useblocks 1.3.11-dev.1 → 1.3.11-dev.2
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/README.md +2 -2
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.c5a8ebf9.html → iframe-eblock.fd4347fc.html} +2 -2
- package/iframe/{iframe.c5a8ebf9.html → iframe.fd4347fc.html} +2 -2
- package/iframe/js/{elMarkupHelper.DjmNMeRr.js → elMarkupHelper.DLCHSWwj.js} +3 -3
- package/iframe/js/{iframe-eblock.body.c5a8ebf9.js → iframe-eblock.body.fd4347fc.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.c5a8ebf9.js → iframe.body.fd4347fc.js} +1 -1
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{9689c25e.js → 12963ed5.js} +1 -1
- package/static/core/{ebf996e0.js → 13a6a2d3.js} +1 -1
- package/static/core/{6a4c653c.js → 153a5a27.js} +1 -1
- package/static/core/{d8b648e9.js → 17c8ebc4.js} +1 -1
- package/static/core/{e4a8dec2.js → 1fcc0627.js} +1 -1
- package/static/core/{f3eb0f57.js → 2865f716.js} +1 -1
- package/static/core/{411823ad.js → 2d58a94b.js} +1 -1
- package/static/core/{d3ae23fa.js → 31d22827.js} +1 -1
- package/static/core/{2aa29959.js → 31da6da0.js} +1 -1
- package/static/core/{c96e8d1f.js → 37bf0f7a.js} +1 -1
- package/static/core/{14819724.js → 3a5bea82.js} +1 -1
- package/static/core/{dbf8654f.js → 3ca0af3d.js} +1 -1
- package/static/core/{880187e3.js → 4181d334.js} +1 -1
- package/static/core/{a5cf594a.js → 4f5add14.js} +1 -1
- package/static/core/{bfa8fbcd.js → 579d4466.js} +1 -1
- package/static/core/{1c0ad4e2.js → 5fd45688.js} +1 -1
- package/static/core/{2f369eab.js → 66b856ca.js} +1 -1
- package/static/core/{ed99afa7.js → 68e393e4.js} +6 -6
- package/static/core/{bf6cd7cc.js → 6ec347ff.js} +1 -1
- package/static/core/{2b3023ec.js → 70749936.js} +1 -1
- package/static/core/{a636d084.js → 752288e6.js} +1 -1
- package/static/core/{62abaa0c.js → 78500214.js} +1 -1
- package/static/core/{35a1d850.js → 7934ed7e.js} +1 -1
- package/static/core/{3f1b20ee.js → 846cd365.js} +1 -1
- package/static/core/{1c94aa95.js → 8d0796c1.js} +1 -1
- package/static/core/{6b521a88.js → 925b75fb.js} +2 -2
- package/static/core/{1155fc70.js → 939d4a62.js} +1 -1
- package/static/core/{4430410a.js → 9438888a.js} +1 -1
- package/static/core/{3b0fc21e.js → 983a408d.js} +1 -1
- package/static/core/{8b0eaa20.js → 9916b298.js} +2 -2
- package/static/core/{203f8a09.js → 9d57053a.js} +1 -1
- package/static/core/{490ecf9b.js → ab741434.js} +1 -1
- package/static/core/{e955189e.js → ae251a52.js} +1 -1
- package/static/core/{f10baea7.js → b0edd3a1.js} +1 -1
- package/static/core/{1d3606c0.js → bbf48eb9.js} +1 -1
- package/static/core/{e6bcae1a.js → c33a9c36.js} +1 -1
- package/static/core/{8c5662da.js → c5128299.js} +1 -1
- package/static/core/{b8e2e735.js → cc4657d9.js} +1 -1
- package/static/core/{2a8276a7.js → d48488c4.js} +1 -1
- package/static/core/{6c84f3aa.js → dda98b73.js} +1 -1
- package/static/core/{b90b0517.js → e37da9a7.js} +1 -1
- package/static/core/{81908794.js → e9281a4c.js} +1 -1
- package/static/core/{cff76b3c.js → f126c14c.js} +1 -1
- package/static/core/{e5cae5a9.js → f8f52e6d.js} +1 -1
- package/static/umd-runtime/{runtime.CtmO-sKr.js → runtime.CQCs2kHH.js} +1 -1
- package/{useblocks-core.c5a8ebf9.js → useblocks-core.fd4347fc.js} +35 -35
- package/useblocks-esm.js +6 -6
- package/{useblocks-po.c5a8ebf9.js → useblocks-po.fd4347fc.js} +1 -1
- package/useblocks.d.ts +2 -2
- package/useblocks.js +6 -6
- package/vendor/useblocks-ui-kit/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
__useblocks__.define("static/core/
|
|
1
|
+
__useblocks__.define("static/core/b0edd3a1.js",["require","exports","module","static/core/2ff39ddf.js","static/core/83a2a45e.js","static/core/8d0796c1.js"],function(u,f,j){const R=u("./2ff39ddf.js"),r=u("./83a2a45e.js"),g=u("./8d0796c1.js");var v={link_check:"link checks",image_check:"image checks",spam_check:"spam checks"},S=t=>r.err("limitExceeded",`The plan limit for ${v[t]} is used up.`),p={ignoreEnabledFlag:!0};function w(t,e){switch(e.reason){case"noStore":return r.err("unavailable","Checks need the editor interface.");case"noDocument":return r.noDocument();case"notSaved":return r.err("unavailable","Save the email first: checks run on a saved email.");case"typeLimit":case"planLimit":case"usageLimit":return S(t);default:{const s=(e.reason==="failed"?e.error:void 0)?.data?.message;return r.err("internal",typeof s=="string"&&s?s:`The ${v[t]} service failed.`)}}}var _=(t,e)=>(e==="spam_check"?r.standaloneRefusal(t,"Spam checks"):void 0)??r.freePlanRefusal(t,"Checks are not available on the current plan.");async function m(t,e){const s=_(t,e);if(s)return s;const a=await g.getOptimiseChecks(t).run(e,p);return a.ok===!1?w(e,a):a}async function C(t,e){const s=_(t,e);if(s)return s;const a=await g.getOptimiseChecks(t).preflight(e,p);return a.ok===!1?w(e,a):a}function y(t){const e=new Map,s=(a,l)=>({precheck:async()=>{const i=C(t,a);e.set(a,i);const n=await i;return n.ok===!1?n:void 0},consent:async()=>{const i=r.agentTranslator(t),{__:n}=i,{title:h,what:k}=l(i),o=e.get(a)??C(t,a);e.delete(a);const c=await o.catch(()=>{}),b=c?.ok?c.remaining:void 0;return{title:h,details:[{label:n("What will be checked"),value:k},...b===void 0?[]:[{label:n("Plan limit"),value:r.sprintf(n("Uses 1 check; %d left"),b)}]]}}});return{"check.links":s("link_check",({__:a})=>({title:a("Check the links in the email"),what:a("Every link of the email is opened over the network.")})),"check.images":s("image_check",({__:a})=>({title:a("Check the images in the email"),what:a("Every image of the email is loaded over the network.")})),"check.spam":s("spam_check",({__:a})=>({title:a("Check the email for spam"),what:a("The email as it is now is scored by a spam filter.")}))}}var d=t=>t===void 0?{}:{limitRemaining:t};function E(t){return{"check.links":async()=>{const e=await m(t,"link_check");if(e.ok===!1)return e;const{links:s,summary:a}=e.value;return{links:s.map(({linkId:l,url:i,text:n,status:h,statusCode:k,resolvedUrl:o,message:c})=>({id:l,url:i,text:n,status:h,statusCode:k,...o?{resolvedUrl:o}:{},...c?{message:c}:{}})),summary:a,...d(e.limitRemaining)}},"check.images":async()=>{const e=await m(t,"image_check");if(e.ok===!1)return e;const{images:s,summary:a,totalKb:l}=e.value;return{images:s.map(({imageId:i,url:n,status:h,statusCode:k,message:o,image:c})=>({id:i,url:n,status:h,statusCode:k,sizeKb:Math.round((c?.bytes??0)/1024),...c?.dimensions?{width:c.dimensions.width,height:c.dimensions.height}:{},...o?{message:o}:{}})),summary:a,totalKb:l,...d(e.limitRemaining)}},"check.spam":async()=>{const e=await m(t,"spam_check");if(e.ok===!1)return e;const{spamScore:s,baseSpamScore:a,report:l}=e.value;return{score:s??null,baseScore:a??null,report:Array.isArray(l)?l.map(({score:i,description:n})=>({score:i,description:n})):[],...d(e.limitRemaining)}}}}f.agentCheckGates=y,f.agentCheckHandlers=E});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__useblocks__.define("static/core/
|
|
1
|
+
__useblocks__.define("static/core/bbf48eb9.js",["require","exports","module","static/core/2ff39ddf.js","static/core/83a2a45e.js"],function(g,$,L){const T=g("./2ff39ddf.js"),u=g("./83a2a45e.js");function w(t,e){const d={bytes:0,hidden:0,byKind:{}};for(const n of e)if(!(n.finishedAt>t.end||n.finishedAt<t.start)){if(n.transferred===null){d.hidden+=1;continue}d.bytes+=n.transferred,d.byKind[n.kind]=(d.byKind[n.kind]??0)+n.transferred}return d}var y="core:module:";function v(t){const e=[...t].sort((n,r)=>n.start-r.start),d=[];return e.forEach(n=>{const r=d[d.length-1];if(r&&n.start<=r.end){r.end=Math.max(r.end,n.end);return}d.push({start:n.start,end:n.end})}),d}function A(t,e){const d=Math.max(0,t.end-t.start),n=v(e.map(r=>({start:Math.max(t.start,r.startedAt),end:Math.min(t.end,r.finishedAt)})).filter(r=>r.end>r.start)).reduce((r,o)=>r+(o.end-o.start),0);return{networkMs:n,quietMs:d-n}}function P(t){const e=new Map;t.forEach(n=>{if(!n.phase.startsWith(y))return;const r=n.phase.slice(12),o=r.lastIndexOf(":");if(o<=0)return;const s=r.slice(0,o),a=r.slice(o+1),i=e.get(s)??{};a==="ask"?(i.ask=n.at,n.parent&&(i.parent=n.parent)):a==="loaded"?i.loaded=n.at:a==="deps"?i.deps=n.at:a==="ready"&&(i.ready=n.at),e.set(s,i)});const d=[];return e.forEach((n,r)=>{if(n.ask===void 0||n.ready===void 0)return;const o=n.ask,s=n.ready,a=n.deps,i=n.loaded;d.push({id:r,parent:n.parent,askedAt:o,loadedAt:i,depsAt:a,readyAt:s,networkMs:i===void 0?0:i-o,waitingMs:a===void 0?0:a-(i??o),executionMs:a===void 0?0:s-a})}),d}function S(t){const e=new Map;t.forEach(o=>{if(o.parent===void 0)return;const s=e.get(o.parent)??[];s.push(o),e.set(o.parent,s)});let d=t.filter(o=>o.parent===void 0).reduce((o,s)=>o===void 0||s.readyAt>o.readyAt?s:o,void 0);const n=[],r=new Set;for(;d&&!r.has(d.id);)r.add(d.id),n.push(d),d=(e.get(d.id)??[]).reduce((o,s)=>o===void 0||s.readyAt>o.readyAt?s:o,void 0);return n}function E(t,e){const d=u.detectMount(t),n=u.requiredPhases(d),r=new Map;t.forEach(l=>{n.includes(l.phase)&&!r.has(l.phase)&&r.set(l.phase,l.at)});const o=[...r.entries()].sort((l,h)=>l[1]-h[1]),s=q(d),a=o.findIndex(([l])=>l===s),i=a===-1?o:o.slice(0,a+1);return i.slice(1).map(([l,h],m)=>{const[x,p]=i[m],f=A({start:p,end:h},e);return{from:x,to:l,startedAt:p,endedAt:h,durationMs:h-p,networkMs:f.networkMs,quietMs:f.quietMs}})}function q(t){return t==="headless"?u.PHASES.showEnd:u.PHASES.canvasSettled}function M(t,e){const d=t.find(n=>n.phase===e);return d?d.at:null}function j(t,e){return t===null?e:e===null?t:Math.max(t,e)}function z(t,e){const d=u.missingRequiredPhases(t),n=d.length===0,r=t.reduce((p,f)=>p===null||f.at<p?f.at:p,null),o=u.detectMount(t),s=M(t,u.PHASES.canvasPainted),a=o==="headless"?M(t,u.PHASES.showEnd):j(M(t,u.PHASES.canvasSettled),M(t,u.PHASES.editorVisible)),i=P(t),l=i.reduce((p,f)=>p+f.executionMs,0),h=r!==null&&n&&(o==="headless"||s!==null),m=o==="headless"?a:s,x=h&&m!==null?A({start:r,end:m},e):{networkMs:0,quietMs:0};return{startedAt:r,paintedAt:s,settledAt:a,totalMs:h&&s!==null?s-r:null,settledMs:h&&a!==null?a-r:null,settleGapMs:h&&a!==null&&s!==null?a-s:null,segments:h?E(t,e):[],complete:n,missingPhases:d,networkMs:x.networkMs,quietMs:x.quietMs,moduleExecutionMs:l,criticalPath:S(i),transferBeforeFrame:h&&r!==null&&m!==null?w({start:r,end:m},e):{bytes:0,hidden:0,byKind:{}}}}function c(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function H(){return"dev"}function k(t,e){return{mode:H(),summary:z(t,e),marks:[...t],resources:[...e]}}function b(t){return t===null?"—":`${Math.round(t)} мс`}function _(t){return t==="dev"?"dev-сервер — AMD-ядро не работает, слой модулей пуст":t==="build"?"собранная версия":"режим неизвестен"}function R(t){const{summary:e}=t,d=e.complete?'<span class="ok">прогон полный</span>':'<span class="bad">прогон неполный — в сравнение не идёт</span>',n=e.missingPhases.length===0?"":`<p class="bad">Не хватает фаз: ${e.missingPhases.map(c).join(", ")}</p>`;return`
|
|
2
2
|
<header>
|
|
3
3
|
<h1>Куда ушло время до показа письма</h1>
|
|
4
4
|
<p class="mode">${c(_(t.mode))}</p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
__useblocks__.define("static/core/
|
|
1
|
+
__useblocks__.define("static/core/c33a9c36.js",["require","exports","module","static/core/83a2a45e.js"],function(d,i,g){const r=d("./83a2a45e.js");function l(t){return t?Date.parse(t):NaN}function f(t){return r.isBlocksV2Enabled()&&t.id!=null&&r.isBlockAutosaveInFlight(String(t.id))}function s(t,e){if(!r.isBlocksV2Enabled()||e.id==null)return e.html;const n=String(e.id);if(r.isBlockAutosaveInFlight(n))return;const u=r.blocksApi.endpoints.getBlock.select(n)(t());if(u.data?.html===void 0)return e.html;const c=l(e.modified);return Number.isNaN(c)||l(u.data.modified)>c?u.data.html:e.html}async function a(t,e){return await new Promise(n=>r.whenBlockAutosaveSettledWithin(String(e.id),r.getSaveTimeoutMs(),n))?s(t,e):void 0}var o=new Set;function m(t,e){const n=String(e.id);return o.has(n)?null:(o.add(n),a(t,e).finally(()=>o.delete(n)))}Object.defineProperty(i,"blockHtmlForInsert",{enumerable:!0,get:function(){return a}}),Object.defineProperty(i,"blockHtmlForInsertOnce",{enumerable:!0,get:function(){return m}}),Object.defineProperty(i,"freshBlockHtml",{enumerable:!0,get:function(){return s}}),Object.defineProperty(i,"waitsForWrite",{enumerable:!0,get:function(){return f}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
__useblocks__.define("static/core/
|
|
1
|
+
__useblocks__.define("static/core/c5128299.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/83a2a45e.js","static/core/e37da9a7.js","static/core/e9281a4c.js","static/core/579d4466.js"],function(c,h,j){const O=c("./2ff39ddf.js"),D=c("./cf7d1dd7.js"),e=c("./83a2a45e.js"),p=c("./e37da9a7.js"),m=c("./e9281a4c.js"),y=c("./579d4466.js");var w={8:"error",4:"warning",2:"info",1:"hint"},S=()=>e.err("unavailable","A block is open, not an email; read its code with document.getHtml.");function f(t){return e.isBlockSessionKey(e.peekEmailDocuments(t)?.sessionKey())}function d(t){try{return t.getInstance(D.PLUGIN_COLLECTION_ID)?.use("EmailSettingsApi")}catch{return}}async function g(t,i,o){const{compileEmail:n}=await e.loadEmailCompiler();return n(await i.getEmailSnapshot(),{amp:!1,text:o},e.getTemplateDirectivesPolicy(t).keepWrappedOnOutput)}function v(t){return f(t)?S():e.featureRefusal(t,"export_html","the compiled email")}function k(t){const{id:i,date:o,modified:n,authorName:r,author:s,subject:a,title:u,isAutosave:l}=t;return{id:i===void 0?void 0:String(i),date:o??n,author:r??s,subject:a,title:u,isAutosave:l}}async function R(t,i){const o=e.peekEmailDocuments(t),n=o?.current()?.get().serverId;if(!o||n==null)return e.err("unavailable","The document has no saved revisions yet.");const r=e.featureRefusal(t,"version_history","revision history");if(r)return r;if(e.isBlockSessionKey(o.sessionKey())){if(!e.canReadBlockHistory(t))return{revisions:[],hasMore:!1};const{revisions:u,hasMore:l}=await e.resolveBlockHistoryPort(t).readRevisions(String(n),i,{wpId:e.openDocumentWpId(t,n)});return{revisions:u.map(k),hasMore:l}}if(!await e.isEmailHistoryAvailable(t))return e.planRefusal("Revision history is not available on this plan.");const{revisions:s,hasMore:a}=await e.resolveEmailHistoryPort(t).readRevisions(String(n),i,{wpId:e.openDocumentWpId(t,n)});return{revisions:s.map(k),hasMore:a}}function E(t,i){return e.openDocument(t)?e.isReadOnly(t)?e.readOnlyError():e.featureRefusal(t,"code_editor","the email code")??(e.markupHasContent(i)?void 0:e.err("invalidArgs",'"html" must not be empty: with no text, pictures or other visible elements it would erase the whole email.')):e.noDocument()}function b(t,{caller:i}){return i==="agent"&&e.getAgentService(t).answerOpen?e.err("undoConflict","The edits of this answer are not closed yet, so undo and redo are not possible now. Undo becomes available after the answer ends: tell the user about it."):void 0}function _(t){return{"document.replaceHtml":{precheck:i=>E(t,i.html),consent:i=>{const o=e.agentTranslator(t);return{title:o.__("Replace the whole email with new markup"),...e.detailsOf(e.markupSize(o,i.html))}}}}}function T(t,i){return{"document.getHtml":async({output:o})=>{const n=e.openDocument(t);return n?o!=="email"?n.getContent():v(t)??(await g(t,i,!1)).compiled.html:e.noDocument()},"document.getText":async()=>e.openDocument(t)?v(t)??(await g(t,i,!0)).compiled.text:e.noDocument(),"document.setHeaders":async o=>{const n=e.openDocument(t);if(!n)return e.noDocument();if(f(t))return e.err("unavailable","A block has no subject or preheader; open an email to set them.");if(e.isReadOnly(t))return e.readOnlyError();if(e.getAppConfig(t).lockPreheaderAndTitle===!0)return e.err("disabled","The subject and the preheader are locked in this editor.");const r=(o.subject!==void 0?e.featureRefusal(t,"theme_editing","the subject"):void 0)??(o.preheader!==void 0?e.featureRefusal(t,"preheader_editing","the preheader"):void 0);if(r)return r;const s=Object.fromEntries(Object.entries(o).filter(([,a])=>a!==void 0));return e.writeEmailAttributes(n,s),await e.settleHeaders(t),e.ok()},"document.getSettings":async()=>{const o=await d(t)?.getEmailLayoutSettings();return o?m.editableLayoutSettings(o):e.noDocument()},"document.setSettings":async({settings:o})=>{const n=d(t);if(!n||!e.openDocument(t))return e.noDocument();if(f(t))return e.err("unavailable","A block has no email layout settings; open an email to set them.");if(e.isReadOnly(t))return e.readOnlyError();const r=m.layoutSettingsRefusal(o);return r||(e.isCanvasOpen(t)?(await n.setEmailLayoutSettings(o),e.getMessageService(t).send({operation:e.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:o}),await e.askCanvasElement(t,{op:"settle"}).then(s=>s.ok,()=>!1)?e.ok():e.ok({canvasPending:!0})):e.err("unavailable","The canvas is not open."))},"document.getContentStyles":async()=>await d(t)?.getEmailContentStyles()??e.noDocument(),"document.setContentStyles":async({styles:o})=>{const n=d(t);if(!n||!e.openDocument(t))return e.noDocument();if(e.isReadOnly(t))return e.readOnlyError();const r=m.contentStylesRefusal(t,o,await n.getEmailContentStyles());return r||(await n.setEmailContentStyles(o),e.openDocument(t)?.markUnsaved(),e.ok())},"document.replaceHtml":({html:o})=>{const n=e.peekEmailDocuments(t),r=n?.current();if(!n||!r)return e.noDocument();const s=E(t,o);return s||(e.replaceDocumentContent(r,n.history(),o,{undoable:!0}),e.ok())},"history.undo":(o,n)=>{const r=e.undoPlanRefusal(t)??b(t,n);if(r)return r;const s=e.peekEmailDocuments(t)?.history();return s?.canUndo()?e.isReadOnly(t)?e.readOnlyError():s.tryUndo()?e.ok():e.err("nothingToUndo","The last step could not be undone: the text changed under it."):e.err("nothingToUndo","There is nothing to undo.")},"history.redo":(o,n)=>{const r=e.undoPlanRefusal(t)??b(t,n);if(r)return r;const s=e.peekEmailDocuments(t)?.history();return s?.canRedo()?e.isReadOnly(t)?e.readOnlyError():s.tryRedo()?e.ok():e.err("nothingToRedo","The step could not be redone: the text changed under it."):e.err("nothingToRedo","There is nothing to redo.")},"history.listRevisions":({page:o})=>R(t,o??1),"check.code":async()=>{const o=e.openDocument(t);return o?(await e.validateEmailCode(o.getContent())).map(({severity:n,message:r,startLineNumber:s,startColumn:a,endLineNumber:u,endColumn:l})=>({severity:w[n]??"error",message:r,startLineNumber:s,startColumn:a,endLineNumber:u,endColumn:l})):e.noDocument()},"check.codeSize":()=>{const o=e.openDocument(t);if(!o)return e.noDocument();const n=e.getCodeSize(o.getContent());return{sizeBytes:n,sizeKb:Math.round(n/1024),limitKb:90,exceeded:e.isCodeSizeExceeded(n,90)}},"block.list":async o=>{if(o.source==="gallery"){const r=await y.galleryBlockList(t);return e.isResult(r)?r:p.blockListPage(r.map(({id:s,title:a,description:u,type:l})=>({id:s,title:a,description:u,type:l})),o)}const n=await y.readProjectBlocks(t);return n?p.blockListPage(n.map(({id:r,title:s,description:a,type:u,global_block:l})=>({id:r,title:s,description:a,type:u,global:l===!0})),o):e.blocksNotLoaded()}}}h.agentDocumentGates=_,h.agentDocumentHandlers=T});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(){try{if(typeof document<"u"){var o=".blocks-app .block-page-header__dropdown-menu{top:10px}.blocks-app .anticon.anticon-edit.block-page-header__icon-edit{color:#8c8c8c;margin-left:6px;font-size:16px}.blocks-app .ant-typography-edit:hover .anticon.anticon-edit.block-page-header__icon-edit{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-page-header.block-page-header{margin-bottom:20px;padding-left:0;padding-right:0}@media (width<=1450px){.blocks-app .ant-page-header.block-page-header{padding-left:12px;padding-right:12px}}.blocks-app .block-page-header .ant-page-header-heading-left{flex-grow:1;overflow:visible}.blocks-app .block-page-header .ant-page-header-back{align-self:flex-start;margin-left:12px;margin-right:0;padding-top:12px}.blocks-app .block-page-header .ant-page-header-heading-title{white-space:pre-wrap;flex-grow:1;font-weight:500;overflow:visible}.blocks-app .block-page-header .ant-typography{margin-bottom:0;padding:4px 12px}.blocks-app .block-page-header .ant-typography-edit-content{margin-top:0;padding:0;left:auto}.blocks-app .block-page-header .ant-input{font-size:inherit;font-weight:inherit}.blocks-app .block-page-header .ant-page-header-heading-extra>*{margin-left:8px}.blocks-app .block-page-header .ant-btn.block-page-header__btn_extra,.blocks-app header .ant-btn.block-page-header__btn_extra{width:32px;padding:0}.blocks-app .block-page__row{margin-bottom:60px}@media (width>=1700px){.blocks-app .block-page__row{margin-right:-60px}}",e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),n=o;if(!e.sheets[n]){var a=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(a=new CSSStyleSheet,a.replaceSync(o))}catch{a=null}if(a){if(!e.host||!e.host.isConnected||!e.host.sheet){var t=document.createElement("style");t.setAttribute("data-useblocks","true"),document.head.appendChild(t),e.host=t}for(var c=e.host.sheet,l=0;l<a.cssRules.length;l++)try{c.insertRule(a.cssRules[l].cssText,c.cssRules.length)}catch{}(e.texts||(e.texts=[])).push(o),(e.listeners||[]).forEach(function(p){try{p(o)}catch{}})}else{var t=document.createElement("style");t.setAttribute("data-useblocks","true"),t.appendChild(document.createTextNode(o)),document.head.appendChild(t)}e.sheets[n]=!0,e.order.push(n)}}}catch(p){console.error("vite-plugin-css-injected-by-js",p)}})();
|
|
2
|
-
__useblocks__.define("static/core/b8e2e735.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/82dfd28b.js","static/core/26aa9bfc.js","static/core/a5cf594a.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(h,re,he){const te=h("./2ff39ddf.js"),X=h("./cf7d1dd7.js"),e=h("./82dfd28b.js"),z=h("./26aa9bfc.js"),le=h("./a5cf594a.js");let n=h("react");n=te.__toESM(n);let o=h("react/jsx-runtime"),r=h("__delivery__/libs"),Z=h("classnames");Z=te.__toESM(Z);var oe={fontSize:"16px"},ae={color:"#ff4d4f"},se=({block:t,autoSaveBlockResult:d})=>{const{__:s,_x:c}=e.useI18n();let E=e.useDispatch();const l=e.useEmailAttributesWriter(),g=e.useAppNavigate(),a=e.useCurrentUser(),{modal:p}=r.ui_kit$App.useApp(),f=e.useNotification(),{confirm:b}=p,{token:$}=(0,r.ui_kit$useToken)(),W=e.useAppConfig(),M=e.useContainer(),y=e.usePluginMenuItems("menu:document"),S=e.usePluginItems("toolbar"),j=(0,n.useMemo)(()=>e.filterPluginItems(S,"collaboration"),[S]),K=(0,n.useMemo)(()=>e.filterPluginItems(S,e.TOOLBAR_GROUPS_BEFORE_SAVE),[S]),O=e.usePluginMenuItems("menu:save"),w=j.length>0,Q=K.length>0,k=O.length>0,R=()=>{e.leaveBlock(M)},H=e.useSelector(e.selectCodeModeDirection),J=t.hasOwnProperty("type")?e.BLOCK:e.EMAIL,U=e.useSelector(e.selectElementSettings$1),I=e.useSelector(e.selectElementSettings),P=J==="email"?U:I,A=e.useSelector(e.selectIsCodeMode),q=()=>(P?.type===e.ELEMENT_TYPES.TEXT||P?.type===e.ELEMENT_TYPES.LINK||P.type===e.ELEMENT_TYPES.BUTTON)&&A&&H!=="bottom",v=e.useProjectData(),F=e.isAuthoredByMe(t.author,a,v?.members),{owner:x,admin:T}=e.useMyRoles(),G=e.useStore(),V=(u,ee)=>G.dispatch(e.blocksApi.endpoints.deleteBlock.initiate(u.id)).then(ce=>{if(ce.error){f.fromError("BLOCK_REMOVING_ERROR",e.getBlockDesc(u),ce.error);return}R(),ee(`/projects/${v?.id??u.project}/blocks`),f.success({id:"BLOCK_REMOVING_SUCCESS",title:s("The block “")+u.title+c("” was successfully removed.","block"),data:e.getBlockDesc(u)})}),i=(u,ee)=>{b({mask:{closable:!0},centered:!0,title:c("Are you sure you want to delete the “","block")+u.title+s("” block?"),icon:(0,o.jsx)(e.EmIcons,{icon:"DeleteOutlined",component:r.icons$DeleteOutlined,size:22,style:{color:r.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:s("Yes"),cancelText:s("No"),onOk:()=>V(u,ee)})},m=()=>{R(),g(`/projects/${v.id}/blocks`)},_=u=>{l({title:u})},[B,C]=e.useAddBlockMutation(),Y=e.useContentReader(),D=()=>{t.isNew?t.isNew?f.warning({id:"COPY_NOT_SAVED",payload:t,title:s("To create a copy, you need to save the block.")}):B({title:e.generateCopyTitle(t.title),blocktags:t.blocktags,project:v.id,subject:t.subject,description:t.description,html:e.stripEmBlockMark(Y()),type:t.type?t.type:"Other"}).then(u=>{if(u.error||E(e.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),u.error){f.error({id:"BLOCK_CLONING_ERROR",data:e.getBlockDesc(t),innerException:u.error,title:u.error.data.code,description:u.error.data.message});return}g(`/projects/${v.id}/blocks/${u.data.id}`),f.success({id:"BLOCK_CLONING_SUCCESS",data:e.getBlockDesc(t),title:s("The copy of block “")+t.title+c("” was successfully created.","block")})}):e.getEmitter(M,X.events.ON_BLOCK_CLONE_ID).fire(t)},L=()=>{t.isNew?(R(),g(`/projects/${v.id}/blocks`),f.success({id:"BLOCK_REMOVING_SUCCESS",title:s("The draft of the block has been deleted."),data:e.getBlockDesc(t)})):i(t,g)};let N=[];N.push({label:s("Clone"),icon:(0,o.jsx)(e.EmIcons,{icon:"CopyOutlined",component:r.icons$CopyOutlined,size:16}),key:"Clone",className:"em-analytics__block-clone",disabled:C.isLoading,onClick:D}),N.push(...e.menuGroup(y,"document"),...e.menuGroup(y,"plugins"));const ie=x||T||F;ie&&N.push({label:(0,o.jsx)(e.SwitchLockBtn,{element:t},"Lock"),icon:t.lock?(0,o.jsx)(e.EmIcons,{icon:"UnlockOutlined",component:r.icons$UnlockOutlined,style:oe}):(0,o.jsx)(e.EmIcons,{icon:"LockOutlined",component:r.icons$LockOutlined,style:oe}),disabled:!!t.isNew}),N.push(...e.menuGroup(y,"access")),ie&&N.push({label:s("Remove"),icon:(0,o.jsx)(e.EmIcons,{icon:"DeleteOutlined",component:r.icons$DeleteOutlined,size:16}),key:"Remove",className:"em-analytics__block-remove",onClick:L,style:ae}),N.push(...e.menuGroup(y,"danger")),e.useSetTitle(t.title===null?s("New block title"):t.title);const Ee=(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(r.ui_kit$Space,{size:10,children:[W.headerArrowBackVisible&&(0,o.jsx)(r.ui_kit$Tooltip,{title:s("Back"),placement:"left",children:(0,o.jsx)(r.ui_kit$Button,{type:"text",icon:(0,o.jsx)(e.EmIcons,{icon:"ArrowLeftOutlined",component:r.icons$ArrowLeftOutlined}),onClick:m,shape:"circle"})}),(0,o.jsx)(r.ui_kit$Paragraph,{className:"ant-page-header-heading-title",editable:{triggerType:["text","icon"],icon:(0,o.jsx)(e.EmIcons,{icon:"EditOutlined",component:r.icons$EditOutlined,className:"email-page-header__icon-edit"}),onChange:_},children:t.title===null?s("New block title"):t.title})]})}),_e=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(z.EmailPreviewMenu,{emailElement:t}),t.lock?(0,o.jsx)(e.EmIcons,{icon:"LockOutlined",component:r.icons$LockOutlined,className:(0,Z.default)("lock-icon",{"lock-icon__disabled":!(x||T||F)}),style:{color:$.colorPrimary,fontSize:"16px"}},"Lock"):null,w&&(0,o.jsx)(e.PluginButtons,{items:j}),(0,o.jsx)(r.ui_kit$Dropdown,{arrow:"true",menu:{items:N},children:(0,o.jsx)(r.ui_kit$Button,{className:"block-page-header__btn block-page-header__btn_extra",onClick:()=>{},children:(0,o.jsx)(e.EmIcons,{icon:"EllipsisOutlined",component:r.icons$EllipsisOutlined})})},"Actions"),Q&&(0,o.jsx)(e.PluginButtons,{items:K}),(0,o.jsx)(le.SaveBlockBtn,{className:"em-analytics__block-save",block:t,isEditableRights:x||T||F,autoSaveBlockResult:d,ownsDocument:!0},"Save"),k&&(0,o.jsx)(e.PluginSaveMore,{items:O})]}),ye=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(z.EmailPreviewMenu,{emailElement:t}),w&&(0,o.jsx)(e.PluginButtons,{items:j}),y.length>0&&(0,o.jsx)(e.PluginMenuButton,{location:"menu:document",items:y,className:"block-page-header__btn block-page-header__btn_extra"}),Q&&(0,o.jsx)(e.PluginButtons,{items:K}),k&&(0,o.jsx)(e.PluginSaveMore,{items:O})]}),ve=W.commandButtonsEnabled?_e:ye;return(0,o.jsx)(e.Header,{leftBlock:Ee,rightBlock:ve,className:"header_blocks",isHeaderCodeMenuOpen:q()})};se.propTypes={};function ne(t=document){const d=t.getElementById("email_iframe_slot");return{slot:d,area:d?.closest("[data-scroll-area]")??null}}function de(t){if(t)return t.renderGuid??(t.id!=null?String(t.id):void 0)}function ue(t,d={}){const s=e.useStore(),c=d.key??de(t),E=d.recovery===!0,l=(0,n.useMemo)(()=>{if(c===void 0)return;const p=e.getEmailDocuments(X.getContainer(s));return E?t?.id!=null?p.open(String(t.id),{email:t}):p.openDraft(t):p.openBlock(c,t)},[c,s,E]),g=t?.modified,a=t?.lock;return(0,n.useEffect)(()=>{e.writeSourceReport(l,e.fromServerFacts({modified:g,lock:a}))},[l,g,a]),l}function me(){const t=e.useContainer(),d=e.useNotification(),{__:s}=e.useI18n(),c=(0,n.useRef)(void 0),E=(0,n.useRef)(0);(0,n.useEffect)(()=>{const l=e.getOpenEmailDocuments(t??void 0);if(l)return l.subscribe(()=>{const{error:g,failures:a,failedIntent:p}=l.saveState(),f=a>E.current;if(E.current=a,a===0||!e.isLockedBlockRefusal(g)){c.current=void 0;return}const b=l.current()?.get(),$=b?.savedVersion??null;!f||p!=="snapshot"||c.current?.saved===$||(c.current={saved:$},d.error({id:"BLOCK_ACCESS_TO_LOCKED_ERROR",title:s("No access to edit the block."),data:e.getBlockDesc({id:b?.serverId??void 0,title:b?.attributes.title})}))})},[t,d,s])}var ge={status:0,data:{code:"timeout",message:"request timed out"}};function pe(t,d){const s=d?void 0:t,c=(0,n.useMemo)(()=>({key:s,inFlight:s!==void 0&&e.isBlockAutosaveInFlight(s)}),[s]),[E,l]=(0,n.useState)(void 0),g=E?.opening===c?E.settled:void 0,a=c.inFlight&&g===void 0;(0,n.useEffect)(()=>a&&c.key!==void 0?e.whenBlockAutosaveSettledWithin(c.key,e.getSaveTimeoutMs(),f=>l({opening:c,settled:f})):void 0,[a,c]);const p=e.useGetBlockQuery(t,{skip:d||a});return a?{...p,data:void 0,isSuccess:!1,isLoading:!0}:g===!1?{...p,data:void 0,isSuccess:!1,isLoading:!1,isError:!0,error:ge}:p}var{Content:Se}=r.ui_kit$Layout,fe=({session:t})=>{const{__:d}=e.useI18n(),s=e.useSendPostMessage(),{blockId:c,projectId:E}=e.useRouteParams();me();const l=e.useDispatch();e.useAppNavigate();const g=e.useCookieManager();e.useSelector(e.selectMonacoFocusing),e.useSelector(e.selectIsPanelHistoryCollapsed),e.useAppConfig();const a=g.get(e.APP_COOKIES.em_new_block),{isSuccess:p,data:f}=e.useGetBlockQuery(+a,{skip:!!t||!a}),[b,$]=(0,n.useState)(!1),{isLoading:W,isSuccess:M,isError:y,error:S,data:j}=pe(c,!!t||!c);(0,n.useEffect)(()=>{y&&S&&e.reportEntityLoadError("block",c,S)},[y,S,c]);const K=a?p:M,O=M&&j?.id?j:p&&f,w=t?t.block:O,Q=ue(t?void 0:O||void 0,{key:!t&&O?.id!=null?e.blockSessionKey(O.id):void 0}),k=t?t.document:Q,R=e.useDocumentAttributes(k),H=(0,n.useMemo)(()=>k?e.resolveOpenEmail({attributes:R,readContent:()=>k.getContent(),docId:k.get().docId,hasSession:!0,serverId:k.get().serverId,show:void 0}):w,[R,k,w]),J=e.useStore(),U=e.getEmailDocuments(X.getContainer(J)).history();e.usePublishDocumentSession(k,U);const I=e.useUserUndo({document:k,history:U}),P=(0,n.useCallback)(()=>{I.undo()},[I]),A=(0,n.useCallback)(()=>{I.redo()},[I]),q=(0,n.useCallback)(()=>I.clear(),[I]);e.useEditorUiReset(k?.get().docId,q);const v=(0,n.useCallback)(i=>{(window.navigator.appVersion.indexOf("Mac")&&i.metaKey||i.ctrlKey)&&(i.code==="KeyZ"?(i.preventDefault(),i.shiftKey?A():P()):i.code==="KeyY"&&!i.shiftKey&&(i.preventDefault(),A()))},[P,A]);(0,n.useEffect)(()=>(document.body.classList.add("editor"),()=>{l(e.resetPanes()),l(e.closeModal$1()),l(e.resetElementHistorySlice()),l(e.setActiveSettingsTab(e.BUILD))}),[l]);const F=i=>{const m=i.data.operation,_=i.data.action,B=document.getElementById("iframe-scroll-top"),C=document.getElementById("iframe-scroll-bottom");if(m===e.EVENT_TYPES.APPLICATION_ACTION&&(_==="undo"?P():_==="redo"&&A()),m===e.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_SHOW){const{slot:Y}=ne(),D=document.body.getBoundingClientRect().height,L=Y?.getClientRects()[0];if(!L||!B||!C)return;L.top<0&&(B.style.display="block"),L.top+L.height>D&&(C.style.display="block")}m===e.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_HIDE&&B&&C&&(B.style.display="none",C.style.display="none")};e.useListenPostMessage(F);const x=(0,n.useCallback)(i=>{i.target?.closest?.(".file-manager, .ant-modal.file-manager")||(i.preventDefault(),i.target&&s({operation:e.EVENT_TYPES.SANDBOX_DRAG_CANCEL}))},[s]),T=(0,n.useCallback)(()=>{},[]),G=(0,n.useCallback)(i=>{if(i.preventDefault(),i.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const m=document.getElementById("iframe-scroll-top"),_=document.getElementById("iframe-scroll-bottom"),{slot:B,area:C}=ne();if(!B||!m||!_)return;const{height:Y,top:D}=B.getBoundingClientRect(),L=document.body.getBoundingClientRect().height;D>1?m.style.display==="block"&&(m.style.display="none"):m.style.display==="none"&&(m.style.display="block"),Y-L+D<1?_.style.display==="block"&&(_.style.display="none"):_.style.display==="none"&&(_.style.display="block"),i.target===m&&C?.scrollBy(0,-20),i.target===_&&C?.scrollBy(0,20)},[]),V=(0,n.useCallback)(()=>{const i=document.getElementById("iframe-scroll-top"),m=document.getElementById("iframe-scroll-bottom");i&&m&&(i.style.display="none",m.style.display="none")},[]);return(0,n.useEffect)(()=>(window.addEventListener("dragstart",T),window.addEventListener("drop",x),window.addEventListener("dragend",V),window.addEventListener("dragover",G),window.addEventListener("keydown",v),()=>{window.removeEventListener("dragstart",T),window.removeEventListener("drop",x),window.removeEventListener("dragover",G),window.removeEventListener("dragend",V),window.removeEventListener("keydown",v)}),[v,T,x,V,G]),(0,o.jsx)(e.DocumentSessionProvider,{document:k,history:U,children:(0,o.jsxs)(r.ui_kit$Layout,{className:"block-page",children:[w&&(0,o.jsx)(se,{block:H}),W&&(0,o.jsx)(r.ui_kit$PageLoader,{}),y&&S&&!1,t?w&&(0,o.jsx)(z.EmailPane_default,{emailElement:H,kind:"block",isSuccess:!0}):(!c&&(a?b&&f:!0)||M&&j)&&(0,o.jsx)(z.EmailPane_default,{emailElement:H,kind:"block",isSuccess:K})]})})},ke=()=>{const{document:t,email:d}=e.useOpenEmail(),s=(0,n.useMemo)(()=>({document:t,block:d}),[t,d]);return(0,o.jsx)(fe,{session:s})};re.default=ke});
|
|
2
|
+
__useblocks__.define("static/core/cc4657d9.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/83a2a45e.js","static/core/ed6c594c.js","static/core/4f5add14.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(h,re,he){const te=h("./2ff39ddf.js"),X=h("./cf7d1dd7.js"),e=h("./83a2a45e.js"),z=h("./ed6c594c.js"),le=h("./4f5add14.js");let n=h("react");n=te.__toESM(n);let o=h("react/jsx-runtime"),r=h("__delivery__/libs"),Z=h("classnames");Z=te.__toESM(Z);var oe={fontSize:"16px"},ae={color:"#ff4d4f"},se=({block:t,autoSaveBlockResult:d})=>{const{__:s,_x:c}=e.useI18n();let E=e.useDispatch();const l=e.useEmailAttributesWriter(),g=e.useAppNavigate(),a=e.useCurrentUser(),{modal:p}=r.ui_kit$App.useApp(),f=e.useNotification(),{confirm:b}=p,{token:$}=(0,r.ui_kit$useToken)(),W=e.useAppConfig(),M=e.useContainer(),y=e.usePluginMenuItems("menu:document"),S=e.usePluginItems("toolbar"),j=(0,n.useMemo)(()=>e.filterPluginItems(S,"collaboration"),[S]),K=(0,n.useMemo)(()=>e.filterPluginItems(S,e.TOOLBAR_GROUPS_BEFORE_SAVE),[S]),O=e.usePluginMenuItems("menu:save"),w=j.length>0,Q=K.length>0,k=O.length>0,R=()=>{e.leaveBlock(M)},H=e.useSelector(e.selectCodeModeDirection),J=t.hasOwnProperty("type")?e.BLOCK:e.EMAIL,U=e.useSelector(e.selectElementSettings$1),I=e.useSelector(e.selectElementSettings),P=J==="email"?U:I,A=e.useSelector(e.selectIsCodeMode),q=()=>(P?.type===e.ELEMENT_TYPES.TEXT||P?.type===e.ELEMENT_TYPES.LINK||P.type===e.ELEMENT_TYPES.BUTTON)&&A&&H!=="bottom",v=e.useProjectData(),F=e.isAuthoredByMe(t.author,a,v?.members),{owner:x,admin:T}=e.useMyRoles(),G=e.useStore(),V=(u,ee)=>G.dispatch(e.blocksApi.endpoints.deleteBlock.initiate(u.id)).then(ce=>{if(ce.error){f.fromError("BLOCK_REMOVING_ERROR",e.getBlockDesc(u),ce.error);return}R(),ee(`/projects/${v?.id??u.project}/blocks`),f.success({id:"BLOCK_REMOVING_SUCCESS",title:s("The block “")+u.title+c("” was successfully removed.","block"),data:e.getBlockDesc(u)})}),i=(u,ee)=>{b({mask:{closable:!0},centered:!0,title:c("Are you sure you want to delete the “","block")+u.title+s("” block?"),icon:(0,o.jsx)(e.EmIcons,{icon:"DeleteOutlined",component:r.icons$DeleteOutlined,size:22,style:{color:r.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:s("Yes"),cancelText:s("No"),onOk:()=>V(u,ee)})},m=()=>{R(),g(`/projects/${v.id}/blocks`)},_=u=>{l({title:u})},[B,C]=e.useAddBlockMutation(),Y=e.useContentReader(),D=()=>{t.isNew?t.isNew?f.warning({id:"COPY_NOT_SAVED",payload:t,title:s("To create a copy, you need to save the block.")}):B({title:e.generateCopyTitle(t.title),blocktags:t.blocktags,project:v.id,subject:t.subject,description:t.description,html:e.stripEmBlockMark(Y()),type:t.type?t.type:"Other"}).then(u=>{if(u.error||E(e.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),u.error){f.error({id:"BLOCK_CLONING_ERROR",data:e.getBlockDesc(t),innerException:u.error,title:u.error.data.code,description:u.error.data.message});return}g(`/projects/${v.id}/blocks/${u.data.id}`),f.success({id:"BLOCK_CLONING_SUCCESS",data:e.getBlockDesc(t),title:s("The copy of block “")+t.title+c("” was successfully created.","block")})}):e.getEmitter(M,X.events.ON_BLOCK_CLONE_ID).fire(t)},L=()=>{t.isNew?(R(),g(`/projects/${v.id}/blocks`),f.success({id:"BLOCK_REMOVING_SUCCESS",title:s("The draft of the block has been deleted."),data:e.getBlockDesc(t)})):i(t,g)};let N=[];N.push({label:s("Clone"),icon:(0,o.jsx)(e.EmIcons,{icon:"CopyOutlined",component:r.icons$CopyOutlined,size:16}),key:"Clone",className:"em-analytics__block-clone",disabled:C.isLoading,onClick:D}),N.push(...e.menuGroup(y,"document"),...e.menuGroup(y,"plugins"));const ie=x||T||F;ie&&N.push({label:(0,o.jsx)(e.SwitchLockBtn,{element:t},"Lock"),icon:t.lock?(0,o.jsx)(e.EmIcons,{icon:"UnlockOutlined",component:r.icons$UnlockOutlined,style:oe}):(0,o.jsx)(e.EmIcons,{icon:"LockOutlined",component:r.icons$LockOutlined,style:oe}),disabled:!!t.isNew}),N.push(...e.menuGroup(y,"access")),ie&&N.push({label:s("Remove"),icon:(0,o.jsx)(e.EmIcons,{icon:"DeleteOutlined",component:r.icons$DeleteOutlined,size:16}),key:"Remove",className:"em-analytics__block-remove",onClick:L,style:ae}),N.push(...e.menuGroup(y,"danger")),e.useSetTitle(t.title===null?s("New block title"):t.title);const Ee=(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(r.ui_kit$Space,{size:10,children:[W.headerArrowBackVisible&&(0,o.jsx)(r.ui_kit$Tooltip,{title:s("Back"),placement:"left",children:(0,o.jsx)(r.ui_kit$Button,{type:"text",icon:(0,o.jsx)(e.EmIcons,{icon:"ArrowLeftOutlined",component:r.icons$ArrowLeftOutlined}),onClick:m,shape:"circle"})}),(0,o.jsx)(r.ui_kit$Paragraph,{className:"ant-page-header-heading-title",editable:{triggerType:["text","icon"],icon:(0,o.jsx)(e.EmIcons,{icon:"EditOutlined",component:r.icons$EditOutlined,className:"email-page-header__icon-edit"}),onChange:_},children:t.title===null?s("New block title"):t.title})]})}),_e=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(z.EmailPreviewMenu,{emailElement:t}),t.lock?(0,o.jsx)(e.EmIcons,{icon:"LockOutlined",component:r.icons$LockOutlined,className:(0,Z.default)("lock-icon",{"lock-icon__disabled":!(x||T||F)}),style:{color:$.colorPrimary,fontSize:"16px"}},"Lock"):null,w&&(0,o.jsx)(e.PluginButtons,{items:j}),(0,o.jsx)(r.ui_kit$Dropdown,{arrow:"true",menu:{items:N},children:(0,o.jsx)(r.ui_kit$Button,{className:"block-page-header__btn block-page-header__btn_extra",onClick:()=>{},children:(0,o.jsx)(e.EmIcons,{icon:"EllipsisOutlined",component:r.icons$EllipsisOutlined})})},"Actions"),Q&&(0,o.jsx)(e.PluginButtons,{items:K}),(0,o.jsx)(le.SaveBlockBtn,{className:"em-analytics__block-save",block:t,isEditableRights:x||T||F,autoSaveBlockResult:d,ownsDocument:!0},"Save"),k&&(0,o.jsx)(e.PluginSaveMore,{items:O})]}),ye=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(z.EmailPreviewMenu,{emailElement:t}),w&&(0,o.jsx)(e.PluginButtons,{items:j}),y.length>0&&(0,o.jsx)(e.PluginMenuButton,{location:"menu:document",items:y,className:"block-page-header__btn block-page-header__btn_extra"}),Q&&(0,o.jsx)(e.PluginButtons,{items:K}),k&&(0,o.jsx)(e.PluginSaveMore,{items:O})]}),ve=W.commandButtonsEnabled?_e:ye;return(0,o.jsx)(e.Header,{leftBlock:Ee,rightBlock:ve,className:"header_blocks",isHeaderCodeMenuOpen:q()})};se.propTypes={};function ne(t=document){const d=t.getElementById("email_iframe_slot");return{slot:d,area:d?.closest("[data-scroll-area]")??null}}function de(t){if(t)return t.renderGuid??(t.id!=null?String(t.id):void 0)}function ue(t,d={}){const s=e.useStore(),c=d.key??de(t),E=d.recovery===!0,l=(0,n.useMemo)(()=>{if(c===void 0)return;const p=e.getEmailDocuments(X.getContainer(s));return E?t?.id!=null?p.open(String(t.id),{email:t}):p.openDraft(t):p.openBlock(c,t)},[c,s,E]),g=t?.modified,a=t?.lock;return(0,n.useEffect)(()=>{e.writeSourceReport(l,e.fromServerFacts({modified:g,lock:a}))},[l,g,a]),l}function me(){const t=e.useContainer(),d=e.useNotification(),{__:s}=e.useI18n(),c=(0,n.useRef)(void 0),E=(0,n.useRef)(0);(0,n.useEffect)(()=>{const l=e.getOpenEmailDocuments(t??void 0);if(l)return l.subscribe(()=>{const{error:g,failures:a,failedIntent:p}=l.saveState(),f=a>E.current;if(E.current=a,a===0||!e.isLockedBlockRefusal(g)){c.current=void 0;return}const b=l.current()?.get(),$=b?.savedVersion??null;!f||p!=="snapshot"||c.current?.saved===$||(c.current={saved:$},d.error({id:"BLOCK_ACCESS_TO_LOCKED_ERROR",title:s("No access to edit the block."),data:e.getBlockDesc({id:b?.serverId??void 0,title:b?.attributes.title})}))})},[t,d,s])}var ge={status:0,data:{code:"timeout",message:"request timed out"}};function pe(t,d){const s=d?void 0:t,c=(0,n.useMemo)(()=>({key:s,inFlight:s!==void 0&&e.isBlockAutosaveInFlight(s)}),[s]),[E,l]=(0,n.useState)(void 0),g=E?.opening===c?E.settled:void 0,a=c.inFlight&&g===void 0;(0,n.useEffect)(()=>a&&c.key!==void 0?e.whenBlockAutosaveSettledWithin(c.key,e.getSaveTimeoutMs(),f=>l({opening:c,settled:f})):void 0,[a,c]);const p=e.useGetBlockQuery(t,{skip:d||a});return a?{...p,data:void 0,isSuccess:!1,isLoading:!0}:g===!1?{...p,data:void 0,isSuccess:!1,isLoading:!1,isError:!0,error:ge}:p}var{Content:Se}=r.ui_kit$Layout,fe=({session:t})=>{const{__:d}=e.useI18n(),s=e.useSendPostMessage(),{blockId:c,projectId:E}=e.useRouteParams();me();const l=e.useDispatch();e.useAppNavigate();const g=e.useCookieManager();e.useSelector(e.selectMonacoFocusing),e.useSelector(e.selectIsPanelHistoryCollapsed),e.useAppConfig();const a=g.get(e.APP_COOKIES.em_new_block),{isSuccess:p,data:f}=e.useGetBlockQuery(+a,{skip:!!t||!a}),[b,$]=(0,n.useState)(!1),{isLoading:W,isSuccess:M,isError:y,error:S,data:j}=pe(c,!!t||!c);(0,n.useEffect)(()=>{y&&S&&e.reportEntityLoadError("block",c,S)},[y,S,c]);const K=a?p:M,O=M&&j?.id?j:p&&f,w=t?t.block:O,Q=ue(t?void 0:O||void 0,{key:!t&&O?.id!=null?e.blockSessionKey(O.id):void 0}),k=t?t.document:Q,R=e.useDocumentAttributes(k),H=(0,n.useMemo)(()=>k?e.resolveOpenEmail({attributes:R,readContent:()=>k.getContent(),docId:k.get().docId,hasSession:!0,serverId:k.get().serverId,show:void 0}):w,[R,k,w]),J=e.useStore(),U=e.getEmailDocuments(X.getContainer(J)).history();e.usePublishDocumentSession(k,U);const I=e.useUserUndo({document:k,history:U}),P=(0,n.useCallback)(()=>{I.undo()},[I]),A=(0,n.useCallback)(()=>{I.redo()},[I]),q=(0,n.useCallback)(()=>I.clear(),[I]);e.useEditorUiReset(k?.get().docId,q);const v=(0,n.useCallback)(i=>{(window.navigator.appVersion.indexOf("Mac")&&i.metaKey||i.ctrlKey)&&(i.code==="KeyZ"?(i.preventDefault(),i.shiftKey?A():P()):i.code==="KeyY"&&!i.shiftKey&&(i.preventDefault(),A()))},[P,A]);(0,n.useEffect)(()=>(document.body.classList.add("editor"),()=>{l(e.resetPanes()),l(e.closeModal$1()),l(e.resetElementHistorySlice()),l(e.setActiveSettingsTab(e.BUILD))}),[l]);const F=i=>{const m=i.data.operation,_=i.data.action,B=document.getElementById("iframe-scroll-top"),C=document.getElementById("iframe-scroll-bottom");if(m===e.EVENT_TYPES.APPLICATION_ACTION&&(_==="undo"?P():_==="redo"&&A()),m===e.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_SHOW){const{slot:Y}=ne(),D=document.body.getBoundingClientRect().height,L=Y?.getClientRects()[0];if(!L||!B||!C)return;L.top<0&&(B.style.display="block"),L.top+L.height>D&&(C.style.display="block")}m===e.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_HIDE&&B&&C&&(B.style.display="none",C.style.display="none")};e.useListenPostMessage(F);const x=(0,n.useCallback)(i=>{i.target?.closest?.(".file-manager, .ant-modal.file-manager")||(i.preventDefault(),i.target&&s({operation:e.EVENT_TYPES.SANDBOX_DRAG_CANCEL}))},[s]),T=(0,n.useCallback)(()=>{},[]),G=(0,n.useCallback)(i=>{if(i.preventDefault(),i.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const m=document.getElementById("iframe-scroll-top"),_=document.getElementById("iframe-scroll-bottom"),{slot:B,area:C}=ne();if(!B||!m||!_)return;const{height:Y,top:D}=B.getBoundingClientRect(),L=document.body.getBoundingClientRect().height;D>1?m.style.display==="block"&&(m.style.display="none"):m.style.display==="none"&&(m.style.display="block"),Y-L+D<1?_.style.display==="block"&&(_.style.display="none"):_.style.display==="none"&&(_.style.display="block"),i.target===m&&C?.scrollBy(0,-20),i.target===_&&C?.scrollBy(0,20)},[]),V=(0,n.useCallback)(()=>{const i=document.getElementById("iframe-scroll-top"),m=document.getElementById("iframe-scroll-bottom");i&&m&&(i.style.display="none",m.style.display="none")},[]);return(0,n.useEffect)(()=>(window.addEventListener("dragstart",T),window.addEventListener("drop",x),window.addEventListener("dragend",V),window.addEventListener("dragover",G),window.addEventListener("keydown",v),()=>{window.removeEventListener("dragstart",T),window.removeEventListener("drop",x),window.removeEventListener("dragover",G),window.removeEventListener("dragend",V),window.removeEventListener("keydown",v)}),[v,T,x,V,G]),(0,o.jsx)(e.DocumentSessionProvider,{document:k,history:U,children:(0,o.jsxs)(r.ui_kit$Layout,{className:"block-page",children:[w&&(0,o.jsx)(se,{block:H}),W&&(0,o.jsx)(r.ui_kit$PageLoader,{}),y&&S&&!1,t?w&&(0,o.jsx)(z.EmailPane_default,{emailElement:H,kind:"block",isSuccess:!0}):(!c&&(a?b&&f:!0)||M&&j)&&(0,o.jsx)(z.EmailPane_default,{emailElement:H,kind:"block",isSuccess:K})]})})},ke=()=>{const{document:t,email:d}=e.useOpenEmail(),s=(0,n.useMemo)(()=>({document:t,block:d}),[t,d]);return(0,o.jsx)(fe,{session:s})};re.default=ke});
|