@uniformdev/context 20.6.2-alpha.11 → 20.7.1-alpha.14
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 +8 -1
- package/dist/api/api.d.ts +8 -1
- package/dist/api/api.js +8 -2
- package/dist/api/api.mjs +8 -2
- package/dist/index.d.mts +4 -33
- package/dist/index.d.ts +4 -33
- package/dist/index.esm.js +39 -216
- package/dist/index.js +40 -221
- package/dist/index.mjs +39 -216
- package/dist/{types-CzIkFCDD.d.mts → types-EJl31yuP.d.mts} +24 -96
- package/dist/{types-CzIkFCDD.d.ts → types-EJl31yuP.d.ts} +24 -96
- package/package.json +2 -2
package/dist/api/api.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { aC as paths$7, N as ManifestV2 } from '../types-EJl31yuP.mjs';
|
2
2
|
import 'mitt';
|
3
3
|
|
4
4
|
type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
@@ -43,6 +43,13 @@ declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
43
43
|
/** Whether to expect a JSON response or not */
|
44
44
|
expectNoContent?: boolean;
|
45
45
|
}): Promise<TResponse>;
|
46
|
+
protected apiClientWithResponse<TResponse>(fetchUri: URL, options?: RequestInit & {
|
47
|
+
/** Whether to expect a JSON response or not */
|
48
|
+
expectNoContent?: boolean;
|
49
|
+
}): Promise<{
|
50
|
+
response: Response;
|
51
|
+
body: TResponse;
|
52
|
+
}>;
|
46
53
|
protected createUrl(path: string, queryParams?: Record<string, string | boolean | undefined | null | number | Array<string | boolean | number>>, hostOverride?: string): URL;
|
47
54
|
private ensureApiHost;
|
48
55
|
private static getRequestId;
|
package/dist/api/api.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { aC as paths$7, N as ManifestV2 } from '../types-EJl31yuP.js';
|
2
2
|
import 'mitt';
|
3
3
|
|
4
4
|
type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
@@ -43,6 +43,13 @@ declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
43
43
|
/** Whether to expect a JSON response or not */
|
44
44
|
expectNoContent?: boolean;
|
45
45
|
}): Promise<TResponse>;
|
46
|
+
protected apiClientWithResponse<TResponse>(fetchUri: URL, options?: RequestInit & {
|
47
|
+
/** Whether to expect a JSON response or not */
|
48
|
+
expectNoContent?: boolean;
|
49
|
+
}): Promise<{
|
50
|
+
response: Response;
|
51
|
+
body: TResponse;
|
52
|
+
}>;
|
46
53
|
protected createUrl(path: string, queryParams?: Record<string, string | boolean | undefined | null | number | Array<string | boolean | number>>, hostOverride?: string): URL;
|
47
54
|
private ensureApiHost;
|
48
55
|
private static getRequestId;
|
package/dist/api/api.js
CHANGED
@@ -123,6 +123,9 @@ var ApiClient = class _ApiClient {
|
|
123
123
|
};
|
124
124
|
}
|
125
125
|
async apiClient(fetchUri, options) {
|
126
|
+
return (await this.apiClientWithResponse(fetchUri, options)).body;
|
127
|
+
}
|
128
|
+
async apiClientWithResponse(fetchUri, options) {
|
126
129
|
return this.options.limitPolicy(async () => {
|
127
130
|
var _a;
|
128
131
|
const coreHeaders = this.options.apiKey ? {
|
@@ -170,9 +173,12 @@ var ApiClient = class _ApiClient {
|
|
170
173
|
);
|
171
174
|
}
|
172
175
|
if (options == null ? void 0 : options.expectNoContent) {
|
173
|
-
return null;
|
176
|
+
return { response: apiResponse, body: null };
|
174
177
|
}
|
175
|
-
return
|
178
|
+
return {
|
179
|
+
response: apiResponse,
|
180
|
+
body: await apiResponse.json()
|
181
|
+
};
|
176
182
|
});
|
177
183
|
}
|
178
184
|
createUrl(path, queryParams, hostOverride) {
|
package/dist/api/api.mjs
CHANGED
@@ -58,6 +58,9 @@ var ApiClient = class _ApiClient {
|
|
58
58
|
};
|
59
59
|
}
|
60
60
|
async apiClient(fetchUri, options) {
|
61
|
+
return (await this.apiClientWithResponse(fetchUri, options)).body;
|
62
|
+
}
|
63
|
+
async apiClientWithResponse(fetchUri, options) {
|
61
64
|
return this.options.limitPolicy(async () => {
|
62
65
|
var _a;
|
63
66
|
const coreHeaders = this.options.apiKey ? {
|
@@ -105,9 +108,12 @@ var ApiClient = class _ApiClient {
|
|
105
108
|
);
|
106
109
|
}
|
107
110
|
if (options == null ? void 0 : options.expectNoContent) {
|
108
|
-
return null;
|
111
|
+
return { response: apiResponse, body: null };
|
109
112
|
}
|
110
|
-
return
|
113
|
+
return {
|
114
|
+
response: apiResponse,
|
115
|
+
body: await apiResponse.json()
|
116
|
+
};
|
111
117
|
});
|
112
118
|
}
|
113
119
|
createUrl(path, queryParams, hostOverride) {
|
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, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage,
|
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, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, g as DevToolsEvents } from './types-EJl31yuP.mjs';
|
2
|
+
export { $ as AggregateDimensionInput, a5 as BehaviorTag, h as CONTEXTUAL_EDITING_TEST_NAME, i as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, n as Context, l as ContextEvents, m as ContextInstance, j as ContextOptions, az as ContextState, aA as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, ao as DecayOptions, q as DevToolsActions, t as DevToolsDataEvent, r as DevToolsEvent, x as DevToolsForgetEvent, u as DevToolsHelloEvent, s as DevToolsLogEvent, w as DevToolsRawCommandsEvent, p as DevToolsState, o as DevToolsUiVersion, v as DevToolsUpdateEvent, a2 as DimensionMatch, Y as EnrichmentCategory, au as EnrichmentData, ax as EventData, aB as GoalStateUpdate, at as Goals, H as GroupCriteriaEvaluator, ah as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, ac as ModifyScoreCommand, ad as ModifySessionScoreCommand, Z as NumberMatch, P as PersonalizationEvent, R as PersonalizationManifest, av as PersonalizeControlVariant, a3 as PersonalizeOptions, aw as PersonalizeVariants, a7 as PersonalizedResult, a6 as PersonalizedVariant, am as SERVER_STATE_ID, al as ServerToClientTransitionState, ae as SetConsentCommand, ai as SetControlGroupCommand, ab as SetGoalCommand, aj as SetPersonalizeVariantControlCommand, af as SetQuirkCommand, ag as SetTestCommand, z as Severity, U as Signal, X as SignalCriteria, W as SignalCriteriaGroup, K as SignalData, aa as StorageCommand, _ as TestDefinition, k as TestEvent, a0 as TestOptions, a9 as TestResult, a8 as TestVariant, as as Tests, an as TransitionDataStoreEvents, ar as VisitorDataStore, aq as VisitorDataStoreEvents, ap as VisitorDataStoreOptions, ak as areCommandsEqual, ay as emptyVisitorData, a4 as personalizeVariations, a1 as testVariations } from './types-EJl31yuP.mjs';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
5
|
|
@@ -158,35 +158,7 @@ declare function createDebugConsoleLogDrain(level: OutputSeverity, options?: Con
|
|
158
158
|
*/
|
159
159
|
declare function enableDebugConsoleLogDrain(level: OutputSeverity, options?: ConsoleDebugLogDrainOptions): ContextPlugin;
|
160
160
|
|
161
|
-
declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void
|
162
|
-
|
163
|
-
/**
|
164
|
-
* @deprecated Use `topDownCriteriaPersonalizationSelectionAlgorithm` instead
|
165
|
-
*/
|
166
|
-
declare function personalizeVariations<TVariant extends PersonalizedVariant<VariantMatchCriteria>>(options: PersonalizeOptions<TVariant> & {
|
167
|
-
context: Context;
|
168
|
-
}): PersonalizedResult<TVariant>;
|
169
|
-
|
170
|
-
declare const STRONGEST_SCORE_PERSONALIZATION_ALGORITHM = "ssc";
|
171
|
-
/**
|
172
|
-
* Implementation of the strongest score personalization selection algorithm.
|
173
|
-
*
|
174
|
-
* In this mode, we take all variations and break them into two groups:
|
175
|
-
* 1. Variations that have a positive score for their tagged dimension
|
176
|
-
* 2. Variations that do not have a dimension tag
|
177
|
-
*
|
178
|
-
* We then sort the first group by score, concatenate the second group, and return the top <take> variations.
|
179
|
-
*/
|
180
|
-
declare function strongestScorePersonalizationSelectionAlgorithm<TCriteria extends VariationMatchDimensionCriteria, TVariation extends PersonalizedVariant<TCriteria>>({ name, context, variations, take, onLogMessage, }: PersonalizationSelectionAlgorithmOptions<TCriteria, TVariation>): PersonalizedResult<TVariation>;
|
181
|
-
|
182
|
-
declare const TOP_DOWN_CRITERIA_PERSONALIZATION_ALGORITHM = "default";
|
183
|
-
/**
|
184
|
-
* Implementation of the top-down criteria personalization selection algorithm.
|
185
|
-
*
|
186
|
-
* In this mode, we evaluate variations in the order they are declared and the first <take>
|
187
|
-
* variations whose criteria evaluate to true are selected.
|
188
|
-
*/
|
189
|
-
declare function topDownCriteriaPersonalizationSelectionAlgorithm<TCriteria extends VariantMatchCriteria, TVariation extends PersonalizedVariant<TCriteria>>({ name, context, variations, take, onLogMessage, }: PersonalizationSelectionAlgorithmOptions<TCriteria, TVariation>): PersonalizedResult<TVariation>;
|
161
|
+
declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void): boolean;
|
190
162
|
|
191
163
|
type ContextDevToolOptions = {
|
192
164
|
onAfterMessageReceived?: (message: DevToolsEvents) => void;
|
@@ -211,7 +183,6 @@ declare enum ScriptType {
|
|
211
183
|
type EdgePersonalizeComponentOptions = {
|
212
184
|
name: string;
|
213
185
|
count?: number;
|
214
|
-
algorithm?: string;
|
215
186
|
};
|
216
187
|
type EdgeTestComponentOptions = {
|
217
188
|
name: string;
|
@@ -242,4 +213,4 @@ type QuickConnectConfig = {
|
|
242
213
|
declare function serializeQuickConnect(config: QuickConnectConfig): string;
|
243
214
|
declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
|
244
215
|
|
245
|
-
export { AggregateDimension, type ConsoleDebugLogDrainOptions,
|
216
|
+
export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, ENR_SEPARATOR, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, KV_SEP, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, PAIR_SEP, QUIRK_SEP, type QuickConnectConfig, Quirks, ScoreVector, ScriptType, StorageCommands, StringMatch, TYPE_SEP, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, UNIFORM_DEFAULT_QUIRK_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, decodeCookieType, decodePersonalizeVariants, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, encodeCookieType, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseCookieScores, parseCookieType, parseQuickConnect, parseQuirkCookie, parseScoreCookie, queryStringEvaluator, quirkEvaluator, serializeCookie, serializeCookieType, serializePersonalizeVariants, serializeQuickConnect, serializeQuirks };
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage,
|
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, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, g as DevToolsEvents } from './types-EJl31yuP.js';
|
2
|
+
export { $ as AggregateDimensionInput, a5 as BehaviorTag, h as CONTEXTUAL_EDITING_TEST_NAME, i as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, n as Context, l as ContextEvents, m as ContextInstance, j as ContextOptions, az as ContextState, aA as ContextStateUpdate, J as CriteriaEvaluatorParameters, I as CriteriaEvaluatorResult, ao as DecayOptions, q as DevToolsActions, t as DevToolsDataEvent, r as DevToolsEvent, x as DevToolsForgetEvent, u as DevToolsHelloEvent, s as DevToolsLogEvent, w as DevToolsRawCommandsEvent, p as DevToolsState, o as DevToolsUiVersion, v as DevToolsUpdateEvent, a2 as DimensionMatch, Y as EnrichmentCategory, au as EnrichmentData, ax as EventData, aB as GoalStateUpdate, at as Goals, H as GroupCriteriaEvaluator, ah as IdentifyCommand, F as LogMessageGroup, E as LogMessageSingle, y as LogMessages, G as ManifestInstance, N as ManifestV2, M as MessageCategory, B as MessageFunc, ac as ModifyScoreCommand, ad as ModifySessionScoreCommand, Z as NumberMatch, P as PersonalizationEvent, R as PersonalizationManifest, av as PersonalizeControlVariant, a3 as PersonalizeOptions, aw as PersonalizeVariants, a7 as PersonalizedResult, a6 as PersonalizedVariant, am as SERVER_STATE_ID, al as ServerToClientTransitionState, ae as SetConsentCommand, ai as SetControlGroupCommand, ab as SetGoalCommand, aj as SetPersonalizeVariantControlCommand, af as SetQuirkCommand, ag as SetTestCommand, z as Severity, U as Signal, X as SignalCriteria, W as SignalCriteriaGroup, K as SignalData, aa as StorageCommand, _ as TestDefinition, k as TestEvent, a0 as TestOptions, a9 as TestResult, a8 as TestVariant, as as Tests, an as TransitionDataStoreEvents, ar as VisitorDataStore, aq as VisitorDataStoreEvents, ap as VisitorDataStoreOptions, ak as areCommandsEqual, ay as emptyVisitorData, a4 as personalizeVariations, a1 as testVariations } from './types-EJl31yuP.js';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
5
|
|
@@ -158,35 +158,7 @@ declare function createDebugConsoleLogDrain(level: OutputSeverity, options?: Con
|
|
158
158
|
*/
|
159
159
|
declare function enableDebugConsoleLogDrain(level: OutputSeverity, options?: ConsoleDebugLogDrainOptions): ContextPlugin;
|
160
160
|
|
161
|
-
declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void
|
162
|
-
|
163
|
-
/**
|
164
|
-
* @deprecated Use `topDownCriteriaPersonalizationSelectionAlgorithm` instead
|
165
|
-
*/
|
166
|
-
declare function personalizeVariations<TVariant extends PersonalizedVariant<VariantMatchCriteria>>(options: PersonalizeOptions<TVariant> & {
|
167
|
-
context: Context;
|
168
|
-
}): PersonalizedResult<TVariant>;
|
169
|
-
|
170
|
-
declare const STRONGEST_SCORE_PERSONALIZATION_ALGORITHM = "ssc";
|
171
|
-
/**
|
172
|
-
* Implementation of the strongest score personalization selection algorithm.
|
173
|
-
*
|
174
|
-
* In this mode, we take all variations and break them into two groups:
|
175
|
-
* 1. Variations that have a positive score for their tagged dimension
|
176
|
-
* 2. Variations that do not have a dimension tag
|
177
|
-
*
|
178
|
-
* We then sort the first group by score, concatenate the second group, and return the top <take> variations.
|
179
|
-
*/
|
180
|
-
declare function strongestScorePersonalizationSelectionAlgorithm<TCriteria extends VariationMatchDimensionCriteria, TVariation extends PersonalizedVariant<TCriteria>>({ name, context, variations, take, onLogMessage, }: PersonalizationSelectionAlgorithmOptions<TCriteria, TVariation>): PersonalizedResult<TVariation>;
|
181
|
-
|
182
|
-
declare const TOP_DOWN_CRITERIA_PERSONALIZATION_ALGORITHM = "default";
|
183
|
-
/**
|
184
|
-
* Implementation of the top-down criteria personalization selection algorithm.
|
185
|
-
*
|
186
|
-
* In this mode, we evaluate variations in the order they are declared and the first <take>
|
187
|
-
* variations whose criteria evaluate to true are selected.
|
188
|
-
*/
|
189
|
-
declare function topDownCriteriaPersonalizationSelectionAlgorithm<TCriteria extends VariantMatchCriteria, TVariation extends PersonalizedVariant<TCriteria>>({ name, context, variations, take, onLogMessage, }: PersonalizationSelectionAlgorithmOptions<TCriteria, TVariation>): PersonalizedResult<TVariation>;
|
161
|
+
declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void): boolean;
|
190
162
|
|
191
163
|
type ContextDevToolOptions = {
|
192
164
|
onAfterMessageReceived?: (message: DevToolsEvents) => void;
|
@@ -211,7 +183,6 @@ declare enum ScriptType {
|
|
211
183
|
type EdgePersonalizeComponentOptions = {
|
212
184
|
name: string;
|
213
185
|
count?: number;
|
214
|
-
algorithm?: string;
|
215
186
|
};
|
216
187
|
type EdgeTestComponentOptions = {
|
217
188
|
name: string;
|
@@ -242,4 +213,4 @@ type QuickConnectConfig = {
|
|
242
213
|
declare function serializeQuickConnect(config: QuickConnectConfig): string;
|
243
214
|
declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
|
244
215
|
|
245
|
-
export { AggregateDimension, type ConsoleDebugLogDrainOptions,
|
216
|
+
export { AggregateDimension, type ConsoleDebugLogDrainOptions, type ContextDevToolOptions, ContextPlugin, CookieTransitionDataStore, type CookieTransitionDataStoreOptions, CriteriaEvaluator, DecayFunction, DevToolsEvents, ENR_SEPARATOR, EdgeNodeTagName, type EdgePersonalizeComponentOptions, type EdgeTestComponentOptions, EdgeTransitionDataStore, type EdgeTransitionDataStoreOptions, type EnableUniformInsightsOptions, KV_SEP, type LinearDecayOptions, LogDrain, LogMessage, OutputSeverity, PAIR_SEP, QUIRK_SEP, type QuickConnectConfig, Quirks, ScoreVector, ScriptType, StorageCommands, StringMatch, TYPE_SEP, TransitionDataStore, TransitionDataStoreOptions, UNIFORM_DEFAULT_COOKIE_NAME, UNIFORM_DEFAULT_QUIRK_COOKIE_NAME, VariantMatchCriteria, VisitorData, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, decodeCookieType, decodePersonalizeVariants, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, enableUniformInsights, encodeCookieType, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, parseCookieScores, parseCookieType, parseQuickConnect, parseQuirkCookie, parseScoreCookie, queryStringEvaluator, quirkEvaluator, serializeCookie, serializeCookieType, serializePersonalizeVariants, serializeQuickConnect, serializeQuirks };
|