@bikdotai/bik-component-library 0.0.528-beta.0 → 0.0.528

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 (340) hide show
  1. package/dist/cjs/assets/{bundle-0deb4a74.css → bundle-c485438b.css} +325 -2
  2. package/dist/cjs/assets/icons/chat-channel.svg.js +1 -0
  3. package/dist/cjs/assets/icons/{sub_category.svg.js → email-channel.svg.js} +1 -1
  4. package/dist/cjs/assets/icons/emoji.svg.js +1 -1
  5. package/dist/cjs/assets/icons/halfRectangle.svg.js +1 -1
  6. package/dist/cjs/assets/icons/instagram-channel.svg.js +1 -0
  7. package/dist/cjs/assets/icons/similar.svg.js +1 -0
  8. package/dist/cjs/assets/icons/strikeThrough.svg.js +1 -1
  9. package/dist/cjs/assets/icons/whatsapp-channel.svg.js +1 -0
  10. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  11. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  12. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  13. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  14. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  15. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
  16. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
  17. package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
  18. package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  19. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +4 -0
  20. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
  21. package/dist/cjs/components/action-button/ActionButton.styled.d.ts +7 -0
  22. package/dist/cjs/components/action-button/ActionButton.styled.js +23 -0
  23. package/dist/cjs/components/action-button/ActionButtons.d.ts +10 -0
  24. package/dist/cjs/components/action-button/ActionButtons.js +1 -0
  25. package/dist/cjs/components/action-button/index.d.ts +1 -0
  26. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.d.ts +7 -0
  27. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
  28. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.d.ts +4 -0
  29. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.js +1 -0
  30. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +1 -0
  31. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  32. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMetric.d.ts +1 -0
  33. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
  34. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.d.ts +1 -0
  35. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js +1 -1
  36. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +1 -0
  37. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
  38. package/dist/cjs/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
  39. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +2 -0
  40. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  41. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +1 -0
  42. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
  43. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  44. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
  45. package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
  46. package/dist/cjs/components/bik-layout/MockMenus.d.ts +20 -1
  47. package/dist/cjs/components/bik-layout/SidebarStyles.js +1 -1
  48. package/dist/cjs/components/card-selector/CardSelector.d.ts +1 -0
  49. package/dist/cjs/components/card-selector/CardSelector.js +1 -1
  50. package/dist/cjs/components/card-selector/CardSelectorGroup.js +1 -1
  51. package/dist/cjs/components/carousel-preview/CarouselPreview.d.ts +4 -1
  52. package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
  53. package/dist/cjs/components/carousel-preview/CarouselPreview.style.d.ts +4 -2
  54. package/dist/cjs/components/carousel-preview/CarouselPreview.style.js +56 -27
  55. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
  56. package/dist/cjs/components/carousel-preview/CustomCarouselArrows.d.ts +7 -0
  57. package/dist/cjs/components/carousel-preview/CustomCarouselArrows.js +1 -0
  58. package/dist/cjs/components/checkBox/CheckBox.d.ts +4 -0
  59. package/dist/cjs/components/checkBox/CheckBox.js +1 -1
  60. package/dist/cjs/components/checkBox/CheckBox.styled.d.ts +1 -0
  61. package/dist/cjs/components/checkBox/CheckBox.styled.js +4 -3
  62. package/dist/cjs/components/checkList/CheckList.d.ts +1 -0
  63. package/dist/cjs/components/checkList/CheckList.js +1 -1
  64. package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  65. package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +1 -2
  66. package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
  67. package/dist/cjs/components/datePicker/index.d.ts +1 -0
  68. package/dist/cjs/components/discount-modal/DiscountUtils.js +1 -1
  69. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  70. package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
  71. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  72. package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +1 -0
  73. package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
  74. package/dist/cjs/components/dropdown/type.d.ts +3 -0
  75. package/dist/cjs/components/dynamic-tabs/DynamicTabs.d.ts +2 -0
  76. package/dist/cjs/components/dynamic-tabs/DynamicTabs.js +1 -1
  77. package/dist/cjs/components/floater/floater.d.ts +2 -1
  78. package/dist/cjs/components/floater/floater.js +1 -1
  79. package/dist/cjs/components/icon-button/IconButton.js +1 -1
  80. package/dist/cjs/components/icon-button/model.d.ts +5 -0
  81. package/dist/cjs/components/input/Input.d.ts +2 -0
  82. package/dist/cjs/components/input/Input.js +1 -1
  83. package/dist/cjs/components/input/Input.styled.d.ts +2 -0
  84. package/dist/cjs/components/input/Input.styled.js +1 -1
  85. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +1 -0
  86. package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -2
  87. package/dist/cjs/components/list-item/ListItem.d.ts +0 -1
  88. package/dist/cjs/components/list-item/ListItem.js +1 -1
  89. package/dist/cjs/components/plans/NewSubscriptionPlan.js +1 -1
  90. package/dist/cjs/components/plans/SubscriptionPlan.d.ts +1 -0
  91. package/dist/cjs/components/progress-bar-v2/ProgressBarV2.d.ts +21 -0
  92. package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js +1 -0
  93. package/dist/cjs/components/progress-bar-v2/index.d.ts +1 -0
  94. package/dist/cjs/components/radioButton/RadioButton.d.ts +3 -0
  95. package/dist/cjs/components/radioButton/RadioButton.js +1 -1
  96. package/dist/cjs/components/radioList/RadioList.d.ts +1 -0
  97. package/dist/cjs/components/radioList/RadioList.js +1 -1
  98. package/dist/cjs/components/side-modal/SideModal.d.ts +0 -1
  99. package/dist/cjs/components/side-modal/SideModal.js +1 -1
  100. package/dist/cjs/components/spinner/Spinner.d.ts +6 -0
  101. package/dist/cjs/components/spinner/Spinner.js +18 -1
  102. package/dist/cjs/components/states/StateComponent.d.ts +2 -0
  103. package/dist/cjs/components/states/StateComponent.js +1 -1
  104. package/dist/cjs/components/states/StateComponent.styled.d.ts +4 -1
  105. package/dist/cjs/components/states/StateComponent.styled.js +6 -6
  106. package/dist/cjs/components/states-modal/StateModalComponent.d.ts +2 -0
  107. package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
  108. package/dist/cjs/components/stepper/Stepper.d.ts +2 -0
  109. package/dist/cjs/components/stepper/Stepper.js +1 -1
  110. package/dist/cjs/components/stepper/Stepper.styled.d.ts +1 -0
  111. package/dist/cjs/components/stepper/Stepper.styled.js +7 -7
  112. package/dist/cjs/components/tabs/Tabs.js +1 -1
  113. package/dist/cjs/components/tabs/Tabs.model.d.ts +1 -0
  114. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +0 -1
  115. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  116. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +8 -9
  117. package/dist/cjs/components/template-context-mapper/context/templateModalContext.js +1 -1
  118. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  119. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +13 -9
  120. package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +1 -1
  121. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +2 -0
  122. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  123. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  124. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.style.js +0 -1
  125. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  126. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -1
  127. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  128. package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +5 -5
  129. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +5 -3
  130. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
  131. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
  132. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  133. package/dist/cjs/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
  134. package/dist/cjs/components/template-context-mapper/utils/constants.d.ts +1 -0
  135. package/dist/cjs/components/template-context-mapper/utils/constants.js +1 -0
  136. package/dist/cjs/components/template-preview/EmailTemplatePreview.styled.js +16 -14
  137. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  138. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.js +1 -1
  139. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.d.ts +5 -0
  140. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +14 -8
  141. package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +2 -2
  142. package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
  143. package/dist/cjs/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +6 -5
  144. package/dist/cjs/components/template-preview/helpers/VariableEditorHelper.js +1 -1
  145. package/dist/cjs/components/tooltips/TooltipInternal.d.ts +1 -1
  146. package/dist/cjs/helpers/index.d.ts +0 -1
  147. package/dist/cjs/hooks/useOutside.d.ts +1 -1
  148. package/dist/cjs/hooks/useOutside.js +1 -1
  149. package/dist/cjs/index.d.ts +2 -1
  150. package/dist/cjs/index.js +1 -1
  151. package/dist/esm/assets/{bundle-0deb4a74.css → bundle-c485438b.css} +325 -2
  152. package/dist/esm/assets/icons/chat-channel.svg.js +1 -0
  153. package/dist/esm/assets/icons/email-channel.svg.js +1 -0
  154. package/dist/esm/assets/icons/emoji.svg.js +1 -1
  155. package/dist/esm/assets/icons/halfRectangle.svg.js +1 -1
  156. package/dist/esm/assets/icons/instagram-channel.svg.js +1 -0
  157. package/dist/esm/assets/icons/similar.svg.js +1 -0
  158. package/dist/esm/assets/icons/strikeThrough.svg.js +1 -1
  159. package/dist/esm/assets/icons/whatsapp-channel.svg.js +1 -0
  160. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  161. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  162. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  163. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  164. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  165. package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
  166. package/dist/esm/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
  167. package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
  168. package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  169. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +4 -0
  170. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
  171. package/dist/esm/components/action-button/ActionButton.styled.d.ts +7 -0
  172. package/dist/esm/components/action-button/ActionButton.styled.js +23 -0
  173. package/dist/esm/components/action-button/ActionButtons.d.ts +10 -0
  174. package/dist/esm/components/action-button/ActionButtons.js +1 -0
  175. package/dist/esm/components/action-button/index.d.ts +1 -0
  176. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.d.ts +7 -0
  177. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
  178. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.d.ts +4 -0
  179. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.js +1 -0
  180. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +1 -0
  181. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  182. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMetric.d.ts +1 -0
  183. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
  184. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.d.ts +1 -0
  185. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js +1 -1
  186. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +1 -0
  187. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
  188. package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
  189. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +2 -0
  190. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  191. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +1 -0
  192. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
  193. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  194. package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
  195. package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
  196. package/dist/esm/components/bik-layout/MockMenus.d.ts +20 -1
  197. package/dist/esm/components/bik-layout/SidebarStyles.js +1 -1
  198. package/dist/esm/components/card-selector/CardSelector.d.ts +1 -0
  199. package/dist/esm/components/card-selector/CardSelector.js +1 -1
  200. package/dist/esm/components/card-selector/CardSelectorGroup.js +1 -1
  201. package/dist/esm/components/carousel-preview/CarouselPreview.d.ts +4 -1
  202. package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
  203. package/dist/esm/components/carousel-preview/CarouselPreview.style.d.ts +4 -2
  204. package/dist/esm/components/carousel-preview/CarouselPreview.style.js +56 -27
  205. package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
  206. package/dist/esm/components/carousel-preview/CustomCarouselArrows.d.ts +7 -0
  207. package/dist/esm/components/carousel-preview/CustomCarouselArrows.js +1 -0
  208. package/dist/esm/components/checkBox/CheckBox.d.ts +4 -0
  209. package/dist/esm/components/checkBox/CheckBox.js +1 -1
  210. package/dist/esm/components/checkBox/CheckBox.styled.d.ts +1 -0
  211. package/dist/esm/components/checkBox/CheckBox.styled.js +6 -5
  212. package/dist/esm/components/checkList/CheckList.d.ts +1 -0
  213. package/dist/esm/components/checkList/CheckList.js +1 -1
  214. package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  215. package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +1 -2
  216. package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
  217. package/dist/esm/components/datePicker/index.d.ts +1 -0
  218. package/dist/esm/components/discount-modal/DiscountUtils.js +1 -1
  219. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  220. package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
  221. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  222. package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +1 -0
  223. package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
  224. package/dist/esm/components/dropdown/type.d.ts +3 -0
  225. package/dist/esm/components/dynamic-tabs/DynamicTabs.d.ts +2 -0
  226. package/dist/esm/components/dynamic-tabs/DynamicTabs.js +1 -1
  227. package/dist/esm/components/floater/floater.d.ts +2 -1
  228. package/dist/esm/components/floater/floater.js +1 -1
  229. package/dist/esm/components/icon-button/IconButton.js +1 -1
  230. package/dist/esm/components/icon-button/model.d.ts +5 -0
  231. package/dist/esm/components/input/Input.d.ts +2 -0
  232. package/dist/esm/components/input/Input.js +1 -1
  233. package/dist/esm/components/input/Input.styled.d.ts +2 -0
  234. package/dist/esm/components/input/Input.styled.js +1 -1
  235. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +1 -0
  236. package/dist/esm/components/input-with-vars/InputWithVariables.js +3 -3
  237. package/dist/esm/components/list-item/ListItem.d.ts +0 -1
  238. package/dist/esm/components/list-item/ListItem.js +1 -1
  239. package/dist/esm/components/plans/NewSubscriptionPlan.js +1 -1
  240. package/dist/esm/components/plans/SubscriptionPlan.d.ts +1 -0
  241. package/dist/esm/components/progress-bar-v2/ProgressBarV2.d.ts +21 -0
  242. package/dist/esm/components/progress-bar-v2/ProgressBarV2.js +1 -0
  243. package/dist/esm/components/progress-bar-v2/index.d.ts +1 -0
  244. package/dist/esm/components/radioButton/RadioButton.d.ts +3 -0
  245. package/dist/esm/components/radioButton/RadioButton.js +1 -1
  246. package/dist/esm/components/radioList/RadioList.d.ts +1 -0
  247. package/dist/esm/components/radioList/RadioList.js +1 -1
  248. package/dist/esm/components/side-modal/SideModal.d.ts +0 -1
  249. package/dist/esm/components/side-modal/SideModal.js +1 -1
  250. package/dist/esm/components/spinner/Spinner.d.ts +6 -0
  251. package/dist/esm/components/spinner/Spinner.js +18 -1
  252. package/dist/esm/components/states/StateComponent.d.ts +2 -0
  253. package/dist/esm/components/states/StateComponent.js +1 -1
  254. package/dist/esm/components/states/StateComponent.styled.d.ts +4 -1
  255. package/dist/esm/components/states/StateComponent.styled.js +6 -6
  256. package/dist/esm/components/states-modal/StateModalComponent.d.ts +2 -0
  257. package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
  258. package/dist/esm/components/stepper/Stepper.d.ts +2 -0
  259. package/dist/esm/components/stepper/Stepper.js +1 -1
  260. package/dist/esm/components/stepper/Stepper.styled.d.ts +1 -0
  261. package/dist/esm/components/stepper/Stepper.styled.js +6 -6
  262. package/dist/esm/components/tabs/Tabs.js +1 -1
  263. package/dist/esm/components/tabs/Tabs.model.d.ts +1 -0
  264. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +0 -1
  265. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  266. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +8 -9
  267. package/dist/esm/components/template-context-mapper/context/templateModalContext.js +1 -1
  268. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  269. package/dist/esm/components/template-context-mapper/modalElements/Body.js +13 -9
  270. package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +2 -2
  271. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +2 -0
  272. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  273. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  274. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.style.js +0 -1
  275. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  276. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -1
  277. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  278. package/dist/esm/components/template-context-mapper/modalElements/Footer.js +5 -5
  279. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +5 -3
  280. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
  281. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
  282. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  283. package/dist/esm/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
  284. package/dist/esm/components/template-context-mapper/utils/constants.d.ts +1 -0
  285. package/dist/esm/components/template-context-mapper/utils/constants.js +1 -0
  286. package/dist/esm/components/template-preview/EmailTemplatePreview.styled.js +2 -0
  287. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  288. package/dist/esm/components/template-preview/WhatsApp/ChatUI.js +2 -2
  289. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.d.ts +5 -0
  290. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +23 -17
  291. package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  292. package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
  293. package/dist/esm/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +6 -5
  294. package/dist/esm/components/template-preview/helpers/VariableEditorHelper.js +1 -1
  295. package/dist/esm/components/tooltips/TooltipInternal.d.ts +1 -1
  296. package/dist/esm/helpers/index.d.ts +0 -1
  297. package/dist/esm/hooks/useOutside.d.ts +1 -1
  298. package/dist/esm/hooks/useOutside.js +1 -1
  299. package/dist/esm/index.d.ts +2 -1
  300. package/dist/esm/index.js +1 -1
  301. package/package.json +4 -2
  302. package/dist/cjs/components/variable-picker-v3/Content.d.ts +0 -6
  303. package/dist/cjs/components/variable-picker-v3/Content.js +0 -1
  304. package/dist/cjs/components/variable-picker-v3/NoResult.d.ts +0 -6
  305. package/dist/cjs/components/variable-picker-v3/NoResult.js +0 -17
  306. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.d.ts +0 -14
  307. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +0 -1
  308. package/dist/cjs/components/variable-picker-v3/VariablePicker.d.ts +0 -5
  309. package/dist/cjs/components/variable-picker-v3/VariablePicker.js +0 -1
  310. package/dist/cjs/components/variable-picker-v3/context.d.ts +0 -21
  311. package/dist/cjs/components/variable-picker-v3/context.js +0 -1
  312. package/dist/cjs/components/variable-picker-v3/index.d.ts +0 -1
  313. package/dist/cjs/components/variable-picker-v3/model.d.ts +0 -57
  314. package/dist/cjs/components/variable-picker-v3/model.js +0 -1
  315. package/dist/cjs/components/variable-picker-v3/recommendVaribles.d.ts +0 -1
  316. package/dist/cjs/components/variable-picker-v3/recommendVaribles.js +0 -1
  317. package/dist/cjs/components/variable-picker-v3/searchVariables.d.ts +0 -2
  318. package/dist/cjs/components/variable-picker-v3/searchVariables.js +0 -1
  319. package/dist/cjs/components/variable-picker-v3/styles.d.ts +0 -6
  320. package/dist/cjs/components/variable-picker-v3/styles.js +0 -40
  321. package/dist/esm/assets/icons/sub_category.svg.js +0 -1
  322. package/dist/esm/components/variable-picker-v3/Content.d.ts +0 -6
  323. package/dist/esm/components/variable-picker-v3/Content.js +0 -1
  324. package/dist/esm/components/variable-picker-v3/NoResult.d.ts +0 -6
  325. package/dist/esm/components/variable-picker-v3/NoResult.js +0 -17
  326. package/dist/esm/components/variable-picker-v3/SubHeaderItems.d.ts +0 -14
  327. package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +0 -1
  328. package/dist/esm/components/variable-picker-v3/VariablePicker.d.ts +0 -5
  329. package/dist/esm/components/variable-picker-v3/VariablePicker.js +0 -1
  330. package/dist/esm/components/variable-picker-v3/context.d.ts +0 -21
  331. package/dist/esm/components/variable-picker-v3/context.js +0 -1
  332. package/dist/esm/components/variable-picker-v3/index.d.ts +0 -1
  333. package/dist/esm/components/variable-picker-v3/model.d.ts +0 -57
  334. package/dist/esm/components/variable-picker-v3/model.js +0 -1
  335. package/dist/esm/components/variable-picker-v3/recommendVaribles.d.ts +0 -1
  336. package/dist/esm/components/variable-picker-v3/recommendVaribles.js +0 -1
  337. package/dist/esm/components/variable-picker-v3/searchVariables.d.ts +0 -2
  338. package/dist/esm/components/variable-picker-v3/searchVariables.js +0 -1
  339. package/dist/esm/components/variable-picker-v3/styles.d.ts +0 -6
  340. package/dist/esm/components/variable-picker-v3/styles.js +0 -40
@@ -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"),a=require("react"),i=require("../../button/Button.js"),r=require("../../image-cropper/BikImageCropper.js");require("../../image-compress/ImageCompress.js"),require("../../states/StateComponent.js"),require("../../../_virtual/_tslib.js"),require("../../../constants/zindex.js"),require("../../modals/styledModal.js");var s=require("../../spinner/Spinner.js"),l=require("../../input-with-vars/InputWithVariables.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var n=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js");var o=require("../../template-preview/models/TemplateMeta.js"),d=require("../../template-preview/models/WhatsAppTemplate.js"),p=require("../../TypographyStyle.js"),c=require("../../../utils/validator.js"),u=require("../../../assets/icons/file.svg.js"),g=require("../../../assets/icons/filePdf.svg.js"),m=require("../../../assets/icons/image.svg.js"),j=require("../../../assets/icons/upload.svg.js"),h=require("../context/templateModalContext.js"),x=require("../utils/validateIsUrl.js");exports.default=E=>{let{setOpenEditMedia:v,mediaComponentFormat:b,variableListForImage:y,openEditMedia:f,uploadMedia:C,fileRef:M,useEditWhatsappTemplateMediaResponse:q}=E;const{pod:I}=h.useTemplateModalContext(),[T,A]=a.useState("");let P;if(P=b===o.HEADER_TYPES.IMAGE?"image/png, image/jpeg":b===o.HEADER_TYPES.VIDEO?"video/mp4":"application/pdf",!f)return e.jsx(e.Fragment,{});return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:"10px",alignItems:"center",marginBottom:"16px"}},{children:[e.jsx(t.default,{onClick:e=>{e.stopPropagation(),v(!1),A("")},style:{cursor:"pointer"},width:16,height:16}),e.jsx(p.TitleRegular,{children:"Update Media"})]})),e.jsxs("div",Object.assign({style:{padding:24,borderRadius:4,border:`1px dashed ${n.DEFAULT_THEME.colorsV2.stroke.primary}`,backgroundColor:n.DEFAULT_THEME.colorsV2.surface.subdued,width:"100%",height:"100%",alignItems:"center",display:q.loading?"flex":"initial"}},{children:[e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[q.loading?e.jsx(s.Spinner,{size:"large"}):e.jsx("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:n.DEFAULT_THEME.colorsV2.background.base}},{children:b===o.HEADER_TYPES.IMAGE?e.jsx(m.default,{width:40,height:40}):b===o.HEADER_TYPES.VIDEO?e.jsx(u.default,{width:40,height:40}):e.jsx(g.default,{width:40,height:40})})),e.jsx(p.TitleMedium,{children:q.loading?"Upload in progress...":b===o.HEADER_TYPES.IMAGE?"Upload an image":b===o.HEADER_TYPES.VIDEO?"Upload a video":"Upload a document"}),e.jsx(p.BodySecondary,Object.assign({color:n.COLORS.content.secondary},{children:q.loading?"Your image is getting loaded. This may take a couple of minutes.":b===o.HEADER_TYPES.IMAGE?"JPEG/ PNG format • Max 5MB":b===o.HEADER_TYPES.VIDEO?"MP4 format video • Max 16MB":"PDF format document • Max 100MB"}))]})),!q.loading&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:[e.jsx(p.BodyCaption,{children:"Press Enter after adding url/variable to add"}),e.jsx(l.InputWithVariables,{noMaxCharCheck:!0,allowMix:!1,onChange:()=>{},onEnterPress:e=>{e&&(c.validateURL(e)||x.isVariable(e)?(C(e),v(!1),A("")):A("Invalid Url/Variable"))},errorMessage:T,prevVariable:{actualValue:"",variableType:"string"},variablesList:y,placeHolder:"Enter URL/Add variable",showAddButton:I!==d.POD.CAMPAIGN||b===o.HEADER_TYPES.IMAGE})]})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px",marginBottom:"16px"}},{children:[e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e.jsx(p.BodyCaption,{children:"Or upload media from device"}),e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(i.Button,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:j.default,onClick:()=>C(),size:"medium"})}))]})]})),e.jsx("input",{ref:M,style:{display:"none"},type:"file",onChange:q.handleImageUpload,accept:P}),!!q.selectedImage&&e.jsx(r.BikImageCropper,{aspectRatio:15/8,src:q.selectedImage,onCropComplete:q.onCropComplete,onCancel:()=>{q.setLoading(!1),q.setSelectedImage(""),M.current&&(M.current.value="")}})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/arrow_back.svg.js"),a=require("react"),i=require("../../button/Button.js"),r=require("../../image-cropper/BikImageCropper.js");require("../../image-compress/ImageCompress.js"),require("../../states/StateComponent.js"),require("../../../_virtual/_tslib.js"),require("../../../constants/zindex.js"),require("../../modals/styledModal.js");var s=require("../../spinner/Spinner.js"),l=require("../../input-with-vars/InputWithVariables.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var n=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js");var o=require("../../template-preview/models/TemplateMeta.js"),d=require("../../template-preview/models/WhatsAppTemplate.js"),p=require("../../TypographyStyle.js"),c=require("../../../utils/validator.js"),u=require("../../../assets/icons/file.svg.js"),g=require("../../../assets/icons/filePdf.svg.js"),m=require("../../../assets/icons/image.svg.js"),j=require("../../../assets/icons/upload.svg.js"),h=require("../context/templateModalContext.js"),x=require("../utils/validateIsUrl.js");exports.default=E=>{let{setOpenEditMedia:v,mediaComponentFormat:b,variableListForImage:y,openEditMedia:f,uploadMedia:C,fileRef:M,useEditWhatsappTemplateMediaResponse:I}=E;const{pod:T}=h.useTemplateModalContext(),[q,A]=a.useState("");let P;if(P=b===o.HEADER_TYPES.IMAGE?"image/png, image/jpeg":b===o.HEADER_TYPES.VIDEO?"video/mp4":"application/pdf",!f)return e.jsx(e.Fragment,{});return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:"10px",alignItems:"center",marginBottom:"16px"}},{children:[e.jsx(t.default,{onClick:e=>{e.stopPropagation(),v(!1),A("")},style:{cursor:"pointer"},width:16,height:16}),e.jsx(p.TitleRegular,{children:"Update Media"})]})),e.jsxs("div",Object.assign({style:{padding:24,borderRadius:4,border:`1px dashed ${n.DEFAULT_THEME.colorsV2.stroke.primary}`,backgroundColor:n.DEFAULT_THEME.colorsV2.surface.subdued,width:"100%",height:"100%",alignItems:"center",display:I.loading?"flex":"initial"}},{children:[e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[I.loading?e.jsx(s.PureSpinner,{width:"40px",height:"40px",color:n.COLORS.content.brand}):e.jsx("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:n.DEFAULT_THEME.colorsV2.background.base}},{children:b===o.HEADER_TYPES.IMAGE?e.jsx(m.default,{width:40,height:40}):b===o.HEADER_TYPES.VIDEO?e.jsx(u.default,{width:40,height:40}):e.jsx(g.default,{width:40,height:40})})),e.jsx(p.TitleMedium,{children:I.loading?"Upload in progress...":b===o.HEADER_TYPES.IMAGE?"Upload an image":b===o.HEADER_TYPES.VIDEO?"Upload a video":"Upload a document"}),e.jsx(p.BodySecondary,Object.assign({color:n.COLORS.content.secondary},{children:I.loading?`Your ${b.toLowerCase()} is getting loaded. This may take a couple of minutes.`:b===o.HEADER_TYPES.IMAGE?"JPEG/ PNG format • Max 5MB":b===o.HEADER_TYPES.VIDEO?"MP4 format video • Max 16MB":"PDF format document • Max 100MB"}))]})),!I.loading&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:[e.jsx(p.BodyCaption,{children:"Press Enter after adding url/variable to add"}),e.jsx(l.InputWithVariables,{noMaxCharCheck:!0,allowMix:!1,onChange:()=>{},onEnterPress:e=>{e&&(c.validateURL(e)||x.isVariable(e)?(C(e),v(!1),A("")):A("Invalid Url/Variable"))},errorMessage:q,prevVariable:{actualValue:"",variableType:"string"},variablesList:y,showSideVariablePanel:!0,placeHolder:"Enter URL/Add variable",showAddButton:T!==d.POD.CAMPAIGN||b===o.HEADER_TYPES.IMAGE})]})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px",marginBottom:"16px"}},{children:[e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e.jsx(p.BodyCaption,{children:"Or upload media from device"}),e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(i.Button,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:j.default,onClick:()=>C(),size:"medium"})}))]})]})),e.jsx("input",{ref:M,style:{display:"none"},type:"file",onChange:I.handleImageUpload,accept:P}),!!I.selectedImage&&e.jsx(r.BikImageCropper,{aspectRatio:15/8,src:I.selectedImage,onCropComplete:I.onCropComplete,onCancel:()=>{I.setLoading(!1),I.setSelectedImage(""),M.current&&(M.current.value="")}})]})};
@@ -26,7 +26,6 @@
26
26
  border-radius: 4px;
27
27
  margin-left: 8px;
28
28
  align-items: center;
29
- height: 100%;
30
29
  `,a=i.default.div`
31
30
  padding-bottom: 0px;
32
31
  min-width: 285px;
@@ -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"),r=require("../../../assets/icons/PlusIcon.js"),l=require("lodash"),a=require("react"),i=require("../../button/Button.js"),n=require("../../icon-button/IconButton.js"),o=require("../../product-picker-v2/modal.js"),s=require("../Badge/index.js"),d=require("../context/templateModalContext.js"),c=require("./EditWhatsAppTemplateV2.js"),u=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var p=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"),h=require("../../TypographyStyle.js");exports.default=g=>{let{template:v,whatsappSpecificPickerMeta:x,showVariableModal:j,variableList:y,variableListForImage:f,discountCode:b,setDiscountCode:C}=g;var O,I;const{selectedCarouselIndex:P,setTemplate:q,pickerConf:w,isProductCarouselType:S,pod:k,cardCount:T,carouselProducts:B,setCarouselProducts:L,isError:E,cardImages:M,disableEditVariable:R,onDeleteSelectedProducts:A,setSelectedCarouselIndex:D,setVariableCallback:F,setShowVariablePicker:V}=d.useTemplateModalContext(),[W,N]=a.useState(-1==P?"First Message (Step 1/2)":S?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)"),[_,$]=a.useState(!1),[z,G]=a.useState(!1);a.useEffect((()=>{N(-1==P?"First Message (Step 1/2)":S?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)")}),[P]);const H=e=>{null==L||L([{name:"variable",productName:e.actualValue}])};return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:24}},{children:[null!=P&&P>=0&&e.jsx(n.IconButton,{Icon:t.default,onClick:()=>{null==D||D(-1)}}),e.jsx(h.TitleMedium,Object.assign({style:{marginLeft:10}},{children:W}))]})),S&&(null!==(O=null==B?void 0:B.length)&&void 0!==O?O:0)>0&&null!=P&&P>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(u.ProductBox,{editItem:()=>{1===(null==B?void 0:B.length)&&"variable"===B[0].name?(F((()=>H)),V(!0)):$(!_)},cardBody:1===(null==B?void 0:B.length)&&"variable"===B[0].name?`${B[0].productName}`:`${null==B?void 0:B.length} Products Selected`,hideIcon:1===(null==B?void 0:B.length)&&"variable"===B[0].name,deleteItem:()=>{var e;if(1===(null==B?void 0:B.length)&&"variable"===B[0].name)return void(null==L||L([]));const t=l.cloneDeep(Object.assign({},v));t&&(M&&M.length>0?null==M||M.forEach(((e,r)=>{var l;t.components[1].cards[r].components[0].example.header_handle=[null!==(l=M[r])&&void 0!==l?l:"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,r)=>{t.components[1].cards[r].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==q||q(t)),null==L||L([]),null==A||A()}}),B&&(null==B?void 0:B.length)>0&&"variable"!=B[0].name&&e.jsx(i.Button,{disabled:(null!==(I=null==B?void 0:B.length)&&void 0!==I?I:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{G(!0),$(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!R&&S&&0===(null==B?void 0:B.length)&&null!=P&&P>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(h.TitleRegular,{children:"Product(s)"}),e.jsx(h.BodySecondary,{children:`Select ${null!=T?T:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:E?16:12,marginRight:E?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(i.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:E?`2px dashed ${p.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:E?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(r.default,{width:18,height:18,color:p.COLORS.content.secondary})})),onClick:e=>{$(!0)}}),k===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(h.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(i.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:E?`2px dashed ${p.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:E?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(r.default,{width:18,height:18,color:p.COLORS.content.secondary})})),onClick:e=>{F((()=>H)),V(!0)}})]})]})),E&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(s.Badge,{padding:"8px",errorText:"Please add products"})}))]}),e.jsx(c.default,{whatsappSpecificPickerMeta:x,template:v,onTemplateChange:e=>{null==q||q(e)},showVariableModal:j,variableList:y,variableListForImage:f,discountCode:b,setDiscountCode:C}),_&&w&&e.jsx(o.ProductPickerModal,{zIndex:200,startupScreen:z?o.ScreenName.RearrangeProducts:o.ScreenName.Collections,rearrangeEnabled:!0,storeId:w.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const r of e){const e=null==r?void 0:r.collectionId,l=r.productId,a=r.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),l in t[e].products||(t[e].products[l]={variants:{},name:(null==r?void 0:r.productName)||"",image:(null==r?void 0:r.productImage)||""}),t[e].products[l].variants[a]={name:(null==r?void 0:r.name)||"",price:"",image:(null==r?void 0:r.image)||"",quantity:r.quantity||0,displayOrder:r.displayOrder}}return t}return{}})(null!=B?B:[]),collectionFetcher:w.fetchCollections,productFetcher:w.fetchProducts,onAdd:(e,t)=>{var r,a,i,n,o,s;G(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const l=e[t].products;if(void 0!==l&&Object.keys(l).length)for(const e of Object.keys(l)){const c=l[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:h,displayOrder:g}=c[u],v={name:p,image:null!==(a=null!=m?m:null===(r=l[e])||void 0===r?void 0:r.image)&&void 0!==a?a:"",quantity:h,variantId:u,productId:e,displayOrder:g,collectionId:t,productName:null!==(n=null===(i=l[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(s=null===(o=l[e])||void 0===o?void 0:o.image)&&void 0!==s?s:""};d.push(v)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=l.cloneDeep(Object.assign({},v));p&&(u.forEach(((e,t)=>{var r;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(r=null==M?void 0:M[t])&&void 0!==r?r:""]})),null==q||q(p)),null==L||L(c),$(!1)},searchInCollectionFetcher:w.searchInCollection,searchFetcher:w.searchProducts,visible:_,onClose:()=>{$(!1)},exactLimit:null!=T?T: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"),i=require("../../../assets/icons/chevronRight.svg.js"),n=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js"),require("../../add-variableV2/AddVariableV2.styled.js");var s=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js");require("../../input/Input.js"),require("../../tooltips/Tooltip.js");var c=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var u=require("../../TypographyStyle.js"),p=require("../../product-picker-v2/modal.js"),v=require("../Badge/index.js"),h=require("../context/templateModalContext.js"),m=require("./EditWhatsAppTemplateV2.js"),g=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../curtain/CurtainHelper.js"),require("../../template-preview/models/TemplateMeta.js");var j=require("../../template-preview/models/WhatsAppTemplate.js");exports.default=x=>{let{template:y,whatsappSpecificPickerMeta:b,showVariableModal:f,variableList:C,variableListForImage:O,discountCode:I,setDiscountCode:S}=x;var q,w,P,k,T,L,B,R;const{selectedCarouselIndex:V,setTemplate:A,pickerConf:E,isProductCarouselType:M,pod:D,cardCount:F,carouselProducts:W,setCarouselProducts:_,isError:N,cardImages:$,disableEditVariable:z,onDeleteSelectedProducts:G,setSelectedCarouselIndex:H,sliderRef:J}=h.useTemplateModalContext(),[K,Q]=r.useState(-1==V?"First Message (Step 1/2)":M?"Product Carousel "+((null===(w=null===(q=null==y?void 0:y.mapping)||void 0===q?void 0:q.body)||void 0===w?void 0:w.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(k=null===(P=null==y?void 0:y.mapping)||void 0===P?void 0:P.body)||void 0===k?void 0:k.length)?"(Step 2/2)":"")),[U,X]=r.useState(!1),[Y,Z]=r.useState(!1),[ee,te]=r.useState(!1),le=V===(null!=F?F:-1)-1,ie=(null!=V?V:-1)<1;r.useEffect((()=>{var e,t,l,i;Q(-1==V?"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===(i=null===(l=null==y?void 0:y.mapping)||void 0===l?void 0:l.body)||void 0===i?void 0:i.length)?"(Step 2/2)":""))}),[V]);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!=V&&V>=0&&(null===(L=null===(T=null==y?void 0:y.mapping)||void 0===T?void 0:T.body)||void 0===L?void 0:L.length)&&e.jsx(d.IconButton,{Icon:t.default,onClick:()=>{null==H||H(-1)}}),e.jsx(u.TitleMedium,Object.assign({style:{marginLeft:10}},{children:K}))]})),M&&(null!==(B=null==W?void 0:W.length)&&void 0!==B?B:0)>0&&null!=V&&V>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(g.ProductBox,{editItem:()=>{1===(null==W?void 0:W.length)&&"variable"===W[0].name?te(!0):X(!U)},cardBody:1===(null==W?void 0:W.length)&&"variable"===W[0].name?`${W[0].productName}`:`${null==W?void 0:W.length} Products Selected`,hideIcon:1===(null==W?void 0:W.length)&&"variable"===W[0].name,deleteItem:()=>{var e;if(1===(null==W?void 0:W.length)&&"variable"===W[0].name)return void(null==_||_([]));const t=o.cloneDeep(Object.assign({},y));t&&($&&$.length>0?null==$||$.forEach(((e,l)=>{var i;t.components[1].cards[l].components[0].example.header_handle=[null!==(i=$[l])&&void 0!==i?i:"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==A||A(t)),null==_||_([]),null==G||G()}}),W&&(null==W?void 0:W.length)>0&&"variable"!=W[0].name&&e.jsx(s.Button,{disabled:(null!==(R=null==W?void 0:W.length)&&void 0!==R?R:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{Z(!0),X(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!z&&M&&0===(null==W?void 0:W.length)&&null!=V&&V>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(u.TitleRegular,{children:"Product(s)"}),e.jsx(u.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(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:N?`2px dashed ${c.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(n.default,{width:18,height:18,color:c.COLORS.content.secondary})})),onClick:e=>{X(!0)}}),D===j.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(u.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:N?`2px dashed ${c.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(n.default,{width:18,height:18,color:c.COLORS.content.secondary})})),onClick:e=>{te(!0)}})]})]})),N&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(v.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!M&&(null!=V?V:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:c.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(d.IconButton,{Icon:l.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:c.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==J?void 0:J.current)||void 0===e||e.slickPrev(),(null!=V?V:-1)<1||null==H||H((e=>e-1))}}),e.jsx(u.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:c.COLORS.content.secondary},{children:`Card ${(null!=V?V:0)+1}/${F}`})),e.jsx(d.IconButton,{Icon:i.default,width:8,height:14,disabled:le,svgStyle:le?{}:{color:c.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==J?void 0:J.current)||void 0===e||e.slickNext(),(null!=V?V:-1)>=(null!=F?F:-1)-1||null==H||H((e=>e+1))}})]})),e.jsx(m.default,{whatsappSpecificPickerMeta:b,template:y,onTemplateChange:e=>{null==A||A(e)},showVariableModal:f,variableList:C,variableListForImage:O,discountCode:I,setDiscountCode:S}),U&&E&&e.jsx(p.ProductPickerModal,{zIndex:200,startupScreen:Y?p.ScreenName.RearrangeProducts:p.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,i=l.productId,n=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),i in t[e].products||(t[e].products[i]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[i].variants[n]={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!=W?W:[]),collectionFetcher:E.fetchCollections,productFetcher:E.fetchProducts,onAdd:(e,t)=>{var l,i,n,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:h,displayOrder:m}=c[u],g={name:p,image:null!==(i=null!=v?v:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==i?i:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:t,productName:null!==(r=null===(n=o[e])||void 0===n?void 0:n.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==$?void 0:$[t])&&void 0!==l?l:""]})),null==A||A(p)),null==_||_(c),X(!1)},searchInCollectionFetcher:E.searchInCollection,searchFetcher:E.searchProducts,visible:U,onClose:()=>{X(!1)},exactLimit:null!=F?F:1}),ee&&e.jsx(a.AddVariableV2SideModal,{zIndex:2e3,data:null!=C?C:[],showVariable:ee,setShowVariable:te,placeholder:"Add a variable",customTrigger:e=>{null==_||_([{name:"variable",productName:e.actualValue}])}})]}))};
@@ -15,5 +15,5 @@ export interface EditWhatsAppTemplateV2Props {
15
15
  fileName?: string;
16
16
  setFileName?: (name: string) => void;
17
17
  }
18
- declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, setDiscountCode, fileName, setFileName, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
18
+ declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, discountCode, setDiscountCode, fileName, setFileName, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
19
19
  export default EditWhatsAppTemplateV2;
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("styled-components"),i=require("../../input/Input.js"),l=require("../../template-preview/models/TemplateMeta.js"),a=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),d=require("../custom-hooks/useAdditionalVariables.js"),r=require("../utils/getDataFromTemplateComponent.js"),u=require("../utils/validateIsUrl.js"),p=require("../utils/validateName.js"),c=require("./BackTrackComponent.js"),v=require("./DiscountCodeComponent.js"),m=require("./EditMediaModal.js"),b=require("./EditMediaV2.js"),g=require("./EditMediaV2.style.js"),f=require("./useEditWhtasappTemplateMedia.js"),j=require("./VariableConnector.js"),h=require("./VariableConnectorsPanel.js"),C=require("./VariableConnectorWhatsApp.js"),O=require("./VariableEditorHeader.js"),x=require("./WhatsAppTemplateCardButtonV2.js");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const y=T(o).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("styled-components"),i=require("../../input/Input.js"),l=require("../../template-preview/models/TemplateMeta.js"),a=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),d=require("../custom-hooks/useAdditionalVariables.js"),u=require("../utils/getDataFromTemplateComponent.js"),r=require("../utils/validateIsUrl.js"),p=require("../utils/validateName.js"),c=require("./BackTrackComponent.js"),v=require("./DiscountCodeComponent.js"),m=require("./EditMediaModal.js"),b=require("./EditMediaV2.js"),g=require("./EditMediaV2.style.js"),f=require("./useEditWhtasappTemplateMedia.js"),h=require("./VariableConnector.js"),j=require("./VariableConnectorsPanel.js"),C=require("./VariableConnectorWhatsApp.js"),O=require("./VariableEditorHeader.js"),x=require("./WhatsAppTemplateCardButtonV2.js");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const y=T(o).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=o=>{let{template:T,onTemplateChange:E,whatsappSpecificPickerMeta:V,showVariableModal:B,variableList:k,variableListForImage:M,setDiscountCode:L,fileName:q,setFileName:D}=o;var I,R,U,P,A,w,N,S,_,F,H,Q,Y,K,W,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,re,ue,pe;const ce=T.isCarouselType,{originalVariableList:ve,pod:me,extras:be,selectedCarouselIndex:ge,isProductCarouselType:fe}=s.useTemplateModalContext(),{descriptionComponents:je,urlBtns:he,qrbBtns:Ce,imageComponent:Oe,bodyVariables:xe,headerVariables:Te}=r.getAllDataFromTemplateComponent(T),ye=t.useRef(null),Ee=d.useAdditionalVariables({variableList:k,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});console.log("updatedVariableList1",Ee);const[Ve,Be]=t.useState(!1),[ke,Me]=t.useState(-1===ge?{descriptionComponents:je,urlBtns:he,qrbBtns:Ce,imageComponent:Oe,bodyVariables:xe,headerVariables:Te}:{}),{uploadMediaLink:Le,uploadMediaFiles:qe}=V,De=f.useEditWhatsappTemplateMedia({uploadMediaLink:Le,uploadMediaFiles:qe,updateTemplateImageUrl:function(e,t){var o,i,l,a,s,d,r,u;let p;p=null!=ge&&ge>-1?{components:null===(i=null===(o=T.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[ge].components,mapping:null===(a=null===(l=null==T?void 0:T.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[ge]}:Object.assign({},T);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 n=Object.assign(Object.assign({},p.components[c]),{format:t,example:{header_handle:[e]}}),o=[...p.components];o[c]=n,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=ge&&ge>-1){const e=n.cloneDeep(T);e.components[1].cards[ge].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[ge]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==E||E(Object.assign({},e)),Re(!0)}else null==E||E(Object.assign({},p))},mediaComponent:ce?ke.imageComponent:Oe,fileRef:ye}),[Ie,Re]=t.useState(!1),[Ue,Pe]=t.useState(q),[Ae,we]=t.useState();function Ne(e,t,o){var i,l,a,s,d,r,u,p,c,v;const m=null!=ge&&ge>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[ge].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[ge]}:Object.assign({},T),b=n.cloneDeep(m),g="custom"===t&&"string"==typeof e,f=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=ge&&ge>-1&&fe){const t=Object.assign({},T).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:[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===(s=null===(a=Object.assign({},T).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=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(T);return l.components=t,l.mapping.cards=i,void(null==E||E(Object.assign({},l)))}const j=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==j&&j>-1){const n=null===(d=null==b?void 0:b.components[j].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==n?void 0:n.length)>0){const i="custom"===t&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=n[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[j])||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[j]),{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[j]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Be(!0):(Be(!1),null==L||L(""))}if(null!=ge&&ge>-1){const e=n.cloneDeep(T);e.components[1].cards[ge].components=b.components,e.mapping.cards[ge]=b.mapping,null==E||E(Object.assign({},e))}else null==E||E(b)}function Se(e,t,o){var i,l,a,s,d,r;const u=null!=ge&&ge>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[ge].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[ge]}:Object.assign({},T);if(null!=ge&&ge>-1&&fe){const t=Object.assign({},T).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=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=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=n.cloneDeep(T);return i.components=t,void(null==E||E(Object.assign({},i)))}const p=null==u?void 0:u.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==p&&p>-1){const n=null===(a=null==u?void 0:u.components[p].buttons)||void 0===a?void 0:a.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!==(r=null===(d=null===(s=u.components)||void 0===s?void 0:s[p])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].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({},u.components[p]),{buttons:i}),a=[...u.components];a[p]=l,u.components=a}}if(null!=ge&&ge>-1){const e=n.cloneDeep(T);e.components[1].cards[ge].components=u.components,null==E||E(Object.assign({},e))}else null==E||E(u)}t.useEffect((()=>{var e,n;if(null===(e=T.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))Be(!0);else{Be(!1);const e=null===(n=null==be?void 0:be.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[T]),t.useEffect((()=>{var e,n,t,o;if(null!=ge&&ge>-1){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ge].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[ge]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:u,headerVariables:p}=r.getAllDataFromTemplateComponent(i);Me({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:u,headerVariables:p})}else if(null!=ge&&-1===ge){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=r.getAllDataFromTemplateComponent(T);Me({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[ge]),t.useEffect((()=>{var e,n,t,o;if(null!=ge&&ge>-1&&Ie){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ge].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[ge]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:u,headerVariables:p}=r.getAllDataFromTemplateComponent(i);Me({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:u,headerVariables:p}),Re(!1)}}),[Ie]);const _e=ce?ke.imageComponent:Oe;return De.openEditMedia?e.jsx(h.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(m.default,{mediaComponentFormat:null!==(I=_e.format)&&void 0!==I?I:l.HEADER_TYPES.IMAGE,uploadMedia:De.uploadMedia,variableListForImage:M||[],useEditWhatsappTemplateMediaResponse:De,setOpenEditMedia:De.setOpenEditMedia,openEditMedia:De.openEditMedia,editIconRef:De.editIconRef,fileRef:ye})})):e.jsxs(h.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!ke.imageComponent&&!fe&&e.jsxs(g.EditTemplateMediaContainer,{children:[e.jsx(b.default,{imageName:null!==(U=null===(R=null==_e?void 0:_e.example)||void 0===R?void 0:R.header_handle)&&void 0!==U?U:[],handleImageChange:De.handleImageChange,mediaType:null==_e?void 0:_e.format,error:De.error,isLoading:De.loading,setOpenEditMedia:De.setOpenEditMedia,selectedVariable:u.isVariable(null!==(w=null===(A=null===(P=null==_e?void 0:_e.example)||void 0===P?void 0:P.header_handle)||void 0===A?void 0:A[0])&&void 0!==w?w:"")?null===(S=null===(N=null==_e?void 0:_e.example)||void 0===N?void 0:N.header_handle)||void 0===S?void 0:S[0]:(null===(F=null===(_=null==T?void 0:T.mapping)||void 0===_?void 0:_.header)||void 0===F?void 0:F[0])?null===(Q=null===(H=null==T?void 0:T.mapping)||void 0===H?void 0:H.header)||void 0===Q?void 0:Q[0]:De.selectedVariable}),(null==Oe?void 0:Oe.format)==l.HEADER_TYPES.DOCUMENT?e.jsx(y,{children:e.jsx(i.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Ue,errorMessage:Ae||void 0,onBlur:()=>{if(!Ue)return null==D||D(""),void we("PDF name is Required");const e=p.validateInputName(Ue);null==D||D(Ue),we(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{we(""),Pe(e)}})}):e.jsx(e.Fragment,{})]}),ke.bodyVariables.length>0&&e.jsx(O.default,{containerStyle:{paddingTop:ke.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===(Y=ke.descriptionComponents)||void 0===Y?void 0:Y.map(((n,t)=>e.jsx(C.default,{originalVariableList:null!=ge&&ge>-1?ve.cards[ge]:ve,type:n.type,descriptionComponent:n.component,showVariableModal:B,variableList:k},t))),(null===(W=null===(K=null!=ge&&ge>-1?ve.cards[ge].buttons:null==ve?void 0:ve.buttons)||void 0===K?void 0:K.filter((e=>"URL"===e.type)))||void 0===W?void 0:W.length)>0&&e.jsx(O.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(G=null===($=null!=ge&&ge>-1?ve.cards[ge].buttons:null==ve?void 0:ve.buttons)||void 0===$?void 0:$.filter((e=>me===a.POD.CHATBOT||"URL"===e.type)))||void 0===G?void 0:G.map(((n,t)=>{if("URL"===n.type)return e.jsx(x.default,{variableListIndex:t,CTAoptions:null==V?void 0:V.CTAoptions,button:n,currentVariableList:null!=ge&&ge>-1?Object.assign({},ve.cards[ge]):Object.assign({},ve),updateSelectedURLTemplateBtn:Ne,variableList:k},`${t}_${ge}`)})),me===a.POD.CHATBOT&&(null===(z=null===(X=Ce[0])||void 0===X?void 0:X.component)||void 0===z?void 0:z.buttons)&&(null===(ee=null===(Z=null===(J=Ce[0])||void 0===J?void 0:J.component)||void 0===Z?void 0:Z.buttons)||void 0===ee?void 0:ee.length)>0&&e.jsx(c.BackTrackComponent,{backTrackMessage:null===(ne=null==be?void 0:be.backTrackExtra)||void 0===ne?void 0:ne[0],setBackTrackMessage:null===(te=null==be?void 0:be.backTrackExtra)||void 0===te?void 0:te[1]}),(null===(ie=null===(oe=null!=ge&&ge>-1?ve.cards[ge].buttons:null==ve?void 0:ve.buttons)||void 0===oe?void 0:oe.filter((e=>"QUICK_REPLY"===e.type)))||void 0===ie?void 0:ie.length)>0&&(me!==a.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(c.BackTrackComponent,{backTrackMessage:null===(le=null==be?void 0:be.backTrackExtra)||void 0===le?void 0:le[0],setBackTrackMessage:null===(ae=null==be?void 0:be.backTrackExtra)||void 0===ae?void 0:ae[1]})),null===(de=null===(se=null!=ge&&ge>-1?ve.cards[ge].buttons:null==ve?void 0:ve.buttons)||void 0===se?void 0:se.filter((e=>"QUICK_REPLY"===e.type)))||void 0===de?void 0:de.map(((n,t)=>{if("QUICK_REPLY"===n.type&&me!==a.POD.CHATBOT)return e.jsx(x.default,{variableListIndex:t,QRBoptions:null==V?void 0:V.QRBoptions,button:n,currentVariableList:null!=ge&&ge>-1?Object.assign({},ve.cards[ge]):Object.assign({},ve),updateSelectedQRBTemplateBtn:Se},`${t}_${ge}`)})),me===a.POD.CHATBOT&&Ve&&e.jsx(v.DiscountCodeComponent,{discountCode:null===(re=null==be?void 0:be.discountCodeExtra)||void 0===re?void 0:re[0],setDiscountCode:null===(ue=null==be?void 0:be.discountCodeExtra)||void 0===ue?void 0:ue[1]}),null===(pe=null!=ge&&ge>-1?ve.cards[ge].buttons:null==ve?void 0:ve.buttons)||void 0===pe?void 0:pe.map(((n,t)=>{var o,i,l;if("COPY_CODE"===n.type)return e.jsx(j.default,{index:t,variable:{variableName:null!==(o=n.text)&&void 0!==o?o:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:Ee,componentType:"BUTTONS"},t)}))]}))};
7
+ `;exports.default=o=>{let{template:T,onTemplateChange:E,whatsappSpecificPickerMeta:V,showVariableModal:B,variableList:k,variableListForImage:M,discountCode:L,setDiscountCode:q,fileName:D,setFileName:I}=o;var R,U,P,A,w,N,S,_,F,H,Q,Y,K,W,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,ue,re,pe,ce,ve,me,be,ge,fe,he;const je=T.isCarouselType,{originalVariableList:Ce,pod:Oe,extras:xe,selectedCarouselIndex:Te,isProductCarouselType:ye}=s.useTemplateModalContext(),{descriptionComponents:Ee,urlBtns:Ve,qrbBtns:Be,imageComponent:ke,bodyVariables:Me,headerVariables:Le}=u.getAllDataFromTemplateComponent(T),qe=t.useRef(null),De=d.useAdditionalVariables({variableList:k,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"}),[Ie,Re]=t.useState(!1),[Ue,Pe]=t.useState(-1===Te?{descriptionComponents:Ee,urlBtns:Ve,qrbBtns:Be,imageComponent:ke,bodyVariables:Me,headerVariables:Le}:{}),{uploadMediaLink:Ae,uploadMediaFiles:we}=V,Ne=f.useEditWhatsappTemplateMedia({uploadMediaLink:Ae,uploadMediaFiles:we,updateTemplateImageUrl:function(e,t){var o,i,l,a,s,d,u,r;let p;p=null!=Te&&Te>-1?{components:null===(i=null===(o=T.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[Te].components,mapping:null===(a=null===(l=null==T?void 0:T.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Te]}:Object.assign({},T);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 n=Object.assign(Object.assign({},p.components[c]),{format:t,example:{header_handle:[e]}}),o=[...p.components];o[c]=n,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=Te&&Te>-1){const e=n.cloneDeep(T);e.components[1].cards[Te].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(u=null==e?void 0:e.mapping)||void 0===u?void 0:u.cards.length)>0&&(e.mapping.cards[Te]=null!==(r=p.mapping)&&void 0!==r?r:{}),null==E||E(Object.assign({},e)),_e(!0)}else null==E||E(Object.assign({},p))},mediaComponent:je?Ue.imageComponent:ke,fileRef:qe}),[Se,_e]=t.useState(!1),[Fe,He]=t.useState(D),[Qe,Ye]=t.useState();function Ke(e,t,o){var i,l,a,s,d,u,r,p,c,v;const m=null!=Te&&Te>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[Te].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[Te]}:Object.assign({},T),b=n.cloneDeep(m),g="custom"===t&&"string"==typeof e,f=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Te&&Te>-1&&ye){const t=Object.assign({},T).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:[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===(s=null===(a=Object.assign({},T).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=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(T);return l.components=t,l.mapping.cards=i,void(null==E||E(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==h&&h>-1){const n=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==n?void 0:n.length)>0){const i="custom"===t&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=n[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(r=null===(u=b.components)||void 0===u?void 0:u[h])||void 0===r?void 0:r.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[h]),{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[h]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Re(!0):(Re(!1),null==q||q(""))}if(null!=Te&&Te>-1){const e=n.cloneDeep(T);e.components[1].cards[Te].components=b.components,e.mapping.cards[Te]=b.mapping,null==E||E(Object.assign({},e))}else null==E||E(b)}function We(e,t,o){var i,l,a,s,d,u,r;const p=null!=Te&&Te>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[Te].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[Te]}:Object.assign({},T);if(null!=Te&&Te>-1&&ye){const t=Object.assign({},T).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=n.cloneDeep(T);return i.components=t,void(null==E||E(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!==(r=null===(u=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===u?void 0:u.buttons)&&void 0!==r?r:[]].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!=Te&&Te>-1){const e=n.cloneDeep(T);e.components[1].cards[Te].components=p.components,null==E||E(Object.assign({},e))}else null==E||E(p)}t.useEffect((()=>{var e,n;if(null===(e=T.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))Re(!0);else{Re(!1);const e=null===(n=null==xe?void 0:xe.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[T]),t.useEffect((()=>{var e,n,t,o;if(null!=Te&&Te>-1){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Te].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Te]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=u.getAllDataFromTemplateComponent(i);Pe({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=Te&&-1===Te){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=u.getAllDataFromTemplateComponent(T);Pe({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[Te]),t.useEffect((()=>{var e,n,t,o;if(null!=Te&&Te>-1&&Se){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Te].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Te]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=u.getAllDataFromTemplateComponent(i);Pe({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),_e(!1)}}),[Se]);const $e=je?Ue.imageComponent:ke;return Ne.openEditMedia?e.jsx(j.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(m.default,{mediaComponentFormat:null!==(R=$e.format)&&void 0!==R?R:l.HEADER_TYPES.IMAGE,uploadMedia:Ne.uploadMedia,variableListForImage:M||[],useEditWhatsappTemplateMediaResponse:Ne,setOpenEditMedia:Ne.setOpenEditMedia,openEditMedia:Ne.openEditMedia,editIconRef:Ne.editIconRef,fileRef:qe})})):e.jsxs(j.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:ye?"420px":"auto"}},{children:[!!Ue.imageComponent&&!ye&&e.jsxs(g.EditTemplateMediaContainer,{children:[e.jsx(b.default,{imageName:null!==(P=null===(U=null==$e?void 0:$e.example)||void 0===U?void 0:U.header_handle)&&void 0!==P?P:[],handleImageChange:Ne.handleImageChange,mediaType:null==$e?void 0:$e.format,error:Ne.error,isLoading:Ne.loading,setOpenEditMedia:Ne.setOpenEditMedia,selectedVariable:r.isVariable(null!==(N=null===(w=null===(A=null==$e?void 0:$e.example)||void 0===A?void 0:A.header_handle)||void 0===w?void 0:w[0])&&void 0!==N?N:"")?null===(_=null===(S=null==$e?void 0:$e.example)||void 0===S?void 0:S.header_handle)||void 0===_?void 0:_[0]:(null===(H=null===(F=null==T?void 0:T.mapping)||void 0===F?void 0:F.header)||void 0===H?void 0:H[0])?null===(Y=null===(Q=null==T?void 0:T.mapping)||void 0===Q?void 0:Q.header)||void 0===Y?void 0:Y[0]:Ne.selectedVariable}),(null==ke?void 0:ke.format)==l.HEADER_TYPES.DOCUMENT?e.jsx(y,{children:e.jsx(i.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Fe,errorMessage:Qe||void 0,onBlur:()=>{if(!Fe)return null==I||I(""),void Ye("PDF name is Required");const e=p.validateInputName(Fe);null==I||I(Fe),Ye(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Ye(""),He(e)}})}):e.jsx(e.Fragment,{})]}),(null===(K=Ue.bodyVariables)||void 0===K?void 0:K.length)>0&&e.jsx(O.default,{containerStyle:{paddingTop:Ue.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===(W=Ue.descriptionComponents)||void 0===W?void 0:W.map(((n,t)=>e.jsx(C.default,{originalVariableList:null!=Te&&Te>-1?Ce.cards[Te]:Ce,type:n.type,descriptionComponent:n.component,showVariableModal:B,variableList:k},t))),(null===(X=null===(G=null!=Te&&Te>-1?null===($=Ce.cards[Te])||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!=Te&&Te>-1?null===(z=Ce.cards[Te])||void 0===z?void 0:z.buttons:null==Ce?void 0:Ce.buttons)||void 0===J?void 0:J.filter((e=>Oe===a.POD.CHATBOT||"URL"===e.type)))||void 0===Z?void 0:Z.map(((n,t)=>{if("URL"===n.type)return e.jsx(x.default,{variableListIndex:t,CTAoptions:null==V?void 0:V.CTAoptions,button:n,currentVariableList:null!=Te&&Te>-1?Object.assign({},Ce.cards[Te]):Object.assign({},Ce),updateSelectedURLTemplateBtn:Ke,variableList:k},`${t}_${Te}`)})),Oe===a.POD.CHATBOT&&(null===(ne=null===(ee=Be[0])||void 0===ee?void 0:ee.component)||void 0===ne?void 0:ne.buttons)&&(null===(ie=null===(oe=null===(te=Be[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(c.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===(ue=null===(de=null!=Te&&Te>-1?null===(se=Ce.cards[Te])||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===ue?void 0:ue.length)>0&&(Oe!==a.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(c.BackTrackComponent,{backTrackMessage:null===(re=null==xe?void 0:xe.backTrackExtra)||void 0===re?void 0:re[0],setBackTrackMessage:null===(pe=null==xe?void 0:xe.backTrackExtra)||void 0===pe?void 0:pe[1]})),null===(me=null===(ve=null!=Te&&Te>-1?null===(ce=Ce.cards[Te])||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&&Oe!==a.POD.CHATBOT)return e.jsx(x.default,{variableListIndex:t,QRBoptions:null==V?void 0:V.QRBoptions,button:n,currentVariableList:null!=Te&&Te>-1?Object.assign({},Ce.cards[Te]):Object.assign({},Ce),updateSelectedQRBTemplateBtn:We},`${t}_${Te}`)})),Oe===a.POD.CHATBOT&&Ie&&e.jsx(v.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],variableList:k}),null===(he=null!=Te&&Te>-1?null===(fe=Ce.cards[Te])||void 0===fe?void 0:fe.buttons:null==Ce?void 0:Ce.buttons)||void 0===he?void 0:he.map(((n,t)=>{var o,i,l;if("COPY_CODE"===n.type)return e.jsx(h.default,{index:t,variable:{variableName:null!==(o=n.text)&&void 0!==o?o:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:De,componentType:"BUTTONS"},t)}))]}))};
@@ -1,14 +1,14 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),s=require("../../button/Button.js"),o=require("../../TypographyStyle.js"),a=require("../../../constants/Theme.js"),l=require("../Badge/index.js"),n=require("../context/templateModalContext.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const u=i(r).default.div`
2
- background: ${a.COLORS.surface.standard};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),o=require("../../button/Button.js"),n=require("../../TypographyStyle.js"),l=require("../../../constants/Theme.js"),s=require("../Badge/index.js"),i=require("../context/templateModalContext.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(r).default.div`
2
+ background: ${l.COLORS.surface.standard};
3
3
  border-top-width: 1px;
4
- border-top-color: ${a.COLORS.stroke.primary};
4
+ border-top-color: ${l.COLORS.stroke.primary};
5
5
  box-shadow: 0px -4px 12px rgba(0, 0, 0, 0.12);
6
6
  width: 100%;
7
7
  padding: 16px 24px;
8
8
  display: flex;
9
- justify-content: ${e=>e.isWhatsappCarousel?"space-between":"end"};
9
+ justify-content: ${e=>{var t;return null!==(t=e.justifyContent)&&void 0!==t?t:"end"}};
10
10
  align-items: center;
11
11
  gap: 12;
12
12
  border-bottom-left-radius: 4px;
13
13
  border-bottom-right-radius: 4px;
14
- `;exports.default=r=>{let{isWhatsappCarousel:i,onSelect:d}=r;const{isError:c,selectedCarouselIndex:p,setSelectedCarouselIndex:x,setErrorIndexes:b}=n.useTemplateModalContext(),[j,f]=t.useState(i?"Next":"Select template");return t.useEffect((()=>{i&&-1===p?f("Next"):i&&null!=p&&p>-1&&f("Save & Select Template")}),[p]),e.jsxs(u,Object.assign({isWhatsappCarousel:i},{children:[i&&null!=p&&p>=-1&&e.jsx(o.TitleRegular,Object.assign({color:a.COLORS.text.secondary},{children:`Step ${-1===p?1:2}/2`})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[c&&e.jsx(l.Badge,{errorText:"Some inputs are missing or incorrect. Please check"}),e.jsx(s.Button,{id:"select-template-btn",buttonText:j,size:i?"small":"large",onClick:function(){i&&-1===p&&x?x(0):(null==b||b([]),d())}})]}))]}))};
14
+ `;exports.default=r=>{let{isWhatsappCarousel:a,onSelect:u}=r;var c,p,x,b;const{isError:g,selectedCarouselIndex:j,setSelectedCarouselIndex:f,setErrorIndexes:m,template:v}=i.useTemplateModalContext(),[y,h]=t.useState(a?"Next":"Select template");return t.useEffect((()=>{a&&-1===j?h("Next"):a&&null!=j&&j>-1&&h("Save & Select Template")}),[j]),e.jsxs(d,Object.assign({justifyContent:a&&(null===(p=null===(c=null==v?void 0:v.mapping)||void 0===c?void 0:c.body)||void 0===p?void 0:p.length)?"space-between":"end"},{children:[a&&null!=j&&j>=-1&&(null===(b=null===(x=null==v?void 0:v.mapping)||void 0===x?void 0:x.body)||void 0===b?void 0:b.length)&&e.jsx(n.TitleRegular,Object.assign({color:l.COLORS.text.secondary},{children:`Step ${-1===j?1:2}/2`})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[g&&e.jsx(s.Badge,{errorText:"Some inputs are missing or incorrect. Please check"}),e.jsx(o.Button,{id:"select-template-btn",buttonText:y,size:a?"small":"large",onClick:function(){a&&-1===j&&f?f(0):(null==m||m([]),u())}})]}))]}))};
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("styled-components"),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");var r=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),l=require("../utils/getPreviewDimension.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=o(t),n=o(i);const d=n.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("styled-components"),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("../../template-preview/models/TemplateMeta.js");var r=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),l=require("../utils/getPreviewDimension.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(t),p=o(i);const c=p.default.div`
2
2
  position: relative;
3
3
  height: 100%;
4
4
  border-radius: 31px;
@@ -6,7 +6,7 @@
6
6
  background-color: white;
7
7
  margin: auto;
8
8
  overflow-y: auto;
9
- `,c=n.default.div`
9
+ `,d=p.default.div`
10
10
  position: absolute;
11
11
  flex: 1;
12
12
  background-color: white;
@@ -17,7 +17,9 @@
17
17
  height: calc(100% - 17px);
18
18
  border-radius: 16px;
19
19
  overflow-y: auto;
20
- `,h=p.default.forwardRef(((t,i)=>{let{display_content:o,channel:p,template:n,showSampleValues:h}=t;const{pod:u,hideDeviceContainerInPreview:v}=s.useTemplateModalContext(),w={showSampleValues:h,template:n,channel:p,smsSpecificMeta:{smsDisplayContent:o},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:u!==r.POD.CHATBOT,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426,width:240}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:o,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}},isPreview:!0};return v?e.jsx(m,{children:e.jsx(a.TemplatePreview,Object.assign({},w))}):e.jsx(e.Fragment,{children:e.jsxs(d,Object.assign({channel:p},{children:[e.jsx("img",{alt:"",src:"https://firebasestorage.googleapis.com/v0/b/staging-bikayi.appspot.com/o/bik%2FkNwEVoGlLpVjOsXoO1M8WgvWicP2%2F6f07b850-8b4b-4d58-96cc-8ba6df7b4e4a-Device___Frame.jpg?alt=media&token=253f1bfe-8481-4f54-bdef-3c0a73697d6a",style:{width:l.getPreviewWidth(p),height:443}}),e.jsx(c,Object.assign({ref:i},{children:e.jsx(a.TemplatePreview,Object.assign({},w))}))]}))})}));h.displayName="MobilePreview";const m=n.default.div`
20
+ `,h=n.default.forwardRef(((t,i)=>{let{display_content:o,channel:n,template:p,showSampleValues:h}=t;const{pod:u,hideDeviceContainerInPreview:w}=s.useTemplateModalContext(),f={showSampleValues:h,template:p,channel:n,smsSpecificMeta:{smsDisplayContent:o},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:u!==r.POD.CHATBOT,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426,width:240}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:o,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}},isPreview:!0};return w?e.jsx(m,{children:e.jsx(a.TemplatePreview,Object.assign({},f))}):e.jsx(e.Fragment,{children:e.jsxs(c,Object.assign({channel:n},{children:[e.jsx("img",{alt:"",src:"https://firebasestorage.googleapis.com/v0/b/staging-bikayi.appspot.com/o/bik%2FkNwEVoGlLpVjOsXoO1M8WgvWicP2%2F6f07b850-8b4b-4d58-96cc-8ba6df7b4e4a-Device___Frame.jpg?alt=media&token=253f1bfe-8481-4f54-bdef-3c0a73697d6a",style:{width:l.getPreviewWidth(n),height:443}}),e.jsx(d,Object.assign({ref:i},{children:e.jsx(a.TemplatePreview,Object.assign({},f))}))]}))})}));h.displayName="MobilePreview";const m=p.default.div`
21
21
  display: flex;
22
22
  align-items: center;
23
+ justify-content: center;
24
+ flex: 1;
23
25
  `;exports.default=h;
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("date-fns"),a=require("lodash"),n=require("react"),i=require("styled-components"),s=require("../../custom-date-time/CustomDateTime.js"),o=require("../../dropdown/Dropdown.js"),u=require("../../input/Input.js"),d=require("../../product-picker-v2/collectionScreen.js"),c=require("../../template-preview/constants/regexPatterns.js"),r=require("../../template-preview/models/Channels.js"),p=require("../../template-preview/models/WhatsAppTemplate.js"),m=require("../../TypographyStyle.js"),v=require("../../../utils/StringUtils.js"),b=require("../../../constants/Theme.js"),g=require("../context/templateModalContext.js"),O=require("../utils/getVariableNameEmail.js");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=j(i);const h=x.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("date-fns"),a=require("lodash"),n=require("react"),i=require("styled-components"),s=require("../../add-variableV2/AddVariableV2SideModal.js"),o=require("../../custom-date-time/CustomDateTime.js"),u=require("../../dropdown/Dropdown.js"),d=require("../../input/Input.js"),c=require("../../product-picker-v2/collectionScreen.js"),r=require("../../template-preview/constants/regexPatterns.js"),p=require("../../template-preview/models/Channels.js"),m=require("../../template-preview/models/WhatsAppTemplate.js"),v=require("../../TypographyStyle.js"),b=require("../../../utils/StringUtils.js"),g=require("../../../constants/Theme.js"),O=require("../context/templateModalContext.js"),j=require("../utils/getVariableNameEmail.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=x(i);const y=h.default.div`
2
2
  /* surface/$color-background-warning-light */
3
3
 
4
- background: ${e=>e.focused&&e.channel===r.CHANNEL_TYPE.EMAIL?b.COLORS.background.warning.light:"transparent"};
4
+ background: ${e=>e.focused&&e.channel===p.CHANNEL_TYPE.EMAIL?g.COLORS.background.warning.light:"transparent"};
5
5
  border-radius: 4px;
6
6
  padding: 8px 10px;
7
- `,y=x.default.div`
7
+ `,_=h.default.div`
8
8
  position: absolute;
9
9
  top: 0;
10
10
  left: 0;
@@ -13,4 +13,4 @@
13
13
  background-color: rgba(0, 0, 0, 0.1);
14
14
  z-index: 1000;
15
15
  cursor: not-allowed;
16
- `,_={value:"custom_link",label:"Custom URL"},f={value:"custom_text",label:"Custom text"},E={value:"static_expiry",label:"Static Expiry"};exports.Container=h,exports.default=i=>{let{onFocus:j,variable:x,index:T,showVariableModal:N,setShowDiscountCheckBox:C,componentType:A,CTAoptions:P}=i;var S,k,L,V,D;const[B,H]=n.useState(!1),[w,Y]=n.useState(""),[U,q]=n.useState([]),[R,M]=n.useState(),[I,W]=n.useState(!1),{setVariableCallback:$,setShowVariablePicker:z,device:Z,channel:F,isError:G,originalVariableList:K,template:J,templateSelectionTriggered:Q,setTemplate:X,setDisplayContent:ee,setOriginalVariableList:te,globalNormalizedPlaceholders:le,enabledCustomText:ae,pod:ne,selectedCarouselIndex:ie,isProductCarouselType:se,disableEditVariable:oe,disableEditExpiry:ue,templateErrorIndexes:de}=g.useTemplateModalContext();function ce(e,t){var l,a,n;const i=e;Y(""),M(i),F===r.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value&&"static_expiry"!==i.value?(pe(null!==(l=i.value)&&void 0!==l?l:"","string"),null==me||me(null!==(a=x.index)&&void 0!==a?a:0,i.value,!0)):(null==me||me(null!==(n=x.index)&&void 0!==n?n:0,"",!0,i.value),pe("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?pe(i.value,"url"===i.bikPlaceholderType?"link":"string"):(Y(""),pe("",i.value))}function re(e,t){var l;Y(t);const a="custom_link"===(null==R?void 0:R.value)&&t?t.includes("https")?t:`https://${t}`:t;pe(a,"static_expiry"===e?"string":e),F===r.CHANNEL_TYPE.WHATSAPP&&(null==me||me(null!==(l=x.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function pe(e,t){var l,n,i,s;const o="custom_link"===t?"link":"custom_text"===t?"string":t;if(F!==r.CHANNEL_TYPE.WHATSAPP){const a=O.getVariableNameForEmailByIndex(T+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===Z?"template_html_mobile":"template_html_desktop"),i=F===r.CHANNEL_TYPE.EMAIL?null===(l=null==n?void 0:n.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);i&&(i.textContent="custom_text"!==t&&"custom_link"!==t||e?e:x.variableName);const s=K.map(((t,l)=>l===T?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t));null==te||te(s)}if(F===r.CHANNEL_TYPE.WHATSAPP){if(null!=ie&&ie>-1&&se){const l=Object.assign({},K).cards.map(((l,a)=>{var n,i;return"BODY"===A?Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((t,l)=>T===l?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t))}):"BUTTONS"===A?Object.assign(Object.assign({},l),{buttons:null===(i=l.buttons)||void 0===i?void 0:i.map(((l,a)=>a===T?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==te||te((e=>Object.assign(Object.assign({},e),{cards:l}))))}const l=null!=ie&&ie>-1?K.cards[ie]:K;let u=l.body,d=l.header,c=l.buttons;if("BODY"===A?u=null===(n=l.body)||void 0===n?void 0:n.map(((t,l)=>l===T?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"HEADER"===A?d=null===(i=l.header)||void 0===i?void 0:i.map(((t,l)=>l===T?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"BUTTONS"===A&&(c=null===(s=l.buttons)||void 0===s?void 0:s.map(((l,a)=>a===T?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))),null!=ie&&ie>-1){const e=a.cloneDeep(K.cards);e[ie]={header:d,body:u,buttons:c},null==te||te((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==te||te((e=>Object.assign(Object.assign({},e),{header:d,body:u,buttons:c})))}}function me(e,t,l,n){var i,s,o,u,d,c,r;if(null!=ie&&ie>-1&&se){const s=Object.assign({},J).components.map((l=>{var a;return"CAROUSEL"===l.type?Object.assign(Object.assign({},l),{cards:null===(a=l.cards)||void 0===a?void 0:a.map((l=>Object.assign(Object.assign({},l),{components:l.components.map((l=>{var a,n,i,s,o,u;if("BODY"===l.type&&"BODY"===A){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const a=[...null!==(o=null===(s=null===(i=l.example)||void 0===i?void 0:i.body_text)||void 0===s?void 0:s[0])&&void 0!==o?o:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const n=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:n})}return l}if("BUTTONS"===l.type&&"BUTTONS"===A){const a=null===(u=l.buttons)||void 0===u?void 0:u.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return a?Object.assign(Object.assign({},l),{buttons:a}):l}return l}))})))}):l})),o=a.cloneDeep(J);if(l){const l=null===(i=Object.assign({},J).mapping.cards)||void 0===i?void 0:i.map(((l,a)=>{var i,s,o;if("BODY"===A)return Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((l,a)=>e===a?"custom_text"===n?`((editableVariable${a+10}))`:t:l))});if("BUTTONS"===A&&(null==l?void 0:l.buttons)){let i=-1,u=-1;return null===(s=J.components[1].cards)||void 0===s||s[a].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(i++,l===e&&"URL"==t.type&&(u=i))})))})),Object.assign(Object.assign({},l),{buttons:null===(o=l.buttons)||void 0===o?void 0:o.map(((e,l)=>l===u?"custom_link"===n?"((customPlaceholderName))":t:e))})}return l}));o.mapping.cards=l}return o.components=s,void(null==X||X(o))}const p=null!=ie&&ie>-1?{components:null===(s=Object.assign({},J).components[1].cards)||void 0===s?void 0:s[ie].components,mapping:null===(o=Object.assign({},J).mapping.cards)||void 0===o?void 0:o[ie]}:Object.assign({},J),m=null===(u=null==p?void 0:p.components)||void 0===u?void 0:u.map((l=>{var a,n,i,s,o,u,d,c,r;const p=Object.assign({},l);if("BODY"===l.type&&"BODY"===A){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const l=[...null!==(o=null===(s=null===(i=p.example)||void 0===i?void 0:i.body_text)||void 0===s?void 0:s[0])&&void 0!==o?o:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{body_text:[l]});return Object.assign(Object.assign({},p),{example:a})}}else if("HEADER"===l.type&&"HEADER"===A){if(null===(u=l.example)||void 0===u?void 0:u.header_text){const l=[...null!==(c=null===(d=p.example)||void 0===d?void 0:d.header_text)&&void 0!==c?c:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{header_text:l});return Object.assign(Object.assign({},p),{example:a})}}else{if("BUTTONS"===l.type&&"BUTTONS"===A){const a=null===(r=l.buttons)||void 0===r?void 0:r.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:"COPY_CODE"===l.type?t:[t]}):l));return a?Object.assign(Object.assign({},p),{buttons:a}):p}if("limited_time_offer"===l.type&&"limited_time_offer"===A)return Object.assign(Object.assign({},p),{example:Object.assign(Object.assign({},p.example),{limited_time_offer:t})})}return l}));if(p.components=m,l)if("BODY"===A&&(null===(d=null==p?void 0:p.mapping)||void 0===d?void 0:d.body))p.mapping=Object.assign(Object.assign({},p.mapping),{body:p.mapping.body.map(((l,a)=>e===a?"custom_text"===n?`((editableVariable${a+10}))`:t:l))});else if("HEADER"===A&&(null===(c=null==p?void 0:p.mapping)||void 0===c?void 0:c.header))p.mapping=Object.assign(Object.assign({},p.mapping),{header:p.mapping.header.map(((l,a)=>e===a?"custom_text"===n?`((editableVariable${a+20}))`:t:l))});else if("BUTTONS"===A&&(null===(r=null==p?void 0:p.mapping)||void 0===r?void 0:r.buttons)){let l=-1,a=-1;m.forEach((t=>{var n;"BUTTONS"===t.type&&(null===(n=t.buttons)||void 0===n||n.forEach(((t,n)=>{"URL"===t.type&&(l++,n===e&&"URL"==t.type&&(a=l))})))})),p.mapping=Object.assign(Object.assign({},p.mapping),{buttons:p.mapping.buttons.map(((e,l)=>l===a?"custom_link"===n?"((customPlaceholderName))":t:e))})}if(null!=ie&&ie>-1&&J){const e=a.cloneDeep(J);e.components[1].cards[ie].components=p.components,e.mapping.cards[ie]=p.mapping,null==X||X(e)}else null==X||X(Object.assign({},p))}n.useEffect((()=>{B&&(null==j||j())}),[B]),n.useEffect((()=>{!function(){var e,t,l,a,n;const i="mobile"===Z?"template_html_mobile":"template_html_desktop",s=document.getElementById(i),o=(null!==(a=null===(l=null===(t=null===(e=null==s?void 0:s.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(n=null==s?void 0:s.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);F===r.CHANNEL_TYPE.EMAIL&&(null==ee||ee(o))}()}),[Q]),n.useEffect((()=>{!function(){var e,t;const l=[];let a=[];if(F!==r.CHANNEL_TYPE.MESSAGE||ae){"link"===(null==x?void 0:x.type)?(l.push({label:"",options:[_,f]}),M(_)):"date_time"===(null==x?void 0:x.type)?(l.push({label:"",options:[_,f]}),M(E)):(l.push({label:"",options:[_,f,E]}),M(f));const e=null!=le?le:[];q([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:v.default.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),a=[...l,...e]}else{const e=null!=le?le:[];q([{label:"",options:[f,_]},...e]),a=[{label:"",options:[f,_]},...e]}if((F===r.CHANNEL_TYPE.WHATSAPP||F===r.CHANNEL_TYPE.EMAIL||F===r.CHANNEL_TYPE.MESSAGE)&&x.updatedValue)if(c.placeHolderNamePattern.test(x.updatedValue)&&F===r.CHANNEL_TYPE.WHATSAPP||x.updatedValue.startsWith("{{")&&F!==r.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===r.CHANNEL_TYPE.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(N){let t=e.updatedValue;if(ne===p.POD.CHATBOT&&"BUTTONS"===A){const l=null==P?void 0:P.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}n={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(x,a,F);e.value&&M(e)}else"date_time"===x.type?(M(E),Y(x.updatedValue),me(null!==(e=x.index)&&void 0!==e?e:0,x.updatedValue)):(null===(t=x.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(M(_),Y(x.updatedValue.split("https://")[1])):(M(f),Y(x.updatedValue))}()}),[ie]),n.useEffect((()=>{Z&&R&&w&&setTimeout((()=>{pe("custom_link"===(null==R?void 0:R.value)&&w?w.includes("https")?w:`https://${w}`:w,R.value)}),100)}),[Z]),n.useEffect((()=>{!I&&R&&x.updatedValue&&setTimeout((()=>{pe("custom_link"===(null==R?void 0:R.value)&&x.updatedValue?x.updatedValue.includes("https")?x.updatedValue:`https://${x.updatedValue}`:x.updatedValue,R.value),W(!0)}),100)}),[R]);const ve=e=>{null==C||C(!1),"{{custom.url}}"===e.actualValue?(console.log("var",e),ce({label:e.displayName,selected:!0,value:"custom_link"})):"{{custom.text}}"==e.actualValue?ce({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?ce({label:e.displayName,selected:!0,value:"static_expiry"}):ce({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})};return e.jsxs(h,Object.assign({channel:F,focused:B,onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(m.BodySecondary,Object.assign({style:{color:G&&!R?b.COLORS.content.negative:b.COLORS.content.primary}},{children:[null===(S=x.variableName)||void 0===S?void 0:S.replace("{{","").replace("}}","")," ","link"===(null==x?void 0:x.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:N?e.jsxs("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==R?void 0:R.label)?"space-between":"flex-end"}},{children:[e.jsx(m.BodyPrimary,Object.assign({numberOfLines:1},{children:ne===p.POD.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(k=null==R?void 0:R.value)&&void 0!==k?k:"")?null==R?void 0:R.label:null==R?void 0:R.value:d.truncate(null!==(L=null==R?void 0:R.label)&&void 0!==L?L:"",20,!0)})),oe||"date_time"===(null==x?void 0:x.type)&&ue?e.jsx(e.Fragment,{}):e.jsx(t.default,{onClick:()=>{$((()=>ve)),z(!0)},width:24,height:24,color:b.COLORS.content.primary})]})):e.jsx(o.Dropdown,{disabled:oe,options:U,isSearchable:!1,onSelect:ce,defaultOptions:R?[Object.assign(Object.assign({},R),{selected:!0})]:[]})})),("custom_text"===(null==R?void 0:R.value)||"custom_link"===(null==R?void 0:R.value))&&e.jsx(u.Input,{state:oe?"disabled":"none",labelText:"custom_text"===(null==R?void 0:R.value)?"Custom text value":"custom_link"===(null==R?void 0:R.value)?"Custom URL value":"",id:`variable-value-${null==R?void 0:R.value}-${T}`,value:w,errorMessage:G&&(null===(V=null==de?void 0:de.buttons)||void 0===V?void 0:V.includes(null!==(D=null==x?void 0:x.index)&&void 0!==D?D:-1))?w&&0!==w.trim().length?"custom_link"!==R.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${w.trim()}`)&&0!==w.trim().length?"custom_link"!==R.value&&w.length>30?"Length cannot be more than 30":"BUTTONS"===A&&"custom_link"!==R.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==R?void 0:R.value)?2e3:"BUTTONS"===A?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==R?void 0:R.value)?"https://":"",placeholder:"link"===x.type||"custom_link"===R.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{re(R.value,e)}}),"static_expiry"===(null==R?void 0:R.value)&&e.jsxs("div",Object.assign({style:{position:"relative"}},{children:[oe&&e.jsx(y,{onClick:e=>e.preventDefault()}),e.jsx(s.CustomDateTime,{placement:"auto",time:w?l.format(new Date(w),"hh:mm a"):l.format(new Date,"hh:mm a"),date:w?new Date(w):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{re("static_expiry",e.toISOString())}})]}))]}))};
16
+ `,f={value:"custom_link",label:"Custom URL"},E={value:"custom_text",label:"Custom text"},T={value:"static_expiry",label:"Static Expiry"};exports.Container=y,exports.default=i=>{let{onFocus:x,variable:h,index:N,showVariableModal:C,variableList:A,setShowDiscountCheckBox:S,componentType:P,CTAoptions:V}=i;var k,L,D,B,H;const[w,Y]=n.useState(!1),[U,q]=n.useState(""),[R,M]=n.useState([]),[I,W]=n.useState(),[$,z]=n.useState(!1),[Z,F]=n.useState(!1),{device:G,channel:K,isError:J,originalVariableList:Q,template:X,templateSelectionTriggered:ee,setTemplate:te,setDisplayContent:le,setOriginalVariableList:ae,globalNormalizedPlaceholders:ne,enabledCustomText:ie,pod:se,selectedCarouselIndex:oe,isProductCarouselType:ue,disableEditVariable:de,disableEditExpiry:ce,templateErrorIndexes:re}=O.useTemplateModalContext();function pe(){var e,t;const l=[];let a=[];if(K!==p.CHANNEL_TYPE.MESSAGE||ie){"link"===(null==h?void 0:h.type)?(l.push({label:"",options:[f,E]}),W(f)):"date_time"===(null==h?void 0:h.type)?(l.push({label:"",options:[f,E]}),W(T)):(l.push({label:"",options:[f,E,T]}),W(E));const e=null!=ne?ne:[];M([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:b.default.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),a=[...l,...e]}else{const e=null!=ne?ne:[];M([{label:"",options:[E,f]},...e]),a=[{label:"",options:[E,f]},...e]}if((K===p.CHANNEL_TYPE.WHATSAPP||K===p.CHANNEL_TYPE.EMAIL||K===p.CHANNEL_TYPE.MESSAGE)&&h.updatedValue)if(r.placeHolderNamePattern.test(h.updatedValue)&&K===p.CHANNEL_TYPE.WHATSAPP||h.updatedValue.startsWith("{{")&&K!==p.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===p.CHANNEL_TYPE.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(C){let t=e.updatedValue;if(se===m.POD.CHATBOT&&"BUTTONS"===P){const l=null==V?void 0:V.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}n={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(h,a,K);e.value&&W(e)}else"date_time"===h.type?(W(T),q(h.updatedValue),ge(null!==(e=h.index)&&void 0!==e?e:0,h.updatedValue)):(null===(t=h.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(W(f),q(h.updatedValue.split("https://")[1])):(W(E),q(h.updatedValue))}function me(e,t){var l,a,n;const i=e;q(""),W(i),K===p.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value&&"static_expiry"!==i.value?(be(null!==(l=i.value)&&void 0!==l?l:"","string"),null==ge||ge(null!==(a=h.index)&&void 0!==a?a:0,i.value,!0)):(null==ge||ge(null!==(n=h.index)&&void 0!==n?n:0,"",!0,i.value),be("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?be(i.value,"url"===i.bikPlaceholderType?"link":"string"):(q(""),be("",i.value))}function ve(e,t){var l;q(t);const a="custom_link"===(null==I?void 0:I.value)&&t?t.includes("https")?t:`https://${t}`:t;be(a,"static_expiry"===e?"string":e),K===p.CHANNEL_TYPE.WHATSAPP&&(null==ge||ge(null!==(l=h.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function be(e,t){var l,n,i,s;const o="custom_link"===t?"link":"custom_text"===t?"string":t;if(K!==p.CHANNEL_TYPE.WHATSAPP){const a=j.getVariableNameForEmailByIndex(N+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===G?"template_html_mobile":"template_html_desktop"),i=K===p.CHANNEL_TYPE.EMAIL?null===(l=null==n?void 0:n.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);i&&(i.textContent="custom_text"!==t&&"custom_link"!==t||e?e:h.variableName);const s=Q.map(((t,l)=>l===N?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t));null==ae||ae(s)}if(K===p.CHANNEL_TYPE.WHATSAPP){if(null!=oe&&oe>-1&&ue){const l=Object.assign({},Q).cards.map(((l,a)=>{var n,i;return"BODY"===P?Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((t,l)=>N===l?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t))}):"BUTTONS"===P?Object.assign(Object.assign({},l),{buttons:null===(i=l.buttons)||void 0===i?void 0:i.map(((l,a)=>a===N?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==ae||ae((e=>Object.assign(Object.assign({},e),{cards:l}))))}const l=null!=oe&&oe>-1?Q.cards[oe]:Q;let u=l.body,d=l.header,c=l.buttons;if("BODY"===P?u=null===(n=l.body)||void 0===n?void 0:n.map(((t,l)=>l===N?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"HEADER"===P?d=null===(i=l.header)||void 0===i?void 0:i.map(((t,l)=>l===N?Object.assign(Object.assign({},t),{type:o,updatedValue:e}):t)):"BUTTONS"===P&&(c=null===(s=l.buttons)||void 0===s?void 0:s.map(((l,a)=>a===N?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))),null!=oe&&oe>-1){const e=a.cloneDeep(Q.cards);e[oe]={header:d,body:u,buttons:c},null==ae||ae((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==ae||ae((e=>Object.assign(Object.assign({},e),{header:d,body:u,buttons:c})))}}function ge(e,t,l,n){var i,s,o,u,d,c,r;if(null!=oe&&oe>-1&&ue){const s=Object.assign({},X).components.map((l=>{var a;return"CAROUSEL"===l.type?Object.assign(Object.assign({},l),{cards:null===(a=l.cards)||void 0===a?void 0:a.map((l=>Object.assign(Object.assign({},l),{components:l.components.map((l=>{var a,n,i,s,o,u;if("BODY"===l.type&&"BODY"===P){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const a=[...null!==(o=null===(s=null===(i=l.example)||void 0===i?void 0:i.body_text)||void 0===s?void 0:s[0])&&void 0!==o?o:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const n=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:n})}return l}if("BUTTONS"===l.type&&"BUTTONS"===P){const a=null===(u=l.buttons)||void 0===u?void 0:u.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:[t]}):l));return a?Object.assign(Object.assign({},l),{buttons:a}):l}return l}))})))}):l})),o=a.cloneDeep(X);if(l){const l=null===(i=Object.assign({},X).mapping.cards)||void 0===i?void 0:i.map(((l,a)=>{var i,s,o;if("BODY"===P)return Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((l,a)=>e===a?"custom_text"===n?`((editableVariable${a+10}))`:t:l))});if("BUTTONS"===P&&(null==l?void 0:l.buttons)){let i=-1,u=-1;return null===(s=X.components[1].cards)||void 0===s||s[a].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(i++,l===e&&"URL"==t.type&&(u=i))})))})),Object.assign(Object.assign({},l),{buttons:null===(o=l.buttons)||void 0===o?void 0:o.map(((e,l)=>l===u?"custom_link"===n?"((customPlaceholderName))":t:e))})}return l}));o.mapping.cards=l}return o.components=s,void(null==te||te(o))}const p=null!=oe&&oe>-1?{components:null===(s=Object.assign({},X).components[1].cards)||void 0===s?void 0:s[oe].components,mapping:null===(o=Object.assign({},X).mapping.cards)||void 0===o?void 0:o[oe]}:Object.assign({},X),m=null===(u=null==p?void 0:p.components)||void 0===u?void 0:u.map((l=>{var a,n,i,s,o,u,d,c,r;const p=Object.assign({},l);if("BODY"===l.type&&"BODY"===P){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const l=[...null!==(o=null===(s=null===(i=p.example)||void 0===i?void 0:i.body_text)||void 0===s?void 0:s[0])&&void 0!==o?o:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{body_text:[l]});return Object.assign(Object.assign({},p),{example:a})}}else if("HEADER"===l.type&&"HEADER"===P){if(null===(u=l.example)||void 0===u?void 0:u.header_text){const l=[...null!==(c=null===(d=p.example)||void 0===d?void 0:d.header_text)&&void 0!==c?c:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},p.example),{header_text:l});return Object.assign(Object.assign({},p),{example:a})}}else{if("BUTTONS"===l.type&&"BUTTONS"===P){const a=null===(r=l.buttons)||void 0===r?void 0:r.map(((l,a)=>a===e?Object.assign(Object.assign({},l),{example:"COPY_CODE"===l.type?t:[t]}):l));return a?Object.assign(Object.assign({},p),{buttons:a}):p}if("limited_time_offer"===l.type&&"limited_time_offer"===P)return Object.assign(Object.assign({},p),{example:Object.assign(Object.assign({},p.example),{limited_time_offer:t})})}return l}));if(p.components=m,l)if("BODY"===P&&(null===(d=null==p?void 0:p.mapping)||void 0===d?void 0:d.body))p.mapping=Object.assign(Object.assign({},p.mapping),{body:p.mapping.body.map(((l,a)=>e===a?"custom_text"===n?`((editableVariable${a+10}))`:t:l))});else if("HEADER"===P&&(null===(c=null==p?void 0:p.mapping)||void 0===c?void 0:c.header))p.mapping=Object.assign(Object.assign({},p.mapping),{header:p.mapping.header.map(((l,a)=>e===a?"custom_text"===n?`((editableVariable${a+20}))`:t:l))});else if("BUTTONS"===P&&(null===(r=null==p?void 0:p.mapping)||void 0===r?void 0:r.buttons)){let l=-1,a=-1;m.forEach((t=>{var n;"BUTTONS"===t.type&&(null===(n=t.buttons)||void 0===n||n.forEach(((t,n)=>{"URL"===t.type&&(l++,n===e&&"URL"==t.type&&(a=l))})))})),p.mapping=Object.assign(Object.assign({},p.mapping),{buttons:p.mapping.buttons.map(((e,l)=>l===a?"custom_link"===n?"((customPlaceholderName))":t:e))})}if(null!=oe&&oe>-1&&X){const e=a.cloneDeep(X);e.components[1].cards[oe].components=p.components,e.mapping.cards[oe]=p.mapping,null==te||te(e)}else null==te||te(Object.assign({},p))}return n.useEffect((()=>{w&&(null==x||x())}),[w]),n.useEffect((()=>{!function(){var e,t,l,a,n;const i="mobile"===G?"template_html_mobile":"template_html_desktop",s=document.getElementById(i),o=(null!==(a=null===(l=null===(t=null===(e=null==s?void 0:s.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(n=null==s?void 0:s.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);K===p.CHANNEL_TYPE.EMAIL&&(null==le||le(o))}()}),[ee]),n.useEffect((()=>{pe()}),[]),n.useEffect((()=>{pe()}),[oe]),n.useEffect((()=>{G&&I&&U&&setTimeout((()=>{be("custom_link"===(null==I?void 0:I.value)&&U?U.includes("https")?U:`https://${U}`:U,I.value)}),100)}),[G]),n.useEffect((()=>{!Z&&I&&h.updatedValue&&setTimeout((()=>{be("custom_link"===(null==I?void 0:I.value)&&h.updatedValue?h.updatedValue.includes("https")?h.updatedValue:`https://${h.updatedValue}`:h.updatedValue,I.value),F(!0)}),100)}),[I]),e.jsxs(y,Object.assign({channel:K,focused:w,onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(v.BodySecondary,Object.assign({style:{color:J&&!I?g.COLORS.content.negative:g.COLORS.content.primary}},{children:[null===(k=h.variableName)||void 0===k?void 0:k.replace("{{","").replace("}}","")," ","link"===(null==h?void 0:h.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:C?e.jsxs("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==I?void 0:I.label)?"space-between":"flex-end"}},{children:[e.jsx(v.BodyPrimary,Object.assign({numberOfLines:1},{children:se===m.POD.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(L=null==I?void 0:I.value)&&void 0!==L?L:"")?null==I?void 0:I.label:null==I?void 0:I.value:c.truncate(null!==(D=null==I?void 0:I.label)&&void 0!==D?D:"",20,!0)})),de||"date_time"===(null==h?void 0:h.type)&&ce?e.jsx(e.Fragment,{}):e.jsx(t.default,{onClick:()=>{z(!$)},width:24,height:24,color:g.COLORS.content.primary})]})):e.jsx(u.Dropdown,{disabled:de,options:R,isSearchable:!1,onSelect:me,defaultOptions:I?[Object.assign(Object.assign({},I),{selected:!0})]:[]})})),("custom_text"===(null==I?void 0:I.value)||"custom_link"===(null==I?void 0:I.value))&&e.jsx(d.Input,{state:de?"disabled":"none",labelText:"custom_text"===(null==I?void 0:I.value)?"Custom text value":"custom_link"===(null==I?void 0:I.value)?"Custom URL value":"",id:`variable-value-${null==I?void 0:I.value}-${N}`,value:U,errorMessage:J&&(null===(B=null==re?void 0:re.buttons)||void 0===B?void 0:B.includes(null!==(H=null==h?void 0:h.index)&&void 0!==H?H:-1))?U&&0!==U.trim().length?"custom_link"!==I.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${U.trim()}`)&&0!==U.trim().length?"custom_link"!==I.value&&U.length>30?"Length cannot be more than 30":"BUTTONS"===P&&"custom_link"!==I.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==I?void 0:I.value)?2e3:"BUTTONS"===P?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==I?void 0:I.value)?"https://":"",placeholder:"link"===h.type||"custom_link"===I.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{ve(I.value,e)}}),"static_expiry"===(null==I?void 0:I.value)&&e.jsxs("div",Object.assign({style:{position:"relative"}},{children:[de&&e.jsx(_,{onClick:e=>e.preventDefault()}),e.jsx(o.CustomDateTime,{placement:"auto",time:U?l.format(new Date(U),"hh:mm a"):l.format(new Date,"hh:mm a"),date:U?new Date(U):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{ve("static_expiry",e.toISOString())}})]})),$&&e.jsx(s.AddVariableV2SideModal,{zIndex:2e3,data:null!=A?A:[],showVariable:$,setShowVariable:z,placeholder:"Add a variable",customTrigger:e=>{null==S||S(!1),"{{custom.url}}"===e.actualValue?me({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?me({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?me({label:e.displayName,selected:!0,value:"static_expiry"}):me({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),i=require("react"),a=require("styled-components"),s=require("../../checkBox/CheckBox.js"),r=require("../../input/Input.js"),l=require("../../tooltips/Tooltip.js"),n=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js"),c=require("../../../assets/icons/plus.svg.js"),d=require("../context/templateModalContext.js"),u=require("./VariableConnector.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(a);const p=x.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../../assets/icons/info.svg.js"),t=require("react"),i=require("styled-components"),r=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js");var s=require("../../../assets/icons/plus.svg.js");require("../../add-variableV2/AddVariableV2.styled.js"),require("../../button/Button.js"),require("../../icon-button/IconButton.js");var l=require("../../input/Input.js"),n=require("../../tooltips/Tooltip.js"),o=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var d=require("../../TypographyStyle.js"),c=require("../../checkBox/CheckBox.js"),u=require("../context/templateModalContext.js"),h=require("./VariableConnector.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=x(i);const p=b.default.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  height: 100%;
5
- `,g=x.default.button`
5
+ `,j=b.default.button`
6
6
  padding: 2px 8px;
7
7
  cursor: pointer;
8
8
  color: white;
@@ -25,4 +25,4 @@
25
25
  align-items: center;
26
26
  gap: 5px;
27
27
  }
28
- `;exports.AddVariableStyled=g,exports.Container=p,exports.default=a=>{let{onFocus:h,showVariableModal:x,variableList:j,discountCode:b,setDiscountCode:f}=a;const{originalVariableList:y,disableEditVariable:v,setVariableCallback:m,setShowVariablePicker:O}=d.useTemplateModalContext(),[C,k]=i.useState(!1),[S,V]=i.useState(!1),[w,q]=i.useState(""),[T,L]=i.useState(!1),B=i.useRef(),E=i.useRef();i.useEffect((()=>{f&&f(b+w)}),[w]),i.useEffect((()=>{y.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(k(!0),b&&L&&L(!0))}))}),[y]);const R=e=>{q(e.actualValue)};return e.jsxs(p,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[e.jsx(n.TitleRegular,Object.assign({style:{color:o.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(l.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(t.default,{width:20,height:20,color:o.COLORS.content.placeholder})}))}))]})),e.jsx(n.BodySecondary,Object.assign({style:{color:o.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==y?void 0:y.map(((t,i)=>!t.isEditableVariable||v?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(n.BodySecondary,Object.assign({style:{color:o.COLORS.content.primary}},{children:["Locked variable ",i+1]})),e.jsx(r.Input,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),i):e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(u.default,{index:i,variable:t,onFocus:()=>null==h?void 0:h(i),showVariableModal:x,variableList:j,setShowDiscountCheckBox:k})}),i))),(C||b)&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(s.CheckBox,{isChecked:T,onValueChange:()=>{T&&f&&f(""),L(!T)}}),e.jsx(n.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),T&&e.jsxs("div",Object.assign({ref:B,style:{margin:10}},{children:[e.jsx(r.Input,{placeholder:"Enter your discount code",onChangeText:e=>{f&&f(e)},value:b,onFocus:()=>{V(!0)},onBlur:e=>{var t;"addVar"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.id)?(B.current&&B.current.focus(),V(!0)):V(!1)},noErrorHint:!0,validate:e=>[!0,""]}),S&&e.jsx(g,Object.assign({ref:E,id:"addVar",onClick:e=>{e.stopPropagation(),m((()=>R)),O(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(c.default,{width:20,height:20,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})};
28
+ `;exports.AddVariableStyled=j,exports.Container=p,exports.default=i=>{let{onFocus:x,showVariableModal:b,variableList:g,discountCode:f,setDiscountCode:v}=i;const{originalVariableList:y,disableEditVariable:m}=u.useTemplateModalContext(),[V,O]=t.useState(!1),[q,S]=t.useState(!1),[C,w]=t.useState(!1),[k,T]=t.useState(""),[B,L]=t.useState(!1),E=t.useRef(),A=t.useRef();return t.useEffect((()=>{v&&v(f+k)}),[k]),t.useEffect((()=>{y.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(O(!0),f&&L&&L(!0))}))}),[y]),e.jsxs(p,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[e.jsx(d.TitleRegular,Object.assign({style:{color:o.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(n.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(a.default,{width:20,height:20,color:o.COLORS.content.placeholder})}))}))]})),e.jsx(d.BodySecondary,Object.assign({style:{color:o.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==y?void 0:y.map(((a,t)=>!a.isEditableVariable||m?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(d.BodySecondary,Object.assign({style:{color:o.COLORS.content.primary}},{children:["Locked variable ",t+1]})),e.jsx(l.Input,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),t):e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(h.default,{index:t,variable:a,onFocus:()=>null==x?void 0:x(t),showVariableModal:b,variableList:g,setShowDiscountCheckBox:O})}),t))),(V||f)&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(c.CheckBox,{isChecked:B,onValueChange:()=>{B&&v&&v(""),L(!B)}}),e.jsx(d.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),B&&e.jsxs("div",Object.assign({ref:E,style:{margin:10}},{children:[e.jsx(l.Input,{placeholder:"Enter your discount code",onChangeText:e=>{v&&v(e)},value:f,onFocus:()=>{S(!0)},onBlur:e=>{var a;"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)?(E.current&&E.current.focus(),S(!0)):(S(!1),w(!1))},noErrorHint:!0,validate:e=>[!0,""]}),q&&e.jsx(j,Object.assign({ref:A,id:"addVar",onClick:e=>{e.stopPropagation(),w(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:20,height:20,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),C&&e.jsx(r.AddVariableV2SideModal,{zIndex:2e3,data:null!=g?g:[],showVariable:C,setShowVariable:w,variableValue:k,setVariableValue:T,placeholder:"Add a variable",customTrigger:e=>{T(e.actualValue),S(!1)}})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),d=require("../custom-hooks/useAdditionalVariables.js"),b=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=j=>{let{variableListIndex:m,button:g,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:O,currentVariableList:x,CTAoptions:f,QRBoptions:y,variableList:L}=j;var h,R,U,V;const[C,T]=l.useState(""),[I,w]=l.useState(),q=d.useAdditionalVariables({variableList:L,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"});console.log("updatedVariableList",q);const{isError:N,disableEditVariable:P,pod:E,selectedCarouselIndex:S,originalVariableList:_,setOriginalVariableList:B,isProductCarouselType:H}=c.useTemplateModalContext();function M(e){if(T(e),null!=S&&S>-1&&H){const l=t.cloneDeep(_);if("URL"===g.type){const t=l.cards.map((t=>{let l=t.buttons.filter((e=>"URL"===e.type))[m];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=t.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e));return Object.assign(Object.assign({},t),{buttons:s})}));null==B||B((e=>Object.assign(Object.assign({},e),{cards:t}))),null==v||v(`https://${e}`,"custom",m)}return}let l=x.buttons.filter((e=>"URL"===e.type))[m];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e)),a=Object.assign({},null!=S&&S>-1?_.cards[S]:_);if(a.buttons=s,null!=S&&S>-1){const e=[..._.cards];e[S]=a,null==B||B((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==B||B((e=>Object.assign(Object.assign({},e),{buttons:[...s]})));null==v||v(`https://${e}`,"custom",m)}return l.useEffect((()=>{var e;if(g.buttonVariable&&n.editableVarPattern.test(g.buttonVariable))w(i.CUSTOM_URL_NAME),T((null===(e=g.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===g.type?f:y;e="URL"===g.type?t.findIndex((e=>e.placeHolder===g.buttonVariable)):t.findIndex((e=>e.label===g.flowName)),e>-1&&w(t[e])}}),[]),E!==o.POD.CHATBOT?e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:u.COLORS.content.primary}},{children:[g.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(s.Dropdown,{disabled:P,options:"URL"===g.type?f:y,isSearchable:!0,onSelect:function(e,l){const s=e;w(s);const a=("URL"===g.type?f:y).find((e=>e.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=S&&S>-1&&H){const e=t.cloneDeep(_);if("URL"===g.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"URL"===e.type))[m];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder});const l=e.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",m),null==B||B((e=>Object.assign(Object.assign({},e),{cards:t})))}else if("QUICK_REPLY"===g.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"QUICK_REPLY"===e.type))[m];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value});const l=e.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==O||O({flowName:s.label,flowId:s.value},"placeholder",m),null==B||B((e=>Object.assign(Object.assign({},e),{cards:t})))}return}let e;if("URL"===g.type){let t=x.buttons.filter((e=>"URL"===e.type))[m];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder}),e=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",m)}else{let t=x.buttons.filter((e=>"QUICK_REPLY"===e.type))[m];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value}),e=x.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==O||O({flowName:s.label,flowId:s.value},"placeholder",m)}const l=Object.assign({},null!=S&&S>-1?_.cards[S]:_);if(l.buttons=e,null!=S&&S>-1){const e=[..._.cards];e[S]=l,null==B||B((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==B||B((t=>Object.assign(Object.assign({},t),{buttons:[...e]})))}else M("")},defaultOptions:I?[Object.assign(Object.assign({},I),{selected:!0})]:[]})})),"custom_link"===(null==I?void 0:I.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:P?"disabled":"none",errorMessage:N?C?b.validateIsUrl(C)?"":"Enter valid URL":"Required field":"",value:C,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:M,maxCharLimit:2e3})}))]}):e.jsx(p.default,{index:m,variable:{variableName:null!==(h=g.text)&&void 0!==h?h:"",updatedValue:"((customPlaceholderName))"===g.buttonVariable?`${null===(R=g.example)||void 0===R?void 0:R[0]}`:null!==(U=g.buttonVariable)&&void 0!==U?U:"",type:"link",isEditableVariable:!0,index:null!==(V=g.index)&&void 0!==V?V:0},showVariableModal:!0,componentType:"BUTTONS",variableList:q,CTAoptions:f})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),d=require("../custom-hooks/useAdditionalVariables.js"),b=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=j=>{let{variableListIndex:m,button:g,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:O,currentVariableList:x,CTAoptions:f,QRBoptions:y,variableList:L}=j;var h,R,U,V;const[C,T]=l.useState(""),[I,w]=l.useState(),q=d.useAdditionalVariables({variableList:L,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"}),{isError:N,disableEditVariable:P,pod:E,selectedCarouselIndex:S,originalVariableList:_,setOriginalVariableList:B,isProductCarouselType:H}=c.useTemplateModalContext();function M(e){if(T(e),null!=S&&S>-1&&H){const l=t.cloneDeep(_);if("URL"===g.type){const t=l.cards.map((t=>{let l=t.buttons.filter((e=>"URL"===e.type))[m];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=t.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e));return Object.assign(Object.assign({},t),{buttons:s})}));null==B||B((e=>Object.assign(Object.assign({},e),{cards:t}))),null==v||v(`https://${e}`,"custom",m)}return}let l=x.buttons.filter((e=>"URL"===e.type))[m];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e)),a=Object.assign({},null!=S&&S>-1?_.cards[S]:_);if(a.buttons=s,null!=S&&S>-1){const e=[..._.cards];e[S]=a,null==B||B((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==B||B((e=>Object.assign(Object.assign({},e),{buttons:[...s]})));null==v||v(`https://${e}`,"custom",m)}return l.useEffect((()=>{var e;if(g.buttonVariable&&n.editableVarPattern.test(g.buttonVariable))w(i.CUSTOM_URL_NAME),T((null===(e=g.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===g.type?f:y;e="URL"===g.type?t.findIndex((e=>e.placeHolder===g.buttonVariable)):t.findIndex((e=>e.label===g.flowName)),e>-1&&w(t[e])}}),[]),E!==o.POD.CHATBOT?e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:u.COLORS.content.primary}},{children:[g.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(s.Dropdown,{disabled:P,options:"URL"===g.type?f:y,isSearchable:!0,onSelect:function(e,l){const s=e;w(s);const a=("URL"===g.type?f:y).find((e=>e.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=S&&S>-1&&H){const e=t.cloneDeep(_);if("URL"===g.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"URL"===e.type))[m];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder});const l=e.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",m),null==B||B((e=>Object.assign(Object.assign({},e),{cards:t})))}else if("QUICK_REPLY"===g.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"QUICK_REPLY"===e.type))[m];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value});const l=e.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==O||O({flowName:s.label,flowId:s.value},"placeholder",m),null==B||B((e=>Object.assign(Object.assign({},e),{cards:t})))}return}let e;if("URL"===g.type){let t=x.buttons.filter((e=>"URL"===e.type))[m];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder}),e=x.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",m)}else{let t=x.buttons.filter((e=>"QUICK_REPLY"===e.type))[m];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value}),e=x.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==O||O({flowName:s.label,flowId:s.value},"placeholder",m)}const l=Object.assign({},null!=S&&S>-1?_.cards[S]:_);if(l.buttons=e,null!=S&&S>-1){const e=[..._.cards];e[S]=l,null==B||B((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==B||B((t=>Object.assign(Object.assign({},t),{buttons:[...e]})))}else M("")},defaultOptions:I?[Object.assign(Object.assign({},I),{selected:!0})]:[]})})),"custom_link"===(null==I?void 0:I.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:P?"disabled":"none",errorMessage:N?C?b.validateIsUrl(C)?"":"Enter valid URL":"Required field":"",value:C,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:M,maxCharLimit:2e3})}))]}):e.jsx(p.default,{index:m,variable:{variableName:null!==(h=g.text)&&void 0!==h?h:"",updatedValue:"((customPlaceholderName))"===g.buttonVariable?`${null===(R=g.example)||void 0===R?void 0:R[0]}`:null!==(U=g.buttonVariable)&&void 0!==U?U:"",type:"link",isEditableVariable:!0,index:null!==(V=g.index)&&void 0!==V?V:0},showVariableModal:!0,componentType:"BUTTONS",variableList:q,CTAoptions:f})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("lodash"),t=require("react"),i=require("../../helpers/FileUploaderHelper.js"),o=require("../../template-preview/models/TemplateMeta.js"),l=require("../context/templateModalContext.js"),a=require("../utils/validateIsUrl.js");exports.useEditWhatsappTemplateMedia=s=>{const{uploadMediaLink:r,updateTemplateImageUrl:d,mediaComponent:c,uploadMediaFiles:u,fileRef:p}=s,{template:m,selectedCarouselIndex:v,setTemplate:f}=l.useTemplateModalContext(),[E,g]=t.useState(void 0),[h,b]=t.useState(),[_,M]=t.useState(!1),[I,T]=t.useState(""),[y,A]=t.useState(!1),[S,j]=t.useState(),R=t.useRef(null);function U(n){var t;return e.__awaiter(this,void 0,void 0,(function*(){const e=new i.FileUploaderHelper;if(n instanceof Blob){const i=e.validate({file:n});if(i)T(i),A(!1),M(!1);else{const e=c.format===o.HEADER_TYPES.IMAGE,i=yield u({file:n,fileName:E,isImage:e});if(i.success){const[e]=n.type.split("/");d(null!==(t=i.url)&&void 0!==t?t:"","application"===e?o.HEADER_TYPES.DOCUMENT:o.HEADER_TYPES[e.toUpperCase()])}else T("An unknown technical error occurred");A(!1),M(!1)}}else T("An unknown technical error occurred"),A(!1)}))}function C(){var e;console.log("handleImageChange",p,null==p?void 0:p.current),(null===(e=null==p?void 0:p.current)||void 0===e?void 0:e.click)&&p.current.click()}return t.useEffect((()=>{g(void 0),j(void 0),b(void 0),M(!1),A(!1),T("")}),[v]),{uploadMedia:function(t){var l,s,u,E,g,h;return e.__awaiter(this,void 0,void 0,(function*(){if(T(""),b(""),console.log("uef uploadMedia",p,null==p?void 0:p.current),t)if(t.startsWith("https"))try{if(A(!0),console.log("uploadMediaLink",r),r){const e=yield r(t),{type:n,size:a,success:s}=e;if(s){const t=(new i.FileUploaderHelper).validate({linkData:{type:n,size:a}});if(t)return T(t),void A(!1);const[s]=n.split("/");d(null!==(l=e.url)&&void 0!==l?l:"",s.includes("application")?o.HEADER_TYPES.DOCUMENT:o.HEADER_TYPES[s.toUpperCase()])}else T("An unknown technical error occurred");A(!1)}else{const e=yield fetch(t),n=yield e.blob();yield U(n)}}catch(e){T("An unknown technical error occurred")}else if(a.isVariable(t)){let e;if(b(t),e=null!=v&&v>-1?{components:null===(u=null===(s=m.components[1])||void 0===s?void 0:s.cards)||void 0===u?void 0:u[v].components,mapping:null===(g=null===(E=null==m?void 0:m.mapping)||void 0===E?void 0:E.cards)||void 0===g?void 0:g[v]}:Object.assign({},m),e.components){const n=null===(h=null==e?void 0:e.components)||void 0===h?void 0:h.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==n&&n>-1&&(null==e?void 0:e.components[n])){const i=Object.assign(Object.assign({},e.components[n]),{format:c.format,example:{header_handle:[t]}}),o=[...e.components];o[n]=i,e.components=o}}if(e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[t]})),A(!1),null!=v&&v>-1){const t=n.cloneDeep(m);t.components[1].cards[v].components=e.components,t.mapping.cards[v]=e.mapping,null==f||f(Object.assign({},t))}else null==f||f(Object.assign({},e))}else A(!1),T("Invalid URL or variable");else C()}))},processImageUpload:U,handleImageUpload:function(e){var n;T(""),A(!0);const t=null===(n=e.target.files)||void 0===n?void 0:n[0];if(c.format===o.HEADER_TYPES.IMAGE){const e=new FileReader;j(""),g(""),e.onload=()=>{j(e.result),g(null==t?void 0:t.name)},t&&e.readAsDataURL(t)}else U(t)},handleImageChange:C,onCropComplete:function(n){return e.__awaiter(this,void 0,void 0,(function*(){A(!1),T("");const e=yield fetch(n),t=yield e.blob();yield U(t),j(void 0),M(!1)}))},editIconRef:R,fileName:E,setFileName:g,selectedVariable:h,setSelectedVariable:b,openEditMedia:_,setOpenEditMedia:M,selectedImage:S,setSelectedImage:j,loading:y,setLoading:A,error:I,setError:T}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("lodash"),i=require("react"),n=require("../../helpers/FileUploaderHelper.js"),o=require("../../template-preview/models/TemplateMeta.js"),l=require("../context/templateModalContext.js"),a=require("../utils/validateIsUrl.js");exports.useEditWhatsappTemplateMedia=s=>{const{uploadMediaLink:r,updateTemplateImageUrl:d,mediaComponent:c,uploadMediaFiles:p,fileRef:u}=s,{template:m,selectedCarouselIndex:v,setTemplate:f}=l.useTemplateModalContext(),[E,g]=i.useState(void 0),[h,b]=i.useState(),[_,T]=i.useState(!1),[y,A]=i.useState(""),[I,M]=i.useState(!1),[S,j]=i.useState(),R=i.useRef(null);function U(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){const e=new n.FileUploaderHelper;if(t instanceof Blob){const n=e.validate({file:t});if(n)A(n),M(!1),T(!1);else{const e=c.format===o.HEADER_TYPES.IMAGE,n=yield p({file:t,fileName:E,isImage:e});if(n.success){const[e]=t.type.split("/");d(null!==(i=n.url)&&void 0!==i?i:"","application"===e?o.HEADER_TYPES.DOCUMENT:o.HEADER_TYPES[e.toUpperCase()])}else M(!1),A("An unknown technical error occurred");M(!1),T(!1)}}else A("An unknown technical error occurred"),M(!1)}))}function D(){var e;(null===(e=null==u?void 0:u.current)||void 0===e?void 0:e.click)&&u.current.click()}return i.useEffect((()=>{g(void 0),j(void 0),b(void 0),T(!1),M(!1),A("")}),[v]),{uploadMedia:function(i){var l,s,p,u,E,g;return e.__awaiter(this,void 0,void 0,(function*(){if(A(""),b(""),i)if(i.startsWith("https"))try{if(M(!0),r){const e=yield r(i),{type:t,size:a,success:s}=e;if(s){const i=(new n.FileUploaderHelper).validate({linkData:{type:t,size:a}});if(i)return A(i),void M(!1);const[s]=t.split("/");d(null!==(l=e.url)&&void 0!==l?l:"",s.includes("application")?o.HEADER_TYPES.DOCUMENT:o.HEADER_TYPES[s.toUpperCase()])}else M(!1),A("An unknown technical error occurred");M(!1)}else{const e=yield fetch(i),t=yield e.blob();yield U(t)}}catch(e){M(!1),A("An unknown technical error occurred")}else if(a.isVariable(i)){let e;if(b(i),e=null!=v&&v>-1?{components:null===(p=null===(s=m.components[1])||void 0===s?void 0:s.cards)||void 0===p?void 0:p[v].components,mapping:null===(E=null===(u=null==m?void 0:m.mapping)||void 0===u?void 0:u.cards)||void 0===E?void 0:E[v]}:Object.assign({},m),e.components){const t=null===(g=null==e?void 0:e.components)||void 0===g?void 0:g.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==t&&t>-1&&(null==e?void 0:e.components[t])){const n=Object.assign(Object.assign({},e.components[t]),{format:c.format,example:{header_handle:[i]}}),o=[...e.components];o[t]=n,e.components=o}}if(e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[i]})),M(!1),null!=v&&v>-1){const i=t.cloneDeep(m);i.components[1].cards[v].components=e.components,i.mapping.cards[v]=e.mapping,null==f||f(Object.assign({},i))}else null==f||f(Object.assign({},e))}else M(!1),A("Invalid URL or variable");else D()}))},processImageUpload:U,handleImageUpload:function(e){var t;A(""),M(!0);const i=null===(t=e.target.files)||void 0===t?void 0:t[0];if(c.format===o.HEADER_TYPES.IMAGE){const e=new FileReader;j(""),g(""),e.onload=()=>{j(e.result),g(null==i?void 0:i.name)},i&&e.readAsDataURL(i)}else U(i)},handleImageChange:D,onCropComplete:function(t){return e.__awaiter(this,void 0,void 0,(function*(){M(!1),A("");const e=yield fetch(t),i=yield e.blob();yield U(i),j(void 0),T(!1)}))},editIconRef:R,fileName:E,setFileName:g,selectedVariable:h,setSelectedVariable:b,openEditMedia:_,setOpenEditMedia:T,selectedImage:S,setSelectedImage:j,loading:I,setLoading:M,error:y,setError:A}};
@@ -0,0 +1 @@
1
+ export declare const BACKGROUND_PREVIEW_IMAGE = "https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BACKGROUND_PREVIEW_IMAGE="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f";
@@ -1,24 +1,24 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e);const d=o.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("styled-components"),e=require("../../constants/Theme.js");function t(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var o=t(r);const d=o.default.div`
2
2
  padding: 16px;
3
3
  padding-bottom: 12px;
4
4
  border-top-left-radius: 4px;
5
5
  border-top-right-radius: 4px;
6
- border: 1px solid ${r.COLORS.stroke.primary};
6
+ border: 1px solid ${e.COLORS.stroke.primary};
7
7
  `,i=o.default.div`
8
8
  width: 100%;
9
9
  display: flex;
10
10
  align-items: center;
11
11
  justify-content: center;
12
- border-left: 1px solid ${r.COLORS.stroke.primary};
13
- border-right: 1px solid ${r.COLORS.stroke.primary};
14
- border-top-color: ${r.COLORS.stroke.primary};
15
- border-top-width: ${e=>e.hideHeader?"1px":"0px"};
12
+ border-left: 1px solid ${e.COLORS.stroke.primary};
13
+ border-right: 1px solid ${e.COLORS.stroke.primary};
14
+ border-top-color: ${e.COLORS.stroke.primary};
15
+ border-top-width: ${r=>r.hideHeader?"1px":"0px"};
16
16
  overflow: scroll;
17
17
  `,a=o.default.div`
18
18
  width: 100%;
19
19
  height: 100%;
20
- background-color: ${r.BASE_COLORS.grayscale[100]};
21
- `,n=o.default.div`
20
+ background-color: ${e.BASE_COLORS.grayscale[100]};
21
+ `,s=o.default.div`
22
22
  height: 100%;
23
23
  display: flex;
24
24
  flex-direction: column;
@@ -26,18 +26,20 @@
26
26
  justify-content: center;
27
27
  flex-grow: 1;
28
28
  min-height: 180px;
29
- `,s=o.default.div`
29
+ border-left: 1px solid ${e.COLORS.stroke.primary};
30
+ border-right: 1px solid ${e.COLORS.stroke.primary};
31
+ `,n=o.default.div`
30
32
  display: flex;
31
33
  justify-content: center;
32
34
  width: 100%;
33
- background: ${r.COLORS.surface.standard};
35
+ background: ${e.COLORS.surface.standard};
34
36
  border-bottom-left-radius: 4px;
35
37
  border-bottom-right-radius: 4px;
36
- border: 1px solid ${r.COLORS.stroke.primary};
38
+ border: 1px solid ${e.COLORS.stroke.primary};
37
39
  `,l=o.default.div`
38
40
  border-radius: 4px;
39
- background-color: ${r.COLORS.surface.standard};
40
- margin-top: ${e=>e.hideHeader?0:16};
41
+ background-color: ${e.COLORS.surface.standard};
42
+ margin-top: ${r=>r.hideHeader?0:16};
41
43
  display: flex;
42
44
  flex-direction: column;
43
- `;exports.CardLoadingContainer=a,exports.EmailContainer=l,exports.Header=d,exports.IframeContainer=n,exports.ImageContainer=i,exports.ViewButton=s;
45
+ `;exports.CardLoadingContainer=a,exports.EmailContainer=l,exports.Header=d,exports.IframeContainer=s,exports.ImageContainer=i,exports.ViewButton=n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("../template-context-mapper/context/templateModalContext.js"),t=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),n=require("./EmailTemplateThumbnailPreview.js"),s=require("./models/Channels.js"),r=require("./SmsTemplatePreview.js"),o=require("./WhatsAppTemplatePreview.js");const d={WhatsAppWrapper:{backgroundColor:a.COLORS.surface.standard,borderRadius:4,border:`1px solid ${a.COLORS.background.inactive}`,marginTop:16}};exports.TemplatePreview=p=>{let{template:u,channel:m,whatsAppSpecificMeta:c,templateCreationsInfo:v,hideHeader:h,size:C,onlyTemplateContent:j,emailSpecificMeta:S,smsSpecificMeta:x,showSampleValues:T,carouselCardIndex:b,isWhatsappCarousel:g,isPreview:y}=p;var w,O;const{setSelectedCarouselIndex:P}=l.useTemplateModalContext();return m===s.CHANNEL_TYPE.SMS?e.jsx("div",Object.assign({style:Object.assign({marginTop:v?16:0,border:v?`1px solid ${a.COLORS.stroke.primary}`:"none",borderRadius:4},null==x?void 0:x.templateContainerStyles)},{children:e.jsx(r.default,{template:u,hideHeader:h,onlyTemplateContent:j,size:null!=C?C:"large",variableStore:null==x?void 0:x.smsVariableStore,display_content:null==x?void 0:x.smsDisplayContent})})):m===s.CHANNEL_TYPE.EMAIL?e.jsx("div",Object.assign({style:Object.assign({marginTop:v?16:0},null==S?void 0:S.templateContainerStyles)},{children:e.jsx(n.default,{template:u,handleViewTemplate:()=>{var e;null===(e=null==S?void 0:S.handleViewTemplate)||void 0===e||e.call(S)},hideHeader:h,hideViewButton:null==S?void 0:S.hideViewButtonForEmail,containerStyle:null==S?void 0:S.containerStyle,emailDisplayContent:null==S?void 0:S.emailDisplayContent,emailHtmlContainerId:null==S?void 0:S.emailHtmlContainerId})})):m===s.CHANNEL_TYPE.WHATSAPP?e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},null==c?void 0:c.templateContainerStyles),v?d.WhatsAppWrapper:{}),onClick:()=>{P&&g&&P(null!=b?b:-1)}},{children:[v?e.jsx("div",Object.assign({style:{padding:16}},{children:e.jsx(i.TitleRegular,{children:t.default.convertToTitleCase(null!==(w=null==u?void 0:u.label)&&void 0!==w?w:"")})})):e.jsx(e.Fragment,{}),e.jsx(o.default,{showSampleValues:T,showHeader:null==c?void 0:c.showWhatsAppHeader,extras:null==c?void 0:c.whatsAppExtras,template:u,size:v?"small":null!=C?C:"large",containerStyle:Object.assign({borderWidth:v?0:1,borderTopWidth:1},null!==(O=null==c?void 0:c.containerStyle)&&void 0!==O?O:{}),zeroStateComponent:null==c?void 0:c.zeroStateComponent,usePlaceHolderName:null==c?void 0:c.usePlaceHolderName,carouselCardIndex:b,isWhatsappCarousel:g,isPreview:y})]})):e.jsx(e.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("../template-context-mapper/context/templateModalContext.js"),t=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),n=require("./EmailTemplateThumbnailPreview.js"),r=require("./models/Channels.js"),s=require("./SmsTemplatePreview.js"),o=require("./WhatsAppTemplatePreview.js");const d={WhatsAppWrapper:{backgroundColor:a.COLORS.surface.standard,borderRadius:4,border:`1px solid ${a.COLORS.background.inactive}`,marginTop:16}};exports.TemplatePreview=p=>{let{template:u,channel:m,whatsAppSpecificMeta:c,templateCreationsInfo:v,hideHeader:h,size:j,onlyTemplateContent:C,emailSpecificMeta:g,smsSpecificMeta:S,showSampleValues:b,carouselCardIndex:x,isWhatsappCarousel:y,isPreview:T}=p;var O,w;const{setSelectedCarouselIndex:P}=l.useTemplateModalContext();return m===r.CHANNEL_TYPE.SMS?e.jsx("div",Object.assign({style:Object.assign({marginTop:v?16:0,border:v?`1px solid ${a.COLORS.stroke.primary}`:"none",borderRadius:4},null==S?void 0:S.templateContainerStyles)},{children:e.jsx(s.default,{template:u,hideHeader:h,onlyTemplateContent:C,size:null!=j?j:"large",variableStore:null==S?void 0:S.smsVariableStore,display_content:null==S?void 0:S.smsDisplayContent})})):m===r.CHANNEL_TYPE.EMAIL?e.jsx("div",Object.assign({style:Object.assign({marginTop:v?16:0},null==g?void 0:g.templateContainerStyles)},{children:e.jsx(n.default,{template:u,handleViewTemplate:()=>{var e;null===(e=null==g?void 0:g.handleViewTemplate)||void 0===e||e.call(g)},hideHeader:h,hideViewButton:null==g?void 0:g.hideViewButtonForEmail,containerStyle:null==g?void 0:g.containerStyle,emailDisplayContent:null==g?void 0:g.emailDisplayContent,emailHtmlContainerId:null==g?void 0:g.emailHtmlContainerId})})):m===r.CHANNEL_TYPE.WHATSAPP?e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},null==c?void 0:c.templateContainerStyles),v?d.WhatsAppWrapper:{}),onClick:()=>{var e,l;if(P&&y){if(-1===x&&!(null===(l=null===(e=null==u?void 0:u.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length))return;P(null!=x?x:-1)}}},{children:[v?e.jsx("div",Object.assign({style:{padding:16}},{children:e.jsx(i.TitleRegular,{children:t.default.convertToTitleCase(null!==(O=null==u?void 0:u.label)&&void 0!==O?O:"")})})):e.jsx(e.Fragment,{}),e.jsx(o.default,{showSampleValues:b,showHeader:null==c?void 0:c.showWhatsAppHeader,extras:null==c?void 0:c.whatsAppExtras,template:u,size:v?"small":null!=j?j:"large",containerStyle:Object.assign(Object.assign({borderWidth:v?0:1,borderTopWidth:1},null!==(w=null==c?void 0:c.containerStyle)&&void 0!==w?w:{}),{height:"100%"}),zeroStateComponent:null==c?void 0:c.zeroStateComponent,usePlaceHolderName:null==c?void 0:c.usePlaceHolderName,carouselCardIndex:x,isWhatsappCarousel:y,isPreview:T})]})):e.jsx(e.Fragment,{})};
@@ -4,4 +4,4 @@
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `;exports.default=a=>{const{bodyText:j,footerText:m,headerMediaType:y,headerText:S,headerAssetLink:g,headerAssetName:f,quickReplybtn:v,ctaBtn:q,actionTypes:E,textType:b,extras:w,showHeader:C,imagePreviewStyles:A,size:N,children:O,isPreview:F}=a,M=new l.WhatsAppFormatToHTML,P=i.useMemo((()=>({color:d.COLORS.content.primary,margin:12,fontSize:C?d.FONTS.caption.fontSize:d.FONTS.bodySecondary.fontSize,fontWeight:d.FONTS.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e.jsxs(p.Container,Object.assign({isPreview:F},{children:[e.jsx(u,{children:e.jsx(t.default,{color:"white",height:8,width:8})}),y===c.HEADER_TYPES.TEXT?e.jsx(T.default,{bold:!0,text:S}):y!==c.HEADER_TYPES.NONE?e.jsx(x.MediaCard,{headerAssetLink:g,headerAssetName:f,mediaType:y,imagePreviewStyles:y===c.HEADER_TYPES.IMAGE?A:{}}):e.jsx(e.Fragment,{}),!!j&&e.jsx(e.Fragment,{children:O?e.jsx(e.Fragment,{children:O}):e.jsx(e.Fragment,{children:"html"===b?e.jsx("div",{className:"richTextEditor",style:P,dangerouslySetInnerHTML:{__html:M.convertToHTML(j)}}):e.jsx(n.BodySecondary,{children:j})})}),e.jsxs(p.FooterWrapper,{children:[e.jsx(o.Tooltip,Object.assign({body:null!=m?m:"",placement:"top"},{children:e.jsx(p.TimeStamp,Object.assign({style:{flex:1}},{children:m}))})),e.jsx(p.TimeStamp,{children:"16:48"})]}),E===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(h.ChatBtn,{text:t.text},r)))}):E===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==q?void 0:q.map(((t,i)=>e.jsx(h.ChatBtn,{textTypography:C?n.Caption:n.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:s.default,size:N},i)))}):e.jsx(e.Fragment,{})]}))};
7
+ `;exports.default=a=>{const{bodyText:j,footerText:m,headerMediaType:y,headerText:g,headerAssetLink:S,headerAssetName:f,quickReplybtn:v,ctaBtn:q,actionTypes:E,textType:b,extras:w,showHeader:C,imagePreviewStyles:A,size:N,children:F,isPreview:O}=a,M=new l.WhatsAppFormatToHTML,P=i.useMemo((()=>({color:d.COLORS.content.primary,margin:12,fontSize:C?d.FONTS.caption.fontSize:d.FONTS.bodySecondary.fontSize,fontWeight:d.FONTS.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e.jsxs(p.Container,Object.assign({isPreview:O},{children:[e.jsx(u,{children:e.jsx(t.default,{color:"white",height:8,width:8})}),y===c.HEADER_TYPES.TEXT?e.jsx(T.default,{bold:!0,text:g}):y!==c.HEADER_TYPES.NONE?e.jsx(x.MediaCard,{headerAssetLink:S,headerAssetName:f,mediaType:y,imagePreviewStyles:y===c.HEADER_TYPES.IMAGE?A:{}}):e.jsx(e.Fragment,{}),!!j&&e.jsx(e.Fragment,{children:F?e.jsx(e.Fragment,{children:F}):e.jsx(e.Fragment,{children:"html"===b?e.jsx("div",{className:"richTextEditor",style:P,dangerouslySetInnerHTML:{__html:M.convertToHTML(j)}}):e.jsx(n.BodySecondary,{children:j})})}),e.jsxs(p.FooterWrapper,{children:[e.jsx(o.Tooltip,Object.assign({body:null!=m?m:"",placement:"top"},{children:e.jsx(p.FooterText,Object.assign({style:{flex:1}},{children:m}))})),e.jsx(p.TimeStamp,{children:"16:48"})]}),E===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(h.ChatBtn,{text:t.text},r)))}):E===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==q?void 0:q.map(((t,i)=>e.jsx(h.ChatBtn,{textTypography:C?n.Caption:n.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:s.default,size:N},i)))}):e.jsx(e.Fragment,{})]}))};