pushfeedback 0.1.45 → 0.1.46

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 (39) hide show
  1. package/dist/cjs/feedback-button_2.cjs.entry.js +8267 -0
  2. package/dist/cjs/index-b596cc3a.js +1551 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/loader.cjs.js +22 -0
  5. package/dist/cjs/pushfeedback.cjs.js +23 -0
  6. package/dist/collection/collection-manifest.json +13 -0
  7. package/dist/collection/components/feedback-button/feedback-button.css +71 -0
  8. package/dist/collection/components/feedback-button/feedback-button.js +671 -0
  9. package/dist/collection/components/feedback-modal/feedback-modal.css +388 -0
  10. package/dist/collection/components/feedback-modal/feedback-modal.js +845 -0
  11. package/dist/collection/index.js +1 -0
  12. package/dist/{pushfeedback/feedback-button.entry.js → components/feedback-button.js} +63 -8
  13. package/dist/components/feedback-modal.js +6 -0
  14. package/dist/{pushfeedback/feedback-modal.entry.js → components/feedback-modal2.js} +67 -44
  15. package/dist/components/index.js +3 -0
  16. package/dist/esm/feedback-button_2.entry.js +8262 -0
  17. package/dist/esm/index-deb00b84.js +1523 -0
  18. package/dist/esm/index.js +1 -0
  19. package/dist/esm/loader.js +18 -0
  20. package/dist/esm/polyfills/core-js.js +11 -0
  21. package/dist/esm/polyfills/css-shim.js +1 -0
  22. package/dist/esm/polyfills/dom.js +79 -0
  23. package/dist/esm/polyfills/es5-html-element.js +1 -0
  24. package/dist/esm/polyfills/index.js +34 -0
  25. package/dist/esm/polyfills/system.js +6 -0
  26. package/dist/esm/pushfeedback.js +18 -0
  27. package/dist/index.cjs.js +1 -0
  28. package/dist/index.js +1 -0
  29. package/dist/pushfeedback/index.esm.js +0 -1
  30. package/dist/pushfeedback/p-90e8ba79.js +2 -0
  31. package/dist/pushfeedback/p-fa888cd3.entry.js +22 -0
  32. package/dist/pushfeedback/pushfeedback.css +1 -108
  33. package/dist/pushfeedback/pushfeedback.esm.js +1 -148
  34. package/package.json +1 -1
  35. package/dist/pushfeedback/app-globals-0f993ce5.js +0 -3
  36. package/dist/pushfeedback/css-shim-b7d3d95f.js +0 -4
  37. package/dist/pushfeedback/dom-64053c71.js +0 -73
  38. package/dist/pushfeedback/index-6a05f159.js +0 -3371
  39. package/dist/pushfeedback/shadow-css-98135883.js +0 -387
@@ -0,0 +1,671 @@
1
+ import { Host, h } from '@stencil/core';
2
+ export class FeedbackButton {
3
+ constructor() {
4
+ this.sessionId = "";
5
+ this.customFont = false;
6
+ this.errorMessage = "Please try again later.";
7
+ this.errorMessage403 = "The request URL does not match the one defined in PushFeedback for this project.";
8
+ this.errorMessage404 = "We could not find the provided project id in PushFeedback.";
9
+ this.modalTitle = 'Share your feedback';
10
+ this.modalTitleSuccess = 'Thanks for your feedback!';
11
+ this.modalTitleError = "Oops!";
12
+ this.modalPosition = 'center';
13
+ this.sendButtonText = 'Send';
14
+ this.successMessage = "";
15
+ this.project = '';
16
+ this.screenshotButtonText = 'Add a screenshot';
17
+ this.screenshotTopbarText = 'Select an element on this page';
18
+ this.hideEmail = false;
19
+ this.emailAddress = '';
20
+ this.emailPlaceholder = 'Email address (optional)';
21
+ this.messagePlaceholder = 'Comments';
22
+ this.hideRating = false;
23
+ this.rating = undefined;
24
+ this.ratingMode = 'thumbs';
25
+ this.ratingPlaceholder = 'Was this page helpful?';
26
+ this.ratingStarsPlaceholder = 'How would you rate this page?';
27
+ this.buttonStyle = 'default';
28
+ this.buttonPosition = 'default';
29
+ this.hideIcon = false;
30
+ this.hideScreenshotButton = false;
31
+ this.hidePrivacyPolicy = true;
32
+ this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
33
+ this.fetchData = true;
34
+ }
35
+ componentWillLoad() {
36
+ if (!this.sessionId) {
37
+ let storedSessionId = localStorage.getItem('pushfeedback_sessionid');
38
+ if (!storedSessionId) {
39
+ storedSessionId = this.generateRandomSessionId();
40
+ localStorage.setItem('pushfeedback_sessionid', storedSessionId);
41
+ this.sessionId = storedSessionId;
42
+ }
43
+ }
44
+ }
45
+ componentDidLoad() {
46
+ if (this.buttonPosition === 'center-right') {
47
+ const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
48
+ let adjustement = 0;
49
+ if (this.isSafariBrowser()) {
50
+ adjustement = 10;
51
+ }
52
+ buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
53
+ }
54
+ if (!this.customFont) {
55
+ this.loadInterFont();
56
+ }
57
+ }
58
+ connectedCallback() {
59
+ this.feedbackModal = document.createElement('feedback-modal');
60
+ const props = [
61
+ 'customFont',
62
+ 'errorMessage',
63
+ 'errorMessage403',
64
+ 'errorMessage404',
65
+ 'modalTitle',
66
+ 'modalTitleSuccess',
67
+ 'modalTitleError',
68
+ 'modalPosition',
69
+ 'sendButtonText',
70
+ 'successMessage',
71
+ 'project',
72
+ 'screenshotButtonText',
73
+ 'screenshotTopbarText',
74
+ 'hideEmail',
75
+ 'emailAddress',
76
+ 'emailPlaceholder',
77
+ 'messagePlaceholder',
78
+ 'hideRating',
79
+ 'rating',
80
+ 'ratingMode',
81
+ 'ratingPlaceholder',
82
+ 'ratingStarsPlaceholder',
83
+ 'hideScreenshotButton',
84
+ 'hidePrivacyPolicy',
85
+ 'privacyPolicyText',
86
+ 'fetchData'
87
+ ];
88
+ props.forEach(prop => {
89
+ this.feedbackModal[prop] = this[prop];
90
+ });
91
+ document.body.appendChild(this.feedbackModal);
92
+ }
93
+ disconnectedCallback() {
94
+ document.body.removeChild(this.feedbackModal);
95
+ }
96
+ generateRandomSessionId(length = 16) {
97
+ return Math.random().toString(36).substr(2, length);
98
+ }
99
+ isSafariBrowser() {
100
+ const isSafari = /safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent);
101
+ return isSafari;
102
+ }
103
+ loadInterFont() {
104
+ const link = document.createElement('link');
105
+ link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
106
+ link.rel = 'stylesheet';
107
+ document.head.appendChild(link);
108
+ }
109
+ showModal() {
110
+ this.feedbackModal.showModal = true;
111
+ }
112
+ render() {
113
+ return (h(Host, null, h("a", { class: `feedback-button-content feedback-button-content--${this.buttonStyle} feedback-button-content--${this.buttonPosition}`, onClick: () => this.showModal() }, !this.hideIcon && this.buttonStyle != 'default' && (h("span", { class: "feedback-button-content-icon" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#fff", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "icon-edit" }, h("path", { d: "M12 20h9" }), h("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })))), h("slot", null))));
114
+ }
115
+ static get is() { return "feedback-button"; }
116
+ static get encapsulation() { return "shadow"; }
117
+ static get originalStyleUrls() {
118
+ return {
119
+ "$": ["feedback-button.css"]
120
+ };
121
+ }
122
+ static get styleUrls() {
123
+ return {
124
+ "$": ["feedback-button.css"]
125
+ };
126
+ }
127
+ static get properties() {
128
+ return {
129
+ "sessionId": {
130
+ "type": "string",
131
+ "mutable": true,
132
+ "complexType": {
133
+ "original": "string",
134
+ "resolved": "string",
135
+ "references": {}
136
+ },
137
+ "required": false,
138
+ "optional": false,
139
+ "docs": {
140
+ "tags": [],
141
+ "text": ""
142
+ },
143
+ "attribute": "session-id",
144
+ "reflect": true,
145
+ "defaultValue": "\"\""
146
+ },
147
+ "customFont": {
148
+ "type": "boolean",
149
+ "mutable": false,
150
+ "complexType": {
151
+ "original": "boolean",
152
+ "resolved": "boolean",
153
+ "references": {}
154
+ },
155
+ "required": false,
156
+ "optional": false,
157
+ "docs": {
158
+ "tags": [],
159
+ "text": ""
160
+ },
161
+ "attribute": "custom-font",
162
+ "reflect": false,
163
+ "defaultValue": "false"
164
+ },
165
+ "errorMessage": {
166
+ "type": "string",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "string",
170
+ "resolved": "string",
171
+ "references": {}
172
+ },
173
+ "required": false,
174
+ "optional": false,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": ""
178
+ },
179
+ "attribute": "error-message",
180
+ "reflect": false,
181
+ "defaultValue": "\"Please try again later.\""
182
+ },
183
+ "errorMessage403": {
184
+ "type": "string",
185
+ "mutable": false,
186
+ "complexType": {
187
+ "original": "string",
188
+ "resolved": "string",
189
+ "references": {}
190
+ },
191
+ "required": false,
192
+ "optional": false,
193
+ "docs": {
194
+ "tags": [],
195
+ "text": ""
196
+ },
197
+ "attribute": "error-message-4-0-3",
198
+ "reflect": false,
199
+ "defaultValue": "\"The request URL does not match the one defined in PushFeedback for this project.\""
200
+ },
201
+ "errorMessage404": {
202
+ "type": "string",
203
+ "mutable": false,
204
+ "complexType": {
205
+ "original": "string",
206
+ "resolved": "string",
207
+ "references": {}
208
+ },
209
+ "required": false,
210
+ "optional": false,
211
+ "docs": {
212
+ "tags": [],
213
+ "text": ""
214
+ },
215
+ "attribute": "error-message-4-0-4",
216
+ "reflect": false,
217
+ "defaultValue": "\"We could not find the provided project id in PushFeedback.\""
218
+ },
219
+ "modalTitle": {
220
+ "type": "string",
221
+ "mutable": false,
222
+ "complexType": {
223
+ "original": "string",
224
+ "resolved": "string",
225
+ "references": {}
226
+ },
227
+ "required": false,
228
+ "optional": false,
229
+ "docs": {
230
+ "tags": [],
231
+ "text": ""
232
+ },
233
+ "attribute": "modal-title",
234
+ "reflect": false,
235
+ "defaultValue": "'Share your feedback'"
236
+ },
237
+ "modalTitleSuccess": {
238
+ "type": "string",
239
+ "mutable": false,
240
+ "complexType": {
241
+ "original": "string",
242
+ "resolved": "string",
243
+ "references": {}
244
+ },
245
+ "required": false,
246
+ "optional": false,
247
+ "docs": {
248
+ "tags": [],
249
+ "text": ""
250
+ },
251
+ "attribute": "modal-title-success",
252
+ "reflect": false,
253
+ "defaultValue": "'Thanks for your feedback!'"
254
+ },
255
+ "modalTitleError": {
256
+ "type": "string",
257
+ "mutable": false,
258
+ "complexType": {
259
+ "original": "string",
260
+ "resolved": "string",
261
+ "references": {}
262
+ },
263
+ "required": false,
264
+ "optional": false,
265
+ "docs": {
266
+ "tags": [],
267
+ "text": ""
268
+ },
269
+ "attribute": "modal-title-error",
270
+ "reflect": false,
271
+ "defaultValue": "\"Oops!\""
272
+ },
273
+ "modalPosition": {
274
+ "type": "string",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "string",
278
+ "resolved": "string",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": ""
286
+ },
287
+ "attribute": "modal-position",
288
+ "reflect": false,
289
+ "defaultValue": "'center'"
290
+ },
291
+ "sendButtonText": {
292
+ "type": "string",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "string",
296
+ "resolved": "string",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": ""
304
+ },
305
+ "attribute": "send-button-text",
306
+ "reflect": false,
307
+ "defaultValue": "'Send'"
308
+ },
309
+ "successMessage": {
310
+ "type": "string",
311
+ "mutable": false,
312
+ "complexType": {
313
+ "original": "string",
314
+ "resolved": "string",
315
+ "references": {}
316
+ },
317
+ "required": false,
318
+ "optional": false,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": ""
322
+ },
323
+ "attribute": "success-message",
324
+ "reflect": false,
325
+ "defaultValue": "\"\""
326
+ },
327
+ "project": {
328
+ "type": "string",
329
+ "mutable": false,
330
+ "complexType": {
331
+ "original": "string",
332
+ "resolved": "string",
333
+ "references": {}
334
+ },
335
+ "required": false,
336
+ "optional": false,
337
+ "docs": {
338
+ "tags": [],
339
+ "text": ""
340
+ },
341
+ "attribute": "project",
342
+ "reflect": false,
343
+ "defaultValue": "''"
344
+ },
345
+ "screenshotButtonText": {
346
+ "type": "string",
347
+ "mutable": false,
348
+ "complexType": {
349
+ "original": "string",
350
+ "resolved": "string",
351
+ "references": {}
352
+ },
353
+ "required": false,
354
+ "optional": false,
355
+ "docs": {
356
+ "tags": [],
357
+ "text": ""
358
+ },
359
+ "attribute": "screenshot-button-text",
360
+ "reflect": false,
361
+ "defaultValue": "'Add a screenshot'"
362
+ },
363
+ "screenshotTopbarText": {
364
+ "type": "string",
365
+ "mutable": false,
366
+ "complexType": {
367
+ "original": "string",
368
+ "resolved": "string",
369
+ "references": {}
370
+ },
371
+ "required": false,
372
+ "optional": false,
373
+ "docs": {
374
+ "tags": [],
375
+ "text": ""
376
+ },
377
+ "attribute": "screenshot-topbar-text",
378
+ "reflect": false,
379
+ "defaultValue": "'Select an element on this page'"
380
+ },
381
+ "hideEmail": {
382
+ "type": "boolean",
383
+ "mutable": false,
384
+ "complexType": {
385
+ "original": "boolean",
386
+ "resolved": "boolean",
387
+ "references": {}
388
+ },
389
+ "required": false,
390
+ "optional": false,
391
+ "docs": {
392
+ "tags": [],
393
+ "text": ""
394
+ },
395
+ "attribute": "hide-email",
396
+ "reflect": false,
397
+ "defaultValue": "false"
398
+ },
399
+ "emailAddress": {
400
+ "type": "string",
401
+ "mutable": false,
402
+ "complexType": {
403
+ "original": "string",
404
+ "resolved": "string",
405
+ "references": {}
406
+ },
407
+ "required": false,
408
+ "optional": false,
409
+ "docs": {
410
+ "tags": [],
411
+ "text": ""
412
+ },
413
+ "attribute": "email-address",
414
+ "reflect": false,
415
+ "defaultValue": "''"
416
+ },
417
+ "emailPlaceholder": {
418
+ "type": "string",
419
+ "mutable": false,
420
+ "complexType": {
421
+ "original": "string",
422
+ "resolved": "string",
423
+ "references": {}
424
+ },
425
+ "required": false,
426
+ "optional": false,
427
+ "docs": {
428
+ "tags": [],
429
+ "text": ""
430
+ },
431
+ "attribute": "email-placeholder",
432
+ "reflect": false,
433
+ "defaultValue": "'Email address (optional)'"
434
+ },
435
+ "messagePlaceholder": {
436
+ "type": "string",
437
+ "mutable": false,
438
+ "complexType": {
439
+ "original": "string",
440
+ "resolved": "string",
441
+ "references": {}
442
+ },
443
+ "required": false,
444
+ "optional": false,
445
+ "docs": {
446
+ "tags": [],
447
+ "text": ""
448
+ },
449
+ "attribute": "message-placeholder",
450
+ "reflect": false,
451
+ "defaultValue": "'Comments'"
452
+ },
453
+ "hideRating": {
454
+ "type": "boolean",
455
+ "mutable": false,
456
+ "complexType": {
457
+ "original": "boolean",
458
+ "resolved": "boolean",
459
+ "references": {}
460
+ },
461
+ "required": false,
462
+ "optional": false,
463
+ "docs": {
464
+ "tags": [],
465
+ "text": ""
466
+ },
467
+ "attribute": "hide-rating",
468
+ "reflect": false,
469
+ "defaultValue": "false"
470
+ },
471
+ "rating": {
472
+ "type": "number",
473
+ "mutable": false,
474
+ "complexType": {
475
+ "original": "number",
476
+ "resolved": "number",
477
+ "references": {}
478
+ },
479
+ "required": false,
480
+ "optional": false,
481
+ "docs": {
482
+ "tags": [],
483
+ "text": ""
484
+ },
485
+ "attribute": "rating",
486
+ "reflect": false
487
+ },
488
+ "ratingMode": {
489
+ "type": "string",
490
+ "mutable": false,
491
+ "complexType": {
492
+ "original": "string",
493
+ "resolved": "string",
494
+ "references": {}
495
+ },
496
+ "required": false,
497
+ "optional": false,
498
+ "docs": {
499
+ "tags": [],
500
+ "text": ""
501
+ },
502
+ "attribute": "rating-mode",
503
+ "reflect": false,
504
+ "defaultValue": "'thumbs'"
505
+ },
506
+ "ratingPlaceholder": {
507
+ "type": "string",
508
+ "mutable": false,
509
+ "complexType": {
510
+ "original": "string",
511
+ "resolved": "string",
512
+ "references": {}
513
+ },
514
+ "required": false,
515
+ "optional": false,
516
+ "docs": {
517
+ "tags": [],
518
+ "text": ""
519
+ },
520
+ "attribute": "rating-placeholder",
521
+ "reflect": false,
522
+ "defaultValue": "'Was this page helpful?'"
523
+ },
524
+ "ratingStarsPlaceholder": {
525
+ "type": "string",
526
+ "mutable": false,
527
+ "complexType": {
528
+ "original": "string",
529
+ "resolved": "string",
530
+ "references": {}
531
+ },
532
+ "required": false,
533
+ "optional": false,
534
+ "docs": {
535
+ "tags": [],
536
+ "text": ""
537
+ },
538
+ "attribute": "rating-stars-placeholder",
539
+ "reflect": false,
540
+ "defaultValue": "'How would you rate this page?'"
541
+ },
542
+ "buttonStyle": {
543
+ "type": "string",
544
+ "mutable": false,
545
+ "complexType": {
546
+ "original": "string",
547
+ "resolved": "string",
548
+ "references": {}
549
+ },
550
+ "required": false,
551
+ "optional": false,
552
+ "docs": {
553
+ "tags": [],
554
+ "text": ""
555
+ },
556
+ "attribute": "button-style",
557
+ "reflect": false,
558
+ "defaultValue": "'default'"
559
+ },
560
+ "buttonPosition": {
561
+ "type": "string",
562
+ "mutable": false,
563
+ "complexType": {
564
+ "original": "string",
565
+ "resolved": "string",
566
+ "references": {}
567
+ },
568
+ "required": false,
569
+ "optional": false,
570
+ "docs": {
571
+ "tags": [],
572
+ "text": ""
573
+ },
574
+ "attribute": "button-position",
575
+ "reflect": false,
576
+ "defaultValue": "'default'"
577
+ },
578
+ "hideIcon": {
579
+ "type": "boolean",
580
+ "mutable": false,
581
+ "complexType": {
582
+ "original": "boolean",
583
+ "resolved": "boolean",
584
+ "references": {}
585
+ },
586
+ "required": false,
587
+ "optional": false,
588
+ "docs": {
589
+ "tags": [],
590
+ "text": ""
591
+ },
592
+ "attribute": "hide-icon",
593
+ "reflect": false,
594
+ "defaultValue": "false"
595
+ },
596
+ "hideScreenshotButton": {
597
+ "type": "boolean",
598
+ "mutable": false,
599
+ "complexType": {
600
+ "original": "boolean",
601
+ "resolved": "boolean",
602
+ "references": {}
603
+ },
604
+ "required": false,
605
+ "optional": false,
606
+ "docs": {
607
+ "tags": [],
608
+ "text": ""
609
+ },
610
+ "attribute": "hide-screenshot-button",
611
+ "reflect": false,
612
+ "defaultValue": "false"
613
+ },
614
+ "hidePrivacyPolicy": {
615
+ "type": "boolean",
616
+ "mutable": false,
617
+ "complexType": {
618
+ "original": "boolean",
619
+ "resolved": "boolean",
620
+ "references": {}
621
+ },
622
+ "required": false,
623
+ "optional": false,
624
+ "docs": {
625
+ "tags": [],
626
+ "text": ""
627
+ },
628
+ "attribute": "hide-privacy-policy",
629
+ "reflect": false,
630
+ "defaultValue": "true"
631
+ },
632
+ "privacyPolicyText": {
633
+ "type": "string",
634
+ "mutable": false,
635
+ "complexType": {
636
+ "original": "string",
637
+ "resolved": "string",
638
+ "references": {}
639
+ },
640
+ "required": false,
641
+ "optional": false,
642
+ "docs": {
643
+ "tags": [],
644
+ "text": ""
645
+ },
646
+ "attribute": "privacy-policy-text",
647
+ "reflect": false,
648
+ "defaultValue": "\"I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.\""
649
+ },
650
+ "fetchData": {
651
+ "type": "boolean",
652
+ "mutable": false,
653
+ "complexType": {
654
+ "original": "boolean",
655
+ "resolved": "boolean",
656
+ "references": {}
657
+ },
658
+ "required": false,
659
+ "optional": false,
660
+ "docs": {
661
+ "tags": [],
662
+ "text": ""
663
+ },
664
+ "attribute": "fetch-data",
665
+ "reflect": false,
666
+ "defaultValue": "true"
667
+ }
668
+ };
669
+ }
670
+ static get elementRef() { return "el"; }
671
+ }