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