@aranova/tracking-react 0.25.0 → 0.26.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.
@@ -394,6 +394,12 @@ interface Sale {
394
394
  updated_at: string;
395
395
  items: SaleItem[];
396
396
  }
397
+ /**
398
+ * The offset page shape returned by the internal admin list, which this client
399
+ * never calls (`list()` is keyset and returns {@link SaleCursorPage}).
400
+ *
401
+ * @deprecated Unused by this client — no verb returns or accepts it. Kept for one release; removed in the next major.
402
+ */
397
403
  interface SaleListPage {
398
404
  items: Sale[];
399
405
  total: number;
@@ -406,9 +412,10 @@ interface SaleCursorPage {
406
412
  has_more?: boolean;
407
413
  }
408
414
  /**
409
- * Sortable columns on the secret-key (keyset) and admin (offset) list endpoints.
410
- * `business_name` only applies to the cross-business admin list — it sorts the
411
- * joined `businesses.name` column.
415
+ * Sortable columns on the internal admin (offset) list. `list()` is typed to
416
+ * {@link SaleKeysetSortField}, which omits `customer_name` and `business_name`.
417
+ *
418
+ * @deprecated Unused by this client — no verb returns or accepts it. Kept for one release; removed in the next major.
412
419
  */
413
420
  type SaleSortField = "occurred_at" | "created_at" | "amount_total_cents" | "customer_name" | "business_name";
414
421
  type SaleSortOrder = "asc" | "desc";
@@ -440,10 +447,13 @@ interface SaleFilters {
440
447
  * Pagination is **keyset (cursor)**: `next_cursor` returned by one page is
441
448
  * passed back as `cursor` on the next. `null` / undefined cursor = first page.
442
449
  *
443
- * Ordering on this endpoint is fixed at **`occurred_at DESC, id DESC`** the
444
- * cursor encodes a position in that index, so a different sort would
445
- * invalidate cursors mid-pagination. For ad-hoc sorted reads use the
446
- * dashboard admin endpoint, which is offset-paginated.
450
+ * Ordering is selectable via `sort`/`order` on {@link SaleListQueryV2}. A cursor
451
+ * encodes a position under the sort it was minted with, so replaying it under a
452
+ * different sort is rejected (422) page with the sort you started with.
453
+ */
454
+ /**
455
+ * @deprecated Superseded by {@link SaleListQueryV2}, which is what `list()` accepts.
456
+ * Its ordering note was also stale — `sort`/`order` are supported. Removed in the next major.
447
457
  */
448
458
  interface SaleListQuery extends SaleFilters {
449
459
  limit?: number;
@@ -461,6 +471,10 @@ interface SaleListQueryV2 extends SaleListQuery {
461
471
  declare const TRACKING_RANGES: readonly ["24h", "7d", "30d"];
462
472
  type TrackingOverviewRange = (typeof TRACKING_RANGES)[number];
463
473
  /** Query input for `SalesClient.summary()` — filters + range + options. */
474
+ /**
475
+ * @deprecated The v1 summary query. `summary()` accepts {@link SaleSummaryQueryV2};
476
+ * the v1 endpoint no longer exists. Removed in the next major.
477
+ */
464
478
  interface SaleSummaryQuery extends SaleFilters {
465
479
  range: TrackingOverviewRange;
466
480
  /** Include the per-category line-item breakdown (extra join; default false). */
@@ -500,6 +514,10 @@ interface SalesTrendPoint {
500
514
  sale_count: number;
501
515
  revenue_cents: number;
502
516
  }
517
+ /**
518
+ * @deprecated The v1 summary response. `summary()` returns {@link SaleSummaryV2};
519
+ * the v1 endpoint no longer exists. Removed in the next major.
520
+ */
503
521
  interface SaleSummary {
504
522
  range: TrackingOverviewRange;
505
523
  business_id: string | null;
@@ -672,6 +690,23 @@ interface BusinessConfigFeatures {
672
690
  comparisons: boolean;
673
691
  retention: boolean;
674
692
  }
693
+ /** A built-in customer field a business can require on every sale. */
694
+ type SaleBuiltinRequirableField = "customer_name" | "customer_phone" | "customer_email" | "description";
695
+ /** v1 value types. `enum` is single-select over the property's `options`. */
696
+ type SalePropertyType = "string" | "number" | "boolean" | "enum" | "date";
697
+ interface SalePropertyOption {
698
+ key: string;
699
+ label: string;
700
+ }
701
+ /** One custom sale property as the sale form sees it: overrides applied, options
702
+ * already filtered to the business's enabled subset. */
703
+ interface EffectiveSaleProperty {
704
+ key: string;
705
+ label: string;
706
+ type: SalePropertyType;
707
+ required: boolean;
708
+ options?: SalePropertyOption[] | null;
709
+ }
675
710
  interface BusinessConfig {
676
711
  business_id: string;
677
712
  display_name: string;
@@ -681,6 +716,11 @@ interface BusinessConfig {
681
716
  default_phone_country: string | null;
682
717
  services: BusinessConfigService[];
683
718
  features: BusinessConfigFeatures;
719
+ builtin_required: SaleBuiltinRequirableField[];
720
+ properties: EffectiveSaleProperty[];
721
+ /** Whether the form should pre-tick the SMS consent box. A form default only —
722
+ * the per-sale `sms_consent` attestation is what every send path gates on. */
723
+ sms_consent_default_opt_in: boolean;
684
724
  }
685
725
 
686
726
  /** Shared config for every awaited (non fire-and-forget) API helper. */
@@ -749,10 +789,10 @@ interface SalesClient<TService extends string = string, TConversion extends stri
749
789
  occurred_at?: string;
750
790
  }): Promise<Sale>;
751
791
  /**
752
- * Record a revenue sale — the intent-revealing alias of {@link record} in the unified-goal
753
- * API. POSTs `/sales` and ALSO fires the on-site conversion when the sale-goal is
754
- * WEBPAGE-mapped. Use this for anything with real revenue; use {@link trackConversion} for a
755
- * non-revenue on-page event.
792
+ * Record a revenue sale — the intent-revealing alias of {@link record}. Identical
793
+ * behavior (same function reference): POSTs `/sales` and fires the on-site conversion
794
+ * when the sale-goal is WEBPAGE-mapped. Use either for real revenue; use
795
+ * {@link trackConversion} for a non-revenue on-page event.
756
796
  */
757
797
  recordSale(input: Omit<SaleInput, "currency" | "occurred_at" | "service" | "services"> & {
758
798
  service?: TService | null;
@@ -858,4 +898,4 @@ interface PublicServiceItem {
858
898
  */
859
899
  declare function fetchServices(config: SalesTransportConfig): Promise<PublicServiceItem[]>;
860
900
 
861
- export { type SalesServiceBreakdown as $, AranovaApiError as A, type BusinessConfig as B, type CompareTo as C, type DistinctCustomersByCurrency as D, type SaleKeysetSortField as E, type SaleListPage as F, type Granularity as G, type SaleListQuery as H, type SaleListQueryV2 as I, type SaleService as J, type SaleServiceInput as K, type SaleSortField as L, type SaleSortOrder as M, NAMED_RANGES as N, type SaleSummary as O, type PublicServiceItem as P, type SaleSummaryPrevious as Q, type SaleSummaryQuery as R, SUPPORTED_CURRENCIES as S, type SaleSummaryQueryV2 as T, type SaleSummaryV2 as U, type SaleUpdateInput as V, type SalesBusinessClient as W, type SalesCategoryBreakdown as X, type SalesClient as Y, type SalesClientConfig as Z, type SalesCustomersClient as _, type BusinessConfigFeatures as a, type SalesTransportConfig as a0, type SalesTrendPoint as a1, type SummaryCurrencyDelta as a2, type SummaryDeltas as a3, type SummaryWindow as a4, type SupportedCurrency as a5, TRACKING_RANGES as a6, type TrackingOverviewRange as a7, clearStashedUserData as a8, createSalesClient as a9, fetchServices as aa, formatDateInTz as ab, formatMoney as ac, fromMinor as ad, saleCreateSchema as ae, saleItemSchema as af, saleServiceSchema as ag, saleUpdateSchema as ah, salesRequest as ai, stashUserData as aj, toMinor as ak, type BusinessConfigService as b, type ConversionUserData as c, type CurrencyRevenue as d, type CustomerCurrencyDelta as e, type CustomerCurrencyTotal as f, type CustomerGetOptions as g, type CustomerGetResult as h, type CustomerKpis as i, type CustomerKpisDeltas as j, type CustomerKpisPrevious as k, type CustomerListPage as l, type CustomerListQuery as m, type CustomerProfile as n, type CustomerSegment as o, type CustomerSegmentCount as p, type CustomerSortField as q, type CustomerSummary as r, type CustomerSummaryQuery as s, type NamedRange as t, type Sale as u, type SaleCursorPage as v, type SaleFilters as w, type SaleInput as x, type SaleItem as y, type SaleItemInput as z };
901
+ export { type SalesCategoryBreakdown as $, AranovaApiError as A, type BusinessConfig as B, type CompareTo as C, type DistinctCustomersByCurrency as D, type EffectiveSaleProperty 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 SalePropertyOption as L, type SalePropertyType as M, NAMED_RANGES as N, type SaleService as O, type PublicServiceItem as P, type SaleServiceInput as Q, type SaleSortField as R, SUPPORTED_CURRENCIES as S, type SaleSortOrder as T, type SaleSummary as U, type SaleSummaryPrevious as V, type SaleSummaryQuery as W, type SaleSummaryQueryV2 as X, type SaleSummaryV2 as Y, type SaleUpdateInput as Z, type SalesBusinessClient as _, type BusinessConfigFeatures as a, type SalesClient as a0, type SalesClientConfig as a1, type SalesCustomersClient as a2, type SalesServiceBreakdown as a3, type SalesTransportConfig as a4, type SalesTrendPoint as a5, type SummaryCurrencyDelta as a6, type SummaryDeltas as a7, type SummaryWindow as a8, type SupportedCurrency as a9, TRACKING_RANGES as aa, type TrackingOverviewRange as ab, clearStashedUserData as ac, createSalesClient as ad, fetchServices as ae, formatDateInTz as af, formatMoney as ag, fromMinor as ah, saleCreateSchema as ai, saleItemSchema as aj, saleServiceSchema as ak, saleUpdateSchema as al, salesRequest as am, stashUserData as an, toMinor as ao, type BusinessConfigService as b, type ConversionUserData as c, type CurrencyRevenue as d, type CustomerCurrencyDelta as e, type CustomerCurrencyTotal as f, type CustomerGetOptions as g, type CustomerGetResult as h, type CustomerKpis as i, type CustomerKpisDeltas as j, type CustomerKpisPrevious as k, type CustomerListPage as l, type CustomerListQuery as m, type CustomerProfile as n, type CustomerSegment as o, type CustomerSegmentCount as p, type CustomerSortField as q, type CustomerSummary as r, type CustomerSummaryQuery as s, type NamedRange as t, type Sale as u, type SaleBuiltinRequirableField as v, type SaleCursorPage as w, type SaleFilters as x, type SaleInput as y, type SaleItem as z };
package/dist/sales.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, u as Sale, v as SaleCursorPage, w as SaleFilters, x as SaleInput, y as SaleItem, z as SaleItemInput, E as SaleKeysetSortField, F as SaleListPage, H as SaleListQuery, I as SaleListQueryV2, J as SaleService, K as SaleServiceInput, L as SaleSortField, M as SaleSortOrder, O as SaleSummary, Q as SaleSummaryPrevious, R as SaleSummaryQuery, T as SaleSummaryQueryV2, U as SaleSummaryV2, V as SaleUpdateInput, W as SalesBusinessClient, X as SalesCategoryBreakdown, Y as SalesClient, Z as SalesClientConfig, _ as SalesCustomersClient, $ as SalesServiceBreakdown, a0 as SalesTransportConfig, a1 as SalesTrendPoint, a2 as SummaryCurrencyDelta, a3 as SummaryDeltas, a4 as SummaryWindow, a5 as SupportedCurrency, a6 as TRACKING_RANGES, a7 as TrackingOverviewRange, a9 as createSalesClient, aa as fetchServices, ab as formatDateInTz, ac as formatMoney, ad as fromMinor, ae as saleCreateSchema, af as saleItemSchema, ag as saleServiceSchema, ah as saleUpdateSchema, ai as salesRequest, ak as toMinor } from './sales-C3B0BOBQ.mjs';
1
+ export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, u as Sale, v as SaleBuiltinRequirableField, w as SaleCursorPage, x as SaleFilters, y as SaleInput, z as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SalePropertyOption, M as SalePropertyType, O as SaleService, Q as SaleServiceInput, R as SaleSortField, T as SaleSortOrder, U as SaleSummary, V as SaleSummaryPrevious, W as SaleSummaryQuery, X as SaleSummaryQueryV2, Y as SaleSummaryV2, Z as SaleUpdateInput, _ as SalesBusinessClient, $ as SalesCategoryBreakdown, a0 as SalesClient, a1 as SalesClientConfig, a2 as SalesCustomersClient, a3 as SalesServiceBreakdown, a4 as SalesTransportConfig, a5 as SalesTrendPoint, a6 as SummaryCurrencyDelta, a7 as SummaryDeltas, a8 as SummaryWindow, a9 as SupportedCurrency, aa as TRACKING_RANGES, ab as TrackingOverviewRange, ad as createSalesClient, ae as fetchServices, af as formatDateInTz, ag as formatMoney, ah as fromMinor, ai as saleCreateSchema, aj as saleItemSchema, ak as saleServiceSchema, al as saleUpdateSchema, am as salesRequest, ao as toMinor } from './sales-DzKvyVjY.mjs';
2
2
  import 'zod';
3
3
  import './tracking-config-runtime-BnUlS_Ae.mjs';
4
4
  import 'libphonenumber-js';
package/dist/sales.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, u as Sale, v as SaleCursorPage, w as SaleFilters, x as SaleInput, y as SaleItem, z as SaleItemInput, E as SaleKeysetSortField, F as SaleListPage, H as SaleListQuery, I as SaleListQueryV2, J as SaleService, K as SaleServiceInput, L as SaleSortField, M as SaleSortOrder, O as SaleSummary, Q as SaleSummaryPrevious, R as SaleSummaryQuery, T as SaleSummaryQueryV2, U as SaleSummaryV2, V as SaleUpdateInput, W as SalesBusinessClient, X as SalesCategoryBreakdown, Y as SalesClient, Z as SalesClientConfig, _ as SalesCustomersClient, $ as SalesServiceBreakdown, a0 as SalesTransportConfig, a1 as SalesTrendPoint, a2 as SummaryCurrencyDelta, a3 as SummaryDeltas, a4 as SummaryWindow, a5 as SupportedCurrency, a6 as TRACKING_RANGES, a7 as TrackingOverviewRange, a9 as createSalesClient, aa as fetchServices, ab as formatDateInTz, ac as formatMoney, ad as fromMinor, ae as saleCreateSchema, af as saleItemSchema, ag as saleServiceSchema, ah as saleUpdateSchema, ai as salesRequest, ak as toMinor } from './sales-BIij04IG.js';
1
+ export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, E as EffectiveSaleProperty, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, u as Sale, v as SaleBuiltinRequirableField, w as SaleCursorPage, x as SaleFilters, y as SaleInput, z as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SalePropertyOption, M as SalePropertyType, O as SaleService, Q as SaleServiceInput, R as SaleSortField, T as SaleSortOrder, U as SaleSummary, V as SaleSummaryPrevious, W as SaleSummaryQuery, X as SaleSummaryQueryV2, Y as SaleSummaryV2, Z as SaleUpdateInput, _ as SalesBusinessClient, $ as SalesCategoryBreakdown, a0 as SalesClient, a1 as SalesClientConfig, a2 as SalesCustomersClient, a3 as SalesServiceBreakdown, a4 as SalesTransportConfig, a5 as SalesTrendPoint, a6 as SummaryCurrencyDelta, a7 as SummaryDeltas, a8 as SummaryWindow, a9 as SupportedCurrency, aa as TRACKING_RANGES, ab as TrackingOverviewRange, ad as createSalesClient, ae as fetchServices, af as formatDateInTz, ag as formatMoney, ah as fromMinor, ai as saleCreateSchema, aj as saleItemSchema, ak as saleServiceSchema, al as saleUpdateSchema, am as salesRequest, ao as toMinor } from './sales-1J-Z4AvL.js';
2
2
  import 'zod';
3
3
  import './tracking-config-runtime-BnUlS_Ae.js';
4
4
  import 'libphonenumber-js';