@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.
Files changed (80) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/.env.example +1 -0
  3. package/README.md +18 -16
  4. package/dist/cjs/{index-DvUR1fp8.js → index-BAfaeq84.js} +3230 -554
  5. package/dist/cjs/index-BAfaeq84.js.map +1 -0
  6. package/dist/cjs/index.js +2 -2
  7. package/dist/cjs/{index.umd-6SU6nkkJ.js → index.umd-Bpwd9vUs.js} +9 -19
  8. package/dist/cjs/index.umd-Bpwd9vUs.js.map +1 -0
  9. package/dist/esm/{index-BlTqx0jm.js → index-CJ_gPli9.js} +3217 -540
  10. package/dist/esm/index-CJ_gPli9.js.map +1 -0
  11. package/dist/esm/index.js +2 -2
  12. package/dist/esm/{index.umd-Dn0hjh7E.js → index.umd-ewNTELOK.js} +9 -19
  13. package/dist/esm/index.umd-ewNTELOK.js.map +1 -0
  14. package/dist/types/components/hook-form/FormProvider.d.ts +2 -1
  15. package/dist/types/form/PaymentOverviewBox.d.ts +2 -0
  16. package/dist/types/form/PaymentOverviewDrawer.d.ts +10 -0
  17. package/dist/types/form/TicketForm.d.ts +1 -0
  18. package/dist/types/form/index.d.ts +2 -1
  19. package/dist/types/form/merchandise/MerchandiseSelection.d.ts +9 -0
  20. package/dist/types/form/merchandise/MerchandiseSlider.d.ts +10 -0
  21. package/dist/types/form/payment/PaymentOverviewCheckbox.d.ts +0 -4
  22. package/dist/types/form/product/ProductVariantsDialog.d.ts +2 -1
  23. package/dist/types/form/services/index.d.ts +7 -0
  24. package/dist/types/form/style.d.ts +1 -0
  25. package/dist/types/form/tickets/ReleaseDescription.d.ts +10 -0
  26. package/dist/types/form/tickets/ReleaseWithMerchandise.d.ts +12 -0
  27. package/dist/types/form/tickets/TicketQuantityControl.d.ts +13 -0
  28. package/dist/types/form/tickets/TicketSelectionMobile.d.ts +17 -0
  29. package/dist/types/hooks/useScrollToFirstError.d.ts +4 -0
  30. package/dist/types/locales/cs.d.ts +22 -0
  31. package/dist/types/locales/en.d.ts +22 -0
  32. package/dist/types/locales/es.d.ts +22 -0
  33. package/dist/types/locales/pl.d.ts +22 -0
  34. package/dist/types/locales/sk.d.ts +22 -0
  35. package/dist/types/locales/uk.d.ts +22 -0
  36. package/dist/types/utils/data/global.d.ts +1 -0
  37. package/package.json +10 -4
  38. package/rollup.config.mjs +7 -12
  39. package/src/components/hook-form/FormProvider.tsx +5 -2
  40. package/src/form/ChildEventDialog.tsx +3 -3
  41. package/src/form/ContactPerson.tsx +1 -1
  42. package/src/form/PaymentOverviewBox.tsx +96 -123
  43. package/src/form/PaymentOverviewDrawer.tsx +446 -0
  44. package/src/form/PaymentPending.tsx +19 -4
  45. package/src/form/ReleaseWithMerchandise.tsx +4 -4
  46. package/src/form/Shipping.tsx +91 -74
  47. package/src/form/TicketForm.tsx +144 -41
  48. package/src/form/index.tsx +3 -1
  49. package/src/form/merchandise/MerchandiseSelection.tsx +24 -0
  50. package/src/form/merchandise/MerchandiseSlider.tsx +62 -0
  51. package/src/form/payment/FeeBox.tsx +4 -31
  52. package/src/form/payment/PaymentOverviewCheckbox.tsx +57 -56
  53. package/src/form/product/ProductCard.tsx +255 -59
  54. package/src/form/product/ProductVariantsDialog.tsx +271 -141
  55. package/src/form/services/index.tsx +263 -0
  56. package/src/form/style.ts +16 -4
  57. package/src/form/tickets/ReleaseDescription.tsx +46 -0
  58. package/src/form/tickets/ReleaseWithMerchandise.tsx +231 -0
  59. package/src/form/tickets/TicketQuantityControl.tsx +100 -0
  60. package/src/form/{TicketSelection.tsx → tickets/TicketSelection.tsx} +24 -128
  61. package/src/form/{TicketSelectionMap.tsx → tickets/TicketSelectionMap.tsx} +9 -1
  62. package/src/form/tickets/TicketSelectionMobile.tsx +177 -0
  63. package/src/form/{TicketWithMerchandiseSelection.tsx → tickets/TicketWithMerchandiseSelection.tsx} +3 -7
  64. package/src/hooks/useScrollToFirstError.ts +99 -0
  65. package/src/locales/cs.tsx +25 -3
  66. package/src/locales/en.tsx +23 -1
  67. package/src/locales/es.tsx +23 -1
  68. package/src/locales/pl.tsx +23 -1
  69. package/src/locales/sk.tsx +24 -2
  70. package/src/locales/uk.tsx +23 -1
  71. package/src/utils/data/global.ts +1 -0
  72. package/tsconfig.json +1 -1
  73. package/README +0 -1
  74. package/dist/cjs/index-DvUR1fp8.js.map +0 -1
  75. package/dist/cjs/index.umd-6SU6nkkJ.js.map +0 -1
  76. package/dist/esm/index-BlTqx0jm.js.map +0 -1
  77. package/dist/esm/index.umd-Dn0hjh7E.js.map +0 -1
  78. /package/dist/types/form/{TicketSelection.d.ts → tickets/TicketSelection.d.ts} +0 -0
  79. /package/dist/types/form/{TicketSelectionMap.d.ts → tickets/TicketSelectionMap.d.ts} +0 -0
  80. /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, IconButton, Stack, Typography } from '@mui/material';
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
- const { eventId, variantId } = variant;
389
- const list = Array.isArray(products[eventId]) ? [...products[eventId]] : [];
390
+ // const removeProduct = (variant: ISelectedProductVariant) => {
391
+ // const { eventId, variantId } = variant;
392
+ // const list = Array.isArray(products[eventId]) ? [...products[eventId]] : [];
390
393
 
391
- const idx = list.findIndex((p) => Number(p.eventProductVariantId) === Number(variantId));
392
- if (idx === -1) return;
393
- const item = list[idx];
394
+ // const idx = list.findIndex((p) => Number(p.eventProductVariantId) === Number(variantId));
395
+ // if (idx === -1) return;
396
+ // const item = list[idx];
394
397
 
395
- if ((item.quantity ?? 0) <= 1) {
396
- list.splice(idx, 1);
397
- } else {
398
- list[idx] = { ...item, quantity: (item.quantity ?? 1) - 1 };
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
- const next = { ...products, [eventId]: list };
404
+ // const next = { ...products, [eventId]: list };
402
405
 
403
- if (list.length === 0) {
404
- const { [eventId]: _removed, ...rest } = next;
405
- setValue('products', rest);
406
- } else {
407
- setValue('products', next);
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) => theme.palette.grey.A100,
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 className="overview-card__order-info" p={2} spacing={1}>
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="caption">
518
+ <Typography variant="body2">
481
519
  {ticket.quantity}x {ticket.itemName}
482
520
  </Typography>
483
- <Typography variant="caption">
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="caption">
541
+ <Typography variant="body2">
504
542
  - {product.quantity}x {product.name}
505
543
  </Typography>
506
- <Typography variant="caption">
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="caption">
566
+ <Typography variant="body2">
529
567
  {variant.quantity}x {variant.name}
530
568
  </Typography>
531
- <Stack direction="row" spacing={1} alignItems="center">
532
- <Typography variant="caption">
533
- {fCurrency(
534
- calculatePriceWithDiscount(
535
- variant.price,
536
- promoCodesValues.productDiscountPercent,
537
- promoCodesValues.fixedDevidedProducts
538
- ? promoCodesValues.fixedDevidedProducts * variant.quantity
539
- : 0
540
- ),
541
- lang,
542
- event.currency
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="caption">{t('form.labels.shipping_fee')}</Typography>
555
- <Typography variant="caption">
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="caption">{t('form.labels.service_fee')}</Typography>
579
- <Typography variant="caption">{getFee}</Typography>
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
- {!!selectedTickets.length && (
600
+ {!hideBuyButton && (
586
601
  <>
587
- {/* TODO: Uncomment this when Colonnade response - must update terms and conditions and email info */}
588
- {/*<PaymentOverviewCheckbox*/}
589
- {/* checkboxName="ticketInsurance"*/}
590
- {/* label={t('event.tickets.insurance.label')}*/}
591
- {/* value={*/}
592
- {/* <>*/}
593
- {/* + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}
594
- {/* {t('event.tickets.insurance.per_ticket')}*/}
595
- {/* </>*/}
596
- {/* }*/}
597
- {/* modal={{*/}
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
  );