@contentful/optimization-api-schemas 0.1.0-alpha
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/LICENSE +21 -0
- package/README.md +127 -0
- package/dist/contentful/AudienceEntry.d.ts +73 -0
- package/dist/contentful/AudienceEntry.d.ts.map +1 -0
- package/dist/contentful/AudienceEntry.js +41 -0
- package/dist/contentful/AudienceEntry.js.map +1 -0
- package/dist/contentful/CtflEntry.d.ts +206 -0
- package/dist/contentful/CtflEntry.d.ts.map +1 -0
- package/dist/contentful/CtflEntry.js +122 -0
- package/dist/contentful/CtflEntry.js.map +1 -0
- package/dist/contentful/MergeTagEntry.d.ts +68 -0
- package/dist/contentful/MergeTagEntry.d.ts.map +1 -0
- package/dist/contentful/MergeTagEntry.js +38 -0
- package/dist/contentful/MergeTagEntry.js.map +1 -0
- package/dist/contentful/PersonalizationConfig.d.ts +437 -0
- package/dist/contentful/PersonalizationConfig.d.ts.map +1 -0
- package/dist/contentful/PersonalizationConfig.js +164 -0
- package/dist/contentful/PersonalizationConfig.js.map +1 -0
- package/dist/contentful/PersonalizationEntry.d.ts +541 -0
- package/dist/contentful/PersonalizationEntry.d.ts.map +1 -0
- package/dist/contentful/PersonalizationEntry.js +95 -0
- package/dist/contentful/PersonalizationEntry.js.map +1 -0
- package/dist/contentful/PersonalizedEntry.d.ts +244 -0
- package/dist/contentful/PersonalizedEntry.d.ts.map +1 -0
- package/dist/contentful/PersonalizedEntry.js +27 -0
- package/dist/contentful/PersonalizedEntry.js.map +1 -0
- package/dist/contentful/index.d.ts +7 -0
- package/dist/contentful/index.d.ts.map +1 -0
- package/dist/contentful/index.js +7 -0
- package/dist/contentful/index.js.map +1 -0
- package/dist/experience/BatchExperienceResponse.d.ts +110 -0
- package/dist/experience/BatchExperienceResponse.d.ts.map +1 -0
- package/dist/experience/BatchExperienceResponse.js +25 -0
- package/dist/experience/BatchExperienceResponse.js.map +1 -0
- package/dist/experience/ExperienceRequest.d.ts +440 -0
- package/dist/experience/ExperienceRequest.d.ts.map +1 -0
- package/dist/experience/ExperienceRequest.js +36 -0
- package/dist/experience/ExperienceRequest.js.map +1 -0
- package/dist/experience/ExperienceResponse.d.ts +173 -0
- package/dist/experience/ExperienceResponse.d.ts.map +1 -0
- package/dist/experience/ExperienceResponse.js +38 -0
- package/dist/experience/ExperienceResponse.js.map +1 -0
- package/dist/experience/ResponseEnvelope.d.ts +35 -0
- package/dist/experience/ResponseEnvelope.d.ts.map +1 -0
- package/dist/experience/ResponseEnvelope.js +31 -0
- package/dist/experience/ResponseEnvelope.js.map +1 -0
- package/dist/experience/change/Change.d.ts +138 -0
- package/dist/experience/change/Change.d.ts.map +1 -0
- package/dist/experience/change/Change.js +102 -0
- package/dist/experience/change/Change.js.map +1 -0
- package/dist/experience/change/index.d.ts +2 -0
- package/dist/experience/change/index.d.ts.map +1 -0
- package/dist/experience/change/index.js +2 -0
- package/dist/experience/change/index.js.map +1 -0
- package/dist/experience/event/AliasEvent.d.ts +73 -0
- package/dist/experience/event/AliasEvent.d.ts.map +1 -0
- package/dist/experience/event/AliasEvent.js +20 -0
- package/dist/experience/event/AliasEvent.js.map +1 -0
- package/dist/experience/event/BatchExperienceEvent.d.ts +820 -0
- package/dist/experience/event/BatchExperienceEvent.d.ts.map +1 -0
- package/dist/experience/event/BatchExperienceEvent.js +37 -0
- package/dist/experience/event/BatchExperienceEvent.js.map +1 -0
- package/dist/experience/event/ComponentViewEvent.d.ts +75 -0
- package/dist/experience/event/ComponentViewEvent.d.ts.map +1 -0
- package/dist/experience/event/ComponentViewEvent.js +43 -0
- package/dist/experience/event/ComponentViewEvent.js.map +1 -0
- package/dist/experience/event/ExperienceEvent.d.ts +810 -0
- package/dist/experience/event/ExperienceEvent.d.ts.map +1 -0
- package/dist/experience/event/ExperienceEvent.js +29 -0
- package/dist/experience/event/ExperienceEvent.js.map +1 -0
- package/dist/experience/event/GroupEvent.d.ts +73 -0
- package/dist/experience/event/GroupEvent.d.ts.map +1 -0
- package/dist/experience/event/GroupEvent.js +20 -0
- package/dist/experience/event/GroupEvent.js.map +1 -0
- package/dist/experience/event/IdentifyEvent.d.ts +71 -0
- package/dist/experience/event/IdentifyEvent.d.ts.map +1 -0
- package/dist/experience/event/IdentifyEvent.js +24 -0
- package/dist/experience/event/IdentifyEvent.js.map +1 -0
- package/dist/experience/event/PageViewEvent.d.ts +128 -0
- package/dist/experience/event/PageViewEvent.d.ts.map +1 -0
- package/dist/experience/event/PageViewEvent.js +44 -0
- package/dist/experience/event/PageViewEvent.js.map +1 -0
- package/dist/experience/event/ScreenViewEvent.d.ts +111 -0
- package/dist/experience/event/ScreenViewEvent.d.ts.map +1 -0
- package/dist/experience/event/ScreenViewEvent.js +43 -0
- package/dist/experience/event/ScreenViewEvent.js.map +1 -0
- package/dist/experience/event/TrackEvent.d.ts +73 -0
- package/dist/experience/event/TrackEvent.d.ts.map +1 -0
- package/dist/experience/event/TrackEvent.js +27 -0
- package/dist/experience/event/TrackEvent.js.map +1 -0
- package/dist/experience/event/UniversalEventProperties.d.ts +175 -0
- package/dist/experience/event/UniversalEventProperties.d.ts.map +1 -0
- package/dist/experience/event/UniversalEventProperties.js +100 -0
- package/dist/experience/event/UniversalEventProperties.js.map +1 -0
- package/dist/experience/event/index.d.ts +12 -0
- package/dist/experience/event/index.d.ts.map +1 -0
- package/dist/experience/event/index.js +12 -0
- package/dist/experience/event/index.js.map +1 -0
- package/dist/experience/event/properties/App.d.ts +25 -0
- package/dist/experience/event/properties/App.d.ts.map +1 -0
- package/dist/experience/event/properties/App.js +21 -0
- package/dist/experience/event/properties/App.js.map +1 -0
- package/dist/experience/event/properties/Campaign.d.ts +34 -0
- package/dist/experience/event/properties/Campaign.d.ts.map +1 -0
- package/dist/experience/event/properties/Campaign.js +30 -0
- package/dist/experience/event/properties/Campaign.js.map +1 -0
- package/dist/experience/event/properties/Channel.d.ts +17 -0
- package/dist/experience/event/properties/Channel.d.ts.map +1 -0
- package/dist/experience/event/properties/Channel.js +13 -0
- package/dist/experience/event/properties/Channel.js.map +1 -0
- package/dist/experience/event/properties/Dictionary.d.ts +13 -0
- package/dist/experience/event/properties/Dictionary.d.ts.map +1 -0
- package/dist/experience/event/properties/Dictionary.js +9 -0
- package/dist/experience/event/properties/Dictionary.js.map +1 -0
- package/dist/experience/event/properties/GeoLocation.d.ts +66 -0
- package/dist/experience/event/properties/GeoLocation.d.ts.map +1 -0
- package/dist/experience/event/properties/GeoLocation.js +76 -0
- package/dist/experience/event/properties/GeoLocation.js.map +1 -0
- package/dist/experience/event/properties/Library.d.ts +22 -0
- package/dist/experience/event/properties/Library.d.ts.map +1 -0
- package/dist/experience/event/properties/Library.js +18 -0
- package/dist/experience/event/properties/Library.js.map +1 -0
- package/dist/experience/event/properties/Page.d.ts +39 -0
- package/dist/experience/event/properties/Page.d.ts.map +1 -0
- package/dist/experience/event/properties/Page.js +36 -0
- package/dist/experience/event/properties/Page.js.map +1 -0
- package/dist/experience/event/properties/Properties.d.ts +13 -0
- package/dist/experience/event/properties/Properties.d.ts.map +1 -0
- package/dist/experience/event/properties/Properties.js +9 -0
- package/dist/experience/event/properties/Properties.js.map +1 -0
- package/dist/experience/event/properties/Screen.d.ts +19 -0
- package/dist/experience/event/properties/Screen.d.ts.map +1 -0
- package/dist/experience/event/properties/Screen.js +15 -0
- package/dist/experience/event/properties/Screen.js.map +1 -0
- package/dist/experience/event/properties/Traits.d.ts +14 -0
- package/dist/experience/event/properties/Traits.d.ts.map +1 -0
- package/dist/experience/event/properties/Traits.js +10 -0
- package/dist/experience/event/properties/Traits.js.map +1 -0
- package/dist/experience/event/properties/index.d.ts +11 -0
- package/dist/experience/event/properties/index.d.ts.map +1 -0
- package/dist/experience/event/properties/index.js +11 -0
- package/dist/experience/event/properties/index.js.map +1 -0
- package/dist/experience/index.d.ts +8 -0
- package/dist/experience/index.d.ts.map +1 -0
- package/dist/experience/index.js +8 -0
- package/dist/experience/index.js.map +1 -0
- package/dist/experience/personalization/SelectedPersonalization.d.ts +86 -0
- package/dist/experience/personalization/SelectedPersonalization.d.ts.map +1 -0
- package/dist/experience/personalization/SelectedPersonalization.js +48 -0
- package/dist/experience/personalization/SelectedPersonalization.js.map +1 -0
- package/dist/experience/personalization/index.d.ts +2 -0
- package/dist/experience/personalization/index.d.ts.map +1 -0
- package/dist/experience/personalization/index.js +2 -0
- package/dist/experience/personalization/index.js.map +1 -0
- package/dist/experience/profile/Profile.d.ts +104 -0
- package/dist/experience/profile/Profile.d.ts.map +1 -0
- package/dist/experience/profile/Profile.js +72 -0
- package/dist/experience/profile/Profile.js.map +1 -0
- package/dist/experience/profile/index.d.ts +3 -0
- package/dist/experience/profile/index.d.ts.map +1 -0
- package/dist/experience/profile/index.js +3 -0
- package/dist/experience/profile/index.js.map +1 -0
- package/dist/experience/profile/properties/SessionStatistics.d.ts +60 -0
- package/dist/experience/profile/properties/SessionStatistics.d.ts.map +1 -0
- package/dist/experience/profile/properties/SessionStatistics.js +50 -0
- package/dist/experience/profile/properties/SessionStatistics.js.map +1 -0
- package/dist/experience/profile/properties/index.d.ts +2 -0
- package/dist/experience/profile/properties/index.d.ts.map +1 -0
- package/dist/experience/profile/properties/index.js +2 -0
- package/dist/experience/profile/properties/index.js.map +1 -0
- package/dist/index.cjs +684 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +425 -0
- package/dist/index.mjs.map +1 -0
- package/dist/insights/event/BatchInsightsEvent.d.ts +173 -0
- package/dist/insights/event/BatchInsightsEvent.d.ts.map +1 -0
- package/dist/insights/event/BatchInsightsEvent.js +32 -0
- package/dist/insights/event/BatchInsightsEvent.js.map +1 -0
- package/dist/insights/event/InsightsEvent.d.ts +145 -0
- package/dist/insights/event/InsightsEvent.d.ts.map +1 -0
- package/dist/insights/event/InsightsEvent.js +16 -0
- package/dist/insights/event/InsightsEvent.js.map +1 -0
- package/dist/insights/event/index.d.ts +3 -0
- package/dist/insights/event/index.d.ts.map +1 -0
- package/dist/insights/event/index.js +3 -0
- package/dist/insights/event/index.js.map +1 -0
- package/dist/insights/index.d.ts +2 -0
- package/dist/insights/index.d.ts.map +1 -0
- package/dist/insights/index.js +2 -0
- package/dist/insights/index.js.map +1 -0
- package/package.json +25 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { ChangeArray } from './change';
|
|
3
|
+
import { SelectedPersonalizationArray } from './personalization';
|
|
4
|
+
import { Profile } from './profile';
|
|
5
|
+
import { ResponseEnvelope } from './ResponseEnvelope';
|
|
6
|
+
/**
|
|
7
|
+
* Zod schema describing the `data` payload of a standard Experience API response.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Contains the evaluated profile, selected personalizations, and computed
|
|
11
|
+
* changes that should be applied on the client.
|
|
12
|
+
*/
|
|
13
|
+
export const ExperienceData = z.object({
|
|
14
|
+
/**
|
|
15
|
+
* Profile associated with the evaluated events.
|
|
16
|
+
*/
|
|
17
|
+
profile: Profile,
|
|
18
|
+
/**
|
|
19
|
+
* Selected experiences and variants for the profile.
|
|
20
|
+
*
|
|
21
|
+
* @see {@link SelectedPersonalizationArray}
|
|
22
|
+
*/
|
|
23
|
+
experiences: SelectedPersonalizationArray,
|
|
24
|
+
/**
|
|
25
|
+
* Currently used for Custom Flags.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link ChangeArray}
|
|
28
|
+
*/
|
|
29
|
+
changes: ChangeArray,
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Zod schema describing a full Experience API response.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Extends {@link ResponseEnvelope} with {@link ExperienceData} as the `data` payload.
|
|
36
|
+
*/
|
|
37
|
+
export const ExperienceResponse = z.extend(ResponseEnvelope, { data: ExperienceData });
|
|
38
|
+
//# sourceMappingURL=ExperienceResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExperienceResponse.js","sourceRoot":"","sources":["../../src/experience/ExperienceResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC;;OAEG;IACH,OAAO,EAAE,OAAO;IAEhB;;;;OAIG;IACH,WAAW,EAAE,4BAA4B;IAEzC;;;;OAIG;IACH,OAAO,EAAE,WAAW;CACrB,CAAC,CAAA;AAOF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema describing the common envelope structure of responses
|
|
4
|
+
* from the Experience API.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Concrete responses extend this schema and refine the `data` property
|
|
8
|
+
* to a more specific shape.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ResponseEnvelope: z.ZodMiniObject<{
|
|
11
|
+
/**
|
|
12
|
+
* Response payload.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* The base schema uses an empty object; specific responses extend this
|
|
16
|
+
* with more detailed structures.
|
|
17
|
+
*/
|
|
18
|
+
data: z.ZodMiniObject<Record<never, z.core.SomeType>, z.core.$strip>;
|
|
19
|
+
/**
|
|
20
|
+
* Human-readable message accompanying the response.
|
|
21
|
+
*/
|
|
22
|
+
message: z.ZodMiniString<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Indicates whether an error occurred.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* May be `null` when the error state is unknown or not applicable.
|
|
28
|
+
*/
|
|
29
|
+
error: z.ZodMiniNullable<z.ZodMiniBoolean<boolean>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
/**
|
|
32
|
+
* TypeScript type inferred from {@link ResponseEnvelope}.
|
|
33
|
+
*/
|
|
34
|
+
export type ResponseEnvelope = z.infer<typeof ResponseEnvelope>;
|
|
35
|
+
//# sourceMappingURL=ResponseEnvelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseEnvelope.d.ts","sourceRoot":"","sources":["../../src/experience/ResponseEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;;;;OAMG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;iBAEH,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema describing the common envelope structure of responses
|
|
4
|
+
* from the Experience API.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Concrete responses extend this schema and refine the `data` property
|
|
8
|
+
* to a more specific shape.
|
|
9
|
+
*/
|
|
10
|
+
export const ResponseEnvelope = z.object({
|
|
11
|
+
/**
|
|
12
|
+
* Response payload.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* The base schema uses an empty object; specific responses extend this
|
|
16
|
+
* with more detailed structures.
|
|
17
|
+
*/
|
|
18
|
+
data: z.object(),
|
|
19
|
+
/**
|
|
20
|
+
* Human-readable message accompanying the response.
|
|
21
|
+
*/
|
|
22
|
+
message: z.string(),
|
|
23
|
+
/**
|
|
24
|
+
* Indicates whether an error occurred.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* May be `null` when the error state is unknown or not applicable.
|
|
28
|
+
*/
|
|
29
|
+
error: z.nullable(z.boolean()),
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=ResponseEnvelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseEnvelope.js","sourceRoot":"","sources":["../../src/experience/ResponseEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC;;;;;;OAMG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAEhB;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IAEnB;;;;;OAKG;IACH,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;CAC/B,CAAC,CAAA"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Enumeration of supported change types.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Currently only the `'Variable'` change type is supported, but the union
|
|
7
|
+
* in {@link ChangeBase} allows for additional types to be introduced.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ChangeType: readonly ["Variable"];
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for the allowed value types of a variable change.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Supports primitives and JSON objects keyed by strings.
|
|
15
|
+
*/
|
|
16
|
+
export declare const VariableChangeValue: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
17
|
+
/**
|
|
18
|
+
* Zod schema representing an unknown change type.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This can be used to handle forward-compatible change payloads where
|
|
22
|
+
* the `type` is not recognized.
|
|
23
|
+
*/
|
|
24
|
+
export declare const UnknownChange: z.ZodMiniObject<{
|
|
25
|
+
key: z.ZodMiniString<string>;
|
|
26
|
+
meta: z.ZodMiniObject<{
|
|
27
|
+
/**
|
|
28
|
+
* Identifier of the personalization or experiment experience.
|
|
29
|
+
*/
|
|
30
|
+
experienceId: z.ZodMiniString<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Index of the variant within the experience configuration.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
36
|
+
*/
|
|
37
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
type: z.ZodMiniString<string>;
|
|
40
|
+
value: z.ZodMiniUnknown;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
/**
|
|
43
|
+
* TypeScript type inferred from {@link UnknownChange}.
|
|
44
|
+
*/
|
|
45
|
+
export type UnknownChange = z.infer<typeof UnknownChange>;
|
|
46
|
+
/**
|
|
47
|
+
* Zod schema representing a change whose type is `'Variable'`.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* The `value` must conform to {@link VariableChangeValue}.
|
|
51
|
+
*/
|
|
52
|
+
export declare const VariableChange: z.ZodMiniObject<{
|
|
53
|
+
key: z.ZodMiniString<string>;
|
|
54
|
+
meta: z.ZodMiniObject<{
|
|
55
|
+
/**
|
|
56
|
+
* Identifier of the personalization or experiment experience.
|
|
57
|
+
*/
|
|
58
|
+
experienceId: z.ZodMiniString<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Index of the variant within the experience configuration.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
64
|
+
*/
|
|
65
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
type: z.ZodMiniLiteral<"Variable">;
|
|
68
|
+
value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
/**
|
|
71
|
+
* TypeScript type inferred from {@link VariableChange}.
|
|
72
|
+
*/
|
|
73
|
+
export type VariableChange = z.infer<typeof VariableChange>;
|
|
74
|
+
/**
|
|
75
|
+
* JSON value type inferred from {@link z.json}.
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Represents any JSON-serializable value.
|
|
79
|
+
*/
|
|
80
|
+
export type Json = z.infer<typeof z.json>;
|
|
81
|
+
/**
|
|
82
|
+
* Map of Custom Flag keys to JSON values.
|
|
83
|
+
*/
|
|
84
|
+
export type Flags = Record<string, Json>;
|
|
85
|
+
/**
|
|
86
|
+
* Union of supported change types.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* Currently only {@link VariableChange} is included.
|
|
90
|
+
*/
|
|
91
|
+
export declare const Change: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
92
|
+
key: z.ZodMiniString<string>;
|
|
93
|
+
meta: z.ZodMiniObject<{
|
|
94
|
+
/**
|
|
95
|
+
* Identifier of the personalization or experiment experience.
|
|
96
|
+
*/
|
|
97
|
+
experienceId: z.ZodMiniString<string>;
|
|
98
|
+
/**
|
|
99
|
+
* Index of the variant within the experience configuration.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
103
|
+
*/
|
|
104
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
type: z.ZodMiniLiteral<"Variable">;
|
|
107
|
+
value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
108
|
+
}, z.core.$strip>], "type">;
|
|
109
|
+
/**
|
|
110
|
+
* TypeScript type inferred from {@link Change}.
|
|
111
|
+
*/
|
|
112
|
+
export type Change = z.infer<typeof Change>;
|
|
113
|
+
/**
|
|
114
|
+
* Zod schema representing an array of {@link Change} items.
|
|
115
|
+
*/
|
|
116
|
+
export declare const ChangeArray: z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
117
|
+
key: z.ZodMiniString<string>;
|
|
118
|
+
meta: z.ZodMiniObject<{
|
|
119
|
+
/**
|
|
120
|
+
* Identifier of the personalization or experiment experience.
|
|
121
|
+
*/
|
|
122
|
+
experienceId: z.ZodMiniString<string>;
|
|
123
|
+
/**
|
|
124
|
+
* Index of the variant within the experience configuration.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
128
|
+
*/
|
|
129
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
type: z.ZodMiniLiteral<"Variable">;
|
|
132
|
+
value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
133
|
+
}, z.core.$strip>], "type">>;
|
|
134
|
+
/**
|
|
135
|
+
* TypeScript type inferred from {@link ChangeArray}.
|
|
136
|
+
*/
|
|
137
|
+
export type ChangeArray = z.infer<typeof ChangeArray>;
|
|
138
|
+
//# sourceMappingURL=Change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Change.d.ts","sourceRoot":"","sources":["../../../src/experience/change/Change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,uBAAwB,CAAA;AAyC/C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sLAM9B,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;QApCtB;;WAEG;;QAGH;;;;;WAKG;;;;;iBAoCL,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;QA3DvB;;WAEG;;QAGH;;;;;WAKG;;;;;iBA2DL,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;AAEzC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAExC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;QA/Ff;;WAEG;;QAGH;;;;;WAKG;;;;;2BAqF6D,CAAA;AAEpE;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,WAAW;;;QAzGpB;;WAEG;;QAGH;;;;;WAKG;;;;;4BA+FmC,CAAA;AAE1C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Enumeration of supported change types.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Currently only the `'Variable'` change type is supported, but the union
|
|
7
|
+
* in {@link ChangeBase} allows for additional types to be introduced.
|
|
8
|
+
*/
|
|
9
|
+
export const ChangeType = ['Variable'];
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema describing the base shape for a change.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This base is extended by specific change types such as {@link VariableChange}.
|
|
15
|
+
*/
|
|
16
|
+
const ChangeBase = z.object({
|
|
17
|
+
/**
|
|
18
|
+
* Key identifying the subject of the change.
|
|
19
|
+
*/
|
|
20
|
+
key: z.string(),
|
|
21
|
+
/**
|
|
22
|
+
* Discriminator for the change type.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* May be one of {@link ChangeType} or an arbitrary string for unknown types.
|
|
26
|
+
*/
|
|
27
|
+
type: z.union([z.enum(ChangeType), z.string()]),
|
|
28
|
+
/**
|
|
29
|
+
* Metadata describing the originating experience and variant index.
|
|
30
|
+
*/
|
|
31
|
+
meta: z.object({
|
|
32
|
+
/**
|
|
33
|
+
* Identifier of the personalization or experiment experience.
|
|
34
|
+
*/
|
|
35
|
+
experienceId: z.string(),
|
|
36
|
+
/**
|
|
37
|
+
* Index of the variant within the experience configuration.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
41
|
+
*/
|
|
42
|
+
variantIndex: z.number(),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Zod schema for the allowed value types of a variable change.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* Supports primitives and JSON objects keyed by strings.
|
|
50
|
+
*/
|
|
51
|
+
export const VariableChangeValue = z.union([
|
|
52
|
+
z.string(),
|
|
53
|
+
z.boolean(),
|
|
54
|
+
z.null(),
|
|
55
|
+
z.number(),
|
|
56
|
+
z.record(z.string(), z.json()),
|
|
57
|
+
]);
|
|
58
|
+
/**
|
|
59
|
+
* Zod schema representing an unknown change type.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* This can be used to handle forward-compatible change payloads where
|
|
63
|
+
* the `type` is not recognized.
|
|
64
|
+
*/
|
|
65
|
+
export const UnknownChange = z.extend(ChangeBase, {
|
|
66
|
+
/**
|
|
67
|
+
* Unconstrained change type string.
|
|
68
|
+
*/
|
|
69
|
+
type: z.string(),
|
|
70
|
+
/**
|
|
71
|
+
* Payload for the change value, with unknown structure.
|
|
72
|
+
*/
|
|
73
|
+
value: z.unknown(),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Zod schema representing a change whose type is `'Variable'`.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* The `value` must conform to {@link VariableChangeValue}.
|
|
80
|
+
*/
|
|
81
|
+
export const VariableChange = z.extend(ChangeBase, {
|
|
82
|
+
/**
|
|
83
|
+
* Discriminator for a variable change.
|
|
84
|
+
*/
|
|
85
|
+
type: z.literal('Variable'),
|
|
86
|
+
/**
|
|
87
|
+
* New value for the variable identified by {@link ChangeBase.key}.
|
|
88
|
+
*/
|
|
89
|
+
value: VariableChangeValue,
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* Union of supported change types.
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Currently only {@link VariableChange} is included.
|
|
96
|
+
*/
|
|
97
|
+
export const Change = z.discriminatedUnion('type', [VariableChange]);
|
|
98
|
+
/**
|
|
99
|
+
* Zod schema representing an array of {@link Change} items.
|
|
100
|
+
*/
|
|
101
|
+
export const ChangeArray = z.array(Change);
|
|
102
|
+
//# sourceMappingURL=Change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Change.js","sourceRoot":"","sources":["../../../src/experience/change/Change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAU,CAAU,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B;;OAEG;IACH,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IAEf;;;;;OAKG;IACH,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAE/C;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb;;WAEG;QACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;QAExB;;;;;WAKG;QACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;KACzB,CAAC;CACH,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC;IACzC,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;IACR,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;CAC/B,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE;IAChD;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAEhB;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;CACnB,CAAC,CAAA;AAOF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE;IACjD;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAE3B;;OAEG;IACH,KAAK,EAAE,mBAAmB;CAC3B,CAAC,CAAA;AAoBF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,CAAC,CAAA;AAOpE;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experience/change/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experience/change/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema describing an `alias` event.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Currently unused.
|
|
7
|
+
*
|
|
8
|
+
* Alias events are typically used to associate multiple identifiers
|
|
9
|
+
* (for example, anonymous and authenticated IDs) with the same user.
|
|
10
|
+
*
|
|
11
|
+
* Extends {@link UniversalEventProperties} with a fixed `type` field.
|
|
12
|
+
*/
|
|
13
|
+
export declare const AliasEvent: z.ZodMiniObject<{
|
|
14
|
+
channel: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"mobile">, z.ZodMiniLiteral<"server">, z.ZodMiniLiteral<"web">]>;
|
|
15
|
+
context: z.ZodMiniObject<{
|
|
16
|
+
app: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
17
|
+
name: z.ZodMiniString<string>;
|
|
18
|
+
version: z.ZodMiniString<string>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
campaign: z.ZodMiniObject<{
|
|
21
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
22
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
23
|
+
medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
24
|
+
term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
25
|
+
content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
gdpr: z.ZodMiniObject<{
|
|
28
|
+
isConsentGiven: z.ZodMiniBoolean<boolean>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
library: z.ZodMiniObject<{
|
|
31
|
+
name: z.ZodMiniString<string>;
|
|
32
|
+
version: z.ZodMiniString<string>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
locale: z.ZodMiniString<string>;
|
|
35
|
+
location: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
36
|
+
coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
37
|
+
latitude: z.ZodMiniNumber<number>;
|
|
38
|
+
longitude: z.ZodMiniNumber<number>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
41
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
42
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
43
|
+
regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
44
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
45
|
+
countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
46
|
+
continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
47
|
+
timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
50
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
51
|
+
path: z.ZodMiniString<string>;
|
|
52
|
+
query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
53
|
+
referrer: z.ZodMiniString<string>;
|
|
54
|
+
search: z.ZodMiniString<string>;
|
|
55
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
56
|
+
url: z.ZodMiniString<string>;
|
|
57
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
58
|
+
screen: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
59
|
+
name: z.ZodMiniString<string>;
|
|
60
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
messageId: z.ZodMiniString<string>;
|
|
63
|
+
originalTimestamp: z.iso.ZodMiniISODateTime;
|
|
64
|
+
sentAt: z.iso.ZodMiniISODateTime;
|
|
65
|
+
timestamp: z.iso.ZodMiniISODateTime;
|
|
66
|
+
userId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
67
|
+
type: z.ZodMiniLiteral<"alias">;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
/**
|
|
70
|
+
* TypeScript type inferred from {@link AliasEvent}.
|
|
71
|
+
*/
|
|
72
|
+
export type AliasEvent = z.infer<typeof AliasEvent>;
|
|
73
|
+
//# sourceMappingURL=AliasEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AliasEvent.d.ts","sourceRoot":"","sources":["../../../src/experience/event/AliasEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAG7B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKrB,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { UniversalEventProperties } from './UniversalEventProperties';
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema describing an `alias` event.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Currently unused.
|
|
8
|
+
*
|
|
9
|
+
* Alias events are typically used to associate multiple identifiers
|
|
10
|
+
* (for example, anonymous and authenticated IDs) with the same user.
|
|
11
|
+
*
|
|
12
|
+
* Extends {@link UniversalEventProperties} with a fixed `type` field.
|
|
13
|
+
*/
|
|
14
|
+
export const AliasEvent = z.extend(UniversalEventProperties, {
|
|
15
|
+
/**
|
|
16
|
+
* Discriminator indicating that this event is an alias event.
|
|
17
|
+
*/
|
|
18
|
+
type: z.literal('alias'),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=AliasEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AliasEvent.js","sourceRoot":"","sources":["../../../src/experience/event/AliasEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAErE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,wBAAwB,EAAE;IAC3D;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;CACzB,CAAC,CAAA"}
|