@bikdotai/bik-component-library 0.0.646-beta.zero.2 → 0.0.647--beta--analytics0.1

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 (107) hide show
  1. package/dist/cjs/assets/icons/RCS_PDF.svg.js +1 -0
  2. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  3. package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
  4. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
  5. package/dist/cjs/components/carousel-preview/CustomCarouselArrows.js +1 -1
  6. package/dist/cjs/components/dropdown/DropdownPopover/index.d.ts +6 -0
  7. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  8. package/dist/cjs/components/dropdown/type.d.ts +0 -3
  9. package/dist/cjs/components/shimmer-image/ShimmerImage.d.ts +1 -0
  10. package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
  11. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  12. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +2 -0
  13. package/dist/cjs/components/template-context-mapper/context/templateModalContext.js +1 -1
  14. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
  15. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  16. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  17. package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +4 -4
  18. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +5 -5
  19. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  20. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  21. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  22. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +1 -0
  23. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  24. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.js +1 -1
  25. package/dist/cjs/components/template-preview/RCS/RCSButtons.d.ts +9 -0
  26. package/dist/cjs/components/template-preview/RCS/RCSButtons.js +1 -0
  27. package/dist/cjs/components/template-preview/RCS/RCSChatHeader.d.ts +2 -0
  28. package/dist/cjs/components/template-preview/RCS/RCSChatHeader.js +1 -0
  29. package/dist/cjs/components/template-preview/RCS/RCSChatPreview.d.ts +2 -0
  30. package/dist/cjs/components/template-preview/RCS/RCSChatPreview.js +1 -0
  31. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.d.ts +14 -0
  32. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -0
  33. package/dist/cjs/components/template-preview/RCS/RCSPreview.styled.d.ts +29 -0
  34. package/dist/cjs/components/template-preview/RCS/RCSPreview.styled.js +123 -0
  35. package/dist/cjs/components/template-preview/RCS/RCSTemplateLikePreview.d.ts +3 -0
  36. package/dist/cjs/components/template-preview/RCS/RCSTemplateLikePreview.js +8 -0
  37. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  38. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.d.ts +2 -0
  39. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  40. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
  41. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  42. package/dist/cjs/components/template-preview/helpers/templateMiscHelper.d.ts +6 -0
  43. package/dist/cjs/components/template-preview/helpers/templateMiscHelper.js +1 -0
  44. package/dist/cjs/components/template-preview/models/Channels.d.ts +2 -1
  45. package/dist/cjs/components/template-preview/models/Channels.js +1 -1
  46. package/dist/cjs/components/template-preview/models/EmailTemplate.d.ts +2 -1
  47. package/dist/cjs/components/template-preview/models/RCSTemplate.d.ts +131 -0
  48. package/dist/cjs/components/template-preview/models/SmsTemplate.d.ts +2 -1
  49. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +9 -1
  50. package/dist/cjs/components/template-preview/models/WhatsappCarouselTemplate.d.ts +28 -1
  51. package/dist/cjs/components/template-preview/models/types.d.ts +2 -1
  52. package/dist/cjs/components/zeroState/ZeroState.d.ts +0 -2
  53. package/dist/cjs/components/zeroState/ZeroState.js +3 -3
  54. package/dist/esm/assets/icons/RCS_PDF.svg.js +1 -0
  55. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  56. package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
  57. package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
  58. package/dist/esm/components/carousel-preview/CustomCarouselArrows.js +1 -1
  59. package/dist/esm/components/dropdown/DropdownPopover/index.d.ts +6 -0
  60. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  61. package/dist/esm/components/dropdown/type.d.ts +0 -3
  62. package/dist/esm/components/shimmer-image/ShimmerImage.d.ts +1 -0
  63. package/dist/esm/components/shimmer-image/ShimmerImage.js +1 -1
  64. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  65. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +2 -0
  66. package/dist/esm/components/template-context-mapper/context/templateModalContext.js +1 -1
  67. package/dist/esm/components/template-context-mapper/modalElements/Body.js +3 -3
  68. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  69. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  70. package/dist/esm/components/template-context-mapper/modalElements/Footer.js +4 -4
  71. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +5 -5
  72. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  73. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +5 -5
  74. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  75. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +1 -0
  76. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  77. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.js +1 -1
  78. package/dist/esm/components/template-preview/RCS/RCSButtons.d.ts +9 -0
  79. package/dist/esm/components/template-preview/RCS/RCSButtons.js +1 -0
  80. package/dist/esm/components/template-preview/RCS/RCSChatHeader.d.ts +2 -0
  81. package/dist/esm/components/template-preview/RCS/RCSChatHeader.js +1 -0
  82. package/dist/esm/components/template-preview/RCS/RCSChatPreview.d.ts +2 -0
  83. package/dist/esm/components/template-preview/RCS/RCSChatPreview.js +1 -0
  84. package/dist/esm/components/template-preview/RCS/RCSMediaCard.d.ts +14 -0
  85. package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -0
  86. package/dist/esm/components/template-preview/RCS/RCSPreview.styled.d.ts +29 -0
  87. package/dist/esm/components/template-preview/RCS/RCSPreview.styled.js +123 -0
  88. package/dist/esm/components/template-preview/RCS/RCSTemplateLikePreview.d.ts +3 -0
  89. package/dist/esm/components/template-preview/RCS/RCSTemplateLikePreview.js +8 -0
  90. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  91. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.d.ts +2 -0
  92. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  93. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -0
  94. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  95. package/dist/esm/components/template-preview/helpers/templateMiscHelper.d.ts +6 -0
  96. package/dist/esm/components/template-preview/helpers/templateMiscHelper.js +1 -0
  97. package/dist/esm/components/template-preview/models/Channels.d.ts +2 -1
  98. package/dist/esm/components/template-preview/models/Channels.js +1 -1
  99. package/dist/esm/components/template-preview/models/EmailTemplate.d.ts +2 -1
  100. package/dist/esm/components/template-preview/models/RCSTemplate.d.ts +131 -0
  101. package/dist/esm/components/template-preview/models/SmsTemplate.d.ts +2 -1
  102. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +9 -1
  103. package/dist/esm/components/template-preview/models/WhatsappCarouselTemplate.d.ts +28 -1
  104. package/dist/esm/components/template-preview/models/types.d.ts +2 -1
  105. package/dist/esm/components/zeroState/ZeroState.d.ts +0 -2
  106. package/dist/esm/components/zeroState/ZeroState.js +5 -5
  107. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r,n,c=e(require("react"));function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}var a=e=>c.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),t||(t=c.createElement("rect",{width:24,height:24,fill:"#017AFF",rx:12})),r||(r=c.createElement("rect",{width:10,height:10,x:7,y:7,fill:"#fff",rx:2})),n||(n=c.createElement("path",{fill:"#017AFF",d:"M9.303 10.841c.405 0 .72.084.942.252.225.167.338.419.338.754 0 .35-.113.614-.338.79-.226.174-.526.261-.901.261h-.37V14H8.37v-3.159h.933Zm-.005 1.605c.217 0 .38-.044.49-.133.11-.091.164-.247.164-.466 0-.375-.218-.562-.654-.562h-.324v1.16h.324Zm2.55-1.605c.491 0 .883.111 1.175.334.296.222.444.632.444 1.23 0 .585-.145.998-.435 1.238-.29.238-.656.357-1.101.357h-.86v-3.159h.777Zm-.173.453v2.253h.297c.268 0 .478-.082.63-.246.153-.168.23-.467.23-.896 0-.3-.04-.53-.12-.69a.638.638 0 0 0-.306-.334 1.07 1.07 0 0 0-.453-.087h-.278ZM14.035 14v-3.159h1.788l-.064.448h-1.12v.946h.974v.448h-.974V14h-.603Z"})));exports.default=a;
@@ -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 c=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 i=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 t=require("../../../modals/styledModal.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 s=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("../../../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");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,c=null!==(e=null==g?void 0:g.symbol)&&void 0!==e?e:"",i=null==g?void 0:g.isInternationalStore;return[` ${r}`,` ${c}${void 0!==i?i?s.truncateValueForInternationalStore(l):s.truncateValueForIndianStore(l):l} (${A}% of ${c}${void 0!==i?i?s.truncateValueForInternationalStore(C):s.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErRThCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgQmFyQ2hhcnRJY29uIGZyb20gJ0BzcmMvYXNzZXRzL2ljb25zL0NoYXJ0QmFyLnN2Zyc7XHJcbmltcG9ydCBNYXhpbWl6ZUljb24gZnJvbSAnQHNyYy9hc3NldHMvaWNvbnMvbWF4aW1pemUuc3ZnJztcclxuaW1wb3J0IHsgU3RyaW5nVXRp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WYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0cnVuY2F0ZVZhbHVlRm9ySW5kaWFuU3RvcmUodG90YWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdG90YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYCAke2xhYmVsfWAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGAgJHtzeW1ib2x9JHt2YWx1ZX0gKCR7cGVyY2VudGFnZX0lIG9mICR7c3ltYm9sfSR7dG90YWxWYWx1ZX0pYCxcclxuICAgICAgICAgICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICB9LFxyXG4gICAgfSxcclxufSk7XHJcbmNvbnN0IEdSQVBIX0NPTE9SUyA9IFtcclxuICAgICcjNUUwN0JCJyxcclxuICAgICcjOUU3N0VEJyxcclxuICAgICcjRDJBRUZGJyxcclxuICAgICcjQ0RFMUZGJyxcclxuICAgICcjOTJBRkZBJyxcclxuICAgICcjMzkzNUUxJyxcclxuXTtcclxuY29uc3QgQ2FydFN0eWxlZCA9IHN0eWxlZC5kaXYgYFxuXHRiYWNrZ3JvdW5kOiAkeyhwcm9wcykgPT4gQ09MT1JTLnN1cmZhY2Uuc3RhbmRhcmR9O1xuXHRib3JkZXI6IDFweCBzb2xpZCAkeyhwcm9wcykgPT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NldEJhckNoYXJ0RGF0YV0gPSB1c2VTdGF0ZShudWxsKTtcclxuICAgIHVzZUVmZmVjdCgoKSA9PiB7XHJcbiAgICAgICAgY29uc3QgdG90YWxTdW0gPSBzbGljZXMucmVkdWNlKChzdW0sIHNsaWNlKSA9PiBzdW0gKyBzbGljZS5jb3VudCwgMCk7XHJcbiAgICAgICAgbGV0IHVwZGF0ZWRTbGljZXNXaXRoQ29sb3IgPSBbXTtcclxuICAgICAgICB1cGRhdGVkU2xpY2VzV2l0aENvbG9yID0gT2JqZWN0LmtleXMoc2xpY2VzKS5tYXAoKGtleSwgaW5kZXgpID0+IChPYmplY3QuYXNzaWduKHsgY29sb3I6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdIH0sIHNsaWNlc1trZXldKSkpO1xyXG4gICAgICAgIHNldFNsaWNlc1dpdGhDb2xvcihbLi4udXBkYXRlZFNsaWNlc1dpdGhDb2xvcl0pO1xyXG4gICAgICAgIGlmICh0b3RhbFN1bSA9PT0gMCkge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IFsxMDBdLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFsnI0YwRjBGMCddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogMCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJ1bmNhdGVTbGljZXMgJiYgc2xpY2VzLmxlbmd0aCA+IHRydW5jYXRlU2xpY2VzKSB7XHJcbiAgICAgICAgICAgIGNvbnN0IHRydW5jYXRlZFNsaWNlcyA9IHNsaWNlcy5zbGljZSgwLCB0cnVuY2F0ZVNsaWNlcyk7XHJcbiAgICAgICAgICAgIGNvbnN0IG90aGVyU2xpY2VzID0gc2xpY2VzLnNsaWNlKHRydW5jYXRlU2xpY2VzKTtcclxuICAgICAgICAgICAgY29uc3Qgb3RoZXJDb3VudCA9IG90aGVyU2xpY2VzLnJlZHVjZSgoc3VtLCBzbGljZSkgPT4gc3VtICsgc2xpY2UuY291bnQsIDApO1xyXG4gICAgICAgICAgICB0cnVuY2F0ZWRTbGljZXMucHVzaCh7IG5hbWU6ICdPdGhlcicsIGNvdW50OiBvdGhlckNvdW50IH0pO1xyXG4gICAgICAgICAgICBjb25zdCB0cnVuY2F0ZWREYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZShzbGljZS5uYW1lKSksXHJcbiAgICAgICAgICAgICAgICBkYXRhc2V0czogW1xyXG4gICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UpID0+IHNsaWNlLmNvdW50KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSwgaW5kZXgpID0+IHsgdmFyIF9hOyByZXR1cm4gKF9hID0gc2xpY2UuY29sb3IpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdOyB9KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyQ29sb3I6IFsnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnXSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyV2lkdGg6IDQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvc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T09IHZvaWQgMCA/IHZvaWQgMCA6IHRpdGxlLmxlbmd0aCkgPT09IDAgPyAnZmxleC1lbmQnIDogJ3NwYWNlLWJldHdlZW4nLFxyXG4gICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBbIWhpZGVUaXRsZSAmJiB0aXRsZSAmJiAoX2pzeChUaXRsZU1lZGl1bSwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IHRpdGxlIH0pKSksIF9qc3hzKFwiZGl2XCIsIHsgY2hpbGRyZW46IFtzaG93Q29udmVydFRvQmFyQ2hhcnQgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBCYXJDaGFydEljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6ICh0cnVuY2F0ZVNsaWNlcyA/IHRydW5jYXRlZERhdGEgOiBkYXRhKSwgb3B0aW9uczogT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zKGN1cnJlbmN5UHJvcHMpKSwgeyBtYWludGFpbkFzcGVjdFJhdGlvOiBzaXplID8gZmFsc2UgOiB0cnVlIH0pIH0pIH0pKSB9KSksIF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNsYXNzTmFtZTogJ2NvbC02Jywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmdMZWZ0OiA0OCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhEaXJlY3Rpb246ICdjb2x1bW4nLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdmbGV4LXN0YXJ0JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KFBpZUNoYXJ0LCB7IHNsaWNlczogdHJ1bmNhdGVTbGljZXMgPyB0cnVuY2F0ZWRTbGljZXNXaXRoQ29sb3IgOiBzbGljZXNXaXRoQ29sb3IsIHNpemU6IHNpemUgfSkgfSkpXSB9KSksIHNob3dQb3B1cCAmJiAoX2pzeChTdHlsZWRNb2RhbCwgT2JqZWN0LmFzc2lnbih7IG9wZW46IHNob3dQb3B1cCwgb25DbG9zZTogKCkgPT4gc2V0U2hvd1BvcHVwKGZhbHNlKSwgY2xvc2VPbk91dHNpZGVDbGljazogdHJ1ZSwgaGVhZGluZ1RpdGxlOiB0aXRsZSwgd2lkdGg6IFwiNzUlXCIgfSwgeyBjaGlsZHJlbjogX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IDI0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnc3BhY2UtYmV0d2VlbicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzgwdmgnLFxyXG4gICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogW19qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7IHdpZHRoOiAnNTUlJywgbWFyZ2luTGVmdDogJzQlJyB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICA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yBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiAnMjRweCAwJyxcclxuICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goVmVydGljYWxHcmFwaCwgeyB4QXhpczogYmFyQ2hhcnREYXRhLnhBeGlzLCB5QXhpczogYmFyQ2hhcnREYXRhLnlBeGlzLCBiYXJDb2xvclJHQkE6IGJhckNoYXJ0RGF0YSA9PT0gbnVsbCB8fCBiYXJDaGFydERhdGEgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGJhckNoYXJ0RGF0YS5iYXJDb2xvclJHQkEgfSkgfSkpIH0pKSldIH0pKTtcclxufTtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9UGllQ2hhcnRBbmFseXRpY3MuanMubWFwIl19 */"));exports.Card=g=>I.jsx(y,Object.assign({style:{padding:24}},{children:g.children})),exports.PieChartAnalytics=g=>{let{title:r,slices:s,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,J]=l.useState(),[R,V]=l.useState(),[F,S]=l.useState([]),[v,k]=l.useState(null);return l.useEffect((()=>{const g=s.reduce(((g,I)=>g+I.count),0);let I=[];if(I=Object.keys(s).map(((g,I)=>Object.assign({color:G[I%G.length]},s[g]))),W([...I]),0===g){J({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}],labels:[]})}else{const g={labels:s.map((g=>A.default.capitalizeEachWord(g.name))),datasets:[{data:s.map((g=>g.count)),backgroundColor:s.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}]};J(g)}if(y&&s.length>y){const g=s.slice(0,y),I=s.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&&k(((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}}))(s,h,X))}),[s,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(c.TitleMedium,Object.assign({style:{marginBottom:16}},{children:r})),I.jsxs("div",{children:[b&&I.jsx(i.IconButton,{Icon:e.default,onClick:()=>{H(!0)}}),u&&I.jsx(i.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?R: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(t.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(t.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 c=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 i=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 t=require("../../../modals/styledModal.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 s=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");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,c=null!==(e=null==g?void 0:g.symbol)&&void 0!==e?e:"",i=null==g?void 0:g.isInternationalStore;return[` ${r}`,` ${c}${void 0!==i?i?s.truncateValueForInternationalStore(l):s.truncateValueForIndianStore(l):l} (${A}% of ${c}${void 0!==i?i?s.truncateValueForInternationalStore(C):s.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErRThCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHl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gICAgdG9vbHRpcDoge1xyXG4gICAgICAgICAgICBlbmFibGVkOiB0cnVlLFxyXG4gICAgICAgICAgICBjYWxsYmFja3M6IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsOiAodG9vbHRpcEl0ZW0pID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0cnVuY2F0ZVZhbHVlRm9ySW5kaWFuU3RvcmUodG90YWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdG90YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYCAke2xhYmVsfWAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGAgJHtzeW1ib2x9JHt2YWx1ZX0gKCR7cGVyY2VudGFnZX0lIG9mICR7c3ltYm9sfSR7dG90YWxWYWx1ZX0pYCxcclxuICAgICAgICAgICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICB9LFxyXG4gICAgfSxcclxufSk7XHJcbmNvbnN0IEdSQVBIX0NPTE9SUyA9IFtcclxuICAgICcjNUUwN0JCJyxcclxuICAgICcjOUU3N0VEJyxcclxuICAgICcjRDJBRUZGJyxcclxuICAgICcjQ0RFMUZGJyxcclxuICAgICcjO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ICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1c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bGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6IGhpZGVUaXRsZSB8fCAodGl0bGUgPT09IG51bGwgfHwgdGl0bGUgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHRpdGxlLmxlbmd0aCkgPT09IDAgPyAnZmxleC1lbmQnIDogJ3NwYWNlLWJldHdlZW4nLFxyXG4gICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBbIWhpZGVUaXRsZSAmJiB0aXRsZSAmJiAoX2pzeChUaXRsZU1lZGl1bSwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IHRpdGxlIH0pKSksIF9qc3hzKFwiZGl2XCIsIHsgY2hpbGRyZW46IFtzaG93Q29udmVydFRvQmFyQ2hhcnQgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBCYXJDaGFydEljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6ICh0cnVuY2F0ZVNsaWNlcyA/IHRydW5jYXRlZERhdGEgOiBkYXRhKSwgb3B0aW9uczogT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zKGN1cnJlbmN5UHJvcHMpKSwgeyBtYWludGFpbkFzcGVjdFJhdGlvOiBzaXplID8gZmFsc2UgOiB0cnVlIH0pIH0pIH0pKSB9KSksIF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNsYXNzTmFtZTogJ2NvbC02Jywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmdMZWZ0OiA0OCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICA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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdXN0aWZ5Q29udGVudDogJ2NlbnRlcicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6IGRhdGEsIG9wdGlvbnM6IE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucyhjdXJyZW5jeVByb3BzKSksIHsgbWFpbnRhaW5Bc3BlY3RSYXRpbzogc2l6ZSA/IGZhbHNlIDogdHJ1ZSB9KSB9KSB9KSkgfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMzAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6ICcxMDAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVyZmxvd1k6ICdhdXRvJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogX2pzeChQaWVDaGFydCwgeyBzbGljZXM6IHNsaWNlc1dpdGhDb2xvciB9KSB9KSldIH0pKSB9KSkpLCBzaG93QmFyQ2hhcnQgJiYgYmFyQ2hhcnREYXRhICYmIChfanN4KFN0eWxlZE1vZGFsLCBPYmplY3QuYXNzaWduKHsgb3Blbjogc2hvd0JhckNoYXJ0LCBvbkNsb3NlOiAoKSA9PiBzZXRTaG93QmFyQ2hhcnQoZmFsc2UpLCBjbG9zZU9uT3V0c2lkZUNsaWNrOiB0cnVlLCBoZWFkaW5nVGl0bGU6IHRpdGxlLCB3aWR0aDogXCI4NSVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiAnMjRweCAwJyxcclxuICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goVmVydGljYWxHcmFwaCwgeyB4QXhpczogYmFyQ2hhcnREYXRhLnhBeGlzLCB5QXhpczogYmFyQ2hhcnREYXRhLnlBeGlzLCBiYXJDb2xvclJHQkE6IGJhckNoYXJ0RGF0YSA9PT0gbnVsbCB8fCBiYXJDaGFydERhdGEgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGJhckNoYXJ0RGF0YS5iYXJDb2xvclJHQkEgfSkgfSkpIH0pKSldIH0pKTtcclxufTtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9UGllQ2hhcnRBbmFseXRpY3MuanMubWFwIl19 */"));exports.Card=g=>I.jsx(y,Object.assign({style:{padding:24}},{children:g.children})),exports.PieChartAnalytics=g=>{let{title:r,slices:s,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=s.reduce(((g,I)=>g+I.count),0);let I=[];if(I=Object.keys(s).map(((g,I)=>Object.assign({color:G[I%G.length]},s[g]))),W([...I]),0===g){R({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}],labels:[]})}else{const g={labels:s.map((g=>A.default.capitalizeEachWord(g.name))),datasets:[{data:s.map((g=>g.count)),backgroundColor:s.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&&s.length>y){const g=s.slice(0,y),I=s.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}}))(s,h,X))}),[s,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(c.TitleMedium,Object.assign({style:{marginBottom:16}},{children:r})),I.jsxs("div",{children:[b&&I.jsx(i.IconButton,{Icon:e.default,onClick:()=>{H(!0)}}),u&&I.jsx(i.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(t.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(t.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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("react-slick"),t=require("./CarouselPreview.style.js"),l=require("./CarouselPreviewCard.js"),n=require("../template-context-mapper/context/templateModalContext.js"),s=require("./CustomCarouselArrows.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(r),d=i(o);const u=a.default.forwardRef((r=>{let{channel:o,template:i,isPreview:a,removeBottomBorder:u,borderRadius:c,showArrows:v,hideBorder:p}=r;var m,C,w;const x=null===(m=null==i?void 0:i.components)||void 0===m?void 0:m[1].cards,{sliderRef:j,selectedCarouselIndex:f,cardCount:h,setIsCarouselHovered:g}=n.useTemplateModalContext();return e.jsxs(t.Container,Object.assign({removeBottomBorder:u,borderRadius:c,hideBorder:p},{children:[e.jsx(l.default,{channel:o,currentTemplate:i,carouselCardIndex:-1,isPreview:a,width:"77%"}),!!(null==x?void 0:x.length)&&e.jsx(t.CarouselSlickContainer,Object.assign({cardCount:null!=h?h:0,selectedCarouselIndex:null!=f?f:-1,onMouseEnter:()=>null==g?void 0:g(!0),onMouseLeave:()=>null==g?void 0:g(!1)},{children:e.jsx(d.default,Object.assign({ref:j,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!a,centerMode:!0,arrows:v,adaptiveHeight:!0,nextArrow:e.jsx(s.CustomCarouselRightArrow,{isPreview:null!=a&&a}),prevArrow:e.jsx(s.CustomCarouselLeftArrow,{isPreview:null!=a&&a})},{children:null===(w=null===(C=null==i?void 0:i.components)||void 0===C?void 0:C[1].cards)||void 0===w?void 0:w.map(((r,t)=>{var n,s;const d={components:r.components,mapping:null===(s=null===(n=null==i?void 0:i.mapping)||void 0===n?void 0:n.cards)||void 0===s?void 0:s[t]};return e.jsx(l.default,{channel:o,currentTemplate:d,carouselCardIndex:t,isPreview:a,width:"100%"},t)}))}))}))]}))}));exports.CarouselPreview=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),s=require("react-slick"),t=require("./CarouselPreview.style.js"),o=require("./CarouselPreviewCard.js"),l=require("../template-context-mapper/context/templateModalContext.js"),n=require("../template-preview/helpers/templateMiscHelper.js"),a=require("../template-preview/RCS/RCSPreview.styled.js"),i=require("./CustomCarouselArrows.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(r),c=d(s);const v=u.default.forwardRef((r=>{let{channel:s,template:i,isPreview:d,removeBottomBorder:u,borderRadius:c,showArrows:v,hideBorder:p}=r;var w,m;const{sliderRef:x,selectedCarouselIndex:j,cardCount:h,setIsCarouselHovered:f,cardIndex:P}=l.useTemplateModalContext(),R=-1==P?n.determineCardIndex(s):P,g=null===(m=null===(w=null==i?void 0:i.components)||void 0===w?void 0:w[R])||void 0===m?void 0:m.cards,I=(null==g?void 0:g.length)?e.jsx(C,{cards:g,cardCount:null!=h?h:0,selectedCarouselIndex:null!=j?j:-1,sliderRef:x,isPreview:d,showArrows:v,channel:s,template:i,setIsCarouselHovered:f}):null;return n.isRCSChannel(s)?e.jsx(a.RCSCarousalContainer,Object.assign({borderRadius:c},{children:I})):e.jsxs(t.Container,Object.assign({removeBottomBorder:u,borderRadius:c,hideBorder:p},{children:[e.jsx(o.default,{channel:s,currentTemplate:i,carouselCardIndex:-1,isPreview:d,width:"77%"}),I]}))})),C=r=>{let{cards:s,cardCount:l,selectedCarouselIndex:n,sliderRef:a,isPreview:d,showArrows:u,channel:v,template:C,setIsCarouselHovered:p}=r;return e.jsx(t.CarouselSlickContainer,Object.assign({cardCount:l,selectedCarouselIndex:n,onMouseEnter:()=>null==p?void 0:p(!0),onMouseLeave:()=>null==p?void 0:p(!1)},{children:e.jsx(c.default,Object.assign({ref:a,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!d,centerMode:!0,arrows:u,adaptiveHeight:!0,nextArrow:e.jsx(i.CustomCarouselRightArrow,{isPreview:null!=d&&d}),prevArrow:e.jsx(i.CustomCarouselLeftArrow,{isPreview:null!=d&&d})},{children:null==s?void 0:s.map(((r,s)=>{var t,l;const n={components:r.components,mapping:null===(l=null===(t=null==C?void 0:C.mapping)||void 0===t?void 0:t.cards)||void 0===l?void 0:l[s]};return e.jsx(o.default,{channel:v,currentTemplate:n,carouselCardIndex:s,isPreview:d,width:"100%"},s)}))}))}))};exports.CarouselPreview=v;
@@ -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"),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;
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");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");var i=require("../template-preview/helpers/templateMiscHelper.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=l(t).default.forwardRef((t=>{let{channel:l,currentTemplate:s,showSampleValues:p,carouselCardIndex:n,isPreview:u,width:d}=t;var o,m,c;const{cardWidth:v,template:h,cardIndex:w}=r.useTemplateModalContext(),j=-1==w?i.determineCardIndex(l):w,q=(null!==(c=null===(m=null===(o=null==h?void 0:h.components)||void 0===o?void 0:o[j].cards)||void 0===m?void 0:m.length)&&void 0!==c?c:0)-1===n?12:0;return e.jsx("div",Object.assign({style:{width:d||v,height:(null!=n?n:-1)>-1?"100%":"auto"}},{children:e.jsx(a.TemplatePreview,{showSampleValues:p,template:s,channel:l,size:"small",hideHeader:!0,carouselCardIndex:n,isWhatsappCarousel:!0,isPreview:u,whatsAppSpecificMeta:{templateContainerStyles:{marginRight:q,height:"100%"}}})}))}));exports.default=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/chevronLeft.svg.js"),t=require("../../assets/icons/chevronRight.svg.js"),l=require("../../constants/Theme.js"),n=require("../template-context-mapper/context/templateModalContext.js");exports.CustomCarouselLeftArrow=t=>{const{className:o,style:r,onClick:a,isPreview:c}=t,{selectedCarouselIndex:i,setSelectedCarouselIndex:u}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{null==a||a(e),(null!=i?i:-1)<1||c||null==u||u((null!=i?i:-1)-1)}},{children:e.jsx(s.default,{height:10,width:10,color:l.COLORS.content.primary})}))},exports.CustomCarouselRightArrow=s=>{const{className:o,style:r,onClick:a,isPreview:c}=s,{selectedCarouselIndex:i,setSelectedCarouselIndex:u,cardCount:d}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{console.log("onClick",i,d),null==a||a(e),(null!=i?i:-1)>=(null!=d?d:-1)-1||c||null==u||u((null!=i?i:-1)+1)}},{children:e.jsx(t.default,{height:10,width:10,color:l.COLORS.content.primary})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/chevronLeft.svg.js"),t=require("../../assets/icons/chevronRight.svg.js"),l=require("../../constants/Theme.js"),n=require("../template-context-mapper/context/templateModalContext.js");exports.CustomCarouselLeftArrow=t=>{const{className:o,style:r,onClick:a,isPreview:c}=t,{selectedCarouselIndex:i,setSelectedCarouselIndex:u}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{null==a||a(e),(null!=i?i:-1)<1||c||null==u||u((null!=i?i:-1)-1)}},{children:e.jsx(s.default,{height:10,width:10,color:l.COLORS.content.primary})}))},exports.CustomCarouselRightArrow=s=>{const{className:o,style:r,onClick:a,isPreview:c}=s,{selectedCarouselIndex:i,setSelectedCarouselIndex:u,cardCount:d}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{null==a||a(e),(null!=i?i:-1)>=(null!=d?d:-1)-1||c||null==u||u((null!=i?i:-1)+1)}},{children:e.jsx(t.default,{height:10,width:10,color:l.COLORS.content.primary})}))};
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { ButtonProps } from "../../button/model";
2
3
  import { Placement } from "../../tooltips";
3
4
  import { OpenDropdownProps } from '../type';
4
5
  export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdownProps & {
@@ -12,6 +13,11 @@ export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdo
12
13
  showTooltipArrow?: boolean | undefined;
13
14
  allowEvents?: boolean | undefined;
14
15
  'data-test'?: string | undefined;
16
+ zeroState?: {
17
+ actionButton?: ButtonProps | undefined;
18
+ title: string;
19
+ subTitle?: string | undefined;
20
+ } | undefined;
15
21
  } & React.RefAttributes<{
16
22
  openDropdown: boolean;
17
23
  }>>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),s=require("../../hooks/useDropdown.js"),o=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),a=require("./multiSelect/MultiSelectDropdownBottomBar.js"),c=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=f=>{let{options:j,isSearchable:x,isMultiSelect:g,width:b,allowFreeForm:v,height:w,onClose:O,onSelect:m,onSearch:y,version:C,skipSorting:D,headerRef:M,hideSelectAll:q,primaryButtonText:L,onInfiniteScroll:F,onMultiSelectClear:k,onDropdownItemClick:A,buttonOptions:B,isSearchLoading:I,disableSearchOptions:H,disableSearchedOptionExcept:R,useDefaultCursor:T,containerStyle:Z={},zeroState:z}=f;const{dropdownOptions:E,search:P,searchedString:_,searchedOptions:K,onApplyHandler:N,selectAllHandler:W,onMultiSelectClear:G,onFreeFormSelect:J,onMultiSelectApply:Q,latestDropdownOptionsRef:U,getSelectedOptions:V}=s.useDropdown(C,j,m,D,g,y,H,R),[X,Y]=t.useState(null!=b?b:S),[$,ee]=t.useState(null),te=t.useRef(null),ne=t.useRef([]);r.useOutside(te,(()=>{if(ee(null),g&&"2.0"===C){const e=V(U.current);null==O||O(e)}else null==O||O(E)}),[M,ne]);const re=null!=w?w:h,se="number"==typeof re?x&&g?re-96:x&&!g||!x&&g?re-48:re:re;t.useEffect((()=>{const e=null!=b?b:S;if(null===$)Y(e);else if("number"==typeof e)Y(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));Y(t)}}),[$]);const oe=[],ie=(_&&y?K:E).map((e=>{var t,n;if(_&&!y){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(_.toLowerCase()))&&(oe.push(!_||e.label===_),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(_.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(_.toLowerCase()))?(oe.push(!_||e.label===_),e):null}return e})).filter((e=>null!==e)),le=!!x&&_&&0===ie.length;return e.jsxs(c.OpennedDropdownContainer,Object.assign({version:C,ref:te,style:Object.assign({width:X},Z)},{children:[e.jsxs("div",Object.assign({style:{width:$?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:P,version:C}),ie.length||_?e.jsxs(c.MenuListContainer,Object.assign({minHeight:re,maxHeight:se},{children:[!!g&&!le&&!q&&e.jsx(u.SelectAllMenu,{version:C,options:_&&y?K:E,onSelect:W}),!v&&le&&e.jsx(p.SearchZeroState,{isLoading:I,height:se,searchedString:_}),v&&(le||!!oe.length&&oe.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:C,isMultiSelect:g,onSelect:J,searchedString:_}),e.jsx(l.MenuList,{onInfiniteScroll:F,onDropdownItemClick:A,version:C,onSelect:N,showDescription:function(e,t){ee(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:ie,useDefaultCursor:T,ref:ne})]})):e.jsx("div",Object.assign({style:{height:re,display:"flex"}},{children:e.jsx(n.ZeroState,Object.assign({},z,{title:(null==z?void 0:z.title)||"No results found",subTitle:(null==z?void 0:z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!g&&!(!ie.length&&!_)&&"2.0"!==C&&e.jsx(a.default,{onClear:()=>{G(),null==k||k()},onApply:Q,list:_&&y?K:E,buttonText:L,buttonOptions:B})]})),!!$&&e.jsx(o.Description,{title:$.title,description:$.description,version:C})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),o=require("../../../../hooks/useOutside.js"),r=require("../../hooks/useDropdown.js"),i=require("./description/Description.js"),s=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),a=require("./multiSelect/MultiSelectDropdownBottomBar.js"),c=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=f=>{let{options:j,isSearchable:x,isMultiSelect:g,width:b,allowFreeForm:v,height:w,onClose:O,onSelect:m,onSearch:y,version:C,skipSorting:D,headerRef:M,hideSelectAll:q,primaryButtonText:L,onInfiniteScroll:F,onMultiSelectClear:k,onDropdownItemClick:A,buttonOptions:B,isSearchLoading:I,disableSearchOptions:H,disableSearchedOptionExcept:R,useDefaultCursor:T,containerStyle:Z={},zeroState:z}=f;const{dropdownOptions:E,search:P,searchedString:_,searchedOptions:K,onApplyHandler:N,selectAllHandler:W,onMultiSelectClear:G,onFreeFormSelect:J,onMultiSelectApply:Q,latestDropdownOptionsRef:U,getSelectedOptions:V}=r.useDropdown(C,j,m,D,g,y,H,R),[X,Y]=t.useState(null!=b?b:S),[$,ee]=t.useState(null),te=t.useRef(null),ne=t.useRef([]);o.useOutside(te,(()=>{if(ee(null),g&&"2.0"===C){const e=V(U.current);null==O||O(e)}else null==O||O(E)}),[M,ne]);const oe=null!=w?w:h,re="number"==typeof oe?x&&g?oe-96:x&&!g||!x&&g?oe-48:oe:oe;t.useEffect((()=>{const e=null!=b?b:S;if(null===$)Y(e);else if("number"==typeof e)Y(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));Y(t)}}),[$]);const ie=[],se=(_&&y?K:E).map((e=>{var t,n;if(_&&!y){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(_.toLowerCase()))&&(ie.push(!_||e.label===_),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(_.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(_.toLowerCase()))?(ie.push(!_||e.label===_),e):null}return e})).filter((e=>null!==e)),le=!!x&&_&&0===se.length;return e.jsxs(c.OpennedDropdownContainer,Object.assign({version:C,ref:te,style:Object.assign({width:X},Z)},{children:[e.jsxs("div",Object.assign({style:{width:$?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:P,version:C}),se.length||_?e.jsxs(c.MenuListContainer,Object.assign({minHeight:oe,maxHeight:re},{children:[!!g&&!le&&!q&&e.jsx(u.SelectAllMenu,{version:C,options:_&&y?K:E,onSelect:W}),!v&&le&&e.jsx(p.SearchZeroState,{isLoading:I,height:re,searchedString:_}),v&&(le||!!ie.length&&ie.every((e=>!1===e)))&&e.jsx(s.FreeFormMenu,{version:C,isMultiSelect:g,onSelect:J,searchedString:_}),e.jsx(l.MenuList,{onInfiniteScroll:F,onDropdownItemClick:A,version:C,onSelect:N,showDescription:function(e,t){ee(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:se,useDefaultCursor:T,ref:ne})]})):e.jsx("div",Object.assign({style:{height:oe,display:"flex"}},{children:e.jsx(n.ZeroState,{title:(null==z?void 0:z.title)||"No results found",subTitle:(null==z?void 0:z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",actionButton:null==z?void 0:z.actionButton})})),!!g&&!(!se.length&&!_)&&"2.0"!==C&&e.jsx(a.default,{onClear:()=>{G(),null==k||k()},onApply:Q,list:_&&y?K:E,buttonText:L,buttonOptions:B})]})),!!$&&e.jsx(i.Description,{title:$.title,description:$.description,version:C})]}))};
@@ -31,10 +31,7 @@ export interface OpenDropdownProps {
31
31
  'data-test'?: string;
32
32
  containerStyle?: React.CSSProperties;
33
33
  zeroState?: {
34
- Icon?: React.ReactNode;
35
- IconHolderStyle?: React.CSSProperties;
36
34
  actionButton?: ButtonProps;
37
- buttonWidth?: number;
38
35
  title: string;
39
36
  subTitle?: string;
40
37
  };
@@ -7,6 +7,7 @@ export type ShimmerImageProps = {
7
7
  borderRadius?: number;
8
8
  defaultImageUrl?: string;
9
9
  useDynamicInfoImageSize?: boolean;
10
+ imagePreviewStyles?: React.CSSProperties;
10
11
  };
11
12
  export declare const DEFAULT_IMAGE = "https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";
12
13
  export declare const ShimmerImage: React.FC<ShimmerImageProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("../shimmer/ShimmerComponent/BikShimmer.js");const r="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=r,exports.ShimmerImage=s=>{let{imageUrl:a,width:o,height:l,borderRadius:n,alt:c,useDynamicInfoImageSize:d,defaultImageUrl:m=r}=s;const[u,h]=t.useState(!0),[g,b]=t.useState(!1);return t.useEffect((()=>{const e=new Image;return e.src=a,e.onload=()=>{b(!1),h(!1)},e.onerror=()=>{b(!0),h(!1)},()=>{e.onload=null,e.onerror=null}}),[a]),e.jsxs("div",Object.assign({style:Object.assign(Object.assign({position:"relative",width:d?`min(100%, ${o}px)`:o},d?{aspectRatio:1}:{height:l}),{borderRadius:n})},{children:[u&&e.jsx(i.BikShimmer,{boxes:[{height:`${l}px`,width:`${o}px`,marginTop:"0px"}]}),g?e.jsx("img",{src:m,alt:null!=c?c:"Image",style:{borderRadius:null!=n?n:0,display:"block",width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("img",{src:a,alt:null!=c?c:"Image",style:{borderRadius:null!=n?n:0,display:u?"none":"block",width:"100%",height:"100%",objectFit:"cover"}})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("../shimmer/ShimmerComponent/BikShimmer.js");const r="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=r,exports.ShimmerImage=s=>{let{imageUrl:a,width:o,height:l,borderRadius:n,alt:c,useDynamicInfoImageSize:m,defaultImageUrl:d=r,imagePreviewStyles:u}=s;const[g,h]=t.useState(!0),[b,p]=t.useState(!1);return t.useEffect((()=>{const e=new Image;return e.src=a,e.onload=()=>{p(!1),h(!1)},e.onerror=()=>{p(!0),h(!1)},()=>{e.onload=null,e.onerror=null}}),[a]),e.jsxs("div",Object.assign({style:Object.assign(Object.assign({position:"relative",width:m?`min(100%, ${o}px)`:o},m?{aspectRatio:1}:{height:l}),{borderRadius:n})},{children:[g&&e.jsx(i.BikShimmer,{boxes:[{height:`${l}px`,width:`${o}px`,marginTop:"0px"}]}),b?e.jsx("img",{src:d,alt:null!=c?c:"Image",style:{borderRadius:null!=n?n:0,display:"block",width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("img",{src:a,alt:null!=c?c:"Image",style:Object.assign({borderRadius:null!=n?n:0,display:g?"none":"block",width:"100%",height:"100%",objectFit:"cover"},u)})]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),i=require("../modals/styledModal.js"),r=require("../template-preview/models/Channels.js"),s=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateAnalyticsComponent.js"),c=require("./modalElements/TemplateSelectModalContent.js"),p=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=v=>{var m,C,h,b,S,E,f,x,P,T;const{selectedTemplate:g,closeDialog:y,showVariableMapping:I,channel:L,htmlContent:A,templateVariables:D,onTemplateSelect:j,globalPlaceholders:w,showOnlyContent:k,whatsappSpecificPickerMeta:H,zIndex:N,showVariableModal:V,variableList:M,discountCode:O,setDiscountCode:B,onBackPress:q,enabledCustomText:F,variableListForImage:_,showSampleValues:W,disableEditVariable:Y,pod:R,extras:$,pickerConf:U,selectedCarouselProducts:z,disableEditExpiry:Q,cardWidth:G,onDeleteSelectedProducts:J,fileName:K,setFileName:X,hideDeviceContainerInPreview:Z,maxCharLimit:ee,onDefaultVariableSelect:te,skipDefaultVariableContent:le,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re,footerButtonText:se,footerInfoText:ne,templateAnalytics:de}=v;l.useEffect((()=>{be(A)}),[A]);const ue=L===r.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(C=null===(m=null==g?void 0:g.components)||void 0===m?void 0:m[1])||void 0===C?void 0:C.type),ce=null==g?void 0:g.isProductCarouselType,[pe,ve]=l.useState(L===r.CHANNEL_TYPE.EMAIL||L==r.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,Ce]=l.useState(!1),[he,be]=l.useState(A),[Se,Ee]=l.useState(!1),[fe,xe]=l.useState([]),[Pe,Te]=l.useState({}),[ge,ye]=l.useState(g),[Ie,Le]=l.useState([]),[Ae,De]=l.useState(null),[je,we]=l.useState(!1),[ke,He]=l.useState(null!=D?D:[]),[Ne,Ve]=l.useState(!1),[Me,Oe]=l.useState(ue?(null===(b=null===(h=null==ge?void 0:ge.mapping)||void 0===h?void 0:h.body)||void 0===b?void 0:b.length)?-1:0:-1),[Be,qe]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,Re]=l.useState(!1),[$e,Ue]=l.useState(!1),[ze,Qe]=l.useState(!1),[Ge,Je]=l.useState(!0),[Ke,Xe]=l.useState(!0),[Ze,et]=l.useState({});l.useEffect((()=>{z?qe(z):ce&&qe([])}),[z]),l.useEffect((()=>{var e;if(!je&&ce&&(!z||0===qe.length)){const t=null===(e=null==ge?void 0:ge.components)||void 0===e?void 0:e[1].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,a;"HEADER"===e.type&&l.push(null!==(a=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),Le(l),we(!0)}}),[je]);const tt=l.useMemo((()=>p.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(t.cloneDeep(M))}),[M]),(null==de?void 0:de.show)&&Ge&&de.templateQuality&&Object.values(s.TEMPLATE_QUALITY).find((e=>e===String(de.templateQuality)))?e.jsx(u.TemplateAnalyticsComponent,{headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(S=null==ge?void 0:ge.category)&&void 0!==S?S:"")} • ${null!==(E=null==ge?void 0:ge.templateCategory)&&void 0!==E?E:""}`:"",templateAnalytics:de,onClose:()=>{null==y||y(),Je(!1),Xe(!1)},onCancel:()=>{Je(!1),Xe(!1)},onProceed:()=>{Je(!1),Xe(!0)},templateId:(null==ge?void 0:ge.templateId)||""}):e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:ze,setHideFooterButton:Qe,hideCrossButton:$e,setHideCrossButton:Ue,variableList:Fe,setVariableList:_e,variableCallback:Ae,setVariableCallback:De,showVariablePicker:me,setShowVariablePicker:Ce,template:ge,setTemplate:ye,device:pe,setDevice:ve,display_content:he,setDisplayContent:be,originalVariableList:ke,setOriginalVariableList:He,isError:Se,setIsError:Ee,channel:L,globalNormalizedPlaceholders:tt,templateSelectionTriggered:Ne,setTemplateSelectionTriggered:Ve,enabledCustomText:F,disableEditVariable:Y,pod:R,extras:$,isWhatsappCarousel:ue,selectedCarouselIndex:Me,setSelectedCarouselIndex:Oe,isProductCarouselType:ce,templateErrorIndexes:Pe,cardCount:ue?null===(x=null===(f=g.components)||void 0===f?void 0:f[1].cards)||void 0===x?void 0:x.length:void 0,errorIndexes:fe,setErrorIndexes:xe,pickerConf:U,carouselProducts:Be,setCarouselProducts:qe,disableEditExpiry:Q,cardWidth:G,cardImages:Ie,onDeleteSelectedProducts:J,hideDeviceContainerInPreview:Z,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:Re,maxCharLimit:ee,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:te,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re}},{children:k?e.jsx(c.default,{variableListFromProps:M,channel:r.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(i.StyledModal,Object.assign({hideCrossButton:$e,zIndex:N,centralContainerStyles:{width:ue?900:L===r.CHANNEL_TYPE.EMAIL&&I?1e3:800},open:Ke,onClose:()=>{Xe(!1),null==y||y()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(P=null==ge?void 0:ge.category)&&void 0!==P?P:"")} • ${null!==(T=null==ge?void 0:ge.templateCategory)&&void 0!==T?T:""}`:"",onBackPress:()=>{if(null==de?void 0:de.show)return Je(!0),void Xe(!1);null==q||q()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(c.default,{variableListFromProps:M,showSampleValues:W,showVariableMapping:I,channel:L,whatsappSpecificPickerMeta:H,showVariableModal:V,discountCode:O,setDiscountCode:B,variableListForImage:_&&(null==_?void 0:_.length)>0?_:Fe,fileName:K,setFileName:e=>{null==X||X(e)},skipDefaultVariableContent:le}),j?e.jsx(d.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e;if((null==Be?void 0:Be.length)<1&&ce)return void Ee(!0);if(Object.keys(Ze).length>0&&R!==s.POD.CHATBOT)return void Ee(!0);const t=null==j?void 0:j(ge,ke,null!=he?he:"",Be);Te(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&xe(t.errorIndexes),(null==t?void 0:t.error)&&Ee(!!(null==t?void 0:t.error))):Ve(!0)},footerButtonText:se,footerInfoText:ne}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),a=require("../../utils/StringUtils.js"),o=require("../../constants/Theme.js"),i=require("../modals/styledModal.js"),r=require("../template-preview/helpers/templateMiscHelper.js"),s=require("../template-preview/models/Channels.js"),n=require("../template-preview/models/WhatsAppTemplate.js"),d=require("./context/templateModalContext.js"),u=require("./modalElements/Footer.js"),c=require("./modalElements/TemplateAnalyticsComponent.js"),p=require("./modalElements/TemplateSelectModalContent.js"),v=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=m=>{var C,h,b,S,E,x,f,T;const{selectedTemplate:P,closeDialog:g,showVariableMapping:y,channel:I,htmlContent:L,templateVariables:j,onTemplateSelect:D,globalPlaceholders:w,showOnlyContent:A,whatsappSpecificPickerMeta:k,zIndex:M,showVariableModal:V,variableList:H,discountCode:N,setDiscountCode:O,onBackPress:q,enabledCustomText:B,variableListForImage:F,showSampleValues:_,disableEditVariable:W,pod:Y,extras:R,pickerConf:$,selectedCarouselProducts:z,disableEditExpiry:Q,cardWidth:U,onDeleteSelectedProducts:G,fileName:J,setFileName:K,hideDeviceContainerInPreview:X,maxCharLimit:Z,onDefaultVariableSelect:ee,skipDefaultVariableContent:te,disableDatePicker:le,disableCopyCode:ae,initialExpiryDateTime:oe,showDiscountCodeExpiryInfo:ie,footerButtonText:re,footerInfoText:se,templateAnalytics:ne}=m;l.useEffect((()=>{be(L)}),[L]);const de=r.determineCardIndex(I),ue=r.isItCarousal(I,P),ce=null==P?void 0:P.isProductCarouselType,[pe,ve]=l.useState(I===s.CHANNEL_TYPE.EMAIL||I==s.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,Ce]=l.useState(!1),[he,be]=l.useState(L),[Se,Ee]=l.useState(!1),[xe,fe]=l.useState([]),[Te,Pe]=l.useState({}),[ge,ye]=l.useState(P),[Ie,Le]=l.useState([]),[je,De]=l.useState(null),[we,Ae]=l.useState(!1),[ke,Me]=l.useState(null!=j?j:[]),[Ve,He]=l.useState(!1),[Ne,Oe]=l.useState(ue?(null===(h=null===(C=null==ge?void 0:ge.mapping)||void 0===C?void 0:C.body)||void 0===h?void 0:h.length)?-1:0:-1),[qe,Be]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,Re]=l.useState(!1),[$e,ze]=l.useState(!1),[Qe,Ue]=l.useState(!1),[Ge,Je]=l.useState(!0),[Ke,Xe]=l.useState(!0),[Ze,et]=l.useState({});l.useEffect((()=>{z?Be(z):ce&&Be([])}),[z]),l.useEffect((()=>{var e;if(!we&&ce&&(!z||0===Be.length)){const t=null===(e=null==ge?void 0:ge.components)||void 0===e?void 0:e[de].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,a,o;"HEADER"===e.type&&l.push(null!==(o=null===(a=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===a?void 0:a[0])&&void 0!==o?o:"")}))})),Le(l),Ae(!0)}}),[we]);const tt=l.useMemo((()=>v.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(t.cloneDeep(H))}),[H]),(null==ne?void 0:ne.show)&&Ge&&ne.templateQuality&&Object.values(n.TEMPLATE_QUALITY).find((e=>e===String(ne.templateQuality)))?e.jsx(c.TemplateAnalyticsComponent,{headingTitle:null==ge?void 0:ge.label,headingSubtitle:I===s.CHANNEL_TYPE.WHATSAPP?`${a.default.capitaliseFirstLetterOfString(null!==(b=null==ge?void 0:ge.category)&&void 0!==b?b:"")} • ${null!==(S=null==ge?void 0:ge.templateCategory)&&void 0!==S?S:""}`:"",templateAnalytics:ne,onClose:()=>{null==g||g(),Je(!1),Xe(!1)},onCancel:()=>{Je(!1),Xe(!1)},onProceed:()=>{Je(!1),Xe(!0)},templateId:(null==ge?void 0:ge.templateId)||""}):e.jsx(d.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Qe,setHideFooterButton:Ue,hideCrossButton:$e,setHideCrossButton:ze,variableList:Fe,setVariableList:_e,variableCallback:je,setVariableCallback:De,showVariablePicker:me,setShowVariablePicker:Ce,template:ge,setTemplate:ye,device:pe,setDevice:ve,display_content:he,setDisplayContent:be,originalVariableList:ke,setOriginalVariableList:Me,isError:Se,setIsError:Ee,channel:I,globalNormalizedPlaceholders:tt,templateSelectionTriggered:Ve,setTemplateSelectionTriggered:He,enabledCustomText:B,disableEditVariable:W,pod:Y,extras:R,isWhatsappCarousel:ue,selectedCarouselIndex:Ne,setSelectedCarouselIndex:Oe,isProductCarouselType:ce,templateErrorIndexes:Te,cardCount:ue?null===(x=null===(E=P.components)||void 0===E?void 0:E[de].cards)||void 0===x?void 0:x.length:void 0,errorIndexes:xe,setErrorIndexes:fe,pickerConf:$,carouselProducts:qe,setCarouselProducts:Be,disableEditExpiry:Q,cardWidth:U,cardImages:Ie,onDeleteSelectedProducts:G,hideDeviceContainerInPreview:X,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:Re,maxCharLimit:Z,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:ee,disableDatePicker:le,disableCopyCode:ae,initialExpiryDateTime:oe,showDiscountCodeExpiryInfo:ie,cardIndex:de}},{children:A?e.jsx(p.default,{variableListFromProps:H,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(i.StyledModal,Object.assign({hideCrossButton:$e,zIndex:M,centralContainerStyles:{width:ue?900:I===s.CHANNEL_TYPE.EMAIL&&y?1e3:800},open:Ke,onClose:()=>{Xe(!1),null==g||g()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:I===s.CHANNEL_TYPE.WHATSAPP||r.isRCSChannel(I)?`${a.default.capitaliseFirstLetterOfString(null!==(f=null==ge?void 0:ge.category)&&void 0!==f?f:"")} • ${null!==(T=null==ge?void 0:ge.templateCategory)&&void 0!==T?T:""}`:"",onBackPress:()=>{if(null==ne?void 0:ne.show)return Je(!0),void Xe(!1);null==q||q()},modalHeaderStyles:{borderBottom:`1px solid ${o.COLORS.stroke.primary}`}},{children:[e.jsx(p.default,{variableListFromProps:H,showSampleValues:_,showVariableMapping:y,channel:I,whatsappSpecificPickerMeta:k,showVariableModal:V,discountCode:N,setDiscountCode:O,variableListForImage:F&&(null==F?void 0:F.length)>0?F:Fe,fileName:J,setFileName:e=>{null==K||K(e)},skipDefaultVariableContent:te}),D?e.jsx(u.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e;if((null==qe?void 0:qe.length)<1&&ce)return void Ee(!0);if(Object.keys(Ze).length>0&&Y!==n.POD.CHATBOT)return void Ee(!0);const t=null==D?void 0:D(ge,ke,null!=he?he:"",qe);Pe(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&fe(t.errorIndexes),(null==t?void 0:t.error)&&Ee(!!(null==t?void 0:t.error))):He(!0)},footerButtonText:re,footerInfoText:se}):e.jsx(e.Fragment,{})]}))}))};
@@ -78,6 +78,7 @@ export declare const TemplateModalContext: React.Context<{
78
78
  [key: string]: string;
79
79
  }>> | undefined;
80
80
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
81
+ cardIndex: number;
81
82
  }>;
82
83
  export declare const useTemplateModalContext: () => {
83
84
  showDiscountCodeExpiryInfo?: boolean | undefined;
@@ -149,4 +150,5 @@ export declare const useTemplateModalContext: () => {
149
150
  [key: string]: string;
150
151
  }>> | undefined;
151
152
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
153
+ cardIndex: number;
152
154
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../template-preview/models/Channels.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=a(e).default.createContext({hideFooterButton:!1,setHideFooterButton:()=>{},hideCrossButton:!1,setHideCrossButton:()=>{},variableList:[],setVariableList:()=>{},variableCallback:null,setVariableCallback:null,showVariablePicker:!1,setShowVariablePicker:()=>{},device:"desktop",templateSelectionTriggered:!1,display_content:null,originalVariableList:[],channel:t.CHANNEL_TYPE.EMAIL,template:null,isError:!1,enabledCustomText:!1,disableEditVariable:!1,disableEditExpiry:!1,disableDatePicker:!1,showDiscountCodeExpiryInfo:!1});exports.TemplateModalContext=l,exports.useTemplateModalContext=()=>e.useContext(l);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../template-preview/models/Channels.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=a(e).default.createContext({hideFooterButton:!1,setHideFooterButton:()=>{},hideCrossButton:!1,setHideCrossButton:()=>{},variableList:[],setVariableList:()=>{},variableCallback:null,setVariableCallback:null,showVariablePicker:!1,setShowVariablePicker:()=>{},device:"desktop",templateSelectionTriggered:!1,display_content:null,originalVariableList:[],channel:t.CHANNEL_TYPE.EMAIL,template:null,isError:!1,enabledCustomText:!1,disableEditVariable:!1,disableEditExpiry:!1,disableDatePicker:!1,showDiscountCodeExpiryInfo:!1,cardIndex:-1});exports.TemplateModalContext=l,exports.useTemplateModalContext=()=>e.useContext(l);
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var a=require("../../variable-picker-v3/model.js"),t=require("lodash"),i=require("react"),l=require("styled-components"),r=require("../../carousel-preview/CarouselPreview.js"),s=require("./EditWhatsAppCarouselTemplateV2.js"),o=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var n=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js"),require("../../template-preview/models/WhatsAppTemplate.js");var p=require("../../template-preview/models/Channels.js"),d=require("../../TypographyStyle.js"),u=require("../../variable-picker-v3/VariablePicker.js"),c=require("../context/templateModalContext.js"),h=require("../utils/constants.js"),m=require("../utils/getVariableNameEmail.js"),v=require("../utils/highlightFor.js"),w=require("./DesktopPreview.js"),C=require("./EditWebpushTemplate.js"),P=require("./EditWhatsAppTemplateV2.js"),b=require("./MobilePreview.js"),E=require("./VariableConnectorsPanel.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=f(l);const j=x.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var a=require("../../variable-picker-v3/model.js"),t=require("lodash"),i=require("react"),l=require("styled-components"),r=require("../../carousel-preview/CarouselPreview.js"),s=require("./EditWhatsAppCarouselTemplateV2.js"),o=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var n=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js"),require("../../template-preview/models/WhatsAppTemplate.js");var p=require("../../template-preview/models/Channels.js"),d=require("../../TypographyStyle.js"),u=require("../../variable-picker-v3/VariablePicker.js"),c=require("../context/templateModalContext.js"),h=require("../utils/constants.js"),m=require("../utils/getVariableNameEmail.js"),C=require("../utils/highlightFor.js"),v=require("./DesktopPreview.js"),P=require("./EditWebpushTemplate.js"),w=require("./EditWhatsAppTemplateV2.js"),E=require("./MobilePreview.js"),b=require("./VariableConnectorsPanel.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=f(l);const A=x.default.div`
2
2
  display: flex;
3
3
  // height: 100%;
4
- `,g=x.default.div`
4
+ `,j=x.default.div`
5
5
  max-width: 450px;
6
6
  max-width: ${e=>e.channel===p.CHANNEL_TYPE.EMAIL?"400px":"450px"};
7
7
 
@@ -11,12 +11,12 @@
11
11
  border-left: ${n.COLORS.stroke.primary} 1px solid;
12
12
  border-top: ${e=>e.isWhatsappCarousel?`${n.COLORS.stroke.primary} 1px solid`:void 0};
13
13
  ${e=>!e.showVariableMapping&&"width: 340px; height: 500px"};
14
- `,A=x.default.div`
14
+ `,N=x.default.div`
15
15
  padding: ${e=>e.isWhatsappCarousel?void 0:e.showOnlyContent?"16px 14px":"16px 32px"};
16
16
  flex: 1;
17
17
  height: ${e=>e.isWhatsappCarousel||e.hideDeviceContainerInPreview?"500px":"475px"};
18
18
  overflow-y: auto;
19
19
  background-image: ${e=>e.hideDeviceContainerInPreview&&e.channel===p.CHANNEL_TYPE.WHATSAPP?`url(${h.BACKGROUND_PREVIEW_IMAGE});`:"none"};
20
- display: ${e=>e.hideDeviceContainerInPreview&&e.channel===p.CHANNEL_TYPE.WHATSAPP?"flex":"initial"};
20
+ display: ${e=>!e.hideDeviceContainerInPreview||e.channel!==p.CHANNEL_TYPE.WHATSAPP&&e.channel!==p.CHANNEL_TYPE.RCS?"initial":"flex"};
21
21
  align-items: flex-start;
22
- `;exports.default=l=>{const{showVariableMapping:h,showOnlyContent:f,whatsappSpecificPickerMeta:x,showVariableModal:T,discountCode:N,setDiscountCode:S,variableListForImage:y,showSampleValues:k,variableListFromProps:L,fileName:V,setFileName:H,skipDefaultVariableContent:W}=l,q=i.useRef(),M=i.useRef(),{variableList:_,setVariableList:D,variableCallback:O,showVariablePicker:I,setShowVariablePicker:Y,device:B,display_content:F,channel:$,template:R,setTemplate:G,isWhatsappCarousel:U,isProductCarouselType:K,hideDeviceContainerInPreview:z,onDefaultVariableSelect:J}=c.useTemplateModalContext();const Q=e=>{let a=0;for(;e;)a+=e.offsetTop,e=e.offsetParent;return a};return e.jsxs(j,{children:[e.jsx(A,Object.assign({showOnlyContent:f,showVariableMapping:h,isWhatsappCarousel:U,hideDeviceContainerInPreview:z,channel:$,skipDefaultVariableContent:W},{children:"mobile"===B?e.jsx(b.default,{ref:M,display_content:null!=F?F:"",channel:$,template:R,showSampleValues:k}):$===p.CHANNEL_TYPE.WHATSAPP&&U?e.jsx(r.CarouselPreview,{ref:q,channel:$,template:R,showSampleValues:k,isPreview:!1,showArrows:!0}):$===p.CHANNEL_TYPE.WEBPUSH?e.jsx(o.TemplatePreview,{showSampleValues:k,channel:$,hideHeader:!0,template:R}):$!==p.CHANNEL_TYPE.MESSAGE?e.jsx(w.default,{ref:q,channel:$,display_content:null!=F?F:"",showSampleValues:k}):e.jsx(e.Fragment,{})})),(K||h)&&e.jsxs(g,Object.assign({channel:$,isWhatsappCarousel:U,showVariableMapping:!0},{children:[e.jsx("div",Object.assign({style:{height:"100%",width:"whatsapp"===$?428:400,display:I?"block":"none"}},{children:e.jsx(u.VariablePicker,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>{D(t.cloneDeep(L)),Y(!1)},onSelect:e=>{O(e),D(t.cloneDeep(L)),Y(!1)},type:a.PickerType.EMBEDDED,data:null!=_?_:[],onDefaultVariableSelect:J,skipDefaultVariableContent:W},Math.random())})),e.jsx("div",Object.assign({style:{padding:"16px 14px",width:"whatsapp"===$||"webpush"==$?428:400,display:I?"none":"block"}},{children:$!==p.CHANNEL_TYPE.WHATSAPP?$==p.CHANNEL_TYPE.WEBPUSH?e.jsx(C.default,{whatsappSpecificPickerMeta:x,template:R,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T}):e.jsx(E.default,{onFocus:$===p.CHANNEL_TYPE.EMAIL?function(e){var a,t,i;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===B?"template_html_mobile":"template_html_desktop"),r=m.getVariableNameForEmailByIndex(e+1),s=$===p.CHANNEL_TYPE.EMAIL?null===(a=null==l?void 0:l.contentWindow)||void 0===a?void 0:a.document.getElementById(r):document.getElementById(r),o=Q(s),d=null==s?void 0:s.offsetLeft;"desktop"===B?o&&q.current&&(null===(t=null==l?void 0:l.contentWindow)||void 0===t||t.scrollTo(null!=d?d:0,o),v.highlightFor(r,n.COLORS.background.warning.light,2,$,B)):o&&M.current&&(null===(i=null==l?void 0:l.contentWindow)||void 0===i||i.scrollTo(null!=d?d:0,o),v.highlightFor(r,n.COLORS.background.warning.light,2,$,B))}:void 0,showVariableModal:T,discountCode:N,setDiscountCode:S}):$===p.CHANNEL_TYPE.WHATSAPP&&U?e.jsx(s.default,{whatsappSpecificPickerMeta:x,template:R,showVariableModal:T,variableListForImage:y,discountCode:N,setDiscountCode:S}):e.jsx(P.default,{whatsappSpecificPickerMeta:x,template:R,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T,variableListForImage:y,discountCode:N,setDiscountCode:S,fileName:V,setFileName:H})}))]})),[p.CHANNEL_TYPE.WHATSAPP,p.CHANNEL_TYPE.SMS].includes($)&&!h&&!K&&e.jsx(g,{children:e.jsx(d.BodySecondary,Object.assign({color:n.COLORS.content.secondary,style:{fontStyle:"italic"}},{children:"Click on ‘Select template’ below to use it"}))})]})};
22
+ `;exports.default=l=>{const{showVariableMapping:h,showOnlyContent:f,whatsappSpecificPickerMeta:x,showVariableModal:T,discountCode:g,setDiscountCode:S,variableListForImage:L,showSampleValues:y,variableListFromProps:H,fileName:k,setFileName:V,skipDefaultVariableContent:_}=l,W=i.useRef(),q=i.useRef(),{variableList:M,setVariableList:D,variableCallback:O,showVariablePicker:Y,setShowVariablePicker:I,device:B,display_content:R,channel:F,template:$,setTemplate:G,isWhatsappCarousel:U,isProductCarouselType:K,hideDeviceContainerInPreview:z,onDefaultVariableSelect:J}=c.useTemplateModalContext();const Q=e=>{let a=0;for(;e;)a+=e.offsetTop,e=e.offsetParent;return a};return e.jsxs(A,{children:[e.jsx(N,Object.assign({showOnlyContent:f,showVariableMapping:h,isWhatsappCarousel:U,hideDeviceContainerInPreview:z,channel:F,skipDefaultVariableContent:_},{children:"mobile"===B?e.jsx(E.default,{ref:q,display_content:null!=R?R:"",channel:F,template:$,showSampleValues:y}):F!==p.CHANNEL_TYPE.WHATSAPP&&F!==p.CHANNEL_TYPE.RCS||!U?F===p.CHANNEL_TYPE.WEBPUSH?e.jsx(o.TemplatePreview,{showSampleValues:y,channel:F,hideHeader:!0,template:$}):F!==p.CHANNEL_TYPE.MESSAGE?e.jsx(v.default,{ref:W,channel:F,display_content:null!=R?R:"",showSampleValues:y}):e.jsx(e.Fragment,{}):e.jsx(r.CarouselPreview,{ref:W,channel:F,template:$,showSampleValues:y,isPreview:!1,showArrows:!0})})),(K||h)&&e.jsxs(j,Object.assign({channel:F,isWhatsappCarousel:U,showVariableMapping:!0},{children:[e.jsx("div",Object.assign({style:{height:"100%",width:"whatsapp"===F?428:400,display:Y?"block":"none"}},{children:e.jsx(u.VariablePicker,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>{D(t.cloneDeep(H)),I(!1)},onSelect:e=>{O(e),D(t.cloneDeep(H)),I(!1)},type:a.PickerType.EMBEDDED,data:null!=M?M:[],onDefaultVariableSelect:J,skipDefaultVariableContent:_},Math.random())})),e.jsx("div",Object.assign({style:{padding:"16px 14px",width:"whatsapp"===F||"webpush"==F||"rcs"==F?428:400,display:Y?"none":"block"}},{children:F!==p.CHANNEL_TYPE.WHATSAPP&&F!==(null===p.CHANNEL_TYPE||void 0===p.CHANNEL_TYPE?void 0:p.CHANNEL_TYPE.RCS)?F==p.CHANNEL_TYPE.WEBPUSH?e.jsx(P.default,{whatsappSpecificPickerMeta:x,template:$,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T}):e.jsx(b.default,{onFocus:F===p.CHANNEL_TYPE.EMAIL?function(e){var a,t,i;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===B?"template_html_mobile":"template_html_desktop"),r=m.getVariableNameForEmailByIndex(e+1),s=F===p.CHANNEL_TYPE.EMAIL?null===(a=null==l?void 0:l.contentWindow)||void 0===a?void 0:a.document.getElementById(r):document.getElementById(r),o=Q(s),d=null==s?void 0:s.offsetLeft;"desktop"===B?o&&W.current&&(null===(t=null==l?void 0:l.contentWindow)||void 0===t||t.scrollTo(null!=d?d:0,o),C.highlightFor(r,n.COLORS.background.warning.light,2,F,B)):o&&q.current&&(null===(i=null==l?void 0:l.contentWindow)||void 0===i||i.scrollTo(null!=d?d:0,o),C.highlightFor(r,n.COLORS.background.warning.light,2,F,B))}:void 0,showVariableModal:T,discountCode:g,setDiscountCode:S}):F!==p.CHANNEL_TYPE.WHATSAPP&&F!==p.CHANNEL_TYPE.RCS||!U?e.jsx(w.default,{whatsappSpecificPickerMeta:x,template:$,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T,variableListForImage:L,discountCode:g,setDiscountCode:S,fileName:k,setFileName:V}):e.jsx(s.default,{whatsappSpecificPickerMeta:x,template:$,showVariableModal:T,variableListForImage:L,discountCode:g,setDiscountCode:S})}))]})),[p.CHANNEL_TYPE.WHATSAPP,p.CHANNEL_TYPE.SMS].includes(F)&&!h&&!K&&e.jsx(j,{children:e.jsx(d.BodySecondary,Object.assign({color:n.COLORS.content.secondary,style:{fontStyle:"italic"}},{children:"Click on ‘Select template’ below to use it"}))})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/arrow_back.svg.js"),l=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../Badge/index.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var m=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var h=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var g=require("../../TypographyStyle.js");exports.default=x=>{let{template:y,whatsappSpecificPickerMeta:j,showVariableModal:f,variableListForImage:b,discountCode:C,setDiscountCode:O}=x;var I,S,P,q,w,k,T,B;const{selectedCarouselIndex:L,setTemplate:R,pickerConf:E,isProductCarouselType:M,pod:D,cardCount:A,carouselProducts:F,setCarouselProducts:V,isError:W,cardImages:N,disableEditVariable:$,onDeleteSelectedProducts:_,setSelectedCarouselIndex:z,setVariableCallback:G,setShowVariablePicker:H,sliderRef:J}=u.useTemplateModalContext(),[K,Q]=r.useState(-1==L?"First Message (Step 1/2)":M?"Product Carousel "+((null===(S=null===(I=null==y?void 0:y.mapping)||void 0===I?void 0:I.body)||void 0===S?void 0:S.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(q=null===(P=null==y?void 0:y.mapping)||void 0===P?void 0:P.body)||void 0===q?void 0:q.length)?"(Step 2/2)":"")),[U,X]=r.useState(!1),[Y,Z]=r.useState(!1),ee=L===(null!=A?A:-1)-1,te=(null!=L?L:-1)<1;r.useEffect((()=>{var e,t,l,n;Q(-1==L?"First Message (Step 1/2)":M?"Product Carousel "+((null===(t=null===(e=null==y?void 0:y.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==y?void 0:y.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[L]);const le=e=>{null==V||V([{name:"variable",productName:e.actualValue}])};return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[null!=L&&L>=0&&!!(null===(k=null===(w=null==y?void 0:y.mapping)||void 0===w?void 0:w.body)||void 0===k?void 0:k.length)&&e.jsx(s.IconButton,{Icon:t.default,onClick:()=>{null==z||z(-1)}}),e.jsx(g.TitleMedium,Object.assign({style:{marginLeft:10}},{children:K}))]})),M&&(null!==(T=null==F?void 0:F.length)&&void 0!==T?T:0)>0&&null!=L&&L>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(v.ProductBox,{editItem:()=>{1===(null==F?void 0:F.length)&&"variable"===F[0].name?(G((()=>le)),H(!0)):X(!U)},cardBody:1===(null==F?void 0:F.length)&&"variable"===F[0].name?`${F[0].productName}`:`${null==F?void 0:F.length} Products Selected`,hideIcon:1===(null==F?void 0:F.length)&&"variable"===F[0].name,deleteItem:()=>{var e;if(1===(null==F?void 0:F.length)&&"variable"===F[0].name)return void(null==V||V([]));const t=o.cloneDeep(Object.assign({},y));t&&(N&&N.length>0?null==N||N.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=N[l])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==R||R(t)),null==V||V([]),null==_||_()}}),F&&(null==F?void 0:F.length)>0&&"variable"!=F[0].name&&e.jsx(a.Button,{disabled:(null!==(B=null==F?void 0:F.length)&&void 0!==B?B:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{Z(!0),X(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!$&&M&&0===(null==F?void 0:F.length)&&null!=L&&L>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(g.TitleRegular,{children:"Product(s)"}),e.jsx(g.BodySecondary,{children:`Select ${null!=A?A:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:W?16:12,marginRight:W?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:W?`2px dashed ${m.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:m.COLORS.content.secondary})})),onClick:e=>{X(!0)}}),D===h.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(g.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:W?`2px dashed ${m.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:m.COLORS.content.secondary})})),onClick:e=>{G((()=>le)),H(!0)}})]})]})),W&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(c.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!M&&(null!=L?L:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:m.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:l.default,disabled:te,width:8,height:14,svgStyle:te?{}:{color:m.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==J?void 0:J.current)||void 0===e||e.slickPrev(),(null!=L?L:-1)<1||null==z||z((e=>e-1))}}),e.jsx(g.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:m.COLORS.content.secondary},{children:`Card ${(null!=L?L:0)+1}/${A}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:ee,svgStyle:ee?{}:{color:m.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==J?void 0:J.current)||void 0===e||e.slickNext(),(null!=L?L:-1)>=(null!=A?A:-1)-1||null==z||z((e=>e+1))}})]})),e.jsx(p.default,{whatsappSpecificPickerMeta:j,template:y,onTemplateChange:e=>{null==R||R(e)},showVariableModal:f,variableListForImage:b,discountCode:C,setDiscountCode:O}),U&&E&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:Y?d.ScreenName.RearrangeProducts:d.ScreenName.Collections,rearrangeEnabled:!0,storeId:E.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=F?F:[]),collectionFetcher:E.fetchCollections,productFetcher:E.fetchProducts,onAdd:(e,t)=>{var l,n,i,r,a,s;Z(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:m,displayOrder:h}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:m,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},y));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==N?void 0:N[t])&&void 0!==l?l:""]})),null==R||R(p)),null==V||V(c),X(!1)},searchInCollectionFetcher:E.searchInCollection,searchFetcher:E.searchProducts,visible:U,onClose:()=>{X(!1)},exactLimit:null!=A?A:1})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("../../../assets/icons/arrow_back.svg.js"),t=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../Badge/index.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var m=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var g=require("../../template-preview/helpers/templateMiscHelper.js"),j=require("../../TypographyStyle.js");exports.default=x=>{let{template:y,whatsappSpecificPickerMeta:f,showVariableModal:b,variableListForImage:C,discountCode:O,setDiscountCode:S}=x;var I,q,w,P,k,T,B,L;const{selectedCarouselIndex:R,setTemplate:E,pickerConf:M,isProductCarouselType:D,pod:A,cardCount:F,carouselProducts:V,setCarouselProducts:W,isError:N,cardImages:$,disableEditVariable:_,onDeleteSelectedProducts:z,setSelectedCarouselIndex:G,setVariableCallback:H,setShowVariablePicker:J,sliderRef:K}=u.useTemplateModalContext(),[Q,U]=r.useState(g.isRCSChannel(null==y?void 0:y.channel)?"Carousel Cards":-1==R?"First Message (Step 1/2)":D?"Product Carousel "+((null===(q=null===(I=null==y?void 0:y.mapping)||void 0===I?void 0:I.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(P=null===(w=null==y?void 0:y.mapping)||void 0===w?void 0:w.body)||void 0===P?void 0:P.length)?"(Step 2/2)":"")),[X,Y]=r.useState(!1),[Z,ee]=r.useState(!1),le=R===(null!=F?F:-1)-1,te=(null!=R?R:-1)<1;r.useEffect((()=>{var e,l,t,n;U(g.isRCSChannel(null==y?void 0:y.channel)?"Carousel Cards":-1==R?"First Message (Step 1/2)":D?"Product Carousel "+((null===(l=null===(e=null==y?void 0:y.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[R]);const ne=e=>{null==W||W([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===R&&g.isRCSChannel(null==y?void 0:y.channel)&&(null==G||G(0))}),[R,null==y?void 0:y.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!g.isRCSChannel(null==y?void 0:y.channel)&&null!=R&&R>=0&&!!(null===(T=null===(k=null==y?void 0:y.mapping)||void 0===k?void 0:k.body)||void 0===T?void 0:T.length)&&e.jsx(s.IconButton,{Icon:l.default,onClick:()=>{null==G||G(-1)}}),e.jsx(j.TitleMedium,Object.assign({style:{marginLeft:10}},{children:Q}))]})),D&&(null!==(B=null==V?void 0:V.length)&&void 0!==B?B:0)>0&&null!=R&&R>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(v.ProductBox,{editItem:()=>{1===(null==V?void 0:V.length)&&"variable"===V[0].name?(H((()=>ne)),J(!0)):Y(!X)},cardBody:1===(null==V?void 0:V.length)&&"variable"===V[0].name?`${V[0].productName}`:`${null==V?void 0:V.length} Products Selected`,hideIcon:1===(null==V?void 0:V.length)&&"variable"===V[0].name,deleteItem:()=>{var e;if(1===(null==V?void 0:V.length)&&"variable"===V[0].name)return void(null==W||W([]));const l=o.cloneDeep(Object.assign({},y));l&&($&&$.length>0?null==$||$.forEach(((e,t)=>{var n;l.components[1].cards[t].components[0].example.header_handle=[null!==(n=$[t])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==l?void 0:l.components[1].cards)||void 0===e||e.forEach(((e,t)=>{l.components[1].cards[t].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==E||E(l)),null==W||W([]),null==z||z()}}),V&&(null==V?void 0:V.length)>0&&"variable"!=V[0].name&&e.jsx(a.Button,{disabled:(null!==(L=null==V?void 0:V.length)&&void 0!==L?L:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{ee(!0),Y(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!_&&D&&0===(null==V?void 0:V.length)&&null!=R&&R>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(j.TitleRegular,{children:"Product(s)"}),e.jsx(j.BodySecondary,{children:`Select ${null!=F?F:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:N?16:12,marginRight:N?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{Y(!0)}}),A===m.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(j.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{H((()=>ne)),J(!0)}})]})]})),N&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(c.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!D&&(null!=R?R:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:t.default,disabled:te,width:8,height:14,svgStyle:te?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==K?void 0:K.current)||void 0===e||e.slickPrev(),(null!=R?R:-1)<1||null==G||G((e=>e-1))}}),e.jsx(j.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=R?R:0)+1}/${F}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:le,svgStyle:le?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==K?void 0:K.current)||void 0===e||e.slickNext(),(null!=R?R:-1)>=(null!=F?F:-1)-1||null==G||G((e=>e+1))}})]})),e.jsx(p.default,{whatsappSpecificPickerMeta:f,template:y,onTemplateChange:e=>{null==E||E(e)},showVariableModal:b,variableListForImage:C,discountCode:O,setDiscountCode:S}),X&&M&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:Z?d.ScreenName.RearrangeProducts:d.ScreenName.Collections,rearrangeEnabled:!0,storeId:M.storeId,selectedItems:(e=>{if(e.length>0){const l={};for(const t of e){const e=null==t?void 0:t.collectionId,n=t.productId,i=t.variantId;e in l||(l[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in l[e].products||(l[e].products[n]={variants:{},name:(null==t?void 0:t.productName)||"",image:(null==t?void 0:t.productImage)||""}),l[e].products[n].variants[i]={name:(null==t?void 0:t.name)||"",price:"",image:(null==t?void 0:t.image)||"",quantity:t.quantity||0,displayOrder:t.displayOrder}}return l}return{}})(null!=V?V:[]),collectionFetcher:M.fetchCollections,productFetcher:M.fetchProducts,onAdd:(e,l)=>{var t,n,i,r,a,s;ee(!1);const d=[];delete e.isCustom;for(const l of Object.keys(e)){const o=e[l].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:h,displayOrder:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(t=o[e])||void 0===t?void 0:t.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:l,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,l)=>e.displayOrder-l.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},y));p&&(u.forEach(((e,l)=>{var t;p.components[1].cards[l].components[0].example.header_handle=e?[e]:[null!==(t=null==$?void 0:$[l])&&void 0!==t?t:""]})),null==E||E(p)),null==W||W(c),Y(!1)},searchInCollectionFetcher:M.searchInCollection,searchFetcher:M.searchProducts,visible:X,onClose:()=>{Y(!1)},exactLimit:null!=F?F:1})]}))};
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var n=require("../../variable-picker-v3/model.js"),t=require("lodash"),o=require("react"),i=require("styled-components"),l=require("../../input/Input.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../template-preview/models/TemplateMeta.js"),d=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../context/templateModalContext.js"),u=require("../utils/constants.js"),p=require("../utils/getDataFromTemplateComponent.js"),c=require("../utils/validateIsUrl.js"),v=require("../utils/validateName.js"),m=require("./BackTrackComponent.js"),b=require("./DiscountCodeComponent.js"),g=require("./EditMediaModal.js"),h=require("./EditMediaV2.js"),f=require("./EditMediaV2.style.js"),j=require("./useEditWhtasappTemplateMedia.js"),C=require("./VariableConnector.js"),T=require("./VariableConnectorsPanel.js"),x=require("./VariableConnectorWhatsApp.js"),O=require("./VariableEditorHeader.js"),E=require("./WhatsAppTemplateCardButtonV2.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const V=y(i).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var n=require("../../variable-picker-v3/model.js"),t=require("lodash"),o=require("react"),i=require("styled-components"),l=require("../../input/Input.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../template-preview/helpers/templateMiscHelper.js"),d=require("../../template-preview/models/TemplateMeta.js"),r=require("../../template-preview/models/WhatsAppTemplate.js"),u=require("../context/templateModalContext.js"),p=require("../utils/constants.js"),c=require("../utils/getDataFromTemplateComponent.js"),v=require("../utils/validateIsUrl.js"),m=require("../utils/validateName.js"),b=require("./BackTrackComponent.js"),g=require("./DiscountCodeComponent.js"),h=require("./EditMediaModal.js"),f=require("./EditMediaV2.js"),j=require("./EditMediaV2.style.js"),C=require("./useEditWhtasappTemplateMedia.js"),x=require("./VariableConnector.js"),T=require("./VariableConnectorsPanel.js"),O=require("./VariableConnectorWhatsApp.js"),y=require("./VariableEditorHeader.js"),E=require("./WhatsAppTemplateCardButtonV2.js");function V(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const B=V(i).default.div`
2
2
  padding-top: 24px;
3
3
  padding-left: 10px;
4
4
  padding-right: 10px;
5
5
  margin-bottom: 8px;
6
6
  line-height: normal;
7
- `;exports.default=i=>{let{template:y,onTemplateChange:B,whatsappSpecificPickerMeta:M,showVariableModal:k,variableListForImage:D,setDiscountCode:I,fileName:q,setFileName:R}=i;var P,L,A,U,w,N,_,H,S,F,Q,Y,W,K,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,re,ue,pe,ce,ve,me,be,ge,he,fe;const je=y.isCarouselType,{originalVariableList:Ce,pod:Te,extras:xe,selectedCarouselIndex:Oe,isProductCarouselType:Ee,disableCopyCode:ye,isError:Ve}=r.useTemplateModalContext(),{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}=p.getAllDataFromTemplateComponent(y),Re=o.useRef(null),[Pe,Le]=o.useState(!1),[Ae,Ue]=o.useState(-1===Oe?{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}:{}),{uploadMediaLink:we,uploadMediaFiles:Ne,validateMimeType:_e}=M,He=j.useEditWhatsappTemplateMedia({uploadMediaLink:we,uploadMediaFiles:Ne,updateTemplateImageUrl:function(e,n){var o,i,l,a,s,d,r,u;let p;p=null!=Oe&&Oe>-1?{components:null===(i=null===(o=y.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[Oe].components,mapping:null===(a=null===(l=null==y?void 0:y.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Oe]}:Object.assign({},y);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==p?void 0:p.components[c])){const t=Object.assign(Object.assign({},p.components[c]),{format:n,example:{header_handle:[e]}}),o=[...p.components];o[c]=t,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=Oe&&Oe>-1){const e=t.cloneDeep(y);e.components[1].cards[Oe].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.cards.length)>0&&(e.mapping.cards[Oe]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==B||B(Object.assign({},e)),Fe(!0)}else null==B||B(Object.assign({},p))},validateMimeType:_e,mediaComponent:je?Ae.imageComponent:De,fileRef:Re}),[Se,Fe]=o.useState(!1),[Qe,Ye]=o.useState(q),[We,Ke]=o.useState();function $e(e,n,o){var i,l,a,s,d,r,u,p,c,v;const m=null!=Oe&&Oe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[Oe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[Oe]}:Object.assign({},y),b=t.cloneDeep(m),g="custom"===n&&"string"==typeof e,h=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Oe&&Oe>-1&&Ee){const n=Object.assign({},y).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let a=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[h]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=null===(s=null===(a=Object.assign({},y).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map(((n,t)=>t===o?g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"":n))})})),l=t.cloneDeep(y);return l.components=n,l.mapping.cards=i,void(null==B||B(Object.assign({},l)))}const f=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==f&&f>-1){const t=null===(d=null==b?void 0:b.components[f].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=t[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(u=null===(r=b.components)||void 0===r?void 0:r[f])||void 0===u?void 0:u.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[f]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[f]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Le(!0):(Le(!1),null==I||I(""))}if(null!=Oe&&Oe>-1){const e=t.cloneDeep(y);e.components[1].cards[Oe].components=b.components,e.mapping.cards[Oe]=b.mapping,null==B||B(Object.assign({},e))}else null==B||B(b)}function Ge(e,n,o){var i,l,a,s,d,r,u;const p=null!=Oe&&Oe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[Oe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[Oe]}:Object.assign({},y);if(null!=Oe&&Oe>-1&&Ee){const n=Object.assign({},y).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[o])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t.cloneDeep(y);return i.components=n,void(null==B||B(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==p?void 0:p.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(u=null===(r=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==u?u:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},p.components[c]),{buttons:i}),a=[...p.components];a[c]=l,p.components=a}}if(null!=Oe&&Oe>-1){const e=t.cloneDeep(y);e.components[1].cards[Oe].components=p.components,null==B||B(Object.assign({},e))}else null==B||B(p)}o.useEffect((()=>{var e,n;if(null===(e=y.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))Le(!0);else{Le(!1);const e=null===(n=null==xe?void 0:xe.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[y]),o.useEffect((()=>{var e,n,t,o;if(null!=Oe&&Oe>-1){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Oe].components,mapping:null===(o=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Oe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u})}else if(null!=Oe&&-1===Oe){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=p.getAllDataFromTemplateComponent(y);Ue({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[Oe]),o.useEffect((()=>{var e,n,t,o;if(null!=Oe&&Oe>-1&&Se){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Oe].components,mapping:null===(o=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Oe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}),Fe(!1)}}),[Se]);o.useEffect((()=>{Ve&&Te===d.POD.CHATBOT&&(()=>{if(!q)return void Ke("PDF name is Required");const e=v.validateInputNameChatbot(q);null==R||R(null!=q?q:""),Ke(e?"Please enter a valid PDF name":void 0)})()}),[Ve]);const Xe=je?Ae.imageComponent:De;return He.openEditMedia?e.jsx(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(g.default,{mediaComponentFormat:null!==(P=Xe.format)&&void 0!==P?P:s.HEADER_TYPES.IMAGE,uploadMedia:He.uploadMedia,variableListForImage:D||[],useEditWhatsappTemplateMediaResponse:He,setOpenEditMedia:He.setOpenEditMedia,openEditMedia:He.openEditMedia,editIconRef:He.editIconRef,fileRef:Re})})):e.jsxs(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Ee?"420px":"auto"}},{children:[!!Ae.imageComponent&&!Ee&&e.jsxs(f.EditTemplateMediaContainer,{children:[e.jsx(h.default,{imageName:null!==(A=null===(L=null==Xe?void 0:Xe.example)||void 0===L?void 0:L.header_handle)&&void 0!==A?A:[],handleImageChange:He.handleImageChange,mediaType:null==Xe?void 0:Xe.format,error:He.error,isLoading:He.loading,setOpenEditMedia:He.setOpenEditMedia,selectedVariable:c.isVariable(null!==(N=null===(w=null===(U=null==Xe?void 0:Xe.example)||void 0===U?void 0:U.header_handle)||void 0===w?void 0:w[0])&&void 0!==N?N:"")?null===(H=null===(_=null==Xe?void 0:Xe.example)||void 0===_?void 0:_.header_handle)||void 0===H?void 0:H[0]:(null===(F=null===(S=null==y?void 0:y.mapping)||void 0===S?void 0:S.header)||void 0===F?void 0:F[0])?null===(Y=null===(Q=null==y?void 0:y.mapping)||void 0===Q?void 0:Q.header)||void 0===Y?void 0:Y[0]:He.selectedVariable}),(null==De?void 0:De.format)==s.HEADER_TYPES.DOCUMENT?e.jsx(V,{children:Te===d.POD.CHATBOT?e.jsx(a.InputWithVariables,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:We||void 0,onChange:e=>{var n;Ke(""),null==R||R(null!==(n=null==e?void 0:e.actualValue)&&void 0!==n?n:"")},pickerType:n.PickerType.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=q?q:"",variableType:"string"},variablesList:D,showAddButton:!0}):e.jsx(l.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Qe,errorMessage:We||void 0,onBlur:()=>{if(!Qe)return null==R||R(""),void Ke("PDF name is Required");const e=v.validateInputName(Qe);null==R||R(Qe),Ke(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Ke(""),Ye(e)}})}):e.jsx(e.Fragment,{})]}),(null===(W=Ae.bodyVariables)||void 0===W?void 0:W.length)>0&&e.jsx(O.default,{containerStyle:{paddingTop:Ae.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(K=Ae.descriptionComponents)||void 0===K?void 0:K.map(((n,t)=>e.jsx(x.default,{originalVariableList:null!=Oe&&Oe>-1?Ce.cards[Oe]:Ce,type:n.type,descriptionComponent:n.component,showVariableModal:k},t))),(null===(X=null===(G=null!=Oe&&Oe>-1?null===($=Ce.cards[Oe])||void 0===$?void 0:$.buttons:null==Ce?void 0:Ce.buttons)||void 0===G?void 0:G.filter((e=>"URL"===e.type)))||void 0===X?void 0:X.length)>0&&e.jsx(O.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(Z=null===(J=null!=Oe&&Oe>-1?null===(z=Ce.cards[Oe])||void 0===z?void 0:z.buttons:null==Ce?void 0:Ce.buttons)||void 0===J?void 0:J.filter((e=>Te===d.POD.CHATBOT||"URL"===e.type)))||void 0===Z?void 0:Z.map(((n,t)=>{const o=n.buttonVariable===u.STATIC_URL_VARIABLE_NAME;if("URL"===n.type)return e.jsx(E.default,{variableListIndex:t,disableEdit:o,CTAoptions:null==M?void 0:M.CTAoptions,button:n,currentVariableList:null!=Oe&&Oe>-1?Object.assign({},Ce.cards[Oe]):Object.assign({},Ce),updateSelectedURLTemplateBtn:$e},`${t}_${Oe}`)})),Te===d.POD.CHATBOT&&(null===(ne=null===(ee=ke[0])||void 0===ee?void 0:ee.component)||void 0===ne?void 0:ne.buttons)&&(null===(ie=null===(oe=null===(te=ke[0])||void 0===te?void 0:te.component)||void 0===oe?void 0:oe.buttons)||void 0===ie?void 0:ie.length)>0&&e.jsx(m.BackTrackComponent,{backTrackMessage:null===(le=null==xe?void 0:xe.backTrackExtra)||void 0===le?void 0:le[0],setBackTrackMessage:null===(ae=null==xe?void 0:xe.backTrackExtra)||void 0===ae?void 0:ae[1]}),(null===(re=null===(de=null!=Oe&&Oe>-1?null===(se=Ce.cards[Oe])||void 0===se?void 0:se.buttons:null==Ce?void 0:Ce.buttons)||void 0===de?void 0:de.filter((e=>"QUICK_REPLY"===e.type)))||void 0===re?void 0:re.length)>0&&(Te!==d.POD.CHATBOT?e.jsx(O.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(m.BackTrackComponent,{backTrackMessage:null===(ue=null==xe?void 0:xe.backTrackExtra)||void 0===ue?void 0:ue[0],setBackTrackMessage:null===(pe=null==xe?void 0:xe.backTrackExtra)||void 0===pe?void 0:pe[1]})),null===(me=null===(ve=null!=Oe&&Oe>-1?null===(ce=Ce.cards[Oe])||void 0===ce?void 0:ce.buttons:null==Ce?void 0:Ce.buttons)||void 0===ve?void 0:ve.filter((e=>"QUICK_REPLY"===e.type)))||void 0===me?void 0:me.map(((n,t)=>{if("QUICK_REPLY"===n.type&&Te!==d.POD.CHATBOT)return e.jsx(E.default,{variableListIndex:t,QRBoptions:null==M?void 0:M.QRBoptions,button:n,currentVariableList:null!=Oe&&Oe>-1?Object.assign({},Ce.cards[Oe]):Object.assign({},Ce),updateSelectedQRBTemplateBtn:Ge},`${t}_${Oe}`)})),Te===d.POD.CHATBOT&&Pe&&e.jsx(b.DiscountCodeComponent,{discountCode:null===(be=null==xe?void 0:xe.discountCodeExtra)||void 0===be?void 0:be[0],setDiscountCode:null===(ge=null==xe?void 0:xe.discountCodeExtra)||void 0===ge?void 0:ge[1]}),null===(fe=null!=Oe&&Oe>-1?null===(he=Ce.cards[Oe])||void 0===he?void 0:he.buttons:null==Ce?void 0:Ce.buttons)||void 0===fe?void 0:fe.map(((n,t)=>{var o,i,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:ye?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(l.Input,{state:"disabled",labelText:null!==(o=n.text)&&void 0!==o?o:"Copy Code",value:null!==(i=n.buttonVariable)&&void 0!==i?i:"",onChangeText:()=>{}})})):e.jsx(C.default,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))};
7
+ `;exports.default=i=>{let{template:V,onTemplateChange:M,whatsappSpecificPickerMeta:k,showVariableModal:D,variableListForImage:I,setDiscountCode:q,fileName:R,setFileName:P}=i;var L,w,A,U,N,H,S,_,F,Q,Y,W,K,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,re,ue,pe,ce,ve,me,be,ge,he,fe,je;const Ce=V.isCarouselType,{originalVariableList:xe,pod:Te,extras:Oe,selectedCarouselIndex:ye,isProductCarouselType:Ee,disableCopyCode:Ve,isError:Be,cardIndex:Me}=u.useTemplateModalContext(),{descriptionComponents:ke,urlBtns:De,qrbBtns:Ie,imageComponent:qe,bodyVariables:Re,headerVariables:Pe,titleVariables:Le}=c.getAllDataFromTemplateComponent(V),we=o.useRef(null),[Ae,Ue]=o.useState(!1),[Ne,He]=o.useState(-1===ye?{descriptionComponents:ke,urlBtns:De,qrbBtns:Ie,imageComponent:qe,bodyVariables:Re,headerVariables:Pe,titleVariables:Le}:{}),{uploadMediaLink:Se,uploadMediaFiles:_e,validateMimeType:Fe}=k,Qe=C.useEditWhatsappTemplateMedia({uploadMediaLink:Se,uploadMediaFiles:_e,updateTemplateImageUrl:function(e,n){var o,i,l,a,s,d,r,u;let p;p=null!=ye&&ye>-1?{components:null===(i=null===(o=V.components[Me])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[ye].components,mapping:null===(a=null===(l=null==V?void 0:V.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[ye]}:Object.assign({},V);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==p?void 0:p.components[c])){const t=Object.assign(Object.assign({},p.components[c]),{format:n,example:{header_handle:[e]}}),o=[...p.components];o[c]=t,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=ye&&ye>-1){const e=t.cloneDeep(V);e.components[Me].cards[ye].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.cards.length)>0&&(e.mapping.cards[ye]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==M||M(Object.assign({},e)),We(!0)}else null==M||M(Object.assign({},p))},validateMimeType:Fe,mediaComponent:Ce?Ne.imageComponent:qe,fileRef:we}),[Ye,We]=o.useState(!1),[Ke,$e]=o.useState(R),[Ge,Xe]=o.useState();function ze(e,n,o){var i,l,a,d,r,u,p,c,v,m;const b=null!=ye&&ye>-1?{components:null===(i=Object.assign({},V).components[Me].cards)||void 0===i?void 0:i[ye].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[ye]}:Object.assign({},V),g=t.cloneDeep(b),h="custom"===n&&"string"==typeof e,f=h?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=ye&&ye>-1&&Ee){const n=Object.assign({},V).components.map((e=>{var n;return s.isCarouselComponent(e.type)?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let a=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=null===(d=null===(a=Object.assign({},V).mapping)||void 0===a?void 0:a.cards)||void 0===d?void 0:d.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map(((n,t)=>t===o?h?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"":n))})})),l=t.cloneDeep(V);return l.components=n,l.mapping.cards=i,void(null==M||M(Object.assign({},l)))}const j=null==g?void 0:g.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==j&&j>-1){const t=null===(r=null==g?void 0:g.components[j].buttons)||void 0===r?void 0:r.filter((e=>"URL"===e.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=t[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(c=null===(p=null===(u=g.components)||void 0===u?void 0:u[j])||void 0===p?void 0:p.buttons)&&void 0!==c?c:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},g.components[j]),{buttons:s}),r=null===(v=g.mapping)||void 0===v?void 0:v.buttons;r&&r.length>0&&(r[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},g.mapping),{buttons:r});g.mapping=m;const b=[...g.components];b[j]=d,g.components=b}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(m=e.placeHolder)||void 0===m?void 0:m.slice(2,-2))?Ue(!0):(Ue(!1),null==q||q(""))}if(null!=ye&&ye>-1){const e=t.cloneDeep(V);e.components[Me].cards[ye].components=g.components,e.mapping.cards[ye]=g.mapping,null==M||M(Object.assign({},e))}else null==M||M(g)}function Je(e,n,o){var i,l,a,d,r,u,p;const c=null!=ye&&ye>-1?{components:null===(i=Object.assign({},V).components[Me].cards)||void 0===i?void 0:i[ye].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[ye]}:Object.assign({},V);if(null!=ye&&ye>-1&&Ee){const n=Object.assign({},V).components.map((n=>{var t;return s.isCarouselComponent(n.type)?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[o])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t.cloneDeep(V);return i.components=n,void(null==M||M(Object.assign({},i)))}const v=null==c?void 0:c.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==v&&v>-1){const n=null===(d=null===(a=null==c?void 0:c.components[v])||void 0===a?void 0:a.buttons)||void 0===d?void 0:d.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(p=null===(u=null===(r=c.components)||void 0===r?void 0:r[v])||void 0===u?void 0:u.buttons)&&void 0!==p?p:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},c.components[v]),{buttons:i}),a=[...c.components];a[v]=l,c.components=a}}if(null!=ye&&ye>-1){const e=t.cloneDeep(V);e.components[Me].cards[ye].components=c.components,null==M||M(Object.assign({},e))}else null==M||M(c)}o.useEffect((()=>{var e,n;if(null===(e=V.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))Ue(!0);else{Ue(!1);const e=null===(n=null==Oe?void 0:Oe.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[V]),o.useEffect((()=>{var e,n,t,o;if(null!=ye&&ye>-1){const i={components:null===(n=null===(e=V.components[Me])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ye].components,mapping:null===(o=null===(t=null==V?void 0:V.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[ye]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u,titleVariables:p}=c.getAllDataFromTemplateComponent(i);He({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u,titleVariables:p})}else if(null!=ye&&-1===ye){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l,titleVariables:a}=c.getAllDataFromTemplateComponent(V);He({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l,titleVariables:a})}}),[ye]),o.useEffect((()=>{var e,n,t,o;if(null!=ye&&ye>-1&&Ye){const i={components:null===(n=null===(e=V.components[Me])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ye].components,mapping:null===(o=null===(t=null==V?void 0:V.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[ye]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u,titleVariables:p}=c.getAllDataFromTemplateComponent(i);He({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u,titleVariables:p}),We(!1)}}),[Ye]);o.useEffect((()=>{Be&&Te===r.POD.CHATBOT&&(()=>{if(!R)return void Xe("PDF name is Required");const e=m.validateInputNameChatbot(R);null==P||P(null!=R?R:""),Xe(e?"Please enter a valid PDF name":void 0)})()}),[Be]);const Ze=Ce?Ne.imageComponent:qe;return Qe.openEditMedia?e.jsx(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(h.default,{mediaComponentFormat:null!==(L=Ze.format)&&void 0!==L?L:d.HEADER_TYPES.IMAGE,uploadMedia:Qe.uploadMedia,variableListForImage:I||[],useEditWhatsappTemplateMediaResponse:Qe,setOpenEditMedia:Qe.setOpenEditMedia,openEditMedia:Qe.openEditMedia,editIconRef:Qe.editIconRef,fileRef:we})})):e.jsxs(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Ee?"420px":"auto"}},{children:[!!Ne.imageComponent&&!Ee&&!s.isRCSChannel(null==V?void 0:V.channel)&&e.jsxs(j.EditTemplateMediaContainer,{children:[e.jsx(f.default,{imageName:null!==(A=null===(w=null==Ze?void 0:Ze.example)||void 0===w?void 0:w.header_handle)&&void 0!==A?A:[],handleImageChange:Qe.handleImageChange,mediaType:null==Ze?void 0:Ze.format,error:Qe.error,isLoading:Qe.loading,setOpenEditMedia:Qe.setOpenEditMedia,selectedVariable:v.isVariable(null!==(H=null===(N=null===(U=null==Ze?void 0:Ze.example)||void 0===U?void 0:U.header_handle)||void 0===N?void 0:N[0])&&void 0!==H?H:"")?null===(_=null===(S=null==Ze?void 0:Ze.example)||void 0===S?void 0:S.header_handle)||void 0===_?void 0:_[0]:(null===(Q=null===(F=null==V?void 0:V.mapping)||void 0===F?void 0:F.header)||void 0===Q?void 0:Q[0])?null===(W=null===(Y=null==V?void 0:V.mapping)||void 0===Y?void 0:Y.header)||void 0===W?void 0:W[0]:Qe.selectedVariable}),(null==qe?void 0:qe.format)==d.HEADER_TYPES.DOCUMENT?e.jsx(B,{children:Te===r.POD.CHATBOT?e.jsx(a.InputWithVariables,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:Ge||void 0,onChange:e=>{var n;Xe(""),null==P||P(null!==(n=null==e?void 0:e.actualValue)&&void 0!==n?n:"")},pickerType:n.PickerType.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=R?R:"",variableType:"string"},variablesList:I,showAddButton:!0}):e.jsx(l.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Ke,errorMessage:Ge||void 0,onBlur:()=>{if(!Ke)return null==P||P(""),void Xe("PDF name is Required");const e=m.validateInputName(Ke);null==P||P(Ke),Xe(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Xe(""),$e(e)}})}):e.jsx(e.Fragment,{})]}),(null===(K=Ne.bodyVariables)||void 0===K?void 0:K.length)>0&&e.jsx(y.default,{containerStyle:{paddingTop:Ne.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===($=Ne.descriptionComponents)||void 0===$?void 0:$.map(((n,t)=>e.jsx(O.default,{originalVariableList:null!=ye&&ye>-1?xe.cards[ye]:xe,type:n.type,descriptionComponent:n.component,showVariableModal:D},t))),(null===(z=null===(X=null!=ye&&ye>-1?null===(G=xe.cards[ye])||void 0===G?void 0:G.buttons:null==xe?void 0:xe.buttons)||void 0===X?void 0:X.filter((e=>"URL"===e.type)))||void 0===z?void 0:z.length)>0&&e.jsx(y.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(ee=null===(Z=null!=ye&&ye>-1?null===(J=xe.cards[ye])||void 0===J?void 0:J.buttons:null==xe?void 0:xe.buttons)||void 0===Z?void 0:Z.filter((e=>Te===r.POD.CHATBOT||"URL"===e.type)))||void 0===ee?void 0:ee.map(((n,t)=>{const o=n.buttonVariable===p.STATIC_URL_VARIABLE_NAME;if("URL"===n.type)return e.jsx(E.default,{variableListIndex:t,disableEdit:o,CTAoptions:null==k?void 0:k.CTAoptions,button:n,currentVariableList:null!=ye&&ye>-1?Object.assign({},xe.cards[ye]):Object.assign({},xe),updateSelectedURLTemplateBtn:ze},`${t}_${ye}`)})),Te===r.POD.CHATBOT&&(null===(te=null===(ne=Ie[0])||void 0===ne?void 0:ne.component)||void 0===te?void 0:te.buttons)&&(null===(le=null===(ie=null===(oe=Ie[0])||void 0===oe?void 0:oe.component)||void 0===ie?void 0:ie.buttons)||void 0===le?void 0:le.length)>0&&e.jsx(b.BackTrackComponent,{backTrackMessage:null===(ae=null==Oe?void 0:Oe.backTrackExtra)||void 0===ae?void 0:ae[0],setBackTrackMessage:null===(se=null==Oe?void 0:Oe.backTrackExtra)||void 0===se?void 0:se[1]}),!s.isRCSChannel(null==V?void 0:V.channel)&&(null===(ue=null===(re=null!=ye&&ye>-1?null===(de=xe.cards[ye])||void 0===de?void 0:de.buttons:null==xe?void 0:xe.buttons)||void 0===re?void 0:re.filter((e=>"QUICK_REPLY"===e.type)))||void 0===ue?void 0:ue.length)>0&&(Te!==r.POD.CHATBOT?e.jsx(y.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(b.BackTrackComponent,{backTrackMessage:null===(pe=null==Oe?void 0:Oe.backTrackExtra)||void 0===pe?void 0:pe[0],setBackTrackMessage:null===(ce=null==Oe?void 0:Oe.backTrackExtra)||void 0===ce?void 0:ce[1]})),!s.isRCSChannel(null==V?void 0:V.channel)&&(null===(be=null===(me=null!=ye&&ye>-1?null===(ve=xe.cards[ye])||void 0===ve?void 0:ve.buttons:null==xe?void 0:xe.buttons)||void 0===me?void 0:me.filter((e=>"QUICK_REPLY"===e.type)))||void 0===be?void 0:be.map(((n,t)=>{if("QUICK_REPLY"===n.type&&Te!==r.POD.CHATBOT)return e.jsx(E.default,{variableListIndex:t,QRBoptions:null==k?void 0:k.QRBoptions,button:n,currentVariableList:null!=ye&&ye>-1?Object.assign({},xe.cards[ye]):Object.assign({},xe),updateSelectedQRBTemplateBtn:Je},`${t}_${ye}`)}))),Te===r.POD.CHATBOT&&Ae&&e.jsx(g.DiscountCodeComponent,{discountCode:null===(ge=null==Oe?void 0:Oe.discountCodeExtra)||void 0===ge?void 0:ge[0],setDiscountCode:null===(he=null==Oe?void 0:Oe.discountCodeExtra)||void 0===he?void 0:he[1]}),null===(je=null!=ye&&ye>-1?null===(fe=xe.cards[ye])||void 0===fe?void 0:fe.buttons:null==xe?void 0:xe.buttons)||void 0===je?void 0:je.map(((n,t)=>{var o,i,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:Ve?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(l.Input,{state:"disabled",labelText:null!==(o=n.text)&&void 0!==o?o:"Copy Code",value:null!==(i=n.buttonVariable)&&void 0!==i?i:"",onChangeText:()=>{}})})):e.jsx(x.default,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))};