@eventlook/sdk 1.4.49 → 1.4.50

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 (84) hide show
  1. package/dist/cjs/form/PaymentOverviewBox.js +0 -6
  2. package/dist/cjs/form/PaymentOverviewBox.js.map +1 -1
  3. package/dist/cjs/form/ReleaseWithMerchandise.js +48 -57
  4. package/dist/cjs/form/ReleaseWithMerchandise.js.map +1 -1
  5. package/dist/cjs/form/TicketSelection.js +6 -5
  6. package/dist/cjs/form/TicketSelection.js.map +1 -1
  7. package/dist/cjs/form/TicketWithMerchandiseSelection.js +5 -3
  8. package/dist/cjs/form/TicketWithMerchandiseSelection.js.map +1 -1
  9. package/dist/cjs/form/services/index.js +1 -18
  10. package/dist/cjs/form/services/index.js.map +1 -1
  11. package/dist/cjs/hooks/useFirstRender.js +14 -0
  12. package/dist/cjs/hooks/useFirstRender.js.map +1 -0
  13. package/dist/esm/form/PaymentOverviewBox.js +0 -6
  14. package/dist/esm/form/PaymentOverviewBox.js.map +1 -1
  15. package/dist/esm/form/ReleaseWithMerchandise.js +49 -58
  16. package/dist/esm/form/ReleaseWithMerchandise.js.map +1 -1
  17. package/dist/esm/form/TicketSelection.js +6 -5
  18. package/dist/esm/form/TicketSelection.js.map +1 -1
  19. package/dist/esm/form/TicketWithMerchandiseSelection.js +6 -4
  20. package/dist/esm/form/TicketWithMerchandiseSelection.js.map +1 -1
  21. package/dist/esm/form/services/index.js +2 -19
  22. package/dist/esm/form/services/index.js.map +1 -1
  23. package/dist/esm/hooks/useFirstRender.js +12 -0
  24. package/dist/esm/hooks/useFirstRender.js.map +1 -0
  25. package/dist/types/locales/cs.d.ts +5 -1
  26. package/package.json +1 -1
  27. package/src/form/PaymentOverviewBox.tsx +11 -11
  28. package/src/form/services/index.tsx +36 -36
  29. package/dist/cjs/_virtual/_commonjsHelpers.js +0 -8
  30. package/dist/cjs/_virtual/_commonjsHelpers.js.map +0 -1
  31. package/dist/cjs/_virtual/index.js +0 -6
  32. package/dist/cjs/_virtual/index.js.map +0 -1
  33. package/dist/cjs/_virtual/index2.js +0 -6
  34. package/dist/cjs/_virtual/index2.js.map +0 -1
  35. package/dist/cjs/_virtual/index3.js +0 -6
  36. package/dist/cjs/_virtual/index3.js.map +0 -1
  37. package/dist/cjs/_virtual/react-is.development.js +0 -6
  38. package/dist/cjs/_virtual/react-is.development.js.map +0 -1
  39. package/dist/cjs/_virtual/react-is.development2.js +0 -6
  40. package/dist/cjs/_virtual/react-is.development2.js.map +0 -1
  41. package/dist/cjs/_virtual/react-is.production.js +0 -6
  42. package/dist/cjs/_virtual/react-is.production.js.map +0 -1
  43. package/dist/cjs/_virtual/react-is.production.min.js +0 -6
  44. package/dist/cjs/_virtual/react-is.production.min.js.map +0 -1
  45. package/dist/cjs/form/TicketQuantityControl.js +0 -51
  46. package/dist/cjs/form/TicketQuantityControl.js.map +0 -1
  47. package/dist/cjs/form/TicketSelectionMobile.js +0 -98
  48. package/dist/cjs/form/TicketSelectionMobile.js.map +0 -1
  49. package/dist/cjs/form/merchendise/MerchandiseSelection.js +0 -19
  50. package/dist/cjs/form/merchendise/MerchandiseSelection.js.map +0 -1
  51. package/dist/cjs/form/merchendise/MerchandiseSlider.js +0 -75
  52. package/dist/cjs/form/merchendise/MerchandiseSlider.js.map +0 -1
  53. package/dist/cjs/hooks/useConsentScrollOnDrawerOpen.js +0 -59
  54. package/dist/cjs/hooks/useConsentScrollOnDrawerOpen.js.map +0 -1
  55. package/dist/esm/_virtual/_commonjsHelpers.js +0 -6
  56. package/dist/esm/_virtual/_commonjsHelpers.js.map +0 -1
  57. package/dist/esm/_virtual/index.js +0 -4
  58. package/dist/esm/_virtual/index.js.map +0 -1
  59. package/dist/esm/_virtual/index2.js +0 -4
  60. package/dist/esm/_virtual/index2.js.map +0 -1
  61. package/dist/esm/_virtual/index3.js +0 -4
  62. package/dist/esm/_virtual/index3.js.map +0 -1
  63. package/dist/esm/_virtual/react-is.development.js +0 -4
  64. package/dist/esm/_virtual/react-is.development.js.map +0 -1
  65. package/dist/esm/_virtual/react-is.development2.js +0 -4
  66. package/dist/esm/_virtual/react-is.development2.js.map +0 -1
  67. package/dist/esm/_virtual/react-is.production.js +0 -4
  68. package/dist/esm/_virtual/react-is.production.js.map +0 -1
  69. package/dist/esm/_virtual/react-is.production.min.js +0 -4
  70. package/dist/esm/_virtual/react-is.production.min.js.map +0 -1
  71. package/dist/esm/form/TicketQuantityControl.js +0 -47
  72. package/dist/esm/form/TicketQuantityControl.js.map +0 -1
  73. package/dist/esm/form/TicketSelectionMobile.js +0 -94
  74. package/dist/esm/form/TicketSelectionMobile.js.map +0 -1
  75. package/dist/esm/form/merchendise/MerchandiseSelection.js +0 -15
  76. package/dist/esm/form/merchendise/MerchandiseSelection.js.map +0 -1
  77. package/dist/esm/form/merchendise/MerchandiseSlider.js +0 -71
  78. package/dist/esm/form/merchendise/MerchandiseSlider.js.map +0 -1
  79. package/dist/esm/hooks/useConsentScrollOnDrawerOpen.js +0 -55
  80. package/dist/esm/hooks/useConsentScrollOnDrawerOpen.js.map +0 -1
  81. package/dist/types/form/PaymentOverviewDrawer.d.ts +0 -8
  82. package/dist/types/form/merchendise/MerchandiseSelection.d.ts +0 -9
  83. package/dist/types/form/merchendise/MerchandiseSlider.d.ts +0 -10
  84. package/dist/types/form/merchendise/MerchendiseSlider.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/form/services/index.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n Box,\n Button,\n Checkbox,\n Dialog,\n DialogContent,\n DialogTitle,\n Divider,\n FormControlLabel,\n IconButton,\n Link,\n Stack,\n Typography,\n} from '@mui/material';\nimport { useWatch, Controller } from 'react-hook-form';\nimport { fCurrency } from '@utils/formatNumber';\nimport useGlobal from '@hooks/useGlobal';\nimport { Iconify } from '@components';\nimport { ITicketForm, ITicketFormTicket } from '@utils/types/ticket.type';\nimport { IEvent } from '@utils/types/event.type';\nimport { useFormContext } from 'react-hook-form';\n\ninterface Props {\n event: IEvent;\n}\n\ninterface BorderedCheckboxProps {\n name: string;\n disabled: boolean;\n title: React.ReactNode;\n price: React.ReactNode;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n}\n\nconst BorderedCheckbox: React.FC<BorderedCheckboxProps> = ({\n name,\n disabled,\n title,\n price,\n onChange,\n}) => {\n const { control } = useFormContext<ITicketForm>();\n\n return (\n <Controller\n name={name as any}\n control={control}\n render={({ field }) => (\n <FormControlLabel\n control={\n <Checkbox\n {...field}\n checked={field.value || false}\n onChange={(e) => {\n onChange?.(e);\n if (!e.defaultPrevented) {\n field.onChange(e);\n }\n }}\n disabled={disabled}\n />\n }\n label={\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n sx={{ width: '100%', pr: 1 }}\n >\n <Typography variant=\"body2\" fontWeight={400}>\n {title}\n </Typography>\n <Typography variant=\"body2\" fontWeight={700} sx={{ whiteSpace: 'nowrap' }}>\n {price}\n </Typography>\n </Stack>\n }\n sx={{\n m: 0,\n px: 1,\n pr: 0.5,\n pl: 0,\n borderRadius: 1,\n width: '100%',\n border: '1px solid',\n borderColor: 'primary.main',\n '& .MuiFormControlLabel-label': {\n width: '100%',\n },\n }}\n />\n )}\n />\n );\n};\n\nconst Services: React.FC<Props> = ({ event }) => {\n const { t, lang, showSnackbar } = useGlobal();\n const [open, setOpen] = useState(false);\n const ticketInsurancePricePerUnit = Number(\n useWatch<ITicketForm>({\n name: 'ticketInsurancePricePerUnit',\n defaultValue: 0,\n }) || 0\n );\n const smsNotificationPrice = Number(\n useWatch<ITicketForm>({\n name: 'smsNotificationPrice',\n defaultValue: 0,\n }) || 0\n );\n const tickets = useWatch<ITicketForm, 'tickets'>({\n name: 'tickets',\n defaultValue: {},\n });\n\n const totalTickets = useMemo(() => {\n const items: ITicketFormTicket[] = Object.values(tickets || {}).flat();\n return items.reduce((sum, ticket) => sum + (Number(ticket.quantity) || 0), 0);\n }, [tickets]);\n\n const handleOpen = (e: React.MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n setOpen(true);\n };\n\n const handleClose = () => setOpen(false);\n\n const handleServiceChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (totalTickets <= 0) {\n e.preventDefault();\n showSnackbar(t('event.tickets.services.add_tickets_first'), {\n variant: 'error',\n });\n }\n };\n\n return (\n <Stack spacing={1}>\n <BorderedCheckbox\n name=\"ticketInsurance\"\n disabled={false}\n title={t('event.tickets.insurance.label')}\n price={\n <>\n + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}\n {t('event.tickets.insurance.per_ticket')}\n </>\n }\n onChange={handleServiceChange}\n />\n\n <BorderedCheckbox\n name=\"smsNotification\"\n disabled={false}\n title={t('event.tickets.sms_notification.label')}\n price={<>+ {fCurrency(smsNotificationPrice, lang, event.currency)}</>}\n onChange={handleServiceChange}\n />\n\n <Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>\n <Link variant=\"body2\" underline=\"always\" onClick={handleOpen} color={'text.primary'}>\n {t('event.tickets.stepper.8.additional_info')}\n </Link>\n </Box>\n\n <Dialog\n open={open}\n onClose={handleClose}\n maxWidth=\"sm\"\n fullWidth\n PaperProps={{\n sx: {\n borderRadius: 4,\n overflow: 'hidden',\n },\n }}\n >\n <DialogTitle\n sx={{\n position: 'relative',\n textAlign: 'center',\n fontWeight: 700,\n fontSize: { xs: '1.5rem', sm: '1.75rem' },\n pt: { xs: 3.5, sm: 4 },\n pb: { xs: 2, sm: 2.5 },\n px: { xs: 3, sm: 4 },\n }}\n >\n {t('event.tickets.stepper.8.title')}:\n <IconButton\n onClick={handleClose}\n size=\"small\"\n sx={{ position: 'absolute', right: 16, top: 16 }}\n >\n <Iconify icon=\"carbon:close\" />\n </IconButton>\n </DialogTitle>\n <DialogContent sx={{ px: { xs: 3, sm: 4 }, pb: { xs: 4, sm: 5 } }}>\n <Stack spacing={3}>\n <Box>\n <Typography variant=\"subtitle2\" fontWeight={700} gutterBottom>\n {t('event.tickets.insurance.label')}\n </Typography>\n <Typography variant=\"body2\" paragraph>\n {t('event.tickets.insurance.modal.description')}\n </Typography>\n <Typography variant=\"body2\" paragraph>\n {t('event.tickets.insurance.modal.coverage')}\n </Typography>\n <BorderedCheckbox\n name=\"ticketInsurance\"\n disabled={false}\n title={t('event.tickets.insurance.label')}\n price={\n <>\n + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}\n {t('event.tickets.insurance.per_ticket')}\n </>\n }\n onChange={handleServiceChange}\n />\n </Box>\n <Divider />\n <Box>\n <Typography variant=\"subtitle2\" fontWeight={700} gutterBottom>\n {t('event.tickets.sms_notification.label')}\n </Typography>\n <Typography variant=\"body2\" paragraph>\n {t('event.tickets.sms_notification.modal.description')}\n </Typography>\n <BorderedCheckbox\n name=\"smsNotification\"\n disabled={false}\n title={t('event.tickets.sms_notification.label')}\n price={<>+ {fCurrency(smsNotificationPrice, lang, event.currency)}</>}\n onChange={handleServiceChange}\n />\n </Box>\n <Button\n variant=\"outlined\"\n onClick={handleClose}\n sx={{\n mt: 1,\n py: 1.25,\n borderRadius: 1,\n height: 36,\n fontWeight: 700,\n borderColor: 'grey.300',\n color: 'text.primary',\n }}\n >\n {t('close')}\n </Button>\n </Stack>\n </DialogContent>\n </Dialog>\n </Stack>\n );\n};\n\nexport default Services;\n"],"names":[],"mappings":";;;;;;;;;;;AAmCA,MAAM,gBAAgB,GAAoC,CAAC,EACzD,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,GACT,KAAI;AACH,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAe;IAEjD,QACE,oBAAC,UAAU,EAAA,EACT,IAAI,EAAE,IAAW,EACjB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAChB,oBAAC,gBAAgB,EAAA,EACf,OAAO,EACL,KAAA,CAAA,aAAA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D,CAAC,CAAC,sCAAsC,CAAC,CAC/B;AACb,wBAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAA,IAAA,EAAA,EAClC,CAAC,CAAC,kDAAkD,CAAC,CAC3C;AACb,wBAAA,KAAA,CAAA,aAAA,CAAC,gBAAgB,EAAA,EACf,IAAI,EAAC,iBAAiB,EACtB,QAAQ,EAAE,KAAK,EACf,KAAK,EAAE,CAAC,CAAC,sCAAsC,CAAC,EAChD,KAAK,EAAE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;;AAAK,gCAAA,SAAS,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAI,EACrE,QAAQ,EAAE,mBAAmB,GAC7B,CACE;oBACN,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAC,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE;AACF,4BAAA,EAAE,EAAE,CAAC;AACL,4BAAA,EAAE,EAAE,IAAI;AACR,4BAAA,YAAY,EAAE,CAAC;AACf,4BAAA,MAAM,EAAE,EAAE;AACV,4BAAA,UAAU,EAAE,GAAG;AACf,4BAAA,WAAW,EAAE,UAAU;AACvB,4BAAA,KAAK,EAAE,cAAc;yBACtB,EAAA,EAEA,CAAC,CAAC,OAAO,CAAC,CACJ,CACH,CACM,CACT,CACH;AAEZ;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/form/services/index.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n Box,\n Button,\n Checkbox,\n Dialog,\n DialogContent,\n DialogTitle,\n Divider,\n FormControlLabel,\n IconButton,\n Link,\n Stack,\n Typography,\n} from '@mui/material';\nimport { useWatch, Controller } from 'react-hook-form';\nimport { fCurrency } from '@utils/formatNumber';\nimport useGlobal from '@hooks/useGlobal';\nimport { Iconify } from '@components';\nimport { ITicketForm, ITicketFormTicket } from '@utils/types/ticket.type';\nimport { IEvent } from '@utils/types/event.type';\nimport { useFormContext } from 'react-hook-form';\n\ninterface Props {\n event: IEvent;\n}\n\ninterface BorderedCheckboxProps {\n name: string;\n disabled: boolean;\n title: React.ReactNode;\n price: React.ReactNode;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n}\n\nconst BorderedCheckbox: React.FC<BorderedCheckboxProps> = ({\n name,\n disabled,\n title,\n price,\n onChange,\n}) => {\n const { control } = useFormContext<ITicketForm>();\n\n return (\n <Controller\n name={name as any}\n control={control}\n render={({ field }) => (\n <FormControlLabel\n control={\n <Checkbox\n {...field}\n checked={field.value || false}\n onChange={(e) => {\n onChange?.(e);\n if (!e.defaultPrevented) {\n field.onChange(e);\n }\n }}\n disabled={disabled}\n />\n }\n label={\n <Stack\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n sx={{ width: '100%', pr: 1 }}\n >\n <Typography variant=\"body2\" fontWeight={400}>\n {title}\n </Typography>\n <Typography variant=\"body2\" fontWeight={700} sx={{ whiteSpace: 'nowrap' }}>\n {price}\n </Typography>\n </Stack>\n }\n sx={{\n m: 0,\n px: 1,\n pr: 0.5,\n pl: 0,\n borderRadius: 1,\n width: '100%',\n border: '1px solid',\n borderColor: 'primary.main',\n '& .MuiFormControlLabel-label': {\n width: '100%',\n },\n }}\n />\n )}\n />\n );\n};\n\nconst Services: React.FC<Props> = ({ event }) => {\n const { t, lang, showSnackbar } = useGlobal();\n const [open, setOpen] = useState(false);\n const ticketInsurancePricePerUnit = Number(\n useWatch<ITicketForm>({\n name: 'ticketInsurancePricePerUnit',\n defaultValue: 0,\n }) || 0\n );\n const smsNotificationPrice = Number(\n useWatch<ITicketForm>({\n name: 'smsNotificationPrice',\n defaultValue: 0,\n }) || 0\n );\n const tickets = useWatch<ITicketForm, 'tickets'>({\n name: 'tickets',\n defaultValue: {},\n });\n\n const totalTickets = useMemo(() => {\n const items: ITicketFormTicket[] = Object.values(tickets || {}).flat();\n return items.reduce((sum, ticket) => sum + (Number(ticket.quantity) || 0), 0);\n }, [tickets]);\n\n const handleOpen = (e: React.MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n setOpen(true);\n };\n\n const handleClose = () => setOpen(false);\n\n const handleServiceChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (totalTickets <= 0) {\n e.preventDefault();\n showSnackbar(t('event.tickets.services.add_tickets_first'), {\n variant: 'error',\n });\n }\n };\n\n return (\n <Stack spacing={1}>\n {/*<BorderedCheckbox*/}\n {/* name=\"ticketInsurance\"*/}\n {/* disabled={false}*/}\n {/* title={t('event.tickets.insurance.label')}*/}\n {/* price={*/}\n {/* <>*/}\n {/* + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}\n {/* {t('event.tickets.insurance.per_ticket')}*/}\n {/* </>*/}\n {/* }*/}\n {/* onChange={handleServiceChange}*/}\n {/*/>*/}\n\n <BorderedCheckbox\n name=\"smsNotification\"\n disabled={false}\n title={t('event.tickets.sms_notification.label')}\n price={<>+ {fCurrency(smsNotificationPrice, lang, event.currency)}</>}\n onChange={handleServiceChange}\n />\n\n <Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>\n <Link variant=\"body2\" underline=\"always\" onClick={handleOpen} color={'text.primary'}>\n {t('event.tickets.stepper.8.additional_info')}\n </Link>\n </Box>\n\n <Dialog\n open={open}\n onClose={handleClose}\n maxWidth=\"sm\"\n fullWidth\n PaperProps={{\n sx: {\n borderRadius: 4,\n overflow: 'hidden',\n },\n }}\n >\n <DialogTitle\n sx={{\n position: 'relative',\n textAlign: 'center',\n fontWeight: 700,\n fontSize: { xs: '1.5rem', sm: '1.75rem' },\n pt: { xs: 3.5, sm: 4 },\n pb: { xs: 2, sm: 2.5 },\n px: { xs: 3, sm: 4 },\n }}\n >\n {t('event.tickets.stepper.8.title')}:\n <IconButton\n onClick={handleClose}\n size=\"small\"\n sx={{ position: 'absolute', right: 16, top: 16 }}\n >\n <Iconify icon=\"carbon:close\" />\n </IconButton>\n </DialogTitle>\n <DialogContent sx={{ px: { xs: 3, sm: 4 }, pb: { xs: 4, sm: 5 } }}>\n <Stack spacing={3}>\n {/*<Box>*/}\n {/* <Typography variant=\"subtitle2\" fontWeight={700} gutterBottom>*/}\n {/* {t('event.tickets.insurance.label')}*/}\n {/* </Typography>*/}\n {/* <Typography variant=\"body2\" paragraph>*/}\n {/* {t('event.tickets.insurance.modal.description')}*/}\n {/* </Typography>*/}\n {/* <Typography variant=\"body2\" paragraph>*/}\n {/* {t('event.tickets.insurance.modal.coverage')}*/}\n {/* </Typography>*/}\n {/* <BorderedCheckbox*/}\n {/* name=\"ticketInsurance\"*/}\n {/* disabled={false}*/}\n {/* title={t('event.tickets.insurance.label')}*/}\n {/* price={*/}\n {/* <>*/}\n {/* + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}\n {/* {t('event.tickets.insurance.per_ticket')}*/}\n {/* </>*/}\n {/* }*/}\n {/* onChange={handleServiceChange}*/}\n {/* />*/}\n {/*</Box>*/}\n {/*<Divider />*/}\n <Box>\n <Typography variant=\"subtitle2\" fontWeight={700} gutterBottom>\n {t('event.tickets.sms_notification.label')}\n </Typography>\n <Typography variant=\"body2\" paragraph>\n {t('event.tickets.sms_notification.modal.description')}\n </Typography>\n <BorderedCheckbox\n name=\"smsNotification\"\n disabled={false}\n title={t('event.tickets.sms_notification.label')}\n price={<>+ {fCurrency(smsNotificationPrice, lang, event.currency)}</>}\n onChange={handleServiceChange}\n />\n </Box>\n <Button\n variant=\"outlined\"\n onClick={handleClose}\n sx={{\n mt: 1,\n py: 1.25,\n borderRadius: 1,\n height: 36,\n fontWeight: 700,\n borderColor: 'grey.300',\n color: 'text.primary',\n }}\n >\n {t('close')}\n </Button>\n </Stack>\n </DialogContent>\n </Dialog>\n </Stack>\n );\n};\n\nexport default Services;\n"],"names":[],"mappings":";;;;;;;;;;;AAmCA,MAAM,gBAAgB,GAAoC,CAAC,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yBf,oBAAA,KAAA,CAAA,aAAA,CAAC,GAAG,EAAA,IAAA;AACF,wBAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAC,OAAO,EAAC,WAAW,EAAC,UAAU,EAAE,GAAG,EAAE,YAAY,EAAA,IAAA,EAAA,EAC1D,CAAC,CAAC,sCAAsC,CAAC,CAC/B;AACb,wBAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAA,IAAA,EAAA,EAClC,CAAC,CAAC,kDAAkD,CAAC,CAC3C;AACb,wBAAA,KAAA,CAAA,aAAA,CAAC,gBAAgB,EAAA,EACf,IAAI,EAAC,iBAAiB,EACtB,QAAQ,EAAE,KAAK,EACf,KAAK,EAAE,CAAC,CAAC,sCAAsC,CAAC,EAChD,KAAK,EAAE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;;AAAK,gCAAA,SAAS,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAI,EACrE,QAAQ,EAAE,mBAAmB,GAC7B,CACE;oBACN,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAC,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE;AACF,4BAAA,EAAE,EAAE,CAAC;AACL,4BAAA,EAAE,EAAE,IAAI;AACR,4BAAA,YAAY,EAAE,CAAC;AACf,4BAAA,MAAM,EAAE,EAAE;AACV,4BAAA,UAAU,EAAE,GAAG;AACf,4BAAA,WAAW,EAAE,UAAU;AACvB,4BAAA,KAAK,EAAE,cAAc;yBACtB,EAAA,EAEA,CAAC,CAAC,OAAO,CAAC,CACJ,CACH,CACM,CACT,CACH;AAEZ;;;;"}
@@ -0,0 +1,12 @@
1
+ import { useRef, useEffect } from 'react';
2
+
3
+ function useFirstRender() {
4
+ const firstRender = useRef(true);
5
+ useEffect(() => {
6
+ firstRender.current = false;
7
+ }, []);
8
+ return firstRender.current;
9
+ }
10
+
11
+ export { useFirstRender };
12
+ //# sourceMappingURL=useFirstRender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFirstRender.js","sources":["../../../src/hooks/useFirstRender.ts"],"sourcesContent":["import { useRef, useEffect } from 'react';\n\nexport function useFirstRender(): boolean {\n const firstRender = useRef(true);\n\n useEffect(() => {\n firstRender.current = false;\n }, []);\n\n return firstRender.current;\n}\n"],"names":[],"mappings":";;SAEgB,cAAc,GAAA;AAC5B,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC;IAEhC,SAAS,CAAC,MAAK;AACb,QAAA,WAAW,CAAC,OAAO,GAAG,KAAK;KAC5B,EAAE,EAAE,CAAC;IAEN,OAAO,WAAW,CAAC,OAAO;AAC5B;;;;"}
@@ -108,7 +108,11 @@ declare const cs: {
108
108
  label: string;
109
109
  per_ticket: string;
110
110
  modal: {
111
- description: string;
111
+ description: string[];
112
+ links: {
113
+ insurance: string;
114
+ info: string;
115
+ };
112
116
  coverage: string;
113
117
  price: string;
114
118
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventlook/sdk",
3
- "version": "1.4.49",
3
+ "version": "1.4.50",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -489,17 +489,17 @@ const PaymentOverviewBox: React.FC<Props> = ({ event, withoutPadding, hideBuyBut
489
489
  {!!selectedTickets.length && (
490
490
  <Stack spacing={0.5}>
491
491
  {/* TODO: Uncomment this when Colonnade response - must update terms and conditions and email info */}
492
- <PaymentOverviewCheckbox
493
- checkboxName="ticketInsurance"
494
- label={t('event.tickets.insurance.label')}
495
- value={
496
- <>
497
- {ticketInsurance && totalItemCount.totalTickets > 0 ? '' : '+ '}
498
- {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}
499
- {t('event.tickets.insurance.per_ticket')}
500
- </>
501
- }
502
- />
492
+ {/*<PaymentOverviewCheckbox*/}
493
+ {/* checkboxName="ticketInsurance"*/}
494
+ {/* label={t('event.tickets.insurance.label')}*/}
495
+ {/* value={*/}
496
+ {/* <>*/}
497
+ {/* {ticketInsurance && totalItemCount.totalTickets > 0 ? '' : '+ '}*/}
498
+ {/* {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}
499
+ {/* {t('event.tickets.insurance.per_ticket')}*/}
500
+ {/* </>*/}
501
+ {/* }*/}
502
+ {/*/>*/}
503
503
  <PaymentOverviewCheckbox
504
504
  checkboxName="smsNotification"
505
505
  label={t('event.tickets.sms_notification.label')}
@@ -138,18 +138,18 @@ const Services: React.FC<Props> = ({ event }) => {
138
138
 
139
139
  return (
140
140
  <Stack spacing={1}>
141
- <BorderedCheckbox
142
- name="ticketInsurance"
143
- disabled={false}
144
- title={t('event.tickets.insurance.label')}
145
- price={
146
- <>
147
- + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}
148
- {t('event.tickets.insurance.per_ticket')}
149
- </>
150
- }
151
- onChange={handleServiceChange}
152
- />
141
+ {/*<BorderedCheckbox*/}
142
+ {/* name="ticketInsurance"*/}
143
+ {/* disabled={false}*/}
144
+ {/* title={t('event.tickets.insurance.label')}*/}
145
+ {/* price={*/}
146
+ {/* <>*/}
147
+ {/* + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}
148
+ {/* {t('event.tickets.insurance.per_ticket')}*/}
149
+ {/* </>*/}
150
+ {/* }*/}
151
+ {/* onChange={handleServiceChange}*/}
152
+ {/*/>*/}
153
153
 
154
154
  <BorderedCheckbox
155
155
  name="smsNotification"
@@ -199,30 +199,30 @@ const Services: React.FC<Props> = ({ event }) => {
199
199
  </DialogTitle>
200
200
  <DialogContent sx={{ px: { xs: 3, sm: 4 }, pb: { xs: 4, sm: 5 } }}>
201
201
  <Stack spacing={3}>
202
- <Box>
203
- <Typography variant="subtitle2" fontWeight={700} gutterBottom>
204
- {t('event.tickets.insurance.label')}
205
- </Typography>
206
- <Typography variant="body2" paragraph>
207
- {t('event.tickets.insurance.modal.description')}
208
- </Typography>
209
- <Typography variant="body2" paragraph>
210
- {t('event.tickets.insurance.modal.coverage')}
211
- </Typography>
212
- <BorderedCheckbox
213
- name="ticketInsurance"
214
- disabled={false}
215
- title={t('event.tickets.insurance.label')}
216
- price={
217
- <>
218
- + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}
219
- {t('event.tickets.insurance.per_ticket')}
220
- </>
221
- }
222
- onChange={handleServiceChange}
223
- />
224
- </Box>
225
- <Divider />
202
+ {/*<Box>*/}
203
+ {/* <Typography variant="subtitle2" fontWeight={700} gutterBottom>*/}
204
+ {/* {t('event.tickets.insurance.label')}*/}
205
+ {/* </Typography>*/}
206
+ {/* <Typography variant="body2" paragraph>*/}
207
+ {/* {t('event.tickets.insurance.modal.description')}*/}
208
+ {/* </Typography>*/}
209
+ {/* <Typography variant="body2" paragraph>*/}
210
+ {/* {t('event.tickets.insurance.modal.coverage')}*/}
211
+ {/* </Typography>*/}
212
+ {/* <BorderedCheckbox*/}
213
+ {/* name="ticketInsurance"*/}
214
+ {/* disabled={false}*/}
215
+ {/* title={t('event.tickets.insurance.label')}*/}
216
+ {/* price={*/}
217
+ {/* <>*/}
218
+ {/* + {fCurrency(ticketInsurancePricePerUnit, lang, event.currency)} /{' '}*/}
219
+ {/* {t('event.tickets.insurance.per_ticket')}*/}
220
+ {/* </>*/}
221
+ {/* }*/}
222
+ {/* onChange={handleServiceChange}*/}
223
+ {/* />*/}
224
+ {/*</Box>*/}
225
+ {/*<Divider />*/}
226
226
  <Box>
227
227
  <Typography variant="subtitle2" fontWeight={700} gutterBottom>
228
228
  {t('event.tickets.sms_notification.label')}
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
8
- //# sourceMappingURL=_commonjsHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var propTypes = {exports: {}};
4
-
5
- exports.__module = propTypes;
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var reactIs = {exports: {}};
4
-
5
- exports.__module = reactIs;
6
- //# sourceMappingURL=index2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var reactIs = {exports: {}};
4
-
5
- exports.__module = reactIs;
6
- //# sourceMappingURL=index3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var reactIs_development = {};
4
-
5
- exports.__exports = reactIs_development;
6
- //# sourceMappingURL=react-is.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var reactIs_development = {};
4
-
5
- exports.__exports = reactIs_development;
6
- //# sourceMappingURL=react-is.development2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.development2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var reactIs_production = {};
4
-
5
- exports.__exports = reactIs_production;
6
- //# sourceMappingURL=react-is.production.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.production.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var reactIs_production_min = {};
4
-
5
- exports.__exports = reactIs_production_min;
6
- //# sourceMappingURL=react-is.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var material = require('@mui/material');
7
- var Iconify = require('../components/iconify/Iconify.js');
8
-
9
- const TicketQuantityControl = ({ quantity, isDisabled, canAddFirst, canAddMore, addLabel, onDecrement, onIncrement, onAddFirst, }) => {
10
- if (quantity > 0) {
11
- return (React.createElement(material.Stack, { direction: "row", spacing: 0.5, alignItems: "center" },
12
- React.createElement(material.IconButton, { onClick: onDecrement, disabled: isDisabled || quantity <= 0, sx: {
13
- width: 32,
14
- height: 32,
15
- borderRadius: 1,
16
- border: '1px solid',
17
- borderColor: 'grey.300',
18
- } },
19
- React.createElement(Iconify.default, { icon: "eva:minus-fill" })),
20
- React.createElement(material.Box, { sx: {
21
- width: 32,
22
- height: 32,
23
- borderRadius: 1,
24
- border: '1px solid',
25
- borderColor: 'grey.300',
26
- display: 'flex',
27
- alignItems: 'center',
28
- justifyContent: 'center',
29
- fontWeight: 600,
30
- } }, quantity),
31
- React.createElement(material.IconButton, { onClick: onIncrement, disabled: isDisabled || !canAddMore, sx: {
32
- width: 32,
33
- height: 32,
34
- borderRadius: 1,
35
- bgcolor: 'primary.main',
36
- color: 'primary.contrastText',
37
- '&:hover': { bgcolor: 'primary.dark' },
38
- } },
39
- React.createElement(Iconify.default, { icon: "eva:plus-fill" }))));
40
- }
41
- return (React.createElement(material.Button, { variant: "contained", onClick: onAddFirst, disabled: isDisabled || !canAddFirst, sx: {
42
- height: 32,
43
- borderRadius: 1,
44
- px: 3,
45
- textTransform: 'none',
46
- fontWeight: 600,
47
- } }, addLabel));
48
- };
49
-
50
- exports.default = TicketQuantityControl;
51
- //# sourceMappingURL=TicketQuantityControl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TicketQuantityControl.js","sources":["../../../src/form/TicketQuantityControl.tsx"],"sourcesContent":["import React from 'react';\nimport { Box, Button, IconButton, Stack } from '@mui/material';\nimport { Iconify } from '@components/iconify';\n\ninterface TicketQuantityControlProps {\n quantity: number;\n isDisabled: boolean;\n canAddFirst: boolean;\n canAddMore: boolean;\n addLabel: string;\n onDecrement: () => void;\n onIncrement: () => void;\n onAddFirst: () => void;\n}\n\nconst TicketQuantityControl: React.FC<TicketQuantityControlProps> = ({\n quantity,\n isDisabled,\n canAddFirst,\n canAddMore,\n addLabel,\n onDecrement,\n onIncrement,\n onAddFirst,\n}) => {\n if (quantity > 0) {\n return (\n <Stack direction=\"row\" spacing={0.5} alignItems=\"center\">\n <IconButton\n onClick={onDecrement}\n disabled={isDisabled || quantity <= 0}\n sx={{\n width: 32,\n height: 32,\n borderRadius: 1,\n border: '1px solid',\n borderColor: 'grey.300',\n }}\n >\n <Iconify icon=\"eva:minus-fill\" />\n </IconButton>\n <Box\n sx={{\n width: 32,\n height: 32,\n borderRadius: 1,\n border: '1px solid',\n borderColor: 'grey.300',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontWeight: 600,\n }}\n >\n {quantity}\n </Box>\n <IconButton\n onClick={onIncrement}\n disabled={isDisabled || !canAddMore}\n sx={{\n width: 32,\n height: 32,\n borderRadius: 1,\n bgcolor: 'primary.main',\n color: 'primary.contrastText',\n '&:hover': { bgcolor: 'primary.dark' },\n }}\n >\n <Iconify icon=\"eva:plus-fill\" />\n </IconButton>\n </Stack>\n );\n }\n\n return (\n <Button\n variant=\"contained\"\n onClick={onAddFirst}\n disabled={isDisabled || !canAddFirst}\n sx={{\n height: 32,\n borderRadius: 1,\n px: 3,\n textTransform: 'none',\n fontWeight: 600,\n }}\n >\n {addLabel}\n </Button>\n );\n};\n\nexport default TicketQuantityControl;\n"],"names":["Stack","IconButton","Iconify","Box","Button"],"mappings":";;;;;;;;AAeA,MAAM,qBAAqB,GAAyC,CAAC,EACnE,QAAQ,EACR,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,GACX,KAAI;AACH,IAAA,IAAI,QAAQ,GAAG,CAAC,EAAE;AAChB,QAAA,QACE,KAAA,CAAA,aAAA,CAACA,cAAK,EAAA,EAAC,SAAS,EAAC,KAAK,EAAC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAC,QAAQ,EAAA;AACtD,YAAA,KAAA,CAAA,aAAA,CAACC,mBAAU,EAAA,EACT,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,UAAU,IAAI,QAAQ,IAAI,CAAC,EACrC,EAAE,EAAE;AACF,oBAAA,KAAK,EAAE,EAAE;AACT,oBAAA,MAAM,EAAE,EAAE;AACV,oBAAA,YAAY,EAAE,CAAC;AACf,oBAAA,MAAM,EAAE,WAAW;AACnB,oBAAA,WAAW,EAAE,UAAU;AACxB,iBAAA,EAAA;AAED,gBAAA,KAAA,CAAA,aAAA,CAACC,eAAO,EAAA,EAAC,IAAI,EAAC,gBAAgB,GAAG,CACtB;YACb,KAAA,CAAA,aAAA,CAACC,YAAG,EAAA,EACF,EAAE,EAAE;AACF,oBAAA,KAAK,EAAE,EAAE;AACT,oBAAA,MAAM,EAAE,EAAE;AACV,oBAAA,YAAY,EAAE,CAAC;AACf,oBAAA,MAAM,EAAE,WAAW;AACnB,oBAAA,WAAW,EAAE,UAAU;AACvB,oBAAA,OAAO,EAAE,MAAM;AACf,oBAAA,UAAU,EAAE,QAAQ;AACpB,oBAAA,cAAc,EAAE,QAAQ;AACxB,oBAAA,UAAU,EAAE,GAAG;AAChB,iBAAA,EAAA,EAEA,QAAQ,CACL;AACN,YAAA,KAAA,CAAA,aAAA,CAACF,mBAAU,EAAA,EACT,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,UAAU,IAAI,CAAC,UAAU,EACnC,EAAE,EAAE;AACF,oBAAA,KAAK,EAAE,EAAE;AACT,oBAAA,MAAM,EAAE,EAAE;AACV,oBAAA,YAAY,EAAE,CAAC;AACf,oBAAA,OAAO,EAAE,cAAc;AACvB,oBAAA,KAAK,EAAE,sBAAsB;AAC7B,oBAAA,SAAS,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;AACvC,iBAAA,EAAA;gBAED,KAAA,CAAA,aAAA,CAACC,eAAO,IAAC,IAAI,EAAC,eAAe,EAAA,CAAG,CACrB,CACP;;IAIZ,QACE,oBAACE,eAAM,EAAA,EACL,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,UAAU,IAAI,CAAC,WAAW,EACpC,EAAE,EAAE;AACF,YAAA,MAAM,EAAE,EAAE;AACV,YAAA,YAAY,EAAE,CAAC;AACf,YAAA,EAAE,EAAE,CAAC;AACL,YAAA,aAAa,EAAE,MAAM;AACrB,YAAA,UAAU,EAAE,GAAG;SAChB,EAAA,EAEA,QAAQ,CACF;AAEb;;;;"}
@@ -1,98 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var material = require('@mui/material');
7
- var Iconify = require('../components/iconify/Iconify.js');
8
- var formatNumber = require('../utils/formatNumber.js');
9
- var useGlobal = require('../hooks/useGlobal.js');
10
- var TicketQuantityControl = require('./tickets/TicketQuantityControl.js');
11
-
12
- const TicketSelectionMobile = ({ event, activeReleases, showLoading, soldOutReleaseCategoryNames, tickets, isQuantityDisabled, setValue, removeTicket, getExtraFields, }) => {
13
- const { t, lang } = useGlobal.default();
14
- const [expandedReleaseIds, setExpandedReleaseIds] = React.useState({});
15
- const getReleaseTitle = (release) => release.releaseCategoryName || release.name || '';
16
- const getTicketIndexByRelease = (releaseId) => tickets.findIndex((ticket) => ticket.releaseId === releaseId);
17
- const getReleaseQuantity = (releaseId) => {
18
- const ticket = tickets.find((t) => t.releaseId === releaseId);
19
- return Number(ticket?.quantity || 0);
20
- };
21
- const updateReleaseQuantity = (release, nextQuantity) => {
22
- const maxAvailable = Math.min(release.availableTickets || 0, 10);
23
- const clampedQuantity = Math.max(0, Math.min(nextQuantity, maxAvailable));
24
- const ticketIndex = getTicketIndexByRelease(release.id);
25
- if (clampedQuantity <= 0) {
26
- if (ticketIndex >= 0)
27
- removeTicket(ticketIndex);
28
- return;
29
- }
30
- if (ticketIndex >= 0) {
31
- setValue(`tickets.${event.id}.${ticketIndex}.quantity`, clampedQuantity);
32
- return;
33
- }
34
- setValue(`tickets.${event.id}`, [
35
- ...tickets,
36
- {
37
- releaseId: release.id,
38
- quantity: clampedQuantity,
39
- itemName: getReleaseTitle(release),
40
- price: release.price || 0,
41
- products: [],
42
- extraFields: [],
43
- },
44
- ]);
45
- };
46
- const toggleReleaseDescription = (releaseId) => setExpandedReleaseIds((prev) => ({
47
- ...prev,
48
- [releaseId]: !prev[releaseId],
49
- }));
50
- if (showLoading) {
51
- return (React.createElement(material.Stack, { spacing: 2 }, [...Array(2)].map((_, index) => (React.createElement(material.Skeleton, { key: index, variant: "rounded", sx: {
52
- width: '100%',
53
- height: (theme) => theme.spacing(12),
54
- } })))));
55
- }
56
- return (React.createElement(material.Stack, { spacing: 2 }, activeReleases?.map((release) => {
57
- const quantity = getReleaseQuantity(release.id);
58
- const ticketIndex = getTicketIndexByRelease(release.id);
59
- const maxAvailable = Math.min(release.availableTickets || 0, 10);
60
- const isLocked = release.locked && !soldOutReleaseCategoryNames.includes(release.releaseCategoryName);
61
- const isDisabled = isLocked && quantity === 0;
62
- const canAddFirst = maxAvailable > 0 && !isQuantityDisabled(1, release.id);
63
- const canAddMore = quantity < maxAvailable && !isQuantityDisabled(quantity + 1, release.id);
64
- const hasDescription = Boolean(release.description);
65
- return (React.createElement(material.Box, { key: release.id, sx: {
66
- p: 1,
67
- pb: 0,
68
- borderRadius: 1,
69
- bgcolor: 'grey.100',
70
- } },
71
- React.createElement(material.Stack, { spacing: 0 },
72
- React.createElement(material.Box, null,
73
- React.createElement(material.Typography, { variant: "subtitle1", fontWeight: 600 }, getReleaseTitle(release))),
74
- React.createElement(material.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between" },
75
- React.createElement(material.Stack, null,
76
- React.createElement(material.Typography, { variant: "body2" }, release.price === 0
77
- ? t('free')
78
- : formatNumber.fCurrency(release.price, lang, event.currency)),
79
- hasDescription && (React.createElement(material.Button, { size: "small", onClick: () => toggleReleaseDescription(release.id), endIcon: React.createElement(Iconify.default, { icon: expandedReleaseIds[release.id]
80
- ? 'eva:chevron-up-fill'
81
- : 'eva:chevron-down-fill' }), sx: {
82
- px: 0,
83
- minWidth: 'auto',
84
- textTransform: 'none',
85
- color: 'text.primary',
86
- textDecoration: 'underline',
87
- fontWeight: 400,
88
- '& .MuiButton-endIcon': { ml: 0.3 },
89
- } }, t('more_info')))),
90
- React.createElement(TicketQuantityControl.default, { quantity: quantity, isDisabled: isDisabled, canAddFirst: canAddFirst, canAddMore: canAddMore, addLabel: t('add'), onDecrement: () => updateReleaseQuantity(release, quantity - 1), onIncrement: () => updateReleaseQuantity(release, quantity + 1), onAddFirst: () => updateReleaseQuantity(release, 1) })),
91
- hasDescription && (React.createElement(material.Collapse, { in: Boolean(expandedReleaseIds[release.id]) },
92
- React.createElement(material.Typography, { variant: "body2", color: "text.secondary" }, release.description))),
93
- ticketIndex >= 0 && getExtraFields(release.id, ticketIndex))));
94
- })));
95
- };
96
-
97
- exports.default = TicketSelectionMobile;
98
- //# sourceMappingURL=TicketSelectionMobile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TicketSelectionMobile.js","sources":["../../../src/form/TicketSelectionMobile.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Box, Button, Collapse, Skeleton, Stack, Typography } from '@mui/material';\nimport { Iconify } from '@components/iconify';\nimport { fCurrency } from '@utils/formatNumber';\nimport { IEvent } from '@utils/types/event.type';\nimport { IReleaseShort } from '@utils/types/release.type';\nimport { ITicketFormTicket } from '@utils/types/ticket.type';\nimport useGlobal from '@hooks/useGlobal';\nimport TicketQuantityControl from './tickets/TicketQuantityControl';\n\ninterface Props {\n event: IEvent;\n activeReleases?: IReleaseShort[];\n showLoading: boolean;\n soldOutReleaseCategoryNames: string[];\n tickets: ITicketFormTicket[];\n isQuantityDisabled: (value: number, releaseId: number | '') => boolean;\n setValue: (name: string, value: any) => void;\n removeTicket: (indexToRemove: number) => void;\n getExtraFields: (releaseId: number | '', index: number) => React.ReactNode;\n}\n\nconst TicketSelectionMobile: React.FC<Props> = ({\n event,\n activeReleases,\n showLoading,\n soldOutReleaseCategoryNames,\n tickets,\n isQuantityDisabled,\n setValue,\n removeTicket,\n getExtraFields,\n}) => {\n const { t, lang } = useGlobal();\n const [expandedReleaseIds, setExpandedReleaseIds] = useState<Record<number, boolean>>({});\n\n const getReleaseTitle = (release: IReleaseShort) =>\n release.releaseCategoryName || release.name || '';\n\n const getTicketIndexByRelease = (releaseId: number) =>\n tickets.findIndex((ticket) => ticket.releaseId === releaseId);\n\n const getReleaseQuantity = (releaseId: number) => {\n const ticket = tickets.find((t) => t.releaseId === releaseId);\n return Number(ticket?.quantity || 0);\n };\n\n const updateReleaseQuantity = (release: IReleaseShort, nextQuantity: number) => {\n const maxAvailable = Math.min(release.availableTickets || 0, 10);\n const clampedQuantity = Math.max(0, Math.min(nextQuantity, maxAvailable));\n const ticketIndex = getTicketIndexByRelease(release.id);\n\n if (clampedQuantity <= 0) {\n if (ticketIndex >= 0) removeTicket(ticketIndex);\n return;\n }\n\n if (ticketIndex >= 0) {\n setValue(`tickets.${event.id}.${ticketIndex}.quantity`, clampedQuantity);\n return;\n }\n\n setValue(`tickets.${event.id}`, [\n ...tickets,\n {\n releaseId: release.id,\n quantity: clampedQuantity,\n itemName: getReleaseTitle(release),\n price: release.price || 0,\n products: [],\n extraFields: [],\n },\n ]);\n };\n\n const toggleReleaseDescription = (releaseId: number) =>\n setExpandedReleaseIds((prev) => ({\n ...prev,\n [releaseId]: !prev[releaseId],\n }));\n\n if (showLoading) {\n return (\n <Stack spacing={2}>\n {[...Array(2)].map((_, index) => (\n <Skeleton\n key={index}\n variant=\"rounded\"\n sx={{\n width: '100%',\n height: (theme) => theme.spacing(12),\n }}\n />\n ))}\n </Stack>\n );\n }\n\n return (\n <Stack spacing={2}>\n {activeReleases?.map((release) => {\n const quantity = getReleaseQuantity(release.id);\n const ticketIndex = getTicketIndexByRelease(release.id);\n const maxAvailable = Math.min(release.availableTickets || 0, 10);\n const isLocked =\n release.locked && !soldOutReleaseCategoryNames.includes(release.releaseCategoryName);\n const isDisabled = isLocked && quantity === 0;\n const canAddFirst = maxAvailable > 0 && !isQuantityDisabled(1, release.id);\n const canAddMore = quantity < maxAvailable && !isQuantityDisabled(quantity + 1, release.id);\n const hasDescription = Boolean(release.description);\n\n return (\n <Box\n key={release.id}\n sx={{\n p: 1,\n pb: 0,\n borderRadius: 1,\n bgcolor: 'grey.100',\n }}\n >\n <Stack spacing={0}>\n <Box>\n <Typography variant=\"subtitle1\" fontWeight={600}>\n {getReleaseTitle(release)}\n </Typography>\n </Box>\n\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\">\n <Stack>\n <Typography variant=\"body2\">\n {release.price === 0\n ? t('free')\n : fCurrency(release.price, lang, event.currency)}\n </Typography>\n\n {hasDescription && (\n <Button\n size=\"small\"\n onClick={() => toggleReleaseDescription(release.id)}\n endIcon={\n <Iconify\n icon={\n expandedReleaseIds[release.id]\n ? 'eva:chevron-up-fill'\n : 'eva:chevron-down-fill'\n }\n />\n }\n sx={{\n px: 0,\n minWidth: 'auto',\n textTransform: 'none',\n color: 'text.primary',\n textDecoration: 'underline',\n fontWeight: 400,\n '& .MuiButton-endIcon': { ml: 0.3 },\n }}\n >\n {t('more_info')}\n </Button>\n )}\n </Stack>\n\n <TicketQuantityControl\n quantity={quantity}\n isDisabled={isDisabled}\n canAddFirst={canAddFirst}\n canAddMore={canAddMore}\n addLabel={t('add')}\n onDecrement={() => updateReleaseQuantity(release, quantity - 1)}\n onIncrement={() => updateReleaseQuantity(release, quantity + 1)}\n onAddFirst={() => updateReleaseQuantity(release, 1)}\n />\n </Stack>\n\n {hasDescription && (\n <Collapse in={Boolean(expandedReleaseIds[release.id])}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {release.description}\n </Typography>\n </Collapse>\n )}\n\n {ticketIndex >= 0 && getExtraFields(release.id, ticketIndex)}\n </Stack>\n </Box>\n );\n })}\n </Stack>\n );\n};\n\nexport default TicketSelectionMobile;\n"],"names":["useGlobal","useState","Stack","Skeleton","Box","Typography","fCurrency","Button","Iconify","TicketQuantityControl","Collapse"],"mappings":";;;;;;;;;;;AAsBA,MAAM,qBAAqB,GAAoB,CAAC,EAC9C,KAAK,EACL,cAAc,EACd,WAAW,EACX,2BAA2B,EAC3B,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,cAAc,GACf,KAAI;IACH,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,GAAGA,iBAAS,EAAE;IAC/B,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAGC,cAAQ,CAA0B,EAAE,CAAC;AAEzF,IAAA,MAAM,eAAe,GAAG,CAAC,OAAsB,KAC7C,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,IAAI,IAAI,EAAE;IAEnD,MAAM,uBAAuB,GAAG,CAAC,SAAiB,KAChD,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC;AAE/D,IAAA,MAAM,kBAAkB,GAAG,CAAC,SAAiB,KAAI;AAC/C,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;QAC7D,OAAO,MAAM,CAAC,MAAM,EAAE,QAAQ,IAAI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Module', { value: true });
4
-
5
- var React = require('react');
6
- var material = require('@mui/material');
7
- var CustomSkeleton = require('../../components/CustomSkeleton.js');
8
- var MerchandiseSlider = require('./MerchandiseSlider.js');
9
-
10
- const MerchandiseSelection = ({ eventProducts, eventId, isLoading }) =>
11
- // <Grid container spacing={3}>
12
- // {
13
- // }
14
- // </Grid>
15
- isLoading ? ([...Array(3)].map((item) => (React.createElement(material.Grid, { key: item, item: true, xs: 12, md: 4 },
16
- React.createElement(CustomSkeleton.default, { height: 334 }))))) : (React.createElement(MerchandiseSlider.default, { eventProducts: eventProducts, eventId: eventId }));
17
-
18
- exports.default = MerchandiseSelection;
19
- //# sourceMappingURL=MerchandiseSelection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MerchandiseSelection.js","sources":["../../../../src/form/merchendise/MerchandiseSelection.tsx"],"sourcesContent":["import React from 'react';\nimport { Grid } from '@mui/material';\nimport { IEventProduct } from '@utils/types/event-product.type';\nimport CustomSkeleton from '@components/CustomSkeleton';\nimport MerchandiseSlider from './MerchandiseSlider';\n\ninterface Props {\n eventProducts: IEventProduct[];\n eventId: number;\n isLoading?: boolean;\n}\n\nconst MerchandiseSelection: React.FC<Props> = ({ eventProducts, eventId, isLoading }) =>\n // <Grid container spacing={3}>\n // {\n\n // }\n // </Grid>\n isLoading ? (\n [...Array(3)].map((item) => (\n <Grid key={item} item xs={12} md={4}>\n <CustomSkeleton height={334} />\n </Grid>\n ))\n ) : (\n <MerchandiseSlider eventProducts={eventProducts} eventId={eventId} />\n );\n\nexport default MerchandiseSelection;\n"],"names":["Grid","CustomSkeleton","MerchandiseSlider"],"mappings":";;;;;;;;;AAYA,MAAM,oBAAoB,GAAoB,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE;AAClF;AACA;AAEA;AACA;AACA,SAAS,IACP,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MACrB,KAAA,CAAA,aAAA,CAACA,aAAI,EAAA,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAA,IAAA,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAA;IACjC,KAAA,CAAA,aAAA,CAACC,sBAAc,EAAA,EAAC,MAAM,EAAE,GAAG,EAAA,CAAI,CAC1B,CACR,CAAC,KAEF,KAAA,CAAA,aAAA,CAACC,yBAAiB,EAAA,EAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAA,CAAI;;;;"}
@@ -1,75 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var useEmblaCarousel = require('embla-carousel-react');
7
- var material = require('@mui/material');
8
- var styles = require('@mui/material/styles');
9
- var ProductCard = require('../product/ProductCard.js');
10
-
11
- const MerchandiseSlider = ({ eventProducts, eventId, sx }) => {
12
- const [emblaRef, emblaApi] = useEmblaCarousel();
13
- const theme = styles.useTheme();
14
- const [totalSlides, setTotalSlides] = React.useState(0);
15
- const [activeSlide, setActiveSlide] = React.useState(0);
16
- const [activeSlides, setActiveSlides] = React.useState(0);
17
- const calculateTotal = React.useCallback(() => {
18
- if (!emblaApi)
19
- return;
20
- const slides = emblaApi.slideNodes().length || 0;
21
- const slidesInView = emblaApi.slidesInView();
22
- setActiveSlides(slidesInView.length);
23
- setTotalSlides(slides);
24
- const activeSlide = slidesInView[0];
25
- setActiveSlide(slidesInView.length > 4 ? slidesInView[1] : activeSlide || 0);
26
- }, [emblaApi]);
27
- React.useCallback(() => {
28
- if (emblaApi)
29
- emblaApi.scrollNext();
30
- }, [emblaApi]);
31
- React.useCallback(() => {
32
- if (emblaApi)
33
- emblaApi.scrollPrev();
34
- }, [emblaApi]);
35
- React.useEffect(() => {
36
- if (!emblaApi)
37
- return;
38
- calculateTotal();
39
- emblaApi.on('reInit', calculateTotal);
40
- emblaApi.on('slidesChanged', calculateTotal);
41
- emblaApi.on('slidesInView', calculateTotal);
42
- return () => {
43
- emblaApi.off('reInit', calculateTotal);
44
- emblaApi.off('slidesChanged', calculateTotal);
45
- emblaApi.off('slidesInView', calculateTotal);
46
- };
47
- }, [emblaApi, calculateTotal]);
48
- return (React.createElement(material.Box, { sx: sx },
49
- React.createElement(material.Box, { sx: {
50
- overflow: 'hidden',
51
- padding: theme.spacing(8, 3),
52
- margin: theme.spacing(-8, -3),
53
- } },
54
- React.createElement(material.Box, { ref: emblaRef, className: "embla", sx: { overflow: 'visible' } },
55
- React.createElement(material.Box, { className: "embla__container", sx: {
56
- display: 'flex',
57
- // marginLeft: theme.spacing(-2),
58
- // marginRight: theme.spacing(-2),
59
- } }, eventProducts.map((eventProduct, index) => (React.createElement(material.Box, { key: `event-slide-${index}`, className: "embla__slide", sx: {
60
- flex: `0 0 ${eventProducts.length > 1 ? '78%' : '100%'}`,
61
- minWidth: 0,
62
- margin: `0 ${theme.spacing(1)}`,
63
- transition: 'opacity 0.2s ease',
64
- [theme.breakpoints.up('sm')]: {
65
- flex: '0 0 43%',
66
- },
67
- [theme.breakpoints.up('md')]: {
68
- flex: '0 0 33.3333%',
69
- },
70
- } },
71
- React.createElement(ProductCard.default, { eventProduct: eventProduct, eventId: eventId, isOnlyMerchandise: true })))))))));
72
- };
73
-
74
- exports.default = MerchandiseSlider;
75
- //# sourceMappingURL=MerchandiseSlider.js.map