web-push-notifications 3.44.6 → 3.44.8

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 (224) hide show
  1. package/core/Pushwoosh.d.ts +199 -0
  2. package/core/Pushwoosh.types.d.ts +213 -0
  3. package/core/Safari.types.d.ts +17 -0
  4. package/core/constants.d.ts +41 -0
  5. package/core/events.types.d.ts +55 -0
  6. package/core/functions.d.ts +5 -0
  7. package/core/legacyEventsMap.d.ts +5 -0
  8. package/core/logger.d.ts +14 -0
  9. package/core/modules/EventBus/EventBus.d.ts +10 -0
  10. package/core/storage.d.ts +27 -0
  11. package/helpers/logger.d.ts +11 -0
  12. package/helpers/pwlogger/Logger.constants.d.ts +21 -0
  13. package/helpers/pwlogger/Logger.d.ts +37 -0
  14. package/helpers/pwlogger/Logger.types.d.ts +44 -0
  15. package/helpers/pwlogger/handlers/handler-console/handler-console.d.ts +2 -0
  16. package/{src/helpers/unescape.ts → helpers/unescape.d.ts} +1 -18
  17. package/models/InboxMessages.d.ts +82 -0
  18. package/models/InboxMessages.types.d.ts +83 -0
  19. package/models/NotificationPayload.d.ts +39 -0
  20. package/models/NotificationPayload.types.d.ts +63 -0
  21. package/modules/Api/Api.d.ts +45 -0
  22. package/modules/Api/Api.types.d.ts +7 -0
  23. package/modules/ApiClient/ApiClient.d.ts +29 -0
  24. package/modules/ApiClient/ApiClient.types.d.ts +188 -0
  25. package/modules/Data/Data.d.ts +76 -0
  26. package/modules/DateModule.d.ts +27 -0
  27. package/modules/InboxMessagesPublic.d.ts +64 -0
  28. package/modules/PlatformChecker/PlatformChecker.d.ts +45 -0
  29. package/modules/PlatformChecker/PlatformChecker.types.d.ts +5 -0
  30. package/modules/storage/Storage.d.ts +63 -0
  31. package/{src/modules/storage/Storage.types.ts → modules/storage/Storage.types.d.ts} +7 -25
  32. package/modules/storage/Store.d.ts +22 -0
  33. package/modules/storage/migrations/26-11-2018.d.ts +2 -0
  34. package/modules/storage/migrations/MigrationExecutor.d.ts +9 -0
  35. package/modules/storage/migrations/Migrations.d.ts +15 -0
  36. package/modules/storage/migrations/constants.d.ts +6 -0
  37. package/modules/storage/migrations/helpers.d.ts +7 -0
  38. package/modules/storage/migrations/initial.d.ts +2 -0
  39. package/modules/storage/version.d.ts +2 -0
  40. package/npm.js +2 -0
  41. package/npm.js.map +1 -0
  42. package/package.json +1 -1
  43. package/service-worker.d.ts +1 -0
  44. package/service-worker.js +2 -0
  45. package/service-worker.js.map +1 -0
  46. package/services/PushService/PushService.types.d.ts +64 -0
  47. package/services/PushService/drivers/PushServiceDefault/PushServiceDefault.d.ts +29 -0
  48. package/{src/services/PushService/drivers/PushServiceDefault/PushServiceDefault.types.ts → services/PushService/drivers/PushServiceDefault/PushServiceDefault.types.d.ts} +1 -1
  49. package/services/PushService/drivers/PushServiceSafari/PushServiceSafari.d.ts +21 -0
  50. package/services/PushService/drivers/PushServiceSafari/PushServiceSafari.types.d.ts +4 -0
  51. package/widget-inbox.js +2 -0
  52. package/widget-inbox.js.map +1 -0
  53. package/widget-subscribe-popup.js +2 -0
  54. package/widget-subscribe-popup.js.map +1 -0
  55. package/widget-subscription-button.js +2 -0
  56. package/widget-subscription-button.js.map +1 -0
  57. package/widget-subscription-prompt.d.ts +2 -0
  58. package/widget-subscription-prompt.js +2 -0
  59. package/widget-subscription-prompt.js.map +1 -0
  60. package/widgets/Inbox/InboxWidget.d.ts +49 -0
  61. package/widgets/Inbox/constants.d.ts +7 -0
  62. package/widgets/Inbox/helpers.d.ts +4 -0
  63. package/widgets/Inbox/inbox_widget.types.d.ts +34 -0
  64. package/widgets/Inbox/widgetTemplates.d.ts +4 -0
  65. package/widgets/SubscribePopup/SubscribePopup.d.ts +20 -0
  66. package/widgets/SubscribePopup/constants.d.ts +6 -0
  67. package/widgets/SubscribePopup/helpers.d.ts +1 -0
  68. package/widgets/SubscribePopup/popupTemplates.d.ts +9 -0
  69. package/widgets/SubscribePopup/types/subscribe-popup.d.ts +43 -0
  70. package/widgets/SubscriptionButton/bell.d.ts +2 -0
  71. package/widgets/SubscriptionButton/constants.d.ts +7 -0
  72. package/widgets/SubscriptionButton/index.d.ts +90 -0
  73. package/widgets/SubscriptionButton/positioning.d.ts +11 -0
  74. package/widgets/SubscriptionButton/subscribe_widget.types.d.ts +35 -0
  75. package/widgets/SubscriptionPrompt/SubscriptionPromptWidget.constants.d.ts +1 -0
  76. package/widgets/SubscriptionPrompt/SubscriptionPromptWidget.d.ts +14 -0
  77. package/widgets/SubscriptionPrompt/SubscriptionPromptWidget.helpers.d.ts +3 -0
  78. package/widgets/SubscriptionPrompt/SubscriptionPromptWidget.types.d.ts +19 -0
  79. package/widgets/SubscriptionPrompt/constants.d.ts +21 -0
  80. package/widgets/SubscriptionPrompt/helpers.d.ts +5 -0
  81. package/worker/global.d.ts +16 -0
  82. package/worker/notification.d.ts +9 -0
  83. package/worker/worker.types.d.ts +4 -0
  84. package/.editorconfig +0 -11
  85. package/.gitlab-ci.yml +0 -193
  86. package/babel.config.js +0 -7
  87. package/ci/cdn/Dockerfile +0 -12
  88. package/ci/dev/Dockerfile +0 -30
  89. package/ci/dev/rootfs/entrypoint.sh +0 -18
  90. package/ci/dev/rootfs/entrypoint.sh.d/nginx.sh +0 -6
  91. package/ci/dev/rootfs/entrypoint.sh.d/supervisor.sh +0 -5
  92. package/ci/dev/rootfs/etc/nginx/_real_ip.conf +0 -2
  93. package/ci/dev/rootfs/etc/nginx/conf.d/default.conf +0 -20
  94. package/ci/dev/rootfs/etc/supervisor.d/nginx.ini +0 -11
  95. package/ci/github/Dockerfile +0 -59
  96. package/ci/github/release-zip.js +0 -61
  97. package/ci/npm/Dockerfile +0 -22
  98. package/config/config.js +0 -24
  99. package/config/configBuilder.js +0 -126
  100. package/config/helpers.js +0 -9
  101. package/config/index.js +0 -1
  102. package/develop/README.md +0 -42
  103. package/develop/favicon.png +0 -0
  104. package/develop/index.html +0 -511
  105. package/eslint.config.mjs +0 -114
  106. package/public/index.d.ts +0 -337
  107. package/scripts/zip.js +0 -26
  108. package/src/core/Pushwoosh.ts +0 -768
  109. package/src/core/Pushwoosh.types.ts +0 -254
  110. package/src/core/Safari.types.ts +0 -26
  111. package/src/core/constants.ts +0 -58
  112. package/src/core/events.types.ts +0 -46
  113. package/src/core/functions.ts +0 -33
  114. package/src/core/legacyEventsMap.ts +0 -64
  115. package/src/core/logger.ts +0 -64
  116. package/src/core/modules/EventBus/EventBus.ts +0 -66
  117. package/src/core/storage.ts +0 -254
  118. package/src/helpers/logger.ts +0 -81
  119. package/src/helpers/pwlogger/Logger.constants.ts +0 -31
  120. package/src/helpers/pwlogger/Logger.ts +0 -218
  121. package/src/helpers/pwlogger/Logger.types.ts +0 -66
  122. package/src/helpers/pwlogger/handlers/handler-console/handler-console.ts +0 -40
  123. package/src/models/InboxMessages.ts +0 -202
  124. package/src/models/InboxMessages.types.ts +0 -111
  125. package/src/models/NotificationPayload.ts +0 -216
  126. package/src/models/NotificationPayload.types.ts +0 -65
  127. package/src/modules/Api/Api.ts +0 -386
  128. package/src/modules/Api/Api.types.ts +0 -7
  129. package/src/modules/ApiClient/ApiClient.ts +0 -153
  130. package/src/modules/ApiClient/ApiClient.types.ts +0 -222
  131. package/src/modules/Data/Data.ts +0 -345
  132. package/src/modules/DateModule.ts +0 -53
  133. package/src/modules/InboxMessagesPublic.ts +0 -222
  134. package/src/modules/PlatformChecker/PlatformChecker.ts +0 -170
  135. package/src/modules/PlatformChecker/PlatformChecker.types.ts +0 -5
  136. package/src/modules/storage/Storage.ts +0 -164
  137. package/src/modules/storage/Store.ts +0 -104
  138. package/src/modules/storage/migrations/26-11-2018.ts +0 -25
  139. package/src/modules/storage/migrations/MigrationExecutor.ts +0 -31
  140. package/src/modules/storage/migrations/Migrations.ts +0 -41
  141. package/src/modules/storage/migrations/constants.ts +0 -8
  142. package/src/modules/storage/migrations/helpers.ts +0 -16
  143. package/src/modules/storage/migrations/initial.ts +0 -47
  144. package/src/modules/storage/version.ts +0 -2
  145. package/src/pushwoosh-web-notifications.ts +0 -47
  146. package/src/pushwoosh-widget-inbox.ts +0 -8
  147. package/src/pushwoosh-widget-subscribe-popup.ts +0 -9
  148. package/src/pushwoosh-widget-subscription-button.ts +0 -8
  149. package/src/pushwoosh-widget-subscription-prompt.ts +0 -6
  150. package/src/service-worker.ts +0 -455
  151. package/src/services/PushService/PushService.types.ts +0 -74
  152. package/src/services/PushService/drivers/PushServiceDefault/PushServiceDefault.ts +0 -235
  153. package/src/services/PushService/drivers/PushServiceSafari/PushServiceSafari.ts +0 -125
  154. package/src/services/PushService/drivers/PushServiceSafari/PushServiceSafari.types.ts +0 -4
  155. package/src/widget-subscription-prompt.ts +0 -33
  156. package/src/widgets/Inbox/InboxWidget.ts +0 -564
  157. package/src/widgets/Inbox/constants.ts +0 -49
  158. package/src/widgets/Inbox/css/inboxWidgetStyle.css +0 -274
  159. package/src/widgets/Inbox/helpers.ts +0 -63
  160. package/src/widgets/Inbox/inbox.d.ts +0 -9
  161. package/src/widgets/Inbox/inbox_widget.types.ts +0 -41
  162. package/src/widgets/Inbox/widgetTemplates.ts +0 -55
  163. package/src/widgets/SubscribePopup/SubscribePopup.ts +0 -241
  164. package/src/widgets/SubscribePopup/constants.ts +0 -66
  165. package/src/widgets/SubscribePopup/helpers.ts +0 -11
  166. package/src/widgets/SubscribePopup/popupTemplates.ts +0 -24
  167. package/src/widgets/SubscribePopup/styles/popup.css +0 -226
  168. package/src/widgets/SubscribePopup/types/subscribe-popup.ts +0 -68
  169. package/src/widgets/SubscriptionButton/assets/css/main.css +0 -205
  170. package/src/widgets/SubscriptionButton/bell.ts +0 -67
  171. package/src/widgets/SubscriptionButton/constants.ts +0 -28
  172. package/src/widgets/SubscriptionButton/index.ts +0 -377
  173. package/src/widgets/SubscriptionButton/positioning.ts +0 -165
  174. package/src/widgets/SubscriptionButton/subscribe_widget.types.ts +0 -53
  175. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.constants.ts +0 -1
  176. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.helpers.ts +0 -110
  177. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.ts +0 -102
  178. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.types.ts +0 -23
  179. package/src/widgets/SubscriptionPrompt/constants.ts +0 -22
  180. package/src/widgets/SubscriptionPrompt/helpers.ts +0 -42
  181. package/src/widgets/widgets.d.ts +0 -4
  182. package/src/worker/global.ts +0 -36
  183. package/src/worker/notification.ts +0 -34
  184. package/src/worker/worker.types.ts +0 -4
  185. package/test/__helpers__/apiHelpers.ts +0 -22
  186. package/test/__helpers__/keyValueHelpers.ts +0 -15
  187. package/test/__helpers__/platformHelpers.ts +0 -54
  188. package/test/__helpers__/sinonHelpers.ts +0 -7
  189. package/test/__helpers__/storageHelpers.ts +0 -56
  190. package/test/__mocks__/apiRequests.ts +0 -26
  191. package/test/__mocks__/idbMock.ts +0 -12
  192. package/test/__mocks__/idbObjectStoreMock.ts +0 -38
  193. package/test/__mocks__/inboxMessages.ts +0 -292
  194. package/test/__mocks__/models/inboxModel.ts +0 -71
  195. package/test/__mocks__/modules/apiClientModule.ts +0 -18
  196. package/test/__mocks__/modules/dateModule.ts +0 -34
  197. package/test/__mocks__/modules/inboxParamsModule.ts +0 -21
  198. package/test/__mocks__/modules/paramsBuilder.ts +0 -12
  199. package/test/__mocks__/modules/paramsModule.ts +0 -35
  200. package/test/__mocks__/modules/payloadBuilderModule.ts +0 -15
  201. package/test/__mocks__/modules/storageModule.ts +0 -58
  202. package/test/__mocks__/navigator.ts +0 -38
  203. package/test/__mocks__/notification.ts +0 -84
  204. package/test/__mocks__/pushwoosh.ts +0 -12
  205. package/test/__mocks__/userAgents +0 -8
  206. package/test/functions.test.ts +0 -22
  207. package/test/ignore-html.js +0 -6
  208. package/test/mocha.opts +0 -6
  209. package/test/modules/DateModule/unit.test.ts +0 -80
  210. package/test/modules/storage/Storage/unit.test.ts +0 -180
  211. package/test/modules/storage/Store/unit.test.ts +0 -192
  212. package/testRegister.js +0 -24
  213. package/tsconfig.json +0 -31
  214. package/webpack.config.js +0 -163
  215. /package/{src/core/modules/EventBus/index.ts → core/modules/EventBus/index.d.ts} +0 -0
  216. /package/{src/helpers/pwlogger/index.ts → helpers/pwlogger/index.d.ts} +0 -0
  217. /package/{src/modules/PlatformChecker/index.ts → modules/PlatformChecker/index.d.ts} +0 -0
  218. /package/{src/npm.ts → npm.d.ts} +0 -0
  219. /package/{src/services/PushService/PushService.ts → services/PushService/PushService.d.ts} +0 -0
  220. /package/{src/widget-inbox.ts → widget-inbox.d.ts} +0 -0
  221. /package/{src/widget-subscribe-popup.ts → widget-subscribe-popup.d.ts} +0 -0
  222. /package/{src/widget-subscription-button.ts → widget-subscription-button.d.ts} +0 -0
  223. /package/{src/widgets/Inbox/index.ts → widgets/Inbox/index.d.ts} +0 -0
  224. /package/{src/widgets/SubscribePopup/index.ts → widgets/SubscribePopup/index.d.ts} +0 -0
@@ -1,292 +0,0 @@
1
- import {dateMock} from './modules/dateModule';
2
-
3
-
4
- export const existedDeletedInboxMessageMock: IInboxMessage = {
5
- action_params: JSON.stringify({
6
- l: '/'
7
- }),
8
- order: '0',
9
- action_type: 'URL',
10
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
11
- inbox_id: 'test_inbox_code5',
12
- rt: '1544504828',
13
- send_date:'1544504828',
14
- status: 4,
15
- text: 'test 152 5',
16
- title: 'Pushwoosh notification'
17
- };
18
-
19
- export const inboxMessageMock: IInboxMessage = {
20
- action_params: JSON.stringify({
21
- l: '/'
22
- }),
23
- order: '0',
24
- action_type: 'URL',
25
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
26
- inbox_id: 'test_inbox_code0',
27
- rt: '1544504828',
28
- send_date:'1544504828',
29
- status: 1,
30
- text: 'test 152',
31
- title: 'Pushwoosh notification'
32
- };
33
-
34
-
35
- export const existedInboxMessagesMock: Array<IInboxMessage> = [
36
- {
37
- action_params: JSON.stringify({
38
- l: '/'
39
- }),
40
- order: '0',
41
- action_type: 'URL',
42
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
43
- inbox_id: 'test_inbox_code0',
44
- rt: '1544504828',
45
- send_date:'1544504828',
46
- status: 1,
47
- text: 'test 152',
48
- title: 'Pushwoosh notification'
49
- },
50
- {
51
- action_params: JSON.stringify({
52
- l: '/'
53
- }),
54
- order: '0',
55
- action_type: 'URL',
56
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
57
- inbox_id: 'test_inbox_code1',
58
- rt: '1544504828',
59
- send_date:'1544504828',
60
- status: 1,
61
- text: 'test 152 1',
62
- title: 'Pushwoosh notification'
63
- },
64
- {
65
- action_params: JSON.stringify({
66
- l: '/'
67
- }),
68
- order: '0',
69
- action_type: 'URL',
70
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
71
- inbox_id: 'test_inbox_code2',
72
- rt: '1544504828',
73
- send_date:'1544504828',
74
- status: 2,
75
- text: 'test 152 2',
76
- title: 'Pushwoosh notification'
77
- },
78
- {
79
- action_params: JSON.stringify({
80
- l: '/'
81
- }),
82
- order: '0',
83
- action_type: 'URL',
84
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
85
- inbox_id: 'test_inbox_code3',
86
- rt: '1544504828',
87
- send_date:'1544504828',
88
- status: 3,
89
- text: 'test 152 3',
90
- title: 'Pushwoosh notification'
91
- },
92
- {
93
- action_params: JSON.stringify({
94
- l: '/'
95
- }),
96
- order: '0',
97
- action_type: 'URL',
98
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
99
- inbox_id: 'test_inbox_code4',
100
- rt: '1544504828',
101
- send_date:'1544504828',
102
- status: 1,
103
- text: 'test 152 4',
104
- title: 'Pushwoosh notification'
105
- },
106
- existedDeletedInboxMessageMock
107
- ];
108
-
109
-
110
- export const receivedInboxMessagesMock: Array<IInboxMessage> = [
111
- {
112
- action_params: JSON.stringify({
113
- l: '/'
114
- }),
115
- order: '15445048280000',
116
- action_type: 'URL',
117
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
118
- inbox_id: 'test_inbox_code2',
119
- rt: '1544504828',
120
- send_date:'1544504828',
121
- status: 2,
122
- text: 'test 152 2',
123
- title: 'Pushwoosh notification'
124
- },
125
- {
126
- action_params: JSON.stringify({
127
- l: 'https://google.com'
128
- }),
129
- order: '15445048280000',
130
- action_type: 'URL',
131
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
132
- inbox_id: 'test_inbox_code5',
133
- rt: '1544504828',
134
- send_date:'1544504828',
135
- status: 3,
136
- text: 'test 152 5',
137
- title: 'Pushwoosh notification'
138
- },
139
- ];
140
-
141
-
142
- export const actionParamsMessageTypeMap = [
143
- [
144
- 0,
145
- {}
146
- ],
147
- [
148
- 1,
149
- {h: 'test_richmedia_data_1'}
150
- ],
151
- [
152
- 1,
153
- {rm: 'test_richmedia_data_2'}
154
- ],
155
- [
156
- 1,
157
- {r: 'test_richmedia_data_3'}
158
- ],
159
- [
160
- 2,
161
- {l: 'http://test.domain'}
162
- ],
163
- [
164
- 2,
165
- {l: 'https://test.domain'}
166
- ],
167
- [
168
- 3,
169
- {l: '/'}
170
- ],
171
- ];
172
-
173
-
174
- export const publicMessageMock: IInboxMessagePublic = {
175
- code: 'test_inbox_code0',
176
- title: 'Pushwoosh notification',
177
- message: 'test 152',
178
- imageUrl: 'https://cp.pushwoosh.com/img/logo-medium.png',
179
- sendDate: new Date(dateMock).toISOString(),
180
- type: 0,
181
- isRead: false,
182
- isActionPerformed: false
183
- };
184
-
185
-
186
- export const deliveredInboxMessagesMock: Array<IInboxMessage> = [
187
- {
188
- order: '1',
189
- action_params: JSON.stringify({
190
- l: '/'
191
- }),
192
- action_type: 'URL',
193
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
194
- inbox_id: 'test_inbox_code0',
195
- rt: '1544504828',
196
- send_date:'1544504828',
197
- status: 1,
198
- text: 'test 152',
199
- title: 'Pushwoosh notification'
200
- },
201
- {
202
- order: '4',
203
- action_params: JSON.stringify({
204
- l: '/'
205
- }),
206
- action_type: 'URL',
207
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
208
- inbox_id: 'test_inbox_code1',
209
- rt: '1544504828',
210
- send_date:'1544504828',
211
- status: 1,
212
- text: 'test 152 1',
213
- title: 'Pushwoosh notification'
214
- }
215
- ];
216
-
217
-
218
- export const readOpenInboxMessagesMock: Array<IInboxMessage> = [
219
- {
220
- order: '3',
221
- action_params: JSON.stringify({
222
- l: '/'
223
- }),
224
- action_type: 'URL',
225
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
226
- inbox_id: 'test_inbox_code2',
227
- rt: '1544504828',
228
- send_date:'1544504828',
229
- status: 2,
230
- text: 'test 152 2',
231
- title: 'Pushwoosh notification'
232
- },
233
- {
234
- order: '3',
235
- action_params: JSON.stringify({
236
- l: '/'
237
- }),
238
- action_type: 'URL',
239
- image: 'https://cp.pushwoosh.com/img/logo-medium.png',
240
- inbox_id: 'test_inbox_code3',
241
- rt: '1544504828',
242
- send_date:'154450000',
243
- status: 3,
244
- text: 'test 152 3',
245
- title: 'Pushwoosh notification'
246
- },
247
- ];
248
-
249
- export const publicInboxMessagesOrderSortedMock: Array<IInboxMessagePublic> = [
250
- {
251
- code: 'test_inbox_code1',
252
- title: 'Pushwoosh notification',
253
- message: 'test 152 1',
254
- imageUrl: 'https://cp.pushwoosh.com/img/logo-medium.png',
255
- sendDate: new Date(dateMock).toISOString(),
256
- type: 3,
257
- isRead: false,
258
- isActionPerformed: false
259
- },
260
- {
261
- code: 'test_inbox_code2',
262
- title: 'Pushwoosh notification',
263
- message: 'test 152 2',
264
- imageUrl: 'https://cp.pushwoosh.com/img/logo-medium.png',
265
- sendDate: new Date(dateMock).toISOString(),
266
- type: 3,
267
- isRead: true,
268
- isActionPerformed: false
269
- },
270
- {
271
- code: 'test_inbox_code3',
272
- title: 'Pushwoosh notification',
273
- message: 'test 152 3',
274
- imageUrl: 'https://cp.pushwoosh.com/img/logo-medium.png',
275
- sendDate: new Date(dateMock).toISOString(),
276
- type: 3,
277
- isRead: true,
278
- isActionPerformed: true
279
- },
280
- {
281
- code: 'test_inbox_code0',
282
- title: 'Pushwoosh notification',
283
- message: 'test 152',
284
- imageUrl: 'https://cp.pushwoosh.com/img/logo-medium.png',
285
- sendDate: new Date(dateMock).toISOString(),
286
- type: 3,
287
- isRead: false,
288
- isActionPerformed: false
289
- },
290
- ];
291
-
292
-
@@ -1,71 +0,0 @@
1
- import {SinonSandbox, SinonStub} from 'sinon';
2
-
3
-
4
- export class InboxModelMock {
5
- putBulkMessagesStub: SinonStub;
6
- getDeliveredReadMessagesCountStub: SinonStub;
7
- getDeliveredMessagesCountStub: SinonStub;
8
- messagesCountStub: SinonStub;
9
- getReadOpenMessagesStub: SinonStub;
10
- getDeliveredMessagesStub: SinonStub;
11
- getMessageStub: SinonStub;
12
- putMessageStub: SinonStub;
13
- updateMessagesStub: SinonStub;
14
-
15
- putBulkMessages() {}
16
- getDeliveredReadMessagesCount() {}
17
- getDeliveredMessagesCount() {}
18
- messagesCount() {}
19
- getReadOpenMessages() {}
20
- getDeliveredMessages() {}
21
- getMessage() {}
22
- putMessage() {}
23
- updateMessages() {}
24
-
25
- setMethodStubs(sandbox: SinonSandbox) {
26
- this.setPutBulkMessagesStub(sandbox);
27
- this.setGetDeliveredReadMessagesCountStub(sandbox);
28
- this.setGetDeliveredMessagesCountStub(sandbox);
29
- this.setMessagesCountStub(sandbox);
30
- this.setGetReadOpenMessagesStub(sandbox);
31
- this.setGetDeliveredMessagesStub(sandbox);
32
- this.setGetMessageStub(sandbox);
33
- this.setPutMessageStub(sandbox);
34
- }
35
-
36
- setPutBulkMessagesStub(sandbox: SinonSandbox) {
37
- this.putBulkMessagesStub = sandbox.stub(this, 'putBulkMessages');
38
- }
39
-
40
- setGetDeliveredReadMessagesCountStub(sandbox: SinonSandbox) {
41
- this.getDeliveredReadMessagesCountStub = sandbox.stub(this, 'getDeliveredReadMessagesCount');
42
- }
43
-
44
- setGetDeliveredMessagesCountStub(sandbox: SinonSandbox) {
45
- this.getDeliveredMessagesCountStub = sandbox.stub(this, 'getDeliveredMessagesCount');
46
- }
47
-
48
- setMessagesCountStub(sandbox: SinonSandbox) {
49
- this.messagesCountStub = sandbox.stub(this, 'messagesCount');
50
- }
51
-
52
- setGetReadOpenMessagesStub(sandbox: SinonSandbox) {
53
- this.getReadOpenMessagesStub = sandbox.stub(this, 'getReadOpenMessages');
54
- }
55
-
56
- setGetDeliveredMessagesStub(sandbox: SinonSandbox) {
57
- this.getDeliveredMessagesStub = sandbox.stub(this, 'getDeliveredMessages');
58
- }
59
-
60
- setGetMessageStub(sandbox: SinonSandbox) {
61
- this.getMessageStub = sandbox.stub(this, 'getMessage');
62
- }
63
-
64
- setPutMessageStub(sandbox: SinonSandbox) {
65
- this.putMessageStub = sandbox.stub(this, 'putMessage');
66
- }
67
-
68
- setUpdateMessagesStub(sandbox: SinonSandbox) {
69
- this.updateMessagesStub = sandbox.stub(this, 'updateMessages');
70
- }
71
- }
@@ -1,18 +0,0 @@
1
- import * as sinon from 'sinon';
2
-
3
-
4
- export const getInboxMessagesResponseMock: IGetInboxMessagesResponse = {
5
- messages: [],
6
- new_inbox: 0,
7
- deleted: [],
8
- next: ''
9
- };
10
-
11
-
12
- export class ApiClientMock {
13
- getInboxMessages = sinon.fake.resolves(getInboxMessagesResponseMock);
14
- inboxStatus = sinon.fake();
15
- }
16
-
17
-
18
- export default new ApiClientMock();
@@ -1,34 +0,0 @@
1
- import * as sinon from 'sinon';
2
-
3
-
4
- export const utcTimestampMock = 1544086800;
5
- export const timestampMock = 1544087800;
6
- export const fakeInboxOrderMock = '154408780000';
7
- export const dateMock = '2018/12/07 10:20';
8
-
9
-
10
- export class DateModuleMock {
11
- _date: Date;
12
- setLocal = sinon.fake();
13
- getInboxFakeOrder = sinon.fake.returns(fakeInboxOrderMock);
14
-
15
- set date(date: Date) {
16
- this._date = new Date(dateMock);
17
- }
18
-
19
- get date() {
20
- return this._date
21
- }
22
-
23
- addDays(days: number) {}
24
-
25
- getUtcTimestamp() {
26
- return utcTimestampMock;
27
- }
28
-
29
- getTimestamp() {
30
- return timestampMock;
31
- }
32
- }
33
-
34
- export default new DateModuleMock();
@@ -1,21 +0,0 @@
1
- import * as sinon from 'sinon';
2
-
3
-
4
- export const lastRequestCodeMock = 'test_last_code';
5
- export const lastRequestTimeMock = 1544086800;
6
-
7
- export class InboxParamsMock {
8
- setLastRequestTime = sinon.fake.resolves(null);
9
- setLastRequestCode = sinon.fake.resolves(null);
10
- setNewMessagesCount = sinon.fake.resolves(null);
11
-
12
- get lastRequestCode() {
13
- return lastRequestCodeMock;
14
- }
15
-
16
- get lastRequestTime() {
17
- return lastRequestTimeMock;
18
- }
19
- }
20
-
21
- export default new InboxParamsMock();
@@ -1,12 +0,0 @@
1
- export const apiUrlMock = 'https://test.pushwoosh.com';
2
-
3
- export class ParamsBuilderMock {
4
- buildApiUrl() {
5
- return new Promise(resolve => {
6
- resolve(apiUrlMock);
7
- });
8
- }
9
- }
10
-
11
-
12
- export default new ParamsBuilderMock();
@@ -1,35 +0,0 @@
1
- import {
2
- DEFAULT_NOTIFICATION_IMAGE,
3
- DEFAULT_NOTIFICATION_TITLE,
4
- } from '../../../src/core/constants';
5
-
6
- export const hwidMock = 'test_hwid';
7
- export const appCodeMock = '#####-#####';
8
- export const userIdMock = 'test_user_id';
9
-
10
- export class ParamsModuleWithoutUserIdMockBase {
11
- get hwid() {
12
- return hwidMock;
13
- }
14
-
15
- get appCode() {
16
- return appCodeMock;
17
- }
18
- }
19
-
20
- export class ParamsMock extends ParamsModuleWithoutUserIdMockBase {
21
- get userId() {
22
- return userIdMock;
23
- }
24
-
25
- get defaultNotificationTitle() {
26
- return DEFAULT_NOTIFICATION_TITLE;
27
- }
28
-
29
- get defaultNotificationImage() {
30
- return DEFAULT_NOTIFICATION_IMAGE;
31
- }
32
- }
33
-
34
- export const paramsModuleInstanceWithutUserIdMock = new ParamsModuleWithoutUserIdMockBase();
35
- export default new ParamsMock();
@@ -1,15 +0,0 @@
1
- import * as sinon from 'sinon';
2
-
3
- import {
4
- getInboxMessagesRequestMock,
5
- inboxStatusRequestMock
6
- } from '../apiRequests';
7
-
8
-
9
- export class PayloadBuilderMock {
10
- getInboxMessages = sinon.fake.resolves(getInboxMessagesRequestMock);
11
- inboxStatus = sinon.fake.resolves(inboxStatusRequestMock);
12
- }
13
-
14
-
15
- export default new PayloadBuilderMock();
@@ -1,58 +0,0 @@
1
- import {SinonSandbox, SinonStub} from 'sinon';
2
- import {existedDeletedInboxMessageMock, existedInboxMessagesMock} from '../inboxMessages';
3
-
4
-
5
- export class StorageMock {
6
- getStub: SinonStub;
7
- putStub: SinonStub;
8
- deleteStub: SinonStub;
9
- countStub: SinonStub;
10
- countByIndexStub: SinonStub;
11
- getAllStub: SinonStub;
12
-
13
- get() {};
14
- put() {};
15
- delete() {};
16
- count() {};
17
- countByIndex() {};
18
- getAll() {};
19
-
20
- setMethodStubs(sandbox: SinonSandbox) {
21
- this.setGetMethodStub(sandbox);
22
- this.setPutMethodStub(sandbox);
23
- this.setDeleteMethodStub(sandbox);
24
- this.setCountByIndexStub(sandbox);
25
- this.setGetAllStub(sandbox);
26
- }
27
-
28
- setGetMethodStub(sandbox: SinonSandbox) {
29
- this.getStub = sandbox.stub(this, 'get');
30
-
31
- // inboxMessages get
32
- this.getStub.returns(existedInboxMessagesMock[0]);
33
- this.getStub.withArgs('inboxMessages', existedDeletedInboxMessageMock.inbox_id)
34
- .resolves(existedDeletedInboxMessageMock);
35
- }
36
-
37
- setPutMethodStub(sandbox: SinonSandbox) {
38
- this.putStub = sandbox.stub(this, 'put');
39
- }
40
-
41
- setDeleteMethodStub(sandbox: SinonSandbox) {
42
- this.deleteStub = sandbox.stub(this, 'delete');
43
- }
44
-
45
- setCountMethodStub(sandbox: SinonSandbox) {
46
- this.countStub = sandbox.stub(this, 'count');
47
- }
48
-
49
- setCountByIndexStub(sandbox: SinonSandbox) {
50
- this.countByIndexStub = sandbox.stub(this, 'countByIndex');
51
- }
52
-
53
- setGetAllStub(sandbox: SinonSandbox) {
54
- this.getAllStub = sandbox.stub(this, 'getAll');
55
- }
56
- }
57
-
58
- export default new StorageMock();
@@ -1,38 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const readline = require('readline');
4
-
5
-
6
- export const userAgentsMock: Promise<Array<string>> = new Promise(resolve => {
7
- const userAgents: string[] = [];
8
-
9
- const lineReader = readline.createInterface({
10
- input: fs.createReadStream(path.resolve(__dirname, 'userAgents'))
11
- });
12
-
13
- lineReader.on('line', function (line: string) {
14
- userAgents.push(line);
15
- });
16
-
17
- lineReader.on('close', function () {
18
- resolve(userAgents);
19
- });
20
- });
21
-
22
- export const userAgentsBrowserVersionMapMock = [
23
- ['Chrome 70', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'],
24
- ['Opera 56', '5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.52'],
25
- ['Safari 12.0.1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15'],
26
- ['Firefox 62', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:62.0) Gecko/20100101 Firefox/62.0'],
27
- ['IE 11', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/7.0; Tablet PC 2.0; .NET4.0E; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET4.0C'],
28
- ['Edge 12', 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10130'],
29
- ['Edge 17', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; MSAppHost/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134']
30
- ];
31
-
32
- export const chromeUserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36';
33
- export const operaUserAgent = '5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.52';
34
- export const safariUserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15';
35
- export const firefoxUserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:62.0) Gecko/20100101 Firefox/62.0';
36
- export const edgeUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; MSAppHost/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134';
37
- export const ie11UserAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/7.0; Tablet PC 2.0; .NET4.0E; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET4.0C';
38
- export const macOSPlatform = 'MacIntel';
@@ -1,84 +0,0 @@
1
-
2
- export const notificationPayloadBodyMock = 'test_body';
3
- export const notificationPayloadHashMock = 'test_hash';
4
- export const notificationPayloadHeaderMock = 'Test Header';
5
- export const notificationPayloadDurationMock = '30';
6
- export const notificationPayloadIconMock = 'https://icon.test/icon.png';
7
- export const notificationPayloadCustomDataMock = JSON.stringify({customData: 'test custom data'});
8
- export const notificationPayloadLinkMock = '/home';
9
- export const notificationPayloadSilent = false;
10
- export const notificationPayloadCampaignIdMock = '#####-CAMPA';
11
- export const notificationPayloadImageMock = 'https://image.test/image.png';
12
- export const notificationPayloadButtonsMock = JSON.stringify([
13
- {
14
- title: 'action 1',
15
- url: 'https://go.pushwoosh.com/img/tmp.icon.png'
16
- },
17
- {
18
- title: 'action 2',
19
- url: 'https://go.pushwoosh.com/img/tmp.icon.png'
20
- }
21
- ]);
22
- export const notificationPayloadActionsMock: Array<INotificationButton> = [
23
- {
24
- action: 'action-0',
25
- title: 'action 1',
26
- url: 'https://go.pushwoosh.com/img/tmp.icon.png'
27
- },
28
- {
29
- action: 'action-1',
30
- title: 'action 2',
31
- url: 'https://go.pushwoosh.com/img/tmp.icon.png'
32
- }
33
- ];
34
- export const notificationPayloadInboxIdMock = 'testInboxId';
35
- export const notificationPayloadInboxParamsMock = {
36
- image: 'https://inbox-image.test/inbox-image.png',
37
- rt: '1544086800'
38
- };
39
- export const notificationPayloadRootParamsMock = {
40
- badge: 'https://inbox-badge.test/inbox-badge.png',
41
- rootParam: 'root param'
42
- };
43
- export const notificationPayloadInvalidDurationMock = 'invalid_duration';
44
-
45
-
46
- export const notificationMinimalPayloadMock: INotificationPayload = {
47
- body: notificationPayloadBodyMock,
48
- p: notificationPayloadHashMock,
49
- };
50
-
51
- export const notificationMinimalChromePayloadMock: IChromeNotificationPayload = {
52
- data: {
53
- body: notificationPayloadBodyMock,
54
- p: notificationPayloadHashMock
55
- },
56
- from: 'test'
57
- };
58
-
59
- export const notificationMinimalPayloadInvalidDurationPayloadMock: INotificationPayload = {
60
- body: notificationPayloadBodyMock,
61
- p: notificationPayloadHashMock,
62
- duration: notificationPayloadInvalidDurationMock
63
- };
64
-
65
- export const notificationMaximumPayloadMock: INotificationPayload = {
66
- ...notificationPayloadRootParamsMock,
67
- body: notificationPayloadBodyMock,
68
- p: notificationPayloadHashMock,
69
- header: notificationPayloadHeaderMock,
70
- duration: notificationPayloadDurationMock,
71
- i: notificationPayloadIconMock,
72
- u: notificationPayloadCustomDataMock,
73
- l: notificationPayloadLinkMock,
74
- pwcid: notificationPayloadCampaignIdMock,
75
- image: notificationPayloadImageMock,
76
- buttons: notificationPayloadButtonsMock,
77
- pw_inbox: notificationPayloadInboxIdMock,
78
- inbox_params: JSON.stringify(notificationPayloadInboxParamsMock),
79
- };
80
-
81
- export const notificationSilentPayloadMock: INotificationPayload = {
82
- ...notificationMaximumPayloadMock,
83
- silent: 'true'
84
- };
@@ -1,12 +0,0 @@
1
- export const initParams = {
2
- applicationCode: 'XXXXX-XXXXX',
3
- safariWebsitePushID: 'web.io.test',
4
- defaultNotificationTitle: 'Pushwoosh',
5
- defaultNotificationImage: 'https://cp.pushwoosh.com/img/logo-medium.png',
6
- autoSubscribe: false,
7
- userId: 'test_user_id',
8
- tags: {
9
- Name: 'Test Name',
10
- },
11
- serviceWorkerUrl: '/pushwoosh-service-worker.js',
12
- };