@textback/notification-widget 2.0.1-103341 → 2.0.1-110242
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 +3 -3
- package/build/sdk.js +2 -2
- package/package.json +1 -1
- package/server.js +224 -224
- package/src/sdk/sdk.js +6 -7
- package/src/sdk/widget/widget.js +7 -7
- package/src/widget/components/tb-notification-widget/index.js +6 -6
- package/src/widget/components/tb-nw-wahunter/index.js +8 -47
- package/src/widget/icons/tb-logo-dark.svg +16 -0
- package/src/widget/icons/tb-logo-white.svg +16 -0
- package/src/widget/icons/tb-logo.svg +15 -20
- package/views/sdk.html +215 -259
- package/webpack.dev.js +2 -3
package/server.js
CHANGED
@@ -1,224 +1,224 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
const express = require('express');
|
4
|
-
const app = express();
|
5
|
-
const port = process.env.PORT || 3000;
|
6
|
-
|
7
|
-
app.use(express.static('.'));
|
8
|
-
|
9
|
-
app.get('/examples', (req, res) => {
|
10
|
-
const query = Object.assign({
|
11
|
-
//widgetPath: 'https://cdn.jsdelivr.net/npm/@textback/notification-widget/build/index.js',
|
12
|
-
widgetPath: 'http://localhost:8080/build/index.js',
|
13
|
-
apiPath: 'https://tb-apisrv-dev.textback.io/api',
|
14
|
-
widgetId: '7f4e72a9-6f97-b658-9496-016eeb97d0e4',
|
15
|
-
lang: 'ru',
|
16
|
-
data: JSON.stringify({orderId: 'insecureOrderID'})
|
17
|
-
}, req.query);
|
18
|
-
|
19
|
-
let widgetCode = `<script src='${query.widgetPath}'></script>`;
|
20
|
-
|
21
|
-
widgetCode += `\n<tb-notification-widget`;
|
22
|
-
widgetCode += `\n widget-id='${query.widgetId}'`;
|
23
|
-
|
24
|
-
if (query.apiPath) {
|
25
|
-
widgetCode += `\n api-path='${query.apiPath}'`;
|
26
|
-
}
|
27
|
-
|
28
|
-
if (query.lang) {
|
29
|
-
widgetCode += `\n lang='${query.lang}'`;
|
30
|
-
}
|
31
|
-
|
32
|
-
if (query.data) {
|
33
|
-
widgetCode += `\n data='${query.data}'`;
|
34
|
-
}
|
35
|
-
|
36
|
-
widgetCode += `>\n</tb-notification-widget>`;
|
37
|
-
|
38
|
-
res.render('examples.ejs', {
|
39
|
-
query,
|
40
|
-
widgetCode
|
41
|
-
});
|
42
|
-
});
|
43
|
-
|
44
|
-
app.get('/api/endUserNotifications/widgets/error500', (req, res) => {
|
45
|
-
res.sendStatus(500);
|
46
|
-
});
|
47
|
-
|
48
|
-
app.get('/api/endUserNotifications/widgets/error404', (req, res) => {
|
49
|
-
res.sendStatus(404);
|
50
|
-
});
|
51
|
-
|
52
|
-
app.get('/api/endUserNotifications/widgets/a', (req, res) => {
|
53
|
-
res.json({
|
54
|
-
'$error': null,
|
55
|
-
'$items': null,
|
56
|
-
'$value': {
|
57
|
-
'id': 'd43a36de-9659-45b5-9373-aed1a6d58dc5',
|
58
|
-
'vkApiId': null,
|
59
|
-
'accountId': '99bffda5-5bd1-49b1-b4f2-658854797c01',
|
60
|
-
'channels': [{
|
61
|
-
'channel': 'tg',
|
62
|
-
'id': 'rb_dev_3_bot',
|
63
|
-
'slug': '@rb_dev_3_bot',
|
64
|
-
'enabled': true,
|
65
|
-
'channelId': null
|
66
|
-
}, {
|
67
|
-
'channel': 'vk',
|
68
|
-
//'type': 'apiCall',
|
69
|
-
'id': '124981888',
|
70
|
-
'slug': 'tb_test_group',
|
71
|
-
'enabled': true,
|
72
|
-
'channelId': 29
|
73
|
-
}, {
|
74
|
-
'channel': 'facebook',
|
75
|
-
'id': '323049074708312',
|
76
|
-
'slug': 'TA0ETXSdhM8JnvkB1iUM',
|
77
|
-
'enabled': true,
|
78
|
-
'channelId': null
|
79
|
-
}, {'channel': 'viber', 'id': 'dev_', 'slug': '', 'enabled': true, 'channelId': null}],
|
80
|
-
'welcomeMessage': {
|
81
|
-
'text': null,
|
82
|
-
'markup': 'PLAIN',
|
83
|
-
'attachments': null,
|
84
|
-
'buttons': [{
|
85
|
-
'type': 'HyperLinkButton',
|
86
|
-
'text': 'Читать статью',
|
87
|
-
'link': 'https://blog.textback.ru/notifications_in_messengers'
|
88
|
-
}]
|
89
|
-
},
|
90
|
-
'title': {'value': 'test heading'},
|
91
|
-
'description': {'value': 'test desc\r\nline'},
|
92
|
-
'markUp': {
|
93
|
-
'body': {},
|
94
|
-
'icon': {'type': 'preset'},
|
95
|
-
'header': {'value': 'привет это тестовый заголовок чтобы понять какое нормальное число знак'},
|
96
|
-
'description': {'value': 'это тестовый заголовок чтобы понять какое нормальное число знаков может быть в описании чтобы было читабельно и красиво и вообще нормально. это очень длинное название, прямо очень длинное очень приоче'},
|
97
|
-
'title': {'value': 'asdadad'}
|
98
|
-
},
|
99
|
-
'displayOptions': {},
|
100
|
-
//'displayMode': 'popup'
|
101
|
-
},
|
102
|
-
'$count': 1
|
103
|
-
});
|
104
|
-
});
|
105
|
-
|
106
|
-
app.get('/api/endUserNotifications/widgets/b', (req, res) => {
|
107
|
-
res.json({
|
108
|
-
'$error': null,
|
109
|
-
'$items': null,
|
110
|
-
'$value': {
|
111
|
-
'id': 'd43a36de-9659-45b5-9373-aed1a6d58dc5',
|
112
|
-
'vkApiId': 5930339,
|
113
|
-
'accountId': '99bffda5-5bd1-49b1-b4f2-658854797c01',
|
114
|
-
'channels': [{
|
115
|
-
'channel': 'tg',
|
116
|
-
'id': 'rb_dev_3_bot',
|
117
|
-
'slug': '@rb_dev_3_bot',
|
118
|
-
'enabled': true,
|
119
|
-
'channelId': null
|
120
|
-
}, {
|
121
|
-
'channel': 'vk',
|
122
|
-
'type': 'apiCall',
|
123
|
-
'id': '124981888',
|
124
|
-
'slug': 'tb_test_group',
|
125
|
-
'enabled': true,
|
126
|
-
'channelId': 29
|
127
|
-
}, {
|
128
|
-
'channel': 'facebook',
|
129
|
-
'id': '323049074708312',
|
130
|
-
'slug': 'TA0ETXSdhM8JnvkB1iUM',
|
131
|
-
'enabled': true,
|
132
|
-
'channelId': null
|
133
|
-
}, {'channel': 'viber', 'id': 'dev_', 'slug': '', 'enabled': true, 'channelId': null}],
|
134
|
-
'welcomeMessage': {
|
135
|
-
'text': null,
|
136
|
-
'markup': 'PLAIN',
|
137
|
-
'attachments': null,
|
138
|
-
'buttons': [{
|
139
|
-
'type': 'HyperLinkButton',
|
140
|
-
'text': 'Читать статью',
|
141
|
-
'link': 'https://blog.textback.ru/notifications_in_messengers'
|
142
|
-
}]
|
143
|
-
},
|
144
|
-
'title': {'value': 'test heading'},
|
145
|
-
'description': {'value': 'test desc\r\nline'},
|
146
|
-
'markUp': {
|
147
|
-
'body': {},
|
148
|
-
'icon': {'type': 'preset'},
|
149
|
-
'header': {'value': 'привет это тестовый заголовок чтобы понять какое нормальное число знак'},
|
150
|
-
'description': {'value': 'это тестовый заголовок чтобы понять какое нормальное число знаков может быть в описании чтобы было читабельно и красиво и вообще нормально. это очень длинное название, прямо очень длинное очень приоче'},
|
151
|
-
'title': {'value': 'asdadad'}
|
152
|
-
},
|
153
|
-
'displayOptions': {},
|
154
|
-
//'displayMode': 'popup'
|
155
|
-
},
|
156
|
-
'$count': 1
|
157
|
-
});
|
158
|
-
});
|
159
|
-
|
160
|
-
app.get('/api/endUserNotifications/widgets/c', (req, res) => {
|
161
|
-
res.json({
|
162
|
-
'$error': null,
|
163
|
-
'$items': null,
|
164
|
-
'$value': {
|
165
|
-
'id': 'd43a36de-9659-45b5-9373-aed1a6d58dc5',
|
166
|
-
'vkApiId': 5930339,
|
167
|
-
'accountId': '99bffda5-5bd1-49b1-b4f2-658854797c01',
|
168
|
-
'channels': [{
|
169
|
-
'channel': 'tg',
|
170
|
-
'id': 'rb_dev_3_bot',
|
171
|
-
'slug': '@rb_dev_3_bot',
|
172
|
-
'enabled': true,
|
173
|
-
'channelId': null
|
174
|
-
}, {
|
175
|
-
'channel': 'vk',
|
176
|
-
'id': '124981888',
|
177
|
-
'slug': 'tb_test_group',
|
178
|
-
'enabled': true,
|
179
|
-
'channelId': 29
|
180
|
-
}, {
|
181
|
-
'channel': 'facebook',
|
182
|
-
'id': '323049074708312',
|
183
|
-
'slug': 'TA0ETXSdhM8JnvkB1iUM',
|
184
|
-
'enabled': true,
|
185
|
-
'channelId': null
|
186
|
-
}, {'channel': 'viber', 'id': 'dev_', 'slug': '', 'enabled': true, 'channelId': null}],
|
187
|
-
'welcomeMessage': {
|
188
|
-
'text': null,
|
189
|
-
'markup': 'PLAIN',
|
190
|
-
'attachments': null,
|
191
|
-
'buttons': [{
|
192
|
-
'type': 'HyperLinkButton',
|
193
|
-
'text': 'Читать статью',
|
194
|
-
'link': 'https://blog.textback.ru/notifications_in_messengers'
|
195
|
-
}]
|
196
|
-
},
|
197
|
-
'title': {'value': 'test heading'},
|
198
|
-
'description': {'value': 'test desc\r\nline'},
|
199
|
-
'markUp': {
|
200
|
-
'body': {},
|
201
|
-
'icon': {'type': 'preset'},
|
202
|
-
'header': {'value': 'привет это тестовый заголовок чтобы понять какое нормальное число знак'},
|
203
|
-
'description': {'value': 'это тестовый заголовок чтобы понять какое нормальное число знаков может быть в описании чтобы было читабельно и красиво и вообще нормально. это очень длинное название, прямо очень длинное очень приоче'},
|
204
|
-
'title': {'value': 'asdadad'}
|
205
|
-
},
|
206
|
-
'displayOptions': {},
|
207
|
-
'displayMode': 'popup'
|
208
|
-
},
|
209
|
-
'$count': 1
|
210
|
-
});
|
211
|
-
});
|
212
|
-
|
213
|
-
app.post('/api/endUserNotifications/deepLinks', (req, res) => {
|
214
|
-
res.json({
|
215
|
-
'$error': null,
|
216
|
-
'$items': null,
|
217
|
-
'$value': 'subscribe_XXX',
|
218
|
-
'$count': 1
|
219
|
-
});
|
220
|
-
});
|
221
|
-
|
222
|
-
app.listen(port, () => {
|
223
|
-
console.log(`Application started on http://localhost:${port}`)
|
224
|
-
});
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const express = require('express');
|
4
|
+
const app = express();
|
5
|
+
const port = process.env.PORT || 3000;
|
6
|
+
|
7
|
+
app.use(express.static('.'));
|
8
|
+
|
9
|
+
app.get('/examples', (req, res) => {
|
10
|
+
const query = Object.assign({
|
11
|
+
//widgetPath: 'https://cdn.jsdelivr.net/npm/@textback/notification-widget/build/index.js',
|
12
|
+
widgetPath: 'http://localhost:8080/build/index.js',
|
13
|
+
apiPath: 'https://tb-apisrv-dev.textback.io/api',
|
14
|
+
widgetId: '7f4e72a9-6f97-b658-9496-016eeb97d0e4',
|
15
|
+
lang: 'ru',
|
16
|
+
data: JSON.stringify({orderId: 'insecureOrderID'})
|
17
|
+
}, req.query);
|
18
|
+
|
19
|
+
let widgetCode = `<script src='${query.widgetPath}'></script>`;
|
20
|
+
|
21
|
+
widgetCode += `\n<tb-notification-widget`;
|
22
|
+
widgetCode += `\n widget-id='${query.widgetId}'`;
|
23
|
+
|
24
|
+
if (query.apiPath) {
|
25
|
+
widgetCode += `\n api-path='${query.apiPath}'`;
|
26
|
+
}
|
27
|
+
|
28
|
+
if (query.lang) {
|
29
|
+
widgetCode += `\n lang='${query.lang}'`;
|
30
|
+
}
|
31
|
+
|
32
|
+
if (query.data) {
|
33
|
+
widgetCode += `\n data='${query.data}'`;
|
34
|
+
}
|
35
|
+
|
36
|
+
widgetCode += `>\n</tb-notification-widget>`;
|
37
|
+
|
38
|
+
res.render('examples.ejs', {
|
39
|
+
query,
|
40
|
+
widgetCode
|
41
|
+
});
|
42
|
+
});
|
43
|
+
|
44
|
+
app.get('/api/endUserNotifications/widgets/error500', (req, res) => {
|
45
|
+
res.sendStatus(500);
|
46
|
+
});
|
47
|
+
|
48
|
+
app.get('/api/endUserNotifications/widgets/error404', (req, res) => {
|
49
|
+
res.sendStatus(404);
|
50
|
+
});
|
51
|
+
|
52
|
+
app.get('/api/endUserNotifications/widgets/a', (req, res) => {
|
53
|
+
res.json({
|
54
|
+
'$error': null,
|
55
|
+
'$items': null,
|
56
|
+
'$value': {
|
57
|
+
'id': 'd43a36de-9659-45b5-9373-aed1a6d58dc5',
|
58
|
+
'vkApiId': null,
|
59
|
+
'accountId': '99bffda5-5bd1-49b1-b4f2-658854797c01',
|
60
|
+
'channels': [{
|
61
|
+
'channel': 'tg',
|
62
|
+
'id': 'rb_dev_3_bot',
|
63
|
+
'slug': '@rb_dev_3_bot',
|
64
|
+
'enabled': true,
|
65
|
+
'channelId': null
|
66
|
+
}, {
|
67
|
+
'channel': 'vk',
|
68
|
+
//'type': 'apiCall',
|
69
|
+
'id': '124981888',
|
70
|
+
'slug': 'tb_test_group',
|
71
|
+
'enabled': true,
|
72
|
+
'channelId': 29
|
73
|
+
}, {
|
74
|
+
'channel': 'facebook',
|
75
|
+
'id': '323049074708312',
|
76
|
+
'slug': 'TA0ETXSdhM8JnvkB1iUM',
|
77
|
+
'enabled': true,
|
78
|
+
'channelId': null
|
79
|
+
}, {'channel': 'viber', 'id': 'dev_', 'slug': '', 'enabled': true, 'channelId': null}],
|
80
|
+
'welcomeMessage': {
|
81
|
+
'text': null,
|
82
|
+
'markup': 'PLAIN',
|
83
|
+
'attachments': null,
|
84
|
+
'buttons': [{
|
85
|
+
'type': 'HyperLinkButton',
|
86
|
+
'text': 'Читать статью',
|
87
|
+
'link': 'https://blog.textback.ru/notifications_in_messengers'
|
88
|
+
}]
|
89
|
+
},
|
90
|
+
'title': {'value': 'test heading'},
|
91
|
+
'description': {'value': 'test desc\r\nline'},
|
92
|
+
'markUp': {
|
93
|
+
'body': {},
|
94
|
+
'icon': {'type': 'preset'},
|
95
|
+
'header': {'value': 'привет это тестовый заголовок чтобы понять какое нормальное число знак'},
|
96
|
+
'description': {'value': 'это тестовый заголовок чтобы понять какое нормальное число знаков может быть в описании чтобы было читабельно и красиво и вообще нормально. это очень длинное название, прямо очень длинное очень приоче'},
|
97
|
+
'title': {'value': 'asdadad'}
|
98
|
+
},
|
99
|
+
'displayOptions': {},
|
100
|
+
//'displayMode': 'popup'
|
101
|
+
},
|
102
|
+
'$count': 1
|
103
|
+
});
|
104
|
+
});
|
105
|
+
|
106
|
+
app.get('/api/endUserNotifications/widgets/b', (req, res) => {
|
107
|
+
res.json({
|
108
|
+
'$error': null,
|
109
|
+
'$items': null,
|
110
|
+
'$value': {
|
111
|
+
'id': 'd43a36de-9659-45b5-9373-aed1a6d58dc5',
|
112
|
+
'vkApiId': 5930339,
|
113
|
+
'accountId': '99bffda5-5bd1-49b1-b4f2-658854797c01',
|
114
|
+
'channels': [{
|
115
|
+
'channel': 'tg',
|
116
|
+
'id': 'rb_dev_3_bot',
|
117
|
+
'slug': '@rb_dev_3_bot',
|
118
|
+
'enabled': true,
|
119
|
+
'channelId': null
|
120
|
+
}, {
|
121
|
+
'channel': 'vk',
|
122
|
+
'type': 'apiCall',
|
123
|
+
'id': '124981888',
|
124
|
+
'slug': 'tb_test_group',
|
125
|
+
'enabled': true,
|
126
|
+
'channelId': 29
|
127
|
+
}, {
|
128
|
+
'channel': 'facebook',
|
129
|
+
'id': '323049074708312',
|
130
|
+
'slug': 'TA0ETXSdhM8JnvkB1iUM',
|
131
|
+
'enabled': true,
|
132
|
+
'channelId': null
|
133
|
+
}, {'channel': 'viber', 'id': 'dev_', 'slug': '', 'enabled': true, 'channelId': null}],
|
134
|
+
'welcomeMessage': {
|
135
|
+
'text': null,
|
136
|
+
'markup': 'PLAIN',
|
137
|
+
'attachments': null,
|
138
|
+
'buttons': [{
|
139
|
+
'type': 'HyperLinkButton',
|
140
|
+
'text': 'Читать статью',
|
141
|
+
'link': 'https://blog.textback.ru/notifications_in_messengers'
|
142
|
+
}]
|
143
|
+
},
|
144
|
+
'title': {'value': 'test heading'},
|
145
|
+
'description': {'value': 'test desc\r\nline'},
|
146
|
+
'markUp': {
|
147
|
+
'body': {},
|
148
|
+
'icon': {'type': 'preset'},
|
149
|
+
'header': {'value': 'привет это тестовый заголовок чтобы понять какое нормальное число знак'},
|
150
|
+
'description': {'value': 'это тестовый заголовок чтобы понять какое нормальное число знаков может быть в описании чтобы было читабельно и красиво и вообще нормально. это очень длинное название, прямо очень длинное очень приоче'},
|
151
|
+
'title': {'value': 'asdadad'}
|
152
|
+
},
|
153
|
+
'displayOptions': {},
|
154
|
+
//'displayMode': 'popup'
|
155
|
+
},
|
156
|
+
'$count': 1
|
157
|
+
});
|
158
|
+
});
|
159
|
+
|
160
|
+
app.get('/api/endUserNotifications/widgets/c', (req, res) => {
|
161
|
+
res.json({
|
162
|
+
'$error': null,
|
163
|
+
'$items': null,
|
164
|
+
'$value': {
|
165
|
+
'id': 'd43a36de-9659-45b5-9373-aed1a6d58dc5',
|
166
|
+
'vkApiId': 5930339,
|
167
|
+
'accountId': '99bffda5-5bd1-49b1-b4f2-658854797c01',
|
168
|
+
'channels': [{
|
169
|
+
'channel': 'tg',
|
170
|
+
'id': 'rb_dev_3_bot',
|
171
|
+
'slug': '@rb_dev_3_bot',
|
172
|
+
'enabled': true,
|
173
|
+
'channelId': null
|
174
|
+
}, {
|
175
|
+
'channel': 'vk',
|
176
|
+
'id': '124981888',
|
177
|
+
'slug': 'tb_test_group',
|
178
|
+
'enabled': true,
|
179
|
+
'channelId': 29
|
180
|
+
}, {
|
181
|
+
'channel': 'facebook',
|
182
|
+
'id': '323049074708312',
|
183
|
+
'slug': 'TA0ETXSdhM8JnvkB1iUM',
|
184
|
+
'enabled': true,
|
185
|
+
'channelId': null
|
186
|
+
}, {'channel': 'viber', 'id': 'dev_', 'slug': '', 'enabled': true, 'channelId': null}],
|
187
|
+
'welcomeMessage': {
|
188
|
+
'text': null,
|
189
|
+
'markup': 'PLAIN',
|
190
|
+
'attachments': null,
|
191
|
+
'buttons': [{
|
192
|
+
'type': 'HyperLinkButton',
|
193
|
+
'text': 'Читать статью',
|
194
|
+
'link': 'https://blog.textback.ru/notifications_in_messengers'
|
195
|
+
}]
|
196
|
+
},
|
197
|
+
'title': {'value': 'test heading'},
|
198
|
+
'description': {'value': 'test desc\r\nline'},
|
199
|
+
'markUp': {
|
200
|
+
'body': {},
|
201
|
+
'icon': {'type': 'preset'},
|
202
|
+
'header': {'value': 'привет это тестовый заголовок чтобы понять какое нормальное число знак'},
|
203
|
+
'description': {'value': 'это тестовый заголовок чтобы понять какое нормальное число знаков может быть в описании чтобы было читабельно и красиво и вообще нормально. это очень длинное название, прямо очень длинное очень приоче'},
|
204
|
+
'title': {'value': 'asdadad'}
|
205
|
+
},
|
206
|
+
'displayOptions': {},
|
207
|
+
'displayMode': 'popup'
|
208
|
+
},
|
209
|
+
'$count': 1
|
210
|
+
});
|
211
|
+
});
|
212
|
+
|
213
|
+
app.post('/api/endUserNotifications/deepLinks', (req, res) => {
|
214
|
+
res.json({
|
215
|
+
'$error': null,
|
216
|
+
'$items': null,
|
217
|
+
'$value': 'subscribe_XXX',
|
218
|
+
'$count': 1
|
219
|
+
});
|
220
|
+
});
|
221
|
+
|
222
|
+
app.listen(port, () => {
|
223
|
+
console.log(`Application started on http://localhost:${port}`)
|
224
|
+
});
|
package/src/sdk/sdk.js
CHANGED
@@ -16,15 +16,14 @@ export default class SDK {
|
|
16
16
|
initWidget(config, preventViewCounting = false) {
|
17
17
|
if (config && config.widgetId) {
|
18
18
|
const widget = new Widget(config, this);
|
19
|
-
|
20
19
|
this.widgets[config.widgetId] = widget.initialize();
|
21
20
|
this.widgets[config.widgetId].then(widget => {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
Observer.trigger(EVENTS.WIDGET_INIT, {widgetId: config.widgetId});
|
22
|
+
|
23
|
+
// First of all, this is a restriction on the count of views for textback settings page ( = for widget preview)
|
24
|
+
if (preventViewCounting) return;
|
25
|
+
|
26
|
+
this.countWidgetView(widget);
|
28
27
|
}, err => console.error(err));
|
29
28
|
return this.widgets[config.widgetId];
|
30
29
|
} else {
|
package/src/sdk/widget/widget.js
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
import assign from 'lodash/assign';
|
2
1
|
import UUID from 'uuid-js';
|
2
|
+
import assign from 'lodash/assign';
|
3
3
|
|
4
|
-
import
|
5
|
-
import constants from '../utils/constants.js';
|
6
|
-
import cookies from '../utils/cookies.js';
|
7
|
-
import find from '../utils/find.js';
|
4
|
+
import apiErrorHandler from '../utils/apiErrorHandler.js';
|
8
5
|
import loadConfig from '../utils/loadConfig.js';
|
9
6
|
import loadDeepLink from '../utils/loadDeepLink.js';
|
10
7
|
import loadSubscriptions from '../utils/loadSubscriptions.js';
|
8
|
+
import cookies from '../utils/cookies.js';
|
9
|
+
import constants from '../utils/constants.js';
|
11
10
|
import parseQueryString from '../utils/parseQueryString.js';
|
11
|
+
import find from '../utils/find.js';
|
12
|
+
import appInsights from '../utils/appInsights.js';
|
12
13
|
|
13
14
|
import channelsFactory from '../channels/factory.js';
|
14
15
|
|
@@ -132,7 +133,7 @@ export default class Widget {
|
|
132
133
|
return this.channels.filter(channel => channel.enabled && !channel.hasError);
|
133
134
|
}
|
134
135
|
|
135
|
-
runWahunter(phoneNumber
|
136
|
+
runWahunter(phoneNumber) {
|
136
137
|
return fetch(`${this.initialConfig.apiPath}/wahunter`, {
|
137
138
|
method: 'POST',
|
138
139
|
headers: {
|
@@ -143,7 +144,6 @@ export default class Widget {
|
|
143
144
|
phone: phoneNumber,
|
144
145
|
insecureContext: this.insecureContext,
|
145
146
|
deeplinkId: this.deeplink,
|
146
|
-
captchaToken
|
147
147
|
}),
|
148
148
|
}).then((resp) => {
|
149
149
|
if (resp.ok) {
|
@@ -14,7 +14,8 @@ import SDK from '../../../sdk/index.js';
|
|
14
14
|
import iconBell from '../../icons/bell-icon.png';
|
15
15
|
import iconBroadcast from '../../icons/broadcast-icon.png';
|
16
16
|
import iconPaperPlane from '../../icons/paper-plane-icon.png';
|
17
|
-
import
|
17
|
+
import iconTbLogoDark from '../../icons/tb-logo-dark.svg'
|
18
|
+
import iconTbLogoWhite from '../../icons/tb-logo-white.svg'
|
18
19
|
import iconChatWindow from '../../icons/icon_whatsapp_hollow.svg';
|
19
20
|
import iconClose from '../../icons/icon_close.svg';
|
20
21
|
|
@@ -81,7 +82,6 @@ export default class Widget extends Component {
|
|
81
82
|
insecureContext: this.data,
|
82
83
|
secureContextToken: this.secureContextToken,
|
83
84
|
overrideConfig: predefinedConfig,
|
84
|
-
captchaTest: this.captchaTest
|
85
85
|
}, this.previewMode);
|
86
86
|
}
|
87
87
|
|
@@ -120,6 +120,7 @@ export default class Widget extends Component {
|
|
120
120
|
this.set({ error: err });
|
121
121
|
return this;
|
122
122
|
});
|
123
|
+
|
123
124
|
widgetsStorage.setWidget(this.widgetId, widgetInitPromise);
|
124
125
|
}
|
125
126
|
|
@@ -127,8 +128,7 @@ export default class Widget extends Component {
|
|
127
128
|
return {
|
128
129
|
widgetId: this.element.getAttribute('widget-id'),
|
129
130
|
secureContextToken: this.element.getAttribute('secure-context-token'),
|
130
|
-
apiPath: this.element.getAttribute('api-path') || config.apiPath
|
131
|
-
captchaTest: !!this.element.getAttribute('captcha-test')
|
131
|
+
apiPath: this.element.getAttribute('api-path') || config.apiPath
|
132
132
|
};
|
133
133
|
}
|
134
134
|
|
@@ -352,7 +352,7 @@ export default class Widget extends Component {
|
|
352
352
|
id="tb-notification-brand-badge"
|
353
353
|
style="${displayMode === 'inline' ? 'fill:inherit; color: inherit;' : ''}"
|
354
354
|
>
|
355
|
-
${this.text('worksFor')} ${
|
355
|
+
${this.text('worksFor')} ${displayMode === 'inline' ? iconTbLogoWhite : iconTbLogoDark}
|
356
356
|
</a>
|
357
357
|
`;
|
358
358
|
}
|
@@ -364,7 +364,7 @@ export default class Widget extends Component {
|
|
364
364
|
id="tb-notification-brand-badge"
|
365
365
|
style="${displayMode === 'inline' ? 'fill:inherit; color: inherit;' : ''}"
|
366
366
|
>
|
367
|
-
${this.text('worksFor')} ${
|
367
|
+
${this.text('worksFor')} ${displayMode === 'inline' ? iconTbLogoWhite : iconTbLogoDark}
|
368
368
|
</a>
|
369
369
|
`;
|
370
370
|
}
|