pushfeedback 0.0.1
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/LICENSE +21 -0
- package/dist/cjs/feedback-button_2.cjs.entry.js +1024 -0
- package/dist/cjs/index-ecaab1ef.js +1466 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/pushfeedback.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/feedback-button/feedback-button.css +16 -0
- package/dist/collection/components/feedback-button/feedback-button.js +263 -0
- package/dist/collection/components/feedback-modal/feedback-modal.css +209 -0
- package/dist/collection/components/feedback-modal/feedback-modal.js +462 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/feedback-button.d.ts +11 -0
- package/dist/components/feedback-button.js +88 -0
- package/dist/components/feedback-modal.d.ts +11 -0
- package/dist/components/feedback-modal.js +6 -0
- package/dist/components/feedback-modal2.js +1007 -0
- package/dist/components/index.d.ts +23 -0
- package/dist/components/index.js +3 -0
- package/dist/esm/feedback-button_2.entry.js +1019 -0
- package/dist/esm/index-4051fc1e.js +1440 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -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 +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/pushfeedback/index.esm.js +0 -0
- package/dist/pushfeedback/p-a5896889.entry.js +1 -0
- package/dist/pushfeedback/p-e53ad7c2.js +2 -0
- package/dist/pushfeedback/pushfeedback.css +1 -0
- package/dist/pushfeedback/pushfeedback.esm.js +1 -0
- package/dist/types/components/feedback-button/feedback-button.d.ts +18 -0
- package/dist/types/components/feedback-modal/feedback-modal.d.ts +40 -0
- package/dist/types/components.d.ts +100 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1581 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +39 -0
- package/readme.md +75 -0
|
@@ -0,0 +1,462 @@
|
|
|
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.showScreenshotMode = false;
|
|
8
|
+
this.showModal = false;
|
|
9
|
+
this.sending = true;
|
|
10
|
+
let encodedScreenshot = "";
|
|
11
|
+
if (this.encodedScreenshot) {
|
|
12
|
+
await this.encodedScreenshot.then((data) => {
|
|
13
|
+
encodedScreenshot = data;
|
|
14
|
+
}).catch((error) => {
|
|
15
|
+
console.log(error);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetch('https://app.pushfeedback.com/api/feedback/', {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
body: JSON.stringify({
|
|
22
|
+
url: window.location.href,
|
|
23
|
+
message: this.formMessage,
|
|
24
|
+
email: this.formEmail,
|
|
25
|
+
project: this.project,
|
|
26
|
+
screenshot: encodedScreenshot
|
|
27
|
+
}),
|
|
28
|
+
headers: {
|
|
29
|
+
'Content-Type': 'application/json'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (res.status === 200) {
|
|
33
|
+
this.formSuccess = true;
|
|
34
|
+
this.formError = false;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.formSuccess = false;
|
|
38
|
+
this.formError = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
this.formSuccess = false;
|
|
43
|
+
this.formError = true;
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
this.sending = false;
|
|
47
|
+
this.showModal = true;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this.close = () => {
|
|
51
|
+
this.sending = false;
|
|
52
|
+
this.showModal = false;
|
|
53
|
+
this.showScreenshotMode = false;
|
|
54
|
+
this.hasSelectedElement = false;
|
|
55
|
+
this.encodedScreenshot = null;
|
|
56
|
+
this.formSuccess = false;
|
|
57
|
+
this.formError = false;
|
|
58
|
+
this.formMessage = '';
|
|
59
|
+
this.formEmail = '';
|
|
60
|
+
};
|
|
61
|
+
this.openScreenShot = () => {
|
|
62
|
+
this.hasSelectedElement = false;
|
|
63
|
+
this.showModal = false;
|
|
64
|
+
this.showScreenshotMode = true;
|
|
65
|
+
this.encodedScreenshot = null;
|
|
66
|
+
const page = document.getElementsByTagName('html')[0];
|
|
67
|
+
page.style.overflow = 'auto';
|
|
68
|
+
};
|
|
69
|
+
this.closeScreenShot = () => {
|
|
70
|
+
this.showModal = false;
|
|
71
|
+
this.showScreenshotMode = false;
|
|
72
|
+
this.hasSelectedElement = false;
|
|
73
|
+
this.encodedScreenshot = null;
|
|
74
|
+
this.overlay.style.display = 'none';
|
|
75
|
+
const page = document.getElementsByTagName('html')[0];
|
|
76
|
+
page.style.overflow = 'inherit';
|
|
77
|
+
};
|
|
78
|
+
this.handleMouseOverScreenShot = (event) => {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
if (this.hasSelectedElement)
|
|
81
|
+
return;
|
|
82
|
+
this.overlay.style.display = 'none';
|
|
83
|
+
this.screenshotModal.style.display = 'none';
|
|
84
|
+
const elementUnder = document.elementFromPoint(event.clientX, event.clientY);
|
|
85
|
+
const rect = elementUnder.getBoundingClientRect();
|
|
86
|
+
this.screenshotModal.style.display = '';
|
|
87
|
+
// Get the bounding box of the element selected
|
|
88
|
+
this.elementSelected.style.position = "absolute";
|
|
89
|
+
this.elementSelected.style.left = `${rect.left}px`;
|
|
90
|
+
this.elementSelected.style.top = `${rect.top}px`;
|
|
91
|
+
this.elementSelected.style.width = `${rect.width}px`;
|
|
92
|
+
this.elementSelected.style.height = `${rect.height}px`;
|
|
93
|
+
this.elementSelected.classList.add('feedback-modal-element-hover');
|
|
94
|
+
// Set the background color of nonselected areas
|
|
95
|
+
// Top
|
|
96
|
+
this.topSide.style.position = "absolute";
|
|
97
|
+
this.topSide.style.left = `${rect.left}px`;
|
|
98
|
+
this.topSide.style.top = '0px';
|
|
99
|
+
this.topSide.style.width = `${rect.width + 8}px`;
|
|
100
|
+
this.topSide.style.height = `${rect.top}px`;
|
|
101
|
+
this.topSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
102
|
+
// Left
|
|
103
|
+
this.leftSide.style.position = "absolute";
|
|
104
|
+
this.leftSide.style.left = '0px';
|
|
105
|
+
this.leftSide.style.top = '0px';
|
|
106
|
+
this.leftSide.style.width = `${rect.left}px`;
|
|
107
|
+
this.leftSide.style.height = '100vh';
|
|
108
|
+
this.leftSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
109
|
+
// Bottom
|
|
110
|
+
this.bottomSide.style.position = "absolute";
|
|
111
|
+
this.bottomSide.style.left = `${rect.left}px`;
|
|
112
|
+
this.bottomSide.style.top = `${rect.bottom + 8}px`;
|
|
113
|
+
this.bottomSide.style.width = `${rect.width + 8}px`;
|
|
114
|
+
this.bottomSide.style.height = '100vh';
|
|
115
|
+
this.bottomSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
116
|
+
// Right
|
|
117
|
+
this.rightSide.style.position = "absolute";
|
|
118
|
+
this.rightSide.style.left = `${rect.right + 8}px`;
|
|
119
|
+
;
|
|
120
|
+
this.rightSide.style.top = '0px';
|
|
121
|
+
this.rightSide.style.width = '100%';
|
|
122
|
+
this.rightSide.style.height = '100vh';
|
|
123
|
+
this.rightSide.style.backgroundColor = "rgba(0, 0, 0, 0.3)";
|
|
124
|
+
// Restore the visibility of the screenshot-modal
|
|
125
|
+
this.screenshotModal.style.backgroundColor = 'transparent';
|
|
126
|
+
};
|
|
127
|
+
this.handleMouseClickedSelectedElement = (event) => {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
if (this.elementSelected)
|
|
130
|
+
this.elementSelected.classList.add('feedback-modal-element-selected');
|
|
131
|
+
let top = this.elementSelected.getBoundingClientRect().top;
|
|
132
|
+
this.elementSelected.style.top = `${top + window.pageYOffset}px`;
|
|
133
|
+
const clonedElementSelected = this.elementSelected.cloneNode(true);
|
|
134
|
+
document.body.appendChild(clonedElementSelected);
|
|
135
|
+
this.elementSelected.style.top = `${top}px`;
|
|
136
|
+
this.encodedScreenshot = domtoimage.toPng(document.body, { cacheBust: true })
|
|
137
|
+
.then(function (dataUrl) {
|
|
138
|
+
document.body.removeChild(clonedElementSelected);
|
|
139
|
+
return dataUrl;
|
|
140
|
+
})
|
|
141
|
+
.catch(function (error) {
|
|
142
|
+
console.error('oops, something went wrong!', error);
|
|
143
|
+
return "";
|
|
144
|
+
});
|
|
145
|
+
const page = document.getElementsByTagName('html')[0];
|
|
146
|
+
page.style.overflow = 'hidden';
|
|
147
|
+
this.hasSelectedElement = true;
|
|
148
|
+
this.overlay.style.display = 'block';
|
|
149
|
+
this.showModal = true;
|
|
150
|
+
};
|
|
151
|
+
this.sending = false;
|
|
152
|
+
this.formMessage = '';
|
|
153
|
+
this.formEmail = '';
|
|
154
|
+
this.formSuccess = false;
|
|
155
|
+
this.formError = false;
|
|
156
|
+
this.encodedScreenshot = undefined;
|
|
157
|
+
this.modalTitle = 'Share your feedback';
|
|
158
|
+
this.successModalTitle = 'Thanks for your feedback!';
|
|
159
|
+
this.errorModalTitle = "Oops! We didn't receive your feedback. Please try again later.";
|
|
160
|
+
this.modalPosition = 'center';
|
|
161
|
+
this.sendButtonText = 'Send';
|
|
162
|
+
this.project = '';
|
|
163
|
+
this.screenshotButtonTooltipText = 'Take a Screenshot';
|
|
164
|
+
this.screenshotTopbarText = 'SELECT AN ELEMENT ON THE PAGE';
|
|
165
|
+
this.email = '';
|
|
166
|
+
this.emailPlaceholder = 'Email address (optional)';
|
|
167
|
+
this.messagePlaceholder = 'How could this page be more helpful?';
|
|
168
|
+
this.showModal = false;
|
|
169
|
+
this.showScreenshotMode = false;
|
|
170
|
+
this.hasSelectedElement = false;
|
|
171
|
+
}
|
|
172
|
+
componentWillLoad() {
|
|
173
|
+
this.formEmail = this.email;
|
|
174
|
+
}
|
|
175
|
+
handleMessageInput(event) {
|
|
176
|
+
this.formMessage = event.target.value;
|
|
177
|
+
}
|
|
178
|
+
handleEmailInput(event) {
|
|
179
|
+
this.formEmail = event.target.value;
|
|
180
|
+
}
|
|
181
|
+
render() {
|
|
182
|
+
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.successModalTitle)) : this.formError ? (h("span", { class: "text-center" }, this.errorModalTitle)) : 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" }, 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")))))));
|
|
183
|
+
}
|
|
184
|
+
static get is() { return "feedback-modal"; }
|
|
185
|
+
static get encapsulation() { return "shadow"; }
|
|
186
|
+
static get originalStyleUrls() {
|
|
187
|
+
return {
|
|
188
|
+
"$": ["feedback-modal.css"]
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
static get styleUrls() {
|
|
192
|
+
return {
|
|
193
|
+
"$": ["feedback-modal.css"]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static get properties() {
|
|
197
|
+
return {
|
|
198
|
+
"modalTitle": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"mutable": false,
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "string",
|
|
203
|
+
"resolved": "string",
|
|
204
|
+
"references": {}
|
|
205
|
+
},
|
|
206
|
+
"required": false,
|
|
207
|
+
"optional": false,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": ""
|
|
211
|
+
},
|
|
212
|
+
"attribute": "modal-title",
|
|
213
|
+
"reflect": false,
|
|
214
|
+
"defaultValue": "'Share your feedback'"
|
|
215
|
+
},
|
|
216
|
+
"successModalTitle": {
|
|
217
|
+
"type": "string",
|
|
218
|
+
"mutable": false,
|
|
219
|
+
"complexType": {
|
|
220
|
+
"original": "string",
|
|
221
|
+
"resolved": "string",
|
|
222
|
+
"references": {}
|
|
223
|
+
},
|
|
224
|
+
"required": false,
|
|
225
|
+
"optional": false,
|
|
226
|
+
"docs": {
|
|
227
|
+
"tags": [],
|
|
228
|
+
"text": ""
|
|
229
|
+
},
|
|
230
|
+
"attribute": "success-modal-title",
|
|
231
|
+
"reflect": false,
|
|
232
|
+
"defaultValue": "'Thanks for your feedback!'"
|
|
233
|
+
},
|
|
234
|
+
"errorModalTitle": {
|
|
235
|
+
"type": "string",
|
|
236
|
+
"mutable": false,
|
|
237
|
+
"complexType": {
|
|
238
|
+
"original": "string",
|
|
239
|
+
"resolved": "string",
|
|
240
|
+
"references": {}
|
|
241
|
+
},
|
|
242
|
+
"required": false,
|
|
243
|
+
"optional": false,
|
|
244
|
+
"docs": {
|
|
245
|
+
"tags": [],
|
|
246
|
+
"text": ""
|
|
247
|
+
},
|
|
248
|
+
"attribute": "error-modal-title",
|
|
249
|
+
"reflect": false,
|
|
250
|
+
"defaultValue": "\"Oops! We didn't receive your feedback. Please try again later.\""
|
|
251
|
+
},
|
|
252
|
+
"modalPosition": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"mutable": false,
|
|
255
|
+
"complexType": {
|
|
256
|
+
"original": "string",
|
|
257
|
+
"resolved": "string",
|
|
258
|
+
"references": {}
|
|
259
|
+
},
|
|
260
|
+
"required": false,
|
|
261
|
+
"optional": false,
|
|
262
|
+
"docs": {
|
|
263
|
+
"tags": [],
|
|
264
|
+
"text": ""
|
|
265
|
+
},
|
|
266
|
+
"attribute": "modal-position",
|
|
267
|
+
"reflect": false,
|
|
268
|
+
"defaultValue": "'center'"
|
|
269
|
+
},
|
|
270
|
+
"sendButtonText": {
|
|
271
|
+
"type": "string",
|
|
272
|
+
"mutable": false,
|
|
273
|
+
"complexType": {
|
|
274
|
+
"original": "string",
|
|
275
|
+
"resolved": "string",
|
|
276
|
+
"references": {}
|
|
277
|
+
},
|
|
278
|
+
"required": false,
|
|
279
|
+
"optional": false,
|
|
280
|
+
"docs": {
|
|
281
|
+
"tags": [],
|
|
282
|
+
"text": ""
|
|
283
|
+
},
|
|
284
|
+
"attribute": "send-button-text",
|
|
285
|
+
"reflect": false,
|
|
286
|
+
"defaultValue": "'Send'"
|
|
287
|
+
},
|
|
288
|
+
"project": {
|
|
289
|
+
"type": "string",
|
|
290
|
+
"mutable": false,
|
|
291
|
+
"complexType": {
|
|
292
|
+
"original": "string",
|
|
293
|
+
"resolved": "string",
|
|
294
|
+
"references": {}
|
|
295
|
+
},
|
|
296
|
+
"required": false,
|
|
297
|
+
"optional": false,
|
|
298
|
+
"docs": {
|
|
299
|
+
"tags": [],
|
|
300
|
+
"text": ""
|
|
301
|
+
},
|
|
302
|
+
"attribute": "project",
|
|
303
|
+
"reflect": false,
|
|
304
|
+
"defaultValue": "''"
|
|
305
|
+
},
|
|
306
|
+
"screenshotButtonTooltipText": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"mutable": false,
|
|
309
|
+
"complexType": {
|
|
310
|
+
"original": "string",
|
|
311
|
+
"resolved": "string",
|
|
312
|
+
"references": {}
|
|
313
|
+
},
|
|
314
|
+
"required": false,
|
|
315
|
+
"optional": false,
|
|
316
|
+
"docs": {
|
|
317
|
+
"tags": [],
|
|
318
|
+
"text": ""
|
|
319
|
+
},
|
|
320
|
+
"attribute": "screenshot-button-tooltip-text",
|
|
321
|
+
"reflect": false,
|
|
322
|
+
"defaultValue": "'Take a Screenshot'"
|
|
323
|
+
},
|
|
324
|
+
"screenshotTopbarText": {
|
|
325
|
+
"type": "string",
|
|
326
|
+
"mutable": false,
|
|
327
|
+
"complexType": {
|
|
328
|
+
"original": "string",
|
|
329
|
+
"resolved": "string",
|
|
330
|
+
"references": {}
|
|
331
|
+
},
|
|
332
|
+
"required": false,
|
|
333
|
+
"optional": false,
|
|
334
|
+
"docs": {
|
|
335
|
+
"tags": [],
|
|
336
|
+
"text": ""
|
|
337
|
+
},
|
|
338
|
+
"attribute": "screenshot-topbar-text",
|
|
339
|
+
"reflect": false,
|
|
340
|
+
"defaultValue": "'SELECT AN ELEMENT ON THE PAGE'"
|
|
341
|
+
},
|
|
342
|
+
"email": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"mutable": false,
|
|
345
|
+
"complexType": {
|
|
346
|
+
"original": "string",
|
|
347
|
+
"resolved": "string",
|
|
348
|
+
"references": {}
|
|
349
|
+
},
|
|
350
|
+
"required": false,
|
|
351
|
+
"optional": false,
|
|
352
|
+
"docs": {
|
|
353
|
+
"tags": [],
|
|
354
|
+
"text": ""
|
|
355
|
+
},
|
|
356
|
+
"attribute": "email",
|
|
357
|
+
"reflect": false,
|
|
358
|
+
"defaultValue": "''"
|
|
359
|
+
},
|
|
360
|
+
"emailPlaceholder": {
|
|
361
|
+
"type": "string",
|
|
362
|
+
"mutable": false,
|
|
363
|
+
"complexType": {
|
|
364
|
+
"original": "string",
|
|
365
|
+
"resolved": "string",
|
|
366
|
+
"references": {}
|
|
367
|
+
},
|
|
368
|
+
"required": false,
|
|
369
|
+
"optional": false,
|
|
370
|
+
"docs": {
|
|
371
|
+
"tags": [],
|
|
372
|
+
"text": ""
|
|
373
|
+
},
|
|
374
|
+
"attribute": "email-placeholder",
|
|
375
|
+
"reflect": false,
|
|
376
|
+
"defaultValue": "'Email address (optional)'"
|
|
377
|
+
},
|
|
378
|
+
"messagePlaceholder": {
|
|
379
|
+
"type": "string",
|
|
380
|
+
"mutable": false,
|
|
381
|
+
"complexType": {
|
|
382
|
+
"original": "string",
|
|
383
|
+
"resolved": "string",
|
|
384
|
+
"references": {}
|
|
385
|
+
},
|
|
386
|
+
"required": false,
|
|
387
|
+
"optional": false,
|
|
388
|
+
"docs": {
|
|
389
|
+
"tags": [],
|
|
390
|
+
"text": ""
|
|
391
|
+
},
|
|
392
|
+
"attribute": "message-placeholder",
|
|
393
|
+
"reflect": false,
|
|
394
|
+
"defaultValue": "'How could this page be more helpful?'"
|
|
395
|
+
},
|
|
396
|
+
"showModal": {
|
|
397
|
+
"type": "boolean",
|
|
398
|
+
"mutable": true,
|
|
399
|
+
"complexType": {
|
|
400
|
+
"original": "boolean",
|
|
401
|
+
"resolved": "boolean",
|
|
402
|
+
"references": {}
|
|
403
|
+
},
|
|
404
|
+
"required": false,
|
|
405
|
+
"optional": false,
|
|
406
|
+
"docs": {
|
|
407
|
+
"tags": [],
|
|
408
|
+
"text": ""
|
|
409
|
+
},
|
|
410
|
+
"attribute": "show-modal",
|
|
411
|
+
"reflect": true,
|
|
412
|
+
"defaultValue": "false"
|
|
413
|
+
},
|
|
414
|
+
"showScreenshotMode": {
|
|
415
|
+
"type": "boolean",
|
|
416
|
+
"mutable": true,
|
|
417
|
+
"complexType": {
|
|
418
|
+
"original": "boolean",
|
|
419
|
+
"resolved": "boolean",
|
|
420
|
+
"references": {}
|
|
421
|
+
},
|
|
422
|
+
"required": false,
|
|
423
|
+
"optional": false,
|
|
424
|
+
"docs": {
|
|
425
|
+
"tags": [],
|
|
426
|
+
"text": ""
|
|
427
|
+
},
|
|
428
|
+
"attribute": "show-screenshot-mode",
|
|
429
|
+
"reflect": true,
|
|
430
|
+
"defaultValue": "false"
|
|
431
|
+
},
|
|
432
|
+
"hasSelectedElement": {
|
|
433
|
+
"type": "boolean",
|
|
434
|
+
"mutable": true,
|
|
435
|
+
"complexType": {
|
|
436
|
+
"original": "boolean",
|
|
437
|
+
"resolved": "boolean",
|
|
438
|
+
"references": {}
|
|
439
|
+
},
|
|
440
|
+
"required": false,
|
|
441
|
+
"optional": false,
|
|
442
|
+
"docs": {
|
|
443
|
+
"tags": [],
|
|
444
|
+
"text": ""
|
|
445
|
+
},
|
|
446
|
+
"attribute": "has-selected-element",
|
|
447
|
+
"reflect": true,
|
|
448
|
+
"defaultValue": "false"
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
static get states() {
|
|
453
|
+
return {
|
|
454
|
+
"sending": {},
|
|
455
|
+
"formMessage": {},
|
|
456
|
+
"formEmail": {},
|
|
457
|
+
"formSuccess": {},
|
|
458
|
+
"formError": {},
|
|
459
|
+
"encodedScreenshot": {}
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface FeedbackButton extends Components.FeedbackButton, HTMLElement {}
|
|
4
|
+
export const FeedbackButton: {
|
|
5
|
+
prototype: FeedbackButton;
|
|
6
|
+
new (): FeedbackButton;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './feedback-modal2.js';
|
|
3
|
+
|
|
4
|
+
const feedbackButtonCss = ".feedback-button-content{cursor:pointer;background-color:var(--feedback-button-bg-color);border:1px solid var(--feedback-button-border-color);border-radius:var(--feedback-button-border-radius);color:var(--feedback-button-text-color);cursor:pointer;font-size:var(--feedback-modal-button-font-size);padding:5px 10px}.feedback-button-content:hover{color:var(--feedback-button-text-color-active);background-color:var(--feedback-button-bg-color-active);border:1px solid var(--feedback-button-border-color-active)}";
|
|
5
|
+
|
|
6
|
+
const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.feedbackModal = undefined;
|
|
12
|
+
this.modalTitle = 'Share your feedback';
|
|
13
|
+
this.successModalTitle = 'Thanks for your feedback!';
|
|
14
|
+
this.errorModalTitle = "Oops! We didn't receive your feedback. Please try again later.";
|
|
15
|
+
this.modalPosition = 'center';
|
|
16
|
+
this.sendButtonText = 'Send';
|
|
17
|
+
this.project = '';
|
|
18
|
+
this.screenshotButtonTooltipText = 'Take a Screenshot';
|
|
19
|
+
this.screenshotTopbarText = 'SELECT AN ELEMENT ON THE PAGE';
|
|
20
|
+
this.email = '';
|
|
21
|
+
this.emailPlaceholder = 'Email address (optional)';
|
|
22
|
+
this.messagePlaceholder = 'How could this page be more helpful?';
|
|
23
|
+
}
|
|
24
|
+
componentDidLoad() {
|
|
25
|
+
this.feedbackModal.showModal = false;
|
|
26
|
+
}
|
|
27
|
+
showModal() {
|
|
28
|
+
this.feedbackModal.showModal = true;
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const propKeys = [
|
|
32
|
+
'modalTitle',
|
|
33
|
+
'successModalTitle',
|
|
34
|
+
'errorModalTitle',
|
|
35
|
+
'modalPosition',
|
|
36
|
+
'sendButtonText',
|
|
37
|
+
'project',
|
|
38
|
+
'screenshotButtonTooltipText',
|
|
39
|
+
'screenshotTopbarText',
|
|
40
|
+
'email',
|
|
41
|
+
'emailPlaceholder',
|
|
42
|
+
'messagePlaceholder',
|
|
43
|
+
'showModal',
|
|
44
|
+
];
|
|
45
|
+
let feedbackModalProps = {};
|
|
46
|
+
propKeys.forEach((key) => {
|
|
47
|
+
feedbackModalProps[key] = this[key];
|
|
48
|
+
});
|
|
49
|
+
return (h(Host, null, h("a", { class: "feedback-button-content", onClick: () => this.showModal() }, h("slot", null)), h("feedback-modal", Object.assign({}, feedbackModalProps, { ref: (el) => this.feedbackModal = el }))));
|
|
50
|
+
}
|
|
51
|
+
static get style() { return feedbackButtonCss; }
|
|
52
|
+
}, [1, "feedback-button", {
|
|
53
|
+
"modalTitle": [1, "modal-title"],
|
|
54
|
+
"successModalTitle": [1, "success-modal-title"],
|
|
55
|
+
"errorModalTitle": [1, "error-modal-title"],
|
|
56
|
+
"modalPosition": [1, "modal-position"],
|
|
57
|
+
"sendButtonText": [1, "send-button-text"],
|
|
58
|
+
"project": [1],
|
|
59
|
+
"screenshotButtonTooltipText": [1, "screenshot-button-tooltip-text"],
|
|
60
|
+
"screenshotTopbarText": [1, "screenshot-topbar-text"],
|
|
61
|
+
"email": [1],
|
|
62
|
+
"emailPlaceholder": [1, "email-placeholder"],
|
|
63
|
+
"messagePlaceholder": [1, "message-placeholder"],
|
|
64
|
+
"feedbackModal": [32]
|
|
65
|
+
}]);
|
|
66
|
+
function defineCustomElement$1() {
|
|
67
|
+
if (typeof customElements === "undefined") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const components = ["feedback-button", "feedback-modal"];
|
|
71
|
+
components.forEach(tagName => { switch (tagName) {
|
|
72
|
+
case "feedback-button":
|
|
73
|
+
if (!customElements.get(tagName)) {
|
|
74
|
+
customElements.define(tagName, FeedbackButton$1);
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case "feedback-modal":
|
|
78
|
+
if (!customElements.get(tagName)) {
|
|
79
|
+
defineCustomElement$2();
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
} });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const FeedbackButton = FeedbackButton$1;
|
|
86
|
+
const defineCustomElement = defineCustomElement$1;
|
|
87
|
+
|
|
88
|
+
export { FeedbackButton, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface FeedbackModal extends Components.FeedbackModal, HTMLElement {}
|
|
4
|
+
export const FeedbackModal: {
|
|
5
|
+
prototype: FeedbackModal;
|
|
6
|
+
new (): FeedbackModal;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|