@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.
- package/build/index.js +2 -5
- package/build/sdk.js +2 -2
- package/package.json +4 -5
- package/readme.md +11 -90
- package/server.js +220 -224
- package/src/libraries/localization/getLocale.js +17 -17
- package/src/libraries/localization/locales/cs.js +21 -23
- package/src/libraries/localization/locales/en.js +21 -23
- package/src/libraries/localization/locales/pl.js +21 -23
- package/src/libraries/localization/locales/ro.js +21 -23
- package/src/libraries/localization/locales/ru.js +21 -22
- package/src/libraries/localization/locales/uk.js +21 -23
- package/src/sdk/channels/facebook.js +1 -1
- package/src/sdk/channels/factory.js +33 -33
- package/src/sdk/channels/skype.js +1 -1
- package/src/sdk/channels/telegram.js +2 -2
- package/src/sdk/channels/viber.js +1 -1
- package/src/sdk/channels/vk.js +147 -158
- package/src/sdk/channels/whatsapp.js +21 -27
- package/src/sdk/sdk.js +5 -42
- package/src/sdk/utils/appInsights.js +2 -2
- package/src/sdk/utils/cookies.js +1 -18
- package/src/sdk/utils/loadDeepLink.js +13 -40
- package/src/sdk/widget/widget.js +107 -159
- package/src/widget/components/index.js +48 -52
- package/src/widget/components/tb-notification-button/facebook.js +48 -55
- package/src/widget/components/tb-notification-button/skype.js +47 -0
- package/src/widget/components/tb-notification-button/styles.scss +16 -240
- package/src/widget/components/tb-notification-button/telegram.js +48 -55
- package/src/widget/components/tb-notification-button/viber.js +49 -56
- package/src/widget/components/tb-notification-button/vk.js +83 -92
- package/src/widget/components/tb-notification-button/whatsapp.js +51 -58
- package/src/widget/components/tb-notification-widget/index.js +473 -694
- package/src/widget/components/tb-notification-widget/normalize.scss +1 -2
- package/src/widget/components/tb-notification-widget/styles.scss +180 -543
- package/src/widget/config.js +1 -1
- package/src/widget/icons/icon_facebook_circle.svg +2 -0
- package/src/widget/icons/icon_tg_circle.svg +10 -0
- package/src/widget/icons/icon_viber_circle.svg +10 -0
- package/src/widget/icons/icon_viber_new.svg +1 -1
- package/src/widget/icons/icon_vk_circle.svg +1 -1
- package/src/widget/icons/icon_whatsapp.svg +4 -4
- package/src/widget/icons/icon_whatsapp_circle.svg +2 -2
- package/src/widget/icons/icon_whatsapp_new.svg +2 -2
- package/src/widget/icons/text-back-badge.png +0 -0
- package/src/widget/locales/cz.js +20 -0
- package/src/widget/locales/en.js +20 -42
- package/src/widget/locales/index.js +8 -8
- package/src/widget/locales/pl.js +20 -42
- package/src/widget/locales/ro.js +19 -40
- package/src/widget/locales/ru.js +20 -41
- package/src/widget/locales/uk.js +20 -41
- package/src/widget/utils/getLocale.js +14 -16
- package/src/widget/utils/stringifyAttributes.js +1 -1
- package/src/widget/utils/text.js +8 -9
- package/src/widget/widget.entry.js +1 -0
- package/tests/gf.html +2 -2
- package/v8-compile-cache-0/5.1.281.102/zSvstszSagentzS_workzS5zSszSnode_moduleszSwebpack-clizSbinzScli.js.BLOB +0 -0
- package/v8-compile-cache-0/5.1.281.102/zSvstszSagentzS_workzS5zSszSnode_moduleszSwebpack-clizSbinzScli.js.MAP +1 -0
- package/views/examples.ejs +47 -51
- package/views/sdk.html +17 -35
- package/webpack.dev.js +2 -2
- package/src/sdk/channels/whatsappb.js +0 -27
- package/src/widget/components/tb-notification-button/whatsappb.js +0 -58
- package/src/widget/components/tb-nw-wahunter/index.js +0 -261
- package/src/widget/components/tb-nw-wahunter/styles.scss +0 -471
- package/src/widget/icons/icon_chat_window.svg +0 -1
- package/src/widget/icons/icon_close.svg +0 -1
- package/src/widget/icons/icon_whatsapp_hollow.svg +0 -128
- package/src/widget/icons/icon_whatsappb.svg +0 -147
- package/src/widget/icons/icon_whatsappb_circle.svg +0 -4
- package/src/widget/icons/icon_whatsappb_new.svg +0 -127
- package/src/widget/icons/paper-plane-arrow.svg +0 -3
- package/src/widget/icons/tb-logo-dark-en.svg +0 -17
- package/src/widget/icons/tb-logo-dark-ru.svg +0 -17
- package/src/widget/icons/tb-logo-dark.svg +0 -16
- package/src/widget/icons/tb-logo-light-en.svg +0 -17
- package/src/widget/icons/tb-logo-light-ru.svg +0 -17
- package/src/widget/icons/tb-logo-white.svg +0 -16
- package/src/widget/icons/tb-logo.svg +0 -16
- 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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
<tb-notification-
|
54
|
-
<tb-notification-button__text for="
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
<tb-notification-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|
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('
|
29
|
-
</p>
|
30
|
-
`;
|
31
|
-
} else if(this.config.markUp.style
|
32
|
-
return `
|
33
|
-
<a target="_blank" href="https://api.whatsapp.com/send
|
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
|
39
|
-
return `
|
40
|
-
<
|
41
|
-
<tb-notification-button__icon>${
|
42
|
-
<
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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;
|