pushfeedback 0.1.64 → 0.1.66

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.
@@ -12,6 +12,9 @@ export class FeedbackModal {
12
12
  };
13
13
  this.handleSubmit = async (event) => {
14
14
  event.preventDefault();
15
+ if (this.isEmailRequired && !this.formEmail) {
16
+ return;
17
+ }
15
18
  this.resetOverflow();
16
19
  this.showScreenshotMode = false;
17
20
  this.showScreenshotTopBar = false;
@@ -26,6 +29,7 @@ export class FeedbackModal {
26
29
  screenshot: this.encodedScreenshot,
27
30
  rating: this.selectedRating,
28
31
  ratingMode: this.ratingMode,
32
+ metadata: this.metadata,
29
33
  verification: this.formVerification,
30
34
  session: localStorage.getItem('pushfeedback_sessionid') || '',
31
35
  };
@@ -78,6 +82,8 @@ export class FeedbackModal {
78
82
  this.showScreenshotTopBar = false;
79
83
  this.hasSelectedElement = false;
80
84
  this.encodedScreenshot = null;
85
+ this.originalElement = null;
86
+ this.selectedElementBounds = null;
81
87
  this.formSuccess = false;
82
88
  this.formError = false;
83
89
  this.formErrorStatus = 500;
@@ -92,6 +98,8 @@ export class FeedbackModal {
92
98
  this.showScreenshotMode = true;
93
99
  this.showScreenshotTopBar = true;
94
100
  this.encodedScreenshot = null;
101
+ this.originalElement = null;
102
+ this.selectedElementBounds = null;
95
103
  if (window.innerWidth > document.documentElement.clientWidth) {
96
104
  document.documentElement.classList.add('feedback-modal-screenshot-open--scroll');
97
105
  }
@@ -106,6 +114,8 @@ export class FeedbackModal {
106
114
  this.showScreenshotTopBar = false;
107
115
  this.hasSelectedElement = false;
108
116
  this.encodedScreenshot = null;
117
+ this.originalElement = null;
118
+ this.selectedElementBounds = null;
109
119
  this.resetOverflow();
110
120
  };
111
121
  this.handleMouseOverScreenShot = (event) => {
@@ -163,16 +173,12 @@ export class FeedbackModal {
163
173
  }
164
174
  this.hasSelectedElement = true;
165
175
  this.elementSelected.classList.add('feedback-modal-element-selected');
166
- // Get the top position including the scroll offset
167
- const rectTop = this.elementSelected.getBoundingClientRect().top;
168
- const topWithScroll = rectTop + window.scrollY;
169
- // Move the element with the scroll offset
170
- this.elementSelected.style.top = `${topWithScroll}px`;
171
- // Clone the selected element and append it to the body
172
- const clonedElementSelected = this.elementSelected.cloneNode(true);
173
- document.body.appendChild(clonedElementSelected);
174
- // Reset the top position of the original element
175
- this.elementSelected.style.top = `${rectTop}px`;
176
+ // Store the original element that was under the mouse
177
+ this.screenshotModal.style.display = 'none';
178
+ this.originalElement = document.elementFromPoint(event.clientX, event.clientY);
179
+ this.selectedElementBounds = this.originalElement.getBoundingClientRect();
180
+ this.screenshotModal.style.display = '';
181
+ // Hide the screenshot interface
176
182
  this.showScreenshotTopBar = false;
177
183
  this.showModal = false;
178
184
  try {
@@ -185,8 +191,7 @@ export class FeedbackModal {
185
191
  this.hasSelectedElement = false;
186
192
  }
187
193
  finally {
188
- // Remove the cloned element and show the modal again
189
- document.body.removeChild(clonedElementSelected);
194
+ // Show the modal again
190
195
  this.showModal = true;
191
196
  }
192
197
  };
@@ -206,6 +211,7 @@ export class FeedbackModal {
206
211
  this.customFont = false;
207
212
  this.emailAddress = '';
208
213
  this.hideEmail = false;
214
+ this.isEmailRequired = false;
209
215
  this.ratingMode = 'thumbs';
210
216
  this.hasSelectedElement = false;
211
217
  this.hidePrivacyPolicy = true;
@@ -216,6 +222,7 @@ export class FeedbackModal {
216
222
  this.showScreenshotTopBar = false;
217
223
  this.showModal = false;
218
224
  this.rating = undefined;
225
+ this.metadata = undefined;
219
226
  this.fetchData = true;
220
227
  this.emailPlaceholder = 'Email address (optional)';
221
228
  this.errorMessage = 'Please try again later.';
@@ -232,6 +239,7 @@ export class FeedbackModal {
232
239
  this.ratingStarsPlaceholder = 'How would you rate this page?';
233
240
  this.sendButtonText = 'Send';
234
241
  this.screenshotButtonText = 'Add a screenshot';
242
+ this.screenshotAttachedText = 'Screenshot attached';
235
243
  this.screenshotTopbarText = 'Select an element on this page';
236
244
  this.successMessage = '';
237
245
  }
@@ -281,13 +289,23 @@ export class FeedbackModal {
281
289
  y: window.scrollY,
282
290
  width: window.innerWidth,
283
291
  height: window.innerHeight,
292
+ allowTaint: true,
293
+ useCORS: true,
294
+ scale: 1,
284
295
  })
285
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);
303
+ }
286
304
  const dataUrl = canvas.toDataURL();
287
305
  resolve(dataUrl);
288
306
  })
289
307
  .catch((error) => {
290
- console.error(error);
308
+ console.error('Failed to capture screenshot:', error);
291
309
  reject(error);
292
310
  });
293
311
  });
@@ -302,6 +320,10 @@ export class FeedbackModal {
302
320
  handleRatingChange(newRating) {
303
321
  this.selectedRating = newRating;
304
322
  }
323
+ // Remove the preview modal toggle function
324
+ // togglePreviewModal() {
325
+ // this.showPreviewModal = !this.showPreviewModal;
326
+ // }
305
327
  render() {
306
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
307
329
  ? 'feedback-modal-rating-button--selected'
@@ -318,7 +340,7 @@ export class FeedbackModal {
318
340
  : ''}`, onClick: (event) => {
319
341
  event.preventDefault();
320
342
  this.handleRatingChange(rating);
321
- } }, 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 }))), 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 }))))))));
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 }))))))));
322
344
  }
323
345
  componentDidRender() {
324
346
  if (this.showModal) {
@@ -403,6 +425,24 @@ export class FeedbackModal {
403
425
  "reflect": false,
404
426
  "defaultValue": "false"
405
427
  },
428
+ "isEmailRequired": {
429
+ "type": "boolean",
430
+ "mutable": false,
431
+ "complexType": {
432
+ "original": "boolean",
433
+ "resolved": "boolean",
434
+ "references": {}
435
+ },
436
+ "required": false,
437
+ "optional": false,
438
+ "docs": {
439
+ "tags": [],
440
+ "text": ""
441
+ },
442
+ "attribute": "is-email-required",
443
+ "reflect": false,
444
+ "defaultValue": "false"
445
+ },
406
446
  "ratingMode": {
407
447
  "type": "string",
408
448
  "mutable": false,
@@ -582,6 +622,23 @@ export class FeedbackModal {
582
622
  "attribute": "rating",
583
623
  "reflect": false
584
624
  },
625
+ "metadata": {
626
+ "type": "string",
627
+ "mutable": false,
628
+ "complexType": {
629
+ "original": "''",
630
+ "resolved": "\"\"",
631
+ "references": {}
632
+ },
633
+ "required": false,
634
+ "optional": false,
635
+ "docs": {
636
+ "tags": [],
637
+ "text": ""
638
+ },
639
+ "attribute": "metadata",
640
+ "reflect": false
641
+ },
585
642
  "fetchData": {
586
643
  "type": "boolean",
587
644
  "mutable": false,
@@ -870,6 +927,24 @@ export class FeedbackModal {
870
927
  "reflect": false,
871
928
  "defaultValue": "'Add a screenshot'"
872
929
  },
930
+ "screenshotAttachedText": {
931
+ "type": "string",
932
+ "mutable": false,
933
+ "complexType": {
934
+ "original": "string",
935
+ "resolved": "string",
936
+ "references": {}
937
+ },
938
+ "required": false,
939
+ "optional": false,
940
+ "docs": {
941
+ "tags": [],
942
+ "text": ""
943
+ },
944
+ "attribute": "screenshot-attached-text",
945
+ "reflect": false,
946
+ "defaultValue": "'Screenshot attached'"
947
+ },
873
948
  "screenshotTopbarText": {
874
949
  "type": "string",
875
950
  "mutable": false,
@@ -15,9 +15,11 @@ 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 = '';
22
+ this.isEmailRequired = false;
21
23
  this.fetchData = true;
22
24
  this.hideEmail = false;
23
25
  this.hidePrivacyPolicy = true;
@@ -39,6 +41,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
39
41
  this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
40
42
  this.ratingPlaceholder = 'Was this page helpful?';
41
43
  this.ratingStarsPlaceholder = 'How would you rate this page?';
44
+ this.screenshotAttachedText = 'Screenshot attached';
42
45
  this.screenshotButtonText = 'Add a screenshot';
43
46
  this.screenshotTopbarText = 'Select an element on this page';
44
47
  this.sendButtonText = 'Send';
@@ -53,6 +56,9 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
53
56
  this.sessionId = storedSessionId;
54
57
  }
55
58
  }
59
+ else {
60
+ localStorage.setItem('pushfeedback_sessionid', this.sessionId);
61
+ }
56
62
  }
57
63
  componentDidLoad() {
58
64
  if (this.buttonPosition === 'center-right') {
@@ -77,6 +83,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
77
83
  'hidePrivacyPolicy',
78
84
  'hideRating',
79
85
  'hideScreenshotButton',
86
+ 'isEmailRequired',
80
87
  'modalPosition',
81
88
  'project',
82
89
  'rating',
@@ -87,12 +94,14 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
87
94
  'errorMessage404',
88
95
  'footerText',
89
96
  'messagePlaceholder',
97
+ 'metadata',
90
98
  'modalTitle',
91
99
  'modalTitleError',
92
100
  'modalTitleSuccess',
93
101
  'privacyPolicyText',
94
102
  'ratingPlaceholder',
95
103
  'ratingStarsPlaceholder',
104
+ 'screenshotAttachedText',
96
105
  'screenshotButtonText',
97
106
  'screenshotTopbarText',
98
107
  'sendButtonText',
@@ -135,6 +144,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
135
144
  rating: this.rating || -1,
136
145
  ratingMode: this.ratingMode,
137
146
  message: '',
147
+ metadata: this.metadata,
138
148
  session: localStorage.getItem('pushfeedback_sessionid') || '',
139
149
  };
140
150
  const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
@@ -176,9 +186,11 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
176
186
  "hideIcon": [4, "hide-icon"],
177
187
  "hideMobile": [4, "hide-mobile"],
178
188
  "sessionId": [1537, "session-id"],
189
+ "metadata": [1],
179
190
  "submit": [4],
180
191
  "customFont": [4, "custom-font"],
181
192
  "emailAddress": [1, "email-address"],
193
+ "isEmailRequired": [4, "is-email-required"],
182
194
  "fetchData": [4, "fetch-data"],
183
195
  "hideEmail": [4, "hide-email"],
184
196
  "hidePrivacyPolicy": [4, "hide-privacy-policy"],
@@ -200,6 +212,7 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
200
212
  "privacyPolicyText": [1, "privacy-policy-text"],
201
213
  "ratingPlaceholder": [1, "rating-placeholder"],
202
214
  "ratingStarsPlaceholder": [1, "rating-stars-placeholder"],
215
+ "screenshotAttachedText": [1, "screenshot-attached-text"],
203
216
  "screenshotButtonText": [1, "screenshot-button-text"],
204
217
  "screenshotTopbarText": [1, "screenshot-topbar-text"],
205
218
  "sendButtonText": [1, "send-button-text"],
@@ -8791,7 +8791,7 @@ var html2canvasPro = createCommonjsModule(function (module, exports) {
8791
8791
  //# sourceMappingURL=html2canvas-pro.js.map
8792
8792
  });
8793
8793
 
8794
- const feedbackModalCss = ".text-center{flex-grow:1;text-align:center}.feedback-modal-wrapper *{font-family:var(--feedback-font-family)}.feedback-modal-wrapper--custom-font *{font-family:inherit}.feedback-modal-wrapper{position:absolute;z-index:var(--feedback-modal-modal-wrapper-z-index)}.feedback-overlay{background-color:var(--feedback-modal-screenshot-bg-color);height:100%;left:0;opacity:0;position:fixed;top:0;width:100%;z-index:var(--feedback-modal-screnshot-z-index);transition:opacity 0.2s ease-out}.feedback-overlay--visible{opacity:1}.feedback-modal{display:inline-block;position:relative}.feedback-modal-content{background-color:var(--feedback-modal-content-bg-color);border-color:1px solid var(--feedback-modal-header-text-color);border-radius:var(--feedback-modal-content-border-radius);box-shadow:0px 1px 2px 0px rgba(60, 64, 67, .30), 0px 2px 6px 2px rgba(60, 64, 67, .15);box-sizing:border-box;color:var(--feedback-modal-content-text-color);display:flex;flex-direction:column;left:50%;max-width:90%;padding:20px;position:fixed;top:50%;transform:translate(-50%, -50%) scale(0.95);opacity:0;width:100%;z-index:var(--feedback-modal-content-z-index);transition:transform 0.2s ease-out, opacity 0.2s ease-out}.feedback-modal-content--open{transform:translate(-50%, -50%) scale(1);opacity:1}.feedback-modal-header{align-items:center;color:var(--feedback-modal-header-text-color);display:flex;font-size:var(--feedback-header-font-size);font-weight:var(--feedback-modal-header-font-weight);justify-content:space-between;margin-bottom:20px}.feedback-modal-rating-buttons{width:100%;margin-bottom:20px}.feedback-modal-rating-button{padding:0;background-color:transparent;border:transparent;margin-right:5px;cursor:pointer}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button{border:1px solid var(--feedback-modal-button-border-color);border-radius:var(--feedback-modal-button-border-radius);color:var(--feedback-modal-button-text-color);font-size:var(--feedback-modal-button-font-size);font-weight:500;margin-right:10px;justify-content:center;padding:5px 10px}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button:hover,.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button--selected{background-color:var(--feedback-modal-button-bg-color-active);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-text-color-active)}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button:hover svg,.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button--selected svg{stroke:var(--feedback-modal-rating-button-selected-color)}.feedback-modal-rating-buttons svg{stroke:var(--feedback-modal-rating-button-color);cursor:pointer}.feedback-modal-rating-buttons--stars .feedback-modal-rating-button--selected svg{fill:var(--feedback-modal-rating-button-stars-selected-color);stroke:var(--feedback-modal-rating-button-stars-selected-color)}.feedback-modal-text textarea{background-color:var(--feedback-modal-input-bg-color);border:1px solid var(--feedback-modal-input-border-color);border-radius:var(--feedback-modal-input-border-radius);box-sizing:border-box;color:var(--feedback-modal-input-text-color);font-size:var(--feedback-modal-input-font-size);margin-bottom:20px;height:100px;min-height:100px;padding:10px;resize:vertical;width:100%}.feedback-modal-email input{background-color:var(--feedback-modal-input-bg-color);border:1px solid var(--feedback-modal-input-border-color);border-radius:var(--feedback-modal-input-border-radius);box-sizing:border-box;color:var(--feedback-modal-input-text-color);font-size:var(--feedback-modal-input-font-size);margin-bottom:20px;height:40px;padding:10px;width:100%;margin-bottom:20px}.feedback-modal-privacy{font-size:var(--feedback-modal-input-font-size);margin-bottom:20px}.feedback-modal-text textarea:focus,.feedback-modal-email input:focus{border:1px solid var(--feedback-modal-input-border-color-focused);outline:none}.feedback-modal-buttons{display:flex;flex-direction:column}.feedback-modal-buttons .feedback-modal-button{margin-bottom:20px}.feedback-modal-button{align-items:center;background-color:transparent;border:1px solid var(--feedback-modal-button-border-color);border-radius:var(--feedback-modal-button-border-radius);color:var(--feedback-modal-button-text-color);cursor:pointer;display:flex;font-size:var(--feedback-modal-button-font-size);font-weight:500;justify-content:center;min-height:40px;padding:5px 10px}.feedback-modal-button svg{margin-right:6px}.feedback-modal-button path{fill:var(--feedback-modal-button-icon-color)}.feedback-modal-button:hover path,.feedback-modal-button--active path{fill:var(--feedback-modal-button-icon-color-active)}.feedback-modal-button--submit{background-color:var(--feedback-modal-button-submit-bg-color);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-submit-text-color)}.feedback-modal-button:hover,.feedback-modal-button--active{background-color:var(--feedback-modal-button-bg-color-active);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-text-color-active)}.feedback-modal-button--submit:hover{background-color:var(--feedback-modal-button-submit-bg-color-hover);border:1px solid var(--feedback-modal-button-submit-border-color-hover);color:var(--feedback-modal-button-submit-text-color-hover)}.feedback-modal-input-heading{display:block;font-size:14px;font-weight:300;padding-bottom:10px}.feedback-modal-footer{font-size:12px;text-align:center}.feedback-modal-footer a{color:var(--feedback-modal-footer-link);font-weight:500;text-decoration:none}.feedback-logo,.feedback-footer-text{display:block;text-align:center;margin-top:5px}.feedback-footer-text{margin-top:10px;line-height:1.5}.feedback-modal-close{background-color:var(--feedback-modal-close-bg-color);border:0;border-radius:50%;cursor:pointer;height:22px;margin-left:auto;padding:0;width:22px}.feedback-modal-close svg{stroke:var(--feedback-modal-close-color)}.feedback-modal-screenshot{background-color:var(--feedback-modal-screenshot-bg-color);height:100%;left:0;position:fixed;top:0;width:100%;z-index:var(--feedback-modal-screnshot-z-index)}.feedback-modal-screenshot-header{align-items:center;background-color:var(--feedback-modal-screenshot-header-bg-color);border-radius:var(--feedback-modal-content-border-radius);box-shadow:0px 1px 2px 0px rgba(60, 64, 67, .30), 0px 2px 6px 2px rgba(60, 64, 67, .15);box-sizing:border-box;color:var(--feedback-modal-screenshot-header-text-color);cursor:pointer;display:flex;left:50%;top:20px;transform:translateX(-50%);padding:10px;position:fixed;width:max-content;z-index:var(--feedback-modal-screenshot-header-z-index)}.feedback-modal-screenshot-close{height:24px;padding-left:10px;width:24px}.feedback-modal-screenshot-close svg{stroke:var(--feedback-modal-close-color)}.feedback-modal-message{font-size:var(--feedback-modal-message-font-size);margin-top:0}.feedback-modal-element-hover{background-color:transparent;cursor:pointer;border:1px solid var(--feedback-modal-element-hover-border-color)}.feedback-modal-element-selected{background-color:transparent;border:1px solid var(--feedback-modal-element-selected-border-color)}@media screen and (min-width: 768px){.feedback-modal-content{max-width:var(--feedback-modal-content-max-width)}.feedback-modal-content.feedback-modal-content--bottom-right{bottom:var(--feedback-modal-content-position-bottom);left:initial;right:var(--feedback-modal-content-position-right);top:initial;transform:initial}.feedback-modal-content.feedback-modal-content--bottom-left{bottom:var(--feedback-modal-content-position-bottom);left:var(--feedback-modal-content-position-left);top:initial;transform:initial}.feedback-modal-content.feedback-modal-content--top-right{right:var(--feedback-modal-content-position-right);top:var(--feedback-modal-content-position-top);transform:initial}.feedback-modal-content.feedback-modal-content--top-left{left:var(--feedback-modal-content-position-left);top:var(--feedback-modal-content-position-top);transform:initial}.feedback-modal-content.feedback-modal-content--center-left{left:5px;right:auto;top:50%;transform:translateY(-50%)}.feedback-modal-content.feedback-modal-content--center-right{left:auto;right:5px;top:50%;transform:translateY(-50%)}.feedback-modal-content.feedback-modal-content--sidebar-left.feedback-modal-content--open,.feedback-modal-content.feedback-modal-content--sidebar-right.feedback-modal-content--open{transform:translateX(0)}.feedback-modal-content.feedback-modal-content--sidebar-left{max-width:var(--feedback-modal-content-sidebar-max-width);left:0;right:auto;height:100vh;top:0;transform:translateX(-100%);transition:transform 0.5s ease-in-out;border-radius:0}.feedback-modal-content.feedback-modal-content--sidebar-right{max-width:var(--feedback-modal-content-sidebar-max-width);left:auto;right:0;height:100vh;top:0;transform:translateX(100%);transition:transform 0.5s ease-in-out;border-radius:0}.feedback-modal-text textarea{height:150px;min-height:150px}.feedback-modal-content.feedback-modal-content--bottom-right{transform:translateY(20px)}.feedback-modal-content.feedback-modal-content--bottom-right.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--bottom-left{transform:translateY(20px)}.feedback-modal-content.feedback-modal-content--bottom-left.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--top-right{transform:translateY(-20px)}.feedback-modal-content.feedback-modal-content--top-right.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--top-left{transform:translateY(-20px)}.feedback-modal-content.feedback-modal-content--top-left.feedback-modal-content--open{transform:translateY(0)}}";
8794
+ const feedbackModalCss = ".text-center{flex-grow:1;text-align:center}.feedback-modal-wrapper *{font-family:var(--feedback-font-family)}.feedback-modal-wrapper--custom-font *{font-family:inherit}.feedback-modal-wrapper{position:absolute;z-index:var(--feedback-modal-modal-wrapper-z-index)}.feedback-overlay{background-color:var(--feedback-modal-screenshot-bg-color);height:100%;left:0;opacity:0;position:fixed;top:0;width:100%;z-index:var(--feedback-modal-screnshot-z-index);transition:opacity 0.2s ease-out}.feedback-overlay--visible{opacity:1}.feedback-modal{display:inline-block;position:relative}.feedback-modal-content{background-color:var(--feedback-modal-content-bg-color);border-color:1px solid var(--feedback-modal-header-text-color);border-radius:var(--feedback-modal-content-border-radius);box-shadow:0px 1px 2px 0px rgba(60, 64, 67, .30), 0px 2px 6px 2px rgba(60, 64, 67, .15);box-sizing:border-box;color:var(--feedback-modal-content-text-color);display:flex;flex-direction:column;left:50%;max-width:90%;padding:20px;position:fixed;top:50%;transform:translate(-50%, -50%) scale(0.95);opacity:0;width:100%;z-index:var(--feedback-modal-content-z-index);transition:transform 0.2s ease-out, opacity 0.2s ease-out}.feedback-modal-content--open{transform:translate(-50%, -50%) scale(1);opacity:1}.feedback-modal-header{align-items:center;color:var(--feedback-modal-header-text-color);display:flex;font-size:var(--feedback-header-font-size);font-weight:var(--feedback-modal-header-font-weight);justify-content:space-between;margin-bottom:20px}.feedback-modal-rating-buttons{width:100%;margin-bottom:20px}.feedback-modal-rating-button{padding:0;background-color:transparent;border:transparent;margin-right:5px;cursor:pointer}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button{border:1px solid var(--feedback-modal-button-border-color);border-radius:var(--feedback-modal-button-border-radius);color:var(--feedback-modal-button-text-color);font-size:var(--feedback-modal-button-font-size);font-weight:500;margin-right:10px;justify-content:center;padding:5px 10px}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button:hover,.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button--selected{background-color:var(--feedback-modal-button-bg-color-active);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-text-color-active)}.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button:hover svg,.feedback-modal-rating-buttons--thumbs .feedback-modal-rating-button--selected svg{stroke:var(--feedback-modal-rating-button-selected-color)}.feedback-modal-rating-buttons svg{stroke:var(--feedback-modal-rating-button-color);cursor:pointer}.feedback-modal-rating-buttons--stars .feedback-modal-rating-button--selected svg{fill:var(--feedback-modal-rating-button-stars-selected-color);stroke:var(--feedback-modal-rating-button-stars-selected-color)}.feedback-modal-text textarea{background-color:var(--feedback-modal-input-bg-color);border:1px solid var(--feedback-modal-input-border-color);border-radius:var(--feedback-modal-input-border-radius);box-sizing:border-box;color:var(--feedback-modal-input-text-color);font-size:var(--feedback-modal-input-font-size);margin-bottom:20px;height:100px;min-height:100px;padding:10px;resize:vertical;width:100%}.feedback-modal-email input{background-color:var(--feedback-modal-input-bg-color);border:1px solid var(--feedback-modal-input-border-color);border-radius:var(--feedback-modal-input-border-radius);box-sizing:border-box;color:var(--feedback-modal-input-text-color);font-size:var(--feedback-modal-input-font-size);margin-bottom:20px;height:40px;padding:10px;width:100%;margin-bottom:20px}.feedback-modal-privacy{font-size:var(--feedback-modal-input-font-size);margin-bottom:20px}.feedback-modal-text textarea:focus,.feedback-modal-email input:focus{border:1px solid var(--feedback-modal-input-border-color-focused);outline:none}.feedback-modal-buttons{display:flex;flex-direction:column}.feedback-modal-buttons .feedback-modal-button{margin-bottom:20px}.feedback-modal-button{align-items:center;background-color:transparent;border:1px solid var(--feedback-modal-button-border-color);border-radius:var(--feedback-modal-button-border-radius);color:var(--feedback-modal-button-text-color);cursor:pointer;display:flex;font-size:var(--feedback-modal-button-font-size);font-weight:500;justify-content:center;min-height:40px;padding:5px 10px}.feedback-modal-button svg{margin-right:6px}.feedback-modal-button path{fill:var(--feedback-modal-button-icon-color)}.feedback-modal-button:hover path,.feedback-modal-button--active path{fill:var(--feedback-modal-button-icon-color-active)}.feedback-modal-button--submit{background-color:var(--feedback-modal-button-submit-bg-color);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-submit-text-color)}.feedback-modal-button:hover,.feedback-modal-button--active{background-color:var(--feedback-modal-button-bg-color-active);border:1px solid var(--feedback-modal-button-border-color-active);color:var(--feedback-modal-button-text-color-active)}.feedback-modal-button--submit:hover{background-color:var(--feedback-modal-button-submit-bg-color-hover);border:1px solid var(--feedback-modal-button-submit-border-color-hover);color:var(--feedback-modal-button-submit-text-color-hover)}.feedback-modal-input-heading{display:block;font-size:14px;font-weight:300;padding-bottom:10px}.feedback-modal-footer{font-size:12px;text-align:center}.feedback-modal-footer a{color:var(--feedback-modal-footer-link);font-weight:500;text-decoration:none}.feedback-logo,.feedback-footer-text{display:block;text-align:center;margin-top:5px}.feedback-footer-text{margin-top:10px;line-height:1.5}.feedback-modal-close{background-color:var(--feedback-modal-close-bg-color);border:0;border-radius:50%;cursor:pointer;height:22px;margin-left:auto;padding:0;width:22px}.feedback-modal-close svg{stroke:var(--feedback-modal-close-color)}.feedback-modal-screenshot{background-color:var(--feedback-modal-screenshot-bg-color);height:100%;left:0;position:fixed;top:0;width:100%;z-index:var(--feedback-modal-screnshot-z-index)}.feedback-modal-screenshot-header{align-items:center;background-color:var(--feedback-modal-screenshot-header-bg-color);border-radius:var(--feedback-modal-content-border-radius);box-shadow:0px 1px 2px 0px rgba(60, 64, 67, .30), 0px 2px 6px 2px rgba(60, 64, 67, .15);box-sizing:border-box;color:var(--feedback-modal-screenshot-header-text-color);cursor:pointer;display:flex;left:50%;top:20px;transform:translateX(-50%);padding:10px;position:fixed;width:max-content;z-index:var(--feedback-modal-screenshot-header-z-index)}.feedback-modal-screenshot-close{height:24px;padding-left:10px;width:24px}.feedback-modal-screenshot-close svg{stroke:var(--feedback-modal-close-color)}.feedback-modal-message{font-size:var(--feedback-modal-message-font-size);margin-top:0}.feedback-modal-element-hover{background-color:transparent;cursor:pointer;border:1px solid var(--feedback-modal-element-hover-border-color)}.feedback-modal-element-selected{background-color:transparent;border:1px solid var(--feedback-modal-element-selected-border-color)}.screenshot-preview{display:inline-block;width:30px;height:30px;overflow:hidden;border-radius:4px;margin-right:10px;box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);cursor:pointer}.screenshot-preview img{width:100%;height:100%;object-fit:cover}.preview-modal{position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);background-color:rgba(0, 0, 0, 0.8);padding:20px;border-radius:8px;z-index:1000}.preview-modal img{max-width:90vw;max-height:90vh}@media screen and (min-width: 768px){.feedback-modal-content{max-width:var(--feedback-modal-content-max-width)}.feedback-modal-content.feedback-modal-content--bottom-right{bottom:var(--feedback-modal-content-position-bottom);left:initial;right:var(--feedback-modal-content-position-right);top:initial;transform:initial}.feedback-modal-content.feedback-modal-content--bottom-left{bottom:var(--feedback-modal-content-position-bottom);left:var(--feedback-modal-content-position-left);top:initial;transform:initial}.feedback-modal-content.feedback-modal-content--top-right{right:var(--feedback-modal-content-position-right);top:var(--feedback-modal-content-position-top);transform:initial}.feedback-modal-content.feedback-modal-content--top-left{left:var(--feedback-modal-content-position-left);top:var(--feedback-modal-content-position-top);transform:initial}.feedback-modal-content.feedback-modal-content--center-left{left:5px;right:auto;top:50%;transform:translateY(-50%)}.feedback-modal-content.feedback-modal-content--center-right{left:auto;right:5px;top:50%;transform:translateY(-50%)}.feedback-modal-content.feedback-modal-content--sidebar-left.feedback-modal-content--open,.feedback-modal-content.feedback-modal-content--sidebar-right.feedback-modal-content--open{transform:translateX(0)}.feedback-modal-content.feedback-modal-content--sidebar-left{max-width:var(--feedback-modal-content-sidebar-max-width);left:0;right:auto;height:100vh;top:0;transform:translateX(-100%);transition:transform 0.5s ease-in-out;border-radius:0}.feedback-modal-content.feedback-modal-content--sidebar-right{max-width:var(--feedback-modal-content-sidebar-max-width);left:auto;right:0;height:100vh;top:0;transform:translateX(100%);transition:transform 0.5s ease-in-out;border-radius:0}.feedback-modal-text textarea{height:150px;min-height:150px}.feedback-modal-content.feedback-modal-content--bottom-right{transform:translateY(20px)}.feedback-modal-content.feedback-modal-content--bottom-right.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--bottom-left{transform:translateY(20px)}.feedback-modal-content.feedback-modal-content--bottom-left.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--top-right{transform:translateY(-20px)}.feedback-modal-content.feedback-modal-content--top-right.feedback-modal-content--open{transform:translateY(0)}.feedback-modal-content.feedback-modal-content--top-left{transform:translateY(-20px)}.feedback-modal-content.feedback-modal-content--top-left.feedback-modal-content--open{transform:translateY(0)}}";
8795
8795
 
8796
8796
  const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8797
8797
  constructor() {
@@ -8810,6 +8810,9 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8810
8810
  };
8811
8811
  this.handleSubmit = async (event) => {
8812
8812
  event.preventDefault();
8813
+ if (this.isEmailRequired && !this.formEmail) {
8814
+ return;
8815
+ }
8813
8816
  this.resetOverflow();
8814
8817
  this.showScreenshotMode = false;
8815
8818
  this.showScreenshotTopBar = false;
@@ -8824,6 +8827,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8824
8827
  screenshot: this.encodedScreenshot,
8825
8828
  rating: this.selectedRating,
8826
8829
  ratingMode: this.ratingMode,
8830
+ metadata: this.metadata,
8827
8831
  verification: this.formVerification,
8828
8832
  session: localStorage.getItem('pushfeedback_sessionid') || '',
8829
8833
  };
@@ -8876,6 +8880,8 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8876
8880
  this.showScreenshotTopBar = false;
8877
8881
  this.hasSelectedElement = false;
8878
8882
  this.encodedScreenshot = null;
8883
+ this.originalElement = null;
8884
+ this.selectedElementBounds = null;
8879
8885
  this.formSuccess = false;
8880
8886
  this.formError = false;
8881
8887
  this.formErrorStatus = 500;
@@ -8890,6 +8896,8 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8890
8896
  this.showScreenshotMode = true;
8891
8897
  this.showScreenshotTopBar = true;
8892
8898
  this.encodedScreenshot = null;
8899
+ this.originalElement = null;
8900
+ this.selectedElementBounds = null;
8893
8901
  if (window.innerWidth > document.documentElement.clientWidth) {
8894
8902
  document.documentElement.classList.add('feedback-modal-screenshot-open--scroll');
8895
8903
  }
@@ -8904,6 +8912,8 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8904
8912
  this.showScreenshotTopBar = false;
8905
8913
  this.hasSelectedElement = false;
8906
8914
  this.encodedScreenshot = null;
8915
+ this.originalElement = null;
8916
+ this.selectedElementBounds = null;
8907
8917
  this.resetOverflow();
8908
8918
  };
8909
8919
  this.handleMouseOverScreenShot = (event) => {
@@ -8961,16 +8971,12 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8961
8971
  }
8962
8972
  this.hasSelectedElement = true;
8963
8973
  this.elementSelected.classList.add('feedback-modal-element-selected');
8964
- // Get the top position including the scroll offset
8965
- const rectTop = this.elementSelected.getBoundingClientRect().top;
8966
- const topWithScroll = rectTop + window.scrollY;
8967
- // Move the element with the scroll offset
8968
- this.elementSelected.style.top = `${topWithScroll}px`;
8969
- // Clone the selected element and append it to the body
8970
- const clonedElementSelected = this.elementSelected.cloneNode(true);
8971
- document.body.appendChild(clonedElementSelected);
8972
- // Reset the top position of the original element
8973
- this.elementSelected.style.top = `${rectTop}px`;
8974
+ // Store the original element that was under the mouse
8975
+ this.screenshotModal.style.display = 'none';
8976
+ this.originalElement = document.elementFromPoint(event.clientX, event.clientY);
8977
+ this.selectedElementBounds = this.originalElement.getBoundingClientRect();
8978
+ this.screenshotModal.style.display = '';
8979
+ // Hide the screenshot interface
8974
8980
  this.showScreenshotTopBar = false;
8975
8981
  this.showModal = false;
8976
8982
  try {
@@ -8983,8 +8989,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
8983
8989
  this.hasSelectedElement = false;
8984
8990
  }
8985
8991
  finally {
8986
- // Remove the cloned element and show the modal again
8987
- document.body.removeChild(clonedElementSelected);
8992
+ // Show the modal again
8988
8993
  this.showModal = true;
8989
8994
  }
8990
8995
  };
@@ -9004,6 +9009,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9004
9009
  this.customFont = false;
9005
9010
  this.emailAddress = '';
9006
9011
  this.hideEmail = false;
9012
+ this.isEmailRequired = false;
9007
9013
  this.ratingMode = 'thumbs';
9008
9014
  this.hasSelectedElement = false;
9009
9015
  this.hidePrivacyPolicy = true;
@@ -9014,6 +9020,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9014
9020
  this.showScreenshotTopBar = false;
9015
9021
  this.showModal = false;
9016
9022
  this.rating = undefined;
9023
+ this.metadata = undefined;
9017
9024
  this.fetchData = true;
9018
9025
  this.emailPlaceholder = 'Email address (optional)';
9019
9026
  this.errorMessage = 'Please try again later.';
@@ -9030,6 +9037,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9030
9037
  this.ratingStarsPlaceholder = 'How would you rate this page?';
9031
9038
  this.sendButtonText = 'Send';
9032
9039
  this.screenshotButtonText = 'Add a screenshot';
9040
+ this.screenshotAttachedText = 'Screenshot attached';
9033
9041
  this.screenshotTopbarText = 'Select an element on this page';
9034
9042
  this.successMessage = '';
9035
9043
  }
@@ -9079,13 +9087,23 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9079
9087
  y: window.scrollY,
9080
9088
  width: window.innerWidth,
9081
9089
  height: window.innerHeight,
9090
+ allowTaint: true,
9091
+ useCORS: true,
9092
+ scale: 1,
9082
9093
  })
9083
9094
  .then((canvas) => {
9095
+ const context = canvas.getContext('2d');
9096
+ if (context && this.selectedElementBounds) {
9097
+ // Use the same color as HTML highlight
9098
+ context.strokeStyle = 'rgba(0, 123, 255, 0.8)'; // Example color
9099
+ context.lineWidth = 3;
9100
+ context.strokeRect(this.selectedElementBounds.left + window.scrollX, this.selectedElementBounds.top + window.scrollY, this.selectedElementBounds.width, this.selectedElementBounds.height);
9101
+ }
9084
9102
  const dataUrl = canvas.toDataURL();
9085
9103
  resolve(dataUrl);
9086
9104
  })
9087
9105
  .catch((error) => {
9088
- console.error(error);
9106
+ console.error('Failed to capture screenshot:', error);
9089
9107
  reject(error);
9090
9108
  });
9091
9109
  });
@@ -9100,6 +9118,10 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9100
9118
  handleRatingChange(newRating) {
9101
9119
  this.selectedRating = newRating;
9102
9120
  }
9121
+ // Remove the preview modal toggle function
9122
+ // togglePreviewModal() {
9123
+ // this.showPreviewModal = !this.showPreviewModal;
9124
+ // }
9103
9125
  render() {
9104
9126
  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
9105
9127
  ? 'feedback-modal-rating-button--selected'
@@ -9116,7 +9138,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9116
9138
  : ''}`, onClick: (event) => {
9117
9139
  event.preventDefault();
9118
9140
  this.handleRatingChange(rating);
9119
- } }, 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 }))), 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 }))))))));
9141
+ } }, 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 }))))))));
9120
9142
  }
9121
9143
  componentDidRender() {
9122
9144
  if (this.showModal) {
@@ -9138,6 +9160,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9138
9160
  "customFont": [4, "custom-font"],
9139
9161
  "emailAddress": [1, "email-address"],
9140
9162
  "hideEmail": [4, "hide-email"],
9163
+ "isEmailRequired": [4, "is-email-required"],
9141
9164
  "ratingMode": [1, "rating-mode"],
9142
9165
  "hasSelectedElement": [1540, "has-selected-element"],
9143
9166
  "hidePrivacyPolicy": [4, "hide-privacy-policy"],
@@ -9148,6 +9171,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9148
9171
  "showScreenshotTopBar": [1540, "show-screenshot-top-bar"],
9149
9172
  "showModal": [1540, "show-modal"],
9150
9173
  "rating": [2],
9174
+ "metadata": [1],
9151
9175
  "fetchData": [4, "fetch-data"],
9152
9176
  "emailPlaceholder": [1, "email-placeholder"],
9153
9177
  "errorMessage": [1, "error-message"],
@@ -9164,6 +9188,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
9164
9188
  "ratingStarsPlaceholder": [1, "rating-stars-placeholder"],
9165
9189
  "sendButtonText": [1, "send-button-text"],
9166
9190
  "screenshotButtonText": [1, "screenshot-button-text"],
9191
+ "screenshotAttachedText": [1, "screenshot-attached-text"],
9167
9192
  "screenshotTopbarText": [1, "screenshot-topbar-text"],
9168
9193
  "successMessage": [1, "success-message"],
9169
9194
  "sending": [32],