@textback/notification-widget 2.0.1-110396 → 2.0.1-13997

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.
Files changed (81) hide show
  1. package/build/index.js +2 -5
  2. package/build/sdk.js +2 -2
  3. package/package.json +4 -5
  4. package/readme.md +11 -90
  5. package/server.js +220 -224
  6. package/src/libraries/localization/getLocale.js +17 -17
  7. package/src/libraries/localization/locales/cs.js +21 -23
  8. package/src/libraries/localization/locales/en.js +21 -23
  9. package/src/libraries/localization/locales/pl.js +21 -23
  10. package/src/libraries/localization/locales/ro.js +21 -23
  11. package/src/libraries/localization/locales/ru.js +21 -22
  12. package/src/libraries/localization/locales/uk.js +21 -23
  13. package/src/sdk/channels/facebook.js +1 -1
  14. package/src/sdk/channels/factory.js +33 -33
  15. package/src/sdk/channels/skype.js +1 -1
  16. package/src/sdk/channels/telegram.js +2 -2
  17. package/src/sdk/channels/viber.js +1 -1
  18. package/src/sdk/channels/vk.js +147 -158
  19. package/src/sdk/channels/whatsapp.js +21 -27
  20. package/src/sdk/sdk.js +5 -42
  21. package/src/sdk/utils/appInsights.js +2 -2
  22. package/src/sdk/utils/cookies.js +1 -18
  23. package/src/sdk/utils/loadDeepLink.js +13 -40
  24. package/src/sdk/widget/widget.js +107 -159
  25. package/src/widget/components/index.js +48 -52
  26. package/src/widget/components/tb-notification-button/facebook.js +48 -55
  27. package/src/widget/components/tb-notification-button/skype.js +47 -0
  28. package/src/widget/components/tb-notification-button/styles.scss +16 -240
  29. package/src/widget/components/tb-notification-button/telegram.js +48 -55
  30. package/src/widget/components/tb-notification-button/viber.js +49 -56
  31. package/src/widget/components/tb-notification-button/vk.js +83 -92
  32. package/src/widget/components/tb-notification-button/whatsapp.js +51 -58
  33. package/src/widget/components/tb-notification-widget/index.js +473 -694
  34. package/src/widget/components/tb-notification-widget/normalize.scss +1 -2
  35. package/src/widget/components/tb-notification-widget/styles.scss +180 -543
  36. package/src/widget/config.js +1 -1
  37. package/src/widget/icons/icon_facebook_circle.svg +2 -0
  38. package/src/widget/icons/icon_tg_circle.svg +10 -0
  39. package/src/widget/icons/icon_viber_circle.svg +10 -0
  40. package/src/widget/icons/icon_viber_new.svg +1 -1
  41. package/src/widget/icons/icon_vk_circle.svg +1 -1
  42. package/src/widget/icons/icon_whatsapp.svg +4 -4
  43. package/src/widget/icons/icon_whatsapp_circle.svg +2 -2
  44. package/src/widget/icons/icon_whatsapp_new.svg +2 -2
  45. package/src/widget/icons/text-back-badge.png +0 -0
  46. package/src/widget/locales/cz.js +20 -0
  47. package/src/widget/locales/en.js +20 -42
  48. package/src/widget/locales/index.js +8 -8
  49. package/src/widget/locales/pl.js +20 -42
  50. package/src/widget/locales/ro.js +19 -40
  51. package/src/widget/locales/ru.js +20 -41
  52. package/src/widget/locales/uk.js +20 -41
  53. package/src/widget/utils/getLocale.js +14 -16
  54. package/src/widget/utils/stringifyAttributes.js +1 -1
  55. package/src/widget/utils/text.js +8 -9
  56. package/src/widget/widget.entry.js +1 -0
  57. package/tests/gf.html +2 -2
  58. package/v8-compile-cache-0/5.1.281.102/zSvstszSagentzS_workzS5zSszSnode_moduleszSwebpack-clizSbinzScli.js.BLOB +0 -0
  59. package/v8-compile-cache-0/5.1.281.102/zSvstszSagentzS_workzS5zSszSnode_moduleszSwebpack-clizSbinzScli.js.MAP +1 -0
  60. package/views/examples.ejs +47 -51
  61. package/views/sdk.html +17 -35
  62. package/webpack.dev.js +2 -2
  63. package/src/sdk/channels/whatsappb.js +0 -27
  64. package/src/widget/components/tb-notification-button/whatsappb.js +0 -58
  65. package/src/widget/components/tb-nw-wahunter/index.js +0 -261
  66. package/src/widget/components/tb-nw-wahunter/styles.scss +0 -471
  67. package/src/widget/icons/icon_chat_window.svg +0 -1
  68. package/src/widget/icons/icon_close.svg +0 -1
  69. package/src/widget/icons/icon_whatsapp_hollow.svg +0 -128
  70. package/src/widget/icons/icon_whatsappb.svg +0 -147
  71. package/src/widget/icons/icon_whatsappb_circle.svg +0 -4
  72. package/src/widget/icons/icon_whatsappb_new.svg +0 -127
  73. package/src/widget/icons/paper-plane-arrow.svg +0 -3
  74. package/src/widget/icons/tb-logo-dark-en.svg +0 -17
  75. package/src/widget/icons/tb-logo-dark-ru.svg +0 -17
  76. package/src/widget/icons/tb-logo-dark.svg +0 -16
  77. package/src/widget/icons/tb-logo-light-en.svg +0 -17
  78. package/src/widget/icons/tb-logo-light-ru.svg +0 -17
  79. package/src/widget/icons/tb-logo-white.svg +0 -16
  80. package/src/widget/icons/tb-logo.svg +0 -16
  81. package/src/widget/locales/cs.js +0 -42
@@ -0,0 +1,47 @@
1
+ import Button from './index.js';
2
+ import icon from '../../icons/icon_skype.svg';
3
+ import iconNew from '../../icons/icon_skype_new.svg';
4
+ import iconCircle from '../../icons/icon_skype_circle.svg';
5
+
6
+ import constants from '../../../sdk/utils/constants.js';
7
+
8
+ class SkypeButton extends Button {
9
+ render() {
10
+ super.render();
11
+
12
+ const link = this.element.querySelector('a');
13
+ link.addEventListener('click', (event) => {
14
+ event.preventDefault();
15
+ this.channelAPI.subscribe();
16
+ });
17
+ }
18
+
19
+ get template() {
20
+ if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
21
+ return `
22
+ <a target="_blank" href="https://join.skype.com/bot/${this.config.id}?add">
23
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
24
+ <tb-notification-button__text>${this.text('skype')}</tb-notification-button__text>
25
+ </a>
26
+ `;
27
+ } else if (this.config.markUp.style !== 'square') {
28
+ return `
29
+ <a target="_blank" href="https://join.skype.com/bot/${this.config.id}?add">
30
+ <tb-notification-button__icon>${(this.config.markUp.style === 'rounded' ? icon : iconCircle )}</tb-notification-button__icon>
31
+ <tb-notification-button__text>${this.text('skype')}</tb-notification-button__text>
32
+ </a>
33
+ `;
34
+ } else {
35
+ return `
36
+ <div class="tb-notification-button__inner">
37
+ <tb-notification-button__icon>${iconNew}</tb-notification-button__icon>
38
+ <a target="_blank" href="https://join.skype.com/bot/${this.config.id}?add">
39
+ <tb-notification-button__text>${this.text('sign-skype')}</tb-notification-button__text>
40
+ </a>
41
+ </div>
42
+ `;
43
+ }
44
+ }
45
+ };
46
+
47
+ module.exports = SkypeButton;
@@ -1,21 +1,9 @@
1
1
  $color-fb: #3b5998;
2
- $color-fb-gradient: #6077a6;
3
-
4
- $color-vk: #4a76a8;
5
- $color-vk-gradient: #0f65c6;
6
-
7
- $color-tg: #61A8DE;
8
- $color-tg-gradient:#408AC2;
9
-
2
+ $color-vk: #45668e;
3
+ $color-tg: #1E96C8;
10
4
  $color-skype: #00aff0;
11
- $color-skype-gradient:#00d0e7;
12
-
13
- $color-viber: #574e92;
14
- $color-viber-gradient:#655bab;
15
-
16
- $color-whatsapp: #25D366;
17
- $color-whatsappb: #25D366;
18
- $color-whatsapp-gradient:#2fc368;
5
+ $color-viber: #59267c;
6
+ $color-whatsapp: #189d0e;
19
7
 
20
8
  @mixin shadow-on-hover() {
21
9
  transition: box-shadow 0.4s;
@@ -25,14 +13,6 @@ $color-whatsapp-gradient:#2fc368;
25
13
  }
26
14
  }
27
15
 
28
- @mixin shadow-on-hover-gradient() {
29
- transition: box-shadow 0.4s;
30
-
31
- &:hover {
32
- box-shadow:inset 0 0 3px 3px rgba(0, 0, 0, 0.4);
33
- }
34
- }
35
-
36
16
  @mixin set-channel-button-brand-color($color) {
37
17
  .tb-notification-button__inner > a {
38
18
  background-color: $color;
@@ -43,9 +23,6 @@ $color-whatsapp-gradient:#2fc368;
43
23
  }
44
24
  }
45
25
 
46
- @mixin set-channel-button-brand-linear-gradient-color($color, $color-gradient) {
47
- background: linear-gradient(309.02deg, $color -6.45%, $color-gradient 111.08%);
48
- }
49
26
 
50
27
  tb-notification-widget {
51
28
  #tb-notification-widget-inner.tb-notification-widget-inner {
@@ -75,7 +52,7 @@ tb-notification-widget {
75
52
  text-align: right;
76
53
  }
77
54
  }
78
-
55
+
79
56
  /* new design */
80
57
 
81
58
  #tb-notification-widget-inner.tb-notification-widget-inner .tb-widget-buttons.tb-btn-style-square {
@@ -86,7 +63,6 @@ tb-notification-widget {
86
63
  margin: 0px 0px 20px;
87
64
  padding: 0px;
88
65
  background-color: transparent;
89
- height: 30px;
90
66
 
91
67
 
92
68
 
@@ -105,7 +81,7 @@ tb-notification-widget {
105
81
  @include shadow-on-hover();
106
82
  }
107
83
  }
108
-
84
+
109
85
  &[authorized="true"] tb-notification-button__text[for="login"], &[authorized="false"] tb-notification-button__text[for="subscribe"] {
110
86
  display: none;
111
87
  }
@@ -116,7 +92,7 @@ tb-notification-widget {
116
92
  background-color: $color-viber;
117
93
  }
118
94
  }
119
-
95
+
120
96
  &[channel="tg"] {
121
97
  @include set-channel-button-brand-color($color-tg);
122
98
  }
@@ -126,13 +102,7 @@ tb-notification-widget {
126
102
  background-color: $color-whatsapp;
127
103
  }
128
104
  }
129
-
130
- &[channel="whatsappb"] {
131
- .tb-notification-button__inner > a {
132
- background-color: $color-whatsappb;
133
- }
134
- }
135
-
105
+
136
106
  &[loading] {
137
107
  color: transparent;
138
108
  &:after {
@@ -166,7 +136,7 @@ tb-notification-widget {
166
136
  all: initial;
167
137
  display: block;
168
138
  box-sizing: content-box;
169
- border-radius: 4px;
139
+ border-radius: 2px;
170
140
  cursor: pointer;
171
141
  color: #fff;
172
142
  position: relative;
@@ -208,7 +178,7 @@ tb-notification-widget {
208
178
 
209
179
  /* old design */
210
180
  #tb-notification-widget-inner.tb-notification-widget-inner .tb-widget-buttons.tb-btn-style-rounded {
211
-
181
+
212
182
  /* inline */
213
183
  tb-notification-button {
214
184
  @include shadow-on-hover();
@@ -222,7 +192,7 @@ tb-notification-widget {
222
192
  display: inline-block;
223
193
  margin: 0 13px 45px 0;
224
194
  position: relative;
225
-
195
+
226
196
  &[channel="skype"] {
227
197
  background-color: $color-skype;
228
198
  }
@@ -244,9 +214,6 @@ tb-notification-widget {
244
214
  &[channel="whatsapp"] {
245
215
  background-color: $color-whatsapp;
246
216
  }
247
- &[channel="whatsappb"] {
248
- background-color: $color-whatsappb;
249
- }
250
217
  &[loading] {
251
218
  color: transparent;
252
219
  &:after {
@@ -346,158 +313,12 @@ tb-notification-widget {
346
313
  }
347
314
  }
348
315
 
349
- /* old design */
350
- #tb-notification-widget-inner.tb-notification-widget-inner .tb-widget-buttons.tb-btn-style-gradient {
351
316
 
352
- /* inline */
353
- tb-notification-button {
354
- @include shadow-on-hover-gradient();
355
-
356
- box-sizing: content-box;
357
- padding: 21px 36px;
358
- border-radius: 5px;
359
- cursor: pointer;
360
- background-color: #2979FF;
361
- color: #fff;
362
- display: inline-block;
363
- margin: 0 13px 45px 0;
364
- position: relative;
365
-
366
- &[channel="skype"] {
367
- @include set-channel-button-brand-linear-gradient-color($color-skype, $color-skype-gradient);
368
- }
369
- &[channel="facebook"] {
370
- @include set-channel-button-brand-linear-gradient-color($color-fb, $color-fb-gradient);
371
- }
372
- &[channel="vk"] {
373
- @include set-channel-button-brand-linear-gradient-color($color-vk, $color-vk-gradient);
374
- padding: 19px 36px;
375
- }
376
- &[authorized="true"] tb-notification-button__text[for="login"], &[authorized="false"] tb-notification-button__text[for="subscribe"] {
377
- display: none;
378
- }
379
- &[channel="viber"] {
380
- @include set-channel-button-brand-linear-gradient-color($color-viber, $color-viber-gradient);
381
- }
382
- &[channel="tg"] {
383
- @include set-channel-button-brand-linear-gradient-color($color-tg, $color-tg-gradient);
384
- }
385
- &[channel="whatsapp"] {
386
- @include set-channel-button-brand-linear-gradient-color($color-whatsapp, $color-whatsapp-gradient);
387
- }
388
- &[channel="whatsappb"] {
389
- @include set-channel-button-brand-linear-gradient-color($color-whatsappb, $color-whatsapp-gradient);
390
- }
391
- &[loading] {
392
- color: transparent;
393
- &:after {
394
- content: "";
395
- border-radius: 100%;
396
- border: 3px solid #fff;
397
- border-bottom-color: transparent;
398
- position: absolute;
399
- top: 50%;
400
- left: 50%;
401
- width: 16px;
402
- height: 16px;
403
- margin: -11px 0 0 -11px;
404
- animation-name: spin;
405
- animation-duration: 1000ms;
406
- animation-iteration-count: infinite;
407
- }
408
- }
409
- > a {
410
- all: initial;
411
- display: block;
412
- text-decoration: none;
413
- color: #fff;
414
- font-family: inherit;
415
- //font-size: 17px;
416
- margin: -10px -20px;
417
- //padding: 10px 20px;
418
- text-decoration: none !important;
419
-
420
- padding: 6px 30px 8px;
421
- min-width: 110px;
422
- text-align: center;
423
- font-size: 15px;
424
-
425
- &:hover {
426
- color: #fff;
427
- }
428
- }
429
-
430
- &[channel="viber"] tb-notification-button__icon {
431
- > svg {
432
- width: 110%;
433
- height: 110%;
434
- }
435
- }
436
- }
437
-
438
- tb-notification-button__text {
439
- display: inline-block;
440
- vertical-align: middle;
441
- }
442
-
443
- tb-notification-button__icon {
444
- display: inline-block;
445
- vertical-align: middle;
446
- //width: 40px;
447
- //height: 40px;
448
- width: 30px;
449
- height: 30px;
450
- margin: -10px 0 -10px -15px;
451
- > svg {
452
- width: 100%;
453
- height: 100%;
454
- }
455
- }
456
- }
457
-
458
- &.tb-no-api-call #tb-notification-widget-inner.tb-notification-widget-inner .tb-widget-buttons.tb-btn-style-gradient tb-notification-button {
459
- margin-bottom: 13px;
460
- }
461
-
462
- /* popup */
463
- #tb-notification-widget-inner.tb-notification-widget-inner tb-notification-widget-overlay .tb-widget-buttons.tb-btn-style-gradient {
464
- tb-notification-button {
465
- display: inline-block;
466
- width: 120px;
467
- height: 24px;
468
- padding: 0px;
469
- margin: 0px 0px 18px 0px;
470
-
471
- > a {
472
- position: relative;
473
- text-align: center;
474
- font-size: 12px;
475
- padding: 5px 20px;
476
- margin: 0px;
477
- }
478
- }
479
- tb-notification-button__icon {
480
- display: block;
481
- position: absolute;
482
- left: 8px;
483
- top: 2px;
484
- width: 20px;
485
- height: 20px;
486
- margin: 0px;
487
- padding: 0px;
488
- }
489
- tb-notification-button__text {
490
- vertical-align: baseline;
491
- width: 60px;
492
- text-align: center;
493
- color: #fff;
494
- }
495
- }
496
317
 
497
318
 
498
319
  /* circle icons design */
499
320
  #tb-notification-widget-inner.tb-notification-widget-inner .tb-widget-buttons.tb-btn-style-icons {
500
-
321
+
501
322
  /* inline */
502
323
  tb-notification-button {
503
324
  display: inline-block;
@@ -535,29 +356,13 @@ tb-notification-widget {
535
356
 
536
357
  min-width: 80px;
537
358
  text-align: center;
538
- font-size: 15px;
359
+ font-size: 13px;
539
360
  color: #333;
540
361
 
541
362
  &:hover {
542
363
  cursor: pointer;
543
364
  }
544
365
  }
545
-
546
- &[channel="whatsappb"] tb-notification-button__icon, &[channel="whatsapp"] tb-notification-button__icon {
547
- background: $color-whatsapp;
548
- }
549
-
550
- &[channel="viber"] tb-notification-button__icon {
551
- background: $color-viber;
552
- }
553
-
554
- &[channel="tg"] tb-notification-button__icon {
555
- background: $color-tg;
556
- }
557
-
558
- &[channel="facebook"] tb-notification-button__icon {
559
- background: $color-fb;
560
- }
561
366
  }
562
367
 
563
368
  tb-notification-button__text {
@@ -567,42 +372,19 @@ tb-notification-widget {
567
372
 
568
373
  tb-notification-button__icon {
569
374
  display: block;
570
- position: relative;
571
375
  width: 50px;
572
376
  height: 50px;
573
- margin: 0 auto;
574
- transition: all .3s ease;
575
- border-radius: 50%;
576
- box-shadow: 0 6px 12px rgba(0,0,0,.25);
377
+ margin: 0px auto;
577
378
  > svg {
578
379
  width: 100%;
579
380
  height: 100%;
580
381
  }
581
-
582
- &[channel="whatsappb"] svg {
583
- display: block;
584
- position: absolute;
585
- top: 0;
586
- bottom: 0;
587
- left: 0;
588
- right: 0;
589
- margin: auto;
590
- width: 50%;
591
- height: 50%;
592
- }
593
-
594
- &:hover {
595
- -webkit-transform: scale(1.3);
596
- -ms-transform: scale(1.3);
597
- transform: scale(1.3);
598
- }
599
- }
600
382
  }
601
383
  }
602
384
 
603
385
  /*styles for non mobile*/
604
386
  @media only screen and (min-device-width: 736px) {
605
-
387
+
606
388
  /* new design */
607
389
 
608
390
  #tb-notification-widget-inner.tb-notification-widget-inner .tb-widget-buttons.tb-btn-style-square {
@@ -648,10 +430,4 @@ tb-notification-widget {
648
430
  }
649
431
  }
650
432
  }
651
-
652
- // Dirty crutch. There is no other way now *'(
653
- tb-notification-widget-popup.tb-popup-with-image .tb-widget-buttons > div:last-child {
654
- tb-notification-button {
655
- margin-bottom: 0 !important;
656
- }
657
- }
433
+ }
@@ -1,55 +1,48 @@
1
- import Button from './index.js';
2
- import icon from '../../icons/icon_tg.svg';
3
- import iconCircle from '../../icons/icon_tg_circle.svg';
4
- import constants from '../../../sdk/utils/constants.js';
5
-
6
- class TelegramButton extends Button {
7
- render() {
8
- super.render();
9
-
10
- const link = this.element.querySelector('a');
11
- link.addEventListener('click', (event) => {
12
- event.preventDefault();
13
- this.channelAPI.subscribe();
14
- });
15
- }
16
-
17
- get template() {
18
- if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
19
- return `
20
- <a target="_blank" href="https://telegram.me/${this.config.id}?start=${this.deepLink}">
21
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
22
- <tb-notification-button__text>${this.text('telegram')}</tb-notification-button__text>
23
- </a>
24
- <p class="tb-notification-button__tip">
25
- ${this.text('telegramTip')}
26
- </p>
27
- `;
28
- } else if(this.config.markUp.style === 'gradient') {
29
- return `
30
- <a target="_blank" href="https://telegram.me/${this.config.id}?start=${this.deepLink}">
31
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
32
- <tb-notification-button__text>${this.text('telegram')}</tb-notification-button__text>
33
- </a>
34
- `;
35
- } else if (this.config.markUp.style !== 'square') {
36
- return `
37
- <a target="_blank" href="https://telegram.me/${this.config.id}?start=${this.deepLink}">
38
- <tb-notification-button__icon>${ (this.config.markUp.style === 'rounded' ? icon : iconCircle) }</tb-notification-button__icon>
39
- <tb-notification-button__text>${this.text('telegram')}</tb-notification-button__text>
40
- </a>
41
- `;
42
- } else {
43
- return `
44
- <div class="tb-notification-button__inner">
45
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
46
- <a target="_blank" href="https://telegram.me/${this.config.id}?start=${this.deepLink}">
47
- <tb-notification-button__text>${this.text('telegramExtended')}</tb-notification-button__text>
48
- </a>
49
- </div>
50
- `;
51
- }
52
- }
53
- };
54
-
55
- module.exports = TelegramButton;
1
+ import Button from './index.js';
2
+ import icon from '../../icons/icon_tg.svg';
3
+ import iconCircle from '../../icons/icon_tg_circle.svg';
4
+ import constants from '../../../sdk/utils/constants.js';
5
+
6
+ class TelegramButton extends Button {
7
+ render() {
8
+ super.render();
9
+
10
+ const link = this.element.querySelector('a');
11
+ link.addEventListener('click', (event) => {
12
+ event.preventDefault();
13
+ this.channelAPI.subscribe();
14
+ });
15
+ }
16
+
17
+ get template() {
18
+ if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
19
+ return `
20
+ <a target="_blank" href="https://telegram.me/${this.config.id}?start=${this.deepLink}">
21
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
22
+ <tb-notification-button__text>${this.text('telegram')}</tb-notification-button__text>
23
+ </a>
24
+ <p class="tb-notification-button__tip">
25
+ ${this.text('telegram_tip')}
26
+ </p>
27
+ `;
28
+ } else if (this.config.markUp.style !== 'square') {
29
+ return `
30
+ <a target="_blank" href="https://telegram.me/${this.config.id}?start=${this.deepLink}">
31
+ <tb-notification-button__icon>${ (this.config.markUp.style === 'rounded' ? icon : iconCircle) }</tb-notification-button__icon>
32
+ <tb-notification-button__text>${this.text('telegram')}</tb-notification-button__text>
33
+ </a>
34
+ `;
35
+ } else {
36
+ return `
37
+ <div class="tb-notification-button__inner">
38
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
39
+ <a target="_blank" href="https://telegram.me/${this.config.id}?start=${this.deepLink}">
40
+ <tb-notification-button__text>${this.text('sign-telegram')}</tb-notification-button__text>
41
+ </a>
42
+ </div>
43
+ `;
44
+ }
45
+ }
46
+ };
47
+
48
+ module.exports = TelegramButton;
@@ -1,57 +1,50 @@
1
- import Button from './index.js';
2
- import icon from '../../icons/icon_viber.svg';
3
- import iconNew from '../../icons/icon_viber_new.svg';
4
- import iconCircle from '../../icons/icon_viber_circle.svg';
5
- import constants from '../../../sdk/utils/constants.js';
6
-
7
- class ViberButton extends Button {
8
- render() {
9
- super.render();
10
-
11
- const link = this.element.querySelector('a');
12
- link.addEventListener('click', (event) => {
13
- event.preventDefault();
14
- this.channelAPI.subscribe();
15
- });
16
- }
17
-
18
- get template() {
19
- if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
20
- return `
21
- <a target="_blank" href="viber://pa?chatURI=${this.config.id}&context=${this.deepLink}">
22
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
23
- <tb-notification-button__text>${this.text('viber')}</tb-notification-button__text>
24
- </a>
25
- <p class="tb-notification-button__tip">
26
- ${this.text('viberTip')}
27
- </p>
28
- `;
29
- } else if(this.config.markUp.style === 'gradient') {
30
- return `
31
- <a target="_blank" href="viber://pa?chatURI=${this.config.id}&context=${this.deepLink}">
32
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
33
- <tb-notification-button__text>${this.text('viber')}</tb-notification-button__text>
34
- </a>
35
- `;
36
- } else if (this.config.markUp.style !== 'square') {
37
- return `
38
- <a target="_blank" href="viber://pa?chatURI=${this.config.id}&context=${this.deepLink}">
39
- <tb-notification-button__icon>${( this.config.markUp.style === 'rounded' ? icon : iconCircle )}</tb-notification-button__icon>
40
- <tb-notification-button__text>${this.text('viber')}</tb-notification-button__text>
41
- </a>
42
- `;
43
- } else {
44
- return `
45
- <div class="tb-notification-button__inner">
46
- <tb-notification-button__icon>${iconNew}</tb-notification-button__icon>
47
- <a target="_blank" href="viber://pa?chatURI=${this.config.id}&context=${this.deepLink}">
48
- <tb-notification-button__text>${this.text('viberExtended')}</tb-notification-button__text>
49
- </a>
50
- </div>
51
- `;
52
- }
53
-
54
- }
55
- };
56
-
1
+ import Button from './index.js';
2
+ import icon from '../../icons/icon_viber.svg';
3
+ import iconNew from '../../icons/icon_viber_new.svg';
4
+ import iconCircle from '../../icons/icon_viber_circle.svg';
5
+ import constants from '../../../sdk/utils/constants.js';
6
+
7
+ class ViberButton extends Button {
8
+ render() {
9
+ super.render();
10
+
11
+ const link = this.element.querySelector('a');
12
+ link.addEventListener('click', (event) => {
13
+ event.preventDefault();
14
+ this.channelAPI.subscribe();
15
+ });
16
+ }
17
+
18
+ get template() {
19
+ if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
20
+ return `
21
+ <a target="_blank" href="viber://pa?chatURI=${this.config.id}&context=${this.deepLink}">
22
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
23
+ <tb-notification-button__text>${this.text('viber')}</tb-notification-button__text>
24
+ </a>
25
+ <p class="tb-notification-button__tip">
26
+ ${this.text('viber_tip')}
27
+ </p>
28
+ `;
29
+ } else if (this.config.markUp.style !== 'square') {
30
+ return `
31
+ <a target="_blank" href="viber://pa?chatURI=${this.config.id}&context=${this.deepLink}">
32
+ <tb-notification-button__icon>${( this.config.markUp.style === 'rounded' ? icon : iconCircle )}</tb-notification-button__icon>
33
+ <tb-notification-button__text>${this.text('viber')}</tb-notification-button__text>
34
+ </a>
35
+ `;
36
+ } else {
37
+ return `
38
+ <div class="tb-notification-button__inner">
39
+ <tb-notification-button__icon>${iconNew}</tb-notification-button__icon>
40
+ <a target="_blank" href="viber://pa?chatURI=${this.config.id}&context=${this.deepLink}">
41
+ <tb-notification-button__text>${this.text('sign-viber')}</tb-notification-button__text>
42
+ </a>
43
+ </div>
44
+ `;
45
+ }
46
+
47
+ }
48
+ };
49
+
57
50
  module.exports = ViberButton;