@uniformdev/context 17.6.1-alpha.60 → 17.7.1-alpha.140
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 +8 -8
- package/dist/cli/cli.d.ts +3 -3
- package/dist/{contextTypes-1907a553.d.ts → contextTypes-defd0c5d.d.ts} +62 -62
- package/dist/index.d.ts +10 -10
- package/dist/{types-cb64a6b4.d.ts → types-1c9fdbd2.d.ts} +75 -75
- package/dist/{v2-manifest.swagger-200ca5ee.d.ts → v2-manifest.swagger-74a3dcac.d.ts} +0 -0
- package/package.json +4 -4
package/dist/api/api.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import { A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, c as AggregateDeleteParameters, D as DimensionDefinition, d as DimensionGetParameters, e as DimensionGetResponse, E as EnrichmentGetParameters, f as EnrichmentGetResponse, g as EnrichmentPutParameters, h as EnrichmentDeleteParameters, i as EnrichmentValuePutParameters, j as EnrichmentValueDeleteParameters, M as ManifestGetParameters, k as ManifestGetResponse, Q as QuirkGetParameters, l as QuirkGetResponse, m as QuirkPutParameters, n as QuirkDeleteParameters, S as SignalGetParameters, o as SignalGetResponse, p as SignalPutParameters, q as SignalDeleteParameters, T as TestGetParameters, r as TestGetResponse, s as TestPutParameters, t as TestDeleteParameters } from '../contextTypes-
|
2
|
-
export { x as Aggregate, c as AggregateDeleteParameters, A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, C as ContextDefinitions, F as CookieCriteria, J as CurrentPageCriteria, D as DimensionDefinition, d as DimensionGetParameters, e as DimensionGetResponse, u as EnrichmentCategory, v as EnrichmentCategoryWithValues, h as EnrichmentDeleteParameters, E as EnrichmentGetParameters, f as EnrichmentGetResponse, g as EnrichmentPutParameters, w as EnrichmentValue, j as EnrichmentValueDeleteParameters, i as EnrichmentValuePutParameters, I as EventCriteria, M as ManifestGetParameters, k as ManifestGetResponse, P as PageViewCountCriteria, G as QueryStringCriteria, y as Quirk, H as QuirkCriteria, n as QuirkDeleteParameters, Q as QuirkGetParameters, l as QuirkGetResponse, m as QuirkPutParameters, R as RootSignalCriteriaGroup, q as SignalDeleteParameters, S as SignalGetParameters, o as SignalGetResponse, p as SignalPutParameters, B as SignalWithId, z as Test, t as TestDeleteParameters, T as TestGetParameters, r as TestGetResponse, s as TestPutParameters } from '../contextTypes-
|
3
|
-
import { I as ManifestV2 } from '../types-
|
4
|
-
import '../v2-manifest.swagger-
|
1
|
+
import { A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, c as AggregateDeleteParameters, D as DimensionDefinition, d as DimensionGetParameters, e as DimensionGetResponse, E as EnrichmentGetParameters, f as EnrichmentGetResponse, g as EnrichmentPutParameters, h as EnrichmentDeleteParameters, i as EnrichmentValuePutParameters, j as EnrichmentValueDeleteParameters, M as ManifestGetParameters, k as ManifestGetResponse, Q as QuirkGetParameters, l as QuirkGetResponse, m as QuirkPutParameters, n as QuirkDeleteParameters, S as SignalGetParameters, o as SignalGetResponse, p as SignalPutParameters, q as SignalDeleteParameters, T as TestGetParameters, r as TestGetResponse, s as TestPutParameters, t as TestDeleteParameters } from '../contextTypes-defd0c5d.js';
|
2
|
+
export { x as Aggregate, c as AggregateDeleteParameters, A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, C as ContextDefinitions, F as CookieCriteria, J as CurrentPageCriteria, D as DimensionDefinition, d as DimensionGetParameters, e as DimensionGetResponse, u as EnrichmentCategory, v as EnrichmentCategoryWithValues, h as EnrichmentDeleteParameters, E as EnrichmentGetParameters, f as EnrichmentGetResponse, g as EnrichmentPutParameters, w as EnrichmentValue, j as EnrichmentValueDeleteParameters, i as EnrichmentValuePutParameters, I as EventCriteria, M as ManifestGetParameters, k as ManifestGetResponse, P as PageViewCountCriteria, G as QueryStringCriteria, y as Quirk, H as QuirkCriteria, n as QuirkDeleteParameters, Q as QuirkGetParameters, l as QuirkGetResponse, m as QuirkPutParameters, R as RootSignalCriteriaGroup, q as SignalDeleteParameters, S as SignalGetParameters, o as SignalGetResponse, p as SignalPutParameters, B as SignalWithId, z as Test, t as TestDeleteParameters, T as TestGetParameters, r as TestGetResponse, s as TestPutParameters } from '../contextTypes-defd0c5d.js';
|
3
|
+
import { I as ManifestV2 } from '../types-1c9fdbd2.js';
|
4
|
+
import '../v2-manifest.swagger-74a3dcac.js';
|
5
5
|
import 'mitt';
|
6
6
|
|
7
|
-
|
7
|
+
type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
8
8
|
declare const nullLimitPolicy: LimitPolicy;
|
9
|
-
|
9
|
+
type ClientOptions = {
|
10
10
|
/** The Uniform API host to use. Internal use. */
|
11
11
|
apiHost?: string;
|
12
12
|
/** The Uniform API key to use when sending API requests. This or bearer token must be specified. */
|
@@ -25,7 +25,7 @@ declare type ClientOptions = {
|
|
25
25
|
/** Specify whether caching is disabled. */
|
26
26
|
bypassCache?: boolean;
|
27
27
|
};
|
28
|
-
|
28
|
+
type ExceptProject<T> = Omit<T, 'projectId'>;
|
29
29
|
declare class ApiClientError extends Error {
|
30
30
|
errorMessage: string;
|
31
31
|
fetchMethod: string;
|
@@ -64,7 +64,7 @@ declare class CachedAggregateClient extends AggregateClient {
|
|
64
64
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
65
65
|
}
|
66
66
|
|
67
|
-
|
67
|
+
type DimensionDisplayData = {
|
68
68
|
dim: string;
|
69
69
|
type: 'Aggregate' | 'Enrichment' | 'Signal' | 'Intent' | 'Audience';
|
70
70
|
category?: string;
|
package/dist/cli/cli.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { UniformCLIPlugin } from '@uniformdev/cli';
|
2
2
|
import { UniformPackage } from '@uniformdev/cli/sync';
|
3
|
-
import { C as ContextDefinitions } from '../contextTypes-
|
4
|
-
import '../v2-manifest.swagger-
|
3
|
+
import { C as ContextDefinitions } from '../contextTypes-defd0c5d.js';
|
4
|
+
import '../v2-manifest.swagger-74a3dcac.js';
|
5
5
|
|
6
|
-
|
6
|
+
type ContextPackage = UniformPackage & ContextDefinitions;
|
7
7
|
declare function readContextPackage(filename: string, assertExists: boolean): ContextPackage;
|
8
8
|
declare function writeContextPackage(filename: string, packageContents: ContextPackage): void;
|
9
9
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { p as paths$7 } from './v2-manifest.swagger-
|
1
|
+
import { p as paths$7 } from './v2-manifest.swagger-74a3dcac.js';
|
2
2
|
|
3
3
|
interface components$6 {
|
4
4
|
schemas: {
|
@@ -1647,67 +1647,67 @@ interface external {
|
|
1647
1647
|
};
|
1648
1648
|
}
|
1649
1649
|
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1650
|
+
type EnrichmentGet = paths$5['/api/v1/enrichments']['get'];
|
1651
|
+
type EnrichmentGetParameters = EnrichmentGet['parameters']['query'];
|
1652
|
+
type EnrichmentGetResponse = EnrichmentGet['responses']['200']['content']['application/json'];
|
1653
|
+
type EnrichmentCategory = components$5['schemas']['EnrichmentCategory'];
|
1654
|
+
type EnrichmentCategoryWithValues = components$5['schemas']['EnrichmentCategoryWithValues'];
|
1655
|
+
type EnrichmentValue = components$5['schemas']['EnrichmentValue'];
|
1656
|
+
type EnrichmentPut = paths$5['/api/v1/enrichments']['put'];
|
1657
|
+
type EnrichmentPutParameters = EnrichmentPut['requestBody']['content']['application/json'];
|
1658
|
+
type EnrichmentDelete = paths$5['/api/v1/enrichments']['delete'];
|
1659
|
+
type EnrichmentDeleteParameters = EnrichmentDelete['requestBody']['content']['application/json'];
|
1660
|
+
type EnrichmentValuePut = paths$6['/api/v1/enrichment-values']['put'];
|
1661
|
+
type EnrichmentValuePutParameters = EnrichmentValuePut['requestBody']['content']['application/json'];
|
1662
|
+
type EnrichmentValueDelete = paths$6['/api/v1/enrichment-values']['delete'];
|
1663
|
+
type EnrichmentValueDeleteParameters = EnrichmentValueDelete['requestBody']['content']['application/json'];
|
1664
|
+
type ManifestGet = paths$7['/api/v2/manifest']['get'];
|
1665
|
+
type ManifestGetParameters = ManifestGet['parameters']['query'];
|
1666
|
+
type ManifestGetResponse = ManifestGet['responses']['200']['content']['application/json'];
|
1667
|
+
type AggregateGet = paths$4['/api/v2/aggregate']['get'];
|
1668
|
+
type AggregateGetParameters = AggregateGet['parameters']['query'];
|
1669
|
+
type AggregateGetResponse = AggregateGet['responses']['200']['content']['application/json'];
|
1670
|
+
type Aggregate = components$4['schemas']['AggregateData'];
|
1671
|
+
type AggregatePut = paths$4['/api/v2/aggregate']['put'];
|
1672
|
+
type AggregatePutParameters = AggregatePut['requestBody']['content']['application/json'];
|
1673
|
+
type AggregateDelete = paths$4['/api/v2/aggregate']['delete'];
|
1674
|
+
type AggregateDeleteParameters = AggregateDelete['requestBody']['content']['application/json'];
|
1675
|
+
type DimensionGet = paths$3['/api/v2/dimension']['get'];
|
1676
|
+
type DimensionGetParameters = DimensionGet['parameters']['query'];
|
1677
|
+
type DimensionGetResponse = DimensionGet['responses']['200']['content']['application/json'];
|
1678
|
+
type DimensionDefinition = components$3['schemas']['DimensionDefinition'];
|
1679
|
+
type QuirkGet = paths$2['/api/v2/quirk']['get'];
|
1680
|
+
type QuirkGetParameters = QuirkGet['parameters']['query'];
|
1681
|
+
type QuirkGetResponse = QuirkGet['responses']['200']['content']['application/json'];
|
1682
|
+
type Quirk = components$2['schemas']['Quirk'];
|
1683
|
+
type QuirkPut = paths$2['/api/v2/quirk']['put'];
|
1684
|
+
type QuirkPutParameters = QuirkPut['requestBody']['content']['application/json'];
|
1685
|
+
type QuirkDelete = paths$2['/api/v2/quirk']['delete'];
|
1686
|
+
type QuirkDeleteParameters = QuirkDelete['requestBody']['content']['application/json'];
|
1687
|
+
type TestGet = paths['/api/v2/test']['get'];
|
1688
|
+
type TestGetParameters = TestGet['parameters']['query'];
|
1689
|
+
type TestGetResponse = TestGet['responses']['200']['content']['application/json'];
|
1690
|
+
type Test = components['schemas']['Test'];
|
1691
|
+
type TestPut = paths['/api/v2/test']['put'];
|
1692
|
+
type TestPutParameters = TestPut['requestBody']['content']['application/json'];
|
1693
|
+
type TestDelete = paths['/api/v2/test']['delete'];
|
1694
|
+
type TestDeleteParameters = TestDelete['requestBody']['content']['application/json'];
|
1695
|
+
type SignalGet = paths$1['/api/v2/signal']['get'];
|
1696
|
+
type SignalGetParameters = SignalGet['parameters']['query'];
|
1697
|
+
type SignalGetResponse = SignalGet['responses']['200']['content']['application/json'];
|
1698
|
+
type SignalWithId = components$1['schemas']['SignalWithId'];
|
1699
|
+
type RootSignalCriteriaGroup = components$6['schemas']['RootSignalCriteriaGroup'];
|
1700
|
+
type CookieCriteria = components$6['schemas']['CookieCriteria'];
|
1701
|
+
type QueryStringCriteria = components$6['schemas']['QueryStringCriteria'];
|
1702
|
+
type QuirkCriteria = components$6['schemas']['QuirkCriteria'];
|
1703
|
+
type EventCriteria = components$6['schemas']['EventCriteria'];
|
1704
|
+
type CurrentPageCriteria = components$6['schemas']['CurrentPageCriteria'];
|
1705
|
+
type PageViewCountCriteria = components$6['schemas']['PageViewCountCriteria'];
|
1706
|
+
type SignalPut = paths$1['/api/v2/signal']['put'];
|
1707
|
+
type SignalPutParameters = SignalPut['requestBody']['content']['application/json'];
|
1708
|
+
type SignalDelete = paths$1['/api/v2/signal']['delete'];
|
1709
|
+
type SignalDeleteParameters = SignalDelete['requestBody']['content']['application/json'];
|
1710
|
+
type ContextDefinitions = {
|
1711
1711
|
aggregates?: Array<Aggregate>;
|
1712
1712
|
quirks?: Array<Quirk>;
|
1713
1713
|
signals?: Array<SignalWithId>;
|
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
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 { A as AggregateDimension, X as AggregateDimensionInput, a1 as BehaviorTag, j as Context, i as ContextEvents, g as ContextOptions, C as ContextPlugin, aq as ContextState, ar as ContextStateUpdate, c as CriteriaEvaluator, F as CriteriaEvaluatorParameters, E as CriteriaEvaluatorResult, D as DecayFunction, ah as DecayOptions, m as DevToolsActions, q as DevToolsDataEvent, n as DevToolsEvent, o as DevToolsEvents, u as DevToolsForgetEvent, r as DevToolsHelloEvent, p as DevToolsLogEvent, t as DevToolsRawCommandsEvent, l as DevToolsState, k as DevToolsUiVersion, s as DevToolsUpdateEvent, _ as DimensionMatch, R as EnrichmentCategory, an as EnrichmentData, ao as EventData, G as GroupCriteriaEvaluator, ac as IdentifyCommand, L as LogDrain, f as LogMessage, z as LogMessageGroup, y as LogMessageSingle, v as LogMessages, B as ManifestInstance, I as ManifestV2, M as MessageCategory, x as MessageFunc, a7 as ModifyScoreCommand, a8 as ModifySessionScoreCommand, U as NumberMatch, O as OutputSeverity, P as PersonalizationEvent, J as PersonalizationManifest, $ as PersonalizeOptions, a3 as PersonalizedResult, a2 as PersonalizedVariant, al as Quirks, af as SERVER_STATE_ID, S as ScoreVector, ae as ServerToClientTransitionState, a9 as SetConsentCommand, ad as SetControlGroupCommand, aa as SetQuirkCommand, ab as SetTestCommand, w as Severity, K as Signal, Q as SignalCriteria, N as SignalCriteriaGroup, H as SignalData, a6 as StorageCommand, a as StorageCommands, d as StringMatch, W as TestDefinition, h as TestEvent, Y as TestOptions, a5 as TestResult, a4 as TestVariant, am as Tests, T as TransitionDataStore, ag as TransitionDataStoreEvents, b as TransitionDataStoreOptions, e as VariantMatchCriteria, V as VisitorData, ak as VisitorDataStore, aj as VisitorDataStoreEvents, ai as VisitorDataStoreOptions, ap as emptyVisitorData, a0 as personalizeVariations, Z as testVariations } from './types-
|
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-1c9fdbd2.js';
|
2
|
+
export { A as AggregateDimension, X as AggregateDimensionInput, a1 as BehaviorTag, j as Context, i as ContextEvents, g as ContextOptions, C as ContextPlugin, aq as ContextState, ar as ContextStateUpdate, c as CriteriaEvaluator, F as CriteriaEvaluatorParameters, E as CriteriaEvaluatorResult, D as DecayFunction, ah as DecayOptions, m as DevToolsActions, q as DevToolsDataEvent, n as DevToolsEvent, o as DevToolsEvents, u as DevToolsForgetEvent, r as DevToolsHelloEvent, p as DevToolsLogEvent, t as DevToolsRawCommandsEvent, l as DevToolsState, k as DevToolsUiVersion, s as DevToolsUpdateEvent, _ as DimensionMatch, R as EnrichmentCategory, an as EnrichmentData, ao as EventData, G as GroupCriteriaEvaluator, ac as IdentifyCommand, L as LogDrain, f as LogMessage, z as LogMessageGroup, y as LogMessageSingle, v as LogMessages, B as ManifestInstance, I as ManifestV2, M as MessageCategory, x as MessageFunc, a7 as ModifyScoreCommand, a8 as ModifySessionScoreCommand, U as NumberMatch, O as OutputSeverity, P as PersonalizationEvent, J as PersonalizationManifest, $ as PersonalizeOptions, a3 as PersonalizedResult, a2 as PersonalizedVariant, al as Quirks, af as SERVER_STATE_ID, S as ScoreVector, ae as ServerToClientTransitionState, a9 as SetConsentCommand, ad as SetControlGroupCommand, aa as SetQuirkCommand, ab as SetTestCommand, w as Severity, K as Signal, Q as SignalCriteria, N as SignalCriteriaGroup, H as SignalData, a6 as StorageCommand, a as StorageCommands, d as StringMatch, W as TestDefinition, h as TestEvent, Y as TestOptions, a5 as TestResult, a4 as TestVariant, am as Tests, T as TransitionDataStore, ag as TransitionDataStoreEvents, b as TransitionDataStoreOptions, e as VariantMatchCriteria, V as VisitorData, ak as VisitorDataStore, aj as VisitorDataStoreEvents, ai as VisitorDataStoreOptions, ap as emptyVisitorData, a0 as personalizeVariations, Z as testVariations } from './types-1c9fdbd2.js';
|
3
3
|
import Cookies from 'js-cookie';
|
4
4
|
import 'mitt';
|
5
|
-
import './v2-manifest.swagger-
|
5
|
+
import './v2-manifest.swagger-74a3dcac.js';
|
6
6
|
|
7
7
|
/**
|
8
8
|
* Creates a new log drain that will log to the console.
|
@@ -21,7 +21,7 @@ declare function enableConsoleLogDrain(level: OutputSeverity): ContextPlugin;
|
|
21
21
|
/** Computes aggregated scores based on other dimensions */
|
22
22
|
declare function computeAggregateDimensions(primitiveScores: ScoreVector, aggregates: Record<string, AggregateDimension>): ScoreVector;
|
23
23
|
|
24
|
-
|
24
|
+
type CookieTransitionDataStoreOptions = {
|
25
25
|
/**
|
26
26
|
* The value of the score cookie during server-side rendering.
|
27
27
|
* Should be parsed from the incoming request.
|
@@ -52,7 +52,7 @@ declare class CookieTransitionDataStore extends TransitionDataStore {
|
|
52
52
|
handleUpdateData(_: StorageCommands[], computedValue: VisitorData): Promise<void>;
|
53
53
|
}
|
54
54
|
|
55
|
-
|
55
|
+
type EdgeTransitionDataStoreOptions = TransitionDataStoreOptions & {
|
56
56
|
serverCookieValue?: string;
|
57
57
|
visitorIdCookieName?: string;
|
58
58
|
};
|
@@ -63,7 +63,7 @@ declare class EdgeTransitionDataStore extends TransitionDataStore {
|
|
63
63
|
handleUpdateData(commands: StorageCommands[]): Promise<void>;
|
64
64
|
}
|
65
65
|
|
66
|
-
|
66
|
+
type LinearDecayOptions = {
|
67
67
|
/**
|
68
68
|
* The length of time before decay starts, in msec.
|
69
69
|
* Default: 1 day (8.64e7)
|
@@ -109,7 +109,7 @@ declare function isStringMatch(lhs: string | number | null | undefined, match: S
|
|
109
109
|
declare function explainStringMatch(lhs: string | number | null | undefined, match: StringMatch): string;
|
110
110
|
declare function explainStringMatchCriteria(match: StringMatch): string;
|
111
111
|
|
112
|
-
|
112
|
+
type ConsoleDebugLogDrainOptions = {
|
113
113
|
enableOnServer?: boolean;
|
114
114
|
};
|
115
115
|
/**
|
@@ -144,16 +144,16 @@ declare enum ScriptType {
|
|
144
144
|
TestEnd = "nesi-test-end",
|
145
145
|
Unknown = "unknown"
|
146
146
|
}
|
147
|
-
|
147
|
+
type EdgePersonalizeComponentOptions = {
|
148
148
|
name: string;
|
149
149
|
count?: number;
|
150
150
|
};
|
151
|
-
|
151
|
+
type EdgeTestComponentOptions = {
|
152
152
|
name: string;
|
153
153
|
};
|
154
154
|
declare const EdgeNodeTagName = "nesitag";
|
155
155
|
|
156
|
-
|
156
|
+
type QuickConnectConfig = {
|
157
157
|
apiKey: string;
|
158
158
|
projectId: string;
|
159
159
|
apiHost?: string;
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import * as mitt from 'mitt';
|
2
|
-
import { c as components, e as external } from './v2-manifest.swagger-
|
2
|
+
import { c as components, e as external } from './v2-manifest.swagger-74a3dcac.js';
|
3
3
|
|
4
|
-
|
4
|
+
type Quirks = {
|
5
5
|
[key: string]: string;
|
6
6
|
};
|
7
|
-
|
7
|
+
type Tests = {
|
8
8
|
[key: string]: string;
|
9
9
|
};
|
10
|
-
|
10
|
+
type ScoreVector = {
|
11
11
|
[key: string]: number;
|
12
12
|
};
|
13
|
-
|
13
|
+
type EnrichmentData = {
|
14
14
|
/** Enrichment category name */
|
15
15
|
cat: string;
|
16
16
|
/** Enrichment key value */
|
@@ -19,11 +19,11 @@ declare type EnrichmentData = {
|
|
19
19
|
str: number;
|
20
20
|
};
|
21
21
|
/** An event that has occurred (i.e. an analytics track) which may trigger an Event signal */
|
22
|
-
|
22
|
+
type EventData = {
|
23
23
|
/** The event name that has been fired */
|
24
24
|
event: string;
|
25
25
|
};
|
26
|
-
|
26
|
+
type VisitorData = {
|
27
27
|
/**
|
28
28
|
* Quirk key-value data.
|
29
29
|
* NOTE: Context.quirks is more commonly correct if you need to read quirks data.
|
@@ -61,37 +61,37 @@ declare const emptyVisitorData: () => VisitorData;
|
|
61
61
|
/**
|
62
62
|
* Expresses a 'patch' to the Uniform Context state
|
63
63
|
*/
|
64
|
-
|
64
|
+
type ContextState = {
|
65
65
|
cookies: Record<string, string>;
|
66
66
|
url?: URL;
|
67
67
|
quirks: Quirks;
|
68
68
|
enrichments: EnrichmentData[];
|
69
69
|
events: EventData[];
|
70
70
|
};
|
71
|
-
|
71
|
+
type ContextStateUpdate = {
|
72
72
|
state: Partial<ContextState>;
|
73
73
|
previousState: Partial<ContextState>;
|
74
74
|
visitor: VisitorData;
|
75
75
|
scores: ScoreVector;
|
76
76
|
};
|
77
77
|
|
78
|
-
|
78
|
+
type StorageCommand<TID extends string = string, TData = unknown> = {
|
79
79
|
type: TID;
|
80
80
|
data: TData;
|
81
81
|
};
|
82
82
|
/** Commands that can be issued to alter the storage of Uniform Context data */
|
83
|
-
|
83
|
+
type StorageCommands = ModifyScoreCommand | ModifySessionScoreCommand | SetConsentCommand | SetQuirkCommand | SetTestCommand | IdentifyCommand | SetControlGroupCommand;
|
84
84
|
/**
|
85
85
|
* Changes the visitor's permanent score for a given dimension
|
86
86
|
*/
|
87
|
-
|
87
|
+
type ModifyScoreCommand = StorageCommand<'modscore', {
|
88
88
|
dimension: string;
|
89
89
|
delta: number;
|
90
90
|
}>;
|
91
91
|
/**
|
92
92
|
* Changes the visitor's session (time-based) score for a given dimension
|
93
93
|
*/
|
94
|
-
|
94
|
+
type ModifySessionScoreCommand = StorageCommand<'modscoreS', {
|
95
95
|
dimension: string;
|
96
96
|
delta: number;
|
97
97
|
}>;
|
@@ -100,14 +100,14 @@ declare type ModifySessionScoreCommand = StorageCommand<'modscoreS', {
|
|
100
100
|
* Setting consent to false will trigger deletion of any stored data for the visitor.
|
101
101
|
* Scores are still collected in-memory when consent is false; just not persisted.
|
102
102
|
*/
|
103
|
-
|
103
|
+
type SetConsentCommand = StorageCommand<'consent', boolean>;
|
104
104
|
/** Sets a permanent quirk key and value for the visitor */
|
105
|
-
|
105
|
+
type SetQuirkCommand = StorageCommand<'setquirk', {
|
106
106
|
key: string;
|
107
107
|
value: string;
|
108
108
|
}>;
|
109
109
|
/** Sets a specific variant as being this visitor's variant on an A/B test */
|
110
|
-
|
110
|
+
type SetTestCommand = StorageCommand<'settest', {
|
111
111
|
test: string;
|
112
112
|
variant: string;
|
113
113
|
}>;
|
@@ -116,7 +116,7 @@ declare type SetTestCommand = StorageCommand<'settest', {
|
|
116
116
|
* NOTE: this only has an effect when using an external cross-device transition storage system.
|
117
117
|
* NOTE: you cannot read the identified visitor ID back from the storage system once it is set.
|
118
118
|
*/
|
119
|
-
|
119
|
+
type IdentifyCommand = StorageCommand<'identify', {
|
120
120
|
identity: string;
|
121
121
|
}>;
|
122
122
|
/**
|
@@ -125,12 +125,12 @@ declare type IdentifyCommand = StorageCommand<'identify', {
|
|
125
125
|
* In most cases this should not be sent as the membership is computed automatically for visitors;
|
126
126
|
* this command is intended mostly for diagnostics and testing purposes.
|
127
127
|
*/
|
128
|
-
|
128
|
+
type SetControlGroupCommand = StorageCommand<'setcontrol', boolean>;
|
129
129
|
|
130
|
-
|
130
|
+
type TransitionDataStoreOptions = {
|
131
131
|
initialData?: Partial<VisitorData>;
|
132
132
|
};
|
133
|
-
|
133
|
+
type ServerToClientTransitionState = Pick<Partial<VisitorData>, 'quirks' | 'tests'> & {
|
134
134
|
/**
|
135
135
|
* Server Score Vector - the resultant scores _on the server side_ after the server/edge render completes
|
136
136
|
* Note that the client side does not trust these scores; they are only used until it's done with initial
|
@@ -139,7 +139,7 @@ declare type ServerToClientTransitionState = Pick<Partial<VisitorData>, 'quirks'
|
|
139
139
|
ssv?: ScoreVector;
|
140
140
|
};
|
141
141
|
declare const SERVER_STATE_ID = "__UNIFORM_DATA__";
|
142
|
-
|
142
|
+
type TransitionDataStoreEvents = {
|
143
143
|
/**
|
144
144
|
* Fired when the data is updated asynchronously
|
145
145
|
* (i.e. a promise resolves with new data from a backend)
|
@@ -203,7 +203,7 @@ declare abstract class TransitionDataStore {
|
|
203
203
|
getClientTransitionState(): ServerToClientTransitionState | undefined;
|
204
204
|
}
|
205
205
|
|
206
|
-
|
206
|
+
type DecayOptions = {
|
207
207
|
now: number;
|
208
208
|
lastUpd: number | undefined;
|
209
209
|
scores: ScoreVector;
|
@@ -217,9 +217,9 @@ declare type DecayOptions = {
|
|
217
217
|
*
|
218
218
|
* @returns true if any decay was applied, false otherwise
|
219
219
|
*/
|
220
|
-
|
220
|
+
type DecayFunction = (options: DecayOptions) => boolean;
|
221
221
|
|
222
|
-
|
222
|
+
type VisitorDataStoreOptions = {
|
223
223
|
/** Transition storage used to transfer server or edge side execution state to the client. Unused for client side only. */
|
224
224
|
transitionStore?: TransitionDataStore;
|
225
225
|
/** Duration of a 'visit' measured by this number of milliseconds without performing any updates */
|
@@ -246,7 +246,7 @@ declare type VisitorDataStoreOptions = {
|
|
246
246
|
/** Called when a log message is emitted from the data store */
|
247
247
|
onLogMessage?: (message: LogMessage) => void;
|
248
248
|
};
|
249
|
-
|
249
|
+
type VisitorDataStoreEvents = {
|
250
250
|
/**
|
251
251
|
* Fired when the stored data is updated.
|
252
252
|
* This is fired for any update, whether from integrated or transition storage.
|
@@ -320,18 +320,18 @@ declare class ManifestInstance {
|
|
320
320
|
getDimensionByKey(scoreKey: string): EnrichmentCategory | Signal | undefined;
|
321
321
|
}
|
322
322
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
323
|
+
type SharedTypes = external['uniform-context-types.swagger.yml']['components']['schemas'];
|
324
|
+
type ManifestV2 = components['schemas']['ManifestV2'];
|
325
|
+
type PersonalizationManifest = components['schemas']['PersonalizationManifest'];
|
326
|
+
type Signal = SharedTypes['Signal'];
|
327
|
+
type SignalCriteriaGroup = SharedTypes['SignalCriteriaGroup'];
|
328
|
+
type SignalCriteria = SharedTypes['SignalCriteria'];
|
329
|
+
type EnrichmentCategory = SharedTypes['EnrichmentCategory'];
|
330
|
+
type StringMatch = SharedTypes['StringMatch'];
|
331
|
+
type NumberMatch = SharedTypes['NumberMatch'];
|
332
|
+
type TestDefinition = SharedTypes['Test'];
|
333
|
+
type AggregateDimension = SharedTypes['AggregateDimension'];
|
334
|
+
type AggregateDimensionInput = SharedTypes['AggregateDimensionInput'];
|
335
335
|
|
336
336
|
declare class GroupCriteriaEvaluator {
|
337
337
|
#private;
|
@@ -342,7 +342,7 @@ declare class GroupCriteriaEvaluator {
|
|
342
342
|
/**
|
343
343
|
* The result of evaluating a signal criteria.
|
344
344
|
*/
|
345
|
-
|
345
|
+
type CriteriaEvaluatorResult = {
|
346
346
|
/** Whether the criteria evaluated to true or not */
|
347
347
|
result: boolean;
|
348
348
|
/**
|
@@ -352,7 +352,7 @@ declare type CriteriaEvaluatorResult = {
|
|
352
352
|
*/
|
353
353
|
changed: boolean;
|
354
354
|
};
|
355
|
-
|
355
|
+
type CriteriaEvaluatorParameters = {
|
356
356
|
/** The update being made to the Context state */
|
357
357
|
update: ContextStateUpdate;
|
358
358
|
/** Current criteria to evaluate the update against */
|
@@ -368,20 +368,20 @@ declare type CriteriaEvaluatorParameters = {
|
|
368
368
|
/** Function to emit log notices to the Context log */
|
369
369
|
onLogMessage?: (message: LogMessage) => void;
|
370
370
|
};
|
371
|
-
|
371
|
+
type SignalData = Signal & {
|
372
372
|
id: string;
|
373
373
|
};
|
374
374
|
/**
|
375
375
|
* A type that evaluates a signal criteria type and
|
376
376
|
* decides if it matches the current Context state or not.
|
377
377
|
*/
|
378
|
-
|
378
|
+
type CriteriaEvaluator = ((parameters: CriteriaEvaluatorParameters) => CriteriaEvaluatorResult) & {
|
379
379
|
/** If true the criteria will always execute even if a short-circuit would normally skip it */
|
380
380
|
alwaysExecute?: boolean;
|
381
381
|
};
|
382
382
|
|
383
383
|
/** Defines all error codes and their parameter(s) */
|
384
|
-
|
384
|
+
type LogMessages = {
|
385
385
|
/** Context constructed */
|
386
386
|
1: MessageFunc;
|
387
387
|
/** Context received data update */
|
@@ -465,10 +465,10 @@ declare type LogMessages = {
|
|
465
465
|
701: MessageFunc;
|
466
466
|
};
|
467
467
|
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
468
|
+
type Severity = 'debug' | 'info' | 'warn' | 'error';
|
469
|
+
type MessageCategory = 'context' | 'storage' | 'testing' | 'personalization' | 'gtag' | 'signals';
|
470
|
+
type OutputSeverity = Severity | 'none';
|
471
|
+
type MessageFunc<TArg = void> = (arg: TArg) => [
|
472
472
|
/** Category of the message */
|
473
473
|
MessageCategory,
|
474
474
|
/** Log message text */
|
@@ -476,16 +476,16 @@ declare type MessageFunc<TArg = void> = (arg: TArg) => [
|
|
476
476
|
/** Log message */
|
477
477
|
...unknown[]
|
478
478
|
];
|
479
|
-
|
480
|
-
|
479
|
+
type LogMessage = LogMessageSingle | LogMessageGroup;
|
480
|
+
type LogMessageSingle<TID extends keyof LogMessages = keyof LogMessages> = [
|
481
481
|
severity: Severity,
|
482
482
|
id: TID,
|
483
483
|
...args: Parameters<LogMessages[TID]>
|
484
484
|
];
|
485
|
-
|
486
|
-
|
485
|
+
type LogMessageGroup<TID extends keyof LogMessages = keyof LogMessages> = [severity: Severity, id: TID, group: 'GROUP', ...args: Parameters<LogMessages[TID]>] | [severity: Severity, id: TID, group: 'ENDGROUP'];
|
486
|
+
type LogDrain = (message: LogMessage) => void;
|
487
487
|
|
488
|
-
|
488
|
+
type VariantMatchCriteria = {
|
489
489
|
/**
|
490
490
|
* Operation for match criteria
|
491
491
|
*
|
@@ -498,7 +498,7 @@ declare type VariantMatchCriteria = {
|
|
498
498
|
*/
|
499
499
|
name?: string;
|
500
500
|
};
|
501
|
-
|
501
|
+
type DimensionMatch = {
|
502
502
|
/**
|
503
503
|
* Left hand side of the match expression (name of dimension in score vector)
|
504
504
|
* NOTE: if the dimension is not present in the score vector, it will be treated as if it has a value of 0
|
@@ -537,25 +537,25 @@ declare type DimensionMatch = {
|
|
537
537
|
};
|
538
538
|
|
539
539
|
/** Content that is tagged for adding enrichment score when triggered by behavior (i.e. being shown that content) */
|
540
|
-
|
540
|
+
type BehaviorTag = {
|
541
541
|
beh?: EnrichmentData[];
|
542
542
|
};
|
543
543
|
/** Defines the shape of a personalized content variant */
|
544
|
-
|
544
|
+
type PersonalizedVariant = {
|
545
545
|
/** A unique identifier for this variation */
|
546
546
|
id: string;
|
547
547
|
/** Match criteria for this variation */
|
548
548
|
pz?: VariantMatchCriteria;
|
549
549
|
};
|
550
550
|
/** The result of computing personalized content from variations */
|
551
|
-
|
551
|
+
type PersonalizedResult<TVariant> = {
|
552
552
|
/** Whether or not this result contains a personalized result */
|
553
553
|
personalized: boolean;
|
554
554
|
/** Matching variations */
|
555
555
|
variations: Array<TVariant>;
|
556
556
|
};
|
557
557
|
/** Defines the shape of a A/B test variant */
|
558
|
-
|
558
|
+
type TestVariant = {
|
559
559
|
/** The identifier for this variant. This value persisted to storage when a variant is selected. */
|
560
560
|
id: string;
|
561
561
|
/**
|
@@ -565,7 +565,7 @@ declare type TestVariant = {
|
|
565
565
|
testDistribution?: number;
|
566
566
|
};
|
567
567
|
/** The result of computing an A/B test result */
|
568
|
-
|
568
|
+
type TestResult<TVariant> = {
|
569
569
|
/** The selected variation */
|
570
570
|
result: TVariant | undefined;
|
571
571
|
/**
|
@@ -576,7 +576,7 @@ declare type TestResult<TVariant> = {
|
|
576
576
|
variantAssigned: boolean;
|
577
577
|
};
|
578
578
|
|
579
|
-
|
579
|
+
type PersonalizeOptions<TVariant> = {
|
580
580
|
/** Name of placement (sent to analytics) */
|
581
581
|
name: string;
|
582
582
|
/** Possible variants to place */
|
@@ -589,7 +589,7 @@ declare function personalizeVariations<TVariant extends PersonalizedVariant>({ n
|
|
589
589
|
context: Context;
|
590
590
|
}): PersonalizedResult<TVariant>;
|
591
591
|
|
592
|
-
|
592
|
+
type TestOptions<TVariant extends TestVariant> = {
|
593
593
|
/** The name of the test that is being run, must be included in the manifest. */
|
594
594
|
name: string;
|
595
595
|
/** Variations that are being tested. */
|
@@ -605,11 +605,11 @@ declare const testVariations: <TVariant extends TestVariant>({ name, context, va
|
|
605
605
|
* The plugin should attach event handlers in its creation function.
|
606
606
|
* @returns A function that detaches any event handlers when called
|
607
607
|
*/
|
608
|
-
|
608
|
+
type ContextPlugin = {
|
609
609
|
logDrain?: LogDrain;
|
610
610
|
init?: (context: Context) => () => void;
|
611
611
|
};
|
612
|
-
|
612
|
+
type ContextOptions = {
|
613
613
|
/** The Context Manifest to load (from the Context API) */
|
614
614
|
manifest: ManifestV2;
|
615
615
|
/**
|
@@ -622,7 +622,7 @@ declare type ContextOptions = {
|
|
622
622
|
plugins?: Array<ContextPlugin>;
|
623
623
|
} & Omit<VisitorDataStoreOptions, 'manifest' | 'onServerTransitionScoresReceived'>;
|
624
624
|
/** Emitted when a personalization runs */
|
625
|
-
|
625
|
+
type PersonalizationEvent = {
|
626
626
|
/** Name of the personalized placement */
|
627
627
|
name: string;
|
628
628
|
/** Selected variant ID(s) */
|
@@ -637,7 +637,7 @@ declare type PersonalizationEvent = {
|
|
637
637
|
changed: boolean;
|
638
638
|
};
|
639
639
|
/** Emitted event when an A/B test runs */
|
640
|
-
|
640
|
+
type TestEvent = {
|
641
641
|
/** Name (public ID) of the A/B test */
|
642
642
|
name: string;
|
643
643
|
/** ID of the variant that was selected */
|
@@ -649,7 +649,7 @@ declare type TestEvent = {
|
|
649
649
|
*/
|
650
650
|
variantAssigned: boolean;
|
651
651
|
};
|
652
|
-
|
652
|
+
type ContextEvents = {
|
653
653
|
/**
|
654
654
|
* Fired when the scores are updated.
|
655
655
|
* The event is NOT fired if an update does not result in any score changes.
|
@@ -735,11 +735,11 @@ declare class Context implements Context {
|
|
735
735
|
* 1: Uniform Optimize.
|
736
736
|
* 2: Uniform Context.
|
737
737
|
*/
|
738
|
-
|
738
|
+
type DevToolsUiVersion = 1 | 2;
|
739
739
|
/**
|
740
740
|
* The data state provided to the devtools for rendering.
|
741
741
|
*/
|
742
|
-
|
742
|
+
type DevToolsState = {
|
743
743
|
/** Current computed visitor scores (includes aggregates) */
|
744
744
|
scores: Readonly<ScoreVector>;
|
745
745
|
/** Current visitor data (includes quirks, raw scores, tests, consent, etc) */
|
@@ -752,7 +752,7 @@ declare type DevToolsState = {
|
|
752
752
|
manifest: ManifestV2;
|
753
753
|
};
|
754
754
|
/** Mutations the DevTools can take on the data it receives */
|
755
|
-
|
755
|
+
type DevToolsActions = {
|
756
756
|
/** Standard updates; maps to Context.update() */
|
757
757
|
update: (newData: Partial<ContextState>) => Promise<void>;
|
758
758
|
/** Raw updates to the storage subsystem. Maps to Context.storage.updateData() */
|
@@ -760,33 +760,33 @@ declare type DevToolsActions = {
|
|
760
760
|
/** Forget the current visitor and clear data on this device */
|
761
761
|
forget: () => Promise<void>;
|
762
762
|
};
|
763
|
-
|
763
|
+
type DevToolsEvent<Type extends string = string, TEventData = unknown> = {
|
764
764
|
/** The integration ID that is required */
|
765
765
|
type: Type;
|
766
766
|
} & TEventData;
|
767
|
-
|
767
|
+
type DevToolsEvents = DevToolsLogEvent | DevToolsDataEvent | DevToolsHelloEvent | DevToolsUpdateEvent | DevToolsRawCommandsEvent | DevToolsForgetEvent;
|
768
768
|
/** A log message emitted as an event to the browser extension */
|
769
|
-
|
769
|
+
type DevToolsLogEvent = DevToolsEvent<'uniform:context:log', {
|
770
770
|
message: LogMessage;
|
771
771
|
}>;
|
772
772
|
/** Emitted when data is updated in Context to the devtools */
|
773
|
-
|
773
|
+
type DevToolsDataEvent = DevToolsEvent<'uniform:context:data', {
|
774
774
|
data: DevToolsState;
|
775
775
|
}>;
|
776
776
|
/** A hello message emitted as an event from the browser extension to test if the page contains Context */
|
777
|
-
|
777
|
+
type DevToolsHelloEvent = DevToolsEvent<'uniform:context:hello', {
|
778
778
|
uiVersion: DevToolsUiVersion;
|
779
779
|
}>;
|
780
780
|
/** Devtools requests a normal update cycle (regular data update, re-eval signals, etc) */
|
781
|
-
|
781
|
+
type DevToolsUpdateEvent = DevToolsEvent<'uniform-in:context:update', {
|
782
782
|
newData: Partial<ContextState>;
|
783
783
|
}>;
|
784
784
|
/** Devtools requests a raw update cycle (explicitly set scores of dimensions in durations, etc) */
|
785
|
-
|
785
|
+
type DevToolsRawCommandsEvent = DevToolsEvent<'uniform-in:context:commands', {
|
786
786
|
commands: StorageCommands[];
|
787
787
|
}>;
|
788
788
|
/** A request to forget me from the DevTools */
|
789
|
-
|
789
|
+
type DevToolsForgetEvent = DevToolsEvent<'uniform-in:context:forget', unknown>;
|
790
790
|
declare global {
|
791
791
|
interface Window {
|
792
792
|
/** Window var set by enableContextDevTools() to enable embedded devtools to receive Context instance and attach events to it. */
|
File without changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/context",
|
3
|
-
"version": "17.
|
3
|
+
"version": "17.7.1-alpha.140+80ab6baf9",
|
4
4
|
"description": "Uniform Context core package",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -58,8 +58,8 @@
|
|
58
58
|
},
|
59
59
|
"devDependencies": {
|
60
60
|
"@types/js-cookie": "3.0.2",
|
61
|
-
"@types/yargs": "17.0.
|
62
|
-
"@uniformdev/cli": "^17.
|
61
|
+
"@types/yargs": "17.0.19",
|
62
|
+
"@uniformdev/cli": "^17.7.1-alpha.140+80ab6baf9",
|
63
63
|
"benny": "3.7.1",
|
64
64
|
"yargs": "17.6.2"
|
65
65
|
},
|
@@ -76,5 +76,5 @@
|
|
76
76
|
"publishConfig": {
|
77
77
|
"access": "public"
|
78
78
|
},
|
79
|
-
"gitHead": "
|
79
|
+
"gitHead": "80ab6baf9edea6b520738bd3dff5c6afc882bf77"
|
80
80
|
}
|