@uniformdev/context 19.61.1 → 19.62.1-alpha.127
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/LICENSE.txt +1 -1
- package/dist/api/api.d.mts +2 -2
- package/dist/api/api.d.ts +2 -2
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.esm.js +204 -27
- package/dist/index.js +204 -27
- package/dist/index.mjs +204 -27
- package/dist/{types-012db0cb.d.ts → types-WtfxfDct.d.mts} +56 -8
- package/dist/types-WtfxfDct.d.ts +1176 -0
- package/package.json +3 -3
package/LICENSE.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
©
|
1
|
+
© 2024 Uniform Systems, Inc. All Rights Reserved.
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
package/dist/api/api.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ay as paths$7, N as ManifestV2 } from '../types-WtfxfDct.mjs';
|
2
2
|
import 'mitt';
|
3
3
|
|
4
4
|
type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
@@ -1907,4 +1907,4 @@ declare class CachedContextClient extends ContextClient {
|
|
1907
1907
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
1908
1908
|
}
|
1909
1909
|
|
1910
|
-
export { Aggregate, AggregateClient, AggregateDeleteParameters, AggregateGetParameters, AggregateGetResponse, AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, ClientOptions, ContextClient, ContextDefinitions, CookieCriteria, CurrentPageCriteria, DimensionClient, DimensionDefinition, DimensionDisplayData, DimensionGetParameters, DimensionGetResponse, EnrichmentCategory, EnrichmentCategoryWithValues, EnrichmentClient, EnrichmentDeleteParameters, EnrichmentGetParameters, EnrichmentGetResponse, EnrichmentPutParameters, EnrichmentValue, EnrichmentValueDeleteParameters, EnrichmentValuePutParameters, EventCriteria, ExceptProject, LimitPolicy, ManifestClient, ManifestGetParameters, ManifestGetResponse, PageViewCountCriteria, QueryStringCriteria, Quirk, QuirkClient, QuirkCriteria, QuirkDeleteParameters, QuirkGetParameters, QuirkGetResponse, QuirkPutParameters, RootSignalCriteriaGroup, SignalClient, SignalDeleteParameters, SignalGetParameters, SignalGetResponse, SignalPutParameters, SignalWithId, Test, TestClient, TestDeleteParameters, TestGetParameters, TestGetResponse, TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy };
|
1910
|
+
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, type ClientOptions, ContextClient, type ContextDefinitions, type CookieCriteria, type CurrentPageCriteria, DimensionClient, type DimensionDefinition, type DimensionDisplayData, type DimensionGetParameters, type DimensionGetResponse, type EnrichmentCategory, type EnrichmentCategoryWithValues, EnrichmentClient, type EnrichmentDeleteParameters, type EnrichmentGetParameters, type EnrichmentGetResponse, type EnrichmentPutParameters, type EnrichmentValue, type EnrichmentValueDeleteParameters, type EnrichmentValuePutParameters, type EventCriteria, type ExceptProject, type LimitPolicy, ManifestClient, type ManifestGetParameters, type ManifestGetResponse, type PageViewCountCriteria, type QueryStringCriteria, type Quirk, QuirkClient, type QuirkCriteria, type QuirkDeleteParameters, type QuirkGetParameters, type QuirkGetResponse, type QuirkPutParameters, type RootSignalCriteriaGroup, SignalClient, type SignalDeleteParameters, type SignalGetParameters, type SignalGetResponse, type SignalPutParameters, type SignalWithId, type Test, TestClient, type TestDeleteParameters, type TestGetParameters, type TestGetResponse, type TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy };
|
package/dist/api/api.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ay as paths$7, N as ManifestV2 } from '../types-WtfxfDct.js';
|
2
2
|
import 'mitt';
|
3
3
|
|
4
4
|
type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
@@ -1907,4 +1907,4 @@ declare class CachedContextClient extends ContextClient {
|
|
1907
1907
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
1908
1908
|
}
|
1909
1909
|
|
1910
|
-
export { Aggregate, AggregateClient, AggregateDeleteParameters, AggregateGetParameters, AggregateGetResponse, AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, ClientOptions, ContextClient, ContextDefinitions, CookieCriteria, CurrentPageCriteria, DimensionClient, DimensionDefinition, DimensionDisplayData, DimensionGetParameters, DimensionGetResponse, EnrichmentCategory, EnrichmentCategoryWithValues, EnrichmentClient, EnrichmentDeleteParameters, EnrichmentGetParameters, EnrichmentGetResponse, EnrichmentPutParameters, EnrichmentValue, EnrichmentValueDeleteParameters, EnrichmentValuePutParameters, EventCriteria, ExceptProject, LimitPolicy, ManifestClient, ManifestGetParameters, ManifestGetResponse, PageViewCountCriteria, QueryStringCriteria, Quirk, QuirkClient, QuirkCriteria, QuirkDeleteParameters, QuirkGetParameters, QuirkGetResponse, QuirkPutParameters, RootSignalCriteriaGroup, SignalClient, SignalDeleteParameters, SignalGetParameters, SignalGetResponse, SignalPutParameters, SignalWithId, Test, TestClient, TestDeleteParameters, TestGetParameters, TestGetResponse, TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy };
|
1910
|
+
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, type ClientOptions, ContextClient, type ContextDefinitions, type CookieCriteria, type CurrentPageCriteria, DimensionClient, type DimensionDefinition, type DimensionDisplayData, type DimensionGetParameters, type DimensionGetResponse, type EnrichmentCategory, type EnrichmentCategoryWithValues, EnrichmentClient, type EnrichmentDeleteParameters, type EnrichmentGetParameters, type EnrichmentGetResponse, type EnrichmentPutParameters, type EnrichmentValue, type EnrichmentValueDeleteParameters, type EnrichmentValuePutParameters, type EventCriteria, type ExceptProject, type LimitPolicy, ManifestClient, type ManifestGetParameters, type ManifestGetResponse, type PageViewCountCriteria, type QueryStringCriteria, type Quirk, QuirkClient, type QuirkCriteria, type QuirkDeleteParameters, type QuirkGetParameters, type QuirkGetResponse, type QuirkPutParameters, type RootSignalCriteriaGroup, SignalClient, type SignalDeleteParameters, type SignalGetParameters, type SignalGetResponse, type SignalPutParameters, type SignalWithId, type Test, TestClient, type TestDeleteParameters, type TestGetParameters, type TestGetResponse, type TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy };
|
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 } from './types-
|
2
|
-
export {
|
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-WtfxfDct.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, aw as ContextState, ax as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, al 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, ar as EnrichmentData, au as EventData, H as GroupCriteriaEvaluator, af as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, aa as ModifyScoreCommand, ab as ModifySessionScoreCommand, Y as NumberMatch, P as PersonalizationEvent, Q as PersonalizationManifest, as as PersonalizeControlVariant, a2 as PersonalizeOptions, at as PersonalizeVariants, a6 as PersonalizedResult, a5 as PersonalizedVariant, ap as Quirks, aj as SERVER_STATE_ID, ai as ServerToClientTransitionState, ac as SetConsentCommand, ag as SetControlGroupCommand, ah as SetPersonalizeVariantControlCommand, ad as SetQuirkCommand, ae 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, aq as Tests, ak as TransitionDataStoreEvents, ao as VisitorDataStore, an as VisitorDataStoreEvents, am as VisitorDataStoreOptions, av as emptyVisitorData, a3 as personalizeVariations, a0 as testVariations } from './types-WtfxfDct.mjs';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
5
|
|
@@ -126,13 +126,16 @@ declare function enableDebugConsoleLogDrain(level: OutputSeverity, options?: Con
|
|
126
126
|
|
127
127
|
declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void): boolean;
|
128
128
|
|
129
|
+
type ContextDevToolOptions = {
|
130
|
+
onAfterMessageReceived?: (message: DevToolsEvents) => void;
|
131
|
+
};
|
129
132
|
/**
|
130
133
|
* Enables a Context instance to feed data to the Uniform Context DevTools.
|
131
134
|
* DevTools can be hosted either as a Chromium extension, or as a standalone
|
132
135
|
* React app within a page and receive data once this plugin has been activated.
|
133
136
|
* @returns Function that when invoked detaches the event listeners and disables DevTools.
|
134
137
|
*/
|
135
|
-
declare function enableContextDevTools(): ContextPlugin;
|
138
|
+
declare function enableContextDevTools(options?: ContextDevToolOptions): ContextPlugin;
|
136
139
|
|
137
140
|
declare enum ScriptType {
|
138
141
|
ListStart = "nesi-list-start",
|
@@ -160,4 +163,4 @@ type QuickConnectConfig = {
|
|
160
163
|
declare function serializeQuickConnect(config: QuickConnectConfig): string;
|
161
164
|
declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
|
162
165
|
|
163
|
-
export { AggregateDimension, ConsoleDebugLogDrainOptions, ContextPlugin, CookieTransitionDataStore, CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, EdgeNodeTagName, EdgePersonalizeComponentOptions, EdgeTestComponentOptions, EdgeTransitionDataStore, EdgeTransitionDataStoreOptions, LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, QuickConnectConfig, ScoreVector, ScriptType, StorageCommands, StringMatch, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseQuickConnect, queryStringEvaluator, quirkEvaluator, serializeQuickConnect };
|
166
|
+
export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, 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, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseQuickConnect, queryStringEvaluator, quirkEvaluator, serializeQuickConnect };
|
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 } from './types-
|
2
|
-
export {
|
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-WtfxfDct.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, aw as ContextState, ax as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, al 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, ar as EnrichmentData, au as EventData, H as GroupCriteriaEvaluator, af as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, aa as ModifyScoreCommand, ab as ModifySessionScoreCommand, Y as NumberMatch, P as PersonalizationEvent, Q as PersonalizationManifest, as as PersonalizeControlVariant, a2 as PersonalizeOptions, at as PersonalizeVariants, a6 as PersonalizedResult, a5 as PersonalizedVariant, ap as Quirks, aj as SERVER_STATE_ID, ai as ServerToClientTransitionState, ac as SetConsentCommand, ag as SetControlGroupCommand, ah as SetPersonalizeVariantControlCommand, ad as SetQuirkCommand, ae 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, aq as Tests, ak as TransitionDataStoreEvents, ao as VisitorDataStore, an as VisitorDataStoreEvents, am as VisitorDataStoreOptions, av as emptyVisitorData, a3 as personalizeVariations, a0 as testVariations } from './types-WtfxfDct.js';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
5
|
|
@@ -126,13 +126,16 @@ declare function enableDebugConsoleLogDrain(level: OutputSeverity, options?: Con
|
|
126
126
|
|
127
127
|
declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void): boolean;
|
128
128
|
|
129
|
+
type ContextDevToolOptions = {
|
130
|
+
onAfterMessageReceived?: (message: DevToolsEvents) => void;
|
131
|
+
};
|
129
132
|
/**
|
130
133
|
* Enables a Context instance to feed data to the Uniform Context DevTools.
|
131
134
|
* DevTools can be hosted either as a Chromium extension, or as a standalone
|
132
135
|
* React app within a page and receive data once this plugin has been activated.
|
133
136
|
* @returns Function that when invoked detaches the event listeners and disables DevTools.
|
134
137
|
*/
|
135
|
-
declare function enableContextDevTools(): ContextPlugin;
|
138
|
+
declare function enableContextDevTools(options?: ContextDevToolOptions): ContextPlugin;
|
136
139
|
|
137
140
|
declare enum ScriptType {
|
138
141
|
ListStart = "nesi-list-start",
|
@@ -160,4 +163,4 @@ type QuickConnectConfig = {
|
|
160
163
|
declare function serializeQuickConnect(config: QuickConnectConfig): string;
|
161
164
|
declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
|
162
165
|
|
163
|
-
export { AggregateDimension, ConsoleDebugLogDrainOptions, ContextPlugin, CookieTransitionDataStore, CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, EdgeNodeTagName, EdgePersonalizeComponentOptions, EdgeTestComponentOptions, EdgeTransitionDataStore, EdgeTransitionDataStoreOptions, LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, QuickConnectConfig, ScoreVector, ScriptType, StorageCommands, StringMatch, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseQuickConnect, queryStringEvaluator, quirkEvaluator, serializeQuickConnect };
|
166
|
+
export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, 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, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseQuickConnect, queryStringEvaluator, quirkEvaluator, serializeQuickConnect };
|
package/dist/index.esm.js
CHANGED
@@ -123,6 +123,15 @@ var SignalInstance = class {
|
|
123
123
|
_evaluator = new WeakMap();
|
124
124
|
_onLogMessage = new WeakMap();
|
125
125
|
|
126
|
+
// src/manifest/utils/control.ts
|
127
|
+
var rollForControlGroup = (value) => {
|
128
|
+
let control = value;
|
129
|
+
if (control >= 1) {
|
130
|
+
control = control / 100;
|
131
|
+
}
|
132
|
+
return Math.random() < control;
|
133
|
+
};
|
134
|
+
|
126
135
|
// src/manifest/ManifestInstance.ts
|
127
136
|
var _mf, _signalInstances, _onLogMessage2;
|
128
137
|
var ManifestInstance = class {
|
@@ -146,8 +155,8 @@ var ManifestInstance = class {
|
|
146
155
|
__privateSet(this, _onLogMessage2, onLogMessage);
|
147
156
|
}
|
148
157
|
rollForControlGroup() {
|
149
|
-
var _a
|
150
|
-
return
|
158
|
+
var _a;
|
159
|
+
return rollForControlGroup(((_a = __privateGet(this, _mf).pz) == null ? void 0 : _a.control) || 0);
|
151
160
|
}
|
152
161
|
getTest(name) {
|
153
162
|
var _a;
|
@@ -495,7 +504,30 @@ function evaluateDimensionMatch(crit, vec, onLogMessage) {
|
|
495
504
|
var _a, _b;
|
496
505
|
const { op, l: lhs } = crit;
|
497
506
|
const lhsScore = (_a = vec[lhs]) != null ? _a : 0;
|
498
|
-
if (op === "
|
507
|
+
if (op === "^") {
|
508
|
+
const [cat] = lhs.split(ENR_SEPARATOR);
|
509
|
+
let topVectorName = void 0;
|
510
|
+
let topScore = 0;
|
511
|
+
Object.keys(vec).forEach((vectorName) => {
|
512
|
+
if (vectorName.startsWith(`${cat}${ENR_SEPARATOR}`)) {
|
513
|
+
const score = vec[vectorName];
|
514
|
+
if (score > topScore) {
|
515
|
+
topVectorName = vectorName;
|
516
|
+
topScore = score;
|
517
|
+
}
|
518
|
+
}
|
519
|
+
});
|
520
|
+
const result = topVectorName === lhs;
|
521
|
+
onLogMessage == null ? void 0 : onLogMessage([
|
522
|
+
"info",
|
523
|
+
302,
|
524
|
+
{
|
525
|
+
matched: result,
|
526
|
+
description: `${crit.l} has the highest score in the category`
|
527
|
+
}
|
528
|
+
]);
|
529
|
+
return result;
|
530
|
+
} else if (op === "+") {
|
499
531
|
const result = Math.max(...Object.values(vec)) === lhsScore && lhsScore > 0;
|
500
532
|
onLogMessage == null ? void 0 : onLogMessage([
|
501
533
|
"info",
|
@@ -582,31 +614,70 @@ function personalizeVariations({
|
|
582
614
|
take = 1,
|
583
615
|
onLogMessage
|
584
616
|
}) {
|
585
|
-
var _a, _b, _c;
|
617
|
+
var _a, _b, _c, _d;
|
586
618
|
onLogMessage == null ? void 0 : onLogMessage(["info", 300, "GROUP", { name, take }]);
|
587
619
|
try {
|
588
620
|
const control = (_a = context.storage.data.controlGroup) != null ? _a : false;
|
589
621
|
const results = [];
|
590
622
|
let personalized = false;
|
591
623
|
const scores = context.scores;
|
624
|
+
let index = 0;
|
625
|
+
const defaultVariants = [];
|
626
|
+
for (const variant of variations) {
|
627
|
+
if (!((_b = variant.pz) == null ? void 0 : _b.crit.length)) {
|
628
|
+
defaultVariants.push(variant);
|
629
|
+
}
|
630
|
+
}
|
592
631
|
for (const variant of variations) {
|
632
|
+
const currentIndex = index++;
|
593
633
|
if (results.length === take) {
|
594
634
|
break;
|
595
635
|
}
|
596
|
-
if (!((
|
597
|
-
onLogMessage == null ? void 0 : onLogMessage(["info", 301, "GROUP", { id: variant.id, op: (
|
636
|
+
if (!((_c = variant.pz) == null ? void 0 : _c.crit.length)) {
|
637
|
+
onLogMessage == null ? void 0 : onLogMessage(["info", 301, "GROUP", { id: variant.id, op: (_d = variant.pz) == null ? void 0 : _d.op }]);
|
598
638
|
onLogMessage == null ? void 0 : onLogMessage(["info", 302, { matched: true, description: "default variation" }]);
|
599
639
|
onLogMessage == null ? void 0 : onLogMessage(["info", 303, true]);
|
600
640
|
onLogMessage == null ? void 0 : onLogMessage(["info", 301, "ENDGROUP"]);
|
601
|
-
results.push(
|
641
|
+
results.push({
|
642
|
+
...variant,
|
643
|
+
control: false
|
644
|
+
});
|
602
645
|
continue;
|
603
646
|
}
|
604
647
|
if (control) {
|
605
648
|
continue;
|
606
649
|
}
|
607
650
|
if (evaluateVariantMatch(variant.id, variant.pz, scores, onLogMessage)) {
|
608
|
-
|
609
|
-
|
651
|
+
let variantToAdd = variant;
|
652
|
+
let isControl = false;
|
653
|
+
const isDefault = defaultVariants.find((v) => v.id === variant.id);
|
654
|
+
if (take === 1 && !isDefault && defaultVariants.length && typeof variant.pz.control === "number") {
|
655
|
+
isControl = context.getPersonalizeVariantControl(name, currentIndex);
|
656
|
+
if (typeof isControl === "undefined") {
|
657
|
+
isControl = rollForControlGroup(variant.pz.control);
|
658
|
+
context.storage.updateData([
|
659
|
+
{
|
660
|
+
type: "setpersonalizecontrol",
|
661
|
+
data: {
|
662
|
+
personlizationName: name,
|
663
|
+
index: currentIndex,
|
664
|
+
control: isControl
|
665
|
+
}
|
666
|
+
}
|
667
|
+
]);
|
668
|
+
}
|
669
|
+
if (isControl) {
|
670
|
+
variantToAdd = {
|
671
|
+
...defaultVariants[0],
|
672
|
+
id: variant.id
|
673
|
+
};
|
674
|
+
}
|
675
|
+
}
|
676
|
+
personalized = personalized || typeof variantToAdd.pz !== "undefined";
|
677
|
+
results.push({
|
678
|
+
...variantToAdd,
|
679
|
+
control: isControl
|
680
|
+
});
|
610
681
|
}
|
611
682
|
}
|
612
683
|
return {
|
@@ -853,16 +924,19 @@ function parseScoreCookie(cookieValue) {
|
|
853
924
|
if (!cookieValue)
|
854
925
|
return;
|
855
926
|
const types = cookieValue.split(TYPE_SEP);
|
856
|
-
if (types.length >
|
927
|
+
if (types.length > 5)
|
857
928
|
return;
|
858
|
-
const [abTestData, sessionScores, visitorScores] = types;
|
859
|
-
|
929
|
+
const [abTestData, sessionScores, visitorScores, controlGroup, personalizeVariants] = types;
|
930
|
+
const data = {
|
860
931
|
// this is true since we're reading a cookie, which wouldn't exist if consent wasn't given
|
861
932
|
consent: true,
|
862
933
|
sessionScores: decodeCookieType(parseCookieType(sessionScores)),
|
863
934
|
scores: decodeCookieType(parseCookieType(visitorScores)),
|
864
|
-
tests: parseCookieType(abTestData)
|
935
|
+
tests: parseCookieType(abTestData),
|
936
|
+
controlGroup: controlGroup === "1",
|
937
|
+
personalizeVariants: decodePersonalizeVariants(personalizeVariants)
|
865
938
|
};
|
939
|
+
return data;
|
866
940
|
}
|
867
941
|
function parseCookieType(type) {
|
868
942
|
if (!type) {
|
@@ -886,9 +960,48 @@ function serializeCookie(data) {
|
|
886
960
|
return [
|
887
961
|
serializeCookieType(data.tests),
|
888
962
|
serializeCookieType(encodeCookieType(data.sessionScores)),
|
889
|
-
serializeCookieType(encodeCookieType(data.scores))
|
963
|
+
serializeCookieType(encodeCookieType(data.scores)),
|
964
|
+
data.controlGroup ? "1" : "0",
|
965
|
+
serializePersonalizeVariants(data)
|
890
966
|
].join(TYPE_SEP);
|
891
967
|
}
|
968
|
+
function serializePersonalizeVariants({
|
969
|
+
personalizeVariants
|
970
|
+
}) {
|
971
|
+
const data = {};
|
972
|
+
if (typeof personalizeVariants === "object") {
|
973
|
+
Object.keys(personalizeVariants).forEach((personalizationName) => {
|
974
|
+
const results = [];
|
975
|
+
const variants = personalizeVariants[personalizationName];
|
976
|
+
variants.forEach((variant) => {
|
977
|
+
results.push(`${variant.index}:${variant.control ? "1" : "0"}`);
|
978
|
+
});
|
979
|
+
data[personalizationName] = results.join(",");
|
980
|
+
});
|
981
|
+
}
|
982
|
+
const serialized = serializeCookieType(data);
|
983
|
+
return serialized;
|
984
|
+
}
|
985
|
+
function decodePersonalizeVariants(data) {
|
986
|
+
const parsed = parseCookieType(data);
|
987
|
+
const keys = Object.keys(parsed);
|
988
|
+
if (!keys.length) {
|
989
|
+
return void 0;
|
990
|
+
}
|
991
|
+
const results = {};
|
992
|
+
Object.keys(parsed).forEach((k) => {
|
993
|
+
const variants = parsed[k].split(",");
|
994
|
+
const key = decodeURIComponent(k);
|
995
|
+
results[key] = variants.map((variant) => {
|
996
|
+
const [index, control] = variant.split(":");
|
997
|
+
return {
|
998
|
+
index: parseInt(index, 10),
|
999
|
+
control: control === "1"
|
1000
|
+
};
|
1001
|
+
});
|
1002
|
+
});
|
1003
|
+
return results;
|
1004
|
+
}
|
892
1005
|
function encodeCookieType(type) {
|
893
1006
|
return Object.entries(type).reduce((acc, [key, value]) => {
|
894
1007
|
acc[key] = ntob(value);
|
@@ -976,7 +1089,8 @@ var emptyVisitorData = () => ({
|
|
976
1089
|
sessionScores: {},
|
977
1090
|
tests: {},
|
978
1091
|
consent: false,
|
979
|
-
controlGroup: false
|
1092
|
+
controlGroup: false,
|
1093
|
+
personalizeVariants: {}
|
980
1094
|
});
|
981
1095
|
|
982
1096
|
// src/storage/VisitorDataStore.ts
|
@@ -1025,6 +1139,25 @@ function applyCommandsToData(commands, state, inControlGroup) {
|
|
1025
1139
|
case "setcontrol":
|
1026
1140
|
newData.controlGroup = command.data;
|
1027
1141
|
break;
|
1142
|
+
case "setpersonalizecontrol":
|
1143
|
+
if (!newData.personalizeVariants) {
|
1144
|
+
newData.personalizeVariants = {};
|
1145
|
+
}
|
1146
|
+
if (!newData.personalizeVariants[command.data.personlizationName]) {
|
1147
|
+
newData.personalizeVariants[command.data.personlizationName] = [];
|
1148
|
+
}
|
1149
|
+
const existingDef = newData.personalizeVariants[command.data.personlizationName].find(
|
1150
|
+
(i) => i.index === command.data.index
|
1151
|
+
);
|
1152
|
+
if (!existingDef) {
|
1153
|
+
newData.personalizeVariants[command.data.personlizationName].push({
|
1154
|
+
index: command.data.index,
|
1155
|
+
control: command.data.control
|
1156
|
+
});
|
1157
|
+
} else {
|
1158
|
+
console.warn("Overwriting existing control group definition is not allowed");
|
1159
|
+
}
|
1160
|
+
break;
|
1028
1161
|
default:
|
1029
1162
|
throw new Error(`Unknown command`);
|
1030
1163
|
}
|
@@ -1386,7 +1519,7 @@ var Context = class {
|
|
1386
1519
|
* will NOT result in a recomputation of signal state.
|
1387
1520
|
*/
|
1388
1521
|
async update(newData) {
|
1389
|
-
var _a, _b, _c;
|
1522
|
+
var _a, _b, _c, _d;
|
1390
1523
|
const commands = [];
|
1391
1524
|
const newServerSideTests = {};
|
1392
1525
|
if ((_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.quirks) {
|
@@ -1416,6 +1549,17 @@ var Context = class {
|
|
1416
1549
|
);
|
1417
1550
|
}
|
1418
1551
|
}
|
1552
|
+
if ((_c = __privateGet(this, _serverTransitionState)) == null ? void 0 : _c.personalizeVariants) {
|
1553
|
+
Object.keys(__privateGet(this, _serverTransitionState).personalizeVariants).forEach((personalizationName) => {
|
1554
|
+
const variants = __privateGet(this, _serverTransitionState).personalizeVariants[personalizationName];
|
1555
|
+
variants.forEach((e) => {
|
1556
|
+
commands.push({
|
1557
|
+
type: "setpersonalizecontrol",
|
1558
|
+
data: { personlizationName: personalizationName, index: e.index, control: e.control }
|
1559
|
+
});
|
1560
|
+
});
|
1561
|
+
});
|
1562
|
+
}
|
1419
1563
|
try {
|
1420
1564
|
__privateGet(this, _mitt3).emit("log", [
|
1421
1565
|
"info",
|
@@ -1425,7 +1569,7 @@ var Context = class {
|
|
1425
1569
|
...newData,
|
1426
1570
|
// need to convert url to string so it can be json serialized
|
1427
1571
|
// to go over postMessage to chrome extension
|
1428
|
-
url: (
|
1572
|
+
url: (_d = newData.url) == null ? void 0 : _d.toString()
|
1429
1573
|
}
|
1430
1574
|
]);
|
1431
1575
|
if (newData.quirks) {
|
@@ -1507,6 +1651,13 @@ var Context = class {
|
|
1507
1651
|
}
|
1508
1652
|
]);
|
1509
1653
|
}
|
1654
|
+
getPersonalizeVariantControl(name, index) {
|
1655
|
+
var _a, _b, _c;
|
1656
|
+
const source = (_b = (_a = __privateGet(this, _serverTransitionState)) == null ? void 0 : _a.personalizeVariants) != null ? _b : this.storage.data.personalizeVariants;
|
1657
|
+
const variants = (_c = source == null ? void 0 : source[name]) != null ? _c : [];
|
1658
|
+
const variant = variants.find((v) => v.index === index);
|
1659
|
+
return variant == null ? void 0 : variant.control;
|
1660
|
+
}
|
1510
1661
|
/**
|
1511
1662
|
* Writes a message to the Context log sink.
|
1512
1663
|
* Used by Uniform internal SDK; not intended for public use.
|
@@ -1549,10 +1700,10 @@ var Context = class {
|
|
1549
1700
|
const previousPlacement = __privateGet(this, _pzCache)[options.name];
|
1550
1701
|
const eventData = {
|
1551
1702
|
name: options.name,
|
1552
|
-
variantIds: value.variations.map((variation) => {
|
1553
|
-
|
1554
|
-
|
1555
|
-
}),
|
1703
|
+
variantIds: value.variations.map((variation) => ({
|
1704
|
+
id: variation.id || "Unknown",
|
1705
|
+
control: variation.control
|
1706
|
+
})),
|
1556
1707
|
control: this.storage.data.controlGroup,
|
1557
1708
|
changed: true
|
1558
1709
|
};
|
@@ -1580,7 +1731,8 @@ var Context = class {
|
|
1580
1731
|
const transitionState = {
|
1581
1732
|
quirks: this.storage.data.quirks,
|
1582
1733
|
ssv: __privateGet(this, _scores),
|
1583
|
-
tests: {}
|
1734
|
+
tests: {},
|
1735
|
+
personalizeVariants: this.storage.data.personalizeVariants
|
1584
1736
|
};
|
1585
1737
|
const allTests = this.storage.data.tests;
|
1586
1738
|
Object.entries(allTests).map(([testName, testValue]) => {
|
@@ -1591,6 +1743,18 @@ var Context = class {
|
|
1591
1743
|
});
|
1592
1744
|
return transitionState;
|
1593
1745
|
}
|
1746
|
+
/** @deprecated */
|
1747
|
+
internal_processTestEvent(event) {
|
1748
|
+
if (event.variantId) {
|
1749
|
+
this.setTestVariantId(event.name, event.variantId);
|
1750
|
+
__privateMethod(this, _emitTest, emitTest_fn).call(this, event);
|
1751
|
+
}
|
1752
|
+
}
|
1753
|
+
/** @deprecated */
|
1754
|
+
internal_processPersonalizationEvent(event) {
|
1755
|
+
__privateGet(this, _pzCache)[event.name] = event.variantIds;
|
1756
|
+
__privateGet(this, _mitt3).emit("personalizationResult", event);
|
1757
|
+
}
|
1594
1758
|
};
|
1595
1759
|
_serverTransitionState = new WeakMap();
|
1596
1760
|
_scores = new WeakMap();
|
@@ -1624,7 +1788,7 @@ calculateScores_fn = function(newData) {
|
|
1624
1788
|
|
1625
1789
|
// src/devTools/enableContextDevTools.ts
|
1626
1790
|
var isBrowser = typeof top !== "undefined";
|
1627
|
-
function enableContextDevTools() {
|
1791
|
+
function enableContextDevTools(options) {
|
1628
1792
|
return {
|
1629
1793
|
logDrain: (message) => {
|
1630
1794
|
if (!isBrowser) {
|
@@ -1677,7 +1841,11 @@ function enableContextDevTools() {
|
|
1677
1841
|
return;
|
1678
1842
|
}
|
1679
1843
|
const message = event.data;
|
1680
|
-
await handleMessageFromDevTools(
|
1844
|
+
await handleMessageFromDevTools({
|
1845
|
+
message,
|
1846
|
+
context,
|
1847
|
+
afterMessageReceived: options == null ? void 0 : options.onAfterMessageReceived
|
1848
|
+
});
|
1681
1849
|
});
|
1682
1850
|
} catch (e) {
|
1683
1851
|
console.warn(
|
@@ -1697,26 +1865,35 @@ function enableContextDevTools() {
|
|
1697
1865
|
context.events.on("personalizationResult", onPersonalizationResult);
|
1698
1866
|
context.events.on("testResult", onTestResult);
|
1699
1867
|
context.events.on("scoresUpdated", onContextDataUpdated);
|
1700
|
-
context.storage.events.on("*", onContextDataUpdated);
|
1701
1868
|
return () => {
|
1702
1869
|
context.events.off("scoresUpdated", onContextDataUpdated);
|
1703
|
-
context.storage.events.off("*", onContextDataUpdated);
|
1704
1870
|
context.events.off("personalizationResult", onPersonalizationResult);
|
1705
1871
|
context.events.off("testResult", onTestResult);
|
1706
1872
|
};
|
1707
1873
|
}
|
1708
1874
|
};
|
1709
1875
|
}
|
1710
|
-
async function handleMessageFromDevTools(
|
1876
|
+
async function handleMessageFromDevTools({
|
1877
|
+
message,
|
1878
|
+
context,
|
1879
|
+
afterMessageReceived
|
1880
|
+
}) {
|
1881
|
+
let receivedUniformMessage = false;
|
1711
1882
|
if (message.type === "uniform-in:context:update" && message.newData) {
|
1883
|
+
receivedUniformMessage = true;
|
1712
1884
|
await context.update(message.newData);
|
1713
1885
|
}
|
1714
1886
|
if (message.type === "uniform-in:context:commands" && message.commands && Array.isArray(message.commands)) {
|
1887
|
+
receivedUniformMessage = true;
|
1715
1888
|
await context.storage.updateData(message.commands);
|
1716
1889
|
}
|
1717
1890
|
if (message.type === "uniform-in:context:forget") {
|
1891
|
+
receivedUniformMessage = true;
|
1718
1892
|
await context.forget(false);
|
1719
1893
|
}
|
1894
|
+
if (receivedUniformMessage && typeof afterMessageReceived === "function") {
|
1895
|
+
afterMessageReceived(message);
|
1896
|
+
}
|
1720
1897
|
}
|
1721
1898
|
|
1722
1899
|
// src/edge/index.ts
|