@uniformdev/context 19.134.3-alpha.28 → 19.135.1-alpha.9
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 +25 -1
- package/dist/api/api.d.ts +25 -1
- package/dist/index.d.mts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.esm.js +447 -7
- package/dist/index.js +448 -7
- package/dist/index.mjs +447 -7
- package/dist/{types-WtfxfDct.d.mts → types-DqYG-dCc.d.mts} +36 -2
- package/dist/{types-WtfxfDct.d.ts → types-DqYG-dCc.d.ts} +36 -2
- package/package.json +5 -3
@@ -9,6 +9,9 @@ type Tests = {
|
|
9
9
|
type ScoreVector = {
|
10
10
|
[key: string]: number;
|
11
11
|
};
|
12
|
+
type Goals = {
|
13
|
+
[key: string]: boolean;
|
14
|
+
};
|
12
15
|
type EnrichmentData = {
|
13
16
|
/** Enrichment category name */
|
14
17
|
cat: string;
|
@@ -47,6 +50,10 @@ type VisitorData = {
|
|
47
50
|
* NOTE: Context.scores is more commonly correct to read scores instead of this value.
|
48
51
|
*/
|
49
52
|
scores: ScoreVector;
|
53
|
+
/**
|
54
|
+
* Goals that this user has triggered.
|
55
|
+
*/
|
56
|
+
goals?: Goals;
|
50
57
|
/**
|
51
58
|
* Whether consent has been given to store the visitor data
|
52
59
|
* If false or not set: visitor data is stored in memory and is lost if the browser refreshes
|
@@ -84,13 +91,23 @@ type ContextStateUpdate = {
|
|
84
91
|
visitor: VisitorData;
|
85
92
|
scores: ScoreVector;
|
86
93
|
};
|
94
|
+
type GoalStateUpdate = {
|
95
|
+
scores: ScoreVector | undefined;
|
96
|
+
quirks: Quirks | undefined;
|
97
|
+
};
|
87
98
|
|
88
99
|
type StorageCommand<TID extends string = string, TData = unknown> = {
|
89
100
|
type: TID;
|
90
101
|
data: TData;
|
91
102
|
};
|
92
103
|
/** Commands that can be issued to alter the storage of Uniform Context data */
|
93
|
-
type StorageCommands = ModifyScoreCommand | ModifySessionScoreCommand | SetConsentCommand | SetQuirkCommand | SetTestCommand | IdentifyCommand | SetControlGroupCommand | SetPersonalizeVariantControlCommand;
|
104
|
+
type StorageCommands = ModifyScoreCommand | ModifySessionScoreCommand | SetConsentCommand | SetQuirkCommand | SetTestCommand | IdentifyCommand | SetControlGroupCommand | SetPersonalizeVariantControlCommand | SetGoalCommand;
|
105
|
+
/**
|
106
|
+
* Converts the goal specified.
|
107
|
+
*/
|
108
|
+
type SetGoalCommand = StorageCommand<'setgoal', {
|
109
|
+
goal: string;
|
110
|
+
}>;
|
94
111
|
/**
|
95
112
|
* Changes the visitor's permanent score for a given dimension
|
96
113
|
*/
|
@@ -286,6 +303,12 @@ type VisitorDataStoreEvents = {
|
|
286
303
|
* Fired when visitor control group membership is changed
|
287
304
|
*/
|
288
305
|
controlGroupUpdated: Pick<VisitorData, 'controlGroup'>;
|
306
|
+
/**
|
307
|
+
* Fired when a goal is converted
|
308
|
+
*/
|
309
|
+
goalConverted: {
|
310
|
+
goalId: string;
|
311
|
+
};
|
289
312
|
};
|
290
313
|
declare class VisitorDataStore {
|
291
314
|
#private;
|
@@ -328,6 +351,7 @@ declare class ManifestInstance {
|
|
328
351
|
rollForControlGroup(): boolean;
|
329
352
|
getTest(name: string): TestDefinition | undefined;
|
330
353
|
computeSignals(update: ContextStateUpdate): StorageCommands[];
|
354
|
+
computeGoals(data: GoalStateUpdate): StorageCommands[];
|
331
355
|
/**
|
332
356
|
* Computes aggregated scores based on other dimensions
|
333
357
|
*/
|
@@ -491,6 +515,7 @@ interface external {
|
|
491
515
|
*/
|
492
516
|
dur: "s" | "p" | "t";
|
493
517
|
crit: external["uniform-context-types.swagger.yml"]["components"]["schemas"]["RootSignalCriteriaGroup"];
|
518
|
+
conversion?: external["uniform-context-types.swagger.yml"]["components"]["schemas"]["Conversion"] | null;
|
494
519
|
};
|
495
520
|
RootSignalCriteriaGroup: {
|
496
521
|
/**
|
@@ -512,6 +537,13 @@ interface external {
|
|
512
537
|
/** @description The criteria clauses that make up this grouping of criteria */
|
513
538
|
clauses: (external["uniform-context-types.swagger.yml"]["components"]["schemas"]["SignalCriteriaGroup"] | external["uniform-context-types.swagger.yml"]["components"]["schemas"]["SignalCriteria"])[];
|
514
539
|
};
|
540
|
+
Conversion: {
|
541
|
+
/**
|
542
|
+
* @description The frequency of the conversion event
|
543
|
+
* @enum {string}
|
544
|
+
*/
|
545
|
+
freq: "O";
|
546
|
+
};
|
515
547
|
SignalCriteriaGroup: {
|
516
548
|
/**
|
517
549
|
* @description Criteria type (Group of other criteria)
|
@@ -962,6 +994,8 @@ declare const CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_
|
|
962
994
|
type ContextPlugin = {
|
963
995
|
logDrain?: LogDrain;
|
964
996
|
init?: (context: Context) => () => void;
|
997
|
+
forget?: () => Promise<void> | void;
|
998
|
+
update?: (newData: Partial<ContextState>) => Promise<void> | void;
|
965
999
|
};
|
966
1000
|
type ContextOptions = {
|
967
1001
|
/** The Context Manifest to load (from the Context API) */
|
@@ -1173,4 +1207,4 @@ declare global {
|
|
1173
1207
|
}
|
1174
1208
|
}
|
1175
1209
|
|
1176
|
-
export { type TestOptions as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type PersonalizationManifest as Q, type Signal as R, type ScoreVector as S, TransitionDataStore as T, type SignalCriteriaGroup as U, type VisitorData as V, type SignalCriteria as W, type EnrichmentCategory as X, type NumberMatch as Y, type TestDefinition as Z, type AggregateDimensionInput as _, type StorageCommands as a, testVariations as a0, type DimensionMatch as a1, type PersonalizeOptions as a2, personalizeVariations as a3, type BehaviorTag as a4, type PersonalizedVariant as a5, type PersonalizedResult as a6, type TestVariant as a7, type TestResult as a8, type StorageCommand as a9, type
|
1210
|
+
export { type TestOptions as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type PersonalizationManifest as Q, type Signal as R, type ScoreVector as S, TransitionDataStore as T, type SignalCriteriaGroup as U, type VisitorData as V, type SignalCriteria as W, type EnrichmentCategory as X, type NumberMatch as Y, type TestDefinition as Z, type AggregateDimensionInput as _, type StorageCommands as a, testVariations as a0, type DimensionMatch as a1, type PersonalizeOptions as a2, personalizeVariations as a3, type BehaviorTag as a4, type PersonalizedVariant as a5, type PersonalizedResult as a6, type TestVariant as a7, type TestResult as a8, type StorageCommand as a9, type GoalStateUpdate as aA, type paths as aB, type SetGoalCommand as aa, type ModifyScoreCommand as ab, type ModifySessionScoreCommand as ac, type SetConsentCommand as ad, type SetQuirkCommand as ae, type SetTestCommand as af, type IdentifyCommand as ag, type SetControlGroupCommand as ah, type SetPersonalizeVariantControlCommand as ai, type ServerToClientTransitionState as aj, SERVER_STATE_ID as ak, type TransitionDataStoreEvents as al, type DecayOptions as am, type VisitorDataStoreOptions as an, type VisitorDataStoreEvents as ao, VisitorDataStore as ap, type Quirks as aq, type Tests as ar, type Goals as as, type EnrichmentData as at, type PersonalizeControlVariant as au, type PersonalizeVariants as av, type EventData as aw, emptyVisitorData as ax, type ContextState as ay, type ContextStateUpdate as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type DevToolsEvents as g, CONTEXTUAL_EDITING_TEST_NAME as h, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as i, type ContextOptions as j, type TestEvent as k, type ContextEvents as l, type ContextInstance as m, Context as n, type DevToolsUiVersion as o, type DevToolsState as p, type DevToolsActions as q, type DevToolsEvent as r, type DevToolsLogEvent as s, type DevToolsDataEvent as t, type DevToolsHelloEvent as u, type DevToolsUpdateEvent as v, type DevToolsRawCommandsEvent as w, type DevToolsForgetEvent as x, type LogMessages as y, type Severity as z };
|
@@ -9,6 +9,9 @@ type Tests = {
|
|
9
9
|
type ScoreVector = {
|
10
10
|
[key: string]: number;
|
11
11
|
};
|
12
|
+
type Goals = {
|
13
|
+
[key: string]: boolean;
|
14
|
+
};
|
12
15
|
type EnrichmentData = {
|
13
16
|
/** Enrichment category name */
|
14
17
|
cat: string;
|
@@ -47,6 +50,10 @@ type VisitorData = {
|
|
47
50
|
* NOTE: Context.scores is more commonly correct to read scores instead of this value.
|
48
51
|
*/
|
49
52
|
scores: ScoreVector;
|
53
|
+
/**
|
54
|
+
* Goals that this user has triggered.
|
55
|
+
*/
|
56
|
+
goals?: Goals;
|
50
57
|
/**
|
51
58
|
* Whether consent has been given to store the visitor data
|
52
59
|
* If false or not set: visitor data is stored in memory and is lost if the browser refreshes
|
@@ -84,13 +91,23 @@ type ContextStateUpdate = {
|
|
84
91
|
visitor: VisitorData;
|
85
92
|
scores: ScoreVector;
|
86
93
|
};
|
94
|
+
type GoalStateUpdate = {
|
95
|
+
scores: ScoreVector | undefined;
|
96
|
+
quirks: Quirks | undefined;
|
97
|
+
};
|
87
98
|
|
88
99
|
type StorageCommand<TID extends string = string, TData = unknown> = {
|
89
100
|
type: TID;
|
90
101
|
data: TData;
|
91
102
|
};
|
92
103
|
/** Commands that can be issued to alter the storage of Uniform Context data */
|
93
|
-
type StorageCommands = ModifyScoreCommand | ModifySessionScoreCommand | SetConsentCommand | SetQuirkCommand | SetTestCommand | IdentifyCommand | SetControlGroupCommand | SetPersonalizeVariantControlCommand;
|
104
|
+
type StorageCommands = ModifyScoreCommand | ModifySessionScoreCommand | SetConsentCommand | SetQuirkCommand | SetTestCommand | IdentifyCommand | SetControlGroupCommand | SetPersonalizeVariantControlCommand | SetGoalCommand;
|
105
|
+
/**
|
106
|
+
* Converts the goal specified.
|
107
|
+
*/
|
108
|
+
type SetGoalCommand = StorageCommand<'setgoal', {
|
109
|
+
goal: string;
|
110
|
+
}>;
|
94
111
|
/**
|
95
112
|
* Changes the visitor's permanent score for a given dimension
|
96
113
|
*/
|
@@ -286,6 +303,12 @@ type VisitorDataStoreEvents = {
|
|
286
303
|
* Fired when visitor control group membership is changed
|
287
304
|
*/
|
288
305
|
controlGroupUpdated: Pick<VisitorData, 'controlGroup'>;
|
306
|
+
/**
|
307
|
+
* Fired when a goal is converted
|
308
|
+
*/
|
309
|
+
goalConverted: {
|
310
|
+
goalId: string;
|
311
|
+
};
|
289
312
|
};
|
290
313
|
declare class VisitorDataStore {
|
291
314
|
#private;
|
@@ -328,6 +351,7 @@ declare class ManifestInstance {
|
|
328
351
|
rollForControlGroup(): boolean;
|
329
352
|
getTest(name: string): TestDefinition | undefined;
|
330
353
|
computeSignals(update: ContextStateUpdate): StorageCommands[];
|
354
|
+
computeGoals(data: GoalStateUpdate): StorageCommands[];
|
331
355
|
/**
|
332
356
|
* Computes aggregated scores based on other dimensions
|
333
357
|
*/
|
@@ -491,6 +515,7 @@ interface external {
|
|
491
515
|
*/
|
492
516
|
dur: "s" | "p" | "t";
|
493
517
|
crit: external["uniform-context-types.swagger.yml"]["components"]["schemas"]["RootSignalCriteriaGroup"];
|
518
|
+
conversion?: external["uniform-context-types.swagger.yml"]["components"]["schemas"]["Conversion"] | null;
|
494
519
|
};
|
495
520
|
RootSignalCriteriaGroup: {
|
496
521
|
/**
|
@@ -512,6 +537,13 @@ interface external {
|
|
512
537
|
/** @description The criteria clauses that make up this grouping of criteria */
|
513
538
|
clauses: (external["uniform-context-types.swagger.yml"]["components"]["schemas"]["SignalCriteriaGroup"] | external["uniform-context-types.swagger.yml"]["components"]["schemas"]["SignalCriteria"])[];
|
514
539
|
};
|
540
|
+
Conversion: {
|
541
|
+
/**
|
542
|
+
* @description The frequency of the conversion event
|
543
|
+
* @enum {string}
|
544
|
+
*/
|
545
|
+
freq: "O";
|
546
|
+
};
|
515
547
|
SignalCriteriaGroup: {
|
516
548
|
/**
|
517
549
|
* @description Criteria type (Group of other criteria)
|
@@ -962,6 +994,8 @@ declare const CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID = "contextual_editing_
|
|
962
994
|
type ContextPlugin = {
|
963
995
|
logDrain?: LogDrain;
|
964
996
|
init?: (context: Context) => () => void;
|
997
|
+
forget?: () => Promise<void> | void;
|
998
|
+
update?: (newData: Partial<ContextState>) => Promise<void> | void;
|
965
999
|
};
|
966
1000
|
type ContextOptions = {
|
967
1001
|
/** The Context Manifest to load (from the Context API) */
|
@@ -1173,4 +1207,4 @@ declare global {
|
|
1173
1207
|
}
|
1174
1208
|
}
|
1175
1209
|
|
1176
|
-
export { type TestOptions as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type PersonalizationManifest as Q, type Signal as R, type ScoreVector as S, TransitionDataStore as T, type SignalCriteriaGroup as U, type VisitorData as V, type SignalCriteria as W, type EnrichmentCategory as X, type NumberMatch as Y, type TestDefinition as Z, type AggregateDimensionInput as _, type StorageCommands as a, testVariations as a0, type DimensionMatch as a1, type PersonalizeOptions as a2, personalizeVariations as a3, type BehaviorTag as a4, type PersonalizedVariant as a5, type PersonalizedResult as a6, type TestVariant as a7, type TestResult as a8, type StorageCommand as a9, type
|
1210
|
+
export { type TestOptions as $, type AggregateDimension as A, type MessageFunc as B, type ContextPlugin as C, type DecayFunction as D, type LogMessageSingle as E, type LogMessageGroup as F, ManifestInstance as G, GroupCriteriaEvaluator as H, type CriteriaEvaluatorResult as I, type CriteriaEvaluatorParameters as J, type SignalData as K, type LogDrain as L, type MessageCategory as M, type ManifestV2 as N, type OutputSeverity as O, type PersonalizationEvent as P, type PersonalizationManifest as Q, type Signal as R, type ScoreVector as S, TransitionDataStore as T, type SignalCriteriaGroup as U, type VisitorData as V, type SignalCriteria as W, type EnrichmentCategory as X, type NumberMatch as Y, type TestDefinition as Z, type AggregateDimensionInput as _, type StorageCommands as a, testVariations as a0, type DimensionMatch as a1, type PersonalizeOptions as a2, personalizeVariations as a3, type BehaviorTag as a4, type PersonalizedVariant as a5, type PersonalizedResult as a6, type TestVariant as a7, type TestResult as a8, type StorageCommand as a9, type GoalStateUpdate as aA, type paths as aB, type SetGoalCommand as aa, type ModifyScoreCommand as ab, type ModifySessionScoreCommand as ac, type SetConsentCommand as ad, type SetQuirkCommand as ae, type SetTestCommand as af, type IdentifyCommand as ag, type SetControlGroupCommand as ah, type SetPersonalizeVariantControlCommand as ai, type ServerToClientTransitionState as aj, SERVER_STATE_ID as ak, type TransitionDataStoreEvents as al, type DecayOptions as am, type VisitorDataStoreOptions as an, type VisitorDataStoreEvents as ao, VisitorDataStore as ap, type Quirks as aq, type Tests as ar, type Goals as as, type EnrichmentData as at, type PersonalizeControlVariant as au, type PersonalizeVariants as av, type EventData as aw, emptyVisitorData as ax, type ContextState as ay, type ContextStateUpdate as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type DevToolsEvents as g, CONTEXTUAL_EDITING_TEST_NAME as h, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as i, type ContextOptions as j, type TestEvent as k, type ContextEvents as l, type ContextInstance as m, Context as n, type DevToolsUiVersion as o, type DevToolsState as p, type DevToolsActions as q, type DevToolsEvent as r, type DevToolsLogEvent as s, type DevToolsDataEvent as t, type DevToolsHelloEvent as u, type DevToolsUpdateEvent as v, type DevToolsRawCommandsEvent as w, type DevToolsForgetEvent as x, type LogMessages as y, type Severity as z };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/context",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.135.1-alpha.9+6715fce92a",
|
4
4
|
"description": "Uniform Context core package",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -51,6 +51,7 @@
|
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
53
|
"@types/js-cookie": "3.0.6",
|
54
|
+
"@types/uuid": "9.0.4",
|
54
55
|
"benny": "3.7.1"
|
55
56
|
},
|
56
57
|
"dependencies": {
|
@@ -58,7 +59,8 @@
|
|
58
59
|
"js-cookie": "3.0.5",
|
59
60
|
"mitt": "^3.0.0",
|
60
61
|
"p-limit": "^3.1.0",
|
61
|
-
"rfdc": "^1.3.0"
|
62
|
+
"rfdc": "^1.3.0",
|
63
|
+
"uuid": "9.0.1"
|
62
64
|
},
|
63
65
|
"files": [
|
64
66
|
"/dist"
|
@@ -66,5 +68,5 @@
|
|
66
68
|
"publishConfig": {
|
67
69
|
"access": "public"
|
68
70
|
},
|
69
|
-
"gitHead": "
|
71
|
+
"gitHead": "6715fce92a09242316f5a218cc3d94b39e58cc05"
|
70
72
|
}
|