@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.
- package/dist/blog-server.d.mts +2 -1
- package/dist/blog-server.d.ts +2 -1
- package/dist/blog-server.js +121 -98
- package/dist/blog-server.js.map +1 -1
- package/dist/blog-server.mjs +86 -63
- package/dist/blog-server.mjs.map +1 -1
- package/dist/blog.d.mts +651 -1755
- package/dist/blog.d.ts +651 -1755
- package/dist/blog.js +121 -98
- package/dist/blog.js.map +1 -1
- package/dist/blog.mjs +86 -63
- package/dist/blog.mjs.map +1 -1
- package/dist/calendar-server.d.mts +2 -2
- package/dist/calendar-server.d.ts +2 -2
- package/dist/calendar-server.js +0 -26
- package/dist/calendar-server.js.map +1 -1
- package/dist/calendar-server.mjs +0 -26
- package/dist/calendar-server.mjs.map +1 -1
- package/dist/calendar.d.mts +3 -3
- package/dist/calendar.d.ts +3 -3
- package/dist/calendar.js +227 -126
- package/dist/calendar.js.map +1 -1
- package/dist/calendar.mjs +216 -125
- package/dist/calendar.mjs.map +1 -1
- package/dist/client.d.mts +11 -4
- package/dist/client.d.ts +11 -4
- package/dist/client.js +611 -347
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +611 -347
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +550 -487
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +539 -487
- package/dist/index.mjs.map +1 -1
- package/dist/ingest-typed-MBuMe9Pn.d.ts +883 -0
- package/dist/ingest-typed-UA13xTfI.d.mts +883 -0
- package/dist/middleware.js +0 -467
- package/dist/middleware.js.map +1 -1
- package/dist/middleware.mjs +0 -467
- package/dist/middleware.mjs.map +1 -1
- package/dist/{phone-utils-BVzSNBf1.d.mts → phone-utils-C0ds6cqZ.d.mts} +24 -78
- package/dist/{phone-utils-BVzSNBf1.d.ts → phone-utils-C0ds6cqZ.d.ts} +24 -78
- package/dist/phone.d.mts +2 -2
- package/dist/phone.d.ts +2 -2
- package/dist/phone.js +0 -464
- package/dist/phone.js.map +1 -1
- package/dist/phone.mjs +0 -464
- package/dist/phone.mjs.map +1 -1
- package/dist/{sales-IGC2tq4J.d.ts → sales-DQC815f3.d.ts} +90 -329
- package/dist/{sales-DQGzXSgL.d.mts → sales-w1reW_Y3.d.mts} +90 -329
- package/dist/sales.d.mts +3 -3
- package/dist/sales.d.ts +3 -3
- package/dist/sales.js +270 -127
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +259 -127
- package/dist/sales.mjs.map +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +0 -467
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +0 -467
- package/dist/server.mjs.map +1 -1
- package/dist/{tracking-config-runtime-D7prdTE1.d.mts → tracking-config-runtime-C6H7ofmo.d.mts} +6 -0
- package/dist/{tracking-config-runtime-D7prdTE1.d.ts → tracking-config-runtime-C6H7ofmo.d.ts} +6 -0
- package/dist/transport-CDmGOiCq.d.ts +253 -0
- package/dist/transport-I_cMSFQ6.d.mts +253 -0
- package/package.json +2 -2
- package/dist/ingest-typed-BxLFlZ7N.d.mts +0 -1371
- package/dist/ingest-typed-ByQVRMvP.d.ts +0 -1371
- package/dist/transport-C-_rFSR4.d.ts +0 -721
- package/dist/transport-yUF5Wize.d.mts +0 -721
package/dist/calendar.mjs
CHANGED
|
@@ -15,32 +15,6 @@ var AranovaApiError = class extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// ../tracking-core/src/phone.ts
|
|
19
|
-
import { AsYouType, parsePhoneNumberFromString } from "libphonenumber-js";
|
|
20
|
-
|
|
21
|
-
// ../tracking-core/src/events/page-view.ts
|
|
22
|
-
import { z } from "zod";
|
|
23
|
-
var pageViewMetadataSchema = z.object({
|
|
24
|
-
page: z.object({
|
|
25
|
-
title: z.string().nullable(),
|
|
26
|
-
path: z.string(),
|
|
27
|
-
search: z.string(),
|
|
28
|
-
hash: z.string()
|
|
29
|
-
}).strict(),
|
|
30
|
-
referrer: z.string().nullable(),
|
|
31
|
-
// `.nullable().optional()` — absent (undefined) OR explicit null OR a
|
|
32
|
-
// real viewport object. Mirrors Pydantic's `_Viewport | None = None`
|
|
33
|
-
// on the backend side so the drift test stays clean.
|
|
34
|
-
viewport: z.object({
|
|
35
|
-
w: z.number(),
|
|
36
|
-
h: z.number()
|
|
37
|
-
}).strict().nullable().optional()
|
|
38
|
-
}).strict();
|
|
39
|
-
var pageViewConfigSchema = z.object({}).strict();
|
|
40
|
-
|
|
41
|
-
// ../tracking-core/src/session.ts
|
|
42
|
-
var SESSION_IDLE_MS = 30 * 60 * 1e3;
|
|
43
|
-
|
|
44
18
|
// ../tracking-core/src/ingest.ts
|
|
45
19
|
var API_KEY_HEADER = "X-Aranova-Api-Key";
|
|
46
20
|
var SDK_VERSION_HEADER = "X-Aranova-Sdk-Version";
|
|
@@ -74,9 +48,9 @@ async function apiRequest(config, method, path, body, extraHeaders) {
|
|
|
74
48
|
try {
|
|
75
49
|
const parsed = await response.json();
|
|
76
50
|
if (parsed && typeof parsed === "object") {
|
|
77
|
-
const
|
|
78
|
-
if (typeof
|
|
79
|
-
if (typeof
|
|
51
|
+
const record3 = parsed;
|
|
52
|
+
if (typeof record3.detail === "string") detail = record3.detail;
|
|
53
|
+
if (typeof record3.code === "string") code = record3.code;
|
|
80
54
|
}
|
|
81
55
|
} catch {
|
|
82
56
|
}
|
|
@@ -96,9 +70,9 @@ async function calendarRequest(config, method, path, body) {
|
|
|
96
70
|
}
|
|
97
71
|
|
|
98
72
|
// ../tracking-core/src/resources/intl/date.ts
|
|
99
|
-
function formatDateInTz(
|
|
100
|
-
const date = new Date(
|
|
101
|
-
if (Number.isNaN(date.getTime())) return
|
|
73
|
+
function formatDateInTz(iso2, timeZone, opts, locale) {
|
|
74
|
+
const date = new Date(iso2);
|
|
75
|
+
if (Number.isNaN(date.getTime())) return iso2;
|
|
102
76
|
return new Intl.DateTimeFormat(locale, {
|
|
103
77
|
year: "numeric",
|
|
104
78
|
month: "short",
|
|
@@ -147,8 +121,8 @@ function instantFromWallClock(timeZone, year, month, day, hour = 0, minute = 0)
|
|
|
147
121
|
const corrected = naive - offsetMinutesAt(firstGuess, timeZone) * 6e4;
|
|
148
122
|
return new Date(corrected);
|
|
149
123
|
}
|
|
150
|
-
function localDateKey(
|
|
151
|
-
const p = partsInTz(new Date(
|
|
124
|
+
function localDateKey(iso2, timeZone) {
|
|
125
|
+
const p = partsInTz(new Date(iso2), timeZone);
|
|
152
126
|
const pad = (n) => String(n).padStart(2, "0");
|
|
153
127
|
return `${p.year}-${pad(p.month)}-${pad(p.day)}`;
|
|
154
128
|
}
|
|
@@ -203,7 +177,167 @@ function isCalendarError(error, code) {
|
|
|
203
177
|
}
|
|
204
178
|
|
|
205
179
|
// ../tracking-core/src/resources/calendar/schema.ts
|
|
206
|
-
import
|
|
180
|
+
import * as z2 from "zod/mini";
|
|
181
|
+
|
|
182
|
+
// ../tracking-core/src/resources/calendar/generated/zod.gen.ts
|
|
183
|
+
import * as z from "zod/mini";
|
|
184
|
+
var zBookingAttendee = z.strictObject({
|
|
185
|
+
display_name: z.nullish(z.string().check(z.maxLength(200))),
|
|
186
|
+
email: z.email().check(z.maxLength(320)),
|
|
187
|
+
optional: z._default(z.optional(z.boolean()), false)
|
|
188
|
+
});
|
|
189
|
+
var zBookingCancelSchema = z.strictObject({
|
|
190
|
+
notify_attendees: z._default(z.optional(z.boolean()), true),
|
|
191
|
+
reason: z.nullish(z.string().check(z.maxLength(500)))
|
|
192
|
+
});
|
|
193
|
+
var zBookingCustomerInput = z.strictObject({
|
|
194
|
+
email: z.email().check(z.maxLength(320)),
|
|
195
|
+
name: z.nullish(z.string().check(z.maxLength(200))),
|
|
196
|
+
phone: z.nullish(z.string().check(z.maxLength(64))),
|
|
197
|
+
sms_consent: z._default(z.optional(z.boolean()), false)
|
|
198
|
+
});
|
|
199
|
+
var zBookingCustomerOutput = z.strictObject({
|
|
200
|
+
email: z.email().check(z.maxLength(320)),
|
|
201
|
+
name: z.nullable(z.string().check(z.maxLength(200))),
|
|
202
|
+
phone: z.nullable(z.string().check(z.maxLength(64))),
|
|
203
|
+
sms_consent: z._default(z.boolean(), false)
|
|
204
|
+
});
|
|
205
|
+
var zBookingRescheduleSchema = z.strictObject({
|
|
206
|
+
duration_minutes: z.nullish(z.int().check(z.gt(0), z.lte(1440))),
|
|
207
|
+
end_at: z.nullish(z.iso.datetime({ offset: true })),
|
|
208
|
+
notify_attendees: z._default(z.optional(z.boolean()), true),
|
|
209
|
+
reason: z.nullish(z.string().check(z.maxLength(500))),
|
|
210
|
+
start_at: z.iso.datetime({ offset: true }),
|
|
211
|
+
time_zone: z.string().check(z.minLength(1), z.maxLength(64), z.regex(/^[A-Za-z0-9_+\-\/]+$/))
|
|
212
|
+
});
|
|
213
|
+
var zBookingResponse = z.strictObject({
|
|
214
|
+
appointment_type: z.nullable(z.string()),
|
|
215
|
+
calendar_key: z.string(),
|
|
216
|
+
customer: zBookingCustomerOutput,
|
|
217
|
+
end_at: z.iso.datetime({ offset: true }),
|
|
218
|
+
google_html_link: z.nullable(z.string()),
|
|
219
|
+
google_sync_state: z.string(),
|
|
220
|
+
id: z.string(),
|
|
221
|
+
manage_token: z.nullable(z.string()),
|
|
222
|
+
meet_url: z.nullable(z.string()),
|
|
223
|
+
start_at: z.iso.datetime({ offset: true }),
|
|
224
|
+
status: z.string(),
|
|
225
|
+
time_zone: z.string(),
|
|
226
|
+
title: z.string()
|
|
227
|
+
});
|
|
228
|
+
var zBookingSource = z.enum(["website", "phone", "walk_in", "import", "operator"]);
|
|
229
|
+
var zBookingMetadata = z.strictObject({
|
|
230
|
+
custom: z.nullish(
|
|
231
|
+
z.record(z.string(), z.nullable(z.union([z.string(), z.int(), z.number(), z.boolean()])))
|
|
232
|
+
),
|
|
233
|
+
fbclid: z.nullish(z.string().check(z.maxLength(256))),
|
|
234
|
+
gclid: z.nullish(z.string().check(z.maxLength(256))),
|
|
235
|
+
landing_page: z.nullish(z.string().check(z.maxLength(2048))),
|
|
236
|
+
notes: z.nullish(z.string().check(z.maxLength(2e3))),
|
|
237
|
+
referrer: z.nullish(z.string().check(z.maxLength(2048))),
|
|
238
|
+
schema_version: z._default(z.optional(z.int()), 1),
|
|
239
|
+
service: z.nullish(z.string().check(z.maxLength(64))),
|
|
240
|
+
session_id: z.nullish(z.string().check(z.maxLength(64))),
|
|
241
|
+
source: z.nullish(zBookingSource),
|
|
242
|
+
utm_campaign: z.nullish(z.string().check(z.maxLength(128))),
|
|
243
|
+
utm_content: z.nullish(z.string().check(z.maxLength(128))),
|
|
244
|
+
utm_medium: z.nullish(z.string().check(z.maxLength(128))),
|
|
245
|
+
utm_source: z.nullish(z.string().check(z.maxLength(128))),
|
|
246
|
+
utm_term: z.nullish(z.string().check(z.maxLength(128))),
|
|
247
|
+
visitor_id: z.nullish(z.string().check(z.maxLength(64)))
|
|
248
|
+
});
|
|
249
|
+
var zCustomLocation = z.strictObject({
|
|
250
|
+
kind: z.literal("custom"),
|
|
251
|
+
text: z.string().check(z.maxLength(1024))
|
|
252
|
+
});
|
|
253
|
+
var zErrorCode = z.enum([
|
|
254
|
+
"missing_credentials",
|
|
255
|
+
"invalid_api_key",
|
|
256
|
+
"not_authenticated",
|
|
257
|
+
"wrong_key_type",
|
|
258
|
+
"origin_missing",
|
|
259
|
+
"origin_not_allowed",
|
|
260
|
+
"capability_denied",
|
|
261
|
+
"session_required",
|
|
262
|
+
"operator_only",
|
|
263
|
+
"cross_tenant",
|
|
264
|
+
"business_id_required",
|
|
265
|
+
"bad_request",
|
|
266
|
+
"not_found",
|
|
267
|
+
"conflict",
|
|
268
|
+
"incompatible_payload",
|
|
269
|
+
"repeat_confirmation_required",
|
|
270
|
+
"idempotency_conflict",
|
|
271
|
+
"validation_error",
|
|
272
|
+
"unknown_service",
|
|
273
|
+
"invalid_sale_properties",
|
|
274
|
+
"invalid_cursor",
|
|
275
|
+
"rate_limited",
|
|
276
|
+
"internal_error"
|
|
277
|
+
]);
|
|
278
|
+
var zMeetLocation = z.strictObject({
|
|
279
|
+
kind: z.literal("google_meet")
|
|
280
|
+
});
|
|
281
|
+
var zPhoneLocation = z.strictObject({
|
|
282
|
+
kind: z.literal("phone"),
|
|
283
|
+
phone: z.string().check(z.maxLength(64))
|
|
284
|
+
});
|
|
285
|
+
var zPhysicalLocation = z.strictObject({
|
|
286
|
+
address: z.string().check(z.maxLength(1024)),
|
|
287
|
+
kind: z.literal("physical")
|
|
288
|
+
});
|
|
289
|
+
var zReminderMethod = z.enum(["email", "popup"]);
|
|
290
|
+
var zBookingReminder = z.strictObject({
|
|
291
|
+
method: zReminderMethod,
|
|
292
|
+
minutes_before: z.int().check(z.gte(0), z.lte(40320))
|
|
293
|
+
});
|
|
294
|
+
var zBookingReminders = z.strictObject({
|
|
295
|
+
overrides: z.optional(z.array(zBookingReminder).check(z.maxLength(5))),
|
|
296
|
+
use_calendar_defaults: z._default(z.optional(z.boolean()), true)
|
|
297
|
+
});
|
|
298
|
+
var zBookingCreateSchema = z.strictObject({
|
|
299
|
+
appointment_type: z.nullish(z.string().check(z.maxLength(64))),
|
|
300
|
+
attendees: z.optional(z.array(zBookingAttendee).check(z.maxLength(20))),
|
|
301
|
+
buffer_after_minutes: z._default(z.optional(z.int().check(z.gte(0), z.lte(1440))), 0),
|
|
302
|
+
buffer_before_minutes: z._default(z.optional(z.int().check(z.gte(0), z.lte(1440))), 0),
|
|
303
|
+
calendar_key: z.string().check(z.minLength(1), z.maxLength(64)),
|
|
304
|
+
customer: zBookingCustomerInput,
|
|
305
|
+
description: z.nullish(z.string().check(z.maxLength(8e3))),
|
|
306
|
+
duration_minutes: z.nullish(z.int().check(z.gt(0), z.lte(1440))),
|
|
307
|
+
end_at: z.nullish(z.iso.datetime({ offset: true })),
|
|
308
|
+
idempotency_key: z.nullish(z.string().check(z.maxLength(128))),
|
|
309
|
+
location: z.nullish(z.union([zMeetLocation, zPhysicalLocation, zPhoneLocation, zCustomLocation])),
|
|
310
|
+
metadata: z.nullish(zBookingMetadata),
|
|
311
|
+
reminders: z.nullish(zBookingReminders),
|
|
312
|
+
send_invites: z._default(z.optional(z.boolean()), true),
|
|
313
|
+
start_at: z.iso.datetime({ offset: true }),
|
|
314
|
+
time_zone: z.string().check(z.minLength(1), z.maxLength(64), z.regex(/^[A-Za-z0-9_+\-\/]+$/)),
|
|
315
|
+
title: z.nullish(z.string().check(z.maxLength(300)))
|
|
316
|
+
});
|
|
317
|
+
var zValidationError = z.object({
|
|
318
|
+
ctx: z.optional(z.record(z.string(), z.unknown())),
|
|
319
|
+
input: z.optional(z.unknown()),
|
|
320
|
+
loc: z.array(z.union([z.string(), z.int()])),
|
|
321
|
+
msg: z.string(),
|
|
322
|
+
type: z.string()
|
|
323
|
+
});
|
|
324
|
+
var zHttpValidationError = z.object({
|
|
325
|
+
detail: z.optional(z.array(zValidationError))
|
|
326
|
+
});
|
|
327
|
+
var zValidationErrorItem = z.object({
|
|
328
|
+
loc: z.array(z.union([z.string(), z.int()])),
|
|
329
|
+
msg: z.string(),
|
|
330
|
+
type: z.string()
|
|
331
|
+
});
|
|
332
|
+
var zApiErrorSchema = z.object({
|
|
333
|
+
code: zErrorCode,
|
|
334
|
+
context: z._default(z.nullish(z.record(z.string(), z.unknown())), null),
|
|
335
|
+
detail: z.string(),
|
|
336
|
+
errors: z._default(z.nullish(z.array(zValidationErrorItem)), null),
|
|
337
|
+
request_id: z._default(z.nullish(z.string()), null)
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// ../tracking-core/src/resources/calendar/schema.ts
|
|
207
341
|
var CALENDAR_METADATA_SCHEMA_VERSION = 1;
|
|
208
342
|
var MAX_ATTENDEES = 20;
|
|
209
343
|
var MAX_REMINDER_OVERRIDES = 5;
|
|
@@ -229,7 +363,6 @@ var CALENDAR_ERROR_CODES = [
|
|
|
229
363
|
"rate_limited",
|
|
230
364
|
"google_error"
|
|
231
365
|
];
|
|
232
|
-
var isoInstant = z2.string().datetime({ offset: true });
|
|
233
366
|
function isKnownTimeZone(timeZone) {
|
|
234
367
|
try {
|
|
235
368
|
new Intl.DateTimeFormat(void 0, { timeZone });
|
|
@@ -238,107 +371,65 @@ function isKnownTimeZone(timeZone) {
|
|
|
238
371
|
return false;
|
|
239
372
|
}
|
|
240
373
|
}
|
|
241
|
-
var ianaTz = z2.string().
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
})
|
|
374
|
+
var ianaTz = z2.string().check(
|
|
375
|
+
z2.minLength(1),
|
|
376
|
+
z2.maxLength(64),
|
|
377
|
+
z2.regex(/^[A-Za-z0-9_+\-/]+$/),
|
|
378
|
+
z2.refine(isKnownTimeZone, { error: "unknown IANA time zone" })
|
|
379
|
+
);
|
|
380
|
+
var bookingAttendeeSchema = zBookingAttendee;
|
|
381
|
+
var bookingReminderSchema = zBookingReminder;
|
|
382
|
+
var bookingCustomerSchema = zBookingCustomerInput;
|
|
383
|
+
var bookingMetadataSchema = z2.extend(zBookingMetadata, {
|
|
384
|
+
custom: z2.nullish(
|
|
385
|
+
z2.record(z2.string(), z2.union([z2.string(), z2.int(), z2.number(), z2.boolean(), z2.null()]))
|
|
386
|
+
)
|
|
387
|
+
});
|
|
255
388
|
var bookingLocationSchema = z2.union([
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
389
|
+
zMeetLocation,
|
|
390
|
+
zPhysicalLocation,
|
|
391
|
+
zPhoneLocation,
|
|
392
|
+
zCustomLocation
|
|
393
|
+
]);
|
|
394
|
+
var bookingLocationNullableSchema = z2.union([
|
|
395
|
+
...bookingLocationSchema.def.options,
|
|
396
|
+
z2.null()
|
|
260
397
|
]);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
// booking, and that invite is the whole confirmation mechanism.
|
|
265
|
-
email: z2.string().max(320).email(),
|
|
266
|
-
name: z2.string().max(200).nullable().optional(),
|
|
267
|
-
phone: z2.string().max(64).nullable().optional(),
|
|
268
|
-
sms_consent: z2.boolean().default(false)
|
|
269
|
-
}).strict();
|
|
270
|
-
var jsonScalar = z2.union([z2.string(), z2.number(), z2.boolean(), z2.null()]);
|
|
271
|
-
var bookingMetadataSchema = z2.object({
|
|
272
|
-
schema_version: z2.number().int().default(CALENDAR_METADATA_SCHEMA_VERSION),
|
|
273
|
-
source: z2.enum(BOOKING_SOURCES).nullable().optional(),
|
|
274
|
-
service: z2.string().max(64).nullable().optional(),
|
|
275
|
-
visitor_id: z2.string().max(64).nullable().optional(),
|
|
276
|
-
session_id: z2.string().max(64).nullable().optional(),
|
|
277
|
-
gclid: z2.string().max(256).nullable().optional(),
|
|
278
|
-
fbclid: z2.string().max(256).nullable().optional(),
|
|
279
|
-
utm_source: z2.string().max(128).nullable().optional(),
|
|
280
|
-
utm_medium: z2.string().max(128).nullable().optional(),
|
|
281
|
-
utm_campaign: z2.string().max(128).nullable().optional(),
|
|
282
|
-
utm_term: z2.string().max(128).nullable().optional(),
|
|
283
|
-
utm_content: z2.string().max(128).nullable().optional(),
|
|
284
|
-
landing_page: z2.string().max(2048).nullable().optional(),
|
|
285
|
-
referrer: z2.string().max(2048).nullable().optional(),
|
|
286
|
-
notes: z2.string().max(2e3).nullable().optional(),
|
|
287
|
-
custom: z2.record(jsonScalar).nullable().optional()
|
|
288
|
-
}).strict();
|
|
398
|
+
function addIssue(ctx, path, message) {
|
|
399
|
+
ctx.issues.push({ code: "custom", input: ctx.value, path, message });
|
|
400
|
+
}
|
|
289
401
|
function refineEndXor(value, ctx) {
|
|
290
402
|
const hasEnd = value.end_at !== void 0 && value.end_at !== null;
|
|
291
403
|
const hasDuration = value.duration_minutes !== void 0 && value.duration_minutes !== null;
|
|
292
404
|
if (hasEnd === hasDuration) {
|
|
293
|
-
|
|
294
|
-
code: z2.ZodIssueCode.custom,
|
|
295
|
-
message: "provide exactly one of end_at or duration_minutes",
|
|
296
|
-
path: ["end_at"]
|
|
297
|
-
});
|
|
405
|
+
addIssue(ctx, ["end_at"], "provide exactly one of end_at or duration_minutes");
|
|
298
406
|
return;
|
|
299
407
|
}
|
|
300
408
|
if (hasEnd && new Date(value.end_at) <= new Date(value.start_at)) {
|
|
301
|
-
|
|
302
|
-
code: z2.ZodIssueCode.custom,
|
|
303
|
-
message: "end_at must be after start_at",
|
|
304
|
-
path: ["end_at"]
|
|
305
|
-
});
|
|
409
|
+
addIssue(ctx, ["end_at"], "end_at must be after start_at");
|
|
306
410
|
}
|
|
307
411
|
}
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
duration_minutes: z2.number().int().positive().max(MAX_BOOKING_MINUTES).nullable().optional(),
|
|
316
|
-
/** The booker's zone — distinct from the business's and the calendar's. */
|
|
317
|
-
time_zone: ianaTz,
|
|
318
|
-
title: z2.string().max(300).nullable().optional(),
|
|
319
|
-
description: z2.string().max(8e3).nullable().optional(),
|
|
320
|
-
location: bookingLocationNullableSchema.optional(),
|
|
321
|
-
customer: bookingCustomerSchema,
|
|
322
|
-
attendees: z2.array(bookingAttendeeSchema).max(MAX_ATTENDEES).default([]),
|
|
323
|
-
send_invites: z2.boolean().default(true),
|
|
324
|
-
reminders: bookingRemindersSchema.nullable().optional(),
|
|
325
|
-
metadata: bookingMetadataSchema.nullable().optional(),
|
|
326
|
-
idempotency_key: z2.string().max(128).nullable().optional(),
|
|
327
|
-
buffer_before_minutes: z2.number().int().min(0).max(MAX_BOOKING_MINUTES).default(0),
|
|
328
|
-
buffer_after_minutes: z2.number().int().min(0).max(MAX_BOOKING_MINUTES).default(0)
|
|
329
|
-
}).strict().superRefine(refineEndXor);
|
|
330
|
-
var bookingRescheduleSchema = z2.object({
|
|
331
|
-
start_at: isoInstant,
|
|
332
|
-
end_at: isoInstant.nullable().optional(),
|
|
333
|
-
duration_minutes: z2.number().int().positive().max(MAX_BOOKING_MINUTES).nullable().optional(),
|
|
412
|
+
var bookingRemindersSchema = z2.extend(zBookingReminders, {
|
|
413
|
+
overrides: z2._default(
|
|
414
|
+
z2.array(bookingReminderSchema).check(z2.maxLength(MAX_REMINDER_OVERRIDES)),
|
|
415
|
+
[]
|
|
416
|
+
)
|
|
417
|
+
});
|
|
418
|
+
var bookingCreateSchema = z2.extend(zBookingCreateSchema, {
|
|
334
419
|
time_zone: ianaTz,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
420
|
+
// The generated field is `z.union([...variants]).nullish()`, which nests one
|
|
421
|
+
// `anyOf` inside another; Pydantic's `BookingLocation | None` flattens to a
|
|
422
|
+
// single list and the drift snapshot compares structure. Override with the
|
|
423
|
+
// flattened union.
|
|
424
|
+
location: z2.optional(bookingLocationNullableSchema),
|
|
425
|
+
attendees: z2._default(z2.array(bookingAttendeeSchema).check(z2.maxLength(MAX_ATTENDEES)), []),
|
|
426
|
+
// These reference the un-composed generated schemas; generation can't nest
|
|
427
|
+
// our compositions into its own output.
|
|
428
|
+
reminders: z2.nullish(bookingRemindersSchema),
|
|
429
|
+
metadata: z2.nullish(bookingMetadataSchema)
|
|
430
|
+
}).check((ctx) => refineEndXor(ctx.value, ctx));
|
|
431
|
+
var bookingRescheduleSchema = z2.extend(zBookingRescheduleSchema, { time_zone: ianaTz }).check((ctx) => refineEndXor(ctx.value, ctx));
|
|
432
|
+
var bookingCancelSchema = zBookingCancelSchema;
|
|
342
433
|
|
|
343
434
|
// ../tracking-core/src/resources/calendar/slots.ts
|
|
344
435
|
function parseHhMm(value) {
|