@shware/analytics 3.7.0 → 3.8.1
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/next/index.cjs +1 -1
- package/dist/next/index.mjs +1 -1
- package/dist/react-router/index.cjs +1 -1
- package/dist/react-router/index.mjs +1 -1
- package/dist/schema/index.cjs +5 -4
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +76 -0
- package/dist/schema/index.d.cts.map +1 -1
- package/dist/schema/index.d.mts +76 -0
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/schema/index.mjs +5 -4
- package/dist/schema/index.mjs.map +1 -1
- package/dist/tanstack/index.cjs +1 -1
- package/dist/tanstack/index.mjs +1 -1
- package/dist/visitor/index.cjs +8 -2
- package/dist/visitor/index.cjs.map +1 -1
- package/dist/visitor/index.d.cts.map +1 -1
- package/dist/visitor/index.d.mts.map +1 -1
- package/dist/visitor/index.mjs +8 -2
- package/dist/visitor/index.mjs.map +1 -1
- package/dist/visitor/types.d.cts +4 -4
- package/dist/visitor/types.d.cts.map +1 -1
- package/dist/visitor/types.d.mts +4 -4
- package/dist/visitor/types.d.mts.map +1 -1
- package/package.json +1 -1
package/dist/next/index.cjs
CHANGED
|
@@ -5,11 +5,11 @@ const require_track_index = require("../track/index.cjs");
|
|
|
5
5
|
const require_hooks_use_click_id_persistence = require("../hooks/use-click-id-persistence.cjs");
|
|
6
6
|
const require_hooks_use_outbound_click_analytics = require("../hooks/use-outbound-click-analytics.cjs");
|
|
7
7
|
const require_hooks_use_web_analytics = require("../hooks/use-web-analytics.cjs");
|
|
8
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
8
|
let next_navigation_js = require("next/navigation.js");
|
|
10
9
|
let next_script_js = require("next/script.js");
|
|
11
10
|
next_script_js = require_runtime.__toESM(next_script_js, 1);
|
|
12
11
|
let next_web_vitals_js = require("next/web-vitals.js");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
13
|
//#region src/next/index.tsx
|
|
14
14
|
function Analytics({ gaId, gaSrc, nonce, debugMode, metaPixelId, hotjarId, redditPixelId, linkedInPartnerId, facebookAppId, reportWebVitals = true }) {
|
|
15
15
|
require_hooks_use_click_id_persistence.useClickIdPersistence();
|
package/dist/next/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import { track } from "../track/index.mjs";
|
|
|
3
3
|
import { useClickIdPersistence } from "../hooks/use-click-id-persistence.mjs";
|
|
4
4
|
import { useOutboundClickAnalytics } from "../hooks/use-outbound-click-analytics.mjs";
|
|
5
5
|
import { useWebAnalytics } from "../hooks/use-web-analytics.mjs";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { usePathname } from "next/navigation.js";
|
|
8
7
|
import Script from "next/script.js";
|
|
9
8
|
import { useReportWebVitals } from "next/web-vitals.js";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/next/index.tsx
|
|
11
11
|
function Analytics({ gaId, gaSrc, nonce, debugMode, metaPixelId, hotjarId, redditPixelId, linkedInPartnerId, facebookAppId, reportWebVitals = true }) {
|
|
12
12
|
useClickIdPersistence();
|
|
@@ -4,9 +4,9 @@ const require_hooks_use_click_id_persistence = require("../hooks/use-click-id-pe
|
|
|
4
4
|
const require_hooks_use_outbound_click_analytics = require("../hooks/use-outbound-click-analytics.cjs");
|
|
5
5
|
const require_hooks_use_web_analytics = require("../hooks/use-web-analytics.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
let react_router = require("react-router");
|
|
8
9
|
let web_vitals = require("web-vitals");
|
|
9
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
//#region src/react-router/index.tsx
|
|
11
11
|
function useReportWebVitals(reportWebVitalsFn) {
|
|
12
12
|
(0, react.useEffect)(() => {
|
|
@@ -3,9 +3,9 @@ import { useClickIdPersistence } from "../hooks/use-click-id-persistence.mjs";
|
|
|
3
3
|
import { useOutboundClickAnalytics } from "../hooks/use-outbound-click-analytics.mjs";
|
|
4
4
|
import { useWebAnalytics } from "../hooks/use-web-analytics.mjs";
|
|
5
5
|
import { useEffect } from "react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { useLocation } from "react-router";
|
|
7
8
|
import { onCLS, onFCP, onINP, onLCP, onTTFB } from "web-vitals";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/react-router/index.tsx
|
|
10
10
|
function useReportWebVitals(reportWebVitalsFn) {
|
|
11
11
|
useEffect(() => {
|
package/dist/schema/index.cjs
CHANGED
|
@@ -114,6 +114,7 @@ const createVisitorSchema = (0, zod_mini.object)({
|
|
|
114
114
|
device_id: (0, zod_mini.string)().check((0, zod_mini.trim)(), (0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(36)),
|
|
115
115
|
platform: (0, zod_mini.enum)(ALL_PLATFORMS),
|
|
116
116
|
environment: (0, zod_mini.enum)(ALL_ENVIRONMENTS),
|
|
117
|
+
tags: tagsSchema,
|
|
117
118
|
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)([
|
|
118
119
|
(0, zod_mini.string)().check((0, zod_mini.maxLength)(512)),
|
|
119
120
|
(0, zod_mini.number)(),
|
|
@@ -153,7 +154,7 @@ const createLinkSchema = (0, zod_mini.object)({
|
|
|
153
154
|
utm_source: (0, zod_mini.string)().check((0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(256)),
|
|
154
155
|
/** Marketing medium, for example: cpc, banner, email */
|
|
155
156
|
utm_medium: (0, zod_mini.string)().check((0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(256)),
|
|
156
|
-
/** Product, slogan, promo code, for example
|
|
157
|
+
/** Product, slogan, promo code, for example, spring_sale */
|
|
157
158
|
utm_campaign: (0, zod_mini.string)().check((0, zod_mini.minLength)(1), (0, zod_mini.maxLength)(256)),
|
|
158
159
|
/** Paid keyword */
|
|
159
160
|
utm_term: (0, zod_mini.optional)(noEmptyString),
|
|
@@ -166,16 +167,16 @@ const createLinkSchema = (0, zod_mini.object)({
|
|
|
166
167
|
/**
|
|
167
168
|
* The platform responsible for directing traffic to a given Analytics property (such as a buying
|
|
168
169
|
* platform that sets budgets and targeting criteria or a platform that manages organic traffic
|
|
169
|
-
* data). For example
|
|
170
|
+
* data). For example, Search Ads 360 or Display & Video 360.
|
|
170
171
|
*/
|
|
171
172
|
utm_source_platform: (0, zod_mini.optional)(noEmptyString),
|
|
172
173
|
/**
|
|
173
|
-
* Type of creative, for example
|
|
174
|
+
* Type of creative, for example, display, native, video, search, utm_creative_format is not
|
|
174
175
|
* currently reported in Google Analytics 4 properties.
|
|
175
176
|
*/
|
|
176
177
|
utm_creative_format: (0, zod_mini.optional)(noEmptyString),
|
|
177
178
|
/**
|
|
178
|
-
* Targeting criteria applied to a campaign, for example
|
|
179
|
+
* Targeting criteria applied to a campaign, for example, remarketing, prospecting,
|
|
179
180
|
* utm_marketing_tactic is not currently reported in Google Analytics 4 properties.
|
|
180
181
|
* */
|
|
181
182
|
utm_marketing_tactic: (0, zod_mini.optional)(noEmptyString)
|
|
@@ -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 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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A,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 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;AAE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AC;;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
|
@@ -287,6 +287,82 @@ declare const createVisitorSchema: z.ZodMiniObject<{
|
|
|
287
287
|
development: "development";
|
|
288
288
|
production: "production";
|
|
289
289
|
}>;
|
|
290
|
+
tags: z.ZodMiniObject<{
|
|
291
|
+
os: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
292
|
+
os_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
293
|
+
os_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
294
|
+
browser: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
295
|
+
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
296
|
+
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
297
|
+
platform: z.ZodMiniEnum<{
|
|
298
|
+
android: "android";
|
|
299
|
+
ios: "ios";
|
|
300
|
+
linux: "linux";
|
|
301
|
+
macos: "macos";
|
|
302
|
+
unknown: "unknown";
|
|
303
|
+
web: "web";
|
|
304
|
+
windows: "windows";
|
|
305
|
+
}>;
|
|
306
|
+
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
307
|
+
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
308
|
+
device_type: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
309
|
+
device_vendor: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
310
|
+
device_pixel_ratio: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
311
|
+
screen_width: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
312
|
+
screen_height: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
313
|
+
screen_resolution: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<`${number}x${number}`, string>>>;
|
|
314
|
+
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
315
|
+
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
316
|
+
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
317
|
+
environment: z.ZodMiniEnum<{
|
|
318
|
+
development: "development";
|
|
319
|
+
production: "production";
|
|
320
|
+
}>;
|
|
321
|
+
source_url: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
322
|
+
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
323
|
+
app: "app";
|
|
324
|
+
offline: "offline";
|
|
325
|
+
web: "web";
|
|
326
|
+
}>>;
|
|
327
|
+
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
328
|
+
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
329
|
+
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
330
|
+
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
331
|
+
fbp: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
332
|
+
fbclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
333
|
+
ad_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
334
|
+
ad_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
335
|
+
adset_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
336
|
+
adset_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
337
|
+
campaign_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
338
|
+
campaign_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
339
|
+
placement: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
340
|
+
site_source_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
341
|
+
gclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
342
|
+
gclsrc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
343
|
+
gad_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
344
|
+
gad_campaignid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
345
|
+
rdt_cid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
346
|
+
rdt_uuid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
347
|
+
dclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
348
|
+
ko_click_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
349
|
+
li_fat_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
350
|
+
msclkid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
351
|
+
sccid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
352
|
+
ttclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
353
|
+
twclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
354
|
+
wbraid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
355
|
+
yclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
356
|
+
utm_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
357
|
+
utm_medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
358
|
+
utm_campaign: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
359
|
+
utm_term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
360
|
+
utm_content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
361
|
+
utm_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
362
|
+
utm_source_platform: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
363
|
+
utm_creative_format: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
364
|
+
utm_marketing_tactic: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
365
|
+
}, z.core.$strip>;
|
|
290
366
|
properties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull]>>>;
|
|
291
367
|
}, z.core.$strip>;
|
|
292
368
|
declare const updateVisitorSchema: z.ZodMiniObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAkCa;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
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAkCa;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAanB,qBAAmB,EAAA;;;;;cAWnB,sBAAoB,EAAA;;;;;;;;;cAepB,kBAAgB,EAAA;;;;;;;;;;;;KAiDjB,sBAAsB,EAAE,cAAc;KACtC,oBAAoB,EAAE,cAAc;KACpC,gBAAgB,EAAE,cAAc;KAChC,mBAAmB,EAAE,cAAc;KACnC,mBAAmB,EAAE,cAAc"}
|
package/dist/schema/index.d.mts
CHANGED
|
@@ -287,6 +287,82 @@ declare const createVisitorSchema: z.ZodMiniObject<{
|
|
|
287
287
|
development: "development";
|
|
288
288
|
production: "production";
|
|
289
289
|
}>;
|
|
290
|
+
tags: z.ZodMiniObject<{
|
|
291
|
+
os: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
292
|
+
os_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
293
|
+
os_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
294
|
+
browser: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
295
|
+
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
296
|
+
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
297
|
+
platform: z.ZodMiniEnum<{
|
|
298
|
+
android: "android";
|
|
299
|
+
ios: "ios";
|
|
300
|
+
linux: "linux";
|
|
301
|
+
macos: "macos";
|
|
302
|
+
unknown: "unknown";
|
|
303
|
+
web: "web";
|
|
304
|
+
windows: "windows";
|
|
305
|
+
}>;
|
|
306
|
+
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
307
|
+
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
308
|
+
device_type: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
309
|
+
device_vendor: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
310
|
+
device_pixel_ratio: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
311
|
+
screen_width: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
312
|
+
screen_height: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
313
|
+
screen_resolution: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<`${number}x${number}`, string>>>;
|
|
314
|
+
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
315
|
+
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
316
|
+
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
317
|
+
environment: z.ZodMiniEnum<{
|
|
318
|
+
development: "development";
|
|
319
|
+
production: "production";
|
|
320
|
+
}>;
|
|
321
|
+
source_url: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
322
|
+
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
323
|
+
app: "app";
|
|
324
|
+
offline: "offline";
|
|
325
|
+
web: "web";
|
|
326
|
+
}>>;
|
|
327
|
+
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
328
|
+
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
329
|
+
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
330
|
+
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
331
|
+
fbp: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
332
|
+
fbclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
333
|
+
ad_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
334
|
+
ad_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
335
|
+
adset_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
336
|
+
adset_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
337
|
+
campaign_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
338
|
+
campaign_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
339
|
+
placement: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
340
|
+
site_source_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
341
|
+
gclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
342
|
+
gclsrc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
343
|
+
gad_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
344
|
+
gad_campaignid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
345
|
+
rdt_cid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
346
|
+
rdt_uuid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
347
|
+
dclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
348
|
+
ko_click_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
349
|
+
li_fat_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
350
|
+
msclkid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
351
|
+
sccid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
352
|
+
ttclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
353
|
+
twclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
354
|
+
wbraid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
355
|
+
yclid: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
356
|
+
utm_source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
357
|
+
utm_medium: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
358
|
+
utm_campaign: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
359
|
+
utm_term: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
360
|
+
utm_content: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
361
|
+
utm_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
362
|
+
utm_source_platform: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
363
|
+
utm_creative_format: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
364
|
+
utm_marketing_tactic: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
365
|
+
}, z.core.$strip>;
|
|
290
366
|
properties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull]>>>;
|
|
291
367
|
}, z.core.$strip>;
|
|
292
368
|
declare const updateVisitorSchema: z.ZodMiniObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAkCa;cAUA;cAEA,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyEV,kBAAgB,EAAA,gBAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,yBAAA,EAAA,aAA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;;;;;;;;;;;;;;cAanB,qBAAmB,EAAA;;;;;cAWnB,sBAAoB,EAAA;;;;;;;;;cAepB,kBAAgB,EAAA;;;;;;;;;;;;KAiDjB,sBAAsB,EAAE,cAAc;KACtC,oBAAoB,EAAE,cAAc;KACpC,gBAAgB,EAAE,cAAc;KAChC,mBAAmB,EAAE,cAAc;KACnC,mBAAmB,EAAE,cAAc"}
|
package/dist/schema/index.mjs
CHANGED
|
@@ -113,6 +113,7 @@ const createVisitorSchema = object({
|
|
|
113
113
|
device_id: string().check(trim(), minLength(1), maxLength(36)),
|
|
114
114
|
platform: enum$1(ALL_PLATFORMS),
|
|
115
115
|
environment: enum$1(ALL_ENVIRONMENTS),
|
|
116
|
+
tags: tagsSchema,
|
|
116
117
|
properties: optional(record(string().check(trim(), minLength(1), maxLength(128)), union([
|
|
117
118
|
string().check(maxLength(512)),
|
|
118
119
|
number(),
|
|
@@ -152,7 +153,7 @@ const createLinkSchema = object({
|
|
|
152
153
|
utm_source: string().check(minLength(1), maxLength(256)),
|
|
153
154
|
/** Marketing medium, for example: cpc, banner, email */
|
|
154
155
|
utm_medium: string().check(minLength(1), maxLength(256)),
|
|
155
|
-
/** Product, slogan, promo code, for example
|
|
156
|
+
/** Product, slogan, promo code, for example, spring_sale */
|
|
156
157
|
utm_campaign: string().check(minLength(1), maxLength(256)),
|
|
157
158
|
/** Paid keyword */
|
|
158
159
|
utm_term: optional(noEmptyString),
|
|
@@ -165,16 +166,16 @@ const createLinkSchema = object({
|
|
|
165
166
|
/**
|
|
166
167
|
* The platform responsible for directing traffic to a given Analytics property (such as a buying
|
|
167
168
|
* platform that sets budgets and targeting criteria or a platform that manages organic traffic
|
|
168
|
-
* data). For example
|
|
169
|
+
* data). For example, Search Ads 360 or Display & Video 360.
|
|
169
170
|
*/
|
|
170
171
|
utm_source_platform: optional(noEmptyString),
|
|
171
172
|
/**
|
|
172
|
-
* Type of creative, for example
|
|
173
|
+
* Type of creative, for example, display, native, video, search, utm_creative_format is not
|
|
173
174
|
* currently reported in Google Analytics 4 properties.
|
|
174
175
|
*/
|
|
175
176
|
utm_creative_format: optional(noEmptyString),
|
|
176
177
|
/**
|
|
177
|
-
* Targeting criteria applied to a campaign, for example
|
|
178
|
+
* Targeting criteria applied to a campaign, for example, remarketing, prospecting,
|
|
178
179
|
* utm_marketing_tactic is not currently reported in Google Analytics 4 properties.
|
|
179
180
|
* */
|
|
180
181
|
utm_marketing_tactic: optional(noEmptyString)
|
|
@@ -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 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,GAAG,CAAC;CAAG,OAAO;CAAG,QAAQ;CAAGA,OAAM;AAAC,CAAC,CACtE,CACF;AAEA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAAmB,CAAC,eAAe,YAAY;AAE5D,MAAa,aAAa,OAAO;CAC/B,IAAI,SAAS,OAAO,CAAC;CACrB,SAAS,SAAS,OAAO,CAAC;CAC1B,YAAY,SAAS,OAAO,CAAC;CAC7B,SAAS,SAAS,OAAO,CAAC;CAC1B,cAAc,SAAS,OAAO,CAAC;CAC/B,iBAAiB,SAAS,OAAO,CAAC;CAClC,UAAUC,OAAM,aAAa;CAC7B,QAAQ,SAAS,OAAO,CAAC;CACzB,WAAW,SAAS,OAAO,CAAC,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,EAAE,CAAC,C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AM,CAAC,CAAC,MAAM,UAAU,GAAG,CAAC;CACnC,SAAS,OAAO,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,UAAU,KAAK,CAAC;AACxD,CAAC;AAED,MAAM,gBAAgB,KACpB,OAAO,CAAC,CAAC,MAAM,UAAU,GAAG,CAAC,GAC7B,WAAW,MAAO,IAAI,IAAI,KAAA,CAAU,CACtC;;;;;AAMA,MAAa,mBAAmB,OAAO;;CAErC,KAAK,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,UAAU,IAAI,CAAC;;;;;CAM9C,QAAQ,SAAS,aAAa;;CAG9B,YAAY,OAAO,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC;;CAGvD,YAAY,OAAO,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"}
|
|
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,GAAG,CAAC;CAAG,OAAO;CAAG,QAAQ;CAAGA,OAAM;AA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BAAsB,SAAS,aAAa;AAC9C,CAAC"}
|
package/dist/tanstack/index.cjs
CHANGED
|
@@ -4,8 +4,8 @@ const require_hooks_use_click_id_persistence = require("../hooks/use-click-id-pe
|
|
|
4
4
|
const require_hooks_use_outbound_click_analytics = require("../hooks/use-outbound-click-analytics.cjs");
|
|
5
5
|
const require_hooks_use_web_analytics = require("../hooks/use-web-analytics.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
|
-
let web_vitals = require("web-vitals");
|
|
8
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let web_vitals = require("web-vitals");
|
|
9
9
|
let _tanstack_react_router = require("@tanstack/react-router");
|
|
10
10
|
//#region src/tanstack/index.tsx
|
|
11
11
|
function useReportWebVitals(reportWebVitalsFn) {
|
package/dist/tanstack/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { useClickIdPersistence } from "../hooks/use-click-id-persistence.mjs";
|
|
|
3
3
|
import { useOutboundClickAnalytics } from "../hooks/use-outbound-click-analytics.mjs";
|
|
4
4
|
import { useWebAnalytics } from "../hooks/use-web-analytics.mjs";
|
|
5
5
|
import { useEffect } from "react";
|
|
6
|
-
import { onCLS, onFCP, onINP, onLCP, onTTFB } from "web-vitals";
|
|
7
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { onCLS, onFCP, onINP, onLCP, onTTFB } from "web-vitals";
|
|
8
8
|
import { useLocation } from "@tanstack/react-router";
|
|
9
9
|
//#region src/tanstack/index.tsx
|
|
10
10
|
function useReportWebVitals(reportWebVitalsFn) {
|
package/dist/visitor/index.cjs
CHANGED
|
@@ -4,11 +4,13 @@ const require_constants_storage = require("../constants/storage.cjs");
|
|
|
4
4
|
let _shware_utils = require("@shware/utils");
|
|
5
5
|
//#region src/visitor/index.ts
|
|
6
6
|
async function createVisitor() {
|
|
7
|
+
const tags = await require_setup_index.config.getTags();
|
|
7
8
|
const dto = {
|
|
8
9
|
device_id: await require_setup_index.config.getDeviceId(),
|
|
9
10
|
platform: require_setup_index.config.platform,
|
|
10
11
|
environment: require_setup_index.config.environment,
|
|
11
|
-
|
|
12
|
+
tags,
|
|
13
|
+
properties: tags
|
|
12
14
|
};
|
|
13
15
|
const data = await (await (0, _shware_utils.fetch)(`${require_setup_index.config.endpoint}/visitors`, {
|
|
14
16
|
method: "POST",
|
|
@@ -44,11 +46,15 @@ async function getVisitor() {
|
|
|
44
46
|
}
|
|
45
47
|
async function setVisitor(dto) {
|
|
46
48
|
const { id } = await getVisitor();
|
|
49
|
+
const tags = await require_setup_index.config.getTags();
|
|
47
50
|
const response = await (0, _shware_utils.fetch)(`${require_setup_index.config.endpoint}/visitors/${id}`, {
|
|
48
51
|
method: "PATCH",
|
|
49
52
|
credentials: "include",
|
|
50
53
|
headers: await require_setup_index.config.getHeaders(),
|
|
51
|
-
body: JSON.stringify(
|
|
54
|
+
body: JSON.stringify({
|
|
55
|
+
...dto,
|
|
56
|
+
tags
|
|
57
|
+
})
|
|
52
58
|
});
|
|
53
59
|
if (!response.ok) throw new Error("Failed to set visitor");
|
|
54
60
|
const data = await response.json();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["config","keys","cache"],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport { keys } from '../constants/storage';\nimport type { CreateVisitorDTO } from '../schema/index';\nimport { cache, config } from '../setup/index';\nimport type { UpdateVisitorDTO, Visitor, VisitorProperties } from './types';\n\nasync function createVisitor(): Promise<Visitor> {\n const dto: CreateVisitorDTO = {\n device_id: await config.getDeviceId(),\n platform: config.platform,\n environment: config.environment,\n properties:
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["config","keys","cache"],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport { keys } from '../constants/storage';\nimport type { CreateVisitorDTO } from '../schema/index';\nimport { cache, config } from '../setup/index';\nimport type { UpdateVisitorDTO, Visitor, VisitorProperties } from './types';\n\nasync function createVisitor(): Promise<Visitor> {\n const tags = await config.getTags();\n const dto: CreateVisitorDTO = {\n device_id: await config.getDeviceId(),\n platform: config.platform,\n environment: config.environment,\n tags,\n properties: tags as VisitorProperties,\n };\n\n const response = await fetch(`${config.endpoint}/visitors`, {\n method: 'POST',\n credentials: 'include',\n headers: await config.getHeaders(),\n body: JSON.stringify(dto),\n });\n\n const data = (await response.json()) as Visitor;\n if (data.id) {\n config.storage.setItem(keys.visitor_id, data.id);\n }\n return data;\n}\n\nasync function getOrCreateVisitor(): Promise<Visitor> {\n const visitorId = config.storage.getItem(keys.visitor_id);\n if (visitorId && visitorId !== 'undefined') {\n const response = await fetch(`${config.endpoint}/visitors/${visitorId}`, {\n method: 'GET',\n credentials: 'include',\n headers: await config.getHeaders(),\n });\n\n if (!response.ok) return createVisitor();\n const data = (await response.json()) as Visitor;\n\n // The legacy system used int64 ids (SnowflakeId); the new system switched to UUID_v7. The GET\n // endpoint accepts both, and querying with a legacy id returns the new UUID_v7,\n // so we write it back here to refresh the stored id for a smooth migration.\n if (data.id) {\n config.storage.setItem(keys.visitor_id, data.id);\n }\n return data;\n } else {\n return createVisitor();\n }\n}\n\nlet visitorFetcher: Promise<Visitor> | null = null;\n\nexport async function getVisitor(): Promise<Visitor> {\n if (cache.visitor) return cache.visitor;\n if (visitorFetcher) return visitorFetcher;\n visitorFetcher = getOrCreateVisitor();\n cache.visitor = await visitorFetcher;\n visitorFetcher = null;\n return cache.visitor;\n}\n\nexport async function setVisitor(dto: UpdateVisitorDTO) {\n const { id } = await getVisitor();\n const tags = await config.getTags();\n const response = await fetch(`${config.endpoint}/visitors/${id}`, {\n method: 'PATCH',\n credentials: 'include',\n headers: await config.getHeaders(),\n body: JSON.stringify({ ...dto, tags }),\n });\n\n if (!response.ok) throw new Error('Failed to set visitor');\n const data = (await response.json()) as Visitor;\n\n config.thirdPartyUserSetters.forEach((setter) => setter(dto));\n cache.visitor = data;\n return data;\n}\n"],"mappings":";;;;;AAMA,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A,eAAsB,WAAW,KAAuB;CACtD,MAAM,EAAE,OAAO,MAAM,WAAW;CAChC,MAAM,OAAO,MAAMF,oBAAAA,OAAO,QAAQ;CAClC,MAAM,WAAW,OAAA,GAAA,cAAA,MAAA,CAAY,GAAGA,oBAAAA,OAAO,SAAS,YAAY,MAAM;EAChE,QAAQ;EACR,aAAa;EACb,SAAS,MAAMA,oBAAAA,OAAO,WAAW;EACjC,MAAM,KAAK,UAAU;GAAE,GAAG;GAAK;EAAK,CAAC;CACvC,CAAC;CAED,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM,uBAAuB;CACzD,MAAM,OAAQ,MAAM,SAAS,KAAK;CAElC,oBAAA,OAAO,sBAAsB,SAAS,WAAW,OAAO,GAAG,CAAC;CAC5D,oBAAA,MAAM,UAAU;CAChB,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":";;iBAwDsB,cAAc,QAAQ;iBAStB,WAAW,KAAK,mBAAgB,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/visitor/index.ts"],"mappings":";;iBAwDsB,cAAc,QAAQ;iBAStB,WAAW,KAAK,mBAAgB,QAAA"}
|
package/dist/visitor/index.mjs
CHANGED
|
@@ -3,11 +3,13 @@ import { keys } from "../constants/storage.mjs";
|
|
|
3
3
|
import { fetch } from "@shware/utils";
|
|
4
4
|
//#region src/visitor/index.ts
|
|
5
5
|
async function createVisitor() {
|
|
6
|
+
const tags = await config.getTags();
|
|
6
7
|
const dto = {
|
|
7
8
|
device_id: await config.getDeviceId(),
|
|
8
9
|
platform: config.platform,
|
|
9
10
|
environment: config.environment,
|
|
10
|
-
|
|
11
|
+
tags,
|
|
12
|
+
properties: tags
|
|
11
13
|
};
|
|
12
14
|
const data = await (await fetch(`${config.endpoint}/visitors`, {
|
|
13
15
|
method: "POST",
|
|
@@ -43,11 +45,15 @@ async function getVisitor() {
|
|
|
43
45
|
}
|
|
44
46
|
async function setVisitor(dto) {
|
|
45
47
|
const { id } = await getVisitor();
|
|
48
|
+
const tags = await config.getTags();
|
|
46
49
|
const response = await fetch(`${config.endpoint}/visitors/${id}`, {
|
|
47
50
|
method: "PATCH",
|
|
48
51
|
credentials: "include",
|
|
49
52
|
headers: await config.getHeaders(),
|
|
50
|
-
body: JSON.stringify(
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
...dto,
|
|
55
|
+
tags
|
|
56
|
+
})
|
|
51
57
|
});
|
|
52
58
|
if (!response.ok) throw new Error("Failed to set visitor");
|
|
53
59
|
const data = await response.json();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport { keys } from '../constants/storage';\nimport type { CreateVisitorDTO } from '../schema/index';\nimport { cache, config } from '../setup/index';\nimport type { UpdateVisitorDTO, Visitor, VisitorProperties } from './types';\n\nasync function createVisitor(): Promise<Visitor> {\n const dto: CreateVisitorDTO = {\n device_id: await config.getDeviceId(),\n platform: config.platform,\n environment: config.environment,\n properties:
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/visitor/index.ts"],"sourcesContent":["import { fetch } from '@shware/utils';\nimport { keys } from '../constants/storage';\nimport type { CreateVisitorDTO } from '../schema/index';\nimport { cache, config } from '../setup/index';\nimport type { UpdateVisitorDTO, Visitor, VisitorProperties } from './types';\n\nasync function createVisitor(): Promise<Visitor> {\n const tags = await config.getTags();\n const dto: CreateVisitorDTO = {\n device_id: await config.getDeviceId(),\n platform: config.platform,\n environment: config.environment,\n tags,\n properties: tags as VisitorProperties,\n };\n\n const response = await fetch(`${config.endpoint}/visitors`, {\n method: 'POST',\n credentials: 'include',\n headers: await config.getHeaders(),\n body: JSON.stringify(dto),\n });\n\n const data = (await response.json()) as Visitor;\n if (data.id) {\n config.storage.setItem(keys.visitor_id, data.id);\n }\n return data;\n}\n\nasync function getOrCreateVisitor(): Promise<Visitor> {\n const visitorId = config.storage.getItem(keys.visitor_id);\n if (visitorId && visitorId !== 'undefined') {\n const response = await fetch(`${config.endpoint}/visitors/${visitorId}`, {\n method: 'GET',\n credentials: 'include',\n headers: await config.getHeaders(),\n });\n\n if (!response.ok) return createVisitor();\n const data = (await response.json()) as Visitor;\n\n // The legacy system used int64 ids (SnowflakeId); the new system switched to UUID_v7. The GET\n // endpoint accepts both, and querying with a legacy id returns the new UUID_v7,\n // so we write it back here to refresh the stored id for a smooth migration.\n if (data.id) {\n config.storage.setItem(keys.visitor_id, data.id);\n }\n return data;\n } else {\n return createVisitor();\n }\n}\n\nlet visitorFetcher: Promise<Visitor> | null = null;\n\nexport async function getVisitor(): Promise<Visitor> {\n if (cache.visitor) return cache.visitor;\n if (visitorFetcher) return visitorFetcher;\n visitorFetcher = getOrCreateVisitor();\n cache.visitor = await visitorFetcher;\n visitorFetcher = null;\n return cache.visitor;\n}\n\nexport async function setVisitor(dto: UpdateVisitorDTO) {\n const { id } = await getVisitor();\n const tags = await config.getTags();\n const response = await fetch(`${config.endpoint}/visitors/${id}`, {\n method: 'PATCH',\n credentials: 'include',\n headers: await config.getHeaders(),\n body: JSON.stringify({ ...dto, tags }),\n });\n\n if (!response.ok) throw new Error('Failed to set visitor');\n const data = (await response.json()) as Visitor;\n\n config.thirdPartyUserSetters.forEach((setter) => setter(dto));\n cache.visitor = data;\n return data;\n}\n"],"mappings":";;;;AAMA,eAAe,gBAAkC;CAC/C,MAAM,OAAO,MAAM,OAAO,QAAQ;CAClC,MAAM,MAAwB;EAC5B,WAAW,MAAM,OAAO,YAAY;EACpC,UAAU,OAAO;EACjB,aAAa,OAAO;E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AM,OAAQ,MAAM,SAAS,KAAK;CAElC,OAAO,sBAAsB,SAAS,WAAW,OAAO,GAAG,CAAC;CAC5D,MAAM,UAAU;CAChB,OAAO;AACT"}
|
package/dist/visitor/types.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Environment, Platform } from "../track/types.cjs";
|
|
1
|
+
import { UserProvidedData } from "../track/gtag.cjs";
|
|
2
|
+
import { Environment, Platform, TrackTags } from "../track/types.cjs";
|
|
3
3
|
//#region src/visitor/types.d.ts
|
|
4
4
|
type VisitorProperties = Record<Lowercase<string>, string | number | boolean | null>;
|
|
5
5
|
interface Visitor {
|
|
@@ -7,13 +7,13 @@ interface Visitor {
|
|
|
7
7
|
device_id: string;
|
|
8
8
|
platform: Platform;
|
|
9
9
|
environment: Environment;
|
|
10
|
-
|
|
10
|
+
tags: TrackTags;
|
|
11
11
|
}
|
|
12
12
|
interface UpdateVisitorDTO {
|
|
13
13
|
user_id?: string;
|
|
14
14
|
distinct_id?: string;
|
|
15
15
|
data?: UserProvidedData;
|
|
16
|
-
properties?:
|
|
16
|
+
properties?: VisitorProperties;
|
|
17
17
|
}
|
|
18
18
|
type ThirdPartyUserSetter = (dto: UpdateVisitorDTO) => void;
|
|
19
19
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/visitor/types.ts"],"mappings":";;;KAGY,oBAAoB,OAAO;UAEtB;EACf;EACA;EACA,UAAU;EACV,aAAa;EACb,
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/visitor/types.ts"],"mappings":";;;KAGY,oBAAoB,OAAO;UAEtB;EACf;EACA;EACA,UAAU;EACV,aAAa;EACb,MAAM;;UAGS;EACf;EACA;EACA,OAAO;EACP,aAAa;;KAGH,wBAAwB,KAAK"}
|
package/dist/visitor/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Environment, Platform } from "../track/types.mjs";
|
|
1
|
+
import { UserProvidedData } from "../track/gtag.mjs";
|
|
2
|
+
import { Environment, Platform, TrackTags } from "../track/types.mjs";
|
|
3
3
|
//#region src/visitor/types.d.ts
|
|
4
4
|
type VisitorProperties = Record<Lowercase<string>, string | number | boolean | null>;
|
|
5
5
|
interface Visitor {
|
|
@@ -7,13 +7,13 @@ interface Visitor {
|
|
|
7
7
|
device_id: string;
|
|
8
8
|
platform: Platform;
|
|
9
9
|
environment: Environment;
|
|
10
|
-
|
|
10
|
+
tags: TrackTags;
|
|
11
11
|
}
|
|
12
12
|
interface UpdateVisitorDTO {
|
|
13
13
|
user_id?: string;
|
|
14
14
|
distinct_id?: string;
|
|
15
15
|
data?: UserProvidedData;
|
|
16
|
-
properties?:
|
|
16
|
+
properties?: VisitorProperties;
|
|
17
17
|
}
|
|
18
18
|
type ThirdPartyUserSetter = (dto: UpdateVisitorDTO) => void;
|
|
19
19
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/visitor/types.ts"],"mappings":";;;KAGY,oBAAoB,OAAO;UAEtB;EACf;EACA;EACA,UAAU;EACV,aAAa;EACb,
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/visitor/types.ts"],"mappings":";;;KAGY,oBAAoB,OAAO;UAEtB;EACf;EACA;EACA,UAAU;EACV,aAAa;EACb,MAAM;;UAGS;EACf;EACA;EACA,OAAO;EACP,aAAa;;KAGH,wBAAwB,KAAK"}
|