@aranova/tracking-next 0.14.0 → 0.14.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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +54 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -14
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs.map +1 -1
- package/dist/phone.js.map +1 -1
- package/dist/phone.mjs.map +1 -1
- package/dist/{sales-BsJodmh0.d.mts → sales-7w7-Ud60.d.mts} +8 -0
- package/dist/{sales-BsJodmh0.d.ts → sales-7w7-Ud60.d.ts} +8 -0
- package/dist/sales.d.mts +1 -1
- package/dist/sales.d.ts +1 -1
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs.map +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as ConsentState, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, T as TrackingParams, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, P as PhoneConfig, g as ParsedPhone, h as PhoneDisplayFormat } from './phone-utils-CcU5mwzc.mjs';
|
|
2
2
|
export { D as DEFAULT_PHONE_COUNTRY, J as JsonValue, i as TrackedField, j as TrackingInitConfig, k as formSubmitConfigSchema, l as formSubmitMetadataSchema, m as formatPhone, n as formatPhoneAsTyped, o as jsonValueSchema, p as parsePhone, q as phoneField, t as toE164 } from './phone-utils-CcU5mwzc.mjs';
|
|
3
|
-
import { C as ConversionConfig } from './sales-
|
|
4
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as CurrencyRevenue, f as CustomerCurrencyDelta, g as CustomerCurrencyTotal, h as CustomerGetOptions, i as CustomerGetResult, j as CustomerKpis, k as CustomerKpisDeltas, l as CustomerKpisPrevious, m as CustomerListPage, n as CustomerListQuery, o as CustomerProfile, p as CustomerSegment, q as CustomerSegmentCount, r as CustomerSortField, s as CustomerSummary, t as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, u as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, v as Sale, w as SaleCursorPage, x as SaleFilters, y as SaleInput, z 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, T as SaleSummaryQuery, U as SaleSummaryQueryV2, V as SaleSummaryV2, W as SaleUpdateInput, X as SalesBusinessClient, Y as SalesCategoryBreakdown, Z as SalesClient, _ as SalesClientConfig, $ as SalesCustomersClient, a0 as SalesServiceBreakdown, a1 as SalesTransportConfig, a2 as SalesTrendPoint, a3 as SummaryCurrencyDelta, a4 as SummaryDeltas, a5 as SummaryWindow, a6 as SupportedCurrency, a7 as TRACKING_RANGES, a8 as TrackingOverviewRange, a9 as createSalesClient, aa as fetchServices, ab as formatDateInTz, ac as formatMoney, ad as fromMinor, ae as resolveConversionConfig, af as saleCreateSchema, ag as saleItemSchema, ah as saleServiceSchema, ai as saleUpdateSchema, aj as salesRequest, ak as toMinor } from './sales-
|
|
3
|
+
import { C as ConversionConfig } from './sales-7w7-Ud60.mjs';
|
|
4
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as CurrencyRevenue, f as CustomerCurrencyDelta, g as CustomerCurrencyTotal, h as CustomerGetOptions, i as CustomerGetResult, j as CustomerKpis, k as CustomerKpisDeltas, l as CustomerKpisPrevious, m as CustomerListPage, n as CustomerListQuery, o as CustomerProfile, p as CustomerSegment, q as CustomerSegmentCount, r as CustomerSortField, s as CustomerSummary, t as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, u as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, v as Sale, w as SaleCursorPage, x as SaleFilters, y as SaleInput, z 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, T as SaleSummaryQuery, U as SaleSummaryQueryV2, V as SaleSummaryV2, W as SaleUpdateInput, X as SalesBusinessClient, Y as SalesCategoryBreakdown, Z as SalesClient, _ as SalesClientConfig, $ as SalesCustomersClient, a0 as SalesServiceBreakdown, a1 as SalesTransportConfig, a2 as SalesTrendPoint, a3 as SummaryCurrencyDelta, a4 as SummaryDeltas, a5 as SummaryWindow, a6 as SupportedCurrency, a7 as TRACKING_RANGES, a8 as TrackingOverviewRange, a9 as createSalesClient, aa as fetchServices, ab as formatDateInTz, ac as formatMoney, ad as fromMinor, ae as resolveConversionConfig, af as saleCreateSchema, ag as saleItemSchema, ah as saleServiceSchema, ai as saleUpdateSchema, aj as salesRequest, ak as toMinor } from './sales-7w7-Ud60.mjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as src from 'src';
|
|
7
7
|
import * as react from 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as ConsentState, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, T as TrackingParams, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, P as PhoneConfig, g as ParsedPhone, h as PhoneDisplayFormat } from './phone-utils-CcU5mwzc.js';
|
|
2
2
|
export { D as DEFAULT_PHONE_COUNTRY, J as JsonValue, i as TrackedField, j as TrackingInitConfig, k as formSubmitConfigSchema, l as formSubmitMetadataSchema, m as formatPhone, n as formatPhoneAsTyped, o as jsonValueSchema, p as parsePhone, q as phoneField, t as toE164 } from './phone-utils-CcU5mwzc.js';
|
|
3
|
-
import { C as ConversionConfig } from './sales-
|
|
4
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as CurrencyRevenue, f as CustomerCurrencyDelta, g as CustomerCurrencyTotal, h as CustomerGetOptions, i as CustomerGetResult, j as CustomerKpis, k as CustomerKpisDeltas, l as CustomerKpisPrevious, m as CustomerListPage, n as CustomerListQuery, o as CustomerProfile, p as CustomerSegment, q as CustomerSegmentCount, r as CustomerSortField, s as CustomerSummary, t as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, u as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, v as Sale, w as SaleCursorPage, x as SaleFilters, y as SaleInput, z 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, T as SaleSummaryQuery, U as SaleSummaryQueryV2, V as SaleSummaryV2, W as SaleUpdateInput, X as SalesBusinessClient, Y as SalesCategoryBreakdown, Z as SalesClient, _ as SalesClientConfig, $ as SalesCustomersClient, a0 as SalesServiceBreakdown, a1 as SalesTransportConfig, a2 as SalesTrendPoint, a3 as SummaryCurrencyDelta, a4 as SummaryDeltas, a5 as SummaryWindow, a6 as SupportedCurrency, a7 as TRACKING_RANGES, a8 as TrackingOverviewRange, a9 as createSalesClient, aa as fetchServices, ab as formatDateInTz, ac as formatMoney, ad as fromMinor, ae as resolveConversionConfig, af as saleCreateSchema, ag as saleItemSchema, ah as saleServiceSchema, ai as saleUpdateSchema, aj as salesRequest, ak as toMinor } from './sales-
|
|
3
|
+
import { C as ConversionConfig } from './sales-7w7-Ud60.js';
|
|
4
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as CurrencyRevenue, f as CustomerCurrencyDelta, g as CustomerCurrencyTotal, h as CustomerGetOptions, i as CustomerGetResult, j as CustomerKpis, k as CustomerKpisDeltas, l as CustomerKpisPrevious, m as CustomerListPage, n as CustomerListQuery, o as CustomerProfile, p as CustomerSegment, q as CustomerSegmentCount, r as CustomerSortField, s as CustomerSummary, t as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, u as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, v as Sale, w as SaleCursorPage, x as SaleFilters, y as SaleInput, z 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, T as SaleSummaryQuery, U as SaleSummaryQueryV2, V as SaleSummaryV2, W as SaleUpdateInput, X as SalesBusinessClient, Y as SalesCategoryBreakdown, Z as SalesClient, _ as SalesClientConfig, $ as SalesCustomersClient, a0 as SalesServiceBreakdown, a1 as SalesTransportConfig, a2 as SalesTrendPoint, a3 as SummaryCurrencyDelta, a4 as SummaryDeltas, a5 as SummaryWindow, a6 as SupportedCurrency, a7 as TRACKING_RANGES, a8 as TrackingOverviewRange, a9 as createSalesClient, aa as fetchServices, ab as formatDateInTz, ac as formatMoney, ad as fromMinor, ae as resolveConversionConfig, af as saleCreateSchema, ag as saleItemSchema, ah as saleServiceSchema, ai as saleUpdateSchema, aj as salesRequest, ak as toMinor } from './sales-7w7-Ud60.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as src from 'src';
|
|
7
7
|
import * as react from 'react';
|
package/dist/index.js
CHANGED
|
@@ -573,19 +573,32 @@ function resolveConversionConfig(options) {
|
|
|
573
573
|
let current = cached?.config ?? options.baked ?? null;
|
|
574
574
|
let etag = cached?.etag ?? null;
|
|
575
575
|
const goalsByKey = /* @__PURE__ */ new Map();
|
|
576
|
+
const resolveListeners = /* @__PURE__ */ new Set();
|
|
576
577
|
function rebuildIndex() {
|
|
577
578
|
goalsByKey.clear();
|
|
578
579
|
for (const goal of current?.goals ?? []) {
|
|
579
580
|
goalsByKey.set(goal.key, goal);
|
|
580
581
|
}
|
|
581
582
|
}
|
|
583
|
+
function notifyResolved() {
|
|
584
|
+
const listeners = [...resolveListeners];
|
|
585
|
+
resolveListeners.clear();
|
|
586
|
+
for (const listener of listeners) {
|
|
587
|
+
try {
|
|
588
|
+
listener();
|
|
589
|
+
} catch {
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
582
593
|
function adopt(next, nextEtag) {
|
|
583
594
|
if (!next) return;
|
|
584
595
|
if (current && next.config_version <= current.config_version) return;
|
|
596
|
+
const wasEmpty = current === null;
|
|
585
597
|
current = next;
|
|
586
598
|
etag = nextEtag;
|
|
587
599
|
rebuildIndex();
|
|
588
600
|
writeCache(options.cdnUrl, { etag, config: next });
|
|
601
|
+
if (wasEmpty) notifyResolved();
|
|
589
602
|
}
|
|
590
603
|
async function revalidate() {
|
|
591
604
|
if (typeof window === "undefined") return;
|
|
@@ -610,6 +623,16 @@ function resolveConversionConfig(options) {
|
|
|
610
623
|
getGoal: (key) => goalsByKey.get(key) ?? null,
|
|
611
624
|
listGoals: () => [...goalsByKey.values()],
|
|
612
625
|
current: () => current,
|
|
626
|
+
isReady: () => current !== null,
|
|
627
|
+
onResolve: (listener) => {
|
|
628
|
+
if (current !== null) {
|
|
629
|
+
listener();
|
|
630
|
+
return () => {
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
resolveListeners.add(listener);
|
|
634
|
+
return () => resolveListeners.delete(listener);
|
|
635
|
+
},
|
|
613
636
|
revalidate
|
|
614
637
|
};
|
|
615
638
|
}
|
|
@@ -671,22 +694,39 @@ function thresholdMet(goal, eventType, metadata) {
|
|
|
671
694
|
function currentPath() {
|
|
672
695
|
return typeof window === "undefined" ? "" : window.location.pathname;
|
|
673
696
|
}
|
|
697
|
+
var MAX_BUFFERED_EVENTS = 50;
|
|
674
698
|
function createConversionAutoFire(store) {
|
|
699
|
+
const pending = [];
|
|
700
|
+
let subscribed = false;
|
|
701
|
+
function fireMatching(eventType, metadata) {
|
|
702
|
+
for (const goal of store.listGoals()) {
|
|
703
|
+
if (goal.kind !== "event" || !goal.firing) continue;
|
|
704
|
+
if (!thresholdMet(goal, eventType, metadata)) continue;
|
|
705
|
+
const firing = goal.firing;
|
|
706
|
+
const cents = firing.value_cents ?? null;
|
|
707
|
+
const currency = firing.currency ?? null;
|
|
708
|
+
fireConversionWithConsent({
|
|
709
|
+
sendTo: firing.send_to,
|
|
710
|
+
value: cents != null && currency ? fromMinor(cents, currency) : null,
|
|
711
|
+
currency,
|
|
712
|
+
// Page-scoped txn id → fire once per (goal, path) per session; engagement conversions
|
|
713
|
+
// shouldn't re-fire as the visitor scrolls back and forth or re-enters a page.
|
|
714
|
+
transactionId: `auto:${goal.key}:${currentPath()}`
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
675
718
|
return {
|
|
676
719
|
onAutomaticEvent(eventType, metadata) {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
// Page-scoped txn id → fire once per (goal, path) per session; engagement conversions
|
|
688
|
-
// shouldn't re-fire as the visitor scrolls back and forth or re-enters a page.
|
|
689
|
-
transactionId: `auto:${goal.key}:${currentPath()}`
|
|
720
|
+
if (store.isReady()) {
|
|
721
|
+
fireMatching(eventType, metadata);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (pending.length < MAX_BUFFERED_EVENTS) pending.push({ eventType, metadata });
|
|
725
|
+
if (!subscribed) {
|
|
726
|
+
subscribed = true;
|
|
727
|
+
store.onResolve(() => {
|
|
728
|
+
const buffered = pending.splice(0);
|
|
729
|
+
for (const event of buffered) fireMatching(event.eventType, event.metadata);
|
|
690
730
|
});
|
|
691
731
|
}
|
|
692
732
|
}
|
|
@@ -2240,7 +2280,7 @@ function GoogleAdsTracking(props) {
|
|
|
2240
2280
|
var import_navigation = require("next/navigation");
|
|
2241
2281
|
|
|
2242
2282
|
// package.json
|
|
2243
|
-
var version = "0.14.
|
|
2283
|
+
var version = "0.14.1";
|
|
2244
2284
|
|
|
2245
2285
|
// src/factory.tsx
|
|
2246
2286
|
var import_react4 = require("react");
|