Skip to content

Commit

Permalink
return session
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed May 31, 2024
1 parent 369d70d commit 3dde050
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/clients/walkerjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export function Walkerjs(
config = {},
...options
}: SessionStartOptions = {}): void | SessionData {
sessionStart({ config: { pulse: true, ...config }, ...options });
return sessionStart({ config: { pulse: true, ...config }, ...options });
}

function setConsent(instance: WebClient.Instance, data: WalkerOS.Consent) {
Expand Down
18 changes: 8 additions & 10 deletions packages/utils/src/web/session/sessionStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ export function sessionStorage(config: SessionStorageConfig = {}): SessionData {
let isStart = true;

// Retrieve or create device ID
const device: string | undefined = tryCatch(
(key: string, age: number, storage: StorageType) => {
let id = storageRead(key, storage);
if (!id) {
id = getId(8); // Create a new device ID
storageWrite(key, id, age, storage); // Write device ID to storage
}
return String(id);
},
)(deviceKey, deviceAge, deviceStorage);
const device = tryCatch((key: string, age: number, storage: StorageType) => {
let id = storageRead(key, storage);
if (!id) {
id = getId(8); // Create a new device ID
storageWrite(key, id, age, storage); // Write device ID to storage
}
return String(id);
})(deviceKey, deviceAge, deviceStorage);

// Retrieve or initialize session data
const existingSession: SessionData =
Expand Down

0 comments on commit 3dde050

Please sign in to comment.