Skip to content

Commit

Permalink
fix!: disable automatic visitor id for client environment
Browse files Browse the repository at this point in the history
since we are defaulting to disable (whereas it was previously enabled),
 we mark the commit as breaking.
  • Loading branch information
nicklasl committed Sep 6, 2024
1 parent 935a195 commit 79396a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Confidence implements EventSender, Trackable, FlagResolver {
//
// @internal
readonly contextChanges: Subscribe<string[]>;
static create({ clientSecret, region, timeout, environment, fetchImplementation, logger, }: ConfidenceOptions): Confidence;
static create({ clientSecret, region, timeout, environment, fetchImplementation, enableVisitorId, logger, }: ConfidenceOptions): Confidence;
get environment(): string;
evaluateFlag(path: string, defaultValue: string): FlagEvaluation<string>;
// (undocumented)
Expand Down Expand Up @@ -52,6 +52,7 @@ export class Confidence implements EventSender, Trackable, FlagResolver {
// @public
export interface ConfidenceOptions {
clientSecret: string;
enableVisitorId?: boolean;
environment: 'client' | 'backend';
// Warning: (ae-forgotten-export) The symbol "SimpleFetch" needs to be exported by the entry point index.d.ts
fetchImplementation?: SimpleFetch;
Expand Down
6 changes: 5 additions & 1 deletion packages/sdk/src/Confidence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface ConfidenceOptions {
fetchImplementation?: SimpleFetch;
/** Resolve timeout */
timeout: number;
/** If the visitorId should be enabled and persisted in a cookie */
enableVisitorId?: boolean;
/** Debug logger */
logger?: Logger;
}
Expand Down Expand Up @@ -322,6 +324,7 @@ export class Confidence implements EventSender, Trackable, FlagResolver {
* @param timeout - timeout for flag resolves
* @param environment - can be either "client" or "backend"
* @param fetchImplementation - fetch implementation
* @param enableVisitorId - if visitorId should be enabled
* @param logger - debug logger
* @returns
*/
Expand All @@ -331,6 +334,7 @@ export class Confidence implements EventSender, Trackable, FlagResolver {
timeout,
environment,
fetchImplementation = defaultFetchImplementation(),
enableVisitorId = false,
logger = defaultLogger(),
}: ConfidenceOptions): Confidence {
const sdk = {
Expand Down Expand Up @@ -373,7 +377,7 @@ export class Confidence implements EventSender, Trackable, FlagResolver {
timeout,
logger,
});
if (environment === 'client') {
if (environment === 'client' && enableVisitorId) {
root.track(visitorIdentity());
}
return root;
Expand Down

0 comments on commit 79396a7

Please sign in to comment.