pushfeedback 0.1.42 → 0.1.43
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/feedback-button_2.cjs.entry.js +27 -27
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pushfeedback.cjs.js +1 -1
- package/dist/collection/components/feedback-button/feedback-button.js +28 -16
- package/dist/collection/components/feedback-modal/feedback-modal.js +2 -33
- package/dist/components/feedback-button.js +27 -15
- package/dist/components/feedback-modal2.js +2 -16
- package/dist/esm/feedback-button_2.entry.js +27 -27
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pushfeedback.js +1 -1
- package/dist/pushfeedback/{p-377fd629.entry.js → p-4571809a.entry.js} +2 -2
- package/dist/pushfeedback/pushfeedback.esm.js +1 -1
- package/dist/types/components/feedback-button/feedback-button.d.ts +3 -1
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +0 -3
- package/dist/types/components.d.ts +0 -2
- package/package.json +2 -2
|
@@ -40,10 +40,32 @@ const FeedbackButton = class {
|
|
|
40
40
|
this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
|
|
41
41
|
this.fetchData = true;
|
|
42
42
|
}
|
|
43
|
+
componentWillLoad() {
|
|
44
|
+
if (!this.sessionId) {
|
|
45
|
+
let storedSessionId = localStorage.getItem('pushfeedback_sessionid');
|
|
46
|
+
if (!storedSessionId) {
|
|
47
|
+
storedSessionId = this.generateRandomSessionId();
|
|
48
|
+
localStorage.setItem('pushfeedback_sessionid', storedSessionId);
|
|
49
|
+
this.sessionId = storedSessionId;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
componentDidLoad() {
|
|
54
|
+
if (this.buttonPosition === 'center-right') {
|
|
55
|
+
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
56
|
+
let adjustement = 0;
|
|
57
|
+
if (this.isSafariBrowser()) {
|
|
58
|
+
adjustement = 10;
|
|
59
|
+
}
|
|
60
|
+
buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
|
|
61
|
+
}
|
|
62
|
+
if (!this.customFont) {
|
|
63
|
+
this.loadInterFont();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
43
66
|
connectedCallback() {
|
|
44
67
|
this.feedbackModal = document.createElement('feedback-modal');
|
|
45
68
|
const props = [
|
|
46
|
-
'sessionId',
|
|
47
69
|
'customFont',
|
|
48
70
|
'errorMessage',
|
|
49
71
|
'errorMessage403',
|
|
@@ -79,23 +101,13 @@ const FeedbackButton = class {
|
|
|
79
101
|
disconnectedCallback() {
|
|
80
102
|
document.body.removeChild(this.feedbackModal);
|
|
81
103
|
}
|
|
104
|
+
generateRandomSessionId(length = 16) {
|
|
105
|
+
return Math.random().toString(36).substr(2, length);
|
|
106
|
+
}
|
|
82
107
|
isSafariBrowser() {
|
|
83
108
|
const isSafari = /safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent);
|
|
84
109
|
return isSafari;
|
|
85
110
|
}
|
|
86
|
-
componentDidLoad() {
|
|
87
|
-
if (this.buttonPosition === 'center-right') {
|
|
88
|
-
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
89
|
-
let adjustement = 0;
|
|
90
|
-
if (this.isSafariBrowser()) {
|
|
91
|
-
adjustement = 10;
|
|
92
|
-
}
|
|
93
|
-
buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
|
|
94
|
-
}
|
|
95
|
-
if (!this.customFont) {
|
|
96
|
-
this.loadInterFont();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
111
|
loadInterFont() {
|
|
100
112
|
const link = document.createElement('link');
|
|
101
113
|
link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
|
|
@@ -7988,7 +8000,7 @@ const FeedbackModal = class {
|
|
|
7988
8000
|
rating: this.selectedRating,
|
|
7989
8001
|
ratingMode: this.ratingMode,
|
|
7990
8002
|
verification: this.formVerification,
|
|
7991
|
-
session:
|
|
8003
|
+
session: localStorage.getItem('pushfeedback_sessionid') || '',
|
|
7992
8004
|
}),
|
|
7993
8005
|
headers: {
|
|
7994
8006
|
'Content-Type': 'application/json'
|
|
@@ -8144,8 +8156,6 @@ const FeedbackModal = class {
|
|
|
8144
8156
|
this.isPrivacyChecked = false;
|
|
8145
8157
|
this.whitelabel = false;
|
|
8146
8158
|
this.selectedRating = 0;
|
|
8147
|
-
this.session = '';
|
|
8148
|
-
this.sessionId = "";
|
|
8149
8159
|
this.errorMessage = "Please try again later.";
|
|
8150
8160
|
this.errorMessage403 = "The request URL does not match the one defined in PushFeedback for this project.";
|
|
8151
8161
|
this.errorMessage404 = "We could not find the provided project ID in PushFeedback.";
|
|
@@ -8180,13 +8190,6 @@ const FeedbackModal = class {
|
|
|
8180
8190
|
if (this.fetchData)
|
|
8181
8191
|
this.fetchProjectData();
|
|
8182
8192
|
this.formEmail = this.emailAddress;
|
|
8183
|
-
if (!this.sessionId) {
|
|
8184
|
-
this.session = this.generateRandomSessionId();
|
|
8185
|
-
}
|
|
8186
|
-
else {
|
|
8187
|
-
this.session = this.sessionId;
|
|
8188
|
-
}
|
|
8189
|
-
console.log(this.session);
|
|
8190
8193
|
if (this.rating) {
|
|
8191
8194
|
this.selectedRating = this.rating;
|
|
8192
8195
|
}
|
|
@@ -8204,9 +8207,6 @@ const FeedbackModal = class {
|
|
|
8204
8207
|
console.log(error);
|
|
8205
8208
|
}
|
|
8206
8209
|
}
|
|
8207
|
-
generateRandomSessionId(length = 16) {
|
|
8208
|
-
return Math.random().toString(36).substr(2, length);
|
|
8209
|
-
}
|
|
8210
8210
|
resetOverflow() {
|
|
8211
8211
|
document.documentElement.classList.remove('feedback-modal-screenshot-open');
|
|
8212
8212
|
document.documentElement.classList.remove('feedback-modal-screenshot-open--scroll');
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"sessionId":[
|
|
17
|
+
return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"sessionId":[1537,"session-id"],"customFont":[4,"custom-font"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"buttonStyle":[1,"button-style"],"buttonPosition":[1,"button-position"],"hideIcon":[4,"hide-icon"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"]}],[1,"feedback-modal",{"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"hasSelectedElement":[1540,"has-selected-element"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"sessionId":[
|
|
20
|
+
return index.bootstrapLazy([["feedback-button_2.cjs",[[1,"feedback-button",{"sessionId":[1537,"session-id"],"customFont":[4,"custom-font"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"buttonStyle":[1,"button-style"],"buttonPosition":[1,"button-position"],"hideIcon":[4,"hide-icon"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"]}],[1,"feedback-modal",{"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"hasSelectedElement":[1540,"has-selected-element"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -32,10 +32,32 @@ export class FeedbackButton {
|
|
|
32
32
|
this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
|
|
33
33
|
this.fetchData = true;
|
|
34
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
|
+
}
|
|
35
58
|
connectedCallback() {
|
|
36
59
|
this.feedbackModal = document.createElement('feedback-modal');
|
|
37
60
|
const props = [
|
|
38
|
-
'sessionId',
|
|
39
61
|
'customFont',
|
|
40
62
|
'errorMessage',
|
|
41
63
|
'errorMessage403',
|
|
@@ -71,23 +93,13 @@ export class FeedbackButton {
|
|
|
71
93
|
disconnectedCallback() {
|
|
72
94
|
document.body.removeChild(this.feedbackModal);
|
|
73
95
|
}
|
|
96
|
+
generateRandomSessionId(length = 16) {
|
|
97
|
+
return Math.random().toString(36).substr(2, length);
|
|
98
|
+
}
|
|
74
99
|
isSafariBrowser() {
|
|
75
100
|
const isSafari = /safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent);
|
|
76
101
|
return isSafari;
|
|
77
102
|
}
|
|
78
|
-
componentDidLoad() {
|
|
79
|
-
if (this.buttonPosition === 'center-right') {
|
|
80
|
-
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
81
|
-
let adjustement = 0;
|
|
82
|
-
if (this.isSafariBrowser()) {
|
|
83
|
-
adjustement = 10;
|
|
84
|
-
}
|
|
85
|
-
buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
|
|
86
|
-
}
|
|
87
|
-
if (!this.customFont) {
|
|
88
|
-
this.loadInterFont();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
103
|
loadInterFont() {
|
|
92
104
|
const link = document.createElement('link');
|
|
93
105
|
link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
|
|
@@ -116,7 +128,7 @@ export class FeedbackButton {
|
|
|
116
128
|
return {
|
|
117
129
|
"sessionId": {
|
|
118
130
|
"type": "string",
|
|
119
|
-
"mutable":
|
|
131
|
+
"mutable": true,
|
|
120
132
|
"complexType": {
|
|
121
133
|
"original": "string",
|
|
122
134
|
"resolved": "string",
|
|
@@ -129,7 +141,7 @@ export class FeedbackButton {
|
|
|
129
141
|
"text": ""
|
|
130
142
|
},
|
|
131
143
|
"attribute": "session-id",
|
|
132
|
-
"reflect":
|
|
144
|
+
"reflect": true,
|
|
133
145
|
"defaultValue": "\"\""
|
|
134
146
|
},
|
|
135
147
|
"customFont": {
|
|
@@ -29,7 +29,7 @@ export class FeedbackModal {
|
|
|
29
29
|
rating: this.selectedRating,
|
|
30
30
|
ratingMode: this.ratingMode,
|
|
31
31
|
verification: this.formVerification,
|
|
32
|
-
session:
|
|
32
|
+
session: localStorage.getItem('pushfeedback_sessionid') || '',
|
|
33
33
|
}),
|
|
34
34
|
headers: {
|
|
35
35
|
'Content-Type': 'application/json'
|
|
@@ -186,8 +186,6 @@ export class FeedbackModal {
|
|
|
186
186
|
this.isPrivacyChecked = false;
|
|
187
187
|
this.whitelabel = false;
|
|
188
188
|
this.selectedRating = 0;
|
|
189
|
-
this.session = '';
|
|
190
|
-
this.sessionId = "";
|
|
191
189
|
this.errorMessage = "Please try again later.";
|
|
192
190
|
this.errorMessage403 = "The request URL does not match the one defined in PushFeedback for this project.";
|
|
193
191
|
this.errorMessage404 = "We could not find the provided project ID in PushFeedback.";
|
|
@@ -222,13 +220,6 @@ export class FeedbackModal {
|
|
|
222
220
|
if (this.fetchData)
|
|
223
221
|
this.fetchProjectData();
|
|
224
222
|
this.formEmail = this.emailAddress;
|
|
225
|
-
if (!this.sessionId) {
|
|
226
|
-
this.session = this.generateRandomSessionId();
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
this.session = this.sessionId;
|
|
230
|
-
}
|
|
231
|
-
console.log(this.session);
|
|
232
223
|
if (this.rating) {
|
|
233
224
|
this.selectedRating = this.rating;
|
|
234
225
|
}
|
|
@@ -246,9 +237,6 @@ export class FeedbackModal {
|
|
|
246
237
|
console.log(error);
|
|
247
238
|
}
|
|
248
239
|
}
|
|
249
|
-
generateRandomSessionId(length = 16) {
|
|
250
|
-
return Math.random().toString(36).substr(2, length);
|
|
251
|
-
}
|
|
252
240
|
resetOverflow() {
|
|
253
241
|
document.documentElement.classList.remove('feedback-modal-screenshot-open');
|
|
254
242
|
document.documentElement.classList.remove('feedback-modal-screenshot-open--scroll');
|
|
@@ -316,24 +304,6 @@ export class FeedbackModal {
|
|
|
316
304
|
}
|
|
317
305
|
static get properties() {
|
|
318
306
|
return {
|
|
319
|
-
"sessionId": {
|
|
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": "session-id",
|
|
334
|
-
"reflect": false,
|
|
335
|
-
"defaultValue": "\"\""
|
|
336
|
-
},
|
|
337
307
|
"errorMessage": {
|
|
338
308
|
"type": "string",
|
|
339
309
|
"mutable": false,
|
|
@@ -869,8 +839,7 @@ export class FeedbackModal {
|
|
|
869
839
|
"encodedScreenshot": {},
|
|
870
840
|
"isPrivacyChecked": {},
|
|
871
841
|
"whitelabel": {},
|
|
872
|
-
"selectedRating": {}
|
|
873
|
-
"session": {}
|
|
842
|
+
"selectedRating": {}
|
|
874
843
|
};
|
|
875
844
|
}
|
|
876
845
|
}
|
|
@@ -39,10 +39,32 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
39
39
|
this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
|
|
40
40
|
this.fetchData = true;
|
|
41
41
|
}
|
|
42
|
+
componentWillLoad() {
|
|
43
|
+
if (!this.sessionId) {
|
|
44
|
+
let storedSessionId = localStorage.getItem('pushfeedback_sessionid');
|
|
45
|
+
if (!storedSessionId) {
|
|
46
|
+
storedSessionId = this.generateRandomSessionId();
|
|
47
|
+
localStorage.setItem('pushfeedback_sessionid', storedSessionId);
|
|
48
|
+
this.sessionId = storedSessionId;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
componentDidLoad() {
|
|
53
|
+
if (this.buttonPosition === 'center-right') {
|
|
54
|
+
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
55
|
+
let adjustement = 0;
|
|
56
|
+
if (this.isSafariBrowser()) {
|
|
57
|
+
adjustement = 10;
|
|
58
|
+
}
|
|
59
|
+
buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
|
|
60
|
+
}
|
|
61
|
+
if (!this.customFont) {
|
|
62
|
+
this.loadInterFont();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
42
65
|
connectedCallback() {
|
|
43
66
|
this.feedbackModal = document.createElement('feedback-modal');
|
|
44
67
|
const props = [
|
|
45
|
-
'sessionId',
|
|
46
68
|
'customFont',
|
|
47
69
|
'errorMessage',
|
|
48
70
|
'errorMessage403',
|
|
@@ -78,23 +100,13 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
78
100
|
disconnectedCallback() {
|
|
79
101
|
document.body.removeChild(this.feedbackModal);
|
|
80
102
|
}
|
|
103
|
+
generateRandomSessionId(length = 16) {
|
|
104
|
+
return Math.random().toString(36).substr(2, length);
|
|
105
|
+
}
|
|
81
106
|
isSafariBrowser() {
|
|
82
107
|
const isSafari = /safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent);
|
|
83
108
|
return isSafari;
|
|
84
109
|
}
|
|
85
|
-
componentDidLoad() {
|
|
86
|
-
if (this.buttonPosition === 'center-right') {
|
|
87
|
-
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
88
|
-
let adjustement = 0;
|
|
89
|
-
if (this.isSafariBrowser()) {
|
|
90
|
-
adjustement = 10;
|
|
91
|
-
}
|
|
92
|
-
buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
|
|
93
|
-
}
|
|
94
|
-
if (!this.customFont) {
|
|
95
|
-
this.loadInterFont();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
110
|
loadInterFont() {
|
|
99
111
|
const link = document.createElement('link');
|
|
100
112
|
link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
|
|
@@ -110,7 +122,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
110
122
|
get el() { return this; }
|
|
111
123
|
static get style() { return feedbackButtonCss; }
|
|
112
124
|
}, [1, "feedback-button", {
|
|
113
|
-
"sessionId": [
|
|
125
|
+
"sessionId": [1537, "session-id"],
|
|
114
126
|
"customFont": [4, "custom-font"],
|
|
115
127
|
"errorMessage": [1, "error-message"],
|
|
116
128
|
"errorMessage403": [1, "error-message-4-0-3"],
|
|
@@ -7878,7 +7878,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
7878
7878
|
rating: this.selectedRating,
|
|
7879
7879
|
ratingMode: this.ratingMode,
|
|
7880
7880
|
verification: this.formVerification,
|
|
7881
|
-
session:
|
|
7881
|
+
session: localStorage.getItem('pushfeedback_sessionid') || '',
|
|
7882
7882
|
}),
|
|
7883
7883
|
headers: {
|
|
7884
7884
|
'Content-Type': 'application/json'
|
|
@@ -8034,8 +8034,6 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8034
8034
|
this.isPrivacyChecked = false;
|
|
8035
8035
|
this.whitelabel = false;
|
|
8036
8036
|
this.selectedRating = 0;
|
|
8037
|
-
this.session = '';
|
|
8038
|
-
this.sessionId = "";
|
|
8039
8037
|
this.errorMessage = "Please try again later.";
|
|
8040
8038
|
this.errorMessage403 = "The request URL does not match the one defined in PushFeedback for this project.";
|
|
8041
8039
|
this.errorMessage404 = "We could not find the provided project ID in PushFeedback.";
|
|
@@ -8070,13 +8068,6 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8070
8068
|
if (this.fetchData)
|
|
8071
8069
|
this.fetchProjectData();
|
|
8072
8070
|
this.formEmail = this.emailAddress;
|
|
8073
|
-
if (!this.sessionId) {
|
|
8074
|
-
this.session = this.generateRandomSessionId();
|
|
8075
|
-
}
|
|
8076
|
-
else {
|
|
8077
|
-
this.session = this.sessionId;
|
|
8078
|
-
}
|
|
8079
|
-
console.log(this.session);
|
|
8080
8071
|
if (this.rating) {
|
|
8081
8072
|
this.selectedRating = this.rating;
|
|
8082
8073
|
}
|
|
@@ -8094,9 +8085,6 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8094
8085
|
console.log(error);
|
|
8095
8086
|
}
|
|
8096
8087
|
}
|
|
8097
|
-
generateRandomSessionId(length = 16) {
|
|
8098
|
-
return Math.random().toString(36).substr(2, length);
|
|
8099
|
-
}
|
|
8100
8088
|
resetOverflow() {
|
|
8101
8089
|
document.documentElement.classList.remove('feedback-modal-screenshot-open');
|
|
8102
8090
|
document.documentElement.classList.remove('feedback-modal-screenshot-open--scroll');
|
|
@@ -8152,7 +8140,6 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8152
8140
|
}
|
|
8153
8141
|
static get style() { return feedbackModalCss; }
|
|
8154
8142
|
}, [1, "feedback-modal", {
|
|
8155
|
-
"sessionId": [1, "session-id"],
|
|
8156
8143
|
"errorMessage": [1, "error-message"],
|
|
8157
8144
|
"errorMessage403": [1, "error-message-4-0-3"],
|
|
8158
8145
|
"errorMessage404": [1, "error-message-4-0-4"],
|
|
@@ -8192,8 +8179,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
8192
8179
|
"encodedScreenshot": [32],
|
|
8193
8180
|
"isPrivacyChecked": [32],
|
|
8194
8181
|
"whitelabel": [32],
|
|
8195
|
-
"selectedRating": [32]
|
|
8196
|
-
"session": [32]
|
|
8182
|
+
"selectedRating": [32]
|
|
8197
8183
|
}]);
|
|
8198
8184
|
function defineCustomElement() {
|
|
8199
8185
|
if (typeof customElements === "undefined") {
|
|
@@ -36,10 +36,32 @@ const FeedbackButton = class {
|
|
|
36
36
|
this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
|
|
37
37
|
this.fetchData = true;
|
|
38
38
|
}
|
|
39
|
+
componentWillLoad() {
|
|
40
|
+
if (!this.sessionId) {
|
|
41
|
+
let storedSessionId = localStorage.getItem('pushfeedback_sessionid');
|
|
42
|
+
if (!storedSessionId) {
|
|
43
|
+
storedSessionId = this.generateRandomSessionId();
|
|
44
|
+
localStorage.setItem('pushfeedback_sessionid', storedSessionId);
|
|
45
|
+
this.sessionId = storedSessionId;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
componentDidLoad() {
|
|
50
|
+
if (this.buttonPosition === 'center-right') {
|
|
51
|
+
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
52
|
+
let adjustement = 0;
|
|
53
|
+
if (this.isSafariBrowser()) {
|
|
54
|
+
adjustement = 10;
|
|
55
|
+
}
|
|
56
|
+
buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
|
|
57
|
+
}
|
|
58
|
+
if (!this.customFont) {
|
|
59
|
+
this.loadInterFont();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
39
62
|
connectedCallback() {
|
|
40
63
|
this.feedbackModal = document.createElement('feedback-modal');
|
|
41
64
|
const props = [
|
|
42
|
-
'sessionId',
|
|
43
65
|
'customFont',
|
|
44
66
|
'errorMessage',
|
|
45
67
|
'errorMessage403',
|
|
@@ -75,23 +97,13 @@ const FeedbackButton = class {
|
|
|
75
97
|
disconnectedCallback() {
|
|
76
98
|
document.body.removeChild(this.feedbackModal);
|
|
77
99
|
}
|
|
100
|
+
generateRandomSessionId(length = 16) {
|
|
101
|
+
return Math.random().toString(36).substr(2, length);
|
|
102
|
+
}
|
|
78
103
|
isSafariBrowser() {
|
|
79
104
|
const isSafari = /safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent);
|
|
80
105
|
return isSafari;
|
|
81
106
|
}
|
|
82
|
-
componentDidLoad() {
|
|
83
|
-
if (this.buttonPosition === 'center-right') {
|
|
84
|
-
const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
|
|
85
|
-
let adjustement = 0;
|
|
86
|
-
if (this.isSafariBrowser()) {
|
|
87
|
-
adjustement = 10;
|
|
88
|
-
}
|
|
89
|
-
buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
|
|
90
|
-
}
|
|
91
|
-
if (!this.customFont) {
|
|
92
|
-
this.loadInterFont();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
107
|
loadInterFont() {
|
|
96
108
|
const link = document.createElement('link');
|
|
97
109
|
link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
|
|
@@ -7984,7 +7996,7 @@ const FeedbackModal = class {
|
|
|
7984
7996
|
rating: this.selectedRating,
|
|
7985
7997
|
ratingMode: this.ratingMode,
|
|
7986
7998
|
verification: this.formVerification,
|
|
7987
|
-
session:
|
|
7999
|
+
session: localStorage.getItem('pushfeedback_sessionid') || '',
|
|
7988
8000
|
}),
|
|
7989
8001
|
headers: {
|
|
7990
8002
|
'Content-Type': 'application/json'
|
|
@@ -8140,8 +8152,6 @@ const FeedbackModal = class {
|
|
|
8140
8152
|
this.isPrivacyChecked = false;
|
|
8141
8153
|
this.whitelabel = false;
|
|
8142
8154
|
this.selectedRating = 0;
|
|
8143
|
-
this.session = '';
|
|
8144
|
-
this.sessionId = "";
|
|
8145
8155
|
this.errorMessage = "Please try again later.";
|
|
8146
8156
|
this.errorMessage403 = "The request URL does not match the one defined in PushFeedback for this project.";
|
|
8147
8157
|
this.errorMessage404 = "We could not find the provided project ID in PushFeedback.";
|
|
@@ -8176,13 +8186,6 @@ const FeedbackModal = class {
|
|
|
8176
8186
|
if (this.fetchData)
|
|
8177
8187
|
this.fetchProjectData();
|
|
8178
8188
|
this.formEmail = this.emailAddress;
|
|
8179
|
-
if (!this.sessionId) {
|
|
8180
|
-
this.session = this.generateRandomSessionId();
|
|
8181
|
-
}
|
|
8182
|
-
else {
|
|
8183
|
-
this.session = this.sessionId;
|
|
8184
|
-
}
|
|
8185
|
-
console.log(this.session);
|
|
8186
8189
|
if (this.rating) {
|
|
8187
8190
|
this.selectedRating = this.rating;
|
|
8188
8191
|
}
|
|
@@ -8200,9 +8203,6 @@ const FeedbackModal = class {
|
|
|
8200
8203
|
console.log(error);
|
|
8201
8204
|
}
|
|
8202
8205
|
}
|
|
8203
|
-
generateRandomSessionId(length = 16) {
|
|
8204
|
-
return Math.random().toString(36).substr(2, length);
|
|
8205
|
-
}
|
|
8206
8206
|
resetOverflow() {
|
|
8207
8207
|
document.documentElement.classList.remove('feedback-modal-screenshot-open');
|
|
8208
8208
|
document.documentElement.classList.remove('feedback-modal-screenshot-open--scroll');
|
package/dist/esm/loader.js
CHANGED
|
@@ -11,7 +11,7 @@ const patchEsm = () => {
|
|
|
11
11
|
const defineCustomElements = (win, options) => {
|
|
12
12
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
13
13
|
return patchEsm().then(() => {
|
|
14
|
-
return bootstrapLazy([["feedback-button_2",[[1,"feedback-button",{"sessionId":[
|
|
14
|
+
return bootstrapLazy([["feedback-button_2",[[1,"feedback-button",{"sessionId":[1537,"session-id"],"customFont":[4,"custom-font"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"buttonStyle":[1,"button-style"],"buttonPosition":[1,"button-position"],"hideIcon":[4,"hide-icon"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"]}],[1,"feedback-modal",{"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"hasSelectedElement":[1540,"has-selected-element"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32]}]]]], options);
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|
package/dist/esm/pushfeedback.js
CHANGED
|
@@ -14,5 +14,5 @@ const patchBrowser = () => {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
patchBrowser().then(options => {
|
|
17
|
-
return bootstrapLazy([["feedback-button_2",[[1,"feedback-button",{"sessionId":[
|
|
17
|
+
return bootstrapLazy([["feedback-button_2",[[1,"feedback-button",{"sessionId":[1537,"session-id"],"customFont":[4,"custom-font"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"buttonStyle":[1,"button-style"],"buttonPosition":[1,"button-position"],"hideIcon":[4,"hide-icon"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"]}],[1,"feedback-modal",{"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"modalTitle":[1,"modal-title"],"modalTitleSuccess":[1,"modal-title-success"],"modalTitleError":[1,"modal-title-error"],"modalPosition":[1,"modal-position"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"project":[1],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTopbarText":[1,"screenshot-topbar-text"],"hideEmail":[4,"hide-email"],"emailAddress":[1,"email-address"],"emailPlaceholder":[1,"email-placeholder"],"messagePlaceholder":[1,"message-placeholder"],"hideRating":[4,"hide-rating"],"rating":[2],"ratingMode":[1,"rating-mode"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"showModal":[1540,"show-modal"],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"hasSelectedElement":[1540,"has-selected-element"],"hideScreenshotButton":[4,"hide-screenshot-button"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"privacyPolicyText":[1,"privacy-policy-text"],"fetchData":[4,"fetch-data"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32]}]]]], options);
|
|
18
18
|
});
|