@textback/notification-widget 2.0.1-84986 → 2.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/.eslintrc.js +291 -291
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/notificationwidget.iml +9 -0
- package/.idea/vcs.xml +6 -0
- package/build/index.js +3 -3
- package/build/sdk.js +2 -2
- package/package.json +70 -70
- package/promote_tag.sh +1 -1
- package/readme.md +569 -569
- package/server.js +1 -1
- package/src/libraries/ai.1.0.11.js +4088 -4088
- package/src/libraries/localization/locales/index.js +8 -8
- package/src/libraries/localization/text.js +9 -9
- package/src/libraries/t.js +82 -82
- package/src/sdk/channels/channel.js +30 -30
- package/src/sdk/channels/facebook.js +13 -13
- package/src/sdk/channels/skype.js +12 -12
- package/src/sdk/channels/telegram.js +18 -18
- package/src/sdk/channels/viber.js +12 -12
- package/src/sdk/channels/vk-modal/vk-modal.html +17 -17
- package/src/sdk/channels/vk-modal/vk-modal.js +25 -25
- package/src/sdk/channels/vk-modal/vk-modal.scss +116 -116
- package/src/sdk/channels/vk.js +195 -195
- package/src/sdk/events/observer.js +46 -46
- package/src/sdk/index.js +5 -5
- package/src/sdk/sdk.js +67 -67
- package/src/sdk/utils/apiErrorHandler.js +11 -11
- package/src/sdk/utils/appInsights.js +88 -88
- package/src/sdk/utils/browserInfo.js +8 -8
- package/src/sdk/utils/constants.js +17 -17
- package/src/sdk/utils/cookies.js +67 -67
- package/src/sdk/utils/find.js +7 -7
- package/src/sdk/utils/loadConfig.js +20 -20
- package/src/sdk/utils/loadDeepLink.js +48 -48
- package/src/sdk/utils/loadScript.js +25 -25
- package/src/sdk/utils/loadSubscriptions.js +6 -6
- package/src/sdk/utils/parseQueryString.js +33 -33
- package/src/sdk/utils/windowHelper.js +25 -25
- package/src/sdk/widget/widget.js +192 -192
- package/src/widget/components/tb-notification-button/index.js +34 -34
- package/src/widget/components/tb-notification-button/styles.scss +657 -657
- package/src/widget/components/tb-notification-widget/normalize.scss +395 -395
- package/src/widget/components/tb-nw-wahunter/styles.scss +471 -471
- package/src/widget/config.js +5 -5
- package/src/widget/icons/icon_chat_window.svg +1 -1
- package/src/widget/icons/icon_close.svg +1 -1
- package/src/widget/icons/icon_facebook.svg +7 -7
- package/src/widget/icons/icon_facebook_circle.svg +7 -7
- package/src/widget/icons/icon_instagram_circle.svg +95 -95
- package/src/widget/icons/icon_skype.svg +44 -44
- package/src/widget/icons/icon_skype_circle.svg +46 -46
- package/src/widget/icons/icon_skype_new.svg +113 -113
- package/src/widget/icons/icon_tg.svg +25 -25
- package/src/widget/icons/icon_tg_circle.svg +17 -17
- package/src/widget/icons/icon_viber.svg +75 -75
- package/src/widget/icons/icon_viber_circle.svg +67 -67
- package/src/widget/icons/icon_viber_new.svg +102 -102
- package/src/widget/icons/icon_vk.svg +14 -14
- package/src/widget/icons/icon_vk_circle.svg +16 -16
- package/src/widget/icons/icon_whatsapp.svg +147 -147
- package/src/widget/icons/icon_whatsapp_circle.svg +3 -3
- package/src/widget/icons/icon_whatsapp_new.svg +127 -127
- package/src/widget/icons/icon_whatsappb.svg +147 -147
- package/src/widget/icons/icon_whatsappb_circle.svg +3 -3
- package/src/widget/icons/icon_whatsappb_new.svg +127 -127
- package/src/widget/icons/paper-plane-arrow.svg +3 -3
- package/src/widget/icons/tb-logo.svg +21 -21
- package/src/widget/index.js +28 -28
- package/src/widget/locales/cs.js +42 -42
- package/src/widget/locales/en.js +42 -42
- package/src/widget/locales/ro.js +41 -41
- package/src/widget/utils/cookiesEx.js +41 -41
- package/src/widget/utils/stringifyAttributes.js +19 -19
- package/src/widget/utils/widgetsStorage.js +28 -28
- package/src/widget/widget.entry.js +3 -3
- package/tests/gf.html +35 -35
- package/tests/gf.js +21 -21
- package/tests/index.js +61 -61
- package/views/examples.ejs +3 -3
- package/views/sdk.html +274 -274
- package/webpack.common.js +72 -72
- package/webpack.dev.js +15 -15
- package/webpack.prod.js +10 -10
package/views/sdk.html
CHANGED
@@ -1,274 +1,274 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>SDK Test</title>
|
7
|
-
|
8
|
-
<style>
|
9
|
-
button {
|
10
|
-
margin-right: 10px;
|
11
|
-
}
|
12
|
-
|
13
|
-
.tb-buttons,
|
14
|
-
.tb-btn-wrapper,
|
15
|
-
.tb-btn {
|
16
|
-
box-sizing: border-box;
|
17
|
-
text-align: center;
|
18
|
-
}
|
19
|
-
|
20
|
-
.tb-btn-wrapper {
|
21
|
-
position: relative;
|
22
|
-
display: inline-block;
|
23
|
-
}
|
24
|
-
|
25
|
-
.tb-btn-tooltip {
|
26
|
-
position: absolute;
|
27
|
-
opacity: 0;
|
28
|
-
visibility: hidden;
|
29
|
-
|
30
|
-
background-color: rgba(255, 255, 255, 0.9);
|
31
|
-
padding: 5px 7px;
|
32
|
-
border-radius: 3px;
|
33
|
-
color: #6f7b8a;
|
34
|
-
font-size: 10px;
|
35
|
-
z-index: 10;
|
36
|
-
top: 52px;
|
37
|
-
box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.2);
|
38
|
-
transition: opacity 0.4s;
|
39
|
-
}
|
40
|
-
|
41
|
-
.tb-btn-tooltip:before, .tb-btn-tooltip:after {
|
42
|
-
content: ' ';
|
43
|
-
height: 0;
|
44
|
-
position: absolute;
|
45
|
-
width: 0;
|
46
|
-
border: 10px solid transparent;
|
47
|
-
}
|
48
|
-
|
49
|
-
.tb-btn-tooltip:before {
|
50
|
-
position: absolute;
|
51
|
-
top: -19px;
|
52
|
-
left: 70px;
|
53
|
-
z-index: 2;
|
54
|
-
border-bottom-color: #fff;
|
55
|
-
}
|
56
|
-
|
57
|
-
.tb-btn-tooltip:after {
|
58
|
-
position: absolute;
|
59
|
-
top: -25px;
|
60
|
-
left: 67px;
|
61
|
-
z-index: 1;
|
62
|
-
border: 13px solid transparent;
|
63
|
-
border-bottom-color: rgba(0, 0, 0, 0.05);
|
64
|
-
}
|
65
|
-
|
66
|
-
.tb-btn {
|
67
|
-
text-decoration: none;
|
68
|
-
display: inline-block;
|
69
|
-
width: 150px;
|
70
|
-
padding: 10px 25px;
|
71
|
-
margin-top: 5px;
|
72
|
-
margin-bottom: 5px;
|
73
|
-
border-radius: 25px;
|
74
|
-
color: #fff !important;
|
75
|
-
font-size: 15px;
|
76
|
-
font-family: 'Open Sans', 'Droid Sans', Arial, sans-serif;
|
77
|
-
line-height: 17px;
|
78
|
-
transition: box-shadow 0.4s;
|
79
|
-
}
|
80
|
-
|
81
|
-
.tb-btn img {
|
82
|
-
width: 30px;
|
83
|
-
height: 30px;
|
84
|
-
display: inline-block;
|
85
|
-
margin: -10px 0px -10px -15px;
|
86
|
-
}
|
87
|
-
|
88
|
-
.tb-btn:hover {
|
89
|
-
box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.4);
|
90
|
-
}
|
91
|
-
|
92
|
-
.tb-btn:hover + .tb-btn-tooltip {
|
93
|
-
opacity: 1;
|
94
|
-
visibility: visible;
|
95
|
-
}
|
96
|
-
|
97
|
-
.tb-btn.tb-vk {
|
98
|
-
background-color: #45668e;
|
99
|
-
}
|
100
|
-
.tb-btn.tb-tg {
|
101
|
-
background-color: #1E96C8;
|
102
|
-
}
|
103
|
-
.tb-btn.tb-facebook {
|
104
|
-
background-color: #3b5998;
|
105
|
-
}
|
106
|
-
.tb-btn.tb-viber {
|
107
|
-
background-color: #59267c;
|
108
|
-
}
|
109
|
-
.tb-btn.tb-whatsapp {
|
110
|
-
background-color: #189d0e;
|
111
|
-
}
|
112
|
-
.tb-btn.tb-whatsappb {
|
113
|
-
background-color: #189d0e;
|
114
|
-
}
|
115
|
-
</style>
|
116
|
-
|
117
|
-
<!-- <link rel="stylesheet" href="/views/tilda.css"> -->
|
118
|
-
</head>
|
119
|
-
<body>
|
120
|
-
<div class="container-fluid">
|
121
|
-
<div class="row-fluid">
|
122
|
-
<div class="col-lg-12">
|
123
|
-
<!-- <h1>Buttons</h1>
|
124
|
-
<div>
|
125
|
-
<button type="button" id="sign_tg" class="btn btn-primary">Telegram</button>
|
126
|
-
<button type="button" id="sign_vk" class="btn btn-small btn-white">VKontakte</button>
|
127
|
-
<button type="button" id="sign_fb">Facebook</button>
|
128
|
-
<button type="button" id="sign_viber">Viber</button>
|
129
|
-
<button type="button" id="sign_wa" class="btn btn-success">WhatsApp</button>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
<h1>Random</h1>
|
133
|
-
<div>
|
134
|
-
<button type="button" id="sign_random" class="btn btn-lg btn-white"><i class="fa fa-refresh"></i> Subscribe to random messenger</button>
|
135
|
-
</div> -->
|
136
|
-
<div class="tb-buttons">
|
137
|
-
<div class="tb-btn-wrapper" id="tb-link">
|
138
|
-
<a href="#" id="sign_tg" class="tb-btn tb-tg">
|
139
|
-
<img src="//
|
140
|
-
Telegram
|
141
|
-
</a>
|
142
|
-
<div class="tb-btn-tooltip">
|
143
|
-
Нажмите "<strong>Start</strong>" в приложении Telegram
|
144
|
-
</div>
|
145
|
-
</div>
|
146
|
-
<div class="tb-btn-wrapper" id="tb-link">
|
147
|
-
<a href="#" id="sign_vk" class="tb-btn tb-vk">
|
148
|
-
<img src="//
|
149
|
-
VK
|
150
|
-
</a>
|
151
|
-
<div class="tb-btn-tooltip">
|
152
|
-
Нажмите "<strong>Разрешить</strong>" во всплывающем окне
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
<div class="tb-btn-wrapper" id="tb-link">
|
156
|
-
<a href="#" id="sign_fb" class="tb-btn tb-facebook">
|
157
|
-
<img src="//
|
158
|
-
Facebook
|
159
|
-
</a>
|
160
|
-
<div class="tb-btn-tooltip">
|
161
|
-
Нажмите "<strong>Начать</strong>" в Facebook Messenger
|
162
|
-
</div>
|
163
|
-
</div>
|
164
|
-
<div class="tb-btn-wrapper" id="tb-link">
|
165
|
-
<a href="#" id="sign_viber" class="tb-btn tb-viber">
|
166
|
-
<img src="//
|
167
|
-
Viber
|
168
|
-
</a>
|
169
|
-
<div class="tb-btn-tooltip">
|
170
|
-
У вас должно быть установлено <strong>Viber Desktop приложение</strong>
|
171
|
-
</div>
|
172
|
-
</div>
|
173
|
-
<div class="tb-btn-wrapper" id="tb-link">
|
174
|
-
<a href="#" id="sign_wa" class="tb-btn tb-whatsapp">
|
175
|
-
<img src="//
|
176
|
-
WhatsApp
|
177
|
-
</a>
|
178
|
-
<div class="tb-btn-tooltip">
|
179
|
-
Отправьте <strong>предзаполненный текст</strong> в WhatsApp без изменений
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
<div class="tb-btn-wrapper" id="tb-link">
|
183
|
-
<a href="#" id="sign_wab" class="tb-btn tb-whatsapp">
|
184
|
-
<img src="//
|
185
|
-
WhatsApp
|
186
|
-
</a>
|
187
|
-
<div class="tb-btn-tooltip">
|
188
|
-
Отправьте <strong>предзаполненный текст</strong> в WhatsApp без изменений
|
189
|
-
</div>
|
190
|
-
</div>
|
191
|
-
</div>
|
192
|
-
|
193
|
-
<!-- <script src="https://zapier.com/zapbook/embed/widget.js?services=TextBack&container=true&limit=10"></script> -->
|
194
|
-
</div>
|
195
|
-
</div>
|
196
|
-
</div>
|
197
|
-
|
198
|
-
<script>
|
199
|
-
var TextBack = {
|
200
|
-
someProp: 123,
|
201
|
-
};
|
202
|
-
</script>
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
<script src="//
|
207
|
-
<!-- <script src="/build/sdk.js"></script> -->
|
208
|
-
|
209
|
-
<script type="text/javascript">
|
210
|
-
var config = {
|
211
|
-
widgetId: 'a74bf35b-bbef-482d-b4aa-0c6795021806',
|
212
|
-
apiPath: 'https://tb-apisrv-dev.textback.io/api',
|
213
|
-
};
|
214
|
-
|
215
|
-
var off = TextBack.SDK.on('widget.init', function(event) {
|
216
|
-
console.log(`First widget has been initialized. ${event.widgetId}`);
|
217
|
-
off();
|
218
|
-
});
|
219
|
-
|
220
|
-
TextBack.SDK.on('subscription.start', function(event) {
|
221
|
-
console.log('subscription.start', event);
|
222
|
-
});
|
223
|
-
|
224
|
-
TextBack.SDK.initWidget(config).then( function(widget) {
|
225
|
-
// Facebook
|
226
|
-
document.getElementById('sign_fb').addEventListener('click', function(event) {
|
227
|
-
event.preventDefault();
|
228
|
-
widget.subscribe('fb');
|
229
|
-
});
|
230
|
-
|
231
|
-
// Telegram
|
232
|
-
document.getElementById('sign_tg').addEventListener('click', function(event) {
|
233
|
-
event.preventDefault();
|
234
|
-
widget.subscribe('tg');
|
235
|
-
});
|
236
|
-
|
237
|
-
// VKontakte
|
238
|
-
document.getElementById('sign_vk').addEventListener('click', function(event) {
|
239
|
-
event.preventDefault();
|
240
|
-
widget.subscribe('vk');
|
241
|
-
});
|
242
|
-
|
243
|
-
// Viber
|
244
|
-
document.getElementById('sign_viber').addEventListener('click', function(event) {
|
245
|
-
event.preventDefault();
|
246
|
-
widget.subscribe('viber');
|
247
|
-
});
|
248
|
-
|
249
|
-
// WhatsApp
|
250
|
-
document.getElementById('sign_wa').addEventListener('click', function(event) {
|
251
|
-
event.preventDefault();
|
252
|
-
widget.subscribe('whatsapp');
|
253
|
-
});
|
254
|
-
|
255
|
-
// WhatsApp Business
|
256
|
-
document.getElementById('sign_wab').addEventListener('click', function(event) {
|
257
|
-
event.preventDefault();
|
258
|
-
widget.subscribe('whatsappb');
|
259
|
-
});
|
260
|
-
}, function(err) {
|
261
|
-
console.log('error', err)
|
262
|
-
});
|
263
|
-
|
264
|
-
// TextBack.SDK.getWidget(config.widgetId).then(function(widget){
|
265
|
-
// // Random
|
266
|
-
// document.getElementById('sign_random').addEventListener('click', function(event) {
|
267
|
-
// var channels = widget.getEnabledChannels();
|
268
|
-
// var channelIndexToSubscribe = Math.floor(Math.random() * channels.length);
|
269
|
-
// widget.subscribe(channels[channelIndexToSubscribe].channel);
|
270
|
-
// });
|
271
|
-
// });
|
272
|
-
</script>
|
273
|
-
</body>
|
274
|
-
</html>
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>SDK Test</title>
|
7
|
+
|
8
|
+
<style>
|
9
|
+
button {
|
10
|
+
margin-right: 10px;
|
11
|
+
}
|
12
|
+
|
13
|
+
.tb-buttons,
|
14
|
+
.tb-btn-wrapper,
|
15
|
+
.tb-btn {
|
16
|
+
box-sizing: border-box;
|
17
|
+
text-align: center;
|
18
|
+
}
|
19
|
+
|
20
|
+
.tb-btn-wrapper {
|
21
|
+
position: relative;
|
22
|
+
display: inline-block;
|
23
|
+
}
|
24
|
+
|
25
|
+
.tb-btn-tooltip {
|
26
|
+
position: absolute;
|
27
|
+
opacity: 0;
|
28
|
+
visibility: hidden;
|
29
|
+
|
30
|
+
background-color: rgba(255, 255, 255, 0.9);
|
31
|
+
padding: 5px 7px;
|
32
|
+
border-radius: 3px;
|
33
|
+
color: #6f7b8a;
|
34
|
+
font-size: 10px;
|
35
|
+
z-index: 10;
|
36
|
+
top: 52px;
|
37
|
+
box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.2);
|
38
|
+
transition: opacity 0.4s;
|
39
|
+
}
|
40
|
+
|
41
|
+
.tb-btn-tooltip:before, .tb-btn-tooltip:after {
|
42
|
+
content: ' ';
|
43
|
+
height: 0;
|
44
|
+
position: absolute;
|
45
|
+
width: 0;
|
46
|
+
border: 10px solid transparent;
|
47
|
+
}
|
48
|
+
|
49
|
+
.tb-btn-tooltip:before {
|
50
|
+
position: absolute;
|
51
|
+
top: -19px;
|
52
|
+
left: 70px;
|
53
|
+
z-index: 2;
|
54
|
+
border-bottom-color: #fff;
|
55
|
+
}
|
56
|
+
|
57
|
+
.tb-btn-tooltip:after {
|
58
|
+
position: absolute;
|
59
|
+
top: -25px;
|
60
|
+
left: 67px;
|
61
|
+
z-index: 1;
|
62
|
+
border: 13px solid transparent;
|
63
|
+
border-bottom-color: rgba(0, 0, 0, 0.05);
|
64
|
+
}
|
65
|
+
|
66
|
+
.tb-btn {
|
67
|
+
text-decoration: none;
|
68
|
+
display: inline-block;
|
69
|
+
width: 150px;
|
70
|
+
padding: 10px 25px;
|
71
|
+
margin-top: 5px;
|
72
|
+
margin-bottom: 5px;
|
73
|
+
border-radius: 25px;
|
74
|
+
color: #fff !important;
|
75
|
+
font-size: 15px;
|
76
|
+
font-family: 'Open Sans', 'Droid Sans', Arial, sans-serif;
|
77
|
+
line-height: 17px;
|
78
|
+
transition: box-shadow 0.4s;
|
79
|
+
}
|
80
|
+
|
81
|
+
.tb-btn img {
|
82
|
+
width: 30px;
|
83
|
+
height: 30px;
|
84
|
+
display: inline-block;
|
85
|
+
margin: -10px 0px -10px -15px;
|
86
|
+
}
|
87
|
+
|
88
|
+
.tb-btn:hover {
|
89
|
+
box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.4);
|
90
|
+
}
|
91
|
+
|
92
|
+
.tb-btn:hover + .tb-btn-tooltip {
|
93
|
+
opacity: 1;
|
94
|
+
visibility: visible;
|
95
|
+
}
|
96
|
+
|
97
|
+
.tb-btn.tb-vk {
|
98
|
+
background-color: #45668e;
|
99
|
+
}
|
100
|
+
.tb-btn.tb-tg {
|
101
|
+
background-color: #1E96C8;
|
102
|
+
}
|
103
|
+
.tb-btn.tb-facebook {
|
104
|
+
background-color: #3b5998;
|
105
|
+
}
|
106
|
+
.tb-btn.tb-viber {
|
107
|
+
background-color: #59267c;
|
108
|
+
}
|
109
|
+
.tb-btn.tb-whatsapp {
|
110
|
+
background-color: #189d0e;
|
111
|
+
}
|
112
|
+
.tb-btn.tb-whatsappb {
|
113
|
+
background-color: #189d0e;
|
114
|
+
}
|
115
|
+
</style>
|
116
|
+
|
117
|
+
<!-- <link rel="stylesheet" href="/views/tilda.css"> -->
|
118
|
+
</head>
|
119
|
+
<body>
|
120
|
+
<div class="container-fluid">
|
121
|
+
<div class="row-fluid">
|
122
|
+
<div class="col-lg-12">
|
123
|
+
<!-- <h1>Buttons</h1>
|
124
|
+
<div>
|
125
|
+
<button type="button" id="sign_tg" class="btn btn-primary">Telegram</button>
|
126
|
+
<button type="button" id="sign_vk" class="btn btn-small btn-white">VKontakte</button>
|
127
|
+
<button type="button" id="sign_fb">Facebook</button>
|
128
|
+
<button type="button" id="sign_viber">Viber</button>
|
129
|
+
<button type="button" id="sign_wa" class="btn btn-success">WhatsApp</button>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<h1>Random</h1>
|
133
|
+
<div>
|
134
|
+
<button type="button" id="sign_random" class="btn btn-lg btn-white"><i class="fa fa-refresh"></i> Subscribe to random messenger</button>
|
135
|
+
</div> -->
|
136
|
+
<div class="tb-buttons">
|
137
|
+
<div class="tb-btn-wrapper" id="tb-link">
|
138
|
+
<a href="#" id="sign_tg" class="tb-btn tb-tg">
|
139
|
+
<img src="//cdn.jsdelivr.net/npm/@textback/notification-widget@latest/src/widget/icons/icon_tg.svg" alt="">
|
140
|
+
Telegram
|
141
|
+
</a>
|
142
|
+
<div class="tb-btn-tooltip">
|
143
|
+
Нажмите "<strong>Start</strong>" в приложении Telegram
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
<div class="tb-btn-wrapper" id="tb-link">
|
147
|
+
<a href="#" id="sign_vk" class="tb-btn tb-vk">
|
148
|
+
<img src="//cdn.jsdelivr.net/npm/@textback/notification-widget@latest/src/widget/icons/icon_vk.svg" alt="">
|
149
|
+
VK
|
150
|
+
</a>
|
151
|
+
<div class="tb-btn-tooltip">
|
152
|
+
Нажмите "<strong>Разрешить</strong>" во всплывающем окне
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
<div class="tb-btn-wrapper" id="tb-link">
|
156
|
+
<a href="#" id="sign_fb" class="tb-btn tb-facebook">
|
157
|
+
<img src="//cdn.jsdelivr.net/npm/@textback/notification-widget@latest/src/widget/icons/icon_facebook.svg" alt="">
|
158
|
+
Facebook
|
159
|
+
</a>
|
160
|
+
<div class="tb-btn-tooltip">
|
161
|
+
Нажмите "<strong>Начать</strong>" в Facebook Messenger
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
<div class="tb-btn-wrapper" id="tb-link">
|
165
|
+
<a href="#" id="sign_viber" class="tb-btn tb-viber">
|
166
|
+
<img src="//cdn.jsdelivr.net/npm/@textback/notification-widget@latest/src/widget/icons/icon_viber.svg" alt="">
|
167
|
+
Viber
|
168
|
+
</a>
|
169
|
+
<div class="tb-btn-tooltip">
|
170
|
+
У вас должно быть установлено <strong>Viber Desktop приложение</strong>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
<div class="tb-btn-wrapper" id="tb-link">
|
174
|
+
<a href="#" id="sign_wa" class="tb-btn tb-whatsapp">
|
175
|
+
<img src="//cdn.jsdelivr.net/npm/@textback/notification-widget@latest/src/widget/icons/icon_whatsapp.svg" alt="">
|
176
|
+
WhatsApp
|
177
|
+
</a>
|
178
|
+
<div class="tb-btn-tooltip">
|
179
|
+
Отправьте <strong>предзаполненный текст</strong> в WhatsApp без изменений
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
<div class="tb-btn-wrapper" id="tb-link">
|
183
|
+
<a href="#" id="sign_wab" class="tb-btn tb-whatsapp">
|
184
|
+
<img src="//cdn.jsdelivr.net/npm/@textback/notification-widget@latest/src/widget/icons/icon_whatsappb.svg" alt="">
|
185
|
+
WhatsApp
|
186
|
+
</a>
|
187
|
+
<div class="tb-btn-tooltip">
|
188
|
+
Отправьте <strong>предзаполненный текст</strong> в WhatsApp без изменений
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<!-- <script src="https://zapier.com/zapbook/embed/widget.js?services=TextBack&container=true&limit=10"></script> -->
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<script>
|
199
|
+
var TextBack = {
|
200
|
+
someProp: 123,
|
201
|
+
};
|
202
|
+
</script>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<script src="//cdn.jsdelivr.net/npm/@textback/notification-widget@latest/build/sdk.js"></script>
|
207
|
+
<!-- <script src="/build/sdk.js"></script> -->
|
208
|
+
|
209
|
+
<script type="text/javascript">
|
210
|
+
var config = {
|
211
|
+
widgetId: 'a74bf35b-bbef-482d-b4aa-0c6795021806',
|
212
|
+
apiPath: 'https://tb-apisrv-dev.textback.io/api',
|
213
|
+
};
|
214
|
+
|
215
|
+
var off = TextBack.SDK.on('widget.init', function(event) {
|
216
|
+
console.log(`First widget has been initialized. ${event.widgetId}`);
|
217
|
+
off();
|
218
|
+
});
|
219
|
+
|
220
|
+
TextBack.SDK.on('subscription.start', function(event) {
|
221
|
+
console.log('subscription.start', event);
|
222
|
+
});
|
223
|
+
|
224
|
+
TextBack.SDK.initWidget(config).then( function(widget) {
|
225
|
+
// Facebook
|
226
|
+
document.getElementById('sign_fb').addEventListener('click', function(event) {
|
227
|
+
event.preventDefault();
|
228
|
+
widget.subscribe('fb');
|
229
|
+
});
|
230
|
+
|
231
|
+
// Telegram
|
232
|
+
document.getElementById('sign_tg').addEventListener('click', function(event) {
|
233
|
+
event.preventDefault();
|
234
|
+
widget.subscribe('tg');
|
235
|
+
});
|
236
|
+
|
237
|
+
// VKontakte
|
238
|
+
document.getElementById('sign_vk').addEventListener('click', function(event) {
|
239
|
+
event.preventDefault();
|
240
|
+
widget.subscribe('vk');
|
241
|
+
});
|
242
|
+
|
243
|
+
// Viber
|
244
|
+
document.getElementById('sign_viber').addEventListener('click', function(event) {
|
245
|
+
event.preventDefault();
|
246
|
+
widget.subscribe('viber');
|
247
|
+
});
|
248
|
+
|
249
|
+
// WhatsApp
|
250
|
+
document.getElementById('sign_wa').addEventListener('click', function(event) {
|
251
|
+
event.preventDefault();
|
252
|
+
widget.subscribe('whatsapp');
|
253
|
+
});
|
254
|
+
|
255
|
+
// WhatsApp Business
|
256
|
+
document.getElementById('sign_wab').addEventListener('click', function(event) {
|
257
|
+
event.preventDefault();
|
258
|
+
widget.subscribe('whatsappb');
|
259
|
+
});
|
260
|
+
}, function(err) {
|
261
|
+
console.log('error', err)
|
262
|
+
});
|
263
|
+
|
264
|
+
// TextBack.SDK.getWidget(config.widgetId).then(function(widget){
|
265
|
+
// // Random
|
266
|
+
// document.getElementById('sign_random').addEventListener('click', function(event) {
|
267
|
+
// var channels = widget.getEnabledChannels();
|
268
|
+
// var channelIndexToSubscribe = Math.floor(Math.random() * channels.length);
|
269
|
+
// widget.subscribe(channels[channelIndexToSubscribe].channel);
|
270
|
+
// });
|
271
|
+
// });
|
272
|
+
</script>
|
273
|
+
</body>
|
274
|
+
</html>
|