pushfeedback 0.0.10 → 0.0.12

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.
@@ -7920,6 +7920,14 @@ const FeedbackModal = class {
7920
7920
  this.showScreenshotMode = false;
7921
7921
  this.showModal = false;
7922
7922
  this.sending = true;
7923
+ let encodedScreenshot = "";
7924
+ if (this.encodedScreenshot) {
7925
+ await this.encodedScreenshot.then((data) => {
7926
+ encodedScreenshot = data;
7927
+ }).catch((error) => {
7928
+ console.log(error);
7929
+ });
7930
+ }
7923
7931
  try {
7924
7932
  const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
7925
7933
  method: 'POST',
@@ -7928,7 +7936,7 @@ const FeedbackModal = class {
7928
7936
  message: this.formMessage,
7929
7937
  email: this.formEmail,
7930
7938
  project: this.project,
7931
- screenshot: this.encodedScreenshot
7939
+ screenshot: encodedScreenshot
7932
7940
  }),
7933
7941
  headers: {
7934
7942
  'Content-Type': 'application/json'
@@ -8033,26 +8041,27 @@ const FeedbackModal = class {
8033
8041
  };
8034
8042
  this.handleMouseClickedSelectedElement = (event) => {
8035
8043
  event.preventDefault();
8036
- if (this.elementSelected) {
8044
+ if (this.elementSelected)
8037
8045
  this.elementSelected.classList.add('feedback-modal-element-selected');
8038
- }
8039
8046
  let top = this.elementSelected.getBoundingClientRect().top;
8040
- this.elementSelected.style.top = `${top + window.scrollY}px`;
8047
+ this.elementSelected.style.top = `${top + window.pageYOffset}px`;
8041
8048
  const clonedElementSelected = this.elementSelected.cloneNode(true);
8042
8049
  document.body.appendChild(clonedElementSelected);
8043
8050
  this.elementSelected.style.top = `${top}px`;
8044
- html2canvas(document.body).then((canvas) => {
8045
- this.encodedScreenshot = canvas.toDataURL();
8051
+ this.encodedScreenshot = html2canvas(document.body).then(canvas => {
8052
+ const dataUrl = canvas.toDataURL();
8046
8053
  document.body.removeChild(clonedElementSelected);
8047
- const page = document.getElementsByTagName('html')[0];
8048
- page.style.overflow = 'hidden';
8049
- this.hasSelectedElement = true;
8050
- this.overlay.style.display = 'block';
8051
- this.showModal = true;
8052
- }).catch((error) => {
8053
- console.log(error);
8054
+ return dataUrl;
8055
+ })
8056
+ .catch(function (error) {
8057
+ console.error(error);
8054
8058
  return "";
8055
8059
  });
8060
+ const page = document.getElementsByTagName('html')[0];
8061
+ page.style.overflow = 'hidden';
8062
+ this.hasSelectedElement = true;
8063
+ this.overlay.style.display = 'block';
8064
+ this.showModal = true;
8056
8065
  };
8057
8066
  this.sending = false;
8058
8067
  this.formMessage = '';
@@ -8,6 +8,14 @@ export class FeedbackModal {
8
8
  this.showScreenshotMode = false;
9
9
  this.showModal = false;
10
10
  this.sending = true;
11
+ let encodedScreenshot = "";
12
+ if (this.encodedScreenshot) {
13
+ await this.encodedScreenshot.then((data) => {
14
+ encodedScreenshot = data;
15
+ }).catch((error) => {
16
+ console.log(error);
17
+ });
18
+ }
11
19
  try {
12
20
  const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
13
21
  method: 'POST',
@@ -16,7 +24,7 @@ export class FeedbackModal {
16
24
  message: this.formMessage,
17
25
  email: this.formEmail,
18
26
  project: this.project,
19
- screenshot: this.encodedScreenshot
27
+ screenshot: encodedScreenshot
20
28
  }),
21
29
  headers: {
22
30
  'Content-Type': 'application/json'
@@ -122,26 +130,27 @@ export class FeedbackModal {
122
130
  };
123
131
  this.handleMouseClickedSelectedElement = (event) => {
124
132
  event.preventDefault();
125
- if (this.elementSelected) {
133
+ if (this.elementSelected)
126
134
  this.elementSelected.classList.add('feedback-modal-element-selected');
127
- }
128
135
  let top = this.elementSelected.getBoundingClientRect().top;
129
- this.elementSelected.style.top = `${top + window.scrollY}px`;
136
+ this.elementSelected.style.top = `${top + window.pageYOffset}px`;
130
137
  const clonedElementSelected = this.elementSelected.cloneNode(true);
131
138
  document.body.appendChild(clonedElementSelected);
132
139
  this.elementSelected.style.top = `${top}px`;
133
- html2canvas(document.body).then((canvas) => {
134
- this.encodedScreenshot = canvas.toDataURL();
140
+ this.encodedScreenshot = html2canvas(document.body).then(canvas => {
141
+ const dataUrl = canvas.toDataURL();
135
142
  document.body.removeChild(clonedElementSelected);
136
- const page = document.getElementsByTagName('html')[0];
137
- page.style.overflow = 'hidden';
138
- this.hasSelectedElement = true;
139
- this.overlay.style.display = 'block';
140
- this.showModal = true;
141
- }).catch((error) => {
142
- console.log(error);
143
+ return dataUrl;
144
+ })
145
+ .catch(function (error) {
146
+ console.error(error);
143
147
  return "";
144
148
  });
149
+ const page = document.getElementsByTagName('html')[0];
150
+ page.style.overflow = 'hidden';
151
+ this.hasSelectedElement = true;
152
+ this.overlay.style.display = 'block';
153
+ this.showModal = true;
145
154
  };
146
155
  this.sending = false;
147
156
  this.formMessage = '';
@@ -7857,6 +7857,14 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
7857
7857
  this.showScreenshotMode = false;
7858
7858
  this.showModal = false;
7859
7859
  this.sending = true;
7860
+ let encodedScreenshot = "";
7861
+ if (this.encodedScreenshot) {
7862
+ await this.encodedScreenshot.then((data) => {
7863
+ encodedScreenshot = data;
7864
+ }).catch((error) => {
7865
+ console.log(error);
7866
+ });
7867
+ }
7860
7868
  try {
7861
7869
  const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
7862
7870
  method: 'POST',
@@ -7865,7 +7873,7 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
7865
7873
  message: this.formMessage,
7866
7874
  email: this.formEmail,
7867
7875
  project: this.project,
7868
- screenshot: this.encodedScreenshot
7876
+ screenshot: encodedScreenshot
7869
7877
  }),
7870
7878
  headers: {
7871
7879
  'Content-Type': 'application/json'
@@ -7970,26 +7978,27 @@ const FeedbackModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
7970
7978
  };
7971
7979
  this.handleMouseClickedSelectedElement = (event) => {
7972
7980
  event.preventDefault();
7973
- if (this.elementSelected) {
7981
+ if (this.elementSelected)
7974
7982
  this.elementSelected.classList.add('feedback-modal-element-selected');
7975
- }
7976
7983
  let top = this.elementSelected.getBoundingClientRect().top;
7977
- this.elementSelected.style.top = `${top + window.scrollY}px`;
7984
+ this.elementSelected.style.top = `${top + window.pageYOffset}px`;
7978
7985
  const clonedElementSelected = this.elementSelected.cloneNode(true);
7979
7986
  document.body.appendChild(clonedElementSelected);
7980
7987
  this.elementSelected.style.top = `${top}px`;
7981
- html2canvas(document.body).then((canvas) => {
7982
- this.encodedScreenshot = canvas.toDataURL();
7988
+ this.encodedScreenshot = html2canvas(document.body).then(canvas => {
7989
+ const dataUrl = canvas.toDataURL();
7983
7990
  document.body.removeChild(clonedElementSelected);
7984
- const page = document.getElementsByTagName('html')[0];
7985
- page.style.overflow = 'hidden';
7986
- this.hasSelectedElement = true;
7987
- this.overlay.style.display = 'block';
7988
- this.showModal = true;
7989
- }).catch((error) => {
7990
- console.log(error);
7991
+ return dataUrl;
7992
+ })
7993
+ .catch(function (error) {
7994
+ console.error(error);
7991
7995
  return "";
7992
7996
  });
7997
+ const page = document.getElementsByTagName('html')[0];
7998
+ page.style.overflow = 'hidden';
7999
+ this.hasSelectedElement = true;
8000
+ this.overlay.style.display = 'block';
8001
+ this.showModal = true;
7993
8002
  };
7994
8003
  this.sending = false;
7995
8004
  this.formMessage = '';
@@ -7916,6 +7916,14 @@ const FeedbackModal = class {
7916
7916
  this.showScreenshotMode = false;
7917
7917
  this.showModal = false;
7918
7918
  this.sending = true;
7919
+ let encodedScreenshot = "";
7920
+ if (this.encodedScreenshot) {
7921
+ await this.encodedScreenshot.then((data) => {
7922
+ encodedScreenshot = data;
7923
+ }).catch((error) => {
7924
+ console.log(error);
7925
+ });
7926
+ }
7919
7927
  try {
7920
7928
  const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
7921
7929
  method: 'POST',
@@ -7924,7 +7932,7 @@ const FeedbackModal = class {
7924
7932
  message: this.formMessage,
7925
7933
  email: this.formEmail,
7926
7934
  project: this.project,
7927
- screenshot: this.encodedScreenshot
7935
+ screenshot: encodedScreenshot
7928
7936
  }),
7929
7937
  headers: {
7930
7938
  'Content-Type': 'application/json'
@@ -8029,26 +8037,27 @@ const FeedbackModal = class {
8029
8037
  };
8030
8038
  this.handleMouseClickedSelectedElement = (event) => {
8031
8039
  event.preventDefault();
8032
- if (this.elementSelected) {
8040
+ if (this.elementSelected)
8033
8041
  this.elementSelected.classList.add('feedback-modal-element-selected');
8034
- }
8035
8042
  let top = this.elementSelected.getBoundingClientRect().top;
8036
- this.elementSelected.style.top = `${top + window.scrollY}px`;
8043
+ this.elementSelected.style.top = `${top + window.pageYOffset}px`;
8037
8044
  const clonedElementSelected = this.elementSelected.cloneNode(true);
8038
8045
  document.body.appendChild(clonedElementSelected);
8039
8046
  this.elementSelected.style.top = `${top}px`;
8040
- html2canvas(document.body).then((canvas) => {
8041
- this.encodedScreenshot = canvas.toDataURL();
8047
+ this.encodedScreenshot = html2canvas(document.body).then(canvas => {
8048
+ const dataUrl = canvas.toDataURL();
8042
8049
  document.body.removeChild(clonedElementSelected);
8043
- const page = document.getElementsByTagName('html')[0];
8044
- page.style.overflow = 'hidden';
8045
- this.hasSelectedElement = true;
8046
- this.overlay.style.display = 'block';
8047
- this.showModal = true;
8048
- }).catch((error) => {
8049
- console.log(error);
8050
+ return dataUrl;
8051
+ })
8052
+ .catch(function (error) {
8053
+ console.error(error);
8050
8054
  return "";
8051
8055
  });
8056
+ const page = document.getElementsByTagName('html')[0];
8057
+ page.style.overflow = 'hidden';
8058
+ this.hasSelectedElement = true;
8059
+ this.overlay.style.display = 'block';
8060
+ this.showModal = true;
8052
8061
  };
8053
8062
  this.sending = false;
8054
8063
  this.formMessage = '';