web-push-notifications 3.44.7 → 3.44.9

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
@@ -0,0 +1,43 @@
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
+ bgColor: string;
15
+ borderColor: string;
16
+ boxShadow: string;
17
+ textColor: string;
18
+ textSize: string;
19
+ textWeight: string;
20
+ fontFamily: string;
21
+ subscribeBtnBgColor: string;
22
+ subscribeBtnTextColor: string;
23
+ subscribeBtnTextWeight: string;
24
+ subscribeBtnBorderColor: string;
25
+ subscribeBtnBorderRadius: string;
26
+ askLaterBtnBgColor: string;
27
+ askLaterBtnTextColor: string;
28
+ askLaterBtnBorderColor: string;
29
+ askLaterBtnBorderRadius: string;
30
+ askLaterBtnTextWeight: string;
31
+ theme: string;
32
+ viewport: string;
33
+ }
34
+ export interface ISubscribePopupVariables extends ISubscribePopupConfig {
35
+ mobileViewTransition: string;
36
+ mobileViewPosition: string;
37
+ }
38
+ export interface ISubscribePopupConfigStyles {
39
+ name: SPTStylesNames;
40
+ type: SPTStylesTypes;
41
+ }
42
+ export type SPTStylesNames = 'mobileViewMargin' | 'mobileViewTransition' | 'mobileViewPosition' | 'bgColor' | 'borderColor' | 'boxShadow' | 'textColor' | 'textSize' | 'textWeight' | 'fontFamily' | 'subscribeBtnBgColor' | 'subscribeBtnTextColor' | 'subscribeBtnTextWeight' | 'subscribeBtnBorderColor' | 'subscribeBtnBorderRadius' | 'askLaterBtnBgColor' | 'askLaterBtnTextColor' | 'askLaterBtnTextWeight' | 'askLaterBtnBorderColor' | 'askLaterBtnBorderRadius';
43
+ export type SPTStylesTypes = 'number' | 'color' | 'string' | 'size';
@@ -0,0 +1,2 @@
1
+ declare const _default: (fillColor: string, strokeColor: string) => string;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { type TBellConfig } from './subscribe_widget.types';
2
+ export declare const BELL_POSITION_BOTTOM_RIGHT = "bottomRight";
3
+ export declare const BELL_POSITION_BOTTOM_LEFT = "bottomLeft";
4
+ export declare const BELL_POSITION_TOP_RIGHT = "topRight";
5
+ export declare const BELL_POSITION_TOP_LEFT = "topLeft";
6
+ export declare const WIDGET_CONTAINER_ID = "pushwooshBellWidget";
7
+ export declare const SUBSCRIBE_WIDGET_DEFAULT_CONFIG: TBellConfig;
@@ -0,0 +1,90 @@
1
+ import { type TBellConfig } from './subscribe_widget.types';
2
+ import { type Pushwoosh } from '../../core/Pushwoosh';
3
+ export declare class PWSubscriptionButtonWidget {
4
+ widget: HTMLElement;
5
+ tooltip: HTMLElement;
6
+ popover: HTMLElement;
7
+ style: HTMLElement;
8
+ pw: Pushwoosh;
9
+ config: TBellConfig;
10
+ constructor(pw: Pushwoosh);
11
+ /**
12
+ * Apply styles to element
13
+ * @param styles
14
+ * @param {HTMLElement} element
15
+ */
16
+ private addStylesToElement;
17
+ /**
18
+ * Create container element
19
+ * @returns {HTMLElement}
20
+ */
21
+ private createContainer;
22
+ /**
23
+ * Create styles element
24
+ * @returns {HTMLElement}
25
+ */
26
+ private createStyle;
27
+ /**
28
+ * Create cell button element
29
+ * @returns {HTMLElement}
30
+ */
31
+ private createBell;
32
+ /**
33
+ * Create tooltip element
34
+ * @returns {Promise<HTMLElement>}
35
+ */
36
+ private createTooltip;
37
+ /**
38
+ * Create tooltip content element
39
+ * @returns {Promise<HTMLElement>}
40
+ */
41
+ private createTooltipContent;
42
+ /**
43
+ * Tooltip text content depending of the permissions
44
+ * @returns {Promise<string>}
45
+ */
46
+ private tooltipTextFactory;
47
+ /**
48
+ * Create permission denied popover element
49
+ * @returns {HTMLElement}
50
+ */
51
+ private createPopover;
52
+ private getBrowserName;
53
+ /**
54
+ * Create permission denied popover content element
55
+ * @returns {HTMLElement}
56
+ */
57
+ private createPopoverContent;
58
+ /**
59
+ * Return source of help images depending of the browser
60
+ * @returns {string}
61
+ */
62
+ getImageSrc(img: string): string;
63
+ private render;
64
+ addEventListeners(): void;
65
+ /**
66
+ * Toggle visibility of popover
67
+ */
68
+ toggleHelpPopover(): void;
69
+ /**
70
+ * Click bell button event callback
71
+ * @returns {Promise<void>}
72
+ */
73
+ private clickBell;
74
+ /**
75
+ * On subscribe event callback
76
+ * @returns {Promise<void>}
77
+ */
78
+ private onSubscribeEvent;
79
+ /**
80
+ * On permission denied event
81
+ * @returns {Promise<void>}
82
+ */
83
+ private onPermissionDeniedEvent;
84
+ /**
85
+ * Out of popover click event
86
+ * @param {MessageEvent} ev
87
+ */
88
+ clickOutOfPopover(ev: MessageEvent): void;
89
+ private onUnsubscribeEvent;
90
+ }
@@ -0,0 +1,11 @@
1
+ import { type TBellPosition, type TPositionStyles } from './subscribe_widget.types';
2
+ export default class Positioning {
3
+ static getBellPosition(position: TBellPosition, indent: string): TPositionStyles;
4
+ static getTooltipPosition(bellPosition: TBellPosition, bellSize: string): [{
5
+ left: string;
6
+ } | {
7
+ right: string;
8
+ }, string];
9
+ static getPopoverPosition(bellPosition: TBellPosition, bellSize: string): [TPositionStyles, string];
10
+ static getPopoverArrowPosition(bellPosition: TBellPosition, bellSize: string): string;
11
+ }
@@ -0,0 +1,35 @@
1
+ export type TBellPosition = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
2
+ export type TTooltipText = {
3
+ successSubscribe: string;
4
+ needSubscribe: string;
5
+ blockSubscribe: string;
6
+ alreadySubscribed: string;
7
+ };
8
+ export type TBellConfig = {
9
+ position: TBellPosition;
10
+ bgColor: string;
11
+ bellColor: string;
12
+ bellStrokeColor: string;
13
+ bellButtonBorder: string;
14
+ shadow: string;
15
+ size: string;
16
+ indent: string;
17
+ zIndex: string;
18
+ tooltipText: TTooltipText;
19
+ buttonImage?: string;
20
+ contentImages?: Record<string, string>;
21
+ };
22
+ export type TPositionStyles = {
23
+ top: string;
24
+ bottom: string;
25
+ left: string;
26
+ right: string;
27
+ };
28
+ export type TEvent = {
29
+ event_id: number | string;
30
+ application: string;
31
+ };
32
+ export type TStyleKeys = 'left' | 'right' | 'top' | 'bottom' | 'zIndex' | 'position' | 'backgroundColor' | 'background' | 'width' | 'height' | 'boxShadow' | 'lineHeight' | 'border' | 'maxWidth' | 'maxHeight';
33
+ export type TCSSStylesObject = {
34
+ [style: string]: string;
35
+ };
@@ -0,0 +1 @@
1
+ export declare const SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE = "pushwoosh-subscription-widget";
@@ -0,0 +1,14 @@
1
+ import { type ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';
2
+ import { type Pushwoosh } from '../../core/Pushwoosh';
3
+ export declare class SubscriptionPromptWidget {
4
+ private readonly pw;
5
+ constructor(pw: Pushwoosh);
6
+ init(params: ISubscriptionPromptWidgetParams): void;
7
+ show(): void;
8
+ hide(): void;
9
+ private getRootElement;
10
+ private getRootElementWithCheckExist;
11
+ private getDeclineButtonWithCheckExist;
12
+ private getAcceptButtonWithCheckExist;
13
+ private addEventListeners;
14
+ }
@@ -0,0 +1,3 @@
1
+ import { type ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';
2
+ export declare const getHTML: (params: ISubscriptionPromptWidgetParams) => string;
3
+ export declare const getStyles: (params: ISubscriptionPromptWidgetParams) => HTMLStyleElement;
@@ -0,0 +1,19 @@
1
+ export interface ISubscriptionPromptWidgetParams {
2
+ headerText: string;
3
+ headerTextColor: string;
4
+ subheaderText?: string;
5
+ subheaderTextColor?: string;
6
+ buttonAcceptText: string;
7
+ buttonAcceptTextColor: string;
8
+ buttonAcceptRound: string;
9
+ buttonAcceptBackgroundColor: string;
10
+ buttonAcceptBorderColor: string;
11
+ buttonCancelText: string;
12
+ buttonCancelTextColor: string;
13
+ buttonCancelRound: string;
14
+ buttonCancelBackgroundColor: string;
15
+ buttonCancelBorderColor: string;
16
+ cappingCount: number;
17
+ cappingDelay: number;
18
+ backgroundColor: string;
19
+ }
@@ -0,0 +1,21 @@
1
+ export declare const SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET = "not-set";
2
+ export declare const SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT = "default";
3
+ export declare const SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG: {
4
+ headerText: string;
5
+ headerTextColor: string;
6
+ subheaderText: string;
7
+ subheaderTextColor: string;
8
+ buttonAcceptText: string;
9
+ buttonAcceptTextColor: string;
10
+ buttonAcceptRound: string;
11
+ buttonAcceptBackgroundColor: string;
12
+ buttonAcceptBorderColor: string;
13
+ buttonCancelText: string;
14
+ buttonCancelTextColor: string;
15
+ buttonCancelRound: string;
16
+ buttonCancelBackgroundColor: string;
17
+ buttonCancelBorderColor: string;
18
+ cappingCount: number;
19
+ cappingDelay: number;
20
+ backgroundColor: string;
21
+ };
@@ -0,0 +1,5 @@
1
+ import type { ISubscriptionPromptWidgetParams } from './SubscriptionPromptWidget.types';
2
+ import type { Pushwoosh } from '../../core/Pushwoosh';
3
+ export declare const getWidgetConfig: (features: any) => ISubscriptionPromptWidgetParams;
4
+ export declare const checkCanShowByCapping: (widgetConfig: ISubscriptionPromptWidgetParams, pw: Pushwoosh) => Promise<boolean>;
5
+ export declare const updateCappingParams: (pw: Pushwoosh) => Promise<void>;
@@ -0,0 +1,16 @@
1
+ import { type EventBus } from '../core/modules/EventBus';
2
+ import { type TPWCanWaitCallback } from '../core/Pushwoosh.types';
3
+ import { type Api } from '../modules/Api/Api';
4
+ import { type Data } from '../modules/Data/Data';
5
+ export default class WorkerPushwooshGlobal {
6
+ readonly eventBus: EventBus;
7
+ readonly api: Api;
8
+ readonly data: Data;
9
+ constructor(eventBus: EventBus, data: Data, api: Api);
10
+ _listeners: {
11
+ [key: string]: TPWCanWaitCallback[];
12
+ };
13
+ push(f: ['onPush', TPWCanWaitCallback]): void;
14
+ getListeners(eventName: string): TPWCanWaitCallback[];
15
+ initApi(): Promise<void>;
16
+ }
@@ -0,0 +1,9 @@
1
+ export default class PushwooshNotification {
2
+ private _canceled;
3
+ private readonly showNotificationOptions;
4
+ private readonly body;
5
+ private readonly title;
6
+ constructor(showNotificationOptions: NotificationOptions, body: string, title: string);
7
+ show(): Promise<void>;
8
+ cancel(): void;
9
+ }
@@ -0,0 +1,4 @@
1
+ export interface PushSubscriptionChangeEvent extends ExtendableEvent {
2
+ readonly newSubscription: PushSubscription | null;
3
+ readonly oldSubscription: PushSubscription | null;
4
+ }
package/.editorconfig DELETED
@@ -1,11 +0,0 @@
1
- # editorconfig.org
2
- root = true
3
-
4
- [*]
5
-
6
- charset = utf-8
7
- end_of_line = lf
8
- indent_size = 2
9
- indent_style = space
10
- insert_final_newline = true
11
- trim_trailing_whitespace = true
package/.gitlab-ci.yml DELETED
@@ -1,193 +0,0 @@
1
- include:
2
- - project: 'platform/tools/gitlab-ci-commons'
3
- ref: master
4
- file: '/cdn-release.yml'
5
- - project: 'platform/tools/gitlab-ci-commons'
6
- ref: master
7
- file: '/github-release.yml'
8
-
9
- stages:
10
- - assets
11
- - build
12
- - test
13
- - deploy
14
- - release
15
- - release-cdn
16
- - build-github
17
- - release-github
18
-
19
- variables:
20
- CONTAINER_NAME: websdk
21
-
22
- Install:assets:
23
- stage: assets
24
- image: node:18.19
25
- before_script:
26
- - npm install -d
27
- script:
28
- - npm run release
29
- cache:
30
- key: "$CI_COMMIT_REF_NAME"
31
- paths:
32
- - node_modules/
33
- artifacts:
34
- expire_in: 1 hour
35
- paths:
36
- - output/
37
-
38
- Deploy:
39
- stage: deploy
40
- image: docker:latest
41
- before_script:
42
- - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
43
- script:
44
- - docker build --pull -t $CI_REGISTRY_IMAGE/dev:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID -f ci/dev/Dockerfile .
45
- - docker rm --force $CONTAINER_NAME-$CI_ENVIRONMENT_SLUG || true
46
- - >
47
- docker run --restart=always -d -p 80
48
- -e PW_initParams__applicationCode=$PW_initParams__applicationCode
49
- -e PW_initParams__autoSubscribe=$PW_initParams__autoSubscribe
50
- -e PW_initParams__safariWebsitePushID=$PW_initParams__safariWebsitePushID
51
- -e PW_manifest__gcm_sender_id=$PW_manifest__gcm_sender_id
52
- --name $CONTAINER_NAME-$CI_ENVIRONMENT_SLUG $CI_REGISTRY_IMAGE/dev:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
53
- after_script:
54
- - sh /home/gitlab-runner/tools/nginx/vhost.sh $CONTAINER_NAME-$CI_ENVIRONMENT_SLUG
55
- environment:
56
- name: websdk
57
- url: https://websdk-gitlab.corp.pushwoosh.com
58
- only:
59
- - branches
60
-
61
- Test:
62
- stage: test
63
- image: node:18.19
64
- cache:
65
- key: "$CI_COMMIT_REF_NAME"
66
- paths:
67
- - node_modules/
68
- before_script:
69
- - npm install -d
70
- script:
71
- - npm run check:types
72
- - npm run check:lint
73
- allow_failure: true
74
- only:
75
- - branches
76
-
77
- # npm
78
-
79
- Build:npm:
80
- stage: build
81
- image: docker:latest
82
- before_script:
83
- - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
84
- script:
85
- - ls -la
86
- - >
87
- docker build --pull
88
- -t $CI_REGISTRY_IMAGE/npm:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
89
- --build-arg NPM_TOKEN=${NPM_TOKEN}
90
- -f ci/npm/Dockerfile .
91
- - docker push $CI_REGISTRY_IMAGE/npm:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
92
- only:
93
- - /.*-prod$/
94
- - /.*-next$/
95
- except:
96
- - branches
97
-
98
- Release:npm:production:
99
- stage: release
100
- image: $CI_REGISTRY_IMAGE/npm:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
101
- script:
102
- - npm publish --tag latest
103
- when: manual
104
- only:
105
- - /.*-prod$/
106
- except:
107
- - branches
108
-
109
- Release:npm:next:
110
- stage: release
111
- image: $CI_REGISTRY_IMAGE/npm:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
112
- script:
113
- - pwd
114
- - ls -lah /publish
115
- - npm publish --tag next
116
- when: manual
117
- only:
118
- - /.*-next$/
119
- except:
120
- - branches
121
-
122
- # cdn
123
-
124
- build:cdn:
125
- stage: build
126
- image: docker:latest
127
- before_script:
128
- - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
129
- script:
130
- - docker build --pull -t $CI_REGISTRY_IMAGE/cdn:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID -f ci/cdn/Dockerfile .
131
- - docker push $CI_REGISTRY_IMAGE/cdn:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
132
- rules:
133
- - if: $CI_COMMIT_TAG =~ /^v.*-next$/
134
- - if: $CI_COMMIT_TAG =~ /^v.*-prod$/
135
-
136
- release:cdn-prod:
137
- extends: .release:cdn
138
- variables:
139
- PUBLIC_PATH: "/webpush/v3/"
140
- DIST_PATH: "/dist/"
141
- stage: release-cdn
142
- image: $CI_REGISTRY_IMAGE/cdn:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
143
- dependencies:
144
- - build:cdn
145
- rules:
146
- - if: $CI_COMMIT_TAG =~ /^v.*-prod$/
147
-
148
- release:cdn-next:
149
- extends: .release:cdn
150
- variables:
151
- PUBLIC_PATH: "/webpush/next/"
152
- DIST_PATH: "/dist/"
153
- stage: release-cdn
154
- image: $CI_REGISTRY_IMAGE/cdn:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
155
- dependencies:
156
- - build:cdn
157
- rules:
158
- - if: $CI_COMMIT_TAG =~ /^v.*-next$/
159
-
160
- #github
161
-
162
- build:github-prod:
163
- extends: .build:github
164
- stage: build-github
165
- image: docker:latest
166
- variables:
167
- GITHUB_PATH_DOCKERFILE: ci/github/Dockerfile
168
- GITHUB_IMAGE_NAME: $CI_REGISTRY_IMAGE/github:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
169
-
170
- release:github:prod:
171
- extends: .release:github
172
- stage: release-github
173
- variables:
174
- GITHUB_HEAD: prod
175
- image: $CI_REGISTRY_IMAGE/github:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
176
- rules:
177
- - if: $CI_COMMIT_TAG =~ /^v.*$"{GITHUB_HEAD}"$/
178
-
179
- release:github:next:
180
- extends: .release:github
181
- stage: release-github
182
- variables:
183
- GITHUB_HEAD: next
184
- image: $CI_REGISTRY_IMAGE/github:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
185
- rules:
186
- - if: $CI_COMMIT_TAG =~ /^v.*$"{GITHUB_HEAD}"$/
187
-
188
- release:github:zip:
189
- extends: .release:githubzip
190
- stage: release-github
191
- image: $CI_REGISTRY_IMAGE/github:$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID
192
- variables:
193
- PATH_TAG_MESSAGE: "/tag-message.txt"
package/babel.config.js DELETED
@@ -1,7 +0,0 @@
1
- // dont rename to .babelrc, because if rename babel not transpiler node_modules
2
-
3
- module.exports = {
4
- "presets": [
5
- "@babel/env",
6
- ]
7
- };
package/ci/cdn/Dockerfile DELETED
@@ -1,12 +0,0 @@
1
- FROM alpine
2
-
3
- LABEL vendor="Pushwoosh Inc." \
4
- name="WebSDK" \
5
- version="1.0"
6
-
7
- RUN apk update
8
- RUN apk --update --no-cache add python3 py-pip py-setuptools git ca-certificates
9
- RUN pip install --break-system-packages pip
10
- RUN pip install --break-system-packages python-dateutil s3cmd
11
-
12
- COPY output/cdn /dist
package/ci/dev/Dockerfile DELETED
@@ -1,30 +0,0 @@
1
- FROM alpine
2
-
3
- LABEL vendor="Pushwoosh Inc." \
4
- name="WebSDK" \
5
- version="1.0"
6
-
7
-
8
- RUN apk --no-cache add nginx supervisor
9
-
10
- COPY ci/dev/rootfs/ /
11
- COPY output/cdn /var/www/html/
12
-
13
- # Configure supervisor
14
- RUN sed -e 's|^;\?\(file\s*=\s*\)[^ ]*|\1/dev/shm/supervisor.sock|' \
15
- -e 's|^;\?\(serverurl\s*=\s*unix://\)[^ ]*|\1/dev/shm/supervisor.sock|' \
16
- -e 's|^;\?\(logfile_maxbytes\s*=\s*\)[^ ]*|\150MB|' \
17
- -e 's|^;\?\(logfile_backups\s*=\s*\)[^ ]*|\110|' \
18
- -e 's|^;\?\(pidfile\s*=\s*\)[^ ]*|\1/dev/shm/supervisord.pid|' \
19
- -e 's|^;\?\(nodaemon\s*=\s*\)[^ ]*|\1false|' \
20
- -e '/^\[supervisord\]$/,/^;\?user\s*=.\+/{/^;\?user\s*=.\+/ s/^;\?\(user\s*=\s*\)[^ ]*/\1root/}' \
21
- -i /etc/supervisord.conf
22
-
23
- # Forward nginx request and error logs to docker log collector
24
- RUN ln -sf /dev/stdout /var/log/nginx/access.log \
25
- && ln -sf /dev/stderr /var/log/nginx/error.log
26
-
27
- EXPOSE 80
28
-
29
- # Start supervisord
30
- CMD ["/entrypoint.sh"]
@@ -1,18 +0,0 @@
1
- #!/bin/sh
2
-
3
- [ -n "$DEBUG" ] && set -x
4
-
5
- # Run custom scripts
6
- if [ -d "/entrypoint.sh.d/" ]; then
7
- for f in /entrypoint.sh.d/*; do
8
- case "$f" in
9
- *.sh) echo "$0 INFO : running $f"; . "$f" ;;
10
- *) echo "$0 INFO : ignoring $f" ;;
11
- esac
12
- done
13
- else
14
- echo "ERROR : Can't find script directory"
15
- fi
16
-
17
- # Start supervisord
18
- exec /usr/bin/supervisord -n -c /etc/supervisord.conf
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
-
3
- # Create runtime directories
4
- install -o nginx -g nginx -m 755 -d /run/nginx
5
-
6
- [ -f /etc/nginx/_real_ip.conf ] || touch /etc/nginx/_real_ip.conf
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
-
3
- sed -e 's|^;\?\(logfile_maxbytes\s*=\s*\)[^ ]*|\1'${SUPERVISOR_LOGFILE_MAXBYTES:-50MB}'|' \
4
- -e 's|^;\?\(logfile_backups\s*=\s*\)[^ ]*|\1'${SUPERVISOR_LOGFILE_BACKUPS:-10}'|' \
5
- -i /etc/supervisord.conf
@@ -1,2 +0,0 @@
1
- set_real_ip_from 172.17.0.1;
2
- real_ip_header X-Real-IP;
@@ -1,20 +0,0 @@
1
- server {
2
- listen 80;
3
- server_name localhost default_server;
4
- server_name _;
5
-
6
- root /var/www/html/;
7
- sendfile on;
8
-
9
- add_header X-Frame-Options DENY;
10
- add_header X-Content-Type-Options nosniff;
11
- add_header X-XSS-Protection "1; mode=block";
12
-
13
- # Add stdout logging
14
- error_log /dev/stderr info;
15
- access_log /dev/stdout;
16
-
17
- location / {
18
- try_files $uri $uri/ /index.html;
19
- }
20
- }
@@ -1,11 +0,0 @@
1
- [program:nginx]
2
- command = /usr/sbin/nginx -g "daemon off; error_log /dev/stderr info;"
3
- autostart = true
4
- autorestart = true
5
- priority = 10
6
- stdout_events_enabled = true
7
- stderr_events_enabled = true
8
- stdout_logfile = /dev/stdout
9
- stdout_logfile_maxbytes = 0
10
- stderr_logfile = /dev/stderr
11
- stderr_logfile_maxbytes = 0