@bikdotai/bik-component-library 0.0.627-containerStyle-2 → 0.0.628-beta.0
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.
- package/dist/cjs/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
- package/dist/esm/components/checkBox/CheckBox.d.ts +1 -0
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/esm/components/radioButton/RadioButton.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=i=>e.jsxs("svg",Object.assign({width:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=s=>{const l=i.useMemo((()=>s.activeColor||t.COLORS.background.positive.vibrant),[s.activeColor]);return e.jsxs("svg",Object.assign({width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",viewBox:s.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",rx:"4",fill:s.isDisabled?t.COLORS.content.inactive:l}),!s.isPartial&&e.jsx("svg",Object.assign({width:s.isSmall?"8":"10",height:s.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),s.isPartial&&e.jsx("rect",{x:"5",y:s.isSmall?"7":"8",width:s.isSmall?"6":"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}))};exports.CheckBox=r=>{var o;const[c,d]=i.useState(r.isChecked||!1),[n,h]=i.useState(r.isPartiallyChecked||!1),[b,x]=i.useState(r.isDisabled||!1),[C,S]=i.useState(!1),[u,O]=i.useState(!1);i.useEffect((()=>{d(r.isChecked)}),[r.isChecked]),i.useEffect((()=>{x(r.isDisabled||!1)}),[r.isDisabled]),i.useEffect((()=>{h(r.isPartiallyChecked||!1)}),[r.isPartiallyChecked]);return e.jsxs(s.CheckboxContainer,Object.assign({onClick:e=>{var i;if(!r.isDisabled){const s=!c;n?h(!n):d(s),null===(i=r.onValueChange)||void 0===i||i.call(r,s,r.value,e)}},onMouseEnter:()=>S(!r.skipHoverState),onMouseLeave:()=>S(!1),onMouseDown:()=>O(!r.skipHoverState),onMouseUp:()=>O(!1),isDisabled:b,enableHover:r.enableHover,style:null!==(o=r.style)&&void 0!==o?o:{}},{children:[e.jsx(s.CheckboxIcon,Object.assign({checked:c,hovered:C,clicked:u,isDisabled:b,size:r.size,borderColor:r.checkboxBorderColor},{children:c&&e.jsx(a,{isPartial:n||!1,isDisabled:b,isSmall:"SMALL"===r.size,activeColor:null==r?void 0:r.activeColor})})),r.label?r.boldOnChecked&&c?"DEFAULT"===r.labelSize?e.jsx(l.TitleRegular,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(l.TitleSmall,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):"SMALL"===r.size||"SMALL"===r.labelSize?e.jsx(l.BodySecondary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(l.BodyPrimary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(e.Fragment,{}),r.rightComponent]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=s=>{const t=i.useMemo((()=>(null==s?void 0:s.activeColor)||l.COLORS.background.positive.vibrant),[s.activeColor]),a=i.useMemo((()=>s.isDisabled?l.COLORS.content.inactive:s.isActive?t:l.COLORS.content.primary),[s.isDisabled,s.isActive,t]);return e.jsxs("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:a,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e.jsx("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?l.COLORS.content.inactive:t})]}))};exports.RadioButton=o=>{const[r,c]=i.useState(o.isActive||!1),[n,d]=i.useState(!1),[O,S]=i.useState(!1);i.useEffect((()=>{c(o.isActive)}),[o.isActive]);return e.jsxs(s.RadioButtonContainer,Object.assign({onClick:()=>{var e;if(!o.skipSelectingOff&&!o.isDisabled){const i=!r;c(i),null===(e=o.onValueChange)||void 0===e||e.call(o,i,o.value)}},onMouseEnter:()=>d(!o.skipHoverState),onMouseLeave:()=>d(!1),onMouseDown:()=>S(!o.skipHoverState),onMouseUp:()=>S(!1),style:o.caption?{alignItems:"flex-start"}:{}},{children:[e.jsx(s.RadioButtonIcon,Object.assign({checked:r,hovered:n,clicked:O,isDisabled:o.isDisabled||!1,size:o.size,style:o.caption?{margin:"2px 0"}:{}},{children:e.jsx(a,{isSmall:"SMALL"===o.size,isActive:r,isDisabled:o.isDisabled||!1,activeColor:o.activeColor})})),e.jsxs("div",{children:[o.label?o.boldOnChecked&&r||o.alwaysBold?e.jsx(t.TitleSmall,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):"SMALL"===o.size?e.jsx(t.BodyCaption,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):"MEDIUM"===o.labelSize?e.jsx(t.BodySecondary,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):e.jsx(t.BodyPrimary,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:o.label})):e.jsx(e.Fragment,{}),o.caption&&e.jsx(t.BodyCaption,Object.assign({color:o.isDisabled?l.COLORS.text.disabled:l.COLORS.text.secondary},{children:o.caption}))]})]}))};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var n=require("../../variable-picker-v3/model.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var n=require("../../variable-picker-v3/model.js"),o=require("lodash"),t=require("react"),i=require("styled-components"),l=require("../../input/Input.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../template-preview/models/TemplateMeta.js"),d=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../context/templateModalContext.js"),u=require("../utils/constants.js"),p=require("../utils/getDataFromTemplateComponent.js"),c=require("../utils/validateIsUrl.js"),v=require("../utils/validateName.js"),m=require("./BackTrackComponent.js"),b=require("./DiscountCodeComponent.js"),g=require("./EditMediaModal.js"),h=require("./EditMediaV2.js"),f=require("./EditMediaV2.style.js"),j=require("./useEditWhtasappTemplateMedia.js"),C=require("./VariableConnector.js"),x=require("./VariableConnectorsPanel.js"),T=require("./VariableConnectorWhatsApp.js"),O=require("./VariableEditorHeader.js"),E=require("./WhatsAppTemplateCardButtonV2.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const V=y(i).default.div`
|
|
2
2
|
padding-top: 24px;
|
|
3
3
|
padding-left: 10px;
|
|
4
4
|
padding-right: 10px;
|
|
5
5
|
margin-bottom: 8px;
|
|
6
6
|
line-height: normal;
|
|
7
|
-
`;exports.default=i=>{let{template:y,onTemplateChange:B,whatsappSpecificPickerMeta:M,showVariableModal:k,variableListForImage:D,setDiscountCode:I,fileName:q,setFileName:R}=i;var P,L,A,U,w,N,_,H,S,F,Q,Y,W,K,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,re,ue,pe,ce,ve,me,be,ge,he,fe;const je=y.isCarouselType,{originalVariableList:Ce,pod:Te,extras:xe,selectedCarouselIndex:Oe,isProductCarouselType:Ee,disableCopyCode:ye,isError:Ve}=r.useTemplateModalContext(),{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}=p.getAllDataFromTemplateComponent(y),Re=o.useRef(null),[Pe,Le]=o.useState(!1),[Ae,Ue]=o.useState(-1===Oe?{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}:{}),{uploadMediaLink:we,uploadMediaFiles:Ne,validateMimeType:_e}=M,He=j.useEditWhatsappTemplateMedia({uploadMediaLink:we,uploadMediaFiles:Ne,updateTemplateImageUrl:function(e,n){var o,i,l,a,s,d,r,u;let p;p=null!=Oe&&Oe>-1?{components:null===(i=null===(o=y.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[Oe].components,mapping:null===(a=null===(l=null==y?void 0:y.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Oe]}:Object.assign({},y);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==p?void 0:p.components[c])){const t=Object.assign(Object.assign({},p.components[c]),{format:n,example:{header_handle:[e]}}),o=[...p.components];o[c]=t,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=Oe&&Oe>-1){const e=t.cloneDeep(y);e.components[1].cards[Oe].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.cards.length)>0&&(e.mapping.cards[Oe]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==B||B(Object.assign({},e)),Fe(!0)}else null==B||B(Object.assign({},p))},validateMimeType:_e,mediaComponent:je?Ae.imageComponent:De,fileRef:Re}),[Se,Fe]=o.useState(!1),[Qe,Ye]=o.useState(q),[We,Ke]=o.useState();function $e(e,n,o){var i,l,a,s,d,r,u,p,c,v;const m=null!=Oe&&Oe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[Oe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[Oe]}:Object.assign({},y),b=t.cloneDeep(m),g="custom"===n&&"string"==typeof e,h=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Oe&&Oe>-1&&Ee){const n=Object.assign({},y).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let a=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[h]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=null===(s=null===(a=Object.assign({},y).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=t.cloneDeep(y);return l.components=n,l.mapping.cards=i,void(null==B||B(Object.assign({},l)))}const f=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==f&&f>-1){const t=null===(d=null==b?void 0:b.components[f].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=t[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(u=null===(r=b.components)||void 0===r?void 0:r[f])||void 0===u?void 0:u.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[f]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[f]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Le(!0):(Le(!1),null==I||I(""))}if(null!=Oe&&Oe>-1){const e=t.cloneDeep(y);e.components[1].cards[Oe].components=b.components,e.mapping.cards[Oe]=b.mapping,null==B||B(Object.assign({},e))}else null==B||B(b)}function Ge(e,n,o){var i,l,a,s,d,r,u;const p=null!=Oe&&Oe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[Oe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[Oe]}:Object.assign({},y);if(null!=Oe&&Oe>-1&&Ee){const n=Object.assign({},y).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[o])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t.cloneDeep(y);return i.components=n,void(null==B||B(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==p?void 0:p.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(u=null===(r=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==u?u:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},p.components[c]),{buttons:i}),a=[...p.components];a[c]=l,p.components=a}}if(null!=Oe&&Oe>-1){const e=t.cloneDeep(y);e.components[1].cards[Oe].components=p.components,null==B||B(Object.assign({},e))}else null==B||B(p)}o.useEffect((()=>{var e,n;if(null===(e=y.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))Le(!0);else{Le(!1);const e=null===(n=null==xe?void 0:xe.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[y]),o.useEffect((()=>{var e,n,t,o;if(null!=Oe&&Oe>-1){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Oe].components,mapping:null===(o=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Oe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u})}else if(null!=Oe&&-1===Oe){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=p.getAllDataFromTemplateComponent(y);Ue({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[Oe]),o.useEffect((()=>{var e,n,t,o;if(null!=Oe&&Oe>-1&&Se){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Oe].components,mapping:null===(o=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[Oe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}),Fe(!1)}}),[Se]);o.useEffect((()=>{Ve&&Te===d.POD.CHATBOT&&(()=>{if(!q)return void Ke("PDF name is Required");const e=v.validateInputNameChatbot(q);null==R||R(null!=q?q:""),Ke(e?"Please enter a valid PDF name":void 0)})()}),[Ve]);const Xe=je?Ae.imageComponent:De;return He.openEditMedia?e.jsx(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(g.default,{mediaComponentFormat:null!==(P=Xe.format)&&void 0!==P?P:s.HEADER_TYPES.IMAGE,uploadMedia:He.uploadMedia,variableListForImage:D||[],useEditWhatsappTemplateMediaResponse:He,setOpenEditMedia:He.setOpenEditMedia,openEditMedia:He.openEditMedia,editIconRef:He.editIconRef,fileRef:Re})})):e.jsxs(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Ee?"420px":"auto"}},{children:[!!Ae.imageComponent&&!Ee&&e.jsxs(f.EditTemplateMediaContainer,{children:[e.jsx(h.default,{imageName:null!==(A=null===(L=null==Xe?void 0:Xe.example)||void 0===L?void 0:L.header_handle)&&void 0!==A?A:[],handleImageChange:He.handleImageChange,mediaType:null==Xe?void 0:Xe.format,error:He.error,isLoading:He.loading,setOpenEditMedia:He.setOpenEditMedia,selectedVariable:c.isVariable(null!==(N=null===(w=null===(U=null==Xe?void 0:Xe.example)||void 0===U?void 0:U.header_handle)||void 0===w?void 0:w[0])&&void 0!==N?N:"")?null===(H=null===(_=null==Xe?void 0:Xe.example)||void 0===_?void 0:_.header_handle)||void 0===H?void 0:H[0]:(null===(F=null===(S=null==y?void 0:y.mapping)||void 0===S?void 0:S.header)||void 0===F?void 0:F[0])?null===(Y=null===(Q=null==y?void 0:y.mapping)||void 0===Q?void 0:Q.header)||void 0===Y?void 0:Y[0]:He.selectedVariable}),(null==De?void 0:De.format)==s.HEADER_TYPES.DOCUMENT?e.jsx(V,{children:Te===d.POD.CHATBOT?e.jsx(a.InputWithVariables,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:We||void 0,onChange:e=>{var n;Ke(""),null==R||R(null!==(n=null==e?void 0:e.actualValue)&&void 0!==n?n:"")},pickerType:n.PickerType.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=q?q:"",variableType:"string"},variablesList:D,showAddButton:!0}):e.jsx(l.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Qe,errorMessage:We||void 0,onBlur:()=>{if(!Qe)return null==R||R(""),void Ke("PDF name is Required");const e=v.validateInputName(Qe);null==R||R(Qe),Ke(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Ke(""),Ye(e)}})}):e.jsx(e.Fragment,{})]}),(null===(W=Ae.bodyVariables)||void 0===W?void 0:W.length)>0&&e.jsx(O.default,{containerStyle:{paddingTop:Ae.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(K=Ae.descriptionComponents)||void 0===K?void 0:K.map(((n,t)=>e.jsx(x.default,{originalVariableList:null!=Oe&&Oe>-1?Ce.cards[Oe]:Ce,type:n.type,descriptionComponent:n.component,showVariableModal:k},t))),(null===(X=null===(G=null!=Oe&&Oe>-1?null===($=Ce.cards[Oe])||void 0===$?void 0:$.buttons:null==Ce?void 0:Ce.buttons)||void 0===G?void 0:G.filter((e=>"URL"===e.type)))||void 0===X?void 0:X.length)>0&&e.jsx(O.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(Z=null===(J=null!=Oe&&Oe>-1?null===(z=Ce.cards[Oe])||void 0===z?void 0:z.buttons:null==Ce?void 0:Ce.buttons)||void 0===J?void 0:J.filter((e=>Te===d.POD.CHATBOT||"URL"===e.type)))||void 0===Z?void 0:Z.map(((n,t)=>{const o=n.buttonVariable===u.STATIC_URL_VARIABLE_NAME;if("URL"===n.type)return e.jsx(E.default,{variableListIndex:t,disableEdit:o,CTAoptions:null==M?void 0:M.CTAoptions,button:n,currentVariableList:null!=Oe&&Oe>-1?Object.assign({},Ce.cards[Oe]):Object.assign({},Ce),updateSelectedURLTemplateBtn:$e},`${t}_${Oe}`)})),Te===d.POD.CHATBOT&&(null===(ne=null===(ee=ke[0])||void 0===ee?void 0:ee.component)||void 0===ne?void 0:ne.buttons)&&(null===(ie=null===(oe=null===(te=ke[0])||void 0===te?void 0:te.component)||void 0===oe?void 0:oe.buttons)||void 0===ie?void 0:ie.length)>0&&e.jsx(m.BackTrackComponent,{backTrackMessage:null===(le=null==xe?void 0:xe.backTrackExtra)||void 0===le?void 0:le[0],setBackTrackMessage:null===(ae=null==xe?void 0:xe.backTrackExtra)||void 0===ae?void 0:ae[1]}),(null===(re=null===(de=null!=Oe&&Oe>-1?null===(se=Ce.cards[Oe])||void 0===se?void 0:se.buttons:null==Ce?void 0:Ce.buttons)||void 0===de?void 0:de.filter((e=>"QUICK_REPLY"===e.type)))||void 0===re?void 0:re.length)>0&&(Te!==d.POD.CHATBOT?e.jsx(O.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(m.BackTrackComponent,{backTrackMessage:null===(ue=null==xe?void 0:xe.backTrackExtra)||void 0===ue?void 0:ue[0],setBackTrackMessage:null===(pe=null==xe?void 0:xe.backTrackExtra)||void 0===pe?void 0:pe[1]})),null===(me=null===(ve=null!=Oe&&Oe>-1?null===(ce=Ce.cards[Oe])||void 0===ce?void 0:ce.buttons:null==Ce?void 0:Ce.buttons)||void 0===ve?void 0:ve.filter((e=>"QUICK_REPLY"===e.type)))||void 0===me?void 0:me.map(((n,t)=>{if("QUICK_REPLY"===n.type&&Te!==d.POD.CHATBOT)return e.jsx(E.default,{variableListIndex:t,QRBoptions:null==M?void 0:M.QRBoptions,button:n,currentVariableList:null!=Oe&&Oe>-1?Object.assign({},Ce.cards[Oe]):Object.assign({},Ce),updateSelectedQRBTemplateBtn:Ge},`${t}_${Oe}`)})),Te===d.POD.CHATBOT&&Pe&&e.jsx(b.DiscountCodeComponent,{discountCode:null===(be=null==xe?void 0:xe.discountCodeExtra)||void 0===be?void 0:be[0],setDiscountCode:null===(ge=null==xe?void 0:xe.discountCodeExtra)||void 0===ge?void 0:ge[1]}),null===(fe=null!=Oe&&Oe>-1?null===(he=Ce.cards[Oe])||void 0===he?void 0:he.buttons:null==Ce?void 0:Ce.buttons)||void 0===fe?void 0:fe.map(((n,t)=>{var o,i,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:ye?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(l.Input,{state:"disabled",labelText:null!==(o=n.text)&&void 0!==o?o:"Copy Code",value:null!==(i=n.buttonVariable)&&void 0!==i?i:"",onChangeText:()=>{}})})):e.jsx(C.default,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))};
|
|
7
|
+
`;exports.default=i=>{let{template:y,onTemplateChange:B,whatsappSpecificPickerMeta:M,showVariableModal:k,variableListForImage:D,setDiscountCode:I,fileName:q,setFileName:R}=i;var P,L,A,U,w,N,_,H,S,F,Q,Y,W,K,$,G,X,z,J,Z,ee,ne,oe,te,ie,le,ae,se,de,re,ue,pe,ce,ve,me,be,ge,he,fe;const je=y.isCarouselType,{originalVariableList:Ce,pod:xe,extras:Te,selectedCarouselIndex:Oe,isProductCarouselType:Ee,disableCopyCode:ye,isError:Ve}=r.useTemplateModalContext(),{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}=p.getAllDataFromTemplateComponent(y),Re=t.useRef(null),[Pe,Le]=t.useState(!1),[Ae,Ue]=t.useState(-1===Oe?{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}:{}),{uploadMediaLink:we,uploadMediaFiles:Ne,validateMimeType:_e}=M,He=j.useEditWhatsappTemplateMedia({uploadMediaLink:we,uploadMediaFiles:Ne,updateTemplateImageUrl:function(e,n){var t,i,l,a,s,d,r,u;let p;p=null!=Oe&&Oe>-1?{components:null===(i=null===(t=y.components[1])||void 0===t?void 0:t.cards)||void 0===i?void 0:i[Oe].components,mapping:null===(a=null===(l=null==y?void 0:y.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Oe]}:Object.assign({},y);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==p?void 0:p.components[c])){const o=Object.assign(Object.assign({},p.components[c]),{format:n,example:{header_handle:[e]}}),t=[...p.components];t[c]=o,p=Object.assign(Object.assign({},p),{components:t})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=Oe&&Oe>-1){const e=o.cloneDeep(y);e.components[1].cards[Oe].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.cards.length)>0&&(e.mapping.cards[Oe]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==B||B(Object.assign({},e)),Fe(!0)}else null==B||B(Object.assign({},p))},validateMimeType:_e,mediaComponent:je?Ae.imageComponent:De,fileRef:Re}),[Se,Fe]=t.useState(!1),[Qe,Ye]=t.useState(q),[We,Ke]=t.useState();function $e(e,n,t){var i,l,a,s,d,r,u,p,c,v;console.log("val",e),console.log("mode",n),console.log("btnIndex",t);const m=null!=Oe&&Oe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[Oe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[Oe]}:Object.assign({},y),b=o.cloneDeep(m),g="custom"===n&&"string"==typeof e,h=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Oe&&Oe>-1&&Ee){const n=Object.assign({},y).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,o,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let a=null!==(o=null==l?void 0:l[t])&&void 0!==o?o:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[h]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e}));console.log("old mapping",y.mapping);const i=null===(s=null===(a=Object.assign({},y).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var o;return Object.assign(Object.assign({},n),{buttons:null===(o=null==n?void 0:n.buttons)||void 0===o?void 0:o.map(((n,o)=>(console.log("button",n),console.log("ind",o),o===t?g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"":n)))})}));console.log("new mapping",i);const l=o.cloneDeep(y);return l.components=n,l.mapping.cards=i,void(null==B||B(Object.assign({},l)))}const f=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==f&&f>-1){const o=null===(d=null==b?void 0:b.components[f].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==o?void 0:o.length)>0){const i="custom"===n&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=o[t];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(u=null===(r=b.components)||void 0===r?void 0:r[f])||void 0===u?void 0:u.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[f]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[t]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[f]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Le(!0):(Le(!1),null==I||I(""))}if(null!=Oe&&Oe>-1){const e=o.cloneDeep(y);e.components[1].cards[Oe].components=b.components,e.mapping.cards[Oe]=b.mapping,null==B||B(Object.assign({},e))}else null==B||B(b)}function Ge(e,n,t){var i,l,a,s,d,r,u;const p=null!=Oe&&Oe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[Oe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[Oe]}:Object.assign({},y);if(null!=Oe&&Oe>-1&&Ee){const n=Object.assign({},y).components.map((n=>{var o;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(o=n.cards)||void 0===o?void 0:o.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var o,i,l;if("BUTTONS"===n.type){const a=null===(o=null==n?void 0:n.buttons)||void 0===o?void 0:o.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[t])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=o.cloneDeep(y);return i.components=n,void(null==B||B(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==p?void 0:p.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let o=n[t];o=Object.assign(Object.assign({},o),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(u=null===(r=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==u?u:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==o?void 0:o.text)?o:e)),l=Object.assign(Object.assign({},p.components[c]),{buttons:i}),a=[...p.components];a[c]=l,p.components=a}}if(null!=Oe&&Oe>-1){const e=o.cloneDeep(y);e.components[1].cards[Oe].components=p.components,null==B||B(Object.assign({},e))}else null==B||B(p)}t.useEffect((()=>{var e,n;if(null===(e=y.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))Le(!0);else{Le(!1);const e=null===(n=null==Te?void 0:Te.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[y]),t.useEffect((()=>{var e,n,o,t;if(null!=Oe&&Oe>-1){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Oe].components,mapping:null===(t=null===(o=null==y?void 0:y.mapping)||void 0===o?void 0:o.cards)||void 0===t?void 0:t[Oe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u})}else if(null!=Oe&&-1===Oe){const{descriptionComponents:e,urlBtns:n,qrbBtns:o,imageComponent:t,bodyVariables:i,headerVariables:l}=p.getAllDataFromTemplateComponent(y);Ue({descriptionComponents:e,urlBtns:n,qrbBtns:o,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Oe]),t.useEffect((()=>{var e,n,o,t;if(null!=Oe&&Oe>-1&&Se){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[Oe].components,mapping:null===(t=null===(o=null==y?void 0:y.mapping)||void 0===o?void 0:o.cards)||void 0===t?void 0:t[Oe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}),Fe(!1)}}),[Se]);t.useEffect((()=>{Ve&&xe===d.POD.CHATBOT&&(()=>{if(!q)return void Ke("PDF name is Required");const e=v.validateInputNameChatbot(q);null==R||R(null!=q?q:""),Ke(e?"Please enter a valid PDF name":void 0)})()}),[Ve]);const Xe=je?Ae.imageComponent:De;return He.openEditMedia?e.jsx(x.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(g.default,{mediaComponentFormat:null!==(P=Xe.format)&&void 0!==P?P:s.HEADER_TYPES.IMAGE,uploadMedia:He.uploadMedia,variableListForImage:D||[],useEditWhatsappTemplateMediaResponse:He,setOpenEditMedia:He.setOpenEditMedia,openEditMedia:He.openEditMedia,editIconRef:He.editIconRef,fileRef:Re})})):e.jsxs(x.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Ee?"420px":"auto"}},{children:[!!Ae.imageComponent&&!Ee&&e.jsxs(f.EditTemplateMediaContainer,{children:[e.jsx(h.default,{imageName:null!==(A=null===(L=null==Xe?void 0:Xe.example)||void 0===L?void 0:L.header_handle)&&void 0!==A?A:[],handleImageChange:He.handleImageChange,mediaType:null==Xe?void 0:Xe.format,error:He.error,isLoading:He.loading,setOpenEditMedia:He.setOpenEditMedia,selectedVariable:c.isVariable(null!==(N=null===(w=null===(U=null==Xe?void 0:Xe.example)||void 0===U?void 0:U.header_handle)||void 0===w?void 0:w[0])&&void 0!==N?N:"")?null===(H=null===(_=null==Xe?void 0:Xe.example)||void 0===_?void 0:_.header_handle)||void 0===H?void 0:H[0]:(null===(F=null===(S=null==y?void 0:y.mapping)||void 0===S?void 0:S.header)||void 0===F?void 0:F[0])?null===(Y=null===(Q=null==y?void 0:y.mapping)||void 0===Q?void 0:Q.header)||void 0===Y?void 0:Y[0]:He.selectedVariable}),(null==De?void 0:De.format)==s.HEADER_TYPES.DOCUMENT?e.jsx(V,{children:xe===d.POD.CHATBOT?e.jsx(a.InputWithVariables,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:We||void 0,onChange:e=>{var n;Ke(""),null==R||R(null!==(n=null==e?void 0:e.actualValue)&&void 0!==n?n:"")},pickerType:n.PickerType.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=q?q:"",variableType:"string"},variablesList:D,showAddButton:!0}):e.jsx(l.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Qe,errorMessage:We||void 0,onBlur:()=>{if(!Qe)return null==R||R(""),void Ke("PDF name is Required");const e=v.validateInputName(Qe);null==R||R(Qe),Ke(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Ke(""),Ye(e)}})}):e.jsx(e.Fragment,{})]}),(null===(W=Ae.bodyVariables)||void 0===W?void 0:W.length)>0&&e.jsx(O.default,{containerStyle:{paddingTop:Ae.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(K=Ae.descriptionComponents)||void 0===K?void 0:K.map(((n,o)=>e.jsx(T.default,{originalVariableList:null!=Oe&&Oe>-1?Ce.cards[Oe]:Ce,type:n.type,descriptionComponent:n.component,showVariableModal:k},o))),(null===(X=null===(G=null!=Oe&&Oe>-1?null===($=Ce.cards[Oe])||void 0===$?void 0:$.buttons:null==Ce?void 0:Ce.buttons)||void 0===G?void 0:G.filter((e=>"URL"===e.type)))||void 0===X?void 0:X.length)>0&&e.jsx(O.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(Z=null===(J=null!=Oe&&Oe>-1?null===(z=Ce.cards[Oe])||void 0===z?void 0:z.buttons:null==Ce?void 0:Ce.buttons)||void 0===J?void 0:J.filter((e=>xe===d.POD.CHATBOT||"URL"===e.type)))||void 0===Z?void 0:Z.map(((n,o)=>{const t=n.buttonVariable===u.STATIC_URL_VARIABLE_NAME;if("URL"===n.type)return e.jsx(E.default,{variableListIndex:o,disableEdit:t,CTAoptions:null==M?void 0:M.CTAoptions,button:n,currentVariableList:null!=Oe&&Oe>-1?Object.assign({},Ce.cards[Oe]):Object.assign({},Ce),updateSelectedURLTemplateBtn:$e},`${o}_${Oe}`)})),xe===d.POD.CHATBOT&&(null===(ne=null===(ee=ke[0])||void 0===ee?void 0:ee.component)||void 0===ne?void 0:ne.buttons)&&(null===(ie=null===(te=null===(oe=ke[0])||void 0===oe?void 0:oe.component)||void 0===te?void 0:te.buttons)||void 0===ie?void 0:ie.length)>0&&e.jsx(m.BackTrackComponent,{backTrackMessage:null===(le=null==Te?void 0:Te.backTrackExtra)||void 0===le?void 0:le[0],setBackTrackMessage:null===(ae=null==Te?void 0:Te.backTrackExtra)||void 0===ae?void 0:ae[1]}),(null===(re=null===(de=null!=Oe&&Oe>-1?null===(se=Ce.cards[Oe])||void 0===se?void 0:se.buttons:null==Ce?void 0:Ce.buttons)||void 0===de?void 0:de.filter((e=>"QUICK_REPLY"===e.type)))||void 0===re?void 0:re.length)>0&&(xe!==d.POD.CHATBOT?e.jsx(O.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(m.BackTrackComponent,{backTrackMessage:null===(ue=null==Te?void 0:Te.backTrackExtra)||void 0===ue?void 0:ue[0],setBackTrackMessage:null===(pe=null==Te?void 0:Te.backTrackExtra)||void 0===pe?void 0:pe[1]})),null===(me=null===(ve=null!=Oe&&Oe>-1?null===(ce=Ce.cards[Oe])||void 0===ce?void 0:ce.buttons:null==Ce?void 0:Ce.buttons)||void 0===ve?void 0:ve.filter((e=>"QUICK_REPLY"===e.type)))||void 0===me?void 0:me.map(((n,o)=>{if("QUICK_REPLY"===n.type&&xe!==d.POD.CHATBOT)return e.jsx(E.default,{variableListIndex:o,QRBoptions:null==M?void 0:M.QRBoptions,button:n,currentVariableList:null!=Oe&&Oe>-1?Object.assign({},Ce.cards[Oe]):Object.assign({},Ce),updateSelectedQRBTemplateBtn:Ge},`${o}_${Oe}`)})),xe===d.POD.CHATBOT&&Pe&&e.jsx(b.DiscountCodeComponent,{discountCode:null===(be=null==Te?void 0:Te.discountCodeExtra)||void 0===be?void 0:be[0],setDiscountCode:null===(ge=null==Te?void 0:Te.discountCodeExtra)||void 0===ge?void 0:ge[1]}),null===(fe=null!=Oe&&Oe>-1?null===(he=Ce.cards[Oe])||void 0===he?void 0:he.buttons:null==Ce?void 0:Ce.buttons)||void 0===fe?void 0:fe.map(((n,o)=>{var t,i,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:ye?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(l.Input,{state:"disabled",labelText:null!==(t=n.text)&&void 0!==t?t:"Copy Code",value:null!==(i=n.buttonVariable)&&void 0!==i?i:"",onChangeText:()=>{}})})):e.jsx(C.default,{index:o,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},o)})}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as s,useEffect as a}from"react";import{CheckboxContainer as
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as s,useEffect as t,useMemo as a}from"react";import{CheckboxContainer as o,CheckboxIcon as r}from"./CheckBox.styled.js";import{TitleRegular as d,TitleSmall as n,BodySecondary as c,BodyPrimary as h}from"../TypographyStyle.js";import{COLORS as b}from"../../constants/Theme.js";const m=l=>{const s=a((()=>l.activeColor||b.background.positive.vibrant),[l.activeColor]);return e("svg",Object.assign({width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",viewBox:l.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[i("rect",{x:"0",y:"0",width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",rx:"4",fill:l.isDisabled?b.content.inactive:s}),!l.isPartial&&i("svg",Object.assign({width:l.isSmall?"8":"10",height:l.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),l.isPartial&&i("rect",{x:"5",y:l.isSmall?"7":"8",width:l.isSmall?"6":"8",height:"2",rx:"1",fill:b.surface.standard})]}))},v=a=>{var v;const[g,C]=s(a.isChecked||!1),[p,x]=s(a.isPartiallyChecked||!1),[S,u]=s(a.isDisabled||!1),[w,y]=s(!1),[k,D]=s(!1);t((()=>{C(a.isChecked)}),[a.isChecked]),t((()=>{u(a.isDisabled||!1)}),[a.isDisabled]),t((()=>{x(a.isPartiallyChecked||!1)}),[a.isPartiallyChecked]);return e(o,Object.assign({onClick:e=>{var i;if(!a.isDisabled){const l=!g;p?x(!p):C(l),null===(i=a.onValueChange)||void 0===i||i.call(a,l,a.value,e)}},onMouseEnter:()=>y(!a.skipHoverState),onMouseLeave:()=>y(!1),onMouseDown:()=>D(!a.skipHoverState),onMouseUp:()=>D(!1),isDisabled:S,enableHover:a.enableHover,style:null!==(v=a.style)&&void 0!==v?v:{}},{children:[i(r,Object.assign({checked:g,hovered:w,clicked:k,isDisabled:S,size:a.size,borderColor:a.checkboxBorderColor},{children:g&&i(m,{isPartial:p||!1,isDisabled:S,isSmall:"SMALL"===a.size,activeColor:null==a?void 0:a.activeColor})})),a.label?a.boldOnChecked&&g?"DEFAULT"===a.labelSize?i(d,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(n,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):"SMALL"===a.size||"SMALL"===a.labelSize?i(c,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(h,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(l,{}),a.rightComponent]}))};export{v as CheckBox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t}from"react";import{RadioButtonContainer as
|
|
1
|
+
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t,useMemo as a}from"react";import{RadioButtonContainer as o,RadioButtonIcon as c}from"./RadioButton.styled.js";import{BodyCaption as r,TitleSmall as n,BodySecondary as d,BodyPrimary as b}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";const v=s=>{const l=a((()=>(null==s?void 0:s.activeColor)||m.background.positive.vibrant),[s.activeColor]),t=a((()=>s.isDisabled?m.content.inactive:s.isActive?l:m.content.primary),[s.isDisabled,s.isActive,l]);return i("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:t,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?m.content.inactive:l})]}))},p=a=>{const[p,h]=l(a.isActive||!1),[g,x]=l(!1),[S,y]=l(!1);t((()=>{h(a.isActive)}),[a.isActive]);return i(o,Object.assign({onClick:()=>{var i;if(!a.skipSelectingOff&&!a.isDisabled){const e=!p;h(e),null===(i=a.onValueChange)||void 0===i||i.call(a,e,a.value)}},onMouseEnter:()=>x(!a.skipHoverState),onMouseLeave:()=>x(!1),onMouseDown:()=>y(!a.skipHoverState),onMouseUp:()=>y(!1),style:a.caption?{alignItems:"flex-start"}:{}},{children:[e(c,Object.assign({checked:p,hovered:g,clicked:S,isDisabled:a.isDisabled||!1,size:a.size,style:a.caption?{margin:"2px 0"}:{}},{children:e(v,{isSmall:"SMALL"===a.size,isActive:p,isDisabled:a.isDisabled||!1,activeColor:a.activeColor})})),i("div",{children:[a.label?a.boldOnChecked&&p||a.alwaysBold?e(n,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):"SMALL"===a.size?e(r,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):"MEDIUM"===a.labelSize?e(d,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):e(b,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):e(s,{}),a.caption&&e(r,Object.assign({color:a.isDisabled?m.text.disabled:m.text.secondary},{children:a.caption}))]})]}))};export{p as RadioButton};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o,Fragment as n}from"react/jsx-runtime";import"../../curtain/CurtainHelper.js";import{PickerType as t}from"../../variable-picker-v3/model.js";import{cloneDeep as i}from"lodash";import{useRef as l,useState as a,useEffect as s}from"react";import d from"styled-components";import{Input as r}from"../../input/Input.js";import{InputWithVariables as p}from"../../input-with-vars/InputWithVariables.js";import{HEADER_TYPES as u}from"../../template-preview/models/TemplateMeta.js";import{POD as c}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import{STATIC_URL_VARIABLE_NAME as m}from"../utils/constants.js";import{getAllDataFromTemplateComponent as b}from"../utils/getDataFromTemplateComponent.js";import{isVariable as g}from"../utils/validateIsUrl.js";import{validateInputName as f,validateInputNameChatbot as h}from"../utils/validateName.js";import{BackTrackComponent as j}from"./BackTrackComponent.js";import{DiscountCodeComponent as C}from"./DiscountCodeComponent.js";import O from"./EditMediaModal.js";import T from"./EditMediaV2.js";import{EditTemplateMediaContainer as x}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as y}from"./useEditWhtasappTemplateMedia.js";import E from"./VariableConnector.js";import{Container as V}from"./VariableConnectorsPanel.js";import B from"./VariableConnectorWhatsApp.js";import M from"./VariableEditorHeader.js";import k from"./WhatsAppTemplateCardButtonV2.js";const I=d=>{let{template:I,onTemplateChange:R,whatsappSpecificPickerMeta:U,showVariableModal:w,variableListForImage:P,setDiscountCode:N,fileName:A,setFileName:D}=d;var H,_,F,S,q,Q,Y,K,W,$,G,X,z,J,Z,ee,oe,ne,te,ie,le,ae,se,de,re,pe,ue,ce,ve,me,be,ge,fe,he,je,Ce,Oe,Te,xe;const ye=I.isCarouselType,{originalVariableList:Ee,pod:Ve,extras:Be,selectedCarouselIndex:Me,isProductCarouselType:ke,disableCopyCode:Ie,isError:Le}=v(),{descriptionComponents:Re,urlBtns:Ue,qrbBtns:we,imageComponent:Pe,bodyVariables:Ne,headerVariables:Ae}=b(I),De=l(null),[He,_e]=a(!1),[Fe,Se]=a(-1===Me?{descriptionComponents:Re,urlBtns:Ue,qrbBtns:we,imageComponent:Pe,bodyVariables:Ne,headerVariables:Ae}:{}),{uploadMediaLink:qe,uploadMediaFiles:Qe,validateMimeType:Ye}=U,Ke=y({uploadMediaLink:qe,uploadMediaFiles:Qe,updateTemplateImageUrl:function(e,o){var n,t,l,a,s,d,r,p;let u;u=null!=Me&&Me>-1?{components:null===(t=null===(n=I.components[1])||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Me].components,mapping:null===(a=null===(l=null==I?void 0:I.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Me]}:Object.assign({},I);const c=null===(s=null==u?void 0:u.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const n=Object.assign(Object.assign({},u.components[c]),{format:o,example:{header_handle:[e]}}),t=[...u.components];t[c]=n,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=Me&&Me>-1){const e=i(I);e.components[1].cards[Me].components=u.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.cards.length)>0&&(e.mapping.cards[Me]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==R||R(Object.assign({},e)),$e(!0)}else null==R||R(Object.assign({},u))},validateMimeType:Ye,mediaComponent:ye?Fe.imageComponent:Pe,fileRef:De}),[We,$e]=a(!1),[Ge,Xe]=a(A),[ze,Je]=a();function Ze(e,o,n){var t,l,a,s,d,r,p,u,c,v;const m=null!=Me&&Me>-1?{components:null===(t=Object.assign({},I).components[1].cards)||void 0===t?void 0:t[Me].components,mapping:null===(l=Object.assign({},I).mapping.cards)||void 0===l?void 0:l[Me]}:Object.assign({},I),b=i(m),g="custom"===o&&"string"==typeof e,f=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Me&&Me>-1&&ke){const o=Object.assign({},I).components.map((e=>{var o;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(o=e.cards)||void 0===o?void 0:o.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var o,t,i;if("BUTTONS"===e.type){const l=null===(o=e.buttons)||void 0===o?void 0:o.filter((e=>"URL"===e.type));let a=null!==(t=null==l?void 0:l[n])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),t=null===(s=null===(a=Object.assign({},I).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((o=>{var n;return Object.assign(Object.assign({},o),{buttons:null===(n=null==o?void 0:o.buttons)||void 0===n?void 0:n.map((o=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=i(I);return l.components=o,l.mapping.cards=t,void(null==R||R(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==h&&h>-1){const t=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==t?void 0:t.length)>0){const i="custom"===o&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=t[n];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[h]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[n]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[h]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?_e(!0):(_e(!1),null==N||N(""))}if(null!=Me&&Me>-1){const e=i(I);e.components[1].cards[Me].components=b.components,e.mapping.cards[Me]=b.mapping,null==R||R(Object.assign({},e))}else null==R||R(b)}function eo(e,o,n){var t,l,a,s,d,r,p;const u=null!=Me&&Me>-1?{components:null===(t=Object.assign({},I).components[1].cards)||void 0===t?void 0:t[Me].components,mapping:null===(l=Object.assign({},I).mapping.cards)||void 0===l?void 0:l[Me]}:Object.assign({},I);if(null!=Me&&Me>-1&&ke){const o=Object.assign({},I).components.map((o=>{var t;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(t=o.cards)||void 0===t?void 0:t.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var t,i,l;if("BUTTONS"===o.type){const a=null===(t=null==o?void 0:o.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[n])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==o?void 0:o.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},o),{buttons:d})}return o}))})))}):o})),t=i(I);return t.components=o,void(null==R||R(Object.assign({},t)))}const c=null==u?void 0:u.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const o=null===(s=null===(a=null==u?void 0:u.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(o){let t=o[n];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(p=null===(r=null===(d=u.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),a=[...u.components];a[c]=l,u.components=a}}if(null!=Me&&Me>-1){const e=i(I);e.components[1].cards[Me].components=u.components,null==R||R(Object.assign({},e))}else null==R||R(u)}s((()=>{var e,o;if(null===(e=I.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))_e(!0);else{_e(!1);const e=null===(o=null==Be?void 0:Be.discountCodeExtra)||void 0===o?void 0:o[1];null==e||e("")}}),[I]),s((()=>{var e,o,n,t;if(null!=Me&&Me>-1){const i={components:null===(o=null===(e=I.components[1])||void 0===e?void 0:e.cards)||void 0===o?void 0:o[Me].components,mapping:null===(t=null===(n=null==I?void 0:I.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Me]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=b(i);Se({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=Me&&-1===Me){const{descriptionComponents:e,urlBtns:o,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l}=b(I);Se({descriptionComponents:e,urlBtns:o,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Me]),s((()=>{var e,o,n,t;if(null!=Me&&Me>-1&&We){const i={components:null===(o=null===(e=I.components[1])||void 0===e?void 0:e.cards)||void 0===o?void 0:o[Me].components,mapping:null===(t=null===(n=null==I?void 0:I.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Me]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=b(i);Se({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),$e(!1)}}),[We]);s((()=>{Le&&Ve===c.CHATBOT&&(()=>{if(!A)return void Je("PDF name is Required");const e=h(A);null==D||D(null!=A?A:""),Je(e?"Please enter a valid PDF name":void 0)})()}),[Le]);const oo=ye?Fe.imageComponent:Pe;return Ke.openEditMedia?e(V,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e(O,{mediaComponentFormat:null!==(H=oo.format)&&void 0!==H?H:u.IMAGE,uploadMedia:Ke.uploadMedia,variableListForImage:P||[],useEditWhatsappTemplateMediaResponse:Ke,setOpenEditMedia:Ke.setOpenEditMedia,openEditMedia:Ke.openEditMedia,editIconRef:Ke.editIconRef,fileRef:De})})):o(V,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:ke?"420px":"auto"}},{children:[!!Fe.imageComponent&&!ke&&o(x,{children:[e(T,{imageName:null!==(F=null===(_=null==oo?void 0:oo.example)||void 0===_?void 0:_.header_handle)&&void 0!==F?F:[],handleImageChange:Ke.handleImageChange,mediaType:null==oo?void 0:oo.format,error:Ke.error,isLoading:Ke.loading,setOpenEditMedia:Ke.setOpenEditMedia,selectedVariable:g(null!==(Q=null===(q=null===(S=null==oo?void 0:oo.example)||void 0===S?void 0:S.header_handle)||void 0===q?void 0:q[0])&&void 0!==Q?Q:"")?null===(K=null===(Y=null==oo?void 0:oo.example)||void 0===Y?void 0:Y.header_handle)||void 0===K?void 0:K[0]:(null===($=null===(W=null==I?void 0:I.mapping)||void 0===W?void 0:W.header)||void 0===$?void 0:$[0])?null===(X=null===(G=null==I?void 0:I.mapping)||void 0===G?void 0:G.header)||void 0===X?void 0:X[0]:Ke.selectedVariable}),(null==Pe?void 0:Pe.format)==u.DOCUMENT?e(L,{children:Ve===c.CHATBOT?e(p,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:ze||void 0,onChange:e=>{var o;Je(""),null==D||D(null!==(o=null==e?void 0:e.actualValue)&&void 0!==o?o:"")},pickerType:t.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=A?A:"",variableType:"string"},variablesList:P,showAddButton:!0}):e(r,{labelText:"PDF Name",placeholder:"Enter the name",value:Ge,errorMessage:ze||void 0,onBlur:()=>{if(!Ge)return null==D||D(""),void Je("PDF name is Required");const e=f(Ge);null==D||D(Ge),Je(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Je(""),Xe(e)}})}):e(n,{})]}),(null===(z=Fe.bodyVariables)||void 0===z?void 0:z.length)>0&&e(M,{containerStyle:{paddingTop:Fe.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(J=Fe.descriptionComponents)||void 0===J?void 0:J.map(((o,n)=>e(B,{originalVariableList:null!=Me&&Me>-1?Ee.cards[Me]:Ee,type:o.type,descriptionComponent:o.component,showVariableModal:w},n))),(null===(oe=null===(ee=null!=Me&&Me>-1?null===(Z=Ee.cards[Me])||void 0===Z?void 0:Z.buttons:null==Ee?void 0:Ee.buttons)||void 0===ee?void 0:ee.filter((e=>"URL"===e.type)))||void 0===oe?void 0:oe.length)>0&&e(M,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(ie=null===(te=null!=Me&&Me>-1?null===(ne=Ee.cards[Me])||void 0===ne?void 0:ne.buttons:null==Ee?void 0:Ee.buttons)||void 0===te?void 0:te.filter((e=>Ve===c.CHATBOT||"URL"===e.type)))||void 0===ie?void 0:ie.map(((o,n)=>{const t=o.buttonVariable===m;if("URL"===o.type)return e(k,{variableListIndex:n,disableEdit:t,CTAoptions:null==U?void 0:U.CTAoptions,button:o,currentVariableList:null!=Me&&Me>-1?Object.assign({},Ee.cards[Me]):Object.assign({},Ee),updateSelectedURLTemplateBtn:Ze},`${n}_${Me}`)})),Ve===c.CHATBOT&&(null===(ae=null===(le=we[0])||void 0===le?void 0:le.component)||void 0===ae?void 0:ae.buttons)&&(null===(re=null===(de=null===(se=we[0])||void 0===se?void 0:se.component)||void 0===de?void 0:de.buttons)||void 0===re?void 0:re.length)>0&&e(j,{backTrackMessage:null===(pe=null==Be?void 0:Be.backTrackExtra)||void 0===pe?void 0:pe[0],setBackTrackMessage:null===(ue=null==Be?void 0:Be.backTrackExtra)||void 0===ue?void 0:ue[1]}),(null===(me=null===(ve=null!=Me&&Me>-1?null===(ce=Ee.cards[Me])||void 0===ce?void 0:ce.buttons:null==Ee?void 0:Ee.buttons)||void 0===ve?void 0:ve.filter((e=>"QUICK_REPLY"===e.type)))||void 0===me?void 0:me.length)>0&&(Ve!==c.CHATBOT?e(M,{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(j,{backTrackMessage:null===(be=null==Be?void 0:Be.backTrackExtra)||void 0===be?void 0:be[0],setBackTrackMessage:null===(ge=null==Be?void 0:Be.backTrackExtra)||void 0===ge?void 0:ge[1]})),null===(je=null===(he=null!=Me&&Me>-1?null===(fe=Ee.cards[Me])||void 0===fe?void 0:fe.buttons:null==Ee?void 0:Ee.buttons)||void 0===he?void 0:he.filter((e=>"QUICK_REPLY"===e.type)))||void 0===je?void 0:je.map(((o,n)=>{if("QUICK_REPLY"===o.type&&Ve!==c.CHATBOT)return e(k,{variableListIndex:n,QRBoptions:null==U?void 0:U.QRBoptions,button:o,currentVariableList:null!=Me&&Me>-1?Object.assign({},Ee.cards[Me]):Object.assign({},Ee),updateSelectedQRBTemplateBtn:eo},`${n}_${Me}`)})),Ve===c.CHATBOT&&He&&e(C,{discountCode:null===(Ce=null==Be?void 0:Be.discountCodeExtra)||void 0===Ce?void 0:Ce[0],setDiscountCode:null===(Oe=null==Be?void 0:Be.discountCodeExtra)||void 0===Oe?void 0:Oe[1]}),null===(xe=null!=Me&&Me>-1?null===(Te=Ee.cards[Me])||void 0===Te?void 0:Te.buttons:null==Ee?void 0:Ee.buttons)||void 0===xe?void 0:xe.map(((o,t)=>{var i,l,a,s,d;if("COPY_CODE"===o.type)return e(n,{children:Ie?e("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e(r,{state:"disabled",labelText:null!==(i=o.text)&&void 0!==i?i:"Copy Code",value:null!==(l=o.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):e(E,{index:t,variable:{variableName:null!==(a=o.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=o.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=o.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:o.type},t)})}))]}))},L=d.div`
|
|
1
|
+
import{jsx as o,jsxs as e,Fragment as n}from"react/jsx-runtime";import"../../curtain/CurtainHelper.js";import{PickerType as t}from"../../variable-picker-v3/model.js";import{cloneDeep as i}from"lodash";import{useRef as l,useState as a,useEffect as s}from"react";import d from"styled-components";import{Input as r}from"../../input/Input.js";import{InputWithVariables as p}from"../../input-with-vars/InputWithVariables.js";import{HEADER_TYPES as u}from"../../template-preview/models/TemplateMeta.js";import{POD as c}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import{STATIC_URL_VARIABLE_NAME as m}from"../utils/constants.js";import{getAllDataFromTemplateComponent as b}from"../utils/getDataFromTemplateComponent.js";import{isVariable as g}from"../utils/validateIsUrl.js";import{validateInputName as f,validateInputNameChatbot as h}from"../utils/validateName.js";import{BackTrackComponent as j}from"./BackTrackComponent.js";import{DiscountCodeComponent as C}from"./DiscountCodeComponent.js";import O from"./EditMediaModal.js";import T from"./EditMediaV2.js";import{EditTemplateMediaContainer as x}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as y}from"./useEditWhtasappTemplateMedia.js";import E from"./VariableConnector.js";import{Container as V}from"./VariableConnectorsPanel.js";import B from"./VariableConnectorWhatsApp.js";import M from"./VariableEditorHeader.js";import k from"./WhatsAppTemplateCardButtonV2.js";const I=d=>{let{template:I,onTemplateChange:R,whatsappSpecificPickerMeta:w,showVariableModal:U,variableListForImage:P,setDiscountCode:N,fileName:A,setFileName:D}=d;var H,_,F,S,q,Q,Y,K,W,$,G,X,z,J,Z,oo,eo,no,to,io,lo,ao,so,ro,po,uo,co,vo,mo,bo,go,fo,ho,jo,Co,Oo,To,xo,yo;const Eo=I.isCarouselType,{originalVariableList:Vo,pod:Bo,extras:Mo,selectedCarouselIndex:ko,isProductCarouselType:Io,disableCopyCode:Lo,isError:Ro}=v(),{descriptionComponents:wo,urlBtns:Uo,qrbBtns:Po,imageComponent:No,bodyVariables:Ao,headerVariables:Do}=b(I),Ho=l(null),[_o,Fo]=a(!1),[So,qo]=a(-1===ko?{descriptionComponents:wo,urlBtns:Uo,qrbBtns:Po,imageComponent:No,bodyVariables:Ao,headerVariables:Do}:{}),{uploadMediaLink:Qo,uploadMediaFiles:Yo,validateMimeType:Ko}=w,Wo=y({uploadMediaLink:Qo,uploadMediaFiles:Yo,updateTemplateImageUrl:function(o,e){var n,t,l,a,s,d,r,p;let u;u=null!=ko&&ko>-1?{components:null===(t=null===(n=I.components[1])||void 0===n?void 0:n.cards)||void 0===t?void 0:t[ko].components,mapping:null===(a=null===(l=null==I?void 0:I.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[ko]}:Object.assign({},I);const c=null===(s=null==u?void 0:u.components)||void 0===s?void 0:s.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const n=Object.assign(Object.assign({},u.components[c]),{format:e,example:{header_handle:[o]}}),t=[...u.components];t[c]=n,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=ko&&ko>-1){const o=i(I);o.components[1].cards[ko].components=u.components,(null===(d=null==o?void 0:o.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==o?void 0:o.mapping)||void 0===r?void 0:r.cards.length)>0&&(o.mapping.cards[ko]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==R||R(Object.assign({},o)),Go(!0)}else null==R||R(Object.assign({},u))},validateMimeType:Ko,mediaComponent:Eo?So.imageComponent:No,fileRef:Ho}),[$o,Go]=a(!1),[Xo,zo]=a(A),[Jo,Zo]=a();function oe(o,e,n){var t,l,a,s,d,r,p,u,c,v;console.log("val",o),console.log("mode",e),console.log("btnIndex",n);const m=null!=ko&&ko>-1?{components:null===(t=Object.assign({},I).components[1].cards)||void 0===t?void 0:t[ko].components,mapping:null===(l=Object.assign({},I).mapping.cards)||void 0===l?void 0:l[ko]}:Object.assign({},I),b=i(m),g="custom"===e&&"string"==typeof o,f=g?o:"string"!=typeof o?o.defaultValue?o.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=ko&&ko>-1&&Io){const e=Object.assign({},I).components.map((o=>{var e;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(e=o.cards)||void 0===e?void 0:e.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var e,t,i;if("BUTTONS"===o.type){const l=null===(e=o.buttons)||void 0===e?void 0:e.filter((o=>"URL"===o.type));let a=null!==(t=null==l?void 0:l[n])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=o.buttons)||void 0===i?void 0:i.map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o));return Object.assign(Object.assign({},o),{buttons:s})}return o}))})))}):o}));console.log("old mapping",I.mapping);const t=null===(s=null===(a=Object.assign({},I).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((e=>{var t;return Object.assign(Object.assign({},e),{buttons:null===(t=null==e?void 0:e.buttons)||void 0===t?void 0:t.map(((e,t)=>(console.log("button",e),console.log("ind",t),t===n?g?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:"":e)))})}));console.log("new mapping",t);const l=i(I);return l.components=e,l.mapping.cards=t,void(null==R||R(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==h&&h>-1){const t=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((o=>"URL"===o.type));if((null==t?void 0:t.length)>0){const i="custom"===e&&"string"==typeof o,l=i?o:"string"!=typeof o&&o.defaultValue?o.defaultValue:"https://d.bik.ai/";let a=t[n];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o)),d=Object.assign(Object.assign({},b.components[h]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[n]=i?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[h]=d,b.components=g}}if("string"!=typeof o){"checkout.checkoutUrl"===(null===(v=o.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Fo(!0):(Fo(!1),null==N||N(""))}if(null!=ko&&ko>-1){const o=i(I);o.components[1].cards[ko].components=b.components,o.mapping.cards[ko]=b.mapping,null==R||R(Object.assign({},o))}else null==R||R(b)}function ee(o,e,n){var t,l,a,s,d,r,p;const u=null!=ko&&ko>-1?{components:null===(t=Object.assign({},I).components[1].cards)||void 0===t?void 0:t[ko].components,mapping:null===(l=Object.assign({},I).mapping.cards)||void 0===l?void 0:l[ko]}:Object.assign({},I);if(null!=ko&&ko>-1&&Io){const e=Object.assign({},I).components.map((e=>{var t;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(t=e.cards)||void 0===t?void 0:t.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var t,i,l;if("BUTTONS"===e.type){const a=null===(t=null==e?void 0:e.buttons)||void 0===t?void 0:t.filter((o=>"QUICK_REPLY"===o.type));let s=null!==(i=null==a?void 0:a[n])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:o.flowId,flowName:o.flowName});const d=null===(l=null==e?void 0:e.buttons)||void 0===l?void 0:l.map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==s?void 0:s.text)?s:o));return Object.assign(Object.assign({},e),{buttons:d})}return e}))})))}):e})),t=i(I);return t.components=e,void(null==R||R(Object.assign({},t)))}const c=null==u?void 0:u.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==c&&c>-1){const e=null===(s=null===(a=null==u?void 0:u.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((o=>"QUICK_REPLY"===o.type));if(e){let t=e[n];t=Object.assign(Object.assign({},t),{flowId:o.flowId,flowName:o.flowName});const i=[...null!==(p=null===(r=null===(d=u.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==t?void 0:t.text)?t:o)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),a=[...u.components];a[c]=l,u.components=a}}if(null!=ko&&ko>-1){const o=i(I);o.components[1].cards[ko].components=u.components,null==R||R(Object.assign({},o))}else null==R||R(u)}s((()=>{var o,e;if(null===(o=I.mapping.buttons)||void 0===o?void 0:o.find((o=>"checkout.checkoutUrl"===o.slice(2,-2))))Fo(!0);else{Fo(!1);const o=null===(e=null==Mo?void 0:Mo.discountCodeExtra)||void 0===e?void 0:e[1];null==o||o("")}}),[I]),s((()=>{var o,e,n,t;if(null!=ko&&ko>-1){const i={components:null===(e=null===(o=I.components[1])||void 0===o?void 0:o.cards)||void 0===e?void 0:e[ko].components,mapping:null===(t=null===(n=null==I?void 0:I.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[ko]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=b(i);qo({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=ko&&-1===ko){const{descriptionComponents:o,urlBtns:e,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l}=b(I);qo({descriptionComponents:o,urlBtns:e,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[ko]),s((()=>{var o,e,n,t;if(null!=ko&&ko>-1&&$o){const i={components:null===(e=null===(o=I.components[1])||void 0===o?void 0:o.cards)||void 0===e?void 0:e[ko].components,mapping:null===(t=null===(n=null==I?void 0:I.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[ko]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=b(i);qo({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),Go(!1)}}),[$o]);s((()=>{Ro&&Bo===c.CHATBOT&&(()=>{if(!A)return void Zo("PDF name is Required");const o=h(A);null==D||D(null!=A?A:""),Zo(o?"Please enter a valid PDF name":void 0)})()}),[Ro]);const ne=Eo?So.imageComponent:No;return Wo.openEditMedia?o(V,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:o(O,{mediaComponentFormat:null!==(H=ne.format)&&void 0!==H?H:u.IMAGE,uploadMedia:Wo.uploadMedia,variableListForImage:P||[],useEditWhatsappTemplateMediaResponse:Wo,setOpenEditMedia:Wo.setOpenEditMedia,openEditMedia:Wo.openEditMedia,editIconRef:Wo.editIconRef,fileRef:Ho})})):e(V,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Io?"420px":"auto"}},{children:[!!So.imageComponent&&!Io&&e(x,{children:[o(T,{imageName:null!==(F=null===(_=null==ne?void 0:ne.example)||void 0===_?void 0:_.header_handle)&&void 0!==F?F:[],handleImageChange:Wo.handleImageChange,mediaType:null==ne?void 0:ne.format,error:Wo.error,isLoading:Wo.loading,setOpenEditMedia:Wo.setOpenEditMedia,selectedVariable:g(null!==(Q=null===(q=null===(S=null==ne?void 0:ne.example)||void 0===S?void 0:S.header_handle)||void 0===q?void 0:q[0])&&void 0!==Q?Q:"")?null===(K=null===(Y=null==ne?void 0:ne.example)||void 0===Y?void 0:Y.header_handle)||void 0===K?void 0:K[0]:(null===($=null===(W=null==I?void 0:I.mapping)||void 0===W?void 0:W.header)||void 0===$?void 0:$[0])?null===(X=null===(G=null==I?void 0:I.mapping)||void 0===G?void 0:G.header)||void 0===X?void 0:X[0]:Wo.selectedVariable}),(null==No?void 0:No.format)==u.DOCUMENT?o(L,{children:Bo===c.CHATBOT?o(p,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:Jo||void 0,onChange:o=>{var e;Zo(""),null==D||D(null!==(e=null==o?void 0:o.actualValue)&&void 0!==e?e:"")},pickerType:t.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=A?A:"",variableType:"string"},variablesList:P,showAddButton:!0}):o(r,{labelText:"PDF Name",placeholder:"Enter the name",value:Xo,errorMessage:Jo||void 0,onBlur:()=>{if(!Xo)return null==D||D(""),void Zo("PDF name is Required");const o=f(Xo);null==D||D(Xo),Zo(o?"Please enter a valid PDF name":void 0)},onChangeText:o=>{Zo(""),zo(o)}})}):o(n,{})]}),(null===(z=So.bodyVariables)||void 0===z?void 0:z.length)>0&&o(M,{containerStyle:{paddingTop:So.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(J=So.descriptionComponents)||void 0===J?void 0:J.map(((e,n)=>o(B,{originalVariableList:null!=ko&&ko>-1?Vo.cards[ko]:Vo,type:e.type,descriptionComponent:e.component,showVariableModal:U},n))),(null===(eo=null===(oo=null!=ko&&ko>-1?null===(Z=Vo.cards[ko])||void 0===Z?void 0:Z.buttons:null==Vo?void 0:Vo.buttons)||void 0===oo?void 0:oo.filter((o=>"URL"===o.type)))||void 0===eo?void 0:eo.length)>0&&o(M,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(io=null===(to=null!=ko&&ko>-1?null===(no=Vo.cards[ko])||void 0===no?void 0:no.buttons:null==Vo?void 0:Vo.buttons)||void 0===to?void 0:to.filter((o=>Bo===c.CHATBOT||"URL"===o.type)))||void 0===io?void 0:io.map(((e,n)=>{const t=e.buttonVariable===m;if("URL"===e.type)return o(k,{variableListIndex:n,disableEdit:t,CTAoptions:null==w?void 0:w.CTAoptions,button:e,currentVariableList:null!=ko&&ko>-1?Object.assign({},Vo.cards[ko]):Object.assign({},Vo),updateSelectedURLTemplateBtn:oe},`${n}_${ko}`)})),Bo===c.CHATBOT&&(null===(ao=null===(lo=Po[0])||void 0===lo?void 0:lo.component)||void 0===ao?void 0:ao.buttons)&&(null===(po=null===(ro=null===(so=Po[0])||void 0===so?void 0:so.component)||void 0===ro?void 0:ro.buttons)||void 0===po?void 0:po.length)>0&&o(j,{backTrackMessage:null===(uo=null==Mo?void 0:Mo.backTrackExtra)||void 0===uo?void 0:uo[0],setBackTrackMessage:null===(co=null==Mo?void 0:Mo.backTrackExtra)||void 0===co?void 0:co[1]}),(null===(bo=null===(mo=null!=ko&&ko>-1?null===(vo=Vo.cards[ko])||void 0===vo?void 0:vo.buttons:null==Vo?void 0:Vo.buttons)||void 0===mo?void 0:mo.filter((o=>"QUICK_REPLY"===o.type)))||void 0===bo?void 0:bo.length)>0&&(Bo!==c.CHATBOT?o(M,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):o(j,{backTrackMessage:null===(go=null==Mo?void 0:Mo.backTrackExtra)||void 0===go?void 0:go[0],setBackTrackMessage:null===(fo=null==Mo?void 0:Mo.backTrackExtra)||void 0===fo?void 0:fo[1]})),null===(Co=null===(jo=null!=ko&&ko>-1?null===(ho=Vo.cards[ko])||void 0===ho?void 0:ho.buttons:null==Vo?void 0:Vo.buttons)||void 0===jo?void 0:jo.filter((o=>"QUICK_REPLY"===o.type)))||void 0===Co?void 0:Co.map(((e,n)=>{if("QUICK_REPLY"===e.type&&Bo!==c.CHATBOT)return o(k,{variableListIndex:n,QRBoptions:null==w?void 0:w.QRBoptions,button:e,currentVariableList:null!=ko&&ko>-1?Object.assign({},Vo.cards[ko]):Object.assign({},Vo),updateSelectedQRBTemplateBtn:ee},`${n}_${ko}`)})),Bo===c.CHATBOT&&_o&&o(C,{discountCode:null===(Oo=null==Mo?void 0:Mo.discountCodeExtra)||void 0===Oo?void 0:Oo[0],setDiscountCode:null===(To=null==Mo?void 0:Mo.discountCodeExtra)||void 0===To?void 0:To[1]}),null===(yo=null!=ko&&ko>-1?null===(xo=Vo.cards[ko])||void 0===xo?void 0:xo.buttons:null==Vo?void 0:Vo.buttons)||void 0===yo?void 0:yo.map(((e,t)=>{var i,l,a,s,d;if("COPY_CODE"===e.type)return o(n,{children:Lo?o("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:o(r,{state:"disabled",labelText:null!==(i=e.text)&&void 0!==i?i:"Copy Code",value:null!==(l=e.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):o(E,{index:t,variable:{variableName:null!==(a=e.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=e.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=e.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:e.type},t)})}))]}))},L=d.div`
|
|
2
2
|
padding-top: 24px;
|
|
3
3
|
padding-left: 10px;
|
|
4
4
|
padding-right: 10px;
|