@licklist/design 0.44.486-dev.5 → 0.44.486-dev.51
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/assets/iframe/available.svg.js +1 -0
- package/dist/assets/iframe/limited.svg.js +1 -0
- package/dist/assets/iframe/soldOut.svg.js +1 -0
- package/dist/assets/logo/bookedit.svg +9 -11
- package/dist/assets/logo/bookedit.svg.js +1 -1
- package/dist/assets/logo/favicon.svg +12 -0
- package/dist/assets/logo/licklist.svg +0 -2
- package/dist/assets/logo/licklist.svg.js +1 -1
- package/dist/availability-indicator/AvailabilityIndicator.d.ts +9 -0
- package/dist/availability-indicator/AvailabilityIndicator.d.ts.map +1 -0
- package/dist/availability-indicator/AvailabilityIndicator.js +1 -0
- package/dist/availability-indicator/index.d.ts +2 -0
- package/dist/availability-indicator/index.d.ts.map +1 -0
- package/dist/calendar/Calendar.d.ts +21 -0
- package/dist/calendar/Calendar.d.ts.map +1 -0
- package/dist/calendar/Calendar.js +1 -0
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts +6 -0
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -0
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +1 -0
- package/dist/calendar/components/CalendarButtons/index.d.ts.map +1 -0
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +5 -0
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -0
- package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -0
- package/dist/calendar/components/CalendarDates/index.d.ts.map +1 -0
- package/dist/calendar/components/CalendarSelect/CalendarSelect.d.ts.map +1 -0
- package/dist/calendar/components/CalendarSelect/CalendarSelect.js +1 -0
- package/dist/calendar/components/CalendarSelect/index.d.ts.map +1 -0
- package/dist/calendar/components/CalendarWeekdays/CalendarWeekdays.d.ts.map +1 -0
- package/dist/calendar/components/CalendarWeekdays/index.d.ts.map +1 -0
- package/dist/calendar/index.d.ts +4 -0
- package/dist/calendar/index.d.ts.map +1 -0
- package/dist/calendar/utils/index.d.ts +5 -0
- package/dist/calendar/utils/index.d.ts.map +1 -0
- package/dist/calendar/utils/index.js +1 -0
- package/dist/date-time-button/DateTimeButton.d.ts +7 -1
- package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/utils/getDefaultProductSet.js +1 -1
- package/dist/events/event-venue-map/hooks/useImage.d.ts.map +1 -1
- package/dist/events/event-venue-map/hooks/useImage.js +1 -1
- package/dist/file-upload/FileUpload.d.ts.map +1 -1
- package/dist/file-upload/FileUpload.js +1 -1
- package/dist/iframe/activity-card/ActivityCard.d.ts +17 -0
- package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -0
- package/dist/iframe/activity-card/ActivityCard.js +1 -0
- package/dist/iframe/activity-card/index.d.ts +2 -0
- package/dist/iframe/activity-card/index.d.ts.map +1 -0
- package/dist/iframe/event/index.d.ts +0 -1
- package/dist/iframe/event/index.d.ts.map +1 -1
- package/dist/iframe/index.d.ts +2 -2
- package/dist/iframe/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +2 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +1 -1
- package/dist/iframe/order-process/components/ErrorModal/ErrorModal.d.ts +2 -1
- package/dist/iframe/order-process/components/ErrorModal/ErrorModal.d.ts.map +1 -1
- package/dist/iframe/order-process/components/ErrorModal/ErrorModal.js +1 -1
- package/dist/iframe/order-process/components/Timer/utils/index.d.ts +1 -1
- package/dist/iframe/order-process/components/Timer/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/Timer/utils/index.js +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +4 -3
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.js +1 -1
- package/dist/iframe/order-process/constants.d.ts +1 -0
- package/dist/iframe/order-process/constants.d.ts.map +1 -1
- package/dist/iframe/order-process/constants.js +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +1 -1
- package/dist/iframe/payment/order-items-table/types/index.d.ts +7 -1
- package/dist/iframe/payment/order-items-table/types/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/types/index.js +1 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts +3 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
- package/dist/product-set/control/ProductSetControl.d.ts +2 -1
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +1 -1
- package/dist/product-set/control/ProductSetRecurrenceControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetRecurrenceControl.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +3 -1
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts +2 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts +0 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts +8 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.js +1 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts +2 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceInput.js +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +4 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +1 -0
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
- package/dist/report/form/ReportForm.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +1 -1
- package/dist/sales/coupon/control/CouponFormControl.d.ts.map +1 -1
- package/dist/sales/coupon/control/CouponFormControl.js +1 -1
- package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts.map +1 -1
- package/dist/sales/manual-booking/summary/ManualBookingSummary.js +1 -1
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/static/RestrictedAccess.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.d.ts +2 -1
- package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.js +1 -1
- package/dist/styles/{iframe-customers-journey/ActivitiesCard.scss → activity-card/GridActivitiesCard.scss} +1 -1
- package/dist/styles/{iframe-customers-journey/ActivitiesSelectedCard.scss → activity-card/ListActivitiesCard.scss} +2 -1
- package/dist/styles/activity-card/_index.scss +2 -0
- package/dist/styles/availability-indicator/AvailabilityIndicator.scss +7 -0
- package/dist/styles/availability-indicator/_index.scss +1 -0
- package/dist/styles/{iframe-customers-journey → date-time-button}/DateTimeButton.scss +6 -12
- package/dist/styles/date-time-button/_index.scss +1 -0
- package/dist/styles/form/CustomCheckbox.scss +5 -0
- package/dist/styles/header/Header.scss +0 -4
- package/dist/styles/iframe-events/Card.scss +1 -0
- package/dist/styles/iframe-page/PageBody.scss +3 -2
- package/dist/styles/notification/Notification.scss +4 -0
- package/dist/styles/packages.scss +3 -1
- package/dist/styles/resources-blocking/_index.scss +5 -0
- package/dist/styles/themes/bookedit/_index.scss +1 -0
- package/dist/virtualized/components/VirtualizedWindowScroller.d.ts.map +1 -1
- package/dist/virtualized/components/VirtualizedWindowScroller.js +1 -1
- package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
- package/dist/zone/form/components/AvailableTimesControl.js +1 -1
- package/dist/zone/form/components/GameDurationControl.d.ts +7 -0
- package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -0
- package/dist/zone/form/components/GameDurationControl.js +1 -0
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/dist/zone/form/utils/dates.js +1 -1
- package/package.json +3 -3
- package/src/assets/logo/bookedit.svg +9 -11
- package/src/assets/logo/favicon.svg +12 -0
- package/src/assets/logo/licklist.svg +0 -2
- package/src/availability-indicator/AvailabilityIndicator.tsx +59 -0
- package/src/availability-indicator/index.ts +1 -0
- package/src/calendar/Calendar.stories.tsx +33 -0
- package/src/calendar/Calendar.tsx +46 -0
- package/src/{iframe/event/event-calendar → calendar}/components/CalendarButtons/CalendarButtons.tsx +31 -14
- package/src/{iframe/event/event-calendar → calendar}/components/CalendarDates/CalendarDates.tsx +24 -19
- package/src/{iframe/event/event-calendar → calendar}/components/CalendarSelect/CalendarSelect.tsx +1 -1
- package/src/calendar/index.ts +3 -0
- package/src/calendar/utils/index.ts +28 -0
- package/src/date-time-button/DateTimeButton.stories.tsx +17 -0
- package/src/date-time-button/DateTimeButton.tsx +19 -22
- package/src/events/edit-event-modal/IntervalInput.tsx +3 -0
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.stories.tsx +0 -9
- package/src/events/edit-event-modal/utils/getDefaultProductSet.ts +3 -1
- package/src/events/event-venue-map/hooks/useImage.tsx +17 -8
- package/src/file-upload/FileUpload.tsx +3 -1
- package/src/iframe/{activity-cards/activity-card → activity-card}/ActivityCard.stories.tsx +24 -1
- package/src/iframe/activity-card/ActivityCard.tsx +77 -0
- package/src/iframe/activity-card/index.ts +1 -0
- package/src/iframe/event/event-venue-map/IframeEventVenueMap.stories.tsx +1 -2
- package/src/iframe/event/index.ts +0 -6
- package/src/iframe/index.ts +1 -2
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +4 -2
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +2 -1
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +2 -0
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.stories.tsx +0 -1
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +17 -8
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +1 -15
- package/src/iframe/order-process/components/ErrorModal/ErrorModal.tsx +12 -9
- package/src/iframe/order-process/components/Timer/utils/index.ts +6 -9
- package/src/iframe/order-process/components/utils/useCategoryVerification.ts +62 -32
- package/src/iframe/order-process/constants.ts +1 -0
- package/src/iframe/page/Page.stories.tsx +2 -2
- package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +6 -1
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +11 -99
- package/src/iframe/payment/order-items-table/types/index.ts +18 -1
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +118 -0
- package/src/iframe/payment/payment-page/PaymentPage.stories.tsx +1 -1
- package/src/iframe/payment/payment-page/PaymentPage.tsx +4 -4
- package/src/index.ts +2 -0
- package/src/notification/email-template/control/EmailTemplateControl.tsx +26 -1
- package/src/product-set/control/ProductSetControl.tsx +35 -0
- package/src/product-set/control/ProductSetRecurrenceControl.tsx +8 -4
- package/src/product-set/form/ProductCategoriesControl.tsx +2 -1
- package/src/product-set/form/ProductSetForm.stories.tsx +3 -6
- package/src/product-set/form/ProductsControl.tsx +10 -0
- package/src/product-set/product/ProductControl.tsx +28 -1
- package/src/product-set/product/duration/ProductDurationControl.tsx +1 -1
- package/src/product-set/product-category/ProductCategory.stories.tsx +0 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +1 -30
- package/src/provider/location-input/LocationInputDescription.tsx +2 -2
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +9 -6
- package/src/recurrence-input/RecurrenceEndInput.tsx +28 -10
- package/src/recurrence-input/RecurrenceInput.tsx +12 -2
- package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +24 -21
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +9 -0
- package/src/report/form/ReportForm.tsx +1 -1
- package/src/sales/booking/results/components/ResultCard.tsx +3 -2
- package/src/sales/coupon/control/CouponFormControl.tsx +5 -0
- package/src/sales/manual-booking/summary/ManualBookingSummary.tsx +7 -3
- package/src/snippet/snippet-template/preview/Preview.tsx +14 -2
- package/src/static/RestrictedAccess.tsx +1 -1
- package/src/static/form-number-input/FormNumberInput.tsx +8 -1
- package/src/styles/{iframe-customers-journey/ActivitiesCard.scss → activity-card/GridActivitiesCard.scss} +1 -1
- package/src/styles/{iframe-customers-journey/ActivitiesSelectedCard.scss → activity-card/ListActivitiesCard.scss} +2 -1
- package/src/styles/activity-card/_index.scss +2 -0
- package/src/styles/availability-indicator/AvailabilityIndicator.scss +7 -0
- package/src/styles/availability-indicator/_index.scss +1 -0
- package/src/styles/{iframe-customers-journey → date-time-button}/DateTimeButton.scss +6 -12
- package/src/styles/date-time-button/_index.scss +1 -0
- package/src/styles/form/CustomCheckbox.scss +5 -0
- package/src/styles/header/Header.scss +0 -4
- package/src/styles/iframe-events/Card.scss +1 -0
- package/src/styles/iframe-page/PageBody.scss +3 -2
- package/src/styles/notification/Notification.scss +4 -0
- package/src/styles/packages.scss +3 -1
- package/src/styles/resources-blocking/_index.scss +5 -0
- package/src/styles/themes/bookedit/_index.scss +1 -0
- package/src/typings.d.ts +11 -0
- package/src/virtualized/components/VirtualizedWindowScroller.tsx +2 -1
- package/src/zone/form/components/AvailableTimesControl.tsx +4 -9
- package/src/zone/form/components/GameDurationControl.tsx +46 -0
- package/src/zone/form/components/ZoneControl.tsx +2 -0
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +27 -35
- package/src/zone/form/utils/dates.ts +29 -36
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts +0 -12
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts.map +0 -1
- package/dist/iframe/activity-cards/activity-card/ActivityCard.js +0 -1
- package/dist/iframe/activity-cards/index.d.ts +0 -3
- package/dist/iframe/activity-cards/index.d.ts.map +0 -1
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts +0 -12
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts.map +0 -1
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.js +0 -1
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts +0 -7
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/EventCalendar.js +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarButtons/CalendarButtons.d.ts +0 -6
- package/dist/iframe/event/event-calendar/components/CalendarButtons/CalendarButtons.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarButtons/CalendarButtons.js +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarButtons/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts +0 -12
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.js +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/index.d.ts +0 -3
- package/dist/iframe/event/event-calendar/components/CalendarDate/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts +0 -7
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.js +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarSelect/CalendarSelect.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarSelect/CalendarSelect.js +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarSelect/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarWeekdays/CalendarWeekdays.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/components/CalendarWeekdays/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/index.d.ts +0 -4
- package/dist/iframe/event/event-calendar/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/types/index.d.ts +0 -6
- package/dist/iframe/event/event-calendar/types/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/utils/index.d.ts +0 -3
- package/dist/iframe/event/event-calendar/utils/index.d.ts.map +0 -1
- package/dist/iframe/event/event-calendar/utils/index.js +0 -1
- package/dist/styles/iframe-customers-journey/_index.scss +0 -3
- package/src/iframe/activity-cards/activity-card/ActivityCard.tsx +0 -38
- package/src/iframe/activity-cards/index.ts +0 -2
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.stories.tsx +0 -52
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.tsx +0 -49
- package/src/iframe/event/event-calendar/EventCalendar.stories.tsx +0 -36
- package/src/iframe/event/event-calendar/EventCalendar.tsx +0 -27
- package/src/iframe/event/event-calendar/components/CalendarDate/CalendarDate.tsx +0 -51
- package/src/iframe/event/event-calendar/components/CalendarDate/index.ts +0 -2
- package/src/iframe/event/event-calendar/index.ts +0 -6
- package/src/iframe/event/event-calendar/types/index.ts +0 -6
- package/src/iframe/event/event-calendar/utils/index.ts +0 -11
- package/src/styles/iframe-customers-journey/_index.scss +0 -3
- /package/dist/assets/iframe/{dateInfo/available.svg → available.svg} +0 -0
- /package/dist/assets/iframe/{dateInfo/limited.svg → limited.svg} +0 -0
- /package/dist/assets/iframe/{dateInfo/soldOut.svg → soldOut.svg} +0 -0
- /package/dist/{iframe/event/event-calendar → calendar}/components/CalendarButtons/index.d.ts +0 -0
- /package/dist/{iframe/event/event-calendar → calendar}/components/CalendarDates/index.d.ts +0 -0
- /package/dist/{iframe/event/event-calendar → calendar}/components/CalendarSelect/CalendarSelect.d.ts +0 -0
- /package/dist/{iframe/event/event-calendar → calendar}/components/CalendarSelect/index.d.ts +0 -0
- /package/dist/{iframe/event/event-calendar → calendar}/components/CalendarWeekdays/CalendarWeekdays.d.ts +0 -0
- /package/dist/{iframe/event/event-calendar → calendar}/components/CalendarWeekdays/CalendarWeekdays.js +0 -0
- /package/dist/{iframe/event/event-calendar → calendar}/components/CalendarWeekdays/index.d.ts +0 -0
- /package/src/assets/iframe/{dateInfo/available.svg → available.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/limited.svg → limited.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/soldOut.svg → soldOut.svg} +0 -0
- /package/src/{iframe/event/event-calendar → calendar}/components/CalendarButtons/index.ts +0 -0
- /package/src/{iframe/event/event-calendar → calendar}/components/CalendarDates/index.ts +0 -0
- /package/src/{iframe/event/event-calendar → calendar}/components/CalendarSelect/index.ts +0 -0
- /package/src/{iframe/event/event-calendar → calendar}/components/CalendarWeekdays/CalendarWeekdays.tsx +0 -0
- /package/src/{iframe/event/event-calendar → calendar}/components/CalendarWeekdays/index.ts +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { Image } from "@licklist/core/dist/DataMapper/Media/ImageDataMapper";
|
|
4
|
+
|
|
5
|
+
export const LAYOUT_GRID = "grid";
|
|
6
|
+
export const LAYOUT_LIST = "list";
|
|
7
|
+
|
|
8
|
+
type Layout = typeof LAYOUT_GRID | typeof LAYOUT_LIST;
|
|
9
|
+
|
|
10
|
+
export type ActivityCardProps = {
|
|
11
|
+
title: ReactNode;
|
|
12
|
+
duration: ReactNode;
|
|
13
|
+
price: ReactNode;
|
|
14
|
+
image?: Image | null;
|
|
15
|
+
onSelect: () => void;
|
|
16
|
+
isSelected: boolean;
|
|
17
|
+
layout?: Layout;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const ActivityCard = ({
|
|
21
|
+
title,
|
|
22
|
+
duration,
|
|
23
|
+
price,
|
|
24
|
+
image,
|
|
25
|
+
onSelect,
|
|
26
|
+
isSelected,
|
|
27
|
+
layout = LAYOUT_GRID,
|
|
28
|
+
}: ActivityCardProps) => {
|
|
29
|
+
if (layout === LAYOUT_GRID) {
|
|
30
|
+
return (
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
className={clsx("activity-card", isSelected && "active")}
|
|
34
|
+
onClick={onSelect}
|
|
35
|
+
>
|
|
36
|
+
{image && (
|
|
37
|
+
<img className="activity-card-image" alt="" src={image.url} />
|
|
38
|
+
)}
|
|
39
|
+
<div className={clsx("d-flex", "flex-column", !image && "no-image")}>
|
|
40
|
+
<div className="activity-card-title">{title}</div>
|
|
41
|
+
|
|
42
|
+
{duration && <div>{duration}</div>}
|
|
43
|
+
|
|
44
|
+
{price && <div>{price}</div>}
|
|
45
|
+
</div>
|
|
46
|
+
</button>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div role="button" onClick={onSelect} onKeyPress={onSelect} tabIndex={0}>
|
|
52
|
+
<div
|
|
53
|
+
className={clsx("list-activity-card", {
|
|
54
|
+
active: isSelected,
|
|
55
|
+
})}
|
|
56
|
+
>
|
|
57
|
+
<div className="description">
|
|
58
|
+
<div className="title">{title}</div>
|
|
59
|
+
{duration && (
|
|
60
|
+
<div>
|
|
61
|
+
<p>{duration}</p>
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
|
|
65
|
+
{price && <div>{price}</div>}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{image && (
|
|
69
|
+
<div className="image-container">
|
|
70
|
+
<img className="image" src={image.url} alt="" />
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
</div>
|
|
74
|
+
<hr className="list-activity-card-hr" />
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ActivityCard";
|
|
@@ -5,7 +5,7 @@ import { IframeEventVenueMap } from "./IframeEventVenueMap";
|
|
|
5
5
|
import { Page, PageBody, PageHeader } from "../../page";
|
|
6
6
|
import { BookingSummaryFooter } from "../../order-process/components/BookingSummaryFooter";
|
|
7
7
|
import { BookingSummary } from "../../order-process/components/BookingSummary";
|
|
8
|
-
import { CalendarSelect } from "
|
|
8
|
+
import { CalendarSelect } from "../../../calendar/components/CalendarSelect";
|
|
9
9
|
import { Product } from "../../../types";
|
|
10
10
|
|
|
11
11
|
export default {
|
|
@@ -26,7 +26,6 @@ const MENU_STEPS = [
|
|
|
26
26
|
maxSubItems: 1,
|
|
27
27
|
quantityType: "constant",
|
|
28
28
|
type: "menuItems",
|
|
29
|
-
isRelyOnPeople: false,
|
|
30
29
|
collectUserInfo: false,
|
|
31
30
|
isTimeRelated: false,
|
|
32
31
|
hasTicket: false,
|
|
@@ -13,12 +13,6 @@ export {
|
|
|
13
13
|
} from "./event-order-short-summary";
|
|
14
14
|
export { EventDescription } from "./event-description";
|
|
15
15
|
export { EventProductSets, EventProductSetsProps } from "./event-product-sets";
|
|
16
|
-
export {
|
|
17
|
-
EventCalendar,
|
|
18
|
-
CalendarSelect,
|
|
19
|
-
CalendarSelectProps,
|
|
20
|
-
CalendarSelectOption,
|
|
21
|
-
} from "./event-calendar";
|
|
22
16
|
export {
|
|
23
17
|
EventStepVenueMapZones,
|
|
24
18
|
EventStepVenueMapZonesProps,
|
package/src/iframe/index.ts
CHANGED
|
@@ -10,7 +10,6 @@ export {
|
|
|
10
10
|
EventOrderShortSummary,
|
|
11
11
|
SummaryDataType,
|
|
12
12
|
EventDescription,
|
|
13
|
-
EventCalendar,
|
|
14
13
|
EventProductSets,
|
|
15
14
|
EventProductSetsProps,
|
|
16
15
|
IframeEventVenueMap,
|
|
@@ -43,5 +42,5 @@ export {
|
|
|
43
42
|
export { BackButton } from "./back-button";
|
|
44
43
|
export { PoweredBy } from "./powered-by";
|
|
45
44
|
export * from "./page";
|
|
46
|
-
export * from "./activity-
|
|
45
|
+
export * from "./activity-card";
|
|
47
46
|
export { CustomDateField, CustomDateFieldProps } from "./custom-fields";
|
|
@@ -11,9 +11,10 @@ import { BookingSummaryAccordion } from "./components/BookingSummaryAccordion";
|
|
|
11
11
|
|
|
12
12
|
export const BookingSummary = ({
|
|
13
13
|
date,
|
|
14
|
+
time,
|
|
14
15
|
menuSteps,
|
|
15
16
|
formValues,
|
|
16
|
-
|
|
17
|
+
shouldHidePeopleAmount,
|
|
17
18
|
eventName,
|
|
18
19
|
transactionFee = 0,
|
|
19
20
|
productsWithErrors,
|
|
@@ -47,6 +48,7 @@ export const BookingSummary = ({
|
|
|
47
48
|
<div className="event-info">
|
|
48
49
|
<p className="m-0 title event-name">{eventName}</p>
|
|
49
50
|
<p className="m-0">{date}</p>
|
|
51
|
+
{time && <p className="m-0">{time}</p>}
|
|
50
52
|
</div>
|
|
51
53
|
<hr />
|
|
52
54
|
|
|
@@ -63,7 +65,7 @@ export const BookingSummary = ({
|
|
|
63
65
|
/>
|
|
64
66
|
);
|
|
65
67
|
})}
|
|
66
|
-
{!
|
|
68
|
+
{!shouldHidePeopleAmount && peopleAmount > 0 && (
|
|
67
69
|
<>
|
|
68
70
|
<hr />
|
|
69
71
|
<div className="d-flex justify-content-between mt-3">
|
|
@@ -6,12 +6,13 @@ export const ACCORDION_KEY = "booking-summary";
|
|
|
6
6
|
|
|
7
7
|
export type BookingSummaryProps = {
|
|
8
8
|
date: string;
|
|
9
|
+
time?: string;
|
|
9
10
|
menuSteps?: MenuStep[];
|
|
10
11
|
formValues?: {
|
|
11
12
|
[key: string]: Order;
|
|
12
13
|
};
|
|
13
14
|
totalWithDiscount?: number;
|
|
14
|
-
|
|
15
|
+
shouldHidePeopleAmount?: boolean;
|
|
15
16
|
eventName?: string;
|
|
16
17
|
hasPeopleInput?: boolean;
|
|
17
18
|
transactionFee?: number;
|
|
@@ -5,6 +5,8 @@ export const cartSumByOrderProducts = (orderProducts?: Order[]) => {
|
|
|
5
5
|
return 0;
|
|
6
6
|
}
|
|
7
7
|
return orderProducts.reduce((prevSumValue: number, product) => {
|
|
8
|
+
if (!product) return 0;
|
|
9
|
+
|
|
8
10
|
return (
|
|
9
11
|
prevSumValue + (product?.deposit || product?.price) * product.quantity
|
|
10
12
|
);
|
|
@@ -20,15 +20,15 @@ import { Step } from "@licklist/core/dist/DataMapper/Product/StepDataMapper";
|
|
|
20
20
|
import { useTranslation } from "react-i18next";
|
|
21
21
|
import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
22
22
|
import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
23
|
+
import { MenuStep } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
23
24
|
import { Category } from "./components/Category";
|
|
24
|
-
import {
|
|
25
|
-
import { STEP_FORM_ID } from "../../constants";
|
|
25
|
+
import { MIN_SPEND_ERROR, STEP_FORM_ID } from "../../constants";
|
|
26
26
|
import { ErrorModal } from "../ErrorModal/ErrorModal";
|
|
27
27
|
import { PageBody } from "../../../page/components/PageBody";
|
|
28
28
|
import {
|
|
29
29
|
CalendarSelect,
|
|
30
30
|
CalendarSelectOption,
|
|
31
|
-
} from "
|
|
31
|
+
} from "../../../../calendar/components/CalendarSelect";
|
|
32
32
|
import { IframeEventVenueMap } from "../../../event/event-venue-map";
|
|
33
33
|
import { VenueMapRef } from "../../../../events/event-venue-map/components/VenueMap";
|
|
34
34
|
import { useCategoryVerification } from "../utils/useCategoryVerification";
|
|
@@ -117,12 +117,19 @@ export const CalendarStepsForm = forwardRef<
|
|
|
117
117
|
);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
-
const
|
|
120
|
+
const orderError = verifyCategoryItems(
|
|
121
|
+
values,
|
|
122
|
+
step.productCategories,
|
|
123
|
+
isLastMenuStep
|
|
124
|
+
);
|
|
121
125
|
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
if (orderError) {
|
|
127
|
+
const categoryId = orderError.id
|
|
128
|
+
? `category_${orderError.id}`
|
|
129
|
+
: MIN_SPEND_ERROR;
|
|
130
|
+
setStepFormError(orderError.message);
|
|
131
|
+
setError(categoryId as never, {
|
|
132
|
+
message: orderError.message,
|
|
126
133
|
});
|
|
127
134
|
return;
|
|
128
135
|
}
|
|
@@ -363,3 +370,5 @@ export const CalendarStepsForm = forwardRef<
|
|
|
363
370
|
);
|
|
364
371
|
}
|
|
365
372
|
);
|
|
373
|
+
|
|
374
|
+
CalendarStepsForm.displayName = "CalendarStepsForm";
|
|
@@ -84,23 +84,9 @@ export const CategoryProduct = ({
|
|
|
84
84
|
// but didn't click on number input.
|
|
85
85
|
// If it will be required then required check fired firstly.
|
|
86
86
|
|
|
87
|
-
const {
|
|
88
|
-
isRequired = false,
|
|
89
|
-
maxAmount = 0,
|
|
90
|
-
minAmount = 0,
|
|
91
|
-
minSpend,
|
|
92
|
-
price,
|
|
93
|
-
} = product;
|
|
87
|
+
const { isRequired = false, maxAmount = 0, minAmount = 0 } = product;
|
|
94
88
|
|
|
95
89
|
const currentQuantity = value?.quantity ?? 0;
|
|
96
|
-
if (minSpend && currentQuantity * price < minSpend) {
|
|
97
|
-
return t("Design:minimumSpendSumValidation", {
|
|
98
|
-
minSpend: formatNumber(minSpend, {
|
|
99
|
-
style: "currency",
|
|
100
|
-
currency: Config.Currency.GBP,
|
|
101
|
-
}),
|
|
102
|
-
}) as string;
|
|
103
|
-
}
|
|
104
90
|
|
|
105
91
|
if (!value) return true;
|
|
106
92
|
|
|
@@ -10,12 +10,14 @@ import Icon from "../../../../static/Icon";
|
|
|
10
10
|
export interface ErrorModalProps {
|
|
11
11
|
isOpen: boolean;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
+
message?: string;
|
|
13
14
|
messageKey?: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const ErrorModal = ({
|
|
17
18
|
isOpen = false,
|
|
18
19
|
onClose,
|
|
20
|
+
message,
|
|
19
21
|
messageKey,
|
|
20
22
|
}: ErrorModalProps) => {
|
|
21
23
|
const { t } = useTranslation("Design");
|
|
@@ -47,15 +49,16 @@ export const ErrorModal = ({
|
|
|
47
49
|
</ModalHeader>
|
|
48
50
|
<ModalBody className="confirmation-modal-body">
|
|
49
51
|
<div className="d-flex m-5 justify-content-center manual-form-error">
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
{message ||
|
|
53
|
+
(messageKey ? (
|
|
54
|
+
t(messageKey)
|
|
55
|
+
) : (
|
|
56
|
+
<Trans
|
|
57
|
+
t={t}
|
|
58
|
+
i18nKey="pleaseSelectAtLeastFrom"
|
|
59
|
+
values={{ min: 1, type: "item", from: "those categories" }}
|
|
60
|
+
/>
|
|
61
|
+
))}
|
|
59
62
|
</div>
|
|
60
63
|
</ModalBody>
|
|
61
64
|
</Modal>
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
export const fancyTimeFormat = (
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
timerString += `${mins}:${secs < 10 ? "0" : ""}`;
|
|
8
|
-
timerString += `${secs}`;
|
|
9
|
-
return timerString;
|
|
1
|
+
export const fancyTimeFormat = (milliseconds: number) => {
|
|
2
|
+
const totalSeconds = Math.floor(milliseconds / 1000);
|
|
3
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
4
|
+
const seconds = totalSeconds % 60;
|
|
5
|
+
const formattedSecs = seconds < 10 ? `0${seconds}` : `${seconds}`;
|
|
6
|
+
return `${minutes}:${formattedSecs}`;
|
|
10
7
|
};
|
|
@@ -1,53 +1,83 @@
|
|
|
1
|
+
import { ProductCategory } from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
|
|
2
|
+
import { Currency } from "@licklist/core/dist/Config";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
1
4
|
import { useTranslation } from "react-i18next";
|
|
2
|
-
import {
|
|
5
|
+
import { Order } from "src/types";
|
|
3
6
|
|
|
4
7
|
interface CategoryError {
|
|
5
8
|
message: string;
|
|
6
|
-
id
|
|
9
|
+
id?: number;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
// TODO it's temporary solution, please remove it later
|
|
10
13
|
export const useCategoryVerification = () => {
|
|
11
14
|
const { t } = useTranslation("Validation");
|
|
12
|
-
|
|
15
|
+
const { formatNumber } = useIntl();
|
|
13
16
|
return (
|
|
14
17
|
values: Record<Order["id"], Order>,
|
|
15
|
-
|
|
18
|
+
productCategories?: ProductCategory[],
|
|
19
|
+
isLastPage?: boolean
|
|
16
20
|
): CategoryError | void => {
|
|
17
|
-
let errorMessage;
|
|
18
|
-
|
|
21
|
+
let errorMessage: { id?: number; message: string } | void;
|
|
19
22
|
const productArray = Object.values(values).filter(
|
|
20
23
|
(product) => product?.quantity > 0
|
|
21
24
|
);
|
|
25
|
+
const sumOfMinSpends = productCategories.reduce((acc, productCategory) => {
|
|
26
|
+
const { products } = productCategory;
|
|
27
|
+
const selectedProducts = products.filter((product) =>
|
|
28
|
+
productArray.map((el) => el.id).includes(product?.id)
|
|
29
|
+
);
|
|
30
|
+
const productMinSpendsSum = selectedProducts.reduce((sum, product) => {
|
|
31
|
+
const quantity =
|
|
32
|
+
productArray.find((selected) => selected.id === product.id)
|
|
33
|
+
?.quantity || 1;
|
|
34
|
+
return sum + product.minSpend * quantity;
|
|
35
|
+
}, 0);
|
|
22
36
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
).length;
|
|
30
|
-
|
|
31
|
-
if (minSubItems && categoryProductsQuantity < minSubItems) {
|
|
32
|
-
const message = t("Validation:fieldMinNumber", {
|
|
33
|
-
min: minSubItems,
|
|
34
|
-
attribute: `number of products in the ${name} category`,
|
|
35
|
-
});
|
|
36
|
-
errorMessage = { id, message };
|
|
37
|
-
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (maxSubItems && categoryProductsQuantity > maxSubItems) {
|
|
42
|
-
const message = t("Validation:fieldMaxNumber", {
|
|
43
|
-
max: maxSubItems,
|
|
44
|
-
attribute: `number of products in the ${name} category`,
|
|
45
|
-
});
|
|
46
|
-
errorMessage = { id, message };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
37
|
+
return acc + productMinSpendsSum;
|
|
38
|
+
}, 0);
|
|
39
|
+
|
|
40
|
+
const totalPrice = productArray.reduce(
|
|
41
|
+
(total, product) => total + product.price * product.quantity,
|
|
42
|
+
0
|
|
49
43
|
);
|
|
50
44
|
|
|
45
|
+
productCategories.forEach(({ minSubItems, maxSubItems, id, name }) => {
|
|
46
|
+
if (!minSubItems && !maxSubItems) return;
|
|
47
|
+
|
|
48
|
+
const categoryProductsQuantity = productArray.filter(
|
|
49
|
+
(product) => product?.productsCategoryId === id
|
|
50
|
+
).length;
|
|
51
|
+
|
|
52
|
+
if (minSubItems && categoryProductsQuantity < minSubItems) {
|
|
53
|
+
const message = t("Validation:fieldMinNumber", {
|
|
54
|
+
min: minSubItems,
|
|
55
|
+
attribute: `number of products in the ${name} category`,
|
|
56
|
+
});
|
|
57
|
+
errorMessage = { id, message };
|
|
58
|
+
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (maxSubItems && categoryProductsQuantity > maxSubItems) {
|
|
63
|
+
const message = t("Validation:fieldMaxNumber", {
|
|
64
|
+
max: maxSubItems,
|
|
65
|
+
attribute: `number of products in the ${name} category`,
|
|
66
|
+
});
|
|
67
|
+
errorMessage = { id, message };
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (totalPrice < sumOfMinSpends && !errorMessage && isLastPage) {
|
|
72
|
+
const message = t("Design:minimumSpendSumValidation", {
|
|
73
|
+
minSpend: formatNumber(sumOfMinSpends, {
|
|
74
|
+
style: "currency",
|
|
75
|
+
currency: Currency.GBP,
|
|
76
|
+
}),
|
|
77
|
+
}) as string;
|
|
78
|
+
errorMessage = { message };
|
|
79
|
+
}
|
|
80
|
+
|
|
51
81
|
return errorMessage;
|
|
52
82
|
};
|
|
53
83
|
};
|
|
@@ -6,7 +6,7 @@ import { Page } from "./Page";
|
|
|
6
6
|
import { PageHeader } from "./components/PageHeader";
|
|
7
7
|
import { PageBody } from "./components/PageBody";
|
|
8
8
|
import { IframeEventCard } from "../event/event-card/IframeEventCard";
|
|
9
|
-
import { CalendarSelect } from "
|
|
9
|
+
import { CalendarSelect } from "../../calendar/components/CalendarSelect";
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
title: "Iframe/Page/Page",
|
|
@@ -219,7 +219,7 @@ export function Default() {
|
|
|
219
219
|
<>
|
|
220
220
|
<CalendarSelect
|
|
221
221
|
options={[{ label: "Floor 1", value: "1" }]}
|
|
222
|
-
value=
|
|
222
|
+
value="1"
|
|
223
223
|
onChange={(chagedId: string) => console.log({ chagedId })}
|
|
224
224
|
/>
|
|
225
225
|
</>
|
|
@@ -26,7 +26,12 @@ export const LeftBlock = ({
|
|
|
26
26
|
<div className={clsx("left-block", className)} {...props}>
|
|
27
27
|
{pageTitle && (
|
|
28
28
|
<div className="navigation">
|
|
29
|
-
|
|
29
|
+
{typeof pageTitle === "string" ? (
|
|
30
|
+
<div className="title">{pageTitle}</div>
|
|
31
|
+
) : (
|
|
32
|
+
pageTitle
|
|
33
|
+
)}
|
|
34
|
+
|
|
30
35
|
{component}
|
|
31
36
|
</div>
|
|
32
37
|
)}
|
|
@@ -9,15 +9,9 @@ import {
|
|
|
9
9
|
PAYMENT_TYPE_NET_PROFIT,
|
|
10
10
|
} from "@licklist/core/dist/DataMapper/Order/PaymentDataMapper";
|
|
11
11
|
import { StaticTableData } from "../../../../table";
|
|
12
|
-
import {
|
|
13
|
-
getProductQuantityAndPrice,
|
|
14
|
-
calculateTotalDiscount,
|
|
15
|
-
calculateTotalPrice,
|
|
16
|
-
getPaymentValueByType,
|
|
17
|
-
getExternalPaymentDetail,
|
|
18
|
-
getTotalSumByCategory,
|
|
19
|
-
} from "../utils";
|
|
12
|
+
import { getProductQuantityAndPrice, getTotalSumByCategory } from "../utils";
|
|
20
13
|
import { OrderItemsTableProps, SummaryItem } from "../types";
|
|
14
|
+
import { getOrderSummaryItems } from "../utils/paymentSummary";
|
|
21
15
|
|
|
22
16
|
const CURRENCY_DEFAULT = "GBP";
|
|
23
17
|
export const PAYMENT_TYPE_TRANSLATE_KEYS = {
|
|
@@ -114,9 +108,7 @@ export const useTableData = ({
|
|
|
114
108
|
);
|
|
115
109
|
};
|
|
116
110
|
|
|
117
|
-
const renderSummaryItems = (
|
|
118
|
-
summaryItems: { translateKey: string; price: number }[]
|
|
119
|
-
) => {
|
|
111
|
+
const renderSummaryItems = (summaryItems: SummaryItem[]) => {
|
|
120
112
|
return summaryItems.map(({ translateKey, price }) => {
|
|
121
113
|
return {
|
|
122
114
|
key: uniqueId(`summary-info-${translateKey}`),
|
|
@@ -127,93 +119,6 @@ export const useTableData = ({
|
|
|
127
119
|
});
|
|
128
120
|
};
|
|
129
121
|
|
|
130
|
-
const paymentNotProcessedSummary = () => {
|
|
131
|
-
const externalPaymentDetail = paymentDetail
|
|
132
|
-
? getExternalPaymentDetail(paymentDetail)
|
|
133
|
-
: undefined;
|
|
134
|
-
|
|
135
|
-
const total = calculateTotalPrice(order, externalPaymentDetail);
|
|
136
|
-
|
|
137
|
-
const summaryItems: SummaryItem[] = [
|
|
138
|
-
{
|
|
139
|
-
translateKey: "amountTotal",
|
|
140
|
-
price: total,
|
|
141
|
-
},
|
|
142
|
-
];
|
|
143
|
-
|
|
144
|
-
if (externalDiscount) {
|
|
145
|
-
summaryItems.push({
|
|
146
|
-
price: externalDiscount,
|
|
147
|
-
translateKey: "amountWithDiscount",
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (externalPaymentDetail) {
|
|
152
|
-
return [...summaryItems, ...getExternalPaymentDetail(paymentDetail)];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return summaryItems;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const processedPaymentSummary = () => {
|
|
159
|
-
const externalPaymentDetail =
|
|
160
|
-
paymentDetail && !order.payments.length
|
|
161
|
-
? getExternalPaymentDetail(paymentDetail)
|
|
162
|
-
: Object.keys(PAYMENT_TYPE_TRANSLATE_KEYS).map((key) => {
|
|
163
|
-
return {
|
|
164
|
-
translateKey: PAYMENT_TYPE_TRANSLATE_KEYS[key],
|
|
165
|
-
price: getPaymentValueByType(order.payments, key),
|
|
166
|
-
};
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
const total = calculateTotalPrice(order, externalPaymentDetail);
|
|
170
|
-
|
|
171
|
-
const totalDiscount = calculateTotalDiscount(order.payments);
|
|
172
|
-
const totalWithDiscount = total - Number(totalDiscount);
|
|
173
|
-
let summaryItems: SummaryItem[] = [
|
|
174
|
-
{
|
|
175
|
-
translateKey: "amountTotal",
|
|
176
|
-
price: total,
|
|
177
|
-
},
|
|
178
|
-
];
|
|
179
|
-
|
|
180
|
-
if (totalDiscount) {
|
|
181
|
-
summaryItems.push({
|
|
182
|
-
translateKey: "amountWithDiscount",
|
|
183
|
-
price: totalWithDiscount < 0 ? 0 : totalWithDiscount,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (paymentDetail && !order.payments.length) {
|
|
188
|
-
return [...summaryItems, ...externalPaymentDetail];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
summaryItems.push({
|
|
192
|
-
translateKey: "totalPaid",
|
|
193
|
-
price: totalWithDiscount <= 0 ? 0 : order.totalAmount,
|
|
194
|
-
});
|
|
195
|
-
if (totalWithDiscount <= 0) {
|
|
196
|
-
return summaryItems;
|
|
197
|
-
}
|
|
198
|
-
summaryItems = [...summaryItems, ...externalPaymentDetail];
|
|
199
|
-
|
|
200
|
-
if (totalWithDiscount > order.totalAmount) {
|
|
201
|
-
summaryItems.push({
|
|
202
|
-
translateKey: "remainingToPay",
|
|
203
|
-
price: totalWithDiscount - order.totalAmount,
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
return summaryItems;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const getOrderSummaryItems = () => {
|
|
210
|
-
if (!isPaymentProcessed) {
|
|
211
|
-
return paymentNotProcessedSummary();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return processedPaymentSummary();
|
|
215
|
-
};
|
|
216
|
-
|
|
217
122
|
const data = useMemo(
|
|
218
123
|
() => {
|
|
219
124
|
if (!order) {
|
|
@@ -222,7 +127,14 @@ export const useTableData = ({
|
|
|
222
127
|
|
|
223
128
|
return [
|
|
224
129
|
...renderProductsContent(),
|
|
225
|
-
...renderSummaryItems(
|
|
130
|
+
...renderSummaryItems(
|
|
131
|
+
getOrderSummaryItems({
|
|
132
|
+
order,
|
|
133
|
+
paymentDetail,
|
|
134
|
+
isPaymentProcessed,
|
|
135
|
+
externalDiscount,
|
|
136
|
+
})
|
|
137
|
+
),
|
|
226
138
|
];
|
|
227
139
|
},
|
|
228
140
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { Order } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
|
|
2
2
|
import { PaymentDetail } from "@licklist/core/dist/DataMapper/Order/PaymentDetailDataMapper";
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export const AMOUNT_TOTAL = "amountTotal";
|
|
5
|
+
export const AMOUNT_WITH_DISCOUNT = "amountWithDiscount";
|
|
6
|
+
export const TOTAL_PAID = "totalPaid";
|
|
7
|
+
export const REMAINING_TO_PAY = "remainingToPay";
|
|
8
|
+
|
|
9
|
+
export const SUMMARY_TRANSLATE_KEYS = [
|
|
10
|
+
AMOUNT_TOTAL,
|
|
11
|
+
AMOUNT_WITH_DISCOUNT,
|
|
12
|
+
TOTAL_PAID,
|
|
13
|
+
REMAINING_TO_PAY,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export type SUMMARY_TRANSLATE_KEY = typeof SUMMARY_TRANSLATE_KEYS[number];
|
|
17
|
+
|
|
18
|
+
export type SummaryItem = {
|
|
19
|
+
translateKey: SUMMARY_TRANSLATE_KEY;
|
|
20
|
+
price: number;
|
|
21
|
+
};
|
|
5
22
|
|
|
6
23
|
export type OrderItemsTableProps = {
|
|
7
24
|
order?: Order;
|