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