@aranova/tracking-react 0.22.3 → 0.23.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/README.md +6 -0
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +60 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -11
- package/dist/index.mjs.map +1 -1
- package/dist/phone.js +3 -0
- package/dist/phone.js.map +1 -1
- package/dist/phone.mjs +3 -0
- package/dist/phone.mjs.map +1 -1
- package/dist/{sales-ZTf8eSa3.d.mts → sales-BwWnvl8L.d.mts} +49 -2
- package/dist/{sales-ZTf8eSa3.d.ts → sales-BwWnvl8L.d.ts} +49 -2
- package/dist/sales.d.mts +1 -1
- package/dist/sales.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -345,6 +345,12 @@ wiring. `ARANOVA_CONFIG_URL` and `conversionConfig: { cdnUrl }` remain legacy co
|
|
|
345
345
|
APIs; do not use them for new installs. See
|
|
346
346
|
[conversion-config-schema.md](https://github.com/AranovaIO/aranova_internal/blob/master/docs/tracking-package/conversion-config-schema.md).
|
|
347
347
|
|
|
348
|
+
`ARANOVA_TRACKING_CONFIG` carries the business identity and the SDK composes the object URL
|
|
349
|
+
against the production CDN — the `endpoint` option only moves **event ingest**, not the config
|
|
350
|
+
fetch. To read the config from elsewhere (a local object store), set
|
|
351
|
+
`REACT_APP_ARANOVA_CDN_BASE_URL`; the generated module already reads it and falls back to
|
|
352
|
+
production, so no code change is needed. Leave it unset in production.
|
|
353
|
+
|
|
348
354
|
> **Before any manual goal exists,** `gen` emits an empty `ARANOVA_CONVERSIONS`, so `AranovaConversion` resolves to `never` — binding it (`createSalesClient<AranovaService, AranovaConversion>`) then makes **every** `trackConversion` call a compile error. Until you've mapped at least one manual goal and re-run `gen`, bind only the service generic (`createSalesClient<AranovaService>(…)`); the conversion key defaults back to `string`.
|
|
349
355
|
|
|
350
356
|
## Consent (v2 — opt-out model)
|
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent } from 'react';
|
|
3
3
|
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-BhWfNuPS.mjs';
|
|
4
4
|
export { k as ConsentChoice, D as DEFAULT_DECLINE_TTL_DAYS, l as DEFAULT_PHONE_COUNTRY, J as JsonValue, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-BhWfNuPS.mjs';
|
|
5
|
-
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-
|
|
6
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as
|
|
5
|
+
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-BwWnvl8L.mjs';
|
|
6
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as resolveTrackingConfigUrl, ak as saleCreateSchema, al as saleItemSchema, am as saleServiceSchema, an as saleUpdateSchema, ao as salesRequest, ap as stashUserData, aq as toMinor } from './sales-BwWnvl8L.mjs';
|
|
7
7
|
import * as src from 'src';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { CountryCode } from 'libphonenumber-js';
|
|
@@ -1709,6 +1709,13 @@ interface CreateTrackingOptions<TRegistry extends TriggerRegistryConfig> {
|
|
|
1709
1709
|
cdnUrl: string;
|
|
1710
1710
|
baked?: ConversionConfig | null;
|
|
1711
1711
|
};
|
|
1712
|
+
/**
|
|
1713
|
+
* R2-authoritative config reference — `ARANOVA_TRACKING_CONFIG` from
|
|
1714
|
+
* `tracking-cli gen`. Wins over `conversionConfig`. The object URL is composed
|
|
1715
|
+
* from `businessId` + `environment` against the production CDN; spread in a
|
|
1716
|
+
* `cdnBaseUrl` to read it from somewhere else, e.g.
|
|
1717
|
+
* `{ ...ARANOVA_TRACKING_CONFIG, cdnBaseUrl: import.meta.env.VITE_ARANOVA_CDN_BASE_URL }`.
|
|
1718
|
+
*/
|
|
1712
1719
|
trackingConfig?: TrackingConfigReference;
|
|
1713
1720
|
}
|
|
1714
1721
|
interface TrackingProviderProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent } from 'react';
|
|
3
3
|
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-BhWfNuPS.js';
|
|
4
4
|
export { k as ConsentChoice, D as DEFAULT_DECLINE_TTL_DAYS, l as DEFAULT_PHONE_COUNTRY, J as JsonValue, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-BhWfNuPS.js';
|
|
5
|
-
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-
|
|
6
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as
|
|
5
|
+
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-BwWnvl8L.js';
|
|
6
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as resolveTrackingConfigUrl, ak as saleCreateSchema, al as saleItemSchema, am as saleServiceSchema, an as saleUpdateSchema, ao as salesRequest, ap as stashUserData, aq as toMinor } from './sales-BwWnvl8L.js';
|
|
7
7
|
import * as src from 'src';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { CountryCode } from 'libphonenumber-js';
|
|
@@ -1709,6 +1709,13 @@ interface CreateTrackingOptions<TRegistry extends TriggerRegistryConfig> {
|
|
|
1709
1709
|
cdnUrl: string;
|
|
1710
1710
|
baked?: ConversionConfig | null;
|
|
1711
1711
|
};
|
|
1712
|
+
/**
|
|
1713
|
+
* R2-authoritative config reference — `ARANOVA_TRACKING_CONFIG` from
|
|
1714
|
+
* `tracking-cli gen`. Wins over `conversionConfig`. The object URL is composed
|
|
1715
|
+
* from `businessId` + `environment` against the production CDN; spread in a
|
|
1716
|
+
* `cdnBaseUrl` to read it from somewhere else, e.g.
|
|
1717
|
+
* `{ ...ARANOVA_TRACKING_CONFIG, cdnBaseUrl: import.meta.env.VITE_ARANOVA_CDN_BASE_URL }`.
|
|
1718
|
+
*/
|
|
1712
1719
|
trackingConfig?: TrackingConfigReference;
|
|
1713
1720
|
}
|
|
1714
1721
|
interface TrackingProviderProps {
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ __export(src_exports, {
|
|
|
56
56
|
phoneField: () => phoneField,
|
|
57
57
|
resetConsent: () => resetConsent,
|
|
58
58
|
resolveConversionConfig: () => resolveConversionConfig,
|
|
59
|
+
resolveTrackingConfigUrl: () => resolveTrackingConfigUrl,
|
|
59
60
|
saleCreateSchema: () => saleCreateSchema,
|
|
60
61
|
saleItemSchema: () => saleItemSchema,
|
|
61
62
|
saleServiceSchema: () => saleServiceSchema,
|
|
@@ -1118,8 +1119,21 @@ function formatMoney(cents, currency, locale) {
|
|
|
1118
1119
|
}
|
|
1119
1120
|
|
|
1120
1121
|
// ../tracking-core/src/resources/tracking-config-runtime.ts
|
|
1122
|
+
var DEFAULT_CDN_BASE_URL = "https://demos.aranova.io";
|
|
1123
|
+
function trackingConfigKey(businessId, environment) {
|
|
1124
|
+
return `tracking-config/v1/${businessId}-${environment}.json`;
|
|
1125
|
+
}
|
|
1126
|
+
function resolveTrackingConfigUrl(ref) {
|
|
1127
|
+
if (ref.cdnUrl) return ref.cdnUrl;
|
|
1128
|
+
const configured = ref.cdnBaseUrl?.trim();
|
|
1129
|
+
const base = (configured || DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
|
|
1130
|
+
return `${base}/${trackingConfigKey(ref.businessId, ref.environment)}`;
|
|
1131
|
+
}
|
|
1121
1132
|
var CACHE_PREFIX2 = "_aranova_cfg_runtime_";
|
|
1122
1133
|
var AUTHORITY_TTL_MS = 6e4;
|
|
1134
|
+
var MAX_QUEUE_LENGTH = 50;
|
|
1135
|
+
var RETRY_BASE_MS = 5e3;
|
|
1136
|
+
var RETRY_MAX_MS = 5 * 6e4;
|
|
1123
1137
|
var runtimes = /* @__PURE__ */ new Map();
|
|
1124
1138
|
var configuredIds = /* @__PURE__ */ new Set();
|
|
1125
1139
|
var scriptLoad = null;
|
|
@@ -1127,6 +1141,10 @@ var jsInitialized = false;
|
|
|
1127
1141
|
function cacheKey2(url) {
|
|
1128
1142
|
return `${CACHE_PREFIX2}${url}`;
|
|
1129
1143
|
}
|
|
1144
|
+
function pushBounded(queue, item) {
|
|
1145
|
+
queue.push(item);
|
|
1146
|
+
if (queue.length > MAX_QUEUE_LENGTH) queue.splice(0, queue.length - MAX_QUEUE_LENGTH);
|
|
1147
|
+
}
|
|
1130
1148
|
function readCache2(url) {
|
|
1131
1149
|
if (typeof window === "undefined") return null;
|
|
1132
1150
|
try {
|
|
@@ -1207,16 +1225,25 @@ var TrackingConfigRuntime = class {
|
|
|
1207
1225
|
this.flushRequested = false;
|
|
1208
1226
|
this.retryTimer = null;
|
|
1209
1227
|
this.started = false;
|
|
1228
|
+
/** Consecutive failed authority attempts — drives the revalidate backoff. */
|
|
1229
|
+
this.authorityFailures = 0;
|
|
1230
|
+
/** Epoch ms before which `ensureAuthority` must not issue another request. */
|
|
1231
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1210
1232
|
this.conversionQueue = [];
|
|
1211
1233
|
this.automaticQueue = [];
|
|
1212
1234
|
this.pageQueue = [];
|
|
1213
1235
|
this.listeners = /* @__PURE__ */ new Set();
|
|
1214
1236
|
this.fetchImpl = fetchImpl.bind(globalThis);
|
|
1215
|
-
|
|
1237
|
+
this.url = resolveTrackingConfigUrl(ref);
|
|
1238
|
+
const cached = readCache2(this.url);
|
|
1216
1239
|
this.current = cached?.config ?? null;
|
|
1217
1240
|
this.etag = cached?.etag ?? null;
|
|
1218
1241
|
this.start();
|
|
1219
1242
|
}
|
|
1243
|
+
/** The URL this runtime actually fetches (composed or explicit). */
|
|
1244
|
+
configUrl() {
|
|
1245
|
+
return this.url;
|
|
1246
|
+
}
|
|
1220
1247
|
/**
|
|
1221
1248
|
* Explicitly start authority resolution and Google-tag bootstrap.
|
|
1222
1249
|
*
|
|
@@ -1245,6 +1272,15 @@ var TrackingConfigRuntime = class {
|
|
|
1245
1272
|
}
|
|
1246
1273
|
__unsafeExpireAuthorityForTests() {
|
|
1247
1274
|
this.confirmedAt = Number.NEGATIVE_INFINITY;
|
|
1275
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1276
|
+
}
|
|
1277
|
+
/** Queue depths — asserted by tests to pin the bound. */
|
|
1278
|
+
__queueDepthsForTests() {
|
|
1279
|
+
return {
|
|
1280
|
+
conversions: this.conversionQueue.length,
|
|
1281
|
+
automatic: this.automaticQueue.length,
|
|
1282
|
+
pages: this.pageQueue.length
|
|
1283
|
+
};
|
|
1248
1284
|
}
|
|
1249
1285
|
subscribe(listener) {
|
|
1250
1286
|
this.listeners.add(listener);
|
|
@@ -1254,10 +1290,12 @@ var TrackingConfigRuntime = class {
|
|
|
1254
1290
|
if (this.stateValue !== "unconfirmed" && Date.now() - this.confirmedAt < AUTHORITY_TTL_MS) {
|
|
1255
1291
|
return true;
|
|
1256
1292
|
}
|
|
1293
|
+
if (Date.now() < this.nextAuthorityAttemptAt) return false;
|
|
1257
1294
|
await this.revalidateAuthority();
|
|
1258
1295
|
return this.stateValue !== "unconfirmed" && Date.now() - this.confirmedAt < AUTHORITY_TTL_MS;
|
|
1259
1296
|
}
|
|
1260
1297
|
async revalidate() {
|
|
1298
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1261
1299
|
await this.revalidateAuthority();
|
|
1262
1300
|
await this.flush();
|
|
1263
1301
|
}
|
|
@@ -1271,15 +1309,20 @@ var TrackingConfigRuntime = class {
|
|
|
1271
1309
|
}
|
|
1272
1310
|
queuePageView(snapshot = pageViewSnapshot()) {
|
|
1273
1311
|
if (!snapshot) return;
|
|
1274
|
-
this.pageQueue
|
|
1312
|
+
pushBounded(this.pageQueue, snapshot);
|
|
1275
1313
|
void this.flush();
|
|
1276
1314
|
}
|
|
1277
1315
|
fireConversion(key, options) {
|
|
1278
|
-
this.conversionQueue
|
|
1316
|
+
pushBounded(this.conversionQueue, { key, ...options });
|
|
1279
1317
|
void this.flush();
|
|
1280
1318
|
}
|
|
1281
1319
|
queueAutomaticEvent(eventType, metadata, transactionPath, transactionScope) {
|
|
1282
|
-
this.automaticQueue
|
|
1320
|
+
pushBounded(this.automaticQueue, {
|
|
1321
|
+
eventType,
|
|
1322
|
+
metadata,
|
|
1323
|
+
transactionPath,
|
|
1324
|
+
transactionScope
|
|
1325
|
+
});
|
|
1283
1326
|
void this.flush();
|
|
1284
1327
|
}
|
|
1285
1328
|
listGoals() {
|
|
@@ -1289,7 +1332,7 @@ var TrackingConfigRuntime = class {
|
|
|
1289
1332
|
try {
|
|
1290
1333
|
const headers = {};
|
|
1291
1334
|
if (this.etag) headers["If-None-Match"] = this.etag;
|
|
1292
|
-
const response = await this.fetchImpl(this.
|
|
1335
|
+
const response = await this.fetchImpl(this.url, {
|
|
1293
1336
|
method: "GET",
|
|
1294
1337
|
headers,
|
|
1295
1338
|
cache: "no-cache"
|
|
@@ -1319,14 +1362,19 @@ var TrackingConfigRuntime = class {
|
|
|
1319
1362
|
expireAuthority() {
|
|
1320
1363
|
this.authorityGeneration += 1;
|
|
1321
1364
|
if (this.stateValue !== "unconfirmed") this.stateValue = "unconfirmed";
|
|
1365
|
+
this.authorityFailures += 1;
|
|
1366
|
+
const delay = Math.min(RETRY_MAX_MS, RETRY_BASE_MS * 2 ** (this.authorityFailures - 1));
|
|
1367
|
+
this.nextAuthorityAttemptAt = Date.now() + delay;
|
|
1322
1368
|
}
|
|
1323
1369
|
confirm(config, etag) {
|
|
1324
1370
|
this.authorityGeneration += 1;
|
|
1325
1371
|
this.current = config;
|
|
1326
1372
|
this.etag = etag;
|
|
1327
1373
|
this.confirmedAt = Date.now();
|
|
1374
|
+
this.authorityFailures = 0;
|
|
1375
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1328
1376
|
this.stateValue = isTombstone(config) ? "tombstone" : "active";
|
|
1329
|
-
writeCache2(this.
|
|
1377
|
+
writeCache2(this.url, { etag, config });
|
|
1330
1378
|
if (this.stateValue === "tombstone") {
|
|
1331
1379
|
if (this.retryTimer !== null) {
|
|
1332
1380
|
window.clearTimeout(this.retryTimer);
|
|
@@ -1405,7 +1453,7 @@ var TrackingConfigRuntime = class {
|
|
|
1405
1453
|
for (const goal of config.goals) {
|
|
1406
1454
|
if (goal.kind !== "event" || !goal.firing) continue;
|
|
1407
1455
|
if (!automaticThresholdMet(goal, event.eventType, event.metadata)) continue;
|
|
1408
|
-
this.conversionQueue
|
|
1456
|
+
pushBounded(this.conversionQueue, {
|
|
1409
1457
|
key: goal.key,
|
|
1410
1458
|
transactionId: getAutomaticTransactionId(
|
|
1411
1459
|
event.transactionScope,
|
|
@@ -1441,7 +1489,7 @@ var TrackingConfigRuntime = class {
|
|
|
1441
1489
|
}
|
|
1442
1490
|
};
|
|
1443
1491
|
function getTrackingConfigRuntime(ref, fetchImpl) {
|
|
1444
|
-
const key = `${ref
|
|
1492
|
+
const key = `${resolveTrackingConfigUrl(ref)}|${ref.businessId}|${ref.environment}`;
|
|
1445
1493
|
const existing = runtimes.get(key);
|
|
1446
1494
|
if (existing) return existing;
|
|
1447
1495
|
const runtime = new TrackingConfigRuntime(ref, fetchImpl ?? globalThis.fetch);
|
|
@@ -3726,7 +3774,7 @@ function AdPlatformTracking({
|
|
|
3726
3774
|
metaPixelId,
|
|
3727
3775
|
metaPixelIds
|
|
3728
3776
|
}) {
|
|
3729
|
-
const
|
|
3777
|
+
const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.environment}` : "";
|
|
3730
3778
|
const gtagIdsKey = (0, import_react3.useMemo)(() => gtagIds ? JSON.stringify(gtagIds) : "", [gtagIds]);
|
|
3731
3779
|
const metaPixelIdsKey = (0, import_react3.useMemo)(
|
|
3732
3780
|
() => metaPixelIds ? JSON.stringify(metaPixelIds) : "",
|
|
@@ -3748,7 +3796,7 @@ function AdPlatformTracking({
|
|
|
3748
3796
|
} else if (gtagId) {
|
|
3749
3797
|
bootstrapGoogleAdsTracking(gtagId);
|
|
3750
3798
|
}
|
|
3751
|
-
}, [gtagId, gtagIdsKey,
|
|
3799
|
+
}, [gtagId, gtagIdsKey, trackingConfigKey2, standalonePageView]);
|
|
3752
3800
|
(0, import_react3.useEffect)(() => {
|
|
3753
3801
|
if (metaPixelIds && Object.keys(metaPixelIds).length > 0) {
|
|
3754
3802
|
bootstrapMultiplePixels(metaPixelIds);
|
|
@@ -3778,7 +3826,7 @@ function GoogleAdsTracking(props) {
|
|
|
3778
3826
|
var import_react6 = require("react");
|
|
3779
3827
|
|
|
3780
3828
|
// package.json
|
|
3781
|
-
var version = "0.
|
|
3829
|
+
var version = "0.23.0";
|
|
3782
3830
|
|
|
3783
3831
|
// ../tracking-core/src/phone-react.tsx
|
|
3784
3832
|
var import_react5 = require("react");
|
|
@@ -4069,6 +4117,7 @@ function createTracking(options) {
|
|
|
4069
4117
|
phoneField,
|
|
4070
4118
|
resetConsent,
|
|
4071
4119
|
resolveConversionConfig,
|
|
4120
|
+
resolveTrackingConfigUrl,
|
|
4072
4121
|
saleCreateSchema,
|
|
4073
4122
|
saleItemSchema,
|
|
4074
4123
|
saleServiceSchema,
|