@fullsession.io/fs-feedback-widget 1.5.10 → 1.6.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.
@@ -1,305 +1,305 @@
1
-
2
- <script>
3
- import Icons from "../Icons/reactionIcons.svelte";
4
- import "../widgetPages/reactionpage.css"
5
- export let feedbackData;
6
- $: widgetComponent = 1;
7
- let reactionNames = ["hate","dislike","neutral","like","love"];
8
- let changingReactionNames = reactionNames;
9
- let reactionType = "";
10
- let comment=""
11
- let email =""
12
- let reactionName = "test";
13
- let reactionState = true;
14
- $:pointerMargin = 10;
15
- $:hateDisplay = 'none'
16
- $:dislikeDisplay = 'none'
17
- $:neutralDisplay = 'none'
18
- $:likeDisplay = 'none'
19
- $:loveDisplay = 'none';
20
- $:buttonColor = feedbackData.wgAccentColor;
21
- $: document.documentElement.style.setProperty('--pointerMargin', pointerMargin + '%')
22
- $: document.documentElement.style.setProperty('--hateDisplay', hateDisplay)
23
- $: document.documentElement.style.setProperty('--dislikeDisplay', dislikeDisplay)
24
- $: document.documentElement.style.setProperty('--neutralDisplay', neutralDisplay)
25
- $: document.documentElement.style.setProperty('--likeDisplay', likeDisplay)
26
- $: document.documentElement.style.setProperty('--loveDisplay', loveDisplay)
27
- $: document.documentElement.style.setProperty('--buttonColor', buttonColor)
28
-
29
-
30
-
31
- let count = 0;
32
- $: buttonState = false;
33
- let checkTextAreaInterval;
34
- let checkEmailAreaInterval;
35
-
36
- export let closeHandler = (email,comment,reactionType) => {};
37
- export let closeHandlerBeforeFinishing = (email,comment,reactionType) => {};
38
-
39
-
40
- // const commentButtonDisable = () =>{
41
-
42
- // let source = document.querySelector(".fsTextArea");
43
-
44
- // source.addEventListener('propertychange', commentHandler);
45
-
46
-
47
- // }
48
- const commentHandler = () => {
49
- let input = document.querySelector(".fsTextArea");
50
-
51
- if (input.value=== "") {
52
- buttonState = false; //button remains disabled
53
- } else {
54
- buttonState = true; //button is enabled
55
- }
56
- comment = "";
57
- comment = input.value;
58
- }
59
-
60
- // const EmailButtonDisable = () =>{
61
-
62
- // let source = document.querySelector("#fsEmailTextArea");
63
-
64
- // source.addEventListener('propertychange', emailHandler);
65
-
66
-
67
- // }
68
-
69
- const emailHandler = ()=> {
70
- let input = document.querySelector("#fsEmailTextArea");
71
-
72
- if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(input.value)) || input.value ==="") {
73
- buttonState = false; //button remains disabled
74
- } else {
75
- buttonState = true; //button is enabled
76
- email = "";
77
- email = document.getElementById("fsEmailTextArea").value;
78
- }
79
-
80
-
81
-
82
- }
83
-
84
-
85
- const changeStyle = (prevState) =>{
86
-
87
- if(prevState == "hate"){
88
- hateDisplay = "none"
89
- } else if(prevState == "dislike"){
90
- dislikeDisplay = "none"
91
- } else if(prevState == "neutral"){
92
- neutralDisplay = "none"
93
- } else if(prevState == "like"){
94
- likeDisplay = "none"
95
- } else if(prevState == "love"){
96
- loveDisplay = "none"
97
- }
98
- }
99
-
100
-
101
- const openComment = (state,rating,name) => {
102
- let prevName = reactionName
103
- reactionName = name
104
-
105
- widgetComponent = state;
106
- reactionType = String(rating);
107
- changingReactionNames = ["unSelectedHate","unSelectedDislike","unSelectedNeutral","unSelectedLike","unSelectedLove"];
108
- closeHandlerBeforeFinishing(email,comment,reactionType)
109
- if(count >0){
110
- changeStyle(prevName)
111
- }
112
- // changeStyle(prevName,reactionName)
113
- count++;
114
- if(rating == 1){
115
-
116
- pointerMargin = 11
117
- hateDisplay = "block"
118
- changingReactionNames[0] = reactionNames[0]
119
- reactionState = !reactionState;
120
- } else if(rating == 2){
121
- changingReactionNames[1] = reactionNames[1]
122
- pointerMargin = 30;
123
- dislikeDisplay = "block"
124
- reactionState = !reactionState;
125
- } else if(rating == 3){
126
- changingReactionNames[2] = reactionNames[2]
127
- pointerMargin = 49
128
- neutralDisplay = "block"
129
- reactionState = !reactionState;
130
- } else if(rating == 4){
131
- changingReactionNames[3] = reactionNames[3]
132
- pointerMargin = 68
133
- likeDisplay = "block"
134
- reactionState = !reactionState;
135
- } else if(rating == 5){
136
- changingReactionNames[4] = reactionNames[4]
137
- pointerMargin = 87
138
- loveDisplay = "block"
139
- reactionState = !reactionState;
140
- }
141
- };
142
-
143
- const openEmailCont = (state) =>{
144
- clearInterval(checkTextAreaInterval);
145
- document.querySelector(".fsTextArea").value="";
146
- buttonState = false
147
- widgetComponent = state;
148
-
149
- }
150
-
151
- const endEmailInterval =()=> {
152
- clearInterval(checkEmailAreaInterval);
153
- document.querySelector("#fsEmailTextArea").value="";
154
-
155
- }
156
-
157
- </script>
158
-
159
-
160
-
161
- {#if widgetComponent === 1}
162
- <div class="fsReactionsContainer">
163
- <div id="fsTxt">{feedbackData.wgQuestion}</div>
164
- <div class="fsIcons">
165
- <div class="fsIconTextCont" on:click={() =>openComment(2,1,"hate")}>
166
- <div class="fsReactionIcon">
167
- <Icons bind:name={changingReactionNames[0]}/>
168
- </div>
169
-
170
- <p class="fsReactionText">Hate</p>
171
- </div>
172
-
173
- <div class="fsIconTextCont" on:click={() =>openComment(2,2,"dislike")}>
174
- <div class="fsReactionIcon">
175
- <Icons bind:name={changingReactionNames[1]} />
176
- </div>
177
-
178
- <p class="fsReactionText">Dislike</p>
179
- </div>
180
- <div class="fsIconTextCont" on:click={() =>openComment(2,3,"neutral")}>
181
- <div class="fsReactionIcon">
182
- <Icons bind:name={changingReactionNames[2]} />
183
- </div>
184
-
185
- <p class="fsReactionText">Neutral</p>
186
- </div>
187
- <div class="fsIconTextCont" on:click={() =>openComment(2,4,"like")}>
188
- <div class="fsReactionIcon">
189
- <Icons bind:name={changingReactionNames[3]} />
190
- </div>
191
- <p class="fsReactionText">Like</p>
192
- </div>
193
- <div class="fsIconTextCont" on:click={() =>openComment(2,5,"love")}>
194
- <div class="fsReactionIcon">
195
- <Icons bind:name={changingReactionNames[4]} />
196
- </div>
197
- <p class="fsReactionText" >Love</p>
198
- </div>
199
- </div>
200
- <p id ="test"></p>
201
- </div>
202
-
203
-
204
- {:else if widgetComponent === 2}
205
- <div class="fsCommentContainer">
206
- <div class="fsIcons-second">
207
- <div class="fsIconTextCont" on:click={() =>openComment(2,1,"hate")}>
208
- <div class="fsReactionIcon">
209
- {#if reactionState}
210
- <Icons bind:name={changingReactionNames[0]}/>
211
- {:else if reactionState==false}
212
- <Icons bind:name={changingReactionNames[0]}/>
213
- {/if}
214
- </div>
215
-
216
- <p class="fsReactionText" id="fsHateDiv">Hate</p>
217
- </div>
218
-
219
- <div class="fsIconTextCont" on:click={() =>openComment(2,2,"dislike")}>
220
- <div class="fsReactionIcon">
221
- {#if reactionState}
222
- <Icons bind:name={changingReactionNames[1]}/>
223
- {:else if reactionState==false}
224
- <Icons bind:name={changingReactionNames[1]}/>
225
- {/if}
226
- </div>
227
-
228
- <p class="fsReactionText" id="fsDislikeDiv">Dislike</p>
229
- </div>
230
- <div class="fsIconTextCont" on:click={() =>openComment(2,3,"neutral")}>
231
- <div class="fsReactionIcon">
232
- {#if reactionState}
233
- <Icons bind:name={changingReactionNames[2]}/>
234
- {:else if reactionState==false}
235
- <Icons bind:name={changingReactionNames[2]}/>
236
- {/if}
237
- </div>
238
-
239
- <p class="fsReactionText" id="fsNeutralDiv">Neutral</p>
240
- </div>
241
- <div class="fsIconTextCont" on:click={() =>openComment(2,4,"like")}>
242
- <div class="fsReactionIcon">
243
- {#if reactionState}
244
- <Icons bind:name={changingReactionNames[3]}/>
245
- {:else if reactionState==false}
246
- <Icons bind:name={changingReactionNames[3]}/>
247
- {/if}
248
- </div>
249
- <p class="fsReactionText" id="fsLikeDiv">Like</p>
250
- </div>
251
- <div class="fsIconTextCont">
252
- <div class="fsReactionIcon" on:click={() =>openComment(2,5,"love")}>
253
- {#if reactionState}
254
- <Icons bind:name={changingReactionNames[4]}/>
255
- {:else if reactionState==false}
256
- <Icons bind:name={changingReactionNames[4]}/>
257
- {/if}
258
- </div>
259
- <p class="fsReactionText" id="fsLoveDiv">Love</p>
260
- </div>
261
- </div>
262
-
263
- <div class="fsTextAreaCont" >
264
- <div class="fsPointerDiv" id="fsPointer" ></div>
265
- <textarea class="fsTextArea" placeholder="Tell us your experience..." on:keyup={() => commentHandler()}></textarea>
266
- </div>
267
-
268
- <div class="fsFooter">
269
- {#if buttonState == false}
270
- <button class="fsCommentButtonContDisable" disabled>
271
- <p class="fsCommentButtonTxtDisable">Send</p>
272
- </button>
273
- {:else if buttonState == true}
274
- <button class="fsSendButtonContCommentComp" on:click={() => openEmailCont(3)} >
275
- <p class="fsSendButtonCommentComponent">Send</p>
276
- </button>
277
- {/if}
278
- </div>
279
- </div>
280
- {:else if widgetComponent === 3}
281
- <div class="fsEmailContainer">
282
- <div id="fsEmailText">
283
- {feedbackData.wgEmailReqMsg}
284
- </div>
285
- <div id="fsEmailInputCont">
286
- <input type="text" id="fsEmailTextArea" placeholder="email@domain.com" on:keyup={() => emailHandler()}>
287
- </div>
288
- <div class="fsEmailFooter">
289
- <p id="fsSkipText" on:click={() => closeHandler(email,comment,reactionType)}><u>Skip</u></p>
290
- {#if buttonState == false}
291
- <button class="fsCommentButtonContDisable" disabled>
292
- <p class="fsCommentButtonTxtDisable">Send</p>
293
- </button>
294
- {:else if buttonState == true}
295
- <button class="fsSendButtonContCommentComp" on:click={() => closeHandler(email,comment,reactionType)} on:click={()=>endEmailInterval() }>
296
- <p class="fsSendButtonCommentComponent" >Send</p>
297
- </button>
298
- {/if}
299
-
300
- </div>
301
- </div>
302
- {/if}
303
-
304
-
305
-
1
+
2
+ <script>
3
+ import Icons from "../Icons/reactionIcons.svelte";
4
+ import "../widgetPages/reactionpage.css"
5
+ export let feedbackData;
6
+ $: widgetComponent = 1;
7
+ let reactionNames = ["hate","dislike","neutral","like","love"];
8
+ let changingReactionNames = reactionNames;
9
+ let reactionType = "";
10
+ let comment=""
11
+ let email =""
12
+ let reactionName = "test";
13
+ let reactionState = true;
14
+ $:pointerMargin = 10;
15
+ $:hateDisplay = 'none'
16
+ $:dislikeDisplay = 'none'
17
+ $:neutralDisplay = 'none'
18
+ $:likeDisplay = 'none'
19
+ $:loveDisplay = 'none';
20
+ $:buttonColor = feedbackData.wgAccentColor;
21
+ $: document.documentElement.style.setProperty('--pointerMargin', pointerMargin + '%')
22
+ $: document.documentElement.style.setProperty('--hateDisplay', hateDisplay)
23
+ $: document.documentElement.style.setProperty('--dislikeDisplay', dislikeDisplay)
24
+ $: document.documentElement.style.setProperty('--neutralDisplay', neutralDisplay)
25
+ $: document.documentElement.style.setProperty('--likeDisplay', likeDisplay)
26
+ $: document.documentElement.style.setProperty('--loveDisplay', loveDisplay)
27
+ $: document.documentElement.style.setProperty('--buttonColor', buttonColor)
28
+
29
+
30
+
31
+ let count = 0;
32
+ $: buttonState = false;
33
+ let checkTextAreaInterval;
34
+ let checkEmailAreaInterval;
35
+
36
+ export let closeHandler = (email,comment,reactionType) => {};
37
+ export let closeHandlerBeforeFinishing = (email,comment,reactionType) => {};
38
+
39
+
40
+ // const commentButtonDisable = () =>{
41
+
42
+ // let source = document.querySelector(".fsTextArea");
43
+
44
+ // source.addEventListener('propertychange', commentHandler);
45
+
46
+
47
+ // }
48
+ const commentHandler = () => {
49
+ let input = document.querySelector(".fsTextArea");
50
+
51
+ if (input.value=== "") {
52
+ buttonState = false; //button remains disabled
53
+ } else {
54
+ buttonState = true; //button is enabled
55
+ }
56
+ comment = "";
57
+ comment = input.value;
58
+ }
59
+
60
+ // const EmailButtonDisable = () =>{
61
+
62
+ // let source = document.querySelector("#fsEmailTextArea");
63
+
64
+ // source.addEventListener('propertychange', emailHandler);
65
+
66
+
67
+ // }
68
+
69
+ const emailHandler = ()=> {
70
+ let input = document.querySelector("#fsEmailTextArea");
71
+
72
+ if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(input.value)) || input.value ==="") {
73
+ buttonState = false; //button remains disabled
74
+ } else {
75
+ buttonState = true; //button is enabled
76
+ email = "";
77
+ email = document.getElementById("fsEmailTextArea").value;
78
+ }
79
+
80
+
81
+
82
+ }
83
+
84
+
85
+ const changeStyle = (prevState) =>{
86
+
87
+ if(prevState == "hate"){
88
+ hateDisplay = "none"
89
+ } else if(prevState == "dislike"){
90
+ dislikeDisplay = "none"
91
+ } else if(prevState == "neutral"){
92
+ neutralDisplay = "none"
93
+ } else if(prevState == "like"){
94
+ likeDisplay = "none"
95
+ } else if(prevState == "love"){
96
+ loveDisplay = "none"
97
+ }
98
+ }
99
+
100
+
101
+ const openComment = (state,rating,name) => {
102
+ let prevName = reactionName
103
+ reactionName = name
104
+
105
+ widgetComponent = state;
106
+ reactionType = String(rating);
107
+ changingReactionNames = ["unSelectedHate","unSelectedDislike","unSelectedNeutral","unSelectedLike","unSelectedLove"];
108
+ closeHandlerBeforeFinishing(email,comment,reactionType)
109
+ if(count >0){
110
+ changeStyle(prevName)
111
+ }
112
+ // changeStyle(prevName,reactionName)
113
+ count++;
114
+ if(rating == 1){
115
+
116
+ pointerMargin = 11
117
+ hateDisplay = "block"
118
+ changingReactionNames[0] = reactionNames[0]
119
+ reactionState = !reactionState;
120
+ } else if(rating == 2){
121
+ changingReactionNames[1] = reactionNames[1]
122
+ pointerMargin = 30;
123
+ dislikeDisplay = "block"
124
+ reactionState = !reactionState;
125
+ } else if(rating == 3){
126
+ changingReactionNames[2] = reactionNames[2]
127
+ pointerMargin = 49
128
+ neutralDisplay = "block"
129
+ reactionState = !reactionState;
130
+ } else if(rating == 4){
131
+ changingReactionNames[3] = reactionNames[3]
132
+ pointerMargin = 68
133
+ likeDisplay = "block"
134
+ reactionState = !reactionState;
135
+ } else if(rating == 5){
136
+ changingReactionNames[4] = reactionNames[4]
137
+ pointerMargin = 87
138
+ loveDisplay = "block"
139
+ reactionState = !reactionState;
140
+ }
141
+ };
142
+
143
+ const openEmailCont = (state) =>{
144
+ clearInterval(checkTextAreaInterval);
145
+ document.querySelector(".fsTextArea").value="";
146
+ buttonState = false
147
+ widgetComponent = state;
148
+
149
+ }
150
+
151
+ const endEmailInterval =()=> {
152
+ clearInterval(checkEmailAreaInterval);
153
+ document.querySelector("#fsEmailTextArea").value="";
154
+
155
+ }
156
+
157
+ </script>
158
+
159
+
160
+
161
+ {#if widgetComponent === 1}
162
+ <div class="fsReactionsContainer">
163
+ <div id="fsTxt">{feedbackData.wgQuestion}</div>
164
+ <div class="fsIcons">
165
+ <div class="fsIconTextCont" on:click={() =>openComment(2,1,"hate")}>
166
+ <div class="fsReactionIcon">
167
+ <Icons bind:name={changingReactionNames[0]}/>
168
+ </div>
169
+
170
+ <p class="fsReactionText">Hate</p>
171
+ </div>
172
+
173
+ <div class="fsIconTextCont" on:click={() =>openComment(2,2,"dislike")}>
174
+ <div class="fsReactionIcon">
175
+ <Icons bind:name={changingReactionNames[1]} />
176
+ </div>
177
+
178
+ <p class="fsReactionText">Dislike</p>
179
+ </div>
180
+ <div class="fsIconTextCont" on:click={() =>openComment(2,3,"neutral")}>
181
+ <div class="fsReactionIcon">
182
+ <Icons bind:name={changingReactionNames[2]} />
183
+ </div>
184
+
185
+ <p class="fsReactionText">Neutral</p>
186
+ </div>
187
+ <div class="fsIconTextCont" on:click={() =>openComment(2,4,"like")}>
188
+ <div class="fsReactionIcon">
189
+ <Icons bind:name={changingReactionNames[3]} />
190
+ </div>
191
+ <p class="fsReactionText">Like</p>
192
+ </div>
193
+ <div class="fsIconTextCont" on:click={() =>openComment(2,5,"love")}>
194
+ <div class="fsReactionIcon">
195
+ <Icons bind:name={changingReactionNames[4]} />
196
+ </div>
197
+ <p class="fsReactionText" >Love</p>
198
+ </div>
199
+ </div>
200
+ <p id ="test"></p>
201
+ </div>
202
+
203
+
204
+ {:else if widgetComponent === 2}
205
+ <div class="fsCommentContainer">
206
+ <div class="fsIcons-second">
207
+ <div class="fsIconTextCont" on:click={() =>openComment(2,1,"hate")}>
208
+ <div class="fsReactionIcon">
209
+ {#if reactionState}
210
+ <Icons bind:name={changingReactionNames[0]}/>
211
+ {:else if reactionState==false}
212
+ <Icons bind:name={changingReactionNames[0]}/>
213
+ {/if}
214
+ </div>
215
+
216
+ <p class="fsReactionText" id="fsHateDiv">Hate</p>
217
+ </div>
218
+
219
+ <div class="fsIconTextCont" on:click={() =>openComment(2,2,"dislike")}>
220
+ <div class="fsReactionIcon">
221
+ {#if reactionState}
222
+ <Icons bind:name={changingReactionNames[1]}/>
223
+ {:else if reactionState==false}
224
+ <Icons bind:name={changingReactionNames[1]}/>
225
+ {/if}
226
+ </div>
227
+
228
+ <p class="fsReactionText" id="fsDislikeDiv">Dislike</p>
229
+ </div>
230
+ <div class="fsIconTextCont" on:click={() =>openComment(2,3,"neutral")}>
231
+ <div class="fsReactionIcon">
232
+ {#if reactionState}
233
+ <Icons bind:name={changingReactionNames[2]}/>
234
+ {:else if reactionState==false}
235
+ <Icons bind:name={changingReactionNames[2]}/>
236
+ {/if}
237
+ </div>
238
+
239
+ <p class="fsReactionText" id="fsNeutralDiv">Neutral</p>
240
+ </div>
241
+ <div class="fsIconTextCont" on:click={() =>openComment(2,4,"like")}>
242
+ <div class="fsReactionIcon">
243
+ {#if reactionState}
244
+ <Icons bind:name={changingReactionNames[3]}/>
245
+ {:else if reactionState==false}
246
+ <Icons bind:name={changingReactionNames[3]}/>
247
+ {/if}
248
+ </div>
249
+ <p class="fsReactionText" id="fsLikeDiv">Like</p>
250
+ </div>
251
+ <div class="fsIconTextCont">
252
+ <div class="fsReactionIcon" on:click={() =>openComment(2,5,"love")}>
253
+ {#if reactionState}
254
+ <Icons bind:name={changingReactionNames[4]}/>
255
+ {:else if reactionState==false}
256
+ <Icons bind:name={changingReactionNames[4]}/>
257
+ {/if}
258
+ </div>
259
+ <p class="fsReactionText" id="fsLoveDiv">Love</p>
260
+ </div>
261
+ </div>
262
+
263
+ <div class="fsTextAreaCont" >
264
+ <div class="fsPointerDiv" id="fsPointer" ></div>
265
+ <textarea class="fsTextArea" placeholder="Tell us your experience..." on:keyup={() => commentHandler()}></textarea>
266
+ </div>
267
+
268
+ <div class="fsFooter">
269
+ {#if buttonState == false}
270
+ <fs-button class="fsCommentButtonContDisable" >
271
+ <p class="fsCommentButtonTxtDisable">Send</p>
272
+ </fs-button>
273
+ {:else if buttonState == true}
274
+ <fs-button class="fsSendButtonContCommentComp" on:click={() => openEmailCont(3)} >
275
+ <p class="fsSendButtonCommentComponent">Send</p>
276
+ </fs-button>
277
+ {/if}
278
+ </div>
279
+ </div>
280
+ {:else if widgetComponent === 3}
281
+ <div class="fsEmailContainer">
282
+ <div id="fsEmailText">
283
+ {feedbackData.wgEmailReqMsg}
284
+ </div>
285
+ <div id="fsEmailInputCont">
286
+ <input type="text" id="fsEmailTextArea" placeholder="email@domain.com" on:keyup={() => emailHandler()}>
287
+ </div>
288
+ <div class="fsEmailFooter">
289
+ <p id="fsSkipText" on:click={() => closeHandler(email,comment,reactionType)}><u>Skip</u></p>
290
+ {#if buttonState == false}
291
+ <fs-button class="fsCommentButtonContDisable" >
292
+ <p class="fsCommentButtonTxtDisable">Send</p>
293
+ </fs-button>
294
+ {:else if buttonState == true}
295
+ <fs-button class="fsSendButtonContCommentComp" on:click={() => closeHandler(email,comment,reactionType)} on:click={()=>endEmailInterval() }>
296
+ <p class="fsSendButtonCommentComponent" >Send</p>
297
+ </fs-button>
298
+ {/if}
299
+
300
+ </div>
301
+ </div>
302
+ {/if}
303
+
304
+
305
+