@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
@@ -1,92 +1,83 @@
1
- /* eslint no-console: "off" */
2
-
3
- import Button from './index.js';
4
- import UUID from 'uuid-js';
5
- import icon from '../../icons/icon_vk.svg';
6
- import iconCircle from '../../icons/icon_vk_circle.svg';
7
- import constants from '../../../sdk/utils/constants.js';
8
-
9
- class VKButton extends Button {
10
- constructor() {
11
- super(...arguments);
12
-
13
- this.useVkApp = this.widget.config.useVkApp;
14
- this.landingUrl = this.config.additionalProperties ? this.config.additionalProperties.landingUrl : undefined;
15
- this.element.setAttribute('type', this.config.type || 'widget');
16
-
17
- this.buttonContainerId = UUID.create(4).hex;
18
-
19
- if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
20
- this.element.setAttribute('authorized', this.channelAPI.authorized);
21
- this.element.addEventListener('click', event => {
22
- event.preventDefault();
23
- this.channelAPI.subscribeViaApi();
24
- });
25
-
26
- this.set({
27
- ready: true
28
- });
29
- } else if (this.useVkApp || this.config.markUp.style !== 'square'|| this.config.markUp.style === 'gradient' || this.landingUrl) {
30
- this.element.addEventListener('click', event => {
31
- event.preventDefault();
32
- this.channelAPI.subscribe();
33
- });
34
-
35
- this.set({
36
- ready: true
37
- });
38
- } else {
39
- this.set({
40
- ready: true
41
- });
42
-
43
- this.channelAPI.renderVKSubscriptionButton(30, this.buttonContainerId);
44
- }
45
- }
46
-
47
-
48
- get template() {
49
- if (this.ready) {
50
- if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
51
- return `
52
- <a href="javascript:void(0)">
53
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
54
- <tb-notification-button__text for="login">${this.text('vkontakteLogin')}</tb-notification-button__text>
55
- <tb-notification-button__text for="subscribe">${this.text('vkontakte')}</tb-notification-button__text>
56
- </a>
57
- <p class="tb-notification-button__tip">
58
- ${this.text('vkontakteTip')}
59
- </p>
60
- `;
61
- } else if(this.config.markUp.style === 'gradient') {
62
- return `
63
- <a class="vk-app-link" href="#">
64
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
65
- <tb-notification-button__text>${this.text('vkontakte')}</tb-notification-button__text>
66
- </a>
67
- `;
68
- } else if (this.config.markUp.style !== 'square') {
69
- return `
70
- <a href="#">
71
- <tb-notification-button__icon>${(this.config.markUp.style === 'rounded' ? icon : iconCircle)}</tb-notification-button__icon>
72
- <tb-notification-button__text>${this.text('vkontakte')}</tb-notification-button__text>
73
- </a>
74
- `;
75
- } else {
76
- return `
77
- <div class="tb-notification-button__inner">
78
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
79
- <a id="${this.buttonContainerId}">
80
- ${
81
- this.useVkApp || this.landingUrl ? this.text('vkontakteExtended') : ''
82
- }
83
- </a>
84
- </div>
85
- `
86
- }
87
- }
88
- return '';
89
- }
90
- }
91
-
92
- module.exports = VKButton;
1
+ /* eslint no-console: "off" */
2
+
3
+ import Button from './index.js';
4
+ import UUID from 'uuid-js';
5
+ import icon from '../../icons/icon_vk.svg';
6
+ import iconCircle from '../../icons/icon_vk_circle.svg';
7
+ import constants from '../../../sdk/utils/constants.js';
8
+
9
+ class VKButton extends Button {
10
+ constructor() {
11
+ super(...arguments);
12
+
13
+ this.useVkApp = this.widget.config.useVkApp;
14
+ this.element.setAttribute('type', this.config.type || 'widget');
15
+
16
+ this.buttonContainerId = UUID.create(4).hex;
17
+
18
+ if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
19
+ this.element.setAttribute('authorized', this.channelAPI.authorized);
20
+ this.element.addEventListener('click', event => {
21
+ event.preventDefault();
22
+ this.channelAPI.subscribeViaApi();
23
+ });
24
+
25
+ this.set({
26
+ ready: true
27
+ });
28
+ } else if (this.useVkApp || this.config.markUp.style !== 'square') {
29
+ this.element.addEventListener('click', event => {
30
+ event.preventDefault();
31
+ this.channelAPI.subscribe();
32
+ });
33
+
34
+ this.set({
35
+ ready: true
36
+ });
37
+ } else {
38
+ this.set({
39
+ ready: true
40
+ });
41
+
42
+ this.channelAPI.renderVKSubscriptionButton(30, this.buttonContainerId);
43
+ }
44
+ }
45
+
46
+
47
+ get template() {
48
+ if (this.ready) {
49
+ if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
50
+ return `
51
+ <a href="javascript:void(0)">
52
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
53
+ <tb-notification-button__text for="login">${this.text('vkontakte login')}</tb-notification-button__text>
54
+ <tb-notification-button__text for="subscribe">${this.text('vkontakte')}</tb-notification-button__text>
55
+ </a>
56
+ <p class="tb-notification-button__tip">
57
+ ${this.text('vkontakte_tip')}
58
+ </p>
59
+ `;
60
+ } else if (this.config.markUp.style !== 'square') {
61
+ return `
62
+ <a href="#">
63
+ <tb-notification-button__icon>${(this.config.markUp.style === 'rounded' ? icon : iconCircle)}</tb-notification-button__icon>
64
+ <tb-notification-button__text>${this.text('vkontakte')}</tb-notification-button__text>
65
+ </a>
66
+ `;
67
+ } else {
68
+ return this.useVkApp
69
+ ?`<a class="vk-app-link" href="#">
70
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
71
+ <tb-notification-button__text>${this.text('vkontakte')}</tb-notification-button__text>
72
+ </a>`
73
+ :`<div class="tb-notification-button__inner">
74
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
75
+ <a id="${this.buttonContainerId}"></a>
76
+ </div>`;
77
+ }
78
+ }
79
+ return '';
80
+ }
81
+ }
82
+
83
+ module.exports = VKButton;
@@ -1,58 +1,51 @@
1
- import Button from './index.js';
2
- import icon from '../../icons/icon_whatsapp.svg';
3
- import iconNew from '../../icons/icon_whatsapp_new.svg';
4
- import iconCircle from '../../icons/icon_whatsapp_circle.svg';
5
- import constants from '../../../sdk/utils/constants.js';
6
-
7
- const prefixText = encodeURIComponent('Отправьте не изменяя это сообщение ');
8
-
9
- class WhatsappButton extends Button {
10
- render() {
11
- super.render();
12
-
13
- const link = this.element.querySelector('a');
14
- link.addEventListener('click', (event) => {
15
- event.preventDefault();
16
- this.channelAPI.subscribe();
17
- });
18
- }
19
-
20
- get template() {
21
- if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
22
- return `
23
- <a target="_blank" href="https://api.whatsapp.com/send/?phone=+${this.config.id}&text=${prefixText + this.deepLink}">
24
- <tb-notification-button__icon>${icon}</tb-notification-button__icon>
25
- <tb-notification-button__text>${this.text('whatsapp')}</tb-notification-button__text>
26
- </a>
27
- <p class="tb-notification-button__tip">
28
- ${this.text('whatsappTip')}
29
- </p>
30
- `;
31
- } else if(this.config.markUp.style === 'gradient' || this.config.markUp.style === 'icons') {
32
- return `
33
- <a target="_blank" href="https://api.whatsapp.com/send/?phone=+${this.config.id}&text=${prefixText + this.deepLink}">
34
- <tb-notification-button__icon>${iconCircle}</tb-notification-button__icon>
35
- <tb-notification-button__text>${this.text('whatsapp')}</tb-notification-button__text>
36
- </a>
37
- `;
38
- } else if (this.config.markUp.style !== 'square') {
39
- return `
40
- <a target="_blank" href="https://api.whatsapp.com/send/?phone=+${this.config.id}&text=${prefixText + this.deepLink}">
41
- <tb-notification-button__icon>${( this.config.markUp.style === 'rounded' ? iconCircle : icon )}</tb-notification-button__icon>
42
- <tb-notification-button__text>${this.text('whatsapp')}</tb-notification-button__text>
43
- </a>
44
- `;
45
- } else {
46
- return `
47
- <div class="tb-notification-button__inner">
48
- <tb-notification-button__icon>${iconNew}</tb-notification-button__icon>
49
- <a target="_blank" href="https://api.whatsapp.com/send/?phone=+${this.config.id}&text=${prefixText + this.deepLink}">
50
- <tb-notification-button__text>${this.text('whatsappExtended')}</tb-notification-button__text>
51
- </a>
52
- </div>
53
- `;
54
- }
55
- }
56
- };
57
-
58
- module.exports = WhatsappButton;
1
+ import Button from './index.js';
2
+ import icon from '../../icons/icon_whatsapp.svg';
3
+ import iconNew from '../../icons/icon_whatsapp_new.svg';
4
+ import iconCircle from '../../icons/icon_whatsapp_circle.svg';
5
+ import constants from '../../../sdk/utils/constants.js';
6
+
7
+ const prefixText = encodeURIComponent('Отправьте не изменяя это сообщение ');
8
+
9
+ class WhatsappButton extends Button {
10
+ render() {
11
+ super.render();
12
+
13
+ const link = this.element.querySelector('a');
14
+ link.addEventListener('click', (event) => {
15
+ event.preventDefault();
16
+ this.channelAPI.subscribe();
17
+ });
18
+ }
19
+
20
+ get template() {
21
+ if (this.config.type === constants.WIDGET_TYPE_API_CALL) {
22
+ return `
23
+ <a target="_blank" href="https://api.whatsapp.com/send?phone=${this.config.id}&text=${prefixText + this.deepLink}">
24
+ <tb-notification-button__icon>${icon}</tb-notification-button__icon>
25
+ <tb-notification-button__text>${this.text('whatsapp')}</tb-notification-button__text>
26
+ </a>
27
+ <p class="tb-notification-button__tip">
28
+ ${this.text('whatsapp_tip')}
29
+ </p>
30
+ `;
31
+ } else if (this.config.markUp.style !== 'square') {
32
+ return `
33
+ <a target="_blank" href="https://api.whatsapp.com/send?phone=${this.config.id}&text=${prefixText + this.deepLink}">
34
+ <tb-notification-button__icon>${( this.config.markUp.style === 'rounded' ? icon : iconCircle )}</tb-notification-button__icon>
35
+ <tb-notification-button__text>${this.text('whatsapp')}</tb-notification-button__text>
36
+ </a>
37
+ `;
38
+ } else {
39
+ return `
40
+ <div class="tb-notification-button__inner">
41
+ <tb-notification-button__icon>${iconNew}</tb-notification-button__icon>
42
+ <a target="_blank" href="https://api.whatsapp.com/send?phone=${this.config.id}&text=${prefixText + this.deepLink}">
43
+ <tb-notification-button__text>${this.text('sign-whatsapp')}</tb-notification-button__text>
44
+ </a>
45
+ </div>
46
+ `;
47
+ }
48
+ }
49
+ };
50
+
51
+ module.exports = WhatsappButton;