@eventlook/sdk 1.5.0-beta.6 → 1.5.0-beta.7
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/.claude/settings.local.json +2 -1
- package/.env.example +1 -0
- package/README.md +18 -16
- package/dist/cjs/{index-DvUR1fp8.js → index-BAfaeq84.js} +3230 -554
- package/dist/cjs/index-BAfaeq84.js.map +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{index.umd-6SU6nkkJ.js → index.umd-Bpwd9vUs.js} +9 -19
- package/dist/cjs/index.umd-Bpwd9vUs.js.map +1 -0
- package/dist/esm/{index-BlTqx0jm.js → index-CJ_gPli9.js} +3217 -540
- package/dist/esm/index-CJ_gPli9.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/{index.umd-Dn0hjh7E.js → index.umd-ewNTELOK.js} +9 -19
- package/dist/esm/index.umd-ewNTELOK.js.map +1 -0
- package/dist/types/components/hook-form/FormProvider.d.ts +2 -1
- package/dist/types/form/PaymentOverviewBox.d.ts +2 -0
- package/dist/types/form/PaymentOverviewDrawer.d.ts +10 -0
- package/dist/types/form/TicketForm.d.ts +1 -0
- package/dist/types/form/index.d.ts +2 -1
- package/dist/types/form/merchandise/MerchandiseSelection.d.ts +9 -0
- package/dist/types/form/merchandise/MerchandiseSlider.d.ts +10 -0
- package/dist/types/form/payment/PaymentOverviewCheckbox.d.ts +0 -4
- package/dist/types/form/product/ProductVariantsDialog.d.ts +2 -1
- package/dist/types/form/services/index.d.ts +7 -0
- package/dist/types/form/style.d.ts +1 -0
- package/dist/types/form/tickets/ReleaseDescription.d.ts +10 -0
- package/dist/types/form/tickets/ReleaseWithMerchandise.d.ts +12 -0
- package/dist/types/form/tickets/TicketQuantityControl.d.ts +13 -0
- package/dist/types/form/tickets/TicketSelectionMobile.d.ts +17 -0
- package/dist/types/hooks/useScrollToFirstError.d.ts +4 -0
- package/dist/types/locales/cs.d.ts +22 -0
- package/dist/types/locales/en.d.ts +22 -0
- package/dist/types/locales/es.d.ts +22 -0
- package/dist/types/locales/pl.d.ts +22 -0
- package/dist/types/locales/sk.d.ts +22 -0
- package/dist/types/locales/uk.d.ts +22 -0
- package/dist/types/utils/data/global.d.ts +1 -0
- package/package.json +10 -4
- package/rollup.config.mjs +7 -12
- package/src/components/hook-form/FormProvider.tsx +5 -2
- package/src/form/ChildEventDialog.tsx +3 -3
- package/src/form/ContactPerson.tsx +1 -1
- package/src/form/PaymentOverviewBox.tsx +96 -123
- package/src/form/PaymentOverviewDrawer.tsx +446 -0
- package/src/form/PaymentPending.tsx +19 -4
- package/src/form/ReleaseWithMerchandise.tsx +4 -4
- package/src/form/Shipping.tsx +91 -74
- package/src/form/TicketForm.tsx +144 -41
- package/src/form/index.tsx +3 -1
- package/src/form/merchandise/MerchandiseSelection.tsx +24 -0
- package/src/form/merchandise/MerchandiseSlider.tsx +62 -0
- package/src/form/payment/FeeBox.tsx +4 -31
- package/src/form/payment/PaymentOverviewCheckbox.tsx +57 -56
- package/src/form/product/ProductCard.tsx +255 -59
- package/src/form/product/ProductVariantsDialog.tsx +271 -141
- package/src/form/services/index.tsx +263 -0
- package/src/form/style.ts +16 -4
- package/src/form/tickets/ReleaseDescription.tsx +46 -0
- package/src/form/tickets/ReleaseWithMerchandise.tsx +231 -0
- package/src/form/tickets/TicketQuantityControl.tsx +100 -0
- package/src/form/{TicketSelection.tsx → tickets/TicketSelection.tsx} +24 -128
- package/src/form/{TicketSelectionMap.tsx → tickets/TicketSelectionMap.tsx} +9 -1
- package/src/form/tickets/TicketSelectionMobile.tsx +177 -0
- package/src/form/{TicketWithMerchandiseSelection.tsx → tickets/TicketWithMerchandiseSelection.tsx} +3 -7
- package/src/hooks/useScrollToFirstError.ts +99 -0
- package/src/locales/cs.tsx +25 -3
- package/src/locales/en.tsx +23 -1
- package/src/locales/es.tsx +23 -1
- package/src/locales/pl.tsx +23 -1
- package/src/locales/sk.tsx +24 -2
- package/src/locales/uk.tsx +23 -1
- package/src/utils/data/global.ts +1 -0
- package/tsconfig.json +1 -1
- package/README +0 -1
- package/dist/cjs/index-DvUR1fp8.js.map +0 -1
- package/dist/cjs/index.umd-6SU6nkkJ.js.map +0 -1
- package/dist/esm/index-BlTqx0jm.js.map +0 -1
- package/dist/esm/index.umd-Dn0hjh7E.js.map +0 -1
- /package/dist/types/form/{TicketSelection.d.ts → tickets/TicketSelection.d.ts} +0 -0
- /package/dist/types/form/{TicketSelectionMap.d.ts → tickets/TicketSelectionMap.d.ts} +0 -0
- /package/dist/types/form/{TicketWithMerchandiseSelection.d.ts → tickets/TicketWithMerchandiseSelection.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { Iconify, Image, TextIconLabel } from '@components';
|
|
3
|
-
import { Box, Button, Divider, Grid,
|
|
3
|
+
import { Box, Button, Divider, Grid, Stack, Typography } from '@mui/material';
|
|
4
4
|
import PaymentOverviewCheckbox from '@form/payment/PaymentOverviewCheckbox';
|
|
5
5
|
import locationIcon from '@iconify/icons-carbon/location';
|
|
6
6
|
import { getPlaceAsString } from '@utils/place';
|
|
@@ -25,12 +25,15 @@ import { ICalculateShoppingCartDto, IShoppingCartDto } from '@utils/types/shoppi
|
|
|
25
25
|
import { PromoCodeTypes } from '@utils/data/promo-code';
|
|
26
26
|
import useActiveEventProducts from '@hooks/data/useActiveEventProducts';
|
|
27
27
|
import useDebounce from '@hooks/useDebounce';
|
|
28
|
+
import { EVENTLOOK_ORDER_FORM_ID } from '@utils/data/global';
|
|
28
29
|
|
|
29
30
|
interface Props {
|
|
30
31
|
event: IEvent;
|
|
32
|
+
withoutPadding?: boolean;
|
|
33
|
+
hideBuyButton?: boolean;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
const PaymentOverviewBox: React.FC<Props> = ({ event }) => {
|
|
36
|
+
const PaymentOverviewBox: React.FC<Props> = ({ event, withoutPadding, hideBuyButton }) => {
|
|
34
37
|
const { t, lang, options } = useGlobal();
|
|
35
38
|
const xs = useResponsive('only', 'xs');
|
|
36
39
|
const md = useResponsive('only', 'md');
|
|
@@ -53,9 +56,9 @@ const PaymentOverviewBox: React.FC<Props> = ({ event }) => {
|
|
|
53
56
|
totalFee,
|
|
54
57
|
isPaymentVerify,
|
|
55
58
|
ticketInsurance,
|
|
56
|
-
ticketInsurancePricePerUnit,
|
|
57
59
|
smsNotification,
|
|
58
60
|
smsNotificationPrice,
|
|
61
|
+
ticketInsurancePricePerUnit,
|
|
59
62
|
} = values;
|
|
60
63
|
const tickets: Record<string, ITicketFormTicket[]> = useWatch({
|
|
61
64
|
name: 'tickets',
|
|
@@ -384,29 +387,29 @@ const PaymentOverviewBox: React.FC<Props> = ({ event }) => {
|
|
|
384
387
|
}
|
|
385
388
|
}, []);
|
|
386
389
|
|
|
387
|
-
const removeProduct = (variant: ISelectedProductVariant) => {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
+
// const removeProduct = (variant: ISelectedProductVariant) => {
|
|
391
|
+
// const { eventId, variantId } = variant;
|
|
392
|
+
// const list = Array.isArray(products[eventId]) ? [...products[eventId]] : [];
|
|
390
393
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
+
// const idx = list.findIndex((p) => Number(p.eventProductVariantId) === Number(variantId));
|
|
395
|
+
// if (idx === -1) return;
|
|
396
|
+
// const item = list[idx];
|
|
394
397
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
// if ((item.quantity ?? 0) <= 1) {
|
|
399
|
+
// list.splice(idx, 1);
|
|
400
|
+
// } else {
|
|
401
|
+
// list[idx] = { ...item, quantity: (item.quantity ?? 1) - 1 };
|
|
402
|
+
// }
|
|
400
403
|
|
|
401
|
-
|
|
404
|
+
// const next = { ...products, [eventId]: list };
|
|
402
405
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
};
|
|
406
|
+
// if (list.length === 0) {
|
|
407
|
+
// const { [eventId]: _removed, ...rest } = next;
|
|
408
|
+
// setValue('products', rest);
|
|
409
|
+
// } else {
|
|
410
|
+
// setValue('products', next);
|
|
411
|
+
// }
|
|
412
|
+
// };
|
|
410
413
|
|
|
411
414
|
return (
|
|
412
415
|
<OverviewCard id="overview-card" stickyHeaderTop={options?.stickyHeaderTop || 0}>
|
|
@@ -445,7 +448,8 @@ const PaymentOverviewBox: React.FC<Props> = ({ event }) => {
|
|
|
445
448
|
/>
|
|
446
449
|
}
|
|
447
450
|
sx={{
|
|
448
|
-
backgroundColor: (theme) =>
|
|
451
|
+
backgroundColor: (theme) =>
|
|
452
|
+
theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[900],
|
|
449
453
|
borderRadius: 1,
|
|
450
454
|
}}
|
|
451
455
|
>
|
|
@@ -472,15 +476,49 @@ const PaymentOverviewBox: React.FC<Props> = ({ event }) => {
|
|
|
472
476
|
</Stack>
|
|
473
477
|
</Stack>
|
|
474
478
|
)}
|
|
475
|
-
<Stack
|
|
479
|
+
<Stack
|
|
480
|
+
className="overview-card__order-info"
|
|
481
|
+
sx={{ p: { xs: withoutPadding ? 0 : 2, md: 2 } }}
|
|
482
|
+
pt={{ xs: 0, sm: 2 }}
|
|
483
|
+
spacing={0.75}
|
|
484
|
+
useFlexGap
|
|
485
|
+
>
|
|
476
486
|
{!!selectedTickets.length && !isMobile && <Divider sx={{ borderStyle: 'dashed' }} />}
|
|
487
|
+
|
|
488
|
+
{!!selectedTickets.length && (
|
|
489
|
+
<Stack spacing={0.5}>
|
|
490
|
+
{/* TODO: Uncomment this when Colonnade response - must update terms and conditions and email info */}
|
|
491
|
+
{/*<PaymentOverviewCheckbox*/}
|
|
492
|
+
{/* checkboxName="ticketInsurance"*/}
|
|
493
|
+
{/* label={t('event.tickets.insurance.label')}*/}
|
|
494
|
+
{/* value={*/}
|
|
495
|
+
{/* <>*/}
|
|
496
|
+
{/* {ticketInsurance && totalItemCount.totalTickets > 0 ? '' : '+ '}*/}
|
|
497
|
+
{/* {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}
|
|
498
|
+
{/* {t('event.tickets.insurance.per_ticket')}*/}
|
|
499
|
+
{/* </>*/}
|
|
500
|
+
{/* }*/}
|
|
501
|
+
{/*/>*/}
|
|
502
|
+
<PaymentOverviewCheckbox
|
|
503
|
+
checkboxName="smsNotification"
|
|
504
|
+
label={t('event.tickets.sms_notification.label')}
|
|
505
|
+
value={
|
|
506
|
+
<>
|
|
507
|
+
{smsNotification && totalItemCount.totalTickets > 0 ? '' : '+ '}
|
|
508
|
+
{fCurrency(smsNotificationPrice, lang, event.currency)}
|
|
509
|
+
</>
|
|
510
|
+
}
|
|
511
|
+
/>
|
|
512
|
+
<Divider sx={{ borderStyle: 'dashed' }} />
|
|
513
|
+
</Stack>
|
|
514
|
+
)}
|
|
477
515
|
{selectedTickets.map((ticket, index) => (
|
|
478
516
|
<Box key={index}>
|
|
479
517
|
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
|
480
|
-
<Typography variant="
|
|
518
|
+
<Typography variant="body2">
|
|
481
519
|
{ticket.quantity}x {ticket.itemName}
|
|
482
520
|
</Typography>
|
|
483
|
-
<Typography variant="
|
|
521
|
+
<Typography variant="body2">
|
|
484
522
|
{fCurrency(
|
|
485
523
|
calculatePriceWithDiscount(
|
|
486
524
|
ticket.price,
|
|
@@ -500,10 +538,10 @@ const PaymentOverviewBox: React.FC<Props> = ({ event }) => {
|
|
|
500
538
|
alignItems="center"
|
|
501
539
|
spacing={2}
|
|
502
540
|
>
|
|
503
|
-
<Typography variant="
|
|
541
|
+
<Typography variant="body2">
|
|
504
542
|
- {product.quantity}x {product.name}
|
|
505
543
|
</Typography>
|
|
506
|
-
<Typography variant="
|
|
544
|
+
<Typography variant="body2">
|
|
507
545
|
{product.price > 0
|
|
508
546
|
? fCurrency(
|
|
509
547
|
calculatePriceWithDiscount(
|
|
@@ -525,120 +563,55 @@ const PaymentOverviewBox: React.FC<Props> = ({ event }) => {
|
|
|
525
563
|
{selectedVariants.map((variant, index) => (
|
|
526
564
|
<Box key={index}>
|
|
527
565
|
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
|
528
|
-
<Typography variant="
|
|
566
|
+
<Typography variant="body2">
|
|
529
567
|
{variant.quantity}x {variant.name}
|
|
530
568
|
</Typography>
|
|
531
|
-
<
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
promoCodesValues.fixedDevidedProducts
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
</Typography>
|
|
545
|
-
<IconButton onClick={() => removeProduct(variant)} color="primary" size="small">
|
|
546
|
-
<Iconify icon="carbon:trash-can" />
|
|
547
|
-
</IconButton>
|
|
548
|
-
</Stack>
|
|
569
|
+
<Typography variant="body2">
|
|
570
|
+
{fCurrency(
|
|
571
|
+
calculatePriceWithDiscount(
|
|
572
|
+
variant.price,
|
|
573
|
+
promoCodesValues.productDiscountPercent,
|
|
574
|
+
promoCodesValues.fixedDevidedProducts
|
|
575
|
+
? promoCodesValues.fixedDevidedProducts * variant.quantity
|
|
576
|
+
: 0
|
|
577
|
+
),
|
|
578
|
+
lang,
|
|
579
|
+
event.currency
|
|
580
|
+
)}
|
|
581
|
+
</Typography>
|
|
549
582
|
</Stack>
|
|
550
583
|
</Box>
|
|
551
584
|
))}
|
|
552
585
|
{!!shippingFee && (
|
|
553
586
|
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
|
554
|
-
<Typography variant="
|
|
555
|
-
<Typography variant="
|
|
556
|
-
{fCurrency(shippingFee, lang, event.currency)}
|
|
557
|
-
</Typography>
|
|
558
|
-
</Stack>
|
|
559
|
-
)}
|
|
560
|
-
{ticketInsurance && totalItemCount.totalTickets > 0 && (
|
|
561
|
-
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
|
562
|
-
<Typography variant="caption">{t('form.labels.ticket_insurance')}</Typography>
|
|
563
|
-
<Typography variant="caption">
|
|
564
|
-
{fCurrency(values.ticketInsurancePrice, lang, event.currency)}
|
|
565
|
-
</Typography>
|
|
566
|
-
</Stack>
|
|
567
|
-
)}
|
|
568
|
-
{smsNotification && totalItemCount.totalTickets > 0 && (
|
|
569
|
-
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
|
570
|
-
<Typography variant="caption">{t('form.labels.sms_notification')}</Typography>
|
|
571
|
-
<Typography variant="caption">
|
|
572
|
-
{fCurrency(values.smsNotificationPrice, lang, event.currency)}
|
|
573
|
-
</Typography>
|
|
587
|
+
<Typography variant="body2">{t('form.labels.shipping_fee')}</Typography>
|
|
588
|
+
<Typography variant="body2">{fCurrency(shippingFee, lang, event.currency)}</Typography>
|
|
574
589
|
</Stack>
|
|
575
590
|
)}
|
|
576
591
|
{!!total && !!totalFee && (
|
|
577
592
|
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
|
578
|
-
<Typography variant="
|
|
579
|
-
<Typography variant="
|
|
593
|
+
<Typography variant="body2">{t('form.labels.service_fee')}</Typography>
|
|
594
|
+
<Typography variant="body2">{getFee}</Typography>
|
|
580
595
|
</Stack>
|
|
581
596
|
)}
|
|
582
597
|
{((!!selectedTickets.length && isMobile) || !isMobile) && (
|
|
583
598
|
<Divider sx={{ borderStyle: 'dashed' }} />
|
|
584
599
|
)}
|
|
585
|
-
{
|
|
600
|
+
{!hideBuyButton && (
|
|
586
601
|
<>
|
|
587
|
-
{
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
{/* title: t('event.tickets.insurance.label'),*/}
|
|
599
|
-
{/* description: (*/}
|
|
600
|
-
{/* <>*/}
|
|
601
|
-
{/* <Typography variant="body2" paragraph>*/}
|
|
602
|
-
{/* {t('event.tickets.insurance.modal.description')}*/}
|
|
603
|
-
{/* </Typography>*/}
|
|
604
|
-
{/* <Typography variant="body2" paragraph>*/}
|
|
605
|
-
{/* {t('event.tickets.insurance.modal.coverage')}*/}
|
|
606
|
-
{/* </Typography>*/}
|
|
607
|
-
{/* <Typography variant="body2" sx={{ fontWeight: 600 }}>*/}
|
|
608
|
-
{/* {t('event.tickets.insurance.modal.price')}:{' '}*/}
|
|
609
|
-
{/* {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}
|
|
610
|
-
{/* {t('event.tickets.insurance.per_ticket')}*/}
|
|
611
|
-
{/* </Typography>*/}
|
|
612
|
-
{/* </>*/}
|
|
613
|
-
{/* ),*/}
|
|
614
|
-
{/* }}*/}
|
|
615
|
-
{/*/>*/}
|
|
616
|
-
<PaymentOverviewCheckbox
|
|
617
|
-
checkboxName="smsNotification"
|
|
618
|
-
label={t('event.tickets.sms_notification.label')}
|
|
619
|
-
value={<>+ {fCurrency(smsNotificationPrice, lang, event.currency)}</>}
|
|
620
|
-
modal={{
|
|
621
|
-
title: t('event.tickets.sms_notification.label'),
|
|
622
|
-
description: (
|
|
623
|
-
<>
|
|
624
|
-
<Typography variant="body2" paragraph>
|
|
625
|
-
{t('event.tickets.sms_notification.modal.description')}
|
|
626
|
-
</Typography>
|
|
627
|
-
<Typography variant="body2" sx={{ fontWeight: 600 }}>
|
|
628
|
-
{t('event.tickets.sms_notification.modal.price')}:{' '}
|
|
629
|
-
{fCurrency(smsNotificationPrice, lang, event.currency)}
|
|
630
|
-
</Typography>
|
|
631
|
-
</>
|
|
632
|
-
),
|
|
633
|
-
}}
|
|
634
|
-
/>
|
|
635
|
-
<Divider sx={{ borderStyle: 'dashed' }} />
|
|
602
|
+
<FeeBox event={event} />
|
|
603
|
+
<Button
|
|
604
|
+
type="submit"
|
|
605
|
+
form={EVENTLOOK_ORDER_FORM_ID}
|
|
606
|
+
variant="contained"
|
|
607
|
+
size="large"
|
|
608
|
+
fullWidth
|
|
609
|
+
sx={{ height: { xs: 36, md: 40 } }}
|
|
610
|
+
>
|
|
611
|
+
{t(isPaymentVerify ? 'verify' : 'buy')}
|
|
612
|
+
</Button>
|
|
636
613
|
</>
|
|
637
614
|
)}
|
|
638
|
-
<FeeBox event={event} />
|
|
639
|
-
<Button type="submit" variant="contained" size="large" fullWidth>
|
|
640
|
-
{t(isPaymentVerify ? 'verify' : 'buy')}
|
|
641
|
-
</Button>
|
|
642
615
|
</Stack>
|
|
643
616
|
</OverviewCard>
|
|
644
617
|
);
|