@uniformdev/context 14.2.1-alpha.128 → 14.2.1-alpha.181

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.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, d as AggregateDeleteParameters, D as DimensionGetParameters, e as DimensionGetResponse, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, i as EnrichmentDeleteParameters, j as EnrichmentValuePutParameters, k as EnrichmentValueDeleteParameters, M as ManifestGetParameters, l as ManifestGetResponse, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, p as QuirkDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, t as SignalDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters, x as TestDeleteParameters, y as DimensionDefinition } from '../contextTypes-7f24fc7c';
2
- export { A as Aggregate, d as AggregateDeleteParameters, a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, C as CookieCriteria, I as CurrentPageCriteria, y as DimensionDefinition, D as DimensionGetParameters, e as DimensionGetResponse, z as EnrichmentCategory, E as EnrichmentCategoryWithValues, i as EnrichmentDeleteParameters, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, B as EnrichmentValue, k as EnrichmentValueDeleteParameters, j as EnrichmentValuePutParameters, H as EventCriteria, M as ManifestGetParameters, l as ManifestGetResponse, P as PageViewCountCriteria, F as QueryStringCriteria, Q as Quirk, G as QuirkCriteria, p as QuirkDeleteParameters, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, R as RootSignalCriteriaGroup, t as SignalDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, S as SignalWithId, T as Test, x as TestDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters } from '../contextTypes-7f24fc7c';
3
- import { g as ManifestV2 } from '../types-d77228a6';
4
- import '../v2-manifest.swagger-d0899723';
1
+ import { a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, d as AggregateDeleteParameters, D as DimensionGetParameters, e as DimensionGetResponse, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, i as EnrichmentDeleteParameters, j as EnrichmentValuePutParameters, k as EnrichmentValueDeleteParameters, M as ManifestGetParameters, l as ManifestGetResponse, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, p as QuirkDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, t as SignalDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters, x as TestDeleteParameters, y as DimensionDefinition } from '../contextTypes-572b0d33';
2
+ export { A as Aggregate, d as AggregateDeleteParameters, a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, C as CookieCriteria, I as CurrentPageCriteria, y as DimensionDefinition, D as DimensionGetParameters, e as DimensionGetResponse, z as EnrichmentCategory, E as EnrichmentCategoryWithValues, i as EnrichmentDeleteParameters, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, B as EnrichmentValue, k as EnrichmentValueDeleteParameters, j as EnrichmentValuePutParameters, H as EventCriteria, M as ManifestGetParameters, l as ManifestGetResponse, P as PageViewCountCriteria, F as QueryStringCriteria, Q as Quirk, G as QuirkCriteria, p as QuirkDeleteParameters, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, R as RootSignalCriteriaGroup, t as SignalDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, S as SignalWithId, T as Test, x as TestDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters } from '../contextTypes-572b0d33';
3
+ import { g as ManifestV2 } from '../types-5f88cc63';
4
+ import '../v2-manifest.swagger-ff2af13e';
5
5
  import 'mitt';
6
6
 
7
7
  declare type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
@@ -0,0 +1,76 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
+ }) : x)(function(x) {
12
+ if (typeof require !== "undefined")
13
+ return require.apply(this, arguments);
14
+ throw new Error('Dynamic require of "' + x + '" is not supported');
15
+ });
16
+ var __esm = (fn, res) => function __init() {
17
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
+ };
19
+ var __commonJS = (cb, mod) => function __require2() {
20
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
21
+ };
22
+ var __reExport = (target, module, copyDefault, desc) => {
23
+ if (module && typeof module === "object" || typeof module === "function") {
24
+ for (let key of __getOwnPropNames(module))
25
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
26
+ __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
27
+ }
28
+ return target;
29
+ };
30
+ var __toESM = (module, isNodeMode) => {
31
+ return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", !isNodeMode && module && module.__esModule ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
32
+ };
33
+ var __publicField = (obj, key, value) => {
34
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
+ return value;
36
+ };
37
+ var __accessCheck = (obj, member, msg) => {
38
+ if (!member.has(obj))
39
+ throw TypeError("Cannot " + msg);
40
+ };
41
+ var __privateGet = (obj, member, getter) => {
42
+ __accessCheck(obj, member, "read from private field");
43
+ return getter ? getter.call(obj) : member.get(obj);
44
+ };
45
+ var __privateAdd = (obj, member, value) => {
46
+ if (member.has(obj))
47
+ throw TypeError("Cannot add the same private member more than once");
48
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
49
+ };
50
+ var __privateSet = (obj, member, value, setter) => {
51
+ __accessCheck(obj, member, "write to private field");
52
+ setter ? setter.call(obj, value) : member.set(obj, value);
53
+ return value;
54
+ };
55
+ var __privateMethod = (obj, member, method) => {
56
+ __accessCheck(obj, member, "access private method");
57
+ return method;
58
+ };
59
+
60
+ // ../../node_modules/.pnpm/tsup@5.12.1_typescript@4.6.2/node_modules/tsup/assets/esm_shims.js
61
+ var init_esm_shims = __esm({
62
+ "../../node_modules/.pnpm/tsup@5.12.1_typescript@4.6.2/node_modules/tsup/assets/esm_shims.js"() {
63
+ }
64
+ });
65
+
66
+ export {
67
+ __require,
68
+ __commonJS,
69
+ __toESM,
70
+ __publicField,
71
+ __privateGet,
72
+ __privateAdd,
73
+ __privateSet,
74
+ __privateMethod,
75
+ init_esm_shims
76
+ };
@@ -0,0 +1,307 @@
1
+ import {
2
+ __privateAdd,
3
+ __privateGet,
4
+ __publicField,
5
+ init_esm_shims
6
+ } from "./chunk-A5FZYSIL.mjs";
7
+
8
+ // src/api/apiClientUtils.ts
9
+ init_esm_shims();
10
+ var nullLimitPolicy = async (func) => await func();
11
+ var ApiClientError = class extends Error {
12
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText) {
13
+ super(`${errorMessage}
14
+ ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri})`);
15
+ this.errorMessage = errorMessage;
16
+ this.fetchMethod = fetchMethod;
17
+ this.fetchUri = fetchUri;
18
+ this.statusCode = statusCode;
19
+ this.statusText = statusText;
20
+ Object.setPrototypeOf(this, ApiClientError.prototype);
21
+ }
22
+ };
23
+
24
+ // src/api/AggregateClient.ts
25
+ init_esm_shims();
26
+
27
+ // src/api/ApiClient.ts
28
+ init_esm_shims();
29
+ var ApiClient = class {
30
+ constructor(options) {
31
+ __publicField(this, "options");
32
+ var _a, _b, _c, _d, _e, _f;
33
+ if (!options.apiKey && !options.bearerToken) {
34
+ throw new Error("You must provide an API key or a bearer token");
35
+ }
36
+ this.options = {
37
+ ...options,
38
+ fetch: (_a = options.fetch) != null ? _a : fetch,
39
+ apiHost: (_b = options.apiHost) != null ? _b : "https://uniform.app",
40
+ apiKey: (_c = options.apiKey) != null ? _c : null,
41
+ projectId: (_d = options.projectId) != null ? _d : null,
42
+ bearerToken: (_e = options.bearerToken) != null ? _e : null,
43
+ limitPolicy: (_f = options.limitPolicy) != null ? _f : nullLimitPolicy
44
+ };
45
+ }
46
+ async apiClient(fetchUri, options) {
47
+ return this.options.limitPolicy(async () => {
48
+ var _a;
49
+ const authHeaders = this.options.apiKey ? {
50
+ "x-api-key": this.options.apiKey
51
+ } : {
52
+ Authorization: `Bearer ${this.options.bearerToken}`
53
+ };
54
+ const apiResponse = await fetch(fetchUri.toString(), {
55
+ ...options,
56
+ headers: {
57
+ ...options == null ? void 0 : options.headers,
58
+ ...authHeaders
59
+ }
60
+ });
61
+ if (!apiResponse.ok) {
62
+ let message = "";
63
+ try {
64
+ const responseText = await apiResponse.text();
65
+ try {
66
+ const parsed = JSON.parse(responseText);
67
+ if (parsed.errorMessage) {
68
+ message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
69
+ } else {
70
+ message = responseText;
71
+ }
72
+ } catch (e) {
73
+ message = responseText;
74
+ }
75
+ } catch (e) {
76
+ message = `General error`;
77
+ }
78
+ throw new ApiClientError(message, (_a = options == null ? void 0 : options.method) != null ? _a : "GET", fetchUri.toString(), apiResponse.status);
79
+ }
80
+ if (options == null ? void 0 : options.expectNoContent) {
81
+ return null;
82
+ }
83
+ return await apiResponse.json();
84
+ });
85
+ }
86
+ createUrl(path, queryParams) {
87
+ const url = new URL(`${this.options.apiHost}${path}`);
88
+ Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
89
+ var _a;
90
+ if (typeof value !== "undefined" && value !== null) {
91
+ url.searchParams.append(key, (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
92
+ }
93
+ });
94
+ return url;
95
+ }
96
+ };
97
+
98
+ // src/api/AggregateClient.ts
99
+ var _url;
100
+ var _AggregateClient = class extends ApiClient {
101
+ constructor(options) {
102
+ super(options);
103
+ }
104
+ async get(options) {
105
+ const { projectId } = this.options;
106
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url), { ...options, projectId });
107
+ return await this.apiClient(fetchUri);
108
+ }
109
+ async upsert(body) {
110
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
111
+ await this.apiClient(fetchUri, {
112
+ method: "PUT",
113
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
114
+ expectNoContent: true
115
+ });
116
+ }
117
+ async remove(body) {
118
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
119
+ await this.apiClient(fetchUri, {
120
+ method: "DELETE",
121
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
122
+ expectNoContent: true
123
+ });
124
+ }
125
+ };
126
+ var AggregateClient = _AggregateClient;
127
+ _url = new WeakMap();
128
+ __privateAdd(AggregateClient, _url, "/api/v2/aggregate");
129
+
130
+ // src/api/EnrichmentClient.ts
131
+ init_esm_shims();
132
+ var _url2, _valueUrl;
133
+ var _EnrichmentClient = class extends ApiClient {
134
+ constructor(options) {
135
+ super(options);
136
+ }
137
+ async get(options) {
138
+ const { projectId } = this.options;
139
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url2), { ...options, projectId });
140
+ return await this.apiClient(fetchUri);
141
+ }
142
+ async upsertCategory(body) {
143
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url2));
144
+ await this.apiClient(fetchUri, {
145
+ method: "PUT",
146
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
147
+ expectNoContent: true
148
+ });
149
+ }
150
+ async removeCategory(body) {
151
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url2));
152
+ await this.apiClient(fetchUri, {
153
+ method: "DELETE",
154
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
155
+ expectNoContent: true
156
+ });
157
+ }
158
+ async upsertValue(body) {
159
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
160
+ await this.apiClient(fetchUri, {
161
+ method: "PUT",
162
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
163
+ expectNoContent: true
164
+ });
165
+ }
166
+ async removeValue(body) {
167
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
168
+ await this.apiClient(fetchUri, {
169
+ method: "DELETE",
170
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
171
+ expectNoContent: true
172
+ });
173
+ }
174
+ };
175
+ var EnrichmentClient = _EnrichmentClient;
176
+ _url2 = new WeakMap();
177
+ _valueUrl = new WeakMap();
178
+ __privateAdd(EnrichmentClient, _url2, "/api/v1/enrichments");
179
+ __privateAdd(EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
180
+
181
+ // src/api/ManifestClient.ts
182
+ init_esm_shims();
183
+ var _url3;
184
+ var _ManifestClient = class extends ApiClient {
185
+ constructor(options) {
186
+ super(options);
187
+ }
188
+ async get(options) {
189
+ const { projectId } = this.options;
190
+ const fetchUri = this.createUrl(__privateGet(_ManifestClient, _url3), { ...options, projectId });
191
+ return await this.apiClient(fetchUri);
192
+ }
193
+ };
194
+ var ManifestClient = _ManifestClient;
195
+ _url3 = new WeakMap();
196
+ __privateAdd(ManifestClient, _url3, "/api/v2/manifest");
197
+
198
+ // src/api/QuirkClient.ts
199
+ init_esm_shims();
200
+ var _url4;
201
+ var _QuirkClient = class extends ApiClient {
202
+ constructor(options) {
203
+ super(options);
204
+ }
205
+ async get(options) {
206
+ const { projectId } = this.options;
207
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url4), { ...options, projectId });
208
+ return await this.apiClient(fetchUri);
209
+ }
210
+ async upsert(body) {
211
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url4));
212
+ await this.apiClient(fetchUri, {
213
+ method: "PUT",
214
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
215
+ expectNoContent: true
216
+ });
217
+ }
218
+ async remove(body) {
219
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url4));
220
+ await this.apiClient(fetchUri, {
221
+ method: "DELETE",
222
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
223
+ expectNoContent: true
224
+ });
225
+ }
226
+ };
227
+ var QuirkClient = _QuirkClient;
228
+ _url4 = new WeakMap();
229
+ __privateAdd(QuirkClient, _url4, "/api/v2/quirk");
230
+
231
+ // src/api/SignalClient.ts
232
+ init_esm_shims();
233
+ var _url5;
234
+ var _SignalClient = class extends ApiClient {
235
+ constructor(options) {
236
+ super(options);
237
+ }
238
+ async get(options) {
239
+ const { projectId } = this.options;
240
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url5), { ...options, projectId });
241
+ return await this.apiClient(fetchUri);
242
+ }
243
+ async upsert(body) {
244
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url5));
245
+ await this.apiClient(fetchUri, {
246
+ method: "PUT",
247
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
248
+ expectNoContent: true
249
+ });
250
+ }
251
+ async remove(body) {
252
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url5));
253
+ await this.apiClient(fetchUri, {
254
+ method: "DELETE",
255
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
256
+ expectNoContent: true
257
+ });
258
+ }
259
+ };
260
+ var SignalClient = _SignalClient;
261
+ _url5 = new WeakMap();
262
+ __privateAdd(SignalClient, _url5, "/api/v2/signal");
263
+
264
+ // src/api/TestClient.ts
265
+ init_esm_shims();
266
+ var _url6;
267
+ var _TestClient = class extends ApiClient {
268
+ constructor(options) {
269
+ super(options);
270
+ }
271
+ async get(options) {
272
+ const { projectId } = this.options;
273
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url6), { ...options, projectId });
274
+ return await this.apiClient(fetchUri);
275
+ }
276
+ async upsert(body) {
277
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url6));
278
+ await this.apiClient(fetchUri, {
279
+ method: "PUT",
280
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
281
+ expectNoContent: true
282
+ });
283
+ }
284
+ async remove(body) {
285
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url6));
286
+ await this.apiClient(fetchUri, {
287
+ method: "DELETE",
288
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
289
+ expectNoContent: true
290
+ });
291
+ }
292
+ };
293
+ var TestClient = _TestClient;
294
+ _url6 = new WeakMap();
295
+ __privateAdd(TestClient, _url6, "/api/v2/test");
296
+
297
+ export {
298
+ nullLimitPolicy,
299
+ ApiClientError,
300
+ ApiClient,
301
+ AggregateClient,
302
+ EnrichmentClient,
303
+ ManifestClient,
304
+ QuirkClient,
305
+ SignalClient,
306
+ TestClient
307
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ init_esm_shims
3
+ } from "./chunk-A5FZYSIL.mjs";
4
+
5
+ // src/manifest/constants.ts
6
+ init_esm_shims();
7
+ var ENR_SEPARATOR = "_";
8
+
9
+ export {
10
+ ENR_SEPARATOR
11
+ };
package/dist/cli/cli.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { UniformCLIPlugin } from '@uniformdev/cli';
2
2
  import { UniformPackage } from '@uniformdev/cli/sync';
3
- import { A as Aggregate, Q as Quirk, S as SignalWithId, E as EnrichmentCategoryWithValues, T as Test } from '../contextTypes-7f24fc7c';
4
- import '../v2-manifest.swagger-d0899723';
3
+ import { A as Aggregate, Q as Quirk, S as SignalWithId, E as EnrichmentCategoryWithValues, T as Test } from '../contextTypes-572b0d33';
4
+ import '../v2-manifest.swagger-ff2af13e';
5
5
 
6
6
  declare type ContextPackage = UniformPackage & {
7
7
  aggregates?: Array<Aggregate>;
@@ -1,4 +1,4 @@
1
- import { p as paths$7 } from './v2-manifest.swagger-d0899723';
1
+ import { p as paths$7 } from './v2-manifest.swagger-ff2af13e';
2
2
 
3
3
  /**
4
4
  * This file was auto-generated by openapi-typescript.
package/dist/index.d.ts CHANGED
@@ -1,26 +1,47 @@
1
- import { C as CookieAdapter, T as TransitionDataStore, S as StorageCommands, V as VisitorData, a as TransitionDataStoreOptions, D as DecayFunction, O as OutputSeverity, L as LogDrain, b as ContextPlugin, c as CriteriaEvaluator, d as StringMatch, e as ScoreVector, A as AggregateDimension, f as VariantMatchCriteria } from './types-d77228a6';
2
- export { A as AggregateDimension, l as AggregateDimensionInput, a8 as BehaviorTag, _ as Context, Z as ContextEvents, W as ContextOptions, b as ContextPlugin, r as ContextState, s as ContextStateUpdate, C as CookieAdapter, c as CriteriaEvaluator, m as CriteriaEvaluatorResult, D as DecayFunction, B as DecayOptions, ag as DevToolsActions, ak as DevToolsDataEvent, ah as DevToolsEvent, ai as DevToolsEvents, ao as DevToolsForgetEvent, al as DevToolsHelloEvent, aj as DevToolsLogEvent, an as DevToolsRawCommandsEvent, af as DevToolsState, ae as DevToolsUiVersion, am as DevToolsUpdateEvent, a7 as DimensionMatch, E as EnrichmentCategory, o as EnrichmentData, p as EventData, G as GroupCriteriaEvaluator, I as IdentifyCommand, L as LogDrain, a2 as LogMessage, $ as LogMessages, M as ManifestInstance, g as ManifestV2, a1 as MessageFunc, u as ModifyScoreCommand, v as ModifySessionScoreCommand, N as NumberMatch, O as OutputSeverity, X as PersonalizationEvent, P as PersonalizationManifest, a5 as PersonalizeOptions, aa as PersonalizedResult, a9 as PersonalizedVariant, Q as Quirks, R as SERVER_STATE_ID, e as ScoreVector, K as ServerToClientTransitionState, w as SetConsentCommand, z as SetControlGroupCommand, x as SetQuirkCommand, y as SetTestCommand, a0 as Severity, h as Signal, j as SignalCriteria, i as SignalCriteriaGroup, t as StorageCommand, S as StorageCommands, d as StringMatch, ad as TaggedContent, k as TestDefinition, Y as TestEvent, a4 as TestOptions, ac as TestResult, ab as TestVariant, n as Tests, T as TransitionDataStore, U as TransitionDataStoreEvents, a as TransitionDataStoreOptions, f as VariantMatchCriteria, V as VisitorData, J as VisitorDataStore, H as VisitorDataStoreEvents, F as VisitorDataStoreOptions, q as emptyVisitorData, a6 as personalizeVariations, a3 as testVariations } from './types-d77228a6';
3
- import './v2-manifest.swagger-d0899723';
1
+ import { T as TransitionDataStore, S as StorageCommands, V as VisitorData, a as TransitionDataStoreOptions, D as DecayFunction, O as OutputSeverity, L as LogDrain, C as ContextPlugin, b as CriteriaEvaluator, c as StringMatch, d as ScoreVector, A as AggregateDimension, e as VariantMatchCriteria, f as LogMessage } from './types-5f88cc63';
2
+ export { A as AggregateDimension, l as AggregateDimensionInput, ac as BehaviorTag, a0 as Context, $ as ContextEvents, Y as ContextOptions, C as ContextPlugin, t as ContextState, u as ContextStateUpdate, b as CriteriaEvaluator, n as CriteriaEvaluatorParameters, m as CriteriaEvaluatorResult, D as DecayFunction, H as DecayOptions, aj as DevToolsActions, an as DevToolsDataEvent, ak as DevToolsEvent, al as DevToolsEvents, ar as DevToolsForgetEvent, ao as DevToolsHelloEvent, am as DevToolsLogEvent, aq as DevToolsRawCommandsEvent, ai as DevToolsState, ah as DevToolsUiVersion, ap as DevToolsUpdateEvent, ab as DimensionMatch, E as EnrichmentCategory, q as EnrichmentData, r as EventData, G as GroupCriteriaEvaluator, I as IdentifyCommand, L as LogDrain, f as LogMessage, a6 as LogMessageGroup, a5 as LogMessageSingle, a1 as LogMessages, M as ManifestInstance, g as ManifestV2, a3 as MessageCategory, a4 as MessageFunc, w as ModifyScoreCommand, x as ModifySessionScoreCommand, N as NumberMatch, O as OutputSeverity, Z as PersonalizationEvent, P as PersonalizationManifest, a9 as PersonalizeOptions, ae as PersonalizedResult, ad as PersonalizedVariant, Q as Quirks, W as SERVER_STATE_ID, d as ScoreVector, U as ServerToClientTransitionState, y as SetConsentCommand, F as SetControlGroupCommand, z as SetQuirkCommand, B as SetTestCommand, a2 as Severity, h as Signal, j as SignalCriteria, i as SignalCriteriaGroup, o as SignalData, v as StorageCommand, S as StorageCommands, c as StringMatch, k as TestDefinition, _ as TestEvent, a8 as TestOptions, ag as TestResult, af as TestVariant, p as Tests, T as TransitionDataStore, X as TransitionDataStoreEvents, a as TransitionDataStoreOptions, e as VariantMatchCriteria, V as VisitorData, R as VisitorDataStore, K as VisitorDataStoreEvents, J as VisitorDataStoreOptions, s as emptyVisitorData, aa as personalizeVariations, a7 as testVariations } from './types-5f88cc63';
3
+ import Cookies from 'js-cookie';
4
+ import './v2-manifest.swagger-ff2af13e';
4
5
  import 'mitt';
5
6
 
6
7
  declare type CookieTransitionDataStoreOptions = {
7
- cookieAdapter: CookieAdapter;
8
+ /**
9
+ * The value of the score cookie during server-side rendering.
10
+ * Should be parsed from the incoming request.
11
+ * IMPORTANT: If not passed, the transition store will not have any effect during SSR.
12
+ */
13
+ serverCookieValue?: string;
14
+ /**
15
+ * The name of the cookie to store client-to-server score information in.
16
+ * Defaults to UNIFORM_DEFAULT_COOKIE_NAME if not set.
17
+ */
8
18
  cookieName?: string;
19
+ /**
20
+ * Attributes to set on the transfer cookie.
21
+ * Persistence is not necessary, because the data is only used for temporary transition;
22
+ * local storage is the master copy. Defaults to SameSite=Lax.
23
+ */
24
+ cookieAttributes?: Cookies.CookieAttributes;
9
25
  };
26
+ declare const UNIFORM_DEFAULT_COOKIE_NAME = "ufvd";
27
+ /**
28
+ * Handles client-to-server score handoff using an encoded cookie with the visitor score vector.
29
+ * NOTE: forget me is not supported when on the server side.
30
+ */
10
31
  declare class CookieTransitionDataStore extends TransitionDataStore {
11
32
  #private;
12
- constructor({ cookieAdapter, cookieName }: CookieTransitionDataStoreOptions);
33
+ constructor({ serverCookieValue, cookieName, cookieAttributes, }: CookieTransitionDataStoreOptions);
13
34
  handleDelete(): Promise<void>;
14
35
  handleUpdateData(_: StorageCommands[], computedValue: VisitorData): Promise<void>;
15
36
  }
16
37
 
17
38
  declare type EdgeTransitionDataStoreOptions = TransitionDataStoreOptions & {
18
- cookieAdapter: CookieAdapter;
39
+ serverCookieValue?: string;
19
40
  visitorIdCookieName?: string;
20
41
  };
21
42
  declare class EdgeTransitionDataStore extends TransitionDataStore {
22
43
  #private;
23
- constructor({ cookieAdapter, visitorIdCookieName, ...base }: EdgeTransitionDataStoreOptions);
44
+ constructor({ serverCookieValue, visitorIdCookieName, ...base }: EdgeTransitionDataStoreOptions);
24
45
  handleDelete(fromAllDevices?: boolean): Promise<void>;
25
46
  handleUpdateData(commands: StorageCommands[]): Promise<void>;
26
47
  }
@@ -65,19 +86,6 @@ declare function createConsoleLogDrain(level: OutputSeverity): LogDrain;
65
86
  */
66
87
  declare function enableConsoleLogDrain(level: OutputSeverity): ContextPlugin;
67
88
 
68
- /**
69
- * Creates a new log drain that will log full debug messages to the console.
70
- * The debug log drain adds significant bundle size, but is useful for debugging.
71
- *
72
- * NOTE: you probably want enableDebugConsoleLogDrain() instead of this function.
73
- */
74
- declare function createDebugConsoleLogDrain(level: OutputSeverity): LogDrain;
75
- /**
76
- * Enables logging Context events to the browser console.
77
- * Lightweight events with only the event ID are emitted.
78
- */
79
- declare function enableDebugConsoleLogDrain(level: OutputSeverity): ContextPlugin;
80
-
81
89
  declare const cookieEvaluator: CriteriaEvaluator;
82
90
 
83
91
  declare const pageViewCountDimension: string;
@@ -93,13 +101,31 @@ declare const currentPageEvaluator: CriteriaEvaluator;
93
101
 
94
102
  /** Tests if a StringMatch matches a string value */
95
103
  declare function isStringMatch(lhs: string | number | null | undefined, match: StringMatch): boolean;
104
+ declare function explainStringMatch(lhs: string | number | null | undefined, match: StringMatch): string;
105
+ declare function explainStringMatchCriteria(match: StringMatch): string;
106
+
107
+ declare type ConsoleDebugLogDrainOptions = {
108
+ enableOnServer?: boolean;
109
+ };
110
+ /**
111
+ * Creates a new log drain that will log full debug messages to the console.
112
+ * The debug log drain adds significant bundle size, but is useful for debugging.
113
+ *
114
+ * NOTE: you probably want enableDebugConsoleLogDrain() instead of this function.
115
+ */
116
+ declare function createDebugConsoleLogDrain(level: OutputSeverity, options?: ConsoleDebugLogDrainOptions): LogDrain;
117
+ /**
118
+ * Enables logging Context events to the browser console.
119
+ * Lightweight events with only the event ID are emitted.
120
+ */
121
+ declare function enableDebugConsoleLogDrain(level: OutputSeverity, options?: ConsoleDebugLogDrainOptions): ContextPlugin;
96
122
 
97
123
  /** Computes aggregated scores based on other dimensions */
98
124
  declare function computeAggregateDimensions(primitiveScores: ScoreVector, aggregates: Record<string, AggregateDimension>): ScoreVector;
99
125
 
100
126
  declare function getEnrichmentVectorKey(category: string, value: string): string;
101
127
 
102
- declare function evaluateVariantMatch(match: VariantMatchCriteria | undefined | null, vec: ScoreVector): boolean;
128
+ declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void): boolean;
103
129
 
104
130
  declare enum ScriptType {
105
131
  ListStart = "nesi-list-start",
@@ -126,4 +152,4 @@ declare const EdgeNodeTagName = "nesitag";
126
152
  */
127
153
  declare function enableContextDevTools(): ContextPlugin;
128
154
 
129
- export { CookieTransitionDataStore, CookieTransitionDataStoreOptions, EdgeNodeTagName, EdgePersonalizeComponentOptions, EdgeTestComponentOptions, EdgeTransitionDataStore, EdgeTransitionDataStoreOptions, LinearDecayOptions, ScriptType, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, evaluateVariantMatch, eventEvaluator, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, queryStringEvaluator, quirkEvaluator };
155
+ export { ConsoleDebugLogDrainOptions, CookieTransitionDataStore, CookieTransitionDataStoreOptions, EdgeNodeTagName, EdgePersonalizeComponentOptions, EdgeTestComponentOptions, EdgeTransitionDataStore, EdgeTransitionDataStoreOptions, LinearDecayOptions, ScriptType, UNIFORM_DEFAULT_COOKIE_NAME, computeAggregateDimensions, cookieEvaluator, createConsoleLogDrain, createDebugConsoleLogDrain, createLinearDecay, currentPageEvaluator, enableConsoleLogDrain, enableContextDevTools, enableDebugConsoleLogDrain, evaluateVariantMatch, eventEvaluator, explainStringMatch, explainStringMatchCriteria, getEnrichmentVectorKey, isStringMatch, pageViewCountDimension, pageViewCountEvaluator, queryStringEvaluator, quirkEvaluator };