pushfeedback 0.1.42 → 0.1.44

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.
@@ -1 +1 @@
1
- export * from './components';
1
+ export * from './components';
@@ -1,163 +1,175 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { d as defineCustomElement$2 } from './feedback-modal2.js';
3
3
 
4
- const feedbackButtonCss = ".feedback-button-content{cursor:pointer;max-width:fit-content;z-index:var(--feedback-button-z-index)}.feedback-button-content--light{align-items:center;background-color:var(--feedback-button-light-bg-color);border-radius:var(--feedback-button-border-radius);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;color:var(--feedback-button-light-text-color);display:flex;font-family:var(--feedback-font-family);font-size:var(--feedback-button-text-font-size);font-weight:var(--feedback-button-text-font-weight);padding:8px 15px}.feedback-button-content--dark{align-items:center;background-color:var(--feedback-button-dark-bg-color);border-radius:var(--feedback-button-border-radius);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;color:var(--feedback-button-dark-text-color);display:flex;font-family:var(--feedback-font-family);font-weight:var(--feedback-button-text-font-weight);font-size:var(--feedback-button-text-font-size);padding:8px 15px}.feedback-button-content--bottom-right{bottom:10px;position:fixed;right:10px}.feedback-button-content--center-right{position:fixed;transform:rotate(-90deg) translateY(-50%);top:50%}.feedback-button-content--center-right.feedback-button-content--dark,.feedback-button-content--center-right.feedback-button-content--light{border-radius:4px;border-bottom-left-radius:0px;border-bottom-right-radius:0px}.feedback-button-content-icon{height:16px;margin-right:5px;width:16px}.feedback-button-content--center-right .feedback-button-content-icon{rotate:90deg}";
4
+ const feedbackButtonCss = ".feedback-button-content{cursor:pointer;max-width:fit-content;z-index:var(--feedback-button-z-index)}.feedback-button-content--light{align-items:center;background-color:var(--feedback-button-light-bg-color);border-radius:var(--feedback-button-border-radius);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;color:var(--feedback-button-light-text-color);display:flex;font-family:var(--feedback-font-family);font-size:var(--feedback-button-text-font-size);font-weight:var(--feedback-button-text-font-weight);padding:8px 15px}.feedback-button-content--dark{align-items:center;background-color:var(--feedback-button-dark-bg-color);border-radius:var(--feedback-button-border-radius);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;color:var(--feedback-button-dark-text-color);display:flex;font-family:var(--feedback-font-family);font-weight:var(--feedback-button-text-font-weight);font-size:var(--feedback-button-text-font-size);padding:8px 15px}.icon-edit{stroke:var(--feedback-button-light-text-color)}.feedback-button-content--dark .icon-edit{stroke:var(--feedback-button-dark-text-color)}.feedback-button-content--bottom-right{bottom:10px;position:fixed;right:10px}.feedback-button-content--center-right{position:fixed;transform:rotate(-90deg) translateY(-50%);top:50%}.feedback-button-content--center-right.feedback-button-content--dark,.feedback-button-content--center-right.feedback-button-content--light{border-radius:4px;border-bottom-left-radius:0px;border-bottom-right-radius:0px}.feedback-button-content-icon{height:16px;margin-right:5px;width:16px}.feedback-button-content--center-right .feedback-button-content-icon{rotate:90deg}";
5
5
 
6
- const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.__attachShadow();
11
- this.sessionId = "";
12
- this.customFont = false;
13
- this.errorMessage = "Please try again later.";
14
- this.errorMessage403 = "The request URL does not match the one defined in PushFeedback for this project.";
15
- this.errorMessage404 = "We could not find the provided project id in PushFeedback.";
16
- this.modalTitle = 'Share your feedback';
17
- this.modalTitleSuccess = 'Thanks for your feedback!';
18
- this.modalTitleError = "Oops!";
19
- this.modalPosition = 'center';
20
- this.sendButtonText = 'Send';
21
- this.successMessage = "";
22
- this.project = '';
23
- this.screenshotButtonText = 'Add a screenshot';
24
- this.screenshotTopbarText = 'Select an element on this page';
25
- this.hideEmail = false;
26
- this.emailAddress = '';
27
- this.emailPlaceholder = 'Email address (optional)';
28
- this.messagePlaceholder = 'Comments';
29
- this.hideRating = false;
30
- this.rating = undefined;
31
- this.ratingMode = 'thumbs';
32
- this.ratingPlaceholder = 'Was this page helpful?';
33
- this.ratingStarsPlaceholder = 'How would you rate this page?';
34
- this.buttonStyle = 'default';
35
- this.buttonPosition = 'default';
36
- this.hideIcon = false;
37
- this.hideScreenshotButton = false;
38
- this.hidePrivacyPolicy = true;
39
- this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
40
- this.fetchData = true;
41
- }
42
- connectedCallback() {
43
- this.feedbackModal = document.createElement('feedback-modal');
44
- const props = [
45
- 'sessionId',
46
- 'customFont',
47
- 'errorMessage',
48
- 'errorMessage403',
49
- 'errorMessage404',
50
- 'modalTitle',
51
- 'modalTitleSuccess',
52
- 'modalTitleError',
53
- 'modalPosition',
54
- 'sendButtonText',
55
- 'successMessage',
56
- 'project',
57
- 'screenshotButtonText',
58
- 'screenshotTopbarText',
59
- 'hideEmail',
60
- 'emailAddress',
61
- 'emailPlaceholder',
62
- 'messagePlaceholder',
63
- 'hideRating',
64
- 'rating',
65
- 'ratingMode',
66
- 'ratingPlaceholder',
67
- 'ratingStarsPlaceholder',
68
- 'hideScreenshotButton',
69
- 'hidePrivacyPolicy',
70
- 'privacyPolicyText',
71
- 'fetchData'
72
- ];
73
- props.forEach(prop => {
74
- this.feedbackModal[prop] = this[prop];
75
- });
76
- document.body.appendChild(this.feedbackModal);
77
- }
78
- disconnectedCallback() {
79
- document.body.removeChild(this.feedbackModal);
80
- }
81
- isSafariBrowser() {
82
- const isSafari = /safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent);
83
- return isSafari;
84
- }
85
- componentDidLoad() {
86
- if (this.buttonPosition === 'center-right') {
87
- const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
88
- let adjustement = 0;
89
- if (this.isSafariBrowser()) {
90
- adjustement = 10;
91
- }
92
- buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
93
- }
94
- if (!this.customFont) {
95
- this.loadInterFont();
96
- }
97
- }
98
- loadInterFont() {
99
- const link = document.createElement('link');
100
- link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
101
- link.rel = 'stylesheet';
102
- document.head.appendChild(link);
103
- }
104
- showModal() {
105
- this.feedbackModal.showModal = true;
106
- }
107
- render() {
108
- 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-edit-3" }, h("path", { d: "M12 20h9" }), h("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })))), !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-edit-3" }, h("path", { d: "M12 20h9" }), h("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })))), h("slot", null))));
109
- }
110
- get el() { return this; }
111
- static get style() { return feedbackButtonCss; }
112
- }, [1, "feedback-button", {
113
- "sessionId": [1, "session-id"],
114
- "customFont": [4, "custom-font"],
115
- "errorMessage": [1, "error-message"],
116
- "errorMessage403": [1, "error-message-4-0-3"],
117
- "errorMessage404": [1, "error-message-4-0-4"],
118
- "modalTitle": [1, "modal-title"],
119
- "modalTitleSuccess": [1, "modal-title-success"],
120
- "modalTitleError": [1, "modal-title-error"],
121
- "modalPosition": [1, "modal-position"],
122
- "sendButtonText": [1, "send-button-text"],
123
- "successMessage": [1, "success-message"],
124
- "project": [1],
125
- "screenshotButtonText": [1, "screenshot-button-text"],
126
- "screenshotTopbarText": [1, "screenshot-topbar-text"],
127
- "hideEmail": [4, "hide-email"],
128
- "emailAddress": [1, "email-address"],
129
- "emailPlaceholder": [1, "email-placeholder"],
130
- "messagePlaceholder": [1, "message-placeholder"],
131
- "hideRating": [4, "hide-rating"],
132
- "rating": [2],
133
- "ratingMode": [1, "rating-mode"],
134
- "ratingPlaceholder": [1, "rating-placeholder"],
135
- "ratingStarsPlaceholder": [1, "rating-stars-placeholder"],
136
- "buttonStyle": [1, "button-style"],
137
- "buttonPosition": [1, "button-position"],
138
- "hideIcon": [4, "hide-icon"],
139
- "hideScreenshotButton": [4, "hide-screenshot-button"],
140
- "hidePrivacyPolicy": [4, "hide-privacy-policy"],
141
- "privacyPolicyText": [1, "privacy-policy-text"],
142
- "fetchData": [4, "fetch-data"]
143
- }]);
144
- function defineCustomElement$1() {
145
- if (typeof customElements === "undefined") {
146
- return;
147
- }
148
- const components = ["feedback-button", "feedback-modal"];
149
- components.forEach(tagName => { switch (tagName) {
150
- case "feedback-button":
151
- if (!customElements.get(tagName)) {
152
- customElements.define(tagName, FeedbackButton$1);
153
- }
154
- break;
155
- case "feedback-modal":
156
- if (!customElements.get(tagName)) {
157
- defineCustomElement$2();
158
- }
159
- break;
160
- } });
6
+ const FeedbackButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.sessionId = "";
12
+ this.customFont = false;
13
+ this.errorMessage = "Please try again later.";
14
+ this.errorMessage403 = "The request URL does not match the one defined in PushFeedback for this project.";
15
+ this.errorMessage404 = "We could not find the provided project id in PushFeedback.";
16
+ this.modalTitle = 'Share your feedback';
17
+ this.modalTitleSuccess = 'Thanks for your feedback!';
18
+ this.modalTitleError = "Oops!";
19
+ this.modalPosition = 'center';
20
+ this.sendButtonText = 'Send';
21
+ this.successMessage = "";
22
+ this.project = '';
23
+ this.screenshotButtonText = 'Add a screenshot';
24
+ this.screenshotTopbarText = 'Select an element on this page';
25
+ this.hideEmail = false;
26
+ this.emailAddress = '';
27
+ this.emailPlaceholder = 'Email address (optional)';
28
+ this.messagePlaceholder = 'Comments';
29
+ this.hideRating = false;
30
+ this.rating = undefined;
31
+ this.ratingMode = 'thumbs';
32
+ this.ratingPlaceholder = 'Was this page helpful?';
33
+ this.ratingStarsPlaceholder = 'How would you rate this page?';
34
+ this.buttonStyle = 'default';
35
+ this.buttonPosition = 'default';
36
+ this.hideIcon = false;
37
+ this.hideScreenshotButton = false;
38
+ this.hidePrivacyPolicy = true;
39
+ this.privacyPolicyText = "I have read and expressly consent to the terms of the <a href='https://pushfeedback.com/privacy'>Privacy Policy</a>.";
40
+ this.fetchData = true;
41
+ }
42
+ componentWillLoad() {
43
+ if (!this.sessionId) {
44
+ let storedSessionId = localStorage.getItem('pushfeedback_sessionid');
45
+ if (!storedSessionId) {
46
+ storedSessionId = this.generateRandomSessionId();
47
+ localStorage.setItem('pushfeedback_sessionid', storedSessionId);
48
+ this.sessionId = storedSessionId;
49
+ }
50
+ }
51
+ }
52
+ componentDidLoad() {
53
+ if (this.buttonPosition === 'center-right') {
54
+ const buttonContent = this.el.shadowRoot.querySelector('.feedback-button-content');
55
+ let adjustement = 0;
56
+ if (this.isSafariBrowser()) {
57
+ adjustement = 10;
58
+ }
59
+ buttonContent.style.right = `${(buttonContent.offsetWidth + adjustement) / 2 * -1}px`;
60
+ }
61
+ if (!this.customFont) {
62
+ this.loadInterFont();
63
+ }
64
+ }
65
+ connectedCallback() {
66
+ this.feedbackModal = document.createElement('feedback-modal');
67
+ const props = [
68
+ 'customFont',
69
+ 'errorMessage',
70
+ 'errorMessage403',
71
+ 'errorMessage404',
72
+ 'modalTitle',
73
+ 'modalTitleSuccess',
74
+ 'modalTitleError',
75
+ 'modalPosition',
76
+ 'sendButtonText',
77
+ 'successMessage',
78
+ 'project',
79
+ 'screenshotButtonText',
80
+ 'screenshotTopbarText',
81
+ 'hideEmail',
82
+ 'emailAddress',
83
+ 'emailPlaceholder',
84
+ 'messagePlaceholder',
85
+ 'hideRating',
86
+ 'rating',
87
+ 'ratingMode',
88
+ 'ratingPlaceholder',
89
+ 'ratingStarsPlaceholder',
90
+ 'hideScreenshotButton',
91
+ 'hidePrivacyPolicy',
92
+ 'privacyPolicyText',
93
+ 'fetchData'
94
+ ];
95
+ props.forEach(prop => {
96
+ this.feedbackModal[prop] = this[prop];
97
+ });
98
+ document.body.appendChild(this.feedbackModal);
99
+ }
100
+ disconnectedCallback() {
101
+ document.body.removeChild(this.feedbackModal);
102
+ }
103
+ generateRandomSessionId(length = 16) {
104
+ return Math.random().toString(36).substr(2, length);
105
+ }
106
+ isSafariBrowser() {
107
+ const isSafari = /safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent);
108
+ return isSafari;
109
+ }
110
+ loadInterFont() {
111
+ const link = document.createElement('link');
112
+ link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
113
+ link.rel = 'stylesheet';
114
+ document.head.appendChild(link);
115
+ }
116
+ showModal() {
117
+ this.feedbackModal.showModal = true;
118
+ }
119
+ render() {
120
+ 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 && (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: "icon-edit" }, h("path", { d: "M12 20h9" }), h("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })))), h("slot", null))));
121
+ }
122
+ get el() { return this; }
123
+ static get style() { return feedbackButtonCss; }
124
+ }, [1, "feedback-button", {
125
+ "sessionId": [1537, "session-id"],
126
+ "customFont": [4, "custom-font"],
127
+ "errorMessage": [1, "error-message"],
128
+ "errorMessage403": [1, "error-message-4-0-3"],
129
+ "errorMessage404": [1, "error-message-4-0-4"],
130
+ "modalTitle": [1, "modal-title"],
131
+ "modalTitleSuccess": [1, "modal-title-success"],
132
+ "modalTitleError": [1, "modal-title-error"],
133
+ "modalPosition": [1, "modal-position"],
134
+ "sendButtonText": [1, "send-button-text"],
135
+ "successMessage": [1, "success-message"],
136
+ "project": [1],
137
+ "screenshotButtonText": [1, "screenshot-button-text"],
138
+ "screenshotTopbarText": [1, "screenshot-topbar-text"],
139
+ "hideEmail": [4, "hide-email"],
140
+ "emailAddress": [1, "email-address"],
141
+ "emailPlaceholder": [1, "email-placeholder"],
142
+ "messagePlaceholder": [1, "message-placeholder"],
143
+ "hideRating": [4, "hide-rating"],
144
+ "rating": [2],
145
+ "ratingMode": [1, "rating-mode"],
146
+ "ratingPlaceholder": [1, "rating-placeholder"],
147
+ "ratingStarsPlaceholder": [1, "rating-stars-placeholder"],
148
+ "buttonStyle": [1, "button-style"],
149
+ "buttonPosition": [1, "button-position"],
150
+ "hideIcon": [4, "hide-icon"],
151
+ "hideScreenshotButton": [4, "hide-screenshot-button"],
152
+ "hidePrivacyPolicy": [4, "hide-privacy-policy"],
153
+ "privacyPolicyText": [1, "privacy-policy-text"],
154
+ "fetchData": [4, "fetch-data"]
155
+ }]);
156
+ function defineCustomElement$1() {
157
+ if (typeof customElements === "undefined") {
158
+ return;
159
+ }
160
+ const components = ["feedback-button", "feedback-modal"];
161
+ components.forEach(tagName => { switch (tagName) {
162
+ case "feedback-button":
163
+ if (!customElements.get(tagName)) {
164
+ customElements.define(tagName, FeedbackButton$1);
165
+ }
166
+ break;
167
+ case "feedback-modal":
168
+ if (!customElements.get(tagName)) {
169
+ defineCustomElement$2();
170
+ }
171
+ break;
172
+ } });
161
173
  }
162
174
 
163
175
  const FeedbackButton = FeedbackButton$1;