@bikdotai/bik-component-library 0.0.394-beta.8 → 0.0.394

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 (87) hide show
  1. package/dist/cjs/components/add-variableV2/AddVariableV2.d.ts +0 -1
  2. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  3. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +6 -14
  4. package/dist/cjs/components/input-with-vars/InputWithVariables.js +3 -3
  5. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +3 -7
  6. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  7. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +1 -5
  8. package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +0 -2
  9. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
  10. package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.d.ts +0 -1
  11. package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +2 -2
  12. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.d.ts +0 -3
  13. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  14. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +0 -2
  15. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  16. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -4
  17. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  18. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.d.ts +0 -1
  19. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
  20. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +1 -3
  21. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  22. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -3
  23. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  24. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  25. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -4
  26. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  27. package/dist/cjs/components/template-preview/TemplatePreview.d.ts +1 -2
  28. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  29. package/dist/cjs/components/template-preview/WhatsApp/ChatBtn.js +1 -1
  30. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +5 -5
  31. package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +2 -2
  32. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.d.ts +0 -1
  33. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  34. package/dist/cjs/components/template-preview/constants/regexPatterns.js +1 -1
  35. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -6
  36. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  37. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +6 -25
  38. package/dist/esm/components/add-variableV2/AddVariableV2.d.ts +0 -1
  39. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  40. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +6 -14
  41. package/dist/esm/components/input-with-vars/InputWithVariables.js +3 -3
  42. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +3 -7
  43. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  44. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +1 -5
  45. package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +0 -2
  46. package/dist/esm/components/template-context-mapper/modalElements/Body.js +4 -4
  47. package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.d.ts +0 -1
  48. package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +4 -4
  49. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.d.ts +0 -3
  50. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  51. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +0 -2
  52. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  53. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +1 -4
  54. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  55. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.d.ts +0 -1
  56. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +4 -4
  57. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +1 -3
  58. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  59. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +1 -3
  60. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +2 -2
  61. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  62. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -4
  63. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  64. package/dist/esm/components/template-preview/TemplatePreview.d.ts +1 -2
  65. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  66. package/dist/esm/components/template-preview/WhatsApp/ChatBtn.js +1 -1
  67. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +1 -1
  68. package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +4 -4
  69. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.d.ts +0 -1
  70. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  71. package/dist/esm/components/template-preview/constants/regexPatterns.js +1 -1
  72. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +1 -6
  73. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  74. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +6 -25
  75. package/package.json +1 -1
  76. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.d.ts +0 -4
  77. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +0 -1
  78. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +0 -6
  79. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +0 -1
  80. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.d.ts +0 -11
  81. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +0 -1
  82. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.d.ts +0 -4
  83. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +0 -1
  84. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +0 -6
  85. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +0 -1
  86. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.d.ts +0 -11
  87. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +0 -1
@@ -7,7 +7,6 @@ export interface VariableListInterfaceV2 {
7
7
  }
8
8
  export interface Variable {
9
9
  description?: string;
10
- defaultValue?: string;
11
10
  displayName: string;
12
11
  actualValue: string;
13
12
  variableType: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1,20 +1,12 @@
1
- /// <reference types="react" />
2
- import { Variable } from '../add-variableV2/AddVariableV2';
3
1
  import { SelectedVariable } from '../add-variableV2/types';
4
- interface InputWithVariablesProps {
2
+ export declare const InputWithVariables: (props: {
5
3
  variablesList: any;
6
4
  onChange: (val: SelectedVariable) => void;
7
- onBlur?: (e: Event, val?: SelectedVariable | Variable) => void;
8
5
  addVarBoxRight: string;
9
6
  allowMix: boolean;
10
7
  prevVariable: SelectedVariable;
11
- showHelp?: boolean;
12
- onlyVariables?: boolean;
13
- showSideVariablePanel?: boolean;
14
- placeHolder?: string;
15
- showAddButton?: boolean;
16
- errorMessage?: string;
17
- showSideModal?: boolean;
18
- }
19
- export declare const InputWithVariables: React.FC<InputWithVariablesProps>;
20
- export {};
8
+ showHelp?: boolean | undefined;
9
+ onlyVariables?: boolean | undefined;
10
+ showSideModal?: boolean | undefined;
11
+ errorMessage?: string | undefined;
12
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),i=require("uuid"),d=require("../../constants/Theme.js"),t=require("../add-variableV2/AddVariableBox.styled.js"),s=require("../add-variableV2/AddVariableV2.js"),u=require("../input/Input.js"),o=require("../TypographyStyle.js"),n=require("../add-variableV2/AddVariableV2SideModal.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const v=c(r).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),i=require("uuid"),d=require("../add-variableV2/AddVariableV2SideModal.js"),t=require("../add-variableV2/AddVariableV2.js"),s=require("../../constants/Theme.js"),u=require("../add-variableV2/AddVariableBox.styled.js"),o=require("../input/Input.js"),n=require("../TypographyStyle.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const v=c(r).default.div`
2
2
  margin-bottom: 16px;
3
3
  input {
4
- color: ${e=>e.isVar?d.COLORS.stroke.brand:"black"};
4
+ color: ${e=>e.isVar?s.COLORS.stroke.brand:"black"};
5
5
  }
6
- `;exports.InputWithVariables=r=>{let{addVarBoxRight:d,allowMix:c,onChange:b,prevVariable:g,variablesList:V,onBlur:h,onlyVariables:p,placeHolder:T,showAddButton:j=!0,showHelp:x,showSideVariablePanel:y,errorMessage:f,showSideModal:S}=r;const m=l.useRef(null),[q,w]=l.useState(!1),[A]=l.useState(i.v4()),[O,C]=l.useState(),[B,N]=l.useState(g),[M,k]=l.useState(!1),[I,F]=l.useState(!1),[L,E]=l.useState(f||"");return l.useEffect((()=>{O&&O.actualValue&&N(c?e=>({actualValue:e.actualValue+O.actualValue,variableType:"string"}):e=>({actualValue:O.actualValue,variableType:O.variableType,needsFetching:O.needsFetching}))}),[O]),l.useEffect((()=>{b(B)}),[B]),e.jsxs(e.Fragment,{children:[e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(B.actualValue)},{children:[e.jsx(u.Input,{id:A,ref:m,skipFocus:!0,textControl:!0,isActive:q,value:B.actualValue,validate:e=>[!0,""],errorMessage:L,placeholder:T||"Add a value",onChangeText:(e,a)=>{if(E(""),p){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||N({actualValue:"",variableType:"string"})}else N(c?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{var a;w(!0),F(!0),"Search..."!==(null===(a=e.relatedTarget)||void 0===a?void 0:a.placeholder)||M||k(!0)},onBlur:e=>{var a,l,r,i,d,t,s;null==h||h(e,B),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(t=null===(d=e.relatedTarget)||void 0===d?void 0:d.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?(m.current&&m.current.focus(),w(!0)):"Search..."===(null===(s=e.relatedTarget)||void 0===s?void 0:s.placeholder)?w(!0):(w(!1),k(!1),F(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[B.actualValue&&x&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(o.BodyCaption,{children:`This value is of type ${B.variableType}`})})),j&&I&&e.jsx("div",Object.assign({style:{marginTop:f?"-24px":"0px"}},{children:e.jsx(t.AddVariableStyled,Object.assign({right:d,id:"addVar",onClick:()=>{k(!M)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!y&&M&&e.jsx(s.AddVariableV2,{data:V,showVariable:!0,setShowVariable:()=>{k(!1)},variableValue:O,setVariableValue:C,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?m.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==A&&(k(!1),F(!1),w(!1)):(k(!1),F(!1),w(!1))}})]})),y&&M&&e.jsx(n.AddVariableV2SideModal,{zIndex:2e3,data:null!=V?V:[],showVariable:M,setShowVariable:()=>{k(!1)},placeholder:"Add a variable",customTrigger:e=>{C({actualValue:e.actualValue,variableType:"string"}),N(e)},onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?m.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==A&&(k(!1),F(!1),w(!1)):(k(!1),F(!1),w(!1))}})]})};
6
+ `;exports.InputWithVariables=r=>{var s;const c=l.useRef(null),[b,g]=l.useState(!1),[V]=l.useState(i.v4()),[p,h]=l.useState(),[T,j]=l.useState(r.prevVariable),[x,y]=l.useState(!1),[f,S]=l.useState(!1),[m,q]=l.useState("");return l.useEffect((()=>{p&&p.actualValue&&(r.allowMix?j((e=>({actualValue:e.actualValue+p.actualValue,variableType:"string"}))):j((e=>({actualValue:p.actualValue,variableType:p.variableType,needsFetching:p.needsFetching}))))}),[p]),l.useEffect((()=>{r.onChange(T)}),[T]),l.useEffect((()=>{(null==r?void 0:r.errorMessage)&&q(null==r?void 0:r.errorMessage)}),[null==r?void 0:r.errorMessage]),e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(T.actualValue)},{children:[e.jsx(o.Input,{id:V,ref:c,skipFocus:!0,textControl:!0,isActive:b,value:T.actualValue,validate:e=>[!0,""],errorMessage:m,placeholder:"Add a value",onChangeText:function(e,a){if(q(""),r.onlyVariables){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!=e&&46!=e||j({actualValue:"",variableType:"string"})}else r.allowMix?j({actualValue:e,variableType:"string"}):j({actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{var a;g(!0),S(!0),"Search..."!==(null===(a=e.relatedTarget)||void 0===a?void 0:a.placeholder)||x||y(!0)},onBlur:e=>{var a,l,r,i,d,t,s;"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(t=null===(d=e.relatedTarget)||void 0===d?void 0:d.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?(c.current&&c.current.focus(),g(!0)):"Search..."===(null===(s=e.relatedTarget)||void 0===s?void 0:s.placeholder)?g(!0):(g(!1),y(!1),S(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[T.actualValue&&r.showHelp?e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(n.BodyCaption,{children:`This value is of type ${T.variableType}`})})):e.jsx("div",{}),f&&e.jsx("div",Object.assign({style:{marginTop:m?"-24px":"0px"}},{children:e.jsx(u.AddVariableStyled,Object.assign({right:r.addVarBoxRight,id:"addVar",onClick:()=>{y(!x)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),x&&!r.showSideModal&&e.jsx(t.AddVariableV2,{data:r.variablesList,showVariable:!0,setShowVariable:()=>{y(!1)},variableValue:p,setVariableValue:h,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?c.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==V&&(y(!1),S(!1),g(!1)):(y(!1),S(!1),g(!1))}}),x&&r.showSideModal&&e.jsx(d.AddVariableV2SideModal,{zIndex:2e3,data:null!==(s=r.variablesList)&&void 0!==s?s:[],showVariable:x,setShowVariable:()=>{y(!1)},placeholder:"Add a variable",customTrigger:e=>{h({actualValue:e.actualValue,variableType:"string"})},onSearchBlur:e=>{var a,l,r,i,d,t;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?c.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==V&&(y(!1),S(!1),g(!1)):(y(!1),S(!1),g(!1))}})]}))};
@@ -3,7 +3,7 @@ import { CHANNEL_TYPE } from '../template-preview/models/Channels';
3
3
  import { EmailTemplateType } from '../template-preview/models/EmailTemplate';
4
4
  import { SMSTemplateType } from '../template-preview/models/SmsTemplate';
5
5
  import { CUSTOM_VARIABLE, GlobalPlaceholderType } from '../template-preview/models/TemplateMeta';
6
- import { Extras, WhatsAppPickerMeta, WhatsAppTemplate, WhatsAppTemplateVariables } from '../template-preview/models/WhatsAppTemplate';
6
+ import { WhatsAppPickerMeta, WhatsAppTemplate, WhatsAppTemplateVariables } from '../template-preview/models/WhatsAppTemplate';
7
7
  export interface TemplateContextMapperProps {
8
8
  selectedTemplate: WhatsAppTemplate | EmailTemplateType | SMSTemplateType;
9
9
  closeDialog?: () => void;
@@ -11,7 +11,7 @@ export interface TemplateContextMapperProps {
11
11
  channel: CHANNEL_TYPE;
12
12
  globalPlaceholders: GlobalPlaceholderType;
13
13
  /** List of variables being used in this template */
14
- templateVariables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables;
14
+ templateVariables: CUSTOM_VARIABLE[];
15
15
  /** Only for initial-UI-purpose for the modal */
16
16
  htmlContent: string;
17
17
  showOnlyContent?: boolean;
@@ -20,14 +20,10 @@ export interface TemplateContextMapperProps {
20
20
  zIndex?: number;
21
21
  showVariableModal?: boolean;
22
22
  variableList?: VariableListInterfaceV2[];
23
- variableListForImage?: VariableListInterfaceV2[];
24
23
  onBackPress?: () => void;
25
24
  discountCode?: string;
26
25
  setDiscountCode?: (code: string) => void;
27
26
  enabledCustomText?: boolean;
28
- showSampleValues?: boolean;
29
27
  disableEditVariable?: boolean;
30
- pod?: string;
31
- extras?: Extras;
32
28
  }
33
- export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, disableEditVariable, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("./context/templateModalContext.js"),o=require("./modalElements/Footer.js"),r=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:m,htmlContent:h,templateVariables:b,onTemplateSelect:g,globalPlaceholders:v,showOnlyContent:C,whatsappSpecificPickerMeta:S,zIndex:x,showVariableModal:T,variableList:E,discountCode:j,setDiscountCode:M,onBackPress:P,enabledCustomText:L,variableListForImage:w,showSampleValues:f,disableEditVariable:V,pod:q,extras:y}=d;var A,N;t.useEffect((()=>{_(h)}),[h]);const[I,k]=t.useState(m===s.CHANNEL_TYPE.EMAIL?"desktop":"mobile"),[D,_]=t.useState(h),[H,O]=t.useState(!1),[F,B]=t.useState(u),[Y,z]=t.useState(null!=b?b:[]),[$,U]=t.useState(!1);const W=t.useMemo((()=>n.convertPlaceholdersToBikDropdown(v)),[v]);return e.jsx(i.TemplateModalContext.Provider,Object.assign({value:{template:F,setTemplate:B,device:I,setDevice:k,display_content:D,setDisplayContent:_,originalVariableList:Y,setOriginalVariableList:z,isError:H,setIsError:O,channel:m,globalNormalizedPlaceholders:W,templateSelectionTriggered:$,setTemplateSelectionTriggered:U,enabledCustomText:L,disableEditVariable:V,pod:q,extras:y}},{children:C?e.jsx(r.default,{channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:x,centralContainerStyles:{width:m===s.CHANNEL_TYPE.EMAIL&&p?1e3:700},open:!0,onClose:()=>{null==c||c()},headingTitle:null==F?void 0:F.label,headingSubtitle:m===s.CHANNEL_TYPE.WHATSAPP?`${l.default.capitaliseFirstLetterOfString(null!==(A=null==F?void 0:F.category)&&void 0!==A?A:"")} • ${null!==(N=null==F?void 0:F.templateCategory)&&void 0!==N?N:""}`:"",onBackPress:()=>{null==P||P()}},{children:[e.jsx(r.default,{showSampleValues:f,showVariableMapping:p,channel:m,whatsappSpecificPickerMeta:S,showVariableModal:T,variableList:E,discountCode:j,setDiscountCode:M,variableListForImage:w&&(null==w?void 0:w.length)>0?w:E}),g?e.jsx(o.default,{onSelect:function(){const e=null==g?void 0:g(F,Y,null!=D?D:"");e?O(!!e):U(!0)}}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("./context/templateModalContext.js"),o=require("./modalElements/Footer.js"),r=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:c,closeDialog:u,showVariableMapping:p,channel:m,htmlContent:b,templateVariables:h,onTemplateSelect:C,globalPlaceholders:g,showOnlyContent:S,whatsappSpecificPickerMeta:T,zIndex:v,showVariableModal:E,variableList:j,discountCode:x,setDiscountCode:M,onBackPress:P,enabledCustomText:L,disableEditVariable:f}=d;var w,q;t.useEffect((()=>{V(b)}),[b]);const[y,A]=t.useState(m===s.CHANNEL_TYPE.EMAIL?"desktop":"mobile"),[N,V]=t.useState(b),[k,D]=t.useState(!1),[_,H]=t.useState(c),[I,O]=t.useState(null!=h?h:[]),[B,Y]=t.useState(!1);const z=t.useMemo((()=>n.convertPlaceholdersToBikDropdown(g)),[g]);return e.jsx(i.TemplateModalContext.Provider,Object.assign({value:{template:_,setTemplate:H,device:y,setDevice:A,display_content:N,setDisplayContent:V,originalVariableList:I,setOriginalVariableList:O,isError:k,setIsError:D,channel:m,globalNormalizedPlaceholders:z,templateSelectionTriggered:B,setTemplateSelectionTriggered:Y,enabledCustomText:L,disableEditVariable:f}},{children:S?e.jsx(r.default,{channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:v,centralContainerStyles:{width:m===s.CHANNEL_TYPE.EMAIL&&p?1e3:650},open:!0,onClose:()=>{null==u||u()},headingTitle:null==_?void 0:_.label,headingSubtitle:m===s.CHANNEL_TYPE.WHATSAPP?`${l.default.capitaliseFirstLetterOfString(null!==(w=null==_?void 0:_.category)&&void 0!==w?w:"")} • ${null!==(q=null==_?void 0:_.templateCategory)&&void 0!==q?q:""}`:"",onBackPress:()=>{null==P||P()}},{children:[e.jsx(r.default,{showVariableMapping:p,channel:m,whatsappSpecificPickerMeta:T,showVariableModal:E,variableList:j,discountCode:x,setDiscountCode:M}),C?e.jsx(o.default,{onSelect:function(){const e=null==C?void 0:C(_,I,null!=N?N:"");e?D(!!e):Y(!0)}}):e.jsx(e.Fragment,{})]}))}))};
@@ -3,7 +3,7 @@ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
3
3
  import { EmailTemplateType } from "../../template-preview/models/EmailTemplate";
4
4
  import { SMSTemplateType } from "../../template-preview/models/SmsTemplate";
5
5
  import { CUSTOM_VARIABLE, globalNormalizedPlaceholdersType } from "../../template-preview/models/TemplateMeta";
6
- import { Extras, WhatsAppTemplate, WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
6
+ import { WhatsAppTemplate, WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
7
7
  export type DEVICE_TYPES = 'desktop' | 'mobile';
8
8
  export declare const TemplateModalContext: React.Context<{
9
9
  device: DEVICE_TYPES;
@@ -23,8 +23,6 @@ export declare const TemplateModalContext: React.Context<{
23
23
  setTemplateSelectionTriggered?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
24
24
  enabledCustomText?: boolean | undefined;
25
25
  disableEditVariable?: boolean | undefined;
26
- pod?: string | undefined;
27
- extras?: Extras | undefined;
28
26
  }>;
29
27
  export declare const useTemplateModalContext: () => {
30
28
  device: DEVICE_TYPES;
@@ -44,6 +42,4 @@ export declare const useTemplateModalContext: () => {
44
42
  setTemplateSelectionTriggered?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
45
43
  enabledCustomText?: boolean | undefined;
46
44
  disableEditVariable?: boolean | undefined;
47
- pod?: string | undefined;
48
- extras?: Extras | undefined;
49
45
  };
@@ -6,10 +6,8 @@ export interface BodyProps {
6
6
  whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
7
7
  showVariableModal?: boolean;
8
8
  variableList?: VariableListInterfaceV2[];
9
- variableListForImage?: VariableListInterfaceV2[];
10
9
  discountCode?: string;
11
10
  setDiscountCode?: (code: string) => void;
12
- showSampleValues?: boolean;
13
11
  }
14
12
  declare const Body: (props: BodyProps) => import("react/jsx-runtime").JSX.Element;
15
13
  export default Body;
@@ -1,17 +1,17 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("styled-components"),o=require("../../template-preview/models/Channels.js"),n=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"),c=require("./VariableConnectorsPanel.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=p(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"),c=require("./VariableConnectorsPanel.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=p(l);const m=h.default.div`
2
2
  display: flex;
3
3
  // height: 100%;
4
4
  `,f=h.default.div`
5
5
  padding: 16px 14px;
6
6
  max-width: 350px;
7
7
 
8
- height: ${e=>e.channel===o.CHANNEL_TYPE.WHATSAPP?"500px":"475px"};
8
+ height: ${e=>e.channel===n.CHANNEL_TYPE.WHATSAPP?"500px":"475px"};
9
9
  overflow-y: 'auto';
10
10
  padding-bottom: 24px;
11
- border-left: ${n.COLORS.stroke.primary} 1px solid;
12
- `,g=h.default.div`
11
+ border-left: ${o.COLORS.stroke.primary} 1px solid;
12
+ `,x=h.default.div`
13
13
  padding: ${e=>e.showOnlyContent?"16px 14px":"16px 32px"};
14
14
  flex: 1;
15
15
  height: 475px;
16
16
  overflow-y: auto;
17
- `;exports.default=l=>{const{showVariableMapping:p,showOnlyContent:h,whatsappSpecificPickerMeta:x,showVariableModal:v,variableList:b,discountCode:w,setDiscountCode:j,variableListForImage:C,showSampleValues:E}=l,y=t.useRef(),L=t.useRef(),{device:P,display_content:T,channel:M,template:_,setTemplate:A}=i.useTemplateModalContext();const q=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(m,{children:[e.jsx(g,Object.assign({showOnlyContent:h,showVariableMapping:p},{children:"mobile"===P?e.jsx(u.default,{ref:L,display_content:null!=T?T:"",channel:M,template:_,showSampleValues:E}):M!==o.CHANNEL_TYPE.MESSAGE?e.jsx(s.default,{ref:y,channel:M,display_content:null!=T?T:"",showSampleValues:E}):e.jsx(e.Fragment,{})})),p&&e.jsx(f,Object.assign({channel:M},{children:M!==o.CHANNEL_TYPE.WHATSAPP?e.jsx(c.default,{onFocus:M===o.CHANNEL_TYPE.EMAIL?function(e){var t,l,i;const s=null===document||void 0===document?void 0:document.getElementById("mobile"===P?"template_html_mobile":"template_html_desktop"),d=a.getVariableNameForEmailByIndex(e+1),u=M===o.CHANNEL_TYPE.EMAIL?null===(t=null==s?void 0:s.contentWindow)||void 0===t?void 0:t.document.getElementById(d):document.getElementById(d),c=q(u),p=null==u?void 0:u.offsetLeft;"desktop"===P?c&&y.current&&(null===(l=null==s?void 0:s.contentWindow)||void 0===l||l.scrollTo(null!=p?p:0,c),r.highlightFor(d,n.COLORS.background.warning.light,2,M,P)):c&&L.current&&(null===(i=null==s?void 0:s.contentWindow)||void 0===i||i.scrollTo(null!=p?p:0,c),r.highlightFor(d,n.COLORS.background.warning.light,2,M,P))}:void 0,showVariableModal:v,variableList:b,discountCode:w,setDiscountCode:j}):e.jsx(d.default,{whatsappSpecificPickerMeta:x,template:_,onTemplateChange:e=>{null==A||A(e)},showVariableModal:v,variableList:b,variableListForImage:C,discountCode:w,setDiscountCode:j})}))]})};
17
+ `;exports.default=l=>{const{showVariableMapping:p,showOnlyContent:h,whatsappSpecificPickerMeta:g,showVariableModal:v,variableList:b,discountCode:j,setDiscountCode:w}=l,C=t.useRef(),E=t.useRef(),{device:y,display_content:P,channel:T,template:L,setTemplate:M}=i.useTemplateModalContext();const _=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:p},{children:"mobile"===y?e.jsx(u.default,{ref:E,display_content:null!=P?P:"",channel:T,template:L}):T!==n.CHANNEL_TYPE.MESSAGE?e.jsx(s.default,{ref:C,channel:T,display_content:null!=P?P:""}):e.jsx(e.Fragment,{})})),p&&e.jsx(f,Object.assign({channel:T},{children:T!==n.CHANNEL_TYPE.WHATSAPP?e.jsx(c.default,{onFocus:T===n.CHANNEL_TYPE.EMAIL?function(e){var t,l,i;const s=null===document||void 0===document?void 0:document.getElementById("mobile"===y?"template_html_mobile":"template_html_desktop"),d=a.getVariableNameForEmailByIndex(e+1),u=T===n.CHANNEL_TYPE.EMAIL?null===(t=null==s?void 0:s.contentWindow)||void 0===t?void 0:t.document.getElementById(d):document.getElementById(d),c=_(u),p=null==u?void 0:u.offsetLeft;"desktop"===y?c&&C.current&&(null===(l=null==s?void 0:s.contentWindow)||void 0===l||l.scrollTo(null!=p?p:0,c),r.highlightFor(d,o.COLORS.background.warning.light,2,T,y)):c&&E.current&&(null===(i=null==s?void 0:s.contentWindow)||void 0===i||i.scrollTo(null!=p?p:0,c),r.highlightFor(d,o.COLORS.background.warning.light,2,T,y))}:void 0,showVariableModal:v,variableList:b,discountCode:j,setDiscountCode:w}):e.jsx(d.default,{whatsappSpecificPickerMeta:g,template:L,onTemplateChange:e=>{null==M||M(e)},showVariableModal:v,variableList:b})}))]})};
@@ -3,6 +3,5 @@ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
3
3
  declare const DesktopPreview: React.ForwardRefExoticComponent<{
4
4
  display_content: string;
5
5
  channel: CHANNEL_TYPE;
6
- showSampleValues?: boolean | undefined;
7
6
  } & React.RefAttributes<HTMLDivElement>>;
8
7
  export default DesktopPreview;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("styled-components"),i=require("../../spinner/Spinner.js"),a=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var s=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js");var p=require("../../template-preview/models/Channels.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(r),o=l(t);const n=o.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("styled-components"),i=require("../../spinner/Spinner.js"),a=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var s=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js");var p=require("../../template-preview/models/Channels.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=d(r),o=d(t);const n=o.default.div`
2
2
  background: ${s.COLORS.surface.standard};
3
3
  border: 1px solid ${s.COLORS.stroke.primary};
4
4
  border-radius: 8px;
@@ -17,4 +17,4 @@
17
17
  height: 6px;
18
18
  background: #d9d9d9;
19
19
  border-radius: 3px;
20
- `,m=d.default.forwardRef(((r,t)=>{let{display_content:s,showSampleValues:l}=r;return e.jsxs(n,Object.assign({ref:t},{children:[e.jsxs(u,{children:[e.jsx(h,{}),e.jsx(h,{}),e.jsx(h,{})]}),e.jsx("div",{children:s?e.jsx(a.TemplatePreview,{showSampleValues:l,channel:p.CHANNEL_TYPE.EMAIL,hideHeader:!0,emailSpecificMeta:{emailDisplayContent:s,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_desktop",containerStyle:{width:584,height:441},templateContainerStyles:{height:"100%"}}}):e.jsx("div",Object.assign({style:{padding:20}},{children:e.jsx(i.Spinner,{size:"small"})}))})]}))}));m.displayName="DesktopPreview",exports.default=m;
20
+ `,m=l.default.forwardRef(((r,t)=>{let{display_content:s}=r;return e.jsxs(n,Object.assign({ref:t},{children:[e.jsxs(u,{children:[e.jsx(h,{}),e.jsx(h,{}),e.jsx(h,{})]}),e.jsx("div",{children:s?e.jsx(a.TemplatePreview,{channel:p.CHANNEL_TYPE.EMAIL,hideHeader:!0,emailSpecificMeta:{emailDisplayContent:s,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_desktop",containerStyle:{width:584,height:441},templateContainerStyles:{height:"100%"}}}):e.jsx("div",Object.assign({style:{padding:20}},{children:e.jsx(i.Spinner,{size:"small"})}))})]}))}));m.displayName="DesktopPreview",exports.default=m;
@@ -1,15 +1,12 @@
1
- /// <reference types="react" />
2
1
  import { HEADER_TYPES } from "../../template-preview/models/TemplateMeta";
3
2
  export interface EditMediaV2Props {
4
3
  imageName: string[];
5
- selectedVariable?: string;
6
4
  errorSecondaryText?: string;
7
5
  error?: string;
8
6
  isLoading?: boolean;
9
7
  mediaType?: HEADER_TYPES;
10
8
  handleImageChange?: () => void;
11
9
  disableEditVariable?: boolean;
12
- setOpenEditMedia?: React.Dispatch<React.SetStateAction<boolean>>;
13
10
  }
14
11
  declare const EditMediaV2: (props: EditMediaV2Props) => import("react/jsx-runtime").JSX.Element;
15
12
  export default EditMediaV2;
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/document_pdf.svg.js"),i=require("../../../assets/icons/edit.svg.js"),s=require("../../../assets/icons/refresh.svg.js"),r=require("../../../assets/icons/video_camcorder.svg.js"),n=require("styled-components"),o=require("../../spinner/Spinner.js"),l=require("../../template-preview/models/TemplateMeta.js"),d=require("../../TypographyStyle.js"),a=require("../../../utils/StringUtils.js"),c=require("../../../constants/Theme.js"),u=require("./EditMediaV2.style.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const g=h(n).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/document_pdf.svg.js"),i=require("../../../assets/icons/edit.svg.js"),s=require("../../../assets/icons/refresh.svg.js"),r=require("../../../assets/icons/video_camcorder.svg.js"),n=require("styled-components"),o=require("../../spinner/Spinner.js"),l=require("../../template-preview/models/TemplateMeta.js"),a=require("../../TypographyStyle.js"),d=require("../../../utils/StringUtils.js"),c=require("../../../constants/Theme.js"),h=require("./EditMediaV2.style.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const j=g(n).default.div`
2
2
  padding-left: 14px;
3
3
  padding-right: 6px;
4
4
  width: 44px;
5
5
  height: 24px;
6
6
  border-left: 1px solid ${c.COLORS.stroke.primary};
7
7
  cursor: pointer;
8
- `;exports.default=n=>{const{imageName:h,error:j,isLoading:p,mediaType:x,handleImageChange:O,disableEditVariable:y,selectedVariable:m,setOpenEditMedia:f}=n,v=null==h?void 0:h[0].split("/"),C=null==v?void 0:v[v.length-1];return e.jsxs(u.Container,{children:[e.jsx(u.ImageContainer,Object.assign({error:!!j,onClick:j?O:void 0},{children:j?e.jsx(s.default,{color:c.COLORS.content.brand,width:32,height:32}):p?e.jsx(o.Spinner,{size:"small"}):x===l.HEADER_TYPES.IMAGE?e.jsx("img",{alt:"",src:null==h?void 0:h[0],style:{width:"100%",height:"56px",borderRadius:8,objectFit:"cover"}}):x===l.HEADER_TYPES.VIDEO?e.jsx(r.default,{width:18,height:22,color:c.COLORS.content.placeholder}):e.jsx(t.default,{width:18,height:22,color:c.COLORS.content.placeholder})})),e.jsxs(u.RightComponent,{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:h&&j?e.jsx(e.Fragment,{}):p?e.jsx(d.BodyCaption,Object.assign({style:{marginLeft:8}},{children:"Your media is getting loaded..."})):e.jsx(d.BodySecondary,Object.assign({style:{color:c.COLORS.content.primary,marginLeft:8}},{children:m||a.default.toCapitilize(null==x?void 0:x.toLowerCase())||C}))})),!!j&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",marginLeft:8}},{children:[e.jsxs(d.BodySecondary,Object.assign({style:{color:c.COLORS.content.negative}},{children:["Error loading this ",null==x?void 0:x.toLowerCase(),". Retry"]})),e.jsx(d.Caption,Object.assign({style:{color:c.COLORS.content.secondary}},{children:j}))]})),!y&&!j&&!p&&e.jsx(g,Object.assign({onClick:()=>null==f?void 0:f(!0),onKeyDown:()=>null==f?void 0:f(!0),role:"presentation"},{children:e.jsx(i.default,{width:24,height:24,color:c.COLORS.content.placeholder})}))]})]})};
8
+ `;exports.default=n=>{const{imageName:g,error:u,isLoading:p,mediaType:x,handleImageChange:y,disableEditVariable:O}=n,m=null==g?void 0:g[0].split("/"),f=null==m?void 0:m[m.length-1];return e.jsxs(h.Container,{children:[e.jsx(h.ImageContainer,Object.assign({error:!!u,onClick:u?y:void 0},{children:u?e.jsx(s.default,{color:c.COLORS.content.brand,width:32,height:32}):p?e.jsx(o.Spinner,{size:"small"}):x===l.HEADER_TYPES.IMAGE?e.jsx("img",{alt:"",src:null==g?void 0:g[0],style:{width:"100%",height:"56px",borderRadius:8,objectFit:"cover"}}):x===l.HEADER_TYPES.VIDEO?e.jsx(r.default,{width:18,height:22,color:c.COLORS.content.placeholder}):e.jsx(t.default,{width:18,height:22,color:c.COLORS.content.placeholder})})),e.jsxs(h.RightComponent,{children:[e.jsx("div",Object.assign({style:{flex:1}},{children:g&&u?e.jsx(e.Fragment,{}):p?e.jsx(a.BodyCaption,Object.assign({style:{marginLeft:8}},{children:"Your media is getting loaded..."})):e.jsx(a.BodySecondary,Object.assign({style:{color:c.COLORS.content.primary,marginLeft:8}},{children:d.default.toCapitilize(null==x?void 0:x.toLowerCase())||f}))})),!!u&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",marginLeft:8}},{children:[e.jsxs(a.BodySecondary,Object.assign({style:{color:c.COLORS.content.negative}},{children:["Error loading this ",null==x?void 0:x.toLowerCase(),". Retry"]})),e.jsx(a.Caption,Object.assign({style:{color:c.COLORS.content.secondary}},{children:u}))]})),!O&&!u&&!p&&e.jsx(j,Object.assign({onClick:y,onKeyDown:y,role:"presentation"},{children:e.jsx(i.default,{width:24,height:24,color:c.COLORS.content.placeholder})}))]})]})};
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
- import { VariableListInterfaceV2 } from "../../add-variableV2";
3
2
  import { WhatsAppPickerMeta, WhatsAppTemplate } from "../../template-preview/models/WhatsAppTemplate";
4
3
  declare const EditMediaTemplateMediaV2: React.FC<{
5
4
  mediaComponent: WhatsAppTemplate['components'][0];
6
5
  template: WhatsAppTemplate;
7
6
  whatsappSpecificPickerMeta: WhatsAppPickerMeta;
8
7
  updateTemplateImageUrl(url: string, format: WhatsAppTemplate['components'][0]['format']): void;
9
- variableListForImage?: VariableListInterfaceV2[];
10
8
  }>;
11
9
  export default EditMediaTemplateMediaV2;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),a=require("../../helpers/FileUploaderHelper.js"),n=require("../../image-cropper/BikImageCropper.js");require("../../image-compress/ImageCompress.js"),require("../../states/StateComponent.js"),require("../../../constants/zindex.js"),require("../../modals/styledModal.js"),require("../../spinner/Spinner.js");var o=require("../../template-preview/models/TemplateMeta.js"),r=require("../context/templateModalContext.js"),l=require("./EditMediaModal.js"),s=require("./EditMediaV2.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(i);exports.default=d=>{let{mediaComponent:p,template:u,updateTemplateImageUrl:m,whatsappSpecificPickerMeta:f,variableListForImage:v}=d;var E,g,j;const{disableEditVariable:h}=r.useTemplateModalContext(),[b,M]=i.useState(void 0),[_,x]=i.useState(),[y,A]=i.useState(),[C,S]=i.useState(!1),T=c.default.createRef(),[I,q]=i.useState(!1),[R,O]=i.useState(""),{template:w,setTemplate:D}=r.useTemplateModalContext();let H;function k(){var e;(null===(e=null==T?void 0:T.current)||void 0===e?void 0:e.click)&&T.current.click()}function P(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){const e=new a.FileUploaderHelper;if(t instanceof Blob){const a=e.validate(t);if(a)O(a),q(!1);else{const e=p.format===o.HEADER_TYPES.IMAGE,a=yield f.uploadMediaFiles({file:t,fileName:b,isImage:e});if(a.success){const[e]=t.type.split("/");m(null!==(i=a.url)&&void 0!==i?i:"","application"===e?o.HEADER_TYPES.DOCUMENT:o.HEADER_TYPES[e.toUpperCase()])}else O("An unknown technical error occured");q(!1)}}else O("An unknown technical error occured"),q(!1)}))}return console.log("ignore: ",h),H=p.format===o.HEADER_TYPES.IMAGE?"image/png, image/jpeg":p.format===o.HEADER_TYPES.VIDEO?"video/mp4":"application/pdf",t.jsxs(t.Fragment,{children:[t.jsx(l.default,{mediaComponentFormat:null!==(E=p.format)&&void 0!==E?E:o.HEADER_TYPES.IMAGE,uploadMedia:function(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){if(O(""),A(""),S(!1),t)if(t.startsWith("https"))try{q(!0);const e=yield fetch(t),i=yield e.blob();yield P(i)}catch(e){O("An unknown technical error occurred")}else if(/^{{.*}}$/.test(t)){A(t);const e=Object.assign({},w);if(e.components){const t=null===(i=null==e?void 0:e.components)||void 0===i?void 0:i.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==t&&t>-1&&(null==e?void 0:e.components[t])){const i=Object.assign(Object.assign({},e.components[t]),{format:p.format,example:{header_handle:["https://jkfenner.com/wp-content/uploads/2019/11/default.jpg"]}}),a=[...e.components];a[t]=i,e.components=a}}e.mapping&&(e.mapping=Object.assign(Object.assign({},e.mapping),{header:[t]})),q(!1),null==D||D(Object.assign({},e))}else q(!1),O("Invalid URL or variable");else k()}))},variableListForImage:v||[],setOpenEditMedia:S,openEditMedia:C}),!!_&&t.jsx(n.BikImageCropper,{aspectRatio:15/8,src:_,onCropComplete:function(t){return e.__awaiter(this,void 0,void 0,(function*(){q(!1),O("");const e=yield fetch(t);P(yield e.blob()).then((()=>{x(void 0)}))}))},onCancel:()=>{q(!1),x("")}}),t.jsx("input",{ref:T,style:{display:"none"},type:"file",onChange:function(e){var t;O(""),q(!0);const i=null===(t=e.target.files)||void 0===t?void 0:t[0];if(p.format===o.HEADER_TYPES.IMAGE){const e=new FileReader;x(""),M(""),e.onload=()=>{x(e.result),M(null==i?void 0:i.name)},i&&e.readAsDataURL(i)}else P(i)},accept:H}),t.jsx(s.default,{imageName:null!==(j=null===(g=null==p?void 0:p.example)||void 0===g?void 0:g.header_handle)&&void 0!==j?j:[],handleImageChange:k,mediaType:null==p?void 0:p.format,error:R,isLoading:I,setOpenEditMedia:S,selectedVariable:y,disableEditVariable:h})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),r=require("../../helpers/FileUploaderHelper.js"),a=require("../../image-cropper/BikImageCropper.js");require("../../image-compress/ImageCompress.js"),require("../../states/StateComponent.js"),require("../../../constants/zindex.js"),require("../../modals/styledModal.js"),require("../../spinner/Spinner.js");var o=require("../../template-preview/models/TemplateMeta.js"),l=require("../context/templateModalContext.js"),n=require("./EditMediaV2.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(i);exports.default=s=>{let{mediaComponent:u,template:c,updateTemplateImageUrl:p,whatsappSpecificPickerMeta:m}=s;var f,v;const{disableEditVariable:E}=l.useTemplateModalContext(),[j,g]=i.useState(void 0),[_,h]=i.useState(),C=d.default.createRef(),[q,S]=i.useState(!1),[x,A]=i.useState("");function M(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){const e=new r.FileUploaderHelper;if(t instanceof Blob){const r=e.validate(t);if(r)A(r),S(!1);else{const e=u.format===o.HEADER_TYPES.IMAGE,r=yield m.uploadMediaFiles({file:t,fileName:j,isImage:e});if(r.success){const[e]=t.type.split("/");p(null!==(i=r.url)&&void 0!==i?i:"","application"===e?o.HEADER_TYPES.DOCUMENT:o.HEADER_TYPES[e.toUpperCase()])}else A("An unknown technical error occured");S(!1)}}else A("An unknown technical error occured"),S(!1)}))}let y;return y=u.format===o.HEADER_TYPES.IMAGE?"image/png, image/jpeg":u.format===o.HEADER_TYPES.VIDEO?"video/mp4":"application/pdf",t.jsxs(t.Fragment,{children:[!!_&&t.jsx(a.BikImageCropper,{aspectRatio:15/8,src:_,onCropComplete:function(t){return e.__awaiter(this,void 0,void 0,(function*(){S(!1),A("");const e=yield fetch(t);M(yield e.blob()).then((()=>{h(void 0)}))}))},onCancel:()=>{S(!1),h("")}}),t.jsx("input",{ref:C,style:{display:"none"},type:"file",onChange:function(e){var t;A(""),S(!0);const i=null===(t=e.target.files)||void 0===t?void 0:t[0];if(u.format===o.HEADER_TYPES.IMAGE){const e=new FileReader;h(""),g(""),e.onload=()=>{h(e.result),g(null==i?void 0:i.name)},i&&e.readAsDataURL(i)}else M(i)},accept:y}),t.jsx(n.default,{imageName:null!==(v=null===(f=null==u?void 0:u.example)||void 0===f?void 0:f.header_handle)&&void 0!==v?v:[],handleImageChange:function(){var e;(null===(e=null==C?void 0:C.current)||void 0===e?void 0:e.click)&&C.current.click()},mediaType:null==u?void 0:u.format,error:x,isLoading:q,disableEditVariable:E})]})};
@@ -8,9 +8,6 @@ export interface EditWhatsAppTemplateV2Props {
8
8
  onTemplateChange?: (template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType) => void;
9
9
  showVariableModal?: boolean;
10
10
  variableList?: VariableListInterfaceV2[];
11
- variableListForImage?: VariableListInterfaceV2[];
12
- discountCode?: string;
13
- setDiscountCode?: (code: string) => void;
14
11
  }
15
- declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, discountCode, setDiscountCode, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
12
+ declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
16
13
  export default EditWhatsAppTemplateV2;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),o=require("../context/templateModalContext.js"),n=require("../utils/getDataFromTemplateComponent.js"),i=require("./BackTrackComponent.js"),a=require("./DiscountCodeComponent.js"),l=require("./EditMediaV2.style.js"),s=require("./EditWhatsAppTemplateMediaV2.js"),d=require("./VariableConnectorsPanel.js"),r=require("./VariableConnectorWhatsApp.js"),u=require("./VariableEditorHeader.js"),c=require("./WhatsAppTemplateCardButtonV2.js");exports.default=p=>{let{template:v,onTemplateChange:m,whatsappSpecificPickerMeta:b,showVariableModal:g,variableList:h,variableListForImage:f,discountCode:j,setDiscountCode:T}=p;var x,C,O,E,k,y,B,V,w,L,q,I,M,A,R,U;const{originalVariableList:D,pod:H,extras:S}=o.useTemplateModalContext(),{descriptionComponents:P,urlBtns:N,qrbBtns:Q,imageComponent:_,bodyVariables:F,headerVariables:W}=n.getAllDataFromTemplateComponent(v),[K,Y]=t.useState(!1);function $(e,t){var o,n,i,a,l;const s=Object.assign({},v),d=null==s?void 0:s.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==d&&d>-1){const l=null===(o=null==s?void 0:s.components[d].buttons)||void 0===o?void 0:o.findIndex((e=>"URL"===e.type));if(void 0!==l&&l>-1){const o="custom"===t&&"string"==typeof e,r=[...null!==(a=null===(i=null===(n=s.components)||void 0===n?void 0:n[d])||void 0===i?void 0:i.buttons)&&void 0!==a?a:[]];r[l]=Object.assign(Object.assign({},r[l]),{url:"https://d.bik.ai/{{1}}",example:[o?e:"string"!=typeof e?e.defaultValue:""]});const u=Object.assign(Object.assign({},s.components[d]),{buttons:r}),c=Object.assign(Object.assign({},s.mapping),{buttons:o?["((customBtnPlaceholder))"]:"string"!=typeof e?[e.placeHolder]:void 0});s.mapping=c;const p=[...s.components];p[d]=u,s.components=p}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(l=e.placeHolder)||void 0===l?void 0:l.slice(2,-2))?Y(!0):(Y(!1),null==T||T(""))}null==m||m(s)}function X(e,t,o){var n;const i=Object.assign({},v),a=null==i?void 0:i.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==a&&a>-1){const t=null===(n=null==i?void 0:i.components[a].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 l=Object.assign(Object.assign({},i.components[a]),{buttons:t}),s=[...i.components];s[a]=l,i.components=s}null==m||m(i)}return t.useEffect((()=>{var e;const t=null===(e=v.mapping.buttons)||void 0===e?void 0:e[0];"checkout.checkoutUrl"===(null==t?void 0:t.slice(2,-2))?Y(!0):(Y(!1),null==T||T(""))}),[v]),e.jsxs(d.Container,Object.assign({style:{flexDirection:"column",maxHeight:460}},{children:[!!_&&e.jsx(l.EditTemplateMediaContainer,{children:e.jsx(s.default,{whatsappSpecificPickerMeta:b,mediaComponent:_,updateTemplateImageUrl:function(e,t){var o;let n=Object.assign({},v);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]}}),a=[...n.components];a[i]=o,n=Object.assign(Object.assign({},n),{components:a})}n.mapping&&(n.mapping=Object.assign(Object.assign({},n.mapping),{header:void 0})),null==m||m(Object.assign({},n))},template:v,variableListForImage:f})}),(F.length>0||W.length>0)&&e.jsx(u.default,{containerStyle:{paddingTop:_?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==P?void 0:P.map(((t,o)=>e.jsx(r.default,{originalVariableList:D,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?v.mapping.header:v.mapping.body,showVariableModal:g,variableList:h},o))),(null===(C=null===(x=N[0])||void 0===x?void 0:x.component)||void 0===C?void 0:C.buttons)&&(null===(k=null===(E=null===(O=N[0])||void 0===O?void 0:O.component)||void 0===E?void 0:E.buttons)||void 0===k?void 0:k.length)>0&&e.jsx(u.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(y=null==D?void 0:D.buttons)||void 0===y?void 0:y.map(((t,o)=>{if("URL"===t.type)return e.jsx(c.default,{CTAoptions:null==b?void 0:b.CTAoptions,button:t,originalVariableList:D,updateSelectedURLTemplateBtn:$},`${o}`)})),(null===(V=null===(B=Q[0])||void 0===B?void 0:B.component)||void 0===V?void 0:V.buttons)&&(null===(q=null===(L=null===(w=Q[0])||void 0===w?void 0:w.component)||void 0===L?void 0:L.buttons)||void 0===q?void 0:q.length)>0&&("CHATBOT"!==H?e.jsx(u.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(i.BackTrackComponent,{backTrackMessage:null===(I=null==S?void 0:S.backTrackExtra)||void 0===I?void 0:I[0],setBackTrackMessage:null===(M=null==S?void 0:S.backTrackExtra)||void 0===M?void 0:M[1]})),null===(A=null==D?void 0:D.buttons)||void 0===A?void 0:A.map(((t,o)=>{if("QUICK_REPLY"===t.type)return e.jsx(c.default,{QRBoptions:null==b?void 0:b.QRBoptions,button:t,originalVariableList:D,updateSelectedQRBTemplateBtn:X},`${o}`)})),"CHATBOT"===H&&K&&e.jsx(a.DiscountCodeComponent,{discountCode:null===(R=null==S?void 0:S.discountCodeExtra)||void 0===R?void 0:R[0],setDiscountCode:null===(U=null==S?void 0:S.discountCodeExtra)||void 0===U?void 0:U[1],variableList:h})]}))};
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,variableList:b}=r;var v,g,h,f,j,x,T,O,y,C,E,V;const{originalVariableList:w}=t.useTemplateModalContext(),{descriptionComponents:B,urlBtns:I,qrbBtns:L,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 U(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==B?void 0:B.map(((t,o)=>e.jsx(a.default,{originalVariableList:w,type:t.type,descriptionComponent:t.component,variableMapping:"HEADER"===t.type?p.mapping.header:p.mapping.body,showVariableModal:m,variableList:b},o))),(null===(g=null===(v=I[0])||void 0===v?void 0:v.component)||void 0===g?void 0:g.buttons)&&(null===(j=null===(f=null===(h=I[0])||void 0===h?void 0:h.component)||void 0===f?void 0:f.buttons)||void 0===j?void 0:j.length)>0&&e.jsx(s.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(x=null==w?void 0:w.buttons)||void 0===x?void 0:x.map(((t,o)=>{if("URL"===t.type)return e.jsx(d.default,{CTAoptions:null==c?void 0:c.CTAoptions,button:t,originalVariableList:w,updateSelectedURLTemplateBtn:A},`${o}`)})),(null===(O=null===(T=L[0])||void 0===T?void 0:T.component)||void 0===O?void 0:O.buttons)&&(null===(E=null===(C=null===(y=L[0])||void 0===y?void 0:y.component)||void 0===C?void 0:C.buttons)||void 0===E?void 0:E.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===(V=null==w?void 0:w.buttons)||void 0===V?void 0:V.map(((t,o)=>{if("QUICK_REPLY"===t.type)return e.jsx(d.default,{QRBoptions:null==c?void 0:c.QRBoptions,button:t,originalVariableList:w,updateSelectedQRBTemplateBtn:U},`${o}`)}))]}))};
@@ -7,6 +7,5 @@ declare const MobilePreview: React.ForwardRefExoticComponent<{
7
7
  display_content: string;
8
8
  channel: CHANNEL_TYPE;
9
9
  template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | null;
10
- showSampleValues?: boolean | undefined;
11
10
  } & React.RefAttributes<HTMLDivElement>>;
12
11
  export default MobilePreview;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("styled-components"),i=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../constants/Theme.js"),require("../../template-preview/models/TemplateMeta.js");var r=require("../../template-preview/models/Channels.js"),o=require("../context/templateModalContext.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(t),p=s(a);const n=p.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("styled-components"),a=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../constants/Theme.js"),require("../../template-preview/models/TemplateMeta.js");var r=require("../../template-preview/models/Channels.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(t),l=o(i);const p=l.default.div`
2
2
  position: relative;
3
3
  height: 100%;
4
4
  border-radius: 31px;
@@ -6,7 +6,7 @@
6
6
  background-color: white;
7
7
  margin: auto;
8
8
  overflow-y: auto;
9
- `,d=p.default.div`
9
+ `,n=l.default.div`
10
10
  position: absolute;
11
11
  flex: 1;
12
12
  background-color: white;
@@ -17,4 +17,4 @@
17
17
  height: calc(100% - 17px);
18
18
  border-radius: 16px;
19
19
  overflow-y: auto;
20
- `,c=l.default.forwardRef(((t,a)=>{let{display_content:s,channel:l,template:p,showSampleValues:c}=t;const{pod:h}=o.useTemplateModalContext();return e.jsx("div",{children:e.jsxs(n,Object.assign({channel:l},{children:[e.jsx("img",{alt:"",src:"https://firebasestorage.googleapis.com/v0/b/staging-bikayi.appspot.com/o/bik%2FkNwEVoGlLpVjOsXoO1M8WgvWicP2%2F6f07b850-8b4b-4d58-96cc-8ba6df7b4e4a-Device___Frame.jpg?alt=media&token=253f1bfe-8481-4f54-bdef-3c0a73697d6a",style:{width:l===r.CHANNEL_TYPE.WHATSAPP?236:300,height:443}}),e.jsx(d,Object.assign({ref:a},{children:e.jsx(i.TemplatePreview,{showSampleValues:c,template:p,channel:l,smsSpecificMeta:{smsDisplayContent:s},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:"CHATBOT"!==h,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426,width:236}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:s,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}}})}))]}))})}));c.displayName="MobilePreview",exports.default=c;
20
+ `,d=s.default.forwardRef(((t,i)=>{let{display_content:o,channel:s,template:l}=t;return e.jsx("div",{children:e.jsxs(p,Object.assign({channel:s},{children:[e.jsx("img",{alt:"",src:"https://firebasestorage.googleapis.com/v0/b/staging-bikayi.appspot.com/o/bik%2FkNwEVoGlLpVjOsXoO1M8WgvWicP2%2F6f07b850-8b4b-4d58-96cc-8ba6df7b4e4a-Device___Frame.jpg?alt=media&token=253f1bfe-8481-4f54-bdef-3c0a73697d6a",style:{width:s===r.CHANNEL_TYPE.WHATSAPP?236:300,height:443}}),e.jsx(n,Object.assign({ref:i},{children:e.jsx(a.TemplatePreview,{template:l,channel:s,smsSpecificMeta:{smsDisplayContent:o},whatsAppSpecificMeta:{showWhatsAppHeader:!0,whatsAppExtras:!0,containerStyle:{border:"none",borderBottomRightRadius:0,borderBottomLeftRadius:0,minHeight:426}},size:"small",hideHeader:!0,emailSpecificMeta:{emailDisplayContent:o,hideViewButtonForEmail:!0,emailHtmlContainerId:"template_html_mobile",containerStyle:{height:"100%",width:"100%"},templateContainerStyles:{height:"100%"}}})}))]}))})}));d.displayName="MobilePreview",exports.default=d;
@@ -9,10 +9,8 @@ export interface TemplateSelectModalContentProps {
9
9
  whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
10
10
  showVariableModal?: boolean;
11
11
  variableList?: VariableListInterfaceV2[];
12
- variableListForImage?: VariableListInterfaceV2[];
13
12
  discountCode?: string;
14
13
  setDiscountCode?: (code: string) => void;
15
- showSampleValues?: boolean;
16
14
  }
17
- declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode, variableListForImage, showSampleValues, }: TemplateSelectModalContentProps) => import("react/jsx-runtime").JSX.Element;
15
+ declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode, }: TemplateSelectModalContentProps) => import("react/jsx-runtime").JSX.Element;
18
16
  export default TemplateSelectModalContent;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../template-preview/models/Channels.js"),s=require("./Body.js"),t=require("./Header.js");exports.default=i=>{let{channel:r,showVariableMapping:o,showOnlyContent:l,whatsappSpecificPickerMeta:n,showVariableModal:d,variableList:p,discountCode:u,setDiscountCode:c,variableListForImage:h,showSampleValues:w}=i;return e.jsx("div",Object.assign({style:{paddingBottom:0}},{children:e.jsxs("div",{children:[r===a.CHANNEL_TYPE.EMAIL&&e.jsx(t.default,{showOnlyContent:l}),e.jsx(s.default,{whatsappSpecificPickerMeta:n,showVariableMapping:!!o,showOnlyContent:l,showVariableModal:d,variableList:p,discountCode:u,setDiscountCode:c,variableListForImage:h,showSampleValues:w})]})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../template-preview/models/Channels.js"),s=require("./Body.js"),a=require("./Header.js");exports.default=i=>{let{channel:r,showVariableMapping:o,showOnlyContent:n,whatsappSpecificPickerMeta:l,showVariableModal:d,variableList:c,discountCode:p,setDiscountCode:u}=i;return e.jsx("div",Object.assign({style:{paddingBottom:0}},{children:e.jsxs("div",{children:[r===t.CHANNEL_TYPE.EMAIL&&e.jsx(a.default,{showOnlyContent:n}),e.jsx(s.default,{whatsappSpecificPickerMeta:l,showVariableMapping:!!o,showOnlyContent:n,showVariableModal:d,variableList:c,discountCode:p,setDiscountCode:u})]})}))};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { VariableListInterfaceV2 } from "../../add-variableV2/AddVariableV2";
3
2
  import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
4
3
  import { CUSTOM_VARIABLE } from "../../template-preview/models/TemplateMeta";
@@ -14,7 +13,6 @@ export interface VariableConnectorProps {
14
13
  showVariableModal?: boolean;
15
14
  variableList?: VariableListInterfaceV2[];
16
15
  setShowDiscountCheckBox?: any;
17
- componentType?: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER';
18
16
  }
19
- declare const VariableConnector: React.FC<VariableConnectorProps>;
17
+ declare const VariableConnector: ({ onFocus, variable, index, showVariableModal, variableList, setShowDiscountCheckBox, }: VariableConnectorProps) => import("react/jsx-runtime").JSX.Element;
20
18
  export default VariableConnector;
@@ -1,7 +1,7 @@
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/AddVariableV2SideModal.js"),i=require("../../dropdown/Dropdown.js"),o=require("../../input/Input.js"),u=require("../../product-picker-v2/collectionScreen.js"),s=require("../../template-preview/constants/regexPatterns.js"),d=require("../../template-preview/models/Channels.js"),r=require("../../TypographyStyle.js"),c=require("../../../utils/StringUtils.js"),p=require("../../../constants/Theme.js"),v=require("../context/templateModalContext.js"),m=require("../utils/getVariableNameEmail.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const g=b(a).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/AddVariableV2SideModal.js"),i=require("../../dropdown/Dropdown.js"),o=require("../../input/Input.js"),u=require("../../product-picker-v2/collectionScreen.js"),s=require("../../template-preview/constants/regexPatterns.js"),d=require("../../template-preview/models/Channels.js"),r=require("../../TypographyStyle.js"),c=require("../../../utils/StringUtils.js"),v=require("../../../constants/Theme.js"),p=require("../context/templateModalContext.js"),m=require("../utils/getVariableNameEmail.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const g=b(a).default.div`
2
2
  /* surface/$color-background-warning-light */
3
3
 
4
- background: ${e=>e.focused&&e.channel===d.CHANNEL_TYPE.EMAIL?p.COLORS.background.warning.light:"transparent"};
4
+ background: ${e=>e.focused&&e.channel===d.CHANNEL_TYPE.EMAIL?v.COLORS.background.warning.light:"transparent"};
5
5
  border-radius: 4px;
6
6
  padding: 8px 10px;
7
- `,h={value:"custom_link",label:"Custom URL"},x={value:"custom_text",label:"Custom text"};exports.Container=g,exports.default=a=>{let{onFocus:b,variable:E,index:_,showVariableModal:j,variableList:y,setShowDiscountCheckBox:A,componentType:O}=a;var f,T;const[N,P]=l.useState(!1),[C,L]=l.useState(""),[V,k]=l.useState([]),[S,H]=l.useState(),[w,Y]=l.useState(!1),[M,q]=l.useState(!1),{device:B,channel:R,isError:W,originalVariableList:D,template:I,templateSelectionTriggered:$,setTemplate:z,setDisplayContent:U,setOriginalVariableList:Z,globalNormalizedPlaceholders:F,enabledCustomText:G}=v.useTemplateModalContext();function J(e,t){var l,a,n;const i=e;L(""),H(i),R===d.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value?(K(null!==(l=i.value)&&void 0!==l?l:"","string"),null==Q||Q(null!==(a=E.index)&&void 0!==a?a:0,i.value,!0)):(null==Q||Q(null!==(n=E.index)&&void 0!==n?n:0,E.variableName,!0,"custom_text"),K("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?K(i.value,"url"===i.bikPlaceholderType?"link":"string"):(L(""),K("",i.value))}function K(e,t){var l,a,n;const i="custom_link"===t?"link":"custom_text"===t?"string":t;if(R!==d.CHANNEL_TYPE.WHATSAPP){const a=m.getVariableNameForEmailByIndex(_+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===B?"template_html_mobile":"template_html_desktop"),o=R===d.CHANNEL_TYPE.EMAIL?null===(l=null==n?void 0:n.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);o&&(o.textContent="custom_text"!==t&&"custom_link"!==t||e?e:E.variableName);const u=D.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:i,updatedValue:e}):t));null==Z||Z(u)}if(R===d.CHANNEL_TYPE.WHATSAPP){const t=D;let l=t.body,o=t.header;"BODY"===O?l=null===(a=t.body)||void 0===a?void 0:a.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:i,updatedValue:e}):t)):"HEADER"===O&&(o=null===(n=t.header)||void 0===n?void 0:n.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:i,updatedValue:e}):t))),null==Z||Z((e=>Object.assign(Object.assign({},e),{header:o,body:l,buttons:t.buttons})))}}function Q(e,t,l,a){var n,i,o;const u=Object.assign({},I),s=null===(n=null==u?void 0:u.components)||void 0===n?void 0:n.map((l=>{var a,n,i,o,u,s,d,r;const c=Object.assign({},l);if("BODY"===l.type&&"BODY"===O){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!==(u=null===(o=null===(i=c.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==u?u:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},c.example),{body_text:[l]});return Object.assign(Object.assign({},c),{example:a})}}else if("HEADER"===l.type&&"HEADER"===O&&(null===(s=l.example)||void 0===s?void 0:s.header_text)){const l=[...null!==(r=null===(d=c.example)||void 0===d?void 0:d.header_text)&&void 0!==r?r:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},c.example),{header_text:l});return Object.assign(Object.assign({},c),{example:a})}return l}));u.components=s,l&&("BODY"===O&&(null===(i=null==u?void 0:u.mapping)||void 0===i?void 0:i.body)?u.mapping=Object.assign(Object.assign({},u.mapping),{body:u.mapping.body.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+10}))`:t:l))}):"HEADER"===O&&(null===(o=null==u?void 0:u.mapping)||void 0===o?void 0:o.header)&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:u.mapping.header.map(((l,n)=>e===n?"custom_text"===a?`((editableVariable${n+20}))`:t:l))}))),null==z||z(Object.assign({},u))}return l.useEffect((()=>{N&&(null==b||b())}),[N]),l.useEffect((()=>{!function(){var e,t,l,a,n;const i="mobile"===B?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),u=(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);R===d.CHANNEL_TYPE.EMAIL&&(null==U||U(u))}()}),[$]),l.useEffect((()=>{var e;const t=[];let l=[];if(R!==d.CHANNEL_TYPE.MESSAGE||G){"link"===(null==E?void 0:E.type)?(t.push({label:"",options:[h,x]}),H(h)):(t.push({label:"",options:[h,x]}),H(x));const e=null!=F?F:[];k([...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]}else{const e=null!=F?F:[];k([{label:"",options:[x,h]},...e]),l=[{label:"",options:[x,h]},...e]}if((R===d.CHANNEL_TYPE.WHATSAPP||R===d.CHANNEL_TYPE.EMAIL||R===d.CHANNEL_TYPE.MESSAGE)&&E.updatedValue)if(s.placeHolderNamePattern.test(E.updatedValue)&&R===d.CHANNEL_TYPE.WHATSAPP||E.updatedValue.startsWith("{{")&&R!==d.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===d.CHANNEL_TYPE.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");j?n={label:e.updatedValue?e.updatedValue.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}: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}(E,l,R);e.value&&H(e)}else(null===(e=E.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(H(h),L(E.updatedValue.split("https://")[1])):(H(x),L(E.updatedValue))}),[]),l.useEffect((()=>{B&&S&&C&&setTimeout((()=>{K("custom_link"===(null==S?void 0:S.value)&&C?C.includes("https")?C:`https://${C}`:C,S.value)}),100)}),[B]),l.useEffect((()=>{!M&&S&&E.updatedValue&&setTimeout((()=>{K("custom_link"===(null==S?void 0:S.value)&&C?C.includes("https")?E.updatedValue:`https://${E.updatedValue}`:E.updatedValue,S.value),q(!0)}),100)}),[S]),e.jsxs(g,Object.assign({channel:R,focused:N,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:W&&!S?p.COLORS.content.negative:p.COLORS.content.primary}},{children:[null===(f=E.variableName)||void 0===f?void 0:f.replace("{{","").replace("}}","")," ","link"===(null==E?void 0:E.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:j?e.jsxs("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==S?void 0:S.label)?"space-between":"flex-end"}},{children:[e.jsx(r.BodyPrimary,{children:u.truncate(null!==(T=null==S?void 0:S.label)&&void 0!==T?T:"",20,!0)}),e.jsx(t.default,{onClick:()=>{Y(!w)},width:24,height:24,color:p.COLORS.content.primary})]})):e.jsx(i.Dropdown,{options:V,isSearchable:!1,onSelect:J,defaultOptions:S?[Object.assign(Object.assign({},S),{selected:!0})]:[]})})),("custom_text"===(null==S?void 0:S.value)||"custom_link"===(null==S?void 0:S.value))&&e.jsx(o.Input,{labelText:"custom_text"===(null==S?void 0:S.value)?"Custom text value":"custom_link"===(null==S?void 0:S.value)?"Custom URL value":"",id:`variable-value-${null==S?void 0:S.value}-${_}`,value:C,errorMessage:W?C&&0!==C.trim().length?"custom_link"!==S.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${C.trim()}`)&&0!==C.trim().length?"custom_link"!==S.value&&C.length>30?"Length cannot be more than 30":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==S?void 0:S.value)?void 0:30,prefixText:"custom_link"===(null==S?void 0:S.value)?"https://":"",placeholder:"link"===E.type||"custom_link"===S.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{!function(e,t){var l;L(t);const a="custom_link"===(null==S?void 0:S.value)&&t?t.includes("https")?t:`https://${t}`:t;K(a,e),R===d.CHANNEL_TYPE.WHATSAPP&&(null==Q||Q(null!==(l=E.index)&&void 0!==l?l:0,a))}(S.value,e)}}),w&&e.jsx(n.AddVariableV2SideModal,{zIndex:2e3,data:null!=y?y:[],showVariable:w,setShowVariable:Y,placeholder:"Add a variable",customTrigger:e=>{null==A||A(!1),"{{custom.url}}"===e.actualValue?J({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?J({label:e.displayName,selected:!0,value:"custom_text"}):J({label:e.displayName.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
7
+ `,x={value:"custom_link",label:"Custom URL"},h={value:"custom_text",label:"Custom text"};exports.Container=g,exports.default=a=>{let{onFocus:b,variable:E,index:_,showVariableModal:j,variableList:A,setShowDiscountCheckBox:y}=a;var f,T;const[P,N]=l.useState(!1),[C,L]=l.useState(""),[k,O]=l.useState([]),[S,V]=l.useState(),[H,w]=l.useState(!1),[M,q]=l.useState(!1),{device:Y,channel:W,isError:I,originalVariableList:B,template:$,templateSelectionTriggered:R,setTemplate:z,setDisplayContent:D,setOriginalVariableList:U,globalNormalizedPlaceholders:Z,enabledCustomText:F}=p.useTemplateModalContext();function G(e,t){var l,a,n;const i=e;L(""),V(i),W===d.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value?(J(null!==(l=i.value)&&void 0!==l?l:"","string"),null==K||K(null!==(a=E.index)&&void 0!==a?a:0,`[[${i.value}]]`)):(null==K||K(null!==(n=E.index)&&void 0!==n?n:0,E.variableName),J("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?J(i.value,"url"===i.bikPlaceholderType?"link":"string"):(L(""),J("",i.value))}function J(e,t){var l,a;const n="custom_link"===t?"link":"custom_text"===t?"string":t;if(W!==d.CHANNEL_TYPE.WHATSAPP){const a=m.getVariableNameForEmailByIndex(_+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===Y?"template_html_mobile":"template_html_desktop"),o=W===d.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:E.variableName);const u=B.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==U||U(u)}if(W===d.CHANNEL_TYPE.WHATSAPP){const t=null===(a=B.body)||void 0===a?void 0:a.map(((t,l)=>l===_?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==U||U((e=>Object.assign(Object.assign({},e),{body:t,buttons:B.buttons})))}}function K(e,t){var l;const a=Object.assign({},$),n=null===(l=null==a?void 0:a.components)||void 0===l?void 0:l.map((l=>{var a,n,i,o,u;const s=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!==(u=null===(o=null===(i=s.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==u?u:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},s.example),{body_text:[l]});return Object.assign(Object.assign({},s),{example:a})}return l}));a.components=n,null==z||z(a)}return l.useEffect((()=>{P&&(null==b||b())}),[P]),l.useEffect((()=>{!function(){var e,t,l,a,n;const i="mobile"===Y?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),u=(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);W===d.CHANNEL_TYPE.EMAIL&&(null==D||D(u))}()}),[R]),l.useEffect((()=>{var e;const t=[];let l=[];if(W!==d.CHANNEL_TYPE.MESSAGE||F){"link"===(null==E?void 0:E.type)?(t.push({label:"",options:[x,h]}),V(x)):(t.push({label:"",options:[x,h]}),V(h));const e=null!=Z?Z:[];O([...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]}else{const e=null!=Z?Z:[];O([{label:"",options:[h,x]},...e]),l=[{label:"",options:[h,x]},...e]}if((W===d.CHANNEL_TYPE.WHATSAPP||W===d.CHANNEL_TYPE.EMAIL||W===d.CHANNEL_TYPE.MESSAGE)&&E.updatedValue)if(s.placeHolderNamePattern.test(E.updatedValue)&&W===d.CHANNEL_TYPE.WHATSAPP||E.updatedValue.startsWith("{{")&&W!==d.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){var a;let n={label:"",value:""};const i=l===d.CHANNEL_TYPE.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");j?n={label:e.updatedValue?e.updatedValue.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}: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}(E,l,W);e.value&&V(e)}else(null===(e=E.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(V(x),L(E.updatedValue.split("https://")[1])):(V(h),L(E.updatedValue))}),[]),l.useEffect((()=>{Y&&S&&C&&setTimeout((()=>{J("custom_link"===(null==S?void 0:S.value)?`https://${C}`:C,S.value)}),100)}),[Y]),l.useEffect((()=>{!M&&S&&E.updatedValue&&setTimeout((()=>{J("custom_link"===(null==S?void 0:S.value)?`https://${E.updatedValue}`:E.updatedValue,S.value),q(!0)}),100)}),[S]),e.jsxs(g,Object.assign({channel:W,focused:P,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:I&&!S?v.COLORS.content.negative:v.COLORS.content.primary}},{children:[null===(f=E.variableName)||void 0===f?void 0:f.replace("{{","").replace("}}","")," ","link"===(null==E?void 0:E.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:j?e.jsxs("div",Object.assign({style:{display:"flex",border:"#E0E0E0 1px solid",borderRadius:4,padding:10,justifyContent:(null==S?void 0:S.label)?"space-between":"flex-end"}},{children:[e.jsx(r.BodyPrimary,{children:u.truncate(null!==(T=null==S?void 0:S.label)&&void 0!==T?T:"",20,!0)}),e.jsx(t.default,{onClick:()=>{w(!H)},width:24,height:24,color:v.COLORS.content.primary})]})):e.jsx(i.Dropdown,{options:k,isSearchable:!1,onSelect:G,defaultOptions:S?[Object.assign(Object.assign({},S),{selected:!0})]:[]})})),("custom_text"===(null==S?void 0:S.value)||"custom_link"===(null==S?void 0:S.value))&&e.jsx(o.Input,{labelText:"custom_text"===(null==S?void 0:S.value)?"Custom text value":"custom_link"===(null==S?void 0:S.value)?"Custom URL value":"",id:`variable-value-${null==S?void 0:S.value}-${_}`,value:C,errorMessage:I?C&&0!==C.trim().length?"custom_link"!==S.value||/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/.test(`https://${C.trim()}`)&&0!==C.trim().length?"custom_link"!==S.value&&C.length>30?"Length cannot be more than 30":"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==S?void 0:S.value)?void 0:30,prefixText:"custom_link"===(null==S?void 0:S.value)?"https://":"",placeholder:"link"===E.type||"custom_link"===S.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>{!function(e,t){var l;L(t);const a="custom_link"===(null==S?void 0:S.value)?`https://${t}`:t;J(a,e),W===d.CHANNEL_TYPE.WHATSAPP&&(null==K||K(null!==(l=E.index)&&void 0!==l?l:0,a))}(S.value,e)}}),H&&e.jsx(n.AddVariableV2SideModal,{zIndex:2e3,data:null!=A?A:[],showVariable:H,setShowVariable:w,placeholder:"Add a variable",customTrigger:e=>{y(!1),"{{custom.url}}"===e.actualValue?G({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?G({label:e.displayName,selected:!0,value:"custom_text"}):G({label:e.actualValue.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../input/Input.js"),i=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),t=require("../context/templateModalContext.js"),l=require("./VariableConnector.js");exports.default=s=>{let{descriptionComponent:n,type:d,showVariableModal:o,variableList:p}=s;var c,b;const{originalVariableList:x,disableEditVariable:u}=t.useTemplateModalContext();return"BODY"===n.type?e.jsx("div",{children:null===(c=null==x?void 0:x.body)||void 0===c?void 0:c.map(((t,s)=>u||!t.isEditableVariable?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(i.BodySecondary,Object.assign({style:{color:r.COLORS.content.primary}},{children:["HEADER"===d?"Header":""," Locked variable ",s+1]})),e.jsx(a.Input,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),s):e.jsx(l.default,{index:s,variable:t,showVariableModal:o,variableList:p,componentType:n.type},`${s}-${t.index}`)))}):"HEADER"===n.type?e.jsx("div",{children:null===(b=null==x?void 0:x.header)||void 0===b?void 0:b.map(((t,s)=>t.isEditableVariable?e.jsx(l.default,{index:s,variable:t,showVariableModal:o,variableList:p,componentType:n.type},`${s}-${t.index}`):e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(i.BodySecondary,Object.assign({style:{color:r.COLORS.content.primary}},{children:["HEADER"===d?"Header":""," Locked variable ",s+1]})),e.jsx(a.Input,{state:"disabled",placeholder:t.variableName,onChangeText:()=>{}})]}),s)))}):e.jsx(e.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../input/Input.js"),r=require("../../TypographyStyle.js"),t=require("../../../constants/Theme.js"),i=require("../context/templateModalContext.js"),l=require("./VariableConnector.js");exports.default=s=>{let{descriptionComponent:n,type:o,showVariableModal:d,variableList:p}=s;var u;const{originalVariableList:b,disableEditVariable:c}=i.useTemplateModalContext();return"BODY"===n.type?e.jsx("div",{children:null===(u=null==b?void 0:b.body)||void 0===u?void 0:u.map(((i,s)=>c||!i.isEditableVariable?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(r.BodySecondary,Object.assign({style:{color:t.COLORS.content.primary}},{children:["HEADER"===o?"Header":""," Locked variable ",s+1]})),e.jsx(a.Input,{state:"disabled",placeholder:i.variableName,onChangeText:()=>{}})]}),s):e.jsx(l.default,{index:s,variable:i,showVariableModal:d,variableList:p},`${s}-${i.index}`)))}):e.jsx(e.Fragment,{})};
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../../assets/icons/info.svg.js"),t=require("react"),i=require("styled-components"),r=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js");var s=require("../../../assets/icons/plus.svg.js");require("../../add-variableV2/AddVariableV2.styled.js"),require("../../button/Button.js"),require("../../icon-button/IconButton.js");var l=require("../../input/Input.js"),o=require("../../tooltips/Tooltip.js"),n=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var d=require("../../TypographyStyle.js"),c=require("../../checkBox/CheckBox.js"),u=require("../context/templateModalContext.js"),h=require("./VariableConnector.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=x(i);const p=b.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../../assets/icons/info.svg.js"),t=require("react"),i=require("styled-components"),r=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js");var s=require("../../../assets/icons/plus.svg.js");require("../../add-variableV2/AddVariableV2.styled.js"),require("../../button/Button.js"),require("../../icon-button/IconButton.js");var l=require("../../input/Input.js"),o=require("../../tooltips/Tooltip.js"),n=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var d=require("../../TypographyStyle.js"),c=require("../../checkBox/CheckBox.js"),u=require("../context/templateModalContext.js"),h=require("./VariableConnector.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=x(i);const j=b.default.div`
2
2
  overflow-y: auto;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  height: 100%;
6
- `,j=b.default.button`
6
+ `,p=b.default.button`
7
7
  padding: 2px 8px;
8
8
  cursor: pointer;
9
9
  color: white;
@@ -24,6 +24,5 @@
24
24
  .add {
25
25
  display: flex;
26
26
  align-items: center;
27
- gap: 5px;
28
27
  }
29
- `;exports.AddVariableStyled=j,exports.Container=p,exports.default=i=>{let{onFocus:x,showVariableModal:b,variableList:g,discountCode:f,setDiscountCode:v}=i;const{originalVariableList:y,disableEditVariable:m}=u.useTemplateModalContext(),[V,O]=t.useState(!1),[q,S]=t.useState(!1),[w,C]=t.useState(!1),[k,T]=t.useState(""),[B,L]=t.useState(!1),E=t.useRef(),A=t.useRef();return t.useEffect((()=>{v&&v(f+k)}),[k]),t.useEffect((()=>{y.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(O(!0),f&&L&&L(!0))}))}),[y]),e.jsxs(p,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[e.jsx(d.TitleRegular,Object.assign({style:{color:n.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(o.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(a.default,{width:20,height:20,color:n.COLORS.content.placeholder})}))}))]})),e.jsx(d.BodySecondary,Object.assign({style:{color:n.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==y?void 0:y.map(((a,t)=>!a.isEditableVariable||m?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(d.BodySecondary,Object.assign({style:{color:n.COLORS.content.primary}},{children:["Locked variable ",t+1]})),e.jsx(l.Input,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),t):e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(h.default,{index:t,variable:a,onFocus:()=>null==x?void 0:x(t),showVariableModal:b,variableList:g,setShowDiscountCheckBox:O})}),t))),(V||f)&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(c.CheckBox,{isChecked:B,onValueChange:()=>{B&&v&&v(""),L(!B)}}),e.jsx(d.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),B&&e.jsxs("div",Object.assign({ref:E,style:{margin:10}},{children:[e.jsx(l.Input,{placeholder:"Enter your discount code",onChangeText:e=>{v&&v(e)},value:f,onFocus:()=>{S(!0)},onBlur:e=>{var a;"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)?(E.current&&E.current.focus(),S(!0)):(S(!1),C(!1))},noErrorHint:!0,validate:e=>[!0,""]}),q&&e.jsx(j,Object.assign({ref:A,id:"addVar",onClick:e=>{e.stopPropagation(),C(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:20,height:20,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),w&&e.jsx(r.AddVariableV2SideModal,{zIndex:2e3,data:null!=g?g:[],showVariable:w,setShowVariable:C,variableValue:k,setVariableValue:T,placeholder:"Add a variable",customTrigger:e=>{T(e.actualValue),S(!1)}})]})};
28
+ `;exports.AddVariableStyled=p,exports.Container=j,exports.default=i=>{let{onFocus:x,showVariableModal:b,variableList:g,discountCode:f,setDiscountCode:v}=i;const{originalVariableList:y,disableEditVariable:m}=u.useTemplateModalContext(),[V,O]=t.useState(!1),[q,S]=t.useState(!1),[w,C]=t.useState(!1),[k,T]=t.useState(""),[B,L]=t.useState(!1),E=t.useRef(),A=t.useRef();return t.useEffect((()=>{v&&v(f+k)}),[k]),t.useEffect((()=>{y.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(O(!0),f&&L&&L(!0))}))}),[y]),e.jsxs(j,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[e.jsx(d.TitleRegular,Object.assign({style:{color:n.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(o.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(a.default,{width:20,height:20,color:n.COLORS.content.placeholder})}))}))]})),e.jsx(d.BodySecondary,Object.assign({style:{color:n.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==y?void 0:y.map(((a,t)=>!a.isEditableVariable||m?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(d.BodySecondary,Object.assign({style:{color:n.COLORS.content.primary}},{children:["Locked variable ",t+1]})),e.jsx(l.Input,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),t):e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(h.default,{index:t,variable:a,onFocus:()=>null==x?void 0:x(t),showVariableModal:b,variableList:g,setShowDiscountCheckBox:O})}),t))),(V||f)&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(c.CheckBox,{isChecked:B,onValueChange:()=>{B&&v&&v(""),L(!B)}}),e.jsx(d.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),B&&e.jsxs("div",Object.assign({ref:E,style:{margin:10}},{children:[e.jsx(l.Input,{placeholder:"Enter your discount code",onChangeText:e=>{v&&v(e)},value:f,onFocus:()=>{S(!0)},onBlur:e=>{var a;"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)?(E.current&&E.current.focus(),S(!0)):(S(!1),C(!1))},noErrorHint:!0,validate:e=>[!0,""]}),q&&e.jsx(p,Object.assign({ref:A,id:"addVar",onClick:e=>{e.stopPropagation(),C(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:20,height:20,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),w&&e.jsx(r.AddVariableV2SideModal,{zIndex:2e3,data:null!=g?g:[],showVariable:w,setShowVariable:C,variableValue:k,setVariableValue:T,placeholder:"Add a variable",customTrigger:e=>{T(e.actualValue),S(!1)}})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),s=require("../../template-preview/constants/regexPatterns.js"),n=require("../../template-preview/models/TemplateMeta.js"),i=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),u=require("../utils/validateIsUrl.js"),c=require("./VariableConnector.js");exports.default=p=>{let{button:b,updateSelectedURLTemplateBtn:j,updateSelectedQRBTemplateBtn:m,originalVariableList:g,CTAoptions:x,QRBoptions:v}=p;const[y,O]=t.useState(""),[f,h]=t.useState(),{setOriginalVariableList:R,isError:U,disableEditVariable:L}=d.useTemplateModalContext();function T(e){O(e);const t=[Object.assign(Object.assign({},g.buttons[0]),{type:i.BUTTON_TYPE.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==R||R((e=>Object.assign(Object.assign({},e),{body:[...g.body],buttons:[...t]}))),null==j||j(`https://${e}`,"custom")}return t.useEffect((()=>{var e;if(b.buttonVariable&&s.editableVarPattern.test(b.buttonVariable))h(n.CUSTOM_URL_NAME),O((null===(e=b.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===b.type?x:v;e="URL"===b.type?t.findIndex((e=>e.placeHolder===b.buttonVariable)):t.findIndex((e=>e.label===b.flowName)),e>-1&&h(t[e])}}),[]),e.jsxs(c.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:o.COLORS.content.primary}},{children:[b.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(l.Dropdown,{disabled:L,options:"URL"===b.type?x:v,isSearchable:!1,onSelect:function(e,t){const l=e;h(l);const a=("URL"===b.type?x:v).find((e=>e.placeHolder===l.placeHolder));if(a)if("custom_link"!==a.value){let e;"URL"===b.type?(e=[Object.assign(Object.assign({},g.buttons[0]),{type:"URL",buttonVariable:l.placeHolder,example:["https://bik.ai/"]})],null==j||j({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder")):(e=g.buttons.map(((e,t)=>t===b.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:l.label,flowId:l.value}):e)),null==m||m({flowName:l.label,flowId:l.value},"placeholder",b.index)),null==R||R((t=>Object.assign(Object.assign({},t),{body:[...g.body],buttons:[...e]})))}else T("")},defaultOptions:f?[Object.assign(Object.assign({},f),{selected:!0})]:[]})})),"custom_link"===(null==f?void 0:f.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:L?"disabled":"none",errorMessage:U?y?u.validateIsUrl(y)?"":"Enter valid URL":"Required field":"",value:y,prefixText:"custom_link"===(null==f?void 0:f.value)?"https://":"",placeholder:"Enter custom URL here",onChangeText:T})}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),s=require("../../template-preview/constants/regexPatterns.js"),n=require("../../template-preview/models/TemplateMeta.js"),i=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),u=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=c=>{let{button:b,updateSelectedURLTemplateBtn:m,updateSelectedQRBTemplateBtn:j,originalVariableList:x,CTAoptions:v,QRBoptions:y}=c;const[f,g]=t.useState(""),[h,O]=t.useState(),{setOriginalVariableList:R,isError:U,disableEditVariable:L}=d.useTemplateModalContext();function T(e){g(e);const t=[Object.assign(Object.assign({},x.buttons[0]),{type:i.BUTTON_TYPE.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==R||R({body:[...x.body],buttons:[...t]}),null==m||m(`https://${e}`,"custom")}return t.useEffect((()=>{var e;if(b.buttonVariable&&s.editableVarPattern.test(b.buttonVariable))O(n.CUSTOM_URL_NAME),g((null===(e=b.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===b.type?v:y;e="URL"===b.type?t.findIndex((e=>e.placeHolder===b.buttonVariable)):t.findIndex((e=>e.label===b.flowName)),e>-1&&O(t[e])}}),[]),e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:o.COLORS.content.primary}},{children:[b.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(l.Dropdown,{disabled:L,options:"URL"===b.type?v:y,isSearchable:!1,onSelect:function(e,t){const l=e;O(l);const a=("URL"===b.type?v:y).find((e=>e.placeHolder===l.placeHolder));if(a)if("custom_link"!==a.value){let e;"URL"===b.type?(e=[Object.assign(Object.assign({},x.buttons[0]),{type:"URL",buttonVariable:l.placeHolder,example:["https://bik.ai/"]})],null==m||m({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder")):(e=x.buttons.map(((e,t)=>t===b.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:l.label,flowId:l.value}):e)),null==j||j({flowName:l.label,flowId:l.value},"placeholder",b.index)),null==R||R({body:[...x.body],buttons:[...e]})}else T("")},defaultOptions:h?[Object.assign(Object.assign({},h),{selected:!0})]:[]})})),"custom_link"===(null==h?void 0:h.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:L?"disabled":"none",errorMessage:U?f?u.validateIsUrl(f)?"":"Enter valid URL":"Required field":"",value:f,prefixText:"custom_link"===(null==h?void 0:h.value)?"https://":"",placeholder:"Enter custom URL here",onChangeText:T})}))]})};
@@ -15,6 +15,5 @@ export interface TemplatePreviewProps {
15
15
  hideHeader?: boolean;
16
16
  size?: 'small' | 'large';
17
17
  templateContainerStyles?: React.CSSProperties;
18
- showSampleValues?: boolean;
19
18
  }
20
- export declare const TemplatePreview: ({ template, channel, whatsAppSpecificMeta, templateCreationsInfo, hideHeader, size, onlyTemplateContent, emailSpecificMeta, smsSpecificMeta, showSampleValues, }: TemplatePreviewProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const TemplatePreview: ({ template, channel, whatsAppSpecificMeta, templateCreationsInfo, hideHeader, size, onlyTemplateContent, emailSpecificMeta, smsSpecificMeta, }: TemplatePreviewProps) => import("react/jsx-runtime").JSX.Element;