@aranova/tracking-react 1.12.0 → 1.13.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,4 +1,4 @@
1
- import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations } from './bookings-Lmi0o_PA.mjs';
1
+ import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations } from './bookings-CHpplXU7.mjs';
2
2
  import * as zod_v4_core from 'zod/v4/core';
3
3
  import * as z from 'zod/mini';
4
4
  import { J as JsonValue, F as FormSubmitConfig, a as FormSubmitMetadata } from './form-submit-CX-CxJjQ.mjs';
@@ -1,4 +1,4 @@
1
- import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations } from './bookings-v_ucn93l.js';
1
+ import { p as BookingDayWindows, h as BookingMode, q as ConversionIntegrations } from './bookings-C1HMPjQl.js';
2
2
  import * as zod_v4_core from 'zod/v4/core';
3
3
  import * as z from 'zod/mini';
4
4
  import { J as JsonValue, F as FormSubmitConfig, a as FormSubmitMetadata } from './form-submit-CX-CxJjQ.js';
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod/mini';
2
- import { S as SalesBookingsClient, l as ConversionConfigStore, s as TrackingConfigRuntime } from './bookings-v_ucn93l.js';
2
+ import { S as SalesBookingsClient, l as ConversionConfigStore, s as TrackingConfigRuntime } from './bookings-C1HMPjQl.js';
3
3
  import { CountryCode } from 'libphonenumber-js';
4
4
 
5
5
  /** Raw identifiers a caller may hand us (normalized before use). */
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod/mini';
2
- import { S as SalesBookingsClient, l as ConversionConfigStore, s as TrackingConfigRuntime } from './bookings-Lmi0o_PA.mjs';
2
+ import { S as SalesBookingsClient, l as ConversionConfigStore, s as TrackingConfigRuntime } from './bookings-CHpplXU7.mjs';
3
3
  import { CountryCode } from 'libphonenumber-js';
4
4
 
5
5
  /** Raw identifiers a caller may hand us (normalized before use). */
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-6vMEcopj.mjs';
2
- export { B as BookingDetailsFailure, a as BookingDetailsInput, b as BookingDetailsOptions, c as BookingDetailsOutcome, d as BookingDetailsStatus, e as BookingDropOff, f as BookingFormSubmit, g as BookingInput, h as BookingMode, i as BookingOutcome, j as BookingSimulation, k as BookingSubmitOptions, F as FormSubmitField, S as SalesBookingsClient, n as newBookingAttemptKey } from './bookings-Lmi0o_PA.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-YUH3bQl9.mjs';
2
+ export { B as BookingDetailsFailure, a as BookingDetailsInput, b as BookingDetailsOptions, c as BookingDetailsOutcome, d as BookingDetailsStatus, e as BookingDropOff, f as BookingFormSubmit, g as BookingInput, h as BookingMode, i as BookingOutcome, j as BookingSimulation, k as BookingSubmitOptions, F as FormSubmitField, S as SalesBookingsClient, n as newBookingAttemptKey } from './bookings-CHpplXU7.mjs';
3
3
  import 'zod/mini';
4
4
  import 'libphonenumber-js';
5
5
  import './form-submit-CX-CxJjQ.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-DXLGjJQ6.js';
2
- export { B as BookingDetailsFailure, a as BookingDetailsInput, b as BookingDetailsOptions, c as BookingDetailsOutcome, d as BookingDetailsStatus, e as BookingDropOff, f as BookingFormSubmit, g as BookingInput, h as BookingMode, i as BookingOutcome, j as BookingSimulation, k as BookingSubmitOptions, F as FormSubmitField, S as SalesBookingsClient, n as newBookingAttemptKey } from './bookings-v_ucn93l.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-CNvzyF5T.js';
2
+ export { B as BookingDetailsFailure, a as BookingDetailsInput, b as BookingDetailsOptions, c as BookingDetailsOutcome, d as BookingDetailsStatus, e as BookingDropOff, f as BookingFormSubmit, g as BookingInput, h as BookingMode, i as BookingOutcome, j as BookingSimulation, k as BookingSubmitOptions, F as FormSubmitField, S as SalesBookingsClient, n as newBookingAttemptKey } from './bookings-C1HMPjQl.js';
3
3
  import 'zod/mini';
4
4
  import 'libphonenumber-js';
5
5
  import './form-submit-CX-CxJjQ.js';
package/dist/sales.js CHANGED
@@ -294,6 +294,10 @@ function nationalDigits(phone) {
294
294
  return (parsed.isValid ? parsed.national : phone).replace(/\D/g, "");
295
295
  }
296
296
 
297
+ // ../tracking-core/src/lead-forms/lead-forms.gen.ts
298
+ var z = __toESM(require("zod/mini"));
299
+ var LEAD_FORM_REGISTRY_VERSION = 2;
300
+
297
301
  // ../tracking-core/src/uuid.ts
298
302
  function uuidV4() {
299
303
  const cryptoApi = globalThis.crypto;
@@ -479,39 +483,54 @@ function outcomeOf(body) {
479
483
  if (body.status === "pending") return { status: "pending", id: body.id, mode };
480
484
  return { status: "failed", id: body.id, fallbackUrl: body.fallback_url, mode };
481
485
  }
482
- function formSubmitPayload(input, formSubmit, labels) {
483
- const vehicle = input.vehicle ? `${input.vehicle.year} ${input.vehicle.make} ${input.vehicle.model}` : "";
484
- const field = (name, type, label, value) => ({
485
- name,
486
- type,
487
- label,
488
- value
489
- });
490
- const fields = [
491
- field("first_name", "text", "First name", input.firstName),
492
- field("last_name", "text", "Last name", input.lastName),
486
+ var DROP_OFF_KEYS = {
487
+ waitForIt: "wait-for-it",
488
+ dropOff: "drop-off"
489
+ };
490
+ function formSubmitPayload(input, formSubmit, contractHash) {
491
+ const field = (role, name, type, label, value) => ({ name, type, label, value, role });
492
+ const text = (value) => value?.trim() || void 0;
493
+ const { vehicle, dropOff } = input;
494
+ const entries = [
495
+ field("given_name", "first_name", "text", "First name", text(input.firstName)),
496
+ field("family_name", "last_name", "text", "Last name", text(input.lastName)),
493
497
  // E.164 on the wire: it keys the customer and enhanced-conversion matching.
494
- field("phone", "tel", "Phone", toE164(input.phone) ?? input.phone),
495
- field("email", "email", "Email", input.email ?? ""),
498
+ field("phone", "phone", "tel", "Phone", toE164(input.phone) ?? input.phone),
499
+ field("email", "email", "email", "Email", text(input.email)),
500
+ field("service", "service", "select", "Service", input.services),
496
501
  field(
497
- "service",
498
- "select",
499
- "Service",
500
- input.services.map((key) => labels.get(key) ?? key).join(", ")
502
+ "vehicle",
503
+ "vehicle",
504
+ "text",
505
+ "Vehicle",
506
+ vehicle ? `${vehicle.year} ${vehicle.make} ${vehicle.model}` : void 0
501
507
  ),
502
- field("vehicle", "text", "Vehicle", vehicle),
503
508
  field(
504
- "start",
505
- "text",
506
- "Requested time",
507
- `${input.startDate} ${String(input.startHour).padStart(2, "0")}:00`
509
+ "drop_off",
510
+ "drop_off",
511
+ "select",
512
+ "Drop-off",
513
+ dropOff ? DROP_OFF_KEYS[dropOff] : void 0
508
514
  ),
509
- field("note", "textarea", "Notes", input.notes ?? "")
515
+ field("preferred_date", "preferred_date", "date", "Date", input.startDate),
516
+ field("preferred_time", "preferred_time", "time", "Time", {
517
+ start: `${String(input.startHour).padStart(2, "0")}:00`,
518
+ end: null
519
+ }),
520
+ field("note", "note", "textarea", "Notes", text(input.notes))
510
521
  ];
511
- const reported = new Set(fields.map((item) => item.name));
522
+ const reported = new Set(entries.map((item) => item.name));
523
+ const fields = entries.filter((item) => item.value !== void 0);
512
524
  const extra = (formSubmit.extraFields ?? []).filter((item) => !reported.has(item.name));
513
525
  return {
514
- form: { id: formSubmit.formId, action: "/tracking/bookings", fields: [...fields, ...extra] },
526
+ form: {
527
+ id: formSubmit.formId,
528
+ action: "/tracking/bookings",
529
+ fields: [...fields, ...extra],
530
+ kind: "booking",
531
+ contract_version: LEAD_FORM_REGISTRY_VERSION,
532
+ ...contractHash ? { contract_hash: contractHash } : {}
533
+ },
515
534
  page: { path: typeof window === "undefined" ? "/" : window.location.pathname }
516
535
  };
517
536
  }
@@ -609,8 +628,11 @@ function createSalesBookingsClient(config, firing) {
609
628
  }
610
629
  if (formSubmit && !submittedForms.has(attemptKey)) {
611
630
  submittedForms.add(attemptKey);
612
- const labels = new Map(booking.options.map((option) => [option.key, option.label]));
613
- formSubmit.tracking.trackEvent("form_submit", formSubmitPayload(input, formSubmit, labels));
631
+ const contract = runtime?.leadForms()?.contracts.find((c) => c.form_kind === "booking");
632
+ formSubmit.tracking.trackEvent(
633
+ "form_submit",
634
+ formSubmitPayload(input, formSubmit, contract?.contract_hash ?? null)
635
+ );
614
636
  }
615
637
  const body = {
616
638
  idempotency_key: attemptKey,
@@ -860,17 +882,17 @@ function createSalesClient(config) {
860
882
  }
861
883
 
862
884
  // ../tracking-core/src/resources/sales/schema.ts
863
- var z2 = __toESM(require("zod/mini"));
885
+ var z3 = __toESM(require("zod/mini"));
864
886
 
865
887
  // ../tracking-core/src/resources/sales/generated/zod.gen.ts
866
- var z = __toESM(require("zod/mini"));
867
- var zAutoLeapSaleFacts = z.object({
868
- first_order: z.boolean(),
869
- fleet_customer: z.boolean(),
870
- invoice_code: z.string(),
871
- invoice_id: z.string()
888
+ var z2 = __toESM(require("zod/mini"));
889
+ var zAutoLeapSaleFacts = z2.object({
890
+ first_order: z2.boolean(),
891
+ fleet_customer: z2.boolean(),
892
+ invoice_code: z2.string(),
893
+ invoice_id: z2.string()
872
894
  });
873
- var zErrorCode = z.enum([
895
+ var zErrorCode = z2.enum([
874
896
  "missing_credentials",
875
897
  "invalid_api_key",
876
898
  "not_authenticated",
@@ -914,37 +936,37 @@ var zErrorCode = z.enum([
914
936
  "rate_limited",
915
937
  "internal_error"
916
938
  ]);
917
- var zSaleItemEntitySchema = z.object({
918
- category: z.nullable(z.string()),
919
- external_item_id: z.nullable(z.string()),
920
- id: z.uuid(),
921
- name: z.nullable(z.string()),
922
- quantity: z.string().check(z.regex(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)),
923
- unit_cost_cents: z.nullable(z.int()),
924
- unit_price_cents: z.int()
939
+ var zSaleItemEntitySchema = z2.object({
940
+ category: z2.nullable(z2.string()),
941
+ external_item_id: z2.nullable(z2.string()),
942
+ id: z2.uuid(),
943
+ name: z2.nullable(z2.string()),
944
+ quantity: z2.string().check(z2.regex(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)),
945
+ unit_cost_cents: z2.nullable(z2.int()),
946
+ unit_price_cents: z2.int()
925
947
  });
926
- var zSaleItemInputSchema = z.strictObject({
927
- category: z.nullish(z.string()),
928
- external_item_id: z.nullish(z.string()),
929
- name: z.nullish(z.string()),
930
- quantity: z.string().check(z.regex(/^\d+(\.\d{1,3})?$/)),
931
- unit_cost_cents: z.nullish(z.int().check(z.gte(0))),
932
- unit_price_cents: z.int().check(z.gte(0))
948
+ var zSaleItemInputSchema = z2.strictObject({
949
+ category: z2.nullish(z2.string()),
950
+ external_item_id: z2.nullish(z2.string()),
951
+ name: z2.nullish(z2.string()),
952
+ quantity: z2.string().check(z2.regex(/^\d+(\.\d{1,3})?$/)),
953
+ unit_cost_cents: z2.nullish(z2.int().check(z2.gte(0))),
954
+ unit_price_cents: z2.int().check(z2.gte(0))
933
955
  });
934
- var zSaleServiceEntitySchema = z.object({
935
- amount_cents: z.int(),
936
- id: z.uuid(),
937
- mapped: z.nullable(z.boolean()),
938
- service_id: z.uuid(),
939
- service_key: z.string(),
940
- service_label: z.string()
956
+ var zSaleServiceEntitySchema = z2.object({
957
+ amount_cents: z2.int(),
958
+ id: z2.uuid(),
959
+ mapped: z2.nullable(z2.boolean()),
960
+ service_id: z2.uuid(),
961
+ service_key: z2.string(),
962
+ service_label: z2.string()
941
963
  });
942
- var zSaleServiceInputSchema = z.strictObject({
943
- amount_cents: z.int().check(z.gte(0)),
944
- service: z.string()
964
+ var zSaleServiceInputSchema = z2.strictObject({
965
+ amount_cents: z2.int().check(z2.gte(0)),
966
+ service: z2.string()
945
967
  });
946
- var zSaleSource = z.enum(["api", "admin", "autoleap"]);
947
- var zSmsAutomationState = z.enum([
968
+ var zSaleSource = z2.enum(["api", "admin", "autoleap"]);
969
+ var zSmsAutomationState = z2.enum([
948
970
  "needs_check",
949
971
  "failed",
950
972
  "undelivered",
@@ -956,7 +978,7 @@ var zSmsAutomationState = z.enum([
956
978
  "eligible",
957
979
  "not_applicable"
958
980
  ]);
959
- var zSmsWithheldReason = z.enum([
981
+ var zSmsWithheldReason = z2.enum([
960
982
  "automation_disabled",
961
983
  "sms_disabled",
962
984
  "no_phone",
@@ -984,75 +1006,75 @@ var zSmsWithheldReason = z.enum([
984
1006
  "invalid_phone",
985
1007
  "recently_texted"
986
1008
  ]);
987
- var zSaleSmsStatusSchema = z.object({
988
- can_send_now: z._default(z.boolean(), false),
989
- last_message_at: z.nullable(z.iso.datetime({ offset: true })),
990
- reason_detail: z.nullable(z.string()),
1009
+ var zSaleSmsStatusSchema = z2.object({
1010
+ can_send_now: z2._default(z2.boolean(), false),
1011
+ last_message_at: z2.nullable(z2.iso.datetime({ offset: true })),
1012
+ reason_detail: z2.nullable(z2.string()),
991
1013
  state: zSmsAutomationState,
992
- suppressed_by_other_sale: z._default(z.boolean(), false),
993
- withheld_reason: z.nullable(zSmsWithheldReason)
1014
+ suppressed_by_other_sale: z2._default(z2.boolean(), false),
1015
+ withheld_reason: z2.nullable(zSmsWithheldReason)
994
1016
  });
995
- var zSupportedCurrency = z.enum(["USD", "CAD"]);
996
- var zTrackingEnvironment = z.enum(["production", "development"]);
997
- var zSaleCreateSchema = z.strictObject({
998
- amount_total_cents: z.nullish(z.int().check(z.gte(0))),
1017
+ var zSupportedCurrency = z2.enum(["USD", "CAD"]);
1018
+ var zTrackingEnvironment = z2.enum(["production", "development"]);
1019
+ var zSaleCreateSchema = z2.strictObject({
1020
+ amount_total_cents: z2.nullish(z2.int().check(z2.gte(0))),
999
1021
  currency: zSupportedCurrency,
1000
- customer_email: z.nullish(z.email().check(z.maxLength(320))),
1001
- customer_name: z.nullish(z.string().check(z.maxLength(200))),
1002
- customer_phone: z.nullish(z.string().check(z.maxLength(64))),
1003
- description: z.nullish(z.string()),
1004
- environment: z._default(z.optional(zTrackingEnvironment), "production"),
1005
- external_id: z.nullish(z.string()),
1006
- items: z.optional(z.array(zSaleItemInputSchema)),
1007
- metadata: z.nullish(z.record(z.string(), z.unknown())),
1008
- occurred_at: z.iso.datetime({ offset: true }),
1009
- service: z.nullish(z.string()),
1010
- services: z.nullish(z.array(zSaleServiceInputSchema)),
1011
- sms_consent: z.nullish(z.boolean())
1022
+ customer_email: z2.nullish(z2.email().check(z2.maxLength(320))),
1023
+ customer_name: z2.nullish(z2.string().check(z2.maxLength(200))),
1024
+ customer_phone: z2.nullish(z2.string().check(z2.maxLength(64))),
1025
+ description: z2.nullish(z2.string()),
1026
+ environment: z2._default(z2.optional(zTrackingEnvironment), "production"),
1027
+ external_id: z2.nullish(z2.string()),
1028
+ items: z2.optional(z2.array(zSaleItemInputSchema)),
1029
+ metadata: z2.nullish(z2.record(z2.string(), z2.unknown())),
1030
+ occurred_at: z2.iso.datetime({ offset: true }),
1031
+ service: z2.nullish(z2.string()),
1032
+ services: z2.nullish(z2.array(zSaleServiceInputSchema)),
1033
+ sms_consent: z2.nullish(z2.boolean())
1012
1034
  });
1013
- var zValidationError = z.object({
1014
- ctx: z.optional(z.record(z.string(), z.unknown())),
1015
- input: z.optional(z.unknown()),
1016
- loc: z.array(z.union([z.string(), z.int()])),
1017
- msg: z.string(),
1018
- type: z.string()
1035
+ var zValidationError = z2.object({
1036
+ ctx: z2.optional(z2.record(z2.string(), z2.unknown())),
1037
+ input: z2.optional(z2.unknown()),
1038
+ loc: z2.array(z2.union([z2.string(), z2.int()])),
1039
+ msg: z2.string(),
1040
+ type: z2.string()
1019
1041
  });
1020
- var zHttpValidationError = z.object({
1021
- detail: z.optional(z.array(zValidationError))
1042
+ var zHttpValidationError = z2.object({
1043
+ detail: z2.optional(z2.array(zValidationError))
1022
1044
  });
1023
- var zValidationErrorItem = z.object({
1024
- loc: z.array(z.union([z.string(), z.int()])),
1025
- msg: z.string(),
1026
- type: z.string()
1045
+ var zValidationErrorItem = z2.object({
1046
+ loc: z2.array(z2.union([z2.string(), z2.int()])),
1047
+ msg: z2.string(),
1048
+ type: z2.string()
1027
1049
  });
1028
- var zApiErrorSchema = z.object({
1050
+ var zApiErrorSchema = z2.object({
1029
1051
  code: zErrorCode,
1030
- context: z._default(z.nullish(z.record(z.string(), z.unknown())), null),
1031
- detail: z.string(),
1032
- errors: z._default(z.nullish(z.array(zValidationErrorItem)), null),
1033
- request_id: z._default(z.nullish(z.string()), null)
1052
+ context: z2._default(z2.nullish(z2.record(z2.string(), z2.unknown())), null),
1053
+ detail: z2.string(),
1054
+ errors: z2._default(z2.nullish(z2.array(zValidationErrorItem)), null),
1055
+ request_id: z2._default(z2.nullish(z2.string()), null)
1034
1056
  });
1035
- var zWritebackEmailSource = z.enum(["NONE", "SALE", "CUSTOMER", "HARVESTED"]);
1036
- var zWritebackEnrichmentStatus = z.enum(["NONE", "MATCHED", "AMBIGUOUS"]);
1037
- var zWritebackSaleUploadCounts = z.object({
1038
- failed: z._default(z.int(), 0),
1039
- pending: z._default(z.int(), 0),
1040
- skipped: z._default(z.int(), 0),
1041
- submitted: z._default(z.int(), 0),
1042
- total: z._default(z.int(), 0),
1043
- uploaded: z._default(z.int(), 0)
1057
+ var zWritebackEmailSource = z2.enum(["NONE", "SALE", "CUSTOMER", "HARVESTED"]);
1058
+ var zWritebackEnrichmentStatus = z2.enum(["NONE", "MATCHED", "AMBIGUOUS"]);
1059
+ var zWritebackSaleUploadCounts = z2.object({
1060
+ failed: z2._default(z2.int(), 0),
1061
+ pending: z2._default(z2.int(), 0),
1062
+ skipped: z2._default(z2.int(), 0),
1063
+ submitted: z2._default(z2.int(), 0),
1064
+ total: z2._default(z2.int(), 0),
1065
+ uploaded: z2._default(z2.int(), 0)
1044
1066
  });
1045
- var zSaleWritebackStatusSchema = z.object({
1046
- blocked_reason: z.nullable(z.string()),
1047
- can_dispatch: z._default(z.boolean(), false),
1048
- email_source: z.nullable(zWritebackEmailSource),
1049
- enrichment_status: z.nullable(zWritebackEnrichmentStatus),
1050
- gclid_attached: z._default(z.boolean(), false),
1051
- identifiers_sent: z.nullable(z.string()),
1052
- mapped_service_ids: z.array(z.uuid()),
1053
- matched_submit_count: z.nullable(z.int()),
1054
- needs_force: z._default(z.boolean(), false),
1055
- rollup: z.enum([
1067
+ var zSaleWritebackStatusSchema = z2.object({
1068
+ blocked_reason: z2.nullable(z2.string()),
1069
+ can_dispatch: z2._default(z2.boolean(), false),
1070
+ email_source: z2.nullable(zWritebackEmailSource),
1071
+ enrichment_status: z2.nullable(zWritebackEnrichmentStatus),
1072
+ gclid_attached: z2._default(z2.boolean(), false),
1073
+ identifiers_sent: z2.nullable(z2.string()),
1074
+ mapped_service_ids: z2.array(z2.uuid()),
1075
+ matched_submit_count: z2.nullable(z2.int()),
1076
+ needs_force: z2._default(z2.boolean(), false),
1077
+ rollup: z2.enum([
1056
1078
  "failed",
1057
1079
  "skipped",
1058
1080
  "pending",
@@ -1062,39 +1084,39 @@ var zSaleWritebackStatusSchema = z.object({
1062
1084
  "out_of_window",
1063
1085
  "blocked"
1064
1086
  ]),
1065
- stale: z._default(z.boolean(), false),
1066
- uncovered_service_ids: z.array(z.uuid()),
1087
+ stale: z2._default(z2.boolean(), false),
1088
+ uncovered_service_ids: z2.array(z2.uuid()),
1067
1089
  uploads: zWritebackSaleUploadCounts
1068
1090
  });
1069
- var zSaleEntitySchema = z.object({
1070
- amount_total_cents: z.int(),
1071
- business_id: z.uuid(),
1072
- business_name: z.nullable(z.string()),
1073
- created_at: z.iso.datetime({ offset: true }),
1074
- currency: z.string(),
1075
- customer_email: z.nullable(z.string()),
1076
- customer_name: z.nullable(z.string()),
1077
- customer_name_placeholder_confirmed: z._default(z.boolean(), false),
1078
- customer_name_placeholder_confirmed_at: z.nullable(z.iso.datetime({ offset: true })),
1079
- customer_phone: z.nullable(z.string()),
1080
- description: z.nullable(z.string()),
1091
+ var zSaleEntitySchema = z2.object({
1092
+ amount_total_cents: z2.int(),
1093
+ business_id: z2.uuid(),
1094
+ business_name: z2.nullable(z2.string()),
1095
+ created_at: z2.iso.datetime({ offset: true }),
1096
+ currency: z2.string(),
1097
+ customer_email: z2.nullable(z2.string()),
1098
+ customer_name: z2.nullable(z2.string()),
1099
+ customer_name_placeholder_confirmed: z2._default(z2.boolean(), false),
1100
+ customer_name_placeholder_confirmed_at: z2.nullable(z2.iso.datetime({ offset: true })),
1101
+ customer_phone: z2.nullable(z2.string()),
1102
+ description: z2.nullable(z2.string()),
1081
1103
  environment: zTrackingEnvironment,
1082
- external_id: z.nullable(z.string()),
1083
- id: z.uuid(),
1084
- items: z.array(zSaleItemEntitySchema),
1085
- metadata: z.nullable(z.record(z.string(), z.unknown())),
1086
- occurred_at: z.iso.datetime({ offset: true }),
1087
- service_id: z.nullable(z.uuid()),
1088
- service_key: z.nullable(z.string()),
1089
- service_label: z.nullable(z.string()),
1090
- services: z.array(zSaleServiceEntitySchema),
1091
- sms_automation: z.nullable(zSaleSmsStatusSchema),
1092
- sms_consent: z._default(z.boolean(), false),
1093
- sms_consent_granted_at: z.nullable(z.iso.datetime({ offset: true })),
1104
+ external_id: z2.nullable(z2.string()),
1105
+ id: z2.uuid(),
1106
+ items: z2.array(zSaleItemEntitySchema),
1107
+ metadata: z2.nullable(z2.record(z2.string(), z2.unknown())),
1108
+ occurred_at: z2.iso.datetime({ offset: true }),
1109
+ service_id: z2.nullable(z2.uuid()),
1110
+ service_key: z2.nullable(z2.string()),
1111
+ service_label: z2.nullable(z2.string()),
1112
+ services: z2.array(zSaleServiceEntitySchema),
1113
+ sms_automation: z2.nullable(zSaleSmsStatusSchema),
1114
+ sms_consent: z2._default(z2.boolean(), false),
1115
+ sms_consent_granted_at: z2.nullable(z2.iso.datetime({ offset: true })),
1094
1116
  source: zSaleSource,
1095
- source_facts: z.nullable(zAutoLeapSaleFacts),
1096
- updated_at: z.iso.datetime({ offset: true }),
1097
- writeback: z.nullable(zSaleWritebackStatusSchema)
1117
+ source_facts: z2.nullable(zAutoLeapSaleFacts),
1118
+ updated_at: z2.iso.datetime({ offset: true }),
1119
+ writeback: z2.nullable(zSaleWritebackStatusSchema)
1098
1120
  });
1099
1121
 
1100
1122
  // ../tracking-core/src/resources/sales/schema.ts
@@ -1103,11 +1125,11 @@ var saleServiceSchema = zSaleServiceInputSchema;
1103
1125
  var currencySchema = zSupportedCurrency;
1104
1126
  var SUPPORTED_CURRENCIES = currencySchema.options;
1105
1127
  var SALE_SOURCES = zSaleSource.options;
1106
- var centsSchema = z2.int().check(z2.gte(0));
1107
- var metadataSchema = z2.record(z2.string(), z2.unknown());
1108
- var customerNameSchema = z2.string().check(z2.maxLength(200));
1109
- var customerPhoneSchema = z2.string().check(z2.maxLength(64));
1110
- var customerEmailSchema = z2.email().check(z2.maxLength(320));
1128
+ var centsSchema = z3.int().check(z3.gte(0));
1129
+ var metadataSchema = z3.record(z3.string(), z3.unknown());
1130
+ var customerNameSchema = z3.string().check(z3.maxLength(200));
1131
+ var customerPhoneSchema = z3.string().check(z3.maxLength(64));
1132
+ var customerEmailSchema = z3.email().check(z3.maxLength(320));
1111
1133
  function addIssue(ctx, path, message) {
1112
1134
  ctx.issues.push({ code: "custom", input: ctx.value, path, message });
1113
1135
  }
@@ -1141,24 +1163,24 @@ function refineServiceXor(val, ctx, { requireAmount }) {
1141
1163
  );
1142
1164
  }
1143
1165
  }
1144
- var saleCreateSchema = z2.extend(zSaleCreateSchema, { items: z2._default(z2.array(saleItemSchema), []) }).check((ctx) => refineServiceXor(ctx.value, ctx, { requireAmount: true }));
1145
- var saleUpdateSchema = z2.strictObject({
1146
- description: z2.nullish(z2.string()),
1147
- service: z2.nullish(z2.string()),
1148
- services: z2.nullish(z2.array(saleServiceSchema)),
1149
- currency: z2.optional(currencySchema),
1150
- amount_total_cents: z2.optional(centsSchema),
1151
- occurred_at: z2.optional(z2.iso.datetime()),
1152
- items: z2.optional(z2.array(saleItemSchema)),
1153
- metadata: z2.nullish(metadataSchema),
1154
- customer_name: z2.nullish(customerNameSchema),
1166
+ var saleCreateSchema = z3.extend(zSaleCreateSchema, { items: z3._default(z3.array(saleItemSchema), []) }).check((ctx) => refineServiceXor(ctx.value, ctx, { requireAmount: true }));
1167
+ var saleUpdateSchema = z3.strictObject({
1168
+ description: z3.nullish(z3.string()),
1169
+ service: z3.nullish(z3.string()),
1170
+ services: z3.nullish(z3.array(saleServiceSchema)),
1171
+ currency: z3.optional(currencySchema),
1172
+ amount_total_cents: z3.optional(centsSchema),
1173
+ occurred_at: z3.optional(z3.iso.datetime()),
1174
+ items: z3.optional(z3.array(saleItemSchema)),
1175
+ metadata: z3.nullish(metadataSchema),
1176
+ customer_name: z3.nullish(customerNameSchema),
1155
1177
  // Re-attest when changing a filler-looking name; the server clears the
1156
1178
  // prior attestation whenever `customer_name` changes.
1157
- customer_name_placeholder_confirmed: z2.optional(z2.boolean()),
1158
- customer_phone: z2.nullish(customerPhoneSchema),
1159
- customer_email: z2.nullish(customerEmailSchema),
1179
+ customer_name_placeholder_confirmed: z3.optional(z3.boolean()),
1180
+ customer_phone: z3.nullish(customerPhoneSchema),
1181
+ customer_email: z3.nullish(customerEmailSchema),
1160
1182
  // NOT NULL server-side: omit to leave unchanged (explicit null is rejected).
1161
- sms_consent: z2.optional(z2.boolean())
1183
+ sms_consent: z3.optional(z3.boolean())
1162
1184
  }).check((ctx) => refineServiceXor(ctx.value, ctx, { requireAmount: false }));
1163
1185
  var TRACKING_RANGES = ["24h", "7d", "30d"];
1164
1186
  var NAMED_RANGES = [