create-brainerce-store 1.53.0 → 1.55.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 +9 -2
- package/package.json +1 -1
- package/templates/nextjs/base/src/app/blog/[slug]/page.tsx.ejs +17 -31
- package/templates/nextjs/base/src/app/category/[slug]/page.tsx +106 -0
- package/templates/nextjs/base/src/app/indexnow-key.txt/route.ts +26 -0
- package/templates/nextjs/base/src/app/llms.txt/route.ts +44 -0
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +175 -157
- package/templates/nextjs/base/src/app/sitemap.ts +18 -1
- package/templates/nextjs/base/src/components/brainerce-bot.tsx +7 -0
- package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +564 -551
- package/templates/nextjs/base/src/components/seo/article-json-ld.tsx +59 -0
- package/templates/nextjs/base/src/components/seo/breadcrumbs.tsx +37 -0
- package/templates/nextjs/base/src/components/seo/category-json-ld.tsx +61 -0
- package/templates/nextjs/base/src/components/seo/organization-json-ld.tsx +4 -1
- package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +56 -2
- package/templates/nextjs/base/src/core/lib/store-info.ts +3 -0
- package/templates/nextjs/designs/atelier/globals.css +1 -1
- package/templates/nextjs/designs/atelier/messages-patch/en.json +13 -13
- package/templates/nextjs/designs/atelier/messages-patch/he.json +15 -15
- package/templates/nextjs/designs/atelier/ui/home/category-tiles.tsx +16 -13
- package/templates/nextjs/designs/atelier/ui/shared/icons.tsx +1 -1
|
@@ -1,551 +1,564 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useEffect, useRef } from 'react';
|
|
4
|
-
import type { SetShippingAddressDto, ShippingDestinations, AddressSuggestion } from 'brainerce';
|
|
5
|
-
import { useTranslations } from '@/core/lib/translations';
|
|
6
|
-
import { cn } from '@/core/lib/utils';
|
|
7
|
-
import { isValidEmail } from '@/core/lib/validation';
|
|
8
|
-
import { getClient } from '@/core/lib/brainerce';
|
|
9
|
-
|
|
10
|
-
// Debounce address-suggestion calls rather than firing on every keystroke —
|
|
11
|
-
// both to avoid a jumpy dropdown and to keep autocomplete-session call volume
|
|
12
|
-
// reasonable (see `getAddressSuggestions` doc in the SDK).
|
|
13
|
-
const ADDRESS_SEARCH_DEBOUNCE_MS = 300;
|
|
14
|
-
const ADDRESS_SEARCH_MIN_CHARS = 3;
|
|
15
|
-
|
|
16
|
-
interface CheckoutConsent {
|
|
17
|
-
acceptsMarketing: boolean;
|
|
18
|
-
saveDetails: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface CheckoutFormProps {
|
|
22
|
-
onSubmit: (address: SetShippingAddressDto, consent: CheckoutConsent) => void;
|
|
23
|
-
loading?: boolean;
|
|
24
|
-
initialValues?: Partial<SetShippingAddressDto>;
|
|
25
|
-
destinations?: ShippingDestinations | null;
|
|
26
|
-
className?: string;
|
|
27
|
-
showSaveDetails?: boolean;
|
|
28
|
-
emailOnly?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function CheckoutForm({
|
|
32
|
-
onSubmit,
|
|
33
|
-
loading = false,
|
|
34
|
-
initialValues,
|
|
35
|
-
destinations,
|
|
36
|
-
className,
|
|
37
|
-
showSaveDetails = false,
|
|
38
|
-
emailOnly = false,
|
|
39
|
-
}: CheckoutFormProps) {
|
|
40
|
-
const [formData, setFormData] = useState<SetShippingAddressDto>({
|
|
41
|
-
email: initialValues?.email || '',
|
|
42
|
-
firstName: initialValues?.firstName || '',
|
|
43
|
-
lastName: initialValues?.lastName || '',
|
|
44
|
-
line1: initialValues?.line1 || '',
|
|
45
|
-
line2: initialValues?.line2 || '',
|
|
46
|
-
city: initialValues?.city || '',
|
|
47
|
-
region: initialValues?.region || '',
|
|
48
|
-
postalCode: initialValues?.postalCode || '',
|
|
49
|
-
country: initialValues?.country || '',
|
|
50
|
-
phone: initialValues?.phone || '',
|
|
51
|
-
notes: initialValues?.notes || '',
|
|
52
|
-
});
|
|
53
|
-
const [errors, setErrors] = useState<Record<string, string>>({});
|
|
54
|
-
const [privacyAccepted, setPrivacyAccepted] = useState(false);
|
|
55
|
-
const [acceptsMarketing, setAcceptsMarketing] = useState(false);
|
|
56
|
-
const [saveDetails, setSaveDetails] = useState(true);
|
|
57
|
-
const t = useTranslations('checkoutForm');
|
|
58
|
-
const tc = useTranslations('common');
|
|
59
|
-
const hasAppliedPrefill = useRef(!!initialValues);
|
|
60
|
-
|
|
61
|
-
// Address-autocomplete state — groups one address-entry attempt for
|
|
62
|
-
// session-token billing (see `getAddressSuggestions` in the SDK). A fresh
|
|
63
|
-
// token is minted whenever a suggestion is picked, ending that session.
|
|
64
|
-
const [addressSuggestions, setAddressSuggestions] = useState<AddressSuggestion[]>([]);
|
|
65
|
-
const [showAddressSuggestions, setShowAddressSuggestions] = useState(false);
|
|
66
|
-
const [isSearchingAddress, setIsSearchingAddress] = useState(false);
|
|
67
|
-
const [outsideDeliveryZone, setOutsideDeliveryZone] = useState(false);
|
|
68
|
-
const addressSessionToken = useRef(
|
|
69
|
-
typeof crypto !== 'undefined' ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`
|
|
70
|
-
);
|
|
71
|
-
const addressSearchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
72
|
-
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
return () => {
|
|
75
|
-
if (addressSearchTimer.current) clearTimeout(addressSearchTimer.current);
|
|
76
|
-
};
|
|
77
|
-
}, []);
|
|
78
|
-
|
|
79
|
-
function handleLine1Change(value: string) {
|
|
80
|
-
updateField('line1', value);
|
|
81
|
-
setOutsideDeliveryZone(false);
|
|
82
|
-
|
|
83
|
-
if (addressSearchTimer.current) clearTimeout(addressSearchTimer.current);
|
|
84
|
-
|
|
85
|
-
const query = value.trim();
|
|
86
|
-
if (query.length < ADDRESS_SEARCH_MIN_CHARS) {
|
|
87
|
-
setAddressSuggestions([]);
|
|
88
|
-
setShowAddressSuggestions(false);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
addressSearchTimer.current = setTimeout(async () => {
|
|
93
|
-
setIsSearchingAddress(true);
|
|
94
|
-
try {
|
|
95
|
-
const results = await getClient().getAddressSuggestions(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
<
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
{
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
</
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect, useRef } from 'react';
|
|
4
|
+
import type { SetShippingAddressDto, ShippingDestinations, AddressSuggestion } from 'brainerce';
|
|
5
|
+
import { useTranslations } from '@/core/lib/translations';
|
|
6
|
+
import { cn } from '@/core/lib/utils';
|
|
7
|
+
import { isValidEmail } from '@/core/lib/validation';
|
|
8
|
+
import { getClient } from '@/core/lib/brainerce';
|
|
9
|
+
|
|
10
|
+
// Debounce address-suggestion calls rather than firing on every keystroke —
|
|
11
|
+
// both to avoid a jumpy dropdown and to keep autocomplete-session call volume
|
|
12
|
+
// reasonable (see `getAddressSuggestions` doc in the SDK).
|
|
13
|
+
const ADDRESS_SEARCH_DEBOUNCE_MS = 300;
|
|
14
|
+
const ADDRESS_SEARCH_MIN_CHARS = 3;
|
|
15
|
+
|
|
16
|
+
interface CheckoutConsent {
|
|
17
|
+
acceptsMarketing: boolean;
|
|
18
|
+
saveDetails: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface CheckoutFormProps {
|
|
22
|
+
onSubmit: (address: SetShippingAddressDto, consent: CheckoutConsent) => void;
|
|
23
|
+
loading?: boolean;
|
|
24
|
+
initialValues?: Partial<SetShippingAddressDto>;
|
|
25
|
+
destinations?: ShippingDestinations | null;
|
|
26
|
+
className?: string;
|
|
27
|
+
showSaveDetails?: boolean;
|
|
28
|
+
emailOnly?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function CheckoutForm({
|
|
32
|
+
onSubmit,
|
|
33
|
+
loading = false,
|
|
34
|
+
initialValues,
|
|
35
|
+
destinations,
|
|
36
|
+
className,
|
|
37
|
+
showSaveDetails = false,
|
|
38
|
+
emailOnly = false,
|
|
39
|
+
}: CheckoutFormProps) {
|
|
40
|
+
const [formData, setFormData] = useState<SetShippingAddressDto>({
|
|
41
|
+
email: initialValues?.email || '',
|
|
42
|
+
firstName: initialValues?.firstName || '',
|
|
43
|
+
lastName: initialValues?.lastName || '',
|
|
44
|
+
line1: initialValues?.line1 || '',
|
|
45
|
+
line2: initialValues?.line2 || '',
|
|
46
|
+
city: initialValues?.city || '',
|
|
47
|
+
region: initialValues?.region || '',
|
|
48
|
+
postalCode: initialValues?.postalCode || '',
|
|
49
|
+
country: initialValues?.country || '',
|
|
50
|
+
phone: initialValues?.phone || '',
|
|
51
|
+
notes: initialValues?.notes || '',
|
|
52
|
+
});
|
|
53
|
+
const [errors, setErrors] = useState<Record<string, string>>({});
|
|
54
|
+
const [privacyAccepted, setPrivacyAccepted] = useState(false);
|
|
55
|
+
const [acceptsMarketing, setAcceptsMarketing] = useState(false);
|
|
56
|
+
const [saveDetails, setSaveDetails] = useState(true);
|
|
57
|
+
const t = useTranslations('checkoutForm');
|
|
58
|
+
const tc = useTranslations('common');
|
|
59
|
+
const hasAppliedPrefill = useRef(!!initialValues);
|
|
60
|
+
|
|
61
|
+
// Address-autocomplete state — groups one address-entry attempt for
|
|
62
|
+
// session-token billing (see `getAddressSuggestions` in the SDK). A fresh
|
|
63
|
+
// token is minted whenever a suggestion is picked, ending that session.
|
|
64
|
+
const [addressSuggestions, setAddressSuggestions] = useState<AddressSuggestion[]>([]);
|
|
65
|
+
const [showAddressSuggestions, setShowAddressSuggestions] = useState(false);
|
|
66
|
+
const [isSearchingAddress, setIsSearchingAddress] = useState(false);
|
|
67
|
+
const [outsideDeliveryZone, setOutsideDeliveryZone] = useState(false);
|
|
68
|
+
const addressSessionToken = useRef(
|
|
69
|
+
typeof crypto !== 'undefined' ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`
|
|
70
|
+
);
|
|
71
|
+
const addressSearchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
return () => {
|
|
75
|
+
if (addressSearchTimer.current) clearTimeout(addressSearchTimer.current);
|
|
76
|
+
};
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
function handleLine1Change(value: string) {
|
|
80
|
+
updateField('line1', value);
|
|
81
|
+
setOutsideDeliveryZone(false);
|
|
82
|
+
|
|
83
|
+
if (addressSearchTimer.current) clearTimeout(addressSearchTimer.current);
|
|
84
|
+
|
|
85
|
+
const query = value.trim();
|
|
86
|
+
if (query.length < ADDRESS_SEARCH_MIN_CHARS) {
|
|
87
|
+
setAddressSuggestions([]);
|
|
88
|
+
setShowAddressSuggestions(false);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
addressSearchTimer.current = setTimeout(async () => {
|
|
93
|
+
setIsSearchingAddress(true);
|
|
94
|
+
try {
|
|
95
|
+
const results = await getClient().getAddressSuggestions(query, addressSessionToken.current);
|
|
96
|
+
setAddressSuggestions(results);
|
|
97
|
+
setShowAddressSuggestions(results.length > 0);
|
|
98
|
+
} catch {
|
|
99
|
+
// Autocomplete is a soft enhancement — a failed lookup just means no
|
|
100
|
+
// suggestions this keystroke; the shopper can keep typing manually.
|
|
101
|
+
setAddressSuggestions([]);
|
|
102
|
+
setShowAddressSuggestions(false);
|
|
103
|
+
} finally {
|
|
104
|
+
setIsSearchingAddress(false);
|
|
105
|
+
}
|
|
106
|
+
}, ADDRESS_SEARCH_DEBOUNCE_MS);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function handleSelectAddressSuggestion(suggestion: AddressSuggestion) {
|
|
110
|
+
setShowAddressSuggestions(false);
|
|
111
|
+
try {
|
|
112
|
+
const { address, inZone } = await getClient().getAddressDetails(
|
|
113
|
+
suggestion.placeId,
|
|
114
|
+
addressSessionToken.current
|
|
115
|
+
);
|
|
116
|
+
setFormData((prev) => {
|
|
117
|
+
const country = address.country || prev.country;
|
|
118
|
+
// Only accept address.region if it's one of THIS store's known
|
|
119
|
+
// region codes for the resolved country (destinations.regions —
|
|
120
|
+
// the same list the dropdown below renders, backed by our own
|
|
121
|
+
// geo-data, not Google's). Google's region code usually lines up
|
|
122
|
+
// (both ultimately trace back to ISO 3166-2), but never assign a
|
|
123
|
+
// value the dropdown wouldn't recognize — better an unselected
|
|
124
|
+
// dropdown the shopper fills in than a silently-wrong one.
|
|
125
|
+
const validRegions = destinations?.regions[country] ?? [];
|
|
126
|
+
const resolvedRegionValid = validRegions.some((r) => r.code === address.region);
|
|
127
|
+
return {
|
|
128
|
+
...prev,
|
|
129
|
+
line1: address.line1 || prev.line1,
|
|
130
|
+
city: address.city || prev.city,
|
|
131
|
+
region: resolvedRegionValid
|
|
132
|
+
? address.region
|
|
133
|
+
: country !== prev.country
|
|
134
|
+
? ''
|
|
135
|
+
: prev.region,
|
|
136
|
+
postalCode: address.postalCode || prev.postalCode,
|
|
137
|
+
country,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
setOutsideDeliveryZone(!inZone);
|
|
141
|
+
} catch {
|
|
142
|
+
// Resolution failed — keep whatever the shopper had typed/selected as
|
|
143
|
+
// the visible text; they can still fill in the rest manually.
|
|
144
|
+
} finally {
|
|
145
|
+
// New session for the next address-entry attempt.
|
|
146
|
+
addressSessionToken.current =
|
|
147
|
+
typeof crypto !== 'undefined' ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`;
|
|
148
|
+
setAddressSuggestions([]);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Sync prefill data when it arrives async (e.g. from getCheckoutPrefillData)
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (!initialValues || hasAppliedPrefill.current) return;
|
|
155
|
+
hasAppliedPrefill.current = true;
|
|
156
|
+
setFormData((prev) => ({
|
|
157
|
+
email: initialValues.email || prev.email,
|
|
158
|
+
firstName: initialValues.firstName || prev.firstName,
|
|
159
|
+
lastName: initialValues.lastName || prev.lastName,
|
|
160
|
+
line1: initialValues.line1 || prev.line1,
|
|
161
|
+
line2: initialValues.line2 || prev.line2 || '',
|
|
162
|
+
city: initialValues.city || prev.city,
|
|
163
|
+
region: initialValues.region || prev.region || '',
|
|
164
|
+
postalCode: initialValues.postalCode || prev.postalCode,
|
|
165
|
+
country: initialValues.country || prev.country,
|
|
166
|
+
phone: initialValues.phone || prev.phone || '',
|
|
167
|
+
notes: prev.notes || '',
|
|
168
|
+
}));
|
|
169
|
+
}, [initialValues]);
|
|
170
|
+
|
|
171
|
+
const hasCountryOptions = destinations && destinations.countries.length > 0;
|
|
172
|
+
const countryRegions = destinations?.regions[formData.country];
|
|
173
|
+
const hasRegionOptions = countryRegions && countryRegions.length > 0;
|
|
174
|
+
|
|
175
|
+
function validate(): boolean {
|
|
176
|
+
const newErrors: Record<string, string> = {};
|
|
177
|
+
|
|
178
|
+
if (!formData.email.trim()) {
|
|
179
|
+
newErrors.email = t('emailRequired');
|
|
180
|
+
} else if (!isValidEmail(formData.email.trim())) {
|
|
181
|
+
newErrors.email = t('emailInvalid');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (!formData.firstName.trim()) {
|
|
185
|
+
newErrors.firstName = t('firstNameRequired');
|
|
186
|
+
}
|
|
187
|
+
if (!formData.lastName.trim()) {
|
|
188
|
+
newErrors.lastName = t('lastNameRequired');
|
|
189
|
+
}
|
|
190
|
+
if (!emailOnly) {
|
|
191
|
+
if (!formData.line1.trim()) {
|
|
192
|
+
newErrors.line1 = t('addressRequired');
|
|
193
|
+
}
|
|
194
|
+
if (!formData.city.trim()) {
|
|
195
|
+
newErrors.city = t('cityRequired');
|
|
196
|
+
}
|
|
197
|
+
if (!formData.postalCode.trim()) {
|
|
198
|
+
newErrors.postalCode = t('postalCodeRequired');
|
|
199
|
+
}
|
|
200
|
+
if (!formData.country.trim()) {
|
|
201
|
+
newErrors.country = t('countryRequired');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (!privacyAccepted) {
|
|
205
|
+
newErrors.privacy = t('privacyRequired');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
setErrors(newErrors);
|
|
209
|
+
return Object.keys(newErrors).length === 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function handleSubmit(e: React.FormEvent) {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
if (validate()) {
|
|
215
|
+
onSubmit(formData, { acceptsMarketing, saveDetails: showSaveDetails && saveDetails });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function updateField(field: keyof SetShippingAddressDto, value: string) {
|
|
220
|
+
setFormData((prev) => {
|
|
221
|
+
const next = { ...prev, [field]: value };
|
|
222
|
+
// Reset region when country changes
|
|
223
|
+
if (field === 'country' && value !== prev.country) {
|
|
224
|
+
next.region = '';
|
|
225
|
+
}
|
|
226
|
+
return next;
|
|
227
|
+
});
|
|
228
|
+
if (errors[field]) {
|
|
229
|
+
setErrors((prev) => {
|
|
230
|
+
const next = { ...prev };
|
|
231
|
+
delete next[field];
|
|
232
|
+
return next;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const inputClass =
|
|
238
|
+
'bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2';
|
|
239
|
+
const selectClass =
|
|
240
|
+
'bg-background text-foreground focus:ring-primary/20 focus:border-primary h-10 w-full appearance-none rounded border px-3 text-sm focus:outline-none focus:ring-2';
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<form onSubmit={handleSubmit} className={cn('space-y-4', className)}>
|
|
244
|
+
{/* Email */}
|
|
245
|
+
<div>
|
|
246
|
+
<label htmlFor="email" className="text-foreground mb-1 block text-sm font-medium">
|
|
247
|
+
{t('email')} <span className="text-destructive">*</span>
|
|
248
|
+
</label>
|
|
249
|
+
<input
|
|
250
|
+
id="email"
|
|
251
|
+
type="email"
|
|
252
|
+
value={formData.email}
|
|
253
|
+
onChange={(e) => updateField('email', e.target.value)}
|
|
254
|
+
className={cn(inputClass, errors.email ? 'border-destructive' : 'border-border')}
|
|
255
|
+
placeholder="your@email.com"
|
|
256
|
+
/>
|
|
257
|
+
{errors.email && <p className="text-destructive mt-1 text-xs">{errors.email}</p>}
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
{/* Name row */}
|
|
261
|
+
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
262
|
+
<div>
|
|
263
|
+
<label htmlFor="firstName" className="text-foreground mb-1 block text-sm font-medium">
|
|
264
|
+
{t('firstName')} <span className="text-destructive">*</span>
|
|
265
|
+
</label>
|
|
266
|
+
<input
|
|
267
|
+
id="firstName"
|
|
268
|
+
type="text"
|
|
269
|
+
value={formData.firstName}
|
|
270
|
+
onChange={(e) => updateField('firstName', e.target.value)}
|
|
271
|
+
className={cn(inputClass, errors.firstName ? 'border-destructive' : 'border-border')}
|
|
272
|
+
/>
|
|
273
|
+
{errors.firstName && <p className="text-destructive mt-1 text-xs">{errors.firstName}</p>}
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<div>
|
|
277
|
+
<label htmlFor="lastName" className="text-foreground mb-1 block text-sm font-medium">
|
|
278
|
+
{t('lastName')} <span className="text-destructive">*</span>
|
|
279
|
+
</label>
|
|
280
|
+
<input
|
|
281
|
+
id="lastName"
|
|
282
|
+
type="text"
|
|
283
|
+
value={formData.lastName}
|
|
284
|
+
onChange={(e) => updateField('lastName', e.target.value)}
|
|
285
|
+
className={cn(inputClass, errors.lastName ? 'border-destructive' : 'border-border')}
|
|
286
|
+
/>
|
|
287
|
+
{errors.lastName && <p className="text-destructive mt-1 text-xs">{errors.lastName}</p>}
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
{!emailOnly && (
|
|
292
|
+
<>
|
|
293
|
+
{/* Country + Region row */}
|
|
294
|
+
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
295
|
+
<div>
|
|
296
|
+
<label htmlFor="country" className="text-foreground mb-1 block text-sm font-medium">
|
|
297
|
+
{t('country')} <span className="text-destructive">*</span>
|
|
298
|
+
</label>
|
|
299
|
+
{hasCountryOptions ? (
|
|
300
|
+
<select
|
|
301
|
+
id="country"
|
|
302
|
+
value={formData.country}
|
|
303
|
+
onChange={(e) => updateField('country', e.target.value)}
|
|
304
|
+
className={cn(
|
|
305
|
+
selectClass,
|
|
306
|
+
errors.country ? 'border-destructive' : 'border-border'
|
|
307
|
+
)}
|
|
308
|
+
>
|
|
309
|
+
<option value="">{t('selectCountry')}</option>
|
|
310
|
+
{destinations.countries.map((c) => (
|
|
311
|
+
<option key={c.code} value={c.code}>
|
|
312
|
+
{c.name}
|
|
313
|
+
</option>
|
|
314
|
+
))}
|
|
315
|
+
</select>
|
|
316
|
+
) : (
|
|
317
|
+
<input
|
|
318
|
+
id="country"
|
|
319
|
+
type="text"
|
|
320
|
+
value={formData.country}
|
|
321
|
+
onChange={(e) => updateField('country', e.target.value)}
|
|
322
|
+
className={cn(
|
|
323
|
+
inputClass,
|
|
324
|
+
errors.country ? 'border-destructive' : 'border-border'
|
|
325
|
+
)}
|
|
326
|
+
placeholder={t('countryPlaceholder')}
|
|
327
|
+
/>
|
|
328
|
+
)}
|
|
329
|
+
{errors.country && <p className="text-destructive mt-1 text-xs">{errors.country}</p>}
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
<div>
|
|
333
|
+
<label htmlFor="region" className="text-foreground mb-1 block text-sm font-medium">
|
|
334
|
+
{t('stateRegion')}
|
|
335
|
+
</label>
|
|
336
|
+
{hasRegionOptions ? (
|
|
337
|
+
<select
|
|
338
|
+
id="region"
|
|
339
|
+
value={formData.region || ''}
|
|
340
|
+
onChange={(e) => updateField('region', e.target.value)}
|
|
341
|
+
className={cn(selectClass, 'border-border')}
|
|
342
|
+
>
|
|
343
|
+
<option value="">{t('selectRegion')}</option>
|
|
344
|
+
{countryRegions.map((r) => (
|
|
345
|
+
<option key={r.code} value={r.code}>
|
|
346
|
+
{r.name}
|
|
347
|
+
</option>
|
|
348
|
+
))}
|
|
349
|
+
</select>
|
|
350
|
+
) : (
|
|
351
|
+
<input
|
|
352
|
+
id="region"
|
|
353
|
+
type="text"
|
|
354
|
+
value={formData.region || ''}
|
|
355
|
+
onChange={(e) => updateField('region', e.target.value)}
|
|
356
|
+
className={cn(inputClass, 'border-border')}
|
|
357
|
+
/>
|
|
358
|
+
)}
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
{/* Address line 1 — autocomplete typeahead */}
|
|
363
|
+
<div className="relative">
|
|
364
|
+
<label htmlFor="line1" className="text-foreground mb-1 block text-sm font-medium">
|
|
365
|
+
{t('address')} <span className="text-destructive">*</span>
|
|
366
|
+
</label>
|
|
367
|
+
<input
|
|
368
|
+
id="line1"
|
|
369
|
+
type="text"
|
|
370
|
+
autoComplete="off"
|
|
371
|
+
value={formData.line1}
|
|
372
|
+
onChange={(e) => handleLine1Change(e.target.value)}
|
|
373
|
+
onFocus={() => setShowAddressSuggestions(addressSuggestions.length > 0)}
|
|
374
|
+
onBlur={() => setTimeout(() => setShowAddressSuggestions(false), 150)}
|
|
375
|
+
className={cn(inputClass, errors.line1 ? 'border-destructive' : 'border-border')}
|
|
376
|
+
placeholder={t('streetAddress')}
|
|
377
|
+
/>
|
|
378
|
+
{errors.line1 && <p className="text-destructive mt-1 text-xs">{errors.line1}</p>}
|
|
379
|
+
|
|
380
|
+
{showAddressSuggestions && addressSuggestions.length > 0 && (
|
|
381
|
+
<ul className="bg-background border-border absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded border shadow-lg">
|
|
382
|
+
{addressSuggestions.map((suggestion) => (
|
|
383
|
+
<li key={suggestion.placeId}>
|
|
384
|
+
<button
|
|
385
|
+
type="button"
|
|
386
|
+
// onMouseDown fires before the input's onBlur, so the
|
|
387
|
+
// click registers before the dropdown closes.
|
|
388
|
+
onMouseDown={() => handleSelectAddressSuggestion(suggestion)}
|
|
389
|
+
className="hover:bg-muted w-full px-3 py-2 text-start text-sm"
|
|
390
|
+
>
|
|
391
|
+
{suggestion.description}
|
|
392
|
+
</button>
|
|
393
|
+
</li>
|
|
394
|
+
))}
|
|
395
|
+
</ul>
|
|
396
|
+
)}
|
|
397
|
+
{isSearchingAddress && (
|
|
398
|
+
<p className="text-muted-foreground mt-1 text-xs">{t('searchingAddress')}</p>
|
|
399
|
+
)}
|
|
400
|
+
{outsideDeliveryZone && (
|
|
401
|
+
<p className="mt-2 rounded border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-200">
|
|
402
|
+
{t('outsideDeliveryZone')}
|
|
403
|
+
</p>
|
|
404
|
+
)}
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
{/* Address line 2 */}
|
|
408
|
+
<div>
|
|
409
|
+
<label htmlFor="line2" className="text-foreground mb-1 block text-sm font-medium">
|
|
410
|
+
{t('apartmentSuite')}
|
|
411
|
+
</label>
|
|
412
|
+
<input
|
|
413
|
+
id="line2"
|
|
414
|
+
type="text"
|
|
415
|
+
value={formData.line2 || ''}
|
|
416
|
+
onChange={(e) => updateField('line2', e.target.value)}
|
|
417
|
+
className={cn(inputClass, 'border-border')}
|
|
418
|
+
placeholder={t('aptPlaceholder')}
|
|
419
|
+
/>
|
|
420
|
+
</div>
|
|
421
|
+
|
|
422
|
+
{/* City + Postal code row */}
|
|
423
|
+
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
|
424
|
+
<div>
|
|
425
|
+
<label htmlFor="city" className="text-foreground mb-1 block text-sm font-medium">
|
|
426
|
+
{t('city')} <span className="text-destructive">*</span>
|
|
427
|
+
</label>
|
|
428
|
+
<input
|
|
429
|
+
id="city"
|
|
430
|
+
type="text"
|
|
431
|
+
value={formData.city}
|
|
432
|
+
onChange={(e) => updateField('city', e.target.value)}
|
|
433
|
+
className={cn(inputClass, errors.city ? 'border-destructive' : 'border-border')}
|
|
434
|
+
/>
|
|
435
|
+
{errors.city && <p className="text-destructive mt-1 text-xs">{errors.city}</p>}
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
<div>
|
|
439
|
+
<label
|
|
440
|
+
htmlFor="postalCode"
|
|
441
|
+
className="text-foreground mb-1 block text-sm font-medium"
|
|
442
|
+
>
|
|
443
|
+
{t('postalCode')} <span className="text-destructive">*</span>
|
|
444
|
+
</label>
|
|
445
|
+
<input
|
|
446
|
+
id="postalCode"
|
|
447
|
+
type="text"
|
|
448
|
+
value={formData.postalCode}
|
|
449
|
+
onChange={(e) => updateField('postalCode', e.target.value)}
|
|
450
|
+
className={cn(
|
|
451
|
+
inputClass,
|
|
452
|
+
errors.postalCode ? 'border-destructive' : 'border-border'
|
|
453
|
+
)}
|
|
454
|
+
/>
|
|
455
|
+
{errors.postalCode && (
|
|
456
|
+
<p className="text-destructive mt-1 text-xs">{errors.postalCode}</p>
|
|
457
|
+
)}
|
|
458
|
+
</div>
|
|
459
|
+
</div>
|
|
460
|
+
|
|
461
|
+
{/* Phone */}
|
|
462
|
+
<div>
|
|
463
|
+
<label htmlFor="phone" className="text-foreground mb-1 block text-sm font-medium">
|
|
464
|
+
{t('phone')}
|
|
465
|
+
</label>
|
|
466
|
+
<input
|
|
467
|
+
id="phone"
|
|
468
|
+
type="tel"
|
|
469
|
+
value={formData.phone || ''}
|
|
470
|
+
onChange={(e) => updateField('phone', e.target.value)}
|
|
471
|
+
className={cn(inputClass, 'border-border')}
|
|
472
|
+
placeholder={t('phonePlaceholder')}
|
|
473
|
+
/>
|
|
474
|
+
</div>
|
|
475
|
+
</>
|
|
476
|
+
)}
|
|
477
|
+
|
|
478
|
+
{/* Order notes (optional) */}
|
|
479
|
+
<div>
|
|
480
|
+
<label htmlFor="orderNotes" className="text-foreground mb-1 block text-sm font-medium">
|
|
481
|
+
{t('orderNotes')}
|
|
482
|
+
</label>
|
|
483
|
+
<textarea
|
|
484
|
+
id="orderNotes"
|
|
485
|
+
value={formData.notes || ''}
|
|
486
|
+
onChange={(e) => updateField('notes', e.target.value)}
|
|
487
|
+
maxLength={2000}
|
|
488
|
+
rows={3}
|
|
489
|
+
className={cn(
|
|
490
|
+
inputClass,
|
|
491
|
+
'border-border h-auto min-h-[80px] resize-y py-2 leading-relaxed'
|
|
492
|
+
)}
|
|
493
|
+
placeholder={t('orderNotesPlaceholder')}
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
{/* Privacy Policy (required) */}
|
|
498
|
+
<div>
|
|
499
|
+
<label className="flex cursor-pointer items-start gap-2">
|
|
500
|
+
<input
|
|
501
|
+
type="checkbox"
|
|
502
|
+
checked={privacyAccepted}
|
|
503
|
+
onChange={(e) => {
|
|
504
|
+
setPrivacyAccepted(e.target.checked);
|
|
505
|
+
if (e.target.checked && errors.privacy) {
|
|
506
|
+
setErrors((prev) => {
|
|
507
|
+
const next = { ...prev };
|
|
508
|
+
delete next.privacy;
|
|
509
|
+
return next;
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
}}
|
|
513
|
+
className="accent-primary mt-0.5"
|
|
514
|
+
/>
|
|
515
|
+
<span className="text-muted-foreground text-sm">
|
|
516
|
+
{t('privacyAcceptPrefix')}{' '}
|
|
517
|
+
<a
|
|
518
|
+
href="/privacy"
|
|
519
|
+
target="_blank"
|
|
520
|
+
rel="noopener noreferrer"
|
|
521
|
+
className="text-primary underline underline-offset-2"
|
|
522
|
+
>
|
|
523
|
+
{t('privacyPolicyLink')}
|
|
524
|
+
</a>{' '}
|
|
525
|
+
<span className="text-destructive">*</span>
|
|
526
|
+
</span>
|
|
527
|
+
</label>
|
|
528
|
+
{errors.privacy && <p className="text-destructive mt-1 text-xs">{errors.privacy}</p>}
|
|
529
|
+
</div>
|
|
530
|
+
|
|
531
|
+
{/* Marketing consent (optional) */}
|
|
532
|
+
<label className="flex cursor-pointer items-start gap-2">
|
|
533
|
+
<input
|
|
534
|
+
type="checkbox"
|
|
535
|
+
checked={acceptsMarketing}
|
|
536
|
+
onChange={(e) => setAcceptsMarketing(e.target.checked)}
|
|
537
|
+
className="accent-primary mt-0.5"
|
|
538
|
+
/>
|
|
539
|
+
<span className="text-muted-foreground text-sm">{t('acceptsMarketing')}</span>
|
|
540
|
+
</label>
|
|
541
|
+
|
|
542
|
+
{/* Save details for next time (logged-in users only) */}
|
|
543
|
+
{showSaveDetails && (
|
|
544
|
+
<label className="flex cursor-pointer items-start gap-2">
|
|
545
|
+
<input
|
|
546
|
+
type="checkbox"
|
|
547
|
+
checked={saveDetails}
|
|
548
|
+
onChange={(e) => setSaveDetails(e.target.checked)}
|
|
549
|
+
className="accent-primary mt-0.5"
|
|
550
|
+
/>
|
|
551
|
+
<span className="text-muted-foreground text-sm">{t('saveDetailsForNextTime')}</span>
|
|
552
|
+
</label>
|
|
553
|
+
)}
|
|
554
|
+
|
|
555
|
+
<button
|
|
556
|
+
type="submit"
|
|
557
|
+
disabled={loading}
|
|
558
|
+
className="bg-primary text-primary-foreground w-full rounded px-6 py-3 text-sm font-medium transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60"
|
|
559
|
+
>
|
|
560
|
+
{loading ? tc('saving') : emailOnly ? t('continueToPayment') : t('continueToShipping')}
|
|
561
|
+
</button>
|
|
562
|
+
</form>
|
|
563
|
+
);
|
|
564
|
+
}
|