pushfeedback 0.1.83 → 0.1.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/canvas-editor_3.cjs.entry.js +440 -44
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pushfeedback.cjs.js +1 -1
- package/dist/collection/components/canvas-editor/canvas-editor.js +173 -15
- package/dist/collection/components/feedback-button/feedback-button.css +45 -1
- package/dist/collection/components/feedback-button/feedback-button.js +98 -8
- package/dist/collection/components/feedback-modal/feedback-modal.css +6 -0
- package/dist/collection/components/feedback-modal/feedback-modal.js +351 -20
- package/dist/collection/utils/sanitize-html.js +90 -0
- package/dist/components/canvas-editor2.js +139 -15
- package/dist/components/feedback-button.js +30 -8
- package/dist/components/feedback-modal2.js +286 -21
- package/dist/esm/canvas-editor_3.entry.js +440 -44
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pushfeedback.js +1 -1
- package/dist/pushfeedback/p-17acbd1c.entry.js +1 -0
- package/dist/pushfeedback/pushfeedback.esm.js +1 -1
- package/dist/types/components/canvas-editor/canvas-editor.d.ts +7 -0
- package/dist/types/components/feedback-button/feedback-button.d.ts +16 -0
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +33 -0
- package/dist/types/components.d.ts +48 -0
- package/dist/types/utils/sanitize-html.d.ts +8 -0
- package/package.json +2 -1
- package/dist/pushfeedback/p-1338beed.entry.js +0 -1
|
@@ -8,8 +8,11 @@ export class FeedbackButton {
|
|
|
8
8
|
this.sessionId = '';
|
|
9
9
|
this.metadata = '';
|
|
10
10
|
this.submit = false;
|
|
11
|
+
this.apiKey = '';
|
|
12
|
+
this.clickOutsideClose = true;
|
|
11
13
|
this.customFont = false;
|
|
12
14
|
this.emailAddress = '';
|
|
15
|
+
this.historyClose = true;
|
|
13
16
|
this.isEmailRequired = false;
|
|
14
17
|
this.fetchData = true;
|
|
15
18
|
this.hideEmail = false;
|
|
@@ -22,6 +25,7 @@ export class FeedbackButton {
|
|
|
22
25
|
this.ratingMode = 'thumbs';
|
|
23
26
|
this.emailPlaceholder = 'Email address (optional)';
|
|
24
27
|
this.errorMessage = 'Please try again later.';
|
|
28
|
+
this.errorMessage401 = 'This project requires a valid API key to submit feedback. Check the api-key attribute.';
|
|
25
29
|
this.errorMessage403 = 'The request URL does not match the one defined in PushFeedback for this project.';
|
|
26
30
|
this.errorMessage404 = 'We could not find the provided project id in PushFeedback.';
|
|
27
31
|
this.footerText = '';
|
|
@@ -67,13 +71,19 @@ export class FeedbackButton {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
componentDidLoad() {
|
|
70
|
-
if (this.buttonPosition === 'center-right') {
|
|
74
|
+
if (this.buttonPosition === 'center-right' || this.buttonPosition === 'center-left') {
|
|
71
75
|
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
72
76
|
let adjustement = 0;
|
|
73
77
|
if (this.isSafariBrowser()) {
|
|
74
78
|
adjustement = 5;
|
|
75
79
|
}
|
|
76
|
-
|
|
80
|
+
const offset = `${((buttonContent.offsetWidth + adjustement) / 2) * -1}px`;
|
|
81
|
+
if (this.buttonPosition === 'center-right') {
|
|
82
|
+
buttonContent.style.right = offset;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
buttonContent.style.left = offset;
|
|
86
|
+
}
|
|
77
87
|
}
|
|
78
88
|
if (!this.customFont) {
|
|
79
89
|
this.loadInterFont();
|
|
@@ -82,9 +92,12 @@ export class FeedbackButton {
|
|
|
82
92
|
connectedCallback() {
|
|
83
93
|
this.feedbackModal = document.createElement('feedback-modal');
|
|
84
94
|
const props = [
|
|
95
|
+
'apiKey',
|
|
96
|
+
'clickOutsideClose',
|
|
85
97
|
'customFont',
|
|
86
98
|
'emailAddress',
|
|
87
99
|
'fetchData',
|
|
100
|
+
'historyClose',
|
|
88
101
|
'hideEmail',
|
|
89
102
|
'hidePrivacyPolicy',
|
|
90
103
|
'hideRating',
|
|
@@ -110,6 +123,7 @@ export class FeedbackButton {
|
|
|
110
123
|
'screenshotErrorUnexpected',
|
|
111
124
|
'emailPlaceholder',
|
|
112
125
|
'errorMessage',
|
|
126
|
+
'errorMessage401',
|
|
113
127
|
'errorMessage403',
|
|
114
128
|
'errorMessage404',
|
|
115
129
|
'footerText',
|
|
@@ -174,12 +188,16 @@ export class FeedbackButton {
|
|
|
174
188
|
}
|
|
175
189
|
}
|
|
176
190
|
const body = Object.assign({ url: window.location.href, project: this.project, rating: this.rating || -1, ratingMode: this.ratingMode, message: '', metadata: this.metadata, session: localStorage.getItem('pushfeedback_sessionid') || '' }, (recaptchaToken && { recaptchaToken }));
|
|
177
|
-
const
|
|
191
|
+
const headers = {
|
|
192
|
+
'Content-Type': 'application/json',
|
|
193
|
+
};
|
|
194
|
+
if (this.apiKey) {
|
|
195
|
+
headers['Authorization'] = `Api-Key ${this.apiKey}`;
|
|
196
|
+
}
|
|
197
|
+
const res = await fetch('https://app.pushfeedback.com/api/v1/feedback/', {
|
|
178
198
|
method: 'POST',
|
|
179
199
|
body: JSON.stringify(body),
|
|
180
|
-
headers
|
|
181
|
-
'Content-Type': 'application/json',
|
|
182
|
-
},
|
|
200
|
+
headers,
|
|
183
201
|
});
|
|
184
202
|
if (res.status === 201) {
|
|
185
203
|
const feedback_with_id = Object.assign(Object.assign({}, body), { id: await res.json() });
|
|
@@ -210,7 +228,7 @@ export class FeedbackButton {
|
|
|
210
228
|
}
|
|
211
229
|
}
|
|
212
230
|
render() {
|
|
213
|
-
return (h(Host, null, h("
|
|
231
|
+
return (h(Host, null, h("button", { type: "button", class: `feedback-button-content feedback-button-content--${this.buttonStyle} feedback-button-content--${this.buttonPosition} ${this.customFont ? 'feedback-button-content--custom-font' : ''} ${this.hideMobile ? 'feedback-button-content--hide-mobile' : ''}`, part: "button", onClick: () => this.showModal() }, !this.hideIcon && this.buttonStyle != 'default' && (h("span", { class: "feedback-button-content-icon", part: "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))));
|
|
214
232
|
}
|
|
215
233
|
static get is() { return "feedback-button"; }
|
|
216
234
|
static get encapsulation() { return "shadow"; }
|
|
@@ -238,7 +256,7 @@ export class FeedbackButton {
|
|
|
238
256
|
"optional": false,
|
|
239
257
|
"docs": {
|
|
240
258
|
"tags": [],
|
|
241
|
-
"text": ""
|
|
259
|
+
"text": "Position of the button on the page. Valid values: `default`, `bottom-right`, `bottom-left`, `top-right`, `top-left`, `center-right` (vertical tab on the right edge) and `center-left` (vertical tab on the left edge). Any other value behaves like `default`."
|
|
242
260
|
},
|
|
243
261
|
"attribute": "button-position",
|
|
244
262
|
"reflect": false,
|
|
@@ -352,6 +370,42 @@ export class FeedbackButton {
|
|
|
352
370
|
"reflect": false,
|
|
353
371
|
"defaultValue": "false"
|
|
354
372
|
},
|
|
373
|
+
"apiKey": {
|
|
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": "Optional API key sent with feedback submissions, for projects that\nrequire one. Sent as `Authorization: Api-Key <key>` on the feedback POST\nrequest only, never on the public config request. Only use keys scoped to\n`feedback:submit`: like any credential used by an embedded widget, the\nvalue is part of the page and readable by any script running on it, so it\nprovides server-side scoping and traceability rather than client-side\nsecrecy. Intended for internal or access-controlled pages."
|
|
386
|
+
},
|
|
387
|
+
"attribute": "api-key",
|
|
388
|
+
"reflect": false,
|
|
389
|
+
"defaultValue": "''"
|
|
390
|
+
},
|
|
391
|
+
"clickOutsideClose": {
|
|
392
|
+
"type": "boolean",
|
|
393
|
+
"mutable": false,
|
|
394
|
+
"complexType": {
|
|
395
|
+
"original": "boolean",
|
|
396
|
+
"resolved": "boolean",
|
|
397
|
+
"references": {}
|
|
398
|
+
},
|
|
399
|
+
"required": false,
|
|
400
|
+
"optional": false,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": ""
|
|
404
|
+
},
|
|
405
|
+
"attribute": "click-outside-close",
|
|
406
|
+
"reflect": false,
|
|
407
|
+
"defaultValue": "true"
|
|
408
|
+
},
|
|
355
409
|
"customFont": {
|
|
356
410
|
"type": "boolean",
|
|
357
411
|
"mutable": false,
|
|
@@ -388,6 +442,24 @@ export class FeedbackButton {
|
|
|
388
442
|
"reflect": false,
|
|
389
443
|
"defaultValue": "''"
|
|
390
444
|
},
|
|
445
|
+
"historyClose": {
|
|
446
|
+
"type": "boolean",
|
|
447
|
+
"mutable": false,
|
|
448
|
+
"complexType": {
|
|
449
|
+
"original": "boolean",
|
|
450
|
+
"resolved": "boolean",
|
|
451
|
+
"references": {}
|
|
452
|
+
},
|
|
453
|
+
"required": false,
|
|
454
|
+
"optional": false,
|
|
455
|
+
"docs": {
|
|
456
|
+
"tags": [],
|
|
457
|
+
"text": ""
|
|
458
|
+
},
|
|
459
|
+
"attribute": "history-close",
|
|
460
|
+
"reflect": false,
|
|
461
|
+
"defaultValue": "true"
|
|
462
|
+
},
|
|
391
463
|
"isEmailRequired": {
|
|
392
464
|
"type": "boolean",
|
|
393
465
|
"mutable": false,
|
|
@@ -603,6 +675,24 @@ export class FeedbackButton {
|
|
|
603
675
|
"reflect": false,
|
|
604
676
|
"defaultValue": "'Please try again later.'"
|
|
605
677
|
},
|
|
678
|
+
"errorMessage401": {
|
|
679
|
+
"type": "string",
|
|
680
|
+
"mutable": false,
|
|
681
|
+
"complexType": {
|
|
682
|
+
"original": "string",
|
|
683
|
+
"resolved": "string",
|
|
684
|
+
"references": {}
|
|
685
|
+
},
|
|
686
|
+
"required": false,
|
|
687
|
+
"optional": false,
|
|
688
|
+
"docs": {
|
|
689
|
+
"tags": [],
|
|
690
|
+
"text": ""
|
|
691
|
+
},
|
|
692
|
+
"attribute": "error-message-4-0-1",
|
|
693
|
+
"reflect": false,
|
|
694
|
+
"defaultValue": "'This project requires a valid API key to submit feedback. Check the api-key attribute.'"
|
|
695
|
+
},
|
|
606
696
|
"errorMessage403": {
|
|
607
697
|
"type": "string",
|
|
608
698
|
"mutable": false,
|
|
@@ -70,6 +70,12 @@
|
|
|
70
70
|
opacity: 1;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/* The dialog receives programmatic focus on open so screen readers announce its
|
|
74
|
+
title; it is not a control, so it should not paint a focus ring */
|
|
75
|
+
.feedback-modal-content:focus {
|
|
76
|
+
outline: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
.feedback-modal-header {
|
|
74
80
|
color: var(--feedback-modal-header-text-color);
|
|
75
81
|
display: flex;
|