riverbankcms 0.32.2 → 0.33.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.
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { $n as headerStyleIdValues, At as getMimeType, Bt as footerPreferencesSchema, Cr as makeBoundaryId, Et as slugifyMediaIdentifier, Ft as MAX_MANAGEMENT_MEDIA_UPLOAD_BYTES, I as footerModeSchema, Ir as createSiteCommandSiteRef, Jn as asHeaderLayoutId, Kn as SUPPORTED_LOADER_ENDPOINTS, Mt as normalizeAmbiguousStoragePathForSite, Nn as RESOLVED_INTERNAL_LINK_ENTITY_TYPES, Or as createCommandRef, Pt as FILE_SIZE_LIMITS, Qn as headerLayoutIdValues, Sn as eventBookingOfferIntentSchema, Sr as asSiteStyleId, St as buildMediaIdentifierFromFilename, Tt as resolveMediaIdentifier, Un as ICON_PICKER_PRESETS, V as themeSchema, Xt as buttonStyleSelectionSchema, Yn as asHeaderStyleId, Zn as footerLookIdValues, _r as asDesignBoundaryId, at as parseAspectRatioValue, b as getSiteCommandMetadata, bt as mediaTypeDiscriminants, ct as getDirectImageUrlForSiteScopedPath, fr as asAppearancePresetId, gr as asDesignBlockId, h as parseAndPlanCommandBatchForTypes, k as headerPreferencesSchema, kr as createContentEntryRef, kt as getExtensionForMimeType, l as resolvePageUpsertSeo, m as createDryRunReport, n as sdkCourseBookingSettingsSchema, p as stableStringify, qn as asFooterLookId, r as sdkEventOccurrenceInputSchema, rr as SYSTEM_BLOCK_KINDS, s as eventVisibilitySchema, v as evaluateSiteCommandBatchExposure, vt as PUBLIC_FILE_FIELD_KINDS, w as entryIdentifierForCommand, wr as bookingQuestionAttachmentSchema, xn as require_dist, xr as asPageFlowPresetId, y as evaluateSiteCommandExposure, yt as isDisplayMediaKind, zr as slugPart } from "./sdk-event-upsert-B3Ln6jqq.mjs";
3
- import { An as formatCurrencyAmount, Bn as parseMembershipId, C as PUBLIC_AVAILABILITY_FRESHNESS_SECONDS, Cn as isNonNegativeWholeCents$1, Cr as unsafeAsOccurrenceId, D as publicReadBatchFreshnessSeconds, Dn as toNonNegativeCents, E as isPublicReadEndpoint, En as toCents, Er as ok, F as createSecret, Hn as unsafeAsPassId, Ht as resolveBookingTimeZoneId, I as exposeSecret, In as unsafeAsAppointmentResourceId, It as getLocalScheduleDate, J as parseMailingListProviderScope, Jt as validateBookingPaymentOptionKinds, Kt as toUtcIsoDateTimeString, L as parseManagementKey, Ln as unsafeAsStaffMemberId, Mn as assertNever, Nt as formatLocalScheduleDate, O as publicReadFreshnessSeconds, On as unsafeAsNonNegativeCents, Qt as getBookingInstalmentDepositRefundability, Rn as parseCustomerId, Sr as unsafeAsEventSeriesId, T as getPublicReadCachePolicy, Tn as parsePositiveCents, Tr as err, Un as parseDatedOfferingCapacityHoldAuditRef, Wn as parseDatedOfferingCapacityHoldId, Xt as addIntervalPreservingMonthAnchor, Y as parseFooterCompositionV1, Yt as isLiveOrderInstalmentPlanStatus, Zt as clampConfiguredAmount, _ as resolveSiteVerticalBookingConfig, _r as parseEventSeriesId, an as resolveFlexibleBalanceDueAt, at as assertAllowedPublicUrl, bn as fromArray, br as unsafeAsEventInstanceId, cr as unsafeAsOrderPaymentPlanId, d as withBookingModulesForSelectionChange, dt as locationValueSchema, fr as parseApiKeyId, g as parseVerticalPresetId, h as parseVerticalId, ht as publicLocationSchema, in as scheduleBookingReasonCodes, jn as parseCurrencyCode, jt as addLocalScheduleDays, kn as unsafeAsPositiveCents, l as planTurningOnCourses, lr as parseEditorSessionGeneration, lt as stableJsonStringify, m as canonicalizeConfiguredBookingVerticalConfig, mr as parseUserId, n as OFFLINE_PAYMENT_METHODS, nn as splitAmountWithRemainderInFirst, on as resolveFlexibleBalanceInitialPaymentCents, or as unsafeAsCheckoutLineId, p as areConfiguredBookingVerticalConfigsEqual, pr as parseSiteId, r as committedWriteProofSchema, rn as businessCancellationRefusalCodes, sr as unsafeAsOrderFlexibleBalanceContractId, tn as omitZeroAmountFutureRows, u as resolveEventCatalogue, ur as parsePageId, v as DEFAULT_EVENT_TYPE_PRESETS, vr as parseRetiredCourseId, vt as trimmedStringOrNull, w as PUBLIC_CONTENT_FRESHNESS_SECONDS, wn as parseNonNegativeCents, wr as unsafeAsPricingOptionId, x as SURFACE_EVENT_PRESET_VALUES, xr as unsafeAsEventOfferingId, xt as formatDate, y as EVENT_PRESET_VALUES, zt as parseBookingLocalDate } from "./src-wXdYu3yt.mjs";
4
- import { n as CliSdkPeerError, t as loadConfigFile } from "./load-config-CTuNN3xv.mjs";
5
- import { Command } from "commander";
2
+ import { $n as headerStyleIdValues, At as getMimeType, Bt as footerPreferencesSchema, Cr as makeBoundaryId, Et as slugifyMediaIdentifier, Ft as MAX_MANAGEMENT_MEDIA_UPLOAD_BYTES, I as footerModeSchema, Ir as createSiteCommandSiteRef, Jn as asHeaderLayoutId, Kn as SUPPORTED_LOADER_ENDPOINTS, Mt as normalizeAmbiguousStoragePathForSite, Nn as RESOLVED_INTERNAL_LINK_ENTITY_TYPES, Or as createCommandRef, Pt as FILE_SIZE_LIMITS, Qn as headerLayoutIdValues, Sn as eventBookingOfferIntentSchema, Sr as asSiteStyleId, St as buildMediaIdentifierFromFilename, Tt as resolveMediaIdentifier, Un as ICON_PICKER_PRESETS, V as themeSchema, Xt as buttonStyleSelectionSchema, Yn as asHeaderStyleId, Zn as footerLookIdValues, _r as asDesignBoundaryId, at as parseAspectRatioValue, b as getSiteCommandMetadata, bt as mediaTypeDiscriminants, ct as getDirectImageUrlForSiteScopedPath, fr as asAppearancePresetId, gr as asDesignBlockId, h as parseAndPlanCommandBatchForTypes, k as headerPreferencesSchema, kr as createContentEntryRef, kt as getExtensionForMimeType, l as resolvePageUpsertSeo, m as createDryRunReport, n as sdkCourseBookingSettingsSchema, p as stableStringify, qn as asFooterLookId, r as sdkEventOccurrenceInputSchema, rr as SYSTEM_BLOCK_KINDS, s as eventVisibilitySchema, v as evaluateSiteCommandBatchExposure, vt as PUBLIC_FILE_FIELD_KINDS, w as entryIdentifierForCommand, wr as bookingQuestionAttachmentSchema, xn as require_dist, xr as asPageFlowPresetId, y as evaluateSiteCommandExposure, yt as isDisplayMediaKind, zr as slugPart } from "./sdk-event-upsert-Y4Iyx0N4.mjs";
3
+ import { $t as clampConfiguredAmount, An as unsafeAsNonNegativeCents, Bn as parseCustomerId, Cr as unsafeAsEventOfferingId, Ct as formatDate, D as isPublicReadEndpoint, Dn as parsePositiveCents, Dr as err, E as getPublicReadCachePolicy, En as parseNonNegativeCents, Er as unsafeAsPricingOptionId, Ft as formatLocalScheduleDate, Gn as parseDatedOfferingCapacityHoldAuditRef, Hn as parseMembershipId, I as createSecret, Jt as toUtcIsoDateTimeString, Kn as parseDatedOfferingCapacityHoldId, L as exposeSecret, Mn as formatCurrencyAmount, Nn as parseCurrencyCode, Nt as addLocalScheduleDays, O as publicReadBatchFreshnessSeconds, On as toCents, Or as ok, Pn as assertNever, Qt as addIntervalPreservingMonthAnchor, R as parseManagementKey, Rn as unsafeAsAppointmentResourceId, Rt as getLocalScheduleDate, S as SURFACE_EVENT_PRESET_VALUES, Sn as fromArray, Sr as unsafeAsEventInstanceId, T as PUBLIC_CONTENT_FRESHNESS_SECONDS, Tn as isNonNegativeWholeCents$1, Tr as unsafeAsOccurrenceId, Vt as parseBookingLocalDate, Wn as unsafeAsPassId, Wt as resolveBookingTimeZoneId, X as parseFooterCompositionV1, Xt as validateBookingPaymentOptionKinds, Y as parseMailingListProviderScope, Zt as isLiveOrderInstalmentPlanStatus, _ as parseVerticalPresetId, _t as publicLocationSchema, an as businessCancellationRefusalCodes, b as EVENT_PRESET_VALUES, br as parseRetiredCourseId, bt as trimmedStringOrNull, cn as resolveFlexibleBalanceInitialPaymentCents, cr as unsafeAsCheckoutLineId, d as resolveEventCatalogue, dr as parseEditorSessionGeneration, en as getBookingInstalmentDepositRefundability, f as withBookingModulesForSelectionChange, fr as parsePageId, g as parseVerticalId, gr as parseUserId, h as canonicalizeConfiguredBookingVerticalConfig, hr as parseSiteId, in as splitAmountWithRemainderInFirst, jn as unsafeAsPositiveCents, k as publicReadFreshnessSeconds, kn as toNonNegativeCents, lr as unsafeAsOrderFlexibleBalanceContractId, m as areConfiguredBookingVerticalConfigsEqual, mr as parseApiKeyId, n as OFFLINE_PAYMENT_METHODS, o as STAFF_OPERATIONAL_CAPABILITIES, on as scheduleBookingReasonCodes, ot as assertAllowedPublicUrl, pt as locationValueSchema, r as committedWriteProofSchema, rn as omitZeroAmountFutureRows, sn as resolveFlexibleBalanceDueAt, u as planTurningOnCourses, ur as unsafeAsOrderPaymentPlanId, ut as stableJsonStringify, v as resolveSiteVerticalBookingConfig, w as PUBLIC_AVAILABILITY_FRESHNESS_SECONDS, wr as unsafeAsEventSeriesId, y as DEFAULT_EVENT_TYPE_PRESETS, yr as parseEventSeriesId, zn as unsafeAsStaffMemberId } from "./src-90EK8rKq.mjs";
4
+ import { n as CliSdkPeerError, t as loadConfigFile } from "./load-config-CexajivS.mjs";
6
5
  import { safeParse, z } from "zod";
6
+ import { Argument, Command, Option } from "commander";
7
7
  import { AsyncLocalStorage } from "node:async_hooks";
8
8
  import * as fs$1 from "fs/promises";
9
9
  import * as path$1 from "path";
@@ -470,7 +470,7 @@ const retentionPolicyRegistry = {
470
470
  kind: "documented_manual",
471
471
  deferredReason: "depends_on_controller_specific_review"
472
472
  },
473
- rationale: "Ticket summaries and replies are retained for ongoing support and accountability; deleting the account removes the ticket thread."
473
+ rationale: "Ticket summaries and replies are retained for ongoing support and accountability; deleting the account removes the ticket thread. A ticket that came by email has no account, so it stays until removed through a data request."
474
474
  },
475
475
  email_audit_body: {
476
476
  dataClass: "email_audit_body",
@@ -2546,6 +2546,13 @@ const APPOINTMENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
2546
2546
  auth: "user",
2547
2547
  responseKind: "json"
2548
2548
  },
2549
+ makeAppointmentServiceStudio: {
2550
+ path: "/sites/{siteId}/bookings/services/{serviceId}/make-studio",
2551
+ method: "POST",
2552
+ auth: "user",
2553
+ responseKind: "json",
2554
+ errors: []
2555
+ },
2549
2556
  listAvailabilityRules: {
2550
2557
  path: "/sites/{siteId}/bookings/resources/{resourceId}/availability",
2551
2558
  method: "GET",
@@ -11402,6 +11409,7 @@ const BOOKING_PEOPLE_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
11402
11409
  errors: [
11403
11410
  "auth:forbidden",
11404
11411
  "validation:invalid_input",
11412
+ "rate_limit:exceeded",
11405
11413
  "server:internal_error"
11406
11414
  ]
11407
11415
  },
@@ -17555,8 +17563,22 @@ const businessCancellationResultSchema = z.object({
17555
17563
  ]).optional()
17556
17564
  })
17557
17565
  });
17566
+ /** Whether attendees were told about a saved date change, as the dashboard reports it. */
17567
+ const dateNotificationKinds = [
17568
+ z.object({ kind: z.literal("not_applicable") }),
17569
+ z.object({ kind: z.literal("suppressed") }),
17570
+ z.object({ kind: z.literal("no_recipients") }),
17571
+ z.object({ kind: z.literal("submission_failed") }),
17572
+ z.object({
17573
+ kind: z.literal("submitted"),
17574
+ sent: z.number().int().nonnegative(),
17575
+ queued: z.number().int().nonnegative(),
17576
+ failed: z.number().int().nonnegative()
17577
+ })
17578
+ ];
17558
17579
  const sdkEventOccurrenceResponseSchema = z.object({
17559
17580
  occurrence: sdkManagementEventOccurrenceSchema,
17581
+ notification: z.discriminatedUnion("kind", [...dateNotificationKinds]).optional(),
17560
17582
  cancellationResult: businessCancellationResultSchema.optional(),
17561
17583
  cancellationResults: z.array(businessCancellationResultSchema).optional()
17562
17584
  });
@@ -17566,19 +17588,7 @@ const addedDateReceiptSchema = z.object({
17566
17588
  details: z.enum(["completed", "failed"]),
17567
17589
  cache: z.enum(["completed", "failed"]),
17568
17590
  projection: z.enum(["available", "unavailable"]),
17569
- notification: z.discriminatedUnion("kind", [
17570
- z.object({ kind: z.literal("not_applicable") }),
17571
- z.object({ kind: z.literal("suppressed") }),
17572
- z.object({ kind: z.literal("not_attempted") }),
17573
- z.object({ kind: z.literal("no_recipients") }),
17574
- z.object({ kind: z.literal("submission_failed") }),
17575
- z.object({
17576
- kind: z.literal("submitted"),
17577
- sent: z.number().int().nonnegative(),
17578
- queued: z.number().int().nonnegative(),
17579
- failed: z.number().int().nonnegative()
17580
- })
17581
- ])
17591
+ notification: z.discriminatedUnion("kind", [...dateNotificationKinds, z.object({ kind: z.literal("not_attempted") })])
17582
17592
  });
17583
17593
  const sdkAddEventOccurrenceResponseSchema = z.union([sdkEventOccurrenceResponseSchema.extend({ commit: addedDateReceiptSchema.optional() }), z.object({
17584
17594
  kind: z.literal("accepted_unavailable"),
@@ -21322,6 +21332,14 @@ function occurrenceListParams(options = {}) {
21322
21332
  limit: options.limit === undefined ? undefined : String(options.limit)
21323
21333
  }).filter((entry) => entry[1] !== undefined));
21324
21334
  }
21335
+ function savedOccurrence(result) {
21336
+ return {
21337
+ ...result.occurrence,
21338
+ ...result.notification ? { notification: result.notification } : {},
21339
+ ...result.cancellationResult ? { cancellationResult: result.cancellationResult } : {},
21340
+ ...result.cancellationResults ? { cancellationResults: result.cancellationResults } : {}
21341
+ };
21342
+ }
21325
21343
  function createEventOccurrenceOperations(http) {
21326
21344
  return {
21327
21345
  async list(eventIdentifier, runIdentifier, options) {
@@ -21336,11 +21354,11 @@ function createEventOccurrenceOperations(http) {
21336
21354
  },
21337
21355
  async update(eventIdentifier, runIdentifier, occurrenceId, input) {
21338
21356
  const result = await http.patchValidated(occurrencePath(eventIdentifier, runIdentifier, occurrenceId), sdkEventOccurrenceResponseSchema, input);
21339
- return result.occurrence;
21357
+ return savedOccurrence(result);
21340
21358
  },
21341
21359
  async cancel(eventIdentifier, runIdentifier, occurrenceId, options) {
21342
21360
  const result = await http.postValidated(`${occurrencePath(eventIdentifier, runIdentifier, occurrenceId)}/cancel`, sdkEventOccurrenceResponseSchema, options?.notifyAttendees === undefined ? undefined : { notifyAttendees: options.notifyAttendees }, "write");
21343
- return result.occurrence;
21361
+ return savedOccurrence(result);
21344
21362
  },
21345
21363
  async delete(eventIdentifier, runIdentifier, occurrenceId) {
21346
21364
  await http.deleteValidated(occurrencePath(eventIdentifier, runIdentifier, occurrenceId), sdkDeleteEventOccurrenceResponseSchema);
@@ -22852,6 +22870,10 @@ function managementClientConfigFor(env) {
22852
22870
  ...timeout === undefined ? {} : { timeout }
22853
22871
  };
22854
22872
  }
22873
+ /** The one place a CLI management client is built; command modules get it from here or their context. */
22874
+ function managementClientFor(env) {
22875
+ return createManagementClient(managementClientConfigFor(env));
22876
+ }
22855
22877
  /**
22856
22878
  * Build the space-separated command path for the envelope's `command` field,
22857
22879
  * excluding the root program name (e.g. `entry upsert`, `drafts`).
@@ -23078,7 +23100,7 @@ function createCommandContext(command) {
23078
23100
  if (!planned.ok) throw new Error(`${planned.error.message}. ${planned.error.suggestion}`);
23079
23101
  const targetEnv = selection.kind === "single" ? selection.target : "local";
23080
23102
  const env = loadSdkEnvironment(targetEnv);
23081
- const client = createManagementClient(managementClientConfigFor(env));
23103
+ const client = managementClientFor(env);
23082
23104
  return {
23083
23105
  output,
23084
23106
  client,
@@ -23088,6 +23110,14 @@ function createCommandContext(command) {
23088
23110
  selection
23089
23111
  };
23090
23112
  }
23113
+ /** One environment target's settings and management client, for commands that span targets. */
23114
+ function loadManagementTarget(target) {
23115
+ const env = loadSdkEnvironment(target);
23116
+ return {
23117
+ env,
23118
+ client: managementClientFor(env)
23119
+ };
23120
+ }
23091
23121
  /**
23092
23122
  * Get global options and output context without creating a client.
23093
23123
  * Useful when you need to check conditions before creating the client.
@@ -23117,6 +23147,19 @@ function getOutputOnlyContext(command) {
23117
23147
  globalOpts
23118
23148
  };
23119
23149
  }
23150
+ /** What an error message may say about where it happened; env problems just leave the URLs out. */
23151
+ function commandErrorContext(target) {
23152
+ try {
23153
+ const env = loadSdkEnvironment(target);
23154
+ return {
23155
+ target,
23156
+ dashboardUrl: env.dashboardUrl,
23157
+ siteId: env.siteId
23158
+ };
23159
+ } catch {
23160
+ return { target };
23161
+ }
23162
+ }
23120
23163
  /**
23121
23164
  * Handle errors in a consistent way across all commands.
23122
23165
  *
@@ -23142,120 +23185,256 @@ function handleCommandError(error, output, ctx) {
23142
23185
  suggestion: formatted.suggestion
23143
23186
  });
23144
23187
  }
23145
- /**
23146
- * Wrap an async command action with standard error handling.
23147
- *
23148
- * @param action - The async action to wrap
23149
- * @returns Wrapped action that handles errors
23150
- *
23151
- * @example
23152
- * .action(withErrorHandling(async (args, options, command) => {
23153
- * const ctx = createCommandContext(command);
23154
- * // ... command logic
23155
- * }))
23156
- */
23157
- function withErrorHandling(action) {
23158
- return async (...args) => {
23159
- const command = args[args.length - 1];
23160
- const { output, selection } = getOutputContext(command);
23161
- const target = selection.kind === "single" ? selection.target : "local";
23162
- try {
23163
- await action(...args);
23164
- } catch (error) {
23165
- if (error instanceof CliExit) throw error;
23166
- let dashboardUrl;
23167
- let siteId;
23168
- try {
23169
- const env = loadSdkEnvironment(target);
23170
- dashboardUrl = env.dashboardUrl;
23171
- siteId = env.siteId;
23172
- } catch {}
23173
- handleCommandError(error, output, {
23174
- target,
23175
- dashboardUrl,
23176
- siteId
23177
- });
23178
- }
23179
- };
23188
+
23189
+ //#endregion
23190
+ //#region src/define-command.ts
23191
+ const loadContext = Symbol("load-command-context");
23192
+ const errorTarget = Symbol("command-error-target");
23193
+ const installCommand = Symbol("install-command");
23194
+ function commandHandle(command) {
23195
+ return Object.freeze({ [installCommand]: (parent) => {
23196
+ parent.addCommand(command);
23197
+ } });
23198
+ }
23199
+ function registerCommand(parent, handle) {
23200
+ handle[installCommand](parent);
23201
+ }
23202
+ function resolveContext(policy, command) {
23203
+ return typeof policy === "function" ? policy({ isJsonOutput: command.optsWithGlobals().json === true }) : policy[loadContext](command);
23204
+ }
23205
+ /** The target a setup failure should name, for context loading that failed before returning one. */
23206
+ function setupErrorTarget(policy, command) {
23207
+ return typeof policy === "function" ? undefined : policy[errorTarget]?.(command);
23208
+ }
23209
+ function selectedTarget(command) {
23210
+ const { selection } = getOutputContext(command);
23211
+ return selection.kind === "single" ? selection.target : "local";
23212
+ }
23213
+ const commandContexts = {
23214
+ management: {
23215
+ [loadContext]: (command) => {
23216
+ const { output: _output, ...context } = createCommandContext(command);
23217
+ return context;
23218
+ },
23219
+ [errorTarget]: selectedTarget
23220
+ },
23221
+ outputOwner: { [loadContext]: (command) => {
23222
+ const { output, isJsonOutput } = getOutputOnlyContext(command);
23223
+ return {
23224
+ output,
23225
+ isJsonOutput,
23226
+ json: isJsonOutput,
23227
+ targetEnv: "local",
23228
+ invocation: command
23229
+ };
23230
+ } },
23231
+ environments: {
23232
+ [loadContext]: (command) => {
23233
+ const { output, selection, globalOpts } = getOutputContext(command);
23234
+ const json = globalOpts.json === true;
23235
+ return {
23236
+ output,
23237
+ selection,
23238
+ json,
23239
+ isJsonOutput: json,
23240
+ targetEnv: selectedTarget(command),
23241
+ invocation: command,
23242
+ loadTarget: loadManagementTarget
23243
+ };
23244
+ },
23245
+ [errorTarget]: selectedTarget
23246
+ },
23247
+ localFiles: { [loadContext]: (command) => {
23248
+ const { selection, globalOpts } = getOutputContext(command);
23249
+ const planned = planEnvironmentExecution({
23250
+ command: resolveCommandPath(command),
23251
+ selection: "single"
23252
+ }, selection);
23253
+ if (!planned.ok) throw new Error("Local file commands do not support --env=both. Use --env=local (default)");
23254
+ return {
23255
+ targetEnv: "local",
23256
+ isJsonOutput: globalOpts.json === true
23257
+ };
23258
+ } }
23259
+ };
23260
+ /** Returned by a command whose runner already wrote its output, through `ctx.output`. */
23261
+ const renderedByOwner = Symbol("rendered-by-owner");
23262
+ /** Handlers throw this to stop with a structured error; `details` and `suggestion` reach the envelope. */
23263
+ var CommandFailure = class extends Error {
23264
+ constructor(message, info = {}) {
23265
+ super(message);
23266
+ this.info = info;
23267
+ this.name = "CommandFailure";
23268
+ }
23269
+ };
23270
+ function inputSchemas(args, options) {
23271
+ const tuple = new z.ZodTuple({
23272
+ type: "tuple",
23273
+ items: args.map(({ value }) => value),
23274
+ rest: null
23275
+ });
23276
+ const shape = Object.fromEntries(Object.entries(options).map(([name, { value }]) => [name, value]));
23277
+ return {
23278
+ args: tuple,
23279
+ options: z.object(shape)
23280
+ };
23281
+ }
23282
+ function registerOption(command, name, descriptor) {
23283
+ const description = descriptor.required ? `${descriptor.description} (required)` : descriptor.description;
23284
+ const option = new Option(descriptor.flags, description);
23285
+ if (option.attributeName() !== name) throw new Error(`Option ${descriptor.flags} must be declared as ${option.attributeName()}`);
23286
+ if (descriptor.required) option.makeOptionMandatory();
23287
+ if ("default" in descriptor) option.default(descriptor.default);
23288
+ if (descriptor.choices) option.choices([...descriptor.choices]);
23289
+ command.addOption(option);
23290
+ if (descriptor.negation) command.addOption(new Option(`--no-${option.long?.replace(/^--/u, "") ?? name}`, descriptor.negation));
23291
+ }
23292
+ function registerInputs(command, args, options, dryRun) {
23293
+ args.forEach(({ flags, description }) => command.addArgument(new Argument(flags, description)));
23294
+ Object.entries(options).forEach(([name, descriptor]) => {
23295
+ if (dryRun?.before === name) command.option("--dry-run", dryRun.description);
23296
+ registerOption(command, name, descriptor);
23297
+ });
23298
+ if (dryRun && dryRun.before === undefined) command.option("--dry-run", dryRun.description);
23180
23299
  }
23181
23300
  /**
23182
- * Error wrapper for output-only commands. It deliberately skips environment
23183
- * selection and credential loading before invoking the action.
23301
+ * One policy for destructive and explicitly confirmed commands, before any effects.
23302
+ * `remoteOnly` commands need --yes on a remote target and never prompt locally.
23184
23303
  */
23185
- function withOutputOnlyErrorHandling(action) {
23186
- return async (...args) => {
23187
- const command = args[args.length - 1];
23188
- const { output } = getOutputOnlyContext(command);
23189
- try {
23190
- await action(...args);
23191
- } catch (error) {
23192
- if (error instanceof CliExit) throw error;
23193
- handleCommandError(error, output);
23194
- }
23304
+ function decideCommandConfirmation(input) {
23305
+ if (input.dryRun || input.yes) return { kind: "proceed" };
23306
+ if ((input.destructive || input.remoteOnly) && input.remote) return {
23307
+ kind: "refuse",
23308
+ message: "Remote operations require --yes flag for safety"
23195
23309
  };
23310
+ if (input.remoteOnly) return { kind: "proceed" };
23311
+ if (input.json) return {
23312
+ kind: "refuse",
23313
+ message: "Confirmation required. Re-run with --yes in --json mode."
23314
+ };
23315
+ return { kind: "prompt" };
23196
23316
  }
23197
- /**
23198
- * Wrap a command action so handlers receive a resolved command context instead
23199
- * of the raw Commander instance.
23200
- */
23201
- function withCommandContext(action) {
23202
- return withErrorHandling(async (...allArgs) => {
23203
- const command = allArgs[allArgs.length - 1];
23204
- const actionArgs = allArgs.slice(0, -1);
23205
- const ctx = createCommandContext(command);
23206
- await action(ctx, ...actionArgs);
23317
+ /** A rule on the input waits for preparation; `none` and `owner` have nothing to decide here. */
23318
+ function decidedBeforePreparation(confirmation) {
23319
+ return confirmation !== "none" && confirmation !== "owner" && typeof confirmation !== "object";
23320
+ }
23321
+ function remoteYesApplies(confirmation, input) {
23322
+ return typeof confirmation === "object" && confirmation.remoteYesWhen(input);
23323
+ }
23324
+ function yesFlagDescription(confirmation) {
23325
+ return confirmation === "remote-yes" || typeof confirmation === "object" ? "Confirm remote changes" : "Skip confirmation prompt (required for remote destructive runs and JSON writes)";
23326
+ }
23327
+ async function confirmCommand(decision, message, runtime) {
23328
+ switch (decision.kind) {
23329
+ case "proceed": return true;
23330
+ case "prompt": return runtime.confirm(message(), {}, false);
23331
+ }
23332
+ }
23333
+ function renderCommandResult(output, result, json) {
23334
+ if (result === renderedByOwner) return;
23335
+ if (json) output.result(result.ok, result.message, result.data);
23336
+ else if (result.presentation === "document") output.json(result.details);
23337
+ else if (result.presentation === "info") {
23338
+ if (result.table) output.table(result.table.headers, result.table.rows);
23339
+ output.info(result.message);
23340
+ } else {
23341
+ output.result(result.ok, result.message, result.details);
23342
+ if (result.table) output.table(result.table.headers, result.table.rows);
23343
+ }
23344
+ if (!json) result.notes?.forEach((note) => output.info(note));
23345
+ }
23346
+ async function executeCommand(definition, command, output, runtime, ctx) {
23347
+ const schemas = inputSchemas(definition.args, definition.options);
23348
+ const args = schemas.args.parse(command.processedArgs);
23349
+ const options = schemas.options.parse(command.opts());
23350
+ const controls = z.object({
23351
+ yes: z.boolean().default(false),
23352
+ dryRun: z.boolean().default(false)
23353
+ }).parse(command.opts());
23354
+ const decide = (remoteOnly) => decideCommandConfirmation({
23355
+ destructive: definition.destructive === true,
23356
+ remote: ctx.targetEnv === "remote",
23357
+ json: ctx.isJsonOutput,
23358
+ remoteOnly,
23359
+ ...controls
23207
23360
  });
23361
+ const confirmation = definition.confirmation;
23362
+ const decision = decidedBeforePreparation(confirmation) ? decide(confirmation === "remote-yes") : { kind: "proceed" };
23363
+ if (decision.kind === "refuse") return output.error(decision.message);
23364
+ const report = output;
23365
+ const input = {
23366
+ args,
23367
+ options,
23368
+ ctx,
23369
+ report,
23370
+ controls,
23371
+ prepared: await definition.prepare({
23372
+ args,
23373
+ options,
23374
+ ctx,
23375
+ report
23376
+ })
23377
+ };
23378
+ const inputDecision = remoteYesApplies(confirmation, input) ? decide(true) : decision;
23379
+ if (inputDecision.kind === "refuse") return output.error(inputDecision.message);
23380
+ if (!await confirmCommand(decision, () => typeof confirmation === "function" ? confirmation(input) : "", runtime)) {
23381
+ renderCommandResult(output, {
23382
+ ok: true,
23383
+ message: "Operation cancelled",
23384
+ data: { cancelled: true }
23385
+ }, ctx.isJsonOutput);
23386
+ return;
23387
+ }
23388
+ const run = controls.dryRun && definition.dryRun ? definition.dryRun.run : definition.run;
23389
+ renderCommandResult(output, await run(input), ctx.isJsonOutput);
23208
23390
  }
23209
- /**
23210
- * Wrap a destructive command action with confirmation prompt and error handling.
23211
- *
23212
- * @param getMessage - Function that builds the confirmation message from command args
23213
- * @param action - The async action to perform after confirmation
23214
- * @returns Wrapped action that confirms, then executes with error handling
23215
- *
23216
- * @example
23217
- * .action(withConfirmation(
23218
- * (type, identifier) => `Delete entry "${type}/${identifier}"?`,
23219
- * async (ctx, type, identifier) => {
23220
- * ctx.output.info(`Deleting entry: ${type}/${identifier}`);
23221
- * await ctx.client.entries.delete(type, identifier);
23222
- * ctx.output.success(`Entry deleted: ${identifier}`);
23223
- * }
23224
- * ))
23225
- */
23226
- function withConfirmation(getMessage, action) {
23227
- return async (...allArgs) => {
23228
- const command = allArgs[allArgs.length - 1];
23229
- const options = allArgs[allArgs.length - 2];
23230
- const args = allArgs.slice(0, -2);
23231
- const ctx = createCommandContext(command);
23232
- const { output, isJsonOutput } = ctx;
23233
- if (isJsonOutput && !options.yes) {
23234
- return output.error("Confirmation required. Re-run with --yes in --json mode.", { suggestion: "Destructive commands do not prompt under --json; pass --yes to proceed." });
23235
- }
23236
- const confirmed = await confirmAction(getMessage(...args), options, ctx.targetEnv === "remote");
23237
- if (!confirmed) {
23238
- output.info("Operation cancelled");
23239
- return;
23240
- }
23391
+ function mapCommandError(error, output, target) {
23392
+ if (error instanceof CliExit) throw error;
23393
+ if (error instanceof CommandFailure) output.error(error.message, error.info);
23394
+ if (error instanceof z.ZodError) output.error("Invalid command input", { details: z.prettifyError(error) });
23395
+ handleCommandError(error, output, target ? commandErrorContext(target) : undefined);
23396
+ }
23397
+ async function executeWithContext(definition, command, output, runtime) {
23398
+ const ctx = resolveContext(definition.context, command);
23399
+ try {
23400
+ await executeCommand(definition, command, output, runtime, ctx);
23401
+ } catch (error) {
23402
+ mapCommandError(error, output, typeof definition.context === "function" ? ctx.targetEnv : setupErrorTarget(definition.context, command));
23403
+ }
23404
+ }
23405
+ /** Commander is an untyped boundary: schemas parse it once; run receives inferred values. */
23406
+ function definePreparedCommand(definition, runtime = { confirm: confirmAction }) {
23407
+ const command = new Command(definition.name).description(definition.description);
23408
+ if (definition.help) command.addHelpText("after", definition.help);
23409
+ registerInputs(command, definition.args, definition.options, definition.dryRun);
23410
+ if (definition.confirmation === "owner") {
23411
+ if (definition.ownedFlags?.dryRun) command.option("--dry-run", definition.ownedFlags.dryRun);
23412
+ if (definition.ownedFlags?.yes) command.option("--yes", definition.ownedFlags.yes);
23413
+ } else if (definition.confirmation !== "none") {
23414
+ command.option("--yes", yesFlagDescription(definition.confirmation));
23415
+ }
23416
+ return command.action(async () => {
23417
+ const output = createOutputForCommand(command);
23241
23418
  try {
23242
- await action(ctx, ...args);
23419
+ await executeWithContext(definition, command, output, runtime);
23243
23420
  } catch (error) {
23244
- if (error instanceof CliExit) throw error;
23245
- let dashboardUrl;
23246
- let siteId;
23247
- try {
23248
- const env = loadSdkEnvironment(ctx.targetEnv);
23249
- dashboardUrl = env.dashboardUrl;
23250
- siteId = env.siteId;
23251
- } catch {}
23252
- handleCommandError(error, output, {
23253
- target: ctx.targetEnv,
23254
- dashboardUrl,
23255
- siteId
23256
- });
23421
+ mapCommandError(error, output, setupErrorTarget(definition.context, command));
23257
23422
  }
23258
- };
23423
+ });
23424
+ }
23425
+ function defineCommand(definition, runtime = { confirm: confirmAction }) {
23426
+ if (!definition.prepare) return commandHandle(definePreparedCommand({
23427
+ ...definition,
23428
+ prepare: async () => undefined
23429
+ }, runtime));
23430
+ return commandHandle(definePreparedCommand(definition, runtime));
23431
+ }
23432
+ /** A group composes handles without giving command modules access to Commander. */
23433
+ function defineCommandGroup(definition) {
23434
+ const group = new Command(definition.name).description(definition.description);
23435
+ if (definition.help) group.addHelpText("after", definition.help);
23436
+ definition.commands.forEach((child) => registerCommand(group, child));
23437
+ return commandHandle(group);
23259
23438
  }
23260
23439
 
23261
23440
  //#endregion
@@ -24741,7 +24920,7 @@ function buildPreviewSummary(sync) {
24741
24920
  }
24742
24921
 
24743
24922
  //#endregion
24744
- //#region src/legacy/push-config.ts
24923
+ //#region src/push-config.ts
24745
24924
  /**
24746
24925
  * push-config CLI command
24747
24926
  *
@@ -25098,7 +25277,7 @@ function renderPushConfigJsonResult(output, execution, dryRun) {
25098
25277
  }
25099
25278
  function getProductionPushConfigCommandDeps() {
25100
25279
  return {
25101
- getOutputContext,
25280
+ context: commandContexts.environments,
25102
25281
  planEnvironmentExecution,
25103
25282
  executeEnvironmentPlan,
25104
25283
  confirmAction,
@@ -25111,7 +25290,10 @@ function getProductionPushConfigCommandDeps() {
25111
25290
  /**
25112
25291
  * push-config command definition
25113
25292
  */
25114
- const createPushConfigCommand = (deps = getProductionPushConfigCommandDeps()) => new Command("push-config").description("Push SDK config to dashboard").option("--api-key <key>", "Management API key (or set RIVERBANK_*_MGMT_API_KEY)").option("--dashboard <url>", "Dashboard URL (or set RIVERBANK_*_DASHBOARD_URL env var)").option("--config <path>", `Path to config file (default: ${DEFAULT_CONFIG_PATH})`).option("--force-content-types", "Force overwrite content type schema even if modified in dashboard after last SDK sync").option("--dry-run", "Preview SDK config changes without updating the dashboard").option("--yes", "Confirm applying config changes across all selected environments").addHelpText("after", `
25293
+ const createPushConfigCommand = (deps = getProductionPushConfigCommandDeps()) => defineCommand({
25294
+ name: "push-config",
25295
+ description: "Push SDK config to dashboard",
25296
+ help: `
25115
25297
  Description:
25116
25298
  Syncs your local riverbank.config.ts schema/config to the CMS dashboard, including:
25117
25299
  - Custom blocks
@@ -25130,49 +25312,83 @@ Examples:
25130
25312
  $ pnpm exec riverbankcms push-config --env=remote
25131
25313
  $ pnpm exec riverbankcms push-config --api-key bld_mgmt_sk_... --dashboard https://www.riverbankcms.com
25132
25314
  $ pnpm exec riverbankcms push-config --config ./src/riverbank.config.ts
25133
- `).action(async (options, command) => {
25134
- const { output, selection, globalOpts } = deps.getOutputContext(command);
25135
- const isJsonOutput = globalOpts.json ?? false;
25136
- const authorization = requireEnvironmentWriteAuthorization({
25137
- ...options,
25138
- json: isJsonOutput,
25139
- interactive: process.stdin.isTTY === true
25140
- }, output);
25141
- if (!authorization) return;
25142
- const planned = deps.planEnvironmentExecution({
25143
- command: "push-config",
25144
- selection: "both",
25145
- failure: "abort",
25146
- confirmation: "command",
25147
- revalidation: "required"
25148
- }, selection);
25149
- if (!planned.ok) return output.error(planned.error.message, { suggestion: planned.error.suggestion });
25150
- const execution = await deps.executeEnvironmentPlan(planned.value, {
25151
- loadTarget: (target) => deps.loadTarget(target, options),
25152
- preflight: async (_target, loaded) => deps.prepareTarget(loaded.context, {
25153
- ...options,
25154
- dashboard: loaded.context.dashboard
25155
- }),
25156
- confirm: async ({ ready }) => {
25157
- if (authorization.kind === "preauthorized") return true;
25158
- for (const { target, context } of ready) {
25159
- const sync = getPushConfigSync(context.preview);
25160
- output.info(`${target} config preview`, sync ? buildPreviewSummary(sync) : { changes: "No sync summary returned" });
25161
- }
25162
- return deps.confirmAction(`Apply SDK config to ${ready.length} environment${ready.length === 1 ? "" : "s"} (${ready.map(({ target }) => target).join(" then ")})?`, { yes: options.yes }, false);
25315
+ `,
25316
+ args: [],
25317
+ options: {
25318
+ apiKey: {
25319
+ flags: "--api-key <key>",
25320
+ description: "Management API key (or set RIVERBANK_*_MGMT_API_KEY)",
25321
+ value: z.string().optional()
25322
+ },
25323
+ dashboard: {
25324
+ flags: "--dashboard <url>",
25325
+ description: "Dashboard URL (or set RIVERBANK_*_DASHBOARD_URL env var)",
25326
+ value: z.string().optional()
25327
+ },
25328
+ config: {
25329
+ flags: "--config <path>",
25330
+ description: `Path to config file (default: ${DEFAULT_CONFIG_PATH})`,
25331
+ value: z.string().optional()
25163
25332
  },
25164
- revalidate: async (_target, loaded, prepared) => options.dryRun ? { ok: true } : deps.revalidatePlan(loaded.context, prepared.context),
25165
- apply: async (target, loaded, prepared) => {
25166
- if (planned.value.targets.length > 1) output.info(`\n--- Pushing to ${target} environment ---`);
25167
- return deps.applyPlan(output, loaded.context, prepared.context, {
25333
+ forceContentTypes: {
25334
+ flags: "--force-content-types",
25335
+ description: "Force overwrite content type schema even if modified in dashboard after last SDK sync",
25336
+ value: z.boolean().optional()
25337
+ }
25338
+ },
25339
+ context: deps.context,
25340
+ confirmation: "owner",
25341
+ ownedFlags: {
25342
+ dryRun: "Preview SDK config changes without updating the dashboard",
25343
+ yes: "Confirm applying config changes across all selected environments"
25344
+ },
25345
+ run: async ({ options: flags, controls, ctx: { output, selection, json: isJsonOutput } }) => {
25346
+ const options = {
25347
+ ...flags,
25348
+ ...controls
25349
+ };
25350
+ const authorization = requireEnvironmentWriteAuthorization({
25351
+ ...options,
25352
+ json: isJsonOutput,
25353
+ interactive: process.stdin.isTTY === true
25354
+ }, output);
25355
+ if (!authorization) return renderedByOwner;
25356
+ const planned = deps.planEnvironmentExecution({
25357
+ command: "push-config",
25358
+ selection: "both",
25359
+ failure: "abort",
25360
+ confirmation: "command",
25361
+ revalidation: "required"
25362
+ }, selection);
25363
+ if (!planned.ok) throw new CommandFailure(planned.error.message, { suggestion: planned.error.suggestion });
25364
+ const execution = await deps.executeEnvironmentPlan(planned.value, {
25365
+ loadTarget: (target) => deps.loadTarget(target, options),
25366
+ preflight: async (_target, loaded) => deps.prepareTarget(loaded.context, {
25168
25367
  ...options,
25169
25368
  dashboard: loaded.context.dashboard
25170
- }, isJsonOutput);
25171
- },
25172
- isSuccess: isPushConfigApplySuccess,
25173
- formatFailure: formatPushConfigActionFailure
25174
- }, output);
25175
- if (isJsonOutput) renderPushConfigJsonResult(output, execution, options.dryRun ?? false);
25369
+ }),
25370
+ confirm: async ({ ready }) => {
25371
+ if (authorization.kind === "preauthorized") return true;
25372
+ for (const { target, context } of ready) {
25373
+ const sync = getPushConfigSync(context.preview);
25374
+ output.info(`${target} config preview`, sync ? buildPreviewSummary(sync) : { changes: "No sync summary returned" });
25375
+ }
25376
+ return deps.confirmAction(`Apply SDK config to ${ready.length} environment${ready.length === 1 ? "" : "s"} (${ready.map(({ target }) => target).join(" then ")})?`, { yes: options.yes }, false);
25377
+ },
25378
+ revalidate: async (_target, loaded, prepared) => options.dryRun ? { ok: true } : deps.revalidatePlan(loaded.context, prepared.context),
25379
+ apply: async (target, loaded, prepared) => {
25380
+ if (planned.value.targets.length > 1) output.info(`\n--- Pushing to ${target} environment ---`);
25381
+ return deps.applyPlan(output, loaded.context, prepared.context, {
25382
+ ...options,
25383
+ dashboard: loaded.context.dashboard
25384
+ }, isJsonOutput);
25385
+ },
25386
+ isSuccess: isPushConfigApplySuccess,
25387
+ formatFailure: formatPushConfigActionFailure
25388
+ }, output);
25389
+ if (isJsonOutput) renderPushConfigJsonResult(output, execution, options.dryRun ?? false);
25390
+ return renderedByOwner;
25391
+ }
25176
25392
  });
25177
25393
 
25178
25394
  //#endregion
@@ -26064,11 +26280,6 @@ async function acceptSiteInvitation(apiClient, { body, options }) {
26064
26280
 
26065
26281
  //#endregion
26066
26282
  //#region ../api/src/staffAccess.ts
26067
- const STAFF_OPERATIONAL_CAPABILITIES = [
26068
- "appointments",
26069
- "event_ops",
26070
- "packages"
26071
- ];
26072
26283
  function roleAtLeast$1(role, minimum) {
26073
26284
  return SITE_ROLE_PERMISSION_LEVEL[role] >= SITE_ROLE_PERMISSION_LEVEL[minimum];
26074
26285
  }
@@ -26104,40 +26315,49 @@ function deriveStaffScope(input) {
26104
26315
  staffMemberId
26105
26316
  };
26106
26317
  }
26107
- if (persistedCapabilities.length === 0) {
26108
- return {
26109
- kind: "staff_setup_required",
26110
- reason: "missing_capabilities"
26111
- };
26112
- }
26113
- const packages = persistedCapabilities.includes("packages") ? { packages: true } : {};
26114
- if (!persistedCapabilities.includes("appointments") && !persistedCapabilities.includes("event_ops")) {
26115
- return {
26116
- kind: "packages_only",
26117
- staffMemberId,
26118
- packages: true
26119
- };
26120
- }
26121
- if (persistedCapabilities.includes("appointments") && persistedCapabilities.includes("event_ops")) {
26122
- return {
26123
- kind: "hybrid",
26124
- staffMemberId,
26125
- ...packages
26126
- };
26127
- }
26128
- if (persistedCapabilities.includes("event_ops")) {
26129
- return {
26130
- kind: "event_ops_only",
26131
- staffMemberId,
26132
- ...packages
26133
- };
26134
- }
26135
- return {
26136
- kind: "appointments",
26137
- staffMemberId,
26138
- ...packages
26139
- };
26318
+ return deriveCapabilityScope(staffMemberId, persistedCapabilities);
26319
+ }
26320
+ }
26321
+ /**
26322
+ * What a linked team member's stored access adds up to. `own_offerings` only
26323
+ * counts beside Appointments and Packages, so "can create but can't book or
26324
+ * sell" can't arise, and alone it isn't access to anything.
26325
+ */
26326
+ function deriveCapabilityScope(staffMemberId, capabilities) {
26327
+ const appointments = capabilities.includes("appointments");
26328
+ const eventOps = capabilities.includes("event_ops");
26329
+ const hasPackages = capabilities.includes("packages");
26330
+ if (!appointments && !eventOps && !hasPackages) {
26331
+ return {
26332
+ kind: "staff_setup_required",
26333
+ reason: "missing_capabilities"
26334
+ };
26335
+ }
26336
+ if (!appointments && !eventOps) {
26337
+ return {
26338
+ kind: "packages_only",
26339
+ staffMemberId,
26340
+ packages: true
26341
+ };
26140
26342
  }
26343
+ const packages = hasPackages ? { packages: true } : {};
26344
+ if (!appointments) return {
26345
+ kind: "event_ops_only",
26346
+ staffMemberId,
26347
+ ...packages
26348
+ };
26349
+ const extras = {
26350
+ ...packages,
26351
+ ...ownOfferingsGrant(capabilities)
26352
+ };
26353
+ return {
26354
+ kind: eventOps ? "hybrid" : "appointments",
26355
+ staffMemberId,
26356
+ ...extras
26357
+ };
26358
+ }
26359
+ function ownOfferingsGrant(capabilities) {
26360
+ return capabilities.includes("packages") && capabilities.includes("own_offerings") ? { ownOfferings: true } : {};
26141
26361
  }
26142
26362
  function isStaffScoped(scope) {
26143
26363
  return scope.kind !== "none";
@@ -26151,6 +26371,16 @@ function hasAppointmentStaffAccess(scope) {
26151
26371
  function hasPackageStaffAccess(scope) {
26152
26372
  return "packages" in scope && scope.packages === true;
26153
26373
  }
26374
+ function hasOwnOfferingsAccess(scope) {
26375
+ return "ownOfferings" in scope && scope.ownOfferings === true;
26376
+ }
26377
+ /**
26378
+ * Own offerings needs Appointments and Packages beside it. Null when the
26379
+ * combination is fine, and otherwise the words to show whoever chose it.
26380
+ */
26381
+ function staffCapabilityCombinationProblem(capabilities) {
26382
+ return capabilities.includes("own_offerings") && !(capabilities.includes("appointments") && capabilities.includes("packages")) ? "Give them Appointments and Packages too, so they can offer what they create." : null;
26383
+ }
26154
26384
  function hasEventOpsAccess(scope) {
26155
26385
  return scope.kind === "event_ops_only" || scope.kind === "hybrid";
26156
26386
  }
@@ -26930,7 +27160,7 @@ const DASHBOARD_SETTINGS_NAV_GROUPS = [
26930
27160
  label: "Team & Billing",
26931
27161
  items: [{
26932
27162
  id: "settings.team",
26933
- label: "Members",
27163
+ label: "Team",
26934
27164
  keywords: [
26935
27165
  "team",
26936
27166
  "roles",
@@ -27074,6 +27304,11 @@ function buildDashboardTeamMemberNavPlan(ctx) {
27074
27304
  resourceId: ownResourceId
27075
27305
  }
27076
27306
  }] : [],
27307
+ ...hasOwnOfferingsAccess(ctx.staffScope) ? [{
27308
+ id: "team.services",
27309
+ label: "Services",
27310
+ destination: { kind: "appointment_services" }
27311
+ }] : [],
27077
27312
  ...hasPackageStaffAccess(ctx.staffScope) ? [{
27078
27313
  id: "team.packages",
27079
27314
  label: "Packages",
@@ -27528,20 +27763,21 @@ function isDemoShopNavSurfaceVisible(mode, surfaceId) {
27528
27763
 
27529
27764
  //#endregion
27530
27765
  //#region ../api/src/navigation/dashboardBookingsNav.ts
27766
+ function staffScopedBookingsNavPolicy(modules, staffScope) {
27767
+ return {
27768
+ kind: "staff_scoped",
27769
+ appointments: modules.appointments && hasAppointmentStaffAccess(staffScope) ? {
27770
+ kind: "calendar",
27771
+ ownResourceId: getOwnAppointmentResourceId(staffScope)
27772
+ } : { kind: "hidden" },
27773
+ packages: modules.appointments && hasPackageStaffAccess(staffScope),
27774
+ services: modules.appointments && hasOwnOfferingsAccess(staffScope)
27775
+ };
27776
+ }
27531
27777
  function resolveDashboardBookingsNavPolicy(modules, ctx) {
27532
27778
  const { role } = ctx;
27533
27779
  const { showStaffScopedNavigation, staffScope } = ctx.teamMember;
27534
- const ownResourceId = getOwnAppointmentResourceId(staffScope);
27535
- if (showStaffScopedNavigation && isStaffScoped(staffScope)) {
27536
- return {
27537
- kind: "staff_scoped",
27538
- appointments: modules.appointments && hasAppointmentStaffAccess(staffScope) ? {
27539
- kind: "calendar",
27540
- ownResourceId
27541
- } : { kind: "hidden" },
27542
- packages: modules.appointments && hasPackageStaffAccess(staffScope)
27543
- };
27544
- }
27780
+ if (showStaffScopedNavigation && isStaffScoped(staffScope)) return staffScopedBookingsNavPolicy(modules, staffScope);
27545
27781
  if (modules.appointments) {
27546
27782
  return {
27547
27783
  kind: "full",
@@ -27587,7 +27823,8 @@ function buildDashboardBookingsNavPlan(modules, ctx, catalogue) {
27587
27823
  "check in",
27588
27824
  "tickets",
27589
27825
  "attendees"
27590
- ]
27826
+ ],
27827
+ ...ctx.publicExperience === "hosted_booking" ? { unlisted: true } : {}
27591
27828
  }
27592
27829
  ] : [{
27593
27830
  label: "Enable events",
@@ -27637,6 +27874,13 @@ function buildDashboardBookingsNavPlan(modules, ctx, catalogue) {
27637
27874
  }
27638
27875
  return groups;
27639
27876
  }
27877
+ /** What the sidebar lists: the plan without its unlisted items. */
27878
+ function listedBookingsNavGroups(groups) {
27879
+ return groups.map((group) => ({
27880
+ ...group,
27881
+ items: group.items.filter((item) => !item.unlisted)
27882
+ })).filter((group) => group.items.length > 0);
27883
+ }
27640
27884
  const BOOKING_SETTINGS_SECTION_KEYWORDS = {
27641
27885
  basics: [
27642
27886
  "defaults",
@@ -27678,6 +27922,7 @@ function buildBookingSettingsNavItem(modules) {
27678
27922
  const sections = visibleBookingSettingsSections(modules);
27679
27923
  return {
27680
27924
  label: "Settings",
27925
+ icon: "settings",
27681
27926
  destination: {
27682
27927
  kind: "booking_settings",
27683
27928
  section: "basics"
@@ -27765,7 +28010,8 @@ function buildAppointmentsNavGroup(policy, soloSite) {
27765
28010
  "intake",
27766
28011
  "custom fields",
27767
28012
  "questionnaire"
27768
- ]
28013
+ ],
28014
+ unlisted: true
27769
28015
  }
27770
28016
  ]
27771
28017
  };
@@ -27819,7 +28065,7 @@ function buildOverviewNavGroup(hasEnabledModules, publicExperience) {
27819
28065
  };
27820
28066
  }
27821
28067
  function buildStaffScopedBookingsNavPlan(policy) {
27822
- return [...policy.appointments.kind === "calendar" ? [buildStaffAppointmentsNavGroup(policy.appointments.ownResourceId, !policy.packages)] : [], ...policy.packages ? [staffPackagesNavGroup] : []];
28068
+ return [...policy.appointments.kind === "calendar" ? [buildStaffAppointmentsNavGroup(policy.appointments.ownResourceId, !policy.packages)] : [], ...policy.packages ? [policy.services ? staffServicesAndPackagesNavGroup : staffPackagesNavGroup] : []];
27823
28069
  }
27824
28070
  const staffClientsNavItem = {
27825
28071
  label: "My Clients",
@@ -27844,6 +28090,19 @@ const staffPackagesNavGroup = {
27844
28090
  ]
27845
28091
  }, staffClientsNavItem]
27846
28092
  };
28093
+ const staffServicesAndPackagesNavGroup = {
28094
+ label: "Services and packages",
28095
+ items: [{
28096
+ label: "Services",
28097
+ destination: { kind: "appointment_services" },
28098
+ keywords: [
28099
+ "services",
28100
+ "sessions",
28101
+ "prices",
28102
+ "offer"
28103
+ ]
28104
+ }, ...staffPackagesNavGroup.items]
28105
+ };
27847
28106
  function buildStaffAppointmentsNavGroup(ownResourceId, includeClients) {
27848
28107
  const appointmentItems = [{
27849
28108
  label: "Appointments",
@@ -27943,7 +28202,8 @@ function buildPageSectionsNavItems(ctx) {
27943
28202
  "sections",
27944
28203
  "event template",
27945
28204
  "faq"
27946
- ]
28205
+ ],
28206
+ ...ctx.publicExperience === "hosted_booking" ? { unlisted: true } : {}
27947
28207
  }];
27948
28208
  }
27949
28209
  function buildEventSeriesPresetNavItem(entry) {
@@ -34404,4 +34664,4 @@ function optionalTitle(data) {
34404
34664
  }
34405
34665
 
34406
34666
  //#endregion
34407
- export { normalizeMediaValueToIdentifierOnly as $, resolveRepeaterGridSpanFieldId as $n, normalizeCalendarFilterId as $r, bindRequestTimeout as $t, formatDiffDetail as A, getEnvPrefix as An, resolveAvailableBookingCollectionOptions as Ar, navigationIdentity as At, buildFieldChanges as B, NodeSchema as Bn, publicMembershipProductSchema as Br, ACCOUNT_SITE_LIST_LIMIT_MIN as Bt, reportFromOutcomes as C, requireEnvironmentWriteAuthorization as Cn, checkoutCopy as Cr, fileExists$1 as Ct, normalizeRemoteHomepageReference as D, transportSuggestion as Dn, flexibleBalanceDueDay as Dr, writeJsonFileAtomic as Dt, createEmptySyncResult as E, formatError as En, planFlexibleBalanceCreditFirst as Er, writeJsonFile$1 as Et, calculatePullDiff as F, createManagementClient as Fn, eventCalendarDefaultViewValues as Fr, AccountApiMalformedResponseError as Ft, syncLocalMediaForPull as G, blockContentSourceSchema as Gn, CALENDAR_SSR_PAGE_SIZE as Gr, applyPushConfigPlan as Gt, formatFieldPath as H, bindingSchema as Hn, publicProductSchema as Hr, ACCOUNT_SITE_TITLE_MAX_LENGTH as Ht, buildJsonDiff as I, cardListBlockParts as In, eventCalendarDisplayModeValues as Ir, createBearerAccountApi as It, admitBinaryWriteDestination as J, MAX_REPEATER_GRID_COLUMNS as Jn, calendarSourceCursorSchema as Jr, preparePushConfigTarget as Jt, applyLocalMediaPush as K, blockRequiredFeatureSchema as Kn, calendarMonthDate as Kr, createPushConfigCommand as Kt, hasPageOperations as L, cardListFamilyBlocks as Ln, eventCalendarListLayoutCompatibleDisplayModeValues as Lr, ACCOUNT_SITE_CURSOR_MAX_LENGTH as Lt, hasPendingChanges as M, isLocalConfigured as Mn, getStripeMinimumChargeRequirement as Mr, convertPulledFooterToLocal as Mt, findChangedFieldsWithValues as N, isRemoteConfigured as Nn, getBookingLaterInstalments as Nr, convertPulledNavigationToLocal as Nt, calculateDiff as O, CliExit as On, isBookingCollectionEquivalentToUpfront as Or, isMediaValue as Ot, formatHumanDiff as P, loadSdkEnvironment as Pn, MAX_EVENT_BOOKING_SELECTION_ITEMS as Pr, convertPulledPagesToLocal as Pt, normalizeMediaIdentifierInput as Q, resolveRepeaterGridRowFieldId as Qn, monthNumber as Qr, mapEnvironmentExecutionOutcomesJson as Qt, pageMetadataForUpsert as R, cardListKnobBlocks as Rn, eventCalendarListLayoutValues as Rr, ACCOUNT_SITE_LIST_LIMIT_DEFAULT as Rt, planCliCommandBatchForBindings as S, planEnvironmentWriteAuthorization as Sn, eventRegistrationErrors as Sr, ensureDir$1 as St, executeResidualSettingsSyncPlan as T, ErrorCodes as Tn, planCheckoutPaymentFlow as Tr, readJsonFile as Tt, revalidateLocalMediaPushPlan as U, DEFAULT_MEDIA_FIELD_KINDS as Un, purchasablePublicMembershipProductSchema as Ur, navigationCommandItemToManagementInput as Ut, formatFieldChange as V, NodeTreeSchema as Vn, publicPassProductSchema as Vr, ACCOUNT_SITE_SEARCH_MAX_LENGTH as Vt, syncLocalMediaForPush as W, blockCategoryEnum as Wn, purchasablePublicPassProductSchema as Wr, normalizeNavigationConfigItemForCommand as Wt, writeBinaryFileAtomic as X, parseRepeaterGridInteger as Xn, eventSurfacePresetValues as Xr, createBearerAPIClient as Xt, readStableBinaryFile as Y, isAcceptedRepeaterGridSpan as Yn, eventScheduleScopeValues as Yr, revalidatePushConfigPlan as Yt, sha256 as Z, resolveRepeaterGridColumnFieldId as Zn, eventSurfaceScopeValues as Zr, deriveCmsApiUrlFromDashboardUrl as Zt, commandExecutionToReport as _, withErrorHandling as _n, decideSelectionAttendance as _r, metadataFilePath as _t, executeEntryCommandPlanAsReport as a, getOutputContext as an, ApiRequestError as ar, readEntries as at, executeCompiledCliCommandPlanAsReport as b, parseEnvironmentSelection as bn, nextCombinationHint as br, writeMetadataFile as bt, titleFromEntryData as c, managementClientConfigFor as cn, linkPayloadSchema as cr, readEventsMeta as ct, unsafeAsCliEntryIdentifier as d, parseJsonData as dn, pageDesignIntentSchemaVersion as dr, readNavigationMeta as dt, publicEventLoaderQuerySchemaShape as ei, confirmAction as en, visibilityLevels as er, walkLocalContentMedia as et, unsafeAsCliFormSlug as f, parsePaginationOptions as fn, sdkConfiguredBookingVerticalConfigSchema as fr, readPagesMeta as ft, commandCompileFailureToReport as g, withConfirmation as gn, INCOMPATIBLE_ATTENDANCE_MESSAGE as gr, ensureMetadataDir as gt, mutationCounterForEffect as h, withCommandContext as hn, eventBookingConsentContentKey as hr, writeMediaManifest as ht, entrySiteCommandTypes as i, formatDateShort as in, isRecord$5 as ir, findLegacyEntryFiles as it, formatDiffSummary as j, getEnvironmentDebugInfo as jn, resolveBookingCollectionOptionFacts as jr, navigationIdentityMap as jt, calculateFooterDiff as k, createOutput as kn, repriceBookingCollectionOptions as kr, duplicateNavigationIdentityMessage as kt, unsafeAsCliBlockIdentifier as l, mapEntryForOutput as ln, portablePageDesignSchema as lr, readFooterMeta as lt, commandReportToSyncResult as m, runWithInvocation as mn, areEventBookingRequirementsIdentical as mr, readVenuesMeta as mt, entryCommandCompileErrorToReport as n, unwrapResponse as ni, createOutputForCommand as nn, extractApiErrorMessage as nr, downloadMedia as nt, executeEntryCommandPlanAsSyncResult as o, getOutputOnlyContext as on, sdkEventScheduleSchema as or, readAllMeta as ot, unsafeAsCliPageIdentifier as p, resolveCommandPath as pn, API_ENDPOINTS as pr, readSettingsMeta as pt, prepareLocalMediaForPush as q, fieldSchema as qn, calendarMonthWindowSchema as qr, loadPushConfigTarget as qt, entryCommandReportToSyncResult as r, currentInvocationEnvelope as rn, normalizeApiError as rr, extractMediaIdentifiers as rt, syncResultForEntryCommandCompileError as s, handleCommandError as sn, sdkSettingsUpdateSchema as sr, readEventCategoriesMeta as st, compileEntryPushCommands as t, ApiEnvelopeError as ti, createCommandContext as tn, ManagementApiError as tr, buildStorageUrl as tt, unsafeAsCliContentTypeKey as u, parseJsonArray as un, pageDesignDecisionsV2Schema as ur, readFormsMeta as ut, commandReportHasFailures as v, withOutputOnlyErrorHandling as vn, resolveSelectionAttendanceMode as vr, metadataTargetFromEnvironment as vt, mergeManySyncResults as w, withRiverbankEnv as wn, unsafeAsPositiveCheckoutQuantity as wr, listFiles as wt, formatManagementError as x, planEnvironmentExecution as xn, planSelectionCombinationPrices as xr, writeMetadataRecordMap as xt, executeCliCommandPlan as y, executeEnvironmentPlan as yn, checkoutStatusArms as yr, readMetadataFile as yt, calculateEntryDiffs as z, lookKnobBlocks as zn, publicVenueMapLocationSchema as zr, ACCOUNT_SITE_LIST_LIMIT_MAX as zt };
34667
+ export { normalizeMediaValueToIdentifierOnly as $, ManagementApiError as $n, publicEventLoaderQuerySchemaShape as $r, CommandFailure as $t, formatDiffDetail as A, getEnvironmentDebugInfo as An, getStripeMinimumChargeRequirement as Ar, navigationIdentity as At, buildFieldChanges as B, bindingSchema as Bn, publicPassProductSchema as Br, ACCOUNT_SITE_LIST_LIMIT_MIN as Bt, reportFromOutcomes as C, withRiverbankEnv as Cn, planCheckoutPaymentFlow as Cr, fileExists$1 as Ct, normalizeRemoteHomepageReference as D, CliExit as Dn, repriceBookingCollectionOptions as Dr, writeJsonFileAtomic as Dt, createEmptySyncResult as E, transportSuggestion as En, isBookingCollectionEquivalentToUpfront as Er, writeJsonFile$1 as Et, calculatePullDiff as F, cardListFamilyBlocks as Fn, eventCalendarListLayoutCompatibleDisplayModeValues as Fr, AccountApiMalformedResponseError as Ft, syncLocalMediaForPull as G, fieldSchema as Gn, calendarMonthDate as Gr, applyPushConfigPlan as Gt, formatFieldPath as H, blockCategoryEnum as Hn, purchasablePublicMembershipProductSchema as Hr, ACCOUNT_SITE_TITLE_MAX_LENGTH as Ht, buildJsonDiff as I, cardListKnobBlocks as In, eventCalendarListLayoutValues as Ir, createBearerAccountApi as It, admitBinaryWriteDestination as J, parseRepeaterGridInteger as Jn, eventScheduleScopeValues as Jr, preparePushConfigTarget as Jt, applyLocalMediaPush as K, MAX_REPEATER_GRID_COLUMNS as Kn, calendarMonthWindowSchema as Kr, createPushConfigCommand as Kt, hasPageOperations as L, lookKnobBlocks as Ln, publicMapLocationResultSchema as Lr, ACCOUNT_SITE_CURSOR_MAX_LENGTH as Lt, hasPendingChanges as M, isRemoteConfigured as Mn, MAX_EVENT_BOOKING_SELECTION_ITEMS as Mr, convertPulledFooterToLocal as Mt, findChangedFieldsWithValues as N, loadSdkEnvironment as Nn, eventCalendarDefaultViewValues as Nr, convertPulledNavigationToLocal as Nt, calculateDiff as O, createOutput as On, resolveAvailableBookingCollectionOptions as Or, isMediaValue as Ot, formatHumanDiff as P, cardListBlockParts as Pn, eventCalendarDisplayModeValues as Pr, convertPulledPagesToLocal as Pt, normalizeMediaIdentifierInput as Q, visibilityLevels as Qn, normalizeCalendarFilterId as Qr, mapEnvironmentExecutionOutcomesJson as Qt, pageMetadataForUpsert as R, NodeSchema as Rn, publicVenueMapLocationSchema as Rr, ACCOUNT_SITE_LIST_LIMIT_DEFAULT as Rt, planCliCommandBatchForBindings as S, requireEnvironmentWriteAuthorization as Sn, unsafeAsPositiveCheckoutQuantity as Sr, ensureDir$1 as St, executeResidualSettingsSyncPlan as T, formatError as Tn, flexibleBalanceDueDay as Tr, readJsonFile as Tt, revalidateLocalMediaPushPlan as U, blockContentSourceSchema as Un, purchasablePublicPassProductSchema as Ur, navigationCommandItemToManagementInput as Ut, formatFieldChange as V, DEFAULT_MEDIA_FIELD_KINDS as Vn, publicProductSchema as Vr, ACCOUNT_SITE_SEARCH_MAX_LENGTH as Vt, syncLocalMediaForPush as W, blockRequiredFeatureSchema as Wn, CALENDAR_SSR_PAGE_SIZE as Wr, normalizeNavigationConfigItemForCommand as Wt, writeBinaryFileAtomic as X, resolveRepeaterGridRowFieldId as Xn, eventSurfaceScopeValues as Xr, createBearerAPIClient as Xt, readStableBinaryFile as Y, resolveRepeaterGridColumnFieldId as Yn, eventSurfacePresetValues as Yr, revalidatePushConfigPlan as Yt, sha256 as Z, resolveRepeaterGridSpanFieldId as Zn, monthNumber as Zr, deriveCmsApiUrlFromDashboardUrl as Zt, commandExecutionToReport as _, runWithInvocation as _n, checkoutStatusArms as _r, metadataFilePath as _t, executeEntryCommandPlanAsReport as a, bindRequestTimeout as an, sdkSettingsUpdateSchema as ar, readEntries as at, executeCompiledCliCommandPlanAsReport as b, planEnvironmentExecution as bn, eventRegistrationErrors as br, writeMetadataFile as bt, titleFromEntryData as c, currentInvocationEnvelope as cn, pageDesignDecisionsV2Schema as cr, readEventsMeta as ct, unsafeAsCliEntryIdentifier as d, loadManagementTarget as dn, API_ENDPOINTS as dr, readNavigationMeta as dt, ApiEnvelopeError as ei, commandContexts as en, extractApiErrorMessage as er, walkLocalContentMedia as et, unsafeAsCliFormSlug as f, managementClientFor as fn, areEventBookingRequirementsIdentical as fr, readPagesMeta as ft, commandCompileFailureToReport as g, resolveCommandPath as gn, resolveSelectionAttendanceMode as gr, ensureMetadataDir as gt, mutationCounterForEffect as h, parseJsonData as hn, decideSelectionAttendance as hr, writeMediaManifest as ht, entrySiteCommandTypes as i, renderedByOwner as in, sdkEventScheduleSchema as ir, findLegacyEntryFiles as it, formatDiffSummary as j, isLocalConfigured as jn, getBookingLaterInstalments as jr, navigationIdentityMap as jt, calculateFooterDiff as k, getEnvPrefix as kn, resolveBookingCollectionOptionFacts as kr, duplicateNavigationIdentityMessage as kt, unsafeAsCliBlockIdentifier as l, formatDateShort as ln, pageDesignIntentSchemaVersion as lr, readFooterMeta as lt, commandReportToSyncResult as m, parseJsonArray as mn, INCOMPATIBLE_ATTENDANCE_MESSAGE as mr, readVenuesMeta as mt, entryCommandCompileErrorToReport as n, defineCommandGroup as nn, isRecord$5 as nr, downloadMedia as nt, executeEntryCommandPlanAsSyncResult as o, confirmAction as on, linkPayloadSchema as or, readAllMeta as ot, unsafeAsCliPageIdentifier as p, mapEntryForOutput as pn, eventBookingConsentContentKey as pr, readSettingsMeta as pt, prepareLocalMediaForPush as q, isAcceptedRepeaterGridSpan as qn, calendarSourceCursorSchema as qr, loadPushConfigTarget as qt, entryCommandReportToSyncResult as r, registerCommand as rn, ApiRequestError as rr, extractMediaIdentifiers as rt, syncResultForEntryCommandCompileError as s, createOutputForCommand as sn, portablePageDesignSchema as sr, readEventCategoriesMeta as st, compileEntryPushCommands as t, unwrapResponse as ti, defineCommand as tn, normalizeApiError as tr, buildStorageUrl as tt, unsafeAsCliContentTypeKey as u, handleCommandError as un, sdkConfiguredBookingVerticalConfigSchema as ur, readFormsMeta as ut, commandReportHasFailures as v, executeEnvironmentPlan as vn, nextCombinationHint as vr, metadataTargetFromEnvironment as vt, mergeManySyncResults as w, ErrorCodes as wn, planFlexibleBalanceCreditFirst as wr, listFiles as wt, formatManagementError as x, planEnvironmentWriteAuthorization as xn, checkoutCopy as xr, writeMetadataRecordMap as xt, executeCliCommandPlan as y, parseEnvironmentSelection as yn, planSelectionCombinationPrices as yr, readMetadataFile as yt, calculateEntryDiffs as z, NodeTreeSchema as zn, publicMembershipProductSchema as zr, ACCOUNT_SITE_LIST_LIMIT_MAX as zt };