@shware/analytics 5.1.2 → 7.0.0
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/native/setup.cjs +24 -3
- package/dist/native/setup.cjs.map +1 -1
- package/dist/native/setup.d.cts.map +1 -1
- package/dist/native/setup.d.mts.map +1 -1
- package/dist/native/setup.mjs +24 -3
- package/dist/native/setup.mjs.map +1 -1
- package/dist/schema/index.cjs +2 -6
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +8 -24
- package/dist/schema/index.d.cts.map +1 -1
- package/dist/schema/index.d.mts +8 -24
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/schema/index.mjs +2 -6
- package/dist/schema/index.mjs.map +1 -1
- package/dist/server/action-source.cjs +28 -0
- package/dist/server/action-source.cjs.map +1 -0
- package/dist/server/action-source.d.cts +20 -0
- package/dist/server/action-source.d.cts.map +1 -0
- package/dist/server/action-source.d.mts +20 -0
- package/dist/server/action-source.d.mts.map +1 -0
- package/dist/server/action-source.mjs +27 -0
- package/dist/server/action-source.mjs.map +1 -0
- package/dist/server/index.d.cts +2 -1
- package/dist/server/index.d.mts +2 -1
- package/dist/server/meta-conversions-api.cjs +13 -9
- package/dist/server/meta-conversions-api.cjs.map +1 -1
- package/dist/server/meta-conversions-api.d.cts +4 -3
- package/dist/server/meta-conversions-api.d.cts.map +1 -1
- package/dist/server/meta-conversions-api.d.mts +4 -3
- package/dist/server/meta-conversions-api.d.mts.map +1 -1
- package/dist/server/meta-conversions-api.mjs +13 -9
- package/dist/server/meta-conversions-api.mjs.map +1 -1
- package/dist/server/openai-conversions-api.cjs +8 -7
- package/dist/server/openai-conversions-api.cjs.map +1 -1
- package/dist/server/openai-conversions-api.d.cts +3 -2
- package/dist/server/openai-conversions-api.d.cts.map +1 -1
- package/dist/server/openai-conversions-api.d.mts +3 -2
- package/dist/server/openai-conversions-api.d.mts.map +1 -1
- package/dist/server/openai-conversions-api.mjs +8 -7
- package/dist/server/openai-conversions-api.mjs.map +1 -1
- package/dist/server/reddit-conversions-api.cjs +6 -4
- package/dist/server/reddit-conversions-api.cjs.map +1 -1
- package/dist/server/reddit-conversions-api.d.cts +3 -2
- package/dist/server/reddit-conversions-api.d.cts.map +1 -1
- package/dist/server/reddit-conversions-api.d.mts +3 -2
- package/dist/server/reddit-conversions-api.d.mts.map +1 -1
- package/dist/server/reddit-conversions-api.mjs +6 -4
- package/dist/server/reddit-conversions-api.mjs.map +1 -1
- package/dist/track/index.cjs +23 -4
- package/dist/track/index.cjs.map +1 -1
- package/dist/track/index.d.cts.map +1 -1
- package/dist/track/index.d.mts.map +1 -1
- package/dist/track/index.mjs +23 -4
- package/dist/track/index.mjs.map +1 -1
- package/dist/track/types.d.cts +13 -5
- package/dist/track/types.d.cts.map +1 -1
- package/dist/track/types.d.mts +13 -5
- package/dist/track/types.d.mts.map +1 -1
- package/dist/web/index.cjs +23 -7
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts.map +1 -1
- package/dist/web/index.d.mts.map +1 -1
- package/dist/web/index.mjs +23 -7
- package/dist/web/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/native/setup.cjs
CHANGED
|
@@ -28,7 +28,29 @@ const storage = {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* `getTags` runs once per event now, and both of these reach for a native module. Neither answer
|
|
33
|
+
* can change while the app is running, so each is resolved once and the promise is reused. A
|
|
34
|
+
* failed lookup is not cached, so the next event tries again.
|
|
35
|
+
*/
|
|
36
|
+
let deviceIdPromise;
|
|
37
|
+
let installReferrerPromise;
|
|
38
|
+
function getDeviceId() {
|
|
39
|
+
deviceIdPromise ??= resolveDeviceId().catch((error) => {
|
|
40
|
+
deviceIdPromise = void 0;
|
|
41
|
+
throw error;
|
|
42
|
+
});
|
|
43
|
+
return deviceIdPromise;
|
|
44
|
+
}
|
|
45
|
+
function getInstallReferrer() {
|
|
46
|
+
if (react_native.Platform.OS !== "android") return Promise.resolve(void 0);
|
|
47
|
+
installReferrerPromise ??= (0, expo_application.getInstallReferrerAsync)().catch((error) => {
|
|
48
|
+
installReferrerPromise = void 0;
|
|
49
|
+
throw error;
|
|
50
|
+
});
|
|
51
|
+
return installReferrerPromise;
|
|
52
|
+
}
|
|
53
|
+
async function resolveDeviceId() {
|
|
32
54
|
let deviceId = null;
|
|
33
55
|
if (react_native.Platform.OS === "ios") deviceId = await (0, expo_application.getIosIdForVendorAsync)();
|
|
34
56
|
else if (react_native.Platform.OS === "android") deviceId = (0, expo_application.getAndroidId)();
|
|
@@ -54,7 +76,7 @@ async function getTags() {
|
|
|
54
76
|
const screen = react_native.Dimensions.get("screen");
|
|
55
77
|
const screen_width = Math.floor(screen.width);
|
|
56
78
|
const screen_height = Math.floor(screen.height);
|
|
57
|
-
const install_referrer =
|
|
79
|
+
const install_referrer = await getInstallReferrer();
|
|
58
80
|
const params = new react_native_url_polyfill.URLSearchParams(install_referrer);
|
|
59
81
|
const tags = {
|
|
60
82
|
os: `${expo_device.osName} ${expo_device.osVersion}`,
|
|
@@ -72,7 +94,6 @@ async function getTags() {
|
|
|
72
94
|
release: require_setup_index.config.release,
|
|
73
95
|
language: (0, expo_localization.getLocales)().at(0)?.languageTag ?? "en",
|
|
74
96
|
time_zone: (0, expo_localization.getCalendars)().at(0)?.timeZone ?? "UTC",
|
|
75
|
-
source: "app",
|
|
76
97
|
advertising_id: (0, expo_tracking_transparency.getAdvertisingId)() ?? void 0,
|
|
77
98
|
install_referrer,
|
|
78
99
|
utm_source: params.get("utm_source") ?? void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.cjs","names":["Platform","deviceType","DeviceType","Dimensions","URLSearchParams","osName","osVersion","modelName","manufacturer","modelId","PixelRatio","config"],"sources":["../../src/native/setup.ts"],"sourcesContent":["import 'expo-sqlite/localStorage/install';\nimport { getAndroidId, getInstallReferrerAsync, getIosIdForVendorAsync } from 'expo-application';\nimport { randomUUID } from 'expo-crypto';\nimport {\n DeviceType,\n deviceType,\n manufacturer,\n modelId,\n modelName,\n osName,\n osVersion,\n} from 'expo-device';\nimport { getCalendars, getLocales } from 'expo-localization';\nimport { getAdvertisingId } from 'expo-tracking-transparency';\nimport { Dimensions, PixelRatio, Platform } from 'react-native';\nimport { URLSearchParams } from 'react-native-url-polyfill';\nimport { type Storage, cache, config } from '../setup/index';\nimport type { TrackTags } from '../track/types';\n\nconst map = new Map<string, string>();\n\nexport const storage: Storage = {\n getItem: (key) => {\n try {\n return localStorage.getItem(key);\n } catch {\n console.error('localStorage is not available');\n return map.get(key) ?? null;\n }\n },\n setItem: (key, value) => {\n try {\n localStorage.setItem(key, value);\n } catch {\n console.error('localStorage is not available');\n map.set(key, value);\n }\n },\n};\n\nexport
|
|
1
|
+
{"version":3,"file":"setup.cjs","names":["Platform","deviceType","DeviceType","Dimensions","URLSearchParams","osName","osVersion","modelName","manufacturer","modelId","PixelRatio","config"],"sources":["../../src/native/setup.ts"],"sourcesContent":["import 'expo-sqlite/localStorage/install';\nimport { getAndroidId, getInstallReferrerAsync, getIosIdForVendorAsync } from 'expo-application';\nimport { randomUUID } from 'expo-crypto';\nimport {\n DeviceType,\n deviceType,\n manufacturer,\n modelId,\n modelName,\n osName,\n osVersion,\n} from 'expo-device';\nimport { getCalendars, getLocales } from 'expo-localization';\nimport { getAdvertisingId } from 'expo-tracking-transparency';\nimport { Dimensions, PixelRatio, Platform } from 'react-native';\nimport { URLSearchParams } from 'react-native-url-polyfill';\nimport { type Storage, cache, config } from '../setup/index';\nimport type { TrackTags } from '../track/types';\n\nconst map = new Map<string, string>();\n\nexport const storage: Storage = {\n getItem: (key) => {\n try {\n return localStorage.getItem(key);\n } catch {\n console.error('localStorage is not available');\n return map.get(key) ?? null;\n }\n },\n setItem: (key, value) => {\n try {\n localStorage.setItem(key, value);\n } catch {\n console.error('localStorage is not available');\n map.set(key, value);\n }\n },\n};\n\n/**\n * `getTags` runs once per event now, and both of these reach for a native module. Neither answer\n * can change while the app is running, so each is resolved once and the promise is reused. A\n * failed lookup is not cached, so the next event tries again.\n */\nlet deviceIdPromise: Promise<string> | undefined;\nlet installReferrerPromise: Promise<string | undefined> | undefined;\n\nexport function getDeviceId(): Promise<string> {\n deviceIdPromise ??= resolveDeviceId().catch((error: unknown) => {\n deviceIdPromise = undefined;\n throw error;\n });\n return deviceIdPromise;\n}\n\nfunction getInstallReferrer(): Promise<string | undefined> {\n if (Platform.OS !== 'android') return Promise.resolve(undefined);\n installReferrerPromise ??= getInstallReferrerAsync().catch((error: unknown) => {\n installReferrerPromise = undefined;\n throw error;\n });\n return installReferrerPromise;\n}\n\nasync function resolveDeviceId(): Promise<string> {\n let deviceId: string | null = null;\n if (Platform.OS === 'ios') {\n deviceId = await getIosIdForVendorAsync();\n } else if (Platform.OS === 'android') {\n deviceId = getAndroidId();\n }\n if (!deviceId) {\n deviceId = localStorage.getItem('device_id');\n if (!deviceId) {\n deviceId = randomUUID();\n localStorage.setItem('device_id', deviceId);\n }\n }\n return deviceId;\n}\n\nexport function getDeviceType(): string | undefined {\n switch (deviceType) {\n case DeviceType.PHONE:\n return 'mobile';\n case DeviceType.TABLET:\n return 'tablet';\n case DeviceType.DESKTOP:\n return 'desktop';\n case DeviceType.TV:\n return 'smarttv';\n default:\n return undefined;\n }\n}\n\nexport async function getTags(): Promise<TrackTags> {\n const screen = Dimensions.get('screen');\n const screen_width = Math.floor(screen.width);\n const screen_height = Math.floor(screen.height);\n\n const install_referrer = await getInstallReferrer();\n const params = new URLSearchParams(install_referrer);\n\n const tags: TrackTags = {\n os: `${osName} ${osVersion}`,\n os_name: osName ?? undefined,\n os_version: osVersion ?? undefined,\n device: modelName ?? undefined,\n device_id: await getDeviceId(),\n device_type: getDeviceType(),\n device_vendor: manufacturer ?? undefined,\n device_model_id: modelId ?? undefined,\n device_pixel_ratio: PixelRatio.get(),\n screen_width,\n screen_height,\n screen_resolution: `${screen_width}x${screen_height}`,\n release: config.release,\n language: getLocales().at(0)?.languageTag ?? 'en',\n time_zone: getCalendars().at(0)?.timeZone ?? 'UTC',\n // ads\n advertising_id: getAdvertisingId() ?? undefined,\n install_referrer,\n // utm params\n utm_source: params.get('utm_source') ?? undefined,\n utm_medium: params.get('utm_medium') ?? undefined,\n utm_campaign: params.get('utm_campaign') ?? undefined,\n utm_term: params.get('utm_term') ?? undefined,\n utm_content: params.get('utm_content') ?? undefined,\n utm_id: params.get('utm_id') ?? undefined,\n utm_source_platform: params.get('utm_source_platform') ?? undefined,\n utm_creative_format: params.get('utm_creative_format') ?? undefined,\n utm_marketing_tactic: params.get('utm_marketing_tactic') ?? undefined,\n };\n\n cache.tags = tags;\n return tags;\n}\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,sBAAM,IAAI,IAAoB;AAEpC,MAAa,UAAmB;CAC9B,UAAU,QAAQ;EAChB,IAAI;GACF,OAAO,aAAa,QAAQ,GAAG;EACjC,QAAQ;GACN,QAAQ,MAAM,+BAA+B;GAC7C,OAAO,IAAI,IAAI,GAAG,KAAK;EACzB;CACF;CACA,UAAU,KAAK,UAAU;EACvB,IAAI;GACF,aAAa,QAAQ,KAAK,KAAK;EACjC,QAAQ;GACN,QAAQ,MAAM,+BAA+B;GAC7C,IAAI,IAAI,KAAK,KAAK;EACpB;CACF;AACF;;;;;;AAOA,IAAI;AACJ,IAAI;AAEJ,SAAgB,cAA+B;CAC7C,oBAAoB,gBAAgB,CAAC,CAAC,OAAO,UAAmB;EAC9D,kBAAkB,KAAA;EAClB,MAAM;CACR,CAAC;CACD,OAAO;AACT;AAEA,SAAS,qBAAkD;CACzD,IAAIA,aAAAA,SAAS,OAAO,WAAW,OAAO,QAAQ,QAAQ,KAAA,CAAS;CAC/D,4BAAA,GAAA,iBAAA,wBAAA,CAAmD,CAAC,CAAC,OAAO,UAAmB;EAC7E,yBAAyB,KAAA;EACzB,MAAM;CACR,CAAC;CACD,OAAO;AACT;AAEA,eAAe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AAC,CAAC,GAAG,CAAC,CAAC,EAAE,eAAe;EAC7C,YAAA,GAAA,kBAAA,aAAA,CAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY;EAE7C,iBAAA,GAAA,2BAAA,iBAAA,CAAiC,KAAK,KAAA;EACtC;EAEA,YAAY,OAAO,IAAI,YAAY,KAAK,KAAA;EACxC,YAAY,OAAO,IAAI,YAAY,KAAK,KAAA;EACxC,cAAc,OAAO,IAAI,cAAc,KAAK,KAAA;EAC5C,UAAU,OAAO,IAAI,UAAU,KAAK,KAAA;EACpC,aAAa,OAAO,IAAI,aAAa,KAAK,KAAA;EAC1C,QAAQ,OAAO,IAAI,QAAQ,KAAK,KAAA;EAChC,qBAAqB,OAAO,IAAI,qBAAqB,KAAK,KAAA;EAC1D,qBAAqB,OAAO,IAAI,qBAAqB,KAAK,KAAA;EAC1D,sBAAsB,OAAO,IAAI,sBAAsB,KAAK,KAAA;CAC9D;CAEA,oBAAA,MAAM,OAAO;CACb,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.cts","names":[],"sources":["../../src/native/setup.ts"],"mappings":";;;;cAqBa,SAAS;
|
|
1
|
+
{"version":3,"file":"setup.d.cts","names":[],"sources":["../../src/native/setup.ts"],"mappings":";;;;cAqBa,SAAS;iBA2BN,eAAe;iBAkCf;iBAeM,WAAW,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.mts","names":[],"sources":["../../src/native/setup.ts"],"mappings":";;;;cAqBa,SAAS;
|
|
1
|
+
{"version":3,"file":"setup.d.mts","names":[],"sources":["../../src/native/setup.ts"],"mappings":";;;;cAqBa,SAAS;iBA2BN,eAAe;iBAkCf;iBAeM,WAAW,QAAQ"}
|
package/dist/native/setup.mjs
CHANGED
|
@@ -27,7 +27,29 @@ const storage = {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* `getTags` runs once per event now, and both of these reach for a native module. Neither answer
|
|
32
|
+
* can change while the app is running, so each is resolved once and the promise is reused. A
|
|
33
|
+
* failed lookup is not cached, so the next event tries again.
|
|
34
|
+
*/
|
|
35
|
+
let deviceIdPromise;
|
|
36
|
+
let installReferrerPromise;
|
|
37
|
+
function getDeviceId() {
|
|
38
|
+
deviceIdPromise ??= resolveDeviceId().catch((error) => {
|
|
39
|
+
deviceIdPromise = void 0;
|
|
40
|
+
throw error;
|
|
41
|
+
});
|
|
42
|
+
return deviceIdPromise;
|
|
43
|
+
}
|
|
44
|
+
function getInstallReferrer() {
|
|
45
|
+
if (Platform.OS !== "android") return Promise.resolve(void 0);
|
|
46
|
+
installReferrerPromise ??= getInstallReferrerAsync().catch((error) => {
|
|
47
|
+
installReferrerPromise = void 0;
|
|
48
|
+
throw error;
|
|
49
|
+
});
|
|
50
|
+
return installReferrerPromise;
|
|
51
|
+
}
|
|
52
|
+
async function resolveDeviceId() {
|
|
31
53
|
let deviceId = null;
|
|
32
54
|
if (Platform.OS === "ios") deviceId = await getIosIdForVendorAsync();
|
|
33
55
|
else if (Platform.OS === "android") deviceId = getAndroidId();
|
|
@@ -53,7 +75,7 @@ async function getTags() {
|
|
|
53
75
|
const screen = Dimensions.get("screen");
|
|
54
76
|
const screen_width = Math.floor(screen.width);
|
|
55
77
|
const screen_height = Math.floor(screen.height);
|
|
56
|
-
const install_referrer =
|
|
78
|
+
const install_referrer = await getInstallReferrer();
|
|
57
79
|
const params = new URLSearchParams(install_referrer);
|
|
58
80
|
const tags = {
|
|
59
81
|
os: `${osName} ${osVersion}`,
|
|
@@ -71,7 +93,6 @@ async function getTags() {
|
|
|
71
93
|
release: config.release,
|
|
72
94
|
language: getLocales().at(0)?.languageTag ?? "en",
|
|
73
95
|
time_zone: getCalendars().at(0)?.timeZone ?? "UTC",
|
|
74
|
-
source: "app",
|
|
75
96
|
advertising_id: getAdvertisingId() ?? void 0,
|
|
76
97
|
install_referrer,
|
|
77
98
|
utm_source: params.get("utm_source") ?? void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.mjs","names":[],"sources":["../../src/native/setup.ts"],"sourcesContent":["import 'expo-sqlite/localStorage/install';\nimport { getAndroidId, getInstallReferrerAsync, getIosIdForVendorAsync } from 'expo-application';\nimport { randomUUID } from 'expo-crypto';\nimport {\n DeviceType,\n deviceType,\n manufacturer,\n modelId,\n modelName,\n osName,\n osVersion,\n} from 'expo-device';\nimport { getCalendars, getLocales } from 'expo-localization';\nimport { getAdvertisingId } from 'expo-tracking-transparency';\nimport { Dimensions, PixelRatio, Platform } from 'react-native';\nimport { URLSearchParams } from 'react-native-url-polyfill';\nimport { type Storage, cache, config } from '../setup/index';\nimport type { TrackTags } from '../track/types';\n\nconst map = new Map<string, string>();\n\nexport const storage: Storage = {\n getItem: (key) => {\n try {\n return localStorage.getItem(key);\n } catch {\n console.error('localStorage is not available');\n return map.get(key) ?? null;\n }\n },\n setItem: (key, value) => {\n try {\n localStorage.setItem(key, value);\n } catch {\n console.error('localStorage is not available');\n map.set(key, value);\n }\n },\n};\n\nexport
|
|
1
|
+
{"version":3,"file":"setup.mjs","names":[],"sources":["../../src/native/setup.ts"],"sourcesContent":["import 'expo-sqlite/localStorage/install';\nimport { getAndroidId, getInstallReferrerAsync, getIosIdForVendorAsync } from 'expo-application';\nimport { randomUUID } from 'expo-crypto';\nimport {\n DeviceType,\n deviceType,\n manufacturer,\n modelId,\n modelName,\n osName,\n osVersion,\n} from 'expo-device';\nimport { getCalendars, getLocales } from 'expo-localization';\nimport { getAdvertisingId } from 'expo-tracking-transparency';\nimport { Dimensions, PixelRatio, Platform } from 'react-native';\nimport { URLSearchParams } from 'react-native-url-polyfill';\nimport { type Storage, cache, config } from '../setup/index';\nimport type { TrackTags } from '../track/types';\n\nconst map = new Map<string, string>();\n\nexport const storage: Storage = {\n getItem: (key) => {\n try {\n return localStorage.getItem(key);\n } catch {\n console.error('localStorage is not available');\n return map.get(key) ?? null;\n }\n },\n setItem: (key, value) => {\n try {\n localStorage.setItem(key, value);\n } catch {\n console.error('localStorage is not available');\n map.set(key, value);\n }\n },\n};\n\n/**\n * `getTags` runs once per event now, and both of these reach for a native module. Neither answer\n * can change while the app is running, so each is resolved once and the promise is reused. A\n * failed lookup is not cached, so the next event tries again.\n */\nlet deviceIdPromise: Promise<string> | undefined;\nlet installReferrerPromise: Promise<string | undefined> | undefined;\n\nexport function getDeviceId(): Promise<string> {\n deviceIdPromise ??= resolveDeviceId().catch((error: unknown) => {\n deviceIdPromise = undefined;\n throw error;\n });\n return deviceIdPromise;\n}\n\nfunction getInstallReferrer(): Promise<string | undefined> {\n if (Platform.OS !== 'android') return Promise.resolve(undefined);\n installReferrerPromise ??= getInstallReferrerAsync().catch((error: unknown) => {\n installReferrerPromise = undefined;\n throw error;\n });\n return installReferrerPromise;\n}\n\nasync function resolveDeviceId(): Promise<string> {\n let deviceId: string | null = null;\n if (Platform.OS === 'ios') {\n deviceId = await getIosIdForVendorAsync();\n } else if (Platform.OS === 'android') {\n deviceId = getAndroidId();\n }\n if (!deviceId) {\n deviceId = localStorage.getItem('device_id');\n if (!deviceId) {\n deviceId = randomUUID();\n localStorage.setItem('device_id', deviceId);\n }\n }\n return deviceId;\n}\n\nexport function getDeviceType(): string | undefined {\n switch (deviceType) {\n case DeviceType.PHONE:\n return 'mobile';\n case DeviceType.TABLET:\n return 'tablet';\n case DeviceType.DESKTOP:\n return 'desktop';\n case DeviceType.TV:\n return 'smarttv';\n default:\n return undefined;\n }\n}\n\nexport async function getTags(): Promise<TrackTags> {\n const screen = Dimensions.get('screen');\n const screen_width = Math.floor(screen.width);\n const screen_height = Math.floor(screen.height);\n\n const install_referrer = await getInstallReferrer();\n const params = new URLSearchParams(install_referrer);\n\n const tags: TrackTags = {\n os: `${osName} ${osVersion}`,\n os_name: osName ?? undefined,\n os_version: osVersion ?? undefined,\n device: modelName ?? undefined,\n device_id: await getDeviceId(),\n device_type: getDeviceType(),\n device_vendor: manufacturer ?? undefined,\n device_model_id: modelId ?? undefined,\n device_pixel_ratio: PixelRatio.get(),\n screen_width,\n screen_height,\n screen_resolution: `${screen_width}x${screen_height}`,\n release: config.release,\n language: getLocales().at(0)?.languageTag ?? 'en',\n time_zone: getCalendars().at(0)?.timeZone ?? 'UTC',\n // ads\n advertising_id: getAdvertisingId() ?? undefined,\n install_referrer,\n // utm params\n utm_source: params.get('utm_source') ?? undefined,\n utm_medium: params.get('utm_medium') ?? undefined,\n utm_campaign: params.get('utm_campaign') ?? undefined,\n utm_term: params.get('utm_term') ?? undefined,\n utm_content: params.get('utm_content') ?? undefined,\n utm_id: params.get('utm_id') ?? undefined,\n utm_source_platform: params.get('utm_source_platform') ?? undefined,\n utm_creative_format: params.get('utm_creative_format') ?? undefined,\n utm_marketing_tactic: params.get('utm_marketing_tactic') ?? undefined,\n };\n\n cache.tags = tags;\n return tags;\n}\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,sBAAM,IAAI,IAAoB;AAEpC,MAAa,UAAmB;CAC9B,UAAU,QAAQ;EAChB,IAAI;GACF,OAAO,aAAa,QAAQ,GAAG;EACjC,QAAQ;GACN,QAAQ,MAAM,+BAA+B;GAC7C,OAAO,IAAI,IAAI,GAAG,KAAK;EACzB;CACF;CACA,UAAU,KAAK,UAAU;EACvB,IAAI;GACF,aAAa,QAAQ,KAAK,KAAK;EACjC,QAAQ;GACN,QAAQ,MAAM,+BAA+B;GAC7C,IAAI,IAAI,KAAK,KAAK;EACpB;CACF;AACF;;;;;;AAOA,IAAI;AACJ,IAAI;AAEJ,SAAgB,cAA+B;CAC7C,oBAAoB,gBAAgB,CAAC,CAAC,OAAO,UAAmB;EAC9D,kBAAkB,KAAA;EAClB,MAAM;CACR,CAAC;CACD,OAAO;AACT;AAEA,SAAS,qBAAkD;CACzD,IAAI,SAAS,OAAO,WAAW,OAAO,QAAQ,QAAQ,KAAA,CAAS;CAC/D,2BAA2B,wBAAwB,CAAC,CA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ACtC;EAEA,YAAY,OAAO,IAAI,YAAY,KAAK,KAAA;EACxC,YAAY,OAAO,IAAI,YAAY,KAAK,KAAA;EACxC,cAAc,OAAO,IAAI,cAAc,KAAK,KAAA;EAC5C,UAAU,OAAO,IAAI,UAAU,KAAK,KAAA;EACpC,aAAa,OAAO,IAAI,aAAa,KAAK,KAAA;EAC1C,QAAQ,OAAO,IAAI,QAAQ,KAAK,KAAA;EAChC,qBAAqB,OAAO,IAAI,qBAAqB,KAAK,KAAA;EAC1D,qBAAqB,OAAO,IAAI,qBAAqB,KAAK,KAAA;EAC1D,sBAAsB,OAAO,IAAI,sBAAsB,KAAK,KAAA;CAC9D;CAEA,MAAM,OAAO;CACb,OAAO;AACT"}
|
package/dist/schema/index.cjs
CHANGED
|
@@ -35,13 +35,9 @@ const tagsSchema = (0, zod_mini.object)({
|
|
|
35
35
|
release: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
36
36
|
language: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
37
37
|
time_zone: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
38
|
-
|
|
39
|
-
source: (0, zod_mini.optional)((0, zod_mini.enum)([
|
|
40
|
-
"web",
|
|
41
|
-
"app",
|
|
42
|
-
"offline"
|
|
43
|
-
])),
|
|
38
|
+
page_location: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
44
39
|
page_referrer: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
40
|
+
page_title: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
45
41
|
advertising_id: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
46
42
|
install_referrer: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
47
43
|
fbc: (0, zod_mini.optional)((0, zod_mini.string)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["iso"],"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n enum as _enum,\n null as _null,\n array,\n boolean,\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 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 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\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":";;;AA6BA,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;EAAQ,GAAA,SAAA,OAAA,CAAA,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,GAAG,CAAC;EAAU,GAAA,SAAA,OAAA,CAAA;EAAW,GAAA,SAAA,QAAA,CAAA;EAAS,GAAA,SAAA,KAAA,CAAA;AAAC,CAAC,CACtE,CACF;AAEA,MAAa,gBAAgB;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AAA,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":["iso"],"sources":["../../src/schema/index.ts"],"sourcesContent":["import {\n enum as _enum,\n null as _null,\n array,\n boolean,\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 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 page_location: optional(string()),\n page_referrer: optional(string()),\n page_title: 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\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":";;;AA6BA,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;EAAQ,GAAA,SAAA,OAAA,CAAA,CAAC,CAAC,OAAA,GAAA,SAAA,UAAA,CAAgB,GAAG,CAAC;EAAU,GAAA,SAAA,OAAA,CAAA;EAAW,GAAA,SAAA,QAAA,CAAA;EAAS,GAAA,SAAA,KAAA,CAAA;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,SA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AMA,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"}
|
package/dist/schema/index.d.cts
CHANGED
|
@@ -20,13 +20,9 @@ declare const tagsSchema: z.ZodMiniObject<{
|
|
|
20
20
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
21
21
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
22
22
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
23
|
-
|
|
24
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
25
|
-
app: "app";
|
|
26
|
-
offline: "offline";
|
|
27
|
-
web: "web";
|
|
28
|
-
}>>;
|
|
23
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
29
24
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
25
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
30
26
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
31
27
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
32
28
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -102,13 +98,9 @@ declare const createTrackEventSchema: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
102
98
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
99
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
104
100
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
105
|
-
|
|
106
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
107
|
-
app: "app";
|
|
108
|
-
offline: "offline";
|
|
109
|
-
web: "web";
|
|
110
|
-
}>>;
|
|
101
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
111
102
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
112
104
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
113
105
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
114
106
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -182,13 +174,9 @@ declare const createVisitorSchema: z.ZodMiniObject<{
|
|
|
182
174
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
183
175
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
184
176
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
185
|
-
|
|
186
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
187
|
-
app: "app";
|
|
188
|
-
offline: "offline";
|
|
189
|
-
web: "web";
|
|
190
|
-
}>>;
|
|
177
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
191
178
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
179
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
192
180
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
193
181
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
194
182
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -302,13 +290,9 @@ declare const updateVisitorSchema: z.ZodMiniObject<{
|
|
|
302
290
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
303
291
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
304
292
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
305
|
-
|
|
306
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
307
|
-
app: "app";
|
|
308
|
-
offline: "offline";
|
|
309
|
-
web: "web";
|
|
310
|
-
}>>;
|
|
293
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
311
294
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
295
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
312
296
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
313
297
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
314
298
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAoCa;cAUA;cAEA,YAAU,EAAA
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAoCa;cAUA;cAEA,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqErB,EAAA,KAAA;cAEW,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;cAOhB,wBAAsB,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAWE,EAAA,KAAA;cAExB,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAW9B,EAAA,KAAA;;;;;;;;;;;cA6BW,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;GAIjC,EAAA,KAAA;cAEW,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAW9B,EAAA,KAAA;cAEW,sBAAoB,EAAA;;;;GAI/B,EAAA,KAAA;;;;;cAWW,kBAAgB,EAAA;;;;;;;;;;;GA+C3B,EAAA,KAAA;KAEU,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
|
@@ -20,13 +20,9 @@ declare const tagsSchema: z.ZodMiniObject<{
|
|
|
20
20
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
21
21
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
22
22
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
23
|
-
|
|
24
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
25
|
-
app: "app";
|
|
26
|
-
offline: "offline";
|
|
27
|
-
web: "web";
|
|
28
|
-
}>>;
|
|
23
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
29
24
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
25
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
30
26
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
31
27
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
32
28
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -102,13 +98,9 @@ declare const createTrackEventSchema: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
102
98
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
99
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
104
100
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
105
|
-
|
|
106
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
107
|
-
app: "app";
|
|
108
|
-
offline: "offline";
|
|
109
|
-
web: "web";
|
|
110
|
-
}>>;
|
|
101
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
111
102
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
112
104
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
113
105
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
114
106
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -182,13 +174,9 @@ declare const createVisitorSchema: z.ZodMiniObject<{
|
|
|
182
174
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
183
175
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
184
176
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
185
|
-
|
|
186
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
187
|
-
app: "app";
|
|
188
|
-
offline: "offline";
|
|
189
|
-
web: "web";
|
|
190
|
-
}>>;
|
|
177
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
191
178
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
179
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
192
180
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
193
181
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
194
182
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -302,13 +290,9 @@ declare const updateVisitorSchema: z.ZodMiniObject<{
|
|
|
302
290
|
release: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
303
291
|
language: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
304
292
|
time_zone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
305
|
-
|
|
306
|
-
source: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
307
|
-
app: "app";
|
|
308
|
-
offline: "offline";
|
|
309
|
-
web: "web";
|
|
310
|
-
}>>;
|
|
293
|
+
page_location: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
311
294
|
page_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
295
|
+
page_title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
312
296
|
advertising_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
313
297
|
install_referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
314
298
|
fbc: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAoCa;cAUA;cAEA,YAAU,EAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/schema/index.ts"],"mappings":";;cAoCa;cAUA;cAEA,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqErB,EAAA,KAAA;cAEW,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;cAOhB,wBAAsB,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAWE,EAAA,KAAA;cAExB,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAW9B,EAAA,KAAA;;;;;;;;;;;cA6BW,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;GAIjC,EAAA,KAAA;cAEW,qBAAmB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAW9B,EAAA,KAAA;cAEW,sBAAoB,EAAA;;;;GAI/B,EAAA,KAAA;;;;;cAWW,kBAAgB,EAAA;;;;;;;;;;;GA+C3B,EAAA,KAAA;KAEU,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
|
@@ -34,13 +34,9 @@ const tagsSchema = object({
|
|
|
34
34
|
release: optional(string()),
|
|
35
35
|
language: optional(string()),
|
|
36
36
|
time_zone: optional(string()),
|
|
37
|
-
|
|
38
|
-
source: optional(enum$1([
|
|
39
|
-
"web",
|
|
40
|
-
"app",
|
|
41
|
-
"offline"
|
|
42
|
-
])),
|
|
37
|
+
page_location: optional(string()),
|
|
43
38
|
page_referrer: optional(string()),
|
|
39
|
+
page_title: optional(string()),
|
|
44
40
|
advertising_id: optional(string()),
|
|
45
41
|
install_referrer: optional(string()),
|
|
46
42
|
fbc: optional(string()),
|
|
@@ -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 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 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 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\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 UserProvidedDataD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["../../src/schema/index.ts"],"sourcesContent":["import {\n enum as _enum,\n null as _null,\n array,\n boolean,\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 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 page_location: optional(string()),\n page_referrer: optional(string()),\n page_title: 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\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":";;AA6BA,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,O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,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/server/action-source.ts
|
|
3
|
+
/**
|
|
4
|
+
* An OS name means the event came from a native app, `web` means a browser page. A caller that
|
|
5
|
+
* declares `macos`/`windows`/`linux` is declaring a desktop app — a page running in a webview
|
|
6
|
+
* should declare `web`.
|
|
7
|
+
*
|
|
8
|
+
* `unknown` maps to nothing, since no vendor value fits; each sender picks its own fallback.
|
|
9
|
+
*/
|
|
10
|
+
function getActionSource(platform) {
|
|
11
|
+
switch (platform) {
|
|
12
|
+
case "web": return "web";
|
|
13
|
+
case "ios":
|
|
14
|
+
case "android":
|
|
15
|
+
case "macos":
|
|
16
|
+
case "windows":
|
|
17
|
+
case "linux": return "app";
|
|
18
|
+
case "unknown": return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** An explicit action source always wins; otherwise it is derived from the event's platform. */
|
|
22
|
+
function resolveActionSource(platform, actionSource) {
|
|
23
|
+
return actionSource ?? getActionSource(platform);
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.resolveActionSource = resolveActionSource;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=action-source.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-source.cjs","names":[],"sources":["../../src/server/action-source.ts"],"sourcesContent":["import type { Platform } from '../track/types';\n\n/**\n * The coarse \"where did this happen\" categorization every conversions API asks for, under its\n * own name and its own spelling: Meta `action_source`, Reddit `action_source`, OpenAI\n * `action_source`. Each sender maps this to its vendor vocabulary.\n */\nexport type ActionSource = 'web' | 'app';\n\n/**\n * What a caller may state explicitly. `offline` is deliberately absent from the derived set:\n * it describes how a conversion was collected — in store, imported from a CRM, taken over the\n * phone — not what device it came from, so no platform implies it. Such events are built by a\n * backend rather than reported by a client SDK, which is why the sender takes it as an argument.\n */\nexport type EventActionSource = ActionSource | 'offline';\n\n/**\n * An OS name means the event came from a native app, `web` means a browser page. A caller that\n * declares `macos`/`windows`/`linux` is declaring a desktop app — a page running in a webview\n * should declare `web`.\n *\n * `unknown` maps to nothing, since no vendor value fits; each sender picks its own fallback.\n */\nfunction getActionSource(platform: Platform): ActionSource | undefined {\n switch (platform) {\n case 'web':\n return 'web';\n case 'ios':\n case 'android':\n case 'macos':\n case 'windows':\n case 'linux':\n return 'app';\n case 'unknown':\n return undefined;\n }\n}\n\n/** An explicit action source always wins; otherwise it is derived from the event's platform. */\nexport function resolveActionSource(\n platform: Platform,\n actionSource?: EventActionSource\n): EventActionSource | undefined {\n return actionSource ?? getActionSource(platform);\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAS,gBAAgB,UAA8C;CACrE,QAAQ,UAAR;EACE,KAAK,OACH,OAAO;EACT,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAO;EACT,KAAK,WACH;CACJ;AACF;;AAGA,SAAgB,oBACd,UACA,cAC+B;CAC/B,OAAO,gBAAgB,gBAAgB,QAAQ;AACjD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Platform } from "../track/types.cjs";
|
|
2
|
+
//#region src/server/action-source.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The coarse "where did this happen" categorization every conversions API asks for, under its
|
|
5
|
+
* own name and its own spelling: Meta `action_source`, Reddit `action_source`, OpenAI
|
|
6
|
+
* `action_source`. Each sender maps this to its vendor vocabulary.
|
|
7
|
+
*/
|
|
8
|
+
type ActionSource = 'web' | 'app';
|
|
9
|
+
/**
|
|
10
|
+
* What a caller may state explicitly. `offline` is deliberately absent from the derived set:
|
|
11
|
+
* it describes how a conversion was collected — in store, imported from a CRM, taken over the
|
|
12
|
+
* phone — not what device it came from, so no platform implies it. Such events are built by a
|
|
13
|
+
* backend rather than reported by a client SDK, which is why the sender takes it as an argument.
|
|
14
|
+
*/
|
|
15
|
+
type EventActionSource = ActionSource | 'offline';
|
|
16
|
+
/** An explicit action source always wins; otherwise it is derived from the event's platform. */
|
|
17
|
+
declare function resolveActionSource(platform: Platform, actionSource?: EventActionSource): EventActionSource | undefined;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { ActionSource, EventActionSource, resolveActionSource };
|
|
20
|
+
//# sourceMappingURL=action-source.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-source.d.cts","names":[],"sources":["../../src/server/action-source.ts"],"mappings":";;;;;;;KAOY;;;;;;;KAQA,oBAAoB;;iBAyBhB,oBACd,UAAU,UACV,eAAe,oBACd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Platform } from "../track/types.mjs";
|
|
2
|
+
//#region src/server/action-source.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The coarse "where did this happen" categorization every conversions API asks for, under its
|
|
5
|
+
* own name and its own spelling: Meta `action_source`, Reddit `action_source`, OpenAI
|
|
6
|
+
* `action_source`. Each sender maps this to its vendor vocabulary.
|
|
7
|
+
*/
|
|
8
|
+
type ActionSource = 'web' | 'app';
|
|
9
|
+
/**
|
|
10
|
+
* What a caller may state explicitly. `offline` is deliberately absent from the derived set:
|
|
11
|
+
* it describes how a conversion was collected — in store, imported from a CRM, taken over the
|
|
12
|
+
* phone — not what device it came from, so no platform implies it. Such events are built by a
|
|
13
|
+
* backend rather than reported by a client SDK, which is why the sender takes it as an argument.
|
|
14
|
+
*/
|
|
15
|
+
type EventActionSource = ActionSource | 'offline';
|
|
16
|
+
/** An explicit action source always wins; otherwise it is derived from the event's platform. */
|
|
17
|
+
declare function resolveActionSource(platform: Platform, actionSource?: EventActionSource): EventActionSource | undefined;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { ActionSource, EventActionSource, resolveActionSource };
|
|
20
|
+
//# sourceMappingURL=action-source.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-source.d.mts","names":[],"sources":["../../src/server/action-source.ts"],"mappings":";;;;;;;KAOY;;;;;;;KAQA,oBAAoB;;iBAyBhB,oBACd,UAAU,UACV,eAAe,oBACd"}
|