@aranova/tracking-next 0.20.2 → 0.22.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.
Files changed (48) hide show
  1. package/README.md +80 -1
  2. package/dist/blog-server.js +12 -0
  3. package/dist/blog-server.js.map +1 -1
  4. package/dist/blog-server.mjs +12 -0
  5. package/dist/blog-server.mjs.map +1 -1
  6. package/dist/blog.js +7 -0
  7. package/dist/blog.js.map +1 -1
  8. package/dist/blog.mjs +7 -0
  9. package/dist/blog.mjs.map +1 -1
  10. package/dist/calendar-server.d.mts +53 -0
  11. package/dist/calendar-server.d.ts +53 -0
  12. package/dist/calendar-server.js +206 -0
  13. package/dist/calendar-server.js.map +1 -0
  14. package/dist/calendar-server.mjs +180 -0
  15. package/dist/calendar-server.mjs.map +1 -0
  16. package/dist/calendar.d.mts +112 -0
  17. package/dist/calendar.d.ts +112 -0
  18. package/dist/calendar.js +524 -0
  19. package/dist/calendar.js.map +1 -0
  20. package/dist/calendar.mjs +464 -0
  21. package/dist/calendar.mjs.map +1 -0
  22. package/dist/date-BHetnL7s.d.mts +26 -0
  23. package/dist/date-BHetnL7s.d.ts +26 -0
  24. package/dist/index.d.mts +62 -5
  25. package/dist/index.d.ts +62 -5
  26. package/dist/index.js +566 -21
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +529 -21
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/{phone-utils-B2vHJkNz.d.mts → phone-utils-BhWfNuPS.d.mts} +8 -0
  31. package/dist/{phone-utils-B2vHJkNz.d.ts → phone-utils-BhWfNuPS.d.ts} +8 -0
  32. package/dist/phone.d.mts +1 -1
  33. package/dist/phone.d.ts +1 -1
  34. package/dist/request-Doq36Rt0.d.mts +19 -0
  35. package/dist/request-Doq36Rt0.d.ts +19 -0
  36. package/dist/{sales-DrH6dY5F.d.mts → sales-C7tPnqbq.d.ts} +9 -48
  37. package/dist/{sales-DrH6dY5F.d.ts → sales-H_6bHrL-.d.mts} +9 -48
  38. package/dist/sales.d.mts +3 -1
  39. package/dist/sales.d.ts +3 -1
  40. package/dist/sales.js +29 -17
  41. package/dist/sales.js.map +1 -1
  42. package/dist/sales.mjs +29 -17
  43. package/dist/sales.mjs.map +1 -1
  44. package/dist/server.d.mts +1 -1
  45. package/dist/server.d.ts +1 -1
  46. package/dist/transport-C-_rFSR4.d.ts +721 -0
  47. package/dist/transport-yUF5Wize.d.mts +721 -0
  48. package/package.json +21 -1
@@ -287,6 +287,14 @@ interface TrackingClientContext {
287
287
  environment: TrackingEnvironment;
288
288
  /** All active gtag IDs loaded on this page, keyed by label. */
289
289
  active_gtag_ids: Record<string, string> | null;
290
+ /**
291
+ * SDK capabilities constructed in this runtime, sorted.
292
+ *
293
+ * Rebuilt per batch rather than sent once at mount, so a client constructed
294
+ * later on a deeper route (a sales client on `/checkout`, a calendar client
295
+ * on `/book`) still reports. See `capabilities.ts`.
296
+ */
297
+ capabilities: string[];
290
298
  }
291
299
  /**
292
300
  * Session payload sent to `POST /tracking/events`.
@@ -287,6 +287,14 @@ interface TrackingClientContext {
287
287
  environment: TrackingEnvironment;
288
288
  /** All active gtag IDs loaded on this page, keyed by label. */
289
289
  active_gtag_ids: Record<string, string> | null;
290
+ /**
291
+ * SDK capabilities constructed in this runtime, sorted.
292
+ *
293
+ * Rebuilt per batch rather than sent once at mount, so a client constructed
294
+ * later on a deeper route (a sales client on `/checkout`, a calendar client
295
+ * on `/book`) still reports. See `capabilities.ts`.
296
+ */
297
+ capabilities: string[];
290
298
  }
291
299
  /**
292
300
  * Session payload sent to `POST /tracking/events`.
package/dist/phone.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- export { l as DEFAULT_PHONE_COUNTRY, i as ParsedPhone, P as PhoneConfig, j as PhoneDisplayFormat, m as TrackedField, q as formatPhone, r as formatPhoneAsTyped, y as parsePhone, z as phoneField, E as toE164 } from './phone-utils-B2vHJkNz.mjs';
1
+ export { l as DEFAULT_PHONE_COUNTRY, i as ParsedPhone, P as PhoneConfig, j as PhoneDisplayFormat, m as TrackedField, q as formatPhone, r as formatPhoneAsTyped, y as parsePhone, z as phoneField, E as toE164 } from './phone-utils-BhWfNuPS.mjs';
2
2
  export { CountryCode } from 'libphonenumber-js';
3
3
  import 'zod';
package/dist/phone.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { l as DEFAULT_PHONE_COUNTRY, i as ParsedPhone, P as PhoneConfig, j as PhoneDisplayFormat, m as TrackedField, q as formatPhone, r as formatPhoneAsTyped, y as parsePhone, z as phoneField, E as toE164 } from './phone-utils-B2vHJkNz.js';
1
+ export { l as DEFAULT_PHONE_COUNTRY, i as ParsedPhone, P as PhoneConfig, j as PhoneDisplayFormat, m as TrackedField, q as formatPhone, r as formatPhoneAsTyped, y as parsePhone, z as phoneField, E as toE164 } from './phone-utils-BhWfNuPS.js';
2
2
  export { CountryCode } from 'libphonenumber-js';
3
3
  import 'zod';
@@ -0,0 +1,19 @@
1
+ /** Shared config for every awaited (non fire-and-forget) API helper. */
2
+ interface ApiTransportConfig {
3
+ /** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
4
+ apiKey: string;
5
+ /** Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`. */
6
+ endpoint: string;
7
+ /** Optional SDK identity headers (mirrors the event ingest client). */
8
+ sdkVersion?: string;
9
+ packageName?: string;
10
+ surface?: string;
11
+ environment?: string;
12
+ }
13
+ /**
14
+ * Single awaited request. Unlike the event queue, this surfaces failures: any
15
+ * non-2xx rejects with an {@link AranovaApiError}. Returns `undefined` for 204.
16
+ */
17
+ declare function apiRequest<T>(config: ApiTransportConfig, method: string, path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
18
+
19
+ export { type ApiTransportConfig as A, apiRequest as a };
@@ -0,0 +1,19 @@
1
+ /** Shared config for every awaited (non fire-and-forget) API helper. */
2
+ interface ApiTransportConfig {
3
+ /** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
4
+ apiKey: string;
5
+ /** Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`. */
6
+ endpoint: string;
7
+ /** Optional SDK identity headers (mirrors the event ingest client). */
8
+ sdkVersion?: string;
9
+ packageName?: string;
10
+ surface?: string;
11
+ environment?: string;
12
+ }
13
+ /**
14
+ * Single awaited request. Unlike the event queue, this surfaces failures: any
15
+ * non-2xx rejects with an {@link AranovaApiError}. Returns `undefined` for 204.
16
+ */
17
+ declare function apiRequest<T>(config: ApiTransportConfig, method: string, path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
18
+
19
+ export { type ApiTransportConfig as A, apiRequest as a };
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { CountryCode } from 'libphonenumber-js';
3
+ import { A as ApiTransportConfig, a as apiRequest } from './request-Doq36Rt0.js';
4
+ import './date-BHetnL7s.js';
3
5
 
4
6
  /** Raw identifiers a caller may hand us (normalized before use). */
5
7
  interface ConversionUserData {
@@ -388,8 +390,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
388
390
  customer_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
389
391
  sms_consent: z.ZodOptional<z.ZodBoolean>;
390
392
  }, "strict", z.ZodTypeAny, {
391
- currency?: "USD" | "CAD" | undefined;
392
393
  metadata?: Record<string, unknown> | null | undefined;
394
+ currency?: "USD" | "CAD" | undefined;
393
395
  services?: {
394
396
  service: string;
395
397
  amount_cents: number;
@@ -411,8 +413,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
411
413
  customer_email?: string | null | undefined;
412
414
  sms_consent?: boolean | undefined;
413
415
  }, {
414
- currency?: "USD" | "CAD" | undefined;
415
416
  metadata?: Record<string, unknown> | null | undefined;
417
+ currency?: "USD" | "CAD" | undefined;
416
418
  services?: {
417
419
  service: string;
418
420
  amount_cents: number;
@@ -434,8 +436,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
434
436
  customer_email?: string | null | undefined;
435
437
  sms_consent?: boolean | undefined;
436
438
  }>, {
437
- currency?: "USD" | "CAD" | undefined;
438
439
  metadata?: Record<string, unknown> | null | undefined;
440
+ currency?: "USD" | "CAD" | undefined;
439
441
  services?: {
440
442
  service: string;
441
443
  amount_cents: number;
@@ -457,8 +459,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
457
459
  customer_email?: string | null | undefined;
458
460
  sms_consent?: boolean | undefined;
459
461
  }, {
460
- currency?: "USD" | "CAD" | undefined;
461
462
  metadata?: Record<string, unknown> | null | undefined;
463
+ currency?: "USD" | "CAD" | undefined;
462
464
  services?: {
463
465
  service: string;
464
466
  amount_cents: number;
@@ -815,27 +817,8 @@ interface BusinessConfig {
815
817
  features: BusinessConfigFeatures;
816
818
  }
817
819
 
818
- /** Shared config for every sales HTTP helper. */
819
- interface SalesTransportConfig {
820
- /** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
821
- apiKey: string;
822
- /**
823
- * Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`.
824
- * The `/sales` path is appended by the helpers.
825
- */
826
- endpoint: string;
827
- /** Optional SDK identity headers (mirrors the event ingest client). */
828
- sdkVersion?: string;
829
- packageName?: string;
830
- surface?: string;
831
- environment?: string;
832
- }
833
- /**
834
- * Single awaited request used by every sales helper. Unlike the event queue,
835
- * this surfaces failures: any non-2xx rejects with an {@link AranovaApiError}.
836
- * Returns `undefined` for 204 No Content.
837
- */
838
- declare function salesRequest<T>(config: SalesTransportConfig, method: string, path: string, body?: unknown): Promise<T>;
820
+ type SalesTransportConfig = ApiTransportConfig;
821
+ declare const salesRequest: typeof apiRequest;
839
822
 
840
823
  /** Config for {@link createSalesClient}. */
841
824
  interface SalesClientConfig extends SalesTransportConfig {
@@ -937,22 +920,6 @@ interface SalesClient<TService extends string = string, TConversion extends stri
937
920
  }
938
921
  declare function createSalesClient<TService extends string = string, TConversion extends string = string>(config: SalesClientConfig): SalesClient<TService, TConversion>;
939
922
 
940
- /**
941
- * Error thrown by the sales client (`createSalesClient`) on a
942
- * non-2xx response. Unlike the fire-and-forget event queue (which swallows
943
- * failures), a sale is a transaction the caller must be able to react to.
944
- */
945
- declare class AranovaApiError extends Error {
946
- readonly status: number;
947
- readonly code: string | undefined;
948
- readonly requestId: string | undefined;
949
- constructor(message: string, options: {
950
- status: number;
951
- code?: string;
952
- requestId?: string;
953
- });
954
- }
955
-
956
923
  /**
957
924
  * Convert a major amount (dollars `250.5`) to integer minor units (`25050`).
958
925
  *
@@ -969,12 +936,6 @@ declare function fromMinor(cents: number, currency: SupportedCurrency): number;
969
936
  * Uses the built-in `Intl.NumberFormat` — no extra dependency.
970
937
  */
971
938
  declare function formatMoney(cents: number, currency: SupportedCurrency, locale?: string): string;
972
- /**
973
- * Format an ISO timestamp in a specific IANA time zone (e.g. `America/Toronto`),
974
- * so dashboards stop hand-rolling `Intl`. Defaults to a short date-time; pass
975
- * `opts` to override fields. The `timeZone` is always forced to the argument.
976
- */
977
- declare function formatDateInTz(iso: string, timeZone: string, opts?: Intl.DateTimeFormatOptions, locale?: string): string;
978
939
 
979
940
  /** A business's active service, as returned by `GET /tracking/services`. */
980
941
  interface PublicServiceItem {
@@ -988,4 +949,4 @@ interface PublicServiceItem {
988
949
  */
989
950
  declare function fetchServices(config: SalesTransportConfig): Promise<PublicServiceItem[]>;
990
951
 
991
- export { type SalesClient as $, AranovaApiError as A, type BusinessConfig as B, type ConversionConfig as C, type DistinctCustomersByCurrency as D, type SaleItem as E, type SaleItemInput as F, type Granularity as G, type SaleKeysetSortField as H, type SaleListPage as I, type SaleListQuery as J, type SaleListQueryV2 as K, type SaleService as L, type SaleServiceInput as M, NAMED_RANGES as N, type SaleSortField as O, type PublicServiceItem as P, type SaleSortOrder as Q, type SaleSummary as R, SUPPORTED_CURRENCIES as S, type TrackingConfigReference as T, type SaleSummaryPrevious as U, type SaleSummaryQuery as V, type SaleSummaryQueryV2 as W, type SaleSummaryV2 as X, type SaleUpdateInput as Y, type SalesBusinessClient as Z, type SalesCategoryBreakdown as _, type BusinessConfigFeatures as a, type SalesClientConfig as a0, type SalesCustomersClient as a1, type SalesServiceBreakdown as a2, type SalesTransportConfig as a3, type SalesTrendPoint as a4, type SummaryCurrencyDelta as a5, type SummaryDeltas as a6, type SummaryWindow as a7, type SupportedCurrency as a8, TRACKING_RANGES as a9, type TrackingOverviewRange as aa, clearStashedUserData as ab, createSalesClient as ac, fetchServices as ad, formatDateInTz as ae, formatMoney as af, fromMinor as ag, getTrackingConfigRuntime as ah, resolveConversionConfig as ai, saleCreateSchema as aj, saleItemSchema as ak, saleServiceSchema as al, saleUpdateSchema as am, salesRequest as an, stashUserData as ao, toMinor as ap, type BusinessConfigService as b, type CompareTo as c, type ConversionConfigStore as d, type ConversionUserData as e, type CurrencyRevenue as f, type CustomerCurrencyDelta as g, type CustomerCurrencyTotal as h, type CustomerGetOptions as i, type CustomerGetResult as j, type CustomerKpis as k, type CustomerKpisDeltas as l, type CustomerKpisPrevious as m, type CustomerListPage as n, type CustomerListQuery as o, type CustomerProfile as p, type CustomerSegment as q, type CustomerSegmentCount as r, type CustomerSortField as s, type CustomerSummary as t, type CustomerSummaryQuery as u, type NamedRange as v, type Sale as w, type SaleCursorPage as x, type SaleFilters as y, type SaleInput as z };
952
+ export { type SalesClientConfig as $, type SaleItem as A, type BusinessConfig as B, type ConversionConfig as C, type DistinctCustomersByCurrency as D, type SaleItemInput as E, type SaleKeysetSortField as F, type Granularity as G, type SaleListPage as H, type SaleListQuery as I, type SaleListQueryV2 as J, type SaleService as K, type SaleServiceInput as L, type SaleSortField as M, NAMED_RANGES as N, type SaleSortOrder as O, type PublicServiceItem as P, type SaleSummary as Q, type SaleSummaryPrevious as R, SUPPORTED_CURRENCIES as S, type TrackingConfigReference as T, type SaleSummaryQuery as U, type SaleSummaryQueryV2 as V, type SaleSummaryV2 as W, type SaleUpdateInput as X, type SalesBusinessClient as Y, type SalesCategoryBreakdown as Z, type SalesClient as _, type BusinessConfigFeatures as a, type SalesCustomersClient as a0, type SalesServiceBreakdown as a1, type SalesTransportConfig as a2, type SalesTrendPoint as a3, type SummaryCurrencyDelta as a4, type SummaryDeltas as a5, type SummaryWindow as a6, type SupportedCurrency as a7, TRACKING_RANGES as a8, type TrackingOverviewRange as a9, clearStashedUserData as aa, createSalesClient as ab, fetchServices as ac, formatMoney as ad, fromMinor as ae, getTrackingConfigRuntime as af, resolveConversionConfig as ag, saleCreateSchema as ah, saleItemSchema as ai, saleServiceSchema as aj, saleUpdateSchema as ak, salesRequest as al, stashUserData as am, toMinor as an, type BusinessConfigService as b, type CompareTo as c, type ConversionConfigStore as d, type ConversionUserData as e, type CurrencyRevenue as f, type CustomerCurrencyDelta as g, type CustomerCurrencyTotal as h, type CustomerGetOptions as i, type CustomerGetResult as j, type CustomerKpis as k, type CustomerKpisDeltas as l, type CustomerKpisPrevious as m, type CustomerListPage as n, type CustomerListQuery as o, type CustomerProfile as p, type CustomerSegment as q, type CustomerSegmentCount as r, type CustomerSortField as s, type CustomerSummary as t, type CustomerSummaryQuery as u, type NamedRange as v, type Sale as w, type SaleCursorPage as x, type SaleFilters as y, type SaleInput as z };
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { CountryCode } from 'libphonenumber-js';
3
+ import { A as ApiTransportConfig, a as apiRequest } from './request-Doq36Rt0.mjs';
4
+ import './date-BHetnL7s.mjs';
3
5
 
4
6
  /** Raw identifiers a caller may hand us (normalized before use). */
5
7
  interface ConversionUserData {
@@ -388,8 +390,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
388
390
  customer_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
389
391
  sms_consent: z.ZodOptional<z.ZodBoolean>;
390
392
  }, "strict", z.ZodTypeAny, {
391
- currency?: "USD" | "CAD" | undefined;
392
393
  metadata?: Record<string, unknown> | null | undefined;
394
+ currency?: "USD" | "CAD" | undefined;
393
395
  services?: {
394
396
  service: string;
395
397
  amount_cents: number;
@@ -411,8 +413,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
411
413
  customer_email?: string | null | undefined;
412
414
  sms_consent?: boolean | undefined;
413
415
  }, {
414
- currency?: "USD" | "CAD" | undefined;
415
416
  metadata?: Record<string, unknown> | null | undefined;
417
+ currency?: "USD" | "CAD" | undefined;
416
418
  services?: {
417
419
  service: string;
418
420
  amount_cents: number;
@@ -434,8 +436,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
434
436
  customer_email?: string | null | undefined;
435
437
  sms_consent?: boolean | undefined;
436
438
  }>, {
437
- currency?: "USD" | "CAD" | undefined;
438
439
  metadata?: Record<string, unknown> | null | undefined;
440
+ currency?: "USD" | "CAD" | undefined;
439
441
  services?: {
440
442
  service: string;
441
443
  amount_cents: number;
@@ -457,8 +459,8 @@ declare const saleUpdateSchema: z.ZodEffects<z.ZodObject<{
457
459
  customer_email?: string | null | undefined;
458
460
  sms_consent?: boolean | undefined;
459
461
  }, {
460
- currency?: "USD" | "CAD" | undefined;
461
462
  metadata?: Record<string, unknown> | null | undefined;
463
+ currency?: "USD" | "CAD" | undefined;
462
464
  services?: {
463
465
  service: string;
464
466
  amount_cents: number;
@@ -815,27 +817,8 @@ interface BusinessConfig {
815
817
  features: BusinessConfigFeatures;
816
818
  }
817
819
 
818
- /** Shared config for every sales HTTP helper. */
819
- interface SalesTransportConfig {
820
- /** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
821
- apiKey: string;
822
- /**
823
- * Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`.
824
- * The `/sales` path is appended by the helpers.
825
- */
826
- endpoint: string;
827
- /** Optional SDK identity headers (mirrors the event ingest client). */
828
- sdkVersion?: string;
829
- packageName?: string;
830
- surface?: string;
831
- environment?: string;
832
- }
833
- /**
834
- * Single awaited request used by every sales helper. Unlike the event queue,
835
- * this surfaces failures: any non-2xx rejects with an {@link AranovaApiError}.
836
- * Returns `undefined` for 204 No Content.
837
- */
838
- declare function salesRequest<T>(config: SalesTransportConfig, method: string, path: string, body?: unknown): Promise<T>;
820
+ type SalesTransportConfig = ApiTransportConfig;
821
+ declare const salesRequest: typeof apiRequest;
839
822
 
840
823
  /** Config for {@link createSalesClient}. */
841
824
  interface SalesClientConfig extends SalesTransportConfig {
@@ -937,22 +920,6 @@ interface SalesClient<TService extends string = string, TConversion extends stri
937
920
  }
938
921
  declare function createSalesClient<TService extends string = string, TConversion extends string = string>(config: SalesClientConfig): SalesClient<TService, TConversion>;
939
922
 
940
- /**
941
- * Error thrown by the sales client (`createSalesClient`) on a
942
- * non-2xx response. Unlike the fire-and-forget event queue (which swallows
943
- * failures), a sale is a transaction the caller must be able to react to.
944
- */
945
- declare class AranovaApiError extends Error {
946
- readonly status: number;
947
- readonly code: string | undefined;
948
- readonly requestId: string | undefined;
949
- constructor(message: string, options: {
950
- status: number;
951
- code?: string;
952
- requestId?: string;
953
- });
954
- }
955
-
956
923
  /**
957
924
  * Convert a major amount (dollars `250.5`) to integer minor units (`25050`).
958
925
  *
@@ -969,12 +936,6 @@ declare function fromMinor(cents: number, currency: SupportedCurrency): number;
969
936
  * Uses the built-in `Intl.NumberFormat` — no extra dependency.
970
937
  */
971
938
  declare function formatMoney(cents: number, currency: SupportedCurrency, locale?: string): string;
972
- /**
973
- * Format an ISO timestamp in a specific IANA time zone (e.g. `America/Toronto`),
974
- * so dashboards stop hand-rolling `Intl`. Defaults to a short date-time; pass
975
- * `opts` to override fields. The `timeZone` is always forced to the argument.
976
- */
977
- declare function formatDateInTz(iso: string, timeZone: string, opts?: Intl.DateTimeFormatOptions, locale?: string): string;
978
939
 
979
940
  /** A business's active service, as returned by `GET /tracking/services`. */
980
941
  interface PublicServiceItem {
@@ -988,4 +949,4 @@ interface PublicServiceItem {
988
949
  */
989
950
  declare function fetchServices(config: SalesTransportConfig): Promise<PublicServiceItem[]>;
990
951
 
991
- export { type SalesClient as $, AranovaApiError as A, type BusinessConfig as B, type ConversionConfig as C, type DistinctCustomersByCurrency as D, type SaleItem as E, type SaleItemInput as F, type Granularity as G, type SaleKeysetSortField as H, type SaleListPage as I, type SaleListQuery as J, type SaleListQueryV2 as K, type SaleService as L, type SaleServiceInput as M, NAMED_RANGES as N, type SaleSortField as O, type PublicServiceItem as P, type SaleSortOrder as Q, type SaleSummary as R, SUPPORTED_CURRENCIES as S, type TrackingConfigReference as T, type SaleSummaryPrevious as U, type SaleSummaryQuery as V, type SaleSummaryQueryV2 as W, type SaleSummaryV2 as X, type SaleUpdateInput as Y, type SalesBusinessClient as Z, type SalesCategoryBreakdown as _, type BusinessConfigFeatures as a, type SalesClientConfig as a0, type SalesCustomersClient as a1, type SalesServiceBreakdown as a2, type SalesTransportConfig as a3, type SalesTrendPoint as a4, type SummaryCurrencyDelta as a5, type SummaryDeltas as a6, type SummaryWindow as a7, type SupportedCurrency as a8, TRACKING_RANGES as a9, type TrackingOverviewRange as aa, clearStashedUserData as ab, createSalesClient as ac, fetchServices as ad, formatDateInTz as ae, formatMoney as af, fromMinor as ag, getTrackingConfigRuntime as ah, resolveConversionConfig as ai, saleCreateSchema as aj, saleItemSchema as ak, saleServiceSchema as al, saleUpdateSchema as am, salesRequest as an, stashUserData as ao, toMinor as ap, type BusinessConfigService as b, type CompareTo as c, type ConversionConfigStore as d, type ConversionUserData as e, type CurrencyRevenue as f, type CustomerCurrencyDelta as g, type CustomerCurrencyTotal as h, type CustomerGetOptions as i, type CustomerGetResult as j, type CustomerKpis as k, type CustomerKpisDeltas as l, type CustomerKpisPrevious as m, type CustomerListPage as n, type CustomerListQuery as o, type CustomerProfile as p, type CustomerSegment as q, type CustomerSegmentCount as r, type CustomerSortField as s, type CustomerSummary as t, type CustomerSummaryQuery as u, type NamedRange as v, type Sale as w, type SaleCursorPage as x, type SaleFilters as y, type SaleInput as z };
952
+ export { type SalesClientConfig as $, type SaleItem as A, type BusinessConfig as B, type ConversionConfig as C, type DistinctCustomersByCurrency as D, type SaleItemInput as E, type SaleKeysetSortField as F, type Granularity as G, type SaleListPage as H, type SaleListQuery as I, type SaleListQueryV2 as J, type SaleService as K, type SaleServiceInput as L, type SaleSortField as M, NAMED_RANGES as N, type SaleSortOrder as O, type PublicServiceItem as P, type SaleSummary as Q, type SaleSummaryPrevious as R, SUPPORTED_CURRENCIES as S, type TrackingConfigReference as T, type SaleSummaryQuery as U, type SaleSummaryQueryV2 as V, type SaleSummaryV2 as W, type SaleUpdateInput as X, type SalesBusinessClient as Y, type SalesCategoryBreakdown as Z, type SalesClient as _, type BusinessConfigFeatures as a, type SalesCustomersClient as a0, type SalesServiceBreakdown as a1, type SalesTransportConfig as a2, type SalesTrendPoint as a3, type SummaryCurrencyDelta as a4, type SummaryDeltas as a5, type SummaryWindow as a6, type SupportedCurrency as a7, TRACKING_RANGES as a8, type TrackingOverviewRange as a9, clearStashedUserData as aa, createSalesClient as ab, fetchServices as ac, formatMoney as ad, fromMinor as ae, getTrackingConfigRuntime as af, resolveConversionConfig as ag, saleCreateSchema as ah, saleItemSchema as ai, saleServiceSchema as aj, saleUpdateSchema as ak, salesRequest as al, stashUserData as am, toMinor as an, type BusinessConfigService as b, type CompareTo as c, type ConversionConfigStore as d, type ConversionUserData as e, type CurrencyRevenue as f, type CustomerCurrencyDelta as g, type CustomerCurrencyTotal as h, type CustomerGetOptions as i, type CustomerGetResult as j, type CustomerKpis as k, type CustomerKpisDeltas as l, type CustomerKpisPrevious as m, type CustomerListPage as n, type CustomerListQuery as o, type CustomerProfile as p, type CustomerSegment as q, type CustomerSegmentCount as r, type CustomerSortField as s, type CustomerSummary as t, type CustomerSummaryQuery as u, type NamedRange as v, type Sale as w, type SaleCursorPage as x, type SaleFilters as y, type SaleInput as z };
package/dist/sales.d.mts CHANGED
@@ -1,3 +1,5 @@
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';
1
+ export { 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, 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, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, ah as saleCreateSchema, ai as saleItemSchema, aj as saleServiceSchema, ak as saleUpdateSchema, al as salesRequest, an as toMinor } from './sales-H_6bHrL-.mjs';
2
+ export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.mjs';
2
3
  import 'zod';
3
4
  import 'libphonenumber-js';
5
+ import './request-Doq36Rt0.mjs';
package/dist/sales.d.ts CHANGED
@@ -1,3 +1,5 @@
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';
1
+ export { 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, 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, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, ah as saleCreateSchema, ai as saleItemSchema, aj as saleServiceSchema, ak as saleUpdateSchema, al as salesRequest, an as toMinor } from './sales-C7tPnqbq.js';
2
+ export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.js';
2
3
  import 'zod';
3
4
  import 'libphonenumber-js';
5
+ import './request-Doq36Rt0.js';
package/dist/sales.js CHANGED
@@ -38,6 +38,12 @@ __export(sales_exports, {
38
38
  });
39
39
  module.exports = __toCommonJS(sales_exports);
40
40
 
41
+ // ../tracking-core/src/capabilities.ts
42
+ var registered = /* @__PURE__ */ new Set();
43
+ function registerCapability(capability) {
44
+ registered.add(capability);
45
+ }
46
+
41
47
  // ../tracking-core/src/phone.ts
42
48
  var import_libphonenumber_js = require("libphonenumber-js");
43
49
  var DEFAULT_PHONE_COUNTRY = "CA";
@@ -234,7 +240,7 @@ var SDK_PACKAGE_HEADER = "X-Aranova-Sdk-Package";
234
240
  var SDK_SURFACE_HEADER = "X-Aranova-Sdk-Surface";
235
241
  var SDK_ENVIRONMENT_HEADER = "X-Aranova-Sdk-Environment";
236
242
 
237
- // ../tracking-core/src/resources/sales/errors.ts
243
+ // ../tracking-core/src/resources/http/errors.ts
238
244
  var AranovaApiError = class extends Error {
239
245
  constructor(message, options) {
240
246
  super(message);
@@ -245,7 +251,7 @@ var AranovaApiError = class extends Error {
245
251
  }
246
252
  };
247
253
 
248
- // ../tracking-core/src/resources/sales/transport.ts
254
+ // ../tracking-core/src/resources/http/request.ts
249
255
  function identityHeaders(config) {
250
256
  const headers = { [API_KEY_HEADER]: config.apiKey };
251
257
  if (config.sdkVersion) headers[SDK_VERSION_HEADER] = config.sdkVersion;
@@ -257,8 +263,8 @@ function identityHeaders(config) {
257
263
  function joinUrl(endpoint, path) {
258
264
  return `${endpoint.replace(/\/$/, "")}${path}`;
259
265
  }
260
- async function salesRequest(config, method, path, body) {
261
- const headers = identityHeaders(config);
266
+ async function apiRequest(config, method, path, body, extraHeaders) {
267
+ const headers = { ...identityHeaders(config), ...extraHeaders };
262
268
  if (body !== void 0) headers["Content-Type"] = "application/json";
263
269
  const response = await fetch(joinUrl(config.endpoint, path), {
264
270
  method,
@@ -287,6 +293,24 @@ async function salesRequest(config, method, path, body) {
287
293
  return await response.json();
288
294
  }
289
295
 
296
+ // ../tracking-core/src/resources/sales/transport.ts
297
+ var salesRequest = apiRequest;
298
+
299
+ // ../tracking-core/src/resources/intl/date.ts
300
+ function formatDateInTz(iso, timeZone, opts, locale) {
301
+ const date = new Date(iso);
302
+ if (Number.isNaN(date.getTime())) return iso;
303
+ return new Intl.DateTimeFormat(locale, {
304
+ year: "numeric",
305
+ month: "short",
306
+ day: "2-digit",
307
+ hour: "2-digit",
308
+ minute: "2-digit",
309
+ ...opts,
310
+ timeZone
311
+ }).format(date);
312
+ }
313
+
290
314
  // ../tracking-core/src/resources/sales/money.ts
291
315
  var MINOR_UNIT_EXPONENT = {
292
316
  USD: 2,
@@ -306,19 +330,6 @@ function formatMoney(cents, currency, locale) {
306
330
  fromMinor(cents, currency)
307
331
  );
308
332
  }
309
- function formatDateInTz(iso, timeZone, opts, locale) {
310
- const date = new Date(iso);
311
- if (Number.isNaN(date.getTime())) return iso;
312
- return new Intl.DateTimeFormat(locale, {
313
- year: "numeric",
314
- month: "short",
315
- day: "2-digit",
316
- hour: "2-digit",
317
- minute: "2-digit",
318
- ...opts,
319
- timeZone
320
- }).format(date);
321
- }
322
333
 
323
334
  // ../tracking-core/src/resources/sales/client.ts
324
335
  function fireRecordedConversions(firing, input, recorded, sale, currency) {
@@ -351,6 +362,7 @@ function fireRecordedConversions(firing, input, recorded, sale, currency) {
351
362
  }
352
363
  }
353
364
  function createSalesClient(config) {
365
+ if (config.firing) registerCapability("conversion_goals_manual");
354
366
  async function record(input) {
355
367
  const currency = input.currency ?? config.defaultCurrency;
356
368
  if (!currency) {