@cimplify/cli 0.6.3 → 0.6.4
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/{add-XETP2LS5.mjs → add-NWGER62A.mjs} +1 -1
- package/dist/{chunk-SVW5FLGR.mjs → chunk-76TJ56KE.mjs} +1 -1
- package/dist/{chunk-2IKULCJK.mjs → chunk-MGP2FUAK.mjs} +1 -1
- package/dist/{chunk-M5ZENIII.mjs → chunk-TFEUFCEH.mjs} +9 -9
- package/dist/dispatcher.mjs +9 -9
- package/dist/{doctor-JK2GOUKZ.mjs → doctor-ZGW3VZOG.mjs} +2 -2
- package/dist/{explain-J6SJKV7A.mjs → explain-4ITTI4FM.mjs} +1 -1
- package/dist/{introspect-L53LUMAR.mjs → introspect-DL2HE7DG.mjs} +2 -2
- package/dist/{list-AADEEPYT.mjs → list-WNNKVK7V.mjs} +1 -1
- package/dist/{update-GB2FEYPY.mjs → update-EPRLX6FL.mjs} +1 -1
- package/package.json +1 -1
- package/templates/storefront-auto/package.json +1 -1
- package/templates/storefront-bakery/package.json +1 -1
- package/templates/storefront-fashion/package.json +1 -1
- package/templates/storefront-grocery/package.json +1 -1
- package/templates/storefront-pharmacy/package.json +1 -1
- package/templates/storefront-restaurant/package.json +1 -1
- package/templates/storefront-retail/package.json +1 -1
- package/templates/storefront-services/app/book/book-client.tsx +40 -104
- package/templates/storefront-services/package.json +1 -1
package/dist/dispatcher.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { TEMPLATES } from './chunk-
|
|
3
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { TEMPLATES } from './chunk-TFEUFCEH.mjs';
|
|
3
|
+
import { package_default } from './chunk-MGP2FUAK.mjs';
|
|
4
4
|
|
|
5
5
|
// src/dispatcher.ts
|
|
6
6
|
var VERSION = package_default.version ?? "unknown";
|
|
@@ -137,15 +137,15 @@ var COMMANDS = {
|
|
|
137
137
|
logs: () => import('./logs-YNN2PQ24.mjs'),
|
|
138
138
|
status: () => import('./status-JSYXM5RT.mjs'),
|
|
139
139
|
dev: () => import('./dev-ONW2S77K.mjs'),
|
|
140
|
-
introspect: () => import('./introspect-
|
|
141
|
-
doctor: () => import('./doctor-
|
|
142
|
-
explain: () => import('./explain-
|
|
140
|
+
introspect: () => import('./introspect-DL2HE7DG.mjs'),
|
|
141
|
+
doctor: () => import('./doctor-ZGW3VZOG.mjs'),
|
|
142
|
+
explain: () => import('./explain-4ITTI4FM.mjs'),
|
|
143
143
|
assets: () => import('./assets-EBEMMENZ.mjs'),
|
|
144
144
|
repo: () => import('./repo-WOBWKEAO.mjs'),
|
|
145
|
-
list: () => import('./list-
|
|
146
|
-
add: () => import('./add-
|
|
147
|
-
update: () => import('./update-
|
|
148
|
-
upgrade: () => import('./update-
|
|
145
|
+
list: () => import('./list-WNNKVK7V.mjs'),
|
|
146
|
+
add: () => import('./add-NWGER62A.mjs'),
|
|
147
|
+
update: () => import('./update-EPRLX6FL.mjs'),
|
|
148
|
+
upgrade: () => import('./update-EPRLX6FL.mjs'),
|
|
149
149
|
"auth-step-up": () => import('./auth-step-up-BIUYQJP6.mjs')
|
|
150
150
|
};
|
|
151
151
|
var COMMAND_PREFIXES = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { gatherIntrospection } from './chunk-
|
|
2
|
+
import { gatherIntrospection } from './chunk-76TJ56KE.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-MGP2FUAK.mjs';
|
|
6
6
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import { ApiClient } from './chunk-MAOO6ZZ5.mjs';
|
|
8
8
|
import { readAuthOrNull } from './chunk-UBAI443T.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-MGP2FUAK.mjs';
|
|
3
3
|
import { parseArgs } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { bold, dim, info, result, CliError, CLI_ERROR_CODE } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-
|
|
2
|
+
export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-76TJ56KE.mjs';
|
|
3
3
|
import './chunk-K5464A3L.mjs';
|
|
4
4
|
import './chunk-DBZ3UOQ2.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-MGP2FUAK.mjs';
|
|
6
6
|
import './chunk-C4M3DXKC.mjs';
|
|
7
7
|
import './chunk-UBAI443T.mjs';
|
|
8
8
|
import './chunk-E2T2SBP5.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { REGISTRY_INDEX } from './chunk-
|
|
2
|
+
import { REGISTRY_INDEX } from './chunk-TFEUFCEH.mjs';
|
|
3
3
|
import { parseArgs, flagBool } from './chunk-C4M3DXKC.mjs';
|
|
4
4
|
import { CliError, CLI_ERROR_CODE, info, bold, dim, green, result } from './chunk-E2T2SBP5.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default } from './chunk-
|
|
2
|
+
import { package_default } from './chunk-MGP2FUAK.mjs';
|
|
3
3
|
import { promptYesNo } from './chunk-ITAFAORS.mjs';
|
|
4
4
|
import { parseArgs, flagBool, flagString } from './chunk-C4M3DXKC.mjs';
|
|
5
5
|
import { success, bold, info, dim, result, failure, CliError, CLI_ERROR_CODE, step, isJsonMode } from './chunk-E2T2SBP5.mjs';
|
package/package.json
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useState } from "react";
|
|
4
4
|
import { useRouter } from "next/navigation";
|
|
5
5
|
import type { Product } from "@cimplify/sdk";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
interface Slot {
|
|
9
|
-
date: Date;
|
|
10
|
-
label: string;
|
|
11
|
-
}
|
|
6
|
+
import type { AvailableSlot } from "@cimplify/sdk";
|
|
7
|
+
import { useCart, DateSlotPicker } from "@cimplify/sdk/react";
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
|
-
*
|
|
15
|
-
* 1. Pick a treatment (left rail)
|
|
16
|
-
* 2.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
10
|
+
* Booking flow:
|
|
11
|
+
* 1. Pick a treatment (left rail) — drives the SDK availability fetch.
|
|
12
|
+
* 2. SDK <DateSlotPicker> handles date + slot selection, fetching real
|
|
13
|
+
* availability via `useServiceAvailability` against the configured
|
|
14
|
+
* backend (mock in dev, Cimplify scheduling API in prod).
|
|
15
|
+
* 3. Add to cart with the chosen slot as a cart-item note;
|
|
19
16
|
* Cimplify Checkout finalises the booking.
|
|
20
|
-
*
|
|
21
|
-
* The slot grid is generated client-side as a placeholder. In production,
|
|
22
|
-
* call `useAvailableSlots({ serviceId, date })` from `@cimplify/sdk/react`
|
|
23
|
-
* to fetch real availability from the Cimplify scheduling API.
|
|
24
17
|
*/
|
|
25
18
|
export function BookClient({ treatments }: { treatments: Product[] }) {
|
|
26
19
|
const router = useRouter();
|
|
@@ -28,41 +21,22 @@ export function BookClient({ treatments }: { treatments: Product[] }) {
|
|
|
28
21
|
const [selectedTreatment, setSelectedTreatment] = useState<Product | undefined>(
|
|
29
22
|
treatments[0],
|
|
30
23
|
);
|
|
31
|
-
const [
|
|
32
|
-
const [selectedSlotKey, setSelectedSlotKey] = useState<string | null>(null);
|
|
24
|
+
const [selectedSlot, setSelectedSlot] = useState<AvailableSlot | null>(null);
|
|
33
25
|
const [submitting, setSubmitting] = useState(false);
|
|
34
26
|
|
|
35
|
-
const dates = useMemo(() => {
|
|
36
|
-
const now = new Date();
|
|
37
|
-
return Array.from({ length: 14 }).map((_, i) => {
|
|
38
|
-
const d = new Date(now);
|
|
39
|
-
d.setDate(now.getDate() + i);
|
|
40
|
-
d.setHours(0, 0, 0, 0);
|
|
41
|
-
return d;
|
|
42
|
-
});
|
|
43
|
-
}, []);
|
|
44
|
-
|
|
45
|
-
const slots = useMemo<Slot[]>(() => {
|
|
46
|
-
const out: Slot[] = [];
|
|
47
|
-
for (let h = 10; h <= 19; h++) {
|
|
48
|
-
for (const m of [0, 30]) {
|
|
49
|
-
const d = new Date(selectedDate);
|
|
50
|
-
d.setHours(h, m, 0, 0);
|
|
51
|
-
const label = `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
52
|
-
out.push({ date: d, label });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return out;
|
|
56
|
-
}, [selectedDate]);
|
|
57
|
-
|
|
58
|
-
const slotKey = (s: Slot) => s.date.toISOString();
|
|
59
|
-
|
|
60
27
|
async function confirm() {
|
|
61
|
-
if (!selectedTreatment || !
|
|
28
|
+
if (!selectedTreatment || !selectedSlot) return;
|
|
62
29
|
setSubmitting(true);
|
|
63
30
|
try {
|
|
31
|
+
const slotLabel = new Date(selectedSlot.start_time).toLocaleString(undefined, {
|
|
32
|
+
weekday: "short",
|
|
33
|
+
month: "short",
|
|
34
|
+
day: "numeric",
|
|
35
|
+
hour: "2-digit",
|
|
36
|
+
minute: "2-digit",
|
|
37
|
+
});
|
|
64
38
|
await addItem(selectedTreatment, 1, {
|
|
65
|
-
|
|
39
|
+
specialInstructions: `Booked for ${slotLabel}`,
|
|
66
40
|
});
|
|
67
41
|
router.push("/checkout");
|
|
68
42
|
} catch {
|
|
@@ -92,7 +66,10 @@ export function BookClient({ treatments }: { treatments: Product[] }) {
|
|
|
92
66
|
<button
|
|
93
67
|
key={t.id}
|
|
94
68
|
type="button"
|
|
95
|
-
onClick={() =>
|
|
69
|
+
onClick={() => {
|
|
70
|
+
setSelectedTreatment(t);
|
|
71
|
+
setSelectedSlot(null);
|
|
72
|
+
}}
|
|
96
73
|
className={[
|
|
97
74
|
"w-full text-left rounded-2xl border p-4 transition-colors",
|
|
98
75
|
active
|
|
@@ -120,73 +97,32 @@ export function BookClient({ treatments }: { treatments: Product[] }) {
|
|
|
120
97
|
</div>
|
|
121
98
|
</div>
|
|
122
99
|
|
|
123
|
-
{/* Date + slots */}
|
|
100
|
+
{/* Date + slots — SDK <DateSlotPicker> fetches real availability */}
|
|
124
101
|
<div className="rounded-2xl border border-border bg-card p-4 sm:p-6">
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}}
|
|
139
|
-
className={[
|
|
140
|
-
"flex flex-col items-center justify-center py-2 rounded-md transition-colors",
|
|
141
|
-
active
|
|
142
|
-
? "bg-foreground text-background"
|
|
143
|
-
: "bg-background hover:bg-muted text-foreground",
|
|
144
|
-
].join(" ")}
|
|
145
|
-
>
|
|
146
|
-
<span className="text-[10px] uppercase tracking-wider opacity-60">
|
|
147
|
-
{d.toLocaleString(undefined, { weekday: "short" })}
|
|
148
|
-
</span>
|
|
149
|
-
<span className="text-base font-semibold tabular-nums">{d.getDate()}</span>
|
|
150
|
-
</button>
|
|
151
|
-
);
|
|
152
|
-
})}
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
<p className="text-[11px] font-mono uppercase tracking-[0.16em] text-muted-foreground mb-3">
|
|
156
|
-
Slot
|
|
157
|
-
</p>
|
|
158
|
-
<div className="grid grid-cols-3 sm:grid-cols-4 gap-2">
|
|
159
|
-
{slots.map((s) => {
|
|
160
|
-
const key = slotKey(s);
|
|
161
|
-
const active = selectedSlotKey === key;
|
|
162
|
-
return (
|
|
163
|
-
<button
|
|
164
|
-
key={key}
|
|
165
|
-
type="button"
|
|
166
|
-
onClick={() => setSelectedSlotKey(key)}
|
|
167
|
-
className={[
|
|
168
|
-
"py-2 rounded-md text-sm tabular-nums transition-colors",
|
|
169
|
-
active
|
|
170
|
-
? "bg-primary text-primary-foreground"
|
|
171
|
-
: "bg-background border border-border hover:border-primary",
|
|
172
|
-
].join(" ")}
|
|
173
|
-
>
|
|
174
|
-
{s.label}
|
|
175
|
-
</button>
|
|
176
|
-
);
|
|
177
|
-
})}
|
|
178
|
-
</div>
|
|
102
|
+
{selectedTreatment ? (
|
|
103
|
+
<DateSlotPicker
|
|
104
|
+
serviceId={selectedTreatment.id}
|
|
105
|
+
selectedSlot={selectedSlot}
|
|
106
|
+
onSlotSelect={(slot) => setSelectedSlot(slot)}
|
|
107
|
+
daysToShow={selectedTreatment.scheduling_mode === "multi_day" ? 14 : 7}
|
|
108
|
+
schedulingMode={selectedTreatment.scheduling_mode}
|
|
109
|
+
durationUnit={selectedTreatment.duration_unit}
|
|
110
|
+
durationValue={selectedTreatment.duration_value}
|
|
111
|
+
/>
|
|
112
|
+
) : (
|
|
113
|
+
<p className="text-sm text-muted-foreground">Pick a treatment to see availability.</p>
|
|
114
|
+
)}
|
|
179
115
|
|
|
180
116
|
<button
|
|
181
117
|
type="button"
|
|
182
118
|
onClick={confirm}
|
|
183
|
-
disabled={!selectedTreatment || !
|
|
119
|
+
disabled={!selectedTreatment || !selectedSlot || submitting}
|
|
184
120
|
className="w-full mt-6 inline-flex items-center justify-center gap-2 px-5 py-3 rounded-md bg-primary text-primary-foreground font-semibold text-sm hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
|
185
121
|
>
|
|
186
122
|
{submitting
|
|
187
123
|
? "Confirming…"
|
|
188
|
-
:
|
|
189
|
-
? `Book ${selectedTreatment?.name} at ${new Date(
|
|
124
|
+
: selectedSlot
|
|
125
|
+
? `Book ${selectedTreatment?.name} at ${new Date(selectedSlot.start_time).toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" })}`
|
|
190
126
|
: "Pick a slot to book"}
|
|
191
127
|
</button>
|
|
192
128
|
</div>
|