@aranova/tracking-react 1.16.0 → 1.17.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.
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod/mini';
2
- import { S as SalesBookingsClient, w as ConversionConfigStore, _ as TrackingConfigRuntime } from './bookings-DFz3BUiP.mjs';
2
+ import { S as SalesBookingsClient, w as ConversionConfigStore, _ as TrackingConfigRuntime } from './bookings-DOh1WMhH.mjs';
3
3
  import { CountryCode } from 'libphonenumber-js';
4
4
 
5
5
  /** Raw identifiers a caller may hand us (normalized before use). */
@@ -631,6 +631,8 @@ declare function createSalesClient<TService extends string = string, TConversion
631
631
  * from two modules is silently dropped unless both resolve to the same binding.
632
632
  */
633
633
  declare class AranovaApiError extends Error {
634
+ /** `instanceof` checks the brand, so an error from another entry's copy of this class passes. */
635
+ static [Symbol.hasInstance](value: unknown): value is AranovaApiError;
634
636
  readonly status: number;
635
637
  readonly code: string | undefined;
636
638
  readonly requestId: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod/mini';
2
- import { S as SalesBookingsClient, w as ConversionConfigStore, _ as TrackingConfigRuntime } from './bookings-CkfA5XOM.js';
2
+ import { S as SalesBookingsClient, w as ConversionConfigStore, _ as TrackingConfigRuntime } from './bookings-2ZKfenQ7.js';
3
3
  import { CountryCode } from 'libphonenumber-js';
4
4
 
5
5
  /** Raw identifiers a caller may hand us (normalized before use). */
@@ -631,6 +631,8 @@ declare function createSalesClient<TService extends string = string, TConversion
631
631
  * from two modules is silently dropped unless both resolve to the same binding.
632
632
  */
633
633
  declare class AranovaApiError extends Error {
634
+ /** `instanceof` checks the brand, so an error from another entry's copy of this class passes. */
635
+ static [Symbol.hasInstance](value: unknown): value is AranovaApiError;
634
636
  readonly status: number;
635
637
  readonly code: string | undefined;
636
638
  readonly requestId: string | undefined;
package/dist/sales.d.mts CHANGED
@@ -1,5 +1,5 @@
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 SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, as as toMinor } from './sales-KbTcowYa.mjs';
2
- export { a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, i as BookingInput, j as BookingInputFor, l as BookingMode, p as BookingOutcome, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, F as FormSubmitField, S as SalesBookingsClient, R as newBookingAttemptKey } from './bookings-DFz3BUiP.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 SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, as as toMinor } from './sales-B1u_IHLZ.mjs';
2
+ export { a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, i as BookingInput, j as BookingInputFor, l as BookingMode, p as BookingOutcome, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, F as FormSubmitField, S as SalesBookingsClient, R as newBookingAttemptKey } from './bookings-DOh1WMhH.mjs';
3
3
  import 'zod/mini';
4
4
  import 'libphonenumber-js';
5
5
  import './phone-utils-CYr6AmEP.mjs';
package/dist/sales.d.ts CHANGED
@@ -1,5 +1,5 @@
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 SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, as as toMinor } from './sales-C0FMkN4m.js';
2
- export { a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, i as BookingInput, j as BookingInputFor, l as BookingMode, p as BookingOutcome, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, F as FormSubmitField, S as SalesBookingsClient, R as newBookingAttemptKey } from './bookings-CkfA5XOM.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 SALE_SOURCES, u as SUPPORTED_CURRENCIES, v as Sale, w as SaleBuiltinRequirableField, x as SaleCursorPage, y as SaleFilters, z as SaleInput, F as SaleItem, H as SaleItemInput, I as SaleKeysetSortField, J as SaleListPage, K as SaleListQuery, L as SaleListQueryV2, M as SalePropertyOption, O as SalePropertyType, Q as SaleService, R as SaleServiceInput, T as SaleSortField, U as SaleSortOrder, V as SaleSource, W as SaleSourceFacts, X as SaleSummary, Y as SaleSummaryPrevious, Z as SaleSummaryQuery, _ as SaleSummaryQueryV2, $ as SaleSummaryV2, a0 as SaleUpdateInput, a1 as SalesBusinessClient, a2 as SalesCategoryBreakdown, a3 as SalesClient, a4 as SalesClientConfig, a5 as SalesCustomersClient, a6 as SalesServiceBreakdown, a7 as SalesTransportConfig, a8 as SalesTrendPoint, a9 as SummaryCurrencyDelta, aa as SummaryDeltas, ab as SummaryWindow, ac as SupportedCurrency, ad as TRACKING_RANGES, ae as TrackingOverviewRange, ag as createSalesClient, ah as currencySchema, ai as fetchServices, aj as formatDateInTz, ak as formatMoney, al as fromMinor, am as saleCreateSchema, an as saleItemSchema, ao as saleServiceSchema, ap as saleUpdateSchema, aq as salesRequest, as as toMinor } from './sales-I2jXSS-l.js';
2
+ export { a as BookingDetailsFailure, b as BookingDetailsInput, c as BookingDetailsOptions, d as BookingDetailsOutcome, e as BookingDetailsStatus, f as BookingDropOff, g as BookingFormSubmit, i as BookingInput, j as BookingInputFor, l as BookingMode, p as BookingOutcome, s as BookingServiceKey, t as BookingSimulation, u as BookingSubmitOptions, v as BookingVehicle, F as FormSubmitField, S as SalesBookingsClient, R as newBookingAttemptKey } from './bookings-2ZKfenQ7.js';
3
3
  import 'zod/mini';
4
4
  import 'libphonenumber-js';
5
5
  import './phone-utils-CYr6AmEP.js';
package/dist/sales.js CHANGED
@@ -378,7 +378,8 @@ function camelRules(rules) {
378
378
  specialHours: rules.special_hours,
379
379
  vehicleRequired: rules.vehicle_required,
380
380
  vehicleDeferred: rules.vehicle_deferred,
381
- dropOffOptions: rules.drop_off_options
381
+ dropOffOptions: rules.drop_off_options,
382
+ bookedCounts: rules.booked_counts ?? {}
382
383
  };
383
384
  }
384
385
  function buildBookingHandoffUrl(fallbackUrl, prefill = {}) {
@@ -640,9 +641,18 @@ function parseBookingRules(value) {
640
641
  special_hours: parseWindowsMap(r.special_hours),
641
642
  vehicle_required: r.vehicle_required === true,
642
643
  vehicle_deferred: r.vehicle_deferred === true,
643
- drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : []
644
+ drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : [],
645
+ booked_counts: parseCounts(r.booked_counts)
644
646
  };
645
647
  }
648
+ function parseCounts(value) {
649
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
650
+ const counts = {};
651
+ for (const [date, count] of Object.entries(value)) {
652
+ if (typeof count === "number" && Number.isInteger(count) && count >= 0) counts[date] = count;
653
+ }
654
+ return counts;
655
+ }
646
656
  function parseBookingOption(value) {
647
657
  if (!value || typeof value !== "object") return [];
648
658
  const o = value;
@@ -1408,9 +1418,16 @@ function optionKeys(value) {
1408
1418
  }
1409
1419
 
1410
1420
  // ../tracking-core/src/resources/http/errors.ts
1411
- var AranovaApiError = class extends Error {
1421
+ var API_ERROR_BRAND = /* @__PURE__ */ Symbol.for("aranova.api_error");
1422
+ var AranovaApiError = class _AranovaApiError extends Error {
1423
+ /** `instanceof` checks the brand, so an error from another entry's copy of this class passes. */
1424
+ static [Symbol.hasInstance](value) {
1425
+ if (this !== _AranovaApiError) return Function.prototype[Symbol.hasInstance].call(this, value);
1426
+ return typeof value === "object" && value !== null && value[API_ERROR_BRAND] === true;
1427
+ }
1412
1428
  constructor(message, options) {
1413
1429
  super(message);
1430
+ Object.defineProperty(this, API_ERROR_BRAND, { value: true });
1414
1431
  this.name = "AranovaApiError";
1415
1432
  this.status = options.status;
1416
1433
  this.code = options.code;