web-push-notifications 3.44.7 → 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,59 +0,0 @@
1
- FROM alpine
2
-
3
- LABEL vendor="Pushwoosh Inc." \
4
- name="WebSDK" \
5
- version="1.0"
6
-
7
- RUN apk add --update git jq curl nodejs npm
8
-
9
- ARG GITHUB_OWNER
10
- ARG GITHUB_REPO
11
- ARG GITHUB_USERNAME
12
- ARG GITHUB_TOKEN
13
- ARG GITLAB_TOKEN
14
- ARG CI_PROJECT_ID
15
- ARG CI_COMMIT_TAG
16
-
17
- ENV GITHUB_OWNER=${GITHUB_OWNER}
18
- ENV GITHUB_REPO=${GITHUB_REPO}
19
- ENV GITHUB_USERNAME=${GITHUB_USERNAME}
20
- ENV GITHUB_TOKEN=${GITHUB_TOKEN}
21
- ENV GITLAB_TOKEN=${GITLAB_TOKEN}
22
- ENV CI_PROJECT_ID=${CI_PROJECT_ID}
23
- ENV CI_COMMIT_TAG=${CI_COMMIT_TAG}
24
-
25
- RUN git config --global user.email "help@pushwoosh.com"
26
- RUN git config --global user.name "${GITHUB_USERNAME}"
27
- RUN git config --global user.password "${GITHUB_TOKEN}"
28
-
29
- RUN mkdir -p github
30
- RUN cd /github && git init && git remote add origin https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${GITHUB_OWNER}/${GITHUB_REPO}.git
31
-
32
- RUN touch /tag-message.txt
33
- RUN chmod +x /tag-message.txt
34
- RUN echo $(curl --header "Private-Token: $GITLAB_TOKEN" https://gitlab.corp.pushwoosh.com/api/v4/projects/${CI_PROJECT_ID}/repository/tags/${CI_COMMIT_TAG} | jq ".message") > /tag-message.txt
35
-
36
- COPY config /github/config
37
- COPY develop /github/develop
38
- COPY public /github/public
39
- COPY scripts /github/scripts
40
- COPY src /github/src
41
- # COPY types /github/types
42
- COPY output/cdn /github/dist
43
-
44
- COPY package.json /github/package.json
45
- COPY .gitignore /github/.gitignore
46
-
47
- # COPY tslint.json /github/babel.config.json
48
- COPY tsconfig.json /github/tsconfig.json
49
- # COPY tslint.json /github/tslint.json
50
-
51
- COPY webpack.config.js /github/webpack.config.js
52
- # COPY webpack.lib.config.js /github/webpack.lib.config.js
53
-
54
- COPY README.md /github/README.md
55
- COPY LICENSE.md /github/LICENSE.md
56
-
57
- COPY ci/github/release-zip.js /ci/release-zip.js
58
-
59
- RUN echo RELEASE_NOTE=$(cat /tag-message.txt)
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const exec = require('child_process').exec;
4
- const fs = require('fs');
5
-
6
- const repo = process.env.GITHUB_REPO;
7
- const owner = process.env.GITHUB_OWNER;
8
- const token = process.env.GITHUB_TOKEN;
9
- const branch = process.env.BRANCH;
10
- const releaseNote = process.env.RELEASE_NOTE;
11
-
12
- fs.readFile('/github/package.json', 'utf8', (err, packageJSON) => {
13
- const currentVersion = JSON.parse(packageJSON).version;
14
-
15
- const data = JSON.stringify({
16
- tag_name: `v${currentVersion}`,
17
- name: `Pushwoosh Web SDK v${currentVersion}`,
18
- body: releaseNote,
19
- target_commitish: branch,
20
- draft: false,
21
- prerelease: false,
22
- });
23
-
24
- exec(`curl -H 'Authorization: token ${token}' --data '${data}' https://api.github.com/repos/${owner}/${repo}/releases`,
25
- (err, stdout, stderr) => {
26
- if (err) {
27
- console.log(err);
28
- return process.exit(1);
29
- }
30
- if (stderr) {
31
- console.log(stderr);
32
- }
33
-
34
- stdout = JSON.parse(stdout);
35
-
36
- if (stdout.upload_url) {
37
- const zipFileName = `PushwooshWebSDK-${currentVersion}.zip`;
38
- const url = stdout.upload_url.replace('{?name,label}', `?name=${zipFileName}`);
39
- const upload = `curl -H 'Authorization: token ${token}' \\
40
- -H 'Accept: application/vnd.github.v3+json' \\
41
- -H 'Content-Type: application/zip' \\
42
- --data-binary '@/github/dist/${zipFileName}' \\
43
- ${url}`;
44
- exec(upload, (err, stdout, stderr) => {
45
- if (err) {
46
- console.log(err);
47
- return process.exit(1);
48
- }
49
- if (stderr) {
50
- console.log(stderr);
51
- }
52
- console.log(stdout);
53
- return process.exit(0);
54
- });
55
- } else {
56
- console.log(stdout);
57
- return process.exit(1);
58
- }
59
- },
60
- );
61
- });
package/ci/npm/Dockerfile DELETED
@@ -1,22 +0,0 @@
1
- FROM node:18-alpine
2
-
3
- LABEL vendor="Pushwoosh Inc." \
4
- name="WebSDK" \
5
- version="1.0"
6
-
7
- ARG NPM_TOKEN
8
-
9
- ENV NPM_TOKEN=${NPM_TOKEN}
10
-
11
- COPY output/npm /publish/
12
- RUN echo "=== Files in /publish ===" && ls -lah /publish && echo "=== Recursive listing ===" && ls -R /publish
13
-
14
- COPY .npmrc /publish/.npmrc
15
- COPY package.json /publish/package.json
16
-
17
- COPY README.md /publish/README.md
18
- COPY LICENSE.md /publish/LICENSE.md
19
-
20
- RUN echo "2=== Files in /publish ===" && ls -lah /publish && echo "1=== Recursive listing ===" && ls -R /publish
21
-
22
- WORKDIR /publish
package/config/config.js DELETED
@@ -1,24 +0,0 @@
1
- module.exports = {
2
- initParams: {
3
- logLevel: 'info',
4
- applicationCode: 'XXXXX-XXXXX',
5
- apiToken: 'abcdxyz',
6
- safariWebsitePushID: 'web.com.example.test',
7
- defaultNotificationTitle: 'Pushwoosh',
8
- defaultNotificationImage: 'https://cp.pushwoosh.com/img/logo-medium.png',
9
- autoSubscribe: false,
10
- userId: 'user_id',
11
- serviceWorkerUrl: 'pushwoosh-service-worker.js',
12
- tags: {
13
- Name: 'John Doe',
14
- },
15
- subscribeWidget: {
16
- enable: true,
17
- },
18
- },
19
-
20
- ssl: {
21
- key: '', // absolute path to key
22
- cert: '', // absolute path to cert
23
- },
24
- };
@@ -1,126 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const BASE_PATH = '__base__';
5
-
6
- // Utils
7
- function parseEnvKey(key) {
8
- return key
9
- .slice(3)
10
- .replace(/__/g, '.')
11
- .split('.');
12
- }
13
-
14
- function castEnvValueTypes(value) {
15
- switch (value) {
16
- case 'true':
17
- return true;
18
- case 'false':
19
- return false;
20
- default:
21
- return value;
22
- }
23
- }
24
-
25
- function setValueByPath(path, obj, value) {
26
- let tmpConfig = obj;
27
- path.forEach((pathPart, i) => {
28
- if (!(pathPart in tmpConfig)) {
29
- tmpConfig[pathPart] = {};
30
- }
31
-
32
- if (i === path.length - 1) {
33
- tmpConfig[pathPart] = value;
34
- } else {
35
- tmpConfig = tmpConfig[pathPart];
36
- }
37
- });
38
- }
39
-
40
- function buildObjectsMap(object, path = BASE_PATH) {
41
- const objMap = { [path]: Object.assign({}, object) };
42
- Object.keys(object).forEach((key) => {
43
- if (object[key] !== null && !Array.isArray(object[key]) && typeof object[key] === 'object') {
44
- delete objMap[path][key];
45
- Object.assign(objMap, buildObjectsMap(object[key], `${path}.${key}`));
46
- }
47
- });
48
- return objMap;
49
- }
50
-
51
- function configDeepAssign(...configs) {
52
- const [baseConfig, ...anotherConfigs] = configs;
53
-
54
- // Make result config map
55
- const resConfigMap = buildObjectsMap(baseConfig);
56
- anotherConfigs.forEach((config) => {
57
- const configMap = buildObjectsMap(config);
58
- Object.keys(configMap).forEach((key) => {
59
- if (key in resConfigMap) {
60
- Object.assign(resConfigMap[key], configMap[key]);
61
- delete configMap[key];
62
- }
63
- });
64
- Object.assign(resConfigMap, configMap);
65
- });
66
-
67
- // Make config from map
68
- const result = {};
69
- Object.keys(resConfigMap).forEach((key) => {
70
- if (key === BASE_PATH) {
71
- Object.assign(result, resConfigMap[key]);
72
- } else {
73
- const path = key.replace(`${BASE_PATH}.`, '').split('.');
74
- setValueByPath(path, result, resConfigMap[key]);
75
- }
76
- });
77
-
78
- return result;
79
- }
80
-
81
- // Config Getters
82
- function getEnvironmentConfig() {
83
- const envConfig = {};
84
- Object.keys(process.env).forEach((envKey) => {
85
- if (!envKey.startsWith('PW_')) {
86
- return;
87
- }
88
-
89
- const path = parseEnvKey(envKey);
90
- const value = castEnvValueTypes(process.env[envKey]);
91
- setValueByPath(path, envConfig, value);
92
- });
93
- return envConfig;
94
- }
95
-
96
- // Configs
97
- const defaultConfig = require(path.resolve(__dirname, 'config.js')); // Default
98
-
99
- const configPath = process.env.GUI_CONFIG_PRESET_NAME
100
- ? path.resolve(__dirname, `config.${process.env.GUI_CONFIG_PRESET_NAME}.js`)
101
- : '';
102
- const presetConfig = fs.existsSync(configPath) ? require(configPath) : {}; // Preset
103
-
104
- const LOCAL_CONFIG_PATH = path.resolve(__dirname, 'config.local.js');
105
- const localConfig = fs.existsSync(LOCAL_CONFIG_PATH) && process.env.NODE_ENV !== 'production'
106
- ? require(LOCAL_CONFIG_PATH)
107
- : {}; // Local
108
-
109
- const fileConfig = {}; // Custom file
110
-
111
- const envConfig = getEnvironmentConfig(); // Environment
112
-
113
- const QA_CONFIG_PATH = path.resolve(__dirname, 'config.qa.js');
114
- const qaConfig = fs.existsSync(QA_CONFIG_PATH) ? require(QA_CONFIG_PATH) : {}; // QA
115
-
116
- // Build result config
117
- const config = configDeepAssign(
118
- defaultConfig,
119
- presetConfig,
120
- localConfig,
121
- fileConfig,
122
- envConfig,
123
- qaConfig,
124
- );
125
-
126
- module.exports = config;
package/config/helpers.js DELETED
@@ -1,9 +0,0 @@
1
- function mapValues(obj, mapFn) {
2
- return Object.fromEntries(
3
- Object.entries(obj).map(([key, value]) => {
4
- return [key, mapFn(value, key)];
5
- }),
6
- );
7
- }
8
-
9
- module.exports.mapValues = mapValues;
package/config/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports.configBuilder = require('./configBuilder');
package/develop/README.md DELETED
@@ -1,42 +0,0 @@
1
- # Change init params
2
-
3
- #### Clone the `config/config.js` to a `config/config.local.js` and edit it
4
-
5
- ```js
6
- module.exports = {
7
- initParams: {
8
- applicationCode: 'XXXXX-XXXXX',
9
- safariWebsitePushID: 'web.com.example.test',
10
- serviceWorkerUrl: 'pushwoosh-service-worker.uncompress.js'
11
- },
12
-
13
- ssl: {
14
- key: '', // absolute path to key
15
- cert: '' // absolute path to cert
16
- }
17
- };
18
- ```
19
-
20
- ## Build development
21
-
22
- ```bash
23
- npm run build
24
- ```
25
-
26
- ## Build production
27
-
28
- ```bash
29
- npm run build:prod
30
- ```
31
-
32
- ## Run server
33
-
34
- ```bash
35
- npm run start
36
- ```
37
-
38
- ## Prepare release files
39
-
40
- ```bash
41
- npm run release
42
- ```
Binary file