glitchgrab 1.58.1 → 1.58.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1049,9 +1049,36 @@ demos[0].answers; // [{ id: "language", question: "Which language…", answer: "
1049
1049
  - The dialog needs a `glitchgrab` version newer than 1.57 on the site. An older one
1050
1050
  still books, without asking.
1051
1051
 
1052
+ ### Trying new questions before prospects see them
1053
+
1054
+ Questions sent as above go live at once. Send `draft: true` and they are saved as
1055
+ a draft instead: the booking dialog and the WhatsApp chat keep asking the current
1056
+ questions until you publish.
1057
+
1058
+ ```ts
1059
+ import { publishBookingQuestions, discardBookingQuestionsDraft } from "glitchgrab/server";
1060
+
1061
+ await updateBookingSettings({ questions, draft: true }); // live dialog unchanged
1062
+
1063
+ // On an admin page (client side), open the real dialog with the draft:
1064
+ const { openBookingPreview } = useGlitchgrab();
1065
+ openBookingPreview(); // "Preview — nothing is booked"; no code is sent
1066
+
1067
+ await publishBookingQuestions(); // the draft goes live
1068
+ // or: await discardBookingQuestionsDraft();
1069
+ ```
1070
+
1071
+ - `settings.draftQuestions` is the draft, `null` when there is none.
1072
+ - Sending `questions` without `draft` still goes live straight away — and drops any draft.
1073
+ - `publishBookingQuestions()` with no draft comes back as `{ ok: false, error }`.
1074
+ - Put `openBookingPreview` behind your admin login; it is not for prospects.
1075
+ - The owner can do the same in Glitchgrab → Calls → Booking (Save as draft → Preview → Publish).
1076
+
1052
1077
  ```ts
1053
1078
  getBookingSettings(options?: CallsOptions): Promise<BookingSettingsResult>
1054
1079
  updateBookingSettings(changes: BookingSettingsChanges, options?: CallsOptions): Promise<BookingSettingsResult>
1080
+ publishBookingQuestions(options?: CallsOptions): Promise<BookingSettingsResult>
1081
+ discardBookingQuestionsDraft(options?: CallsOptions): Promise<BookingSettingsResult>
1055
1082
 
1056
1083
  type BookingSettingsResult =
1057
1084
  | { ok: true; data: { settings: BookingSettings; saved: boolean; calendarConnected: boolean } }
@@ -1072,6 +1099,7 @@ interface BookingSettings {
1072
1099
  whatsappCode: string | null;
1073
1100
  notifyRecipients: { name: string; phone: string }[]; // extra WhatsApp numbers alerted on a booking, max 5
1074
1101
  questions: BookingQuestion[]; // asked before the calendar, max 5
1102
+ draftQuestions: BookingQuestion[] | null; // saved with draft: true, not live; null = no draft
1075
1103
  }
1076
1104
 
1077
1105
  interface BookingQuestion {
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, L as LeadInput, h as LeadResult, i as ReportPayload, j as ReportResult } from './types-DfVtKZcp.mjs';
3
- export { G as GlitchgrabConfig, k as ReportSeverity, l as ReportType, m as RuntimeInfo } from './types-DfVtKZcp.mjs';
2
+ import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, L as LeadInput, h as LeadResult, i as ReportPayload, j as ReportResult } from './types-BpTLWJ1y.mjs';
3
+ export { G as GlitchgrabConfig, k as ReportSeverity, l as ReportType, m as RuntimeInfo } from './types-BpTLWJ1y.mjs';
4
4
  import * as React from 'react';
5
5
  import { ReactNode } from 'react';
6
6
 
@@ -81,6 +81,24 @@ declare function BookDemoButton({ label, className, children, }: {
81
81
  }) => ReactNode;
82
82
  }): react_jsx_runtime.JSX.Element;
83
83
 
84
+ declare function BookingDialog({ token, baseUrl, open, onClose, preview, availabilityUrl, }: {
85
+ token: string;
86
+ baseUrl: string;
87
+ open: boolean;
88
+ onClose: () => void;
89
+ /**
90
+ * The owner checking draft questions (#551): loads the draft instead of the
91
+ * live set and never books — the dialog stops before it would post.
92
+ */
93
+ preview?: boolean;
94
+ /**
95
+ * Where availability is read from instead of the public SDK route. The
96
+ * Glitchgrab dashboard's Preview passes its own session route, because it
97
+ * holds no `gg_` token for the project. Same response shape.
98
+ */
99
+ availabilityUrl?: string;
100
+ }): react_jsx_runtime.JSX.Element | null;
101
+
84
102
  /**
85
103
  * Trigger for the built-in feedback dialog (stars + message).
86
104
  *
@@ -404,4 +422,4 @@ declare function computeSignature(params: {
404
422
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
405
423
  declare function clearDedupCache(): void;
406
424
 
407
- export { BookDemoButton, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReports };
425
+ export { BookDemoButton, BookingDialog, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReports };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, L as LeadInput, h as LeadResult, i as ReportPayload, j as ReportResult } from './types-DfVtKZcp.js';
3
- export { G as GlitchgrabConfig, k as ReportSeverity, l as ReportType, m as RuntimeInfo } from './types-DfVtKZcp.js';
2
+ import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, L as LeadInput, h as LeadResult, i as ReportPayload, j as ReportResult } from './types-BpTLWJ1y.js';
3
+ export { G as GlitchgrabConfig, k as ReportSeverity, l as ReportType, m as RuntimeInfo } from './types-BpTLWJ1y.js';
4
4
  import * as React from 'react';
5
5
  import { ReactNode } from 'react';
6
6
 
@@ -81,6 +81,24 @@ declare function BookDemoButton({ label, className, children, }: {
81
81
  }) => ReactNode;
82
82
  }): react_jsx_runtime.JSX.Element;
83
83
 
84
+ declare function BookingDialog({ token, baseUrl, open, onClose, preview, availabilityUrl, }: {
85
+ token: string;
86
+ baseUrl: string;
87
+ open: boolean;
88
+ onClose: () => void;
89
+ /**
90
+ * The owner checking draft questions (#551): loads the draft instead of the
91
+ * live set and never books — the dialog stops before it would post.
92
+ */
93
+ preview?: boolean;
94
+ /**
95
+ * Where availability is read from instead of the public SDK route. The
96
+ * Glitchgrab dashboard's Preview passes its own session route, because it
97
+ * holds no `gg_` token for the project. Same response shape.
98
+ */
99
+ availabilityUrl?: string;
100
+ }): react_jsx_runtime.JSX.Element | null;
101
+
84
102
  /**
85
103
  * Trigger for the built-in feedback dialog (stars + message).
86
104
  *
@@ -404,4 +422,4 @@ declare function computeSignature(params: {
404
422
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
405
423
  declare function clearDedupCache(): void;
406
424
 
407
- export { BookDemoButton, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReports };
425
+ export { BookDemoButton, BookingDialog, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReports };