@creaditor/newsletter-starterkit 1.0.40 → 1.0.42
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/1317.creaditor.bundle.js +3 -3
- package/dist/1317.creaditor.bundle.js.gz +0 -0
- package/dist/1529.creaditor.bundle.js +16 -0
- package/dist/1529.creaditor.bundle.js.gz +0 -0
- package/dist/1565.creaditor.bundle.js +1016 -0
- package/dist/1565.creaditor.bundle.js.gz +0 -0
- package/dist/168.creaditor.bundle.js +5 -421
- package/dist/168.creaditor.bundle.js.gz +0 -0
- package/dist/170.creaditor.bundle.js +1 -1
- package/dist/170.creaditor.bundle.js.gz +0 -0
- package/dist/2234.creaditor.bundle.js +1 -1
- package/dist/2234.creaditor.bundle.js.gz +0 -0
- package/dist/2384.creaditor.bundle.js +1 -1
- package/dist/2384.creaditor.bundle.js.gz +0 -0
- package/dist/2438.creaditor.bundle.js +67 -0
- package/dist/2438.creaditor.bundle.js.gz +0 -0
- package/dist/2547.creaditor.bundle.js +6 -0
- package/dist/2547.creaditor.bundle.js.gz +0 -0
- package/dist/2706.creaditor.bundle.js +2 -2
- package/dist/2706.creaditor.bundle.js.gz +0 -0
- package/dist/271.creaditor.bundle.js +99 -0
- package/dist/271.creaditor.bundle.js.gz +0 -0
- package/dist/2834.creaditor.bundle.js +14 -0
- package/dist/2834.creaditor.bundle.js.LICENSE.txt +5 -0
- package/dist/2834.creaditor.bundle.js.gz +0 -0
- package/dist/3095.creaditor.bundle.js +161 -0
- package/dist/3095.creaditor.bundle.js.gz +0 -0
- package/dist/3521.creaditor.bundle.js +2 -2
- package/dist/3521.creaditor.bundle.js.gz +0 -0
- package/dist/3553.creaditor.bundle.js +1 -1
- package/dist/3553.creaditor.bundle.js.gz +0 -0
- package/dist/3606.creaditor.bundle.js +113 -0
- package/dist/3606.creaditor.bundle.js.gz +0 -0
- package/dist/3932.creaditor.bundle.js +30 -0
- package/dist/3932.creaditor.bundle.js.gz +0 -0
- package/dist/4186.creaditor.bundle.js +453 -0
- package/dist/4186.creaditor.bundle.js.LICENSE.txt +10 -0
- package/dist/4186.creaditor.bundle.js.LICENSE.txt.gz +0 -0
- package/dist/4186.creaditor.bundle.js.gz +0 -0
- package/dist/4288.creaditor.bundle.js +98 -0
- package/dist/4288.creaditor.bundle.js.gz +0 -0
- package/dist/453.creaditor.bundle.js +111 -11
- package/dist/453.creaditor.bundle.js.gz +0 -0
- package/dist/4569.creaditor.bundle.js +1043 -19
- package/dist/4569.creaditor.bundle.js.gz +0 -0
- package/dist/4819.creaditor.bundle.js +1 -1
- package/dist/4819.creaditor.bundle.js.gz +0 -0
- package/dist/5133.creaditor.bundle.js +60 -0
- package/dist/5133.creaditor.bundle.js.gz +0 -0
- package/dist/5501.creaditor.bundle.js +112 -0
- package/dist/5501.creaditor.bundle.js.gz +0 -0
- package/dist/5713.creaditor.bundle.js +2 -152
- package/dist/5713.creaditor.bundle.js.LICENSE.txt +0 -11
- package/dist/5713.creaditor.bundle.js.LICENSE.txt.gz +0 -0
- package/dist/5713.creaditor.bundle.js.gz +0 -0
- package/dist/574.creaditor.bundle.js +4 -68
- package/dist/574.creaditor.bundle.js.gz +0 -0
- package/dist/5849.creaditor.bundle.js +1 -1
- package/dist/5849.creaditor.bundle.js.gz +0 -0
- package/dist/5926.creaditor.bundle.js +1 -1
- package/dist/5926.creaditor.bundle.js.gz +0 -0
- package/dist/6036.creaditor.bundle.js +34 -0
- package/dist/6036.creaditor.bundle.js.gz +0 -0
- package/dist/6151.creaditor.bundle.js +1 -0
- package/dist/6151.creaditor.bundle.js.gz +0 -0
- package/dist/638.creaditor.bundle.js +23 -0
- package/dist/638.creaditor.bundle.js.gz +0 -0
- package/dist/6442.creaditor.bundle.js +236 -0
- package/dist/6442.creaditor.bundle.js.gz +0 -0
- package/dist/7307.creaditor.bundle.js +186 -0
- package/dist/7307.creaditor.bundle.js.gz +0 -0
- package/dist/741.creaditor.bundle.js +234 -0
- package/dist/741.creaditor.bundle.js.gz +0 -0
- package/dist/7466.creaditor.bundle.js +1 -1
- package/dist/7466.creaditor.bundle.js.gz +0 -0
- package/dist/752.creaditor.bundle.js +40 -0
- package/dist/752.creaditor.bundle.js.gz +0 -0
- package/dist/767.creaditor.bundle.js +1 -1
- package/dist/767.creaditor.bundle.js.gz +0 -0
- package/dist/8042.creaditor.bundle.js +71 -0
- package/dist/8042.creaditor.bundle.js.gz +0 -0
- package/dist/8141.creaditor.bundle.js +1 -1
- package/dist/8141.creaditor.bundle.js.gz +0 -0
- package/dist/8173.creaditor.bundle.js +3 -3
- package/dist/8173.creaditor.bundle.js.gz +0 -0
- package/dist/8443.creaditor.bundle.js +72 -0
- package/dist/8443.creaditor.bundle.js.gz +0 -0
- package/dist/8516.creaditor.bundle.js +1 -1
- package/dist/8516.creaditor.bundle.js.gz +0 -0
- package/dist/8570.creaditor.bundle.js +102 -0
- package/dist/8570.creaditor.bundle.js.gz +0 -0
- package/dist/8646.creaditor.bundle.js +122 -0
- package/dist/8646.creaditor.bundle.js.gz +0 -0
- package/dist/8654.creaditor.bundle.js +109 -0
- package/dist/8654.creaditor.bundle.js.gz +0 -0
- package/dist/8854.creaditor.bundle.js +1 -1
- package/dist/8854.creaditor.bundle.js.gz +0 -0
- package/dist/8916.creaditor.bundle.js +18 -0
- package/dist/8916.creaditor.bundle.js.gz +0 -0
- package/dist/898.creaditor.bundle.js +5 -357
- package/dist/898.creaditor.bundle.js.gz +0 -0
- package/dist/9041.creaditor.bundle.js +171 -0
- package/dist/9041.creaditor.bundle.js.gz +0 -0
- package/dist/9193.creaditor.bundle.js +1 -1
- package/dist/9193.creaditor.bundle.js.gz +0 -0
- package/dist/9990.creaditor.bundle.js +16 -0
- package/dist/9990.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +1277 -1671
- package/dist/creaditor.bundle.js.LICENSE.txt +8 -0
- package/dist/creaditor.bundle.js.LICENSE.txt.gz +0 -0
- 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
|
@@ -1,23 +1,1047 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[4569],{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3095,4569,7307],{73095(t,e,i){i.r(e),i.d(e,{default:()=>a});var s=i(24586),o=i(59929),n=i(21421),r=i(69600);class a extends o.WF{constructor(){super(),(0,s.A)(this,"contentRef",(0,n._)()),this.toggle=this.toggle.bind(this),this.onEnter=this.onEnter.bind(this),this.onKeydown=this.onKeydown.bind(this),this.overflow=!0,this.maxHeight=300,this.left=0,this.top=0,this.custom=!1,this.opened=!1}close(){this.toggle()}onBouncing(t){this.searchText=t.target.value;const e=new UIEvent("search",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}render(){return o.qy`
|
|
2
|
+
<slot @click=${()=>this.toggle()} tabindex="0" name="trigger"></slot>
|
|
3
|
+
${this.opened?o.qy` <div
|
|
4
|
+
@mouseup=${this.onClickOutside}
|
|
5
|
+
class="backdrop"
|
|
6
|
+
style="z-index:${(0,r.A)()};"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
${(0,n.K)(this.contentRef)}
|
|
10
|
+
@mouseup=${this.preventClosing}
|
|
11
|
+
style="z-index:${(0,r.A)()};left:${this.left}px;top:${this.top}px;"
|
|
12
|
+
class="dropdown-content fade-in ${this.custom?"":"dropdown-background"}"
|
|
13
|
+
>
|
|
14
|
+
${this.search?o.qy`<cdtr-input
|
|
15
|
+
@input=${this.onBouncing}
|
|
16
|
+
type="search"
|
|
17
|
+
value=${this.searchText}
|
|
18
|
+
></cdtr-input>`:null}
|
|
19
|
+
<slot name="content"></slot>
|
|
20
|
+
</div>
|
|
21
|
+
</div>`:null}
|
|
22
|
+
`}preventClosing(t){return t.stopPropagation(),setTimeout(()=>{this.calcRects()},0),!1}onClickOutside(){this.toggle(!1)}updated(){this.opened&&(setTimeout(()=>{this.calcRects()},0),this.contentRef.value?.classList.add("fade-in"),this.contentRef.value.style.maxHeight=`${this.maxHeight}px`)}calcRects(){let t=0,e=0;const i=this.getBoundingClientRect(),s=this.contentRef?.value?.getBoundingClientRect();s&&(t=i.left,e=i.top,t<0&&(t=0),e<0&&(e=0),t+s.width>window.innerWidth&&(t=window.innerWidth-s.width),e+s.height>window.innerHeight&&(e=window.innerHeight-s.height),this.left=t,this.top=e,this.contentRef.value.style.left=`${i.left}px`,this.contentRef.value.style.top=`${e+i.height}px`,this.contentRef.value.style.overflow=this.overflow?"hidden auto":"hidden")}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t||!this.opened;e?(window.removeEventListener("keydown",this.onKeydown),window.addEventListener("keydown",this.onKeydown),this.opened=e,setTimeout(()=>{const t=this.focusedItem=this.querySelector("cdtr-dropdown-item[focused]")||this.querySelector("cdtr-dropdown-item");t&&t.focus()},20)):(window.removeEventListener("keydown",this.onKeydown),this.contentRef.value?.classList.add("fade-out"),setTimeout(()=>{this.opened=e},150)),this.setAttribute("aria-expanded",e)}onEnter(t){t.target===this&&13===t.keyCode&&this.toggle()}onKeydown(t){this.focusedItem&&40===t.keyCode&&this.focusedItem.nextElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.nextElementSibling.nodeName?(this.focusedItem=this.focusedItem.nextElementSibling,this.focusedItem&&this.focusedItem.focus()):this.focusedItem&&38===t.keyCode&&this.focusedItem.previousElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.previousElementSibling.nodeName?(this.focusedItem=this.focusedItem.previousElementSibling,this.focusedItem&&this.focusedItem.focus()):27===t.keyCode&&this.toggle();const e=new UIEvent("keypress",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",this.opened),this.addEventListener("keydown",this.onEnter),setTimeout(()=>{this.opened&&this.toggle(!0)},50)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKeydown)}patch(t){this.value=t,this.toggle(!1);const e=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),setTimeout(()=>{this.focus()},0)}}(0,s.A)(a,"styles",o.AH`
|
|
23
|
+
:host {
|
|
24
|
+
display: inline-block;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.backdrop {
|
|
30
|
+
position: fixed;
|
|
31
|
+
top: 0;
|
|
32
|
+
left: 0;
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
background: transparent;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
.dropdown-background {
|
|
39
|
+
background: #fff;
|
|
40
|
+
}
|
|
41
|
+
.dropdown-content {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
min-width: 50px;
|
|
44
|
+
min-height: 50;
|
|
45
|
+
position: fixed;
|
|
46
|
+
border-radius: 0.25rem;
|
|
47
|
+
/* padding: 3px; */
|
|
48
|
+
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
|
|
49
|
+
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
50
|
+
}
|
|
51
|
+
.fade-in {
|
|
52
|
+
animation: fade-in 0.3s;
|
|
53
|
+
}
|
|
54
|
+
.fade-out {
|
|
55
|
+
animation: fade-out 0.3s;
|
|
56
|
+
opacity: 0;
|
|
57
|
+
}
|
|
58
|
+
@keyframes fade-in {
|
|
59
|
+
from {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
margin-top: 5px;
|
|
62
|
+
}
|
|
63
|
+
to {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
@keyframes fade-out {
|
|
68
|
+
from {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
71
|
+
to {
|
|
72
|
+
margin-top: 5px;
|
|
73
|
+
opacity: 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`),(0,s.A)(a,"properties",{search:{type:Boolean},searchText:{type:String},left:{type:Number},top:{type:Number},opened:{type:Boolean},maxHeight:{type:Number},overflow:{type:Boolean},value:{type:String},custom:{type:String}});class l extends o.WF{constructor(){super(),this.minWidth=50}render(){return o.qy`<paper-button style="min-width:${this.minWidth}px"
|
|
77
|
+
><slot></slot> <cdtr-dd-arrow-icon></cdtr-dd-arrow-icon
|
|
78
|
+
></paper-button>`}}(0,s.A)(l,"properties",{minWidth:{type:Number}}),(0,s.A)(l,"styles",o.AH`
|
|
79
|
+
paper-button {
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: space-between;
|
|
82
|
+
text-transform: capitalize;
|
|
83
|
+
width: 100%;
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
font-weight: 400;
|
|
86
|
+
line-height: 1.5;
|
|
87
|
+
color: rgb(33, 37, 41);
|
|
88
|
+
background: rgb(255, 255, 255);
|
|
89
|
+
background-clip: padding-box;
|
|
90
|
+
border-width: 1px;
|
|
91
|
+
border-style: solid;
|
|
92
|
+
border-image: initial;
|
|
93
|
+
appearance: none;
|
|
94
|
+
border-radius: 0.25rem;
|
|
95
|
+
transition: border-color 0.15s ease-in-out 0s,
|
|
96
|
+
box-shadow 0.15s ease-in-out 0s;
|
|
97
|
+
margin: 0px;
|
|
98
|
+
font-family: var(--font-family);
|
|
99
|
+
border-color: var(--input-border-color);
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
padding: 5px;
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
}
|
|
104
|
+
paper-button:hover {
|
|
105
|
+
border-color: black;
|
|
106
|
+
}
|
|
107
|
+
`);class c extends o.WF{constructor(){super(),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}focus(){this.shadowRoot.querySelector(".dropdown-item").focus()}onFocus(){this.focused=!0}onBlur(){this.focused=!1}onClick(t){if(this.notClickable)return;const e=this.closest("cdtr-dropdown");e&&e.patch(this.value,t,this)}onPress(t){if(13===t.keyCode){const e=new UIEvent("click",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e);const i=this.closest("cdtr-dropdown");i&&i.patch(this.value,t,this)}}connectedCallback(){super.connectedCallback(),this.selected&&this.scrollIntoView({behavior:"smooth",block:"start"})}render(){return o.qy`<div role="button"
|
|
108
|
+
@click=${this.onClick}
|
|
109
|
+
@keydown=${this.onPress}
|
|
110
|
+
@blur=${this.onBlur}
|
|
111
|
+
@focus=${this.onFocus}
|
|
112
|
+
class="dropdown-item"
|
|
113
|
+
tabindex="0"
|
|
7
114
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
115
|
+
${this.selected?o.qy` <svg
|
|
116
|
+
class="selected-svg"
|
|
117
|
+
fill="var(--primary)"
|
|
118
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
119
|
+
viewBox="0 0 24 24"
|
|
120
|
+
width="24"
|
|
121
|
+
height="24"
|
|
122
|
+
>
|
|
123
|
+
<path fill="none" d="M0 0h24v24H0z" />
|
|
124
|
+
<path
|
|
125
|
+
d="M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z"
|
|
126
|
+
/>
|
|
127
|
+
</svg>`:null}
|
|
128
|
+
<slot></slot>
|
|
129
|
+
</div>`}}(0,s.A)(c,"properties",{focused:{type:Boolean,reflect:!0},selected:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},notClickable:{type:Boolean}}),(0,s.A)(c,"styles",o.AH`
|
|
130
|
+
.dropdown-item {
|
|
131
|
+
position: relative;
|
|
132
|
+
box-sizing: border-box;
|
|
133
|
+
display: flex;
|
|
134
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
135
|
+
font-size: 12px;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
margin-bottom: 2px;
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
user-select: none;
|
|
141
|
+
width: 100%;
|
|
142
|
+
justify-content: space-between;
|
|
143
|
+
box-sizing: border-box;
|
|
144
|
+
padding: 10px 20px;
|
|
145
|
+
}
|
|
146
|
+
.dropdown-item:hover {
|
|
147
|
+
background: #f3f3f396;
|
|
148
|
+
}
|
|
149
|
+
.dropdown-item:focus {
|
|
150
|
+
color: var(--primary-color);
|
|
151
|
+
outline: none;
|
|
152
|
+
background: #f3f3f3;
|
|
153
|
+
}
|
|
154
|
+
.selected-svg {
|
|
155
|
+
width: 16px;
|
|
156
|
+
position: absolute;
|
|
157
|
+
left: 95%;
|
|
158
|
+
transform: translate(-70%, -50%);
|
|
159
|
+
top: 50%;
|
|
160
|
+
}
|
|
161
|
+
`),customElements.get("cdtr-dropdown-item")||customElements.define("cdtr-dropdown-item",c),customElements.get("cdtr-dropdown-button")||customElements.define("cdtr-dropdown-button",l),customElements.get("cdtr-dropdown")||customElements.define("cdtr-dropdown",a)},47307(t,e,i){i.r(e),i.d(e,{default:()=>d});var s=i(24586),o=i(59929),n=i(21421),r=i(91597),a=i(81744),l=i(86319);const c=(0,r.S)();class d extends o.WF{constructor(){super(),(0,s.A)(this,"inputRef",(0,n._)()),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=l.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"===(0,a.o)(t)?"right":"")));const e=this.multiline?o.qy` <textarea
|
|
162
|
+
row=${this.row||4}
|
|
163
|
+
.disabled=${this.disabled}
|
|
164
|
+
dir="auto"
|
|
165
|
+
${(0,n.K)(this.inputRef)}
|
|
166
|
+
style="${this.inputStyle}"
|
|
167
|
+
.autofocus="${this.autofocus}"
|
|
168
|
+
.placeholder="${t}"
|
|
169
|
+
@input="${this.setValue}"
|
|
170
|
+
@change="${this.setValue}"
|
|
171
|
+
.min="${String(this.min)}"
|
|
172
|
+
.max="${String(this.max)}"
|
|
173
|
+
.step="${String(this.step)}"
|
|
174
|
+
.value="${String(this.value)}"
|
|
175
|
+
/>`:o.qy` <input
|
|
176
|
+
.disabled=${this.disabled}
|
|
177
|
+
dir="auto"
|
|
178
|
+
${(0,n.K)(this.inputRef)}
|
|
179
|
+
style="${this.inputStyle}"
|
|
180
|
+
.autofocus="${this.autofocus}"
|
|
181
|
+
.placeholder="${t}"
|
|
182
|
+
@input="${this.setValue}"
|
|
183
|
+
@change="${this.setValue}"
|
|
184
|
+
.min="${String(this.min)}"
|
|
185
|
+
.type="${this.type}"
|
|
186
|
+
.max="${String(this.max)}"
|
|
187
|
+
.step="${String(this.step)}"
|
|
188
|
+
.value="${String(this.value)}"
|
|
189
|
+
/>`;return o.qy`<form @submit=${this.onSubmit}>
|
|
190
|
+
${e}
|
|
191
|
+
${!this.icon||this.couchOnEmpty||this.successActive?null:o.qy`<cdtr-icon
|
|
192
|
+
color="#d9d9d9"
|
|
193
|
+
width=${20}
|
|
194
|
+
height=${20}
|
|
195
|
+
style="position: absolute;
|
|
196
|
+
transform: translateY(-50%);top:50%;z-index:1;
|
|
197
|
+
left: 10px;"
|
|
198
|
+
icon="${this.icon}"
|
|
199
|
+
></cdtr-icon>`}
|
|
200
|
+
${this.successActive?o.qy`<div class="success-overlay" aria-live="polite">
|
|
201
|
+
<cdtr-couch-mark></cdtr-couch-mark>
|
|
202
|
+
<span class="success-icon">✓</span>
|
|
203
|
+
</div>`:null}
|
|
204
|
+
${!this.couchOnEmpty||this.value||this.successActive?null:o.qy`<cdtr-couch-mark
|
|
205
|
+
style="position: absolute;
|
|
206
|
+
transform: translateY(-50%);
|
|
207
|
+
left: 0;"
|
|
208
|
+
></cdtr-couch-mark>`}
|
|
209
|
+
${"text"===this.type&&this.maxLength?o.qy`<span class="counter"
|
|
210
|
+
>${this.value.length}/${this.maxLength}</span
|
|
211
|
+
> `:null}
|
|
212
|
+
</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)};c.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}}(0,s.A)(d,"styles",o.AH`
|
|
213
|
+
:host {
|
|
214
|
+
display: inline-block;
|
|
215
|
+
--cdtr-input-height: 30px;
|
|
216
|
+
--cdtr-input-padding: 0.105rem 0.45rem;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
form {
|
|
220
|
+
position: relative;
|
|
221
|
+
}
|
|
222
|
+
.counter {
|
|
223
|
+
font-size: 10px;
|
|
224
|
+
}
|
|
225
|
+
input,
|
|
226
|
+
textarea {
|
|
227
|
+
height: var(--cdtr-input-height);
|
|
228
|
+
display: inline-block;
|
|
229
|
+
width: 100%;
|
|
230
|
+
padding: var(--cdtr-input-padding);
|
|
231
|
+
font-size: 14px;
|
|
232
|
+
font-weight: 400;
|
|
233
|
+
line-height: 1.5;
|
|
234
|
+
color: #212529;
|
|
235
|
+
background: #fff;
|
|
236
|
+
background-clip: padding-box;
|
|
237
|
+
border: 1px solid #ced4da;
|
|
238
|
+
-webkit-appearance: none;
|
|
239
|
+
-moz-appearance: none;
|
|
240
|
+
appearance: none;
|
|
241
|
+
border-radius: 0.25rem;
|
|
242
|
+
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
243
|
+
margin: 0;
|
|
244
|
+
font-family: var(--font-family);
|
|
245
|
+
border-color: var(--input-border-color);
|
|
246
|
+
outline: var(--input-border-color);
|
|
247
|
+
box-sizing: border-box;
|
|
248
|
+
}
|
|
249
|
+
textarea {
|
|
250
|
+
height: auto;
|
|
251
|
+
resize: none;
|
|
252
|
+
}
|
|
253
|
+
input:disabled,
|
|
254
|
+
textrea:disabled,
|
|
255
|
+
textareap[readonly],
|
|
256
|
+
input[readonly] {
|
|
257
|
+
background-color: #e9ecef;
|
|
258
|
+
opacity: 0.5;
|
|
259
|
+
}
|
|
260
|
+
input:hover,
|
|
261
|
+
textarea:hover {
|
|
262
|
+
border-color: black;
|
|
263
|
+
}
|
|
264
|
+
input::placeholder,
|
|
265
|
+
textarea::placeholder {
|
|
266
|
+
font-family: var(--font-family);
|
|
267
|
+
}
|
|
268
|
+
input:focus,
|
|
269
|
+
textarea:focus {
|
|
270
|
+
border-color: var(--primary);
|
|
271
|
+
}
|
|
272
|
+
input[type="number"] {
|
|
273
|
+
padding-right: 0px;
|
|
274
|
+
padding-left: 4px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
input[type="number"] {
|
|
278
|
+
-moz-appearance: textfield;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.success-overlay {
|
|
282
|
+
position: absolute;
|
|
283
|
+
top: 50%;
|
|
284
|
+
left: 4px;
|
|
285
|
+
transform: translateY(-50%);
|
|
286
|
+
width: 28px;
|
|
287
|
+
height: 28px;
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
justify-content: center;
|
|
291
|
+
pointer-events: none;
|
|
292
|
+
z-index: 2;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.success-overlay cdtr-couch-mark {
|
|
296
|
+
position: absolute;
|
|
297
|
+
top: 50%;
|
|
298
|
+
left: 50%;
|
|
299
|
+
transform: translate(-50%, -50%) scale(0.75);
|
|
300
|
+
opacity: 0.85;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.success-overlay .success-icon {
|
|
304
|
+
position: absolute;
|
|
305
|
+
top: 50%;
|
|
306
|
+
left: 50%;
|
|
307
|
+
width: 20px;
|
|
308
|
+
height: 20px;
|
|
309
|
+
border-radius: 999px;
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
justify-content: center;
|
|
313
|
+
background: var(--primary);
|
|
314
|
+
color: #f6fff9;
|
|
315
|
+
font-size: 14px;
|
|
316
|
+
font-weight: 600;
|
|
317
|
+
transform: translate(-50%, -50%) scale(0.85);
|
|
318
|
+
opacity: 0;
|
|
319
|
+
animation: successPop 0.32s ease-out forwards;
|
|
320
|
+
box-shadow: 0 0 6px rgba(79, 192, 111, 0.25);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
@keyframes successPop {
|
|
324
|
+
0% {
|
|
325
|
+
transform: translate(-50%, -50%) scale(0.85);
|
|
326
|
+
opacity: 0;
|
|
327
|
+
}
|
|
328
|
+
50% {
|
|
329
|
+
transform: translate(-50%, -50%) scale(1.05);
|
|
330
|
+
opacity: 1;
|
|
331
|
+
}
|
|
332
|
+
100% {
|
|
333
|
+
transform: translate(-50%, -50%) scale(1);
|
|
334
|
+
opacity: 1;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
@keyframes successGlow {
|
|
339
|
+
0% {
|
|
340
|
+
box-shadow: 0 0 6px rgba(79, 192, 111, 0.25);
|
|
341
|
+
}
|
|
342
|
+
100% {
|
|
343
|
+
box-shadow: 0 0 10px rgba(79, 192, 111, 0.2);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
`),(0,s.A)(d,"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",d)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>w});var s=i(24586),o=i(59929),n=i(86319),r=i(88385);const a=o.AH`
|
|
13
347
|
:host {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
348
|
+
--paper-radio-button-checked-color: var(--primary);
|
|
349
|
+
box-sizing: border-box;
|
|
350
|
+
}
|
|
351
|
+
.anchor-dd {
|
|
352
|
+
width: 100%;
|
|
353
|
+
}
|
|
354
|
+
cdtr-add-icon {
|
|
355
|
+
--cdtr-icon-width: 16px;
|
|
356
|
+
--cdtr-icon-height: 16px;
|
|
357
|
+
--cdtr-icon-color: var(--dark);
|
|
358
|
+
}
|
|
359
|
+
cdtr-row {
|
|
360
|
+
direction: var(--direction-locale);
|
|
361
|
+
}
|
|
362
|
+
paper-radio-button {
|
|
363
|
+
padding: 0;
|
|
364
|
+
display: flex;
|
|
365
|
+
gap: 5px;
|
|
366
|
+
margin-top: 8px;
|
|
367
|
+
}
|
|
368
|
+
.add-button {
|
|
369
|
+
background: var(--primary);
|
|
370
|
+
color: #fff;
|
|
371
|
+
min-width:0;
|
|
372
|
+
padding:6px;
|
|
373
|
+
width:100%;
|
|
374
|
+
}
|
|
375
|
+
paper-item {
|
|
376
|
+
width: 130px;
|
|
377
|
+
cursor: pointer;
|
|
378
|
+
}
|
|
379
|
+
paper-item:hover {
|
|
380
|
+
color: var(--primary);
|
|
381
|
+
}
|
|
382
|
+
.input-wrapper {
|
|
383
|
+
width: 100%;
|
|
384
|
+
position: relative;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
paper-button {
|
|
388
|
+
padding: 0.4em;
|
|
389
|
+
color: var(--primary);
|
|
390
|
+
}
|
|
391
|
+
paper-button.indigo {
|
|
392
|
+
background: var(--primary);
|
|
393
|
+
color: white;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.input-wrapper cdtr-input {
|
|
397
|
+
display: block;
|
|
398
|
+
}
|
|
399
|
+
.explain-title {
|
|
400
|
+
margin: 20px 0 6px;
|
|
401
|
+
}
|
|
402
|
+
paper-item {
|
|
403
|
+
text-align: var(--text-align-locale);
|
|
404
|
+
direction: var(--direction-locale);
|
|
405
|
+
}
|
|
406
|
+
.link-type-dropdown {
|
|
407
|
+
text-align: var(--text-align-locale);
|
|
408
|
+
direction: var(--direction-locale);
|
|
409
|
+
width: 50%;
|
|
410
|
+
}
|
|
411
|
+
.trigger-wrapper svg {
|
|
412
|
+
width: 20px;
|
|
413
|
+
cursor: pointer;
|
|
414
|
+
fill: var(--dark);
|
|
415
|
+
}
|
|
416
|
+
.trigger-wrapper svg:hover {
|
|
417
|
+
fill: var(--primary);
|
|
418
|
+
}
|
|
419
|
+
.demo-icon {
|
|
420
|
+
position: absolute;
|
|
421
|
+
left: 100%;
|
|
422
|
+
transform: translate(-100%, -50%);
|
|
423
|
+
top: 55%;
|
|
424
|
+
}
|
|
425
|
+
.automations-view {
|
|
426
|
+
width: 100%;
|
|
427
|
+
}
|
|
428
|
+
.automation-card {
|
|
429
|
+
padding: 1rem;
|
|
430
|
+
border: 1px solid #e0e0e0;
|
|
431
|
+
border-radius: 4px;
|
|
432
|
+
margin-bottom: 0.5rem;
|
|
433
|
+
cursor: pointer;
|
|
434
|
+
transition: all 0.2s;
|
|
435
|
+
}
|
|
436
|
+
.automation-card:hover {
|
|
437
|
+
border-color: var(--primary);
|
|
438
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
439
|
+
}
|
|
440
|
+
.automation-card.active {
|
|
441
|
+
border-color: var(--primary);
|
|
442
|
+
background: #e3f2fd;
|
|
443
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
444
|
+
}
|
|
445
|
+
.automation-card.active:hover {
|
|
446
|
+
border-color: var(--primary);
|
|
447
|
+
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
|
|
448
|
+
}
|
|
449
|
+
.automation-details-view {
|
|
450
|
+
width: 100%;
|
|
451
|
+
min-height: 400px;
|
|
452
|
+
display: flex;
|
|
453
|
+
flex-direction: column;
|
|
454
|
+
}
|
|
455
|
+
.automation-content {
|
|
456
|
+
overflow-y: auto;
|
|
457
|
+
flex: 1 1 auto;
|
|
458
|
+
min-height: 0;
|
|
459
|
+
}
|
|
460
|
+
.automation-footer {
|
|
461
|
+
flex: 0 0 auto;
|
|
462
|
+
position: sticky;
|
|
463
|
+
bottom: 0;
|
|
464
|
+
z-index: 10;
|
|
465
|
+
background: #fff;
|
|
466
|
+
}
|
|
467
|
+
.mailing-lists-container {
|
|
468
|
+
max-height: 300px;
|
|
469
|
+
overflow-y: auto;
|
|
470
|
+
}
|
|
471
|
+
.mailing-list-item {
|
|
472
|
+
padding: 0.5rem 0.75rem;
|
|
473
|
+
border-radius: 4px;
|
|
474
|
+
margin-bottom: 0.5rem;
|
|
475
|
+
cursor: pointer;
|
|
476
|
+
transition: all 0.2s;
|
|
477
|
+
}
|
|
478
|
+
.mailing-list-item:hover {
|
|
479
|
+
background: rgba(0, 0, 0, 0.03);
|
|
480
|
+
}
|
|
481
|
+
.action-section {
|
|
482
|
+
margin-bottom: 1.5rem;
|
|
483
|
+
}
|
|
484
|
+
.action-question {
|
|
485
|
+
padding: 0.75rem 0;
|
|
486
|
+
cursor: pointer;
|
|
487
|
+
border-bottom: 1px solid #e0e0e0;
|
|
488
|
+
transition: all 0.2s;
|
|
489
|
+
}
|
|
490
|
+
.action-question:hover {
|
|
491
|
+
border-bottom-color: var(--primary);
|
|
17
492
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
color: var(--cdtr-icon-color);
|
|
493
|
+
.mailing-lists-list {
|
|
494
|
+
margin-top: 0.75rem;
|
|
495
|
+
padding-left: 1rem;
|
|
22
496
|
}
|
|
23
|
-
|
|
497
|
+
`;var l=i(21421);i(73095),i(47307);const c="260px",d=[{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",p="cdtrRemove",u="cdtrAutomation",m=[h,p,u];function f(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function g(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:s,protocol:n,onChangeLink:r,onBlur:a,onRequest:l}=t;return o.qy`
|
|
498
|
+
<cdtr-row alignItems="center" spacing="5">
|
|
499
|
+
<cdtr-dropdown
|
|
500
|
+
@change=${t=>{r({target:{value:"#"+t.target.value},anchor:!0}),a()}}
|
|
501
|
+
.opened=${i.length>0&&"anchor:"===n&&!s}
|
|
502
|
+
class="anchor-dd"
|
|
503
|
+
>
|
|
504
|
+
<cdtr-dropdown-button
|
|
505
|
+
minWidth=${100}
|
|
506
|
+
class=" dropdown-button"
|
|
507
|
+
slot="trigger"
|
|
508
|
+
><lang-text .text=${e.isAnchor?s:""}></lang-text>
|
|
509
|
+
</cdtr-dropdown-button>
|
|
510
|
+
<div style="min-width:150px" slot="content">
|
|
511
|
+
${i.map(t=>o.qy`<cdtr-dropdown-item
|
|
512
|
+
value="${t.props.name||t.props.element_ID}"
|
|
513
|
+
>${t.props.name||t.props.element_ID}
|
|
514
|
+
</cdtr-dropdown-item>`)}
|
|
515
|
+
</div>
|
|
516
|
+
</cdtr-dropdown>
|
|
517
|
+
${0===i.length?o.qy`<paper-button
|
|
518
|
+
@click=${()=>{"function"===l&&l("anchor")}}
|
|
519
|
+
><cdtr-title
|
|
520
|
+
><lang-text text="create_anchor"></lang-text></cdtr-title
|
|
521
|
+
></paper-button>`:null}
|
|
522
|
+
</cdtr-row>
|
|
523
|
+
`}(e);case"mailto:":return function(t){const{href:e,body:i,subject:s,onBlur:n,updateBody:r,updateSubject:a}=t,l="string"==typeof e?f("body",e):i||e.params.body,d="string"==typeof e?f("subject",e):s||e.params.subject;return o.qy`
|
|
524
|
+
<cdtr-row spacing="5">
|
|
525
|
+
<cdtr-title class="explain-title"
|
|
526
|
+
><lang-text text="add_catchy_subject"></lang-text
|
|
527
|
+
></cdtr-title>
|
|
528
|
+
<cdtr-input
|
|
529
|
+
inputStyle="height:${"40px"};"
|
|
530
|
+
style="width:${c};"
|
|
531
|
+
@change=${t=>{let{target:e}=t;a(e.value),n()}}
|
|
532
|
+
value=${d||s||""}
|
|
533
|
+
></cdtr-input>
|
|
534
|
+
<cdtr-title class="explain-title"
|
|
535
|
+
><lang-text text="email_body_if_needed"></lang-text
|
|
536
|
+
></cdtr-title>
|
|
537
|
+
<cdtr-input
|
|
538
|
+
.multiline=${!0}
|
|
539
|
+
value="${l||i||""}"
|
|
540
|
+
style="width:${c};"
|
|
541
|
+
@change=${t=>{let{target:e}=t;r(e.value),n()}}
|
|
542
|
+
></cdtr-input>
|
|
543
|
+
</cdtr-row>
|
|
544
|
+
`}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:s,updateBody:n}=t,r="string"==typeof e?f("body",e):e.params.body;return o.qy`
|
|
545
|
+
<cdtr-row spacing="5">
|
|
546
|
+
<cdtr-title class="explain-title"
|
|
547
|
+
><lang-text text="sms_body_if_needed"></lang-text
|
|
548
|
+
></cdtr-title>
|
|
549
|
+
<cdtr-input
|
|
550
|
+
.multiline=${!0}
|
|
551
|
+
value="${r||i||""}"
|
|
552
|
+
style="width:${c};"
|
|
553
|
+
@change=${t=>{let{target:e}=t;n(e.value),s()}}
|
|
554
|
+
></cdtr-input>
|
|
555
|
+
</cdtr-row>
|
|
556
|
+
`}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:s,updateBody:n}=t,r="string"==typeof e?f("text",e)||f("body",e):e.params&&(e.params.text||e.params.body)||"";return o.qy`
|
|
557
|
+
<cdtr-row spacing="5">
|
|
558
|
+
<cdtr-title class="explain-title"
|
|
559
|
+
><lang-text text="whatsapp_body_if_needed"></lang-text
|
|
560
|
+
></cdtr-title>
|
|
561
|
+
<cdtr-input
|
|
562
|
+
.multiline=${!0}
|
|
563
|
+
value="${r||i||""}"
|
|
564
|
+
style="width:${c};"
|
|
565
|
+
@change=${t=>{let{target:e}=t;n(e.value),s()}}
|
|
566
|
+
></cdtr-input>
|
|
567
|
+
</cdtr-row>
|
|
568
|
+
`}(e);default:return""}}function b(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))||f("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 d=`https://wa.me/${a}`;c&&(d+=`?text=${c}`);const h=new r.A(d);return h.target=o||h.target||"_blank",{url:h,params:h.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 y(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 v(t){const{value:e="",inputRef:i,autofocus:s=!1,onChange:n,onBlur:r,onFocus:a,onKeyDown:d,placeholder:h="",inputStyle:p="",style:u="width:260px;",width:m=c}=t,f=t=>{n&&n(t),r&&r()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return o.qy`
|
|
569
|
+
<cdtr-row style="position:relative;" spacing="5">
|
|
570
|
+
<span style="display:none;" aria-hidden="true">${e}</span>
|
|
571
|
+
<cdtr-input
|
|
572
|
+
.couchOnEmpty=${!0}
|
|
573
|
+
${i?(0,l.K)(i):""}
|
|
574
|
+
style="${u}"
|
|
575
|
+
inputStyle="${p}"
|
|
576
|
+
.autofocus=${s}
|
|
577
|
+
type="search"
|
|
578
|
+
width="${m}"
|
|
579
|
+
placeholder="${h}"
|
|
580
|
+
@input=${t=>{if(t.target.selectionStart!==t.target.value.length)return;const e=t.target.value.trim();/^[^a-zA-Z0-9]+$/.test(e)||n&&n(t)}}
|
|
581
|
+
@change=${f}
|
|
582
|
+
@focus=${a}
|
|
583
|
+
@submit=${d||f}
|
|
584
|
+
.value="${g}"
|
|
585
|
+
></cdtr-input>
|
|
586
|
+
</cdtr-row>
|
|
587
|
+
`}function x(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=n.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=n.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(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("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[u]?(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=m,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()}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=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${h}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${p}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],s=e[2],o={};s.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const n=o.url;let a;if(delete o.url,a=n?new r.A(n):new r.A("https://example.com"),a.params||(a.params={}),o[h]&&(a.params[h]=o[h]),o[p]&&(a.params[p]=o[p]),a.params[u]=i,a.href=t,a.url=n||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,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[u])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],s={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const o=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[p]&&(n.params[p]=s[p]),n.params[u]=e[1],n.href=t,n.url=o||"",this.href=n,this.value=n,this.link=n,this.lastUrl=n,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;if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=s.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[u],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,s]=t.split("=");i&&s&&(e[decodeURIComponent(i)]=decodeURIComponent(s))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForAdd=t}if(e[p]){const t="string"==typeof e[p]?e[p].split(",").filter(t=>t.trim()):Array.isArray(e[p])?e[p]:[];this.selectedMailingListsForRemove=t}}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[p]){const e="string"==typeof t.params[p]?t.params[p].split(",").filter(t=>t.trim()):Array.isArray(t.params[p])?t.params[p]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():o.qy`
|
|
588
|
+
<div class="automations-view">
|
|
589
|
+
<cdtr-row justify="space-between" alignItems="center" mb="1">
|
|
590
|
+
<cdtr-title
|
|
591
|
+
style="font-weight: 700; font-size: 14.4px; color: #000000b0;"
|
|
592
|
+
>
|
|
593
|
+
<lang-text text="automations"></lang-text>
|
|
594
|
+
</cdtr-title>
|
|
595
|
+
<paper-button
|
|
596
|
+
@click=${this.onBackClick}
|
|
597
|
+
style="padding: 0.4em; color: var(--primary); background: none; box-shadow: none;"
|
|
598
|
+
>
|
|
599
|
+
<lang-text text="back"></lang-text>
|
|
600
|
+
</paper-button>
|
|
601
|
+
</cdtr-row>
|
|
602
|
+
<cdtr-divider></cdtr-divider>
|
|
603
|
+
<div class="automations-list" style="margin-top: 1rem;">
|
|
604
|
+
${this.automations.map(t=>{const e=this.activeAutomationId===t.id;return o.qy`
|
|
605
|
+
<div
|
|
606
|
+
class="automation-card ${e?"active":""}"
|
|
607
|
+
@click=${()=>this.onAutomationClick(t)}
|
|
608
|
+
style="
|
|
609
|
+
padding: 1rem;
|
|
610
|
+
border: 2px solid ${e?"var(--primary)":"#e0e0e0"};
|
|
611
|
+
border-radius: 4px;
|
|
612
|
+
margin-bottom: 0.5rem;
|
|
613
|
+
cursor: pointer;
|
|
614
|
+
transition: all 0.2s;
|
|
615
|
+
background: ${e?"#e3f2fd":"#fff"};
|
|
616
|
+
"
|
|
617
|
+
@mouseenter=${t=>{e||(t.currentTarget.style.borderColor="var(--primary)",t.currentTarget.style.boxShadow="0 2px 4px rgba(0,0,0,0.1)")}}
|
|
618
|
+
@mouseleave=${t=>{e||(t.currentTarget.style.borderColor="#e0e0e0",t.currentTarget.style.boxShadow="none")}}
|
|
619
|
+
>
|
|
620
|
+
<cdtr-row justify="space-between" alignItems="center">
|
|
621
|
+
<cdtr-title
|
|
622
|
+
style="font-size: 14px; color: ${e?"var(--primary)":"#000"}; font-weight: ${e?"600":"400"};"
|
|
623
|
+
>
|
|
624
|
+
<lang-text text="${t.name}"></lang-text>
|
|
625
|
+
</cdtr-title>
|
|
626
|
+
${e?o.qy`
|
|
627
|
+
<span
|
|
628
|
+
style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
|
|
629
|
+
>✓</span
|
|
630
|
+
>
|
|
631
|
+
`:null}
|
|
632
|
+
</cdtr-row>
|
|
633
|
+
</div>
|
|
634
|
+
`})}
|
|
635
|
+
<!-- coming soon -->
|
|
636
|
+
<h6 align="center">
|
|
637
|
+
<lang-text whiteSpace="break-spaces" text="coming_soon_automations"></lang-text>
|
|
638
|
+
</h6>
|
|
639
|
+
</div>
|
|
640
|
+
</div>
|
|
641
|
+
`}renderAutomationDetails(){const t=this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0;return o.qy`
|
|
642
|
+
<div
|
|
643
|
+
class="automation-details-view"
|
|
644
|
+
style="display: flex; flex-direction: column; height: 100%;"
|
|
645
|
+
>
|
|
646
|
+
<div style="flex: 0 0 auto;">
|
|
647
|
+
<cdtr-row justify="space-between" alignItems="center" mb="1">
|
|
648
|
+
<cdtr-title
|
|
649
|
+
style="font-weight: 700; font-size: 14.4px; color: #000000b0;"
|
|
650
|
+
>
|
|
651
|
+
<lang-text text="automation_settings"></lang-text>
|
|
652
|
+
</cdtr-title>
|
|
653
|
+
<paper-button
|
|
654
|
+
@click=${this.onBackClick}
|
|
655
|
+
style="padding: 0.4em; color: var(--primary); background: none; box-shadow: none;"
|
|
656
|
+
>
|
|
657
|
+
<lang-text text="back"></lang-text>
|
|
658
|
+
</paper-button>
|
|
659
|
+
</cdtr-row>
|
|
660
|
+
<cdtr-divider></cdtr-divider>
|
|
661
|
+
</div>
|
|
662
|
+
|
|
663
|
+
<div class="automation-content">
|
|
664
|
+
<!-- Success Message -->
|
|
665
|
+
${this.showSaveSuccess?o.qy`
|
|
666
|
+
<style>
|
|
667
|
+
.save-success-container {
|
|
668
|
+
margin-bottom: 1rem;
|
|
669
|
+
animation: slideDown 0.3s ease-out, fadeOut 0.3s ease-in 2.7s forwards;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.save-success-content {
|
|
673
|
+
display: flex;
|
|
674
|
+
align-items: center;
|
|
675
|
+
gap: 12px;
|
|
676
|
+
background: #e8f5e9;
|
|
677
|
+
border: 1px solid #4caf50;
|
|
678
|
+
color: #2e7d32;
|
|
679
|
+
padding: 12px 16px;
|
|
680
|
+
border-radius: 6px;
|
|
681
|
+
animation: scaleIn 0.3s ease-out;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.success-icon {
|
|
685
|
+
display: flex;
|
|
686
|
+
align-items: center;
|
|
687
|
+
justify-content: center;
|
|
688
|
+
width: 20px;
|
|
689
|
+
height: 20px;
|
|
690
|
+
background: #4caf50;
|
|
691
|
+
border-radius: 50%;
|
|
692
|
+
flex-shrink: 0;
|
|
693
|
+
animation: iconBounce 0.5s ease-out 0.2s both;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
.success-icon svg {
|
|
697
|
+
width: 14px;
|
|
698
|
+
height: 14px;
|
|
699
|
+
color: white;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
.success-text {
|
|
703
|
+
font-size: 13px;
|
|
704
|
+
font-weight: 500;
|
|
705
|
+
flex: 1;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
@keyframes slideDown {
|
|
709
|
+
from {
|
|
710
|
+
transform: translateY(-10px);
|
|
711
|
+
opacity: 0;
|
|
712
|
+
}
|
|
713
|
+
to {
|
|
714
|
+
transform: translateY(0);
|
|
715
|
+
opacity: 1;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
@keyframes fadeOut {
|
|
720
|
+
from {
|
|
721
|
+
opacity: 1;
|
|
722
|
+
transform: translateY(0);
|
|
723
|
+
}
|
|
724
|
+
to {
|
|
725
|
+
opacity: 0;
|
|
726
|
+
transform: translateY(-10px);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
@keyframes scaleIn {
|
|
731
|
+
from {
|
|
732
|
+
transform: scale(0.95);
|
|
733
|
+
opacity: 0;
|
|
734
|
+
}
|
|
735
|
+
to {
|
|
736
|
+
transform: scale(1);
|
|
737
|
+
opacity: 1;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
@keyframes iconBounce {
|
|
742
|
+
0% {
|
|
743
|
+
transform: scale(0);
|
|
744
|
+
opacity: 0;
|
|
745
|
+
}
|
|
746
|
+
50% {
|
|
747
|
+
transform: scale(1.2);
|
|
748
|
+
}
|
|
749
|
+
100% {
|
|
750
|
+
transform: scale(1);
|
|
751
|
+
opacity: 1;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
</style>
|
|
755
|
+
<div class="save-success-container">
|
|
756
|
+
<div class="save-success-content">
|
|
757
|
+
<div class="success-icon">
|
|
758
|
+
<svg
|
|
759
|
+
width="24"
|
|
760
|
+
height="24"
|
|
761
|
+
viewBox="0 0 24 24"
|
|
762
|
+
fill="none"
|
|
763
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
764
|
+
>
|
|
765
|
+
<path
|
|
766
|
+
d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"
|
|
767
|
+
fill="currentColor"
|
|
768
|
+
/>
|
|
769
|
+
</svg>
|
|
770
|
+
</div>
|
|
771
|
+
<span class="success-text">
|
|
772
|
+
<lang-text text="saved_successfully"></lang-text>
|
|
773
|
+
</span>
|
|
774
|
+
</div>
|
|
775
|
+
</div>
|
|
776
|
+
`:null}
|
|
777
|
+
|
|
778
|
+
<!-- URL Input (Optional) -->
|
|
779
|
+
<div style="margin-bottom: 1.5rem;">
|
|
780
|
+
<cdtr-title
|
|
781
|
+
style="font-size: 13px; color: #666; margin-bottom: 0.5rem; font-weight: 500;"
|
|
782
|
+
>
|
|
783
|
+
<lang-text text="url"></lang-text> (Optional)
|
|
784
|
+
</cdtr-title>
|
|
785
|
+
${v({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=y(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%;"})}
|
|
786
|
+
</div>
|
|
787
|
+
|
|
788
|
+
<h6
|
|
789
|
+
class="explain-title"
|
|
790
|
+
style="margin-bottom: 1rem; font-size: 14px; color: #666;"
|
|
791
|
+
>
|
|
792
|
+
<lang-text whiteSpace="break-spaces" text="what_should_happen"></lang-text>
|
|
793
|
+
</h6>
|
|
794
|
+
|
|
795
|
+
<!-- Tabs -->
|
|
796
|
+
<div
|
|
797
|
+
style="margin-bottom: 1.5rem; border-bottom: 1px solid #e0e0e0;"
|
|
798
|
+
>
|
|
799
|
+
<cdtr-row spacing="0">
|
|
800
|
+
<paper-button
|
|
801
|
+
@click=${()=>this.onTabChange("add")}
|
|
802
|
+
style="
|
|
803
|
+
background: ${"add"===this.activeTab?"var(--primary)":"transparent"};
|
|
804
|
+
color: ${"add"===this.activeTab?"#fff":"var(--primary)"};
|
|
805
|
+
padding: 0.6em 1.5em;
|
|
806
|
+
font-size: 14px;
|
|
807
|
+
text-transform: none;
|
|
808
|
+
border-radius: 4px 4px 0 0;
|
|
809
|
+
margin-right: 0.5rem;
|
|
810
|
+
box-shadow: none;
|
|
811
|
+
"
|
|
812
|
+
>
|
|
813
|
+
<lang-text text="add_to_mailing_list_question"></lang-text>
|
|
814
|
+
</paper-button>
|
|
815
|
+
<paper-button
|
|
816
|
+
@click=${()=>this.onTabChange("remove")}
|
|
817
|
+
style="
|
|
818
|
+
background: ${"remove"===this.activeTab?"#f44336":"transparent"};
|
|
819
|
+
color: ${"remove"===this.activeTab?"#fff":"#f44336"};
|
|
820
|
+
padding: 0.6em 1.5em;
|
|
821
|
+
font-size: 14px;
|
|
822
|
+
text-transform: none;
|
|
823
|
+
border-radius: 4px 4px 0 0;
|
|
824
|
+
box-shadow: none;
|
|
825
|
+
"
|
|
826
|
+
>
|
|
827
|
+
<lang-text
|
|
828
|
+
text="remove_from_mailing_list_question"
|
|
829
|
+
></lang-text>
|
|
830
|
+
</paper-button>
|
|
831
|
+
</cdtr-row>
|
|
832
|
+
</div>
|
|
833
|
+
|
|
834
|
+
<!-- Add to mailing list section -->
|
|
835
|
+
${"add"===this.activeTab?o.qy`
|
|
836
|
+
<div class="action-section">
|
|
837
|
+
<div class="mailing-lists-list" style="padding-left: 1rem;">
|
|
838
|
+
${this.mailingLists.map(t=>{const e=this.selectedMailingListsForAdd.includes(t.id);return o.qy`
|
|
839
|
+
<div
|
|
840
|
+
class="mailing-list-item ${e?"selected":""}"
|
|
841
|
+
@click=${()=>this.onMailingListToggle(t.id,"add")}
|
|
842
|
+
style="
|
|
843
|
+
padding: 0.75rem;
|
|
844
|
+
margin-bottom: 0.5rem;
|
|
845
|
+
cursor: pointer;
|
|
846
|
+
border-radius: 4px;
|
|
847
|
+
transition: all 0.2s;
|
|
848
|
+
border: 2px solid ${e?"var(--primary)":"#e0e0e0"};
|
|
849
|
+
background: ${e?"#e3f2fd":"#fff"};
|
|
850
|
+
"
|
|
851
|
+
@mouseenter=${t=>{e||(t.currentTarget.style.borderColor="var(--primary)",t.currentTarget.style.background="#f5f5f5")}}
|
|
852
|
+
@mouseleave=${t=>{e||(t.currentTarget.style.borderColor="#e0e0e0",t.currentTarget.style.background="#fff")}}
|
|
853
|
+
>
|
|
854
|
+
<cdtr-row
|
|
855
|
+
justify="space-between"
|
|
856
|
+
alignItems="center"
|
|
857
|
+
>
|
|
858
|
+
<cdtr-title
|
|
859
|
+
style="font-size: 13px; color: ${e?"var(--primary)":"#333"}; font-weight: ${e?"600":"400"};"
|
|
860
|
+
>
|
|
861
|
+
${t.name}
|
|
862
|
+
</cdtr-title>
|
|
863
|
+
${e?o.qy`
|
|
864
|
+
<span
|
|
865
|
+
style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
|
|
866
|
+
>✓</span
|
|
867
|
+
>
|
|
868
|
+
`:o.qy`
|
|
869
|
+
<span
|
|
870
|
+
style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
|
|
871
|
+
>○</span
|
|
872
|
+
>
|
|
873
|
+
`}
|
|
874
|
+
</cdtr-row>
|
|
875
|
+
</div>
|
|
876
|
+
`})}
|
|
877
|
+
</div>
|
|
878
|
+
</div>
|
|
879
|
+
`:null}
|
|
880
|
+
|
|
881
|
+
<!-- Remove from mailing list section -->
|
|
882
|
+
${"remove"===this.activeTab?o.qy`
|
|
883
|
+
<div class="action-section">
|
|
884
|
+
<div class="mailing-lists-list" style="padding-left: 1rem;">
|
|
885
|
+
${this.mailingLists.map(t=>{const e=this.selectedMailingListsForRemove.includes(t.id);return o.qy`
|
|
886
|
+
<div
|
|
887
|
+
class="mailing-list-item ${e?"selected":""}"
|
|
888
|
+
@click=${()=>this.onMailingListToggle(t.id,"remove")}
|
|
889
|
+
style="
|
|
890
|
+
padding: 0.75rem;
|
|
891
|
+
margin-bottom: 0.5rem;
|
|
892
|
+
cursor: pointer;
|
|
893
|
+
border-radius: 4px;
|
|
894
|
+
transition: all 0.2s;
|
|
895
|
+
border: 2px solid ${e?"#f44336":"#e0e0e0"};
|
|
896
|
+
background: ${e?"#ffebee":"#fff"};
|
|
897
|
+
"
|
|
898
|
+
@mouseenter=${t=>{e||(t.currentTarget.style.borderColor="#f44336",t.currentTarget.style.background="#f5f5f5")}}
|
|
899
|
+
@mouseleave=${t=>{e||(t.currentTarget.style.borderColor="#e0e0e0",t.currentTarget.style.background="#fff")}}
|
|
900
|
+
>
|
|
901
|
+
<cdtr-row
|
|
902
|
+
justify="space-between"
|
|
903
|
+
alignItems="center"
|
|
904
|
+
>
|
|
905
|
+
<cdtr-title
|
|
906
|
+
style="font-size: 13px; color: ${e?"#f44336":"#333"}; font-weight: ${e?"600":"400"};"
|
|
907
|
+
>
|
|
908
|
+
${t.name}
|
|
909
|
+
</cdtr-title>
|
|
910
|
+
${e?o.qy`
|
|
911
|
+
<span
|
|
912
|
+
style="color: #f44336; font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
|
|
913
|
+
>✓</span
|
|
914
|
+
>
|
|
915
|
+
`:o.qy`
|
|
916
|
+
<span
|
|
917
|
+
style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
|
|
918
|
+
>○</span
|
|
919
|
+
>
|
|
920
|
+
`}
|
|
921
|
+
</cdtr-row>
|
|
922
|
+
</div>
|
|
923
|
+
`})}
|
|
924
|
+
</div>
|
|
925
|
+
</div>
|
|
926
|
+
`:null}
|
|
927
|
+
</div>
|
|
928
|
+
|
|
929
|
+
<div
|
|
930
|
+
class="automation-footer"
|
|
931
|
+
style="flex: 0 0 auto; padding: 10px; border-top: 1px solid #e0e0e0; background: #fff;"
|
|
932
|
+
>
|
|
933
|
+
<cdtr-row justify="flex-end">
|
|
934
|
+
<paper-button
|
|
935
|
+
@click=${this.onSaveAutomation}
|
|
936
|
+
?disabled=${!t}
|
|
937
|
+
style="
|
|
938
|
+
background: ${t?"var(--primary)":"#ccc"};
|
|
939
|
+
color: #fff;
|
|
940
|
+
padding: 0.6em 1.5em;
|
|
941
|
+
font-size: 14px;
|
|
942
|
+
text-transform: none;
|
|
943
|
+
cursor: ${t?"pointer":"not-allowed"};
|
|
944
|
+
"
|
|
945
|
+
>
|
|
946
|
+
<lang-text text="save"></lang-text>
|
|
947
|
+
</paper-button>
|
|
948
|
+
</cdtr-row>
|
|
949
|
+
</div>
|
|
950
|
+
</div>
|
|
951
|
+
`}}}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 w extends(x(o.WF)){constructor(){super(),(0,s.A)(this,"inputRef",(0,l._)()),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=d,this.body="",this.subject="",this.name=n.M.get("lang",d[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:n,target:r,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=b(e,i,s,o,n,r);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=y(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=function(){const t=n.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const n="anchor"===o.text,r=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:n,clearParams:r}}(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[u];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=n.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 s=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==s){this._lastBodySyncHref=s,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");s.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[u]?(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 a=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:n.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const d=String(i.href||""),h=d.match(/^\[\[([^\]]+)\]\]\?/),p=i.params&&i.params[u];if(h)c=d;else if(p){const t=m,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=n.M.get("config","editor","configure","editorProps","automations"),w={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}},$=null!=c&&""!==c?String(c):"",k=this._urlInputRawValue!==$,A=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!A;k&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):k||(this._lastSyncedMyHref=$);const R=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,l.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:R};return this.showAutomations?o.qy` <div class="root">${this.renderAutomationsView()}</div>`:o.qy` <div class="root">
|
|
952
|
+
${q=this.label,q?o.qy`<cdtr-title
|
|
953
|
+
style="font-weight: 700;
|
|
954
|
+
font-size: 14.4px;
|
|
955
|
+
margin-bottom: 0.6rem;
|
|
956
|
+
color: #000000b0;"
|
|
957
|
+
><lang-text text=${q}></lang-text
|
|
958
|
+
><cdtr-divider></cdtr-divider
|
|
959
|
+
></cdtr-title>`:null}
|
|
960
|
+
<cdtr-row alignItems="center" justify="space-between" spacing="10">
|
|
961
|
+
${E=this.options,B=this.protocol,M=this.onChangeType.bind(this),o.qy`
|
|
962
|
+
<cdtr-dropdown @change=${t=>M(t.target.value)}>
|
|
963
|
+
<cdtr-dropdown-button
|
|
964
|
+
minWidth=${100}
|
|
965
|
+
class=" dropdown-button"
|
|
966
|
+
slot="trigger"
|
|
967
|
+
><lang-text
|
|
968
|
+
.text="${E.find(t=>t.type===B)?.text||"link"}"
|
|
969
|
+
></lang-text>
|
|
970
|
+
</cdtr-dropdown-button>
|
|
971
|
+
<div slot="content">
|
|
972
|
+
${E.map(t=>o.qy`<cdtr-dropdown-item
|
|
973
|
+
.focused=${t.type===B}
|
|
974
|
+
.selected=${t.type===B}
|
|
975
|
+
value="${t.type}"
|
|
976
|
+
><lang-text text="${t.text}"></lang-text>
|
|
977
|
+
</cdtr-dropdown-item>`)}
|
|
978
|
+
</div>
|
|
979
|
+
</cdtr-dropdown>
|
|
980
|
+
`}
|
|
981
|
+
${L=this.target,U=this.onChangeTarget.bind(this),o.qy`
|
|
982
|
+
<cdtr-dropdown @change=${t=>U(t)} style="min-width: 120px;">
|
|
983
|
+
<cdtr-dropdown-button minWidth=${120} class="dropdown-button" slot="trigger">
|
|
984
|
+
<lang-text .text=${L}></lang-text>
|
|
985
|
+
</cdtr-dropdown-button>
|
|
986
|
+
<div slot="content">
|
|
987
|
+
<cdtr-dropdown-item value="_blank" .selected=${"_blank"===L}>
|
|
988
|
+
<lang-text text="open_in_new_tab"></lang-text>
|
|
989
|
+
</cdtr-dropdown-item>
|
|
990
|
+
<cdtr-dropdown-item value="_self" .selected=${"_self"===L}>
|
|
991
|
+
<lang-text text="open_in_same_tab"></lang-text>
|
|
992
|
+
</cdtr-dropdown-item>
|
|
993
|
+
<cdtr-dropdown-item value="_parent" .selected=${"_parent"===L}>
|
|
994
|
+
<lang-text text="open_in_parent_frame"></lang-text>
|
|
995
|
+
</cdtr-dropdown-item>
|
|
996
|
+
<cdtr-dropdown-item value="_top" .selected=${"_top"===L}>
|
|
997
|
+
<lang-text text="open_in_top_frame"></lang-text>
|
|
998
|
+
</cdtr-dropdown-item>
|
|
999
|
+
</div>
|
|
1000
|
+
</cdtr-dropdown>
|
|
1001
|
+
`}
|
|
1002
|
+
</cdtr-row>
|
|
1003
|
+
<cdtr-row mt="1">
|
|
1004
|
+
${function(t,e){return 0===t.length?null:o.qy`${t.map(t=>o.qy`<paper-button
|
|
1005
|
+
@click=${()=>e(t.type)}
|
|
1006
|
+
style="background:rgb(233, 237, 243);color:#000;font-size:13px;margin:0;margin-right:5px;"
|
|
1007
|
+
><lang-text text="${t.text}"></lang-text
|
|
1008
|
+
></paper-button>`)}`}(a,this.onChangeType.bind(this))}
|
|
1009
|
+
</cdtr-row>
|
|
1010
|
+
|
|
1011
|
+
<div class="input-wrapper">
|
|
1012
|
+
<cdtr-title class="explain-title"
|
|
1013
|
+
><lang-text .text="${f}"></lang-text
|
|
1014
|
+
></cdtr-title>
|
|
1015
|
+
${function(t){const{protocol:e,url:i,autofocus:s,inputRef:o,onChangeLink:n,onBlur:r,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:v({value:c,inputRef:o,autofocus:s,onChange:n,onBlur:r,onFocus:a,onKeyDown:l})}(S)}
|
|
1016
|
+
${g(this.protocol,w)}
|
|
1017
|
+
${x?o.qy` <cdtr-divider></cdtr-divider>
|
|
1018
|
+
<cdtr-row justify="flex-start" mt="1">
|
|
1019
|
+
<cdtr-title class="explain-title"
|
|
1020
|
+
><lang-text
|
|
1021
|
+
whiteSpace="break-spaces"
|
|
1022
|
+
text="need_automations"
|
|
1023
|
+
></lang-text>
|
|
1024
|
+
</cdtr-title>
|
|
1025
|
+
<paper-button
|
|
1026
|
+
@click=${this.onAutomationsClick.bind(this)}
|
|
1027
|
+
style="background:#000;color:#fff;font-size:13px;margin:0;width:100%;"
|
|
1028
|
+
>
|
|
1029
|
+
<lang-text text="menu_automations"></lang-text>
|
|
1030
|
+
</paper-button>
|
|
1031
|
+
<cdtr-divider></cdtr-divider
|
|
1032
|
+
></cdtr-row>`:null}
|
|
1033
|
+
${function(t,e,i,s){return t&&Array.isArray(t)&&0!==t.length?o.qy`<cdtr-list-picker
|
|
1034
|
+
.selected=${e}
|
|
1035
|
+
@change=${t=>{i({target:{value:t.target.value}}),s()}}
|
|
1036
|
+
heading="saved_links"
|
|
1037
|
+
.list=${t}
|
|
1038
|
+
></cdtr-list-picker>`:null}(t,c,this.onChangeLink.bind(this),this.onBlur.bind(this))}
|
|
1039
|
+
</div>
|
|
1040
|
+
|
|
1041
|
+
${C=this.hasButton,I=this.onClickOk.bind(this),C?o.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
|
|
1042
|
+
<cdtr-row justify="flex-end" mt="1">
|
|
1043
|
+
<paper-button fullWidth @click=${I} raised class="add-button">
|
|
1044
|
+
<lang-text text="add_now"></lang-text>
|
|
1045
|
+
</paper-button>
|
|
1046
|
+
</cdtr-row>`:null}
|
|
1047
|
+
</div>`;var C,I,L,U,E,B,M,q}}(0,s.A)(w,"styles",a),(0,s.A)(w,"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}}),customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",w)},88385(t,e,i){i.d(e,{A:()=>l});var s=i(24586);const o=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,}))$/)),n=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 n,r=-1!==o?t.substring(o+1):"";for(;null!==(n=i.exec(r));){const t=s(n[1]),i=s(n[2]);t&&(e[t]=i)}return e}function a(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class l{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){(0,s.A)(this,"protocol",""),(0,s.A)(this,"href",""),(0,s.A)(this,"fullHref",""),(0,s.A)(this,"target","_self"),(0,s.A)(this,"isEmail",!1),(0,s.A)(this,"isPhone",!1),(0,s.A)(this,"isAnchor",!1),(0,s.A)(this,"url",""),(0,s.A)(this,"isValid",!0),(0,s.A)(this,"params",{}),"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??l.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=o(i),this.isPhone=n(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=a(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const c="http:"===this.protocol||"https:"===this.protocol;this.href=c?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}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("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)}}(0,s.A)(l,"resetURL",a)}}]);
|