pushfeedback 0.0.7 → 0.0.9
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 +1049 -0
- package/dist/cjs/index-d5ac8167.js +1469 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +22 -0
- package/dist/cjs/pushfeedback.cjs.js +23 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/feedback-button/feedback-button.css +57 -0
- package/dist/collection/components/feedback-button/feedback-button.js +343 -0
- package/dist/collection/components/feedback-modal/feedback-modal.css +222 -0
- package/dist/collection/components/feedback-modal/feedback-modal.js +529 -0
- package/dist/collection/index.js +1 -0
- package/dist/{pushfeedback/feedback-button.entry.js → components/feedback-button.js} +48 -8
- package/dist/components/feedback-modal.js +6 -0
- package/dist/{pushfeedback/feedback-modal.entry.js → components/feedback-modal2.js} +63 -50
- package/dist/components/index.js +3 -0
- package/dist/esm/feedback-button_2.entry.js +1044 -0
- package/dist/esm/index-74109694.js +1441 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +18 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/pushfeedback.js +18 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/pushfeedback/index.esm.js +0 -1
- package/dist/pushfeedback/p-09647793.entry.js +1 -0
- package/dist/pushfeedback/p-38d135e1.js +2 -0
- package/dist/pushfeedback/pushfeedback.css +1 -55
- package/dist/pushfeedback/pushfeedback.esm.js +1 -148
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +5 -2
- package/dist/types/components.d.ts +8 -4
- package/package.json +2 -2
- package/dist/pushfeedback/app-globals-0f993ce5.js +0 -3
- package/dist/pushfeedback/css-shim-b7d3d95f.js +0 -4
- package/dist/pushfeedback/dom-64053c71.js +0 -73
- package/dist/pushfeedback/index-e4444da7.js +0 -3371
- package/dist/pushfeedback/shadow-css-008a49f5.js +0 -387
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import domtoimage from 'dom-to-image';
|
|
3
|
+
export class FeedbackModal {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handleSubmit = async (event) => {
|
|
6
|
+
event.preventDefault();
|
|
7
|
+
this.resetOverflow();
|
|
8
|
+
this.showScreenshotMode = false;
|
|
9
|
+
this.showModal = false;
|
|
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
|
+
try {
|
|
20
|
+
const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
body: JSON.stringify({
|
|
23
|
+
url: window.location.href,
|
|
24
|
+
message: this.formMessage,
|
|
25
|
+
email: this.formEmail,
|
|
26
|
+
project: this.project,
|
|
27
|
+
screenshot: encodedScreenshot
|
|
28
|
+
}),
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json'
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (res.status === 201) {
|
|
34
|
+
this.formSuccess = true;
|
|
35
|
+
this.formError = false;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.formSuccess = false;
|
|
39
|
+
this.formError = true;
|
|
40
|
+
this.formErrorStatus = res.status;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.log(error);
|
|
45
|
+
this.formSuccess = false;
|
|
46
|
+
this.formError = true;
|
|
47
|
+
this.formErrorStatus = 500;
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
this.sending = false;
|
|
51
|
+
this.showModal = true;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
this.close = () => {
|
|
55
|
+
this.sending = false;
|
|
56
|
+
this.showModal = false;
|
|
57
|
+
this.showScreenshotMode = false;
|
|
58
|
+
this.hasSelectedElement = false;
|
|
59
|
+
this.encodedScreenshot = null;
|
|
60
|
+
this.formSuccess = false;
|
|
61
|
+
this.formError = false;
|
|
62
|
+
this.formErrorStatus = 500;
|
|
63
|
+
this.formMessage = '';
|
|
64
|
+
this.formEmail = '';
|
|
65
|
+
this.resetOverflow();
|
|
66
|
+
};
|
|
67
|
+
this.openScreenShot = () => {
|
|
68
|
+
this.hasSelectedElement = false;
|
|
69
|
+
this.showModal = false;
|
|
70
|
+
this.showScreenshotMode = true;
|
|
71
|
+
this.encodedScreenshot = null;
|
|
72
|
+
this.resetOverflow();
|
|
73
|
+
};
|
|
74
|
+
this.closeScreenShot = () => {
|
|
75
|
+
this.showModal = false;
|
|
76
|
+
this.showScreenshotMode = false;
|
|
77
|
+
this.hasSelectedElement = false;
|
|
78
|
+
this.encodedScreenshot = null;
|
|
79
|
+
this.overlay.style.display = 'none';
|
|
80
|
+
this.resetOverflow();
|
|
81
|
+
};
|
|
82
|
+
this.handleMouseOverScreenShot = (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
if (this.hasSelectedElement)
|
|
85
|
+
return;
|
|
86
|
+
this.overlay.style.display = 'none';
|
|
87
|
+
this.screenshotModal.style.display = 'none';
|
|
88
|
+
const elementUnder = document.elementFromPoint(event.clientX, event.clientY);
|
|
89
|
+
const rect = elementUnder.getBoundingClientRect();
|
|
90
|
+
this.screenshotModal.style.display = '';
|
|
91
|
+
// Get the bounding box of the element selected
|
|
92
|
+
this.elementSelected.style.position = "absolute";
|
|
93
|
+
this.elementSelected.style.left = `${rect.left}px`;
|
|
94
|
+
this.elementSelected.style.top = `${rect.top}px`;
|
|
95
|
+
this.elementSelected.style.width = `${rect.width}px`;
|
|
96
|
+
this.elementSelected.style.height = `${rect.height}px`;
|
|
97
|
+
this.elementSelected.classList.add('feedback-modal-element-hover');
|
|
98
|
+
// Set the background color of nonselected areas
|
|
99
|
+
// Top
|
|
100
|
+
this.topSide.style.position = "absolute";
|
|
101
|
+
this.topSide.style.left = `${rect.left}px`;
|
|
102
|
+
this.topSide.style.top = '0px';
|
|
103
|
+
this.topSide.style.width = `${rect.width + 8}px`;
|
|
104
|
+
this.topSide.style.height = `${rect.top}px`;
|
|
105
|
+
this.topSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
106
|
+
// Left
|
|
107
|
+
this.leftSide.style.position = "absolute";
|
|
108
|
+
this.leftSide.style.left = '0px';
|
|
109
|
+
this.leftSide.style.top = '0px';
|
|
110
|
+
this.leftSide.style.width = `${rect.left}px`;
|
|
111
|
+
this.leftSide.style.height = '100vh';
|
|
112
|
+
this.leftSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
113
|
+
// Bottom
|
|
114
|
+
this.bottomSide.style.position = "absolute";
|
|
115
|
+
this.bottomSide.style.left = `${rect.left}px`;
|
|
116
|
+
this.bottomSide.style.top = `${rect.bottom + 8}px`;
|
|
117
|
+
this.bottomSide.style.width = `${rect.width + 8}px`;
|
|
118
|
+
this.bottomSide.style.height = '100vh';
|
|
119
|
+
this.bottomSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
120
|
+
// Right
|
|
121
|
+
this.rightSide.style.position = "absolute";
|
|
122
|
+
this.rightSide.style.left = `${rect.right + 8}px`;
|
|
123
|
+
;
|
|
124
|
+
this.rightSide.style.top = '0px';
|
|
125
|
+
this.rightSide.style.width = '100%';
|
|
126
|
+
this.rightSide.style.height = '100vh';
|
|
127
|
+
this.rightSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
128
|
+
// Restore the visibility of the screenshot-modal
|
|
129
|
+
this.screenshotModal.style.backgroundColor = 'transparent';
|
|
130
|
+
};
|
|
131
|
+
this.handleMouseClickedSelectedElement = (event) => {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
if (this.elementSelected)
|
|
134
|
+
this.elementSelected.classList.add('feedback-modal-element-selected');
|
|
135
|
+
let top = this.elementSelected.getBoundingClientRect().top;
|
|
136
|
+
this.elementSelected.style.top = `${top + window.pageYOffset}px`;
|
|
137
|
+
const clonedElementSelected = this.elementSelected.cloneNode(true);
|
|
138
|
+
document.body.appendChild(clonedElementSelected);
|
|
139
|
+
this.elementSelected.style.top = `${top}px`;
|
|
140
|
+
this.encodedScreenshot = domtoimage.toPng(document.body, { cacheBust: true })
|
|
141
|
+
.then(function (dataUrl) {
|
|
142
|
+
document.body.removeChild(clonedElementSelected);
|
|
143
|
+
return dataUrl;
|
|
144
|
+
})
|
|
145
|
+
.catch(function (error) {
|
|
146
|
+
console.log(error);
|
|
147
|
+
return "";
|
|
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;
|
|
154
|
+
};
|
|
155
|
+
this.sending = false;
|
|
156
|
+
this.formMessage = '';
|
|
157
|
+
this.formEmail = '';
|
|
158
|
+
this.formSuccess = false;
|
|
159
|
+
this.formError = false;
|
|
160
|
+
this.formErrorStatus = 500;
|
|
161
|
+
this.encodedScreenshot = undefined;
|
|
162
|
+
this.modalTitle = 'Share your feedback';
|
|
163
|
+
this.modalTitleSuccess = 'Thanks for your feedback!';
|
|
164
|
+
this.modalTitleError = "Oops! We didn't receive your feedback. Please try again later.";
|
|
165
|
+
this.modalTitleError403 = "Oops! The request URL does not match the one defined in PushFeedback for this project.";
|
|
166
|
+
this.modalTitleError404 = "Oops! We could not find the provided project id in PushFeedback.";
|
|
167
|
+
this.modalPosition = 'center';
|
|
168
|
+
this.sendButtonText = 'Send';
|
|
169
|
+
this.project = '';
|
|
170
|
+
this.screenshotButtonTooltipText = 'Take a Screenshot';
|
|
171
|
+
this.screenshotTopbarText = 'SELECT AN ELEMENT ON THE PAGE';
|
|
172
|
+
this.email = '';
|
|
173
|
+
this.emailPlaceholder = 'Email address (optional)';
|
|
174
|
+
this.messagePlaceholder = 'How could this page be more helpful?';
|
|
175
|
+
this.showModal = false;
|
|
176
|
+
this.showScreenshotMode = false;
|
|
177
|
+
this.hasSelectedElement = false;
|
|
178
|
+
this.hideScreenshotButton = false;
|
|
179
|
+
}
|
|
180
|
+
componentWillLoad() {
|
|
181
|
+
this.formEmail = this.email;
|
|
182
|
+
}
|
|
183
|
+
resetOverflow() {
|
|
184
|
+
const page = document.getElementsByTagName('html')[0];
|
|
185
|
+
page.style.overflow = 'inherit';
|
|
186
|
+
}
|
|
187
|
+
handleMessageInput(event) {
|
|
188
|
+
this.formMessage = event.target.value;
|
|
189
|
+
}
|
|
190
|
+
handleEmailInput(event) {
|
|
191
|
+
this.formEmail = event.target.value;
|
|
192
|
+
}
|
|
193
|
+
render() {
|
|
194
|
+
return (h("div", { class: "feedback-modal-wrapper" }, 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) }), 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: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "#fff", "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-screenshot-overlay", ref: el => (this.overlay = el) }))), this.showModal && (h("div", { class: `feedback-modal-content feedback-modal-content--${this.modalPosition}`, ref: el => (this.modalContent = el) }, h("div", { class: "feedback-modal-header" }, !this.formSuccess && !this.formError ? (h("span", null, this.modalTitle)) : this.formSuccess ? (h("span", { class: "text-center" }, this.modalTitleSuccess)) : this.formError && this.formErrorStatus == 500 ? (h("span", { class: "text-center" }, this.modalTitleError)) : this.formError && this.formErrorStatus == 403 ? (h("span", { class: "text-center" }, this.modalTitleError403)) : this.formError && this.formErrorStatus == 404 ? (h("span", { class: "text-center" }, this.modalTitleError404)) : h("span", null), h("button", { class: "feedback-modal-close", onClick: this.close }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "#ccc", "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 }, h("div", { class: "feedback-modal-text" }, h("textarea", { placeholder: this.messagePlaceholder, value: this.formMessage, onInput: (event) => this.handleMessageInput(event), required: true })), !this.email && (h("div", { class: "feedback-modal-email" }, h("input", { type: "email", placeholder: this.emailPlaceholder, onInput: (event) => this.handleEmailInput(event), value: this.formEmail }))), h("div", { class: `feedback-modal-buttons ${this.hideScreenshotButton ? 'single' : ''}` }, !this.hideScreenshotButton && (h("button", { type: "button", class: `button${this.encodedScreenshot ? " active" : ""}`, title: this.screenshotButtonTooltipText, onClick: this.openScreenShot, disabled: this.sending }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "feather feather-camera" }, h("path", { d: "M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" }), h("circle", { cx: "12", cy: "13", r: "4" })))), h("button", { class: "button", type: "submit", disabled: this.sending }, this.sendButtonText)))) : h("span", null)), h("div", { class: "feedback-modal-footer" }, h("div", { class: "feedback-logo" }, h("svg", { class: "w-8 h-8", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg" }, h("defs", null, h("radialGradient", { cx: "21.152%", cy: "86.063%", fx: "21.152%", fy: "86.063%", r: "79.941%", id: "footer-logo" }, h("stop", { "stop-color": "#4FD1C5", offset: "0%" }), h("stop", { "stop-color": "#81E6D9", offset: "25.871%" }), h("stop", { "stop-color": "#338CF5", offset: "100%" }))), h("rect", { width: "32", height: "32", rx: "16", fill: "url(#footer-logo)", "fill-rule": "nonzero" })), " ", h("a", { href: "https://pushfeedback.com" }, "PushFeedback")))))));
|
|
195
|
+
}
|
|
196
|
+
static get is() { return "feedback-modal"; }
|
|
197
|
+
static get encapsulation() { return "shadow"; }
|
|
198
|
+
static get originalStyleUrls() {
|
|
199
|
+
return {
|
|
200
|
+
"$": ["feedback-modal.css"]
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
static get styleUrls() {
|
|
204
|
+
return {
|
|
205
|
+
"$": ["feedback-modal.css"]
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
static get properties() {
|
|
209
|
+
return {
|
|
210
|
+
"modalTitle": {
|
|
211
|
+
"type": "string",
|
|
212
|
+
"mutable": false,
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "string",
|
|
215
|
+
"resolved": "string",
|
|
216
|
+
"references": {}
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"optional": false,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [],
|
|
222
|
+
"text": ""
|
|
223
|
+
},
|
|
224
|
+
"attribute": "modal-title",
|
|
225
|
+
"reflect": false,
|
|
226
|
+
"defaultValue": "'Share your feedback'"
|
|
227
|
+
},
|
|
228
|
+
"modalTitleSuccess": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"mutable": false,
|
|
231
|
+
"complexType": {
|
|
232
|
+
"original": "string",
|
|
233
|
+
"resolved": "string",
|
|
234
|
+
"references": {}
|
|
235
|
+
},
|
|
236
|
+
"required": false,
|
|
237
|
+
"optional": false,
|
|
238
|
+
"docs": {
|
|
239
|
+
"tags": [],
|
|
240
|
+
"text": ""
|
|
241
|
+
},
|
|
242
|
+
"attribute": "modal-title-success",
|
|
243
|
+
"reflect": false,
|
|
244
|
+
"defaultValue": "'Thanks for your feedback!'"
|
|
245
|
+
},
|
|
246
|
+
"modalTitleError": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"mutable": false,
|
|
249
|
+
"complexType": {
|
|
250
|
+
"original": "string",
|
|
251
|
+
"resolved": "string",
|
|
252
|
+
"references": {}
|
|
253
|
+
},
|
|
254
|
+
"required": false,
|
|
255
|
+
"optional": false,
|
|
256
|
+
"docs": {
|
|
257
|
+
"tags": [],
|
|
258
|
+
"text": ""
|
|
259
|
+
},
|
|
260
|
+
"attribute": "modal-title-error",
|
|
261
|
+
"reflect": false,
|
|
262
|
+
"defaultValue": "\"Oops! We didn't receive your feedback. Please try again later.\""
|
|
263
|
+
},
|
|
264
|
+
"modalTitleError403": {
|
|
265
|
+
"type": "string",
|
|
266
|
+
"mutable": false,
|
|
267
|
+
"complexType": {
|
|
268
|
+
"original": "string",
|
|
269
|
+
"resolved": "string",
|
|
270
|
+
"references": {}
|
|
271
|
+
},
|
|
272
|
+
"required": false,
|
|
273
|
+
"optional": false,
|
|
274
|
+
"docs": {
|
|
275
|
+
"tags": [],
|
|
276
|
+
"text": ""
|
|
277
|
+
},
|
|
278
|
+
"attribute": "modal-title-error-4-0-3",
|
|
279
|
+
"reflect": false,
|
|
280
|
+
"defaultValue": "\"Oops! The request URL does not match the one defined in PushFeedback for this project.\""
|
|
281
|
+
},
|
|
282
|
+
"modalTitleError404": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"mutable": false,
|
|
285
|
+
"complexType": {
|
|
286
|
+
"original": "string",
|
|
287
|
+
"resolved": "string",
|
|
288
|
+
"references": {}
|
|
289
|
+
},
|
|
290
|
+
"required": false,
|
|
291
|
+
"optional": false,
|
|
292
|
+
"docs": {
|
|
293
|
+
"tags": [],
|
|
294
|
+
"text": ""
|
|
295
|
+
},
|
|
296
|
+
"attribute": "modal-title-error-4-0-4",
|
|
297
|
+
"reflect": false,
|
|
298
|
+
"defaultValue": "\"Oops! We could not find the provided project id in PushFeedback.\""
|
|
299
|
+
},
|
|
300
|
+
"modalPosition": {
|
|
301
|
+
"type": "string",
|
|
302
|
+
"mutable": false,
|
|
303
|
+
"complexType": {
|
|
304
|
+
"original": "string",
|
|
305
|
+
"resolved": "string",
|
|
306
|
+
"references": {}
|
|
307
|
+
},
|
|
308
|
+
"required": false,
|
|
309
|
+
"optional": false,
|
|
310
|
+
"docs": {
|
|
311
|
+
"tags": [],
|
|
312
|
+
"text": ""
|
|
313
|
+
},
|
|
314
|
+
"attribute": "modal-position",
|
|
315
|
+
"reflect": false,
|
|
316
|
+
"defaultValue": "'center'"
|
|
317
|
+
},
|
|
318
|
+
"sendButtonText": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"mutable": false,
|
|
321
|
+
"complexType": {
|
|
322
|
+
"original": "string",
|
|
323
|
+
"resolved": "string",
|
|
324
|
+
"references": {}
|
|
325
|
+
},
|
|
326
|
+
"required": false,
|
|
327
|
+
"optional": false,
|
|
328
|
+
"docs": {
|
|
329
|
+
"tags": [],
|
|
330
|
+
"text": ""
|
|
331
|
+
},
|
|
332
|
+
"attribute": "send-button-text",
|
|
333
|
+
"reflect": false,
|
|
334
|
+
"defaultValue": "'Send'"
|
|
335
|
+
},
|
|
336
|
+
"project": {
|
|
337
|
+
"type": "string",
|
|
338
|
+
"mutable": false,
|
|
339
|
+
"complexType": {
|
|
340
|
+
"original": "string",
|
|
341
|
+
"resolved": "string",
|
|
342
|
+
"references": {}
|
|
343
|
+
},
|
|
344
|
+
"required": false,
|
|
345
|
+
"optional": false,
|
|
346
|
+
"docs": {
|
|
347
|
+
"tags": [],
|
|
348
|
+
"text": ""
|
|
349
|
+
},
|
|
350
|
+
"attribute": "project",
|
|
351
|
+
"reflect": false,
|
|
352
|
+
"defaultValue": "''"
|
|
353
|
+
},
|
|
354
|
+
"screenshotButtonTooltipText": {
|
|
355
|
+
"type": "string",
|
|
356
|
+
"mutable": false,
|
|
357
|
+
"complexType": {
|
|
358
|
+
"original": "string",
|
|
359
|
+
"resolved": "string",
|
|
360
|
+
"references": {}
|
|
361
|
+
},
|
|
362
|
+
"required": false,
|
|
363
|
+
"optional": false,
|
|
364
|
+
"docs": {
|
|
365
|
+
"tags": [],
|
|
366
|
+
"text": ""
|
|
367
|
+
},
|
|
368
|
+
"attribute": "screenshot-button-tooltip-text",
|
|
369
|
+
"reflect": false,
|
|
370
|
+
"defaultValue": "'Take a Screenshot'"
|
|
371
|
+
},
|
|
372
|
+
"screenshotTopbarText": {
|
|
373
|
+
"type": "string",
|
|
374
|
+
"mutable": false,
|
|
375
|
+
"complexType": {
|
|
376
|
+
"original": "string",
|
|
377
|
+
"resolved": "string",
|
|
378
|
+
"references": {}
|
|
379
|
+
},
|
|
380
|
+
"required": false,
|
|
381
|
+
"optional": false,
|
|
382
|
+
"docs": {
|
|
383
|
+
"tags": [],
|
|
384
|
+
"text": ""
|
|
385
|
+
},
|
|
386
|
+
"attribute": "screenshot-topbar-text",
|
|
387
|
+
"reflect": false,
|
|
388
|
+
"defaultValue": "'SELECT AN ELEMENT ON THE PAGE'"
|
|
389
|
+
},
|
|
390
|
+
"email": {
|
|
391
|
+
"type": "string",
|
|
392
|
+
"mutable": false,
|
|
393
|
+
"complexType": {
|
|
394
|
+
"original": "string",
|
|
395
|
+
"resolved": "string",
|
|
396
|
+
"references": {}
|
|
397
|
+
},
|
|
398
|
+
"required": false,
|
|
399
|
+
"optional": false,
|
|
400
|
+
"docs": {
|
|
401
|
+
"tags": [],
|
|
402
|
+
"text": ""
|
|
403
|
+
},
|
|
404
|
+
"attribute": "email",
|
|
405
|
+
"reflect": false,
|
|
406
|
+
"defaultValue": "''"
|
|
407
|
+
},
|
|
408
|
+
"emailPlaceholder": {
|
|
409
|
+
"type": "string",
|
|
410
|
+
"mutable": false,
|
|
411
|
+
"complexType": {
|
|
412
|
+
"original": "string",
|
|
413
|
+
"resolved": "string",
|
|
414
|
+
"references": {}
|
|
415
|
+
},
|
|
416
|
+
"required": false,
|
|
417
|
+
"optional": false,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": ""
|
|
421
|
+
},
|
|
422
|
+
"attribute": "email-placeholder",
|
|
423
|
+
"reflect": false,
|
|
424
|
+
"defaultValue": "'Email address (optional)'"
|
|
425
|
+
},
|
|
426
|
+
"messagePlaceholder": {
|
|
427
|
+
"type": "string",
|
|
428
|
+
"mutable": false,
|
|
429
|
+
"complexType": {
|
|
430
|
+
"original": "string",
|
|
431
|
+
"resolved": "string",
|
|
432
|
+
"references": {}
|
|
433
|
+
},
|
|
434
|
+
"required": false,
|
|
435
|
+
"optional": false,
|
|
436
|
+
"docs": {
|
|
437
|
+
"tags": [],
|
|
438
|
+
"text": ""
|
|
439
|
+
},
|
|
440
|
+
"attribute": "message-placeholder",
|
|
441
|
+
"reflect": false,
|
|
442
|
+
"defaultValue": "'How could this page be more helpful?'"
|
|
443
|
+
},
|
|
444
|
+
"showModal": {
|
|
445
|
+
"type": "boolean",
|
|
446
|
+
"mutable": true,
|
|
447
|
+
"complexType": {
|
|
448
|
+
"original": "boolean",
|
|
449
|
+
"resolved": "boolean",
|
|
450
|
+
"references": {}
|
|
451
|
+
},
|
|
452
|
+
"required": false,
|
|
453
|
+
"optional": false,
|
|
454
|
+
"docs": {
|
|
455
|
+
"tags": [],
|
|
456
|
+
"text": ""
|
|
457
|
+
},
|
|
458
|
+
"attribute": "show-modal",
|
|
459
|
+
"reflect": true,
|
|
460
|
+
"defaultValue": "false"
|
|
461
|
+
},
|
|
462
|
+
"showScreenshotMode": {
|
|
463
|
+
"type": "boolean",
|
|
464
|
+
"mutable": true,
|
|
465
|
+
"complexType": {
|
|
466
|
+
"original": "boolean",
|
|
467
|
+
"resolved": "boolean",
|
|
468
|
+
"references": {}
|
|
469
|
+
},
|
|
470
|
+
"required": false,
|
|
471
|
+
"optional": false,
|
|
472
|
+
"docs": {
|
|
473
|
+
"tags": [],
|
|
474
|
+
"text": ""
|
|
475
|
+
},
|
|
476
|
+
"attribute": "show-screenshot-mode",
|
|
477
|
+
"reflect": true,
|
|
478
|
+
"defaultValue": "false"
|
|
479
|
+
},
|
|
480
|
+
"hasSelectedElement": {
|
|
481
|
+
"type": "boolean",
|
|
482
|
+
"mutable": true,
|
|
483
|
+
"complexType": {
|
|
484
|
+
"original": "boolean",
|
|
485
|
+
"resolved": "boolean",
|
|
486
|
+
"references": {}
|
|
487
|
+
},
|
|
488
|
+
"required": false,
|
|
489
|
+
"optional": false,
|
|
490
|
+
"docs": {
|
|
491
|
+
"tags": [],
|
|
492
|
+
"text": ""
|
|
493
|
+
},
|
|
494
|
+
"attribute": "has-selected-element",
|
|
495
|
+
"reflect": true,
|
|
496
|
+
"defaultValue": "false"
|
|
497
|
+
},
|
|
498
|
+
"hideScreenshotButton": {
|
|
499
|
+
"type": "boolean",
|
|
500
|
+
"mutable": false,
|
|
501
|
+
"complexType": {
|
|
502
|
+
"original": "boolean",
|
|
503
|
+
"resolved": "boolean",
|
|
504
|
+
"references": {}
|
|
505
|
+
},
|
|
506
|
+
"required": false,
|
|
507
|
+
"optional": false,
|
|
508
|
+
"docs": {
|
|
509
|
+
"tags": [],
|
|
510
|
+
"text": ""
|
|
511
|
+
},
|
|
512
|
+
"attribute": "hide-screenshot-button",
|
|
513
|
+
"reflect": false,
|
|
514
|
+
"defaultValue": "false"
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
static get states() {
|
|
519
|
+
return {
|
|
520
|
+
"sending": {},
|
|
521
|
+
"formMessage": {},
|
|
522
|
+
"formEmail": {},
|
|
523
|
+
"formSuccess": {},
|
|
524
|
+
"formError": {},
|
|
525
|
+
"formErrorStatus": {},
|
|
526
|
+
"encodedScreenshot": {}
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './feedback-modal2.js';
|
|
2
3
|
|
|
3
4
|
const feedbackButtonCss = ".feedback-button-content{cursor:pointer;z-index:300}.feedback-button-content--light{align-items:center;background-color:var(--feedback-white-color);border-radius:20px;box-shadow:rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;box-sizing:border-box;display:flex;font-family:var(--feedback-font-family);color:var(--feedback-primary-color);font-weight:bold;padding:8px 15px;font-size:var(--feedback-text-font-size)}.feedback-button-content--dark{align-items:center;background-color:var(--feedback-primary-color);border-radius:20px;box-shadow:rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;box-sizing:border-box;display:flex;font-family:var(--feedback-font-family);color:var(--feedback-white-color);font-weight:bold;padding:8px 15px;font-size:16px}.feedback-button-content--bottom-right{position:fixed;bottom:10px;right:10px}.feedback-button-content--center-right{position:fixed;top:50%;transform:rotate(-90deg) translateY(-50%)}.feedback-button-content--center-right.feedback-button-content--dark,.feedback-button-content--center-right.feedback-button-content--light{border-radius:4px;border-bottom-right-radius:0px;border-bottom-left-radius:0px}.feedback-button-content-icon{margin-right:5px;height:16px;width:16px}";
|
|
4
5
|
|
|
5
|
-
const FeedbackButton = class {
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
6
|
+
const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
8
11
|
this.modalTitle = 'Share your feedback';
|
|
9
12
|
this.successModalTitle = 'Thanks for your feedback!';
|
|
10
13
|
this.errorModalTitle = "Oops! We didn't receive your feedback. Please try again later.";
|
|
@@ -57,8 +60,45 @@ const FeedbackButton = class {
|
|
|
57
60
|
render() {
|
|
58
61
|
return (h(Host, null, h("a", { class: `feedback-button-content feedback-button-content--${this.buttonStyle} feedback-button-content--${this.buttonPosition}`, onClick: () => this.showModal() }, !this.hideIcon && this.buttonStyle === 'dark' && (h("span", { class: "feedback-button-content-icon" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#fff", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "feather feather-repeat" }, h("polyline", { points: "17 1 21 5 17 9" }), h("path", { d: "M3 11V9a4 4 0 0 1 4-4h14" }), h("polyline", { points: "7 23 3 19 7 15" }), h("path", { d: "M21 13v2a4 4 0 0 1-4 4H3" })))), !this.hideIcon && this.buttonStyle === 'light' && (h("span", { class: "feedback-button-content-icon" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#0070F4", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "feather feather-repeat" }, h("polyline", { points: "17 1 21 5 17 9" }), h("path", { d: "M3 11V9a4 4 0 0 1 4-4h14" }), h("polyline", { points: "7 23 3 19 7 15" }), h("path", { d: "M21 13v2a4 4 0 0 1-4 4H3" })))), h("slot", null))));
|
|
59
62
|
}
|
|
60
|
-
get el() { return
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
+
get el() { return this; }
|
|
64
|
+
static get style() { return feedbackButtonCss; }
|
|
65
|
+
}, [1, "feedback-button", {
|
|
66
|
+
"modalTitle": [1, "modal-title"],
|
|
67
|
+
"successModalTitle": [1, "success-modal-title"],
|
|
68
|
+
"errorModalTitle": [1, "error-modal-title"],
|
|
69
|
+
"modalPosition": [1, "modal-position"],
|
|
70
|
+
"sendButtonText": [1, "send-button-text"],
|
|
71
|
+
"project": [1],
|
|
72
|
+
"screenshotButtonTooltipText": [1, "screenshot-button-tooltip-text"],
|
|
73
|
+
"screenshotTopbarText": [1, "screenshot-topbar-text"],
|
|
74
|
+
"email": [1],
|
|
75
|
+
"emailPlaceholder": [1, "email-placeholder"],
|
|
76
|
+
"messagePlaceholder": [1, "message-placeholder"],
|
|
77
|
+
"buttonStyle": [1, "button-style"],
|
|
78
|
+
"buttonPosition": [1, "button-position"],
|
|
79
|
+
"hideIcon": [4, "hide-icon"],
|
|
80
|
+
"hideScreenshotButton": [4, "hide-screenshot-button"]
|
|
81
|
+
}]);
|
|
82
|
+
function defineCustomElement$1() {
|
|
83
|
+
if (typeof customElements === "undefined") {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const components = ["feedback-button", "feedback-modal"];
|
|
87
|
+
components.forEach(tagName => { switch (tagName) {
|
|
88
|
+
case "feedback-button":
|
|
89
|
+
if (!customElements.get(tagName)) {
|
|
90
|
+
customElements.define(tagName, FeedbackButton$1);
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case "feedback-modal":
|
|
94
|
+
if (!customElements.get(tagName)) {
|
|
95
|
+
defineCustomElement$2();
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
} });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const FeedbackButton = FeedbackButton$1;
|
|
102
|
+
const defineCustomElement = defineCustomElement$1;
|
|
63
103
|
|
|
64
|
-
export { FeedbackButton
|
|
104
|
+
export { FeedbackButton, defineCustomElement };
|