@uniformdev/context 19.35.2 → 19.35.3-alpha.82

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.
@@ -0,0 +1,163 @@
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-012db0cb.js';
2
+ export { Z as AggregateDimensionInput, a3 as BehaviorTag, g as CONTEXTUAL_EDITING_TEST_NAME, h as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, l as Context, k as ContextEvents, i as ContextOptions, as as ContextState, at as ContextStateUpdate, I as CriteriaEvaluatorParameters, H as CriteriaEvaluatorResult, aj as DecayOptions, o as DevToolsActions, s as DevToolsDataEvent, p as DevToolsEvent, q as DevToolsEvents, w as DevToolsForgetEvent, t as DevToolsHelloEvent, r as DevToolsLogEvent, v as DevToolsRawCommandsEvent, n as DevToolsState, m as DevToolsUiVersion, u as DevToolsUpdateEvent, a0 as DimensionMatch, W as EnrichmentCategory, ap as EnrichmentData, aq as EventData, G as GroupCriteriaEvaluator, ae as IdentifyCommand, E as LogMessageGroup, B as LogMessageSingle, x as LogMessages, F as ManifestInstance, K as ManifestV2, M as MessageCategory, z as MessageFunc, a9 as ModifyScoreCommand, aa as ModifySessionScoreCommand, X as NumberMatch, P as PersonalizationEvent, N as PersonalizationManifest, a1 as PersonalizeOptions, a5 as PersonalizedResult, a4 as PersonalizedVariant, an as Quirks, ah as SERVER_STATE_ID, ag as ServerToClientTransitionState, ab as SetConsentCommand, af as SetControlGroupCommand, ac as SetQuirkCommand, ad as SetTestCommand, y as Severity, Q as Signal, U as SignalCriteria, R as SignalCriteriaGroup, J as SignalData, a8 as StorageCommand, Y as TestDefinition, j as TestEvent, _ as TestOptions, a7 as TestResult, a6 as TestVariant, ao as Tests, ai as TransitionDataStoreEvents, am as VisitorDataStore, al as VisitorDataStoreEvents, ak as VisitorDataStoreOptions, ar as emptyVisitorData, a2 as personalizeVariations, $ as testVariations } from './types-012db0cb.js';
3
+ import Cookies from 'js-cookie';
4
+ import 'mitt';
5
+
6
+ /**
7
+ * Creates a new log drain that will log to the console.
8
+ * The log drain will only log event IDs, but is much smaller than the
9
+ * debug log drain.
10
+ *
11
+ * NOTE: you probably want enableConsoleLogDrain() instead of this function.
12
+ */
13
+ declare function createConsoleLogDrain(level: OutputSeverity): LogDrain;
14
+ /**
15
+ * Enables logging Context events to the browser console.
16
+ * Lightweight events with only the event ID are emitted.
17
+ */
18
+ declare function enableConsoleLogDrain(level: OutputSeverity): ContextPlugin;
19
+
20
+ /** Computes aggregated scores based on other dimensions */
21
+ declare function computeAggregateDimensions(primitiveScores: ScoreVector, aggregates: Record<string, AggregateDimension>): ScoreVector;
22
+
23
+ type CookieTransitionDataStoreOptions = {
24
+ /**
25
+ * The value of the score cookie during server-side rendering.
26
+ * Should be parsed from the incoming request.
27
+ * IMPORTANT: If not passed, the transition store will not have any effect during SSR.
28
+ */
29
+ serverCookieValue?: string;
30
+ /**
31
+ * The name of the cookie to store client-to-server score information in.
32
+ * Defaults to UNIFORM_DEFAULT_COOKIE_NAME if not set.
33
+ */
34
+ cookieName?: string;
35
+ /**
36
+ * Attributes to set on the transfer cookie.
37
+ * Persistence is not necessary, because the data is only used for temporary transition;
38
+ * local storage is the master copy. Defaults to SameSite=Lax.
39
+ */
40
+ cookieAttributes?: Cookies.CookieAttributes;
41
+ };
42
+ declare const UNIFORM_DEFAULT_COOKIE_NAME = "ufvd";
43
+ /**
44
+ * Handles client-to-server score handoff using an encoded cookie with the visitor score vector.
45
+ * NOTE: forget me is not supported when on the server side.
46
+ */
47
+ declare class CookieTransitionDataStore extends TransitionDataStore {
48
+ #private;
49
+ constructor({ serverCookieValue, cookieName, cookieAttributes, }: CookieTransitionDataStoreOptions);
50
+ handleDelete(): Promise<void>;
51
+ handleUpdateData(_: StorageCommands[], computedValue: VisitorData): Promise<void>;
52
+ }
53
+
54
+ type EdgeTransitionDataStoreOptions = TransitionDataStoreOptions & {
55
+ serverCookieValue?: string;
56
+ visitorIdCookieName?: string;
57
+ };
58
+ declare class EdgeTransitionDataStore extends TransitionDataStore {
59
+ #private;
60
+ constructor({ serverCookieValue, visitorIdCookieName, ...base }: EdgeTransitionDataStoreOptions);
61
+ handleDelete(fromAllDevices?: boolean): Promise<void>;
62
+ handleUpdateData(commands: StorageCommands[]): Promise<void>;
63
+ }
64
+
65
+ type LinearDecayOptions = {
66
+ /**
67
+ * The length of time before decay starts, in msec.
68
+ * Default: 1 day (8.64e7)
69
+ */
70
+ gracePeriod?: number;
71
+ /**
72
+ * How much the score decays per day (decimal, 0-1).
73
+ * Default: decay over 30 days (1/30)
74
+ *
75
+ * Note: the grace period is not included in this rate,
76
+ * so if the grace period is 1 day and the decay rate is 1/30,
77
+ * it would take 31 days to hit max decay.
78
+ */
79
+ decayRate?: number;
80
+ /**
81
+ * The maximum amount of decay that can occur at once (decimal, 0-1)
82
+ * Default: 95% (0.95)
83
+ */
84
+ decayCap?: number;
85
+ };
86
+ /**
87
+ * Creates a function that applies linear decay to scores over time.
88
+ */
89
+ declare function createLinearDecay(options?: LinearDecayOptions): DecayFunction;
90
+
91
+ declare function getEnrichmentVectorKey(category: string, value: string): string;
92
+
93
+ declare const cookieEvaluator: CriteriaEvaluator;
94
+
95
+ declare const currentPageEvaluator: CriteriaEvaluator;
96
+
97
+ declare const eventEvaluator: CriteriaEvaluator;
98
+
99
+ declare const pageViewCountDimension: string;
100
+ declare const pageViewCountEvaluator: CriteriaEvaluator;
101
+
102
+ declare const queryStringEvaluator: CriteriaEvaluator;
103
+
104
+ declare const quirkEvaluator: CriteriaEvaluator;
105
+
106
+ /** Tests if a StringMatch matches a string value */
107
+ declare function isStringMatch(lhs: string | number | null | undefined, match: StringMatch): boolean;
108
+ declare function explainStringMatch(lhs: string | number | null | undefined, match: StringMatch): string;
109
+ declare function explainStringMatchCriteria(match: StringMatch): string;
110
+
111
+ type ConsoleDebugLogDrainOptions = {
112
+ enableOnServer?: boolean;
113
+ };
114
+ /**
115
+ * Creates a new log drain that will log full debug messages to the console.
116
+ * The debug log drain adds significant bundle size, but is useful for debugging.
117
+ *
118
+ * NOTE: you probably want enableDebugConsoleLogDrain() instead of this function.
119
+ */
120
+ declare function createDebugConsoleLogDrain(level: OutputSeverity, options?: ConsoleDebugLogDrainOptions): LogDrain;
121
+ /**
122
+ * Enables logging Context events to the browser console.
123
+ * Lightweight events with only the event ID are emitted.
124
+ */
125
+ declare function enableDebugConsoleLogDrain(level: OutputSeverity, options?: ConsoleDebugLogDrainOptions): ContextPlugin;
126
+
127
+ declare function evaluateVariantMatch(variantId: string, match: VariantMatchCriteria | undefined | null, vec: ScoreVector, onLogMessage?: (message: LogMessage) => void): boolean;
128
+
129
+ /**
130
+ * Enables a Context instance to feed data to the Uniform Context DevTools.
131
+ * DevTools can be hosted either as a Chromium extension, or as a standalone
132
+ * React app within a page and receive data once this plugin has been activated.
133
+ * @returns Function that when invoked detaches the event listeners and disables DevTools.
134
+ */
135
+ declare function enableContextDevTools(): ContextPlugin;
136
+
137
+ declare enum ScriptType {
138
+ ListStart = "nesi-list-start",
139
+ ListEnd = "nesi-list-end",
140
+ ListItem = "nesi-list-item-html",
141
+ ListItemSettings = "nesi-list-item-settings",
142
+ TestStart = "nesi-test-start",
143
+ TestEnd = "nesi-test-end",
144
+ Unknown = "unknown"
145
+ }
146
+ type EdgePersonalizeComponentOptions = {
147
+ name: string;
148
+ count?: number;
149
+ };
150
+ type EdgeTestComponentOptions = {
151
+ name: string;
152
+ };
153
+ declare const EdgeNodeTagName = "nesitag";
154
+
155
+ type QuickConnectConfig = {
156
+ apiKey: string;
157
+ projectId: string;
158
+ apiHost?: string;
159
+ };
160
+ declare function serializeQuickConnect(config: QuickConnectConfig): string;
161
+ declare function parseQuickConnect(serialized: string): Required<QuickConnectConfig>;
162
+
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context",
3
- "version": "19.35.2",
3
+ "version": "19.35.3-alpha.82+4bc341093",
4
4
  "description": "Uniform Context core package",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "64d3270175087c87cfaa29a283aa4a7b0a98fd2c"
69
+ "gitHead": "4bc341093bc946900df2646fe53eca4bcddc693c"
70
70
  }