@bikdotai/bik-component-library 0.0.679-8 → 0.0.679-beta.0

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.
Files changed (99) hide show
  1. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  2. package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +0 -5
  3. package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
  4. package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +1 -2
  5. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  6. package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +3 -40
  7. package/dist/cjs/components/data-source-panel/model.d.ts +0 -8
  8. package/dist/cjs/components/discount-modal/DiscountModal.d.ts +0 -2
  9. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  10. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  11. package/dist/cjs/components/dropdown/ChipInput.js +1 -1
  12. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  13. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  14. package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +0 -1
  15. package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
  16. package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +1 -4
  17. package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
  18. package/dist/cjs/components/dropdown/type.d.ts +0 -1
  19. package/dist/cjs/components/input/Input.d.ts +0 -3
  20. package/dist/cjs/components/input/Input.js +1 -1
  21. package/dist/cjs/components/input/Input.styled.d.ts +0 -1
  22. package/dist/cjs/components/input/Input.styled.js +1 -1
  23. package/dist/cjs/components/modals/Modal.d.ts +0 -2
  24. package/dist/cjs/components/modals/Modal.js +1 -1
  25. package/dist/cjs/components/modals/modal.styled.d.ts +0 -6
  26. package/dist/cjs/components/modals/modal.styled.js +1 -1
  27. package/dist/cjs/components/modals/styledModal.d.ts +0 -2
  28. package/dist/cjs/components/modals/styledModal.js +1 -1
  29. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +1 -3
  30. package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
  31. package/dist/cjs/components/product-picker-v2/modal.d.ts +5 -7
  32. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  33. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +3 -5
  34. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  35. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  36. package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
  37. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +1 -3
  38. package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
  39. package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -3
  40. package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
  41. package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -2
  42. package/dist/cjs/components/product-picker-v2/utility.js +1 -1
  43. package/dist/cjs/components/states-modal/StateModalComponent.d.ts +0 -1
  44. package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
  45. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  46. package/dist/cjs/components/zeroState/ZeroState.d.ts +0 -1
  47. package/dist/cjs/components/zeroState/ZeroState.js +1 -1
  48. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  49. package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +0 -5
  50. package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
  51. package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +1 -2
  52. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  53. package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +3 -40
  54. package/dist/esm/components/data-source-panel/model.d.ts +0 -8
  55. package/dist/esm/components/discount-modal/DiscountModal.d.ts +0 -2
  56. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  57. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  58. package/dist/esm/components/dropdown/ChipInput.js +1 -1
  59. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  60. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  61. package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +0 -1
  62. package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
  63. package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +1 -4
  64. package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
  65. package/dist/esm/components/dropdown/type.d.ts +0 -1
  66. package/dist/esm/components/input/Input.d.ts +0 -3
  67. package/dist/esm/components/input/Input.js +1 -1
  68. package/dist/esm/components/input/Input.styled.d.ts +0 -1
  69. package/dist/esm/components/input/Input.styled.js +1 -1
  70. package/dist/esm/components/modals/Modal.d.ts +0 -2
  71. package/dist/esm/components/modals/Modal.js +1 -1
  72. package/dist/esm/components/modals/modal.styled.d.ts +0 -6
  73. package/dist/esm/components/modals/modal.styled.js +1 -1
  74. package/dist/esm/components/modals/styledModal.d.ts +0 -2
  75. package/dist/esm/components/modals/styledModal.js +1 -1
  76. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +1 -3
  77. package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
  78. package/dist/esm/components/product-picker-v2/modal.d.ts +5 -7
  79. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  80. package/dist/esm/components/product-picker-v2/productScreen.d.ts +3 -5
  81. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  82. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  83. package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
  84. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +1 -3
  85. package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
  86. package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -3
  87. package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
  88. package/dist/esm/components/product-picker-v2/utility.d.ts +1 -2
  89. package/dist/esm/components/product-picker-v2/utility.js +1 -1
  90. package/dist/esm/components/states-modal/StateModalComponent.d.ts +0 -1
  91. package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
  92. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  93. package/dist/esm/components/zeroState/ZeroState.d.ts +0 -1
  94. package/dist/esm/components/zeroState/ZeroState.js +5 -5
  95. package/package.json +1 -1
  96. package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.d.ts +0 -8
  97. package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.js +0 -48
  98. package/dist/esm/components/data-source-panel/Modals/DescriptionModal.d.ts +0 -8
  99. package/dist/esm/components/data-source-panel/Modals/DescriptionModal.js +0 -48
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var g=require("@emotion/styled/base"),I=require("react/jsx-runtime"),e=require("../../../../assets/icons/ChartBar.svg.js"),C=require("../../../../assets/icons/maximize.svg.js");require("@amplitude/analytics-browser"),require("../../../../amplitude/model.js");var A=require("../../../../utils/StringUtils.js"),r=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var l=require("react");require("../../../checkBox/CheckBox.styled.js");var i=require("../../../TypographyStyle.js");require("../../../list-item/ListItem.js"),require("../../../pagination/Pagination.js"),require("../../../radioButton/RadioButton.styled.js"),require("react-dom"),require("react-toastify"),require("../../../button/Button.js"),require("../../../toaster/Toaster.styled.js"),require("../../../tooltips/Tooltip.js"),require("../../../spinner/Spinner.js"),require("../../../stepper/Stepper.styled.js"),require("../../../tag/Tag.js");var c=require("../../../icon-button/IconButton.js");require("../../../template-preview/TemplatePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../curtain/CurtainHelper.js"),require("../../../variable-picker-v3/model.js"),require("../../../template-preview/models/TemplateMeta.js"),require("../../../template-preview/models/WhatsAppTemplate.js"),require("../../../template-preview/models/Channels.js"),require("lodash");var s=require("../../../modals/styledModal.js");require("../../../template-preview/models/RCSTemplate.js"),require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.js"),require("../../../template-context-mapper/styles/TemplateAnalyticsStyles.js"),require("../../../template-context-mapper/utils/TemplateConstants.js"),require("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../template-context-mapper/modalElements/Body.js"),require("../../../template-context-mapper/modalElements/Header.js"),require("../../../../_virtual/_tslib.js"),require("../../../zeroState/ZeroState.js"),require("../../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../../input/Input.js"),require("react-bootstrap"),require("../../../floating-action-button/FloatingActionButton.styles.js"),require("../../../image-compress/ImageCompress.js"),require("../../../progress-bar/ProgressBarComponent.js"),require("../../../progress-bar-v2/ProgressBarV2.js"),require("../../../QueryBuilder/QueryBuilder.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js"),require("../../../QueryBuilder/constants/connectorPosition.js"),require("../../../QueryBuilder/constants/connector.js"),require("../../../QueryBuilder/types/QueryBuilder.type.js"),require("../../../dropdown/Dropdown.js"),require("../../../QueryBuilder/components/InputLoader.js"),require("../../../QueryBuilder/components/Connectors/Components/EmojiPicker.js"),require("react-chips"),require("../../../input/ChipInput.styled.js"),require("../../../QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js"),require("../../../QueryBuilder/components/Connectors/Components/IgPicker.js"),require("../../../QueryBuilder/components/Connectors/Components/InTheLast.js"),require("../../../QueryBuilder/components/Connectors/Components/InTwoLast.js"),require("../../../datePicker/DatePickerWrapper.js"),require("../../../QueryBuilder/components/Connectors/Connector.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.styled.js"),require("../../../QueryBuilder/redux/queryBuilder.reducer.js"),require("../../../QueryBuilder/redux/queryBuilderCache.reducer.js"),require("../../../QueryBuilder/types/QueryBuilderOperator.type.js"),require("../../../dropdown/DropdownPopover/index.js"),require("../../../dropdown/ChipDropdown.js"),require("../../../dropdown/MenuItem/MenuItem.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("react-calendar"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../../../../utils/DateUtils.js");var t=require("../utils/calcPercentage.js");require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var a=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../StackedBarChart/StackedBarDistributionChart.js"),require("../StackedBarChart/StackedBarDistributionChart.model.js");var d=require("../VerticalBarGraph/VerticalGraph.js");require("../VerticalBarGraph/FunnelVerticalBarGraph.js"),require("../heatmap/HeatMap.js"),require("../heatmap/HeatMapVertical.js"),require("../VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../../avatar/Avatar.js"),require("../../../avatar/AvatarHelper.js"),require("../../../alerts/Alert.styled.js"),require("../../../alerts/AlertHelper.js"),require("../../../thumbnail/Thumbnail.js"),require("../../../curtain/Curtain.styled.js"),require("../../../switch/Switch.js"),require("../../../plans/SubscriptionPlanStyled.js"),require("../../../plans/SubscriptionPlanSelector.js"),require("../../../plans/SubscriptionPlansCollected.js"),require("../../../tabs/Tabs.js"),require("../../../TablePagination/TablePagination.styled.js"),require("../../../TablePagination/TablePaginationCard.js"),require("../../../states/StateComponent.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditor.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditorHeader.js"),require("../../../card-selection-modal/CardSelectionModal.styled.js"),require("react-image-crop"),require("../../../buttonGroup/ButtonGroupStyle.js"),require("../../../accordion/Accordion.style.js"),require("../../../accordion/AccordionArrow.js"),require("../../../file-uploader/FileUploaderStyle.js"),require("../../../colourInput/ColourInput.styled.js"),require("../../../bik-layout/CommonStyles.js"),require("../../../navigation-hyperlink/NavigationHyperlink.js"),require("../../../bik-layout/SidebarStyles.js"),require("date-fns"),require("react-popper"),require("../../../dropdown/Common.styled.js"),require("../../../custom-date-time/CustomDateTime.styled.js"),require("../../../../node_modules/lodash.debounce/index.js"),require("../../../product-picker/ProductPicker.styled.js"),require("../../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js"),require("../../../discount-modal/type.js"),require("../../../product-picker-v2/modal.js"),require("../../../modals/modal.styled.js"),require("../../../variable-picker-v3/NoResult.js"),require("../../../variable-picker-v3/styles.js"),require("../../../discount-modal/DiscountModal.styled.js"),require("../../../discount-modal/DynamicCoupon/DynamicCoupon.js"),require("../../../country-code-picker/CountryCodePicker.styled.js"),require("../../../carousel/carousel.js"),require("../../../carousel-secondary/CarouselSecondary.js"),require("../../../access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.styles.js"),require("../../../radioList/RadioList.styled.js"),require("../../../checkList/CheckList.styled.js"),require("../../../postPicker/postPicker.js"),require("../../../dropdown-button/DropdownButton.style.js"),require("../../../side-modal/SideModal.style.js"),require("../../../add-variableV2/AddVariableV2.styled.js"),require("../../../SearchFilter/types/SearchFilter.type.js"),require("../../../SearchFilter/components/DatePickerButton.js"),require("../../../SearchFilter/components/DateRangeOnlyButton.js"),require("../../../input-with-vars/InputWithVariables.js"),require("../../../star-rating/StarRating.js"),require("../../../dashboard-review-popup/components/FiveStar.styled.js"),require("../../../dashboard-review-popup/components/Form.styled.js"),require("../../../dashboard-review-popup/components/ZeroState.js"),require("../../../dashboard-review-popup/DashboardReviewPopUp.styled.js"),require("../../../testimonial-card/TestimonialCard.style.js"),require("../../../slider/slider.js"),require("react-slick"),require("../../../carousel-preview/CarouselPreview.style.js"),require("../../../template-preview/RCS/RCSPreview.styled.js"),require("../../../card-selector/CardSelector.styled.js"),require("../../../action-button/ActionButton.styled.js"),require("../../../floating-input-dropdown/FloatingInputDropdown.js"),require("../../../dropdown/MultilevelDropdownPopover/index.js"),require("../../../multi-level-dropdown/MultiLevelDropdown.styled.js"),require("../../../data-source-panel/DataSourceInfoFooter.js"),require("../../../data-source-panel/DataSourcePanel.style.js"),require("../../../data-source-panel/Modals/DescriptionModal.js"),require("../../../data-source-panel/model.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryResponseList.style.js");var n=require("chart.js"),o=require("react-chartjs-2");function u(g){return g&&"object"==typeof g&&"default"in g?g:{default:g}}var b=u(g);n.Chart.register(n.ArcElement,n.Legend);const p=g=>({plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:I=>{var e;if(!I.label)return" 0%";const C=I.dataset.data.reduce(((g,I)=>g+I),0),A=parseFloat((I.raw/C*100).toFixed(1)),{label:r,raw:l}=I,i=null!==(e=null==g?void 0:g.symbol)&&void 0!==e?e:"",c=null==g?void 0:g.isInternationalStore;return[` ${r}`,` ${i}${void 0!==c?c?t.truncateValueForInternationalStore(l):t.truncateValueForIndianStore(l):l} (${A}% of ${i}${void 0!==c?c?t.truncateValueForInternationalStore(C):t.truncateValueForIndianStore(C):C})`]}}}}}),G=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],y=b.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(g=>r.COLORS.surface.standard),";border:1px solid ",(g=>r.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErRThCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgQmFyQ2hhcnRJY29uIGZyb20gJ0BzcmMvYXNzZXRzL2ljb25zL0NoYXJ0QmFyLnN2Zyc7XHJcbmltcG9ydCBNYXhpbWl6ZUljb24gZnJvbSAnQHNyYy9hc3NldHMvaWNvbnMvbWF4aW1pemUuc3ZnJztcclxuaW1wb3J0IHsgU3RyaW5nVXRpbHMgfSBmcm9tIFwiLi4vLi4vLi4vLi4vaW5kZXhcIjtcclxuaW1wb3J0IHsgQXJjRWxlbWVudCwgQ2hhcnQgYXMgQ2hhcnRKUywgTGVnZW5kIH0gZnJvbSAnY2hhcnQuanMnO1xyXG5pbXBvcnQgeyB1c2VFZmZlY3QsIHVzZVN0YXRlIH0gZnJvbSAncmVhY3QnO1xyXG5pbXBvcnQgeyBEb3VnaG51dCB9IGZyb20gJ3JlYWN0LWNoYXJ0anMtMic7XHJcbmltcG9ydCB7IEljb25CdXR0b24gfSBmcm9tIFwiLi4vLi4vLi4vaWNvb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AgICAgICAgZGF0YTogeUF4aXNEYXRhLFxyXG4gICAgICAgIHRpdGxlOiB5QXhpc1RpdGxlICE9PSBudWxsICYmIHlBeGlzVGl0bGUgIT09IHZvaWQgMCA/IHlBeGlzVGl0bGUgOiAnJyxcclxuICAgIH07XHJcbiAgICBjb25zdCBiYXJDaGFydERhdGEgPSB7XHJcbiAgICAgICAgeEF4aXMsXHJcbiAgICAgICAgeUF4aXMsXHJcbiAgICAgICAgYmFyQ29sb3JSR0JBOiB7IHI6IDIxMCwgZzogMTc0LCBiOiAyNTUsIGE6IDEgfSxcclxuICAgIH07XHJcbiAgICByZXR1cm4gYmFyQ2hhcnREYXRhO1xyXG59O1xyXG5jb25zdCBvcHRpb25zID0gKGN1cnJlbmN5UHJvcHMpID0+ICh7XHJcbiAgICBwbHVnaW5zOiB7XHJcbiAgICAgICAgbGVnZW5kOiB7XHJcbiAgICAgICAgICAgIGRpc3BsYXk6IGZhbHNlLFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgdG9vbHRpcDoge1xyXG4gICAgICAgICAgICBlbmFibGVkOiB0cnVlLFxyXG4gICAgICAgICAgICBjYWxsYmFja3M6IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsOiAodG9vbHRpcEl0ZW0pID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgO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W5kZXgpID0+IChPYmplY3QuYXNzaWduKHsgY29sb3I6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdIH0sIHNsaWNlc1trZXldKSkpO1xyXG4gICAgICAgIHNldFNsaWNlc1dpdGhDb2xvcihbLi4udXBkYXRlZFNsaWNlc1dpdGhDb2xvcl0pO1xyXG4gICAgICAgIGlmICh0b3RhbFN1bSA9PT0gMCkge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IFsxMDBdLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFsnI0YwRjBGMCddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogMCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJ1bmNhdGVTbGljZXMgJiYgc2xpY2VzLmxlbmd0aCA+IHRydW5jYXRlU2xpY2VzKSB7XHJcbiAgICAgICAgICAgIGNvbnN0IHRydW5jYXRlZFNsaWNlcyA9IHNsaWNlcy5zbGljZSgwLCB0cnVuY2F0ZVNsaWNlcyk7XHJcbiAgICAgICAgICAgIGNvbnN0IG90aGVyU2xpY2VzID0gc2xpY2VzLnNsaWNlKHRydW5jYXRlU2xpY2VzKTtcclxuICAgICAgICAgICAgY29uc3Qgb3RoZXJDb3VudCA9IG90aGVyU2xpY2VzLnJlZHVjZSgoc3VtLCBzbGljZSkgPT4gc3VtICsgc2xpY2UuY291bnQsIDApO1xyXG4gICAgICAgICAgICB0cnVuY2F0ZWRTbGljZXMucHVzaCh7IG5hbWU6ICdPdGhlcicsIGNvdW50OiBvdGhlckNvdW50IH0pO1xyXG4gICAgICAgICAgICBjb25zdCB0cnVuY2F0ZWREYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZShzbGljZS5uYW1lKSksXHJcbiAgICAgICAgICAgICAgICBkYXRhc2V0czogW1xyXG4gICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UpID0+IHNsaWNlLmNvdW50KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSwgaW5kZXgpID0+IHsgdmFyIF9hOyByZXR1cm4gKF9hID0gc2xpY2UuY29sb3IpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdOyB9KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyQ29sb3I6IFsnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnXSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyV2lkdGg6IDQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlclJhZGl1czogOCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2V0VHJ1bmNhdGVkRGF0YSh0cnVuY2F0ZWREYXRhU2V0KTtcclxuICAgICAgICAgICAgY29uc3QgdHJ1bmNhdGVkU2xpY2VzV2l0aENvbG9yID0gdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UsIGluZGV4KSA9PiAoT2JqZWN0LmFzc2lnbih7IGNvbG9yOiBHUkFQSF9DT0xPUlNbaW5kZX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0sIHsgY2hpbGRyZW46IHRpdGxlIH0pKSksIF9qc3hzKFwiZGl2XCIsIHsgY2hpbGRyZW46IFtzaG93Q29udmVydFRvQmFyQ2hhcnQgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBCYXJDaGFydEljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICA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6IFwiNzUlXCIgfSwgeyBjaGlsZHJlbjogX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IDI0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnc3BhY2UtYmV0d2VlbicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzgwdmgnLFxyXG4gICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogW19qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7IHdpZHRoOiAnNTUlJywgbWFyZ2luTGVmdDogJzQlJyB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdXN0aWZ5Q29udGVudDogJ2NlbnRlcicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6IGRhdGEsIG9wdGlvbnM6IE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucyhjdXJyZW5jeVByb3BzKSksIHsgbWFpbnRhaW5B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YS5iYXJDb2xvclJHQkEgfSkgfSkpIH0pKSldIH0pKTtcclxufTtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9UGllQ2hhcnRBbmFseXRpY3MuanMubWFwIl19 */"));exports.Card=g=>I.jsx(y,Object.assign({style:{padding:24}},{children:g.children})),exports.PieChartAnalytics=g=>{let{title:r,slices:t,size:n,allowChartPopup:u,showConvertToBarChart:b,truncateSlices:y,barChartXAxisTitle:h,barChartYAxisTitle:X,hideTitle:m=!1,currencyProps:B}=g;const[x,j]=l.useState(!1),[Z,H]=l.useState(!1),[N,W]=l.useState([]),[Y,R]=l.useState(),[J,V]=l.useState(),[F,S]=l.useState([]),[v,q]=l.useState(null);return l.useEffect((()=>{const g=t.reduce(((g,I)=>g+I.count),0);let I=[];if(I=Object.keys(t).map(((g,I)=>Object.assign({color:G[I%G.length]},t[g]))),W([...I]),0===g){R({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}],labels:[]})}else{const g={labels:t.map((g=>A.default.capitalizeEachWord(g.name))),datasets:[{data:t.map((g=>g.count)),backgroundColor:t.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};R(g)}if(y&&t.length>y){const g=t.slice(0,y),I=t.slice(y).reduce(((g,I)=>g+I.count),0);g.push({name:"Other",count:I});const e={labels:g.map((g=>A.default.capitalize(g.name))),datasets:[{data:g.map((g=>g.count)),backgroundColor:g.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};V(e);const C=g.map(((g,I)=>Object.assign({color:G[I%G.length]},g)));S(C)}b&&q(((g,I,e)=>({xAxis:{data:g.map((g=>g.name)),title:null!=I?I:""},yAxis:{data:g.map((g=>g.count)),title:null!=e?e:""},barColorRGBA:{r:210,g:174,b:255,a:1}}))(t,h,X))}),[t,y]),Y?I.jsxs(I.Fragment,{children:[I.jsxs("div",Object.assign({style:{display:"flex",justifyContent:m||0===(null==r?void 0:r.length)?"flex-end":"space-between"}},{children:[!m&&r&&I.jsx(i.TitleMedium,Object.assign({style:{marginBottom:16}},{children:r})),I.jsxs("div",{children:[b&&I.jsx(c.IconButton,{Icon:e.default,onClick:()=>{H(!0)}}),u&&I.jsx(c.IconButton,{Icon:C.default,onClick:()=>{j(!0)}})]})]})),I.jsxs("div",Object.assign({className:"row"},{children:[I.jsx("div",Object.assign({className:"col-6 ",style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx("div",Object.assign({style:{width:n,height:n}},{children:I.jsx(o.Doughnut,{data:y?J:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"flex-start"}},{children:I.jsx(a.PieChart,{slices:y?F:N,size:n})}))]})),x&&I.jsx(s.StyledModal,Object.assign({open:x,onClose:()=>j(!1),closeOnOutsideClick:!0,headingTitle:r,width:"75%"},{children:I.jsxs("div",Object.assign({style:{padding:24,display:"flex",justifyContent:"space-between",height:"80vh"}},{children:[I.jsx("div",Object.assign({style:{width:"55%",marginLeft:"4%"}},{children:I.jsx("div",Object.assign({style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx(o.Doughnut,{data:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({style:{width:"30%",height:"100%",overflowY:"auto"}},{children:I.jsx(a.PieChart,{slices:N})}))]}))})),Z&&v&&I.jsx(s.StyledModal,Object.assign({open:Z,onClose:()=>H(!1),closeOnOutsideClick:!0,headingTitle:r,width:"85%"},{children:I.jsx("div",Object.assign({style:{padding:"24px 0"}},{children:I.jsx(d.VerticalGraph,{xAxis:v.xAxis,yAxis:v.yAxis,barColorRGBA:null==v?void 0:v.barColorRGBA})}))}))]}):I.jsx(I.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var g=require("@emotion/styled/base"),I=require("react/jsx-runtime"),e=require("../../../../assets/icons/ChartBar.svg.js"),C=require("../../../../assets/icons/maximize.svg.js");require("@amplitude/analytics-browser"),require("../../../../amplitude/model.js");var A=require("../../../../utils/StringUtils.js"),r=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var l=require("react");require("../../../checkBox/CheckBox.styled.js");var i=require("../../../TypographyStyle.js");require("../../../list-item/ListItem.js"),require("../../../pagination/Pagination.js"),require("../../../radioButton/RadioButton.styled.js"),require("react-dom"),require("react-toastify"),require("../../../button/Button.js"),require("../../../toaster/Toaster.styled.js"),require("../../../tooltips/Tooltip.js"),require("../../../spinner/Spinner.js"),require("../../../stepper/Stepper.styled.js"),require("../../../tag/Tag.js");var c=require("../../../icon-button/IconButton.js");require("../../../template-preview/TemplatePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../curtain/CurtainHelper.js"),require("../../../variable-picker-v3/model.js"),require("../../../template-preview/models/TemplateMeta.js"),require("../../../template-preview/models/WhatsAppTemplate.js"),require("../../../template-preview/models/Channels.js"),require("lodash");var s=require("../../../modals/styledModal.js");require("../../../template-preview/models/RCSTemplate.js"),require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.js"),require("../../../template-context-mapper/styles/TemplateAnalyticsStyles.js"),require("../../../template-context-mapper/utils/TemplateConstants.js"),require("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../template-context-mapper/modalElements/Body.js"),require("../../../template-context-mapper/modalElements/Header.js"),require("../../../../_virtual/_tslib.js"),require("../../../zeroState/ZeroState.js"),require("../../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../../input/Input.js"),require("react-bootstrap"),require("../../../floating-action-button/FloatingActionButton.styles.js"),require("../../../image-compress/ImageCompress.js"),require("../../../progress-bar/ProgressBarComponent.js"),require("../../../progress-bar-v2/ProgressBarV2.js"),require("../../../QueryBuilder/QueryBuilder.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js"),require("../../../QueryBuilder/constants/connectorPosition.js"),require("../../../QueryBuilder/constants/connector.js"),require("../../../QueryBuilder/types/QueryBuilder.type.js"),require("../../../dropdown/Dropdown.js"),require("../../../QueryBuilder/components/InputLoader.js"),require("../../../QueryBuilder/components/Connectors/Components/EmojiPicker.js"),require("react-chips"),require("../../../input/ChipInput.styled.js"),require("../../../QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js"),require("../../../QueryBuilder/components/Connectors/Components/IgPicker.js"),require("../../../QueryBuilder/components/Connectors/Components/InTheLast.js"),require("../../../QueryBuilder/components/Connectors/Components/InTwoLast.js"),require("../../../datePicker/DatePickerWrapper.js"),require("../../../QueryBuilder/components/Connectors/Connector.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.styled.js"),require("../../../QueryBuilder/redux/queryBuilder.reducer.js"),require("../../../QueryBuilder/redux/queryBuilderCache.reducer.js"),require("../../../QueryBuilder/types/QueryBuilderOperator.type.js"),require("../../../dropdown/DropdownPopover/index.js"),require("../../../dropdown/ChipDropdown.js"),require("../../../dropdown/MenuItem/MenuItem.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("react-calendar"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../../../../utils/DateUtils.js");var t=require("../utils/calcPercentage.js");require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var a=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../StackedBarChart/StackedBarDistributionChart.js"),require("../StackedBarChart/StackedBarDistributionChart.model.js");var d=require("../VerticalBarGraph/VerticalGraph.js");require("../VerticalBarGraph/FunnelVerticalBarGraph.js"),require("../heatmap/HeatMap.js"),require("../heatmap/HeatMapVertical.js"),require("../VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../../avatar/Avatar.js"),require("../../../avatar/AvatarHelper.js"),require("../../../alerts/Alert.styled.js"),require("../../../alerts/AlertHelper.js"),require("../../../thumbnail/Thumbnail.js"),require("../../../curtain/Curtain.styled.js"),require("../../../switch/Switch.js"),require("../../../plans/SubscriptionPlanStyled.js"),require("../../../plans/SubscriptionPlanSelector.js"),require("../../../plans/SubscriptionPlansCollected.js"),require("../../../tabs/Tabs.js"),require("../../../TablePagination/TablePagination.styled.js"),require("../../../TablePagination/TablePaginationCard.js"),require("../../../states/StateComponent.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditor.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditorHeader.js"),require("../../../card-selection-modal/CardSelectionModal.styled.js"),require("react-image-crop"),require("../../../buttonGroup/ButtonGroupStyle.js"),require("../../../accordion/Accordion.style.js"),require("../../../accordion/AccordionArrow.js"),require("../../../file-uploader/FileUploaderStyle.js"),require("../../../colourInput/ColourInput.styled.js"),require("../../../bik-layout/CommonStyles.js"),require("../../../navigation-hyperlink/NavigationHyperlink.js"),require("../../../bik-layout/SidebarStyles.js"),require("date-fns"),require("react-popper"),require("../../../dropdown/Common.styled.js"),require("../../../custom-date-time/CustomDateTime.styled.js"),require("../../../../node_modules/lodash.debounce/index.js"),require("../../../product-picker/ProductPicker.styled.js"),require("../../../discount-modal/type.js"),require("../../../product-picker-v2/modal.js"),require("../../../modals/modal.styled.js"),require("../../../variable-picker-v3/NoResult.js"),require("../../../variable-picker-v3/styles.js"),require("../../../discount-modal/DiscountModal.styled.js"),require("../../../discount-modal/DynamicCoupon/DynamicCoupon.js"),require("../../../country-code-picker/CountryCodePicker.styled.js"),require("../../../carousel/carousel.js"),require("../../../carousel-secondary/CarouselSecondary.js"),require("../../../access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.styles.js"),require("../../../radioList/RadioList.styled.js"),require("../../../checkList/CheckList.styled.js"),require("../../../postPicker/postPicker.js"),require("../../../dropdown-button/DropdownButton.style.js"),require("../../../side-modal/SideModal.style.js"),require("../../../add-variableV2/AddVariableV2.styled.js"),require("../../../SearchFilter/types/SearchFilter.type.js"),require("../../../SearchFilter/components/DatePickerButton.js"),require("../../../SearchFilter/components/DateRangeOnlyButton.js"),require("../../../input-with-vars/InputWithVariables.js"),require("../../../star-rating/StarRating.js"),require("../../../dashboard-review-popup/components/FiveStar.styled.js"),require("../../../dashboard-review-popup/components/Form.styled.js"),require("../../../dashboard-review-popup/components/ZeroState.js"),require("../../../dashboard-review-popup/DashboardReviewPopUp.styled.js"),require("../../../testimonial-card/TestimonialCard.style.js"),require("../../../slider/slider.js"),require("react-slick"),require("../../../carousel-preview/CarouselPreview.style.js"),require("../../../template-preview/RCS/RCSPreview.styled.js"),require("../../../card-selector/CardSelector.styled.js"),require("../../../action-button/ActionButton.styled.js"),require("../../../floating-input-dropdown/FloatingInputDropdown.js"),require("../../../dropdown/MultilevelDropdownPopover/index.js"),require("../../../multi-level-dropdown/MultiLevelDropdown.styled.js"),require("../../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js"),require("../../../data-source-panel/DataSourceInfoFooter.js"),require("../../../data-source-panel/DataSourcePanel.style.js"),require("../../../data-source-panel/model.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryResponseList.style.js");var n=require("chart.js"),o=require("react-chartjs-2");function u(g){return g&&"object"==typeof g&&"default"in g?g:{default:g}}var b=u(g);n.Chart.register(n.ArcElement,n.Legend);const p=g=>({plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:I=>{var e;if(!I.label)return" 0%";const C=I.dataset.data.reduce(((g,I)=>g+I),0),A=parseFloat((I.raw/C*100).toFixed(1)),{label:r,raw:l}=I,i=null!==(e=null==g?void 0:g.symbol)&&void 0!==e?e:"",c=null==g?void 0:g.isInternationalStore;return[` ${r}`,` ${i}${void 0!==c?c?t.truncateValueForInternationalStore(l):t.truncateValueForIndianStore(l):l} (${A}% of ${i}${void 0!==c?c?t.truncateValueForInternationalStore(C):t.truncateValueForIndianStore(C):C})`]}}}}}),G=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],y=b.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(g=>r.COLORS.surface.standard),";border:1px solid ",(g=>r.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErRThCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgQmFyQ2hhcnRJY29uIGZyb20gJ0BzcmMvYXNzZXRzL2ljb25zL0NoYXJ0QmFyLnN2Zyc7XHJcbmltcG9ydCBN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xhYmVsOiAodG9vbHRpcEl0ZW0pID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0cnVuY2F0ZVZhbHVlRm9ySW5kaWFuU3RvcmUodG90YWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdG90YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYCAke2xhYmVsfWAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGAgJHtzeW1ib2x9JHt2YWx1ZX0gKCR7cGVyY2VudGFnZX0lIG9mICR7c3ltYm9sfSR7dG90YWxWYWx1ZX0pYCxcclxuICAgICAgICAgICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICB9LFxyXG4gICAgfSxcclxufSk7XHJcbmNvbnN0IEdSQVBIX0NPTE9SUyA9IFtcclxuICAgICcjNUUwN0JCJyxcclxuICAgICcjOUU3N0VEJyxcclxuICAgICcjRDJBRUZGJyxcclxuICAgICcjQ0RFMUZGJyxcclxuICAgICcjOTJBRkZBJyxcclxuICAgICcjMzkzNUUxJyxcclxuXTtcclxuY29uc3QgQ2FydFN0eWxlZCA9IHN0eWxlZC5kaXYgYFxuXHRiYWNrZ3JvdW5kOiA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V0VHJ1bmNhdGVkU2xpY2VzV2l0aENvbG9yXSA9IHVzZVN0YXRlKFtdKTtcclxuICAgIGNvbnN0IFtiYXJDaGFydERhdGEsIHNldEJhckNoYXJ0RGF0YV0gPSB1c2VTdGF0ZShudWxsKTtcclxuICAgIHVzZUVmZmVjdCgoKSA9PiB7XHJcbiAgICAgICAgY29uc3QgdG90YWxTdW0gPSBzbGljZXMucmVkdWNlKChzdW0sIHNsaWNlKSA9PiBzdW0gKyBzbGljZS5jb3VudCwgMCk7XHJcbiAgICAgICAgbGV0IHVwZGF0ZWRTbGljZXNXaXRoQ29sb3IgPSBbXTtcclxuICAgICAgICB1cGRhdGVkU2xpY2VzV2l0aENvbG9yID0gT2JqZWN0LmtleXMoc2xpY2VzKS5tYXAoKGtleSwgaW5kZXgpID0+IChPYmplY3QuYXNzaWduKHsgY29sb3I6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdIH0sIHNsaWNlc1trZXldKSkpO1xyXG4gICAgICAgIHNldFNsaWNlc1dpdGhDb2xvcihbLi4udXBkYXRlZFNsaWNlc1dpdGhDb2xvcl0pO1xyXG4gICAgICAgIGlmICh0b3RhbFN1bSA9PT0gMCkge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IFsxMDBdLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFsnI0YwRjBGMCddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogMCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJ1bmNhdGVTbGljZXMgJiYgc2xpY2VzLmxlbmd0aCA+IHRydW5jYXRlU2xpY2VzKSB7XHJcbiAgICAgICAgICAgIGNvbn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2hpdGUnXSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyV2lkdGg6IDQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlclJhZGl1czogOCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2V0VHJ1bmNhdGVkRGF0YSh0cnVuY2F0ZWREYXRhU2V0KTtcclxuICAgICAgICAgICAgY29uc3QgdHJ1bmNhdGVkU2xpY2VzV2l0aENvbG9yID0gdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UsIGluZGV4KSA9PiAoT2JqZWN0LmFzc2lnbih7IGNvbG9yOiBHUkFQSF9DT0xPUlNbaW5kZXggJSBHUkFQSF9DT0xPUlMubGVuZ3RoXSB9LCBzbGljZSkpKTtcclxuICAgICAgICAgICAgc2V0VHJ1bmNhdGVkU2xpY2VzV2l0aENvbG9yKHRydW5jYXRlZFNsaWNlc1dpdGhDb2xvcik7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChzaG93Q29udmVydFRvQmFyQ2hhcnQpIHtcclxuICAgICAgICAgICAgc2V0QmFyQ2hhcnREYXRhKGNvbnZlcnRUb0JhckNoYXJ0RGF0YShzbGljZXMsIGJhckNoYXJ0WEF4aXNUaXRsZSwgYmFyQ2hhcnRZQXhpc1RpdGxlKSk7XHJcbiAgICAgICAgfVxyXG4gICAgfSwgW3NsaWNlcywgdHJ1bmNhdGVTbGljZXNdKTtcclxuICAgIGlmICghZGF0YSkge1xyXG4gICAgICAgIHJldHVybiBfanN4KF9GcmFnbWVudCwge30pO1xyXG4gICAgfVxyXG4gICAgcmV0dXJuIChfanN4cyhfRnJhZ21lbnQsIHsgY2hpbGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6IGhpZGVUaXRsZSB8fCAodGl0bGUgPT09IG51bGwgfHwgdGl0bGUgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHRpdGxlLmxlbmd0aCkgPT09IDAgPyAnZmxleC1lbmQnIDogJ3NwYWNlLWJldHdlZW4nLFxyXG4gICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBbIWhpZGVUaXRsZSAmJiB0aXRsZSAmJiAoX2pzeChUaXRsZU1lZGl1bSwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IHRpdGxlIH0pKSksIF9qc3hzKFwiZGl2XCIsIHsgY2hpbGRyZW46IFtzaG93Q29udmVydFRvQmFyQ2hhcnQgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBCYXJDaGFydEljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6ICh0cnVuY2F0ZVNsaWNlcyA/IHRydW5jYXRlZERhdGEgOiBkYXRhKSwgb3B0aW9uczogT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zKGN1cnJlbmN5UHJvcHMpKSwgeyBtYWludGFpbkFzcGVjdFJhdGlvOiBzaXplID8gZmFsc2UgOiB0cnVlIH0pIH0pIH0pKSB9KSksIF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNsYXNzTmFtZTogJ2NvbC02Jywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmdMZWZ0OiA0OCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhEaXJlY3Rpb246ICdjb2x1bW4nLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdm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MCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdXN0aWZ5Q29udGVudDogJ2NlbnRlcicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6IGRhdGEsIG9wdGlvbnM6IE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucyhjdXJyZW5jeVByb3BzKSksIHsgbWFpbnRhaW5Bc3BlY3RSYXRpbzogc2l6ZSA/IGZhbHNlIDogdHJ1ZSB9KSB9KSB9KSkgfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMzAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6ICcxMDAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVyZmxvd1k6ICdhdXRvJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogX2pzeChQaWVDaGFydCwgeyBzbGljZXM6IHNsaWNlc1dpdGhDb2xvciB9KSB9KSldIH0pKSB9KSkpLCBzaG93QmFyQ2hhcnQgJiYgYmFyQ2hhcnREYXRhICYmIChfanN4KFN0eWxlZE1vZGFsLCBPYmplY3QuYXNzaWduKHsgb3Blbjogc2hvd0JhckNoYXJ0LCBvbkNsb3NlOiAoKSA9PiBzZXRTaG93QmFyQ2hhcnQoZmFsc2UpLCBjbG9zZU9uT3V0c2lkZUNsaWNrOiB0cnVlLCBoZWFkaW5nVGl0bGU6IHRpdGxlLCB3aWR0aDogXCI4NSVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiAnMjRweCAwJyxcclxuICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goVmVydGljYWxHcmFwaCwgeyB4QXhpczogYmFyQ2hhcnREYXRhLnhBeGlzLCB5QXhpczogYmFyQ2hhcnREYXRhLnlBeGlzLCBiYXJDb2xvclJHQkE6IGJhckNoYXJ0RGF0YSA9PT0gbnVsbCB8fCBiYXJDaGFydERhdGEgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGJhckNoYXJ0RGF0YS5iYXJDb2xvclJHQkEgfSkgfSkpIH0pKSldIH0pKTtcclxufTtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9UGllQ2hhcnRBbmFseXRpY3MuanMubWFwIl19 */"));exports.Card=g=>I.jsx(y,Object.assign({style:{padding:24}},{children:g.children})),exports.PieChartAnalytics=g=>{let{title:r,slices:t,size:n,allowChartPopup:u,showConvertToBarChart:b,truncateSlices:y,barChartXAxisTitle:h,barChartYAxisTitle:X,hideTitle:m=!1,currencyProps:B}=g;const[x,j]=l.useState(!1),[Z,H]=l.useState(!1),[N,W]=l.useState([]),[Y,R]=l.useState(),[J,V]=l.useState(),[F,S]=l.useState([]),[v,w]=l.useState(null);return l.useEffect((()=>{const g=t.reduce(((g,I)=>g+I.count),0);let I=[];if(I=Object.keys(t).map(((g,I)=>Object.assign({color:G[I%G.length]},t[g]))),W([...I]),0===g){R({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}],labels:[]})}else{const g={labels:t.map((g=>A.default.capitalizeEachWord(g.name))),datasets:[{data:t.map((g=>g.count)),backgroundColor:t.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};R(g)}if(y&&t.length>y){const g=t.slice(0,y),I=t.slice(y).reduce(((g,I)=>g+I.count),0);g.push({name:"Other",count:I});const e={labels:g.map((g=>A.default.capitalize(g.name))),datasets:[{data:g.map((g=>g.count)),backgroundColor:g.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};V(e);const C=g.map(((g,I)=>Object.assign({color:G[I%G.length]},g)));S(C)}b&&w(((g,I,e)=>({xAxis:{data:g.map((g=>g.name)),title:null!=I?I:""},yAxis:{data:g.map((g=>g.count)),title:null!=e?e:""},barColorRGBA:{r:210,g:174,b:255,a:1}}))(t,h,X))}),[t,y]),Y?I.jsxs(I.Fragment,{children:[I.jsxs("div",Object.assign({style:{display:"flex",justifyContent:m||0===(null==r?void 0:r.length)?"flex-end":"space-between"}},{children:[!m&&r&&I.jsx(i.TitleMedium,Object.assign({style:{marginBottom:16}},{children:r})),I.jsxs("div",{children:[b&&I.jsx(c.IconButton,{Icon:e.default,onClick:()=>{H(!0)}}),u&&I.jsx(c.IconButton,{Icon:C.default,onClick:()=>{j(!0)}})]})]})),I.jsxs("div",Object.assign({className:"row"},{children:[I.jsx("div",Object.assign({className:"col-6 ",style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx("div",Object.assign({style:{width:n,height:n}},{children:I.jsx(o.Doughnut,{data:y?J:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"flex-start"}},{children:I.jsx(a.PieChart,{slices:y?F:N,size:n})}))]})),x&&I.jsx(s.StyledModal,Object.assign({open:x,onClose:()=>j(!1),closeOnOutsideClick:!0,headingTitle:r,width:"75%"},{children:I.jsxs("div",Object.assign({style:{padding:24,display:"flex",justifyContent:"space-between",height:"80vh"}},{children:[I.jsx("div",Object.assign({style:{width:"55%",marginLeft:"4%"}},{children:I.jsx("div",Object.assign({style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx(o.Doughnut,{data:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({style:{width:"30%",height:"100%",overflowY:"auto"}},{children:I.jsx(a.PieChart,{slices:N})}))]}))})),Z&&v&&I.jsx(s.StyledModal,Object.assign({open:Z,onClose:()=>H(!1),closeOnOutsideClick:!0,headingTitle:r,width:"85%"},{children:I.jsx("div",Object.assign({style:{padding:"24px 0"}},{children:I.jsx(d.VerticalGraph,{xAxis:v.xAxis,yAxis:v.yAxis,barColorRGBA:null==v?void 0:v.barColorRGBA})}))}))]}):I.jsx(I.Fragment,{})};
@@ -10,9 +10,4 @@ export declare const CountryCodePicker: React.FC<{
10
10
  placement?: Placement;
11
11
  placementStrategy?: PositioningStrategy;
12
12
  disabled?: boolean;
13
- hideFlagImage?: boolean;
14
- containerStyles?: React.CSSProperties;
15
- codeColor?: string;
16
- dialColor?: string;
17
- countryTextStyle?: React.CSSProperties;
18
13
  }>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/chevronDown.svg.js"),r=require("react"),t=require("./CountryCodePicker.modal.js"),n=require("./CountryCodePicker.styled.js"),s=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var d=require("../TypographyStyle.js"),i=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");exports.CountryCodePicker=l=>{var c,a,u,p,y,m,j;const[v,h]=r.useState(null!==(c=l.selectedCountry)&&void 0!==c?c:{name:"India",dial:"+91",code:"IN"}),w=`https://flagcdn.com/${null===(a=v.code)||void 0===a?void 0:a.toLowerCase()}.svg`;r.useEffect((()=>{l.selectedCountry&&h(l.selectedCountry)}),[null===(u=l.selectedCountry)||void 0===u?void 0:u.code]);return e.jsx(s.DropdownPopover,Object.assign({version:l.version,isSearchable:!0,width:null!==(p=l.popoverWidth)&&void 0!==p?p:"200px",placement:null!==(y=l.placement)&&void 0!==y?y:"bottom-start",strategy:null!==(m=l.placementStrategy)&&void 0!==m?m:"absolute",options:t.CountriesData.map((o=>{var r,t,s,c;const a=`https://flagcdn.com/${null===(r=o.code)||void 0===r?void 0:r.toLowerCase()}.svg`;return{value:o.code,label:o.dial,searchKey:o.name,customComponent:e.jsxs(n.StyledCountryPickerOption,{children:[!l.hideFlagImage&&e.jsx("img",{src:a,className:"country-flag__option",alt:o.name}),e.jsxs(d.BodySecondary,Object.assign({style:null!==(t=l.countryTextStyle)&&void 0!==t?t:{}},{children:[e.jsx("span",Object.assign({style:{color:null!==(s=l.codeColor)&&void 0!==s?s:i.COLORS.text.primary}},{children:o.code}))," ",e.jsx("span",Object.assign({style:{color:null!==(c=l.dialColor)&&void 0!==c?c:i.COLORS.text.primary}},{children:o.dial}))]}))]}),selected:v.code===o.code}})),disabled:l.disabled,onSelect:e=>{const o=t.CountriesData.filter((o=>o.code===e.value));h(o[0]),l.onCountrySelect(o[0])}},{children:e.jsxs(n.StyledCountryPickerWrapper,Object.assign({height:l.height,style:l.containerStyles},{children:[e.jsxs("div",Object.assign({className:"content__wrapper"},{children:[!l.hideFlagImage&&e.jsx("img",{src:w,className:"country-flag__selected-option",alt:v.name}),e.jsx(d.BodySecondary,Object.assign({style:null!==(j=l.countryTextStyle)&&void 0!==j?j:{}},{children:v.dial}))]})),e.jsx(o.default,{width:24,height:24,color:i.COLORS.content.primary})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/chevronDown.svg.js"),r=require("react"),t=require("./CountryCodePicker.modal.js"),n=require("./CountryCodePicker.styled.js"),s=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var d=require("../TypographyStyle.js"),i=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");exports.CountryCodePicker=c=>{var l,u,a,p,m,j;const[y,w]=r.useState(null!==(l=c.selectedCountry)&&void 0!==l?l:{name:"India",dial:"+91",code:"IN"}),v=`https://flagcdn.com/${null===(u=y.code)||void 0===u?void 0:u.toLowerCase()}.svg`;r.useEffect((()=>{c.selectedCountry&&w(c.selectedCountry)}),[null===(a=c.selectedCountry)||void 0===a?void 0:a.code]);return e.jsx(s.DropdownPopover,Object.assign({version:c.version,isSearchable:!0,width:null!==(p=c.popoverWidth)&&void 0!==p?p:"200px",placement:null!==(m=c.placement)&&void 0!==m?m:"bottom-start",strategy:null!==(j=c.placementStrategy)&&void 0!==j?j:"absolute",options:t.CountriesData.map((o=>{var r;const t=`https://flagcdn.com/${null===(r=o.code)||void 0===r?void 0:r.toLowerCase()}.svg`;return{value:o.code,label:o.dial,searchKey:o.name,customComponent:e.jsxs(n.StyledCountryPickerOption,{children:[e.jsx("img",{src:t,className:"country-flag__option",alt:o.name}),e.jsxs(d.BodySecondary,{children:[o.code," ",o.dial]})]}),selected:y.code===o.code}})),disabled:c.disabled,onSelect:e=>{const o=t.CountriesData.filter((o=>o.code===e.value));w(o[0]),c.onCountrySelect(o[0])}},{children:e.jsxs(n.StyledCountryPickerWrapper,Object.assign({height:c.height},{children:[e.jsxs("div",Object.assign({className:"content__wrapper"},{children:[e.jsx("img",{src:v,className:"country-flag__selected-option",alt:y.name}),e.jsx(d.BodySecondary,{children:y.dial})]})),e.jsx(o.default,{width:24,height:24,color:i.COLORS.content.primary})]}))}))};
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
- import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
3
+ import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource } from './model';
4
4
  export interface DataSourcePanelProps {
5
5
  storeId: string;
6
6
  appType: ApplicationType;
@@ -22,6 +22,5 @@ export interface DataSourcePanelProps {
22
22
  [k in string]: number;
23
23
  }>;
24
24
  fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
25
- productSourceData?: ProductSourceData;
26
25
  }
27
26
  export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),s=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),r=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),j=require("../side-modal/SideModal.js"),y=require("../tag/Tag.js"),m=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),v=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),S=require("./IntentConfig.js"),T=require("./Modals/DescriptionModal.js"),I=require("./model.js"),L=require("../../_virtual/bik-store.js");exports.DataSourcePanel=b=>{var E,w;const{appType:D,storeId:N,messageSource:R,setMessageSourcePanel:_,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:A,ChecklistType:k,title:F,zeroStateButton:P,editableSources:M,preFillTrainingSourceCount:U,redirect:K,footerButtonOption:W,fetchTrainingSourceCount:H,fetchProductFAQCount:$,productSourceData:Q}=b,{sources:Y}=R,G=["blog","article","page","policy"],[X,z]=p.useState(!1),[V,J]=p.useState(!1),[Z,ee]=p.useState(0),[te,ie]=p.useState(),[se,oe]=p.useState(null!=U?U:{}),ne={};S.intentConfig.forEach((t=>{let{key:i,type:s,tagText:o}=t;k[i]&&(ne[k[i]]=e.jsx(y.Tag,{theme:"light",type:s,tagText:o,cursor:"pointer"}))}));const le=Y.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),ae=Y.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),re=p.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{k[t]&&(e[k[t]]=k[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[k]);p.useEffect((()=>{var e,t,i,s;if(!(null==R?void 0:R.messageId))return;z(!0),J(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(s=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.insights));const o=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));$(N,n).then((e=>ee(e))).then((()=>{U?(oe(U),setTimeout((()=>z(!1)),100)):H(N).then((e=>oe(e))).then((()=>{setTimeout((()=>z(!1)),100)}))}))}),[$,H,null==R?void 0:R.messageId,R.sources,U,N]);const de=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=I.CustomDataType.FILES:G.includes(e)?e=I.CustomDataType.FETCHED_LINKS:"url"==e?e=I.CustomDataType.WEBSITE_LINKS:"text"===e?e=I.CustomDataType.TEXTS:"faq"===e&&(e=I.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ue=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",pe=i=>"products"==i||"product"==i?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==i?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==i||"fetched links"==i?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==i?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==i?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}),he=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return X||!B?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsxs(e.Fragment,{children:[e.jsx(f.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!F&&e.jsx(O.TitleSmall,{children:F}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(E=ne[R.intent])&&void 0!==E?E:ne.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>_(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),de(Y)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,i;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(l.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(O.TitleSmall,{children:"Insufficient data"})})),e.jsx(O.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),P&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=P.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(i=P.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{P.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:l.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${D===L.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!de(Y)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[le.length>0&&e.jsxs("div",Object.assign({className:"info-product-source"},{children:[e.jsx(O.BodyCaption,{children:"Product Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:le.map(((t,i)=>{var o,n,l,a;const r=ce(t.type||t.subTitle||"OpenAI"),c=ce(t.type||t.subTitle||"OpenAI",!0),u=ue(r),p=null==M?void 0:M.includes(c),g=A[null!==(o=t.productId)&&void 0!==o?o:"Products"],C=t.title,j=t.productId&&(null==Q?void 0:Q[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==le?void 0:le.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[pe(r),e.jsx(m.Tooltip,Object.assign({body:C,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:C}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:u}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),j&&e.jsxs(O.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;ie({title:C,description:he(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>ie(void 0)})}},{children:`${null===(n=j.description)||void 0===n?void 0:n.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(m.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${i}`)}))}))]})),ae.length>0&&e.jsxs("div",Object.assign({className:"info-content-source"},{children:[e.jsx(O.BodyCaption,{children:"Content Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:ae.map(((t,i)=>{var o,n,l,a,r,c,u,p,g,C,j,y,v,f,S,T,L;const b=ce(t.type||t.subTitle||"OpenAI"),E=ce(t.type||t.subTitle||"OpenAI",!0),w=ue(b),D=null==M?void 0:M.includes(E),N="Products"===t.subTitle?A[null!==(o=t.productId)&&void 0!==o?o:"Products"]:A[null!==(n=t.docId)&&void 0!==n?n:""],R=E.toLowerCase()===(null===(l=I.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=I.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(c=I.CustomDataType.FETCHED_LINKS)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(u=I.CustomDataType.TEXTS)||void 0===u?void 0:u.toLowerCase())?t.title:E.toLowerCase()===(null===(p=I.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):t.intent===k.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(C=null==N?void 0:N.data)||void 0===C?void 0:C.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=I.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(v=I.CustomDataType.WEBSITE_LINKS)||void 0===v?void 0:v.toLowerCase())||E.toLowerCase()===(null===(f=I.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(L=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==L?L:"":t.intent===k.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==ae?void 0:ae.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[pe(b),e.jsx(m.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:he(null!=_?_:"").trim()}))}))]}),`info-${i}`)}))}))]}))]})),V&&!de(Y)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(v.default,{appType:D,storeId:N,messageSource:R,sourceIntent:null!==(w=R.intent)&&void 0!==w?w:k.GENERIC,faqCount:Z,trainingSourceCount:se,ShowTrainingDataSource:re,ChecklistType:k,footerButtonOption:W})}))]})}),te&&e.jsx(j.SideModal,Object.assign({header:"Product description",onClose:()=>ie(void 0),width:"30%"},{children:e.jsx(T.DescriptionModal,{title:te.title,description:te.description,imageUrl:te.imageUrl,onClose:te.onClose})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),r=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),l=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),x=require("../shimmer/ShimmerComponent/BikShimmer.js"),y=require("../tag/Tag.js"),v=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),m=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),O=require("./IntentConfig.js"),S=require("./model.js"),T=require("../../_virtual/bik-store.js");exports.DataSourcePanel=I=>{var L,b;const{appType:E,storeId:w,messageSource:D,setMessageSourcePanel:N,hideCloseButton:_,isSourceInfoFetched:R,allSourceInfoDetail:q,ChecklistType:A,title:B,zeroStateButton:F,editableSources:k,preFillTrainingSourceCount:P,redirect:K,footerButtonOption:M,fetchTrainingSourceCount:U,fetchProductFAQCount:H}=I,{sources:Q}=D,W=["blog","article","page","policy"],[$,Y]=p.useState(!1),[G,X]=p.useState(!1),[z,V]=p.useState(0),[J,Z]=p.useState(null!=P?P:{}),ee={};O.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;A[s]&&(ee[A[s]]=e.jsx(y.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const te=p.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{A[t]&&(e[A[t]]=A[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[A]);p.useEffect((()=>{var e,t,s,i;if(!(null==D?void 0:D.messageId))return;Y(!0),X(!1!==(null===(t=null===(e=D.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=D.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=D.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));H(w,n).then((e=>V(e))).then((()=>{P?(Z(P),setTimeout((()=>Y(!1)),100)):U(w).then((e=>Z(e))).then((()=>{setTimeout((()=>Y(!1)),100)}))}))}),[H,U,null==D?void 0:D.messageId,D.sources,P,w]);const se=e=>!(0!==e.length&&!(null==D?void 0:D.isUnsatisfactoryAnswer)),ie=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=S.CustomDataType.FILES:W.includes(e)?e=S.CustomDataType.FETCHED_LINKS:"url"==e?e=S.CustomDataType.WEBSITE_LINKS:"text"===e?e=S.CustomDataType.TEXTS:"faq"===e&&(e=S.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")},oe=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};return $||!R?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(x.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsx(e.Fragment,{children:e.jsx(f.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!B&&e.jsx(j.TitleSmall,{children:B}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(j.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(L=ee[D.intent])&&void 0!==L?L:ee.GENERIC,!_&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>N(void 0)},{children:e.jsx(s.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),se(Q)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(r.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(j.TitleSmall,{children:"Insufficient data"})})),e.jsx(j.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),F&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=F.leadingIcon)&&void 0!==t?t:l.default,buttonText:null!==(s=F.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{F.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:r.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:D.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${E===T.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!se(Q)&&e.jsx("div",Object.assign({className:"info-container"},{children:e.jsx("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:Q.map(((s,r)=>{var l,p,g,x,y,m,f,O,T,I,L,b,E,w,D,N,_;const R=ie(s.type||s.subTitle||"OpenAI"),B=ie(s.type||s.subTitle||"OpenAI",!0),F=(P=R)?"faq"==P.toLocaleLowerCase()?"FAQ":"openai"==P.toLocaleLowerCase()?"OPENAI":"files"==P.toLocaleLowerCase()?"PDF":"texts"==P.toLocaleLowerCase()?"Custom text":((P=(P=P.charAt(0).toUpperCase()+P.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(P=P.slice(0,-1)),P.replace("Website","Manual")):"";var P;const M=null==k?void 0:k.includes(B),U="Products"===s.subTitle?q[null!==(l=s.productId)&&void 0!==l?l:"Products"]:q[null!==(p=s.docId)&&void 0!==p?p:""],H=B.toLowerCase()===(null===(g=S.CustomDataType.FAQ)||void 0===g?void 0:g.toLowerCase())?"faq"===(null===(x=s.title)||void 0===x?void 0:x.toLowerCase())?s.subTitle:s.title:B.toLowerCase()===(null===(y=S.CustomDataType.FILES)||void 0===y?void 0:y.toLowerCase())||B.toLowerCase()===(null===(m=S.CustomDataType.FETCHED_LINKS)||void 0===m?void 0:m.toLowerCase())||B.toLowerCase()===(null===(f=S.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?s.title:B.toLowerCase()===(null===(O=S.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):s.intent===A.EMAIL_COLLECTION?F:s.title,Q="faq"===B.toLowerCase()?null!==(L=null!==(T=null==U?void 0:U.content)&&void 0!==T?T:null===(I=null==U?void 0:U.data)||void 0===I?void 0:I.answer)&&void 0!==L?L:"":B.toLowerCase()===(null===(b=S.CustomDataType.FETCHED_LINKS)||void 0===b?void 0:b.toLowerCase())||B.toLowerCase()===(null===(E=S.CustomDataType.WEBSITE_LINKS)||void 0===E?void 0:E.toLowerCase())||B.toLowerCase()===(null===(w=S.CustomDataType.TEXTS)||void 0===w?void 0:w.toLowerCase())?null!==(_=null!==(D=null==U?void 0:U.content)&&void 0!==D?D:null===(N=null==U?void 0:U.data)||void 0===N?void 0:N.fileContentText)&&void 0!==_?_:"":s.intent===A.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${h.COLORS.stroke.primary}`}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(v.Tooltip,Object.assign({body:H,placement:"top"},{children:e.jsx(j.BodySecondary,Object.assign({style:B==S.CustomDataType.FETCHED_LINKS||B==S.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>B==S.CustomDataType.FETCHED_LINKS||B==S.CustomDataType.WEBSITE_LINKS?K(s):{}},{children:H}))}))})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==A.EMAIL_COLLECTION&&e.jsxs(e.Fragment,{children:[(W=R,"products"==W||"product"==W?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==W?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==W||"fetched links"==W?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==W?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==W?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary})),e.jsx(j.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:F}))]}),(s.link||s.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:M?e.jsx(C.IconButton,{Icon:i.default,height:16,width:16,bordered:!0,onClick:()=>null==U?void 0:U.onEditClick(U.data,U.type),disabled:!U,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:d.default,height:16,width:16,bordered:!0,disabled:"custom"===s.type&&!U,disabledTooltip:"This source is deleted",onClick:()=>K(s)})}))]}))]})),(null!=Q?Q:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(j.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:oe(null!=Q?Q:"").trim()}))}))]}),`info-${r}`);var W}))}))})),G&&!se(Q)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(m.default,{appType:E,storeId:w,messageSource:D,sourceIntent:null!==(b=D.intent)&&void 0!==b?b:A.GENERIC,faqCount:z,trainingSourceCount:J,ShowTrainingDataSource:te,ChecklistType:A,footerButtonOption:M})}))]})})})};
@@ -1,48 +1,11 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),o=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(e);const l=i.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),o=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e);const l=r.default.div`
2
2
  display: flex;
3
3
  margin: 0px 8px 0px 8px;
4
4
  padding: 20px 0px 20px 0px;
5
5
  flex-direction: column;
6
6
  max-height: calc(100vh - 130px);
7
7
  .info-container {
8
- display: flex;
9
- flex-direction: column;
10
8
  border-radius: 8px;
11
- gap: 12px;
12
- }
13
- .info-content-source {
14
- border-radius: 8px;
15
- display: flex;
16
- flex-direction: column;
17
- gap: 8px;
18
- .source {
19
- border-radius: 12px;
20
- background-color: ${o.COLORS.surface.subdued};
21
- }
22
- }
23
- .info-product-source {
24
- border-radius: 8px;
25
- display: flex;
26
- flex-direction: column;
27
- gap: 8px;
28
-
29
- .product-data-text1 {
30
- padding: 2px;
31
- text-decoration: underline;
32
- color: ${o.COLORS.content.secondary};
33
- cursor: pointer;
34
- &:active {
35
- background-color: ${o.COLORS.surface.hovered};
36
- }
37
- }
38
- .product-data-text2 {
39
- padding: 2px;
40
- color: ${o.COLORS.content.secondary};
41
- }
42
- .source {
43
- border-radius: 12px;
44
- background-color: ${o.COLORS.surface.subdued};
45
- }
46
9
  }
47
10
  .pop-up-header {
48
11
  padding: 6px 8px;
@@ -81,7 +44,7 @@
81
44
  width: 8px;
82
45
  display: block;
83
46
  }
84
- `;i.default.div`
47
+ `;r.default.div`
85
48
  display: flex;
86
49
  margin: 16px 0px 0px 0px;
87
50
  padding: 0px 0px 16px 0px;
@@ -137,7 +100,7 @@
137
100
  -webkit-box-orient: vertical;
138
101
  white-space: pre-line;
139
102
  }
140
- `;const p=i.default.div`
103
+ `;const p=r.default.div`
141
104
  display: flex;
142
105
  flex-direction: column;
143
106
  gap: 8px;
@@ -132,11 +132,3 @@ export interface footerButtonOptionModel {
132
132
  addFaqProps?: any;
133
133
  }) => void;
134
134
  }
135
- export interface ProductSourceData {
136
- [keys: string]: {
137
- description: string;
138
- metafield: string[];
139
- faqs: CustomDataFaqModel[];
140
- onEditFaqClick: (faqs: CustomDataFaqModel[]) => void;
141
- };
142
- }
@@ -1,4 +1,3 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
1
  import React from 'react';
3
2
  import { ICouponData } from "./type";
4
3
  import { Collection, Product } from "../product-picker/type";
@@ -28,7 +27,6 @@ export interface DiscountDialogueI {
28
27
  fetchCollections: any;
29
28
  fetchProducts: any;
30
29
  storeId: string;
31
- appType?: ApplicationType;
32
30
  };
33
31
  errorMsg?: string;
34
32
  loading?: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("react"),i=require("./type.js");require("../dropdown/DropdownPopover/index.js");var o=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var r=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),s=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),u=require("../../assets/icons/percentage_icon.svg.js"),p=require("../../assets/icons/shipping_icon.svg.js"),C=require("../../assets/icons/triangle_error.svg.js"),T=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js"),P=require("../variable-picker-v3/model.js"),E=require("../variable-picker-v3/VariablePicker.js"),I=require("./DiscountModal.styled.js"),O=require("./DiscountUtils.js"),v=require("./DynamicCoupon/DynamicCoupon.js"),_=require("./StaticCoupon/StaticCoupon.js"),b=require("../../_virtual/bik-store.js");exports.DiscountModal=y=>{var D,N,h,m,f,U,A,g,j,R,x;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:y.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsx(u.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:i.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:i.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsx(p.default,{width:24,height:24,color:t})}],[F,k]=t.useState(),[q,L]=t.useState(),[M,Y]=t.useState(),[w,G]=t.useState(null!==(D=y.data)&&void 0!==D?D:"string"==typeof y.hideOption?{isStaticCoupon:"dynamic"===y.hideOption}:{isStaticCoupon:!0}),[B,X]=t.useState(!0),[Q,H]=t.useState(),[z,K]=t.useState((null===(N=y.data)||void 0===N?void 0:N.minAmount)?i.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(h=y.data)||void 0===h?void 0:h.minQuantity)?i.MIN_PURCHASE_REQUIREMENT.QUANTITY:i.MIN_PURCHASE_REQUIREMENT.NA),[$,Z]=t.useState(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[J,W]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ee,te]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ie,oe]=t.useState(void 0),[ne,le]=t.useState(void 0),[re,ae]=t.useState(void 0),[de,se]=t.useState(void 0),[ce,ue]=t.useState(void 0),[pe,Ce]=t.useState(void 0),[Te,Se]=t.useState(0),[Pe,Ee]=t.useState(""),[Ie,Oe]=t.useState(V[0]),[ve,_e]=t.useState(!1),[be,ye]=t.useState(i.initialStaticCouponErrorState),[De,Ne]=t.useState(i.initialDynamicCouponErrorState),[he,me]=t.useState(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),fe=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:Q===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:Q===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:Q===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:Q===i.DISCOUNT_TYPES.FREE_SHIPPING}];t.useEffect((()=>{y.makeExpiryMandatory&&_e(!0)}),[y.makeExpiryMandatory]),t.useEffect((()=>{var e,t,o,n,l,r,a,d;let s;const{tempCouponData:c,discountType:u}=Ue();H(u);const p=(e,t)=>{Oe(c.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},C=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==c?void 0:c.expireAfter)||(null==c?void 0:c.expireAt))&&(_e(!0),(null==c?void 0:c.expireAt)&&me(i.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==c?void 0:c.expireAfter)&&me(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),u){case i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),Z(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=c.entitledCollectionIds)||void 0===e?void 0:e.length)?Z(i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=c.entitledProductIds)||void 0===t?void 0:t.length)||(null===(o=c.productVariableConf)||void 0===o?void 0:o.entitledProductVariable)?(Z(i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(n=c.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,se)):Z(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=c.entitledCollectionIds)||void 0===l?void 0:l.length)?te(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(te(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(r=c.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,se)),(null===(a=c.prerequisiteCollectionIds)||void 0===a?void 0:a.length)?W(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(W(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(d=c.productVariableConf)||void 0===d?void 0:d.prerequisiteProductVariable,ue));break;case i.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}G(Object.assign({},c)),y.hideProbability||(s=je()),X(O.validateDiscountData(c,z,u,y.hideProbability||!1,s,!!c.isStaticCoupon)),y.hideProbability||je()}),[]),t.useEffect((()=>{let e;y.hideProbability||(e=je()),X(O.validateDiscountData(w,z,Q,y.hideProbability||!1,e,!!w.isStaticCoupon))}),[w,Te,Q,z]),t.useEffect((()=>{var e,t,i,o,n,l,r;if(!y.newPickerConf&&((null===(e=y.products)||void 0===e?void 0:e.length)||(null===(t=y.collection)||void 0===t?void 0:t.length))){if(y.products&&(null===(i=y.products)||void 0===i?void 0:i.length)){if(null===(o=y.data)||void 0===o?void 0:o.entitledProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));le(e)}if(null===(n=y.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));oe(e)}}if(y.collection&&y.collection.length){if(null===(l=y.data)||void 0===l?void 0:l.entitledCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));Ce(e)}if(null===(r=y.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ae(e)}}}}),[y.products,y.collection]),t.useEffect((()=>{var e,t,i,o,n,l,r,a;(null===(t=null===(e=y.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&le(y.data.productsConf.entitledProducts),(null===(o=null===(i=y.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&oe(y.data.productsConf.prerequisiteProducts),(null===(l=null===(n=y.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&Ce(y.data.collectionsConf.entitledCollections),(null===(a=null===(r=y.data)||void 0===r?void 0:r.collectionsConf)||void 0===a?void 0:a.prerequisiteCollections)&&ae(y.data.collectionsConf.prerequisiteCollections)}),[null===(m=y.data)||void 0===m?void 0:m.productsConf,null===(f=y.data)||void 0===f?void 0:f.collectionsConf]),t.useEffect((()=>{if(!ne)return;if(y.newPickerConf){const e=[];return Object.values(ne).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}const e=ne.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}),[ne]),t.useEffect((()=>{if(!ie)return;if(y.newPickerConf){const e=[];return Object.values(ie).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}const e=ie.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}),[ie]),t.useEffect((()=>{if(!pe)return;if(y.newPickerConf){(null==pe?void 0:pe.isCustom)&&delete pe.isCustom;const e=Object.keys(pe).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}const e=pe.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}),[pe]),t.useEffect((()=>{if(!re)return;if(y.newPickerConf){(null==re?void 0:re.isCustom)&&delete re.isCustom;const e=Object.keys(re).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}const e=re.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}),[re]);const Ue=()=>{var e,t;let o,n=w;return w.isStaticCoupon||(w.targetType===i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?o=i.DISCOUNT_TYPES.FREE_SHIPPING:w.targetType===i.DISCOUNT_TARGET_TYPES.LINE_ITEM?o=w.targetSelection===i.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=w.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=w.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||w.prerequisiteQuantity||w.entitledQuantity?i.DISCOUNT_TYPES.BUY_X_GET_Y:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),o=i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:n}},Ae=()=>{ye(i.initialStaticCouponErrorState),Ne(i.initialDynamicCouponErrorState)},ge=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=w.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":w.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Ee(n>1?"Please add discount details":o),!0)},je=()=>{if(!y.quadrant||!y.probability)return;const e=[...y.probability];let t=[];e.length>=y.quadrant&&e.splice(y.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(w.probability||0);return Se(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},Re=e=>{var t,o,n,l,r,a,d,s,c,u,p,C,T,S,P,E;const I=e.value;H(I),oe([]),le([]),ae([]),Ce([]),I===i.DISCOUNT_TYPES.FREE_SHIPPING?G({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(t=w.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(o=w.expireAfter)&&void 0!==o?o:void 0,probability:w.probability,minQuantity:null!==(n=w.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=w.minAmount)&&void 0!==l?l:void 0}):I===i.DISCOUNT_TYPES.BUY_X_GET_Y?G({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(r=w.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(a=w.expireAfter)&&void 0!==a?a:void 0,probability:w.probability,minQuantity:void 0,minAmount:void 0}):I===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?G({targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(d=w.valueType)&&void 0!==d?d:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(s=w.expireAt)&&void 0!==s?s:void 0,expireAfter:null!==(c=w.expireAfter)&&void 0!==c?c:void 0,probability:w.probability,value:w.value,minQuantity:null!==(u=w.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=w.minAmount)&&void 0!==p?p:void 0}):I===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&G({targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(C=w.valueType)&&void 0!==C?C:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(T=w.expireAt)&&void 0!==T?T:void 0,expireAfter:null!==(S=w.expireAfter)&&void 0!==S?S:void 0,probability:w.probability,value:w.value,minQuantity:null!==(P=w.minQuantity)&&void 0!==P?P:void 0,minAmount:null!==(E=w.minAmount)&&void 0!==E?E:void 0})},xe=t=>t&&e.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:T.default});return e.jsxs(r.StyledModal,Object.assign({width:(M||F)&&y.newPickerConf?"25px":"640px",open:y.isOpen,hideCrossButton:!!q,headingTitle:F?"Select Products":y.title,headingSubtitle:F?void 0:y.subTitle,footerLeftCustomElement:Pe?xe(Pe):y.errorMsg?xe(y.errorMsg):!y.quadrant||y.hideProbability?e.jsx(e.Fragment,{}):Te<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Te}`,type:"white"}):e.jsx(s.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Te}`,type:"negative",LeadingIcon:C.default})})})),headerRightCustomElement:y.allowStaticCoupon||F?void 0:e.jsx(o.Dropdown,{options:fe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Re(e)}}),onClose:y.onClose,footerContainerStyle:{borderTop:`1px solid ${l.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:F?{buttonType:"primary",onClick:()=>{k(void 0)},buttonText:"Add"}:M?{buttonType:"primary",onClick:()=>{Y(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(U=y.loading)&&void 0!==U&&U,onClick:()=>{var e,t,o,n,l;if(Ae(),w.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=w,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!y.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(ge(r))return void ye(r);if(B||Te>1)return void Ee(!y.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:w.title})}else{const r={invalidCouponTitle:!w.title,inValidProbability:!y.hideProbability&&(null!==(e=w.probability)&&void 0!==e?e:-1)<=0||(null!==(t=w.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(o=w.probability)&&void 0!==o?o:-1),inValidDiscountAmount:!w.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(Q!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&z!==i.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=w;r.inValidMinimumAmount=z===i.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=z===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(ve&&(r.inValidCouponExpiry=!w.expireAt&&!w.expireAfter),Q!==i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&Q!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||de||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidCollectionSelection=!0)),Q===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(w.prerequisiteQuantity||(r.inValidBuyXValue=!0),w.entitledQuantity||(r.inValidGetYValue=!0),J!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ie||Object.keys(ie).length||ce||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),J===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&re&&!Object.keys(re).length&&(r.inValidBuyXCollectionSelection=!0),ee!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||de||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),ee===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidGetYCollectionSelection=!0)),ge(r))return void Ne(r);if(B||Te>1)return void Ee(!y.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked(Object.assign(Object.assign({},w),{description:O.descriptionBuilder(w,y.currency,null!==(n=y.products)&&void 0!==n?n:[],null!==(l=y.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[]},collectionsConf:{entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[]},productVariableConf:{entitledProductVariable:null!=de?de:{},prerequisiteProductVariable:null!=ce?ce:{}}}))}}},secondaryButton:F?{buttonType:"tertiaryGray",onClick:()=>{k(void 0)},buttonText:"Back"}:M?{buttonType:"tertiaryGray",onClick:()=>{Y(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:y.onClose,buttonText:"Cancel"}},{children:[!F&&!M&&e.jsxs(I.StyledDiscountDialogueContainer,{children:[y.allowStaticCoupon&&!F&&e.jsxs(I.CouponTypeContainerStyled,Object.assign({selectedDiv:w.isStaticCoupon?1:2},{children:["static"===y.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{w.isStaticCoupon||(G({isStaticCoupon:!0,quadrant:w.quadrant}),Ee(""),Ae())}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?l.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsx(n.BodyCaption,Object.assign({style:w.isStaticCoupon?{color:l.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===y.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;w.isStaticCoupon&&(H(i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),G({isStaticCoupon:!1,quadrant:w.quadrant,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Ee(""),Ae(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:y.currency||""}))}),_e(null!==(t=y.makeExpiryMandatory)&&void 0!==t&&t),K(i.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?void 0:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsx(n.BodyCaption,Object.assign({style:w.isStaticCoupon?{}:{color:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e.jsx(n.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),w.isStaticCoupon&&!F&&e.jsx(_.default,{discountData:w,setDiscountData:G,hideProbability:y.hideProbability||!1,discountAdminUrl:y.discountAdminUrl,staticDiscountValidationError:be,currency:y.currency}),!w.isStaticCoupon&&!F&&!M&&e.jsx(v.default,{currency:y.currency,entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[],setEntitledProducts:le,setPrerequisiteProducts:oe,discountData:w,productPickerOpen:F,productVariablePickerOpen:q,setIsProductPickerOpen:k,setIsProductVariablePickerOpen:L,setDiscountData:G,selectedCouponType:Q,setSelectedCouponType:H,selectedMinimumRequirement:z,setSelectedMinimumRequirement:K,discountCouponAppliesTo:$,offerAppliesToBuy:J,offerAppliesToGet:ee,setDiscountCouponAppliesTo:Z,setOfferAppliesToBuy:W,setOfferAppliesToGet:te,hideProbability:y.hideProbability||!1,hideExpiration:y.hideExpiration||!1,allowStaticCoupon:y.allowStaticCoupon,onChangeCouponType:Re,collectionPickerOpen:M,entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[],setIsCollectionPickerOpen:Y,setEntitledCollections:Ce,setPrerequisiteCollections:ae,useNewPicker:!!y.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Ie,isProductVariableSupported:y.isProductVariableSupported,entitledProductVariable:de,setEntitledProductVariable:se,preRequisiteProductVariable:ce,setPreRequisiteProductVariable:ue,productVariableList:y.productVariableList,isAddExpirationChecked:ve,setIsAddExpirationChecked:_e,dynamicDiscountValidationError:De,setDynamicDiscountValidationError:Ne,setValidationErrorMessage:Ee,resetValidationErrors:Ae,discountDetailsOptions:V,selectedExpiration:he,setSelectedExpiration:me,makeExpiryMandatory:!!y.makeExpiryMandatory})]}),!!F&&e.jsxs(e.Fragment,{children:[!y.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(A=y.products)&&void 0!==A?A:[],title:"Select Products",onClose:()=>{k(void 0)},selectedProducts:null!==(g=F===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie)&&void 0!==g?g:[],setSelectedProducts:F===v.DISCOUNT_PRODUCTS.ENTITLED?le:oe,onSearchKeyChange:y.onProductSearch})})),y.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>k(void 0),collectionFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.fetchCollections)?y.newPickerConf.fetchCollections(e,t,!1,i):null},productFetcher:(e,t,i,o,n)=>{var l;return(null===(l=y.newPickerConf)||void 0===l?void 0:l.fetchProducts)?y.newPickerConf.fetchProducts(e,t,o,n,!1,i):null},selectedItems:F===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onAdd:e=>{F===v.DISCOUNT_PRODUCTS.ENTITLED?le(e):oe(e),k(void 0)},zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||b.__exports.ApplicationType.BIK,searchInCollectionFetcher:(e,t,i,o)=>{var n;return(null===(n=y.newPickerConf)||void 0===n?void 0:n.searchInCollection)?y.newPickerConf.searchInCollection(e,t,i,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.searchProducts)?y.newPickerConf.searchProducts(e,t,!1,i):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!M&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[y.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>Y(void 0),collectionFetcher:y.newPickerConf.fetchCollections,productFetcher:y.newPickerConf.fetchProducts,selectedItems:M===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),M===v.DISCOUNT_PRODUCTS.ENTITLED?Ce(e):ae(e),Y(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||b.__exports.ApplicationType.BIK,searchInCollectionFetcher:y.newPickerConf.searchInCollection,searchFetcher:y.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!y.newPickerConf&&e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(j=y.collection)&&void 0!==j?j:[],title:"Select Products",onClose:()=>{Y(void 0)},selectedProducts:null!==(R=M===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re)&&void 0!==R?R:[],setSelectedProducts:M===v.DISCOUNT_PRODUCTS.ENTITLED?Ce:ae,onSearchKeyChange:y.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsx(I.VariablePickerContainer,{children:e.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsx(E.VariablePicker,{type:P.PickerType.EMBEDDED,data:null!==(x=y.productVariableList)&&void 0!==x?x:[],showHeader:!0,onSelect:e=>{if(q===v.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;se({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===v.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ue({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("./type.js");require("../dropdown/DropdownPopover/index.js");var o=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var r=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),s=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),u=require("../../assets/icons/percentage_icon.svg.js"),p=require("../../assets/icons/shipping_icon.svg.js"),T=require("../../assets/icons/triangle_error.svg.js"),C=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js"),E=require("../variable-picker-v3/model.js"),P=require("../variable-picker-v3/VariablePicker.js"),O=require("./DiscountModal.styled.js"),I=require("./DiscountUtils.js"),v=require("./DynamicCoupon/DynamicCoupon.js"),_=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=b=>{var y,D,N,m,h,U,f,A,g,j,R;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:b.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsx(u.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:i.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:i.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsx(p.default,{width:24,height:24,color:t})}],[x,F]=t.useState(),[q,L]=t.useState(),[k,M]=t.useState(),[Y,w]=t.useState(null!==(y=b.data)&&void 0!==y?y:"string"==typeof b.hideOption?{isStaticCoupon:"dynamic"===b.hideOption}:{isStaticCoupon:!0}),[G,B]=t.useState(!0),[X,Q]=t.useState(),[H,z]=t.useState((null===(D=b.data)||void 0===D?void 0:D.minAmount)?i.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(N=b.data)||void 0===N?void 0:N.minQuantity)?i.MIN_PURCHASE_REQUIREMENT.QUANTITY:i.MIN_PURCHASE_REQUIREMENT.NA),[$,K]=t.useState(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[Z,J]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[W,ee]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[te,ie]=t.useState(void 0),[oe,ne]=t.useState(void 0),[le,re]=t.useState(void 0),[ae,de]=t.useState(void 0),[se,ce]=t.useState(void 0),[ue,pe]=t.useState(void 0),[Te,Ce]=t.useState(0),[Se,Ee]=t.useState(""),[Pe,Oe]=t.useState(V[0]),[Ie,ve]=t.useState(!1),[_e,be]=t.useState(i.initialStaticCouponErrorState),[ye,De]=t.useState(i.initialDynamicCouponErrorState),[Ne,me]=t.useState(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),he=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:X===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:X===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:X===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:X===i.DISCOUNT_TYPES.FREE_SHIPPING}];t.useEffect((()=>{b.makeExpiryMandatory&&ve(!0)}),[b.makeExpiryMandatory]),t.useEffect((()=>{var e,t,o,n,l,r,a,d;let s;const{tempCouponData:c,discountType:u}=Ue();Q(u);const p=(e,t)=>{Oe(c.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},T=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==c?void 0:c.expireAfter)||(null==c?void 0:c.expireAt))&&(ve(!0),(null==c?void 0:c.expireAt)&&me(i.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==c?void 0:c.expireAfter)&&me(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),u){case i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),K(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=c.entitledCollectionIds)||void 0===e?void 0:e.length)?K(i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=c.entitledProductIds)||void 0===t?void 0:t.length)||(null===(o=c.productVariableConf)||void 0===o?void 0:o.entitledProductVariable)?(K(i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(n=c.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,de)):K(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=c.entitledCollectionIds)||void 0===l?void 0:l.length)?ee(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(ee(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(r=c.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,de)),(null===(a=c.prerequisiteCollectionIds)||void 0===a?void 0:a.length)?J(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(J(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(d=c.productVariableConf)||void 0===d?void 0:d.prerequisiteProductVariable,ce));break;case i.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}w(Object.assign({},c)),b.hideProbability||(s=ge()),B(I.validateDiscountData(c,H,u,b.hideProbability||!1,s,!!c.isStaticCoupon)),b.hideProbability||ge()}),[]),t.useEffect((()=>{let e;b.hideProbability||(e=ge()),B(I.validateDiscountData(Y,H,X,b.hideProbability||!1,e,!!Y.isStaticCoupon))}),[Y,Te,X,H]),t.useEffect((()=>{var e,t,i,o,n,l,r;if(!b.newPickerConf&&((null===(e=b.products)||void 0===e?void 0:e.length)||(null===(t=b.collection)||void 0===t?void 0:t.length))){if(b.products&&(null===(i=b.products)||void 0===i?void 0:i.length)){if(null===(o=b.data)||void 0===o?void 0:o.entitledProductIds){const e=b.products.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ne(e)}if(null===(n=b.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=b.products.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ie(e)}}if(b.collection&&b.collection.length){if(null===(l=b.data)||void 0===l?void 0:l.entitledCollectionIds){const e=b.collection.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));pe(e)}if(null===(r=b.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=b.collection.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));re(e)}}}}),[b.products,b.collection]),t.useEffect((()=>{var e,t,i,o,n,l,r,a;(null===(t=null===(e=b.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&ne(b.data.productsConf.entitledProducts),(null===(o=null===(i=b.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&ie(b.data.productsConf.prerequisiteProducts),(null===(l=null===(n=b.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&pe(b.data.collectionsConf.entitledCollections),(null===(a=null===(r=b.data)||void 0===r?void 0:r.collectionsConf)||void 0===a?void 0:a.prerequisiteCollections)&&re(b.data.collectionsConf.prerequisiteCollections)}),[null===(m=b.data)||void 0===m?void 0:m.productsConf,null===(h=b.data)||void 0===h?void 0:h.collectionsConf]),t.useEffect((()=>{if(!oe)return;if(b.newPickerConf){const e=[];return Object.values(oe).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void w(Object.assign(Object.assign({},Y),{entitledProductIds:e}))}const e=oe.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{entitledProductIds:e}))}),[oe]),t.useEffect((()=>{if(!te)return;if(b.newPickerConf){const e=[];return Object.values(te).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void w(Object.assign(Object.assign({},Y),{prerequisiteProductIds:e}))}const e=te.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{prerequisiteProductIds:e}))}),[te]),t.useEffect((()=>{if(!ue)return;if(b.newPickerConf){(null==ue?void 0:ue.isCustom)&&delete ue.isCustom;const e=Object.keys(ue).map((e=>parseInt(e)));return void w(Object.assign(Object.assign({},Y),{entitledCollectionIds:e}))}const e=ue.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{entitledCollectionIds:e}))}),[ue]),t.useEffect((()=>{if(!le)return;if(b.newPickerConf){(null==le?void 0:le.isCustom)&&delete le.isCustom;const e=Object.keys(le).map((e=>parseInt(e)));return void w(Object.assign(Object.assign({},Y),{prerequisiteCollectionIds:e}))}const e=le.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{prerequisiteCollectionIds:e}))}),[le]);const Ue=()=>{var e,t;let o,n=Y;return Y.isStaticCoupon||(Y.targetType===i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?o=i.DISCOUNT_TYPES.FREE_SHIPPING:Y.targetType===i.DISCOUNT_TARGET_TYPES.LINE_ITEM?o=Y.targetSelection===i.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=Y.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=Y.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||Y.prerequisiteQuantity||Y.entitledQuantity?i.DISCOUNT_TYPES.BUY_X_GET_Y:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),o=i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:n}},fe=()=>{be(i.initialStaticCouponErrorState),De(i.initialDynamicCouponErrorState)},Ae=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=Y.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":Y.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Ee(n>1?"Please add discount details":o),!0)},ge=()=>{if(!b.quadrant||!b.probability)return;const e=[...b.probability];let t=[];e.length>=b.quadrant&&e.splice(b.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(Y.probability||0);return Ce(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},je=e=>{var t,o,n,l,r,a,d,s,c,u,p,T,C,S,E,P;const O=e.value;Q(O),ie([]),ne([]),re([]),pe([]),O===i.DISCOUNT_TYPES.FREE_SHIPPING?w({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(t=Y.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(o=Y.expireAfter)&&void 0!==o?o:void 0,probability:Y.probability,minQuantity:null!==(n=Y.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=Y.minAmount)&&void 0!==l?l:void 0}):O===i.DISCOUNT_TYPES.BUY_X_GET_Y?w({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(r=Y.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(a=Y.expireAfter)&&void 0!==a?a:void 0,probability:Y.probability,minQuantity:void 0,minAmount:void 0}):O===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?w({targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(d=Y.valueType)&&void 0!==d?d:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(s=Y.expireAt)&&void 0!==s?s:void 0,expireAfter:null!==(c=Y.expireAfter)&&void 0!==c?c:void 0,probability:Y.probability,value:Y.value,minQuantity:null!==(u=Y.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=Y.minAmount)&&void 0!==p?p:void 0}):O===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&w({targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(T=Y.valueType)&&void 0!==T?T:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(C=Y.expireAt)&&void 0!==C?C:void 0,expireAfter:null!==(S=Y.expireAfter)&&void 0!==S?S:void 0,probability:Y.probability,value:Y.value,minQuantity:null!==(E=Y.minQuantity)&&void 0!==E?E:void 0,minAmount:null!==(P=Y.minAmount)&&void 0!==P?P:void 0})},Re=t=>t&&e.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:C.default});return e.jsxs(r.StyledModal,Object.assign({width:(k||x)&&b.newPickerConf?"25px":"640px",open:b.isOpen,hideCrossButton:!!q,headingTitle:x?"Select Products":b.title,headingSubtitle:x?void 0:b.subTitle,footerLeftCustomElement:Se?Re(Se):b.errorMsg?Re(b.errorMsg):!b.quadrant||b.hideProbability?e.jsx(e.Fragment,{}):Te<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Te}`,type:"white"}):e.jsx(s.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Te}`,type:"negative",LeadingIcon:T.default})})})),headerRightCustomElement:b.allowStaticCoupon||x?void 0:e.jsx(o.Dropdown,{options:he,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{je(e)}}),onClose:b.onClose,footerContainerStyle:{borderTop:`1px solid ${l.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:x?{buttonType:"primary",onClick:()=>{F(void 0)},buttonText:"Add"}:k?{buttonType:"primary",onClick:()=>{M(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(U=b.loading)&&void 0!==U&&U,onClick:()=>{var e,t,o,n,l;if(fe(),Y.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=Y,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!b.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(Ae(r))return void be(r);if(G||Te>1)return void Ee(!b.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");b.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:Y.title})}else{const r={invalidCouponTitle:!Y.title,inValidProbability:!b.hideProbability&&(null!==(e=Y.probability)&&void 0!==e?e:-1)<=0||(null!==(t=Y.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(o=Y.probability)&&void 0!==o?o:-1),inValidDiscountAmount:!Y.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(X!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&H!==i.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=Y;r.inValidMinimumAmount=H===i.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=H===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(Ie&&(r.inValidCouponExpiry=!Y.expireAt&&!Y.expireAfter),X!==i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&X!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!oe||Object.keys(oe).length||ae||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&ue&&!Object.keys(ue).length&&(r.inValidCollectionSelection=!0)),X===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(Y.prerequisiteQuantity||(r.inValidBuyXValue=!0),Y.entitledQuantity||(r.inValidGetYValue=!0),Z!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!te||Object.keys(te).length||se||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),Z===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&le&&!Object.keys(le).length&&(r.inValidBuyXCollectionSelection=!0),W!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!oe||Object.keys(oe).length||ae||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),W===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&ue&&!Object.keys(ue).length&&(r.inValidGetYCollectionSelection=!0)),Ae(r))return void De(r);if(G||Te>1)return void Ee(!b.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");b.onSaveClicked(Object.assign(Object.assign({},Y),{description:I.descriptionBuilder(Y,b.currency,null!==(n=b.products)&&void 0!==n?n:[],null!==(l=b.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=oe?oe:[],prerequisiteProducts:null!=te?te:[]},collectionsConf:{entitledCollections:null!=ue?ue:[],prerequisiteCollections:null!=le?le:[]},productVariableConf:{entitledProductVariable:null!=ae?ae:{},prerequisiteProductVariable:null!=se?se:{}}}))}}},secondaryButton:x?{buttonType:"tertiaryGray",onClick:()=>{F(void 0)},buttonText:"Back"}:k?{buttonType:"tertiaryGray",onClick:()=>{M(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:b.onClose,buttonText:"Cancel"}},{children:[!x&&!k&&e.jsxs(O.StyledDiscountDialogueContainer,{children:[b.allowStaticCoupon&&!x&&e.jsxs(O.CouponTypeContainerStyled,Object.assign({selectedDiv:Y.isStaticCoupon?1:2},{children:["static"===b.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{Y.isStaticCoupon||(w({isStaticCoupon:!0,quadrant:Y.quadrant}),Ee(""),fe())}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:Y.isStaticCoupon?l.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsx(n.BodyCaption,Object.assign({style:Y.isStaticCoupon?{color:l.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===b.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;Y.isStaticCoupon&&(Q(i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),w({isStaticCoupon:!1,quadrant:Y.quadrant,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Ee(""),fe(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:b.currency||""}))}),ve(null!==(t=b.makeExpiryMandatory)&&void 0!==t&&t),z(i.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:Y.isStaticCoupon?void 0:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsx(n.BodyCaption,Object.assign({style:Y.isStaticCoupon?{}:{color:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e.jsx(n.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),Y.isStaticCoupon&&!x&&e.jsx(_.default,{discountData:Y,setDiscountData:w,hideProbability:b.hideProbability||!1,discountAdminUrl:b.discountAdminUrl,staticDiscountValidationError:_e,currency:b.currency}),!Y.isStaticCoupon&&!x&&!k&&e.jsx(v.default,{currency:b.currency,entitledProducts:null!=oe?oe:[],prerequisiteProducts:null!=te?te:[],setEntitledProducts:ne,setPrerequisiteProducts:ie,discountData:Y,productPickerOpen:x,productVariablePickerOpen:q,setIsProductPickerOpen:F,setIsProductVariablePickerOpen:L,setDiscountData:w,selectedCouponType:X,setSelectedCouponType:Q,selectedMinimumRequirement:H,setSelectedMinimumRequirement:z,discountCouponAppliesTo:$,offerAppliesToBuy:Z,offerAppliesToGet:W,setDiscountCouponAppliesTo:K,setOfferAppliesToBuy:J,setOfferAppliesToGet:ee,hideProbability:b.hideProbability||!1,hideExpiration:b.hideExpiration||!1,allowStaticCoupon:b.allowStaticCoupon,onChangeCouponType:je,collectionPickerOpen:k,entitledCollections:null!=ue?ue:[],prerequisiteCollections:null!=le?le:[],setIsCollectionPickerOpen:M,setEntitledCollections:pe,setPrerequisiteCollections:re,useNewPicker:!!b.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Pe,isProductVariableSupported:b.isProductVariableSupported,entitledProductVariable:ae,setEntitledProductVariable:de,preRequisiteProductVariable:se,setPreRequisiteProductVariable:ce,productVariableList:b.productVariableList,isAddExpirationChecked:Ie,setIsAddExpirationChecked:ve,dynamicDiscountValidationError:ye,setDynamicDiscountValidationError:De,setValidationErrorMessage:Ee,resetValidationErrors:fe,discountDetailsOptions:V,selectedExpiration:Ne,setSelectedExpiration:me,makeExpiryMandatory:!!b.makeExpiryMandatory})]}),!!x&&e.jsxs(e.Fragment,{children:[!b.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(f=b.products)&&void 0!==f?f:[],title:"Select Products",onClose:()=>{F(void 0)},selectedProducts:null!==(A=x===v.DISCOUNT_PRODUCTS.ENTITLED?oe:te)&&void 0!==A?A:[],setSelectedProducts:x===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onSearchKeyChange:b.onProductSearch})})),b.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>F(void 0),collectionFetcher:b.newPickerConf.fetchCollections,productFetcher:b.newPickerConf.fetchProducts,selectedItems:x===v.DISCOUNT_PRODUCTS.ENTITLED?oe:te,onAdd:e=>{x===v.DISCOUNT_PRODUCTS.ENTITLED?ne(e):ie(e),F(void 0)},zIndex:200,storeId:b.newPickerConf.storeId,searchInCollectionFetcher:b.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:b.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!k&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[b.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>M(void 0),collectionFetcher:b.newPickerConf.fetchCollections,productFetcher:b.newPickerConf.fetchProducts,selectedItems:k===v.DISCOUNT_PRODUCTS.ENTITLED?ue:le,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),k===v.DISCOUNT_PRODUCTS.ENTITLED?pe(e):re(e),M(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:b.newPickerConf.storeId,searchInCollectionFetcher:b.newPickerConf.searchInCollection,searchFetcher:b.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!b.newPickerConf&&e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(g=b.collection)&&void 0!==g?g:[],title:"Select Products",onClose:()=>{M(void 0)},selectedProducts:null!==(j=k===v.DISCOUNT_PRODUCTS.ENTITLED?ue:le)&&void 0!==j?j:[],setSelectedProducts:k===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onSearchKeyChange:b.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsx(O.VariablePickerContainer,{children:e.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsx(P.VariablePicker,{type:E.PickerType.EMBEDDED,data:null!==(R=b.productVariableList)&&void 0!==R?R:[],showHeader:!0,onSelect:e=>{if(q===v.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;de({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===v.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ce({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};