@streamline-pulse/formkrafter-core 0.27.0 → 0.28.1
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/dist/index.d.ts +1 -0
- package/dist/index.js +104 -1
- package/dist/index.js.map +8 -7
- package/dist/utils/slots.d.ts +38 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Appointment slots: either generated from opening rules (weekdays, hours,
|
|
3
|
+
* duration, horizon, closed dates) or served by a URL as a list. A slot is
|
|
4
|
+
* `{ id, start, end, remaining? }` with ISO local datetimes (no timezone:
|
|
5
|
+
* the organisation's clock), `remaining` undefined meaning unlimited.
|
|
6
|
+
*/
|
|
7
|
+
export interface Slot {
|
|
8
|
+
id: string;
|
|
9
|
+
/** ISO 8601 without offset, e.g. 2026-10-20T09:00. */
|
|
10
|
+
start: string;
|
|
11
|
+
end: string;
|
|
12
|
+
remaining?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface SlotRules {
|
|
15
|
+
/** Weekdays open, 1 = Monday … 7 = Sunday. Default Monday to Friday. */
|
|
16
|
+
days?: number[];
|
|
17
|
+
/** Opening hour, "08:00". */
|
|
18
|
+
from?: string;
|
|
19
|
+
/** Closing hour, "17:00". */
|
|
20
|
+
to?: string;
|
|
21
|
+
/** Slot length in minutes. */
|
|
22
|
+
duration?: number;
|
|
23
|
+
/** How many days ahead can be booked. */
|
|
24
|
+
horizonDays?: number;
|
|
25
|
+
/** Days that must be booked at least this many hours ahead. */
|
|
26
|
+
noticeHours?: number;
|
|
27
|
+
/** Closed dates, "2026-12-25". */
|
|
28
|
+
exclude?: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare const slotDate: (iso: string) => string;
|
|
31
|
+
export declare function generateSlots(rules: SlotRules, now?: Date): Slot[];
|
|
32
|
+
/** Reads a provider answer: an array, or `{ slots: [...] }` / `{ data: [...] }`. */
|
|
33
|
+
export declare function readSlots(payload: unknown): Slot[];
|
|
34
|
+
/** Slots grouped by day, in order, bookable ones only. */
|
|
35
|
+
export declare function groupSlotsByDay(slots: Slot[]): {
|
|
36
|
+
day: string;
|
|
37
|
+
slots: Slot[];
|
|
38
|
+
}[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamline-pulse/formkrafter-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "Framework-agnostic core for FormKrafter: form specs, RFC 6902 ops with undo/redo, Ajv validation, sandboxed rules engine and injectable services",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|