@bikdotai/bik-component-library 0.0.685-beta.2 → 0.0.685-beta.3
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/assets/icons/CheckSquareOffset.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/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/alerts/Alert.d.ts +0 -3
- package/dist/cjs/components/alerts/Alert.js +1 -1
- package/dist/cjs/components/alerts/Alert.styled.d.ts +0 -2
- package/dist/cjs/components/alerts/Alert.styled.js +2 -10
- package/dist/cjs/components/alerts/AlertHelper.d.ts +1 -2
- 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 +0 -13
- 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 +0 -2
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +0 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +2 -6
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/cjs/components/avatar/Avatar.d.ts +1 -4
- 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 +1 -2
- package/dist/cjs/components/avatar/AvatarHelper.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.d.ts +4 -2
- 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/checkBox/CheckBox.d.ts +0 -1
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +0 -6
- 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 +0 -5
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +5 -18
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.d.ts +0 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +4 -50
- package/dist/cjs/components/data-source-panel/model.d.ts +7 -14
- package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +4 -1
- 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/discount-modal/DiscountModal.d.ts +0 -2
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +2 -1
- 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 +0 -2
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/Common.styled.d.ts +1 -3
- package/dist/cjs/components/dropdown/Common.styled.js +4 -4
- package/dist/cjs/components/dropdown/Dropdown.d.ts +0 -1
- 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 +0 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +1 -4
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +0 -1
- package/dist/cjs/components/input/Input.d.ts +0 -3
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.styled.d.ts +0 -1
- package/dist/cjs/components/input/Input.styled.js +1 -1
- package/dist/cjs/components/modals/Modal.d.ts +0 -2
- package/dist/cjs/components/modals/Modal.js +1 -1
- package/dist/cjs/components/modals/modal.styled.d.ts +0 -6
- package/dist/cjs/components/modals/modal.styled.js +1 -1
- package/dist/cjs/components/modals/styledModal.d.ts +0 -2
- 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 +0 -1
- package/dist/cjs/components/plans/SubscriptionPlan.js +1 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +1 -3
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +13 -9
- 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 +3 -5
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +1 -3
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -3
- package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.d.ts +0 -11
- package/dist/cjs/components/product-picker-v2/style.js +18 -53
- package/dist/cjs/components/product-picker-v2/type.d.ts +0 -7
- package/dist/cjs/components/product-picker-v2/type.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -3
- 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 +0 -1
- package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js +1 -1
- package/dist/cjs/components/states-modal/StateModalComponent.d.ts +0 -1
- 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/model.d.ts +1 -12
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +0 -2
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +0 -3
- 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 +0 -1
- 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 +5 -7
- 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 +1 -0
- 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/zeroState/ZeroState.d.ts +0 -1
- package/dist/cjs/components/zeroState/ZeroState.js +1 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/CheckSquareOffset.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/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/alerts/Alert.d.ts +0 -3
- package/dist/esm/components/alerts/Alert.js +1 -1
- package/dist/esm/components/alerts/Alert.styled.d.ts +0 -2
- package/dist/esm/components/alerts/Alert.styled.js +5 -13
- package/dist/esm/components/alerts/AlertHelper.d.ts +1 -2
- 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 +0 -13
- 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 +0 -2
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +1 -5
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/esm/components/avatar/Avatar.d.ts +1 -4
- 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 +1 -2
- package/dist/esm/components/avatar/AvatarHelper.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/carousel-secondary/CarouselSecondary.d.ts +4 -2
- 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/checkBox/CheckBox.d.ts +0 -1
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +0 -6
- 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 +0 -5
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +5 -18
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +0 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +3 -49
- package/dist/esm/components/data-source-panel/model.d.ts +7 -14
- package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +4 -1
- 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/discount-modal/DiscountModal.d.ts +0 -2
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +2 -1
- 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 +0 -2
- package/dist/esm/components/dropdown/ChipInput.js +1 -1
- package/dist/esm/components/dropdown/Common.styled.d.ts +1 -3
- package/dist/esm/components/dropdown/Common.styled.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +0 -1
- 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 +0 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +1 -4
- package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +0 -1
- package/dist/esm/components/input/Input.d.ts +0 -3
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.styled.d.ts +0 -1
- package/dist/esm/components/input/Input.styled.js +1 -1
- package/dist/esm/components/modals/Modal.d.ts +0 -2
- package/dist/esm/components/modals/Modal.js +1 -1
- package/dist/esm/components/modals/modal.styled.d.ts +0 -6
- package/dist/esm/components/modals/modal.styled.js +1 -1
- package/dist/esm/components/modals/styledModal.d.ts +0 -2
- 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 +0 -1
- package/dist/esm/components/plans/SubscriptionPlan.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +1 -3
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +13 -9
- 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 +3 -5
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
- package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +1 -3
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -3
- package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/style.d.ts +0 -11
- package/dist/esm/components/product-picker-v2/style.js +16 -51
- package/dist/esm/components/product-picker-v2/type.d.ts +0 -7
- package/dist/esm/components/product-picker-v2/type.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.d.ts +1 -3
- 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 +0 -1
- package/dist/esm/components/progress-bar-v2/ProgressBarV2.js +1 -1
- package/dist/esm/components/states-modal/StateModalComponent.d.ts +0 -1
- 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/model.d.ts +1 -12
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +0 -2
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +0 -3
- 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 +0 -1
- 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 +5 -7
- 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 +1 -0
- 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/zeroState/ZeroState.d.ts +0 -1
- package/dist/esm/components/zeroState/ZeroState.js +5 -5
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/_virtual/bik-store.js +0 -1
- package/dist/cjs/assets/icons/bik_livechat.svg.js +0 -1
- package/dist/cjs/assets/icons/task.svg.js +0 -1
- package/dist/cjs/components/carousel-secondary/model.d.ts +0 -4
- package/dist/cjs/components/carousel-secondary/model.js +0 -1
- package/dist/cjs/components/data-source-panel/IntentConfig.d.ts +0 -5
- package/dist/cjs/components/data-source-panel/IntentConfig.js +0 -1
- package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.d.ts +0 -8
- package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.js +0 -48
- package/dist/cjs/components/datePicker/model.d.ts +0 -4
- package/dist/cjs/components/datePicker/model.js +0 -1
- package/dist/cjs/components/tag/Tag.stories.d.ts +0 -22
- package/dist/cjs/components/variable-picker-v3/highlightSearchText.d.ts +0 -1
- package/dist/cjs/components/variable-picker-v3/highlightSearchText.js +0 -1
- package/dist/cjs/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +0 -1
- package/dist/esm/_virtual/bik-store.js +0 -1
- package/dist/esm/assets/icons/bik_livechat.svg.js +0 -1
- package/dist/esm/assets/icons/task.svg.js +0 -1
- package/dist/esm/components/carousel-secondary/model.d.ts +0 -4
- package/dist/esm/components/carousel-secondary/model.js +0 -1
- package/dist/esm/components/data-source-panel/IntentConfig.d.ts +0 -5
- package/dist/esm/components/data-source-panel/IntentConfig.js +0 -1
- package/dist/esm/components/data-source-panel/Modals/DescriptionModal.d.ts +0 -8
- package/dist/esm/components/data-source-panel/Modals/DescriptionModal.js +0 -48
- package/dist/esm/components/datePicker/model.d.ts +0 -4
- package/dist/esm/components/datePicker/model.js +0 -1
- package/dist/esm/components/tag/Tag.stories.d.ts +0 -22
- package/dist/esm/components/variable-picker-v3/highlightSearchText.d.ts +0 -1
- package/dist/esm/components/variable-picker-v3/highlightSearchText.js +0 -1
- package/dist/esm/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +0 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
3
2
|
import { footerButtonOptionModel, MessageSource } from './model';
|
|
4
3
|
interface SourceInfoFooterProps {
|
|
5
|
-
appType: ApplicationType;
|
|
6
4
|
sourceIntent: string;
|
|
7
5
|
messageSource?: MessageSource;
|
|
8
6
|
hideAddDataButton?: boolean;
|
|
@@ -16,9 +14,6 @@ interface SourceInfoFooterProps {
|
|
|
16
14
|
ShowTrainingDataSource: Record<string, string>;
|
|
17
15
|
ChecklistType: Record<string, string>;
|
|
18
16
|
footerButtonOption?: footerButtonOptionModel;
|
|
19
|
-
isFooterLoading?: boolean;
|
|
20
|
-
reasonForAiGeneratedResponse?: string;
|
|
21
|
-
showAiResponseReason?: boolean;
|
|
22
17
|
}
|
|
23
18
|
declare const SourceInfoFooter: import("react").MemoExoticComponent<(props: SourceInfoFooterProps) => import("react/jsx-runtime").JSX.Element>;
|
|
24
19
|
export default SourceInfoFooter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/alert_triangle.svg.js"),n=require("../../assets/icons/plus.svg.js"),i=require("react"),s=require("../../constants/Theme.js"),o=require("../button/Button.js"),a=require("../TypographyStyle.js"),r=require("./DataSourcePanel.style.js");const d=i.memo((d=>{const{sourceIntent:u,hideHeading:c,messageSource:h,trainingSourceCount:g={},ShowTrainingDataSource:j={},ChecklistType:m,footerButtonOption:x}=d,[y,v]=i.useState({}),O=j,[T,C]=i.useState(!0),[b,p]=i.useState(!0),f=i.useMemo((()=>{const e=(null==g?void 0:g[u])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[g,u]);return i.useEffect((()=>{var e,t;if(u){if(null===(e=null==h?void 0:h.sources)||void 0===e?void 0:e.length)if(O[u])u===m.ORDER_ENQUIRY&&p(!1);else{const e=null!==(t=null==x?void 0:x.title)&&void 0!==t?t:h.sources[0].insights,n=null==x?void 0:x.subtitle;v({title:e,subTitle:n})}(O[u]||[m.PRODUCT_DETAILS,m.ORDER_MODIFICATION,m.ORDER_CANCELLATION,m.ORDER_TRACKING].includes(u))&&C(!1)}}),[null==h?void 0:h.messageId,g,u]),e.jsx(r.SourceInfoFooterStyle,{children:!y.title&&g&&u in g?e.jsxs(e.Fragment,{children:[e.jsx(l,{hideHeading:null!=c&&c}),e.jsxs("div",Object.assign({className:"source_info_details "+(g[u]>0?"":"no_data_source")},{children:[g[u]>0&&b?e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:f}),e.jsx(a.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):b&&e.jsxs("div",Object.assign({className:"no_data_source_title"},{children:[e.jsx(t.default,{width:15,height:15,color:s.COLORS.content.negative,style:{marginTop:2}}),e.jsx(a.BodyCaption,{children:"No data sources added to the identified link"})]})),!x||x.hideAddDataButton||T?e.jsx(e.Fragment,{}):e.jsx(o.Button,{size:"small",buttonType:"tertiary",LeadingIcon:n.default,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:x.onClick,style:{backgroundColor:"unset"}})]}))]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{hideHeading:null!=c&&c}),e.jsxs("div",Object.assign({className:"source_info_details"},{children:[b&&e.jsxs(e.Fragment,{children:[e.jsx(a.BodyCaption,{children:y.title}),e.jsx(a.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:y.subTitle}))]}),!x||x.hideAddDataButton||T?e.jsx(e.Fragment,{}):e.jsx(o.Button,{size:"small",buttonType:"tertiary",LeadingIcon:n.default,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:x.onClick,style:{backgroundColor:"unset"}})]}))]})})})),l=i.memo((t=>t.hideHeading?null:e.jsx(a.BodyCaption,Object.assign({color:s.COLORS.content.secondary},{children:"Training insights"}))));l.displayName="TrainingInsightsHeading",d.displayName="SourceInfoFooter",exports.default=d;
|
|
@@ -1,36 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
|
|
4
|
-
export interface CollapsibleSectionProps {
|
|
5
|
-
title: string;
|
|
6
|
-
count: number;
|
|
7
|
-
isExpanded: boolean;
|
|
8
|
-
onToggle: () => void;
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
}
|
|
2
|
+
import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource } from './model';
|
|
11
3
|
export interface DataSourcePanelProps {
|
|
12
4
|
storeId: string;
|
|
13
|
-
appType: ApplicationType;
|
|
14
5
|
messageSource: MessageSource;
|
|
15
6
|
setMessageSourcePanel: (source?: MessageSource) => void;
|
|
16
7
|
hideCloseButton?: boolean;
|
|
17
8
|
title?: string;
|
|
18
9
|
allSourceInfoDetail: AllSourceInfoDetailsCustomDataModel;
|
|
19
10
|
isSourceInfoFetched?: boolean;
|
|
11
|
+
faqCount: number;
|
|
20
12
|
editableSources: CustomDataType[];
|
|
21
13
|
redirect: (sourceInfo: InfoContent) => void;
|
|
22
|
-
|
|
14
|
+
trainingSourceCount: {
|
|
23
15
|
[k in string]: number;
|
|
24
16
|
};
|
|
25
17
|
zeroStateButton: DataSourcePanelZeroState;
|
|
26
18
|
ChecklistType: Record<string, string>;
|
|
19
|
+
IntentComponentMap: Record<string, JSX.Element>;
|
|
20
|
+
ShowTrainingDataSource: Record<string, string>;
|
|
27
21
|
footerButtonOption?: footerButtonOptionModel;
|
|
28
|
-
fetchTrainingSourceCount: (storeId: string) => Promise<{
|
|
29
|
-
[k in string]: number;
|
|
30
|
-
}>;
|
|
31
|
-
fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
|
|
32
|
-
productSourceData?: ProductSourceData;
|
|
33
|
-
reasonForAiGeneratedResponse?: string;
|
|
34
|
-
showAiResponseReason?: boolean;
|
|
35
22
|
}
|
|
36
23
|
export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/chevronDownOutline.svg.js"),i=require("../../assets/icons/chevronUpOutline.svg.js"),o=require("../../assets/icons/cross.svg.js"),n=require("../../assets/icons/edit.svg.js"),l=require("../../assets/icons/filePdf.svg.js"),a=require("../../assets/icons/help.svg.js"),r=require("../../assets/icons/info.svg.js"),d=require("../../assets/icons/openai.svg.js"),c=require("../../assets/icons/plus.svg.js"),u=require("../../assets/icons/redirect.svg.js"),p=require("../../assets/icons/text_t9.svg.js"),g=require("../../assets/icons/website.svg.js"),h=require("react"),x=require("../../constants/Theme.js"),j=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),y=require("../shimmer/ShimmerComponent/BikShimmer.js"),O=require("../side-modal/SideModal.js"),m=require("../tag/Tag.js"),v=require("../tooltips/Tooltip.js"),f=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),T=require("./DataSourcePanel.style.js"),I=require("./IntentConfig.js"),b=require("./Modals/DescriptionModal.js"),L=require("./model.js"),E=require("../../_virtual/bik-store.js");exports.DataSourcePanel=w=>{var D,N;const{appType:R,storeId:_,messageSource:A,setMessageSourcePanel:F,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:k,ChecklistType:P,title:M,zeroStateButton:U,editableSources:K,preFillTrainingSourceCount:W,redirect:H,footerButtonOption:$,fetchTrainingSourceCount:Q,fetchProductFAQCount:G,productSourceData:Y,reasonForAiGeneratedResponse:z,showAiResponseReason:X}=w,{sources:V}=A,J=["blog","article","page","policy"],[Z,ee]=h.useState(!1),[te,se]=h.useState(!1),[ie,oe]=h.useState(!1),[ne,le]=h.useState(0),[ae,re]=h.useState(),[de,ce]=h.useState(null!=W?W:{}),[ue,pe]=h.useState(!1),[ge,he]=h.useState(!1),xe={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;P[s]&&(xe[P[s]]=e.jsx(m.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const je=V.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Ce=V.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ye=h.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{P[t]&&(e[P[t]]=P[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[P]);h.useEffect((()=>{var e,t,s,i;if(!(null==A?void 0:A.messageId))return;ee(!0),se(!0),oe(!1!==(null===(t=null===(e=A.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=A.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=A.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));G(_,n).then((e=>le(e))).then((()=>{W?(ce(W),setTimeout((()=>{ee(!1),se(!1)}),100)):(setTimeout((()=>ee(!1)),100),Q(_).then((e=>ce(e))).then((()=>setTimeout((()=>{se(!1)}),100))))}))}),[G,Q,null==A?void 0:A.messageId,A.sources,W,_]);const Oe=e=>!!(e&&0===e.length||(null==A?void 0:A.isUnsatisfactoryAnswer)),me=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:J.includes(e)?e=L.CustomDataType.FETCHED_LINKS:"url"==e?e=L.CustomDataType.WEBSITE_LINKS:"text"===e?e=L.CustomDataType.TEXTS:"faq"===e&&(e=L.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")},ve=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",fe=s=>"products"==s||"product"==s?e.jsx(t.default,{height:16,width:16,color:x.COLORS.content.secondary}):"files"==s?e.jsx(l.default,{height:16,width:16,color:x.COLORS.content.secondary}):"website links"==s||"fetched links"==s?e.jsx(g.default,{height:16,width:16,color:x.COLORS.content.secondary}):"faq"==s?e.jsx(a.default,{height:16,width:16,color:x.COLORS.content.secondary}):"texts"==s?e.jsx(p.default,{height:16,width:16,color:x.COLORS.content.secondary}):e.jsx(d.default,{height:16,width:16,color:x.COLORS.content.secondary}),Se=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(Z||!B)return e.jsx(T.SourceInfoDetailsStyle,{children:e.jsx(y.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const Te=t=>{const{title:o,count:n,isExpanded:l,onToggle:a,children:r}=t;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(f.BodyCaption,Object.assign({style:{fontWeight:"600"}},{children:o})),R===E.__exports.ApplicationType.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:x.COLORS.surface.subdued,color:x.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:n})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:R===E.__exports.ApplicationType.BIK?e.jsx(e.Fragment,{}):l?e.jsx(s.default,{width:20,height:20,color:x.COLORS.content.primary}):e.jsx(i.default,{width:20,height:20,color:x.COLORS.content.primary})})]})),l&&r]})};return e.jsxs(e.Fragment,{children:[e.jsx(T.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!M&&e.jsx(f.TitleSmall,{children:M}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:"Intent"})),null!==(D=xe[A.intent])&&void 0!==D?D:xe.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>F(void 0)},{children:e.jsx(o.default,{height:20,width:20,color:x.COLORS.content.secondary})}))]})),Oe(V)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${x.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(r.default,{width:24,height:24,color:x.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(f.TitleSmall,{children:"Insufficient data"})})),e.jsx(f.BodySecondary,Object.assign({color:x.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),U&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(j.Button,{LeadingIcon:null!==(t=U.leadingIcon)&&void 0!==t?t:c.default,buttonText:null!==(s=U.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{U.onClick()}})}))]}))})()})):e.jsx(m.Tag,{LeadingIcon:r.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:A.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${R===E.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(V)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:je.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(Te,Object.assign({title:"Product Sources",count:je.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ue,onToggle:()=>pe(!ue)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:je.map(((t,s)=>{var i,o,l,a;const r=me(t.type||t.subTitle||"OpenAI"),d=me(t.type||t.subTitle||"OpenAI",!0),c=ve(r),p=null==K?void 0:K.includes(d),g=k[null!==(i=t.productId)&&void 0!==i?i:"Products"],h=t.title,j=t.productId&&(null==Y?void 0:Y[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==je?void 0:je.length)?`1px solid ${x.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[fe(r),e.jsx(v.Tooltip,Object.assign({body:h,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:h}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),j&&e.jsxs(f.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;re({title:h,description:Se(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>re(void 0)})}},{children:`${null===(o=j.description)||void 0===o?void 0:o.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(v.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Ce.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(Te,Object.assign({title:"Content Sources",count:Ce.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ge,onToggle:()=>he(!ge)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,l,a,r,d,c,p,g,h,j,y,O,m,S,T,I;const b=me(t.type||t.subTitle||"OpenAI"),E=me(t.type||t.subTitle||"OpenAI",!0),w=ve(b),D=null==K?void 0:K.includes(E),N="Products"===t.subTitle?k[null!==(i=t.productId)&&void 0!==i?i:"Products"]:k[null!==(o=t.docId)&&void 0!==o?o:""],R=E.toLowerCase()===(null===(l=L.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=L.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||E.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:E.toLowerCase()===(null===(p=L.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===P.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(h=null==N?void 0:N.data)||void 0===h?void 0:h.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=L.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())||E.toLowerCase()===(null===(m=L.CustomDataType.TEXTS)||void 0===m?void 0:m.toLowerCase())?null!==(I=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==I?I:"":t.intent===P.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ce?void 0:Ce.length)?`1px solid ${x.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[fe(b),e.jsx(v.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${x.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:x.COLORS.surface.subdued}},{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.primary,className:"clamp-description"},{children:Se(null!=_?_:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),ie&&!Oe(V)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(S.default,{appType:R,storeId:_,messageSource:A,sourceIntent:null!==(N=A.intent)&&void 0!==N?N:P.GENERIC,faqCount:ne,trainingSourceCount:de,ShowTrainingDataSource:ye,ChecklistType:P,footerButtonOption:$,isFooterLoading:te,reasonForAiGeneratedResponse:z,showAiResponseReason:X})}))]})}),ae&&e.jsx(O.SideModal,Object.assign({header:"Product description",onClose:()=>re(void 0),width:"30%"},{children:e.jsx(b.DescriptionModal,{title:ae.title,description:ae.description,imageUrl:ae.imageUrl,onClose:ae.onClose})}))]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),a=require("../../assets/icons/info.svg.js"),r=require("../../assets/icons/openai.svg.js"),l=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),y=require("../tag/Tag.js"),j=require("../tooltips/Tooltip.js"),v=require("../TypographyStyle.js"),m=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),L=require("./model.js");exports.DataSourcePanel=O=>{var S,T;const{storeId:I,messageSource:b,setMessageSourcePanel:w,hideCloseButton:E,faqCount:D=0,isSourceInfoFetched:q,allSourceInfoDetail:B,ChecklistType:N,IntentComponentMap:k,title:R,zeroStateButton:F,editableSources:_,redirect:A,trainingSourceCount:P,ShowTrainingDataSource:K,footerButtonOption:W}=O,{sources:M}=b,H=["blog","article","page","policy"],[Q,$]=p.useState(!1),[U,X]=p.useState(!1);p.useEffect((()=>{var e,t,s,i;(null==b?void 0:b.messageId)&&($(!0),setTimeout((()=>$(!1)),200),X(!1!==(null===(t=null===(e=b.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=b.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights)))}),[null==b?void 0:b.messageId]);const z=e=>!(0!==e.length&&!(null==b?void 0:b.isUnsatisfactoryAnswer)),G=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:H.includes(e)?e=L.CustomDataType.FETCHED_LINKS:"url"==e?e=L.CustomDataType.WEBSITE_LINKS:"text"===e?e=L.CustomDataType.TEXTS:"faq"===e&&(e=L.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")};return Q||!q?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsx(e.Fragment,{children:e.jsx(f.SourceInfoDetailsStyle,{children:!!(null==M?void 0:M.length)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!R&&e.jsx(v.TitleSmall,{children:R}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(S=k[b.intent])&&void 0!==S?S:k.GENERIC,!E&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>w(void 0)},{children:e.jsx(s.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),z(M)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(a.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(v.TitleSmall,{children:"Insufficient data"})})),e.jsx(v.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),F&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=F.leadingIcon)&&void 0!==t?t:l.default,buttonText:null!==(s=F.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{F.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:a.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:b.isEditable?"If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in Manifest.":"Edit the original source and save again to update the response"})]})),!z(M)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:M.map(((s,a)=>{var l,p,g,C,y,m,f,O,S,T,I,b,w,E;const D=G(s.type||s.subTitle||"OpenAI"),q=G(s.type||s.subTitle||"OpenAI",!0),k=(R=D)?"faq"==R.toLocaleLowerCase()?"FAQ":"openai"==R.toLocaleLowerCase()?"OPENAI":"files"==R.toLocaleLowerCase()?"PDF":"texts"==R.toLocaleLowerCase()?"Custom text":((R=(R=R.charAt(0).toUpperCase()+R.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(R=R.slice(0,-1)),R.replace("Website","Manual")):"";var R;const F=null==_?void 0:_.includes(q),P="Products"===s.subTitle?B[null!==(l=s.productId)&&void 0!==l?l:"Products"]:B[null!==(p=s.docId)&&void 0!==p?p:""],K=q.toLowerCase()===(null===(g=L.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(C=s.title)||void 0===C?void 0:C.toLowerCase())?s.subTitle:s.title:q.toLowerCase()===(null===(y=L.CustomDataType.FILES)||void 0===y?void 0:y.toLowerCase())||q.toLowerCase()===(null===(m=L.CustomDataType.FETCHED_LINKS)||void 0===m?void 0:m.toLowerCase())||q.toLowerCase()===(null===(f=L.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?s.title:q.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):s.intent===N.EMAIL_COLLECTION?k:s.title,W="faq"===q.toLowerCase()?null===(S=null==P?void 0:P.data)||void 0===S?void 0:S.answer:q.toLowerCase()===(null===(T=L.CustomDataType.FETCHED_LINKS)||void 0===T?void 0:T.toLowerCase())||q.toLowerCase()===(null===(I=L.CustomDataType.WEBSITE_LINKS)||void 0===I?void 0:I.toLowerCase())||q.toLowerCase()===(null===(b=L.CustomDataType.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(E=null===(w=null==P?void 0:P.data)||void 0===w?void 0:w.fileContentText)&&void 0!==E?E:"":s.intent===N.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${h.COLORS.stroke.primary}`}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(j.Tooltip,Object.assign({body:K,placement:"top"},{children:e.jsx(v.BodySecondary,Object.assign({style:q==L.CustomDataType.FETCHED_LINKS||q==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>q==L.CustomDataType.FETCHED_LINKS||q==L.CustomDataType.WEBSITE_LINKS?A(s):{}},{children:K}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==N.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(H=D,"products"==H?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==H?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==H||"fetched links"==H?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==H?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==H?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(r.default,{height:16,width:16,color:h.COLORS.content.secondary})),e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:k}))]}),(s.link||s.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:F?e.jsx(x.IconButton,{Icon:i.default,height:16,width:16,bordered:!0,onClick:()=>null==P?void 0:P.onEditClick(P.data,P.type),disabled:!P,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===s.type&&!P,disabledTooltip:"This source is deleted",onClick:()=>A(s)})}))]}))]})),(null!=W?W:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(v.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:(M=null!=W?W:"",M.replace(/(<([^>]+)>)/gi,"")).trim()}))}))]}),`info-${a}`);var M,H}))}))})),U&&!z(M)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(m.default,{storeId:I,messageSource:b,sourceIntent:null!==(T=b.intent)&&void 0!==T?T:N.GENERIC,faqCount:D,trainingSourceCount:P,ShowTrainingDataSource:K,ChecklistType:N,footerButtonOption:W})}))]})})})};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const SourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export declare const WithoutContentSourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const SourceInfoFooterStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const DataSourceCountStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,48 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),o=require("../../constants/Theme.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),o=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e);const l=r.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
margin: 0px 8px 0px 8px;
|
|
4
4
|
padding: 20px 0px 20px 0px;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
max-height: calc(100vh - 130px);
|
|
7
7
|
.info-container {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
border-radius: 8px;
|
|
11
|
-
gap: 12px;
|
|
12
|
-
}
|
|
13
|
-
.info-content-source {
|
|
14
|
-
border-radius: 8px;
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
gap: 8px;
|
|
18
|
-
background-color: ${o.COLORS.surface.hovered};
|
|
19
|
-
.source {
|
|
20
|
-
border-radius: 12px;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
.info-product-source {
|
|
24
8
|
border-radius: 8px;
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
gap: 8px;
|
|
28
|
-
background-color: ${o.COLORS.surface.hovered};
|
|
29
|
-
|
|
30
|
-
.product-data-text1 {
|
|
31
|
-
padding: 2px;
|
|
32
|
-
text-decoration: underline;
|
|
33
|
-
color: ${o.COLORS.content.secondary};
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
&:active {
|
|
36
|
-
background-color: ${o.COLORS.surface.hovered};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
.product-data-text2 {
|
|
40
|
-
padding: 2px;
|
|
41
|
-
color: ${o.COLORS.content.secondary};
|
|
42
|
-
}
|
|
43
|
-
.source {
|
|
44
|
-
border-radius: 12px;
|
|
45
|
-
}
|
|
46
9
|
}
|
|
47
10
|
.pop-up-header {
|
|
48
11
|
padding: 6px 8px;
|
|
@@ -81,7 +44,7 @@
|
|
|
81
44
|
width: 8px;
|
|
82
45
|
display: block;
|
|
83
46
|
}
|
|
84
|
-
`;
|
|
47
|
+
`;r.default.div`
|
|
85
48
|
display: flex;
|
|
86
49
|
margin: 16px 0px 0px 0px;
|
|
87
50
|
padding: 0px 0px 16px 0px;
|
|
@@ -137,7 +100,7 @@
|
|
|
137
100
|
-webkit-box-orient: vertical;
|
|
138
101
|
white-space: pre-line;
|
|
139
102
|
}
|
|
140
|
-
`;const p=
|
|
103
|
+
`;const p=r.default.div`
|
|
141
104
|
display: flex;
|
|
142
105
|
flex-direction: column;
|
|
143
106
|
gap: 8px;
|
|
@@ -157,13 +120,4 @@
|
|
|
157
120
|
display: flex;
|
|
158
121
|
gap: 8px;
|
|
159
122
|
}
|
|
160
|
-
`;
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
justify-content: center;
|
|
164
|
-
width: 24px;
|
|
165
|
-
height: 24px;
|
|
166
|
-
background-color: ${o.COLORS.surface.subdued};
|
|
167
|
-
border-radius: 22px;
|
|
168
|
-
border: 1px solid ${o.COLORS.stroke.primary};
|
|
169
|
-
`,exports.SourceInfoDetailsStyle=l,exports.SourceInfoFooterStyle=p;
|
|
123
|
+
`;exports.SourceInfoDetailsStyle=l,exports.SourceInfoFooterStyle=p;
|
|
@@ -124,19 +124,12 @@ export interface LiveChatCTA {
|
|
|
124
124
|
buttonType: string;
|
|
125
125
|
}
|
|
126
126
|
export interface footerButtonOptionModel {
|
|
127
|
+
title?: string;
|
|
128
|
+
subtitle?: string;
|
|
129
|
+
buttonTitle: string;
|
|
130
|
+
addFaqProps?: any;
|
|
131
|
+
redirectUrl?: string;
|
|
127
132
|
hideAddDataButton?: boolean;
|
|
128
|
-
navigate?: (pagePathKey: string, params?: object, queryParam?: object, openInNewTab?: boolean) => void;
|
|
129
|
-
onClick: (
|
|
130
|
-
buttonTitle: string;
|
|
131
|
-
redirectUrl?: string;
|
|
132
|
-
addFaqProps?: any;
|
|
133
|
-
}) => void;
|
|
134
|
-
}
|
|
135
|
-
export interface ProductSourceData {
|
|
136
|
-
[keys: string]: {
|
|
137
|
-
description: string;
|
|
138
|
-
metafield: string[];
|
|
139
|
-
faqs: CustomDataFaqModel[];
|
|
140
|
-
onEditFaqClick: (faqs: CustomDataFaqModel[]) => void;
|
|
141
|
-
};
|
|
133
|
+
navigate?: (pagePathKey: Record<string, string>, params?: object, queryParam?: object, openInNewTab?: boolean) => void;
|
|
134
|
+
onClick: () => void;
|
|
142
135
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarProps } from 'react-calendar';
|
|
3
3
|
import { CSSProperties } from 'styled-components';
|
|
4
|
-
|
|
4
|
+
export declare enum DateButtonType {
|
|
5
|
+
DEFAULT = "default",
|
|
6
|
+
LARGE = "large"
|
|
7
|
+
}
|
|
5
8
|
export declare const DatePickerWrapper: React.FC<{
|
|
6
9
|
val?: Date | Date[];
|
|
7
10
|
onChange: (val: Date | Date[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-calendar"),a=require("../../hooks/useOutside.js"),n=require("../../utils/DateUtils.js"),o=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-calendar"),a=require("../../hooks/useOutside.js"),n=require("../../utils/DateUtils.js"),o=require("../../constants/Theme.js"),s=require("../../assets/icons/calendar.svg.js"),i=require("../TypographyStyle.js"),l=require("./DatePickerWrapper.styled.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c,d=u(r);exports.DateButtonType=void 0,(c=exports.DateButtonType||(exports.DateButtonType={})).DEFAULT="default",c.LARGE="large";exports.DatePickerWrapper=r=>{let{val:u,onChange:c,calendarProps:O,disabled:y,pickerStyles:D,nativeID:p,maxDate:g,minDate:S,dateButtonType:L,dateButtonStyles:v}=r;const[C,j]=t.useState(!1),x=t.useRef(null),b=t.useRef(null);a.useOutside(b,(()=>{j(!1)}));const R=()=>{var e,t,r,a;return u?Array.isArray(u)?(null===(e=null==u?void 0:u[0])||void 0===e?void 0:e.toString())&&(null===(t=null==u?void 0:u[1])||void 0===t?void 0:t.toString())?`${new Date(null===(r=null==u?void 0:u[0])||void 0===r?void 0:r.toString()).toLocaleDateString()}-${new Date(null===(a=null==u?void 0:u[1])||void 0===a?void 0:a.toString()).toLocaleDateString()}`:`${n.default.getPastDate(new Date,30).toLocaleDateString()}-${(new Date).toLocaleDateString()}`:new Date(u.toString()).toLocaleDateString():(new Date).toLocaleDateString()};return e.jsxs(e.Fragment,{children:[e.jsxs(l.DateBtn,Object.assign({id:p,ref:x,bgColor:y?o.COLORS.background.base:o.COLORS.surface.standard,borderColor:o.COLORS.stroke.primary,onClick:()=>j(!C),dateButtonType:L||exports.DateButtonType.DEFAULT,style:v},{children:[L===exports.DateButtonType.LARGE?e.jsx(i.BodyPrimary,Object.assign({style:{color:y?o.COLORS.content.inactive:o.COLORS.content.primary,flex:1}},{children:R()})):e.jsx(i.BodySecondary,Object.assign({style:{color:y?o.COLORS.content.inactive:o.COLORS.content.primary,flex:1}},{children:R()})),e.jsx(s.default,{width:L===exports.DateButtonType.LARGE?24:20,height:L===exports.DateButtonType.LARGE?24:20,color:y?o.COLORS.content.inactive:o.COLORS.content.primary})]})),C&&!y&&e.jsx(l.PickerContainer,Object.assign({ref:b,style:Object.assign({},D),contentPrimary:o.COLORS.content.primary,subDued:o.COLORS.surface.subdued,brandColor:o.COLORS.background.brand,bgColor:o.COLORS.surface.standard,borderColor:o.COLORS.stroke.primary},{children:e.jsx(d.default,Object.assign({tileClassName:["custom__tile"],className:["custom__calendar"],onChange:e=>{c(e),j(!1)},maxDate:g,minDate:S,value:u?Array.isArray(u)?2===u.length?[new Date(u[0]),new Date(u[1])]:null:new Date(u):null},O))}))]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("./DatePickerWrapper.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e);const a=o.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
padding: 5px 8px;
|
|
4
4
|
background: ${e=>e.bgColor};
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
gap: 8px;
|
|
12
12
|
position: relative;
|
|
13
13
|
height: ${e=>e.dateButtonType===r.DateButtonType.LARGE?"48px":"32px"};
|
|
14
|
-
`,n=
|
|
14
|
+
`,n=o.default.div`
|
|
15
15
|
position: absolute;
|
|
16
16
|
top: calc(100% + 8px);
|
|
17
17
|
zindex: 9;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { ICouponData } from "./type";
|
|
4
3
|
import { Collection, Product } from "../product-picker/type";
|
|
@@ -28,7 +27,6 @@ export interface DiscountDialogueI {
|
|
|
28
27
|
fetchCollections: any;
|
|
29
28
|
fetchProducts: any;
|
|
30
29
|
storeId: string;
|
|
31
|
-
appType?: ApplicationType;
|
|
32
30
|
};
|
|
33
31
|
errorMsg?: string;
|
|
34
32
|
loading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("react"),i=require("./type.js");require("../dropdown/DropdownPopover/index.js");var o=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var r=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),s=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),u=require("../../assets/icons/percentage_icon.svg.js"),p=require("../../assets/icons/shipping_icon.svg.js"),C=require("../../assets/icons/triangle_error.svg.js"),T=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js"),P=require("../variable-picker-v3/model.js"),E=require("../variable-picker-v3/VariablePicker.js"),I=require("./DiscountModal.styled.js"),O=require("./DiscountUtils.js"),v=require("./DynamicCoupon/DynamicCoupon.js"),_=require("./StaticCoupon/StaticCoupon.js"),b=require("../../_virtual/bik-store.js");exports.DiscountModal=y=>{var D,N,h,m,f,U,A,g,j,R,x;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:y.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsx(u.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:i.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:i.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsx(p.default,{width:24,height:24,color:t})}],[F,k]=t.useState(),[q,L]=t.useState(),[M,Y]=t.useState(),[w,G]=t.useState(null!==(D=y.data)&&void 0!==D?D:"string"==typeof y.hideOption?{isStaticCoupon:"dynamic"===y.hideOption}:{isStaticCoupon:!0}),[B,X]=t.useState(!0),[Q,H]=t.useState(),[z,K]=t.useState((null===(N=y.data)||void 0===N?void 0:N.minAmount)?i.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(h=y.data)||void 0===h?void 0:h.minQuantity)?i.MIN_PURCHASE_REQUIREMENT.QUANTITY:i.MIN_PURCHASE_REQUIREMENT.NA),[$,Z]=t.useState(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[J,W]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ee,te]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ie,oe]=t.useState(void 0),[ne,le]=t.useState(void 0),[re,ae]=t.useState(void 0),[de,se]=t.useState(void 0),[ce,ue]=t.useState(void 0),[pe,Ce]=t.useState(void 0),[Te,Se]=t.useState(0),[Pe,Ee]=t.useState(""),[Ie,Oe]=t.useState(V[0]),[ve,_e]=t.useState(!1),[be,ye]=t.useState(i.initialStaticCouponErrorState),[De,Ne]=t.useState(i.initialDynamicCouponErrorState),[he,me]=t.useState(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),fe=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:Q===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:Q===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:Q===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:Q===i.DISCOUNT_TYPES.FREE_SHIPPING}];t.useEffect((()=>{y.makeExpiryMandatory&&_e(!0)}),[y.makeExpiryMandatory]),t.useEffect((()=>{var e,t,o,n,l,r,a,d;let s;const{tempCouponData:c,discountType:u}=Ue();H(u);const p=(e,t)=>{Oe(c.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},C=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==c?void 0:c.expireAfter)||(null==c?void 0:c.expireAt))&&(_e(!0),(null==c?void 0:c.expireAt)&&me(i.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==c?void 0:c.expireAfter)&&me(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),u){case i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),Z(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=c.entitledCollectionIds)||void 0===e?void 0:e.length)?Z(i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=c.entitledProductIds)||void 0===t?void 0:t.length)||(null===(o=c.productVariableConf)||void 0===o?void 0:o.entitledProductVariable)?(Z(i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(n=c.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,se)):Z(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=c.entitledCollectionIds)||void 0===l?void 0:l.length)?te(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(te(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(r=c.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,se)),(null===(a=c.prerequisiteCollectionIds)||void 0===a?void 0:a.length)?W(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(W(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(d=c.productVariableConf)||void 0===d?void 0:d.prerequisiteProductVariable,ue));break;case i.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}G(Object.assign({},c)),y.hideProbability||(s=je()),X(O.validateDiscountData(c,z,u,y.hideProbability||!1,s,!!c.isStaticCoupon)),y.hideProbability||je()}),[]),t.useEffect((()=>{let e;y.hideProbability||(e=je()),X(O.validateDiscountData(w,z,Q,y.hideProbability||!1,e,!!w.isStaticCoupon))}),[w,Te,Q,z]),t.useEffect((()=>{var e,t,i,o,n,l,r;if(!y.newPickerConf&&((null===(e=y.products)||void 0===e?void 0:e.length)||(null===(t=y.collection)||void 0===t?void 0:t.length))){if(y.products&&(null===(i=y.products)||void 0===i?void 0:i.length)){if(null===(o=y.data)||void 0===o?void 0:o.entitledProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));le(e)}if(null===(n=y.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));oe(e)}}if(y.collection&&y.collection.length){if(null===(l=y.data)||void 0===l?void 0:l.entitledCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));Ce(e)}if(null===(r=y.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ae(e)}}}}),[y.products,y.collection]),t.useEffect((()=>{var e,t,i,o,n,l,r,a;(null===(t=null===(e=y.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&le(y.data.productsConf.entitledProducts),(null===(o=null===(i=y.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&oe(y.data.productsConf.prerequisiteProducts),(null===(l=null===(n=y.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&Ce(y.data.collectionsConf.entitledCollections),(null===(a=null===(r=y.data)||void 0===r?void 0:r.collectionsConf)||void 0===a?void 0:a.prerequisiteCollections)&&ae(y.data.collectionsConf.prerequisiteCollections)}),[null===(m=y.data)||void 0===m?void 0:m.productsConf,null===(f=y.data)||void 0===f?void 0:f.collectionsConf]),t.useEffect((()=>{if(!ne)return;if(y.newPickerConf){const e=[];return Object.values(ne).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}const e=ne.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}),[ne]),t.useEffect((()=>{if(!ie)return;if(y.newPickerConf){const e=[];return Object.values(ie).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}const e=ie.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}),[ie]),t.useEffect((()=>{if(!pe)return;if(y.newPickerConf){(null==pe?void 0:pe.isCustom)&&delete pe.isCustom;const e=Object.keys(pe).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}const e=pe.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}),[pe]),t.useEffect((()=>{if(!re)return;if(y.newPickerConf){(null==re?void 0:re.isCustom)&&delete re.isCustom;const e=Object.keys(re).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}const e=re.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}),[re]);const Ue=()=>{var e,t;let o,n=w;return w.isStaticCoupon||(w.targetType===i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?o=i.DISCOUNT_TYPES.FREE_SHIPPING:w.targetType===i.DISCOUNT_TARGET_TYPES.LINE_ITEM?o=w.targetSelection===i.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=w.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=w.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||w.prerequisiteQuantity||w.entitledQuantity?i.DISCOUNT_TYPES.BUY_X_GET_Y:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),o=i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:n}},Ae=()=>{ye(i.initialStaticCouponErrorState),Ne(i.initialDynamicCouponErrorState)},ge=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=w.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":w.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((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Ee(n>1?"Please add discount details":o),!0)},je=()=>{if(!y.quadrant||!y.probability)return;const e=[...y.probability];let t=[];e.length>=y.quadrant&&e.splice(y.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(w.probability||0);return Se(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},Re=e=>{var t,o,n,l,r,a,d,s,c,u,p,C,T,S,P,E;const I=e.value;H(I),oe([]),le([]),ae([]),Ce([]),I===i.DISCOUNT_TYPES.FREE_SHIPPING?G({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(t=w.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(o=w.expireAfter)&&void 0!==o?o:void 0,probability:w.probability,minQuantity:null!==(n=w.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=w.minAmount)&&void 0!==l?l:void 0}):I===i.DISCOUNT_TYPES.BUY_X_GET_Y?G({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(r=w.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(a=w.expireAfter)&&void 0!==a?a:void 0,probability:w.probability,minQuantity:void 0,minAmount:void 0}):I===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?G({targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(d=w.valueType)&&void 0!==d?d:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(s=w.expireAt)&&void 0!==s?s:void 0,expireAfter:null!==(c=w.expireAfter)&&void 0!==c?c:void 0,probability:w.probability,value:w.value,minQuantity:null!==(u=w.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=w.minAmount)&&void 0!==p?p:void 0}):I===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&G({targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(C=w.valueType)&&void 0!==C?C:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(T=w.expireAt)&&void 0!==T?T:void 0,expireAfter:null!==(S=w.expireAfter)&&void 0!==S?S:void 0,probability:w.probability,value:w.value,minQuantity:null!==(P=w.minQuantity)&&void 0!==P?P:void 0,minAmount:null!==(E=w.minAmount)&&void 0!==E?E:void 0})},xe=t=>t&&e.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:T.default});return e.jsxs(r.StyledModal,Object.assign({width:(M||F)&&y.newPickerConf?"25px":"640px",open:y.isOpen,hideCrossButton:!!q,headingTitle:F?"Select Products":y.title,headingSubtitle:F?void 0:y.subTitle,footerLeftCustomElement:Pe?xe(Pe):y.errorMsg?xe(y.errorMsg):!y.quadrant||y.hideProbability?e.jsx(e.Fragment,{}):Te<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Te}`,type:"white"}):e.jsx(s.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Te}`,type:"negative",LeadingIcon:C.default})})})),headerRightCustomElement:y.allowStaticCoupon||F?void 0:e.jsx(o.Dropdown,{options:fe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Re(e)}}),onClose:y.onClose,footerContainerStyle:{borderTop:`1px solid ${l.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:F?{buttonType:"primary",onClick:()=>{k(void 0)},buttonText:"Add"}:M?{buttonType:"primary",onClick:()=>{Y(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(U=y.loading)&&void 0!==U&&U,onClick:()=>{var e,t,o,n,l;if(Ae(),w.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=w,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!y.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(ge(r))return void ye(r);if(B||Te>1)return void Ee(!y.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:w.title})}else{const r={invalidCouponTitle:!w.title,inValidProbability:!y.hideProbability&&(null!==(e=w.probability)&&void 0!==e?e:-1)<=0||(null!==(t=w.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(o=w.probability)&&void 0!==o?o:-1),inValidDiscountAmount:!w.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(Q!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&z!==i.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=w;r.inValidMinimumAmount=z===i.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=z===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(ve&&(r.inValidCouponExpiry=!w.expireAt&&!w.expireAfter),Q!==i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&Q!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||de||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidCollectionSelection=!0)),Q===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(w.prerequisiteQuantity||(r.inValidBuyXValue=!0),w.entitledQuantity||(r.inValidGetYValue=!0),J!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ie||Object.keys(ie).length||ce||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),J===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&re&&!Object.keys(re).length&&(r.inValidBuyXCollectionSelection=!0),ee!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||de||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),ee===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidGetYCollectionSelection=!0)),ge(r))return void Ne(r);if(B||Te>1)return void Ee(!y.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked(Object.assign(Object.assign({},w),{description:O.descriptionBuilder(w,y.currency,null!==(n=y.products)&&void 0!==n?n:[],null!==(l=y.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[]},collectionsConf:{entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[]},productVariableConf:{entitledProductVariable:null!=de?de:{},prerequisiteProductVariable:null!=ce?ce:{}}}))}}},secondaryButton:F?{buttonType:"tertiaryGray",onClick:()=>{k(void 0)},buttonText:"Back"}:M?{buttonType:"tertiaryGray",onClick:()=>{Y(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:y.onClose,buttonText:"Cancel"}},{children:[!F&&!M&&e.jsxs(I.StyledDiscountDialogueContainer,{children:[y.allowStaticCoupon&&!F&&e.jsxs(I.CouponTypeContainerStyled,Object.assign({selectedDiv:w.isStaticCoupon?1:2},{children:["static"===y.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{w.isStaticCoupon||(G({isStaticCoupon:!0,quadrant:w.quadrant}),Ee(""),Ae())}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?l.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsx(n.BodyCaption,Object.assign({style:w.isStaticCoupon?{color:l.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===y.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;w.isStaticCoupon&&(H(i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),G({isStaticCoupon:!1,quadrant:w.quadrant,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Ee(""),Ae(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:y.currency||""}))}),_e(null!==(t=y.makeExpiryMandatory)&&void 0!==t&&t),K(i.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?void 0:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsx(n.BodyCaption,Object.assign({style:w.isStaticCoupon?{}:{color:l.DEFAULT_THEME.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.jsx(n.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),w.isStaticCoupon&&!F&&e.jsx(_.default,{discountData:w,setDiscountData:G,hideProbability:y.hideProbability||!1,discountAdminUrl:y.discountAdminUrl,staticDiscountValidationError:be,currency:y.currency}),!w.isStaticCoupon&&!F&&!M&&e.jsx(v.default,{currency:y.currency,entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[],setEntitledProducts:le,setPrerequisiteProducts:oe,discountData:w,productPickerOpen:F,productVariablePickerOpen:q,setIsProductPickerOpen:k,setIsProductVariablePickerOpen:L,setDiscountData:G,selectedCouponType:Q,setSelectedCouponType:H,selectedMinimumRequirement:z,setSelectedMinimumRequirement:K,discountCouponAppliesTo:$,offerAppliesToBuy:J,offerAppliesToGet:ee,setDiscountCouponAppliesTo:Z,setOfferAppliesToBuy:W,setOfferAppliesToGet:te,hideProbability:y.hideProbability||!1,hideExpiration:y.hideExpiration||!1,allowStaticCoupon:y.allowStaticCoupon,onChangeCouponType:Re,collectionPickerOpen:M,entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[],setIsCollectionPickerOpen:Y,setEntitledCollections:Ce,setPrerequisiteCollections:ae,useNewPicker:!!y.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Ie,isProductVariableSupported:y.isProductVariableSupported,entitledProductVariable:de,setEntitledProductVariable:se,preRequisiteProductVariable:ce,setPreRequisiteProductVariable:ue,productVariableList:y.productVariableList,isAddExpirationChecked:ve,setIsAddExpirationChecked:_e,dynamicDiscountValidationError:De,setDynamicDiscountValidationError:Ne,setValidationErrorMessage:Ee,resetValidationErrors:Ae,discountDetailsOptions:V,selectedExpiration:he,setSelectedExpiration:me,makeExpiryMandatory:!!y.makeExpiryMandatory})]}),!!F&&e.jsxs(e.Fragment,{children:[!y.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(A=y.products)&&void 0!==A?A:[],title:"Select Products",onClose:()=>{k(void 0)},selectedProducts:null!==(g=F===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie)&&void 0!==g?g:[],setSelectedProducts:F===v.DISCOUNT_PRODUCTS.ENTITLED?le:oe,onSearchKeyChange:y.onProductSearch})})),y.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>k(void 0),collectionFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.fetchCollections)?y.newPickerConf.fetchCollections(e,t,!1,i):null},productFetcher:(e,t,i,o,n)=>{var l;return(null===(l=y.newPickerConf)||void 0===l?void 0:l.fetchProducts)?y.newPickerConf.fetchProducts(e,t,o,n,!1,i):null},selectedItems:F===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onAdd:e=>{F===v.DISCOUNT_PRODUCTS.ENTITLED?le(e):oe(e),k(void 0)},zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||b.__exports.ApplicationType.BIK,searchInCollectionFetcher:(e,t,i,o)=>{var n;return(null===(n=y.newPickerConf)||void 0===n?void 0:n.searchInCollection)?y.newPickerConf.searchInCollection(e,t,i,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.searchProducts)?y.newPickerConf.searchProducts(e,t,!1,i):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!M&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[y.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>Y(void 0),collectionFetcher:y.newPickerConf.fetchCollections,productFetcher:y.newPickerConf.fetchProducts,selectedItems:M===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),M===v.DISCOUNT_PRODUCTS.ENTITLED?Ce(e):ae(e),Y(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||b.__exports.ApplicationType.BIK,searchInCollectionFetcher:y.newPickerConf.searchInCollection,searchFetcher:y.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!y.newPickerConf&&e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(j=y.collection)&&void 0!==j?j:[],title:"Select Products",onClose:()=>{Y(void 0)},selectedProducts:null!==(R=M===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re)&&void 0!==R?R:[],setSelectedProducts:M===v.DISCOUNT_PRODUCTS.ENTITLED?Ce:ae,onSearchKeyChange:y.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsx(I.VariablePickerContainer,{children:e.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsx(E.VariablePicker,{type:P.PickerType.EMBEDDED,data:null!==(x=y.productVariableList)&&void 0!==x?x:[],showHeader:!0,onSelect:e=>{if(q===v.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;se({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===v.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ue({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("./type.js");require("../dropdown/DropdownPopover/index.js");var o=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var r=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),s=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),u=require("../../assets/icons/percentage_icon.svg.js"),p=require("../../assets/icons/shipping_icon.svg.js"),T=require("../../assets/icons/triangle_error.svg.js"),C=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js"),E=require("../variable-picker-v3/model.js"),P=require("../variable-picker-v3/VariablePicker.js"),O=require("./DiscountModal.styled.js"),I=require("./DiscountUtils.js"),v=require("./DynamicCoupon/DynamicCoupon.js"),_=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=b=>{var y,D,N,m,h,U,f,A,g,j,R;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:b.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsx(u.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:i.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:i.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsx(p.default,{width:24,height:24,color:t})}],[x,F]=t.useState(),[q,L]=t.useState(),[k,M]=t.useState(),[Y,w]=t.useState(null!==(y=b.data)&&void 0!==y?y:"string"==typeof b.hideOption?{isStaticCoupon:"dynamic"===b.hideOption}:{isStaticCoupon:!0}),[G,B]=t.useState(!0),[X,Q]=t.useState(),[H,z]=t.useState((null===(D=b.data)||void 0===D?void 0:D.minAmount)?i.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(N=b.data)||void 0===N?void 0:N.minQuantity)?i.MIN_PURCHASE_REQUIREMENT.QUANTITY:i.MIN_PURCHASE_REQUIREMENT.NA),[$,K]=t.useState(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[Z,J]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[W,ee]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[te,ie]=t.useState(void 0),[oe,ne]=t.useState(void 0),[le,re]=t.useState(void 0),[ae,de]=t.useState(void 0),[se,ce]=t.useState(void 0),[ue,pe]=t.useState(void 0),[Te,Ce]=t.useState(0),[Se,Ee]=t.useState(""),[Pe,Oe]=t.useState(V[0]),[Ie,ve]=t.useState(!1),[_e,be]=t.useState(i.initialStaticCouponErrorState),[ye,De]=t.useState(i.initialDynamicCouponErrorState),[Ne,me]=t.useState(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),he=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:X===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:X===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:X===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:X===i.DISCOUNT_TYPES.FREE_SHIPPING}];t.useEffect((()=>{b.makeExpiryMandatory&&ve(!0)}),[b.makeExpiryMandatory]),t.useEffect((()=>{var e,t,o,n,l,r,a,d;let s;const{tempCouponData:c,discountType:u}=Ue();Q(u);const p=(e,t)=>{Oe(c.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},T=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==c?void 0:c.expireAfter)||(null==c?void 0:c.expireAt))&&(ve(!0),(null==c?void 0:c.expireAt)&&me(i.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==c?void 0:c.expireAfter)&&me(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),u){case i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),K(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=c.entitledCollectionIds)||void 0===e?void 0:e.length)?K(i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=c.entitledProductIds)||void 0===t?void 0:t.length)||(null===(o=c.productVariableConf)||void 0===o?void 0:o.entitledProductVariable)?(K(i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(n=c.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,de)):K(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=c.entitledCollectionIds)||void 0===l?void 0:l.length)?ee(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(ee(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(r=c.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,de)),(null===(a=c.prerequisiteCollectionIds)||void 0===a?void 0:a.length)?J(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(J(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(d=c.productVariableConf)||void 0===d?void 0:d.prerequisiteProductVariable,ce));break;case i.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}w(Object.assign({},c)),b.hideProbability||(s=ge()),B(I.validateDiscountData(c,H,u,b.hideProbability||!1,s,!!c.isStaticCoupon)),b.hideProbability||ge()}),[]),t.useEffect((()=>{let e;b.hideProbability||(e=ge()),B(I.validateDiscountData(Y,H,X,b.hideProbability||!1,e,!!Y.isStaticCoupon))}),[Y,Te,X,H]),t.useEffect((()=>{var e,t,i,o,n,l,r;if(!b.newPickerConf&&((null===(e=b.products)||void 0===e?void 0:e.length)||(null===(t=b.collection)||void 0===t?void 0:t.length))){if(b.products&&(null===(i=b.products)||void 0===i?void 0:i.length)){if(null===(o=b.data)||void 0===o?void 0:o.entitledProductIds){const e=b.products.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ne(e)}if(null===(n=b.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=b.products.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ie(e)}}if(b.collection&&b.collection.length){if(null===(l=b.data)||void 0===l?void 0:l.entitledCollectionIds){const e=b.collection.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));pe(e)}if(null===(r=b.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=b.collection.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));re(e)}}}}),[b.products,b.collection]),t.useEffect((()=>{var e,t,i,o,n,l,r,a;(null===(t=null===(e=b.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&ne(b.data.productsConf.entitledProducts),(null===(o=null===(i=b.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&ie(b.data.productsConf.prerequisiteProducts),(null===(l=null===(n=b.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&pe(b.data.collectionsConf.entitledCollections),(null===(a=null===(r=b.data)||void 0===r?void 0:r.collectionsConf)||void 0===a?void 0:a.prerequisiteCollections)&&re(b.data.collectionsConf.prerequisiteCollections)}),[null===(m=b.data)||void 0===m?void 0:m.productsConf,null===(h=b.data)||void 0===h?void 0:h.collectionsConf]),t.useEffect((()=>{if(!oe)return;if(b.newPickerConf){const e=[];return Object.values(oe).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void w(Object.assign(Object.assign({},Y),{entitledProductIds:e}))}const e=oe.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{entitledProductIds:e}))}),[oe]),t.useEffect((()=>{if(!te)return;if(b.newPickerConf){const e=[];return Object.values(te).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void w(Object.assign(Object.assign({},Y),{prerequisiteProductIds:e}))}const e=te.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{prerequisiteProductIds:e}))}),[te]),t.useEffect((()=>{if(!ue)return;if(b.newPickerConf){(null==ue?void 0:ue.isCustom)&&delete ue.isCustom;const e=Object.keys(ue).map((e=>parseInt(e)));return void w(Object.assign(Object.assign({},Y),{entitledCollectionIds:e}))}const e=ue.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{entitledCollectionIds:e}))}),[ue]),t.useEffect((()=>{if(!le)return;if(b.newPickerConf){(null==le?void 0:le.isCustom)&&delete le.isCustom;const e=Object.keys(le).map((e=>parseInt(e)));return void w(Object.assign(Object.assign({},Y),{prerequisiteCollectionIds:e}))}const e=le.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{prerequisiteCollectionIds:e}))}),[le]);const Ue=()=>{var e,t;let o,n=Y;return Y.isStaticCoupon||(Y.targetType===i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?o=i.DISCOUNT_TYPES.FREE_SHIPPING:Y.targetType===i.DISCOUNT_TARGET_TYPES.LINE_ITEM?o=Y.targetSelection===i.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=Y.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=Y.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||Y.prerequisiteQuantity||Y.entitledQuantity?i.DISCOUNT_TYPES.BUY_X_GET_Y:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),o=i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:n}},fe=()=>{be(i.initialStaticCouponErrorState),De(i.initialDynamicCouponErrorState)},Ae=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=Y.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":Y.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((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Ee(n>1?"Please add discount details":o),!0)},ge=()=>{if(!b.quadrant||!b.probability)return;const e=[...b.probability];let t=[];e.length>=b.quadrant&&e.splice(b.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(Y.probability||0);return Ce(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},je=e=>{var t,o,n,l,r,a,d,s,c,u,p,T,C,S,E,P;const O=e.value;Q(O),ie([]),ne([]),re([]),pe([]),O===i.DISCOUNT_TYPES.FREE_SHIPPING?w({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(t=Y.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(o=Y.expireAfter)&&void 0!==o?o:void 0,probability:Y.probability,minQuantity:null!==(n=Y.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=Y.minAmount)&&void 0!==l?l:void 0}):O===i.DISCOUNT_TYPES.BUY_X_GET_Y?w({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(r=Y.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(a=Y.expireAfter)&&void 0!==a?a:void 0,probability:Y.probability,minQuantity:void 0,minAmount:void 0}):O===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?w({targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(d=Y.valueType)&&void 0!==d?d:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(s=Y.expireAt)&&void 0!==s?s:void 0,expireAfter:null!==(c=Y.expireAfter)&&void 0!==c?c:void 0,probability:Y.probability,value:Y.value,minQuantity:null!==(u=Y.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=Y.minAmount)&&void 0!==p?p:void 0}):O===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&w({targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(T=Y.valueType)&&void 0!==T?T:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(C=Y.expireAt)&&void 0!==C?C:void 0,expireAfter:null!==(S=Y.expireAfter)&&void 0!==S?S:void 0,probability:Y.probability,value:Y.value,minQuantity:null!==(E=Y.minQuantity)&&void 0!==E?E:void 0,minAmount:null!==(P=Y.minAmount)&&void 0!==P?P:void 0})},Re=t=>t&&e.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:C.default});return e.jsxs(r.StyledModal,Object.assign({width:(k||x)&&b.newPickerConf?"25px":"640px",open:b.isOpen,hideCrossButton:!!q,headingTitle:x?"Select Products":b.title,headingSubtitle:x?void 0:b.subTitle,footerLeftCustomElement:Se?Re(Se):b.errorMsg?Re(b.errorMsg):!b.quadrant||b.hideProbability?e.jsx(e.Fragment,{}):Te<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Te}`,type:"white"}):e.jsx(s.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Te}`,type:"negative",LeadingIcon:T.default})})})),headerRightCustomElement:b.allowStaticCoupon||x?void 0:e.jsx(o.Dropdown,{options:he,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{je(e)}}),onClose:b.onClose,footerContainerStyle:{borderTop:`1px solid ${l.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:x?{buttonType:"primary",onClick:()=>{F(void 0)},buttonText:"Add"}:k?{buttonType:"primary",onClick:()=>{M(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(U=b.loading)&&void 0!==U&&U,onClick:()=>{var e,t,o,n,l;if(fe(),Y.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=Y,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!b.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(Ae(r))return void be(r);if(G||Te>1)return void Ee(!b.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");b.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:Y.title})}else{const r={invalidCouponTitle:!Y.title,inValidProbability:!b.hideProbability&&(null!==(e=Y.probability)&&void 0!==e?e:-1)<=0||(null!==(t=Y.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(o=Y.probability)&&void 0!==o?o:-1),inValidDiscountAmount:!Y.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(X!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&H!==i.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=Y;r.inValidMinimumAmount=H===i.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=H===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(Ie&&(r.inValidCouponExpiry=!Y.expireAt&&!Y.expireAfter),X!==i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&X!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!oe||Object.keys(oe).length||ae||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&ue&&!Object.keys(ue).length&&(r.inValidCollectionSelection=!0)),X===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(Y.prerequisiteQuantity||(r.inValidBuyXValue=!0),Y.entitledQuantity||(r.inValidGetYValue=!0),Z!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!te||Object.keys(te).length||se||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),Z===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&le&&!Object.keys(le).length&&(r.inValidBuyXCollectionSelection=!0),W!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!oe||Object.keys(oe).length||ae||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),W===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&ue&&!Object.keys(ue).length&&(r.inValidGetYCollectionSelection=!0)),Ae(r))return void De(r);if(G||Te>1)return void Ee(!b.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");b.onSaveClicked(Object.assign(Object.assign({},Y),{description:I.descriptionBuilder(Y,b.currency,null!==(n=b.products)&&void 0!==n?n:[],null!==(l=b.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=oe?oe:[],prerequisiteProducts:null!=te?te:[]},collectionsConf:{entitledCollections:null!=ue?ue:[],prerequisiteCollections:null!=le?le:[]},productVariableConf:{entitledProductVariable:null!=ae?ae:{},prerequisiteProductVariable:null!=se?se:{}}}))}}},secondaryButton:x?{buttonType:"tertiaryGray",onClick:()=>{F(void 0)},buttonText:"Back"}:k?{buttonType:"tertiaryGray",onClick:()=>{M(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:b.onClose,buttonText:"Cancel"}},{children:[!x&&!k&&e.jsxs(O.StyledDiscountDialogueContainer,{children:[b.allowStaticCoupon&&!x&&e.jsxs(O.CouponTypeContainerStyled,Object.assign({selectedDiv:Y.isStaticCoupon?1:2},{children:["static"===b.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{Y.isStaticCoupon||(w({isStaticCoupon:!0,quadrant:Y.quadrant}),Ee(""),fe())}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:Y.isStaticCoupon?l.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsx(n.BodyCaption,Object.assign({style:Y.isStaticCoupon?{color:l.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===b.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;Y.isStaticCoupon&&(Q(i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),w({isStaticCoupon:!1,quadrant:Y.quadrant,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Ee(""),fe(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:b.currency||""}))}),ve(null!==(t=b.makeExpiryMandatory)&&void 0!==t&&t),z(i.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:Y.isStaticCoupon?void 0:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsx(n.BodyCaption,Object.assign({style:Y.isStaticCoupon?{}:{color:l.DEFAULT_THEME.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.jsx(n.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),Y.isStaticCoupon&&!x&&e.jsx(_.default,{discountData:Y,setDiscountData:w,hideProbability:b.hideProbability||!1,discountAdminUrl:b.discountAdminUrl,staticDiscountValidationError:_e,currency:b.currency}),!Y.isStaticCoupon&&!x&&!k&&e.jsx(v.default,{currency:b.currency,entitledProducts:null!=oe?oe:[],prerequisiteProducts:null!=te?te:[],setEntitledProducts:ne,setPrerequisiteProducts:ie,discountData:Y,productPickerOpen:x,productVariablePickerOpen:q,setIsProductPickerOpen:F,setIsProductVariablePickerOpen:L,setDiscountData:w,selectedCouponType:X,setSelectedCouponType:Q,selectedMinimumRequirement:H,setSelectedMinimumRequirement:z,discountCouponAppliesTo:$,offerAppliesToBuy:Z,offerAppliesToGet:W,setDiscountCouponAppliesTo:K,setOfferAppliesToBuy:J,setOfferAppliesToGet:ee,hideProbability:b.hideProbability||!1,hideExpiration:b.hideExpiration||!1,allowStaticCoupon:b.allowStaticCoupon,onChangeCouponType:je,collectionPickerOpen:k,entitledCollections:null!=ue?ue:[],prerequisiteCollections:null!=le?le:[],setIsCollectionPickerOpen:M,setEntitledCollections:pe,setPrerequisiteCollections:re,useNewPicker:!!b.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Pe,isProductVariableSupported:b.isProductVariableSupported,entitledProductVariable:ae,setEntitledProductVariable:de,preRequisiteProductVariable:se,setPreRequisiteProductVariable:ce,productVariableList:b.productVariableList,isAddExpirationChecked:Ie,setIsAddExpirationChecked:ve,dynamicDiscountValidationError:ye,setDynamicDiscountValidationError:De,setValidationErrorMessage:Ee,resetValidationErrors:fe,discountDetailsOptions:V,selectedExpiration:Ne,setSelectedExpiration:me,makeExpiryMandatory:!!b.makeExpiryMandatory})]}),!!x&&e.jsxs(e.Fragment,{children:[!b.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(f=b.products)&&void 0!==f?f:[],title:"Select Products",onClose:()=>{F(void 0)},selectedProducts:null!==(A=x===v.DISCOUNT_PRODUCTS.ENTITLED?oe:te)&&void 0!==A?A:[],setSelectedProducts:x===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onSearchKeyChange:b.onProductSearch})})),b.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>F(void 0),collectionFetcher:b.newPickerConf.fetchCollections,productFetcher:b.newPickerConf.fetchProducts,selectedItems:x===v.DISCOUNT_PRODUCTS.ENTITLED?oe:te,onAdd:e=>{x===v.DISCOUNT_PRODUCTS.ENTITLED?ne(e):ie(e),F(void 0)},zIndex:200,storeId:b.newPickerConf.storeId,searchInCollectionFetcher:b.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:b.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!k&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[b.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>M(void 0),collectionFetcher:b.newPickerConf.fetchCollections,productFetcher:b.newPickerConf.fetchProducts,selectedItems:k===v.DISCOUNT_PRODUCTS.ENTITLED?ue:le,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),k===v.DISCOUNT_PRODUCTS.ENTITLED?pe(e):re(e),M(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:b.newPickerConf.storeId,searchInCollectionFetcher:b.newPickerConf.searchInCollection,searchFetcher:b.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!b.newPickerConf&&e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(g=b.collection)&&void 0!==g?g:[],title:"Select Products",onClose:()=>{M(void 0)},selectedProducts:null!==(j=k===v.DISCOUNT_PRODUCTS.ENTITLED?ue:le)&&void 0!==j?j:[],setSelectedProducts:k===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onSearchKeyChange:b.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsx(O.VariablePickerContainer,{children:e.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsx(P.VariablePicker,{type:E.PickerType.EMBEDDED,data:null!==(R=b.productVariableList)&&void 0!==R?R:[],showHeader:!0,onSelect:e=>{if(q===v.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;de({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===v.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ce({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { DISCOUNT_TYPES } from "..";
|
|
2
3
|
import { COUPON_EXPIRATION, DISCOUNT_APPLIES_TO, ICouponData, IDynamicDiscountValidationError, MIN_PURCHASE_REQUIREMENT, OFFER_APPLIES_TO } from "../type";
|
|
3
4
|
import { SingleOption } from "../../dropdown/type";
|
|
4
5
|
import { Collection, Product } from "../../product-picker/type";
|
|
5
6
|
import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
|
|
6
|
-
import {
|
|
7
|
+
import { ProductVariable } from '../type';
|
|
7
8
|
export declare enum DISCOUNT_PRODUCTS {
|
|
8
9
|
ENTITLED = "entitled",
|
|
9
10
|
PREREQUISITE = "prerequisite"
|