Skip to content

Commit

Permalink
fix(browser): allow cookie options to be customized #548 (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-filip authored Aug 24, 2023
1 parent 198f3e5 commit 5c483f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/analytics-browser/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ export const useBrowserConfig = async (
// Step 1: Create identity storage instance
const identityStorage = options.identityStorage || DEFAULT_IDENTITY_STORAGE;
const cookieOptions = {
...options.cookieOptions,
domain:
identityStorage !== DEFAULT_IDENTITY_STORAGE ? '' : options.cookieOptions?.domain ?? (await getTopLevelDomain()),
expiration: 365,
sameSite: 'Lax' as const,
secure: false,
upgrade: true,
...options.cookieOptions,
};
const cookieStorage = createCookieStorage<UserSession>(options.identityStorage, cookieOptions);

Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-browser/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('config', () => {
expiration: 365,
sameSite: 'Lax',
secure: false,
upgrade: true,
upgrade: false,
},
defaultTracking: true,
flushIntervalMillis: 1000,
Expand Down

0 comments on commit 5c483f4

Please sign in to comment.