@wix/ditto-codegen-public 1.0.171 → 1.0.172
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/examples-apps/custom-element/src/widgets/custom-elements/countdown-timer/widget.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { items } from '@wix/data';
|
|
2
|
+
import { window as wixWindow } from '@wix/site-window';
|
|
3
|
+
|
|
4
|
+
interface CountdownConfig {
|
|
5
|
+
_id: string;
|
|
6
|
+
targetDate: Date;
|
|
7
|
+
title?: string;
|
|
5
8
|
isActive: boolean;
|
|
6
|
-
description?: string;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
interface TimeRemaining {
|
|
@@ -15,41 +17,65 @@ interface TimeRemaining {
|
|
|
15
17
|
|
|
16
18
|
export default class extends HTMLElement {
|
|
17
19
|
private intervalId: number | null = null;
|
|
18
|
-
private
|
|
20
|
+
private config: CountdownConfig | null = null;
|
|
21
|
+
private isEditorMode = false;
|
|
19
22
|
|
|
20
|
-
public connectedCallback(): void {
|
|
21
|
-
this.
|
|
23
|
+
public async connectedCallback(): Promise<void> {
|
|
24
|
+
await this.checkEnvironment();
|
|
25
|
+
if (this.isEditorMode) {
|
|
26
|
+
this.renderEditorPlaceholder();
|
|
27
|
+
} else {
|
|
28
|
+
await this.loadConfig();
|
|
29
|
+
}
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
public disconnectedCallback(): void {
|
|
25
33
|
if (this.intervalId !== null) {
|
|
26
34
|
clearInterval(this.intervalId);
|
|
35
|
+
this.intervalId = null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private async checkEnvironment(): Promise<void> {
|
|
40
|
+
try {
|
|
41
|
+
const currentViewMode = await wixWindow.viewMode();
|
|
42
|
+
this.isEditorMode = currentViewMode === 'Editor';
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('Failed to check view mode:', error);
|
|
45
|
+
this.isEditorMode = false;
|
|
27
46
|
}
|
|
28
47
|
}
|
|
29
48
|
|
|
30
|
-
private async
|
|
49
|
+
private async loadConfig(): Promise<void> {
|
|
31
50
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
const result = await items.query('countdown-config')
|
|
52
|
+
.eq('isActive', true)
|
|
53
|
+
.limit(1)
|
|
54
|
+
.find();
|
|
55
|
+
|
|
56
|
+
if (result.items.length > 0) {
|
|
57
|
+
const item = result.items[0];
|
|
58
|
+
this.config = {
|
|
59
|
+
_id: item._id as string,
|
|
60
|
+
targetDate: new Date(item.targetDate as string),
|
|
61
|
+
title: item.title as string | undefined,
|
|
62
|
+
isActive: item.isActive as boolean
|
|
63
|
+
};
|
|
64
|
+
this.render();
|
|
65
|
+
this.startCountdown();
|
|
66
|
+
} else {
|
|
67
|
+
this.renderNoConfig();
|
|
68
|
+
}
|
|
43
69
|
} catch (error) {
|
|
44
|
-
console.error('Failed to load
|
|
70
|
+
console.error('Failed to load countdown config:', error);
|
|
45
71
|
this.renderError();
|
|
46
72
|
}
|
|
47
73
|
}
|
|
48
74
|
|
|
49
|
-
private calculateTimeRemaining(
|
|
75
|
+
private calculateTimeRemaining(targetDate: Date): TimeRemaining | null {
|
|
50
76
|
const now = new Date().getTime();
|
|
51
|
-
const
|
|
52
|
-
const difference =
|
|
77
|
+
const target = targetDate.getTime();
|
|
78
|
+
const difference = target - now;
|
|
53
79
|
|
|
54
80
|
if (difference <= 0) {
|
|
55
81
|
return null;
|
|
@@ -64,7 +90,7 @@ export default class extends HTMLElement {
|
|
|
64
90
|
}
|
|
65
91
|
|
|
66
92
|
private startCountdown(): void {
|
|
67
|
-
if (!this.
|
|
93
|
+
if (!this.config || !this.config.isActive) {
|
|
68
94
|
return;
|
|
69
95
|
}
|
|
70
96
|
|
|
@@ -74,12 +100,12 @@ export default class extends HTMLElement {
|
|
|
74
100
|
}
|
|
75
101
|
|
|
76
102
|
private updateCountdown(): void {
|
|
77
|
-
if (!this.
|
|
103
|
+
if (!this.config) {
|
|
78
104
|
return;
|
|
79
105
|
}
|
|
80
106
|
|
|
81
|
-
const timeRemaining = this.calculateTimeRemaining(this.
|
|
82
|
-
|
|
107
|
+
const timeRemaining = this.calculateTimeRemaining(this.config.targetDate);
|
|
108
|
+
|
|
83
109
|
if (timeRemaining === null) {
|
|
84
110
|
this.renderExpired();
|
|
85
111
|
if (this.intervalId !== null) {
|
|
@@ -93,12 +119,12 @@ export default class extends HTMLElement {
|
|
|
93
119
|
}
|
|
94
120
|
|
|
95
121
|
private render(): void {
|
|
96
|
-
if (!this.
|
|
122
|
+
if (!this.config) {
|
|
97
123
|
return;
|
|
98
124
|
}
|
|
99
125
|
|
|
100
|
-
const timeRemaining = this.calculateTimeRemaining(this.
|
|
101
|
-
|
|
126
|
+
const timeRemaining = this.calculateTimeRemaining(this.config.targetDate);
|
|
127
|
+
|
|
102
128
|
if (timeRemaining === null) {
|
|
103
129
|
this.renderExpired();
|
|
104
130
|
} else {
|
|
@@ -106,220 +132,355 @@ export default class extends HTMLElement {
|
|
|
106
132
|
}
|
|
107
133
|
}
|
|
108
134
|
|
|
109
|
-
private
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
private getStyles(): string {
|
|
136
|
+
return `
|
|
137
|
+
<style>
|
|
138
|
+
/* Editor Placeholder Styles */
|
|
139
|
+
.editor-container {
|
|
140
|
+
font-family: 'Courier New', monospace;
|
|
141
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
142
|
+
color: #00ff88;
|
|
143
|
+
padding: 48px 24px;
|
|
144
|
+
border-radius: 16px;
|
|
145
|
+
text-align: center;
|
|
146
|
+
box-shadow: 0 8px 32px rgba(0, 255, 136, 0.2);
|
|
147
|
+
max-width: 600px;
|
|
148
|
+
margin: 0 auto;
|
|
149
|
+
border: 2px solid #00ff88;
|
|
150
|
+
}
|
|
125
151
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
`;
|
|
152
|
+
.editor-icon {
|
|
153
|
+
font-size: 64px;
|
|
154
|
+
margin-bottom: 16px;
|
|
155
|
+
animation: pulse 2s ease-in-out infinite;
|
|
156
|
+
}
|
|
132
157
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
158
|
+
.editor-title {
|
|
159
|
+
font-size: 28px;
|
|
160
|
+
font-weight: 700;
|
|
161
|
+
margin: 0 0 12px 0;
|
|
162
|
+
text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
|
|
163
|
+
letter-spacing: 2px;
|
|
164
|
+
}
|
|
139
165
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
166
|
+
.editor-message {
|
|
167
|
+
font-size: 16px;
|
|
168
|
+
opacity: 0.85;
|
|
169
|
+
margin: 0;
|
|
170
|
+
line-height: 1.6;
|
|
171
|
+
}
|
|
146
172
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
173
|
+
/* Countdown Timer Styles */
|
|
174
|
+
.timer-container {
|
|
175
|
+
font-family: 'Orbitron', 'Rajdhani', 'Exo 2', monospace, sans-serif;
|
|
176
|
+
background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
|
|
177
|
+
color: #00d9ff;
|
|
178
|
+
padding: 40px 24px;
|
|
179
|
+
border-radius: 20px;
|
|
180
|
+
text-align: center;
|
|
181
|
+
box-shadow: 0 20px 60px rgba(0, 217, 255, 0.3), inset 0 0 40px rgba(0, 217, 255, 0.1);
|
|
182
|
+
max-width: 700px;
|
|
183
|
+
margin: 0 auto;
|
|
184
|
+
position: relative;
|
|
185
|
+
overflow: hidden;
|
|
186
|
+
}
|
|
153
187
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
188
|
+
.timer-glow {
|
|
189
|
+
content: '';
|
|
190
|
+
position: absolute;
|
|
191
|
+
top: -50%;
|
|
192
|
+
left: -50%;
|
|
193
|
+
width: 200%;
|
|
194
|
+
height: 200%;
|
|
195
|
+
background: radial-gradient(circle, rgba(0, 217, 255, 0.1) 0%, transparent 70%);
|
|
196
|
+
animation: rotate 10s linear infinite;
|
|
197
|
+
}
|
|
160
198
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
199
|
+
.timer-title {
|
|
200
|
+
font-size: 32px;
|
|
201
|
+
font-weight: 900;
|
|
202
|
+
margin: 0 0 12px 0;
|
|
203
|
+
text-shadow: 0 0 20px rgba(0, 217, 255, 0.8), 0 0 40px rgba(0, 217, 255, 0.4);
|
|
204
|
+
letter-spacing: 3px;
|
|
205
|
+
text-transform: uppercase;
|
|
206
|
+
position: relative;
|
|
207
|
+
z-index: 1;
|
|
208
|
+
}
|
|
168
209
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
cursor: pointer;
|
|
178
|
-
transition: all 0.3s ease;
|
|
179
|
-
text-decoration: none;
|
|
180
|
-
display: inline-block;
|
|
181
|
-
margin-top: 16px;
|
|
182
|
-
backdrop-filter: blur(10px);
|
|
183
|
-
`;
|
|
210
|
+
.timer-grid {
|
|
211
|
+
display: grid;
|
|
212
|
+
grid-template-columns: repeat(4, 1fr);
|
|
213
|
+
gap: 20px;
|
|
214
|
+
margin: 32px 0;
|
|
215
|
+
position: relative;
|
|
216
|
+
z-index: 1;
|
|
217
|
+
}
|
|
184
218
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
219
|
+
.time-unit {
|
|
220
|
+
background: rgba(0, 217, 255, 0.15);
|
|
221
|
+
border-radius: 12px;
|
|
222
|
+
padding: 24px 12px;
|
|
223
|
+
backdrop-filter: blur(10px);
|
|
224
|
+
border: 2px solid rgba(0, 217, 255, 0.3);
|
|
225
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(0, 217, 255, 0.1);
|
|
226
|
+
transition: all 0.3s ease;
|
|
227
|
+
}
|
|
190
228
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
gap: 12px;
|
|
229
|
+
.time-unit:hover {
|
|
230
|
+
transform: translateY(-4px);
|
|
231
|
+
border-color: rgba(0, 217, 255, 0.6);
|
|
232
|
+
box-shadow: 0 12px 40px rgba(0, 217, 255, 0.4), inset 0 0 30px rgba(0, 217, 255, 0.2);
|
|
196
233
|
}
|
|
234
|
+
|
|
197
235
|
.time-number {
|
|
236
|
+
font-size: 48px;
|
|
237
|
+
font-weight: 900;
|
|
238
|
+
margin: 0;
|
|
239
|
+
text-shadow: 0 0 15px rgba(0, 217, 255, 0.8), 0 0 30px rgba(0, 217, 255, 0.4);
|
|
240
|
+
font-family: 'Orbitron', monospace;
|
|
241
|
+
letter-spacing: 2px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.time-label {
|
|
245
|
+
font-size: 13px;
|
|
246
|
+
text-transform: uppercase;
|
|
247
|
+
letter-spacing: 2px;
|
|
248
|
+
margin: 8px 0 0 0;
|
|
249
|
+
opacity: 0.9;
|
|
250
|
+
font-weight: 700;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* Expired State Styles */
|
|
254
|
+
.expired-container {
|
|
255
|
+
font-family: 'Bebas Neue', 'Anton', 'Oswald', sans-serif;
|
|
256
|
+
background: linear-gradient(135deg, #2d1b00 0%, #5c3a1f 50%, #8b4513 100%);
|
|
257
|
+
color: #ffa500;
|
|
258
|
+
padding: 48px 24px;
|
|
259
|
+
border-radius: 20px;
|
|
260
|
+
text-align: center;
|
|
261
|
+
box-shadow: 0 20px 60px rgba(255, 165, 0, 0.4), inset 0 0 40px rgba(255, 165, 0, 0.1);
|
|
262
|
+
max-width: 600px;
|
|
263
|
+
margin: 0 auto;
|
|
264
|
+
border: 3px solid #ffa500;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.expired-icon {
|
|
268
|
+
font-size: 80px;
|
|
269
|
+
margin-bottom: 16px;
|
|
270
|
+
animation: bounce 1s ease-in-out infinite;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.expired-title {
|
|
274
|
+
font-size: 48px;
|
|
275
|
+
font-weight: 900;
|
|
276
|
+
margin: 0 0 16px 0;
|
|
277
|
+
text-shadow: 0 0 20px rgba(255, 165, 0, 0.8), 0 4px 8px rgba(0, 0, 0, 0.5);
|
|
278
|
+
letter-spacing: 4px;
|
|
279
|
+
text-transform: uppercase;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.expired-message {
|
|
283
|
+
font-size: 20px;
|
|
284
|
+
margin: 0;
|
|
285
|
+
opacity: 0.95;
|
|
286
|
+
font-weight: 600;
|
|
287
|
+
letter-spacing: 1px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/* No Config State Styles */
|
|
291
|
+
.no-config-container {
|
|
292
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
293
|
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
|
294
|
+
color: #2c3e50;
|
|
295
|
+
padding: 40px 24px;
|
|
296
|
+
border-radius: 16px;
|
|
297
|
+
text-align: center;
|
|
298
|
+
border: 2px dashed #95a5a6;
|
|
299
|
+
max-width: 500px;
|
|
300
|
+
margin: 0 auto;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.no-config-icon {
|
|
304
|
+
font-size: 64px;
|
|
305
|
+
margin-bottom: 16px;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.no-config-title {
|
|
198
309
|
font-size: 24px;
|
|
310
|
+
font-weight: 700;
|
|
311
|
+
margin: 0 0 12px 0;
|
|
312
|
+
color: #34495e;
|
|
199
313
|
}
|
|
200
|
-
|
|
201
|
-
|
|
314
|
+
|
|
315
|
+
.no-config-message {
|
|
316
|
+
font-size: 16px;
|
|
317
|
+
margin: 0;
|
|
318
|
+
line-height: 1.6;
|
|
319
|
+
color: #7f8c8d;
|
|
202
320
|
}
|
|
203
|
-
}
|
|
204
|
-
`;
|
|
205
321
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
322
|
+
/* Error State Styles */
|
|
323
|
+
.error-container {
|
|
324
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
325
|
+
background: #fff5f5;
|
|
326
|
+
color: #c53030;
|
|
327
|
+
padding: 32px 24px;
|
|
328
|
+
border-radius: 12px;
|
|
329
|
+
text-align: center;
|
|
330
|
+
border: 2px solid #fc8181;
|
|
331
|
+
max-width: 500px;
|
|
332
|
+
margin: 0 auto;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.error-icon {
|
|
336
|
+
font-size: 48px;
|
|
337
|
+
margin-bottom: 12px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.error-message {
|
|
341
|
+
margin: 0;
|
|
342
|
+
font-size: 16px;
|
|
343
|
+
font-weight: 600;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/* Animations */
|
|
347
|
+
@keyframes pulse {
|
|
348
|
+
0%, 100% {
|
|
349
|
+
opacity: 1;
|
|
350
|
+
transform: scale(1);
|
|
351
|
+
}
|
|
352
|
+
50% {
|
|
353
|
+
opacity: 0.6;
|
|
354
|
+
transform: scale(1.1);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@keyframes rotate {
|
|
359
|
+
from {
|
|
360
|
+
transform: rotate(0deg);
|
|
361
|
+
}
|
|
362
|
+
to {
|
|
363
|
+
transform: rotate(360deg);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
@keyframes bounce {
|
|
368
|
+
0%, 100% {
|
|
369
|
+
transform: translateY(0);
|
|
370
|
+
}
|
|
371
|
+
50% {
|
|
372
|
+
transform: translateY(-20px);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/* Responsive Styles */
|
|
377
|
+
@media (max-width: 600px) {
|
|
378
|
+
.timer-grid {
|
|
379
|
+
grid-template-columns: repeat(2, 1fr);
|
|
380
|
+
gap: 16px;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.time-number {
|
|
384
|
+
font-size: 36px;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.timer-container {
|
|
388
|
+
padding: 24px 16px;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.timer-title {
|
|
392
|
+
font-size: 24px;
|
|
393
|
+
}
|
|
211
394
|
}
|
|
212
395
|
</style>
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
<div style="${timeUnitStyle}">
|
|
227
|
-
<div class="time-number" style="${numberStyle}">${timeRemaining.minutes.toString().padStart(2, '0')}</div>
|
|
228
|
-
<div style="${labelStyle}">Minutes</div>
|
|
229
|
-
</div>
|
|
230
|
-
<div style="${timeUnitStyle}">
|
|
231
|
-
<div class="time-number" style="${numberStyle}">${timeRemaining.seconds.toString().padStart(2, '0')}</div>
|
|
232
|
-
<div style="${labelStyle}">Seconds</div>
|
|
233
|
-
</div>
|
|
234
|
-
</div>
|
|
235
|
-
|
|
236
|
-
${this.timerData.targetUrl ? `
|
|
237
|
-
<a href="${this.escapeHtml(this.timerData.targetUrl)}"
|
|
238
|
-
class="timer-button"
|
|
239
|
-
style="${buttonStyle}"
|
|
240
|
-
role="button"
|
|
241
|
-
aria-label="Take action before timer expires">
|
|
242
|
-
Don't Miss Out!
|
|
243
|
-
</a>
|
|
244
|
-
` : ''}
|
|
396
|
+
`;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
private renderEditorPlaceholder(): void {
|
|
400
|
+
this.innerHTML = `
|
|
401
|
+
${this.getStyles()}
|
|
402
|
+
<div class="editor-container" data-testid="countdown-timer-editor">
|
|
403
|
+
<div class="editor-icon">⏱️</div>
|
|
404
|
+
<h2 class="editor-title">COUNTDOWN TIMER</h2>
|
|
405
|
+
<p class="editor-message">
|
|
406
|
+
This widget will display a live countdown on your published site.<br>
|
|
407
|
+
Configure the target date in your dashboard to get started.
|
|
408
|
+
</p>
|
|
245
409
|
</div>
|
|
246
410
|
`;
|
|
247
411
|
}
|
|
248
412
|
|
|
249
|
-
private
|
|
250
|
-
if (!this.
|
|
413
|
+
private renderCountdown(timeRemaining: TimeRemaining): void {
|
|
414
|
+
if (!this.config) {
|
|
251
415
|
return;
|
|
252
416
|
}
|
|
253
417
|
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
418
|
+
const timeUnits = [
|
|
419
|
+
{ value: timeRemaining.days, label: 'Days' },
|
|
420
|
+
{ value: timeRemaining.hours, label: 'Hours' },
|
|
421
|
+
{ value: timeRemaining.minutes, label: 'Minutes' },
|
|
422
|
+
{ value: timeRemaining.seconds, label: 'Seconds' }
|
|
423
|
+
];
|
|
424
|
+
|
|
425
|
+
const timeUnitsHtml = timeUnits
|
|
426
|
+
.map(unit => `
|
|
427
|
+
<div class="time-unit">
|
|
428
|
+
<div class="time-number">${unit.value.toString().padStart(2, '0')}</div>
|
|
429
|
+
<div class="time-label">${unit.label}</div>
|
|
430
|
+
</div>
|
|
431
|
+
`)
|
|
432
|
+
.join('');
|
|
265
433
|
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
margin: 0 0 16px 0;
|
|
270
|
-
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
271
|
-
`;
|
|
434
|
+
const titleHtml = this.config.title
|
|
435
|
+
? `<h2 class="timer-title">${this.escapeHtml(this.config.title)}</h2>`
|
|
436
|
+
: '';
|
|
272
437
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
438
|
+
this.innerHTML = `
|
|
439
|
+
${this.getStyles()}
|
|
440
|
+
<div class="timer-container" data-testid="countdown-timer">
|
|
441
|
+
<div class="timer-glow"></div>
|
|
442
|
+
${titleHtml}
|
|
443
|
+
<div class="timer-grid">
|
|
444
|
+
${timeUnitsHtml}
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
277
447
|
`;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
private renderExpired(): void {
|
|
451
|
+
const message = this.config && this.config.title
|
|
452
|
+
? `${this.escapeHtml(this.config.title)} has ended.`
|
|
453
|
+
: 'The countdown has ended.';
|
|
278
454
|
|
|
279
455
|
this.innerHTML = `
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
style="
|
|
286
|
-
background: rgba(255, 255, 255, 0.2);
|
|
287
|
-
color: white;
|
|
288
|
-
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
289
|
-
padding: 12px 24px;
|
|
290
|
-
border-radius: 6px;
|
|
291
|
-
font-size: 16px;
|
|
292
|
-
font-weight: 600;
|
|
293
|
-
cursor: pointer;
|
|
294
|
-
text-decoration: none;
|
|
295
|
-
display: inline-block;
|
|
296
|
-
margin-top: 16px;
|
|
297
|
-
backdrop-filter: blur(10px);
|
|
298
|
-
"
|
|
299
|
-
role="button">
|
|
300
|
-
Learn More
|
|
301
|
-
</a>
|
|
302
|
-
` : ''}
|
|
456
|
+
${this.getStyles()}
|
|
457
|
+
<div class="expired-container" data-testid="countdown-timer-expired">
|
|
458
|
+
<div class="expired-icon">🎉</div>
|
|
459
|
+
<h2 class="expired-title">Time's Up!</h2>
|
|
460
|
+
<p class="expired-message">${message}</p>
|
|
303
461
|
</div>
|
|
304
462
|
`;
|
|
305
463
|
}
|
|
306
464
|
|
|
307
|
-
private
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
margin: 0 auto;
|
|
465
|
+
private renderNoConfig(): void {
|
|
466
|
+
this.innerHTML = `
|
|
467
|
+
${this.getStyles()}
|
|
468
|
+
<div class="no-config-container" data-testid="countdown-timer-no-config">
|
|
469
|
+
<div class="no-config-icon">⚙️</div>
|
|
470
|
+
<h2 class="no-config-title">No Active Countdown</h2>
|
|
471
|
+
<p class="no-config-message">
|
|
472
|
+
Please configure a countdown timer in your dashboard to display it here.
|
|
473
|
+
</p>
|
|
474
|
+
</div>
|
|
318
475
|
`;
|
|
476
|
+
}
|
|
319
477
|
|
|
478
|
+
private renderError(): void {
|
|
320
479
|
this.innerHTML = `
|
|
321
|
-
|
|
322
|
-
|
|
480
|
+
${this.getStyles()}
|
|
481
|
+
<div class="error-container" data-testid="countdown-timer-error">
|
|
482
|
+
<div class="error-icon">⚠️</div>
|
|
483
|
+
<p class="error-message">Unable to load countdown timer</p>
|
|
323
484
|
</div>
|
|
324
485
|
`;
|
|
325
486
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.172",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@wix/ditto-codegen": "1.0.0",
|
|
25
25
|
"esbuild": "^0.25.9"
|
|
26
26
|
},
|
|
27
|
-
"falconPackageHash": "
|
|
27
|
+
"falconPackageHash": "5f55c293e1d9dc44eafdb84800bd1d20129b4fea5bf5eeac1b61c3a5"
|
|
28
28
|
}
|