pushfeedback 0.1.37 → 0.1.39

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