@uniformdev/context 19.155.0 → 19.157.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 +55 -14
- package/dist/index.js +56 -14
- package/dist/index.mjs +55 -14
- package/dist/{types-DqYG-dCc.d.mts → types-ZjAbVh_D.d.mts} +10 -1
- package/dist/{types-DqYG-dCc.d.ts → types-ZjAbVh_D.d.ts} +10 -1
- 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,
|
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-ZjAbVh_D.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-ZjAbVh_D.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,
|
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-ZjAbVh_D.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-ZjAbVh_D.js';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
5
|
|
package/dist/index.esm.js
CHANGED
@@ -826,11 +826,20 @@ var testVariations = ({
|
|
826
826
|
}
|
827
827
|
};
|
828
828
|
|
829
|
+
// src/storage/commands.ts
|
830
|
+
import { dequal as dequal2 } from "dequal/lite";
|
831
|
+
var areCommandsEqual = (a, b) => {
|
832
|
+
if (a.type !== b.type) {
|
833
|
+
return false;
|
834
|
+
}
|
835
|
+
return dequal2(a, b);
|
836
|
+
};
|
837
|
+
|
829
838
|
// src/storage/CookieTransitionDataStore.ts
|
830
839
|
import Cookies from "js-cookie";
|
831
840
|
|
832
841
|
// src/storage/TransitionDataStore.ts
|
833
|
-
import { dequal as
|
842
|
+
import { dequal as dequal3 } from "dequal/lite";
|
834
843
|
import mitt from "mitt";
|
835
844
|
var SERVER_STATE_ID = "__UNIFORM_DATA__";
|
836
845
|
var _data, _initialData, _mitt;
|
@@ -876,7 +885,7 @@ var TransitionDataStore = class {
|
|
876
885
|
await this.handleDelete(fromAllDevices);
|
877
886
|
}
|
878
887
|
signalAsyncDataUpdate(newScores) {
|
879
|
-
if (
|
888
|
+
if (dequal3(this.data, newScores)) {
|
880
889
|
return;
|
881
890
|
}
|
882
891
|
__privateSet(this, _data, newScores);
|
@@ -1149,7 +1158,7 @@ var emptyVisitorData = () => ({
|
|
1149
1158
|
});
|
1150
1159
|
|
1151
1160
|
// src/storage/VisitorDataStore.ts
|
1152
|
-
import { dequal as
|
1161
|
+
import { dequal as dequal4 } from "dequal/lite";
|
1153
1162
|
import mitt2 from "mitt";
|
1154
1163
|
|
1155
1164
|
// src/storage/util/applyCommandsToData.ts
|
@@ -1399,11 +1408,11 @@ replaceData_fn = function(data, quiet = false) {
|
|
1399
1408
|
onLogMessage: __privateGet(this, _options).onLogMessage
|
1400
1409
|
});
|
1401
1410
|
}
|
1402
|
-
const haveScoresChanged = !
|
1403
|
-
const haveSessionScoresChanged = !
|
1404
|
-
const haveQuirksChanged = !
|
1405
|
-
const haveTestsChanged = !
|
1406
|
-
const haveGoalsChanged = !
|
1411
|
+
const haveScoresChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
1412
|
+
const haveSessionScoresChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
1413
|
+
const haveQuirksChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
1414
|
+
const haveTestsChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.tests, data.tests);
|
1415
|
+
const haveGoalsChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.goals, data.goals);
|
1407
1416
|
const updatedData = {
|
1408
1417
|
updated: now,
|
1409
1418
|
visitorData: data
|
@@ -1485,11 +1494,11 @@ defaultData_fn = function() {
|
|
1485
1494
|
};
|
1486
1495
|
|
1487
1496
|
// src/Context.ts
|
1488
|
-
import { dequal as
|
1497
|
+
import { dequal as dequal5 } from "dequal/lite";
|
1489
1498
|
import mitt3 from "mitt";
|
1490
1499
|
var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
|
1491
1500
|
var CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_test_selected_variant";
|
1492
|
-
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _mitt3, _emitTest, emitTest_fn, _updateGoals, updateGoals_fn, _updateComputedScores, updateComputedScores_fn, _calculateScores, calculateScores_fn;
|
1501
|
+
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _mitt3, _emitTest, emitTest_fn, _updateGoals, updateGoals_fn, _updateComputedScores, updateComputedScores_fn, _calculateScores, calculateScores_fn;
|
1493
1502
|
var Context = class {
|
1494
1503
|
constructor(options) {
|
1495
1504
|
__privateAdd(this, _emitTest);
|
@@ -1502,6 +1511,7 @@ var Context = class {
|
|
1502
1511
|
__privateAdd(this, _state, void 0);
|
1503
1512
|
__privateAdd(this, _pzCache, {});
|
1504
1513
|
__privateAdd(this, _plugins, void 0);
|
1514
|
+
__privateAdd(this, _commands, void 0);
|
1505
1515
|
__privateAdd(this, _mitt3, mitt3());
|
1506
1516
|
/**
|
1507
1517
|
* Subscribe to events
|
@@ -1515,6 +1525,9 @@ var Context = class {
|
|
1515
1525
|
const { manifest, ...storageOptions } = options;
|
1516
1526
|
__privateSet(this, _state, {});
|
1517
1527
|
__privateSet(this, _plugins, options.plugins);
|
1528
|
+
if (typeof options.transitionStore !== "undefined") {
|
1529
|
+
__privateSet(this, _commands, []);
|
1530
|
+
}
|
1518
1531
|
(_a = __privateGet(this, _plugins)) == null ? void 0 : _a.forEach((plugin) => {
|
1519
1532
|
if (!plugin.logDrain) {
|
1520
1533
|
return;
|
@@ -1595,7 +1608,7 @@ var Context = class {
|
|
1595
1608
|
* will NOT result in a recomputation of signal state.
|
1596
1609
|
*/
|
1597
1610
|
async update(newData) {
|
1598
|
-
var _a, _b, _c, _d;
|
1611
|
+
var _a, _b, _c, _d, _e;
|
1599
1612
|
const commands = [];
|
1600
1613
|
const newServerSideTests = {};
|
1601
1614
|
if ((_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) {
|
@@ -1690,6 +1703,10 @@ var Context = class {
|
|
1690
1703
|
});
|
1691
1704
|
await this.storage.updateData(commands);
|
1692
1705
|
if (__privateGet(this, _serverTransitionState)) {
|
1706
|
+
await this.processServerCommands({
|
1707
|
+
serverCommands: __privateGet(this, _serverTransitionState).commands,
|
1708
|
+
commands
|
1709
|
+
});
|
1693
1710
|
__privateMethod(this, _updateComputedScores, updateComputedScores_fn).call(this, this.storage.data);
|
1694
1711
|
Object.entries(newServerSideTests).forEach(([testName, testVariantId]) => {
|
1695
1712
|
__privateMethod(this, _emitTest, emitTest_fn).call(this, {
|
@@ -1710,10 +1727,31 @@ var Context = class {
|
|
1710
1727
|
await plugin.update(newData);
|
1711
1728
|
}
|
1712
1729
|
}
|
1730
|
+
(_e = __privateGet(this, _commands)) == null ? void 0 : _e.push(...commands);
|
1713
1731
|
} finally {
|
1714
1732
|
__privateGet(this, _mitt3).emit("log", ["info", 2, "ENDGROUP"]);
|
1715
1733
|
}
|
1716
1734
|
}
|
1735
|
+
async processServerCommands({
|
1736
|
+
serverCommands,
|
1737
|
+
commands
|
1738
|
+
}) {
|
1739
|
+
if (!(serverCommands == null ? void 0 : serverCommands.length)) {
|
1740
|
+
return;
|
1741
|
+
}
|
1742
|
+
const notExecutedCommands = [];
|
1743
|
+
serverCommands.forEach((serverCommand) => {
|
1744
|
+
const found = commands.find((command) => {
|
1745
|
+
return areCommandsEqual(command, serverCommand);
|
1746
|
+
});
|
1747
|
+
if (!found) {
|
1748
|
+
notExecutedCommands.push(serverCommand);
|
1749
|
+
}
|
1750
|
+
});
|
1751
|
+
if (notExecutedCommands.length > 0) {
|
1752
|
+
await this.storage.updateData(notExecutedCommands);
|
1753
|
+
}
|
1754
|
+
}
|
1717
1755
|
/** use test() instead */
|
1718
1756
|
getTestVariantId(testName) {
|
1719
1757
|
var _a, _b, _c, _d;
|
@@ -1792,7 +1830,7 @@ var Context = class {
|
|
1792
1830
|
control: this.storage.data.controlGroup,
|
1793
1831
|
changed: true
|
1794
1832
|
};
|
1795
|
-
if (previousPlacement &&
|
1833
|
+
if (previousPlacement && dequal5(eventData.variantIds, previousPlacement)) {
|
1796
1834
|
eventData.changed = false;
|
1797
1835
|
}
|
1798
1836
|
__privateGet(this, _mitt3).emit("personalizationResult", eventData);
|
@@ -1826,7 +1864,8 @@ var Context = class {
|
|
1826
1864
|
quirks: this.storage.data.quirks,
|
1827
1865
|
ssv: __privateGet(this, _scores),
|
1828
1866
|
tests: {},
|
1829
|
-
personalizeVariants: this.storage.data.personalizeVariants
|
1867
|
+
personalizeVariants: this.storage.data.personalizeVariants,
|
1868
|
+
commands: __privateGet(this, _commands)
|
1830
1869
|
};
|
1831
1870
|
const allTests = this.storage.data.tests;
|
1832
1871
|
Object.entries(allTests).map(([testName, testValue]) => {
|
@@ -1855,6 +1894,7 @@ _scores = new WeakMap();
|
|
1855
1894
|
_state = new WeakMap();
|
1856
1895
|
_pzCache = new WeakMap();
|
1857
1896
|
_plugins = new WeakMap();
|
1897
|
+
_commands = new WeakMap();
|
1858
1898
|
_mitt3 = new WeakMap();
|
1859
1899
|
_emitTest = new WeakSet();
|
1860
1900
|
emitTest_fn = function(event) {
|
@@ -1870,7 +1910,7 @@ updateGoals_fn = async function(data) {
|
|
1870
1910
|
_updateComputedScores = new WeakSet();
|
1871
1911
|
updateComputedScores_fn = function(newData) {
|
1872
1912
|
const newScores = __privateMethod(this, _calculateScores, calculateScores_fn).call(this, newData);
|
1873
|
-
const newScoresHaveChanged = !
|
1913
|
+
const newScoresHaveChanged = !dequal5(newScores, __privateGet(this, _scores));
|
1874
1914
|
if (newScoresHaveChanged) {
|
1875
1915
|
__privateSet(this, _scores, newScores);
|
1876
1916
|
__privateMethod(this, _updateGoals, updateGoals_fn).call(this, {
|
@@ -2541,6 +2581,7 @@ export {
|
|
2541
2581
|
TransitionDataStore,
|
2542
2582
|
UNIFORM_DEFAULT_COOKIE_NAME,
|
2543
2583
|
VisitorDataStore,
|
2584
|
+
areCommandsEqual,
|
2544
2585
|
computeAggregateDimensions,
|
2545
2586
|
cookieEvaluator,
|
2546
2587
|
createConsoleLogDrain,
|
package/dist/index.js
CHANGED
@@ -70,6 +70,7 @@ __export(src_exports, {
|
|
70
70
|
TransitionDataStore: () => TransitionDataStore,
|
71
71
|
UNIFORM_DEFAULT_COOKIE_NAME: () => UNIFORM_DEFAULT_COOKIE_NAME,
|
72
72
|
VisitorDataStore: () => VisitorDataStore,
|
73
|
+
areCommandsEqual: () => areCommandsEqual,
|
73
74
|
computeAggregateDimensions: () => computeAggregateDimensions,
|
74
75
|
cookieEvaluator: () => cookieEvaluator,
|
75
76
|
createConsoleLogDrain: () => createConsoleLogDrain,
|
@@ -897,11 +898,20 @@ var testVariations = ({
|
|
897
898
|
}
|
898
899
|
};
|
899
900
|
|
901
|
+
// src/storage/commands.ts
|
902
|
+
var import_lite2 = require("dequal/lite");
|
903
|
+
var areCommandsEqual = (a, b) => {
|
904
|
+
if (a.type !== b.type) {
|
905
|
+
return false;
|
906
|
+
}
|
907
|
+
return (0, import_lite2.dequal)(a, b);
|
908
|
+
};
|
909
|
+
|
900
910
|
// src/storage/CookieTransitionDataStore.ts
|
901
911
|
var import_js_cookie = __toESM(require("js-cookie"));
|
902
912
|
|
903
913
|
// src/storage/TransitionDataStore.ts
|
904
|
-
var
|
914
|
+
var import_lite3 = require("dequal/lite");
|
905
915
|
var import_mitt = __toESM(require("mitt"));
|
906
916
|
var SERVER_STATE_ID = "__UNIFORM_DATA__";
|
907
917
|
var _data, _initialData, _mitt;
|
@@ -947,7 +957,7 @@ var TransitionDataStore = class {
|
|
947
957
|
await this.handleDelete(fromAllDevices);
|
948
958
|
}
|
949
959
|
signalAsyncDataUpdate(newScores) {
|
950
|
-
if ((0,
|
960
|
+
if ((0, import_lite3.dequal)(this.data, newScores)) {
|
951
961
|
return;
|
952
962
|
}
|
953
963
|
__privateSet(this, _data, newScores);
|
@@ -1220,7 +1230,7 @@ var emptyVisitorData = () => ({
|
|
1220
1230
|
});
|
1221
1231
|
|
1222
1232
|
// src/storage/VisitorDataStore.ts
|
1223
|
-
var
|
1233
|
+
var import_lite4 = require("dequal/lite");
|
1224
1234
|
var import_mitt2 = __toESM(require("mitt"));
|
1225
1235
|
|
1226
1236
|
// src/storage/util/applyCommandsToData.ts
|
@@ -1470,11 +1480,11 @@ replaceData_fn = function(data, quiet = false) {
|
|
1470
1480
|
onLogMessage: __privateGet(this, _options).onLogMessage
|
1471
1481
|
});
|
1472
1482
|
}
|
1473
|
-
const haveScoresChanged = !(0,
|
1474
|
-
const haveSessionScoresChanged = !(0,
|
1475
|
-
const haveQuirksChanged = !(0,
|
1476
|
-
const haveTestsChanged = !(0,
|
1477
|
-
const haveGoalsChanged = !(0,
|
1483
|
+
const haveScoresChanged = !(0, import_lite4.dequal)(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
1484
|
+
const haveSessionScoresChanged = !(0, import_lite4.dequal)(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
1485
|
+
const haveQuirksChanged = !(0, import_lite4.dequal)(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
1486
|
+
const haveTestsChanged = !(0, import_lite4.dequal)(oldData == null ? void 0 : oldData.visitorData.tests, data.tests);
|
1487
|
+
const haveGoalsChanged = !(0, import_lite4.dequal)(oldData == null ? void 0 : oldData.visitorData.goals, data.goals);
|
1478
1488
|
const updatedData = {
|
1479
1489
|
updated: now,
|
1480
1490
|
visitorData: data
|
@@ -1556,11 +1566,11 @@ defaultData_fn = function() {
|
|
1556
1566
|
};
|
1557
1567
|
|
1558
1568
|
// src/Context.ts
|
1559
|
-
var
|
1569
|
+
var import_lite5 = require("dequal/lite");
|
1560
1570
|
var import_mitt3 = __toESM(require("mitt"));
|
1561
1571
|
var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
|
1562
1572
|
var CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_test_selected_variant";
|
1563
|
-
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _mitt3, _emitTest, emitTest_fn, _updateGoals, updateGoals_fn, _updateComputedScores, updateComputedScores_fn, _calculateScores, calculateScores_fn;
|
1573
|
+
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _mitt3, _emitTest, emitTest_fn, _updateGoals, updateGoals_fn, _updateComputedScores, updateComputedScores_fn, _calculateScores, calculateScores_fn;
|
1564
1574
|
var Context = class {
|
1565
1575
|
constructor(options) {
|
1566
1576
|
__privateAdd(this, _emitTest);
|
@@ -1573,6 +1583,7 @@ var Context = class {
|
|
1573
1583
|
__privateAdd(this, _state, void 0);
|
1574
1584
|
__privateAdd(this, _pzCache, {});
|
1575
1585
|
__privateAdd(this, _plugins, void 0);
|
1586
|
+
__privateAdd(this, _commands, void 0);
|
1576
1587
|
__privateAdd(this, _mitt3, (0, import_mitt3.default)());
|
1577
1588
|
/**
|
1578
1589
|
* Subscribe to events
|
@@ -1586,6 +1597,9 @@ var Context = class {
|
|
1586
1597
|
const { manifest, ...storageOptions } = options;
|
1587
1598
|
__privateSet(this, _state, {});
|
1588
1599
|
__privateSet(this, _plugins, options.plugins);
|
1600
|
+
if (typeof options.transitionStore !== "undefined") {
|
1601
|
+
__privateSet(this, _commands, []);
|
1602
|
+
}
|
1589
1603
|
(_a = __privateGet(this, _plugins)) == null ? void 0 : _a.forEach((plugin) => {
|
1590
1604
|
if (!plugin.logDrain) {
|
1591
1605
|
return;
|
@@ -1666,7 +1680,7 @@ var Context = class {
|
|
1666
1680
|
* will NOT result in a recomputation of signal state.
|
1667
1681
|
*/
|
1668
1682
|
async update(newData) {
|
1669
|
-
var _a, _b, _c, _d;
|
1683
|
+
var _a, _b, _c, _d, _e;
|
1670
1684
|
const commands = [];
|
1671
1685
|
const newServerSideTests = {};
|
1672
1686
|
if ((_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) {
|
@@ -1761,6 +1775,10 @@ var Context = class {
|
|
1761
1775
|
});
|
1762
1776
|
await this.storage.updateData(commands);
|
1763
1777
|
if (__privateGet(this, _serverTransitionState)) {
|
1778
|
+
await this.processServerCommands({
|
1779
|
+
serverCommands: __privateGet(this, _serverTransitionState).commands,
|
1780
|
+
commands
|
1781
|
+
});
|
1764
1782
|
__privateMethod(this, _updateComputedScores, updateComputedScores_fn).call(this, this.storage.data);
|
1765
1783
|
Object.entries(newServerSideTests).forEach(([testName, testVariantId]) => {
|
1766
1784
|
__privateMethod(this, _emitTest, emitTest_fn).call(this, {
|
@@ -1781,10 +1799,31 @@ var Context = class {
|
|
1781
1799
|
await plugin.update(newData);
|
1782
1800
|
}
|
1783
1801
|
}
|
1802
|
+
(_e = __privateGet(this, _commands)) == null ? void 0 : _e.push(...commands);
|
1784
1803
|
} finally {
|
1785
1804
|
__privateGet(this, _mitt3).emit("log", ["info", 2, "ENDGROUP"]);
|
1786
1805
|
}
|
1787
1806
|
}
|
1807
|
+
async processServerCommands({
|
1808
|
+
serverCommands,
|
1809
|
+
commands
|
1810
|
+
}) {
|
1811
|
+
if (!(serverCommands == null ? void 0 : serverCommands.length)) {
|
1812
|
+
return;
|
1813
|
+
}
|
1814
|
+
const notExecutedCommands = [];
|
1815
|
+
serverCommands.forEach((serverCommand) => {
|
1816
|
+
const found = commands.find((command) => {
|
1817
|
+
return areCommandsEqual(command, serverCommand);
|
1818
|
+
});
|
1819
|
+
if (!found) {
|
1820
|
+
notExecutedCommands.push(serverCommand);
|
1821
|
+
}
|
1822
|
+
});
|
1823
|
+
if (notExecutedCommands.length > 0) {
|
1824
|
+
await this.storage.updateData(notExecutedCommands);
|
1825
|
+
}
|
1826
|
+
}
|
1788
1827
|
/** use test() instead */
|
1789
1828
|
getTestVariantId(testName) {
|
1790
1829
|
var _a, _b, _c, _d;
|
@@ -1863,7 +1902,7 @@ var Context = class {
|
|
1863
1902
|
control: this.storage.data.controlGroup,
|
1864
1903
|
changed: true
|
1865
1904
|
};
|
1866
|
-
if (previousPlacement && (0,
|
1905
|
+
if (previousPlacement && (0, import_lite5.dequal)(eventData.variantIds, previousPlacement)) {
|
1867
1906
|
eventData.changed = false;
|
1868
1907
|
}
|
1869
1908
|
__privateGet(this, _mitt3).emit("personalizationResult", eventData);
|
@@ -1897,7 +1936,8 @@ var Context = class {
|
|
1897
1936
|
quirks: this.storage.data.quirks,
|
1898
1937
|
ssv: __privateGet(this, _scores),
|
1899
1938
|
tests: {},
|
1900
|
-
personalizeVariants: this.storage.data.personalizeVariants
|
1939
|
+
personalizeVariants: this.storage.data.personalizeVariants,
|
1940
|
+
commands: __privateGet(this, _commands)
|
1901
1941
|
};
|
1902
1942
|
const allTests = this.storage.data.tests;
|
1903
1943
|
Object.entries(allTests).map(([testName, testValue]) => {
|
@@ -1926,6 +1966,7 @@ _scores = new WeakMap();
|
|
1926
1966
|
_state = new WeakMap();
|
1927
1967
|
_pzCache = new WeakMap();
|
1928
1968
|
_plugins = new WeakMap();
|
1969
|
+
_commands = new WeakMap();
|
1929
1970
|
_mitt3 = new WeakMap();
|
1930
1971
|
_emitTest = new WeakSet();
|
1931
1972
|
emitTest_fn = function(event) {
|
@@ -1941,7 +1982,7 @@ updateGoals_fn = async function(data) {
|
|
1941
1982
|
_updateComputedScores = new WeakSet();
|
1942
1983
|
updateComputedScores_fn = function(newData) {
|
1943
1984
|
const newScores = __privateMethod(this, _calculateScores, calculateScores_fn).call(this, newData);
|
1944
|
-
const newScoresHaveChanged = !(0,
|
1985
|
+
const newScoresHaveChanged = !(0, import_lite5.dequal)(newScores, __privateGet(this, _scores));
|
1945
1986
|
if (newScoresHaveChanged) {
|
1946
1987
|
__privateSet(this, _scores, newScores);
|
1947
1988
|
__privateMethod(this, _updateGoals, updateGoals_fn).call(this, {
|
@@ -2613,6 +2654,7 @@ function parseQuickConnect(serialized) {
|
|
2613
2654
|
TransitionDataStore,
|
2614
2655
|
UNIFORM_DEFAULT_COOKIE_NAME,
|
2615
2656
|
VisitorDataStore,
|
2657
|
+
areCommandsEqual,
|
2616
2658
|
computeAggregateDimensions,
|
2617
2659
|
cookieEvaluator,
|
2618
2660
|
createConsoleLogDrain,
|
package/dist/index.mjs
CHANGED
@@ -826,11 +826,20 @@ var testVariations = ({
|
|
826
826
|
}
|
827
827
|
};
|
828
828
|
|
829
|
+
// src/storage/commands.ts
|
830
|
+
import { dequal as dequal2 } from "dequal/lite";
|
831
|
+
var areCommandsEqual = (a, b) => {
|
832
|
+
if (a.type !== b.type) {
|
833
|
+
return false;
|
834
|
+
}
|
835
|
+
return dequal2(a, b);
|
836
|
+
};
|
837
|
+
|
829
838
|
// src/storage/CookieTransitionDataStore.ts
|
830
839
|
import Cookies from "js-cookie";
|
831
840
|
|
832
841
|
// src/storage/TransitionDataStore.ts
|
833
|
-
import { dequal as
|
842
|
+
import { dequal as dequal3 } from "dequal/lite";
|
834
843
|
import mitt from "mitt";
|
835
844
|
var SERVER_STATE_ID = "__UNIFORM_DATA__";
|
836
845
|
var _data, _initialData, _mitt;
|
@@ -876,7 +885,7 @@ var TransitionDataStore = class {
|
|
876
885
|
await this.handleDelete(fromAllDevices);
|
877
886
|
}
|
878
887
|
signalAsyncDataUpdate(newScores) {
|
879
|
-
if (
|
888
|
+
if (dequal3(this.data, newScores)) {
|
880
889
|
return;
|
881
890
|
}
|
882
891
|
__privateSet(this, _data, newScores);
|
@@ -1149,7 +1158,7 @@ var emptyVisitorData = () => ({
|
|
1149
1158
|
});
|
1150
1159
|
|
1151
1160
|
// src/storage/VisitorDataStore.ts
|
1152
|
-
import { dequal as
|
1161
|
+
import { dequal as dequal4 } from "dequal/lite";
|
1153
1162
|
import mitt2 from "mitt";
|
1154
1163
|
|
1155
1164
|
// src/storage/util/applyCommandsToData.ts
|
@@ -1399,11 +1408,11 @@ replaceData_fn = function(data, quiet = false) {
|
|
1399
1408
|
onLogMessage: __privateGet(this, _options).onLogMessage
|
1400
1409
|
});
|
1401
1410
|
}
|
1402
|
-
const haveScoresChanged = !
|
1403
|
-
const haveSessionScoresChanged = !
|
1404
|
-
const haveQuirksChanged = !
|
1405
|
-
const haveTestsChanged = !
|
1406
|
-
const haveGoalsChanged = !
|
1411
|
+
const haveScoresChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.scores, data.scores);
|
1412
|
+
const haveSessionScoresChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.sessionScores, data.sessionScores);
|
1413
|
+
const haveQuirksChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.quirks, data.quirks);
|
1414
|
+
const haveTestsChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.tests, data.tests);
|
1415
|
+
const haveGoalsChanged = !dequal4(oldData == null ? void 0 : oldData.visitorData.goals, data.goals);
|
1407
1416
|
const updatedData = {
|
1408
1417
|
updated: now,
|
1409
1418
|
visitorData: data
|
@@ -1485,11 +1494,11 @@ defaultData_fn = function() {
|
|
1485
1494
|
};
|
1486
1495
|
|
1487
1496
|
// src/Context.ts
|
1488
|
-
import { dequal as
|
1497
|
+
import { dequal as dequal5 } from "dequal/lite";
|
1489
1498
|
import mitt3 from "mitt";
|
1490
1499
|
var CONTEXTUAL_EDITING_TEST_NAME = "contextual_editing_test";
|
1491
1500
|
var CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_test_selected_variant";
|
1492
|
-
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _mitt3, _emitTest, emitTest_fn, _updateGoals, updateGoals_fn, _updateComputedScores, updateComputedScores_fn, _calculateScores, calculateScores_fn;
|
1501
|
+
var _serverTransitionState, _scores, _state, _pzCache, _plugins, _commands, _mitt3, _emitTest, emitTest_fn, _updateGoals, updateGoals_fn, _updateComputedScores, updateComputedScores_fn, _calculateScores, calculateScores_fn;
|
1493
1502
|
var Context = class {
|
1494
1503
|
constructor(options) {
|
1495
1504
|
__privateAdd(this, _emitTest);
|
@@ -1502,6 +1511,7 @@ var Context = class {
|
|
1502
1511
|
__privateAdd(this, _state, void 0);
|
1503
1512
|
__privateAdd(this, _pzCache, {});
|
1504
1513
|
__privateAdd(this, _plugins, void 0);
|
1514
|
+
__privateAdd(this, _commands, void 0);
|
1505
1515
|
__privateAdd(this, _mitt3, mitt3());
|
1506
1516
|
/**
|
1507
1517
|
* Subscribe to events
|
@@ -1515,6 +1525,9 @@ var Context = class {
|
|
1515
1525
|
const { manifest, ...storageOptions } = options;
|
1516
1526
|
__privateSet(this, _state, {});
|
1517
1527
|
__privateSet(this, _plugins, options.plugins);
|
1528
|
+
if (typeof options.transitionStore !== "undefined") {
|
1529
|
+
__privateSet(this, _commands, []);
|
1530
|
+
}
|
1518
1531
|
(_a = __privateGet(this, _plugins)) == null ? void 0 : _a.forEach((plugin) => {
|
1519
1532
|
if (!plugin.logDrain) {
|
1520
1533
|
return;
|
@@ -1595,7 +1608,7 @@ var Context = class {
|
|
1595
1608
|
* will NOT result in a recomputation of signal state.
|
1596
1609
|
*/
|
1597
1610
|
async update(newData) {
|
1598
|
-
var _a, _b, _c, _d;
|
1611
|
+
var _a, _b, _c, _d, _e;
|
1599
1612
|
const commands = [];
|
1600
1613
|
const newServerSideTests = {};
|
1601
1614
|
if ((_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) {
|
@@ -1690,6 +1703,10 @@ var Context = class {
|
|
1690
1703
|
});
|
1691
1704
|
await this.storage.updateData(commands);
|
1692
1705
|
if (__privateGet(this, _serverTransitionState)) {
|
1706
|
+
await this.processServerCommands({
|
1707
|
+
serverCommands: __privateGet(this, _serverTransitionState).commands,
|
1708
|
+
commands
|
1709
|
+
});
|
1693
1710
|
__privateMethod(this, _updateComputedScores, updateComputedScores_fn).call(this, this.storage.data);
|
1694
1711
|
Object.entries(newServerSideTests).forEach(([testName, testVariantId]) => {
|
1695
1712
|
__privateMethod(this, _emitTest, emitTest_fn).call(this, {
|
@@ -1710,10 +1727,31 @@ var Context = class {
|
|
1710
1727
|
await plugin.update(newData);
|
1711
1728
|
}
|
1712
1729
|
}
|
1730
|
+
(_e = __privateGet(this, _commands)) == null ? void 0 : _e.push(...commands);
|
1713
1731
|
} finally {
|
1714
1732
|
__privateGet(this, _mitt3).emit("log", ["info", 2, "ENDGROUP"]);
|
1715
1733
|
}
|
1716
1734
|
}
|
1735
|
+
async processServerCommands({
|
1736
|
+
serverCommands,
|
1737
|
+
commands
|
1738
|
+
}) {
|
1739
|
+
if (!(serverCommands == null ? void 0 : serverCommands.length)) {
|
1740
|
+
return;
|
1741
|
+
}
|
1742
|
+
const notExecutedCommands = [];
|
1743
|
+
serverCommands.forEach((serverCommand) => {
|
1744
|
+
const found = commands.find((command) => {
|
1745
|
+
return areCommandsEqual(command, serverCommand);
|
1746
|
+
});
|
1747
|
+
if (!found) {
|
1748
|
+
notExecutedCommands.push(serverCommand);
|
1749
|
+
}
|
1750
|
+
});
|
1751
|
+
if (notExecutedCommands.length > 0) {
|
1752
|
+
await this.storage.updateData(notExecutedCommands);
|
1753
|
+
}
|
1754
|
+
}
|
1717
1755
|
/** use test() instead */
|
1718
1756
|
getTestVariantId(testName) {
|
1719
1757
|
var _a, _b, _c, _d;
|
@@ -1792,7 +1830,7 @@ var Context = class {
|
|
1792
1830
|
control: this.storage.data.controlGroup,
|
1793
1831
|
changed: true
|
1794
1832
|
};
|
1795
|
-
if (previousPlacement &&
|
1833
|
+
if (previousPlacement && dequal5(eventData.variantIds, previousPlacement)) {
|
1796
1834
|
eventData.changed = false;
|
1797
1835
|
}
|
1798
1836
|
__privateGet(this, _mitt3).emit("personalizationResult", eventData);
|
@@ -1826,7 +1864,8 @@ var Context = class {
|
|
1826
1864
|
quirks: this.storage.data.quirks,
|
1827
1865
|
ssv: __privateGet(this, _scores),
|
1828
1866
|
tests: {},
|
1829
|
-
personalizeVariants: this.storage.data.personalizeVariants
|
1867
|
+
personalizeVariants: this.storage.data.personalizeVariants,
|
1868
|
+
commands: __privateGet(this, _commands)
|
1830
1869
|
};
|
1831
1870
|
const allTests = this.storage.data.tests;
|
1832
1871
|
Object.entries(allTests).map(([testName, testValue]) => {
|
@@ -1855,6 +1894,7 @@ _scores = new WeakMap();
|
|
1855
1894
|
_state = new WeakMap();
|
1856
1895
|
_pzCache = new WeakMap();
|
1857
1896
|
_plugins = new WeakMap();
|
1897
|
+
_commands = new WeakMap();
|
1858
1898
|
_mitt3 = new WeakMap();
|
1859
1899
|
_emitTest = new WeakSet();
|
1860
1900
|
emitTest_fn = function(event) {
|
@@ -1870,7 +1910,7 @@ updateGoals_fn = async function(data) {
|
|
1870
1910
|
_updateComputedScores = new WeakSet();
|
1871
1911
|
updateComputedScores_fn = function(newData) {
|
1872
1912
|
const newScores = __privateMethod(this, _calculateScores, calculateScores_fn).call(this, newData);
|
1873
|
-
const newScoresHaveChanged = !
|
1913
|
+
const newScoresHaveChanged = !dequal5(newScores, __privateGet(this, _scores));
|
1874
1914
|
if (newScoresHaveChanged) {
|
1875
1915
|
__privateSet(this, _scores, newScores);
|
1876
1916
|
__privateMethod(this, _updateGoals, updateGoals_fn).call(this, {
|
@@ -2541,6 +2581,7 @@ export {
|
|
2541
2581
|
TransitionDataStore,
|
2542
2582
|
UNIFORM_DEFAULT_COOKIE_NAME,
|
2543
2583
|
VisitorDataStore,
|
2584
|
+
areCommandsEqual,
|
2544
2585
|
computeAggregateDimensions,
|
2545
2586
|
cookieEvaluator,
|
2546
2587
|
createConsoleLogDrain,
|
@@ -158,6 +158,7 @@ type SetPersonalizeVariantControlCommand = StorageCommand<'setpersonalizecontrol
|
|
158
158
|
index: number;
|
159
159
|
control: boolean;
|
160
160
|
}>;
|
161
|
+
declare const areCommandsEqual: (a: StorageCommands, b: StorageCommands) => boolean;
|
161
162
|
|
162
163
|
type TransitionDataStoreOptions = {
|
163
164
|
initialData?: Partial<VisitorData>;
|
@@ -169,6 +170,10 @@ type ServerToClientTransitionState = Pick<Partial<VisitorData>, 'quirks' | 'test
|
|
169
170
|
* recomputation.
|
170
171
|
*/
|
171
172
|
ssv?: ScoreVector;
|
173
|
+
/**
|
174
|
+
* Storage commands that the server
|
175
|
+
*/
|
176
|
+
commands?: StorageCommands[];
|
172
177
|
};
|
173
178
|
declare const SERVER_STATE_ID = "__UNIFORM_DATA__";
|
174
179
|
type TransitionDataStoreEvents = {
|
@@ -1112,6 +1117,10 @@ declare class Context implements ContextInstance {
|
|
1112
1117
|
* will NOT result in a recomputation of signal state.
|
1113
1118
|
*/
|
1114
1119
|
update(newData: Partial<ContextState>): Promise<void>;
|
1120
|
+
processServerCommands({ serverCommands, commands, }: {
|
1121
|
+
serverCommands: StorageCommands[] | undefined;
|
1122
|
+
commands: StorageCommands[];
|
1123
|
+
}): Promise<void>;
|
1115
1124
|
/** use test() instead */
|
1116
1125
|
getTestVariantId(testName: string): string | null | undefined;
|
1117
1126
|
/** use test() instead */
|
@@ -1207,4 +1216,4 @@ declare global {
|
|
1207
1216
|
}
|
1208
1217
|
}
|
1209
1218
|
|
1210
|
-
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
|
1219
|
+
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 };
|
@@ -158,6 +158,7 @@ type SetPersonalizeVariantControlCommand = StorageCommand<'setpersonalizecontrol
|
|
158
158
|
index: number;
|
159
159
|
control: boolean;
|
160
160
|
}>;
|
161
|
+
declare const areCommandsEqual: (a: StorageCommands, b: StorageCommands) => boolean;
|
161
162
|
|
162
163
|
type TransitionDataStoreOptions = {
|
163
164
|
initialData?: Partial<VisitorData>;
|
@@ -169,6 +170,10 @@ type ServerToClientTransitionState = Pick<Partial<VisitorData>, 'quirks' | 'test
|
|
169
170
|
* recomputation.
|
170
171
|
*/
|
171
172
|
ssv?: ScoreVector;
|
173
|
+
/**
|
174
|
+
* Storage commands that the server
|
175
|
+
*/
|
176
|
+
commands?: StorageCommands[];
|
172
177
|
};
|
173
178
|
declare const SERVER_STATE_ID = "__UNIFORM_DATA__";
|
174
179
|
type TransitionDataStoreEvents = {
|
@@ -1112,6 +1117,10 @@ declare class Context implements ContextInstance {
|
|
1112
1117
|
* will NOT result in a recomputation of signal state.
|
1113
1118
|
*/
|
1114
1119
|
update(newData: Partial<ContextState>): Promise<void>;
|
1120
|
+
processServerCommands({ serverCommands, commands, }: {
|
1121
|
+
serverCommands: StorageCommands[] | undefined;
|
1122
|
+
commands: StorageCommands[];
|
1123
|
+
}): Promise<void>;
|
1115
1124
|
/** use test() instead */
|
1116
1125
|
getTestVariantId(testName: string): string | null | undefined;
|
1117
1126
|
/** use test() instead */
|
@@ -1207,4 +1216,4 @@ declare global {
|
|
1207
1216
|
}
|
1208
1217
|
}
|
1209
1218
|
|
1210
|
-
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
|
1219
|
+
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 };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/context",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.157.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": "af204708fe4428d4dfe46f894fb2724a9c00b40a"
|
72
72
|
}
|