Skip to content

Commit 670fcdc

Browse files
feat: decouple logic and add support for agnostic push
1 parent 02a504d commit 670fcdc

File tree

16 files changed

+1083
-288
lines changed

16 files changed

+1083
-288
lines changed

packages/notification-services-controller/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@
6767
"default": "./dist/NotificationServicesPushController/index.cjs"
6868
}
6969
},
70+
"./push-services/web": {
71+
"import": {
72+
"types": "./dist/NotificationServicesPushController/web/index.d.mts",
73+
"default": "./dist/NotificationServicesPushController/web/index.mjs"
74+
},
75+
"require": {
76+
"types": "./dist/NotificationServicesPushController/web/index.d.cts",
77+
"default": "./dist/NotificationServicesPushController/web/index.cjs"
78+
}
79+
},
7080
"./push-services/mocks": {
7181
"import": {
7282
"types": "./dist/NotificationServicesPushController/__fixtures__/index.d.mts",
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"name": "@metamask/notification-services-controller",
3+
"version": "0.18.0",
4+
"description": "Manages New MetaMask decentralized Notification system",
5+
"keywords": [
6+
"MetaMask",
7+
"Ethereum"
8+
],
9+
"homepage": "https://github.com/MetaMask/core/tree/main/packages/notification-services-controller#readme",
10+
"bugs": {
11+
"url": "https://github.com/MetaMask/core/issues"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/MetaMask/core.git"
16+
},
17+
"license": "MIT",
18+
"sideEffects": false,
19+
"exports": {
20+
".": {
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
29+
},
30+
"./notification-services": {
31+
"import": {
32+
"types": "./dist/NotificationServicesController/index.d.mts",
33+
"default": "./dist/NotificationServicesController/index.mjs"
34+
},
35+
"require": {
36+
"types": "./dist/NotificationServicesController/index.d.cts",
37+
"default": "./dist/NotificationServicesController/index.cjs"
38+
}
39+
},
40+
"./notification-services/ui": {
41+
"import": {
42+
"types": "./dist/NotificationServicesController/ui/index.d.mts",
43+
"default": "./dist/NotificationServicesController/ui/index.mjs"
44+
},
45+
"require": {
46+
"types": "./dist/NotificationServicesController/ui/index.d.cts",
47+
"default": "./dist/NotificationServicesController/ui/index.cjs"
48+
}
49+
},
50+
"./notification-services/mocks": {
51+
"import": {
52+
"types": "./dist/NotificationServicesController/__fixtures__/index.d.mts",
53+
"default": "./dist/NotificationServicesController/__fixtures__/index.mjs"
54+
},
55+
"require": {
56+
"types": "./dist/NotificationServicesController/__fixtures__/index.d.cts",
57+
"default": "./dist/NotificationServicesController/__fixtures__/index.cjs"
58+
}
59+
},
60+
"./push-services": {
61+
"import": {
62+
"types": "./dist/NotificationServicesPushController/index.d.mts",
63+
"default": "./dist/NotificationServicesPushController/index.mjs"
64+
},
65+
"require": {
66+
"types": "./dist/NotificationServicesPushController/index.d.cts",
67+
"default": "./dist/NotificationServicesPushController/index.cjs"
68+
}
69+
},
70+
"./push-services/web": {
71+
"import": {
72+
"types": "./dist/NotificationServicesPushController/web/index.d.mts",
73+
"default": "./dist/NotificationServicesPushController/web/index.mjs"
74+
},
75+
"require": {
76+
"types": "./dist/NotificationServicesPushController/web/index.d.cts",
77+
"default": "./dist/NotificationServicesPushController/web/index.cjs"
78+
}
79+
},
80+
"./push-services/mocks": {
81+
"import": {
82+
"types": "./dist/NotificationServicesPushController/__fixtures__/index.d.mts",
83+
"default": "./dist/NotificationServicesPushController/__fixtures__/index.mjs"
84+
},
85+
"require": {
86+
"types": "./dist/NotificationServicesPushController/__fixtures__/index.d.cts",
87+
"default": "./dist/NotificationServicesPushController/__fixtures__/index.cjs"
88+
}
89+
},
90+
"./package.json": "./package.json"
91+
},
92+
"main": "./dist/index.cjs",
93+
"types": "./dist/index.d.cts",
94+
"files": [
95+
"dist/",
96+
"notification-services/",
97+
"push-services/"
98+
],
99+
"scripts": {
100+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
101+
"build:docs": "typedoc",
102+
"changelog:update": "../../scripts/update-changelog.sh @metamask/notification-services-controller",
103+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/notification-services-controller",
104+
"publish:preview": "yarn npm publish --tag preview",
105+
"since-latest-release": "../../scripts/since-latest-release.sh",
106+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
107+
"test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
108+
"test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
109+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
110+
},
111+
"dependencies": {
112+
"@contentful/rich-text-html-renderer": "^16.5.2",
113+
"@metamask/base-controller": "^7.1.1",
114+
"@metamask/controller-utils": "^11.4.5",
115+
"@metamask/utils": "^11.0.1",
116+
"bignumber.js": "^9.1.2",
117+
"firebase": "^11.2.0",
118+
"loglevel": "^1.8.1",
119+
"uuid": "^8.3.2"
120+
},
121+
"devDependencies": {
122+
"@lavamoat/allow-scripts": "^3.0.4",
123+
"@lavamoat/preinstall-always-fail": "^2.1.0",
124+
"@metamask/auto-changelog": "^3.4.4",
125+
"@metamask/keyring-controller": "^19.0.5",
126+
"@metamask/profile-sync-controller": "^5.0.0",
127+
"@types/jest": "^27.4.1",
128+
"@types/readable-stream": "^2.3.0",
129+
"contentful": "^10.15.0",
130+
"deepmerge": "^4.2.2",
131+
"jest": "^27.5.1",
132+
"jest-environment-jsdom": "^27.5.1",
133+
"nock": "^13.3.1",
134+
"ts-jest": "^27.1.4",
135+
"typedoc": "^0.24.8",
136+
"typedoc-plugin-missing-exports": "^2.0.0",
137+
"typescript": "~5.2.2"
138+
},
139+
"peerDependencies": {
140+
"@metamask/keyring-controller": "^19.0.0",
141+
"@metamask/profile-sync-controller": "^5.0.0"
142+
},
143+
"engines": {
144+
"node": "^18.18 || >=20"
145+
},
146+
"publishConfig": {
147+
"access": "public",
148+
"registry": "https://registry.npmjs.org/"
149+
}
150+
}

packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ describe('metamask-notifications - disableMetamaskNotifications()', () => {
10171017
// Act - final state
10181018
expect(controller.state.isUpdatingMetamaskNotifications).toBe(false);
10191019
expect(controller.state.isNotificationServicesEnabled).toBe(false);
1020+
expect(controller.state.isFeatureAnnouncementsEnabled).toBe(false);
10201021
expect(controller.state.metamaskNotificationsList).toStrictEqual([
10211022
createMockSnapNotification(),
10221023
]);
@@ -1101,6 +1102,7 @@ function mockNotificationMessenger() {
11011102
'KeyringController:lock',
11021103
'KeyringController:unlock',
11031104
'NotificationServicesPushController:onNewNotifications',
1105+
'NotificationServicesPushController:stateChange',
11041106
],
11051107
});
11061108

0 commit comments

Comments
 (0)