@uniformdev/context 19.201.1 → 19.202.0
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.
- package/dist/api/api.d.mts +1 -1
- package/dist/api/api.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +12 -3
- package/dist/index.js +12 -3
- package/dist/index.mjs +12 -3
- package/dist/{types-WXZBuJXL.d.mts → types-Bb_hEqnt.d.mts} +7 -0
- package/dist/{types-WXZBuJXL.d.ts → types-Bb_hEqnt.d.ts} +7 -0
- package/package.json +2 -2
package/dist/api/api.d.mts
CHANGED
package/dist/api/api.d.ts
CHANGED
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-
|
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-
|
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-Bb_hEqnt.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-Bb_hEqnt.mjs';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
5
|
|
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-
|
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-
|
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-Bb_hEqnt.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-Bb_hEqnt.js';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
5
|
|
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 {
|
@@ -1213,7 +1215,8 @@ var LocalStorage = class {
|
|
1213
1215
|
this.partitionKey = partitionKey;
|
1214
1216
|
__privateAdd(this, _LocalStorage_instances);
|
1215
1217
|
__publicField(this, "inMemoryFallback", {});
|
1216
|
-
|
1218
|
+
// deno implements localStorage in netlify edge workers, must also check if document is present.
|
1219
|
+
__publicField(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
1217
1220
|
}
|
1218
1221
|
get(key) {
|
1219
1222
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
@@ -1467,7 +1470,7 @@ import { dequal as dequal5 } from "dequal/lite";
|
|
1467
1470
|
import mitt3 from "mitt";
|
1468
1471
|
var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
|
1469
1472
|
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;
|
1473
|
+
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _requireConsentForPersonalization, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
|
1471
1474
|
var Context = class {
|
1472
1475
|
constructor(options) {
|
1473
1476
|
__privateAdd(this, _Context_instances);
|
@@ -1478,6 +1481,7 @@ var Context = class {
|
|
1478
1481
|
__privateAdd(this, _pzCache, {});
|
1479
1482
|
__privateAdd(this, _plugins);
|
1480
1483
|
__privateAdd(this, _commands);
|
1484
|
+
__privateAdd(this, _requireConsentForPersonalization);
|
1481
1485
|
__privateAdd(this, _mitt3, mitt3());
|
1482
1486
|
/**
|
1483
1487
|
* Subscribe to events
|
@@ -1491,6 +1495,7 @@ var Context = class {
|
|
1491
1495
|
const { manifest, ...storageOptions } = options;
|
1492
1496
|
__privateSet(this, _state, {});
|
1493
1497
|
__privateSet(this, _plugins, options.plugins);
|
1498
|
+
__privateSet(this, _requireConsentForPersonalization, options.requireConsentForPersonalization);
|
1494
1499
|
if (typeof options.transitionStore !== "undefined") {
|
1495
1500
|
__privateSet(this, _commands, []);
|
1496
1501
|
}
|
@@ -1567,6 +1572,9 @@ var Context = class {
|
|
1567
1572
|
var _a, _b;
|
1568
1573
|
return (_b = (_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) != null ? _b : this.storage.data.quirks;
|
1569
1574
|
}
|
1575
|
+
get requireConsentForPersonalization() {
|
1576
|
+
return __privateGet(this, _requireConsentForPersonalization);
|
1577
|
+
}
|
1570
1578
|
/**
|
1571
1579
|
* Updates the Context with new data of any sort, such as
|
1572
1580
|
* new URLs, cookies, quirks, and enrichments.
|
@@ -1868,6 +1876,7 @@ _state = new WeakMap();
|
|
1868
1876
|
_pzCache = new WeakMap();
|
1869
1877
|
_plugins = new WeakMap();
|
1870
1878
|
_commands = new WeakMap();
|
1879
|
+
_requireConsentForPersonalization = new WeakMap();
|
1871
1880
|
_mitt3 = new WeakMap();
|
1872
1881
|
_Context_instances = new WeakSet();
|
1873
1882
|
emitTest_fn = function(event) {
|
package/dist/index.js
CHANGED
@@ -737,9 +737,11 @@ function personalizeVariations({
|
|
737
737
|
try {
|
738
738
|
const variantMatches = [];
|
739
739
|
const defaultVariants = [];
|
740
|
+
const needsConsent = context.requireConsentForPersonalization;
|
741
|
+
const canEvaluate = !needsConsent || context.storage.data.consent;
|
740
742
|
for (const variant of variations) {
|
741
743
|
if ((_a = variant.pz) == null ? void 0 : _a.crit.length) {
|
742
|
-
if (variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
|
744
|
+
if (canEvaluate && variantMatches.length !== take && evaluateVariantMatch(variant.id, variant.pz, context.scores, onLogMessage)) {
|
743
745
|
variantMatches.push(variant);
|
744
746
|
}
|
745
747
|
} else {
|
@@ -1297,7 +1299,8 @@ var LocalStorage = class {
|
|
1297
1299
|
this.partitionKey = partitionKey;
|
1298
1300
|
__privateAdd(this, _LocalStorage_instances);
|
1299
1301
|
__publicField(this, "inMemoryFallback", {});
|
1300
|
-
|
1302
|
+
// deno implements localStorage in netlify edge workers, must also check if document is present.
|
1303
|
+
__publicField(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
1301
1304
|
}
|
1302
1305
|
get(key) {
|
1303
1306
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
@@ -1551,7 +1554,7 @@ var import_lite5 = require("dequal/lite");
|
|
1551
1554
|
var import_mitt3 = __toESM(require("mitt"));
|
1552
1555
|
var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
|
1553
1556
|
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;
|
1557
|
+
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _requireConsentForPersonalization, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
|
1555
1558
|
var Context = class {
|
1556
1559
|
constructor(options) {
|
1557
1560
|
__privateAdd(this, _Context_instances);
|
@@ -1562,6 +1565,7 @@ var Context = class {
|
|
1562
1565
|
__privateAdd(this, _pzCache, {});
|
1563
1566
|
__privateAdd(this, _plugins);
|
1564
1567
|
__privateAdd(this, _commands);
|
1568
|
+
__privateAdd(this, _requireConsentForPersonalization);
|
1565
1569
|
__privateAdd(this, _mitt3, (0, import_mitt3.default)());
|
1566
1570
|
/**
|
1567
1571
|
* Subscribe to events
|
@@ -1575,6 +1579,7 @@ var Context = class {
|
|
1575
1579
|
const { manifest, ...storageOptions } = options;
|
1576
1580
|
__privateSet(this, _state, {});
|
1577
1581
|
__privateSet(this, _plugins, options.plugins);
|
1582
|
+
__privateSet(this, _requireConsentForPersonalization, options.requireConsentForPersonalization);
|
1578
1583
|
if (typeof options.transitionStore !== "undefined") {
|
1579
1584
|
__privateSet(this, _commands, []);
|
1580
1585
|
}
|
@@ -1651,6 +1656,9 @@ var Context = class {
|
|
1651
1656
|
var _a, _b;
|
1652
1657
|
return (_b = (_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) != null ? _b : this.storage.data.quirks;
|
1653
1658
|
}
|
1659
|
+
get requireConsentForPersonalization() {
|
1660
|
+
return __privateGet(this, _requireConsentForPersonalization);
|
1661
|
+
}
|
1654
1662
|
/**
|
1655
1663
|
* Updates the Context with new data of any sort, such as
|
1656
1664
|
* new URLs, cookies, quirks, and enrichments.
|
@@ -1952,6 +1960,7 @@ _state = new WeakMap();
|
|
1952
1960
|
_pzCache = new WeakMap();
|
1953
1961
|
_plugins = new WeakMap();
|
1954
1962
|
_commands = new WeakMap();
|
1963
|
+
_requireConsentForPersonalization = new WeakMap();
|
1955
1964
|
_mitt3 = new WeakMap();
|
1956
1965
|
_Context_instances = new WeakSet();
|
1957
1966
|
emitTest_fn = function(event) {
|
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 {
|
@@ -1213,7 +1215,8 @@ var LocalStorage = class {
|
|
1213
1215
|
this.partitionKey = partitionKey;
|
1214
1216
|
__privateAdd(this, _LocalStorage_instances);
|
1215
1217
|
__publicField(this, "inMemoryFallback", {});
|
1216
|
-
|
1218
|
+
// deno implements localStorage in netlify edge workers, must also check if document is present.
|
1219
|
+
__publicField(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
1217
1220
|
}
|
1218
1221
|
get(key) {
|
1219
1222
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
@@ -1467,7 +1470,7 @@ import { dequal as dequal5 } from "dequal/lite";
|
|
1467
1470
|
import mitt3 from "mitt";
|
1468
1471
|
var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
|
1469
1472
|
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;
|
1473
|
+
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _requireConsentForPersonalization, _mitt3, _Context_instances, emitTest_fn, updateGoals_fn, updateComputedScores_fn, calculateScores_fn;
|
1471
1474
|
var Context = class {
|
1472
1475
|
constructor(options) {
|
1473
1476
|
__privateAdd(this, _Context_instances);
|
@@ -1478,6 +1481,7 @@ var Context = class {
|
|
1478
1481
|
__privateAdd(this, _pzCache, {});
|
1479
1482
|
__privateAdd(this, _plugins);
|
1480
1483
|
__privateAdd(this, _commands);
|
1484
|
+
__privateAdd(this, _requireConsentForPersonalization);
|
1481
1485
|
__privateAdd(this, _mitt3, mitt3());
|
1482
1486
|
/**
|
1483
1487
|
* Subscribe to events
|
@@ -1491,6 +1495,7 @@ var Context = class {
|
|
1491
1495
|
const { manifest, ...storageOptions } = options;
|
1492
1496
|
__privateSet(this, _state, {});
|
1493
1497
|
__privateSet(this, _plugins, options.plugins);
|
1498
|
+
__privateSet(this, _requireConsentForPersonalization, options.requireConsentForPersonalization);
|
1494
1499
|
if (typeof options.transitionStore !== "undefined") {
|
1495
1500
|
__privateSet(this, _commands, []);
|
1496
1501
|
}
|
@@ -1567,6 +1572,9 @@ var Context = class {
|
|
1567
1572
|
var _a, _b;
|
1568
1573
|
return (_b = (_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) != null ? _b : this.storage.data.quirks;
|
1569
1574
|
}
|
1575
|
+
get requireConsentForPersonalization() {
|
1576
|
+
return __privateGet(this, _requireConsentForPersonalization);
|
1577
|
+
}
|
1570
1578
|
/**
|
1571
1579
|
* Updates the Context with new data of any sort, such as
|
1572
1580
|
* new URLs, cookies, quirks, and enrichments.
|
@@ -1868,6 +1876,7 @@ _state = new WeakMap();
|
|
1868
1876
|
_pzCache = new WeakMap();
|
1869
1877
|
_plugins = new WeakMap();
|
1870
1878
|
_commands = new WeakMap();
|
1879
|
+
_requireConsentForPersonalization = new WeakMap();
|
1871
1880
|
_mitt3 = new WeakMap();
|
1872
1881
|
_Context_instances = new WeakSet();
|
1873
1882
|
emitTest_fn = function(event) {
|
@@ -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
|
*/
|
@@ -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
|
*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/context",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.202.0",
|
4
4
|
"description": "Uniform Context core package",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -68,5 +68,5 @@
|
|
68
68
|
"publishConfig": {
|
69
69
|
"access": "public"
|
70
70
|
},
|
71
|
-
"gitHead": "
|
71
|
+
"gitHead": "133a9ea4d2d3794e2d05ad8277f6bb3803d109d7"
|
72
72
|
}
|