@aranova/tracking-next 0.26.0 → 1.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.
Files changed (73) hide show
  1. package/dist/blog-server.d.mts +2 -1
  2. package/dist/blog-server.d.ts +2 -1
  3. package/dist/blog-server.js +121 -98
  4. package/dist/blog-server.js.map +1 -1
  5. package/dist/blog-server.mjs +86 -63
  6. package/dist/blog-server.mjs.map +1 -1
  7. package/dist/blog.d.mts +651 -1755
  8. package/dist/blog.d.ts +651 -1755
  9. package/dist/blog.js +121 -98
  10. package/dist/blog.js.map +1 -1
  11. package/dist/blog.mjs +86 -63
  12. package/dist/blog.mjs.map +1 -1
  13. package/dist/calendar-server.d.mts +2 -2
  14. package/dist/calendar-server.d.ts +2 -2
  15. package/dist/calendar-server.js +0 -26
  16. package/dist/calendar-server.js.map +1 -1
  17. package/dist/calendar-server.mjs +0 -26
  18. package/dist/calendar-server.mjs.map +1 -1
  19. package/dist/calendar.d.mts +3 -3
  20. package/dist/calendar.d.ts +3 -3
  21. package/dist/calendar.js +227 -126
  22. package/dist/calendar.js.map +1 -1
  23. package/dist/calendar.mjs +216 -125
  24. package/dist/calendar.mjs.map +1 -1
  25. package/dist/client.d.mts +5 -4
  26. package/dist/client.d.ts +5 -4
  27. package/dist/client.js +197 -283
  28. package/dist/client.js.map +1 -1
  29. package/dist/client.mjs +169 -255
  30. package/dist/client.mjs.map +1 -1
  31. package/dist/index.d.mts +9 -8
  32. package/dist/index.d.ts +9 -8
  33. package/dist/index.js +486 -485
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +475 -485
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/ingest-typed-BdKmlouW.d.ts +791 -0
  38. package/dist/ingest-typed-Bo7WPmpU.d.mts +791 -0
  39. package/dist/middleware.js +0 -465
  40. package/dist/middleware.js.map +1 -1
  41. package/dist/middleware.mjs +0 -465
  42. package/dist/middleware.mjs.map +1 -1
  43. package/dist/{phone-utils-BVzSNBf1.d.mts → phone-utils-CubQif9Z.d.mts} +18 -78
  44. package/dist/{phone-utils-BVzSNBf1.d.ts → phone-utils-CubQif9Z.d.ts} +18 -78
  45. package/dist/phone.d.mts +2 -2
  46. package/dist/phone.d.ts +2 -2
  47. package/dist/phone.js +0 -462
  48. package/dist/phone.js.map +1 -1
  49. package/dist/phone.mjs +0 -462
  50. package/dist/phone.mjs.map +1 -1
  51. package/dist/{sales-f1iXwlaV.d.mts → sales-D7KstKA-.d.mts} +90 -329
  52. package/dist/{sales-C3dIw4LW.d.ts → sales-DG150g3o.d.ts} +90 -329
  53. package/dist/sales.d.mts +3 -3
  54. package/dist/sales.d.ts +3 -3
  55. package/dist/sales.js +265 -127
  56. package/dist/sales.js.map +1 -1
  57. package/dist/sales.mjs +254 -127
  58. package/dist/sales.mjs.map +1 -1
  59. package/dist/server.d.mts +2 -2
  60. package/dist/server.d.ts +2 -2
  61. package/dist/server.js +0 -465
  62. package/dist/server.js.map +1 -1
  63. package/dist/server.mjs +0 -465
  64. package/dist/server.mjs.map +1 -1
  65. package/dist/{tracking-config-runtime-BnUlS_Ae.d.mts → tracking-config-runtime-D7prdTE1.d.mts} +6 -0
  66. package/dist/{tracking-config-runtime-BnUlS_Ae.d.ts → tracking-config-runtime-D7prdTE1.d.ts} +6 -0
  67. package/dist/transport-CDmGOiCq.d.ts +253 -0
  68. package/dist/transport-I_cMSFQ6.d.mts +253 -0
  69. package/package.json +2 -2
  70. package/dist/ingest-typed-BioxtBJD.d.mts +0 -1365
  71. package/dist/ingest-typed-C-SPiigr.d.ts +0 -1365
  72. package/dist/transport-C-_rFSR4.d.ts +0 -721
  73. package/dist/transport-yUF5Wize.d.mts +0 -721
package/dist/client.js CHANGED
@@ -626,10 +626,10 @@ function readStoredRecord() {
626
626
  return null;
627
627
  }
628
628
  }
629
- function writeRecord(record) {
630
- memoryRecord = record;
629
+ function writeRecord(record3) {
630
+ memoryRecord = record3;
631
631
  try {
632
- window.localStorage.setItem(LANDING_STORAGE_KEY, JSON.stringify(record));
632
+ window.localStorage.setItem(LANDING_STORAGE_KEY, JSON.stringify(record3));
633
633
  } catch {
634
634
  }
635
635
  }
@@ -651,9 +651,9 @@ function getOrCaptureLandingParams(sessionId, url) {
651
651
  if (memoryRecord && memoryRecord.session_id === sessionId) {
652
652
  return memoryRecord.params;
653
653
  }
654
- const record = { session_id: sessionId, params: captureFromUrl(url) };
655
- writeRecord(record);
656
- return record.params;
654
+ const record3 = { session_id: sessionId, params: captureFromUrl(url) };
655
+ writeRecord(record3);
656
+ return record3.params;
657
657
  }
658
658
  function buildLandingPayloadFields(sessionId, override) {
659
659
  const params = override ?? (typeof window === "undefined" ? null : getOrCaptureLandingParams(sessionId));
@@ -988,14 +988,15 @@ function fromMinor(cents, currency) {
988
988
 
989
989
  // ../tracking-core/src/resources/tracking-config-runtime.ts
990
990
  var DEFAULT_CDN_BASE_URL = "https://demos.aranova.io";
991
- function trackingConfigKey(businessId, environment) {
992
- return `tracking-config/v1/${businessId}-${environment}.json`;
991
+ function trackingConfigKey(ref) {
992
+ if (ref.siteId) return `tracking-config/v1/sites/${ref.siteId}-${ref.environment}.json`;
993
+ return `tracking-config/v1/${ref.businessId}-${ref.environment}.json`;
993
994
  }
994
995
  function resolveTrackingConfigUrl(ref) {
995
996
  if (ref.cdnUrl) return ref.cdnUrl;
996
997
  const configured = ref.cdnBaseUrl?.trim();
997
998
  const base = (configured || DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
998
- return `${base}/${trackingConfigKey(ref.businessId, ref.environment)}`;
999
+ return `${base}/${trackingConfigKey(ref)}`;
999
1000
  }
1000
1001
  var CACHE_PREFIX2 = "_aranova_cfg_runtime_";
1001
1002
  var AUTHORITY_TTL_MS = 6e4;
@@ -1484,25 +1485,32 @@ function getOrRotateSessionId(now = Date.now()) {
1484
1485
  return { id: fresh.id, isNew: true };
1485
1486
  }
1486
1487
 
1488
+ // ../tracking-core/src/page-view.ts
1489
+ var import_mini = require("zod/mini");
1490
+
1487
1491
  // ../tracking-core/src/events/page-view.ts
1488
- var import_zod = require("zod");
1489
- var pageViewMetadataSchema = import_zod.z.object({
1490
- page: import_zod.z.object({
1491
- title: import_zod.z.string().nullable(),
1492
- path: import_zod.z.string(),
1493
- search: import_zod.z.string(),
1494
- hash: import_zod.z.string()
1495
- }).strict(),
1496
- referrer: import_zod.z.string().nullable(),
1497
- // `.nullable().optional()` — absent (undefined) OR explicit null OR a
1492
+ var z = __toESM(require("zod/mini"));
1493
+ var pageViewMetadataSchema = z.strictObject({
1494
+ page: z.strictObject({
1495
+ title: z.nullable(z.string()),
1496
+ path: z.string(),
1497
+ search: z.string(),
1498
+ hash: z.string()
1499
+ }),
1500
+ referrer: z.nullable(z.string()),
1501
+ // Optional + nullable — absent (undefined) OR explicit null OR a
1498
1502
  // real viewport object. Mirrors Pydantic's `_Viewport | None = None`
1499
1503
  // on the backend side so the drift test stays clean.
1500
- viewport: import_zod.z.object({
1501
- w: import_zod.z.number(),
1502
- h: import_zod.z.number()
1503
- }).strict().nullable().optional()
1504
- }).strict();
1505
- var pageViewConfigSchema = import_zod.z.object({}).strict();
1504
+ viewport: z.optional(
1505
+ z.nullable(
1506
+ z.strictObject({
1507
+ w: z.number(),
1508
+ h: z.number()
1509
+ })
1510
+ )
1511
+ )
1512
+ });
1513
+ var pageViewConfigSchema = z.strictObject({});
1506
1514
 
1507
1515
  // ../tracking-core/src/page-view.ts
1508
1516
  var LAST_FIRED_URL_STORAGE_KEY = "aranova_tracking_last_fired_url";
@@ -1538,7 +1546,7 @@ function setLastFiredUrl(url) {
1538
1546
  }
1539
1547
  function buildPageViewMetadata(referrerOverride) {
1540
1548
  if (typeof window === "undefined" || typeof document === "undefined") return null;
1541
- return pageViewMetadataSchema.parse({
1549
+ return (0, import_mini.parse)(pageViewMetadataSchema, {
1542
1550
  page: {
1543
1551
  title: document.title || null,
1544
1552
  path: window.location.pathname,
@@ -1592,7 +1600,7 @@ function serializeValue(value) {
1592
1600
  }
1593
1601
  return value;
1594
1602
  }
1595
- function buildHeartbeatMetadata(surface, sdkVersion, packageName, triggers, gtagIds = null) {
1603
+ function buildHeartbeatMetadata(surface, sdkVersion, packageName, triggers, gtagIds = null, configSiteId = null) {
1596
1604
  const automaticNames = triggers ? Object.keys(triggers.automatic) : [];
1597
1605
  const manualNames = triggers?.manual ? Object.keys(triggers.manual) : [];
1598
1606
  let triggerConfig = null;
@@ -1626,7 +1634,8 @@ function buildHeartbeatMetadata(surface, sdkVersion, packageName, triggers, gtag
1626
1634
  manual: manualNames
1627
1635
  },
1628
1636
  trigger_config: triggerConfig,
1629
- configured_gtag_ids: gtagIds
1637
+ configured_gtag_ids: gtagIds,
1638
+ config_site_id: configSiteId
1630
1639
  };
1631
1640
  }
1632
1641
 
@@ -1823,7 +1832,8 @@ function createTrackingClient(config) {
1823
1832
  sdkVersion,
1824
1833
  packageName,
1825
1834
  config.triggers ?? null,
1826
- activeGtagIds
1835
+ activeGtagIds,
1836
+ config.configSiteId ?? null
1827
1837
  );
1828
1838
  queue.push({
1829
1839
  event_type: "sdk_heartbeat",
@@ -1994,184 +2004,198 @@ function createTrackingClient(config) {
1994
2004
  };
1995
2005
  }
1996
2006
 
2007
+ // ../tracking-core/src/ingest-typed.ts
2008
+ var import_mini2 = require("zod/mini");
2009
+
1997
2010
  // ../tracking-core/src/events/cta-click.ts
1998
- var import_zod2 = require("zod");
1999
- var ctaClickMetadataSchema = import_zod2.z.object({
2000
- cta_name: import_zod2.z.string(),
2001
- page: import_zod2.z.object({
2002
- path: import_zod2.z.string()
2003
- }).strict(),
2004
- section: import_zod2.z.string().nullable().optional(),
2005
- destination_url: import_zod2.z.string().nullable().optional(),
2011
+ var z2 = __toESM(require("zod/mini"));
2012
+ var ctaClickMetadataSchema = z2.strictObject({
2013
+ cta_name: z2.string(),
2014
+ page: z2.strictObject({
2015
+ path: z2.string()
2016
+ }),
2017
+ section: z2.optional(z2.nullable(z2.string())),
2018
+ destination_url: z2.optional(z2.nullable(z2.string())),
2006
2019
  // Set by auto-capture (and available to manual callers): the link target
2007
2020
  // and a short element descriptor (tag#id) for tying clicks to specific UI.
2008
- href: import_zod2.z.string().nullable().optional(),
2009
- element: import_zod2.z.string().nullable().optional()
2010
- }).strict();
2011
- var ctaClickConfigSchema = import_zod2.z.object({
2012
- autoCapture: import_zod2.z.object({
2013
- selector: import_zod2.z.string().optional()
2014
- }).strict().optional()
2015
- }).strict();
2021
+ href: z2.optional(z2.nullable(z2.string())),
2022
+ element: z2.optional(z2.nullable(z2.string()))
2023
+ });
2024
+ var ctaClickConfigSchema = z2.strictObject({
2025
+ autoCapture: z2.optional(
2026
+ z2.strictObject({
2027
+ selector: z2.optional(z2.string())
2028
+ })
2029
+ )
2030
+ });
2016
2031
 
2017
2032
  // ../tracking-core/src/events/sdk-heartbeat.ts
2018
- var import_zod3 = require("zod");
2019
- var sdkHeartbeatTriggersSchema = import_zod3.z.object({
2020
- automatic: import_zod3.z.array(import_zod3.z.string()),
2021
- manual: import_zod3.z.array(import_zod3.z.string())
2022
- }).strict();
2023
- var sdkHeartbeatMetadataSchema = import_zod3.z.object({
2024
- sdk_version: import_zod3.z.string(),
2025
- package_name: import_zod3.z.string().nullable(),
2026
- surface: import_zod3.z.enum(["next", "react", "script"]),
2033
+ var z3 = __toESM(require("zod/mini"));
2034
+ var sdkHeartbeatTriggersSchema = z3.strictObject({
2035
+ automatic: z3.array(z3.string()),
2036
+ manual: z3.array(z3.string())
2037
+ });
2038
+ var sdkHeartbeatMetadataSchema = z3.strictObject({
2039
+ sdk_version: z3.string(),
2040
+ package_name: z3.nullable(z3.string()),
2041
+ surface: z3.enum(["next", "react", "script"]),
2027
2042
  triggers: sdkHeartbeatTriggersSchema,
2028
- trigger_config: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown())).nullable().optional(),
2029
- configured_gtag_ids: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()).nullable().optional()
2030
- }).strict();
2031
- var sdkHeartbeatConfigSchema = import_zod3.z.object({}).strict();
2043
+ trigger_config: z3.optional(z3.nullable(z3.record(z3.string(), z3.record(z3.string(), z3.unknown())))),
2044
+ configured_gtag_ids: z3.optional(z3.nullable(z3.record(z3.string(), z3.string()))),
2045
+ // Site whose config object the SDK resolves; null on a legacy business ref.
2046
+ config_site_id: z3.optional(z3.nullable(z3.uuid()))
2047
+ });
2048
+ var sdkHeartbeatConfigSchema = z3.strictObject({});
2032
2049
 
2033
2050
  // ../tracking-core/src/events/form-start.ts
2034
- var import_zod4 = require("zod");
2035
- var formStartMetadataSchema = import_zod4.z.object({
2036
- form: import_zod4.z.object({
2037
- id: import_zod4.z.string(),
2038
- action: import_zod4.z.string().nullable()
2039
- }).strict(),
2040
- page: import_zod4.z.object({
2041
- path: import_zod4.z.string()
2042
- }).strict()
2043
- }).strict();
2044
- var formStartConfigSchema = import_zod4.z.object({
2045
- selector: import_zod4.z.string().optional()
2046
- }).strict();
2051
+ var z4 = __toESM(require("zod/mini"));
2052
+ var formStartMetadataSchema = z4.strictObject({
2053
+ form: z4.strictObject({
2054
+ id: z4.string(),
2055
+ action: z4.nullable(z4.string())
2056
+ }),
2057
+ page: z4.strictObject({
2058
+ path: z4.string()
2059
+ })
2060
+ });
2061
+ var formStartConfigSchema = z4.strictObject({
2062
+ selector: z4.optional(z4.string())
2063
+ });
2047
2064
 
2048
2065
  // ../tracking-core/src/events/form-submit.ts
2049
- var import_zod5 = require("zod");
2050
- var jsonValueSchema = import_zod5.z.lazy(
2051
- () => import_zod5.z.union([
2052
- import_zod5.z.string(),
2053
- import_zod5.z.number().finite(),
2054
- import_zod5.z.boolean(),
2055
- import_zod5.z.null(),
2056
- import_zod5.z.array(jsonValueSchema),
2057
- import_zod5.z.record(jsonValueSchema)
2066
+ var z5 = __toESM(require("zod/mini"));
2067
+ var jsonValueSchema = z5.lazy(
2068
+ () => z5.union([
2069
+ z5.string(),
2070
+ z5.number(),
2071
+ z5.boolean(),
2072
+ z5.null(),
2073
+ z5.array(jsonValueSchema),
2074
+ z5.record(z5.string(), jsonValueSchema)
2058
2075
  ])
2059
- );
2060
- var formSubmitMetadataSchema = import_zod5.z.object({
2061
- form: import_zod5.z.object({
2062
- id: import_zod5.z.string(),
2063
- action: import_zod5.z.string().nullable(),
2064
- fields: import_zod5.z.array(
2065
- import_zod5.z.object({
2066
- name: import_zod5.z.string(),
2067
- type: import_zod5.z.string(),
2068
- label: import_zod5.z.string().nullable(),
2069
- value: jsonValueSchema
2070
- }).strict()
2071
- ).optional()
2072
- }).strict(),
2073
- page: import_zod5.z.object({
2074
- path: import_zod5.z.string()
2075
- }).strict()
2076
- }).strict();
2077
- var formSubmitConfigSchema = import_zod5.z.object({}).strict();
2076
+ ).register(z5.globalRegistry, { id: "JsonSerializableValue" });
2077
+ var formSubmitMetadataSchema = z5.strictObject({
2078
+ form: z5.strictObject({
2079
+ id: z5.string(),
2080
+ action: z5.nullable(z5.string()),
2081
+ fields: z5.optional(
2082
+ z5.array(
2083
+ z5.strictObject({
2084
+ name: z5.string(),
2085
+ type: z5.string(),
2086
+ label: z5.nullable(z5.string()),
2087
+ value: jsonValueSchema
2088
+ })
2089
+ )
2090
+ )
2091
+ }),
2092
+ page: z5.strictObject({
2093
+ path: z5.string()
2094
+ })
2095
+ });
2096
+ var formSubmitConfigSchema = z5.strictObject({});
2078
2097
 
2079
2098
  // ../tracking-core/src/events/multi-page-session.ts
2080
- var import_zod6 = require("zod");
2081
- var multiPageSessionMetadataSchema = import_zod6.z.object({
2082
- page_count: import_zod6.z.number().int().min(2),
2083
- page: import_zod6.z.object({
2084
- path: import_zod6.z.string()
2085
- }).strict()
2086
- }).strict();
2087
- var multiPageSessionConfigSchema = import_zod6.z.object({
2088
- pageThreshold: import_zod6.z.number().int().min(2)
2089
- }).strict();
2099
+ var z6 = __toESM(require("zod/mini"));
2100
+ var multiPageSessionMetadataSchema = z6.strictObject({
2101
+ page_count: z6.int().check(z6.gte(2)),
2102
+ page: z6.strictObject({
2103
+ path: z6.string()
2104
+ })
2105
+ });
2106
+ var multiPageSessionConfigSchema = z6.strictObject({
2107
+ pageThreshold: z6.int().check(z6.gte(2))
2108
+ });
2090
2109
 
2091
2110
  // ../tracking-core/src/events/page-exit.ts
2092
- var import_zod7 = require("zod");
2093
- var pageExitMetadataSchema = import_zod7.z.object({
2094
- dwell_ms: import_zod7.z.number().int().min(0),
2111
+ var z7 = __toESM(require("zod/mini"));
2112
+ var pageExitMetadataSchema = z7.strictObject({
2113
+ dwell_ms: z7.int().check(z7.gte(0)),
2095
2114
  // null = left without any scroll signal; floor is 0 so a valid 0% is never
2096
2115
  // rejected (a single bad field 422s the whole keepalive beacon batch).
2097
- max_scroll_percent: import_zod7.z.number().int().min(0).max(100).nullable(),
2116
+ max_scroll_percent: z7.nullable(z7.int().check(z7.gte(0), z7.lte(100))),
2098
2117
  // The gating baseline: the fraction of the page visible at load with
2099
2118
  // zero scrolling — or, for pages that grew after the post-paint snapshot
2100
2119
  // (skeleton/streaming renders), the first-scroll position that
2101
2120
  // established it. null = page had no scrollable range, or the segment
2102
- // ended before the snapshot. `.optional()` is load-bearing: SDK builds
2121
+ // ended before the snapshot. Optionality is load-bearing: SDK builds
2103
2122
  // predating this field keep POSTing page_exit without the key —
2104
2123
  // requiring it would 422 whole keepalive beacon batches.
2105
- scroll_baseline_percent: import_zod7.z.number().int().min(0).max(100).nullable().optional(),
2106
- page: import_zod7.z.object({
2107
- path: import_zod7.z.string()
2108
- }).strict()
2109
- }).strict();
2110
- var pageExitConfigSchema = import_zod7.z.object({}).strict();
2124
+ scroll_baseline_percent: z7.optional(z7.nullable(z7.int().check(z7.gte(0), z7.lte(100)))),
2125
+ page: z7.strictObject({
2126
+ path: z7.string()
2127
+ })
2128
+ });
2129
+ var pageExitConfigSchema = z7.strictObject({});
2111
2130
 
2112
2131
  // ../tracking-core/src/events/phone-click.ts
2113
- var import_zod8 = require("zod");
2114
- var phoneClickMetadataSchema = import_zod8.z.object({
2115
- phone_number: import_zod8.z.string(),
2116
- page: import_zod8.z.object({
2117
- path: import_zod8.z.string()
2118
- }).strict(),
2119
- section: import_zod8.z.string().nullable().optional()
2120
- }).strict();
2121
- var phoneClickConfigSchema = import_zod8.z.object({
2122
- autoCapture: import_zod8.z.object({
2123
- selector: import_zod8.z.string().optional()
2124
- }).strict().optional()
2125
- }).strict();
2132
+ var z8 = __toESM(require("zod/mini"));
2133
+ var phoneClickMetadataSchema = z8.strictObject({
2134
+ phone_number: z8.string(),
2135
+ page: z8.strictObject({
2136
+ path: z8.string()
2137
+ }),
2138
+ section: z8.optional(z8.nullable(z8.string()))
2139
+ });
2140
+ var phoneClickConfigSchema = z8.strictObject({
2141
+ autoCapture: z8.optional(
2142
+ z8.strictObject({
2143
+ selector: z8.optional(z8.string())
2144
+ })
2145
+ )
2146
+ });
2126
2147
 
2127
2148
  // ../tracking-core/src/events/scroll-depth.ts
2128
- var import_zod9 = require("zod");
2129
- var scrollDepthMetadataSchema = import_zod9.z.object({
2130
- depth_percent: import_zod9.z.number().int().min(1).max(100),
2131
- page: import_zod9.z.object({
2132
- path: import_zod9.z.string()
2133
- }).strict()
2134
- }).strict();
2135
- var scrollDepthConfigSchema = import_zod9.z.object({
2136
- thresholds: import_zod9.z.array(import_zod9.z.number().int().min(1).max(100)).min(1)
2137
- }).strict();
2149
+ var z9 = __toESM(require("zod/mini"));
2150
+ var scrollDepthMetadataSchema = z9.strictObject({
2151
+ depth_percent: z9.int().check(z9.gte(1), z9.lte(100)),
2152
+ page: z9.strictObject({
2153
+ path: z9.string()
2154
+ })
2155
+ });
2156
+ var scrollDepthConfigSchema = z9.strictObject({
2157
+ thresholds: z9.array(z9.int().check(z9.gte(1), z9.lte(100))).check(z9.minLength(1))
2158
+ });
2138
2159
 
2139
2160
  // ../tracking-core/src/events/specific-page-visit.ts
2140
- var import_zod10 = require("zod");
2161
+ var z10 = __toESM(require("zod/mini"));
2141
2162
  var PAGE_IDENTITY_MAX_LENGTH = 64;
2142
2163
  var PAGE_IDENTITY_PATTERN = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/;
2143
- var pageIdentitySchema = import_zod10.z.string().max(PAGE_IDENTITY_MAX_LENGTH).regex(PAGE_IDENTITY_PATTERN, {
2144
- message: "page identity must be lowercase snake_case, start with a letter, and contain at most 64 characters"
2145
- });
2164
+ var pageIdentitySchema = z10.string().check(
2165
+ z10.maxLength(PAGE_IDENTITY_MAX_LENGTH),
2166
+ z10.regex(PAGE_IDENTITY_PATTERN, {
2167
+ message: "page identity must be lowercase snake_case, start with a letter, and contain at most 64 characters"
2168
+ })
2169
+ );
2146
2170
  var specificPageNameSchema = pageIdentitySchema;
2147
- var specificPageVisitMetadataSchema = import_zod10.z.object({
2171
+ var specificPageVisitMetadataSchema = z10.strictObject({
2148
2172
  page_name: specificPageNameSchema,
2149
- page: import_zod10.z.object({
2150
- path: import_zod10.z.string()
2151
- }).strict()
2152
- }).strict();
2153
- var specificPageVisitConfigSchema = import_zod10.z.object({
2154
- pages: import_zod10.z.array(
2155
- import_zod10.z.object({
2173
+ page: z10.strictObject({
2174
+ path: z10.string()
2175
+ })
2176
+ });
2177
+ var specificPageVisitConfigSchema = z10.strictObject({
2178
+ pages: z10.array(
2179
+ z10.strictObject({
2156
2180
  name: specificPageNameSchema,
2157
- pathPattern: import_zod10.z.custom((value) => value instanceof RegExp, {
2181
+ pathPattern: z10.custom((value) => value instanceof RegExp, {
2158
2182
  message: "pathPattern must be a RegExp"
2159
2183
  })
2160
- }).strict()
2161
- ).min(1)
2162
- }).strict();
2184
+ })
2185
+ ).check(z10.minLength(1))
2186
+ });
2163
2187
 
2164
2188
  // ../tracking-core/src/events/time-on-site.ts
2165
- var import_zod11 = require("zod");
2166
- var timeOnSiteMetadataSchema = import_zod11.z.object({
2167
- duration_ms: import_zod11.z.number().int().nonnegative(),
2168
- page: import_zod11.z.object({
2169
- path: import_zod11.z.string()
2170
- }).strict()
2171
- }).strict();
2172
- var timeOnSiteConfigSchema = import_zod11.z.object({
2173
- thresholdSeconds: import_zod11.z.number().int().positive()
2174
- }).strict();
2189
+ var z11 = __toESM(require("zod/mini"));
2190
+ var timeOnSiteMetadataSchema = z11.strictObject({
2191
+ duration_ms: z11.int().check(z11.nonnegative()),
2192
+ page: z11.strictObject({
2193
+ path: z11.string()
2194
+ })
2195
+ });
2196
+ var timeOnSiteConfigSchema = z11.strictObject({
2197
+ thresholdSeconds: z11.int().check(z11.positive())
2198
+ });
2175
2199
 
2176
2200
  // ../tracking-core/src/events/semantics.ts
2177
2201
  var EVENT_SEMANTICS = {
@@ -2330,7 +2354,7 @@ function createTypedClient(raw, registry, options = {}) {
2330
2354
  trackEvent(eventType, metadata, opts) {
2331
2355
  if (debug) {
2332
2356
  const def = getEventDefinition(eventType);
2333
- def.metadataSchema.parse(metadata);
2357
+ (0, import_mini2.parse)(def.metadataSchema, metadata);
2334
2358
  }
2335
2359
  raw.trackEvent({
2336
2360
  eventType,
@@ -2819,117 +2843,6 @@ function attachPhoneClickCapture(client, config) {
2819
2843
  };
2820
2844
  }
2821
2845
 
2822
- // ../tracking-core/src/resources/sales/schema.ts
2823
- var import_zod12 = require("zod");
2824
- var SUPPORTED_CURRENCIES = ["USD", "CAD"];
2825
- var TRACKING_ENVIRONMENTS = ["production", "development"];
2826
- var currencySchema = import_zod12.z.enum(SUPPORTED_CURRENCIES);
2827
- var centsSchema = import_zod12.z.number().int().nonnegative();
2828
- var quantitySchema = import_zod12.z.string().regex(/^\d+(\.\d{1,3})?$/);
2829
- var metadataSchema = import_zod12.z.record(import_zod12.z.unknown());
2830
- var saleItemSchema = import_zod12.z.object({
2831
- external_item_id: import_zod12.z.string().nullable().optional(),
2832
- name: import_zod12.z.string().nullable().optional(),
2833
- category: import_zod12.z.string().nullable().optional(),
2834
- quantity: quantitySchema,
2835
- unit_price_cents: centsSchema,
2836
- // Non-negativity validated on the wire — same contract as the other cents
2837
- // fields — and backstopped by the DB CHECK.
2838
- unit_cost_cents: centsSchema.nullable().optional()
2839
- }).strict();
2840
- var saleServiceSchema = import_zod12.z.object({
2841
- service: import_zod12.z.string(),
2842
- amount_cents: centsSchema
2843
- }).strict();
2844
- var customerNameSchema = import_zod12.z.string().max(200);
2845
- var customerPhoneSchema = import_zod12.z.string().max(64);
2846
- var customerEmailSchema = import_zod12.z.string().max(320).email();
2847
- function refineServiceXor(val, ctx, { requireAmount }) {
2848
- if (val.services != null) {
2849
- if (val.service != null) {
2850
- ctx.addIssue({
2851
- code: import_zod12.z.ZodIssueCode.custom,
2852
- message: "pass either `service` or `services`, not both",
2853
- path: ["services"]
2854
- });
2855
- }
2856
- if (val.services.length === 0) {
2857
- ctx.addIssue({
2858
- code: import_zod12.z.ZodIssueCode.custom,
2859
- message: "`services` must not be empty",
2860
- path: ["services"]
2861
- });
2862
- }
2863
- const keys = val.services.map((s) => s.service);
2864
- if (new Set(keys).size !== keys.length) {
2865
- ctx.addIssue({
2866
- code: import_zod12.z.ZodIssueCode.custom,
2867
- message: "`services` must not list the same service more than once",
2868
- path: ["services"]
2869
- });
2870
- }
2871
- if (val.amount_total_cents != null) {
2872
- const sum = val.services.reduce((acc, s) => acc + s.amount_cents, 0);
2873
- if (val.amount_total_cents !== sum) {
2874
- ctx.addIssue({
2875
- code: import_zod12.z.ZodIssueCode.custom,
2876
- message: "amount_total_cents must equal the sum of the services amounts (omit it to derive it automatically)",
2877
- path: ["amount_total_cents"]
2878
- });
2879
- }
2880
- }
2881
- } else if (requireAmount && val.amount_total_cents == null) {
2882
- ctx.addIssue({
2883
- code: import_zod12.z.ZodIssueCode.custom,
2884
- message: "amount_total_cents is required unless `services` is provided",
2885
- path: ["amount_total_cents"]
2886
- });
2887
- }
2888
- }
2889
- var saleCreateSchema = import_zod12.z.object({
2890
- external_id: import_zod12.z.string().nullable().optional(),
2891
- description: import_zod12.z.string().nullable().optional(),
2892
- service: import_zod12.z.string().nullable().optional(),
2893
- services: import_zod12.z.array(saleServiceSchema).nullable().optional(),
2894
- currency: currencySchema,
2895
- // Optional only because the plural `services` form derives it from the sum
2896
- // (see refineServiceXor); the singular/serviceless path still requires it.
2897
- amount_total_cents: centsSchema.nullable().optional(),
2898
- occurred_at: import_zod12.z.string().datetime(),
2899
- environment: import_zod12.z.enum(TRACKING_ENVIRONMENTS).default("production"),
2900
- items: import_zod12.z.array(saleItemSchema).default([]),
2901
- metadata: metadataSchema.nullable().optional(),
2902
- customer_name: customerNameSchema.nullable().optional(),
2903
- customer_phone: customerPhoneSchema.nullable().optional(),
2904
- customer_email: customerEmailSchema.nullable().optional(),
2905
- // CASL consent attestation: the customer agreed to receive SMS. Recorded
2906
- // with a timestamp server-side; every SMS send path gates on it.
2907
- //
2908
- // Tri-state: omit it (or send null) to let the server apply the business's
2909
- // configured default-opt-in policy, honouring a returning customer's
2910
- // remembered preference. Send an explicit boolean to assert consent state
2911
- // yourself — `false` records a deliberate opt-out.
2912
- sms_consent: import_zod12.z.boolean().nullable().optional()
2913
- }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: true }));
2914
- var saleUpdateSchema = import_zod12.z.object({
2915
- description: import_zod12.z.string().nullable().optional(),
2916
- service: import_zod12.z.string().nullable().optional(),
2917
- services: import_zod12.z.array(saleServiceSchema).nullable().optional(),
2918
- currency: currencySchema.optional(),
2919
- amount_total_cents: centsSchema.optional(),
2920
- occurred_at: import_zod12.z.string().datetime().optional(),
2921
- items: import_zod12.z.array(saleItemSchema).optional(),
2922
- metadata: metadataSchema.nullable().optional(),
2923
- customer_name: customerNameSchema.nullable().optional(),
2924
- // Re-attest when changing a filler-looking name; the server clears the
2925
- // prior attestation whenever `customer_name` changes.
2926
- customer_name_placeholder_confirmed: import_zod12.z.boolean().optional(),
2927
- customer_phone: customerPhoneSchema.nullable().optional(),
2928
- customer_email: customerEmailSchema.nullable().optional(),
2929
- // NOT NULL server-side: omit to leave unchanged (explicit null is rejected).
2930
- sms_consent: import_zod12.z.boolean().optional()
2931
- }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: false }));
2932
-
2933
2846
  // src/hooks.ts
2934
2847
  function useGclid() {
2935
2848
  const [gclid, setGclid] = (0, import_react.useState)(null);
@@ -3211,7 +3124,7 @@ function AdPlatformTracking({
3211
3124
  metaPixelId,
3212
3125
  metaPixelIds
3213
3126
  }) {
3214
- const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.environment}` : "";
3127
+ const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.siteId ?? ""}:${trackingConfig.environment}` : "";
3215
3128
  (0, import_react3.useEffect)(() => {
3216
3129
  if (!trackingConfig) return;
3217
3130
  const runtime = getTrackingConfigRuntime(trackingConfig);
@@ -3270,7 +3183,7 @@ function GoogleAdsTracking(props) {
3270
3183
  var import_navigation3 = require("next/navigation");
3271
3184
 
3272
3185
  // package.json
3273
- var version = "0.26.0";
3186
+ var version = "1.0.0";
3274
3187
 
3275
3188
  // src/factory.tsx
3276
3189
  var import_react5 = require("react");
@@ -3420,6 +3333,7 @@ function createTracking(options) {
3420
3333
  triggers,
3421
3334
  environment,
3422
3335
  activeGtagIds: gtagIds,
3336
+ configSiteId: trackingConfig?.siteId ?? null,
3423
3337
  debug
3424
3338
  }),
3425
3339
  []