web-push-notifications 3.40.1 → 3.44.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 (149) hide show
  1. package/.editorconfig +11 -0
  2. package/.gitlab-ci.yml +190 -0
  3. package/babel.config.js +7 -0
  4. package/ci/cdn/Dockerfile +12 -0
  5. package/ci/dev/Dockerfile +30 -0
  6. package/ci/dev/rootfs/entrypoint.sh +18 -0
  7. package/ci/dev/rootfs/entrypoint.sh.d/nginx.sh +6 -0
  8. package/ci/dev/rootfs/entrypoint.sh.d/supervisor.sh +5 -0
  9. package/ci/dev/rootfs/etc/nginx/_real_ip.conf +2 -0
  10. package/ci/dev/rootfs/etc/nginx/conf.d/default.conf +20 -0
  11. package/ci/dev/rootfs/etc/supervisor.d/nginx.ini +11 -0
  12. package/ci/github/Dockerfile +59 -0
  13. package/ci/github/release-zip.js +61 -0
  14. package/ci/npm/Dockerfile +19 -0
  15. package/config/config.js +24 -0
  16. package/config/configBuilder.js +126 -0
  17. package/config/helpers.js +9 -0
  18. package/config/index.js +1 -0
  19. package/develop/README.md +42 -0
  20. package/develop/favicon.png +0 -0
  21. package/develop/index.html +511 -0
  22. package/eslint.config.mjs +114 -0
  23. package/package.json +4 -34
  24. package/{lib → public}/index.d.ts +10 -10
  25. package/scripts/zip.js +26 -0
  26. package/src/core/Pushwoosh.ts +768 -0
  27. package/src/core/Pushwoosh.types.ts +254 -0
  28. package/src/core/Safari.types.ts +26 -0
  29. package/src/core/constants.ts +58 -0
  30. package/src/core/events.types.ts +46 -0
  31. package/src/core/functions.ts +33 -0
  32. package/src/core/legacyEventsMap.ts +64 -0
  33. package/src/core/logger.ts +64 -0
  34. package/src/core/modules/EventBus/EventBus.ts +66 -0
  35. package/src/core/modules/EventBus/index.ts +1 -0
  36. package/src/core/storage.ts +254 -0
  37. package/src/helpers/logger.ts +81 -0
  38. package/src/helpers/pwlogger/Logger.constants.ts +31 -0
  39. package/src/helpers/pwlogger/Logger.ts +218 -0
  40. package/src/helpers/pwlogger/Logger.types.ts +66 -0
  41. package/src/helpers/pwlogger/handlers/handler-console/handler-console.ts +40 -0
  42. package/src/helpers/pwlogger/index.ts +2 -0
  43. package/src/helpers/unescape.ts +36 -0
  44. package/src/models/InboxMessages.ts +202 -0
  45. package/src/models/InboxMessages.types.ts +111 -0
  46. package/src/models/NotificationPayload.ts +216 -0
  47. package/src/models/NotificationPayload.types.ts +65 -0
  48. package/src/modules/Api/Api.ts +386 -0
  49. package/src/modules/Api/Api.types.ts +7 -0
  50. package/src/modules/ApiClient/ApiClient.ts +153 -0
  51. package/src/modules/ApiClient/ApiClient.types.ts +222 -0
  52. package/src/modules/Data/Data.ts +345 -0
  53. package/src/modules/DateModule.ts +53 -0
  54. package/src/modules/InboxMessagesPublic.ts +222 -0
  55. package/src/modules/PlatformChecker/PlatformChecker.ts +170 -0
  56. package/src/modules/PlatformChecker/PlatformChecker.types.ts +5 -0
  57. package/src/modules/PlatformChecker/index.ts +1 -0
  58. package/src/modules/storage/Storage.ts +164 -0
  59. package/src/modules/storage/Storage.types.ts +54 -0
  60. package/src/modules/storage/Store.ts +104 -0
  61. package/src/modules/storage/migrations/26-11-2018.ts +25 -0
  62. package/src/modules/storage/migrations/MigrationExecutor.ts +31 -0
  63. package/src/modules/storage/migrations/Migrations.ts +41 -0
  64. package/src/modules/storage/migrations/constants.ts +8 -0
  65. package/src/modules/storage/migrations/helpers.ts +16 -0
  66. package/src/modules/storage/migrations/initial.ts +47 -0
  67. package/src/modules/storage/version.ts +2 -0
  68. package/src/npm.ts +1 -0
  69. package/src/pushwoosh-web-notifications.ts +47 -0
  70. package/src/pushwoosh-widget-inbox.ts +8 -0
  71. package/src/pushwoosh-widget-subscribe-popup.ts +9 -0
  72. package/src/pushwoosh-widget-subscription-button.ts +8 -0
  73. package/src/pushwoosh-widget-subscription-prompt.ts +6 -0
  74. package/src/service-worker.ts +455 -0
  75. package/src/services/PushService/PushService.ts +2 -0
  76. package/src/services/PushService/PushService.types.ts +74 -0
  77. package/src/services/PushService/drivers/PushServiceDefault/PushServiceDefault.ts +235 -0
  78. package/src/services/PushService/drivers/PushServiceDefault/PushServiceDefault.types.ts +3 -0
  79. package/src/services/PushService/drivers/PushServiceSafari/PushServiceSafari.ts +125 -0
  80. package/src/services/PushService/drivers/PushServiceSafari/PushServiceSafari.types.ts +4 -0
  81. package/src/widget-inbox.ts +1 -0
  82. package/src/widget-subscribe-popup.ts +1 -0
  83. package/src/widget-subscription-button.ts +1 -0
  84. package/src/widget-subscription-prompt.ts +33 -0
  85. package/src/widgets/Inbox/InboxWidget.ts +564 -0
  86. package/src/widgets/Inbox/constants.ts +49 -0
  87. package/src/widgets/Inbox/css/inboxWidgetStyle.css +274 -0
  88. package/src/widgets/Inbox/helpers.ts +63 -0
  89. package/src/widgets/Inbox/inbox.d.ts +9 -0
  90. package/src/widgets/Inbox/inbox_widget.types.ts +41 -0
  91. package/src/widgets/Inbox/index.ts +1 -0
  92. package/src/widgets/Inbox/widgetTemplates.ts +55 -0
  93. package/src/widgets/SubscribePopup/SubscribePopup.ts +241 -0
  94. package/src/widgets/SubscribePopup/constants.ts +66 -0
  95. package/src/widgets/SubscribePopup/helpers.ts +11 -0
  96. package/src/widgets/SubscribePopup/index.ts +1 -0
  97. package/src/widgets/SubscribePopup/popupTemplates.ts +24 -0
  98. package/src/widgets/SubscribePopup/styles/popup.css +226 -0
  99. package/src/widgets/SubscribePopup/types/subscribe-popup.ts +68 -0
  100. package/src/widgets/SubscriptionButton/assets/css/main.css +205 -0
  101. package/src/widgets/SubscriptionButton/bell.ts +67 -0
  102. package/src/widgets/SubscriptionButton/constants.ts +28 -0
  103. package/src/widgets/SubscriptionButton/index.ts +377 -0
  104. package/src/widgets/SubscriptionButton/positioning.ts +165 -0
  105. package/src/widgets/SubscriptionButton/subscribe_widget.types.ts +53 -0
  106. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.constants.ts +1 -0
  107. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.helpers.ts +110 -0
  108. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.ts +102 -0
  109. package/src/widgets/SubscriptionPrompt/SubscriptionPromptWidget.types.ts +23 -0
  110. package/src/widgets/SubscriptionPrompt/constants.ts +22 -0
  111. package/src/widgets/SubscriptionPrompt/helpers.ts +42 -0
  112. package/src/widgets/widgets.d.ts +4 -0
  113. package/src/worker/global.ts +36 -0
  114. package/src/worker/notification.ts +34 -0
  115. package/src/worker/worker.types.ts +4 -0
  116. package/test/__helpers__/apiHelpers.ts +22 -0
  117. package/test/__helpers__/keyValueHelpers.ts +15 -0
  118. package/test/__helpers__/platformHelpers.ts +54 -0
  119. package/test/__helpers__/sinonHelpers.ts +7 -0
  120. package/test/__helpers__/storageHelpers.ts +56 -0
  121. package/test/__mocks__/apiRequests.ts +26 -0
  122. package/test/__mocks__/idbMock.ts +12 -0
  123. package/test/__mocks__/idbObjectStoreMock.ts +38 -0
  124. package/test/__mocks__/inboxMessages.ts +292 -0
  125. package/test/__mocks__/models/inboxModel.ts +71 -0
  126. package/test/__mocks__/modules/apiClientModule.ts +18 -0
  127. package/test/__mocks__/modules/dateModule.ts +34 -0
  128. package/test/__mocks__/modules/inboxParamsModule.ts +21 -0
  129. package/test/__mocks__/modules/paramsBuilder.ts +12 -0
  130. package/test/__mocks__/modules/paramsModule.ts +35 -0
  131. package/test/__mocks__/modules/payloadBuilderModule.ts +15 -0
  132. package/test/__mocks__/modules/storageModule.ts +58 -0
  133. package/test/__mocks__/navigator.ts +38 -0
  134. package/test/__mocks__/notification.ts +84 -0
  135. package/test/__mocks__/pushwoosh.ts +12 -0
  136. package/test/__mocks__/userAgents +8 -0
  137. package/test/functions.test.ts +22 -0
  138. package/test/ignore-html.js +6 -0
  139. package/test/mocha.opts +6 -0
  140. package/test/modules/DateModule/unit.test.ts +80 -0
  141. package/test/modules/storage/Storage/unit.test.ts +180 -0
  142. package/test/modules/storage/Store/unit.test.ts +192 -0
  143. package/testRegister.js +24 -0
  144. package/tsconfig.json +31 -0
  145. package/webpack.config.js +163 -0
  146. package/lib/index.js +0 -2
  147. package/lib/index.js.map +0 -1
  148. package/lib/service-worker.js +0 -2
  149. package/lib/service-worker.js.map +0 -1
@@ -0,0 +1,66 @@
1
+ import { type ISubscribePopupConfig, type ISubscribePopupConfigStyles } from './types/subscribe-popup';
2
+
3
+ export const DEFAULT_CONFIG: ISubscribePopupConfig = {
4
+ enable: true,
5
+ text: 'Don’t miss out on our news and updates! Enable push notifications',
6
+ askLaterButtonText: 'Not now',
7
+ confirmSubscriptionButtonText: 'Subscribe',
8
+ delay: 5,
9
+ retryOffset: 60 * 60 * 24 * 7,
10
+ overlay: false,
11
+ position: 'top',
12
+ mobileViewMargin: '0',
13
+
14
+ bgColor: '#fff',
15
+ borderColor: 'transparent',
16
+ boxShadow: '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)',
17
+
18
+ textColor: '#000',
19
+ textSize: 'inherit',
20
+ textWeight: 'normal',
21
+ fontFamily: 'inherit',
22
+
23
+ subscribeBtnBgColor: '#4285f4',
24
+ subscribeBtnTextColor: '#fff',
25
+ subscribeBtnTextWeight: 'normal',
26
+ subscribeBtnBorderColor: 'transparent',
27
+ subscribeBtnBorderRadius: '2px',
28
+
29
+ askLaterBtnBgColor: 'transparent',
30
+ askLaterBtnTextColor: '#000',
31
+ askLaterBtnTextWeight: 'normal',
32
+ askLaterBtnBorderColor: 'transparent',
33
+ askLaterBtnBorderRadius: '2px',
34
+
35
+ theme: 'material',
36
+ viewport: 'html',
37
+ };
38
+
39
+ export const COLOR_TEST_REGEXP = /^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/i;
40
+
41
+ // Permissions
42
+ export const PERMISSION_DENIED = 'denied';
43
+ export const PERMISSION_GRANTED = 'granted';
44
+
45
+ export const CONFIG_STYLES: Array<ISubscribePopupConfigStyles> = [
46
+ { name: 'mobileViewMargin', type: 'string' },
47
+ { name: 'mobileViewPosition', type: 'string' },
48
+ { name: 'mobileViewTransition', type: 'string' },
49
+ { name: 'bgColor', type: 'color' },
50
+ { name: 'borderColor', type: 'color' },
51
+ { name: 'boxShadow', type: 'string' },
52
+ { name: 'textColor', type: 'color' },
53
+ { name: 'textSize', type: 'string' },
54
+ { name: 'textWeight', type: 'string' },
55
+ { name: 'fontFamily', type: 'string' },
56
+ { name: 'subscribeBtnBgColor', type: 'color' },
57
+ { name: 'subscribeBtnTextColor', type: 'color' },
58
+ { name: 'subscribeBtnTextWeight', type: 'string' },
59
+ { name: 'subscribeBtnBorderColor', type: 'color' },
60
+ { name: 'subscribeBtnBorderRadius', type: 'string' },
61
+ { name: 'askLaterBtnBgColor', type: 'color' },
62
+ { name: 'askLaterBtnTextColor', type: 'color' },
63
+ { name: 'askLaterBtnTextWeight', type: 'string' },
64
+ { name: 'askLaterBtnBorderColor', type: 'color' },
65
+ { name: 'askLaterBtnBorderRadius', type: 'string' },
66
+ ];
@@ -0,0 +1,11 @@
1
+ import { COLOR_TEST_REGEXP } from './constants';
2
+
3
+ export function getValidColor(color: string): string {
4
+ if (color === 'transparent') {
5
+ return color;
6
+ }
7
+
8
+ return COLOR_TEST_REGEXP.test(color)
9
+ ? color
10
+ : '#333';
11
+ }
@@ -0,0 +1 @@
1
+ export { PWSubscribePopupWidget } from './SubscribePopup';
@@ -0,0 +1,24 @@
1
+ interface IInnerTemplate {
2
+ iconUrl?: string;
3
+ iconAlt?: string;
4
+ text: string;
5
+ askLaterButtonText: string;
6
+ confirmSubscriptionButtonText: string;
7
+ }
8
+
9
+ export const innerTemplate = ({ iconUrl, iconAlt, text, askLaterButtonText, confirmSubscriptionButtonText }: IInnerTemplate): string => {
10
+ return `<div class="pw-subscription-popup-inner">
11
+ <div class="pw-subscription-popup-content">
12
+ ${iconUrl
13
+ ? `<div class="pw-subscription-popup-icon"><img src="${iconUrl}" alt="${iconAlt || 'Subscribe'}"></div>`
14
+ : ''}
15
+ <div class="pw-subscription-popup-text">
16
+ ${text}
17
+ </div>
18
+ </div>
19
+ <div class="pw-subscription-popup-controls">
20
+ <button name="pwAskLater" class="pw-subscribe-popup-button">${askLaterButtonText}</button>
21
+ <button name="pwSubscribe" class="pw-subscribe-popup-button pw-subscribe-popup-button-active">${confirmSubscriptionButtonText}</button>
22
+ </div>
23
+ </div>`;
24
+ };
@@ -0,0 +1,226 @@
1
+ .pw-subscribe-popup {
2
+ position: fixed;
3
+ left: 50%;
4
+ transform: translateX(-50%);
5
+ justify-content: center;
6
+ z-index: 1000000;
7
+ display: flex;
8
+ transition: all .4s ease-out;
9
+ }
10
+
11
+ .pw-subscribe-popup.pw-position-top {
12
+ top: calc(-100% - 24px);
13
+ }
14
+ .pw-subscribe-popup.pw-position-top.pw-show {
15
+ top: 0;
16
+ }
17
+
18
+ .pw-subscribe-popup.pw-position-bottom {
19
+ bottom: calc(-100% - 24px);
20
+ }
21
+ .pw-subscribe-popup.pw-position-bottom.pw-show {
22
+ bottom: 0;
23
+ }
24
+
25
+ .pw-subscribe-popup.pw-position-center {
26
+ display: flex;
27
+
28
+ position: fixed;
29
+ top: 0;
30
+ left: 0;
31
+ width: 100vw;
32
+ height: 100vh;
33
+ justify-content: center;
34
+ align-items: center;
35
+
36
+ transform: none;
37
+ }
38
+
39
+ .pw-subscribe-popup__overlay {
40
+ background: rgba(0,0,0,.4);
41
+ z-index: 1000000;
42
+ }
43
+
44
+ .pw-subscribe-popup.pw-position-center:not(.pw-subscribe-popup__overlay) {
45
+ pointer-events: none;
46
+ }
47
+
48
+ .pw-subscribe-popup.pw-position-center:not(.pw-show) {
49
+ display: none;
50
+ }
51
+
52
+
53
+ .pw-subscribe-popup__overlay.pw-position-top {
54
+ align-items: flex-start;
55
+ }
56
+
57
+ .pw-subscribe-popup__overlay.pw-position-bottom {
58
+ align-items: flex-end;
59
+ }
60
+
61
+ .pw-subscribe-popup__overlay.pw-position-center {
62
+ align-items: center;
63
+ }
64
+
65
+ .pw-subscription-popup-inner {
66
+ max-width: 400px;
67
+ font-size: var(--textSize);
68
+ color: var(--textColor);
69
+ font-weight: var(--textWeight);
70
+ font-family: var(--fontFamily);
71
+ border-style: solid;
72
+ border-width: 1px;
73
+ border-color: var(--borderColor);
74
+ background: var(--bgColor);
75
+ box-shadow: var(--boxShadow);
76
+ pointer-events: auto;
77
+ }
78
+
79
+ .pw-subscription-popup-content {
80
+ padding: 16px 16px 4px;
81
+ display: flex;
82
+ justify-content: stretch;
83
+ }
84
+
85
+ .pw-subscription-popup-icon {
86
+ flex: 0 0 50px;
87
+ margin-right: 12px;
88
+ padding-top: 4px;
89
+ }
90
+
91
+ .pw-subscription-popup-icon img {
92
+ max-width: 60px;
93
+ max-height: 60px;
94
+ }
95
+
96
+ .pw-subscription-popup-text {
97
+ flex: 1 1 300px;
98
+ }
99
+
100
+ .pw-subscription-popup-controls {
101
+ display: flex;
102
+ flex-wrap: nowrap;
103
+ justify-content: center;
104
+ padding: 8px 16px 16px;
105
+ }
106
+
107
+ button.pw-subscribe-popup-button {
108
+ border: solid 1px var(--askLaterBtnBorderColor);
109
+ border-radius: var(--askLaterBtnBorderRadius);
110
+ display: inline-block;
111
+ height: 36px;
112
+ line-height: 36px;
113
+ padding: 0 16px;
114
+ text-transform: uppercase;
115
+ font-weight: var(--askLaterBtnTextWeight);
116
+ vertical-align: middle;
117
+ -webkit-tap-highlight-color: transparent;
118
+ font-size: 14px;
119
+ outline: 0;
120
+ text-decoration: none;
121
+ color: var(--askLaterBtnTextColor);
122
+ text-align: center;
123
+ letter-spacing: .5px;
124
+ cursor: pointer;
125
+ background: var(--askLaterBtnBgColor);
126
+ margin: 4px 8px;
127
+ }
128
+ button.pw-subscribe-popup-button:hover {
129
+ background: rgba(0,0,0,.04);
130
+ }
131
+ button.pw-subscribe-popup-button:active {
132
+ background: rgba(0,0,0,.12);
133
+ }
134
+
135
+ button.pw-subscribe-popup-button.pw-subscribe-popup-button-active {
136
+ color: var(--subscribeBtnTextColor);
137
+ background: var(--subscribeBtnBgColor);
138
+ border-radius: var(--subscribeBtnBorderRadius);
139
+ border: solid 1px var(--subscribeBtnBorderColor);
140
+ box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),
141
+ 0 3px 1px -2px rgba(0,0,0,0.12),
142
+ 0 1px 5px 0 rgba(0,0,0,0.2);
143
+ font-weight: var(--subscribeBtnTextWeight);
144
+ }
145
+ button.pw-subscribe-popup-button.pw-subscribe-popup-button-active:hover {
146
+ box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),
147
+ 0 1px 7px 0 rgba(0,0,0,0.12),
148
+ 0 3px 1px -1px rgba(0,0,0,0.2);
149
+ }
150
+ button.pw-subscribe-popup-button.pw-subscribe-popup-button-active:active {
151
+ box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),
152
+ 0 3px 1px -2px rgba(0,0,0,0.12),
153
+ 0 1px 5px 0 rgba(0,0,0,0.2);
154
+ }
155
+
156
+ @media screen and (min-width: 541px) {
157
+
158
+ .pw-subscribe-popup-topbar {
159
+ width: 100%;
160
+ }
161
+
162
+ .pw-subscribe-popup-topbar .pw-subscription-popup-inner {
163
+ max-width: 100%;
164
+ width: 100%;
165
+ display: flex;
166
+ flex-direction: row;
167
+ padding: 2px 40px;
168
+ justify-content: center;
169
+ align-items: center;
170
+ flex-wrap: nowrap;
171
+ }
172
+
173
+ .pw-subscribe-popup-topbar .pw-subscription-popup-content {
174
+ padding: 0;
175
+ justify-content: flex-start;
176
+ align-items: center;
177
+ }
178
+
179
+ .pw-subscribe-popup-topbar .pw-subscription-popup-icon img {
180
+ max-width: 28px;
181
+ max-height: 28px;
182
+ }
183
+
184
+ .pw-subscribe-popup-topbar button.pw-subscribe-popup-button {
185
+ height: 32px;
186
+ line-height: 32px;
187
+ }
188
+
189
+ .pw-subscribe-popup-topbar .pw-subscription-popup-controls {
190
+ padding: 0 0 0 16px;
191
+ align-items: center;
192
+ }
193
+ }
194
+ @media screen and (max-width: 540px) {
195
+ .pw-subscribe-popup,
196
+ .pw-subscribe-popup.pw-position-top,
197
+ .pw-subscribe-popup.pw-position-center,
198
+ .pw-subscribe-popup.pw-position-bottom {
199
+ top: var(--mobileViewPosition);
200
+ bottom: -110%;
201
+ left: 0;
202
+ right: 0;
203
+ transform: none;
204
+ display: flex;
205
+ transition: var(--mobileViewTransition);
206
+ align-items: flex-end;
207
+ }
208
+
209
+ .pw-subscribe-popup.pw-subscribe-popup__overlay {
210
+ align-items: flex-end;
211
+ }
212
+
213
+ .pw-subscribe-popup.pw-show {
214
+ bottom: var(--mobileViewMargin);
215
+ }
216
+
217
+ .pw-subscribe-popup__overlay .pw-subscription-popup-inner {
218
+ align-items: flex-end;
219
+ justify-content: stretch;
220
+ }
221
+
222
+ .pw-subscription-popup-inner {
223
+ max-width: 100%;
224
+ width: 100%;
225
+ }
226
+ }
@@ -0,0 +1,68 @@
1
+ export interface ISubscribePopupConfig {
2
+ enable: boolean;
3
+ text: string;
4
+ askLaterButtonText: string;
5
+ confirmSubscriptionButtonText: string;
6
+ delay: number;
7
+ manualToggle?: boolean;
8
+ retryOffset: number;
9
+ iconUrl?: string;
10
+ iconAlt?: string;
11
+ overlay: boolean;
12
+ position: string;
13
+ mobileViewMargin: string;
14
+
15
+ bgColor: string;
16
+ borderColor: string;
17
+ boxShadow: string;
18
+ textColor: string;
19
+ textSize: string;
20
+ textWeight: string;
21
+ fontFamily: string;
22
+ subscribeBtnBgColor: string;
23
+ subscribeBtnTextColor: string;
24
+ subscribeBtnTextWeight: string;
25
+ subscribeBtnBorderColor: string;
26
+ subscribeBtnBorderRadius: string;
27
+ askLaterBtnBgColor: string;
28
+ askLaterBtnTextColor: string;
29
+ askLaterBtnBorderColor: string;
30
+ askLaterBtnBorderRadius: string;
31
+ askLaterBtnTextWeight: string;
32
+ theme: string;
33
+ viewport: string;
34
+ }
35
+
36
+ export interface ISubscribePopupVariables extends ISubscribePopupConfig {
37
+ mobileViewTransition: string;
38
+ mobileViewPosition: string;
39
+ }
40
+
41
+ export interface ISubscribePopupConfigStyles {
42
+ name: SPTStylesNames;
43
+ type: SPTStylesTypes;
44
+ }
45
+
46
+ export type SPTStylesNames =
47
+ | 'mobileViewMargin'
48
+ | 'mobileViewTransition'
49
+ | 'mobileViewPosition'
50
+ | 'bgColor'
51
+ | 'borderColor'
52
+ | 'boxShadow'
53
+ | 'textColor'
54
+ | 'textSize'
55
+ | 'textWeight'
56
+ | 'fontFamily'
57
+ | 'subscribeBtnBgColor'
58
+ | 'subscribeBtnTextColor'
59
+ | 'subscribeBtnTextWeight'
60
+ | 'subscribeBtnBorderColor'
61
+ | 'subscribeBtnBorderRadius'
62
+ | 'askLaterBtnBgColor'
63
+ | 'askLaterBtnTextColor'
64
+ | 'askLaterBtnTextWeight'
65
+ | 'askLaterBtnBorderColor'
66
+ | 'askLaterBtnBorderRadius';
67
+
68
+ export type SPTStylesTypes = 'number' | 'color' | 'string' | 'size';
@@ -0,0 +1,205 @@
1
+ /* Widget */
2
+ .pushwoosh-subscribe-widget {
3
+ position: fixed;
4
+ display: block;
5
+ transform: translate3d(0, 0, 0);
6
+ }
7
+
8
+ .pushwoosh-subscribe-widget__subscribed {
9
+ display: none;
10
+ }
11
+
12
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button {
13
+ border-radius: 50%;
14
+ cursor: pointer;
15
+ font-size: 0;
16
+ text-align: center;
17
+ transform: scale(0.9) translate3d(0, 0, 0);
18
+ transition: transform .3s ease-in-out;
19
+ position: relative;
20
+ }
21
+
22
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button:hover {
23
+ transform: scale(1);
24
+ }
25
+
26
+ /* Tooltip */
27
+ .pushwoosh-subscribe-widget__tooltip {
28
+ position: absolute;
29
+ height: 48px;
30
+ max-width: 300px;
31
+ min-width: 200px;
32
+ padding: 5px 7px;
33
+ background-color: #3b444b;
34
+ color: #ffffff;
35
+ text-align: center;
36
+ vertical-align: middle;
37
+ box-sizing: border-box;
38
+ line-height: 38px;
39
+ font-size: 0;
40
+ font-weight: normal;
41
+ visibility: hidden;
42
+ opacity: 0;
43
+ transition: visibility 0s ease-in .3s,
44
+ opacity .3s ease-in;
45
+ top: 50%;
46
+ transform: translate(0, -50%);
47
+ box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);
48
+ }
49
+
50
+ .pushwoosh-subscribe-widget__tooltip__right:after,
51
+ .pushwoosh-subscribe-widget__tooltip__left:after {
52
+ content: "";
53
+ top: 50%;
54
+ height: 0;
55
+ width: 0;
56
+ position: absolute;
57
+ pointer-events: none;
58
+ border-top: 5px solid transparent;
59
+ border-bottom: 5px solid transparent;
60
+ background: #3b444b;
61
+ }
62
+
63
+ .pushwoosh-subscribe-widget__tooltip__right:after {
64
+ left: calc(100% - 7px);
65
+ border-top: 5px solid #3b444b;
66
+ border-left: 5px solid #3b444b;
67
+ border-right: 5px solid transparent;
68
+ box-sizing: border-box;
69
+ transform-origin: 0 0;
70
+ transform: rotate(-45deg);
71
+ box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);
72
+ }
73
+
74
+ .pushwoosh-subscribe-widget__tooltip__left:after {
75
+ left: -7px;
76
+ border-top: 5px solid #3b444b;
77
+ border-right: 5px solid #3b444b;
78
+ border-left: 5px solid transparent;
79
+ box-sizing: border-box;
80
+ transform-origin: 0 0;
81
+ transform: rotate(-45deg);
82
+ box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);
83
+ }
84
+
85
+ .pushwoosh-subscribe-widget__bell-button:hover + .pushwoosh-subscribe-widget__tooltip,
86
+ .pushwoosh-subscribe-widget__tooltip.pushwoosh-subscribe-widget__tooltip__visible {
87
+ display: block;
88
+ visibility: visible;
89
+ opacity: 1;
90
+ transition-delay: 0s;
91
+ }
92
+
93
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__tooltip-content {
94
+ display: inline-block;
95
+ vertical-align: middle;
96
+ font-size: 14px;
97
+ line-height: 1.4;
98
+ white-space: nowrap;
99
+ overflow: hidden;
100
+ padding-right: 5px;
101
+ text-overflow: ellipsis;
102
+ max-width: 100%;
103
+ }
104
+
105
+ /* Popover */
106
+
107
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover {
108
+ position: absolute;
109
+ right: auto;
110
+ box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);
111
+ box-sizing: border-box;
112
+ background: #9ca8b1;
113
+ visibility: hidden;
114
+ opacity: 0;
115
+ transition: visibility 0s ease-in .5s,
116
+ opacity .5s ease-in;
117
+ }
118
+
119
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover__visible {
120
+ display: block;
121
+ visibility: visible;
122
+ opacity: 1;
123
+ transition-delay: 0s;
124
+ }
125
+
126
+ .pushwoosh-subscribe-widget__popover__bottom:after,
127
+ .pushwoosh-subscribe-widget__popover__top:after {
128
+ content: "";
129
+ height: 0;
130
+ width: 0;
131
+ position: absolute;
132
+ pointer-events: none;
133
+ border-right: 8px solid transparent;
134
+ border-left: 8px solid #9ca8b1;
135
+ background: #9ca8b1;
136
+ transform-origin: 0 0;
137
+ transform: rotate(-45deg);
138
+ }
139
+
140
+ .pushwoosh-subscribe-widget__popover__bottom:after {
141
+ border-bottom: 8px solid #9ca8b1;
142
+ border-top: 8px solid transparent;
143
+ box-sizing: border-box;
144
+ box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);
145
+ bottom: -16px;
146
+ }
147
+
148
+ .pushwoosh-subscribe-widget__popover__top:after {
149
+ top: 0;
150
+ border-top: 8px solid #9ca8b1;
151
+ border-bottom: 8px solid transparent;
152
+ box-sizing: border-box;
153
+ box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);
154
+ }
155
+
156
+ .pushwoosh-subscribe-widget__popover-content-wrapper {
157
+ overflow: auto;
158
+ max-width: 100%;
159
+ }
160
+
161
+
162
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {
163
+ display: flex;
164
+ flex-direction: column;
165
+ padding: 14px;
166
+ box-sizing: border-box;
167
+ float: left;
168
+ min-width: 100%;
169
+ align-items: center;
170
+ }
171
+
172
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {
173
+ display: block;
174
+ }
175
+
176
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {
177
+ margin-bottom: 14px;
178
+ }
179
+
180
+ @media (max-width: 767px) and (orientation: portrait) {
181
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {
182
+ flex-direction: column;
183
+ }
184
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {
185
+ max-width: 280px;
186
+ height: auto;
187
+ }
188
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {
189
+ margin-right: 0;
190
+ margin-bottom: 14px;
191
+ }
192
+ }
193
+ @media (max-width: 767px) and (orientation: landscape) {
194
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {
195
+ flex-direction: row;
196
+ }
197
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {
198
+ max-width: 280px;
199
+ height: auto;
200
+ }
201
+ .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {
202
+ margin-right: 14px;
203
+ margin-bottom: 0;
204
+ }
205
+ }
@@ -0,0 +1,67 @@
1
+ export default (fillColor: string, strokeColor: string) => {
2
+ return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
3
+ + '<svg\n'
4
+ + ' xmlns:dc="http://purl.org/dc/elements/1.1/"\n'
5
+ + ' xmlns:cc="http://creativecommons.org/ns#"\n'
6
+ + ' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n'
7
+ + ' xmlns:svg="http://www.w3.org/2000/svg"\n'
8
+ + ' xmlns="http://www.w3.org/2000/svg"\n'
9
+ + ' xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n'
10
+ + ' xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n'
11
+ + ' version="1.1"\n'
12
+ + ' id="Capa_1"\n'
13
+ + ' x="0px"\n'
14
+ + ' y="0px"\n'
15
+ + ' viewBox="0 0 346.013 346.013"\n'
16
+ + ' style="enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;"\n'
17
+ + ' xml:space="preserve"\n'
18
+ + ' inkscape:version="0.91 r13725"\n'
19
+ + ' sodipodi:docname="alarm_white.svg"><metadata\n'
20
+ + ' id="metadata51"><rdf:RDF><cc:Work\n'
21
+ + ' rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n'
22
+ + ' rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n'
23
+ + ' id="defs49" /><sodipodi:namedview\n'
24
+ + ' borderopacity="1"\n'
25
+ + ' objecttolerance="10"\n'
26
+ + ' gridtolerance="10"\n'
27
+ + ' guidetolerance="10"\n'
28
+ + ' inkscape:pageopacity="0"\n'
29
+ + ' inkscape:pageshadow="2"\n'
30
+ + ' inkscape:window-width="1618"\n'
31
+ + ' inkscape:window-height="828"\n'
32
+ + ' id="namedview47"\n'
33
+ + ' showgrid="false"\n'
34
+ + ' inkscape:zoom="0.6820553"\n'
35
+ + ' inkscape:cx="173.0065"\n'
36
+ + ' inkscape:cy="173.0065"\n'
37
+ + ' inkscape:window-x="0"\n'
38
+ + ' inkscape:window-y="0"\n'
39
+ + ' inkscape:window-maximized="0"\n'
40
+ + ' inkscape:current-layer="g3" /><g\n'
41
+ + ' id="g3"><path\n'
42
+ + ' d="m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z"\n'
43
+ + ' id="path5"\n'
44
+ + ' inkscape:connector-curvature="0"\n'
45
+ + ' vector-effect="non-scaling-stroke"\n'
46
+ + ` style="fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1; " /><path\n`
47
+ + ' vector-effect="non-scaling-stroke"\n'
48
+ + ' d="m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z"\n'
49
+ + ' id="path7"\n'
50
+ + ' inkscape:connector-curvature="0"\n'
51
+ + ` style="fill:${fillColor}; stroke: ${strokeColor}; stroke-width: 1;" /></g><g\n`
52
+ + ' id="g17" /><g\n'
53
+ + ' id="g19" /><g\n'
54
+ + ' id="g21" /><g\n'
55
+ + ' id="g23" /><g\n'
56
+ + ' id="g25" /><g\n'
57
+ + ' id="g27" /><g\n'
58
+ + ' id="g29" /><g\n'
59
+ + ' id="g31" /><g\n'
60
+ + ' id="g33" /><g\n'
61
+ + ' id="g35" /><g\n'
62
+ + ' id="g37" /><g\n'
63
+ + ' id="g39" /><g\n'
64
+ + ' id="g41" /><g\n'
65
+ + ' id="g43" /><g\n'
66
+ + ' id="g45" /></svg>';
67
+ };
@@ -0,0 +1,28 @@
1
+ // Bell
2
+ import { type TBellConfig } from './subscribe_widget.types';
3
+
4
+ export const BELL_POSITION_BOTTOM_RIGHT = 'bottomRight';
5
+ export const BELL_POSITION_BOTTOM_LEFT = 'bottomLeft';
6
+ export const BELL_POSITION_TOP_RIGHT = 'topRight';
7
+ export const BELL_POSITION_TOP_LEFT = 'topLeft';
8
+
9
+ // Common
10
+ export const WIDGET_CONTAINER_ID = 'pushwooshBellWidget';
11
+
12
+ export const SUBSCRIBE_WIDGET_DEFAULT_CONFIG: TBellConfig = {
13
+ position: BELL_POSITION_BOTTOM_LEFT,
14
+ bgColor: '#12AE7E',
15
+ bellColor: 'white',
16
+ bellStrokeColor: '#08754f',
17
+ bellButtonBorder: '1px solid #379676',
18
+ shadow: '0px 0px 6px rgba(0, 0, 0, 0.75)',
19
+ size: '48px',
20
+ indent: '20px',
21
+ zIndex: '999999',
22
+ tooltipText: {
23
+ successSubscribe: 'You are successfully subscribed!',
24
+ needSubscribe: 'Get notifications about important news!',
25
+ blockSubscribe: 'Click to see how to get notifications',
26
+ alreadySubscribed: 'You are already subscribed',
27
+ },
28
+ };