@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.
Files changed (85) hide show
  1. package/.eslintrc.js +291 -291
  2. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  3. package/.idea/misc.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/notificationwidget.iml +9 -0
  6. package/.idea/vcs.xml +6 -0
  7. package/build/index.js +3 -3
  8. package/build/sdk.js +2 -2
  9. package/package.json +70 -70
  10. package/promote_tag.sh +1 -1
  11. package/readme.md +569 -569
  12. package/server.js +1 -1
  13. package/src/libraries/ai.1.0.11.js +4088 -4088
  14. package/src/libraries/localization/locales/index.js +8 -8
  15. package/src/libraries/localization/text.js +9 -9
  16. package/src/libraries/t.js +82 -82
  17. package/src/sdk/channels/channel.js +30 -30
  18. package/src/sdk/channels/facebook.js +13 -13
  19. package/src/sdk/channels/skype.js +12 -12
  20. package/src/sdk/channels/telegram.js +18 -18
  21. package/src/sdk/channels/viber.js +12 -12
  22. package/src/sdk/channels/vk-modal/vk-modal.html +17 -17
  23. package/src/sdk/channels/vk-modal/vk-modal.js +25 -25
  24. package/src/sdk/channels/vk-modal/vk-modal.scss +116 -116
  25. package/src/sdk/channels/vk.js +195 -195
  26. package/src/sdk/events/observer.js +46 -46
  27. package/src/sdk/index.js +5 -5
  28. package/src/sdk/sdk.js +67 -67
  29. package/src/sdk/utils/apiErrorHandler.js +11 -11
  30. package/src/sdk/utils/appInsights.js +88 -88
  31. package/src/sdk/utils/browserInfo.js +8 -8
  32. package/src/sdk/utils/constants.js +17 -17
  33. package/src/sdk/utils/cookies.js +67 -67
  34. package/src/sdk/utils/find.js +7 -7
  35. package/src/sdk/utils/loadConfig.js +20 -20
  36. package/src/sdk/utils/loadDeepLink.js +48 -48
  37. package/src/sdk/utils/loadScript.js +25 -25
  38. package/src/sdk/utils/loadSubscriptions.js +6 -6
  39. package/src/sdk/utils/parseQueryString.js +33 -33
  40. package/src/sdk/utils/windowHelper.js +25 -25
  41. package/src/sdk/widget/widget.js +192 -192
  42. package/src/widget/components/tb-notification-button/index.js +34 -34
  43. package/src/widget/components/tb-notification-button/styles.scss +657 -657
  44. package/src/widget/components/tb-notification-widget/normalize.scss +395 -395
  45. package/src/widget/components/tb-nw-wahunter/styles.scss +471 -471
  46. package/src/widget/config.js +5 -5
  47. package/src/widget/icons/icon_chat_window.svg +1 -1
  48. package/src/widget/icons/icon_close.svg +1 -1
  49. package/src/widget/icons/icon_facebook.svg +7 -7
  50. package/src/widget/icons/icon_facebook_circle.svg +7 -7
  51. package/src/widget/icons/icon_instagram_circle.svg +95 -95
  52. package/src/widget/icons/icon_skype.svg +44 -44
  53. package/src/widget/icons/icon_skype_circle.svg +46 -46
  54. package/src/widget/icons/icon_skype_new.svg +113 -113
  55. package/src/widget/icons/icon_tg.svg +25 -25
  56. package/src/widget/icons/icon_tg_circle.svg +17 -17
  57. package/src/widget/icons/icon_viber.svg +75 -75
  58. package/src/widget/icons/icon_viber_circle.svg +67 -67
  59. package/src/widget/icons/icon_viber_new.svg +102 -102
  60. package/src/widget/icons/icon_vk.svg +14 -14
  61. package/src/widget/icons/icon_vk_circle.svg +16 -16
  62. package/src/widget/icons/icon_whatsapp.svg +147 -147
  63. package/src/widget/icons/icon_whatsapp_circle.svg +3 -3
  64. package/src/widget/icons/icon_whatsapp_new.svg +127 -127
  65. package/src/widget/icons/icon_whatsappb.svg +147 -147
  66. package/src/widget/icons/icon_whatsappb_circle.svg +3 -3
  67. package/src/widget/icons/icon_whatsappb_new.svg +127 -127
  68. package/src/widget/icons/paper-plane-arrow.svg +3 -3
  69. package/src/widget/icons/tb-logo.svg +21 -21
  70. package/src/widget/index.js +28 -28
  71. package/src/widget/locales/cs.js +42 -42
  72. package/src/widget/locales/en.js +42 -42
  73. package/src/widget/locales/ro.js +41 -41
  74. package/src/widget/utils/cookiesEx.js +41 -41
  75. package/src/widget/utils/stringifyAttributes.js +19 -19
  76. package/src/widget/utils/widgetsStorage.js +28 -28
  77. package/src/widget/widget.entry.js +3 -3
  78. package/tests/gf.html +35 -35
  79. package/tests/gf.js +21 -21
  80. package/tests/index.js +61 -61
  81. package/views/examples.ejs +3 -3
  82. package/views/sdk.html +274 -274
  83. package/webpack.common.js +72 -72
  84. package/webpack.dev.js +15 -15
  85. package/webpack.prod.js +10 -10
@@ -1,41 +1,41 @@
1
- module.exports = {
2
-
3
- //пояснения к переводу смотри в en.js
4
-
5
- //виджет подписок
6
- facebook: "Facebook",
7
- facebookExtended: "Abonați-vă la Facebook",
8
- telegram: "Telegram",
9
- telegramExtended: "Abonați-vă la Telegram",
10
- viber: "Viber",
11
- viberExtended: "Abonați-vă la Viber",
12
- vkontakte: "VK",
13
- vkontakteExtended: "Abonați-vă la VK",
14
- whatsapp: "WhatsApp",
15
- whatsappExtended: "Abonați-vă la WhatsApp",
16
- whatsappb: "WhatsApp",
17
- whatsappbExtended: "Abonați-vă la WhatsApp",
18
-
19
- vkontakteLogin: "VK Login",
20
- singVK: "Abonează-te VK",
21
-
22
- //double check в рассылке
23
- facebookTip: "Tap <strong>Get started</strong><br/>in Messenger",
24
- telegramTip: "Tap <strong>Start</strong></br>in Telegram",
25
- viberTip: "<strong>Viber Desktop App</strong></br>should be installed on your PC",
26
- vkontakteTip: "Press <strong>Allow messages</strong><br/>in a popup window",
27
- whatsappTip: "<strong>Send generated text</strong><br/>to WhatsApp",
28
-
29
- //WhatsApp Hunter
30
- getAnswer: "Primește răspuns în ",
31
- enterNumber: "Introdu numarul tau",
32
- sendMessage: "Trimitem un mesaj în 3-2-1 sec",
33
- answerSuccessful: "V-am răspuns pe WhatsApp.<br>Verifică-ți telefonul",
34
- numberNotFound: "Nu există un astfel de număr în WhatsApp.<br>Sunteți de pe Marte?🤔",
35
- tryAgain: "Specificați un alt număr",
36
- somethingWentWrong: "Hopa! Ceva n-a mers bine",
37
- errorTryAgain: "Să mai încerc o dată",
38
-
39
- //логотип
40
- worksFor: "Works on"
41
- };
1
+ module.exports = {
2
+
3
+ //пояснения к переводу смотри в en.js
4
+
5
+ //виджет подписок
6
+ facebook: "Facebook",
7
+ facebookExtended: "Abonați-vă la Facebook",
8
+ telegram: "Telegram",
9
+ telegramExtended: "Abonați-vă la Telegram",
10
+ viber: "Viber",
11
+ viberExtended: "Abonați-vă la Viber",
12
+ vkontakte: "VK",
13
+ vkontakteExtended: "Abonați-vă la VK",
14
+ whatsapp: "WhatsApp",
15
+ whatsappExtended: "Abonați-vă la WhatsApp",
16
+ whatsappb: "WhatsApp",
17
+ whatsappbExtended: "Abonați-vă la WhatsApp",
18
+
19
+ vkontakteLogin: "VK Login",
20
+ singVK: "Abonează-te VK",
21
+
22
+ //double check в рассылке
23
+ facebookTip: "Tap <strong>Get started</strong><br/>in Messenger",
24
+ telegramTip: "Tap <strong>Start</strong></br>in Telegram",
25
+ viberTip: "<strong>Viber Desktop App</strong></br>should be installed on your PC",
26
+ vkontakteTip: "Press <strong>Allow messages</strong><br/>in a popup window",
27
+ whatsappTip: "<strong>Send generated text</strong><br/>to WhatsApp",
28
+
29
+ //WhatsApp Hunter
30
+ getAnswer: "Primește răspuns în ",
31
+ enterNumber: "Introdu numarul tau",
32
+ sendMessage: "Trimitem un mesaj în 3-2-1 sec",
33
+ answerSuccessful: "V-am răspuns pe WhatsApp.<br>Verifică-ți telefonul",
34
+ numberNotFound: "Nu există un astfel de număr în WhatsApp.<br>Sunteți de pe Marte?🤔",
35
+ tryAgain: "Specificați un alt număr",
36
+ somethingWentWrong: "Hopa! Ceva n-a mers bine",
37
+ errorTryAgain: "Să mai încerc o dată",
38
+
39
+ //логотип
40
+ worksFor: "Works on"
41
+ };
@@ -1,41 +1,41 @@
1
- // const cookies = require('./cookies');
2
- import cookies from '../../sdk/utils/cookies.js';
3
-
4
- /**
5
- *
6
- * @extends cookies
7
- */
8
- const cookiesEx = Object.create(cookies);
9
-
10
- /**
11
- *
12
- * @param name {string}
13
- * @returns {Number}
14
- */
15
- cookiesEx.getIntCookie = function (name) {
16
- return parseInt(this.getCookie(name));
17
- };
18
-
19
- /**
20
- *
21
- * @param name {string}
22
- * @returns {boolean}
23
- */
24
- cookiesEx.getBoolCookie = function (name) {
25
- return (this.getCookie(name)) === 'true';
26
- };
27
- /**
28
- *
29
- * @param name {string}
30
- * @param timeToLive {number}
31
- * @returns {number}
32
- */
33
- cookiesEx.incrementIntCookie = function (name, timeToLive) {
34
- let val = this.getIntCookie(name) || 0;
35
- val++;
36
- this.setCookie(name, val, timeToLive);
37
-
38
- return val;
39
- };
40
-
41
- export default cookiesEx;
1
+ // const cookies = require('./cookies');
2
+ import cookies from '../../sdk/utils/cookies.js';
3
+
4
+ /**
5
+ *
6
+ * @extends cookies
7
+ */
8
+ const cookiesEx = Object.create(cookies);
9
+
10
+ /**
11
+ *
12
+ * @param name {string}
13
+ * @returns {Number}
14
+ */
15
+ cookiesEx.getIntCookie = function (name) {
16
+ return parseInt(this.getCookie(name));
17
+ };
18
+
19
+ /**
20
+ *
21
+ * @param name {string}
22
+ * @returns {boolean}
23
+ */
24
+ cookiesEx.getBoolCookie = function (name) {
25
+ return (this.getCookie(name)) === 'true';
26
+ };
27
+ /**
28
+ *
29
+ * @param name {string}
30
+ * @param timeToLive {number}
31
+ * @returns {number}
32
+ */
33
+ cookiesEx.incrementIntCookie = function (name, timeToLive) {
34
+ let val = this.getIntCookie(name) || 0;
35
+ val++;
36
+ this.setCookie(name, val, timeToLive);
37
+
38
+ return val;
39
+ };
40
+
41
+ export default cookiesEx;
@@ -1,19 +1,19 @@
1
- function stringifyAttributes(attributesMap = {}) {
2
- return Object.keys(attributesMap)
3
- .map(key => {
4
- let value = attributesMap[key];
5
-
6
- if (value === null || typeof value === 'undefined') {
7
- return ''
8
- }
9
-
10
- if (typeof value === 'object') {
11
- value = JSON.stringify(value)
12
- }
13
-
14
- return `${key}='${value}'`
15
- })
16
- .join(' ');
17
- }
18
-
19
- export default stringifyAttributes;
1
+ function stringifyAttributes(attributesMap = {}) {
2
+ return Object.keys(attributesMap)
3
+ .map(key => {
4
+ let value = attributesMap[key];
5
+
6
+ if (value === null || typeof value === 'undefined') {
7
+ return ''
8
+ }
9
+
10
+ if (typeof value === 'object') {
11
+ value = JSON.stringify(value)
12
+ }
13
+
14
+ return `${key}='${value}'`
15
+ })
16
+ .join(' ');
17
+ }
18
+
19
+ export default stringifyAttributes;
@@ -1,28 +1,28 @@
1
- const storage = {};
2
-
3
- function setWidget(widgetId, widgetPromise) {
4
- storage[widgetId] = storage[widgetId] || {};
5
- storage[widgetId].promise = widgetPromise;
6
- }
7
-
8
- function getWidget(widgetId) {
9
- return storage[widgetId] ? storage[widgetId].promise : null;
10
- }
11
-
12
- function setVkHandler(widgetId, handler) {
13
- storage[widgetId] = storage[widgetId] || {};
14
- storage[widgetId].vkHandler = handler;
15
- }
16
-
17
- function getVkHandler(widgetId) {
18
- return storage[widgetId] ? storage[widgetId].vkHandler : null;
19
- }
20
-
21
- const widgetsStorage = {
22
- setWidget,
23
- getWidget,
24
- setVkHandler,
25
- getVkHandler,
26
- };
27
-
28
- export default widgetsStorage;
1
+ const storage = {};
2
+
3
+ function setWidget(widgetId, widgetPromise) {
4
+ storage[widgetId] = storage[widgetId] || {};
5
+ storage[widgetId].promise = widgetPromise;
6
+ }
7
+
8
+ function getWidget(widgetId) {
9
+ return storage[widgetId] ? storage[widgetId].promise : null;
10
+ }
11
+
12
+ function setVkHandler(widgetId, handler) {
13
+ storage[widgetId] = storage[widgetId] || {};
14
+ storage[widgetId].vkHandler = handler;
15
+ }
16
+
17
+ function getVkHandler(widgetId) {
18
+ return storage[widgetId] ? storage[widgetId].vkHandler : null;
19
+ }
20
+
21
+ const widgetsStorage = {
22
+ setWidget,
23
+ getWidget,
24
+ setVkHandler,
25
+ getVkHandler,
26
+ };
27
+
28
+ export default widgetsStorage;
@@ -1,3 +1,3 @@
1
- import NotificationWidget from './index.js';
2
-
3
- window.TextBack.NotificationWidget = window.TextBack.NotificationWidget || NotificationWidget;
1
+ import NotificationWidget from './index.js';
2
+
3
+ window.TextBack.NotificationWidget = window.TextBack.NotificationWidget || NotificationWidget;
package/tests/gf.html CHANGED
@@ -1,35 +1,35 @@
1
- <html lang="en">
2
- <head>
3
- <meta charset="UTF-8">
4
- <title>example</title>
5
- <link rel="stylesheet" href="https://unpkg.com/semantic-ui-css/semantic.min.css">
6
- <script src="//unpkg.com/jquery/dist/jquery.min.js"></script>
7
- <script src="//cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch,Promise"></script>
8
- <script src="/build/index.js"></script>
9
- <script>
10
- var _fetch = window.fetch;
11
-
12
- window.fetch = function(url, options) {
13
- window.fetch.calls.push({url: url, options: options});
14
- return _fetch(url, options);
15
- }
16
-
17
- window.fetch.calls = [];
18
- </script>
19
- </head>
20
- <body>
21
- <tb-notification-widget
22
- secure-context-token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmRlcklkIjoiNDU2OCIsImlhdCI6MTQ5MTMzMzM0OCwiZXhwIjoxNDkyMTk3MzQ4LCJpc3MiOiJlZTlhZTMwYi1jYzRhLTRlNTctYWM1Mi05ZmYwOTEyMmRkODEiLCJzdWIiOiIxMjM0NSJ9._3FnsIV0atJ9F8_vmDZlzz5S0Qo6-tn7GP597Rxphm8="
23
- widget-id="59f3dfaf-935f-4f0f-98b3-02a51abd0c7c"
24
- api-path="https://api.textback.io/api"
25
- data-insecure-order-id="">
26
- </tb-notification-widget>
27
- <script>
28
- setTimeout(function() {
29
- var widgetElement = $('tb-notification-widget').get(0);
30
- widgetElement.dataset.insecureOrderId = 'testId';
31
- new TextBack.NotificationWidget({element: widgetElement});
32
- }, 2000);
33
- </script>
34
- </body>
35
- </html>
1
+ <html lang="en">
2
+ <head>
3
+ <meta charset="UTF-8">
4
+ <title>example</title>
5
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui-css/semantic.min.css">
6
+ <script src="//cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
7
+ <script src="//cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch,Promise"></script>
8
+ <script src="/build/index.js"></script>
9
+ <script>
10
+ var _fetch = window.fetch;
11
+
12
+ window.fetch = function(url, options) {
13
+ window.fetch.calls.push({url: url, options: options});
14
+ return _fetch(url, options);
15
+ }
16
+
17
+ window.fetch.calls = [];
18
+ </script>
19
+ </head>
20
+ <body>
21
+ <tb-notification-widget
22
+ secure-context-token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmRlcklkIjoiNDU2OCIsImlhdCI6MTQ5MTMzMzM0OCwiZXhwIjoxNDkyMTk3MzQ4LCJpc3MiOiJlZTlhZTMwYi1jYzRhLTRlNTctYWM1Mi05ZmYwOTEyMmRkODEiLCJzdWIiOiIxMjM0NSJ9._3FnsIV0atJ9F8_vmDZlzz5S0Qo6-tn7GP597Rxphm8="
23
+ widget-id="59f3dfaf-935f-4f0f-98b3-02a51abd0c7c"
24
+ api-path="https://api.textback.io/api"
25
+ data-insecure-order-id="">
26
+ </tb-notification-widget>
27
+ <script>
28
+ setTimeout(function() {
29
+ var widgetElement = $('tb-notification-widget').get(0);
30
+ widgetElement.dataset.insecureOrderId = 'testId';
31
+ new TextBack.NotificationWidget({element: widgetElement});
32
+ }, 2000);
33
+ </script>
34
+ </body>
35
+ </html>
package/tests/gf.js CHANGED
@@ -1,22 +1,22 @@
1
- fixture `Notification widget growfood tests`
2
- .page `http://localhost:3000/tests/gf.html`;
3
-
4
- test('Post initialization deeplink request', async t => {
5
- const initialization = new Promise(resolve => {
6
- setTimeout(resolve, 3000);
7
- });
8
-
9
- await initialization;
10
-
11
- const requests = await t.eval(() => window.fetch.calls);
12
- const deeplinkRequests = requests.filter(call => {
13
- return call.url === 'https://api.textback.io/api/endUserNotifications/deepLinks';
14
- });
15
-
16
- await t.expect(JSON.parse(deeplinkRequests[1].options.body)).eql({
17
- "accountId": "ee9ae30b-cc4a-4e57-ac52-9ff09122dd81",
18
- "insecureContext": {"insecureOrderId": "testId"},
19
- "secureContextToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmRlcklkIjoiNDU2OCIsImlhdCI6MTQ5MTMzMzM0OCwiZXhwIjoxNDkyMTk3MzQ4LCJpc3MiOiJlZTlhZTMwYi1jYzRhLTRlNTctYWM1Mi05ZmYwOTEyMmRkODEiLCJzdWIiOiIxMjM0NSJ9._3FnsIV0atJ9F8_vmDZlzz5S0Qo6-tn7GP597Rxphm8="
20
- });
21
-
1
+ fixture `Notification widget growfood tests`
2
+ .page `http://localhost:3000/tests/gf.html`;
3
+
4
+ test('Post initialization deeplink request', async t => {
5
+ const initialization = new Promise(resolve => {
6
+ setTimeout(resolve, 3000);
7
+ });
8
+
9
+ await initialization;
10
+
11
+ const requests = await t.eval(() => window.fetch.calls);
12
+ const deeplinkRequests = requests.filter(call => {
13
+ return call.url === 'https://api.textback.io/api/endUserNotifications/deepLinks';
14
+ });
15
+
16
+ await t.expect(JSON.parse(deeplinkRequests[1].options.body)).eql({
17
+ "accountId": "ee9ae30b-cc4a-4e57-ac52-9ff09122dd81",
18
+ "insecureContext": {"insecureOrderId": "testId"},
19
+ "secureContextToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmRlcklkIjoiNDU2OCIsImlhdCI6MTQ5MTMzMzM0OCwiZXhwIjoxNDkyMTk3MzQ4LCJpc3MiOiJlZTlhZTMwYi1jYzRhLTRlNTctYWM1Mi05ZmYwOTEyMmRkODEiLCJzdWIiOiIxMjM0NSJ9._3FnsIV0atJ9F8_vmDZlzz5S0Qo6-tn7GP597Rxphm8="
20
+ });
21
+
22
22
  });
package/tests/index.js CHANGED
@@ -1,62 +1,62 @@
1
- const {Selector} = require('testcafe');
2
- const querystring = require('querystring');
3
-
4
- const query = querystring.stringify({
5
- widgetPath: '/build/index.js',
6
- apiPath: '/api',
7
- widgetId: 'a'
8
- });
9
-
10
- fixture `Notification widget base tests`
11
- .page `http://localhost:3000/examples?${query}`;
12
-
13
- test('Telegram button', async t => {
14
- const button = Selector('tb-notification-button[channel="tg"]');
15
- const link = button.find('a');
16
- const text = await button.innerText;
17
- const href = await link.getAttribute('href');
18
-
19
- await t.expect(text).contains('Telegram');
20
- await t.expect(href).contains('https://telegram.me/rb_dev_3_bot?start=subscribe_');
21
- });
22
-
23
- test('VK button', async t => {
24
- const button = Selector('tb-notification-button[channel="vk"]');
25
- const text = await button.innerText;
26
-
27
- await t.expect(text).contains('VKontakte');
28
- });
29
-
30
- test('Facebook button', async t => {
31
- const button = Selector('tb-notification-button[channel="facebook"]');
32
- const link = button.find('a');
33
- const text = await button.innerText;
34
- const href = await link.getAttribute('href');
35
-
36
- await t.expect(text).contains('Facebook');
37
- await t.expect(href).contains('https://m.me/323049074708312?ref=subscribe_');
38
- });
39
-
40
- test('Viber button', async t => {
41
- const button = Selector('tb-notification-button[channel="viber"]');
42
- const link = button.find('a');
43
- const text = await button.innerText;
44
- const href = await link.getAttribute('href');
45
-
46
- await t.expect(text).contains('Viber');
47
- await t.expect(href).contains('viber://pa?chatURI=dev_&context=subscribe_');
48
- });
49
-
50
- test('deeplink request', async t => {
51
- const requests = await t.eval(() => window.fetch.calls);
52
-
53
- const deeplinkRequests = requests.filter(call => {
54
- return call.url === '/api/endUserNotifications/deepLinks'
55
- });
56
-
57
- await t.expect(JSON.parse(deeplinkRequests[0].options.body)).eql({
58
- "accountId": "99bffda5-5bd1-49b1-b4f2-658854797c01",
59
- "insecureContext": {"orderId": "insecureOrderID"},
60
- "secureContextToken": null
61
- });
1
+ const {Selector} = require('testcafe');
2
+ const querystring = require('querystring');
3
+
4
+ const query = querystring.stringify({
5
+ widgetPath: '/build/index.js',
6
+ apiPath: '/api',
7
+ widgetId: 'a'
8
+ });
9
+
10
+ fixture `Notification widget base tests`
11
+ .page `http://localhost:3000/examples?${query}`;
12
+
13
+ test('Telegram button', async t => {
14
+ const button = Selector('tb-notification-button[channel="tg"]');
15
+ const link = button.find('a');
16
+ const text = await button.innerText;
17
+ const href = await link.getAttribute('href');
18
+
19
+ await t.expect(text).contains('Telegram');
20
+ await t.expect(href).contains('https://telegram.me/rb_dev_3_bot?start=subscribe_');
21
+ });
22
+
23
+ test('VK button', async t => {
24
+ const button = Selector('tb-notification-button[channel="vk"]');
25
+ const text = await button.innerText;
26
+
27
+ await t.expect(text).contains('VKontakte');
28
+ });
29
+
30
+ test('Facebook button', async t => {
31
+ const button = Selector('tb-notification-button[channel="facebook"]');
32
+ const link = button.find('a');
33
+ const text = await button.innerText;
34
+ const href = await link.getAttribute('href');
35
+
36
+ await t.expect(text).contains('Facebook');
37
+ await t.expect(href).contains('https://m.me/323049074708312?ref=subscribe_');
38
+ });
39
+
40
+ test('Viber button', async t => {
41
+ const button = Selector('tb-notification-button[channel="viber"]');
42
+ const link = button.find('a');
43
+ const text = await button.innerText;
44
+ const href = await link.getAttribute('href');
45
+
46
+ await t.expect(text).contains('Viber');
47
+ await t.expect(href).contains('viber://pa?chatURI=dev_&context=subscribe_');
48
+ });
49
+
50
+ test('deeplink request', async t => {
51
+ const requests = await t.eval(() => window.fetch.calls);
52
+
53
+ const deeplinkRequests = requests.filter(call => {
54
+ return call.url === '/api/endUserNotifications/deepLinks'
55
+ });
56
+
57
+ await t.expect(JSON.parse(deeplinkRequests[0].options.body)).eql({
58
+ "accountId": "99bffda5-5bd1-49b1-b4f2-658854797c01",
59
+ "insecureContext": {"orderId": "insecureOrderID"},
60
+ "secureContextToken": null
61
+ });
62
62
  });
@@ -3,10 +3,10 @@
3
3
  <meta charset="UTF-8">
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
5
  <title>example</title>
6
- <link rel="stylesheet" href="https://unpkg.com/semantic-ui-css/semantic.min.css">
6
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui-css/semantic.min.css">
7
7
  <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">-->
8
- <script src="https://unpkg.com/jquery/dist/jquery.min.js"></script>
9
- <script src="https://unpkg.com/semantic-ui-css/semantic.min.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/semantic-ui-css/semantic.min.js"></script>
10
10
  <!-- <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch,Promise"></script> -->
11
11
 
12
12
  </head>