@aranova/tracking-next 0.27.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +4 -3
- package/dist/client.d.ts +4 -3
- package/dist/client.js +185 -277
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +157 -249
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +482 -484
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +471 -484
- package/dist/index.mjs.map +1 -1
- package/dist/ingest-typed-BdKmlouW.d.ts +791 -0
- package/dist/ingest-typed-Bo7WPmpU.d.mts +791 -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-CubQif9Z.d.mts} +18 -78
- package/dist/{phone-utils-BVzSNBf1.d.ts → phone-utils-CubQif9Z.d.ts} +18 -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-DQGzXSgL.d.mts → sales-D7KstKA-.d.mts} +89 -328
- package/dist/{sales-IGC2tq4J.d.ts → sales-DG150g3o.d.ts} +89 -328
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +265 -127
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +254 -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/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.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
|
|
137
|
-
if (typeof
|
|
138
|
-
if (typeof
|
|
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(
|
|
159
|
-
const date = new Date(
|
|
160
|
-
if (Number.isNaN(date.getTime())) return
|
|
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(
|
|
210
|
-
const p = partsInTz(new Date(
|
|
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
|
|
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 =
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
var
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
})
|
|
314
|
-
var bookingLocationSchema =
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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 =
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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) {
|