@bikdotai/bik-component-library 0.0.263 → 0.0.264-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/cjs/components/add-variableV2/AddVariableV2.d.ts +41 -0
  2. package/dist/cjs/components/add-variableV2/AddVariableV2.js +1 -0
  3. package/dist/cjs/components/add-variableV2/AddVariableV2.styled.d.ts +6 -0
  4. package/dist/cjs/components/add-variableV2/AddVariableV2.styled.js +161 -0
  5. package/dist/cjs/components/add-variableV2/AddVariableV2SideModal.d.ts +15 -0
  6. package/dist/cjs/components/add-variableV2/AddVariableV2SideModal.js +1 -0
  7. package/dist/cjs/components/add-variableV2/__stories__/AddVariableV2.stories.d.ts +505 -0
  8. package/dist/cjs/components/add-variableV2/__stories__/AddVariableV2.stories.js +1 -0
  9. package/dist/cjs/components/add-variableV2/backIcon.d.ts +3 -0
  10. package/dist/cjs/components/add-variableV2/backIcon.js +1 -0
  11. package/dist/cjs/components/add-variableV2/closeIcon.d.ts +3 -0
  12. package/dist/cjs/components/add-variableV2/closeIcon.js +1 -0
  13. package/dist/cjs/components/add-variableV2/icon-props.d.ts +7 -0
  14. package/dist/cjs/components/add-variableV2/index.d.ts +1 -0
  15. package/dist/cjs/components/add-variableV2/plusIcon.d.ts +3 -0
  16. package/dist/cjs/components/add-variableV2/plusIcon.js +1 -0
  17. package/dist/cjs/components/add-variableV2/rightFilled.d.ts +2 -0
  18. package/dist/cjs/components/add-variableV2/rightFilled.js +1 -0
  19. package/dist/cjs/components/add-variableV2/undoIcon.d.ts +3 -0
  20. package/dist/cjs/components/add-variableV2/undoIcon.js +1 -0
  21. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  22. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  23. package/dist/cjs/components/plans/SubscriptionPlan.js +1 -1
  24. package/dist/cjs/components/stepper/WorkingStepper.d.ts +0 -1
  25. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +2 -1
  26. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  27. package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +1 -0
  28. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +2 -2
  29. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +2 -1
  30. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  31. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -1
  32. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  33. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  34. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  35. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +2 -1
  36. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  37. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.d.ts +2 -1
  38. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +2 -2
  39. package/dist/esm/components/add-variableV2/AddVariableV2.d.ts +41 -0
  40. package/dist/esm/components/add-variableV2/AddVariableV2.js +1 -0
  41. package/dist/esm/components/add-variableV2/AddVariableV2.styled.d.ts +6 -0
  42. package/dist/esm/components/add-variableV2/AddVariableV2.styled.js +161 -0
  43. package/dist/esm/components/add-variableV2/AddVariableV2SideModal.d.ts +15 -0
  44. package/dist/esm/components/add-variableV2/AddVariableV2SideModal.js +1 -0
  45. package/dist/esm/components/add-variableV2/__stories__/AddVariableV2.stories.d.ts +505 -0
  46. package/dist/esm/components/add-variableV2/__stories__/AddVariableV2.stories.js +1 -0
  47. package/dist/esm/components/add-variableV2/backIcon.d.ts +3 -0
  48. package/dist/esm/components/add-variableV2/backIcon.js +1 -0
  49. package/dist/esm/components/add-variableV2/closeIcon.d.ts +3 -0
  50. package/dist/esm/components/add-variableV2/closeIcon.js +1 -0
  51. package/dist/esm/components/add-variableV2/icon-props.d.ts +7 -0
  52. package/dist/esm/components/add-variableV2/index.d.ts +1 -0
  53. package/dist/esm/components/add-variableV2/plusIcon.d.ts +3 -0
  54. package/dist/esm/components/add-variableV2/plusIcon.js +1 -0
  55. package/dist/esm/components/add-variableV2/rightFilled.d.ts +2 -0
  56. package/dist/esm/components/add-variableV2/rightFilled.js +1 -0
  57. package/dist/esm/components/add-variableV2/undoIcon.d.ts +3 -0
  58. package/dist/esm/components/add-variableV2/undoIcon.js +1 -0
  59. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  60. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  61. package/dist/esm/components/plans/SubscriptionPlan.js +1 -1
  62. package/dist/esm/components/stepper/WorkingStepper.d.ts +0 -1
  63. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +2 -1
  64. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  65. package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +1 -0
  66. package/dist/esm/components/template-context-mapper/modalElements/Body.js +1 -1
  67. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +2 -1
  68. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  69. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +2 -1
  70. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  71. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  72. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  73. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.d.ts +2 -1
  74. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  75. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.d.ts +2 -1
  76. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +2 -2
  77. package/package.json +1 -1
@@ -4,6 +4,7 @@ export interface BodyProps {
4
4
  showVariableMapping: boolean;
5
5
  showOnlyContent?: boolean;
6
6
  whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
7
+ showVariableModal?: boolean;
7
8
  }
8
9
  declare const Body: (props: BodyProps) => JSX.Element;
9
10
  export default Body;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("../../template-preview/models/Channels.js"),o=require("../../../constants/Theme.js"),i=require("../context/templateModalContext.js"),r=require("../utils/getVariableNameEmail.js"),a=require("../utils/highlightFor.js"),s=require("./DesktopPreview.js"),d=require("./EditWhatsAppTemplateV2.js"),u=require("./MobilePreview.js"),p=require("./VariableConnectorsPanel.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(l);const m=h.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("../../template-preview/models/Channels.js"),o=require("../../../constants/Theme.js"),i=require("../context/templateModalContext.js"),a=require("../utils/getVariableNameEmail.js"),r=require("../utils/highlightFor.js"),s=require("./DesktopPreview.js"),d=require("./EditWhatsAppTemplateV2.js"),u=require("./MobilePreview.js"),p=require("./VariableConnectorsPanel.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(l);const m=h.default.div`
2
2
  display: flex;
3
3
  // height: 100%;
4
4
  `,f=h.default.div`
@@ -15,4 +15,4 @@
15
15
  flex: 1;
16
16
  height: 475px;
17
17
  overflow-y: auto;
18
- `;exports.default=l=>{const{showVariableMapping:c,showOnlyContent:h,whatsappSpecificPickerMeta:g}=l,v=t.useRef(),j=t.useRef(),{device:E,display_content:w,channel:b,template:y,setTemplate:C}=i.useTemplateModalContext();const P=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(m,{children:[e.jsx(x,Object.assign({showOnlyContent:h,showVariableMapping:c},{children:"mobile"===E?e.jsx(u.default,{ref:j,display_content:null!=w?w:"",channel:b,template:y}):b!==n.CHANNEL_TYPE.MESSAGE?e.jsx(s.default,{ref:v,channel:b,display_content:null!=w?w:""}):e.jsx(e.Fragment,{})})),c&&e.jsx(f,Object.assign({channel:b},{children:b!==n.CHANNEL_TYPE.WHATSAPP?e.jsx(p.default,{onFocus:b===n.CHANNEL_TYPE.EMAIL?function(e){var t,l,i;const s=null===document||void 0===document?void 0:document.getElementById("mobile"===E?"template_html_mobile":"template_html_desktop"),d=r.getVariableNameForEmailByIndex(e+1),u=b===n.CHANNEL_TYPE.EMAIL?null===(t=null==s?void 0:s.contentWindow)||void 0===t?void 0:t.document.getElementById(d):document.getElementById(d),p=P(u),c=null==u?void 0:u.offsetLeft;"desktop"===E?p&&v.current&&(null===(l=null==s?void 0:s.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,p),a.highlightFor(d,o.COLORS.background.warning.light,2,b,E)):p&&j.current&&(null===(i=null==s?void 0:s.contentWindow)||void 0===i||i.scrollTo(null!=c?c:0,p),a.highlightFor(d,o.COLORS.background.warning.light,2,b,E))}:void 0}):e.jsx(d.default,{whatsappSpecificPickerMeta:g,template:y,onTemplateChange:e=>{null==C||C(e)}})}))]})};
18
+ `;exports.default=l=>{const{showVariableMapping:c,showOnlyContent:h,whatsappSpecificPickerMeta:g,showVariableModal:v}=l,j=t.useRef(),w=t.useRef(),{device:b,display_content:E,channel:y,template:C,setTemplate:P}=i.useTemplateModalContext();const T=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(m,{children:[e.jsx(x,Object.assign({showOnlyContent:h,showVariableMapping:c},{children:"mobile"===b?e.jsx(u.default,{ref:w,display_content:null!=E?E:"",channel:y,template:C}):y!==n.CHANNEL_TYPE.MESSAGE?e.jsx(s.default,{ref:j,channel:y,display_content:null!=E?E:""}):e.jsx(e.Fragment,{})})),c&&e.jsx(f,Object.assign({channel:y},{children:y!==n.CHANNEL_TYPE.WHATSAPP?e.jsx(p.default,{onFocus:y===n.CHANNEL_TYPE.EMAIL?function(e){var t,l,i;const s=null===document||void 0===document?void 0:document.getElementById("mobile"===b?"template_html_mobile":"template_html_desktop"),d=a.getVariableNameForEmailByIndex(e+1),u=y===n.CHANNEL_TYPE.EMAIL?null===(t=null==s?void 0:s.contentWindow)||void 0===t?void 0:t.document.getElementById(d):document.getElementById(d),p=T(u),c=null==u?void 0:u.offsetLeft;"desktop"===b?p&&j.current&&(null===(l=null==s?void 0:s.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,p),r.highlightFor(d,o.COLORS.background.warning.light,2,y,b)):p&&w.current&&(null===(i=null==s?void 0:s.contentWindow)||void 0===i||i.scrollTo(null!=c?c:0,p),r.highlightFor(d,o.COLORS.background.warning.light,2,y,b))}:void 0,showVariableModal:v}):e.jsx(d.default,{whatsappSpecificPickerMeta:g,template:C,onTemplateChange:e=>{null==P||P(e)},showVariableModal:v})}))]})};
@@ -6,6 +6,7 @@ export interface EditWhatsAppTemplateV2Props {
6
6
  whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
7
7
  template: WhatsAppTemplate;
8
8
  onTemplateChange?: (template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType) => void;
9
+ showVariableModal?: boolean;
9
10
  }
10
- declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, }: EditWhatsAppTemplateV2Props) => JSX.Element;
11
+ declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, }: EditWhatsAppTemplateV2Props) => JSX.Element;
11
12
  export default EditWhatsAppTemplateV2;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../context/templateModalContext.js"),n=require("../utils/getDataFromTemplateComponent.js"),o=require("./EditMediaV2.style.js"),i=require("./EditWhatsAppTemplateMediaV2.js"),l=require("./VariableConnectorsPanel.js"),s=require("./VariableConnectorWhatsApp.js"),a=require("./VariableEditorHeader.js"),d=require("./WhatsAppTemplateCardButtonV2.js");exports.default=r=>{let{template:p,onTemplateChange:u,whatsappSpecificPickerMeta:c}=r;var m,v,b,g,h,f,j,x,T,O,y,C;const{originalVariableList:E}=t.useTemplateModalContext(),{descriptionComponents:V,urlBtns:w,qrbBtns:B,imageComponent:I,bodyVariables:q,headerVariables:R}=n.getAllDataFromTemplateComponent(p);function A(e,t){var n,o,i,l;const s=Object.assign({},p),a=null==s?void 0:s.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==a&&a>-1){const d=null===(n=null==s?void 0:s.components[a].buttons)||void 0===n?void 0:n.findIndex((e=>"URL"===e.type));if(void 0!==d&&d>-1){const n="custom"===t&&"string"==typeof e,r=[...null!==(l=null===(i=null===(o=s.components)||void 0===o?void 0:o[a])||void 0===i?void 0:i.buttons)&&void 0!==l?l:[]];r[d]=Object.assign(Object.assign({},r[d]),{url:"https://d.bik.ai/{{1}}",example:[n?e:"string"!=typeof e?e.defaultValue:""]});const p=Object.assign(Object.assign({},s.components[a]),{buttons:r}),u=Object.assign(Object.assign({},s.mapping),{buttons:n?["((customBtnPlaceholder))"]:"string"!=typeof e?[e.placeHolder]:void 0});s.mapping=u;const c=[...s.components];c[a]=p,s.components=c}}null==u||u(s)}function L(e,t,n){var o;const i=Object.assign({},p),l=null==i?void 0:i.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==l&&l>-1){const t=null===(o=null==i?void 0:i.components[l].buttons)||void 0===o?void 0:o.filter((e=>"QUICK_REPLY"===e.type));t&&(t[n]=Object.assign(Object.assign({},t[n]),{flowId:e.flowId,flowName:e.flowName}));const s=Object.assign(Object.assign({},i.components[l]),{buttons:t}),a=[...i.components];a[l]=s,i.components=a}null==u||u(i)}return e.jsxs(l.Container,Object.assign({style:{flexDirection:"column",maxHeight:460}},{children:[!!I&&e.jsx(o.EditTemplateMediaContainer,{children:e.jsx(i.default,{whatsappSpecificPickerMeta:c,mediaComponent:I,updateTemplateImageUrl:function(e,t){var n;let o=Object.assign({},p);const i=null===(n=null==o?void 0:o.components)||void 0===n?void 0:n.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==i&&i>-1&&(null==o?void 0:o.components[i])){const n=Object.assign(Object.assign({},o.components[i]),{format:t,example:{header_handle:[e]}}),l=[...o.components];l[i]=n,o=Object.assign(Object.assign({},o),{components:l})}null==u||u(o)},template:p})}),(q.length>0||R.length>0)&&e.jsx(a.default,{containerStyle:{paddingTop:I?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null==V?void 0:V.map(((t,n)=>e.jsx(s.default,{originalVariableList:E,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?p.mapping.header:p.mapping.body},n))),(null===(v=null===(m=w[0])||void 0===m?void 0:m.component)||void 0===v?void 0:v.buttons)&&(null===(h=null===(g=null===(b=w[0])||void 0===b?void 0:b.component)||void 0===g?void 0:g.buttons)||void 0===h?void 0:h.length)>0&&e.jsx(a.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(f=null==E?void 0:E.buttons)||void 0===f?void 0:f.map(((t,n)=>{if("URL"===t.type)return e.jsx(d.default,{CTAoptions:null==c?void 0:c.CTAoptions,button:t,originalVariableList:E,updateSelectedURLTemplateBtn:A},`${n}`)})),(null===(x=null===(j=B[0])||void 0===j?void 0:j.component)||void 0===x?void 0:x.buttons)&&(null===(y=null===(O=null===(T=B[0])||void 0===T?void 0:T.component)||void 0===O?void 0:O.buttons)||void 0===y?void 0:y.length)>0&&e.jsx(a.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}),null===(C=null==E?void 0:E.buttons)||void 0===C?void 0:C.map(((t,n)=>{if("QUICK_REPLY"===t.type)return e.jsx(d.default,{QRBoptions:null==c?void 0:c.QRBoptions,button:t,originalVariableList:E,updateSelectedQRBTemplateBtn:L},`${n}`)}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../context/templateModalContext.js"),o=require("../utils/getDataFromTemplateComponent.js"),n=require("./EditMediaV2.style.js"),i=require("./EditWhatsAppTemplateMediaV2.js"),l=require("./VariableConnectorsPanel.js"),a=require("./VariableConnectorWhatsApp.js"),s=require("./VariableEditorHeader.js"),d=require("./WhatsAppTemplateCardButtonV2.js");exports.default=r=>{let{template:p,onTemplateChange:u,whatsappSpecificPickerMeta:c,showVariableModal:m}=r;var b,v,g,h,f,j,x,T,O,y,C,E;const{originalVariableList:V}=t.useTemplateModalContext(),{descriptionComponents:w,urlBtns:B,qrbBtns:I,imageComponent:M,bodyVariables:q,headerVariables:R}=o.getAllDataFromTemplateComponent(p);function A(e,t){var o,n,i,l;const a=Object.assign({},p),s=null==a?void 0:a.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==s&&s>-1){const d=null===(o=null==a?void 0:a.components[s].buttons)||void 0===o?void 0:o.findIndex((e=>"URL"===e.type));if(void 0!==d&&d>-1){const o="custom"===t&&"string"==typeof e,r=[...null!==(l=null===(i=null===(n=a.components)||void 0===n?void 0:n[s])||void 0===i?void 0:i.buttons)&&void 0!==l?l:[]];r[d]=Object.assign(Object.assign({},r[d]),{url:"https://d.bik.ai/{{1}}",example:[o?e:"string"!=typeof e?e.defaultValue:""]});const p=Object.assign(Object.assign({},a.components[s]),{buttons:r}),u=Object.assign(Object.assign({},a.mapping),{buttons:o?["((customBtnPlaceholder))"]:"string"!=typeof e?[e.placeHolder]:void 0});a.mapping=u;const c=[...a.components];c[s]=p,a.components=c}}null==u||u(a)}function L(e,t,o){var n;const i=Object.assign({},p),l=null==i?void 0:i.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==l&&l>-1){const t=null===(n=null==i?void 0:i.components[l].buttons)||void 0===n?void 0:n.filter((e=>"QUICK_REPLY"===e.type));t&&(t[o]=Object.assign(Object.assign({},t[o]),{flowId:e.flowId,flowName:e.flowName}));const a=Object.assign(Object.assign({},i.components[l]),{buttons:t}),s=[...i.components];s[l]=a,i.components=s}null==u||u(i)}return e.jsxs(l.Container,Object.assign({style:{flexDirection:"column",maxHeight:460}},{children:[!!M&&e.jsx(n.EditTemplateMediaContainer,{children:e.jsx(i.default,{whatsappSpecificPickerMeta:c,mediaComponent:M,updateTemplateImageUrl:function(e,t){var o;let n=Object.assign({},p);const i=null===(o=null==n?void 0:n.components)||void 0===o?void 0:o.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==i&&i>-1&&(null==n?void 0:n.components[i])){const o=Object.assign(Object.assign({},n.components[i]),{format:t,example:{header_handle:[e]}}),l=[...n.components];l[i]=o,n=Object.assign(Object.assign({},n),{components:l})}null==u||u(n)},template:p})}),(q.length>0||R.length>0)&&e.jsx(s.default,{containerStyle:{paddingTop:M?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null==w?void 0:w.map(((t,o)=>e.jsx(a.default,{originalVariableList:V,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?p.mapping.header:p.mapping.body,showVariableModal:m},o))),(null===(v=null===(b=B[0])||void 0===b?void 0:b.component)||void 0===v?void 0:v.buttons)&&(null===(f=null===(h=null===(g=B[0])||void 0===g?void 0:g.component)||void 0===h?void 0:h.buttons)||void 0===f?void 0:f.length)>0&&e.jsx(s.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(j=null==V?void 0:V.buttons)||void 0===j?void 0:j.map(((t,o)=>{if("URL"===t.type)return e.jsx(d.default,{CTAoptions:null==c?void 0:c.CTAoptions,button:t,originalVariableList:V,updateSelectedURLTemplateBtn:A},`${o}`)})),(null===(T=null===(x=I[0])||void 0===x?void 0:x.component)||void 0===T?void 0:T.buttons)&&(null===(C=null===(y=null===(O=I[0])||void 0===O?void 0:O.component)||void 0===y?void 0:y.buttons)||void 0===C?void 0:C.length)>0&&e.jsx(s.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}),null===(E=null==V?void 0:V.buttons)||void 0===E?void 0:E.map(((t,o)=>{if("QUICK_REPLY"===t.type)return e.jsx(d.default,{QRBoptions:null==c?void 0:c.QRBoptions,button:t,originalVariableList:V,updateSelectedQRBTemplateBtn:L},`${o}`)}))]}))};
@@ -7,6 +7,7 @@ export interface TemplateSelectModalContentProps {
7
7
  hideHeader?: boolean;
8
8
  showOnlyContent?: boolean;
9
9
  whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
10
+ showVariableModal?: boolean;
10
11
  }
11
- declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, }: TemplateSelectModalContentProps) => JSX.Element;
12
+ declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, }: TemplateSelectModalContentProps) => JSX.Element;
12
13
  export default TemplateSelectModalContent;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../template-preview/models/Channels.js"),r=require("./Body.js"),s=require("./Header.js");exports.default=a=>{let{channel:i,showVariableMapping:n,showOnlyContent:l,whatsappSpecificPickerMeta:o}=a;return e.jsx("div",Object.assign({style:{paddingBottom:0}},{children:e.jsxs("div",{children:[i===t.CHANNEL_TYPE.EMAIL&&e.jsx(s.default,{showOnlyContent:l}),e.jsx(r.default,{whatsappSpecificPickerMeta:o,showVariableMapping:!!n,showOnlyContent:l})]})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../template-preview/models/Channels.js"),t=require("./Body.js"),r=require("./Header.js");exports.default=s=>{let{channel:i,showVariableMapping:l,showOnlyContent:n,whatsappSpecificPickerMeta:o,showVariableModal:d}=s;return e.jsx("div",Object.assign({style:{paddingBottom:0}},{children:e.jsxs("div",{children:[i===a.CHANNEL_TYPE.EMAIL&&e.jsx(r.default,{showOnlyContent:n}),e.jsx(t.default,{whatsappSpecificPickerMeta:o,showVariableMapping:!!l,showOnlyContent:n,showVariableModal:d})]})}))};
@@ -10,6 +10,7 @@ export interface VariableConnectorProps {
10
10
  onFocus?: () => void;
11
11
  variable: CUSTOM_VARIABLE;
12
12
  index: number;
13
+ showVariableModal?: boolean;
13
14
  }
14
- declare const VariableConnector: ({ onFocus, variable, index, }: VariableConnectorProps) => JSX.Element;
15
+ declare const VariableConnector: ({ onFocus, variable, index, showVariableModal, }: VariableConnectorProps) => JSX.Element;
15
16
  export default VariableConnector;
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),n=require("../../dropdown/Dropdown.js"),i=require("../../input/Input.js"),o=require("../../template-preview/constants/regexPatterns.js"),a=require("../../template-preview/models/Channels.js"),u=require("../../TypographyStyle.js"),s=require("../../../utils/StringUtils.js"),r=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),c=require("../utils/getVariableNameEmail.js"),v=require("../utils/validateIsUrl.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const m=p(l).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("react"),a=require("styled-components"),n=require("../../add-variableV2/__stories__/AddVariableV2.stories.js"),i=require("../../add-variableV2/AddVariableV2SideModal.js"),o=require("../../dropdown/Dropdown.js"),s=require("../../input/Input.js"),u=require("../../template-preview/constants/regexPatterns.js"),r=require("../../template-preview/models/Channels.js"),d=require("../../TypographyStyle.js"),c=require("../../../utils/StringUtils.js"),v=require("../../../constants/Theme.js"),p=require("../context/templateModalContext.js"),m=require("../utils/getVariableNameEmail.js"),b=require("../utils/validateIsUrl.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const x=g(a).default.div`
2
2
  /* surface/$color-background-warning-light */
3
3
 
4
- background: ${e=>e.focused&&e.channel===a.CHANNEL_TYPE.EMAIL?r.COLORS.background.warning.light:"transparent"};
4
+ background: ${e=>e.focused&&e.channel===r.CHANNEL_TYPE.EMAIL?v.COLORS.background.warning.light:"transparent"};
5
5
  border-radius: 4px;
6
6
  padding: 8px 10px;
7
- `,b={value:"custom_link",label:"Custom URL"},g={value:"custom_text",label:"Custom text"};exports.Container=m,exports.default=l=>{let{onFocus:p,variable:E,index:_}=l;var x;const[j,A]=t.useState(!1),[P,N]=t.useState(""),[h,T]=t.useState([]),[f,y]=t.useState(),{device:L,channel:C,isError:O,originalVariableList:k,template:H,templateSelectionTriggered:S,setTemplate:Y,setDisplayContent:q,setOriginalVariableList:M,globalNormalizedPlaceholders:I}=d.useTemplateModalContext();function V(e,t){var l,n;const i="custom_link"===t?"link":"custom_text"===t?"string":t;if(C!==a.CHANNEL_TYPE.WHATSAPP){const n=c.getVariableNameForEmailByIndex(_+1),o=null===document||void 0===document?void 0:document.getElementById("mobile"===L?"template_html_mobile":"template_html_desktop"),u=C===a.CHANNEL_TYPE.EMAIL?null===(l=null==o?void 0:o.contentWindow)||void 0===l?void 0:l.document.getElementById(n):document.getElementById(n);u&&(u.textContent="custom_text"!==t&&"custom_link"!==t||e?e:E.variableName);const s=k.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:i,updatedValue:e}):t));null==M||M(s)}if(C===a.CHANNEL_TYPE.WHATSAPP){const t=null===(n=k.body)||void 0===n?void 0:n.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:i,updatedValue:e}):t));null==M||M((e=>Object.assign(Object.assign({},e),{body:t,buttons:k.buttons})))}}function W(e,t){var l;const n=Object.assign({},H),i=null===(l=null==n?void 0:n.components)||void 0===l?void 0:l.map((l=>{var n,i,o,a,u;const s=Object.assign({},l);if("BODY"===l.type&&(null===(i=null===(n=l.example)||void 0===n?void 0:n.body_text)||void 0===i?void 0:i[0])){const l=[...null!==(u=null===(a=null===(o=s.example)||void 0===o?void 0:o.body_text)||void 0===a?void 0:a[0])&&void 0!==u?u:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const n=Object.assign(Object.assign({},s.example),{body_text:[l]});return Object.assign(Object.assign({},s),{example:n})}return l}));n.components=i,null==Y||Y(n)}return t.useEffect((()=>{j&&(null==p||p())}),[j]),t.useEffect((()=>{!function(){var e,t,l,n,i;const o="mobile"===L?"template_html_mobile":"template_html_desktop",u=document.getElementById(o),s=(null!==(n=null===(l=null===(t=null===(e=null==u?void 0:u.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==n?n:"")+(null===(i=null==u?void 0:u.contentWindow)||void 0===i?void 0:i.document.head.innerHTML);C===a.CHANNEL_TYPE.EMAIL&&(null==q||q(s))}()}),[S]),t.useEffect((()=>{var e;const t=[];let l=[];if(C===a.CHANNEL_TYPE.MESSAGE){const e=null!=I?I:[];T([{label:"",options:[g,b]},...e]),l=[{label:"",options:[g,b]},...e]}else{"link"===(null==E?void 0:E.type)?(t.push({label:"",options:[b,g]}),y(b)):(t.push({label:"",options:[b,g]}),y(g));const e=null!=I?I:[];T([...t,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:s.default.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),l=[...t,...e]}if((C===a.CHANNEL_TYPE.WHATSAPP||C===a.CHANNEL_TYPE.EMAIL||C===a.CHANNEL_TYPE.MESSAGE)&&E.updatedValue)if(o.placeHolderNamePattern.test(E.updatedValue)&&C===a.CHANNEL_TYPE.WHATSAPP||E.updatedValue.startsWith("{{")&&C!==a.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){let n={label:"",value:""};const i=l===a.CHANNEL_TYPE.WHATSAPP?e.replace("[[","").replace("]]",""):e.replace("{{","").replace("}}","");return 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)}))})),n}(E.updatedValue,l,C);e.value&&y(e)}else(null===(e=E.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(y(b),N(E.updatedValue.split("https://")[1])):(y(g),N(E.updatedValue))}),[]),e.jsxs(m,Object.assign({channel:C,focused:j,onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(u.BodySecondary,Object.assign({style:{color:O&&!f?r.COLORS.content.negative:r.COLORS.content.primary}},{children:[null===(x=E.variableName)||void 0===x?void 0:x.replace("{{","").replace("}}","")," ","link"===(null==E?void 0:E.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(n.Dropdown,{options:h,isSearchable:!1,onSelect:function(e,t){var l,n,i;const o=e;N(""),y(o),C===a.CHANNEL_TYPE.WHATSAPP?"custom_text"!==o.value&&"custom_link"!==o.value?(V(null!==(l=o.value)&&void 0!==l?l:"","string"),null==W||W(null!==(n=E.index)&&void 0!==n?n:0,`[[${o.value}]]`)):(null==W||W(null!==(i=E.index)&&void 0!==i?i:0,E.variableName),V("","url"===o.bikPlaceholderType?"link":"string")):"custom_text"!==o.value&&"custom_link"!==o.value?V(o.value,"url"===o.bikPlaceholderType?"link":"string"):(N(""),V("",o.value))},defaultOptions:f?[Object.assign(Object.assign({},f),{selected:!0})]:[]})})),("custom_text"===(null==f?void 0:f.value)||"custom_link"===(null==f?void 0:f.value))&&e.jsx(i.Input,{labelText:"custom_text"===(null==f?void 0:f.value)?"Custom text value":"custom_link"===(null==f?void 0:f.value)?"Custom URL value":"",id:`variable-value-${null==f?void 0:f.value}-${_}`,value:P,errorMessage:O?P?"custom_link"!==f.value||v.validateIsUrl(P)?"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==f?void 0:f.value)?void 0:30,prefixText:"custom_link"===(null==f?void 0:f.value)?"https://":"",placeholder:"link"===E.type||"custom_link"===f.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,t){var l;N(t);const n="custom_link"===(null==f?void 0:f.value)?`https://${t}`:t;V(n,e),C===a.CHANNEL_TYPE.WHATSAPP&&(null==W||W(null!==(l=E.index)&&void 0!==l?l:0,n))}(f.value,e)})]}))};
7
+ `,_={value:"custom_link",label:"Custom URL"},E={value:"custom_text",label:"Custom text"};exports.Container=x,exports.default=a=>{let{onFocus:g,variable:h,index:j,showVariableModal:A}=a;var N;const[y,P]=l.useState(!1),[T,C]=l.useState(""),[f,L]=l.useState([]),[O,V]=l.useState(),[S,k]=l.useState(!1),H=[];H.push(n.customVariables),H.push(n.storeVariables),H.push(n.customerVariables),H.push(n.cartVariables),H.push(n.orderVariables);const{device:q,channel:M,isError:w,originalVariableList:I,template:Y,templateSelectionTriggered:W,setTemplate:B,setDisplayContent:R,setOriginalVariableList:U,globalNormalizedPlaceholders:$}=p.useTemplateModalContext();function D(e,t){var l,a,n;const i=e;C(""),V(i),M===r.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value?(z(null!==(l=i.value)&&void 0!==l?l:"","string"),null==F||F(null!==(a=h.index)&&void 0!==a?a:0,`[[${i.value}]]`)):(null==F||F(null!==(n=h.index)&&void 0!==n?n:0,h.variableName),z("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?z(i.value,"url"===i.bikPlaceholderType?"link":"string"):(C(""),z("",i.value))}function z(e,t){var l,a;const n="custom_link"===t?"link":"custom_text"===t?"string":t;if(M!==r.CHANNEL_TYPE.WHATSAPP){const a=m.getVariableNameForEmailByIndex(j+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===q?"template_html_mobile":"template_html_desktop"),o=M===r.CHANNEL_TYPE.EMAIL?null===(l=null==i?void 0:i.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);o&&(o.textContent="custom_text"!==t&&"custom_link"!==t||e?e:h.variableName);const s=I.map(((t,l)=>l===j?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==U||U(s)}if(M===r.CHANNEL_TYPE.WHATSAPP){const t=null===(a=I.body)||void 0===a?void 0:a.map(((t,l)=>l===j?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==U||U((e=>Object.assign(Object.assign({},e),{body:t,buttons:I.buttons})))}}function F(e,t){var l;const a=Object.assign({},Y),n=null===(l=null==a?void 0:a.components)||void 0===l?void 0:l.map((l=>{var a,n,i,o,s;const u=Object.assign({},l);if("BODY"===l.type&&(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=u.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({},u.example),{body_text:[l]});return Object.assign(Object.assign({},u),{example:a})}return l}));a.components=n,null==B||B(a)}return l.useEffect((()=>{y&&(null==g||g())}),[y]),l.useEffect((()=>{!function(){var e,t,l,a,n;const i="mobile"===q?"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);M===r.CHANNEL_TYPE.EMAIL&&(null==R||R(s))}()}),[W]),l.useEffect((()=>{var e;const t=[];let l=[];if(M===r.CHANNEL_TYPE.MESSAGE){const e=null!=$?$:[];L([{label:"",options:[E,_]},...e]),l=[{label:"",options:[E,_]},...e]}else{"link"===(null==h?void 0:h.type)?(t.push({label:"",options:[_,E]}),V(_)):(t.push({label:"",options:[_,E]}),V(E));const e=null!=$?$:[];L([...t,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:c.default.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),l=[...t,...e]}if((M===r.CHANNEL_TYPE.WHATSAPP||M===r.CHANNEL_TYPE.EMAIL||M===r.CHANNEL_TYPE.MESSAGE)&&h.updatedValue)if(u.placeHolderNamePattern.test(h.updatedValue)&&M===r.CHANNEL_TYPE.WHATSAPP||h.updatedValue.startsWith("{{")&&M!==r.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){let a={label:"",value:""};const n=l===r.CHANNEL_TYPE.WHATSAPP?e.replace("[[","").replace("]]",""):e.replace("{{","").replace("}}","");return t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===n.trim()&&(a=e)}))})),a}(h.updatedValue,l,M);e.value&&V(e)}else(null===(e=h.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(V(_),C(h.updatedValue.split("https://")[1])):(V(E),C(h.updatedValue))}),[]),e.jsxs(x,Object.assign({channel:M,focused:y,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(d.BodySecondary,Object.assign({style:{color:w&&!O?v.COLORS.content.negative:v.COLORS.content.primary}},{children:[null===(N=h.variableName)||void 0===N?void 0:N.replace("{{","").replace("}}","")," ","link"===(null==h?void 0:h.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:A?e.jsx(s.Input,{state:"none",value:O?O.label:"Custom text",onChangeText:()=>{},rightIcon:{icon:()=>e.jsx(t.default,{onClick:()=>{k(!S)},width:24,height:24,color:v.COLORS.content.primary})}}):e.jsx(o.Dropdown,{options:f,isSearchable:!1,onSelect:D,defaultOptions:O?[Object.assign(Object.assign({},O),{selected:!0})]:[]})})),("custom_text"===(null==O?void 0:O.value)||"custom_link"===(null==O?void 0:O.value))&&e.jsx(s.Input,{labelText:"custom_text"===(null==O?void 0:O.value)?"Custom text value":"custom_link"===(null==O?void 0:O.value)?"Custom URL value":"",id:`variable-value-${null==O?void 0:O.value}-${j}`,value:T,errorMessage:w?T?"custom_link"!==O.value||b.validateIsUrl(T)?"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==O?void 0:O.value)?void 0:30,prefixText:"custom_link"===(null==O?void 0:O.value)?"https://":"",placeholder:"link"===h.type||"custom_link"===O.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,t){var l;C(t);const a="custom_link"===(null==O?void 0:O.value)?`https://${t}`:t;z(a,e),M===r.CHANNEL_TYPE.WHATSAPP&&(null==F||F(null!==(l=h.index)&&void 0!==l?l:0,a))}(O.value,e)}),S&&e.jsx(i.AddVariableV2SideModal,{data:H,showVariable:S,setShowVariable:k,placeholder:"Add a variable",customTrigger:e=>{console.log("variable: ",e),"{{custom.url}}"===e.actualValue?D({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?D({label:e.displayName,selected:!0,value:"custom_text"}):D({label:e.displayName,selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
@@ -6,6 +6,7 @@ export interface VariableConnectorWhatsAppProps {
6
6
  descriptionComponent: ComponentType;
7
7
  variableMapping: string[] | undefined;
8
8
  type: ComponentType['type'];
9
+ showVariableModal?: boolean;
9
10
  }
10
- declare const VariableConnectorWhatsApp: ({ descriptionComponent, type, }: VariableConnectorWhatsAppProps) => JSX.Element;
11
+ declare const VariableConnectorWhatsApp: ({ descriptionComponent, type, showVariableModal, }: VariableConnectorWhatsAppProps) => JSX.Element;
11
12
  export default VariableConnectorWhatsApp;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../input/Input.js"),r=require("../../TypographyStyle.js"),a=require("../../../constants/Theme.js"),i=require("../context/templateModalContext.js"),n=require("./VariableConnector.js");exports.default=s=>{let{descriptionComponent:l,type:o}=s;var d;const{originalVariableList:p}=i.useTemplateModalContext();return"BODY"===l.type?e.jsx("div",{children:null===(d=null==p?void 0:p.body)||void 0===d?void 0:d.map(((i,s)=>i.isEditableVariable?e.jsx(n.default,{index:s,variable:i},`${s}-${i.index}`):e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(r.BodySecondary,Object.assign({style:{color:a.COLORS.content.primary}},{children:["HEADER"===o?"Header":""," Locked variable ",s+1]})),e.jsx(t.Input,{state:"disabled",placeholder:i.variableName,onChangeText:()=>{}})]}),s)))}):e.jsx(e.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../input/Input.js"),a=require("../../TypographyStyle.js"),t=require("../../../constants/Theme.js"),i=require("../context/templateModalContext.js"),s=require("./VariableConnector.js");exports.default=l=>{let{descriptionComponent:n,type:o,showVariableModal:d}=l;var p;const{originalVariableList:u}=i.useTemplateModalContext();return"BODY"===n.type?e.jsx("div",{children:null===(p=null==u?void 0:u.body)||void 0===p?void 0:p.map(((i,l)=>i.isEditableVariable?e.jsx(s.default,{index:l,variable:i,showVariableModal:d},`${l}-${i.index}`):e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(a.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:["HEADER"===o?"Header":""," Locked variable ",l+1]})),e.jsx(r.Input,{state:"disabled",placeholder:i.variableName,onChangeText:()=>{}})]}),l)))}):e.jsx(e.Fragment,{})};
@@ -2,6 +2,7 @@
2
2
  export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export interface VariableConnectorsProps {
4
4
  onFocus?: (variableIndex: number) => void;
5
+ showVariableModal?: boolean;
5
6
  }
6
- declare const VariableConnectors: ({ onFocus }: VariableConnectorsProps) => JSX.Element;
7
+ declare const VariableConnectors: ({ onFocus, showVariableModal, }: VariableConnectorsProps) => JSX.Element;
7
8
  export default VariableConnectors;
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),i=require("styled-components"),s=require("../../input/Input.js"),n=require("../../template-preview/models/Channels.js"),r=require("../../tooltips/Tooltip.js"),l=require("../../TypographyStyle.js"),a=require("../../../constants/Theme.js"),o=require("../context/templateModalContext.js"),c=require("./VariableConnector.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const u=d(i).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),i=require("styled-components"),s=require("../../input/Input.js"),a=require("../../template-preview/models/Channels.js"),l=require("../../tooltips/Tooltip.js"),n=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),o=require("../context/templateModalContext.js"),d=require("./VariableConnector.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const u=c(i).default.div`
2
2
  overflow-y: auto;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  height: 100%;
6
- `;exports.Container=u,exports.default=i=>{let{onFocus:d}=i;const{originalVariableList:p,channel:j}=o.useTemplateModalContext();return e.jsxs(u,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8}},{children:[e.jsx(l.TitleRegular,Object.assign({style:{color:a.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(r.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",{children:e.jsx(t.default,{width:20,height:20,color:a.COLORS.content.placeholder})})}))]})),e.jsx(l.BodySecondary,Object.assign({style:{color:a.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==p?void 0:p.map(((t,i)=>j!==n.CHANNEL_TYPE.EMAIL||t.isEditableVariable?e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(c.default,{index:i,variable:t,onFocus:()=>null==d?void 0:d(i)})}),i):e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(l.BodySecondary,Object.assign({style:{color:a.COLORS.content.primary}},{children:["Locked variable ",i+1]})),e.jsx(s.Input,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),i)))]})};
6
+ `;exports.Container=u,exports.default=i=>{let{onFocus:c,showVariableModal:p}=i;const{originalVariableList:h,channel:j}=o.useTemplateModalContext();return e.jsxs(u,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8}},{children:[e.jsx(n.TitleRegular,Object.assign({style:{color:r.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(l.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",{children:e.jsx(t.default,{width:20,height:20,color:r.COLORS.content.placeholder})})}))]})),e.jsx(n.BodySecondary,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==h?void 0:h.map(((t,i)=>j!==a.CHANNEL_TYPE.EMAIL||t.isEditableVariable?e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(d.default,{index:i,variable:t,onFocus:()=>null==c?void 0:c(i),showVariableModal:p})}),i):e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(n.BodySecondary,Object.assign({style:{color:r.COLORS.content.primary}},{children:["Locked variable ",i+1]})),e.jsx(s.Input,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),i)))]})};
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ export interface VariableListInterfaceV2 {
3
+ payloadVariables: PayloadVariables;
4
+ }
5
+ export interface PayloadVariables {
6
+ displayName: string;
7
+ description: string;
8
+ orderId: number;
9
+ variables?: any;
10
+ }
11
+ export interface Variable {
12
+ description?: string;
13
+ displayName: string;
14
+ actualValue: string;
15
+ variableType: string;
16
+ isAvailable: boolean;
17
+ isSubHeader?: boolean;
18
+ variables?: {
19
+ [key: string]: Variable;
20
+ };
21
+ }
22
+ export interface AddVariableProps {
23
+ data: VariableListInterfaceV2[];
24
+ showVariable: any;
25
+ setShowVariable: any;
26
+ variableValue?: any;
27
+ setVariableValue?: any;
28
+ placeholder: string;
29
+ customTrigger?: any;
30
+ isSearchRequired?: boolean;
31
+ leftPosition?: number;
32
+ pickerSize?: string;
33
+ }
34
+ type Props = AddVariableProps;
35
+ export interface VariableBoxProps {
36
+ item: Variable;
37
+ raw?: string;
38
+ parentKey?: string;
39
+ }
40
+ declare const AddVariableV2: React.FC<Props>;
41
+ export default AddVariableV2;
@@ -0,0 +1 @@
1
+ import{jsx as a,jsxs as i,Fragment as e}from"react/jsx-runtime";import{useState as s,useEffect as l}from"react";import{AddVariableStyled as r}from"./AddVariableV2.styled.js";import c from"./backIcon.js";import d from"./closeIcon.js";import n from"./plusIcon.js";import{RightFilled as t}from"./rightFilled.js";import o from"./undoIcon.js";import{Button as b}from"../button/Button.js";import{IconButton as m}from"../icon-button/IconButton.js";import{SearchBar as p}from"../searchBar/searchBar.js";import{TitleSmall as v,BodyCaption as g}from"../TypographyStyle.js";const y=y=>{const{data:h}=y,[j,u]=s({}),[V,O]=s(),[N,_]=s(""),[f,k]=s("");l((()=>{const a={};h.forEach((i=>{a[i.payloadVariables.displayName]=[]})),O(a)}),[h]);const S=(a,i)=>{const e=h.find((a=>a.payloadVariables.displayName===i));if(e){let s=e.payloadVariables;a.forEach(((a,i)=>{s=s.variables[a]})),u((a=>Object.assign(Object.assign({},a),{[i]:s})))}},T=i=>a(b,{disabled:!i.item.isAvailable,size:"chip",LeadingIcon:i.item.isSubHeader?void 0:n,TrailingIcon:()=>i.item.isSubHeader?a("div",Object.assign({className:"icon-trailing",style:{display:"flex"}},{children:a(t,{})})):a(e,{}),buttonText:i.item.displayName}),I=(i,e)=>a("div",Object.assign({onClick:i.isSubHeader?()=>{const a=[...V[N],e];S(a,N),O((i=>Object.assign(Object.assign({},i),{[N]:a})))}:()=>{y.customTrigger?(y.customTrigger(i),y.setShowVariable(!1)):y.setVariableValue(i.actualValue)}},{children:a(T,{item:i})}));return a(r,Object.assign({id:"varList",onClick:a=>{a.stopPropagation()},pickerSize:y.pickerSize||"large"},{children:y.showVariable&&i("div",Object.assign({className:"popup"},{children:[i("div",Object.assign({className:"sticky__bar"},{children:[i("div",Object.assign({className:"header__bar"},{children:[a("div",Object.assign({className:"add__variable"},{children:"Add a new variable"})),a("div",Object.assign({className:"close__icon",style:{cursor:"pointer"},onClick:()=>{y.setShowVariable(!1)}},{children:a(d,{})}))]})),a("div",Object.assign({className:"search__bar"},{children:a(p,{width:"100%",isEnabled:!0,onChange:a=>{k(a)},onEnter:()=>{},placeholder:"Search...",variant:"default"})})),N&&V[N].length>0&&i("div",Object.assign({className:"nav__bar",style:{marginTop:8}},{children:[i("div",Object.assign({className:"left__nav"},{children:[a(m,{Icon:c,style:{color:"#919191",display:"flex"},onClick:()=>{const a=V[N].slice(0,-1);S(a,N),O((i=>Object.assign(Object.assign({},i),{[N]:a}))),a.length||_("")}}),i("div",Object.assign({className:"block"},{children:[a(v,{children:j[N].displayName}),j[N].description&&a(g,{children:j[N].description})]}))]})),i("div",Object.assign({className:"right__nav"},{children:[a(m,{Icon:o,style:{display:"flex"},onClick:()=>{S([],N),O((a=>Object.assign(Object.assign({},a),{[N]:[]}))),_("")}}),a("div",{children:"First page"})]}))]}))]})),a("div",Object.assign({className:"wrapper"},{children:a("div",Object.assign({className:"list__map"},{children:i("div",Object.assign({className:"items"},{children:[!N&&y.data.map(((s,l)=>{var r,c,d,n;let t=[];return f&&(t=Object.keys(s.payloadVariables.variables).filter((a=>{var i;return null===(i=s.payloadVariables.variables[a].displayName)||void 0===i?void 0:i.includes(f)}))),i(e,{children:[f?t.length>0?i("div",Object.assign({className:"block"},{children:[a("div",Object.assign({className:"heading__font"},{children:null===(r=null==s?void 0:s.payloadVariables)||void 0===r?void 0:r.displayName})),a(g,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null===(c=null==s?void 0:s.payloadVariables)||void 0===c?void 0:c.description}))]})):a(e,{}):i("div",Object.assign({className:"block"},{children:[a("div",Object.assign({className:"heading__font"},{children:null===(d=null==s?void 0:s.payloadVariables)||void 0===d?void 0:d.displayName})),a(g,Object.assign({style:{marginBottom:8,color:"#616161"}},{children:null===(n=null==s?void 0:s.payloadVariables)||void 0===n?void 0:n.description}))]})),Object.keys(s.payloadVariables.variables).map((i=>{var l;return f?(null===(l=s.payloadVariables.variables[i].displayName)||void 0===l?void 0:l.includes(f))?a("div",Object.assign({onClick:s.payloadVariables.variables[i].isSubHeader?()=>{const a=[...V[s.payloadVariables.displayName],i];S(a,s.payloadVariables.displayName),O((i=>Object.assign(Object.assign({},i),{[s.payloadVariables.displayName]:a}))),_(s.payloadVariables.displayName)}:()=>{y.customTrigger?(y.customTrigger(s.payloadVariables.variables[i]),y.setShowVariable(!1)):y.setVariableValue(s.payloadVariables.variables[i].actualValue)}},{children:a(T,{item:s.payloadVariables.variables[i]})})):a(e,{}):a("div",Object.assign({onClick:s.payloadVariables.variables[i].isSubHeader?()=>{const a=[...V[s.payloadVariables.displayName],i];S(a,s.payloadVariables.displayName),O((i=>Object.assign(Object.assign({},i),{[s.payloadVariables.displayName]:a}))),_(s.payloadVariables.displayName)}:()=>{y.customTrigger?(y.customTrigger(s.payloadVariables.variables[i]),y.setShowVariable(!1)):y.setVariableValue(s.payloadVariables.variables[i].actualValue)}},{children:a(T,{item:s.payloadVariables.variables[i]})}))}))]})})),N&&a("div",Object.assign({className:"list__map"},{children:a("div",Object.assign({className:"items",style:{marginTop:16}},{children:Object.keys(j[N].variables).map(((i,s)=>{var l;return f?(null===(l=j[N].variables[i].displayName)||void 0===l?void 0:l.includes(f))?I(j[N].variables[i],i):a(e,{}):I(j[N].variables[i],i)}))}))}))]}))}))})),a("div",{className:"bottom__padding"})]}))}))};export{y as default};
@@ -0,0 +1,6 @@
1
+ export declare const AddVariableStyled: import("styled-components").StyledComponent<"div", any, {
2
+ pickerSize: string;
3
+ }, never>;
4
+ export declare const VariableBoxStyled: import("styled-components").StyledComponent<"div", any, {
5
+ isAvailable?: boolean | undefined;
6
+ }, never>;
@@ -0,0 +1,161 @@
1
+ import e from"styled-components";const o=e.div`
2
+ position: fixed;
3
+ z-index: 10;
4
+ *::-webkit-scrollbar {
5
+ display: none;
6
+ }
7
+ * {
8
+ -ms-overflow-style: none;
9
+ scrollbar-width: none;
10
+ }
11
+ .popup {
12
+ background: white;
13
+ width: 566px;
14
+ height: 100vh;
15
+ border-radius: 8px;
16
+ overflow-y: scroll;
17
+ .sticky__bar {
18
+ z-index: 10;
19
+ position: sticky;
20
+ top: 0;
21
+ background: white;
22
+
23
+ .header__bar {
24
+ display: flex;
25
+ justify-content: space-between;
26
+ align-items: center;
27
+ padding: 24px 24px 16px 24px;
28
+ border-bottom: 1px solid var(--stroke-color-stroke-primary, #e0e0e0);
29
+ .add__variable {
30
+ font-family: 'Inter';
31
+ font-style: normal;
32
+ font-weight: 600;
33
+ font-size: 20px;
34
+ line-height: 24px;
35
+
36
+ color: #212121;
37
+ }
38
+ }
39
+
40
+ .search__bar {
41
+ padding: 24px 24px 8px 24px;
42
+ }
43
+ .nav__bar {
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: center;
47
+ border-bottom: 1px solid var(--stroke-color-stroke-primary, #e0e0e0);
48
+ background: var(--surface-color-surface-hovered, #f0f0f0);
49
+ padding: 10px 24px;
50
+
51
+ font-family: Inter;
52
+ font-size: 14px;
53
+ font-style: normal;
54
+
55
+ line-height: 20px;
56
+
57
+ .left__nav {
58
+ display: flex;
59
+ align-items: center;
60
+ gap: 8px;
61
+ color: var(--content-color-content-primary, #212121);
62
+ cursor: pointer;
63
+ }
64
+ .right__nav {
65
+ display: flex;
66
+ align-items: center;
67
+ gap: 8px;
68
+ font-weight: 400;
69
+ color: var(--content-color-content-secondary, #616161);
70
+ cursor: pointer;
71
+ }
72
+ }
73
+ }
74
+ hr {
75
+ margin: 0;
76
+ border: 0.2px solid #e0e0e0;
77
+ }
78
+ .wrapper {
79
+ padding: 4px 24px 16px 24px;
80
+ .search__bar {
81
+ padding-bottom: 16px;
82
+ input {
83
+ width: 100%;
84
+ padding: 6px 8px;
85
+ border: 1px solid #e0e0e0;
86
+ border-radius: 4px;
87
+ background-image: url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F5bc8962e-af88-4692-80f1-631ac4a5c6c7?alt=media&token=7931b07d-cb55-43aa-be75-9ddac4b8ddad');
88
+ background-repeat: no-repeat;
89
+ background-position: 95% 50%;
90
+ background-size: 20px 20px;
91
+ }
92
+ }
93
+ .heading__font {
94
+ font-family: 'Inter';
95
+ font-style: normal;
96
+ font-weight: 600;
97
+ font-size: 16px;
98
+ line-height: 24px;
99
+ padding: 12px 0 0 0;
100
+ color: #212121;
101
+ }
102
+ .sub_heading__font {
103
+ font-family: 'Inter';
104
+ font-style: normal;
105
+ font-size: 12px;
106
+ line-height: 24px;
107
+ color: #212121;
108
+ }
109
+
110
+ .items {
111
+ display: flex;
112
+ flex-wrap: wrap;
113
+ grid-gap: 8px;
114
+ .block {
115
+ display: block;
116
+ min-width: 100%;
117
+ flex-wrap: nowrap;
118
+ width: 430px;
119
+ }
120
+ }
121
+ }
122
+ position: relative;
123
+
124
+ .bottom__padding {
125
+ background: white;
126
+ min-height: 30px;
127
+ width: 100%;
128
+ position: sticky;
129
+ z-index: 10;
130
+ bottom: 0px;
131
+ }
132
+ }
133
+ `;e.div`
134
+ .box {
135
+ display: flex;
136
+ align-items: center;
137
+ cursor: pointer;
138
+ padding: 6px 12px 6px 8px;
139
+ gap: 8px;
140
+ width: auto;
141
+ height: 32px;
142
+
143
+ background: ${e=>(null==e?void 0:e.isAvailable)?"#f0f0f0":"#fafafa"};
144
+
145
+ border: 1px solid #e0e0e0;
146
+ border-radius: 4px;
147
+ .icon {
148
+ color: ${e=>(null==e?void 0:e.isAvailable)?"#212121":"#bdbdbd"};
149
+ display: flex;
150
+ align-items: center;
151
+ }
152
+ .variable__name {
153
+ font-family: 'Inter';
154
+ font-style: normal;
155
+ font-weight: 400;
156
+ font-size: 14px;
157
+ line-height: 20px;
158
+ color: ${e=>(null==e?void 0:e.isAvailable)?"#212121":"#bdbdbd"};
159
+ }
160
+ }
161
+ `;export{o as AddVariableStyled};
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { VariableListInterfaceV2 } from "./AddVariableV2";
3
+ export interface VariableV2SideModalProps {
4
+ data: VariableListInterfaceV2[];
5
+ showVariable: any;
6
+ setShowVariable: any;
7
+ variableValue?: any;
8
+ setVariableValue?: any;
9
+ placeholder: string;
10
+ customTrigger?: any;
11
+ isSearchRequired?: boolean;
12
+ leftPosition?: number;
13
+ pickerSize?: string;
14
+ }
15
+ export declare const AddVariableV2SideModal: React.FC<VariableV2SideModalProps>;
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import a from"react-dom";import e from"./AddVariableV2.js";import{SideModalStyle as o,SideModalContainer as t}from"../side-modal/SideModal.style.js";const i=i=>a.createPortal(r(o,{children:r(t,{children:r(e,{data:i.data,showVariable:i.showVariable,setShowVariable:i.setShowVariable,placeholder:"Add a variable",customTrigger:i.customTrigger})})}),document.body);export{i as AddVariableV2SideModal};