@creaditor/web-starterkit 1.0.61 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3601.creaditor.bundle.js +288 -0
- package/dist/3601.creaditor.bundle.js.gz +0 -0
- package/dist/3847.creaditor.bundle.js +114 -67
- package/dist/3847.creaditor.bundle.js.gz +0 -0
- package/dist/507.creaditor.bundle.js +334 -0
- package/dist/507.creaditor.bundle.js.gz +0 -0
- package/dist/{4819.creaditor.bundle.js → 6323.creaditor.bundle.js} +7 -7
- package/dist/6323.creaditor.bundle.js.gz +0 -0
- package/dist/8088.creaditor.bundle.js +141 -0
- package/dist/8088.creaditor.bundle.js.gz +0 -0
- package/dist/8299.creaditor.bundle.js +74 -42
- package/dist/8299.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +251 -85
- package/dist/creaditor.bundle.js.gz +0 -0
- package/dist/service-worker.js +1 -1
- package/dist/service-worker.js.gz +0 -0
- package/package.json +1 -1
- package/dist/2001.creaditor.bundle.js +0 -318
- package/dist/2001.creaditor.bundle.js.LICENSE.txt +0 -11
- package/dist/2001.creaditor.bundle.js.LICENSE.txt.gz +0 -0
- package/dist/2001.creaditor.bundle.js.gz +0 -0
- package/dist/2682.creaditor.bundle.js +0 -195
- package/dist/2682.creaditor.bundle.js.LICENSE.txt +0 -11
- package/dist/2682.creaditor.bundle.js.LICENSE.txt.gz +0 -0
- package/dist/2682.creaditor.bundle.js.gz +0 -0
- package/dist/4819.creaditor.bundle.js.gz +0 -0
- package/dist/5791.creaditor.bundle.js +0 -288
- package/dist/5791.creaditor.bundle.js.gz +0 -0
- package/dist/715.creaditor.bundle.js +0 -142
- package/dist/715.creaditor.bundle.js.LICENSE.txt +0 -11
- package/dist/715.creaditor.bundle.js.LICENSE.txt.gz +0 -0
- package/dist/715.creaditor.bundle.js.gz +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,3847],{70380(t,e,i){i.r(e),i.d(e,{default:()=>
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,3847],{70380(t,e,i){i.r(e),i.d(e,{default:()=>p});var s=i(59929),o=i(21421),r=i(91597);const n="֑-߿יִ-﷽ﹰ-ﻼ",a="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",l=new RegExp("^[^"+a+"]*["+n+"]"),c=new RegExp("^[^"+n+"]*["+a+"]");var h=i(86319);const d=(0,r.S)();class p extends s.WF{constructor(){super(),this.inputRef=(0,o._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=h.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===function(t){const e=String(t||"");return l.test(e)?"rtl":c.test(e)?"ltr":"neutral"}(t)?"right":"")));const e=this.multiline?s.qy` <textarea
|
|
2
2
|
rows=${this.row||4}
|
|
3
3
|
.disabled=${this.disabled}
|
|
4
4
|
dir="auto"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
${"text"===this.type&&this.maxLength?s.qy`<span class="counter"
|
|
50
50
|
>${this.value.length}/${this.maxLength}</span
|
|
51
51
|
> `:null}
|
|
52
|
-
</form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const i=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(i),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};d.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}
|
|
52
|
+
</form>`}firstUpdated(){this.autofocus&&setTimeout(()=>{this.inputRef.value&&this.inputRef.value.focus()},500),void 0===this.value&&(this.value="")}focus(){super.focus(),this.inputRef.value.focus()}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null)}setValue(t){if(this.selectionStart=this.inputRef.value.selectionStart,!this.inputRef.value)return;const e=this.inputRef.value;if("text"===this.type&&this.max&&e.value.length>this.max)return e.value=this.value,void this.inputRef.value.focus();this.value=e.value;const i=new UIEvent(t.type,{view:window,bubbles:!0,cancelable:!0});if(this.dispatchEvent(i),"input"===t.type){const t=()=>{const t=new UIEvent("debounce",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)};d.run(t,500)}}success(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3;this._successTimeout&&(clearTimeout(this._successTimeout),this._successTimeout=null),this.successActive=!0;const e=Number(t);!Number.isFinite(e)||e<=0||(this._successTimeout=setTimeout(()=>{this.successActive=!1,this._successTimeout=null},e))}patch(t){this.value=t}}p.styles=s.AH`
|
|
53
53
|
:host {
|
|
54
54
|
display: inline-block;
|
|
55
55
|
--cdtr-input-height: 30px;
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
box-shadow: 0 0 10px rgba(79, 192, 111, 0.2);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
`,
|
|
188
|
+
`,p.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",p)},73847(t,e,i){i.r(e),i.d(e,{LinkElement:()=>F});var s=i(59929),o=i(86319),r=i(88385);const n=s.AH`
|
|
189
189
|
:host {
|
|
190
190
|
--paper-radio-button-checked-color: var(--primary);
|
|
191
191
|
box-sizing: border-box;
|
|
@@ -290,8 +290,38 @@
|
|
|
290
290
|
.input-wrapper cdtr-input {
|
|
291
291
|
display: block;
|
|
292
292
|
}
|
|
293
|
+
.compact {
|
|
294
|
+
display: grid;
|
|
295
|
+
gap: 8px;
|
|
296
|
+
}
|
|
297
|
+
.compact-row {
|
|
298
|
+
display: grid;
|
|
299
|
+
gap: 8px;
|
|
300
|
+
}
|
|
301
|
+
.compact-row cdtr-row {
|
|
302
|
+
width: 100%;
|
|
303
|
+
}
|
|
304
|
+
.compact-tab {
|
|
305
|
+
display: flex;
|
|
306
|
+
align-items: center;
|
|
307
|
+
gap: 8px;
|
|
308
|
+
font-size: 12.5px;
|
|
309
|
+
color: var(--color-text-secondary, #555);
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
}
|
|
312
|
+
.compact-tab cdtr-checkbox {
|
|
313
|
+
flex: none;
|
|
314
|
+
}
|
|
315
|
+
/* the email/SMS extra fields are drawn 260px wide; in a tight panel they fill the space instead */
|
|
316
|
+
.compact cdtr-input {
|
|
317
|
+
width: 100% !important;
|
|
318
|
+
}
|
|
319
|
+
.compact .explain-title {
|
|
320
|
+
margin-top: 4px;
|
|
321
|
+
}
|
|
293
322
|
.explain-title {
|
|
294
|
-
|
|
323
|
+
display: block;
|
|
324
|
+
margin: 12px 0 6px;
|
|
295
325
|
}
|
|
296
326
|
paper-item {
|
|
297
327
|
text-align: var(--text-align-locale);
|
|
@@ -520,7 +550,7 @@
|
|
|
520
550
|
margin-top: 0.75rem;
|
|
521
551
|
padding-left: 1rem;
|
|
522
552
|
}
|
|
523
|
-
`;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",
|
|
553
|
+
`;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];var m=i(73813);function g(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",b="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 x=null,v=null;const w="cdtr:anchor-attached";function $(){let{onCreated:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k();const e=function(){const t=y();let e=1;for(;t.has(`${f}-${e}`);)e++;return`${f}-${e}`}(),i={id:b,name:f,group:"elements",body:{type:f,props:{name:e,color:"#6b7280"}}},s=document.createElement("div");return s.setAttribute("data-id",b),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,x=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(w,i),document.removeEventListener("mouseup",s,!0)}return window.addEventListener(w,i),document.addEventListener("mouseup",s,!0),o}(t)),s}function k(){x&&window.__dragoned_selected_element===x&&delete window.__dragoned_selected_element,x=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`
|
|
524
554
|
<div class="anchor-create">
|
|
525
555
|
<div
|
|
526
556
|
class="anchor-drag draggable-element-handle"
|
|
@@ -571,7 +601,7 @@
|
|
|
571
601
|
</cdtr-dropdown>
|
|
572
602
|
${A({onRequest:a,onChangeLink:r,onBlur:n})}
|
|
573
603
|
</cdtr-row>
|
|
574
|
-
`}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?
|
|
604
|
+
`}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?g("body",e):i||e.params.body,h="string"==typeof e?g("subject",e):o||e.params.subject;return s.qy`
|
|
575
605
|
<cdtr-row spacing="5">
|
|
576
606
|
<cdtr-title class="explain-title"
|
|
577
607
|
><lang-text text="add_catchy_subject"></lang-text
|
|
@@ -592,7 +622,7 @@
|
|
|
592
622
|
@change=${t=>{let{target:e}=t;n(e.value),r()}}
|
|
593
623
|
></cdtr-input>
|
|
594
624
|
</cdtr-row>
|
|
595
|
-
`}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?
|
|
625
|
+
`}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?g("body",e):e.params.body;return s.qy`
|
|
596
626
|
<cdtr-row spacing="5">
|
|
597
627
|
<cdtr-title class="explain-title"
|
|
598
628
|
><lang-text text="sms_body_if_needed"></lang-text
|
|
@@ -604,7 +634,7 @@
|
|
|
604
634
|
@change=${t=>{let{target:e}=t;r(e.value),o()}}
|
|
605
635
|
></cdtr-input>
|
|
606
636
|
</cdtr-row>
|
|
607
|
-
`}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?
|
|
637
|
+
`}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?g("text",e)||g("body",e):e.params&&(e.params.text||e.params.body)||"";return s.qy`
|
|
608
638
|
<cdtr-row spacing="5">
|
|
609
639
|
<cdtr-title class="explain-title"
|
|
610
640
|
><lang-text text="whatsapp_body_if_needed"></lang-text
|
|
@@ -616,14 +646,14 @@
|
|
|
616
646
|
@change=${t=>{let{target:e}=t;r(e.value),o()}}
|
|
617
647
|
></cdtr-input>
|
|
618
648
|
</cdtr-row>
|
|
619
|
-
`}(e);default:return""}}function S(t
|
|
649
|
+
`}(e);default:return""}}function S(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,coach:g=!0}=t,f=t=>{r&&r(t),n&&n()},b=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
|
|
620
650
|
<cdtr-row style="position:relative;" spacing="5">
|
|
621
651
|
<span style="display:none;" aria-hidden="true">${e}</span>
|
|
622
652
|
<cdtr-input
|
|
623
|
-
.couchOnEmpty=${
|
|
653
|
+
.couchOnEmpty=${g}
|
|
624
654
|
${i?(0,a.K)(i):""}
|
|
625
|
-
style="${
|
|
626
|
-
inputStyle="${
|
|
655
|
+
style="${u}"
|
|
656
|
+
inputStyle="${p}"
|
|
627
657
|
.autofocus=${o}
|
|
628
658
|
type="search"
|
|
629
659
|
width="${m}"
|
|
@@ -632,10 +662,44 @@
|
|
|
632
662
|
@change=${f}
|
|
633
663
|
@focus=${c}
|
|
634
664
|
@submit=${h||f}
|
|
635
|
-
.value="${
|
|
665
|
+
.value="${b}"
|
|
636
666
|
></cdtr-input>
|
|
637
667
|
</cdtr-row>
|
|
638
|
-
`}const M="automation:";function
|
|
668
|
+
`}function L(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);let 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))||g("phone",n.href||"")||n.url||"";try{a=decodeURIComponent(a)}catch(t){}const l=a.replace(/\D+/g,"");if(!l)return null;const c=s||n.params&&(n.params.text||n.params.body)||"",h=c?encodeURIComponent(c):"";let d=`https://wa.me/${l}`;h&&(d+=`?text=${h}`);const p=new r.A(d);return p.target=o||p.target||"_blank",{url:p,params:p.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 R(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 C(){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}const M="automation:";function U(t,e,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return s.qy`
|
|
669
|
+
<cdtr-dropdown @change=${t=>i(t.target.value)}>
|
|
670
|
+
<cdtr-dropdown-button
|
|
671
|
+
minWidth=${100}
|
|
672
|
+
class=" dropdown-button"
|
|
673
|
+
slot="trigger"
|
|
674
|
+
><lang-text
|
|
675
|
+
.text="${t.find(t=>t.type===e)?.text||"link"}"
|
|
676
|
+
></lang-text>
|
|
677
|
+
</cdtr-dropdown-button>
|
|
678
|
+
<div slot="content">
|
|
679
|
+
${t.map(t=>s.qy`<cdtr-dropdown-item
|
|
680
|
+
.focused=${t.type===e}
|
|
681
|
+
.selected=${t.type===e}
|
|
682
|
+
value="${t.type}"
|
|
683
|
+
><lang-text text="${t.text}"></lang-text>
|
|
684
|
+
</cdtr-dropdown-item>`)}
|
|
685
|
+
${o.length?s.qy`<cdtr-dropdown-item value="${M}" class="special-links-item">
|
|
686
|
+
<span class="special-links-label">
|
|
687
|
+
<span class="special-links-title">
|
|
688
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
689
|
+
<path d="M13 2 4.5 13.5H11L10 22l8.5-11.5H12L13 2Z" />
|
|
690
|
+
</svg>
|
|
691
|
+
<lang-text text="link_automations_title"></lang-text>
|
|
692
|
+
</span>
|
|
693
|
+
<span class="special-links-desc">
|
|
694
|
+
${o.map((t,e)=>s.qy`${e>0?" · ":""}<lang-text
|
|
695
|
+
text="${t.name}"
|
|
696
|
+
></lang-text>`)}
|
|
697
|
+
</span>
|
|
698
|
+
</span>
|
|
699
|
+
</cdtr-dropdown-item>`:null}
|
|
700
|
+
</div>
|
|
701
|
+
</cdtr-dropdown>
|
|
702
|
+
`}function q(){return s.qy`
|
|
639
703
|
<style>
|
|
640
704
|
.save-success-container {
|
|
641
705
|
margin-bottom: 1rem;
|
|
@@ -746,23 +810,23 @@
|
|
|
746
810
|
</span>
|
|
747
811
|
</div>
|
|
748
812
|
</div>
|
|
749
|
-
`}function
|
|
813
|
+
`}function B(){const t=o.M.get("config","editor","configure","editorProps","automations")||{},e=[];return t.addAndRemoveFromMailingList&&e.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list",description:"automation_desc_mailing_list",icon:"lists"}),t.unsubscribe&&e.push({id:"unsubscribe",name:"unsubscribe",description:"automation_desc_unsubscribe",icon:"unsubscribe"}),e}const I={lists:s.qy`<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
750
814
|
<path d="M4 6h11M4 12h11M4 18h7M18 15v6M15 18h6" />
|
|
751
815
|
</svg>`,unsubscribe:s.qy`<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
752
816
|
<rect x="3" y="5" width="18" height="14" rx="2" />
|
|
753
817
|
<path d="m3 7 9 6 9-6M15 16l4-4M19 16l-4-4" />
|
|
754
|
-
</svg>`},
|
|
818
|
+
</svg>`},j=s.qy`<svg class="crumb-sep" viewBox="0 0 24 24" aria-hidden="true">
|
|
755
819
|
<path d="m9 6 6 6-6 6" />
|
|
756
|
-
</svg>`;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
|
|
820
|
+
</svg>`;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 F extends(function(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=o.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[],this.automations=B()}onAutomationsClick(){if(this.automations=B(),this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if((0,m.r_)(t))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,s=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];s.push(`${e}=${encodeURIComponent(i)}`)}});let o=e.join("");return s.length>0&&(o+=`?${s.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new r.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}exitAutomations(){this.selectedAutomation&&this.onBackClick(),this.onBackClick()}renderAutomationsBreadcrumb(){const t=[{text:"link",onClick:()=>this.exitAutomations()}];return this.selectedAutomation?(t.push({text:"link_automations_title",onClick:()=>this.onBackClick()}),t.push({text:this.selectedAutomation.name})):t.push({text:"link_automations_title"}),s.qy`<nav class="automation-crumbs" aria-label="breadcrumb">
|
|
757
821
|
${t.map((t,e)=>s.qy`
|
|
758
|
-
${e>0?
|
|
822
|
+
${e>0?j:null}
|
|
759
823
|
${t.onClick?s.qy`<button type="button" class="crumb" @click=${t.onClick}>
|
|
760
824
|
<lang-text text="${t.text}"></lang-text>
|
|
761
825
|
</button>`:s.qy`<span class="crumb current" aria-current="page">
|
|
762
826
|
<lang-text text="${t.text}"></lang-text>
|
|
763
827
|
</span>`}
|
|
764
828
|
`)}
|
|
765
|
-
</nav>`}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=this.selectedAutomation.name||this.selectedAutomation.id;if("unsubscribe"===this.selectedAutomation.id)return(0,m.LX)(t);const e={};if(this.selectedMailingListsForAdd.length>0&&(e[h]=this.selectedMailingListsForAdd.join(",")),this.selectedMailingListsForRemove.length>0&&(e[d]=this.selectedMailingListsForRemove.join(",")),0===Object.keys(e).length)return null;if(this.baseUrl&&this.baseUrl.trim()){let t=this.baseUrl.trim();t.match(/^https?:\/\//i)||t.includes("://")||!t.includes(".")&&t.match(/^[a-zA-Z]+:/)||(t=`https://${t}`),e.url=t}return(0,m.LX)(t,e)}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=(0,m.IW)(t);if(!e)return void console.error("Invalid automation link format:",t);const i=e.name,s=e.params,o=s.url;let n;if(delete s.url,n=o?new r.A(o):new r.A("https://example.com"),n.params||(n.params={}),s[h]&&(n.params[h]=s[h]),s[d]&&(n.params[d]=s[d]),n.params[
|
|
829
|
+
</nav>`}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=this.selectedAutomation.name||this.selectedAutomation.id;if("unsubscribe"===this.selectedAutomation.id)return(0,m.LX)(t);const e={};if(this.selectedMailingListsForAdd.length>0&&(e[h]=this.selectedMailingListsForAdd.join(",")),this.selectedMailingListsForRemove.length>0&&(e[d]=this.selectedMailingListsForRemove.join(",")),0===Object.keys(e).length)return null;if(this.baseUrl&&this.baseUrl.trim()){let t=this.baseUrl.trim();t.match(/^https?:\/\//i)||t.includes("://")||!t.includes(".")&&t.match(/^[a-zA-Z]+:/)||(t=`https://${t}`),e.url=t}return(0,m.LX)(t,e)}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=(0,m.IW)(t);if(!e)return void console.error("Invalid automation link format:",t);const i=e.name,s=e.params,o=s.url;let n;if(delete s.url,n=o?new r.A(o):new r.A("https://example.com"),n.params||(n.params={}),s[h]&&(n.params[h]=s[h]),s[d]&&(n.params[d]=s[d]),n.params[p]=i,n.href=t,n.url=o||"",this.href=n,this.protocol=null,this.value=n,this.link=n,this.lastUrl=n,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=(0,m.IW)(String(t));if(e){const i=e.params,s=i.url,o=s?new r.A(s):new r.A("https://example.com");o.params||(o.params={}),i[h]&&(o.params[h]=i[h]),i[d]&&(o.params[d]=i[d]),o.params[p]=e.name,o.href=t,o.url=s||"",this.href=o,this.value=o,this.link=o,this.lastUrl=o,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,s=t.href||t;const o="string"==typeof s?(0,m.IW)(s):null;if(o?(i=!0,e=o.name):t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim()),!i)return;if(o){const t=o.params;if(t.url?this.baseUrl=t.url:this.baseUrl="",t[h]){const e="string"==typeof t[h]?t[h].split(",").filter(t=>t.trim()):Array.isArray(t[h])?t[h]:[];this.selectedMailingListsForAdd=e}if(t[d]){const e="string"==typeof t[d]?t[d].split(",").filter(t=>t.trim()):Array.isArray(t[d])?t[d]:[];this.selectedMailingListsForRemove=e}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForAdd=e}if(t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForRemove=e}}const r=String(e).trim(),n=(this.automations||[]).find(t=>t.name&&String(t.name).trim()===r||t.id&&String(t.id).trim()===r);if(this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0||"unsubscribe"===n?.id){this.showAutomations=!0;const t=n||this.automations?.[0];t&&(this.selectedAutomation=t,this.activeAutomationId=t.id)}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():s.qy`
|
|
766
830
|
<div class="automations-view">
|
|
767
831
|
${this.renderAutomationsBreadcrumb()}
|
|
768
832
|
<div class="automations-list">
|
|
@@ -772,14 +836,14 @@
|
|
|
772
836
|
class="automation-card ${e?"active":""}"
|
|
773
837
|
@click=${()=>this.onAutomationClick(t)}
|
|
774
838
|
>
|
|
775
|
-
<span class="automation-card-icon">${
|
|
839
|
+
<span class="automation-card-icon">${I[t.icon]}</span>
|
|
776
840
|
<span class="automation-card-text">
|
|
777
841
|
<span class="automation-card-title"><lang-text text="${t.name}"></lang-text></span>
|
|
778
842
|
${t.description?s.qy`<span class="automation-card-desc"
|
|
779
843
|
><lang-text whiteSpace="break-spaces" text="${t.description}"></lang-text
|
|
780
844
|
></span>`:null}
|
|
781
845
|
</span>
|
|
782
|
-
${
|
|
846
|
+
${j}
|
|
783
847
|
</button>
|
|
784
848
|
`})}
|
|
785
849
|
</div>
|
|
@@ -795,7 +859,7 @@
|
|
|
795
859
|
|
|
796
860
|
<div class="automation-content">
|
|
797
861
|
<!-- Success Message -->
|
|
798
|
-
${this.showSaveSuccess?
|
|
862
|
+
${this.showSaveSuccess?q():null}
|
|
799
863
|
|
|
800
864
|
<h6
|
|
801
865
|
class="explain-title"
|
|
@@ -839,7 +903,7 @@
|
|
|
839
903
|
|
|
840
904
|
<div class="automation-content">
|
|
841
905
|
<!-- Success Message -->
|
|
842
|
-
${this.showSaveSuccess?
|
|
906
|
+
${this.showSaveSuccess?q():null}
|
|
843
907
|
|
|
844
908
|
<!-- URL Input (Optional) -->
|
|
845
909
|
<div style="margin-bottom: 1.5rem;">
|
|
@@ -848,7 +912,7 @@
|
|
|
848
912
|
>
|
|
849
913
|
<lang-text text="url"></lang-text> (Optional)
|
|
850
914
|
</cdtr-title>
|
|
851
|
-
${
|
|
915
|
+
${S({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=R(e,null,this.baseUrl?new r.A(this.baseUrl):{});null===i?this.baseUrl=e:i.href?i.href instanceof r.A?this.baseUrl=i.href.href||e:"string"==typeof i.href?this.baseUrl=i.href:this.baseUrl=e:this.baseUrl=e,this.requestUpdate()},placeholder:"https://example.com",inputStyle:"height: 40px; padding: 0.5rem; border: 1px solid #e0e0e0; border-radius: 4px; width: 100%;",style:"width: 100%;"})}
|
|
852
916
|
</div>
|
|
853
917
|
|
|
854
918
|
<h6
|
|
@@ -1014,7 +1078,24 @@
|
|
|
1014
1078
|
</cdtr-row>
|
|
1015
1079
|
</div>
|
|
1016
1080
|
</div>
|
|
1017
|
-
`}}}(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=
|
|
1081
|
+
`}}}(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=L(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=R(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=C()}onChangeType(t){if(t===M)return void this.onAutomationsClick();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=""),this.compact&&e.clearParams)return this.href="",this.params={},void(this._urlInputRawValue="");if(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||""),e=(0,m.r_)(t),i=this.href&&this.href.params&&this.href.params[p];(e||i)&&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){const t=void 0===this._lastBodySyncHref;this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");(0,m.r_)(n)||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,t&&this.openAutomations&&B().length&&this.onAutomationsClick())}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=(0,m.r_)(h),g=i.params&&i.params[p];if(d)c=h;else if(g){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),b=[...this.options],y=b.findIndex(t=>"http:"===t.type);y>-1&&b.splice(y,1);const x=B(),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}},w=null!=c&&""!==c?String(c):"",$=this._urlInputRawValue!==w,k=void 0!==this._lastSyncedMyHref&&w!==this._lastSyncedMyHref,A=this.urlInputFocused&&this._urlInputRawValue&&w&&!k;$&&!A?(this._urlInputRawValue=w,this._lastSyncedMyHref=w):$||(this._lastSyncedMyHref=w);const L=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,R={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:L},C="rtl"===getComputedStyle(this).getPropertyValue("--direction-locale").trim();if(this.showAutomations)return s.qy` <div class="root ${C?"rtl":""}">${this.renderAutomationsView()}</div>`;if(this.compact){const t=!this.protocol||"https:"===this.protocol||"http:"===this.protocol;return s.qy`<div class="compact">
|
|
1082
|
+
<div class="compact-row">
|
|
1083
|
+
${U(b,this.protocol,this.onChangeType.bind(this),x)}
|
|
1084
|
+
${"anchor:"===this.protocol?null:S({...R,value:L,onChange:R.onChangeLink,placeholder:o.M.get("lang",f)||"",style:"width:100%;--cdtr-input-height:32px;",width:"100%",coach:!1})}
|
|
1085
|
+
</div>
|
|
1086
|
+
${_(this.protocol,v)}
|
|
1087
|
+
${t?s.qy`<div
|
|
1088
|
+
class="compact-tab"
|
|
1089
|
+
@click=${t=>{t.target.closest("cdtr-checkbox")||t.currentTarget.querySelector("cdtr-checkbox").toggle()}}
|
|
1090
|
+
>
|
|
1091
|
+
<cdtr-checkbox
|
|
1092
|
+
.controlled=${!1}
|
|
1093
|
+
.checked=${"_blank"===this.target}
|
|
1094
|
+
@change=${t=>this.onChangeTarget({target:{value:t.currentTarget.checked?"_blank":"_self"},stopPropagation(){}})}
|
|
1095
|
+
></cdtr-checkbox>
|
|
1096
|
+
<lang-text text="open_in_new_tab"></lang-text>
|
|
1097
|
+
</div>`:null}
|
|
1098
|
+
</div>`}return s.qy` <div class="root">
|
|
1018
1099
|
${z=this.label,z?s.qy`<cdtr-title
|
|
1019
1100
|
style="font-weight: 700;
|
|
1020
1101
|
font-size: 14.4px;
|
|
@@ -1024,43 +1105,9 @@
|
|
|
1024
1105
|
><cdtr-divider></cdtr-divider
|
|
1025
1106
|
></cdtr-title>`:null}
|
|
1026
1107
|
<cdtr-row alignItems="center" justify="space-between" spacing="10">
|
|
1027
|
-
${
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
minWidth=${100}
|
|
1031
|
-
class=" dropdown-button"
|
|
1032
|
-
slot="trigger"
|
|
1033
|
-
><lang-text
|
|
1034
|
-
.text="${t.find(t=>t.type===e)?.text||"link"}"
|
|
1035
|
-
></lang-text>
|
|
1036
|
-
</cdtr-dropdown-button>
|
|
1037
|
-
<div slot="content">
|
|
1038
|
-
${t.map(t=>s.qy`<cdtr-dropdown-item
|
|
1039
|
-
.focused=${t.type===e}
|
|
1040
|
-
.selected=${t.type===e}
|
|
1041
|
-
value="${t.type}"
|
|
1042
|
-
><lang-text text="${t.text}"></lang-text>
|
|
1043
|
-
</cdtr-dropdown-item>`)}
|
|
1044
|
-
${o.length?s.qy`<cdtr-dropdown-item value="${M}" class="special-links-item">
|
|
1045
|
-
<span class="special-links-label">
|
|
1046
|
-
<span class="special-links-title">
|
|
1047
|
-
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
1048
|
-
<path d="M13 2 4.5 13.5H11L10 22l8.5-11.5H12L13 2Z" />
|
|
1049
|
-
</svg>
|
|
1050
|
-
<lang-text text="link_automations_title"></lang-text>
|
|
1051
|
-
</span>
|
|
1052
|
-
<span class="special-links-desc">
|
|
1053
|
-
${o.map((t,e)=>s.qy`${e>0?" · ":""}<lang-text
|
|
1054
|
-
text="${t.name}"
|
|
1055
|
-
></lang-text>`)}
|
|
1056
|
-
</span>
|
|
1057
|
-
</span>
|
|
1058
|
-
</cdtr-dropdown-item>`:null}
|
|
1059
|
-
</div>
|
|
1060
|
-
</cdtr-dropdown>
|
|
1061
|
-
`}(this.options,this.protocol,this.onChangeType.bind(this),x)}
|
|
1062
|
-
${F=this.target,E=this.onChangeTarget.bind(this),s.qy`
|
|
1063
|
-
<cdtr-dropdown @change=${t=>E(t)} style="min-width: 120px;">
|
|
1108
|
+
${U(this.options,this.protocol,this.onChangeType.bind(this),x)}
|
|
1109
|
+
${F=this.target,T=this.onChangeTarget.bind(this),s.qy`
|
|
1110
|
+
<cdtr-dropdown @change=${t=>T(t)} style="min-width: 120px;">
|
|
1064
1111
|
<cdtr-dropdown-button minWidth=${120} class="dropdown-button" slot="trigger">
|
|
1065
1112
|
<lang-text .text=${F}></lang-text>
|
|
1066
1113
|
</cdtr-dropdown-button>
|
|
@@ -1091,9 +1138,9 @@
|
|
|
1091
1138
|
|
|
1092
1139
|
<div class="input-wrapper">
|
|
1093
1140
|
<cdtr-title class="explain-title"
|
|
1094
|
-
><lang-text .text="${
|
|
1141
|
+
><lang-text .text="${f}"></lang-text
|
|
1095
1142
|
></cdtr-title>
|
|
1096
|
-
${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:
|
|
1143
|
+
${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:S({value:c,inputRef:o,autofocus:s,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(R)}
|
|
1097
1144
|
${_(this.protocol,v)}
|
|
1098
1145
|
${function(t,e,i,o){return t&&Array.isArray(t)&&0!==t.length?s.qy`<cdtr-list-picker
|
|
1099
1146
|
.selected=${e}
|
|
@@ -1103,10 +1150,10 @@
|
|
|
1103
1150
|
></cdtr-list-picker>`:null}(t,c,this.onChangeLink.bind(this),this.onBlur.bind(this))}
|
|
1104
1151
|
</div>
|
|
1105
1152
|
|
|
1106
|
-
${
|
|
1153
|
+
${M=this.hasButton,q=this.onClickOk.bind(this),M?s.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
|
|
1107
1154
|
<cdtr-row justify="flex-end" mt="1">
|
|
1108
|
-
<paper-button fullWidth @click=${
|
|
1155
|
+
<paper-button fullWidth @click=${q} raised class="add-button">
|
|
1109
1156
|
<lang-text text="add_now"></lang-text>
|
|
1110
1157
|
</paper-button>
|
|
1111
1158
|
</cdtr-row>`:null}
|
|
1112
|
-
</div>`;var
|
|
1159
|
+
</div>`;var M,q,I,j,F,T,z}}F.styles=n,F.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function},openAutomations:{type:Boolean},compact:{type:Boolean}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",F)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\](?:\?|$)/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol||this.protocol||a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams(),this.isAnchor="anchor:"===this.protocol||this.href.startsWith("#")}addParam(t,e){this.params[t]=e,this.href=this.getUrlWithParams()}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if(this.isAnchor||"anchor:"===this.protocol)return t?i(t.startsWith("#")?t:`#${t}`):"";if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);
|
|
Binary file
|