@uniformdev/context 19.201.1 → 19.202.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { aC as paths$7, N as ManifestV2 } from '../types-WXZBuJXL.mjs';
1
+ import { aC as paths$7, N as ManifestV2 } from '../types-yhnsCpvC.mjs';
2
2
  import 'mitt';
3
3
 
4
4
  type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
package/dist/api/api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { aC as paths$7, N as ManifestV2 } from '../types-WXZBuJXL.js';
1
+ import { aC as paths$7, N as ManifestV2 } from '../types-yhnsCpvC.js';
2
2
  import 'mitt';
3
3
 
4
4
  type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
package/dist/api/api.js CHANGED
@@ -229,7 +229,7 @@ async function handleRateLimits(callApi) {
229
229
  if (typeof serverTime === "number" && typeof resetTime === "number") {
230
230
  resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
231
231
  }
232
- } catch (err) {
232
+ } catch (e) {
233
233
  }
234
234
  const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
235
235
  const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
package/dist/api/api.mjs CHANGED
@@ -164,7 +164,7 @@ async function handleRateLimits(callApi) {
164
164
  if (typeof serverTime === "number" && typeof resetTime === "number") {
165
165
  resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
166
166
  }
167
- } catch (err) {
167
+ } catch (e) {
168
168
  }
169
169
  const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
170
170
  const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, g as DevToolsEvents } from './types-WXZBuJXL.mjs';
2
- export { _ as AggregateDimensionInput, a4 as BehaviorTag, h as CONTEXTUAL_EDITING_TEST_NAME, i as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, n as Context, l as ContextEvents, m as ContextInstance, j as ContextOptions, az as ContextState, aA as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, an as DecayOptions, q as DevToolsActions, t as DevToolsDataEvent, r as DevToolsEvent, x as DevToolsForgetEvent, u as DevToolsHelloEvent, s as DevToolsLogEvent, w as DevToolsRawCommandsEvent, p as DevToolsState, o as DevToolsUiVersion, v as DevToolsUpdateEvent, a1 as DimensionMatch, X as EnrichmentCategory, au as EnrichmentData, ax as EventData, aB as GoalStateUpdate, at as Goals, H as GroupCriteriaEvaluator, ag as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, ab as ModifyScoreCommand, ac as ModifySessionScoreCommand, Y as NumberMatch, P as PersonalizationEvent, Q as PersonalizationManifest, av as PersonalizeControlVariant, a2 as PersonalizeOptions, aw as PersonalizeVariants, a6 as PersonalizedResult, a5 as PersonalizedVariant, ar as Quirks, al as SERVER_STATE_ID, ak as ServerToClientTransitionState, ad as SetConsentCommand, ah as SetControlGroupCommand, aa as SetGoalCommand, ai as SetPersonalizeVariantControlCommand, ae as SetQuirkCommand, af as SetTestCommand, z as Severity, R as Signal, W as SignalCriteria, U as SignalCriteriaGroup, K as SignalData, a9 as StorageCommand, Z as TestDefinition, k as TestEvent, $ as TestOptions, a8 as TestResult, a7 as TestVariant, as as Tests, am as TransitionDataStoreEvents, aq as VisitorDataStore, ap as VisitorDataStoreEvents, ao as VisitorDataStoreOptions, aj as areCommandsEqual, ay as emptyVisitorData, a3 as personalizeVariations, a0 as testVariations } from './types-WXZBuJXL.mjs';
1
+ import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, g as DevToolsEvents } from './types-yhnsCpvC.mjs';
2
+ export { $ as AggregateDimensionInput, a5 as BehaviorTag, h as CONTEXTUAL_EDITING_TEST_NAME, i as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, n as Context, l as ContextEvents, m as ContextInstance, j as ContextOptions, az as ContextState, aA as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, ao as DecayOptions, q as DevToolsActions, t as DevToolsDataEvent, r as DevToolsEvent, x as DevToolsForgetEvent, u as DevToolsHelloEvent, s as DevToolsLogEvent, w as DevToolsRawCommandsEvent, p as DevToolsState, o as DevToolsUiVersion, v as DevToolsUpdateEvent, a2 as DimensionMatch, Y as EnrichmentCategory, au as EnrichmentData, ax as EventData, aB as GoalStateUpdate, at as Goals, H as GroupCriteriaEvaluator, ah as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, ac as ModifyScoreCommand, ad as ModifySessionScoreCommand, Z as NumberMatch, P as PersonalizationEvent, R as PersonalizationManifest, av as PersonalizeControlVariant, a3 as PersonalizeOptions, aw as PersonalizeVariants, a7 as PersonalizedResult, a6 as PersonalizedVariant, am as SERVER_STATE_ID, al as ServerToClientTransitionState, ae as SetConsentCommand, ai as SetControlGroupCommand, ab as SetGoalCommand, aj as SetPersonalizeVariantControlCommand, af as SetQuirkCommand, ag as SetTestCommand, z as Severity, U as Signal, X as SignalCriteria, W as SignalCriteriaGroup, K as SignalData, aa as StorageCommand, _ as TestDefinition, k as TestEvent, a0 as TestOptions, a9 as TestResult, a8 as TestVariant, as as Tests, an as TransitionDataStoreEvents, ar as VisitorDataStore, aq as VisitorDataStoreEvents, ap as VisitorDataStoreOptions, ak as areCommandsEqual, ay as emptyVisitorData, a4 as personalizeVariations, a1 as testVariations } from './types-yhnsCpvC.mjs';
3
3
  import Cookies from 'js-cookie';
4
4
  import 'mitt';
5
5
 
@@ -27,11 +27,27 @@ type CookieTransitionDataStoreOptions = {
27
27
  * IMPORTANT: If not passed, the transition store will not have any effect during SSR.
28
28
  */
29
29
  serverCookieValue?: string;
30
+ /**
31
+ * @deprecated
32
+ * The value of the quirk cookie during server-side rendering.
33
+ */
34
+ quirkCookieValue?: string;
35
+ /**
36
+ * @deprecated
37
+ * Whether to enable the experimental quirks feature.
38
+ */
39
+ experimental_quirksEnabled?: boolean;
30
40
  /**
31
41
  * The name of the cookie to store client-to-server score information in.
32
42
  * Defaults to UNIFORM_DEFAULT_COOKIE_NAME if not set.
33
43
  */
34
44
  cookieName?: string;
45
+ /**
46
+ * @deprecated
47
+ * The name of the cookie to store quirks in.
48
+ * Defaults to UNIFORM_DEFAULT_QUIRK_COOKIE_NAME if not set.
49
+ */
50
+ quirkCookieName?: string;
35
51
  /**
36
52
  * Attributes to set on the transfer cookie.
37
53
  * Persistence is not necessary, because the data is only used for temporary transition;
@@ -40,20 +56,23 @@ type CookieTransitionDataStoreOptions = {
40
56
  cookieAttributes?: Cookies.CookieAttributes;
41
57
  };
42
58
  declare const UNIFORM_DEFAULT_COOKIE_NAME = "ufvd";
59
+ declare const UNIFORM_DEFAULT_QUIRK_COOKIE_NAME = "ufvdqk";
43
60
  /**
44
61
  * Handles client-to-server score handoff using an encoded cookie with the visitor score vector.
45
62
  * NOTE: forget me is not supported when on the server side.
46
63
  */
47
64
  declare class CookieTransitionDataStore extends TransitionDataStore {
48
65
  #private;
49
- constructor({ serverCookieValue, cookieName, cookieAttributes, }: CookieTransitionDataStoreOptions);
66
+ constructor({ serverCookieValue, experimental_quirksEnabled, quirkCookieValue, quirkCookieName, cookieName, cookieAttributes, }: CookieTransitionDataStoreOptions);
50
67
  handleDelete(): Promise<void>;
51
68
  handleUpdateData(_: StorageCommands[], computedValue: VisitorData): Promise<void>;
52
69
  }
53
70
  declare const TYPE_SEP = "~";
54
71
  declare const PAIR_SEP = "!";
55
72
  declare const KV_SEP = "-";
56
- declare function parseScoreCookie(cookieValue: string | undefined): Partial<VisitorData> | undefined;
73
+ declare const QUIRK_SEP = "!!";
74
+ declare function parseScoreCookie(cookieValue: string | undefined, quirkCookieValue?: string): Partial<VisitorData> | undefined;
75
+ declare function parseQuirkCookie(quirkCookieValue: string): Quirks;
57
76
  declare function parseCookieScores(type: string | undefined): Record<string, string>;
58
77
  declare function parseCookieType(type: string | undefined): Record<string, string>;
59
78
  declare function decodeCookieType(type: Record<string, string>): Record<string, number>;
@@ -62,6 +81,7 @@ declare function serializePersonalizeVariants({ personalizeVariants, }: Pick<Vis
62
81
  declare function decodePersonalizeVariants(data: string | undefined): VisitorData['personalizeVariants'];
63
82
  declare function encodeCookieType(type: Record<string, number>): Record<string, string>;
64
83
  declare function serializeCookieType(type: Record<string, string>): string;
84
+ declare function serializeQuirks(quirks: Quirks): string;
65
85
 
66
86
  type EdgeTransitionDataStoreOptions = TransitionDataStoreOptions & {
67
87
  serverCookieValue?: string;
@@ -189,4 +209,4 @@ type QuickConnectConfig = {
189
209
  declare function serializeQuickConnect(config: QuickConnectConfig): string;
190
210
  declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
191
211
 
192
- export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, KV_SEP, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, PAIR_SEP, type QuickConnectConfig, ScoreVector, ScriptType, StorageCommands, StringMatch, TYPE_SEP, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, decodeCookieType, decodePersonalizeVariants, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, encodeCookieType, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseCookieScores, parseCookieType, parseQuickConnect, parseScoreCookie, queryStringEvaluator, quirkEvaluator, serializeCookie, serializeCookieType, serializePersonalizeVariants, serializeQuickConnect };
212
+ export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, KV_SEP, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, PAIR_SEP, QUIRK_SEP, type QuickConnectConfig, Quirks, ScoreVector, ScriptType, StorageCommands, StringMatch, TYPE_SEP, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, UNIFORM_DEFAULT_QUIRK_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, decodeCookieType, decodePersonalizeVariants, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, encodeCookieType, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseCookieScores, parseCookieType, parseQuickConnect, parseQuirkCookie, parseScoreCookie, queryStringEvaluator, quirkEvaluator, serializeCookie, serializeCookieType, serializePersonalizeVariants, serializeQuickConnect, serializeQuirks };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, g as DevToolsEvents } from './types-WXZBuJXL.js';
2
- export { _ as AggregateDimensionInput, a4 as BehaviorTag, h as CONTEXTUAL_EDITING_TEST_NAME, i as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, n as Context, l as ContextEvents, m as ContextInstance, j as ContextOptions, az as ContextState, aA as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, an as DecayOptions, q as DevToolsActions, t as DevToolsDataEvent, r as DevToolsEvent, x as DevToolsForgetEvent, u as DevToolsHelloEvent, s as DevToolsLogEvent, w as DevToolsRawCommandsEvent, p as DevToolsState, o as DevToolsUiVersion, v as DevToolsUpdateEvent, a1 as DimensionMatch, X as EnrichmentCategory, au as EnrichmentData, ax as EventData, aB as GoalStateUpdate, at as Goals, H as GroupCriteriaEvaluator, ag as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, ab as ModifyScoreCommand, ac as ModifySessionScoreCommand, Y as NumberMatch, P as PersonalizationEvent, Q as PersonalizationManifest, av as PersonalizeControlVariant, a2 as PersonalizeOptions, aw as PersonalizeVariants, a6 as PersonalizedResult, a5 as PersonalizedVariant, ar as Quirks, al as SERVER_STATE_ID, ak as ServerToClientTransitionState, ad as SetConsentCommand, ah as SetControlGroupCommand, aa as SetGoalCommand, ai as SetPersonalizeVariantControlCommand, ae as SetQuirkCommand, af as SetTestCommand, z as Severity, R as Signal, W as SignalCriteria, U as SignalCriteriaGroup, K as SignalData, a9 as StorageCommand, Z as TestDefinition, k as TestEvent, $ as TestOptions, a8 as TestResult, a7 as TestVariant, as as Tests, am as TransitionDataStoreEvents, aq as VisitorDataStore, ap as VisitorDataStoreEvents, ao as VisitorDataStoreOptions, aj as areCommandsEqual, ay as emptyVisitorData, a3 as personalizeVariations, a0 as testVariations } from './types-WXZBuJXL.js';
1
+ import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, g as DevToolsEvents } from './types-yhnsCpvC.js';
2
+ export { $ as AggregateDimensionInput, a5 as BehaviorTag, h as CONTEXTUAL_EDITING_TEST_NAME, i as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, n as Context, l as ContextEvents, m as ContextInstance, j as ContextOptions, az as ContextState, aA as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, ao as DecayOptions, q as DevToolsActions, t as DevToolsDataEvent, r as DevToolsEvent, x as DevToolsForgetEvent, u as DevToolsHelloEvent, s as DevToolsLogEvent, w as DevToolsRawCommandsEvent, p as DevToolsState, o as DevToolsUiVersion, v as DevToolsUpdateEvent, a2 as DimensionMatch, Y as EnrichmentCategory, au as EnrichmentData, ax as EventData, aB as GoalStateUpdate, at as Goals, H as GroupCriteriaEvaluator, ah as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, ac as ModifyScoreCommand, ad as ModifySessionScoreCommand, Z as NumberMatch, P as PersonalizationEvent, R as PersonalizationManifest, av as PersonalizeControlVariant, a3 as PersonalizeOptions, aw as PersonalizeVariants, a7 as PersonalizedResult, a6 as PersonalizedVariant, am as SERVER_STATE_ID, al as ServerToClientTransitionState, ae as SetConsentCommand, ai as SetControlGroupCommand, ab as SetGoalCommand, aj as SetPersonalizeVariantControlCommand, af as SetQuirkCommand, ag as SetTestCommand, z as Severity, U as Signal, X as SignalCriteria, W as SignalCriteriaGroup, K as SignalData, aa as StorageCommand, _ as TestDefinition, k as TestEvent, a0 as TestOptions, a9 as TestResult, a8 as TestVariant, as as Tests, an as TransitionDataStoreEvents, ar as VisitorDataStore, aq as VisitorDataStoreEvents, ap as VisitorDataStoreOptions, ak as areCommandsEqual, ay as emptyVisitorData, a4 as personalizeVariations, a1 as testVariations } from './types-yhnsCpvC.js';
3
3
  import Cookies from 'js-cookie';
4
4
  import 'mitt';
5
5
 
@@ -27,11 +27,27 @@ type CookieTransitionDataStoreOptions = {
27
27
  * IMPORTANT: If not passed, the transition store will not have any effect during SSR.
28
28
  */
29
29
  serverCookieValue?: string;
30
+ /**
31
+ * @deprecated
32
+ * The value of the quirk cookie during server-side rendering.
33
+ */
34
+ quirkCookieValue?: string;
35
+ /**
36
+ * @deprecated
37
+ * Whether to enable the experimental quirks feature.
38
+ */
39
+ experimental_quirksEnabled?: boolean;
30
40
  /**
31
41
  * The name of the cookie to store client-to-server score information in.
32
42
  * Defaults to UNIFORM_DEFAULT_COOKIE_NAME if not set.
33
43
  */
34
44
  cookieName?: string;
45
+ /**
46
+ * @deprecated
47
+ * The name of the cookie to store quirks in.
48
+ * Defaults to UNIFORM_DEFAULT_QUIRK_COOKIE_NAME if not set.
49
+ */
50
+ quirkCookieName?: string;
35
51
  /**
36
52
  * Attributes to set on the transfer cookie.
37
53
  * Persistence is not necessary, because the data is only used for temporary transition;
@@ -40,20 +56,23 @@ type CookieTransitionDataStoreOptions = {
40
56
  cookieAttributes?: Cookies.CookieAttributes;
41
57
  };
42
58
  declare const UNIFORM_DEFAULT_COOKIE_NAME = "ufvd";
59
+ declare const UNIFORM_DEFAULT_QUIRK_COOKIE_NAME = "ufvdqk";
43
60
  /**
44
61
  * Handles client-to-server score handoff using an encoded cookie with the visitor score vector.
45
62
  * NOTE: forget me is not supported when on the server side.
46
63
  */
47
64
  declare class CookieTransitionDataStore extends TransitionDataStore {
48
65
  #private;
49
- constructor({ serverCookieValue, cookieName, cookieAttributes, }: CookieTransitionDataStoreOptions);
66
+ constructor({ serverCookieValue, experimental_quirksEnabled, quirkCookieValue, quirkCookieName, cookieName, cookieAttributes, }: CookieTransitionDataStoreOptions);
50
67
  handleDelete(): Promise<void>;
51
68
  handleUpdateData(_: StorageCommands[], computedValue: VisitorData): Promise<void>;
52
69
  }
53
70
  declare const TYPE_SEP = "~";
54
71
  declare const PAIR_SEP = "!";
55
72
  declare const KV_SEP = "-";
56
- declare function parseScoreCookie(cookieValue: string | undefined): Partial<VisitorData> | undefined;
73
+ declare const QUIRK_SEP = "!!";
74
+ declare function parseScoreCookie(cookieValue: string | undefined, quirkCookieValue?: string): Partial<VisitorData> | undefined;
75
+ declare function parseQuirkCookie(quirkCookieValue: string): Quirks;
57
76
  declare function parseCookieScores(type: string | undefined): Record<string, string>;
58
77
  declare function parseCookieType(type: string | undefined): Record<string, string>;
59
78
  declare function decodeCookieType(type: Record<string, string>): Record<string, number>;
@@ -62,6 +81,7 @@ declare function serializePersonalizeVariants({ personalizeVariants, }: Pick<Vis
62
81
  declare function decodePersonalizeVariants(data: string | undefined): VisitorData['personalizeVariants'];
63
82
  declare function encodeCookieType(type: Record<string, number>): Record<string, string>;
64
83
  declare function serializeCookieType(type: Record<string, string>): string;
84
+ declare function serializeQuirks(quirks: Quirks): string;
65
85
 
66
86
  type EdgeTransitionDataStoreOptions = TransitionDataStoreOptions & {
67
87
  serverCookieValue?: string;
@@ -189,4 +209,4 @@ type QuickConnectConfig = {
189
209
  declare function serializeQuickConnect(config: QuickConnectConfig): string;
190
210
  declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
191
211
 
192
- export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, KV_SEP, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, PAIR_SEP, type QuickConnectConfig, ScoreVector, ScriptType, StorageCommands, StringMatch, TYPE_SEP, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, decodeCookieType, decodePersonalizeVariants, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, encodeCookieType, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseCookieScores, parseCookieType, parseQuickConnect, parseScoreCookie, queryStringEvaluator, quirkEvaluator, serializeCookie, serializeCookieType, serializePersonalizeVariants, serializeQuickConnect };
212
+ export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, KV_SEP, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, PAIR_SEP, QUIRK_SEP, type QuickConnectConfig, Quirks, ScoreVector, ScriptType, StorageCommands, StringMatch, TYPE_SEP, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, UNIFORM_DEFAULT_QUIRK_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, decodeCookieType, decodePersonalizeVariants, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, encodeCookieType, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseCookieScores, parseCookieType, parseQuickConnect, parseQuirkCookie, parseScoreCookie, queryStringEvaluator, quirkEvaluator, serializeCookie, serializeCookieType, serializePersonalizeVariants, serializeQuickConnect, serializeQuirks };
package/dist/index.esm.js CHANGED
@@ -653,9 +653,11 @@ function personalizeVariations({
653
653
  try {
654
654
  const variantMatches = [];
655
655
  const defaultVariants = [];
656
+ const needsConsent = context.requireConsentForPersonalization;
657
+ const canEvaluate = !needsConsent || context.storage.data.consent;
656
658
  for (const variant of variations) {
657
659
  if ((_a = variant.pz) == null ? void 0 : _a.crit.length) {
658
- if (variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
660
+ if (canEvaluate && variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
659
661
  variantMatches.push(variant);
660
662
  }
661
663
  } else {
@@ -917,20 +919,28 @@ var bton = (base64) => {
917
919
  // src/storage/CookieTransitionDataStore.ts
918
920
  var ssr = typeof document === "undefined";
919
921
  var UNIFORM_DEFAULT_COOKIE_NAME = "ufvd";
920
- var _cookieName, _cookieAttributes;
922
+ var UNIFORM_DEFAULT_QUIRK_COOKIE_NAME = `ufvdqk`;
923
+ var _cookieName, _quirkCookieName, _cookieAttributes, _quirksEnabled;
921
924
  var CookieTransitionDataStore = class extends TransitionDataStore {
922
925
  constructor({
923
926
  serverCookieValue,
927
+ experimental_quirksEnabled,
928
+ quirkCookieValue,
929
+ quirkCookieName = UNIFORM_DEFAULT_QUIRK_COOKIE_NAME,
924
930
  cookieName = UNIFORM_DEFAULT_COOKIE_NAME,
925
931
  cookieAttributes = { sameSite: "lax" }
926
932
  }) {
927
933
  super({
928
- initialData: ssr ? parseScoreCookie(serverCookieValue) : void 0
934
+ initialData: ssr ? parseScoreCookie(serverCookieValue, experimental_quirksEnabled ? quirkCookieValue : void 0) : void 0
929
935
  });
930
936
  __privateAdd(this, _cookieName);
937
+ __privateAdd(this, _quirkCookieName);
931
938
  __privateAdd(this, _cookieAttributes);
939
+ __privateAdd(this, _quirksEnabled);
932
940
  __privateSet(this, _cookieName, cookieName);
933
941
  __privateSet(this, _cookieAttributes, cookieAttributes);
942
+ __privateSet(this, _quirkCookieName, quirkCookieName);
943
+ __privateSet(this, _quirksEnabled, experimental_quirksEnabled || false);
934
944
  }
935
945
  handleDelete() {
936
946
  if (ssr) return Promise.resolve();
@@ -941,17 +951,27 @@ var CookieTransitionDataStore = class extends TransitionDataStore {
941
951
  if (ssr) return;
942
952
  if (computedValue.consent) {
943
953
  Cookies.set(__privateGet(this, _cookieName), serializeCookie(computedValue), __privateGet(this, _cookieAttributes));
954
+ if (__privateGet(this, _quirksEnabled) && Object.keys(computedValue.quirks || {}).length) {
955
+ const quirkCookieValue = serializeQuirks(computedValue.quirks || {});
956
+ Cookies.set(__privateGet(this, _quirkCookieName), quirkCookieValue, __privateGet(this, _cookieAttributes));
957
+ }
944
958
  } else {
945
959
  Cookies.remove(__privateGet(this, _cookieName));
960
+ if (__privateGet(this, _quirksEnabled)) {
961
+ Cookies.remove(__privateGet(this, _quirkCookieName));
962
+ }
946
963
  }
947
964
  }
948
965
  };
949
966
  _cookieName = new WeakMap();
967
+ _quirkCookieName = new WeakMap();
950
968
  _cookieAttributes = new WeakMap();
969
+ _quirksEnabled = new WeakMap();
951
970
  var TYPE_SEP = "~";
952
971
  var PAIR_SEP = "!";
953
972
  var KV_SEP = "-";
954
- function parseScoreCookie(cookieValue) {
973
+ var QUIRK_SEP = "!!";
974
+ function parseScoreCookie(cookieValue, quirkCookieValue) {
955
975
  if (!cookieValue) return;
956
976
  const types = cookieValue.split(TYPE_SEP);
957
977
  if (types.length > 5) return;
@@ -965,8 +985,30 @@ function parseScoreCookie(cookieValue) {
965
985
  controlGroup: controlGroup === "1",
966
986
  personalizeVariants: decodePersonalizeVariants(personalizeVariants)
967
987
  };
988
+ if (quirkCookieValue) {
989
+ data.quirks = parseQuirkCookie(quirkCookieValue);
990
+ }
968
991
  return data;
969
992
  }
993
+ function parseQuirkCookie(quirkCookieValue) {
994
+ const pairs = quirkCookieValue.split(QUIRK_SEP);
995
+ const splitPairs = pairs.map((pair) => {
996
+ const sep = pair.indexOf(KV_SEP);
997
+ if (sep === -1) {
998
+ return void 0;
999
+ }
1000
+ return [pair.slice(0, sep), pair.slice(sep + 1)];
1001
+ });
1002
+ const areAllPairsValid = splitPairs.every((pair) => pair !== void 0);
1003
+ if (!areAllPairsValid) {
1004
+ return {};
1005
+ }
1006
+ return splitPairs.reduce((acc, cur) => {
1007
+ const [key, value] = cur;
1008
+ acc[key] = value;
1009
+ return acc;
1010
+ }, {});
1011
+ }
970
1012
  function parseCookieScores(type) {
971
1013
  if (!type) {
972
1014
  return {};
@@ -1051,6 +1093,9 @@ function encodeCookieType(type) {
1051
1093
  function serializeCookieType(type) {
1052
1094
  return Object.entries(type).map((kv) => kv.join(KV_SEP)).join(PAIR_SEP);
1053
1095
  }
1096
+ function serializeQuirks(quirks) {
1097
+ return Object.entries(quirks).map((kv) => kv.join(KV_SEP)).join(QUIRK_SEP);
1098
+ }
1054
1099
 
1055
1100
  // src/storage/EdgeTransitionDataStore.ts
1056
1101
  var _EdgeTransitionDataStore_instances, fetchData_fn;
@@ -1213,7 +1258,8 @@ var LocalStorage = class {
1213
1258
  this.partitionKey = partitionKey;
1214
1259
  __privateAdd(this, _LocalStorage_instances);
1215
1260
  __publicField(this, "inMemoryFallback", {});
1216
- __publicField(this, "hasLocalStorageObject", typeof localStorage !== "undefined");
1261
+ // deno implements localStorage in netlify edge workers, must also check if document is present.
1262
+ __publicField(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
1217
1263
  }
1218
1264
  get(key) {
1219
1265
  const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
@@ -1467,7 +1513,7 @@ import { dequal as dequal5 } from "dequal/lite";
1467
1513
  import mitt3 from "mitt";
1468
1514
  var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
1469
1515
  var CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_test_selected_variant";
1470
- var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
1516
+ var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _requireConsentForPersonalization, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
1471
1517
  var Context = class {
1472
1518
  constructor(options) {
1473
1519
  __privateAdd(this, _Context_instances);
@@ -1478,6 +1524,7 @@ var Context = class {
1478
1524
  __privateAdd(this, _pzCache, {});
1479
1525
  __privateAdd(this, _plugins);
1480
1526
  __privateAdd(this, _commands);
1527
+ __privateAdd(this, _requireConsentForPersonalization);
1481
1528
  __privateAdd(this, _mitt3, mitt3());
1482
1529
  /**
1483
1530
  * Subscribe to events
@@ -1491,6 +1538,7 @@ var Context = class {
1491
1538
  const { manifest, ...storageOptions } = options;
1492
1539
  __privateSet(this, _state, {});
1493
1540
  __privateSet(this, _plugins, options.plugins);
1541
+ __privateSet(this, _requireConsentForPersonalization, options.requireConsentForPersonalization);
1494
1542
  if (typeof options.transitionStore !== "undefined") {
1495
1543
  __privateSet(this, _commands, []);
1496
1544
  }
@@ -1567,6 +1615,9 @@ var Context = class {
1567
1615
  var _a, _b;
1568
1616
  return (_b = (_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) != null ? _b : this.storage.data.quirks;
1569
1617
  }
1618
+ get requireConsentForPersonalization() {
1619
+ return __privateGet(this, _requireConsentForPersonalization);
1620
+ }
1570
1621
  /**
1571
1622
  * Updates the Context with new data of any sort, such as
1572
1623
  * new URLs, cookies, quirks, and enrichments.
@@ -1765,9 +1816,7 @@ var Context = class {
1765
1816
  test(options) {
1766
1817
  var _a, _b, _c;
1767
1818
  if (options.name === CONTEXTUAL_EDITING_TEST_NAME) {
1768
- const selectedVariant = (_a = options.variations.find((variant) => {
1769
- variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID;
1770
- })) != null ? _a : options.variations.at(-1);
1819
+ const selectedVariant = (_a = options.variations.find((variant) => variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID)) != null ? _a : options.variations.at(-1);
1771
1820
  const value2 = {
1772
1821
  result: selectedVariant,
1773
1822
  variantAssigned: false
@@ -1868,6 +1917,7 @@ _state = new WeakMap();
1868
1917
  _pzCache = new WeakMap();
1869
1918
  _plugins = new WeakMap();
1870
1919
  _commands = new WeakMap();
1920
+ _requireConsentForPersonalization = new WeakMap();
1871
1921
  _mitt3 = new WeakMap();
1872
1922
  _Context_instances = new WeakSet();
1873
1923
  emitTest_fn = function(event) {
@@ -2550,11 +2600,13 @@ export {
2550
2600
  KV_SEP,
2551
2601
  ManifestInstance,
2552
2602
  PAIR_SEP,
2603
+ QUIRK_SEP,
2553
2604
  SERVER_STATE_ID,
2554
2605
  ScriptType,
2555
2606
  TYPE_SEP,
2556
2607
  TransitionDataStore,
2557
2608
  UNIFORM_DEFAULT_COOKIE_NAME,
2609
+ UNIFORM_DEFAULT_QUIRK_COOKIE_NAME,
2558
2610
  VisitorDataStore,
2559
2611
  areCommandsEqual,
2560
2612
  computeAggregateDimensions,
@@ -2582,6 +2634,7 @@ export {
2582
2634
  parseCookieScores,
2583
2635
  parseCookieType,
2584
2636
  parseQuickConnect,
2637
+ parseQuirkCookie,
2585
2638
  parseScoreCookie,
2586
2639
  personalizeVariations,
2587
2640
  queryStringEvaluator,
@@ -2590,5 +2643,6 @@ export {
2590
2643
  serializeCookieType,
2591
2644
  serializePersonalizeVariants,
2592
2645
  serializeQuickConnect,
2646
+ serializeQuirks,
2593
2647
  testVariations
2594
2648
  };
package/dist/index.js CHANGED
@@ -50,11 +50,13 @@ __export(src_exports, {
50
50
  KV_SEP: () => KV_SEP,
51
51
  ManifestInstance: () => ManifestInstance,
52
52
  PAIR_SEP: () => PAIR_SEP,
53
+ QUIRK_SEP: () => QUIRK_SEP,
53
54
  SERVER_STATE_ID: () => SERVER_STATE_ID,
54
55
  ScriptType: () => ScriptType,
55
56
  TYPE_SEP: () => TYPE_SEP,
56
57
  TransitionDataStore: () => TransitionDataStore,
57
58
  UNIFORM_DEFAULT_COOKIE_NAME: () => UNIFORM_DEFAULT_COOKIE_NAME,
59
+ UNIFORM_DEFAULT_QUIRK_COOKIE_NAME: () => UNIFORM_DEFAULT_QUIRK_COOKIE_NAME,
58
60
  VisitorDataStore: () => VisitorDataStore,
59
61
  areCommandsEqual: () => areCommandsEqual,
60
62
  computeAggregateDimensions: () => computeAggregateDimensions,
@@ -82,6 +84,7 @@ __export(src_exports, {
82
84
  parseCookieScores: () => parseCookieScores,
83
85
  parseCookieType: () => parseCookieType,
84
86
  parseQuickConnect: () => parseQuickConnect,
87
+ parseQuirkCookie: () => parseQuirkCookie,
85
88
  parseScoreCookie: () => parseScoreCookie,
86
89
  personalizeVariations: () => personalizeVariations,
87
90
  queryStringEvaluator: () => queryStringEvaluator,
@@ -90,6 +93,7 @@ __export(src_exports, {
90
93
  serializeCookieType: () => serializeCookieType,
91
94
  serializePersonalizeVariants: () => serializePersonalizeVariants,
92
95
  serializeQuickConnect: () => serializeQuickConnect,
96
+ serializeQuirks: () => serializeQuirks,
93
97
  testVariations: () => testVariations
94
98
  });
95
99
  module.exports = __toCommonJS(src_exports);
@@ -737,9 +741,11 @@ function personalizeVariations({
737
741
  try {
738
742
  const variantMatches = [];
739
743
  const defaultVariants = [];
744
+ const needsConsent = context.requireConsentForPersonalization;
745
+ const canEvaluate = !needsConsent || context.storage.data.consent;
740
746
  for (const variant of variations) {
741
747
  if ((_a = variant.pz) == null ? void 0 : _a.crit.length) {
742
- if (variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
748
+ if (canEvaluate && variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
743
749
  variantMatches.push(variant);
744
750
  }
745
751
  } else {
@@ -1001,20 +1007,28 @@ var bton = (base64) => {
1001
1007
  // src/storage/CookieTransitionDataStore.ts
1002
1008
  var ssr = typeof document === "undefined";
1003
1009
  var UNIFORM_DEFAULT_COOKIE_NAME = "ufvd";
1004
- var _cookieName, _cookieAttributes;
1010
+ var UNIFORM_DEFAULT_QUIRK_COOKIE_NAME = `ufvdqk`;
1011
+ var _cookieName, _quirkCookieName, _cookieAttributes, _quirksEnabled;
1005
1012
  var CookieTransitionDataStore = class extends TransitionDataStore {
1006
1013
  constructor({
1007
1014
  serverCookieValue,
1015
+ experimental_quirksEnabled,
1016
+ quirkCookieValue,
1017
+ quirkCookieName = UNIFORM_DEFAULT_QUIRK_COOKIE_NAME,
1008
1018
  cookieName = UNIFORM_DEFAULT_COOKIE_NAME,
1009
1019
  cookieAttributes = { sameSite: "lax" }
1010
1020
  }) {
1011
1021
  super({
1012
- initialData: ssr ? parseScoreCookie(serverCookieValue) : void 0
1022
+ initialData: ssr ? parseScoreCookie(serverCookieValue, experimental_quirksEnabled ? quirkCookieValue : void 0) : void 0
1013
1023
  });
1014
1024
  __privateAdd(this, _cookieName);
1025
+ __privateAdd(this, _quirkCookieName);
1015
1026
  __privateAdd(this, _cookieAttributes);
1027
+ __privateAdd(this, _quirksEnabled);
1016
1028
  __privateSet(this, _cookieName, cookieName);
1017
1029
  __privateSet(this, _cookieAttributes, cookieAttributes);
1030
+ __privateSet(this, _quirkCookieName, quirkCookieName);
1031
+ __privateSet(this, _quirksEnabled, experimental_quirksEnabled || false);
1018
1032
  }
1019
1033
  handleDelete() {
1020
1034
  if (ssr) return Promise.resolve();
@@ -1025,17 +1039,27 @@ var CookieTransitionDataStore = class extends TransitionDataStore {
1025
1039
  if (ssr) return;
1026
1040
  if (computedValue.consent) {
1027
1041
  import_js_cookie.default.set(__privateGet(this, _cookieName), serializeCookie(computedValue), __privateGet(this, _cookieAttributes));
1042
+ if (__privateGet(this, _quirksEnabled) && Object.keys(computedValue.quirks || {}).length) {
1043
+ const quirkCookieValue = serializeQuirks(computedValue.quirks || {});
1044
+ import_js_cookie.default.set(__privateGet(this, _quirkCookieName), quirkCookieValue, __privateGet(this, _cookieAttributes));
1045
+ }
1028
1046
  } else {
1029
1047
  import_js_cookie.default.remove(__privateGet(this, _cookieName));
1048
+ if (__privateGet(this, _quirksEnabled)) {
1049
+ import_js_cookie.default.remove(__privateGet(this, _quirkCookieName));
1050
+ }
1030
1051
  }
1031
1052
  }
1032
1053
  };
1033
1054
  _cookieName = new WeakMap();
1055
+ _quirkCookieName = new WeakMap();
1034
1056
  _cookieAttributes = new WeakMap();
1057
+ _quirksEnabled = new WeakMap();
1035
1058
  var TYPE_SEP = "~";
1036
1059
  var PAIR_SEP = "!";
1037
1060
  var KV_SEP = "-";
1038
- function parseScoreCookie(cookieValue) {
1061
+ var QUIRK_SEP = "!!";
1062
+ function parseScoreCookie(cookieValue, quirkCookieValue) {
1039
1063
  if (!cookieValue) return;
1040
1064
  const types = cookieValue.split(TYPE_SEP);
1041
1065
  if (types.length > 5) return;
@@ -1049,8 +1073,30 @@ function parseScoreCookie(cookieValue) {
1049
1073
  controlGroup: controlGroup === "1",
1050
1074
  personalizeVariants: decodePersonalizeVariants(personalizeVariants)
1051
1075
  };
1076
+ if (quirkCookieValue) {
1077
+ data.quirks = parseQuirkCookie(quirkCookieValue);
1078
+ }
1052
1079
  return data;
1053
1080
  }
1081
+ function parseQuirkCookie(quirkCookieValue) {
1082
+ const pairs = quirkCookieValue.split(QUIRK_SEP);
1083
+ const splitPairs = pairs.map((pair) => {
1084
+ const sep = pair.indexOf(KV_SEP);
1085
+ if (sep === -1) {
1086
+ return void 0;
1087
+ }
1088
+ return [pair.slice(0, sep), pair.slice(sep + 1)];
1089
+ });
1090
+ const areAllPairsValid = splitPairs.every((pair) => pair !== void 0);
1091
+ if (!areAllPairsValid) {
1092
+ return {};
1093
+ }
1094
+ return splitPairs.reduce((acc, cur) => {
1095
+ const [key, value] = cur;
1096
+ acc[key] = value;
1097
+ return acc;
1098
+ }, {});
1099
+ }
1054
1100
  function parseCookieScores(type) {
1055
1101
  if (!type) {
1056
1102
  return {};
@@ -1135,6 +1181,9 @@ function encodeCookieType(type) {
1135
1181
  function serializeCookieType(type) {
1136
1182
  return Object.entries(type).map((kv) => kv.join(KV_SEP)).join(PAIR_SEP);
1137
1183
  }
1184
+ function serializeQuirks(quirks) {
1185
+ return Object.entries(quirks).map((kv) => kv.join(KV_SEP)).join(QUIRK_SEP);
1186
+ }
1138
1187
 
1139
1188
  // src/storage/EdgeTransitionDataStore.ts
1140
1189
  var _EdgeTransitionDataStore_instances, fetchData_fn;
@@ -1297,7 +1346,8 @@ var LocalStorage = class {
1297
1346
  this.partitionKey = partitionKey;
1298
1347
  __privateAdd(this, _LocalStorage_instances);
1299
1348
  __publicField(this, "inMemoryFallback", {});
1300
- __publicField(this, "hasLocalStorageObject", typeof localStorage !== "undefined");
1349
+ // deno implements localStorage in netlify edge workers, must also check if document is present.
1350
+ __publicField(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
1301
1351
  }
1302
1352
  get(key) {
1303
1353
  const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
@@ -1551,7 +1601,7 @@ var import_lite5 = require("dequal/lite");
1551
1601
  var import_mitt3 = __toESM(require("mitt"));
1552
1602
  var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
1553
1603
  var CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_test_selected_variant";
1554
- var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
1604
+ var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _requireConsentForPersonalization, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
1555
1605
  var Context = class {
1556
1606
  constructor(options) {
1557
1607
  __privateAdd(this, _Context_instances);
@@ -1562,6 +1612,7 @@ var Context = class {
1562
1612
  __privateAdd(this, _pzCache, {});
1563
1613
  __privateAdd(this, _plugins);
1564
1614
  __privateAdd(this, _commands);
1615
+ __privateAdd(this, _requireConsentForPersonalization);
1565
1616
  __privateAdd(this, _mitt3, (0, import_mitt3.default)());
1566
1617
  /**
1567
1618
  * Subscribe to events
@@ -1575,6 +1626,7 @@ var Context = class {
1575
1626
  const { manifest, ...storageOptions } = options;
1576
1627
  __privateSet(this, _state, {});
1577
1628
  __privateSet(this, _plugins, options.plugins);
1629
+ __privateSet(this, _requireConsentForPersonalization, options.requireConsentForPersonalization);
1578
1630
  if (typeof options.transitionStore !== "undefined") {
1579
1631
  __privateSet(this, _commands, []);
1580
1632
  }
@@ -1651,6 +1703,9 @@ var Context = class {
1651
1703
  var _a, _b;
1652
1704
  return (_b = (_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) != null ? _b : this.storage.data.quirks;
1653
1705
  }
1706
+ get requireConsentForPersonalization() {
1707
+ return __privateGet(this, _requireConsentForPersonalization);
1708
+ }
1654
1709
  /**
1655
1710
  * Updates the Context with new data of any sort, such as
1656
1711
  * new URLs, cookies, quirks, and enrichments.
@@ -1849,9 +1904,7 @@ var Context = class {
1849
1904
  test(options) {
1850
1905
  var _a, _b, _c;
1851
1906
  if (options.name === CONTEXTUAL_EDITING_TEST_NAME) {
1852
- const selectedVariant = (_a = options.variations.find((variant) => {
1853
- variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID;
1854
- })) != null ? _a : options.variations.at(-1);
1907
+ const selectedVariant = (_a = options.variations.find((variant) => variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID)) != null ? _a : options.variations.at(-1);
1855
1908
  const value2 = {
1856
1909
  result: selectedVariant,
1857
1910
  variantAssigned: false
@@ -1952,6 +2005,7 @@ _state = new WeakMap();
1952
2005
  _pzCache = new WeakMap();
1953
2006
  _plugins = new WeakMap();
1954
2007
  _commands = new WeakMap();
2008
+ _requireConsentForPersonalization = new WeakMap();
1955
2009
  _mitt3 = new WeakMap();
1956
2010
  _Context_instances = new WeakSet();
1957
2011
  emitTest_fn = function(event) {
@@ -2635,11 +2689,13 @@ function parseQuickConnect(serialized) {
2635
2689
  KV_SEP,
2636
2690
  ManifestInstance,
2637
2691
  PAIR_SEP,
2692
+ QUIRK_SEP,
2638
2693
  SERVER_STATE_ID,
2639
2694
  ScriptType,
2640
2695
  TYPE_SEP,
2641
2696
  TransitionDataStore,
2642
2697
  UNIFORM_DEFAULT_COOKIE_NAME,
2698
+ UNIFORM_DEFAULT_QUIRK_COOKIE_NAME,
2643
2699
  VisitorDataStore,
2644
2700
  areCommandsEqual,
2645
2701
  computeAggregateDimensions,
@@ -2667,6 +2723,7 @@ function parseQuickConnect(serialized) {
2667
2723
  parseCookieScores,
2668
2724
  parseCookieType,
2669
2725
  parseQuickConnect,
2726
+ parseQuirkCookie,
2670
2727
  parseScoreCookie,
2671
2728
  personalizeVariations,
2672
2729
  queryStringEvaluator,
@@ -2675,5 +2732,6 @@ function parseQuickConnect(serialized) {
2675
2732
  serializeCookieType,
2676
2733
  serializePersonalizeVariants,
2677
2734
  serializeQuickConnect,
2735
+ serializeQuirks,
2678
2736
  testVariations
2679
2737
  });
package/dist/index.mjs CHANGED
@@ -653,9 +653,11 @@ function personalizeVariations({
653
653
  try {
654
654
  const variantMatches = [];
655
655
  const defaultVariants = [];
656
+ const needsConsent = context.requireConsentForPersonalization;
657
+ const canEvaluate = !needsConsent || context.storage.data.consent;
656
658
  for (const variant of variations) {
657
659
  if ((_a = variant.pz) == null ? void 0 : _a.crit.length) {
658
- if (variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
660
+ if (canEvaluate && variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
659
661
  variantMatches.push(variant);
660
662
  }
661
663
  } else {
@@ -917,20 +919,28 @@ var bton = (base64) => {
917
919
  // src/storage/CookieTransitionDataStore.ts
918
920
  var ssr = typeof document === "undefined";
919
921
  var UNIFORM_DEFAULT_COOKIE_NAME = "ufvd";
920
- var _cookieName, _cookieAttributes;
922
+ var UNIFORM_DEFAULT_QUIRK_COOKIE_NAME = `ufvdqk`;
923
+ var _cookieName, _quirkCookieName, _cookieAttributes, _quirksEnabled;
921
924
  var CookieTransitionDataStore = class extends TransitionDataStore {
922
925
  constructor({
923
926
  serverCookieValue,
927
+ experimental_quirksEnabled,
928
+ quirkCookieValue,
929
+ quirkCookieName = UNIFORM_DEFAULT_QUIRK_COOKIE_NAME,
924
930
  cookieName = UNIFORM_DEFAULT_COOKIE_NAME,
925
931
  cookieAttributes = { sameSite: "lax" }
926
932
  }) {
927
933
  super({
928
- initialData: ssr ? parseScoreCookie(serverCookieValue) : void 0
934
+ initialData: ssr ? parseScoreCookie(serverCookieValue, experimental_quirksEnabled ? quirkCookieValue : void 0) : void 0
929
935
  });
930
936
  __privateAdd(this, _cookieName);
937
+ __privateAdd(this, _quirkCookieName);
931
938
  __privateAdd(this, _cookieAttributes);
939
+ __privateAdd(this, _quirksEnabled);
932
940
  __privateSet(this, _cookieName, cookieName);
933
941
  __privateSet(this, _cookieAttributes, cookieAttributes);
942
+ __privateSet(this, _quirkCookieName, quirkCookieName);
943
+ __privateSet(this, _quirksEnabled, experimental_quirksEnabled || false);
934
944
  }
935
945
  handleDelete() {
936
946
  if (ssr) return Promise.resolve();
@@ -941,17 +951,27 @@ var CookieTransitionDataStore = class extends TransitionDataStore {
941
951
  if (ssr) return;
942
952
  if (computedValue.consent) {
943
953
  Cookies.set(__privateGet(this, _cookieName), serializeCookie(computedValue), __privateGet(this, _cookieAttributes));
954
+ if (__privateGet(this, _quirksEnabled) && Object.keys(computedValue.quirks || {}).length) {
955
+ const quirkCookieValue = serializeQuirks(computedValue.quirks || {});
956
+ Cookies.set(__privateGet(this, _quirkCookieName), quirkCookieValue, __privateGet(this, _cookieAttributes));
957
+ }
944
958
  } else {
945
959
  Cookies.remove(__privateGet(this, _cookieName));
960
+ if (__privateGet(this, _quirksEnabled)) {
961
+ Cookies.remove(__privateGet(this, _quirkCookieName));
962
+ }
946
963
  }
947
964
  }
948
965
  };
949
966
  _cookieName = new WeakMap();
967
+ _quirkCookieName = new WeakMap();
950
968
  _cookieAttributes = new WeakMap();
969
+ _quirksEnabled = new WeakMap();
951
970
  var TYPE_SEP = "~";
952
971
  var PAIR_SEP = "!";
953
972
  var KV_SEP = "-";
954
- function parseScoreCookie(cookieValue) {
973
+ var QUIRK_SEP = "!!";
974
+ function parseScoreCookie(cookieValue, quirkCookieValue) {
955
975
  if (!cookieValue) return;
956
976
  const types = cookieValue.split(TYPE_SEP);
957
977
  if (types.length > 5) return;
@@ -965,8 +985,30 @@ function parseScoreCookie(cookieValue) {
965
985
  controlGroup: controlGroup === "1",
966
986
  personalizeVariants: decodePersonalizeVariants(personalizeVariants)
967
987
  };
988
+ if (quirkCookieValue) {
989
+ data.quirks = parseQuirkCookie(quirkCookieValue);
990
+ }
968
991
  return data;
969
992
  }
993
+ function parseQuirkCookie(quirkCookieValue) {
994
+ const pairs = quirkCookieValue.split(QUIRK_SEP);
995
+ const splitPairs = pairs.map((pair) => {
996
+ const sep = pair.indexOf(KV_SEP);
997
+ if (sep === -1) {
998
+ return void 0;
999
+ }
1000
+ return [pair.slice(0, sep), pair.slice(sep + 1)];
1001
+ });
1002
+ const areAllPairsValid = splitPairs.every((pair) => pair !== void 0);
1003
+ if (!areAllPairsValid) {
1004
+ return {};
1005
+ }
1006
+ return splitPairs.reduce((acc, cur) => {
1007
+ const [key, value] = cur;
1008
+ acc[key] = value;
1009
+ return acc;
1010
+ }, {});
1011
+ }
970
1012
  function parseCookieScores(type) {
971
1013
  if (!type) {
972
1014
  return {};
@@ -1051,6 +1093,9 @@ function encodeCookieType(type) {
1051
1093
  function serializeCookieType(type) {
1052
1094
  return Object.entries(type).map((kv) => kv.join(KV_SEP)).join(PAIR_SEP);
1053
1095
  }
1096
+ function serializeQuirks(quirks) {
1097
+ return Object.entries(quirks).map((kv) => kv.join(KV_SEP)).join(QUIRK_SEP);
1098
+ }
1054
1099
 
1055
1100
  // src/storage/EdgeTransitionDataStore.ts
1056
1101
  var _EdgeTransitionDataStore_instances, fetchData_fn;
@@ -1213,7 +1258,8 @@ var LocalStorage = class {
1213
1258
  this.partitionKey = partitionKey;
1214
1259
  __privateAdd(this, _LocalStorage_instances);
1215
1260
  __publicField(this, "inMemoryFallback", {});
1216
- __publicField(this, "hasLocalStorageObject", typeof localStorage !== "undefined");
1261
+ // deno implements localStorage in netlify edge workers, must also check if document is present.
1262
+ __publicField(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
1217
1263
  }
1218
1264
  get(key) {
1219
1265
  const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
@@ -1467,7 +1513,7 @@ import { dequal as dequal5 } from "dequal/lite";
1467
1513
  import mitt3 from "mitt";
1468
1514
  var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
1469
1515
  var CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_test_selected_variant";
1470
- var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
1516
+ var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _requireConsentForPersonalization, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
1471
1517
  var Context = class {
1472
1518
  constructor(options) {
1473
1519
  __privateAdd(this, _Context_instances);
@@ -1478,6 +1524,7 @@ var Context = class {
1478
1524
  __privateAdd(this, _pzCache, {});
1479
1525
  __privateAdd(this, _plugins);
1480
1526
  __privateAdd(this, _commands);
1527
+ __privateAdd(this, _requireConsentForPersonalization);
1481
1528
  __privateAdd(this, _mitt3, mitt3());
1482
1529
  /**
1483
1530
  * Subscribe to events
@@ -1491,6 +1538,7 @@ var Context = class {
1491
1538
  const { manifest, ...storageOptions } = options;
1492
1539
  __privateSet(this, _state, {});
1493
1540
  __privateSet(this, _plugins, options.plugins);
1541
+ __privateSet(this, _requireConsentForPersonalization, options.requireConsentForPersonalization);
1494
1542
  if (typeof options.transitionStore !== "undefined") {
1495
1543
  __privateSet(this, _commands, []);
1496
1544
  }
@@ -1567,6 +1615,9 @@ var Context = class {
1567
1615
  var _a, _b;
1568
1616
  return (_b = (_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) != null ? _b : this.storage.data.quirks;
1569
1617
  }
1618
+ get requireConsentForPersonalization() {
1619
+ return __privateGet(this, _requireConsentForPersonalization);
1620
+ }
1570
1621
  /**
1571
1622
  * Updates the Context with new data of any sort, such as
1572
1623
  * new URLs, cookies, quirks, and enrichments.
@@ -1765,9 +1816,7 @@ var Context = class {
1765
1816
  test(options) {
1766
1817
  var _a, _b, _c;
1767
1818
  if (options.name === CONTEXTUAL_EDITING_TEST_NAME) {
1768
- const selectedVariant = (_a = options.variations.find((variant) => {
1769
- variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID;
1770
- })) != null ? _a : options.variations.at(-1);
1819
+ const selectedVariant = (_a = options.variations.find((variant) => variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID)) != null ? _a : options.variations.at(-1);
1771
1820
  const value2 = {
1772
1821
  result: selectedVariant,
1773
1822
  variantAssigned: false
@@ -1868,6 +1917,7 @@ _state = new WeakMap();
1868
1917
  _pzCache = new WeakMap();
1869
1918
  _plugins = new WeakMap();
1870
1919
  _commands = new WeakMap();
1920
+ _requireConsentForPersonalization = new WeakMap();
1871
1921
  _mitt3 = new WeakMap();
1872
1922
  _Context_instances = new WeakSet();
1873
1923
  emitTest_fn = function(event) {
@@ -2550,11 +2600,13 @@ export {
2550
2600
  KV_SEP,
2551
2601
  ManifestInstance,
2552
2602
  PAIR_SEP,
2603
+ QUIRK_SEP,
2553
2604
  SERVER_STATE_ID,
2554
2605
  ScriptType,
2555
2606
  TYPE_SEP,
2556
2607
  TransitionDataStore,
2557
2608
  UNIFORM_DEFAULT_COOKIE_NAME,
2609
+ UNIFORM_DEFAULT_QUIRK_COOKIE_NAME,
2558
2610
  VisitorDataStore,
2559
2611
  areCommandsEqual,
2560
2612
  computeAggregateDimensions,
@@ -2582,6 +2634,7 @@ export {
2582
2634
  parseCookieScores,
2583
2635
  parseCookieType,
2584
2636
  parseQuickConnect,
2637
+ parseQuirkCookie,
2585
2638
  parseScoreCookie,
2586
2639
  personalizeVariations,
2587
2640
  queryStringEvaluator,
@@ -2590,5 +2643,6 @@ export {
2590
2643
  serializeCookieType,
2591
2644
  serializePersonalizeVariants,
2592
2645
  serializeQuickConnect,
2646
+ serializeQuirks,
2593
2647
  testVariations
2594
2648
  };
@@ -80,7 +80,7 @@ declare const emptyVisitorData: () => VisitorData;
80
80
  * Expresses a 'patch' to the Uniform Context state
81
81
  */
82
82
  type ContextState = {
83
- cookies: Record<string, string>;
83
+ cookies: Record<string, string | undefined>;
84
84
  url?: URL;
85
85
  quirks: Quirks;
86
86
  enrichments: EnrichmentData[];
@@ -1040,6 +1040,12 @@ type ContextOptions = {
1040
1040
  * only - don't call scores, update, etc on it. If you need to call these methods immediately, attach your plugin after initialisation.
1041
1041
  */
1042
1042
  plugins?: Array<ContextPlugin>;
1043
+ /**
1044
+ * Only show personalizations if the visitor has given consent.
1045
+ * `false (default)`: personalization can run in memory without visitor granting storage consent
1046
+ * `true`: personalization is not run at all unless storage consent is given
1047
+ */
1048
+ requireConsentForPersonalization?: boolean;
1043
1049
  } & Omit<VisitorDataStoreOptions, 'manifest' | 'onServerTransitionScoresReceived'>;
1044
1050
  /** Emitted when a personalization runs */
1045
1051
  type PersonalizationEvent = {
@@ -1124,6 +1130,7 @@ declare class Context implements ContextInstance {
1124
1130
  get scores(): Readonly<ScoreVector>;
1125
1131
  /** Gets the current visitor's quirks values. */
1126
1132
  get quirks(): Readonly<Quirks>;
1133
+ get requireConsentForPersonalization(): boolean | undefined;
1127
1134
  /**
1128
1135
  * Subscribe to events
1129
1136
  */
@@ -1252,4 +1259,4 @@ declare global {
1252
1259
  }
1253
1260
  }
1254
1261
 
1255
- export { type TestOptions as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type PersonalizationManifest as Q, type Signal as R, type ScoreVector as S, TransitionDataStore as T, type SignalCriteriaGroup as U, type VisitorData as V, type SignalCriteria as W, type EnrichmentCategory as X, type NumberMatch as Y, type TestDefinition as Z, type AggregateDimensionInput as _, type StorageCommands as a, testVariations as a0, type DimensionMatch as a1, type PersonalizeOptions as a2, personalizeVariations as a3, type BehaviorTag as a4, type PersonalizedVariant as a5, type PersonalizedResult as a6, type TestVariant as a7, type TestResult as a8, type StorageCommand as a9, type ContextStateUpdate as aA, type GoalStateUpdate as aB, type paths as aC, type SetGoalCommand as aa, type ModifyScoreCommand as ab, type ModifySessionScoreCommand as ac, type SetConsentCommand as ad, type SetQuirkCommand as ae, type SetTestCommand as af, type IdentifyCommand as ag, type SetControlGroupCommand as ah, type SetPersonalizeVariantControlCommand as ai, areCommandsEqual as aj, type ServerToClientTransitionState as ak, SERVER_STATE_ID as al, type TransitionDataStoreEvents as am, type DecayOptions as an, type VisitorDataStoreOptions as ao, type VisitorDataStoreEvents as ap, VisitorDataStore as aq, type Quirks as ar, type Tests as as, type Goals as at, type EnrichmentData as au, type PersonalizeControlVariant as av, type PersonalizeVariants as aw, type EventData as ax, emptyVisitorData as ay, type ContextState as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type DevToolsEvents as g, CONTEXTUAL_EDITING_TEST_NAME as h, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as i, type ContextOptions as j, type TestEvent as k, type ContextEvents as l, type ContextInstance as m, Context as n, type DevToolsUiVersion as o, type DevToolsState as p, type DevToolsActions as q, type DevToolsEvent as r, type DevToolsLogEvent as s, type DevToolsDataEvent as t, type DevToolsHelloEvent as u, type DevToolsUpdateEvent as v, type DevToolsRawCommandsEvent as w, type DevToolsForgetEvent as x, type LogMessages as y, type Severity as z };
1262
+ export { type AggregateDimensionInput as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type Quirks as Q, type PersonalizationManifest as R, type ScoreVector as S, TransitionDataStore as T, type Signal as U, type VisitorData as V, type SignalCriteriaGroup as W, type SignalCriteria as X, type EnrichmentCategory as Y, type NumberMatch as Z, type TestDefinition as _, type StorageCommands as a, type TestOptions as a0, testVariations as a1, type DimensionMatch as a2, type PersonalizeOptions as a3, personalizeVariations as a4, type BehaviorTag as a5, type PersonalizedVariant as a6, type PersonalizedResult as a7, type TestVariant as a8, type TestResult as a9, type ContextStateUpdate as aA, type GoalStateUpdate as aB, type paths as aC, type StorageCommand as aa, type SetGoalCommand as ab, type ModifyScoreCommand as ac, type ModifySessionScoreCommand as ad, type SetConsentCommand as ae, type SetQuirkCommand as af, type SetTestCommand as ag, type IdentifyCommand as ah, type SetControlGroupCommand as ai, type SetPersonalizeVariantControlCommand as aj, areCommandsEqual as ak, type ServerToClientTransitionState as al, SERVER_STATE_ID as am, type TransitionDataStoreEvents as an, type DecayOptions as ao, type VisitorDataStoreOptions as ap, type VisitorDataStoreEvents as aq, VisitorDataStore as ar, type Tests as as, type Goals as at, type EnrichmentData as au, type PersonalizeControlVariant as av, type PersonalizeVariants as aw, type EventData as ax, emptyVisitorData as ay, type ContextState as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type DevToolsEvents as g, CONTEXTUAL_EDITING_TEST_NAME as h, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as i, type ContextOptions as j, type TestEvent as k, type ContextEvents as l, type ContextInstance as m, Context as n, type DevToolsUiVersion as o, type DevToolsState as p, type DevToolsActions as q, type DevToolsEvent as r, type DevToolsLogEvent as s, type DevToolsDataEvent as t, type DevToolsHelloEvent as u, type DevToolsUpdateEvent as v, type DevToolsRawCommandsEvent as w, type DevToolsForgetEvent as x, type LogMessages as y, type Severity as z };
@@ -80,7 +80,7 @@ declare const emptyVisitorData: () => VisitorData;
80
80
  * Expresses a 'patch' to the Uniform Context state
81
81
  */
82
82
  type ContextState = {
83
- cookies: Record<string, string>;
83
+ cookies: Record<string, string | undefined>;
84
84
  url?: URL;
85
85
  quirks: Quirks;
86
86
  enrichments: EnrichmentData[];
@@ -1040,6 +1040,12 @@ type ContextOptions = {
1040
1040
  * only - don't call scores, update, etc on it. If you need to call these methods immediately, attach your plugin after initialisation.
1041
1041
  */
1042
1042
  plugins?: Array<ContextPlugin>;
1043
+ /**
1044
+ * Only show personalizations if the visitor has given consent.
1045
+ * `false (default)`: personalization can run in memory without visitor granting storage consent
1046
+ * `true`: personalization is not run at all unless storage consent is given
1047
+ */
1048
+ requireConsentForPersonalization?: boolean;
1043
1049
  } & Omit<VisitorDataStoreOptions, 'manifest' | 'onServerTransitionScoresReceived'>;
1044
1050
  /** Emitted when a personalization runs */
1045
1051
  type PersonalizationEvent = {
@@ -1124,6 +1130,7 @@ declare class Context implements ContextInstance {
1124
1130
  get scores(): Readonly<ScoreVector>;
1125
1131
  /** Gets the current visitor's quirks values. */
1126
1132
  get quirks(): Readonly<Quirks>;
1133
+ get requireConsentForPersonalization(): boolean | undefined;
1127
1134
  /**
1128
1135
  * Subscribe to events
1129
1136
  */
@@ -1252,4 +1259,4 @@ declare global {
1252
1259
  }
1253
1260
  }
1254
1261
 
1255
- export { type TestOptions as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type PersonalizationManifest as Q, type Signal as R, type ScoreVector as S, TransitionDataStore as T, type SignalCriteriaGroup as U, type VisitorData as V, type SignalCriteria as W, type EnrichmentCategory as X, type NumberMatch as Y, type TestDefinition as Z, type AggregateDimensionInput as _, type StorageCommands as a, testVariations as a0, type DimensionMatch as a1, type PersonalizeOptions as a2, personalizeVariations as a3, type BehaviorTag as a4, type PersonalizedVariant as a5, type PersonalizedResult as a6, type TestVariant as a7, type TestResult as a8, type StorageCommand as a9, type ContextStateUpdate as aA, type GoalStateUpdate as aB, type paths as aC, type SetGoalCommand as aa, type ModifyScoreCommand as ab, type ModifySessionScoreCommand as ac, type SetConsentCommand as ad, type SetQuirkCommand as ae, type SetTestCommand as af, type IdentifyCommand as ag, type SetControlGroupCommand as ah, type SetPersonalizeVariantControlCommand as ai, areCommandsEqual as aj, type ServerToClientTransitionState as ak, SERVER_STATE_ID as al, type TransitionDataStoreEvents as am, type DecayOptions as an, type VisitorDataStoreOptions as ao, type VisitorDataStoreEvents as ap, VisitorDataStore as aq, type Quirks as ar, type Tests as as, type Goals as at, type EnrichmentData as au, type PersonalizeControlVariant as av, type PersonalizeVariants as aw, type EventData as ax, emptyVisitorData as ay, type ContextState as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type DevToolsEvents as g, CONTEXTUAL_EDITING_TEST_NAME as h, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as i, type ContextOptions as j, type TestEvent as k, type ContextEvents as l, type ContextInstance as m, Context as n, type DevToolsUiVersion as o, type DevToolsState as p, type DevToolsActions as q, type DevToolsEvent as r, type DevToolsLogEvent as s, type DevToolsDataEvent as t, type DevToolsHelloEvent as u, type DevToolsUpdateEvent as v, type DevToolsRawCommandsEvent as w, type DevToolsForgetEvent as x, type LogMessages as y, type Severity as z };
1262
+ export { type AggregateDimensionInput as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type Quirks as Q, type PersonalizationManifest as R, type ScoreVector as S, TransitionDataStore as T, type Signal as U, type VisitorData as V, type SignalCriteriaGroup as W, type SignalCriteria as X, type EnrichmentCategory as Y, type NumberMatch as Z, type TestDefinition as _, type StorageCommands as a, type TestOptions as a0, testVariations as a1, type DimensionMatch as a2, type PersonalizeOptions as a3, personalizeVariations as a4, type BehaviorTag as a5, type PersonalizedVariant as a6, type PersonalizedResult as a7, type TestVariant as a8, type TestResult as a9, type ContextStateUpdate as aA, type GoalStateUpdate as aB, type paths as aC, type StorageCommand as aa, type SetGoalCommand as ab, type ModifyScoreCommand as ac, type ModifySessionScoreCommand as ad, type SetConsentCommand as ae, type SetQuirkCommand as af, type SetTestCommand as ag, type IdentifyCommand as ah, type SetControlGroupCommand as ai, type SetPersonalizeVariantControlCommand as aj, areCommandsEqual as ak, type ServerToClientTransitionState as al, SERVER_STATE_ID as am, type TransitionDataStoreEvents as an, type DecayOptions as ao, type VisitorDataStoreOptions as ap, type VisitorDataStoreEvents as aq, VisitorDataStore as ar, type Tests as as, type Goals as at, type EnrichmentData as au, type PersonalizeControlVariant as av, type PersonalizeVariants as aw, type EventData as ax, emptyVisitorData as ay, type ContextState as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type DevToolsEvents as g, CONTEXTUAL_EDITING_TEST_NAME as h, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as i, type ContextOptions as j, type TestEvent as k, type ContextEvents as l, type ContextInstance as m, Context as n, type DevToolsUiVersion as o, type DevToolsState as p, type DevToolsActions as q, type DevToolsEvent as r, type DevToolsLogEvent as s, type DevToolsDataEvent as t, type DevToolsHelloEvent as u, type DevToolsUpdateEvent as v, type DevToolsRawCommandsEvent as w, type DevToolsForgetEvent as x, type LogMessages as y, type Severity as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context",
3
- "version": "19.201.1",
3
+ "version": "19.202.1-alpha.9+63c059770a",
4
4
  "description": "Uniform Context core package",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -59,7 +59,7 @@
59
59
  "js-cookie": "3.0.5",
60
60
  "mitt": "^3.0.1",
61
61
  "p-limit": "^3.1.0",
62
- "rfdc": "^1.3.0",
62
+ "rfdc": "^1.4.1",
63
63
  "uuid": "9.0.1"
64
64
  },
65
65
  "files": [
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "2e20dee3fc5ce005f6d73eddf939cc89cbad83de"
71
+ "gitHead": "63c059770a54fc063a12af0f74eba059143e8074"
72
72
  }