pushfeedback 0.1.66 → 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 +101 -64
- 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 +20 -0
- package/dist/collection/components/feedback-modal/feedback-modal.css +28 -9
- package/dist/collection/components/feedback-modal/feedback-modal.js +122 -67
- package/dist/components/feedback-button.js +3 -0
- package/dist/components/feedback-modal2.js +103 -65
- package/dist/esm/feedback-button_2.entry.js +101 -64
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pushfeedback.js +1 -1
- package/dist/pushfeedback/{p-e6c2f829.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 +1 -0
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +11 -2
- package/dist/types/components.d.ts +4 -0
- package/package.json +1 -1
|
@@ -82,6 +82,11 @@ export class FeedbackModal {
|
|
|
82
82
|
this.showScreenshotTopBar = false;
|
|
83
83
|
this.hasSelectedElement = false;
|
|
84
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;
|
|
85
90
|
this.originalElement = null;
|
|
86
91
|
this.selectedElementBounds = null;
|
|
87
92
|
this.formSuccess = false;
|
|
@@ -89,6 +94,7 @@ export class FeedbackModal {
|
|
|
89
94
|
this.formErrorStatus = 500;
|
|
90
95
|
this.formMessage = '';
|
|
91
96
|
this.formEmail = '';
|
|
97
|
+
this.showPreviewModal = false;
|
|
92
98
|
this.resetOverflow();
|
|
93
99
|
}, 200);
|
|
94
100
|
};
|
|
@@ -97,26 +103,31 @@ export class FeedbackModal {
|
|
|
97
103
|
this.showModal = false;
|
|
98
104
|
this.showScreenshotMode = true;
|
|
99
105
|
this.showScreenshotTopBar = true;
|
|
106
|
+
// Clear previous screenshot and selection data
|
|
100
107
|
this.encodedScreenshot = null;
|
|
101
108
|
this.originalElement = null;
|
|
102
109
|
this.selectedElementBounds = null;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const scrollY = window.scrollY;
|
|
107
|
-
document.documentElement.style.top = `-${scrollY}px`;
|
|
108
|
-
window.scrollTo(0, parseInt(document.documentElement.style.top || '0') * -1);
|
|
109
|
-
document.documentElement.classList.add('feedback-modal-screenshot-open');
|
|
110
|
+
this.hoveredElement = null;
|
|
111
|
+
this.hoveredElementBounds = null;
|
|
112
|
+
// NO CSS CLASSES - they cause scroll jumping
|
|
110
113
|
};
|
|
111
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;
|
|
112
121
|
this.showModal = false;
|
|
113
122
|
this.showScreenshotMode = false;
|
|
114
123
|
this.showScreenshotTopBar = false;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.
|
|
119
|
-
|
|
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;
|
|
120
131
|
};
|
|
121
132
|
this.handleMouseOverScreenShot = (event) => {
|
|
122
133
|
event.preventDefault();
|
|
@@ -127,6 +138,9 @@ export class FeedbackModal {
|
|
|
127
138
|
const elementUnder = document.elementFromPoint(event.clientX, event.clientY);
|
|
128
139
|
const rect = elementUnder.getBoundingClientRect();
|
|
129
140
|
this.screenshotModal.style.display = '';
|
|
141
|
+
// Store the hovered element and its bounds for later use
|
|
142
|
+
this.hoveredElement = elementUnder;
|
|
143
|
+
this.hoveredElementBounds = rect;
|
|
130
144
|
// Get the bounding box of the element selected
|
|
131
145
|
this.elementSelected.style.position = 'absolute';
|
|
132
146
|
this.elementSelected.style.left = `${rect.left}px`;
|
|
@@ -168,30 +182,45 @@ export class FeedbackModal {
|
|
|
168
182
|
};
|
|
169
183
|
this.handleMouseClickedSelectedElement = async (event) => {
|
|
170
184
|
event.preventDefault();
|
|
171
|
-
if (!this.elementSelected) {
|
|
185
|
+
if (!this.elementSelected || !this.hoveredElement) {
|
|
172
186
|
return;
|
|
173
187
|
}
|
|
174
188
|
this.hasSelectedElement = true;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
this.
|
|
181
|
-
//
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
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
|
|
184
201
|
try {
|
|
185
202
|
const dataUrl = await this.captureScreenshot();
|
|
186
203
|
console.log('Screenshot captured');
|
|
187
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;
|
|
188
214
|
}
|
|
189
215
|
catch (error) {
|
|
190
216
|
console.error('Failed to capture screenshot:', error);
|
|
191
217
|
this.hasSelectedElement = false;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
//
|
|
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();
|
|
195
224
|
this.showModal = true;
|
|
196
225
|
}
|
|
197
226
|
};
|
|
@@ -238,10 +267,13 @@ export class FeedbackModal {
|
|
|
238
267
|
this.ratingPlaceholder = 'Was this page helpful?';
|
|
239
268
|
this.ratingStarsPlaceholder = 'How would you rate this page?';
|
|
240
269
|
this.sendButtonText = 'Send';
|
|
241
|
-
this.screenshotButtonText = 'Add a screenshot';
|
|
242
270
|
this.screenshotAttachedText = 'Screenshot attached';
|
|
271
|
+
this.screenshotButtonText = 'Add a screenshot';
|
|
272
|
+
this.screenshotTakingText = 'Taking screenshot...';
|
|
243
273
|
this.screenshotTopbarText = 'Select an element on this page';
|
|
244
274
|
this.successMessage = '';
|
|
275
|
+
this.takingScreenshot = false;
|
|
276
|
+
this.showPreviewModal = false;
|
|
245
277
|
}
|
|
246
278
|
componentWillLoad() {
|
|
247
279
|
if (this.fetchData)
|
|
@@ -265,15 +297,10 @@ export class FeedbackModal {
|
|
|
265
297
|
}
|
|
266
298
|
}
|
|
267
299
|
resetOverflow() {
|
|
300
|
+
// Just clean up any stray classes, don't add/remove during screenshot
|
|
268
301
|
document.documentElement.classList.remove('feedback-modal-screenshot-open');
|
|
269
302
|
document.documentElement.classList.remove('feedback-modal-screenshot-open--scroll');
|
|
270
|
-
document.documentElement.classList.
|
|
271
|
-
// Only restore scroll position if we previously modified it
|
|
272
|
-
if (document.documentElement.style.top) {
|
|
273
|
-
window.scrollTo(0, parseInt(document.documentElement.style.top || '0') * -1);
|
|
274
|
-
document.documentElement.style.top = '';
|
|
275
|
-
}
|
|
276
|
-
window.addEventListener('scroll', this.onScrollDebounced);
|
|
303
|
+
document.documentElement.classList.remove('feedback-modal-screenshot-closing');
|
|
277
304
|
}
|
|
278
305
|
handleMessageInput(event) {
|
|
279
306
|
this.formMessage = event.target.value;
|
|
@@ -283,32 +310,44 @@ export class FeedbackModal {
|
|
|
283
310
|
}
|
|
284
311
|
captureScreenshot() {
|
|
285
312
|
return new Promise((resolve, reject) => {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
allowTaint: true,
|
|
293
|
-
useCORS: true,
|
|
294
|
-
scale: 1,
|
|
295
|
-
})
|
|
296
|
-
.then((canvas) => {
|
|
297
|
-
const context = canvas.getContext('2d');
|
|
298
|
-
if (context && this.selectedElementBounds) {
|
|
299
|
-
// Use the same color as HTML highlight
|
|
300
|
-
context.strokeStyle = 'rgba(0, 123, 255, 0.8)'; // Example color
|
|
301
|
-
context.lineWidth = 3;
|
|
302
|
-
context.strokeRect(this.selectedElementBounds.left + window.scrollX, this.selectedElementBounds.top + window.scrollY, this.selectedElementBounds.width, this.selectedElementBounds.height);
|
|
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;
|
|
303
319
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
+
});
|
|
310
349
|
});
|
|
311
|
-
});
|
|
350
|
+
}, 100); // Small delay to ensure CSS is applied
|
|
312
351
|
});
|
|
313
352
|
}
|
|
314
353
|
handleCheckboxChange(event) {
|
|
@@ -320,12 +359,8 @@ export class FeedbackModal {
|
|
|
320
359
|
handleRatingChange(newRating) {
|
|
321
360
|
this.selectedRating = newRating;
|
|
322
361
|
}
|
|
323
|
-
// Remove the preview modal toggle function
|
|
324
|
-
// togglePreviewModal() {
|
|
325
|
-
// this.showPreviewModal = !this.showPreviewModal;
|
|
326
|
-
// }
|
|
327
362
|
render() {
|
|
328
|
-
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
|
|
329
364
|
? 'feedback-modal-rating-button--selected'
|
|
330
365
|
: ''}`, onClick: (event) => {
|
|
331
366
|
event.preventDefault();
|
|
@@ -340,7 +375,7 @@ export class FeedbackModal {
|
|
|
340
375
|
: ''}`, onClick: (event) => {
|
|
341
376
|
event.preventDefault();
|
|
342
377
|
this.handleRatingChange(rating);
|
|
343
|
-
} }, 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" }, 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 }))))))));
|
|
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() }))))));
|
|
344
379
|
}
|
|
345
380
|
componentDidRender() {
|
|
346
381
|
if (this.showModal) {
|
|
@@ -909,6 +944,24 @@ export class FeedbackModal {
|
|
|
909
944
|
"reflect": false,
|
|
910
945
|
"defaultValue": "'Send'"
|
|
911
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
|
+
},
|
|
912
965
|
"screenshotButtonText": {
|
|
913
966
|
"type": "string",
|
|
914
967
|
"mutable": false,
|
|
@@ -927,7 +980,7 @@ export class FeedbackModal {
|
|
|
927
980
|
"reflect": false,
|
|
928
981
|
"defaultValue": "'Add a screenshot'"
|
|
929
982
|
},
|
|
930
|
-
"
|
|
983
|
+
"screenshotTakingText": {
|
|
931
984
|
"type": "string",
|
|
932
985
|
"mutable": false,
|
|
933
986
|
"complexType": {
|
|
@@ -941,9 +994,9 @@ export class FeedbackModal {
|
|
|
941
994
|
"tags": [],
|
|
942
995
|
"text": ""
|
|
943
996
|
},
|
|
944
|
-
"attribute": "screenshot-
|
|
997
|
+
"attribute": "screenshot-taking-text",
|
|
945
998
|
"reflect": false,
|
|
946
|
-
"defaultValue": "'
|
|
999
|
+
"defaultValue": "'Taking screenshot...'"
|
|
947
1000
|
},
|
|
948
1001
|
"screenshotTopbarText": {
|
|
949
1002
|
"type": "string",
|
|
@@ -997,7 +1050,9 @@ export class FeedbackModal {
|
|
|
997
1050
|
"whitelabel": {},
|
|
998
1051
|
"selectedRating": {},
|
|
999
1052
|
"overlayVisible": {},
|
|
1000
|
-
"isAnimating": {}
|
|
1053
|
+
"isAnimating": {},
|
|
1054
|
+
"takingScreenshot": {},
|
|
1055
|
+
"showPreviewModal": {}
|
|
1001
1056
|
};
|
|
1002
1057
|
}
|
|
1003
1058
|
static get events() {
|
|
@@ -43,6 +43,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
43
43
|
this.ratingStarsPlaceholder = 'How would you rate this page?';
|
|
44
44
|
this.screenshotAttachedText = 'Screenshot attached';
|
|
45
45
|
this.screenshotButtonText = 'Add a screenshot';
|
|
46
|
+
this.screenshotTakingText = 'Taking screenshot...';
|
|
46
47
|
this.screenshotTopbarText = 'Select an element on this page';
|
|
47
48
|
this.sendButtonText = 'Send';
|
|
48
49
|
this.successMessage = '';
|
|
@@ -103,6 +104,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
103
104
|
'ratingStarsPlaceholder',
|
|
104
105
|
'screenshotAttachedText',
|
|
105
106
|
'screenshotButtonText',
|
|
107
|
+
'screenshotTakingText',
|
|
106
108
|
'screenshotTopbarText',
|
|
107
109
|
'sendButtonText',
|
|
108
110
|
'successMessage',
|
|
@@ -214,6 +216,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
214
216
|
"ratingStarsPlaceholder": [1, "rating-stars-placeholder"],
|
|
215
217
|
"screenshotAttachedText": [1, "screenshot-attached-text"],
|
|
216
218
|
"screenshotButtonText": [1, "screenshot-button-text"],
|
|
219
|
+
"screenshotTakingText": [1, "screenshot-taking-text"],
|
|
217
220
|
"screenshotTopbarText": [1, "screenshot-topbar-text"],
|
|
218
221
|
"sendButtonText": [1, "send-button-text"],
|
|
219
222
|
"successMessage": [1, "success-message"]
|