@aranova/tracking-next 0.27.0 → 1.0.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 (71) hide show
  1. package/dist/blog-server.d.mts +2 -1
  2. package/dist/blog-server.d.ts +2 -1
  3. package/dist/blog-server.js +121 -98
  4. package/dist/blog-server.js.map +1 -1
  5. package/dist/blog-server.mjs +86 -63
  6. package/dist/blog-server.mjs.map +1 -1
  7. package/dist/blog.d.mts +651 -1755
  8. package/dist/blog.d.ts +651 -1755
  9. package/dist/blog.js +121 -98
  10. package/dist/blog.js.map +1 -1
  11. package/dist/blog.mjs +86 -63
  12. package/dist/blog.mjs.map +1 -1
  13. package/dist/calendar-server.d.mts +2 -2
  14. package/dist/calendar-server.d.ts +2 -2
  15. package/dist/calendar-server.js +0 -26
  16. package/dist/calendar-server.js.map +1 -1
  17. package/dist/calendar-server.mjs +0 -26
  18. package/dist/calendar-server.mjs.map +1 -1
  19. package/dist/calendar.d.mts +3 -3
  20. package/dist/calendar.d.ts +3 -3
  21. package/dist/calendar.js +227 -126
  22. package/dist/calendar.js.map +1 -1
  23. package/dist/calendar.mjs +216 -125
  24. package/dist/calendar.mjs.map +1 -1
  25. package/dist/client.d.mts +4 -3
  26. package/dist/client.d.ts +4 -3
  27. package/dist/client.js +185 -277
  28. package/dist/client.js.map +1 -1
  29. package/dist/client.mjs +157 -249
  30. package/dist/client.mjs.map +1 -1
  31. package/dist/index.d.mts +8 -7
  32. package/dist/index.d.ts +8 -7
  33. package/dist/index.js +482 -484
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +471 -484
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/ingest-typed-BdKmlouW.d.ts +791 -0
  38. package/dist/ingest-typed-Bo7WPmpU.d.mts +791 -0
  39. package/dist/middleware.js +0 -467
  40. package/dist/middleware.js.map +1 -1
  41. package/dist/middleware.mjs +0 -467
  42. package/dist/middleware.mjs.map +1 -1
  43. package/dist/{phone-utils-BVzSNBf1.d.mts → phone-utils-CubQif9Z.d.mts} +18 -78
  44. package/dist/{phone-utils-BVzSNBf1.d.ts → phone-utils-CubQif9Z.d.ts} +18 -78
  45. package/dist/phone.d.mts +2 -2
  46. package/dist/phone.d.ts +2 -2
  47. package/dist/phone.js +0 -464
  48. package/dist/phone.js.map +1 -1
  49. package/dist/phone.mjs +0 -464
  50. package/dist/phone.mjs.map +1 -1
  51. package/dist/{sales-DQGzXSgL.d.mts → sales-D7KstKA-.d.mts} +89 -328
  52. package/dist/{sales-IGC2tq4J.d.ts → sales-DG150g3o.d.ts} +89 -328
  53. package/dist/sales.d.mts +2 -2
  54. package/dist/sales.d.ts +2 -2
  55. package/dist/sales.js +265 -127
  56. package/dist/sales.js.map +1 -1
  57. package/dist/sales.mjs +254 -127
  58. package/dist/sales.mjs.map +1 -1
  59. package/dist/server.d.mts +2 -2
  60. package/dist/server.d.ts +2 -2
  61. package/dist/server.js +0 -467
  62. package/dist/server.js.map +1 -1
  63. package/dist/server.mjs +0 -467
  64. package/dist/server.mjs.map +1 -1
  65. package/dist/transport-CDmGOiCq.d.ts +253 -0
  66. package/dist/transport-I_cMSFQ6.d.mts +253 -0
  67. package/package.json +2 -2
  68. package/dist/ingest-typed-BxLFlZ7N.d.mts +0 -1371
  69. package/dist/ingest-typed-ByQVRMvP.d.ts +0 -1371
  70. package/dist/transport-C-_rFSR4.d.ts +0 -721
  71. package/dist/transport-yUF5Wize.d.mts +0 -721
package/dist/phone.js CHANGED
@@ -69,470 +69,6 @@ function formatPhoneAsTyped(raw, country) {
69
69
  return new import_libphonenumber_js.AsYouType(country ?? DEFAULT_PHONE_COUNTRY).input(raw ?? "");
70
70
  }
71
71
 
72
- // ../tracking-core/src/resources/tracking-config-runtime.ts
73
- var RETRY_MAX_MS = 5 * 6e4;
74
-
75
- // ../tracking-core/src/session.ts
76
- var SESSION_IDLE_MS = 30 * 60 * 1e3;
77
-
78
- // ../tracking-core/src/events/page-view.ts
79
- var import_zod = require("zod");
80
- var pageViewMetadataSchema = import_zod.z.object({
81
- page: import_zod.z.object({
82
- title: import_zod.z.string().nullable(),
83
- path: import_zod.z.string(),
84
- search: import_zod.z.string(),
85
- hash: import_zod.z.string()
86
- }).strict(),
87
- referrer: import_zod.z.string().nullable(),
88
- // `.nullable().optional()` — absent (undefined) OR explicit null OR a
89
- // real viewport object. Mirrors Pydantic's `_Viewport | None = None`
90
- // on the backend side so the drift test stays clean.
91
- viewport: import_zod.z.object({
92
- w: import_zod.z.number(),
93
- h: import_zod.z.number()
94
- }).strict().nullable().optional()
95
- }).strict();
96
- var pageViewConfigSchema = import_zod.z.object({}).strict();
97
-
98
- // ../tracking-core/src/events/cta-click.ts
99
- var import_zod2 = require("zod");
100
- var ctaClickMetadataSchema = import_zod2.z.object({
101
- cta_name: import_zod2.z.string(),
102
- page: import_zod2.z.object({
103
- path: import_zod2.z.string()
104
- }).strict(),
105
- section: import_zod2.z.string().nullable().optional(),
106
- destination_url: import_zod2.z.string().nullable().optional(),
107
- // Set by auto-capture (and available to manual callers): the link target
108
- // and a short element descriptor (tag#id) for tying clicks to specific UI.
109
- href: import_zod2.z.string().nullable().optional(),
110
- element: import_zod2.z.string().nullable().optional()
111
- }).strict();
112
- var ctaClickConfigSchema = import_zod2.z.object({
113
- autoCapture: import_zod2.z.object({
114
- selector: import_zod2.z.string().optional()
115
- }).strict().optional()
116
- }).strict();
117
-
118
- // ../tracking-core/src/events/sdk-heartbeat.ts
119
- var import_zod3 = require("zod");
120
- var sdkHeartbeatTriggersSchema = import_zod3.z.object({
121
- automatic: import_zod3.z.array(import_zod3.z.string()),
122
- manual: import_zod3.z.array(import_zod3.z.string())
123
- }).strict();
124
- var sdkHeartbeatMetadataSchema = import_zod3.z.object({
125
- sdk_version: import_zod3.z.string(),
126
- package_name: import_zod3.z.string().nullable(),
127
- surface: import_zod3.z.enum(["next", "react", "script"]),
128
- triggers: sdkHeartbeatTriggersSchema,
129
- trigger_config: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown())).nullable().optional(),
130
- configured_gtag_ids: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()).nullable().optional(),
131
- // Site whose config object the SDK resolves; null on a legacy business ref.
132
- config_site_id: import_zod3.z.string().uuid().nullable().optional()
133
- }).strict();
134
- var sdkHeartbeatConfigSchema = import_zod3.z.object({}).strict();
135
-
136
- // ../tracking-core/src/events/form-start.ts
137
- var import_zod4 = require("zod");
138
- var formStartMetadataSchema = import_zod4.z.object({
139
- form: import_zod4.z.object({
140
- id: import_zod4.z.string(),
141
- action: import_zod4.z.string().nullable()
142
- }).strict(),
143
- page: import_zod4.z.object({
144
- path: import_zod4.z.string()
145
- }).strict()
146
- }).strict();
147
- var formStartConfigSchema = import_zod4.z.object({
148
- selector: import_zod4.z.string().optional()
149
- }).strict();
150
-
151
- // ../tracking-core/src/events/form-submit.ts
152
- var import_zod5 = require("zod");
153
- var jsonValueSchema = import_zod5.z.lazy(
154
- () => import_zod5.z.union([
155
- import_zod5.z.string(),
156
- import_zod5.z.number().finite(),
157
- import_zod5.z.boolean(),
158
- import_zod5.z.null(),
159
- import_zod5.z.array(jsonValueSchema),
160
- import_zod5.z.record(jsonValueSchema)
161
- ])
162
- );
163
- var formSubmitMetadataSchema = import_zod5.z.object({
164
- form: import_zod5.z.object({
165
- id: import_zod5.z.string(),
166
- action: import_zod5.z.string().nullable(),
167
- fields: import_zod5.z.array(
168
- import_zod5.z.object({
169
- name: import_zod5.z.string(),
170
- type: import_zod5.z.string(),
171
- label: import_zod5.z.string().nullable(),
172
- value: jsonValueSchema
173
- }).strict()
174
- ).optional()
175
- }).strict(),
176
- page: import_zod5.z.object({
177
- path: import_zod5.z.string()
178
- }).strict()
179
- }).strict();
180
- var formSubmitConfigSchema = import_zod5.z.object({}).strict();
181
-
182
- // ../tracking-core/src/events/multi-page-session.ts
183
- var import_zod6 = require("zod");
184
- var multiPageSessionMetadataSchema = import_zod6.z.object({
185
- page_count: import_zod6.z.number().int().min(2),
186
- page: import_zod6.z.object({
187
- path: import_zod6.z.string()
188
- }).strict()
189
- }).strict();
190
- var multiPageSessionConfigSchema = import_zod6.z.object({
191
- pageThreshold: import_zod6.z.number().int().min(2)
192
- }).strict();
193
-
194
- // ../tracking-core/src/events/page-exit.ts
195
- var import_zod7 = require("zod");
196
- var pageExitMetadataSchema = import_zod7.z.object({
197
- dwell_ms: import_zod7.z.number().int().min(0),
198
- // null = left without any scroll signal; floor is 0 so a valid 0% is never
199
- // rejected (a single bad field 422s the whole keepalive beacon batch).
200
- max_scroll_percent: import_zod7.z.number().int().min(0).max(100).nullable(),
201
- // The gating baseline: the fraction of the page visible at load with
202
- // zero scrolling — or, for pages that grew after the post-paint snapshot
203
- // (skeleton/streaming renders), the first-scroll position that
204
- // established it. null = page had no scrollable range, or the segment
205
- // ended before the snapshot. `.optional()` is load-bearing: SDK builds
206
- // predating this field keep POSTing page_exit without the key —
207
- // requiring it would 422 whole keepalive beacon batches.
208
- scroll_baseline_percent: import_zod7.z.number().int().min(0).max(100).nullable().optional(),
209
- page: import_zod7.z.object({
210
- path: import_zod7.z.string()
211
- }).strict()
212
- }).strict();
213
- var pageExitConfigSchema = import_zod7.z.object({}).strict();
214
-
215
- // ../tracking-core/src/events/phone-click.ts
216
- var import_zod8 = require("zod");
217
- var phoneClickMetadataSchema = import_zod8.z.object({
218
- phone_number: import_zod8.z.string(),
219
- page: import_zod8.z.object({
220
- path: import_zod8.z.string()
221
- }).strict(),
222
- section: import_zod8.z.string().nullable().optional()
223
- }).strict();
224
- var phoneClickConfigSchema = import_zod8.z.object({
225
- autoCapture: import_zod8.z.object({
226
- selector: import_zod8.z.string().optional()
227
- }).strict().optional()
228
- }).strict();
229
-
230
- // ../tracking-core/src/events/scroll-depth.ts
231
- var import_zod9 = require("zod");
232
- var scrollDepthMetadataSchema = import_zod9.z.object({
233
- depth_percent: import_zod9.z.number().int().min(1).max(100),
234
- page: import_zod9.z.object({
235
- path: import_zod9.z.string()
236
- }).strict()
237
- }).strict();
238
- var scrollDepthConfigSchema = import_zod9.z.object({
239
- thresholds: import_zod9.z.array(import_zod9.z.number().int().min(1).max(100)).min(1)
240
- }).strict();
241
-
242
- // ../tracking-core/src/events/specific-page-visit.ts
243
- var import_zod10 = require("zod");
244
- var PAGE_IDENTITY_MAX_LENGTH = 64;
245
- var PAGE_IDENTITY_PATTERN = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/;
246
- var pageIdentitySchema = import_zod10.z.string().max(PAGE_IDENTITY_MAX_LENGTH).regex(PAGE_IDENTITY_PATTERN, {
247
- message: "page identity must be lowercase snake_case, start with a letter, and contain at most 64 characters"
248
- });
249
- var specificPageNameSchema = pageIdentitySchema;
250
- var specificPageVisitMetadataSchema = import_zod10.z.object({
251
- page_name: specificPageNameSchema,
252
- page: import_zod10.z.object({
253
- path: import_zod10.z.string()
254
- }).strict()
255
- }).strict();
256
- var specificPageVisitConfigSchema = import_zod10.z.object({
257
- pages: import_zod10.z.array(
258
- import_zod10.z.object({
259
- name: specificPageNameSchema,
260
- pathPattern: import_zod10.z.custom((value) => value instanceof RegExp, {
261
- message: "pathPattern must be a RegExp"
262
- })
263
- }).strict()
264
- ).min(1)
265
- }).strict();
266
-
267
- // ../tracking-core/src/events/time-on-site.ts
268
- var import_zod11 = require("zod");
269
- var timeOnSiteMetadataSchema = import_zod11.z.object({
270
- duration_ms: import_zod11.z.number().int().nonnegative(),
271
- page: import_zod11.z.object({
272
- path: import_zod11.z.string()
273
- }).strict()
274
- }).strict();
275
- var timeOnSiteConfigSchema = import_zod11.z.object({
276
- thresholdSeconds: import_zod11.z.number().int().positive()
277
- }).strict();
278
-
279
- // ../tracking-core/src/events/semantics.ts
280
- var EVENT_SEMANTICS = {
281
- page_view: {
282
- label: "Page view",
283
- category: "page",
284
- outcomeRole: "navigation",
285
- clientVisibility: "simple"
286
- },
287
- time_on_site: {
288
- label: "Time on site",
289
- category: "engagement",
290
- outcomeRole: "engagement",
291
- clientVisibility: "detailed"
292
- },
293
- specific_page_visit: {
294
- label: "Key page visit",
295
- category: "engagement",
296
- outcomeRole: "engagement",
297
- clientVisibility: "detailed"
298
- },
299
- scroll_depth: {
300
- label: "Scroll depth",
301
- category: "engagement",
302
- outcomeRole: "engagement",
303
- clientVisibility: "detailed"
304
- },
305
- multi_page_session: {
306
- label: "Multi-page session",
307
- category: "engagement",
308
- outcomeRole: "engagement",
309
- clientVisibility: "detailed"
310
- },
311
- form_start: {
312
- label: "Form started",
313
- category: "engagement",
314
- outcomeRole: "engagement",
315
- clientVisibility: "simple"
316
- },
317
- sdk_heartbeat: {
318
- label: "SDK heartbeat",
319
- category: "system",
320
- outcomeRole: "diagnostic",
321
- clientVisibility: "hidden"
322
- },
323
- page_exit: {
324
- label: "Page exit",
325
- category: "engagement",
326
- outcomeRole: "diagnostic",
327
- clientVisibility: "detailed"
328
- },
329
- form_submit: {
330
- label: "Form submitted",
331
- category: "lead",
332
- outcomeRole: "lead",
333
- clientVisibility: "simple"
334
- },
335
- phone_click: {
336
- label: "Phone click",
337
- category: "lead",
338
- outcomeRole: "lead",
339
- clientVisibility: "simple"
340
- },
341
- cta_click: {
342
- label: "CTA click",
343
- category: "engagement",
344
- outcomeRole: "engagement",
345
- clientVisibility: "simple"
346
- }
347
- };
348
-
349
- // ../tracking-core/src/events/registry.ts
350
- var EVENT_REGISTRY = {
351
- // --- automatic triggers ---
352
- page_view: {
353
- kind: "automatic",
354
- semantics: EVENT_SEMANTICS.page_view,
355
- metadataSchema: pageViewMetadataSchema,
356
- configSchema: pageViewConfigSchema
357
- },
358
- time_on_site: {
359
- kind: "automatic",
360
- semantics: EVENT_SEMANTICS.time_on_site,
361
- metadataSchema: timeOnSiteMetadataSchema,
362
- configSchema: timeOnSiteConfigSchema
363
- },
364
- specific_page_visit: {
365
- kind: "automatic",
366
- semantics: EVENT_SEMANTICS.specific_page_visit,
367
- metadataSchema: specificPageVisitMetadataSchema,
368
- configSchema: specificPageVisitConfigSchema
369
- },
370
- scroll_depth: {
371
- kind: "automatic",
372
- semantics: EVENT_SEMANTICS.scroll_depth,
373
- metadataSchema: scrollDepthMetadataSchema,
374
- configSchema: scrollDepthConfigSchema
375
- },
376
- multi_page_session: {
377
- kind: "automatic",
378
- semantics: EVENT_SEMANTICS.multi_page_session,
379
- metadataSchema: multiPageSessionMetadataSchema,
380
- configSchema: multiPageSessionConfigSchema
381
- },
382
- form_start: {
383
- kind: "automatic",
384
- semantics: EVENT_SEMANTICS.form_start,
385
- metadataSchema: formStartMetadataSchema,
386
- configSchema: formStartConfigSchema
387
- },
388
- // --- SDK-internal automatic (not consumer-configurable) ---
389
- sdk_heartbeat: {
390
- kind: "automatic",
391
- semantics: EVENT_SEMANTICS.sdk_heartbeat,
392
- metadataSchema: sdkHeartbeatMetadataSchema,
393
- configSchema: sdkHeartbeatConfigSchema
394
- },
395
- page_exit: {
396
- kind: "automatic",
397
- semantics: EVENT_SEMANTICS.page_exit,
398
- metadataSchema: pageExitMetadataSchema,
399
- configSchema: pageExitConfigSchema
400
- },
401
- // --- manual triggers ---
402
- form_submit: {
403
- kind: "manual",
404
- semantics: EVENT_SEMANTICS.form_submit,
405
- metadataSchema: formSubmitMetadataSchema,
406
- configSchema: formSubmitConfigSchema
407
- },
408
- phone_click: {
409
- kind: "manual",
410
- semantics: EVENT_SEMANTICS.phone_click,
411
- metadataSchema: phoneClickMetadataSchema,
412
- configSchema: phoneClickConfigSchema
413
- },
414
- cta_click: {
415
- kind: "manual",
416
- semantics: EVENT_SEMANTICS.cta_click,
417
- metadataSchema: ctaClickMetadataSchema,
418
- configSchema: ctaClickConfigSchema
419
- }
420
- };
421
- var ALL_AUTOMATIC_EVENT_NAMES = Object.entries(EVENT_REGISTRY).filter(([, def]) => def.kind === "automatic").map(([name]) => name);
422
- var ALL_MANUAL_EVENT_NAMES = Object.entries(EVENT_REGISTRY).filter(([, def]) => def.kind === "manual").map(([name]) => name);
423
- var ALL_LEAD_EVENT_NAMES = Object.entries(EVENT_REGISTRY).filter(([, def]) => def.semantics.outcomeRole === "lead").map(([name]) => name);
424
-
425
- // ../tracking-core/src/resources/sales/schema.ts
426
- var import_zod12 = require("zod");
427
- var SUPPORTED_CURRENCIES = ["USD", "CAD"];
428
- var TRACKING_ENVIRONMENTS = ["production", "development"];
429
- var currencySchema = import_zod12.z.enum(SUPPORTED_CURRENCIES);
430
- var centsSchema = import_zod12.z.number().int().nonnegative();
431
- var quantitySchema = import_zod12.z.string().regex(/^\d+(\.\d{1,3})?$/);
432
- var metadataSchema = import_zod12.z.record(import_zod12.z.unknown());
433
- var saleItemSchema = import_zod12.z.object({
434
- external_item_id: import_zod12.z.string().nullable().optional(),
435
- name: import_zod12.z.string().nullable().optional(),
436
- category: import_zod12.z.string().nullable().optional(),
437
- quantity: quantitySchema,
438
- unit_price_cents: centsSchema,
439
- // Non-negativity validated on the wire — same contract as the other cents
440
- // fields — and backstopped by the DB CHECK.
441
- unit_cost_cents: centsSchema.nullable().optional()
442
- }).strict();
443
- var saleServiceSchema = import_zod12.z.object({
444
- service: import_zod12.z.string(),
445
- amount_cents: centsSchema
446
- }).strict();
447
- var customerNameSchema = import_zod12.z.string().max(200);
448
- var customerPhoneSchema = import_zod12.z.string().max(64);
449
- var customerEmailSchema = import_zod12.z.string().max(320).email();
450
- function refineServiceXor(val, ctx, { requireAmount }) {
451
- if (val.services != null) {
452
- if (val.service != null) {
453
- ctx.addIssue({
454
- code: import_zod12.z.ZodIssueCode.custom,
455
- message: "pass either `service` or `services`, not both",
456
- path: ["services"]
457
- });
458
- }
459
- if (val.services.length === 0) {
460
- ctx.addIssue({
461
- code: import_zod12.z.ZodIssueCode.custom,
462
- message: "`services` must not be empty",
463
- path: ["services"]
464
- });
465
- }
466
- const keys = val.services.map((s) => s.service);
467
- if (new Set(keys).size !== keys.length) {
468
- ctx.addIssue({
469
- code: import_zod12.z.ZodIssueCode.custom,
470
- message: "`services` must not list the same service more than once",
471
- path: ["services"]
472
- });
473
- }
474
- if (val.amount_total_cents != null) {
475
- const sum = val.services.reduce((acc, s) => acc + s.amount_cents, 0);
476
- if (val.amount_total_cents !== sum) {
477
- ctx.addIssue({
478
- code: import_zod12.z.ZodIssueCode.custom,
479
- message: "amount_total_cents must equal the sum of the services amounts (omit it to derive it automatically)",
480
- path: ["amount_total_cents"]
481
- });
482
- }
483
- }
484
- } else if (requireAmount && val.amount_total_cents == null) {
485
- ctx.addIssue({
486
- code: import_zod12.z.ZodIssueCode.custom,
487
- message: "amount_total_cents is required unless `services` is provided",
488
- path: ["amount_total_cents"]
489
- });
490
- }
491
- }
492
- var saleCreateSchema = import_zod12.z.object({
493
- external_id: import_zod12.z.string().nullable().optional(),
494
- description: import_zod12.z.string().nullable().optional(),
495
- service: import_zod12.z.string().nullable().optional(),
496
- services: import_zod12.z.array(saleServiceSchema).nullable().optional(),
497
- currency: currencySchema,
498
- // Optional only because the plural `services` form derives it from the sum
499
- // (see refineServiceXor); the singular/serviceless path still requires it.
500
- amount_total_cents: centsSchema.nullable().optional(),
501
- occurred_at: import_zod12.z.string().datetime(),
502
- environment: import_zod12.z.enum(TRACKING_ENVIRONMENTS).default("production"),
503
- items: import_zod12.z.array(saleItemSchema).default([]),
504
- metadata: metadataSchema.nullable().optional(),
505
- customer_name: customerNameSchema.nullable().optional(),
506
- customer_phone: customerPhoneSchema.nullable().optional(),
507
- customer_email: customerEmailSchema.nullable().optional(),
508
- // CASL consent attestation: the customer agreed to receive SMS. Recorded
509
- // with a timestamp server-side; every SMS send path gates on it.
510
- //
511
- // Tri-state: omit it (or send null) to let the server apply the business's
512
- // configured default-opt-in policy, honouring a returning customer's
513
- // remembered preference. Send an explicit boolean to assert consent state
514
- // yourself — `false` records a deliberate opt-out.
515
- sms_consent: import_zod12.z.boolean().nullable().optional()
516
- }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: true }));
517
- var saleUpdateSchema = import_zod12.z.object({
518
- description: import_zod12.z.string().nullable().optional(),
519
- service: import_zod12.z.string().nullable().optional(),
520
- services: import_zod12.z.array(saleServiceSchema).nullable().optional(),
521
- currency: currencySchema.optional(),
522
- amount_total_cents: centsSchema.optional(),
523
- occurred_at: import_zod12.z.string().datetime().optional(),
524
- items: import_zod12.z.array(saleItemSchema).optional(),
525
- metadata: metadataSchema.nullable().optional(),
526
- customer_name: customerNameSchema.nullable().optional(),
527
- // Re-attest when changing a filler-looking name; the server clears the
528
- // prior attestation whenever `customer_name` changes.
529
- customer_name_placeholder_confirmed: import_zod12.z.boolean().optional(),
530
- customer_phone: customerPhoneSchema.nullable().optional(),
531
- customer_email: customerEmailSchema.nullable().optional(),
532
- // NOT NULL server-side: omit to leave unchanged (explicit null is rejected).
533
- sms_consent: import_zod12.z.boolean().optional()
534
- }).strict().superRefine((val, ctx) => refineServiceXor(val, ctx, { requireAmount: false }));
535
-
536
72
  // ../tracking-core/src/phone-field.ts
537
73
  function phoneField(name, raw, country) {
538
74
  return { name, type: "phone", value: toE164(raw, country) };