@aranova/tracking-react 0.26.0 → 0.27.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/client.mjs CHANGED
@@ -957,14 +957,15 @@ function fromMinor(cents, currency) {
957
957
 
958
958
  // ../tracking-core/src/resources/tracking-config-runtime.ts
959
959
  var DEFAULT_CDN_BASE_URL = "https://demos.aranova.io";
960
- function trackingConfigKey(businessId, environment) {
961
- return `tracking-config/v1/${businessId}-${environment}.json`;
960
+ function trackingConfigKey(ref) {
961
+ if (ref.siteId) return `tracking-config/v1/sites/${ref.siteId}-${ref.environment}.json`;
962
+ return `tracking-config/v1/${ref.businessId}-${ref.environment}.json`;
962
963
  }
963
964
  function resolveTrackingConfigUrl(ref) {
964
965
  if (ref.cdnUrl) return ref.cdnUrl;
965
966
  const configured = ref.cdnBaseUrl?.trim();
966
967
  const base = (configured || DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
967
- return `${base}/${trackingConfigKey(ref.businessId, ref.environment)}`;
968
+ return `${base}/${trackingConfigKey(ref)}`;
968
969
  }
969
970
  var CACHE_PREFIX2 = "_aranova_cfg_runtime_";
970
971
  var AUTHORITY_TTL_MS = 6e4;
@@ -1599,7 +1600,7 @@ function serializeValue(value) {
1599
1600
  }
1600
1601
  return value;
1601
1602
  }
1602
- function buildHeartbeatMetadata(surface, sdkVersion, packageName, triggers, gtagIds = null) {
1603
+ function buildHeartbeatMetadata(surface, sdkVersion, packageName, triggers, gtagIds = null, configSiteId = null) {
1603
1604
  const automaticNames = triggers ? Object.keys(triggers.automatic) : [];
1604
1605
  const manualNames = triggers?.manual ? Object.keys(triggers.manual) : [];
1605
1606
  let triggerConfig = null;
@@ -1633,7 +1634,8 @@ function buildHeartbeatMetadata(surface, sdkVersion, packageName, triggers, gtag
1633
1634
  manual: manualNames
1634
1635
  },
1635
1636
  trigger_config: triggerConfig,
1636
- configured_gtag_ids: gtagIds
1637
+ configured_gtag_ids: gtagIds,
1638
+ config_site_id: configSiteId
1637
1639
  };
1638
1640
  }
1639
1641
 
@@ -1830,7 +1832,8 @@ function createTrackingClient(config) {
1830
1832
  sdkVersion,
1831
1833
  packageName,
1832
1834
  config.triggers ?? null,
1833
- activeGtagIds
1835
+ activeGtagIds,
1836
+ config.configSiteId ?? null
1834
1837
  );
1835
1838
  queue.push({
1836
1839
  event_type: "sdk_heartbeat",
@@ -2033,7 +2036,9 @@ var sdkHeartbeatMetadataSchema = z3.object({
2033
2036
  surface: z3.enum(["next", "react", "script"]),
2034
2037
  triggers: sdkHeartbeatTriggersSchema,
2035
2038
  trigger_config: z3.record(z3.string(), z3.record(z3.string(), z3.unknown())).nullable().optional(),
2036
- configured_gtag_ids: z3.record(z3.string(), z3.string()).nullable().optional()
2039
+ configured_gtag_ids: z3.record(z3.string(), z3.string()).nullable().optional(),
2040
+ // Site whose config object the SDK resolves; null on a legacy business ref.
2041
+ config_site_id: z3.string().uuid().nullable().optional()
2037
2042
  }).strict();
2038
2043
  var sdkHeartbeatConfigSchema = z3.object({}).strict();
2039
2044
 
@@ -3351,7 +3356,7 @@ function AdPlatformTracking({
3351
3356
  metaPixelId,
3352
3357
  metaPixelIds
3353
3358
  }) {
3354
- const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.environment}` : "";
3359
+ const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.siteId ?? ""}:${trackingConfig.environment}` : "";
3355
3360
  const gtagIdsKey = useMemo(() => gtagIds ? JSON.stringify(gtagIds) : "", [gtagIds]);
3356
3361
  const metaPixelIdsKey = useMemo(
3357
3362
  () => metaPixelIds ? JSON.stringify(metaPixelIds) : "",
@@ -3403,7 +3408,7 @@ function GoogleAdsTracking(props) {
3403
3408
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
3404
3409
 
3405
3410
  // package.json
3406
- var version = "0.26.0";
3411
+ var version = "0.27.0";
3407
3412
 
3408
3413
  // ../tracking-core/src/phone-react.tsx
3409
3414
  import {
@@ -3562,6 +3567,7 @@ function createTracking(options) {
3562
3567
  triggers,
3563
3568
  environment,
3564
3569
  activeGtagIds: resolvedGtagIds,
3570
+ configSiteId: trackingConfig?.siteId ?? null,
3565
3571
  debug
3566
3572
  }),
3567
3573
  [resolvedGtagIds]