PageSourceSearch

https://app.manageplus.io/_next/static/chunks/784.b2d30799a044effe.js

js manageplus.io collected 2026-09-24 12:57:09 UTC 14,691 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[784],{784:function(e,t,n){n.r(t);var a=n(47568),r=n(14924),o=n(26042),i=n(69396),l=n(29815),c=n(97582),u=n(85893),s=n(67294),d=n(86886),v=n(71438),f=n(38663),p=n(11826),b=n(7133),g=n(4017),h=n(83485),m=n(25617),x=n(47920),y=n(18362),k=n(94129),_=n(40347);t.default=function(e){var t,n,w,E,C=e.setBlock,T=e.data,S=e.placeholder,Z=e.editorStyle,R=e.editorCore,L=e.activityData,A=e.values,D=e.renderData,U=void 0===D||D,P=(0,m.I0)(),j=(0,s.useState)(!1),B=j[0],F=j[1],V=(0,s.useState)(null),q=V[0],z=V[1],$=(0,s.useState)(""),I=$[0],M=$[1],N=(0,s.useState)({link:"",anchorText:""}),K=N[0],G=N[1],H=(0,s.useState)(null),O=(H[0],H[1]),W=(0,s.useState)(null),Y=W[0],J=W[1],Q=(0,s.useState)(!1),X=Q[0],ee=Q[1],te=(0,s.useState)(null),ne=te[0],ae=te[1],re=(0,s.useMemo)((function(){var e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return((null===A||void 0===A?void 0:A.customer_ids)||[]).some((function(t){return e.test(t)}))}),[null===A||void 0===A?void 0:A.customer_ids]),oe=(0,y.ER)({hide_fields_from:k.pn.TEMPLATE}).data,ie=(0,s.useMemo)((function(){var e;return null===oe||void 0===oe||null===(e=oe.data)||void 0===e?void 0:e.flatMap((function(e){return null===e||void 0===e?void 0:e.fields}))}),[oe]),le=(0,s.useCallback)((function(e){R.current=e}),[T]),ce=function(){var e=(0,a.Z)((function(e,t,n){var a;return(0,c.__generator)(this,(function(e){switch(e.label){case 0:return[4,R.current.save()];case 1:return a=e.sent(),C("activity_data.content.description",a),[2]}}))}));return function(t,n,a){return e.apply(this,arguments)}}(),ue=function(){z(null),M("")},se=function(){G({link:"",anchorText:""}),J(null)},de=function(){var e=(0,a.Z)((function(e,t,n){var a,r,o,i,l,u,s,d,v;return(0,c.__generator)(this,(function(e){switch(e.label){case 0:if(a=["trackable=".concat(!0)],r=a.join("&"),o=(null===t||void 0===t?void 0:t.includes("?"))?"".concat(t,"&").concat(r):"".concat(t,"?").concat(r),!R)return[3,6];e.label=1;case 1:return e.trys.push([1,5,,6]),i=n||t,l=!1,T.blocks.forEach((function(e){var t,a=e.id,r=e.data.text,c=(t=i,t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=n?new RegExp("<a\\s+[^>]*>([^<]*)".concat(c,"([^<]*)</a>"),"g"):new RegExp("".concat(c,"(?![^<]*</a>)"),"g");if(u.test(r)){var s;l=!0;var d='<a href="'.concat(o,'" target="_blank">').concat(i,"</a>"),v=r.replace(u,d);null===R||void 0===R||null===(s=R.current)||void 0===s||s.blocks.update(a,{text:v})}})),l?[4,null===(u=R.current)||void 0===u?void 0:u.save()]:[3,3];case 2:return s=e.sent(),d=s.blocks.map((function(e){return e})),C("activity_data.content.description",d),se(),P(h.C.setAppSuccess({message:"Trackable link added successfully!"})),[3,4];case 3:P(h.C.setAppError({message:"Link not found"})),e.label=4;case 4:return[3,6];case 5:return v=e.sent(),console.error(v),[3,6];case 6:return[2]}}
1))}));return function(t,n,a){return e.apply(this,arguments)}}(),ve=function(){var e=(0,a.Z)((function(e,t){var n,a,r,o,i,u,s,d,v,f,p,b,g,h,m,x,y,k,_,w,E,S,Z,L,D,U,P;return(0,c.__generator)(this,(function(c){switch(c.label){case 0:if(n='<span contenteditable="false" id=\'variable\' data-variable="'.concat(t,'" style="background:#F1F1F1;color:rgba(34, 51, 84, 0.5);border-radius:6px;">{{').concat(e,"}}</span>"),!R)return[3,11];c.label=1;case 1:c.trys.push([1,10,,11]),a=T,o=!0,i=!1,u=void 0,c.label=2;case 2:c.trys.push([2,7,8,9]),s=a.blocks[Symbol.iterator](),c.label=3;case 3:return(o=(d=s.next()).done)?[3,6]:(v=d.value,f=v.data.text,b=/(<span[^>]*>.*?<\/span>)|{{/g,(p=(p=f).replace(b,(function(e,t){return t||n})))===f?[3,5]:(console.log({updatedText:p,block:v,txt:f}),m=v.id,null===(g=R.current)||void 0===g||g.blocks.update(m,{text:p}),[4,null===(h=R.current)||void 0===h?void 0:h.save()]));case 4:x=c.sent(),r=x.blocks.map((function(e){return e})),c.label=5;case 5:return o=!0,[3,3];case 6:return[3,9];case 7:return y=c.sent(),i=!0,u=y,[3,9];case 8:try{o||null==s.return||s.return()}finally{if(i)throw u}return[7];case 9:if(r){if(console.log({updatedDescription:r}),C("activity_data.content.description",r),ue(),(null===(L=!!(null===A||void 0===A||null===(k=A.activity_data)||void 0===k||null===(_=k.content)||void 0===_||null===(w=_.variables)||void 0===w?void 0:w.length)&&(null===A||void 0===A||null===(E=A.activity_data)||void 0===E||null===(S=E.content)||void 0===S||null===(Z=S.variables)||void 0===Z?void 0:Z.filter((function(n){return n.field_name===t&&n.field_label===e}))))||void 0===L?void 0:L.length)>0)return[2];C("activity_data.content.variables",(0,l.Z)(null===A||void 0===A||null===(D=A.activity_data)||void 0===D||null===(U=D.content)||void 0===U?void 0:U.variables).concat([{field_name:t,field_label:e}]))}return[3,11];case 10:return P=c.sent(),console.error(P),[3,11];case 11:return[2]}}
1))}));return function(t,n){return e.apply(this,arguments)}}(),fe=document.getElementById(null===R||void 0===R||null===(t=R.current)||void 0===t||null===(n=t.configuration)||void 0===n?void 0:n.holder),pe="",be=function(e,t){if(console.log({event:e}),"{"===pe&&"{"===e.key){var n=window.getSelection().getRangeAt(0).getBoundingClientRect();z({top:null===n||void 0===n?void 0:n.top,left:null===n||void 0===n?void 0:n.left})}pe=e.key,"{"!==e.key&&(pe="")},ge=function(){var e=(0,a.Z)((function(e,t,n,a){return(0,c.__generator)(this,(function(n){switch(n.label){case 0:return e.preventDefault(),e.stopPropagation(),re?(ue(),ae((function(){return function(){return ve(t,a)}})),ee(!0),[2]):[4,ve(t,a)];case 1:return n.sent(),ue(),[2]}}))}));return function(t,n,a,r){return e.apply(this,arguments)}}(),he=function(){var e=(0,a.Z)((function(){return(0,c.__generator)(this,(function(e){switch(e.label){case 0:return ne?[4,ne()]:[3,2];case 1:e.sent(),ae(null),e.label=2;case 2:return ee(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}(),me=(0,i.Z)((0,o.Z)({},f._y),(E={},(0,r.Z)(E,"Add Tracking Url",{class:g.l,inlineToolbar:!0,config:{onClick:function(e,t,n,a){var r=t.getRangeAt(0).getBoundingClientRect();G({link:n,anchorText:a}),J({top:null===r||void 0===r?void 0:r.top,left:null===r||void 0===r?void 0:r.left})}}}),(0,r.Z)(E,"LinkInlineTool",{inlineToolbar:!0,class:b.b}),E));(0,s.useEffect)((function(){var e=setTimeout((function(){var e;L&&(null===L||void 0===L||null===(e=L.blocks)||void 0===e?void 0:e.some((function(e){var t,n;return""!==(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.text)||void 0===n?void 0:n.trim())})))&&F(!0)}),1e3);return function(){return clearTimeout(e)}}),[L]),(0,s.useEffect)((function(){var e;(B&&R.current,U)&&(null===(e=R.current.blocks)||void 0===e||e.render(T))}),[B]),(0,s.useEffect)((function(){return null===fe||void 0===fe||fe.addEventListener("paste",(function(e){var t,n,a,r,o=e.clipboardData.getData("Text"),i=/^https?:\/\/\S+$/.test(o),l=null===e||void 0===e||null===(t=e.target)||void 0===t||null===(n=t.firstElementChild)||void 0===n?void 0:n.href,c=null===e||void 0===e||null===(a=e.target)||void 0===a||null===(r=a.firstElementChild)||void 0===r?void 0:r.innerText;if(i){var u=new URL(l||o);(u.searchParams.has("trackable")||u.searchParams.has("amp;trackable"))&&"true"===u.searchParams.get("trackable")||setTimeout((function(){var e=window.getSelection().getRangeAt(0).getBoundingClientRect();!function(){var e=window.getSelection();e.rangeCount>0&&O(e.getRangeAt(0))}(),G({link:o,anchorText:c||""}),J({top:null===e||void 0===e?void 0:e.top,left:null===e||void 0===e?void 0:e.left})}),0)}})),function(){}}),[fe]);var xe=(null===ie||void 0===ie?void 0:ie.length)?ie:[];return(0,s.useEffect)((function(){var e=function(e){for(var t,n,a,r=function(){var e=t[1].trim(),n=xe.find((function(t){return t.label.toLowerCase()===e.toLowerCase()}));n&&c.push({field_name:n.name,field_label:n.label})},o=e.clipboardData.getData("Text"),i=/{{(.*?)}}/g,c=[];null!==(t=i.exec(o));)r();c.length>0&&C("activity_data.content.variables",(0,l.Z)(null===A||void 0===A||null===(n=A.activity_data)||void 0===n||null===(a=n.content)||void 0===a?void 0:a.variables).concat((0,l.Z)(c)))};return null===fe||void 0===fe||fe.addEventListener("paste",e),function(){null===fe||void 0===fe||fe.removeEventListener("paste",e)}}),[fe,xe]),(0,s.useEffect)((function(){var e=function(e){if("{"===e.key){document.querySelector(".codex-editor__redactor");var t=window.getSelection();if(!t.rangeCount)return;var n=t.getRangeAt(0),a=n.startOffset;if(n.startContainer.textContent.slice(0,a).endsWith("{"))return;e.preventDefault(),document.execCommand("insertText",!1,"{"),document.execCommand("insertText",!1,"}"),t.modify("move","backward","character")}};return R.current&&function(){var t=document.querySelector(".codex-editor__redactor");t&&t.addEventListener("keydown",e)}(),function(){var t=document.querySelector(".codex-editor__redactor");t&&t.removeEventListener("keydown",e)}}),[T]),(0,s.useEffect)((function(){var e;if(T&&(null===(e=T.blocks)||void 0===e?void 0:e.length)){var t=!1;T.blocks.forEach((function(e){var n;"paragraph"===e.type&&(null===(n=e.data)||void 0===n?void 0:n.text.includes("{{}"))&&(t=!0)})),t&&T.blocks.forEach(function(){var e=(0,a.Z)((function(e){var t,n,a,r,o;return(0,c.__generator)(this,(function(i){switch(i.label){case 0:return"paragraph"===e.type&&(null===(t=e.data)||void 0===t?void 0:t.text.includes("{{}"))?(r=/(\{\{)\}/g,o=e.data.text.replace(r,"$1"),console.log({newText:o}),[4,null===R||void 0===R||null===(n=R.current)||void 0===n||null===(a=n.blocks)||void 0===a?void 0:a.update(e.id,{text:o})]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}())}}),[T]),(0,s.useEffect)((function(){var e;if(T&&(null===(e=T.blocks)||void 0===e?void 0:e.length)){var t=!1,n=!0,a=!1,r=void 0;try{for(var o,i=T.blocks[Symbol.iterator]();!(n=(o=i.next()).done);n=!0){var l,c=o.value;if("paragraph"===c.type&&(null===(l=c.data)||void 0===l?void 0:l.text)&&(c.data.text.includes("https://app.manageplus.io/c/unsubscribe")||c.data.text.includes("https://app.manageplus.io/c/unsubscribe?trackable=true"))){t=!0;break}}}catch(x){a=!0,r=x}finally{try{n||null==i.return||i.return()}finally{if(a)throw r}}if(t){var u=!0,s=!1,d=void 0;try{for(var v,f=T.blocks[Symbol.iterator]();!(u=(v=f.next()).done);u=!0){var p,b=v.value;if("paragraph"===b.type&&(null===(p=b.data)||void 0===p?void 0:p.text)){var g=b.data.text;g=g.replace(/<a\s+([^>]*?)href=["'](https:\/\/app\.manageplus\.io\/c\/unsubscribe(?:\?trackable=true)?)["']([^>]*?)>(.*?)<\/a>/gi,(function(e,t,n,a,r){return"Unsubscribe"===r.trim()||/id\s*=\s*["']mp_unsubscribe["']/i.test("".concat(t," ").concat(a))?e:"<a ".concat(t,' href="').concat(n,'" target="_blank" id="mp_unsubscribe" data-unsub="Unsubscribe" style="font-size: 12px; font-weight: 500; color: #75777c;" ').concat(a,">Unsubscribe</a>")}));var h,m;if((g=g.replace(/(https:\/\/app\.manageplus\.io\/c\/unsubscribe(?:\?trackable=true)?)(?![^<]*<\/a>)/g,(function(e){return'<a href="'.concat(e,'" target="_blank" id="mp_unsubscribe" data-unsub="Unsubscribe" style="font-size: 12px; font-weight: 500; color: #75777c;">Unsubscribe</a>')})))!==b.data.text)null===R||void 0===R||null===(h=R.current)||void 0===h||null===(m=h.blocks)||void 0===m||m.update(b.id,{text:g})}}}catch(x){s=!0,d=x}finally{try{u||null==f.return||f.return()}finally{if(s)throw d}}}}}),[T]),(0,s.useEffect)((function(){var e;if(T&&(null===T||void 0===T||null===(e=T.blocks)||void 0===e?void 0:e.length)){var t=[];T.blocks.forEach(function(){var e=(0,a.Z)((function(e){var n,a,r,o,i,u,s,d,v,f,p,b;return(0,c.__generator)(this,(function(c){switch(c.label){case 0:if(n=e.type,a=e.data,"paragraph"!==n||!/{{(.*?)}}/g.test(a.text))return[3,3];for(r=function(){var e=i[1].trim();if(new RegExp("<span[^>]*?>\\s*{{".concat(e,"}}\\s*</span>"),"i").test(a.text))return"continue";var n=xe.find((function(t){return t.label.toLowerCase()===e.toLowerCase()})),r=void 0;if(n)r='<span contenteditable="false" id="variable" data-variable="'.concat(n.name,'" style="background:#F1F1F1;color:rgba(34, 51, 84, 0.5);border-radius:6px;">{{').concat(n.label,"}}</span>"),u=u.replace(i[0],r),s=!0,t.push({field_name:n.name,field_label:n.label});else if(/{{.*?}}/.test(null===a||void 0===a?void 0:a.text)){for(var o=/{{[^{}]+}}/g,l=!1;null!==(i=o.exec(null===a||void 0===a?void 0:a.text));){var c=i[0];new RegExp("<span[^>]*?>\\s*".concat(c,"\\s*</span>"),"i").test(null===a||void 0===a?void 0:a.text)||(l=!0,r='<span contenteditable="false" style="background:rgba(255, 25, 67, 0.1);color:red;border-radius:6px;" title="Variable \''.concat(c,"' is not recognized.\">").concat(c,"</span>"),u=u.replace(c,r),s=!0)}l&&console.log({newText:u})}},o=/{{(.*?)}}/g,u=a.text,s=!1;null!==(i=o.exec(a.text));)r();return s?[4,null===R||void 0===R||null===(d=R.current)||void 0===d||null===(v=d.blocks)||void 0===v?void 0:v.update(e.id,{text:u})]:[3,2];case 1:c.sent(),c.label=2;case 2:t.length>0&&(f=t.filter((function(e){var t,n,a;return!(null===A||void 0===A||null===(t=A.activity_data)||void 0===t||null===(n=t.content)||void 0===n||null===(a=n.variables)||void 0===a?void 0:a.some((function(t){return t.field_name===e.field_name})))})),f.length>0&&C("activity_data.content.variables",(0,l.Z)(null===A||void 0===A||null===(p=A.activity_data)||void 0===p||null===(b=p.content)||void 0===b?void 0:b.variables).concat((0,l.Z)(f)))),c.label=3;case 3:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}())}}),[T,xe]),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(d.ZP,{sx:(0,o.Z)({mt:2,mb:4,flexGrow:1,pb:3,minHeight:400},Z),onKeyUp:be,className:"activity-text-editor ".concat(T?(null===T||void 0===T||null===(w=T.blocks)||void 0===w?void 0:w.some((function(e){return"paragraph"===e.type&&e.data.text.trim()})))?"has-blocks":"":(null===fe||void 0===fe?void 0:fe.innerText)?"has-blocks":""),children:(0,u.jsx)(v.Z,{onReady:function(e){return C("activity_data.content.description",T)},placeholder:S,instanceRef:le,onChange:ce,i18n:f.qx,autofocus:!0,tools:me,onKeyUp:be,data:T,config:{sanitizer:{b:!0,strong:!0,i:!0,em:!0,u:!0,s:!0,br:!0,p:!0}}})}),Boolean(q)&&(0,u.jsx)(p.default,{anchorPosition:q,handleAddVariable:ge,handleClose:ue,setSearchVariable:M,searchVariable:I}),Boolean(Y)&&(0,u.jsx)(x.Z,{anchorPosition:Y,handleClose:se,handleAddLink:function(e){return de(e,null===K||void 0===K?void 0:K.link,null===K||void 0===K?void 0:K.anchorText)}}),(0,u.jsx)(_.Z,{open:X,dialogTitle:"Add Variable with Custom Email",dialogContent:"You have custom email addresses entered. Variables may not work correctly with custom emails. Do you want to continue anyway?",onConfirm:he,onDeny:function(){ae(null),ee(!1)},sx:{zIndex:1e4},confirmText:"Continue Anyway"})]})}}}]);

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.