@creaditor/newsletter-starterkit 1.0.59 → 1.0.61

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.
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3503],{43503(e,t,n){function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"string"==typeof e.url&&e.url?e.url:"string"==typeof e.src&&e.src?e.src:""}function i(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const e of t){if("string"==typeof e&&e.includes("%"))continue;const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return null}n.d(t,{default:()=>k});const s=e=>{{const{component:t,commands:n,helpers:i}=e,s=t.parent("col");return{select:e=>{let{changeTab:t,tab:n}=e},tabs:e=>{const t=[{text:"video"},{text:"design"},{text:"settings"}];return t.forEach(t=>t.selected=t.selected=t.text===e),t},layout:e=>{let{tab:i,changeTab:r,tabs:l}=e;return[{type:"input",title:"add_urlAddress_from_media_site",active:()=>"video"===i.text,value:o(t.props),onChange:e=>{let o=e.target.value;if(-1!==o.indexOf("youtube.com/shorts/")){const e=o.split("/");e.length>0&&(o=`https://youtu.be/${e[e.length-1]}`)}n.execCommand("url",o),"string"==typeof t.props.src&&n.execCommand("src",o)}},{type:"divider",active:()=>"video"===i.text},{type:"input",title:"altText",active:()=>"video"===i.text,value:t.props.alt||"",onChange:e=>{const t=e.target.value;n.execCommand("alt",t)}},{type:"divider",active:()=>"video"===i.text},{type:"checkbox",title:"fullWidthOnMobile",checked:!!t.props.isFullWidthOnMobile,active:()=>"video"===i.text,onChange:e=>{const t=e.target.checked;n.execCommand("isFullWidthOnMobile",t)}},{type:"slider",min:10,title:"size",active:()=>"design"===i.text,max:s?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px"})}},{type:"divider"},{type:"justifyContent",value:s?.props.justify,active:()=>"design"===i.text,onChange:e=>{const t=e.target.value;n.execCommand("justify",t,{find:"col"})}},{type:"justifyContent",title:"alignItems",active:()=>"design"===i.text,value:s?.props.alignItems,onChange:e=>{const t=e.target.value;n.execCommand("alignItems",t,{find:"col"})}},{type:"divider",active:()=>"design"===i.text}]}}}};var r=n(52144);const l=()=>({set:(e,t,n)=>{switch(t){case"url":case"alt":case"fullWidthOnMobile":return e[t]=n,!0;case"style":if("object"==typeof n)return e[t]=(0,r.A)(e[t],n),n.height&&(e[t].height=n.height),n.width&&(e[t].width=n.width),!0}}});var a=n(72591),c=n.n(a),d=n(88639),u=n.n(d),p=n(88128),h=n.n(p),m=n(30855),v=n.n(m),g=n(93051),y=n.n(g),f=n(54292),A={};A.setAttributes=v(),A.insert=h().bind(null,"head"),A.domAPI=u(),A.insertStyleElement=y();c()(f.A,A);const b=f.A&&f.A.locals?f.A.locals:void 0;n(15284);var w=n(91597);const C="video";function x(){const e=(0,w.S)(),t="https://api.creaditor.com",n="https://multimedia.sendmsg.co.il/ShowYouTube.aspx?";return{name:C,create:r=>{function a(e,o,i){return o=parseInt(o),i=parseInt(i),new Promise((s,r)=>{if("string"!=typeof e||!e)return console.warn("video link is empty.."),void s(null);-1!==e.indexOf("youtu.be")&&(e=e.replace("youtu.be/","youtube.com/watch?v=")),-1!==e.indexOf("youtube")?s(function(e,o,i){const s=function(e){if(-1!==e.indexOf("youtube.com/shorts/")){const t=e.split("/");t.length>0&&(e=`https://youtu.be/${t[t.length-1]}`)}const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null}(e);if(!s)throw Error();const r=`//www.youtube.com/embed/${s}`,l=r.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/).pop();return 11!==l.length?(console.error("youtube link is not valid"),null):{img:`${t}/images/video/?code=${l}&width=${o}&height=${i}&type=youtube`,href:`${n}youtube=${s}`,embeded:r,source:e}}(e,o,i)):e.indexOf("vimeo")>-1?function(e,o,i){const s=e;return new Promise((r,l)=>{e=e.substr(e.lastIndexOf("/")+1).replace(/\?.*/g,""),r({img:`${t}/images/video/?code=${e}&width=${o}&height=${i}&type=vimeo`,href:`${n}vimeo=${e}`,source:s})})}(e,o,i).then(e=>{s(e)}):(console.warn("video link is not a youtube or vimeo link..",e),s(null))})}const{createElement:c,compose:d,helpers:u}=r,{arrayToString:p,mergeDiff:h}=u,m=document.createElement("div");m.classList.add(b.root);const v=document.createElement("div");v.classList.add(b.cover);const g=document.createElement("img");return m.append(g,v),c({name:C,id:d.id,template:m,defaultProps:{height:"300px",width:"400px",url:"https://www.youtube.com/watch?v=04Or_U9OexU",style:{width:"400px",height:"300px",playing:!1,loop:!1,light:!1,controls:!0,autoPlay:!1,muted:!1}},draggable:{group:"element"},droppable:{group:"element"},render:t=>{e.run(()=>{const e=g.getBoundingClientRect(),t=i(d.props.style.height,d.props.height,e.height)||300,n=i(d.props.style.width,d.props.width,e.width)||400,s=o(d.props);a(s,n,t).then(e=>{e&&(g.src=e.img)}).catch(()=>{console.warn("could not resolve video link",s)})});const n={...d.props.style};delete n.height,h(g,{style:n});const s=i(d.props.style.width);s?g.width=s:g.removeAttribute("width"),g.style.height="auto",g.height="auto",g.style.maxWidth="100%"},atomElement:g,resizeable:()=>m,handleBar:!0,validator:l(),schema:d.schema,onSelect:e=>{g.classList.add(e)},onDeselect:e=>{g.classList.remove(e)},elementProps:d,remove:()=>{m.remove()},createEditor:s})}}}const k=()=>x()},54292(e,t,n){n.d(t,{A:()=>l});var o=n(82001),i=n.n(o),s=n(40935),r=n.n(s)()(i());r.push([e.id,".erXmYCCmdWL8v5GDxnjP {\n position: relative;\n max-width: 100%;\n}\n.tPZLaQk8gBr1YTwcypDQ {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.erXmYCCmdWL8v5GDxnjP:hover .tPZLaQk8gBr1YTwcypDQ {\n display: block;\n background-color: var(--primary);\n}\n","",{version:3,sources:["webpack://./../newsletter-editors/video-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,eAAe;AACjB;AACA;EACE,WAAW;EACX,YAAY;EACZ,OAAO;EACP,MAAM;EACN,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,cAAc;EACd,gCAAgC;AAClC",sourcesContent:[".root {\n position: relative;\n max-width: 100%;\n}\n.cover {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.root:hover .cover {\n display: block;\n background-color: var(--primary);\n}\n"],sourceRoot:""}]),r.locals={root:"erXmYCCmdWL8v5GDxnjP",cover:"tPZLaQk8gBr1YTwcypDQ"};const l=r}}]);
Binary file
@@ -1,7 +1,7 @@
1
1
  "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3521],{83521(t,e,i){i.r(e),i.d(e,{DesignFactory:()=>l});var o=i(5441),n=i(59929),r=i(15604),s=i(18057),d=i(86319);i.e(8315).then(i.bind(i,68315));class l extends n.WF{constructor(){super(),this.lastEditor=null,this._selectedComponentId=null,this._injectedForId=null,d.M.set({injectEditor:t=>{this.injected=!0,this._injectedForId=this._selectedComponentId,this.lastEditor=this.editor,this.backToEditor=this.editor,this.editor=t}}),this.editor=n.qy`<cdtr-ilustration-preference
2
2
  width="200px"
3
3
  height="200px"
4
- ></cdtr-ilustration-preference>`,this.delayer=new s.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(1260).then(i.bind(i,91260)),component:null},no_editor:{selector:"cdtr-no-component",load:()=>i.e(8854).then(i.bind(i,68854)),component:null,attrs:{style:"margin:auto;display:block;max-width:150px;margin-top:30px;"}}},this.type=null,r.Ay.on("select",this.connect)}connect(t){let{editor:e,component:i}=t;if(!e)return;let n=e.type;if("string"!=typeof n)return;const r=i?.id??null;if(this.injected){if(null==r||r===this._injectedForId)return;this.injected=!1,this._injectedForId=null}if(this._selectedComponentId=r,this.editor?.type===n)return;if(!this.editors[n]){const t=d.M.get("config","editor","configure","plugins");if(Array.isArray(t)){const e=t.find(t=>t.name===n);if(e&&"function"==typeof e.createEditor){this.editor=document.createElement("cdtr-editor-builder"),this.editor.type=n;const t=e.createEditor();return void(t&&(this.editor.editors=t.layout,t!==this.backToEditor&&this.lastEditor&&(this.lastEditor=null)))}}n="no_editor"}this.type=n;const s=(0,o.A)("div",null,(0,o.A)("cdtr-block-loader",null),(0,o.A)("cdtr-title",{style:"text-align:center;"},(0,o.A)("lang-text",{text:"please_wait_downloading_new_version"})));this.editors[n]&&!this.editors[n].component&&(this.editors[n].load().then(()=>{if(s.remove(),this.editors[n].attrs)for(const t in this.editors[n].attrs)if(Object.hasOwnProperty.call(this.editors[n].attrs,t)){const e=this.editors[n].attrs[t];this.editors[n].component[t]=e}}),this.editors[n].component=document.createElement(this.editors[n].selector),this.editors[n].component.appendChild(s)),this.editors[n].component&&(this.editor=this.editors[n].component)}goBack(){this.lastEditor&&(this.editor=this.lastEditor,this.lastEditor=null,this.injected=!1,this._injectedForId=null)}createRenderRoot(){return this}render(){return n.qy` ${this.lastEditor?n.qy`<div style="display:flex;justify-content:flex-start;padding:12px 16px 4px;direction:var(--direction-locale);">
4
+ ></cdtr-ilustration-preference>`,this.delayer=new s.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(8299).then(i.bind(i,68299)),component:null},no_editor:{selector:"cdtr-no-component",load:()=>i.e(8854).then(i.bind(i,68854)),component:null,attrs:{style:"margin:auto;display:block;max-width:150px;margin-top:30px;"}}},this.type=null,r.Ay.on("select",this.connect)}connect(t){let{editor:e,component:i}=t;if(!e)return;let n=e.type;if("string"!=typeof n)return;const r=i?.id??null;if(this.injected){if(null==r||r===this._injectedForId)return;this.injected=!1,this._injectedForId=null}if(this._selectedComponentId=r,this.editor?.type===n)return;if(!this.editors[n]){const t=d.M.get("config","editor","configure","plugins");if(Array.isArray(t)){const e=t.find(t=>t.name===n);if(e&&"function"==typeof e.createEditor){this.editor=document.createElement("cdtr-editor-builder"),this.editor.type=n;const t=e.createEditor();return void(t&&(this.editor.editors=t.layout,t!==this.backToEditor&&this.lastEditor&&(this.lastEditor=null)))}}n="no_editor"}this.type=n;const s=(0,o.A)("div",null,(0,o.A)("cdtr-block-loader",null),(0,o.A)("cdtr-title",{style:"text-align:center;"},(0,o.A)("lang-text",{text:"please_wait_downloading_new_version"})));this.editors[n]&&!this.editors[n].component&&(this.editors[n].load().then(()=>{if(s.remove(),this.editors[n].attrs)for(const t in this.editors[n].attrs)if(Object.hasOwnProperty.call(this.editors[n].attrs,t)){const e=this.editors[n].attrs[t];this.editors[n].component[t]=e}}),this.editors[n].component=document.createElement(this.editors[n].selector),this.editors[n].component.appendChild(s)),this.editors[n].component&&(this.editor=this.editors[n].component)}goBack(){this.lastEditor&&(this.editor=this.lastEditor,this.lastEditor=null,this.injected=!1,this._injectedForId=null)}createRenderRoot(){return this}render(){return n.qy` ${this.lastEditor?n.qy`<div style="display:flex;justify-content:flex-start;padding:12px 16px 4px;direction:var(--direction-locale);">
5
5
  <span
6
6
  @click=${this.goBack}
7
7
  style="display:inline-flex;align-items:center;gap:3px;font-size:12px;color:#555;cursor:pointer;font-family:inherit;"
Binary file
@@ -388,7 +388,7 @@
388
388
  margin-top: 0.75rem;
389
389
  padding-left: 1rem;
390
390
  }
391
- `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],h="cdtrAdd",d="cdtrRemove",p="cdtrAutomation",u=[h,d,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}const f="anchor",g="linkpicker:anchor";function y(){const t=new Set;return function(){const t=o.M.get("components");return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t).filter(t=>t&&"object"==typeof t):[]}().forEach(e=>{const i=e&&e.props;i&&(i.anchor&&i.anchor.name&&t.add(String(i.anchor.name)),e.type===f&&i.name&&t.add(String(i.name)))}),t}let b=null,v=null;const x="cdtr:anchor-attached";function w(){let{onCreated:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$();const e=function(){const t=y();let e=1;for(;t.has(`${f}-${e}`);)e++;return`${f}-${e}`}(),i={id:g,name:f,group:"elements",body:{type:f,props:{name:e,color:"#6b7280"}}},s=document.createElement("div");return s.setAttribute("data-id",g),s.setAttribute("data-group","elements"),s.setAttribute("data-placement",""),s.setAttribute("draggable-element","create:element"),s.setAttribute("draggable-direction","top,bottom,left,right"),s.classList.add("draggable-element-handle"),s.__template=i,window.__dragoned_selected_element=s,b=s,"function"==typeof t&&(v=function(t){let e=!1;const i=i=>{const s=i&&i.detail&&i.detail.name;!e&&s&&(e=!0,o(),v=null,t(s))},s=()=>{setTimeout(()=>{e||(o(),v=null)},0)};function o(){window.removeEventListener(x,i),document.removeEventListener("mouseup",s,!0)}return window.addEventListener(x,i),document.addEventListener("mouseup",s,!0),o}(t)),s}function $(){b&&window.__dragoned_selected_element===b&&delete window.__dragoned_selected_element,b=null,v&&(v(),v=null)}function A(t){let{onRequest:e,onChangeLink:i,onBlur:r}=t;return function(){const t=o.M.get("config","editor","configure","plugins");return!!Array.isArray(t)&&t.some(t=>t&&t.name===f)}()?s.qy`
391
+ `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],h="cdtrAdd",d="cdtrRemove",p="cdtrAutomation",u=[h,d,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}const f="anchor",g="linkpicker:anchor";function b(){const t=new Set;return function(){const t=o.M.get("components");return Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t).filter(t=>t&&"object"==typeof t):[]}().forEach(e=>{const i=e&&e.props;i&&(i.anchor&&i.anchor.name&&t.add(String(i.anchor.name)),e.type===f&&i.name&&t.add(String(i.name)))}),t}let y=null,v=null;const x="cdtr:anchor-attached";function w(){let{onCreated:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$();const e=function(){const t=b();let e=1;for(;t.has(`${f}-${e}`);)e++;return`${f}-${e}`}(),i={id:g,name:f,group:"elements",body:{type:f,props:{name:e,color:"#6b7280"}}},s=document.createElement("div");return s.setAttribute("data-id",g),s.setAttribute("data-group","elements"),s.setAttribute("data-placement",""),s.setAttribute("draggable-element","create:element"),s.setAttribute("draggable-direction","top,bottom,left,right"),s.classList.add("draggable-element-handle"),s.__template=i,window.__dragoned_selected_element=s,y=s,"function"==typeof t&&(v=function(t){let e=!1;const i=i=>{const s=i&&i.detail&&i.detail.name;!e&&s&&(e=!0,o(),v=null,t(s))},s=()=>{setTimeout(()=>{e||(o(),v=null)},0)};function o(){window.removeEventListener(x,i),document.removeEventListener("mouseup",s,!0)}return window.addEventListener(x,i),document.addEventListener("mouseup",s,!0),o}(t)),s}function $(){y&&window.__dragoned_selected_element===y&&delete window.__dragoned_selected_element,y=null,v&&(v(),v=null)}function A(t){let{onRequest:e,onChangeLink:i,onBlur:r}=t;return function(){const t=o.M.get("config","editor","configure","plugins");return!!Array.isArray(t)&&t.some(t=>t&&t.name===f)}()?s.qy`
392
392
  <div class="anchor-create">
393
393
  <div
394
394
  class="anchor-drag draggable-element-handle"
@@ -422,7 +422,9 @@
422
422
  class=" dropdown-button"
423
423
  slot="trigger"
424
424
  >
425
- ${l?s.qy`<span class="anchor-dd-value">${l}</span>`:s.qy`<lang-text
425
+ ${l?s.qy`<span class="anchor-dd-value"
426
+ >${(t=>{const e=i.find(e=>e.name===t);return e&&e.label||t})(l)}</span
427
+ >`:s.qy`<lang-text
426
428
  text=${i.length?"select_anchor":"no_anchors_yet"}
427
429
  ></lang-text>`}
428
430
  </cdtr-dropdown-button>
@@ -431,7 +433,7 @@
431
433
  value="${t.name}"
432
434
  .selected=${t.name===l}
433
435
  .focused=${t.name===l}
434
- >${t.name}
436
+ >${t.label||t.name}
435
437
  </cdtr-dropdown-item>`)}
436
438
  </div>
437
439
  </cdtr-dropdown>
@@ -482,7 +484,7 @@
482
484
  @change=${t=>{let{target:e}=t;r(e.value),o()}}
483
485
  ></cdtr-input>
484
486
  </cdtr-row>
485
- `}(e);default:return""}}function _(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let h=`https://wa.me/${a}`;c&&(h+=`?text=${c}`);const d=new r.A(h);return d.target=o||d.target||"_blank",{url:d,params:d.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function S(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function R(){const t=o.M.get("components"),e=Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[],i=function(t){const e=new Map;t.forEach(t=>{const i=t&&(t.id||t._id);i&&e.set(i,t)});const i=t.find(t=>t&&"root"===t.type),s=i&&(i.id||i._id);if(!s)return null;const o=new Set,r=t=>{if(!t||o.has(t))return;o.add(t);const i=e.get(t);i&&[].concat(Array.isArray(i.children)?i.children:[]).concat(Array.isArray(i.elements)?i.elements:[]).forEach(t=>r((t=>t?"string"==typeof t?t:t.id||t.dataset&&t.dataset.id||null:null)(t)))};return r(s),o}(e),s=i?e.filter(t=>t&&i.has(t.id||t._id)):e,r=new Set,n=[],a=(t,e)=>{e&&!r.has(e)&&(r.add(e),n.push({id:t,name:e}))};return s.forEach(t=>{const e=t&&t.props;e&&(e.anchor&&e.anchor.name?a(t.id,e.anchor.name):"anchor"===t.type&&e.name?a(t.id,e.name):e.element_ID&&a(t.id,e.element_ID))}),n}function L(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:h,placeholder:d="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
487
+ `}(e);default:return""}}function _(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let h=`https://wa.me/${a}`;c&&(h+=`?text=${c}`);const d=new r.A(h);return d.target=o||d.target||"_blank",{url:d,params:d.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function S(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function R(){const t=o.M.get("components"),e=Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[],i=function(t){const e=new Map;t.forEach(t=>{const i=t&&(t.id||t._id);i&&e.set(i,t)});const i=t.find(t=>t&&"root"===t.type),s=i&&(i.id||i._id);if(!s)return null;const o=new Set,r=t=>{if(!t||o.has(t))return;o.add(t);const i=e.get(t);i&&[].concat(Array.isArray(i.children)?i.children:[]).concat(Array.isArray(i.elements)?i.elements:[]).forEach(t=>r((t=>t?"string"==typeof t?t:t.id||t.dataset&&t.dataset.id||null:null)(t)))};return r(s),o}(e),s=i?e.filter(t=>t&&i.has(t.id||t._id)):e,r=new Set,n=[],a=(t,e,i)=>{e&&!r.has(e)&&(r.add(e),n.push({id:t,name:e,label:i||e}))};return s.forEach(t=>{const e=t&&t.props;e&&(e.anchor&&e.anchor.name?a(t.id,e.anchor.name,e.anchor.label):"anchor"===t.type&&e.name?a(t.id,e.name):e.element_ID&&a(t.id,e.element_ID))}),n}function L(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:h,placeholder:d="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
486
488
  <cdtr-row style="position:relative;" spacing="5">
487
489
  <span style="display:none;" aria-hidden="true">${e}</span>
488
490
  <cdtr-input
@@ -865,7 +867,7 @@
865
867
  </cdtr-row>
866
868
  </div>
867
869
  </div>
868
- `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class C extends(U(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=_(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=S(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=R()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=h.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(d)c=h;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const f=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),g=[...this.options],y=g.findIndex(t=>"http:"===t.type);y>-1&&g.splice(y,1);const b=o.M.get("config","editor","configure","editorProps","automations"),v={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},x=null!=c&&""!==c?String(c):"",w=this._urlInputRawValue!==x,$=void 0!==this._lastSyncedMyHref&&x!==this._lastSyncedMyHref,A=this.urlInputFocused&&this._urlInputRawValue&&x&&!$;w&&!A?(this._urlInputRawValue=x,this._lastSyncedMyHref=x):w||(this._lastSyncedMyHref=x);const _=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:_};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
870
+ `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class C extends(U(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=_(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=S(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=R()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=h.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(d)c=h;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const f=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),g=[...this.options],b=g.findIndex(t=>"http:"===t.type);b>-1&&g.splice(b,1);const y=o.M.get("config","editor","configure","editorProps","automations"),v={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},x=null!=c&&""!==c?String(c):"",w=this._urlInputRawValue!==x,$=void 0!==this._lastSyncedMyHref&&x!==this._lastSyncedMyHref,A=this.urlInputFocused&&this._urlInputRawValue&&x&&!$;w&&!A?(this._urlInputRawValue=x,this._lastSyncedMyHref=x):w||(this._lastSyncedMyHref=x);const _=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:_};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
869
871
  ${F=this.label,F?s.qy`<cdtr-title
870
872
  style="font-weight: 700;
871
873
  font-size: 14.4px;
@@ -931,7 +933,7 @@
931
933
  ></cdtr-title>
932
934
  ${function(t){const{protocol:e,url:i,autofocus:s,inputRef:o,onChangeLink:r,onBlur:n,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:L({value:c,inputRef:o,autofocus:s,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(S)}
933
935
  ${k(this.protocol,v)}
934
- ${b?s.qy` <cdtr-divider></cdtr-divider>
936
+ ${y?s.qy` <cdtr-divider></cdtr-divider>
935
937
  <cdtr-row justify="flex-start" mt="1">
936
938
  <cdtr-title class="explain-title"
937
939
  ><lang-text
Binary file
@@ -1,10 +1,10 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5909],{65909(e,t,i){i.r(t),i.d(t,{NextButton:()=>b,PUBLISH_ERROR_EVENT:()=>g,PUBLISH_EVENT:()=>f});var o=i(59929),s=i(86319),r=i(93432),n=i(90090),a=i(86959),l=i(15604);const c=`${(0,a.Ay)()?"http://127.0.0.1:8000":"https://studio.creaditor.ai"}/api/seo-generate`;const d=o.qy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5909],{65909(e,t,i){i.r(t),i.d(t,{NextButton:()=>g,PUBLISH_ERROR_EVENT:()=>f,PUBLISH_EVENT:()=>u});var s=i(59929),o=i(86319),r=i(93432),n=i(90090),a=i(86959),l=i(15604);const c=`${(0,a.Ay)()?"http://127.0.0.1:8000":"https://studio.creaditor.ai"}/api/seo-generate`;const d=s.qy`
2
2
  <svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16" aria-hidden="true">
3
3
  <path
4
4
  d="M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z"
5
5
  />
6
6
  </svg>
7
- `;class p extends o.WF{constructor(){super(),this.resolver=null,this.onCancel=()=>{this.loading||this.close(null)},this.onKeywordKeydown=e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),this.commitDraftKeyword()):"Backspace"===e.key&&""===this.keywordDraft&&this.keywordList.length&&(this.keywordList=this.keywordList.slice(0,-1))},this.generateField=async e=>{if(this.loading||this.generatingField)return;const t=function(){const e=document.getElementById("main-page-wrapper");return(e?.innerText||"").trim()}();if(t){this.generatingField=e;try{const i="rtl"===this.direction?"he":"en",o=await this.requestSeo(e,t,i);if("keywords"===e){const e=(Array.isArray(o)?o:String(o).split(",")).map(e=>e.trim()).filter(Boolean),t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t}else"title"===e?this.title=String(o).slice(0,100):this.description=String(o).slice(0,255)}catch(e){console.error("[seo-generate] failed:",e),this.snackbar(this.t("seo_generate_failed","Couldn't generate. Please try again."))}finally{this.generatingField=""}}else this.snackbar(this.t("seo_generate_empty","Add some content to the page first."))},this.onPublish=()=>{this.loading||(this.commitDraftKeyword(),this.loading=!0,this.close({title:this.title.trim(),description:this.description.trim(),keywords:[...this.keywordList]}))},this.loading=!1,this.title="",this.description="",this.keywordList=[],this.keywordDraft="",this.keywordsFocused=!1,this.generatingField=""}static open(){const e=document.createElement("cdtr-publish-seo"),t=s.M.get("app","seo")||{};return e.title=t.title||"",e.description=t.description||"",e.keywordList=(Array.isArray(t.keywords)?t.keywords:String(t.keywords||"").split(",")).map(e=>String(e).trim()).filter(Boolean),document.body.appendChild(e),e.waitForChoice()}waitForChoice(){return new Promise(e=>{this.resolver=e})}t(e,t){return s.M.get("lang",e)||t}get direction(){const e=s.M.get("theme");return e?.direction||"rtl"}close(e){this.resolver&&(this.resolver(e),this.resolver=null),this.isConnected&&this.remove()}commitDraftKeyword(){const e=this.keywordDraft.split(",").map(e=>e.trim()).filter(Boolean);if(!e.length)return;const t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t,this.keywordDraft=""}removeKeyword(e){this.keywordList=this.keywordList.filter((t,i)=>i!==e)}snackbar(e){const t=s.M.get("commands");t?.snackbar?.(e)}async requestSeo(e,t,i){const o=async o=>{const s=await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=l.Ay;if("function"==typeof t.studioTokenProvider)try{const i=await t.studioTokenProvider({forceRefresh:e});if("string"==typeof i&&i.length>0)return i}catch{}return"string"==typeof t.studioToken&&t.studioToken.length>0?t.studioToken:null}(o),r={"Content-Type":"application/json",Accept:"application/json"};return s&&(r.Authorization=`Bearer ${s}`),fetch(c,{method:"POST",headers:r,body:JSON.stringify({content:t,field:e,language:i})})};let s=await o(!1);if(401===s.status&&(s=await o(!0)),!s.ok)throw new Error(`HTTP ${s.status}`);const r=await s.json();if(!r.ok||void 0===r.value)throw new Error("bad response");return r.value}magicButton(e){const t=this.generatingField===e;return o.qy`
7
+ `;class h extends s.WF{constructor(){super(),this.resolver=null,this.dismiss=()=>{this.isConnected&&this.remove()},this.onCancel=()=>{this.loading||(this.settle(null),this.dismiss())},this.onKeywordKeydown=e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),this.commitDraftKeyword()):"Backspace"===e.key&&""===this.keywordDraft&&this.keywordList.length&&(this.keywordList=this.keywordList.slice(0,-1))},this.generateField=async e=>{if(this.loading||this.generatingField)return;const t=function(){const e=document.getElementById("main-page-wrapper");return(e?.innerText||"").trim()}();if(t){this.generatingField=e;try{const i="rtl"===this.direction?"he":"en",s=await this.requestSeo(e,t,i);if("keywords"===e){const e=(Array.isArray(s)?s:String(s).split(",")).map(e=>e.trim()).filter(Boolean),t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t}else"title"===e?this.title=String(s).slice(0,100):this.description=String(s).slice(0,255)}catch(e){console.error("[seo-generate] failed:",e),this.snackbar(this.t("seo_generate_failed","Couldn't generate. Please try again."))}finally{this.generatingField=""}}else this.snackbar(this.t("seo_generate_empty","Add some content to the page first."))},this.onPublish=()=>{this.loading||(this.commitDraftKeyword(),this.loading=!0,this.settle({seo:{title:this.title.trim(),description:this.description.trim(),keywords:[...this.keywordList]},busy:e=>{this.isConnected&&(this.loading=e)},done:this.dismiss}))},this.loading=!1,this.title="",this.description="",this.keywordList=[],this.keywordDraft="",this.keywordsFocused=!1,this.generatingField=""}static open(){const e=document.createElement("cdtr-publish-seo"),t=o.M.get("app","seo")||{};return e.title=t.title||"",e.description=t.description||"",e.keywordList=(Array.isArray(t.keywords)?t.keywords:String(t.keywords||"").split(",")).map(e=>String(e).trim()).filter(Boolean),document.body.appendChild(e),e.waitForChoice()}waitForChoice(){return new Promise(e=>{this.resolver=e})}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}settle(e){this.resolver&&(this.resolver(e),this.resolver=null)}commitDraftKeyword(){const e=this.keywordDraft.split(",").map(e=>e.trim()).filter(Boolean);if(!e.length)return;const t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t,this.keywordDraft=""}removeKeyword(e){this.keywordList=this.keywordList.filter((t,i)=>i!==e)}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}async requestSeo(e,t,i){const s=async s=>{const o=await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=l.Ay;if("function"==typeof t.studioTokenProvider)try{const i=await t.studioTokenProvider({forceRefresh:e});if("string"==typeof i&&i.length>0)return i}catch{}return"string"==typeof t.studioToken&&t.studioToken.length>0?t.studioToken:null}(s),r={"Content-Type":"application/json",Accept:"application/json"};return o&&(r.Authorization=`Bearer ${o}`),fetch(c,{method:"POST",headers:r,body:JSON.stringify({content:t,field:e,language:i})})};let o=await s(!1);if(401===o.status&&(o=await s(!0)),!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();if(!r.ok||void 0===r.value)throw new Error("bad response");return r.value}magicButton(e){const t=this.generatingField===e;return s.qy`
8
8
  <button
9
9
  class="magic"
10
10
  type="button"
@@ -13,13 +13,15 @@
13
13
  ?disabled=${this.loading||!!this.generatingField}
14
14
  @click=${()=>this.generateField(e)}
15
15
  >
16
- ${t?o.qy`<span class="mini-spinner"></span>`:d}
16
+ ${t?s.qy`<span class="mini-spinner"></span>`:d}
17
17
  </button>
18
- `}render(){const e=this.direction;return o.qy`
18
+ `}render(){const e=this.direction;return s.qy`
19
19
  <div class="backdrop" @click=${this.onCancel}></div>
20
20
  <div class="card" dir=${e}>
21
21
  <h2 class="heading">${this.t("ready_to_publish","Ready to publish")}</h2>
22
- <p class="subheading">${this.t("lets_set_some_seo","Let's set some SEO")}</p>
22
+ <p class="subheading">
23
+ ${this.loading?this.t("publishing_your_site","Publishing your site…"):this.t("lets_set_some_seo","Let's set some SEO")}
24
+ </p>
23
25
 
24
26
  <div class="field">
25
27
  <div class="label-row">
@@ -29,6 +31,7 @@
29
31
  <input
30
32
  type="text"
31
33
  maxlength=${100}
34
+ ?disabled=${this.loading}
32
35
  .value=${this.title}
33
36
  placeholder=${this.t("seo_title_placeholder","Page name as it will appear in search engines")}
34
37
  @input=${e=>this.title=e.target.value}
@@ -43,6 +46,7 @@
43
46
  </div>
44
47
  <textarea
45
48
  maxlength=${255}
49
+ ?disabled=${this.loading}
46
50
  .value=${this.description}
47
51
  placeholder=${this.t("seo_description_placeholder","This description will appear below the site title in search engines")}
48
52
  @input=${e=>this.description=e.target.value}
@@ -59,7 +63,7 @@
59
63
  class="chips ${this.keywordsFocused?"focused":""}"
60
64
  @click=${e=>{const t=e.currentTarget.querySelector("input");t?.focus()}}
61
65
  >
62
- ${this.keywordList.map((e,t)=>o.qy`
66
+ ${this.keywordList.map((e,t)=>s.qy`
63
67
  <span class="chip">
64
68
  ${e}
65
69
  <button
@@ -73,6 +77,7 @@
73
77
  `)}
74
78
  <input
75
79
  type="text"
80
+ ?disabled=${this.loading}
76
81
  .value=${this.keywordDraft}
77
82
  placeholder=${this.keywordList.length?"":this.t("seo_keywords_placeholder","For example: gift,woman,gift for woman")}
78
83
  @input=${e=>this.keywordDraft=e.target.value}
@@ -85,14 +90,14 @@
85
90
 
86
91
  <div class="actions">
87
92
  <button class="publish" ?disabled=${this.loading} @click=${this.onPublish}>
88
- ${this.loading?o.qy`<span class="spinner"></span>`:this.t("publish","Publish")}
93
+ ${this.loading?s.qy`<span class="spinner"></span>`:this.t("publish","Publish")}
89
94
  </button>
90
95
  <button class="cancel" ?disabled=${this.loading} @click=${this.onCancel}>
91
96
  ${this.t("cancel","Cancel")}
92
97
  </button>
93
98
  </div>
94
99
  </div>
95
- `}}p.styles=o.AH`
100
+ `}}h.styles=s.AH`
96
101
  :host {
97
102
  position: fixed;
98
103
  inset: 0;
@@ -338,22 +343,31 @@
338
343
  @keyframes spin {
339
344
  to { transform: rotate(360deg); }
340
345
  }
341
- `,p.properties={loading:{type:Boolean},title:{type:String},description:{type:String},keywordList:{type:Array},keywordDraft:{type:String},keywordsFocused:{type:Boolean},generatingField:{type:String}},customElements.define("cdtr-publish-seo",p);var h=i(65550);class u extends o.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,this.dismiss=()=>{this.isConnected&&this.remove()},this.copyLink=async()=>{if(this.url)try{await navigator.clipboard.writeText(this.url),this.copied=!0,setTimeout(()=>this.copied=!1,2e3)}catch{}},this.message="",this.sub="",this.url="",this.seoTitle="",this.seoDescription="",this.copied=!1}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),6500)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer)}t(e,t){return s.M.get("lang",e)||t}get direction(){const e=s.M.get("theme");return e?.direction||"rtl"}get host(){return this.url?this.url.replace(/^https?:\/\//,"").replace(/\/+$/,""):""}launchConfetti(){const e=this.renderRoot.querySelector("canvas");if(!e)return;const t=e.getContext("2d");if(!t)return;const i=window.devicePixelRatio||1,o=window.innerWidth,s=window.innerHeight;e.width=o*i,e.height=s*i,t.scale(i,i);const r=["#e94560","#1a1a2e","#f6c945","#2ec7a9","#4d7cfe","#ffffff"],n=o/2,a=.42*s,l=Math.min(220,Math.round(o/6)),c=Array.from({length:l},(e,t)=>{const i=2*Math.PI*t/l+t%3*.4,o=4+t%9;return{x:n,y:a,vx:Math.cos(i)*o,vy:Math.sin(i)*o-3,size:5+t%5,color:r[t%r.length],rot:t,vrot:(t%2?1:-1)*(.1+t%5*.03),life:1}}),d=performance.now(),p=e=>{const i=e-d;t.clearRect(0,0,o,s);let r=!1;for(const e of c)e.vy+=.16,e.x+=e.vx,e.y+=e.vy,e.rot+=e.vrot,i>2600*.55&&(e.life=Math.max(0,e.life-.02)),e.life>0&&e.y<s+40&&(r=!0),t.save(),t.globalAlpha=e.life,t.translate(e.x,e.y),t.rotate(e.rot),t.fillStyle=e.color,t.fillRect(-e.size/2,-e.size/2,e.size,.6*e.size),t.restore();r&&i<3e3?this.raf=requestAnimationFrame(p):t.clearRect(0,0,o,s)};this.raf=requestAnimationFrame(p)}renderPreview(){const e=this.host;if(!e)return o.s6;const t=(this.seoTitle||"").trim()||(this.seoDescription?"":e),i=(this.seoDescription||"").trim(),s=(t||e).charAt(0);return o.qy`
346
+ `,h.properties={loading:{type:Boolean},title:{type:String},description:{type:String},keywordList:{type:Array},keywordDraft:{type:String},keywordsFocused:{type:Boolean},generatingField:{type:String}},customElements.define("cdtr-publish-seo",h);class p extends s.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,this.onKeyDown=e=>{"Escape"===e.key&&this.dismiss()},this.dismiss=()=>{this.isConnected&&this.remove()},this.copyLink=async()=>{if(this.url)try{await navigator.clipboard.writeText(this.url),this.copied=!0,setTimeout(()=>this.copied=!1,2e3)}catch{}},this.message="",this.sub="",this.url="",this.seoTitle="",this.seoDescription="",this.copied=!1}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.onKeyDown)}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),6500)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer),document.removeEventListener("keydown",this.onKeyDown)}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}get host(){return this.url?this.url.replace(/^https?:\/\//,"").replace(/\/+$/,""):""}launchConfetti(){const e=this.renderRoot.querySelector("canvas");if(!e)return;const t=e.getContext("2d");if(!t)return;const i=window.devicePixelRatio||1,s=window.innerWidth,o=window.innerHeight;e.width=s*i,e.height=o*i,t.scale(i,i);const r=["#e94560","#1a1a2e","#f6c945","#2ec7a9","#4d7cfe","#ffffff"],n=s/2,a=.42*o,l=Math.min(220,Math.round(s/6)),c=Array.from({length:l},(e,t)=>{const i=2*Math.PI*t/l+t%3*.4,s=4+t%9;return{x:n,y:a,vx:Math.cos(i)*s,vy:Math.sin(i)*s-3,size:5+t%5,color:r[t%r.length],rot:t,vrot:(t%2?1:-1)*(.1+t%5*.03),life:1}}),d=performance.now(),h=e=>{const i=e-d;t.clearRect(0,0,s,o);let r=!1;for(const e of c)e.vy+=.16,e.x+=e.vx,e.y+=e.vy,e.rot+=e.vrot,i>2600*.55&&(e.life=Math.max(0,e.life-.02)),e.life>0&&e.y<o+40&&(r=!0),t.save(),t.globalAlpha=e.life,t.translate(e.x,e.y),t.rotate(e.rot),t.fillStyle=e.color,t.fillRect(-e.size/2,-e.size/2,e.size,.6*e.size),t.restore();r&&i<3e3?this.raf=requestAnimationFrame(h):t.clearRect(0,0,s,o)};this.raf=requestAnimationFrame(h)}renderPreview(){const e=this.host;if(!e)return s.s6;const t=(this.seoTitle||"").trim()||(this.seoDescription?"":e),i=(this.seoDescription||"").trim(),o=(t||e).charAt(0);return s.qy`
342
347
  <div class="preview">
343
348
  <p class="preview-caption">${this.t("search_preview_label","How your page will look on Google")}</p>
344
349
  <div class="result-head">
345
- <span class="favicon">${s}</span>
350
+ <span class="favicon">${o}</span>
346
351
  <div class="result-url">
347
352
  <div class="result-host">${e.split("/")[0]}</div>
348
353
  <div class="result-crumb">${e}</div>
349
354
  </div>
350
355
  </div>
351
- ${t?o.qy`<p class="result-title">${t}</p>`:o.s6}
352
- ${i?o.qy`<p class="result-desc">${i}</p>`:o.s6}
356
+ ${t?s.qy`<p class="result-title">${t}</p>`:s.s6}
357
+ ${i?s.qy`<p class="result-desc">${i}</p>`:s.s6}
353
358
  </div>
354
- `}render(){const e=this.direction,t=this.copied?o.qy`<svg viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" /></svg>`:o.qy`<svg viewBox="0 0 24 24" fill="none"><rect x="9" y="9" width="11" height="11" rx="2" stroke="currentColor" stroke-width="2" /><path d="M5 15V5a2 2 0 0 1 2-2h10" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>`;return o.qy`
359
+ `}render(){const e=this.direction,t=this.copied?s.qy`<svg viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" /></svg>`:s.qy`<svg viewBox="0 0 24 24" fill="none"><rect x="9" y="9" width="11" height="11" rx="2" stroke="currentColor" stroke-width="2" /><path d="M5 15V5a2 2 0 0 1 2-2h10" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>`;return s.qy`
355
360
  <canvas @click=${this.dismiss}></canvas>
356
361
  <div class="card" dir=${e}>
362
+ <button
363
+ class="close"
364
+ type="button"
365
+ aria-label=${this.t("close","Close")}
366
+ title=${this.t("close","Close")}
367
+ @click=${this.dismiss}
368
+ >
369
+ <svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6L6 18" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" /></svg>
370
+ </button>
357
371
  <div class="check">
358
372
  <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
359
373
  <path d="M5 13l4 4L19 7" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" />
@@ -364,7 +378,7 @@
364
378
 
365
379
  ${this.renderPreview()}
366
380
 
367
- ${this.url?o.qy`
381
+ ${this.url?s.qy`
368
382
  <div class="actions">
369
383
  <a class="view" href=${this.url} target="_blank" rel="noopener">
370
384
  <svg viewBox="0 0 24 24" fill="none"><path d="M14 4h6v6M20 4l-9 9M18 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
@@ -375,9 +389,9 @@
375
389
  ${this.copied?this.t("link_copied","Link copied"):this.t("copy_link","Copy link")}
376
390
  </button>
377
391
  </div>
378
- `:o.s6}
392
+ `:s.s6}
379
393
  </div>
380
- `}}u.styles=o.AH`
394
+ `}}p.styles=s.AH`
381
395
  :host {
382
396
  position: fixed;
383
397
  inset: 0;
@@ -415,6 +429,34 @@
415
429
  transform: translate(-50%, -50%) scale(1);
416
430
  }
417
431
  }
432
+ /* Manual dismiss. The card also auto-closes, but the confetti + preview
433
+ invite lingering — the user needs a way out on their own terms.
434
+ inset-inline-end so it lands top-left in the RTL card, top-right in LTR. */
435
+ .close {
436
+ position: absolute;
437
+ top: 12px;
438
+ inset-inline-end: 12px;
439
+ width: 32px;
440
+ height: 32px;
441
+ display: flex;
442
+ align-items: center;
443
+ justify-content: center;
444
+ padding: 0;
445
+ border: none;
446
+ border-radius: 50%;
447
+ background: transparent;
448
+ color: #a7abb5;
449
+ cursor: pointer;
450
+ transition: background 0.15s ease, color 0.15s ease;
451
+ }
452
+ .close:hover {
453
+ background: #f1f2f6;
454
+ color: #1a1a2e;
455
+ }
456
+ .close svg {
457
+ width: 16px;
458
+ height: 16px;
459
+ }
418
460
  .check {
419
461
  width: 68px;
420
462
  height: 68px;
@@ -582,21 +624,21 @@
582
624
  width: 15px;
583
625
  height: 15px;
584
626
  }
585
- `,u.properties={message:{type:String},sub:{type:String},url:{type:String},seoTitle:{type:String},seoDescription:{type:String},copied:{type:Boolean}},customElements.define("cdtr-publish-success",u);const f="creaditor:publish",g="creaditor:publish-error";class b extends o.WF{constructor(){super(),this.channel="",this.isLoading=!1,this.isLocked=!1,this.lockTimer=null}connectedCallback(){super.connectedCallback(),this.onNextStep||(this.onNextStep=s.M.get("config","onNextStep")),this.channel||(this.channel=s.M.get("config","channel")||"")}disconnectedCallback(){super.disconnectedCallback(),this.clearTimers()}clearTimers(){this.lockTimer&&(clearTimeout(this.lockTimer),this.lockTimer=null)}async handleClick(){if(this.isLocked||this.isLoading)return;const e=!!s.M.get("config","access"),t="web"===this.channel,i=e&&t;let o=null;if(!t||(o=await p.open(),o)){this.isLoading=!0,this.isLocked=!0,this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{if(t){const e=this.showBuildingLoader();try{i&&o&&(await(0,n.YE)({seo:o}),await(0,n.bK)({})),"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2,seo:o??void 0})}finally{e()}return this.emitPublished(i,o),void this.celebratePublish(o)}"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2}),this.emitPublished(i,o)}catch(e){console.error("Error in publish/onNextStep:",e),this.emitPublishError(i,o,e),this.snackbar(s.M.get("lang","publishError")||"Publish failed")}finally{this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}}snackbar(e){const t=s.M.get("commands");t?.snackbar?.(e)}showBuildingLoader(){const e=(0,h.A)();document.body.appendChild(e);let t=!1;return()=>{t||(t=!0,e.style.transition="opacity 300ms ease",e.style.opacity="0",e.style.pointerEvents="none",setTimeout(()=>e.remove(),320))}}siteUrl(){const e=s.M.get("app","domains"),t=e?.[0]?.name;if(t)return/^https?:\/\//.test(t)?t:`https://${t}`}emitPublished(e,t){const i={channel:this.channel,selfPublish:e,seo:t??void 0,url:this.siteUrl(),toHTML:r.FE,toJSON:r.U2};window.dispatchEvent(new CustomEvent(f,{detail:i}))}emitPublishError(e,t,i){const o={channel:this.channel,selfPublish:e,seo:t??void 0,error:i};window.dispatchEvent(new CustomEvent(g,{detail:o}))}celebratePublish(e){const t=document.createElement("cdtr-publish-success");e&&(t.seoTitle=e.title,t.seoDescription=e.description);const i=this.siteUrl();i&&(t.url=i),document.body.appendChild(t)}render(){const e=!!s.M.get("config","access");if(!(this.onNextStep||"web"===this.channel&&e))return null;const t="web"===this.channel?"publish":"next";return o.qy`
627
+ `,p.properties={message:{type:String},sub:{type:String},url:{type:String},seoTitle:{type:String},seoDescription:{type:String},copied:{type:Boolean}},customElements.define("cdtr-publish-success",p);const u="creaditor:publish",f="creaditor:publish-error";class g extends s.WF{constructor(){super(),this.channel="",this.isLoading=!1,this.isLocked=!1,this.lockTimer=null}connectedCallback(){super.connectedCallback(),this.onNextStep||(this.onNextStep=o.M.get("config","onNextStep")),this.onPublish||(this.onPublish=o.M.get("config","onPublish")),this.channel||(this.channel=o.M.get("config","channel")||"")}disconnectedCallback(){super.disconnectedCallback(),this.clearTimers()}clearTimers(){this.lockTimer&&(clearTimeout(this.lockTimer),this.lockTimer=null)}async handleClick(){if(this.isLocked||this.isLoading)return;const e=!!o.M.get("config","access"),t="web"===this.channel,i=e&&t;let s=null;if(t&&(s=await h.open(),!s))return;const a=s?s.seo:null;this.isLoading=!0,this.isLocked=!0,this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{if(t&&s){let e=!1;try{i&&a&&(await(0,n.YE)({seo:a}),await(0,n.bK)({})),"function"==typeof this.onPublish?e=await this.runHostPublish(this.onPublish,a,i,s):"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2,seo:a??void 0})}finally{s.done()}return void(e||(this.emitPublished(i,a),this.celebratePublish(a)))}"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2}),this.emitPublished(i,a)}catch(e){console.error("Error in publish/onNextStep:",e),this.emitPublishError(i,a,e),this.snackbar(o.M.get("lang","publishError")||"Publish failed")}finally{this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}runHostPublish(e,t,i,s){return new Promise(a=>{let l=!1;const c=(e,r,n)=>{l||(l=!0,clearTimeout(d),s.done(),e?(this.celebratePublish(t),this.emitPublished(i,t)):(this.snackbar(n||o.M.get("lang","publishError")||"Publish failed"),this.emitPublishError(i,t,r)),a(!0))},d=setTimeout(()=>{l||(console.warn("config.onPublish never signalled completion — finishing the publish without it. Call success() or error() (or return a promise) so the modal can come down."),l=!0,s.done(),a(!1))},6e4),h={title:t.title,description:t.description,keywords:t.keywords},p={loading:function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s.busy(e)},success:()=>c(!0),confetti:()=>c(!0),error:e=>c(!1,new Error(e||"host publish failed"),e),commands:{patchSite:e=>(0,n.YE)(e??{}),publishSite:e=>(0,n.bK)(e??{}),toHTML:r.FE,toJSON:r.U2}};let u;try{u=e(h,p)}catch(e){return console.error("Error in config.onPublish:",e),void c(!1,e)}u&&"function"==typeof u.then&&Promise.resolve(u).then(()=>c(!0),e=>{console.error("Error in config.onPublish:",e),c(!1,e)})})}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}siteUrl(){const e=o.M.get("app","domains"),t=e?.[0]?.name;if(t)return/^https?:\/\//.test(t)?t:`https://${t}`}emitPublished(e,t){const i={channel:this.channel,selfPublish:e,seo:t??void 0,url:this.siteUrl(),toHTML:r.FE,toJSON:r.U2};window.dispatchEvent(new CustomEvent(u,{detail:i}))}emitPublishError(e,t,i){const s={channel:this.channel,selfPublish:e,seo:t??void 0,error:i};window.dispatchEvent(new CustomEvent(f,{detail:s}))}celebratePublish(e){const t=document.createElement("cdtr-publish-success");e&&(t.seoTitle=e.title,t.seoDescription=e.description);const i=this.siteUrl();i&&(t.url=i),document.body.appendChild(t)}render(){const e=!!o.M.get("config","access");if(!(this.onNextStep||"function"==typeof this.onPublish||"web"===this.channel&&e))return null;const t="web"===this.channel?"publish":"next";return s.qy`
586
628
  <paper-button
587
629
  @click=${this.handleClick}
588
630
  class="next-button"
589
631
  ?disabled=${this.isLocked}
590
632
  >
591
- ${this.isLoading?o.qy`
633
+ ${this.isLoading?s.qy`
592
634
  <div class="loading-spinner"></div>
593
- `:o.qy`
635
+ `:s.qy`
594
636
  <div class="button-content ${this.isLoading?"loading":""}">
595
637
  <lang-text text=${t}></lang-text>
596
638
  </div>
597
639
  `}
598
640
  </paper-button>
599
- `}}b.styles=o.AH`
641
+ `}}g.styles=s.AH`
600
642
  :host {
601
643
  display: block;
602
644
  }
@@ -648,4 +690,4 @@
648
690
  }
649
691
 
650
692
 
651
- `,b.properties={onNextStep:{type:Function},channel:{type:String},isLoading:{type:Boolean},isLocked:{type:Boolean},lockTimer:{type:Number}},customElements.define("cdtr-next-button",b)}}]);
693
+ `,g.properties={onNextStep:{type:Function},onPublish:{type:Function},channel:{type:String},isLoading:{type:Boolean},isLocked:{type:Boolean},lockTimer:{type:Number}},customElements.define("cdtr-next-button",g)}}]);
Binary file
@@ -45,4 +45,4 @@
45
45
  </button>
46
46
  </div>
47
47
  </cdtr-editor-container>
48
- `},{type:"heading",level:6,text:"colors",active:()=>"style"===a.text},{type:"colorSwatchGroup",active:()=>"style"===a.text,columns:2,items:[{title:"button_background",allowGradient:!0,value:t.props.style.background||"#000000",onChange:e=>{const r=e.target.value;if(!r.includes("gradient(")){const e=(0,o.w)(t.props.style.color,r);n.execCommand("style",{color:e})}n.execCommand("style",{background:r,backgroundColor:null})}},{title:"font_color",value:t.props.style.color||"#ffffff",onChange:e=>{const t=e.target.value;n.execCommand("style",{color:t})}}]},{type:"heading",level:6,text:"typography",active:()=>"style"===a.text},{type:"typography",active:()=>"style"===a.text,bold:700===t.props.style.fontWeight,italic:"italic"===t.props.style.fontStyle,underline:"underline"===t.props.style.textDecoration,onChange:e=>{switch(e){case"bold":const e=700===t.props.style.fontWeight?400:700;n.execCommand("style",{fontWeight:e});break;case"italic":const o="italic"===t.props.style.fontStyle?"normal":"italic";n.execCommand("style",{fontStyle:o});break;case"underline":const r="underline"===t.props.style.textDecoration?"none":"underline";n.execCommand("style",{textDecoration:r})}}},{type:"fontFamily",active:()=>"style"===a.text,value:t.props.style.fontFamily,weight:"web"===r.M.get("config","channel"),weightValue:t.props.style.fontWeight,onChange:e=>{const t=e.target.value;n.execCommand("style",{fontFamily:t})},onWeightChange:e=>{n.execCommand("style",{fontWeight:e.detail.value})}},{type:"slider",title:"fontSize",step:1,min:8,max:50,active:()=>"style"===a.text,value:parseInt(t.props.style.fontSize)||14,onInput:e=>{const t=e.target.value;n.execCommand("style",{fontSize:t+"px"})}},{type:"heading",level:6,text:"dimensions",active:()=>"style"===a.text},{type:"slider",title:"width",min:10,max:500,active:()=>"style"===a.text,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px",minWidth:null})}},{type:"slider",title:"height",min:20,max:300,active:()=>"style"===a.text,value:parseInt(t.props.style.height)||(()=>{const e=document.querySelector(`[data-id="${t.id}"]`);return e&&Math.round(e.getBoundingClientRect().height)||40})(),sizes:[{name:r.M.get("lang","auto")||"auto",value:"auto"}],onInput:e=>{const t=e.target.value;n.execCommand("style",{height:"auto"===t?"auto":parseInt(t)+"px"})}},{type:"heading",level:6,text:"border_design",active:()=>"style"===a.text},{type:"slider",title:"radius",min:0,max:100,active:()=>"style"===a.text,value:parseInt(t.props.style.borderRadius),onInput:e=>{const t=e.target.value;n.execCommand("style",{borderRadius:t+"px"})}},{type:"borderpicker",title:"border",active:()=>"style"===a.text,value:t.props.style.border,onChange:e=>{const t=e.target.value;n.execCommand("style",{border:t})}},{type:"slider",title:"borderWidth",active:()=>"style"===a.text,value:t.props.style.borderWidth,onInput:e=>{const t=e.target.value;n.execCommand("style",{borderWidth:t+"px"})}},{type:"colorpicker",title:"borderColor",active:()=>"style"===a.text,value:t.props.style.borderColor,onChange:e=>{const t=e.target.value;n.execCommand("style",{borderColor:t})}},{type:"heading",level:6,text:"shadow",active:()=>"style"===a.text},{type:"boxShadow",active:()=>"style"===a.text,value:t.props.style.boxShadow,onChange:e=>{n.execCommand("style",{boxShadow:e})}},{type:"heading",level:6,text:"link",active:()=>"interactions"===a.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===a.text,onChange:e=>{const t={link:e.target.value};n.execCommand("onClick",t)}},{type:"heading",level:6,text:"open_modal",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"info",text:c.length?"modal_pick_hint":"modal_none_hint",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"dropdown",title:"modal_block",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel"),value:u,selected:p,items:d,onChange:e=>{n.execCommand("modalBlockId",e.target.value)}},{type:"heading",level:6,text:"icons",active:()=>"style"===a.text},{type:"checkbox",title:"hasIcon",useIconsApi:!0,checked:!!t.props.hasIcon,active:()=>"style"===a.text,onChange:e=>{const t=e.target.checked;n.execCommand("hasIcon",t),n.execCommand("iconDirection","left")}},{type:"dropdown",active:()=>"style"===a.text&&!0===t.props.hasIcon,title:"iconDirection",value:t.props.iconDirection,onChange:e=>{const t=e.target.value;n.execCommand("iconDirection",t)},items:[{value:"left",label:"left"},{value:"right",label:"right"}]},{type:"slider",title:"size",min:10,max:100,active:()=>"style"===a.text&&!0===t.props.hasIcon,value:t.props.iconSize||16,onInput:e=>{const t=e.target.value;n.execCommand("iconSize",t)}},{type:"icons",active:()=>"style"===a.text&&!0===t.props.hasIcon,selectedIcon:t.props.iconUrl,onChange:e=>{const t=e.detail;n.execCommand("iconUrl",t.src)}},{type:"heading",level:6,text:"spacing",active:()=>"style"===a.text},{type:"spacingPicker",active:()=>"style"===a.text,hasLeft:!1,hasRight:!1,value:{top:parseInt(t.props.style.paddingTop)||0,bottom:parseInt(t.props.style.paddingBottom)||0,left:parseInt(t.props.style.paddingLeft)||0,right:parseInt(t.props.style.paddingRight)||0},onChange:e=>{e.target.value;const t=e.target.topValue,o=e.target.bottomValue,r=e.target.leftValue,l=e.target.rightValue;n.execCommand("style",{paddingTop:t+"px",paddingBottom:o+"px",paddingLeft:r+"px",paddingRight:l+"px",padding:null})}},...g]}}}},i=e=>{let{helpers:t,editor:n,getFocused:o}=e;return{set:(e,r,l)=>{switch(r){case"style":return e[r]=t.deepMerge(e[r],l),!0;case"text":return e.text=l,o()||n.chain().setContent(l).run(),!0;case"ripple":case"rippleColor":case"scaleOnHover":case"hasIcon":case"iconUrl":case"iconSize":case"iconDirection":case"modalBlockId":return e[r]=l,!0;case"onClick":if(l.link)return e[r]=l,!0}}}};var s=n(72591),c=n.n(s),d=n(88639),p=n.n(d),u=n(88128),g=n.n(u),m=n(30855),y=n.n(m),h=n(93051),x=n.n(h),b=n(49536),A={};A.setAttributes=y(),A.insert=g().bind(null,"head"),A.domAPI=p(),A.insertStyleElement=x();c()(b.A,A);const f=b.A&&b.A.locals?b.A.locals:void 0;var C=n(81318),v=n(1366);const w=C.bP.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,C.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var k=n(85194),E=n(28396);const B=C.YY.create({addKeyboardShortcuts:()=>({Enter:()=>!0})});const S=()=>{const e="button";return{name:e,create:t=>{const{createElement:n,compose:o,helpers:r}=t,{arrayToString:l,mergeDiff:s}=r;let c=!1;const d=document.createElement("div"),p=document.createElement("div"),{editor:u}=function(e){let{content:t,element:n}=e;return{element:n,editor:new C.KE({element:n,extensions:[v.A,w,E.A,k.Ay,B],content:t})}}({content:o.props.text,element:p});d.appendChild(p);return u.view.dom.setAttribute("dir","auto"),u.on("update",e=>{let{editor:t}=e;const n=t.getText();o.editor.store().updateComponent(o,"text",n)}),u.on("focus",e=>{let{event:t,editor:n}=e;c=!0}),u.on("blur",e=>{let{event:t,editor:n}=e;c=!1}),d.className=f.button,n({name:e,id:o.id,template:d,commands:{insertContent:e=>{u.commands.insertContent(e),u.chain().focus()}},defaultProps:{style:{height:"auto",width:"200px",padding:"10px",borderRadius:"5px",fontFamily:"Arial",fontSize:"16px"},text:"button"},render:()=>{try{o.props.style.display="",o.props.style.direction=""}catch(e){console.error(e)}s(d,{style:o.props.style});const e=o.props.hasIcon,t=o.props.iconUrl,n=o.props.iconDirection,r=o.props.iconSize,l="icon_in_button";let a=d.querySelector(`.${l}`)||document.createElement("img");e&&t?(a.className=l,a.src=t,a.style.width=(r||16)+"px",a.style.height=(r||16)+"px",a.style.marginRight="8px",a.style.marginLeft="8px","left"===n?d.insertBefore(a,d.firstChild):d.appendChild(a)):a.remove()},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>d,resizeAxis:"xy",handleBar:!0,validator:i({template:d,helpers:r,editor:u,getFocused:function(){return c}}),schema:o.schema,onSelect:e=>{d.classList.add(e)},onDeselect:e=>{d.classList.remove(e)},elementProps:o,destroy:()=>{u.destroy()},remove:()=>{d.remove()},createEditor:a})}}}},49536(e,t,n){n.d(t,{A:()=>i});var o=n(82001),r=n.n(o),l=n(40935),a=n.n(l)()(r());a.push([e.id,".BEr8unIfy4OEGYhlHclN {\n cursor: text !important;\n}\n.BEr8unIfy4OEGYhlHclN {\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.BEr8unIfy4OEGYhlHclN p {\n margin: 0;\n line-height: 1;\n}\n.cI3RTMAdk9qoZ8mu9Sm9 {\n width: 100%;\n}\n.VSumPf0Ui7b1pl8cMATP {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.Vo2Ewnq6ekWFdNMjxBIB {\n left: -8px;\n cursor: w-resize;\n}\n.WLZC84sb1rfaRnHCDyj8 {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.BEr8unIfy4OEGYhlHclN .VSumPf0Ui7b1pl8cMATP {\n display: none;\n}\n.BEr8unIfy4OEGYhlHclN.Qh20ei1Fa8QUbGinFFbw .VSumPf0Ui7b1pl8cMATP {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n","",{version:3,sources:["webpack://./../web-editors/button-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,uBAAuB;AAOzB;AARA;EAEE,eAAe;EACf,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,WAAW;AACb;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,UAAU;EACV,WAAW;EACX,gCAAgC;EAChC,mBAAmB;AACrB;AACA;EACE,UAAU;EACV,gBAAgB;AAClB;AACA;EACE,sBAAsB;EACtB,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;AACA;EACE,cAAc;AAChB;AACA;;;;;GAKG",sourcesContent:[".button {\n cursor: text !important;\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.button p {\n margin: 0;\n line-height: 1;\n}\n.contentEditable {\n width: 100%;\n}\n.margin {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.marginLeft {\n left: -8px;\n cursor: w-resize;\n}\n.marginRight {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.button .margin {\n display: none;\n}\n.button.selected .margin {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n"],sourceRoot:""}]),a.locals={button:"BEr8unIfy4OEGYhlHclN",contentEditable:"cI3RTMAdk9qoZ8mu9Sm9",margin:"VSumPf0Ui7b1pl8cMATP",marginLeft:"Vo2Ewnq6ekWFdNMjxBIB",marginRight:"WLZC84sb1rfaRnHCDyj8",selected:"Qh20ei1Fa8QUbGinFFbw"};const i=a}}]);
48
+ `},{type:"heading",level:6,text:"colors",active:()=>"style"===a.text},{type:"colorSwatchGroup",active:()=>"style"===a.text,columns:2,items:[{title:"button_background",allowGradient:!0,value:t.props.style.background||"#000000",onChange:e=>{const r=e.target.value;if(!r.includes("gradient(")){const e=(0,o.w)(t.props.style.color,r);n.execCommand("style",{color:e})}n.execCommand("style",{background:r,backgroundColor:null})}},{title:"font_color",value:t.props.style.color||"#ffffff",onChange:e=>{const t=e.target.value;n.execCommand("style",{color:t})}}]},{type:"heading",level:6,text:"typography",active:()=>"style"===a.text},{type:"typography",active:()=>"style"===a.text,bold:700===t.props.style.fontWeight,italic:"italic"===t.props.style.fontStyle,underline:"underline"===t.props.style.textDecoration,onChange:e=>{switch(e){case"bold":const e=700===t.props.style.fontWeight?400:700;n.execCommand("style",{fontWeight:e});break;case"italic":const o="italic"===t.props.style.fontStyle?"normal":"italic";n.execCommand("style",{fontStyle:o});break;case"underline":const r="underline"===t.props.style.textDecoration?"none":"underline";n.execCommand("style",{textDecoration:r})}}},{type:"fontFamily",active:()=>"style"===a.text,value:t.props.style.fontFamily,weight:"web"===r.M.get("config","channel"),weightValue:t.props.style.fontWeight,onChange:e=>{const t=e.target.value;n.execCommand("style",{fontFamily:t})},onWeightChange:e=>{n.execCommand("style",{fontWeight:e.detail.value})}},{type:"slider",title:"fontSize",step:1,min:8,max:50,active:()=>"style"===a.text,value:parseInt(t.props.style.fontSize)||14,onInput:e=>{const t=e.target.value;n.execCommand("style",{fontSize:t+"px"})}},{type:"heading",level:6,text:"dimensions",active:()=>"style"===a.text},{type:"slider",title:"width",min:10,max:500,active:()=>"style"===a.text,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px",minWidth:null})}},{type:"slider",title:"height",min:20,max:300,active:()=>"style"===a.text,value:parseInt(t.props.style.height)||(()=>{const e=document.querySelector(`[data-id="${t.id}"]`);return e&&Math.round(e.getBoundingClientRect().height)||40})(),sizes:[{name:r.M.get("lang","auto")||"auto",value:"auto"}],onInput:e=>{const t=e.target.value;n.execCommand("style",{height:"auto"===t?"auto":parseInt(t)+"px"})}},{type:"heading",level:6,text:"border_design",active:()=>"style"===a.text},{type:"slider",title:"radius",min:0,max:100,active:()=>"style"===a.text,value:parseInt(t.props.style.borderRadius),onInput:e=>{const t=e.target.value;n.execCommand("style",{borderRadius:t+"px"})}},{type:"borderpicker",title:"border",active:()=>"style"===a.text,value:t.props.style.border,onChange:e=>{const t=e.target.value;n.execCommand("style",{border:t})}},{type:"slider",title:"borderWidth",active:()=>"style"===a.text,value:t.props.style.borderWidth,onInput:e=>{const t=e.target.value;n.execCommand("style",{borderWidth:t+"px"})}},{type:"colorpicker",title:"borderColor",active:()=>"style"===a.text,value:t.props.style.borderColor,onChange:e=>{const t=e.target.value;n.execCommand("style",{borderColor:t})}},{type:"heading",level:6,text:"shadow",active:()=>"style"===a.text},{type:"boxShadow",active:()=>"style"===a.text,value:t.props.style.boxShadow,onChange:e=>{n.execCommand("style",{boxShadow:e})}},{type:"heading",level:6,text:"link",active:()=>"interactions"===a.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===a.text,onChange:e=>{const t={link:e.target.value};n.execCommand("onClick",t)}},{type:"heading",level:6,text:"open_modal",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"info",text:c.length?"modal_pick_hint":"modal_none_hint",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"dropdown",title:"modal_block",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel"),value:u,selected:p,items:d,onChange:e=>{n.execCommand("modalBlockId",e.target.value)}},{type:"heading",level:6,text:"icons",active:()=>"style"===a.text},{type:"checkbox",title:"hasIcon",useIconsApi:!0,checked:!!t.props.hasIcon,active:()=>"style"===a.text,onChange:e=>{const t=e.target.checked;n.execCommand("hasIcon",t),n.execCommand("iconDirection","left")}},{type:"dropdown",active:()=>"style"===a.text&&!0===t.props.hasIcon,title:"iconDirection",value:t.props.iconDirection,onChange:e=>{const t=e.target.value;n.execCommand("iconDirection",t)},items:[{value:"left",label:"left"},{value:"right",label:"right"}]},{type:"slider",title:"size",min:10,max:100,active:()=>"style"===a.text&&!0===t.props.hasIcon,value:t.props.iconSize||16,onInput:e=>{const t=e.target.value;n.execCommand("iconSize",t)}},{type:"icons",active:()=>"style"===a.text&&!0===t.props.hasIcon,selectedIcon:t.props.iconUrl,onChange:e=>{const t=e.detail;n.execCommand("iconUrl",t.src)}},{type:"heading",level:6,text:"spacing",active:()=>"style"===a.text},{type:"spacingPicker",active:()=>"style"===a.text,hasLeft:!1,hasRight:!1,value:{top:parseInt(t.props.style.paddingTop)||0,bottom:parseInt(t.props.style.paddingBottom)||0,left:parseInt(t.props.style.paddingLeft)||0,right:parseInt(t.props.style.paddingRight)||0},onChange:e=>{e.target.value;const t=e.target.topValue,o=e.target.bottomValue,r=e.target.leftValue,l=e.target.rightValue;n.execCommand("style",{paddingTop:t+"px",paddingBottom:o+"px",paddingLeft:r+"px",paddingRight:l+"px",padding:null})}},...g]}}}},i=e=>{let{helpers:t,editor:n,getFocused:o}=e;return{set:(e,r,l)=>{switch(r){case"style":return e[r]=t.deepMerge(e[r],l),!0;case"text":return e.text=l,o()||n.chain().setContent(l).run(),!0;case"ripple":case"rippleColor":case"scaleOnHover":case"hasIcon":case"iconUrl":case"iconSize":case"iconDirection":case"modalBlockId":return e[r]=l,!0;case"onClick":if(l.link)return e[r]=l,!0}}}};var s=n(72591),c=n.n(s),d=n(88639),p=n.n(d),u=n(88128),g=n.n(u),m=n(30855),y=n.n(m),h=n(93051),x=n.n(h),b=n(49536),A={};A.setAttributes=y(),A.insert=g().bind(null,"head"),A.domAPI=p(),A.insertStyleElement=x();c()(b.A,A);const f=b.A&&b.A.locals?b.A.locals:void 0;var C=n(81318),v=n(1366);const w=C.bP.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,C.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var k=n(85194),E=n(28396);const B=C.YY.create({addKeyboardShortcuts:()=>({Enter:()=>!0})});const S=()=>{const e="button";return{name:e,create:t=>{const{createElement:n,compose:o,helpers:r}=t,{arrayToString:l,mergeDiff:s}=r;let c=!1;const d=document.createElement("div"),p=document.createElement("div"),{editor:u}=function(e){let{content:t,element:n}=e;return{element:n,editor:new C.KE({element:n,extensions:[v.A,w,E.A,k.Ay,B],content:t})}}({content:o.props.text,element:p});d.appendChild(p);u.view.dom.setAttribute("dir","auto");const g=()=>{let e="";try{e=u.getText()||""}catch(t){e=""}d.setAttribute("dir",function(e){if(!e)return null;for(const t of String(e)){if(/[\u0590-\u05FF\u0600-\u07BF\u0860-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(t))return"rtl";if(/\p{L}/u.test(t))return"ltr"}return null}(e)||"ltr")};return g(),u.on("update",e=>{let{editor:t}=e;const n=t.getText();g(),o.editor.store().updateComponent(o,"text",n)}),u.on("focus",e=>{let{event:t,editor:n}=e;c=!0}),u.on("blur",e=>{let{event:t,editor:n}=e;c=!1}),d.className=f.button,n({name:e,id:o.id,template:d,commands:{insertContent:e=>{u.commands.insertContent(e),u.chain().focus()}},defaultProps:{style:{height:"auto",width:"200px",padding:"10px",borderRadius:"5px",fontFamily:"Arial",fontSize:"16px"},text:"button"},render:()=>{try{o.props.style.display="",o.props.style.direction=""}catch(e){console.error(e)}s(d,{style:o.props.style});const e=o.props.hasIcon,t=o.props.iconUrl,n=o.props.iconDirection,r=o.props.iconSize,l="icon_in_button";g();let a=d.querySelector(`.${l}`)||document.createElement("img");e&&t?(a.className=l,a.src=t,a.style.width=(r||16)+"px",a.style.height=(r||16)+"px",a.style.marginRight="8px",a.style.marginLeft="8px","right"===n?d.appendChild(a):d.insertBefore(a,d.firstChild)):a.remove()},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>d,resizeAxis:"xy",handleBar:!0,validator:i({template:d,helpers:r,editor:u,getFocused:function(){return c}}),schema:o.schema,onSelect:e=>{d.classList.add(e)},onDeselect:e=>{d.classList.remove(e)},elementProps:o,destroy:()=>{u.destroy()},remove:()=>{d.remove()},createEditor:a})}}}},49536(e,t,n){n.d(t,{A:()=>i});var o=n(82001),r=n.n(o),l=n(40935),a=n.n(l)()(r());a.push([e.id,".BEr8unIfy4OEGYhlHclN {\n cursor: text !important;\n}\n.BEr8unIfy4OEGYhlHclN {\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.BEr8unIfy4OEGYhlHclN p {\n margin: 0;\n line-height: 1;\n}\n.cI3RTMAdk9qoZ8mu9Sm9 {\n width: 100%;\n}\n.VSumPf0Ui7b1pl8cMATP {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.Vo2Ewnq6ekWFdNMjxBIB {\n left: -8px;\n cursor: w-resize;\n}\n.WLZC84sb1rfaRnHCDyj8 {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.BEr8unIfy4OEGYhlHclN .VSumPf0Ui7b1pl8cMATP {\n display: none;\n}\n.BEr8unIfy4OEGYhlHclN.Qh20ei1Fa8QUbGinFFbw .VSumPf0Ui7b1pl8cMATP {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n","",{version:3,sources:["webpack://./../web-editors/button-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,uBAAuB;AAOzB;AARA;EAEE,eAAe;EACf,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,WAAW;AACb;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,UAAU;EACV,WAAW;EACX,gCAAgC;EAChC,mBAAmB;AACrB;AACA;EACE,UAAU;EACV,gBAAgB;AAClB;AACA;EACE,sBAAsB;EACtB,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;AACA;EACE,cAAc;AAChB;AACA;;;;;GAKG",sourcesContent:[".button {\n cursor: text !important;\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.button p {\n margin: 0;\n line-height: 1;\n}\n.contentEditable {\n width: 100%;\n}\n.margin {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.marginLeft {\n left: -8px;\n cursor: w-resize;\n}\n.marginRight {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.button .margin {\n display: none;\n}\n.button.selected .margin {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n"],sourceRoot:""}]),a.locals={button:"BEr8unIfy4OEGYhlHclN",contentEditable:"cI3RTMAdk9qoZ8mu9Sm9",margin:"VSumPf0Ui7b1pl8cMATP",marginLeft:"Vo2Ewnq6ekWFdNMjxBIB",marginRight:"WLZC84sb1rfaRnHCDyj8",selected:"Qh20ei1Fa8QUbGinFFbw"};const i=a}}]);
Binary file
@@ -0,0 +1 @@
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[823],{30823(e,t,n){n.d(t,{default:()=>B});var a=n(61919),i=n(79795),o=n(29180);const l=[{value:"dot",label:"ask_ai_variant_dot"},{value:"pill",label:"ask_ai_variant_pill"},{value:"plain",label:"ask_ai_variant_plain"}],r=e=>{const{component:t,commands:n}=e;return{select:e=>{let{changeTab:t,tab:n}=e;n.text||t("content")},tabs:e=>{const t=[{text:"content",selected:!0},{text:"engines"},{text:"style"},{text:"settings"}];return e?(t.forEach(t=>t.selected=t.text===e),t):t},layout:e=>{let{tab:r}=e;const s=()=>"content"===r.text,p=()=>"engines"===r.text,c=()=>"style"===r.text,d=t.props.prompt||"",A=t.props.variant||"dot",m=(0,o.x8)(t.props);var u,g;return[{type:"info",active:s,text:"ask_ai_external_notice"},{type:"heading",level:6,text:"ask_ai_prompt",active:s},{type:"info",active:s,text:"ask_ai_placeholders_hint"},{type:"input",title:"ask_ai_prompt",multiline:!0,row:16,active:s,value:d,onDebounce:e=>{n.execCommand("prompt",e.target.value)}},{type:"info",active:()=>s()&&(0,o.Jq)(d,m).length>o.Ep,text:"ask_ai_prompt_too_long"},{type:"heading",level:6,text:"ask_ai_engines",active:p},...i.ug.map(e=>({type:"checkbox",title:e.label,active:p,checked:(t.props.engines||[]).includes(e.key),onChange:a=>((e,a)=>{const o=t.props.engines||[],l=i.ug.map(e=>e.key).filter(t=>t===e?a:o.includes(t));l.length&&n.execCommand("engines",l)})(e.key,!!a.target.checked)})),{type:"dropdown",title:"ask_ai_variant",active:c,value:l.find(e=>e.value===A)?.label,selected:A,items:l,onChange:e=>n.execCommand("variant",e.target.value)},{type:"input",title:"ask_ai_leading_text",active:c,value:t.props.leadingText||"",onDebounce:e=>n.execCommand("leadingText",e.target.value)},{type:"slider",title:"size",min:16,max:96,active:c,value:parseInt(t.props.iconSize,10)||34,onInput:e=>n.execCommand("iconSize",e.target.value)},{type:"slider",title:"spacing",min:0,max:60,active:c,value:parseFloat(t.props.style?.gap)||0,onInput:e=>n.execCommand("style",{gap:e.target.value+"px"})},{type:"justifyContent",active:c,value:t.props.style?.justifyContent||"flex-start",onChange:e=>n.execCommand("style",{justifyContent:e.target.value})},{type:"divider",active:c},{type:"checkbox",title:"ask_ai_brand_colors",active:c,checked:!t.props.iconColor,onChange:e=>n.execCommand("iconColor",e.target.checked?"":"000000")},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>c()&&!!t.props.iconColor,value:(u=t.props.iconColor,g="#000000",u?u.startsWith("#")?u:"#"+u:g),onChange:e=>{const t=(0,a.A)(e.target.value).toHex();n.execCommand("iconColor",t)}},{type:"colorpicker",title:"backgroundColor",active:()=>c()&&"plain"!==t.props.variant,value:t.props.bgColor||"#f2f2f2",onChange:e=>n.execCommand("bgColor",e.target.value)},{type:"colorpicker",title:"color",active:()=>c()&&("pill"===t.props.variant||!!t.props.leadingText),value:t.props.textColor||"#000000",onChange:e=>n.execCommand("textColor",e.target.value)}]}}},s=e=>{let{helpers:t}=e;return{set:(e,n,a)=>{switch(n){case"style":return e[n]=t.deepMerge(e[n],a),!0;case"engines":return!!Array.isArray(a)&&(e[n]=a.filter(e=>"string"==typeof e),!0);case"items":return!!Array.isArray(a)&&(e[n]=a,!0);case"iconSize":return e[n]=Math.min(128,Math.max(12,parseInt(a,10)||34)),!0;case"variant":return!!["dot","pill","plain"].includes(a)&&(e[n]=a,!0);case"prompt":case"leadingText":case"itemAriaLabel":case"iconColor":case"bgColor":case"textColor":case"pageUrl":case"pageTitle":case"pageDescription":case"businessName":return e[n]=a,!0}return!1}}};var p=n(72591),c=n.n(p),d=n(88639),A=n.n(d),m=n(88128),u=n.n(m),g=n(30855),C=n.n(g),h=n(93051),x=n.n(h),v=n(49606),y={};y.setAttributes=C(),y.insert=u().bind(null,"head"),y.domAPI=A(),y.insertStyleElement=x();c()(v.A,y);const f=v.A&&v.A.locals?v.A.locals:void 0;var E=n(40856);const b="ask-ai",B=()=>({name:b,create:e=>{let{createElement:t,compose:n,helpers:a}=e;const l=document.createElement("div"),p=document.createElement("div");p.classList.add(f.root),l.appendChild(p);return t({name:b,id:n.id,template:l,defaultProps:{style:{gap:"10px",justifyContent:"flex-start"},variant:"dot",engines:i.up,prompt:(0,o.Mc)(),iconSize:34,iconColor:"",bgColor:"#f2f2f2",textColor:"",leadingText:"",itemAriaLabel:"Ask {{engine}} about this page",items:[]},draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=n.props,t=(0,E.z)(e);for((0,E.S)(t,e.items)||setTimeout(()=>{n.editor?.updateComponent?.(n.id,"items",t)},0);p.firstChild;)p.removeChild(p.firstChild);if(a.mergeDiff(p,{style:e.style}),e.leadingText){const t=document.createElement("span");t.classList.add(f.leading),t.textContent=e.leadingText,e.textColor&&(t.style.color=e.textColor),p.appendChild(t)}t.forEach(t=>p.appendChild(((e,t)=>{const n=document.createElement("a");n.classList.add(f.item),"dot"===t.variant&&n.classList.add(f.dot),"pill"===t.variant&&n.classList.add(f.pill),n.setAttribute("data-id",e.id),n.href=e.href,n.target="_blank",n.rel="noopener noreferrer",n.setAttribute("aria-label",(t.itemAriaLabel||"Ask {{engine}} about this page").replace("{{engine}}",e.label)),n.title=e.label,"plain"!==t.variant&&t.bgColor&&(n.style.backgroundColor=t.bgColor),t.textColor&&(n.style.color=t.textColor);const a=document.createElement("img");a.src=e.src,a.alt="",a.setAttribute("aria-hidden","true");const i=(parseInt(t.iconSize,10)||34)+"px";if(a.style.width=i,a.style.height=i,n.appendChild(a),"pill"===t.variant){const t=document.createElement("span");t.classList.add(f.label),t.textContent=e.label,n.appendChild(t)}return n.addEventListener("click",e=>e.preventDefault()),n})(t,e)))},handleBar:!0,validator:s({helpers:a}),schema:n.schema,onSelect:e=>{l.classList.add(e)},onDeselect:e=>{l.classList.remove(e)},elementProps:n,remove:()=>{l.remove()},createEditor:r})}})},49606(e,t,n){n.d(t,{A:()=>r});var a=n(82001),i=n.n(a),o=n(40935),l=n.n(o)()(i());l.push([e.id,'.icTm1UFc5X5A8tag7W_Q {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 10px;\n}\n\n.WiVzPdjkN11lPSsmSGBB {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n text-decoration: none;\n line-height: 0;\n transition: transform 0.15s ease, opacity 0.15s ease;\n}\n\n.WiVzPdjkN11lPSsmSGBB:hover {\n transform: translateY(-1px);\n opacity: 0.85;\n}\n\n/* "dot" variant — the circular chip the pattern is usually seen as. */\n._lQONL1oIiZTe42CyXuB {\n border-radius: 999px;\n padding: 8px;\n line-height: 0;\n}\n\n/* "pill" variant — icon plus the engine name. */\n.bTqTp8uamOPSh67_0QtJ {\n border-radius: 999px;\n padding: 6px 14px 6px 10px;\n line-height: 1;\n font-size: 14px;\n}\n\n.fY4pheZcfQxg8DP_HYgE {\n /* Inherits the block\'s font; only the icon is sized by iconSize. */\n white-space: nowrap;\n}\n\n.cnAwK9OBcEyRXbAuQ14D {\n white-space: nowrap;\n}\n\n.SCB1TtYJtUVEle7tVBiu {\n outline: 2px solid #1a73e8;\n outline-offset: 2px;\n}\n',"",{version:3,sources:["webpack://./../web-editors/ask-ai-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,SAAS;AACX;;AAEA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,uBAAuB;EACvB,QAAQ;EACR,qBAAqB;EACrB,cAAc;EACd,oDAAoD;AACtD;;AAEA;EACE,2BAA2B;EAC3B,aAAa;AACf;;AAEA,sEAAsE;AACtE;EACE,oBAAoB;EACpB,YAAY;EACZ,cAAc;AAChB;;AAEA,gDAAgD;AAChD;EACE,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EACd,eAAe;AACjB;;AAEA;EACE,mEAAmE;EACnE,mBAAmB;AACrB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,0BAA0B;EAC1B,mBAAmB;AACrB",sourcesContent:['.root {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 10px;\n}\n\n.item {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n text-decoration: none;\n line-height: 0;\n transition: transform 0.15s ease, opacity 0.15s ease;\n}\n\n.item:hover {\n transform: translateY(-1px);\n opacity: 0.85;\n}\n\n/* "dot" variant — the circular chip the pattern is usually seen as. */\n.dot {\n border-radius: 999px;\n padding: 8px;\n line-height: 0;\n}\n\n/* "pill" variant — icon plus the engine name. */\n.pill {\n border-radius: 999px;\n padding: 6px 14px 6px 10px;\n line-height: 1;\n font-size: 14px;\n}\n\n.label {\n /* Inherits the block\'s font; only the icon is sized by iconSize. */\n white-space: nowrap;\n}\n\n.leading {\n white-space: nowrap;\n}\n\n.selected {\n outline: 2px solid #1a73e8;\n outline-offset: 2px;\n}\n'],sourceRoot:""}]),l.locals={root:"icTm1UFc5X5A8tag7W_Q",item:"WiVzPdjkN11lPSsmSGBB",dot:"_lQONL1oIiZTe42CyXuB",pill:"bTqTp8uamOPSh67_0QtJ",label:"fY4pheZcfQxg8DP_HYgE",leading:"cnAwK9OBcEyRXbAuQ14D",selected:"SCB1TtYJtUVEle7tVBiu"};const r=l}}]);
Binary file