@aranova/tracking-next 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 +24 -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/middleware.js +3 -0
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +3 -0
- package/dist/middleware.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-ChA6g-GJ.d.mts → sales-CmlzRq3u.d.mts} +49 -2
- package/dist/{sales-PttMfkw0.d.ts → sales-D_BTsRuM.d.ts} +49 -2
- package/dist/sales.d.mts +1 -1
- package/dist/sales.d.ts +1 -1
- package/dist/server.js +3 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +3 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -471,6 +471,30 @@ sales.trackConversion("phone_click"); // fires a manual event-goal only (no sale
|
|
|
471
471
|
APIs; do not use them for new installs. See
|
|
472
472
|
[conversion-config-schema.md](https://github.com/AranovaIO/aranova_internal/blob/master/docs/tracking-package/conversion-config-schema.md).
|
|
473
473
|
|
|
474
|
+
### Where the config is read from
|
|
475
|
+
|
|
476
|
+
`ARANOVA_TRACKING_CONFIG` carries the business identity, and the SDK composes the
|
|
477
|
+
object URL against the production CDN. Two origins are in play and they are easy to
|
|
478
|
+
conflate:
|
|
479
|
+
|
|
480
|
+
- `endpoint` — where **events** are POSTed (the Aranova API).
|
|
481
|
+
- `cdnBaseUrl` — where the **config object** is GET (object storage / CDN).
|
|
482
|
+
|
|
483
|
+
Switching `NEXT_PUBLIC_ARANOVA_TRACKING_ENDPOINT` to a local backend therefore does
|
|
484
|
+
_not_ move the config fetch. The generated module reads
|
|
485
|
+
`NEXT_PUBLIC_ARANOVA_CDN_BASE_URL` for that, falling back to production:
|
|
486
|
+
|
|
487
|
+
```
|
|
488
|
+
# .env.local — local object storage only. Leave UNSET in production.
|
|
489
|
+
NEXT_PUBLIC_ARANOVA_CDN_BASE_URL=http://localhost:9100/aranova-demos
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
No code change is needed; pass `ARANOVA_TRACKING_CONFIG` as-is. Setting this in
|
|
493
|
+
production points every visitor's browser at the wrong origin — events keep
|
|
494
|
+
flowing, so the dashboard looks healthy while on-page conversion firing never
|
|
495
|
+
engages. If you need to override it programmatically,
|
|
496
|
+
`resolveTrackingConfigUrl(ref)` returns the URL a reference resolves to.
|
|
497
|
+
|
|
474
498
|
## Consent (v2 — opt-out model)
|
|
475
499
|
|
|
476
500
|
Tracking is **on by default**: the consent-default `<Script>` injected by `GoogleAdsTracking` / `AdPlatformTracking` resolves the visitor's effective consent synchronously from `localStorage` before gtag.js loads — granted unless an explicit, unexpired decline is stored. A decline is honored for **90 days**; a grant never expires. There is no `pending` state and the package ships **no consent UI** — each site provides its own footer "cookie preferences" control and discloses tracking in its privacy policy (that notice is what makes the opt-out model defensible).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-BhWfNuPS.mjs';
|
|
2
2
|
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';
|
|
3
|
-
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-
|
|
4
|
-
export { 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, A as SaleItem, E as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SaleService, L as SaleServiceInput, M as SaleSortField, O as SaleSortOrder, Q as SaleSummary, R as SaleSummaryPrevious, U as SaleSummaryQuery, V as SaleSummaryQueryV2, W as SaleSummaryV2, X as SaleUpdateInput, Y as SalesBusinessClient, Z as SalesCategoryBreakdown, _ as SalesClient, $ as SalesClientConfig, a0 as SalesCustomersClient, a1 as SalesServiceBreakdown, a2 as SalesTransportConfig, a3 as SalesTrendPoint, a4 as SummaryCurrencyDelta, a5 as SummaryDeltas, a6 as SummaryWindow, a7 as SupportedCurrency, a8 as TRACKING_RANGES, a9 as TrackingOverviewRange, aa as clearStashedUserData, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, af as getTrackingConfigRuntime, ag as resolveConversionConfig, ah as
|
|
3
|
+
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-CmlzRq3u.mjs';
|
|
4
|
+
export { 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, A as SaleItem, E as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SaleService, L as SaleServiceInput, M as SaleSortField, O as SaleSortOrder, Q as SaleSummary, R as SaleSummaryPrevious, U as SaleSummaryQuery, V as SaleSummaryQueryV2, W as SaleSummaryV2, X as SaleUpdateInput, Y as SalesBusinessClient, Z as SalesCategoryBreakdown, _ as SalesClient, $ as SalesClientConfig, a0 as SalesCustomersClient, a1 as SalesServiceBreakdown, a2 as SalesTransportConfig, a3 as SalesTrendPoint, a4 as SummaryCurrencyDelta, a5 as SummaryDeltas, a6 as SummaryWindow, a7 as SupportedCurrency, a8 as TRACKING_RANGES, a9 as TrackingOverviewRange, aa as clearStashedUserData, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, af as getTrackingConfigRuntime, ag as resolveConversionConfig, ah as resolveTrackingConfigUrl, ai as saleCreateSchema, aj as saleItemSchema, ak as saleServiceSchema, al as saleUpdateSchema, am as salesRequest, an as stashUserData, ao as toMinor } from './sales-CmlzRq3u.mjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as src from 'src';
|
|
7
7
|
export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.mjs';
|
|
@@ -1710,6 +1710,13 @@ interface CreateTrackingOptions<TRegistry extends TriggerRegistryConfig> {
|
|
|
1710
1710
|
cdnUrl: string;
|
|
1711
1711
|
baked?: ConversionConfig | null;
|
|
1712
1712
|
};
|
|
1713
|
+
/**
|
|
1714
|
+
* R2-authoritative config reference — `ARANOVA_TRACKING_CONFIG` from
|
|
1715
|
+
* `tracking-cli gen`. Wins over `conversionConfig`. The object URL is composed
|
|
1716
|
+
* from `businessId` + `environment` against the production CDN; spread in a
|
|
1717
|
+
* `cdnBaseUrl` to read it from somewhere else, e.g.
|
|
1718
|
+
* `{ ...ARANOVA_TRACKING_CONFIG, cdnBaseUrl: process.env.NEXT_PUBLIC_ARANOVA_CDN_BASE_URL }`.
|
|
1719
|
+
*/
|
|
1713
1720
|
trackingConfig?: TrackingConfigReference;
|
|
1714
1721
|
}
|
|
1715
1722
|
interface TrackingProviderProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-BhWfNuPS.js';
|
|
2
2
|
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';
|
|
3
|
-
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-
|
|
4
|
-
export { 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, A as SaleItem, E as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SaleService, L as SaleServiceInput, M as SaleSortField, O as SaleSortOrder, Q as SaleSummary, R as SaleSummaryPrevious, U as SaleSummaryQuery, V as SaleSummaryQueryV2, W as SaleSummaryV2, X as SaleUpdateInput, Y as SalesBusinessClient, Z as SalesCategoryBreakdown, _ as SalesClient, $ as SalesClientConfig, a0 as SalesCustomersClient, a1 as SalesServiceBreakdown, a2 as SalesTransportConfig, a3 as SalesTrendPoint, a4 as SummaryCurrencyDelta, a5 as SummaryDeltas, a6 as SummaryWindow, a7 as SupportedCurrency, a8 as TRACKING_RANGES, a9 as TrackingOverviewRange, aa as clearStashedUserData, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, af as getTrackingConfigRuntime, ag as resolveConversionConfig, ah as
|
|
3
|
+
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-D_BTsRuM.js';
|
|
4
|
+
export { 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, A as SaleItem, E as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SaleService, L as SaleServiceInput, M as SaleSortField, O as SaleSortOrder, Q as SaleSummary, R as SaleSummaryPrevious, U as SaleSummaryQuery, V as SaleSummaryQueryV2, W as SaleSummaryV2, X as SaleUpdateInput, Y as SalesBusinessClient, Z as SalesCategoryBreakdown, _ as SalesClient, $ as SalesClientConfig, a0 as SalesCustomersClient, a1 as SalesServiceBreakdown, a2 as SalesTransportConfig, a3 as SalesTrendPoint, a4 as SummaryCurrencyDelta, a5 as SummaryDeltas, a6 as SummaryWindow, a7 as SupportedCurrency, a8 as TRACKING_RANGES, a9 as TrackingOverviewRange, aa as clearStashedUserData, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, af as getTrackingConfigRuntime, ag as resolveConversionConfig, ah as resolveTrackingConfigUrl, ai as saleCreateSchema, aj as saleItemSchema, ak as saleServiceSchema, al as saleUpdateSchema, am as salesRequest, an as stashUserData, ao as toMinor } from './sales-D_BTsRuM.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as src from 'src';
|
|
7
7
|
export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.js';
|
|
@@ -1710,6 +1710,13 @@ interface CreateTrackingOptions<TRegistry extends TriggerRegistryConfig> {
|
|
|
1710
1710
|
cdnUrl: string;
|
|
1711
1711
|
baked?: ConversionConfig | null;
|
|
1712
1712
|
};
|
|
1713
|
+
/**
|
|
1714
|
+
* R2-authoritative config reference — `ARANOVA_TRACKING_CONFIG` from
|
|
1715
|
+
* `tracking-cli gen`. Wins over `conversionConfig`. The object URL is composed
|
|
1716
|
+
* from `businessId` + `environment` against the production CDN; spread in a
|
|
1717
|
+
* `cdnBaseUrl` to read it from somewhere else, e.g.
|
|
1718
|
+
* `{ ...ARANOVA_TRACKING_CONFIG, cdnBaseUrl: process.env.NEXT_PUBLIC_ARANOVA_CDN_BASE_URL }`.
|
|
1719
|
+
*/
|
|
1713
1720
|
trackingConfig?: TrackingConfigReference;
|
|
1714
1721
|
}
|
|
1715
1722
|
interface TrackingProviderProps {
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,7 @@ __export(src_exports, {
|
|
|
98
98
|
resetConsent: () => resetConsent,
|
|
99
99
|
resolveBrowserTimeZone: () => resolveBrowserTimeZone,
|
|
100
100
|
resolveConversionConfig: () => resolveConversionConfig,
|
|
101
|
+
resolveTrackingConfigUrl: () => resolveTrackingConfigUrl,
|
|
101
102
|
saleCreateSchema: () => saleCreateSchema,
|
|
102
103
|
saleItemSchema: () => saleItemSchema,
|
|
103
104
|
saleServiceSchema: () => saleServiceSchema,
|
|
@@ -1144,8 +1145,21 @@ function formatMoney(cents, currency, locale) {
|
|
|
1144
1145
|
}
|
|
1145
1146
|
|
|
1146
1147
|
// ../tracking-core/src/resources/tracking-config-runtime.ts
|
|
1148
|
+
var DEFAULT_CDN_BASE_URL = "https://demos.aranova.io";
|
|
1149
|
+
function trackingConfigKey(businessId, environment) {
|
|
1150
|
+
return `tracking-config/v1/${businessId}-${environment}.json`;
|
|
1151
|
+
}
|
|
1152
|
+
function resolveTrackingConfigUrl(ref) {
|
|
1153
|
+
if (ref.cdnUrl) return ref.cdnUrl;
|
|
1154
|
+
const configured = ref.cdnBaseUrl?.trim();
|
|
1155
|
+
const base = (configured || DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
|
|
1156
|
+
return `${base}/${trackingConfigKey(ref.businessId, ref.environment)}`;
|
|
1157
|
+
}
|
|
1147
1158
|
var CACHE_PREFIX2 = "_aranova_cfg_runtime_";
|
|
1148
1159
|
var AUTHORITY_TTL_MS = 6e4;
|
|
1160
|
+
var MAX_QUEUE_LENGTH = 50;
|
|
1161
|
+
var RETRY_BASE_MS = 5e3;
|
|
1162
|
+
var RETRY_MAX_MS = 5 * 6e4;
|
|
1149
1163
|
var runtimes = /* @__PURE__ */ new Map();
|
|
1150
1164
|
var configuredIds = /* @__PURE__ */ new Set();
|
|
1151
1165
|
var scriptLoad = null;
|
|
@@ -1153,6 +1167,10 @@ var jsInitialized = false;
|
|
|
1153
1167
|
function cacheKey2(url) {
|
|
1154
1168
|
return `${CACHE_PREFIX2}${url}`;
|
|
1155
1169
|
}
|
|
1170
|
+
function pushBounded(queue, item) {
|
|
1171
|
+
queue.push(item);
|
|
1172
|
+
if (queue.length > MAX_QUEUE_LENGTH) queue.splice(0, queue.length - MAX_QUEUE_LENGTH);
|
|
1173
|
+
}
|
|
1156
1174
|
function readCache2(url) {
|
|
1157
1175
|
if (typeof window === "undefined") return null;
|
|
1158
1176
|
try {
|
|
@@ -1233,16 +1251,25 @@ var TrackingConfigRuntime = class {
|
|
|
1233
1251
|
this.flushRequested = false;
|
|
1234
1252
|
this.retryTimer = null;
|
|
1235
1253
|
this.started = false;
|
|
1254
|
+
/** Consecutive failed authority attempts — drives the revalidate backoff. */
|
|
1255
|
+
this.authorityFailures = 0;
|
|
1256
|
+
/** Epoch ms before which `ensureAuthority` must not issue another request. */
|
|
1257
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1236
1258
|
this.conversionQueue = [];
|
|
1237
1259
|
this.automaticQueue = [];
|
|
1238
1260
|
this.pageQueue = [];
|
|
1239
1261
|
this.listeners = /* @__PURE__ */ new Set();
|
|
1240
1262
|
this.fetchImpl = fetchImpl.bind(globalThis);
|
|
1241
|
-
|
|
1263
|
+
this.url = resolveTrackingConfigUrl(ref);
|
|
1264
|
+
const cached = readCache2(this.url);
|
|
1242
1265
|
this.current = cached?.config ?? null;
|
|
1243
1266
|
this.etag = cached?.etag ?? null;
|
|
1244
1267
|
this.start();
|
|
1245
1268
|
}
|
|
1269
|
+
/** The URL this runtime actually fetches (composed or explicit). */
|
|
1270
|
+
configUrl() {
|
|
1271
|
+
return this.url;
|
|
1272
|
+
}
|
|
1246
1273
|
/**
|
|
1247
1274
|
* Explicitly start authority resolution and Google-tag bootstrap.
|
|
1248
1275
|
*
|
|
@@ -1271,6 +1298,15 @@ var TrackingConfigRuntime = class {
|
|
|
1271
1298
|
}
|
|
1272
1299
|
__unsafeExpireAuthorityForTests() {
|
|
1273
1300
|
this.confirmedAt = Number.NEGATIVE_INFINITY;
|
|
1301
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1302
|
+
}
|
|
1303
|
+
/** Queue depths — asserted by tests to pin the bound. */
|
|
1304
|
+
__queueDepthsForTests() {
|
|
1305
|
+
return {
|
|
1306
|
+
conversions: this.conversionQueue.length,
|
|
1307
|
+
automatic: this.automaticQueue.length,
|
|
1308
|
+
pages: this.pageQueue.length
|
|
1309
|
+
};
|
|
1274
1310
|
}
|
|
1275
1311
|
subscribe(listener) {
|
|
1276
1312
|
this.listeners.add(listener);
|
|
@@ -1280,10 +1316,12 @@ var TrackingConfigRuntime = class {
|
|
|
1280
1316
|
if (this.stateValue !== "unconfirmed" && Date.now() - this.confirmedAt < AUTHORITY_TTL_MS) {
|
|
1281
1317
|
return true;
|
|
1282
1318
|
}
|
|
1319
|
+
if (Date.now() < this.nextAuthorityAttemptAt) return false;
|
|
1283
1320
|
await this.revalidateAuthority();
|
|
1284
1321
|
return this.stateValue !== "unconfirmed" && Date.now() - this.confirmedAt < AUTHORITY_TTL_MS;
|
|
1285
1322
|
}
|
|
1286
1323
|
async revalidate() {
|
|
1324
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1287
1325
|
await this.revalidateAuthority();
|
|
1288
1326
|
await this.flush();
|
|
1289
1327
|
}
|
|
@@ -1297,15 +1335,20 @@ var TrackingConfigRuntime = class {
|
|
|
1297
1335
|
}
|
|
1298
1336
|
queuePageView(snapshot = pageViewSnapshot()) {
|
|
1299
1337
|
if (!snapshot) return;
|
|
1300
|
-
this.pageQueue
|
|
1338
|
+
pushBounded(this.pageQueue, snapshot);
|
|
1301
1339
|
void this.flush();
|
|
1302
1340
|
}
|
|
1303
1341
|
fireConversion(key, options) {
|
|
1304
|
-
this.conversionQueue
|
|
1342
|
+
pushBounded(this.conversionQueue, { key, ...options });
|
|
1305
1343
|
void this.flush();
|
|
1306
1344
|
}
|
|
1307
1345
|
queueAutomaticEvent(eventType, metadata, transactionPath, transactionScope) {
|
|
1308
|
-
this.automaticQueue
|
|
1346
|
+
pushBounded(this.automaticQueue, {
|
|
1347
|
+
eventType,
|
|
1348
|
+
metadata,
|
|
1349
|
+
transactionPath,
|
|
1350
|
+
transactionScope
|
|
1351
|
+
});
|
|
1309
1352
|
void this.flush();
|
|
1310
1353
|
}
|
|
1311
1354
|
listGoals() {
|
|
@@ -1315,7 +1358,7 @@ var TrackingConfigRuntime = class {
|
|
|
1315
1358
|
try {
|
|
1316
1359
|
const headers = {};
|
|
1317
1360
|
if (this.etag) headers["If-None-Match"] = this.etag;
|
|
1318
|
-
const response = await this.fetchImpl(this.
|
|
1361
|
+
const response = await this.fetchImpl(this.url, {
|
|
1319
1362
|
method: "GET",
|
|
1320
1363
|
headers,
|
|
1321
1364
|
cache: "no-cache"
|
|
@@ -1345,14 +1388,19 @@ var TrackingConfigRuntime = class {
|
|
|
1345
1388
|
expireAuthority() {
|
|
1346
1389
|
this.authorityGeneration += 1;
|
|
1347
1390
|
if (this.stateValue !== "unconfirmed") this.stateValue = "unconfirmed";
|
|
1391
|
+
this.authorityFailures += 1;
|
|
1392
|
+
const delay = Math.min(RETRY_MAX_MS, RETRY_BASE_MS * 2 ** (this.authorityFailures - 1));
|
|
1393
|
+
this.nextAuthorityAttemptAt = Date.now() + delay;
|
|
1348
1394
|
}
|
|
1349
1395
|
confirm(config, etag) {
|
|
1350
1396
|
this.authorityGeneration += 1;
|
|
1351
1397
|
this.current = config;
|
|
1352
1398
|
this.etag = etag;
|
|
1353
1399
|
this.confirmedAt = Date.now();
|
|
1400
|
+
this.authorityFailures = 0;
|
|
1401
|
+
this.nextAuthorityAttemptAt = 0;
|
|
1354
1402
|
this.stateValue = isTombstone(config) ? "tombstone" : "active";
|
|
1355
|
-
writeCache2(this.
|
|
1403
|
+
writeCache2(this.url, { etag, config });
|
|
1356
1404
|
if (this.stateValue === "tombstone") {
|
|
1357
1405
|
if (this.retryTimer !== null) {
|
|
1358
1406
|
window.clearTimeout(this.retryTimer);
|
|
@@ -1431,7 +1479,7 @@ var TrackingConfigRuntime = class {
|
|
|
1431
1479
|
for (const goal of config.goals) {
|
|
1432
1480
|
if (goal.kind !== "event" || !goal.firing) continue;
|
|
1433
1481
|
if (!automaticThresholdMet(goal, event.eventType, event.metadata)) continue;
|
|
1434
|
-
this.conversionQueue
|
|
1482
|
+
pushBounded(this.conversionQueue, {
|
|
1435
1483
|
key: goal.key,
|
|
1436
1484
|
transactionId: getAutomaticTransactionId(
|
|
1437
1485
|
event.transactionScope,
|
|
@@ -1467,7 +1515,7 @@ var TrackingConfigRuntime = class {
|
|
|
1467
1515
|
}
|
|
1468
1516
|
};
|
|
1469
1517
|
function getTrackingConfigRuntime(ref, fetchImpl) {
|
|
1470
|
-
const key = `${ref
|
|
1518
|
+
const key = `${resolveTrackingConfigUrl(ref)}|${ref.businessId}|${ref.environment}`;
|
|
1471
1519
|
const existing = runtimes.get(key);
|
|
1472
1520
|
if (existing) return existing;
|
|
1473
1521
|
const runtime = new TrackingConfigRuntime(ref, fetchImpl ?? globalThis.fetch);
|
|
@@ -3585,13 +3633,13 @@ function AdPlatformTracking({
|
|
|
3585
3633
|
metaPixelId,
|
|
3586
3634
|
metaPixelIds
|
|
3587
3635
|
}) {
|
|
3588
|
-
const
|
|
3636
|
+
const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.environment}` : "";
|
|
3589
3637
|
(0, import_react3.useEffect)(() => {
|
|
3590
3638
|
if (!trackingConfig) return;
|
|
3591
3639
|
const runtime = getTrackingConfigRuntime(trackingConfig);
|
|
3592
3640
|
if (standalonePageView) runtime.queuePageView();
|
|
3593
3641
|
else runtime.start();
|
|
3594
|
-
}, [
|
|
3642
|
+
}, [trackingConfigKey2, standalonePageView]);
|
|
3595
3643
|
const gtagAll = trackingConfig ? [] : gtagIds ? Object.values(gtagIds).filter((id) => id != null) : gtagId ? [gtagId] : [];
|
|
3596
3644
|
const metaAll = metaPixelIds ? Object.values(metaPixelIds).filter((id) => id != null) : metaPixelId ? [metaPixelId] : [];
|
|
3597
3645
|
if (trackingConfig || gtagAll.length > 0) registerCapability("ad_tags_google");
|
|
@@ -3644,7 +3692,7 @@ function GoogleAdsTracking(props) {
|
|
|
3644
3692
|
var import_navigation3 = require("next/navigation");
|
|
3645
3693
|
|
|
3646
3694
|
// package.json
|
|
3647
|
-
var version = "0.
|
|
3695
|
+
var version = "0.23.0";
|
|
3648
3696
|
|
|
3649
3697
|
// src/factory.tsx
|
|
3650
3698
|
var import_react5 = require("react");
|
|
@@ -4413,6 +4461,7 @@ function useBookingForm(options = {}) {
|
|
|
4413
4461
|
resetConsent,
|
|
4414
4462
|
resolveBrowserTimeZone,
|
|
4415
4463
|
resolveConversionConfig,
|
|
4464
|
+
resolveTrackingConfigUrl,
|
|
4416
4465
|
saleCreateSchema,
|
|
4417
4466
|
saleItemSchema,
|
|
4418
4467
|
saleServiceSchema,
|