@fullsession.io/fs-feedback-widget 1.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/README.md +109 -0
- package/dist/bundle.css +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/lib/index.js +2 -0
- package/package.json +31 -0
- package/src/App.svelte +223 -0
- package/src/Icons/mainIcon.svelte +25 -0
- package/src/Icons/reactionIcons.svelte +135 -0
- package/src/main.js +45 -0
- package/src/widgetPages/reactionPage.svelte +466 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Icons from "../Icons/reactionIcons.svelte";
|
|
3
|
+
|
|
4
|
+
export let feedbackData;
|
|
5
|
+
$: widgetComponent = 1;
|
|
6
|
+
let reactionNames = ["hate","dislike","neutral","like","love"];
|
|
7
|
+
let changingReactionNames = reactionNames;
|
|
8
|
+
let reactionType = 0;
|
|
9
|
+
let reactionName = "test";
|
|
10
|
+
let reactionState = true;
|
|
11
|
+
$:pointerMargin = 10;
|
|
12
|
+
$:hateDisplay = 'none'
|
|
13
|
+
$:dislikeDisplay = 'none'
|
|
14
|
+
$:neutralDisplay = 'none'
|
|
15
|
+
$:likeDisplay = 'none'
|
|
16
|
+
$:loveDisplay = 'none';
|
|
17
|
+
$:buttonColor = feedbackData.wgAccentColor;
|
|
18
|
+
$: document.documentElement.style.setProperty('--pointerMargin', pointerMargin + '%')
|
|
19
|
+
$: document.documentElement.style.setProperty('--hateDisplay', hateDisplay)
|
|
20
|
+
$: document.documentElement.style.setProperty('--dislikeDisplay', dislikeDisplay)
|
|
21
|
+
$: document.documentElement.style.setProperty('--neutralDisplay', neutralDisplay)
|
|
22
|
+
$: document.documentElement.style.setProperty('--likeDisplay', likeDisplay)
|
|
23
|
+
$: document.documentElement.style.setProperty('--loveDisplay', loveDisplay)
|
|
24
|
+
$: document.documentElement.style.setProperty('--buttonColor', buttonColor)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
let count = 0;
|
|
29
|
+
$: buttonState = false;
|
|
30
|
+
let checkTextAreaInterval;
|
|
31
|
+
let checkEmailAreaInterval;
|
|
32
|
+
|
|
33
|
+
export let closeHandler = () => {};
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const commentButtonDisable = () =>{
|
|
37
|
+
|
|
38
|
+
let input = document.querySelector(".textArea");
|
|
39
|
+
|
|
40
|
+
checkTextAreaInterval = setInterval(() => {
|
|
41
|
+
console.log(input.value)
|
|
42
|
+
if (input.value=== "") {
|
|
43
|
+
buttonState = false; //button remains disabled
|
|
44
|
+
} else {
|
|
45
|
+
buttonState = true; //button is enabled
|
|
46
|
+
}
|
|
47
|
+
}, 500);
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const EmailButtonDisable = () =>{
|
|
53
|
+
|
|
54
|
+
let input = document.querySelector("#EmailTextArea");
|
|
55
|
+
|
|
56
|
+
checkEmailAreaInterval = setInterval(() => {
|
|
57
|
+
console.log(input.value)
|
|
58
|
+
if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(input.value)) || input.value ==="") {
|
|
59
|
+
buttonState = false; //button remains disabled
|
|
60
|
+
} else {
|
|
61
|
+
buttonState = true; //button is enabled
|
|
62
|
+
}
|
|
63
|
+
}, 500);
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const changeStyle = (prevState) =>{
|
|
70
|
+
|
|
71
|
+
if(prevState == "hate"){
|
|
72
|
+
hateDisplay = "none"
|
|
73
|
+
} else if(prevState == "dislike"){
|
|
74
|
+
dislikeDisplay = "none"
|
|
75
|
+
} else if(prevState == "neutral"){
|
|
76
|
+
neutralDisplay = "none"
|
|
77
|
+
} else if(prevState == "like"){
|
|
78
|
+
likeDisplay = "none"
|
|
79
|
+
} else if(prevState == "love"){
|
|
80
|
+
loveDisplay = "none"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
const openComment = (state,rating,name) => {
|
|
86
|
+
let prevName = reactionName
|
|
87
|
+
reactionName = name
|
|
88
|
+
console.log(name)
|
|
89
|
+
|
|
90
|
+
widgetComponent = state;
|
|
91
|
+
reactionType = rating;
|
|
92
|
+
changingReactionNames = ["unSelectedHate","unSelectedDislike","unSelectedNeutral","unSelectedLike","unSelectedLove"];
|
|
93
|
+
|
|
94
|
+
if(count >0){
|
|
95
|
+
changeStyle(prevName)
|
|
96
|
+
}
|
|
97
|
+
// changeStyle(prevName,reactionName)
|
|
98
|
+
count++;
|
|
99
|
+
if(rating == 1){
|
|
100
|
+
|
|
101
|
+
pointerMargin = 11
|
|
102
|
+
hateDisplay = "block"
|
|
103
|
+
changingReactionNames[0] = reactionNames[0]
|
|
104
|
+
reactionState = !reactionState;
|
|
105
|
+
} else if(rating == 2){
|
|
106
|
+
changingReactionNames[1] = reactionNames[1]
|
|
107
|
+
pointerMargin = 30;
|
|
108
|
+
dislikeDisplay = "block"
|
|
109
|
+
reactionState = !reactionState;
|
|
110
|
+
} else if(rating == 3){
|
|
111
|
+
changingReactionNames[2] = reactionNames[2]
|
|
112
|
+
pointerMargin = 49
|
|
113
|
+
neutralDisplay = "block"
|
|
114
|
+
reactionState = !reactionState;
|
|
115
|
+
} else if(rating == 4){
|
|
116
|
+
changingReactionNames[3] = reactionNames[3]
|
|
117
|
+
pointerMargin = 68
|
|
118
|
+
likeDisplay = "block"
|
|
119
|
+
reactionState = !reactionState;
|
|
120
|
+
} else if(rating == 5){
|
|
121
|
+
changingReactionNames[4] = reactionNames[4]
|
|
122
|
+
pointerMargin = 87
|
|
123
|
+
loveDisplay = "block"
|
|
124
|
+
reactionState = !reactionState;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const openEmailCont = (state) =>{
|
|
129
|
+
clearInterval(checkTextAreaInterval);
|
|
130
|
+
buttonState = false
|
|
131
|
+
widgetComponent = state;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
{#if widgetComponent === 1}
|
|
140
|
+
<div class="container">
|
|
141
|
+
<div id="txt">{feedbackData.wgQuestion}</div>
|
|
142
|
+
<div class="icons">
|
|
143
|
+
<div class="iconTextCont" on:click={() =>openComment(2,1,"hate")}>
|
|
144
|
+
<div class="reactionIcon">
|
|
145
|
+
<Icons bind:name={changingReactionNames[0]}/>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<p class="reactionText">Hate</p>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<div class="iconTextCont" on:click={() =>openComment(2,2,"dislike")}>
|
|
152
|
+
<div class="reactionIcon">
|
|
153
|
+
<Icons bind:name={changingReactionNames[1]} />
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<p class="reactionText">Dislike</p>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="iconTextCont" on:click={() =>openComment(2,3,"neutral")}>
|
|
159
|
+
<div class="reactionIcon">
|
|
160
|
+
<Icons bind:name={changingReactionNames[2]} />
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<p class="reactionText">Neutral</p>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="iconTextCont" on:click={() =>openComment(2,4,"like")}>
|
|
166
|
+
<div class="reactionIcon">
|
|
167
|
+
<Icons bind:name={changingReactionNames[3]} />
|
|
168
|
+
</div>
|
|
169
|
+
<p class="reactionText">Like</p>
|
|
170
|
+
</div>
|
|
171
|
+
<div class="iconTextCont" on:click={() =>openComment(2,5,"love")}>
|
|
172
|
+
<div class="reactionIcon">
|
|
173
|
+
<Icons bind:name={changingReactionNames[4]} />
|
|
174
|
+
</div>
|
|
175
|
+
<p class="reactionText" >Love</p>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
<p id ="test"></p>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
{:else if widgetComponent === 2}
|
|
183
|
+
<div class="commentContainer">
|
|
184
|
+
<div class="icons-second">
|
|
185
|
+
<div class="iconTextCont" on:click={() =>openComment(2,1,"hate")}>
|
|
186
|
+
<div class="reactionIcon">
|
|
187
|
+
{#if reactionState}
|
|
188
|
+
<Icons bind:name={changingReactionNames[0]}/>
|
|
189
|
+
{:else if reactionState==false}
|
|
190
|
+
<Icons bind:name={changingReactionNames[0]}/>
|
|
191
|
+
{/if}
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
<p class="reactionText" id="hateDiv">Hate</p>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<div class="iconTextCont" on:click={() =>openComment(2,2,"dislike")}>
|
|
198
|
+
<div class="reactionIcon">
|
|
199
|
+
{#if reactionState}
|
|
200
|
+
<Icons bind:name={changingReactionNames[1]}/>
|
|
201
|
+
{:else if reactionState==false}
|
|
202
|
+
<Icons bind:name={changingReactionNames[1]}/>
|
|
203
|
+
{/if}
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<p class="reactionText" id="dislikeDiv">Dislike</p>
|
|
207
|
+
</div>
|
|
208
|
+
<div class="iconTextCont" on:click={() =>openComment(2,3,"neutral")}>
|
|
209
|
+
<div class="reactionIcon">
|
|
210
|
+
{#if reactionState}
|
|
211
|
+
<Icons bind:name={changingReactionNames[2]}/>
|
|
212
|
+
{:else if reactionState==false}
|
|
213
|
+
<Icons bind:name={changingReactionNames[2]}/>
|
|
214
|
+
{/if}
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<p class="reactionText" id="neutralDiv">Neutral</p>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="iconTextCont" on:click={() =>openComment(2,4,"like")}>
|
|
220
|
+
<div class="reactionIcon">
|
|
221
|
+
{#if reactionState}
|
|
222
|
+
<Icons bind:name={changingReactionNames[3]}/>
|
|
223
|
+
{:else if reactionState==false}
|
|
224
|
+
<Icons bind:name={changingReactionNames[3]}/>
|
|
225
|
+
{/if}
|
|
226
|
+
</div>
|
|
227
|
+
<p class="reactionText" id="likeDiv">Like</p>
|
|
228
|
+
</div>
|
|
229
|
+
<div class="iconTextCont">
|
|
230
|
+
<div class="reactionIcon" on:click={() =>openComment(2,5,"love")}>
|
|
231
|
+
{#if reactionState}
|
|
232
|
+
<Icons bind:name={changingReactionNames[4]}/>
|
|
233
|
+
{:else if reactionState==false}
|
|
234
|
+
<Icons bind:name={changingReactionNames[4]}/>
|
|
235
|
+
{/if}
|
|
236
|
+
</div>
|
|
237
|
+
<p class="reactionText" id="loveDiv">Love</p>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
<div class="textAreaCont" >
|
|
242
|
+
<div class="pointerDiv" id="pointer" ></div>
|
|
243
|
+
<textarea class="textArea" placeholder="Tell us your experience..." on:click={() => commentButtonDisable()}></textarea>
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
<div class="footer">
|
|
247
|
+
{#if buttonState == false}
|
|
248
|
+
<button class="CommentButtonContDisable" disabled>
|
|
249
|
+
<p class="CommentButtonTxtDisable">Send</p>
|
|
250
|
+
</button>
|
|
251
|
+
{:else if buttonState == true}
|
|
252
|
+
<button class="sendButtonContCommentComp" on:click={() => openEmailCont(3)} >
|
|
253
|
+
<p class="SendButtonCommentComponent">Send</p>
|
|
254
|
+
</button>
|
|
255
|
+
{/if}
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
{:else if widgetComponent === 3}
|
|
259
|
+
<div class="emailContainer">
|
|
260
|
+
<div id="emailText">
|
|
261
|
+
{feedbackData.wgEmailReqMsg}
|
|
262
|
+
</div>
|
|
263
|
+
<div id="emailInputCont" on:click={() => EmailButtonDisable()}>
|
|
264
|
+
<input type="text" id="EmailTextArea" placeholder="email@domain.com">
|
|
265
|
+
</div>
|
|
266
|
+
<div class="emailFooter">
|
|
267
|
+
<p id="skipText" on:click={() => closeHandler()}><u>Skip</u></p>
|
|
268
|
+
{#if buttonState == false}
|
|
269
|
+
<button class="CommentButtonContDisable" disabled>
|
|
270
|
+
<p class="CommentButtonTxtDisable">Send</p>
|
|
271
|
+
</button>
|
|
272
|
+
{:else if buttonState == true}
|
|
273
|
+
<button class="sendButtonContCommentComp" on:click={() => closeHandler()}>
|
|
274
|
+
<p class="SendButtonCommentComponent" >Send</p>
|
|
275
|
+
</button>
|
|
276
|
+
{/if}
|
|
277
|
+
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
{/if}
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
<style>
|
|
284
|
+
.container {
|
|
285
|
+
display: flex;
|
|
286
|
+
flex-direction: column;
|
|
287
|
+
height: 190px;
|
|
288
|
+
}
|
|
289
|
+
.icons {
|
|
290
|
+
display: flex;
|
|
291
|
+
flex-direction: row;
|
|
292
|
+
justify-content: space-evenly;
|
|
293
|
+
margin-top: 11%;
|
|
294
|
+
}
|
|
295
|
+
#txt {
|
|
296
|
+
font-size: 17px;
|
|
297
|
+
display: flex;
|
|
298
|
+
text-align: center;
|
|
299
|
+
margin-top: 5%;
|
|
300
|
+
width: 61%;
|
|
301
|
+
margin-left: 19%;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.iconTextCont {
|
|
305
|
+
display: flex;
|
|
306
|
+
flex-direction: column;
|
|
307
|
+
align-items: center;
|
|
308
|
+
height: 22px;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.reactionText {
|
|
312
|
+
font-size: 9px;
|
|
313
|
+
display: none;
|
|
314
|
+
}
|
|
315
|
+
.iconTextCont:hover{
|
|
316
|
+
cursor: pointer;
|
|
317
|
+
}
|
|
318
|
+
.reactionIcon:hover + .reactionText {
|
|
319
|
+
display: block;
|
|
320
|
+
opacity: 0.8;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.commentContainer{
|
|
324
|
+
display: flex;
|
|
325
|
+
flex-direction: column;
|
|
326
|
+
height: 291px;
|
|
327
|
+
}
|
|
328
|
+
.textAreaCont{
|
|
329
|
+
width: 100%;
|
|
330
|
+
height: 140px;
|
|
331
|
+
background-color: #eaeaeb;
|
|
332
|
+
margin-top: 17%;
|
|
333
|
+
}
|
|
334
|
+
.textArea{
|
|
335
|
+
border: 0px;
|
|
336
|
+
width: 85%;
|
|
337
|
+
height: 120px;
|
|
338
|
+
background-color: #eaeaeb;
|
|
339
|
+
margin-left: 6%;
|
|
340
|
+
outline: none;
|
|
341
|
+
margin-top: 4%;
|
|
342
|
+
resize: none;
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
.SendButtonCommentComponent{
|
|
346
|
+
color: #ffff;
|
|
347
|
+
font-size: 12px;
|
|
348
|
+
text-align: center;
|
|
349
|
+
margin-top: 1px;
|
|
350
|
+
|
|
351
|
+
}
|
|
352
|
+
.sendButtonContCommentComp{
|
|
353
|
+
background-color: var(--buttonColor);
|
|
354
|
+
width: 50px;
|
|
355
|
+
height: 29px;
|
|
356
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 3px 0px;
|
|
357
|
+
border-radius: 3px;
|
|
358
|
+
margin-top: 13px;
|
|
359
|
+
margin-right: 11px;
|
|
360
|
+
cursor: pointer;
|
|
361
|
+
border: 0px;
|
|
362
|
+
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.CommentButtonContDisable{
|
|
366
|
+
background-color: #cccccc;
|
|
367
|
+
width: 50px;
|
|
368
|
+
height: 29px;
|
|
369
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 3px 0px;
|
|
370
|
+
border-radius: 3px;
|
|
371
|
+
margin-top: 13px;
|
|
372
|
+
margin-right: 11px;
|
|
373
|
+
cursor:not-allowed;
|
|
374
|
+
border: 0px;
|
|
375
|
+
}
|
|
376
|
+
.CommentButtonTxtDisable{
|
|
377
|
+
color: black;
|
|
378
|
+
font-size: 12px;
|
|
379
|
+
text-align: center;
|
|
380
|
+
margin-top: 2px;
|
|
381
|
+
}
|
|
382
|
+
.footer{
|
|
383
|
+
display: flex;
|
|
384
|
+
justify-content: flex-end;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.icons-second{
|
|
388
|
+
display: flex;
|
|
389
|
+
flex-direction: row;
|
|
390
|
+
justify-content: space-evenly;
|
|
391
|
+
margin-top: 6%;
|
|
392
|
+
}
|
|
393
|
+
.pointerDiv{
|
|
394
|
+
width: 0;
|
|
395
|
+
height: 0;
|
|
396
|
+
border-left: 3px solid transparent;
|
|
397
|
+
margin-top: -8px;
|
|
398
|
+
border-right: 5px solid transparent;
|
|
399
|
+
border-bottom: 8px solid #eaeaeb;
|
|
400
|
+
margin-left: var(--pointerMargin);
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
#hateDiv{
|
|
405
|
+
display: var(--hateDisplay);
|
|
406
|
+
}
|
|
407
|
+
#dislikeDiv{
|
|
408
|
+
display: var(--dislikeDisplay);
|
|
409
|
+
}
|
|
410
|
+
#neutralDiv{
|
|
411
|
+
display: var(--neutralDisplay);
|
|
412
|
+
}
|
|
413
|
+
#likeDiv{
|
|
414
|
+
display: var(--likeDisplay);
|
|
415
|
+
}
|
|
416
|
+
#loveDiv{
|
|
417
|
+
display: var(--loveDisplay);
|
|
418
|
+
}
|
|
419
|
+
.emailContainer{
|
|
420
|
+
display: flex;
|
|
421
|
+
flex-direction: column;
|
|
422
|
+
height: 220px;
|
|
423
|
+
}
|
|
424
|
+
#emailInputCont{
|
|
425
|
+
width: 100%;
|
|
426
|
+
height: 46px;
|
|
427
|
+
background-color: #eaeaeb;
|
|
428
|
+
display: flex;
|
|
429
|
+
/* align-items: center; */
|
|
430
|
+
justify-content: center;
|
|
431
|
+
margin-top: 10%;
|
|
432
|
+
|
|
433
|
+
}
|
|
434
|
+
#EmailTextArea{
|
|
435
|
+
text-align: center;
|
|
436
|
+
border: 0px;
|
|
437
|
+
background-color: #eaeaeb;
|
|
438
|
+
margin-top:3%;
|
|
439
|
+
outline: none;
|
|
440
|
+
}
|
|
441
|
+
#emailText{
|
|
442
|
+
width: 80%;
|
|
443
|
+
text-align: center;
|
|
444
|
+
margin-left: 11%;
|
|
445
|
+
margin-top: 8%;
|
|
446
|
+
line-height: 1.29;
|
|
447
|
+
font-size: 17px;
|
|
448
|
+
}
|
|
449
|
+
.emailFooter{
|
|
450
|
+
display: flex;
|
|
451
|
+
justify-content: flex-end;
|
|
452
|
+
flex-direction: row;
|
|
453
|
+
}
|
|
454
|
+
#skipText{
|
|
455
|
+
color: #908f8f;
|
|
456
|
+
cursor: pointer;
|
|
457
|
+
font-size: 13px;
|
|
458
|
+
margin-top: 6%;
|
|
459
|
+
margin-right: 4%;
|
|
460
|
+
letter-spacing: normal;
|
|
461
|
+
|
|
462
|
+
}
|
|
463
|
+
#skipText:hover{
|
|
464
|
+
color: #666666;
|
|
465
|
+
}
|
|
466
|
+
</style>
|