@bikdotai/bik-component-library 0.0.783-beta.3 → 0.0.783-beta.5
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/Ai_event_generating.svg.js +1 -1
- package/dist/cjs/assets/icons/magic-line.svg.js +1 -0
- package/dist/cjs/assets/icons/refresh-purple.svg.js +1 -0
- package/dist/cjs/assets/icons/rewind.svg.js +1 -0
- package/dist/cjs/assets/icons/thumbs_down.svg.js +1 -0
- package/dist/cjs/assets/icons/thumbs_up.svg.js +1 -0
- package/dist/cjs/components/ProgressChecklist/MultiChecklistItem.d.ts +29 -1
- package/dist/cjs/components/ProgressChecklist/ProgressChecklist.d.ts +1 -27
- package/dist/cjs/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/Segment/components/SegmentFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.js +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/EmojiPicker.d.ts +1 -2
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/EmojiPicker.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.d.ts +5 -2
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.d.ts +3 -1
- package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/constants/connector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/constants/connector.js +1 -1
- package/dist/cjs/components/QueryBuilder/constants/connectorPosition.js +1 -1
- package/dist/cjs/components/QueryBuilder/helpers/Connector.helper.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/helpers/Connector.helper.js +1 -1
- package/dist/cjs/components/QueryBuilder/helpers/PropertyCustomProcessor.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/helpers/SegmentValidator.d.ts +3 -15
- package/dist/cjs/components/QueryBuilder/types/QueryBuilder.type.d.ts +2 -22
- package/dist/cjs/components/QueryBuilder/types/QueryBuilder.type.js +1 -1
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderAPI.type.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +6 -1
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderEnum.type.d.ts +21 -0
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderEnum.type.js +1 -0
- package/dist/cjs/components/QueryBuilder/types/index.d.ts +2 -1
- package/dist/cjs/components/SearchFilter/components/DatePickerButton.d.ts +1 -1
- package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.d.ts +1 -1
- package/dist/cjs/components/SearchFilter/components/SearchFilterItem.d.ts +1 -1
- package/dist/cjs/components/SearchFilter/components/SearchFilterItem.js +1 -1
- package/dist/cjs/components/SearchFilter/types/SearchFilter.type.d.ts +1 -1
- package/dist/cjs/components/TablePagination/TablePagination.d.ts +1 -0
- package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/AIRephrase.styled.d.ts +10 -0
- package/dist/cjs/components/WhatsAppTextEditor/AIRephrase.styled.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/AIRephraseButton.d.ts +20 -0
- package/dist/cjs/components/WhatsAppTextEditor/AIRephraseButton.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/BorderAnimation.d.ts +11 -0
- package/dist/cjs/components/WhatsAppTextEditor/BorderAnimation.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/CustomEditor.styled.d.ts +13 -0
- package/dist/cjs/components/WhatsAppTextEditor/CustomEditor.styled.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.d.ts +131 -3
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +5 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +39 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/ai/actionRegistry.d.ts +15 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/actionRegistry.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/aiTag.d.ts +63 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/aiTag.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/api.d.ts +22 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/api.js +1 -0
- package/dist/cjs/components/accordion/Accordion.d.ts +2 -35
- package/dist/cjs/components/accordion/Accordion.model.d.ts +35 -0
- package/dist/cjs/components/accordion/Accordion.style.d.ts +1 -1
- package/dist/cjs/components/alerts/Alert.styled.js +1 -0
- package/dist/cjs/components/analytics-card/AnalyticsCard.d.ts +1 -1
- package/dist/cjs/components/analytics-card/AnalyticsCard.model.d.ts +1 -0
- package/dist/cjs/components/analytics-card/AnalyticsCard.styled.d.ts +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.d.ts +1 -17
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.model.d.ts +18 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.d.ts +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.d.ts +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LazyCharts.d.ts +2 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LazyCharts.js +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/bik-layout/BikSidebar.d.ts +1 -1
- package/dist/cjs/components/bik-layout/BikSidebarV2/BikSidebarV2.d.ts +33 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/BikSidebarV2.js +1 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/SidebarV2.model.d.ts +27 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/SidebarV2Popup.d.ts +13 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/SidebarV2Popup.js +1 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/SidebarV2Styles.d.ts +44 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/SidebarV2Styles.js +282 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/SimpleSidebarV2.d.ts +3 -0
- package/dist/cjs/components/bik-layout/BikSidebarV2/SimpleSidebarV2.js +1 -0
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/bik-layout/Sidebar.model.d.ts +27 -0
- package/dist/cjs/components/bik-layout/SidebarPopup.d.ts +1 -1
- package/dist/cjs/components/bik-layout/SidebarSkeleton.d.ts +1 -1
- package/dist/cjs/components/bik-layout/SidebarStyles.d.ts +1 -1
- package/dist/cjs/components/bik-layout/SimpleSidebar.d.ts +1 -27
- package/dist/cjs/components/bik-layout/index.d.ts +2 -0
- package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/cjs/components/country-code-picker/CountryPicker.js +1 -1
- package/dist/cjs/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/cjs/components/datePicker/TimePicker.js +1 -1
- package/dist/cjs/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/MinimumRequirementComponent.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.d.ts +0 -2
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +2 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +2 -0
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +9 -0
- package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +1 -1
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -1
- package/dist/cjs/components/floating-input-dropdown/FloatingInputDropdown.d.ts +1 -1
- package/dist/cjs/components/image-cropper/BikImageCropper.d.ts +1 -6
- package/dist/cjs/components/image-cropper/BikImageCropper.model.d.ts +6 -0
- package/dist/cjs/components/image-cropper/BikImagePipeline/BikImagePipeline.d.ts +1 -1
- package/dist/cjs/components/input/ChipInput.js +1 -1
- package/dist/cjs/components/input/ChipInput.styled.d.ts +6 -66
- package/dist/cjs/components/input/ChipInput.styled.js +1 -1
- package/dist/cjs/components/input/Input-helper.d.ts +3 -1
- package/dist/cjs/components/input/Input-helper.js +1 -1
- package/dist/cjs/components/input/Input.d.ts +1 -71
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.model.d.ts +73 -0
- package/dist/cjs/components/input/Input.styled.d.ts +1 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +1 -1
- package/dist/cjs/components/list-item/List.model.d.ts +18 -0
- package/dist/cjs/components/list-item/ListItem.d.ts +1 -17
- package/dist/cjs/components/list-item/ListItem.styled.d.ts +1 -1
- package/dist/cjs/components/list-item/themes.d.ts +1 -1
- package/dist/cjs/components/multi-level-dropdown/GroupedMenuList.d.ts +6 -1
- package/dist/cjs/components/multi-level-dropdown/GroupedMenuList.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuItem.d.ts +5 -1
- package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuList.d.ts +4 -0
- package/dist/cjs/components/multi-level-dropdown/MenuList.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MultiLevelDropdown.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/type.d.ts +5 -1
- package/dist/cjs/components/product-picker-v2/ProductPickerTag.d.ts +2 -2
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +3 -3
- package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.d.ts +3 -4
- package/dist/cjs/components/product-picker-v2/index.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +2 -58
- package/dist/cjs/components/product-picker-v2/product.d.ts +2 -3
- package/dist/cjs/components/product-picker-v2/productInfoOverlay.d.ts +1 -2
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +3 -3
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +3 -4
- package/dist/cjs/components/product-picker-v2/reducers.d.ts +1 -1
- package/dist/cjs/components/product-picker-v2/reducers.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +3 -4
- package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +3 -4
- package/dist/cjs/components/product-picker-v2/type.d.ts +65 -0
- package/dist/cjs/components/product-picker-v2/utility.d.ts +3 -3
- package/dist/cjs/components/product-picker-v2/utility.js +1 -1
- package/dist/cjs/components/product-picker-v2/variant.d.ts +2 -12
- package/dist/cjs/components/product-picker-v2/variantComponents.d.ts +2 -3
- package/dist/cjs/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/cjs/components/sample-button/SampleButton.d.ts +1 -16
- package/dist/cjs/components/sample-button/SampleButton.model.d.ts +17 -0
- package/dist/cjs/components/sample-button/SampleButton.styled.d.ts +1 -1
- package/dist/cjs/components/sample-button/themes.d.ts +1 -1
- package/dist/cjs/components/searchBar/searchBar.d.ts +1 -1
- package/dist/cjs/components/slider/slider.js +1 -1
- package/dist/cjs/components/stepper/Stepper.d.ts +1 -17
- package/dist/cjs/components/stepper/Stepper.model.d.ts +17 -0
- package/dist/cjs/components/stepper/Stepper.styled.d.ts +1 -1
- package/dist/cjs/components/stepper/StepperService.d.ts +1 -1
- package/dist/cjs/components/stepper/themes.d.ts +1 -1
- package/dist/cjs/components/tag/Tag.styled.js +1 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +9 -9
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +7 -7
- package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/helpers/WebpushTemplateHelper.d.ts +6 -4
- package/dist/cjs/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/Body.js +10 -10
- package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +7 -7
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.d.ts +3 -3
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.d.ts +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.d.ts +3 -14
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +5 -5
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +4 -4
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
- package/dist/cjs/components/template-context-mapper/modalElements/QualityWarningModal.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +5 -4
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableEditorHeader.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/modal.d.ts +13 -0
- package/dist/cjs/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.d.ts +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/convertPlaceholdersToBikDropdown.d.ts +2 -2
- package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +2 -2
- package/dist/cjs/components/template-context-mapper/utils/highlightFor.d.ts +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/models/TemplateMeta.d.ts +1 -1
- package/dist/cjs/components/template-preview/models/WhatsappCarouselTemplate.d.ts +2 -2
- package/dist/cjs/components/toaster/Toaster.styled.js +1 -1
- package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/cjs/components/zeroState/ZeroState.js +2 -1
- package/dist/cjs/constants/Theme.d.ts +6 -0
- package/dist/cjs/constants/Theme.js +1 -1
- package/dist/cjs/firebase/environment.d.ts +58 -0
- package/dist/cjs/firebase/environment.js +1 -0
- package/dist/cjs/firebase/firebaseUserFetcher.d.ts +34 -0
- package/dist/cjs/firebase/firebaseUserFetcher.js +1 -0
- package/dist/cjs/firebase/index.d.ts +7 -0
- package/dist/cjs/firebase/lazyFirebaseApp.d.ts +22 -0
- package/dist/cjs/firebase/lazyFirebaseApp.js +1 -0
- package/dist/cjs/firebase/lazyFirebaseMethods.d.ts +589 -0
- package/dist/cjs/firebase/lazyFirebaseMethods.js +1 -0
- package/dist/cjs/firebase/lazyFirestore.d.ts +6 -0
- package/dist/cjs/firebase/lazyFirestore.js +1 -0
- package/dist/cjs/firebase/lazyFirestoreLite.d.ts +6 -0
- package/dist/cjs/firebase/lazyFirestoreLite.js +1 -0
- package/dist/cjs/firebase/lazyStorage.d.ts +5 -0
- package/dist/cjs/firebase/lazyStorage.js +1 -0
- package/dist/cjs/helpers/BaseWhatsappContentLang.helper.js +1 -1
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/request-executor/executor.d.ts +99 -0
- package/dist/cjs/request-executor/executor.js +1 -0
- package/dist/cjs/request-executor/index.d.ts +2 -0
- package/dist/cjs/request-executor/model.d.ts +14 -0
- package/dist/cjs/utils/logging/ErrorConstructor/ApiError.d.ts +3 -0
- package/dist/cjs/utils/logging/ErrorConstructor/ApiError.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/BroadcastFlowError.d.ts +4 -0
- package/dist/cjs/utils/logging/ErrorConstructor/BroadcastFlowError.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/CohortError.d.ts +4 -0
- package/dist/cjs/utils/logging/ErrorConstructor/CohortError.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/CustomError.d.ts +3 -0
- package/dist/cjs/utils/logging/ErrorConstructor/CustomError.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/ExcelUploadError.d.ts +3 -0
- package/dist/cjs/utils/logging/ErrorConstructor/ExcelUploadError.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/FirebaseCallError.d.ts +3 -0
- package/dist/cjs/utils/logging/ErrorConstructor/FirebaseCallError.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/FirebaseSubscriptionError.d.ts +3 -0
- package/dist/cjs/utils/logging/ErrorConstructor/FirebaseSubscriptionError.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/RechargeFailure.d.ts +3 -0
- package/dist/cjs/utils/logging/ErrorConstructor/RechargeFailure.js +1 -0
- package/dist/cjs/utils/logging/ErrorConstructor/WhatsappIntegrationError.d.ts +3 -0
- package/dist/cjs/utils/logging/ErrorConstructor/WhatsappIntegrationError.js +1 -0
- package/dist/cjs/utils/logging/Logger.d.ts +24 -0
- package/dist/cjs/utils/logging/Logger.js +1 -0
- package/dist/cjs/utils/logging/index.d.ts +10 -0
- package/dist/esm/assets/icons/Ai_event_generating.svg.js +1 -1
- package/dist/esm/assets/icons/magic-line.svg.js +1 -0
- package/dist/esm/assets/icons/refresh-purple.svg.js +1 -0
- package/dist/esm/assets/icons/rewind.svg.js +1 -0
- package/dist/esm/assets/icons/thumbs_down.svg.js +1 -0
- package/dist/esm/assets/icons/thumbs_up.svg.js +1 -0
- package/dist/esm/components/ProgressChecklist/MultiChecklistItem.d.ts +29 -1
- package/dist/esm/components/ProgressChecklist/ProgressChecklist.d.ts +1 -27
- package/dist/esm/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/Segment/components/SegmentFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/EmojiPicker.d.ts +1 -2
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/EmojiPicker.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.d.ts +5 -2
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/esm/components/QueryBuilder/components/DropdownWrapper.d.ts +3 -1
- package/dist/esm/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/esm/components/QueryBuilder/constants/connector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/constants/connector.js +1 -1
- package/dist/esm/components/QueryBuilder/constants/connectorPosition.js +1 -1
- package/dist/esm/components/QueryBuilder/helpers/Connector.helper.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/helpers/Connector.helper.js +1 -1
- package/dist/esm/components/QueryBuilder/helpers/PropertyCustomProcessor.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/helpers/SegmentValidator.d.ts +3 -15
- package/dist/esm/components/QueryBuilder/types/QueryBuilder.type.d.ts +2 -22
- package/dist/esm/components/QueryBuilder/types/QueryBuilder.type.js +1 -1
- package/dist/esm/components/QueryBuilder/types/QueryBuilderAPI.type.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +6 -1
- package/dist/esm/components/QueryBuilder/types/QueryBuilderEnum.type.d.ts +21 -0
- package/dist/esm/components/QueryBuilder/types/QueryBuilderEnum.type.js +1 -0
- package/dist/esm/components/QueryBuilder/types/index.d.ts +2 -1
- package/dist/esm/components/SearchFilter/components/DatePickerButton.d.ts +1 -1
- package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.d.ts +1 -1
- package/dist/esm/components/SearchFilter/components/SearchFilterItem.d.ts +1 -1
- package/dist/esm/components/SearchFilter/components/SearchFilterItem.js +1 -1
- package/dist/esm/components/SearchFilter/types/SearchFilter.type.d.ts +1 -1
- package/dist/esm/components/TablePagination/TablePagination.d.ts +1 -0
- package/dist/esm/components/TablePagination/TablePagination.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/AIRephrase.styled.d.ts +10 -0
- package/dist/esm/components/WhatsAppTextEditor/AIRephrase.styled.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/AIRephraseButton.d.ts +20 -0
- package/dist/esm/components/WhatsAppTextEditor/AIRephraseButton.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/BorderAnimation.d.ts +11 -0
- package/dist/esm/components/WhatsAppTextEditor/BorderAnimation.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/CustomEditor.styled.d.ts +13 -0
- package/dist/esm/components/WhatsAppTextEditor/CustomEditor.styled.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.d.ts +131 -3
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +5 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +39 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/ai/actionRegistry.d.ts +15 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/actionRegistry.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/aiTag.d.ts +63 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/aiTag.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/api.d.ts +22 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/api.js +1 -0
- package/dist/esm/components/accordion/Accordion.d.ts +2 -35
- package/dist/esm/components/accordion/Accordion.model.d.ts +35 -0
- package/dist/esm/components/accordion/Accordion.style.d.ts +1 -1
- package/dist/esm/components/alerts/Alert.styled.js +9 -8
- package/dist/esm/components/analytics-card/AnalyticsCard.d.ts +1 -1
- package/dist/esm/components/analytics-card/AnalyticsCard.model.d.ts +1 -0
- package/dist/esm/components/analytics-card/AnalyticsCard.styled.d.ts +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.d.ts +1 -17
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.model.d.ts +18 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.d.ts +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.d.ts +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LazyCharts.d.ts +2 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LazyCharts.js +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/bik-layout/BikSidebar.d.ts +1 -1
- package/dist/esm/components/bik-layout/BikSidebarV2/BikSidebarV2.d.ts +33 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/BikSidebarV2.js +1 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/SidebarV2.model.d.ts +27 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/SidebarV2Popup.d.ts +13 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/SidebarV2Popup.js +1 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/SidebarV2Styles.d.ts +44 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/SidebarV2Styles.js +282 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/SimpleSidebarV2.d.ts +3 -0
- package/dist/esm/components/bik-layout/BikSidebarV2/SimpleSidebarV2.js +1 -0
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/bik-layout/Sidebar.model.d.ts +27 -0
- package/dist/esm/components/bik-layout/SidebarPopup.d.ts +1 -1
- package/dist/esm/components/bik-layout/SidebarSkeleton.d.ts +1 -1
- package/dist/esm/components/bik-layout/SidebarStyles.d.ts +1 -1
- package/dist/esm/components/bik-layout/SimpleSidebar.d.ts +1 -27
- package/dist/esm/components/bik-layout/index.d.ts +2 -0
- package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/esm/components/country-code-picker/CountryPicker.js +1 -1
- package/dist/esm/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/esm/components/datePicker/TimePicker.js +1 -1
- package/dist/esm/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/MinimumRequirementComponent.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +0 -2
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +2 -0
- package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +9 -0
- package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +1 -1
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +1 -1
- package/dist/esm/components/floating-input-dropdown/FloatingInputDropdown.d.ts +1 -1
- package/dist/esm/components/image-cropper/BikImageCropper.d.ts +1 -6
- package/dist/esm/components/image-cropper/BikImageCropper.model.d.ts +6 -0
- package/dist/esm/components/image-cropper/BikImagePipeline/BikImagePipeline.d.ts +1 -1
- package/dist/esm/components/input/ChipInput.js +1 -1
- package/dist/esm/components/input/ChipInput.styled.d.ts +6 -66
- package/dist/esm/components/input/ChipInput.styled.js +1 -1
- package/dist/esm/components/input/Input-helper.d.ts +3 -1
- package/dist/esm/components/input/Input-helper.js +1 -1
- package/dist/esm/components/input/Input.d.ts +1 -71
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.model.d.ts +73 -0
- package/dist/esm/components/input/Input.styled.d.ts +1 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +1 -1
- package/dist/esm/components/list-item/List.model.d.ts +18 -0
- package/dist/esm/components/list-item/ListItem.d.ts +1 -17
- package/dist/esm/components/list-item/ListItem.styled.d.ts +1 -1
- package/dist/esm/components/list-item/themes.d.ts +1 -1
- package/dist/esm/components/multi-level-dropdown/GroupedMenuList.d.ts +6 -1
- package/dist/esm/components/multi-level-dropdown/GroupedMenuList.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MenuItem.d.ts +5 -1
- package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MenuList.d.ts +4 -0
- package/dist/esm/components/multi-level-dropdown/MenuList.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.js +1 -1
- package/dist/esm/components/multi-level-dropdown/type.d.ts +5 -1
- package/dist/esm/components/product-picker-v2/ProductPickerTag.d.ts +2 -2
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +3 -3
- package/dist/esm/components/product-picker-v2/helpers/ProductHelper.d.ts +3 -4
- package/dist/esm/components/product-picker-v2/index.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +2 -58
- package/dist/esm/components/product-picker-v2/product.d.ts +2 -3
- package/dist/esm/components/product-picker-v2/productInfoOverlay.d.ts +1 -2
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +3 -3
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +3 -4
- package/dist/esm/components/product-picker-v2/reducers.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/reducers.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +3 -4
- package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +3 -4
- package/dist/esm/components/product-picker-v2/type.d.ts +65 -0
- package/dist/esm/components/product-picker-v2/utility.d.ts +3 -3
- package/dist/esm/components/product-picker-v2/utility.js +1 -1
- package/dist/esm/components/product-picker-v2/variant.d.ts +2 -12
- package/dist/esm/components/product-picker-v2/variantComponents.d.ts +2 -3
- package/dist/esm/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/esm/components/radioButton/RadioButton.js +1 -1
- package/dist/esm/components/sample-button/SampleButton.d.ts +1 -16
- package/dist/esm/components/sample-button/SampleButton.model.d.ts +17 -0
- package/dist/esm/components/sample-button/SampleButton.styled.d.ts +1 -1
- package/dist/esm/components/sample-button/themes.d.ts +1 -1
- package/dist/esm/components/searchBar/searchBar.d.ts +1 -1
- package/dist/esm/components/slider/slider.js +1 -1
- package/dist/esm/components/stepper/Stepper.d.ts +1 -17
- package/dist/esm/components/stepper/Stepper.model.d.ts +17 -0
- package/dist/esm/components/stepper/Stepper.styled.d.ts +1 -1
- package/dist/esm/components/stepper/StepperService.d.ts +1 -1
- package/dist/esm/components/stepper/themes.d.ts +1 -1
- package/dist/esm/components/tag/Tag.styled.js +1 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +9 -9
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +7 -7
- package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/helpers/WebpushTemplateHelper.d.ts +6 -4
- package/dist/esm/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/Body.js +10 -10
- package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +6 -6
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.d.ts +3 -3
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.d.ts +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.d.ts +3 -14
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +5 -5
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/Footer.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +5 -5
- package/dist/esm/components/template-context-mapper/modalElements/QualityWarningModal.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +5 -4
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableEditorHeader.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/modal.d.ts +13 -0
- package/dist/esm/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.d.ts +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/convertPlaceholdersToBikDropdown.d.ts +2 -2
- package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +2 -2
- package/dist/esm/components/template-context-mapper/utils/highlightFor.d.ts +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/models/TemplateMeta.d.ts +1 -1
- package/dist/esm/components/template-preview/models/WhatsappCarouselTemplate.d.ts +2 -2
- package/dist/esm/components/toaster/Toaster.styled.js +1 -1
- package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/esm/components/zeroState/ZeroState.js +2 -1
- package/dist/esm/constants/Theme.d.ts +6 -0
- package/dist/esm/constants/Theme.js +1 -1
- package/dist/esm/firebase/environment.d.ts +58 -0
- package/dist/esm/firebase/environment.js +1 -0
- package/dist/esm/firebase/firebaseUserFetcher.d.ts +34 -0
- package/dist/esm/firebase/firebaseUserFetcher.js +1 -0
- package/dist/esm/firebase/index.d.ts +7 -0
- package/dist/esm/firebase/lazyFirebaseApp.d.ts +22 -0
- package/dist/esm/firebase/lazyFirebaseApp.js +1 -0
- package/dist/esm/firebase/lazyFirebaseMethods.d.ts +589 -0
- package/dist/esm/firebase/lazyFirebaseMethods.js +1 -0
- package/dist/esm/firebase/lazyFirestore.d.ts +6 -0
- package/dist/esm/firebase/lazyFirestore.js +1 -0
- package/dist/esm/firebase/lazyFirestoreLite.d.ts +6 -0
- package/dist/esm/firebase/lazyFirestoreLite.js +1 -0
- package/dist/esm/firebase/lazyStorage.d.ts +5 -0
- package/dist/esm/firebase/lazyStorage.js +1 -0
- package/dist/esm/helpers/BaseWhatsappContentLang.helper.js +1 -1
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/request-executor/executor.d.ts +99 -0
- package/dist/esm/request-executor/executor.js +1 -0
- package/dist/esm/request-executor/index.d.ts +2 -0
- package/dist/esm/request-executor/model.d.ts +14 -0
- package/dist/esm/utils/logging/ErrorConstructor/ApiError.d.ts +3 -0
- package/dist/esm/utils/logging/ErrorConstructor/ApiError.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/BroadcastFlowError.d.ts +4 -0
- package/dist/esm/utils/logging/ErrorConstructor/BroadcastFlowError.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/CohortError.d.ts +4 -0
- package/dist/esm/utils/logging/ErrorConstructor/CohortError.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/CustomError.d.ts +3 -0
- package/dist/esm/utils/logging/ErrorConstructor/CustomError.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/ExcelUploadError.d.ts +3 -0
- package/dist/esm/utils/logging/ErrorConstructor/ExcelUploadError.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/FirebaseCallError.d.ts +3 -0
- package/dist/esm/utils/logging/ErrorConstructor/FirebaseCallError.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/FirebaseSubscriptionError.d.ts +3 -0
- package/dist/esm/utils/logging/ErrorConstructor/FirebaseSubscriptionError.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/RechargeFailure.d.ts +3 -0
- package/dist/esm/utils/logging/ErrorConstructor/RechargeFailure.js +1 -0
- package/dist/esm/utils/logging/ErrorConstructor/WhatsappIntegrationError.d.ts +3 -0
- package/dist/esm/utils/logging/ErrorConstructor/WhatsappIntegrationError.js +1 -0
- package/dist/esm/utils/logging/Logger.d.ts +24 -0
- package/dist/esm/utils/logging/Logger.js +1 -0
- package/dist/esm/utils/logging/index.d.ts +10 -0
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import{useState as n,useEffect as l}from"react";import{DISCOUNT_TYPES as r,MIN_PURCHASE_REQUIREMENT as d,DISCOUNT_APPLIES_TO as a,OFFER_APPLIES_TO as c,initialStaticCouponErrorState as s,initialDynamicCouponErrorState as u,COUPON_EXPIRATION as p,DISCOUNT_TARGET_TYPES as C,DISCOUNT_TARGET_SELECTION as b,DISCOUNT_VALUE_TYPES as v}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as y}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import"lodash/debounce";import{TitleSmall as P,BodyCaption as m,TitleRegular as I}from"../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as S}from"../modals/styledModal.js";import{ProductPickerContent as O}from"../product-picker/ProductPickerModal.js";import{Tag as E}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import f from"../../assets/icons/gift_icon.svg.js";import g from"../../assets/icons/percentage_icon.svg.js";import V from"../../assets/icons/shipping_icon.svg.js";import D from"../../assets/icons/triangle_error.svg.js";import _ from"../../assets/icons/warning.svg.js";import{ProductPickerModal as A}from"../product-picker-v2/modal.js";import"../product-picker-v2/type.js";import{PickerType as N}from"../variable-picker-v3/model.js";import{VariablePicker as k}from"../variable-picker-v3/VariablePicker.js";import{StyledDiscountDialogueContainer as j,CouponTypeContainerStyled as F,VariablePickerContainer as x}from"./DiscountModal.styled.js";import{validateDiscountData as R,descriptionBuilder as M}from"./DiscountUtils.js";import w,{DISCOUNT_PRODUCTS as q}from"./DynamicCoupon/DynamicCoupon.js";import U from"./StaticCoupon/StaticCoupon.js";const L=L=>{var B,G,Y,X,Q,H,z,K,$,Z,J;const W=[{id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i,lineHeight:.9}},{children:L.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(g,{width:24,height:24,color:i})},{id:"2",label:"Buy X get Y",value:r.BUY_X_GET_Y,icon:i=>e(f,{width:24,height:24,color:i})},{id:"3",label:"Free Shipping",value:r.FREE_SHIPPING,icon:i=>e(V,{width:24,height:24,color:i})}],[ee,ie]=n(),[te,oe]=n(),[ne,le]=n(),[re,de]=n(null!==(B=L.data)&&void 0!==B?B:"string"==typeof L.hideOption?{isStaticCoupon:"dynamic"===L.hideOption}:{isStaticCoupon:!0}),[ae,ce]=n(!0),[se,ue]=n(),[pe,Ce]=n((null===(G=L.data)||void 0===G?void 0:G.minAmount)?d.AMOUNT:(null===(Y=L.data)||void 0===Y?void 0:Y.minQuantity)?d.QUANTITY:d.NA),[be,ve]=n(a.ENTIRE_ORDER),[ye,Pe]=n(c.SPECIFIC_PRODUCTS),[me,Ie]=n(c.SPECIFIC_PRODUCTS),[he,Se]=n(void 0),[Oe,Ee]=n(void 0),[Te,fe]=n(void 0),[ge,Ve]=n(void 0),[De,_e]=n(void 0),[Ae,Ne]=n(void 0),[ke,je]=n(0),[Fe,xe]=n(""),[Re,Me]=n(W[0]),[we,qe]=n(!1),[Ue,Le]=n(s),[Be,Ge]=n(u),[Ye,Xe]=n(L.getDetailedDescription?p.FIXED_EXPIRATION:p.DYNAMIC_EXPIRATION),Qe=[{value:r.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:se===r.AMOUNT_OFF_ORDER},{value:r.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:se===r.AMOUNT_OFF_PRODUCTS},{value:r.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:se===r.BUY_X_GET_Y},{value:r.FREE_SHIPPING,label:"Free shipping",selected:se===r.FREE_SHIPPING}];l((()=>{L.makeExpiryMandatory&&qe(!0)}),[L.makeExpiryMandatory]),l((()=>{var e,i,t,o,n,l,d,s;let u;const{tempCouponData:C,discountType:b}=He();ue(b);const y=(e,i)=>{Me(C.valueType===v.FIXED_AMOUNT?W[e]:W[i])},P=(e,i)=>{Object.keys(e||{}).length&&i(e)};switch(((null==C?void 0:C.expireAfter)||(null==C?void 0:C.expireAt))&&(qe(!0),(null==C?void 0:C.expireAt)&&Xe(p.FIXED_EXPIRATION),(null==C?void 0:C.expireAfter)&&Xe(p.DYNAMIC_EXPIRATION)),b){case r.AMOUNT_OFF_ORDER:y(0,1),ve(a.ENTIRE_ORDER);break;case r.AMOUNT_OFF_PRODUCTS:y(0,1),(null===(e=C.entitledCollectionIds)||void 0===e?void 0:e.length)?ve(a.SPECIFIC_COLLECTIONS):(null===(i=C.entitledProductIds)||void 0===i?void 0:i.length)||(null===(t=C.productVariableConf)||void 0===t?void 0:t.entitledProductVariable)?(ve(a.SPECIFIC_PRODUCTS),P(null===(o=C.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,Ve)):ve(a.ENTIRE_ORDER);break;case r.BUY_X_GET_Y:Me(W[2]),(null===(n=C.entitledCollectionIds)||void 0===n?void 0:n.length)?Ie(c.SPECIFIC_COLLECTIONS):(Ie(c.SPECIFIC_PRODUCTS),P(null===(l=C.productVariableConf)||void 0===l?void 0:l.entitledProductVariable,Ve)),(null===(d=C.prerequisiteCollectionIds)||void 0===d?void 0:d.length)?Pe(c.SPECIFIC_COLLECTIONS):(Pe(c.SPECIFIC_PRODUCTS),P(null===(s=C.productVariableConf)||void 0===s?void 0:s.prerequisiteProductVariable,_e));break;case r.FREE_SHIPPING:Me(W[3])}de(Object.assign({},C)),L.hideProbability||(u=$e()),ce(R(C,pe,b,L.hideProbability||!1,u,!!C.isStaticCoupon,L.getDetailedDescription||!1)),L.hideProbability||$e()}),[]),l((()=>{let e;L.hideProbability||(e=$e()),ce(R(re,pe,se,L.hideProbability||!1,e,!!re.isStaticCoupon,L.getDetailedDescription||!1))}),[re,ke,se,pe]),l((()=>{var e,i,t,o,n,l,r;if(!L.newPickerConf&&((null===(e=L.products)||void 0===e?void 0:e.length)||(null===(i=L.collection)||void 0===i?void 0:i.length))){if(L.products&&(null===(t=L.products)||void 0===t?void 0:t.length)){if(null===(o=L.data)||void 0===o?void 0:o.entitledProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ee(e)}if(null===(n=L.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Se(e)}}if(L.collection&&L.collection.length){if(null===(l=L.data)||void 0===l?void 0:l.entitledCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ne(e)}if(null===(r=L.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));fe(e)}}}}),[L.products,L.collection]),l((()=>{var e,i,t,o,n,l,r,d;(null===(i=null===(e=L.data)||void 0===e?void 0:e.productsConf)||void 0===i?void 0:i.entitledProducts)&&Ee(L.data.productsConf.entitledProducts),(null===(o=null===(t=L.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&Se(L.data.productsConf.prerequisiteProducts),(null===(l=null===(n=L.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&Ne(L.data.collectionsConf.entitledCollections),(null===(d=null===(r=L.data)||void 0===r?void 0:r.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&fe(L.data.collectionsConf.prerequisiteCollections)}),[null===(X=L.data)||void 0===X?void 0:X.productsConf,null===(Q=L.data)||void 0===Q?void 0:Q.collectionsConf]),l((()=>{if(!Oe)return;if(L.newPickerConf){const e=[];return Object.values(Oe).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}const e=Oe.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}),[Oe]),l((()=>{if(!he)return;if(L.newPickerConf){const e=[];return Object.values(he).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}const e=he.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}),[he]),l((()=>{if(!Ae)return;if(L.newPickerConf){(null==Ae?void 0:Ae.isCustom)&&delete Ae.isCustom;const e=Object.keys(Ae).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}const e=Ae.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}),[Ae]),l((()=>{if(!Te)return;if(L.newPickerConf){(null==Te?void 0:Te.isCustom)&&delete Te.isCustom;const e=Object.keys(Te).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}const e=Te.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}),[Te]);const He=()=>{var e,i,t,o;let n,l=re;return re.isStaticCoupon?re.isStaticCoupon&&L.getDetailedDescription&&(re.targetType===C.SHIPPING_LINE?n=r.FREE_SHIPPING:re.targetType===C.LINE_ITEM?n=re.targetSelection===b.ENTITLED?(null===(t=re.prerequisiteProductIds)||void 0===t?void 0:t.length)||(null===(o=re.prerequisiteCollectionIds)||void 0===o?void 0:o.length)||re.prerequisiteQuantity||re.entitledQuantity?r.BUY_X_GET_Y:r.AMOUNT_OFF_PRODUCTS:r.AMOUNT_OFF_ORDER:(l=Object.assign(Object.assign({},l),{targetType:C.LINE_ITEM,targetSelection:b.ALL,valueType:v.FIXED_AMOUNT}),n=r.AMOUNT_OFF_ORDER)):re.targetType===C.SHIPPING_LINE?n=r.FREE_SHIPPING:re.targetType===C.LINE_ITEM?n=re.targetSelection===b.ENTITLED?(null===(e=re.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=re.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||re.prerequisiteQuantity||re.entitledQuantity?r.BUY_X_GET_Y:r.AMOUNT_OFF_PRODUCTS:r.AMOUNT_OFF_ORDER:(l=Object.assign(Object.assign({},l),{targetType:C.LINE_ITEM,targetSelection:b.ALL,valueType:v.FIXED_AMOUNT}),n=r.AMOUNT_OFF_ORDER),{discountType:n,tempCouponData:l}},ze=()=>{Le(s),Ge(u)},Ke=e=>{var i;const t={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(i=re.probability)&&void 0!==i?i:-1)>1?"Probability should not exceed 1":re.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((i=>{e[i]&&(o=t[i])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(xe(n>1?"Please add discount details":o),!0)},$e=()=>{if(!L.quadrant||!L.probability)return;const e=[...L.probability];let i=[];e.length>=L.quadrant&&e.splice(L.quadrant-1,1),i=e;const t=i.reduce(((e,i)=>e+i),0)+(re.probability||0);return je(parseFloat(t.toFixed(4))),parseFloat(t.toFixed(4))},Ze=e=>{var i,t,o,n,l,d,a,c,s,u,p,y,P,m,I,h;const S=e.value;ue(S),Se([]),Ee([]),fe([]),Ne([]),S===r.FREE_SHIPPING?de({value:100,targetSelection:b.ALL,targetType:C.SHIPPING_LINE,valueType:v.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(i=re.expireAt)&&void 0!==i?i:void 0,expireAfter:null!==(t=re.expireAfter)&&void 0!==t?t:void 0,probability:re.probability,minQuantity:null!==(o=re.minQuantity)&&void 0!==o?o:void 0,minAmount:null!==(n=re.minAmount)&&void 0!==n?n:void 0}):S===r.BUY_X_GET_Y?de({value:100,targetSelection:b.ENTITLED,targetType:C.LINE_ITEM,valueType:v.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(l=re.expireAt)&&void 0!==l?l:void 0,expireAfter:null!==(d=re.expireAfter)&&void 0!==d?d:void 0,probability:re.probability,minQuantity:void 0,minAmount:void 0}):S===r.AMOUNT_OFF_ORDER?de({targetSelection:b.ALL,targetType:C.LINE_ITEM,valueType:null!==(a=re.valueType)&&void 0!==a?a:v.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(c=re.expireAt)&&void 0!==c?c:void 0,expireAfter:null!==(s=re.expireAfter)&&void 0!==s?s:void 0,probability:re.probability,value:re.value,minQuantity:null!==(u=re.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=re.minAmount)&&void 0!==p?p:void 0}):S===r.AMOUNT_OFF_PRODUCTS&&de({targetSelection:b.ENTITLED,targetType:C.LINE_ITEM,valueType:null!==(y=re.valueType)&&void 0!==y?y:v.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(P=re.expireAt)&&void 0!==P?P:void 0,expireAfter:null!==(m=re.expireAfter)&&void 0!==m?m:void 0,probability:re.probability,value:re.value,minQuantity:null!==(I=re.minQuantity)&&void 0!==I?I:void 0,minAmount:null!==(h=re.minAmount)&&void 0!==h?h:void 0})},Je=i=>i&&e(E,{theme:"light",tagText:i,type:"negative",LeadingIcon:_});return i(S,Object.assign({width:(ne||ee)&&L.newPickerConf?"25px":"640px",open:L.isOpen,hideCrossButton:!!te,headingTitle:ee?"Select Products":L.title,headingSubtitle:ee?void 0:L.subTitle,footerLeftCustomElement:Fe?Je(Fe):L.errorMsg?Je(L.errorMsg):!L.quadrant||L.hideProbability?e(t,{}):ke<=1?e(E,{theme:"light",tagText:`Current probability sum: ${ke}`,type:"white"}):e(T,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(E,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ke}`,type:"negative",LeadingIcon:D})})})),headerRightCustomElement:L.allowStaticCoupon||ee?void 0:e(y,{options:Qe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ze(e)}}),onClose:L.onClose,footerContainerStyle:{borderTop:`1px solid ${h.colorsV2.stroke.primary}`},primaryButton:ee?{buttonType:"primary",onClick:()=>{ie(void 0)},buttonText:"Add"}:ne?{buttonType:"primary",onClick:()=>{le(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(H=L.loading)&&void 0!==H&&H,onClick:()=>{var e,i,t,o,n,l,s,u,p,C;if(ze(),re.isStaticCoupon&&!L.getDetailedDescription){const{isStaticCoupon:e,couponCode:i,title:t,description:o,quadrant:n,probability:l}=re,r={invalidDiscountCode:!i,invalidCouponTitle:!t,invalidCouponDescription:!o,inValidProbability:!L.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(Ke(r))return void Le(r);if(ae||ke>1)return void xe(!L.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked({quadrant:n,couponCode:i,description:o,isStaticCoupon:e,probability:l,title:re.title})}else if(re.isStaticCoupon&&L.getDetailedDescription){const{isStaticCoupon:l,couponCode:s,title:u,quadrant:p,probability:C}=re,b={invalidDiscountCode:!s,invalidCouponTitle:!u,invalidCouponDescription:!1,inValidProbability:!L.hideProbability&&(null!=C?C:-1)<0||(null!=C?C:0)>1||Number.isNaN(null!=C?C:0)};if(Ke(b))return void Le(b);const v={invalidCouponTitle:!re.title,inValidProbability:!L.hideProbability&&(null!==(e=re.probability)&&void 0!==e?e:-1)<=0||(null!==(i=re.probability)&&void 0!==i?i:-1)>1||Number.isNaN(null!==(t=re.probability)&&void 0!==t?t:-1),inValidDiscountAmount:!re.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(se!==r.BUY_X_GET_Y&&pe!==d.NA){const{minAmount:e,minQuantity:i}=re;v.inValidMinimumAmount=pe===d.AMOUNT&&!e,v.inValidMinimumQuantity=pe===d.QUANTITY&&!i}if(we&&(v.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==r.AMOUNT_OFF_ORDER&&se!==r.AMOUNT_OFF_PRODUCTS||(be!==a.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(v.inValidProductSelection=!0,v.inValidProductVariableSelection=!0),be===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(v.inValidCollectionSelection=!0)),se===r.BUY_X_GET_Y&&(re.prerequisiteQuantity||(v.inValidBuyXValue=!0),re.entitledQuantity||(v.inValidGetYValue=!0),ye!==c.SPECIFIC_PRODUCTS||!he||Object.keys(he).length||De||(v.inValidBuyXProductSelection=!0,v.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Te&&!Object.keys(Te).length&&(v.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(v.inValidGetYProductSelection=!0,v.inValidGetYProductVariableSelection=!0),me===c.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(v.inValidGetYCollectionSelection=!0)),Ke(v))return void Ge(v);if(ae||ke>1)return void xe(!L.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked(Object.assign(Object.assign({},re),{couponCode:s,isStaticCoupon:l,quadrant:p,description:M(re,L.currency,null!==(o=L.products)&&void 0!==o?o:[],null!==(n=L.collection)&&void 0!==n?n:[]),productsConf:{entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[]},productVariableConf:{entitledProductVariable:null!=ge?ge:{},prerequisiteProductVariable:null!=De?De:{}}}))}else{const e={invalidCouponTitle:!re.title,inValidProbability:!L.hideProbability&&(null!==(l=re.probability)&&void 0!==l?l:-1)<=0||(null!==(s=re.probability)&&void 0!==s?s:-1)>1||Number.isNaN(null!==(u=re.probability)&&void 0!==u?u:-1),inValidDiscountAmount:!re.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(se!==r.BUY_X_GET_Y&&pe!==d.NA){const{minAmount:i,minQuantity:t}=re;e.inValidMinimumAmount=pe===d.AMOUNT&&!i,e.inValidMinimumQuantity=pe===d.QUANTITY&&!t}if(we&&(e.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==r.AMOUNT_OFF_ORDER&&se!==r.AMOUNT_OFF_PRODUCTS||(be!==a.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(e.inValidProductSelection=!0,e.inValidProductVariableSelection=!0),be===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(e.inValidCollectionSelection=!0)),se===r.BUY_X_GET_Y&&(re.prerequisiteQuantity||(e.inValidBuyXValue=!0),re.entitledQuantity||(e.inValidGetYValue=!0),ye!==c.SPECIFIC_PRODUCTS||!he||Object.keys(he).length||De||(e.inValidBuyXProductSelection=!0,e.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Te&&!Object.keys(Te).length&&(e.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(e.inValidGetYProductSelection=!0,e.inValidGetYProductVariableSelection=!0),me===c.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(e.inValidGetYCollectionSelection=!0)),Ke(e))return void Ge(e);if(ae||ke>1)return void xe(!L.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked(Object.assign(Object.assign({},re),{isStaticCoupon:re.isStaticCoupon,description:M(re,L.currency,null!==(p=L.products)&&void 0!==p?p:[],null!==(C=L.collection)&&void 0!==C?C:[]),productsConf:{entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[]},productVariableConf:{entitledProductVariable:null!=ge?ge:{},prerequisiteProductVariable:null!=De?De:{}}}))}}},secondaryButton:ee?{buttonType:"tertiaryGray",onClick:()=>{ie(void 0)},buttonText:"Back"}:ne?{buttonType:"tertiaryGray",onClick:()=>{le(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:L.onClose,buttonText:"Cancel"}},{children:[!ee&&!ne&&i(j,{children:[L.allowStaticCoupon&&!ee&&!L.hideOption&&i(F,Object.assign({selectedDiv:re.isStaticCoupon?1:2},{children:["static"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{re.isStaticCoupon||(de({isStaticCoupon:!0,quadrant:re.quadrant}),xe(""),ze())}},{children:[e(P,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?h.colorsV2.content.brand:void 0}},{children:"Static Code"})),e(m,Object.assign({style:re.isStaticCoupon?{color:h.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{var i;re.isStaticCoupon&&(ue(r.AMOUNT_OFF_ORDER),de({isStaticCoupon:!1,quadrant:re.quadrant,targetType:C.LINE_ITEM,targetSelection:b.ALL,valueType:v.FIXED_AMOUNT}),xe(""),ze(),Me({id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i}},{children:L.currency||""}))}),qe(null!==(i=L.makeExpiryMandatory)&&void 0!==i&&i),Ce(d.NA))}},{children:[e(P,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?void 0:h.colorsV2.content.brand}},{children:"Dynamic Code"})),e(m,Object.assign({style:re.isStaticCoupon?{}:{color:h.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),!L.getDetailedDescription&&e(I,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"}))," ",re.isStaticCoupon&&!ee&&!L.getDetailedDescription&&e(U,{discountData:re,setDiscountData:de,hideProbability:L.hideProbability||!1,discountAdminUrl:L.discountAdminUrl,staticDiscountValidationError:Ue,currency:L.currency}),re.isStaticCoupon&&!ee&&L.getDetailedDescription&&e(U,{discountData:re,setDiscountData:de,hideProbability:L.hideProbability||!1,discountAdminUrl:L.discountAdminUrl,staticDiscountValidationError:Ue,currency:L.currency,getDetailedDescription:!0,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:Ce,discountCouponAppliesTo:be,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:ve,setOfferAppliesToBuy:Pe,setOfferAppliesToGet:Ie,hideExpiration:L.hideExpiration||!1,onChangeCouponType:Ze,entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[],setEntitledProducts:Ee,setPrerequisiteProducts:Se,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[],setEntitledCollections:Ne,setPrerequisiteCollections:fe,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setIsCollectionPickerOpen:le,productPickerOpen:ee,productVariablePickerOpen:te,collectionPickerOpen:ne,useNewPicker:!!L.newPickerConf,selectedDiscountDetails:Re,setSelectedDiscountDetails:Me,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:ge,setEntitledProductVariable:Ve,preRequisiteProductVariable:De,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:xe,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory}),!re.isStaticCoupon&&!ee&&!ne&&e(w,{currency:L.currency,entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[],setEntitledProducts:Ee,setPrerequisiteProducts:Se,discountData:re,productPickerOpen:ee,productVariablePickerOpen:te,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setDiscountData:de,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:Ce,discountCouponAppliesTo:be,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:ve,setOfferAppliesToBuy:Pe,setOfferAppliesToGet:Ie,hideProbability:L.hideProbability||!1,hideExpiration:L.hideExpiration||!1,allowStaticCoupon:L.allowStaticCoupon,onChangeCouponType:Ze,collectionPickerOpen:ne,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[],setIsCollectionPickerOpen:le,setEntitledCollections:Ne,setPrerequisiteCollections:fe,useNewPicker:!!L.newPickerConf,setSelectedDiscountDetails:Me,selectedDiscountDetails:Re,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:ge,setEntitledProductVariable:Ve,preRequisiteProductVariable:De,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:xe,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory})]}),!!ee&&i(t,{children:[!L.newPickerConf&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(O,{show:!0,onSave:()=>{},products:null!==(z=L.products)&&void 0!==z?z:[],title:"Select Products",onClose:()=>{ie(void 0)},selectedProducts:null!==(K=ee===q.ENTITLED?Oe:he)&&void 0!==K?K:[],setSelectedProducts:ee===q.ENTITLED?Ee:Se,onSearchKeyChange:L.onProductSearch})})),L.newPickerConf&&e(A,{visible:!0,onClose:()=>ie(void 0),collectionFetcher:(e,i,t)=>{var o;return(null===(o=L.newPickerConf)||void 0===o?void 0:o.fetchCollections)?L.newPickerConf.fetchCollections(e,i,!1,t):null},productFetcher:(e,i,t,o,n)=>{var l;return(null===(l=L.newPickerConf)||void 0===l?void 0:l.fetchProducts)?L.newPickerConf.fetchProducts(e,i,o,n,!1,t):null},selectedItems:ee===q.ENTITLED?Oe:he,onAdd:e=>{ee===q.ENTITLED?Ee(e):Se(e),ie(void 0)},zIndex:200,storeId:L.newPickerConf.storeId,appType:L.newPickerConf.appType||o.BIK,searchInCollectionFetcher:(e,i,t,o)=>{var n;return(null===(n=L.newPickerConf)||void 0===n?void 0:n.searchInCollection)?L.newPickerConf.searchInCollection(e,i,t,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,i,t)=>{var o;return(null===(o=L.newPickerConf)||void 0===o?void 0:o.searchProducts)?L.newPickerConf.searchProducts(e,i,!1,t):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!ne&&e("div",Object.assign({style:{padding:"12px 0"}},{children:i(t,{children:[L.newPickerConf&&e(A,{visible:!0,onClose:()=>le(void 0),collectionFetcher:L.newPickerConf.fetchCollections,productFetcher:L.newPickerConf.fetchProducts,selectedItems:ne===q.ENTITLED?Ae:Te,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),ne===q.ENTITLED?Ne(e):fe(e),le(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:L.newPickerConf.storeId,appType:L.newPickerConf.appType||o.BIK,searchInCollectionFetcher:L.newPickerConf.searchInCollection,searchFetcher:L.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!L.newPickerConf&&e(O,{show:!0,onSave:()=>{},products:null!==($=L.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{le(void 0)},selectedProducts:null!==(Z=ne===q.ENTITLED?Ae:Te)&&void 0!==Z?Z:[],setSelectedProducts:ne===q.ENTITLED?Ne:fe,onSearchKeyChange:L.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),te&&e(x,{children:e("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e(k,{type:N.EMBEDDED,data:null!==(J=L.productVariableList)&&void 0!==J?J:[],showHeader:!0,onSelect:e=>{if(te===q.ENTITLED){const{displayName:i,actualValue:t,isAvailable:o}=e;Ve({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}if(te===q.PREREQUISITE){const{displayName:i,actualValue:t,isAvailable:o}=e;_e({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}},onClose:()=>{oe(void 0)}})}))})]}))};export{L as DiscountModal};
|
|
1
|
+
import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import{useState as n,useEffect as l}from"react";import{DISCOUNT_TYPES as r,MIN_PURCHASE_REQUIREMENT as d,DISCOUNT_APPLIES_TO as a,OFFER_APPLIES_TO as c,initialStaticCouponErrorState as s,initialDynamicCouponErrorState as u,COUPON_EXPIRATION as p,DISCOUNT_TARGET_TYPES as C,DISCOUNT_TARGET_SELECTION as b,DISCOUNT_VALUE_TYPES as v}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as y}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{DEFAULT_THEME as P}from"../../constants/Theme.js";import"../../_virtual/_tslib.js";import"lodash/debounce";import{TitleSmall as m,BodyCaption as I,TitleRegular as h}from"../TypographyStyle.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as S}from"../modals/styledModal.js";import{ProductPickerContent as O}from"../product-picker/ProductPickerModal.js";import{Tag as E}from"../tag/Tag.js";import{Tooltip as T}from"../tooltips/Tooltip.js";import f from"../../assets/icons/gift_icon.svg.js";import g from"../../assets/icons/percentage_icon.svg.js";import V from"../../assets/icons/shipping_icon.svg.js";import D from"../../assets/icons/triangle_error.svg.js";import _ from"../../assets/icons/warning.svg.js";import{ProductPickerModal as A}from"../product-picker-v2/modal.js";import"../product-picker-v2/type.js";import{PickerType as N}from"../variable-picker-v3/model.js";import{VariablePicker as k}from"../variable-picker-v3/VariablePicker.js";import{StyledDiscountDialogueContainer as j,CouponTypeContainerStyled as F,VariablePickerContainer as x}from"./DiscountModal.styled.js";import{validateDiscountData as R,descriptionBuilder as M}from"./DiscountUtils.js";import w,{DISCOUNT_PRODUCTS as q}from"./DynamicCoupon/DynamicCoupon.js";import U from"./StaticCoupon/StaticCoupon.js";const L=L=>{var B,G,Y,X,Q,H,z,K,$,Z,J;const W=[{id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i,lineHeight:.9}},{children:L.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(g,{width:24,height:24,color:i})},{id:"2",label:"Buy X get Y",value:r.BUY_X_GET_Y,icon:i=>e(f,{width:24,height:24,color:i})},{id:"3",label:"Free Shipping",value:r.FREE_SHIPPING,icon:i=>e(V,{width:24,height:24,color:i})}],[ee,ie]=n(),[te,oe]=n(),[ne,le]=n(),[re,de]=n(null!==(B=L.data)&&void 0!==B?B:"string"==typeof L.hideOption?{isStaticCoupon:"dynamic"===L.hideOption}:{isStaticCoupon:!0}),[ae,ce]=n(!0),[se,ue]=n(),[pe,Ce]=n((null===(G=L.data)||void 0===G?void 0:G.minAmount)?d.AMOUNT:(null===(Y=L.data)||void 0===Y?void 0:Y.minQuantity)?d.QUANTITY:d.NA),[be,ve]=n(a.ENTIRE_ORDER),[ye,Pe]=n(c.SPECIFIC_PRODUCTS),[me,Ie]=n(c.SPECIFIC_PRODUCTS),[he,Se]=n(void 0),[Oe,Ee]=n(void 0),[Te,fe]=n(void 0),[ge,Ve]=n(void 0),[De,_e]=n(void 0),[Ae,Ne]=n(void 0),[ke,je]=n(0),[Fe,xe]=n(""),[Re,Me]=n(W[0]),[we,qe]=n(!1),[Ue,Le]=n(s),[Be,Ge]=n(u),[Ye,Xe]=n(L.getDetailedDescription?p.FIXED_EXPIRATION:p.DYNAMIC_EXPIRATION),Qe=[{value:r.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:se===r.AMOUNT_OFF_ORDER},{value:r.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:se===r.AMOUNT_OFF_PRODUCTS},{value:r.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:se===r.BUY_X_GET_Y},{value:r.FREE_SHIPPING,label:"Free shipping",selected:se===r.FREE_SHIPPING}];l((()=>{L.makeExpiryMandatory&&qe(!0)}),[L.makeExpiryMandatory]),l((()=>{var e,i,t,o,n,l,d,s;let u;const{tempCouponData:C,discountType:b}=He();ue(b);const y=(e,i)=>{Me(C.valueType===v.FIXED_AMOUNT?W[e]:W[i])},P=(e,i)=>{Object.keys(e||{}).length&&i(e)};switch(((null==C?void 0:C.expireAfter)||(null==C?void 0:C.expireAt))&&(qe(!0),(null==C?void 0:C.expireAt)&&Xe(p.FIXED_EXPIRATION),(null==C?void 0:C.expireAfter)&&Xe(p.DYNAMIC_EXPIRATION)),b){case r.AMOUNT_OFF_ORDER:y(0,1),ve(a.ENTIRE_ORDER);break;case r.AMOUNT_OFF_PRODUCTS:y(0,1),(null===(e=C.entitledCollectionIds)||void 0===e?void 0:e.length)?ve(a.SPECIFIC_COLLECTIONS):(null===(i=C.entitledProductIds)||void 0===i?void 0:i.length)||(null===(t=C.productVariableConf)||void 0===t?void 0:t.entitledProductVariable)?(ve(a.SPECIFIC_PRODUCTS),P(null===(o=C.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,Ve)):ve(a.ENTIRE_ORDER);break;case r.BUY_X_GET_Y:Me(W[2]),(null===(n=C.entitledCollectionIds)||void 0===n?void 0:n.length)?Ie(c.SPECIFIC_COLLECTIONS):(Ie(c.SPECIFIC_PRODUCTS),P(null===(l=C.productVariableConf)||void 0===l?void 0:l.entitledProductVariable,Ve)),(null===(d=C.prerequisiteCollectionIds)||void 0===d?void 0:d.length)?Pe(c.SPECIFIC_COLLECTIONS):(Pe(c.SPECIFIC_PRODUCTS),P(null===(s=C.productVariableConf)||void 0===s?void 0:s.prerequisiteProductVariable,_e));break;case r.FREE_SHIPPING:Me(W[3])}de(Object.assign({},C)),L.hideProbability||(u=$e()),ce(R(C,pe,b,L.hideProbability||!1,u,!!C.isStaticCoupon,L.getDetailedDescription||!1)),L.hideProbability||$e()}),[]),l((()=>{let e;L.hideProbability||(e=$e()),ce(R(re,pe,se,L.hideProbability||!1,e,!!re.isStaticCoupon,L.getDetailedDescription||!1))}),[re,ke,se,pe]),l((()=>{var e,i,t,o,n,l,r;if(!L.newPickerConf&&((null===(e=L.products)||void 0===e?void 0:e.length)||(null===(i=L.collection)||void 0===i?void 0:i.length))){if(L.products&&(null===(t=L.products)||void 0===t?void 0:t.length)){if(null===(o=L.data)||void 0===o?void 0:o.entitledProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ee(e)}if(null===(n=L.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Se(e)}}if(L.collection&&L.collection.length){if(null===(l=L.data)||void 0===l?void 0:l.entitledCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ne(e)}if(null===(r=L.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));fe(e)}}}}),[L.products,L.collection]),l((()=>{var e,i,t,o,n,l,r,d;(null===(i=null===(e=L.data)||void 0===e?void 0:e.productsConf)||void 0===i?void 0:i.entitledProducts)&&Ee(L.data.productsConf.entitledProducts),(null===(o=null===(t=L.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&Se(L.data.productsConf.prerequisiteProducts),(null===(l=null===(n=L.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&Ne(L.data.collectionsConf.entitledCollections),(null===(d=null===(r=L.data)||void 0===r?void 0:r.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&fe(L.data.collectionsConf.prerequisiteCollections)}),[null===(X=L.data)||void 0===X?void 0:X.productsConf,null===(Q=L.data)||void 0===Q?void 0:Q.collectionsConf]),l((()=>{if(!Oe)return;if(L.newPickerConf){const e=[];return Object.values(Oe).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}const e=Oe.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}),[Oe]),l((()=>{if(!he)return;if(L.newPickerConf){const e=[];return Object.values(he).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}const e=he.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}),[he]),l((()=>{if(!Ae)return;if(L.newPickerConf){(null==Ae?void 0:Ae.isCustom)&&delete Ae.isCustom;const e=Object.keys(Ae).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}const e=Ae.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}),[Ae]),l((()=>{if(!Te)return;if(L.newPickerConf){(null==Te?void 0:Te.isCustom)&&delete Te.isCustom;const e=Object.keys(Te).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}const e=Te.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}),[Te]);const He=()=>{var e,i,t,o;let n,l=re;return re.isStaticCoupon?re.isStaticCoupon&&L.getDetailedDescription&&(re.targetType===C.SHIPPING_LINE?n=r.FREE_SHIPPING:re.targetType===C.LINE_ITEM?n=re.targetSelection===b.ENTITLED?(null===(t=re.prerequisiteProductIds)||void 0===t?void 0:t.length)||(null===(o=re.prerequisiteCollectionIds)||void 0===o?void 0:o.length)||re.prerequisiteQuantity||re.entitledQuantity?r.BUY_X_GET_Y:r.AMOUNT_OFF_PRODUCTS:r.AMOUNT_OFF_ORDER:(l=Object.assign(Object.assign({},l),{targetType:C.LINE_ITEM,targetSelection:b.ALL,valueType:v.FIXED_AMOUNT}),n=r.AMOUNT_OFF_ORDER)):re.targetType===C.SHIPPING_LINE?n=r.FREE_SHIPPING:re.targetType===C.LINE_ITEM?n=re.targetSelection===b.ENTITLED?(null===(e=re.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=re.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||re.prerequisiteQuantity||re.entitledQuantity?r.BUY_X_GET_Y:r.AMOUNT_OFF_PRODUCTS:r.AMOUNT_OFF_ORDER:(l=Object.assign(Object.assign({},l),{targetType:C.LINE_ITEM,targetSelection:b.ALL,valueType:v.FIXED_AMOUNT}),n=r.AMOUNT_OFF_ORDER),{discountType:n,tempCouponData:l}},ze=()=>{Le(s),Ge(u)},Ke=e=>{var i;const t={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(i=re.probability)&&void 0!==i?i:-1)>1?"Probability should not exceed 1":re.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((i=>{e[i]&&(o=t[i])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(xe(n>1?"Please add discount details":o),!0)},$e=()=>{if(!L.quadrant||!L.probability)return;const e=[...L.probability];let i=[];e.length>=L.quadrant&&e.splice(L.quadrant-1,1),i=e;const t=i.reduce(((e,i)=>e+i),0)+(re.probability||0);return je(parseFloat(t.toFixed(4))),parseFloat(t.toFixed(4))},Ze=e=>{var i,t,o,n,l,d,a,c,s,u,p,y,P,m,I,h;const S=e.value;ue(S),Se([]),Ee([]),fe([]),Ne([]),S===r.FREE_SHIPPING?de({value:100,targetSelection:b.ALL,targetType:C.SHIPPING_LINE,valueType:v.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(i=re.expireAt)&&void 0!==i?i:void 0,expireAfter:null!==(t=re.expireAfter)&&void 0!==t?t:void 0,probability:re.probability,minQuantity:null!==(o=re.minQuantity)&&void 0!==o?o:void 0,minAmount:null!==(n=re.minAmount)&&void 0!==n?n:void 0}):S===r.BUY_X_GET_Y?de({value:100,targetSelection:b.ENTITLED,targetType:C.LINE_ITEM,valueType:v.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(l=re.expireAt)&&void 0!==l?l:void 0,expireAfter:null!==(d=re.expireAfter)&&void 0!==d?d:void 0,probability:re.probability,minQuantity:void 0,minAmount:void 0}):S===r.AMOUNT_OFF_ORDER?de({targetSelection:b.ALL,targetType:C.LINE_ITEM,valueType:null!==(a=re.valueType)&&void 0!==a?a:v.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(c=re.expireAt)&&void 0!==c?c:void 0,expireAfter:null!==(s=re.expireAfter)&&void 0!==s?s:void 0,probability:re.probability,value:re.value,minQuantity:null!==(u=re.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=re.minAmount)&&void 0!==p?p:void 0}):S===r.AMOUNT_OFF_PRODUCTS&&de({targetSelection:b.ENTITLED,targetType:C.LINE_ITEM,valueType:null!==(y=re.valueType)&&void 0!==y?y:v.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!!L.getDetailedDescription,title:re.title,couponCode:L.getDetailedDescription?re.couponCode:void 0,expireAt:null!==(P=re.expireAt)&&void 0!==P?P:void 0,expireAfter:null!==(m=re.expireAfter)&&void 0!==m?m:void 0,probability:re.probability,value:re.value,minQuantity:null!==(I=re.minQuantity)&&void 0!==I?I:void 0,minAmount:null!==(h=re.minAmount)&&void 0!==h?h:void 0})},Je=i=>i&&e(E,{theme:"light",tagText:i,type:"negative",LeadingIcon:_});return i(S,Object.assign({width:(ne||ee)&&L.newPickerConf?"25px":"640px",open:L.isOpen,hideCrossButton:!!te,headingTitle:ee?"Select Products":L.title,headingSubtitle:ee?void 0:L.subTitle,footerLeftCustomElement:Fe?Je(Fe):L.errorMsg?Je(L.errorMsg):!L.quadrant||L.hideProbability?e(t,{}):ke<=1?e(E,{theme:"light",tagText:`Current probability sum: ${ke}`,type:"white"}):e(T,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(E,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ke}`,type:"negative",LeadingIcon:D})})})),headerRightCustomElement:L.allowStaticCoupon||ee?void 0:e(y,{options:Qe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ze(e)}}),onClose:L.onClose,footerContainerStyle:{borderTop:`1px solid ${P.colorsV2.stroke.primary}`},primaryButton:ee?{buttonType:"primary",onClick:()=>{ie(void 0)},buttonText:"Add"}:ne?{buttonType:"primary",onClick:()=>{le(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(H=L.loading)&&void 0!==H&&H,onClick:()=>{var e,i,t,o,n,l,s,u,p,C;if(ze(),re.isStaticCoupon&&!L.getDetailedDescription){const{isStaticCoupon:e,couponCode:i,title:t,description:o,quadrant:n,probability:l}=re,r={invalidDiscountCode:!i,invalidCouponTitle:!t,invalidCouponDescription:!o,inValidProbability:!L.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(Ke(r))return void Le(r);if(ae||ke>1)return void xe(!L.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked({quadrant:n,couponCode:i,description:o,isStaticCoupon:e,probability:l,title:re.title})}else if(re.isStaticCoupon&&L.getDetailedDescription){const{isStaticCoupon:l,couponCode:s,title:u,quadrant:p,probability:C}=re,b={invalidDiscountCode:!s,invalidCouponTitle:!u,invalidCouponDescription:!1,inValidProbability:!L.hideProbability&&(null!=C?C:-1)<0||(null!=C?C:0)>1||Number.isNaN(null!=C?C:0)};if(Ke(b))return void Le(b);const v={invalidCouponTitle:!re.title,inValidProbability:!L.hideProbability&&(null!==(e=re.probability)&&void 0!==e?e:-1)<=0||(null!==(i=re.probability)&&void 0!==i?i:-1)>1||Number.isNaN(null!==(t=re.probability)&&void 0!==t?t:-1),inValidDiscountAmount:!re.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(se!==r.BUY_X_GET_Y&&pe!==d.NA){const{minAmount:e,minQuantity:i}=re;v.inValidMinimumAmount=pe===d.AMOUNT&&!e,v.inValidMinimumQuantity=pe===d.QUANTITY&&!i}if(we&&(v.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==r.AMOUNT_OFF_ORDER&&se!==r.AMOUNT_OFF_PRODUCTS||(be!==a.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(v.inValidProductSelection=!0,v.inValidProductVariableSelection=!0),be===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(v.inValidCollectionSelection=!0)),se===r.BUY_X_GET_Y&&(re.prerequisiteQuantity||(v.inValidBuyXValue=!0),re.entitledQuantity||(v.inValidGetYValue=!0),ye!==c.SPECIFIC_PRODUCTS||!he||Object.keys(he).length||De||(v.inValidBuyXProductSelection=!0,v.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Te&&!Object.keys(Te).length&&(v.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(v.inValidGetYProductSelection=!0,v.inValidGetYProductVariableSelection=!0),me===c.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(v.inValidGetYCollectionSelection=!0)),Ke(v))return void Ge(v);if(ae||ke>1)return void xe(!L.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked(Object.assign(Object.assign({},re),{couponCode:s,isStaticCoupon:l,quadrant:p,description:M(re,L.currency,null!==(o=L.products)&&void 0!==o?o:[],null!==(n=L.collection)&&void 0!==n?n:[]),productsConf:{entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[]},productVariableConf:{entitledProductVariable:null!=ge?ge:{},prerequisiteProductVariable:null!=De?De:{}}}))}else{const e={invalidCouponTitle:!re.title,inValidProbability:!L.hideProbability&&(null!==(l=re.probability)&&void 0!==l?l:-1)<=0||(null!==(s=re.probability)&&void 0!==s?s:-1)>1||Number.isNaN(null!==(u=re.probability)&&void 0!==u?u:-1),inValidDiscountAmount:!re.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(se!==r.BUY_X_GET_Y&&pe!==d.NA){const{minAmount:i,minQuantity:t}=re;e.inValidMinimumAmount=pe===d.AMOUNT&&!i,e.inValidMinimumQuantity=pe===d.QUANTITY&&!t}if(we&&(e.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==r.AMOUNT_OFF_ORDER&&se!==r.AMOUNT_OFF_PRODUCTS||(be!==a.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(e.inValidProductSelection=!0,e.inValidProductVariableSelection=!0),be===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(e.inValidCollectionSelection=!0)),se===r.BUY_X_GET_Y&&(re.prerequisiteQuantity||(e.inValidBuyXValue=!0),re.entitledQuantity||(e.inValidGetYValue=!0),ye!==c.SPECIFIC_PRODUCTS||!he||Object.keys(he).length||De||(e.inValidBuyXProductSelection=!0,e.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Te&&!Object.keys(Te).length&&(e.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Oe||Object.keys(Oe).length||ge||(e.inValidGetYProductSelection=!0,e.inValidGetYProductVariableSelection=!0),me===c.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(e.inValidGetYCollectionSelection=!0)),Ke(e))return void Ge(e);if(ae||ke>1)return void xe(!L.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked(Object.assign(Object.assign({},re),{isStaticCoupon:re.isStaticCoupon,description:M(re,L.currency,null!==(p=L.products)&&void 0!==p?p:[],null!==(C=L.collection)&&void 0!==C?C:[]),productsConf:{entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[]},productVariableConf:{entitledProductVariable:null!=ge?ge:{},prerequisiteProductVariable:null!=De?De:{}}}))}}},secondaryButton:ee?{buttonType:"tertiaryGray",onClick:()=>{ie(void 0)},buttonText:"Back"}:ne?{buttonType:"tertiaryGray",onClick:()=>{le(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:L.onClose,buttonText:"Cancel"}},{children:[!ee&&!ne&&i(j,{children:[L.allowStaticCoupon&&!ee&&!L.hideOption&&i(F,Object.assign({selectedDiv:re.isStaticCoupon?1:2},{children:["static"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{re.isStaticCoupon||(de({isStaticCoupon:!0,quadrant:re.quadrant}),xe(""),ze())}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?P.colorsV2.content.brand:void 0}},{children:"Static Code"})),e(I,Object.assign({style:re.isStaticCoupon?{color:P.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{var i;re.isStaticCoupon&&(ue(r.AMOUNT_OFF_ORDER),de({isStaticCoupon:!1,quadrant:re.quadrant,targetType:C.LINE_ITEM,targetSelection:b.ALL,valueType:v.FIXED_AMOUNT}),xe(""),ze(),Me({id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i}},{children:L.currency||""}))}),qe(null!==(i=L.makeExpiryMandatory)&&void 0!==i&&i),Ce(d.NA))}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?void 0:P.colorsV2.content.brand}},{children:"Dynamic Code"})),e(I,Object.assign({style:re.isStaticCoupon?{}:{color:P.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."}))]}))]})),!L.getDetailedDescription&&e(h,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"}))," ",re.isStaticCoupon&&!ee&&!L.getDetailedDescription&&e(U,{discountData:re,setDiscountData:de,hideProbability:L.hideProbability||!1,discountAdminUrl:L.discountAdminUrl,staticDiscountValidationError:Ue,currency:L.currency}),re.isStaticCoupon&&!ee&&L.getDetailedDescription&&e(U,{discountData:re,setDiscountData:de,hideProbability:L.hideProbability||!1,discountAdminUrl:L.discountAdminUrl,staticDiscountValidationError:Ue,currency:L.currency,getDetailedDescription:!0,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:Ce,discountCouponAppliesTo:be,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:ve,setOfferAppliesToBuy:Pe,setOfferAppliesToGet:Ie,hideExpiration:L.hideExpiration||!1,onChangeCouponType:Ze,entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[],setEntitledProducts:Ee,setPrerequisiteProducts:Se,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[],setEntitledCollections:Ne,setPrerequisiteCollections:fe,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setIsCollectionPickerOpen:le,productPickerOpen:ee,productVariablePickerOpen:te,collectionPickerOpen:ne,useNewPicker:!!L.newPickerConf,selectedDiscountDetails:Re,setSelectedDiscountDetails:Me,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:ge,setEntitledProductVariable:Ve,preRequisiteProductVariable:De,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:xe,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory}),!re.isStaticCoupon&&!ee&&!ne&&e(w,{currency:L.currency,entitledProducts:null!=Oe?Oe:[],prerequisiteProducts:null!=he?he:[],setEntitledProducts:Ee,setPrerequisiteProducts:Se,discountData:re,productPickerOpen:ee,productVariablePickerOpen:te,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setDiscountData:de,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:Ce,discountCouponAppliesTo:be,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:ve,setOfferAppliesToBuy:Pe,setOfferAppliesToGet:Ie,hideProbability:L.hideProbability||!1,hideExpiration:L.hideExpiration||!1,allowStaticCoupon:L.allowStaticCoupon,onChangeCouponType:Ze,collectionPickerOpen:ne,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Te?Te:[],setIsCollectionPickerOpen:le,setEntitledCollections:Ne,setPrerequisiteCollections:fe,useNewPicker:!!L.newPickerConf,setSelectedDiscountDetails:Me,selectedDiscountDetails:Re,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:ge,setEntitledProductVariable:Ve,preRequisiteProductVariable:De,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:xe,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory})]}),!!ee&&i(t,{children:[!L.newPickerConf&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(O,{show:!0,onSave:()=>{},products:null!==(z=L.products)&&void 0!==z?z:[],title:"Select Products",onClose:()=>{ie(void 0)},selectedProducts:null!==(K=ee===q.ENTITLED?Oe:he)&&void 0!==K?K:[],setSelectedProducts:ee===q.ENTITLED?Ee:Se,onSearchKeyChange:L.onProductSearch})})),L.newPickerConf&&e(A,{visible:!0,onClose:()=>ie(void 0),collectionFetcher:(e,i,t)=>{var o;return(null===(o=L.newPickerConf)||void 0===o?void 0:o.fetchCollections)?L.newPickerConf.fetchCollections(e,i,!1,t):null},productFetcher:(e,i,t,o,n)=>{var l;return(null===(l=L.newPickerConf)||void 0===l?void 0:l.fetchProducts)?L.newPickerConf.fetchProducts(e,i,o,n,!1,t):null},selectedItems:ee===q.ENTITLED?Oe:he,onAdd:e=>{ee===q.ENTITLED?Ee(e):Se(e),ie(void 0)},zIndex:200,storeId:L.newPickerConf.storeId,appType:L.newPickerConf.appType||o.BIK,searchInCollectionFetcher:(e,i,t,o)=>{var n;return(null===(n=L.newPickerConf)||void 0===n?void 0:n.searchInCollection)?L.newPickerConf.searchInCollection(e,i,t,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,i,t)=>{var o;return(null===(o=L.newPickerConf)||void 0===o?void 0:o.searchProducts)?L.newPickerConf.searchProducts(e,i,!1,t):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!ne&&e("div",Object.assign({style:{padding:"12px 0"}},{children:i(t,{children:[L.newPickerConf&&e(A,{visible:!0,onClose:()=>le(void 0),collectionFetcher:L.newPickerConf.fetchCollections,productFetcher:L.newPickerConf.fetchProducts,selectedItems:ne===q.ENTITLED?Ae:Te,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),ne===q.ENTITLED?Ne(e):fe(e),le(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:L.newPickerConf.storeId,appType:L.newPickerConf.appType||o.BIK,searchInCollectionFetcher:L.newPickerConf.searchInCollection,searchFetcher:L.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!L.newPickerConf&&e(O,{show:!0,onSave:()=>{},products:null!==($=L.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{le(void 0)},selectedProducts:null!==(Z=ne===q.ENTITLED?Ae:Te)&&void 0!==Z?Z:[],setSelectedProducts:ne===q.ENTITLED?Ne:fe,onSearchKeyChange:L.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),te&&e(x,{children:e("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e(k,{type:N.EMBEDDED,data:null!==(J=L.productVariableList)&&void 0!==J?J:[],showHeader:!0,onSelect:e=>{if(te===q.ENTITLED){const{displayName:i,actualValue:t,isAvailable:o}=e;Ve({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}if(te===q.PREREQUISITE){const{displayName:i,actualValue:t,isAvailable:o}=e;_e({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}},onClose:()=>{oe(void 0)}})}))})]}))};export{L as DiscountModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import n from"../../../assets/icons/info.svg.js";import{Alert as l}from"../../alerts/Alert.js";import{ALERT_TYPES as s,CONTENT_POSITION as r}from"../../alerts/AlertHelper.js";import{Button as a}from"../../button/Button.js";import{CheckBox as d}from"../../checkBox/CheckBox.js";import{DISCOUNT_APPLIES_TO as c,OFFER_APPLIES_TO as u,DISCOUNT_TYPES as p,COUPON_EXPIRATION as m,DISCOUNT_VALUE_TYPES as C,DISCOUNT_TARGET_TYPES as E,DISCOUNT_TARGET_SELECTION as v}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as D}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"react";import"../../zeroState/ZeroState.js";import"lodash/debounce";import{BodySecondary as b,TitleRegular as g,TitleSmall as T}from"../../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../../constants/Theme.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../icon-button/IconButton.js";import{Input as y}from"../../input/Input.js";import O from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import{RadioButton as P}from"../../radioButton/RadioButton.js";import I from"../../../assets/icons/cubeIcon.svg.js";import V from"../../../assets/icons/delete.svg.js";import S from"../../../assets/icons/edit.svg.js";import j from"../../../assets/icons/plus.svg.js";import{CouponExpiration as f}from"../CouponExpiration/CouponExpiration.js";import{DynamicCouponContainer as x}from"../DiscountModal.styled.js";import{DiscountOptionsContainer as R,DiscountDetailsOption as _,AddProductButtonsContainer as N,ProductCollectionCard as A,CubeIconContainer as F,IconContainer as L,ProductVariableCard as w}from"./DynamicCoupon.styled.js";import q from"./MinimumRequirementComponent.js";import U from"./ZeroState.js";var k;!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(k||(k={}));const B=B=>{var M,G,Q,X,Y,$,W,z;const Z=[{selected:B.discountCouponAppliesTo===c.ENTIRE_ORDER,label:"Entire Order",value:c.ENTIRE_ORDER},{selected:B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS,label:"Specific Product",value:c.SPECIFIC_PRODUCTS},{selected:B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:c.SPECIFIC_COLLECTIONS}],H=[{selected:B.offerAppliesToBuy===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToBuy===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],J=[{selected:B.offerAppliesToGet===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToGet===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],K=(e,d,u)=>{var p,m,C,E,v,D,g,y,P,f,x,R;let _=[],q=[],U={},M={};B.useNewPicker?(U=d===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=d===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==p?p:[],(null==U?void 0:U.isCustom)&&delete U.isCustom,(null==M?void 0:M.isCustom)&&delete M.isCustom,Object.values(U).forEach((e=>{Object.keys(e.products).forEach((i=>{_.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(M).forEach((e=>{"isCustom"!==e&&q.push({id:e,name:M[e].name,image:M[e].image})}))):(_=d===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=d===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==m?m:[]);const G=[null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidProductSelection,null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidProductVariableSelection,null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],Q=[null===(D=B.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXCollectionSelection,null===(g=B.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidBuyXProductSelection,null===(y=B.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidBuyXProductVariableSelection],X=[null===(P=B.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidGetYCollectionSelection,null===(f=B.dynamicDiscountValidationError)||void 0===f?void 0:f.inValidGetYProductSelection,null===(x=B.dynamicDiscountValidationError)||void 0===x?void 0:x.inValidGetYProductVariableSelection];let Y=!1;return"couponAppliesTo"===u&&(Y=G.some(Boolean)),"buyX"===u&&(Y=Q.some(Boolean)),"getY"===u&&(Y=X.some(Boolean)),i(o,{children:[i("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(d===k.ENTITLED&&!B.entitledProductVariable||d===k.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(N,{children:[t("div",Object.assign({style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:t(a,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(d)},error:Y})})),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(b,Object.assign({color:h.colorsV2.content.placeholder},{children:"OR"})),t(a,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(d)},error:Y})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",Object.assign({style:{width:"300px",display:"flex"}},{children:t(a,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(d)},style:{marginTop:"16px"},error:Y})}))]})),Y&&t("div",Object.assign({style:{margin:"8px 0 0"}},{children:t(l,{type:s.NEGATIVE,text:"Required Field",contentPosition:r.START,icon:()=>t(n,{width:16,height:16,color:h.colorsV2.content.negative})})})),_.length||q.length?i("div",{children:[t(b,Object.assign({style:{margin:"8px 0"}},{children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i(A,{children:[t(F,{children:t(I,{width:20,height:20,color:h.colorsV2.content.secondary})}),i(T,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(d):B.setIsCollectionPickerOpen(d)}},{children:t(S,{width:24,height:24,color:h.colorsV2.content.placeholder})})),t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?d===k.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):d===k.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])}},{children:t(V,{width:24,height:24,color:h.colorsV2.content.placeholder})}))]}))]})]}):d===k.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(b,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(T,{children:B.entitledProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setEntitledProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):d===k.PREREQUISITE&&(null===(R=B.preRequisiteProductVariable)||void 0===R?void 0:R.displayName)?i("div",{children:[t(b,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(T,{children:B.preRequisiteProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setPreRequisiteProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:h.colorsV2.content.primary})}))}))]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,s,r,a,d,p,m,C,E;let v=[],g=[],h={},O={};B.useNewPicker?(h=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,O=null!==(n=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==h?void 0:h.isCustom)&&delete h.isCustom,(null==O?void 0:O.isCustom)&&delete O.isCustom,Object.values(h).forEach((e=>{Object.keys(e.products).forEach((i=>{v.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(O).forEach((e=>{"isCustom"!==e&&g.push({id:e,name:O[e].name,image:O[e].image})}))):(v=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,g=null!==(l=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const P=e===k.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,I=e===k.PREREQUISITE?k.PREREQUISITE:k.ENTITLED,V=P===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(T,Object.assign({style:{marginBottom:16}},{children:e===k.PREREQUISITE?"Customer buys":"Customer gets"})),i("div",Object.assign({style:{display:"flex"}},{children:[!o&&t("div",{children:i("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:e===k.ENTITLED?null!==(r=null===(s=B.discountData.entitledQuantity)||void 0===s?void 0:s.toString())&&void 0!==r?r:"":null!==(d=null===(a=B.discountData.prerequisiteQuantity)||void 0===a?void 0:a.toString())&&void 0!==d?d:"",type:"number",onChangeText:i=>{e===k.ENTITLED?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledQuantity:parseInt(i)})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===k.PREREQUISITE&&(null===(p=B.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidBuyXValue)||e===k.ENTITLED&&(null===(m=B.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYValue)?"Required Field":"",state:e===k.PREREQUISITE&&(null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===k.ENTITLED&&(null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"invalid":"none"})})),t("div",{className:"input__wrapper"})]}))}),i("div",{children:[t(b,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===k.PREREQUISITE&&t(D,{width:"244px",options:H,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToBuy(e.value),B.setPrerequisiteProducts([]),B.setPrerequisiteCollections([]),B.setPreRequisiteProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===k.ENTITLED&&t(D,{width:"244px",options:J,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToGet(e.value),B.setEntitledProducts([]),B.setEntitledCollections([]),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),K(V,I,e===k.PREREQUISITE?"buyX":"getY")]})};return i(x,Object.assign({style:B.noTopMargin?{marginTop:0}:{}},{children:[i("div",{children:[i("div",Object.assign({style:{display:"flex",gap:16}},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(M=B.discountData.title)&&void 0!==M?M:"",onChangeText:e=>{var i;B.setDiscountData(Object.assign(Object.assign({},B.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(G=B.currency)&&void 0!==G?G:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(Q=B.dynamicDiscountValidationError)||void 0===Q?void 0:Q.invalidCouponTitle)?"Required Field":"",state:(null===(X=B.dynamicDiscountValidationError)||void 0===X?void 0:X.invalidCouponTitle)?"invalid":"none"})})),!B.hideProbability&&t(y,{value:null!==($=null===(Y=B.discountData.probability)||void 0===Y?void 0:Y.toString())&&void 0!==$?$:"",type:"number",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(W=B.dynamicDiscountValidationError)||void 0===W?void 0:W.inValidProbability)?"Required Field":"",state:(null===(z=B.dynamicDiscountValidationError)||void 0===z?void 0:z.inValidProbability)?"invalid":"none"})]})),t("div",{style:{height:"1px",width:"100%",background:h.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t((()=>i("div",{children:[t(g,{children:"Discount Details"}),t(R,{children:B.discountDetailsOptions.map((t=>{return i(_,Object.assign({selected:B.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(B.selectedDiscountDetails.id!==i.id)if(B.resetValidationErrors(),B.setValidationErrorMessage(""),B.setDiscountCouponAppliesTo(c.ENTIRE_ORDER),B.setSelectedDiscountDetails(i),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0})),B.setPreRequisiteProductVariable(void 0),B.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){B.onChangeCouponType({label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},B.discountData),{valueType:"percentage"===i.value?C.PERCENTAGE:C.FIXED_AMOUNT,value:void 0,targetType:E.LINE_ITEM,targetSelection:v.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e(t,["entitledQuantity","prerequisiteQuantity"]);B.setDiscountData(o)}else B.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,B.selectedDiscountDetails.id===o?h.colorsV2.stroke.brand:h.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(B.selectedCouponType===p.AMOUNT_OFF_ORDER||B.selectedCouponType===p.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,n,l,s,r,a;return i(o,{children:[t("div",Object.assign({className:"input__rows"},{children:t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(l=null===(n=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===n?void 0:n.toString())&&void 0!==l?l:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:B.discountData.valueType===C.FIXED_AMOUNT?null!==(s=B.currency)&&void 0!==s?s:"":void 0,suffixText:B.discountData.valueType===C.PERCENTAGE?"%":void 0,errorMessage:(null===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"Required Field":"",state:(null===(a=B.dynamicDiscountValidationError)||void 0===a?void 0:a.inValidDiscountAmount)?"invalid":"none"})}))})),t("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:i("div",Object.assign({className:"input__wrapper"},{children:[t(g,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),t("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:t(D,{width:"300px",options:Z,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===c.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:p.AMOUNT_OFF_PRODUCTS};B.onChangeCouponType(i),B.setDiscountCouponAppliesTo(e.value),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS||B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS)&&K(B.discountCouponAppliesTo,k.ENTITLED,"couponAppliesTo")]}))}))]})})(),B.selectedCouponType===p.BUY_X_GET_Y&&(()=>{var e,o,n,l,s;return i(x,Object.assign({style:{border:`1px solid ${h.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[ee(k.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:h.colorsV2.stroke.primary,margin:"8px 0"}}),ee(k.ENTITLED),t(b,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),t("div",{children:t(P,{label:"Free",isActive:100===B.discountData.value,onValueChange:e=>{e?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:100})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}})}),i("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[t(P,{label:"Percentage off",isActive:100!==B.discountData.value,onValueChange:()=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}}),100!==B.discountData.value&&t("div",Object.assign({style:{marginTop:8}},{children:t(y,{value:null!==(n=null===(o=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===o?void 0:o.toString())&&void 0!==n?n:"",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(l=B.dynamicDiscountValidationError)||void 0===l?void 0:l.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!B.selectedCouponType&&t(U,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${h.colorsV2.stroke.primary}`}},{children:t(q,{selectedMinimumRequirement:B.selectedMinimumRequirement,setSelectedMinimumRequirement:B.setSelectedMinimumRequirement,discountData:B.discountData,setDiscountData:B.setDiscountData,currency:B.currency,dynamicDiscountValidationError:B.dynamicDiscountValidationError})})),B.selectedCouponType&&!B.hideExpiration&&i("div",Object.assign({style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${h.colorsV2.stroke.primary}`:"none"}},{children:[t(d,{label:"Add expiration",isDisabled:!!B.makeExpiryMandatory,isChecked:B.isAddExpirationChecked,onValueChange:e=>{B.setIsAddExpirationChecked(e),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{expireAfter:void 0,expireAt:void 0})),B.setSelectedExpiration(B.isUsageFromStatic?m.FIXED_EXPIRATION:m.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),t(b,Object.assign({style:{color:h.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),B.isAddExpirationChecked&&t(f,{discountData:B.discountData,setDiscountData:B.setDiscountData,isAddExpirationChecked:B.isAddExpirationChecked,inValidCouponExpiry:B.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:B.selectedExpiration,setSelectedExpiration:B.setSelectedExpiration,hideExpirationOptions:B.isUsageFromStatic})]}))]}))};export{k as DISCOUNT_PRODUCTS,B as default};
|
|
1
|
+
import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import n from"../../../assets/icons/info.svg.js";import{Alert as l}from"../../alerts/Alert.js";import{ALERT_TYPES as s,CONTENT_POSITION as r}from"../../alerts/AlertHelper.js";import{Button as a}from"../../button/Button.js";import{CheckBox as d}from"../../checkBox/CheckBox.js";import{DISCOUNT_APPLIES_TO as c,OFFER_APPLIES_TO as u,DISCOUNT_TYPES as p,COUPON_EXPIRATION as m,DISCOUNT_VALUE_TYPES as C,DISCOUNT_TARGET_TYPES as E,DISCOUNT_TARGET_SELECTION as v}from"../type.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as D}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"react";import"../../zeroState/ZeroState.js";import{DEFAULT_THEME as b}from"../../../constants/Theme.js";import"lodash/debounce";import{BodySecondary as g,TitleRegular as T,TitleSmall as h}from"../../TypographyStyle.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../icon-button/IconButton.js";import{Input as y}from"../../input/Input.js";import O from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import{RadioButton as P}from"../../radioButton/RadioButton.js";import I from"../../../assets/icons/cubeIcon.svg.js";import V from"../../../assets/icons/delete.svg.js";import S from"../../../assets/icons/edit.svg.js";import j from"../../../assets/icons/plus.svg.js";import{CouponExpiration as f}from"../CouponExpiration/CouponExpiration.js";import{DynamicCouponContainer as x}from"../DiscountModal.styled.js";import{DiscountOptionsContainer as R,DiscountDetailsOption as _,AddProductButtonsContainer as N,ProductCollectionCard as A,CubeIconContainer as F,IconContainer as L,ProductVariableCard as w}from"./DynamicCoupon.styled.js";import q from"./MinimumRequirementComponent.js";import U from"./ZeroState.js";var k;!function(e){e.ENTITLED="entitled",e.PREREQUISITE="prerequisite"}(k||(k={}));const B=B=>{var M,G,Q,X,Y,$,W,z;const Z=[{selected:B.discountCouponAppliesTo===c.ENTIRE_ORDER,label:"Entire Order",value:c.ENTIRE_ORDER},{selected:B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS,label:"Specific Product",value:c.SPECIFIC_PRODUCTS},{selected:B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:c.SPECIFIC_COLLECTIONS}],H=[{selected:B.offerAppliesToBuy===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToBuy===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],J=[{selected:B.offerAppliesToGet===u.SPECIFIC_PRODUCTS,label:"Specific Product",value:u.SPECIFIC_PRODUCTS},{selected:B.offerAppliesToGet===u.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:u.SPECIFIC_COLLECTIONS}],K=(e,d,u)=>{var p,m,C,E,v,D,T,y,P,f,x,R;let _=[],q=[],U={},M={};B.useNewPicker?(U=d===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=d===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==p?p:[],(null==U?void 0:U.isCustom)&&delete U.isCustom,(null==M?void 0:M.isCustom)&&delete M.isCustom,Object.values(U).forEach((e=>{Object.keys(e.products).forEach((i=>{_.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(M).forEach((e=>{"isCustom"!==e&&q.push({id:e,name:M[e].name,image:M[e].image})}))):(_=d===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=d===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==m?m:[]);const G=[null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidProductSelection,null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidProductVariableSelection,null===(v=B.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],Q=[null===(D=B.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXCollectionSelection,null===(T=B.dynamicDiscountValidationError)||void 0===T?void 0:T.inValidBuyXProductSelection,null===(y=B.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidBuyXProductVariableSelection],X=[null===(P=B.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidGetYCollectionSelection,null===(f=B.dynamicDiscountValidationError)||void 0===f?void 0:f.inValidGetYProductSelection,null===(x=B.dynamicDiscountValidationError)||void 0===x?void 0:x.inValidGetYProductVariableSelection];let Y=!1;return"couponAppliesTo"===u&&(Y=G.some(Boolean)),"buyX"===u&&(Y=Q.some(Boolean)),"getY"===u&&(Y=X.some(Boolean)),i(o,{children:[i("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(d===k.ENTITLED&&!B.entitledProductVariable||d===k.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(N,{children:[t("div",Object.assign({style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:t(a,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(d)},error:Y})})),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(g,Object.assign({color:b.colorsV2.content.placeholder},{children:"OR"})),t(a,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(d)},error:Y})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",Object.assign({style:{width:"300px",display:"flex"}},{children:t(a,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:j,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(d)},style:{marginTop:"16px"},error:Y})}))]})),Y&&t("div",Object.assign({style:{margin:"8px 0 0"}},{children:t(l,{type:s.NEGATIVE,text:"Required Field",contentPosition:r.START,icon:()=>t(n,{width:16,height:16,color:b.colorsV2.content.negative})})})),_.length||q.length?i("div",{children:[t(g,Object.assign({style:{margin:"8px 0"}},{children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i(A,{children:[t(F,{children:t(I,{width:20,height:20,color:b.colorsV2.content.secondary})}),i(h,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(d):B.setIsCollectionPickerOpen(d)}},{children:t(S,{width:24,height:24,color:b.colorsV2.content.placeholder})})),t(L,Object.assign({onClick:()=>{e===c.SPECIFIC_PRODUCTS?d===k.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):d===k.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])}},{children:t(V,{width:24,height:24,color:b.colorsV2.content.placeholder})}))]}))]})]}):d===k.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(g,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(h,{children:B.entitledProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setEntitledProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:b.colorsV2.content.primary})}))}))]})]}):d===k.PREREQUISITE&&(null===(R=B.preRequisiteProductVariable)||void 0===R?void 0:R.displayName)?i("div",{children:[t(g,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i(w,{children:[t(h,{children:B.preRequisiteProductVariable.displayName}),t("div",Object.assign({style:{display:"flex",gap:4}},{children:t(L,Object.assign({onClick:()=>{B.setPreRequisiteProductVariable(void 0)}},{children:t(O,{width:24,height:24,color:b.colorsV2.content.primary})}))}))]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,s,r,a,d,p,m,C,E;let v=[],b=[],T={},O={};B.useNewPicker?(T=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,O=null!==(n=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==T?void 0:T.isCustom)&&delete T.isCustom,(null==O?void 0:O.isCustom)&&delete O.isCustom,Object.values(T).forEach((e=>{Object.keys(e.products).forEach((i=>{v.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(O).forEach((e=>{"isCustom"!==e&&b.push({id:e,name:O[e].name,image:O[e].image})}))):(v=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,b=null!==(l=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const P=e===k.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,I=e===k.PREREQUISITE?k.PREREQUISITE:k.ENTITLED,V=P===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(h,Object.assign({style:{marginBottom:16}},{children:e===k.PREREQUISITE?"Customer buys":"Customer gets"})),i("div",Object.assign({style:{display:"flex"}},{children:[!o&&t("div",{children:i("div",Object.assign({className:"input__rows"},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:e===k.ENTITLED?null!==(r=null===(s=B.discountData.entitledQuantity)||void 0===s?void 0:s.toString())&&void 0!==r?r:"":null!==(d=null===(a=B.discountData.prerequisiteQuantity)||void 0===a?void 0:a.toString())&&void 0!==d?d:"",type:"number",onChangeText:i=>{e===k.ENTITLED?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledQuantity:parseInt(i)})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===k.PREREQUISITE&&(null===(p=B.dynamicDiscountValidationError)||void 0===p?void 0:p.inValidBuyXValue)||e===k.ENTITLED&&(null===(m=B.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYValue)?"Required Field":"",state:e===k.PREREQUISITE&&(null===(C=B.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===k.ENTITLED&&(null===(E=B.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"invalid":"none"})})),t("div",{className:"input__wrapper"})]}))}),i("div",{children:[t(g,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===k.PREREQUISITE&&t(D,{width:"244px",options:H,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToBuy(e.value),B.setPrerequisiteProducts([]),B.setPrerequisiteCollections([]),B.setPreRequisiteProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===k.ENTITLED&&t(D,{width:"244px",options:J,placement:"bottom-start",onSelect:e=>{var i,t,o;B.setOfferAppliesToGet(e.value),B.setEntitledProducts([]),B.setEntitledCollections([]),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=B.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=B.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=B.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),K(V,I,e===k.PREREQUISITE?"buyX":"getY")]})};return i(x,Object.assign({style:B.noTopMargin?{marginTop:0}:{}},{children:[i("div",{children:[i("div",Object.assign({style:{display:"flex",gap:16}},{children:[t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(M=B.discountData.title)&&void 0!==M?M:"",onChangeText:e=>{var i;B.setDiscountData(Object.assign(Object.assign({},B.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(G=B.currency)&&void 0!==G?G:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(Q=B.dynamicDiscountValidationError)||void 0===Q?void 0:Q.invalidCouponTitle)?"Required Field":"",state:(null===(X=B.dynamicDiscountValidationError)||void 0===X?void 0:X.invalidCouponTitle)?"invalid":"none"})})),!B.hideProbability&&t(y,{value:null!==($=null===(Y=B.discountData.probability)||void 0===Y?void 0:Y.toString())&&void 0!==$?$:"",type:"number",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(W=B.dynamicDiscountValidationError)||void 0===W?void 0:W.inValidProbability)?"Required Field":"",state:(null===(z=B.dynamicDiscountValidationError)||void 0===z?void 0:z.inValidProbability)?"invalid":"none"})]})),t("div",{style:{height:"1px",width:"100%",background:b.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t((()=>i("div",{children:[t(T,{children:"Discount Details"}),t(R,{children:B.discountDetailsOptions.map((t=>{return i(_,Object.assign({selected:B.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(B.selectedDiscountDetails.id!==i.id)if(B.resetValidationErrors(),B.setValidationErrorMessage(""),B.setDiscountCouponAppliesTo(c.ENTIRE_ORDER),B.setSelectedDiscountDetails(i),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0})),B.setPreRequisiteProductVariable(void 0),B.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){B.onChangeCouponType({label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},B.discountData),{valueType:"percentage"===i.value?C.PERCENTAGE:C.FIXED_AMOUNT,value:void 0,targetType:E.LINE_ITEM,targetSelection:v.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e(t,["entitledQuantity","prerequisiteQuantity"]);B.setDiscountData(o)}else B.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,B.selectedDiscountDetails.id===o?b.colorsV2.stroke.brand:b.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(B.selectedCouponType===p.AMOUNT_OFF_ORDER||B.selectedCouponType===p.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,n,l,s,r,a;return i(o,{children:[t("div",Object.assign({className:"input__rows"},{children:t("div",Object.assign({className:"input__wrapper"},{children:t(y,{value:null!==(l=null===(n=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===n?void 0:n.toString())&&void 0!==l?l:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:B.discountData.valueType===C.FIXED_AMOUNT?null!==(s=B.currency)&&void 0!==s?s:"":void 0,suffixText:B.discountData.valueType===C.PERCENTAGE?"%":void 0,errorMessage:(null===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"Required Field":"",state:(null===(a=B.dynamicDiscountValidationError)||void 0===a?void 0:a.inValidDiscountAmount)?"invalid":"none"})}))})),t("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${b.colorsV2.stroke.primary}`}},{children:i("div",Object.assign({className:"input__wrapper"},{children:[t(T,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),t("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:t(D,{width:"300px",options:Z,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===c.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:p.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:p.AMOUNT_OFF_PRODUCTS};B.onChangeCouponType(i),B.setDiscountCouponAppliesTo(e.value),B.setEntitledProductVariable(void 0),B.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(B.discountCouponAppliesTo===c.SPECIFIC_PRODUCTS||B.discountCouponAppliesTo===c.SPECIFIC_COLLECTIONS)&&K(B.discountCouponAppliesTo,k.ENTITLED,"couponAppliesTo")]}))}))]})})(),B.selectedCouponType===p.BUY_X_GET_Y&&(()=>{var e,o,n,l,s;return i(x,Object.assign({style:{border:`1px solid ${b.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[ee(k.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:b.colorsV2.stroke.primary,margin:"8px 0"}}),ee(k.ENTITLED),t(g,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),t("div",{children:t(P,{label:"Free",isActive:100===B.discountData.value,onValueChange:e=>{e?B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:100})):B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}})}),i("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[t(P,{label:"Percentage off",isActive:100!==B.discountData.value,onValueChange:()=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:void 0}))}}),100!==B.discountData.value&&t("div",Object.assign({style:{marginTop:8}},{children:t(y,{value:null!==(n=null===(o=null===(e=B.discountData)||void 0===e?void 0:e.value)||void 0===o?void 0:o.toString())&&void 0!==n?n:"",onChangeText:e=>{B.setDiscountData(Object.assign(Object.assign({},B.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(l=B.dynamicDiscountValidationError)||void 0===l?void 0:l.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!B.selectedCouponType&&t(U,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${b.colorsV2.stroke.primary}`}},{children:t(q,{selectedMinimumRequirement:B.selectedMinimumRequirement,setSelectedMinimumRequirement:B.setSelectedMinimumRequirement,discountData:B.discountData,setDiscountData:B.setDiscountData,currency:B.currency,dynamicDiscountValidationError:B.dynamicDiscountValidationError})})),B.selectedCouponType&&!B.hideExpiration&&i("div",Object.assign({style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${b.colorsV2.stroke.primary}`:"none"}},{children:[t(d,{label:"Add expiration",isDisabled:!!B.makeExpiryMandatory,isChecked:B.isAddExpirationChecked,onValueChange:e=>{B.setIsAddExpirationChecked(e),B.setDiscountData(Object.assign(Object.assign({},B.discountData),{expireAfter:void 0,expireAt:void 0})),B.setSelectedExpiration(B.isUsageFromStatic?m.FIXED_EXPIRATION:m.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),t(g,Object.assign({style:{color:b.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),B.isAddExpirationChecked&&t(f,{discountData:B.discountData,setDiscountData:B.setDiscountData,isAddExpirationChecked:B.isAddExpirationChecked,inValidCouponExpiry:B.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:B.selectedExpiration,setSelectedExpiration:B.setSelectedExpiration,hideExpirationOptions:B.isUsageFromStatic})]}))]}))};export{k as DISCOUNT_PRODUCTS,B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as i}from"react/jsx-runtime";import{CheckBox as n}from"../../checkBox/CheckBox.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as o}from"../../dropdown/Dropdown.js";import"../../dropdown/ChipDropdown.js";import"react";import"../../zeroState/ZeroState.js";import{DEFAULT_THEME as m}from"../../../constants/Theme.js";import"../../../_virtual/_tslib.js";import"lodash/debounce";import{BodySecondary as s}from"../../TypographyStyle.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../button/Button.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../icon-button/IconButton.js";import{Input as r}from"../../input/Input.js";import"../../dropdown/MenuItem/MenuItem.js";import{MIN_PURCHASE_REQUIREMENT as d}from"../type.js";const u=u=>{var a,l,c,p,M,j,v,D,O;const b=[{selected:u.selectedMinimumRequirement===d.AMOUNT,label:"Minimum order value",value:d.AMOUNT},{selected:u.selectedMinimumRequirement===d.QUANTITY,label:"Minimum number of items",value:d.QUANTITY}];return e(t,{children:[i(n,{label:"Minimum Purchase Requirements",isChecked:u.selectedMinimumRequirement!==d.NA,onValueChange:e=>{e?(u.setSelectedMinimumRequirement(d.AMOUNT),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0}))):(u.setSelectedMinimumRequirement(d.NA),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0})))},boldOnChecked:!0,labelSize:"DEFAULT"}),i(s,Object.assign({style:{color:m.colorsV2.text.secondary,marginLeft:28}},{children:"Enable coupon only after a minimum order value"})),u.selectedMinimumRequirement!==d.NA&&e("div",Object.assign({style:{margin:"16px 0 0 28px"},className:"input__rows"},{children:[e("div",Object.assign({className:"input__wrapper"},{children:[i(s,Object.assign({style:{marginBottom:10}},{children:"Requirements"})),i(o,{options:b,placement:"bottom-start",onSelect:e=>{const t=e.value;u.setSelectedMinimumRequirement(t),u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:void 0,minAmount:void 0}))},truncatedText:!1,width:"272px"})]})),i("div",Object.assign({className:"input__wrapper"},{children:i(r,{value:u.selectedMinimumRequirement===d.AMOUNT?null!==(l=null===(a=u.discountData.minAmount)||void 0===a?void 0:a.toString())&&void 0!==l?l:"":null!==(p=null===(c=u.discountData.minQuantity)||void 0===c?void 0:c.toString())&&void 0!==p?p:"",onChangeText:e=>{u.selectedMinimumRequirement===d.AMOUNT?u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minAmount:parseInt(e)})):u.selectedMinimumRequirement===d.QUANTITY&&u.setDiscountData(Object.assign(Object.assign({},u.discountData),{minQuantity:parseInt(e)}))},labelText:u.selectedMinimumRequirement===d.AMOUNT?"Minimum amount":"Minimum no. of items",prefixText:u.selectedMinimumRequirement===d.AMOUNT?null!==(M=u.currency)&&void 0!==M?M:"":void 0,type:"number",placeholder:u.selectedMinimumRequirement===d.AMOUNT?"Eg. 5000":"Eg. 5",errorMessage:(null===(j=u.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidMinimumAmount)||(null===(v=u.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidMinimumQuantity)?"Required Field":"",state:(null===(D=u.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidMinimumAmount)||(null===(O=u.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidMinimumQuantity)?"invalid":"none"})}))]}))]})};export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,Fragment as n,jsxs as t}from"react/jsx-runtime";import{useState as i,useRef as l,useEffect as r}from"react";import{COLORS as s}from"../../constants/Theme.js";import a from"../../assets/icons/chevronDown.svg.js";import{Input as d}from"../input/Input.js";import{InputStyleContext as c}from"../input/context/InputStyleProvider.js";import p from"./ChipInput.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function v(){}const m=m=>{var g,f,b,w,x,{placeHolder:j,size:O,onSelect:I,defaultOptions:y,disabled:H,noErrorHint:S,placeHolderHeight:E,showPlaceholderWhenSelected:C=!1,inputStyle:T={},inputType:D="default",onDeleteChip:P,truncatedText:M,showLeadingIconInPlaceholder:W=!1,showTrailingIconPlaceholder:L=!1,showLabelsOnMoreHover:z=!1,value:k}=m,A=e(m,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[_,N]=i(!1),[U,V]=i(!1),q=null!=O?O:"default",B=l(),[F,G]=i(null!=y?y:[]);r((()=>{var e;const o=[];null===(e=null==A?void 0:A.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),G([...o])}),[A.options]),r((()=>{y&&G([...y])}),[y]);const J=u(F),K=C?j:null!==(g=null!=J?J:j)&&void 0!==g?g:"Select an option",Q=null!==(f=A.width)&&void 0!==f?f:A.buttonWidth,R=null!=Q?Q:"100%",X=null!==(b=A.dropdownWidth)&&void 0!==b?b:R;return o(n,{children:o(c.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:E||("x-small"===q?24:"small"===q?32:48),width:R},Q?{maxWidth:Q}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===q?"4px 8px":"6px 8px",backgroundColor:void 0!==k?"#C3E4C4":U?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),T),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==k?"#00580E":"inherit"}}},{children:o("div",Object.assign({onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1)},{children:t(h,Object.assign({"data-test":A["data-test"],ref:B,onSelect:function(e){Array.isArray(e)?G([...e]):G([e]),null==I||I(e)},disabled:H,onDropdownVisbilityChange:e=>N(e)},A,{width:X},{children:["default"==D&&o(d,{version:A.version,noErrorHint:S,state:H?"disabled":"none",value:void 0===k?K:k,errorMessage:A.error,variant:q,placeholder:null!=j?j:"Select an option",onChangeText:v,leftIcon:W&&(null===(w=F[0])||void 0===w?void 0:w.leadingIcon)?{icon:()=>{var e;return o(n,{children:null===(e=F[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t("div",Object.assign({style:{display:"flex"}},{children:[L&&(null===(e=F[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:_?"rotate(180deg)":"rotate(0deg)"},onClick:v,width:"x-small"===q?16:"small"===q?20:24,height:"x-small"===q?16:"small"===q?20:24,color:s.content.primary})]}))}},truncateText:null==M||M}),"chip"==D&&o(p,{placeholder:null!=j?j:"Select options",chips:F,onDeleteChip:e=>{null==P||P(e)},errorMessage:A.error,isDropdownOpened:_,sizeToUse:q,containerStyle:{width:null!==(x=A.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:z})]}))}))}))})};m.displayName="Dropdown";export{m as Dropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"../../../../assets/icons/errorInfo.svg.js";import n from"../../../../assets/icons/refresh-purple.svg.js";import{useCallback as r,useState as i,useRef as s,useEffect as l}from"react";import{ZeroState as c}from"../../../zeroState/ZeroState.js";import{useOutside as a}from"../../../../hooks/useOutside.js";import{COLORS as u}from"../../../../constants/Theme.js";import{useDropdown as d}from"../../hooks/useDropdown.js";import{Description as p}from"./description/Description.js";import{FreeFormMenu as h}from"./menu/FreeFormMenu.js";import{MenuList as g}from"./menu/MenuList.js";import{SelectAllMenu as f}from"./menu/SelectAllMenu.js";import m from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as b,MenuListContainer as v}from"./OpennedDropdown.styled.js";import{SearchBox as S}from"./searchbox/SearchBox.js";import{SearchZeroState as j}from"./searchbox/SearchZeroState.js";const O=304,y=290,w=w=>{let{options:x,isSearchable:k,isMultiSelect:C,maxSelections:D,width:L,allowFreeForm:I,height:T,onClose:M,onSelect:E,onSearch:A,version:B,skipSorting:F,headerRef:H,hideSelectAll:R,primaryButtonText:q,onInfiniteScroll:z,onMultiSelectClear:P,onDropdownItemClick:V,buttonOptions:W,isSearchLoading:Z,isOptionsLoading:$,optionsErrorState:K,disableSearchOptions:N,disableSearchedOptionExcept:U,useDefaultCursor:G,containerStyle:J={},zeroState:Q,isDraggable:X=!1,onOptionsReorder:Y,hideClearButton:_=!1}=w;var ee;const te=r((e=>{if(!X||!C)return e;const t=[],o=[];return e.forEach((e=>{if(e.options)o.push(e);else{e.selected?t.push(e):o.push(e)}})),[...t,...o]}),[X,C]),[oe,ne]=i((()=>te(x))),re=s(oe),ie=s(!1),se=s(Y);l((()=>{ne(te(x))}),[x,te]),l((()=>{re.current=oe}),[oe]),l((()=>{se.current=Y}),[Y]),l((()=>()=>{ie.current&&se.current&&se.current(re.current)}),[]);const le=r((e=>{ne(e),"2.0"===B?null==Y||Y(e):ie.current=!0}),[Y,B]),ce=X?oe:x,{dropdownOptions:ae,search:ue,searchedString:de,searchedOptions:pe,searchError:he,retrySearch:ge,onApplyHandler:fe,selectAllHandler:me,onMultiSelectClear:be,onFreeFormSelect:ve,onMultiSelectApply:Se,latestDropdownOptionsRef:je,getSelectedOptions:Oe,getCurrentSelectionCount:ye}=d(B,ce,E,F||X,C,A,N,U,D),[we,xe]=i(null!=L?L:y),[ke,Ce]=i(null),[De,Le]=i(-1),Ie=s(null),Te=s([]),Me=s(null);a(Ie,(()=>{if(Ce(null),C&&"2.0"===B){const e=Oe(je.current);null==M||M(e)}else null==M||M(ae)}),[H,Te]),l((()=>{const e=setTimeout((()=>{Ie.current&&Ie.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);l((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const o=e;o.disabled||t.push(o)}})),t})(de&&A?pe:ae);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),Le((e=>{const o=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=Me.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("ArrowUp"===e.key)e.preventDefault(),Le((e=>{const o=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=Me.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("Enter"===e.key&&De>=0){e.preventDefault();const o=t[De];o&&(fe(Object.assign(Object.assign({},o),{selected:!o.selected})),V&&V(o))}},t=Ie.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[De,de,pe,ae,A,fe,V]);const Ee=null!=T?T:O,Ae="number"==typeof Ee?k&&C?Ee-96:k&&!C||!k&&C?Ee-48:Ee:Ee;l((()=>{const e=null!=L?L:y;if(null===ke)xe(e);else if("number"==typeof e)xe(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));xe(t)}}),[ke]);const Be=[],Fe=(e=>{if(!C||!D&&0!==D)return e;const t=ye(ae)>=D;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((de&&A?pe:ae).map((e=>{var t,o;if(de&&!A){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(de.toLowerCase()))&&(Be.push(!de||e.label===de),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(de.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(de.toLowerCase()))?(Be.push(!de||e.label===de),e):null}return e})).filter((e=>null!==e))),He=!!k&&de&&0===Fe.length,Re=!de&&!!$,qe=!de&&!!K&&!Re,ze=!(de||Fe.length||Re||qe),Pe=Re||qe||ze,Ve=(null==Q?void 0:Q.title)||"No results found",We=(null==Q?void 0:Q.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",Ze=(null==K?void 0:K.title)||"Failed to load options",$e=(null==K?void 0:K.subTitle)||"Something went wrong while fetching the list. Please try again",Ke={buttonText:"Try again",buttonType:"text",size:"small",buttonTextColor:u.background.inverseLight,customIconColor:u.background.inverseLight,LeadingIcon:n},Ne=Object.assign({IconHolderStyle:{background:u.background.negative.light},Icon:e(o,{color:u.content.negative,width:24,height:24})},K);Ne.actionButton=Object.assign(Object.assign({},Ke),null!==(ee=null==K?void 0:K.actionButton)&&void 0!==ee?ee:{});const Ue=Re?void 0:qe?Ne:Q;return t(b,Object.assign({version:B,ref:Ie,tabIndex:-1,style:Object.assign(Object.assign({width:we},J),{outline:"none"})},{children:[t("div",Object.assign({style:{width:ke?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!k&&e(S,{onSearch:ue,version:B}),Pe?e("div",Object.assign({style:{height:Ee,display:"flex",background:u.background.base}},{children:e(c,Object.assign({},null!=Ue?Ue:{},{isLoading:Re,title:qe?Ze:Ve,subTitle:qe?$e:We}))})):t(v,Object.assign({minHeight:Ee,maxHeight:Ae,ref:Me},{children:[!!C&&!He&&!R&&e(f,{version:B,options:de&&A?pe:ae,onSelect:me}),!I&&He&&e(j,{isLoading:Z,errorMessage:he,onRetry:ge,height:Ae,searchedString:de,containerWidth:L}),I&&(He||!!Be.length&&Be.every((e=>!1===e)))&&e(h,{version:B,isMultiSelect:C,onSelect:ve,searchedString:de}),e(g,{onInfiniteScroll:z,onDropdownItemClick:V,version:B,onSelect:fe,showDescription:function(e,t){Ce(e&&t?{title:e,description:t}:null)},isMultiSelect:C,options:Fe,useDefaultCursor:G,ref:Te,focusedIndex:De,isDraggable:X,onOptionsReorder:le})]})),!!C&&!Pe&&"2.0"!==B&&e(m,{onClear:()=>{be(),null==P||P()},onApply:Se,list:de&&A?pe:ae,buttonText:q,buttonOptions:W,hideClearButton:_})]})),!!ke&&e(p,{title:ke.title,description:ke.description,version:B})]}))};export{w as OpenedDropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{ZeroState as e}from"../../../../zeroState/ZeroState.js";const
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{ZeroState as e}from"../../../../zeroState/ZeroState.js";const o=o=>{let{searchedString:i,height:n,isLoading:r,containerWidth:s,errorMessage:a,onRetry:l}=o;const d=!!a&&!r;return t("div",Object.assign({style:{height:n,display:"flex",alignItems:"center"}},{children:t(e,{isLoading:r,title:d?"Failed to load options":"No results found",subTitle:d?a:`Sorry we could not find any results for "${null!=i?i:""}"`,actionButton:d?{buttonText:"Try again",buttonType:"text",onClick:l}:void 0,containerWidth:s})}))};export{o as SearchZeroState};
|
|
@@ -7,6 +7,8 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
7
7
|
search: (searchKey: string) => void;
|
|
8
8
|
searchedString: string;
|
|
9
9
|
searchedOptions: DropdownOption[];
|
|
10
|
+
searchError: string | undefined;
|
|
11
|
+
retrySearch: () => void;
|
|
10
12
|
onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
|
|
11
13
|
label: string;
|
|
12
14
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"lodash/debounce";import{useState as
|
|
1
|
+
import{__awaiter as e}from"../../../_virtual/_tslib.js";import t from"lodash/debounce";import{useState as s,useRef as n,useEffect as l,useCallback as i,useMemo as c}from"react";import{iterateOnOptionsRaw as o,iterateOnOptions as a}from"../OpenedDropdown/utils/iterationOnOptions.js";const r=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1.0",d=arguments.length>1?arguments[1]:void 0,u=arguments.length>2?arguments[2]:void 0,v=arguments.length>3?arguments[3]:void 0,f=arguments.length>4?arguments[4]:void 0,g=arguments.length>5?arguments[5]:void 0,p=arguments.length>6?arguments[6]:void 0,b=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],O=arguments.length>8?arguments[8]:void 0;const[h,j]=s(null!=d?d:[]),[m,w]=s([]),[S,C]=s(""),[E,y]=s(void 0),F=n(h),L=n(g);l((()=>{L.current=g}),[g]),l((()=>{if(F.current=h,m.length&&S&&g){let e=[...m];const t=h.map((e=>{if(e.options)return e.options.map((e=>({value:e.value,selected:e.selected})));const t=e;return{value:t.value,selected:t.selected}})).flat();e=e.map((e=>{const s=t.find((t=>e.value===t.value));return s?Object.assign(Object.assign({},e),{selected:s.selected}):e})),p&&(e=e.map((e=>Object.assign(Object.assign({},e),{disabled:!b.includes(e.value)})))),w(f&&!v?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[h]),l((()=>{if(d){const e=[...d];j(f&&!v?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[d]);const A=e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t},x=e=>{let t=0;return e.forEach((e=>{e.options?t+=e.options.filter((e=>!0===e.selected)).length:e.selected&&t++})),t},M=e=>!(!f||!O&&0!==O)&&x(e)>=O,D=i((t=>e(void 0,void 0,void 0,(function*(){const e=L.current;if(!t||!e)return;const s=[];o(F.current,(e=>{e.selected&&!s.includes(e.value)&&s.push(e.value)}));try{const n=yield e(t);if(y(void 0),n){const e=n.map((e=>{if(e.options){const t=e;return Object.assign(Object.assign({},t),{options:t.options.map((e=>Object.assign(Object.assign({},e),{selected:s.includes(e.value)})))})}return Object.assign(Object.assign({},e),{selected:s.includes(e.value)})}));w([...e])}else w([])}catch(e){w([]),y(e instanceof Error?e.message:"Something went wrong while fetching the list. Please try again")}}))),[]),H=c((()=>t(D,300)),[D]);function R(e,t){if(f){if(e.selected&&O&&M(h))return;if(m.length&&S&&g)if(e.selected){if(O&&M(h))return;let s=!1;const n=a(h,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s||n.push(e),t)return[...n];j([...n]),"2.0"===r&&_(n)}else{let s=!1,n=a(h,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s&&(n=n.filter((t=>t.value!==e.value))),t)return[...n];j([...n]),"2.0"===r&&_(n)}else{const s=a(h,{selected:e.selected},(t=>t.value===e.value));if(t)return[...s];j([...s]),"2.0"===r&&_(s)}}else null==u||u(e)}function _(e){const t=A(null!=e?e:F.current);null==u||u([...t])}return l((()=>()=>null==H?void 0:H.cancel()),[H]),{latestDropdownOptionsRef:F,dropdownOptions:h,search:function(e){C(e),w([]),y(void 0),e?H(e):null==H||H.cancel()},searchedString:S,searchedOptions:m,searchError:E,retrySearch:function(){S&&(y(void 0),D(S))},onApplyHandler:R,selectAllHandler:function(e){if(m.length&&S&&g)"selectAll"===e?function(e){let t=[...h];if(e&&O&&O>0){const e=x(t),s=O-e;if(s<=0)return;let n=0;m.forEach((e=>{if(n>=s)return;let l=!1;t=t.map((t=>{const s=e;return t.selected||t.disabled?t:void 0!==s.value&&s.value===t.value?(l=!0,n++,Object.assign(Object.assign({},t),{selected:!0})):t})),!l&&n<s&&(e.disabled||(t.push(Object.assign(Object.assign({},e),{selected:!0})),n++))})),j([...t]),"2.0"===r&&_(t)}}(!0):function(e){let t=[...h];e?m.forEach((e=>{let s=!1;t=t.map((t=>{const n=e;return void 0!==n.value&&n.value===t.value?(s=!0,Object.assign(Object.assign({},t),{selected:!0})):t})),s||t.push(Object.assign(Object.assign({},e),{selected:!0}))})):m.forEach((e=>{t=t.map((t=>{const s=e;return void 0!==s.value&&s.value===t.value?Object.assign(Object.assign({},t),{selected:!1}):t}))})),j([...t]),"2.0"===r&&_(t)}(!1);else if("selectAll"===e)if(O&&O>0){const e=x(h),t=O-e;if(t<=0)return;let s=0;const n=h.map((e=>{var n;if(e.options){const n=e;return Object.assign(Object.assign({},n),{options:n.options.map((e=>{var n;return e.disabled||e.selected||S&&!(null===(n=e.label)||void 0===n?void 0:n.toLowerCase().includes(S.toLowerCase()))?e:s<t?(s++,Object.assign(Object.assign({},e),{selected:!0})):e}))})}{const l=e;return l.disabled||(l.selected||S&&!(null===(n=l.label)||void 0===n?void 0:n.toLowerCase().includes(S.toLowerCase())))?e:s<t?(s++,Object.assign(Object.assign({},e),{selected:!0})):e}}));j([...n]),"2.0"===r&&_(n)}else{const e=a(h,{selected:!0},(e=>{var t;return S?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(S.toLowerCase()))&&!e.disabled:!e.disabled}));j([...e]),"2.0"===r&&_(e)}else if("notSelected"===e){const e=a(h,{selected:!1},(e=>!e.disabled));j([...e]),"2.0"===r&&_(e)}},onMultiSelectClear:function(){const e=a(h,{selected:!1});j([...e]),"2.0"===r&&_(e)},onFreeFormSelect:function(e){if(!f)return void R({label:S,value:S,isFreeForm:!0,selected:!0});const t=h.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===S&&t.value===S?e:t.selected})));e&&(t.some((e=>e.label===S&&e.value===S))||t.unshift({label:S,value:S,isFreeForm:!0,selected:!0})),j([...t]),"2.0"===r&&_(t)},onMultiSelectApply:_,getSelectedOptions:A,getCurrentSelectionCount:x,isMaxSelectionsReached:M,maxSelections:O}};export{r as useDropdown};
|
|
@@ -27,6 +27,15 @@ export interface OpenDropdownProps {
|
|
|
27
27
|
onDropdownItemClick?: (option: DropdownOption) => void;
|
|
28
28
|
buttonOptions?: ButtonOptions;
|
|
29
29
|
isSearchLoading?: boolean;
|
|
30
|
+
isOptionsLoading?: boolean;
|
|
31
|
+
optionsErrorState?: {
|
|
32
|
+
Icon?: React.ReactNode;
|
|
33
|
+
IconHolderStyle?: React.CSSProperties;
|
|
34
|
+
actionButton?: ButtonProps;
|
|
35
|
+
buttonWidth?: number;
|
|
36
|
+
title?: string;
|
|
37
|
+
subTitle?: string;
|
|
38
|
+
};
|
|
30
39
|
disableSearchOptions?: boolean;
|
|
31
40
|
disableSearchedOptionExcept?: string[];
|
|
32
41
|
useDefaultCursor?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o}from"../../_virtual/_tslib.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{DropdownPopover as r}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import"lodash/debounce";import"../TypographyStyle.js";import"
|
|
1
|
+
import{__rest as o}from"../../_virtual/_tslib.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{DropdownPopover as r}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import"../../constants/Theme.js";import"lodash/debounce";import"../TypographyStyle.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import{Button as e}from"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{SpinnerColorMap as p}from"../button/themes.js";import{Spinner as s}from"../spinner/Spinner.js";import{DropdownButtonStyle as i,LoaderContainer as d}from"./DropdownButton.style.js";const m=m=>{var u,l;const a=m.buttonProps,c=o(a,["onClick"]);return t(i,Object.assign({type:m.buttonProps.buttonType,disabled:m.buttonProps.disabled},{children:[(null===(u=m.buttonProps)||void 0===u?void 0:u.isLoading)&&n(d,{children:n(s,{className:"spinner",size:"small",color:p(m.buttonProps.buttonType||"primary",m.buttonProps.inverse)})}),n(e,Object.assign({},m.buttonProps,{isLoading:!1,style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),n("div",{className:"dd-button-divider"}),n(r,Object.assign({},m.dropdownProps,{isChildLoading:null===(l=m.buttonProps)||void 0===l?void 0:l.isLoading},{children:n(e,Object.assign({},c,{isLoading:!1,buttonText:"",TrailingIcon:m.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}))};export{m as DropdownButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as s}from"react";import a from"../../assets/icons/chevronRight2.svg.js";import i from"../../assets/icons/play.svg.js";import{TEXT as l}from"./constants/index.js";import{getMajorPopupStyles as c}from"./styles/majorPopup.styles.js";import"../../constants/Theme.js";import"./constants/animations.js";import{decodeHTMLEntities as u}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as d,calculateCloseTransform as p,executeAfterAnimation as g}from"./utils/animationHelpers.js";import{findWhatsNewButton as y}from"./utils/elementHelpers.js";const b=b=>{let{feature:v,currentIndex:h,totalFeatures:m,onSkip:f,onExplore:j,onPrevious:O,onNext:B,setIsClosing:T,onSecondaryAction:k,ratio:x="16:9",padding:M}=b;var E,P,C,L,w;const[U,W]=o(!1),[_,I]=o(!1),[D,H]=o(""),S=r(null),[A,R]=o(!1),[V,F]=o(!0),N=r(null),[z,G]=o(x),K=r(null);s((()=>{U&&I(!0)}),[U]);const X=t=>{var e,n;t.preventDefault(),t.stopPropagation();const o=null===(e=v.secondaryButton)||void 0===e?void 0:e.action;if("Open link"===o){const t=null===(n=v.secondaryButton)||void 0===n?void 0:n.redirectionUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}
|
|
1
|
+
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as s}from"react";import a from"../../assets/icons/chevronRight2.svg.js";import i from"../../assets/icons/play.svg.js";import{TEXT as l}from"./constants/index.js";import{getMajorPopupStyles as c}from"./styles/majorPopup.styles.js";import"../../constants/Theme.js";import"./constants/animations.js";import{decodeHTMLEntities as u}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as d,calculateCloseTransform as p,executeAfterAnimation as g}from"./utils/animationHelpers.js";import{findWhatsNewButton as y}from"./utils/elementHelpers.js";const b=b=>{let{feature:v,currentIndex:h,totalFeatures:m,onSkip:f,onExplore:j,onPrevious:O,onNext:B,setIsClosing:T,onSecondaryAction:k,ratio:x="16:9",padding:M}=b;var E,P,C,L,w;const[U,W]=o(!1),[_,I]=o(!1),[D,H]=o(""),S=r(null),[A,R]=o(!1),[V,F]=o(!0),N=r(null),[z,G]=o(x),K=r(null);s((()=>{U&&I(!0)}),[U]);const X=t=>{var e,n;t.preventDefault(),t.stopPropagation();const o=null===(e=v.secondaryButton)||void 0===e?void 0:e.action,r=k||f;if("Open link"===o){const t=null===(n=v.secondaryButton)||void 0===n?void 0:n.redirectionUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}d(S.current);const s=y();if(s&&S.current){const t=p(S.current,s);H(t)}else H("scale(0)");null==T||T(!0),W(!0),g(r)},$=c(_,D,z,M||v.padding,null===(E=v.primaryButton)||void 0===E?void 0:E.style,null===(P=v.secondaryButton)||void 0===P?void 0:P.style);return t("div",Object.assign({style:$.outerWrapper},{children:e("div",Object.assign({ref:S,style:Object.assign(Object.assign({},$.container),{opacity:_?0:1,transition:"opacity 0.2s ease-in-out, transform 0.3s ease"})},{children:[t("style",{children:"\n\t\t\t\t[data-popup-content] ul {\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tpadding-left: 20px;\n\t\t\t\t\tlist-style-type: disc;\n\t\t\t\t}\n\t\t\t\t[data-popup-content] ul li {\n\t\t\t\t\tmargin-bottom: 8px;\n\t\t\t\t\tcolor: rgba(255, 255, 255, 0.8);\n\t\t\t\t\tfont-size: 12px;\n\t\t\t\t\tline-height: 16px;\n\t\t\t\t\tfont-family: Inter, sans-serif;\n\t\t\t\t}\n\t\t\t"}),e("div",Object.assign({style:$.contentWrapper},{children:[t("div",Object.assign({style:$.imageContainer},{children:v.productVideo?e(n,{children:[t("video",{ref:N,src:v.productVideo,style:$.image,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,controls:!0,"aria-label":`Product video for ${v.title}`,onLoadedMetadata:t=>{const e=t.currentTarget,n=e.videoWidth,o=e.videoHeight;if(n&&o){const t=n/o;Math.abs(t-16/9)<.1?G("16:9"):Math.abs(t-1)<.1?G("1:1"):Math.abs(t-4/3)<.1?G("4:3"):G(t>1.5?"16:9":t<.9?"4:3":"1:1")}}}),(A||V)&&t("div",Object.assign({style:$.videoOverlay,onClick:t=>{t.stopPropagation(),N.current&&(N.current.paused?(N.current.play(),R(!1),F(!1)):(N.current.pause(),R(!0),F(!0)))},role:"button",tabIndex:0,"aria-label":A?"Play video":"Pause video",onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),N.current&&(N.current.paused?(N.current.play(),R(!1),F(!1)):(N.current.pause(),R(!0),F(!0))))}},{children:t(i,{width:20,height:20})}))]}):v.displayImage?t("img",{ref:K,src:v.displayImage,alt:v.title,style:$.image,onLoad:t=>{const e=t.currentTarget,n=e.naturalWidth,o=e.naturalHeight;if(n&&o){const t=n/o;Math.abs(t-16/9)<.1?G("16:9"):Math.abs(t-1)<.1?G("1:1"):Math.abs(t-4/3)<.1?G("4:3"):G(t>1.5?"16:9":t<.9?"4:3":"1:1")}},onError:t=>{v.image&&(t.target.src=v.image)}}):t("div",Object.assign({style:$.imagePlaceholder},{children:l.FEATURE_PREVIEW_PLACEHOLDER}))})),e("div",Object.assign({style:$.contentContainer},{children:[t("div",Object.assign({style:$.skipButtonContainer},{children:t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),(t=>{d(S.current);const e=y();if(e&&S.current){const t=p(S.current,e);H(t)}else H("scale(0)");null==T||T(!0),W(!0),g(t)})(f)},style:$.skipButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.skipButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.skipButton.base),"aria-label":"Skip feature announcement"},{children:"Skip"}))})),t("h3",Object.assign({style:$.title},{children:v.title})),t("div",{"data-popup-content":!0,style:$.content,dangerouslySetInnerHTML:{__html:u(v.content||v.body||"")}}),e("div",Object.assign({style:$.actionsWrapper},{children:[e("div",Object.assign({style:$.buttonsGroup},{children:[t("button",Object.assign({onClick:()=>{var t,e;const n=null===(t=v.primaryButton)||void 0===t?void 0:t.action;if("Play Video"===n)j();else if("Open link"===n){const t=(null===(e=v.primaryButton)||void 0===e?void 0:e.redirectionUrl)||v.redirectUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}j()}else j();d(S.current);const o=y();if(o&&S.current){const t=p(S.current,o);H(t)}else H("scale(0)");null==T||T(!0),W(!0)},style:$.exploreButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.exploreButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.exploreButton.base)},{children:(null===(C=v.primaryButton)||void 0===C?void 0:C.text)||v.buttonText||l.DEFAULT_BUTTON_TEXT})),(null===(L=v.secondaryButton)||void 0===L?void 0:L.text)&&((null===(w=v.secondaryButton)||void 0===w?void 0:w.redirectionUrl)?t("a",Object.assign({href:v.secondaryButton.redirectionUrl,target:v.secondaryButton.redirectionUrl.startsWith("http")?"_blank":"_self",rel:v.secondaryButton.redirectionUrl.startsWith("http")?"noopener noreferrer":void 0,onClick:X,style:$.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.secondaryButton.base)},{children:v.secondaryButton.text})):t("button",Object.assign({onClick:X,style:$.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.secondaryButton.base)},{children:v.secondaryButton.text})))]})),m>1&&e("div",Object.assign({style:$.navigationContainer},{children:[t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),O()},disabled:0===h,style:$.navigationButton(0===h).base,onMouseEnter:t=>{0!==h&&Object.assign(t.currentTarget.style,$.navigationButton(!1).hover)},onMouseLeave:t=>{0!==h&&Object.assign(t.currentTarget.style,$.navigationButton(!1).base)},"aria-label":"Previous feature"},{children:t(a,{style:{transform:"rotate(180deg)"}})})),t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),B()},disabled:h===m-1,style:$.navigationButton(h===m-1).base,onMouseEnter:t=>{h!==m-1&&Object.assign(t.currentTarget.style,$.navigationButton(!1).hover)},onMouseLeave:t=>{h!==m-1&&Object.assign(t.currentTarget.style,$.navigationButton(h===m-1).base)},"aria-label":"Next feature"},{children:t(a,{})}))]}))]}))]}))]}))]}))}))};export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as r,useEffect as o}from"react";import{TEXT as i}from"./constants/index.js";import"../../constants/Theme.js";import"./constants/animations.js";import{getMinorPopupStyles as s}from"./styles/minorPopup.styles.js";import{decodeHTMLEntities as l}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as a,calculateCloseTransform as c}from"./utils/animationHelpers.js";import{findFeatureTagElement as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as r,useEffect as o}from"react";import{TEXT as i}from"./constants/index.js";import"../../constants/Theme.js";import"./constants/animations.js";import{getMinorPopupStyles as s}from"./styles/minorPopup.styles.js";import{decodeHTMLEntities as l}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as a,calculateCloseTransform as c,executeAfterAnimation as d}from"./utils/animationHelpers.js";import{findFeatureTagElement as u}from"./utils/elementHelpers.js";const m=m=>{let{feature:p,currentIndex:f,totalFeatures:g,onSkip:y,onExplore:v,onPrevious:h,onNext:T,setIsClosing:j}=m;var b,O;const[x,B]=n(!1),[E,w]=n(!1),[C,_]=n(""),k=r(null);o((()=>{x&&w(!0)}),[x]);const W=s(E,C);return e("div",Object.assign({ref:k,style:W.container},{children:[t("div",Object.assign({style:W.imageContainer},{children:p.displayImage?t("div",Object.assign({style:W.imageWrapper},{children:t("img",{src:p.displayImage,alt:p.title,style:W.image,onError:e=>{p.image&&(e.target.src=p.image)}})})):t("div",Object.assign({style:W.imagePlaceholder},{children:i.FEATURE_PREVIEW_PLACEHOLDER}))})),e("div",Object.assign({style:W.contentContainer},{children:[e("div",{children:[t("h3",Object.assign({style:W.title},{children:p.title})),t("div",{style:W.content,dangerouslySetInnerHTML:{__html:l(p.content||p.body||"")}})]}),e("div",Object.assign({style:W.actionsContainer},{children:[(null===(b=p.secondaryButton)||void 0===b?void 0:b.text)&&t("span",Object.assign({onClick:()=>{var e,t,n;const r=null===(e=p.secondaryButton)||void 0===e?void 0:e.action,o=y;if("Open link"===r){const e=null===(t=p.secondaryButton)||void 0===t?void 0:t.redirectionUrl;if(e){e.startsWith("http")?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}}else"Close popup"!==r&&""!==r||null===(n=p.secondaryButton)||void 0===n||n.action;if(a(k.current),k.current&&p.featureTag){const e=u(p.featureTag);if(e){const t=c(k.current,e);_(t)}else _("scale(0)")}else _("scale(0)");null==j||j(!0),B(!0),d(o)},style:W.understoodText},{children:p.secondaryButton.text})),t("button",Object.assign({onClick:()=>{var e,t;const n=null===(e=p.primaryButton)||void 0===e?void 0:e.action;if("Play Video"===n)v();else if("Open link"===n){const e=(null===(t=p.primaryButton)||void 0===t?void 0:t.redirectionUrl)||p.redirectUrl;if(e){e.startsWith("http")?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}v()}else v();if(a(k.current),k.current&&p.featureTag){const e=p.featureTag.startsWith("#")||p.featureTag.startsWith(".")||p.featureTag.startsWith("[")?p.featureTag:`#${p.featureTag}`,t=document.querySelector(e);if(t){const e=c(k.current,t);_(e)}else _("scale(0)")}else _("scale(0)");null==j||j(!0),B(!0)},style:W.exploreButton},{children:(null===(O=p.primaryButton)||void 0===O?void 0:O.text)||p.buttonText||i.DEFAULT_BUTTON_TEXT}))]}))]}))]}))};export{m as default};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Placement } from "../tooltips";
|
|
3
3
|
import { DropdownOption, OpenDropdownProps } from '../dropdown/type';
|
|
4
4
|
import { FloaterProps } from '../floater/floater';
|
|
5
|
-
import { InputProps } from '../input';
|
|
5
|
+
import { InputProps } from '../input/Input.model';
|
|
6
6
|
type DropdownProps = OpenDropdownProps & {
|
|
7
7
|
isLoading?: boolean;
|
|
8
8
|
children?: React.ReactNode;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import 'react-image-crop/dist/ReactCrop.css';
|
|
2
|
-
|
|
3
|
-
aspectRatio?: number;
|
|
4
|
-
src: string;
|
|
5
|
-
onCropComplete: (base64String: string, didChange: boolean) => void | Promise<void>;
|
|
6
|
-
onCancel: () => void;
|
|
7
|
-
}
|
|
2
|
+
import { BikImageCropperProps } from './BikImageCropper.model';
|
|
8
3
|
export declare const BikImageCropper: (props: BikImageCropperProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
4
|
export default BikImageCropper;
|