Skip to content

Commit

Permalink
enhanced user properties
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed Jun 5, 2024
1 parent ab78abd commit 64117ae
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
25 changes: 24 additions & 1 deletion packages/clients/walkerjs/src/__tests__/commands.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { WebClient } from '..';
import type { WalkerOS } from '@elbwalker/types';
import { elb, Walkerjs } from '..';
import { mockDataLayer } from '@elbwalker/jest/web.setup';
import type { WebClient } from '..';

describe('Commands', () => {
let walkerjs: WebClient.Instance;
Expand Down Expand Up @@ -80,6 +81,28 @@ describe('Commands', () => {
},
}),
);

const user: WalkerOS.User = {
userAgent: 'Mozilla...',
browser: 'Chrome',
browserVersion: '90',
deviceType: 'desktop',
language: 'de-DE',
country: 'DE',
region: 'HH',
city: 'Hamburg',
timezone: 'Berlin',
os: 'walkerOS',
osVersion: '1.0',
screenSize: '1337x420',
ip: 'xxx',
internal: true,
custom: 'value',
};
elb('walker user', user);
expect(walkerjs.user).toStrictEqual(
expect.objectContaining({ ...user, id: 'userId' }),
);
});

test('walker consent', () => {
Expand Down
18 changes: 17 additions & 1 deletion packages/types/src/walkeros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,27 @@ export type Commands =
| 'walker'
| string;

export interface User {
export interface User extends Properties {
// IDs
id?: string;
device?: string;
session?: string;
hash?: string;
// User related
userAgent?: string;
browser?: string;
browserVersion?: string;
deviceType?: string;
language?: string;
country?: string;
region?: string;
city?: string;
timezone?: string;
os?: string;
osVersion?: string;
screenSize?: string;
ip?: string;
internal?: boolean;
}

export interface Version {
Expand Down

0 comments on commit 64117ae

Please sign in to comment.