1"use strict"; 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e201d16f-57a4-5e64-8d2d-ffd725aa5ac7")}catch(e){}}(); 3(self.webpackChunkchatbot_builder=self.webpackChunkchatbot_builder||[]).push([[6553],{56553:(e,t,o)=>{o.r(t),o.d(t,{default:()=>V});var n=o(72791),l=o(90082),i=o(33263);const d=l.ZP.div` 4 display: flex; 5 flex-direction: column; 6 gap: 16px; 7 height: 100%; 8 overflow-y: auto; 9 overflow-x: hidden; 10 max-width: 100%; 11`,a=(l.ZP.div` 12 font-size: 14px; 13 font-weight: 600; 14 color: ${i.DM.content.primary}; 15 margin-bottom: 8px; 16`,l.ZP.div` 17 border: 1px solid ${e=>e.error?i.DM.content.negative:i.DM.stroke.primary}; 18 border-radius: 8px; 19 padding: 16px; 20 background: #ffffff; 21 display: flex; 22 flex-direction: column; 23 gap: 12px; 24`,l.ZP.div` 25 display: flex; 26 border-bottom: 1px solid ${i.DM.stroke.primary}; 27 margin-bottom: 16px; 28`,l.ZP.div` 29 padding: 8px 16px; 30 cursor: pointer; 31 font-size: 14px; 32 font-weight: 600; 33 color: ${e=>e.active?i.DM.content.brand:i.DM.content.secondary}; 34 border-bottom: ${e=>e.active?`2px solid ${i.DM.content.brand}`:"none"}; 35`,l.ZP.div` 36 display: flex; 37 flex-direction: column; 38 gap: 4px; 39 position: relative; 40`),s=(l.ZP.label` 41 font-size: 12px; 42 font-weight: 500; 43 color: ${i.DM.content.secondary}; 44`,l.ZP.button` 45 padding: 8px 16px; 46 border-radius: 6px; 47 font-size: 14px; 48 font-weight: 600; 49 cursor: pointer; 50 border: 1px solid ${i.DM.content.brand}; 51 background: #ffffff; 52 color: ${i.DM.content.brand}; 53 display: flex; 54 align-items: center; 55 justify-content: center; 56 gap: 8px; 57 58 &:hover { 59 background: ${i.DM.background.brandLight}; 60 } 61 62 &:disabled { 63 opacity: 0.5; 64 cursor: not-allowed; 65 } 66`,l.ZP.div` 67 display: flex; 68 justify-content: flex-end; 69 gap: 12px; 70 margin-top: auto; 71 padding-top: 16px; 72 border-top: 1px solid ${i.DM.stroke.primary}; 73`,l.ZP.div` 74 display: flex; 75 flex-direction: column; 76`),r=l.ZP.div` 77 display: flex; 78 flex-wrap: wrap; 79 gap: 8px; 80 width: 100%; 81 justify-content: space-between; 82 83 & > * { 84 flex: 1 1 0; 85 min-width: 0; 86 max-width: calc(33% - 6px); 87 box-sizing: border-box; 88 } 89`,c=l.ZP.div` 90 display: flex; 91 flex-direction: column; 92 align-items: center; 93 justify-content: center; 94 height: 60px; 95 padding: 4px; 96 border-radius: 4px; 97 border: 1px solid 98 ${e=>e.selected?i.DM.stroke.brand:i.DM.stroke.primary}; 99 background: ${e=>e.selected?i.DM.background.brandLight:"#ffffff"}; 100 cursor: pointer; 101 gap: 2px; 102`,u=l.ZP.div` 103 display: flex; 104 align-items: center; 105 justify-content: center; 106`,p=l.ZP.div` 107 font-size: 11px; 108 font-weight: 500; 109 text-transform: capitalize; 110 color: ${e=>e.selected?i.DM.content.brand:i.DM.content.secondary}; 111`,x=l.ZP.div` 112 display: flex; 113 align-items: center; 114 height: 56px; 115 border: 1px solid ${i.DM.stroke.primary}; 116 border-radius: 4px; 117 padding: 8px 12px; 118 background: #ffffff; 119 margin-bottom: 8px; 120`,m=l.ZP.div` 121 width: 40px; 122 height: 40px; 123 border-radius: 4px; 124 border: 1px solid ${i.DM.stroke.primary}; 125 background: ${i.DM.background.base}; 126 display: flex; 127 align-items: center; 128 justify-content: center; 129 flex-shrink: 0; 130`,f=l.ZP.div` 131 flex: 1; 132 padding-left: 10px; 133 overflow: hidden; 134 135 .file-name { 136 font-size: 13px; 137 font-weight: 500; 138 color: ${i.DM.content.primary}; 139 white-space: nowrap; 140 overflow: hidden; 141 text-overflow: ellipsis; 142 } 143 144 .file-size { 145 font-size: 11px; 146 color: ${i.DM.content.secondary}; 147 margin-top: 2px; 148 } 149`,v=l.ZP.div` 150 display: flex; 151 align-items: center; 152 justify-content: center; 153 height: 40px; 154 padding-left: 12px; 155 cursor: pointer; 156 flex-shrink: 0; 157`;var h=o(61990),b=o(95048),y=o(63532),g=o(31475),N=o(74330),M=o(54805),k=o(52011),j=o(74768),E=o(96736),D=o(53321),P=o(2840),S=o(45218),T=o(34416),w=o(90645),C=o(80184);const I={[T.sf.NONE]:0,[T.sf.IMAGE]:5,[T.sf.VIDEO]:1,[T.sf.DOCUMENT]:1},O=[{blockName:T.sf.NONE,blockIcon:(0,C.jsx)(g.Z,{})},{blockName:T.sf.IMAGE,blockIcon:(0,C.jsx)(N.Z,{})},{blockName:T.sf.VIDEO,blockIcon:(0,C.jsx)(M.Z,{})},{blockName:T.sf.DOCUMENT,blockIcon:(0,C.jsx)(k.Z,{})}],Z=e=>(0,C.jsx)(D.Z,{onBackdropPress:e.onBackDropPress,children:(0,C.jsx)(P.U,{width:400,children:(0,C.jsxs)("div",{children:[(0,C.jsxs)("div",{className:"d-flex title-medium",style:{flexDirection:"row"},children:[(0,C.jsx)("div",{style:{color:i.DM.content.primary},children:"Information will be lost"}),(0,C.jsx)("div",{onClick:e.onBackDropPress,className:"d-flex ml-auto my-auto",children:(0,C.jsx)(E.aM,{width:24,height:24,color:i.DM.content.primary})})]}),(0,C.jsx)("div",{style:{marginTop:8,marginBottom:30},children:"Selecting a new type will delete all previously added attachments."}),(0,C.jsx)("div",{style:{display:"flex",flexDirection:"row"},children:(0,C.jsxs)("div",{className:"ml-auto d-flex",onClick:e.onCancel,children:[(0,C.jsx)("div",{className:"button-regular cancel",children:"Cancel"}),(0,C.jsx)("div",{className:"button-regular go",onClick:()=>e.onClear(e.type),children:"Okay, go ahead"})]})})]})})}),U=e=>{var t,o,l,d;let{value:a,onChange:h,channel:b,ismacro:y=!1}=e;const g=(e=>{let t=[...O];return e===w.oP.LIVECHAT&&(t=t.filter((e=>e.blockName!==T.sf.VIDEO))),e===w.oP.INSTAGRAM&&(t=t.filter((e=>e.blockName!==T.sf.DOCUMENT))),t}
157)(b),[M,k]=(0,n.useState)(null!==(t=a.type)&&void 0!==t?t:T.sf.NONE),[E,D]=(0,n.useState)(g.find((e=>{var t;return e.blockName===(null!==(t=a.type)&&void 0!==t?t:T.sf.NONE)}))),[P,U]=(0,n.useState)(null!==(o=a.attachments)&&void 0!==o?o:[]),[A,$]=(0,n.useState)(!1),[z,L]=(0,n.useState)(null!==(l=a.type)&&void 0!==l?l:T.sf.NONE),[B,G]=(0,n.useState)(!1),[R,H]=(0,n.useState)(""),[F,V]=(0,n.useState)(""),[_,J]=(0,n.useState)(!1),W=null!==(d=I[M])&&void 0!==d?d:1,X=M!==T.sf.NONE&&P.length<W,K=e=>{k(e);const t=g.find((t=>t.blockName===e));D(t),e!==T.sf.NONE?($(!0),U([])):($(!1),U([]))};return(0,n.useEffect)((()=>{h({type:M,attachments:P})}),[P,M]),(0,n.useEffect)((()=>{var e,t;const o=null!==(e=a.type)&&void 0!==e?e:T.sf.NONE;k(o);const n=g.find((e=>e.blockName===o));D(n);const l=null!==(t=a.attachments)&&void 0!==t?t:[];var i;(U(l),o!==T.sf.NONE)?$(l.length<(null!==(i=I[o])&&void 0!==i?i:1)):$(!1)}),[]),(0,C.jsxs)(s,{children:[B&&(0,C.jsx)(Z,{onBackDropPress:()=>G(!1),onCancel:()=>G(!1),onClear:K,type:z}),(0,C.jsx)(r,{children:g.map((e=>(0,C.jsxs)(c,{selected:e.blockName===M,onClick:()=>{e.blockName!==M&&(P.length>0?(L(e.blockName),G(!0)):K(e.blockName))},children:[(0,C.jsx)(u,{children:n.cloneElement(e.blockIcon,{color:e.blockName===M?"#731DCF":"#616161",height:20})}),(0,C.jsx)(p,{selected:e.blockName===M,children:e.blockName})]},e.blockName)))}),(0,C.jsx)("hr",{style:{border:"none",borderTop:"2px solid #D9D9D9",margin:"16px 0"}}),P.map(((e,t)=>{var o,l,i;return(0,C.jsxs)(x,{children:[(0,C.jsx)(m,{children:e.type===T.sf.IMAGE&&e.mediaUrl?(0,C.jsx)("img",{src:e.mediaUrl,alt:e.mediaName,style:{width:38,height:38,objectFit:"contain",borderRadius:4}}):n.cloneElement(null!==(o=null===(l=O.find((t=>t.blockName===e.type)))||void 0===l?void 0:l.blockIcon)&&void 0!==o?o:null!==(i=null===E||void 0===E?void 0:E.blockIcon)&&void 0!==i?i:(0,C.jsx)(N.Z,{}),{width:24,height:24,color:"#000000"})}),(0,C.jsxs)(f,{children:[(0,C.jsx)("div",{className:"file-name",children:e.mediaName}),(0,C.jsx)("div",{className:"file-size",children:e.mediaSize})]}),(0,C.jsx)(v,{onClick:e=>{e.stopPropagation(),(e=>{U((t=>t.filter(((t,o)=>o!==e)))),$(!0)})(t)},children:(0,C.jsx)(j.Z,{width:24,height:24,color:"#616161"})})]},`${e.mediaUrl}-${t}`)})),A&&X&&(0,C.jsxs)("div",{style:{marginTop:P.length>0?8:16,marginBottom:8},children:[(0,C.jsx)(S.G,{type:M,onFileUpload:e=>{e.mediaName&&e.mediaUrl&&e.mediaSize&&U((t=>{var o;return[...t,{type:M,mediaUrl:e.mediaUrl,mediaName:e.mediaName,mediaSize:e.mediaSize}].slice(0,null!==(o=I[M])&&void 0!==o?o:1)}))},channel:b,borderStyle:"dashed",title:"Upload "+M,color:i.DM.content.secondary,ismacro:y,multiple:!0,maxFiles:W-P.length}),(0,C.jsxs)("div",{style:{fontSize:11,color:"#9E9E9E",textAlign:"center",marginTop:4},children:[M===T.sf.IMAGE&&(b===w.oP.INSTAGRAM?"JPEG/PNG \u2022 Max 8 MB \u2022 ":"JPEG/PNG \u2022 Max 5 MB \u2022 "),M===T.sf.VIDEO&&(b===w.oP.INSTAGRAM?"MP4 \u2022 Max 25 MB \u2022 ":"MP4 \u2022 Max 16 MB \u2022 "),M===T.sf.DOCUMENT&&"PDF \u2022 Max 100 MB \u2022 ","Upto ",W," file",W>1?"s":""," (",P.length,"/",W,")"]})]}),_&&(0,C.jsx)(S.C,{header:R,subText:F,onBackDropPress:()=>{J(!1),V("")},onRetry:()=>{J(!1),V("")}})]})};var A=o(68006),$=o(48839),z=o(97355),L=o(18111),B=o.n(L),G=o(85159),R=o(86784),H=o(73643),F=o(74249);const V=e=>{var t,o,l;const{saveTo:s,setSaveTo:r,nodeData:c,config:u}=e,[p,x]=(0,n.useState)(),[m,f]=(0,n.useState)(),[v,g]=(0,n.useState)(),[N,M]=(0,n.useState)({type:T.sf.NONE,attachments:[]}),[k,j]=(0,n.useState)(!1),[E,D]=(0,n.useState)(null),P=(0,h.C)((e=>e.nodeClickState)),S=(0,b.I0)(),I=u.automationChannel===w.oP.EMAIL,O=(()=>{const e=u.automationChannel||w.oP.WHATSAPP;return T.uY.includes(e)?1e3:1024})(),Z=(0,n.useContext)(z.zQ),L=(0,n.useRef)(null),V=(0,n.useRef)(null);(0,n.useEffect)((()=>{var e,t;if(!Z||!k)return;const o=(null!==(e=null===p||void 0===p?void 0:p.bodyText)&&void 0!==e?e:"")!==(null!==(t=L.current)&&void 0!==t?t:""),n=!B()(N,V.current||{type:T.sf.NONE,attachments:[]});Z.setHasUnsavedChanges(o||n)}),[p,N,Z,k]);const _=async()=>{var t,o,n,l,i,d,a,s,x,f,v;if(e.setLoading(!0),D(null),(()=>{var e;const t=(null!==(e=null===m||void 0===m?void 0:m.bodyText)&&void 0!==e?e:"").replace(/^\s+|\s+$/g,"");return(0,R.I4)(t).length>O}
157)())return D(`Maximum ${O.toLocaleString()} characters are allowed`),e.setLoading(!1),void r("");const h=null!==(t=null===m||void 0===m||null===(o=m.bodyText)||void 0===o?void 0:o.trim())&&void 0!==t?t:"",b=null!==(n=null===p||void 0===p||null===(l=p.bodyText)||void 0===l?void 0:l.trim())&&void 0!==n?n:"",g=h.length>0||b.length>0,M=N.attachments.length>0;if(!g&&!M)return D("Please add a message or attach a file"),e.setLoading(!1),void r("");const k=u.automationChannel||w.oP.WHATSAPP,j=N.type,E=N.attachments[0],C=N.attachments.map((e=>{var t,o,n,l;return{fileName:null!==(t=e.mediaName)&&void 0!==t?t:"",type:null!==(o=T.AJ[e.type])&&void 0!==o?o:T.j8.IMAGE,path:null!==(n=e.mediaUrl)&&void 0!==n?n:"",size:null!==(l=e.mediaSize)&&void 0!==l?l:""}})),I=null!==(i=null===m||void 0===m||null===(d=m.bodyText)||void 0===d?void 0:d.trim())&&void 0!==i?i:"",Z={type:H.Uq.MESSAGE,title:(0,w.sL)(k)+" response",subType:(null===c||void 0===c?void 0:c.subtype)||F.X.RESPONSE_BLOCK,description:I,media:null!==(a=(0,A.getMediaType)(j))&&void 0!==a?a:"",mediaUrl:(null===E||void 0===E?void 0:E.mediaUrl)||"",attachments:N.attachments},U=null!==(s=T.AJ[j])&&void 0!==s?s:T.j8.TEXT,$={channel:k,type:H._A.MESSAGE,subType:(null===u||void 0===u?void 0:u.subType)||F.X.RESPONSE_BLOCK,message:{body:null!==(x=null===p||void 0===p?void 0:p.bodyText)&&void 0!==x?x:"",header:{type:U,mediaUrls:C,body:null!==(f=null===p||void 0===p?void 0:p.bodyText)&&void 0!==f?f:""}},next:(null===c||void 0===c||null===(v=c.conf)||void 0===v?void 0:v.next)||""};S(y._.setEditNode({nodeId:P.nodeId,nodeType:Z.type,nodeSubType:Z.subType,data:Z,backendConfig:$})),D(null),e.setLoading(!1),r("close")};return(0,n.useEffect)((()=>{s===F.X.RESPONSE_BLOCK&&_().then().catch()}),[s]),(0,n.useEffect)((()=>{var e,t,o,n;const l=null===c||void 0===c||null===(e=c.conf)||void 0===e?void 0:e.message,i=null===c||void 0===c||null===(t=c.conf)||void 0===t||null===(o=t.message)||void 0===o?void 0:o.body;if(L.current=null!==i&&void 0!==i?i:"",i&&(x({bodyText:i}),g({bodyText:[]})),null!==l&&void 0!==l&&null!==(n=l.header)&&void 0!==n&&n.mediaUrls&&l.header.mediaUrls.length>0){const e=T.fF[l.header.type];if(e){const t={type:e,attachments:l.header.mediaUrls.map((e=>{var t,o;return{type:null!==(t=T.fF[e.type])&&void 0!==t?t:T.sf.DOCUMENT,mediaUrl:e.path,mediaName:e.fileName,mediaSize:null!==(o=e.size)&&void 0!==o?o:""}}))};return V.current=t,M(t),void j(!0)}}V.current={type:T.sf.NONE,attachments:[]},j(!0)}),[null===c||void 0===c?void 0:c.nodeId]),(0,C.jsxs)(d,{children:[(0,C.jsxs)(a,{children:[(0,C.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,C.jsx)($.HO,{children:"Message body"}),(0,C.jsxs)("div",{style:{fontSize:12,color:i.DM.content.primary},children:[null!==(t=null===m||void 0===m||null===(o=m.bodyText)||void 0===o?void 0:o.length)&&void 0!==t?t:0,"/",O]})]}),(0,C.jsx)(G.ZP,{uniqueId:"bodyText",textMessage:"",htmlMessage:null===p||void 0===p?void 0:p.bodyText,setTextMessage:f,setHtmlMessage:x,setSelectedVariableList:g,selectedVariableList:null!==(l=null===v||void 0===v?void 0:v.bodyText)&&void 0!==l?l:[],placeHolder:"Enter your text here",customWordCount:O,customHeight:"144px",hideWordLimit:!0,readonly:!1,errorText:null!==E&&void 0!==E?E:void 0,enableLink:I,enableBulletList:!0})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:8},children:(0,C.jsx)($.HO,{children:"Attachments"})}),k&&(0,C.jsx)(U,{value:N,onChange:M,channel:u.automationChannel,ismacro:!0})]})]})}}}]); 158//# sourceMappingURL=6553.1d2c1a6b.chunk.js.map 159//# debugId=e201d16f-57a4-5e64-8d2d-ffd725aa5ac7
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.