@cimplify/cli 0.6.3 → 0.6.5

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { gitDetectRoot, gitCurrentBranch, gitCurrentSha, gitStatusPorcelain } from './chunk-K5464A3L.mjs';
3
3
  import { parseEnvFile } from './chunk-DBZ3UOQ2.mjs';
4
- import { package_default } from './chunk-2IKULCJK.mjs';
4
+ import { package_default } from './chunk-FVYBHC45.mjs';
5
5
  import { parseArgs } from './chunk-C4M3DXKC.mjs';
6
6
  import { readAuthOrNull, readProjectLinkOrNull, readProjectState } from './chunk-UBAI443T.mjs';
7
7
  import { bold, dim, yellow, green, info, result, red } from './chunk-E2T2SBP5.mjs';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { TEMPLATES } from './chunk-M5ZENIII.mjs';
3
- import { package_default } from './chunk-2IKULCJK.mjs';
2
+ import { TEMPLATES } from './chunk-XZZZS6X2.mjs';
3
+ import { package_default } from './chunk-FVYBHC45.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-L53LUMAR.mjs'),
141
- doctor: () => import('./doctor-JK2GOUKZ.mjs'),
142
- explain: () => import('./explain-J6SJKV7A.mjs'),
140
+ introspect: () => import('./introspect-56FKN72I.mjs'),
141
+ doctor: () => import('./doctor-S3GTCQMC.mjs'),
142
+ explain: () => import('./explain-3DSAJBNE.mjs'),
143
143
  assets: () => import('./assets-EBEMMENZ.mjs'),
144
144
  repo: () => import('./repo-WOBWKEAO.mjs'),
145
- list: () => import('./list-AADEEPYT.mjs'),
146
- add: () => import('./add-XETP2LS5.mjs'),
147
- update: () => import('./update-GB2FEYPY.mjs'),
148
- upgrade: () => import('./update-GB2FEYPY.mjs'),
145
+ list: () => import('./list-FPFX4RGB.mjs'),
146
+ add: () => import('./add-UQGZNABQ.mjs'),
147
+ update: () => import('./update-MT4OG7FW.mjs'),
148
+ upgrade: () => import('./update-MT4OG7FW.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-SVW5FLGR.mjs';
2
+ import { gatherIntrospection } from './chunk-ZC2KRCFO.mjs';
3
3
  import './chunk-K5464A3L.mjs';
4
4
  import './chunk-DBZ3UOQ2.mjs';
5
- import './chunk-2IKULCJK.mjs';
5
+ import './chunk-FVYBHC45.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-2IKULCJK.mjs';
2
+ import { package_default } from './chunk-FVYBHC45.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-SVW5FLGR.mjs';
2
+ export { run as default, extractMockSeed, gatherIntrospection, renderIntrospection } from './chunk-ZC2KRCFO.mjs';
3
3
  import './chunk-K5464A3L.mjs';
4
4
  import './chunk-DBZ3UOQ2.mjs';
5
- import './chunk-2IKULCJK.mjs';
5
+ import './chunk-FVYBHC45.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-M5ZENIII.mjs';
2
+ import { REGISTRY_INDEX } from './chunk-XZZZS6X2.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-2IKULCJK.mjs';
2
+ import { package_default } from './chunk-FVYBHC45.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/cli",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "Cimplify CLI — deploy, manage env vars, link projects, and scaffold storefronts",
5
5
  "keywords": [
6
6
  "cimplify",
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.47.0",
20
+ "@cimplify/sdk": "^0.48.1",
21
21
  "next": "^16.2.4",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.47.0",
20
+ "@cimplify/sdk": "^0.48.1",
21
21
  "next": "^16.2.4",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -19,7 +19,7 @@
19
19
  "check": "bun run typecheck && bun run test:run"
20
20
  },
21
21
  "dependencies": {
22
- "@cimplify/sdk": "^0.47.0",
22
+ "@cimplify/sdk": "^0.48.1",
23
23
  "next": "^16.2.4",
24
24
  "react": "^19.0.0",
25
25
  "react-dom": "^19.0.0"
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.47.0",
20
+ "@cimplify/sdk": "^0.48.1",
21
21
  "next": "^16.2.4",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.47.0",
20
+ "@cimplify/sdk": "^0.48.1",
21
21
  "next": "^16.2.4",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.47.0",
20
+ "@cimplify/sdk": "^0.48.1",
21
21
  "next": "^16.2.4",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.47.0",
20
+ "@cimplify/sdk": "^0.48.1",
21
21
  "next": "^16.2.4",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"
@@ -1,26 +1,19 @@
1
1
  "use client";
2
2
 
3
- import { useMemo, useState } from "react";
3
+ import { useState } from "react";
4
4
  import { useRouter } from "next/navigation";
5
5
  import type { Product } from "@cimplify/sdk";
6
- import { useCart } from "@cimplify/sdk/react";
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
- * Real booking flow:
15
- * 1. Pick a treatment (left rail)
16
- * 2. Pick a date (chips, today + next 13 days)
17
- * 3. Pick a slot (15-minute grid, 10am–7pm)
18
- * 4. Add to cart with the chosen slot as a cart-item note;
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 [selectedDate, setSelectedDate] = useState<Date>(() => new Date());
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 || !selectedSlotKey) return;
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
- notes: `Booked for ${new Date(selectedSlotKey).toLocaleString()}`,
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={() => setSelectedTreatment(t)}
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
- <p className="text-[11px] font-mono uppercase tracking-[0.16em] text-muted-foreground mb-3">
126
- Date
127
- </p>
128
- <div className="grid grid-cols-7 gap-1 sm:gap-1.5 mb-6">
129
- {dates.map((d) => {
130
- const active = d.toDateString() === selectedDate.toDateString();
131
- return (
132
- <button
133
- key={d.toISOString()}
134
- type="button"
135
- onClick={() => {
136
- setSelectedDate(d);
137
- setSelectedSlotKey(null);
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 || !selectedSlotKey || submitting}
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
- : selectedSlotKey
189
- ? `Book ${selectedTreatment?.name} at ${new Date(selectedSlotKey).toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" })}`
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>
@@ -17,7 +17,7 @@
17
17
  "check": "bun run typecheck && bun run test:run"
18
18
  },
19
19
  "dependencies": {
20
- "@cimplify/sdk": "^0.47.0",
20
+ "@cimplify/sdk": "^0.48.1",
21
21
  "next": "^16.2.4",
22
22
  "react": "^19.0.0",
23
23
  "react-dom": "^19.0.0"