@aranova/tracking-react 0.19.0 → 0.19.2

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.
@@ -115,26 +115,41 @@ declare class TrackingConfigRuntime {
115
115
  private etag;
116
116
  private stateValue;
117
117
  private confirmedAt;
118
+ private authorityGeneration;
118
119
  private inFlight;
120
+ private flushInFlight;
121
+ private flushRequested;
122
+ private retryTimer;
123
+ private started;
119
124
  private readonly conversionQueue;
120
125
  private readonly automaticQueue;
121
126
  private readonly pageQueue;
122
127
  private readonly listeners;
123
128
  constructor(ref: TrackingConfigReference, fetchImpl?: typeof fetch);
129
+ /**
130
+ * Explicitly start authority resolution and Google-tag bootstrap.
131
+ *
132
+ * Idempotent so framework effects can call it after hydration without
133
+ * depending on constructor timing.
134
+ */
135
+ start(): void;
124
136
  state(): RuntimeState;
125
137
  config(): ConversionConfig | null;
126
138
  __unsafeExpireAuthorityForTests(): void;
127
139
  subscribe(listener: () => void): () => void;
128
140
  ensureAuthority(): Promise<boolean>;
129
141
  revalidate(): Promise<void>;
142
+ private revalidateAuthority;
130
143
  queuePageView(snapshot?: QueuedPageView | null): void;
131
144
  fireConversion(key: string, options?: TrackingConfigConversionOptions): void;
132
- queueAutomaticEvent(eventType: string, metadata: Record<string, unknown>, transactionPath: string): void;
145
+ queueAutomaticEvent(eventType: string, metadata: Record<string, unknown>, transactionPath: string, transactionScope: string): void;
133
146
  listGoals(): ConversionGoal[];
134
147
  private revalidateNow;
135
148
  private expireAuthority;
136
149
  private confirm;
137
150
  private flush;
151
+ private scheduleRetry;
152
+ private flushNow;
138
153
  }
139
154
  declare function getTrackingConfigRuntime(ref: TrackingConfigReference, fetchImpl?: typeof fetch): TrackingConfigRuntime;
140
155
 
@@ -115,26 +115,41 @@ declare class TrackingConfigRuntime {
115
115
  private etag;
116
116
  private stateValue;
117
117
  private confirmedAt;
118
+ private authorityGeneration;
118
119
  private inFlight;
120
+ private flushInFlight;
121
+ private flushRequested;
122
+ private retryTimer;
123
+ private started;
119
124
  private readonly conversionQueue;
120
125
  private readonly automaticQueue;
121
126
  private readonly pageQueue;
122
127
  private readonly listeners;
123
128
  constructor(ref: TrackingConfigReference, fetchImpl?: typeof fetch);
129
+ /**
130
+ * Explicitly start authority resolution and Google-tag bootstrap.
131
+ *
132
+ * Idempotent so framework effects can call it after hydration without
133
+ * depending on constructor timing.
134
+ */
135
+ start(): void;
124
136
  state(): RuntimeState;
125
137
  config(): ConversionConfig | null;
126
138
  __unsafeExpireAuthorityForTests(): void;
127
139
  subscribe(listener: () => void): () => void;
128
140
  ensureAuthority(): Promise<boolean>;
129
141
  revalidate(): Promise<void>;
142
+ private revalidateAuthority;
130
143
  queuePageView(snapshot?: QueuedPageView | null): void;
131
144
  fireConversion(key: string, options?: TrackingConfigConversionOptions): void;
132
- queueAutomaticEvent(eventType: string, metadata: Record<string, unknown>, transactionPath: string): void;
145
+ queueAutomaticEvent(eventType: string, metadata: Record<string, unknown>, transactionPath: string, transactionScope: string): void;
133
146
  listGoals(): ConversionGoal[];
134
147
  private revalidateNow;
135
148
  private expireAuthority;
136
149
  private confirm;
137
150
  private flush;
151
+ private scheduleRetry;
152
+ private flushNow;
138
153
  }
139
154
  declare function getTrackingConfigRuntime(ref: TrackingConfigReference, fetchImpl?: typeof fetch): TrackingConfigRuntime;
140
155
 
package/dist/sales.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, 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, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ap as toMinor } from './sales--WzOzyiO.mjs';
1
+ export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, 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, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ap as toMinor } from './sales-DrH6dY5F.mjs';
2
2
  import 'zod';
3
3
  import 'libphonenumber-js';
package/dist/sales.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, 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, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ap as toMinor } from './sales--WzOzyiO.js';
1
+ export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, 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, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ap as toMinor } from './sales-DrH6dY5F.js';
2
2
  import 'zod';
3
3
  import 'libphonenumber-js';
package/dist/sales.js CHANGED
@@ -191,10 +191,17 @@ function markFired(input) {
191
191
  }
192
192
  }
193
193
  function fireConversionWithConsent(input, options) {
194
- if (getConsentState() === "denied") return;
195
- if (alreadyFired(input)) return;
196
- applyUserDataForConversion(options?.userData);
197
- if (fireGtagConversion(input)) markFired(input);
194
+ if (getConsentState() === "denied") return "denied";
195
+ if (alreadyFired(input)) return "duplicate";
196
+ if (!isValidSendTo(input.sendTo)) return "invalid";
197
+ try {
198
+ applyUserDataForConversion(options?.userData);
199
+ if (!fireGtagConversion(input)) return "retryable";
200
+ markFired(input);
201
+ return "fired";
202
+ } catch {
203
+ return "retryable";
204
+ }
198
205
  }
199
206
 
200
207
  // ../tracking-core/src/events/page-view.ts