@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/contentful/CtflEntry.ts","../src/contentful/AudienceEntry.ts","../src/contentful/MergeTagEntry.ts","../src/contentful/PersonalizationConfig.ts","../src/contentful/PersonalizationEntry.ts","../src/contentful/PersonalizedEntry.ts","../src/experience/event/properties/App.ts","../src/experience/event/properties/Campaign.ts","../src/experience/event/properties/Channel.ts","../src/experience/event/properties/Dictionary.ts","../src/experience/event/properties/GeoLocation.ts","../src/experience/event/properties/Library.ts","../src/experience/event/properties/Page.ts","../src/experience/event/properties/Properties.ts","../src/experience/event/properties/Screen.ts","../src/experience/event/properties/Traits.ts","../src/experience/profile/properties/SessionStatistics.ts","../src/experience/profile/Profile.ts","../src/experience/ResponseEnvelope.ts","../src/experience/BatchExperienceResponse.ts","../src/experience/change/Change.ts","../src/experience/event/UniversalEventProperties.ts","../src/experience/event/AliasEvent.ts","../src/experience/event/ComponentViewEvent.ts","../src/experience/event/GroupEvent.ts","../src/experience/event/IdentifyEvent.ts","../src/experience/event/PageViewEvent.ts","../src/experience/event/ScreenViewEvent.ts","../src/experience/event/TrackEvent.ts","../src/experience/event/BatchExperienceEvent.ts","../src/experience/event/ExperienceEvent.ts","../src/experience/ExperienceRequest.ts","../src/experience/personalization/SelectedPersonalization.ts","../src/experience/ExperienceResponse.ts","../src/insights/event/InsightsEvent.ts","../src/insights/event/BatchInsightsEvent.ts"],"sourcesContent":["import type { ChainModifiers, Entry, EntrySkeletonType, LocaleCode } from 'contentful'\nimport * as z from 'zod/mini'\n\n/**\n * Base Zod schema for entry fields.\n *\n * @remarks\n * This is modeled as a catch-all map from string keys to JSON-compatible values.\n * The strong typing ot consumer-specified Contentful Entry fields is not\n * validated by these schemas.\n */\nexport const EntryFields = z.catchall(z.object({}), z.json())\n\n/**\n * TypeScript type inferred from {@link EntryFields}.\n */\nexport type EntryFields = z.infer<typeof EntryFields>\n\n/**\n * Zod schema representing a generic Contentful Link object.\n *\n * @remarks\n * This is used for references to other Contentful resources where `linkType` is not constrained.\n */\nexport const Link = z.object({\n sys: z.object({\n type: z.literal('Link'),\n linkType: z.string(),\n id: z.string(),\n }),\n})\n\n/**\n * TypeScript type inferred from {@link Link}.\n */\nexport type Link = z.infer<typeof Link>\n\n/**\n * Zod schema representing a Contentful ContentType link.\n */\nexport const ContentTypeLink = z.object({\n sys: z.object({\n type: z.literal('Link'),\n linkType: z.literal('ContentType'),\n id: z.string(),\n }),\n})\n\n/**\n * TypeScript type inferred from {@link ContentTypeLink}.\n */\nexport type ContentTypeLink = z.infer<typeof ContentTypeLink>\n\n/**\n * Zod schema representing a Contentful Environment link.\n */\nexport const EnvironmentLink = z.object({\n sys: z.object({\n type: z.literal('Link'),\n linkType: z.literal('Environment'),\n id: z.string(),\n }),\n})\n\n/**\n * TypeScript type inferred from {@link EnvironmentLink}.\n */\nexport type EnvironmentLink = z.infer<typeof EnvironmentLink>\n\n/**\n * Zod schema representing a Contentful Space link.\n */\nexport const SpaceLink = z.object({\n sys: z.object({\n type: z.literal('Link'),\n linkType: z.literal('Space'),\n id: z.string(),\n }),\n})\n\n/**\n * TypeScript type inferred from {@link SpaceLink}.\n */\nexport type SpaceLink = z.infer<typeof SpaceLink>\n\n/**\n * Zod schema representing a Contentful Tag link.\n */\nexport const TagLink = z.object({\n sys: z.object({\n type: z.literal('Link'),\n linkType: z.literal('Tag'),\n id: z.string(),\n }),\n})\n\n/**\n * TypeScript type inferred from {@link TagLink}.\n */\nexport type TagLink = z.infer<typeof TagLink>\n\n/**\n * Zod schema describing the `sys` block for a Contentful entry.\n *\n * @remarks\n * This mirrors the structure of `Entry['sys']` from the Contentful SDK with\n * a subset of fields used by this library.\n */\nexport const EntrySys = z.object({\n type: z.literal('Entry'),\n contentType: ContentTypeLink,\n publishedVersion: z.number(),\n id: z.string(),\n createdAt: z.any(),\n updatedAt: z.any(),\n locale: z.optional(z.string()),\n revision: z.number(),\n space: SpaceLink,\n environment: EnvironmentLink,\n})\n\n/**\n * TypeScript type inferred from {@link EntrySys}.\n */\nexport type EntrySys = z.infer<typeof EntrySys>\n\n/**\n * Zod schema describing a generic Contentful entry.\n *\n * @remarks\n * This model is intentionally loose: `fields` is any JSON-compliant object and\n * `metadata` is modeled as a catch-all object that must contain an array of\n * {@link TagLink} tags.\n */\nexport const CtflEntry = z.object({\n /**\n * The entry fields payload.\n */\n fields: EntryFields,\n\n /**\n * Contentful metadata, including tags.\n */\n metadata: z.catchall(\n z.object({\n tags: z.array(TagLink),\n }),\n z.json(),\n ),\n\n /**\n * System-managed properties describing the entry.\n */\n sys: EntrySys,\n})\n\n/**\n * TypeScript type inferred from {@link CtflEntry}.\n */\nexport type CtflEntry = z.infer<typeof CtflEntry>\n\n/**\n * Type guard that checks whether the given value is a Contentful {@link Entry},\n * passing through the specified skeleton, chain modifiers, and locale.\n *\n * @typeParam S - The entry skeleton type.\n * @typeParam M - The chain modifiers type. Defaults to {@link ChainModifiers}.\n * @typeParam L - The locale code type. Defaults to {@link LocaleCode}.\n *\n * @param entry - The value to test.\n * @returns `true` if the object conforms to {@link CtflEntry} and can be treated\n * as a typed {@link Entry}, otherwise `false`.\n */\nexport function isEntry<\n S extends EntrySkeletonType,\n M extends ChainModifiers = ChainModifiers,\n L extends LocaleCode = LocaleCode,\n>(entry: Entry | undefined): entry is Entry<S, M, L> {\n return CtflEntry.safeParse(entry).success\n}\n","import * as z from 'zod/mini'\nimport { CtflEntry, EntryFields } from './CtflEntry'\n\n/**\n * Zod schema describing the fields of an Audience entry.\n *\n * @remarks\n * Extends the base {@link EntryFields} with audience-specific properties.\n */\nexport const AudienceEntryFields = z.extend(EntryFields, {\n /**\n * The internal id of the audience (Short Text).\n *\n * @remarks\n * This usually corresponds to a stable identifier used by the personalization system.\n */\n nt_audience_id: z.string(),\n\n /**\n * The name of the audience (Short Text).\n *\n * @remarks\n * Optional field used for display purposes in tools and UI.\n */\n nt_name: z.optional(z.string()),\n\n /**\n * The description of the audience (Short Text).\n *\n * @remarks\n * Optional field intended for internal documentation and operator context.\n */\n nt_description: z.optional(z.string()),\n})\n\n/**\n * TypeScript type inferred from {@link AudienceEntryFields}.\n */\nexport type AudienceEntryFields = z.infer<typeof AudienceEntryFields>\n\n/**\n * Zod schema for a Contentful Audience entry, including system metadata.\n *\n * @remarks\n * Extends the generic {@link CtflEntry} with {@link AudienceEntryFields} as the `fields` payload.\n */\nexport const AudienceEntry = z.extend(CtflEntry, {\n fields: AudienceEntryFields,\n})\n\n/**\n * TypeScript type inferred from {@link AudienceEntry}.\n */\nexport type AudienceEntry = z.infer<typeof AudienceEntry>\n","import * as z from 'zod/mini'\nimport { CtflEntry, EntrySys } from './CtflEntry'\n\n/**\n * Zod schema for a Merge Tag Contentful entry.\n *\n * @remarks\n * Extends {@link CtflEntry} with merge-tag-specific fields and constrains the\n * `contentType` to the `nt_mergetag` content type.\n */\nexport const MergeTagEntry = z.extend(CtflEntry, {\n fields: z.object({\n /**\n * Human-readable name of the merge tag.\n */\n nt_name: z.string(),\n\n /**\n * Fallback value to use when the merge tag cannot be resolved.\n */\n nt_fallback: z.optional(z.string()),\n\n /**\n * Internal identifier of the merge tag.\n */\n nt_mergetag_id: z.string(),\n }),\n\n /**\n * System fields extended to constrain the content type to `nt_mergetag`.\n */\n sys: z.extend(EntrySys, {\n contentType: z.object({\n sys: z.object({\n type: z.literal('Link'),\n linkType: z.literal('ContentType'),\n id: z.literal('nt_mergetag'),\n }),\n }),\n }),\n})\n\n/**\n * TypeScript type inferred from {@link MergeTagEntry}.\n */\nexport type MergeTagEntry = z.infer<typeof MergeTagEntry>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing a single entry replacement variant.\n *\n * @remarks\n * Each variant is identified by an `id` and may be marked as `hidden`.\n */\nexport const EntryReplacementVariant = z.object({\n /**\n * Unique identifier for the variant.\n */\n id: z.string(),\n\n /**\n * Indicates whether this variant is hidden from allocation/traffic.\n *\n * @defaultValue false\n */\n hidden: z.prefault(z.boolean(), false),\n})\n\n/**\n * TypeScript type inferred from {@link EntryReplacementVariant}.\n */\nexport type EntryReplacementVariant = z.infer<typeof EntryReplacementVariant>\n\n/**\n * Type guard for {@link EntryReplacementVariant}.\n *\n * @param variant - Value to test.\n * @returns `true` if `variant` conforms to {@link EntryReplacementVariant}, otherwise `false`.\n */\nexport function isEntryReplacementVariant(variant: unknown): variant is EntryReplacementVariant {\n return EntryReplacementVariant.safeParse(variant).success\n}\n\n/**\n * Zod schema describing an entry replacement personalization component.\n *\n * @remarks\n * This component replaces a baseline entry with one of several variants.\n */\nexport const EntryReplacementComponent = z.object({\n /**\n * Discriminator for the component type.\n *\n * @remarks\n * May be omitted, in which case the component is treated as an EntryReplacement.\n */\n type: z.optional(z.literal('EntryReplacement')),\n\n /**\n * Baseline variant used when no targeting or allocation selects another variant.\n */\n baseline: EntryReplacementVariant,\n\n /**\n * Additional variants that may be served.\n */\n variants: z.array(EntryReplacementVariant),\n})\n\n/**\n * TypeScript type inferred from {@link EntryReplacementComponent}.\n */\nexport type EntryReplacementComponent = z.infer<typeof EntryReplacementComponent>\n\n/**\n * Type guard for {@link EntryReplacementComponent}.\n *\n * @param component - Personalization component to test.\n * @returns `true` if the component is an EntryReplacement component, otherwise `false`.\n */\nexport function isEntryReplacementComponent(\n component: PersonalizationComponent,\n): component is EntryReplacementComponent {\n return component.type === 'EntryReplacement' || component.type === undefined\n}\n\n/**\n * Zod schema describing a variant for inline variables.\n *\n * @remarks\n * The value may be a primitive or a JSON object.\n */\nexport const InlineVariableVariant = z.object({\n /**\n * Variant value for the inline variable.\n */\n value: z.union([z.string(), z.boolean(), z.null(), z.number(), z.record(z.string(), z.json())]),\n})\n\n/**\n * Enumeration of supported inline variable value types.\n */\nexport const InlineVariableComponentValueType = z.enum(['Boolean', 'Number', 'Object', 'String'])\n\n/**\n * Zod schema describing an inline variable personalization component.\n *\n * @remarks\n * Used to vary scalar or object values in templates.\n */\nexport const InlineVariableComponent = z.object({\n /**\n * Discriminator for the inline variable component.\n */\n type: z.literal('InlineVariable'),\n\n /**\n * Key under which this variable is exposed to the template.\n */\n key: z.string(),\n\n /**\n * Describes the runtime type of the values for this variable.\n */\n valueType: InlineVariableComponentValueType,\n\n /**\n * Baseline value used when no targeting or allocation selects another variant.\n */\n baseline: InlineVariableVariant,\n\n /**\n * Additional variable variants for experimentation or personalization.\n */\n variants: z.array(InlineVariableVariant),\n})\n\n/**\n * TypeScript type inferred from {@link InlineVariableComponent}.\n */\nexport type InlineVariableComponent = z.infer<typeof InlineVariableComponent>\n\n/**\n * Type guard for {@link InlineVariableComponent}.\n *\n * @param component - Personalization component to test.\n * @returns `true` if the component is an InlineVariable component, otherwise `false`.\n */\nexport function isInlineVariableComponent(\n component: PersonalizationComponent,\n): component is InlineVariableComponent {\n return component.type === 'InlineVariable'\n}\n\n/**\n * Discriminated union of all supported personalization components.\n */\nexport const PersonalizationComponent = z.discriminatedUnion('type', [\n EntryReplacementComponent,\n InlineVariableComponent,\n])\n\n/**\n * TypeScript type inferred from {@link PersonalizationComponent}.\n */\nexport type PersonalizationComponent = z.infer<typeof PersonalizationComponent>\n\n/**\n * Zod schema representing an array of {@link PersonalizationComponent} items.\n */\nexport const PersonalizationComponentArray = z.array(PersonalizationComponent)\n\n/**\n * TypeScript type inferred from {@link PersonalizationComponentArray}.\n */\nexport type PersonalizationComponentArray = z.infer<typeof PersonalizationComponentArray>\n\n/**\n * Zod schema describing the full configuration for a personalization.\n *\n * @remarks\n * Provides distribution, traffic allocation, component definitions, and sticky behavior.\n */\nexport const PersonalizationConfig = z.object({\n /**\n * Variant distribution used for traffic allocation.\n *\n * @defaultValue [0.5, 0.5]\n */\n distribution: z.optional(z.prefault(z.array(z.number()), [0.5, 0.5])),\n\n /**\n * Percentage of total traffic that should enter the personalization.\n *\n * @defaultValue 0\n */\n traffic: z.optional(z.prefault(z.number(), 0)),\n\n /**\n * Personalization components that define how content is varied.\n *\n * @defaultValue\n * A single {@link EntryReplacementComponent} with an empty `baseline` and `variants` ID.\n */\n components: z.optional(\n z.prefault(PersonalizationComponentArray, [\n {\n type: 'EntryReplacement',\n baseline: { id: '' },\n variants: [{ id: '' }],\n },\n ]),\n ),\n\n /**\n * Controls whether the assignment should be sticky for a given user.\n *\n * @defaultValue false\n */\n sticky: z.optional(z.prefault(z.boolean(), false)),\n})\n\n/**\n * TypeScript type inferred from {@link PersonalizationConfig}.\n */\nexport type PersonalizationConfig = z.infer<typeof PersonalizationConfig>\n","import type { Entry } from 'contentful'\nimport * as z from 'zod/mini'\nimport { AudienceEntry } from './AudienceEntry'\nimport { CtflEntry, EntryFields, Link } from './CtflEntry'\nimport { PersonalizationConfig } from './PersonalizationConfig'\n\n/**\n * Union of supported personalization types.\n *\n * @remarks\n * `nt_experiment` represents experiments (A/B tests), and `nt_personalization`\n * represents always-on personalized experiences.\n */\nexport const PersonalizationType = z.union([\n z.literal('nt_experiment'),\n z.literal('nt_personalization'),\n])\n\n/**\n * TypeScript type inferred from {@link PersonalizationType}.\n */\nexport type PersonalizationType = z.infer<typeof PersonalizationType>\n\n/**\n * Zod schema describing the fields of a Personalization entry.\n *\n * @remarks\n * Extends the generic {@link EntryFields} with personalization-specific\n * properties such as name, description, type, config, audience, and variants.\n */\nexport const PersonalizationFields = z.extend(EntryFields, {\n /**\n * The name of the personalization (Short Text).\n */\n nt_name: z.string(),\n\n /**\n * The description of the personalization (Short Text).\n *\n * @remarks\n * Optional, may be `null` if no description is provided.\n */\n nt_description: z.optional(z.nullable(z.string())),\n\n /**\n * The type of the personalization (`nt_experiment` | `nt_personalization`).\n */\n nt_type: PersonalizationType,\n\n /**\n * The configuration of a {@link PersonalizationEntry } (JSON).\n *\n * @remarks\n * Accepts `null` or an explicit {@link PersonalizationConfig} and converts\n * falsy/undefined values into a default configuration.\n */\n nt_config: z.pipe(\n z.optional(z.prefault(z.nullable(PersonalizationConfig), null)),\n z.transform<PersonalizationConfig | null>(\n (v) =>\n v ?? {\n traffic: 0,\n distribution: [0.5, 0.5],\n components: [],\n sticky: false,\n },\n ),\n ),\n\n /**\n * The audience of the personalization (Audience).\n *\n * @remarks\n * Optional and nullable; when omitted or `null`, the personalization may apply\n * to all users.\n */\n nt_audience: z.optional(z.nullable(AudienceEntry)),\n\n /**\n * All used variants of the personalization (Contentful references to other Content Types).\n *\n * @remarks\n * Modeled as an array of untyped Contentful entries and defaults to an empty\n * array when omitted.\n */\n nt_variants: z.optional(z.prefault(z.array(z.custom<Entry>()), [])),\n\n /**\n * The personalization/experience ID related to this personalization entry.\n */\n nt_experience_id: z.string(),\n})\n\n/**\n * TypeScript type inferred from {@link PersonalizationFields}.\n */\nexport type PersonalizationFields = z.infer<typeof PersonalizationFields>\n\n/**\n * Zod schema describing a Personalization entry, which is associated with a {@link PersonalizedEntry } via its `fields.nt_experiences`.\n */\nexport const PersonalizationEntry = z.extend(CtflEntry, {\n fields: PersonalizationFields,\n})\n\n/**\n * TypeScript type inferred from {@link PersonalizationEntry}.\n */\nexport type PersonalizationEntry = z.infer<typeof PersonalizationEntry>\n\n/**\n * Type guard for {@link PersonalizationEntry}.\n *\n * @param entry - Contentful entry or link to test.\n * @returns `true` if the value conforms to {@link PersonalizationEntry}, otherwise `false`.\n */\nexport function isPersonalizationEntry(entry: CtflEntry | Link): entry is PersonalizationEntry {\n return PersonalizationEntry.safeParse(entry).success\n}\n\n/**\n * Zod schema describing an array of personalization entries or links.\n *\n * @remarks\n * Each element may be a {@link Link} or a fully resolved {@link PersonalizationEntry}.\n */\nexport const PersonalizationEntryArray = z.array(z.union([Link, PersonalizationEntry]))\n\n/**\n * TypeScript type inferred from {@link PersonalizationEntryArray}.\n */\nexport type PersonalizationEntryArray = z.infer<typeof PersonalizationEntryArray>\n","import type { Entry } from 'contentful'\nimport * as z from 'zod/mini'\nimport { CtflEntry, EntryFields } from './CtflEntry'\nimport { PersonalizationEntryArray } from './PersonalizationEntry'\n\n/**\n * Zod schema describing a Contentful entry that has attached personalizations.\n *\n * @remarks\n * Extends {@link CtflEntry} and adds `nt_experiences` to the `fields` object.\n */\nexport const PersonalizedEntry = z.extend(CtflEntry, {\n fields: z.extend(EntryFields, {\n /**\n * Personalization or experimentation experiences attached to this entry.\n */\n nt_experiences: PersonalizationEntryArray,\n }),\n})\n\n/**\n * TypeScript type inferred from {@link PersonalizedEntry}.\n */\nexport type PersonalizedEntry = z.infer<typeof PersonalizedEntry>\n\n/**\n * Type guard for {@link PersonalizedEntry}.\n *\n * @param entry - Contentful entry to test.\n * @returns `true` if the entry conforms to {@link PersonalizedEntry}, otherwise `false`.\n */\nexport function isPersonalizedEntry(entry: Entry | undefined): entry is PersonalizedEntry {\n return PersonalizedEntry.safeParse(entry).success\n}\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing app-level properties.\n *\n * @remarks\n * These properties typically describe the application that is emitting\n * analytics events, such as its name and version.\n *\n * The entire object is optional; when omitted, no app context is attached.\n */\nexport const App = z.optional(\n z.object({\n /**\n * Name of the application.\n */\n name: z.string(),\n\n /**\n * Version of the application.\n */\n version: z.string(),\n }),\n)\n\n/**\n * TypeScript type inferred from {@link App}.\n */\nexport type App = z.infer<typeof App>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing campaign attribution properties.\n *\n * @remarks\n * These fields typically mirror UTM parameters used for marketing campaigns.\n */\nexport const Campaign = z.object({\n /**\n * Name of the campaign (e.g., `utm_campaign`).\n */\n name: z.optional(z.string()),\n\n /**\n * Campaign source (e.g., `utm_source`).\n */\n source: z.optional(z.string()),\n\n /**\n * Campaign medium (e.g., `utm_medium`).\n */\n medium: z.optional(z.string()),\n\n /**\n * Campaign term (e.g., `utm_term`).\n */\n term: z.optional(z.string()),\n\n /**\n * Campaign content (e.g., `utm_content`).\n */\n content: z.optional(z.string()),\n})\n\n/**\n * TypeScript type inferred from {@link Campaign}.\n */\nexport type Campaign = z.infer<typeof Campaign>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing the analytics channel.\n *\n * @remarks\n * Indicates the execution environment where the event originated.\n *\n * - `'mobile'` — Events from native or hybrid mobile apps.\n * - `'server'` — Events emitted from backend/server-side code.\n * - `'web'` — Events from web browsers or web-based clients.\n */\nexport const Channel = z.union([z.literal('mobile'), z.literal('server'), z.literal('web')])\n\n/**\n * TypeScript type inferred from {@link Channel}.\n */\nexport type Channel = z.infer<typeof Channel>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing a simple string-to-string dictionary.\n *\n * @remarks\n * Commonly used for query parameters or other small key–value maps.\n */\nexport const Dictionary = z.record(z.string(), z.string())\n\n/**\n * TypeScript type inferred from {@link Dictionary}.\n */\nexport type Dictionary = z.infer<typeof Dictionary>\n","import * as z from 'zod/mini'\n\n/**\n * Length (in characters) of the expected country code.\n *\n * @remarks\n * Typically corresponds to ISO 3166-1 alpha-2 country codes.\n */\nconst COUNTRY_CODE_LENGTH = 2\n\n/**\n * Zod schema describing geographical coordinates.\n *\n * @remarks\n * Latitude and longitude are expressed in decimal degrees.\n */\nconst Coordinates = z.object({\n /**\n * Latitude component of the coordinates.\n */\n latitude: z.number(),\n\n /**\n * Longitude component of the coordinates.\n */\n longitude: z.number(),\n})\n\n/**\n * Zod schema describing geo-location properties associated with an event.\n *\n * @remarks\n * All properties are optional and may be derived from IP or device data.\n */\nexport const GeoLocation = z.object({\n /**\n * Geographical coordinates for the location.\n */\n coordinates: z.optional(Coordinates),\n\n /**\n * City name associated with the location.\n */\n city: z.optional(z.string()),\n\n /**\n * Postal or ZIP code associated with the location.\n */\n postalCode: z.optional(z.string()),\n\n /**\n * Region or state name associated with the location.\n */\n region: z.optional(z.string()),\n\n /**\n * Region or state code associated with the location.\n */\n regionCode: z.optional(z.string()),\n\n /**\n * Country name associated with the location.\n */\n country: z.optional(z.string()),\n\n /**\n * Country code associated with the location.\n *\n * @remarks\n * Validated to exactly COUNTRY_CODE_LENGTH characters, typically\n * an ISO 3166-1 alpha-2 code.\n */\n countryCode: z.optional(z.string().check(z.length(COUNTRY_CODE_LENGTH))),\n\n /**\n * Continent name associated with the location.\n */\n continent: z.optional(z.string()),\n\n /**\n * Time zone identifier associated with the location.\n *\n * @remarks\n * Typically an IANA time zone string (e.g., `\"Europe/Berlin\"`).\n */\n timezone: z.optional(z.string()),\n})\n\n/**\n * TypeScript type inferred from {@link GeoLocation}.\n */\nexport type GeoLocation = z.infer<typeof GeoLocation>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing analytics library metadata.\n *\n * @remarks\n * Identifies the client library that produced the event.\n */\nexport const Library = z.object({\n /**\n * Name of the SDK/library (e.g., `\"@contentful/optimization-web\"`).\n */\n name: z.string(),\n\n /**\n * Version of the analytics library.\n */\n version: z.string(),\n})\n\n/**\n * TypeScript type inferred from {@link Library}.\n */\nexport type Library = z.infer<typeof Library>\n","import * as z from 'zod/mini'\nimport { Dictionary } from './Dictionary'\n\n/**\n * Zod schema describing Web page-level properties for events.\n *\n * @remarks\n * The base object describes standard page attributes, while additional\n * JSON properties may be present due to the use of `z.catchall`.\n */\nexport const Page = z.catchall(\n z.object({\n /**\n * Path component of the page URL (e.g., `/products/123`).\n */\n path: z.string(),\n\n /**\n * Parsed query parameters for the page.\n */\n query: Dictionary,\n\n /**\n * Referrer URL that led to the current page.\n */\n referrer: z.string(),\n\n /**\n * Raw search string including the leading `?` (e.g., `\"?q=test\"`).\n */\n search: z.string(),\n\n /**\n * Title of the page as seen by the user.\n */\n title: z.optional(z.string()),\n\n /**\n * Full URL of the page.\n */\n url: z.string(),\n }),\n z.json(),\n)\n\n/**\n * TypeScript type inferred from {@link Page}.\n */\nexport type Page = z.infer<typeof Page>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing a generic collection of event properties.\n *\n * @remarks\n * Represents an arbitrary JSON-serializable map from string keys to values.\n */\nexport const Properties = z.record(z.string(), z.json())\n\n/**\n * TypeScript type inferred from {@link Properties}.\n */\nexport type Properties = z.infer<typeof Properties>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing Web page-level properties for events.\n *\n * @remarks\n * The base object describes standard page attributes, while additional\n * JSON properties may be present due to the use of `z.catchall`.\n */\nexport const Screen = z.catchall(\n z.object({\n /**\n * Name or label for the screen.\n */\n name: z.string(),\n }),\n z.json(),\n)\n\n/**\n * TypeScript type inferred from {@link Page}.\n */\nexport type Screen = z.infer<typeof Screen>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing user traits / identity properties.\n *\n * @remarks\n * Represents an arbitrary JSON-serializable map from string keys to values.\n * Common traits may include `name`, `plan`, and custom attributes.\n */\nexport const Traits = z.record(z.string(), z.json())\n\n/**\n * TypeScript type inferred from {@link Traits}.\n */\nexport type Traits = z.infer<typeof Traits>\n","import * as z from 'zod/mini'\nimport { Page } from '../../event/properties'\n\n/**\n * Zod schema describing aggregated statistics for a user session.\n *\n * @remarks\n * Captures both per-session metrics (such as `activeSessionLength`) and\n * aggregate metrics (such as `averageSessionLength`) for a given profile.\n */\nexport const SessionStatistics = z.object({\n /**\n * Unique identifier for this session statistics record.\n */\n id: z.string(),\n\n /**\n * Indicates whether the visitor has been seen before.\n *\n * @remarks\n * `true` typically means the visitor has at least one prior session.\n */\n isReturningVisitor: z.boolean(),\n\n /**\n * Landing page for the session.\n *\n * @remarks\n * Represents the first page the user visited in this session.\n *\n * @see Page\n */\n landingPage: Page,\n\n /**\n * Number of sessions associated with this profile or identifier.\n *\n * @remarks\n * Often used in combination with {@link SessionStatistics.averageSessionLength}.\n */\n count: z.number(),\n\n /**\n * Duration of the active session.\n */\n activeSessionLength: z.number(),\n\n /**\n * Average session duration across all sessions represented by this record.\n *\n * @remarks\n * The unit should match {@link SessionStatistics.activeSessionLength}.\n */\n averageSessionLength: z.number(),\n})\n\n/**\n * TypeScript type inferred from {@link SessionStatistics}.\n */\nexport type SessionStatistics = z.infer<typeof SessionStatistics>\n","import * as z from 'zod/mini'\nimport { GeoLocation } from '../event/properties'\nimport { Traits } from '../event/properties/Traits'\nimport { SessionStatistics } from './properties'\n\n/**\n * Zod schema describing a full user profile as received from the Experience API.\n *\n * @remarks\n * Represents the server-side view of a profile, including identifiers,\n * traits, audiences, location, and session statistics.\n */\nexport const Profile = z.object({\n /**\n * Primary identifier of the profile.\n */\n id: z.string(),\n\n /**\n * Stable, long-lived identifier of the profile.\n *\n * @remarks\n * Intended to remain constant across sessions and devices when possible.\n * Usually equal to `id`.\n */\n stableId: z.string(),\n\n /**\n * Random value associated with the profile.\n *\n * @remarks\n * Often used for deterministic bucketing (e.g., in experiments).\n */\n random: z.number(),\n\n /**\n * List of audience identifiers that this profile currently belongs to.\n */\n audiences: z.array(z.string()),\n\n /**\n * Traits describing the profile (user-level attributes).\n *\n * @see Traits\n */\n traits: Traits,\n\n /**\n * Geo-location information associated with the profile.\n *\n * @see GeoLocation\n */\n location: GeoLocation,\n\n /**\n * Aggregated session statistics for the profile.\n *\n * @see SessionStatistics\n */\n session: SessionStatistics,\n})\n\n/**\n * TypeScript type inferred from {@link Profile}.\n */\nexport type Profile = z.infer<typeof Profile>\n\n/**\n * Zod schema describing a partial profile payload used for sending events\n * to the Experience & Insights APIs.\n *\n * @remarks\n * This schema enforces the presence of an `id` field and allows additional\n * JSON-serializable properties via `z.catchall`.\n */\nexport const PartialProfile = z.catchall(\n z.object({\n /**\n * Identifier of the profile.\n *\n * @remarks\n * Used to associate events with an existing profile.\n */\n id: z.string(),\n }),\n z.json(),\n)\n\n/**\n * TypeScript type inferred from {@link PartialProfile}.\n */\nexport type PartialProfile = z.infer<typeof PartialProfile>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing the common envelope structure of responses\n * from the Experience API.\n *\n * @remarks\n * Concrete responses extend this schema and refine the `data` property\n * to a more specific shape.\n */\nexport const ResponseEnvelope = z.object({\n /**\n * Response payload.\n *\n * @remarks\n * The base schema uses an empty object; specific responses extend this\n * with more detailed structures.\n */\n data: z.object(),\n\n /**\n * Human-readable message accompanying the response.\n */\n message: z.string(),\n\n /**\n * Indicates whether an error occurred.\n *\n * @remarks\n * May be `null` when the error state is unknown or not applicable.\n */\n error: z.nullable(z.boolean()),\n})\n\n/**\n * TypeScript type inferred from {@link ResponseEnvelope}.\n */\nexport type ResponseEnvelope = z.infer<typeof ResponseEnvelope>\n","import * as z from 'zod/mini'\nimport { Profile } from './profile'\nimport { ResponseEnvelope } from './ResponseEnvelope'\n\n/**\n * Zod schema describing the `data` property of a batch experience response.\n *\n * @remarks\n * A batch request may return zero or more profiles. When no profiles are\n * returned, `profiles` may be omitted or an empty array.\n */\nexport const BatchExperienceData = z.object({\n /**\n * Profiles evaluated or affected by the batch experience request.\n */\n profiles: z.optional(z.array(Profile)),\n})\n\n/**\n * TypeScript type inferred from {@link BatchExperienceData}.\n */\nexport type BatchExperienceData = z.infer<typeof BatchExperienceData>\n\n/**\n * Zod schema describing a batch experience response from the Experience API.\n *\n * @remarks\n * Extends {@link ResponseEnvelope} with {@link BatchExperienceData} as the\n * `data` payload.\n */\nexport const BatchExperienceResponse = z.extend(ResponseEnvelope, { data: BatchExperienceData })\n\n/**\n * TypeScript type inferred from {@link BatchExperienceResponse}.\n */\nexport type BatchExperienceResponse = z.infer<typeof BatchExperienceResponse>\n","import * as z from 'zod/mini'\n\n/**\n * Enumeration of supported change types.\n *\n * @remarks\n * Currently only the `'Variable'` change type is supported, but the union\n * in {@link ChangeBase} allows for additional types to be introduced.\n */\nexport const ChangeType = ['Variable'] as const\n\n/**\n * Zod schema describing the base shape for a change.\n *\n * @remarks\n * This base is extended by specific change types such as {@link VariableChange}.\n */\nconst ChangeBase = z.object({\n /**\n * Key identifying the subject of the change.\n */\n key: z.string(),\n\n /**\n * Discriminator for the change type.\n *\n * @remarks\n * May be one of {@link ChangeType} or an arbitrary string for unknown types.\n */\n type: z.union([z.enum(ChangeType), z.string()]),\n\n /**\n * Metadata describing the originating experience and variant index.\n */\n meta: z.object({\n /**\n * Identifier of the personalization or experiment experience.\n */\n experienceId: z.string(),\n\n /**\n * Index of the variant within the experience configuration.\n *\n * @remarks\n * Typically corresponds to the array index in the experience's distribution.\n */\n variantIndex: z.number(),\n }),\n})\n\n/**\n * Zod schema for the allowed value types of a variable change.\n *\n * @remarks\n * Supports primitives and JSON objects keyed by strings.\n */\nexport const VariableChangeValue = z.union([\n z.string(),\n z.boolean(),\n z.null(),\n z.number(),\n z.record(z.string(), z.json()),\n])\n\n/**\n * Zod schema representing an unknown change type.\n *\n * @remarks\n * This can be used to handle forward-compatible change payloads where\n * the `type` is not recognized.\n */\nexport const UnknownChange = z.extend(ChangeBase, {\n /**\n * Unconstrained change type string.\n */\n type: z.string(),\n\n /**\n * Payload for the change value, with unknown structure.\n */\n value: z.unknown(),\n})\n\n/**\n * TypeScript type inferred from {@link UnknownChange}.\n */\nexport type UnknownChange = z.infer<typeof UnknownChange>\n\n/**\n * Zod schema representing a change whose type is `'Variable'`.\n *\n * @remarks\n * The `value` must conform to {@link VariableChangeValue}.\n */\nexport const VariableChange = z.extend(ChangeBase, {\n /**\n * Discriminator for a variable change.\n */\n type: z.literal('Variable'),\n\n /**\n * New value for the variable identified by {@link ChangeBase.key}.\n */\n value: VariableChangeValue,\n})\n\n/**\n * TypeScript type inferred from {@link VariableChange}.\n */\nexport type VariableChange = z.infer<typeof VariableChange>\n\n/**\n * JSON value type inferred from {@link z.json}.\n *\n * @remarks\n * Represents any JSON-serializable value.\n */\nexport type Json = z.infer<typeof z.json>\n\n/**\n * Map of Custom Flag keys to JSON values.\n */\nexport type Flags = Record<string, Json>\n\n/**\n * Union of supported change types.\n *\n * @remarks\n * Currently only {@link VariableChange} is included.\n */\nexport const Change = z.discriminatedUnion('type', [VariableChange])\n\n/**\n * TypeScript type inferred from {@link Change}.\n */\nexport type Change = z.infer<typeof Change>\n\n/**\n * Zod schema representing an array of {@link Change} items.\n */\nexport const ChangeArray = z.array(Change)\n\n/**\n * TypeScript type inferred from {@link ChangeArray}.\n */\nexport type ChangeArray = z.infer<typeof ChangeArray>\n","import * as z from 'zod/mini'\nimport { App, Campaign, Channel, GeoLocation, Library, Page, Screen } from './properties'\n\n/**\n * Zod schema describing universal event context properties shared by all\n * analytics events.\n *\n * @remarks\n * The `page` and screen` properties are optional, but should usually be\n * omitted for event types that are not `page` or `screen`\n */\nexport const UniversalEventContext = z.object({\n /**\n * Application-level metadata.\n */\n app: App,\n\n /**\n * Campaign attribution metadata.\n */\n campaign: Campaign,\n\n /**\n * GDPR-related consent information.\n */\n gdpr: z.object({\n /**\n * Indicates whether the user has given consent.\n */\n isConsentGiven: z.boolean(),\n }),\n\n /**\n * Analytics library metadata.\n */\n library: Library,\n\n /**\n * Locale identifier of the event (e.g., `\"en-US\"`).\n */\n locale: z.string(),\n\n /**\n * Optional geo-location information associated with the event.\n */\n location: z.optional(GeoLocation),\n\n /**\n * User agent string of the client, if available.\n */\n userAgent: z.optional(z.string()),\n})\nexport type UniversalEventContext = z.infer<typeof UniversalEventContext>\n\n/**\n * Zod schema describing universal properties shared by all analytics events.\n *\n * @remarks\n * These properties capture common metadata such as channel, context,\n * timestamps, and user identifiers.\n */\nexport const UniversalEventProperties = z.object({\n /**\n * Channel from which the event originated.\n *\n * @see Channel\n */\n channel: Channel,\n\n /**\n * Context object carrying environment and client metadata.\n */\n context: z.extend(UniversalEventContext, {\n page: z.optional(Page),\n screen: z.optional(Screen),\n }),\n\n /**\n * Unique identifier for this message.\n *\n * @remarks\n * Used to deduplicate events across retries and transports.\n */\n messageId: z.string(),\n\n /**\n * Timestamp when the event originally occurred.\n *\n * @remarks\n * ISO 8601 datetime string.\n */\n originalTimestamp: z.iso.datetime(),\n\n /**\n * Timestamp when the event payload was sent.\n *\n * @remarks\n * ISO 8601 datetime string.\n */\n sentAt: z.iso.datetime(),\n\n /**\n * Timestamp when the event was recorded or processed.\n *\n * @remarks\n * ISO 8601 datetime string.\n */\n timestamp: z.iso.datetime(),\n\n /**\n * Identifier of the authenticated user, if known.\n */\n userId: z.optional(z.string()),\n})\n\n/**\n * TypeScript type inferred from {@link UniversalEventProperties}.\n */\nexport type UniversalEventProperties = z.infer<typeof UniversalEventProperties>\n","import * as z from 'zod/mini'\nimport { UniversalEventProperties } from './UniversalEventProperties'\n\n/**\n * Zod schema describing an `alias` event.\n *\n * @remarks\n * Currently unused.\n *\n * Alias events are typically used to associate multiple identifiers\n * (for example, anonymous and authenticated IDs) with the same user.\n *\n * Extends {@link UniversalEventProperties} with a fixed `type` field.\n */\nexport const AliasEvent = z.extend(UniversalEventProperties, {\n /**\n * Discriminator indicating that this event is an alias event.\n */\n type: z.literal('alias'),\n})\n\n/**\n * TypeScript type inferred from {@link AliasEvent}.\n */\nexport type AliasEvent = z.infer<typeof AliasEvent>\n","import * as z from 'zod/mini'\nimport { UniversalEventProperties } from './UniversalEventProperties'\n\n/**\n * Zod schema describing a `component` view event.\n *\n * @remarks\n * Component view events track exposure of individual components such as\n * entries or variables within a personalized experience.\n *\n * Extends {@link UniversalEventProperties}.\n */\nexport const ComponentViewEvent = z.extend(UniversalEventProperties, {\n /**\n * Discriminator indicating that this event is a component view.\n */\n type: z.literal('component'),\n\n /**\n * Type of component that was viewed.\n *\n * - `'Entry'` — A content entry component.\n * - `'Variable'` — A variable or inline value component.\n */\n componentType: z.union([z.literal('Entry'), z.literal('Variable')]),\n\n /**\n * Contentful entry ID corresponding to the component that was viewed.\n */\n componentId: z.string(),\n\n /**\n * Identifier of the experience that rendered this component.\n *\n * @remarks\n * Optional; component views may occur outside of a specific experience/personalization.\n */\n experienceId: z.optional(z.string()),\n\n /**\n * Index of the variant associated with this component view.\n *\n * @remarks\n * Typically corresponds to the index of the selected personalization entry.\n */\n variantIndex: z.number(),\n})\n\n/**\n * TypeScript type inferred from {@link ComponentViewEvent}.\n */\nexport type ComponentViewEvent = z.infer<typeof ComponentViewEvent>\n","import * as z from 'zod/mini'\nimport { UniversalEventProperties } from './UniversalEventProperties'\n\n/**\n * Zod schema describing a `group` event.\n *\n * @remarks\n * Currently unused.\n *\n * Group events typically associate a user with an organization, account,\n * or other grouping construct.\n *\n * Extends {@link UniversalEventProperties}.\n */\nexport const GroupEvent = z.extend(UniversalEventProperties, {\n /**\n * Discriminator indicating that this event is a group event.\n */\n type: z.literal('group'),\n})\n\n/**\n * TypeScript type inferred from {@link GroupEvent}.\n */\nexport type GroupEvent = z.infer<typeof GroupEvent>\n","import * as z from 'zod/mini'\nimport { UniversalEventProperties } from './UniversalEventProperties'\nimport { Traits } from './properties/Traits'\n\n/**\n * Zod schema describing an `identify` event.\n *\n * @remarks\n * Identify events attach user traits to a known identity.\n *\n * Extends {@link UniversalEventProperties} with a `traits` payload.\n */\nexport const IdentifyEvent = z.extend(UniversalEventProperties, {\n /**\n * Discriminator indicating that this event is an identify event.\n */\n type: z.literal('identify'),\n\n /**\n * Traits describing the user.\n *\n * @see {@link Traits}\n */\n traits: Traits,\n})\n\n/**\n * TypeScript type inferred from {@link IdentifyEvent}.\n */\nexport type IdentifyEvent = z.infer<typeof IdentifyEvent>\n","import * as z from 'zod/mini'\nimport { UniversalEventContext, UniversalEventProperties } from './UniversalEventProperties'\nimport { Page } from './properties'\n\n/**\n * Zod schema describing event context properties specific to page events\n */\nexport const PageEventContext = z.extend(UniversalEventContext, {\n /**\n * Page context for events that occur within a web page.\n */\n page: Page,\n})\n\n/**\n * TypeScript type inferred from {@link PageEventContext}.\n */\nexport type PageEventContext = z.infer<typeof PageEventContext>\n\n/**\n * Zod schema describing a `page` view event.\n *\n * @remarks\n * Page view events track visits to web pages and associated context.\n *\n * Extends {@link UniversalEventProperties} with optional `name` and\n * page-level {@link Page} properties.\n */\nexport const PageViewEvent = z.extend(UniversalEventProperties, {\n /**\n * Discriminator indicating that this event is a page view.\n */\n type: z.literal('page'),\n\n /**\n * Optional name for the page.\n *\n * @remarks\n * Useful when the logical page name differs from the URL or title.\n */\n name: z.optional(z.string()),\n\n /**\n * Page-level properties such as URL, path, and referrer.\n */\n properties: Page,\n\n /*\n * Override the context property of {@link UniversalEventProperties}\n * with a page-specific context\n */\n context: PageEventContext,\n})\n\n/**\n * TypeScript type inferred from {@link PageViewEvent}.\n */\nexport type PageViewEvent = z.infer<typeof PageViewEvent>\n","import * as z from 'zod/mini'\nimport { UniversalEventContext, UniversalEventProperties } from './UniversalEventProperties'\nimport { Properties, Screen } from './properties'\n\n/**\n * Zod schema describing event context properties specific to screen events\n */\nexport const ScreenEventContext = z.extend(UniversalEventContext, {\n /**\n * Screen context for events that occur within a web page.\n */\n screen: Screen,\n})\n\n/**\n * TypeScript type inferred from {@link ScreenEventContext}.\n */\nexport type ScreenEventContext = z.infer<typeof ScreenEventContext>\n\n/**\n * Zod schema describing a `screen` view event.\n *\n * @remarks\n * Screen view events are typically used by mobile or TV applications\n * to track navigation between screens.\n *\n * Extends {@link UniversalEventProperties}.\n */\nexport const ScreenViewEvent = z.extend(UniversalEventProperties, {\n /**\n * Discriminator indicating that this event is a screen view.\n */\n type: z.literal('screen'),\n\n /**\n * Name of the screen being viewed.\n */\n name: z.string(),\n\n /**\n * Optional properties describing the screen context.\n *\n * @see Properties\n */\n properties: z.optional(Properties),\n\n /*\n * Override the context property of {@link UniversalEventProperties}\n * with a screen-specific context\n */\n context: ScreenEventContext,\n})\n\n/**\n * TypeScript type inferred from {@link ScreenViewEvent}.\n */\nexport type ScreenViewEvent = z.infer<typeof ScreenViewEvent>\n","import * as z from 'zod/mini'\nimport { UniversalEventProperties } from './UniversalEventProperties'\nimport { Properties } from './properties'\n\n/**\n * Zod schema describing a custom `track` event.\n *\n * @remarks\n * Track events capture arbitrary user actions that do not fit into\n * the more specific event types (page, screen, identify, etc.).\n *\n * Extends {@link UniversalEventProperties}.\n */\nexport const TrackEvent = z.extend(UniversalEventProperties, {\n /**\n * Discriminator indicating that this event is a track event.\n */\n type: z.literal('track'),\n\n /**\n * Name of the event being tracked.\n */\n event: z.string(),\n\n /**\n * Additional properties describing the event.\n */\n properties: Properties,\n})\n\n/**\n * TypeScript type inferred from {@link TrackEvent}.\n */\nexport type TrackEvent = z.infer<typeof TrackEvent>\n","import * as z from 'zod/mini'\nimport { AliasEvent } from './AliasEvent'\nimport { ComponentViewEvent } from './ComponentViewEvent'\nimport { GroupEvent } from './GroupEvent'\nimport { IdentifyEvent } from './IdentifyEvent'\nimport { PageViewEvent } from './PageViewEvent'\nimport { ScreenViewEvent } from './ScreenViewEvent'\nimport { TrackEvent } from './TrackEvent'\n\n/**\n * Partial schema capturing an anonymous identifier.\n *\n * @remarks\n * This object is merged into each event type in a batch to associate the\n * event with an `anonymousId`.\n */\nconst Anon = { anonymousId: z.string() }\n\n/**\n * Zod schema describing each valid experience/personalization event within a batch.\n *\n * @remarks\n * This is a discriminated union on the `type` field that supports all event\n * types used in batch ingestion, each extended with an `anonymousId`.\n */\nexport const BatchExperienceEvent = z.discriminatedUnion('type', [\n z.extend(AliasEvent, Anon),\n z.extend(ComponentViewEvent, Anon),\n z.extend(GroupEvent, Anon),\n z.extend(IdentifyEvent, Anon),\n z.extend(PageViewEvent, Anon),\n z.extend(ScreenViewEvent, Anon),\n z.extend(TrackEvent, Anon),\n])\n\n/**\n * TypeScript type inferred from {@link BatchExperienceEvent}.\n */\nexport type BatchExperienceEvent = z.infer<typeof BatchExperienceEvent>\n\n/**\n * Zod schema describing an array of {@link BatchExperienceEvent} items.\n */\nexport const BatchExperienceEventArray = z.array(BatchExperienceEvent)\n\n/**\n * TypeScript type inferred from {@link BatchExperienceEventArray}.\n */\nexport type BatchExperienceEventArray = z.infer<typeof BatchExperienceEventArray>\n","import * as z from 'zod/mini'\nimport { AliasEvent } from './AliasEvent'\nimport { ComponentViewEvent } from './ComponentViewEvent'\nimport { GroupEvent } from './GroupEvent'\nimport { IdentifyEvent } from './IdentifyEvent'\nimport { PageViewEvent } from './PageViewEvent'\nimport { ScreenViewEvent } from './ScreenViewEvent'\nimport { TrackEvent } from './TrackEvent'\n\n/**\n * Zod schema describing any supported experience/personalization event.\n *\n * @remarks\n * This discriminated union aggregates all event types used by the\n * personalization/experience tracking system.\n */\nexport const ExperienceEvent = z.discriminatedUnion('type', [\n AliasEvent,\n ComponentViewEvent,\n GroupEvent,\n IdentifyEvent,\n PageViewEvent,\n ScreenViewEvent,\n TrackEvent,\n])\n\n/**\n * TypeScript type inferred from {@link ExperienceEvent}.\n */\nexport type ExperienceEvent = z.infer<typeof ExperienceEvent>\n\n/**\n * Union of all possible `type` values for {@link ExperienceEvent}.\n */\nexport type ExperienceEventType = ExperienceEvent['type']\n\n/**\n * Zod schema describing an array of {@link ExperienceEvent} items.\n */\nexport const ExperienceEventArray = z.array(ExperienceEvent)\n\n/**\n * TypeScript type inferred from {@link ExperienceEventArray}.\n */\nexport type ExperienceEventArray = z.infer<typeof ExperienceEventArray>\n","import * as z from 'zod/mini'\nimport { ExperienceEventArray } from './event'\n\n/**\n * Zod schema describing optional configuration for an experience request.\n *\n * @remarks\n * These options can be used to enable or filter specific features when\n * evaluating experiences.\n */\nexport const ExperienceRequestOptions = z.object({\n /**\n * Features or capabilities to enable for this request.\n */\n features: z.optional(z.array(z.string())),\n})\n\n/**\n * TypeScript type inferred from {@link ExperienceRequestOptions}.\n */\nexport type ExperienceRequestOptions = z.infer<typeof ExperienceRequestOptions>\n\n/**\n * Zod schema describing the data payload for an experience request.\n *\n * @remarks\n * Contains the list of events to be evaluated plus optional request\n * configuration.\n */\nexport const ExperienceRequestData = z.object({\n /**\n * Experience events that should be evaluated by the Experience API.\n *\n * @remarks\n * Must contain at least one event.\n */\n events: ExperienceEventArray.check(z.minLength(1)),\n\n /**\n * Optional configuration for this experience request.\n */\n options: z.optional(ExperienceRequestOptions),\n})\n\n/**\n * TypeScript type inferred from {@link ExperienceRequestData}.\n */\nexport type ExperienceRequestData = z.infer<typeof ExperienceRequestData>\n","import * as z from 'zod/mini'\n\n/**\n * Zod schema describing a selected personalization outcome for a user.\n *\n * @remarks\n * Represents the result of choosing a specific variant for a given\n * experience, along with additional metadata such as whether the\n * selection is sticky.\n */\nexport const SelectedPersonalization = z.object({\n /**\n * Identifier of the personalization or experiment experience.\n */\n experienceId: z.string(),\n\n /**\n * Index of the selected variant within the experience configuration.\n *\n * @remarks\n * Typically corresponds to the index of the selected {@link PersonalizationConfig } entry.\n */\n variantIndex: z.number(),\n\n /**\n * Mapping of baseline entry IDs to their selected variant entry IDs.\n *\n * @remarks\n * The keys are component identifiers and the values are the\n * identifiers of the selected variant for that component.\n */\n variants: z.record(z.string(), z.string()),\n\n /**\n * Indicates whether this personalization selection is sticky for the user.\n *\n * @defaultValue false\n *\n * @remarks\n * Sticky selections should be reused on subsequent requests for the\n * same user, rather than re-allocating a new variant.\n */\n sticky: z.optional(z.prefault(z.boolean(), false)),\n})\n\n/**\n * TypeScript type inferred from {@link SelectedPersonalization}.\n */\nexport type SelectedPersonalization = z.infer<typeof SelectedPersonalization>\n\n/**\n * Zod schema describing an array of {@link SelectedPersonalization} items.\n *\n * @remarks\n * Useful when multiple experiences are evaluated at once.\n */\nexport const SelectedPersonalizationArray = z.array(SelectedPersonalization)\n\n/**\n * TypeScript type inferred from {@link SelectedPersonalizationArray}.\n */\nexport type SelectedPersonalizationArray = z.infer<typeof SelectedPersonalizationArray>\n","import * as z from 'zod/mini'\nimport { ChangeArray } from './change'\nimport { SelectedPersonalizationArray } from './personalization'\nimport { Profile } from './profile'\nimport { ResponseEnvelope } from './ResponseEnvelope'\n\n/**\n * Zod schema describing the `data` payload of a standard Experience API response.\n *\n * @remarks\n * Contains the evaluated profile, selected personalizations, and computed\n * changes that should be applied on the client.\n */\nexport const ExperienceData = z.object({\n /**\n * Profile associated with the evaluated events.\n */\n profile: Profile,\n\n /**\n * Selected experiences and variants for the profile.\n *\n * @see {@link SelectedPersonalizationArray}\n */\n experiences: SelectedPersonalizationArray,\n\n /**\n * Currently used for Custom Flags.\n *\n * @see {@link ChangeArray}\n */\n changes: ChangeArray,\n})\n\n/**\n * TypeScript type inferred from {@link ExperienceData}.\n */\nexport type ExperienceData = z.infer<typeof ExperienceData>\n\n/**\n * Zod schema describing a full Experience API response.\n *\n * @remarks\n * Extends {@link ResponseEnvelope} with {@link ExperienceData} as the `data` payload.\n */\nexport const ExperienceResponse = z.extend(ResponseEnvelope, { data: ExperienceData })\n\n/**\n * TypeScript type inferred from {@link ExperienceResponse}.\n */\nexport type ExperienceResponse = z.infer<typeof ExperienceResponse>\n\n/**\n * Optimization data shape used for compatibility outside the API adapter.\n *\n * @remarks\n * This type mirrors {@link ExperienceData} but replaces the `experiences`\n * field with `personalizations` while preserving the rest of the structure.\n */\nexport type OptimizationData = Omit<ExperienceData, 'experiences'> & {\n /**\n * Selected personalizations for the profile.\n */\n personalizations: SelectedPersonalizationArray\n}\n","import * as z from 'zod/mini'\nimport { ComponentViewEvent } from '../../experience/event'\n\n/**\n * Zod schema describing an Insights event.\n *\n * @remarks\n * Currently, Insights events are limited to {@link ComponentViewEvent},\n * but this discriminated union can be extended with additional event\n * types in the future.\n */\nexport const InsightsEvent = z.discriminatedUnion('type', [ComponentViewEvent])\n\n/**\n * TypeScript type inferred from {@link InsightsEvent}.\n */\nexport type InsightsEvent = z.infer<typeof InsightsEvent>\n\n/**\n * Union of all possible `type` values for {@link InsightsEvent}.\n */\nexport type InsightsEventType = InsightsEvent['type']\n\n/**\n * Zod schema describing an array of {@link InsightsEvent} items.\n */\nexport const InsightsEventArray = z.array(InsightsEvent)\n\n/**\n * TypeScript type inferred from {@link InsightsEventArray}.\n */\nexport type InsightsEventArray = z.infer<typeof InsightsEventArray>\n","import * as z from 'zod/mini'\nimport { PartialProfile } from '../../experience/profile'\nimport { InsightsEventArray } from './InsightsEvent'\n\n/**\n * Zod schema describing a batched Insights event payload.\n *\n * @remarks\n * Combines a {@link PartialProfile} with one or more Insights events\n * to be sent to the Contentful Insights API.\n */\nexport const BatchInsightsEvent = z.object({\n /**\n * Partial profile information used to associate events with a user.\n *\n * @see PartialProfile\n */\n profile: PartialProfile,\n\n /**\n * Insights events that should be recorded for this profile.\n *\n * @see InsightsEventArray\n */\n events: InsightsEventArray,\n})\n\n/**\n * TypeScript type inferred from {@link BatchInsightsEvent}.\n */\nexport type BatchInsightsEvent = z.infer<typeof BatchInsightsEvent>\n\n/**\n * Zod schema describing an array of {@link BatchInsightsEvent} items.\n *\n * @remarks\n * Useful when sending multiple profile/event batches in a single request.\n */\nexport const BatchInsightsEventArray = z.array(BatchInsightsEvent)\n\n/**\n * TypeScript type inferred from {@link BatchInsightsEventArray}.\n */\nexport type BatchInsightsEventArray = z.infer<typeof BatchInsightsEventArray>\n"],"names":["EntryFields","z","Link","ContentTypeLink","EnvironmentLink","SpaceLink","TagLink","EntrySys","CtflEntry","isEntry","entry","AudienceEntryFields","AudienceEntry","MergeTagEntry","EntryReplacementVariant","isEntryReplacementVariant","variant","EntryReplacementComponent","isEntryReplacementComponent","component","undefined","InlineVariableVariant","InlineVariableComponentValueType","InlineVariableComponent","isInlineVariableComponent","PersonalizationComponent","PersonalizationComponentArray","PersonalizationConfig","PersonalizationType","PersonalizationFields","v","PersonalizationEntry","isPersonalizationEntry","PersonalizationEntryArray","PersonalizedEntry","isPersonalizedEntry","App","Campaign","Channel","Dictionary","COUNTRY_CODE_LENGTH","Coordinates","GeoLocation","Library","Page","Properties","Screen","Traits","SessionStatistics","Profile","PartialProfile","ResponseEnvelope","BatchExperienceData","BatchExperienceResponse","ChangeType","ChangeBase","VariableChangeValue","UnknownChange","VariableChange","Change","ChangeArray","UniversalEventContext","UniversalEventProperties","AliasEvent","ComponentViewEvent","GroupEvent","IdentifyEvent","PageEventContext","PageViewEvent","ScreenEventContext","ScreenViewEvent","TrackEvent","Anon","BatchExperienceEvent","BatchExperienceEventArray","ExperienceEvent","ExperienceEventArray","ExperienceRequestOptions","ExperienceRequestData","SelectedPersonalization","SelectedPersonalizationArray","ExperienceData","ExperienceResponse","InsightsEvent","InsightsEventArray","BatchInsightsEvent","BatchInsightsEventArray"],"mappings":";AAWO,MAAMA,cAAc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hF,OAAS;IAIrC,SAASgD;IAOT,aAAa+B;IAOb,SAASpB;AACX;AAaO,MAAMsB,qBAAqBjF,OAASkD,kBAAkB;IAAE,MAAM8B;AAAe;AClC7E,MAAME,gBAAgBlF,mBAAqB,QAAQ;IAAC+D;CAAmB;AAevE,MAAMoB,qBAAqBnF,MAAQkF;ACfnC,MAAME,qBAAqBpF,OAAS;IAMzC,SAASiD;IAOT,QAAQkC;AACV;AAaO,MAAME,0BAA0BrF,MAAQoF"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema describing a batched Insights event payload.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Combines a {@link PartialProfile} with one or more Insights events
|
|
7
|
+
* to be sent to the Contentful Insights API.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BatchInsightsEvent: z.ZodMiniObject<{
|
|
10
|
+
/**
|
|
11
|
+
* Partial profile information used to associate events with a user.
|
|
12
|
+
*
|
|
13
|
+
* @see PartialProfile
|
|
14
|
+
*/
|
|
15
|
+
profile: z.ZodMiniObject<{
|
|
16
|
+
id: z.ZodMiniString<string>;
|
|
17
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>;
|
|
18
|
+
/**
|
|
19
|
+
* Insights events that should be recorded for this profile.
|
|
20
|
+
*
|
|
21
|
+
* @see InsightsEventArray
|
|
22
|
+
*/
|
|
23
|
+
events: z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
24
|
+
channel: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"mobile">, z.ZodMiniLiteral<"server">, z.ZodMiniLiteral<"web">]>;
|
|
25
|
+
context: z.ZodMiniObject<{
|
|
26
|
+
app: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
27
|
+
name: z.ZodMiniString<string>;
|
|
28
|
+
version: z.ZodMiniString<string>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
campaign: z.ZodMiniObject<{
|
|
31
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
32
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
33
|
+
medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
34
|
+
term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
35
|
+
content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
gdpr: z.ZodMiniObject<{
|
|
38
|
+
isConsentGiven: z.ZodMiniBoolean<boolean>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
library: z.ZodMiniObject<{
|
|
41
|
+
name: z.ZodMiniString<string>;
|
|
42
|
+
version: z.ZodMiniString<string>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
locale: z.ZodMiniString<string>;
|
|
45
|
+
location: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
46
|
+
coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
47
|
+
latitude: z.ZodMiniNumber<number>;
|
|
48
|
+
longitude: z.ZodMiniNumber<number>;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
51
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
52
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
53
|
+
regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
54
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
55
|
+
countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
56
|
+
continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
57
|
+
timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
60
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
61
|
+
path: z.ZodMiniString<string>;
|
|
62
|
+
query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
63
|
+
referrer: z.ZodMiniString<string>;
|
|
64
|
+
search: z.ZodMiniString<string>;
|
|
65
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
66
|
+
url: z.ZodMiniString<string>;
|
|
67
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
68
|
+
screen: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
69
|
+
name: z.ZodMiniString<string>;
|
|
70
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
messageId: z.ZodMiniString<string>;
|
|
73
|
+
originalTimestamp: z.iso.ZodMiniISODateTime;
|
|
74
|
+
sentAt: z.iso.ZodMiniISODateTime;
|
|
75
|
+
timestamp: z.iso.ZodMiniISODateTime;
|
|
76
|
+
userId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
77
|
+
type: z.ZodMiniLiteral<"component">;
|
|
78
|
+
componentType: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"Entry">, z.ZodMiniLiteral<"Variable">]>;
|
|
79
|
+
componentId: z.ZodMiniString<string>;
|
|
80
|
+
experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
81
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
82
|
+
}, z.core.$strip>], "type">>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
/**
|
|
85
|
+
* TypeScript type inferred from {@link BatchInsightsEvent}.
|
|
86
|
+
*/
|
|
87
|
+
export type BatchInsightsEvent = z.infer<typeof BatchInsightsEvent>;
|
|
88
|
+
/**
|
|
89
|
+
* Zod schema describing an array of {@link BatchInsightsEvent} items.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Useful when sending multiple profile/event batches in a single request.
|
|
93
|
+
*/
|
|
94
|
+
export declare const BatchInsightsEventArray: z.ZodMiniArray<z.ZodMiniObject<{
|
|
95
|
+
/**
|
|
96
|
+
* Partial profile information used to associate events with a user.
|
|
97
|
+
*
|
|
98
|
+
* @see PartialProfile
|
|
99
|
+
*/
|
|
100
|
+
profile: z.ZodMiniObject<{
|
|
101
|
+
id: z.ZodMiniString<string>;
|
|
102
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>;
|
|
103
|
+
/**
|
|
104
|
+
* Insights events that should be recorded for this profile.
|
|
105
|
+
*
|
|
106
|
+
* @see InsightsEventArray
|
|
107
|
+
*/
|
|
108
|
+
events: z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
109
|
+
channel: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"mobile">, z.ZodMiniLiteral<"server">, z.ZodMiniLiteral<"web">]>;
|
|
110
|
+
context: z.ZodMiniObject<{
|
|
111
|
+
app: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
112
|
+
name: z.ZodMiniString<string>;
|
|
113
|
+
version: z.ZodMiniString<string>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
campaign: z.ZodMiniObject<{
|
|
116
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
117
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
118
|
+
medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
119
|
+
term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
120
|
+
content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
gdpr: z.ZodMiniObject<{
|
|
123
|
+
isConsentGiven: z.ZodMiniBoolean<boolean>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
library: z.ZodMiniObject<{
|
|
126
|
+
name: z.ZodMiniString<string>;
|
|
127
|
+
version: z.ZodMiniString<string>;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
locale: z.ZodMiniString<string>;
|
|
130
|
+
location: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
131
|
+
coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
132
|
+
latitude: z.ZodMiniNumber<number>;
|
|
133
|
+
longitude: z.ZodMiniNumber<number>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
136
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
137
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
138
|
+
regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
139
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
140
|
+
countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
141
|
+
continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
142
|
+
timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
145
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
146
|
+
path: z.ZodMiniString<string>;
|
|
147
|
+
query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
148
|
+
referrer: z.ZodMiniString<string>;
|
|
149
|
+
search: z.ZodMiniString<string>;
|
|
150
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
151
|
+
url: z.ZodMiniString<string>;
|
|
152
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
153
|
+
screen: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
154
|
+
name: z.ZodMiniString<string>;
|
|
155
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
messageId: z.ZodMiniString<string>;
|
|
158
|
+
originalTimestamp: z.iso.ZodMiniISODateTime;
|
|
159
|
+
sentAt: z.iso.ZodMiniISODateTime;
|
|
160
|
+
timestamp: z.iso.ZodMiniISODateTime;
|
|
161
|
+
userId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
162
|
+
type: z.ZodMiniLiteral<"component">;
|
|
163
|
+
componentType: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"Entry">, z.ZodMiniLiteral<"Variable">]>;
|
|
164
|
+
componentId: z.ZodMiniString<string>;
|
|
165
|
+
experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
166
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
167
|
+
}, z.core.$strip>], "type">>;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
/**
|
|
170
|
+
* TypeScript type inferred from {@link BatchInsightsEventArray}.
|
|
171
|
+
*/
|
|
172
|
+
export type BatchInsightsEventArray = z.infer<typeof BatchInsightsEventArray>;
|
|
173
|
+
//# sourceMappingURL=BatchInsightsEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchInsightsEvent.d.ts","sourceRoot":"","sources":["../../../src/insights/event/BatchInsightsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAI7B;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;IAC7B;;;;OAIG;;;;IAGH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEH,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;IA1BlC;;;;OAIG;;;;IAGH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAe6D,CAAA;AAElE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { PartialProfile } from '../../experience/profile';
|
|
3
|
+
import { InsightsEventArray } from './InsightsEvent';
|
|
4
|
+
/**
|
|
5
|
+
* Zod schema describing a batched Insights event payload.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Combines a {@link PartialProfile} with one or more Insights events
|
|
9
|
+
* to be sent to the Contentful Insights API.
|
|
10
|
+
*/
|
|
11
|
+
export const BatchInsightsEvent = z.object({
|
|
12
|
+
/**
|
|
13
|
+
* Partial profile information used to associate events with a user.
|
|
14
|
+
*
|
|
15
|
+
* @see PartialProfile
|
|
16
|
+
*/
|
|
17
|
+
profile: PartialProfile,
|
|
18
|
+
/**
|
|
19
|
+
* Insights events that should be recorded for this profile.
|
|
20
|
+
*
|
|
21
|
+
* @see InsightsEventArray
|
|
22
|
+
*/
|
|
23
|
+
events: InsightsEventArray,
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Zod schema describing an array of {@link BatchInsightsEvent} items.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Useful when sending multiple profile/event batches in a single request.
|
|
30
|
+
*/
|
|
31
|
+
export const BatchInsightsEventArray = z.array(BatchInsightsEvent);
|
|
32
|
+
//# sourceMappingURL=BatchInsightsEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchInsightsEvent.js","sourceRoot":"","sources":["../../../src/insights/event/BatchInsightsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC;;;;OAIG;IACH,OAAO,EAAE,cAAc;IAEvB;;;;OAIG;IACH,MAAM,EAAE,kBAAkB;CAC3B,CAAC,CAAA;AAOF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema describing an Insights event.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Currently, Insights events are limited to {@link ComponentViewEvent},
|
|
7
|
+
* but this discriminated union can be extended with additional event
|
|
8
|
+
* types in the future.
|
|
9
|
+
*/
|
|
10
|
+
export declare const InsightsEvent: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
11
|
+
channel: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"mobile">, z.ZodMiniLiteral<"server">, z.ZodMiniLiteral<"web">]>;
|
|
12
|
+
context: z.ZodMiniObject<{
|
|
13
|
+
app: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
14
|
+
name: z.ZodMiniString<string>;
|
|
15
|
+
version: z.ZodMiniString<string>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
campaign: z.ZodMiniObject<{
|
|
18
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
19
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
20
|
+
medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
21
|
+
term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
22
|
+
content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
gdpr: z.ZodMiniObject<{
|
|
25
|
+
isConsentGiven: z.ZodMiniBoolean<boolean>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
library: z.ZodMiniObject<{
|
|
28
|
+
name: z.ZodMiniString<string>;
|
|
29
|
+
version: z.ZodMiniString<string>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
locale: z.ZodMiniString<string>;
|
|
32
|
+
location: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
33
|
+
coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
34
|
+
latitude: z.ZodMiniNumber<number>;
|
|
35
|
+
longitude: z.ZodMiniNumber<number>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
38
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
39
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
40
|
+
regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
41
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
42
|
+
countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
43
|
+
continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
44
|
+
timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
47
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
48
|
+
path: z.ZodMiniString<string>;
|
|
49
|
+
query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
50
|
+
referrer: z.ZodMiniString<string>;
|
|
51
|
+
search: z.ZodMiniString<string>;
|
|
52
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
53
|
+
url: z.ZodMiniString<string>;
|
|
54
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
55
|
+
screen: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
56
|
+
name: z.ZodMiniString<string>;
|
|
57
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
messageId: z.ZodMiniString<string>;
|
|
60
|
+
originalTimestamp: z.iso.ZodMiniISODateTime;
|
|
61
|
+
sentAt: z.iso.ZodMiniISODateTime;
|
|
62
|
+
timestamp: z.iso.ZodMiniISODateTime;
|
|
63
|
+
userId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
64
|
+
type: z.ZodMiniLiteral<"component">;
|
|
65
|
+
componentType: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"Entry">, z.ZodMiniLiteral<"Variable">]>;
|
|
66
|
+
componentId: z.ZodMiniString<string>;
|
|
67
|
+
experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
68
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
69
|
+
}, z.core.$strip>], "type">;
|
|
70
|
+
/**
|
|
71
|
+
* TypeScript type inferred from {@link InsightsEvent}.
|
|
72
|
+
*/
|
|
73
|
+
export type InsightsEvent = z.infer<typeof InsightsEvent>;
|
|
74
|
+
/**
|
|
75
|
+
* Union of all possible `type` values for {@link InsightsEvent}.
|
|
76
|
+
*/
|
|
77
|
+
export type InsightsEventType = InsightsEvent['type'];
|
|
78
|
+
/**
|
|
79
|
+
* Zod schema describing an array of {@link InsightsEvent} items.
|
|
80
|
+
*/
|
|
81
|
+
export declare const InsightsEventArray: z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
82
|
+
channel: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"mobile">, z.ZodMiniLiteral<"server">, z.ZodMiniLiteral<"web">]>;
|
|
83
|
+
context: z.ZodMiniObject<{
|
|
84
|
+
app: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
85
|
+
name: z.ZodMiniString<string>;
|
|
86
|
+
version: z.ZodMiniString<string>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
campaign: z.ZodMiniObject<{
|
|
89
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
90
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
91
|
+
medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
92
|
+
term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
93
|
+
content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
gdpr: z.ZodMiniObject<{
|
|
96
|
+
isConsentGiven: z.ZodMiniBoolean<boolean>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
library: z.ZodMiniObject<{
|
|
99
|
+
name: z.ZodMiniString<string>;
|
|
100
|
+
version: z.ZodMiniString<string>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
locale: z.ZodMiniString<string>;
|
|
103
|
+
location: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
104
|
+
coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
105
|
+
latitude: z.ZodMiniNumber<number>;
|
|
106
|
+
longitude: z.ZodMiniNumber<number>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
109
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
110
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
111
|
+
regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
112
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
113
|
+
countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
114
|
+
continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
115
|
+
timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
118
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
119
|
+
path: z.ZodMiniString<string>;
|
|
120
|
+
query: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
121
|
+
referrer: z.ZodMiniString<string>;
|
|
122
|
+
search: z.ZodMiniString<string>;
|
|
123
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
124
|
+
url: z.ZodMiniString<string>;
|
|
125
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
126
|
+
screen: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
127
|
+
name: z.ZodMiniString<string>;
|
|
128
|
+
}, z.core.$catchall<z.ZodMiniJSONSchema>>>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
messageId: z.ZodMiniString<string>;
|
|
131
|
+
originalTimestamp: z.iso.ZodMiniISODateTime;
|
|
132
|
+
sentAt: z.iso.ZodMiniISODateTime;
|
|
133
|
+
timestamp: z.iso.ZodMiniISODateTime;
|
|
134
|
+
userId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
135
|
+
type: z.ZodMiniLiteral<"component">;
|
|
136
|
+
componentType: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"Entry">, z.ZodMiniLiteral<"Variable">]>;
|
|
137
|
+
componentId: z.ZodMiniString<string>;
|
|
138
|
+
experienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
139
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
140
|
+
}, z.core.$strip>], "type">>;
|
|
141
|
+
/**
|
|
142
|
+
* TypeScript type inferred from {@link InsightsEventArray}.
|
|
143
|
+
*/
|
|
144
|
+
export type InsightsEventArray = z.infer<typeof InsightsEventArray>;
|
|
145
|
+
//# sourceMappingURL=InsightsEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightsEvent.d.ts","sourceRoot":"","sources":["../../../src/insights/event/InsightsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAG7B;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAqD,CAAA;AAE/E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEzD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;AAErD;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAyB,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { ComponentViewEvent } from '../../experience/event';
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema describing an Insights event.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Currently, Insights events are limited to {@link ComponentViewEvent},
|
|
8
|
+
* but this discriminated union can be extended with additional event
|
|
9
|
+
* types in the future.
|
|
10
|
+
*/
|
|
11
|
+
export const InsightsEvent = z.discriminatedUnion('type', [ComponentViewEvent]);
|
|
12
|
+
/**
|
|
13
|
+
* Zod schema describing an array of {@link InsightsEvent} items.
|
|
14
|
+
*/
|
|
15
|
+
export const InsightsEventArray = z.array(InsightsEvent);
|
|
16
|
+
//# sourceMappingURL=InsightsEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightsEvent.js","sourceRoot":"","sources":["../../../src/insights/event/InsightsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAY/E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/insights/event/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/insights/event/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/insights/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/insights/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contentful/optimization-api-schemas",
|
|
3
|
+
"version": "0.1.0-alpha",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/**/*"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"contentful": "^11.7.19",
|
|
22
|
+
"zod": "^4.1.5",
|
|
23
|
+
"@contentful/optimization-api-schemas": "0.1.0-alpha"
|
|
24
|
+
}
|
|
25
|
+
}
|