siteplane 0.2.1-rc.0 → 0.2.1-rc.1

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.
@@ -1188,16 +1188,16 @@ var require_range = __commonJS({
1188
1188
  };
1189
1189
  var replaceTilde = (comp, options) => {
1190
1190
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1191
- const z6 = options.includePrerelease ? "-0" : "";
1191
+ const z7 = options.includePrerelease ? "-0" : "";
1192
1192
  return comp.replace(r, (_, M, m, p, pr) => {
1193
1193
  debug("tilde", comp, _, M, m, p, pr);
1194
1194
  let ret;
1195
1195
  if (isX(M)) {
1196
1196
  ret = "";
1197
1197
  } else if (isX(m)) {
1198
- ret = `>=${M}.0.0${z6} <${+M + 1}.0.0-0`;
1198
+ ret = `>=${M}.0.0${z7} <${+M + 1}.0.0-0`;
1199
1199
  } else if (isX(p)) {
1200
- ret = `>=${M}.${m}.0${z6} <${M}.${+m + 1}.0-0`;
1200
+ ret = `>=${M}.${m}.0${z7} <${M}.${+m + 1}.0-0`;
1201
1201
  } else if (pr) {
1202
1202
  debug("replaceTilde pr", pr);
1203
1203
  ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
@@ -1214,19 +1214,19 @@ var require_range = __commonJS({
1214
1214
  var replaceCaret = (comp, options) => {
1215
1215
  debug("caret", comp, options);
1216
1216
  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1217
- const z6 = options.includePrerelease ? "-0" : "";
1217
+ const z7 = options.includePrerelease ? "-0" : "";
1218
1218
  return comp.replace(r, (_, M, m, p, pr) => {
1219
1219
  debug("caret", comp, _, M, m, p, pr);
1220
1220
  let ret;
1221
1221
  if (isX(M)) {
1222
1222
  ret = "";
1223
1223
  } else if (isX(m)) {
1224
- ret = `>=${M}.0.0${z6} <${+M + 1}.0.0-0`;
1224
+ ret = `>=${M}.0.0${z7} <${+M + 1}.0.0-0`;
1225
1225
  } else if (isX(p)) {
1226
1226
  if (M === "0") {
1227
- ret = `>=${M}.${m}.0${z6} <${M}.${+m + 1}.0-0`;
1227
+ ret = `>=${M}.${m}.0${z7} <${M}.${+m + 1}.0-0`;
1228
1228
  } else {
1229
- ret = `>=${M}.${m}.0${z6} <${+M + 1}.0.0-0`;
1229
+ ret = `>=${M}.${m}.0${z7} <${+M + 1}.0.0-0`;
1230
1230
  }
1231
1231
  } else if (pr) {
1232
1232
  debug("replaceCaret pr", pr);
@@ -2132,7 +2132,15 @@ var deviceTokenErrorSchema = z.object({
2132
2132
 
2133
2133
  // ../shared/dist/booking-contracts.js
2134
2134
  init_esm_shims();
2135
+ import { z as z3 } from "zod";
2136
+
2137
+ // ../shared/dist/site-language.js
2138
+ init_esm_shims();
2135
2139
  import { z as z2 } from "zod";
2140
+ var SITE_LANGUAGES = ["en-US", "en-GB", "de-DE"];
2141
+ var siteLanguageSchema = z2.enum(SITE_LANGUAGES);
2142
+
2143
+ // ../shared/dist/booking-contracts.js
2136
2144
  var bookingStatuses = [
2137
2145
  "pending_payment",
2138
2146
  "confirmed",
@@ -2187,30 +2195,30 @@ var bookingResourceKinds = [
2187
2195
  "equipment",
2188
2196
  "other"
2189
2197
  ];
2190
- var bookingStatusSchema = z2.enum(bookingStatuses);
2191
- var bookingPaymentStatusSchema = z2.enum(bookingPaymentStatuses);
2192
- var bookingAccountReadinessStatusSchema = z2.enum(bookingAccountReadinessStatuses);
2193
- var bookingRefundStatusSchema = z2.enum(bookingRefundStatuses);
2194
- var bookingDisputeStatusSchema = z2.enum(bookingDisputeStatuses);
2195
- var bookingPaymentModeSchema = z2.enum(bookingPaymentModes);
2196
- var bookingPaymentCollectionTypeSchema = z2.enum(bookingPaymentCollectionTypes);
2197
- var bookingPaymentCollectionSchema = z2.discriminatedUnion("type", [
2198
- z2.object({ type: z2.literal("full_amount") }).strict(),
2199
- z2.object({
2200
- type: z2.literal("deposit_percent"),
2201
- depositPercent: z2.number().int().min(10).max(90)
2198
+ var bookingStatusSchema = z3.enum(bookingStatuses);
2199
+ var bookingPaymentStatusSchema = z3.enum(bookingPaymentStatuses);
2200
+ var bookingAccountReadinessStatusSchema = z3.enum(bookingAccountReadinessStatuses);
2201
+ var bookingRefundStatusSchema = z3.enum(bookingRefundStatuses);
2202
+ var bookingDisputeStatusSchema = z3.enum(bookingDisputeStatuses);
2203
+ var bookingPaymentModeSchema = z3.enum(bookingPaymentModes);
2204
+ var bookingPaymentCollectionTypeSchema = z3.enum(bookingPaymentCollectionTypes);
2205
+ var bookingPaymentCollectionSchema = z3.discriminatedUnion("type", [
2206
+ z3.object({ type: z3.literal("full_amount") }).strict(),
2207
+ z3.object({
2208
+ type: z3.literal("deposit_percent"),
2209
+ depositPercent: z3.number().int().min(10).max(90)
2202
2210
  }).strict()
2203
2211
  ]);
2204
2212
  var bookingPaymentChoices = ["onsite", "online"];
2205
- var bookingPaymentChoiceSchema = z2.enum(bookingPaymentChoices);
2206
- var bookingPaymentSnapshotSchema = z2.object({
2207
- snapshotId: z2.string().uuid(),
2208
- snapshotVersion: z2.number().int().positive(),
2209
- currency: z2.literal("EUR"),
2210
- totalAmountCents: z2.number().int().min(0),
2211
- onlineAmountCents: z2.number().int().min(0),
2212
- onsiteRemainderCents: z2.number().int().min(0),
2213
- maxStripeRefundAmountCents: z2.number().int().min(0)
2213
+ var bookingPaymentChoiceSchema = z3.enum(bookingPaymentChoices);
2214
+ var bookingPaymentSnapshotSchema = z3.object({
2215
+ snapshotId: z3.string().uuid(),
2216
+ snapshotVersion: z3.number().int().positive(),
2217
+ currency: z3.literal("EUR"),
2218
+ totalAmountCents: z3.number().int().min(0),
2219
+ onlineAmountCents: z3.number().int().min(0),
2220
+ onsiteRemainderCents: z3.number().int().min(0),
2221
+ maxStripeRefundAmountCents: z3.number().int().min(0)
2214
2222
  }).strict().superRefine((snapshot, context) => {
2215
2223
  if (snapshot.onlineAmountCents + snapshot.onsiteRemainderCents !== snapshot.totalAmountCents) {
2216
2224
  context.addIssue({
@@ -2225,17 +2233,17 @@ var bookingPaymentSnapshotSchema = z2.object({
2225
2233
  });
2226
2234
  }
2227
2235
  });
2228
- var bookingServiceVariantSchema = z2.object({
2229
- id: z2.string().uuid(),
2230
- name: z2.string().trim().min(1).max(120),
2231
- durationMinutes: z2.number().int().min(1).max(1440),
2232
- priceCents: z2.number().int().min(0).nullable()
2236
+ var bookingServiceVariantSchema = z3.object({
2237
+ id: z3.string().uuid(),
2238
+ name: z3.string().trim().min(1).max(120),
2239
+ durationMinutes: z3.number().int().min(1).max(1440),
2240
+ priceCents: z3.number().int().min(0).nullable()
2233
2241
  }).strict();
2234
- var bookingServiceVariantsSchema = z2.array(bookingServiceVariantSchema).min(1).max(20);
2235
- var isoDateSchema = z2.string().regex(/^\d{4}-\d{2}-\d{2}$/);
2236
- var utcDateTimeSchema = z2.string().datetime();
2237
- var bookingLocalTimeSchema = z2.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/);
2238
- var bookingAvailabilityIntervalsSchema = z2.array(z2.object({
2242
+ var bookingServiceVariantsSchema = z3.array(bookingServiceVariantSchema).min(1).max(20);
2243
+ var isoDateSchema = z3.string().regex(/^\d{4}-\d{2}-\d{2}$/);
2244
+ var utcDateTimeSchema = z3.string().datetime();
2245
+ var bookingLocalTimeSchema = z3.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/);
2246
+ var bookingAvailabilityIntervalsSchema = z3.array(z3.object({
2239
2247
  start: bookingLocalTimeSchema,
2240
2248
  end: bookingLocalTimeSchema
2241
2249
  }).strict().refine((interval) => interval.end > interval.start)).superRefine((intervals, context) => {
@@ -2250,78 +2258,78 @@ var bookingAvailabilityIntervalsSchema = z2.array(z2.object({
2250
2258
  }
2251
2259
  }
2252
2260
  });
2253
- var bookingPublicConfigSchema = z2.object({
2254
- site: z2.object({
2255
- displayName: z2.string().trim().min(1),
2256
- timezone: z2.string().trim().min(1),
2257
- locale: z2.string().trim().min(2),
2258
- bookingPageSlug: z2.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).min(2).max(64),
2259
- privacyUrl: z2.string().url().nullable()
2261
+ var bookingPublicConfigSchema = z3.object({
2262
+ site: z3.object({
2263
+ displayName: z3.string().trim().min(1),
2264
+ timezone: z3.string().trim().min(1),
2265
+ locale: siteLanguageSchema,
2266
+ bookingPageSlug: z3.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).min(2).max(64),
2267
+ privacyUrl: z3.string().url().nullable()
2260
2268
  }),
2261
- branding: z2.object({
2262
- logoUrl: z2.string().url().nullable(),
2263
- accentColor: z2.string().trim().min(1).nullable()
2269
+ branding: z3.object({
2270
+ logoUrl: z3.string().url().nullable(),
2271
+ accentColor: z3.string().trim().min(1).nullable()
2264
2272
  }),
2265
- settings: z2.object({
2266
- slotIntervalMinutes: z2.number().int().positive(),
2267
- minLeadMinutes: z2.number().int().min(0),
2268
- minCancelLeadMinutes: z2.number().int().min(0),
2269
- maxAdvanceDays: z2.number().int().min(1),
2270
- requirePhone: z2.boolean(),
2271
- collectNote: z2.boolean(),
2272
- confirmationMessage: z2.string().nullable()
2273
+ settings: z3.object({
2274
+ slotIntervalMinutes: z3.number().int().positive(),
2275
+ minLeadMinutes: z3.number().int().min(0),
2276
+ minCancelLeadMinutes: z3.number().int().min(0),
2277
+ maxAdvanceDays: z3.number().int().min(1),
2278
+ requirePhone: z3.boolean(),
2279
+ collectNote: z3.boolean(),
2280
+ confirmationMessage: z3.string().nullable()
2273
2281
  }),
2274
2282
  /** Freitexte des Salons, im Kassen-Schritt vor der Bestaetigung sichtbar. */
2275
- policies: z2.object({
2276
- cancellation: z2.string().nullable(),
2277
- lateArrival: z2.string().nullable()
2283
+ policies: z3.object({
2284
+ cancellation: z3.string().nullable(),
2285
+ lateArrival: z3.string().nullable()
2278
2286
  }),
2279
- payment: z2.object({
2287
+ payment: z3.object({
2280
2288
  mode: bookingPaymentModeSchema,
2281
2289
  collection: bookingPaymentCollectionSchema,
2282
- onlinePaymentsReady: z2.boolean()
2290
+ onlinePaymentsReady: z3.boolean()
2283
2291
  }).strict(),
2284
- serviceCategories: z2.array(z2.object({
2285
- id: z2.string().uuid(),
2286
- name: z2.string().trim().min(1),
2287
- sortOrder: z2.number().int()
2292
+ serviceCategories: z3.array(z3.object({
2293
+ id: z3.string().uuid(),
2294
+ name: z3.string().trim().min(1),
2295
+ sortOrder: z3.number().int()
2288
2296
  })),
2289
- serviceSubcategories: z2.array(z2.object({
2290
- id: z2.string().uuid(),
2291
- categoryId: z2.string().uuid(),
2292
- name: z2.string().trim().min(1),
2293
- sortOrder: z2.number().int()
2297
+ serviceSubcategories: z3.array(z3.object({
2298
+ id: z3.string().uuid(),
2299
+ categoryId: z3.string().uuid(),
2300
+ name: z3.string().trim().min(1),
2301
+ sortOrder: z3.number().int()
2294
2302
  })),
2295
- services: z2.array(z2.object({
2296
- id: z2.string().trim().min(1),
2297
- name: z2.string().trim().min(1),
2298
- durationMinutes: z2.number().int().positive(),
2299
- priceCents: z2.number().int().min(0).nullable(),
2300
- currency: z2.string().regex(/^[A-Z]{3}$/),
2301
- description: z2.string().nullable(),
2302
- categoryId: z2.string().uuid(),
2303
- subcategoryId: z2.string().uuid().nullable(),
2303
+ services: z3.array(z3.object({
2304
+ id: z3.string().trim().min(1),
2305
+ name: z3.string().trim().min(1),
2306
+ durationMinutes: z3.number().int().positive(),
2307
+ priceCents: z3.number().int().min(0).nullable(),
2308
+ currency: z3.string().regex(/^[A-Z]{3}$/),
2309
+ description: z3.string().nullable(),
2310
+ categoryId: z3.string().uuid(),
2311
+ subcategoryId: z3.string().uuid().nullable(),
2304
2312
  variants: bookingServiceVariantsSchema,
2305
- allowsAnyResource: z2.boolean(),
2306
- sortOrder: z2.number().int()
2313
+ allowsAnyResource: z3.boolean(),
2314
+ sortOrder: z3.number().int()
2307
2315
  })),
2308
- resources: z2.array(z2.object({
2309
- id: z2.string().trim().min(1),
2310
- name: z2.string().trim().min(1),
2311
- kind: z2.enum(bookingResourceKinds),
2316
+ resources: z3.array(z3.object({
2317
+ id: z3.string().trim().min(1),
2318
+ name: z3.string().trim().min(1),
2319
+ kind: z3.enum(bookingResourceKinds),
2312
2320
  /** Profilfoto für „Bei wem?“; `null` ohne Foto. */
2313
- photoUrl: z2.string().url().nullable()
2321
+ photoUrl: z3.string().url().nullable()
2314
2322
  })),
2315
- serviceResources: z2.array(z2.object({
2316
- serviceId: z2.string().trim().min(1),
2317
- resourceId: z2.string().trim().min(1)
2323
+ serviceResources: z3.array(z3.object({
2324
+ serviceId: z3.string().trim().min(1),
2325
+ resourceId: z3.string().trim().min(1)
2318
2326
  }))
2319
2327
  });
2320
- var bookingItemSchema = z2.object({
2321
- serviceId: z2.string().trim().min(1),
2322
- variantId: z2.string().trim().min(1)
2328
+ var bookingItemSchema = z3.object({
2329
+ serviceId: z3.string().trim().min(1),
2330
+ variantId: z3.string().trim().min(1)
2323
2331
  }).strict();
2324
- var bookingItemsSchema = z2.array(bookingItemSchema).min(1).max(10);
2332
+ var bookingItemsSchema = z3.array(bookingItemSchema).min(1).max(10);
2325
2333
  function parseBookingItemsParam(value) {
2326
2334
  const items = value.split(",").map((entry) => entry.trim()).filter((entry) => entry !== "").map((entry) => {
2327
2335
  const [serviceId, variantId, ...rest] = entry.split(":");
@@ -2329,36 +2337,36 @@ function parseBookingItemsParam(value) {
2329
2337
  });
2330
2338
  return items.every((item) => item !== null) ? items : null;
2331
2339
  }
2332
- var bookingSlotsQuerySchema = z2.object({
2333
- items: z2.preprocess((value) => typeof value === "string" ? parseBookingItemsParam(value) : value, bookingItemsSchema),
2334
- resourceId: z2.string().trim().min(1).optional(),
2340
+ var bookingSlotsQuerySchema = z3.object({
2341
+ items: z3.preprocess((value) => typeof value === "string" ? parseBookingItemsParam(value) : value, bookingItemsSchema),
2342
+ resourceId: z3.string().trim().min(1).optional(),
2335
2343
  fromDate: isoDateSchema,
2336
2344
  toDate: isoDateSchema
2337
2345
  });
2338
- var bookingSlotsResponseSchema = z2.object({
2339
- timezone: z2.string().trim().min(1),
2346
+ var bookingSlotsResponseSchema = z3.object({
2347
+ timezone: z3.string().trim().min(1),
2340
2348
  items: bookingItemsSchema,
2341
2349
  // Reine Behandlungsdauer ohne Puffer: das UI zeigt damit die Terminspanne,
2342
2350
  // ohne selbst rechnen zu muessen.
2343
- totalDurationMinutes: z2.number().int().min(1),
2344
- mode: z2.enum(["any", "resource"]),
2345
- slots: z2.array(z2.object({
2351
+ totalDurationMinutes: z3.number().int().min(1),
2352
+ mode: z3.enum(["any", "resource"]),
2353
+ slots: z3.array(z3.object({
2346
2354
  startUtc: utcDateTimeSchema,
2347
- resourceId: z2.string().trim().min(1).optional()
2355
+ resourceId: z3.string().trim().min(1).optional()
2348
2356
  }))
2349
2357
  });
2350
- var bookingAvailabilityQuerySchema = z2.object({
2351
- items: z2.preprocess((value) => typeof value === "string" ? parseBookingItemsParam(value) : value, bookingItemsSchema),
2352
- resourceId: z2.string().trim().min(1).optional(),
2358
+ var bookingAvailabilityQuerySchema = z3.object({
2359
+ items: z3.preprocess((value) => typeof value === "string" ? parseBookingItemsParam(value) : value, bookingItemsSchema),
2360
+ resourceId: z3.string().trim().min(1).optional(),
2353
2361
  fromDate: isoDateSchema,
2354
2362
  toDate: isoDateSchema
2355
2363
  });
2356
- var bookingAvailabilityResponseSchema = z2.object({
2357
- timezone: z2.string().trim().min(1),
2358
- totalDurationMinutes: z2.number().int().min(1),
2359
- days: z2.array(z2.object({
2364
+ var bookingAvailabilityResponseSchema = z3.object({
2365
+ timezone: z3.string().trim().min(1),
2366
+ totalDurationMinutes: z3.number().int().min(1),
2367
+ days: z3.array(z3.object({
2360
2368
  date: isoDateSchema,
2361
- hasSlots: z2.boolean()
2369
+ hasSlots: z3.boolean()
2362
2370
  })),
2363
2371
  /** Erster Tag mit Slot ab `fromDate`, auch ausserhalb des Fensters. */
2364
2372
  nextAvailableDate: isoDateSchema.nullable()
@@ -2376,72 +2384,72 @@ var bookingPublicErrorCodes = [
2376
2384
  "too_late",
2377
2385
  "not_found"
2378
2386
  ];
2379
- var bookingPublicErrorSchema = z2.object({
2380
- error: z2.enum(bookingPublicErrorCodes),
2381
- message: z2.string().optional(),
2382
- requestId: z2.string().optional()
2387
+ var bookingPublicErrorSchema = z3.object({
2388
+ error: z3.enum(bookingPublicErrorCodes),
2389
+ message: z3.string().optional(),
2390
+ requestId: z3.string().optional()
2383
2391
  }).strict();
2384
- var bookingCreateRequestSchema = z2.object({
2392
+ var bookingCreateRequestSchema = z3.object({
2385
2393
  items: bookingItemsSchema,
2386
- resourceId: z2.string().min(1).nullable(),
2394
+ resourceId: z3.string().min(1).nullable(),
2387
2395
  startUtc: utcDateTimeSchema,
2388
- customer: z2.object({
2389
- name: z2.string().min(1).max(120),
2390
- email: z2.string().email().max(254),
2391
- phone: z2.string().max(32).optional(),
2392
- note: z2.string().max(1e3).optional()
2396
+ customer: z3.object({
2397
+ name: z3.string().min(1).max(120),
2398
+ email: z3.string().email().max(254),
2399
+ phone: z3.string().max(32).optional(),
2400
+ note: z3.string().max(1e3).optional()
2393
2401
  }).strict(),
2394
- hp: z2.string().optional(),
2395
- clientToken: z2.string().uuid(),
2402
+ hp: z3.string().optional(),
2403
+ clientToken: z3.string().uuid(),
2396
2404
  paymentChoice: bookingPaymentChoiceSchema,
2397
2405
  // Werbe-Einwilligung. Bestaetigung, Erinnerung und Storno-Link sind davon
2398
2406
  // unabhaengig und werden immer versendet.
2399
- consent: z2.object({
2400
- marketingEmail: z2.boolean(),
2401
- marketingSms: z2.boolean()
2407
+ consent: z3.object({
2408
+ marketingEmail: z3.boolean(),
2409
+ marketingSms: z3.boolean()
2402
2410
  }).strict().optional()
2403
2411
  }).strict();
2404
- var bookingPublicPaymentResponseSchema = z2.object({
2405
- clientSecret: z2.string().min(1),
2406
- stripeAccountId: z2.string().startsWith("acct_")
2412
+ var bookingPublicPaymentResponseSchema = z3.object({
2413
+ clientSecret: z3.string().min(1),
2414
+ stripeAccountId: z3.string().startsWith("acct_")
2407
2415
  }).strict();
2408
- var bookingCreateResponseSchema = z2.union([
2409
- z2.object({
2410
- status: z2.literal("confirmed"),
2411
- booking: z2.object({
2412
- id: z2.string().min(1),
2416
+ var bookingCreateResponseSchema = z3.union([
2417
+ z3.object({
2418
+ status: z3.literal("confirmed"),
2419
+ booking: z3.object({
2420
+ id: z3.string().min(1),
2413
2421
  startUtc: utcDateTimeSchema,
2414
2422
  endUtc: utcDateTimeSchema,
2415
- timezone: z2.string().trim().min(1),
2416
- serviceName: z2.string().trim().min(1),
2417
- resourceName: z2.string().trim().min(1)
2423
+ timezone: z3.string().trim().min(1),
2424
+ serviceName: z3.string().trim().min(1),
2425
+ resourceName: z3.string().trim().min(1)
2418
2426
  }).strict(),
2419
- manageUrl: z2.string().url(),
2420
- confirmationMessage: z2.string().nullable()
2427
+ manageUrl: z3.string().url(),
2428
+ confirmationMessage: z3.string().nullable()
2421
2429
  }).strict(),
2422
- z2.object({
2423
- status: z2.literal("pending_payment"),
2424
- bookingId: z2.string().min(1),
2430
+ z3.object({
2431
+ status: z3.literal("pending_payment"),
2432
+ bookingId: z3.string().min(1),
2425
2433
  holdExpiresAt: utcDateTimeSchema,
2426
2434
  payment: bookingPublicPaymentResponseSchema,
2427
- statusToken: z2.string().min(20),
2428
- manageUrl: z2.string().url().optional()
2435
+ statusToken: z3.string().min(20),
2436
+ manageUrl: z3.string().url().optional()
2429
2437
  }).strict(),
2430
2438
  bookingPublicErrorSchema
2431
2439
  ]);
2432
- var bookingStatusResponseSchema = z2.object({
2440
+ var bookingStatusResponseSchema = z3.object({
2433
2441
  bookingStatus: bookingStatusSchema,
2434
2442
  paymentStatus: bookingPaymentStatusSchema,
2435
2443
  refundStatus: bookingRefundStatusSchema,
2436
2444
  disputeStatus: bookingDisputeStatusSchema,
2437
2445
  holdExpiresAt: utcDateTimeSchema.nullable()
2438
2446
  }).strict();
2439
- var bookingCancelRequestSchema = z2.object({
2440
- token: z2.string().min(20)
2447
+ var bookingCancelRequestSchema = z3.object({
2448
+ token: z3.string().min(20)
2441
2449
  });
2442
- var bookingCancelResponseSchema = z2.union([
2443
- z2.object({
2444
- status: z2.enum(["cancelled", "already_cancelled", "too_late", "not_found"])
2450
+ var bookingCancelResponseSchema = z3.union([
2451
+ z3.object({
2452
+ status: z3.enum(["cancelled", "already_cancelled", "too_late", "not_found"])
2445
2453
  }),
2446
2454
  bookingPublicErrorSchema
2447
2455
  ]);
@@ -2450,33 +2458,33 @@ var bookingMoveErrorCodes = [
2450
2458
  "booking_not_movable",
2451
2459
  "not_found"
2452
2460
  ];
2453
- var bookingMoveRequestSchema = z2.object({
2454
- bookingId: z2.string().uuid(),
2461
+ var bookingMoveRequestSchema = z3.object({
2462
+ bookingId: z3.string().uuid(),
2455
2463
  newStartUtc: utcDateTimeSchema,
2456
- newResourceId: z2.string().uuid().optional(),
2457
- notifyCustomer: z2.boolean().default(false),
2458
- reason: z2.string().max(500).optional()
2464
+ newResourceId: z3.string().uuid().optional(),
2465
+ notifyCustomer: z3.boolean().default(false),
2466
+ reason: z3.string().max(500).optional()
2459
2467
  });
2460
- var bookingMoveResponseSchema = z2.union([
2461
- z2.object({
2462
- status: z2.literal("moved"),
2463
- bookingId: z2.string().uuid(),
2468
+ var bookingMoveResponseSchema = z3.union([
2469
+ z3.object({
2470
+ status: z3.literal("moved"),
2471
+ bookingId: z3.string().uuid(),
2464
2472
  startUtc: utcDateTimeSchema,
2465
2473
  endUtc: utcDateTimeSchema,
2466
- resourceId: z2.string().uuid()
2474
+ resourceId: z3.string().uuid()
2467
2475
  }),
2468
- z2.object({
2469
- error: z2.enum(bookingMoveErrorCodes),
2470
- message: z2.string().optional(),
2471
- requestId: z2.string().optional()
2476
+ z3.object({
2477
+ error: z3.enum(bookingMoveErrorCodes),
2478
+ message: z3.string().optional(),
2479
+ requestId: z3.string().optional()
2472
2480
  })
2473
2481
  ]);
2474
- var bookingManifestSchema = z2.object({
2475
- schemaVersion: z2.number().int().positive(),
2476
- siteId: z2.string().trim().min(1),
2477
- bookingPageSlug: z2.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).min(2).max(64),
2478
- integration: z2.literal("rewrite").optional(),
2479
- productionOrigin: z2.string().url().optional()
2482
+ var bookingManifestSchema = z3.object({
2483
+ schemaVersion: z3.number().int().positive(),
2484
+ siteId: z3.string().trim().min(1),
2485
+ bookingPageSlug: z3.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).min(2).max(64),
2486
+ integration: z3.literal("rewrite").optional(),
2487
+ productionOrigin: z3.string().url().optional()
2480
2488
  }).passthrough();
2481
2489
  var secretManifestKeys = /* @__PURE__ */ new Set([
2482
2490
  "siteKey",
@@ -2496,21 +2504,21 @@ function redactBookingManifest(value) {
2496
2504
 
2497
2505
  // ../shared/dist/field-id.js
2498
2506
  init_esm_shims();
2499
- import { z as z3 } from "zod";
2507
+ import { z as z4 } from "zod";
2500
2508
  var FIELD_ID_PATTERN = /^[a-z][a-z0-9_-]*(\.[a-z][a-z0-9_-]*)+$/;
2501
- var fieldIdSchema = z3.string().regex(FIELD_ID_PATTERN, "Invalid field id");
2509
+ var fieldIdSchema = z4.string().regex(FIELD_ID_PATTERN, "Invalid field id");
2502
2510
 
2503
2511
  // ../shared/dist/site.js
2504
2512
  init_esm_shims();
2505
- import { z as z4 } from "zod";
2513
+ import { z as z5 } from "zod";
2506
2514
  var SITE_STATUSES = ["active", "disabled", "archived"];
2507
- var siteStatusSchema = z4.enum(SITE_STATUSES);
2515
+ var siteStatusSchema = z5.enum(SITE_STATUSES);
2508
2516
  function normalizeSiteName(value) {
2509
2517
  return value.replace(/[\s\p{Cc}]+/gu, " ").trim();
2510
2518
  }
2511
- var siteNameSchema = z4.string().transform(normalizeSiteName).pipe(z4.string().min(1).max(120));
2512
- var editableBriefSchema = z4.string().nullish().transform((value) => (value ?? "").replace(/\r\n?|[\u000b\u000c\u0085\u2028\u2029]/gu, "\n").replace(/[\u0000-\u0009\u000e-\u001f\u007f-\u009f]/gu, "").replace(/[ \t]+\n/gu, "\n").replace(/\n{3,}/gu, "\n\n").trim()).pipe(z4.string().max(500)).transform((value) => value || null);
2513
- var websiteUrlSchema = z4.string().trim().url().refine((value) => value.startsWith("https://") || value.startsWith("http://"), "Website URL must use http or https");
2519
+ var siteNameSchema = z5.string().transform(normalizeSiteName).pipe(z5.string().min(1).max(120));
2520
+ var editableBriefSchema = z5.string().nullish().transform((value) => (value ?? "").replace(/\r\n?|[\u000b\u000c\u0085\u2028\u2029]/gu, "\n").replace(/[\u0000-\u0009\u000e-\u001f\u007f-\u009f]/gu, "").replace(/[ \t]+\n/gu, "\n").replace(/\n{3,}/gu, "\n\n").trim()).pipe(z5.string().max(500)).transform((value) => value || null);
2521
+ var websiteUrlSchema = z5.string().trim().url().refine((value) => value.startsWith("https://") || value.startsWith("http://"), "Website URL must use http or https");
2514
2522
 
2515
2523
  // ../shared/dist/field-values.js
2516
2524
  init_esm_shims();
@@ -2978,20 +2986,42 @@ import { join as join4 } from "path";
2978
2986
  import ts2 from "typescript";
2979
2987
  var MODULE = "siteplane/components";
2980
2988
  var LAYOUT_FILES = ["layout.tsx", "layout.jsx", "layout.ts", "layout.js"];
2981
- function rendersSiteplaneComponent(source, component) {
2989
+ function reExportedNames(text, component) {
2990
+ const names = /* @__PURE__ */ new Set();
2991
+ if (text === null)
2992
+ return names;
2993
+ for (const statement of ts2.createSourceFile("module.tsx", text, ts2.ScriptTarget.Latest, false, ts2.ScriptKind.TSX).statements) {
2994
+ if (!ts2.isExportDeclaration(statement) || !statement.moduleSpecifier || !ts2.isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== MODULE)
2995
+ continue;
2996
+ const clause = statement.exportClause;
2997
+ if (!clause)
2998
+ names.add(component);
2999
+ else if (ts2.isNamedExports(clause)) {
3000
+ for (const element of clause.elements)
3001
+ if ((element.propertyName ?? element.name).text === component)
3002
+ names.add(element.name.text);
3003
+ }
3004
+ }
3005
+ return names;
3006
+ }
3007
+ function rendersSiteplaneComponent(source, component, readLocal) {
2982
3008
  const file = ts2.createSourceFile("layout.tsx", source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TSX);
2983
3009
  const names = /* @__PURE__ */ new Set();
2984
3010
  for (const statement of file.statements) {
2985
- if (!ts2.isImportDeclaration(statement) || !ts2.isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== MODULE)
3011
+ if (!ts2.isImportDeclaration(statement) || !ts2.isStringLiteral(statement.moduleSpecifier))
2986
3012
  continue;
2987
3013
  const bindings = statement.importClause?.namedBindings;
2988
- if (bindings && ts2.isNamedImports(bindings)) {
3014
+ if (!bindings)
3015
+ continue;
3016
+ const specifier = statement.moduleSpecifier.text;
3017
+ const exported = specifier === MODULE ? /* @__PURE__ */ new Set([component]) : reExportedNames(readLocal?.(specifier) ?? null, component);
3018
+ if (ts2.isNamedImports(bindings)) {
2989
3019
  for (const element of bindings.elements)
2990
- if ((element.propertyName ?? element.name).text === component)
3020
+ if (exported.has((element.propertyName ?? element.name).text))
2991
3021
  names.add(element.name.text);
2992
- }
2993
- if (bindings && ts2.isNamespaceImport(bindings))
2994
- names.add(`${bindings.name.text}.${component}`);
3022
+ } else
3023
+ for (const name of exported)
3024
+ names.add(`${bindings.name.text}.${name}`);
2995
3025
  }
2996
3026
  let rendered = false;
2997
3027
  const visit = (node) => {
@@ -3014,7 +3044,7 @@ function addSiteplaneComponents(source, options) {
3014
3044
  const wanted = [
3015
3045
  { name: "SiteplaneBridge", element: "<SiteplaneBridge />" },
3016
3046
  ...options.analytics ? [{ name: "SiteplaneAnalytics", element: `<SiteplaneAnalytics siteId="${options.siteId}" />` }] : []
3017
- ].filter((component) => !rendersSiteplaneComponent(source, component.name));
3047
+ ].filter((component) => !rendersSiteplaneComponent(source, component.name, options.readLocal));
3018
3048
  if (wanted.length === 0)
3019
3049
  return { status: "already" };
3020
3050
  if (!body)
@@ -3109,18 +3139,25 @@ async function detectNextVersion(root, manifest) {
3109
3139
  return /(\d+\.\d+\.\d+)/u.exec(declared ?? "")?.[1] ?? null;
3110
3140
  }
3111
3141
  async function collectSourceFiles2(root) {
3112
- const configPath = ["tsconfig.json", "jsconfig.json"].map((file) => join5(root, file)).find((path2) => existsSync2(path2));
3113
- let paths;
3114
- if (configPath) {
3115
- const config = ts3.readConfigFile(configPath, ts3.sys.readFile);
3116
- const parsed = ts3.parseJsonConfigFileContent(config.config ?? {}, ts3.sys, root, void 0, configPath);
3117
- paths = parsed.fileNames;
3118
- } else {
3119
- paths = (await Promise.all(FALLBACK_FOLDERS.map((folder) => walk(join5(root, folder))))).flat();
3120
- }
3142
+ const parsed = readTsConfig(root);
3143
+ const paths = parsed ? parsed.fileNames : (await Promise.all(FALLBACK_FOLDERS.map((folder) => walk(join5(root, folder))))).flat();
3121
3144
  const relevant = [...new Set(paths)].map((path2) => relative(root, path2).split(sep).join("/")).filter((path2) => SOURCE_EXTENSIONS.test(path2) && !path2.endsWith(".d.ts") && !path2.startsWith("../") && !path2.split("/").some((part) => SKIPPED_FOLDERS.has(part))).sort();
3122
3145
  return Promise.all(relevant.map(async (path2) => ({ path: path2, text: await readFile4(join5(root, path2), "utf8") })));
3123
3146
  }
3147
+ function readTsConfig(root) {
3148
+ const configPath = ["tsconfig.json", "jsconfig.json"].map((file) => join5(root, file)).find((path2) => existsSync2(path2));
3149
+ if (!configPath)
3150
+ return null;
3151
+ const config = ts3.readConfigFile(configPath, ts3.sys.readFile);
3152
+ return ts3.parseJsonConfigFileContent(config.config ?? {}, ts3.sys, root, void 0, configPath);
3153
+ }
3154
+ function localModuleReader(root, from) {
3155
+ const options = { ...readTsConfig(root)?.options, allowJs: true };
3156
+ return (specifier) => {
3157
+ const resolved = ts3.resolveModuleName(specifier, join5(root, from), options, ts3.sys).resolvedModule;
3158
+ return resolved && !resolved.isExternalLibraryImport ? ts3.sys.readFile(resolved.resolvedFileName) ?? null : null;
3159
+ };
3160
+ }
3124
3161
  async function walk(dir) {
3125
3162
  const entries = await readdir3(dir, { withFileTypes: true }).catch(() => []);
3126
3163
  const nested = await Promise.all(entries.map(async (entry) => {
@@ -3263,7 +3300,10 @@ function scanFields(files) {
3263
3300
  };
3264
3301
  visit(source);
3265
3302
  const readLabels = /* @__PURE__ */ new Set();
3303
+ const passedOn = /* @__PURE__ */ new Set();
3266
3304
  const diagnose = (node) => {
3305
+ if (ts4.isIdentifier(node) && isPassedOn(node))
3306
+ passedOn.add(node.text);
3267
3307
  const target = ts4.isPropertyAccessExpression(node) && node.name.text === "label" ? node.expression : ts4.isElementAccessExpression(node) && node.argumentExpression && ts4.isStringLiteralLike(node.argumentExpression) && node.argumentExpression.text === "label" ? node.expression : null;
3268
3308
  if (target && ts4.isIdentifier(target))
3269
3309
  readLabels.add(target.text);
@@ -3325,7 +3365,7 @@ function scanFields(files) {
3325
3365
  result = result.parent;
3326
3366
  const directLabel = ts4.isPropertyAccessExpression(result.parent) && result.parent.name.text === "label" || ts4.isElementAccessExpression(result.parent) && result.parent.argumentExpression && ts4.isStringLiteralLike(result.parent.argumentExpression) && result.parent.argumentExpression.text === "label";
3327
3367
  const destructured = ts4.isVariableDeclaration(result.parent) && ts4.isObjectBindingPattern(result.parent.name) && result.parent.name.elements.some((element) => (element.propertyName ?? element.name).getText(source) === "label");
3328
- if (directLabel || destructured || link.name && readLabels.has(link.name))
3368
+ if (directLabel || destructured || isPassedOn(result) || link.name && (readLabels.has(link.name) || passedOn.has(link.name)))
3329
3369
  readLinkLabels.add(link.id);
3330
3370
  else
3331
3371
  unreadLinks.set(link.id, { file: file.path, line: link.line });
@@ -3440,6 +3480,10 @@ function siteplaneMethod(call, bindings) {
3440
3480
  }
3441
3481
  return null;
3442
3482
  }
3483
+ function isPassedOn(node) {
3484
+ const parent = node.parent;
3485
+ return ts4.isJsxExpression(parent) && ts4.isJsxAttribute(parent.parent) || ts4.isJsxSpreadAttribute(parent) || ts4.isCallExpression(parent) && parent.arguments.some((argument) => argument === node);
3486
+ }
3443
3487
  function isUnused(call) {
3444
3488
  let node = call;
3445
3489
  while (ts4.isAwaitExpression(node.parent) || ts4.isParenthesizedExpression(node.parent))
@@ -3556,7 +3600,7 @@ async function checkProject(root) {
3556
3600
  if (layouts.length === 0)
3557
3601
  error("layout_missing", `There is no root layout in ${project.appDir}/.`);
3558
3602
  for (const layout of layouts) {
3559
- if (!rendersSiteplaneComponent(await readFile5(join6(root, layout), "utf8"), "SiteplaneBridge")) {
3603
+ if (!rendersSiteplaneComponent(await readFile5(join6(root, layout), "utf8"), "SiteplaneBridge", localModuleReader(root, layout))) {
3560
3604
  error("bridge_missing", 'Render <SiteplaneBridge /> from "siteplane/components" at the end of <body> in the root layout.', layout);
3561
3605
  }
3562
3606
  }
@@ -3813,15 +3857,7 @@ async function initCommand(deps, input) {
3813
3857
  let siteId = input.siteId ?? existing?.siteId;
3814
3858
  const declared = dependencies.siteplane;
3815
3859
  const declaredVersion = typeof declared === "string" && (0, import_semver2.validRange)(declared) ? (0, import_semver2.minVersion)(declared)?.version : null;
3816
- let installed = null;
3817
- try {
3818
- const installedPath = createRequire(join7(deps.root, "package.json")).resolve("siteplane/package.json");
3819
- installed = await readJson(installedPath);
3820
- } catch (error) {
3821
- if (!(error instanceof Error && "code" in error && error.code === "MODULE_NOT_FOUND"))
3822
- throw error;
3823
- }
3824
- const installedVersion = typeof installed?.version === "string" ? (0, import_semver2.valid)(installed.version) : null;
3860
+ const installedVersion = await installedPackageVersion(deps.root);
3825
3861
  const newer = [declaredVersion, installedVersion].filter((version) => Boolean(version && (0, import_semver2.valid)(deps.version) && (0, import_semver2.gt)(version, deps.version))).sort(import_semver2.compare).at(-1);
3826
3862
  if (newer) {
3827
3863
  deps.out(`This project uses siteplane ${newer}; run npx siteplane@${newer} init --site ${siteId ?? "<siteId>"}.`);
@@ -3886,7 +3922,8 @@ async function initCommand(deps, input) {
3886
3922
  const layout = layouts[0];
3887
3923
  const edit = addSiteplaneComponents(await readFile6(join7(deps.root, layout), "utf8"), {
3888
3924
  siteId,
3889
- analytics: task.data.analytics
3925
+ analytics: task.data.analytics,
3926
+ readLocal: localModuleReader(deps.root, layout)
3890
3927
  });
3891
3928
  if (edit.status === "changed") {
3892
3929
  await writeFile3(join7(deps.root, layout), edit.source);
@@ -3909,6 +3946,14 @@ async function initCommand(deps, input) {
3909
3946
  deps.out(formatTask(task.data, deps.version));
3910
3947
  return todo.length ? 1 : 0;
3911
3948
  }
3949
+ async function installedPackageVersion(root) {
3950
+ for (const folder of createRequire(join7(root, "package.json")).resolve.paths("siteplane") ?? []) {
3951
+ const manifest = await readJson(join7(folder, "siteplane", "package.json"));
3952
+ if (manifest)
3953
+ return typeof manifest.version === "string" ? (0, import_semver2.valid)(manifest.version) : null;
3954
+ }
3955
+ return null;
3956
+ }
3912
3957
  async function taskCommand(deps) {
3913
3958
  const config = await requireConfig(deps);
3914
3959
  if (!config)
@@ -3948,7 +3993,7 @@ async function syncCommand(deps) {
3948
3993
  deps.err(notice);
3949
3994
  if (result.data.analyticsEnabled && report.project.appDir) {
3950
3995
  const layouts = await findRootLayouts(deps.root, report.project.appDir);
3951
- const rendered = await Promise.all(layouts.map(async (layout) => rendersSiteplaneComponent(await readFile6(join7(deps.root, layout), "utf8"), "SiteplaneAnalytics")));
3996
+ const rendered = await Promise.all(layouts.map(async (layout) => rendersSiteplaneComponent(await readFile6(join7(deps.root, layout), "utf8"), "SiteplaneAnalytics", localModuleReader(deps.root, layout))));
3952
3997
  if (!rendered.some(Boolean)) {
3953
3998
  report.issues.push({
3954
3999
  severity: "warning",
@@ -4288,14 +4333,14 @@ init_esm_shims();
4288
4333
  import { randomUUID } from "crypto";
4289
4334
  import { chmod, mkdir as mkdir4, open, readFile as readFile7, rename, rm } from "fs/promises";
4290
4335
  import { join as join8 } from "path";
4291
- import { z as z5 } from "zod";
4292
- var storeSchema = z5.object({
4293
- connections: z5.array(z5.object({
4294
- apiOrigin: z5.string().url(),
4295
- siteId: z5.string().min(1),
4296
- accessToken: z5.string().min(1),
4297
- scopes: z5.array(z5.string()),
4298
- expiresAt: z5.string()
4336
+ import { z as z6 } from "zod";
4337
+ var storeSchema = z6.object({
4338
+ connections: z6.array(z6.object({
4339
+ apiOrigin: z6.string().url(),
4340
+ siteId: z6.string().min(1),
4341
+ accessToken: z6.string().min(1),
4342
+ scopes: z6.array(z6.string()),
4343
+ expiresAt: z6.string()
4299
4344
  }))
4300
4345
  });
4301
4346
  function resolveSiteplaneConfigDir(env, platform, homeDir) {
@@ -4353,7 +4398,7 @@ async function writeStore(connections, options) {
4353
4398
 
4354
4399
  // src/version.ts
4355
4400
  init_esm_shims();
4356
- var PACKAGE_VERSION = "0.2.1-rc.0";
4401
+ var PACKAGE_VERSION = "0.2.1-rc.1";
4357
4402
 
4358
4403
  // src/bin/run-siteplane.ts
4359
4404
  var usage = [
package/dist/route.js CHANGED
@@ -114,7 +114,7 @@ async function readBoundedText(request) {
114
114
  }
115
115
 
116
116
  // src/version.ts
117
- var PACKAGE_VERSION = "0.2.1-rc.0";
117
+ var PACKAGE_VERSION = "0.2.1-rc.1";
118
118
 
119
119
  // src/route.ts
120
120
  var embeddable = { httpOnly: true, secure: true, sameSite: "none", partitioned: true, path: "/" };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "siteplane",
3
3
  "private": false,
4
- "version": "0.2.1-rc.0",
4
+ "version": "0.2.1-rc.1",
5
5
  "description": "Siteplane for Next.js websites: editable content with code fallbacks, Draft Mode preview, Booking and the siteplane CLI.",
6
6
  "type": "module",
7
7
  "license": "SEE LICENSE IN LICENSE",