@bikdotai/bik-component-library 0.0.533-beta.16 → 0.0.533-beta.2

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 (297) hide show
  1. package/dist/cjs/assets/{bundle-c485438b.css → bundle-0deb4a74.css} +2 -325
  2. package/dist/cjs/assets/icons/emoji.svg.js +1 -1
  3. package/dist/cjs/assets/icons/halfRectangle.svg.js +1 -1
  4. package/dist/cjs/assets/icons/strikeThrough.svg.js +1 -1
  5. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
  6. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
  7. package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
  8. package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  9. package/dist/cjs/components/TypographyStyle.d.ts +0 -24
  10. package/dist/cjs/components/TypographyStyle.js +14 -74
  11. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +0 -4
  12. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
  13. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.d.ts +0 -7
  14. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
  15. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +0 -1
  16. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  17. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMetric.d.ts +0 -1
  18. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
  19. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.d.ts +0 -1
  20. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js +1 -1
  21. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
  22. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
  23. package/dist/cjs/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
  24. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
  25. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  26. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +0 -1
  27. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
  28. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  29. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
  30. package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
  31. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -20
  32. package/dist/cjs/components/bik-layout/SidebarStyles.js +1 -1
  33. package/dist/cjs/components/card-selector/CardSelector.d.ts +0 -1
  34. package/dist/cjs/components/card-selector/CardSelector.js +1 -1
  35. package/dist/cjs/components/card-selector/CardSelectorGroup.js +1 -1
  36. package/dist/cjs/components/carousel-preview/CarouselPreview.d.ts +1 -4
  37. package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
  38. package/dist/cjs/components/carousel-preview/CarouselPreview.style.d.ts +2 -4
  39. package/dist/cjs/components/carousel-preview/CarouselPreview.style.js +27 -56
  40. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
  41. package/dist/cjs/components/checkBox/CheckBox.d.ts +0 -4
  42. package/dist/cjs/components/checkBox/CheckBox.js +1 -1
  43. package/dist/cjs/components/checkBox/CheckBox.styled.d.ts +0 -1
  44. package/dist/cjs/components/checkBox/CheckBox.styled.js +3 -4
  45. package/dist/cjs/components/checkList/CheckList.d.ts +0 -1
  46. package/dist/cjs/components/checkList/CheckList.js +1 -1
  47. package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  48. package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +2 -1
  49. package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
  50. package/dist/cjs/components/datePicker/index.d.ts +0 -1
  51. package/dist/cjs/components/discount-modal/DiscountUtils.js +1 -1
  52. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  53. package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
  54. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  55. package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +0 -1
  56. package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
  57. package/dist/cjs/components/dropdown/type.d.ts +0 -3
  58. package/dist/cjs/components/dynamic-tabs/DynamicTabs.d.ts +0 -2
  59. package/dist/cjs/components/dynamic-tabs/DynamicTabs.js +1 -1
  60. package/dist/cjs/components/floater/floater.js +1 -1
  61. package/dist/cjs/components/icon-button/IconButton.js +1 -1
  62. package/dist/cjs/components/icon-button/model.d.ts +0 -5
  63. package/dist/cjs/components/input/Input.d.ts +0 -2
  64. package/dist/cjs/components/input/Input.js +1 -1
  65. package/dist/cjs/components/input/Input.styled.d.ts +0 -2
  66. package/dist/cjs/components/input/Input.styled.js +1 -1
  67. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +1 -6
  68. package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -2
  69. package/dist/cjs/components/list-item/ListItem.d.ts +1 -1
  70. package/dist/cjs/components/list-item/themes.js +1 -1
  71. package/dist/cjs/components/plans/NewSubscriptionPlan.js +1 -1
  72. package/dist/cjs/components/plans/SubscriptionPlan.d.ts +0 -1
  73. package/dist/cjs/components/radioButton/RadioButton.d.ts +0 -3
  74. package/dist/cjs/components/radioButton/RadioButton.js +1 -1
  75. package/dist/cjs/components/radioList/RadioList.d.ts +0 -1
  76. package/dist/cjs/components/radioList/RadioList.js +1 -1
  77. package/dist/cjs/components/spinner/Spinner.d.ts +0 -6
  78. package/dist/cjs/components/spinner/Spinner.js +1 -18
  79. package/dist/cjs/components/states/StateComponent.d.ts +0 -2
  80. package/dist/cjs/components/states/StateComponent.js +1 -1
  81. package/dist/cjs/components/states/StateComponent.styled.d.ts +1 -4
  82. package/dist/cjs/components/states/StateComponent.styled.js +6 -6
  83. package/dist/cjs/components/states-modal/StateModalComponent.d.ts +0 -2
  84. package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
  85. package/dist/cjs/components/stepper/Stepper.d.ts +0 -2
  86. package/dist/cjs/components/stepper/Stepper.js +1 -1
  87. package/dist/cjs/components/stepper/Stepper.styled.d.ts +0 -1
  88. package/dist/cjs/components/stepper/Stepper.styled.js +7 -7
  89. package/dist/cjs/components/tabs/Tabs.js +1 -1
  90. package/dist/cjs/components/tabs/Tabs.model.d.ts +0 -1
  91. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +1 -0
  92. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  93. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +1 -12
  94. package/dist/cjs/components/template-context-mapper/context/templateModalContext.js +1 -1
  95. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  96. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +7 -11
  97. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  98. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.style.js +1 -0
  99. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  100. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  101. package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +5 -5
  102. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -5
  103. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  104. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  105. package/dist/cjs/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
  106. package/dist/cjs/components/template-preview/EmailTemplatePreview.styled.js +14 -16
  107. package/dist/cjs/components/template-preview/SmsTemplatePreview.d.ts +0 -1
  108. package/dist/cjs/components/template-preview/SmsTemplatePreview.js +1 -1
  109. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  110. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.js +1 -1
  111. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.d.ts +0 -5
  112. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +8 -14
  113. package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +2 -2
  114. package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
  115. package/dist/cjs/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +5 -6
  116. package/dist/cjs/components/template-preview/helpers/SmsTemplateHelper.d.ts +1 -1
  117. package/dist/cjs/components/template-preview/helpers/SmsTemplateHelper.js +1 -1
  118. package/dist/cjs/components/template-preview/models/SmsTemplate.d.ts +0 -1
  119. package/dist/cjs/components/tooltips/TooltipInternal.d.ts +1 -1
  120. package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
  121. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
  122. package/dist/cjs/components/variable-picker-v3/recommendVaribles.js +1 -1
  123. package/dist/cjs/components/variable-picker-v3/styles.js +2 -4
  124. package/dist/cjs/hooks/useOutside.d.ts +1 -1
  125. package/dist/cjs/hooks/useOutside.js +1 -1
  126. package/dist/cjs/index.d.ts +0 -2
  127. package/dist/cjs/index.js +1 -1
  128. package/dist/esm/assets/{bundle-c485438b.css → bundle-0deb4a74.css} +2 -325
  129. package/dist/esm/assets/icons/emoji.svg.js +1 -1
  130. package/dist/esm/assets/icons/halfRectangle.svg.js +1 -1
  131. package/dist/esm/assets/icons/strikeThrough.svg.js +1 -1
  132. package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleDate.js +1 -1
  133. package/dist/esm/components/QueryBuilder/components/Connectors/Components/TwoDate.js +1 -1
  134. package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
  135. package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  136. package/dist/esm/components/TypographyStyle.d.ts +0 -24
  137. package/dist/esm/components/TypographyStyle.js +17 -77
  138. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +0 -4
  139. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
  140. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.d.ts +0 -7
  141. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
  142. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +0 -1
  143. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  144. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMetric.d.ts +0 -1
  145. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMetric.js +1 -1
  146. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.d.ts +0 -1
  147. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsMultiChip.js +1 -1
  148. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
  149. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
  150. package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.js +1 -1
  151. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
  152. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  153. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +0 -1
  154. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
  155. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  156. package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js +1 -1
  157. package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
  158. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -20
  159. package/dist/esm/components/bik-layout/SidebarStyles.js +1 -1
  160. package/dist/esm/components/card-selector/CardSelector.d.ts +0 -1
  161. package/dist/esm/components/card-selector/CardSelector.js +1 -1
  162. package/dist/esm/components/card-selector/CardSelectorGroup.js +1 -1
  163. package/dist/esm/components/carousel-preview/CarouselPreview.d.ts +1 -4
  164. package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
  165. package/dist/esm/components/carousel-preview/CarouselPreview.style.d.ts +2 -4
  166. package/dist/esm/components/carousel-preview/CarouselPreview.style.js +27 -56
  167. package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
  168. package/dist/esm/components/checkBox/CheckBox.d.ts +0 -4
  169. package/dist/esm/components/checkBox/CheckBox.js +1 -1
  170. package/dist/esm/components/checkBox/CheckBox.styled.d.ts +0 -1
  171. package/dist/esm/components/checkBox/CheckBox.styled.js +5 -6
  172. package/dist/esm/components/checkList/CheckList.d.ts +0 -1
  173. package/dist/esm/components/checkList/CheckList.js +1 -1
  174. package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  175. package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +2 -1
  176. package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
  177. package/dist/esm/components/datePicker/index.d.ts +0 -1
  178. package/dist/esm/components/discount-modal/DiscountUtils.js +1 -1
  179. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  180. package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
  181. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  182. package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +0 -1
  183. package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
  184. package/dist/esm/components/dropdown/type.d.ts +0 -3
  185. package/dist/esm/components/dynamic-tabs/DynamicTabs.d.ts +0 -2
  186. package/dist/esm/components/dynamic-tabs/DynamicTabs.js +1 -1
  187. package/dist/esm/components/floater/floater.js +1 -1
  188. package/dist/esm/components/icon-button/IconButton.js +1 -1
  189. package/dist/esm/components/icon-button/model.d.ts +0 -5
  190. package/dist/esm/components/input/Input.d.ts +0 -2
  191. package/dist/esm/components/input/Input.js +1 -1
  192. package/dist/esm/components/input/Input.styled.d.ts +0 -2
  193. package/dist/esm/components/input/Input.styled.js +1 -1
  194. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +1 -6
  195. package/dist/esm/components/input-with-vars/InputWithVariables.js +2 -2
  196. package/dist/esm/components/list-item/ListItem.d.ts +1 -1
  197. package/dist/esm/components/list-item/themes.js +1 -1
  198. package/dist/esm/components/plans/NewSubscriptionPlan.js +1 -1
  199. package/dist/esm/components/plans/SubscriptionPlan.d.ts +0 -1
  200. package/dist/esm/components/radioButton/RadioButton.d.ts +0 -3
  201. package/dist/esm/components/radioButton/RadioButton.js +1 -1
  202. package/dist/esm/components/radioList/RadioList.d.ts +0 -1
  203. package/dist/esm/components/radioList/RadioList.js +1 -1
  204. package/dist/esm/components/spinner/Spinner.d.ts +0 -6
  205. package/dist/esm/components/spinner/Spinner.js +1 -18
  206. package/dist/esm/components/states/StateComponent.d.ts +0 -2
  207. package/dist/esm/components/states/StateComponent.js +1 -1
  208. package/dist/esm/components/states/StateComponent.styled.d.ts +1 -4
  209. package/dist/esm/components/states/StateComponent.styled.js +6 -6
  210. package/dist/esm/components/states-modal/StateModalComponent.d.ts +0 -2
  211. package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
  212. package/dist/esm/components/stepper/Stepper.d.ts +0 -2
  213. package/dist/esm/components/stepper/Stepper.js +1 -1
  214. package/dist/esm/components/stepper/Stepper.styled.d.ts +0 -1
  215. package/dist/esm/components/stepper/Stepper.styled.js +6 -6
  216. package/dist/esm/components/tabs/Tabs.js +1 -1
  217. package/dist/esm/components/tabs/Tabs.model.d.ts +0 -1
  218. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +1 -0
  219. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  220. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +1 -12
  221. package/dist/esm/components/template-context-mapper/context/templateModalContext.js +1 -1
  222. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  223. package/dist/esm/components/template-context-mapper/modalElements/Body.js +7 -11
  224. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  225. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.style.js +1 -0
  226. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  227. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  228. package/dist/esm/components/template-context-mapper/modalElements/Footer.js +5 -5
  229. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +1 -3
  230. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +2 -2
  231. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  232. package/dist/esm/components/template-context-mapper/modalElements/useEditWhtasappTemplateMedia.js +1 -1
  233. package/dist/esm/components/template-preview/EmailTemplatePreview.styled.js +0 -2
  234. package/dist/esm/components/template-preview/SmsTemplatePreview.d.ts +0 -1
  235. package/dist/esm/components/template-preview/SmsTemplatePreview.js +1 -1
  236. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  237. package/dist/esm/components/template-preview/WhatsApp/ChatUI.js +2 -2
  238. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.d.ts +0 -5
  239. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +17 -23
  240. package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
  241. package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
  242. package/dist/esm/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +5 -6
  243. package/dist/esm/components/template-preview/helpers/SmsTemplateHelper.d.ts +1 -1
  244. package/dist/esm/components/template-preview/helpers/SmsTemplateHelper.js +1 -1
  245. package/dist/esm/components/template-preview/models/SmsTemplate.d.ts +0 -1
  246. package/dist/esm/components/tooltips/TooltipInternal.d.ts +1 -1
  247. package/dist/esm/components/variable-picker-v3/Content.js +1 -1
  248. package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
  249. package/dist/esm/components/variable-picker-v3/recommendVaribles.js +1 -1
  250. package/dist/esm/components/variable-picker-v3/styles.js +4 -6
  251. package/dist/esm/hooks/useOutside.d.ts +1 -1
  252. package/dist/esm/hooks/useOutside.js +1 -1
  253. package/dist/esm/index.d.ts +0 -2
  254. package/dist/esm/index.js +1 -1
  255. package/package.json +2 -4
  256. package/dist/cjs/assets/icons/chat-channel.svg.js +0 -1
  257. package/dist/cjs/assets/icons/email-channel.svg.js +0 -1
  258. package/dist/cjs/assets/icons/instagram-channel.svg.js +0 -1
  259. package/dist/cjs/assets/icons/similar.svg.js +0 -1
  260. package/dist/cjs/assets/icons/whatsapp-channel.svg.js +0 -1
  261. package/dist/cjs/components/action-button/ActionButton.styled.d.ts +0 -7
  262. package/dist/cjs/components/action-button/ActionButton.styled.js +0 -23
  263. package/dist/cjs/components/action-button/ActionButtons.d.ts +0 -10
  264. package/dist/cjs/components/action-button/ActionButtons.js +0 -1
  265. package/dist/cjs/components/action-button/index.d.ts +0 -1
  266. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.d.ts +0 -4
  267. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.js +0 -1
  268. package/dist/cjs/components/carousel-preview/CustomCarouselArrows.d.ts +0 -7
  269. package/dist/cjs/components/carousel-preview/CustomCarouselArrows.js +0 -1
  270. package/dist/cjs/components/input-with-vars/customPortal.d.ts +0 -8
  271. package/dist/cjs/components/input-with-vars/customPortal.js +0 -1
  272. package/dist/cjs/components/progress-bar-v2/ProgressBarV2.d.ts +0 -21
  273. package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js +0 -1
  274. package/dist/cjs/components/progress-bar-v2/index.d.ts +0 -1
  275. package/dist/cjs/components/template-context-mapper/utils/constants.d.ts +0 -1
  276. package/dist/cjs/components/template-context-mapper/utils/constants.js +0 -1
  277. package/dist/esm/assets/icons/chat-channel.svg.js +0 -1
  278. package/dist/esm/assets/icons/email-channel.svg.js +0 -1
  279. package/dist/esm/assets/icons/instagram-channel.svg.js +0 -1
  280. package/dist/esm/assets/icons/similar.svg.js +0 -1
  281. package/dist/esm/assets/icons/whatsapp-channel.svg.js +0 -1
  282. package/dist/esm/components/action-button/ActionButton.styled.d.ts +0 -7
  283. package/dist/esm/components/action-button/ActionButton.styled.js +0 -23
  284. package/dist/esm/components/action-button/ActionButtons.d.ts +0 -10
  285. package/dist/esm/components/action-button/ActionButtons.js +0 -1
  286. package/dist/esm/components/action-button/index.d.ts +0 -1
  287. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.d.ts +0 -4
  288. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChipChannelFooter.js +0 -1
  289. package/dist/esm/components/carousel-preview/CustomCarouselArrows.d.ts +0 -7
  290. package/dist/esm/components/carousel-preview/CustomCarouselArrows.js +0 -1
  291. package/dist/esm/components/input-with-vars/customPortal.d.ts +0 -8
  292. package/dist/esm/components/input-with-vars/customPortal.js +0 -1
  293. package/dist/esm/components/progress-bar-v2/ProgressBarV2.d.ts +0 -21
  294. package/dist/esm/components/progress-bar-v2/ProgressBarV2.js +0 -1
  295. package/dist/esm/components/progress-bar-v2/index.d.ts +0 -1
  296. package/dist/esm/components/template-context-mapper/utils/constants.d.ts +0 -1
  297. package/dist/esm/components/template-context-mapper/utils/constants.js +0 -1
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import o from"../../../assets/icons/arrow_back.svg.js";import i from"../../../assets/icons/chevronLeft.svg.js";import n from"../../../assets/icons/chevronRight.svg.js";import r from"../../../assets/icons/PlusIcon.js";import{cloneDeep as a}from"lodash";import{useState as d,useEffect as s}from"react";import{Button as c}from"../../button/Button.js";import{IconButton as u}from"../../icon-button/IconButton.js";import{ProductPickerModal as p,ScreenName as m}from"../../product-picker-v2/modal.js";import{Badge as v}from"../Badge/index.js";import{useTemplateModalContext as h}from"../context/templateModalContext.js";import g from"./EditWhatsAppTemplateV2.js";import{ProductBox as f}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as y}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as b}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as j,TitleRegular as x,BodySecondary as C,BodyCaption as I}from"../../TypographyStyle.js";const w=w=>{let{template:k,whatsappSpecificPickerMeta:O,showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}=w;var E,B,A,V,D,F,M,R;const{selectedCarouselIndex:W,setTemplate:$,pickerConf:q,isProductCarouselType:N,pod:_,cardCount:z,carouselProducts:G,setCarouselProducts:H,isError:J,cardImages:K,disableEditVariable:Q,onDeleteSelectedProducts:U,setSelectedCarouselIndex:X,setVariableCallback:Y,setShowVariablePicker:Z,sliderRef:ee}=h(),[te,le]=d(-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(B=null===(E=null==k?void 0:k.mapping)||void 0===E?void 0:E.body)||void 0===B?void 0:B.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(V=null===(A=null==k?void 0:k.mapping)||void 0===A?void 0:A.body)||void 0===V?void 0:V.length)?"(Step 2/2)":"")),[oe,ie]=d(!1),[ne,re]=d(!1),ae=W===(null!=z?z:-1)-1,de=(null!=W?W:-1)<1;s((()=>{var e,t,l,o;le(-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(t=null===(e=null==k?void 0:k.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(l=null==k?void 0:k.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[W]);const se=e=>{null==H||H([{name:"variable",productName:e.actualValue}])};return e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[null!=W&&W>=0&&!!(null===(F=null===(D=null==k?void 0:k.mapping)||void 0===D?void 0:D.body)||void 0===F?void 0:F.length)&&t(u,{Icon:o,onClick:()=>{null==X||X(-1)}}),t(j,Object.assign({style:{marginLeft:10}},{children:te}))]})),N&&(null!==(M=null==G?void 0:G.length)&&void 0!==M?M:0)>0&&null!=W&&W>=0&&e("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(f,{editItem:()=>{1===(null==G?void 0:G.length)&&"variable"===G[0].name?(Y((()=>se)),Z(!0)):ie(!oe)},cardBody:1===(null==G?void 0:G.length)&&"variable"===G[0].name?`${G[0].productName}`:`${null==G?void 0:G.length} Products Selected`,hideIcon:1===(null==G?void 0:G.length)&&"variable"===G[0].name,deleteItem:()=>{var e;if(1===(null==G?void 0:G.length)&&"variable"===G[0].name)return void(null==H||H([]));const t=a(Object.assign({},k));t&&(K&&K.length>0?null==K||K.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=K[l])&&void 0!==o?o:"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==$||$(t)),null==H||H([]),null==U||U()}}),G&&(null==G?void 0:G.length)>0&&"variable"!=G[0].name&&t(c,{disabled:(null!==(R=null==G?void 0:G.length)&&void 0!==R?R:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{re(!0),ie(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!Q&&N&&0===(null==G?void 0:G.length)&&null!=W&&W>=0&&e(l,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(x,{children:"Product(s)"}),t(C,{children:`Select ${null!=z?z:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:J?16:12,marginRight:J?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(c,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:J?`2px dashed ${y.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:J?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(r,{width:18,height:18,color:y.content.secondary})})),onClick:e=>{ie(!0)}}),_===b.CHATBOT&&e(l,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),t(I,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(c,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:J?`2px dashed ${y.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:J?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(r,{width:18,height:18,color:y.content.secondary})})),onClick:e=>{Y((()=>se)),Z(!0)}})]})]})),J&&t("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:t(v,{padding:"8px",errorText:"Please add products"})}))]}),!N&&(null!=W?W:-1)>-1&&e("div",Object.assign({style:{display:"flex",background:y.surface.hovered,alignItems:"center"}},{children:[t(u,{Icon:i,disabled:de,width:8,height:14,svgStyle:de?{}:{color:y.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickPrev(),(null!=W?W:-1)<1||null==X||X((e=>e-1))}}),t(x,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:y.content.secondary},{children:`Card ${(null!=W?W:0)+1}/${z}`})),t(u,{Icon:n,width:8,height:14,disabled:ae,svgStyle:ae?{}:{color:y.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickNext(),(null!=W?W:-1)>=(null!=z?z:-1)-1||null==X||X((e=>e+1))}})]})),t(g,{whatsappSpecificPickerMeta:O,template:k,onTemplateChange:e=>{null==$||$(e)},showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}),oe&&q&&t(p,{zIndex:200,startupScreen:ne?m.RearrangeProducts:m.Collections,rearrangeEnabled:!0,storeId:q.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,o=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in t[e].products||(t[e].products[o]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[o].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=G?G:[]),collectionFetcher:q.fetchCollections,productFetcher:q.fetchProducts,onAdd:(e,t)=>{var l,o,i,n,r,d;re(!1);const s=[];delete e.isCustom;for(const t of Object.keys(e)){const a=e[t].products;if(void 0!==a&&Object.keys(a).length)for(const e of Object.keys(a)){const c=a[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=a[e])||void 0===l?void 0:l.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(n=null===(i=a[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(d=null===(r=a[e])||void 0===r?void 0:r.image)&&void 0!==d?d:""};s.push(g)}}}const c=s.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=s.map((e=>e.image)),p=a(Object.assign({},k));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==K?void 0:K[t])&&void 0!==l?l:""]})),null==$||$(p)),null==H||H(c),ie(!1)},searchInCollectionFetcher:q.searchInCollection,searchFetcher:q.searchProducts,visible:oe,onClose:()=>{ie(!1)},exactLimit:null!=z?z:1})]}))};export{w as default};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import l from"../../../assets/icons/arrow_back.svg.js";import i from"../../../assets/icons/PlusIcon.js";import{cloneDeep as r}from"lodash";import{useState as n,useEffect as a}from"react";import{Button as s}from"../../button/Button.js";import{IconButton as d}from"../../icon-button/IconButton.js";import{ProductPickerModal as c,ScreenName as m}from"../../product-picker-v2/modal.js";import{Badge as p}from"../Badge/index.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import h from"./EditWhatsAppTemplateV2.js";import{ProductBox as g}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as v}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as f}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as y,TitleRegular as b,BodySecondary as j,BodyCaption as x}from"../../TypographyStyle.js";const C=C=>{let{template:I,whatsappSpecificPickerMeta:w,showVariableModal:O,variableListForImage:P,discountCode:k,setDiscountCode:T}=C;var S,B;const{selectedCarouselIndex:E,setTemplate:L,pickerConf:A,isProductCarouselType:V,pod:F,cardCount:M,carouselProducts:W,setCarouselProducts:D,isError:q,cardImages:R,disableEditVariable:$,onDeleteSelectedProducts:N,setSelectedCarouselIndex:_,setVariableCallback:z,setShowVariablePicker:G}=u(),[H,J]=n(-1==E?"First Message (Step 1/2)":V?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)"),[K,Q]=n(!1),[U,X]=n(!1);a((()=>{J(-1==E?"First Message (Step 1/2)":V?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)")}),[E]);const Y=e=>{null==D||D([{name:"variable",productName:e.actualValue}])};return e("div",{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:24}},{children:[null!=E&&E>=0&&t(d,{Icon:l,onClick:()=>{null==_||_(-1)}}),t(y,Object.assign({style:{marginLeft:10}},{children:H}))]})),V&&(null!==(S=null==W?void 0:W.length)&&void 0!==S?S:0)>0&&null!=E&&E>=0&&e("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(g,{editItem:()=>{1===(null==W?void 0:W.length)&&"variable"===W[0].name?(z((()=>Y)),G(!0)):Q(!K)},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==D||D([]));const t=r(Object.assign({},I));t&&(R&&R.length>0?null==R||R.forEach(((e,o)=>{var l;t.components[1].cards[o].components[0].example.header_handle=[null!==(l=R[o])&&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,o)=>{t.components[1].cards[o].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==L||L(t)),null==D||D([]),null==N||N()}}),W&&(null==W?void 0:W.length)>0&&"variable"!=W[0].name&&t(s,{disabled:(null!==(B=null==W?void 0:W.length)&&void 0!==B?B:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{X(!0),Q(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!$&&V&&0===(null==W?void 0:W.length)&&null!=E&&E>=0&&e(o,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(b,{children:"Product(s)"}),t(j,{children:`Select ${null!=M?M:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:q?16:12,marginRight:q?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(s,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:q?`2px dashed ${v.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(i,{width:18,height:18,color:v.content.secondary})})),onClick:e=>{Q(!0)}}),F===f.CHATBOT&&e(o,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),t(x,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(s,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:q?`2px dashed ${v.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(i,{width:18,height:18,color:v.content.secondary})})),onClick:e=>{z((()=>Y)),G(!0)}})]})]})),q&&t("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:t(p,{padding:"8px",errorText:"Please add products"})}))]}),t(h,{whatsappSpecificPickerMeta:w,template:I,onTemplateChange:e=>{null==L||L(e)},showVariableModal:O,variableListForImage:P,discountCode:k,setDiscountCode:T}),K&&A&&t(c,{zIndex:200,startupScreen:U?m.RearrangeProducts:m.Collections,rearrangeEnabled:!0,storeId:A.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const o of e){const e=null==o?void 0:o.collectionId,l=o.productId,i=o.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),l in t[e].products||(t[e].products[l]={variants:{},name:(null==o?void 0:o.productName)||"",image:(null==o?void 0:o.productImage)||""}),t[e].products[l].variants[i]={name:(null==o?void 0:o.name)||"",price:"",image:(null==o?void 0:o.image)||"",quantity:o.quantity||0,displayOrder:o.displayOrder}}return t}return{}})(null!=W?W:[]),collectionFetcher:A.fetchCollections,productFetcher:A.fetchProducts,onAdd:(e,t)=>{var o,l,i,n,a,s;X(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const r=e[t].products;if(void 0!==r&&Object.keys(r).length)for(const e of Object.keys(r)){const c=r[e].variants;if(void 0!==c&&Object.keys(c).length)for(const m of Object.keys(c)){const{name:p,image:u,quantity:h,displayOrder:g}=c[m],v={name:p,image:null!==(l=null!=u?u:null===(o=r[e])||void 0===o?void 0:o.image)&&void 0!==l?l:"",quantity:h,variantId:m,productId:e,displayOrder:g,collectionId:t,productName:null!==(n=null===(i=r[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(s=null===(a=r[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(v)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),m=d.map((e=>e.image)),p=r(Object.assign({},I));p&&(m.forEach(((e,t)=>{var o;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(o=null==R?void 0:R[t])&&void 0!==o?o:""]})),null==L||L(p)),null==D||D(c),Q(!1)},searchInCollectionFetcher:A.searchInCollection,searchFetcher:A.searchProducts,visible:K,onClose:()=>{Q(!1)},exactLimit:null!=M?M:1})]})};export{C as default};
@@ -1,4 +1,4 @@
1
- import{jsx as o,jsxs as n,Fragment as e}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useRef as i,useState as l,useEffect as a}from"react";import s from"styled-components";import{Input as d}from"../../input/Input.js";import{HEADER_TYPES as r}from"../../template-preview/models/TemplateMeta.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as c}from"../utils/getDataFromTemplateComponent.js";import{isVariable as m}from"../utils/validateIsUrl.js";import{validateInputName as v}from"../utils/validateName.js";import{BackTrackComponent as b}from"./BackTrackComponent.js";import{DiscountCodeComponent as g}from"./DiscountCodeComponent.js";import f from"./EditMediaModal.js";import h from"./EditMediaV2.js";import{EditTemplateMediaContainer as O}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as j}from"./useEditWhtasappTemplateMedia.js";import C from"./VariableConnector.js";import{Container as T}from"./VariableConnectorsPanel.js";import x from"./VariableConnectorWhatsApp.js";import y from"./VariableEditorHeader.js";import E from"./WhatsAppTemplateCardButtonV2.js";const V=s=>{let{template:V,onTemplateChange:k,whatsappSpecificPickerMeta:M,showVariableModal:I,variableListForImage:L,setDiscountCode:R,fileName:U,setFileName:w}=s;var N,P,A,_,D,H,S,F,Q,q,Y,K,W,$,G,X,z,J,Z,oo,no,eo,to,io,lo,ao,so,ro,po,uo,co,mo,vo,bo,go,fo,ho,Oo,jo;const Co=V.isCarouselType,{originalVariableList:To,pod:xo,extras:yo,selectedCarouselIndex:Eo,isProductCarouselType:Vo}=u(),{descriptionComponents:Bo,urlBtns:ko,qrbBtns:Mo,imageComponent:Io,bodyVariables:Lo,headerVariables:Ro}=c(V),Uo=i(null),[wo,No]=l(!1),[Po,Ao]=l(-1===Eo?{descriptionComponents:Bo,urlBtns:ko,qrbBtns:Mo,imageComponent:Io,bodyVariables:Lo,headerVariables:Ro}:{}),{uploadMediaLink:_o,uploadMediaFiles:Do}=M,Ho=j({uploadMediaLink:_o,uploadMediaFiles:Do,updateTemplateImageUrl:function(o,n){var e,i,l,a,s,d,r,p;let u;u=null!=Eo&&Eo>-1?{components:null===(i=null===(e=V.components[1])||void 0===e?void 0:e.cards)||void 0===i?void 0:i[Eo].components,mapping:null===(a=null===(l=null==V?void 0:V.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Eo]}:Object.assign({},V);const c=null===(s=null==u?void 0:u.components)||void 0===s?void 0:s.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const e=Object.assign(Object.assign({},u.components[c]),{format:n,example:{header_handle:[o]}}),t=[...u.components];t[c]=e,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=Eo&&Eo>-1){const o=t(V);o.components[1].cards[Eo].components=u.components,(null===(d=null==o?void 0:o.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==o?void 0:o.mapping)||void 0===r?void 0:r.cards.length)>0&&(o.mapping.cards[Eo]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==k||k(Object.assign({},o)),Fo(!0)}else null==k||k(Object.assign({},u))},mediaComponent:Co?Po.imageComponent:Io,fileRef:Uo}),[So,Fo]=l(!1),[Qo,qo]=l(U),[Yo,Ko]=l();function Wo(o,n,e){var i,l,a,s,d,r,p,u,c,m;const v=null!=Eo&&Eo>-1?{components:null===(i=Object.assign({},V).components[1].cards)||void 0===i?void 0:i[Eo].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[Eo]}:Object.assign({},V),b=t(v),g="custom"===n&&"string"==typeof o,f=g?o:"string"!=typeof o?o.defaultValue?o.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Eo&&Eo>-1&&Vo){const n=Object.assign({},V).components.map((o=>{var n;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(n=o.cards)||void 0===n?void 0:n.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var n,t,i;if("BUTTONS"===o.type){const l=null===(n=o.buttons)||void 0===n?void 0:n.filter((o=>"URL"===o.type));let a=null!==(t=null==l?void 0:l[e])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=o.buttons)||void 0===i?void 0:i.map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o));return Object.assign(Object.assign({},o),{buttons:s})}return o}))})))}):o})),i=null===(s=null===(a=Object.assign({},V).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var e;return Object.assign(Object.assign({},n),{buttons:null===(e=null==n?void 0:n.buttons)||void 0===e?void 0:e.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:""))})})),l=t(V);return l.components=n,l.mapping.cards=i,void(null==k||k(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==h&&h>-1){const t=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((o=>"URL"===o.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof o,l=i?o:"string"!=typeof o&&o.defaultValue?o.defaultValue:"https://d.bik.ai/";let a=t[e];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o)),d=Object.assign(Object.assign({},b.components[h]),{buttons:s}),m=null===(c=b.mapping)||void 0===c?void 0:c.buttons;m&&m.length>0&&(m[e]=i?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:"");const v=Object.assign(Object.assign({},b.mapping),{buttons:m});b.mapping=v;const g=[...b.components];g[h]=d,b.components=g}}if("string"!=typeof o){"checkout.checkoutUrl"===(null===(m=o.placeHolder)||void 0===m?void 0:m.slice(2,-2))?No(!0):(No(!1),null==R||R(""))}if(null!=Eo&&Eo>-1){const o=t(V);o.components[1].cards[Eo].components=b.components,o.mapping.cards[Eo]=b.mapping,null==k||k(Object.assign({},o))}else null==k||k(b)}function $o(o,n,e){var i,l,a,s,d,r,p;const u=null!=Eo&&Eo>-1?{components:null===(i=Object.assign({},V).components[1].cards)||void 0===i?void 0:i[Eo].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[Eo]}:Object.assign({},V);if(null!=Eo&&Eo>-1&&Vo){const n=Object.assign({},V).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((o=>"QUICK_REPLY"===o.type));let s=null!==(i=null==a?void 0:a[e])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:o.flowId,flowName:o.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==s?void 0:s.text)?s:o));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t(V);return i.components=n,void(null==k||k(Object.assign({},i)))}const c=null==u?void 0:u.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==u?void 0:u.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((o=>"QUICK_REPLY"===o.type));if(n){let t=n[e];t=Object.assign(Object.assign({},t),{flowId:o.flowId,flowName:o.flowName});const i=[...null!==(p=null===(r=null===(d=u.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==t?void 0:t.text)?t:o)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),a=[...u.components];a[c]=l,u.components=a}}if(null!=Eo&&Eo>-1){const o=t(V);o.components[1].cards[Eo].components=u.components,null==k||k(Object.assign({},o))}else null==k||k(u)}a((()=>{var o,n;if(null===(o=V.mapping.buttons)||void 0===o?void 0:o.find((o=>"checkout.checkoutUrl"===o.slice(2,-2))))No(!0);else{No(!1);const o=null===(n=null==yo?void 0:yo.discountCodeExtra)||void 0===n?void 0:n[1];null==o||o("")}}),[V]),a((()=>{var o,n,e,t;if(null!=Eo&&Eo>-1){const i={components:null===(n=null===(o=V.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Eo].components,mapping:null===(t=null===(e=null==V?void 0:V.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Eo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=c(i);Ao({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=Eo&&-1===Eo){const{descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l}=c(V);Ao({descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Eo]),a((()=>{var o,n,e,t;if(null!=Eo&&Eo>-1&&So){const i={components:null===(n=null===(o=V.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Eo].components,mapping:null===(t=null===(e=null==V?void 0:V.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Eo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=c(i);Ao({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),Fo(!1)}}),[So]);const Go=Co?Po.imageComponent:Io;return Ho.openEditMedia?o(T,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:o(f,{mediaComponentFormat:null!==(N=Go.format)&&void 0!==N?N:r.IMAGE,uploadMedia:Ho.uploadMedia,variableListForImage:L||[],useEditWhatsappTemplateMediaResponse:Ho,setOpenEditMedia:Ho.setOpenEditMedia,openEditMedia:Ho.openEditMedia,editIconRef:Ho.editIconRef,fileRef:Uo})})):n(T,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Vo?"420px":"auto"}},{children:[!!Po.imageComponent&&!Vo&&n(O,{children:[o(h,{imageName:null!==(A=null===(P=null==Go?void 0:Go.example)||void 0===P?void 0:P.header_handle)&&void 0!==A?A:[],handleImageChange:Ho.handleImageChange,mediaType:null==Go?void 0:Go.format,error:Ho.error,isLoading:Ho.loading,setOpenEditMedia:Ho.setOpenEditMedia,selectedVariable:m(null!==(H=null===(D=null===(_=null==Go?void 0:Go.example)||void 0===_?void 0:_.header_handle)||void 0===D?void 0:D[0])&&void 0!==H?H:"")?null===(F=null===(S=null==Go?void 0:Go.example)||void 0===S?void 0:S.header_handle)||void 0===F?void 0:F[0]:(null===(q=null===(Q=null==V?void 0:V.mapping)||void 0===Q?void 0:Q.header)||void 0===q?void 0:q[0])?null===(K=null===(Y=null==V?void 0:V.mapping)||void 0===Y?void 0:Y.header)||void 0===K?void 0:K[0]:Ho.selectedVariable}),(null==Io?void 0:Io.format)==r.DOCUMENT?o(B,{children:o(d,{labelText:"PDF Name",placeholder:"Enter the name",value:Qo,errorMessage:Yo||void 0,onBlur:()=>{if(!Qo)return null==w||w(""),void Ko("PDF name is Required");const o=v(Qo);null==w||w(Qo),Ko(o?"Please enter a valid PDF name":void 0)},onChangeText:o=>{Ko(""),qo(o)}})}):o(e,{})]}),(null===(W=Po.bodyVariables)||void 0===W?void 0:W.length)>0&&o(y,{containerStyle:{paddingTop:Po.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===($=Po.descriptionComponents)||void 0===$?void 0:$.map(((n,e)=>o(x,{originalVariableList:null!=Eo&&Eo>-1?To.cards[Eo]:To,type:n.type,descriptionComponent:n.component,showVariableModal:I},e))),(null===(z=null===(X=null!=Eo&&Eo>-1?null===(G=To.cards[Eo])||void 0===G?void 0:G.buttons:null==To?void 0:To.buttons)||void 0===X?void 0:X.filter((o=>"URL"===o.type)))||void 0===z?void 0:z.length)>0&&o(y,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(oo=null===(Z=null!=Eo&&Eo>-1?null===(J=To.cards[Eo])||void 0===J?void 0:J.buttons:null==To?void 0:To.buttons)||void 0===Z?void 0:Z.filter((o=>xo===p.CHATBOT||"URL"===o.type)))||void 0===oo?void 0:oo.map(((n,e)=>{if("URL"===n.type)return o(E,{variableListIndex:e,CTAoptions:null==M?void 0:M.CTAoptions,button:n,currentVariableList:null!=Eo&&Eo>-1?Object.assign({},To.cards[Eo]):Object.assign({},To),updateSelectedURLTemplateBtn:Wo},`${e}_${Eo}`)})),xo===p.CHATBOT&&(null===(eo=null===(no=Mo[0])||void 0===no?void 0:no.component)||void 0===eo?void 0:eo.buttons)&&(null===(lo=null===(io=null===(to=Mo[0])||void 0===to?void 0:to.component)||void 0===io?void 0:io.buttons)||void 0===lo?void 0:lo.length)>0&&o(b,{backTrackMessage:null===(ao=null==yo?void 0:yo.backTrackExtra)||void 0===ao?void 0:ao[0],setBackTrackMessage:null===(so=null==yo?void 0:yo.backTrackExtra)||void 0===so?void 0:so[1]}),(null===(uo=null===(po=null!=Eo&&Eo>-1?null===(ro=To.cards[Eo])||void 0===ro?void 0:ro.buttons:null==To?void 0:To.buttons)||void 0===po?void 0:po.filter((o=>"QUICK_REPLY"===o.type)))||void 0===uo?void 0:uo.length)>0&&(xo!==p.CHATBOT?o(y,{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"}):o(b,{backTrackMessage:null===(co=null==yo?void 0:yo.backTrackExtra)||void 0===co?void 0:co[0],setBackTrackMessage:null===(mo=null==yo?void 0:yo.backTrackExtra)||void 0===mo?void 0:mo[1]})),null===(go=null===(bo=null!=Eo&&Eo>-1?null===(vo=To.cards[Eo])||void 0===vo?void 0:vo.buttons:null==To?void 0:To.buttons)||void 0===bo?void 0:bo.filter((o=>"QUICK_REPLY"===o.type)))||void 0===go?void 0:go.map(((n,e)=>{if("QUICK_REPLY"===n.type&&xo!==p.CHATBOT)return o(E,{variableListIndex:e,QRBoptions:null==M?void 0:M.QRBoptions,button:n,currentVariableList:null!=Eo&&Eo>-1?Object.assign({},To.cards[Eo]):Object.assign({},To),updateSelectedQRBTemplateBtn:$o},`${e}_${Eo}`)})),xo===p.CHATBOT&&wo&&o(g,{discountCode:null===(fo=null==yo?void 0:yo.discountCodeExtra)||void 0===fo?void 0:fo[0],setDiscountCode:null===(ho=null==yo?void 0:yo.discountCodeExtra)||void 0===ho?void 0:ho[1]}),null===(jo=null!=Eo&&Eo>-1?null===(Oo=To.cards[Eo])||void 0===Oo?void 0:Oo.buttons:null==To?void 0:To.buttons)||void 0===jo?void 0:jo.map(((n,e)=>{var t,i,l;if("COPY_CODE"===n.type)return o(C,{index:e,variable:{variableName:null!==(t=n.text)&&void 0!==t?t:"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,componentType:"BUTTONS",buttonType:n.type},e)}))]}))},B=s.div`
1
+ import{jsx as o,jsxs as n,Fragment as e}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useRef as i,useState as l,useEffect as a}from"react";import s from"styled-components";import{Input as d}from"../../input/Input.js";import{HEADER_TYPES as r}from"../../template-preview/models/TemplateMeta.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as c}from"../utils/getDataFromTemplateComponent.js";import{isVariable as m}from"../utils/validateIsUrl.js";import{validateInputName as v}from"../utils/validateName.js";import{BackTrackComponent as b}from"./BackTrackComponent.js";import{DiscountCodeComponent as g}from"./DiscountCodeComponent.js";import f from"./EditMediaModal.js";import h from"./EditMediaV2.js";import{EditTemplateMediaContainer as O}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as j}from"./useEditWhtasappTemplateMedia.js";import C from"./VariableConnector.js";import{Container as T}from"./VariableConnectorsPanel.js";import x from"./VariableConnectorWhatsApp.js";import y from"./VariableEditorHeader.js";import E from"./WhatsAppTemplateCardButtonV2.js";const V=s=>{let{template:V,onTemplateChange:k,whatsappSpecificPickerMeta:M,showVariableModal:I,variableListForImage:L,setDiscountCode:R,fileName:U,setFileName:w}=s;var N,P,A,_,D,H,S,F,Q,q,Y,K,W,$,G,X,z,J,Z,oo,no,eo,to,io,lo,ao,so,ro,po,uo,co,mo,vo;const bo=V.isCarouselType,{originalVariableList:go,pod:fo,extras:ho,selectedCarouselIndex:Oo,isProductCarouselType:jo}=u(),{descriptionComponents:Co,urlBtns:To,qrbBtns:xo,imageComponent:yo,bodyVariables:Eo,headerVariables:Vo}=c(V),Bo=i(null),[ko,Mo]=l(!1),[Io,Lo]=l(-1===Oo?{descriptionComponents:Co,urlBtns:To,qrbBtns:xo,imageComponent:yo,bodyVariables:Eo,headerVariables:Vo}:{}),{uploadMediaLink:Ro,uploadMediaFiles:Uo}=M,wo=j({uploadMediaLink:Ro,uploadMediaFiles:Uo,updateTemplateImageUrl:function(o,n){var e,i,l,a,s,d,r,p;let u;u=null!=Oo&&Oo>-1?{components:null===(i=null===(e=V.components[1])||void 0===e?void 0:e.cards)||void 0===i?void 0:i[Oo].components,mapping:null===(a=null===(l=null==V?void 0:V.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Oo]}:Object.assign({},V);const c=null===(s=null==u?void 0:u.components)||void 0===s?void 0:s.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const e=Object.assign(Object.assign({},u.components[c]),{format:n,example:{header_handle:[o]}}),t=[...u.components];t[c]=e,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=Oo&&Oo>-1){const o=t(V);o.components[1].cards[Oo].components=u.components,(null===(d=null==o?void 0:o.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==o?void 0:o.mapping)||void 0===r?void 0:r.cards.length)>0&&(o.mapping.cards[Oo]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==k||k(Object.assign({},o)),Po(!0)}else null==k||k(Object.assign({},u))},mediaComponent:bo?Io.imageComponent:yo,fileRef:Bo}),[No,Po]=l(!1),[Ao,_o]=l(U),[Do,Ho]=l();function So(o,n,e){var i,l,a,s,d,r,p,u,c,m;const v=null!=Oo&&Oo>-1?{components:null===(i=Object.assign({},V).components[1].cards)||void 0===i?void 0:i[Oo].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[Oo]}:Object.assign({},V),b=t(v),g="custom"===n&&"string"==typeof o,f=g?o:"string"!=typeof o?o.defaultValue?o.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Oo&&Oo>-1&&jo){const n=Object.assign({},V).components.map((o=>{var n;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(n=o.cards)||void 0===n?void 0:n.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var n,t,i;if("BUTTONS"===o.type){const l=null===(n=o.buttons)||void 0===n?void 0:n.filter((o=>"URL"===o.type));let a=null!==(t=null==l?void 0:l[e])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=o.buttons)||void 0===i?void 0:i.map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o));return Object.assign(Object.assign({},o),{buttons:s})}return o}))})))}):o})),i=null===(s=null===(a=Object.assign({},V).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var e;return Object.assign(Object.assign({},n),{buttons:null===(e=null==n?void 0:n.buttons)||void 0===e?void 0:e.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:""))})})),l=t(V);return l.components=n,l.mapping.cards=i,void(null==k||k(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==h&&h>-1){const t=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((o=>"URL"===o.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof o,l=i?o:"string"!=typeof o&&o.defaultValue?o.defaultValue:"https://d.bik.ai/";let a=t[e];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o)),d=Object.assign(Object.assign({},b.components[h]),{buttons:s}),m=null===(c=b.mapping)||void 0===c?void 0:c.buttons;m&&m.length>0&&(m[e]=i?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:"");const v=Object.assign(Object.assign({},b.mapping),{buttons:m});b.mapping=v;const g=[...b.components];g[h]=d,b.components=g}}if("string"!=typeof o){"checkout.checkoutUrl"===(null===(m=o.placeHolder)||void 0===m?void 0:m.slice(2,-2))?Mo(!0):(Mo(!1),null==R||R(""))}if(null!=Oo&&Oo>-1){const o=t(V);o.components[1].cards[Oo].components=b.components,o.mapping.cards[Oo]=b.mapping,null==k||k(Object.assign({},o))}else null==k||k(b)}function Fo(o,n,e){var i,l,a,s,d,r;const p=null!=Oo&&Oo>-1?{components:null===(i=Object.assign({},V).components[1].cards)||void 0===i?void 0:i[Oo].components,mapping:null===(l=Object.assign({},V).mapping.cards)||void 0===l?void 0:l[Oo]}:Object.assign({},V);if(null!=Oo&&Oo>-1&&jo){const n=Object.assign({},V).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((o=>"QUICK_REPLY"===o.type));let s=null!==(i=null==a?void 0:a[e])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:o.flowId,flowName:o.flowName});const d=null===(l=n.buttons)||void 0===l?void 0:l.map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==s?void 0:s.text)?s:o));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t(V);return i.components=n,void(null==k||k(Object.assign({},i)))}const u=null==p?void 0:p.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==u&&u>-1){const n=null===(a=null==p?void 0:p.components[u].buttons)||void 0===a?void 0:a.filter((o=>"QUICK_REPLY"===o.type));if(n){let t=n[e];t=Object.assign(Object.assign({},t),{flowId:o.flowId,flowName:o.flowName});const i=[...null!==(r=null===(d=null===(s=p.components)||void 0===s?void 0:s[u])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==t?void 0:t.text)?t:o)),l=Object.assign(Object.assign({},p.components[u]),{buttons:i}),a=[...p.components];a[u]=l,p.components=a}}if(null!=Oo&&Oo>-1){const o=t(V);o.components[1].cards[Oo].components=p.components,null==k||k(Object.assign({},o))}else null==k||k(p)}a((()=>{var o,n;if(null===(o=V.mapping.buttons)||void 0===o?void 0:o.find((o=>"checkout.checkoutUrl"===o.slice(2,-2))))Mo(!0);else{Mo(!1);const o=null===(n=null==ho?void 0:ho.discountCodeExtra)||void 0===n?void 0:n[1];null==o||o("")}}),[V]),a((()=>{var o,n,e,t;if(null!=Oo&&Oo>-1){const i={components:null===(n=null===(o=V.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Oo].components,mapping:null===(t=null===(e=null==V?void 0:V.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Oo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=c(i);Lo({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=Oo&&-1===Oo){const{descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l}=c(V);Lo({descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Oo]),a((()=>{var o,n,e,t;if(null!=Oo&&Oo>-1&&No){const i={components:null===(n=null===(o=V.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Oo].components,mapping:null===(t=null===(e=null==V?void 0:V.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Oo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=c(i);Lo({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),Po(!1)}}),[No]);const Qo=bo?Io.imageComponent:yo;return wo.openEditMedia?o(T,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:o(f,{mediaComponentFormat:null!==(N=Qo.format)&&void 0!==N?N:r.IMAGE,uploadMedia:wo.uploadMedia,variableListForImage:L||[],useEditWhatsappTemplateMediaResponse:wo,setOpenEditMedia:wo.setOpenEditMedia,openEditMedia:wo.openEditMedia,editIconRef:wo.editIconRef,fileRef:Bo})})):n(T,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!Io.imageComponent&&!jo&&n(O,{children:[o(h,{imageName:null!==(A=null===(P=null==Qo?void 0:Qo.example)||void 0===P?void 0:P.header_handle)&&void 0!==A?A:[],handleImageChange:wo.handleImageChange,mediaType:null==Qo?void 0:Qo.format,error:wo.error,isLoading:wo.loading,setOpenEditMedia:wo.setOpenEditMedia,selectedVariable:m(null!==(H=null===(D=null===(_=null==Qo?void 0:Qo.example)||void 0===_?void 0:_.header_handle)||void 0===D?void 0:D[0])&&void 0!==H?H:"")?null===(F=null===(S=null==Qo?void 0:Qo.example)||void 0===S?void 0:S.header_handle)||void 0===F?void 0:F[0]:(null===(q=null===(Q=null==V?void 0:V.mapping)||void 0===Q?void 0:Q.header)||void 0===q?void 0:q[0])?null===(K=null===(Y=null==V?void 0:V.mapping)||void 0===Y?void 0:Y.header)||void 0===K?void 0:K[0]:wo.selectedVariable}),(null==yo?void 0:yo.format)==r.DOCUMENT?o(B,{children:o(d,{labelText:"PDF Name",placeholder:"Enter the name",value:Ao,errorMessage:Do||void 0,onBlur:()=>{if(!Ao)return null==w||w(""),void Ho("PDF name is Required");const o=v(Ao);null==w||w(Ao),Ho(o?"Please enter a valid PDF name":void 0)},onChangeText:o=>{Ho(""),_o(o)}})}):o(e,{})]}),Io.bodyVariables.length>0&&o(y,{containerStyle:{paddingTop:Io.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=Io.descriptionComponents)||void 0===W?void 0:W.map(((n,e)=>o(x,{originalVariableList:null!=Oo&&Oo>-1?go.cards[Oo]:go,type:n.type,descriptionComponent:n.component,showVariableModal:I},e))),(null===(G=null===($=null!=Oo&&Oo>-1?go.cards[Oo].buttons:null==go?void 0:go.buttons)||void 0===$?void 0:$.filter((o=>"URL"===o.type)))||void 0===G?void 0:G.length)>0&&o(y,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(z=null===(X=null!=Oo&&Oo>-1?go.cards[Oo].buttons:null==go?void 0:go.buttons)||void 0===X?void 0:X.filter((o=>fo===p.CHATBOT||"URL"===o.type)))||void 0===z?void 0:z.map(((n,e)=>{if("URL"===n.type)return o(E,{variableListIndex:e,CTAoptions:null==M?void 0:M.CTAoptions,button:n,currentVariableList:null!=Oo&&Oo>-1?Object.assign({},go.cards[Oo]):Object.assign({},go),updateSelectedURLTemplateBtn:So},`${e}_${Oo}`)})),fo===p.CHATBOT&&(null===(Z=null===(J=xo[0])||void 0===J?void 0:J.component)||void 0===Z?void 0:Z.buttons)&&(null===(eo=null===(no=null===(oo=xo[0])||void 0===oo?void 0:oo.component)||void 0===no?void 0:no.buttons)||void 0===eo?void 0:eo.length)>0&&o(b,{backTrackMessage:null===(to=null==ho?void 0:ho.backTrackExtra)||void 0===to?void 0:to[0],setBackTrackMessage:null===(io=null==ho?void 0:ho.backTrackExtra)||void 0===io?void 0:io[1]}),(null===(ao=null===(lo=null!=Oo&&Oo>-1?go.cards[Oo].buttons:null==go?void 0:go.buttons)||void 0===lo?void 0:lo.filter((o=>"QUICK_REPLY"===o.type)))||void 0===ao?void 0:ao.length)>0&&(fo!==p.CHATBOT?o(y,{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"}):o(b,{backTrackMessage:null===(so=null==ho?void 0:ho.backTrackExtra)||void 0===so?void 0:so[0],setBackTrackMessage:null===(ro=null==ho?void 0:ho.backTrackExtra)||void 0===ro?void 0:ro[1]})),null===(uo=null===(po=null!=Oo&&Oo>-1?go.cards[Oo].buttons:null==go?void 0:go.buttons)||void 0===po?void 0:po.filter((o=>"QUICK_REPLY"===o.type)))||void 0===uo?void 0:uo.map(((n,e)=>{if("QUICK_REPLY"===n.type&&fo!==p.CHATBOT)return o(E,{variableListIndex:e,QRBoptions:null==M?void 0:M.QRBoptions,button:n,currentVariableList:null!=Oo&&Oo>-1?Object.assign({},go.cards[Oo]):Object.assign({},go),updateSelectedQRBTemplateBtn:Fo},`${e}_${Oo}`)})),fo===p.CHATBOT&&ko&&o(g,{discountCode:null===(co=null==ho?void 0:ho.discountCodeExtra)||void 0===co?void 0:co[0],setDiscountCode:null===(mo=null==ho?void 0:ho.discountCodeExtra)||void 0===mo?void 0:mo[1]}),null===(vo=null!=Oo&&Oo>-1?go.cards[Oo].buttons:null==go?void 0:go.buttons)||void 0===vo?void 0:vo.map(((n,e)=>{var t,i,l;if("COPY_CODE"===n.type)return o(C,{index:e,variable:{variableName:null!==(t=n.text)&&void 0!==t?t:"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,componentType:"BUTTONS",buttonType:n.type},e)}))]}))},B=s.div`
2
2
  padding-top: 24px;
3
3
  padding-left: 10px;
4
4
  padding-right: 10px;
@@ -1,14 +1,14 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as r}from"react";import n from"styled-components";import{Button as l}from"../../button/Button.js";import{TitleRegular as i}from"../../TypographyStyle.js";import{COLORS as s}from"../../../constants/Theme.js";import{Badge as d}from"../Badge/index.js";import{useTemplateModalContext as a}from"../context/templateModalContext.js";const p=n.div`
2
- background: ${s.surface.standard};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import s from"styled-components";import{Button as a}from"../../button/Button.js";import{TitleRegular as n}from"../../TypographyStyle.js";import{COLORS as i}from"../../../constants/Theme.js";import{Badge as l}from"../Badge/index.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";const c=s.div`
2
+ background: ${i.surface.standard};
3
3
  border-top-width: 1px;
4
- border-top-color: ${s.stroke.primary};
4
+ border-top-color: ${i.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=>{var t;return null!==(t=e.justifyContent)&&void 0!==t?t:"end"}};
9
+ justify-content: ${e=>e.isWhatsappCarousel?"space-between":"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
- `,c=n=>{let{isWhatsappCarousel:c,onSelect:m}=n;var u,x,b,f;const{isError:g,selectedCarouselIndex:v,setSelectedCarouselIndex:h,setErrorIndexes:y,template:j,showVariablePicker:S}=a(),[C,w]=o(c?"Next":"Select template");return r((()=>{c&&-1===v?w("Next"):c&&null!=v&&v>-1&&w("Save & Select Template")}),[v]),e(p,Object.assign({justifyContent:c&&(null===(x=null===(u=null==j?void 0:j.mapping)||void 0===u?void 0:u.body)||void 0===x?void 0:x.length)?"space-between":"end"},{children:[c&&null!=v&&v>=-1&&!!(null===(f=null===(b=null==j?void 0:j.mapping)||void 0===b?void 0:b.body)||void 0===f?void 0:f.length)&&t(i,Object.assign({color:s.text.secondary},{children:`Step ${-1===v?1:2}/2`})),e("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[g&&t(d,{errorText:"Some inputs are missing or incorrect. Please check"}),t(l,{disabled:S,id:"select-template-btn",buttonText:C,size:c?"small":"large",onClick:function(){c&&-1===v&&h?h(0):(null==y||y([]),m())}})]}))]}))};export{c as default};
14
+ `,d=s=>{let{isWhatsappCarousel:d,onSelect:m}=s;const{isError:x,selectedCarouselIndex:u,setSelectedCarouselIndex:b,setErrorIndexes:f}=p(),[g,h]=r(d?"Next":"Select template");return o((()=>{d&&-1===u?h("Next"):d&&null!=u&&u>-1&&h("Save & Select Template")}),[u]),e(c,Object.assign({isWhatsappCarousel:d},{children:[d&&null!=u&&u>=-1&&t(n,Object.assign({color:i.text.secondary},{children:`Step ${-1===u?1:2}/2`})),e("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[x&&t(l,{errorText:"Some inputs are missing or incorrect. Please check"}),t(a,{id:"select-template-btn",buttonText:g,size:d?"small":"large",onClick:function(){d&&-1===u&&b?b(0):(null==f||f([]),m())}})]}))]}))};export{d as default};
@@ -17,9 +17,7 @@ import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import a from"re
17
17
  height: calc(100% - 17px);
18
18
  border-radius: 16px;
19
19
  overflow-y: auto;
20
- `,c=a.forwardRef(((a,o)=>{let{display_content:c,channel:d,template:f,showSampleValues:w}=a;const{pod:b,hideDeviceContainerInPreview:v}=s(),g={showSampleValues:w,template:f,channel:d,smsSpecificMeta:{smsDisplayContent:c},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:b!==p.CHATBOT,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426,width:240}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:c,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}},isPreview:!0};return v?e(h,{children:e(r,Object.assign({},g))}):e(t,{children:i(m,Object.assign({channel:d},{children:[e("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(d),height:443}}),e(n,Object.assign({ref:o},{children:e(r,Object.assign({},g))}))]}))})}));c.displayName="MobilePreview";const h=o.div`
20
+ `,c=a.forwardRef(((a,o)=>{let{display_content:c,channel:d,template:w,showSampleValues:b}=a;const{pod:f,hideDeviceContainerInPreview:v}=s(),g={showSampleValues:b,template:w,channel:d,smsSpecificMeta:{smsDisplayContent:c},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:f!==p.CHATBOT,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426,width:240}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:c,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}},isPreview:!0};return v?e(h,{children:e(r,Object.assign({},g))}):e(t,{children:i(m,Object.assign({channel:d},{children:[e("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(d),height:443}}),e(n,Object.assign({ref:o},{children:e(r,Object.assign({},g))}))]}))})}));c.displayName="MobilePreview";const h=o.div`
21
21
  display: flex;
22
22
  align-items: center;
23
- justify-content: center;
24
- flex: 1;
25
23
  `;export{c as default};
@@ -4,7 +4,7 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import a from"..
4
4
  background: ${e=>e.focused&&e.channel===v.EMAIL?h.background.warning.light:"transparent"};
5
5
  border-radius: 4px;
6
6
  padding: 8px 10px;
7
- `,V=u.div`
7
+ `,k=u.div`
8
8
  position: absolute;
9
9
  top: 0;
10
10
  left: 0;
@@ -13,4 +13,4 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import a from"..
13
13
  background-color: rgba(0, 0, 0, 0.1);
14
14
  z-index: 1000;
15
15
  cursor: not-allowed;
16
- `,k={value:"custom_link",label:"Custom URL"},E={value:"custom_text",label:"Custom text"},C={value:"static_expiry",label:"Static Expiry"},S=u=>{let{onFocus:S,variable:A,index:D,showVariableModal:B,setShowDiscountCheckBox:N,componentType:P,CTAoptions:L,buttonType:w}=u;var U,H,R,W,M;const[$,I]=o(!1),[Y,z]=o(""),[Z,G]=o([]),[q,F]=o(),[K,J]=o(!1),{variableList:Q,setVariableList:X,setVariableCallback:ee,setShowVariablePicker:te,device:le,channel:ae,isError:ie,originalVariableList:ne,template:oe,templateSelectionTriggered:se,setTemplate:ue,setDisplayContent:de,setOriginalVariableList:ce,globalNormalizedPlaceholders:re,enabledCustomText:pe,pod:me,selectedCarouselIndex:ve,isProductCarouselType:be,disableEditVariable:ge,disableEditExpiry:Oe,templateErrorIndexes:je}=x();function ye(e,t){var l,a,i;const n=e;z(""),F(n),ae===v.WHATSAPP?"custom_text"!==n.value&&"custom_link"!==n.value&&"static_expiry"!==n.value?(xe(null!==(l=n.value)&&void 0!==l?l:"","string"),null==fe||fe(null!==(a=A.index)&&void 0!==a?a:0,n.value,!0)):(null==fe||fe(null!==(i=A.index)&&void 0!==i?i:0,"",!0,n.value),xe("","url"===n.bikPlaceholderType?"link":"string")):"custom_text"!==n.value&&"custom_link"!==n.value?xe(n.value,"url"===n.bikPlaceholderType?"link":"string"):(z(""),xe("",n.value))}function he(e,t){var l;z(t);const a="custom_link"===(null==q?void 0:q.value)&&t?t.includes("https")?t:`https://${t}`:t;xe(a,"static_expiry"===e?"string":e),ae===v.WHATSAPP&&(null==fe||fe(null!==(l=A.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function xe(e,t){var l,a,i,o;const s="custom_link"===t?"link":"custom_text"===t?"string":t;if(ae!==v.WHATSAPP){const a=_(D+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===le?"template_html_mobile":"template_html_desktop"),n=ae===v.EMAIL?null===(l=null==i?void 0:i.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);n&&(n.textContent="custom_text"!==t&&"custom_link"!==t||e?e:A.variableName);const o=ne.map(((t,l)=>l===D?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t));null==ce||ce(o)}if(ae===v.WHATSAPP){if(null!=ve&&ve>-1&&be){const l=Object.assign({},ne).cards.map(((l,a)=>{var i,n;return"BODY"===P?Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((t,l)=>D===l?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t))}):"BUTTONS"===P?Object.assign(Object.assign({},l),{buttons:null===(n=l.buttons)||void 0===n?void 0:n.map(((l,a)=>a===D?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==ce||ce((e=>Object.assign(Object.assign({},e),{cards:l}))))}const l=null!=ve&&ve>-1?ne.cards[ve]:ne;let u=l.body,d=l.header,c=l.buttons;if("BODY"===P?u=null===(a=l.body)||void 0===a?void 0:a.map(((t,l)=>l===D?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"HEADER"===P?d=null===(i=l.header)||void 0===i?void 0:i.map(((t,l)=>l===D?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"BUTTONS"===P&&(c=null===(o=l.buttons)||void 0===o?void 0:o.map(((l,a)=>a===D?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))),null!=ve&&ve>-1){const e=n(ne.cards);e[ve]={header:d,body:u,buttons:c},null==ce||ce((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==ce||ce((e=>Object.assign(Object.assign({},e),{header:d,body:u,buttons:c})))}}function fe(e,t,l,a){var i,o,s,u,d,c,r;if(null!=ve&&ve>-1&&be){const o=Object.assign({},oe).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,i,n,o,s,u;if("BODY"===l.type&&"BODY"===P){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const a=[...null!==(s=null===(o=null===(n=l.example)||void 0===n?void 0:n.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const i=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:i})}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})),s=n(oe);if(l){const l=null===(i=Object.assign({},oe).mapping.cards)||void 0===i?void 0:i.map(((l,i)=>{var n,o,s;if("BODY"===P)return Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});if("BUTTONS"===P&&(null==l?void 0:l.buttons)){let n=-1,u=-1;return null===(o=oe.components[1].cards)||void 0===o||o[i].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(n++,l===e&&"URL"==t.type&&(u=n))})))})),Object.assign(Object.assign({},l),{buttons:null===(s=l.buttons)||void 0===s?void 0:s.map(((e,l)=>l===u?"custom_link"===a?"((customPlaceholderName))":t:e))})}return l}));s.mapping.cards=l}return s.components=o,void(null==ue||ue(s))}const p=null!=ve&&ve>-1?{components:null===(o=Object.assign({},oe).components[1].cards)||void 0===o?void 0:o[ve].components,mapping:null===(s=Object.assign({},oe).mapping.cards)||void 0===s?void 0:s[ve]}:Object.assign({},oe),m=null===(u=null==p?void 0:p.components)||void 0===u?void 0:u.map((l=>{var a,i,n,o,s,u,d,c,r;const p=Object.assign({},l);if("BODY"===l.type&&"BODY"===P){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const l=[...null!==(s=null===(o=null===(n=p.example)||void 0===n?void 0:n.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];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,i)=>e===i?"custom_text"===a?`((editableVariable${i+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,i)=>e===i?"custom_text"===a?`((editableVariable${i+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,i=-1;m.forEach((t=>{var a;"BUTTONS"===t.type&&(null===(a=t.buttons)||void 0===a||a.forEach(((t,a)=>{"URL"===t.type&&(l++,a===e&&"URL"==t.type&&(i=l))})))})),p.mapping=Object.assign(Object.assign({},p.mapping),{buttons:p.mapping.buttons.map(((e,l)=>l===i?"custom_link"===a?"((customPlaceholderName))":t:e))})}if(null!=ve&&ve>-1&&oe){const e=n(oe);e.components[1].cards[ve].components=p.components,e.mapping.cards[ve]=p.mapping,null==ue||ue(e)}else null==ue||ue(Object.assign({},p))}s((()=>{$&&(null==S||S())}),[$]),s((()=>{!function(){var e,t,l,a,i;const n="mobile"===le?"template_html_mobile":"template_html_desktop",o=document.getElementById(n),s=(null!==(a=null===(l=null===(t=null===(e=null==o?void 0:o.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===(i=null==o?void 0:o.contentWindow)||void 0===i?void 0:i.document.head.innerHTML);ae===v.EMAIL&&(null==de||de(s))}()}),[se]),s((()=>{!function(){var e,t;const l=[];let a=[];if(ae!==v.MESSAGE||pe){"link"===(null==A?void 0:A.type)?(l.push({label:"",options:[k,E]}),F(k)):"date_time"===(null==A?void 0:A.type)?(l.push({label:"",options:[k,E]}),F(C)):(l.push({label:"",options:[k,E,C]}),F(E));const e=null!=re?re:[];G([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:y.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!=re?re:[];G([{label:"",options:[E,k]},...e]),a=[{label:"",options:[E,k]},...e]}if((ae===v.WHATSAPP||ae===v.EMAIL||ae===v.MESSAGE)&&A.updatedValue)if(m.test(A.updatedValue)&&ae===v.WHATSAPP||A.updatedValue.startsWith("{{")&&ae!==v.WHATSAPP){const e=function(e,t,l){var a;let i={label:"",value:""};const n=l===v.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(B){let t=e.updatedValue;if(me===b.CHATBOT&&"BUTTONS"===P){const l=null==L?void 0:L.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}i={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())===n.trim()&&(i=e)}))}));return i}(A,a,ae);e.value&&F(e)}else"date_time"===A.type?(F(C),z(A.updatedValue),fe(null!==(e=A.index)&&void 0!==e?e:0,A.updatedValue)):(null===(t=A.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(F(k),z(A.updatedValue.split("https://")[1])):(F(E),z(A.updatedValue))}()}),[ve]),s((()=>{le&&q&&Y&&setTimeout((()=>{xe("custom_link"===(null==q?void 0:q.value)&&Y?Y.includes("https")?Y:`https://${Y}`:Y,q.value)}),100)}),[le]),s((()=>{!K&&q&&A.updatedValue&&setTimeout((()=>{xe("custom_link"===(null==q?void 0:q.value)&&A.updatedValue?A.updatedValue.includes("https")?A.updatedValue:`https://${A.updatedValue}`:A.updatedValue,q.value),J(!0)}),100)}),[q]);const _e=e=>{null==N||N(!1),"{{custom.url}}"===e.actualValue?ye({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?ye({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?ye({label:e.displayName,selected:!0,value:"static_expiry"}):ye({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})};return e(T,Object.assign({channel:ae,focused:$,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(O,Object.assign({style:{color:ie&&!q?h.content.negative:h.content.primary}},{children:[null===(U=A.variableName)||void 0===U?void 0:U.replace("{{","").replace("}}","")," ","link"===(null==A?void 0:A.type)?"link":"variable"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:B?e("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==q?void 0:q.label)?"space-between":"flex-end"}},{children:[t(j,Object.assign({numberOfLines:1},{children:me===b.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(H=null==q?void 0:q.value)&&void 0!==H?H:"")?null==q?void 0:q.label:null==q?void 0:q.value:p(null!==(R=null==q?void 0:q.label)&&void 0!==R?R:"",20,!0)})),ge||"date_time"===(null==A?void 0:A.type)&&Oe?t(l,{}):t(a,{onClick:()=>{(()=>{if(w===g.URL&&me===b.CHATBOT){const e=f({variableList:Q,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"});X(e)}else if("limited_time_offer"===P){const e=f({variableList:Q,categoryDisplayName:"Static Variables",variableDisplayName:"Static Expiry",variableValue:"{{static.expiry}}"});X(e)}else if(w===g.COPY_CODE){const e=f({variableList:Q,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});X(e)}})(),ee((()=>_e)),te(!0)},width:24,height:24,color:h.content.primary})]})):t(c,{disabled:ge,options:Z,isSearchable:!1,onSelect:ye,defaultOptions:q?[Object.assign(Object.assign({},q),{selected:!0})]:[]})})),("custom_text"===(null==q?void 0:q.value)||"custom_link"===(null==q?void 0:q.value))&&t(r,{state:ge?"disabled":"none",labelText:"custom_text"===(null==q?void 0:q.value)?"Custom text value":"custom_link"===(null==q?void 0:q.value)?"Custom URL value":"",id:`variable-value-${null==q?void 0:q.value}-${D}`,value:Y,errorMessage:ie&&(null===(W=null==je?void 0:je.buttons)||void 0===W?void 0:W.includes(null!==(M=null==A?void 0:A.index)&&void 0!==M?M:-1))?Y&&0!==Y.trim().length?"custom_link"!==q.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${Y.trim()}`)&&0!==Y.trim().length?"custom_link"!==q.value&&Y.length>30?"Length cannot be more than 30":"BUTTONS"===P&&"custom_link"!==q.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==q?void 0:q.value)?2e3:"BUTTONS"===P?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==q?void 0:q.value)?"https://":"",placeholder:"link"===A.type||"custom_link"===q.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{he(q.value,e)}}),"static_expiry"===(null==q?void 0:q.value)&&e("div",Object.assign({style:{position:"relative"}},{children:[ge&&t(V,{onClick:e=>e.preventDefault()}),t(d,{placement:"auto",time:i(Y?new Date(Y):new Date,"hh:mm a"),date:Y?new Date(Y):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{he("static_expiry",e.toISOString())}})]}))]}))};export{T as Container,S as default};
16
+ `,V={value:"custom_link",label:"Custom URL"},E={value:"custom_text",label:"Custom text"},C={value:"static_expiry",label:"Static Expiry"},S=u=>{let{onFocus:S,variable:A,index:D,showVariableModal:B,setShowDiscountCheckBox:N,componentType:P,CTAoptions:L,buttonType:w}=u;var U,H,R,W,M;const[$,I]=o(!1),[Y,z]=o(""),[Z,G]=o([]),[q,F]=o(),[K,J]=o(!1),{variableList:Q,setVariableList:X,setVariableCallback:ee,setShowVariablePicker:te,device:le,channel:ae,isError:ie,originalVariableList:ne,template:oe,templateSelectionTriggered:se,setTemplate:ue,setDisplayContent:de,setOriginalVariableList:ce,globalNormalizedPlaceholders:re,enabledCustomText:pe,pod:me,selectedCarouselIndex:ve,isProductCarouselType:be,disableEditVariable:ge,disableEditExpiry:Oe,templateErrorIndexes:je}=x();function ye(e,t){var l,a,i;const n=e;z(""),F(n),ae===v.WHATSAPP?"custom_text"!==n.value&&"custom_link"!==n.value&&"static_expiry"!==n.value?(xe(null!==(l=n.value)&&void 0!==l?l:"","string"),null==fe||fe(null!==(a=A.index)&&void 0!==a?a:0,n.value,!0)):(null==fe||fe(null!==(i=A.index)&&void 0!==i?i:0,"",!0,n.value),xe("","url"===n.bikPlaceholderType?"link":"string")):"custom_text"!==n.value&&"custom_link"!==n.value?xe(n.value,"url"===n.bikPlaceholderType?"link":"string"):(z(""),xe("",n.value))}function he(e,t){var l;z(t);const a="custom_link"===(null==q?void 0:q.value)&&t?t.includes("https")?t:`https://${t}`:t;xe(a,"static_expiry"===e?"string":e),ae===v.WHATSAPP&&(null==fe||fe(null!==(l=A.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function xe(e,t){var l,a,i,o;const s="custom_link"===t?"link":"custom_text"===t?"string":t;if(ae!==v.WHATSAPP){const a=_(D+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===le?"template_html_mobile":"template_html_desktop"),n=ae===v.EMAIL?null===(l=null==i?void 0:i.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);n&&(n.textContent="custom_text"!==t&&"custom_link"!==t||e?e:A.variableName);const o=ne.map(((t,l)=>l===D?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t));null==ce||ce(o)}if(ae===v.WHATSAPP){if(null!=ve&&ve>-1&&be){const l=Object.assign({},ne).cards.map(((l,a)=>{var i,n;return"BODY"===P?Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((t,l)=>D===l?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t))}):"BUTTONS"===P?Object.assign(Object.assign({},l),{buttons:null===(n=l.buttons)||void 0===n?void 0:n.map(((l,a)=>a===D?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==ce||ce((e=>Object.assign(Object.assign({},e),{cards:l}))))}const l=null!=ve&&ve>-1?ne.cards[ve]:ne;let u=l.body,d=l.header,c=l.buttons;if("BODY"===P?u=null===(a=l.body)||void 0===a?void 0:a.map(((t,l)=>l===D?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"HEADER"===P?d=null===(i=l.header)||void 0===i?void 0:i.map(((t,l)=>l===D?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"BUTTONS"===P&&(c=null===(o=l.buttons)||void 0===o?void 0:o.map(((l,a)=>a===D?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))),null!=ve&&ve>-1){const e=n(ne.cards);e[ve]={header:d,body:u,buttons:c},null==ce||ce((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==ce||ce((e=>Object.assign(Object.assign({},e),{header:d,body:u,buttons:c})))}}function fe(e,t,l,a){var i,o,s,u,d,c,r;if(null!=ve&&ve>-1&&be){const o=Object.assign({},oe).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,i,n,o,s,u;if("BODY"===l.type&&"BODY"===P){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const a=[...null!==(s=null===(o=null===(n=l.example)||void 0===n?void 0:n.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const i=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:i})}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})),s=n(oe);if(l){const l=null===(i=Object.assign({},oe).mapping.cards)||void 0===i?void 0:i.map(((l,i)=>{var n,o,s;if("BODY"===P)return Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((l,i)=>e===i?"custom_text"===a?`((editableVariable${i+10}))`:t:l))});if("BUTTONS"===P&&(null==l?void 0:l.buttons)){let n=-1,u=-1;return null===(o=oe.components[1].cards)||void 0===o||o[i].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(n++,l===e&&"URL"==t.type&&(u=n))})))})),Object.assign(Object.assign({},l),{buttons:null===(s=l.buttons)||void 0===s?void 0:s.map(((e,l)=>l===u?"custom_link"===a?"((customPlaceholderName))":t:e))})}return l}));s.mapping.cards=l}return s.components=o,void(null==ue||ue(s))}const p=null!=ve&&ve>-1?{components:null===(o=Object.assign({},oe).components[1].cards)||void 0===o?void 0:o[ve].components,mapping:null===(s=Object.assign({},oe).mapping.cards)||void 0===s?void 0:s[ve]}:Object.assign({},oe),m=null===(u=null==p?void 0:p.components)||void 0===u?void 0:u.map((l=>{var a,i,n,o,s,u,d,c,r;const p=Object.assign({},l);if("BODY"===l.type&&"BODY"===P){if(null===(i=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===i?void 0:i[0]){const l=[...null!==(s=null===(o=null===(n=p.example)||void 0===n?void 0:n.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];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,i)=>e===i?"custom_text"===a?`((editableVariable${i+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,i)=>e===i?"custom_text"===a?`((editableVariable${i+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,i=-1;m.forEach((t=>{var a;"BUTTONS"===t.type&&(null===(a=t.buttons)||void 0===a||a.forEach(((t,a)=>{"URL"===t.type&&(l++,a===e&&"URL"==t.type&&(i=l))})))})),p.mapping=Object.assign(Object.assign({},p.mapping),{buttons:p.mapping.buttons.map(((e,l)=>l===i?"custom_link"===a?"((customPlaceholderName))":t:e))})}if(null!=ve&&ve>-1&&oe){const e=n(oe);e.components[1].cards[ve].components=p.components,e.mapping.cards[ve]=p.mapping,null==ue||ue(e)}else null==ue||ue(Object.assign({},p))}s((()=>{$&&(null==S||S())}),[$]),s((()=>{!function(){var e,t,l,a,i;const n="mobile"===le?"template_html_mobile":"template_html_desktop",o=document.getElementById(n),s=(null!==(a=null===(l=null===(t=null===(e=null==o?void 0:o.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===(i=null==o?void 0:o.contentWindow)||void 0===i?void 0:i.document.head.innerHTML);ae===v.EMAIL&&(null==de||de(s))}()}),[se]),s((()=>{!function(){var e,t;const l=[];let a=[];if(ae!==v.MESSAGE||pe){"link"===(null==A?void 0:A.type)?(l.push({label:"",options:[V,E]}),F(V)):"date_time"===(null==A?void 0:A.type)?(l.push({label:"",options:[V,E]}),F(C)):(l.push({label:"",options:[V,E,C]}),F(E));const e=null!=re?re:[];G([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:y.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!=re?re:[];G([{label:"",options:[E,V]},...e]),a=[{label:"",options:[E,V]},...e]}if((ae===v.WHATSAPP||ae===v.EMAIL||ae===v.MESSAGE)&&A.updatedValue)if(m.test(A.updatedValue)&&ae===v.WHATSAPP||A.updatedValue.startsWith("{{")&&ae!==v.WHATSAPP){const e=function(e,t,l){var a;let i={label:"",value:""};const n=l===v.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(B){let t=e.updatedValue;if(me===b.CHATBOT&&"BUTTONS"===P){const l=null==L?void 0:L.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}i={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())===n.trim()&&(i=e)}))}));return i}(A,a,ae);e.value&&F(e)}else"date_time"===A.type?(F(C),z(A.updatedValue),fe(null!==(e=A.index)&&void 0!==e?e:0,A.updatedValue)):(null===(t=A.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(F(V),z(A.updatedValue.split("https://")[1])):(F(E),z(A.updatedValue))}()}),[ve]),s((()=>{le&&q&&Y&&setTimeout((()=>{xe("custom_link"===(null==q?void 0:q.value)&&Y?Y.includes("https")?Y:`https://${Y}`:Y,q.value)}),100)}),[le]),s((()=>{!K&&q&&A.updatedValue&&setTimeout((()=>{xe("custom_link"===(null==q?void 0:q.value)&&A.updatedValue?A.updatedValue.includes("https")?A.updatedValue:`https://${A.updatedValue}`:A.updatedValue,q.value),J(!0)}),100)}),[q]);const _e=e=>{null==N||N(!1),"{{custom.url}}"===e.actualValue?ye({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?ye({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?ye({label:e.displayName,selected:!0,value:"static_expiry"}):ye({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})};return e(T,Object.assign({channel:ae,focused:$,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(O,Object.assign({style:{color:ie&&!q?h.content.negative:h.content.primary}},{children:[null===(U=A.variableName)||void 0===U?void 0:U.replace("{{","").replace("}}","")," ","link"===(null==A?void 0:A.type)?"link":"variable"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:B?e("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==q?void 0:q.label)?"space-between":"flex-end"}},{children:[t(j,Object.assign({numberOfLines:1},{children:me===b.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(H=null==q?void 0:q.value)&&void 0!==H?H:"")?null==q?void 0:q.label:null==q?void 0:q.value:p(null!==(R=null==q?void 0:q.label)&&void 0!==R?R:"",20,!0)})),ge||"date_time"===(null==A?void 0:A.type)&&Oe?t(l,{}):t(a,{onClick:()=>{console.log("click"),(()=>{if(w===g.URL&&me===b.CHATBOT){const e=f({variableList:Q,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"});X(e)}else if("limited_time_offer"===P){const e=f({variableList:Q,categoryDisplayName:"Static Variables",variableDisplayName:"Static Expiry",variableValue:"{{static.expiry}}"});X(e)}else if(w===g.COPY_CODE){const e=f({variableList:Q,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});X(e)}})(),ee((()=>_e)),te(!0)},width:24,height:24,color:h.content.primary})]})):t(c,{disabled:ge,options:Z,isSearchable:!1,onSelect:ye,defaultOptions:q?[Object.assign(Object.assign({},q),{selected:!0})]:[]})})),("custom_text"===(null==q?void 0:q.value)||"custom_link"===(null==q?void 0:q.value))&&t(r,{state:ge?"disabled":"none",labelText:"custom_text"===(null==q?void 0:q.value)?"Custom text value":"custom_link"===(null==q?void 0:q.value)?"Custom URL value":"",id:`variable-value-${null==q?void 0:q.value}-${D}`,value:Y,errorMessage:ie&&(null===(W=null==je?void 0:je.buttons)||void 0===W?void 0:W.includes(null!==(M=null==A?void 0:A.index)&&void 0!==M?M:-1))?Y&&0!==Y.trim().length?"custom_link"!==q.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${Y.trim()}`)&&0!==Y.trim().length?"custom_link"!==q.value&&Y.length>30?"Length cannot be more than 30":"BUTTONS"===P&&"custom_link"!==q.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==q?void 0:q.value)?2e3:"BUTTONS"===P?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==q?void 0:q.value)?"https://":"",placeholder:"link"===A.type||"custom_link"===q.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{he(q.value,e)}}),"static_expiry"===(null==q?void 0:q.value)&&e("div",Object.assign({style:{position:"relative"}},{children:[ge&&t(k,{onClick:e=>e.preventDefault()}),t(d,{placement:"auto",time:i(Y?new Date(Y):new Date,"hh:mm a"),date:Y?new Date(Y):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{he("static_expiry",e.toISOString())}})]}))]}))};export{T as Container,S as default};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import{cloneDeep as l}from"lodash";import{useState as s,useEffect as a}from"react";import{Dropdown as n}from"../../dropdown/Dropdown.js";import{Input as o}from"../../input/Input.js";import{editableVarPattern as i}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as r}from"../../template-preview/models/TemplateMeta.js";import{POD as c}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as u}from"../../TypographyStyle.js";import{COLORS as d}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{validateIsUrl as b}from"../utils/validateIsUrl.js";import m,{Container as j}from"./VariableConnector.js";const f=f=>{let{variableListIndex:g,button:O,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:x,currentVariableList:y,CTAoptions:h,QRBoptions:L}=f;var R,U,V,T;const[w,I]=s(""),[C,E]=s(),{isError:H,disableEditVariable:N,pod:P,selectedCarouselIndex:B,originalVariableList:Q,setOriginalVariableList:_,isProductCarouselType:S}=p();function K(t){if(I(t),null!=B&&B>-1&&S){const e=l(Q);if("URL"===O.type){const l=e.cards.map((e=>{let l=e.buttons.filter((t=>"URL"===t.type))[g];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const s=e.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==l?void 0:l.text)?l:t));return Object.assign(Object.assign({},e),{buttons:s})}));null==_||_((t=>Object.assign(Object.assign({},t),{cards:l}))),null==v||v(`https://${t}`,"custom",g)}return}let e=y.buttons.filter((t=>"URL"===t.type))[g];e=Object.assign(Object.assign({},e),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const s=y.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),a=Object.assign({},null!=B&&B>-1?Q.cards[B]:Q);if(a.buttons=s,null!=B&&B>-1){const t=[...Q.cards];t[B]=a,null==_||_((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==_||_((t=>Object.assign(Object.assign({},t),{buttons:[...s]})));null==v||v(`https://${t}`,"custom",g)}return a((()=>{var t;if(O.buttonVariable&&i.test(O.buttonVariable))E(r),I((null===(t=O.example)||void 0===t?void 0:t[0].split("https://")[1])||"");else{let t=-1;const e="URL"===O.type?h:L;t="URL"===O.type?e.findIndex((t=>t.placeHolder===O.buttonVariable)):e.findIndex((t=>t.label===O.flowName)),t>-1&&E(e[t])}}),[]),P!==c.CHATBOT?t(j,{children:[e("div",Object.assign({style:{marginBottom:8}},{children:t(u,Object.assign({style:{color:d.content.primary}},{children:[O.text," button"]}))})),e("div",Object.assign({style:{marginBottom:12}},{children:e(n,{disabled:N,options:"URL"===O.type?h:L,isSearchable:!0,onSelect:function(t,e){const s=t;E(s);const a=("URL"===O.type?h:L).find((t=>t.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=B&&B>-1&&S){const t=l(Q);if("URL"===O.type){const e=t.cards.map((t=>{let e=t.buttons.filter((t=>"URL"===t.type))[g];e=Object.assign(Object.assign({},e),{buttonVariable:s.placeHolder});const l=t.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t));return Object.assign(Object.assign({},t),{buttons:l})}));null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",g),null==_||_((t=>Object.assign(Object.assign({},t),{cards:e})))}else if("QUICK_REPLY"===O.type){const e=t.cards.map((t=>{let e=t.buttons.filter((t=>"QUICK_REPLY"===t.type))[g];e=Object.assign(Object.assign({},e),{flowName:s.label,flowId:s.value});const l=t.buttons.map((t=>"QUICK_REPLY"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t));return Object.assign(Object.assign({},t),{buttons:l})}));null==x||x({flowName:s.label,flowId:s.value},"placeholder",g),null==_||_((t=>Object.assign(Object.assign({},t),{cards:e})))}return}let t;if("URL"===O.type){let e=y.buttons.filter((t=>"URL"===t.type))[g];e=Object.assign(Object.assign({},e),{buttonVariable:s.placeHolder}),t=y.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",g)}else{let e=y.buttons.filter((t=>"QUICK_REPLY"===t.type))[g];e=Object.assign(Object.assign({},e),{flowName:s.label,flowId:s.value}),t=y.buttons.map((t=>"QUICK_REPLY"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==x||x({flowName:s.label,flowId:s.value},"placeholder",g)}const e=Object.assign({},null!=B&&B>-1?Q.cards[B]:Q);if(e.buttons=t,null!=B&&B>-1){const t=[...Q.cards];t[B]=e,null==_||_((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==_||_((e=>Object.assign(Object.assign({},e),{buttons:[...t]})))}else K("")},defaultOptions:C?[Object.assign(Object.assign({},C),{selected:!0})]:[]})})),"custom_link"===(null==C?void 0:C.value)&&e("div",Object.assign({style:{marginBottom:20}},{children:e(o,{state:N?"disabled":"none",errorMessage:H?w?b(w)?"":"Enter valid URL":"Required field":"",value:w,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:K,maxCharLimit:2e3})}))]}):e(m,{index:g,variable:{variableName:null!==(R=O.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===O.buttonVariable?`${null===(U=O.example)||void 0===U?void 0:U[0]}`:null!==(V=O.buttonVariable)&&void 0!==V?V:"",type:"link",isEditableVariable:!0,index:null!==(T=O.index)&&void 0!==T?T:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:O.type,CTAoptions:h})};export{f as default};
1
+ import{jsxs as t,jsx as e}from"react/jsx-runtime";import{cloneDeep as l}from"lodash";import{useState as s,useEffect as a}from"react";import{Dropdown as n}from"../../dropdown/Dropdown.js";import{Input as o}from"../../input/Input.js";import{editableVarPattern as i}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as r}from"../../template-preview/models/TemplateMeta.js";import{POD as c}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as u}from"../../TypographyStyle.js";import{COLORS as d}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{validateIsUrl as b}from"../utils/validateIsUrl.js";import m,{Container as j}from"./VariableConnector.js";const f=f=>{let{variableListIndex:g,button:O,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:x,currentVariableList:y,CTAoptions:h,QRBoptions:L}=f;var R,U,V,T;const[w,I]=s(""),[C,E]=s(),{isError:H,disableEditVariable:N,pod:P,selectedCarouselIndex:B,originalVariableList:Q,setOriginalVariableList:_,isProductCarouselType:S}=p();function K(t){if(I(t),null!=B&&B>-1&&S){const e=l(Q);if("URL"===O.type){const l=e.cards.map((e=>{let l=e.buttons.filter((t=>"URL"===t.type))[g];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const s=e.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==l?void 0:l.text)?l:t));return Object.assign(Object.assign({},e),{buttons:s})}));null==_||_((t=>Object.assign(Object.assign({},t),{cards:l}))),null==v||v(`https://${t}`,"custom",g)}return}let e=y.buttons.filter((t=>"URL"===t.type))[g];e=Object.assign(Object.assign({},e),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const s=y.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),a=Object.assign({},null!=B&&B>-1?Q.cards[B]:Q);if(a.buttons=s,null!=B&&B>-1){const t=[...Q.cards];t[B]=a,null==_||_((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==_||_((t=>Object.assign(Object.assign({},t),{buttons:[...s]})));null==v||v(`https://${t}`,"custom",g)}return a((()=>{var t;if(O.buttonVariable&&i.test(O.buttonVariable))E(r),I((null===(t=O.example)||void 0===t?void 0:t[0].split("https://")[1])||"");else{let t=-1;const e="URL"===O.type?h:L;t="URL"===O.type?e.findIndex((t=>t.placeHolder===O.buttonVariable)):e.findIndex((t=>t.label===O.flowName)),t>-1&&E(e[t])}}),[]),P!==c.CHATBOT?t(j,{children:[e("div",Object.assign({style:{marginBottom:8}},{children:t(u,Object.assign({style:{color:d.content.primary}},{children:[O.text," button"]}))})),e("div",Object.assign({style:{marginBottom:12}},{children:e(n,{disabled:N,options:"URL"===O.type?h:L,isSearchable:!0,onSelect:function(t,e){const s=t;E(s);const a=("URL"===O.type?h:L).find((t=>t.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=B&&B>-1&&S){const t=l(Q);if("URL"===O.type){const e=t.cards.map((t=>{let e=t.buttons.filter((t=>"URL"===t.type))[g];e=Object.assign(Object.assign({},e),{buttonVariable:s.placeHolder});const l=t.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t));return Object.assign(Object.assign({},t),{buttons:l})}));null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",g),null==_||_((t=>Object.assign(Object.assign({},t),{cards:e})))}else if("QUICK_REPLY"===O.type){const e=t.cards.map((t=>{let e=t.buttons.filter((t=>"QUICK_REPLY"===t.type))[g];e=Object.assign(Object.assign({},e),{flowName:s.label,flowId:s.value});const l=t.buttons.map((t=>"QUICK_REPLY"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t));return Object.assign(Object.assign({},t),{buttons:l})}));null==x||x({flowName:s.label,flowId:s.value},"placeholder",g),null==_||_((t=>Object.assign(Object.assign({},t),{cards:e})))}return}let t;if("URL"===O.type){let e=y.buttons.filter((t=>"URL"===t.type))[g];e=Object.assign(Object.assign({},e),{buttonVariable:s.placeHolder}),t=y.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",g)}else{let e=y.buttons.filter((t=>"QUICK_REPLY"===t.type))[g];e=Object.assign(Object.assign({},e),{flowName:s.label,flowId:s.value}),t=y.buttons.map((t=>"QUICK_REPLY"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==x||x({flowName:s.label,flowId:s.value},"placeholder",g)}const e=Object.assign({},null!=B&&B>-1?Q.cards[B]:Q);if(e.buttons=t,null!=B&&B>-1){const t=[...Q.cards];t[B]=e,null==_||_((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==_||_((e=>Object.assign(Object.assign({},e),{buttons:[...t]})))}else K("")},defaultOptions:C?[Object.assign(Object.assign({},C),{selected:!0})]:[]})})),"custom_link"===(null==C?void 0:C.value)&&e("div",Object.assign({style:{marginBottom:20}},{children:e(o,{state:N?"disabled":"none",errorMessage:H?w?b(w)?"":"Enter valid URL":"Required field":"",value:w,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:K,maxCharLimit:2e3})}))]}):e(m,{index:g,variable:{variableName:null!==(R=O.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===O.buttonVariable?`${null===(U=O.example)||void 0===U?void 0:U[0]}`:null!==(V=O.buttonVariable)&&void 0!==V?V:"",type:"link",isEditableVariable:!0,index:null!==(T=O.index)&&void 0!==T?T:0},showVariableModal:!0,componentType:"BUTTONS",CTAoptions:h})};export{f as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../_virtual/_tslib.js";import{cloneDeep as o}from"lodash";import{useState as n,useRef as i,useEffect as t}from"react";import{FileUploaderHelper as l}from"../../helpers/FileUploaderHelper.js";import{HEADER_TYPES as a}from"../../template-preview/models/TemplateMeta.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import{isVariable as r}from"../utils/validateIsUrl.js";const d=d=>{const{uploadMediaLink:c,updateTemplateImageUrl:p,mediaComponent:m,uploadMediaFiles:u,fileRef:f}=d,{template:v,selectedCarouselIndex:g,setTemplate:h}=s(),[b,I]=n(void 0),[y,j]=n(),[E,M]=n(!1),[O,U]=n(""),[C,k]=n(!1),[w,A]=n(),N=i(null);function T(o){var n;return e(this,void 0,void 0,(function*(){const e=new l;if(o instanceof Blob){const i=e.validate({file:o});if(i)U(i),k(!1),M(!1);else{const e=m.format===a.IMAGE,i=yield u({file:o,fileName:b,isImage:e});if(i.success){const[e]=o.type.split("/");p(null!==(n=i.url)&&void 0!==n?n:"","application"===e?a.DOCUMENT:a[e.toUpperCase()])}else k(!1),U("An unknown technical error occurred");k(!1),M(!1)}}else U("An unknown technical error occurred"),k(!1)}))}function x(){var e;(null===(e=null==f?void 0:f.current)||void 0===e?void 0:e.click)&&f.current.click()}return t((()=>{I(void 0),A(void 0),j(void 0),M(!1),k(!1),U("")}),[g]),{uploadMedia:function(n){var i,t,s,d,u,f;return e(this,void 0,void 0,(function*(){if(U(""),j(""),n)if(n.startsWith("https"))try{if(k(!0),c){const e=yield c(n),{type:o,size:t,success:s}=e;if(s){const n=(new l).validate({linkData:{type:o,size:t}});if(n)return U(n),void k(!1);const[s]=o.split("/");p(null!==(i=e.url)&&void 0!==i?i:"",s.includes("application")?a.DOCUMENT:a[s.toUpperCase()])}else k(!1),U("An unknown technical error occurred");k(!1)}else{const e=yield fetch(n),o=yield e.blob();yield T(o)}}catch(e){k(!1),U("An unknown technical error occurred")}else if(r(n)){let e;if(j(n),e=null!=g&&g>-1?{components:null===(s=null===(t=v.components[1])||void 0===t?void 0:t.cards)||void 0===s?void 0:s[g].components,mapping:null===(u=null===(d=null==v?void 0:v.mapping)||void 0===d?void 0:d.cards)||void 0===u?void 0:u[g]}:Object.assign({},v),e.components){const o=null===(f=null==e?void 0:e.components)||void 0===f?void 0:f.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==o&&o>-1&&(null==e?void 0:e.components[o])){const i=Object.assign(Object.assign({},e.components[o]),{format:m.format,example:{header_handle:[n]}}),t=[...e.components];t[o]=i,e.components=t}}if(e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[n]})),k(!1),null!=g&&g>-1){const n=o(v);n.components[1].cards[g].components=e.components,n.mapping.cards[g]=e.mapping,null==h||h(Object.assign({},n))}else null==h||h(Object.assign({},e))}else k(!1),U("Invalid URL or variable");else x()}))},processImageUpload:T,handleImageUpload:function(e){var o;U(""),k(!0);const n=null===(o=e.target.files)||void 0===o?void 0:o[0];if(m.format===a.IMAGE){const e=new FileReader;A(""),I(""),e.onload=()=>{A(e.result),I(null==n?void 0:n.name)},n&&e.readAsDataURL(n)}else T(n)},handleImageChange:x,onCropComplete:function(o){return e(this,void 0,void 0,(function*(){k(!1),U("");const e=yield fetch(o),n=yield e.blob();yield T(n),A(void 0),M(!1)}))},editIconRef:N,fileName:b,setFileName:I,selectedVariable:y,setSelectedVariable:j,openEditMedia:E,setOpenEditMedia:M,selectedImage:w,setSelectedImage:A,loading:C,setLoading:k,error:O,setError:U}};export{d as useEditWhatsappTemplateMedia};
1
+ import{__awaiter as e}from"../../../_virtual/_tslib.js";import{cloneDeep as o}from"lodash";import{useState as n,useRef as i,useEffect as l}from"react";import{FileUploaderHelper as t}from"../../helpers/FileUploaderHelper.js";import{HEADER_TYPES as a}from"../../template-preview/models/TemplateMeta.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import{isVariable as r}from"../utils/validateIsUrl.js";const d=d=>{const{uploadMediaLink:c,updateTemplateImageUrl:p,mediaComponent:u,uploadMediaFiles:m,fileRef:f}=d,{template:v,selectedCarouselIndex:g,setTemplate:h}=s(),[b,I]=n(void 0),[y,M]=n(),[j,C]=n(!1),[E,O]=n(""),[U,k]=n(!1),[w,A]=n(),N=i(null);function T(o){var n;return e(this,void 0,void 0,(function*(){const e=new t;if(o instanceof Blob){const i=e.validate({file:o});if(i)O(i),k(!1),C(!1);else{const e=u.format===a.IMAGE,i=yield m({file:o,fileName:b,isImage:e});if(i.success){const[e]=o.type.split("/");p(null!==(n=i.url)&&void 0!==n?n:"","application"===e?a.DOCUMENT:a[e.toUpperCase()])}else O("An unknown technical error occurred");k(!1),C(!1)}}else O("An unknown technical error occurred"),k(!1)}))}function x(){var e;console.log("handleImageChange",f,null==f?void 0:f.current),(null===(e=null==f?void 0:f.current)||void 0===e?void 0:e.click)&&f.current.click()}return l((()=>{I(void 0),A(void 0),M(void 0),C(!1),k(!1),O("")}),[g]),{uploadMedia:function(n){var i,l,s,d,m,b;return e(this,void 0,void 0,(function*(){if(O(""),M(""),console.log("uef uploadMedia",f,null==f?void 0:f.current),n)if(n.startsWith("https"))try{if(k(!0),console.log("uploadMediaLink",c),c){const e=yield c(n),{type:o,size:l,success:s}=e;if(s){const n=(new t).validate({linkData:{type:o,size:l}});if(n)return O(n),void k(!1);const[s]=o.split("/");p(null!==(i=e.url)&&void 0!==i?i:"",s.includes("application")?a.DOCUMENT:a[s.toUpperCase()])}else O("An unknown technical error occurred");k(!1)}else{const e=yield fetch(n),o=yield e.blob();yield T(o)}}catch(e){O("An unknown technical error occurred")}else if(r(n)){let e;if(M(n),e=null!=g&&g>-1?{components:null===(s=null===(l=v.components[1])||void 0===l?void 0:l.cards)||void 0===s?void 0:s[g].components,mapping:null===(m=null===(d=null==v?void 0:v.mapping)||void 0===d?void 0:d.cards)||void 0===m?void 0:m[g]}:Object.assign({},v),e.components){const o=null===(b=null==e?void 0:e.components)||void 0===b?void 0:b.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==o&&o>-1&&(null==e?void 0:e.components[o])){const i=Object.assign(Object.assign({},e.components[o]),{format:u.format,example:{header_handle:[n]}}),l=[...e.components];l[o]=i,e.components=l}}if(e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[n]})),k(!1),null!=g&&g>-1){const n=o(v);n.components[1].cards[g].components=e.components,n.mapping.cards[g]=e.mapping,null==h||h(Object.assign({},n))}else null==h||h(Object.assign({},e))}else k(!1),O("Invalid URL or variable");else x()}))},processImageUpload:T,handleImageUpload:function(e){var o;O(""),k(!0);const n=null===(o=e.target.files)||void 0===o?void 0:o[0];if(u.format===a.IMAGE){const e=new FileReader;A(""),I(""),e.onload=()=>{A(e.result),I(null==n?void 0:n.name)},n&&e.readAsDataURL(n)}else T(n)},handleImageChange:x,onCropComplete:function(o){return e(this,void 0,void 0,(function*(){k(!1),O("");const e=yield fetch(o),n=yield e.blob();yield T(n),A(void 0),C(!1)}))},editIconRef:N,fileName:b,setFileName:I,selectedVariable:y,setSelectedVariable:M,openEditMedia:j,setOpenEditMedia:C,selectedImage:w,setSelectedImage:A,loading:U,setLoading:k,error:E,setError:O}};export{d as useEditWhatsappTemplateMedia};
@@ -26,8 +26,6 @@ import r from"styled-components";import{COLORS as e,BASE_COLORS as o}from"../../
26
26
  justify-content: center;
27
27
  flex-grow: 1;
28
28
  min-height: 180px;
29
- border-left: 1px solid ${e.stroke.primary};
30
- border-right: 1px solid ${e.stroke.primary};
31
29
  `,p=r.div`
32
30
  display: flex;
33
31
  justify-content: center;
@@ -8,6 +8,5 @@ declare const SmsTemplatePreview: React.FC<{
8
8
  onlyTemplateContent?: boolean;
9
9
  display_content?: string;
10
10
  size?: 'small' | 'large';
11
- uniqueId?: string;
12
11
  }>;
13
12
  export default SmsTemplatePreview;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import n from"../../assets/icons/more_vertical.svg.js";import o from"../../assets/icons/search.svg.js";import{COLORS as r}from"../../constants/Theme.js";import{useTemplateModalContext as s}from"../template-context-mapper/context/templateModalContext.js";import{TitleRegular as a,Caption as c}from"../TypographyStyle.js";import{renderVariableUIForPreview as d}from"./helpers/SmsTemplateHelper.js";import m from"./SMS/SMSBubble.js";import{SMSBubbleContainer as p,SMSCardHeader as h,SMSHeader as u}from"./SmsTemplatePreview.styled.js";const v=v=>{let{template:f,variableStore:g,hideHeader:j,display_content:y,onlyTemplateContent:x,size:b,uniqueId:w}=v;var S;const z=null==f?void 0:f.content,{hideDeviceContainerInPreview:O}=s();return O?e(p,Object.assign({size:b},{children:e(m,{size:null!=b?b:"large",content:null!=y?y:d(z,null!=g?g:[],void 0,null!=w?w:"")})})):t(i,{children:[!j&&!x&&e(h,{children:e(a,Object.assign({style:{maxWidth:"100%"}},{children:f.name}))}),!x&&e(u,{children:t(i,{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8}},{children:[e(l,{width:16,height:16,color:r.content.secondary}),e(c,{children:null===(S=null==f?void 0:f.headers)||void 0===S?void 0:S[0]})]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8}},{children:[e(o,{width:16,height:16,color:r.content.secondary}),e(n,{width:16,height:16,color:r.content.secondary})]}))]})}),e(p,Object.assign({size:b},{children:e(m,{size:null!=b?b:"large",content:null!=y?y:d(z,null!=g?g:[],void 0,null!=w?w:"")})}))]})};export{v as default};
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import n from"../../assets/icons/more_vertical.svg.js";import o from"../../assets/icons/search.svg.js";import{COLORS as l}from"../../constants/Theme.js";import{useTemplateModalContext as s}from"../template-context-mapper/context/templateModalContext.js";import{TitleRegular as a,Caption as c}from"../TypographyStyle.js";import{renderVariableUIForPreview as m}from"./helpers/SmsTemplateHelper.js";import d from"./SMS/SMSBubble.js";import{SMSBubbleContainer as p,SMSCardHeader as h,SMSHeader as f}from"./SmsTemplatePreview.styled.js";const g=g=>{let{template:j,variableStore:v,hideHeader:y,display_content:u,onlyTemplateContent:x,size:b}=g;var w;const S=null==j?void 0:j.content,{hideDeviceContainerInPreview:z}=s();return z?e(p,Object.assign({size:b},{children:e(d,{size:null!=b?b:"large",content:null!=u?u:m(S,null!=v?v:[])})})):t(r,{children:[!y&&!x&&e(h,{children:e(a,Object.assign({style:{maxWidth:"100%"}},{children:j.name}))}),!x&&e(f,{children:t(r,{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8}},{children:[e(i,{width:16,height:16,color:l.content.secondary}),e(c,{children:null===(w=null==j?void 0:j.headers)||void 0===w?void 0:w[0]})]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8}},{children:[e(o,{width:16,height:16,color:l.content.secondary}),e(n,{width:16,height:16,color:l.content.secondary})]}))]})}),e(p,Object.assign({size:b},{children:e(d,{size:null!=b?b:"large",content:null!=u?u:m(S,null!=v?v:[])})}))]})};export{g as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as l,Fragment as t}from"react/jsx-runtime";import{useTemplateModalContext as i}from"../template-context-mapper/context/templateModalContext.js";import a from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import{TitleRegular as o}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as s}from"./models/Channels.js";import d from"./SmsTemplatePreview.js";import p from"./WhatsAppTemplatePreview.js";const m=m=>{let{template:c,channel:v,whatsAppSpecificMeta:h,templateCreationsInfo:b,hideHeader:g,size:C,onlyTemplateContent:S,emailSpecificMeta:y,smsSpecificMeta:j,showSampleValues:T,carouselCardIndex:f,isWhatsappCarousel:w,isPreview:x}=m;var W,H;const{setSelectedCarouselIndex:O}=i();return v===s.SMS?e("div",Object.assign({style:Object.assign({marginTop:b?16:0,border:b?`1px solid ${n.stroke.primary}`:"none",borderRadius:4},null==j?void 0:j.templateContainerStyles)},{children:e(d,{template:c,hideHeader:g,onlyTemplateContent:S,size:null!=C?C:"large",variableStore:null==j?void 0:j.smsVariableStore,display_content:null==j?void 0:j.smsDisplayContent,uniqueId:null==j?void 0:j.uniqueId})})):v===s.EMAIL?e("div",Object.assign({style:Object.assign({marginTop:b?16:0},null==y?void 0:y.templateContainerStyles)},{children:e(r,{template:c,handleViewTemplate:()=>{var e;null===(e=null==y?void 0:y.handleViewTemplate)||void 0===e||e.call(y)},hideHeader:g,hideViewButton:null==y?void 0:y.hideViewButtonForEmail,containerStyle:null==y?void 0:y.containerStyle,emailDisplayContent:null==y?void 0:y.emailDisplayContent,emailHtmlContainerId:null==y?void 0:y.emailHtmlContainerId})})):v===s.WHATSAPP?l("div",Object.assign({style:Object.assign(Object.assign({},null==h?void 0:h.templateContainerStyles),b?u.WhatsAppWrapper:{}),onClick:()=>{var e,l;if(O&&w){if(-1===f&&!(null===(l=null===(e=null==c?void 0:c.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length))return;O(null!=f?f:-1)}}},{children:[b?e("div",Object.assign({style:{padding:16}},{children:e(o,{children:a.convertToTitleCase(null!==(W=null==c?void 0:c.label)&&void 0!==W?W:"")})})):e(t,{}),e(p,{showSampleValues:T,showHeader:null==h?void 0:h.showWhatsAppHeader,extras:null==h?void 0:h.whatsAppExtras,template:c,size:b?"small":null!=C?C:"large",containerStyle:Object.assign(Object.assign({borderWidth:b?0:1,borderTopWidth:1},null!==(H=null==h?void 0:h.containerStyle)&&void 0!==H?H:{}),{height:"100%"}),zeroStateComponent:null==h?void 0:h.zeroStateComponent,usePlaceHolderName:null==h?void 0:h.usePlaceHolderName,carouselCardIndex:f,isWhatsappCarousel:w,isPreview:x})]})):e(t,{})},u={WhatsAppWrapper:{backgroundColor:n.surface.standard,borderRadius:4,border:`1px solid ${n.background.inactive}`,marginTop:16}};export{m as TemplatePreview};
1
+ import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useTemplateModalContext as a}from"../template-context-mapper/context/templateModalContext.js";import i from"../../utils/StringUtils.js";import{COLORS as o}from"../../constants/Theme.js";import{TitleRegular as n}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as s}from"./models/Channels.js";import d from"./SmsTemplatePreview.js";import p from"./WhatsAppTemplatePreview.js";const m=m=>{let{template:u,channel:v,whatsAppSpecificMeta:h,templateCreationsInfo:C,hideHeader:S,size:b,onlyTemplateContent:y,emailSpecificMeta:g,smsSpecificMeta:j,showSampleValues:T,carouselCardIndex:w,isWhatsappCarousel:f,isPreview:x}=m;var W,H;const{setSelectedCarouselIndex:A}=a();return v===s.SMS?e("div",Object.assign({style:Object.assign({marginTop:C?16:0,border:C?`1px solid ${o.stroke.primary}`:"none",borderRadius:4},null==j?void 0:j.templateContainerStyles)},{children:e(d,{template:u,hideHeader:S,onlyTemplateContent:y,size:null!=b?b:"large",variableStore:null==j?void 0:j.smsVariableStore,display_content:null==j?void 0:j.smsDisplayContent})})):v===s.EMAIL?e("div",Object.assign({style:Object.assign({marginTop:C?16:0},null==g?void 0:g.templateContainerStyles)},{children:e(r,{template:u,handleViewTemplate:()=>{var e;null===(e=null==g?void 0:g.handleViewTemplate)||void 0===e||e.call(g)},hideHeader:S,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})})):v===s.WHATSAPP?t("div",Object.assign({style:Object.assign(Object.assign({},null==h?void 0:h.templateContainerStyles),C?c.WhatsAppWrapper:{}),onClick:()=>{A&&f&&A(null!=w?w:-1)}},{children:[C?e("div",Object.assign({style:{padding:16}},{children:e(n,{children:i.convertToTitleCase(null!==(W=null==u?void 0:u.label)&&void 0!==W?W:"")})})):e(l,{}),e(p,{showSampleValues:T,showHeader:null==h?void 0:h.showWhatsAppHeader,extras:null==h?void 0:h.whatsAppExtras,template:u,size:C?"small":null!=b?b:"large",containerStyle:Object.assign({borderWidth:C?0:1,borderTopWidth:1},null!==(H=null==h?void 0:h.containerStyle)&&void 0!==H?H:{}),zeroStateComponent:null==h?void 0:h.zeroStateComponent,usePlaceHolderName:null==h?void 0:h.usePlaceHolderName,carouselCardIndex:w,isWhatsappCarousel:f,isPreview:x})]})):e(l,{})},c={WhatsAppWrapper:{backgroundColor:o.surface.standard,borderRadius:4,border:`1px solid ${o.background.inactive}`,marginTop:16}};export{m as TemplatePreview};
@@ -1,7 +1,7 @@
1
- import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,FooterText as j,TimeStamp as v}from"./ChatUI.style.js";import{MediaCard as w}from"./MediaCard.js";import b from"./RenderTemplateWithVariable.js";const u=n.div`
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,TimeStamp as j}from"./ChatUI.style.js";import{MediaCard as v}from"./MediaCard.js";import w from"./RenderTemplateWithVariable.js";const b=n.div`
2
2
  position: absolute;
3
3
  width: 8px;
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `,S=n=>{const{bodyText:S,footerText:N,headerMediaType:A,headerText:M,headerAssetLink:C,headerAssetName:L,quickReplybtn:k,ctaBtn:z,actionTypes:B,textType:E,extras:I,showHeader:P,imagePreviewStyles:R,size:W,children:H,isPreview:O}=n,_=new c,U=a((()=>({color:l.content.primary,margin:12,fontSize:P?h.caption.fontSize:h.bodySecondary.fontSize,fontWeight:h.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e(x,Object.assign({isPreview:O},{children:[t(u,{children:t(o,{color:"white",height:8,width:8})}),A===f.TEXT?t(b,{bold:!0,text:M}):A!==f.NONE?t(w,{headerAssetLink:C,headerAssetName:L,mediaType:A,imagePreviewStyles:A===f.IMAGE?R:{}}):t(r,{}),!!S&&t(r,{children:t(r,H?{children:H}:{children:"html"===E?t("div",{className:"richTextEditor",style:U,dangerouslySetInnerHTML:{__html:_.convertToHTML(S)}}):t(p,{children:S})})}),e(g,{children:[t(m,Object.assign({body:null!=N?N:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:N}))})),t(v,{children:"16:48"})]}),B===y.QUICK_REPLY?t("div",{children:null==k?void 0:k.map(((e,r)=>t(T,{text:e.text},r)))}):B===y.CTA_BTN?t("div",{children:null==z?void 0:z.map(((e,r)=>t(T,{textTypography:P?d:p,extraContent:I?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?i:s,size:W},r)))}):t(r,{})]}))};export{S as default};
7
+ `,u=n=>{const{bodyText:u,footerText:S,headerMediaType:N,headerText:A,headerAssetLink:M,headerAssetName:C,quickReplybtn:L,ctaBtn:k,actionTypes:z,textType:B,extras:E,showHeader:I,imagePreviewStyles:P,size:R,children:W,isPreview:H}=n,O=new c,_=a((()=>({color:l.content.primary,margin:12,fontSize:I?h.caption.fontSize:h.bodySecondary.fontSize,fontWeight:h.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e(x,Object.assign({isPreview:H},{children:[t(b,{children:t(o,{color:"white",height:8,width:8})}),N===f.TEXT?t(w,{bold:!0,text:A}):N!==f.NONE?t(v,{headerAssetLink:M,headerAssetName:C,mediaType:N,imagePreviewStyles:N===f.IMAGE?P:{}}):t(r,{}),!!u&&t(r,{children:t(r,W?{children:W}:{children:"html"===B?t("div",{className:"richTextEditor",style:_,dangerouslySetInnerHTML:{__html:O.convertToHTML(u)}}):t(p,{children:u})})}),e(g,{children:[t(m,Object.assign({body:null!=S?S:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:S}))})),t(j,{children:"16:48"})]}),z===y.QUICK_REPLY?t("div",{children:null==L?void 0:L.map(((e,r)=>t(T,{text:e.text},r)))}):z===y.CTA_BTN?t("div",{children:null==k?void 0:k.map(((e,r)=>t(T,{textTypography:I?d:p,extraContent:E?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?i:s,size:R},r)))}):t(r,{})]}))};export{u as default};
@@ -1,7 +1,6 @@
1
1
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
2
2
  isCarouselCard?: boolean | undefined;
3
3
  showBorder?: boolean | undefined;
4
- showDashedBorder?: boolean | undefined;
5
4
  isWhatsappCarousel?: boolean | undefined;
6
5
  hasError?: boolean | undefined;
7
6
  isPreview?: boolean | undefined;
@@ -10,10 +9,6 @@ export declare const TimeStamp: import("styled-components").StyledComponent<"div
10
9
  numberOfLines?: number | undefined;
11
10
  color?: string | undefined;
12
11
  }, never>;
13
- export declare const FooterText: import("styled-components").StyledComponent<"div", any, {
14
- numberOfLines?: number | undefined;
15
- color?: string | undefined;
16
- }, never>;
17
12
  export declare const MediaContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
18
13
  export declare const ChatBtnContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
19
14
  export declare const FooterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,33 +1,27 @@
1
- import r from"styled-components";import{Caption as e}from"../../TypographyStyle.js";import{COLORS as o}from"../../../constants/Theme.js";const t=r.div`
2
- background: ${o.surface.standard};
3
- border-top-left-radius: ${r=>r.isCarouselCard?"12px":"0px"};
1
+ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.js";import{COLORS as t}from"../../../constants/Theme.js";const o=e.div`
2
+ background: ${t.surface.standard};
3
+ box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.12);
4
+ border-top-left-radius: ${e=>e.isCarouselCard?"12px":"0px"};
4
5
  border-top-right-radius: 12px;
5
6
  border-bottom-right-radius: 12px;
6
7
  border-bottom-left-radius: 12px;
7
8
  position: relative;
8
9
  padding: 8px 0px;
9
10
  border: 2px solid
10
- ${r=>r.hasError?`${o.content.negative}`:r.showBorder?`${o.stroke.brand}`:`${o.stroke.primary}`};
11
- border: ${r=>r.showDashedBorder&&`2px dashed ${o.content.brand}`};
12
- height: 100%;
13
- display: flex;
14
- flex-direction: column;
11
+ ${e=>e.hasError?`${t.content.negative}`:e.showBorder?`${t.stroke.brand}`:`${t.text.white}`};
15
12
  :hover {
16
13
  border: 2px
17
- ${r=>r.isPreview?"unset":r.isWhatsappCarousel?r.hasError?"dashed":r.showBorder?"solid":"dashed":"solid"}
18
- ${o.stroke.brand};
19
- box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.25);
14
+ ${e=>e.isPreview?"unset":e.isWhatsappCarousel?e.hasError?"dashed":e.showBorder?"solid":"dashed":"solid"}
15
+ ${t.stroke.brand};
20
16
  }
21
- `,i=r(e)`
22
- color: ${o.content.secondary};
17
+ `,i=e(r)`
18
+ color: ${t.content.secondary};
23
19
  max-width: 80px;
24
20
  text-overflow: ellipsis;
25
21
  white-space: nowrap;
26
22
  overflow: hidden;
27
23
  text-wrap: wrap;
28
- `,d=r(i)`
29
- max-width: 200px;
30
- `,s=r.div`
24
+ `,d=e.div`
31
25
  border-radius: 8px;
32
26
  display: flex;
33
27
  flex-direction: column;
@@ -36,19 +30,19 @@ import r from"styled-components";import{Caption as e}from"../../TypographyStyle.
36
30
  min-height: 152px;
37
31
  margin-bottom: 4px;
38
32
  margin: 0px 8px;
39
- `,p=r.div`
33
+ `,s=e.div`
40
34
  padding: 12px;
41
35
  display: flex;
42
36
  flex-direction: row;
43
37
  justify-content: center;
44
38
  align-items: center;
45
- border-top: 1px solid ${o.stroke.primary};
46
- `,a=r.div`
39
+ border-top: 1px solid ${t.stroke.primary};
40
+ `,p=e.div`
47
41
  display: flex;
48
42
  flex-direction: row;
49
43
  justify-content: space-between;
50
44
  margin: 8px 12px;
51
- `;r.div`
45
+ `;e.div`
52
46
  position: absolute;
53
47
  bottom: -1px;
54
48
  left: 0;
@@ -59,11 +53,11 @@ import r from"styled-components";import{Caption as e}from"../../TypographyStyle.
59
53
  display: flex;
60
54
  flex-direction: row;
61
55
  justify-content: start;
62
- background: ${o.surface.hovered};
56
+ background: ${t.surface.hovered};
63
57
  border-bottom-right-radius: 8px;
64
58
  border-bottom-left-radius: 8px;
65
- `,r.div`
59
+ `,e.div`
66
60
  position: absolute;
67
61
  top: 16px;
68
62
  right: 16px;
69
- `;export{p as ChatBtnContainer,t as Container,d as FooterText,a as FooterWrapper,s as MediaContainer,i as TimeStamp};
63
+ `;export{s as ChatBtnContainer,o as Container,p as FooterWrapper,d as MediaContainer,i as TimeStamp};
@@ -1,19 +1,19 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import l from"../../../assets/icons/RedirectToNew.svg.js";import n from"styled-components";import{useTemplateModalContext as d}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{Caption as p,BodySecondary as h}from"../../TypographyStyle.js";import{COLORS as c}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as u}from"../models/TemplateMeta.js";import{ChatBtn as y}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,FooterText as C,TimeStamp as j}from"./ChatUI.style.js";import{LimitedTimeOffer as v}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as w}from"./MediaCard.js";const b=n.div`
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as u}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,TimeStamp as C}from"./ChatUI.style.js";import{LimitedTimeOffer as j}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as v}from"./MediaCard.js";const b=l.div`
2
2
  position: absolute;
3
3
  width: 8px;
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `,I=n.div`
7
+ `,w=l.div`
8
8
  font-family: 'Inter';
9
9
  font-style: normal;
10
10
  font-weight: 400;
11
11
  font-size: 14px;
12
12
  line-height: 20px;
13
13
  padding: 8px 12px 0px;
14
- color: ${c.content.primary};
14
+ color: ${h.content.primary};
15
15
  word-wrap: break-word;
16
- `,O=n(I)`
16
+ `,I=l(w)`
17
17
  font-weight: 600;
18
18
  margin-bottom: 8px;
19
- `,E=new f,L=n=>{const{bodyText:c,footerText:f,headerMediaType:L,headerText:P,headerAssetLink:_,headerAssetName:N,quickReplybtn:M,ctaBtn:R,actionTypes:A,extras:B,showHeader:H,imagePreviewStyles:S,size:U,bodyVariableList:k,headerVariableList:z,buttons:Y,limitedTimeOfferComponent:D,carouselCardIndex:V,isWhatsappCarousel:q,isPreview:K}=n,Q=E.format(c,k),W=E.format(P,z),{selectedCarouselIndex:G,isProductCarouselType:X,errorIndexes:$,isCarouselHovered:F}=d(),J={COPY_CODE:r,PHONE_NUMBER:s,URL:l,QUICK_REPLY:a};return e(T,Object.assign({isCarouselCard:null!=V&&V>-1,showBorder:null!=V&&V===G||X&&null!=V&&V>-1&&null!=G&&G>-1,hasError:null==$?void 0:$.includes(null!=V?V:-2),isWhatsappCarousel:q,isPreview:K,showDashedBorder:X&&F&&(null!=G?G:-1)<0&&(null!=V?V:-1)>-1},{children:[!q&&t(b,{children:t(i,{color:"white",height:8,width:8})}),L===x.TEXT?t(O,{dangerouslySetInnerHTML:{__html:W}}):L!==x.NONE?t(w,{headerAssetLink:_,headerAssetName:N,mediaType:L,imagePreviewStyles:L===x.IMAGE?S:{}}):t(o,{}),(null==D?void 0:D.dateTime)?t(v,{text:D.text,dateTime:D.dateTime,code:D.code}):t(o,{}),!!c&&t(o,{children:t(I,{dangerouslySetInnerHTML:{__html:Q},style:{flex:1}})}),e(g,{children:[t(m,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(C,Object.assign({style:{flex:1}},{children:f}))})),t(j,{children:"16:48"})]}),Y&&Y.length>0?Y.map(((e,o)=>t(y,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:J[e.type],size:U},o))):A===u.QUICK_REPLY?t("div",{children:null==M?void 0:M.map(((e,o)=>t(y,{text:e.text},o)))}):A===u.CTA_BTN?t("div",{children:null==R?void 0:R.map(((e,o)=>t(y,{textTypography:H?p:h,extraContent:B?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:l,size:U},o)))}):t(o,{})]}))};export{L as ChatUIV2};
19
+ `,O=new f,E=l=>{const{bodyText:h,footerText:f,headerMediaType:E,headerText:L,headerAssetLink:P,headerAssetName:_,quickReplybtn:N,ctaBtn:M,actionTypes:R,extras:A,showHeader:B,imagePreviewStyles:H,size:S,bodyVariableList:U,headerVariableList:k,buttons:z,limitedTimeOfferComponent:Y,carouselCardIndex:V,isWhatsappCarousel:q,isPreview:D}=l,K=O.format(h,U),Q=O.format(L,k),{selectedCarouselIndex:W,isProductCarouselType:G,errorIndexes:X}=m(),$={COPY_CODE:r,PHONE_NUMBER:s,URL:n,QUICK_REPLY:a};return e(T,Object.assign({isCarouselCard:null!=V&&V>-1,showBorder:null!=V&&V===W||G&&null!=V&&V>-1&&null!=W&&W>-1,hasError:null==X?void 0:X.includes(null!=V?V:-2),isWhatsappCarousel:q,isPreview:D},{children:[!q&&t(b,{children:t(i,{color:"white",height:8,width:8})}),E===x.TEXT?t(I,{dangerouslySetInnerHTML:{__html:Q}}):E!==x.NONE?t(v,{headerAssetLink:P,headerAssetName:_,mediaType:E,imagePreviewStyles:E===x.IMAGE?H:{}}):t(o,{}),(null==Y?void 0:Y.dateTime)?t(j,{text:Y.text,dateTime:Y.dateTime,code:Y.code}):t(o,{}),!!h&&t(o,{children:t(w,{dangerouslySetInnerHTML:{__html:K}})}),e(g,{children:[t(p,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(C,Object.assign({style:{flex:1}},{children:f}))})),t(C,{children:"16:48"})]}),z&&z.length>0?z.map(((e,o)=>t(u,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:$[e.type],size:S},o))):R===y.QUICK_REPLY?t("div",{children:null==N?void 0:N.map(((e,o)=>t(u,{text:e.text},o)))}):R===y.CTA_BTN?t("div",{children:null==M?void 0:M.map(((e,o)=>t(u,{textTypography:B?d:c,extraContent:A?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:n,size:S},o)))}):t(o,{})]}))};export{E as ChatUIV2};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as s,jsxs as r}from"react/jsx-runtime";import t from"../../../assets/icons/filePdf.svg.js";import i from"../../../assets/icons/image.svg.js";import o from"../../../assets/icons/videoRecorder.svg.js";import{BodySecondary as m}from"../../TypographyStyle.js";import{COLORS as a}from"../../../constants/Theme.js";import{HEADER_TYPES as n}from"../models/TemplateMeta.js";import{MediaContainer as d}from"./ChatUI.style.js";import{ShimmerImage as c}from"../../shimmer-image/ShimmerImage.js";const h=s=>{let{headerAssetName:c,mediaType:h}=s;const l=h===n.IMAGE?i:h===n.VIDEO?o:t;return r(d,{children:[e(l,{height:40,width:40,color:a.icon.placeholder}),!!c&&e(m,Object.assign({style:{color:a.content.secondary,marginTop:8}},{children:c}))]})},l=r=>{let{headerAssetLink:t,headerAssetName:i,mediaType:o,imagePreviewStyles:m}=r;if(!t||o===n.DOCUMENT)return e(h,Object.assign({},{headerAssetLink:t,headerAssetName:i,mediaType:o}));return e(d,{children:o===n.IMAGE?e(c,{imageUrl:t,alt:t,width:"100%",height:240,borderRadius:8}):o===n.VIDEO?e("video",Object.assign({src:t,style:{width:"100%",minHeight:"240px",height:"240px",borderRadius:8},controls:!0,muted:!0},{children:e("track",{default:!0,kind:"captions",srcLang:"en",src:t})})):e(s,{})})};export{l as MediaCard,h as NoMediaCard};
1
+ import{jsx as e,Fragment as s,jsxs as r}from"react/jsx-runtime";import t from"../../../assets/icons/filePdf.svg.js";import i from"../../../assets/icons/image.svg.js";import o from"../../../assets/icons/videoRecorder.svg.js";import{BodySecondary as m}from"../../TypographyStyle.js";import{COLORS as a}from"../../../constants/Theme.js";import{HEADER_TYPES as n}from"../models/TemplateMeta.js";import{MediaContainer as d}from"./ChatUI.style.js";import{ShimmerImage as c}from"../../shimmer-image/ShimmerImage.js";const h=s=>{let{headerAssetName:c,mediaType:h}=s;const l=h===n.IMAGE?i:h===n.VIDEO?o:t;return r(d,{children:[e(l,{height:40,width:40,color:a.icon.placeholder}),!!c&&e(m,Object.assign({style:{color:a.content.secondary,marginTop:8}},{children:c}))]})},l=r=>{let{headerAssetLink:t,headerAssetName:i,mediaType:o,imagePreviewStyles:m}=r;if(!t||o===n.DOCUMENT)return e(h,Object.assign({},{headerAssetLink:t,headerAssetName:i,mediaType:o}));return e(d,{children:o===n.IMAGE?e(c,{imageUrl:t,alt:t,width:"100%",height:240,borderRadius:8}):o===n.VIDEO?e("video",Object.assign({src:t,style:{width:"100%",minHeight:"240px",height:"240px",borderRadius:8},controls:!0},{children:e("track",{default:!0,kind:"captions",srcLang:"en",src:t})})):e(s,{})})};export{l as MediaCard,h as NoMediaCard};
@@ -1,11 +1,10 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import o from"styled-components";import{useTemplateModalContext as s}from"../../template-context-mapper/context/templateModalContext.js";import{BACKGROUND_PREVIEW_IMAGE as a}from"../../template-context-mapper/utils/constants.js";import{TitleRegular as i}from"../../TypographyStyle.js";import{COLORS as p}from"../../../constants/Theme.js";import{getPreviewPropLen as n}from"../utils/getPreviewPropLen.js";import m from"./ChatHeader.js";import{ChatUIV2 as c}from"./ChatUiV2.js";const h=o.div`
2
- background-image: ${e=>e.isWhatsappCarousel?"none":`url(${a})`};
1
+ import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import r from"styled-components";import{useTemplateModalContext as a}from"../../template-context-mapper/context/templateModalContext.js";import{TitleRegular as s}from"../../TypographyStyle.js";import{COLORS as i}from"../../../constants/Theme.js";import{getPreviewPropLen as p}from"../utils/getPreviewPropLen.js";import n from"./ChatHeader.js";import{ChatUIV2 as d}from"./ChatUiV2.js";const m=r.div`
2
+ background-image: ${e=>e.isWhatsappCarousel?"none":"url('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')"};
3
3
  border-radius: 4px;
4
4
  background-repeat: no-repeat;
5
5
  background-position: center;
6
6
  background-size: cover;
7
7
  position: relative;
8
- height: ${e=>e.isWhatsappCarousel?"100%":"auto"};
9
- `,l=o(i)`
10
- color: ${p.content.primary};
11
- `,d=o=>{const{hideDeviceContainerInPreview:a}=s();return 3===n(o)?e(t,{children:o.zeroStateComponent}):a?e(c,Object.assign({showHeader:o.showHeader},o)):e(t,{children:r(h,Object.assign({style:o.containerStyle,showHeader:o.showHeader,isWhatsappCarousel:o.isWhatsappCarousel},{children:[o.showHeader&&e(m,{}),r("div",Object.assign({style:{padding:"small"===o.size?"12px 32px 12px 12px":`16px ${o.isWhatsappCarousel?"0px":"56px"} ${o.isWhatsappCarousel?"2px":"16px"} 16px`,height:o.isWhatsappCarousel?"100%":"auto"}},{children:[!o.hidePreviewText&&e("div",Object.assign({style:{marginBottom:16}},{children:e(l,{children:"Preview"})})),e(c,Object.assign({showHeader:o.showHeader},o))]}))]}))})};export{d as WhatsappLikePreviewV2};
8
+ `,c=r(s)`
9
+ color: ${i.content.primary};
10
+ `,l=r=>{const{hideDeviceContainerInPreview:s}=a();return 3===p(r)?e(o,{children:r.zeroStateComponent}):s?e(d,Object.assign({showHeader:r.showHeader},r)):e(o,{children:t(m,Object.assign({style:r.containerStyle,showHeader:r.showHeader,isWhatsappCarousel:r.isWhatsappCarousel},{children:[r.showHeader&&e(n,{}),t("div",Object.assign({style:{padding:"small"===r.size?"12px 32px 12px 12px":`16px ${r.isWhatsappCarousel?"0px":"56px"} ${r.isWhatsappCarousel?"2px":"16px"} 16px`}},{children:[!r.hidePreviewText&&e("div",Object.assign({style:{marginBottom:16}},{children:e(c,{children:"Preview"})})),e(d,Object.assign({showHeader:r.showHeader},r))]}))]}))})};export{l as WhatsappLikePreviewV2};