@creaditor/web-starterkit 1.0.39 → 1.0.41

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.
Files changed (107) hide show
  1. package/dist/3847.creaditor.bundle.js +173 -116
  2. package/dist/3847.creaditor.bundle.js.gz +0 -0
  3. package/dist/5156.creaditor.bundle.js +1 -1
  4. package/dist/5156.creaditor.bundle.js.gz +0 -0
  5. package/dist/5909.creaditor.bundle.js +19 -19
  6. package/dist/5909.creaditor.bundle.js.gz +0 -0
  7. package/dist/7209.creaditor.bundle.js +32 -30
  8. package/dist/7209.creaditor.bundle.js.gz +0 -0
  9. package/dist/767.creaditor.bundle.js +26 -70
  10. package/dist/767.creaditor.bundle.js.gz +0 -0
  11. package/dist/8547.creaditor.bundle.js +1 -1
  12. package/dist/8547.creaditor.bundle.js.gz +0 -0
  13. package/dist/8646.creaditor.bundle.js +36 -37
  14. package/dist/8646.creaditor.bundle.js.gz +0 -0
  15. package/dist/creaditor.bundle.js +554 -224
  16. package/dist/creaditor.bundle.js.gz +0 -0
  17. package/dist/service-worker.js +1 -1
  18. package/dist/service-worker.js.gz +0 -0
  19. package/package.json +2 -2
  20. package/dist/1260.creaditor.bundle.js +0 -459
  21. package/dist/1260.creaditor.bundle.js.gz +0 -0
  22. package/dist/1393.creaditor.bundle.js +0 -1
  23. package/dist/1393.creaditor.bundle.js.gz +0 -0
  24. package/dist/1452.creaditor.bundle.js +0 -23
  25. package/dist/1452.creaditor.bundle.js.gz +0 -0
  26. package/dist/1565.creaditor.bundle.js +0 -1216
  27. package/dist/1565.creaditor.bundle.js.gz +0 -0
  28. package/dist/1756.creaditor.bundle.js +0 -1
  29. package/dist/1756.creaditor.bundle.js.gz +0 -0
  30. package/dist/1936.creaditor.bundle.js +0 -177
  31. package/dist/1936.creaditor.bundle.js.LICENSE.txt +0 -29
  32. package/dist/1936.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  33. package/dist/1936.creaditor.bundle.js.gz +0 -0
  34. package/dist/2438.creaditor.bundle.js +0 -67
  35. package/dist/2438.creaditor.bundle.js.gz +0 -0
  36. package/dist/2834.creaditor.bundle.js +0 -14
  37. package/dist/2834.creaditor.bundle.js.LICENSE.txt +0 -5
  38. package/dist/2834.creaditor.bundle.js.gz +0 -0
  39. package/dist/307.creaditor.bundle.js +0 -23
  40. package/dist/307.creaditor.bundle.js.gz +0 -0
  41. package/dist/3095.creaditor.bundle.js +0 -194
  42. package/dist/3095.creaditor.bundle.js.gz +0 -0
  43. package/dist/365.creaditor.bundle.js +0 -26
  44. package/dist/365.creaditor.bundle.js.gz +0 -0
  45. package/dist/3778.creaditor.bundle.js +0 -1
  46. package/dist/3778.creaditor.bundle.js.gz +0 -0
  47. package/dist/3932.creaditor.bundle.js +0 -30
  48. package/dist/3932.creaditor.bundle.js.gz +0 -0
  49. package/dist/4217.creaditor.bundle.js +0 -105
  50. package/dist/4217.creaditor.bundle.js.gz +0 -0
  51. package/dist/453.creaditor.bundle.js.LICENSE.txt +0 -5
  52. package/dist/4569.creaditor.bundle.js +0 -887
  53. package/dist/4569.creaditor.bundle.js.gz +0 -0
  54. package/dist/4739.creaditor.bundle.js +0 -1
  55. package/dist/4739.creaditor.bundle.js.gz +0 -0
  56. package/dist/4970.creaditor.bundle.js +0 -1316
  57. package/dist/4970.creaditor.bundle.js.gz +0 -0
  58. package/dist/5340.creaditor.bundle.js +0 -157
  59. package/dist/5340.creaditor.bundle.js.gz +0 -0
  60. package/dist/5428.creaditor.bundle.js +0 -23
  61. package/dist/5428.creaditor.bundle.js.gz +0 -0
  62. package/dist/5813.creaditor.bundle.js +0 -613
  63. package/dist/5813.creaditor.bundle.js.LICENSE.txt +0 -10
  64. package/dist/5813.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  65. package/dist/5813.creaditor.bundle.js.gz +0 -0
  66. package/dist/6151.creaditor.bundle.js +0 -1
  67. package/dist/6151.creaditor.bundle.js.gz +0 -0
  68. package/dist/6459.creaditor.bundle.js +0 -23
  69. package/dist/6459.creaditor.bundle.js.gz +0 -0
  70. package/dist/6713.creaditor.bundle.js +0 -151
  71. package/dist/6713.creaditor.bundle.js.gz +0 -0
  72. package/dist/763.creaditor.bundle.js +0 -1
  73. package/dist/763.creaditor.bundle.js.gz +0 -0
  74. package/dist/7759.creaditor.bundle.js +0 -25
  75. package/dist/7759.creaditor.bundle.js.gz +0 -0
  76. package/dist/8141.creaditor.bundle.js.LICENSE.txt +0 -5
  77. package/dist/8303.creaditor.bundle.js +0 -57
  78. package/dist/8303.creaditor.bundle.js.LICENSE.txt +0 -10
  79. package/dist/8303.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  80. package/dist/8303.creaditor.bundle.js.gz +0 -0
  81. package/dist/8305.creaditor.bundle.js +0 -32
  82. package/dist/8305.creaditor.bundle.js.gz +0 -0
  83. package/dist/8386.creaditor.bundle.js +0 -1420
  84. package/dist/8386.creaditor.bundle.js.gz +0 -0
  85. package/dist/84702e107adede1a967468c78921d455.mp4 +0 -0
  86. package/dist/8478.creaditor.bundle.js +0 -1
  87. package/dist/8478.creaditor.bundle.js.gz +0 -0
  88. package/dist/8676.creaditor.bundle.js +0 -24
  89. package/dist/8676.creaditor.bundle.js.gz +0 -0
  90. package/dist/88.creaditor.bundle.js +0 -1
  91. package/dist/88.creaditor.bundle.js.gz +0 -0
  92. package/dist/8876.creaditor.bundle.js +0 -25
  93. package/dist/8876.creaditor.bundle.js.LICENSE.txt +0 -32
  94. package/dist/8876.creaditor.bundle.js.LICENSE.txt.gz +0 -0
  95. package/dist/8876.creaditor.bundle.js.gz +0 -0
  96. package/dist/9089.creaditor.bundle.js +0 -21
  97. package/dist/9089.creaditor.bundle.js.gz +0 -0
  98. package/dist/9162.creaditor.bundle.js +0 -24
  99. package/dist/9162.creaditor.bundle.js.gz +0 -0
  100. package/dist/9184.creaditor.bundle.js +0 -23
  101. package/dist/9184.creaditor.bundle.js.gz +0 -0
  102. package/dist/9193.creaditor.bundle.js +0 -1
  103. package/dist/9193.creaditor.bundle.js.gz +0 -0
  104. package/dist/9338.creaditor.bundle.js +0 -1
  105. package/dist/9338.creaditor.bundle.js.gz +0 -0
  106. package/dist/951.creaditor.bundle.js +0 -1
  107. package/dist/951.creaditor.bundle.js.gz +0 -0
@@ -1,887 +0,0 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[380,4569],{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
- row=${this.row||4}
3
- .disabled=${this.disabled}
4
- dir="auto"
5
- ${(0,o.K)(this.inputRef)}
6
- style="${this.inputStyle}"
7
- .autofocus="${this.autofocus}"
8
- .placeholder="${t}"
9
- @input="${this.setValue}"
10
- @change="${this.setValue}"
11
- .min="${String(this.min)}"
12
- .max="${String(this.max)}"
13
- .step="${String(this.step)}"
14
- .value="${String(this.value)}"
15
- />`:s.qy` <input
16
- .disabled=${this.disabled}
17
- dir="auto"
18
- ${(0,o.K)(this.inputRef)}
19
- style="${this.inputStyle}"
20
- .autofocus="${this.autofocus}"
21
- .placeholder="${t}"
22
- @input="${this.setValue}"
23
- @change="${this.setValue}"
24
- .min="${String(this.min)}"
25
- .type="${this.type}"
26
- .max="${String(this.max)}"
27
- .step="${String(this.step)}"
28
- .value="${String(this.value)}"
29
- />`;return s.qy`<form @submit=${this.onSubmit}>
30
- ${e}
31
- ${!this.icon||this.couchOnEmpty||this.successActive?null:s.qy`<cdtr-icon
32
- color="#d9d9d9"
33
- width=${20}
34
- height=${20}
35
- style="position: absolute;
36
- transform: translateY(-50%);top:50%;z-index:1;
37
- left: 10px;"
38
- icon="${this.icon}"
39
- ></cdtr-icon>`}
40
- ${this.successActive?s.qy`<div class="success-overlay" aria-live="polite">
41
- <cdtr-couch-mark></cdtr-couch-mark>
42
- <span class="success-icon">✓</span>
43
- </div>`:null}
44
- ${!this.couchOnEmpty||this.value||this.successActive?null:s.qy`<cdtr-couch-mark
45
- style="position: absolute;
46
- transform: translateY(-50%);
47
- left: 0;"
48
- ></cdtr-couch-mark>`}
49
- ${"text"===this.type&&this.maxLength?s.qy`<span class="counter"
50
- >${this.value.length}/${this.maxLength}</span
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}}p.styles=s.AH`
53
- :host {
54
- display: inline-block;
55
- --cdtr-input-height: 30px;
56
- --cdtr-input-padding: 0.105rem 0.45rem;
57
- }
58
-
59
- form {
60
- position: relative;
61
- }
62
- .counter {
63
- font-size: 10px;
64
- }
65
- input,
66
- textarea {
67
- height: var(--cdtr-input-height);
68
- display: inline-block;
69
- width: 100%;
70
- padding: var(--cdtr-input-padding);
71
- font-size: 14px;
72
- font-weight: 400;
73
- line-height: 1.5;
74
- color: #212529;
75
- background: #fff;
76
- background-clip: padding-box;
77
- border: 1px solid #ced4da;
78
- -webkit-appearance: none;
79
- -moz-appearance: none;
80
- appearance: none;
81
- border-radius: 0.25rem;
82
- transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
83
- margin: 0;
84
- font-family: var(--font-family);
85
- border-color: var(--input-border-color);
86
- outline: var(--input-border-color);
87
- box-sizing: border-box;
88
- }
89
- textarea {
90
- height: auto;
91
- resize: none;
92
- }
93
- input:disabled,
94
- textrea:disabled,
95
- textareap[readonly],
96
- input[readonly] {
97
- background-color: #e9ecef;
98
- opacity: 0.5;
99
- }
100
- input:hover,
101
- textarea:hover {
102
- border-color: black;
103
- }
104
- input::placeholder,
105
- textarea::placeholder {
106
- font-family: var(--font-family);
107
- }
108
- input:focus,
109
- textarea:focus {
110
- border-color: var(--primary);
111
- }
112
- input[type="number"] {
113
- padding-right: 0px;
114
- padding-left: 4px;
115
- }
116
-
117
- input[type="number"] {
118
- -moz-appearance: textfield;
119
- }
120
-
121
- .success-overlay {
122
- position: absolute;
123
- top: 50%;
124
- left: 4px;
125
- transform: translateY(-50%);
126
- width: 28px;
127
- height: 28px;
128
- display: flex;
129
- align-items: center;
130
- justify-content: center;
131
- pointer-events: none;
132
- z-index: 2;
133
- }
134
-
135
- .success-overlay cdtr-couch-mark {
136
- position: absolute;
137
- top: 50%;
138
- left: 50%;
139
- transform: translate(-50%, -50%) scale(0.75);
140
- opacity: 0.85;
141
- }
142
-
143
- .success-overlay .success-icon {
144
- position: absolute;
145
- top: 50%;
146
- left: 50%;
147
- width: 20px;
148
- height: 20px;
149
- border-radius: 999px;
150
- display: flex;
151
- align-items: center;
152
- justify-content: center;
153
- background: var(--primary);
154
- color: #f6fff9;
155
- font-size: 14px;
156
- font-weight: 600;
157
- transform: translate(-50%, -50%) scale(0.85);
158
- opacity: 0;
159
- animation: successPop 0.32s ease-out forwards;
160
- box-shadow: 0 0 6px rgba(79, 192, 111, 0.25);
161
- }
162
-
163
- @keyframes successPop {
164
- 0% {
165
- transform: translate(-50%, -50%) scale(0.85);
166
- opacity: 0;
167
- }
168
- 50% {
169
- transform: translate(-50%, -50%) scale(1.05);
170
- opacity: 1;
171
- }
172
- 100% {
173
- transform: translate(-50%, -50%) scale(1);
174
- opacity: 1;
175
- }
176
- }
177
-
178
- @keyframes successGlow {
179
- 0% {
180
- box-shadow: 0 0 6px rgba(79, 192, 111, 0.25);
181
- }
182
- 100% {
183
- box-shadow: 0 0 10px rgba(79, 192, 111, 0.2);
184
- }
185
- }
186
- `,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)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>x});var s=i(59929),o=i(86319),r=i(88385);const n=s.AH`
187
- :host {
188
- --paper-radio-button-checked-color: var(--primary);
189
- box-sizing: border-box;
190
- }
191
- .anchor-dd {
192
- width: 100%;
193
- }
194
- cdtr-add-icon {
195
- --cdtr-icon-width: 16px;
196
- --cdtr-icon-height: 16px;
197
- --cdtr-icon-color: var(--dark);
198
- }
199
- cdtr-row {
200
- direction: var(--direction-locale);
201
- }
202
- paper-radio-button {
203
- padding: 0;
204
- display: flex;
205
- gap: 5px;
206
- margin-top: 8px;
207
- }
208
- .add-button {
209
- background: var(--primary);
210
- color: #fff;
211
- min-width:0;
212
- padding:6px;
213
- width:100%;
214
- }
215
- paper-item {
216
- width: 130px;
217
- cursor: pointer;
218
- }
219
- paper-item:hover {
220
- color: var(--primary);
221
- }
222
- .input-wrapper {
223
- width: 100%;
224
- position: relative;
225
- }
226
-
227
- paper-button {
228
- padding: 0.4em;
229
- color: var(--primary);
230
- }
231
- paper-button.indigo {
232
- background: var(--primary);
233
- color: white;
234
- }
235
-
236
- .input-wrapper cdtr-input {
237
- display: block;
238
- }
239
- .explain-title {
240
- margin: 20px 0 6px;
241
- }
242
- paper-item {
243
- text-align: var(--text-align-locale);
244
- direction: var(--direction-locale);
245
- }
246
- .link-type-dropdown {
247
- text-align: var(--text-align-locale);
248
- direction: var(--direction-locale);
249
- width: 50%;
250
- }
251
- .trigger-wrapper svg {
252
- width: 20px;
253
- cursor: pointer;
254
- fill: var(--dark);
255
- }
256
- .trigger-wrapper svg:hover {
257
- fill: var(--primary);
258
- }
259
- .demo-icon {
260
- position: absolute;
261
- left: 100%;
262
- transform: translate(-100%, -50%);
263
- top: 55%;
264
- }
265
- .automations-view {
266
- width: 100%;
267
- }
268
- .automation-card {
269
- padding: 1rem;
270
- border: 1px solid #e0e0e0;
271
- border-radius: 4px;
272
- margin-bottom: 0.5rem;
273
- cursor: pointer;
274
- transition: all 0.2s;
275
- }
276
- .automation-card:hover {
277
- border-color: var(--primary);
278
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
279
- }
280
- .automation-card.active {
281
- border-color: var(--primary);
282
- background: #e3f2fd;
283
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
284
- }
285
- .automation-card.active:hover {
286
- border-color: var(--primary);
287
- box-shadow: 0 2px 6px rgba(0,0,0,0.15);
288
- }
289
- .automation-details-view {
290
- width: 100%;
291
- min-height: 400px;
292
- display: flex;
293
- flex-direction: column;
294
- }
295
- .automation-content {
296
- overflow-y: auto;
297
- flex: 1 1 auto;
298
- min-height: 0;
299
- }
300
- .automation-footer {
301
- flex: 0 0 auto;
302
- position: sticky;
303
- bottom: 0;
304
- z-index: 10;
305
- background: #fff;
306
- }
307
- .mailing-lists-container {
308
- max-height: 300px;
309
- overflow-y: auto;
310
- }
311
- .mailing-list-item {
312
- padding: 0.5rem 0.75rem;
313
- border-radius: 4px;
314
- margin-bottom: 0.5rem;
315
- cursor: pointer;
316
- transition: all 0.2s;
317
- }
318
- .mailing-list-item:hover {
319
- background: rgba(0, 0, 0, 0.03);
320
- }
321
- .action-section {
322
- margin-bottom: 1.5rem;
323
- }
324
- .action-question {
325
- padding: 0.75rem 0;
326
- cursor: pointer;
327
- border-bottom: 1px solid #e0e0e0;
328
- transition: all 0.2s;
329
- }
330
- .action-question:hover {
331
- border-bottom-color: var(--primary);
332
- }
333
- .mailing-lists-list {
334
- margin-top: 0.75rem;
335
- padding-left: 1rem;
336
- }
337
- `;var a=i(21421);i(73095),i(70380);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],h="cdtrAdd",d="cdtrRemove",p="cdtrAutomation",u=[h,d,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function f(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:o,protocol:r,onChangeLink:n,onBlur:a,onRequest:l}=t;return s.qy`
338
- <cdtr-row alignItems="center" spacing="5">
339
- <cdtr-dropdown
340
- @change=${t=>{n({target:{value:"#"+t.target.value},anchor:!0}),a()}}
341
- .opened=${i.length>0&&"anchor:"===r&&!o}
342
- class="anchor-dd"
343
- >
344
- <cdtr-dropdown-button
345
- minWidth=${100}
346
- class=" dropdown-button"
347
- slot="trigger"
348
- ><lang-text .text=${e.isAnchor?o:""}></lang-text>
349
- </cdtr-dropdown-button>
350
- <div style="min-width:150px" slot="content">
351
- ${i.map(t=>s.qy`<cdtr-dropdown-item
352
- value="${t.props.name||t.props.element_ID}"
353
- >${t.props.name||t.props.element_ID}
354
- </cdtr-dropdown-item>`)}
355
- </div>
356
- </cdtr-dropdown>
357
- ${0===i.length?s.qy`<paper-button
358
- @click=${()=>{"function"===l&&l("anchor")}}
359
- ><cdtr-title
360
- ><lang-text text="create_anchor"></lang-text></cdtr-title
361
- ></paper-button>`:null}
362
- </cdtr-row>
363
- `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,h="string"==typeof e?m("subject",e):o||e.params.subject;return s.qy`
364
- <cdtr-row spacing="5">
365
- <cdtr-title class="explain-title"
366
- ><lang-text text="add_catchy_subject"></lang-text
367
- ></cdtr-title>
368
- <cdtr-input
369
- inputStyle="height:${"40px"};"
370
- style="width:${l};"
371
- @change=${t=>{let{target:e}=t;a(e.value),r()}}
372
- value=${h||o||""}
373
- ></cdtr-input>
374
- <cdtr-title class="explain-title"
375
- ><lang-text text="email_body_if_needed"></lang-text
376
- ></cdtr-title>
377
- <cdtr-input
378
- .multiline=${!0}
379
- value="${c||i||""}"
380
- style="width:${l};"
381
- @change=${t=>{let{target:e}=t;n(e.value),r()}}
382
- ></cdtr-input>
383
- </cdtr-row>
384
- `}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("body",e):e.params.body;return s.qy`
385
- <cdtr-row spacing="5">
386
- <cdtr-title class="explain-title"
387
- ><lang-text text="sms_body_if_needed"></lang-text
388
- ></cdtr-title>
389
- <cdtr-input
390
- .multiline=${!0}
391
- value="${n||i||""}"
392
- style="width:${l};"
393
- @change=${t=>{let{target:e}=t;r(e.value),o()}}
394
- ></cdtr-input>
395
- </cdtr-row>
396
- `}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("text",e)||m("body",e):e.params&&(e.params.text||e.params.body)||"";return s.qy`
397
- <cdtr-row spacing="5">
398
- <cdtr-title class="explain-title"
399
- ><lang-text text="whatsapp_body_if_needed"></lang-text
400
- ></cdtr-title>
401
- <cdtr-input
402
- .multiline=${!0}
403
- value="${n||i||""}"
404
- style="width:${l};"
405
- @change=${t=>{let{target:e}=t;r(e.value),o()}}
406
- ></cdtr-input>
407
- </cdtr-row>
408
- `}(e);default:return""}}function g(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let h=`https://wa.me/${a}`;c&&(h+=`?text=${c}`);const d=new r.A(h);return d.target=o||d.target||"_blank",{url:d,params:d.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function 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 b(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:h,placeholder:d="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
409
- <cdtr-row style="position:relative;" spacing="5">
410
- <span style="display:none;" aria-hidden="true">${e}</span>
411
- <cdtr-input
412
- .couchOnEmpty=${!0}
413
- ${i?(0,a.K)(i):""}
414
- style="${u}"
415
- inputStyle="${p}"
416
- .autofocus=${o}
417
- type="search"
418
- width="${m}"
419
- placeholder="${d}"
420
- @input=${t=>{if(t.target.selectionStart!==t.target.value.length)return;const e=t.target.value.trim();/^[^a-zA-Z0-9]+$/.test(e)||r&&r(t)}}
421
- @change=${f}
422
- @focus=${c}
423
- @submit=${h||f}
424
- .value="${g}"
425
- ></cdtr-input>
426
- </cdtr-row>
427
- `}function v(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||[];const e=o.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[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()}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(`${d}=${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[d]&&(a.params[d]=o[d]),a.params[p]=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[p])){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[d]&&(n.params[d]=s[d]),n.params[p]=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[p],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[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];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[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}}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():s.qy`
428
- <div class="automations-view">
429
- <cdtr-row justify="space-between" alignItems="center" mb="1">
430
- <cdtr-title
431
- style="font-weight: 700; font-size: 14.4px; color: #000000b0;"
432
- >
433
- <lang-text text="automations"></lang-text>
434
- </cdtr-title>
435
- <paper-button
436
- @click=${this.onBackClick}
437
- style="padding: 0.4em; color: var(--primary); background: none; box-shadow: none;"
438
- >
439
- <lang-text text="back"></lang-text>
440
- </paper-button>
441
- </cdtr-row>
442
- <cdtr-divider></cdtr-divider>
443
- <div class="automations-list" style="margin-top: 1rem;">
444
- ${this.automations.map(t=>{const e=this.activeAutomationId===t.id;return s.qy`
445
- <div
446
- class="automation-card ${e?"active":""}"
447
- @click=${()=>this.onAutomationClick(t)}
448
- style="
449
- padding: 1rem;
450
- border: 2px solid ${e?"var(--primary)":"#e0e0e0"};
451
- border-radius: 4px;
452
- margin-bottom: 0.5rem;
453
- cursor: pointer;
454
- transition: all 0.2s;
455
- background: ${e?"#e3f2fd":"#fff"};
456
- "
457
- @mouseenter=${t=>{e||(t.currentTarget.style.borderColor="var(--primary)",t.currentTarget.style.boxShadow="0 2px 4px rgba(0,0,0,0.1)")}}
458
- @mouseleave=${t=>{e||(t.currentTarget.style.borderColor="#e0e0e0",t.currentTarget.style.boxShadow="none")}}
459
- >
460
- <cdtr-row justify="space-between" alignItems="center">
461
- <cdtr-title
462
- style="font-size: 14px; color: ${e?"var(--primary)":"#000"}; font-weight: ${e?"600":"400"};"
463
- >
464
- <lang-text text="${t.name}"></lang-text>
465
- </cdtr-title>
466
- ${e?s.qy`
467
- <span
468
- style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
469
- >✓</span
470
- >
471
- `:null}
472
- </cdtr-row>
473
- </div>
474
- `})}
475
- <!-- coming soon -->
476
- <h6 align="center">
477
- <lang-text whiteSpace="break-spaces" text="coming_soon_automations"></lang-text>
478
- </h6>
479
- </div>
480
- </div>
481
- `}renderAutomationDetails(){const t=this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0;return s.qy`
482
- <div
483
- class="automation-details-view"
484
- style="display: flex; flex-direction: column; height: 100%;"
485
- >
486
- <div style="flex: 0 0 auto;">
487
- <cdtr-row justify="space-between" alignItems="center" mb="1">
488
- <cdtr-title
489
- style="font-weight: 700; font-size: 14.4px; color: #000000b0;"
490
- >
491
- <lang-text text="automation_settings"></lang-text>
492
- </cdtr-title>
493
- <paper-button
494
- @click=${this.onBackClick}
495
- style="padding: 0.4em; color: var(--primary); background: none; box-shadow: none;"
496
- >
497
- <lang-text text="back"></lang-text>
498
- </paper-button>
499
- </cdtr-row>
500
- <cdtr-divider></cdtr-divider>
501
- </div>
502
-
503
- <div class="automation-content">
504
- <!-- Success Message -->
505
- ${this.showSaveSuccess?s.qy`
506
- <style>
507
- .save-success-container {
508
- margin-bottom: 1rem;
509
- animation: slideDown 0.3s ease-out, fadeOut 0.3s ease-in 2.7s forwards;
510
- }
511
-
512
- .save-success-content {
513
- display: flex;
514
- align-items: center;
515
- gap: 12px;
516
- background: #e8f5e9;
517
- border: 1px solid #4caf50;
518
- color: #2e7d32;
519
- padding: 12px 16px;
520
- border-radius: 6px;
521
- animation: scaleIn 0.3s ease-out;
522
- }
523
-
524
- .success-icon {
525
- display: flex;
526
- align-items: center;
527
- justify-content: center;
528
- width: 20px;
529
- height: 20px;
530
- background: #4caf50;
531
- border-radius: 50%;
532
- flex-shrink: 0;
533
- animation: iconBounce 0.5s ease-out 0.2s both;
534
- }
535
-
536
- .success-icon svg {
537
- width: 14px;
538
- height: 14px;
539
- color: white;
540
- }
541
-
542
- .success-text {
543
- font-size: 13px;
544
- font-weight: 500;
545
- flex: 1;
546
- }
547
-
548
- @keyframes slideDown {
549
- from {
550
- transform: translateY(-10px);
551
- opacity: 0;
552
- }
553
- to {
554
- transform: translateY(0);
555
- opacity: 1;
556
- }
557
- }
558
-
559
- @keyframes fadeOut {
560
- from {
561
- opacity: 1;
562
- transform: translateY(0);
563
- }
564
- to {
565
- opacity: 0;
566
- transform: translateY(-10px);
567
- }
568
- }
569
-
570
- @keyframes scaleIn {
571
- from {
572
- transform: scale(0.95);
573
- opacity: 0;
574
- }
575
- to {
576
- transform: scale(1);
577
- opacity: 1;
578
- }
579
- }
580
-
581
- @keyframes iconBounce {
582
- 0% {
583
- transform: scale(0);
584
- opacity: 0;
585
- }
586
- 50% {
587
- transform: scale(1.2);
588
- }
589
- 100% {
590
- transform: scale(1);
591
- opacity: 1;
592
- }
593
- }
594
- </style>
595
- <div class="save-success-container">
596
- <div class="save-success-content">
597
- <div class="success-icon">
598
- <svg
599
- width="24"
600
- height="24"
601
- viewBox="0 0 24 24"
602
- fill="none"
603
- xmlns="http://www.w3.org/2000/svg"
604
- >
605
- <path
606
- d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"
607
- fill="currentColor"
608
- />
609
- </svg>
610
- </div>
611
- <span class="success-text">
612
- <lang-text text="saved_successfully"></lang-text>
613
- </span>
614
- </div>
615
- </div>
616
- `:null}
617
-
618
- <!-- URL Input (Optional) -->
619
- <div style="margin-bottom: 1.5rem;">
620
- <cdtr-title
621
- style="font-size: 13px; color: #666; margin-bottom: 0.5rem; font-weight: 500;"
622
- >
623
- <lang-text text="url"></lang-text> (Optional)
624
- </cdtr-title>
625
- ${b({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%;"})}
626
- </div>
627
-
628
- <h6
629
- class="explain-title"
630
- style="margin-bottom: 1rem; font-size: 14px; color: #666;"
631
- >
632
- <lang-text whiteSpace="break-spaces" text="what_should_happen"></lang-text>
633
- </h6>
634
-
635
- <!-- Tabs -->
636
- <div
637
- style="margin-bottom: 1.5rem; border-bottom: 1px solid #e0e0e0;"
638
- >
639
- <cdtr-row spacing="0">
640
- <paper-button
641
- @click=${()=>this.onTabChange("add")}
642
- style="
643
- background: ${"add"===this.activeTab?"var(--primary)":"transparent"};
644
- color: ${"add"===this.activeTab?"#fff":"var(--primary)"};
645
- padding: 0.6em 1.5em;
646
- font-size: 14px;
647
- text-transform: none;
648
- border-radius: 4px 4px 0 0;
649
- margin-right: 0.5rem;
650
- box-shadow: none;
651
- "
652
- >
653
- <lang-text text="add_to_mailing_list_question"></lang-text>
654
- </paper-button>
655
- <paper-button
656
- @click=${()=>this.onTabChange("remove")}
657
- style="
658
- background: ${"remove"===this.activeTab?"#f44336":"transparent"};
659
- color: ${"remove"===this.activeTab?"#fff":"#f44336"};
660
- padding: 0.6em 1.5em;
661
- font-size: 14px;
662
- text-transform: none;
663
- border-radius: 4px 4px 0 0;
664
- box-shadow: none;
665
- "
666
- >
667
- <lang-text
668
- text="remove_from_mailing_list_question"
669
- ></lang-text>
670
- </paper-button>
671
- </cdtr-row>
672
- </div>
673
-
674
- <!-- Add to mailing list section -->
675
- ${"add"===this.activeTab?s.qy`
676
- <div class="action-section">
677
- <div class="mailing-lists-list" style="padding-left: 1rem;">
678
- ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForAdd.includes(t.id);return s.qy`
679
- <div
680
- class="mailing-list-item ${e?"selected":""}"
681
- @click=${()=>this.onMailingListToggle(t.id,"add")}
682
- style="
683
- padding: 0.75rem;
684
- margin-bottom: 0.5rem;
685
- cursor: pointer;
686
- border-radius: 4px;
687
- transition: all 0.2s;
688
- border: 2px solid ${e?"var(--primary)":"#e0e0e0"};
689
- background: ${e?"#e3f2fd":"#fff"};
690
- "
691
- @mouseenter=${t=>{e||(t.currentTarget.style.borderColor="var(--primary)",t.currentTarget.style.background="#f5f5f5")}}
692
- @mouseleave=${t=>{e||(t.currentTarget.style.borderColor="#e0e0e0",t.currentTarget.style.background="#fff")}}
693
- >
694
- <cdtr-row
695
- justify="space-between"
696
- alignItems="center"
697
- >
698
- <cdtr-title
699
- style="font-size: 13px; color: ${e?"var(--primary)":"#333"}; font-weight: ${e?"600":"400"};"
700
- >
701
- ${t.name}
702
- </cdtr-title>
703
- ${e?s.qy`
704
- <span
705
- style="color: var(--primary); font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
706
- >✓</span
707
- >
708
- `:s.qy`
709
- <span
710
- style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
711
- >○</span
712
- >
713
- `}
714
- </cdtr-row>
715
- </div>
716
- `})}
717
- </div>
718
- </div>
719
- `:null}
720
-
721
- <!-- Remove from mailing list section -->
722
- ${"remove"===this.activeTab?s.qy`
723
- <div class="action-section">
724
- <div class="mailing-lists-list" style="padding-left: 1rem;">
725
- ${this.mailingLists.map(t=>{const e=this.selectedMailingListsForRemove.includes(t.id);return s.qy`
726
- <div
727
- class="mailing-list-item ${e?"selected":""}"
728
- @click=${()=>this.onMailingListToggle(t.id,"remove")}
729
- style="
730
- padding: 0.75rem;
731
- margin-bottom: 0.5rem;
732
- cursor: pointer;
733
- border-radius: 4px;
734
- transition: all 0.2s;
735
- border: 2px solid ${e?"#f44336":"#e0e0e0"};
736
- background: ${e?"#ffebee":"#fff"};
737
- "
738
- @mouseenter=${t=>{e||(t.currentTarget.style.borderColor="#f44336",t.currentTarget.style.background="#f5f5f5")}}
739
- @mouseleave=${t=>{e||(t.currentTarget.style.borderColor="#e0e0e0",t.currentTarget.style.background="#fff")}}
740
- >
741
- <cdtr-row
742
- justify="space-between"
743
- alignItems="center"
744
- >
745
- <cdtr-title
746
- style="font-size: 13px; color: ${e?"#f44336":"#333"}; font-weight: ${e?"600":"400"};"
747
- >
748
- ${t.name}
749
- </cdtr-title>
750
- ${e?s.qy`
751
- <span
752
- style="color: #f44336; font-weight: bold; font-size: 18px; margin-left: 0.5rem;"
753
- >✓</span
754
- >
755
- `:s.qy`
756
- <span
757
- style="color: #ddd; font-size: 18px; margin-left: 0.5rem;"
758
- >○</span
759
- >
760
- `}
761
- </cdtr-row>
762
- </div>
763
- `})}
764
- </div>
765
- </div>
766
- `:null}
767
- </div>
768
-
769
- <div
770
- class="automation-footer"
771
- style="flex: 0 0 auto; padding: 10px; border-top: 1px solid #e0e0e0; background: #fff;"
772
- >
773
- <cdtr-row justify="flex-end">
774
- <paper-button
775
- @click=${this.onSaveAutomation}
776
- ?disabled=${!t}
777
- style="
778
- background: ${t?"var(--primary)":"#ccc"};
779
- color: #fff;
780
- padding: 0.6em 1.5em;
781
- font-size: 14px;
782
- text-transform: none;
783
- cursor: ${t?"pointer":"not-allowed"};
784
- "
785
- >
786
- <lang-text text="save"></lang-text>
787
- </paper-button>
788
- </cdtr-row>
789
- </div>
790
- </div>
791
- `}}}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 x extends(v(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=g(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=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=o.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 r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const h=String(i.href||""),d=h.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(d)c=h;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const g=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),y=[...this.options],v=y.findIndex(t=>"http:"===t.type);v>-1&&y.splice(v,1);const x=o.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):"",A=this._urlInputRawValue!==$,k=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!k;A&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):A||(this._lastSyncedMyHref=$);const S=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:S};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
792
- ${j=this.label,j?s.qy`<cdtr-title
793
- style="font-weight: 700;
794
- font-size: 14.4px;
795
- margin-bottom: 0.6rem;
796
- color: #000000b0;"
797
- ><lang-text text=${j}></lang-text
798
- ><cdtr-divider></cdtr-divider
799
- ></cdtr-title>`:null}
800
- <cdtr-row alignItems="center" justify="space-between" spacing="10">
801
- ${M=this.options,F=this.protocol,q=this.onChangeType.bind(this),s.qy`
802
- <cdtr-dropdown @change=${t=>q(t.target.value)}>
803
- <cdtr-dropdown-button
804
- minWidth=${100}
805
- class=" dropdown-button"
806
- slot="trigger"
807
- ><lang-text
808
- .text="${M.find(t=>t.type===F)?.text||"link"}"
809
- ></lang-text>
810
- </cdtr-dropdown-button>
811
- <div slot="content">
812
- ${M.map(t=>s.qy`<cdtr-dropdown-item
813
- .focused=${t.type===F}
814
- .selected=${t.type===F}
815
- value="${t.type}"
816
- ><lang-text text="${t.text}"></lang-text>
817
- </cdtr-dropdown-item>`)}
818
- </div>
819
- </cdtr-dropdown>
820
- `}
821
- ${C=this.target,I=this.onChangeTarget.bind(this),s.qy`
822
- <cdtr-dropdown @change=${t=>I(t)} style="min-width: 120px;">
823
- <cdtr-dropdown-button minWidth=${120} class="dropdown-button" slot="trigger">
824
- <lang-text .text=${C}></lang-text>
825
- </cdtr-dropdown-button>
826
- <div slot="content">
827
- <cdtr-dropdown-item value="_blank" .selected=${"_blank"===C}>
828
- <lang-text text="open_in_new_tab"></lang-text>
829
- </cdtr-dropdown-item>
830
- <cdtr-dropdown-item value="_self" .selected=${"_self"===C}>
831
- <lang-text text="open_in_same_tab"></lang-text>
832
- </cdtr-dropdown-item>
833
- <cdtr-dropdown-item value="_parent" .selected=${"_parent"===C}>
834
- <lang-text text="open_in_parent_frame"></lang-text>
835
- </cdtr-dropdown-item>
836
- <cdtr-dropdown-item value="_top" .selected=${"_top"===C}>
837
- <lang-text text="open_in_top_frame"></lang-text>
838
- </cdtr-dropdown-item>
839
- </div>
840
- </cdtr-dropdown>
841
- `}
842
- </cdtr-row>
843
- <cdtr-row mt="1">
844
- ${function(t,e){return 0===t.length?null:s.qy`${t.map(t=>s.qy`<paper-button
845
- @click=${()=>e(t.type)}
846
- style="background:rgb(233, 237, 243);color:#000;font-size:13px;margin:0;margin-right:5px;"
847
- ><lang-text text="${t.text}"></lang-text
848
- ></paper-button>`)}`}(l,this.onChangeType.bind(this))}
849
- </cdtr-row>
850
-
851
- <div class="input-wrapper">
852
- <cdtr-title class="explain-title"
853
- ><lang-text .text="${g}"></lang-text
854
- ></cdtr-title>
855
- ${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:b({value:c,inputRef:o,autofocus:s,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(R)}
856
- ${f(this.protocol,w)}
857
- ${x?s.qy` <cdtr-divider></cdtr-divider>
858
- <cdtr-row justify="flex-start" mt="1">
859
- <cdtr-title class="explain-title"
860
- ><lang-text
861
- whiteSpace="break-spaces"
862
- text="need_automations"
863
- ></lang-text>
864
- </cdtr-title>
865
- <paper-button
866
- @click=${this.onAutomationsClick.bind(this)}
867
- style="background:#000;color:#fff;font-size:13px;margin:0;width:100%;"
868
- >
869
- <lang-text text="menu_automations"></lang-text>
870
- </paper-button>
871
- <cdtr-divider></cdtr-divider
872
- ></cdtr-row>`:null}
873
- ${function(t,e,i,o){return t&&Array.isArray(t)&&0!==t.length?s.qy`<cdtr-list-picker
874
- .selected=${e}
875
- @change=${t=>{i({target:{value:t.target.value}}),o()}}
876
- heading="saved_links"
877
- .list=${t}
878
- ></cdtr-list-picker>`:null}(t,c,this.onChangeLink.bind(this),this.onBlur.bind(this))}
879
- </div>
880
-
881
- ${U=this.hasButton,L=this.onClickOk.bind(this),U?s.qy`<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e0e0e0;">
882
- <cdtr-row justify="flex-end" mt="1">
883
- <paper-button fullWidth @click=${L} raised class="add-button">
884
- <lang-text text="add_now"></lang-text>
885
- </paper-button>
886
- </cdtr-row>`:null}
887
- </div>`;var U,L,C,I,M,F,q,j}}x.styles=n,x.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",x)},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??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()}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("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}}]);