@uniformdev/context 19.181.1-alpha.4 → 19.181.2
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/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.esm.js +29 -9
- package/dist/index.js +41 -9
- package/dist/index.mjs +29 -9
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -50,6 +50,18 @@ declare class CookieTransitionDataStore extends TransitionDataStore {
|
|
50
50
|
handleDelete(): Promise<void>;
|
51
51
|
handleUpdateData(_: StorageCommands[], computedValue: VisitorData): Promise<void>;
|
52
52
|
}
|
53
|
+
declare const TYPE_SEP = "~";
|
54
|
+
declare const PAIR_SEP = "!";
|
55
|
+
declare const KV_SEP = "-";
|
56
|
+
declare function parseScoreCookie(cookieValue: string | undefined): Partial<VisitorData> | undefined;
|
57
|
+
declare function parseCookieScores(type: string | undefined): Record<string, string>;
|
58
|
+
declare function parseCookieType(type: string | undefined): Record<string, string>;
|
59
|
+
declare function decodeCookieType(type: Record<string, string>): Record<string, number>;
|
60
|
+
declare function serializeCookie(data: VisitorData): string;
|
61
|
+
declare function serializePersonalizeVariants({ personalizeVariants, }: Pick<VisitorData, 'personalizeVariants'>): string;
|
62
|
+
declare function decodePersonalizeVariants(data: string | undefined): VisitorData['personalizeVariants'];
|
63
|
+
declare function encodeCookieType(type: Record<string, number>): Record<string, string>;
|
64
|
+
declare function serializeCookieType(type: Record<string, string>): string;
|
53
65
|
|
54
66
|
type EdgeTransitionDataStoreOptions = TransitionDataStoreOptions & {
|
55
67
|
serverCookieValue?: string;
|
@@ -177,4 +189,4 @@ type QuickConnectConfig = {
|
|
177
189
|
declare function serializeQuickConnect(config: QuickConnectConfig): string;
|
178
190
|
declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
|
179
191
|
|
180
|
-
export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, type QuickConnectConfig, ScoreVector, ScriptType, StorageCommands, StringMatch, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseQuickConnect, queryStringEvaluator, quirkEvaluator, serializeQuickConnect };
|
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 };
|
package/dist/index.d.ts
CHANGED
@@ -50,6 +50,18 @@ declare class CookieTransitionDataStore extends TransitionDataStore {
|
|
50
50
|
handleDelete(): Promise<void>;
|
51
51
|
handleUpdateData(_: StorageCommands[], computedValue: VisitorData): Promise<void>;
|
52
52
|
}
|
53
|
+
declare const TYPE_SEP = "~";
|
54
|
+
declare const PAIR_SEP = "!";
|
55
|
+
declare const KV_SEP = "-";
|
56
|
+
declare function parseScoreCookie(cookieValue: string | undefined): Partial<VisitorData> | undefined;
|
57
|
+
declare function parseCookieScores(type: string | undefined): Record<string, string>;
|
58
|
+
declare function parseCookieType(type: string | undefined): Record<string, string>;
|
59
|
+
declare function decodeCookieType(type: Record<string, string>): Record<string, number>;
|
60
|
+
declare function serializeCookie(data: VisitorData): string;
|
61
|
+
declare function serializePersonalizeVariants({ personalizeVariants, }: Pick<VisitorData, 'personalizeVariants'>): string;
|
62
|
+
declare function decodePersonalizeVariants(data: string | undefined): VisitorData['personalizeVariants'];
|
63
|
+
declare function encodeCookieType(type: Record<string, number>): Record<string, string>;
|
64
|
+
declare function serializeCookieType(type: Record<string, string>): string;
|
53
65
|
|
54
66
|
type EdgeTransitionDataStoreOptions = TransitionDataStoreOptions & {
|
55
67
|
serverCookieValue?: string;
|
@@ -177,4 +189,4 @@ type QuickConnectConfig = {
|
|
177
189
|
declare function serializeQuickConnect(config: QuickConnectConfig): string;
|
178
190
|
declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
|
179
191
|
|
180
|
-
export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, type QuickConnectConfig, ScoreVector, ScriptType, StorageCommands, StringMatch, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseQuickConnect, queryStringEvaluator, quirkEvaluator, serializeQuickConnect };
|
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 };
|
package/dist/index.esm.js
CHANGED
@@ -959,14 +959,26 @@ function parseScoreCookie(cookieValue) {
|
|
959
959
|
const data = {
|
960
960
|
// this is true since we're reading a cookie, which wouldn't exist if consent wasn't given
|
961
961
|
consent: true,
|
962
|
-
sessionScores: decodeCookieType(
|
963
|
-
scores: decodeCookieType(
|
962
|
+
sessionScores: decodeCookieType(parseCookieScores(sessionScores)),
|
963
|
+
scores: decodeCookieType(parseCookieScores(visitorScores)),
|
964
964
|
tests: parseCookieType(abTestData),
|
965
965
|
controlGroup: controlGroup === "1",
|
966
966
|
personalizeVariants: decodePersonalizeVariants(personalizeVariants)
|
967
967
|
};
|
968
968
|
return data;
|
969
969
|
}
|
970
|
+
function parseCookieScores(type) {
|
971
|
+
if (!type) {
|
972
|
+
return {};
|
973
|
+
}
|
974
|
+
const pairs = type.split(PAIR_SEP).map((pair) => pair.split(KV_SEP));
|
975
|
+
return pairs.reduce((acc, cur) => {
|
976
|
+
if (cur.length < 2) return acc;
|
977
|
+
const key = cur.slice(0, -1).join(KV_SEP);
|
978
|
+
acc[key] = cur[cur.length - 1];
|
979
|
+
return acc;
|
980
|
+
}, {});
|
981
|
+
}
|
970
982
|
function parseCookieType(type) {
|
971
983
|
if (!type) {
|
972
984
|
return {};
|
@@ -1290,12 +1302,12 @@ var VisitorDataStore = class {
|
|
1290
1302
|
}
|
1291
1303
|
/** Gets the current visitor data. This property is always up to date. */
|
1292
1304
|
get data() {
|
1293
|
-
var _a, _b;
|
1294
|
-
const data = __privateGet(this, _VisitorDataStore_instances, currentData_get);
|
1305
|
+
var _a, _b, _c;
|
1306
|
+
const data = (_a = __privateGet(this, _VisitorDataStore_instances, currentData_get)) != null ? _a : { visitorData: __privateMethod(this, _VisitorDataStore_instances, defaultData_fn).call(this), updated: (/* @__PURE__ */ new Date()).getTime() };
|
1295
1307
|
if (__privateMethod(this, _VisitorDataStore_instances, isExpired_fn).call(this, data)) {
|
1296
1308
|
const { sessionScores, ...newData } = data.visitorData;
|
1297
1309
|
__privateMethod(this, _VisitorDataStore_instances, replaceData_fn).call(this, { ...newData, sessionScores: {} });
|
1298
|
-
(
|
1310
|
+
(_c = (_b = __privateGet(this, _options)).onLogMessage) == null ? void 0 : _c.call(_b, ["info", 120]);
|
1299
1311
|
return __privateGet(this, _VisitorDataStore_instances, currentData_get).visitorData;
|
1300
1312
|
}
|
1301
1313
|
return data.visitorData;
|
@@ -2216,7 +2228,6 @@ var createInsights = ({
|
|
2216
2228
|
},
|
2217
2229
|
pageHit: () => {
|
2218
2230
|
if (!storageData) {
|
2219
|
-
console.error("Insights not initialized");
|
2220
2231
|
return;
|
2221
2232
|
}
|
2222
2233
|
if (previousUrl === window.location.href) {
|
@@ -2244,7 +2255,6 @@ var createInsights = ({
|
|
2244
2255
|
},
|
2245
2256
|
personalizationResult: (result) => {
|
2246
2257
|
if (!storageData) {
|
2247
|
-
console.error("Insights not initialized");
|
2248
2258
|
return;
|
2249
2259
|
}
|
2250
2260
|
client.personalizationResult({
|
@@ -2256,7 +2266,6 @@ var createInsights = ({
|
|
2256
2266
|
},
|
2257
2267
|
goalConvert: (goalId) => {
|
2258
2268
|
if (!storageData) {
|
2259
|
-
console.error("Insights not initialized");
|
2260
2269
|
return;
|
2261
2270
|
}
|
2262
2271
|
client.goalConvert({
|
@@ -2268,7 +2277,6 @@ var createInsights = ({
|
|
2268
2277
|
},
|
2269
2278
|
scoresChange: (scores) => {
|
2270
2279
|
if (!storageData) {
|
2271
|
-
console.error("Insights not initialized");
|
2272
2280
|
return;
|
2273
2281
|
}
|
2274
2282
|
client.scoresChange({
|
@@ -2536,9 +2544,12 @@ export {
|
|
2536
2544
|
EdgeNodeTagName,
|
2537
2545
|
EdgeTransitionDataStore,
|
2538
2546
|
GroupCriteriaEvaluator,
|
2547
|
+
KV_SEP,
|
2539
2548
|
ManifestInstance,
|
2549
|
+
PAIR_SEP,
|
2540
2550
|
SERVER_STATE_ID,
|
2541
2551
|
ScriptType,
|
2552
|
+
TYPE_SEP,
|
2542
2553
|
TransitionDataStore,
|
2543
2554
|
UNIFORM_DEFAULT_COOKIE_NAME,
|
2544
2555
|
VisitorDataStore,
|
@@ -2549,11 +2560,14 @@ export {
|
|
2549
2560
|
createDebugConsoleLogDrain,
|
2550
2561
|
createLinearDecay,
|
2551
2562
|
currentPageEvaluator,
|
2563
|
+
decodeCookieType,
|
2564
|
+
decodePersonalizeVariants,
|
2552
2565
|
emptyVisitorData,
|
2553
2566
|
enableConsoleLogDrain,
|
2554
2567
|
enableContextDevTools,
|
2555
2568
|
enableDebugConsoleLogDrain,
|
2556
2569
|
enableUniformInsights,
|
2570
|
+
encodeCookieType,
|
2557
2571
|
evaluateVariantMatch,
|
2558
2572
|
eventEvaluator,
|
2559
2573
|
explainStringMatch,
|
@@ -2562,10 +2576,16 @@ export {
|
|
2562
2576
|
isStringMatch,
|
2563
2577
|
pageViewCountDimension,
|
2564
2578
|
pageViewCountEvaluator,
|
2579
|
+
parseCookieScores,
|
2580
|
+
parseCookieType,
|
2565
2581
|
parseQuickConnect,
|
2582
|
+
parseScoreCookie,
|
2566
2583
|
personalizeVariations,
|
2567
2584
|
queryStringEvaluator,
|
2568
2585
|
quirkEvaluator,
|
2586
|
+
serializeCookie,
|
2587
|
+
serializeCookieType,
|
2588
|
+
serializePersonalizeVariants,
|
2569
2589
|
serializeQuickConnect,
|
2570
2590
|
testVariations
|
2571
2591
|
};
|
package/dist/index.js
CHANGED
@@ -47,9 +47,12 @@ __export(src_exports, {
|
|
47
47
|
EdgeNodeTagName: () => EdgeNodeTagName,
|
48
48
|
EdgeTransitionDataStore: () => EdgeTransitionDataStore,
|
49
49
|
GroupCriteriaEvaluator: () => GroupCriteriaEvaluator,
|
50
|
+
KV_SEP: () => KV_SEP,
|
50
51
|
ManifestInstance: () => ManifestInstance,
|
52
|
+
PAIR_SEP: () => PAIR_SEP,
|
51
53
|
SERVER_STATE_ID: () => SERVER_STATE_ID,
|
52
54
|
ScriptType: () => ScriptType,
|
55
|
+
TYPE_SEP: () => TYPE_SEP,
|
53
56
|
TransitionDataStore: () => TransitionDataStore,
|
54
57
|
UNIFORM_DEFAULT_COOKIE_NAME: () => UNIFORM_DEFAULT_COOKIE_NAME,
|
55
58
|
VisitorDataStore: () => VisitorDataStore,
|
@@ -60,11 +63,14 @@ __export(src_exports, {
|
|
60
63
|
createDebugConsoleLogDrain: () => createDebugConsoleLogDrain,
|
61
64
|
createLinearDecay: () => createLinearDecay,
|
62
65
|
currentPageEvaluator: () => currentPageEvaluator,
|
66
|
+
decodeCookieType: () => decodeCookieType,
|
67
|
+
decodePersonalizeVariants: () => decodePersonalizeVariants,
|
63
68
|
emptyVisitorData: () => emptyVisitorData,
|
64
69
|
enableConsoleLogDrain: () => enableConsoleLogDrain,
|
65
70
|
enableContextDevTools: () => enableContextDevTools,
|
66
71
|
enableDebugConsoleLogDrain: () => enableDebugConsoleLogDrain,
|
67
72
|
enableUniformInsights: () => enableUniformInsights,
|
73
|
+
encodeCookieType: () => encodeCookieType,
|
68
74
|
evaluateVariantMatch: () => evaluateVariantMatch,
|
69
75
|
eventEvaluator: () => eventEvaluator,
|
70
76
|
explainStringMatch: () => explainStringMatch,
|
@@ -73,10 +79,16 @@ __export(src_exports, {
|
|
73
79
|
isStringMatch: () => isStringMatch,
|
74
80
|
pageViewCountDimension: () => pageViewCountDimension,
|
75
81
|
pageViewCountEvaluator: () => pageViewCountEvaluator,
|
82
|
+
parseCookieScores: () => parseCookieScores,
|
83
|
+
parseCookieType: () => parseCookieType,
|
76
84
|
parseQuickConnect: () => parseQuickConnect,
|
85
|
+
parseScoreCookie: () => parseScoreCookie,
|
77
86
|
personalizeVariations: () => personalizeVariations,
|
78
87
|
queryStringEvaluator: () => queryStringEvaluator,
|
79
88
|
quirkEvaluator: () => quirkEvaluator,
|
89
|
+
serializeCookie: () => serializeCookie,
|
90
|
+
serializeCookieType: () => serializeCookieType,
|
91
|
+
serializePersonalizeVariants: () => serializePersonalizeVariants,
|
80
92
|
serializeQuickConnect: () => serializeQuickConnect,
|
81
93
|
testVariations: () => testVariations
|
82
94
|
});
|
@@ -1031,14 +1043,26 @@ function parseScoreCookie(cookieValue) {
|
|
1031
1043
|
const data = {
|
1032
1044
|
// this is true since we're reading a cookie, which wouldn't exist if consent wasn't given
|
1033
1045
|
consent: true,
|
1034
|
-
sessionScores: decodeCookieType(
|
1035
|
-
scores: decodeCookieType(
|
1046
|
+
sessionScores: decodeCookieType(parseCookieScores(sessionScores)),
|
1047
|
+
scores: decodeCookieType(parseCookieScores(visitorScores)),
|
1036
1048
|
tests: parseCookieType(abTestData),
|
1037
1049
|
controlGroup: controlGroup === "1",
|
1038
1050
|
personalizeVariants: decodePersonalizeVariants(personalizeVariants)
|
1039
1051
|
};
|
1040
1052
|
return data;
|
1041
1053
|
}
|
1054
|
+
function parseCookieScores(type) {
|
1055
|
+
if (!type) {
|
1056
|
+
return {};
|
1057
|
+
}
|
1058
|
+
const pairs = type.split(PAIR_SEP).map((pair) => pair.split(KV_SEP));
|
1059
|
+
return pairs.reduce((acc, cur) => {
|
1060
|
+
if (cur.length < 2) return acc;
|
1061
|
+
const key = cur.slice(0, -1).join(KV_SEP);
|
1062
|
+
acc[key] = cur[cur.length - 1];
|
1063
|
+
return acc;
|
1064
|
+
}, {});
|
1065
|
+
}
|
1042
1066
|
function parseCookieType(type) {
|
1043
1067
|
if (!type) {
|
1044
1068
|
return {};
|
@@ -1362,12 +1386,12 @@ var VisitorDataStore = class {
|
|
1362
1386
|
}
|
1363
1387
|
/** Gets the current visitor data. This property is always up to date. */
|
1364
1388
|
get data() {
|
1365
|
-
var _a, _b;
|
1366
|
-
const data = __privateGet(this, _VisitorDataStore_instances, currentData_get);
|
1389
|
+
var _a, _b, _c;
|
1390
|
+
const data = (_a = __privateGet(this, _VisitorDataStore_instances, currentData_get)) != null ? _a : { visitorData: __privateMethod(this, _VisitorDataStore_instances, defaultData_fn).call(this), updated: (/* @__PURE__ */ new Date()).getTime() };
|
1367
1391
|
if (__privateMethod(this, _VisitorDataStore_instances, isExpired_fn).call(this, data)) {
|
1368
1392
|
const { sessionScores, ...newData } = data.visitorData;
|
1369
1393
|
__privateMethod(this, _VisitorDataStore_instances, replaceData_fn).call(this, { ...newData, sessionScores: {} });
|
1370
|
-
(
|
1394
|
+
(_c = (_b = __privateGet(this, _options)).onLogMessage) == null ? void 0 : _c.call(_b, ["info", 120]);
|
1371
1395
|
return __privateGet(this, _VisitorDataStore_instances, currentData_get).visitorData;
|
1372
1396
|
}
|
1373
1397
|
return data.visitorData;
|
@@ -2288,7 +2312,6 @@ var createInsights = ({
|
|
2288
2312
|
},
|
2289
2313
|
pageHit: () => {
|
2290
2314
|
if (!storageData) {
|
2291
|
-
console.error("Insights not initialized");
|
2292
2315
|
return;
|
2293
2316
|
}
|
2294
2317
|
if (previousUrl === window.location.href) {
|
@@ -2316,7 +2339,6 @@ var createInsights = ({
|
|
2316
2339
|
},
|
2317
2340
|
personalizationResult: (result) => {
|
2318
2341
|
if (!storageData) {
|
2319
|
-
console.error("Insights not initialized");
|
2320
2342
|
return;
|
2321
2343
|
}
|
2322
2344
|
client.personalizationResult({
|
@@ -2328,7 +2350,6 @@ var createInsights = ({
|
|
2328
2350
|
},
|
2329
2351
|
goalConvert: (goalId) => {
|
2330
2352
|
if (!storageData) {
|
2331
|
-
console.error("Insights not initialized");
|
2332
2353
|
return;
|
2333
2354
|
}
|
2334
2355
|
client.goalConvert({
|
@@ -2340,7 +2361,6 @@ var createInsights = ({
|
|
2340
2361
|
},
|
2341
2362
|
scoresChange: (scores) => {
|
2342
2363
|
if (!storageData) {
|
2343
|
-
console.error("Insights not initialized");
|
2344
2364
|
return;
|
2345
2365
|
}
|
2346
2366
|
client.scoresChange({
|
@@ -2609,9 +2629,12 @@ function parseQuickConnect(serialized) {
|
|
2609
2629
|
EdgeNodeTagName,
|
2610
2630
|
EdgeTransitionDataStore,
|
2611
2631
|
GroupCriteriaEvaluator,
|
2632
|
+
KV_SEP,
|
2612
2633
|
ManifestInstance,
|
2634
|
+
PAIR_SEP,
|
2613
2635
|
SERVER_STATE_ID,
|
2614
2636
|
ScriptType,
|
2637
|
+
TYPE_SEP,
|
2615
2638
|
TransitionDataStore,
|
2616
2639
|
UNIFORM_DEFAULT_COOKIE_NAME,
|
2617
2640
|
VisitorDataStore,
|
@@ -2622,11 +2645,14 @@ function parseQuickConnect(serialized) {
|
|
2622
2645
|
createDebugConsoleLogDrain,
|
2623
2646
|
createLinearDecay,
|
2624
2647
|
currentPageEvaluator,
|
2648
|
+
decodeCookieType,
|
2649
|
+
decodePersonalizeVariants,
|
2625
2650
|
emptyVisitorData,
|
2626
2651
|
enableConsoleLogDrain,
|
2627
2652
|
enableContextDevTools,
|
2628
2653
|
enableDebugConsoleLogDrain,
|
2629
2654
|
enableUniformInsights,
|
2655
|
+
encodeCookieType,
|
2630
2656
|
evaluateVariantMatch,
|
2631
2657
|
eventEvaluator,
|
2632
2658
|
explainStringMatch,
|
@@ -2635,10 +2661,16 @@ function parseQuickConnect(serialized) {
|
|
2635
2661
|
isStringMatch,
|
2636
2662
|
pageViewCountDimension,
|
2637
2663
|
pageViewCountEvaluator,
|
2664
|
+
parseCookieScores,
|
2665
|
+
parseCookieType,
|
2638
2666
|
parseQuickConnect,
|
2667
|
+
parseScoreCookie,
|
2639
2668
|
personalizeVariations,
|
2640
2669
|
queryStringEvaluator,
|
2641
2670
|
quirkEvaluator,
|
2671
|
+
serializeCookie,
|
2672
|
+
serializeCookieType,
|
2673
|
+
serializePersonalizeVariants,
|
2642
2674
|
serializeQuickConnect,
|
2643
2675
|
testVariations
|
2644
2676
|
});
|
package/dist/index.mjs
CHANGED
@@ -959,14 +959,26 @@ function parseScoreCookie(cookieValue) {
|
|
959
959
|
const data = {
|
960
960
|
// this is true since we're reading a cookie, which wouldn't exist if consent wasn't given
|
961
961
|
consent: true,
|
962
|
-
sessionScores: decodeCookieType(
|
963
|
-
scores: decodeCookieType(
|
962
|
+
sessionScores: decodeCookieType(parseCookieScores(sessionScores)),
|
963
|
+
scores: decodeCookieType(parseCookieScores(visitorScores)),
|
964
964
|
tests: parseCookieType(abTestData),
|
965
965
|
controlGroup: controlGroup === "1",
|
966
966
|
personalizeVariants: decodePersonalizeVariants(personalizeVariants)
|
967
967
|
};
|
968
968
|
return data;
|
969
969
|
}
|
970
|
+
function parseCookieScores(type) {
|
971
|
+
if (!type) {
|
972
|
+
return {};
|
973
|
+
}
|
974
|
+
const pairs = type.split(PAIR_SEP).map((pair) => pair.split(KV_SEP));
|
975
|
+
return pairs.reduce((acc, cur) => {
|
976
|
+
if (cur.length < 2) return acc;
|
977
|
+
const key = cur.slice(0, -1).join(KV_SEP);
|
978
|
+
acc[key] = cur[cur.length - 1];
|
979
|
+
return acc;
|
980
|
+
}, {});
|
981
|
+
}
|
970
982
|
function parseCookieType(type) {
|
971
983
|
if (!type) {
|
972
984
|
return {};
|
@@ -1290,12 +1302,12 @@ var VisitorDataStore = class {
|
|
1290
1302
|
}
|
1291
1303
|
/** Gets the current visitor data. This property is always up to date. */
|
1292
1304
|
get data() {
|
1293
|
-
var _a, _b;
|
1294
|
-
const data = __privateGet(this, _VisitorDataStore_instances, currentData_get);
|
1305
|
+
var _a, _b, _c;
|
1306
|
+
const data = (_a = __privateGet(this, _VisitorDataStore_instances, currentData_get)) != null ? _a : { visitorData: __privateMethod(this, _VisitorDataStore_instances, defaultData_fn).call(this), updated: (/* @__PURE__ */ new Date()).getTime() };
|
1295
1307
|
if (__privateMethod(this, _VisitorDataStore_instances, isExpired_fn).call(this, data)) {
|
1296
1308
|
const { sessionScores, ...newData } = data.visitorData;
|
1297
1309
|
__privateMethod(this, _VisitorDataStore_instances, replaceData_fn).call(this, { ...newData, sessionScores: {} });
|
1298
|
-
(
|
1310
|
+
(_c = (_b = __privateGet(this, _options)).onLogMessage) == null ? void 0 : _c.call(_b, ["info", 120]);
|
1299
1311
|
return __privateGet(this, _VisitorDataStore_instances, currentData_get).visitorData;
|
1300
1312
|
}
|
1301
1313
|
return data.visitorData;
|
@@ -2216,7 +2228,6 @@ var createInsights = ({
|
|
2216
2228
|
},
|
2217
2229
|
pageHit: () => {
|
2218
2230
|
if (!storageData) {
|
2219
|
-
console.error("Insights not initialized");
|
2220
2231
|
return;
|
2221
2232
|
}
|
2222
2233
|
if (previousUrl === window.location.href) {
|
@@ -2244,7 +2255,6 @@ var createInsights = ({
|
|
2244
2255
|
},
|
2245
2256
|
personalizationResult: (result) => {
|
2246
2257
|
if (!storageData) {
|
2247
|
-
console.error("Insights not initialized");
|
2248
2258
|
return;
|
2249
2259
|
}
|
2250
2260
|
client.personalizationResult({
|
@@ -2256,7 +2266,6 @@ var createInsights = ({
|
|
2256
2266
|
},
|
2257
2267
|
goalConvert: (goalId) => {
|
2258
2268
|
if (!storageData) {
|
2259
|
-
console.error("Insights not initialized");
|
2260
2269
|
return;
|
2261
2270
|
}
|
2262
2271
|
client.goalConvert({
|
@@ -2268,7 +2277,6 @@ var createInsights = ({
|
|
2268
2277
|
},
|
2269
2278
|
scoresChange: (scores) => {
|
2270
2279
|
if (!storageData) {
|
2271
|
-
console.error("Insights not initialized");
|
2272
2280
|
return;
|
2273
2281
|
}
|
2274
2282
|
client.scoresChange({
|
@@ -2536,9 +2544,12 @@ export {
|
|
2536
2544
|
EdgeNodeTagName,
|
2537
2545
|
EdgeTransitionDataStore,
|
2538
2546
|
GroupCriteriaEvaluator,
|
2547
|
+
KV_SEP,
|
2539
2548
|
ManifestInstance,
|
2549
|
+
PAIR_SEP,
|
2540
2550
|
SERVER_STATE_ID,
|
2541
2551
|
ScriptType,
|
2552
|
+
TYPE_SEP,
|
2542
2553
|
TransitionDataStore,
|
2543
2554
|
UNIFORM_DEFAULT_COOKIE_NAME,
|
2544
2555
|
VisitorDataStore,
|
@@ -2549,11 +2560,14 @@ export {
|
|
2549
2560
|
createDebugConsoleLogDrain,
|
2550
2561
|
createLinearDecay,
|
2551
2562
|
currentPageEvaluator,
|
2563
|
+
decodeCookieType,
|
2564
|
+
decodePersonalizeVariants,
|
2552
2565
|
emptyVisitorData,
|
2553
2566
|
enableConsoleLogDrain,
|
2554
2567
|
enableContextDevTools,
|
2555
2568
|
enableDebugConsoleLogDrain,
|
2556
2569
|
enableUniformInsights,
|
2570
|
+
encodeCookieType,
|
2557
2571
|
evaluateVariantMatch,
|
2558
2572
|
eventEvaluator,
|
2559
2573
|
explainStringMatch,
|
@@ -2562,10 +2576,16 @@ export {
|
|
2562
2576
|
isStringMatch,
|
2563
2577
|
pageViewCountDimension,
|
2564
2578
|
pageViewCountEvaluator,
|
2579
|
+
parseCookieScores,
|
2580
|
+
parseCookieType,
|
2565
2581
|
parseQuickConnect,
|
2582
|
+
parseScoreCookie,
|
2566
2583
|
personalizeVariations,
|
2567
2584
|
queryStringEvaluator,
|
2568
2585
|
quirkEvaluator,
|
2586
|
+
serializeCookie,
|
2587
|
+
serializeCookieType,
|
2588
|
+
serializePersonalizeVariants,
|
2569
2589
|
serializeQuickConnect,
|
2570
2590
|
testVariations
|
2571
2591
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/context",
|
3
|
-
"version": "19.181.
|
3
|
+
"version": "19.181.2",
|
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": "89ffb2d1ab09ac3cb09b3928194352e358ef7f07"
|
72
72
|
}
|