@metamask-previews/notification-services-controller 0.2.0-preview-89bd443 → 0.2.0-preview-f59de5e
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.
- package/dist/NotificationServicesController/NotificationServicesController.js +4 -3
- package/dist/NotificationServicesController/NotificationServicesController.mjs +3 -2
- package/dist/NotificationServicesController/index.js +17 -16
- package/dist/NotificationServicesController/index.mjs +16 -15
- package/dist/NotificationServicesController/services/onchain-notifications.js +3 -2
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +2 -1
- package/dist/NotificationServicesController/types/index.js +2 -2
- package/dist/NotificationServicesController/types/index.mjs +2 -2
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js +14 -13
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +13 -12
- package/dist/NotificationServicesPushController/index.js +18 -17
- package/dist/NotificationServicesPushController/index.mjs +17 -16
- package/dist/NotificationServicesPushController/services/push/push-web.js +12 -11
- package/dist/NotificationServicesPushController/services/push/push-web.mjs +11 -10
- package/dist/NotificationServicesPushController/services/services.js +13 -12
- package/dist/NotificationServicesPushController/services/services.mjs +12 -11
- package/dist/NotificationServicesPushController/utils/get-notification-message.js +10 -9
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +10 -9
- package/dist/NotificationServicesPushController/utils/index.js +10 -9
- package/dist/NotificationServicesPushController/utils/index.mjs +10 -9
- package/dist/{chunk-MT4VCZEE.js → chunk-2BCJRWFF.js} +6 -6
- package/dist/{chunk-T6VYBOQN.js → chunk-323GXNRE.js} +19 -7
- package/dist/chunk-323GXNRE.js.map +1 -0
- package/dist/{chunk-GJHW5Z65.js → chunk-4HOEZMSV.js} +4 -4
- package/dist/{chunk-5TUHE2FM.js → chunk-6GXEFQ64.js} +11 -11
- package/dist/chunk-6GXEFQ64.js.map +1 -0
- package/dist/chunk-DINCLRZT.mjs +12 -0
- package/dist/chunk-DINCLRZT.mjs.map +1 -0
- package/dist/chunk-DT6SLUWJ.js +12 -0
- package/dist/chunk-DT6SLUWJ.js.map +1 -0
- package/dist/{chunk-EZHMYHBX.mjs → chunk-FN6GVBCU.mjs} +9 -11
- package/dist/chunk-FN6GVBCU.mjs.map +1 -0
- package/dist/{chunk-72H2V4J5.js → chunk-GDKHOBJT.js} +7 -3
- package/dist/chunk-GDKHOBJT.js.map +1 -0
- package/dist/{chunk-DNVD3CHQ.js → chunk-H73GATCU.js} +9 -11
- package/dist/chunk-H73GATCU.js.map +1 -0
- package/dist/{chunk-R373BQEU.mjs → chunk-N4EKQQX7.mjs} +5 -5
- package/dist/{chunk-CODFVUDW.js → chunk-OE2TTTBQ.js} +14 -14
- package/dist/{chunk-TGT36FCC.mjs → chunk-OLYCBAVW.mjs} +14 -2
- package/dist/chunk-OLYCBAVW.mjs.map +1 -0
- package/dist/{chunk-YF2244XO.mjs → chunk-PGXUX4TK.mjs} +9 -9
- package/dist/{chunk-ADYRLXWY.mjs → chunk-WGGW6VCR.mjs} +2 -2
- package/dist/{chunk-XVIUHFC3.mjs → chunk-X3ZU3HL7.mjs} +4 -4
- package/dist/{chunk-XVIUHFC3.mjs.map → chunk-X3ZU3HL7.mjs.map} +1 -1
- package/dist/{chunk-A5QFYBTR.mjs → chunk-YHVXD5WW.mjs} +7 -3
- package/dist/chunk-YHVXD5WW.mjs.map +1 -0
- package/dist/index.js +16 -15
- package/dist/index.mjs +15 -14
- package/dist/shared/to-raw-notification.js +8 -0
- package/dist/shared/to-raw-notification.js.map +1 -0
- package/dist/shared/to-raw-notification.mjs +8 -0
- package/dist/shared/to-raw-notification.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/NotificationServicesController/NotificationServicesController.d.ts +11 -2
- package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/services/onchain-notifications.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts +1 -0
- package/dist/types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts.map +1 -1
- package/dist/types/NotificationServicesPushController/services/push/push-web.d.ts.map +1 -1
- package/dist/types/shared/to-raw-notification.d.ts +11 -0
- package/dist/types/shared/to-raw-notification.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-5TUHE2FM.js.map +0 -1
- package/dist/chunk-72H2V4J5.js.map +0 -1
- package/dist/chunk-A5QFYBTR.mjs.map +0 -1
- package/dist/chunk-DNVD3CHQ.js.map +0 -1
- package/dist/chunk-EZHMYHBX.mjs.map +0 -1
- package/dist/chunk-T6VYBOQN.js.map +0 -1
- package/dist/chunk-TGT36FCC.mjs.map +0 -1
- /package/dist/{chunk-MT4VCZEE.js.map → chunk-2BCJRWFF.js.map} +0 -0
- /package/dist/{chunk-GJHW5Z65.js.map → chunk-4HOEZMSV.js.map} +0 -0
- /package/dist/{chunk-R373BQEU.mjs.map → chunk-N4EKQQX7.mjs.map} +0 -0
- /package/dist/{chunk-CODFVUDW.js.map → chunk-OE2TTTBQ.js.map} +0 -0
- /package/dist/{chunk-YF2244XO.mjs.map → chunk-PGXUX4TK.mjs.map} +0 -0
- /package/dist/{chunk-ADYRLXWY.mjs.map → chunk-WGGW6VCR.mjs.map} +0 -0
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
var _chunkBUT7X5F2js = require('../../chunk-BUT7X5F2.js');
|
|
6
6
|
require('../../chunk-EJ52BDLB.js');
|
|
7
|
-
require('../../chunk-
|
|
8
|
-
require('../../chunk-IG3KWCQU.js');
|
|
9
|
-
require('../../chunk-QOG3RCXM.js');
|
|
10
|
-
require('../../chunk-KWTSMLND.js');
|
|
7
|
+
require('../../chunk-OE2TTTBQ.js');
|
|
11
8
|
require('../../chunk-232HZSEV.js');
|
|
9
|
+
require('../../chunk-XZEVRYUE.js');
|
|
10
|
+
require('../../chunk-3ZS2HAEG.js');
|
|
12
11
|
require('../../chunk-ZV3DFBO4.js');
|
|
13
12
|
require('../../chunk-DMH4NSLF.js');
|
|
14
13
|
require('../../chunk-IPI7BAW3.js');
|
|
@@ -17,17 +16,19 @@ require('../../chunk-WRYFIWNK.js');
|
|
|
17
16
|
require('../../chunk-V5HMYDWE.js');
|
|
18
17
|
require('../../chunk-ZBNBZN5H.js');
|
|
19
18
|
require('../../chunk-PROWNV4M.js');
|
|
20
|
-
require('../../chunk-
|
|
21
|
-
require('../../chunk-
|
|
22
|
-
require('../../chunk-
|
|
19
|
+
require('../../chunk-IG3KWCQU.js');
|
|
20
|
+
require('../../chunk-QOG3RCXM.js');
|
|
21
|
+
require('../../chunk-QY4UST5V.js');
|
|
22
|
+
require('../../chunk-KWTSMLND.js');
|
|
23
|
+
require('../../chunk-323GXNRE.js');
|
|
23
24
|
require('../../chunk-5FUMSWDD.js');
|
|
24
25
|
require('../../chunk-LYEXYTOI.js');
|
|
25
26
|
require('../../chunk-HZEB53A6.js');
|
|
26
27
|
require('../../chunk-52CALMRA.js');
|
|
27
|
-
require('../../chunk-
|
|
28
|
+
require('../../chunk-H73GATCU.js');
|
|
28
29
|
require('../../chunk-NOYP2T77.js');
|
|
29
|
-
require('../../chunk-QY4UST5V.js');
|
|
30
30
|
require('../../chunk-V6P5JEPT.js');
|
|
31
|
+
require('../../chunk-DT6SLUWJ.js');
|
|
31
32
|
require('../../chunk-TLX5QQK5.js');
|
|
32
33
|
require('../../chunk-IGY2S5BC.js');
|
|
33
34
|
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
isOnChainNotification
|
|
5
5
|
} from "../../chunk-6GUOLD7O.mjs";
|
|
6
6
|
import "../../chunk-ODI2BTKS.mjs";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-5JDAO4ZC.mjs";
|
|
9
|
-
import "../../chunk-YZYQYIKS.mjs";
|
|
10
|
-
import "../../chunk-X42WN3FE.mjs";
|
|
7
|
+
import "../../chunk-PGXUX4TK.mjs";
|
|
11
8
|
import "../../chunk-B4ECJJ5C.mjs";
|
|
9
|
+
import "../../chunk-U74Q3BRP.mjs";
|
|
10
|
+
import "../../chunk-G52DNXFH.mjs";
|
|
12
11
|
import "../../chunk-7RM3YNTD.mjs";
|
|
13
12
|
import "../../chunk-PNCS6GEX.mjs";
|
|
14
13
|
import "../../chunk-4QXAPVW3.mjs";
|
|
@@ -17,17 +16,19 @@ import "../../chunk-IDO4JFV5.mjs";
|
|
|
17
16
|
import "../../chunk-A2RPVX47.mjs";
|
|
18
17
|
import "../../chunk-4BTNTREI.mjs";
|
|
19
18
|
import "../../chunk-QB5IFRLA.mjs";
|
|
20
|
-
import "../../chunk-
|
|
21
|
-
import "../../chunk-
|
|
22
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-5JDAO4ZC.mjs";
|
|
20
|
+
import "../../chunk-YZYQYIKS.mjs";
|
|
21
|
+
import "../../chunk-ZHAD55AN.mjs";
|
|
22
|
+
import "../../chunk-X42WN3FE.mjs";
|
|
23
|
+
import "../../chunk-OLYCBAVW.mjs";
|
|
23
24
|
import "../../chunk-KCWTVLMK.mjs";
|
|
24
25
|
import "../../chunk-BONB66A2.mjs";
|
|
25
26
|
import "../../chunk-QFJZBLYQ.mjs";
|
|
26
27
|
import "../../chunk-D42BBXBM.mjs";
|
|
27
|
-
import "../../chunk-
|
|
28
|
+
import "../../chunk-FN6GVBCU.mjs";
|
|
28
29
|
import "../../chunk-ILPTPB4U.mjs";
|
|
29
|
-
import "../../chunk-ZHAD55AN.mjs";
|
|
30
30
|
import "../../chunk-J4D2NH6Y.mjs";
|
|
31
|
+
import "../../chunk-DINCLRZT.mjs";
|
|
31
32
|
import "../../chunk-6ZDVTRRT.mjs";
|
|
32
33
|
import "../../chunk-U5UIDVOO.mjs";
|
|
33
34
|
export {
|
|
@@ -10,11 +10,10 @@ var _chunkBUT7X5F2js = require('../../chunk-BUT7X5F2.js');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkEJ52BDLBjs = require('../../chunk-EJ52BDLB.js');
|
|
13
|
-
require('../../chunk-
|
|
14
|
-
require('../../chunk-IG3KWCQU.js');
|
|
15
|
-
require('../../chunk-QOG3RCXM.js');
|
|
16
|
-
require('../../chunk-KWTSMLND.js');
|
|
13
|
+
require('../../chunk-OE2TTTBQ.js');
|
|
17
14
|
require('../../chunk-232HZSEV.js');
|
|
15
|
+
require('../../chunk-XZEVRYUE.js');
|
|
16
|
+
require('../../chunk-3ZS2HAEG.js');
|
|
18
17
|
require('../../chunk-ZV3DFBO4.js');
|
|
19
18
|
require('../../chunk-DMH4NSLF.js');
|
|
20
19
|
require('../../chunk-IPI7BAW3.js');
|
|
@@ -23,17 +22,19 @@ require('../../chunk-WRYFIWNK.js');
|
|
|
23
22
|
require('../../chunk-V5HMYDWE.js');
|
|
24
23
|
require('../../chunk-ZBNBZN5H.js');
|
|
25
24
|
require('../../chunk-PROWNV4M.js');
|
|
26
|
-
require('../../chunk-
|
|
27
|
-
require('../../chunk-
|
|
28
|
-
require('../../chunk-
|
|
25
|
+
require('../../chunk-IG3KWCQU.js');
|
|
26
|
+
require('../../chunk-QOG3RCXM.js');
|
|
27
|
+
require('../../chunk-QY4UST5V.js');
|
|
28
|
+
require('../../chunk-KWTSMLND.js');
|
|
29
|
+
require('../../chunk-323GXNRE.js');
|
|
29
30
|
require('../../chunk-5FUMSWDD.js');
|
|
30
31
|
require('../../chunk-LYEXYTOI.js');
|
|
31
32
|
require('../../chunk-HZEB53A6.js');
|
|
32
33
|
require('../../chunk-52CALMRA.js');
|
|
33
|
-
require('../../chunk-
|
|
34
|
+
require('../../chunk-H73GATCU.js');
|
|
34
35
|
require('../../chunk-NOYP2T77.js');
|
|
35
|
-
require('../../chunk-QY4UST5V.js');
|
|
36
36
|
require('../../chunk-V6P5JEPT.js');
|
|
37
|
+
require('../../chunk-DT6SLUWJ.js');
|
|
37
38
|
require('../../chunk-TLX5QQK5.js');
|
|
38
39
|
require('../../chunk-IGY2S5BC.js');
|
|
39
40
|
|
|
@@ -10,11 +10,10 @@ import {
|
|
|
10
10
|
getAmount,
|
|
11
11
|
getLeadingZeroCount
|
|
12
12
|
} from "../../chunk-ODI2BTKS.mjs";
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-5JDAO4ZC.mjs";
|
|
15
|
-
import "../../chunk-YZYQYIKS.mjs";
|
|
16
|
-
import "../../chunk-X42WN3FE.mjs";
|
|
13
|
+
import "../../chunk-PGXUX4TK.mjs";
|
|
17
14
|
import "../../chunk-B4ECJJ5C.mjs";
|
|
15
|
+
import "../../chunk-U74Q3BRP.mjs";
|
|
16
|
+
import "../../chunk-G52DNXFH.mjs";
|
|
18
17
|
import "../../chunk-7RM3YNTD.mjs";
|
|
19
18
|
import "../../chunk-PNCS6GEX.mjs";
|
|
20
19
|
import "../../chunk-4QXAPVW3.mjs";
|
|
@@ -23,17 +22,19 @@ import "../../chunk-IDO4JFV5.mjs";
|
|
|
23
22
|
import "../../chunk-A2RPVX47.mjs";
|
|
24
23
|
import "../../chunk-4BTNTREI.mjs";
|
|
25
24
|
import "../../chunk-QB5IFRLA.mjs";
|
|
26
|
-
import "../../chunk-
|
|
27
|
-
import "../../chunk-
|
|
28
|
-
import "../../chunk-
|
|
25
|
+
import "../../chunk-5JDAO4ZC.mjs";
|
|
26
|
+
import "../../chunk-YZYQYIKS.mjs";
|
|
27
|
+
import "../../chunk-ZHAD55AN.mjs";
|
|
28
|
+
import "../../chunk-X42WN3FE.mjs";
|
|
29
|
+
import "../../chunk-OLYCBAVW.mjs";
|
|
29
30
|
import "../../chunk-KCWTVLMK.mjs";
|
|
30
31
|
import "../../chunk-BONB66A2.mjs";
|
|
31
32
|
import "../../chunk-QFJZBLYQ.mjs";
|
|
32
33
|
import "../../chunk-D42BBXBM.mjs";
|
|
33
|
-
import "../../chunk-
|
|
34
|
+
import "../../chunk-FN6GVBCU.mjs";
|
|
34
35
|
import "../../chunk-ILPTPB4U.mjs";
|
|
35
|
-
import "../../chunk-ZHAD55AN.mjs";
|
|
36
36
|
import "../../chunk-J4D2NH6Y.mjs";
|
|
37
|
+
import "../../chunk-DINCLRZT.mjs";
|
|
37
38
|
import "../../chunk-6ZDVTRRT.mjs";
|
|
38
39
|
import "../../chunk-U5UIDVOO.mjs";
|
|
39
40
|
export {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7LWR54U7js = require('./chunk-7LWR54U7.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkENRKCWJ6js = require('./chunk-ENRKCWJ6.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk6GXEFQ64js = require('./chunk-6GXEFQ64.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkB25TJ7KSjs = require('./chunk-B25TJ7KS.js');
|
|
@@ -18,11 +18,11 @@ var _chunkIGY2S5BCjs = require('./chunk-IGY2S5BC.js');
|
|
|
18
18
|
// src/NotificationServicesPushController/index.ts
|
|
19
19
|
var NotificationServicesPushController_exports = {};
|
|
20
20
|
_chunkIGY2S5BCjs.__export.call(void 0, NotificationServicesPushController_exports, {
|
|
21
|
-
Controller: () =>
|
|
21
|
+
Controller: () => _chunk6GXEFQ64js.NotificationServicesPushController,
|
|
22
22
|
Mocks: () => fixtures_exports,
|
|
23
23
|
Types: () => _chunk7LWR54U7js.types_exports,
|
|
24
24
|
Utils: () => _chunkENRKCWJ6js.utils_exports,
|
|
25
|
-
defaultState: () =>
|
|
25
|
+
defaultState: () => _chunk6GXEFQ64js.defaultState
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
// src/NotificationServicesPushController/__fixtures__/index.ts
|
|
@@ -91,4 +91,4 @@ var getMockDeleteFCMRegistrationTokenResponse = () => {
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
exports.fixtures_exports = fixtures_exports; exports.NotificationServicesPushController_exports = NotificationServicesPushController_exports;
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-2BCJRWFF.js.map
|
|
@@ -9,7 +9,7 @@ var _chunkHZEB53A6js = require('./chunk-HZEB53A6.js');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkH73GATCUjs = require('./chunk-H73GATCU.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -451,7 +451,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
451
451
|
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
452
452
|
}
|
|
453
453
|
const triggers = _chunkNOYP2T77js.traverseUserStorageTriggers.call(void 0, userStorage);
|
|
454
|
-
await
|
|
454
|
+
await _chunkH73GATCUjs.createOnChainTriggers.call(void 0,
|
|
455
455
|
userStorage,
|
|
456
456
|
storageKey,
|
|
457
457
|
bearerToken,
|
|
@@ -545,7 +545,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
545
545
|
if (UUIDs.length === 0) {
|
|
546
546
|
return userStorage;
|
|
547
547
|
}
|
|
548
|
-
await
|
|
548
|
+
await _chunkH73GATCUjs.deleteOnChainTriggers.call(void 0,
|
|
549
549
|
userStorage,
|
|
550
550
|
storageKey,
|
|
551
551
|
bearerToken,
|
|
@@ -601,7 +601,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
601
601
|
return void 0;
|
|
602
602
|
}
|
|
603
603
|
});
|
|
604
|
-
await
|
|
604
|
+
await _chunkH73GATCUjs.createOnChainTriggers.call(void 0,
|
|
605
605
|
userStorage,
|
|
606
606
|
storageKey,
|
|
607
607
|
bearerToken,
|
|
@@ -637,7 +637,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
637
637
|
const userStorage = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).getNotificationStorage().then((s) => s && JSON.parse(s)).catch(() => null);
|
|
638
638
|
const bearerToken = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).getBearerToken().catch(() => null);
|
|
639
639
|
if (userStorage && bearerToken) {
|
|
640
|
-
const notifications = await
|
|
640
|
+
const notifications = await _chunkH73GATCUjs.getOnChainNotifications.call(void 0,
|
|
641
641
|
userStorage,
|
|
642
642
|
bearerToken
|
|
643
643
|
).catch(() => []);
|
|
@@ -660,6 +660,10 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
660
660
|
this.update((state) => {
|
|
661
661
|
state.metamaskNotificationsList = metamaskNotifications;
|
|
662
662
|
});
|
|
663
|
+
this.messagingSystem.publish(
|
|
664
|
+
`${controllerName}:notificationsListUpdated`,
|
|
665
|
+
this.state.metamaskNotificationsList
|
|
666
|
+
);
|
|
663
667
|
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn).call(this, false);
|
|
664
668
|
return metamaskNotifications;
|
|
665
669
|
} catch (err) {
|
|
@@ -690,7 +694,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
690
694
|
onchainNotificationIds = onChainNotifications.map(
|
|
691
695
|
(notification) => notification.id
|
|
692
696
|
);
|
|
693
|
-
await
|
|
697
|
+
await _chunkH73GATCUjs.markNotificationsAsRead.call(void 0,
|
|
694
698
|
bearerToken,
|
|
695
699
|
onchainNotificationIds
|
|
696
700
|
).catch(() => {
|
|
@@ -722,6 +726,10 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
722
726
|
}
|
|
723
727
|
);
|
|
724
728
|
});
|
|
729
|
+
this.messagingSystem.publish(
|
|
730
|
+
`${controllerName}:markNotificationsAsRead`,
|
|
731
|
+
this.state.metamaskNotificationsList
|
|
732
|
+
);
|
|
725
733
|
}
|
|
726
734
|
/**
|
|
727
735
|
* Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.
|
|
@@ -745,6 +753,10 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
745
753
|
notification,
|
|
746
754
|
...state.metamaskNotificationsList
|
|
747
755
|
];
|
|
756
|
+
this.messagingSystem.publish(
|
|
757
|
+
`${controllerName}:notificationsListUpdated`,
|
|
758
|
+
state.metamaskNotificationsList
|
|
759
|
+
);
|
|
748
760
|
}
|
|
749
761
|
});
|
|
750
762
|
}
|
|
@@ -864,4 +876,4 @@ clearUpdatingAccountsState_fn = function(accounts) {
|
|
|
864
876
|
|
|
865
877
|
|
|
866
878
|
exports.defaultState = defaultState; exports.NotificationServicesController = NotificationServicesController;
|
|
867
|
-
//# sourceMappingURL=chunk-
|
|
879
|
+
//# sourceMappingURL=chunk-323GXNRE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AAYrC,OAAO,SAAS;AAuChB,IAAM,iBAAiB;AAwDvB,IAAM,WAA+D;AAAA,EACnE,0BAA0B;AAAA,IACxB,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,oCAAoC;AAAA,IAClC,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,+BAA+B;AAAA,IAC7B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,+BAA+B;AAAA,IAC7B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,2BAA2B;AAAA,IACzB,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,+BAA+B;AAAA,IAC7B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,iCAAiC;AAAA,IAC/B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,iCAAiC;AAAA,IAC/B,SAAS;AAAA,IACT,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A,EACrC,CAAC;AACH;AAQA;AAAA,iCAA4B,SAAC,UAAoB;AAC/C,OAAK,OAAO,CAAC,UAAU;AACrB,UAAM,iBAAiB,oBAAI,IAAI;AAAA,MAC7B,GAAG,MAAM;AAAA,MACT,GAAG;AAAA,IACL,CAAC;AACD,UAAM,yCAAyC,MAAM,KAAK,cAAc;AAAA,EAC1E,CAAC;AACH;AAOA;AAAA,gCAA2B,SAAC,UAAoB;AAC9C,OAAK,OAAO,CAAC,UAAU;AACrB,UAAM,yCACJ,MAAM,uCAAuC;AAAA,MAC3C,CAAC,oBAAoB,CAAC,SAAS,SAAS,eAAe;AAAA,IACzD;AAAA,EACJ,CAAC;AACH","sourcesContent":["import type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { toChecksumHexAddress } from '@metamask/controller-utils';\nimport type {\n KeyringControllerGetAccountsAction,\n KeyringControllerStateChangeEvent,\n KeyringControllerGetStateAction,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n} from '@metamask/keyring-controller';\nimport type {\n AuthenticationController,\n UserStorageController,\n} from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport { USER_STORAGE_VERSION_KEY } from './constants/constants';\nimport { TRIGGER_TYPES } from './constants/notification-schema';\nimport { safeProcessNotification } from './processors/process-notifications';\nimport * as FeatureNotifications from './services/feature-announcements';\nimport * as OnChainNotifications from './services/onchain-notifications';\nimport type {\n INotification,\n MarkAsReadNotificationsParam,\n NotificationUnion,\n} from './types/notification/notification';\nimport type { OnChainRawNotification } from './types/on-chain-notification/on-chain-notification';\nimport type { UserStorage } from './types/user-storage/user-storage';\nimport * as Utils from './utils/utils';\n\n// TODO: Fix Circular Type Dependencies\n// This indicates that control flow of messages is everywhere, lets orchestrate these better\nexport type NotificationServicesPushControllerEnablePushNotifications = {\n type: `NotificationServicesPushController:enablePushNotifications`;\n handler: (UUIDs: string[]) => Promise<void>;\n};\n\nexport type NotificationServicesPushControllerDisablePushNotifications = {\n type: `NotificationServicesPushController:disablePushNotifications`;\n handler: (UUIDs: string[]) => Promise<void>;\n};\n\nexport type NotificationServicesPushControllerUpdateTriggerPushNotifications = {\n type: `NotificationServicesPushController:updateTriggerPushNotifications`;\n handler: (UUIDs: string[]) => Promise<void>;\n};\n\nexport type NotificationServicesPushControllerOnNewNotification = {\n type: `NotificationServicesPushController:onNewNotifications`;\n payload: [INotification];\n};\n\n// Unique name for the controller\nconst controllerName = 'NotificationServicesController';\n\n/**\n * State shape for NotificationServicesController\n */\nexport type NotificationServicesControllerState = {\n /**\n * We store and manage accounts that have been seen/visted through the\n * account subscription. This allows us to track and add notifications for new accounts and not previous accounts added.\n */\n subscriptionAccountsSeen: string[];\n\n /**\n * Flag that indicates if the metamask notifications feature has been seen\n */\n isMetamaskNotificationsFeatureSeen: boolean;\n\n /**\n * Flag that indicates if the metamask notifications are enabled\n */\n isNotificationServicesEnabled: boolean;\n\n /**\n * Flag that indicates if the feature announcements are enabled\n */\n isFeatureAnnouncementsEnabled: boolean;\n\n /**\n * List of metamask notifications\n */\n metamaskNotificationsList: INotification[];\n\n /**\n * List of read metamask notifications\n */\n metamaskNotificationsReadList: string[];\n /**\n * Flag that indicates that the creating notifications is in progress\n */\n isUpdatingMetamaskNotifications: boolean;\n /**\n * Flag that indicates that the fetching notifications is in progress\n * This is used to show a loading spinner in the UI\n * when fetching notifications\n */\n isFetchingMetamaskNotifications: boolean;\n /**\n * Flag that indicates that the updating notifications for a specific address is in progress\n */\n isUpdatingMetamaskNotificationsAccount: string[];\n /**\n * Flag that indicates that the checking accounts presence is in progress\n */\n isCheckingAccountsPresence: boolean;\n};\n\nconst metadata: StateMetadata<NotificationServicesControllerState> = {\n subscriptionAccountsSeen: {\n persist: true,\n anonymous: true,\n },\n\n isMetamaskNotificationsFeatureSeen: {\n persist: true,\n anonymous: false,\n },\n isNotificationServicesEnabled: {\n persist: true,\n anonymous: false,\n },\n isFeatureAnnouncementsEnabled: {\n persist: true,\n anonymous: false,\n },\n metamaskNotificationsList: {\n persist: true,\n anonymous: true,\n },\n metamaskNotificationsReadList: {\n persist: true,\n anonymous: true,\n },\n isUpdatingMetamaskNotifications: {\n persist: false,\n anonymous: false,\n },\n isFetchingMetamaskNotifications: {\n persist: false,\n anonymous: false,\n },\n isUpdatingMetamaskNotificationsAccount: {\n persist: false,\n anonymous: false,\n },\n isCheckingAccountsPresence: {\n persist: false,\n anonymous: false,\n },\n};\nexport const defaultState: NotificationServicesControllerState = {\n subscriptionAccountsSeen: [],\n isMetamaskNotificationsFeatureSeen: false,\n isNotificationServicesEnabled: false,\n isFeatureAnnouncementsEnabled: false,\n metamaskNotificationsList: [],\n metamaskNotificationsReadList: [],\n isUpdatingMetamaskNotifications: false,\n isFetchingMetamaskNotifications: false,\n isUpdatingMetamaskNotificationsAccount: [],\n isCheckingAccountsPresence: false,\n};\n\nexport type NotificationServicesControllerUpdateMetamaskNotificationsList = {\n type: `${typeof controllerName}:updateMetamaskNotificationsList`;\n handler: NotificationServicesController['updateMetamaskNotificationsList'];\n};\n\nexport type NotificationServicesControllerDisableNotificationServices = {\n type: `${typeof controllerName}:disableNotificationServices`;\n handler: NotificationServicesController['disableNotificationServices'];\n};\n\nexport type NotificationServicesControllerSelectIsNotificationServicesEnabled =\n {\n type: `${typeof controllerName}:selectIsNotificationServicesEnabled`;\n handler: NotificationServicesController['selectIsNotificationServicesEnabled'];\n };\n\n// Messenger Actions\nexport type Actions =\n | NotificationServicesControllerUpdateMetamaskNotificationsList\n | NotificationServicesControllerDisableNotificationServices\n | NotificationServicesControllerSelectIsNotificationServicesEnabled\n | ControllerGetStateAction<'state', NotificationServicesControllerState>;\n\n// Allowed Actions\nexport type AllowedActions =\n // Keyring Controller Requests\n | KeyringControllerGetAccountsAction\n | KeyringControllerGetStateAction\n // Auth Controller Requests\n | AuthenticationController.AuthenticationControllerGetBearerToken\n | AuthenticationController.AuthenticationControllerIsSignedIn\n // User Storage Controller Requests\n | UserStorageController.UserStorageControllerEnableProfileSyncing\n | UserStorageController.UserStorageControllerGetStorageKey\n | UserStorageController.UserStorageControllerPerformGetStorage\n | UserStorageController.UserStorageControllerPerformSetStorage\n // Push Notifications Controller Requests\n | NotificationServicesPushControllerEnablePushNotifications\n | NotificationServicesPushControllerDisablePushNotifications\n | NotificationServicesPushControllerUpdateTriggerPushNotifications;\n\n// Events\nexport type NotificationServicesControllerChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n NotificationServicesControllerState\n >;\n\nexport type MetamaskNotificationsControllerNotificationsListUpdatedEvent = {\n type: `${typeof controllerName}:notificationsListUpdated`;\n payload: [INotification[]];\n};\n\nexport type MetamaskNotificationsControllerMarkNotificationsAsRead = {\n type: `${typeof controllerName}:markNotificationsAsRead`;\n payload: [INotification[]];\n};\n\n// Events\nexport type Events =\n | NotificationServicesControllerChangeEvent\n | MetamaskNotificationsControllerNotificationsListUpdatedEvent\n | MetamaskNotificationsControllerMarkNotificationsAsRead;\n\n// Allowed Events\nexport type AllowedEvents =\n // Keyring Events\n | KeyringControllerStateChangeEvent\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent\n // Push Notification Events\n | NotificationServicesPushControllerOnNewNotification;\n\n// Type for the messenger of NotificationServicesController\nexport type NotificationServicesControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n >;\n\ntype FeatureAnnouncementEnv = {\n spaceId: string;\n accessToken: string;\n platform: 'extension' | 'mobile';\n};\n\n/**\n * Controller that enables wallet notifications and feature announcements\n */\nexport default class NotificationServicesController extends BaseController<\n typeof controllerName,\n NotificationServicesControllerState,\n NotificationServicesControllerMessenger\n> {\n // Temporary boolean as push notifications are not yet enabled on mobile\n #isPushIntegrated = true;\n\n // Flag to check is notifications have been setup when the browser/extension is initialized.\n // We want to re-initialize push notifications when the browser/extension is refreshed\n // To ensure we subscribe to the most up-to-date notifications\n #isPushNotificationsSetup = false;\n\n #isUnlocked = false;\n\n #keyringController = {\n setupLockedStateSubscriptions: (onUnlock: () => Promise<void>) => {\n const { isUnlocked } = this.messagingSystem.call(\n 'KeyringController:getState',\n );\n this.#isUnlocked = isUnlocked;\n\n this.messagingSystem.subscribe('KeyringController:unlock', () => {\n this.#isUnlocked = true;\n // messaging system cannot await promises\n // we don't need to wait for a result on this.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n onUnlock();\n });\n\n this.messagingSystem.subscribe('KeyringController:lock', () => {\n this.#isUnlocked = false;\n });\n },\n };\n\n #auth = {\n getBearerToken: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n );\n },\n isSignedIn: () => {\n return this.messagingSystem.call('AuthenticationController:isSignedIn');\n },\n };\n\n #storage = {\n enableProfileSyncing: async () => {\n return await this.messagingSystem.call(\n 'UserStorageController:enableProfileSyncing',\n );\n },\n getStorageKey: () => {\n return this.messagingSystem.call('UserStorageController:getStorageKey');\n },\n getNotificationStorage: async () => {\n return await this.messagingSystem.call(\n 'UserStorageController:performGetStorage',\n 'notifications.notificationSettings',\n );\n },\n setNotificationStorage: async (state: string) => {\n return await this.messagingSystem.call(\n 'UserStorageController:performSetStorage',\n 'notifications.notificationSettings',\n state,\n );\n },\n };\n\n #pushNotifications = {\n enablePushNotifications: async (UUIDs: string[]) => {\n if (!this.#isPushIntegrated) {\n return;\n }\n try {\n await this.messagingSystem.call(\n 'NotificationServicesPushController:enablePushNotifications',\n UUIDs,\n );\n } catch (e) {\n log.error('Silently failed to enable push notifications', e);\n }\n },\n disablePushNotifications: async (UUIDs: string[]) => {\n if (!this.#isPushIntegrated) {\n return;\n }\n try {\n await this.messagingSystem.call(\n 'NotificationServicesPushController:disablePushNotifications',\n UUIDs,\n );\n } catch (e) {\n log.error('Silently failed to disable push notifications', e);\n }\n },\n updatePushNotifications: async (UUIDs: string[]) => {\n if (!this.#isPushIntegrated) {\n return;\n }\n try {\n await this.messagingSystem.call(\n 'NotificationServicesPushController:updateTriggerPushNotifications',\n UUIDs,\n );\n } catch (e) {\n log.error('Silently failed to update push notifications', e);\n }\n },\n subscribe: () => {\n if (!this.#isPushIntegrated) {\n return;\n }\n this.messagingSystem.subscribe(\n 'NotificationServicesPushController:onNewNotifications',\n (notification) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.updateMetamaskNotificationsList(notification);\n },\n );\n },\n initializePushNotifications: async () => {\n if (!this.#isPushIntegrated) {\n return;\n }\n if (!this.state.isNotificationServicesEnabled) {\n return;\n }\n if (this.#isPushNotificationsSetup) {\n return;\n }\n if (!this.#isUnlocked) {\n return;\n }\n\n const storage = await this.#getUserStorage();\n if (!storage) {\n return;\n }\n\n const uuids = Utils.getAllUUIDs(storage);\n await this.#pushNotifications.enablePushNotifications(uuids);\n this.#isPushNotificationsSetup = true;\n },\n };\n\n #accounts = {\n /**\n * Used to get list of addresses from keyring (wallet addresses)\n *\n * @returns addresses removed, added, and latest list of addresses\n */\n listAccounts: async () => {\n // Get previous and current account sets\n const nonChecksumAccounts = await this.messagingSystem.call(\n 'KeyringController:getAccounts',\n );\n const accounts = nonChecksumAccounts.map((a) => toChecksumHexAddress(a));\n const currentAccountsSet = new Set(accounts);\n const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);\n\n // Invalid value you cannot have zero accounts\n // Only occurs when the Accounts controller is initializing.\n if (accounts.length === 0) {\n return {\n accountsAdded: [],\n accountsRemoved: [],\n accounts: [],\n };\n }\n\n // Calculate added and removed addresses\n const accountsAdded = accounts.filter((a) => !prevAccountsSet.has(a));\n const accountsRemoved = [...prevAccountsSet.values()].filter(\n (a) => !currentAccountsSet.has(a),\n );\n\n // Update accounts seen\n this.update((state) => {\n state.subscriptionAccountsSeen = [...prevAccountsSet, ...accountsAdded];\n });\n\n return {\n accountsAdded,\n accountsRemoved,\n accounts,\n };\n },\n\n /**\n * Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.\n *\n * @returns result from list accounts\n */\n initialize: () => {\n return this.#accounts.listAccounts();\n },\n\n /**\n * Subscription to any state change in the keyring controller (aka wallet accounts).\n * We can call the `listAccounts` defined above to find out about any accounts added, removed\n * And call effects to subscribe/unsubscribe to notifications.\n */\n subscribe: () => {\n this.messagingSystem.subscribe(\n 'KeyringController:stateChange',\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async () => {\n if (!this.state.isNotificationServicesEnabled) {\n return;\n }\n\n const { accountsAdded, accountsRemoved } =\n await this.#accounts.listAccounts();\n\n const promises: Promise<unknown>[] = [];\n if (accountsAdded.length > 0) {\n promises.push(this.updateOnChainTriggersByAccount(accountsAdded));\n }\n if (accountsRemoved.length > 0) {\n promises.push(this.deleteOnChainTriggersByAccount(accountsRemoved));\n }\n await Promise.all(promises);\n },\n );\n },\n };\n\n #featureAnnouncementEnv: FeatureAnnouncementEnv;\n\n /**\n * Creates a NotificationServicesController instance.\n *\n * @param args - The arguments to this function.\n * @param args.messenger - Messenger used to communicate with BaseV2 controller.\n * @param args.state - Initial state to set on this controller.\n * @param args.env - environment variables for a given controller.\n * @param args.env.featureAnnouncements - env variables for feature announcements.\n * @param args.env.isPushIntegrated - toggle push notifications on/off if client has integrated them.\n */\n constructor({\n messenger,\n state,\n env,\n }: {\n messenger: NotificationServicesControllerMessenger;\n state?: Partial<NotificationServicesControllerState>;\n env: {\n featureAnnouncements: FeatureAnnouncementEnv;\n isPushIntegrated?: boolean;\n };\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#isPushIntegrated = env.isPushIntegrated ?? true;\n this.#featureAnnouncementEnv = env.featureAnnouncements;\n this.#registerMessageHandlers();\n this.#clearLoadingStates();\n\n this.#keyringController.setupLockedStateSubscriptions(\n this.#pushNotifications.initializePushNotifications,\n );\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.#accounts.initialize();\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.#pushNotifications.initializePushNotifications();\n this.#accounts.subscribe();\n this.#pushNotifications.subscribe();\n }\n\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n `${controllerName}:updateMetamaskNotificationsList`,\n this.updateMetamaskNotificationsList.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${controllerName}:disableNotificationServices`,\n this.disableNotificationServices.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${controllerName}:selectIsNotificationServicesEnabled`,\n this.selectIsNotificationServicesEnabled.bind(this),\n );\n }\n\n #clearLoadingStates(): void {\n this.update((state) => {\n state.isUpdatingMetamaskNotifications = false;\n state.isCheckingAccountsPresence = false;\n state.isFetchingMetamaskNotifications = false;\n state.isUpdatingMetamaskNotificationsAccount = [];\n });\n }\n\n #assertAuthEnabled() {\n if (!this.#auth.isSignedIn()) {\n this.update((state) => {\n state.isNotificationServicesEnabled = false;\n });\n throw new Error('User is not signed in.');\n }\n }\n\n async #getValidStorageKeyAndBearerToken() {\n this.#assertAuthEnabled();\n\n const bearerToken = await this.#auth.getBearerToken();\n const storageKey = await this.#storage.getStorageKey();\n\n if (!bearerToken || !storageKey) {\n throw new Error('Missing BearerToken or storage key');\n }\n\n return { bearerToken, storageKey };\n }\n\n #performEnableProfileSyncing = async () => {\n try {\n await this.#storage.enableProfileSyncing();\n } catch (e) {\n log.error('Failed to enable profile syncing', e);\n throw new Error('Failed to enable profile syncing');\n }\n };\n\n #assertUserStorage(\n storage: UserStorage | null,\n ): asserts storage is UserStorage {\n if (!storage) {\n throw new Error('User Storage does not exist');\n }\n }\n\n /**\n * Retrieves and parses the user storage from the storage key.\n *\n * This method attempts to retrieve the user storage using the specified storage key,\n * then parses the JSON string to an object. If the storage is not found or cannot be parsed,\n * it throws an error.\n *\n * @returns The parsed user storage object or null\n */\n async #getUserStorage(): Promise<UserStorage | null> {\n const userStorageString: string | null =\n await this.#storage.getNotificationStorage();\n\n if (!userStorageString) {\n return null;\n }\n\n try {\n const userStorage: UserStorage = JSON.parse(userStorageString);\n return userStorage;\n } catch (error) {\n log.error('Unable to parse User Storage');\n return null;\n }\n }\n\n /**\n * Retrieves the current enabled state of MetaMask notifications.\n *\n * This method directly returns the boolean value of `isMetamaskNotificationsEnabled`\n * from the controller's state, indicating whether MetaMask notifications are currently enabled.\n *\n * @returns The enabled state of MetaMask notifications.\n */\n public selectIsNotificationServicesEnabled(): boolean {\n return this.state.isNotificationServicesEnabled;\n }\n\n /**\n * Sets the state of notification creation process.\n *\n * This method updates the `isUpdatingMetamaskNotifications` state, which can be used to indicate\n * whether the notification creation process is currently active or not. This is useful\n * for UI elements that need to reflect the state of ongoing operations, such as loading\n * indicators or disabled buttons during processing.\n *\n * @param isUpdatingMetamaskNotifications - A boolean value representing the new state of the notification creation process.\n */\n #setIsUpdatingMetamaskNotifications(\n isUpdatingMetamaskNotifications: boolean,\n ) {\n this.update((state) => {\n state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;\n });\n }\n\n /**\n * Updates the state to indicate whether fetching of MetaMask notifications is in progress.\n *\n * This method is used to set the `isFetchingMetamaskNotifications` state, which can be utilized\n * to show or hide loading indicators in the UI when notifications are being fetched.\n *\n * @param isFetchingMetamaskNotifications - A boolean value representing the fetching state.\n */\n #setIsFetchingMetamaskNotifications(\n isFetchingMetamaskNotifications: boolean,\n ) {\n this.update((state) => {\n state.isFetchingMetamaskNotifications = isFetchingMetamaskNotifications;\n });\n }\n\n /**\n * Updates the state to indicate that the checking of accounts presence is in progress.\n *\n * This method modifies the `isCheckingAccountsPresence` state, which can be used to manage UI elements\n * that depend on the status of account presence checks, such as displaying loading indicators or disabling\n * buttons while the check is ongoing.\n *\n * @param isCheckingAccountsPresence - A boolean value indicating whether the account presence check is currently active.\n */\n #setIsCheckingAccountsPresence(isCheckingAccountsPresence: boolean) {\n this.update((state) => {\n state.isCheckingAccountsPresence = isCheckingAccountsPresence;\n });\n }\n\n /**\n * Updates the state to indicate that account updates are in progress.\n * Removes duplicate accounts before updating the state.\n *\n * @param accounts - The accounts being updated.\n */\n #updateUpdatingAccountsState(accounts: string[]) {\n this.update((state) => {\n const uniqueAccounts = new Set([\n ...state.isUpdatingMetamaskNotificationsAccount,\n ...accounts,\n ]);\n state.isUpdatingMetamaskNotificationsAccount = Array.from(uniqueAccounts);\n });\n }\n\n /**\n * Clears the state indicating that account updates are complete.\n *\n * @param accounts - The accounts that have finished updating.\n */\n #clearUpdatingAccountsState(accounts: string[]) {\n this.update((state) => {\n state.isUpdatingMetamaskNotificationsAccount =\n state.isUpdatingMetamaskNotificationsAccount.filter(\n (existingAccount) => !accounts.includes(existingAccount),\n );\n });\n }\n\n public async checkAccountsPresence(\n accounts: string[],\n ): Promise<Record<string, boolean>> {\n try {\n this.#setIsCheckingAccountsPresence(true);\n\n // Retrieve user storage\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n\n const presence = Utils.checkAccountsPresence(userStorage, accounts);\n return presence;\n } catch (error) {\n log.error('Failed to check accounts presence', error);\n throw error;\n } finally {\n this.#setIsCheckingAccountsPresence(false);\n }\n }\n\n /**\n * Sets the enabled state of feature announcements.\n *\n * **Action** - used in the notification settings to enable/disable feature announcements.\n *\n * @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements.\n * @async\n * @throws {Error} If fails to update\n */\n public async setFeatureAnnouncementsEnabled(\n featureAnnouncementsEnabled: boolean,\n ) {\n try {\n this.update((s) => {\n s.isFeatureAnnouncementsEnabled = featureAnnouncementsEnabled;\n });\n } catch (e) {\n log.error('Unable to toggle feature announcements', e);\n throw new Error('Unable to toggle feature announcements');\n }\n }\n\n /**\n * This creates/re-creates on-chain triggers defined in User Storage.\n *\n * **Action** - Used during Sign In / Enabling of notifications.\n *\n * @returns The updated or newly created user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async createOnChainTriggers(): Promise<UserStorage> {\n try {\n this.#setIsUpdatingMetamaskNotifications(true);\n\n await this.#performEnableProfileSyncing();\n\n const { bearerToken, storageKey } =\n await this.#getValidStorageKeyAndBearerToken();\n\n const { accounts } = await this.#accounts.listAccounts();\n\n let userStorage = await this.#getUserStorage();\n\n // If userStorage does not exist, create a new one\n // All the triggers created are set as: \"disabled\"\n if (userStorage?.[USER_STORAGE_VERSION_KEY] === undefined) {\n userStorage = Utils.initializeUserStorage(\n accounts.map((account) => ({ address: account })),\n false,\n );\n\n // Write the userStorage\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n }\n\n // Create the triggers\n const triggers = Utils.traverseUserStorageTriggers(userStorage);\n await OnChainNotifications.createOnChainTriggers(\n userStorage,\n storageKey,\n bearerToken,\n triggers,\n );\n\n // Create push notifications triggers\n const allUUIDS = Utils.getAllUUIDs(userStorage);\n await this.#pushNotifications.enablePushNotifications(allUUIDS);\n\n // Write the new userStorage (triggers are now \"enabled\")\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n\n // Update the state of the controller\n this.update((state) => {\n state.isNotificationServicesEnabled = true;\n state.isFeatureAnnouncementsEnabled = true;\n state.isMetamaskNotificationsFeatureSeen = true;\n });\n\n return userStorage;\n } catch (err) {\n log.error('Failed to create On Chain triggers', err);\n throw new Error('Failed to create On Chain triggers');\n } finally {\n this.#setIsUpdatingMetamaskNotifications(false);\n }\n }\n\n /**\n * Enables all MetaMask notifications for the user.\n * This is identical flow when initializing notifications for the first time.\n * 1. Enable Profile Syncing\n * 2. Get or Create Notification User Storage\n * 3. Upsert Triggers\n * 4. Update Push notifications\n *\n * @throws {Error} If there is an error during the process of enabling notifications.\n */\n public async enableMetamaskNotifications() {\n try {\n this.#setIsUpdatingMetamaskNotifications(true);\n await this.createOnChainTriggers();\n } catch (e) {\n log.error('Unable to enable notifications', e);\n throw new Error('Unable to enable notifications');\n } finally {\n this.#setIsUpdatingMetamaskNotifications(false);\n }\n }\n\n /**\n * Disables all MetaMask notifications for the user.\n * This method ensures that the user is authenticated, retrieves all linked accounts,\n * and disables on-chain triggers for each account. It also sets the global notification\n * settings for MetaMask, feature announcements to false.\n *\n * @throws {Error} If the user is not authenticated or if there is an error during the process.\n */\n public async disableNotificationServices() {\n try {\n this.#setIsUpdatingMetamaskNotifications(true);\n\n // Disable Push Notifications\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n const UUIDs = Utils.getAllUUIDs(userStorage);\n await this.#pushNotifications.disablePushNotifications(UUIDs);\n\n // Clear Notification States (toggles and list)\n this.update((state) => {\n state.isNotificationServicesEnabled = false;\n state.isFeatureAnnouncementsEnabled = false;\n state.metamaskNotificationsList = [];\n });\n } catch (e) {\n log.error('Unable to disable notifications', e);\n throw new Error('Unable to disable notifications');\n } finally {\n this.#setIsUpdatingMetamaskNotifications(false);\n }\n }\n\n /**\n * Deletes on-chain triggers associated with a specific account.\n * This method performs several key operations:\n * 1. Validates Auth & Storage\n * 2. Finds and deletes all triggers associated with the account\n * 3. Disables any related push notifications\n * 4. Updates Storage to reflect new state.\n *\n * **Action** - When a user disables notifications for a given account in settings.\n *\n * @param accounts - The account for which on-chain triggers are to be deleted.\n * @returns A promise that resolves to void or an object containing a success message.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async deleteOnChainTriggersByAccount(\n accounts: string[],\n ): Promise<UserStorage> {\n try {\n this.#updateUpdatingAccountsState(accounts);\n // Get and Validate BearerToken and User Storage Key\n const { bearerToken, storageKey } =\n await this.#getValidStorageKeyAndBearerToken();\n\n // Get & Validate User Storage\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n\n // Get the UUIDs to delete\n const UUIDs = accounts\n .map((a) => Utils.getUUIDsForAccount(userStorage, a.toLowerCase()))\n .flat();\n\n if (UUIDs.length === 0) {\n return userStorage;\n }\n\n // Delete these UUIDs (Mutates User Storage)\n await OnChainNotifications.deleteOnChainTriggers(\n userStorage,\n storageKey,\n bearerToken,\n UUIDs,\n );\n\n // Delete these UUIDs from the push notifications\n await this.#pushNotifications.disablePushNotifications(UUIDs);\n\n // Update User Storage\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n return userStorage;\n } catch (err) {\n log.error('Failed to delete OnChain triggers', err);\n throw new Error('Failed to delete OnChain triggers');\n } finally {\n this.#clearUpdatingAccountsState(accounts);\n }\n }\n\n /**\n * Updates/Creates on-chain triggers for a specific account.\n *\n * This method performs several key operations:\n * 1. Validates Auth & Storage\n * 2. Finds and creates any missing triggers associated with the account\n * 3. Enables any related push notifications\n * 4. Updates Storage to reflect new state.\n *\n * **Action** - When a user enables notifications for an account\n *\n * @param accounts - List of accounts you want to update.\n * @returns A promise that resolves to the updated user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async updateOnChainTriggersByAccount(\n accounts: string[],\n ): Promise<UserStorage> {\n try {\n this.#updateUpdatingAccountsState(accounts);\n // Get and Validate BearerToken and User Storage Key\n const { bearerToken, storageKey } =\n await this.#getValidStorageKeyAndBearerToken();\n\n // Get & Validate User Storage\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n\n // Add any missing triggers\n accounts.forEach((a) => Utils.upsertAddressTriggers(a, userStorage));\n\n const newTriggers = Utils.traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (!t.enabled) {\n return t;\n }\n return undefined;\n },\n });\n\n // Create any missing triggers.\n if (newTriggers.length > 0) {\n // Write te updated userStorage (where triggers are disabled)\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n\n // Create the triggers\n const triggers = Utils.traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (\n accounts.some((a) => a.toLowerCase() === t.address.toLowerCase())\n ) {\n return t;\n }\n return undefined;\n },\n });\n await OnChainNotifications.createOnChainTriggers(\n userStorage,\n storageKey,\n bearerToken,\n triggers,\n );\n }\n\n // Update Push Notifications Triggers\n const UUIDs = Utils.getAllUUIDs(userStorage);\n await this.#pushNotifications.updatePushNotifications(UUIDs);\n\n // Update the userStorage (where triggers are enabled)\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n return userStorage;\n } catch (err) {\n log.error('Failed to update OnChain triggers', err);\n throw new Error('Failed to update OnChain triggers');\n } finally {\n this.#clearUpdatingAccountsState(accounts);\n }\n }\n\n /**\n * Fetches the list of metamask notifications.\n * This includes OnChain notifications and Feature Announcements.\n *\n * **Action** - When a user views the notification list page/dropdown\n *\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async fetchAndUpdateMetamaskNotifications(): Promise<INotification[]> {\n try {\n this.#setIsFetchingMetamaskNotifications(true);\n\n // Raw Feature Notifications\n const rawFeatureAnnouncementNotifications = this.state\n .isFeatureAnnouncementsEnabled\n ? await FeatureNotifications.getFeatureAnnouncementNotifications(\n this.#featureAnnouncementEnv,\n ).catch(() => [])\n : [];\n\n // Raw On Chain Notifications\n const rawOnChainNotifications: OnChainRawNotification[] = [];\n const userStorage = await this.#storage\n .getNotificationStorage()\n .then((s) => s && (JSON.parse(s) as UserStorage))\n .catch(() => null);\n const bearerToken = await this.#auth.getBearerToken().catch(() => null);\n if (userStorage && bearerToken) {\n const notifications =\n await OnChainNotifications.getOnChainNotifications(\n userStorage,\n bearerToken,\n ).catch(() => []);\n\n rawOnChainNotifications.push(...notifications);\n }\n\n const readIds = this.state.metamaskNotificationsReadList;\n\n // Combined Notifications\n const isNotUndefined = <Item>(t?: Item): t is Item => Boolean(t);\n const processAndFilter = (ns: NotificationUnion[]) =>\n ns\n .map((n) => safeProcessNotification(n, readIds))\n .filter(isNotUndefined);\n\n const featureAnnouncementNotifications = processAndFilter(\n rawFeatureAnnouncementNotifications,\n );\n const onChainNotifications = processAndFilter(rawOnChainNotifications);\n\n const metamaskNotifications: INotification[] = [\n ...featureAnnouncementNotifications,\n ...onChainNotifications,\n ];\n metamaskNotifications.sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),\n );\n\n // Update State\n this.update((state) => {\n state.metamaskNotificationsList = metamaskNotifications;\n });\n\n this.messagingSystem.publish(\n `${controllerName}:notificationsListUpdated`,\n this.state.metamaskNotificationsList,\n );\n\n this.#setIsFetchingMetamaskNotifications(false);\n return metamaskNotifications;\n } catch (err) {\n this.#setIsFetchingMetamaskNotifications(false);\n log.error('Failed to fetch notifications', err);\n throw new Error('Failed to fetch notifications');\n }\n }\n\n /**\n * Marks specified metamask notifications as read.\n *\n * @param notifications - An array of notifications to be marked as read. Each notification should include its type and read status.\n * @returns A promise that resolves when the operation is complete.\n */\n public async markMetamaskNotificationsAsRead(\n notifications: MarkAsReadNotificationsParam,\n ): Promise<void> {\n let onchainNotificationIds: string[] = [];\n let featureAnnouncementNotificationIds: string[] = [];\n\n try {\n // Filter unread on/off chain notifications\n const onChainNotifications = notifications.filter(\n (notification) =>\n notification.type !== TRIGGER_TYPES.FEATURES_ANNOUNCEMENT &&\n !notification.isRead,\n );\n\n const featureAnnouncementNotifications = notifications.filter(\n (notification) =>\n notification.type === TRIGGER_TYPES.FEATURES_ANNOUNCEMENT &&\n !notification.isRead,\n );\n\n // Mark On-Chain Notifications as Read\n if (onChainNotifications.length > 0) {\n const bearerToken = await this.#auth.getBearerToken();\n\n if (bearerToken) {\n onchainNotificationIds = onChainNotifications.map(\n (notification) => notification.id,\n );\n await OnChainNotifications.markNotificationsAsRead(\n bearerToken,\n onchainNotificationIds,\n ).catch(() => {\n onchainNotificationIds = [];\n log.warn('Unable to mark onchain notifications as read');\n });\n }\n }\n\n // Mark Off-Chain notifications as Read\n if (featureAnnouncementNotifications.length > 0) {\n featureAnnouncementNotificationIds =\n featureAnnouncementNotifications.map(\n (notification) => notification.id,\n );\n }\n } catch (err) {\n log.warn('Something failed when marking notifications as read', err);\n }\n\n // Update the state (state is also used on counter & badge)\n this.update((state) => {\n const currentReadList = state.metamaskNotificationsReadList;\n const newReadIds = [...featureAnnouncementNotificationIds];\n state.metamaskNotificationsReadList = [\n ...new Set([...currentReadList, ...newReadIds]),\n ];\n\n state.metamaskNotificationsList = state.metamaskNotificationsList.map(\n (notification: INotification) => {\n if (\n newReadIds.includes(notification.id) ||\n onchainNotificationIds.includes(notification.id)\n ) {\n return { ...notification, isRead: true };\n }\n return notification;\n },\n );\n });\n\n this.messagingSystem.publish(\n `${controllerName}:markNotificationsAsRead`,\n this.state.metamaskNotificationsList,\n );\n }\n\n /**\n * Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.\n * This method ensures that the most recent notification is displayed first in the UI.\n *\n * @param notification - The new notification object to be added to the list.\n * @returns A promise that resolves when the notification list has been successfully updated.\n */\n public async updateMetamaskNotificationsList(\n notification: INotification,\n ): Promise<void> {\n if (\n this.state.metamaskNotificationsList.some((n) => n.id === notification.id)\n ) {\n return;\n }\n\n const processedNotification = safeProcessNotification(notification);\n\n if (processedNotification) {\n this.update((state) => {\n const existingNotificationIds = new Set(\n state.metamaskNotificationsList.map((n) => n.id),\n );\n // Add the new notification only if its ID is not already present in the list\n if (!existingNotificationIds.has(notification.id)) {\n state.metamaskNotificationsList = [\n notification,\n ...state.metamaskNotificationsList,\n ];\n this.messagingSystem.publish(\n `${controllerName}:notificationsListUpdated`,\n state.metamaskNotificationsList,\n );\n }\n });\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkGDKHOBJTjs = require('./chunk-GDKHOBJT.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkB25TJ7KSjs = require('./chunk-B25TJ7KS.js');
|
|
@@ -126,11 +126,11 @@ async function updateTriggerPushNotifications(params) {
|
|
|
126
126
|
}
|
|
127
127
|
async function listenToPushNotifications(params) {
|
|
128
128
|
const { env, listenToPushReceived, listenToPushClicked } = params;
|
|
129
|
-
const unsubscribePushNotifications = await
|
|
129
|
+
const unsubscribePushNotifications = await _chunkGDKHOBJTjs.listenToPushNotificationsReceived.call(void 0,
|
|
130
130
|
env,
|
|
131
131
|
listenToPushReceived
|
|
132
132
|
);
|
|
133
|
-
const unsubscribeNotificationClicks =
|
|
133
|
+
const unsubscribeNotificationClicks = _chunkGDKHOBJTjs.listenToPushNotificationsClicked.call(void 0, listenToPushClicked);
|
|
134
134
|
const unsubscribe = () => {
|
|
135
135
|
unsubscribePushNotifications();
|
|
136
136
|
unsubscribeNotificationClicks();
|
|
@@ -146,4 +146,4 @@ async function listenToPushNotifications(params) {
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
exports.getPushNotificationLinks = getPushNotificationLinks; exports.updateLinksAPI = updateLinksAPI; exports.activatePushNotifications = activatePushNotifications; exports.deactivatePushNotifications = deactivatePushNotifications; exports.updateTriggerPushNotifications = updateTriggerPushNotifications; exports.listenToPushNotifications = listenToPushNotifications;
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
149
|
+
//# sourceMappingURL=chunk-4HOEZMSV.js.map
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk4HOEZMSVjs = require('./chunk-4HOEZMSV.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkGDKHOBJTjs = require('./chunk-GDKHOBJT.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -67,17 +67,17 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
67
67
|
}
|
|
68
68
|
const bearerToken = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
|
|
69
69
|
try {
|
|
70
|
-
const regToken = await
|
|
70
|
+
const regToken = await _chunk4HOEZMSVjs.activatePushNotifications.call(void 0, {
|
|
71
71
|
bearerToken,
|
|
72
72
|
triggers: UUIDs,
|
|
73
73
|
env: _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _env),
|
|
74
|
-
createRegToken:
|
|
74
|
+
createRegToken: _chunkGDKHOBJTjs.createRegToken,
|
|
75
75
|
platform: _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _config).platform
|
|
76
76
|
});
|
|
77
77
|
if (!regToken) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
_chunkIGY2S5BCjs.__privateSet.call(void 0, this, _pushListenerUnsubscribe, await
|
|
80
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushListenerUnsubscribe) ?? _chunkIGY2S5BCjs.__privateSet.call(void 0, this, _pushListenerUnsubscribe, await _chunk4HOEZMSVjs.listenToPushNotifications.call(void 0, {
|
|
81
81
|
env: _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _env),
|
|
82
82
|
listenToPushReceived: async (n) => {
|
|
83
83
|
this.messagingSystem.publish(
|
|
@@ -121,11 +121,11 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
121
121
|
const bearerToken = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
|
|
122
122
|
let isPushNotificationsDisabled;
|
|
123
123
|
try {
|
|
124
|
-
isPushNotificationsDisabled = await
|
|
124
|
+
isPushNotificationsDisabled = await _chunk4HOEZMSVjs.deactivatePushNotifications.call(void 0, {
|
|
125
125
|
bearerToken,
|
|
126
126
|
triggers: UUIDs,
|
|
127
127
|
env: _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _env),
|
|
128
|
-
deleteRegToken:
|
|
128
|
+
deleteRegToken: _chunkGDKHOBJTjs.deleteRegToken,
|
|
129
129
|
regToken: this.state.fcmToken
|
|
130
130
|
});
|
|
131
131
|
} catch (error) {
|
|
@@ -156,12 +156,12 @@ var NotificationServicesPushController = class extends _basecontroller.BaseContr
|
|
|
156
156
|
}
|
|
157
157
|
const bearerToken = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
|
|
158
158
|
try {
|
|
159
|
-
const { fcmToken } = await
|
|
159
|
+
const { fcmToken } = await _chunk4HOEZMSVjs.updateTriggerPushNotifications.call(void 0, {
|
|
160
160
|
bearerToken,
|
|
161
161
|
triggers: UUIDs,
|
|
162
162
|
env: _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _env),
|
|
163
|
-
createRegToken:
|
|
164
|
-
deleteRegToken:
|
|
163
|
+
createRegToken: _chunkGDKHOBJTjs.createRegToken,
|
|
164
|
+
deleteRegToken: _chunkGDKHOBJTjs.deleteRegToken,
|
|
165
165
|
platform: _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _config).platform,
|
|
166
166
|
regToken: this.state.fcmToken
|
|
167
167
|
});
|
|
@@ -213,4 +213,4 @@ getAndAssertBearerToken_fn = async function() {
|
|
|
213
213
|
|
|
214
214
|
|
|
215
215
|
exports.defaultState = defaultState; exports.NotificationServicesPushController = NotificationServicesPushController;
|
|
216
|
-
//# sourceMappingURL=chunk-
|
|
216
|
+
//# sourceMappingURL=chunk-6GXEFQ64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/NotificationServicesPushController/NotificationServicesPushController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAIA,SAAS,sBAAsB;AAE/B,OAAO,SAAS;AAYhB,IAAM,iBAAiB;AAqDhB,IAAM,eAAwD;AAAA,EACnE,UAAU;AACZ;AACA,IAAM,WAAW;AAAA,EACf,UAAU;AAAA,IACR,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;AA/EA;AAwHA,IAAqB,qCAArB,cAAgE,eAI9D;AAAA,EAOA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,IACrC,CAAC;AAQH;AAeA,u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A,OAAK,gBAAgB;AAAA,IACnB;AAAA,IACA,KAAK,yBAAyB,KAAK,IAAI;AAAA,EACzC;AACA,OAAK,gBAAgB;AAAA,IACnB;AAAA,IACA,KAAK,+BAA+B,KAAK,IAAI;AAAA,EAC/C;AACF;AAEM;AAAA,6BAAwB,iBAAG;AAC/B,QAAM,cAAc,MAAM,KAAK,gBAAgB;AAAA,IAC7C;AAAA,EACF;AACA,MAAI,CAAC,aAAa;AAChB,QAAI;AAAA,MACF;AAAA,IACF;AACA,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AAEA,SAAO;AACT","sourcesContent":["import type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport type { Types } from '../NotificationServicesController';\nimport { createRegToken, deleteRegToken } from './services/push/push-web';\nimport {\n activatePushNotifications,\n deactivatePushNotifications,\n listenToPushNotifications,\n updateTriggerPushNotifications,\n} from './services/services';\nimport type { PushNotificationEnv } from './types';\n\nconst controllerName = 'NotificationServicesPushController';\n\nexport type NotificationServicesPushControllerState = {\n fcmToken: string;\n};\n\nexport type NotificationServicesPushControllerEnablePushNotificationsAction = {\n type: `${typeof controllerName}:enablePushNotifications`;\n handler: NotificationServicesPushController['enablePushNotifications'];\n};\n\nexport type NotificationServicesPushControllerDisablePushNotificationsAction = {\n type: `${typeof controllerName}:disablePushNotifications`;\n handler: NotificationServicesPushController['disablePushNotifications'];\n};\nexport type NotificationServicesPushControllerUpdateTriggerPushNotificationsAction =\n {\n type: `${typeof controllerName}:updateTriggerPushNotifications`;\n handler: NotificationServicesPushController['updateTriggerPushNotifications'];\n };\n\nexport type Actions =\n | NotificationServicesPushControllerEnablePushNotificationsAction\n | NotificationServicesPushControllerDisablePushNotificationsAction\n | NotificationServicesPushControllerUpdateTriggerPushNotificationsAction\n | ControllerGetStateAction<'state', NotificationServicesPushControllerState>;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type NotificationServicesPushControllerOnNewNotificationEvent = {\n type: `${typeof controllerName}:onNewNotifications`;\n payload: [Types.INotification];\n};\n\nexport type NotificationServicesPushControllerPushNotificationClicked = {\n type: `${typeof controllerName}:pushNotificationClicked`;\n payload: [Types.INotification];\n};\n\nexport type AllowedEvents =\n | NotificationServicesPushControllerOnNewNotificationEvent\n | NotificationServicesPushControllerPushNotificationClicked;\n\nexport type NotificationServicesPushControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n >;\n\nexport const defaultState: NotificationServicesPushControllerState = {\n fcmToken: '',\n};\nconst metadata = {\n fcmToken: {\n persist: true,\n anonymous: true,\n },\n};\n\ntype ControllerConfig = {\n /**\n * Config to turn on/off push notifications.\n * This is currently linked to MV3 builds on extension.\n */\n isPushEnabled: boolean;\n\n /**\n * Must handle when a push notification is received.\n * You must call `registration.showNotification` or equivalent to show the notification on web/mobile\n */\n onPushNotificationReceived: (\n notification: Types.INotification,\n ) => void | Promise<void>;\n\n /**\n * Must handle when a push notification is clicked.\n * You must call `event.notification.close();` or equivalent for closing and opening notification in a new window.\n */\n onPushNotificationClicked: (\n event: NotificationEvent,\n notification?: Types.INotification,\n ) => void;\n\n /**\n * determine the config used for push notification services\n */\n platform: 'extension' | 'mobile';\n};\n\n/**\n * Manages push notifications for the application, including enabling, disabling, and updating triggers for push notifications.\n * This controller integrates with Firebase Cloud Messaging (FCM) to handle the registration and management of push notifications.\n * It is responsible for registering and unregistering the service worker that listens for push notifications,\n * managing the FCM token, and communicating with the server to register or unregister the device for push notifications.\n * Additionally, it provides functionality to update the server with new UUIDs that should trigger push notifications.\n *\n * @augments {BaseController<typeof controllerName, NotificationServicesPushControllerState, NotificationServicesPushControllerMessenger>}\n */\nexport default class NotificationServicesPushController extends BaseController<\n typeof controllerName,\n NotificationServicesPushControllerState,\n NotificationServicesPushControllerMessenger\n> {\n #pushListenerUnsubscribe: (() => void) | undefined = undefined;\n\n #env: PushNotificationEnv;\n\n #config: ControllerConfig;\n\n constructor({\n messenger,\n state,\n env,\n config,\n }: {\n messenger: NotificationServicesPushControllerMessenger;\n state: NotificationServicesPushControllerState;\n env: PushNotificationEnv;\n config: ControllerConfig;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#env = env;\n this.#config = config;\n\n this.#registerMessageHandlers();\n }\n\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:enablePushNotifications',\n this.enablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:disablePushNotifications',\n this.disablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:updateTriggerPushNotifications',\n this.updateTriggerPushNotifications.bind(this),\n );\n }\n\n async #getAndAssertBearerToken() {\n const bearerToken = await this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n );\n if (!bearerToken) {\n log.error(\n 'Failed to enable push notifications: BearerToken token is missing.',\n );\n throw new Error('BearerToken token is missing');\n }\n\n return bearerToken;\n }\n\n /**\n * Enables push notifications for the application.\n *\n * This method sets up the necessary infrastructure for handling push notifications by:\n * 1. Registering the service worker to listen for messages.\n * 2. Fetching the Firebase Cloud Messaging (FCM) token from Firebase.\n * 3. Sending the FCM token to the server responsible for sending notifications, to register the device.\n *\n * @param UUIDs - An array of UUIDs to enable push notifications for.\n */\n async enablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n\n try {\n // Activate Push Notifications\n const regToken = await activatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n platform: this.#config.platform,\n });\n\n if (!regToken) {\n return;\n }\n\n this.#pushListenerUnsubscribe ??= await listenToPushNotifications({\n env: this.#env,\n listenToPushReceived: async (n) => {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:onNewNotifications',\n n,\n );\n await this.#config.onPushNotificationReceived(n);\n },\n listenToPushClicked: (e, n) => {\n if (n) {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:pushNotificationClicked',\n n,\n );\n }\n\n this.#config.onPushNotificationClicked(e);\n },\n });\n\n // Update state\n this.update((state) => {\n state.fcmToken = regToken;\n });\n } catch (error) {\n log.error('Failed to enable push notifications:', error);\n throw new Error('Failed to enable push notifications');\n }\n }\n\n /**\n * Disables push notifications for the application.\n * This method handles the process of disabling push notifications by:\n * 1. Unregistering the service worker to stop listening for messages.\n * 2. Sending a request to the server to unregister the device using the FCM token.\n * 3. Removing the FCM token from the state to complete the process.\n *\n * @param UUIDs - An array of UUIDs for which push notifications should be disabled.\n */\n async disablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n let isPushNotificationsDisabled: boolean;\n\n try {\n // Send a request to the server to unregister the token/device\n isPushNotificationsDisabled = await deactivatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n deleteRegToken,\n regToken: this.state.fcmToken,\n });\n } catch (error) {\n const errorMessage = `Failed to disable push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n // Remove the FCM token from the state\n if (!isPushNotificationsDisabled) {\n return;\n }\n\n // Unsubscribe from push notifications\n this.#pushListenerUnsubscribe?.();\n\n // Update State\n if (isPushNotificationsDisabled) {\n this.update((state) => {\n state.fcmToken = '';\n });\n }\n }\n\n /**\n * Updates the triggers for push notifications.\n * This method is responsible for updating the server with the new set of UUIDs that should trigger push notifications.\n * It uses the current FCM token and a BearerToken for authentication.\n *\n * @param UUIDs - An array of UUIDs that should trigger push notifications.\n */\n async updateTriggerPushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n\n try {\n const { fcmToken } = await updateTriggerPushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n deleteRegToken,\n platform: this.#config.platform,\n regToken: this.state.fcmToken,\n });\n\n // update the state with the new FCM token\n if (fcmToken) {\n this.update((state) => {\n state.fcmToken = fcmToken;\n });\n }\n } catch (error) {\n const errorMessage = `Failed to update triggers for push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/to-raw-notification.ts"],"sourcesContent":["import type {\n OnChainRawNotification,\n UnprocessedOnChainRawNotification,\n} from 'src/NotificationServicesController/types';\n\n/**\n * A true \"raw notification\" does not have some fields that exist on this type. E.g. the `type` field.\n * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.\n * We use this to ensure that the correct missing fields are added to the raw shapes\n *\n * @param data - raw onchain notification\n * @returns a complete raw onchain notification\n */\nexport function toRawOnChainNotification(\n data: UnprocessedOnChainRawNotification,\n): OnChainRawNotification {\n return {\n ...data,\n type: data?.data?.kind,\n } as OnChainRawNotification;\n}\n"],"mappings":";AAaO,SAAS,yBACd,MACwB;AACxB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM,MAAM,MAAM;AAAA,EACpB;AACF;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/shared/to-raw-notification.ts
|
|
2
|
+
function toRawOnChainNotification(data) {
|
|
3
|
+
return {
|
|
4
|
+
...data,
|
|
5
|
+
type: data?.data?.kind
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.toRawOnChainNotification = toRawOnChainNotification;
|
|
12
|
+
//# sourceMappingURL=chunk-DT6SLUWJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/to-raw-notification.ts"],"names":[],"mappings":";AAaO,SAAS,yBACd,MACwB;AACxB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM,MAAM,MAAM;AAAA,EACpB;AACF","sourcesContent":["import type {\n OnChainRawNotification,\n UnprocessedOnChainRawNotification,\n} from 'src/NotificationServicesController/types';\n\n/**\n * A true \"raw notification\" does not have some fields that exist on this type. E.g. the `type` field.\n * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.\n * We use this to ensure that the correct missing fields are added to the raw shapes\n *\n * @param data - raw onchain notification\n * @returns a complete raw onchain notification\n */\nexport function toRawOnChainNotification(\n data: UnprocessedOnChainRawNotification,\n): OnChainRawNotification {\n return {\n ...data,\n type: data?.data?.kind,\n } as OnChainRawNotification;\n}\n"]}
|
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
toggleUserStorageTriggerStatus,
|
|
4
4
|
traverseUserStorageTriggers
|
|
5
5
|
} from "./chunk-ILPTPB4U.mjs";
|
|
6
|
+
import {
|
|
7
|
+
toRawOnChainNotification
|
|
8
|
+
} from "./chunk-DINCLRZT.mjs";
|
|
6
9
|
|
|
7
10
|
// src/NotificationServicesController/services/onchain-notifications.ts
|
|
8
11
|
import { UserStorageController } from "@metamask/profile-sync-controller";
|
|
@@ -122,17 +125,12 @@ async function getOnChainNotifications(userStorage, bearerToken) {
|
|
|
122
125
|
{ trigger_ids: triggerIds }
|
|
123
126
|
);
|
|
124
127
|
const notifications = await response.json();
|
|
125
|
-
const transformedNotifications = notifications.map(
|
|
126
|
-
(n)
|
|
127
|
-
|
|
128
|
-
return void 0;
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
...n,
|
|
132
|
-
type: n.data.kind
|
|
133
|
-
};
|
|
128
|
+
const transformedNotifications = notifications.map((n) => {
|
|
129
|
+
if (!n.data?.kind) {
|
|
130
|
+
return void 0;
|
|
134
131
|
}
|
|
135
|
-
|
|
132
|
+
return toRawOnChainNotification(n);
|
|
133
|
+
}).filter((n) => Boolean(n));
|
|
136
134
|
onChainNotifications.push(...transformedNotifications);
|
|
137
135
|
if (notifications.length < 100) {
|
|
138
136
|
page = PAGE_LIMIT + 1;
|
|
@@ -184,4 +182,4 @@ export {
|
|
|
184
182
|
getOnChainNotifications,
|
|
185
183
|
markNotificationsAsRead
|
|
186
184
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
185
|
+
//# sourceMappingURL=chunk-FN6GVBCU.mjs.map
|