@bikdotai/bik-component-library 0.0.574 → 0.0.575-beta-02

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 (115) hide show
  1. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  7. package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
  8. package/dist/cjs/components/carousel-preview/CarouselPreview.d.ts +2 -5
  9. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
  10. package/dist/cjs/components/product-picker-v2/modal.d.ts +2 -0
  11. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  12. package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +9 -8
  13. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  14. package/dist/cjs/components/template-context-mapper/Mocks/constants.d.ts +4364 -0
  15. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +9 -9
  16. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  17. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +11 -13
  18. package/dist/cjs/components/template-context-mapper/helpers/WebpushTemplateHelper.d.ts +57 -0
  19. package/dist/cjs/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -0
  20. package/dist/cjs/components/template-context-mapper/index.d.ts +1 -0
  21. package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +1 -0
  22. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +9 -9
  23. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.d.ts +1 -0
  24. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  25. package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.d.ts +10 -0
  26. package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -0
  27. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  28. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.d.ts +2 -5
  29. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +1 -1
  30. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -1
  31. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  32. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  33. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
  34. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +6 -4
  35. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  36. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  37. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +12 -0
  38. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  39. package/dist/cjs/components/template-preview/TemplatePreview.d.ts +8 -6
  40. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  41. package/dist/cjs/components/template-preview/constants/TemplateConstants.d.ts +2 -0
  42. package/dist/cjs/components/template-preview/constants/TemplateConstants.js +1 -1
  43. package/dist/cjs/components/template-preview/index.d.ts +2 -0
  44. package/dist/cjs/components/template-preview/models/WebpushTemplate.d.ts +74 -0
  45. package/dist/cjs/components/template-preview/models/WebpushTemplate.js +1 -0
  46. package/dist/cjs/components/template-preview/models/types.d.ts +9 -0
  47. package/dist/cjs/components/template-preview/utils/TemplateHelperUtils.d.ts +2 -0
  48. package/dist/cjs/components/template-preview/utils/TemplateHelperUtils.js +1 -1
  49. package/dist/cjs/components/template-preview/webpush/WebpushPreview.d.ts +8 -0
  50. package/dist/cjs/components/template-preview/webpush/WebpushPreview.js +1 -0
  51. package/dist/cjs/components/template-preview/webpush/WebpushPreview.styled.d.ts +1 -0
  52. package/dist/cjs/components/template-preview/webpush/WebpushPreview.styled.js +70 -0
  53. package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
  54. package/dist/cjs/components/variable-picker-v3/model.d.ts +1 -0
  55. package/dist/cjs/index.js +1 -1
  56. package/dist/cjs/utils/variableUtils.d.ts +1 -0
  57. package/dist/cjs/utils/variableUtils.js +1 -0
  58. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  59. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  60. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  61. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  62. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  63. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  64. package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
  65. package/dist/esm/components/carousel-preview/CarouselPreview.d.ts +2 -5
  66. package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
  67. package/dist/esm/components/product-picker-v2/modal.d.ts +2 -0
  68. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  69. package/dist/esm/components/product-picker-v2/productInfoOverlay.js +3 -2
  70. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  71. package/dist/esm/components/template-context-mapper/Mocks/constants.d.ts +4364 -0
  72. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +9 -9
  73. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  74. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +11 -13
  75. package/dist/esm/components/template-context-mapper/helpers/WebpushTemplateHelper.d.ts +57 -0
  76. package/dist/esm/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -0
  77. package/dist/esm/components/template-context-mapper/index.d.ts +1 -0
  78. package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +1 -0
  79. package/dist/esm/components/template-context-mapper/modalElements/Body.js +8 -8
  80. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.d.ts +1 -0
  81. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  82. package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.d.ts +10 -0
  83. package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -0
  84. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  85. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.d.ts +2 -5
  86. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +2 -2
  87. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -1
  88. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  89. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  90. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  91. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +6 -4
  92. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  93. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  94. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +12 -0
  95. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  96. package/dist/esm/components/template-preview/TemplatePreview.d.ts +8 -6
  97. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  98. package/dist/esm/components/template-preview/constants/TemplateConstants.d.ts +2 -0
  99. package/dist/esm/components/template-preview/constants/TemplateConstants.js +1 -1
  100. package/dist/esm/components/template-preview/index.d.ts +2 -0
  101. package/dist/esm/components/template-preview/models/WebpushTemplate.d.ts +74 -0
  102. package/dist/esm/components/template-preview/models/WebpushTemplate.js +1 -0
  103. package/dist/esm/components/template-preview/models/types.d.ts +9 -0
  104. package/dist/esm/components/template-preview/utils/TemplateHelperUtils.d.ts +2 -0
  105. package/dist/esm/components/template-preview/utils/TemplateHelperUtils.js +1 -1
  106. package/dist/esm/components/template-preview/webpush/WebpushPreview.d.ts +8 -0
  107. package/dist/esm/components/template-preview/webpush/WebpushPreview.js +1 -0
  108. package/dist/esm/components/template-preview/webpush/WebpushPreview.styled.d.ts +1 -0
  109. package/dist/esm/components/template-preview/webpush/WebpushPreview.styled.js +70 -0
  110. package/dist/esm/components/variable-picker-v3/Content.js +1 -1
  111. package/dist/esm/components/variable-picker-v3/model.d.ts +1 -0
  112. package/dist/esm/index.js +1 -1
  113. package/dist/esm/utils/variableUtils.d.ts +1 -0
  114. package/dist/esm/utils/variableUtils.js +1 -0
  115. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@emotion/styled/base"),r=require("react/jsx-runtime");require("@amplitude/analytics-browser"),require("../../../../amplitude/model.js");var i=require("../../../../utils/StringUtils.js"),t=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var s=require("react");require("../../../checkBox/CheckBox.styled.js");var g=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"),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("lodash"),require("../../../modals/styledModal.js"),require("../../../template-preview/models/Channels.js"),require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.js"),require("../../../template-context-mapper/modalElements/Body.js"),require("../../../template-context-mapper/modalElements/Header.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("react-calendar"),require("../../../../utils/DateUtils.js"),require("../../../datePicker/DatePickerWrapper.styled.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("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var I=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../StackedBarChart/StackedBarDistributionChart.js"),require("../StackedBarChart/StackedBarDistributionChart.model.js"),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("../../../../_virtual/_tslib.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.style.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("../../../card-selector/CardSelector.styled.js"),require("../../../action-button/ActionButton.styled.js");var C=require("chart.js"),o=require("react-chartjs-2");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(e);C.Chart.register(C.ArcElement,C.Legend);const l={plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:e=>{if(!e.label)return" 0%";const r=e.dataset.data.reduce(((e,r)=>e+r),0),i=parseFloat((e.raw/r*100).toFixed(1));return` ${e.label}: ${i}%`}}}}},u=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],d=c.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(e=>t.COLORS.surface.standard),";border:1px solid ",(e=>t.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFzQzhCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgeyBTdHJpbmdVdGlscyB9IGZyb20gXCIuLi8uLi8uLi8uLi9pbmRleFwiO1xyXG5pbXBvcnQgeyBBcmNFbGVtZW50LCBDaGFydCBhcyBDaGFydEpTLCBMZWdlbmQg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tcclxuICAgICAgICBjb25zdCB0b3RhbFN1bSA9IHNsaWNlcy5yZWR1Y2UoKHN1bSwgc2xpY2UpID0+IHN1bSArIHNsaWNlLmNvdW50LCAwKTtcclxuICAgICAgICBsZXQgdXBkYXRlZFNsaWNlc1dpdGhDb2xvciA9IFtdO1xyXG4gICAgICAgIHVwZGF0ZWRTbGljZXNXaXRoQ29sb3IgPSBPYmplY3Qua2V5cyhzbGljZXMpLm1hcCgoa2V5LCBpbmRleCkgPT4gKE9iamVjdC5hc3NpZ24oeyBjb2xvcjogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF0gfSwgc2xpY2VzW2tleV0pKSk7XHJcbiAgICAgICAgc2V0U2xpY2VzV2l0aENvbG9yKFsuLi51cGRhdGVkU2xpY2VzV2l0aENvbG9yXSk7XHJcbiAgICAgICAgaWYgKHRvdGFsU3VtID09PSAwKSB7XHJcbiAgICAgICAgICAgIGNvbnN0IGRhdGFTZXQgPSB7XHJcbiAgICAgICAgICAgICAgICBkYXRhc2V0czogW1xyXG4gICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogWzEwMF0sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogWycjRjBGMEYwJ10sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlcldpZHRoOiAwLFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgY29uc3QgZGF0YVNldCA9IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsczogc2xpY2VzLm1hcCgoc2xpY2UpID0+IFN0cmluZ1V0aWxzLmNhcGl0YWxpemUoc2xpY2UubmFtZSkpLFxyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHNsaWNlcy5tYXAoKHNsaWNlKSA9PiBzbGljZS5jb3VudCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogc2xpY2VzLm1hcCgoc2xpY2UsIGluZGV4KSA9PiB7IHZhciBfYTsgcmV0dXJuIChfYSA9IHNsaWNlLmNvbG9yKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBHUkFQSF9DT0xPUlNbaW5kZXggJSBHUkFQSF9DT0xPUlMubGVuZ3RoXTsgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yOiBbJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJ10sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlcldpZHRoOiA0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJSYWRpdXM6IDgsXHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIF0sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgfSwgW3NsaWNlc10pO1xyXG4gICAgaWYgKCFkYXRhKSB7XHJcbiAgICAgICAgcmV0dXJuIF9qc3goX0ZyYWdtZW50LCB7fSk7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gKF9qc3hzKF9GcmFnbWVudCwgeyBjaGlsZHJlbjogW3RpdGxlICYmIChfanN4KFRpdGxlTWVkaXVtLCBPYmplY3QuYXNzaWduKHsgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiB0aXRsZSB9KSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYnIH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6IGRhdGEsIG9wdGlvbnM6IE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucyksIHsgbWFpbnRhaW5Bc3BlY3RSYXRpbzogc2l6ZSA/IGZhbHNlIDogdHJ1ZSB9KSB9KSB9KSkgfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjbGFzc05hbWU6ICdjb2wtNicsIHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nTGVmdDogNDgsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGV4RGlyZWN0aW9uOiAnY29sdW1uJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnY2VudGVyJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KFBpZUNoYXJ0LCB7IHNsaWNlczogc2xpY2VzV2l0aENvbG9yIH0pIH0pKV0gfSkpXSB9KSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPVBpZUNoYXJ0QW5hbHl0aWNzLmpzLm1hcCJdfQ== */"));exports.Card=e=>r.jsx(d,Object.assign({style:{padding:24}},{children:e.children})),exports.PieChartAnalytics=e=>{let{title:t,slices:C,size:a}=e;const[c,d]=s.useState([]),[A,n]=s.useState();return s.useEffect((()=>{const e=C.reduce(((e,r)=>e+r.count),0);let r=[];if(r=Object.keys(C).map(((e,r)=>Object.assign({color:u[r%u.length]},C[e]))),d([...r]),0===e){n({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}]})}else{const e={labels:C.map((e=>i.default.capitalize(e.name))),datasets:[{data:C.map((e=>e.count)),backgroundColor:C.map(((e,r)=>{var i;return null!==(i=e.color)&&void 0!==i?i:u[r%u.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};n(e)}}),[C]),A?r.jsxs(r.Fragment,{children:[t&&r.jsx(g.TitleMedium,Object.assign({style:{marginBottom:16}},{children:t})),r.jsxs("div",Object.assign({className:"row"},{children:[r.jsx("div",Object.assign({className:"col-6"},{children:r.jsx("div",Object.assign({style:{width:a,height:a}},{children:r.jsx(o.Doughnut,{data:A,options:Object.assign(Object.assign({},l),{maintainAspectRatio:!a})})}))})),r.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"center"}},{children:r.jsx(I.PieChart,{slices:c})}))]}))]}):r.jsx(r.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@emotion/styled/base"),r=require("react/jsx-runtime");require("@amplitude/analytics-browser"),require("../../../../amplitude/model.js");var i=require("../../../../utils/StringUtils.js"),t=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var s=require("react");require("../../../checkBox/CheckBox.styled.js");var g=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"),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"),require("../../../modals/styledModal.js"),require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.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("react-calendar"),require("../../../../utils/DateUtils.js"),require("../../../datePicker/DatePickerWrapper.styled.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("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var I=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../StackedBarChart/StackedBarDistributionChart.js"),require("../StackedBarChart/StackedBarDistributionChart.model.js"),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.style.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("../../../card-selector/CardSelector.styled.js"),require("../../../action-button/ActionButton.styled.js");var C=require("chart.js"),o=require("react-chartjs-2");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(e);C.Chart.register(C.ArcElement,C.Legend);const l={plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:e=>{if(!e.label)return" 0%";const r=e.dataset.data.reduce(((e,r)=>e+r),0),i=parseFloat((e.raw/r*100).toFixed(1));return` ${e.label}: ${i}%`}}}}},u=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],d=c.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(e=>t.COLORS.surface.standard),";border:1px solid ",(e=>t.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFzQzhCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWx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ICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgY29uc3QgZGF0YVNldCA9IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsczogc2xpY2VzLm1hcCgoc2xpY2UpID0+IFN0cmluZ1V0aWxzLmNhcGl0YWxpemUoc2xpY2UubmFtZSkpLFxyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHNsaWNlcy5tYXAoKHNsaWNlKSA9PiBzbGljZS5jb3VudCksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogc2xpY2VzLm1hcCgoc2xpY2UsIGluZGV4KSA9PiB7IHZhciBfYTsgcmV0dXJuIChfYSA9IHNsaWNlLmNvbG9yKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBHUkFQSF9DT0xPUlNbaW5kZXggJSBHUkFQSF9DT0xPUlMubGVuZ3RoXTsgfSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yOiBbJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJywgJ3doaXRlJ10sXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlcldpZHRoOiA0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJSYWRpdXM6IDgsXHJcbiAgICAgICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIF0sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgfSwgW3NsaWNlc10pO1xyXG4gICAgaWYgKCFkYXRhKSB7XHJcbiAgICAgICAgcmV0dXJuIF9qc3goX0ZyYWdtZW50LCB7fSk7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gKF9qc3hzKF9GcmFnbWVudCwgeyBjaGlsZHJlbjogW3RpdGxlICYmIChfanN4KFRpdGxlTWVkaXVtLCBPYmplY3QuYXNzaWduKHsgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiB0aXRsZSB9KSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYnIH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6IGRhdGEsIG9wdGlvbnM6IE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucyksIHsgbWFpbnRhaW5Bc3BlY3RSYXRpbzogc2l6ZSA/IGZhbHNlIDogdHJ1ZSB9KSB9KSB9KSkgfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBjbGFzc05hbWU6ICdjb2wtNicsIHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nTGVmdDogNDgsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGV4RGlyZWN0aW9uOiAnY29sdW1uJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnY2VudGVyJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KFBpZUNoYXJ0LCB7IHNsaWNlczogc2xpY2VzV2l0aENvbG9yIH0pIH0pKV0gfSkpXSB9KSk7XHJcbn07XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPVBpZUNoYXJ0QW5hbHl0aWNzLmpzLm1hcCJdfQ== */"));exports.Card=e=>r.jsx(d,Object.assign({style:{padding:24}},{children:e.children})),exports.PieChartAnalytics=e=>{let{title:t,slices:C,size:a}=e;const[c,d]=s.useState([]),[A,n]=s.useState();return s.useEffect((()=>{const e=C.reduce(((e,r)=>e+r.count),0);let r=[];if(r=Object.keys(C).map(((e,r)=>Object.assign({color:u[r%u.length]},C[e]))),d([...r]),0===e){n({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}]})}else{const e={labels:C.map((e=>i.default.capitalize(e.name))),datasets:[{data:C.map((e=>e.count)),backgroundColor:C.map(((e,r)=>{var i;return null!==(i=e.color)&&void 0!==i?i:u[r%u.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};n(e)}}),[C]),A?r.jsxs(r.Fragment,{children:[t&&r.jsx(g.TitleMedium,Object.assign({style:{marginBottom:16}},{children:t})),r.jsxs("div",Object.assign({className:"row"},{children:[r.jsx("div",Object.assign({className:"col-6"},{children:r.jsx("div",Object.assign({style:{width:a,height:a}},{children:r.jsx(o.Doughnut,{data:A,options:Object.assign(Object.assign({},l),{maintainAspectRatio:!a})})}))})),r.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"center"}},{children:r.jsx(I.PieChart,{slices:c})}))]}))]}):r.jsx(r.Fragment,{})};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -2,13 +2,10 @@ import React from 'react';
2
2
  import 'slick-carousel/slick/slick-theme.css';
3
3
  import 'slick-carousel/slick/slick.css';
4
4
  import { CHANNEL_TYPE } from "../template-preview/models/Channels";
5
- import { EmailTemplateType } from "../template-preview/models/EmailTemplate";
6
- import { SMSTemplateType } from "../template-preview/models/SmsTemplate";
7
- import { WhatsAppCarouselTemplate } from "../template-preview/models/WhatsappCarouselTemplate";
8
- import { WhatsAppTemplate } from "../template-preview/models/WhatsAppTemplate";
5
+ import { AllTemplateTypes } from '../template-preview/models/types';
9
6
  export declare const CarouselPreview: React.ForwardRefExoticComponent<{
10
7
  channel: CHANNEL_TYPE;
11
- template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
8
+ template: AllTemplateTypes;
12
9
  showSampleValues?: boolean | undefined;
13
10
  isPreview?: boolean | undefined;
14
11
  removeBottomBorder?: boolean | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../template-context-mapper/context/templateModalContext.js"),a=require("../template-preview/TemplatePreview.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../constants/Theme.js"),require("../curtain/CurtainHelper.js"),require("../variable-picker-v3/model.js"),require("../template-preview/models/TemplateMeta.js"),require("../template-preview/models/WhatsAppTemplate.js");const l=i(t).default.forwardRef((t=>{let{channel:i,currentTemplate:l,showSampleValues:s,carouselCardIndex:p,isPreview:n,width:u}=t;var o,d,m;const{cardWidth:c,template:h}=r.useTemplateModalContext(),v=(null!==(m=null===(d=null===(o=null==h?void 0:h.components)||void 0===o?void 0:o[1].cards)||void 0===d?void 0:d.length)&&void 0!==m?m:0)-1===p?12:0;return e.jsx("div",Object.assign({style:{width:u||c,height:(null!=p?p:-1)>-1?"100%":"auto"}},{children:e.jsx(a.TemplatePreview,{showSampleValues:s,template:l,channel:i,size:"small",hideHeader:!0,carouselCardIndex:p,isWhatsappCarousel:!0,isPreview:n,whatsAppSpecificMeta:{templateContainerStyles:{marginRight:v,height:"100%"}}})}))}));exports.default=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../template-context-mapper/context/templateModalContext.js"),a=require("../template-preview/TemplatePreview.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../constants/Theme.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");const l=i(t).default.forwardRef((t=>{let{channel:i,currentTemplate:l,showSampleValues:s,carouselCardIndex:p,isPreview:n,width:u}=t;var o,d,m;const{cardWidth:c,template:h}=r.useTemplateModalContext(),v=(null!==(m=null===(d=null===(o=null==h?void 0:h.components)||void 0===o?void 0:o[1].cards)||void 0===d?void 0:d.length)&&void 0!==m?m:0)-1===p?12:0;return e.jsx("div",Object.assign({style:{width:u||c,height:(null!=p?p:-1)>-1?"100%":"auto"}},{children:e.jsx(a.TemplatePreview,{showSampleValues:s,template:l,channel:i,size:"small",hideHeader:!0,carouselCardIndex:p,isWhatsappCarousel:!0,isPreview:n,whatsAppSpecificMeta:{templateContainerStyles:{marginRight:v,height:"100%"}}})}))}));exports.default=l;
@@ -9,6 +9,7 @@ export interface ProductVariant {
9
9
  displayOrder?: number | null;
10
10
  fbStatus?: FbProductStatus;
11
11
  description?: string;
12
+ id?: string;
12
13
  }
13
14
  export interface Product {
14
15
  name: string;
@@ -17,6 +18,7 @@ export interface Product {
17
18
  variants?: {
18
19
  [key: string]: ProductVariant;
19
20
  };
21
+ id?: string;
20
22
  }
21
23
  export interface Collection {
22
24
  name: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),l=require("../input/Input.js"),i=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),C=require("./reducers.js"),x=require("./searchScreen.js"),g=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:f,selectedItems:b,onClose:m,visible:v,zIndex:P,exactLimit:k,limit:O,hideCollectionCheckbox:I,hideProductCheckbox:F,outOfStockAction:R=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:T,selectProductsFromCustomCollection:q,hideSelectionCount:E,title:D,width:w,left:N,renderWithoutModal:A,onClickSave:B,pickerType:L,hideProductVariants:M=!1,startupScreen:V=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:_=!1,showProductDetails:z,containerStyle:H,crossButtonInsideHeader:W=!1}=e,[G,K]=c.useReducer(C.collectionsReducer,{}),[U,Y]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(V)?V:exports.ScreenName.Collections),[J,Q]=c.useState("grid"),[X,Z]=c.useState(""),[ee,te]=c.useState(""),[oe,ce]=c.useState(0),[re,se]=c.useState(!1),[ne,le]=c.useState(0),[ie,ae]=c.useState(""),[de,ue]=c.useState(!1),[he,pe]=c.useState(!1),[Se,Ce]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[xe,ge]=c.useReducer(C.selectedColectionsReducer,Object.keys(b).length>0?b:{}),je=c.useRef(null),[ye,fe]=c.useState(!1),[be,me]=c.useState();c.useEffect((()=>{se(!0),pe(!0),e.collectionFetcher(oe,f).then((e=>{K({type:"fetched",data:(null==e?void 0:e.collections)||{}}),se(!1),ce((e=>e+1)),pe(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;M?Object.keys(xe||[]).forEach((t=>{var o;Object.keys((null===(o=xe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&xe[-1]&&(null===(c=xe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(xe||[]).forEach((t=>{var o;Object.keys((null===(o=xe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=xe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),le(e)}),[G,xe,M]),c.useEffect((()=>{ee&&(se(!0),e.productFetcher(ee,f).then((e=>{Object.keys(e).length&&K({type:"productsFetched",data:{collectionId:ee,products:e}}),se(!1)})).catch())}),[ee]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==U&&(ie.length||"collections"!==U)&&(ie.length?(ue(!0),e.searchFetcher(f,ie).then((e=>{"collections"in e&&"products"in e?(Ce({type:"set",data:e}),K({type:"searched",data:e.collections})):(Ce({type:"set",data:{collections:{},products:e}}),K({type:"searched",data:e})),Y("searchProducts"),se(!1),ue(!1)}))):Y("collections"))}),800);return()=>clearTimeout(t)}),[ie]),c.useEffect((()=>{B&&(e.onAdd(xe,ne),ve())}),[B]),c.useEffect((()=>{_&&Object.keys(xe||{}).length&&ne&&(e.onAdd(xe,ne),ve())}),[_,xe,ne]);const ve=()=>{ge({type:"reset",data:{}})},Pe=t.jsxs(j.ContainerStyle,Object.assign({style:null!=H?H:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===U||"searchProducts"===U)&&t.jsx("div",Object.assign({style:{padding:A?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(l.Input,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>de?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:ie,onChangeText:e=>{e.length&&e.trim().length?ae(e):ae("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:je,screenName:U},{children:["collections"===U&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:he,collections:G,selectedCollectionsDispatch:ge,setCollectionId:Z,setSelectedCollectionId:te,setScreen:Y,selectedCollections:xe,collectionFetcher:e.collectionFetcher,storeId:f,collectionsDispatch:K,setSaveDisabled:se,pagingControls:{curPage:oe,setCurPage:ce},hideCollectionCheckbox:I,renderWithoutModal:A,pickerType:L,scrollContainerRef:je}),"products"===U&&X&&t.jsx(C.CollectionIdContext.Provider,Object.assign({value:X},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:Y,storeId:f,data:G[X],collectionsDispatch:K,selectedCollectionsDispatch:ge,selectedData:xe,setSaveDisabled:se,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:F,outOfStockAction:R,hideVariantCheckbox:T,selectProductsFromCustomCollection:q,renderWithoutModal:A,pickerType:L,hideProductVariants:M,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{fe(!0),me(e)},showProductDetailInfoIcon:z,scrollContainerRef:je})})),"view"===U&&t.jsx(g.SelectedScreen,{selectedCollections:xe||{},selectedCollectionsDispatch:ge,setScreen:Y,collections:G,hideProductVariants:M,outOfStockAction:R,storeId:f,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===U&&t.jsx(S.RearrangeScreen,{selectedCollections:xe||{},selectedCollectionsDispatch:ge,setScreen:Y,outOfStockAction:R,rearrangeViewType:"grid"===J?"list":"grid",scrollContainerRef:je,storeId:f,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===U&&t.jsx(x.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:xe||{},searchedCollections:Se||{},searchedCollectionsDispatch:Ce,selectedCollectionsDispatch:ge,setScreen:Y,collections:G,onBackPress:()=>{ae(""),Ce({type:"set",data:{collections:{},products:{}}})},pickerType:L,hideProductCheckbox:F,hideProductVariants:M,hideVariantCheckbox:T,storeId:f,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:Z,setSelectedCollectionId:te,renderWithoutModal:A,hideCollectionCheckbox:I,outOfStockAction:R})]}))]}));return t.jsx(t.Fragment,{children:A?Pe:t.jsxs(i.StyledModal,Object.assign({zIndex:P,open:v,onClose:()=>{null==m||m(),ve()},headingTitle:D||("collections"===U||"products"===U?"Select Products":"view"===U?"Selected Products":"searchProducts"===U?"Searched Results":"rearrange"===U?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:w||"600px",left:N||"auto"},headerRightCustomElement:W?t.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:m},{children:t.jsx(s.default,{width:20,height:20,color:r.COLORS.content.secondary})})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:{buttonText:re?"Loading...":U===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:re||ne<1||k&&ne<k||!k&&O&&ne>O||!1,onClick:()=>{e.onAdd(xe,ne),ve()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:E?t.jsx(t.Fragment,{}):k&&ne>k?t.jsx(d.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):O&&ne>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):ne>0?t.jsx(n.Button,{onClick:()=>{Y($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:k?`${ne}/${k} products selected`:`${ne} products selected`,buttonType:["rearrange","view"].includes(U)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(U)}):t.jsx(n.Button,{disabled:!0,buttonText:k?`${ne}/${k} products selected`:`${ne} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:ye||W},{children:[Pe,ye&&be?t.jsx(h.ProductInfoOverlay,{productData:be,outOfStockAction:R,onClose:()=>{fe(!1)}}):t.jsx(t.Fragment,{})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),l=require("../input/Input.js"),i=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),C=require("./reducers.js"),x=require("./searchScreen.js"),g=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:f,selectedItems:b,onClose:m,visible:v,zIndex:k,exactLimit:P,limit:O,hideCollectionCheckbox:I,hideProductCheckbox:F,outOfStockAction:R=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:T,selectProductsFromCustomCollection:q,hideSelectionCount:D,title:E,width:w,left:N,renderWithoutModal:A,onClickSave:B,pickerType:L,hideProductVariants:M=!1,startupScreen:V=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:_=!1,showProductDetails:z,containerStyle:H,crossButtonInsideHeader:W=!1}=e,[G,K]=c.useReducer(C.collectionsReducer,{}),[U,Y]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(V)?V:exports.ScreenName.Collections),[J,Q]=c.useState("grid"),[X,Z]=c.useState(""),[ee,te]=c.useState(""),[oe,ce]=c.useState(0),[re,se]=c.useState(!1),[ne,le]=c.useState(0),[ie,ae]=c.useState(""),[de,ue]=c.useState(!1),[he,pe]=c.useState(!1),[Se,Ce]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[xe,ge]=c.useReducer(C.selectedColectionsReducer,Object.keys(b).length>0?b:{}),je=c.useRef(null),[ye,fe]=c.useState(!1),[be,me]=c.useState();c.useEffect((()=>{se(!0),pe(!0),e.collectionFetcher(oe,f).then((e=>{K({type:"fetched",data:(null==e?void 0:e.collections)||{}}),se(!1),ce((e=>e+1)),pe(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;M?Object.keys(xe||[]).forEach((t=>{var o;Object.keys((null===(o=xe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&xe[-1]&&(null===(c=xe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(xe||[]).forEach((t=>{var o;Object.keys((null===(o=xe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=xe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),le(e)}),[G,xe,M]),c.useEffect((()=>{ee&&(se(!0),e.productFetcher(ee,f).then((e=>{Object.keys(e).length&&K({type:"productsFetched",data:{collectionId:ee,products:e}}),se(!1)})).catch())}),[ee]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==U&&(ie.length||"collections"!==U)&&(ie.length?(ue(!0),e.searchFetcher(f,ie).then((e=>{"collections"in e&&"products"in e?(Ce({type:"set",data:e}),K({type:"searched",data:e.collections})):(Ce({type:"set",data:{collections:{},products:e}}),K({type:"searched",data:e})),Y("searchProducts"),se(!1),ue(!1)}))):Y("collections"))}),800);return()=>clearTimeout(t)}),[ie]),c.useEffect((()=>{B&&(e.onAdd(xe,ne),ve())}),[B]),c.useEffect((()=>{_&&Object.keys(xe||{}).length&&ne&&(e.onAdd(xe,ne),ve())}),[_,xe,ne]);const ve=()=>{ge({type:"reset",data:{}})},ke=t.jsxs(j.ContainerStyle,Object.assign({style:null!=H?H:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===U||"searchProducts"===U)&&t.jsx("div",Object.assign({style:{padding:A?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(l.Input,{placeholder:"Search for collections and products, or type a product ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>de?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:ie,onChangeText:e=>{e.length&&e.trim().length?ae(e):ae("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:je,screenName:U},{children:["collections"===U&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:he,collections:G,selectedCollectionsDispatch:ge,setCollectionId:Z,setSelectedCollectionId:te,setScreen:Y,selectedCollections:xe,collectionFetcher:e.collectionFetcher,storeId:f,collectionsDispatch:K,setSaveDisabled:se,pagingControls:{curPage:oe,setCurPage:ce},hideCollectionCheckbox:I,renderWithoutModal:A,pickerType:L,scrollContainerRef:je}),"products"===U&&X&&t.jsx(C.CollectionIdContext.Provider,Object.assign({value:X},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:Y,storeId:f,data:G[X],collectionsDispatch:K,selectedCollectionsDispatch:ge,selectedData:xe,setSaveDisabled:se,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:F,outOfStockAction:R,hideVariantCheckbox:T,selectProductsFromCustomCollection:q,renderWithoutModal:A,pickerType:L,hideProductVariants:M,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{fe(!0),me(e)},showProductDetailInfoIcon:z,scrollContainerRef:je})})),"view"===U&&t.jsx(g.SelectedScreen,{selectedCollections:xe||{},selectedCollectionsDispatch:ge,setScreen:Y,collections:G,hideProductVariants:M,outOfStockAction:R,storeId:f,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===U&&t.jsx(S.RearrangeScreen,{selectedCollections:xe||{},selectedCollectionsDispatch:ge,setScreen:Y,outOfStockAction:R,rearrangeViewType:"grid"===J?"list":"grid",scrollContainerRef:je,storeId:f,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===U&&t.jsx(x.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:xe||{},searchedCollections:Se||{},searchedCollectionsDispatch:Ce,selectedCollectionsDispatch:ge,setScreen:Y,collections:G,onBackPress:()=>{ae(""),Ce({type:"set",data:{collections:{},products:{}}})},pickerType:L,hideProductCheckbox:F,hideProductVariants:M,hideVariantCheckbox:T,storeId:f,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:Z,setSelectedCollectionId:te,renderWithoutModal:A,hideCollectionCheckbox:I,outOfStockAction:R})]}))]}));return t.jsx(t.Fragment,{children:A?ke:t.jsxs(i.StyledModal,Object.assign({zIndex:k,open:v,onClose:()=>{null==m||m(),ve()},headingTitle:E||("collections"===U||"products"===U?"Select Products":"view"===U?"Selected Products":"searchProducts"===U?"Searched Results":"rearrange"===U?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:w||"600px",left:N||"auto"},headerRightCustomElement:W?t.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:m},{children:t.jsx(s.default,{width:20,height:20,color:r.COLORS.content.secondary})})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:{buttonText:re?"Loading...":U===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:re||ne<1||P&&ne<P||!P&&O&&ne>O||!1,onClick:()=>{e.onAdd(xe,ne),ve()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:D?t.jsx(t.Fragment,{}):P&&ne>P?t.jsx(d.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):O&&ne>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):ne>0?t.jsx(n.Button,{onClick:()=>{Y($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ne}/${P} products selected`:`${ne} products selected`,buttonType:["rearrange","view"].includes(U)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(U)}):t.jsx(n.Button,{disabled:!0,buttonText:P?`${ne}/${P} products selected`:`${ne} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:ye||W},{children:[ke,ye&&be?t.jsx(h.ProductInfoOverlay,{productData:be,outOfStockAction:R,onClose:()=>{fe(!1)}}):t.jsx(t.Fragment,{})]}))})};
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),s=require("../TypographyStyle.js"),d=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t);const c=t=>{var o;const r=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(s.TitleSmall,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(s.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(o=t.productData.description)&&void 0!==o?o:""}}),e.jsx(d.ProductPickerTag,{isVariant:r,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},u=l.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),d=require("../TypographyStyle.js"),s=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=n(t);const l=t=>{var r;const i=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(d.TitleRegular,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:`Product ID: ${t.productData.id}`})),e.jsx(d.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(r=t.productData.description)&&void 0!==r?r:""}}),e.jsx(s.ProductPickerTag,{isVariant:i,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},u=c.default.div`
2
2
  display: flex;
3
3
  flex: 1;
4
4
  background: rgba(0, 0, 0, 0.5);
@@ -15,12 +15,13 @@
15
15
  max-height: 300px;
16
16
  overflow-y: auto;
17
17
  word-break: break-word;
18
+ margin-top: 8px;
18
19
  }
19
- `,p=l.default.div`
20
+ `,p=c.default.div`
20
21
  display: flex;
21
22
  flex: 1;
22
23
  background: rgba(0, 0, 0, 0.5);
23
- `,x=l.default.div`
24
+ `,x=c.default.div`
24
25
  position: relative;
25
26
 
26
27
  .close-button {
@@ -31,17 +32,17 @@
31
32
  background: ${o.COLORS.surface.standard};
32
33
  border-radius: 50%;
33
34
  }
34
- `,f=l.default.div`
35
+ `,f=c.default.div`
35
36
  display: flex;
36
37
  background: white;
37
38
  padding: 24px;
38
39
  gap: 24px;
39
40
  border-radius: 8px 8px 0px 0px;
40
- `,g=l.default.div`
41
+ `,g=c.default.div`
41
42
  display: flex;
42
- `,h=l.default.div`
43
+ `,h=c.default.div`
43
44
  display: flex;
44
45
  flex: 1;
45
46
  flex-direction: column;
46
- gap: 10px;
47
- `;exports.ProductInfoCard=c,exports.ProductInfoOverlay=t=>e.jsxs(u,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(c,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
47
+ gap: 4px;
48
+ `;exports.ProductInfoCard=l,exports.ProductInfoOverlay=t=>e.jsxs(u,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(l,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),c=require("../../assets/icons/box.svg.js"),o=require("../../assets/icons/search.svg.js"),r=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),d=require("../InfiniteScroll/InfiniteScroll.js"),u=require("../input/Input.js"),a=require("../spinner/Spinner.js"),h=require("../TypographyStyle.js"),p=require("./emptyState.js"),j=require("./product.js"),v=require("./ProductPickerShimmer.js"),g=require("./reducers.js"),y=require("./style.js"),O=require("./type.js"),b=require("./utility.js");exports.ProductsScreen=f=>{var k,C;const{data:P,collectionsDispatch:x,selectedData:S,selectedCollectionsDispatch:I,productFetcher:m,storeId:q,setScreen:A,setSaveDisabled:E,hideInCollectionSearch:T,customCollectionRestriction:D,hideProductCheckbox:R,outOfStockAction:V=O.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:F=!1,pickerType:w,hideProductVariants:B,fbStatusFetcher:_,onProductDetailClick:M,showProductDetailInfoIcon:U,scrollContainerRef:H}=f,J=s.useContext(g.CollectionIdContext),K=s.useRef(0),N=s.useRef(!1),[W,z]=s.useState(""),[G,Q]=s.useState(!1),[X,Y]=s.useState(P),Z=s.useRef(!0),$=s.useRef(!1);s.useEffect((()=>{if(Z.current)return void(Z.current=!1);const e=setTimeout((()=>{W.length?(Q(!0),f.searchInCollectionFetcher(q,J,W).then((e=>{const t=r.cloneDeep(P);t.products=e,Y(t);const c=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});te(c,null!=e?e:{},!0),E(!1),Q(!1)}))):Y(P)}),800);return()=>clearTimeout(e)}),[W]);s.useEffect((()=>{var e,t,c,o;$.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=P.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const r=b.getVariantIdsToFetchAtProductLevel(null!==(c=P.products)&&void 0!==c?c:{});te(r,null!==(o=P.products)&&void 0!==o?o:{})}),[J]);const ee=!!D&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||ce(10)}),[]);const te=(e,t,c)=>{_||(c?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)),e.length>0&&_&&_(q,e).then((e=>{const o=Object.assign({},t);Object.keys(t).forEach((c=>{var r,s;Object.keys(null!==(s=null===(r=null==t?void 0:t[c])||void 0===r?void 0:r.variants)&&void 0!==s?s:{}).forEach((r=>{var s,n;const i=null===(s=null==t?void 0:t[c].variants)||void 0===s?void 0:s[r];i&&"REJECTED"===e[r]?i.fbStatus="REJECTED":i&&"APPROVED"===e[r]&&(i.fbStatus="APPROVED");const l=null===(n=null==o?void 0:o[c])||void 0===n?void 0:n.variants;l&&l[r]&&(l[r]=i)}))})),c?(Y((e=>{const t=Object.assign({},e);return t.products=o,t})),x({type:"productsPaged",data:{collectionId:J,products:o}})):x({type:"productsPaged",data:{collectionId:J,products:o}})})).catch((e=>{c?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)}))},ce=e=>{E(!0),Q(!0),m(J,q,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Y(Object.assign(Object.assign({},X),{products:t}));const e=b.getVariantIdsToFetchAtProductLevel(t);te(e,t),K.current=1}e||I({type:"selected",data:{id:J,val:Object.assign(Object.assign({},P),{products:t})}}),E(!1),Q(!1)})).catch()},oe=(e,t)=>{const c=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},c),{isRestricted:D})})},re=!!(null==S?void 0:S[J])&&!!Object.keys(null!==(C=null===(k=null==S?void 0:S[J])||void 0===k?void 0:k.products)&&void 0!==C?C:{}).length;return e.jsxs("div",{children:[e.jsxs(y.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{A("collections")}}),e.jsx(h.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:P.name}))]}),!T&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>G&&W.length?e.jsx(a.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:W,onChangeText:e=>{e.length&&e.trim().length?z(e):z("")},placeholder:"Search products in this collection..."})})),Object.keys((null==X?void 0:X.products)||[]).length>0&&!ee&&!W.length&&!R&&"-1"!==J&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:re,isPartiallyChecked:b.isCollectionPartiallyChecked(J,X,S,B),onValueChange:function(e){e?ce():I({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(c.default,{})})),e.jsx(h.TitleRegular,{children:"All Products"})]}),e.jsx(d.InfiniteScroll,Object.assign({hasData:!(Object.keys((null==X?void 0:X.products)||[]).length<10)&&!!Object.keys((null==X?void 0:X.products)||[]).length,fetchMore:()=>(N.current=!0,m(J,q,10,K.current).then((e=>{let t=!1;if(Object.keys(e).length||(t=!0),Object.keys(e).length){const t=X;t.products=Object.assign(Object.assign({},X.products),e),Y(Object.assign({},t));const c=b.getVariantIdsToFetchAtProductLevel(e);te(c,e)}return E(!1),N.current=!1,K.current+=1,t}))),containerRef:H},{children:Object.keys((null==X?void 0:X.products)||[]).length?Object.keys(X.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:b.isProductPartiallyChecked(J,t,S,X,B),productId:t,data:X.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!ee,upliftAdditions:oe,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:M,showProductDetailInfoIcon:U},t))):G?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(p.EmptyState,{title:"No products to show",subtitle:W.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("../../assets/icons/box.svg.js"),o=require("../../assets/icons/search.svg.js"),c=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),d=require("../InfiniteScroll/InfiniteScroll.js"),u=require("../input/Input.js"),a=require("../spinner/Spinner.js"),h=require("../TypographyStyle.js"),p=require("./emptyState.js"),j=require("./product.js"),v=require("./ProductPickerShimmer.js"),g=require("./reducers.js"),y=require("./style.js"),O=require("./type.js"),b=require("./utility.js");exports.ProductsScreen=f=>{var k,C;const{data:P,collectionsDispatch:x,selectedData:S,selectedCollectionsDispatch:I,productFetcher:m,storeId:q,setScreen:A,setSaveDisabled:D,hideInCollectionSearch:E,customCollectionRestriction:T,hideProductCheckbox:R,outOfStockAction:V=O.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:F=!1,pickerType:w,hideProductVariants:B,fbStatusFetcher:_,onProductDetailClick:M,showProductDetailInfoIcon:U,scrollContainerRef:H}=f,J=s.useContext(g.CollectionIdContext),K=s.useRef(0),N=s.useRef(!1),[W,z]=s.useState(""),[G,Q]=s.useState(!1),[X,Y]=s.useState(P),Z=s.useRef(!0),$=s.useRef(!1);s.useEffect((()=>{if(Z.current)return void(Z.current=!1);const e=setTimeout((()=>{W.length?(Q(!0),f.searchInCollectionFetcher(q,J,W).then((e=>{const t=c.cloneDeep(P);t.products=e,Y(t);const r=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});te(r,null!=e?e:{},!0),D(!1),Q(!1)}))):Y(P)}),800);return()=>clearTimeout(e)}),[W]);s.useEffect((()=>{var e,t,r,o;$.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=P.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const c=b.getVariantIdsToFetchAtProductLevel(null!==(r=P.products)&&void 0!==r?r:{});te(c,null!==(o=P.products)&&void 0!==o?o:{})}),[J]);const ee=!!T&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||re(10)}),[]);const te=(e,t,r)=>{_||(r?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)),e.length>0&&_&&_(q,e).then((e=>{const o=Object.assign({},t);Object.keys(t).forEach((r=>{var c,s;Object.keys(null!==(s=null===(c=null==t?void 0:t[r])||void 0===c?void 0:c.variants)&&void 0!==s?s:{}).forEach((c=>{var s,n;const i=null===(s=null==t?void 0:t[r].variants)||void 0===s?void 0:s[c];i&&"REJECTED"===e[c]?i.fbStatus="REJECTED":i&&"APPROVED"===e[c]&&(i.fbStatus="APPROVED");const l=null===(n=null==o?void 0:o[r])||void 0===n?void 0:n.variants;l&&l[c]&&(l[c]=i)}))})),r?(Y((e=>{const t=Object.assign({},e);return t.products=o,t})),x({type:"productsPaged",data:{collectionId:J,products:o}})):x({type:"productsPaged",data:{collectionId:J,products:o}})})).catch((e=>{r?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)}))},re=e=>{D(!0),Q(!0),m(J,q,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Y(Object.assign(Object.assign({},X),{products:t}));const e=b.getVariantIdsToFetchAtProductLevel(t);te(e,t),K.current=1}e||I({type:"selected",data:{id:J,val:Object.assign(Object.assign({},P),{products:t})}}),D(!1),Q(!1)})).catch()},oe=(e,t)=>{const r=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},r),{isRestricted:T})})},ce=!!(null==S?void 0:S[J])&&!!Object.keys(null!==(C=null===(k=null==S?void 0:S[J])||void 0===k?void 0:k.products)&&void 0!==C?C:{}).length;return e.jsxs("div",{children:[e.jsxs(y.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{A("collections")}}),e.jsx(h.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:P.name}))]}),!E&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>G&&W.length?e.jsx(a.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:W,onChangeText:e=>{e.length&&e.trim().length?z(e):z("")},placeholder:"Search for a product or type a product ID"})})),Object.keys((null==X?void 0:X.products)||[]).length>0&&!ee&&!W.length&&!R&&"-1"!==J&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:ce,isPartiallyChecked:b.isCollectionPartiallyChecked(J,X,S,B),onValueChange:function(e){e?re():I({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.default,{})})),e.jsx(h.TitleRegular,{children:"All Products"})]}),e.jsx(d.InfiniteScroll,Object.assign({hasData:!(Object.keys((null==X?void 0:X.products)||[]).length<10)&&!!Object.keys((null==X?void 0:X.products)||[]).length,fetchMore:()=>(N.current=!0,m(J,q,10,K.current).then((e=>{let t=!1;if(Object.keys(e).length||(t=!0),Object.keys(e).length){const t=X;t.products=Object.assign(Object.assign({},X.products),e),Y(Object.assign({},t));const r=b.getVariantIdsToFetchAtProductLevel(e);te(r,e)}return D(!1),N.current=!1,K.current+=1,t}))),containerRef:H},{children:Object.keys((null==X?void 0:X.products)||[]).length?Object.keys(X.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:b.isProductPartiallyChecked(J,t,S,X,B),productId:t,data:X.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!ee,upliftAdditions:oe,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:M,showProductDetailInfoIcon:U},t))):G?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(p.EmptyState,{title:"No products to show",subtitle:W.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};