@aranova/tracking-react 0.22.4 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -7
- package/dist/index.mjs.map +1 -1
- package/dist/phone.js.map +1 -1
- package/dist/phone.mjs.map +1 -1
- package/dist/{sales-hH-509J5.d.mts → sales-BwWnvl8L.d.mts} +39 -2
- package/dist/{sales-hH-509J5.d.ts → sales-BwWnvl8L.d.ts} +39 -2
- package/dist/sales.d.mts +1 -1
- package/dist/sales.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1041,6 +1041,16 @@ function formatMoney(cents, currency, locale) {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
1043
|
// ../tracking-core/src/resources/tracking-config-runtime.ts
|
|
1044
|
+
var DEFAULT_CDN_BASE_URL = "https://demos.aranova.io";
|
|
1045
|
+
function trackingConfigKey(businessId, environment) {
|
|
1046
|
+
return `tracking-config/v1/${businessId}-${environment}.json`;
|
|
1047
|
+
}
|
|
1048
|
+
function resolveTrackingConfigUrl(ref) {
|
|
1049
|
+
if (ref.cdnUrl) return ref.cdnUrl;
|
|
1050
|
+
const configured = ref.cdnBaseUrl?.trim();
|
|
1051
|
+
const base = (configured || DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
|
|
1052
|
+
return `${base}/${trackingConfigKey(ref.businessId, ref.environment)}`;
|
|
1053
|
+
}
|
|
1044
1054
|
var CACHE_PREFIX2 = "_aranova_cfg_runtime_";
|
|
1045
1055
|
var AUTHORITY_TTL_MS = 6e4;
|
|
1046
1056
|
var MAX_QUEUE_LENGTH = 50;
|
|
@@ -1146,11 +1156,16 @@ var TrackingConfigRuntime = class {
|
|
|
1146
1156
|
this.pageQueue = [];
|
|
1147
1157
|
this.listeners = /* @__PURE__ */ new Set();
|
|
1148
1158
|
this.fetchImpl = fetchImpl.bind(globalThis);
|
|
1149
|
-
|
|
1159
|
+
this.url = resolveTrackingConfigUrl(ref);
|
|
1160
|
+
const cached = readCache2(this.url);
|
|
1150
1161
|
this.current = cached?.config ?? null;
|
|
1151
1162
|
this.etag = cached?.etag ?? null;
|
|
1152
1163
|
this.start();
|
|
1153
1164
|
}
|
|
1165
|
+
/** The URL this runtime actually fetches (composed or explicit). */
|
|
1166
|
+
configUrl() {
|
|
1167
|
+
return this.url;
|
|
1168
|
+
}
|
|
1154
1169
|
/**
|
|
1155
1170
|
* Explicitly start authority resolution and Google-tag bootstrap.
|
|
1156
1171
|
*
|
|
@@ -1239,7 +1254,7 @@ var TrackingConfigRuntime = class {
|
|
|
1239
1254
|
try {
|
|
1240
1255
|
const headers = {};
|
|
1241
1256
|
if (this.etag) headers["If-None-Match"] = this.etag;
|
|
1242
|
-
const response = await this.fetchImpl(this.
|
|
1257
|
+
const response = await this.fetchImpl(this.url, {
|
|
1243
1258
|
method: "GET",
|
|
1244
1259
|
headers,
|
|
1245
1260
|
cache: "no-cache"
|
|
@@ -1281,7 +1296,7 @@ var TrackingConfigRuntime = class {
|
|
|
1281
1296
|
this.authorityFailures = 0;
|
|
1282
1297
|
this.nextAuthorityAttemptAt = 0;
|
|
1283
1298
|
this.stateValue = isTombstone(config) ? "tombstone" : "active";
|
|
1284
|
-
writeCache2(this.
|
|
1299
|
+
writeCache2(this.url, { etag, config });
|
|
1285
1300
|
if (this.stateValue === "tombstone") {
|
|
1286
1301
|
if (this.retryTimer !== null) {
|
|
1287
1302
|
window.clearTimeout(this.retryTimer);
|
|
@@ -1396,7 +1411,7 @@ var TrackingConfigRuntime = class {
|
|
|
1396
1411
|
}
|
|
1397
1412
|
};
|
|
1398
1413
|
function getTrackingConfigRuntime(ref, fetchImpl) {
|
|
1399
|
-
const key = `${ref
|
|
1414
|
+
const key = `${resolveTrackingConfigUrl(ref)}|${ref.businessId}|${ref.environment}`;
|
|
1400
1415
|
const existing = runtimes.get(key);
|
|
1401
1416
|
if (existing) return existing;
|
|
1402
1417
|
const runtime = new TrackingConfigRuntime(ref, fetchImpl ?? globalThis.fetch);
|
|
@@ -3681,7 +3696,7 @@ function AdPlatformTracking({
|
|
|
3681
3696
|
metaPixelId,
|
|
3682
3697
|
metaPixelIds
|
|
3683
3698
|
}) {
|
|
3684
|
-
const
|
|
3699
|
+
const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.environment}` : "";
|
|
3685
3700
|
const gtagIdsKey = useMemo(() => gtagIds ? JSON.stringify(gtagIds) : "", [gtagIds]);
|
|
3686
3701
|
const metaPixelIdsKey = useMemo(
|
|
3687
3702
|
() => metaPixelIds ? JSON.stringify(metaPixelIds) : "",
|
|
@@ -3703,7 +3718,7 @@ function AdPlatformTracking({
|
|
|
3703
3718
|
} else if (gtagId) {
|
|
3704
3719
|
bootstrapGoogleAdsTracking(gtagId);
|
|
3705
3720
|
}
|
|
3706
|
-
}, [gtagId, gtagIdsKey,
|
|
3721
|
+
}, [gtagId, gtagIdsKey, trackingConfigKey2, standalonePageView]);
|
|
3707
3722
|
useEffect3(() => {
|
|
3708
3723
|
if (metaPixelIds && Object.keys(metaPixelIds).length > 0) {
|
|
3709
3724
|
bootstrapMultiplePixels(metaPixelIds);
|
|
@@ -3733,7 +3748,7 @@ function GoogleAdsTracking(props) {
|
|
|
3733
3748
|
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
|
|
3734
3749
|
|
|
3735
3750
|
// package.json
|
|
3736
|
-
var version = "0.
|
|
3751
|
+
var version = "0.23.1";
|
|
3737
3752
|
|
|
3738
3753
|
// ../tracking-core/src/phone-react.tsx
|
|
3739
3754
|
import {
|
|
@@ -4030,6 +4045,7 @@ export {
|
|
|
4030
4045
|
phoneField,
|
|
4031
4046
|
resetConsent,
|
|
4032
4047
|
resolveConversionConfig,
|
|
4048
|
+
resolveTrackingConfigUrl,
|
|
4033
4049
|
saleCreateSchema,
|
|
4034
4050
|
saleItemSchema,
|
|
4035
4051
|
saleServiceSchema,
|