@fullsession.io/fs-feedback-widget 1.7.2 → 1.7.4

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/package.json CHANGED
@@ -1,32 +1,32 @@
1
- {
2
- "name": "@fullsession.io/fs-feedback-widget",
3
- "version": "1.7.2",
4
- "scripts": {
5
- "build": "rollup -c",
6
- "dev": "rollup -c -w",
7
- "start": "sirv public --no-clear",
8
- "prepublish": "npm run build",
9
- "prepublishOnly": "npm run build"
10
- },
11
- "devDependencies": {
12
- "@rollup/plugin-commonjs": "^17.0.0",
13
- "@rollup/plugin-node-resolve": "^11.0.0",
14
- "rollup": "^2.3.4",
15
- "rollup-plugin-css-only": "^3.1.0",
16
- "rollup-plugin-livereload": "^2.0.0",
17
- "rollup-plugin-svelte": "^7.0.0",
18
- "rollup-plugin-terser": "^7.0.0",
19
- "svelte": "^3.0.0"
20
- },
21
- "dependencies": {
22
- "rollup-plugin-postcss": "^4.0.2",
23
- "sirv-cli": "^2.0.2"
24
- },
25
- "files": [
26
- "src",
27
- "dist"
28
- ],
29
- "main": "dist/index.js",
30
- "module": "dist/index.mjs",
31
- "unpkg": "dist/index.js"
1
+ {
2
+ "name": "@fullsession.io/fs-feedback-widget",
3
+ "version": "1.7.4",
4
+ "scripts": {
5
+ "build": "rollup -c",
6
+ "dev": "rollup -c -w",
7
+ "start": "sirv public --no-clear",
8
+ "prepublish": "npm run build",
9
+ "prepublishOnly": "npm run build"
10
+ },
11
+ "devDependencies": {
12
+ "@rollup/plugin-commonjs": "^17.0.0",
13
+ "@rollup/plugin-node-resolve": "^11.0.0",
14
+ "rollup": "^2.3.4",
15
+ "rollup-plugin-css-only": "^3.1.0",
16
+ "rollup-plugin-livereload": "^2.0.0",
17
+ "rollup-plugin-svelte": "^7.0.0",
18
+ "rollup-plugin-terser": "^7.0.0",
19
+ "svelte": "^3.0.0"
20
+ },
21
+ "dependencies": {
22
+ "rollup-plugin-postcss": "^4.0.2",
23
+ "sirv-cli": "^2.0.2"
24
+ },
25
+ "files": [
26
+ "src",
27
+ "dist"
28
+ ],
29
+ "main": "dist/index.js",
30
+ "module": "dist/index.mjs",
31
+ "unpkg": "dist/index.js"
32
32
  }
package/src/App.svelte CHANGED
@@ -1,246 +1,247 @@
1
- <script>
2
- import MainIcon from "./Icons/mainIcon.svelte";
3
- import ReactionPage from "./widgetPages/reactionPage.svelte";
4
- export let feedback;
5
- export let widgetPosition;
6
- import { fly } from "svelte/transition";
7
- import "../src/widgetPages/App.css";
8
-
9
- $: widgetColor = feedback.wgAccentColor;
10
- $: widgetDisplayMode = feedback.wgDisplayMode;
11
- $: widgetType = feedback.wgType;
12
- $: widgetLanguage = feedback.wgLanguage;
13
- $: widgetAlternateColor = feedback.wgAlternateColor;
14
- $: wgPosition = feedback.wgPosition;
15
- $: widgetThanksMsg = feedback.wgThanksMsg;
16
- $: document.documentElement.style.setProperty("--widgetColor", widgetColor);
17
-
18
- let widgetTextColor = "";
19
- let iconColor = "";
20
- let widgetName = "Feedback";
21
- $: if (widgetLanguage == "en") {
22
- widgetName = " Feedback";
23
- } else if (widgetLanguage == "ar") {
24
- widgetName = "رأي";
25
- } else {
26
- widgetName = "Rétroaction";
27
- }
28
-
29
- $: if (widgetAlternateColor === true) {
30
- widgetTextColor = "white";
31
- iconColor = "white";
32
- } else {
33
- widgetTextColor = "black";
34
- iconColor = "black";
35
- }
36
-
37
- $: document.documentElement.style.setProperty(
38
- "--widgetTextColor",
39
- widgetTextColor
40
- );
41
-
42
- let wgPositionHorizintal = "";
43
- let wgPositionVertical = "";
44
- let widgetLeftSideBorder = 0;
45
- let widgetRightSideBorder = 0;
46
- let widgetMarginRight = 0;
47
- let widgetMarginLeft = 0;
48
- let visible = false;
49
- let buttonVisible = true;
50
- let thanksMessageVisible = false;
51
- let inTransitionX = 0;
52
- let outTransitionX = 0;
53
- let positionState = "";
54
-
55
- if (widgetPosition == "fixed") {
56
- positionState = "fixed";
57
- } else {
58
- positionState = "absolute";
59
- }
60
- $: document.documentElement.style.setProperty(
61
- "--positionState",
62
- positionState
63
- );
64
- $: if (Number(wgPosition) == 0) {
65
- wgPositionHorizintal = "center";
66
- wgPositionVertical = "row-reverse";
67
- widgetLeftSideBorder = 5;
68
- widgetRightSideBorder = 0;
69
- widgetMarginRight = 30;
70
- widgetMarginLeft = 0;
71
- inTransitionX = -100;
72
- outTransitionX = 20;
73
- } else if (Number(wgPosition) == 1) {
74
- wgPositionHorizintal = "center";
75
- wgPositionVertical = "row";
76
- widgetLeftSideBorder = 0;
77
- widgetRightSideBorder = 5;
78
- widgetMarginRight = 0;
79
- widgetMarginLeft = 30;
80
- inTransitionX = 100;
81
- outTransitionX = -20;
82
- } else if (Number(wgPosition) == 2) {
83
- wgPositionHorizintal = "flex-end";
84
- wgPositionVertical = "row-reverse";
85
- widgetLeftSideBorder = 5;
86
- widgetMarginRight = 30;
87
- widgetMarginLeft = 0;
88
- inTransitionX = -100;
89
- outTransitionX = 20;
90
- } else if (Number(wgPosition) == 3) {
91
- wgPositionHorizintal = "flex-end";
92
- wgPositionVertical = "row";
93
- widgetLeftSideBorder = 0;
94
- widgetRightSideBorder = 5;
95
- widgetMarginRight = 0;
96
- widgetMarginLeft = 30;
97
- inTransitionX = 100;
98
- outTransitionX = -20;
99
- }
100
- $: document.documentElement.style.setProperty(
101
- "--wgPositionHorizintal",
102
- wgPositionHorizintal
103
- );
104
- $: document.documentElement.style.setProperty(
105
- "--wgPositionVertical",
106
- wgPositionVertical
107
- );
108
- $: document.documentElement.style.setProperty(
109
- "--widgetLeftSideBorder",
110
- widgetLeftSideBorder + "px"
111
- );
112
- $: document.documentElement.style.setProperty(
113
- "--widgetRightSideBorder",
114
- widgetRightSideBorder + "px"
115
- );
116
- $: document.documentElement.style.setProperty(
117
- "--widgetMarginRight",
118
- widgetMarginRight + "px"
119
- );
120
- $: document.documentElement.style.setProperty(
121
- "--widgetMarginLeft",
122
- widgetMarginLeft + "px"
123
- );
124
-
125
- let userClosedWidget = 0;
126
- let emailx = "";
127
- let commentx = "";
128
- let reactionTypex = "";
129
- const closeOne = (email, comment, reactionType, questionAnswer) => {
130
- let widgetResponse;
131
- if (widgetType === 0) {
132
- widgetResponse = {
133
- email: email,
134
- comment: comment,
135
- reaction: Number(reactionType),
136
- type: widgetType,
137
- };
138
- } else {
139
- widgetResponse = {
140
- email: email,
141
- questionAnswer: questionAnswer,
142
- type: widgetType,
143
- };
144
- }
145
-
146
- let event = new CustomEvent("fbEvent", {
147
- bubbles: false,
148
- detail: widgetResponse,
149
- });
150
-
151
- window.dispatchEvent(event);
152
- openThanksMessage();
153
- };
154
-
155
- // const closeBeforeFinsihing = (email, comment, reactionType) => {
156
- // emailx = email;
157
- // commentx = comment;
158
- // reactionTypex = Number(reactionType);
159
- // let widgetResponse = {
160
- // email: email,
161
- // comment: comment,
162
- // reaction: reactionType,
163
- // };
164
- // if (userClosedWidget == 1) {
165
- // console.log("hi", widgetResponse);
166
- // let event = new CustomEvent("fbEvent", {
167
- // bubbles: false,
168
- // detail: widgetResponse,
169
- // });
170
- // window.dispatchEvent(event);
171
- // console.log(widgetResponse);
172
- // }
173
- // };
174
-
175
- const openThanksMessage = () => {
176
- visible = !visible;
177
- thanksMessageVisible = !thanksMessageVisible;
178
- };
179
-
180
- const closeThanksMessage = () => {
181
- thanksMessageVisible = !thanksMessageVisible;
182
- setTimeout(function () {
183
- buttonVisible = !buttonVisible;
184
- }, 350);
185
- };
186
-
187
- const openWidget = () => {
188
- visible = !visible;
189
- buttonVisible = !buttonVisible;
190
- };
191
-
192
- const closeWidget = () => {
193
- userClosedWidget = 1;
194
- if (reactionTypex != 0) {
195
- closeBeforeFinsihing(emailx, commentx, reactionTypex);
196
- }
197
- visible = !visible;
198
- setTimeout(function () {
199
- buttonVisible = !buttonVisible;
200
- }, 350);
201
- };
202
- </script>
203
-
204
- <fsContainer
205
- class={!buttonVisible && widgetDisplayMode == 1 ? "modal" : "side"}
206
- style="position: 10px"
207
- >
208
- {#if buttonVisible}
209
- <div class="fsWidget" on:click={openWidget}>
210
- <div id="fsFeedbackTxt">{widgetName}</div>
211
- <div id="fsMainIcon">
212
- <MainIcon bind:fill={iconColor} />
213
- </div>
214
- </div>
215
- {/if}
216
-
217
- {#if visible}
218
- <div
219
- class="fsCont"
220
- class:fsContModal={widgetDisplayMode === 1}
221
- in:fly={{ x: inTransitionX, duration: 500 }}
222
- >
223
- <div class="fsCloseCont" on:click={closeWidget}>
224
- <p id="fsCloseIcon">X</p>
225
- </div>
226
- <ReactionPage
227
- closeHandler={closeOne}
228
- bind:feedbackData={feedback}
229
- bind:wgType={widgetType}
230
- />
231
- </div>
232
- {/if}
233
- {#if thanksMessageVisible}
234
- <div
235
- class="fsThanksMessageCont"
236
- out:fly={{ x: outTransitionX, duration: 300 }}
237
- >
238
- <div class="fsCloseCont" on:click={closeThanksMessage}>
239
- <p id="fsCloseIcon">X</p>
240
- </div>
241
- <div class="thanks-txt">
242
- {widgetThanksMsg}
243
- </div>
244
- </div>
245
- {/if}
246
- </fsContainer>
1
+ <script>
2
+ import MainIcon from "./Icons/mainIcon.svelte";
3
+ import ReactionPage from "./widgetPages/reactionPage.svelte";
4
+ export let feedback;
5
+ export let widgetPosition;
6
+ import { fly } from "svelte/transition";
7
+ import "../src/widgetPages/App.css";
8
+
9
+ $: widgetColor = feedback.wgAccentColor;
10
+ $: widgetDisplayMode = feedback.wgDisplayMode;
11
+ $: widgetType = feedback.wgType;
12
+ $: widgetLanguage = feedback.wgLanguage;
13
+ $: widgetAlternateColor = feedback.wgAlternateColor;
14
+ $: wgPosition = feedback.wgPosition;
15
+ $: widgetThanksMsg = feedback.wgThanksMsg;
16
+ $: document.documentElement.style.setProperty("--widgetColor", widgetColor);
17
+
18
+ let widgetTextColor = "";
19
+ let iconColor = "";
20
+ let widgetName = "Feedback";
21
+ $: if (widgetLanguage == "en") {
22
+ widgetName = " Feedback";
23
+ } else if (widgetLanguage == "ar") {
24
+ widgetName = "رأي";
25
+ } else {
26
+ widgetName = "Rétroaction";
27
+ }
28
+
29
+ $: if (widgetAlternateColor === true) {
30
+ widgetTextColor = "white";
31
+ iconColor = "white";
32
+ } else {
33
+ widgetTextColor = "black";
34
+ iconColor = "black";
35
+ }
36
+
37
+ $: document.documentElement.style.setProperty(
38
+ "--widgetTextColor",
39
+ widgetTextColor
40
+ );
41
+
42
+ let wgPositionHorizintal = "";
43
+ let wgPositionVertical = "";
44
+ let widgetLeftSideBorder = 0;
45
+ let widgetRightSideBorder = 0;
46
+ let widgetMarginRight = 0;
47
+ let widgetMarginLeft = 0;
48
+ let visible = false;
49
+ let buttonVisible = true;
50
+ let thanksMessageVisible = false;
51
+ let inTransitionX = 0;
52
+ let outTransitionX = 0;
53
+ let positionState = "";
54
+
55
+ if (widgetPosition == "fixed") {
56
+ positionState = "fixed";
57
+ } else {
58
+ positionState = "absolute";
59
+ }
60
+ $: document.documentElement.style.setProperty(
61
+ "--positionState",
62
+ positionState
63
+ );
64
+ $: if (Number(wgPosition) == 0) {
65
+ wgPositionHorizintal = "center";
66
+ wgPositionVertical = "row-reverse";
67
+ widgetLeftSideBorder = 5;
68
+ widgetRightSideBorder = 0;
69
+ widgetMarginRight = 30;
70
+ widgetMarginLeft = 0;
71
+ inTransitionX = -100;
72
+ outTransitionX = 20;
73
+ } else if (Number(wgPosition) == 1) {
74
+ wgPositionHorizintal = "center";
75
+ wgPositionVertical = "row";
76
+ widgetLeftSideBorder = 0;
77
+ widgetRightSideBorder = 5;
78
+ widgetMarginRight = 0;
79
+ widgetMarginLeft = 30;
80
+ inTransitionX = 100;
81
+ outTransitionX = -20;
82
+ } else if (Number(wgPosition) == 2) {
83
+ wgPositionHorizintal = "flex-end";
84
+ wgPositionVertical = "row-reverse";
85
+ widgetLeftSideBorder = 5;
86
+ widgetMarginRight = 30;
87
+ widgetMarginLeft = 0;
88
+ inTransitionX = -100;
89
+ outTransitionX = 20;
90
+ } else if (Number(wgPosition) == 3) {
91
+ wgPositionHorizintal = "flex-end";
92
+ wgPositionVertical = "row";
93
+ widgetLeftSideBorder = 0;
94
+ widgetRightSideBorder = 5;
95
+ widgetMarginRight = 0;
96
+ widgetMarginLeft = 30;
97
+ inTransitionX = 100;
98
+ outTransitionX = -20;
99
+ }
100
+ $: document.documentElement.style.setProperty(
101
+ "--wgPositionHorizintal",
102
+ wgPositionHorizintal
103
+ );
104
+ $: document.documentElement.style.setProperty(
105
+ "--wgPositionVertical",
106
+ wgPositionVertical
107
+ );
108
+ $: document.documentElement.style.setProperty(
109
+ "--widgetLeftSideBorder",
110
+ widgetLeftSideBorder + "px"
111
+ );
112
+ $: document.documentElement.style.setProperty(
113
+ "--widgetRightSideBorder",
114
+ widgetRightSideBorder + "px"
115
+ );
116
+ $: document.documentElement.style.setProperty(
117
+ "--widgetMarginRight",
118
+ widgetMarginRight + "px"
119
+ );
120
+ $: document.documentElement.style.setProperty(
121
+ "--widgetMarginLeft",
122
+ widgetMarginLeft + "px"
123
+ );
124
+
125
+ let userClosedWidget = 0;
126
+ let emailx = "";
127
+ let commentx = "";
128
+ let reactionTypex = "";
129
+ const closeOne = (email, comment, reactionType, questionAnswer) => {
130
+ let widgetResponse;
131
+ if (widgetType === 0) {
132
+ widgetResponse = {
133
+ email: email,
134
+ comment: comment,
135
+ reaction: Number(reactionType),
136
+ type: widgetType,
137
+ };
138
+ } else {
139
+ widgetResponse = {
140
+ email: email,
141
+ questionAnswer: questionAnswer,
142
+ type: widgetType,
143
+ };
144
+ }
145
+
146
+ let event = new CustomEvent("fbEvent", {
147
+ bubbles: false,
148
+ detail: widgetResponse,
149
+ });
150
+
151
+ window.dispatchEvent(event);
152
+ openThanksMessage();
153
+ };
154
+
155
+ // const closeBeforeFinsihing = (email, comment, reactionType) => {
156
+ // emailx = email;
157
+ // commentx = comment;
158
+ // reactionTypex = Number(reactionType);
159
+ // let widgetResponse = {
160
+ // email: email,
161
+ // comment: comment,
162
+ // reaction: reactionType,
163
+ // };
164
+ // if (userClosedWidget == 1) {
165
+ // console.log("hi", widgetResponse);
166
+ // let event = new CustomEvent("fbEvent", {
167
+ // bubbles: false,
168
+ // detail: widgetResponse,
169
+ // });
170
+ // window.dispatchEvent(event);
171
+ // console.log(widgetResponse);
172
+ // }
173
+ // };
174
+
175
+ const openThanksMessage = () => {
176
+ visible = !visible;
177
+ thanksMessageVisible = !thanksMessageVisible;
178
+ };
179
+
180
+ const closeThanksMessage = () => {
181
+ thanksMessageVisible = !thanksMessageVisible;
182
+ setTimeout(function () {
183
+ buttonVisible = !buttonVisible;
184
+ }, 350);
185
+ };
186
+
187
+ const openWidget = () => {
188
+ visible = !visible;
189
+ buttonVisible = !buttonVisible;
190
+ };
191
+
192
+ const closeWidget = () => {
193
+ userClosedWidget = 1;
194
+ if (reactionTypex != 0) {
195
+ closeBeforeFinsihing(emailx, commentx, reactionTypex);
196
+ }
197
+ visible = !visible;
198
+ setTimeout(function () {
199
+ buttonVisible = !buttonVisible;
200
+ }, 350);
201
+ };
202
+ </script>
203
+
204
+ <fsContainer
205
+ class={!buttonVisible && widgetDisplayMode == 1 ? "modal" : "side"}
206
+ style="position: 10px"
207
+ dir="ltr"
208
+ >
209
+ {#if buttonVisible}
210
+ <div class="fsWidget" on:click={openWidget}>
211
+ <div id="fsFeedbackTxt">{widgetName}</div>
212
+ <div id="fsMainIcon">
213
+ <MainIcon bind:fill={iconColor} />
214
+ </div>
215
+ </div>
216
+ {/if}
217
+
218
+ {#if visible}
219
+ <div
220
+ class="fsCont"
221
+ class:fsContModal={widgetDisplayMode === 1}
222
+ in:fly={{ x: inTransitionX, duration: 500 }}
223
+ >
224
+ <div class="fsCloseCont" on:click={closeWidget}>
225
+ <p id="fsCloseIcon">X</p>
226
+ </div>
227
+ <ReactionPage
228
+ closeHandler={closeOne}
229
+ bind:feedbackData={feedback}
230
+ bind:wgType={widgetType}
231
+ />
232
+ </div>
233
+ {/if}
234
+ {#if thanksMessageVisible}
235
+ <div
236
+ class="fsThanksMessageCont"
237
+ out:fly={{ x: outTransitionX, duration: 300 }}
238
+ >
239
+ <div class="fsCloseCont" on:click={closeThanksMessage}>
240
+ <p id="fsCloseIcon">X</p>
241
+ </div>
242
+ <div class="thanks-txt">
243
+ {widgetThanksMsg}
244
+ </div>
245
+ </div>
246
+ {/if}
247
+ </fsContainer>
@@ -1,25 +1,25 @@
1
- <script>
2
- export let fill = "";
3
- </script>
4
- <svg
5
- fill={fill}
6
-
7
-
8
- version="1.1"
9
- id="Layer_1"
10
- xmlns="http://www.w3.org/2000/svg"
11
- xmlns:xlink="http://www.w3.org/1999/xlink"
12
- x="0px"
13
- y="0px"
14
- viewBox="0 0 458 458"
15
- style="enable-background:new 0 0 458 458;"
16
- xml:space="preserve"
17
- ><g
18
- ><g
19
- ><path
20
- d="M428,41.534H30c-16.569,0-30,13.431-30,30v252c0,16.568,13.432,30,30,30h132.1l43.942,52.243 c5.7,6.777,14.103,10.69,22.959,10.69c8.856,0,17.258-3.912,22.959-10.69l43.942-52.243H428c16.568,0,30-13.432,30-30v-252 C458,54.965,444.568,41.534,428,41.534z M323.916,281.534H82.854c-8.284,0-15-6.716-15-15s6.716-15,15-15h241.062 c8.284,0,15,6.716,15,15S332.2,281.534,323.916,281.534z M67.854,198.755c0-8.284,6.716-15,15-15h185.103c8.284,0,15,6.716,15,15 s-6.716,15-15,15H82.854C74.57,213.755,67.854,207.039,67.854,198.755z M375.146,145.974H82.854c-8.284,0-15-6.716-15-15 s6.716-15,15-15h292.291c8.284,0,15,6.716,15,15C390.146,139.258,383.43,145.974,375.146,145.974z"
21
- /></g
22
- ></g
23
- ><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g
24
- /></svg
25
- >
1
+ <script>
2
+ export let fill = "";
3
+ </script>
4
+ <svg
5
+ fill={fill}
6
+
7
+
8
+ version="1.1"
9
+ id="Layer_1"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ xmlns:xlink="http://www.w3.org/1999/xlink"
12
+ x="0px"
13
+ y="0px"
14
+ viewBox="0 0 458 458"
15
+ style="enable-background:new 0 0 458 458;"
16
+ xml:space="preserve"
17
+ ><g
18
+ ><g
19
+ ><path
20
+ d="M428,41.534H30c-16.569,0-30,13.431-30,30v252c0,16.568,13.432,30,30,30h132.1l43.942,52.243 c5.7,6.777,14.103,10.69,22.959,10.69c8.856,0,17.258-3.912,22.959-10.69l43.942-52.243H428c16.568,0,30-13.432,30-30v-252 C458,54.965,444.568,41.534,428,41.534z M323.916,281.534H82.854c-8.284,0-15-6.716-15-15s6.716-15,15-15h241.062 c8.284,0,15,6.716,15,15S332.2,281.534,323.916,281.534z M67.854,198.755c0-8.284,6.716-15,15-15h185.103c8.284,0,15,6.716,15,15 s-6.716,15-15,15H82.854C74.57,213.755,67.854,207.039,67.854,198.755z M375.146,145.974H82.854c-8.284,0-15-6.716-15-15 s6.716-15,15-15h292.291c8.284,0,15,6.716,15,15C390.146,139.258,383.43,145.974,375.146,145.974z"
21
+ /></g
22
+ ></g
23
+ ><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g /><g
24
+ /></svg
25
+ >