@shware/analytics 3.8.1 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schema/index.cjs +32 -0
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +130 -1
- package/dist/schema/index.d.cts.map +1 -1
- package/dist/schema/index.d.mts +130 -1
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/schema/index.mjs +33 -2
- package/dist/schema/index.mjs.map +1 -1
- package/dist/third-parties/google-analytics.cjs +2 -2
- package/dist/third-parties/google-analytics.cjs.map +1 -1
- package/dist/third-parties/google-analytics.d.cts +2 -2
- package/dist/third-parties/google-analytics.d.cts.map +1 -1
- package/dist/third-parties/google-analytics.d.mts +2 -2
- package/dist/third-parties/google-analytics.d.mts.map +1 -1
- package/dist/third-parties/google-analytics.mjs +2 -2
- package/dist/third-parties/google-analytics.mjs.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.cjs +2 -2
- package/dist/third-parties/linkedin-insight-tag.cjs.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.cts +2 -2
- package/dist/third-parties/linkedin-insight-tag.d.cts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.mts +2 -2
- package/dist/third-parties/linkedin-insight-tag.d.mts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.mjs +2 -2
- package/dist/third-parties/linkedin-insight-tag.mjs.map +1 -1
- package/dist/third-parties/meta-pixel.cjs +4 -4
- package/dist/third-parties/meta-pixel.cjs.map +1 -1
- package/dist/third-parties/meta-pixel.d.cts +2 -2
- package/dist/third-parties/meta-pixel.d.cts.map +1 -1
- package/dist/third-parties/meta-pixel.d.mts +2 -2
- package/dist/third-parties/meta-pixel.d.mts.map +1 -1
- package/dist/third-parties/meta-pixel.mjs +4 -4
- package/dist/third-parties/meta-pixel.mjs.map +1 -1
- package/dist/third-parties/openai-pixel.cjs +3 -3
- package/dist/third-parties/openai-pixel.cjs.map +1 -1
- package/dist/third-parties/openai-pixel.d.cts +2 -2
- package/dist/third-parties/openai-pixel.d.cts.map +1 -1
- package/dist/third-parties/openai-pixel.d.mts +2 -2
- package/dist/third-parties/openai-pixel.d.mts.map +1 -1
- package/dist/third-parties/openai-pixel.mjs +3 -3
- package/dist/third-parties/openai-pixel.mjs.map +1 -1
- package/dist/third-parties/posthog.cjs +2 -2
- package/dist/third-parties/posthog.cjs.map +1 -1
- package/dist/third-parties/posthog.d.cts +2 -2
- package/dist/third-parties/posthog.d.cts.map +1 -1
- package/dist/third-parties/posthog.d.mts +2 -2
- package/dist/third-parties/posthog.d.mts.map +1 -1
- package/dist/third-parties/posthog.mjs +2 -2
- package/dist/third-parties/posthog.mjs.map +1 -1
- package/dist/third-parties/reddit-pixel.cjs +3 -3
- package/dist/third-parties/reddit-pixel.cjs.map +1 -1
- package/dist/third-parties/reddit-pixel.d.cts +2 -2
- package/dist/third-parties/reddit-pixel.d.cts.map +1 -1
- package/dist/third-parties/reddit-pixel.d.mts +2 -2
- package/dist/third-parties/reddit-pixel.d.mts.map +1 -1
- package/dist/third-parties/reddit-pixel.mjs +3 -3
- package/dist/third-parties/reddit-pixel.mjs.map +1 -1
- package/dist/visitor/index.cjs +6 -5
- package/dist/visitor/index.cjs.map +1 -1
- package/dist/visitor/index.d.cts +3 -2
- package/dist/visitor/index.d.cts.map +1 -1
- package/dist/visitor/index.d.mts +3 -2
- package/dist/visitor/index.d.mts.map +1 -1
- package/dist/visitor/index.mjs +6 -5
- package/dist/visitor/index.mjs.map +1 -1
- package/dist/visitor/types.d.cts +2 -8
- package/dist/visitor/types.d.cts.map +1 -1
- package/dist/visitor/types.d.mts +2 -8
- package/dist/visitor/types.d.mts.map +1 -1
- package/package.json +2 -2
package/dist/schema/index.cjs
CHANGED
|
@@ -122,9 +122,40 @@ const createVisitorSchema = (0, zod_mini.object)({
|
|
|
122
122
|
(0, zod_mini.null)()
|
|
123
123
|
])).check((0, zod_mini.refine)((data) => Object.keys(data).length <= 64)))
|
|
124
124
|
});
|
|
125
|
+
const emailValue = (0, zod_mini.pipe)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.toLowerCase)(), (0, zod_mini.maxLength)(320)), (0, zod_mini.email)());
|
|
126
|
+
/** E.164: a plus sign (+) prefix, country code, then digits only, no dashes/parens/spaces. */
|
|
127
|
+
const phoneValue = (0, zod_mini.pipe)((0, zod_mini.string)().check((0, zod_mini.trim)()), (0, zod_mini.e164)());
|
|
128
|
+
const addressValue = (0, zod_mini.object)({
|
|
129
|
+
first_name: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.maxLength)(128))),
|
|
130
|
+
last_name: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.maxLength)(128))),
|
|
131
|
+
street: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.maxLength)(256))),
|
|
132
|
+
city: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.maxLength)(128))),
|
|
133
|
+
/** User province, state, or region. Example: `Hampshire` */
|
|
134
|
+
region: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.maxLength)(128))),
|
|
135
|
+
postal_code: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.maxLength)(32))),
|
|
136
|
+
/** 2-letter country code, per the ISO 3166-1 alpha-2 standard. Example: `UK` */
|
|
137
|
+
country: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.toUpperCase)(), (0, zod_mini.regex)(/^[A-Z]{2}$/)))
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* User-provided data (UPD) used for enhanced conversions, Customer Match, and demographics.
|
|
141
|
+
* Values are sent unhashed; Google normalizes and hashes them before they reach its servers.
|
|
142
|
+
*
|
|
143
|
+
* Multiple values may be sent to increase the match rate: up to 3 emails, 3 phone numbers, and
|
|
144
|
+
* 2 addresses.
|
|
145
|
+
*
|
|
146
|
+
* @see https://support.google.com/analytics/answer/14078702
|
|
147
|
+
* @see https://support.google.com/google-ads/answer/13258081
|
|
148
|
+
*/
|
|
149
|
+
const userProvidedDataSchema = (0, zod_mini.object)({
|
|
150
|
+
email: (0, zod_mini.optional)((0, zod_mini.union)([emailValue, (0, zod_mini.array)(emailValue).check((0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(3))])),
|
|
151
|
+
phone_number: (0, zod_mini.optional)((0, zod_mini.union)([phoneValue, (0, zod_mini.array)(phoneValue).check((0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(3))])),
|
|
152
|
+
address: (0, zod_mini.optional)((0, zod_mini.union)([addressValue, (0, zod_mini.array)(addressValue).check((0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(2))]))
|
|
153
|
+
});
|
|
125
154
|
const updateVisitorSchema = (0, zod_mini.object)({
|
|
126
155
|
user_id: (0, zod_mini.optional)((0, zod_mini.uuid)()),
|
|
156
|
+
user_data: (0, zod_mini.optional)(userProvidedDataSchema),
|
|
127
157
|
distinct_id: (0, zod_mini.optional)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(36))),
|
|
158
|
+
tags: tagsSchema,
|
|
128
159
|
properties: (0, zod_mini.optional)((0, zod_mini.record)((0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(128)), (0, zod_mini.union)([
|
|
129
160
|
(0, zod_mini.string)().check((0, zod_mini.maxLength)(512)),
|
|
130
161
|
(0, zod_mini.number)(),
|
|
@@ -192,5 +223,6 @@ exports.createVisitorSchema = createVisitorSchema;
|
|
|
192
223
|
exports.propertiesSchema = propertiesSchema;
|
|
193
224
|
exports.tagsSchema = tagsSchema;
|
|
194
225
|
exports.updateVisitorSchema = updateVisitorSchema;
|
|
226
|
+
exports.userProvidedDataSchema = userProvidedDataSchema;
|
|
195
227
|
|
|
196
228
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["coerce","iso"],"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n enum as _enum,\n null as _null,\n array,\n boolean,\n coerce,\n email,\n iso,\n maxLength,\n minLength,\n number,\n object,\n optional,\n pipe,\n record,\n refine,\n regex,\n string,\n transform,\n trim,\n union,\n url,\n uuid,\n type z,\n} from 'zod/mini';\nimport type { Environment, Platform } from '../track/types';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\nexport const ALL_PLATFORMS = [\n 'ios',\n 'android',\n 'web',\n 'macos',\n 'windows',\n 'linux',\n 'unknown',\n] as const satisfies Platform[];\n\nexport const ALL_ENVIRONMENTS = ['development', 'production'] as const satisfies Environment[];\n\nexport const tagsSchema = object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: _enum(ALL_PLATFORMS),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(number()),\n screen_width: optional(number()),\n screen_height: optional(number()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: _enum(ALL_ENVIRONMENTS),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n page_referrer: optional(string()),\n // app info\n advertising_id: optional(string()),\n install_referrer: optional(string()),\n // Meta Ads\n fbc: optional(string()),\n fbp: optional(string()),\n fbclid: optional(string()),\n ad_id: optional(string()),\n ad_name: optional(string()),\n adset_id: optional(string()),\n adset_name: optional(string()),\n campaign_id: optional(string()),\n campaign_name: optional(string()),\n placement: optional(string()),\n site_source_name: optional(string()),\n // Google Ads\n gclid: optional(string()),\n gclsrc: optional(string()),\n gad_source: optional(string()),\n gad_campaignid: optional(string()),\n // Reddit ads\n rdt_cid: optional(string()),\n rdt_uuid: optional(string()),\n // click ids\n dclid: optional(string()),\n ko_click_id: optional(string()),\n li_fat_id: optional(string()),\n msclkid: optional(string()),\n sccid: optional(string()),\n ttclid: optional(string()),\n twclid: optional(string()),\n wbraid: optional(string()),\n yclid: optional(string()),\n // utm params\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n utm_id: optional(string()),\n utm_source_platform: optional(string()),\n utm_creative_format: optional(string()),\n utm_marketing_tactic: optional(string()),\n});\n\nexport const propertiesSchema = optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n tags: tagsSchema,\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n distinct_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\nconst noEmptyString = pipe(\n string().check(maxLength(256)),\n transform((v) => (v ? v : undefined))\n);\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(noEmptyString),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example, spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(noEmptyString),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(noEmptyString),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example, Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(noEmptyString),\n\n /**\n * Type of creative, for example, display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(noEmptyString),\n\n /**\n * Targeting criteria applied to a campaign, for example, remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(noEmptyString),\n});\n\nexport type CreateTrackEventDTO = z.output<typeof createTrackEventSchema>;\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<typeof createLinkSchema>;\nexport type CreateVisitorDTO = z.output<typeof createVisitorSchema>;\nexport type UpdateVisitorDTO = z.output<typeof updateVisitorSchema>;\n"],"mappings":";;;AA2BA,MAAM,SAAA,GAAA,SAAA,MAAA,EAAA,GAAA,SAAA,OAAA,EAAA,GAAA,SAAA,OAAA,CAEK,CAAC,CAAC,OAAA,GAAA,SAAA,KAAA,CAAW,IAAA,GAAA,SAAA,UAAA,CAAa,CAAC,IAAA,GAAA,SAAA,UAAA,CAAa,GAAG,CAAC,IAAA,GAAA,SAAA,MAAA,CAC7C;sBAAQ,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,GAAG,CAAC;sBAAU;uBAAW;oBAAS;AAAC,CAAC,CACtE,CACF;AAEA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAAmB,CAAC,eAAe,YAAY;AAE5D,MAAa,cAAA,GAAA,SAAA,OAAA,CAAoB;CAC/B,KAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,OAAA,CAAoB,CAAC;CACrB,UAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,OAAA,CAAyB,CAAC;CAC1B,aAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,OAAA,CAA4B,CAAC;CAC7B,UAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,OAAA,CAAyB,CAAC;CAC1B,eAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SAAA,OAAA,CAA8B,CAAC;CAC/B,kBAAA,GAAA,SAAA,SAAA,EAAA,GAAA,SA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A,GAAA,SAAA,OAAA,CACG,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,GAAG,CAAC,IAAA,GAAA,SAAA,UAAA,EAClB,MAAO,IAAI,IAAI,KAAA,CAAU,CACtC;;;;;AAMA,MAAa,oBAAA,GAAA,SAAA,OAAA,CAA0B;;CAErC,MAAA,GAAA,SAAA,IAAA,CAAS,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,CAAC,IAAA,GAAA,SAAA,UAAA,CAAa,IAAI,CAAC;;;;;CAM9C,SAAA,GAAA,SAAA,SAAA,CAAiB,aAAa;;CAG9B,aAAA,GAAA,SAAA,OAAA,CAAmB,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,CAAC,IAAA,GAAA,SAAA,UAAA,CAAa,GAAG,CAAC;;CAGvD,aAAA,GAAA,SAAA,OAAA,CAAmB,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,CAAC,IAAA,GAAA,SAAA,UAAA,CAAa,GAAG,CAAC;;CAGvD,eAAA,GAAA,SAAA,OAAA,CAAqB,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,CAAC,IAAA,GAAA,SAAA,UAAA,CAAa,GAAG,CAAC;;CAGzD,WAAA,GAAA,SAAA,SAAA,CAAmB,aAAa;;;;;;CAOhC,cAAA,GAAA,SAAA,SAAA,CAAsB,aAAa;;;;;;CAOnC,sBAAA,GAAA,SAAA,SAAA,CAA8B,aAAa;;;;;CAM3C,sBAAA,GAAA,SAAA,SAAA,CAA8B,aAAa;;;;;CAM3C,uBAAA,GAAA,SAAA,SAAA,CAA+B,aAAa;AAC9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["coerce","iso"],"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n enum as _enum,\n null as _null,\n array,\n boolean,\n coerce,\n e164,\n email,\n iso,\n maxLength,\n minLength,\n number,\n object,\n optional,\n pipe,\n record,\n refine,\n regex,\n string,\n toLowerCase,\n toUpperCase,\n transform,\n trim,\n union,\n url,\n uuid,\n type z,\n} from 'zod/mini';\nimport type { Environment, Platform } from '../track/types';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\nexport const ALL_PLATFORMS = [\n 'ios',\n 'android',\n 'web',\n 'macos',\n 'windows',\n 'linux',\n 'unknown',\n] as const satisfies Platform[];\n\nexport const ALL_ENVIRONMENTS = ['development', 'production'] as const satisfies Environment[];\n\nexport const tagsSchema = object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: _enum(ALL_PLATFORMS),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(number()),\n screen_width: optional(number()),\n screen_height: optional(number()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: _enum(ALL_ENVIRONMENTS),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n page_referrer: optional(string()),\n // app info\n advertising_id: optional(string()),\n install_referrer: optional(string()),\n // Meta Ads\n fbc: optional(string()),\n fbp: optional(string()),\n fbclid: optional(string()),\n ad_id: optional(string()),\n ad_name: optional(string()),\n adset_id: optional(string()),\n adset_name: optional(string()),\n campaign_id: optional(string()),\n campaign_name: optional(string()),\n placement: optional(string()),\n site_source_name: optional(string()),\n // Google Ads\n gclid: optional(string()),\n gclsrc: optional(string()),\n gad_source: optional(string()),\n gad_campaignid: optional(string()),\n // Reddit ads\n rdt_cid: optional(string()),\n rdt_uuid: optional(string()),\n // click ids\n dclid: optional(string()),\n ko_click_id: optional(string()),\n li_fat_id: optional(string()),\n msclkid: optional(string()),\n sccid: optional(string()),\n ttclid: optional(string()),\n twclid: optional(string()),\n wbraid: optional(string()),\n yclid: optional(string()),\n // utm params\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n utm_id: optional(string()),\n utm_source_platform: optional(string()),\n utm_creative_format: optional(string()),\n utm_marketing_tactic: optional(string()),\n});\n\nexport const propertiesSchema = optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n tags: tagsSchema,\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nconst emailValue = pipe(string().check(trim(), toLowerCase(), maxLength(320)), email());\n\n/** E.164: a plus sign (+) prefix, country code, then digits only, no dashes/parens/spaces. */\nconst phoneValue = pipe(string().check(trim()), e164());\n\nconst addressValue = object({\n first_name: optional(string().check(trim(), maxLength(128))),\n last_name: optional(string().check(trim(), maxLength(128))),\n street: optional(string().check(trim(), maxLength(256))),\n city: optional(string().check(trim(), maxLength(128))),\n /** User province, state, or region. Example: `Hampshire` */\n region: optional(string().check(trim(), maxLength(128))),\n postal_code: optional(string().check(trim(), maxLength(32))),\n /** 2-letter country code, per the ISO 3166-1 alpha-2 standard. Example: `UK` */\n country: optional(string().check(trim(), toUpperCase(), regex(/^[A-Z]{2}$/))),\n});\n\n/**\n * User-provided data (UPD) used for enhanced conversions, Customer Match, and demographics.\n * Values are sent unhashed; Google normalizes and hashes them before they reach its servers.\n *\n * Multiple values may be sent to increase the match rate: up to 3 emails, 3 phone numbers, and\n * 2 addresses.\n *\n * @see https://support.google.com/analytics/answer/14078702\n * @see https://support.google.com/google-ads/answer/13258081\n */\nexport const userProvidedDataSchema = object({\n email: optional(union([emailValue, array(emailValue).check(minLength(1), maxLength(3))])),\n phone_number: optional(union([phoneValue, array(phoneValue).check(minLength(1), maxLength(3))])),\n address: optional(union([addressValue, array(addressValue).check(minLength(1), maxLength(2))])),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n user_data: optional(userProvidedDataSchema),\n distinct_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n tags: tagsSchema,\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\nconst noEmptyString = pipe(\n string().check(maxLength(256)),\n transform((v) => (v ? v : undefined))\n);\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(noEmptyString),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example, spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(noEmptyString),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(noEmptyString),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example, Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(noEmptyString),\n\n /**\n * Type of creative, for example, display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(noEmptyString),\n\n /**\n * Targeting criteria applied to a campaign, for example, remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(noEmptyString),\n});\n\nexport type CreateTrackEventDTO = z.output<typeof createTrackEventSchema>;\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<typeof createLinkSchema>;\nexport type CreateVisitorDTO = z.output<typeof createVisitorSchema>;\nexport type UserProvidedDataDTO = z.output<typeof userProvidedDataSchema>;\nexport type UpdateVisitorDTO = z.output<typeof updateVisitorSchema>;\n"],"mappings":";;;AA8BA,MAAM,SAAA,GAAA,SAAA,MAAA,EAAA,GAAA,SAAA,OAAA,EAAA,GAAA,SAAA,OAAA,CAEK,CAAC,CAAC,OAAA,GAAA,SAAA,KAAA,CAAW,IAAA,GAAA,SAAA,UAAA,CAAa,CAAC,IAAA,GAAA,SAAA,UAAA,CAAa,GAAG,CAAC,IAAA,GAAA,SAAA,MAAA,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A,CAAa,GAAG,CAAC;;CAGzD,WAAA,GAAA,SAAA,SAAA,CAAmB,aAAa;;;;;;CAOhC,cAAA,GAAA,SAAA,SAAA,CAAsB,aAAa;;;;;;CAOnC,sBAAA,GAAA,SAAA,SAAA,CAA8B,aAAa;;;;;CAM3C,sBAAA,GAAA,SAAA,SAAA,CAA8B,aAAa;;;;;CAM3C,uBAAA,GAAA,SAAA,SAAA,CAA+B,aAAa;AAC9C,CAAC"}
|
package/dist/schema/index.d.cts
CHANGED
|
@@ -365,9 +365,137 @@ declare const createVisitorSchema: z.ZodMiniObject<{
|
|
|
365
365
|
}, z.core.$strip>;
|
|
366
366
|
properties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull]>>>;
|
|
367
367
|
}, z.core.$strip>;
|
|
368
|
+
/**
|
|
369
|
+
* User-provided data (UPD) used for enhanced conversions, Customer Match, and demographics.
|
|
370
|
+
* Values are sent unhashed; Google normalizes and hashes them before they reach its servers.
|
|
371
|
+
*
|
|
372
|
+
* Multiple values may be sent to increase the match rate: up to 3 emails, 3 phone numbers, and
|
|
373
|
+
* 2 addresses.
|
|
374
|
+
*
|
|
375
|
+
* @see https://support.google.com/analytics/answer/14078702
|
|
376
|
+
* @see https://support.google.com/google-ads/answer/13258081
|
|
377
|
+
*/
|
|
378
|
+
declare const userProvidedDataSchema: z.ZodMiniObject<{
|
|
379
|
+
email: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>>]>>;
|
|
380
|
+
phone_number: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>>]>>;
|
|
381
|
+
address: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
382
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
383
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
384
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
385
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
386
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
387
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
388
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
389
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
390
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
391
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
392
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
393
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
394
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
395
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
396
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
397
|
+
}, z.core.$strip>>]>>;
|
|
398
|
+
}, z.core.$strip>;
|
|
368
399
|
declare const updateVisitorSchema: z.ZodMiniObject<{
|
|
369
400
|
user_id: z.ZodMiniOptional<z.ZodMiniUUID>;
|
|
401
|
+
user_data: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
402
|
+
email: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>>]>>;
|
|
403
|
+
phone_number: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>>]>>;
|
|
404
|
+
address: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
405
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
406
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
407
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
408
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
409
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
410
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
411
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
412
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
413
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
414
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
415
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
416
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
417
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
418
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
419
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
420
|
+
}, z.core.$strip>>]>>;
|
|
421
|
+
}, z.core.$strip>>;
|
|
370
422
|
distinct_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
423
|
+
tags: z.ZodMiniObject<{
|
|
424
|
+
os: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
425
|
+
os_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
426
|
+
os_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
427
|
+
browser: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
428
|
+
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
429
|
+
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
430
|
+
platform: z.ZodMiniEnum<{
|
|
431
|
+
android: "android";
|
|
432
|
+
ios: "ios";
|
|
433
|
+
linux: "linux";
|
|
434
|
+
macos: "macos";
|
|
435
|
+
unknown: "unknown";
|
|
436
|
+
web: "web";
|
|
437
|
+
windows: "windows";
|
|
438
|
+
}>;
|
|
439
|
+
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
440
|
+
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
441
|
+
device_type: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
442
|
+
device_vendor: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
443
|
+
device_pixel_ratio: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
444
|
+
screen_width: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
445
|
+
screen_height: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
446
|
+
screen_resolution: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<`${number}x${number}`, string>>>;
|
|
447
|
+
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
448
|
+
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
449
|
+
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
450
|
+
environment: z.ZodMiniEnum<{
|
|
451
|
+
development: "development";
|
|
452
|
+
production: "production";
|
|
453
|
+
}>;
|
|
454
|
+
source_url: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
455
|
+
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
456
|
+
app: "app";
|
|
457
|
+
offline: "offline";
|
|
458
|
+
web: "web";
|
|
459
|
+
}>>;
|
|
460
|
+
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
461
|
+
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
462
|
+
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
463
|
+
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
464
|
+
fbp: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
465
|
+
fbclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
466
|
+
ad_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
467
|
+
ad_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
468
|
+
adset_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
469
|
+
adset_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
470
|
+
campaign_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
471
|
+
campaign_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
472
|
+
placement: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
473
|
+
site_source_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
474
|
+
gclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
475
|
+
gclsrc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
476
|
+
gad_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
477
|
+
gad_campaignid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
478
|
+
rdt_cid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
479
|
+
rdt_uuid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
480
|
+
dclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
481
|
+
ko_click_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
482
|
+
li_fat_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
483
|
+
msclkid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
484
|
+
sccid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
485
|
+
ttclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
486
|
+
twclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
487
|
+
wbraid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
488
|
+
yclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
489
|
+
utm_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
490
|
+
utm_medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
491
|
+
utm_campaign: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
492
|
+
utm_term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
493
|
+
utm_content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
494
|
+
utm_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
495
|
+
utm_source_platform: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
496
|
+
utm_creative_format: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
497
|
+
utm_marketing_tactic: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
498
|
+
}, z.core.$strip>;
|
|
371
499
|
properties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull]>>>;
|
|
372
500
|
}, z.core.$strip>;
|
|
373
501
|
declare const createFeedbackSchema: z.ZodMiniObject<{
|
|
@@ -395,7 +523,8 @@ type CreateTrackEventDTO = z.output<typeof createTrackEventSchema>;
|
|
|
395
523
|
type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;
|
|
396
524
|
type CreateLinkDTO = z.output<typeof createLinkSchema>;
|
|
397
525
|
type CreateVisitorDTO = z.output<typeof createVisitorSchema>;
|
|
526
|
+
type UserProvidedDataDTO = z.output<typeof userProvidedDataSchema>;
|
|
398
527
|
type UpdateVisitorDTO = z.output<typeof updateVisitorSchema>;
|
|
399
528
|
//#endregion
|
|
400
|
-
export { ALL_ENVIRONMENTS, ALL_PLATFORMS, CreateFeedbackDTO, CreateLinkDTO, CreateTrackEventDTO, CreateVisitorDTO, UpdateVisitorDTO, createFeedbackSchema, createLinkSchema, createTrackEventSchema, createTrackEventSchemaV1, createVisitorSchema, propertiesSchema, tagsSchema, updateVisitorSchema };
|
|
529
|
+
export { ALL_ENVIRONMENTS, ALL_PLATFORMS, CreateFeedbackDTO, CreateLinkDTO, CreateTrackEventDTO, CreateVisitorDTO, UpdateVisitorDTO, UserProvidedDataDTO, createFeedbackSchema, createLinkSchema, createTrackEventSchema, createTrackEventSchemaV1, createVisitorSchema, propertiesSchema, tagsSchema, updateVisitorSchema, userProvidedDataSchema };
|
|
401
530
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAqCa;cAUA;cAEA,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyEV,kBAAgB,EAAA,gBAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,yBAAA,EAAA,aAAA,EAAA,aAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,yBAAA,EAAA;;cAQhB,0BAAwB,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAaxB,wBAAsB,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAatB,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwCnB,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;cAMtB,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAanB,sBAAoB,EAAA;;;;;;;;;cAepB,kBAAgB,EAAA;;;;;;;;;;;;KAiDjB,sBAAsB,EAAE,cAAc;KACtC,oBAAoB,EAAE,cAAc;KACpC,gBAAgB,EAAE,cAAc;KAChC,mBAAmB,EAAE,cAAc;KACnC,sBAAsB,EAAE,cAAc;KACtC,mBAAmB,EAAE,cAAc"}
|
package/dist/schema/index.d.mts
CHANGED
|
@@ -365,9 +365,137 @@ declare const createVisitorSchema: z.ZodMiniObject<{
|
|
|
365
365
|
}, z.core.$strip>;
|
|
366
366
|
properties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull]>>>;
|
|
367
367
|
}, z.core.$strip>;
|
|
368
|
+
/**
|
|
369
|
+
* User-provided data (UPD) used for enhanced conversions, Customer Match, and demographics.
|
|
370
|
+
* Values are sent unhashed; Google normalizes and hashes them before they reach its servers.
|
|
371
|
+
*
|
|
372
|
+
* Multiple values may be sent to increase the match rate: up to 3 emails, 3 phone numbers, and
|
|
373
|
+
* 2 addresses.
|
|
374
|
+
*
|
|
375
|
+
* @see https://support.google.com/analytics/answer/14078702
|
|
376
|
+
* @see https://support.google.com/google-ads/answer/13258081
|
|
377
|
+
*/
|
|
378
|
+
declare const userProvidedDataSchema: z.ZodMiniObject<{
|
|
379
|
+
email: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>>]>>;
|
|
380
|
+
phone_number: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>>]>>;
|
|
381
|
+
address: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
382
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
383
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
384
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
385
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
386
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
387
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
388
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
389
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
390
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
391
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
392
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
393
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
394
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
395
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
396
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
397
|
+
}, z.core.$strip>>]>>;
|
|
398
|
+
}, z.core.$strip>;
|
|
368
399
|
declare const updateVisitorSchema: z.ZodMiniObject<{
|
|
369
400
|
user_id: z.ZodMiniOptional<z.ZodMiniUUID>;
|
|
401
|
+
user_data: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
402
|
+
email: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniEmail>>]>>;
|
|
403
|
+
phone_number: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>, z.ZodMiniArray<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniE164>>]>>;
|
|
404
|
+
address: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
405
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
406
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
407
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
408
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
409
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
410
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
411
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
412
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
413
|
+
first_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
414
|
+
last_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
415
|
+
street: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
416
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
417
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
418
|
+
postal_code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
419
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
420
|
+
}, z.core.$strip>>]>>;
|
|
421
|
+
}, z.core.$strip>>;
|
|
370
422
|
distinct_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
423
|
+
tags: z.ZodMiniObject<{
|
|
424
|
+
os: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
425
|
+
os_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
426
|
+
os_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
427
|
+
browser: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
428
|
+
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
429
|
+
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
430
|
+
platform: z.ZodMiniEnum<{
|
|
431
|
+
android: "android";
|
|
432
|
+
ios: "ios";
|
|
433
|
+
linux: "linux";
|
|
434
|
+
macos: "macos";
|
|
435
|
+
unknown: "unknown";
|
|
436
|
+
web: "web";
|
|
437
|
+
windows: "windows";
|
|
438
|
+
}>;
|
|
439
|
+
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
440
|
+
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
441
|
+
device_type: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
442
|
+
device_vendor: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
443
|
+
device_pixel_ratio: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
444
|
+
screen_width: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
445
|
+
screen_height: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
446
|
+
screen_resolution: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<`${number}x${number}`, string>>>;
|
|
447
|
+
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
448
|
+
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
449
|
+
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
450
|
+
environment: z.ZodMiniEnum<{
|
|
451
|
+
development: "development";
|
|
452
|
+
production: "production";
|
|
453
|
+
}>;
|
|
454
|
+
source_url: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
455
|
+
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
456
|
+
app: "app";
|
|
457
|
+
offline: "offline";
|
|
458
|
+
web: "web";
|
|
459
|
+
}>>;
|
|
460
|
+
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
461
|
+
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
462
|
+
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
463
|
+
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
464
|
+
fbp: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
465
|
+
fbclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
466
|
+
ad_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
467
|
+
ad_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
468
|
+
adset_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
469
|
+
adset_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
470
|
+
campaign_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
471
|
+
campaign_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
472
|
+
placement: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
473
|
+
site_source_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
474
|
+
gclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
475
|
+
gclsrc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
476
|
+
gad_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
477
|
+
gad_campaignid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
478
|
+
rdt_cid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
479
|
+
rdt_uuid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
480
|
+
dclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
481
|
+
ko_click_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
482
|
+
li_fat_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
483
|
+
msclkid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
484
|
+
sccid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
485
|
+
ttclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
486
|
+
twclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
487
|
+
wbraid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
488
|
+
yclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
489
|
+
utm_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
490
|
+
utm_medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
491
|
+
utm_campaign: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
492
|
+
utm_term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
493
|
+
utm_content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
494
|
+
utm_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
495
|
+
utm_source_platform: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
496
|
+
utm_creative_format: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
497
|
+
utm_marketing_tactic: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
498
|
+
}, z.core.$strip>;
|
|
371
499
|
properties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull]>>>;
|
|
372
500
|
}, z.core.$strip>;
|
|
373
501
|
declare const createFeedbackSchema: z.ZodMiniObject<{
|
|
@@ -395,7 +523,8 @@ type CreateTrackEventDTO = z.output<typeof createTrackEventSchema>;
|
|
|
395
523
|
type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;
|
|
396
524
|
type CreateLinkDTO = z.output<typeof createLinkSchema>;
|
|
397
525
|
type CreateVisitorDTO = z.output<typeof createVisitorSchema>;
|
|
526
|
+
type UserProvidedDataDTO = z.output<typeof userProvidedDataSchema>;
|
|
398
527
|
type UpdateVisitorDTO = z.output<typeof updateVisitorSchema>;
|
|
399
528
|
//#endregion
|
|
400
|
-
export { ALL_ENVIRONMENTS, ALL_PLATFORMS, CreateFeedbackDTO, CreateLinkDTO, CreateTrackEventDTO, CreateVisitorDTO, UpdateVisitorDTO, createFeedbackSchema, createLinkSchema, createTrackEventSchema, createTrackEventSchemaV1, createVisitorSchema, propertiesSchema, tagsSchema, updateVisitorSchema };
|
|
529
|
+
export { ALL_ENVIRONMENTS, ALL_PLATFORMS, CreateFeedbackDTO, CreateLinkDTO, CreateTrackEventDTO, CreateVisitorDTO, UpdateVisitorDTO, UserProvidedDataDTO, createFeedbackSchema, createLinkSchema, createTrackEventSchema, createTrackEventSchemaV1, createVisitorSchema, propertiesSchema, tagsSchema, updateVisitorSchema, userProvidedDataSchema };
|
|
401
530
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAqCa;cAUA;cAEA,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyEV,kBAAgB,EAAA,gBAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,yBAAA,EAAA,aAAA,EAAA,aAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,yBAAA,EAAA;;cAQhB,0BAAwB,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAaxB,wBAAsB,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAatB,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwCnB,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;cAMtB,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAanB,sBAAoB,EAAA;;;;;;;;;cAepB,kBAAgB,EAAA;;;;;;;;;;;;KAiDjB,sBAAsB,EAAE,cAAc;KACtC,oBAAoB,EAAE,cAAc;KACpC,gBAAgB,EAAE,cAAc;KAChC,mBAAmB,EAAE,cAAc;KACnC,sBAAsB,EAAE,cAAc;KACtC,mBAAmB,EAAE,cAAc"}
|
package/dist/schema/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { array, boolean, coerce, email, enum as enum$1, iso, maxLength, minLength, null as null$1, number, object, optional, pipe, record, refine, regex, string, transform, trim, union, url, uuid } from "zod/mini";
|
|
1
|
+
import { array, boolean, coerce, e164, email, enum as enum$1, iso, maxLength, minLength, null as null$1, number, object, optional, pipe, record, refine, regex, string, toLowerCase, toUpperCase, transform, trim, union, url, uuid } from "zod/mini";
|
|
2
2
|
//#region src/schema/index.ts
|
|
3
3
|
const items = array(record(string().check(trim(), minLength(1), maxLength(128)), union([
|
|
4
4
|
string().check(maxLength(512)),
|
|
@@ -121,9 +121,40 @@ const createVisitorSchema = object({
|
|
|
121
121
|
null$1()
|
|
122
122
|
])).check(refine((data) => Object.keys(data).length <= 64)))
|
|
123
123
|
});
|
|
124
|
+
const emailValue = pipe(string().check(trim(), toLowerCase(), maxLength(320)), email());
|
|
125
|
+
/** E.164: a plus sign (+) prefix, country code, then digits only, no dashes/parens/spaces. */
|
|
126
|
+
const phoneValue = pipe(string().check(trim()), e164());
|
|
127
|
+
const addressValue = object({
|
|
128
|
+
first_name: optional(string().check(trim(), maxLength(128))),
|
|
129
|
+
last_name: optional(string().check(trim(), maxLength(128))),
|
|
130
|
+
street: optional(string().check(trim(), maxLength(256))),
|
|
131
|
+
city: optional(string().check(trim(), maxLength(128))),
|
|
132
|
+
/** User province, state, or region. Example: `Hampshire` */
|
|
133
|
+
region: optional(string().check(trim(), maxLength(128))),
|
|
134
|
+
postal_code: optional(string().check(trim(), maxLength(32))),
|
|
135
|
+
/** 2-letter country code, per the ISO 3166-1 alpha-2 standard. Example: `UK` */
|
|
136
|
+
country: optional(string().check(trim(), toUpperCase(), regex(/^[A-Z]{2}$/)))
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* User-provided data (UPD) used for enhanced conversions, Customer Match, and demographics.
|
|
140
|
+
* Values are sent unhashed; Google normalizes and hashes them before they reach its servers.
|
|
141
|
+
*
|
|
142
|
+
* Multiple values may be sent to increase the match rate: up to 3 emails, 3 phone numbers, and
|
|
143
|
+
* 2 addresses.
|
|
144
|
+
*
|
|
145
|
+
* @see https://support.google.com/analytics/answer/14078702
|
|
146
|
+
* @see https://support.google.com/google-ads/answer/13258081
|
|
147
|
+
*/
|
|
148
|
+
const userProvidedDataSchema = object({
|
|
149
|
+
email: optional(union([emailValue, array(emailValue).check(minLength(1), maxLength(3))])),
|
|
150
|
+
phone_number: optional(union([phoneValue, array(phoneValue).check(minLength(1), maxLength(3))])),
|
|
151
|
+
address: optional(union([addressValue, array(addressValue).check(minLength(1), maxLength(2))]))
|
|
152
|
+
});
|
|
124
153
|
const updateVisitorSchema = object({
|
|
125
154
|
user_id: optional(uuid()),
|
|
155
|
+
user_data: optional(userProvidedDataSchema),
|
|
126
156
|
distinct_id: optional(string().check(trim(), minLength(1), maxLength(36))),
|
|
157
|
+
tags: tagsSchema,
|
|
127
158
|
properties: optional(record(string().check(trim(), minLength(1), maxLength(128)), union([
|
|
128
159
|
string().check(maxLength(512)),
|
|
129
160
|
number(),
|
|
@@ -181,6 +212,6 @@ const createLinkSchema = object({
|
|
|
181
212
|
utm_marketing_tactic: optional(noEmptyString)
|
|
182
213
|
});
|
|
183
214
|
//#endregion
|
|
184
|
-
export { ALL_ENVIRONMENTS, ALL_PLATFORMS, createFeedbackSchema, createLinkSchema, createTrackEventSchema, createTrackEventSchemaV1, createVisitorSchema, propertiesSchema, tagsSchema, updateVisitorSchema };
|
|
215
|
+
export { ALL_ENVIRONMENTS, ALL_PLATFORMS, createFeedbackSchema, createLinkSchema, createTrackEventSchema, createTrackEventSchemaV1, createVisitorSchema, propertiesSchema, tagsSchema, updateVisitorSchema, userProvidedDataSchema };
|
|
185
216
|
|
|
186
217
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["_null","_enum"],"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n enum as _enum,\n null as _null,\n array,\n boolean,\n coerce,\n email,\n iso,\n maxLength,\n minLength,\n number,\n object,\n optional,\n pipe,\n record,\n refine,\n regex,\n string,\n transform,\n trim,\n union,\n url,\n uuid,\n type z,\n} from 'zod/mini';\nimport type { Environment, Platform } from '../track/types';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\nexport const ALL_PLATFORMS = [\n 'ios',\n 'android',\n 'web',\n 'macos',\n 'windows',\n 'linux',\n 'unknown',\n] as const satisfies Platform[];\n\nexport const ALL_ENVIRONMENTS = ['development', 'production'] as const satisfies Environment[];\n\nexport const tagsSchema = object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: _enum(ALL_PLATFORMS),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(number()),\n screen_width: optional(number()),\n screen_height: optional(number()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: _enum(ALL_ENVIRONMENTS),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n page_referrer: optional(string()),\n // app info\n advertising_id: optional(string()),\n install_referrer: optional(string()),\n // Meta Ads\n fbc: optional(string()),\n fbp: optional(string()),\n fbclid: optional(string()),\n ad_id: optional(string()),\n ad_name: optional(string()),\n adset_id: optional(string()),\n adset_name: optional(string()),\n campaign_id: optional(string()),\n campaign_name: optional(string()),\n placement: optional(string()),\n site_source_name: optional(string()),\n // Google Ads\n gclid: optional(string()),\n gclsrc: optional(string()),\n gad_source: optional(string()),\n gad_campaignid: optional(string()),\n // Reddit ads\n rdt_cid: optional(string()),\n rdt_uuid: optional(string()),\n // click ids\n dclid: optional(string()),\n ko_click_id: optional(string()),\n li_fat_id: optional(string()),\n msclkid: optional(string()),\n sccid: optional(string()),\n ttclid: optional(string()),\n twclid: optional(string()),\n wbraid: optional(string()),\n yclid: optional(string()),\n // utm params\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n utm_id: optional(string()),\n utm_source_platform: optional(string()),\n utm_creative_format: optional(string()),\n utm_marketing_tactic: optional(string()),\n});\n\nexport const propertiesSchema = optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n tags: tagsSchema,\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n distinct_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\nconst noEmptyString = pipe(\n string().check(maxLength(256)),\n transform((v) => (v ? v : undefined))\n);\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(noEmptyString),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example, spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(noEmptyString),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(noEmptyString),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example, Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(noEmptyString),\n\n /**\n * Type of creative, for example, display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(noEmptyString),\n\n /**\n * Targeting criteria applied to a campaign, for example, remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(noEmptyString),\n});\n\nexport type CreateTrackEventDTO = z.output<typeof createTrackEventSchema>;\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<typeof createLinkSchema>;\nexport type CreateVisitorDTO = z.output<typeof createVisitorSchema>;\nexport type UpdateVisitorDTO = z.output<typeof updateVisitorSchema>;\n"],"mappings":";;AA2BA,MAAM,QAAQ,MACZ,OACE,OAAO,CAAC,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC,GACnD,MAAM;CAAC,OAAO,CAAC,CAAC,MAAM,UAAU,GA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AAa;;;;;CAM3C,qBAAqB,SAAS,aAAa;;;;;CAM3C,sBAAsB,SAAS,aAAa;AAC9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["_null","_enum"],"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n enum as _enum,\n null as _null,\n array,\n boolean,\n coerce,\n e164,\n email,\n iso,\n maxLength,\n minLength,\n number,\n object,\n optional,\n pipe,\n record,\n refine,\n regex,\n string,\n toLowerCase,\n toUpperCase,\n transform,\n trim,\n union,\n url,\n uuid,\n type z,\n} from 'zod/mini';\nimport type { Environment, Platform } from '../track/types';\n\nconst items = array(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n )\n);\n\nexport const ALL_PLATFORMS = [\n 'ios',\n 'android',\n 'web',\n 'macos',\n 'windows',\n 'linux',\n 'unknown',\n] as const satisfies Platform[];\n\nexport const ALL_ENVIRONMENTS = ['development', 'production'] as const satisfies Environment[];\n\nexport const tagsSchema = object({\n os: optional(string()),\n os_name: optional(string()),\n os_version: optional(string()),\n browser: optional(string()),\n browser_name: optional(string()),\n browser_version: optional(string()),\n platform: _enum(ALL_PLATFORMS),\n device: optional(string()),\n device_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n device_type: optional(string()),\n device_vendor: optional(string()),\n device_pixel_ratio: optional(number()),\n screen_width: optional(number()),\n screen_height: optional(number()),\n screen_resolution: optional(\n pipe(\n string().check(regex(/^\\d+x\\d+$/)),\n transform((v) => v as `${number}x${number}`)\n )\n ),\n release: optional(string()),\n language: optional(string()),\n time_zone: optional(string()),\n environment: _enum(ALL_ENVIRONMENTS),\n source_url: optional(string()),\n source: optional(_enum(['web', 'app', 'offline'])),\n page_referrer: optional(string()),\n // app info\n advertising_id: optional(string()),\n install_referrer: optional(string()),\n // Meta Ads\n fbc: optional(string()),\n fbp: optional(string()),\n fbclid: optional(string()),\n ad_id: optional(string()),\n ad_name: optional(string()),\n adset_id: optional(string()),\n adset_name: optional(string()),\n campaign_id: optional(string()),\n campaign_name: optional(string()),\n placement: optional(string()),\n site_source_name: optional(string()),\n // Google Ads\n gclid: optional(string()),\n gclsrc: optional(string()),\n gad_source: optional(string()),\n gad_campaignid: optional(string()),\n // Reddit ads\n rdt_cid: optional(string()),\n rdt_uuid: optional(string()),\n // click ids\n dclid: optional(string()),\n ko_click_id: optional(string()),\n li_fat_id: optional(string()),\n msclkid: optional(string()),\n sccid: optional(string()),\n ttclid: optional(string()),\n twclid: optional(string()),\n wbraid: optional(string()),\n yclid: optional(string()),\n // utm params\n utm_source: optional(string()),\n utm_medium: optional(string()),\n utm_campaign: optional(string()),\n utm_term: optional(string()),\n utm_content: optional(string()),\n utm_id: optional(string()),\n utm_source_platform: optional(string()),\n utm_creative_format: optional(string()),\n utm_marketing_tactic: optional(string()),\n});\n\nexport const propertiesSchema = optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null(), items])\n ).check(refine((data) => Object.keys(data).length <= 64))\n);\n\n/** @deprecated */\nexport const createTrackEventSchemaV1 = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: coerce.bigint(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createTrackEventSchema = array(\n object({\n name: string().check(trim(), minLength(1), maxLength(64)),\n visitor_id: uuid(),\n session_id: uuid(),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n timestamp: iso.datetime(),\n tags: tagsSchema,\n properties: propertiesSchema,\n })\n).check(minLength(1), maxLength(100));\n\nexport const createVisitorSchema = object({\n device_id: string().check(trim(), minLength(1), maxLength(36)),\n platform: _enum(ALL_PLATFORMS),\n environment: _enum(ALL_ENVIRONMENTS),\n tags: tagsSchema,\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nconst emailValue = pipe(string().check(trim(), toLowerCase(), maxLength(320)), email());\n\n/** E.164: a plus sign (+) prefix, country code, then digits only, no dashes/parens/spaces. */\nconst phoneValue = pipe(string().check(trim()), e164());\n\nconst addressValue = object({\n first_name: optional(string().check(trim(), maxLength(128))),\n last_name: optional(string().check(trim(), maxLength(128))),\n street: optional(string().check(trim(), maxLength(256))),\n city: optional(string().check(trim(), maxLength(128))),\n /** User province, state, or region. Example: `Hampshire` */\n region: optional(string().check(trim(), maxLength(128))),\n postal_code: optional(string().check(trim(), maxLength(32))),\n /** 2-letter country code, per the ISO 3166-1 alpha-2 standard. Example: `UK` */\n country: optional(string().check(trim(), toUpperCase(), regex(/^[A-Z]{2}$/))),\n});\n\n/**\n * User-provided data (UPD) used for enhanced conversions, Customer Match, and demographics.\n * Values are sent unhashed; Google normalizes and hashes them before they reach its servers.\n *\n * Multiple values may be sent to increase the match rate: up to 3 emails, 3 phone numbers, and\n * 2 addresses.\n *\n * @see https://support.google.com/analytics/answer/14078702\n * @see https://support.google.com/google-ads/answer/13258081\n */\nexport const userProvidedDataSchema = object({\n email: optional(union([emailValue, array(emailValue).check(minLength(1), maxLength(3))])),\n phone_number: optional(union([phoneValue, array(phoneValue).check(minLength(1), maxLength(3))])),\n address: optional(union([addressValue, array(addressValue).check(minLength(1), maxLength(2))])),\n});\n\nexport const updateVisitorSchema = object({\n user_id: optional(uuid()),\n user_data: optional(userProvidedDataSchema),\n distinct_id: optional(string().check(trim(), minLength(1), maxLength(36))),\n tags: tagsSchema,\n properties: optional(\n record(\n string().check(trim(), minLength(1), maxLength(128)),\n union([string().check(maxLength(512)), number(), boolean(), _null()])\n ).check(refine((data) => Object.keys(data).length <= 64))\n ),\n});\n\nexport const createFeedbackSchema = object({\n name: string().check(minLength(1), maxLength(256)),\n email: email().check(maxLength(320)),\n message: string().check(minLength(1), maxLength(65536)),\n});\n\nconst noEmptyString = pipe(\n string().check(maxLength(256)),\n transform((v) => (v ? v : undefined))\n);\n\n/**\n * The schema for creating a link.\n * @see https://support.google.com/analytics/answer/10917952\n * */\nexport const createLinkSchema = object({\n /** The URL that the user is redirected to. */\n url: url().check(minLength(1), maxLength(1024)), // required\n\n /**\n * Campaign ID. Used to identify a specific campaign or promotion. This is a required key for GA4\n * data import. Use the same IDs that you use when uploading campaign cost data.\n */\n utm_id: optional(noEmptyString),\n\n /** Referrer, for example: google, newsletter4, billboard */\n utm_source: string().check(minLength(1), maxLength(256)), // required\n\n /** Marketing medium, for example: cpc, banner, email */\n utm_medium: string().check(minLength(1), maxLength(256)), // required\n\n /** Product, slogan, promo code, for example, spring_sale */\n utm_campaign: string().check(minLength(1), maxLength(256)), // required\n\n /** Paid keyword */\n utm_term: optional(noEmptyString),\n\n /**\n * Use to differentiate creatives. For example, if you have two call-to-action links within the\n * same email message, you can use utm_content and set different values for each so you can tell\n * which version is more effective.\n */\n utm_content: optional(noEmptyString),\n\n /**\n * The platform responsible for directing traffic to a given Analytics property (such as a buying\n * platform that sets budgets and targeting criteria or a platform that manages organic traffic\n * data). For example, Search Ads 360 or Display & Video 360.\n */\n utm_source_platform: optional(noEmptyString),\n\n /**\n * Type of creative, for example, display, native, video, search, utm_creative_format is not\n * currently reported in Google Analytics 4 properties.\n */\n utm_creative_format: optional(noEmptyString),\n\n /**\n * Targeting criteria applied to a campaign, for example, remarketing, prospecting,\n * utm_marketing_tactic is not currently reported in Google Analytics 4 properties.\n * */\n utm_marketing_tactic: optional(noEmptyString),\n});\n\nexport type CreateTrackEventDTO = z.output<typeof createTrackEventSchema>;\nexport type CreateFeedbackDTO = z.output<typeof createFeedbackSchema>;\nexport type CreateLinkDTO = z.output<typeof createLinkSchema>;\nexport type CreateVisitorDTO = z.output<typeof createVisitorSchema>;\nexport type UserProvidedDataDTO = z.output<typeof userProvidedDataSchema>;\nexport type U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O,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;;CAGvD,cAAc,OAAO,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;;CAGzD,UAAU,SAAS,aAAa;;;;;;CAOhC,aAAa,SAAS,aAAa;;;;;;CAOnC,qBAAqB,SAAS,aAAa;;;;;CAM3C,qBAAqB,SAAS,aAAa;;;;;CAM3C,sBAAsB,SAAS,aAAa;AAC9C,CAAC"}
|
|
@@ -7,13 +7,13 @@ function sendGAEvent(name, properties) {
|
|
|
7
7
|
}
|
|
8
8
|
window.gtag("event", name, properties);
|
|
9
9
|
}
|
|
10
|
-
function setGAUser({ user_id,
|
|
10
|
+
function setGAUser({ user_id, user_data, properties }) {
|
|
11
11
|
if (!window.gtag) {
|
|
12
12
|
console.warn("GA has not been initialized");
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
if (user_id) window.gtag("set", "user_id", user_id);
|
|
16
|
-
if (
|
|
16
|
+
if (user_data) window.gtag("set", "user_data", user_data);
|
|
17
17
|
if (properties) window.gtag("set", "user_properties", properties);
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-analytics.cjs","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"google-analytics.cjs","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport type { Gtag } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ndeclare global {\n // oxlint-disable-next-line typescript/no-empty-object-type\n interface Window extends Gtag {}\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (!window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n window.gtag('event', name, properties);\n}\n\nexport function setGAUser({ user_id, user_data, properties }: UpdateVisitorDTO) {\n if (!window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n if (user_id) window.gtag('set', 'user_id', user_id);\n if (user_data) window.gtag('set', 'user_data', user_data);\n if (properties) window.gtag('set', 'user_properties', properties as never);\n}\n"],"mappings":";;AASA,SAAgB,YACd,MACA,YACA;CACA,IAAI,CAAC,OAAO,MAAM;EAChB,QAAQ,KAAK,6BAA6B;EAC1C;CACF;CACA,OAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEA,SAAgB,UAAU,EAAE,SAAS,WAAW,cAAgC;CAC9E,IAAI,CAAC,OAAO,MAAM;EAChB,QAAQ,KAAK,6BAA6B;EAC1C;CACF;CACA,IAAI,SAAS,OAAO,KAAK,OAAO,WAAW,OAAO;CAClD,IAAI,WAAW,OAAO,KAAK,OAAO,aAAa,SAAS;CACxD,IAAI,YAAY,OAAO,KAAK,OAAO,mBAAmB,UAAmB;AAC3E"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { UpdateVisitorDTO } from "../schema/index.cjs";
|
|
1
2
|
import { Gtag } from "../track/gtag.cjs";
|
|
2
3
|
import { EventName, TrackName, TrackProperties } from "../track/types.cjs";
|
|
3
|
-
import { UpdateVisitorDTO } from "../visitor/types.cjs";
|
|
4
4
|
//#region src/third-parties/google-analytics.d.ts
|
|
5
5
|
declare global {
|
|
6
6
|
interface Window extends Gtag {}
|
|
7
7
|
}
|
|
8
8
|
declare function sendGAEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): void;
|
|
9
|
-
declare function setGAUser({ user_id,
|
|
9
|
+
declare function setGAUser({ user_id, user_data, properties }: UpdateVisitorDTO): void;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { sendGAEvent, setGAUser };
|
|
12
12
|
//# sourceMappingURL=google-analytics.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-analytics.d.cts","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"mappings":";;;;QAIQ;YAEI,eAAe;;iBAGX,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB;iBASf,YAAY,SAAS,
|
|
1
|
+
{"version":3,"file":"google-analytics.d.cts","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"mappings":";;;;QAIQ;YAEI,eAAe;;iBAGX,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB;iBASf,YAAY,SAAS,WAAW,cAAc"}
|