pushfeedback 0.1.83 → 0.1.84

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.
@@ -920,8 +920,10 @@ const FeedbackButton = class {
920
920
  this.sessionId = '';
921
921
  this.metadata = '';
922
922
  this.submit = false;
923
+ this.clickOutsideClose = true;
923
924
  this.customFont = false;
924
925
  this.emailAddress = '';
926
+ this.historyClose = true;
925
927
  this.isEmailRequired = false;
926
928
  this.fetchData = true;
927
929
  this.hideEmail = false;
@@ -994,9 +996,11 @@ const FeedbackButton = class {
994
996
  connectedCallback() {
995
997
  this.feedbackModal = document.createElement('feedback-modal');
996
998
  const props = [
999
+ 'clickOutsideClose',
997
1000
  'customFont',
998
1001
  'emailAddress',
999
1002
  'fetchData',
1003
+ 'historyClose',
1000
1004
  'hideEmail',
1001
1005
  'hidePrivacyPolicy',
1002
1006
  'hideRating',
@@ -1135,6 +1139,17 @@ const FeedbackModal = class {
1135
1139
  index.registerInstance(this, hostRef);
1136
1140
  this.feedbackSent = index.createEvent(this, "feedbackSent", 7);
1137
1141
  this.feedbackError = index.createEvent(this, "feedbackError", 7);
1142
+ // Track the history entry pushed while the modal is open
1143
+ this.historyEntryPushed = false;
1144
+ this.handlePopState = () => {
1145
+ // Back button pressed while the modal is open: close it and consume our entry
1146
+ if (this.historyEntryPushed) {
1147
+ this.historyEntryPushed = false;
1148
+ if (this.showModal) {
1149
+ this.close();
1150
+ }
1151
+ }
1152
+ };
1138
1153
  this.onScrollDebounced = () => {
1139
1154
  clearTimeout(this.scrollTimeout);
1140
1155
  this.scrollTimeout = setTimeout(() => {
@@ -1219,14 +1234,22 @@ const FeedbackModal = class {
1219
1234
  }
1220
1235
  };
1221
1236
  this.close = () => {
1237
+ this.doClose(false);
1238
+ };
1239
+ // Closing by clicking outside keeps the typed input, so an accidental
1240
+ // click does not throw away a half-written message or screenshot
1241
+ this.handleOverlayClick = () => {
1242
+ this.doClose(!this.formSuccess);
1243
+ };
1244
+ this.doClose = (preserveInput) => {
1222
1245
  this.isAnimating = false;
1246
+ this.popHistoryEntry();
1223
1247
  setTimeout(() => {
1224
1248
  this.sending = false;
1225
1249
  this.showModal = false;
1226
1250
  this.showScreenshotMode = false;
1227
1251
  this.showScreenshotTopBar = false;
1228
1252
  this.hasSelectedElement = false;
1229
- this.encodedScreenshot = null;
1230
1253
  // Remove highlight from ALL selected elements
1231
1254
  document.querySelectorAll('.feedback-modal-element-selected').forEach((el) => {
1232
1255
  el.classList.remove('feedback-modal-element-selected');
@@ -1235,8 +1258,11 @@ const FeedbackModal = class {
1235
1258
  this.formSuccess = false;
1236
1259
  this.formError = false;
1237
1260
  this.formErrorStatus = 500;
1238
- this.formMessage = '';
1239
- this.formEmail = '';
1261
+ if (!preserveInput) {
1262
+ this.encodedScreenshot = null;
1263
+ this.formMessage = '';
1264
+ this.formEmail = '';
1265
+ }
1240
1266
  this.resetOverflow();
1241
1267
  }, 200);
1242
1268
  };
@@ -1322,6 +1348,8 @@ const FeedbackModal = class {
1322
1348
  this.metadata = undefined;
1323
1349
  this.fetchData = true;
1324
1350
  this.embedded = false;
1351
+ this.clickOutsideClose = true;
1352
+ this.historyClose = true;
1325
1353
  this.emailPlaceholder = 'Email address (optional)';
1326
1354
  this.errorMessage = 'Please try again later.';
1327
1355
  this.errorMessage403 = 'The request URL does not match the one defined in PushFeedback for this project.';
@@ -1356,6 +1384,12 @@ const FeedbackModal = class {
1356
1384
  this.screenshotErrorBrowserNotSupported = 'Your browser does not support screen capture. Please use a browser like Chrome, Firefox, or Safari on desktop.';
1357
1385
  this.screenshotErrorUnexpected = 'An unexpected error occurred. Please try again.';
1358
1386
  }
1387
+ connectedCallback() {
1388
+ window.addEventListener('popstate', this.handlePopState);
1389
+ }
1390
+ disconnectedCallback() {
1391
+ window.removeEventListener('popstate', this.handlePopState);
1392
+ }
1359
1393
  componentWillLoad() {
1360
1394
  if (this.fetchData)
1361
1395
  this.fetchProjectData();
@@ -1446,6 +1480,12 @@ const FeedbackModal = class {
1446
1480
  handleEmailInput(event) {
1447
1481
  this.formEmail = event.target.value;
1448
1482
  }
1483
+ popHistoryEntry() {
1484
+ if (this.historyEntryPushed) {
1485
+ this.historyEntryPushed = false;
1486
+ history.back();
1487
+ }
1488
+ }
1449
1489
  handleCheckboxChange(event) {
1450
1490
  this.isPrivacyChecked = event.target.checked;
1451
1491
  }
@@ -1456,7 +1496,7 @@ const FeedbackModal = class {
1456
1496
  this.selectedRating = newRating;
1457
1497
  }
1458
1498
  render() {
1459
- return (index.h("div", { class: `feedback-modal-wrapper ${this.customFont ? 'feedback-modal-wrapper--custom-font' : ''} ${this.embedded ? 'feedback-modal-wrapper--embedded' : ''}`, part: "wrapper" }, this.showCanvasEditor && (index.h("canvas-editor", { ref: (el) => (this.canvasEditorRef = el), exportparts: "overlay: canvas-editor-overlay, modal: canvas-editor-modal, header: canvas-editor-header, title: canvas-editor-title, toolbar: canvas-editor-toolbar, tool-button: canvas-editor-tool-button, cancel-button: canvas-editor-cancel-button, save-button: canvas-editor-save-button, content: canvas-editor-content, canvas: canvas-editor-canvas", "canvas-editor-title": this.screenshotEditorTitle, "canvas-editor-cancel-text": this.screenshotEditorCancelText, "canvas-editor-save-text": this.screenshotEditorSaveText, "screenshot-taking-text": this.screenshotTakingText, "screenshot-attached-text": this.screenshotAttachedText, "screenshot-button-text": this.screenshotButtonText, "auto-start-screenshot": this.autoStartCapture, "existing-screenshot": this.encodedScreenshot || '', "edit-text-button-text": this.screenshotEditTextButtonText, "size-label-text": this.screenshotSizeLabelText, "border-label-text": this.screenshotBorderLabelText, "edit-text-prompt-text": this.screenshotEditTextPromptText, "screenshot-error-general": this.screenshotErrorGeneral, "screenshot-error-permission": this.screenshotErrorPermission, "screenshot-error-not-supported": this.screenshotErrorNotSupported, "screenshot-error-not-found": this.screenshotErrorNotFound, "screenshot-error-cancelled": this.screenshotErrorCancelled, "screenshot-error-browser-not-supported": this.screenshotErrorBrowserNotSupported, "screenshot-error-unexpected": this.screenshotErrorUnexpected, onScreenshotReady: this.handleScreenshotReady, onScreenshotCancelled: this.handleScreenshotCancelled, onScreenshotFailed: this.handleScreenshotError })), this.showScreenshotError && (index.h("div", { class: "screenshot-error-notification" }, index.h("div", { class: "screenshot-error-content" }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("circle", { cx: "12", cy: "12", r: "10" }), index.h("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), index.h("line", { x1: "9", y1: "9", x2: "15", y2: "15" })), index.h("span", null, this.screenshotError), index.h("button", { class: "error-close-btn", onClick: () => (this.showScreenshotError = false), title: "Close" }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), index.h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))))), this.showModal && !this.embedded && (index.h("div", { class: `feedback-overlay ${this.isAnimating ? 'feedback-overlay--visible' : ''}`, part: "overlay" })), this.showModal && (index.h("div", { class: `feedback-modal-content feedback-modal-content--${this.modalPosition} ${this.isAnimating ? 'feedback-modal-content--open' : ''} ${this.embedded ? 'feedback-modal-content--embedded' : ''}`, part: "modal", ref: (el) => (this.modalContent = el) }, index.h("div", { class: `feedback-modal-header ${(this.formSuccess && !this.successMessage) || (this.formError && !this.errorMessage)
1499
+ return (index.h("div", { class: `feedback-modal-wrapper ${this.customFont ? 'feedback-modal-wrapper--custom-font' : ''} ${this.embedded ? 'feedback-modal-wrapper--embedded' : ''}`, part: "wrapper" }, this.showCanvasEditor && (index.h("canvas-editor", { ref: (el) => (this.canvasEditorRef = el), exportparts: "overlay: canvas-editor-overlay, modal: canvas-editor-modal, header: canvas-editor-header, title: canvas-editor-title, toolbar: canvas-editor-toolbar, tool-button: canvas-editor-tool-button, cancel-button: canvas-editor-cancel-button, save-button: canvas-editor-save-button, content: canvas-editor-content, canvas: canvas-editor-canvas", "canvas-editor-title": this.screenshotEditorTitle, "canvas-editor-cancel-text": this.screenshotEditorCancelText, "canvas-editor-save-text": this.screenshotEditorSaveText, "screenshot-taking-text": this.screenshotTakingText, "screenshot-attached-text": this.screenshotAttachedText, "screenshot-button-text": this.screenshotButtonText, "auto-start-screenshot": this.autoStartCapture, "existing-screenshot": this.encodedScreenshot || '', "edit-text-button-text": this.screenshotEditTextButtonText, "size-label-text": this.screenshotSizeLabelText, "border-label-text": this.screenshotBorderLabelText, "edit-text-prompt-text": this.screenshotEditTextPromptText, "screenshot-error-general": this.screenshotErrorGeneral, "screenshot-error-permission": this.screenshotErrorPermission, "screenshot-error-not-supported": this.screenshotErrorNotSupported, "screenshot-error-not-found": this.screenshotErrorNotFound, "screenshot-error-cancelled": this.screenshotErrorCancelled, "screenshot-error-browser-not-supported": this.screenshotErrorBrowserNotSupported, "screenshot-error-unexpected": this.screenshotErrorUnexpected, onScreenshotReady: this.handleScreenshotReady, onScreenshotCancelled: this.handleScreenshotCancelled, onScreenshotFailed: this.handleScreenshotError })), this.showScreenshotError && (index.h("div", { class: "screenshot-error-notification" }, index.h("div", { class: "screenshot-error-content" }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("circle", { cx: "12", cy: "12", r: "10" }), index.h("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), index.h("line", { x1: "9", y1: "9", x2: "15", y2: "15" })), index.h("span", null, this.screenshotError), index.h("button", { class: "error-close-btn", onClick: () => (this.showScreenshotError = false), title: "Close" }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), index.h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))))), this.showModal && !this.embedded && (index.h("div", { class: `feedback-overlay ${this.isAnimating ? 'feedback-overlay--visible' : ''}`, part: "overlay", onClick: this.clickOutsideClose ? this.handleOverlayClick : undefined })), this.showModal && (index.h("div", { class: `feedback-modal-content feedback-modal-content--${this.modalPosition} ${this.isAnimating ? 'feedback-modal-content--open' : ''} ${this.embedded ? 'feedback-modal-content--embedded' : ''}`, part: "modal", ref: (el) => (this.modalContent = el) }, index.h("div", { class: `feedback-modal-header ${(this.formSuccess && !this.successMessage) || (this.formError && !this.errorMessage)
1460
1500
  ? 'feedback-modal-header--no-content'
1461
1501
  : ''}`, part: "header" }, index.h("div", { class: "feedback-modal-header-content" }, !this.formSuccess && !this.formError ? (index.h("div", { class: "feedback-modal-header-text" }, index.h("span", { class: "feedback-modal-title", part: "title" }, this.modalTitle), !this.whitelabel && (index.h("span", { class: "feedback-modal-powered-by", part: "powered-by" }, "Powered by", ' ', index.h("a", { target: "_blank", href: "https://pushfeedback.com" }, "PushFeedback"))))) : this.formSuccess ? (index.h("span", { class: "feedback-modal-title", part: "title" }, this.modalTitleSuccess)) : (index.h("span", { class: "feedback-modal-title", part: "title" }, this.modalTitleError))), !this.embedded && (index.h("button", { class: "feedback-modal-close", part: "close-button", onClick: this.close }, index.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" }, index.h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), index.h("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))))), index.h("div", { class: "feedback-modal-body", part: "body" }, !this.formSuccess && !this.formError ? (index.h("form", { part: "form", onSubmit: this.handleSubmit }, !this.hideRating && (index.h("div", { class: "feedback-modal-rating", part: "rating" }, this.ratingMode === 'thumbs' ? (index.h("div", { class: "feedback-modal-rating-content" }, index.h("span", { class: "feedback-modal-input-heading", part: "rating-title" }, this.ratingPlaceholder), index.h("div", { class: "feedback-modal-rating-buttons feedback-modal-rating-buttons--thumbs", part: "rating-buttons" }, index.h("button", { title: "Yes", class: `feedback-modal-rating-button feedback-modal-rating-button--positive ${this.selectedRating === 1
1462
1502
  ? 'feedback-modal-rating-button--selected'
@@ -1488,6 +1528,10 @@ const FeedbackModal = class {
1488
1528
  }
1489
1529
  async openModal() {
1490
1530
  this.showModal = true;
1531
+ if (this.historyClose && !this.embedded && !this.historyEntryPushed) {
1532
+ history.pushState({ feedbackModal: true }, '');
1533
+ this.historyEntryPushed = true;
1534
+ }
1491
1535
  requestAnimationFrame(() => {
1492
1536
  requestAnimationFrame(() => {
1493
1537
  this.isAnimating = true;
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["canvas-editor_3.cjs",[[1,"feedback-button",{"buttonPosition":[1,"button-position"],"buttonStyle":[1,"button-style"],"hideIcon":[4,"hide-icon"],"hideMobile":[4,"hide-mobile"],"sessionId":[1537,"session-id"],"metadata":[1],"submit":[4],"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"isEmailRequired":[4,"is-email-required"],"fetchData":[4,"fetch-data"],"hideEmail":[4,"hide-email"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"modalPosition":[1,"modal-position"],"project":[1],"rating":[2],"ratingMode":[1,"rating-mode"],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"footerText":[1,"footer-text"],"messagePlaceholder":[1,"message-placeholder"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"]}],[1,"feedback-modal",{"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"hideEmail":[4,"hide-email"],"isEmailRequired":[4,"is-email-required"],"ratingMode":[1,"rating-mode"],"hasSelectedElement":[1540,"has-selected-element"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"project":[1],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"showModal":[1540,"show-modal"],"rating":[2],"metadata":[1],"fetchData":[4,"fetch-data"],"embedded":[4],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"messagePlaceholder":[1,"message-placeholder"],"footerText":[1,"footer-text"],"modalPosition":[1,"modal-position"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32],"overlayVisible":[32],"isAnimating":[32],"recaptchaEnabled":[32],"recaptchaSiteKey":[32],"takingScreenshot":[32],"showScreenshotError":[32],"screenshotError":[32],"showCanvasEditor":[32],"autoStartCapture":[32],"openModal":[64]}],[1,"canvas-editor",{"canvasEditorTitle":[1,"canvas-editor-title"],"canvasEditorCancelText":[1,"canvas-editor-cancel-text"],"canvasEditorSaveText":[1,"canvas-editor-save-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"autoStartScreenshot":[4,"auto-start-screenshot"],"existingScreenshot":[1,"existing-screenshot"],"editTextButtonText":[1,"edit-text-button-text"],"sizeLabelText":[1,"size-label-text"],"borderLabelText":[1,"border-label-text"],"editTextPromptText":[1,"edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"takingScreenshot":[32],"showCanvasEditor":[32],"canvasDrawingTool":[32],"canvasDrawingColor":[32],"canvasLineWidth":[32],"canvasTextSize":[32],"isDrawing":[32],"annotations":[32],"currentAnnotation":[32],"isDragging":[32],"draggedAnnotation":[32],"dragStartPos":[32],"showColorPicker":[32],"editingColorIndex":[32],"selectedAnnotation":[32],"isResizing":[32],"resizingAnnotation":[32],"resizeStartSize":[32],"resizeStartDimensions":[32],"hoveredAnnotation":[32],"resizeHandle":[32],"defaultColors":[32]}]]]], options);
17
+ return index.bootstrapLazy([["canvas-editor_3.cjs",[[1,"feedback-button",{"buttonPosition":[1,"button-position"],"buttonStyle":[1,"button-style"],"hideIcon":[4,"hide-icon"],"hideMobile":[4,"hide-mobile"],"sessionId":[1537,"session-id"],"metadata":[1],"submit":[4],"clickOutsideClose":[4,"click-outside-close"],"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"historyClose":[4,"history-close"],"isEmailRequired":[4,"is-email-required"],"fetchData":[4,"fetch-data"],"hideEmail":[4,"hide-email"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"modalPosition":[1,"modal-position"],"project":[1],"rating":[2],"ratingMode":[1,"rating-mode"],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"footerText":[1,"footer-text"],"messagePlaceholder":[1,"message-placeholder"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"]}],[1,"feedback-modal",{"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"hideEmail":[4,"hide-email"],"isEmailRequired":[4,"is-email-required"],"ratingMode":[1,"rating-mode"],"hasSelectedElement":[1540,"has-selected-element"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"project":[1],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"showModal":[1540,"show-modal"],"rating":[2],"metadata":[1],"fetchData":[4,"fetch-data"],"embedded":[4],"clickOutsideClose":[4,"click-outside-close"],"historyClose":[4,"history-close"],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"messagePlaceholder":[1,"message-placeholder"],"footerText":[1,"footer-text"],"modalPosition":[1,"modal-position"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32],"overlayVisible":[32],"isAnimating":[32],"recaptchaEnabled":[32],"recaptchaSiteKey":[32],"takingScreenshot":[32],"showScreenshotError":[32],"screenshotError":[32],"showCanvasEditor":[32],"autoStartCapture":[32],"openModal":[64]}],[1,"canvas-editor",{"canvasEditorTitle":[1,"canvas-editor-title"],"canvasEditorCancelText":[1,"canvas-editor-cancel-text"],"canvasEditorSaveText":[1,"canvas-editor-save-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"autoStartScreenshot":[4,"auto-start-screenshot"],"existingScreenshot":[1,"existing-screenshot"],"editTextButtonText":[1,"edit-text-button-text"],"sizeLabelText":[1,"size-label-text"],"borderLabelText":[1,"border-label-text"],"editTextPromptText":[1,"edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"takingScreenshot":[32],"showCanvasEditor":[32],"canvasDrawingTool":[32],"canvasDrawingColor":[32],"canvasLineWidth":[32],"canvasTextSize":[32],"isDrawing":[32],"annotations":[32],"currentAnnotation":[32],"isDragging":[32],"draggedAnnotation":[32],"dragStartPos":[32],"showColorPicker":[32],"editingColorIndex":[32],"selectedAnnotation":[32],"isResizing":[32],"resizingAnnotation":[32],"resizeStartSize":[32],"resizeStartDimensions":[32],"hoveredAnnotation":[32],"resizeHandle":[32],"defaultColors":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["canvas-editor_3.cjs",[[1,"feedback-button",{"buttonPosition":[1,"button-position"],"buttonStyle":[1,"button-style"],"hideIcon":[4,"hide-icon"],"hideMobile":[4,"hide-mobile"],"sessionId":[1537,"session-id"],"metadata":[1],"submit":[4],"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"isEmailRequired":[4,"is-email-required"],"fetchData":[4,"fetch-data"],"hideEmail":[4,"hide-email"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"modalPosition":[1,"modal-position"],"project":[1],"rating":[2],"ratingMode":[1,"rating-mode"],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"footerText":[1,"footer-text"],"messagePlaceholder":[1,"message-placeholder"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"]}],[1,"feedback-modal",{"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"hideEmail":[4,"hide-email"],"isEmailRequired":[4,"is-email-required"],"ratingMode":[1,"rating-mode"],"hasSelectedElement":[1540,"has-selected-element"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"project":[1],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"showModal":[1540,"show-modal"],"rating":[2],"metadata":[1],"fetchData":[4,"fetch-data"],"embedded":[4],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"messagePlaceholder":[1,"message-placeholder"],"footerText":[1,"footer-text"],"modalPosition":[1,"modal-position"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32],"overlayVisible":[32],"isAnimating":[32],"recaptchaEnabled":[32],"recaptchaSiteKey":[32],"takingScreenshot":[32],"showScreenshotError":[32],"screenshotError":[32],"showCanvasEditor":[32],"autoStartCapture":[32],"openModal":[64]}],[1,"canvas-editor",{"canvasEditorTitle":[1,"canvas-editor-title"],"canvasEditorCancelText":[1,"canvas-editor-cancel-text"],"canvasEditorSaveText":[1,"canvas-editor-save-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"autoStartScreenshot":[4,"auto-start-screenshot"],"existingScreenshot":[1,"existing-screenshot"],"editTextButtonText":[1,"edit-text-button-text"],"sizeLabelText":[1,"size-label-text"],"borderLabelText":[1,"border-label-text"],"editTextPromptText":[1,"edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"takingScreenshot":[32],"showCanvasEditor":[32],"canvasDrawingTool":[32],"canvasDrawingColor":[32],"canvasLineWidth":[32],"canvasTextSize":[32],"isDrawing":[32],"annotations":[32],"currentAnnotation":[32],"isDragging":[32],"draggedAnnotation":[32],"dragStartPos":[32],"showColorPicker":[32],"editingColorIndex":[32],"selectedAnnotation":[32],"isResizing":[32],"resizingAnnotation":[32],"resizeStartSize":[32],"resizeStartDimensions":[32],"hoveredAnnotation":[32],"resizeHandle":[32],"defaultColors":[32]}]]]], options);
20
+ return index.bootstrapLazy([["canvas-editor_3.cjs",[[1,"feedback-button",{"buttonPosition":[1,"button-position"],"buttonStyle":[1,"button-style"],"hideIcon":[4,"hide-icon"],"hideMobile":[4,"hide-mobile"],"sessionId":[1537,"session-id"],"metadata":[1],"submit":[4],"clickOutsideClose":[4,"click-outside-close"],"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"historyClose":[4,"history-close"],"isEmailRequired":[4,"is-email-required"],"fetchData":[4,"fetch-data"],"hideEmail":[4,"hide-email"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"modalPosition":[1,"modal-position"],"project":[1],"rating":[2],"ratingMode":[1,"rating-mode"],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"footerText":[1,"footer-text"],"messagePlaceholder":[1,"message-placeholder"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"]}],[1,"feedback-modal",{"customFont":[4,"custom-font"],"emailAddress":[1,"email-address"],"hideEmail":[4,"hide-email"],"isEmailRequired":[4,"is-email-required"],"ratingMode":[1,"rating-mode"],"hasSelectedElement":[1540,"has-selected-element"],"hidePrivacyPolicy":[4,"hide-privacy-policy"],"hideRating":[4,"hide-rating"],"hideScreenshotButton":[4,"hide-screenshot-button"],"project":[1],"showScreenshotMode":[1540,"show-screenshot-mode"],"showScreenshotTopBar":[1540,"show-screenshot-top-bar"],"showModal":[1540,"show-modal"],"rating":[2],"metadata":[1],"fetchData":[4,"fetch-data"],"embedded":[4],"clickOutsideClose":[4,"click-outside-close"],"historyClose":[4,"history-close"],"emailPlaceholder":[1,"email-placeholder"],"errorMessage":[1,"error-message"],"errorMessage403":[1,"error-message-4-0-3"],"errorMessage404":[1,"error-message-4-0-4"],"messagePlaceholder":[1,"message-placeholder"],"footerText":[1,"footer-text"],"modalPosition":[1,"modal-position"],"modalTitle":[1,"modal-title"],"modalTitleError":[1,"modal-title-error"],"modalTitleSuccess":[1,"modal-title-success"],"privacyPolicyText":[1,"privacy-policy-text"],"ratingPlaceholder":[1,"rating-placeholder"],"ratingStarsPlaceholder":[1,"rating-stars-placeholder"],"sendButtonText":[1,"send-button-text"],"successMessage":[1,"success-message"],"recaptchaText":[1,"recaptcha-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotEditTextButtonText":[1,"screenshot-edit-text-button-text"],"screenshotEditorTitle":[1,"screenshot-editor-title"],"screenshotEditorCancelText":[1,"screenshot-editor-cancel-text"],"screenshotEditorSaveText":[1,"screenshot-editor-save-text"],"screenshotSizeLabelText":[1,"screenshot-size-label-text"],"screenshotBorderLabelText":[1,"screenshot-border-label-text"],"screenshotEditTextPromptText":[1,"screenshot-edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"sending":[32],"formMessage":[32],"formEmail":[32],"formSuccess":[32],"formVerification":[32],"formError":[32],"formErrorStatus":[32],"encodedScreenshot":[32],"isPrivacyChecked":[32],"whitelabel":[32],"selectedRating":[32],"overlayVisible":[32],"isAnimating":[32],"recaptchaEnabled":[32],"recaptchaSiteKey":[32],"takingScreenshot":[32],"showScreenshotError":[32],"screenshotError":[32],"showCanvasEditor":[32],"autoStartCapture":[32],"openModal":[64]}],[1,"canvas-editor",{"canvasEditorTitle":[1,"canvas-editor-title"],"canvasEditorCancelText":[1,"canvas-editor-cancel-text"],"canvasEditorSaveText":[1,"canvas-editor-save-text"],"screenshotTakingText":[1,"screenshot-taking-text"],"screenshotAttachedText":[1,"screenshot-attached-text"],"screenshotButtonText":[1,"screenshot-button-text"],"autoStartScreenshot":[4,"auto-start-screenshot"],"existingScreenshot":[1,"existing-screenshot"],"editTextButtonText":[1,"edit-text-button-text"],"sizeLabelText":[1,"size-label-text"],"borderLabelText":[1,"border-label-text"],"editTextPromptText":[1,"edit-text-prompt-text"],"screenshotErrorGeneral":[1,"screenshot-error-general"],"screenshotErrorPermission":[1,"screenshot-error-permission"],"screenshotErrorNotSupported":[1,"screenshot-error-not-supported"],"screenshotErrorNotFound":[1,"screenshot-error-not-found"],"screenshotErrorCancelled":[1,"screenshot-error-cancelled"],"screenshotErrorBrowserNotSupported":[1,"screenshot-error-browser-not-supported"],"screenshotErrorUnexpected":[1,"screenshot-error-unexpected"],"takingScreenshot":[32],"showCanvasEditor":[32],"canvasDrawingTool":[32],"canvasDrawingColor":[32],"canvasLineWidth":[32],"canvasTextSize":[32],"isDrawing":[32],"annotations":[32],"currentAnnotation":[32],"isDragging":[32],"draggedAnnotation":[32],"dragStartPos":[32],"showColorPicker":[32],"editingColorIndex":[32],"selectedAnnotation":[32],"isResizing":[32],"resizingAnnotation":[32],"resizeStartSize":[32],"resizeStartDimensions":[32],"hoveredAnnotation":[32],"resizeHandle":[32],"defaultColors":[32]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -8,8 +8,10 @@ export class FeedbackButton {
8
8
  this.sessionId = '';
9
9
  this.metadata = '';
10
10
  this.submit = false;
11
+ this.clickOutsideClose = true;
11
12
  this.customFont = false;
12
13
  this.emailAddress = '';
14
+ this.historyClose = true;
13
15
  this.isEmailRequired = false;
14
16
  this.fetchData = true;
15
17
  this.hideEmail = false;
@@ -82,9 +84,11 @@ export class FeedbackButton {
82
84
  connectedCallback() {
83
85
  this.feedbackModal = document.createElement('feedback-modal');
84
86
  const props = [
87
+ 'clickOutsideClose',
85
88
  'customFont',
86
89
  'emailAddress',
87
90
  'fetchData',
91
+ 'historyClose',
88
92
  'hideEmail',
89
93
  'hidePrivacyPolicy',
90
94
  'hideRating',
@@ -352,6 +356,24 @@ export class FeedbackButton {
352
356
  "reflect": false,
353
357
  "defaultValue": "false"
354
358
  },
359
+ "clickOutsideClose": {
360
+ "type": "boolean",
361
+ "mutable": false,
362
+ "complexType": {
363
+ "original": "boolean",
364
+ "resolved": "boolean",
365
+ "references": {}
366
+ },
367
+ "required": false,
368
+ "optional": false,
369
+ "docs": {
370
+ "tags": [],
371
+ "text": ""
372
+ },
373
+ "attribute": "click-outside-close",
374
+ "reflect": false,
375
+ "defaultValue": "true"
376
+ },
355
377
  "customFont": {
356
378
  "type": "boolean",
357
379
  "mutable": false,
@@ -388,6 +410,24 @@ export class FeedbackButton {
388
410
  "reflect": false,
389
411
  "defaultValue": "''"
390
412
  },
413
+ "historyClose": {
414
+ "type": "boolean",
415
+ "mutable": false,
416
+ "complexType": {
417
+ "original": "boolean",
418
+ "resolved": "boolean",
419
+ "references": {}
420
+ },
421
+ "required": false,
422
+ "optional": false,
423
+ "docs": {
424
+ "tags": [],
425
+ "text": ""
426
+ },
427
+ "attribute": "history-close",
428
+ "reflect": false,
429
+ "defaultValue": "true"
430
+ },
391
431
  "isEmailRequired": {
392
432
  "type": "boolean",
393
433
  "mutable": false,
@@ -1,6 +1,17 @@
1
1
  import { h } from '@stencil/core';
2
2
  export class FeedbackModal {
3
3
  constructor() {
4
+ // Track the history entry pushed while the modal is open
5
+ this.historyEntryPushed = false;
6
+ this.handlePopState = () => {
7
+ // Back button pressed while the modal is open: close it and consume our entry
8
+ if (this.historyEntryPushed) {
9
+ this.historyEntryPushed = false;
10
+ if (this.showModal) {
11
+ this.close();
12
+ }
13
+ }
14
+ };
4
15
  this.onScrollDebounced = () => {
5
16
  clearTimeout(this.scrollTimeout);
6
17
  this.scrollTimeout = setTimeout(() => {
@@ -85,14 +96,22 @@ export class FeedbackModal {
85
96
  }
86
97
  };
87
98
  this.close = () => {
99
+ this.doClose(false);
100
+ };
101
+ // Closing by clicking outside keeps the typed input, so an accidental
102
+ // click does not throw away a half-written message or screenshot
103
+ this.handleOverlayClick = () => {
104
+ this.doClose(!this.formSuccess);
105
+ };
106
+ this.doClose = (preserveInput) => {
88
107
  this.isAnimating = false;
108
+ this.popHistoryEntry();
89
109
  setTimeout(() => {
90
110
  this.sending = false;
91
111
  this.showModal = false;
92
112
  this.showScreenshotMode = false;
93
113
  this.showScreenshotTopBar = false;
94
114
  this.hasSelectedElement = false;
95
- this.encodedScreenshot = null;
96
115
  // Remove highlight from ALL selected elements
97
116
  document.querySelectorAll('.feedback-modal-element-selected').forEach((el) => {
98
117
  el.classList.remove('feedback-modal-element-selected');
@@ -101,8 +120,11 @@ export class FeedbackModal {
101
120
  this.formSuccess = false;
102
121
  this.formError = false;
103
122
  this.formErrorStatus = 500;
104
- this.formMessage = '';
105
- this.formEmail = '';
123
+ if (!preserveInput) {
124
+ this.encodedScreenshot = null;
125
+ this.formMessage = '';
126
+ this.formEmail = '';
127
+ }
106
128
  this.resetOverflow();
107
129
  }, 200);
108
130
  };
@@ -188,6 +210,8 @@ export class FeedbackModal {
188
210
  this.metadata = undefined;
189
211
  this.fetchData = true;
190
212
  this.embedded = false;
213
+ this.clickOutsideClose = true;
214
+ this.historyClose = true;
191
215
  this.emailPlaceholder = 'Email address (optional)';
192
216
  this.errorMessage = 'Please try again later.';
193
217
  this.errorMessage403 = 'The request URL does not match the one defined in PushFeedback for this project.';
@@ -222,6 +246,12 @@ export class FeedbackModal {
222
246
  this.screenshotErrorBrowserNotSupported = 'Your browser does not support screen capture. Please use a browser like Chrome, Firefox, or Safari on desktop.';
223
247
  this.screenshotErrorUnexpected = 'An unexpected error occurred. Please try again.';
224
248
  }
249
+ connectedCallback() {
250
+ window.addEventListener('popstate', this.handlePopState);
251
+ }
252
+ disconnectedCallback() {
253
+ window.removeEventListener('popstate', this.handlePopState);
254
+ }
225
255
  componentWillLoad() {
226
256
  if (this.fetchData)
227
257
  this.fetchProjectData();
@@ -312,6 +342,12 @@ export class FeedbackModal {
312
342
  handleEmailInput(event) {
313
343
  this.formEmail = event.target.value;
314
344
  }
345
+ popHistoryEntry() {
346
+ if (this.historyEntryPushed) {
347
+ this.historyEntryPushed = false;
348
+ history.back();
349
+ }
350
+ }
315
351
  handleCheckboxChange(event) {
316
352
  this.isPrivacyChecked = event.target.checked;
317
353
  }
@@ -322,7 +358,7 @@ export class FeedbackModal {
322
358
  this.selectedRating = newRating;
323
359
  }
324
360
  render() {
325
- return (h("div", { class: `feedback-modal-wrapper ${this.customFont ? 'feedback-modal-wrapper--custom-font' : ''} ${this.embedded ? 'feedback-modal-wrapper--embedded' : ''}`, part: "wrapper" }, this.showCanvasEditor && (h("canvas-editor", { ref: (el) => (this.canvasEditorRef = el), exportparts: "overlay: canvas-editor-overlay, modal: canvas-editor-modal, header: canvas-editor-header, title: canvas-editor-title, toolbar: canvas-editor-toolbar, tool-button: canvas-editor-tool-button, cancel-button: canvas-editor-cancel-button, save-button: canvas-editor-save-button, content: canvas-editor-content, canvas: canvas-editor-canvas", "canvas-editor-title": this.screenshotEditorTitle, "canvas-editor-cancel-text": this.screenshotEditorCancelText, "canvas-editor-save-text": this.screenshotEditorSaveText, "screenshot-taking-text": this.screenshotTakingText, "screenshot-attached-text": this.screenshotAttachedText, "screenshot-button-text": this.screenshotButtonText, "auto-start-screenshot": this.autoStartCapture, "existing-screenshot": this.encodedScreenshot || '', "edit-text-button-text": this.screenshotEditTextButtonText, "size-label-text": this.screenshotSizeLabelText, "border-label-text": this.screenshotBorderLabelText, "edit-text-prompt-text": this.screenshotEditTextPromptText, "screenshot-error-general": this.screenshotErrorGeneral, "screenshot-error-permission": this.screenshotErrorPermission, "screenshot-error-not-supported": this.screenshotErrorNotSupported, "screenshot-error-not-found": this.screenshotErrorNotFound, "screenshot-error-cancelled": this.screenshotErrorCancelled, "screenshot-error-browser-not-supported": this.screenshotErrorBrowserNotSupported, "screenshot-error-unexpected": this.screenshotErrorUnexpected, onScreenshotReady: this.handleScreenshotReady, onScreenshotCancelled: this.handleScreenshotCancelled, onScreenshotFailed: this.handleScreenshotError })), this.showScreenshotError && (h("div", { class: "screenshot-error-notification" }, h("div", { class: "screenshot-error-content" }, h("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("circle", { cx: "12", cy: "12", r: "10" }), h("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), h("line", { x1: "9", y1: "9", x2: "15", y2: "15" })), h("span", null, this.screenshotError), h("button", { class: "error-close-btn", onClick: () => (this.showScreenshotError = false), title: "Close" }, h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))))), this.showModal && !this.embedded && (h("div", { class: `feedback-overlay ${this.isAnimating ? 'feedback-overlay--visible' : ''}`, part: "overlay" })), this.showModal && (h("div", { class: `feedback-modal-content feedback-modal-content--${this.modalPosition} ${this.isAnimating ? 'feedback-modal-content--open' : ''} ${this.embedded ? 'feedback-modal-content--embedded' : ''}`, part: "modal", ref: (el) => (this.modalContent = el) }, h("div", { class: `feedback-modal-header ${(this.formSuccess && !this.successMessage) || (this.formError && !this.errorMessage)
361
+ return (h("div", { class: `feedback-modal-wrapper ${this.customFont ? 'feedback-modal-wrapper--custom-font' : ''} ${this.embedded ? 'feedback-modal-wrapper--embedded' : ''}`, part: "wrapper" }, this.showCanvasEditor && (h("canvas-editor", { ref: (el) => (this.canvasEditorRef = el), exportparts: "overlay: canvas-editor-overlay, modal: canvas-editor-modal, header: canvas-editor-header, title: canvas-editor-title, toolbar: canvas-editor-toolbar, tool-button: canvas-editor-tool-button, cancel-button: canvas-editor-cancel-button, save-button: canvas-editor-save-button, content: canvas-editor-content, canvas: canvas-editor-canvas", "canvas-editor-title": this.screenshotEditorTitle, "canvas-editor-cancel-text": this.screenshotEditorCancelText, "canvas-editor-save-text": this.screenshotEditorSaveText, "screenshot-taking-text": this.screenshotTakingText, "screenshot-attached-text": this.screenshotAttachedText, "screenshot-button-text": this.screenshotButtonText, "auto-start-screenshot": this.autoStartCapture, "existing-screenshot": this.encodedScreenshot || '', "edit-text-button-text": this.screenshotEditTextButtonText, "size-label-text": this.screenshotSizeLabelText, "border-label-text": this.screenshotBorderLabelText, "edit-text-prompt-text": this.screenshotEditTextPromptText, "screenshot-error-general": this.screenshotErrorGeneral, "screenshot-error-permission": this.screenshotErrorPermission, "screenshot-error-not-supported": this.screenshotErrorNotSupported, "screenshot-error-not-found": this.screenshotErrorNotFound, "screenshot-error-cancelled": this.screenshotErrorCancelled, "screenshot-error-browser-not-supported": this.screenshotErrorBrowserNotSupported, "screenshot-error-unexpected": this.screenshotErrorUnexpected, onScreenshotReady: this.handleScreenshotReady, onScreenshotCancelled: this.handleScreenshotCancelled, onScreenshotFailed: this.handleScreenshotError })), this.showScreenshotError && (h("div", { class: "screenshot-error-notification" }, h("div", { class: "screenshot-error-content" }, h("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("circle", { cx: "12", cy: "12", r: "10" }), h("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), h("line", { x1: "9", y1: "9", x2: "15", y2: "15" })), h("span", null, this.screenshotError), h("button", { class: "error-close-btn", onClick: () => (this.showScreenshotError = false), title: "Close" }, h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))))), this.showModal && !this.embedded && (h("div", { class: `feedback-overlay ${this.isAnimating ? 'feedback-overlay--visible' : ''}`, part: "overlay", onClick: this.clickOutsideClose ? this.handleOverlayClick : undefined })), this.showModal && (h("div", { class: `feedback-modal-content feedback-modal-content--${this.modalPosition} ${this.isAnimating ? 'feedback-modal-content--open' : ''} ${this.embedded ? 'feedback-modal-content--embedded' : ''}`, part: "modal", ref: (el) => (this.modalContent = el) }, h("div", { class: `feedback-modal-header ${(this.formSuccess && !this.successMessage) || (this.formError && !this.errorMessage)
326
362
  ? 'feedback-modal-header--no-content'
327
363
  : ''}`, part: "header" }, h("div", { class: "feedback-modal-header-content" }, !this.formSuccess && !this.formError ? (h("div", { class: "feedback-modal-header-text" }, h("span", { class: "feedback-modal-title", part: "title" }, this.modalTitle), !this.whitelabel && (h("span", { class: "feedback-modal-powered-by", part: "powered-by" }, "Powered by", ' ', h("a", { target: "_blank", href: "https://pushfeedback.com" }, "PushFeedback"))))) : this.formSuccess ? (h("span", { class: "feedback-modal-title", part: "title" }, this.modalTitleSuccess)) : (h("span", { class: "feedback-modal-title", part: "title" }, this.modalTitleError))), !this.embedded && (h("button", { class: "feedback-modal-close", part: "close-button", 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", part: "body" }, !this.formSuccess && !this.formError ? (h("form", { part: "form", onSubmit: this.handleSubmit }, !this.hideRating && (h("div", { class: "feedback-modal-rating", part: "rating" }, this.ratingMode === 'thumbs' ? (h("div", { class: "feedback-modal-rating-content" }, h("span", { class: "feedback-modal-input-heading", part: "rating-title" }, this.ratingPlaceholder), h("div", { class: "feedback-modal-rating-buttons feedback-modal-rating-buttons--thumbs", part: "rating-buttons" }, h("button", { title: "Yes", class: `feedback-modal-rating-button feedback-modal-rating-button--positive ${this.selectedRating === 1
328
364
  ? 'feedback-modal-rating-button--selected'
@@ -354,6 +390,10 @@ export class FeedbackModal {
354
390
  }
355
391
  async openModal() {
356
392
  this.showModal = true;
393
+ if (this.historyClose && !this.embedded && !this.historyEntryPushed) {
394
+ history.pushState({ feedbackModal: true }, '');
395
+ this.historyEntryPushed = true;
396
+ }
357
397
  requestAnimationFrame(() => {
358
398
  requestAnimationFrame(() => {
359
399
  this.isAnimating = true;
@@ -678,6 +718,42 @@ export class FeedbackModal {
678
718
  "reflect": false,
679
719
  "defaultValue": "false"
680
720
  },
721
+ "clickOutsideClose": {
722
+ "type": "boolean",
723
+ "mutable": false,
724
+ "complexType": {
725
+ "original": "boolean",
726
+ "resolved": "boolean",
727
+ "references": {}
728
+ },
729
+ "required": false,
730
+ "optional": false,
731
+ "docs": {
732
+ "tags": [],
733
+ "text": ""
734
+ },
735
+ "attribute": "click-outside-close",
736
+ "reflect": false,
737
+ "defaultValue": "true"
738
+ },
739
+ "historyClose": {
740
+ "type": "boolean",
741
+ "mutable": false,
742
+ "complexType": {
743
+ "original": "boolean",
744
+ "resolved": "boolean",
745
+ "references": {}
746
+ },
747
+ "required": false,
748
+ "optional": false,
749
+ "docs": {
750
+ "tags": [],
751
+ "text": ""
752
+ },
753
+ "attribute": "history-close",
754
+ "reflect": false,
755
+ "defaultValue": "true"
756
+ },
681
757
  "emailPlaceholder": {
682
758
  "type": "string",
683
759
  "mutable": false,
@@ -18,8 +18,10 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
18
18
  this.sessionId = '';
19
19
  this.metadata = '';
20
20
  this.submit = false;
21
+ this.clickOutsideClose = true;
21
22
  this.customFont = false;
22
23
  this.emailAddress = '';
24
+ this.historyClose = true;
23
25
  this.isEmailRequired = false;
24
26
  this.fetchData = true;
25
27
  this.hideEmail = false;
@@ -92,9 +94,11 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
92
94
  connectedCallback() {
93
95
  this.feedbackModal = document.createElement('feedback-modal');
94
96
  const props = [
97
+ 'clickOutsideClose',
95
98
  'customFont',
96
99
  'emailAddress',
97
100
  'fetchData',
101
+ 'historyClose',
98
102
  'hideEmail',
99
103
  'hidePrivacyPolicy',
100
104
  'hideRating',
@@ -232,8 +236,10 @@ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
232
236
  "sessionId": [1537, "session-id"],
233
237
  "metadata": [1],
234
238
  "submit": [4],
239
+ "clickOutsideClose": [4, "click-outside-close"],
235
240
  "customFont": [4, "custom-font"],
236
241
  "emailAddress": [1, "email-address"],
242
+ "historyClose": [4, "history-close"],
237
243
  "isEmailRequired": [4, "is-email-required"],
238
244
  "fetchData": [4, "fetch-data"],
239
245
  "hideEmail": [4, "hide-email"],