pushfeedback 0.1.55 → 0.1.57

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