@aranova/tracking-next 0.27.0 → 1.1.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 +11 -4
  26. package/dist/client.d.ts +11 -4
  27. package/dist/client.js +611 -347
  28. package/dist/client.js.map +1 -1
  29. package/dist/client.mjs +611 -347
  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 +550 -487
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +539 -487
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/ingest-typed-MBuMe9Pn.d.ts +883 -0
  38. package/dist/ingest-typed-UA13xTfI.d.mts +883 -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-C0ds6cqZ.d.mts} +24 -78
  44. package/dist/{phone-utils-BVzSNBf1.d.ts → phone-utils-C0ds6cqZ.d.ts} +24 -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-IGC2tq4J.d.ts → sales-DQC815f3.d.ts} +90 -329
  52. package/dist/{sales-DQGzXSgL.d.mts → sales-w1reW_Y3.d.mts} +90 -329
  53. package/dist/sales.d.mts +3 -3
  54. package/dist/sales.d.ts +3 -3
  55. package/dist/sales.js +270 -127
  56. package/dist/sales.js.map +1 -1
  57. package/dist/sales.mjs +259 -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/{tracking-config-runtime-D7prdTE1.d.mts → tracking-config-runtime-C6H7ofmo.d.mts} +6 -0
  66. package/dist/{tracking-config-runtime-D7prdTE1.d.ts → tracking-config-runtime-C6H7ofmo.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-BxLFlZ7N.d.mts +0 -1371
  71. package/dist/ingest-typed-ByQVRMvP.d.ts +0 -1371
  72. package/dist/transport-C-_rFSR4.d.ts +0 -721
  73. package/dist/transport-yUF5Wize.d.mts +0 -721
@@ -1,8 +1,8 @@
1
1
  import { A as AranovaApiError } from './date-BHetnL7s.js';
2
2
  export { f as formatDateInTz } from './date-BHetnL7s.js';
3
- import { r as CalendarSummary, m as BusyResponse, C as CalendarTransportConfig, q as CalendarErrorCode, d as BusyInterval } from './transport-C-_rFSR4.js';
4
- export { e as BOOKING_SOURCES, f as BOOKING_STATUSES, a as Booking, g as BookingAttendee, c as BookingCancelInput, B as BookingCreateInput, h as BookingCustomer, i as BookingLocation, j as BookingMetadata, k as BookingReminders, b as BookingRescheduleInput, l as BookingStatus, n as CALENDAR_ERROR_CODES, o as CALENDAR_METADATA_SCHEMA_VERSION, p as CALENDAR_SYNC_STATUSES, s as CalendarSyncStatus, G as GOOGLE_SYNC_STATES, t as GoogleSyncState, J as JsonScalar, M as MAX_ATTENDEES, u as MAX_BOOKING_MINUTES, v as MAX_REMINDER_MINUTES, w as MAX_REMINDER_OVERRIDES, x as bookingAttendeeSchema, y as bookingCancelSchema, z as bookingCreateSchema, A as bookingCustomerSchema, D as bookingLocationNullableSchema, E as bookingLocationSchema, F as bookingMetadataSchema, H as bookingReminderSchema, I as bookingRemindersSchema, K as bookingRescheduleSchema } from './transport-C-_rFSR4.js';
5
- import 'zod';
3
+ import { r as CalendarSummary, m as BusyResponse, C as CalendarTransportConfig, q as CalendarErrorCode, d as BusyInterval } from './transport-CDmGOiCq.js';
4
+ export { e as BOOKING_SOURCES, f as BOOKING_STATUSES, a as Booking, g as BookingAttendee, c as BookingCancelInput, B as BookingCreateInput, h as BookingCustomer, i as BookingLocation, j as BookingMetadata, k as BookingReminders, b as BookingRescheduleInput, l as BookingStatus, n as CALENDAR_ERROR_CODES, o as CALENDAR_METADATA_SCHEMA_VERSION, p as CALENDAR_SYNC_STATUSES, s as CalendarSyncStatus, G as GOOGLE_SYNC_STATES, t as GoogleSyncState, J as JsonScalar, M as MAX_ATTENDEES, u as MAX_BOOKING_MINUTES, v as MAX_REMINDER_MINUTES, w as MAX_REMINDER_OVERRIDES, x as bookingAttendeeSchema, y as bookingCancelSchema, z as bookingCreateSchema, A as bookingCustomerSchema, D as bookingLocationNullableSchema, E as bookingLocationSchema, F as bookingMetadataSchema, H as bookingReminderSchema, I as bookingRemindersSchema, K as bookingRescheduleSchema } from './transport-CDmGOiCq.js';
5
+ import 'zod/mini';
6
6
  import './request-Doq36Rt0.js';
7
7
 
8
8
  /**
package/dist/calendar.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/calendar.ts
@@ -74,32 +84,6 @@ var AranovaApiError = class extends Error {
74
84
  }
75
85
  };
76
86
 
77
- // ../tracking-core/src/phone.ts
78
- var import_libphonenumber_js = require("libphonenumber-js");
79
-
80
- // ../tracking-core/src/events/page-view.ts
81
- var import_zod = require("zod");
82
- var pageViewMetadataSchema = import_zod.z.object({
83
- page: import_zod.z.object({
84
- title: import_zod.z.string().nullable(),
85
- path: import_zod.z.string(),
86
- search: import_zod.z.string(),
87
- hash: import_zod.z.string()
88
- }).strict(),
89
- referrer: import_zod.z.string().nullable(),
90
- // `.nullable().optional()` — absent (undefined) OR explicit null OR a
91
- // real viewport object. Mirrors Pydantic's `_Viewport | None = None`
92
- // on the backend side so the drift test stays clean.
93
- viewport: import_zod.z.object({
94
- w: import_zod.z.number(),
95
- h: import_zod.z.number()
96
- }).strict().nullable().optional()
97
- }).strict();
98
- var pageViewConfigSchema = import_zod.z.object({}).strict();
99
-
100
- // ../tracking-core/src/session.ts
101
- var SESSION_IDLE_MS = 30 * 60 * 1e3;
102
-
103
87
  // ../tracking-core/src/ingest.ts
104
88
  var API_KEY_HEADER = "X-Aranova-Api-Key";
105
89
  var SDK_VERSION_HEADER = "X-Aranova-Sdk-Version";
@@ -133,9 +117,9 @@ async function apiRequest(config, method, path, body, extraHeaders) {
133
117
  try {
134
118
  const parsed = await response.json();
135
119
  if (parsed && typeof parsed === "object") {
136
- const record = parsed;
137
- if (typeof record.detail === "string") detail = record.detail;
138
- if (typeof record.code === "string") code = record.code;
120
+ const record3 = parsed;
121
+ if (typeof record3.detail === "string") detail = record3.detail;
122
+ if (typeof record3.code === "string") code = record3.code;
139
123
  }
140
124
  } catch {
141
125
  }
@@ -155,9 +139,9 @@ async function calendarRequest(config, method, path, body) {
155
139
  }
156
140
 
157
141
  // ../tracking-core/src/resources/intl/date.ts
158
- function formatDateInTz(iso, timeZone, opts, locale) {
159
- const date = new Date(iso);
160
- if (Number.isNaN(date.getTime())) return iso;
142
+ function formatDateInTz(iso2, timeZone, opts, locale) {
143
+ const date = new Date(iso2);
144
+ if (Number.isNaN(date.getTime())) return iso2;
161
145
  return new Intl.DateTimeFormat(locale, {
162
146
  year: "numeric",
163
147
  month: "short",
@@ -206,8 +190,8 @@ function instantFromWallClock(timeZone, year, month, day, hour = 0, minute = 0)
206
190
  const corrected = naive - offsetMinutesAt(firstGuess, timeZone) * 6e4;
207
191
  return new Date(corrected);
208
192
  }
209
- function localDateKey(iso, timeZone) {
210
- const p = partsInTz(new Date(iso), timeZone);
193
+ function localDateKey(iso2, timeZone) {
194
+ const p = partsInTz(new Date(iso2), timeZone);
211
195
  const pad = (n) => String(n).padStart(2, "0");
212
196
  return `${p.year}-${pad(p.month)}-${pad(p.day)}`;
213
197
  }
@@ -262,7 +246,167 @@ function isCalendarError(error, code) {
262
246
  }
263
247
 
264
248
  // ../tracking-core/src/resources/calendar/schema.ts
265
- var import_zod2 = require("zod");
249
+ var z2 = __toESM(require("zod/mini"));
250
+
251
+ // ../tracking-core/src/resources/calendar/generated/zod.gen.ts
252
+ var z = __toESM(require("zod/mini"));
253
+ var zBookingAttendee = z.strictObject({
254
+ display_name: z.nullish(z.string().check(z.maxLength(200))),
255
+ email: z.email().check(z.maxLength(320)),
256
+ optional: z._default(z.optional(z.boolean()), false)
257
+ });
258
+ var zBookingCancelSchema = z.strictObject({
259
+ notify_attendees: z._default(z.optional(z.boolean()), true),
260
+ reason: z.nullish(z.string().check(z.maxLength(500)))
261
+ });
262
+ var zBookingCustomerInput = z.strictObject({
263
+ email: z.email().check(z.maxLength(320)),
264
+ name: z.nullish(z.string().check(z.maxLength(200))),
265
+ phone: z.nullish(z.string().check(z.maxLength(64))),
266
+ sms_consent: z._default(z.optional(z.boolean()), false)
267
+ });
268
+ var zBookingCustomerOutput = z.strictObject({
269
+ email: z.email().check(z.maxLength(320)),
270
+ name: z.nullable(z.string().check(z.maxLength(200))),
271
+ phone: z.nullable(z.string().check(z.maxLength(64))),
272
+ sms_consent: z._default(z.boolean(), false)
273
+ });
274
+ var zBookingRescheduleSchema = z.strictObject({
275
+ duration_minutes: z.nullish(z.int().check(z.gt(0), z.lte(1440))),
276
+ end_at: z.nullish(z.iso.datetime({ offset: true })),
277
+ notify_attendees: z._default(z.optional(z.boolean()), true),
278
+ reason: z.nullish(z.string().check(z.maxLength(500))),
279
+ start_at: z.iso.datetime({ offset: true }),
280
+ time_zone: z.string().check(z.minLength(1), z.maxLength(64), z.regex(/^[A-Za-z0-9_+\-\/]+$/))
281
+ });
282
+ var zBookingResponse = z.strictObject({
283
+ appointment_type: z.nullable(z.string()),
284
+ calendar_key: z.string(),
285
+ customer: zBookingCustomerOutput,
286
+ end_at: z.iso.datetime({ offset: true }),
287
+ google_html_link: z.nullable(z.string()),
288
+ google_sync_state: z.string(),
289
+ id: z.string(),
290
+ manage_token: z.nullable(z.string()),
291
+ meet_url: z.nullable(z.string()),
292
+ start_at: z.iso.datetime({ offset: true }),
293
+ status: z.string(),
294
+ time_zone: z.string(),
295
+ title: z.string()
296
+ });
297
+ var zBookingSource = z.enum(["website", "phone", "walk_in", "import", "operator"]);
298
+ var zBookingMetadata = z.strictObject({
299
+ custom: z.nullish(
300
+ z.record(z.string(), z.nullable(z.union([z.string(), z.int(), z.number(), z.boolean()])))
301
+ ),
302
+ fbclid: z.nullish(z.string().check(z.maxLength(256))),
303
+ gclid: z.nullish(z.string().check(z.maxLength(256))),
304
+ landing_page: z.nullish(z.string().check(z.maxLength(2048))),
305
+ notes: z.nullish(z.string().check(z.maxLength(2e3))),
306
+ referrer: z.nullish(z.string().check(z.maxLength(2048))),
307
+ schema_version: z._default(z.optional(z.int()), 1),
308
+ service: z.nullish(z.string().check(z.maxLength(64))),
309
+ session_id: z.nullish(z.string().check(z.maxLength(64))),
310
+ source: z.nullish(zBookingSource),
311
+ utm_campaign: z.nullish(z.string().check(z.maxLength(128))),
312
+ utm_content: z.nullish(z.string().check(z.maxLength(128))),
313
+ utm_medium: z.nullish(z.string().check(z.maxLength(128))),
314
+ utm_source: z.nullish(z.string().check(z.maxLength(128))),
315
+ utm_term: z.nullish(z.string().check(z.maxLength(128))),
316
+ visitor_id: z.nullish(z.string().check(z.maxLength(64)))
317
+ });
318
+ var zCustomLocation = z.strictObject({
319
+ kind: z.literal("custom"),
320
+ text: z.string().check(z.maxLength(1024))
321
+ });
322
+ var zErrorCode = z.enum([
323
+ "missing_credentials",
324
+ "invalid_api_key",
325
+ "not_authenticated",
326
+ "wrong_key_type",
327
+ "origin_missing",
328
+ "origin_not_allowed",
329
+ "capability_denied",
330
+ "session_required",
331
+ "operator_only",
332
+ "cross_tenant",
333
+ "business_id_required",
334
+ "bad_request",
335
+ "not_found",
336
+ "conflict",
337
+ "incompatible_payload",
338
+ "repeat_confirmation_required",
339
+ "idempotency_conflict",
340
+ "validation_error",
341
+ "unknown_service",
342
+ "invalid_sale_properties",
343
+ "invalid_cursor",
344
+ "rate_limited",
345
+ "internal_error"
346
+ ]);
347
+ var zMeetLocation = z.strictObject({
348
+ kind: z.literal("google_meet")
349
+ });
350
+ var zPhoneLocation = z.strictObject({
351
+ kind: z.literal("phone"),
352
+ phone: z.string().check(z.maxLength(64))
353
+ });
354
+ var zPhysicalLocation = z.strictObject({
355
+ address: z.string().check(z.maxLength(1024)),
356
+ kind: z.literal("physical")
357
+ });
358
+ var zReminderMethod = z.enum(["email", "popup"]);
359
+ var zBookingReminder = z.strictObject({
360
+ method: zReminderMethod,
361
+ minutes_before: z.int().check(z.gte(0), z.lte(40320))
362
+ });
363
+ var zBookingReminders = z.strictObject({
364
+ overrides: z.optional(z.array(zBookingReminder).check(z.maxLength(5))),
365
+ use_calendar_defaults: z._default(z.optional(z.boolean()), true)
366
+ });
367
+ var zBookingCreateSchema = z.strictObject({
368
+ appointment_type: z.nullish(z.string().check(z.maxLength(64))),
369
+ attendees: z.optional(z.array(zBookingAttendee).check(z.maxLength(20))),
370
+ buffer_after_minutes: z._default(z.optional(z.int().check(z.gte(0), z.lte(1440))), 0),
371
+ buffer_before_minutes: z._default(z.optional(z.int().check(z.gte(0), z.lte(1440))), 0),
372
+ calendar_key: z.string().check(z.minLength(1), z.maxLength(64)),
373
+ customer: zBookingCustomerInput,
374
+ description: z.nullish(z.string().check(z.maxLength(8e3))),
375
+ duration_minutes: z.nullish(z.int().check(z.gt(0), z.lte(1440))),
376
+ end_at: z.nullish(z.iso.datetime({ offset: true })),
377
+ idempotency_key: z.nullish(z.string().check(z.maxLength(128))),
378
+ location: z.nullish(z.union([zMeetLocation, zPhysicalLocation, zPhoneLocation, zCustomLocation])),
379
+ metadata: z.nullish(zBookingMetadata),
380
+ reminders: z.nullish(zBookingReminders),
381
+ send_invites: z._default(z.optional(z.boolean()), true),
382
+ start_at: z.iso.datetime({ offset: true }),
383
+ time_zone: z.string().check(z.minLength(1), z.maxLength(64), z.regex(/^[A-Za-z0-9_+\-\/]+$/)),
384
+ title: z.nullish(z.string().check(z.maxLength(300)))
385
+ });
386
+ var zValidationError = z.object({
387
+ ctx: z.optional(z.record(z.string(), z.unknown())),
388
+ input: z.optional(z.unknown()),
389
+ loc: z.array(z.union([z.string(), z.int()])),
390
+ msg: z.string(),
391
+ type: z.string()
392
+ });
393
+ var zHttpValidationError = z.object({
394
+ detail: z.optional(z.array(zValidationError))
395
+ });
396
+ var zValidationErrorItem = z.object({
397
+ loc: z.array(z.union([z.string(), z.int()])),
398
+ msg: z.string(),
399
+ type: z.string()
400
+ });
401
+ var zApiErrorSchema = z.object({
402
+ code: zErrorCode,
403
+ context: z._default(z.nullish(z.record(z.string(), z.unknown())), null),
404
+ detail: z.string(),
405
+ errors: z._default(z.nullish(z.array(zValidationErrorItem)), null),
406
+ request_id: z._default(z.nullish(z.string()), null)
407
+ });
408
+
409
+ // ../tracking-core/src/resources/calendar/schema.ts
266
410
  var CALENDAR_METADATA_SCHEMA_VERSION = 1;
267
411
  var MAX_ATTENDEES = 20;
268
412
  var MAX_REMINDER_OVERRIDES = 5;
@@ -288,7 +432,6 @@ var CALENDAR_ERROR_CODES = [
288
432
  "rate_limited",
289
433
  "google_error"
290
434
  ];
291
- var isoInstant = import_zod2.z.string().datetime({ offset: true });
292
435
  function isKnownTimeZone(timeZone) {
293
436
  try {
294
437
  new Intl.DateTimeFormat(void 0, { timeZone });
@@ -297,107 +440,65 @@ function isKnownTimeZone(timeZone) {
297
440
  return false;
298
441
  }
299
442
  }
300
- var ianaTz = import_zod2.z.string().min(1).max(64).regex(/^[A-Za-z0-9_+\-/]+$/).refine(isKnownTimeZone, { message: "unknown IANA time zone" });
301
- var bookingAttendeeSchema = import_zod2.z.object({
302
- email: import_zod2.z.string().max(320).email(),
303
- display_name: import_zod2.z.string().max(200).nullable().optional(),
304
- optional: import_zod2.z.boolean().default(false)
305
- }).strict();
306
- var bookingReminderSchema = import_zod2.z.object({
307
- method: import_zod2.z.enum(["email", "popup"]),
308
- minutes_before: import_zod2.z.number().int().min(0).max(MAX_REMINDER_MINUTES)
309
- }).strict();
310
- var bookingRemindersSchema = import_zod2.z.object({
311
- use_calendar_defaults: import_zod2.z.boolean().default(true),
312
- overrides: import_zod2.z.array(bookingReminderSchema).max(MAX_REMINDER_OVERRIDES).default([])
313
- }).strict();
314
- var bookingLocationSchema = import_zod2.z.union([
315
- import_zod2.z.object({ kind: import_zod2.z.literal("google_meet") }).strict(),
316
- import_zod2.z.object({ kind: import_zod2.z.literal("physical"), address: import_zod2.z.string().max(1024) }).strict(),
317
- import_zod2.z.object({ kind: import_zod2.z.literal("phone"), phone: import_zod2.z.string().max(64) }).strict(),
318
- import_zod2.z.object({ kind: import_zod2.z.literal("custom"), text: import_zod2.z.string().max(1024) }).strict()
443
+ var ianaTz = z2.string().check(
444
+ z2.minLength(1),
445
+ z2.maxLength(64),
446
+ z2.regex(/^[A-Za-z0-9_+\-/]+$/),
447
+ z2.refine(isKnownTimeZone, { error: "unknown IANA time zone" })
448
+ );
449
+ var bookingAttendeeSchema = zBookingAttendee;
450
+ var bookingReminderSchema = zBookingReminder;
451
+ var bookingCustomerSchema = zBookingCustomerInput;
452
+ var bookingMetadataSchema = z2.extend(zBookingMetadata, {
453
+ custom: z2.nullish(
454
+ z2.record(z2.string(), z2.union([z2.string(), z2.int(), z2.number(), z2.boolean(), z2.null()]))
455
+ )
456
+ });
457
+ var bookingLocationSchema = z2.union([
458
+ zMeetLocation,
459
+ zPhysicalLocation,
460
+ zPhoneLocation,
461
+ zCustomLocation
319
462
  ]);
320
- var bookingLocationNullableSchema = import_zod2.z.union([...bookingLocationSchema.options, import_zod2.z.null()]);
321
- var bookingCustomerSchema = import_zod2.z.object({
322
- // Required: Google needs an address to send the invite that confirms the
323
- // booking, and that invite is the whole confirmation mechanism.
324
- email: import_zod2.z.string().max(320).email(),
325
- name: import_zod2.z.string().max(200).nullable().optional(),
326
- phone: import_zod2.z.string().max(64).nullable().optional(),
327
- sms_consent: import_zod2.z.boolean().default(false)
328
- }).strict();
329
- var jsonScalar = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number(), import_zod2.z.boolean(), import_zod2.z.null()]);
330
- var bookingMetadataSchema = import_zod2.z.object({
331
- schema_version: import_zod2.z.number().int().default(CALENDAR_METADATA_SCHEMA_VERSION),
332
- source: import_zod2.z.enum(BOOKING_SOURCES).nullable().optional(),
333
- service: import_zod2.z.string().max(64).nullable().optional(),
334
- visitor_id: import_zod2.z.string().max(64).nullable().optional(),
335
- session_id: import_zod2.z.string().max(64).nullable().optional(),
336
- gclid: import_zod2.z.string().max(256).nullable().optional(),
337
- fbclid: import_zod2.z.string().max(256).nullable().optional(),
338
- utm_source: import_zod2.z.string().max(128).nullable().optional(),
339
- utm_medium: import_zod2.z.string().max(128).nullable().optional(),
340
- utm_campaign: import_zod2.z.string().max(128).nullable().optional(),
341
- utm_term: import_zod2.z.string().max(128).nullable().optional(),
342
- utm_content: import_zod2.z.string().max(128).nullable().optional(),
343
- landing_page: import_zod2.z.string().max(2048).nullable().optional(),
344
- referrer: import_zod2.z.string().max(2048).nullable().optional(),
345
- notes: import_zod2.z.string().max(2e3).nullable().optional(),
346
- custom: import_zod2.z.record(jsonScalar).nullable().optional()
347
- }).strict();
463
+ var bookingLocationNullableSchema = z2.union([
464
+ ...bookingLocationSchema.def.options,
465
+ z2.null()
466
+ ]);
467
+ function addIssue(ctx, path, message) {
468
+ ctx.issues.push({ code: "custom", input: ctx.value, path, message });
469
+ }
348
470
  function refineEndXor(value, ctx) {
349
471
  const hasEnd = value.end_at !== void 0 && value.end_at !== null;
350
472
  const hasDuration = value.duration_minutes !== void 0 && value.duration_minutes !== null;
351
473
  if (hasEnd === hasDuration) {
352
- ctx.addIssue({
353
- code: import_zod2.z.ZodIssueCode.custom,
354
- message: "provide exactly one of end_at or duration_minutes",
355
- path: ["end_at"]
356
- });
474
+ addIssue(ctx, ["end_at"], "provide exactly one of end_at or duration_minutes");
357
475
  return;
358
476
  }
359
477
  if (hasEnd && new Date(value.end_at) <= new Date(value.start_at)) {
360
- ctx.addIssue({
361
- code: import_zod2.z.ZodIssueCode.custom,
362
- message: "end_at must be after start_at",
363
- path: ["end_at"]
364
- });
478
+ addIssue(ctx, ["end_at"], "end_at must be after start_at");
365
479
  }
366
480
  }
367
- var bookingCreateSchema = import_zod2.z.object({
368
- calendar_key: import_zod2.z.string().min(1).max(64),
369
- // Free-form: appointment types are the client site's own vocabulary, not
370
- // configuration the dashboard holds.
371
- appointment_type: import_zod2.z.string().max(64).nullable().optional(),
372
- start_at: isoInstant,
373
- end_at: isoInstant.nullable().optional(),
374
- duration_minutes: import_zod2.z.number().int().positive().max(MAX_BOOKING_MINUTES).nullable().optional(),
375
- /** The booker's zone — distinct from the business's and the calendar's. */
376
- time_zone: ianaTz,
377
- title: import_zod2.z.string().max(300).nullable().optional(),
378
- description: import_zod2.z.string().max(8e3).nullable().optional(),
379
- location: bookingLocationNullableSchema.optional(),
380
- customer: bookingCustomerSchema,
381
- attendees: import_zod2.z.array(bookingAttendeeSchema).max(MAX_ATTENDEES).default([]),
382
- send_invites: import_zod2.z.boolean().default(true),
383
- reminders: bookingRemindersSchema.nullable().optional(),
384
- metadata: bookingMetadataSchema.nullable().optional(),
385
- idempotency_key: import_zod2.z.string().max(128).nullable().optional(),
386
- buffer_before_minutes: import_zod2.z.number().int().min(0).max(MAX_BOOKING_MINUTES).default(0),
387
- buffer_after_minutes: import_zod2.z.number().int().min(0).max(MAX_BOOKING_MINUTES).default(0)
388
- }).strict().superRefine(refineEndXor);
389
- var bookingRescheduleSchema = import_zod2.z.object({
390
- start_at: isoInstant,
391
- end_at: isoInstant.nullable().optional(),
392
- duration_minutes: import_zod2.z.number().int().positive().max(MAX_BOOKING_MINUTES).nullable().optional(),
481
+ var bookingRemindersSchema = z2.extend(zBookingReminders, {
482
+ overrides: z2._default(
483
+ z2.array(bookingReminderSchema).check(z2.maxLength(MAX_REMINDER_OVERRIDES)),
484
+ []
485
+ )
486
+ });
487
+ var bookingCreateSchema = z2.extend(zBookingCreateSchema, {
393
488
  time_zone: ianaTz,
394
- notify_attendees: import_zod2.z.boolean().default(true),
395
- reason: import_zod2.z.string().max(500).nullable().optional()
396
- }).strict().superRefine(refineEndXor);
397
- var bookingCancelSchema = import_zod2.z.object({
398
- reason: import_zod2.z.string().max(500).nullable().optional(),
399
- notify_attendees: import_zod2.z.boolean().default(true)
400
- }).strict();
489
+ // The generated field is `z.union([...variants]).nullish()`, which nests one
490
+ // `anyOf` inside another; Pydantic's `BookingLocation | None` flattens to a
491
+ // single list and the drift snapshot compares structure. Override with the
492
+ // flattened union.
493
+ location: z2.optional(bookingLocationNullableSchema),
494
+ attendees: z2._default(z2.array(bookingAttendeeSchema).check(z2.maxLength(MAX_ATTENDEES)), []),
495
+ // These reference the un-composed generated schemas; generation can't nest
496
+ // our compositions into its own output.
497
+ reminders: z2.nullish(bookingRemindersSchema),
498
+ metadata: z2.nullish(bookingMetadataSchema)
499
+ }).check((ctx) => refineEndXor(ctx.value, ctx));
500
+ var bookingRescheduleSchema = z2.extend(zBookingRescheduleSchema, { time_zone: ianaTz }).check((ctx) => refineEndXor(ctx.value, ctx));
501
+ var bookingCancelSchema = zBookingCancelSchema;
401
502
 
402
503
  // ../tracking-core/src/resources/calendar/slots.ts
403
504
  function parseHhMm(value) {