@bikdotai/bik-component-library 0.0.685-beta.0 → 0.0.685-beta.10
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/cjs/_virtual/bik-store.js +1 -0
- package/dist/cjs/assets/icons/bik_livechat.svg.js +1 -0
- package/dist/cjs/assets/icons/email-channel.svg.js +1 -1
- package/dist/cjs/assets/icons/facebook_channel.svg.js +1 -1
- package/dist/cjs/assets/icons/instagram-channel.svg.js +1 -1
- package/dist/cjs/assets/icons/task.svg.js +1 -0
- package/dist/cjs/assets/icons/whatsapp_color.svg.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
- package/dist/cjs/components/QueryBuilder/redux/queryBuilder.reducer.js +1 -1
- package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
- package/dist/cjs/components/accordion/Accordion.d.ts +8 -0
- package/dist/cjs/components/accordion/Accordion.js +1 -1
- package/dist/cjs/components/accordion/Accordion.style.d.ts +1 -0
- package/dist/cjs/components/accordion/Accordion.style.js +8 -1
- package/dist/cjs/components/alerts/Alert.d.ts +3 -0
- package/dist/cjs/components/alerts/Alert.js +1 -1
- package/dist/cjs/components/alerts/Alert.styled.d.ts +2 -0
- package/dist/cjs/components/alerts/Alert.styled.js +10 -2
- package/dist/cjs/components/alerts/AlertHelper.d.ts +2 -1
- package/dist/cjs/components/alerts/AlertHelper.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +13 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +2 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +6 -2
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/cjs/components/avatar/Avatar.d.ts +4 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/avatar/Avatar.styled.js +4 -4
- package/dist/cjs/components/avatar/AvatarHelper.d.ts +2 -1
- package/dist/cjs/components/avatar/AvatarHelper.js +1 -1
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.d.ts +2 -4
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.js +1 -1
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.js +1 -1
- package/dist/cjs/components/carousel-secondary/model.d.ts +4 -0
- package/dist/cjs/components/carousel-secondary/model.js +1 -0
- package/dist/cjs/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/code-block/CodeBlock.d.ts +2 -0
- package/dist/cjs/components/code-block/CodeBlock.js +1 -0
- package/dist/cjs/components/code-block/CodeBlock.styled.d.ts +31 -0
- package/dist/cjs/components/code-block/CodeBlock.styled.js +110 -0
- package/dist/cjs/components/code-block/CodeBlockHelper.d.ts +1 -0
- package/dist/cjs/components/code-block/CodeBlockHelper.js +1 -0
- package/dist/cjs/components/code-block/index.d.ts +2 -0
- package/dist/cjs/components/code-block/languageSpecificFormatting/html.d.ts +1 -0
- package/dist/cjs/components/code-block/types.d.ts +18 -0
- package/dist/cjs/components/code-block/types.js +1 -0
- package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +6 -0
- package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +5 -0
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +18 -5
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.d.ts +1 -0
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +50 -4
- package/dist/cjs/components/data-source-panel/IntentConfig.d.ts +5 -0
- package/dist/cjs/components/data-source-panel/IntentConfig.js +1 -0
- package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.d.ts +8 -0
- package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.js +48 -0
- package/dist/cjs/components/data-source-panel/model.d.ts +14 -7
- package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +1 -4
- package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.styled.js +2 -2
- package/dist/cjs/components/datePicker/model.d.ts +4 -0
- package/dist/cjs/components/datePicker/model.js +1 -0
- package/dist/cjs/components/discount-modal/DiscountModal.d.ts +2 -0
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -2
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/dropdown/ChipDropdown.d.ts +1 -1
- package/dist/cjs/components/dropdown/ChipDropdown.js +3 -3
- package/dist/cjs/components/dropdown/ChipInput.d.ts +2 -0
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/Common.styled.d.ts +3 -1
- package/dist/cjs/components/dropdown/Common.styled.js +4 -4
- package/dist/cjs/components/dropdown/Dropdown.d.ts +1 -0
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +5 -5
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +4 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +1 -0
- package/dist/cjs/components/input/Input.d.ts +3 -0
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.styled.d.ts +1 -0
- package/dist/cjs/components/input/Input.styled.js +1 -1
- package/dist/cjs/components/modals/Modal.d.ts +2 -0
- package/dist/cjs/components/modals/Modal.js +1 -1
- package/dist/cjs/components/modals/modal.styled.d.ts +6 -0
- package/dist/cjs/components/modals/modal.styled.js +1 -1
- package/dist/cjs/components/modals/styledModal.d.ts +2 -0
- package/dist/cjs/components/modals/styledModal.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/cjs/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlan.d.ts +1 -0
- package/dist/cjs/components/plans/SubscriptionPlan.js +1 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +9 -13
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/product.js +1 -1
- package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +7 -7
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +5 -3
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.d.ts +11 -0
- package/dist/cjs/components/product-picker-v2/style.js +53 -18
- package/dist/cjs/components/product-picker-v2/type.d.ts +7 -0
- package/dist/cjs/components/product-picker-v2/type.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/utility.js +1 -1
- package/dist/cjs/components/product-picker-v2/variant.js +1 -1
- package/dist/cjs/components/progress-bar-v2/ProgressBarV2.d.ts +1 -0
- package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js +1 -1
- package/dist/cjs/components/states-modal/StateModalComponent.d.ts +1 -0
- package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
- package/dist/cjs/components/tag/Tag.d.ts +1 -1
- package/dist/cjs/components/tag/Tag.js +1 -1
- package/dist/cjs/components/tag/Tag.stories.d.ts +22 -0
- package/dist/cjs/components/tag/model.d.ts +12 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +2 -0
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +3 -0
- package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +5 -5
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
- package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +4 -4
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +7 -5
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.d.ts +0 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/cjs/components/variable-picker-v3/highlightSearchText.d.ts +1 -0
- package/dist/cjs/components/variable-picker-v3/highlightSearchText.js +1 -0
- package/dist/cjs/components/zeroState/ZeroState.d.ts +1 -0
- package/dist/cjs/components/zeroState/ZeroState.js +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +1 -0
- package/dist/esm/_virtual/bik-store.js +1 -0
- package/dist/esm/assets/icons/bik_livechat.svg.js +1 -0
- package/dist/esm/assets/icons/email-channel.svg.js +1 -1
- package/dist/esm/assets/icons/facebook_channel.svg.js +1 -1
- package/dist/esm/assets/icons/instagram-channel.svg.js +1 -1
- package/dist/esm/assets/icons/task.svg.js +1 -0
- package/dist/esm/assets/icons/whatsapp_color.svg.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
- package/dist/esm/components/QueryBuilder/redux/queryBuilder.reducer.js +1 -1
- package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/esm/components/TablePagination/TablePagination.js +1 -1
- package/dist/esm/components/accordion/Accordion.d.ts +8 -0
- package/dist/esm/components/accordion/Accordion.js +1 -1
- package/dist/esm/components/accordion/Accordion.style.d.ts +1 -0
- package/dist/esm/components/accordion/Accordion.style.js +23 -16
- package/dist/esm/components/alerts/Alert.d.ts +3 -0
- package/dist/esm/components/alerts/Alert.js +1 -1
- package/dist/esm/components/alerts/Alert.styled.d.ts +2 -0
- package/dist/esm/components/alerts/Alert.styled.js +13 -5
- package/dist/esm/components/alerts/AlertHelper.d.ts +2 -1
- package/dist/esm/components/alerts/AlertHelper.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +13 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +2 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +5 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/esm/components/avatar/Avatar.d.ts +4 -1
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/avatar/Avatar.styled.js +2 -2
- package/dist/esm/components/avatar/AvatarHelper.d.ts +2 -1
- package/dist/esm/components/avatar/AvatarHelper.js +1 -1
- package/dist/esm/components/carousel-secondary/CarouselSecondary.d.ts +2 -4
- package/dist/esm/components/carousel-secondary/CarouselSecondary.js +1 -1
- package/dist/esm/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
- package/dist/esm/components/carousel-secondary/CarouselSecondary.style.js +1 -1
- package/dist/esm/components/carousel-secondary/model.d.ts +4 -0
- package/dist/esm/components/carousel-secondary/model.js +1 -0
- package/dist/esm/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/code-block/CodeBlock.d.ts +2 -0
- package/dist/esm/components/code-block/CodeBlock.js +1 -0
- package/dist/esm/components/code-block/CodeBlock.styled.d.ts +31 -0
- package/dist/esm/components/code-block/CodeBlock.styled.js +110 -0
- package/dist/esm/components/code-block/CodeBlockHelper.d.ts +1 -0
- package/dist/esm/components/code-block/CodeBlockHelper.js +1 -0
- package/dist/esm/components/code-block/index.d.ts +2 -0
- package/dist/esm/components/code-block/languageSpecificFormatting/html.d.ts +1 -0
- package/dist/esm/components/code-block/types.d.ts +18 -0
- package/dist/esm/components/code-block/types.js +1 -0
- package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +6 -0
- package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +5 -0
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +18 -5
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +1 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +49 -3
- package/dist/esm/components/data-source-panel/IntentConfig.d.ts +5 -0
- package/dist/esm/components/data-source-panel/IntentConfig.js +1 -0
- package/dist/esm/components/data-source-panel/Modals/DescriptionModal.d.ts +8 -0
- package/dist/esm/components/data-source-panel/Modals/DescriptionModal.js +48 -0
- package/dist/esm/components/data-source-panel/model.d.ts +14 -7
- package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +1 -4
- package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.styled.js +11 -11
- package/dist/esm/components/datePicker/model.d.ts +4 -0
- package/dist/esm/components/datePicker/model.js +1 -0
- package/dist/esm/components/discount-modal/DiscountModal.d.ts +2 -0
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -2
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/dropdown/ChipDropdown.d.ts +1 -1
- package/dist/esm/components/dropdown/ChipDropdown.js +3 -3
- package/dist/esm/components/dropdown/ChipInput.d.ts +2 -0
- package/dist/esm/components/dropdown/ChipInput.js +1 -1
- package/dist/esm/components/dropdown/Common.styled.d.ts +3 -1
- package/dist/esm/components/dropdown/Common.styled.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +1 -0
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.js +5 -5
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +4 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +1 -0
- package/dist/esm/components/input/Input.d.ts +3 -0
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.styled.d.ts +1 -0
- package/dist/esm/components/input/Input.styled.js +1 -1
- package/dist/esm/components/modals/Modal.d.ts +2 -0
- package/dist/esm/components/modals/Modal.js +1 -1
- package/dist/esm/components/modals/modal.styled.d.ts +6 -0
- package/dist/esm/components/modals/modal.styled.js +1 -1
- package/dist/esm/components/modals/styledModal.d.ts +2 -0
- package/dist/esm/components/modals/styledModal.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/esm/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlan.d.ts +1 -0
- package/dist/esm/components/plans/SubscriptionPlan.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +9 -13
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/product.js +1 -1
- package/dist/esm/components/product-picker-v2/productInfoOverlay.js +7 -7
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +5 -3
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/style.d.ts +11 -0
- package/dist/esm/components/product-picker-v2/style.js +51 -16
- package/dist/esm/components/product-picker-v2/type.d.ts +7 -0
- package/dist/esm/components/product-picker-v2/type.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/utility.js +1 -1
- package/dist/esm/components/product-picker-v2/variant.js +1 -1
- package/dist/esm/components/progress-bar-v2/ProgressBarV2.d.ts +1 -0
- package/dist/esm/components/progress-bar-v2/ProgressBarV2.js +1 -1
- package/dist/esm/components/states-modal/StateModalComponent.d.ts +1 -0
- package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
- package/dist/esm/components/tag/Tag.d.ts +1 -1
- package/dist/esm/components/tag/Tag.js +1 -1
- package/dist/esm/components/tag/Tag.stories.d.ts +22 -0
- package/dist/esm/components/tag/model.d.ts +12 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +2 -0
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +3 -0
- package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
- package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
- package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +4 -4
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +7 -5
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +1 -1
- package/dist/esm/components/variable-picker-v3/Content.d.ts +0 -1
- package/dist/esm/components/variable-picker-v3/Content.js +1 -1
- package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/esm/components/variable-picker-v3/highlightSearchText.d.ts +1 -0
- package/dist/esm/components/variable-picker-v3/highlightSearchText.js +1 -0
- package/dist/esm/components/zeroState/ZeroState.d.ts +1 -0
- package/dist/esm/components/zeroState/ZeroState.js +5 -5
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +1 -0
- package/package.json +1 -1
- package/dist/cjs/assets/icons/CheckSquareOffset.svg.js +0 -1
- package/dist/esm/assets/icons/CheckSquareOffset.svg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,Fragment as e,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as
|
|
1
|
+
import{jsxs as t,Fragment as e,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as n}from"react";import a from"react-calendar";import{useOutside as i}from"../../hooks/useOutside.js";import l from"../../utils/DateUtils.js";import{COLORS as s}from"../../constants/Theme.js";import c from"../../assets/icons/calendar.svg.js";import{BodyPrimary as d,BodySecondary as m}from"../TypographyStyle.js";import{DateBtn as u,PickerContainer as g}from"./DatePickerWrapper.styled.js";import{DateButtonType as p}from"./model.js";const D=D=>{let{val:y,onChange:v,calendarProps:b,disabled:f,pickerStyles:h,nativeID:j,maxDate:S,minDate:w,dateButtonType:L,dateButtonStyles:C}=D;const[k,A]=o(!1),O=n(null),x=n(null);i(x,(()=>{A(!1)}));const T=()=>{var t,e,r,o;return y?Array.isArray(y)?(null===(t=null==y?void 0:y[0])||void 0===t?void 0:t.toString())&&(null===(e=null==y?void 0:y[1])||void 0===e?void 0:e.toString())?`${new Date(null===(r=null==y?void 0:y[0])||void 0===r?void 0:r.toString()).toLocaleDateString()}-${new Date(null===(o=null==y?void 0:y[1])||void 0===o?void 0:o.toString()).toLocaleDateString()}`:`${l.getPastDate(new Date,30).toLocaleDateString()}-${(new Date).toLocaleDateString()}`:new Date(y.toString()).toLocaleDateString():(new Date).toLocaleDateString()};return t(e,{children:[t(u,Object.assign({id:j,ref:O,bgColor:f?s.background.base:s.surface.standard,borderColor:s.stroke.primary,onClick:()=>A(!k),dateButtonType:L||p.DEFAULT,style:C},{children:[L===p.LARGE?r(d,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:T()})):r(m,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:T()})),r(c,{width:L===p.LARGE?24:20,height:L===p.LARGE?24:20,color:f?s.content.inactive:s.content.primary})]})),k&&!f&&r(g,Object.assign({ref:x,style:Object.assign({},h),contentPrimary:s.content.primary,subDued:s.surface.subdued,brandColor:s.background.brand,bgColor:s.surface.standard,borderColor:s.stroke.primary},{children:r(a,Object.assign({tileClassName:["custom__tile"],className:["custom__calendar"],onChange:t=>{v(t),A(!1)},maxDate:S,minDate:w,value:y?Array.isArray(y)?2===y.length?[new Date(y[0]),new Date(y[1])]:null:new Date(y):null},b))}))]})};export{D as DatePickerWrapper};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"styled-components";import{DateButtonType as r}from"./model.js";const e=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
padding: 5px 8px;
|
|
4
|
-
background: ${
|
|
4
|
+
background: ${o=>o.bgColor};
|
|
5
5
|
border-width: 1px;
|
|
6
6
|
border-style: solid;
|
|
7
|
-
border-color: ${
|
|
7
|
+
border-color: ${o=>o.borderColor};
|
|
8
8
|
border-radius: 4px;
|
|
9
9
|
flex-direction: row;
|
|
10
10
|
align-items: center;
|
|
11
11
|
gap: 8px;
|
|
12
12
|
position: relative;
|
|
13
|
-
height: ${
|
|
14
|
-
`,
|
|
13
|
+
height: ${o=>o.dateButtonType===r.LARGE?"48px":"32px"};
|
|
14
|
+
`,t=o.div`
|
|
15
15
|
position: absolute;
|
|
16
16
|
top: calc(100% + 8px);
|
|
17
17
|
zindex: 9;
|
|
18
18
|
.custom__calendar {
|
|
19
|
-
background: ${
|
|
19
|
+
background: ${o=>o.bgColor};
|
|
20
20
|
border-width: 1px;
|
|
21
21
|
border-style: solid;
|
|
22
|
-
border-color: ${
|
|
22
|
+
border-color: ${o=>o.borderColor};
|
|
23
23
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.12);
|
|
24
24
|
border-radius: 4px;
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
|
|
|
27
27
|
.custom__tile:hover,
|
|
28
28
|
.custom__tile:focus,
|
|
29
29
|
.react-calendar__tile--active {
|
|
30
|
-
background: ${
|
|
30
|
+
background: ${o=>o.brandColor};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.react-calendar__month-view__weekdays__weekday {
|
|
@@ -37,7 +37,7 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
|
|
|
37
37
|
font-weight: 600;
|
|
38
38
|
font-size: 14px;
|
|
39
39
|
line-height: 20px;
|
|
40
|
-
color: ${
|
|
40
|
+
color: ${o=>o.contentPrimary};
|
|
41
41
|
|
|
42
42
|
abbr[title] {
|
|
43
43
|
text-decoration: none !important;
|
|
@@ -45,7 +45,7 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.react-calendar__month-view__weekdays {
|
|
48
|
-
background: ${
|
|
48
|
+
background: ${o=>o.subDued};
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.react-calendar__navigation {
|
|
@@ -66,4 +66,4 @@ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWra
|
|
|
66
66
|
font-size: 20px;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
`;export{e as DateBtn,
|
|
69
|
+
`;export{e as DateBtn,t as PickerContainer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a;!function(a){a.DEFAULT="default",a.LARGE="large"}(a||(a={}));export{a as DateButtonType};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { ICouponData } from "./type";
|
|
3
4
|
import { Collection, Product } from "../product-picker/type";
|
|
@@ -27,6 +28,7 @@ export interface DiscountDialogueI {
|
|
|
27
28
|
fetchCollections: any;
|
|
28
29
|
fetchProducts: any;
|
|
29
30
|
storeId: string;
|
|
31
|
+
appType?: ApplicationType;
|
|
30
32
|
};
|
|
31
33
|
errorMsg?: string;
|
|
32
34
|
loading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{useState as o,useEffect as n}from"react";import{DISCOUNT_TYPES as l,MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_APPLIES_TO as d,OFFER_APPLIES_TO as a,initialStaticCouponErrorState as c,initialDynamicCouponErrorState as s,COUPON_EXPIRATION as u,DISCOUNT_TARGET_TYPES as p,DISCOUNT_TARGET_SELECTION as v,DISCOUNT_VALUE_TYPES as C}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as b}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as m,BodyCaption as y,TitleRegular as P}from"../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as I}from"../modals/styledModal.js";import{ProductPickerContent as f}from"../product-picker/ProductPickerModal.js";import{Tag as E}from"../tag/Tag.js";import{Tooltip as O}from"../tooltips/Tooltip.js";import T from"../../assets/icons/gift_icon.svg.js";import S from"../../assets/icons/percentage_icon.svg.js";import g from"../../assets/icons/shipping_icon.svg.js";import V from"../../assets/icons/triangle_error.svg.js";import _ from"../../assets/icons/warning.svg.js";import{ProductPickerModal as A}from"../product-picker-v2/modal.js";import{PickerType as D}from"../variable-picker-v3/model.js";import{VariablePicker as j}from"../variable-picker-v3/VariablePicker.js";import{StyledDiscountDialogueContainer as N,CouponTypeContainerStyled as k,VariablePickerContainer as x}from"./DiscountModal.styled.js";import{validateDiscountData as F,descriptionBuilder as w}from"./DiscountUtils.js";import R,{DISCOUNT_PRODUCTS as M}from"./DynamicCoupon/DynamicCoupon.js";import q from"./StaticCoupon/StaticCoupon.js";const L=L=>{var U,B,G,Y,X,Q,H,z,$,K,Z;const J=[{id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i,lineHeight:.9}},{children:L.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(S,{width:24,height:24,color:i})},{id:"2",label:"Buy X get Y",value:l.BUY_X_GET_Y,icon:i=>e(T,{width:24,height:24,color:i})},{id:"3",label:"Free Shipping",value:l.FREE_SHIPPING,icon:i=>e(g,{width:24,height:24,color:i})}],[W,ee]=o(),[ie,te]=o(),[oe,ne]=o(),[le,re]=o(null!==(U=L.data)&&void 0!==U?U:"string"==typeof L.hideOption?{isStaticCoupon:"dynamic"===L.hideOption}:{isStaticCoupon:!0}),[de,ae]=o(!0),[ce,se]=o(),[ue,pe]=o((null===(B=L.data)||void 0===B?void 0:B.minAmount)?r.AMOUNT:(null===(G=L.data)||void 0===G?void 0:G.minQuantity)?r.QUANTITY:r.NA),[ve,Ce]=o(d.ENTIRE_ORDER),[be,me]=o(a.SPECIFIC_PRODUCTS),[ye,Pe]=o(a.SPECIFIC_PRODUCTS),[he,Ie]=o(void 0),[fe,Ee]=o(void 0),[Oe,Te]=o(void 0),[Se,ge]=o(void 0),[Ve,_e]=o(void 0),[Ae,De]=o(void 0),[je,Ne]=o(0),[ke,xe]=o(""),[Fe,we]=o(J[0]),[Re,Me]=o(!1),[qe,Le]=o(c),[Ue,Be]=o(s),[Ge,Ye]=o(u.DYNAMIC_EXPIRATION),Xe=[{value:l.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:ce===l.AMOUNT_OFF_ORDER},{value:l.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:ce===l.AMOUNT_OFF_PRODUCTS},{value:l.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:ce===l.BUY_X_GET_Y},{value:l.FREE_SHIPPING,label:"Free shipping",selected:ce===l.FREE_SHIPPING}];n((()=>{L.makeExpiryMandatory&&Me(!0)}),[L.makeExpiryMandatory]),n((()=>{var e,i,t,o,n,r,c,s;let p;const{tempCouponData:v,discountType:b}=Qe();se(b);const m=(e,i)=>{we(v.valueType===C.FIXED_AMOUNT?J[e]:J[i])},y=(e,i)=>{Object.keys(e||{}).length&&i(e)};switch(((null==v?void 0:v.expireAfter)||(null==v?void 0:v.expireAt))&&(Me(!0),(null==v?void 0:v.expireAt)&&Ye(u.FIXED_EXPIRATION),(null==v?void 0:v.expireAfter)&&Ye(u.DYNAMIC_EXPIRATION)),b){case l.AMOUNT_OFF_ORDER:m(0,1),Ce(d.ENTIRE_ORDER);break;case l.AMOUNT_OFF_PRODUCTS:m(0,1),(null===(e=v.entitledCollectionIds)||void 0===e?void 0:e.length)?Ce(d.SPECIFIC_COLLECTIONS):(null===(i=v.entitledProductIds)||void 0===i?void 0:i.length)||(null===(t=v.productVariableConf)||void 0===t?void 0:t.entitledProductVariable)?(Ce(d.SPECIFIC_PRODUCTS),y(null===(o=v.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,ge)):Ce(d.ENTIRE_ORDER);break;case l.BUY_X_GET_Y:we(J[2]),(null===(n=v.entitledCollectionIds)||void 0===n?void 0:n.length)?Pe(a.SPECIFIC_COLLECTIONS):(Pe(a.SPECIFIC_PRODUCTS),y(null===(r=v.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,ge)),(null===(c=v.prerequisiteCollectionIds)||void 0===c?void 0:c.length)?me(a.SPECIFIC_COLLECTIONS):(me(a.SPECIFIC_PRODUCTS),y(null===(s=v.productVariableConf)||void 0===s?void 0:s.prerequisiteProductVariable,_e));break;case l.FREE_SHIPPING:we(J[3])}re(Object.assign({},v)),L.hideProbability||(p=$e()),ae(F(v,ue,b,L.hideProbability||!1,p,!!v.isStaticCoupon)),L.hideProbability||$e()}),[]),n((()=>{let e;L.hideProbability||(e=$e()),ae(F(le,ue,ce,L.hideProbability||!1,e,!!le.isStaticCoupon))}),[le,je,ce,ue]),n((()=>{var e,i,t,o,n,l,r;if(!L.newPickerConf&&((null===(e=L.products)||void 0===e?void 0:e.length)||(null===(i=L.collection)||void 0===i?void 0:i.length))){if(L.products&&(null===(t=L.products)||void 0===t?void 0:t.length)){if(null===(o=L.data)||void 0===o?void 0:o.entitledProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ee(e)}if(null===(n=L.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ie(e)}}if(L.collection&&L.collection.length){if(null===(l=L.data)||void 0===l?void 0:l.entitledCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));De(e)}if(null===(r=L.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Te(e)}}}}),[L.products,L.collection]),n((()=>{var e,i,t,o,n,l,r,d;(null===(i=null===(e=L.data)||void 0===e?void 0:e.productsConf)||void 0===i?void 0:i.entitledProducts)&&Ee(L.data.productsConf.entitledProducts),(null===(o=null===(t=L.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&Ie(L.data.productsConf.prerequisiteProducts),(null===(l=null===(n=L.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&De(L.data.collectionsConf.entitledCollections),(null===(d=null===(r=L.data)||void 0===r?void 0:r.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&Te(L.data.collectionsConf.prerequisiteCollections)}),[null===(Y=L.data)||void 0===Y?void 0:Y.productsConf,null===(X=L.data)||void 0===X?void 0:X.collectionsConf]),n((()=>{if(!fe)return;if(L.newPickerConf){const e=[];return Object.values(fe).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void re(Object.assign(Object.assign({},le),{entitledProductIds:e}))}const e=fe.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{entitledProductIds:e}))}),[fe]),n((()=>{if(!he)return;if(L.newPickerConf){const e=[];return Object.values(he).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void re(Object.assign(Object.assign({},le),{prerequisiteProductIds:e}))}const e=he.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{prerequisiteProductIds:e}))}),[he]),n((()=>{if(!Ae)return;if(L.newPickerConf){(null==Ae?void 0:Ae.isCustom)&&delete Ae.isCustom;const e=Object.keys(Ae).map((e=>parseInt(e)));return void re(Object.assign(Object.assign({},le),{entitledCollectionIds:e}))}const e=Ae.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{entitledCollectionIds:e}))}),[Ae]),n((()=>{if(!Oe)return;if(L.newPickerConf){(null==Oe?void 0:Oe.isCustom)&&delete Oe.isCustom;const e=Object.keys(Oe).map((e=>parseInt(e)));return void re(Object.assign(Object.assign({},le),{prerequisiteCollectionIds:e}))}const e=Oe.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{prerequisiteCollectionIds:e}))}),[Oe]);const Qe=()=>{var e,i;let t,o=le;return le.isStaticCoupon||(le.targetType===p.SHIPPING_LINE?t=l.FREE_SHIPPING:le.targetType===p.LINE_ITEM?t=le.targetSelection===v.ENTITLED?(null===(e=le.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=le.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||le.prerequisiteQuantity||le.entitledQuantity?l.BUY_X_GET_Y:l.AMOUNT_OFF_PRODUCTS:l.AMOUNT_OFF_ORDER:(o=Object.assign(Object.assign({},o),{targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),t=l.AMOUNT_OFF_ORDER)),{discountType:t,tempCouponData:o}},He=()=>{Le(c),Be(s)},ze=e=>{var i;const t={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(i=le.probability)&&void 0!==i?i:-1)>1?"Probability should not exceed 1":le.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((i=>{e[i]&&(o=t[i])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(xe(n>1?"Please add discount details":o),!0)},$e=()=>{if(!L.quadrant||!L.probability)return;const e=[...L.probability];let i=[];e.length>=L.quadrant&&e.splice(L.quadrant-1,1),i=e;const t=i.reduce(((e,i)=>e+i),0)+(le.probability||0);return Ne(parseFloat(t.toFixed(4))),parseFloat(t.toFixed(4))},Ke=e=>{var i,t,o,n,r,d,a,c,s,u,b,m,y,P,h,I;const f=e.value;se(f),Ie([]),Ee([]),Te([]),De([]),f===l.FREE_SHIPPING?re({value:100,targetSelection:v.ALL,targetType:p.SHIPPING_LINE,valueType:C.PERCENTAGE,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(i=le.expireAt)&&void 0!==i?i:void 0,expireAfter:null!==(t=le.expireAfter)&&void 0!==t?t:void 0,probability:le.probability,minQuantity:null!==(o=le.minQuantity)&&void 0!==o?o:void 0,minAmount:null!==(n=le.minAmount)&&void 0!==n?n:void 0}):f===l.BUY_X_GET_Y?re({value:100,targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:C.PERCENTAGE,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(r=le.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(d=le.expireAfter)&&void 0!==d?d:void 0,probability:le.probability,minQuantity:void 0,minAmount:void 0}):f===l.AMOUNT_OFF_ORDER?re({targetSelection:v.ALL,targetType:p.LINE_ITEM,valueType:null!==(a=le.valueType)&&void 0!==a?a:C.FIXED_AMOUNT,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(c=le.expireAt)&&void 0!==c?c:void 0,expireAfter:null!==(s=le.expireAfter)&&void 0!==s?s:void 0,probability:le.probability,value:le.value,minQuantity:null!==(u=le.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(b=le.minAmount)&&void 0!==b?b:void 0}):f===l.AMOUNT_OFF_PRODUCTS&&re({targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:null!==(m=le.valueType)&&void 0!==m?m:C.FIXED_AMOUNT,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(y=le.expireAt)&&void 0!==y?y:void 0,expireAfter:null!==(P=le.expireAfter)&&void 0!==P?P:void 0,probability:le.probability,value:le.value,minQuantity:null!==(h=le.minQuantity)&&void 0!==h?h:void 0,minAmount:null!==(I=le.minAmount)&&void 0!==I?I:void 0})},Ze=i=>i&&e(E,{theme:"light",tagText:i,type:"negative",LeadingIcon:_});return i(I,Object.assign({width:(oe||W)&&L.newPickerConf?"25px":"640px",open:L.isOpen,hideCrossButton:!!ie,headingTitle:W?"Select Products":L.title,headingSubtitle:W?void 0:L.subTitle,footerLeftCustomElement:ke?Ze(ke):L.errorMsg?Ze(L.errorMsg):!L.quadrant||L.hideProbability?e(t,{}):je<=1?e(E,{theme:"light",tagText:`Current probability sum: ${je}`,type:"white"}):e(O,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(E,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${je}`,type:"negative",LeadingIcon:V})})})),headerRightCustomElement:L.allowStaticCoupon||W?void 0:e(b,{options:Xe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ke(e)}}),onClose:L.onClose,footerContainerStyle:{borderTop:`1px solid ${h.colorsV2.stroke.primary}`},primaryButton:W?{buttonType:"primary",onClick:()=>{ee(void 0)},buttonText:"Add"}:oe?{buttonType:"primary",onClick:()=>{ne(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(Q=L.loading)&&void 0!==Q&&Q,onClick:()=>{var e,i,t,o,n;if(He(),le.isStaticCoupon){const{isStaticCoupon:e,couponCode:i,title:t,description:o,quadrant:n,probability:l}=le,r={invalidDiscountCode:!i,invalidCouponTitle:!t,invalidCouponDescription:!o,inValidProbability:!L.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(ze(r))return void Le(r);if(de||je>1)return void xe(!L.hideProbability&&je>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked({quadrant:n,couponCode:i,description:o,isStaticCoupon:e,probability:l,title:le.title})}else{const c={invalidCouponTitle:!le.title,inValidProbability:!L.hideProbability&&(null!==(e=le.probability)&&void 0!==e?e:-1)<=0||(null!==(i=le.probability)&&void 0!==i?i:-1)>1||Number.isNaN(null!==(t=le.probability)&&void 0!==t?t:-1),inValidDiscountAmount:!le.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(ce!==l.BUY_X_GET_Y&&ue!==r.NA){const{minAmount:e,minQuantity:i}=le;c.inValidMinimumAmount=ue===r.AMOUNT&&!e,c.inValidMinimumQuantity=ue===r.QUANTITY&&!i}if(Re&&(c.inValidCouponExpiry=!le.expireAt&&!le.expireAfter),ce!==l.AMOUNT_OFF_ORDER&&ce!==l.AMOUNT_OFF_PRODUCTS||(ve!==d.SPECIFIC_PRODUCTS||!fe||Object.keys(fe).length||Se||(c.inValidProductSelection=!0,c.inValidProductVariableSelection=!0),ve===d.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(c.inValidCollectionSelection=!0)),ce===l.BUY_X_GET_Y&&(le.prerequisiteQuantity||(c.inValidBuyXValue=!0),le.entitledQuantity||(c.inValidGetYValue=!0),be!==a.SPECIFIC_PRODUCTS||!he||Object.keys(he).length||Ve||(c.inValidBuyXProductSelection=!0,c.inValidBuyXProductVariableSelection=!0),be===a.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(c.inValidBuyXCollectionSelection=!0),ye!==a.SPECIFIC_PRODUCTS||!fe||Object.keys(fe).length||Se||(c.inValidGetYProductSelection=!0,c.inValidGetYProductVariableSelection=!0),ye===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(c.inValidGetYCollectionSelection=!0)),ze(c))return void Be(c);if(de||je>1)return void xe(!L.hideProbability&&je>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked(Object.assign(Object.assign({},le),{description:w(le,L.currency,null!==(o=L.products)&&void 0!==o?o:[],null!==(n=L.collection)&&void 0!==n?n:[]),productsConf:{entitledProducts:null!=fe?fe:[],prerequisiteProducts:null!=he?he:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=Se?Se:{},prerequisiteProductVariable:null!=Ve?Ve:{}}}))}}},secondaryButton:W?{buttonType:"tertiaryGray",onClick:()=>{ee(void 0)},buttonText:"Back"}:oe?{buttonType:"tertiaryGray",onClick:()=>{ne(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:L.onClose,buttonText:"Cancel"}},{children:[!W&&!oe&&i(N,{children:[L.allowStaticCoupon&&!W&&i(k,Object.assign({selectedDiv:le.isStaticCoupon?1:2},{children:["static"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{le.isStaticCoupon||(re({isStaticCoupon:!0,quadrant:le.quadrant}),xe(""),He())}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:le.isStaticCoupon?h.colorsV2.content.brand:void 0}},{children:"Static Code"})),e(y,Object.assign({style:le.isStaticCoupon?{color:h.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{var i;le.isStaticCoupon&&(se(l.AMOUNT_OFF_ORDER),re({isStaticCoupon:!1,quadrant:le.quadrant,targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),xe(""),He(),we({id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i}},{children:L.currency||""}))}),Me(null!==(i=L.makeExpiryMandatory)&&void 0!==i&&i),pe(r.NA))}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:le.isStaticCoupon?void 0:h.colorsV2.content.brand}},{children:"Dynamic Code"})),e(y,Object.assign({style:le.isStaticCoupon?{}:{color:h.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e(P,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),le.isStaticCoupon&&!W&&e(q,{discountData:le,setDiscountData:re,hideProbability:L.hideProbability||!1,discountAdminUrl:L.discountAdminUrl,staticDiscountValidationError:qe,currency:L.currency}),!le.isStaticCoupon&&!W&&!oe&&e(R,{currency:L.currency,entitledProducts:null!=fe?fe:[],prerequisiteProducts:null!=he?he:[],setEntitledProducts:Ee,setPrerequisiteProducts:Ie,discountData:le,productPickerOpen:W,productVariablePickerOpen:ie,setIsProductPickerOpen:ee,setIsProductVariablePickerOpen:te,setDiscountData:re,selectedCouponType:ce,setSelectedCouponType:se,selectedMinimumRequirement:ue,setSelectedMinimumRequirement:pe,discountCouponAppliesTo:ve,offerAppliesToBuy:be,offerAppliesToGet:ye,setDiscountCouponAppliesTo:Ce,setOfferAppliesToBuy:me,setOfferAppliesToGet:Pe,hideProbability:L.hideProbability||!1,hideExpiration:L.hideExpiration||!1,allowStaticCoupon:L.allowStaticCoupon,onChangeCouponType:Ke,collectionPickerOpen:oe,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[],setIsCollectionPickerOpen:ne,setEntitledCollections:De,setPrerequisiteCollections:Te,useNewPicker:!!L.newPickerConf,setSelectedDiscountDetails:we,selectedDiscountDetails:Fe,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:Se,setEntitledProductVariable:ge,preRequisiteProductVariable:Ve,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:Re,setIsAddExpirationChecked:Me,dynamicDiscountValidationError:Ue,setDynamicDiscountValidationError:Be,setValidationErrorMessage:xe,resetValidationErrors:He,discountDetailsOptions:J,selectedExpiration:Ge,setSelectedExpiration:Ye,makeExpiryMandatory:!!L.makeExpiryMandatory})]}),!!W&&i(t,{children:[!L.newPickerConf&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(f,{show:!0,onSave:()=>{},products:null!==(H=L.products)&&void 0!==H?H:[],title:"Select Products",onClose:()=>{ee(void 0)},selectedProducts:null!==(z=W===M.ENTITLED?fe:he)&&void 0!==z?z:[],setSelectedProducts:W===M.ENTITLED?Ee:Ie,onSearchKeyChange:L.onProductSearch})})),L.newPickerConf&&e(A,{visible:!0,onClose:()=>ee(void 0),collectionFetcher:L.newPickerConf.fetchCollections,productFetcher:L.newPickerConf.fetchProducts,selectedItems:W===M.ENTITLED?fe:he,onAdd:e=>{W===M.ENTITLED?Ee(e):Ie(e),ee(void 0)},zIndex:200,storeId:L.newPickerConf.storeId,searchInCollectionFetcher:L.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:L.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!oe&&e("div",Object.assign({style:{padding:"12px 0"}},{children:i(t,{children:[L.newPickerConf&&e(A,{visible:!0,onClose:()=>ne(void 0),collectionFetcher:L.newPickerConf.fetchCollections,productFetcher:L.newPickerConf.fetchProducts,selectedItems:oe===M.ENTITLED?Ae:Oe,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),oe===M.ENTITLED?De(e):Te(e),ne(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:L.newPickerConf.storeId,searchInCollectionFetcher:L.newPickerConf.searchInCollection,searchFetcher:L.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!L.newPickerConf&&e(f,{show:!0,onSave:()=>{},products:null!==($=L.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{ne(void 0)},selectedProducts:null!==(K=oe===M.ENTITLED?Ae:Oe)&&void 0!==K?K:[],setSelectedProducts:oe===M.ENTITLED?De:Te,onSearchKeyChange:L.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),ie&&e(x,{children:e("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e(j,{type:D.EMBEDDED,data:null!==(Z=L.productVariableList)&&void 0!==Z?Z:[],showHeader:!0,onSelect:e=>{if(ie===M.ENTITLED){const{displayName:i,actualValue:t,isAvailable:o}=e;ge({displayName:i,actualValue:t,isAvailable:o}),te(void 0)}if(ie===M.PREREQUISITE){const{displayName:i,actualValue:t,isAvailable:o}=e;_e({displayName:i,actualValue:t,isAvailable:o}),te(void 0)}},onClose:()=>{te(void 0)}})}))})]}))};export{L as DiscountModal};
|
|
1
|
+
import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import{useState as o,useEffect as n}from"react";import{DISCOUNT_TYPES as l,MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_APPLIES_TO as d,OFFER_APPLIES_TO as a,initialStaticCouponErrorState as c,initialDynamicCouponErrorState as s,COUPON_EXPIRATION as u,DISCOUNT_TARGET_TYPES as p,DISCOUNT_TARGET_SELECTION as v,DISCOUNT_VALUE_TYPES as C}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as b}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as m,BodyCaption as y,TitleRegular as P}from"../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as I}from"../modals/styledModal.js";import{ProductPickerContent as f}from"../product-picker/ProductPickerModal.js";import{Tag as T}from"../tag/Tag.js";import{Tooltip as E}from"../tooltips/Tooltip.js";import O from"../../assets/icons/gift_icon.svg.js";import S from"../../assets/icons/percentage_icon.svg.js";import g from"../../assets/icons/shipping_icon.svg.js";import _ from"../../assets/icons/triangle_error.svg.js";import V from"../../assets/icons/warning.svg.js";import{ProductPickerModal as A}from"../product-picker-v2/modal.js";import{PickerType as D}from"../variable-picker-v3/model.js";import{VariablePicker as j}from"../variable-picker-v3/VariablePicker.js";import{StyledDiscountDialogueContainer as k,CouponTypeContainerStyled as N,VariablePickerContainer as x}from"./DiscountModal.styled.js";import{validateDiscountData as F,descriptionBuilder as w}from"./DiscountUtils.js";import R,{DISCOUNT_PRODUCTS as M}from"./DynamicCoupon/DynamicCoupon.js";import q from"./StaticCoupon/StaticCoupon.js";import{__exports as L}from"../../_virtual/bik-store.js";const U=U=>{var B,G,Y,X,Q,H,z,K,$,Z,J;const W=[{id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i,lineHeight:.9}},{children:U.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(S,{width:24,height:24,color:i})},{id:"2",label:"Buy X get Y",value:l.BUY_X_GET_Y,icon:i=>e(O,{width:24,height:24,color:i})},{id:"3",label:"Free Shipping",value:l.FREE_SHIPPING,icon:i=>e(g,{width:24,height:24,color:i})}],[ee,ie]=o(),[te,oe]=o(),[ne,le]=o(),[re,de]=o(null!==(B=U.data)&&void 0!==B?B:"string"==typeof U.hideOption?{isStaticCoupon:"dynamic"===U.hideOption}:{isStaticCoupon:!0}),[ae,ce]=o(!0),[se,ue]=o(),[pe,ve]=o((null===(G=U.data)||void 0===G?void 0:G.minAmount)?r.AMOUNT:(null===(Y=U.data)||void 0===Y?void 0:Y.minQuantity)?r.QUANTITY:r.NA),[Ce,be]=o(d.ENTIRE_ORDER),[me,ye]=o(a.SPECIFIC_PRODUCTS),[Pe,he]=o(a.SPECIFIC_PRODUCTS),[Ie,fe]=o(void 0),[Te,Ee]=o(void 0),[Oe,Se]=o(void 0),[ge,_e]=o(void 0),[Ve,Ae]=o(void 0),[De,je]=o(void 0),[ke,Ne]=o(0),[xe,Fe]=o(""),[we,Re]=o(W[0]),[Me,qe]=o(!1),[Le,Ue]=o(c),[Be,Ge]=o(s),[Ye,Xe]=o(u.DYNAMIC_EXPIRATION),Qe=[{value:l.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:se===l.AMOUNT_OFF_ORDER},{value:l.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:se===l.AMOUNT_OFF_PRODUCTS},{value:l.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:se===l.BUY_X_GET_Y},{value:l.FREE_SHIPPING,label:"Free shipping",selected:se===l.FREE_SHIPPING}];n((()=>{U.makeExpiryMandatory&&qe(!0)}),[U.makeExpiryMandatory]),n((()=>{var e,i,t,o,n,r,c,s;let p;const{tempCouponData:v,discountType:b}=He();ue(b);const m=(e,i)=>{Re(v.valueType===C.FIXED_AMOUNT?W[e]:W[i])},y=(e,i)=>{Object.keys(e||{}).length&&i(e)};switch(((null==v?void 0:v.expireAfter)||(null==v?void 0:v.expireAt))&&(qe(!0),(null==v?void 0:v.expireAt)&&Xe(u.FIXED_EXPIRATION),(null==v?void 0:v.expireAfter)&&Xe(u.DYNAMIC_EXPIRATION)),b){case l.AMOUNT_OFF_ORDER:m(0,1),be(d.ENTIRE_ORDER);break;case l.AMOUNT_OFF_PRODUCTS:m(0,1),(null===(e=v.entitledCollectionIds)||void 0===e?void 0:e.length)?be(d.SPECIFIC_COLLECTIONS):(null===(i=v.entitledProductIds)||void 0===i?void 0:i.length)||(null===(t=v.productVariableConf)||void 0===t?void 0:t.entitledProductVariable)?(be(d.SPECIFIC_PRODUCTS),y(null===(o=v.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,_e)):be(d.ENTIRE_ORDER);break;case l.BUY_X_GET_Y:Re(W[2]),(null===(n=v.entitledCollectionIds)||void 0===n?void 0:n.length)?he(a.SPECIFIC_COLLECTIONS):(he(a.SPECIFIC_PRODUCTS),y(null===(r=v.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,_e)),(null===(c=v.prerequisiteCollectionIds)||void 0===c?void 0:c.length)?ye(a.SPECIFIC_COLLECTIONS):(ye(a.SPECIFIC_PRODUCTS),y(null===(s=v.productVariableConf)||void 0===s?void 0:s.prerequisiteProductVariable,Ae));break;case l.FREE_SHIPPING:Re(W[3])}de(Object.assign({},v)),U.hideProbability||(p=$e()),ce(F(v,pe,b,U.hideProbability||!1,p,!!v.isStaticCoupon)),U.hideProbability||$e()}),[]),n((()=>{let e;U.hideProbability||(e=$e()),ce(F(re,pe,se,U.hideProbability||!1,e,!!re.isStaticCoupon))}),[re,ke,se,pe]),n((()=>{var e,i,t,o,n,l,r;if(!U.newPickerConf&&((null===(e=U.products)||void 0===e?void 0:e.length)||(null===(i=U.collection)||void 0===i?void 0:i.length))){if(U.products&&(null===(t=U.products)||void 0===t?void 0:t.length)){if(null===(o=U.data)||void 0===o?void 0:o.entitledProductIds){const e=U.products.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.entitledProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ee(e)}if(null===(n=U.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=U.products.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.prerequisiteProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));fe(e)}}if(U.collection&&U.collection.length){if(null===(l=U.data)||void 0===l?void 0:l.entitledCollectionIds){const e=U.collection.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.entitledCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));je(e)}if(null===(r=U.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=U.collection.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.prerequisiteCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Se(e)}}}}),[U.products,U.collection]),n((()=>{var e,i,t,o,n,l,r,d;(null===(i=null===(e=U.data)||void 0===e?void 0:e.productsConf)||void 0===i?void 0:i.entitledProducts)&&Ee(U.data.productsConf.entitledProducts),(null===(o=null===(t=U.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&fe(U.data.productsConf.prerequisiteProducts),(null===(l=null===(n=U.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&je(U.data.collectionsConf.entitledCollections),(null===(d=null===(r=U.data)||void 0===r?void 0:r.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&Se(U.data.collectionsConf.prerequisiteCollections)}),[null===(X=U.data)||void 0===X?void 0:X.productsConf,null===(Q=U.data)||void 0===Q?void 0:Q.collectionsConf]),n((()=>{if(!Te)return;if(U.newPickerConf){const e=[];return Object.values(Te).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}const e=Te.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}),[Te]),n((()=>{if(!Ie)return;if(U.newPickerConf){const e=[];return Object.values(Ie).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}const e=Ie.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}),[Ie]),n((()=>{if(!De)return;if(U.newPickerConf){(null==De?void 0:De.isCustom)&&delete De.isCustom;const e=Object.keys(De).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}const e=De.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}),[De]),n((()=>{if(!Oe)return;if(U.newPickerConf){(null==Oe?void 0:Oe.isCustom)&&delete Oe.isCustom;const e=Object.keys(Oe).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}const e=Oe.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}),[Oe]);const He=()=>{var e,i;let t,o=re;return re.isStaticCoupon||(re.targetType===p.SHIPPING_LINE?t=l.FREE_SHIPPING:re.targetType===p.LINE_ITEM?t=re.targetSelection===v.ENTITLED?(null===(e=re.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=re.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||re.prerequisiteQuantity||re.entitledQuantity?l.BUY_X_GET_Y:l.AMOUNT_OFF_PRODUCTS:l.AMOUNT_OFF_ORDER:(o=Object.assign(Object.assign({},o),{targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),t=l.AMOUNT_OFF_ORDER)),{discountType:t,tempCouponData:o}},ze=()=>{Ue(c),Ge(s)},Ke=e=>{var i;const t={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(i=re.probability)&&void 0!==i?i:-1)>1?"Probability should not exceed 1":re.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((i=>{e[i]&&(o=t[i])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Fe(n>1?"Please add discount details":o),!0)},$e=()=>{if(!U.quadrant||!U.probability)return;const e=[...U.probability];let i=[];e.length>=U.quadrant&&e.splice(U.quadrant-1,1),i=e;const t=i.reduce(((e,i)=>e+i),0)+(re.probability||0);return Ne(parseFloat(t.toFixed(4))),parseFloat(t.toFixed(4))},Ze=e=>{var i,t,o,n,r,d,a,c,s,u,b,m,y,P,h,I;const f=e.value;ue(f),fe([]),Ee([]),Se([]),je([]),f===l.FREE_SHIPPING?de({value:100,targetSelection:v.ALL,targetType:p.SHIPPING_LINE,valueType:C.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(i=re.expireAt)&&void 0!==i?i:void 0,expireAfter:null!==(t=re.expireAfter)&&void 0!==t?t:void 0,probability:re.probability,minQuantity:null!==(o=re.minQuantity)&&void 0!==o?o:void 0,minAmount:null!==(n=re.minAmount)&&void 0!==n?n:void 0}):f===l.BUY_X_GET_Y?de({value:100,targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:C.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(r=re.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(d=re.expireAfter)&&void 0!==d?d:void 0,probability:re.probability,minQuantity:void 0,minAmount:void 0}):f===l.AMOUNT_OFF_ORDER?de({targetSelection:v.ALL,targetType:p.LINE_ITEM,valueType:null!==(a=re.valueType)&&void 0!==a?a:C.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(c=re.expireAt)&&void 0!==c?c:void 0,expireAfter:null!==(s=re.expireAfter)&&void 0!==s?s:void 0,probability:re.probability,value:re.value,minQuantity:null!==(u=re.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(b=re.minAmount)&&void 0!==b?b:void 0}):f===l.AMOUNT_OFF_PRODUCTS&&de({targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:null!==(m=re.valueType)&&void 0!==m?m:C.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(y=re.expireAt)&&void 0!==y?y:void 0,expireAfter:null!==(P=re.expireAfter)&&void 0!==P?P:void 0,probability:re.probability,value:re.value,minQuantity:null!==(h=re.minQuantity)&&void 0!==h?h:void 0,minAmount:null!==(I=re.minAmount)&&void 0!==I?I:void 0})},Je=i=>i&&e(T,{theme:"light",tagText:i,type:"negative",LeadingIcon:V});return i(I,Object.assign({width:(ne||ee)&&U.newPickerConf?"25px":"640px",open:U.isOpen,hideCrossButton:!!te,headingTitle:ee?"Select Products":U.title,headingSubtitle:ee?void 0:U.subTitle,footerLeftCustomElement:xe?Je(xe):U.errorMsg?Je(U.errorMsg):!U.quadrant||U.hideProbability?e(t,{}):ke<=1?e(T,{theme:"light",tagText:`Current probability sum: ${ke}`,type:"white"}):e(E,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(T,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ke}`,type:"negative",LeadingIcon:_})})})),headerRightCustomElement:U.allowStaticCoupon||ee?void 0:e(b,{options:Qe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ze(e)}}),onClose:U.onClose,footerContainerStyle:{borderTop:`1px solid ${h.colorsV2.stroke.primary}`},primaryButton:ee?{buttonType:"primary",onClick:()=>{ie(void 0)},buttonText:"Add"}:ne?{buttonType:"primary",onClick:()=>{le(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(H=U.loading)&&void 0!==H&&H,onClick:()=>{var e,i,t,o,n;if(ze(),re.isStaticCoupon){const{isStaticCoupon:e,couponCode:i,title:t,description:o,quadrant:n,probability:l}=re,r={invalidDiscountCode:!i,invalidCouponTitle:!t,invalidCouponDescription:!o,inValidProbability:!U.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(Ke(r))return void Ue(r);if(ae||ke>1)return void Fe(!U.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");U.onSaveClicked({quadrant:n,couponCode:i,description:o,isStaticCoupon:e,probability:l,title:re.title})}else{const c={invalidCouponTitle:!re.title,inValidProbability:!U.hideProbability&&(null!==(e=re.probability)&&void 0!==e?e:-1)<=0||(null!==(i=re.probability)&&void 0!==i?i:-1)>1||Number.isNaN(null!==(t=re.probability)&&void 0!==t?t:-1),inValidDiscountAmount:!re.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(se!==l.BUY_X_GET_Y&&pe!==r.NA){const{minAmount:e,minQuantity:i}=re;c.inValidMinimumAmount=pe===r.AMOUNT&&!e,c.inValidMinimumQuantity=pe===r.QUANTITY&&!i}if(Me&&(c.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==l.AMOUNT_OFF_ORDER&&se!==l.AMOUNT_OFF_PRODUCTS||(Ce!==d.SPECIFIC_PRODUCTS||!Te||Object.keys(Te).length||ge||(c.inValidProductSelection=!0,c.inValidProductVariableSelection=!0),Ce===d.SPECIFIC_COLLECTIONS&&De&&!Object.keys(De).length&&(c.inValidCollectionSelection=!0)),se===l.BUY_X_GET_Y&&(re.prerequisiteQuantity||(c.inValidBuyXValue=!0),re.entitledQuantity||(c.inValidGetYValue=!0),me!==a.SPECIFIC_PRODUCTS||!Ie||Object.keys(Ie).length||Ve||(c.inValidBuyXProductSelection=!0,c.inValidBuyXProductVariableSelection=!0),me===a.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(c.inValidBuyXCollectionSelection=!0),Pe!==a.SPECIFIC_PRODUCTS||!Te||Object.keys(Te).length||ge||(c.inValidGetYProductSelection=!0,c.inValidGetYProductVariableSelection=!0),Pe===a.SPECIFIC_COLLECTIONS&&De&&!Object.keys(De).length&&(c.inValidGetYCollectionSelection=!0)),Ke(c))return void Ge(c);if(ae||ke>1)return void Fe(!U.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");U.onSaveClicked(Object.assign(Object.assign({},re),{description:w(re,U.currency,null!==(o=U.products)&&void 0!==o?o:[],null!==(n=U.collection)&&void 0!==n?n:[]),productsConf:{entitledProducts:null!=Te?Te:[],prerequisiteProducts:null!=Ie?Ie:[]},collectionsConf:{entitledCollections:null!=De?De:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=ge?ge:{},prerequisiteProductVariable:null!=Ve?Ve:{}}}))}}},secondaryButton:ee?{buttonType:"tertiaryGray",onClick:()=>{ie(void 0)},buttonText:"Back"}:ne?{buttonType:"tertiaryGray",onClick:()=>{le(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:U.onClose,buttonText:"Cancel"}},{children:[!ee&&!ne&&i(k,{children:[U.allowStaticCoupon&&!ee&&i(N,Object.assign({selectedDiv:re.isStaticCoupon?1:2},{children:["static"===U.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{re.isStaticCoupon||(de({isStaticCoupon:!0,quadrant:re.quadrant}),Fe(""),ze())}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?h.colorsV2.content.brand:void 0}},{children:"Static Code"})),e(y,Object.assign({style:re.isStaticCoupon?{color:h.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===U.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{var i;re.isStaticCoupon&&(ue(l.AMOUNT_OFF_ORDER),de({isStaticCoupon:!1,quadrant:re.quadrant,targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),Fe(""),ze(),Re({id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i}},{children:U.currency||""}))}),qe(null!==(i=U.makeExpiryMandatory)&&void 0!==i&&i),ve(r.NA))}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?void 0:h.colorsV2.content.brand}},{children:"Dynamic Code"})),e(y,Object.assign({style:re.isStaticCoupon?{}:{color:h.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e(P,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),re.isStaticCoupon&&!ee&&e(q,{discountData:re,setDiscountData:de,hideProbability:U.hideProbability||!1,discountAdminUrl:U.discountAdminUrl,staticDiscountValidationError:Le,currency:U.currency}),!re.isStaticCoupon&&!ee&&!ne&&e(R,{currency:U.currency,entitledProducts:null!=Te?Te:[],prerequisiteProducts:null!=Ie?Ie:[],setEntitledProducts:Ee,setPrerequisiteProducts:fe,discountData:re,productPickerOpen:ee,productVariablePickerOpen:te,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setDiscountData:de,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:ve,discountCouponAppliesTo:Ce,offerAppliesToBuy:me,offerAppliesToGet:Pe,setDiscountCouponAppliesTo:be,setOfferAppliesToBuy:ye,setOfferAppliesToGet:he,hideProbability:U.hideProbability||!1,hideExpiration:U.hideExpiration||!1,allowStaticCoupon:U.allowStaticCoupon,onChangeCouponType:Ze,collectionPickerOpen:ne,entitledCollections:null!=De?De:[],prerequisiteCollections:null!=Oe?Oe:[],setIsCollectionPickerOpen:le,setEntitledCollections:je,setPrerequisiteCollections:Se,useNewPicker:!!U.newPickerConf,setSelectedDiscountDetails:Re,selectedDiscountDetails:we,isProductVariableSupported:U.isProductVariableSupported,entitledProductVariable:ge,setEntitledProductVariable:_e,preRequisiteProductVariable:Ve,setPreRequisiteProductVariable:Ae,productVariableList:U.productVariableList,isAddExpirationChecked:Me,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:Fe,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!U.makeExpiryMandatory})]}),!!ee&&i(t,{children:[!U.newPickerConf&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(f,{show:!0,onSave:()=>{},products:null!==(z=U.products)&&void 0!==z?z:[],title:"Select Products",onClose:()=>{ie(void 0)},selectedProducts:null!==(K=ee===M.ENTITLED?Te:Ie)&&void 0!==K?K:[],setSelectedProducts:ee===M.ENTITLED?Ee:fe,onSearchKeyChange:U.onProductSearch})})),U.newPickerConf&&e(A,{visible:!0,onClose:()=>ie(void 0),collectionFetcher:(e,i,t)=>{var o;return(null===(o=U.newPickerConf)||void 0===o?void 0:o.fetchCollections)?U.newPickerConf.fetchCollections(e,i,!1,t):null},productFetcher:(e,i,t,o,n)=>{var l;return(null===(l=U.newPickerConf)||void 0===l?void 0:l.fetchProducts)?U.newPickerConf.fetchProducts(e,i,o,n,!1,t):null},selectedItems:ee===M.ENTITLED?Te:Ie,onAdd:e=>{ee===M.ENTITLED?Ee(e):fe(e),ie(void 0)},zIndex:200,storeId:U.newPickerConf.storeId,appType:U.newPickerConf.appType||L.ApplicationType.BIK,searchInCollectionFetcher:(e,i,t,o)=>{var n;return(null===(n=U.newPickerConf)||void 0===n?void 0:n.searchInCollection)?U.newPickerConf.searchInCollection(e,i,t,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,i,t)=>{var o;return(null===(o=U.newPickerConf)||void 0===o?void 0:o.searchProducts)?U.newPickerConf.searchProducts(e,i,!1,t):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!ne&&e("div",Object.assign({style:{padding:"12px 0"}},{children:i(t,{children:[U.newPickerConf&&e(A,{visible:!0,onClose:()=>le(void 0),collectionFetcher:U.newPickerConf.fetchCollections,productFetcher:U.newPickerConf.fetchProducts,selectedItems:ne===M.ENTITLED?De:Oe,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),ne===M.ENTITLED?je(e):Se(e),le(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:U.newPickerConf.storeId,appType:U.newPickerConf.appType||L.ApplicationType.BIK,searchInCollectionFetcher:U.newPickerConf.searchInCollection,searchFetcher:U.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!U.newPickerConf&&e(f,{show:!0,onSave:()=>{},products:null!==($=U.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{le(void 0)},selectedProducts:null!==(Z=ne===M.ENTITLED?De:Oe)&&void 0!==Z?Z:[],setSelectedProducts:ne===M.ENTITLED?je:Se,onSearchKeyChange:U.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),te&&e(x,{children:e("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e(j,{type:D.EMBEDDED,data:null!==(J=U.productVariableList)&&void 0!==J?J:[],showHeader:!0,onSelect:e=>{if(te===M.ENTITLED){const{displayName:i,actualValue:t,isAvailable:o}=e;_e({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}if(te===M.PREREQUISITE){const{displayName:i,actualValue:t,isAvailable:o}=e;Ae({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}},onClose:()=>{oe(void 0)}})}))})]}))};export{U as DiscountModal};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DISCOUNT_TYPES } from "..";
|
|
3
2
|
import { COUPON_EXPIRATION, DISCOUNT_APPLIES_TO, ICouponData, IDynamicDiscountValidationError, MIN_PURCHASE_REQUIREMENT, OFFER_APPLIES_TO } from "../type";
|
|
4
3
|
import { SingleOption } from "../../dropdown/type";
|
|
5
4
|
import { Collection, Product } from "../../product-picker/type";
|
|
6
5
|
import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
|
|
7
|
-
import { ProductVariable } from '../type';
|
|
6
|
+
import { DISCOUNT_TYPES, ProductVariable } from '../type';
|
|
8
7
|
export declare enum DISCOUNT_PRODUCTS {
|
|
9
8
|
ENTITLED = "entitled",
|
|
10
9
|
PREREQUISITE = "prerequisite"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import n from"../../../assets/icons/info.svg.js";import{Alert as l}from"../../alerts/Alert.js";import{ALERT_TYPES as s,CONTENT_POSITION as r}from"../../alerts/AlertHelper.js";import{Button as a}from"../../button/Button.js";import{CheckBox as d}from"../../checkBox/CheckBox.js";import"react";import{DISCOUNT_APPLIES_TO as c,OFFER_APPLIES_TO as u,DISCOUNT_TYPES as p,COUPON_EXPIRATION as m,DISCOUNT_VALUE_TYPES as v,DISCOUNT_TARGET_TYPES as C,DISCOUNT_TARGET_SELECTION as E}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as b}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import{BodySecondary as D,TitleRegular as g,TitleSmall as T}from"../../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../icon-button/IconButton.js";import{Input as y}from"../../input/Input.js";import P from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import"../../modals/styledModal.js";import"../../../node_modules/lodash.debounce/index.js";import"../../bik-layout/CommonStyles.js";import"../../product-picker/ProductPicker.styled.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"../../tooltips/Tooltip.js";import"../../product-picker-v2/modal.js";import"../../variable-picker-v3/model.js";import"../../modals/modal.styled.js";import O from"../../../assets/icons/plus.svg.js";import"../../accordion/Accordion.style.js";import"../../accordion/AccordionArrow.js";import"../../switch/Switch.js";import"../../variable-picker-v3/NoResult.js";import"../../variable-picker-v3/styles.js";import"lodash";import{DynamicCouponContainer as I}from"../DiscountModal.styled.js";import{CouponExpiration as j}from"../CouponExpiration/CouponExpiration.js";import{RadioButton as V}from"../../radioButton/RadioButton.js";import S from"../../../assets/icons/cubeIcon.svg.js";import f from"../../../assets/icons/delete.svg.js";import x from"../../../assets/icons/edit.svg.js";import{DiscountOptionsContainer as R,DiscountDetailsOption as _,AddProductButtonsContainer as A,ProductCollectionCard as N,CubeIconContainer as w,IconContainer as L,ProductVariableCard as F}from"./DynamicCoupon.styled.js";import q from"./MinimumRequirementComponent.js";import k from"./ZeroState.js";var U;!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(U||(U={}));const B=B=>{var M,G,Q,Y,X,$,W,z;const Z=[{selected:B.discountCouponAppliesTo===c.ENTIRE_ORDER,label:"Entire Order",value:c.ENTIRE_ORDER},{selected:B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS,label:"Specific Product",value:c.SPECIFIC_PRODUCTS},{selected:B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:c.SPECIFIC_COLLECTIONS}],H=[{selected:B.offerAppliesToBuy===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToBuy===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],J=[{selected:B.offerAppliesToGet===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToGet===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],K=(e,d,u)=>{var p,m,v,C,E,b,g,y,I,j,V,R;let _=[],q=[],k={},M={};B.useNewPicker?(k=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==p?p:[],(null==k?void 0:k.isCustom)&&delete k.isCustom,(null==M?void 0:M.isCustom)&&delete M.isCustom,Object.values(k).forEach((e=>{Object.keys(e.products).forEach((i=>{_.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(M).forEach((e=>{"isCustom"!==e&&q.push({id:e,name:M[e].name,image:M[e].image})}))):(_=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==m?m:[]);const G=[null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidProductSelection,null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidProductVariableSelection,null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidCollectionSelection],Q=[null===(b=B.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXCollectionSelection,null===(g=B.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidBuyXProductSelection,null===(y=B.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidBuyXProductVariableSelection],Y=[null===(I=B.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidGetYCollectionSelection,null===(j=B.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidGetYProductSelection,null===(V=B.dynamicDiscountValidationError)||void 0===V?void 0:V.inValidGetYProductVariableSelection];let X=!1;return"couponAppliesTo"===u&&(X=G.some(Boolean)),"buyX"===u&&(X=Q.some(Boolean)),"getY"===u&&(X=Y.some(Boolean)),i(o,{children:[i("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(d===U.ENTITLED&&!B.entitledProductVariable||d===U.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(A,{children:[t("div",Object.assign({style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:t(a,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:O,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(d)},error:X})})),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(D,Object.assign({color:h.colorsV2.content.placeholder},{children:"OR"})),t(a,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:O,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(d)},error:X})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",Object.assign({style:{width:"300px",display:"flex"}},{children:t(a,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:O,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(d)},style:{marginTop:"16px"},error:X})}))]})),X&&t("div",Object.assign({style:{margin:"8px 0 0"}},{children:t(l,{type:s.NEGATIVE,text:"Required Field",contentPosition:r.START,icon:()=>t(n,{width:16,height:16,color:h.colorsV2.content.negative})})})),_.length||q.length?i("div",{children:[t(D,Object.assign({style:{margin:"8px 0"}},{children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i(N,{children:[t(w,{children:t(S,{width:20,height:20,color:h.colorsV2.content.secondary})}),i(T,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(d):B.setIsCollectionPickerOpen(d)}},{children:t(x,{width:24,height:24,color:h.colorsV2.content.placeholder})})),t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?d===U.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):d===U.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])}},{children:t(f,{width:24,height:24,color:h.colorsV2.content.placeholder})}))]}))]})]}):d===U.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(D,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(F,{children:[t(T,{children:B.entitledProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setEntitledProductVariable(void 0)}},{children:t(P,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):d===U.PREREQUISITE&&(null===(R=B.preRequisiteProductVariable)||void 0===R?void 0:R.displayName)?i("div",{children:[t(D,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(F,{children:[t(T,{children:B.preRequisiteProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setPreRequisiteProductVariable(void 0)}},{children:t(P,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,s,r,a,d,p,m,v,C;let E=[],g=[],h={},P={};B.useNewPicker?(h=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,P=null!==(n=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==P?void 0:P.isCustom)&&delete P.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((i=>{E.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(P).forEach((e=>{"isCustom"!==e&&g.push({id:e,name:P[e].name,image:P[e].image})}))):(E=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,g=null!==(l=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const O=e===U.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,I=e===U.PREREQUISITE?U.PREREQUISITE:U.ENTITLED,j=O===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(T,Object.assign({style:{marginBottom:16}},{children:e===U.PREREQUISITE?"Customer buys":"Customer gets"})),i("div",Object.assign({style:{display:"flex"}},{children:[!o&&t("div",{children:i("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:e===U.ENTITLED?null!==(r=null===(s=B.discountData.entitledQuantity)||void 0===s?void 0:s.toString())&&void 0!==r?r:"":null!==(d=null===(a=B.discountData.prerequisiteQuantity)||void 0===a?void 0:a.toString())&&void 0!==d?d:"",type:"number",onChangeText:i=>{e===U.ENTITLED?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledQuantity:parseInt(i)})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===U.PREREQUISITE&&(null===(p=B.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidBuyXValue)||e===U.ENTITLED&&(null===(m=B.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYValue)?"Required Field":"",state:e===U.PREREQUISITE&&(null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidBuyXValue)||e===U.ENTITLED&&(null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidGetYValue)?"invalid":"none"})})),t("div",{className:"input__wrapper"})]}))}),i("div",{children:[t(D,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===U.PREREQUISITE&&t(b,{width:"244px",options:H,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToBuy(e.value),B.setPrerequisiteProducts([]),B.setPrerequisiteCollections([]),B.setPreRequisiteProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===U.ENTITLED&&t(b,{width:"244px",options:J,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToGet(e.value),B.setEntitledProducts([]),B.setEntitledCollections([]),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),K(j,I,e===U.PREREQUISITE?"buyX":"getY")]})};return i(I,{children:[i("div",{children:[i("div",Object.assign({style:{display:"flex",gap:16}},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(M=B.discountData.title)&&void 0!==M?M:"",onChangeText:e=>{var i;B.setDiscountData(Object.assign(Object.assign({},B.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(G=B.currency)&&void 0!==G?G:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(Q=B.dynamicDiscountValidationError)||void 0===Q?void 0:Q.invalidCouponTitle)?"Required Field":"",state:(null===(Y=B.dynamicDiscountValidationError)||void 0===Y?void 0:Y.invalidCouponTitle)?"invalid":"none"})})),!B.hideProbability&&t(y,{value:null!==($=null===(X=B.discountData.probability)||void 0===X?void 0:X.toString())&&void 0!==$?$:"",type:"number",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(W=B.dynamicDiscountValidationError)||void 0===W?void 0:W.inValidProbability)?"Required Field":"",state:(null===(z=B.dynamicDiscountValidationError)||void 0===z?void 0:z.inValidProbability)?"invalid":"none"})]})),t("div",{style:{height:"1px",width:"100%",background:h.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t((()=>i("div",{children:[t(g,{children:"Discount Details"}),t(R,{children:B.discountDetailsOptions.map((t=>{return i(_,Object.assign({selected:B.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(B.selectedDiscountDetails.id!==i.id)if(B.resetValidationErrors(),B.setValidationErrorMessage(""),B.setDiscountCouponAppliesTo(c.ENTIRE_ORDER),B.setSelectedDiscountDetails(i),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0})),B.setPreRequisiteProductVariable(void 0),B.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){B.onChangeCouponType({label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},B.discountData),{valueType:"percentage"===i.value?v.PERCENTAGE:v.FIXED_AMOUNT,value:void 0,targetType:C.LINE_ITEM,targetSelection:E.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e(t,["entitledQuantity","prerequisiteQuantity"]);B.setDiscountData(o)}else B.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,B.selectedDiscountDetails.id===o?h.colorsV2.stroke.brand:h.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(B.selectedCouponType===p.AMOUNT_OFF_ORDER||B.selectedCouponType===p.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,n,l,s,r,a;return i(o,{children:[t("div",Object.assign({className:"input__rows"},{children:t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(l=null===(n=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===n?void 0:n.toString())&&void 0!==l?l:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:B.discountData.valueType===v.FIXED_AMOUNT?null!==(s=B.currency)&&void 0!==s?s:"":void 0,suffixText:B.discountData.valueType===v.PERCENTAGE?"%":void 0,errorMessage:(null===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"Required Field":"",state:(null===(a=B.dynamicDiscountValidationError)||void 0===a?void 0:a.inValidDiscountAmount)?"invalid":"none"})}))})),t("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:i("div",Object.assign({className:"input__wrapper"},{children:[t(g,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),t("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:t(b,{width:"300px",options:Z,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===c.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:p.AMOUNT_OFF_PRODUCTS};B.onChangeCouponType(i),B.setDiscountCouponAppliesTo(e.value),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS||B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS)&&K(B.discountCouponAppliesTo,U.ENTITLED,"couponAppliesTo")]}))}))]})})(),B.selectedCouponType===p.BUY_X_GET_Y&&(()=>{var e,o,n,l,s;return i(I,Object.assign({style:{border:`1px solid ${h.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[ee(U.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:h.colorsV2.stroke.primary,margin:"8px 0"}}),ee(U.ENTITLED),t(D,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),t("div",{children:t(V,{label:"Free",isActive:100===B.discountData.value,onValueChange:e=>{e?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:100})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}})}),i("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[t(V,{label:"Percentage off",isActive:100!==B.discountData.value,onValueChange:()=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}}),100!==B.discountData.value&&t("div",Object.assign({style:{marginTop:8}},{children:t(y,{value:null!==(n=null===(o=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===o?void 0:o.toString())&&void 0!==n?n:"",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(l=B.dynamicDiscountValidationError)||void 0===l?void 0:l.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!B.selectedCouponType&&t(k,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:t(q,{selectedMinimumRequirement:B.selectedMinimumRequirement,setSelectedMinimumRequirement:B.setSelectedMinimumRequirement,discountData:B.discountData,setDiscountData:B.setDiscountData,currency:B.currency,dynamicDiscountValidationError:B.dynamicDiscountValidationError})})),B.selectedCouponType&&!B.hideExpiration&&i("div",Object.assign({style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${h.colorsV2.stroke.primary}`:"none"}},{children:[t(d,{label:"Add expiration",isDisabled:!!B.makeExpiryMandatory,isChecked:B.isAddExpirationChecked,onValueChange:e=>{B.setIsAddExpirationChecked(e),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{expireAfter:void 0,expireAt:void 0})),B.setSelectedExpiration(m.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),t(D,Object.assign({style:{color:h.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),B.isAddExpirationChecked&&t(j,{discountData:B.discountData,setDiscountData:B.setDiscountData,isAddExpirationChecked:B.isAddExpirationChecked,inValidCouponExpiry:B.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:B.selectedExpiration,setSelectedExpiration:B.setSelectedExpiration})]}))]})};export{U as DISCOUNT_PRODUCTS,B as default};
|
|
1
|
+
import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import n from"../../../assets/icons/info.svg.js";import{Alert as l}from"../../alerts/Alert.js";import{ALERT_TYPES as s,CONTENT_POSITION as r}from"../../alerts/AlertHelper.js";import{Button as a}from"../../button/Button.js";import{CheckBox as d}from"../../checkBox/CheckBox.js";import{DISCOUNT_APPLIES_TO as c,OFFER_APPLIES_TO as u,DISCOUNT_TYPES as p,COUPON_EXPIRATION as m,DISCOUNT_VALUE_TYPES as C,DISCOUNT_TARGET_TYPES as v,DISCOUNT_TARGET_SELECTION as E}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as D}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"react";import"../../zeroState/ZeroState.js";import{BodySecondary as b,TitleRegular as g,TitleSmall as T}from"../../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../icon-button/IconButton.js";import{Input as y}from"../../input/Input.js";import O from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import{RadioButton as P}from"../../radioButton/RadioButton.js";import I from"../../../assets/icons/cubeIcon.svg.js";import V from"../../../assets/icons/delete.svg.js";import S from"../../../assets/icons/edit.svg.js";import j from"../../../assets/icons/plus.svg.js";import{CouponExpiration as f}from"../CouponExpiration/CouponExpiration.js";import{DynamicCouponContainer as x}from"../DiscountModal.styled.js";import{DiscountOptionsContainer as R,DiscountDetailsOption as _,AddProductButtonsContainer as N,ProductCollectionCard as A,CubeIconContainer as L,IconContainer as F,ProductVariableCard as w}from"./DynamicCoupon.styled.js";import q from"./MinimumRequirementComponent.js";import k from"./ZeroState.js";var U;!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(U||(U={}));const B=B=>{var M,G,Q,Y,X,$,W,z;const Z=[{selected:B.discountCouponAppliesTo===c.ENTIRE_ORDER,label:"Entire Order",value:c.ENTIRE_ORDER},{selected:B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS,label:"Specific Product",value:c.SPECIFIC_PRODUCTS},{selected:B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:c.SPECIFIC_COLLECTIONS}],H=[{selected:B.offerAppliesToBuy===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToBuy===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],J=[{selected:B.offerAppliesToGet===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToGet===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],K=(e,d,u)=>{var p,m,C,v,E,D,g,y,P,f,x,R;let _=[],q=[],k={},M={};B.useNewPicker?(k=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==p?p:[],(null==k?void 0:k.isCustom)&&delete k.isCustom,(null==M?void 0:M.isCustom)&&delete M.isCustom,Object.values(k).forEach((e=>{Object.keys(e.products).forEach((i=>{_.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(M).forEach((e=>{"isCustom"!==e&&q.push({id:e,name:M[e].name,image:M[e].image})}))):(_=d===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=d===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==m?m:[]);const G=[null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidProductSelection,null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidProductVariableSelection,null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidCollectionSelection],Q=[null===(D=B.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXCollectionSelection,null===(g=B.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidBuyXProductSelection,null===(y=B.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidBuyXProductVariableSelection],Y=[null===(P=B.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidGetYCollectionSelection,null===(f=B.dynamicDiscountValidationError)||void 0===f?void 0:f.inValidGetYProductSelection,null===(x=B.dynamicDiscountValidationError)||void 0===x?void 0:x.inValidGetYProductVariableSelection];let X=!1;return"couponAppliesTo"===u&&(X=G.some(Boolean)),"buyX"===u&&(X=Q.some(Boolean)),"getY"===u&&(X=Y.some(Boolean)),i(o,{children:[i("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(d===U.ENTITLED&&!B.entitledProductVariable||d===U.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(N,{children:[t("div",Object.assign({style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:t(a,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(d)},error:X})})),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(b,Object.assign({color:h.colorsV2.content.placeholder},{children:"OR"})),t(a,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(d)},error:X})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",Object.assign({style:{width:"300px",display:"flex"}},{children:t(a,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(d)},style:{marginTop:"16px"},error:X})}))]})),X&&t("div",Object.assign({style:{margin:"8px 0 0"}},{children:t(l,{type:s.NEGATIVE,text:"Required Field",contentPosition:r.START,icon:()=>t(n,{width:16,height:16,color:h.colorsV2.content.negative})})})),_.length||q.length?i("div",{children:[t(b,Object.assign({style:{margin:"8px 0"}},{children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i(A,{children:[t(L,{children:t(I,{width:20,height:20,color:h.colorsV2.content.secondary})}),i(T,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(F,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(d):B.setIsCollectionPickerOpen(d)}},{children:t(S,{width:24,height:24,color:h.colorsV2.content.placeholder})})),t(F,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?d===U.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):d===U.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])}},{children:t(V,{width:24,height:24,color:h.colorsV2.content.placeholder})}))]}))]})]}):d===U.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(b,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(T,{children:B.entitledProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(F,Object.assign({onClick:()=>{B.setEntitledProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):d===U.PREREQUISITE&&(null===(R=B.preRequisiteProductVariable)||void 0===R?void 0:R.displayName)?i("div",{children:[t(b,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(T,{children:B.preRequisiteProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(F,Object.assign({onClick:()=>{B.setPreRequisiteProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,s,r,a,d,p,m,C,v;let E=[],g=[],h={},O={};B.useNewPicker?(h=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,O=null!==(n=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==O?void 0:O.isCustom)&&delete O.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((i=>{E.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(O).forEach((e=>{"isCustom"!==e&&g.push({id:e,name:O[e].name,image:O[e].image})}))):(E=e===U.ENTITLED?B.entitledProducts:B.prerequisiteProducts,g=null!==(l=e===U.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const P=e===U.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,I=e===U.PREREQUISITE?U.PREREQUISITE:U.ENTITLED,V=P===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(T,Object.assign({style:{marginBottom:16}},{children:e===U.PREREQUISITE?"Customer buys":"Customer gets"})),i("div",Object.assign({style:{display:"flex"}},{children:[!o&&t("div",{children:i("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:e===U.ENTITLED?null!==(r=null===(s=B.discountData.entitledQuantity)||void 0===s?void 0:s.toString())&&void 0!==r?r:"":null!==(d=null===(a=B.discountData.prerequisiteQuantity)||void 0===a?void 0:a.toString())&&void 0!==d?d:"",type:"number",onChangeText:i=>{e===U.ENTITLED?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledQuantity:parseInt(i)})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===U.PREREQUISITE&&(null===(p=B.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidBuyXValue)||e===U.ENTITLED&&(null===(m=B.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYValue)?"Required Field":"",state:e===U.PREREQUISITE&&(null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===U.ENTITLED&&(null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidGetYValue)?"invalid":"none"})})),t("div",{className:"input__wrapper"})]}))}),i("div",{children:[t(b,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===U.PREREQUISITE&&t(D,{width:"244px",options:H,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToBuy(e.value),B.setPrerequisiteProducts([]),B.setPrerequisiteCollections([]),B.setPreRequisiteProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===U.ENTITLED&&t(D,{width:"244px",options:J,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToGet(e.value),B.setEntitledProducts([]),B.setEntitledCollections([]),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),K(V,I,e===U.PREREQUISITE?"buyX":"getY")]})};return i(x,{children:[i("div",{children:[i("div",Object.assign({style:{display:"flex",gap:16}},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(M=B.discountData.title)&&void 0!==M?M:"",onChangeText:e=>{var i;B.setDiscountData(Object.assign(Object.assign({},B.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(G=B.currency)&&void 0!==G?G:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(Q=B.dynamicDiscountValidationError)||void 0===Q?void 0:Q.invalidCouponTitle)?"Required Field":"",state:(null===(Y=B.dynamicDiscountValidationError)||void 0===Y?void 0:Y.invalidCouponTitle)?"invalid":"none"})})),!B.hideProbability&&t(y,{value:null!==($=null===(X=B.discountData.probability)||void 0===X?void 0:X.toString())&&void 0!==$?$:"",type:"number",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(W=B.dynamicDiscountValidationError)||void 0===W?void 0:W.inValidProbability)?"Required Field":"",state:(null===(z=B.dynamicDiscountValidationError)||void 0===z?void 0:z.inValidProbability)?"invalid":"none"})]})),t("div",{style:{height:"1px",width:"100%",background:h.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t((()=>i("div",{children:[t(g,{children:"Discount Details"}),t(R,{children:B.discountDetailsOptions.map((t=>{return i(_,Object.assign({selected:B.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(B.selectedDiscountDetails.id!==i.id)if(B.resetValidationErrors(),B.setValidationErrorMessage(""),B.setDiscountCouponAppliesTo(c.ENTIRE_ORDER),B.setSelectedDiscountDetails(i),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0})),B.setPreRequisiteProductVariable(void 0),B.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){B.onChangeCouponType({label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},B.discountData),{valueType:"percentage"===i.value?C.PERCENTAGE:C.FIXED_AMOUNT,value:void 0,targetType:v.LINE_ITEM,targetSelection:E.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e(t,["entitledQuantity","prerequisiteQuantity"]);B.setDiscountData(o)}else B.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,B.selectedDiscountDetails.id===o?h.colorsV2.stroke.brand:h.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(B.selectedCouponType===p.AMOUNT_OFF_ORDER||B.selectedCouponType===p.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,n,l,s,r,a;return i(o,{children:[t("div",Object.assign({className:"input__rows"},{children:t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(l=null===(n=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===n?void 0:n.toString())&&void 0!==l?l:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:B.discountData.valueType===C.FIXED_AMOUNT?null!==(s=B.currency)&&void 0!==s?s:"":void 0,suffixText:B.discountData.valueType===C.PERCENTAGE?"%":void 0,errorMessage:(null===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"Required Field":"",state:(null===(a=B.dynamicDiscountValidationError)||void 0===a?void 0:a.inValidDiscountAmount)?"invalid":"none"})}))})),t("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:i("div",Object.assign({className:"input__wrapper"},{children:[t(g,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),t("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:t(D,{width:"300px",options:Z,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===c.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:p.AMOUNT_OFF_PRODUCTS};B.onChangeCouponType(i),B.setDiscountCouponAppliesTo(e.value),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS||B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS)&&K(B.discountCouponAppliesTo,U.ENTITLED,"couponAppliesTo")]}))}))]})})(),B.selectedCouponType===p.BUY_X_GET_Y&&(()=>{var e,o,n,l,s;return i(x,Object.assign({style:{border:`1px solid ${h.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[ee(U.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:h.colorsV2.stroke.primary,margin:"8px 0"}}),ee(U.ENTITLED),t(b,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),t("div",{children:t(P,{label:"Free",isActive:100===B.discountData.value,onValueChange:e=>{e?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:100})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}})}),i("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[t(P,{label:"Percentage off",isActive:100!==B.discountData.value,onValueChange:()=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}}),100!==B.discountData.value&&t("div",Object.assign({style:{marginTop:8}},{children:t(y,{value:null!==(n=null===(o=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===o?void 0:o.toString())&&void 0!==n?n:"",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(l=B.dynamicDiscountValidationError)||void 0===l?void 0:l.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!B.selectedCouponType&&t(k,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:t(q,{selectedMinimumRequirement:B.selectedMinimumRequirement,setSelectedMinimumRequirement:B.setSelectedMinimumRequirement,discountData:B.discountData,setDiscountData:B.setDiscountData,currency:B.currency,dynamicDiscountValidationError:B.dynamicDiscountValidationError})})),B.selectedCouponType&&!B.hideExpiration&&i("div",Object.assign({style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${h.colorsV2.stroke.primary}`:"none"}},{children:[t(d,{label:"Add expiration",isDisabled:!!B.makeExpiryMandatory,isChecked:B.isAddExpirationChecked,onValueChange:e=>{B.setIsAddExpirationChecked(e),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{expireAfter:void 0,expireAt:void 0})),B.setSelectedExpiration(m.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),t(b,Object.assign({style:{color:h.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),B.isAddExpirationChecked&&t(f,{discountData:B.discountData,setDiscountData:B.setDiscountData,isAddExpirationChecked:B.isAddExpirationChecked,inValidCouponExpiry:B.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:B.selectedExpiration,setSelectedExpiration:B.setSelectedExpiration})]}))]})};export{U as DISCOUNT_PRODUCTS,B as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DropdownProps } from
|
|
2
|
+
import { DropdownProps } from './Dropdown';
|
|
3
3
|
export declare const ChipDropdown: React.FC<DropdownProps>;
|
|
4
4
|
export declare const ChipDropdownContainer: import("styled-components").StyledComponent<"div", any, {
|
|
5
5
|
width?: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as
|
|
1
|
+
import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as i}from"react";import n from"styled-components";import{Tag as s}from"../tag/Tag.js";import{COLORS as l}from"../../constants/Theme.js";import p from"../../assets/icons/chevronDown.svg.js";import a from"../../assets/icons/chevronDownOutline.svg.js";import c from"../../assets/icons/chevronUpOutline.svg.js";import{BodySecondary as d}from"../TypographyStyle.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";const m=n=>{var{placeHolder:m,onSelect:f}=n,u=t(n,["placeHolder","onSelect"]);const[v,j]=r(!1),w=i();return e(h,Object.assign({ref:w,onDropdownVisbilityChange:t=>j(t),onSelect:function(t){null==f||f(t)}},u,{children:"default"==u.inputType?o(g,Object.assign({width:null==u?void 0:u.width,height:null==u?void 0:u.height},{children:[e(d,Object.assign({color:l.content.placeholder},{children:m})),e(p,{style:{transform:v?"rotate(180deg)":"rotate(0deg)"},width:20,height:20,color:l.content.primary})]})):e(s,{tagText:null!=m?m:"",theme:"light",type:"neutral",variant:"regular",TrailingIcon:v?c:a})}))};m.displayName="ChipDropdown";const g=n.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: row;
|
|
4
4
|
width: ${t=>(null==t?void 0:t.width)?t.width:"240px"};
|
|
@@ -6,9 +6,9 @@ import{__rest as t}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as e}from
|
|
|
6
6
|
gap: 8px;
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
align-items: center;
|
|
9
|
-
border: 1px solid ${
|
|
9
|
+
border: 1px solid ${l.stroke.primary};
|
|
10
10
|
border-radius: 4px;
|
|
11
11
|
padding-left: 8px;
|
|
12
12
|
padding-right: 8px;
|
|
13
13
|
cursor: pointer;
|
|
14
|
-
`;export{
|
|
14
|
+
`;export{m as ChipDropdown,g as ChipDropdownContainer};
|
|
@@ -7,6 +7,8 @@ interface ChipInputProps {
|
|
|
7
7
|
containerStyle?: React.CSSProperties;
|
|
8
8
|
isDropdownOpened?: boolean;
|
|
9
9
|
sizeToUse?: 'default' | 'small' | 'x-small';
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
showLabelsOnMoreHover?: boolean;
|
|
10
12
|
}
|
|
11
13
|
declare const ChipInput: React.FC<ChipInputProps>;
|
|
12
14
|
export default ChipInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as s}from"react/jsx-runtime";import{useState as o,useEffect as l}from"react";import i from"../../utils/StringUtils.js";import{COLORS as r}from"../../constants/Theme.js";import n from"../../assets/icons/chevronDown.svg.js";import c from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/errorInfo.svg.js";import{InputFooter as d}from"../input/Input.styled.js";import{Tag as h}from"../tag/Tag.js";import{Tooltip as m}from"../tooltips/Tooltip.js";import{BodyCaption as p}from"../TypographyStyle.js";import{ChipInputWrapper as g}from"./Common.styled.js";const j=j=>{let{chips:b,onDeleteChip:f,containerStyle:v={},sizeToUse:y="default",isDropdownOpened:O,placeholder:u="Select..",errorMessage:x="",showLabelsOnMoreHover:T=!1}=j;const[w,I]=o(),[C,S]=o(0),[z,D]=o([]);return l((()=>{if(!b)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(b);let s=b.filter((s=>(e+=s.label.length,e<=t)));0===s.length&&b.length>0&&(s=[b[0]]),I(s);const o=b.filter((e=>!s.includes(e))).map((e=>e.label));D(o),S(b.length-s.length)}),[b]),e(t,{children:[e(g,Object.assign({style:Object.assign({},v),error:!!x},{children:[e("div",Object.assign({className:"chips-container"},{children:[null==w?void 0:w.map(((e,t)=>s("div",Object.assign({style:{zIndex:2}},{children:s(h,Object.assign({tagText:i.truncateText(e.selectedLabel||e.label,40),TrailingIcon:()=>s(c,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{f(e)}})},{children:e.selectedLabel||e.label}))}),t))),!!C&&s("div",Object.assign({style:{position:"relative",zIndex:2,pointerEvents:"auto"}},{children:s(m,Object.assign({body:"",placement:"bottom",tooltipContent:T&&z.length>0?s("div",Object.assign({style:{padding:"4px"}},{children:z.map(((e,t)=>s(p,Object.assign({style:{color:r.text.white}},{children:e}),t)))})):void 0},{children:s(p,Object.assign({color:r.content.placeholder},{children:`+${C} more`}))}))})),0===b.length&&s("div",Object.assign({style:{color:r.content.placeholder}},{children:u}))]})),s("div",{children:s(n,{style:{transform:O?"rotate(180deg)":"rotate(0deg)"},width:"x-small"===y?16:"small"===y?20:24,height:"x-small"===y?16:"small"===y?20:24,color:r.content.primary})})]})),!!x&&e(d,Object.assign({invalid:!0},{children:[!!x&&s(a,{width:16,height:16}),x]}))]})};export{j as default};
|
|
@@ -4,4 +4,6 @@ export declare const OverLapAbs: import("styled-components").StyledComponent<"di
|
|
|
4
4
|
}, never>;
|
|
5
5
|
export declare const OpenDropdownContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const LoadingContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export declare const ChipInputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
export declare const ChipInputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
error?: boolean | undefined;
|
|
9
|
+
}, never>;
|
|
@@ -27,7 +27,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
27
27
|
justify-content: space-between;
|
|
28
28
|
align-items: center;
|
|
29
29
|
border-radius: 4px;
|
|
30
|
-
border: 1px solid ${i.stroke.primary};
|
|
30
|
+
border: ${e=>e.error?`1px solid ${i.stroke.negative.vibrant}`:`1px solid ${i.stroke.primary}`};
|
|
31
31
|
.chips-container {
|
|
32
32
|
display: flex;
|
|
33
33
|
gap: 8px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as r,useEffect as i}from"react";import{COLORS as s}from"../../constants/Theme.js";import a from"../../assets/icons/chevronDown.svg.js";import{Input as d}from"../input/Input.js";import{InputStyleContext as c}from"../input/context/InputStyleProvider.js";import p from"./ChipInput.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const v=v=>{var g,f,w,b,x,{placeHolder:I,size:j,onSelect:O,defaultOptions:y,disabled:H,noErrorHint:S,placeHolderHeight:T,showPlaceholderWhenSelected:D=!1,inputStyle:P={},inputType:C="default",onDeleteChip:E,truncatedText:L,showLeadingIconInPlaceholder:M=!1,showTrailingIconPlaceholder:z=!1,showLabelsOnMoreHover:W=!1}=v,A=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover"]);const[_,k]=l(!1),N=null!=j?j:"default",U=r(),[V,q]=l(null!=y?y:[]);i((()=>{var e;const o=[];null===(e=null==A?void 0:A.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),q([...o])}),[A.options]),i((()=>{y&&q([...y])}),[y]);const B=u(V);return o(c.Provider,Object.assign({value:{InputWrapper:Object.assign({height:T||("x-small"===N?24:"small"===N?32:48),width:null!==(f=null!==(g=A.buttonWidth)&&void 0!==g?g:A.width)&&void 0!==f?f:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===N?"4px 8px":"6px 8px"},P),input:{minHeight:"100%"}}},{children:n(h,Object.assign({"data-test":A["data-test"],ref:U,onSelect:function(e){Array.isArray(e)?q([...e]):q([e]),null==O||O(e)},disabled:H,onDropdownVisbilityChange:e=>k(e)},A,{children:["default"==C&&o(d,{version:A.version,noErrorHint:S,state:H?"disabled":"none",value:D?I:null!=B?B:"",errorMessage:A.error,variant:N,placeholder:null!=I?I:"Select an option",width:null!==(w=A.width)&&void 0!==w?w:"100%",onChangeText:m,leftIcon:M&&(null===(b=V[0])||void 0===b?void 0:b.leadingIcon)?{icon:()=>{var e;return o(t,{children:null===(e=V[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n("div",Object.assign({style:{display:"flex"}},{children:[z&&(null===(e=V[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:_?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===N?16:"small"===N?20:24,height:"x-small"===N?16:"small"===N?20:24,color:s.content.primary})]}))}},truncateText:null==L||L}),"chip"==C&&o(p,{placeholder:null!=I?I:"Select options",chips:V,onDeleteChip:e=>{null==E||E(e)},errorMessage:A.error,isDropdownOpened:_,sizeToUse:N,containerStyle:{width:null!==(x=A.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:W})]}))}))};v.displayName="Dropdown";export{v as Dropdown};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsx as o,jsxs as e}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as o,jsxs as e}from"react/jsx-runtime";import i from"../../../assets/icons/horizontal_dots.svg.js";import r from"../../../assets/icons/vertical_dots.svg.js";import s from"styled-components";import{IconButton as t}from"../../icon-button/IconButton.js";import{COLORS as n}from"../../../constants/Theme.js";import{DropdownPopover as a}from"../DropdownPopover/index.js";const d=s.div`
|
|
2
2
|
:hover {
|
|
3
|
-
background: ${
|
|
3
|
+
background: ${n.surface.subdued};
|
|
4
4
|
}
|
|
5
5
|
position: ${o=>o.isNewTag?"relative":""};
|
|
6
6
|
.new--tag {
|
|
@@ -11,10 +11,10 @@ import{jsx as o,jsxs as e}from"react/jsx-runtime";import t from"../../../assets/
|
|
|
11
11
|
border-radius: 50%;
|
|
12
12
|
width: 14px;
|
|
13
13
|
height: 14px;
|
|
14
|
-
background: ${
|
|
15
|
-
border: 1.25px solid ${
|
|
14
|
+
background: ${n.background.negative.vibrant};
|
|
15
|
+
border: 1.25px solid ${n.surface.standard};
|
|
16
16
|
display: flex;
|
|
17
17
|
justify-content: center;
|
|
18
18
|
align-items: center;
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,c=s=>o(d,Object.assign({isNewTag:s.isNewTag},{children:e(a,Object.assign({},s,{children:[o("div",{children:o(t,{Icon:s.isHorizontal?i:r,bordered:!(null==s?void 0:s.hideBorder)})}),s.isNewTag?o("div",{className:"new--tag"}):null]}))}));c.displayName="MenuItemDropdown";export{c as MenuItemDropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as i}from"react";import{ZeroState as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as i}from"react";import{ZeroState as r}from"../../../zeroState/ZeroState.js";import{useOutside as s}from"../../../../hooks/useOutside.js";import{useDropdown as l}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as u}from"./menu/MenuList.js";import{SelectAllMenu as p}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const b=304,g=290,j=j=>{let{options:O,isSearchable:v,isMultiSelect:w,maxSelections:y,width:C,allowFreeForm:x,height:D,onClose:M,onSelect:L,onSearch:k,version:A,skipSorting:F,headerRef:I,hideSelectAll:B,primaryButtonText:H,onInfiniteScroll:T,onMultiSelectClear:z,onDropdownItemClick:R,buttonOptions:W,isSearchLoading:Z,disableSearchOptions:q,disableSearchedOptionExcept:E,useDefaultCursor:K,containerStyle:N={},zeroState:P}=j;const{dropdownOptions:G,search:J,searchedString:Q,searchedOptions:U,onApplyHandler:V,selectAllHandler:X,onMultiSelectClear:Y,onFreeFormSelect:$,onMultiSelectApply:_,latestDropdownOptionsRef:ee,getSelectedOptions:te,getCurrentSelectionCount:oe}=l(A,O,L,F,w,k,q,E,y),[ne,ie]=o(null!=C?C:g),[re,se]=o(null),le=n(null),ce=n([]);s(le,(()=>{if(se(null),w&&"2.0"===A){const e=te(ee.current);null==M||M(e)}else null==M||M(G)}),[I,ce]);const ae=null!=D?D:b,ue="number"==typeof ae?v&&w?ae-96:v&&!w||!v&&w?ae-48:ae:ae;i((()=>{const e=null!=C?C:g;if(null===re)ie(e);else if("number"==typeof e)ie(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ie(t)}}),[re]);const pe=[],de=(e=>{if(!w||!y&&0!==y)return e;const t=oe(e)>=y;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((Q&&k?U:G).map((e=>{var t,o;if(Q&&!k){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Q.toLowerCase()))&&(pe.push(!Q||e.label===Q),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Q.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(Q.toLowerCase()))?(pe.push(!Q||e.label===Q),e):null}return e})).filter((e=>null!==e))),he=!!v&&Q&&0===de.length;return e(h,Object.assign({version:A,ref:le,style:Object.assign({width:ne},N)},{children:[e("div",Object.assign({style:{width:re?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!v&&t(f,{onSearch:J,version:A}),de.length||Q?e(m,Object.assign({minHeight:ae,maxHeight:ue},{children:[!!w&&!he&&!B&&t(p,{version:A,options:Q&&k?U:G,onSelect:X}),!x&&he&&t(S,{isLoading:Z,height:ue,searchedString:Q,containerWidth:C}),x&&(he||!!pe.length&&pe.every((e=>!1===e)))&&t(a,{version:A,isMultiSelect:w,onSelect:$,searchedString:Q}),t(u,{onInfiniteScroll:T,onDropdownItemClick:R,version:A,onSelect:V,showDescription:function(e,t){se(e&&t?{title:e,description:t}:null)},isMultiSelect:w,options:de,useDefaultCursor:K,ref:ce})]})):t("div",Object.assign({style:{height:ae,display:"flex"}},{children:t(r,Object.assign({},P,{title:(null==P?void 0:P.title)||"No results found",subTitle:(null==P?void 0:P.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!w&&!(!de.length&&!Q)&&"2.0"!==A&&t(d,{onClear:()=>{Y(),null==z||z()},onApply:_,list:Q&&k?U:G,buttonText:H,buttonOptions:W})]})),!!re&&t(c,{title:re.title,description:re.description,version:A})]}))};export{j as OpenedDropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{ZeroState as e}from"../../../../zeroState/ZeroState.js";const i=i=>{let{searchedString:r,height:n,isLoading:o,containerWidth:s}=i;return t("div",Object.assign({style:{height:n,display:"flex",alignItems:"center"}},{children:t(e,{isLoading:o,title:"No results found",subTitle:`Sorry we could not find any results for "${null!=r?r:""}"`,containerWidth:s})}))};export{i as SearchZeroState};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SelectAllCheckboxState } from '../OpenedDropdown/components/menu/SelectAllMenu';
|
|
3
3
|
import { DropdownOption, SingleOption } from '../type';
|
|
4
|
-
export declare const useDropdown: (version: string | undefined, options: DropdownOption[], onSelect: ((option: DropdownOption | DropdownOption[]) => void) | undefined, skipSorting?: boolean, isMultiSelect?: boolean, onSearch?: ((searchKey: string) => Promise<DropdownOption[]>) | undefined, disableOtherSearchedOption?: boolean, disableSearchedOptionExcept?: string[]) => {
|
|
4
|
+
export declare const useDropdown: (version: string | undefined, options: DropdownOption[], onSelect: ((option: DropdownOption | DropdownOption[]) => void) | undefined, skipSorting?: boolean, isMultiSelect?: boolean, onSearch?: ((searchKey: string) => Promise<DropdownOption[]>) | undefined, disableOtherSearchedOption?: boolean, disableSearchedOptionExcept?: string[], maxSelections?: number) => {
|
|
5
5
|
latestDropdownOptionsRef: import("react").MutableRefObject<DropdownOption[]>;
|
|
6
6
|
dropdownOptions: DropdownOption[];
|
|
7
7
|
search: (searchKey: string) => void;
|
|
@@ -46,4 +46,7 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
46
46
|
onFreeFormSelect: (selected: boolean) => void;
|
|
47
47
|
onMultiSelectApply: (options?: DropdownOption[]) => void;
|
|
48
48
|
getSelectedOptions: (data: DropdownOption[]) => DropdownOption[];
|
|
49
|
+
getCurrentSelectionCount: (data: DropdownOption[]) => number;
|
|
50
|
+
isMaxSelectionsReached: (data: DropdownOption[]) => boolean;
|
|
51
|
+
maxSelections: number | undefined;
|
|
49
52
|
};
|