@simplelayer/graniteer-core 0.3.26 → 0.3.27

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.
@@ -81,6 +81,13 @@ export type NotifyGhlConfig = {
81
81
  /** Absolute origin the signed manage-booking link is built against. */
82
82
  manageUrlBase: string;
83
83
  customFieldNames: BookingCustomFieldNames;
84
+ /**
85
+ * Optional. Room slugs whose standard confirmation email gets an extra line
86
+ * saying door access details arrive the day before the event. Core does not
87
+ * hardcode any slug; the consuming wrapper supplies them. Absent/empty = no
88
+ * change to the email.
89
+ */
90
+ doorAccessEmailRoomSlugs?: readonly string[];
84
91
  };
85
92
  export declare function notifyGhl(supabase: SupabaseLike, booking: BookingRow, config: NotifyGhlConfig, doorAccess?: BookingDoorAccess | null): Promise<void>;
86
93
  export {};
@@ -294,7 +294,13 @@ export async function notifyGhl(supabase, booking, config, doorAccess) {
294
294
  if (typeof usageInstructions === 'string' && usageInstructions.trim().length > 0) {
295
295
  instructionsSection = `<div style='margin:20px 0;padding:16px;border:1px solid #E5E1D8;border-radius:8px'><h3 style='margin:0 0 8px 0;color:#22263B;font-family:Inter,Arial,sans-serif;font-size:16px'>About this room</h3>${textToHtmlParagraphs(usageInstructions)}</div>`;
296
296
  }
297
- const confirmationHtml = `<div style='font-family:Inter,Arial,sans-serif;max-width:560px;margin:0 auto;color:#22263B'><h2 style='color:#22263B'>Your booking is confirmed</h2><p>Hi ${firstName},</p><p>Thanks for booking with ${operator.name}. Here are your details:</p><table style='border-collapse:collapse;width:100%'><tr><td style='padding:6px 0;color:#5f6c5d;width:110px'>Room</td><td style='padding:6px 0'><strong>${roomName}</strong></td></tr><tr><td style='padding:6px 0;color:#5f6c5d'>When</td><td style='padding:6px 0'><strong>${whenStr}</strong></td></tr><tr><td style='padding:6px 0;color:#5f6c5d'>Amount</td><td style='padding:6px 0'><strong>${amountStr}</strong></td></tr><tr><td style='padding:6px 0;color:#5f6c5d'>Address</td><td style='padding:6px 0'>${address}</td></tr></table><p style='margin:20px 0'><a href='${gcalUrl}' style='background:#748272;color:#F6F6F6;padding:10px 18px;text-decoration:none;border-radius:6px;display:inline-block'>Add to Google Calendar</a></p>${doorSection}${wifiSection}${instructionsSection}${manageParagraph}<p style='color:#5f6c5d;font-size:13px;margin-top:28px'>${operator.name} · ${address}</p></div>`;
297
+ const doorAccessSlugs = Array.isArray(config.doorAccessEmailRoomSlugs) ? config.doorAccessEmailRoomSlugs : [];
298
+ // The external day-before sender only fires for starts at least ~20h out, so a booking made inside 24h must not be promised the email.
299
+ const doorAccessLaterRow = typeof booking.rooms.slug === 'string' && doorAccessSlugs.includes(booking.rooms.slug) && !doorAccess?.pin
300
+ && new Date(startISO).getTime() - Date.now() > 24 * 60 * 60 * 1000
301
+ ? `<tr><td colspan='2' style='padding:2px 0 8px 0;color:#5f6c5d;font-size:13px'>We'll email your door access details the day before your event.</td></tr>`
302
+ : '';
303
+ const confirmationHtml = `<div style='font-family:Inter,Arial,sans-serif;max-width:560px;margin:0 auto;color:#22263B'><h2 style='color:#22263B'>Your booking is confirmed</h2><p>Hi ${firstName},</p><p>Thanks for booking with ${operator.name}. Here are your details:</p><table style='border-collapse:collapse;width:100%'><tr><td style='padding:6px 0;color:#5f6c5d;width:110px'>Room</td><td style='padding:6px 0'><strong>${roomName}</strong></td></tr><tr><td style='padding:6px 0;color:#5f6c5d'>When</td><td style='padding:6px 0'><strong>${whenStr}</strong></td></tr>${doorAccessLaterRow}<tr><td style='padding:6px 0;color:#5f6c5d'>Amount</td><td style='padding:6px 0'><strong>${amountStr}</strong></td></tr><tr><td style='padding:6px 0;color:#5f6c5d'>Address</td><td style='padding:6px 0'>${address}</td></tr></table><p style='margin:20px 0'><a href='${gcalUrl}' style='background:#748272;color:#F6F6F6;padding:10px 18px;text-decoration:none;border-radius:6px;display:inline-block'>Add to Google Calendar</a></p>${doorSection}${wifiSection}${instructionsSection}${manageParagraph}<p style='color:#5f6c5d;font-size:13px;margin-top:28px'>${operator.name} · ${address}</p></div>`;
298
304
  const emailRes = await fetch(`${GHL_BASE}/conversations/messages`, {
299
305
  method: 'POST', headers,
300
306
  body: JSON.stringify({
@@ -191,7 +191,7 @@ export function sendCommonsDepositReceiptEmail(supabase, { email, name, eventDat
191
191
  contractUrl
192
192
  ? p(`<a href="${esc(contractUrl)}" style="color:#C98A5E">View your signed agreement →</a>`)
193
193
  : p(`A copy of your signed agreement was emailed to you when signing completed.`),
194
- p(`We'll be in touch before your date to confirm setup, timing and access details.`),
194
+ p(`We'll be in touch before your date to confirm setup and timing. Once your balance is paid, we'll email your door access details the day before your event.`),
195
195
  p(`Questions? Reach us at <a href="mailto:${operator.supportEmail}" style="color:#C98A5E">${operator.supportEmail}</a>.`),
196
196
  p(`— The ${operator.name} team`),
197
197
  ].join(''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplelayer/graniteer-core",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
4
4
  "description": "Shared platform core for Graniteer",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",