@bikdotai/bik-component-library 0.0.533-beta.119 → 0.0.533-beta.13

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 (191) hide show
  1. package/dist/cjs/assets/icons/sub_category.svg.js +1 -0
  2. package/dist/cjs/components/TypographyStyle.d.ts +0 -17
  3. package/dist/cjs/components/TypographyStyle.js +19 -82
  4. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  5. package/dist/cjs/components/button/Button.js +1 -1
  6. package/dist/cjs/components/button/model.d.ts +1 -1
  7. package/dist/cjs/components/button/themes.d.ts +2 -2
  8. package/dist/cjs/components/button/themes.js +1 -1
  9. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
  10. package/dist/cjs/components/floater/floater.d.ts +1 -2
  11. package/dist/cjs/components/floater/floater.js +1 -1
  12. package/dist/cjs/components/icon-button/IconButton.styled.js +1 -1
  13. package/dist/cjs/components/icon-button/model.d.ts +1 -1
  14. package/dist/cjs/components/icon-button/theme.js +1 -1
  15. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +6 -2
  16. package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -2
  17. package/dist/cjs/components/input-with-vars/customPortal.d.ts +8 -0
  18. package/dist/cjs/components/input-with-vars/customPortal.js +1 -0
  19. package/dist/cjs/components/list-item/ListItem.d.ts +2 -1
  20. package/dist/cjs/components/list-item/ListItem.js +1 -1
  21. package/dist/cjs/components/list-item/themes.js +1 -1
  22. package/dist/cjs/components/progress-bar/ProgressBarComponent.js +1 -1
  23. package/dist/cjs/components/side-modal/SideModal.d.ts +1 -3
  24. package/dist/cjs/components/side-modal/SideModal.js +1 -1
  25. package/dist/cjs/components/side-modal/SideModal.style.d.ts +1 -4
  26. package/dist/cjs/components/side-modal/SideModal.style.js +7 -13
  27. package/dist/cjs/components/tag/Tag.js +1 -1
  28. package/dist/cjs/components/tag/Tag.styled.js +1 -1
  29. package/dist/cjs/components/tag/model.d.ts +1 -11
  30. package/dist/cjs/components/tag/model.js +1 -1
  31. package/dist/cjs/components/tag/themes.d.ts +1 -1
  32. package/dist/cjs/components/tag/themes.js +1 -1
  33. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
  34. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  35. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +17 -0
  36. package/dist/cjs/components/template-context-mapper/context/templateModalContext.js +1 -1
  37. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +1 -1
  38. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
  39. package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +1 -1
  40. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +11 -11
  41. package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +1 -1
  42. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +0 -2
  43. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  44. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  45. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.d.ts +1 -2
  46. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  47. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -2
  48. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  49. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
  50. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -2
  51. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  52. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -2
  53. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
  54. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +1 -3
  55. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  56. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.d.ts +1 -3
  57. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
  58. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +1 -3
  59. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  60. package/dist/cjs/components/template-preview/helpers/VariableEditorHelper.js +1 -1
  61. package/dist/cjs/components/variable-picker-v3/Content.d.ts +6 -0
  62. package/dist/cjs/components/variable-picker-v3/Content.js +1 -0
  63. package/dist/cjs/components/variable-picker-v3/NoResult.d.ts +6 -0
  64. package/dist/cjs/components/variable-picker-v3/NoResult.js +17 -0
  65. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.d.ts +14 -0
  66. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -0
  67. package/dist/cjs/components/variable-picker-v3/VariablePicker.d.ts +5 -0
  68. package/dist/cjs/components/variable-picker-v3/VariablePicker.js +1 -0
  69. package/dist/cjs/components/variable-picker-v3/context.d.ts +21 -0
  70. package/dist/cjs/components/variable-picker-v3/context.js +1 -0
  71. package/dist/cjs/components/variable-picker-v3/index.d.ts +1 -0
  72. package/dist/cjs/components/variable-picker-v3/model.d.ts +57 -0
  73. package/dist/cjs/components/variable-picker-v3/model.js +1 -0
  74. package/dist/cjs/components/variable-picker-v3/recommendVaribles.d.ts +1 -0
  75. package/dist/cjs/components/variable-picker-v3/recommendVaribles.js +1 -0
  76. package/dist/cjs/components/variable-picker-v3/searchVariables.d.ts +2 -0
  77. package/dist/cjs/components/variable-picker-v3/searchVariables.js +1 -0
  78. package/dist/cjs/components/variable-picker-v3/styles.d.ts +6 -0
  79. package/dist/cjs/components/variable-picker-v3/styles.js +42 -0
  80. package/dist/cjs/helpers/index.d.ts +1 -0
  81. package/dist/cjs/hooks/useOutside.js +1 -1
  82. package/dist/cjs/index.d.ts +1 -1
  83. package/dist/cjs/index.js +1 -1
  84. package/dist/esm/assets/icons/sub_category.svg.js +1 -0
  85. package/dist/esm/components/TypographyStyle.d.ts +0 -17
  86. package/dist/esm/components/TypographyStyle.js +21 -84
  87. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  88. package/dist/esm/components/button/Button.js +1 -1
  89. package/dist/esm/components/button/model.d.ts +1 -1
  90. package/dist/esm/components/button/themes.d.ts +2 -2
  91. package/dist/esm/components/button/themes.js +1 -1
  92. package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
  93. package/dist/esm/components/floater/floater.d.ts +1 -2
  94. package/dist/esm/components/floater/floater.js +1 -1
  95. package/dist/esm/components/icon-button/IconButton.styled.js +1 -1
  96. package/dist/esm/components/icon-button/model.d.ts +1 -1
  97. package/dist/esm/components/icon-button/theme.js +1 -1
  98. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +6 -2
  99. package/dist/esm/components/input-with-vars/InputWithVariables.js +3 -3
  100. package/dist/esm/components/input-with-vars/customPortal.d.ts +8 -0
  101. package/dist/esm/components/input-with-vars/customPortal.js +1 -0
  102. package/dist/esm/components/list-item/ListItem.d.ts +2 -1
  103. package/dist/esm/components/list-item/ListItem.js +1 -1
  104. package/dist/esm/components/list-item/themes.js +1 -1
  105. package/dist/esm/components/progress-bar/ProgressBarComponent.js +1 -1
  106. package/dist/esm/components/side-modal/SideModal.d.ts +1 -3
  107. package/dist/esm/components/side-modal/SideModal.js +1 -1
  108. package/dist/esm/components/side-modal/SideModal.style.d.ts +1 -4
  109. package/dist/esm/components/side-modal/SideModal.style.js +0 -6
  110. package/dist/esm/components/tag/Tag.js +1 -1
  111. package/dist/esm/components/tag/Tag.styled.js +1 -1
  112. package/dist/esm/components/tag/model.d.ts +1 -11
  113. package/dist/esm/components/tag/model.js +1 -1
  114. package/dist/esm/components/tag/themes.d.ts +1 -1
  115. package/dist/esm/components/tag/themes.js +1 -1
  116. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
  117. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  118. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +17 -0
  119. package/dist/esm/components/template-context-mapper/context/templateModalContext.js +1 -1
  120. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.d.ts +1 -1
  121. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
  122. package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +1 -1
  123. package/dist/esm/components/template-context-mapper/modalElements/Body.js +11 -11
  124. package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +2 -2
  125. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +0 -2
  126. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  127. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  128. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.d.ts +1 -2
  129. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  130. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -2
  131. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  132. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
  133. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -2
  134. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  135. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -2
  136. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
  137. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +1 -3
  138. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  139. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.d.ts +1 -3
  140. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -3
  141. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.d.ts +1 -3
  142. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  143. package/dist/esm/components/template-preview/helpers/VariableEditorHelper.js +1 -1
  144. package/dist/esm/components/variable-picker-v3/Content.d.ts +6 -0
  145. package/dist/esm/components/variable-picker-v3/Content.js +1 -0
  146. package/dist/esm/components/variable-picker-v3/NoResult.d.ts +6 -0
  147. package/dist/esm/components/variable-picker-v3/NoResult.js +17 -0
  148. package/dist/esm/components/variable-picker-v3/SubHeaderItems.d.ts +14 -0
  149. package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -0
  150. package/dist/esm/components/variable-picker-v3/VariablePicker.d.ts +5 -0
  151. package/dist/esm/components/variable-picker-v3/VariablePicker.js +1 -0
  152. package/dist/esm/components/variable-picker-v3/context.d.ts +21 -0
  153. package/dist/esm/components/variable-picker-v3/context.js +1 -0
  154. package/dist/esm/components/variable-picker-v3/index.d.ts +1 -0
  155. package/dist/esm/components/variable-picker-v3/model.d.ts +57 -0
  156. package/dist/esm/components/variable-picker-v3/model.js +1 -0
  157. package/dist/esm/components/variable-picker-v3/recommendVaribles.d.ts +1 -0
  158. package/dist/esm/components/variable-picker-v3/recommendVaribles.js +1 -0
  159. package/dist/esm/components/variable-picker-v3/searchVariables.d.ts +2 -0
  160. package/dist/esm/components/variable-picker-v3/searchVariables.js +1 -0
  161. package/dist/esm/components/variable-picker-v3/styles.d.ts +6 -0
  162. package/dist/esm/components/variable-picker-v3/styles.js +42 -0
  163. package/dist/esm/helpers/index.d.ts +1 -0
  164. package/dist/esm/hooks/useOutside.js +1 -1
  165. package/dist/esm/index.d.ts +1 -1
  166. package/dist/esm/index.js +1 -1
  167. package/package.json +1 -1
  168. package/dist/cjs/assets/icons/graph.svg.js +0 -1
  169. package/dist/cjs/assets/icons/sparkle.svg.js +0 -1
  170. package/dist/cjs/assets/icons/sync.svg.js +0 -1
  171. package/dist/cjs/components/ai-modals/ActivateBikAI.d.ts +0 -8
  172. package/dist/cjs/components/ai-modals/ActivateBikAI.js +0 -1
  173. package/dist/cjs/components/ai-modals/AiCreditsExhausted.d.ts +0 -8
  174. package/dist/cjs/components/ai-modals/AiCreditsExhausted.js +0 -1
  175. package/dist/cjs/components/ai-modals/AiCreditsLow.d.ts +0 -7
  176. package/dist/cjs/components/ai-modals/AiCreditsLow.js +0 -1
  177. package/dist/cjs/components/ai-modals/AiSyncProgress.d.ts +0 -8
  178. package/dist/cjs/components/ai-modals/AiSyncProgress.js +0 -1
  179. package/dist/cjs/components/ai-modals/index.d.ts +0 -4
  180. package/dist/esm/assets/icons/graph.svg.js +0 -1
  181. package/dist/esm/assets/icons/sparkle.svg.js +0 -1
  182. package/dist/esm/assets/icons/sync.svg.js +0 -1
  183. package/dist/esm/components/ai-modals/ActivateBikAI.d.ts +0 -8
  184. package/dist/esm/components/ai-modals/ActivateBikAI.js +0 -1
  185. package/dist/esm/components/ai-modals/AiCreditsExhausted.d.ts +0 -8
  186. package/dist/esm/components/ai-modals/AiCreditsExhausted.js +0 -1
  187. package/dist/esm/components/ai-modals/AiCreditsLow.d.ts +0 -7
  188. package/dist/esm/components/ai-modals/AiCreditsLow.js +0 -1
  189. package/dist/esm/components/ai-modals/AiSyncProgress.d.ts +0 -8
  190. package/dist/esm/components/ai-modals/AiSyncProgress.js +0 -1
  191. package/dist/esm/components/ai-modals/index.d.ts +0 -4
@@ -1,10 +1,10 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import a from"../../../assets/icons/edit.svg.js";import{format as n}from"date-fns";import{cloneDeep as i}from"lodash";import{useState as o,useEffect as s}from"react";import u from"styled-components";import{AddVariableV2SideModal as d}from"../../add-variableV2/AddVariableV2SideModal.js";import{CustomDateTime as c}from"../../custom-date-time/CustomDateTime.js";import{Dropdown as r}from"../../dropdown/Dropdown.js";import{Input as p}from"../../input/Input.js";import{truncate as m}from"../../product-picker-v2/collectionScreen.js";import{placeHolderNamePattern as v}from"../../template-preview/constants/regexPatterns.js";import{CHANNEL_TYPE as b}from"../../template-preview/models/Channels.js";import{POD as g}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as O,BodyPrimary as j}from"../../TypographyStyle.js";import h from"../../../utils/StringUtils.js";import{COLORS as x}from"../../../constants/Theme.js";import{useTemplateModalContext as y}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as f}from"../utils/getVariableNameEmail.js";const _=u.div`
1
+ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import a from"../../../assets/icons/edit.svg.js";import{format as i}from"date-fns";import{cloneDeep as n}from"lodash";import{useState as o,useEffect as s}from"react";import u from"styled-components";import{CustomDateTime as d}from"../../custom-date-time/CustomDateTime.js";import{Dropdown as c}from"../../dropdown/Dropdown.js";import{Input as r}from"../../input/Input.js";import{truncate as p}from"../../product-picker-v2/collectionScreen.js";import{placeHolderNamePattern as m}from"../../template-preview/constants/regexPatterns.js";import{CHANNEL_TYPE as v}from"../../template-preview/models/Channels.js";import{POD as b,BUTTON_TYPE as g}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as O,BodyPrimary as j}from"../../TypographyStyle.js";import y from"../../../utils/StringUtils.js";import{COLORS as h}from"../../../constants/Theme.js";import{useTemplateModalContext as x}from"../context/templateModalContext.js";import{updateVariables as f}from"../custom-hooks/useAdditionalVariables.js";import{getVariableNameForEmailByIndex as _}from"../utils/getVariableNameEmail.js";const T=u.div`
2
2
  /* surface/$color-background-warning-light */
3
3
 
4
- background: ${e=>e.focused&&e.channel===b.EMAIL?x.background.warning.light:"transparent"};
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
- `,T=u.div`
7
+ `,V=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
- `,E={value:"custom_link",label:"Custom URL"},k={value:"custom_text",label:"Custom text"},V={value:"static_expiry",label:"Static Expiry"},S=u=>{let{onFocus:S,variable:A,index:C,showVariableModal:B,variableList:P,setShowDiscountCheckBox:w,componentType:D,CTAoptions:N}=u;var L,U,H,R,M;const[W,I]=o(!1),[$,Y]=o(""),[z,Z]=o([]),[G,q]=o(),[F,K]=o(!1),[J,Q]=o(!1),{device:X,channel:ee,isError:te,originalVariableList:le,template:ae,templateSelectionTriggered:ne,setTemplate:ie,setDisplayContent:oe,setOriginalVariableList:se,globalNormalizedPlaceholders:ue,enabledCustomText:de,pod:ce,selectedCarouselIndex:re,isProductCarouselType:pe,disableEditVariable:me,disableEditExpiry:ve,templateErrorIndexes:be}=y();function ge(){var e,t;const l=[];let a=[];if(ee!==b.MESSAGE||de){"link"===(null==A?void 0:A.type)?(l.push({label:"",options:[E,k]}),q(E)):"date_time"===(null==A?void 0:A.type)?(l.push({label:"",options:[E,k]}),q(V)):(l.push({label:"",options:[E,k,V]}),q(k));const e=null!=ue?ue:[];Z([...l,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:h.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!=ue?ue:[];Z([{label:"",options:[k,E]},...e]),a=[{label:"",options:[k,E]},...e]}if((ee===b.WHATSAPP||ee===b.EMAIL||ee===b.MESSAGE)&&A.updatedValue)if(v.test(A.updatedValue)&&ee===b.WHATSAPP||A.updatedValue.startsWith("{{")&&ee!==b.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===b.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");if(B){let t=e.updatedValue;if(ce===g.CHATBOT&&"BUTTONS"===D){const l=null==N?void 0:N.filter((t=>t.placeHolder===e.updatedValue));l&&l.length>0&&(t=l[0].label)}n={label:t?t.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}}else t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(A,a,ee);e.value&&q(e)}else"date_time"===A.type?(q(V),Y(A.updatedValue),xe(null!==(e=A.index)&&void 0!==e?e:0,A.updatedValue)):(null===(t=A.updatedValue)||void 0===t?void 0:t.startsWith("https"))?(q(E),Y(A.updatedValue.split("https://")[1])):(q(k),Y(A.updatedValue))}function Oe(e,t){var l,a,n;const i=e;Y(""),q(i),ee===b.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value&&"static_expiry"!==i.value?(he(null!==(l=i.value)&&void 0!==l?l:"","string"),null==xe||xe(null!==(a=A.index)&&void 0!==a?a:0,i.value,!0)):(null==xe||xe(null!==(n=A.index)&&void 0!==n?n:0,"",!0,i.value),he("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?he(i.value,"url"===i.bikPlaceholderType?"link":"string"):(Y(""),he("",i.value))}function je(e,t){var l;Y(t);const a="custom_link"===(null==G?void 0:G.value)&&t?t.includes("https")?t:`https://${t}`:t;he(a,"static_expiry"===e?"string":e),ee===b.WHATSAPP&&(null==xe||xe(null!==(l=A.index)&&void 0!==l?l:0,a,"custom_link"===e,e))}function he(e,t){var l,a,n,o;const s="custom_link"===t?"link":"custom_text"===t?"string":t;if(ee!==b.WHATSAPP){const a=f(C+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===X?"template_html_mobile":"template_html_desktop"),i=ee===b.EMAIL?null===(l=null==n?void 0:n.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);i&&(i.textContent="custom_text"!==t&&"custom_link"!==t||e?e:A.variableName);const o=le.map(((t,l)=>l===C?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t));null==se||se(o)}if(ee===b.WHATSAPP){if(null!=re&&re>-1&&pe){const l=Object.assign({},le).cards.map(((l,a)=>{var n,i;return"BODY"===D?Object.assign(Object.assign({},l),{body:null===(n=l.body)||void 0===n?void 0:n.map(((t,l)=>C===l?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t))}):"BUTTONS"===D?Object.assign(Object.assign({},l),{buttons:null===(i=l.buttons)||void 0===i?void 0:i.map(((l,a)=>a===C?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))}):l}));return void(null==se||se((e=>Object.assign(Object.assign({},e),{cards:l}))))}const l=null!=re&&re>-1?le.cards[re]:le;let u=l.body,d=l.header,c=l.buttons;if("BODY"===D?u=null===(a=l.body)||void 0===a?void 0:a.map(((t,l)=>l===C?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"HEADER"===D?d=null===(n=l.header)||void 0===n?void 0:n.map(((t,l)=>l===C?Object.assign(Object.assign({},t),{type:s,updatedValue:e}):t)):"BUTTONS"===D&&(c=null===(o=l.buttons)||void 0===o?void 0:o.map(((l,a)=>a===C?Object.assign(Object.assign({},l),{buttonVariable:"custom_link"===t?"((customPlaceholderName))":e,example:"COPY_CODE"===l.type?e:[e]}):l))),null!=re&&re>-1){const e=i(le.cards);e[re]={header:d,body:u,buttons:c},null==se||se((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==se||se((e=>Object.assign(Object.assign({},e),{header:d,body:u,buttons:c})))}}function xe(e,t,l,a){var n,o,s,u,d,c,r;if(null!=re&&re>-1&&pe){const o=Object.assign({},ae).components.map((l=>{var a;return"CAROUSEL"===l.type?Object.assign(Object.assign({},l),{cards:null===(a=l.cards)||void 0===a?void 0:a.map((l=>Object.assign(Object.assign({},l),{components:l.components.map((l=>{var a,n,i,o,s,u;if("BODY"===l.type&&"BODY"===D){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const a=[...null!==(s=null===(o=null===(i=l.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];a[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const n=Object.assign(Object.assign({},l.example),{body_text:[a]});return Object.assign(Object.assign({},l),{example:n})}return l}if("BUTTONS"===l.type&&"BUTTONS"===D){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=i(ae);if(l){const l=null===(n=Object.assign({},ae).mapping.cards)||void 0===n?void 0:n.map(((l,n)=>{var i,o,s;if("BODY"===D)return Object.assign(Object.assign({},l),{body:null===(i=l.body)||void 0===i?void 0:i.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+10}))`:t:l))});if("BUTTONS"===D&&(null==l?void 0:l.buttons)){let i=-1,u=-1;return null===(o=ae.components[1].cards)||void 0===o||o[n].components.forEach((t=>{var l;"BUTTONS"===t.type&&(null===(l=t.buttons)||void 0===l||l.forEach(((t,l)=>{"URL"===t.type&&(i++,l===e&&"URL"==t.type&&(u=i))})))})),Object.assign(Object.assign({},l),{buttons:null===(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==ie||ie(s))}const p=null!=re&&re>-1?{components:null===(o=Object.assign({},ae).components[1].cards)||void 0===o?void 0:o[re].components,mapping:null===(s=Object.assign({},ae).mapping.cards)||void 0===s?void 0:s[re]}:Object.assign({},ae),m=null===(u=null==p?void 0:p.components)||void 0===u?void 0:u.map((l=>{var a,n,i,o,s,u,d,c,r;const p=Object.assign({},l);if("BODY"===l.type&&"BODY"===D){if(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0]){const l=[...null!==(s=null===(o=null===(i=p.example)||void 0===i?void 0:i.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"===D){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"===D){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"===D)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"===D&&(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,n)=>e===n?"custom_text"===a?`((editableVariable${n+10}))`:t:l))});else if("HEADER"===D&&(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,n)=>e===n?"custom_text"===a?`((editableVariable${n+20}))`:t:l))});else if("BUTTONS"===D&&(null===(r=null==p?void 0:p.mapping)||void 0===r?void 0:r.buttons)){let l=-1,n=-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&&(n=l))})))})),p.mapping=Object.assign(Object.assign({},p.mapping),{buttons:p.mapping.buttons.map(((e,l)=>l===n?"custom_link"===a?"((customPlaceholderName))":t:e))})}if(null!=re&&re>-1&&ae){const e=i(ae);e.components[1].cards[re].components=p.components,e.mapping.cards[re]=p.mapping,null==ie||ie(e)}else null==ie||ie(Object.assign({},p))}return s((()=>{W&&(null==S||S())}),[W]),s((()=>{!function(){var e,t,l,a,n;const i="mobile"===X?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),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===(n=null==o?void 0:o.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);ee===b.EMAIL&&(null==oe||oe(s))}()}),[ne]),s((()=>{ge()}),[]),s((()=>{ge()}),[re]),s((()=>{X&&G&&$&&setTimeout((()=>{he("custom_link"===(null==G?void 0:G.value)&&$?$.includes("https")?$:`https://${$}`:$,G.value)}),100)}),[X]),s((()=>{!J&&G&&A.updatedValue&&setTimeout((()=>{he("custom_link"===(null==G?void 0:G.value)&&A.updatedValue?A.updatedValue.includes("https")?A.updatedValue:`https://${A.updatedValue}`:A.updatedValue,G.value),Q(!0)}),100)}),[G]),e(_,Object.assign({channel:ee,focused:W,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1)},{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(O,Object.assign({style:{color:te&&!G?x.content.negative:x.content.primary}},{children:[null===(L=A.variableName)||void 0===L?void 0:L.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==G?void 0:G.label)?"space-between":"flex-end"}},{children:[t(j,Object.assign({numberOfLines:1},{children:ce===g.CHATBOT?["static_expiry","custom_text","custom_link"].includes(null!==(U=null==G?void 0:G.value)&&void 0!==U?U:"")?null==G?void 0:G.label:null==G?void 0:G.value:m(null!==(H=null==G?void 0:G.label)&&void 0!==H?H:"",20,!0)})),me||"date_time"===(null==A?void 0:A.type)&&ve?t(l,{}):t(a,{onClick:()=>{K(!F)},width:24,height:24,color:x.content.primary})]})):t(r,{disabled:me,options:z,isSearchable:!1,onSelect:Oe,defaultOptions:G?[Object.assign(Object.assign({},G),{selected:!0})]:[]})})),("custom_text"===(null==G?void 0:G.value)||"custom_link"===(null==G?void 0:G.value))&&t(p,{state:me?"disabled":"none",labelText:"custom_text"===(null==G?void 0:G.value)?"Custom text value":"custom_link"===(null==G?void 0:G.value)?"Custom URL value":"",id:`variable-value-${null==G?void 0:G.value}-${C}`,value:$,errorMessage:te&&(null===(R=null==be?void 0:be.buttons)||void 0===R?void 0:R.includes(null!==(M=null==A?void 0:A.index)&&void 0!==M?M:-1))?$&&0!==$.trim().length?"custom_link"!==G.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${$.trim()}`)&&0!==$.trim().length?"custom_link"!==G.value&&$.length>30?"Length cannot be more than 30":"BUTTONS"===D&&"custom_link"!==G.value?"Enter valid alpha numeric code":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==G?void 0:G.value)?2e3:"BUTTONS"===D?15:30,noKeyDownChange:!0,prefixText:"custom_link"===(null==G?void 0:G.value)?"https://":"",placeholder:"link"===A.type||"custom_link"===G.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{je(G.value,e)}}),"static_expiry"===(null==G?void 0:G.value)&&e("div",Object.assign({style:{position:"relative"}},{children:[me&&t(T,{onClick:e=>e.preventDefault()}),t(c,{placement:"auto",time:n($?new Date($):new Date,"hh:mm a"),date:$?new Date($):new Date,minDate:new Date,error:"",setError:()=>{},onChange:e=>{je("static_expiry",e.toISOString())}})]})),F&&t(d,{zIndex:2e3,data:null!=P?P:[],showVariable:F,setShowVariable:K,placeholder:"Add a variable",customTrigger:e=>{null==w||w(!1),"{{custom.url}}"===e.actualValue?Oe({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?Oe({label:e.displayName,selected:!0,value:"custom_text"}):"{{static.expiry}}"==e.actualValue?Oe({label:e.displayName,selected:!0,value:"static_expiry"}):Oe({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};export{_ as Container,S as default};
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};
@@ -1,4 +1,3 @@
1
- import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
2
1
  import { WhatsAppTemplate, WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
3
2
  export type ComponentType = WhatsAppTemplate['components'][0];
4
3
  export interface VariableConnectorWhatsAppProps {
@@ -6,7 +5,6 @@ export interface VariableConnectorWhatsAppProps {
6
5
  descriptionComponent: ComponentType;
7
6
  type: ComponentType['type'];
8
7
  showVariableModal?: boolean;
9
- variableList?: VariableListInterfaceV2[];
10
8
  }
11
- declare const VariableConnectorWhatsApp: ({ descriptionComponent, type, showVariableModal, variableList, }: VariableConnectorWhatsAppProps) => import("react/jsx-runtime").JSX.Element;
9
+ declare const VariableConnectorWhatsApp: ({ descriptionComponent, type, showVariableModal, }: VariableConnectorWhatsAppProps) => import("react/jsx-runtime").JSX.Element;
12
10
  export default VariableConnectorWhatsApp;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as i,Fragment as a}from"react/jsx-runtime";import{Input as t}from"../../input/Input.js";import{BodySecondary as l}from"../../TypographyStyle.js";import{COLORS as r}from"../../../constants/Theme.js";import{useTemplateModalContext as o}from"../context/templateModalContext.js";import{useAdditionalVariables as d}from"../custom-hooks/useAdditionalVariables.js";import n from"./VariableConnector.js";const s=s=>{let{descriptionComponent:p,type:m,showVariableModal:b,variableList:c}=s;var v,y,u,x,h,f;const{originalVariableList:V,disableEditVariable:g,selectedCarouselIndex:E}=o(),j=d({variableList:c,categoryDisplayName:"Static Variables",variableDisplayName:"Static Expiry",variableValue:"{{static.expiry}}"});return"BODY"===p.type?e("div",{children:null===(v=null!=E&&E>-1?V.cards[E].body:null==V?void 0:V.body)||void 0===v?void 0:v.map(((a,o)=>g||!a.isEditableVariable?i("div",Object.assign({style:{margin:"16px 8px"}},{children:[i(l,Object.assign({style:{color:r.content.primary}},{children:["HEADER"===m?"Header":""," Locked variable ",o+1]})),e(t,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),o):e(n,{index:o,variable:a,showVariableModal:b,variableList:c,componentType:p.type},`${o}-${a.index}`)))}):"HEADER"===p.type?e("div",{children:null===(y=null!=E&&E>-1?V.cards[E].header:null==V?void 0:V.header)||void 0===y?void 0:y.map(((a,o)=>a.isEditableVariable?e(n,{index:o,variable:a,showVariableModal:b,variableList:c,componentType:p.type},`${o}-${a.index}`):i("div",Object.assign({style:{margin:"16px 8px"}},{children:[i(l,Object.assign({style:{color:r.content.primary}},{children:["HEADER"===m?"Header":""," Locked variable ",o+1]})),e(t,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),o)))}):"limited_time_offer"===p.type?e("div",{children:e(n,{index:0,variable:{variableName:null!==(x=null===(u=null==p?void 0:p.limited_time_offer)||void 0===u?void 0:u.text)&&void 0!==x?x:"Expires after",updatedValue:null!==(f=null===(h=p.example)||void 0===h?void 0:h.limited_time_offer)&&void 0!==f?f:(new Date).toISOString(),type:"date_time",isEditableVariable:!0,index:0},showVariableModal:b,variableList:j,componentType:p.type},`${p.type}`)}):e(a,{})};export{s as default};
1
+ import{jsx as e,jsxs as i,Fragment as a}from"react/jsx-runtime";import{Input as l}from"../../input/Input.js";import{BodySecondary as t}from"../../TypographyStyle.js";import{COLORS as o}from"../../../constants/Theme.js";import{useTemplateModalContext as r}from"../context/templateModalContext.js";import d from"./VariableConnector.js";const n=n=>{let{descriptionComponent:p,type:s,showVariableModal:m}=n;var c,b,v,y,x,h;const{originalVariableList:u,disableEditVariable:f,selectedCarouselIndex:g}=r();return"BODY"===p.type?e("div",{children:null===(c=null!=g&&g>-1?u.cards[g].body:null==u?void 0:u.body)||void 0===c?void 0:c.map(((a,r)=>f||!a.isEditableVariable?i("div",Object.assign({style:{margin:"16px 8px"}},{children:[i(t,Object.assign({style:{color:o.content.primary}},{children:["HEADER"===s?"Header":""," Locked variable ",r+1]})),e(l,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),r):e(d,{index:r,variable:a,showVariableModal:m,componentType:p.type},`${r}-${a.index}`)))}):"HEADER"===p.type?e("div",{children:null===(b=null!=g&&g>-1?u.cards[g].header:null==u?void 0:u.header)||void 0===b?void 0:b.map(((a,r)=>a.isEditableVariable?e(d,{index:r,variable:a,showVariableModal:m,componentType:p.type},`${r}-${a.index}`):i("div",Object.assign({style:{margin:"16px 8px"}},{children:[i(t,Object.assign({style:{color:o.content.primary}},{children:["HEADER"===s?"Header":""," Locked variable ",r+1]})),e(l,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),r)))}):"limited_time_offer"===p.type?e("div",{children:e(d,{index:0,variable:{variableName:null!==(y=null===(v=null==p?void 0:p.limited_time_offer)||void 0===v?void 0:v.text)&&void 0!==y?y:"Expires after",updatedValue:null!==(h=null===(x=p.example)||void 0===x?void 0:x.limited_time_offer)&&void 0!==h?h:(new Date).toISOString(),type:"date_time",isEditableVariable:!0,index:0},showVariableModal:m,componentType:p.type},`${p.type}`)}):e(a,{})};export{n as default};
@@ -1,12 +1,10 @@
1
- import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
2
1
  export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
3
2
  export interface VariableConnectorsProps {
4
3
  onFocus?: (variableIndex: number) => void;
5
4
  showVariableModal?: boolean;
6
- variableList?: VariableListInterfaceV2[];
7
5
  discountCode?: string;
8
6
  setDiscountCode?: (code: string) => void;
9
7
  }
10
- declare const VariableConnectors: ({ onFocus, showVariableModal, variableList, discountCode, setDiscountCode, }: VariableConnectorsProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const VariableConnectors: ({ onFocus, showVariableModal, discountCode, setDiscountCode, }: VariableConnectorsProps) => import("react/jsx-runtime").JSX.Element;
11
9
  export default VariableConnectors;
12
10
  export declare const AddVariableStyled: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -1,8 +1,8 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"../../../assets/icons/info.svg.js";import{useState as a,useRef as o,useEffect as r}from"react";import l from"styled-components";import{AddVariableV2SideModal as n}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import s from"../../../assets/icons/plus.svg.js";import"../../add-variableV2/AddVariableV2.styled.js";import"../../button/Button.js";import"../../icon-button/IconButton.js";import{Input as d}from"../../input/Input.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{COLORS as p}from"../../../constants/Theme.js";import"../../modals/modal.styled.js";import"../../switch/Switch.js";import{TitleRegular as m,BodySecondary as h,TitleSmall as b}from"../../TypographyStyle.js";import{CheckBox as g}from"../../checkBox/CheckBox.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import f from"./VariableConnector.js";const v=l.div`
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"../../../assets/icons/info.svg.js";import{useState as a,useRef as o,useEffect as r}from"react";import n from"styled-components";import{CheckBox as l}from"../../checkBox/CheckBox.js";import{Input as s}from"../../input/Input.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{TitleRegular as d,BodySecondary as p,TitleSmall as h}from"../../TypographyStyle.js";import{COLORS as m}from"../../../constants/Theme.js";import g from"../../../assets/icons/plus.svg.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";import u from"./VariableConnector.js";const f=n.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  height: 100%;
5
- `,j=l=>{let{onFocus:j,showVariableModal:y,variableList:V,discountCode:w,setDiscountCode:O}=l;const{originalVariableList:k,disableEditVariable:C}=u(),[T,B]=a(!1),[E,L]=a(!1),[A,I]=a(!1),[S,M]=a(""),[D,F]=a(!1),N=o(),z=o();return r((()=>{O&&O(w+S)}),[S]),r((()=>{k.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(B(!0),w&&F&&F(!0))}))}),[k]),e(v,{children:[e("div",Object.assign({style:{padding:8}},{children:[e("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[i(m,Object.assign({style:{color:p.content.primary}},{children:"Edit variables and links"})),i(c,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:i("div",Object.assign({style:{display:"flex"}},{children:i(t,{width:20,height:20,color:p.content.placeholder})}))}))]})),i(h,Object.assign({style:{color:p.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==k?void 0:k.map(((t,a)=>!t.isEditableVariable||C?e("div",Object.assign({style:{margin:"16px 8px"}},{children:[e(h,Object.assign({style:{color:p.content.primary}},{children:["Locked variable ",a+1]})),i(d,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),a):i("div",Object.assign({style:{marginTop:16}},{children:i(f,{index:a,variable:t,onFocus:()=>null==j?void 0:j(a),showVariableModal:y,variableList:V,setShowDiscountCheckBox:B})}),a))),(T||w)&&e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[i(g,{isChecked:D,onValueChange:()=>{D&&O&&O(""),F(!D)}}),i(b,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),D&&e("div",Object.assign({ref:N,style:{margin:10}},{children:[i(d,{placeholder:"Enter your discount code",onChangeText:e=>{O&&O(e)},value:w,onFocus:()=>{L(!0)},onBlur:e=>{var i;"addVar"===(null===(i=e.relatedTarget)||void 0===i?void 0:i.id)?(N.current&&N.current.focus(),L(!0)):(L(!1),I(!1))},noErrorHint:!0,validate:e=>[!0,""]}),E&&i(x,Object.assign({ref:z,id:"addVar",onClick:e=>{e.stopPropagation(),I(!0)}},{children:e("div",Object.assign({className:"add"},{children:[i(s,{width:20,height:20,color:"white"}),i("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),A&&i(n,{zIndex:2e3,data:null!=V?V:[],showVariable:A,setShowVariable:I,variableValue:S,setVariableValue:M,placeholder:"Add a variable",customTrigger:e=>{M(e.actualValue),L(!1)}})]})},x=l.button`
5
+ `,x=n=>{let{onFocus:x,showVariableModal:v,discountCode:j,setDiscountCode:O}=n;const{originalVariableList:k,disableEditVariable:w,setVariableCallback:V,setShowVariablePicker:C}=b(),[T,E]=a(!1),[B,L]=a(!1),[D,F]=a(""),[I,M]=a(!1),N=o(),S=o();r((()=>{O&&O(j+D)}),[D]),r((()=>{k.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(E(!0),j&&M&&M(!0))}))}),[k]);const A=e=>{F(e.actualValue)};return e(f,{children:[e("div",Object.assign({style:{padding:8}},{children:[e("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[i(d,Object.assign({style:{color:m.content.primary}},{children:"Edit variables and links"})),i(c,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:i("div",Object.assign({style:{display:"flex"}},{children:i(t,{width:20,height:20,color:m.content.placeholder})}))}))]})),i(p,Object.assign({style:{color:m.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==k?void 0:k.map(((t,a)=>!t.isEditableVariable||w?e("div",Object.assign({style:{margin:"16px 8px"}},{children:[e(p,Object.assign({style:{color:m.content.primary}},{children:["Locked variable ",a+1]})),i(s,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),a):i("div",Object.assign({style:{marginTop:16}},{children:i(u,{index:a,variable:t,onFocus:()=>null==x?void 0:x(a),showVariableModal:v,setShowDiscountCheckBox:E})}),a))),(T||j)&&e("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[i(l,{isChecked:I,onValueChange:()=>{I&&O&&O(""),M(!I)}}),i(h,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),I&&e("div",Object.assign({ref:N,style:{margin:10}},{children:[i(s,{placeholder:"Enter your discount code",onChangeText:e=>{O&&O(e)},value:j,onFocus:()=>{L(!0)},onBlur:e=>{var i;"addVar"===(null===(i=e.relatedTarget)||void 0===i?void 0:i.id)?(N.current&&N.current.focus(),L(!0)):L(!1)},noErrorHint:!0,validate:e=>[!0,""]}),B&&i(y,Object.assign({ref:S,id:"addVar",onClick:e=>{e.stopPropagation(),V((()=>A)),C(!0)}},{children:e("div",Object.assign({className:"add"},{children:[i(g,{width:20,height:20,color:"white"}),i("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})},y=n.button`
6
6
  padding: 2px 8px;
7
7
  cursor: pointer;
8
8
  color: white;
@@ -25,4 +25,4 @@ import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"../../../assets/
25
25
  align-items: center;
26
26
  gap: 5px;
27
27
  }
28
- `;export{x as AddVariableStyled,v as Container,j as default};
28
+ `;export{y as AddVariableStyled,f as Container,x as default};
@@ -1,4 +1,3 @@
1
- import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
2
1
  import { ButtonPlaceHolderOptions } from "../../template-preview/models/TemplateMeta";
3
2
  import { CTABtnValType, QRBBtnValType, TEMPLATE_BUTTON } from "../../template-preview/models/WhatsAppTemplate";
4
3
  import { WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
@@ -11,8 +10,7 @@ export interface WhatsAppTemplateCardButtonV2Props {
11
10
  button: TEMPLATE_BUTTON;
12
11
  CTAoptions?: ButtonPlaceHolderOptions[];
13
12
  QRBoptions?: ButtonPlaceHolderOptions[];
14
- variableList?: VariableListInterfaceV2[];
15
13
  variableListIndex: number;
16
14
  }
17
- declare const WhatsAppTemplateCardButtonV2: ({ variableListIndex, button, updateSelectedURLTemplateBtn, updateSelectedQRBTemplateBtn, currentVariableList, CTAoptions, QRBoptions, variableList, }: WhatsAppTemplateCardButtonV2Props) => import("react/jsx-runtime").JSX.Element;
15
+ declare const WhatsAppTemplateCardButtonV2: ({ variableListIndex, button, updateSelectedURLTemplateBtn, updateSelectedQRBTemplateBtn, currentVariableList, CTAoptions, QRBoptions, }: WhatsAppTemplateCardButtonV2Props) => import("react/jsx-runtime").JSX.Element;
18
16
  export default WhatsAppTemplateCardButtonV2;
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import{cloneDeep as l}from"lodash";import{useState as a,useEffect as s}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 b}from"../../../constants/Theme.js";import{useTemplateModalContext as d}from"../context/templateModalContext.js";import{useAdditionalVariables as p}from"../custom-hooks/useAdditionalVariables.js";import{validateIsUrl as m}from"../utils/validateIsUrl.js";import j,{Container as f}from"./VariableConnector.js";const g=g=>{let{variableListIndex:v,button:O,updateSelectedURLTemplateBtn:x,updateSelectedQRBTemplateBtn:y,currentVariableList:L,CTAoptions:h,QRBoptions:R,variableList:U}=g;var V,C,T,w;const[I,N]=a(""),[E,H]=a(),P=p({variableList:U,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"}),{isError:B,disableEditVariable:Q,pod:_,selectedCarouselIndex:S,originalVariableList:A,setOriginalVariableList:K,isProductCarouselType:Y}=d();function $(t){if(N(t),null!=S&&S>-1&&Y){const e=l(A);if("URL"===O.type){const l=e.cards.map((e=>{let l=e.buttons.filter((t=>"URL"===t.type))[v];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const a=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:a})}));null==K||K((t=>Object.assign(Object.assign({},t),{cards:l}))),null==x||x(`https://${t}`,"custom",v)}return}let e=L.buttons.filter((t=>"URL"===t.type))[v];e=Object.assign(Object.assign({},e),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const a=L.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),s=Object.assign({},null!=S&&S>-1?A.cards[S]:A);if(s.buttons=a,null!=S&&S>-1){const t=[...A.cards];t[S]=s,null==K||K((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==K||K((t=>Object.assign(Object.assign({},t),{buttons:[...a]})));null==x||x(`https://${t}`,"custom",v)}return s((()=>{var t;if(O.buttonVariable&&i.test(O.buttonVariable))H(r),N((null===(t=O.example)||void 0===t?void 0:t[0].split("https://")[1])||"");else{let t=-1;const e="URL"===O.type?h:R;t="URL"===O.type?e.findIndex((t=>t.placeHolder===O.buttonVariable)):e.findIndex((t=>t.label===O.flowName)),t>-1&&H(e[t])}}),[]),_!==c.CHATBOT?t(f,{children:[e("div",Object.assign({style:{marginBottom:8}},{children:t(u,Object.assign({style:{color:b.content.primary}},{children:[O.text," button"]}))})),e("div",Object.assign({style:{marginBottom:12}},{children:e(n,{disabled:Q,options:"URL"===O.type?h:R,isSearchable:!0,onSelect:function(t,e){const a=t;H(a);const s=("URL"===O.type?h:R).find((t=>t.placeHolder===a.placeHolder));if(s)if("custom_link"!==s.value){if(null!=S&&S>-1&&Y){const t=l(A);if("URL"===O.type){const e=t.cards.map((t=>{let e=t.buttons.filter((t=>"URL"===t.type))[v];e=Object.assign(Object.assign({},e),{buttonVariable:a.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==x||x({defaultValue:s.value,placeHolder:s.placeHolder},"placeholder",v),null==K||K((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))[v];e=Object.assign(Object.assign({},e),{flowName:a.label,flowId:a.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==y||y({flowName:a.label,flowId:a.value},"placeholder",v),null==K||K((t=>Object.assign(Object.assign({},t),{cards:e})))}return}let t;if("URL"===O.type){let e=L.buttons.filter((t=>"URL"===t.type))[v];e=Object.assign(Object.assign({},e),{buttonVariable:a.placeHolder}),t=L.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==x||x({defaultValue:s.value,placeHolder:s.placeHolder},"placeholder",v)}else{let e=L.buttons.filter((t=>"QUICK_REPLY"===t.type))[v];e=Object.assign(Object.assign({},e),{flowName:a.label,flowId:a.value}),t=L.buttons.map((t=>"QUICK_REPLY"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==y||y({flowName:a.label,flowId:a.value},"placeholder",v)}const e=Object.assign({},null!=S&&S>-1?A.cards[S]:A);if(e.buttons=t,null!=S&&S>-1){const t=[...A.cards];t[S]=e,null==K||K((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==K||K((e=>Object.assign(Object.assign({},e),{buttons:[...t]})))}else $("")},defaultOptions:E?[Object.assign(Object.assign({},E),{selected:!0})]:[]})})),"custom_link"===(null==E?void 0:E.value)&&e("div",Object.assign({style:{marginBottom:20}},{children:e(o,{state:Q?"disabled":"none",errorMessage:B?I?m(I)?"":"Enter valid URL":"Required field":"",value:I,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:$,maxCharLimit:2e3})}))]}):e(j,{index:v,variable:{variableName:null!==(V=O.text)&&void 0!==V?V:"",updatedValue:"((customPlaceholderName))"===O.buttonVariable?`${null===(C=O.example)||void 0===C?void 0:C[0]}`:null!==(T=O.buttonVariable)&&void 0!==T?T:"",type:"link",isEditableVariable:!0,index:null!==(w=O.index)&&void 0!==w?w:0},showVariableModal:!0,componentType:"BUTTONS",variableList:P,CTAoptions:h})};export{g 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",buttonType:O.type,CTAoptions:h})};export{f as default};
@@ -1 +1 @@
1
- import{BaseWhatsappContentLangHelper as e}from"../../../helpers/BaseWhatsappContentLang.helper.js";import"../../curtain/CurtainHelper.js";import{variablePattern as r}from"../constants/regexPatterns.js";const l=new e;class a{format(e,a){var t;if(!e)return"";const n=new RegExp(r,"g"),p=e.match(n),o=null!==(t=null==a?void 0:a.map((e=>{let{placeholder:r}=e;return r})))&&void 0!==t?t:[],c=e.split(r).map(((e,r)=>{var l;const t=null==p?void 0:p[r];if(t){const r=t.replace("{{","").replace("}}","").replace("[[","").replace("]]","").replace("((","").replace("))",""),n=o.findIndex((e=>e.replace("{{","").replace("}}","").replace("[[","").replace("]]","").replace("((","").replace("))","")===r));return n>-1?e+'<code style="color: #731DCF">'+(null===(l=null==a?void 0:a[n])||void 0===l?void 0:l.value)+"</code>":e+t}return e})).join("");return l.getHTML(c)}}export{a as VariableEditorHelper};
1
+ import{BaseWhatsappContentLangHelper as e}from"../../../helpers/BaseWhatsappContentLang.helper.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import{variablePattern as r}from"../constants/regexPatterns.js";const l=new e;class a{format(e,a){var t;if(!e)return"";const p=new RegExp(r,"g"),n=e.match(p),o=null!==(t=null==a?void 0:a.map((e=>{let{placeholder:r}=e;return r})))&&void 0!==t?t:[],c=e.split(r).map(((e,r)=>{var l;const t=null==n?void 0:n[r];if(t){const r=t.replace("{{","").replace("}}","").replace("[[","").replace("]]","").replace("((","").replace("))",""),p=o.findIndex((e=>e.replace("{{","").replace("}}","").replace("[[","").replace("]]","").replace("((","").replace("))","")===r));return p>-1?e+'<code style="color: #731DCF">'+(null===(l=null==a?void 0:a[p])||void 0===l?void 0:l.value)+"</code>":e+t}return e})).join("");return l.getHTML(c)}}export{a as VariableEditorHelper};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { VariablePickerV3Props } from './model';
3
+ type Props = VariablePickerV3Props;
4
+ export declare const highlightSearchText: (text: string, searchText: string) => string | import("react/jsx-runtime").JSX.Element;
5
+ export declare const VariablePickerContent: React.FC<Props>;
6
+ export {};
@@ -0,0 +1 @@
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/arrow_back.svg.js";import l from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/plus.svg.js";import n from"../../assets/icons/triangle_error.svg.js";import{useState as r,useEffect as c}from"react";import{COLORS as d}from"../../constants/Theme.js";import{BikAccordion as h}from"../accordion/Accordion.js";import{IconButton as m}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{ListItem as g}from"../list-item/ListItem.js";import{Switch as b}from"../switch/Switch.js";import{Tooltip as u}from"../tooltips/Tooltip.js";import{TitleRegular as f,BodySecondary as y,BodyCaption as v,TitleSmall as j}from"../TypographyStyle.js";import{VariablePickerContext as x}from"./context.js";import O from"./NoResult.js";import{showOnlyRecommendedVariables as w}from"./recommendVaribles.js";import{searchVariables as k}from"./searchVariables.js";import{HeaderWrapper as C,RecommendWrapper as S,BackHeader as T,Container as N}from"./styles.js";import V,{renderTooltipBody as I}from"./SubHeaderItems.js";const B=(e,i)=>{if(0===i.length)return e;const o=e.toLowerCase().indexOf(i.toLowerCase());if(-1===o)return e;const l=e.slice(0,o),a=e.slice(o,o+i.length),n=e.slice(o+i.length);return s("span",{children:[l,t("b",Object.assign({style:{color:d.content.primary}},{children:a})),n]})},R=/.*\..*/,L=e=>{if(e.actualValue.match(R)){const t=e.actualValue.replace("{{","").replace("}}","").split(".");let s=t[0];return t.forEach(((e,t)=>{if(0===t)return;const i=(e=>/\w+\[\d+\]/g.test(e))(e);if(i){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const e=t[1],i=t[2];s+=`['${e}'][${i}]`}}else s+=`['${e}']`})),s}return e.actualValueEval?e.actualValueEval:e.actualValue},H=R=>{const{data:H,onSelect:$,showHeader:E,showBackButton:P,hideHeaderCross:_,onBackButtonClick:A,isEvaluationList:z,autoOpenFirst:D,headerText:F}=R,[K,q]=r(H),[G,J]=r(""),[M,Q]=r([]),[U,W]=r(""),[X,Y]=r(!1),[Z,ee]=r([]);c((()=>{te(!0)}),[]),c((()=>{M.length>0?ee([M[M.length-1]]):ee(H)}),[M]);const te=t=>e(void 0,void 0,void 0,(function*(){if(Y(t),t){const e=w(K,M);q(e)}else if(M.length>0){const e=U==M[M.length-1].displayName;if(G.length>0&&e){const e=k(G,Z,M);q(e)}else q([M[M.length-1].variables])}else if(G.length>0){const e=k(G,Z,M);q(e)}else q(H)})),se=()=>{let e=131;return M.length>0&&(e+=32),(R.showHeader||R.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return t(x.Provider,Object.assign({value:{variables:K,searchText:G,subHeaderStack:M,showRecommended:X,setSubHeaderStack:Q,setSearchText:J,setVariables:q,setShowRecommended:Y}},{children:s("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%",outline:"none"},onClick:e=>e.stopPropagation()},{children:[(E||P)&&s(C,{children:[s("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[P&&t(m,{Icon:()=>t(o,{width:16,height:16,style:{display:"flex",color:d.content.primary}}),onClick:A}),E&&t(f,{children:null!=F?F:"Select Variable"})]})),!_&&t(m,{style:{color:"#212121"},Icon:l,onClick:()=>R.onClose&&R.onClose()})]}),t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:d.surface.subdued,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:t(p,{id:"search-bar-v3-picker",onBlur:e=>{R.onSearchBlur&&R.onSearchBlur(e)},value:G,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||W("");const t=k(e,Z,M);if(X){const e=w(t,M);q(e)}else q(t);J(e);const s=M.length>0?M[M.length-1].displayName:"home";W(s)}})})),s(S,{children:[t(y,Object.assign({style:{color:d.content.secondary}},{children:"Only Recommended"})),t(b,{value:X,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield te(t)}))})]}),M.length>0&&s(T,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(m,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>t(o,{width:12,height:12,style:{color:d.content.secondary}}),onClick:e=>{e.stopPropagation();let t=G;const s=[...M],i=s.pop();if(Q(s),i.displayName===U&&(J(""),t=""),t.length>0){const e=s.length>0?[s[s.length-1]]:H,i=k(t,e,s);if(X){const e=w(i,s);q(e)}else q(i)}else if(s.length>0)if(X){const e=w([s[s.length-1].variables],s);q(e)}else q([s[s.length-1].variables]);else if(X){const e=w(H,M);q(e)}else q(H)}})})),t(v,Object.assign({style:{color:d.content.secondary}},{children:M[M.length-1].displayName}))]}),t(i,{children:K.length>0?t(N,Object.assign({height:se()},{children:K.map(((e,o)=>{var l,r;return e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:t(h,Object.assign({autoOpen:D&&0===o,headerPadding:"12px 16px",header:t(j,Object.assign({style:{color:d.content.secondary}},{children:B(e.displayName,G)}))},{children:t(V,{parentVariable:e,disabled:null!==(l=R.disabled)&&void 0!==l&&l,searchText:G,variable:e.variables,onSelect:$})}))}),e.displayName+X):e.displayName?t(u,Object.assign({body:I(e),placement:"bottom"},{children:t(g,{variant:R.disabled?"readonly":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)||R.disabled?t(i,{}):t(a,{width:14,height:14}),customListItemLabel:s("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(y,Object.assign({style:{fontSize:"14px",color:d.text.primary}},{children:B(e.displayName,G)})),!e.isAvailable&&t(u,Object.assign({body:"Not Recommended"},{children:t("div",Object.assign({style:{display:"flex",marginTop:2}},{children:t(n,{width:16,height:16,color:d.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!R.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}),o):t(V,{disabled:null!==(r=R.disabled)&&void 0!==r&&r,searchText:G,variable:e,onSelect:e=>{if(!R.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}))})):t(O,{height:se(),searchText:G})})]}))}))};export{H as VariablePickerContent,B as highlightSearchText};
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ height: string;
3
+ searchText?: string;
4
+ };
5
+ declare const NoResult: (props: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default NoResult;
@@ -0,0 +1,17 @@
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import r from"../../assets/icons/search.svg.js";import n from"styled-components";import{COLORS as o}from"../../constants/Theme.js";import{TitleMedium as i,BodySecondary as s}from"../TypographyStyle.js";const c=n=>e(a,Object.assign({height:n.height},{children:[t(d,{children:t(r,{width:24,height:24,color:o.background.brand})}),e("div",Object.assign({style:{textAlign:"center"}},{children:[t(i,{children:"No results found"}),n.searchText?t(s,Object.assign({style:{color:o.content.secondary,marginTop:8}},{children:`Sorry we could not find any results for "${n.searchText}"`})):t(s,Object.assign({style:{color:o.content.secondary,marginTop:8}},{children:"Sorry we could not find any variables"}))]}))]})),a=n.div`
2
+ display: flex;
3
+ gap: 16px;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ justify-content: center;
7
+ padding: 0 16px;
8
+ height: ${e=>e.height};
9
+ `,d=n.div`
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ background-color: ${o.background.brandLight};
14
+ width: 48px;
15
+ height: 48px;
16
+ border-radius: 24px;
17
+ `;export{c as default};
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { SubHeader, VariableListInterfaceV3, VariableV3 } from './model';
3
+ type SubHeaderProps = {
4
+ parentVariable?: VariableListInterfaceV3;
5
+ disabled: boolean;
6
+ searchText: string;
7
+ onSelect: (variable: VariableV3) => void;
8
+ variable: {
9
+ [key: string]: SubHeader | VariableV3;
10
+ };
11
+ };
12
+ export declare const renderTooltipBody: (variable: VariableV3) => string;
13
+ declare const SubHeaderItem: React.FC<SubHeaderProps>;
14
+ export default SubHeaderItem;
@@ -0,0 +1 @@
1
+ import{jsx as e,Fragment as t,jsxs as s}from"react/jsx-runtime";import i from"../../assets/icons/chevronRight.svg.js";import o from"../../assets/icons/plus.svg.js";import a from"../../assets/icons/sub_category.svg.js";import l from"../../assets/icons/triangle_error.svg.js";import{cloneDeep as r}from"lodash";import{COLORS as n}from"../../constants/Theme.js";import{ListItem as c}from"../list-item/ListItem.js";import{Tooltip as d}from"../tooltips/Tooltip.js";import{BodySecondary as m}from"../TypographyStyle.js";import{highlightSearchText as p}from"./Content.js";import{useVariablePickerContext as b}from"./context.js";import{showOnlyRecommendedVariables as y}from"./recommendVaribles.js";const g=e=>{var t;return(null===(t=e.contextQ)||void 0===t?void 0:t.join(" > "))||""},h=h=>{const{onSelect:v,variable:f,searchText:j,disabled:u,parentVariable:x}=h,{subHeaderStack:O,setSubHeaderStack:I,setVariables:N,showRecommended:S}=b();return e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:4}},{children:Object.keys(f).map(((b,h)=>{if(void 0===f[b].variables){const i=f[b];return e(d,Object.assign({body:g(i),placement:"bottom"},{children:e(c,{variant:u?"readonly":(null==i?void 0:i.selected)?"selected":"default",version:"2.0",leadingIcon:(null==i?void 0:i.selected)||u?e(t,{}):e(o,{width:14,height:14}),customListItemLabel:s("div",Object.assign({style:{display:"flex",gap:4}},{children:[e(m,Object.assign({style:{fontSize:"14px",color:n.text.primary}},{children:p(i.displayName,j)})),!i.isAvailable&&e(d,Object.assign({body:"Not Recommended"},{children:e("div",Object.assign({style:{display:"flex",marginTop:2}},{children:e(l,{width:16,height:16,color:n.content.secondary})}))}))]})),listItem:{label:i.displayName,value:i.displayName},subText:i.description||"",onClick:()=>{v(i)}})}),h)}return e(d,Object.assign({body:g(f[b]),placement:"bottom"},{children:e(c,{variant:"default",version:"2.0",listItem:{label:f[b].displayName,value:f[b].displayName},customListItemLabel:e("div",Object.assign({style:{display:"flex",alignItems:"center"}},{children:e(m,Object.assign({style:{fontSize:"14px",color:n.text.primary}},{children:p(f[b].displayName,j)}))})),leadingIcon:e(a,{width:14,height:14}),subText:f[b].description||"",trailingIcon:e(i,{width:10,height:10,color:"#212121"}),onClick:()=>{const e=r(f[b]);void 0!==x&&(e.contextQ=[x.displayName]);const t=[...O,e];if(I(t),S){const s=y([e.variables],t);N(s)}else N([e.variables])}})}),h)}))}))};export{h as default,g as renderTooltipBody};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { VariablePickerV3Props } from './model';
3
+ type Props = VariablePickerV3Props;
4
+ export declare const VariablePicker: React.FC<Props>;
5
+ export default VariablePicker;
@@ -0,0 +1 @@
1
+ import{jsxs as t,jsx as s}from"react/jsx-runtime";import o from"../../assets/icons/cross.svg.js";import{COLORS as e}from"../../constants/Theme.js";import{CloseButtonContainer as i}from"../modals/modal.styled.js";import{VariablePickerContent as r}from"./Content.js";import{PickerType as n}from"./model.js";const d=d=>{var c;const{type:h}=d;return h==n.FLOATER?t("div",Object.assign({style:{boxShadow:"0px 2px 8px 0px #0000001F",width:d.width?d.width:344,borderRadius:4,height:"100%"}},{children:[s(r,Object.assign({},d)),s(i,Object.assign({onClick:()=>{d.onClose&&d.onClose()}},{children:s(o,{height:20,width:20,color:e.content.secondary})}))]})):s("div",Object.assign({style:{width:null!==(c=d.width)&&void 0!==c?c:"100%",height:"100%"}},{children:s(r,Object.assign({},d))}))};export{d as VariablePicker,d as default};
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare const VariablePickerContext: React.Context<{
3
+ searchText: string;
4
+ setSearchText: React.Dispatch<React.SetStateAction<string>>;
5
+ subHeaderStack: any[];
6
+ setSubHeaderStack: React.Dispatch<React.SetStateAction<any[]>>;
7
+ variables: any[];
8
+ setVariables: React.Dispatch<React.SetStateAction<any[]>>;
9
+ showRecommended: boolean;
10
+ setShowRecommended: React.Dispatch<React.SetStateAction<boolean>>;
11
+ }>;
12
+ export declare const useVariablePickerContext: () => {
13
+ searchText: string;
14
+ setSearchText: React.Dispatch<React.SetStateAction<string>>;
15
+ subHeaderStack: any[];
16
+ setSubHeaderStack: React.Dispatch<React.SetStateAction<any[]>>;
17
+ variables: any[];
18
+ setVariables: React.Dispatch<React.SetStateAction<any[]>>;
19
+ showRecommended: boolean;
20
+ setShowRecommended: React.Dispatch<React.SetStateAction<boolean>>;
21
+ };
@@ -0,0 +1 @@
1
+ import e,{useContext as t}from"react";const a=e.createContext({searchText:"",setSearchText:()=>{},subHeaderStack:[],setSubHeaderStack:()=>{},variables:[],setVariables:()=>{},showRecommended:!1,setShowRecommended:()=>{}}),r=()=>t(a);export{a as VariablePickerContext,r as useVariablePickerContext};
@@ -0,0 +1 @@
1
+ export * from './VariablePicker';
@@ -0,0 +1,57 @@
1
+ export declare enum PickerType {
2
+ FLOATER = "floater",
3
+ EMBEDDED = "embedded"
4
+ }
5
+ export interface VariablePickerV3Props {
6
+ type: PickerType;
7
+ data: VariableListInterfaceV3[];
8
+ onSelect: (variable: VariableV3) => void;
9
+ width?: string;
10
+ onClose?: () => void;
11
+ showHeader?: boolean;
12
+ showBackButton?: boolean;
13
+ onBackButtonClick?: () => void;
14
+ onSearchBlur?: (e: any) => void;
15
+ isEvaluationList?: boolean;
16
+ hideHeaderCross?: boolean;
17
+ disabled?: boolean;
18
+ autoOpenFirst?: boolean;
19
+ headerText?: string;
20
+ }
21
+ export interface VariableListInterfaceV3 {
22
+ isSubHeader?: boolean;
23
+ displayName: string;
24
+ description: string;
25
+ orderId?: number;
26
+ isAvailable?: boolean;
27
+ contextQ?: string[];
28
+ variables?: {
29
+ [key: string]: SubHeader | VariableV3;
30
+ };
31
+ }
32
+ export interface SubHeader {
33
+ isSubHeader: boolean;
34
+ isAvailable: boolean;
35
+ displayName: string;
36
+ description: string;
37
+ contextQ?: string[];
38
+ variables?: {
39
+ [key: string]: SubHeader | VariableV3;
40
+ };
41
+ }
42
+ export interface VariableV3 {
43
+ contextQ?: string[];
44
+ selected?: boolean;
45
+ description?: string;
46
+ defaultValue?: string;
47
+ displayName: string;
48
+ actualValue: string;
49
+ variableType: string;
50
+ isAvailable: boolean;
51
+ actualValueEval?: string;
52
+ isSubHeader?: boolean;
53
+ variables?: {
54
+ [key: string]: VariableV3;
55
+ };
56
+ needsFetching?: boolean;
57
+ }
@@ -0,0 +1 @@
1
+ var e;!function(e){e.FLOATER="floater",e.EMBEDDED="embedded"}(e||(e={}));export{e as PickerType};
@@ -0,0 +1 @@
1
+ export declare const showOnlyRecommendedVariables: (data: any, stack: any[]) => any;
@@ -0,0 +1 @@
1
+ const e=(e,i)=>e.map((e=>{if(e.isAvailable&&void 0===e.variables)return e;if(void 0===e.isAvailable&&void 0!==e.variables){const i=a(e.variables);return 0===Object.keys(i).length?{}:Object.assign(Object.assign({},e),{variables:i})}if(void 0===e.variables){return a(e)}{const s=a(e.variables);return i.length?s:Object.assign(Object.assign({},e),{variables:s})}})).filter((e=>Object.keys(e).length>0)),a=e=>Object.keys(e).reduce(((a,i)=>(e[i]&&e[i].isAvailable&&(a[i]=e[i]),a)),{});export{e as showOnlyRecommendedVariables};
@@ -0,0 +1,2 @@
1
+ import { VariableListInterfaceV3 } from './model';
2
+ export declare const searchVariables: (text: string, data: VariableListInterfaceV3[], subHeaderStack: any[]) => any[];
@@ -0,0 +1 @@
1
+ const e=(e,s,t)=>{if(!e)return t.length>0?[t[t.length-1].variables]:s;const i=[];return s.forEach((s=>{if(t.length>0)if(s.displayName&&void 0!==s.variables)a(e,s.variables,i,[...s.contextQ||[],s.displayName]);else{if(s.displayName.toLowerCase().includes(e.toLowerCase())&&i.push(s),!s.variables||!Object.keys(s.variables).length)return;a(e,s.variables,i,[...s.contextQ||[],s.displayName])}else{if(s.displayName.toLowerCase().includes(e.toLowerCase())&&i.push(s),!s.variables||!Object.keys(s.variables).length)return;a(e,s.variables,i,[s.displayName])}})),i},a=function(e,s,t){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];Object.keys(s).forEach((l=>{s[l].displayName.toLowerCase().includes(e.toLowerCase())&&t.push(s[l].isSubHeader?{[l]:Object.assign(Object.assign({},s[l]),{contextQ:i})}:Object.assign(Object.assign({},s[l]),{contextQ:i})),s[l].variables&&Object.keys(s[l].variables).length&&a(e,s[l].variables,t,[...i,s[l].displayName])}))};export{e as searchVariables};
@@ -0,0 +1,6 @@
1
+ export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const RecommendWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const BackHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {
5
+ height: string;
6
+ }, never>;
@@ -0,0 +1,42 @@
1
+ import e from"styled-components";import{COLORS as t}from"../../constants/Theme.js";const o=e.div`
2
+ display: flex;
3
+ align-items: center;
4
+ padding: 12px 16px 0px 16px;
5
+ background-color: ${t.surface.subdued};
6
+ justify-content: space-between;
7
+ border-top-right-radius: 4px;
8
+ border-top-left-radius: 4px;
9
+ `,r=e.div`
10
+ display: flex;
11
+ justify-content: space-between;
12
+ align-items: center;
13
+ padding: 12px 16px;
14
+ background-color: ${t.surface.subdued};
15
+ border-bottom: 1px solid ${t.stroke.primary};
16
+ `,i=e.div`
17
+ position: relative;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ height: 32px;
22
+ background-color: ${t.background.base};
23
+ `,p=e.div`
24
+ margin: 8px;
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 4px;
28
+ height: ${e=>e.height};
29
+ overflow: scroll;
30
+ &::-webkit-scrollbar-thumb {
31
+ background-color: #e0e0e0 !important;
32
+ border-radius: 8px;
33
+ }
34
+ &::-webkit-scrollbar {
35
+ height: 5px;
36
+ display: block;
37
+ width: 8px;
38
+ }
39
+ &::-webkit-scrollbar-thumb:horizontal {
40
+ width: 8px;
41
+ }
42
+ `;export{i as BackHeader,p as Container,o as HeaderWrapper,r as RecommendWrapper};
@@ -1,3 +1,4 @@
1
1
  export * from './BaseWhatsappContentLang.helper';
2
2
  export * from '../components/curtain/CurtainHelper';
3
3
  export * from '../utils/resizeImage';
4
+ export * from '../components/variable-picker-v3/model';
@@ -1 +1 @@
1
- import{useEffect as n}from"react";function t(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];n((()=>{function n(n){let o=!0;null==r||r.forEach((t=>{t&&(null==t?void 0:t.current)&&t.current.contains(n.target)&&(o=!1)})),o&&(null==t?void 0:t.current)&&!t.current.contains(n.target)&&e()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}}),[t])}export{t as useOutside};
1
+ import{useEffect as t}from"react";function e(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];t((()=>{function t(t){let o=!0;null==r||r.forEach((e=>{e&&e.current&&e.current.contains(t.target)&&(o=!1)})),o&&e.current&&!e.current.contains(t.target)&&n()}return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}}),[e])}export{e as useOutside};
@@ -80,5 +80,5 @@ export * from './utils/validator';
80
80
  export * from './components/carousel-preview';
81
81
  export * from './components/floater';
82
82
  export * from './components/card-selector';
83
+ export * from './components/variable-picker-v3';
83
84
  export * from './components/action-button';
84
- export * from './components/ai-modals';