@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/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,6 +1119,16 @@ 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;
|
|
1123
1134
|
var MAX_QUEUE_LENGTH = 50;
|
|
@@ -1223,11 +1234,16 @@ var TrackingConfigRuntime = class {
|
|
|
1223
1234
|
this.pageQueue = [];
|
|
1224
1235
|
this.listeners = /* @__PURE__ */ new Set();
|
|
1225
1236
|
this.fetchImpl = fetchImpl.bind(globalThis);
|
|
1226
|
-
|
|
1237
|
+
this.url = resolveTrackingConfigUrl(ref);
|
|
1238
|
+
const cached = readCache2(this.url);
|
|
1227
1239
|
this.current = cached?.config ?? null;
|
|
1228
1240
|
this.etag = cached?.etag ?? null;
|
|
1229
1241
|
this.start();
|
|
1230
1242
|
}
|
|
1243
|
+
/** The URL this runtime actually fetches (composed or explicit). */
|
|
1244
|
+
configUrl() {
|
|
1245
|
+
return this.url;
|
|
1246
|
+
}
|
|
1231
1247
|
/**
|
|
1232
1248
|
* Explicitly start authority resolution and Google-tag bootstrap.
|
|
1233
1249
|
*
|
|
@@ -1316,7 +1332,7 @@ var TrackingConfigRuntime = class {
|
|
|
1316
1332
|
try {
|
|
1317
1333
|
const headers = {};
|
|
1318
1334
|
if (this.etag) headers["If-None-Match"] = this.etag;
|
|
1319
|
-
const response = await this.fetchImpl(this.
|
|
1335
|
+
const response = await this.fetchImpl(this.url, {
|
|
1320
1336
|
method: "GET",
|
|
1321
1337
|
headers,
|
|
1322
1338
|
cache: "no-cache"
|
|
@@ -1358,7 +1374,7 @@ var TrackingConfigRuntime = class {
|
|
|
1358
1374
|
this.authorityFailures = 0;
|
|
1359
1375
|
this.nextAuthorityAttemptAt = 0;
|
|
1360
1376
|
this.stateValue = isTombstone(config) ? "tombstone" : "active";
|
|
1361
|
-
writeCache2(this.
|
|
1377
|
+
writeCache2(this.url, { etag, config });
|
|
1362
1378
|
if (this.stateValue === "tombstone") {
|
|
1363
1379
|
if (this.retryTimer !== null) {
|
|
1364
1380
|
window.clearTimeout(this.retryTimer);
|
|
@@ -1473,7 +1489,7 @@ var TrackingConfigRuntime = class {
|
|
|
1473
1489
|
}
|
|
1474
1490
|
};
|
|
1475
1491
|
function getTrackingConfigRuntime(ref, fetchImpl) {
|
|
1476
|
-
const key = `${ref
|
|
1492
|
+
const key = `${resolveTrackingConfigUrl(ref)}|${ref.businessId}|${ref.environment}`;
|
|
1477
1493
|
const existing = runtimes.get(key);
|
|
1478
1494
|
if (existing) return existing;
|
|
1479
1495
|
const runtime = new TrackingConfigRuntime(ref, fetchImpl ?? globalThis.fetch);
|
|
@@ -3758,7 +3774,7 @@ function AdPlatformTracking({
|
|
|
3758
3774
|
metaPixelId,
|
|
3759
3775
|
metaPixelIds
|
|
3760
3776
|
}) {
|
|
3761
|
-
const
|
|
3777
|
+
const trackingConfigKey2 = trackingConfig ? `${resolveTrackingConfigUrl(trackingConfig)}:${trackingConfig.businessId}:${trackingConfig.environment}` : "";
|
|
3762
3778
|
const gtagIdsKey = (0, import_react3.useMemo)(() => gtagIds ? JSON.stringify(gtagIds) : "", [gtagIds]);
|
|
3763
3779
|
const metaPixelIdsKey = (0, import_react3.useMemo)(
|
|
3764
3780
|
() => metaPixelIds ? JSON.stringify(metaPixelIds) : "",
|
|
@@ -3780,7 +3796,7 @@ function AdPlatformTracking({
|
|
|
3780
3796
|
} else if (gtagId) {
|
|
3781
3797
|
bootstrapGoogleAdsTracking(gtagId);
|
|
3782
3798
|
}
|
|
3783
|
-
}, [gtagId, gtagIdsKey,
|
|
3799
|
+
}, [gtagId, gtagIdsKey, trackingConfigKey2, standalonePageView]);
|
|
3784
3800
|
(0, import_react3.useEffect)(() => {
|
|
3785
3801
|
if (metaPixelIds && Object.keys(metaPixelIds).length > 0) {
|
|
3786
3802
|
bootstrapMultiplePixels(metaPixelIds);
|
|
@@ -3810,7 +3826,7 @@ function GoogleAdsTracking(props) {
|
|
|
3810
3826
|
var import_react6 = require("react");
|
|
3811
3827
|
|
|
3812
3828
|
// package.json
|
|
3813
|
-
var version = "0.
|
|
3829
|
+
var version = "0.23.1";
|
|
3814
3830
|
|
|
3815
3831
|
// ../tracking-core/src/phone-react.tsx
|
|
3816
3832
|
var import_react5 = require("react");
|
|
@@ -4101,6 +4117,7 @@ function createTracking(options) {
|
|
|
4101
4117
|
phoneField,
|
|
4102
4118
|
resetConsent,
|
|
4103
4119
|
resolveConversionConfig,
|
|
4120
|
+
resolveTrackingConfigUrl,
|
|
4104
4121
|
saleCreateSchema,
|
|
4105
4122
|
saleItemSchema,
|
|
4106
4123
|
saleServiceSchema,
|