pushfeedback 0.1.65 → 0.1.67
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 +116 -53
- 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 +64 -0
- package/dist/collection/components/feedback-modal/feedback-modal.css +53 -1
- package/dist/collection/components/feedback-modal/feedback-modal.js +161 -53
- package/dist/components/feedback-button.js +13 -0
- package/dist/components/feedback-modal2.js +111 -53
- package/dist/esm/feedback-button_2.entry.js +116 -53
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pushfeedback.js +1 -1
- package/dist/pushfeedback/{p-d671215c.entry.js → p-51e790c7.entry.js} +2 -2
- package/dist/pushfeedback/pushfeedback.esm.js +1 -1
- package/dist/types/components/feedback-button/feedback-button.d.ts +3 -0
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +14 -1
- package/dist/types/components.d.ts +12 -0
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ export class FeedbackModal {
|
|
|
29
29
|
screenshot: this.encodedScreenshot,
|
|
30
30
|
rating: this.selectedRating,
|
|
31
31
|
ratingMode: this.ratingMode,
|
|
32
|
+
metadata: this.metadata,
|
|
32
33
|
verification: this.formVerification,
|
|
33
34
|
session: localStorage.getItem('pushfeedback_sessionid') || '',
|
|
34
35
|
};
|
|
@@ -81,11 +82,19 @@ export class FeedbackModal {
|
|
|
81
82
|
this.showScreenshotTopBar = false;
|
|
82
83
|
this.hasSelectedElement = false;
|
|
83
84
|
this.encodedScreenshot = null;
|
|
85
|
+
// Remove highlight from ALL selected elements
|
|
86
|
+
document.querySelectorAll('.feedback-modal-element-selected').forEach(el => {
|
|
87
|
+
el.classList.remove('feedback-modal-element-selected');
|
|
88
|
+
});
|
|
89
|
+
this.takingScreenshot = false;
|
|
90
|
+
this.originalElement = null;
|
|
91
|
+
this.selectedElementBounds = null;
|
|
84
92
|
this.formSuccess = false;
|
|
85
93
|
this.formError = false;
|
|
86
94
|
this.formErrorStatus = 500;
|
|
87
95
|
this.formMessage = '';
|
|
88
96
|
this.formEmail = '';
|
|
97
|
+
this.showPreviewModal = false;
|
|
89
98
|
this.resetOverflow();
|
|
90
99
|
}, 200);
|
|
91
100
|
};
|
|
@@ -94,22 +103,31 @@ export class FeedbackModal {
|
|
|
94
103
|
this.showModal = false;
|
|
95
104
|
this.showScreenshotMode = true;
|
|
96
105
|
this.showScreenshotTopBar = true;
|
|
106
|
+
// Clear previous screenshot and selection data
|
|
97
107
|
this.encodedScreenshot = null;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
window.scrollTo(0, parseInt(document.documentElement.style.top || '0') * -1);
|
|
104
|
-
document.documentElement.classList.add('feedback-modal-screenshot-open');
|
|
108
|
+
this.originalElement = null;
|
|
109
|
+
this.selectedElementBounds = null;
|
|
110
|
+
this.hoveredElement = null;
|
|
111
|
+
this.hoveredElementBounds = null;
|
|
112
|
+
// NO CSS CLASSES - they cause scroll jumping
|
|
105
113
|
};
|
|
106
114
|
this.closeScreenShot = () => {
|
|
115
|
+
// Remove highlight from ALL selected elements
|
|
116
|
+
document.querySelectorAll('.feedback-modal-element-selected').forEach(el => {
|
|
117
|
+
el.classList.remove('feedback-modal-element-selected');
|
|
118
|
+
});
|
|
119
|
+
// Reset loading state
|
|
120
|
+
this.takingScreenshot = false;
|
|
107
121
|
this.showModal = false;
|
|
108
122
|
this.showScreenshotMode = false;
|
|
109
123
|
this.showScreenshotTopBar = false;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
124
|
+
};
|
|
125
|
+
this.openPreviewModal = (event) => {
|
|
126
|
+
event.stopPropagation(); // Prevent button click from firing
|
|
127
|
+
this.showPreviewModal = true;
|
|
128
|
+
};
|
|
129
|
+
this.closePreviewModal = () => {
|
|
130
|
+
this.showPreviewModal = false;
|
|
113
131
|
};
|
|
114
132
|
this.handleMouseOverScreenShot = (event) => {
|
|
115
133
|
event.preventDefault();
|
|
@@ -120,6 +138,9 @@ export class FeedbackModal {
|
|
|
120
138
|
const elementUnder = document.elementFromPoint(event.clientX, event.clientY);
|
|
121
139
|
const rect = elementUnder.getBoundingClientRect();
|
|
122
140
|
this.screenshotModal.style.display = '';
|
|
141
|
+
// Store the hovered element and its bounds for later use
|
|
142
|
+
this.hoveredElement = elementUnder;
|
|
143
|
+
this.hoveredElementBounds = rect;
|
|
123
144
|
// Get the bounding box of the element selected
|
|
124
145
|
this.elementSelected.style.position = 'absolute';
|
|
125
146
|
this.elementSelected.style.left = `${rect.left}px`;
|
|
@@ -161,35 +182,45 @@ export class FeedbackModal {
|
|
|
161
182
|
};
|
|
162
183
|
this.handleMouseClickedSelectedElement = async (event) => {
|
|
163
184
|
event.preventDefault();
|
|
164
|
-
if (!this.elementSelected) {
|
|
185
|
+
if (!this.elementSelected || !this.hoveredElement) {
|
|
165
186
|
return;
|
|
166
187
|
}
|
|
167
188
|
this.hasSelectedElement = true;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
//
|
|
173
|
-
this.
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
//
|
|
178
|
-
this.
|
|
179
|
-
|
|
180
|
-
this.showModal = false;
|
|
189
|
+
// Remove highlight from ALL previously selected elements
|
|
190
|
+
document.querySelectorAll('.feedback-modal-element-selected').forEach(el => {
|
|
191
|
+
el.classList.remove('feedback-modal-element-selected');
|
|
192
|
+
});
|
|
193
|
+
// Add highlight to newly selected element
|
|
194
|
+
this.hoveredElement.classList.add('feedback-modal-element-selected');
|
|
195
|
+
// Store element bounds in viewport coordinates
|
|
196
|
+
this.selectedElementBounds = this.hoveredElementBounds;
|
|
197
|
+
this.originalElement = this.hoveredElement;
|
|
198
|
+
// Show loading state in top bar
|
|
199
|
+
this.takingScreenshot = true;
|
|
200
|
+
// Take screenshot FIRST while highlight is still visible
|
|
181
201
|
try {
|
|
182
202
|
const dataUrl = await this.captureScreenshot();
|
|
183
203
|
console.log('Screenshot captured');
|
|
184
204
|
this.encodedScreenshot = dataUrl;
|
|
205
|
+
// Reset loading state
|
|
206
|
+
this.takingScreenshot = false;
|
|
207
|
+
// NOW hide screenshot interface after capturing
|
|
208
|
+
this.showScreenshotTopBar = false;
|
|
209
|
+
this.showScreenshotMode = false;
|
|
210
|
+
// Restore normal page state
|
|
211
|
+
this.resetOverflow();
|
|
212
|
+
// Show modal with the captured screenshot
|
|
213
|
+
this.showModal = true;
|
|
185
214
|
}
|
|
186
215
|
catch (error) {
|
|
187
216
|
console.error('Failed to capture screenshot:', error);
|
|
188
217
|
this.hasSelectedElement = false;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
//
|
|
192
|
-
|
|
218
|
+
// Reset loading state on error
|
|
219
|
+
this.takingScreenshot = false;
|
|
220
|
+
// Still need to cleanup on error
|
|
221
|
+
this.showScreenshotTopBar = false;
|
|
222
|
+
this.showScreenshotMode = false;
|
|
223
|
+
this.resetOverflow();
|
|
193
224
|
this.showModal = true;
|
|
194
225
|
}
|
|
195
226
|
};
|
|
@@ -220,6 +251,7 @@ export class FeedbackModal {
|
|
|
220
251
|
this.showScreenshotTopBar = false;
|
|
221
252
|
this.showModal = false;
|
|
222
253
|
this.rating = undefined;
|
|
254
|
+
this.metadata = undefined;
|
|
223
255
|
this.fetchData = true;
|
|
224
256
|
this.emailPlaceholder = 'Email address (optional)';
|
|
225
257
|
this.errorMessage = 'Please try again later.';
|
|
@@ -235,9 +267,13 @@ export class FeedbackModal {
|
|
|
235
267
|
this.ratingPlaceholder = 'Was this page helpful?';
|
|
236
268
|
this.ratingStarsPlaceholder = 'How would you rate this page?';
|
|
237
269
|
this.sendButtonText = 'Send';
|
|
270
|
+
this.screenshotAttachedText = 'Screenshot attached';
|
|
238
271
|
this.screenshotButtonText = 'Add a screenshot';
|
|
272
|
+
this.screenshotTakingText = 'Taking screenshot...';
|
|
239
273
|
this.screenshotTopbarText = 'Select an element on this page';
|
|
240
274
|
this.successMessage = '';
|
|
275
|
+
this.takingScreenshot = false;
|
|
276
|
+
this.showPreviewModal = false;
|
|
241
277
|
}
|
|
242
278
|
componentWillLoad() {
|
|
243
279
|
if (this.fetchData)
|
|
@@ -261,15 +297,10 @@ export class FeedbackModal {
|
|
|
261
297
|
}
|
|
262
298
|
}
|
|
263
299
|
resetOverflow() {
|
|
300
|
+
// Just clean up any stray classes, don't add/remove during screenshot
|
|
264
301
|
document.documentElement.classList.remove('feedback-modal-screenshot-open');
|
|
265
302
|
document.documentElement.classList.remove('feedback-modal-screenshot-open--scroll');
|
|
266
|
-
document.documentElement.classList.
|
|
267
|
-
// Only restore scroll position if we previously modified it
|
|
268
|
-
if (document.documentElement.style.top) {
|
|
269
|
-
window.scrollTo(0, parseInt(document.documentElement.style.top || '0') * -1);
|
|
270
|
-
document.documentElement.style.top = '';
|
|
271
|
-
}
|
|
272
|
-
window.addEventListener('scroll', this.onScrollDebounced);
|
|
303
|
+
document.documentElement.classList.remove('feedback-modal-screenshot-closing');
|
|
273
304
|
}
|
|
274
305
|
handleMessageInput(event) {
|
|
275
306
|
this.formMessage = event.target.value;
|
|
@@ -279,22 +310,44 @@ export class FeedbackModal {
|
|
|
279
310
|
}
|
|
280
311
|
captureScreenshot() {
|
|
281
312
|
return new Promise((resolve, reject) => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
313
|
+
// Add a small delay to ensure CSS highlight is applied
|
|
314
|
+
setTimeout(() => {
|
|
315
|
+
requestAnimationFrame(() => {
|
|
316
|
+
if (!this.selectedElementBounds) {
|
|
317
|
+
reject(new Error('No element selected'));
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
// Capture what's currently visible in the viewport
|
|
321
|
+
html2canvas(document.body, {
|
|
322
|
+
x: window.scrollX,
|
|
323
|
+
y: window.scrollY,
|
|
324
|
+
width: window.innerWidth,
|
|
325
|
+
height: window.innerHeight,
|
|
326
|
+
scrollX: window.scrollX,
|
|
327
|
+
scrollY: window.scrollY,
|
|
328
|
+
allowTaint: false,
|
|
329
|
+
useCORS: true,
|
|
330
|
+
scale: 1,
|
|
331
|
+
backgroundColor: '#ffffff',
|
|
332
|
+
logging: true,
|
|
333
|
+
foreignObjectRendering: false,
|
|
334
|
+
imageTimeout: 10000,
|
|
335
|
+
ignoreElements: (element) => {
|
|
336
|
+
// Only ignore screenshot UI, keep everything else including highlights
|
|
337
|
+
return element.classList.contains('feedback-modal-screenshot-header') ||
|
|
338
|
+
element.classList.contains('feedback-overlay');
|
|
339
|
+
}
|
|
340
|
+
})
|
|
341
|
+
.then((canvas) => {
|
|
342
|
+
const dataUrl = canvas.toDataURL();
|
|
343
|
+
resolve(dataUrl);
|
|
344
|
+
})
|
|
345
|
+
.catch((error) => {
|
|
346
|
+
console.error('Failed to capture screenshot:', error);
|
|
347
|
+
reject(error);
|
|
348
|
+
});
|
|
296
349
|
});
|
|
297
|
-
});
|
|
350
|
+
}, 100); // Small delay to ensure CSS is applied
|
|
298
351
|
});
|
|
299
352
|
}
|
|
300
353
|
handleCheckboxChange(event) {
|
|
@@ -307,7 +360,7 @@ export class FeedbackModal {
|
|
|
307
360
|
this.selectedRating = newRating;
|
|
308
361
|
}
|
|
309
362
|
render() {
|
|
310
|
-
return (h("div", { class: `feedback-modal-wrapper ${this.customFont ? 'feedback-modal-wrapper--custom-font' : ''}` }, this.showScreenshotMode && (h("div", { class: "feedback-modal-screenshot", ref: (el) => (this.screenshotModal = el), onMouseMove: this.handleMouseOverScreenShot }, h("div", { class: "feedback-modal-screenshot-element-selected", ref: (el) => (this.elementSelected = el), onClick: this.handleMouseClickedSelectedElement }), h("div", { class: "top-side", ref: (el) => (this.topSide = el) }), h("div", { class: "left-side", ref: (el) => (this.leftSide = el) }), h("div", { class: "bottom-side", ref: (el) => (this.bottomSide = el) }), h("div", { class: "right-side", ref: (el) => (this.rightSide = el) }), this.showScreenshotTopBar && (h("div", { class: "feedback-modal-screenshot-header", onClick: this.closeScreenShot }, h("span", null, this.screenshotTopbarText), h("span", { class: "feedback-modal-screenshot-close" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "#191919", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "feather feather-x" }, h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), h("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))))))), this.showModal && (h("div", { class: `feedback-overlay ${this.isAnimating ? 'feedback-overlay--visible' : ''}` })), this.showModal && (h("div", { class: `feedback-modal-content feedback-modal-content--${this.modalPosition} ${this.isAnimating ? 'feedback-modal-content--open' : ''}`, ref: (el) => (this.modalContent = el) }, h("div", { class: "feedback-modal-header" }, !this.formSuccess && !this.formError ? (h("span", null, this.modalTitle)) : this.formSuccess ? (h("span", null, this.modalTitleSuccess)) : (h("span", null, this.modalTitleError)), h("button", { class: "feedback-modal-close", onClick: this.close }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "#191919", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "feather feather-x" }, h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))), h("div", { class: "feedback-modal-body" }, !this.formSuccess && !this.formError ? (h("form", { onSubmit: this.handleSubmit }, !this.hideRating && (h("div", { class: "feedback-modal-rating" }, this.ratingMode === 'thumbs' ? (h("div", { class: "feedback-modal-rating-content" }, h("span", { class: "feedback-modal-input-heading" }, this.ratingPlaceholder), h("div", { class: "feedback-modal-rating-buttons feedback-modal-rating-buttons--thumbs" }, h("button", { title: "Yes", class: `feedback-modal-rating-button ${this.selectedRating === 1
|
|
363
|
+
return (h("div", { class: `feedback-modal-wrapper ${this.customFont ? 'feedback-modal-wrapper--custom-font' : ''}` }, this.showScreenshotMode && (h("div", { class: "feedback-modal-screenshot", ref: (el) => (this.screenshotModal = el), onMouseMove: this.handleMouseOverScreenShot }, h("div", { class: "feedback-modal-screenshot-element-selected", ref: (el) => (this.elementSelected = el), onClick: this.handleMouseClickedSelectedElement }), h("div", { class: "top-side", ref: (el) => (this.topSide = el) }), h("div", { class: "left-side", ref: (el) => (this.leftSide = el) }), h("div", { class: "bottom-side", ref: (el) => (this.bottomSide = el) }), h("div", { class: "right-side", ref: (el) => (this.rightSide = el) }), this.showScreenshotTopBar && (h("div", { class: "feedback-modal-screenshot-header", onClick: this.closeScreenShot }, h("span", null, this.takingScreenshot ? this.screenshotTakingText : this.screenshotTopbarText), h("span", { class: "feedback-modal-screenshot-close" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "#191919", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "feather feather-x" }, h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), h("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))))))), this.showModal && (h("div", { class: `feedback-overlay ${this.isAnimating ? 'feedback-overlay--visible' : ''}` })), this.showModal && (h("div", { class: `feedback-modal-content feedback-modal-content--${this.modalPosition} ${this.isAnimating ? 'feedback-modal-content--open' : ''}`, ref: (el) => (this.modalContent = el) }, h("div", { class: "feedback-modal-header" }, !this.formSuccess && !this.formError ? (h("span", null, this.modalTitle)) : this.formSuccess ? (h("span", null, this.modalTitleSuccess)) : (h("span", null, this.modalTitleError)), h("button", { class: "feedback-modal-close", onClick: this.close }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "#191919", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "feather feather-x" }, h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))), h("div", { class: "feedback-modal-body" }, !this.formSuccess && !this.formError ? (h("form", { onSubmit: this.handleSubmit }, !this.hideRating && (h("div", { class: "feedback-modal-rating" }, this.ratingMode === 'thumbs' ? (h("div", { class: "feedback-modal-rating-content" }, h("span", { class: "feedback-modal-input-heading" }, this.ratingPlaceholder), h("div", { class: "feedback-modal-rating-buttons feedback-modal-rating-buttons--thumbs" }, h("button", { title: "Yes", class: `feedback-modal-rating-button ${this.selectedRating === 1
|
|
311
364
|
? 'feedback-modal-rating-button--selected'
|
|
312
365
|
: ''}`, onClick: (event) => {
|
|
313
366
|
event.preventDefault();
|
|
@@ -322,7 +375,7 @@ export class FeedbackModal {
|
|
|
322
375
|
: ''}`, onClick: (event) => {
|
|
323
376
|
event.preventDefault();
|
|
324
377
|
this.handleRatingChange(rating);
|
|
325
|
-
} }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "#5F6368", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })))))))))), h("div", { class: "feedback-modal-text" }, h("textarea", { placeholder: this.messagePlaceholder, value: this.formMessage, onInput: (event) => this.handleMessageInput(event) })), !this.hideEmail && (h("div", { class: "feedback-modal-email" }, h("input", { placeholder: this.emailPlaceholder, type: "email", onInput: (event) => this.handleEmailInput(event), value: this.formEmail, required: this.isEmailRequired }))), h("div", { class: "feedback-verification" }, h("input", { type: "text", name: "verification", style: { display: 'none' }, onInput: (event) => this.handleVerification(event), value: this.formVerification })), !this.hidePrivacyPolicy && (h("div", { class: "feedback-modal-privacy" }, h("input", { type: "checkbox", id: "privacyPolicy", onChange: (ev) => this.handleCheckboxChange(ev), required: true }), h("span", { innerHTML: this.privacyPolicyText }))), h("div", { class: `feedback-modal-buttons ${this.hideScreenshotButton ? 'single' : ''}` }, !this.hideScreenshotButton && (h("button", { type: "button", class: `feedback-modal-button feedback-modal-button--screenshot ${this.encodedScreenshot ? 'feedback-modal-button--active' : ''}`, onClick: this.openScreenShot, disabled: this.sending }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 -960 960 960", width: "24" }, h("path", { d: "M680-80v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-200v-200h80v120h120v80H200Zm0-360v-200h200v80H280v120h-80Zm480 0v-120H560v-80h200v200h-80Z" })), this.screenshotButtonText)), h("button", { class: "feedback-modal-button feedback-modal-button--submit", type: "submit", disabled: this.sending }, this.sendButtonText)))) : this.formSuccess && !this.formError ? (h("div", { class: "feedback-modal-success" }, h("p", { class: "feedback-modal-message" }, this.successMessage))) : this.formError && this.formErrorStatus == 404 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage404)) : this.formError && this.formErrorStatus == 403 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage403)) : this.formError ? (h("p", { class: "feedback-modal-message" }, this.errorMessage)) : (h("span", null))), h("div", { class: "feedback-modal-footer" }, h("div", { class: "feedback-logo", style: { display: this.whitelabel ? 'none' : 'block' } }, "Powered by", ' ', h("a", { target: "_blank", href: "https://pushfeedback.com" }, "PushFeedback.com")), this.footerText && (h("div", { class: "feedback-footer-text" }, h("span", { innerHTML: this.footerText }))))))));
|
|
378
|
+
} }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "#5F6368", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })))))))))), h("div", { class: "feedback-modal-text" }, h("textarea", { placeholder: this.messagePlaceholder, value: this.formMessage, onInput: (event) => this.handleMessageInput(event) })), !this.hideEmail && (h("div", { class: "feedback-modal-email" }, h("input", { placeholder: this.emailPlaceholder, type: "email", onInput: (event) => this.handleEmailInput(event), value: this.formEmail, required: this.isEmailRequired }))), h("div", { class: "feedback-verification" }, h("input", { type: "text", name: "verification", style: { display: 'none' }, onInput: (event) => this.handleVerification(event), value: this.formVerification })), !this.hidePrivacyPolicy && (h("div", { class: "feedback-modal-privacy" }, h("input", { type: "checkbox", id: "privacyPolicy", onChange: (ev) => this.handleCheckboxChange(ev), required: true }), h("span", { innerHTML: this.privacyPolicyText }))), h("div", { class: `feedback-modal-buttons ${this.hideScreenshotButton ? 'single' : ''}` }, !this.hideScreenshotButton && (h("button", { type: "button", class: `feedback-modal-button feedback-modal-button--screenshot ${this.encodedScreenshot ? 'feedback-modal-button--active' : ''}`, onClick: this.openScreenShot, disabled: this.sending }, this.encodedScreenshot && (h("div", { class: "screenshot-preview", onClick: this.openPreviewModal }, h("img", { src: this.encodedScreenshot, alt: "Screenshot Preview" }))), !this.encodedScreenshot && (h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 -960 960 960", width: "24" }, h("path", { d: "M680-80v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-200v-200h80v120h120v80H200Zm0-360v-200h200v80H280v120h-80Zm480 0v-120H560v-80h200v200h-80Z" }))), this.encodedScreenshot ? this.screenshotAttachedText : this.screenshotButtonText)), h("button", { class: "feedback-modal-button feedback-modal-button--submit", type: "submit", disabled: this.sending }, this.sendButtonText)))) : this.formSuccess && !this.formError ? (h("div", { class: "feedback-modal-success" }, h("p", { class: "feedback-modal-message" }, this.successMessage))) : this.formError && this.formErrorStatus == 404 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage404)) : this.formError && this.formErrorStatus == 403 ? (h("p", { class: "feedback-modal-message" }, this.errorMessage403)) : this.formError ? (h("p", { class: "feedback-modal-message" }, this.errorMessage)) : (h("span", null))), h("div", { class: "feedback-modal-footer" }, h("div", { class: "feedback-logo", style: { display: this.whitelabel ? 'none' : 'block' } }, "Powered by", ' ', h("a", { target: "_blank", href: "https://pushfeedback.com" }, "PushFeedback.com")), this.footerText && (h("div", { class: "feedback-footer-text" }, h("span", { innerHTML: this.footerText })))))), this.showPreviewModal && (h("div", { class: "preview-modal-overlay", onClick: this.closePreviewModal }, h("div", { class: "preview-modal" }, h("img", { src: this.encodedScreenshot, alt: "Screenshot Preview", onClick: (e) => e.stopPropagation() }))))));
|
|
326
379
|
}
|
|
327
380
|
componentDidRender() {
|
|
328
381
|
if (this.showModal) {
|
|
@@ -604,6 +657,23 @@ export class FeedbackModal {
|
|
|
604
657
|
"attribute": "rating",
|
|
605
658
|
"reflect": false
|
|
606
659
|
},
|
|
660
|
+
"metadata": {
|
|
661
|
+
"type": "string",
|
|
662
|
+
"mutable": false,
|
|
663
|
+
"complexType": {
|
|
664
|
+
"original": "''",
|
|
665
|
+
"resolved": "\"\"",
|
|
666
|
+
"references": {}
|
|
667
|
+
},
|
|
668
|
+
"required": false,
|
|
669
|
+
"optional": false,
|
|
670
|
+
"docs": {
|
|
671
|
+
"tags": [],
|
|
672
|
+
"text": ""
|
|
673
|
+
},
|
|
674
|
+
"attribute": "metadata",
|
|
675
|
+
"reflect": false
|
|
676
|
+
},
|
|
607
677
|
"fetchData": {
|
|
608
678
|
"type": "boolean",
|
|
609
679
|
"mutable": false,
|
|
@@ -874,6 +944,24 @@ export class FeedbackModal {
|
|
|
874
944
|
"reflect": false,
|
|
875
945
|
"defaultValue": "'Send'"
|
|
876
946
|
},
|
|
947
|
+
"screenshotAttachedText": {
|
|
948
|
+
"type": "string",
|
|
949
|
+
"mutable": false,
|
|
950
|
+
"complexType": {
|
|
951
|
+
"original": "string",
|
|
952
|
+
"resolved": "string",
|
|
953
|
+
"references": {}
|
|
954
|
+
},
|
|
955
|
+
"required": false,
|
|
956
|
+
"optional": false,
|
|
957
|
+
"docs": {
|
|
958
|
+
"tags": [],
|
|
959
|
+
"text": ""
|
|
960
|
+
},
|
|
961
|
+
"attribute": "screenshot-attached-text",
|
|
962
|
+
"reflect": false,
|
|
963
|
+
"defaultValue": "'Screenshot attached'"
|
|
964
|
+
},
|
|
877
965
|
"screenshotButtonText": {
|
|
878
966
|
"type": "string",
|
|
879
967
|
"mutable": false,
|
|
@@ -892,6 +980,24 @@ export class FeedbackModal {
|
|
|
892
980
|
"reflect": false,
|
|
893
981
|
"defaultValue": "'Add a screenshot'"
|
|
894
982
|
},
|
|
983
|
+
"screenshotTakingText": {
|
|
984
|
+
"type": "string",
|
|
985
|
+
"mutable": false,
|
|
986
|
+
"complexType": {
|
|
987
|
+
"original": "string",
|
|
988
|
+
"resolved": "string",
|
|
989
|
+
"references": {}
|
|
990
|
+
},
|
|
991
|
+
"required": false,
|
|
992
|
+
"optional": false,
|
|
993
|
+
"docs": {
|
|
994
|
+
"tags": [],
|
|
995
|
+
"text": ""
|
|
996
|
+
},
|
|
997
|
+
"attribute": "screenshot-taking-text",
|
|
998
|
+
"reflect": false,
|
|
999
|
+
"defaultValue": "'Taking screenshot...'"
|
|
1000
|
+
},
|
|
895
1001
|
"screenshotTopbarText": {
|
|
896
1002
|
"type": "string",
|
|
897
1003
|
"mutable": false,
|
|
@@ -944,7 +1050,9 @@ export class FeedbackModal {
|
|
|
944
1050
|
"whitelabel": {},
|
|
945
1051
|
"selectedRating": {},
|
|
946
1052
|
"overlayVisible": {},
|
|
947
|
-
"isAnimating": {}
|
|
1053
|
+
"isAnimating": {},
|
|
1054
|
+
"takingScreenshot": {},
|
|
1055
|
+
"showPreviewModal": {}
|
|
948
1056
|
};
|
|
949
1057
|
}
|
|
950
1058
|
static get events() {
|
|
@@ -15,6 +15,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
15
15
|
this.hideIcon = false;
|
|
16
16
|
this.hideMobile = false;
|
|
17
17
|
this.sessionId = '';
|
|
18
|
+
this.metadata = '';
|
|
18
19
|
this.submit = false;
|
|
19
20
|
this.customFont = false;
|
|
20
21
|
this.emailAddress = '';
|
|
@@ -40,7 +41,9 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
40
41
|
this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
|
|
41
42
|
this.ratingPlaceholder = 'Was this page helpful?';
|
|
42
43
|
this.ratingStarsPlaceholder = 'How would you rate this page?';
|
|
44
|
+
this.screenshotAttachedText = 'Screenshot attached';
|
|
43
45
|
this.screenshotButtonText = 'Add a screenshot';
|
|
46
|
+
this.screenshotTakingText = 'Taking screenshot...';
|
|
44
47
|
this.screenshotTopbarText = 'Select an element on this page';
|
|
45
48
|
this.sendButtonText = 'Send';
|
|
46
49
|
this.successMessage = '';
|
|
@@ -54,6 +57,9 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
54
57
|
this.sessionId = storedSessionId;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
60
|
+
else {
|
|
61
|
+
localStorage.setItem('pushfeedback_sessionid', this.sessionId);
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
componentDidLoad() {
|
|
59
65
|
if (this.buttonPosition === 'center-right') {
|
|
@@ -89,13 +95,16 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
89
95
|
'errorMessage404',
|
|
90
96
|
'footerText',
|
|
91
97
|
'messagePlaceholder',
|
|
98
|
+
'metadata',
|
|
92
99
|
'modalTitle',
|
|
93
100
|
'modalTitleError',
|
|
94
101
|
'modalTitleSuccess',
|
|
95
102
|
'privacyPolicyText',
|
|
96
103
|
'ratingPlaceholder',
|
|
97
104
|
'ratingStarsPlaceholder',
|
|
105
|
+
'screenshotAttachedText',
|
|
98
106
|
'screenshotButtonText',
|
|
107
|
+
'screenshotTakingText',
|
|
99
108
|
'screenshotTopbarText',
|
|
100
109
|
'sendButtonText',
|
|
101
110
|
'successMessage',
|
|
@@ -137,6 +146,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
137
146
|
rating: this.rating || -1,
|
|
138
147
|
ratingMode: this.ratingMode,
|
|
139
148
|
message: '',
|
|
149
|
+
metadata: this.metadata,
|
|
140
150
|
session: localStorage.getItem('pushfeedback_sessionid') || '',
|
|
141
151
|
};
|
|
142
152
|
const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
|
|
@@ -178,6 +188,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
178
188
|
"hideIcon": [4, "hide-icon"],
|
|
179
189
|
"hideMobile": [4, "hide-mobile"],
|
|
180
190
|
"sessionId": [1537, "session-id"],
|
|
191
|
+
"metadata": [1],
|
|
181
192
|
"submit": [4],
|
|
182
193
|
"customFont": [4, "custom-font"],
|
|
183
194
|
"emailAddress": [1, "email-address"],
|
|
@@ -203,7 +214,9 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
203
214
|
"privacyPolicyText": [1, "privacy-policy-text"],
|
|
204
215
|
"ratingPlaceholder": [1, "rating-placeholder"],
|
|
205
216
|
"ratingStarsPlaceholder": [1, "rating-stars-placeholder"],
|
|
217
|
+
"screenshotAttachedText": [1, "screenshot-attached-text"],
|
|
206
218
|
"screenshotButtonText": [1, "screenshot-button-text"],
|
|
219
|
+
"screenshotTakingText": [1, "screenshot-taking-text"],
|
|
207
220
|
"screenshotTopbarText": [1, "screenshot-topbar-text"],
|
|
208
221
|
"sendButtonText": [1, "send-button-text"],
|
|
209
222
|
"successMessage": [1, "success-message"]
|