glitchgrab 1.51.0 → 1.53.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.
- package/README.md +50 -0
- package/dist/index.js +1123 -517
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1123 -517
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +61 -2
- package/dist/server.d.ts +61 -2
- package/dist/server.js +73 -4
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +70 -3
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -944,6 +944,56 @@ interface CallsOptions {
|
|
|
944
944
|
}
|
|
945
945
|
```
|
|
946
946
|
|
|
947
|
+
## How do I change demo booking settings from my admin panel?
|
|
948
|
+
|
|
949
|
+
The same server key reads and writes the project's demo booking settings —
|
|
950
|
+
whether prospects can book, working hours, slot length, notice, and the
|
|
951
|
+
WhatsApp code. Which Google calendar demos land in is **not** exposed: that
|
|
952
|
+
stays set in Glitchgrab → Calls → Booking.
|
|
953
|
+
|
|
954
|
+
```ts
|
|
955
|
+
// app/api/admin/booking/route.ts — behind your admin auth
|
|
956
|
+
import { getBookingSettings, updateBookingSettings } from "glitchgrab/server";
|
|
957
|
+
|
|
958
|
+
const current = await getBookingSettings(); // GLITCHGRAB_CALLS_KEY=ggc_…
|
|
959
|
+
if (current.ok && !current.data.calendarConnected) {
|
|
960
|
+
// no calendar → no slots, whatever `enabled` says
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const saved = await updateBookingSettings({ enabled: true, slotMinutes: 45 });
|
|
964
|
+
if (!saved.ok) console.error(saved.error); // e.g. WhatsApp code already taken
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
- **Send only what changed.** A field left out keeps its value.
|
|
968
|
+
- **Values are clamped** (slot 15–180 min, gap 0–120, 1–90 days ahead, notice
|
|
969
|
+
0–10080 min) and invalid working hours are ignored — read `data.settings`
|
|
970
|
+
back instead of trusting what you sent.
|
|
971
|
+
- **Never throws.** Failures come back as `{ ok: false, error }`, never as defaults.
|
|
972
|
+
|
|
973
|
+
```ts
|
|
974
|
+
getBookingSettings(options?: CallsOptions): Promise<BookingSettingsResult>
|
|
975
|
+
updateBookingSettings(changes: Partial<BookingSettings>, options?: CallsOptions): Promise<BookingSettingsResult>
|
|
976
|
+
|
|
977
|
+
type BookingSettingsResult =
|
|
978
|
+
| { ok: true; data: { settings: BookingSettings; saved: boolean; calendarConnected: boolean } }
|
|
979
|
+
| { ok: false; error: string };
|
|
980
|
+
|
|
981
|
+
interface BookingSettings {
|
|
982
|
+
enabled: boolean;
|
|
983
|
+
slotMinutes: number;
|
|
984
|
+
bufferMinutes: number;
|
|
985
|
+
timezone: string; // IANA, e.g. "Asia/Kolkata"
|
|
986
|
+
workingHours: Record<string, [string, string][]>; // { "1": [["09:00","17:00"]] }, 1 = Monday
|
|
987
|
+
title: string | null;
|
|
988
|
+
description: string | null;
|
|
989
|
+
hostName: string | null; // who the visitor meets, shown beside the calendar
|
|
990
|
+
hostAvatarUrl: string | null; // https only; anything else is ignored on save
|
|
991
|
+
horizonDays: number;
|
|
992
|
+
noticeMinutes: number;
|
|
993
|
+
whatsappCode: string | null;
|
|
994
|
+
}
|
|
995
|
+
```
|
|
996
|
+
|
|
947
997
|
## What configuration options are available?
|
|
948
998
|
|
|
949
999
|
| Prop | Type | Default | Description |
|