@aranova/tracking-next 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.
@@ -396,6 +396,12 @@ interface Sale {
396
396
  updated_at: string;
397
397
  items: SaleItem[];
398
398
  }
399
+ /**
400
+ * The offset page shape returned by the internal admin list, which this client
401
+ * never calls (`list()` is keyset and returns {@link SaleCursorPage}).
402
+ *
403
+ * @deprecated Unused by this client — no verb returns or accepts it. Kept for one release; removed in the next major.
404
+ */
399
405
  interface SaleListPage {
400
406
  items: Sale[];
401
407
  total: number;
@@ -408,9 +414,10 @@ interface SaleCursorPage {
408
414
  has_more?: boolean;
409
415
  }
410
416
  /**
411
- * Sortable columns on the secret-key (keyset) and admin (offset) list endpoints.
412
- * `business_name` only applies to the cross-business admin list — it sorts the
413
- * joined `businesses.name` column.
417
+ * Sortable columns on the internal admin (offset) list. `list()` is typed to
418
+ * {@link SaleKeysetSortField}, which omits `customer_name` and `business_name`.
419
+ *
420
+ * @deprecated Unused by this client — no verb returns or accepts it. Kept for one release; removed in the next major.
414
421
  */
415
422
  type SaleSortField = "occurred_at" | "created_at" | "amount_total_cents" | "customer_name" | "business_name";
416
423
  type SaleSortOrder = "asc" | "desc";
@@ -442,10 +449,13 @@ interface SaleFilters {
442
449
  * Pagination is **keyset (cursor)**: `next_cursor` returned by one page is
443
450
  * passed back as `cursor` on the next. `null` / undefined cursor = first page.
444
451
  *
445
- * Ordering on this endpoint is fixed at **`occurred_at DESC, id DESC`** — the
446
- * cursor encodes a position in that index, so a different sort would
447
- * invalidate cursors mid-pagination. For ad-hoc sorted reads use the
448
- * dashboard admin endpoint, which is offset-paginated.
452
+ * Ordering is selectable via `sort`/`order` on {@link SaleListQueryV2}. A cursor
453
+ * encodes a position under the sort it was minted with, so replaying it under a
454
+ * different sort is rejected (422) — page with the sort you started with.
455
+ */
456
+ /**
457
+ * @deprecated Superseded by {@link SaleListQueryV2}, which is what `list()` accepts.
458
+ * Its ordering note was also stale — `sort`/`order` are supported. Removed in the next major.
449
459
  */
450
460
  interface SaleListQuery extends SaleFilters {
451
461
  limit?: number;
@@ -463,6 +473,10 @@ interface SaleListQueryV2 extends SaleListQuery {
463
473
  declare const TRACKING_RANGES: readonly ["24h", "7d", "30d"];
464
474
  type TrackingOverviewRange = (typeof TRACKING_RANGES)[number];
465
475
  /** Query input for `SalesClient.summary()` — filters + range + options. */
476
+ /**
477
+ * @deprecated The v1 summary query. `summary()` accepts {@link SaleSummaryQueryV2};
478
+ * the v1 endpoint no longer exists. Removed in the next major.
479
+ */
466
480
  interface SaleSummaryQuery extends SaleFilters {
467
481
  range: TrackingOverviewRange;
468
482
  /** Include the per-category line-item breakdown (extra join; default false). */
@@ -502,6 +516,10 @@ interface SalesTrendPoint {
502
516
  sale_count: number;
503
517
  revenue_cents: number;
504
518
  }
519
+ /**
520
+ * @deprecated The v1 summary response. `summary()` returns {@link SaleSummaryV2};
521
+ * the v1 endpoint no longer exists. Removed in the next major.
522
+ */
505
523
  interface SaleSummary {
506
524
  range: TrackingOverviewRange;
507
525
  business_id: string | null;
@@ -674,6 +692,23 @@ interface BusinessConfigFeatures {
674
692
  comparisons: boolean;
675
693
  retention: boolean;
676
694
  }
695
+ /** A built-in customer field a business can require on every sale. */
696
+ type SaleBuiltinRequirableField = "customer_name" | "customer_phone" | "customer_email" | "description";
697
+ /** v1 value types. `enum` is single-select over the property's `options`. */
698
+ type SalePropertyType = "string" | "number" | "boolean" | "enum" | "date";
699
+ interface SalePropertyOption {
700
+ key: string;
701
+ label: string;
702
+ }
703
+ /** One custom sale property as the sale form sees it: overrides applied, options
704
+ * already filtered to the business's enabled subset. */
705
+ interface EffectiveSaleProperty {
706
+ key: string;
707
+ label: string;
708
+ type: SalePropertyType;
709
+ required: boolean;
710
+ options?: SalePropertyOption[] | null;
711
+ }
677
712
  interface BusinessConfig {
678
713
  business_id: string;
679
714
  display_name: string;
@@ -683,6 +718,11 @@ interface BusinessConfig {
683
718
  default_phone_country: string | null;
684
719
  services: BusinessConfigService[];
685
720
  features: BusinessConfigFeatures;
721
+ builtin_required: SaleBuiltinRequirableField[];
722
+ properties: EffectiveSaleProperty[];
723
+ /** Whether the form should pre-tick the SMS consent box. A form default only —
724
+ * the per-sale `sms_consent` attestation is what every send path gates on. */
725
+ sms_consent_default_opt_in: boolean;
686
726
  }
687
727
 
688
728
  type SalesTransportConfig = ApiTransportConfig;
@@ -733,10 +773,10 @@ interface SalesClient<TService extends string = string, TConversion extends stri
733
773
  occurred_at?: string;
734
774
  }): Promise<Sale>;
735
775
  /**
736
- * Record a revenue sale — the intent-revealing alias of {@link record} in the unified-goal
737
- * API. POSTs `/sales` and ALSO fires the on-site conversion when the sale-goal is
738
- * WEBPAGE-mapped. Use this for anything with real revenue; use {@link trackConversion} for a
739
- * non-revenue on-page event.
776
+ * Record a revenue sale — the intent-revealing alias of {@link record}. Identical
777
+ * behavior (same function reference): POSTs `/sales` and fires the on-site conversion
778
+ * when the sale-goal is WEBPAGE-mapped. Use either for real revenue; use
779
+ * {@link trackConversion} for a non-revenue on-page event.
740
780
  */
741
781
  recordSale(input: Omit<SaleInput, "currency" | "occurred_at" | "service" | "services"> & {
742
782
  service?: TService | null;
@@ -817,4 +857,4 @@ interface PublicServiceItem {
817
857
  */
818
858
  declare function fetchServices(config: SalesTransportConfig): Promise<PublicServiceItem[]>;
819
859
 
820
- export { type SalesTransportConfig as $, type SaleKeysetSortField as A, type BusinessConfig as B, type CompareTo as C, type DistinctCustomersByCurrency as D, type SaleListPage as E, type SaleListQuery as F, type Granularity as G, type SaleListQueryV2 as H, type SaleService as I, type SaleServiceInput as J, type SaleSortField as K, type SaleSortOrder as L, type SaleSummary as M, NAMED_RANGES as N, type SaleSummaryPrevious as O, type PublicServiceItem as P, type SaleSummaryQuery as Q, type SaleSummaryQueryV2 as R, SUPPORTED_CURRENCIES as S, type SaleSummaryV2 as T, type SaleUpdateInput as U, type SalesBusinessClient as V, type SalesCategoryBreakdown as W, type SalesClient as X, type SalesClientConfig as Y, type SalesCustomersClient as Z, type SalesServiceBreakdown as _, type BusinessConfigFeatures as a, type SalesTrendPoint as a0, type SummaryCurrencyDelta as a1, type SummaryDeltas as a2, type SummaryWindow as a3, type SupportedCurrency as a4, TRACKING_RANGES as a5, type TrackingOverviewRange as a6, clearStashedUserData as a7, createSalesClient as a8, fetchServices as a9, formatMoney as aa, fromMinor as ab, saleCreateSchema as ac, saleItemSchema as ad, saleServiceSchema as ae, saleUpdateSchema as af, salesRequest as ag, stashUserData as ah, toMinor as ai, 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 };
860
+ export { type SalesClient as $, type SaleItemInput as A, type BusinessConfig as B, type CompareTo as C, type DistinctCustomersByCurrency as D, type EffectiveSaleProperty as E, type SaleKeysetSortField as F, type Granularity as G, type SaleListPage as H, type SaleListQuery as I, type SaleListQueryV2 as J, type SalePropertyOption as K, type SalePropertyType as L, type SaleService as M, NAMED_RANGES as N, type SaleServiceInput as O, type PublicServiceItem as P, type SaleSortField as Q, type SaleSortOrder as R, SUPPORTED_CURRENCIES as S, type SaleSummary 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, formatMoney as ae, fromMinor as af, saleCreateSchema as ag, saleItemSchema as ah, saleServiceSchema as ai, saleUpdateSchema as aj, salesRequest as ak, stashUserData as al, toMinor as am, 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 { 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, A as SaleKeysetSortField, E as SaleListPage, F as SaleListQuery, H as SaleListQueryV2, I as SaleService, J as SaleServiceInput, K as SaleSortField, L as SaleSortOrder, M as SaleSummary, O as SaleSummaryPrevious, Q as SaleSummaryQuery, R as SaleSummaryQueryV2, T as SaleSummaryV2, U as SaleUpdateInput, V as SalesBusinessClient, W as SalesCategoryBreakdown, X as SalesClient, Y as SalesClientConfig, Z as SalesCustomersClient, _ as SalesServiceBreakdown, $ as SalesTransportConfig, a0 as SalesTrendPoint, a1 as SummaryCurrencyDelta, a2 as SummaryDeltas, a3 as SummaryWindow, a4 as SupportedCurrency, a5 as TRACKING_RANGES, a6 as TrackingOverviewRange, a8 as createSalesClient, a9 as fetchServices, aa as formatMoney, ab as fromMinor, ac as saleCreateSchema, ad as saleItemSchema, ae as saleServiceSchema, af as saleUpdateSchema, ag as salesRequest, ai as toMinor } from './sales-Xs375f6t.mjs';
1
+ export { 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, A as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SalePropertyOption, L as SalePropertyType, M as SaleService, O as SaleServiceInput, Q as SaleSortField, R as SaleSortOrder, T 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 formatMoney, af as fromMinor, ag as saleCreateSchema, ah as saleItemSchema, ai as saleServiceSchema, aj as saleUpdateSchema, ak as salesRequest, am as toMinor } from './sales-f1iXwlaV.mjs';
2
2
  export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.mjs';
3
3
  import 'zod';
4
4
  import './tracking-config-runtime-BnUlS_Ae.mjs';
package/dist/sales.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { 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, A as SaleKeysetSortField, E as SaleListPage, F as SaleListQuery, H as SaleListQueryV2, I as SaleService, J as SaleServiceInput, K as SaleSortField, L as SaleSortOrder, M as SaleSummary, O as SaleSummaryPrevious, Q as SaleSummaryQuery, R as SaleSummaryQueryV2, T as SaleSummaryV2, U as SaleUpdateInput, V as SalesBusinessClient, W as SalesCategoryBreakdown, X as SalesClient, Y as SalesClientConfig, Z as SalesCustomersClient, _ as SalesServiceBreakdown, $ as SalesTransportConfig, a0 as SalesTrendPoint, a1 as SummaryCurrencyDelta, a2 as SummaryDeltas, a3 as SummaryWindow, a4 as SupportedCurrency, a5 as TRACKING_RANGES, a6 as TrackingOverviewRange, a8 as createSalesClient, a9 as fetchServices, aa as formatMoney, ab as fromMinor, ac as saleCreateSchema, ad as saleItemSchema, ae as saleServiceSchema, af as saleUpdateSchema, ag as salesRequest, ai as toMinor } from './sales-Bv1tihaB.js';
1
+ export { 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, A as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SalePropertyOption, L as SalePropertyType, M as SaleService, O as SaleServiceInput, Q as SaleSortField, R as SaleSortOrder, T 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 formatMoney, af as fromMinor, ag as saleCreateSchema, ah as saleItemSchema, ai as saleServiceSchema, aj as saleUpdateSchema, ak as salesRequest, am as toMinor } from './sales-C3dIw4LW.js';
2
2
  export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.js';
3
3
  import 'zod';
4
4
  import './tracking-config-runtime-BnUlS_Ae.js';