@bikdotai/bik-component-library 0.0.736-beta.10 → 0.0.736-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_virtual/_tslib.js +1 -1
- package/dist/cjs/amplitude/Track.stories.d.ts +4 -0
- package/dist/cjs/amplitude/index.js +1 -1
- package/dist/cjs/assets/icons/AiEdit.svg.js +1 -1
- package/dist/cjs/assets/icons/Ai_event_generating.svg.js +1 -1
- package/dist/cjs/assets/icons/Bik_logo.svg.js +1 -1
- package/dist/cjs/assets/icons/ChartBar.svg.js +1 -1
- package/dist/cjs/assets/icons/ChartPie.svg.js +1 -1
- package/dist/cjs/assets/icons/HelpIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/Idea.svg.js +1 -1
- package/dist/cjs/assets/icons/RCS_PDF.svg.js +1 -1
- package/dist/cjs/assets/icons/RedirectToNew.svg.js +1 -1
- package/dist/cjs/assets/icons/WhiteStarFilled.svg.js +1 -1
- package/dist/cjs/assets/icons/aiContentIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/alert.svg.js +1 -1
- package/dist/cjs/assets/icons/alert_triangle.svg.js +1 -1
- package/dist/cjs/assets/icons/arrow_back.svg.js +1 -1
- package/dist/cjs/assets/icons/arrow_down.svg.js +1 -1
- package/dist/cjs/assets/icons/arrow_left.svg.js +1 -1
- package/dist/cjs/assets/icons/arrow_up.svg.js +1 -1
- package/dist/cjs/assets/icons/back_icon.svg.js +1 -1
- package/dist/cjs/assets/icons/bik_livechat.svg.js +1 -1
- package/dist/cjs/assets/icons/bold.svg.js +1 -1
- package/dist/cjs/assets/icons/box.svg.js +1 -1
- package/dist/cjs/assets/icons/boxV2.svg.js +1 -1
- package/dist/cjs/assets/icons/box_round.svg.js +1 -1
- package/dist/cjs/assets/icons/box_search.svg.js +1 -1
- package/dist/cjs/assets/icons/broken_media_image.svg.js +1 -1
- package/dist/cjs/assets/icons/calendar.svg.js +1 -1
- package/dist/cjs/assets/icons/card_footer_arraw.svg.js +1 -1
- package/dist/cjs/assets/icons/chat-channel.svg.js +1 -1
- package/dist/cjs/assets/icons/check.svg.js +1 -1
- package/dist/cjs/assets/icons/checkCircle.svg.js +1 -1
- package/dist/cjs/assets/icons/checklistIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronDown.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronDownOutline.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronLeft.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronLeft2.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronRight.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronRight2.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronRightAlt.svg.js +1 -1
- package/dist/cjs/assets/icons/chevronUpOutline.svg.js +1 -1
- package/dist/cjs/assets/icons/click.svg.js +1 -1
- package/dist/cjs/assets/icons/clock.svg.js +1 -1
- package/dist/cjs/assets/icons/copy-code-icon.svg.js +1 -1
- package/dist/cjs/assets/icons/cross.svg.js +1 -1
- package/dist/cjs/assets/icons/cubeIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/cursor.svg.js +1 -1
- package/dist/cjs/assets/icons/delete.svg.js +1 -1
- package/dist/cjs/assets/icons/desktop_custom.svg.js +1 -1
- package/dist/cjs/assets/icons/document_pdf.svg.js +1 -1
- package/dist/cjs/assets/icons/drag_handle.svg.js +1 -1
- package/dist/cjs/assets/icons/edit.svg.js +1 -1
- package/dist/cjs/assets/icons/email-channel.svg.js +1 -1
- package/dist/cjs/assets/icons/emoji.svg.js +1 -1
- package/dist/cjs/assets/icons/errorIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/errorInfo.svg.js +1 -1
- package/dist/cjs/assets/icons/expressionless_emoji.svg.js +1 -1
- package/dist/cjs/assets/icons/facebook_channel.svg.js +1 -1
- package/dist/cjs/assets/icons/file.svg.js +1 -1
- package/dist/cjs/assets/icons/filePdf.svg.js +1 -1
- package/dist/cjs/assets/icons/gift_icon.svg.js +1 -1
- package/dist/cjs/assets/icons/gmail.svg.js +1 -1
- package/dist/cjs/assets/icons/graph.svg.js +1 -1
- package/dist/cjs/assets/icons/halfRectangle.svg.js +1 -1
- package/dist/cjs/assets/icons/help.svg.js +1 -1
- package/dist/cjs/assets/icons/horizontal_dots.svg.js +1 -1
- package/dist/cjs/assets/icons/image.svg.js +1 -1
- package/dist/cjs/assets/icons/info.svg.js +1 -1
- package/dist/cjs/assets/icons/instagram-channel.svg.js +1 -1
- package/dist/cjs/assets/icons/instagram.svg.js +1 -1
- package/dist/cjs/assets/icons/italic.svg.js +1 -1
- package/dist/cjs/assets/icons/locked.svg.js +1 -1
- package/dist/cjs/assets/icons/log_out.svg.js +1 -1
- package/dist/cjs/assets/icons/lto_icon.svg.js +1 -1
- package/dist/cjs/assets/icons/maximize.svg.js +1 -1
- package/dist/cjs/assets/icons/mobile_custom.svg.js +1 -1
- package/dist/cjs/assets/icons/more_vertical.svg.js +1 -1
- package/dist/cjs/assets/icons/openai.svg.js +1 -1
- package/dist/cjs/assets/icons/percentage_icon.svg.js +1 -1
- package/dist/cjs/assets/icons/phone.svg.js +1 -1
- package/dist/cjs/assets/icons/phone_round.svg.js +1 -1
- package/dist/cjs/assets/icons/plus.svg.js +1 -1
- package/dist/cjs/assets/icons/qrb.svg.js +1 -1
- package/dist/cjs/assets/icons/question-mark.svg.js +1 -1
- package/dist/cjs/assets/icons/quotes.svg.js +1 -1
- package/dist/cjs/assets/icons/redirect.svg.js +1 -1
- package/dist/cjs/assets/icons/refresh.svg.js +1 -1
- package/dist/cjs/assets/icons/retryIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/sad_emoji.svg.js +1 -1
- package/dist/cjs/assets/icons/search.svg.js +1 -1
- package/dist/cjs/assets/icons/searchIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/send_template.svg.js +1 -1
- package/dist/cjs/assets/icons/shipping_icon.svg.js +1 -1
- package/dist/cjs/assets/icons/similar.svg.js +1 -1
- package/dist/cjs/assets/icons/smiley_emoji.svg.js +1 -1
- package/dist/cjs/assets/icons/sparkle.svg.js +1 -1
- package/dist/cjs/assets/icons/speedometer.svg.js +1 -1
- package/dist/cjs/assets/icons/starEmpty.svg.js +1 -1
- package/dist/cjs/assets/icons/starFilled.svg.js +1 -1
- package/dist/cjs/assets/icons/starFilledV2.svg.js +1 -1
- package/dist/cjs/assets/icons/state_icon.svg.js +1 -1
- package/dist/cjs/assets/icons/strikeThrough.svg.js +1 -1
- package/dist/cjs/assets/icons/sub_category.svg.js +1 -1
- package/dist/cjs/assets/icons/successIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/sync.svg.js +1 -1
- package/dist/cjs/assets/icons/task.svg.js +1 -1
- package/dist/cjs/assets/icons/text_t9.svg.js +1 -1
- package/dist/cjs/assets/icons/tick.svg.js +1 -1
- package/dist/cjs/assets/icons/tick_double.svg.js +1 -1
- package/dist/cjs/assets/icons/triangle_error.svg.js +1 -1
- package/dist/cjs/assets/icons/undo.svg.js +1 -1
- package/dist/cjs/assets/icons/union.svg.js +1 -1
- package/dist/cjs/assets/icons/upload.svg.js +1 -1
- package/dist/cjs/assets/icons/user_icon.svg.js +1 -1
- package/dist/cjs/assets/icons/vertical_dots.svg.js +1 -1
- package/dist/cjs/assets/icons/videoRecorder.svg.js +1 -1
- package/dist/cjs/assets/icons/warning.svg.js +1 -1
- package/dist/cjs/assets/icons/warningIcon.svg.js +1 -1
- package/dist/cjs/assets/icons/website.svg.js +1 -1
- package/dist/cjs/assets/icons/whatsNew.svg.js +1 -1
- package/dist/cjs/assets/icons/whatsapp-channel.svg.js +1 -1
- package/dist/cjs/assets/icons/whatsapp_color.svg.js +1 -1
- package/dist/cjs/components/InfiniteScroll/InfiniteScroll.js +1 -1
- 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/QueryBuilder.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/AddNodeButton.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/AllowedListDropdown.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/EmojiPicker.js +3 -6
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/FreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/IgPicker.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/IntegerPositiveSingle.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/IntegerSingleValue.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/NumberTime.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/StringSingleValue.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/TwoNumberInputsSeperatedByAnd.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/DeleteButton.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/InputLoader.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/AddPropertyButton.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
- package/dist/cjs/components/QueryBuilder/helpers/ApiResponse.helper.js +1 -1
- package/dist/cjs/components/QueryBuilder/helpers/Connector.helper.js +1 -1
- package/dist/cjs/components/QueryBuilder/hooks/useQueryBuilderCache.js +1 -1
- package/dist/cjs/components/QueryBuilder/redux/queryBuilder.reducer.js +1 -1
- package/dist/cjs/components/QueryBuilder/redux/selectors/useQueryBuilderCacheSelector.js +1 -1
- package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/cjs/components/SearchFilter/components/FilterChipListRenderer.js +1 -1
- package/dist/cjs/components/SearchFilter/index.js +1 -1
- package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +2 -2
- package/dist/cjs/components/access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.js +1 -1
- package/dist/cjs/components/accordion/Accordion.js +1 -1
- package/dist/cjs/components/accordion/Accordion.style.js +1 -1
- package/dist/cjs/components/accordion/AccordionArrow.js +1 -1
- package/dist/cjs/components/action-button/ActionButton.styled.js +1 -1
- package/dist/cjs/components/action-button/ActionButtons.js +1 -1
- package/dist/cjs/components/add-variableV2/AddVariableV2.js +1 -1
- package/dist/cjs/components/ai-modals/ActivateBikAI.js +1 -1
- package/dist/cjs/components/ai-modals/AiCreditsExhausted.js +1 -1
- package/dist/cjs/components/ai-modals/AiCreditsLow.js +1 -1
- package/dist/cjs/components/ai-modals/AiSyncProgress.js +1 -1
- package/dist/cjs/components/analytics-card/AnalyticsCard.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Legend/Legend.js +2 -2
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +2 -2
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarDistributionChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/FunnelVerticalBarGraph.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/scoreBlock/Chip.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/scoreBlock/HorizontalBar.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/scoreBlock/ScoreBlock.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/scoreBlock/ScoreBlock.styled.js +8 -8
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/utils/calcPercentage.js +1 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/banner/BannerInline.js +1 -1
- package/dist/cjs/components/banner/CardBanner.js +1 -1
- package/dist/cjs/components/bik-chatbot/components/AIChat.js +1 -1
- package/dist/cjs/components/bik-chatbot/components/BIKChatbot.js +1 -1
- package/dist/cjs/components/bik-chatbot/components/ChatLoadingState.js +1 -1
- package/dist/cjs/components/bik-chatbot/components/ChatWindow.js +1 -1
- package/dist/cjs/components/bik-chatbot/components/ThinkingIndicator.js +1 -1
- package/dist/cjs/components/bik-chatbot/contexts/AIContext.js +1 -1
- package/dist/cjs/components/bik-chatbot/services/aiService.js +1 -1
- package/dist/cjs/components/bik-chatbot/services/callToChatbot.js +1 -1
- package/dist/cjs/components/bik-chatbot/services/db.js +1 -1
- package/dist/cjs/components/bik-chatbot/services/useAIChat.js +1 -1
- package/dist/cjs/components/bik-chatbot/utils/markdown.js +1 -1
- package/dist/cjs/components/bik-layout/BikProfile.js +1 -1
- package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
- package/dist/cjs/components/bik-layout/SidebarPopup.js +1 -1
- package/dist/cjs/components/bik-layout/SidebarSkeleton.js +1 -1
- package/dist/cjs/components/bik-layout/SimpleSidebar.js +1 -1
- package/dist/cjs/components/button/Button.js +1 -1
- package/dist/cjs/components/button/Button.styled.js +1 -1
- package/dist/cjs/components/button/themes.js +1 -1
- package/dist/cjs/components/buttonGroup/ButtonGroup.js +1 -1
- package/dist/cjs/components/card-selection-modal/CardSelectionModal.js +1 -1
- package/dist/cjs/components/card-selector/CardSelectorGroup.js +1 -1
- package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
- package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/checkList/CheckList.js +1 -1
- package/dist/cjs/components/code-block/CodeBlock.js +1 -1
- package/dist/cjs/components/code-block/CodeBlock.styled.js +33 -33
- package/dist/cjs/components/code-block/CodeBlockHelper.js +1 -1
- package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/cjs/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/cjs/components/custom-date-time/CustomDateTime.styled.js +1 -0
- package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js +1 -1
- package/dist/cjs/components/dashboard-review-popup/components/FiveStar.js +1 -1
- package/dist/cjs/components/dashboard-review-popup/components/Form.js +1 -1
- package/dist/cjs/components/dashboard-review-popup/components/ZeroState.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.js +1 -1
- package/dist/cjs/components/datePicker/DatePicker.js +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.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/DiscountUtils.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.styled.js +6 -6
- package/dist/cjs/components/dot-pulse/DotPulse.js +2 -2
- package/dist/cjs/components/dropShadow/DropShadow.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +1 -1
- package/dist/cjs/components/dropdown/MultilevelDropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/description/Description.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/FreeFormMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +5 -5
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dynamic-tabs/DynamicTabs.js +1 -1
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.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/feature-announcements/VideoModal.js +1 -1
- package/dist/cjs/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -1
- package/dist/cjs/components/feature-announcements/utils/animationHelpers.js +1 -1
- package/dist/cjs/components/feature-announcements/utils/elementHelpers.js +1 -1
- package/dist/cjs/components/file-uploader/FileUploader.js +1 -1
- package/dist/cjs/components/floater/floater.js +1 -1
- package/dist/cjs/components/floating-input-dropdown/FloatingInputDropdown.js +4 -4
- package/dist/cjs/components/icon-button/IconButton.js +1 -1
- package/dist/cjs/components/icon-button/IconButton.styled.js +1 -1
- package/dist/cjs/components/image-compress/ImageCompress.js +1 -1
- package/dist/cjs/components/image-cropper/BikImageCropper.js +1 -1
- package/dist/cjs/components/image-cropper/BikImagePipeline/BikImagePipeline.js +1 -1
- package/dist/cjs/components/input/ChipInput.js +1 -1
- package/dist/cjs/components/input/ChipInput.styled.js +1 -146
- package/dist/cjs/components/input/Input-helper.js +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.styled.js +1 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.js +1 -1
- package/dist/cjs/components/keywords-input/KeywordsInput.js +1 -1
- package/dist/cjs/components/list-item/ListItem.js +1 -1
- package/dist/cjs/components/markdown/index.js +1 -1
- package/dist/cjs/components/modals/Modal.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/GroupedMenuList.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
- 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/MultiLevelDropdown.styled.js +20 -20
- package/dist/cjs/components/pagination/Pagination.js +1 -1
- package/dist/cjs/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlan.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlanSelector.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlansCollected.js +1 -1
- package/dist/cjs/components/postPicker/postPicker.js +1 -1
- package/dist/cjs/components/product-picker/ProductPickerModal.js +1 -1
- package/dist/cjs/components/product-picker-v2/ProductPickerShimmer.js +1 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/emptyState.js +1 -1
- package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/product.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.js +1 -1
- package/dist/cjs/components/product-picker-v2/variantComponents.js +1 -1
- package/dist/cjs/components/progress-bar/CircularProgressBar.js +1 -1
- package/dist/cjs/components/progress-bar/ProgressBarComponent.js +1 -1
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/cjs/components/radioList/RadioList.js +1 -1
- package/dist/cjs/components/resizeImage/index.js +1 -1
- package/dist/cjs/components/searchBar/searchBar.js +1 -1
- package/dist/cjs/components/shimmer/ShimmerComponent/BikShimmer.js +1 -1
- package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
- package/dist/cjs/components/side-modal/SideModal.style.js +16 -16
- package/dist/cjs/components/slider/slider.js +1 -1
- package/dist/cjs/components/spinner/Spinner.js +1 -1
- package/dist/cjs/components/star-rating/Star.js +1 -1
- package/dist/cjs/components/star-rating/StarRating.js +1 -1
- package/dist/cjs/components/states/ShopifyScopeWrapper.js +1 -1
- package/dist/cjs/components/stepper/Stepper.js +1 -1
- package/dist/cjs/components/switch/Switch.js +1 -1
- package/dist/cjs/components/tabs/Tabs.js +1 -1
- package/dist/cjs/components/tag/Tag.js +1 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
- package/dist/cjs/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/Header.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/QueryParamsComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateAnalyticsSkeleton.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableEditorHeader.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/convertPlaceholdersToBikDropdown.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/highlightFor.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/validateName.js +1 -1
- package/dist/cjs/components/template-preview/EmailTemplateThumbnailPreview.js +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSButtons.js +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSChatPreview.js +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -1
- package/dist/cjs/components/template-preview/SmsTemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatBtn.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/RenderTemplateWithVariable.js +1 -1
- package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/helpers/SmsTemplateHelper.js +1 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/cjs/components/template-preview/helpers/VariableEditorHelper.js +1 -1
- package/dist/cjs/components/template-preview/utils/TemplateHelperUtils.js +1 -1
- package/dist/cjs/components/template-preview/utils/getPreviewPropLen.js +1 -1
- package/dist/cjs/components/template-preview/webpush/WebpushPreview.js +1 -1
- package/dist/cjs/components/text-picker/TextPickerCategoryCard.js +5 -5
- package/dist/cjs/components/text-picker/TextPickerFooter.js +3 -3
- package/dist/cjs/components/text-picker/TextPickerItemRow.js +4 -4
- package/dist/cjs/components/text-picker/TextPickerModal.js +1 -1
- package/dist/cjs/components/text-picker/TextPickerSelectAllRow.js +5 -5
- package/dist/cjs/components/toaster/Toaster.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/cjs/components/variable-picker-v3/recommendVaribles.js +1 -1
- package/dist/cjs/components/variable-picker-v3/searchVariables.js +1 -1
- package/dist/cjs/components/whats-new/WhatsNew.js +1 -1
- package/dist/cjs/components/whats-new/WhatsNewButton.js +1 -1
- package/dist/cjs/components/whats-new/WhatsNewPanel.js +1 -1
- package/dist/cjs/components/whats-new/WhatsNewProvider.js +1 -1
- package/dist/cjs/components/whats-new/useWhatsNew.js +1 -1
- package/dist/cjs/helpers/BaseWhatsappContentLang.helper.js +1 -1
- package/dist/cjs/hooks/useCurreny.js +1 -1
- package/dist/cjs/hooks/useOutside.js +1 -1
- package/dist/cjs/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs.js +1 -1
- package/dist/cjs/node_modules/immer/dist/immer.mjs.js +1 -1
- package/dist/cjs/node_modules/lodash.debounce/index.js +1 -1
- package/dist/cjs/src/components/banner/Banner.stories.d.ts +6 -9
- package/dist/cjs/src/components/bik-layout/CommonStyles.d.ts +2 -2
- package/dist/cjs/src/components/floating-action-button/FloatingActionButton.styles.d.ts +8 -8
- package/dist/cjs/src/components/input/ChipInput.d.ts +0 -1
- package/dist/cjs/src/components/input/ChipInput.styled.d.ts +14 -871
- package/dist/cjs/src/components/progress-bar/ProgressBarComponent.d.ts +0 -1
- package/dist/cjs/src/components/shimmer-image/ShimmerImage.stories.d.ts +5 -6
- package/dist/cjs/src/components/tag/Tag.stories.d.ts +19 -34
- package/dist/cjs/utils/DateUtils.js +1 -1
- package/dist/cjs/utils/StringUtils.js +1 -1
- package/dist/cjs/utils/resizeImage.js +1 -1
- package/dist/cjs/utils/unCamelCase.js +1 -1
- package/dist/esm/_virtual/_tslib.js +1 -1
- package/dist/esm/amplitude/Track.stories.d.ts +4 -0
- package/dist/esm/amplitude/index.js +1 -1
- package/dist/esm/assets/icons/AiEdit.svg.js +1 -1
- package/dist/esm/assets/icons/Ai_event_generating.svg.js +1 -1
- package/dist/esm/assets/icons/Bik_logo.svg.js +1 -1
- package/dist/esm/assets/icons/ChartBar.svg.js +1 -1
- package/dist/esm/assets/icons/ChartPie.svg.js +1 -1
- package/dist/esm/assets/icons/HelpIcon.svg.js +1 -1
- package/dist/esm/assets/icons/Idea.svg.js +1 -1
- package/dist/esm/assets/icons/RCS_PDF.svg.js +1 -1
- package/dist/esm/assets/icons/RedirectToNew.svg.js +1 -1
- package/dist/esm/assets/icons/WhiteStarFilled.svg.js +1 -1
- package/dist/esm/assets/icons/aiContentIcon.svg.js +1 -1
- package/dist/esm/assets/icons/alert.svg.js +1 -1
- package/dist/esm/assets/icons/alert_triangle.svg.js +1 -1
- package/dist/esm/assets/icons/arrow_back.svg.js +1 -1
- package/dist/esm/assets/icons/arrow_down.svg.js +1 -1
- package/dist/esm/assets/icons/arrow_left.svg.js +1 -1
- package/dist/esm/assets/icons/arrow_up.svg.js +1 -1
- package/dist/esm/assets/icons/back_icon.svg.js +1 -1
- package/dist/esm/assets/icons/bik_livechat.svg.js +1 -1
- package/dist/esm/assets/icons/bold.svg.js +1 -1
- package/dist/esm/assets/icons/box.svg.js +1 -1
- package/dist/esm/assets/icons/boxV2.svg.js +1 -1
- package/dist/esm/assets/icons/box_round.svg.js +1 -1
- package/dist/esm/assets/icons/box_search.svg.js +1 -1
- package/dist/esm/assets/icons/broken_media_image.svg.js +1 -1
- package/dist/esm/assets/icons/calendar.svg.js +1 -1
- package/dist/esm/assets/icons/card_footer_arraw.svg.js +1 -1
- package/dist/esm/assets/icons/chat-channel.svg.js +1 -1
- package/dist/esm/assets/icons/check.svg.js +1 -1
- package/dist/esm/assets/icons/checkCircle.svg.js +1 -1
- package/dist/esm/assets/icons/checklistIcon.svg.js +1 -1
- package/dist/esm/assets/icons/chevronDown.svg.js +1 -1
- package/dist/esm/assets/icons/chevronDownOutline.svg.js +1 -1
- package/dist/esm/assets/icons/chevronLeft.svg.js +1 -1
- package/dist/esm/assets/icons/chevronLeft2.svg.js +1 -1
- package/dist/esm/assets/icons/chevronRight.svg.js +1 -1
- package/dist/esm/assets/icons/chevronRight2.svg.js +1 -1
- package/dist/esm/assets/icons/chevronRightAlt.svg.js +1 -1
- package/dist/esm/assets/icons/chevronUpOutline.svg.js +1 -1
- package/dist/esm/assets/icons/click.svg.js +1 -1
- package/dist/esm/assets/icons/clock.svg.js +1 -1
- package/dist/esm/assets/icons/copy-code-icon.svg.js +1 -1
- package/dist/esm/assets/icons/cross.svg.js +1 -1
- package/dist/esm/assets/icons/cubeIcon.svg.js +1 -1
- package/dist/esm/assets/icons/cursor.svg.js +1 -1
- package/dist/esm/assets/icons/delete.svg.js +1 -1
- package/dist/esm/assets/icons/desktop_custom.svg.js +1 -1
- package/dist/esm/assets/icons/document_pdf.svg.js +1 -1
- package/dist/esm/assets/icons/drag_handle.svg.js +1 -1
- package/dist/esm/assets/icons/edit.svg.js +1 -1
- package/dist/esm/assets/icons/email-channel.svg.js +1 -1
- package/dist/esm/assets/icons/emoji.svg.js +1 -1
- package/dist/esm/assets/icons/errorIcon.svg.js +1 -1
- package/dist/esm/assets/icons/errorInfo.svg.js +1 -1
- package/dist/esm/assets/icons/expressionless_emoji.svg.js +1 -1
- package/dist/esm/assets/icons/facebook_channel.svg.js +1 -1
- package/dist/esm/assets/icons/file.svg.js +1 -1
- package/dist/esm/assets/icons/filePdf.svg.js +1 -1
- package/dist/esm/assets/icons/gift_icon.svg.js +1 -1
- package/dist/esm/assets/icons/gmail.svg.js +1 -1
- package/dist/esm/assets/icons/graph.svg.js +1 -1
- package/dist/esm/assets/icons/halfRectangle.svg.js +1 -1
- package/dist/esm/assets/icons/help.svg.js +1 -1
- package/dist/esm/assets/icons/horizontal_dots.svg.js +1 -1
- package/dist/esm/assets/icons/image.svg.js +1 -1
- package/dist/esm/assets/icons/info.svg.js +1 -1
- package/dist/esm/assets/icons/instagram-channel.svg.js +1 -1
- package/dist/esm/assets/icons/instagram.svg.js +1 -1
- package/dist/esm/assets/icons/italic.svg.js +1 -1
- package/dist/esm/assets/icons/locked.svg.js +1 -1
- package/dist/esm/assets/icons/log_out.svg.js +1 -1
- package/dist/esm/assets/icons/lto_icon.svg.js +1 -1
- package/dist/esm/assets/icons/maximize.svg.js +1 -1
- package/dist/esm/assets/icons/mobile_custom.svg.js +1 -1
- package/dist/esm/assets/icons/more_vertical.svg.js +1 -1
- package/dist/esm/assets/icons/openai.svg.js +1 -1
- package/dist/esm/assets/icons/percentage_icon.svg.js +1 -1
- package/dist/esm/assets/icons/phone.svg.js +1 -1
- package/dist/esm/assets/icons/phone_round.svg.js +1 -1
- package/dist/esm/assets/icons/plus.svg.js +1 -1
- package/dist/esm/assets/icons/qrb.svg.js +1 -1
- package/dist/esm/assets/icons/question-mark.svg.js +1 -1
- package/dist/esm/assets/icons/quotes.svg.js +1 -1
- package/dist/esm/assets/icons/redirect.svg.js +1 -1
- package/dist/esm/assets/icons/refresh.svg.js +1 -1
- package/dist/esm/assets/icons/retryIcon.svg.js +1 -1
- package/dist/esm/assets/icons/sad_emoji.svg.js +1 -1
- package/dist/esm/assets/icons/search.svg.js +1 -1
- package/dist/esm/assets/icons/searchIcon.svg.js +1 -1
- package/dist/esm/assets/icons/send_template.svg.js +1 -1
- package/dist/esm/assets/icons/shipping_icon.svg.js +1 -1
- package/dist/esm/assets/icons/similar.svg.js +1 -1
- package/dist/esm/assets/icons/smiley_emoji.svg.js +1 -1
- package/dist/esm/assets/icons/sparkle.svg.js +1 -1
- package/dist/esm/assets/icons/speedometer.svg.js +1 -1
- package/dist/esm/assets/icons/starEmpty.svg.js +1 -1
- package/dist/esm/assets/icons/starFilled.svg.js +1 -1
- package/dist/esm/assets/icons/starFilledV2.svg.js +1 -1
- package/dist/esm/assets/icons/state_icon.svg.js +1 -1
- package/dist/esm/assets/icons/strikeThrough.svg.js +1 -1
- package/dist/esm/assets/icons/sub_category.svg.js +1 -1
- package/dist/esm/assets/icons/successIcon.svg.js +1 -1
- package/dist/esm/assets/icons/sync.svg.js +1 -1
- package/dist/esm/assets/icons/task.svg.js +1 -1
- package/dist/esm/assets/icons/text_t9.svg.js +1 -1
- package/dist/esm/assets/icons/tick.svg.js +1 -1
- package/dist/esm/assets/icons/tick_double.svg.js +1 -1
- package/dist/esm/assets/icons/triangle_error.svg.js +1 -1
- package/dist/esm/assets/icons/undo.svg.js +1 -1
- package/dist/esm/assets/icons/union.svg.js +1 -1
- package/dist/esm/assets/icons/upload.svg.js +1 -1
- package/dist/esm/assets/icons/user_icon.svg.js +1 -1
- package/dist/esm/assets/icons/vertical_dots.svg.js +1 -1
- package/dist/esm/assets/icons/videoRecorder.svg.js +1 -1
- package/dist/esm/assets/icons/warning.svg.js +1 -1
- package/dist/esm/assets/icons/warningIcon.svg.js +1 -1
- package/dist/esm/assets/icons/website.svg.js +1 -1
- package/dist/esm/assets/icons/whatsNew.svg.js +1 -1
- package/dist/esm/assets/icons/whatsapp-channel.svg.js +1 -1
- package/dist/esm/assets/icons/whatsapp_color.svg.js +1 -1
- package/dist/esm/components/InfiniteScroll/InfiniteScroll.js +1 -1
- 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/QueryBuilder.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/AddNodeButton.js +1 -1
- package/dist/esm/components/QueryBuilder/components/AllowedListDropdown.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/EmojiPicker.js +4 -7
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/FreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js +2 -2
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/IgPicker.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/IntegerPositiveSingle.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/IntegerSingleValue.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/NumberTime.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/StringSingleValue.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/TwoNumberInputsSeperatedByAnd.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/esm/components/QueryBuilder/components/DeleteButton.js +1 -1
- package/dist/esm/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/esm/components/QueryBuilder/components/InputLoader.js +4 -4
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/AddPropertyButton.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
- package/dist/esm/components/QueryBuilder/helpers/ApiResponse.helper.js +1 -1
- package/dist/esm/components/QueryBuilder/helpers/Connector.helper.js +1 -1
- package/dist/esm/components/QueryBuilder/hooks/useQueryBuilderCache.js +1 -1
- package/dist/esm/components/QueryBuilder/redux/queryBuilder.reducer.js +1 -1
- package/dist/esm/components/QueryBuilder/redux/selectors/useQueryBuilderCacheSelector.js +1 -1
- package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/esm/components/SearchFilter/components/FilterChipListRenderer.js +1 -1
- package/dist/esm/components/SearchFilter/index.js +1 -1
- package/dist/esm/components/TablePagination/TablePagination.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +2 -2
- package/dist/esm/components/access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.js +1 -1
- package/dist/esm/components/accordion/Accordion.js +1 -1
- package/dist/esm/components/accordion/Accordion.style.js +1 -1
- package/dist/esm/components/accordion/AccordionArrow.js +1 -1
- package/dist/esm/components/action-button/ActionButton.styled.js +1 -1
- package/dist/esm/components/action-button/ActionButtons.js +1 -1
- package/dist/esm/components/add-variableV2/AddVariableV2.js +1 -1
- package/dist/esm/components/ai-modals/ActivateBikAI.js +1 -1
- package/dist/esm/components/ai-modals/AiCreditsExhausted.js +1 -1
- package/dist/esm/components/ai-modals/AiCreditsLow.js +1 -1
- package/dist/esm/components/ai-modals/AiSyncProgress.js +1 -1
- package/dist/esm/components/analytics-card/AnalyticsCard.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Legend/Legend.js +2 -2
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +2 -2
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarDistributionChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/FunnelVerticalBarGraph.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/scoreBlock/Chip.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/scoreBlock/HorizontalBar.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/scoreBlock/ScoreBlock.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/scoreBlock/ScoreBlock.styled.js +5 -5
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/utils/calcPercentage.js +1 -1
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/banner/BannerInline.js +1 -1
- package/dist/esm/components/banner/CardBanner.js +1 -1
- package/dist/esm/components/bik-chatbot/components/AIChat.js +1 -1
- package/dist/esm/components/bik-chatbot/components/BIKChatbot.js +1 -1
- package/dist/esm/components/bik-chatbot/components/ChatLoadingState.js +1 -1
- package/dist/esm/components/bik-chatbot/components/ChatWindow.js +1 -1
- package/dist/esm/components/bik-chatbot/components/ThinkingIndicator.js +1 -1
- package/dist/esm/components/bik-chatbot/contexts/AIContext.js +1 -1
- package/dist/esm/components/bik-chatbot/services/aiService.js +1 -1
- package/dist/esm/components/bik-chatbot/services/callToChatbot.js +1 -1
- package/dist/esm/components/bik-chatbot/services/db.js +1 -1
- package/dist/esm/components/bik-chatbot/services/useAIChat.js +1 -1
- package/dist/esm/components/bik-chatbot/utils/markdown.js +1 -1
- package/dist/esm/components/bik-layout/BikProfile.js +1 -1
- package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
- package/dist/esm/components/bik-layout/SidebarPopup.js +1 -1
- package/dist/esm/components/bik-layout/SidebarSkeleton.js +1 -1
- package/dist/esm/components/bik-layout/SimpleSidebar.js +1 -1
- package/dist/esm/components/button/Button.js +1 -1
- package/dist/esm/components/button/Button.styled.js +1 -1
- package/dist/esm/components/button/themes.js +1 -1
- package/dist/esm/components/buttonGroup/ButtonGroup.js +1 -1
- package/dist/esm/components/card-selection-modal/CardSelectionModal.js +1 -1
- package/dist/esm/components/card-selector/CardSelectorGroup.js +1 -1
- package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
- package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
- package/dist/esm/components/carousel-secondary/CarouselSecondary.js +1 -1
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/checkList/CheckList.js +1 -1
- package/dist/esm/components/code-block/CodeBlock.js +1 -1
- package/dist/esm/components/code-block/CodeBlock.styled.js +31 -31
- package/dist/esm/components/code-block/CodeBlockHelper.js +1 -1
- package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/esm/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/esm/components/custom-date-time/CustomDateTime.styled.js +1 -0
- package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js +1 -1
- package/dist/esm/components/dashboard-review-popup/components/FiveStar.js +1 -1
- package/dist/esm/components/dashboard-review-popup/components/Form.js +1 -1
- package/dist/esm/components/dashboard-review-popup/components/ZeroState.js +2 -2
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/data-source-panel/Modals/DescriptionModal.js +1 -1
- package/dist/esm/components/datePicker/DatePicker.js +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.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/DiscountUtils.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.styled.js +8 -8
- package/dist/esm/components/dot-pulse/DotPulse.js +2 -2
- package/dist/esm/components/dropShadow/DropShadow.js +1 -1
- package/dist/esm/components/dropdown/ChipInput.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.js +1 -1
- package/dist/esm/components/dropdown/MultilevelDropdownPopover/index.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/description/Description.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/FreeFormMenu.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +5 -5
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/esm/components/dynamic-tabs/DynamicTabs.js +1 -1
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.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/feature-announcements/VideoModal.js +1 -1
- package/dist/esm/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -1
- package/dist/esm/components/feature-announcements/utils/animationHelpers.js +1 -1
- package/dist/esm/components/feature-announcements/utils/elementHelpers.js +1 -1
- package/dist/esm/components/file-uploader/FileUploader.js +1 -1
- package/dist/esm/components/floater/floater.js +1 -1
- package/dist/esm/components/floating-input-dropdown/FloatingInputDropdown.js +3 -3
- package/dist/esm/components/icon-button/IconButton.js +1 -1
- package/dist/esm/components/icon-button/IconButton.styled.js +1 -1
- package/dist/esm/components/image-compress/ImageCompress.js +1 -1
- package/dist/esm/components/image-cropper/BikImageCropper.js +1 -1
- package/dist/esm/components/image-cropper/BikImagePipeline/BikImagePipeline.js +1 -1
- package/dist/esm/components/input/ChipInput.js +1 -1
- package/dist/esm/components/input/ChipInput.styled.js +1 -146
- package/dist/esm/components/input/Input-helper.js +1 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.styled.js +1 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.js +1 -1
- package/dist/esm/components/keywords-input/KeywordsInput.js +1 -1
- package/dist/esm/components/list-item/ListItem.js +1 -1
- package/dist/esm/components/markdown/index.js +1 -1
- package/dist/esm/components/modals/Modal.js +1 -1
- package/dist/esm/components/multi-level-dropdown/GroupedMenuList.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
- 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/MultiLevelDropdown.styled.js +25 -25
- package/dist/esm/components/pagination/Pagination.js +1 -1
- package/dist/esm/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlan.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlanSelector.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlansCollected.js +1 -1
- package/dist/esm/components/postPicker/postPicker.js +1 -1
- package/dist/esm/components/product-picker/ProductPickerModal.js +1 -1
- package/dist/esm/components/product-picker-v2/ProductPickerShimmer.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/emptyState.js +1 -1
- package/dist/esm/components/product-picker-v2/helpers/ProductHelper.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/product.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.js +1 -1
- package/dist/esm/components/product-picker-v2/variantComponents.js +1 -1
- package/dist/esm/components/progress-bar/CircularProgressBar.js +1 -1
- package/dist/esm/components/progress-bar/ProgressBarComponent.js +3 -3
- package/dist/esm/components/radioButton/RadioButton.js +1 -1
- package/dist/esm/components/radioList/RadioList.js +1 -1
- package/dist/esm/components/resizeImage/index.js +1 -1
- package/dist/esm/components/searchBar/searchBar.js +1 -1
- package/dist/esm/components/shimmer/ShimmerComponent/BikShimmer.js +1 -1
- package/dist/esm/components/shimmer-image/ShimmerImage.js +1 -1
- package/dist/esm/components/side-modal/SideModal.style.js +9 -9
- package/dist/esm/components/slider/slider.js +1 -1
- package/dist/esm/components/spinner/Spinner.js +1 -1
- package/dist/esm/components/star-rating/Star.js +1 -1
- package/dist/esm/components/star-rating/StarRating.js +2 -2
- package/dist/esm/components/states/ShopifyScopeWrapper.js +1 -1
- package/dist/esm/components/stepper/Stepper.js +1 -1
- package/dist/esm/components/switch/Switch.js +1 -1
- package/dist/esm/components/tabs/Tabs.js +1 -1
- package/dist/esm/components/tag/Tag.js +1 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
- package/dist/esm/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +3 -3
- package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/Footer.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/Header.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/QueryParamsComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateAnalyticsSkeleton.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/VariableEditorHeader.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/convertPlaceholdersToBikDropdown.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/highlightFor.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/validateName.js +1 -1
- package/dist/esm/components/template-preview/EmailTemplateThumbnailPreview.js +1 -1
- package/dist/esm/components/template-preview/RCS/RCSButtons.js +1 -1
- package/dist/esm/components/template-preview/RCS/RCSChatPreview.js +1 -1
- package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -1
- package/dist/esm/components/template-preview/SmsTemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatBtn.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/RenderTemplateWithVariable.js +1 -1
- package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/helpers/SmsTemplateHelper.js +1 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/esm/components/template-preview/helpers/VariableEditorHelper.js +1 -1
- package/dist/esm/components/template-preview/utils/TemplateHelperUtils.js +1 -1
- package/dist/esm/components/template-preview/utils/getPreviewPropLen.js +1 -1
- package/dist/esm/components/template-preview/webpush/WebpushPreview.js +1 -1
- package/dist/esm/components/text-picker/TextPickerCategoryCard.js +4 -4
- package/dist/esm/components/text-picker/TextPickerFooter.js +4 -4
- package/dist/esm/components/text-picker/TextPickerItemRow.js +6 -6
- package/dist/esm/components/text-picker/TextPickerModal.js +1 -1
- package/dist/esm/components/text-picker/TextPickerSelectAllRow.js +5 -5
- package/dist/esm/components/toaster/Toaster.js +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/dist/esm/components/variable-picker-v3/Content.js +1 -1
- package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/esm/components/variable-picker-v3/recommendVaribles.js +1 -1
- package/dist/esm/components/variable-picker-v3/searchVariables.js +1 -1
- package/dist/esm/components/whats-new/WhatsNew.js +1 -1
- package/dist/esm/components/whats-new/WhatsNewButton.js +1 -1
- package/dist/esm/components/whats-new/WhatsNewPanel.js +1 -1
- package/dist/esm/components/whats-new/WhatsNewProvider.js +1 -1
- package/dist/esm/components/whats-new/useWhatsNew.js +1 -1
- package/dist/esm/helpers/BaseWhatsappContentLang.helper.js +1 -1
- package/dist/esm/hooks/useCurreny.js +1 -1
- package/dist/esm/hooks/useOutside.js +1 -1
- package/dist/esm/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs.js +1 -1
- package/dist/esm/node_modules/immer/dist/immer.mjs.js +1 -1
- package/dist/esm/node_modules/lodash.debounce/index.js +1 -1
- package/dist/esm/src/components/banner/Banner.stories.d.ts +6 -9
- package/dist/esm/src/components/bik-layout/CommonStyles.d.ts +2 -2
- package/dist/esm/src/components/floating-action-button/FloatingActionButton.styles.d.ts +8 -8
- package/dist/esm/src/components/input/ChipInput.d.ts +0 -1
- package/dist/esm/src/components/input/ChipInput.styled.d.ts +14 -871
- package/dist/esm/src/components/progress-bar/ProgressBarComponent.d.ts +0 -1
- package/dist/esm/src/components/shimmer-image/ShimmerImage.stories.d.ts +5 -6
- package/dist/esm/src/components/tag/Tag.stories.d.ts +19 -34
- package/dist/esm/utils/DateUtils.js +1 -1
- package/dist/esm/utils/StringUtils.js +1 -1
- package/dist/esm/utils/resizeImage.js +1 -1
- package/dist/esm/utils/unCamelCase.js +1 -1
- package/package.json +24 -40
- package/dist/cjs/src/amplitude/Track.stories.d.ts +0 -6
- package/dist/esm/src/amplitude/Track.stories.d.ts +0 -6
- /package/dist/cjs/{src/amplitude → amplitude}/index.d.ts +0 -0
- /package/dist/esm/{src/amplitude → amplitude}/index.d.ts +0 -0
|
@@ -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 v,DISCOUNT_VALUE_TYPES as b}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{TitleSmall as P,BodyCaption as m,TitleRegular as I}from"../TypographyStyle.js";import{DEFAULT_THEME as S}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 h}from"../modals/styledModal.js";import{ProductPickerContent as E}from"../product-picker/ProductPickerModal.js";import{Tag as T}from"../tag/Tag.js";import{Tooltip as O}from"../tooltips/Tooltip.js";import f from"../../assets/icons/gift_icon.svg.js";import V from"../../assets/icons/percentage_icon.svg.js";import D from"../../assets/icons/shipping_icon.svg.js";import g 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 F,CouponTypeContainerStyled as x,VariablePickerContainer as j}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",{style:{fontSize:20,color:i,lineHeight:.9},children:L.currency||""})},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(V,{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(D,{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),[ve,be]=n(a.ENTIRE_ORDER),[ye,Pe]=n(c.SPECIFIC_PRODUCTS),[me,Ie]=n(c.SPECIFIC_PRODUCTS),[Se,he]=n(void 0),[Ee,Te]=n(void 0),[Oe,fe]=n(void 0),[Ve,De]=n(void 0),[ge,_e]=n(void 0),[Ae,Ne]=n(void 0),[ke,Fe]=n(0),[xe,je]=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:v}=He();ue(v);const y=(e,i)=>{Me(C.valueType===b.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)),v){case r.AMOUNT_OFF_ORDER:y(0,1),be(a.ENTIRE_ORDER);break;case r.AMOUNT_OFF_PRODUCTS:y(0,1),(null===(e=C.entitledCollectionIds)||void 0===e?void 0:e.length)?be(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)?(be(a.SPECIFIC_PRODUCTS),P(null===(o=C.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,De)):be(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,De)),(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,v,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))});Te(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))});he(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)&&Te(L.data.productsConf.entitledProducts),(null===(o=null===(t=L.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&he(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(!Ee)return;if(L.newPickerConf){const e=[];return Object.values(Ee).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=Ee.map(e=>parseInt(e.id));de(Object.assign(Object.assign({},re),{entitledProductIds:e}))},[Ee]),l(()=>{if(!Se)return;if(L.newPickerConf){const e=[];return Object.values(Se).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=Se.map(e=>parseInt(e.id));de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))},[Se]),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(!Oe)return;if(L.newPickerConf){(null==Oe?void 0:Oe.isCustom)&&delete Oe.isCustom;const e=Object.keys(Oe).map(e=>parseInt(e));return void de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}const e=Oe.map(e=>parseInt(e.id));de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))},[Oe]);const He=()=>{var e,i,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===v.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:v.ALL,valueType:b.FIXED_AMOUNT}),n=r.AMOUNT_OFF_ORDER)):re.targetType===C.SHIPPING_LINE?n=r.FREE_SHIPPING:re.targetType===C.LINE_ITEM?n=re.targetSelection===v.ENTITLED?(null===(e=re.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=re.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||re.prerequisiteQuantity||re.entitledQuantity?r.BUY_X_GET_Y:r.AMOUNT_OFF_PRODUCTS:r.AMOUNT_OFF_ORDER:(l=Object.assign(Object.assign({},l),{targetType:C.LINE_ITEM,targetSelection:v.ALL,valueType:b.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&&(je(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 Fe(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,S;const h=e.value;ue(h),he([]),Te([]),fe([]),Ne([]),h===r.FREE_SHIPPING?de({value:100,targetSelection:v.ALL,targetType:C.SHIPPING_LINE,valueType:b.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}):h===r.BUY_X_GET_Y?de({value:100,targetSelection:v.ENTITLED,targetType:C.LINE_ITEM,valueType:b.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}):h===r.AMOUNT_OFF_ORDER?de({targetSelection:v.ALL,targetType:C.LINE_ITEM,valueType:null!==(a=re.valueType)&&void 0!==a?a:b.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}):h===r.AMOUNT_OFF_PRODUCTS&&de({targetSelection:v.ENTITLED,targetType:C.LINE_ITEM,valueType:null!==(y=re.valueType)&&void 0!==y?y:b.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!==(S=re.minAmount)&&void 0!==S?S:void 0})},Je=i=>i&&e(T,{theme:"light",tagText:i,type:"negative",LeadingIcon:_});return i(h,{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:xe?Je(xe):L.errorMsg?Je(L.errorMsg):!L.quadrant||L.hideProbability?e(t,{}):ke<=1?e(T,{theme:"light",tagText:`Current probability sum: ${ke}`,type:"white"}):e(O,{body:"Probability sum should not exceed 1",placement:"top",children:e("div",{children:e(T,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ke}`,type:"negative",LeadingIcon:g})})}),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 ${S.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 je(!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,v={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(v))return void Le(v);const b={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;b.inValidMinimumAmount=pe===d.AMOUNT&&!e,b.inValidMinimumQuantity=pe===d.QUANTITY&&!i}if(we&&(b.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==r.AMOUNT_OFF_ORDER&&se!==r.AMOUNT_OFF_PRODUCTS||(ve!==a.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(b.inValidProductSelection=!0,b.inValidProductVariableSelection=!0),ve===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(b.inValidCollectionSelection=!0)),se===r.BUY_X_GET_Y&&(re.prerequisiteQuantity||(b.inValidBuyXValue=!0),re.entitledQuantity||(b.inValidGetYValue=!0),ye!==c.SPECIFIC_PRODUCTS||!Se||Object.keys(Se).length||ge||(b.inValidBuyXProductSelection=!0,b.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(b.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(b.inValidGetYProductSelection=!0,b.inValidGetYProductVariableSelection=!0),me===c.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(b.inValidGetYCollectionSelection=!0)),Ke(b))return void Ge(b);if(ae||ke>1)return void je(!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!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=Ve?Ve:{},prerequisiteProductVariable:null!=ge?ge:{}}}))}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||(ve!==a.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(e.inValidProductSelection=!0,e.inValidProductVariableSelection=!0),ve===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||!Se||Object.keys(Se).length||ge||(e.inValidBuyXProductSelection=!0,e.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(e.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(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 je(!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!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=Ve?Ve:{},prerequisiteProductVariable:null!=ge?ge:{}}}))}}},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(F,{children:[L.allowStaticCoupon&&!ee&&!L.hideOption&&i(x,{selectedDiv:re.isStaticCoupon?1:2,children:["static"===L.hideOption?e(t,{}):i("div",{className:"coupon-type__container",onClick:()=>{re.isStaticCoupon||(de({isStaticCoupon:!0,quadrant:re.quadrant}),je(""),ze())},children:[e(P,{style:{marginBottom:"4px",color:re.isStaticCoupon?S.colorsV2.content.brand:void 0},children:"Static Code"}),e(m,{style:re.isStaticCoupon?{color:S.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",{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:v.ALL,valueType:b.FIXED_AMOUNT}),je(""),ze(),Me({id:"0",label:"Amount",value:"amount",icon:i=>e("span",{style:{fontSize:20,color:i},children:L.currency||""})}),qe(null!==(i=L.makeExpiryMandatory)&&void 0!==i&&i),Ce(d.NA))},children:[e(P,{style:{marginBottom:"4px",color:re.isStaticCoupon?void 0:S.colorsV2.content.brand},children:"Dynamic Code"}),e(m,{style:re.isStaticCoupon?{}:{color:S.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,{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:ve,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:be,setOfferAppliesToBuy:Pe,setOfferAppliesToGet:Ie,hideExpiration:L.hideExpiration||!1,onChangeCouponType:Ze,entitledProducts:null!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[],setEntitledProducts:Te,setPrerequisiteProducts:he,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[],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:Ve,setEntitledProductVariable:De,preRequisiteProductVariable:ge,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:je,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory}),!re.isStaticCoupon&&!ee&&!ne&&e(w,{currency:L.currency,entitledProducts:null!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[],setEntitledProducts:Te,setPrerequisiteProducts:he,discountData:re,productPickerOpen:ee,productVariablePickerOpen:te,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setDiscountData:de,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:Ce,discountCouponAppliesTo:ve,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:be,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!=Oe?Oe:[],setIsCollectionPickerOpen:le,setEntitledCollections:Ne,setPrerequisiteCollections:fe,useNewPicker:!!L.newPickerConf,setSelectedDiscountDetails:Me,selectedDiscountDetails:Re,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:Ve,setEntitledProductVariable:De,preRequisiteProductVariable:ge,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:je,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory})]}),!!ee&&i(t,{children:[!L.newPickerConf&&e("div",{style:{padding:"12px 0"},children:e(E,{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?Ee:Se)&&void 0!==K?K:[],setSelectedProducts:ee===q.ENTITLED?Te:he,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?Ee:Se,onAdd:e=>{ee===q.ENTITLED?Te(e):he(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",{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:Oe,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(E,{show:!0,onSave:()=>{},products:null!==($=L.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{le(void 0)},selectedProducts:null!==(Z=ne===q.ENTITLED?Ae:Oe)&&void 0!==Z?Z:[],setSelectedProducts:ne===q.ENTITLED?Ne:fe,onSearchKeyChange:L.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}),te&&e(j,{children:e("div",{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;De({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 v,DISCOUNT_VALUE_TYPES as b}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{TitleSmall as P,BodyCaption as m,TitleRegular as I}from"../TypographyStyle.js";import{DEFAULT_THEME as S}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 h}from"../modals/styledModal.js";import{ProductPickerContent as E}from"../product-picker/ProductPickerModal.js";import{Tag as T}from"../tag/Tag.js";import{Tooltip as O}from"../tooltips/Tooltip.js";import f from"../../assets/icons/gift_icon.svg.js";import V from"../../assets/icons/percentage_icon.svg.js";import D from"../../assets/icons/shipping_icon.svg.js";import g 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 F,CouponTypeContainerStyled as x,VariablePickerContainer as j}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",{style:{fontSize:20,color:i,lineHeight:.9},children:L.currency||""})},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(V,{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(D,{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),[ve,be]=n(a.ENTIRE_ORDER),[ye,Pe]=n(c.SPECIFIC_PRODUCTS),[me,Ie]=n(c.SPECIFIC_PRODUCTS),[Se,he]=n(void 0),[Ee,Te]=n(void 0),[Oe,fe]=n(void 0),[Ve,De]=n(void 0),[ge,_e]=n(void 0),[Ae,Ne]=n(void 0),[ke,Fe]=n(0),[xe,je]=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:v}=He();ue(v);const y=(e,i)=>{Me(C.valueType===b.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)),v){case r.AMOUNT_OFF_ORDER:y(0,1),be(a.ENTIRE_ORDER);break;case r.AMOUNT_OFF_PRODUCTS:y(0,1),(null===(e=C.entitledCollectionIds)||void 0===e?void 0:e.length)?be(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)?(be(a.SPECIFIC_PRODUCTS),P(null===(o=C.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,De)):be(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,De)),(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,v,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))}));Te(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))}));he(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)&&Te(L.data.productsConf.entitledProducts),(null===(o=null===(t=L.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&he(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(!Ee)return;if(L.newPickerConf){const e=[];return Object.values(Ee).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=Ee.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}),[Ee]),l((()=>{if(!Se)return;if(L.newPickerConf){const e=[];return Object.values(Se).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=Se.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}),[Se]),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(!Oe)return;if(L.newPickerConf){(null==Oe?void 0:Oe.isCustom)&&delete Oe.isCustom;const e=Object.keys(Oe).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}const e=Oe.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}),[Oe]);const He=()=>{var e,i,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===v.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:v.ALL,valueType:b.FIXED_AMOUNT}),n=r.AMOUNT_OFF_ORDER)):re.targetType===C.SHIPPING_LINE?n=r.FREE_SHIPPING:re.targetType===C.LINE_ITEM?n=re.targetSelection===v.ENTITLED?(null===(e=re.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=re.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||re.prerequisiteQuantity||re.entitledQuantity?r.BUY_X_GET_Y:r.AMOUNT_OFF_PRODUCTS:r.AMOUNT_OFF_ORDER:(l=Object.assign(Object.assign({},l),{targetType:C.LINE_ITEM,targetSelection:v.ALL,valueType:b.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&&(je(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 Fe(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,S;const h=e.value;ue(h),he([]),Te([]),fe([]),Ne([]),h===r.FREE_SHIPPING?de({value:100,targetSelection:v.ALL,targetType:C.SHIPPING_LINE,valueType:b.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}):h===r.BUY_X_GET_Y?de({value:100,targetSelection:v.ENTITLED,targetType:C.LINE_ITEM,valueType:b.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}):h===r.AMOUNT_OFF_ORDER?de({targetSelection:v.ALL,targetType:C.LINE_ITEM,valueType:null!==(a=re.valueType)&&void 0!==a?a:b.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}):h===r.AMOUNT_OFF_PRODUCTS&&de({targetSelection:v.ENTITLED,targetType:C.LINE_ITEM,valueType:null!==(y=re.valueType)&&void 0!==y?y:b.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!==(S=re.minAmount)&&void 0!==S?S:void 0})},Je=i=>i&&e(T,{theme:"light",tagText:i,type:"negative",LeadingIcon:_});return i(h,{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:xe?Je(xe):L.errorMsg?Je(L.errorMsg):!L.quadrant||L.hideProbability?e(t,{}):ke<=1?e(T,{theme:"light",tagText:`Current probability sum: ${ke}`,type:"white"}):e(O,{body:"Probability sum should not exceed 1",placement:"top",children:e("div",{children:e(T,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ke}`,type:"negative",LeadingIcon:g})})}),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 ${S.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 je(!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,v={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(v))return void Le(v);const b={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;b.inValidMinimumAmount=pe===d.AMOUNT&&!e,b.inValidMinimumQuantity=pe===d.QUANTITY&&!i}if(we&&(b.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==r.AMOUNT_OFF_ORDER&&se!==r.AMOUNT_OFF_PRODUCTS||(ve!==a.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(b.inValidProductSelection=!0,b.inValidProductVariableSelection=!0),ve===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(b.inValidCollectionSelection=!0)),se===r.BUY_X_GET_Y&&(re.prerequisiteQuantity||(b.inValidBuyXValue=!0),re.entitledQuantity||(b.inValidGetYValue=!0),ye!==c.SPECIFIC_PRODUCTS||!Se||Object.keys(Se).length||ge||(b.inValidBuyXProductSelection=!0,b.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(b.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(b.inValidGetYProductSelection=!0,b.inValidGetYProductVariableSelection=!0),me===c.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(b.inValidGetYCollectionSelection=!0)),Ke(b))return void Ge(b);if(ae||ke>1)return void je(!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!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=Ve?Ve:{},prerequisiteProductVariable:null!=ge?ge:{}}}))}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||(ve!==a.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(e.inValidProductSelection=!0,e.inValidProductVariableSelection=!0),ve===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||!Se||Object.keys(Se).length||ge||(e.inValidBuyXProductSelection=!0,e.inValidBuyXProductVariableSelection=!0),ye===c.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(e.inValidBuyXCollectionSelection=!0),me!==c.SPECIFIC_PRODUCTS||!Ee||Object.keys(Ee).length||Ve||(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 je(!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!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=Ve?Ve:{},prerequisiteProductVariable:null!=ge?ge:{}}}))}}},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(F,{children:[L.allowStaticCoupon&&!ee&&!L.hideOption&&i(x,{selectedDiv:re.isStaticCoupon?1:2,children:["static"===L.hideOption?e(t,{}):i("div",{className:"coupon-type__container",onClick:()=>{re.isStaticCoupon||(de({isStaticCoupon:!0,quadrant:re.quadrant}),je(""),ze())},children:[e(P,{style:{marginBottom:"4px",color:re.isStaticCoupon?S.colorsV2.content.brand:void 0},children:"Static Code"}),e(m,{style:re.isStaticCoupon?{color:S.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",{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:v.ALL,valueType:b.FIXED_AMOUNT}),je(""),ze(),Me({id:"0",label:"Amount",value:"amount",icon:i=>e("span",{style:{fontSize:20,color:i},children:L.currency||""})}),qe(null!==(i=L.makeExpiryMandatory)&&void 0!==i&&i),Ce(d.NA))},children:[e(P,{style:{marginBottom:"4px",color:re.isStaticCoupon?void 0:S.colorsV2.content.brand},children:"Dynamic Code"}),e(m,{style:re.isStaticCoupon?{}:{color:S.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,{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:ve,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:be,setOfferAppliesToBuy:Pe,setOfferAppliesToGet:Ie,hideExpiration:L.hideExpiration||!1,onChangeCouponType:Ze,entitledProducts:null!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[],setEntitledProducts:Te,setPrerequisiteProducts:he,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[],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:Ve,setEntitledProductVariable:De,preRequisiteProductVariable:ge,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:je,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory}),!re.isStaticCoupon&&!ee&&!ne&&e(w,{currency:L.currency,entitledProducts:null!=Ee?Ee:[],prerequisiteProducts:null!=Se?Se:[],setEntitledProducts:Te,setPrerequisiteProducts:he,discountData:re,productPickerOpen:ee,productVariablePickerOpen:te,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setDiscountData:de,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:Ce,discountCouponAppliesTo:ve,offerAppliesToBuy:ye,offerAppliesToGet:me,setDiscountCouponAppliesTo:be,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!=Oe?Oe:[],setIsCollectionPickerOpen:le,setEntitledCollections:Ne,setPrerequisiteCollections:fe,useNewPicker:!!L.newPickerConf,setSelectedDiscountDetails:Me,selectedDiscountDetails:Re,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:Ve,setEntitledProductVariable:De,preRequisiteProductVariable:ge,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:we,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:je,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!L.makeExpiryMandatory})]}),!!ee&&i(t,{children:[!L.newPickerConf&&e("div",{style:{padding:"12px 0"},children:e(E,{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?Ee:Se)&&void 0!==K?K:[],setSelectedProducts:ee===q.ENTITLED?Te:he,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?Ee:Se,onAdd:e=>{ee===q.ENTITLED?Te(e):he(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",{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:Oe,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(E,{show:!0,onSave:()=>{},products:null!==($=L.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{le(void 0)},selectedProducts:null!==(Z=ne===q.ENTITLED?Ae:Oe)&&void 0!==Z?Z:[],setSelectedProducts:ne===q.ENTITLED?Ne:fe,onSearchKeyChange:L.onCollectionSearch,searchPlaceholder:"Search collections..."})]})}),te&&e(j,{children:e("div",{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;De({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{DISCOUNT_TYPES as e,DISCOUNT_VALUE_TYPES as t,MIN_PURCHASE_REQUIREMENT as i,DISCOUNT_TARGET_TYPES as r,DISCOUNT_TARGET_SELECTION as n}from"./type.js";import l from"../../utils/DateUtils.js";const u=(l,u,o,d,a,p,s)=>{var f;if(!l.title||(null===(f=l.title)||void 0===f?void 0:f.length)>30)return!0;if(!d){if(isNaN(l.probability))return!0;if((l.probability||0)>1)return!0;if((l.probability||0)<0)return!0;if(a>1)return!0}if(p&&!s){if(!(null==l?void 0:l.couponCode))return!0;if(!l.description)return!0}else{if(p&&s&&!(null==l?void 0:l.couponCode))return!0;if(o&&o===e.AMOUNT_OFF_ORDER){if((null==l?void 0:l.valueType)===t.FIXED_AMOUNT){if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0)return!0}else if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0||(null==l?void 0:l.value)>100)return!0;if(u===i.AMOUNT&&(!l.minAmount||(null==l?void 0:l.minAmount)<=0))return!0;if(u===i.QUANTITY&&(!(null==l?void 0:l.minQuantity)||(null==l?void 0:l.minQuantity)<=0))return!0;if(l.targetType!==r.LINE_ITEM)return!0;if(l.targetSelection!==n.ALL)return!0}else if(o&&o===e.AMOUNT_OFF_PRODUCTS){if(!l.value)return!0;if((null==l?void 0:l.valueType)===t.FIXED_AMOUNT){if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0)return!0}else if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0||(null==l?void 0:l.value)>100)return!0;if(l.targetSelection!==n.ENTITLED)return!0;if(l.targetType!==r.LINE_ITEM)return!0}else if(o&&o===e.BUY_X_GET_Y){if(!l.entitledQuantity||l.entitledQuantity<0||!l.prerequisiteQuantity||l.prerequisiteQuantity<0)return!0;if(l.valueType!==t.PERCENTAGE)return!0;if(!l.value)return!0;if(l.value<=0||l.value>100)return!0;if(l.targetSelection!==n.ENTITLED)return!0;if(l.targetType!==r.LINE_ITEM)return!0}else if(o&&e.FREE_SHIPPING){if(l.valueType!==t.PERCENTAGE)return!0;if(l.targetType!==r.SHIPPING_LINE)return!0;if(100!==l.value)return!0;if(l.targetSelection!==n.ALL)return!0;if(u===i.AMOUNT&&(!l.minAmount||(null==l?void 0:l.minAmount)<=0))return!0;if(u===i.QUANTITY&&(!(null==l?void 0:l.minQuantity)||(null==l?void 0:l.minQuantity)<=0))return!0}if(null!==l.expireAfter&&void 0!==l.expireAfter&&l.expireAfter<=0)return!0;if(l.expireAt&&l.expireAt<new Date)return!0}return!1},o=(e,i,u,o)=>{var a,p,s;return(null==e?void 0:e.isStaticCoupon)&&(null==e?void 0:e.description)?e.description:e.targetType===r.LINE_ITEM&&e.targetSelection===n.ALL?`${e.valueType===t.FIXED_AMOUNT?i:""}${(null!==(a=e.value)&&void 0!==a?a:0).toString()}${e.valueType===t.PERCENTAGE?"% off":" off"} on all products\n ${e.minAmount?`| Minimum purchase of ${i}${e.minAmount}`:""} ${e.minQuantity?`| Buy ${e.minQuantity} products`:""} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():e.targetType===r.SHIPPING_LINE?`\n Free shipping on your order ${e.minAmount?`| Minimum purchase of ${i}${e.minAmount}`:""} ${e.minQuantity?`| Buy ${e.minQuantity} products`:""} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():e.targetSelection===n.ENTITLED?(null===(p=e.prerequisiteProductIds)||void 0===p?void 0:p.length)||(null===(s=e.prerequisiteCollectionIds)||void 0===s?void 0:s.length)||e.entitledQuantity||e.prerequisiteQuantity?`${function(e,t,i){var r,n,l,u,o,a,p,s;let f=`Buy ${e.prerequisiteQuantity} item`;if((null===(r=e.prerequisiteProductIds)||void 0===r?void 0:r.length)||(null===(n=e.prerequisiteCollectionIds)||void 0===n?void 0:n.length)){const r=d(null!==(l=e.prerequisiteProductIds)&&void 0!==l?l:[],t),n=d(null!==(u=e.prerequisiteCollectionIds)&&void 0!==u?u:[],i);f+=" from a selection of ",r.length>0&&(f+=`${r.join(", ")} or `),n.length>0&&(f+=`products in ${n.join(", ")} collection or `),f=f.slice(0,-4)}if(f+=` and get ${e.entitledQuantity} item`,(null===(o=e.entitledProductIds)||void 0===o?void 0:o.length)||(null===(a=e.entitledCollectionIds)||void 0===a?void 0:a.length)){const r=d(null!==(p=e.entitledProductIds)&&void 0!==p?p:[],t),n=d(null!==(s=e.entitledCollectionIds)&&void 0!==s?s:[],i);f+=" from ",r.length>0&&(f+=`${r.join(", ")} or `),n.length>0&&(f+=`products in ${n.join(", ")} collection or `),f=f.slice(0,-4)}return f}(e,u,o)} ${100===e.value?"for free":`at ${e.value}% off`} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():`${function(e,i,r,n){var l,u,o;let a=`Get ${e.valueType===t.FIXED_AMOUNT?n:""}${(null!==(l=e.value)&&void 0!==l?l:0).toString()}${e.valueType===t.PERCENTAGE?"% off":" off"} on `;const p=d(null!==(u=e.entitledProductIds)&&void 0!==u?u:[],i),s=d(null!==(o=e.entitledCollectionIds)&&void 0!==o?o:[],r);p.length>0&&(a+=`${p.join(", ")} or `);s.length>0&&(a+=`products in ${s.join(", ")} collection or `);return a.slice(0,-4)}(e,u,o,i)} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():void 0};function d(e,t){const i=[];return t.forEach(t=>{e.find(e=>e.toString()===t.id)&&i.push(t.name)}),i}export{o as descriptionBuilder,u as validateDiscountData};
|
|
1
|
+
import{DISCOUNT_TYPES as e,DISCOUNT_VALUE_TYPES as t,MIN_PURCHASE_REQUIREMENT as i,DISCOUNT_TARGET_TYPES as r,DISCOUNT_TARGET_SELECTION as n}from"./type.js";import l from"../../utils/DateUtils.js";const u=(l,u,o,d,a,p,s)=>{var f;if(!l.title||(null===(f=l.title)||void 0===f?void 0:f.length)>30)return!0;if(!d){if(isNaN(l.probability))return!0;if((l.probability||0)>1)return!0;if((l.probability||0)<0)return!0;if(a>1)return!0}if(p&&!s){if(!(null==l?void 0:l.couponCode))return!0;if(!l.description)return!0}else{if(p&&s&&!(null==l?void 0:l.couponCode))return!0;if(o&&o===e.AMOUNT_OFF_ORDER){if((null==l?void 0:l.valueType)===t.FIXED_AMOUNT){if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0)return!0}else if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0||(null==l?void 0:l.value)>100)return!0;if(u===i.AMOUNT&&(!l.minAmount||(null==l?void 0:l.minAmount)<=0))return!0;if(u===i.QUANTITY&&(!(null==l?void 0:l.minQuantity)||(null==l?void 0:l.minQuantity)<=0))return!0;if(l.targetType!==r.LINE_ITEM)return!0;if(l.targetSelection!==n.ALL)return!0}else if(o&&o===e.AMOUNT_OFF_PRODUCTS){if(!l.value)return!0;if((null==l?void 0:l.valueType)===t.FIXED_AMOUNT){if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0)return!0}else if(!(null==l?void 0:l.value)||(null==l?void 0:l.value)<=0||(null==l?void 0:l.value)>100)return!0;if(l.targetSelection!==n.ENTITLED)return!0;if(l.targetType!==r.LINE_ITEM)return!0}else if(o&&o===e.BUY_X_GET_Y){if(!l.entitledQuantity||l.entitledQuantity<0||!l.prerequisiteQuantity||l.prerequisiteQuantity<0)return!0;if(l.valueType!==t.PERCENTAGE)return!0;if(!l.value)return!0;if(l.value<=0||l.value>100)return!0;if(l.targetSelection!==n.ENTITLED)return!0;if(l.targetType!==r.LINE_ITEM)return!0}else if(o&&e.FREE_SHIPPING){if(l.valueType!==t.PERCENTAGE)return!0;if(l.targetType!==r.SHIPPING_LINE)return!0;if(100!==l.value)return!0;if(l.targetSelection!==n.ALL)return!0;if(u===i.AMOUNT&&(!l.minAmount||(null==l?void 0:l.minAmount)<=0))return!0;if(u===i.QUANTITY&&(!(null==l?void 0:l.minQuantity)||(null==l?void 0:l.minQuantity)<=0))return!0}if(null!==l.expireAfter&&void 0!==l.expireAfter&&l.expireAfter<=0)return!0;if(l.expireAt&&l.expireAt<new Date)return!0}return!1},o=(e,i,u,o)=>{var a,p,s;return(null==e?void 0:e.isStaticCoupon)&&(null==e?void 0:e.description)?e.description:e.targetType===r.LINE_ITEM&&e.targetSelection===n.ALL?`${e.valueType===t.FIXED_AMOUNT?i:""}${(null!==(a=e.value)&&void 0!==a?a:0).toString()}${e.valueType===t.PERCENTAGE?"% off":" off"} on all products\n ${e.minAmount?`| Minimum purchase of ${i}${e.minAmount}`:""} ${e.minQuantity?`| Buy ${e.minQuantity} products`:""} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():e.targetType===r.SHIPPING_LINE?`\n Free shipping on your order ${e.minAmount?`| Minimum purchase of ${i}${e.minAmount}`:""} ${e.minQuantity?`| Buy ${e.minQuantity} products`:""} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():e.targetSelection===n.ENTITLED?(null===(p=e.prerequisiteProductIds)||void 0===p?void 0:p.length)||(null===(s=e.prerequisiteCollectionIds)||void 0===s?void 0:s.length)||e.entitledQuantity||e.prerequisiteQuantity?`${function(e,t,i){var r,n,l,u,o,a,p,s;let f=`Buy ${e.prerequisiteQuantity} item`;if((null===(r=e.prerequisiteProductIds)||void 0===r?void 0:r.length)||(null===(n=e.prerequisiteCollectionIds)||void 0===n?void 0:n.length)){const r=d(null!==(l=e.prerequisiteProductIds)&&void 0!==l?l:[],t),n=d(null!==(u=e.prerequisiteCollectionIds)&&void 0!==u?u:[],i);f+=" from a selection of ",r.length>0&&(f+=`${r.join(", ")} or `),n.length>0&&(f+=`products in ${n.join(", ")} collection or `),f=f.slice(0,-4)}if(f+=` and get ${e.entitledQuantity} item`,(null===(o=e.entitledProductIds)||void 0===o?void 0:o.length)||(null===(a=e.entitledCollectionIds)||void 0===a?void 0:a.length)){const r=d(null!==(p=e.entitledProductIds)&&void 0!==p?p:[],t),n=d(null!==(s=e.entitledCollectionIds)&&void 0!==s?s:[],i);f+=" from ",r.length>0&&(f+=`${r.join(", ")} or `),n.length>0&&(f+=`products in ${n.join(", ")} collection or `),f=f.slice(0,-4)}return f}(e,u,o)} ${100===e.value?"for free":`at ${e.value}% off`} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():`${function(e,i,r,n){var l,u,o;let a=`Get ${e.valueType===t.FIXED_AMOUNT?n:""}${(null!==(l=e.value)&&void 0!==l?l:0).toString()}${e.valueType===t.PERCENTAGE?"% off":" off"} on `;const p=d(null!==(u=e.entitledProductIds)&&void 0!==u?u:[],i),s=d(null!==(o=e.entitledCollectionIds)&&void 0!==o?o:[],r);p.length>0&&(a+=`${p.join(", ")} or `);s.length>0&&(a+=`products in ${s.join(", ")} collection or `);return a.slice(0,-4)}(e,u,o,i)} | One use per customer${e.expireAfter?` | Expires in ${e.expireAfter} day(s)`:e.expireAt?` | Expires at ${l.getStringFromDate(e.expireAt,"dd MMM yyyy")}`:""}`.replace(/\s\s+/g," ").trim():void 0};function d(e,t){const i=[];return t.forEach((t=>{e.find((e=>e.toString()===t.id))&&i.push(t.name)})),i}export{o as descriptionBuilder,u as validateDiscountData};
|
|
@@ -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 r,CONTENT_POSITION as d}from"../../alerts/AlertHelper.js";import{Button as s}from"../../button/Button.js";import{CheckBox as a}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{BodySecondary as T,TitleRegular as h,TitleSmall as y}from"../../TypographyStyle.js";import{DEFAULT_THEME as P}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 I}from"../../input/Input.js";import b from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import{RadioButton as g}from"../../radioButton/RadioButton.js";import V from"../../../assets/icons/cubeIcon.svg.js";import O from"../../../assets/icons/delete.svg.js";import S from"../../../assets/icons/edit.svg.js";import f from"../../../assets/icons/plus.svg.js";import{CouponExpiration as x}from"../CouponExpiration/CouponExpiration.js";import{DynamicCouponContainer as R}from"../DiscountModal.styled.js";import{DiscountOptionsContainer as j,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,a,u)=>{var p,m,C,E,v,D,h,I,g,x,R,j;let _=[],q=[],U={},M={};B.useNewPicker?(U=a===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=a===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})})):(_=a===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=a===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===(h=B.dynamicDiscountValidationError)||void 0===h?void 0:h.inValidBuyXProductSelection,null===(I=B.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidBuyXProductVariableSelection],X=[null===(g=B.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYCollectionSelection,null===(x=B.dynamicDiscountValidationError)||void 0===x?void 0:x.inValidGetYProductSelection,null===(R=B.dynamicDiscountValidationError)||void 0===R?void 0:R.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",{style:{display:"flex",gap:18},children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(a===k.ENTITLED&&!B.entitledProductVariable||a===k.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(N,{children:[t("div",{style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"},children:t(s,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:f,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(a)},error:Y})}),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(T,{color:P.colorsV2.content.placeholder,children:"OR"}),t(s,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:f,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(a)},error:Y})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",{style:{width:"300px",display:"flex"},children:t(s,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:f,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(a)},style:{marginTop:"16px"},error:Y})})]}),Y&&t("div",{style:{margin:"8px 0 0"},children:t(l,{type:r.NEGATIVE,text:"Required Field",contentPosition:d.START,icon:()=>t(n,{width:16,height:16,color:P.colorsV2.content.negative})})}),_.length||q.length?i("div",{children:[t(T,{style:{margin:"8px 0"},children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"}),i(A,{children:[t(F,{children:t(V,{width:20,height:20,color:P.colorsV2.content.secondary})}),i(y,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",{style:{display:"flex",gap:4},children:[t(L,{onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(a):B.setIsCollectionPickerOpen(a)},children:t(S,{width:24,height:24,color:P.colorsV2.content.placeholder})}),t(L,{onClick:()=>{e===c.SPECIFIC_PRODUCTS?a===k.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):a===k.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])},children:t(O,{width:24,height:24,color:P.colorsV2.content.placeholder})})]})]})]}):a===k.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(T,{style:{margin:"16px 0 8px"},children:"Product Variable"}),i(w,{children:[t(y,{children:B.entitledProductVariable.displayName}),t("div",{style:{display:"flex",gap:4},children:t(L,{onClick:()=>{B.setEntitledProductVariable(void 0)},children:t(b,{width:24,height:24,color:P.colorsV2.content.primary})})})]})]}):a===k.PREREQUISITE&&(null===(j=B.preRequisiteProductVariable)||void 0===j?void 0:j.displayName)?i("div",{children:[t(T,{style:{margin:"16px 0 8px"},children:"Product Variable"}),i(w,{children:[t(y,{children:B.preRequisiteProductVariable.displayName}),t("div",{style:{display:"flex",gap:4},children:t(L,{onClick:()=>{B.setPreRequisiteProductVariable(void 0)},children:t(b,{width:24,height:24,color:P.colorsV2.content.primary})})})]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,r,d,s,a,p,m,C,E;let v=[],h=[],P={},b={};B.useNewPicker?(P=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,b=null!==(n=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==P?void 0:P.isCustom)&&delete P.isCustom,(null==b?void 0:b.isCustom)&&delete b.isCustom,Object.values(P).forEach(e=>{Object.keys(e.products).forEach(i=>{v.push({id:i,name:e.products[i].name,image:e.products[i].image})})}),Object.keys(b).forEach(e=>{"isCustom"!==e&&h.push({id:e,name:b[e].name,image:b[e].image})})):(v=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,h=null!==(l=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const g=e===k.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,V=e===k.PREREQUISITE?k.PREREQUISITE:k.ENTITLED,O=g===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(y,{style:{marginBottom:16},children:e===k.PREREQUISITE?"Customer buys":"Customer gets"}),i("div",{style:{display:"flex"},children:[!o&&t("div",{children:i("div",{className:"input__rows",children:[t("div",{className:"input__wrapper",children:t(I,{value:e===k.ENTITLED?null!==(d=null===(r=B.discountData.entitledQuantity)||void 0===r?void 0:r.toString())&&void 0!==d?d:"":null!==(a=null===(s=B.discountData.prerequisiteQuantity)||void 0===s?void 0:s.toString())&&void 0!==a?a:"",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(T,{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(O,V,e===k.PREREQUISITE?"buyX":"getY")]})};return i(R,{style:B.noTopMargin?{marginTop:0}:{},children:[i("div",{children:[i("div",{style:{display:"flex",gap:16},children:[t("div",{className:"input__wrapper",children:t(I,{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(I,{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:P.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t(()=>i("div",{children:[t(h,{children:"Discount Details"}),t(j,{children:B.discountDetailsOptions.map(t=>{return i(_,{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?P.colorsV2.stroke.brand:P.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,r,d,s;return i(o,{children:[t("div",{className:"input__rows",children:t("div",{className:"input__wrapper",children:t(I,{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!==(r=B.currency)&&void 0!==r?r:"":void 0,suffixText:B.discountData.valueType===C.PERCENTAGE?"%":void 0,errorMessage:(null===(d=B.dynamicDiscountValidationError)||void 0===d?void 0:d.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})})}),t("div",{style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${P.colorsV2.stroke.primary}`},children:i("div",{className:"input__wrapper",children:[t(h,{style:{marginBottom:10},children:"Applies to"}),t("div",{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,r;return i(R,{style:{border:`1px solid ${P.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0},children:[ee(k.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:P.colorsV2.stroke.primary,margin:"8px 0"}}),ee(k.ENTITLED),t(T,{style:{marginTop:"8px"},children:"At a discounted value"}),t("div",{children:t(g,{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",{style:{display:"flex",flexDirection:"column"},children:[t(g,{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",{style:{marginTop:8},children:t(I,{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===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})})]})]})})(),!B.selectedCouponType&&t(U,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",{style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${P.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",{style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${P.colorsV2.stroke.primary}`:"none"},children:[t(a,{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(T,{style:{color:P.colorsV2.text.secondary,marginLeft:28},children:"Make coupon only valid till a certain time"}),B.isAddExpirationChecked&&t(x,{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 r,CONTENT_POSITION as d}from"../../alerts/AlertHelper.js";import{Button as s}from"../../button/Button.js";import{CheckBox as a}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{BodySecondary as T,TitleRegular as h,TitleSmall as y}from"../../TypographyStyle.js";import{DEFAULT_THEME as P}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 I}from"../../input/Input.js";import b from"../../../assets/icons/cross.svg.js";import"../../dropdown/MenuItem/MenuItem.js";import{RadioButton as g}from"../../radioButton/RadioButton.js";import V from"../../../assets/icons/cubeIcon.svg.js";import O from"../../../assets/icons/delete.svg.js";import S from"../../../assets/icons/edit.svg.js";import f from"../../../assets/icons/plus.svg.js";import{CouponExpiration as x}from"../CouponExpiration/CouponExpiration.js";import{DynamicCouponContainer as R}from"../DiscountModal.styled.js";import{DiscountOptionsContainer as j,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,a,u)=>{var p,m,C,E,v,D,h,I,g,x,R,j;let _=[],q=[],U={},M={};B.useNewPicker?(U=a===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,M=null!==(p=a===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})}))):(_=a===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,q=null!==(m=a===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===(h=B.dynamicDiscountValidationError)||void 0===h?void 0:h.inValidBuyXProductSelection,null===(I=B.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidBuyXProductVariableSelection],X=[null===(g=B.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYCollectionSelection,null===(x=B.dynamicDiscountValidationError)||void 0===x?void 0:x.inValidGetYProductSelection,null===(R=B.dynamicDiscountValidationError)||void 0===R?void 0:R.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",{style:{display:"flex",gap:18},children:[e===c.SPECIFIC_PRODUCTS&&0===_.length&&(a===k.ENTITLED&&!B.entitledProductVariable||a===k.PREREQUISITE&&!B.preRequisiteProductVariable)&&!(null==q?void 0:q.length)&&i(N,{children:[t("div",{style:{width:B.isProductVariableSupported?"284px":"300px",display:"flex"},children:t(s,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:f,matchParentWidth:!0,onClick:()=>{B.setIsProductPickerOpen(a)},error:Y})}),B.isProductVariableSupported&&B.productVariableList&&i(o,{children:[t(T,{color:P.colorsV2.content.placeholder,children:"OR"}),t(s,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:f,matchParentWidth:!0,onClick:()=>{B.setIsProductVariablePickerOpen(a)},error:Y})]})]}),e===c.SPECIFIC_COLLECTIONS&&0===q.length&&!(null==_?void 0:_.length)&&t("div",{style:{width:"300px",display:"flex"},children:t(s,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:f,matchParentWidth:!0,onClick:()=>{B.setIsCollectionPickerOpen(a)},style:{marginTop:"16px"},error:Y})})]}),Y&&t("div",{style:{margin:"8px 0 0"},children:t(l,{type:r.NEGATIVE,text:"Required Field",contentPosition:d.START,icon:()=>t(n,{width:16,height:16,color:P.colorsV2.content.negative})})}),_.length||q.length?i("div",{children:[t(T,{style:{margin:"8px 0"},children:e===c.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"}),i(A,{children:[t(F,{children:t(V,{width:20,height:20,color:P.colorsV2.content.secondary})}),i(y,{children:[e===c.SPECIFIC_PRODUCTS?_.length:q.length," ",e===c.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i("div",{style:{display:"flex",gap:4},children:[t(L,{onClick:()=>{e===c.SPECIFIC_PRODUCTS?B.setIsProductPickerOpen(a):B.setIsCollectionPickerOpen(a)},children:t(S,{width:24,height:24,color:P.colorsV2.content.placeholder})}),t(L,{onClick:()=>{e===c.SPECIFIC_PRODUCTS?a===k.ENTITLED?B.setEntitledProducts([]):B.setPrerequisiteProducts([]):a===k.ENTITLED?B.setEntitledCollections([]):B.setPrerequisiteCollections([])},children:t(O,{width:24,height:24,color:P.colorsV2.content.placeholder})})]})]})]}):a===k.ENTITLED&&B.entitledProductVariable?i("div",{children:[t(T,{style:{margin:"16px 0 8px"},children:"Product Variable"}),i(w,{children:[t(y,{children:B.entitledProductVariable.displayName}),t("div",{style:{display:"flex",gap:4},children:t(L,{onClick:()=>{B.setEntitledProductVariable(void 0)},children:t(b,{width:24,height:24,color:P.colorsV2.content.primary})})})]})]}):a===k.PREREQUISITE&&(null===(j=B.preRequisiteProductVariable)||void 0===j?void 0:j.displayName)?i("div",{children:[t(T,{style:{margin:"16px 0 8px"},children:"Product Variable"}),i(w,{children:[t(y,{children:B.preRequisiteProductVariable.displayName}),t("div",{style:{display:"flex",gap:4},children:t(L,{onClick:()=>{B.setPreRequisiteProductVariable(void 0)},children:t(b,{width:24,height:24,color:P.colorsV2.content.primary})})})]})]}):t(o,{children:" "})]})},ee=(e,o)=>{var n,l,r,d,s,a,p,m,C,E;let v=[],h=[],P={},b={};B.useNewPicker?(P=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,b=null!==(n=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==n?n:[],(null==P?void 0:P.isCustom)&&delete P.isCustom,(null==b?void 0:b.isCustom)&&delete b.isCustom,Object.values(P).forEach((e=>{Object.keys(e.products).forEach((i=>{v.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(b).forEach((e=>{"isCustom"!==e&&h.push({id:e,name:b[e].name,image:b[e].image})}))):(v=e===k.ENTITLED?B.entitledProducts:B.prerequisiteProducts,h=null!==(l=e===k.ENTITLED?B.entitledCollections:B.prerequisiteCollections)&&void 0!==l?l:[]);const g=e===k.PREREQUISITE?B.offerAppliesToBuy:B.offerAppliesToGet,V=e===k.PREREQUISITE?k.PREREQUISITE:k.ENTITLED,O=g===u.SPECIFIC_PRODUCTS?c.SPECIFIC_PRODUCTS:c.SPECIFIC_COLLECTIONS;return i("div",{children:[t(y,{style:{marginBottom:16},children:e===k.PREREQUISITE?"Customer buys":"Customer gets"}),i("div",{style:{display:"flex"},children:[!o&&t("div",{children:i("div",{className:"input__rows",children:[t("div",{className:"input__wrapper",children:t(I,{value:e===k.ENTITLED?null!==(d=null===(r=B.discountData.entitledQuantity)||void 0===r?void 0:r.toString())&&void 0!==d?d:"":null!==(a=null===(s=B.discountData.prerequisiteQuantity)||void 0===s?void 0:s.toString())&&void 0!==a?a:"",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(T,{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(O,V,e===k.PREREQUISITE?"buyX":"getY")]})};return i(R,{style:B.noTopMargin?{marginTop:0}:{},children:[i("div",{children:[i("div",{style:{display:"flex",gap:16},children:[t("div",{className:"input__wrapper",children:t(I,{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(I,{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:P.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),B.allowStaticCoupon&&t((()=>i("div",{children:[t(h,{children:"Discount Details"}),t(j,{children:B.discountDetailsOptions.map((t=>{return i(_,{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?P.colorsV2.stroke.brand:P.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,r,d,s;return i(o,{children:[t("div",{className:"input__rows",children:t("div",{className:"input__wrapper",children:t(I,{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!==(r=B.currency)&&void 0!==r?r:"":void 0,suffixText:B.discountData.valueType===C.PERCENTAGE?"%":void 0,errorMessage:(null===(d=B.dynamicDiscountValidationError)||void 0===d?void 0:d.inValidDiscountAmount)?"Required Field":"",state:(null===(s=B.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"invalid":"none"})})}),t("div",{style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${P.colorsV2.stroke.primary}`},children:i("div",{className:"input__wrapper",children:[t(h,{style:{marginBottom:10},children:"Applies to"}),t("div",{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,r;return i(R,{style:{border:`1px solid ${P.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0},children:[ee(k.PREREQUISITE),t("div",{style:{width:"100%",height:"1px",backgroundColor:P.colorsV2.stroke.primary,margin:"8px 0"}}),ee(k.ENTITLED),t(T,{style:{marginTop:"8px"},children:"At a discounted value"}),t("div",{children:t(g,{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",{style:{display:"flex",flexDirection:"column"},children:[t(g,{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",{style:{marginTop:8},children:t(I,{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===(r=B.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})})]})]})})(),!B.selectedCouponType&&t(U,{}),B.allowStaticCoupon&&B.selectedCouponType!==p.BUY_X_GET_Y&&t("div",{style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${P.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",{style:{padding:B.selectedCouponType!==p.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:B.selectedCouponType!==p.BUY_X_GET_Y?`1px solid ${P.colorsV2.stroke.primary}`:"none"},children:[t(a,{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(T,{style:{color:P.colorsV2.text.secondary,marginLeft:28},children:"Make coupon only valid till a certain time"}),B.isAddExpirationChecked&&t(x,{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};
|
|
@@ -15,12 +15,12 @@ import e from"styled-components";import{DEFAULT_THEME as r}from"../../../constan
|
|
|
15
15
|
gap: 12px;
|
|
16
16
|
margin-bottom: 8px;
|
|
17
17
|
margin-top: 16px;
|
|
18
|
-
`,
|
|
18
|
+
`,n=e.div`
|
|
19
19
|
height: 76px;
|
|
20
20
|
width: 100%;
|
|
21
21
|
padding: 12px;
|
|
22
22
|
border: 1px solid
|
|
23
|
-
${
|
|
23
|
+
${e=>{let{selected:o}=e;return o?r.colorsV2.content.brand:r.colorsV2.stroke.primary}};
|
|
24
24
|
border-radius: 4px;
|
|
25
25
|
cursor: pointer;
|
|
26
26
|
display: flex;
|
|
@@ -29,13 +29,13 @@ import e from"styled-components";import{DEFAULT_THEME as r}from"../../../constan
|
|
|
29
29
|
align-items: center;
|
|
30
30
|
text-align: center;
|
|
31
31
|
gap: 8px;
|
|
32
|
-
color: ${
|
|
33
|
-
background-color: ${
|
|
32
|
+
color: ${e=>{let{selected:o}=e;return o?r.colorsV2.text.brand:r.colorsV2.text.secondary}};
|
|
33
|
+
background-color: ${e=>{let{selected:o}=e;return o?r.colorsV2.background.brandLight:r.colorsV2.surface.subdued}};
|
|
34
34
|
|
|
35
35
|
&:hover {
|
|
36
|
-
background-color: ${
|
|
36
|
+
background-color: ${e=>{let{selected:o}=e;return o?r.colorsV2.background.brandLight:r.colorsV2.surface.hovered}};
|
|
37
37
|
}
|
|
38
|
-
`,
|
|
38
|
+
`,d=e.div`
|
|
39
39
|
display: flex;
|
|
40
40
|
justify-content: space-between;
|
|
41
41
|
align-items: center;
|
|
@@ -43,7 +43,7 @@ import e from"styled-components";import{DEFAULT_THEME as r}from"../../../constan
|
|
|
43
43
|
gap: 16px;
|
|
44
44
|
margin-top: 16px;
|
|
45
45
|
width: 100%;
|
|
46
|
-
`,
|
|
46
|
+
`,i=e.div`
|
|
47
47
|
width: 296px;
|
|
48
48
|
height: 64px;
|
|
49
49
|
border-radius: 4px;
|
|
@@ -73,4 +73,4 @@ import e from"styled-components";import{DEFAULT_THEME as r}from"../../../constan
|
|
|
73
73
|
align-items: center;
|
|
74
74
|
justify-content: space-between;
|
|
75
75
|
width: fit-content;
|
|
76
|
-
`;export{
|
|
76
|
+
`;export{d as AddProductButtonsContainer,s as CubeIconContainer,n as DiscountDetailsOption,t as DiscountOptionsContainer,o as IconContainer,i as ProductCollectionCard,c as ProductVariableCard};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsxs as i,jsx as
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import o from"styled-components";const a=o=>{let{color:a="linear-gradient(90deg, #ff166a 0%, #ff317dff 100%)",size:t=4}=o;return i(n,{children:[e(r,{$color:a,$size:t}),e(r,{$color:a,$size:t}),e(r,{$color:a,$size:t})]})},n=o.span`
|
|
2
2
|
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
`,r=
|
|
4
|
+
`,r=o.span`
|
|
5
5
|
display: block;
|
|
6
6
|
width: ${i=>i.$size}px;
|
|
7
7
|
height: ${i=>i.$size}px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as p}from"react/jsx-runtime";const x={z1:{up:"0px -2px 8px rgba(0, 0, 0, 0.12)",down:"0px 2px 8px rgba(0, 0, 0, 0.12)"},z2:{up:"0px -4px 12px rgba(0, 0, 0, 0.12)",down:"0px 4px 12px rgba(0, 0, 0, 0.12)"}},r=
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";const x={z1:{up:"0px -2px 8px rgba(0, 0, 0, 0.12)",down:"0px 2px 8px rgba(0, 0, 0, 0.12)"},z2:{up:"0px -4px 12px rgba(0, 0, 0, 0.12)",down:"0px 4px 12px rgba(0, 0, 0, 0.12)"}},r=r=>{let{level:e="z1",position:n="down",children:o,style:t}=r;const l=x[e][n];return p("div",{style:Object.assign({boxShadow:l},null!=t?t:{}),children:o})};export{r as DropShadow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useState as l,useEffect as r}from"react";import i from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import s from"../../assets/icons/chevronDown.svg.js";import c from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/errorInfo.svg.js";import{InputFooter as d}from"../input/Input.styled.js";import{Tag as h}from"../tag/Tag.js";import{Tooltip as m}from"../tooltips/Tooltip.js";import{BodyCaption as p}from"../TypographyStyle.js";import{ChipInputWrapper as g}from"./Common.styled.js";const f=
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useState as l,useEffect as r}from"react";import i from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import s from"../../assets/icons/chevronDown.svg.js";import c from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/errorInfo.svg.js";import{InputFooter as d}from"../input/Input.styled.js";import{Tag as h}from"../tag/Tag.js";import{Tooltip as m}from"../tooltips/Tooltip.js";import{BodyCaption as p}from"../TypographyStyle.js";import{ChipInputWrapper as g}from"./Common.styled.js";const f=f=>{let{chips:v,onDeleteChip:y,containerStyle:u={},sizeToUse:j="default",isDropdownOpened:b,placeholder:x="Select..",errorMessage:T="",showLabelsOnMoreHover:w=!1}=f;const[I,C]=l(),[S,z]=l(0),[D,L]=l([]);return r((()=>{if(!v)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(v);let o=v.filter((o=>(e+=o.label.length,e<=t)));0===o.length&&v.length>0&&(o=[v[0]]),C(o);const l=v.filter((e=>!o.includes(e))).map((e=>e.label));L(l),z(v.length-o.length)}),[v]),e(t,{children:[e(g,{style:Object.assign({},u),error:!!T,children:[e("div",{className:"chips-container",children:[null==I?void 0:I.map(((e,t)=>o("div",{style:{zIndex:2},children:o(h,{tagText:i.truncateText(e.selectedLabel||e.label,40),TrailingIcon:()=>o(c,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{y(e)}}),children:e.selectedLabel||e.label})},t))),!!S&&o("div",{style:{position:"relative",zIndex:2,pointerEvents:"auto"},children:o(m,{body:"",placement:"bottom",tooltipContent:w&&D.length>0?o("div",{style:{padding:"4px"},children:D.map(((e,t)=>o(p,{style:{color:n.text.white},children:e},t)))}):void 0,children:o(p,{color:n.content.placeholder,children:`+${S} more`})})}),0===v.length&&o("div",{style:{color:n.content.placeholder},children:x})]}),o("div",{children:o(s,{style:{transform:b?"rotate(180deg)":"rotate(0deg)"},width:"x-small"===j?16:"small"===j?20:24,height:"x-small"===j?16:"small"===j?20:24,color:n.content.primary})})]}),!!T&&e(d,{invalid:!0,children:[!!T&&o(a,{width:16,height:16}),T]})]})};export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as r,useEffect as i}from"react";import{COLORS as s}from"../../constants/Theme.js";import a from"../../assets/icons/chevronDown.svg.js";import{Input as d}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import c from"./ChipInput.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const v=v=>{var g,f,w,x,b,{placeHolder:I,size:y,onSelect:j,defaultOptions:H,disabled:O,noErrorHint:S,placeHolderHeight:T,showPlaceholderWhenSelected:D=!1,inputStyle:P={},inputType:C="default",onDeleteChip:E,truncatedText:L,showLeadingIconInPlaceholder:M=!1,showTrailingIconPlaceholder:z=!1,showLabelsOnMoreHover:W=!1}=v,A=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover"]);const[_,k]=l(!1),N=null!=y?y:"default",U=r(),[V,q]=l(null!=H?H:[]);i(()=>{var e;const o=[];null===(e=null==A?void 0:A.options)||void 0===e||e.forEach(e=>{e.options?e.options.forEach(e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))}):e.selected&&o.push(e)}),q([...o])},[A.options]),i(()=>{H&&q([...H])},[H]);const B=u(V);return o(p.Provider,{value:{InputWrapper:Object.assign({height:T||("x-small"===N?24:"small"===N?32:48),width:null!==(f=null!==(g=A.buttonWidth)&&void 0!==g?g:A.width)&&void 0!==f?f:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===N?"4px 8px":"6px 8px"},P),input:{minHeight:"100%"}},children:n(h,Object.assign({"data-test":A["data-test"],ref:U,onSelect:function(e){Array.isArray(e)?q([...e]):q([e]),null==j||j(e)},disabled:O,onDropdownVisbilityChange:e=>k(e)},A,{children:["default"==C&&o(d,{version:A.version,noErrorHint:S,state:O?"disabled":"none",value:D?I:null!=B?B:"",errorMessage:A.error,variant:N,placeholder:null!=I?I:"Select an option",width:null!==(w=A.width)&&void 0!==w?w:"100%",onChangeText:m,leftIcon:M&&(null===(x=V[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return o(t,{children:null===(e=V[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n("div",{style:{display:"flex"},children:[z&&(null===(e=V[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:_?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===N?16:"small"===N?20:24,height:"x-small"===N?16:"small"===N?20:24,color:s.content.primary})]})}},truncateText:null==L||L}),"chip"==C&&o(c,{placeholder:null!=I?I:"Select options",chips:V,onDeleteChip:e=>{null==E||E(e)},errorMessage:A.error,isDropdownOpened:_,sizeToUse:N,containerStyle:{width:null!==(b=A.width)&&void 0!==b?b:"100%",cursor:"pointer"},showLabelsOnMoreHover:W})]}))})};v.displayName="Dropdown";export{v as Dropdown};
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as r,useEffect as i}from"react";import{COLORS as s}from"../../constants/Theme.js";import a from"../../assets/icons/chevronDown.svg.js";import{Input as d}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import c from"./ChipInput.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const v=v=>{var g,f,w,x,b,{placeHolder:I,size:y,onSelect:j,defaultOptions:H,disabled:O,noErrorHint:S,placeHolderHeight:T,showPlaceholderWhenSelected:D=!1,inputStyle:P={},inputType:C="default",onDeleteChip:E,truncatedText:L,showLeadingIconInPlaceholder:M=!1,showTrailingIconPlaceholder:z=!1,showLabelsOnMoreHover:W=!1}=v,A=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover"]);const[_,k]=l(!1),N=null!=y?y:"default",U=r(),[V,q]=l(null!=H?H:[]);i((()=>{var e;const o=[];null===(e=null==A?void 0:A.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),q([...o])}),[A.options]),i((()=>{H&&q([...H])}),[H]);const B=u(V);return o(p.Provider,{value:{InputWrapper:Object.assign({height:T||("x-small"===N?24:"small"===N?32:48),width:null!==(f=null!==(g=A.buttonWidth)&&void 0!==g?g:A.width)&&void 0!==f?f:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===N?"4px 8px":"6px 8px"},P),input:{minHeight:"100%"}},children:n(h,Object.assign({"data-test":A["data-test"],ref:U,onSelect:function(e){Array.isArray(e)?q([...e]):q([e]),null==j||j(e)},disabled:O,onDropdownVisbilityChange:e=>k(e)},A,{children:["default"==C&&o(d,{version:A.version,noErrorHint:S,state:O?"disabled":"none",value:D?I:null!=B?B:"",errorMessage:A.error,variant:N,placeholder:null!=I?I:"Select an option",width:null!==(w=A.width)&&void 0!==w?w:"100%",onChangeText:m,leftIcon:M&&(null===(x=V[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return o(t,{children:null===(e=V[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n("div",{style:{display:"flex"},children:[z&&(null===(e=V[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:_?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===N?16:"small"===N?20:24,height:"x-small"===N?16:"small"===N?20:24,color:s.content.primary})]})}},truncateText:null==L||L}),"chip"==C&&o(c,{placeholder:null!=I?I:"Select options",chips:V,onDeleteChip:e=>{null==E||E(e)},errorMessage:A.error,isDropdownOpened:_,sizeToUse:N,containerStyle:{width:null!==(b=A.width)&&void 0!==b?b:"100%",cursor:"pointer"},showLabelsOnMoreHover:W})]}))})};v.displayName="Dropdown";export{v as Dropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as t,jsxs as l}from"react/jsx-runtime";import n,{useState as r,useRef as i,useImperativeHandle as d,useEffect as s}from"react";import{usePopper as a}from"react-popper";import{DropShadow as p}from"../../dropShadow/DropShadow.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{OverLapAbs as v,OpenDropdownContainer as m}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const h=n.forwardRef((n,h)=>{var{children:w,onDropdownVisbilityChange:f,version:b="1.0",tooltipContent:D,tooltipDirection:g,showTooltipArrow:y,isChildLoading:C,forceOpen:j}=n,O=o(n,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow","isChildLoading","forceOpen"]);const S=h,[z,E]=r(!1),[x,A]=r(null),[L,R]=r(null),T=i(null),{styles:M,attributes:V}=a(x,L,{placement:O.placement,strategy:O.strategy}),_=o=>{var e,t;"2.0"===b&&O.isMultiSelect&&o&&(null===(e=O.onSelect)||void 0===e||e.call(O,[...o])),E(!1),null===(t=null==O?void 0:O.onClose)||void 0===t||t.call(O)};d(S,()=>({openDropdown:z}),[]),s(()=>{(null==S?void 0:S.current)&&(S.current.openDropdown=z)},[z]),s(()=>{null==f||f(z)},[z]);const k=()=>l(t,{children:[l("div",{style:{position:"relative"},ref:A,children:[e(v,{ref:T,allowEvents:O.allowEvents,disabled:O.disabled,onClick:o=>{var e;null===(e=O.onDropdownOpen)||void 0===e||e.call(O),z?(E(!1),o.preventDefault()):O.disabled||E(!0)},isChildLoading:C,children:O.allowEvents?w:null}),O.allowEvents?null:w]}),(z||j)&&e(m,Object.assign({ref:R,style:Object.assign(Object.assign({},M.popper),{zIndex:3})},V.popper,{"data-test":O["data-test"],children:e(p,{level:"z2",position:"down",style:{borderRadius:8},children:e(u,Object.assign({},O,{onSelect:o=>{var e;"2.0"===b&&O.isMultiSelect||(null===(e=O.onSelect)||void 0===e||e.call(O,o),E(!1))},onClose:_,version:b,headerRef:T,zeroState:null==O?void 0:O.zeroState}))})}))]});return e(t,{children:z||j||void 0===D?k():e(c,{body:D,placement:g,hideArrow:!y,children:e("div",{"data-test":O["data-test"],children:k()})})})});h.displayName="DropdownPopover";export{h as DropdownPopover};
|
|
1
|
+
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as t,jsxs as l}from"react/jsx-runtime";import n,{useState as r,useRef as i,useImperativeHandle as d,useEffect as s}from"react";import{usePopper as a}from"react-popper";import{DropShadow as p}from"../../dropShadow/DropShadow.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{OverLapAbs as v,OpenDropdownContainer as m}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const h=n.forwardRef(((n,h)=>{var{children:w,onDropdownVisbilityChange:f,version:b="1.0",tooltipContent:D,tooltipDirection:g,showTooltipArrow:y,isChildLoading:C,forceOpen:j}=n,O=o(n,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow","isChildLoading","forceOpen"]);const S=h,[z,E]=r(!1),[x,A]=r(null),[L,R]=r(null),T=i(null),{styles:M,attributes:V}=a(x,L,{placement:O.placement,strategy:O.strategy}),_=o=>{var e,t;"2.0"===b&&O.isMultiSelect&&o&&(null===(e=O.onSelect)||void 0===e||e.call(O,[...o])),E(!1),null===(t=null==O?void 0:O.onClose)||void 0===t||t.call(O)};d(S,(()=>({openDropdown:z})),[]),s((()=>{(null==S?void 0:S.current)&&(S.current.openDropdown=z)}),[z]),s((()=>{null==f||f(z)}),[z]);const k=()=>l(t,{children:[l("div",{style:{position:"relative"},ref:A,children:[e(v,{ref:T,allowEvents:O.allowEvents,disabled:O.disabled,onClick:o=>{var e;null===(e=O.onDropdownOpen)||void 0===e||e.call(O),z?(E(!1),o.preventDefault()):O.disabled||E(!0)},isChildLoading:C,children:O.allowEvents?w:null}),O.allowEvents?null:w]}),(z||j)&&e(m,Object.assign({ref:R,style:Object.assign(Object.assign({},M.popper),{zIndex:3})},V.popper,{"data-test":O["data-test"],children:e(p,{level:"z2",position:"down",style:{borderRadius:8},children:e(u,Object.assign({},O,{onSelect:o=>{var e;"2.0"===b&&O.isMultiSelect||(null===(e=O.onSelect)||void 0===e||e.call(O,o),E(!1))},onClose:_,version:b,headerRef:T,zeroState:null==O?void 0:O.zeroState}))})}))]});return e(t,{children:z||j||void 0===D?k():e(c,{body:D,placement:g,hideArrow:!y,children:e("div",{"data-test":O["data-test"],children:k()})})})}));h.displayName="DropdownPopover";export{h as DropdownPopover};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{jsx as o,jsxs as e}from"react/jsx-runtime";import r from"../../../assets/icons/horizontal_dots.svg.js";import i from"../../../assets/icons/vertical_dots.svg.js";import t from"styled-components";import{IconButton as s}from"../../icon-button/IconButton.js";import{COLORS as n}from"../../../constants/Theme.js";import{DropdownPopover as a}from"../DropdownPopover/index.js";const d=t.div`
|
|
2
|
-
|
|
2
|
+
:hover {
|
|
3
3
|
background: ${n.surface.subdued};
|
|
4
4
|
}
|
|
5
5
|
position: ${o=>o.isNewTag?"relative":""};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as r,jsxs as l}from"react/jsx-runtime";import n,{useState as t,useRef as i,useImperativeHandle as p,useEffect as d}from"react";import{usePopper as s}from"react-popper";import{DropShadow as c}from"../../dropShadow/DropShadow.js";import{Tooltip as a}from"../../tooltips/Tooltip.js";import{OverLapAbs as m,OpenDropdownContainer as v}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const h=n.forwardRef((n,h)=>{var{children:w,onDropdownVisbilityChange:f,version:b="1.0",tooltipContent:D,tooltipDirection:y,showTooltipArrow:j}=n,g=o(n,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const C=h,[O,S]=t(!1),[x,A]=t(null),[M,R]=t(null),T=i(null),{styles:z,attributes:V}=s(x,M,{placement:g.placement,strategy:g.strategy}),_=o=>{var e,r;g.isMultiSelect&&o&&(null===(e=g.onSelect)||void 0===e||e.call(g,[...o])),S(!1),null===(r=null==g?void 0:g.onClose)||void 0===r||r.call(g)};p(C,()=>({openDropdown:O}),[]),d(()=>{(null==C?void 0:C.current)&&(C.current.openDropdown=O)},[O]),d(()=>{null==f||f(O)},[O]);const k=()=>l(r,{children:[l("div",{style:{position:"relative"},ref:A,children:[e(m,{ref:T,disabled:g.disabled,onClick:o=>{var e;null===(e=g.onDropdownOpen)||void 0===e||e.call(g),O?(S(!1),o.preventDefault()):g.disabled||S(!0)}}),w]}),O&&e(v,Object.assign({ref:R,style:Object.assign(Object.assign({},z.popper),{zIndex:3})},V.popper,{children:e(c,{level:"z2",position:"down",style:{borderRadius:8},children:e(u,Object.assign({},g,{onSelect:o=>{var e;"2.0"===b&&g.isMultiSelect||(null===(e=g.onSelect)||void 0===e||e.call(g,o),S(!1))},onClose:_,version:b,headerRef:T}))})}))]});return e(r,{children:O||void 0===D?k():e(a,{body:D,placement:y,hideArrow:!j,children:e("div",{children:k()})})})});h.displayName="MultilevelDropdownPopover";export{h as MultilevelDropdownPopover};
|
|
1
|
+
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as r,jsxs as l}from"react/jsx-runtime";import n,{useState as t,useRef as i,useImperativeHandle as p,useEffect as d}from"react";import{usePopper as s}from"react-popper";import{DropShadow as c}from"../../dropShadow/DropShadow.js";import{Tooltip as a}from"../../tooltips/Tooltip.js";import{OverLapAbs as m,OpenDropdownContainer as v}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const h=n.forwardRef(((n,h)=>{var{children:w,onDropdownVisbilityChange:f,version:b="1.0",tooltipContent:D,tooltipDirection:y,showTooltipArrow:j}=n,g=o(n,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const C=h,[O,S]=t(!1),[x,A]=t(null),[M,R]=t(null),T=i(null),{styles:z,attributes:V}=s(x,M,{placement:g.placement,strategy:g.strategy}),_=o=>{var e,r;g.isMultiSelect&&o&&(null===(e=g.onSelect)||void 0===e||e.call(g,[...o])),S(!1),null===(r=null==g?void 0:g.onClose)||void 0===r||r.call(g)};p(C,(()=>({openDropdown:O})),[]),d((()=>{(null==C?void 0:C.current)&&(C.current.openDropdown=O)}),[O]),d((()=>{null==f||f(O)}),[O]);const k=()=>l(r,{children:[l("div",{style:{position:"relative"},ref:A,children:[e(m,{ref:T,disabled:g.disabled,onClick:o=>{var e;null===(e=g.onDropdownOpen)||void 0===e||e.call(g),O?(S(!1),o.preventDefault()):g.disabled||S(!0)}}),w]}),O&&e(v,Object.assign({ref:R,style:Object.assign(Object.assign({},z.popper),{zIndex:3})},V.popper,{children:e(c,{level:"z2",position:"down",style:{borderRadius:8},children:e(u,Object.assign({},g,{onSelect:o=>{var e;"2.0"===b&&g.isMultiSelect||(null===(e=g.onSelect)||void 0===e||e.call(g,o),S(!1))},onClose:_,version:b,headerRef:T}))})}))]});return e(r,{children:O||void 0===D?k():e(a,{body:D,placement:y,hideArrow:!j,children:e("div",{children:k()})})})}));h.displayName="MultilevelDropdownPopover";export{h as MultilevelDropdownPopover};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as r}from"react";import{ZeroState as i}from"../../../zeroState/ZeroState.js";import{useOutside as s}from"../../../../hooks/useOutside.js";import{useDropdown as l}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as u}from"./menu/MenuList.js";import{SelectAllMenu as d}from"./menu/SelectAllMenu.js";import p from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as f}from"./OpennedDropdown.styled.js";import{SearchBox as m}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const S=304,g=290,v=
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as r}from"react";import{ZeroState as i}from"../../../zeroState/ZeroState.js";import{useOutside as s}from"../../../../hooks/useOutside.js";import{useDropdown as l}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as u}from"./menu/MenuList.js";import{SelectAllMenu as d}from"./menu/SelectAllMenu.js";import p from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as f}from"./OpennedDropdown.styled.js";import{SearchBox as m}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const S=304,g=290,v=v=>{let{options:w,isSearchable:y,isMultiSelect:j,maxSelections:O,width:x,allowFreeForm:C,height:D,onClose:k,onSelect:L,onSearch:M,version:I,skipSorting:A,headerRef:T,hideSelectAll:E,primaryButtonText:F,onInfiniteScroll:B,onMultiSelectClear:H,onDropdownItemClick:q,buttonOptions:z,isSearchLoading:R,disableSearchOptions:V,disableSearchedOptionExcept:W,useDefaultCursor:Z,containerStyle:$={},zeroState:K}=v;const{dropdownOptions:N,search:P,searchedString:U,searchedOptions:G,onApplyHandler:J,selectAllHandler:Q,onMultiSelectClear:X,onFreeFormSelect:Y,onMultiSelectApply:_,latestDropdownOptionsRef:ee,getSelectedOptions:te,getCurrentSelectionCount:oe}=l(I,w,L,A,j,M,V,W,O),[ne,re]=o(null!=x?x:g),[ie,se]=o(null),[le,ce]=o(-1),ae=n(null),ue=n([]),de=n(null);s(ae,(()=>{if(se(null),j&&"2.0"===I){const e=te(ee.current);null==k||k(e)}else null==k||k(N)}),[T,ue]),r((()=>{const e=setTimeout((()=>{ae.current&&ae.current.focus({preventScroll:!0})}),0);return()=>clearTimeout(e)}),[]);r((()=>{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})(U&&M?G:N);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),ce((e=>{const o=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=de.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(),ce((e=>{const o=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=de.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&&le>=0){e.preventDefault();const o=t[le];o&&(J(Object.assign(Object.assign({},o),{selected:!o.selected})),q&&q(o))}},t=ae.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[le,U,G,N,M,J,q]);const pe=null!=D?D:S,he="number"==typeof pe?y&&j?pe-96:y&&!j||!y&&j?pe-48:pe:pe;r((()=>{const e=null!=x?x:g;if(null===ie)re(e);else if("number"==typeof e)re(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));re(t)}}),[ie]);const fe=[],me=(e=>{if(!j||!O&&0!==O)return e;const t=oe(e)>=O;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})((U&&M?G:N).map((e=>{var t,o;if(U&&!M){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(U.toLowerCase()))&&(fe.push(!U||e.label===U),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(U.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(U.toLowerCase()))?(fe.push(!U||e.label===U),e):null}return e})).filter((e=>null!==e))),be=!!y&&U&&0===me.length;return e(h,{version:I,ref:ae,tabIndex:-1,style:Object.assign(Object.assign({width:ne},$),{outline:"none"}),children:[e("div",{style:{width:ie?"50%":"100%",display:"flex",flexDirection:"column",background:"white"},children:[!!y&&t(m,{onSearch:P,version:I}),me.length||U?e(f,{minHeight:pe,maxHeight:he,ref:de,children:[!!j&&!be&&!E&&t(d,{version:I,options:U&&M?G:N,onSelect:Q}),!C&&be&&t(b,{isLoading:R,height:he,searchedString:U,containerWidth:x}),C&&(be||!!fe.length&&fe.every((e=>!1===e)))&&t(a,{version:I,isMultiSelect:j,onSelect:Y,searchedString:U}),t(u,{onInfiniteScroll:B,onDropdownItemClick:q,version:I,onSelect:J,showDescription:function(e,t){se(e&&t?{title:e,description:t}:null)},isMultiSelect:j,options:me,useDefaultCursor:Z,ref:ue,focusedIndex:le})]}):t("div",{style:{height:pe,display:"flex"},children:t(i,Object.assign({},K,{title:(null==K?void 0:K.title)||"No results found",subTitle:(null==K?void 0:K.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))}),!!j&&!(!me.length&&!U)&&"2.0"!==I&&t(p,{onClear:()=>{X(),null==H||H()},onApply:_,list:U&&M?G:N,buttonText:F,buttonOptions:z})]}),!!ie&&t(c,{title:ie.title,description:ie.description,version:I})]})};export{v as OpenedDropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as
|
|
1
|
+
import{jsx as r,jsxs as t}from"react/jsx-runtime";import{TitleRegular as o,BodySecondary as e}from"../../../../TypographyStyle.js";import{COLORS as i}from"../../../../../constants/Theme.js";import{DescriptionContainer as n}from"./Description.styled.js";const s=s=>{let{title:c,description:l,version:m}=s;return r(n,{version:m,children:t("div",{style:{padding:"2.0"===m?12:24},children:[r(o,{style:{color:i.content.primary,marginBottom:4},children:c}),r(e,{style:{color:i.content.secondary},children:l})]})})};export{s as Description};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as
|
|
1
|
+
import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useState as o}from"react";import{CheckBox as r}from"../../../../checkBox/CheckBox.js";import{ListItem as i}from"../../../../list-item/ListItem.js";import{BodyCaption as n}from"../../../../TypographyStyle.js";import{COLORS as s}from"../../../../../constants/Theme.js";import{FreeFormContainer as c}from"./FreeFormMenu.styled.js";const m=m=>{let{searchedString:l,onSelect:a,isMultiSelect:p,version:f}=m;const[h,u]=o(!1);function d(){u(!h),a(!h)}return e(i,{version:f,onClick:e=>{e.preventDefault(),d()},listItem:{label:l,value:l},leadingIcon:p?e(r,{size:"2.0"===f?"SMALL":"DEFAULT",isChecked:h,onValueChange:d}):e(t,{}),trailingIcon:e(c,{children:e(n,{style:{color:s.content.secondary},children:"Freeform"})})})};export{m as FreeFormMenu};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import n from"../../../../../assets/icons/chevronRight.svg.js";import{forwardRef as i,useState as r}from"react";import l from"styled-components";import{CheckBox as s}from"../../../../checkBox/CheckBox.js";import{ListItem as d}from"../../../../list-item/ListItem.js";import{Tooltip as a}from"../../../../tooltips/Tooltip.js";import{BodyCaption as c}from"../../../../TypographyStyle.js";import{DEFAULT_THEME as p,COLORS as m}from"../../../../../constants/Theme.js";import{FreeFormContainer as u}from"./FreeFormMenu.styled.js";const v=l(d)`
|
|
2
2
|
padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
margin-top: ${e=>"2.0"===e.version?"2px":"0"};
|
|
5
5
|
`,h=l.div`
|
|
6
6
|
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12);
|
|
7
|
-
border-radius: ${
|
|
8
|
-
padding: ${
|
|
7
|
+
border-radius: ${e=>{let{version:o}=e;return"1.0"===o?"0":"8px"}};
|
|
8
|
+
padding: ${e=>{let{version:o}=e;return"1.0"===o?"0":"4px"}};
|
|
9
9
|
min-width: 148px;
|
|
10
|
-
border: ${
|
|
10
|
+
border: ${e=>{let{version:o}=e;return"1.0"===o?`1px solid ${p.colorsV2.stroke.primary}`:"none"}};
|
|
11
11
|
max-height: 248px;
|
|
12
12
|
overflow-y: auto;
|
|
13
|
-
`,g=
|
|
13
|
+
`,g=i(((i,l)=>{let{option:d,isMultiSelect:g,showDescription:b,onSelect:x,last:f,version:y,onDropdownItemClick:I,useDefaultCursor:j,isFocused:C=!1,dataIndex:k=-1}=i;var w;const[T,D]=r(d.selected),F=(e,o)=>{if(!e.children){O(!e.selected);const t=o?Object.assign(Object.assign({},e),{parent:o}):e;null==I||I(t)}},O=e=>{d.disabled||x(Object.assign(Object.assign({},d),{selected:e}))},$=j?{cursor:"default"}:{};return e(o,{children:e(a,{body:"",tooltipContent:d.children?e("div",{style:{backgroundColor:p.colorsV2.surface.standard},ref:l,onMouseEnter:()=>D(!0),onMouseLeave:()=>D(!1),children:e(h,{version:null!=y?y:"2.0",children:d.children.map((o=>{var t;return e(v,{version:y,style:"1.0"!==y&&(null!==(t=null==d?void 0:d.children)&&void 0!==t?t:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),F(o,d)},listItem:{value:o.value,label:o.label},subText:o.subText,leadingIcon:o.leadingIcon||void 0,customComponent:o.customComponent,trailingIcon:o.trailingIcon||void 0,variant:d.disabled?"inactive":o.selected?"selected":"default"},o.value)}))})}):e(o,{}),placement:"right-start",hideArrow:!0,children:e(v,{version:y,style:f?Object.assign({borderBottom:0},$):Object.assign({},$),onClick:e=>{e.preventDefault(),F(d)},onMouseOver:()=>{d.description?b(d.label,d.description):b()},listItem:{value:d.value,label:d.label},subText:d.subText,"data-option-index":k,role:"option",id:`dropdown-option-${k}`,"aria-selected":!!d.selected,leadingIcon:g?t("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8},children:[e(s,{size:"2.0"===y?"SMALL":"DEFAULT",isDisabled:null!==(w=d.disabled)&&void 0!==w&&w,isChecked:!!d.selected,onValueChange:O}),e("div",{style:{marginRight:"-4px"},children:d.leadingIcon})]}):d.leadingIcon?e(o,{children:d.leadingIcon}):void 0,customComponent:d.customComponent,trailingIcon:d.isFreeForm?e(u,{children:e(c,{style:{color:m.content.secondary},children:"Freeform"})}):d.children?e(n,{width:12,height:12}):d.trailingIcon?e(o,{children:d.trailingIcon}):void 0,variant:d.disabled?"inactive":C||d.selected||!g&&T?"selected":"default"})})})}));export{g as MenuItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useCallback as s,useEffect as i}from"react";import{MenuItem as c}from"./MenuItem.js";import{StyledGroupedLabel as l}from"./MenuList.styled.js";const u=r(({options:
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useCallback as s,useEffect as i}from"react";import{MenuItem as c}from"./MenuItem.js";import{StyledGroupedLabel as l}from"./MenuList.styled.js";const u=r(((r,u)=>{let{options:d,isMultiSelect:a,showDescription:p,onSelect:f,version:m,onInfiniteScroll:h,onDropdownItemClick:I,useDefaultCursor:g,focusedIndex:b=-1}=r;const D=o(null),v=o(null),w=s((()=>{D.current&&D.current.disconnect(),D.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==h||h())})),v.current&&D.current.observe(v.current)}),[h]);i((()=>(w(),()=>{D.current&&D.current.disconnect()})),[w,d]);const S=new Map;let C=-1;return d.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(C++,S.set(e,C))}));else{const n=e;n.disabled||(C++,S.set(n,C))}})),e(n,{children:d.map(((n,r)=>{const o=r===d.length-1;if(n.options){const s=n;return t("div",{style:{marginTop:"2.0"===m?2:0},children:[t(l,{version:m,children:[s.leadingIcon?e("span",{style:{marginRight:8},children:s.leadingIcon}):null,s.label]}),s.options.map(((n,t)=>{const o=S.get(n),i=o===b&&!n.disabled;return e(c,{version:m,last:t===s.options.length-1,onSelect:f,showDescription:p,onDropdownItemClick:I,isMultiSelect:a,option:n,useDefaultCursor:g,isFocused:i,dataIndex:o,ref:e=>{u&&"object"==typeof u&&u.current&&e&&e&&e&&e&&(u.current[r]=e)}},`${r}-${t}`)})),o?e("span",{ref:v}):null]},r)}const s=n,i=S.get(s),h=i===b&&!s.disabled;return t("div",{children:[e(c,{version:m,last:o,onSelect:f,showDescription:p,onDropdownItemClick:I,isMultiSelect:a,option:s,useDefaultCursor:g,isFocused:h,dataIndex:i,ref:e=>{u&&"object"==typeof u&&u.current&&e&&(u.current[r]=e)}},r),o?e("span",{ref:v}):null]},r)}))})}));export{u as MenuList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useState as t,useEffect as l}from"react";import{CheckBox as o}from"../../../../checkBox/CheckBox.js";import{ListItem as i}from"../../../../list-item/ListItem.js";const c=
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useState as t,useEffect as l}from"react";import{CheckBox as o}from"../../../../checkBox/CheckBox.js";import{ListItem as i}from"../../../../list-item/ListItem.js";const c=c=>{let{options:r,onSelect:n,version:s}=c;const[a,d]=t("notSelected");function p(){"partiallySelected"===a&&n("notSelected"),"selectAll"===a&&n("notSelected"),"notSelected"===a&&n("selectAll")}return l((()=>{const e=[];r.filter((e=>!e.disabled)).forEach((t=>{t.options?t.options.filter((e=>!e.disabled)).forEach((t=>{e.push(t.selected||!1)})):e.push(t.selected||!1)})),e.every(Boolean)?d("selectAll"):e.filter(Boolean).length>0?d("partiallySelected"):d("notSelected")}),[r]),e(i,{version:s,onClick:e=>{e.preventDefault(),p()},listItem:{label:"Select All",value:"All"},leadingIcon:e("div",{style:{width:18,height:18},children:e(o,{size:"2.0"===s?"SMALL":"DEFAULT",isChecked:"selectAll"===a||"partiallySelected"===a,isPartiallyChecked:"partiallySelected"===a,onValueChange:p})}),variant:"default"})};export{c as SelectAllMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{Button as o}from"../../../../button/Button.js";import{BodySecondary as r}from"../../../../TypographyStyle.js";import{COLORS as n}from"../../../../../constants/Theme.js";import{BottomBarContainer as l}from"./MultiSelectDropdownBottomBar.styled.js";const i=i=>{const{onClear:s,onApply:p,list:y,buttonText:u,buttonOptions:a}=i,{primaryButtonText:c,primaryButtonType:m,secondaryButtonText:d,secondaryButtonType:f}=null!=a?a:{},T=y.reduce((t,e)=>{if(e.options){return t+e.options.filter(t=>!0===t.selected).length}return e.selected?t+1:t},0);return t(l,{style:{justifyContent:"space-between"},children:[e(r,{style:{flex:1,color:n.content.primary},children:T?`${T} selected`:""}),t("div",{style:{flexDirection:"row",display:"flex",gap:12},children:[e(o,{size:"small",buttonType:f||"primary",buttonText:d||"Clear",onClick:s}),e(o,{size:"small",buttonText:c||u||"Apply",buttonType:m||"primary",onClick:()=>{p()}})]})]})};export{i as default};
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{Button as o}from"../../../../button/Button.js";import{BodySecondary as r}from"../../../../TypographyStyle.js";import{COLORS as n}from"../../../../../constants/Theme.js";import{BottomBarContainer as l}from"./MultiSelectDropdownBottomBar.styled.js";const i=i=>{const{onClear:s,onApply:p,list:y,buttonText:u,buttonOptions:a}=i,{primaryButtonText:c,primaryButtonType:m,secondaryButtonText:d,secondaryButtonType:f}=null!=a?a:{},T=y.reduce(((t,e)=>{if(e.options){return t+e.options.filter((t=>!0===t.selected)).length}return e.selected?t+1:t}),0);return t(l,{style:{justifyContent:"space-between"},children:[e(r,{style:{flex:1,color:n.content.primary},children:T?`${T} selected`:""}),t("div",{style:{flexDirection:"row",display:"flex",gap:12},children:[e(o,{size:"small",buttonType:f||"primary",buttonText:d||"Clear",onClick:s}),e(o,{size:"small",buttonText:c||u||"Apply",buttonType:m||"primary",onClick:()=>{p()}})]})]})};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t}from"react";import{IconButton as e}from"../../../../icon-button/IconButton.js";import{Input as n}from"../../../../input/Input.js";import{InputStyleContext as i}from"../../../../input/context/InputStyleProvider.js";import{COLORS as s}from"../../../../../constants/Theme.js";import c from"../../../../../assets/icons/cross.svg.js";import p from"../../../../../assets/icons/search.svg.js";const a=
|
|
1
|
+
import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t}from"react";import{IconButton as e}from"../../../../icon-button/IconButton.js";import{Input as n}from"../../../../input/Input.js";import{InputStyleContext as i}from"../../../../input/context/InputStyleProvider.js";import{COLORS as s}from"../../../../../constants/Theme.js";import c from"../../../../../assets/icons/cross.svg.js";import p from"../../../../../assets/icons/search.svg.js";const a=a=>{let{onSearch:m,version:l}=a;const[h,d]=t(""),[u,f]=t(!1);return o(i.Provider,{value:{InputWrapper:{borderRadius:0,border:0,borderBottom:`${"2.0"===l?.5:1}px solid ${s.stroke.primary}`,padding:""+("2.0"===l?"6px 8px":"14px 16px")},IconHolder:{marginLeft:0},input:{marginLeft:4,minHeight:"100%"}},children:o(n,{noKeyDownChange:!0,skipFocus:!0,placeholder:"Search",variant:"2.0"===l?"small":"default",leftIcon:{icon:()=>o(p,{width:"2.0"===l?18:24,height:"2.0"===l?18:24,color:s.content.placeholder})},rightIcon:{icon:()=>h?o(e,{onClick:()=>{f(!0),m(""),d("")},Icon:c,width:"2.0"===l?18:24,height:"2.0"===l?18:24,iconColor:s.content.placeholder}):o(r,{})},reset:u,onChangeText:o=>{f(!1),d(o),m(o)}})})};export{a as SearchBox};
|