@magicfeedback/popup-sdk 1.1.0 → 1.1.1
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/README.md +0 -19
- package/dist/chunk-5VVCJBND.mjs +140 -0
- package/dist/chunk-5VVCJBND.mjs.map +1 -0
- package/dist/chunk-M6PEFLLQ.mjs +119 -0
- package/dist/chunk-M6PEFLLQ.mjs.map +1 -0
- package/dist/index.d.mts +400 -40
- package/dist/index.d.ts +400 -40
- package/dist/index.js +903 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +758 -3411
- package/dist/index.mjs.map +1 -1
- package/dist/react-native.d.mts +470 -0
- package/dist/react-native.d.ts +470 -0
- package/dist/react-native.js +3202 -0
- package/dist/react-native.js.map +1 -0
- package/dist/react-native.mjs +1675 -0
- package/dist/react-native.mjs.map +1 -0
- package/dist/renderPopup-7GGKR5BY.mjs +1376 -0
- package/dist/renderPopup-7GGKR5BY.mjs.map +1 -0
- package/dist/renderPopup-Y4WG3575.mjs +3303 -0
- package/dist/renderPopup-Y4WG3575.mjs.map +1 -0
- package/package.json +36 -2
|
@@ -0,0 +1,1376 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildSurveyIdentity
|
|
3
|
+
} from "./chunk-M6PEFLLQ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/ui/renderPopup.ts
|
|
6
|
+
import magicfeedback from "@magicfeedback/native";
|
|
7
|
+
|
|
8
|
+
// src/assets/style.css
|
|
9
|
+
var style_default = `.magicfeedback-container {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.magicfeedback-success-message,
|
|
15
|
+
.magicfeedback-info-message,
|
|
16
|
+
.magicfeedback-start-message,
|
|
17
|
+
.magicfeedback-container{
|
|
18
|
+
animation-duration: 0.5s;
|
|
19
|
+
animation-name: animate-fade;
|
|
20
|
+
animation-delay: 0.25s;
|
|
21
|
+
animation-fill-mode: backwards;
|
|
22
|
+
|
|
23
|
+
font-style: normal;
|
|
24
|
+
text-align: justify;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
font-size: 1.2rem;
|
|
27
|
+
color: #475569;
|
|
28
|
+
line-height: 1.5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes animate-fade {
|
|
32
|
+
0% { opacity: 0; }
|
|
33
|
+
100% { opacity: 1; }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.magicfeedback-form {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
justify-content: flex-start;
|
|
40
|
+
align-items: center;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
.magicfeedback-questions {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
justify-content: flex-start;
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
width: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.magicfeedback-div {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
justify-content: flex-start;
|
|
55
|
+
align-items: flex-start;
|
|
56
|
+
margin-bottom: 10px;
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.magicfeedback-label {
|
|
61
|
+
margin-bottom: 25px;
|
|
62
|
+
margin-top: 20px;
|
|
63
|
+
font-weight: 400;
|
|
64
|
+
font-family: inherit;
|
|
65
|
+
font-size: 1.2rem;
|
|
66
|
+
color: #212529;
|
|
67
|
+
text-align: start;
|
|
68
|
+
word-wrap: break-word;
|
|
69
|
+
white-space: normal;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.magicfeedback-checkbox {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
flex-wrap: wrap;
|
|
77
|
+
width: 100%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.magicfeedback-checkbox-container {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: row;
|
|
83
|
+
justify-content: flex-start;
|
|
84
|
+
align-items: center;
|
|
85
|
+
margin-bottom: 5px;
|
|
86
|
+
margin-top: 5px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.magicfeedback-radio {
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
justify-content: flex-start;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
width: 100%;
|
|
95
|
+
margin-right: 5px;
|
|
96
|
+
padding: 5px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.magicfeedback-checkbox-container,
|
|
100
|
+
.magicfeedback-radio-container {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
justify-content: flex-start;
|
|
104
|
+
align-items: center;
|
|
105
|
+
margin: 5px;
|
|
106
|
+
padding: 5px 0;
|
|
107
|
+
background-color: #fff;
|
|
108
|
+
border-radius: 5px;
|
|
109
|
+
box-shadow: 0 0 3px #ccc;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.deepdots-popup input::-webkit-outer-spin-button,
|
|
113
|
+
.deepdots-popup input::-webkit-inner-spin-button {
|
|
114
|
+
-webkit-appearance: none;
|
|
115
|
+
-moz-appearance: textfield;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.magicfeedback-checkbox input[type="checkbox"] {
|
|
119
|
+
margin-right: 5px;
|
|
120
|
+
margin-left: 5px;
|
|
121
|
+
width: 20px;
|
|
122
|
+
height: 20px;
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
.magicfeedback-checkbox label,
|
|
128
|
+
.magicfeedback-radio-container label {
|
|
129
|
+
margin-left: 5px;
|
|
130
|
+
font-weight: 400;
|
|
131
|
+
font-family: inherit;
|
|
132
|
+
font-size: 16px;
|
|
133
|
+
color: #212529;
|
|
134
|
+
text-align: start;
|
|
135
|
+
width: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.deepdots-popup p {
|
|
139
|
+
margin-bottom: 0px;
|
|
140
|
+
font-size: 12px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.deepdots-popup h2 {
|
|
144
|
+
line-height: 1.66;
|
|
145
|
+
margin: 0;
|
|
146
|
+
padding: 0;
|
|
147
|
+
font-weight: 900;
|
|
148
|
+
color: #222;
|
|
149
|
+
font-family: 'Montserrat';
|
|
150
|
+
font-size: 18px;
|
|
151
|
+
text-transform: uppercase;
|
|
152
|
+
text-align: center;
|
|
153
|
+
margin-bottom: 40px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.deepdots-popup h6 {
|
|
157
|
+
margin-bottom: 1rem;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.deepdots-popup input[type="date"],
|
|
161
|
+
.deepdots-popup input[type="text"],
|
|
162
|
+
.deepdots-popup input[type="number"],
|
|
163
|
+
.deepdots-popup input[type="email"],
|
|
164
|
+
.deepdots-popup input[type="password"],
|
|
165
|
+
.deepdots-popup textarea,
|
|
166
|
+
.deepdots-popup select {
|
|
167
|
+
box-sizing: border-box;
|
|
168
|
+
padding: 10px;
|
|
169
|
+
margin: 10px 0;
|
|
170
|
+
width: 100%;
|
|
171
|
+
border: 2px solid #ccc; /* Default border color - you can customize this */
|
|
172
|
+
border-radius: 5px;
|
|
173
|
+
font-size: 18px;
|
|
174
|
+
outline: none;
|
|
175
|
+
transition: border-color 0.3s ease;
|
|
176
|
+
min-height: 50px;
|
|
177
|
+
font-family: inherit;
|
|
178
|
+
-webkit-appearance: none;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.deepdots-popup select {
|
|
182
|
+
background-image: linear-gradient(45deg, transparent 50%, gray 50%),
|
|
183
|
+
linear-gradient(135deg, gray 50%, transparent 50%),
|
|
184
|
+
linear-gradient(to right, #ccc, #ccc);
|
|
185
|
+
background-position: calc(100% - 20px) calc(1em + 2px),
|
|
186
|
+
calc(100% - 15px) calc(1em + 2px),
|
|
187
|
+
calc(100% - 2.5em) 0.5em;
|
|
188
|
+
background-size: 5px 5px,
|
|
189
|
+
5px 5px,
|
|
190
|
+
1px 1.5em;
|
|
191
|
+
background-repeat: no-repeat;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.magicfeedback-boolean-container {
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-direction: row;
|
|
197
|
+
justify-content: flex-start;
|
|
198
|
+
align-items: center;
|
|
199
|
+
margin: 10px 0;
|
|
200
|
+
width: 100%;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.magicfeedback-boolean-container label {
|
|
204
|
+
margin-left: 10px;
|
|
205
|
+
font-weight: 400;
|
|
206
|
+
font-size: 16px;
|
|
207
|
+
width: 100%;
|
|
208
|
+
padding-top: 5px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.magicfeedback-boolean-option {
|
|
212
|
+
margin-right: 10px;
|
|
213
|
+
margin-left: 10px;
|
|
214
|
+
width: 100%;
|
|
215
|
+
height: 38px;
|
|
216
|
+
border-radius: 8px;
|
|
217
|
+
font-size: 16px;
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
border: 1px solid #ced4da !important;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.magicfeedback-boolean-option label {
|
|
223
|
+
font-weight: 400;
|
|
224
|
+
font-size: 16px;
|
|
225
|
+
color: #475569;
|
|
226
|
+
cursor: pointer;
|
|
227
|
+
width: 100%;
|
|
228
|
+
height: 100%;
|
|
229
|
+
display: flex;
|
|
230
|
+
justify-content: center;
|
|
231
|
+
align-items: center;
|
|
232
|
+
border-radius: inherit;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.magicfeedback-boolean-option input[type=radio] + label:hover {
|
|
236
|
+
color: #007bff;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.magicfeedback-boolean-option input[type=radio]:checked + label {
|
|
240
|
+
color: #007bff;
|
|
241
|
+
background-color: #cadff8;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.deepdots-popup input[type="radio"] {
|
|
245
|
+
padding: 20px;
|
|
246
|
+
margin: 10px 0 10px 15px;
|
|
247
|
+
width: 40px;
|
|
248
|
+
background-color: #fff;
|
|
249
|
+
box-shadow: none;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* Style for focused input/select */
|
|
253
|
+
.deepdots-popup input:focus, .deepdots-popup select:focus {
|
|
254
|
+
border-color: #4CAF50; /* Highlight color when focused - you can customize this */
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* Style for invalid input (example: validation error) */
|
|
258
|
+
.deepdots-popup input.error, .deepdots-popup select.error {
|
|
259
|
+
border-color: #ff3333; /* Red color for error state - you can customize this */
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.magicfeedback-action-container {
|
|
263
|
+
display: flex;
|
|
264
|
+
flex-direction: row;
|
|
265
|
+
justify-content: space-between;
|
|
266
|
+
align-items: center;
|
|
267
|
+
margin-top: 10px;
|
|
268
|
+
width: 100%;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.magicfeedback-action-container .magicfeedback-submit {
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
padding: 10px;
|
|
274
|
+
margin: 10px 0;
|
|
275
|
+
width: 100px;
|
|
276
|
+
border-radius: 8px;
|
|
277
|
+
font-size: 16px;
|
|
278
|
+
outline: none;
|
|
279
|
+
transition: border-color 0.3s ease;
|
|
280
|
+
background-color: #1E293B;
|
|
281
|
+
color: white;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.magicfeedback-action-container .magicfeedback-back {
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
padding: 10px;
|
|
287
|
+
margin: 10px 0;
|
|
288
|
+
width: 100px;
|
|
289
|
+
border: 0;
|
|
290
|
+
border-radius: 8px;
|
|
291
|
+
font-size: 16px;
|
|
292
|
+
outline: none;
|
|
293
|
+
transition: border-color 0.3s ease;
|
|
294
|
+
background-color: transparent;
|
|
295
|
+
color: #212529;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
/* Rating styles */
|
|
301
|
+
.magicfeedback-rating {
|
|
302
|
+
width: 100%;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.magicfeedback-rating-container {
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: row;
|
|
308
|
+
justify-content: space-around;
|
|
309
|
+
flex-wrap: wrap;
|
|
310
|
+
align-items: center;
|
|
311
|
+
|
|
312
|
+
margin: 15px 5px;
|
|
313
|
+
padding: 0;
|
|
314
|
+
|
|
315
|
+
list-style: none;
|
|
316
|
+
font-size: 1.5rem;
|
|
317
|
+
cursor: pointer;
|
|
318
|
+
user-select: none;
|
|
319
|
+
-webkit-user-select: none;
|
|
320
|
+
-moz-user-select: none;
|
|
321
|
+
-ms-user-select: none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.magicfeedback-rating-placeholder-value,
|
|
325
|
+
.magicfeedback-rating-placeholder{
|
|
326
|
+
text-align: center;
|
|
327
|
+
align-content: center;
|
|
328
|
+
justify-content: center;
|
|
329
|
+
text-wrap: wrap;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.magicfeedback-rating-option {
|
|
333
|
+
margin: 0 0.5rem;
|
|
334
|
+
padding: 0;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
@media (max-width: 1024px) {
|
|
338
|
+
.magicfeedback-rating-option {
|
|
339
|
+
margin: 10px 0;
|
|
340
|
+
padding: 0;
|
|
341
|
+
width: 20%;
|
|
342
|
+
display: flex;
|
|
343
|
+
justify-content: center;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.magicfeedback-rating-placeholder-value {
|
|
347
|
+
font-size: 0.75rem;
|
|
348
|
+
margin-bottom: 1px;
|
|
349
|
+
}
|
|
350
|
+
.magicfeedback-rating-placeholder{
|
|
351
|
+
justify-content: center;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.magicfeedback-rating-container {
|
|
355
|
+
flex-wrap: wrap;
|
|
356
|
+
justify-content: flex-start;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
.magicfeedback-rating-option-label-container {
|
|
362
|
+
display: flex;
|
|
363
|
+
flex-direction: column;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
.magicfeedback-rating-option-label-container label {
|
|
368
|
+
display: inline-block;
|
|
369
|
+
text-align: center;
|
|
370
|
+
margin-bottom: 0;
|
|
371
|
+
font-weight: 600;
|
|
372
|
+
font-size: 18px;
|
|
373
|
+
color: #475569;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.magicfeedback-rating-option-label-container input[type=radio] {
|
|
377
|
+
position: absolute;
|
|
378
|
+
opacity: 0;
|
|
379
|
+
width: 0;
|
|
380
|
+
height: 0;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* IMAGE STYLES */
|
|
384
|
+
.magicfeedback-rating-option-label-container input[type=radio] + img {
|
|
385
|
+
cursor: pointer;
|
|
386
|
+
height: 48px;
|
|
387
|
+
width: 48px;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/* LABEL STYLES */
|
|
391
|
+
.magicfeedback-rating-option-label-container input[type=radio] + label {
|
|
392
|
+
cursor: pointer;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* CHECKED STYLES */
|
|
396
|
+
.magicfeedback-rating-option-label-container input[type=radio]:checked + img {
|
|
397
|
+
box-shadow: #007bff 0px 1px 4px, #007BFFA0 0px 0px 0px 2px;
|
|
398
|
+
border-radius: 50%;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.magicfeedback-rating-number {
|
|
402
|
+
width: 100%;
|
|
403
|
+
}
|
|
404
|
+
.magicfeedback-rating-container,
|
|
405
|
+
.magicfeedback-rating-number-container {
|
|
406
|
+
display: flex;
|
|
407
|
+
flex-direction: row;
|
|
408
|
+
justify-content: space-between;
|
|
409
|
+
align-items: center;
|
|
410
|
+
|
|
411
|
+
margin: 15px 0;
|
|
412
|
+
padding: 0;
|
|
413
|
+
|
|
414
|
+
list-style: none;
|
|
415
|
+
font-size: 1.5rem;
|
|
416
|
+
cursor: pointer;
|
|
417
|
+
user-select: none;
|
|
418
|
+
-webkit-user-select: none;
|
|
419
|
+
-moz-user-select: none;
|
|
420
|
+
-ms-user-select: none;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/* Cuando hay placeholders (Very bad / Very good), el placeholder ocupa
|
|
424
|
+
el 100% de la primera l\xEDnea y los boxes bajan a la siguiente */
|
|
425
|
+
.magicfeedback-rating-number-container--with-placeholder {
|
|
426
|
+
flex-wrap: wrap;
|
|
427
|
+
align-items: flex-start;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.magicfeedback-rating-number-container--with-placeholder .magicfeedback-rating-placeholder {
|
|
431
|
+
width: 100%;
|
|
432
|
+
margin-bottom: 8px;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.magicfeedback-rating-number-container--with-placeholder .magicfeedback-rating-number-option {
|
|
436
|
+
width: auto;
|
|
437
|
+
flex: 1;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.magicfeedback-rating-number-option {
|
|
441
|
+
display: flex;
|
|
442
|
+
flex-direction: row;
|
|
443
|
+
justify-content: flex-start;
|
|
444
|
+
align-items: center;
|
|
445
|
+
margin: 5px;
|
|
446
|
+
padding: 0;
|
|
447
|
+
list-style: none;
|
|
448
|
+
font-size: 1.5rem;
|
|
449
|
+
cursor: pointer;
|
|
450
|
+
user-select: none;
|
|
451
|
+
-webkit-user-select: none;
|
|
452
|
+
-moz-user-select: none;
|
|
453
|
+
-ms-user-select: none;
|
|
454
|
+
width: 100%;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.magicfeedback-rating-number-option-row{
|
|
458
|
+
max-width: 100% !important;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.magicfeedback-rating-number-top-placeholder,
|
|
462
|
+
.magicfeedback-rating-number-bottom-placeholder{
|
|
463
|
+
text-align: center !important;
|
|
464
|
+
align-content: center;
|
|
465
|
+
justify-content: center;
|
|
466
|
+
text-wrap: wrap;
|
|
467
|
+
|
|
468
|
+
font-size: 15px;
|
|
469
|
+
color: #475569;
|
|
470
|
+
|
|
471
|
+
width: 100%;
|
|
472
|
+
margin: auto;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
@media (min-width: 650px) {
|
|
476
|
+
.magicfeedback-rating-number-option-row +.magicfeedback-rating-number-container-ltr:first-child,
|
|
477
|
+
.magicfeedback-rating-number-option-row + +.magicfeedback-rating-number-container-rtl:last-child {
|
|
478
|
+
margin-left: 0;
|
|
479
|
+
width: calc(100% - 10px);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.magicfeedback-rating-number-option-row +.magicfeedback-rating-number-container-rtl:first-child,
|
|
483
|
+
.magicfeedback-rating-number-option-row + +.magicfeedback-rating-number-container-ltr:last-child {
|
|
484
|
+
margin-right: 0;
|
|
485
|
+
width: calc(100% - 10px);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
.magicfeedback-rating-number-option-label-container {
|
|
491
|
+
display: flex;
|
|
492
|
+
flex-direction: column;
|
|
493
|
+
align-items: center;
|
|
494
|
+
justify-content: center;
|
|
495
|
+
width: 100%;
|
|
496
|
+
height: 100%;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.magicfeedback-rating-number-option-label-container label {
|
|
500
|
+
display: flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
justify-content: center;
|
|
503
|
+
white-space: nowrap;
|
|
504
|
+
overflow: hidden;
|
|
505
|
+
text-overflow: ellipsis;
|
|
506
|
+
margin: 0 10px;
|
|
507
|
+
font-weight: 600;
|
|
508
|
+
font-size: 14px;
|
|
509
|
+
color: #475569;
|
|
510
|
+
cursor: pointer;
|
|
511
|
+
width: 100%;
|
|
512
|
+
height: 100%;
|
|
513
|
+
min-height: 50px;
|
|
514
|
+
text-align: center;
|
|
515
|
+
padding: 0;
|
|
516
|
+
border-radius: 4px;
|
|
517
|
+
border: 1px solid #ced4da;
|
|
518
|
+
background-color: rgba(246, 246, 246, 0.3);
|
|
519
|
+
transition: background-color 0.15s ease-in-out;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.magicfeedback-rating-number-option-label-container input[type=radio] {
|
|
523
|
+
position: absolute;
|
|
524
|
+
opacity: 0;
|
|
525
|
+
width: 0;
|
|
526
|
+
height: 0;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.magicfeedback-rating-number-option-label-container input[type=radio] + label {
|
|
530
|
+
cursor: pointer;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.magicfeedback-rating-number-option-label-container input[type=radio] + label:hover,
|
|
534
|
+
.magicfeedback-rating-number-option-label-container input[type=radio]:checked + label {
|
|
535
|
+
color: #007bff;
|
|
536
|
+
border: 1px solid #007bff;
|
|
537
|
+
background-color: rgba(86, 168, 253, 0.29);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.magicfeedback-rating-number-container-column{
|
|
541
|
+
align-items: flex-start !important;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
@media (max-width: 650px) {
|
|
545
|
+
.magicfeedback-rating-number-container-ltr {
|
|
546
|
+
justify-content: center;
|
|
547
|
+
flex-wrap: wrap;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.magicfeedback-rating-number-container-rtl {
|
|
551
|
+
justify-content: center;
|
|
552
|
+
flex-wrap: wrap-reverse;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.magicfeedback-rating-number-option {
|
|
556
|
+
max-width: 100%;
|
|
557
|
+
height: 55px;
|
|
558
|
+
margin: 5px 0;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.magicfeedback-rating-star {
|
|
563
|
+
width: 100%;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.magicfeedback-rating-star-container {
|
|
567
|
+
display: flex !important;
|
|
568
|
+
flex-direction: row !important;
|
|
569
|
+
justify-content: center !important;
|
|
570
|
+
align-items: center !important;
|
|
571
|
+
flex-wrap: wrap;
|
|
572
|
+
margin: 15px 5px;
|
|
573
|
+
padding: 0;
|
|
574
|
+
list-style: none;
|
|
575
|
+
font-size: 1.5rem;
|
|
576
|
+
cursor: pointer;
|
|
577
|
+
user-select: none;
|
|
578
|
+
-webkit-user-select: none;
|
|
579
|
+
-moz-user-select: none;
|
|
580
|
+
-ms-user-select: none;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.magicfeedback-rating-star-option:not(:checked) > .rating__star {
|
|
584
|
+
float: right;
|
|
585
|
+
width: 1em;
|
|
586
|
+
overflow: hidden;
|
|
587
|
+
white-space: nowrap;
|
|
588
|
+
cursor: pointer;
|
|
589
|
+
font-size: 30px;
|
|
590
|
+
color: #ccc;
|
|
591
|
+
margin: 0 10px;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.magicfeedback-rating-star-option:not(:checked) > .rating__star:hover,
|
|
595
|
+
.magicfeedback-rating-star-option:not(:checked) > .rating__star:hover ~ span {
|
|
596
|
+
color: #deb217 !important;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.magicfeedback-rating-star-selected {
|
|
600
|
+
color: #ffc700 !important;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
/* Style for multiple choice image */
|
|
605
|
+
.magicfeedback-image-option-label-container:hover {
|
|
606
|
+
cursor: pointer;
|
|
607
|
+
border: 0 !important;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.magicfeedback-image-option-label-container input[type=radio]:checked + img,
|
|
611
|
+
.magicfeedback-image-option-label-container input[type=checkbox]:checked + img {
|
|
612
|
+
border: 1px solid #007bff !important;
|
|
613
|
+
box-shadow: 0 0 3px #007bff !important;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.magicfeedback-image-option-label-container input[type=radio] + img,
|
|
617
|
+
.magicfeedback-image-option-label-container input[type=checkbox] + img {
|
|
618
|
+
border: 1px solid transparent !important;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.magicfeedback-image-option-label-container{
|
|
622
|
+
margin: 10px !important;
|
|
623
|
+
height: calc(100% - 20px) !important;
|
|
624
|
+
width: calc(100% - 20px) !important;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.magicfeedback-multiple-choice-image-option {
|
|
628
|
+
display: flex;
|
|
629
|
+
height: auto !important;
|
|
630
|
+
box-shadow: 0 0 3px #ccc;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.magicfeedback-multiple-choice-image-label {
|
|
634
|
+
font-size: 1rem;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.magicfeedback-consent-container {
|
|
638
|
+
display: flex;
|
|
639
|
+
flex-direction: row;
|
|
640
|
+
justify-content: flex-start;
|
|
641
|
+
align-items: center;
|
|
642
|
+
margin: 10px 0;
|
|
643
|
+
width: 100%;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.magicfeedback-consent-container label {
|
|
647
|
+
margin-left: 10px;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.magicfeedback-start-message-container {
|
|
651
|
+
/* ... add your start message container styles here ... */
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.magicfeedback-success-message,
|
|
655
|
+
.magicfeedback-info-message,
|
|
656
|
+
.magicfeedback-start-message {
|
|
657
|
+
margin: 35px 5px;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
.magicfeedback-success-message p,
|
|
661
|
+
.magicfeedback-info-message p,
|
|
662
|
+
.magicfeedback-start-message p {
|
|
663
|
+
font-style: normal;
|
|
664
|
+
text-align: start;
|
|
665
|
+
font-weight: 400;
|
|
666
|
+
font-size: 16px;
|
|
667
|
+
color: #475569;
|
|
668
|
+
line-height: 1.5;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
.magicfeedback-success-message img,
|
|
672
|
+
.magicfeedback-info-message img,
|
|
673
|
+
.magicfeedback-start-message img {
|
|
674
|
+
width: 400px;
|
|
675
|
+
max-width: 80%;
|
|
676
|
+
height: auto;
|
|
677
|
+
margin: 10px auto;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.magicfeedback-counter,
|
|
681
|
+
.magicfeedback-point-system-total {
|
|
682
|
+
margin: 10px 0 0 0 !important;
|
|
683
|
+
display: flex !important;
|
|
684
|
+
justify-content: right !important;
|
|
685
|
+
align-items: center !important;
|
|
686
|
+
width: 100%;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
.magicfeedback-skip-container {
|
|
690
|
+
background-color: transparent !important;
|
|
691
|
+
border: 0 !important;
|
|
692
|
+
color: #999999FF !important;
|
|
693
|
+
padding: 0 !important;
|
|
694
|
+
margin: 0 !important;
|
|
695
|
+
cursor: pointer !important;
|
|
696
|
+
font-size: 0.5em !important;
|
|
697
|
+
font-weight: 400 !important;
|
|
698
|
+
box-shadow: 0 0 0 !important;
|
|
699
|
+
|
|
700
|
+
&:hover {
|
|
701
|
+
color: #0066ff;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.magicfeedback-skip-container input[type=checkbox] {
|
|
706
|
+
border-color: #999999FF !important;
|
|
707
|
+
border: 0 !important;
|
|
708
|
+
cursor: pointer !important;
|
|
709
|
+
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.magicfeedback-multi-question-matrix,
|
|
713
|
+
.magicfeedback-point-system,
|
|
714
|
+
.magicfeedback-priority-list {
|
|
715
|
+
width: 100% !important;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
.magicfeedback-multi-question-matrix-container,
|
|
719
|
+
.magicfeedback-point-system-container,
|
|
720
|
+
.magicfeedback-priority-list-container {
|
|
721
|
+
width: 100% !important;
|
|
722
|
+
overflow-x: auto;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
.magicfeedback-point-system-list,
|
|
726
|
+
.magicfeedback-priority-list-list,
|
|
727
|
+
.magicfeedback-multi-question-matrix-table {
|
|
728
|
+
width: 100% !important;
|
|
729
|
+
padding: 0 !important;
|
|
730
|
+
overflow-x: auto;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
.magicfeedback-multi-question-matrix {
|
|
734
|
+
position: relative !important;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.magicfeedback-multi-question-matrix-container {
|
|
738
|
+
overflow: auto !important;
|
|
739
|
+
padding-bottom: 10px;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
.magicfeedback-multi-question-matrix-label{
|
|
743
|
+
text-align: left !important;
|
|
744
|
+
}
|
|
745
|
+
.magicfeedback-priority-list-item {
|
|
746
|
+
display: flex;
|
|
747
|
+
flex-direction: row;
|
|
748
|
+
justify-content: space-between;
|
|
749
|
+
align-items: center;
|
|
750
|
+
padding: 10px 0 10px 10px;
|
|
751
|
+
|
|
752
|
+
border: 1px solid #ced4da;
|
|
753
|
+
border-radius: 5px;
|
|
754
|
+
margin: 10px 0 !important;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
.magicfeedback-point-system-item {
|
|
758
|
+
height: 45px;
|
|
759
|
+
margin: 5px 0 !important;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
.magicfeedback-point-system-item label,
|
|
763
|
+
.magicfeedback-priority-list-item-label {
|
|
764
|
+
font-family: inherit;
|
|
765
|
+
font-size: 18px !important;
|
|
766
|
+
color: #212529;
|
|
767
|
+
text-align: start;
|
|
768
|
+
word-wrap: break-word;
|
|
769
|
+
white-space: normal;
|
|
770
|
+
padding: 0 10px 0 0;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
.magicfeedback-point-system-input-container {
|
|
774
|
+
padding: 0 10px 0 0;
|
|
775
|
+
border-radius: 5px;
|
|
776
|
+
font-size: 14px;
|
|
777
|
+
border: 1px solid #ced4da;
|
|
778
|
+
height: 42px;
|
|
779
|
+
margin: auto 0;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.magicfeedback-multi-question-matrix-table thead {
|
|
783
|
+
margin-bottom: 20px;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
.magicfeedback-multi-question-matrix-table th{
|
|
787
|
+
text-align: center;
|
|
788
|
+
font-weight: 400 !important;
|
|
789
|
+
font-size: 1rem !important;
|
|
790
|
+
padding: 0 10px !important;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
.magicfeedback-multi-question-matrix-table th,
|
|
794
|
+
.magicfeedback-multi-question-matrix-table td label,
|
|
795
|
+
.magicfeedback-priority-list-arrow-up,
|
|
796
|
+
.magicfeedback-priority-list-arrow-down {
|
|
797
|
+
font-style: normal !important;
|
|
798
|
+
font-weight: 400 !important;
|
|
799
|
+
font-size: 1rem !important;
|
|
800
|
+
color: #475569 !important;
|
|
801
|
+
cursor: pointer !important;
|
|
802
|
+
margin: 0 !important;
|
|
803
|
+
line-height: inherit;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
.magicfeedback-multi-question-matrix-table tr {
|
|
807
|
+
align-items: center;
|
|
808
|
+
margin: 5px 0;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
.magicfeedback-multi-question-matrix-row-tr{
|
|
812
|
+
border-radius: 5px;
|
|
813
|
+
margin: 10px 0 !important;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
.magicfeedback-multi-question-matrix-row-tr:nth-child(odd) {
|
|
817
|
+
background-color: #f1f6f6; /* Light gray background for odd rows */
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
.magicfeedback-multi-question-matrix-row-tr:nth-child(even) {
|
|
821
|
+
background-color: #ffffff; /* White background for even rows */
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
.magicfeedback-multi-question-matrix-row-label {
|
|
825
|
+
text-align: left !important;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.magicfeedback-point-system-item span {
|
|
829
|
+
color: #475569 !important;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.magicfeedback-point-system-item input {
|
|
833
|
+
padding: 0;
|
|
834
|
+
margin: 0 !important;
|
|
835
|
+
width: auto !important;
|
|
836
|
+
min-width: 100px !important;
|
|
837
|
+
height: auto !important;
|
|
838
|
+
min-height: 42px;
|
|
839
|
+
cursor: pointer;
|
|
840
|
+
font-size: 14px;
|
|
841
|
+
text-align: center !important;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.magicfeedback-multi-question-matrix-table input {
|
|
845
|
+
margin: auto !important;
|
|
846
|
+
padding: 20px !important;
|
|
847
|
+
width: 100% !important;
|
|
848
|
+
height: 15px;
|
|
849
|
+
border: 1px solid #ced4da;
|
|
850
|
+
cursor: pointer;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
.magicfeedback-image{
|
|
854
|
+
max-height: 400px !important;
|
|
855
|
+
height: auto !important;
|
|
856
|
+
max-width: 100% !important;
|
|
857
|
+
margin: 10px auto !important;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.magicfeedback-error{
|
|
861
|
+
margin-top: 5px;
|
|
862
|
+
}`;
|
|
863
|
+
|
|
864
|
+
// src/ui/renderPopup.ts
|
|
865
|
+
function ensureMagicFeedbackStyles(_popup) {
|
|
866
|
+
const STYLE_ID = "magicfeedback-sdk-styles";
|
|
867
|
+
if (document.getElementById(STYLE_ID)) return;
|
|
868
|
+
const style = document.createElement("style");
|
|
869
|
+
style.id = STYLE_ID;
|
|
870
|
+
style.textContent = style_default;
|
|
871
|
+
document.head.appendChild(style);
|
|
872
|
+
}
|
|
873
|
+
function ensureSpinnerStyles(_popup) {
|
|
874
|
+
if (document.getElementById("deepdots-spinner-styles")) return;
|
|
875
|
+
const style = document.createElement("style");
|
|
876
|
+
style.id = "deepdots-spinner-styles";
|
|
877
|
+
style.textContent = `
|
|
878
|
+
@keyframes ddspin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
|
879
|
+
.mf-spinner { display:flex; justify-content:center; align-items:center; padding:8px 0; }
|
|
880
|
+
.mf-spinner-circle { width:28px; height:28px; border:3px solid #e0e6ed; border-top-color:#1E293B; border-radius:50%; animation: ddspin 0.9s linear infinite; }
|
|
881
|
+
`;
|
|
882
|
+
document.head.appendChild(style);
|
|
883
|
+
}
|
|
884
|
+
function ensureResponsiveStyles(_popup) {
|
|
885
|
+
if (document.getElementById("deepdots-responsive-styles")) return;
|
|
886
|
+
const style = document.createElement("style");
|
|
887
|
+
style.id = "deepdots-responsive-styles";
|
|
888
|
+
style.textContent = `
|
|
889
|
+
/* Responsive adjustments */
|
|
890
|
+
@media (max-width: 640px) {
|
|
891
|
+
.deepdots-popup {
|
|
892
|
+
width: calc(100% - 24px) !important;
|
|
893
|
+
max-width: calc(100% - 24px) !important;
|
|
894
|
+
height: auto !important;
|
|
895
|
+
max-height: 90vh !important;
|
|
896
|
+
border-radius: 12px !important;
|
|
897
|
+
padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) 16px !important;
|
|
898
|
+
box-sizing: border-box;
|
|
899
|
+
}
|
|
900
|
+
.deepdots-popup .mf-spinner-circle { width: 32px; height: 32px; border-width: 4px; }
|
|
901
|
+
.deepdots-popup button { font-size: 16px !important; }
|
|
902
|
+
.deepdots-popup-header button { width:48px; height:48px; }
|
|
903
|
+
.deepdots-popup-header button svg { width:26px; height:26px; }
|
|
904
|
+
.deepdots-popup-footer { flex-direction: column-reverse !important; gap: 12px !important; }
|
|
905
|
+
.deepdots-popup-footer button { width: 100%; }
|
|
906
|
+
}
|
|
907
|
+
@media (max-width: 400px) {
|
|
908
|
+
.deepdots-popup { padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)) 12px !important; }
|
|
909
|
+
.deepdots-popup-header button { width:48px; height:48px; }
|
|
910
|
+
.deepdots-popup-header button svg { width:26px; height:26px; }
|
|
911
|
+
}
|
|
912
|
+
@media (orientation: landscape) and (max-height: 480px) {
|
|
913
|
+
.deepdots-popup {
|
|
914
|
+
height: 100vh !important;
|
|
915
|
+
max-height: 100vh !important;
|
|
916
|
+
overflow-y: auto !important;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
`;
|
|
920
|
+
document.head.appendChild(style);
|
|
921
|
+
}
|
|
922
|
+
async function renderPopup(container, surveyId, productId, actions, emit, onClose, env = "production", userId, style, sessionId, miniService) {
|
|
923
|
+
let surveyCompletedEmitted = false;
|
|
924
|
+
let stylesInjected = false;
|
|
925
|
+
const isDark = style?.theme === "dark";
|
|
926
|
+
const theme = {
|
|
927
|
+
popupBg: isDark ? "#1e1e1e" : "#fff",
|
|
928
|
+
textPrimary: isDark ? "#f0f0f0" : "#111",
|
|
929
|
+
closeBtnHoverBg: isDark ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.06)",
|
|
930
|
+
closeBtnHoverColor: isDark ? "#fff" : "#000000"
|
|
931
|
+
};
|
|
932
|
+
const positionMap = {
|
|
933
|
+
"center": { justifyContent: "center", alignItems: "center", background: "rgba(0,0,0,0.5)" },
|
|
934
|
+
"bottom": { justifyContent: "center", alignItems: "flex-end", padding: "16px", background: "transparent" },
|
|
935
|
+
"bottom-right": { justifyContent: "flex-end", alignItems: "flex-end", padding: "16px", background: "transparent" },
|
|
936
|
+
"bottom-left": { justifyContent: "flex-start", alignItems: "flex-end", padding: "16px", background: "transparent" },
|
|
937
|
+
"top": { justifyContent: "center", alignItems: "flex-start", padding: "16px", background: "transparent" },
|
|
938
|
+
"top-right": { justifyContent: "flex-end", alignItems: "flex-start", padding: "16px", background: "transparent" },
|
|
939
|
+
"top-left": { justifyContent: "flex-start", alignItems: "flex-start", padding: "16px", background: "transparent" }
|
|
940
|
+
};
|
|
941
|
+
const pos = positionMap[style?.position ?? "center"] ?? positionMap["center"];
|
|
942
|
+
const popup = document.createElement("div");
|
|
943
|
+
popup.className = "deepdots-popup";
|
|
944
|
+
popup.style.cssText = `
|
|
945
|
+
position: relative;
|
|
946
|
+
display: flex;
|
|
947
|
+
flex-direction: column;
|
|
948
|
+
justify-content: flex-start;
|
|
949
|
+
background: ${theme.popupBg};
|
|
950
|
+
border-radius: 8px;
|
|
951
|
+
padding: 24px;
|
|
952
|
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
|
953
|
+
max-width: 600px;
|
|
954
|
+
width: 90%;
|
|
955
|
+
min-height: 200px;
|
|
956
|
+
`;
|
|
957
|
+
const header = document.createElement("div");
|
|
958
|
+
header.className = "deepdots-popup-header";
|
|
959
|
+
header.style.cssText = "display:flex; justify-content:flex-end; align-items:center; width:100%;";
|
|
960
|
+
const closeBtn = document.createElement("button");
|
|
961
|
+
closeBtn.type = "button";
|
|
962
|
+
closeBtn.setAttribute("aria-label", "Close popup");
|
|
963
|
+
closeBtn.innerHTML = `
|
|
964
|
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
965
|
+
<path d="M6 6L18 18M6 18L18 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
966
|
+
</svg>
|
|
967
|
+
`;
|
|
968
|
+
closeBtn.style.cssText = `
|
|
969
|
+
background:transparent;
|
|
970
|
+
border:none;
|
|
971
|
+
width:32px;
|
|
972
|
+
height:32px;
|
|
973
|
+
display:flex;
|
|
974
|
+
align-items:center;
|
|
975
|
+
justify-content:center;
|
|
976
|
+
border-radius: 8px;
|
|
977
|
+
cursor:pointer;
|
|
978
|
+
color:${theme.textPrimary};
|
|
979
|
+
padding:4px;
|
|
980
|
+
transition: color .15s ease, transform .15s ease, background .15s ease;
|
|
981
|
+
box-shadow: none !important;
|
|
982
|
+
`;
|
|
983
|
+
closeBtn.onmouseenter = () => {
|
|
984
|
+
closeBtn.style.color = theme.closeBtnHoverColor;
|
|
985
|
+
closeBtn.style.background = theme.closeBtnHoverBg;
|
|
986
|
+
closeBtn.style.transform = "scale(1.06)";
|
|
987
|
+
};
|
|
988
|
+
closeBtn.onmouseleave = () => {
|
|
989
|
+
closeBtn.style.color = theme.textPrimary;
|
|
990
|
+
closeBtn.style.background = "transparent";
|
|
991
|
+
closeBtn.style.transform = "scale(1)";
|
|
992
|
+
};
|
|
993
|
+
closeBtn.onclick = () => {
|
|
994
|
+
emit("popup_clicked", surveyId, { action: "close_icon" });
|
|
995
|
+
onClose();
|
|
996
|
+
};
|
|
997
|
+
header.appendChild(closeBtn);
|
|
998
|
+
ensureMagicFeedbackStyles(popup);
|
|
999
|
+
ensureSpinnerStyles(popup);
|
|
1000
|
+
ensureResponsiveStyles(popup);
|
|
1001
|
+
const containerContent = document.createElement("div");
|
|
1002
|
+
containerContent.className = "deepdots-popup-container-conetent";
|
|
1003
|
+
containerContent.style.cssText = `
|
|
1004
|
+
display:flex;
|
|
1005
|
+
flex-direction:column;
|
|
1006
|
+
padding: 0 20px 12px 20px;
|
|
1007
|
+
max-height: 80vh; /* l\xEDmite general del popup */
|
|
1008
|
+
overflow: hidden; /* quita scroll del contenedor principal */
|
|
1009
|
+
`;
|
|
1010
|
+
const main = document.createElement("div");
|
|
1011
|
+
main.className = "deepdots-popup-main";
|
|
1012
|
+
main.style.cssText = "display:flex; flex-direction:column; width:100%; max-height:80vh; overflow-y:auto;";
|
|
1013
|
+
const formWrapper = document.createElement("div");
|
|
1014
|
+
formWrapper.style.cssText = "width:100%; flex: 1 1 auto;";
|
|
1015
|
+
const errorHint = document.createElement("div");
|
|
1016
|
+
errorHint.className = "deepdots-error-hint";
|
|
1017
|
+
errorHint.style.cssText = `
|
|
1018
|
+
display: none;
|
|
1019
|
+
margin: 12px 0 0 0;
|
|
1020
|
+
padding: 10px 12px;
|
|
1021
|
+
border-radius: 6px;
|
|
1022
|
+
background: #FEF3C7; /* amber-100 */
|
|
1023
|
+
color: #92400E; /* amber-700 */
|
|
1024
|
+
border: 1px solid #FCD34D; /* amber-300 */
|
|
1025
|
+
font-size: 13px;
|
|
1026
|
+
`;
|
|
1027
|
+
errorHint.setAttribute("role", "alert");
|
|
1028
|
+
errorHint.setAttribute("aria-live", "polite");
|
|
1029
|
+
const spinnerEl = document.createElement("div");
|
|
1030
|
+
spinnerEl.className = "mf-spinner";
|
|
1031
|
+
spinnerEl.setAttribute("role", "status");
|
|
1032
|
+
spinnerEl.setAttribute("aria-label", "Loading survey");
|
|
1033
|
+
spinnerEl.innerHTML = '<div class="mf-spinner-circle"></div>';
|
|
1034
|
+
spinnerEl.style.cssText = "position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);";
|
|
1035
|
+
const formDivId = `magicfeedback-form-${surveyId}`;
|
|
1036
|
+
const formHost = document.createElement("div");
|
|
1037
|
+
formHost.id = formDivId;
|
|
1038
|
+
formHost.style.cssText = "width:100%; visibility:hidden;";
|
|
1039
|
+
formWrapper.appendChild(spinnerEl);
|
|
1040
|
+
formWrapper.appendChild(formHost);
|
|
1041
|
+
main.appendChild(formWrapper);
|
|
1042
|
+
main.appendChild(errorHint);
|
|
1043
|
+
const footer = document.createElement("div");
|
|
1044
|
+
footer.className = "deepdots-popup-footer";
|
|
1045
|
+
footer.setAttribute("data-actions-wrapper", "true");
|
|
1046
|
+
footer.style.cssText = "display:flex; flex-direction: row-reverse ;justify-content:space-between; align-items:center; gap:8px; margin-top:auto; width:100%; padding-top:16px;";
|
|
1047
|
+
const backButton = document.createElement("button");
|
|
1048
|
+
backButton.textContent = actions?.back ? actions.back.label : "Back";
|
|
1049
|
+
backButton.style.cssText = `
|
|
1050
|
+
background: transparent;
|
|
1051
|
+
color: #333;
|
|
1052
|
+
border: 1px solid #999;
|
|
1053
|
+
padding: 12px 24px;
|
|
1054
|
+
border-radius: 4px;
|
|
1055
|
+
cursor: pointer;
|
|
1056
|
+
font-size: 14px;
|
|
1057
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
1058
|
+
transition: filter .15s ease;
|
|
1059
|
+
display: inline-flex;
|
|
1060
|
+
align-items: center;
|
|
1061
|
+
justify-content: center;
|
|
1062
|
+
text-align: center;
|
|
1063
|
+
`;
|
|
1064
|
+
backButton.onmouseenter = () => {
|
|
1065
|
+
backButton.style.filter = "brightness(0.9)";
|
|
1066
|
+
};
|
|
1067
|
+
backButton.onmouseleave = () => {
|
|
1068
|
+
backButton.style.filter = "brightness(1)";
|
|
1069
|
+
};
|
|
1070
|
+
backButton.onclick = () => {
|
|
1071
|
+
emit("popup_clicked", surveyId, { action: "back" });
|
|
1072
|
+
formInstance?.back?.();
|
|
1073
|
+
};
|
|
1074
|
+
const startButton = document.createElement("button");
|
|
1075
|
+
startButton.textContent = actions?.start ? actions.start.label : "Start survey";
|
|
1076
|
+
startButton.style.cssText = `
|
|
1077
|
+
background: #1E293B;
|
|
1078
|
+
color: #fff;
|
|
1079
|
+
border: none;
|
|
1080
|
+
padding: 12px 24px;
|
|
1081
|
+
border-radius: 4px;
|
|
1082
|
+
cursor: pointer;
|
|
1083
|
+
font-size: 14px;
|
|
1084
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
1085
|
+
transition: filter .15s ease;
|
|
1086
|
+
display: inline-flex;
|
|
1087
|
+
align-items: center;
|
|
1088
|
+
justify-content: center;
|
|
1089
|
+
text-align: center;
|
|
1090
|
+
`;
|
|
1091
|
+
startButton.onclick = () => {
|
|
1092
|
+
emit("popup_clicked", surveyId, { action: "start_survey" });
|
|
1093
|
+
formInstance?.startForm?.();
|
|
1094
|
+
};
|
|
1095
|
+
const closeButton = document.createElement("button");
|
|
1096
|
+
closeButton.textContent = actions?.complete ? actions.complete.label : "Complete survey";
|
|
1097
|
+
closeButton.style.cssText = `
|
|
1098
|
+
background: #1E293B;
|
|
1099
|
+
color: #fff;
|
|
1100
|
+
border: none;
|
|
1101
|
+
padding: 12px 24px;
|
|
1102
|
+
border-radius: 4px;
|
|
1103
|
+
cursor: pointer;
|
|
1104
|
+
font-size: 14px;
|
|
1105
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
1106
|
+
transition: filter .15s ease;
|
|
1107
|
+
display: inline-flex;
|
|
1108
|
+
align-items: center;
|
|
1109
|
+
justify-content: center;
|
|
1110
|
+
text-align: center;
|
|
1111
|
+
`;
|
|
1112
|
+
closeButton.onmouseenter = () => {
|
|
1113
|
+
closeButton.style.filter = "brightness(0.9)";
|
|
1114
|
+
};
|
|
1115
|
+
closeButton.onmouseleave = () => {
|
|
1116
|
+
closeButton.style.filter = "brightness(1)";
|
|
1117
|
+
};
|
|
1118
|
+
closeButton.onclick = () => {
|
|
1119
|
+
emit("popup_clicked", surveyId, { action: "complete" });
|
|
1120
|
+
onClose();
|
|
1121
|
+
};
|
|
1122
|
+
const submitButton = document.createElement("button");
|
|
1123
|
+
submitButton.textContent = actions?.accept ? actions.accept.label : "Send";
|
|
1124
|
+
submitButton.style.cssText = `
|
|
1125
|
+
background: #1E293B;
|
|
1126
|
+
color: #fff;
|
|
1127
|
+
border: none;
|
|
1128
|
+
padding: 12px 24px;
|
|
1129
|
+
border-radius: 4px;
|
|
1130
|
+
cursor: pointer;
|
|
1131
|
+
font-size: 14px;
|
|
1132
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
1133
|
+
transition: filter .15s ease;
|
|
1134
|
+
display: inline-flex;
|
|
1135
|
+
align-items: center;
|
|
1136
|
+
justify-content: center;
|
|
1137
|
+
text-align: center;
|
|
1138
|
+
`;
|
|
1139
|
+
submitButton.onclick = () => {
|
|
1140
|
+
if (!surveyCompletedEmitted) {
|
|
1141
|
+
emit("popup_clicked", surveyId, { action: "manual_send" });
|
|
1142
|
+
formInstance?.send?.();
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
backButton.style.display = "none";
|
|
1146
|
+
startButton.style.display = "none";
|
|
1147
|
+
submitButton.style.display = "none";
|
|
1148
|
+
closeButton.style.display = "none";
|
|
1149
|
+
footer.appendChild(submitButton);
|
|
1150
|
+
footer.appendChild(backButton);
|
|
1151
|
+
footer.appendChild(closeButton);
|
|
1152
|
+
footer.appendChild(startButton);
|
|
1153
|
+
main.appendChild(footer);
|
|
1154
|
+
containerContent.appendChild(main);
|
|
1155
|
+
function updateButtons(state) {
|
|
1156
|
+
backButton.style.display = "none";
|
|
1157
|
+
startButton.style.display = "none";
|
|
1158
|
+
submitButton.style.display = "none";
|
|
1159
|
+
closeButton.style.display = "none";
|
|
1160
|
+
backButton.style.width = "";
|
|
1161
|
+
startButton.style.width = "";
|
|
1162
|
+
submitButton.style.width = "";
|
|
1163
|
+
closeButton.style.width = "";
|
|
1164
|
+
switch (state) {
|
|
1165
|
+
case "loading":
|
|
1166
|
+
break;
|
|
1167
|
+
case "start":
|
|
1168
|
+
startButton.style.display = "inline-flex";
|
|
1169
|
+
startButton.style.width = "100%";
|
|
1170
|
+
break;
|
|
1171
|
+
case "in_progress_first":
|
|
1172
|
+
submitButton.style.display = "inline-flex";
|
|
1173
|
+
submitButton.style.width = "";
|
|
1174
|
+
setLoading(false);
|
|
1175
|
+
break;
|
|
1176
|
+
case "in_progress_next":
|
|
1177
|
+
backButton.style.display = "inline-flex";
|
|
1178
|
+
submitButton.style.display = "inline-flex";
|
|
1179
|
+
setLoading(false);
|
|
1180
|
+
break;
|
|
1181
|
+
case "completed":
|
|
1182
|
+
closeButton.style.display = "inline-flex";
|
|
1183
|
+
closeButton.style.width = "100%";
|
|
1184
|
+
setLoading(false);
|
|
1185
|
+
break;
|
|
1186
|
+
case "error":
|
|
1187
|
+
setLoading(false);
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
popup.appendChild(header);
|
|
1192
|
+
popup.appendChild(containerContent);
|
|
1193
|
+
container.innerHTML = "";
|
|
1194
|
+
container.appendChild(popup);
|
|
1195
|
+
container.style.display = "flex";
|
|
1196
|
+
container.style.justifyContent = pos.justifyContent;
|
|
1197
|
+
container.style.alignItems = pos.alignItems;
|
|
1198
|
+
container.style.background = pos.background;
|
|
1199
|
+
if (pos.padding) container.style.padding = pos.padding;
|
|
1200
|
+
function setLoading(isLoading) {
|
|
1201
|
+
spinnerEl.style.display = isLoading ? "flex" : "none";
|
|
1202
|
+
if (!isLoading) {
|
|
1203
|
+
formHost.style.visibility = "visible";
|
|
1204
|
+
}
|
|
1205
|
+
footer.style.display = isLoading ? "none" : "flex";
|
|
1206
|
+
backButton.disabled = isLoading;
|
|
1207
|
+
startButton.disabled = isLoading;
|
|
1208
|
+
closeButton.disabled = isLoading;
|
|
1209
|
+
submitButton.disabled = isLoading;
|
|
1210
|
+
submitButton.style.opacity = isLoading ? "0.6" : "1";
|
|
1211
|
+
submitButton.style.cursor = isLoading ? "not-allowed" : "pointer";
|
|
1212
|
+
if (isLoading) {
|
|
1213
|
+
updateButtons("loading");
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
setLoading(true);
|
|
1217
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
let formInstance = null;
|
|
1221
|
+
try {
|
|
1222
|
+
if (!magicfeedback || typeof magicfeedback.form !== "function") {
|
|
1223
|
+
console.warn("[MagicFeedback] form() no disponible. Fallback manual.");
|
|
1224
|
+
setLoading(false);
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
magicfeedback.init(
|
|
1228
|
+
{
|
|
1229
|
+
debug: true,
|
|
1230
|
+
env: env === "production" ? "prod" : "dev"
|
|
1231
|
+
}
|
|
1232
|
+
);
|
|
1233
|
+
const { profile, metadata } = buildSurveyIdentity(userId ?? null, sessionId ?? null, miniService ?? null);
|
|
1234
|
+
formInstance = magicfeedback.form(surveyId, productId, profile, metadata);
|
|
1235
|
+
const generateOptions = {
|
|
1236
|
+
addButton: false,
|
|
1237
|
+
getMetaData: true
|
|
1238
|
+
};
|
|
1239
|
+
generateOptions.onLoadedEvent = ({ formData }) => {
|
|
1240
|
+
try {
|
|
1241
|
+
} catch (e) {
|
|
1242
|
+
}
|
|
1243
|
+
const s = formData?.style;
|
|
1244
|
+
if (s && !stylesInjected) {
|
|
1245
|
+
stylesInjected = true;
|
|
1246
|
+
if (s.boxBackgroundColor) {
|
|
1247
|
+
popup.style.background = s.boxBackgroundColor;
|
|
1248
|
+
}
|
|
1249
|
+
if (s.contentAlign) {
|
|
1250
|
+
main.style.justifyContent = s.contentAlign === "center" ? "center" : "flex-start";
|
|
1251
|
+
}
|
|
1252
|
+
if (s.buttonPrimaryColor) {
|
|
1253
|
+
submitButton.style.background = s.buttonPrimaryColor;
|
|
1254
|
+
submitButton.style.border = "none";
|
|
1255
|
+
submitButton.style.color = "#fff";
|
|
1256
|
+
startButton.style.background = s.buttonPrimaryColor;
|
|
1257
|
+
startButton.style.border = "none";
|
|
1258
|
+
startButton.style.color = "#fff";
|
|
1259
|
+
closeButton.style.background = s.buttonPrimaryColor;
|
|
1260
|
+
closeButton.style.border = "none";
|
|
1261
|
+
closeButton.style.color = "#fff";
|
|
1262
|
+
}
|
|
1263
|
+
if (s.buttonSecondaryColor) {
|
|
1264
|
+
backButton.style.background = "#fff";
|
|
1265
|
+
backButton.style.color = s.buttonSecondaryColor;
|
|
1266
|
+
backButton.style.border = `1px solid ${s.buttonSecondaryColor}`;
|
|
1267
|
+
}
|
|
1268
|
+
if (s.logo) {
|
|
1269
|
+
if (!document.getElementById("deepdots-popup-logo")) {
|
|
1270
|
+
const logoImg = document.createElement("img");
|
|
1271
|
+
logoImg.id = "deepdots-popup-logo";
|
|
1272
|
+
logoImg.src = s.logo;
|
|
1273
|
+
logoImg.alt = "Logo";
|
|
1274
|
+
logoImg.style.cssText = "max-height:40px; max-width:100%; object-fit:contain;";
|
|
1275
|
+
if (s.logoSize) {
|
|
1276
|
+
switch (s.logoSize) {
|
|
1277
|
+
case "small":
|
|
1278
|
+
logoImg.style.maxHeight = "30px";
|
|
1279
|
+
break;
|
|
1280
|
+
case "medium":
|
|
1281
|
+
logoImg.style.maxHeight = "50px";
|
|
1282
|
+
break;
|
|
1283
|
+
case "large":
|
|
1284
|
+
logoImg.style.maxHeight = "70px";
|
|
1285
|
+
break;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
if (s.logoPosition) {
|
|
1289
|
+
switch (s.logoPosition) {
|
|
1290
|
+
case "left":
|
|
1291
|
+
logoImg.style.margin = "0 16px 42px 0";
|
|
1292
|
+
logoImg.style.display = "block";
|
|
1293
|
+
logoImg.style.marginLeft = "0";
|
|
1294
|
+
break;
|
|
1295
|
+
case "right":
|
|
1296
|
+
logoImg.style.margin = "0 0 42px 16px";
|
|
1297
|
+
logoImg.style.display = "block";
|
|
1298
|
+
logoImg.style.marginLeft = "auto";
|
|
1299
|
+
break;
|
|
1300
|
+
case "center":
|
|
1301
|
+
logoImg.style.margin = "0 auto 42px auto";
|
|
1302
|
+
logoImg.style.display = "block";
|
|
1303
|
+
break;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
containerContent.insertBefore(logoImg, main);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
if (s.startMessage && s.startMessage !== "") {
|
|
1310
|
+
console.log(s.startMessage);
|
|
1311
|
+
updateButtons("start");
|
|
1312
|
+
} else {
|
|
1313
|
+
updateButtons("in_progress_first");
|
|
1314
|
+
}
|
|
1315
|
+
} else {
|
|
1316
|
+
updateButtons("in_progress_first");
|
|
1317
|
+
}
|
|
1318
|
+
emit("popup_clicked", surveyId, { action: "loaded" });
|
|
1319
|
+
setLoading(false);
|
|
1320
|
+
};
|
|
1321
|
+
generateOptions.beforeSubmitEvent = () => {
|
|
1322
|
+
setLoading(true);
|
|
1323
|
+
emit("popup_clicked", surveyId, { action: "before_submit" });
|
|
1324
|
+
};
|
|
1325
|
+
generateOptions.afterSubmitEvent = ({ error, completed, total, progress }) => {
|
|
1326
|
+
const errText = error ? typeof error === "string" ? error : error.message ?? String(error) : "";
|
|
1327
|
+
if (errText) {
|
|
1328
|
+
setLoading(false);
|
|
1329
|
+
if (errText.toLowerCase().includes("no response")) {
|
|
1330
|
+
errorHint.textContent = "Please answer the required question to continue.";
|
|
1331
|
+
errorHint.style.display = "block";
|
|
1332
|
+
emit("popup_clicked", surveyId, { action: "validation_error_required" });
|
|
1333
|
+
updateButtons("in_progress_next");
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
errorHint.textContent = "An error occurred while submitting. Please try again or close the popup.";
|
|
1337
|
+
errorHint.style.display = "block";
|
|
1338
|
+
emit("popup_clicked", surveyId, { action: "submit_error", error: errText });
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
errorHint.style.display = "none";
|
|
1342
|
+
setLoading(false);
|
|
1343
|
+
if (completed) {
|
|
1344
|
+
emit("survey_completed", surveyId, { action: "completed" });
|
|
1345
|
+
surveyCompletedEmitted = true;
|
|
1346
|
+
updateButtons("completed");
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
emit("popup_clicked", surveyId, { action: "partial" });
|
|
1350
|
+
if (total > 1 && progress > 0 && progress < total) {
|
|
1351
|
+
updateButtons("in_progress_next");
|
|
1352
|
+
} else {
|
|
1353
|
+
updateButtons("in_progress_first");
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
generateOptions.onBackEvent = ({ progress }) => {
|
|
1357
|
+
emit("popup_clicked", surveyId, { action: "back" });
|
|
1358
|
+
if (progress === 0) {
|
|
1359
|
+
updateButtons("in_progress_first");
|
|
1360
|
+
} else {
|
|
1361
|
+
updateButtons("in_progress_next");
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
formInstance.generate(formDivId, generateOptions).catch((err) => {
|
|
1365
|
+
console.error("[MagicFeedback] Error generating form:", err);
|
|
1366
|
+
setLoading(false);
|
|
1367
|
+
});
|
|
1368
|
+
} catch (e) {
|
|
1369
|
+
console.error("[MagicFeedback] Exception initializing form:", e);
|
|
1370
|
+
setLoading(false);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
export {
|
|
1374
|
+
renderPopup
|
|
1375
|
+
};
|
|
1376
|
+
//# sourceMappingURL=renderPopup-7GGKR5BY.mjs.map
|