create-brainerce-store 1.58.0 → 1.61.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/dist/index.js +7 -2
- package/messages/en.json +22 -0
- package/messages/he.json +22 -0
- package/package.json +2 -1
- package/templates/nextjs/base/.mcp.json +8 -0
- package/templates/nextjs/base/AGENTS.md.ejs +81 -65
- package/templates/nextjs/base/CLAUDE.md.ejs +92 -76
- package/templates/nextjs/base/src/app/api/auth/oauth-callback/route.ts +12 -4
- package/templates/nextjs/base/src/app/auth/callback/page.tsx +16 -1
- package/templates/nextjs/base/src/app/order-status/page.tsx +121 -0
- package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +292 -258
- package/templates/nextjs/base/src/components/checkout/date-picker.tsx +309 -0
- package/templates/nextjs/base/src/components/checkout/datetime-picker.tsx +144 -0
- package/templates/nextjs/base/src/components/checkout/shipping-step.tsx +17 -1
- package/templates/nextjs/designs/atelier/messages-patch/en.json +7 -7
- package/templates/nextjs/designs/atelier/messages-patch/he.json +8 -8
- package/templates/nextjs/designs/atelier/ui/home/editorial-band.tsx +16 -14
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { isCalendarDateAllowed, type DateAvailabilityConstraints } from 'brainerce';
|
|
5
|
+
import { cn } from '@/core/lib/utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Custom calendar dropdown for checkout DATE custom fields — replaces the
|
|
9
|
+
* native `<input type="date">`, whose OS/browser-rendered popup can't be
|
|
10
|
+
* restyled with CSS in any browser (only the closed field can be).
|
|
11
|
+
*
|
|
12
|
+
* Lives next to `custom-fields-step.tsx` (not under `src/ui/`) and stays
|
|
13
|
+
* dependency-free from any design pack for the same reason that file does:
|
|
14
|
+
* canvas scaffolds wipe `src/ui` and ship no pack, but never touch
|
|
15
|
+
* `src/components/`, so this must work without either.
|
|
16
|
+
*
|
|
17
|
+
* Day availability is delegated wholesale to the SDK's `isCalendarDateAllowed`
|
|
18
|
+
* — min/max date, blocked weekdays AND blocked specific dates in one call, the
|
|
19
|
+
* exact predicate the server re-runs on submit. Reimplementing any part of it
|
|
20
|
+
* here is how a picker ends up offering a day the API then rejects with 400.
|
|
21
|
+
*/
|
|
22
|
+
interface DatePickerProps {
|
|
23
|
+
id?: string;
|
|
24
|
+
value: string; // 'YYYY-MM-DD' or ''
|
|
25
|
+
onChange: (value: string) => void;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/** The field's `dateAvailability`, passed straight through from the API. */
|
|
28
|
+
availability?: DateAvailabilityConstraints | null;
|
|
29
|
+
/**
|
|
30
|
+
* Extra per-day gate ANDed with `isCalendarDateAllowed`. DATETIME fields use
|
|
31
|
+
* it to grey out days that pass the calendar rules but have no business-hours
|
|
32
|
+
* window — those are closed all day, and offering them is what produces a
|
|
33
|
+
* "no business hours are configured for this day" 400 after the shopper has
|
|
34
|
+
* already committed to a date.
|
|
35
|
+
*/
|
|
36
|
+
isDateSelectable?: (dateYYYYMMDD: string) => boolean;
|
|
37
|
+
placeholder: string;
|
|
38
|
+
todayLabel: string;
|
|
39
|
+
clearLabel: string;
|
|
40
|
+
prevMonthLabel: string;
|
|
41
|
+
nextMonthLabel: string;
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function pad(n: number): string {
|
|
46
|
+
return String(n).padStart(2, '0');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function toYMD(y: number, m: number, d: number): string {
|
|
50
|
+
return `${y}-${pad(m + 1)}-${pad(d)}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function parseYMD(value: string): { y: number; m: number; d: number } | null {
|
|
54
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
55
|
+
if (!match) return null;
|
|
56
|
+
return { y: Number(match[1]), m: Number(match[2]) - 1, d: Number(match[3]) };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function DatePicker({
|
|
60
|
+
id,
|
|
61
|
+
value,
|
|
62
|
+
onChange,
|
|
63
|
+
required,
|
|
64
|
+
availability,
|
|
65
|
+
isDateSelectable,
|
|
66
|
+
placeholder,
|
|
67
|
+
todayLabel,
|
|
68
|
+
clearLabel,
|
|
69
|
+
prevMonthLabel,
|
|
70
|
+
nextMonthLabel,
|
|
71
|
+
className,
|
|
72
|
+
}: DatePickerProps) {
|
|
73
|
+
const [open, setOpen] = useState(false);
|
|
74
|
+
const [locale, setLocale] = useState<string | undefined>(undefined);
|
|
75
|
+
const [rtl, setRtl] = useState(false);
|
|
76
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
77
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setLocale(document.documentElement.lang || undefined);
|
|
81
|
+
setRtl(document.documentElement.dir === 'rtl');
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
const selected = parseYMD(value);
|
|
85
|
+
const today = new Date();
|
|
86
|
+
const [view, setView] = useState(() => {
|
|
87
|
+
const initial = selected ?? { y: today.getFullYear(), m: today.getMonth() };
|
|
88
|
+
return { y: initial.y, m: initial.m };
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!open) return;
|
|
93
|
+
function onDocClick(e: MouseEvent) {
|
|
94
|
+
if (rootRef.current && !rootRef.current.contains(e.target as Node)) setOpen(false);
|
|
95
|
+
}
|
|
96
|
+
function onKey(e: KeyboardEvent) {
|
|
97
|
+
if (e.key === 'Escape') {
|
|
98
|
+
setOpen(false);
|
|
99
|
+
triggerRef.current?.focus();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
document.addEventListener('mousedown', onDocClick);
|
|
103
|
+
document.addEventListener('keydown', onKey);
|
|
104
|
+
return () => {
|
|
105
|
+
document.removeEventListener('mousedown', onDocClick);
|
|
106
|
+
document.removeEventListener('keydown', onKey);
|
|
107
|
+
};
|
|
108
|
+
}, [open]);
|
|
109
|
+
|
|
110
|
+
function isDisabled(y: number, m: number, d: number): boolean {
|
|
111
|
+
const ymd = toYMD(y, m, d);
|
|
112
|
+
if (!isCalendarDateAllowed(ymd, availability)) return true;
|
|
113
|
+
return isDateSelectable ? !isDateSelectable(ymd) : false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function selectDay(y: number, m: number, d: number) {
|
|
117
|
+
if (isDisabled(y, m, d)) return;
|
|
118
|
+
onChange(toYMD(y, m, d));
|
|
119
|
+
setView({ y, m });
|
|
120
|
+
setOpen(false);
|
|
121
|
+
triggerRef.current?.focus();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function shiftMonth(delta: number) {
|
|
125
|
+
setView((v) => {
|
|
126
|
+
let m = v.m + delta;
|
|
127
|
+
let y = v.y;
|
|
128
|
+
if (m < 0) {
|
|
129
|
+
m = 11;
|
|
130
|
+
y -= 1;
|
|
131
|
+
} else if (m > 11) {
|
|
132
|
+
m = 0;
|
|
133
|
+
y += 1;
|
|
134
|
+
}
|
|
135
|
+
return { y, m };
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const monthLabel = new Date(view.y, view.m, 1).toLocaleDateString(locale, {
|
|
140
|
+
month: 'long',
|
|
141
|
+
year: 'numeric',
|
|
142
|
+
});
|
|
143
|
+
const weekdayLabels = Array.from({ length: 7 }, (_, i) => {
|
|
144
|
+
// A Sunday-anchored week (2023-01-01 was a Sunday) formatted with the
|
|
145
|
+
// page's own locale — matches whatever week-start convention that
|
|
146
|
+
// locale's date formatting implies.
|
|
147
|
+
const d = new Date(2023, 0, 1 + i);
|
|
148
|
+
return d.toLocaleDateString(locale, { weekday: 'narrow' });
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const firstOfMonth = new Date(view.y, view.m, 1);
|
|
152
|
+
const startWeekday = firstOfMonth.getDay();
|
|
153
|
+
const daysInMonth = new Date(view.y, view.m + 1, 0).getDate();
|
|
154
|
+
const daysInPrevMonth = new Date(view.y, view.m, 0).getDate();
|
|
155
|
+
|
|
156
|
+
const cells: Array<{ day: number; muted: boolean; y: number; m: number }> = [];
|
|
157
|
+
for (let i = startWeekday - 1; i >= 0; i--) {
|
|
158
|
+
const m = view.m === 0 ? 11 : view.m - 1;
|
|
159
|
+
const y = view.m === 0 ? view.y - 1 : view.y;
|
|
160
|
+
cells.push({ day: daysInPrevMonth - i, muted: true, y, m });
|
|
161
|
+
}
|
|
162
|
+
for (let d = 1; d <= daysInMonth; d++) {
|
|
163
|
+
cells.push({ day: d, muted: false, y: view.y, m: view.m });
|
|
164
|
+
}
|
|
165
|
+
while (cells.length % 7 !== 0) {
|
|
166
|
+
const idx = cells.length - startWeekday - daysInMonth + 1;
|
|
167
|
+
const m = view.m === 11 ? 0 : view.m + 1;
|
|
168
|
+
const y = view.m === 11 ? view.y + 1 : view.y;
|
|
169
|
+
cells.push({ day: idx, muted: true, y, m });
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const displayValue = selected
|
|
173
|
+
? new Date(selected.y, selected.m, selected.d).toLocaleDateString(locale)
|
|
174
|
+
: '';
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<div ref={rootRef} className={cn('relative', className)}>
|
|
178
|
+
<button
|
|
179
|
+
ref={triggerRef}
|
|
180
|
+
type="button"
|
|
181
|
+
id={id}
|
|
182
|
+
onClick={() => setOpen((o) => !o)}
|
|
183
|
+
aria-haspopup="dialog"
|
|
184
|
+
aria-expanded={open}
|
|
185
|
+
aria-required={required}
|
|
186
|
+
className={cn(
|
|
187
|
+
'bg-background focus-visible:ring-primary flex h-11 w-full items-center rounded-lg border px-3.5 pe-11 text-start text-sm focus-visible:outline-none focus-visible:ring-2',
|
|
188
|
+
displayValue ? 'text-foreground' : 'text-muted-foreground'
|
|
189
|
+
)}
|
|
190
|
+
>
|
|
191
|
+
{displayValue || placeholder}
|
|
192
|
+
<svg
|
|
193
|
+
aria-hidden="true"
|
|
194
|
+
width={18}
|
|
195
|
+
height={18}
|
|
196
|
+
viewBox="0 0 24 24"
|
|
197
|
+
fill="none"
|
|
198
|
+
stroke="currentColor"
|
|
199
|
+
strokeWidth={1.75}
|
|
200
|
+
strokeLinecap="round"
|
|
201
|
+
strokeLinejoin="round"
|
|
202
|
+
className="text-muted-foreground pointer-events-none absolute end-3.5 top-1/2 -translate-y-1/2"
|
|
203
|
+
>
|
|
204
|
+
<rect x="3.5" y="5" width="17" height="15.5" rx="2.5" />
|
|
205
|
+
<path d="M3.5 9.5h17M8 3v3.5M16 3v3.5" />
|
|
206
|
+
</svg>
|
|
207
|
+
</button>
|
|
208
|
+
|
|
209
|
+
{open && (
|
|
210
|
+
<div
|
|
211
|
+
role="dialog"
|
|
212
|
+
aria-label={placeholder}
|
|
213
|
+
className="border-border bg-background absolute start-0 z-20 mt-2 w-[19rem] rounded-2xl border p-4 shadow-xl"
|
|
214
|
+
>
|
|
215
|
+
<div className="mb-3 flex items-center justify-between">
|
|
216
|
+
<div className="flex gap-1">
|
|
217
|
+
<button
|
|
218
|
+
type="button"
|
|
219
|
+
onClick={() => shiftMonth(rtl ? 1 : -1)}
|
|
220
|
+
aria-label={prevMonthLabel}
|
|
221
|
+
className="border-border hover:bg-secondary flex h-8 w-8 items-center justify-center rounded-full border text-sm"
|
|
222
|
+
>
|
|
223
|
+
{rtl ? '›' : '‹'}
|
|
224
|
+
</button>
|
|
225
|
+
<button
|
|
226
|
+
type="button"
|
|
227
|
+
onClick={() => shiftMonth(rtl ? -1 : 1)}
|
|
228
|
+
aria-label={nextMonthLabel}
|
|
229
|
+
className="border-border hover:bg-secondary flex h-8 w-8 items-center justify-center rounded-full border text-sm"
|
|
230
|
+
>
|
|
231
|
+
{rtl ? '‹' : '›'}
|
|
232
|
+
</button>
|
|
233
|
+
</div>
|
|
234
|
+
<div className="font-display text-sm font-medium capitalize">{monthLabel}</div>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<div className="mb-1 grid grid-cols-7">
|
|
238
|
+
{weekdayLabels.map((w, i) => (
|
|
239
|
+
<span
|
|
240
|
+
key={i}
|
|
241
|
+
className="text-muted-foreground py-1 text-center text-[0.7rem] font-semibold"
|
|
242
|
+
>
|
|
243
|
+
{w}
|
|
244
|
+
</span>
|
|
245
|
+
))}
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<div className="grid grid-cols-7 gap-0.5">
|
|
249
|
+
{cells.map((c, i) => {
|
|
250
|
+
const disabled = c.muted || isDisabled(c.y, c.m, c.day);
|
|
251
|
+
const isToday =
|
|
252
|
+
!c.muted &&
|
|
253
|
+
c.y === today.getFullYear() &&
|
|
254
|
+
c.m === today.getMonth() &&
|
|
255
|
+
c.day === today.getDate();
|
|
256
|
+
const isSelected =
|
|
257
|
+
selected &&
|
|
258
|
+
!c.muted &&
|
|
259
|
+
c.y === selected.y &&
|
|
260
|
+
c.m === selected.m &&
|
|
261
|
+
c.day === selected.d;
|
|
262
|
+
return (
|
|
263
|
+
<button
|
|
264
|
+
key={i}
|
|
265
|
+
type="button"
|
|
266
|
+
disabled={disabled}
|
|
267
|
+
onClick={() => selectDay(c.y, c.m, c.day)}
|
|
268
|
+
className={cn(
|
|
269
|
+
'flex aspect-square items-center justify-center rounded-full text-sm tabular-nums',
|
|
270
|
+
c.muted && 'text-muted-foreground/40',
|
|
271
|
+
disabled && !c.muted && 'text-muted-foreground/40 cursor-not-allowed',
|
|
272
|
+
!disabled && !isSelected && 'hover:bg-secondary',
|
|
273
|
+
isToday && !isSelected && 'ring-primary font-semibold ring-1',
|
|
274
|
+
isSelected && 'bg-primary text-primary-foreground font-bold'
|
|
275
|
+
)}
|
|
276
|
+
>
|
|
277
|
+
{c.day}
|
|
278
|
+
</button>
|
|
279
|
+
);
|
|
280
|
+
})}
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div className="border-border mt-3 flex justify-between border-t pt-3">
|
|
284
|
+
<button
|
|
285
|
+
type="button"
|
|
286
|
+
onClick={() => {
|
|
287
|
+
const t = new Date();
|
|
288
|
+
selectDay(t.getFullYear(), t.getMonth(), t.getDate());
|
|
289
|
+
}}
|
|
290
|
+
className="text-primary text-sm font-semibold hover:underline"
|
|
291
|
+
>
|
|
292
|
+
{todayLabel}
|
|
293
|
+
</button>
|
|
294
|
+
<button
|
|
295
|
+
type="button"
|
|
296
|
+
onClick={() => {
|
|
297
|
+
onChange('');
|
|
298
|
+
setOpen(false);
|
|
299
|
+
}}
|
|
300
|
+
className="text-primary text-sm font-semibold hover:underline"
|
|
301
|
+
>
|
|
302
|
+
{clearLabel}
|
|
303
|
+
</button>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
)}
|
|
307
|
+
</div>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
computeAvailableSlots,
|
|
6
|
+
getBusinessHoursForDate,
|
|
7
|
+
type DateAvailabilityConstraints,
|
|
8
|
+
} from 'brainerce';
|
|
9
|
+
import { cn } from '@/core/lib/utils';
|
|
10
|
+
import { DatePicker } from '@/components/checkout/date-picker';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Date + time control for checkout `DATETIME` custom fields.
|
|
14
|
+
*
|
|
15
|
+
* **The value it emits is `"YYYY-MM-DDTHH:mm"` with no UTC offset**, which the
|
|
16
|
+
* API resolves in the *store's* timezone — the only frame a delivery slot has.
|
|
17
|
+
* Do not append an offset from the shopper's browser (a buyer travelling
|
|
18
|
+
* abroad would book a different hour than the one they tapped), and never
|
|
19
|
+
* concatenate a human slot label: `"2026-08-13" + "T13:00-14:00"` parses as a
|
|
20
|
+
* -14:00 UTC offset and silently books the following day.
|
|
21
|
+
*
|
|
22
|
+
* Which times exist comes from the SDK, not from a list hardcoded here:
|
|
23
|
+
* - `computeAvailableSlots` → discrete slot starts, when the field defines
|
|
24
|
+
* `slotDurationMinutes`. The submitted time must equal one of them exactly.
|
|
25
|
+
* - `getBusinessHoursForDate` → the open/close window, when it doesn't. Slots
|
|
26
|
+
* being empty does NOT mean the day is closed; that distinction is why this
|
|
27
|
+
* component asks for the windows separately.
|
|
28
|
+
*
|
|
29
|
+
* Dependency-free from any design pack, same as `date-picker.tsx`.
|
|
30
|
+
*/
|
|
31
|
+
interface DateTimePickerProps {
|
|
32
|
+
id?: string;
|
|
33
|
+
/** 'YYYY-MM-DDTHH:mm' or ''. */
|
|
34
|
+
value: string;
|
|
35
|
+
onChange: (value: string) => void;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
availability?: DateAvailabilityConstraints | null;
|
|
38
|
+
placeholder: string;
|
|
39
|
+
todayLabel: string;
|
|
40
|
+
clearLabel: string;
|
|
41
|
+
prevMonthLabel: string;
|
|
42
|
+
nextMonthLabel: string;
|
|
43
|
+
timeLabel: string;
|
|
44
|
+
closedLabel: string;
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function splitValue(value: string): { date: string; time: string } {
|
|
49
|
+
const [date = '', time = ''] = value.split('T');
|
|
50
|
+
return { date, time: time.slice(0, 5) };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function DateTimePicker({
|
|
54
|
+
id,
|
|
55
|
+
value,
|
|
56
|
+
onChange,
|
|
57
|
+
required,
|
|
58
|
+
availability,
|
|
59
|
+
placeholder,
|
|
60
|
+
todayLabel,
|
|
61
|
+
clearLabel,
|
|
62
|
+
prevMonthLabel,
|
|
63
|
+
nextMonthLabel,
|
|
64
|
+
timeLabel,
|
|
65
|
+
closedLabel,
|
|
66
|
+
className,
|
|
67
|
+
}: DateTimePickerProps) {
|
|
68
|
+
const submitted = splitValue(value);
|
|
69
|
+
// The date survives on its own while no time is picked yet. The field value
|
|
70
|
+
// stays empty until both halves exist, so a `required` field can't be
|
|
71
|
+
// satisfied by a half-filled answer.
|
|
72
|
+
const [date, setDate] = useState(submitted.date);
|
|
73
|
+
|
|
74
|
+
const slots = date ? computeAvailableSlots(availability, date) : [];
|
|
75
|
+
const windows = date ? getBusinessHoursForDate(availability, date) : [];
|
|
76
|
+
const openDay = (dateYYYYMMDD: string) =>
|
|
77
|
+
!availability?.businessHours?.length ||
|
|
78
|
+
getBusinessHoursForDate(availability, dateYYYYMMDD).length > 0;
|
|
79
|
+
|
|
80
|
+
const commit = (nextDate: string, nextTime: string) => {
|
|
81
|
+
setDate(nextDate);
|
|
82
|
+
onChange(nextDate && nextTime ? `${nextDate}T${nextTime}` : '');
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div className={cn('space-y-2', className)}>
|
|
87
|
+
<DatePicker
|
|
88
|
+
id={id}
|
|
89
|
+
value={date}
|
|
90
|
+
onChange={(d) => commit(d, '')}
|
|
91
|
+
required={required}
|
|
92
|
+
availability={availability}
|
|
93
|
+
isDateSelectable={openDay}
|
|
94
|
+
placeholder={placeholder}
|
|
95
|
+
todayLabel={todayLabel}
|
|
96
|
+
clearLabel={clearLabel}
|
|
97
|
+
prevMonthLabel={prevMonthLabel}
|
|
98
|
+
nextMonthLabel={nextMonthLabel}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
{date && slots.length > 0 && (
|
|
102
|
+
<div className="flex flex-wrap gap-1.5" role="group" aria-label={timeLabel}>
|
|
103
|
+
{slots.map((slot) => (
|
|
104
|
+
<button
|
|
105
|
+
key={slot}
|
|
106
|
+
type="button"
|
|
107
|
+
onClick={() => commit(date, slot)}
|
|
108
|
+
aria-pressed={submitted.time === slot}
|
|
109
|
+
className={cn(
|
|
110
|
+
'h-9 rounded-lg border px-3 text-sm tabular-nums transition-colors',
|
|
111
|
+
submitted.time === slot
|
|
112
|
+
? 'bg-primary text-primary-foreground border-primary font-semibold'
|
|
113
|
+
: 'border-border hover:bg-secondary'
|
|
114
|
+
)}
|
|
115
|
+
>
|
|
116
|
+
{slot}
|
|
117
|
+
</button>
|
|
118
|
+
))}
|
|
119
|
+
</div>
|
|
120
|
+
)}
|
|
121
|
+
|
|
122
|
+
{date && slots.length === 0 && windows.length > 0 && (
|
|
123
|
+
<label className="flex items-center gap-2 text-sm">
|
|
124
|
+
<span className="text-muted-foreground">{timeLabel}</span>
|
|
125
|
+
<input
|
|
126
|
+
type="time"
|
|
127
|
+
value={submitted.time}
|
|
128
|
+
required={required}
|
|
129
|
+
// The window is a half-open interval [open, close) server-side, so
|
|
130
|
+
// `max` here is the last minute the API will still accept.
|
|
131
|
+
min={windows[0].open}
|
|
132
|
+
max={windows[0].close}
|
|
133
|
+
onChange={(e) => commit(date, e.target.value)}
|
|
134
|
+
className="bg-background focus-visible:ring-primary h-11 rounded-lg border px-3 text-sm focus-visible:outline-none focus-visible:ring-2"
|
|
135
|
+
/>
|
|
136
|
+
</label>
|
|
137
|
+
)}
|
|
138
|
+
|
|
139
|
+
{date && slots.length === 0 && windows.length === 0 && (
|
|
140
|
+
<p className="text-muted-foreground text-xs">{closedLabel}</p>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
@@ -14,6 +14,21 @@ interface ShippingStepProps {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Live carrier rates arrive labelled with the carrier's own service identifier
|
|
19
|
+
* — `USPS PriorityMailInternational`, `USAExportPBA USAExportStandard` — which
|
|
20
|
+
* answers a question no shopper asked. They are choosing between how fast and
|
|
21
|
+
* how much, so we render `speedTier` in the store's own language instead.
|
|
22
|
+
*
|
|
23
|
+
* Manual zone rates carry no `speedTier`: the merchant named those deliberately,
|
|
24
|
+
* so those keep `rate.name` exactly as written.
|
|
25
|
+
*/
|
|
26
|
+
const TIER_KEYS = {
|
|
27
|
+
cheapest: 'shippingTierCheapest',
|
|
28
|
+
balanced: 'shippingTierBalanced',
|
|
29
|
+
fastest: 'shippingTierFastest',
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
17
32
|
export function ShippingStep({
|
|
18
33
|
rates,
|
|
19
34
|
selectedRateId,
|
|
@@ -53,6 +68,7 @@ export function ShippingStep({
|
|
|
53
68
|
const price = parseFloat(rate.price);
|
|
54
69
|
const isFree = price === 0;
|
|
55
70
|
const isSelected = selectedRateId === rate.id;
|
|
71
|
+
const label = rate.speedTier ? t(TIER_KEYS[rate.speedTier]) : rate.name;
|
|
56
72
|
|
|
57
73
|
return (
|
|
58
74
|
<button
|
|
@@ -80,7 +96,7 @@ export function ShippingStep({
|
|
|
80
96
|
|
|
81
97
|
{/* Rate info */}
|
|
82
98
|
<div className="min-w-0 flex-1">
|
|
83
|
-
<p className="text-foreground text-sm font-medium">{
|
|
99
|
+
<p className="text-foreground text-sm font-medium">{label}</p>
|
|
84
100
|
{rate.description && (
|
|
85
101
|
<p className="text-muted-foreground mt-0.5 text-xs">{rate.description}</p>
|
|
86
102
|
)}
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"catEarrings": "Earrings",
|
|
31
31
|
"catBracelets": "Bracelets",
|
|
32
32
|
"catCta": "Shop the category",
|
|
33
|
-
"storyEyebrow": "Our
|
|
33
|
+
"storyEyebrow": "Our story",
|
|
34
34
|
"storyTitle": "Made with care, made to last",
|
|
35
|
-
"storyP1": "Every
|
|
36
|
-
"storyP2": "We believe in
|
|
35
|
+
"storyP1": "Every product we carry is chosen with the same question in mind: would we want this ourselves? We check quality, sourcing and detail before anything reaches our shelves, so what arrives at your door is exactly what you expect.",
|
|
36
|
+
"storyP2": "We believe in products that last: solid materials, careful quality checks and full support behind every order. That is what care for the details looks like.",
|
|
37
37
|
"storyCta": "Discover the collection",
|
|
38
|
-
"storyStat1Value": "
|
|
39
|
-
"storyStat1Label": "Every
|
|
40
|
-
"storyStat2Value": "
|
|
41
|
-
"storyStat2Label": "Every
|
|
38
|
+
"storyStat1Value": "Quality-checked",
|
|
39
|
+
"storyStat1Label": "Every product is checked before it's listed",
|
|
40
|
+
"storyStat2Value": "Fully guaranteed",
|
|
41
|
+
"storyStat2Label": "Every order backed by our support",
|
|
42
42
|
"testimonialsEyebrow": "Customer stories",
|
|
43
43
|
"testimonialsTitle": "They already fell in love",
|
|
44
44
|
"testimonial1Quote": "It arrived in gorgeous packaging and looks even better than the photos. I got compliments on day one.",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"catEarrings": "עגילים",
|
|
31
31
|
"catBracelets": "צמידים",
|
|
32
32
|
"catCta": "לצפייה בקטגוריה",
|
|
33
|
-
"storyEyebrow": "
|
|
34
|
-
"storyTitle": "
|
|
35
|
-
"storyP1": "כל
|
|
36
|
-
"storyP2": "אנחנו מאמינים
|
|
33
|
+
"storyEyebrow": "הסיפור שלנו",
|
|
34
|
+
"storyTitle": "מוקפד בכל פרט, מהתחלה ועד אליכם",
|
|
35
|
+
"storyP1": "כל מוצר אצלנו עובר את אותה שאלה: האם היינו רוצים אותו בעצמנו? אנחנו בודקים איכות, מקור וכל פרט לפני שמשהו עולה למדף שלנו, כדי שמה שמגיע אליכם יהיה בדיוק מה שציפיתם לו.",
|
|
36
|
+
"storyP2": "אנחנו מאמינים במוצרים שנשארים: חומרים איכותיים, בקרת איכות קפדנית ותמיכה מלאה מאחורי כל הזמנה. ככה נראית תשומת לב לפרטים הקטנים.",
|
|
37
37
|
"storyCta": "לגלות את הקולקציה",
|
|
38
|
-
"storyStat1Value": "
|
|
39
|
-
"storyStat1Label": "כל
|
|
40
|
-
"storyStat2Value": "
|
|
41
|
-
"storyStat2Label": "כל
|
|
38
|
+
"storyStat1Value": "איכות נבדקת",
|
|
39
|
+
"storyStat1Label": "כל מוצר נבדק לפני שהוא עולה לאתר",
|
|
40
|
+
"storyStat2Value": "אחריות מלאה",
|
|
41
|
+
"storyStat2Label": "כל הזמנה מגובה בתמיכה שלנו",
|
|
42
42
|
"testimonialsEyebrow": "לקוחות מספרות",
|
|
43
43
|
"testimonialsTitle": "הן כבר התאהבו",
|
|
44
44
|
"testimonial1Quote": "הפריט הגיע באריזה מהממת ונראה אפילו יותר טוב מבתמונות. קיבלתי מחמאות כבר ביום הראשון.",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Editorial "our
|
|
4
|
+
* Editorial "our story" band — lifestyle photography (Pexels hotlinks,
|
|
5
5
|
* HEAD-verified) + brand-story copy from translation keys. Purely template
|
|
6
|
-
* marketing content; no catalog data is hardcoded here.
|
|
6
|
+
* marketing content; no catalog data is hardcoded here. Deliberately
|
|
7
|
+
* vertical-neutral (order fulfillment / packaging imagery, not a specific
|
|
8
|
+
* product category) since this pack scaffolds stores of any kind.
|
|
7
9
|
*/
|
|
8
10
|
import { Link } from '@/core/lib/navigation';
|
|
9
11
|
import { useTranslations } from '@/core/lib/translations';
|
|
@@ -11,9 +13,9 @@ import { IconArrowEnd } from '@/ui/shared/icons';
|
|
|
11
13
|
|
|
12
14
|
// Verified free-stock imagery (images.pexels.com allows hotlinking).
|
|
13
15
|
const IMG_MODEL =
|
|
14
|
-
'https://images.pexels.com/photos/
|
|
16
|
+
'https://images.pexels.com/photos/7857523/pexels-photo-7857523.jpeg?auto=compress&cs=tinysrgb&w=1200';
|
|
15
17
|
const IMG_DETAIL =
|
|
16
|
-
'https://images.pexels.com/photos/
|
|
18
|
+
'https://images.pexels.com/photos/6224252/pexels-photo-6224252.jpeg?auto=compress&cs=tinysrgb&w=800';
|
|
17
19
|
|
|
18
20
|
export function EditorialBand() {
|
|
19
21
|
const t = useTranslations('home');
|
|
@@ -23,8 +25,8 @@ export function EditorialBand() {
|
|
|
23
25
|
<div className="container-page grid items-center gap-10 lg:grid-cols-2 lg:gap-16">
|
|
24
26
|
{/* Image pair */}
|
|
25
27
|
<div className="grid grid-cols-12 gap-4">
|
|
26
|
-
<figure className="col-span-8 -rotate-2 overflow-hidden rounded-3xl border-4
|
|
27
|
-
{
|
|
28
|
+
<figure className="border-background col-span-8 -rotate-2 overflow-hidden rounded-3xl border-4 shadow-[0_28px_60px_-24px_hsl(var(--primary)/0.35)]">
|
|
29
|
+
{}
|
|
28
30
|
<img
|
|
29
31
|
src={IMG_MODEL}
|
|
30
32
|
alt={t('storyTitle')}
|
|
@@ -32,8 +34,8 @@ export function EditorialBand() {
|
|
|
32
34
|
className="aspect-[4/5] h-full w-full object-cover"
|
|
33
35
|
/>
|
|
34
36
|
</figure>
|
|
35
|
-
<figure className="col-span-4 -mb-8 self-end
|
|
36
|
-
{
|
|
37
|
+
<figure className="border-background col-span-4 -mb-8 rotate-3 self-end overflow-hidden rounded-3xl border-4 shadow-[0_24px_50px_-20px_hsl(var(--primary)/0.35)]">
|
|
38
|
+
{}
|
|
37
39
|
<img
|
|
38
40
|
src={IMG_DETAIL}
|
|
39
41
|
alt={t('storyStat1Value')}
|
|
@@ -47,18 +49,18 @@ export function EditorialBand() {
|
|
|
47
49
|
<div className="max-w-xl">
|
|
48
50
|
<span className="eyebrow">{t('storyEyebrow')}</span>
|
|
49
51
|
<h2 className="text-4xl sm:text-5xl">{t('storyTitle')}</h2>
|
|
50
|
-
<p className="mt-5 leading-8
|
|
51
|
-
<p className="mt-4 leading-8
|
|
52
|
+
<p className="text-muted-foreground mt-5 leading-8">{t('storyP1')}</p>
|
|
53
|
+
<p className="text-muted-foreground mt-4 leading-8">{t('storyP2')}</p>
|
|
52
54
|
|
|
53
55
|
{/* Craft highlights */}
|
|
54
56
|
<dl className="mt-8 grid grid-cols-2 gap-6 border-t pt-8">
|
|
55
57
|
<div>
|
|
56
|
-
<dt className="font-display text-
|
|
57
|
-
<dd className="mt-1 text-sm
|
|
58
|
+
<dt className="font-display text-foreground text-2xl">{t('storyStat1Value')}</dt>
|
|
59
|
+
<dd className="text-muted-foreground mt-1 text-sm">{t('storyStat1Label')}</dd>
|
|
58
60
|
</div>
|
|
59
61
|
<div>
|
|
60
|
-
<dt className="font-display text-
|
|
61
|
-
<dd className="mt-1 text-sm
|
|
62
|
+
<dt className="font-display text-foreground text-2xl">{t('storyStat2Value')}</dt>
|
|
63
|
+
<dd className="text-muted-foreground mt-1 text-sm">{t('storyStat2Label')}</dd>
|
|
62
64
|
</div>
|
|
63
65
|
</dl>
|
|
64
66
|
|