pushfeedback 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/feedback-button_2.cjs.entry.js +7755 -702
- package/dist/collection/components/feedback-modal/feedback-modal.js +13 -22
- package/dist/components/feedback-modal2.js +7755 -702
- package/dist/esm/feedback-button_2.entry.js +7755 -702
- package/dist/pushfeedback/p-ab8c350d.entry.js +22 -0
- package/dist/pushfeedback/pushfeedback.esm.js +1 -1
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +1 -1
- package/package.json +2 -2
- package/dist/pushfeedback/p-09647793.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
-
import
|
|
2
|
+
import html2canvas from 'html2canvas';
|
|
3
3
|
export class FeedbackModal {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.handleSubmit = async (event) => {
|
|
@@ -8,14 +8,6 @@ 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
|
-
}
|
|
19
11
|
try {
|
|
20
12
|
const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
|
|
21
13
|
method: 'POST',
|
|
@@ -24,7 +16,7 @@ export class FeedbackModal {
|
|
|
24
16
|
message: this.formMessage,
|
|
25
17
|
email: this.formEmail,
|
|
26
18
|
project: this.project,
|
|
27
|
-
screenshot: encodedScreenshot
|
|
19
|
+
screenshot: this.encodedScreenshot
|
|
28
20
|
}),
|
|
29
21
|
headers: {
|
|
30
22
|
'Content-Type': 'application/json'
|
|
@@ -130,27 +122,26 @@ export class FeedbackModal {
|
|
|
130
122
|
};
|
|
131
123
|
this.handleMouseClickedSelectedElement = (event) => {
|
|
132
124
|
event.preventDefault();
|
|
133
|
-
if (this.elementSelected)
|
|
125
|
+
if (this.elementSelected) {
|
|
134
126
|
this.elementSelected.classList.add('feedback-modal-element-selected');
|
|
127
|
+
}
|
|
135
128
|
let top = this.elementSelected.getBoundingClientRect().top;
|
|
136
|
-
this.elementSelected.style.top = `${top + window.
|
|
129
|
+
this.elementSelected.style.top = `${top + window.scrollY}px`;
|
|
137
130
|
const clonedElementSelected = this.elementSelected.cloneNode(true);
|
|
138
131
|
document.body.appendChild(clonedElementSelected);
|
|
139
132
|
this.elementSelected.style.top = `${top}px`;
|
|
140
|
-
|
|
141
|
-
.
|
|
133
|
+
html2canvas(document.body).then((canvas) => {
|
|
134
|
+
this.encodedScreenshot = canvas.toDataURL();
|
|
142
135
|
document.body.removeChild(clonedElementSelected);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
.
|
|
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) => {
|
|
146
142
|
console.log(error);
|
|
147
143
|
return "";
|
|
148
144
|
});
|
|
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;
|
|
154
145
|
};
|
|
155
146
|
this.sending = false;
|
|
156
147
|
this.formMessage = '';
|