riverbankcms 0.15.0 → 0.17.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.
@@ -90,8 +90,11 @@ Create `src/app/api/preview/keep-alive/route.ts`:
90
90
  import type { NextRequest } from 'next/server'
91
91
 
92
92
  import { createPreviewKeepAliveRouteHandler } from '@riverbankcms/sdk/preview-next/keep-alive'
93
+ import { getCmsConfig } from '@/lib/env'
93
94
 
94
- const handler = createPreviewKeepAliveRouteHandler()
95
+ const handler = createPreviewKeepAliveRouteHandler({
96
+ dashboardUrl: getCmsConfig().dashboardUrl,
97
+ })
95
98
 
96
99
  export function GET(request: NextRequest) {
97
100
  return handler(request)
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { a as classifySdkEventSchedule, i as sdkEventUpsertOptionalFieldSchemas, n as sdkCourseBookingSettingsSchema, o as classifySdkEventBookingOffer } from "./sdk-event-upsert-TGjuLLJp.mjs";
3
- import { l as EVENT_PRESET_VALUES } from "./src-DQ0xnGOE.mjs";
2
+ import { a as classifySdkEventSchedule, i as sdkEventUpsertOptionalFieldSchemas, n as sdkCourseBookingSettingsSchema, o as classifySdkEventBookingOffer } from "./sdk-event-upsert-BfdOApMM.mjs";
3
+ import { l as EVENT_PRESET_VALUES } from "./src-DwdPY0Os.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region ../blocks/src/lib/typeGuards.ts
@@ -269,6 +269,7 @@ function resolveContentTitle(content, titleField, fallbackTitle) {
269
269
  //#endregion
270
270
  //#region ../content-model/src/metadataConfig.ts
271
271
  const ROUTE_METADATA_MANIFEST = {
272
+ variantMeaning: { kind: "arrangement" },
272
273
  name: "content-entry-metadata",
273
274
  version: "1.0.0",
274
275
  title: "Details",
@@ -3344,7 +3345,23 @@ const DEFAULT_TEMPLATE_DEFINITIONS = {
3344
3345
  }]
3345
3346
  }
3346
3347
  };
3347
- function getDefaultTemplateDefinition(contentTypeKey) {
3348
+ /** The legacy definition stays untouched; this alternative is selected only at creation. */
3349
+ const EVENT_HEADER_TEMPLATE_DEFINITION = {
3350
+ ...DEFAULT_TEMPLATE_DEFINITIONS.event,
3351
+ blocks: [{
3352
+ blockKind: "block.event-details",
3353
+ scope: "entry",
3354
+ content: {
3355
+ heading: "",
3356
+ showVenue: true,
3357
+ showMap: true,
3358
+ showOtherDates: true,
3359
+ otherDatesLimit: "5"
3360
+ }
3361
+ }, ...DEFAULT_TEMPLATE_DEFINITIONS.event.blocks.slice(2)]
3362
+ };
3363
+ function getDefaultTemplateDefinition(contentTypeKey, defaults) {
3364
+ if (contentTypeKey === "event" && defaults?.event === "event-header") return EVENT_HEADER_TEMPLATE_DEFINITION;
3348
3365
  return DEFAULT_TEMPLATE_DEFINITIONS[contentTypeKey] ?? null;
3349
3366
  }
3350
3367
  const DEFAULT_TEMPLATE_KEYS = Object.freeze(Object.keys(DEFAULT_TEMPLATE_DEFINITIONS));
@@ -7,7 +7,7 @@ import { existsSync as existsSync$1 } from "fs";
7
7
  import { fileURLToPath } from "url";
8
8
 
9
9
  //#region package.json
10
- var version = "0.15.0";
10
+ var version = "0.17.0";
11
11
  var peerDependencies = { "@riverbankcms/sdk": ">=0.139.0 <1.0.0" };
12
12
  var package_default = {
13
13
  name: "riverbankcms",
@@ -83,7 +83,7 @@ var package_default = {
83
83
  //#endregion
84
84
  //#region src/version.ts
85
85
  /** The package manifest is the source-run fallback; builds inject this value. */
86
- const CLI_VERSION = typeof "0.15.0" === "string" ? "0.15.0" : version;
86
+ const CLI_VERSION = typeof "0.17.0" === "string" ? "0.17.0" : version;
87
87
  /**
88
88
  * The CLI's SDK peer range is bundled from the CLI manifest alongside its
89
89
  * version. Runtime config loading uses this value as the single compatibility
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { t as loadConfigFile } from "./load-config-BvBtVFZQ.mjs";
3
+
4
+ export { loadConfigFile };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { T as eventBookingOfferIntentSchema, _n as pageDesignIntentSchemaVersion, br as asPageFlowPresetId, d as stableStringify, dn as buttonStyleSelectionSchema, gn as pageDesignBoundaryTreatmentSchema, n as sdkCourseBookingSettingsSchema, nt as themeSchema, r as sdkEventOccurrenceInputSchema, s as eventVisibilitySchema, vr as asAppearancePresetId, xr as asSiteStyleId } from "./sdk-event-upsert-TGjuLLJp.mjs";
3
- import { At as unsafeAsOccurrenceId, Bt as unsafeAsStorageBucketName, Dt as unsafeAsEventSeriesId, Et as unsafeAsEventOfferingId, Ft as unsafeAsSafeDownloadFilename, Gt as ok, Ht as unsafeAsUploadSessionId, It as unsafeAsSiteFontId, J as parseUtcIsoDateTimeString, Lt as unsafeAsSiteId, Mt as unsafeAsPositiveByteCount, Nt as unsafeAsPositiveSeconds, Ot as unsafeAsFileChecksumSha256, Pt as unsafeAsProductId, Rt as unsafeAsSiteScopedStoragePath, St as unsafeAsDeclaredMimeType, Tt as unsafeAsEntitlementId, Ut as unsafeAsUserId, Vt as unsafeAsStoragePath, Wt as err, _t as parseSiteId, a as parseVerticalId, bt as unsafeAsBookingRequirementId, ft as assertNever, i as canonicalizeConfiguredBookingVerticalConfig, j as parseFooterCompositionV1, jt as unsafeAsOriginalFilename, kt as unsafeAsMediaAssetId, l as EVENT_PRESET_VALUES, lt as fromArray, o as parseVerticalPresetId, s as resolveSiteVerticalBookingConfig, ut as mapNonEmptyArray, v as exposeSecret, wt as unsafeAsDetectedMimeType, xt as unsafeAsBookingSessionId } from "./src-DQ0xnGOE.mjs";
2
+ import { T as eventBookingOfferIntentSchema, ar as asSiteStyleId, bn as pageDesignBoundaryTreatmentSchema, d as stableStringify, ft as themeSchema, hn as buttonStyleSelectionSchema, ir as asPageFlowPresetId, n as sdkCourseBookingSettingsSchema, r as sdkEventOccurrenceInputSchema, s as eventVisibilitySchema, tr as asAppearancePresetId, xn as pageDesignIntentSchemaVersion } from "./sdk-event-upsert-BfdOApMM.mjs";
3
+ import { $t as unsafeAsEventOfferingId, Gt as unsafeAsBookingRequirementId, Ht as parseSiteId, Jt as unsafeAsDeclaredMimeType, Kt as unsafeAsBookingSessionId, St as mapNonEmptyArray, Xt as unsafeAsDetectedMimeType, Y as parseUtcIsoDateTimeString, Zt as unsafeAsEntitlementId, _n as unsafeAsUploadSessionId, a as parseVerticalId, bn as ok, c as DEFAULT_EVENT_TYPE_PRESETS, dn as unsafeAsSiteFontId, en as unsafeAsEventSeriesId, fn as unsafeAsSiteId, gn as unsafeAsStoragePath, hn as unsafeAsStorageBucketName, i as canonicalizeConfiguredBookingVerticalConfig, in as unsafeAsOriginalFilename, j as parseFooterCompositionV1, jt as assertNever, l as EVENT_PRESET_VALUES, ln as unsafeAsProductId, nn as unsafeAsMediaAssetId, o as parseVerticalPresetId, on as unsafeAsPositiveByteCount, pn as unsafeAsSiteScopedStoragePath, rn as unsafeAsOccurrenceId, s as resolveSiteVerticalBookingConfig, sn as unsafeAsPositiveSeconds, t as resolveEventCatalogue, tn as unsafeAsFileChecksumSha256, un as unsafeAsSafeDownloadFilename, v as exposeSecret, vn as unsafeAsUserId, xt as fromArray, yn as err } from "./src-DwdPY0Os.mjs";
4
4
  import * as fs$1 from "fs/promises";
5
5
  import * as path$1 from "path";
6
6
  import { z } from "zod";
@@ -215,7 +215,59 @@ const sdkListEventOccurrencesResponseSchema = z.object({
215
215
  occurrences: z.array(sdkManagementEventOccurrenceSchema),
216
216
  nextCursor: z.string().nullable()
217
217
  });
218
- const sdkEventOccurrenceResponseSchema = z.object({ occurrence: sdkManagementEventOccurrenceSchema });
218
+ const businessCancellationResultSchema = z.object({
219
+ kind: z.enum([
220
+ "finished",
221
+ "unfinished",
222
+ "partial_application"
223
+ ]),
224
+ paymentTerms: z.enum([
225
+ "complete",
226
+ "unfinished",
227
+ "unavailable"
228
+ ]),
229
+ refunds: z.enum([
230
+ "complete",
231
+ "processing",
232
+ "needs_attention",
233
+ "unavailable"
234
+ ]),
235
+ emails: z.enum([
236
+ "complete",
237
+ "queued",
238
+ "needs_attention",
239
+ "unavailable"
240
+ ]),
241
+ operationId: identifierSchema$1,
242
+ directContactAttendeeIds: z.array(identifierSchema$1),
243
+ cancelledBookings: z.number().int().nonnegative(),
244
+ refundedBookings: z.number().int().nonnegative(),
245
+ restoredPassCredits: z.number().int().nonnegative(),
246
+ pending: z.object({
247
+ refundAttendeeIds: z.array(identifierSchema$1),
248
+ creditAttendeeIds: z.array(identifierSchema$1),
249
+ emailAttendeeIds: z.array(identifierSchema$1)
250
+ }),
251
+ structural: z.object({
252
+ created: z.number().int().nonnegative(),
253
+ deleted: z.number().int().nonnegative(),
254
+ cancelled: z.number().int().nonnegative(),
255
+ unfinishedOccurrenceIds: z.array(identifierSchema$1),
256
+ unfinishedCreateCount: z.number().int().nonnegative().optional(),
257
+ reason: z.enum([
258
+ "superseded",
259
+ "not_found",
260
+ "restore_blocked",
261
+ "failed",
262
+ "result_unavailable"
263
+ ]).optional()
264
+ })
265
+ });
266
+ const sdkEventOccurrenceResponseSchema = z.object({
267
+ occurrence: sdkManagementEventOccurrenceSchema,
268
+ cancellationResult: businessCancellationResultSchema.optional(),
269
+ cancellationResults: z.array(businessCancellationResultSchema).optional()
270
+ });
219
271
  const sdkDeleteEventOccurrenceResponseSchema = z.object({ deleted: z.literal(true) });
220
272
  const sdkReorderResponseSchema = z.object({
221
273
  reordered: z.literal(true),
@@ -932,6 +984,200 @@ const sdkPullEventsResponseSchema = z.object({
932
984
  meta: sdkPullMetaSchema
933
985
  });
934
986
 
987
+ //#endregion
988
+ //#region ../api/src/bookingSettingsSections.ts
989
+ const BOOKING_SETTINGS_SECTION_LABELS = {
990
+ basics: "Booking basics",
991
+ payments: "Payments",
992
+ events: "Events",
993
+ appointments: "Appointments",
994
+ messages: "Messages"
995
+ };
996
+ const BOOKING_SETTINGS_SECTION_KEYS = {
997
+ basics: [
998
+ "modules",
999
+ "verticalConfig",
1000
+ "eventTypePresets",
1001
+ "personRecordMode",
1002
+ "defaultTimezone",
1003
+ "calendarDisplay",
1004
+ "icsFeedsEnabled",
1005
+ "waitlists",
1006
+ "teamMemberProfilePages"
1007
+ ],
1008
+ payments: [
1009
+ "paymentDefaults",
1010
+ "currency",
1011
+ "refundsIssueCredit"
1012
+ ],
1013
+ events: [
1014
+ "defaultVenueId",
1015
+ "eventReminderHours",
1016
+ "eventReminderOverrides",
1017
+ "eventScheduleWindowMonths",
1018
+ "eventOrganizerNotifications",
1019
+ "eventOrganizerEmail",
1020
+ "eventTicketingDefaultEnabled",
1021
+ "collectAllAttendeeDetails",
1022
+ "eventTypeBookingDefaults",
1023
+ "eventBookingPolicies",
1024
+ "defaultEventImage",
1025
+ "eventDestinationPolicy"
1026
+ ],
1027
+ appointments: [
1028
+ "appointmentReminderHours",
1029
+ "appointmentReminderOverrides",
1030
+ "appointmentRescheduleHours",
1031
+ "appointmentDefaultMinLeadMinutes",
1032
+ "appointmentDefaultMaxBookingNoticeMinutes",
1033
+ "appointmentBookingPolicies"
1034
+ ],
1035
+ messages: [
1036
+ "remindersEnabled",
1037
+ "notificationSettings",
1038
+ "appointmentStaffReminder",
1039
+ "appointmentStaffChangeNotifications",
1040
+ "eventFeedback",
1041
+ "appointmentFollowUp"
1042
+ ]
1043
+ };
1044
+
1045
+ //#endregion
1046
+ //#region ../api/src/event-destination-policy.ts
1047
+ const eventDestinationModeValues = ["cms-managed", "system-managed"];
1048
+ const eventDestinationPresetValues = EVENT_PRESET_VALUES;
1049
+ const DEFAULT_EVENT_DESTINATION_POLICY = {
1050
+ defaultMode: "cms-managed",
1051
+ presetOverrides: {}
1052
+ };
1053
+ function isEventDestinationMode(value) {
1054
+ return eventDestinationModeValues.some((mode) => mode === value);
1055
+ }
1056
+ function resolveEventDestinationMode(input) {
1057
+ const policy = input.policy ?? DEFAULT_EVENT_DESTINATION_POLICY;
1058
+ if (input.preset) {
1059
+ const presetOverride = policy.presetOverrides[input.preset];
1060
+ if (presetOverride) return presetOverride;
1061
+ }
1062
+ if (input.publicExperience === "hosted_booking") return "system-managed";
1063
+ return policy.defaultMode;
1064
+ }
1065
+ function macadamiaDefaultEventDestinationPolicy(selectedPresets) {
1066
+ const presetOverrides = {};
1067
+ for (const preset of selectedPresets) {
1068
+ presetOverrides[preset] = preset === "class" ? "system-managed" : "cms-managed";
1069
+ }
1070
+ return {
1071
+ defaultMode: "cms-managed",
1072
+ presetOverrides
1073
+ };
1074
+ }
1075
+
1076
+ //#endregion
1077
+ //#region ../api/src/bookingConfig.ts
1078
+ /** Every option kind; the checkout routes validate the requested kind against it. */
1079
+ const DIRECT_CHECKOUT_COLLECTION_OPTION_KINDS = [
1080
+ "upfront",
1081
+ "deferred_manual",
1082
+ "instalment_plan",
1083
+ "flexible_balance"
1084
+ ];
1085
+ const eventOccurrenceRestorationSummarySchema = z.object({
1086
+ restoredOccurrenceIds: z.array(z.string().uuid()),
1087
+ excludedBookings: z.array(z.object({
1088
+ attendeeId: z.string().uuid(),
1089
+ occurrenceId: z.string().uuid(),
1090
+ customerId: z.string().uuid(),
1091
+ customerName: z.string().nullable(),
1092
+ customerEmail: z.string().nullable()
1093
+ }))
1094
+ });
1095
+ const DEFAULT_BOOKING_NOTIFICATION_SEND_RULE = {
1096
+ kind: "send",
1097
+ sendToAssignedStaff: true,
1098
+ extraEmail: null,
1099
+ sendToSiteOwnerIfNoStaff: true
1100
+ };
1101
+ const DEFAULT_BOOKING_NOTIFICATION_SETTINGS = {
1102
+ state: "configured",
1103
+ defaultRule: DEFAULT_BOOKING_NOTIFICATION_SEND_RULE,
1104
+ overrides: {}
1105
+ };
1106
+ const DEFAULT_APPOINTMENT_STAFF_DIGEST_LOCAL_SEND_TIME = "07:00";
1107
+ const BOOKING_SETTINGS_SECTIONS = [
1108
+ "basics",
1109
+ "payments",
1110
+ "events",
1111
+ "appointments",
1112
+ "messages"
1113
+ ];
1114
+ const unownedBookingSettingsKeys = {};
1115
+ void unownedBookingSettingsKeys;
1116
+ function pickBookingSettingsSection(settings, section) {
1117
+ const entries = BOOKING_SETTINGS_SECTION_KEYS[section].map((key) => [key, settings[key]]);
1118
+ return Object.fromEntries(entries);
1119
+ }
1120
+ function completeBookingSettingsForSectionUpdate(settings) {
1121
+ return {
1122
+ ...settings,
1123
+ eventTypePresets: settings.eventTypePresets ?? DEFAULT_EVENT_TYPE_PRESETS,
1124
+ verticalConfig: settings.verticalConfig ?? {
1125
+ verticalId: null,
1126
+ selectedPresetIds: []
1127
+ },
1128
+ teamMemberProfilePages: settings.teamMemberProfilePages ?? { policy: "selected" },
1129
+ eventDestinationPolicy: settings.eventDestinationPolicy ?? {
1130
+ defaultMode: "cms-managed",
1131
+ presetOverrides: {}
1132
+ },
1133
+ eventTypeBookingDefaults: settings.eventTypeBookingDefaults ?? {}
1134
+ };
1135
+ }
1136
+ function createBookingSettingsSectionUpdate(settings, section) {
1137
+ const completeSettings = completeBookingSettingsForSectionUpdate(settings);
1138
+ switch (section) {
1139
+ case "basics": return {
1140
+ section,
1141
+ settings: pickBookingSettingsSection(completeSettings, section)
1142
+ };
1143
+ case "payments": return {
1144
+ section,
1145
+ settings: pickBookingSettingsSection(completeSettings, section)
1146
+ };
1147
+ case "events": return {
1148
+ section,
1149
+ settings: pickBookingSettingsSection(completeSettings, section)
1150
+ };
1151
+ case "appointments": return {
1152
+ section,
1153
+ settings: pickBookingSettingsSection(completeSettings, section)
1154
+ };
1155
+ case "messages": return {
1156
+ section,
1157
+ settings: pickBookingSettingsSection(completeSettings, section)
1158
+ };
1159
+ }
1160
+ }
1161
+ function createBookingSettingsUpdateRequest(settings, sections = BOOKING_SETTINGS_SECTIONS) {
1162
+ return { updates: sections.map((section) => createBookingSettingsSectionUpdate(settings, section)) };
1163
+ }
1164
+ function applyBookingSettingsSectionUpdate(settings, update) {
1165
+ return {
1166
+ ...settings,
1167
+ ...update.settings
1168
+ };
1169
+ }
1170
+ function applyBookingSettingsSectionUpdates(settings, updates) {
1171
+ return updates.reduce(applyBookingSettingsSectionUpdate, settings);
1172
+ }
1173
+ /** Normalize optional wire defaults once before projecting operational Event policy. */
1174
+ function resolveBookingSettingsEventCatalogue(settings) {
1175
+ return resolveEventCatalogue({
1176
+ verticalConfig: settings.verticalConfig,
1177
+ eventTypePresets: settings.eventTypePresets ?? DEFAULT_EVENT_TYPE_PRESETS
1178
+ });
1179
+ }
1180
+
935
1181
  //#endregion
936
1182
  //#region ../api/src/sdkManagementResponseSchemas.ts
937
1183
  const sdkIdentifierSchema = z.string().min(1);
@@ -1065,7 +1311,15 @@ const sdkTakeEventOfflineResponseSchema = z.union([
1065
1311
  }),
1066
1312
  z.object({ kind: z.literal("already-offline") })
1067
1313
  ]);
1068
- const sdkUpsertEventResponseSchema = sdkCommandApplicationResultSchema(sdkManagementEventGraphSchema);
1314
+ const sdkUpsertEventResponseSchema = z.union([sdkCommandApplicationResultSchema(sdkManagementEventGraphSchema).extend({
1315
+ cancellationResult: businessCancellationResultSchema.optional(),
1316
+ restoration: eventOccurrenceRestorationSummarySchema.optional()
1317
+ }), z.object({
1318
+ kind: z.literal("accepted_unavailable"),
1319
+ id: sdkEventSeriesIdSchema,
1320
+ effect: z.object({ kind: z.literal("updated") }),
1321
+ cancellationResult: businessCancellationResultSchema
1322
+ })]);
1069
1323
  const sdkUpsertThemeResponseSchema = sdkCommandApplicationResultSchema(z.object({
1070
1324
  themeId: sdkIdentifierSchema,
1071
1325
  selectionId: sdkIdentifierSchema,
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Gt as ok, Wt as err, _t as parseSiteId } from "./src-DQ0xnGOE.mjs";
2
+ import { Ht as parseSiteId, bn as ok, yn as err } from "./src-DwdPY0Os.mjs";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "../src-DQ0xnGOE.mjs";
3
- import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-tejzSw1n.mjs";
2
+ import "../src-DwdPY0Os.mjs";
3
+ import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-BuRyn-Df.mjs";
4
4
 
5
5
  export { deriveGeneratedPackageRanges, deriveScaffoldLocalManifest, deriveScaffoldPlan, findPackageManifestPath, loadGeneratedPackageRanges, preflightScaffoldPlan, preflightScaffoldTargets, prepareScaffoldExecution, writeScaffoldFiles };