@code-collective/booking-widget 1.0.3 → 1.0.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/README.md +318 -282
- package/dist/booking-widget.css +1 -1
- package/dist/booking-widget.js +1060 -830
- package/dist/booking-widget.min.js +6 -7
- package/dist/booking-widget.umd.cjs +2 -2
- package/package.json +1 -1
- package/src/lib/Checkout.svelte +6 -1
- package/src/lib/CheckoutModal.svelte +16 -43
- package/src/lib/EditBookingView.svelte +5 -1
- package/src/lib/WizardPage.svelte +371 -96
- package/src/lib/config.ts +72 -14
- package/src/lib/elements/bw-checkout.svelte +9 -4
- package/src/lib/elements/bw-configurator.svelte +2 -2
- package/src/lib/elements/register.ts +12 -1
- package/src/lib/index.ts +4 -0
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
cart: CheckoutCartDetailDto;
|
|
17
17
|
api: BookingApi;
|
|
18
18
|
wizardPages?: WizardPages;
|
|
19
|
+
editPages?: WizardPages;
|
|
20
|
+
autoSelectSingleTimeSlot?: boolean;
|
|
19
21
|
onClose: () => void;
|
|
20
22
|
onOrderConfirmed: () => void;
|
|
21
23
|
}
|
|
22
|
-
let { cart, api, wizardPages, onClose, onOrderConfirmed }: Props = $props();
|
|
24
|
+
let { cart, api, wizardPages, editPages, autoSelectSingleTimeSlot = false, onClose, onOrderConfirmed }: Props = $props();
|
|
23
25
|
|
|
24
26
|
type View = 'cart' | 'contact' | 'edit' | 'payment' | 'result';
|
|
25
27
|
let currentView = $state<View>('cart');
|
|
@@ -210,6 +212,8 @@
|
|
|
210
212
|
product={productsById.get(editingItem.productId)!}
|
|
211
213
|
{api}
|
|
212
214
|
{wizardPages}
|
|
215
|
+
{editPages}
|
|
216
|
+
{autoSelectSingleTimeSlot}
|
|
213
217
|
onBack={() => { currentView = 'cart'; }}
|
|
214
218
|
onClose={close}
|
|
215
219
|
onUpdated={onItemUpdated}
|
|
@@ -250,15 +254,14 @@
|
|
|
250
254
|
|
|
251
255
|
{:else}
|
|
252
256
|
<!-- Cart view -->
|
|
253
|
-
<div class="
|
|
254
|
-
<
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
</div>
|
|
260
|
-
</div>
|
|
257
|
+
<div class="page-header">
|
|
258
|
+
<h2>Your cart</h2>
|
|
259
|
+
<span class="spacer"></span>
|
|
260
|
+
<CountdownTimer expiresAt={expiresAt()} />
|
|
261
|
+
<button class="keep-shopping-btn" onclick={continueShopping}>+ Keep shopping</button>
|
|
262
|
+
</div>
|
|
261
263
|
|
|
264
|
+
<div class="body">
|
|
262
265
|
{#each cart.items as item}
|
|
263
266
|
<div class="cart-card">
|
|
264
267
|
<div class="cart-card-top">
|
|
@@ -296,9 +299,11 @@
|
|
|
296
299
|
<span>Total payable today</span>
|
|
297
300
|
<span class="cart-total-amount">{formattedTotal()}</span>
|
|
298
301
|
</div>
|
|
302
|
+
</div>
|
|
299
303
|
|
|
300
|
-
|
|
301
|
-
|
|
304
|
+
<div class="action-bar">
|
|
305
|
+
<button class="btn btn-primary" onclick={() => { currentView = 'contact'; }}>
|
|
306
|
+
Checkout <span class="arrow">→</span>
|
|
302
307
|
</button>
|
|
303
308
|
</div>
|
|
304
309
|
{/if}
|
|
@@ -320,21 +325,6 @@
|
|
|
320
325
|
}
|
|
321
326
|
|
|
322
327
|
/* -- Cart view -- */
|
|
323
|
-
.cart-header {
|
|
324
|
-
display: flex;
|
|
325
|
-
justify-content: space-between;
|
|
326
|
-
align-items: center;
|
|
327
|
-
margin-bottom: 20px;
|
|
328
|
-
}
|
|
329
|
-
.cart-title {
|
|
330
|
-
font-size: 22px;
|
|
331
|
-
font-weight: 800;
|
|
332
|
-
}
|
|
333
|
-
.cart-header-right {
|
|
334
|
-
display: flex;
|
|
335
|
-
align-items: center;
|
|
336
|
-
gap: 12px;
|
|
337
|
-
}
|
|
338
328
|
.keep-shopping-btn {
|
|
339
329
|
padding: 8px 16px;
|
|
340
330
|
background: none;
|
|
@@ -443,23 +433,6 @@
|
|
|
443
433
|
font-size: 20px;
|
|
444
434
|
font-weight: 800;
|
|
445
435
|
}
|
|
446
|
-
.checkout-btn {
|
|
447
|
-
display: block;
|
|
448
|
-
width: 100%;
|
|
449
|
-
padding: 16px;
|
|
450
|
-
background: var(--bw-color-primary);
|
|
451
|
-
color: white;
|
|
452
|
-
border: none;
|
|
453
|
-
border-radius: var(--bw-radius-md);
|
|
454
|
-
font-size: 16px;
|
|
455
|
-
font-weight: 700;
|
|
456
|
-
cursor: pointer;
|
|
457
|
-
text-align: center;
|
|
458
|
-
}
|
|
459
|
-
.checkout-btn:hover {
|
|
460
|
-
background: var(--bw-color-primary-dark);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
436
|
/* -- Contact view -- */
|
|
464
437
|
.contact-header {
|
|
465
438
|
display: flex;
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
product: CheckoutProductDto;
|
|
12
12
|
api: BookingApi;
|
|
13
13
|
wizardPages?: WizardPages;
|
|
14
|
+
editPages?: WizardPages;
|
|
15
|
+
autoSelectSingleTimeSlot?: boolean;
|
|
14
16
|
onBack: () => void;
|
|
15
17
|
onClose: () => void;
|
|
16
18
|
onUpdated: () => void;
|
|
17
19
|
}
|
|
18
|
-
let { cartItem, product, api, wizardPages, onBack, onClose, onUpdated }: Props = $props();
|
|
20
|
+
let { cartItem, product, api, wizardPages, editPages, autoSelectSingleTimeSlot = false, onBack, onClose, onUpdated }: Props = $props();
|
|
19
21
|
|
|
20
22
|
let isSaving = $state(false);
|
|
21
23
|
|
|
@@ -55,7 +57,9 @@
|
|
|
55
57
|
{product}
|
|
56
58
|
{api}
|
|
57
59
|
wizardPages={wizardPages ?? DEFAULT_WIZARD_PAGES}
|
|
60
|
+
editPages={editPages ?? wizardPages ?? DEFAULT_WIZARD_PAGES}
|
|
58
61
|
editItem={cartItem}
|
|
62
|
+
{autoSelectSingleTimeSlot}
|
|
59
63
|
{onComplete}
|
|
60
64
|
onCancel={onBack}
|
|
61
65
|
/>
|