@metamask-previews/notification-services-controller 0.2.1-preview-3b4ca958 → 0.2.1-preview-04657153
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/index.js +4 -2
- package/dist/NotificationServicesController/index.mjs +3 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js +3 -3
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +2 -2
- package/dist/NotificationServicesPushController/index.js +6 -4
- package/dist/NotificationServicesPushController/index.mjs +5 -3
- package/dist/NotificationServicesPushController/services/push/push-web.js +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.mjs +1 -1
- package/dist/NotificationServicesPushController/services/services.js +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.js +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +1 -1
- package/dist/NotificationServicesPushController/utils/index.js +1 -1
- package/dist/NotificationServicesPushController/utils/index.mjs +1 -1
- package/dist/{chunk-AGYH42WJ.mjs → chunk-56OOTY2L.mjs} +7 -1
- package/dist/chunk-56OOTY2L.mjs.map +1 -0
- package/dist/{chunk-KALM2VL3.js → chunk-5CFEVEAV.js} +1 -1
- package/dist/chunk-5CFEVEAV.js.map +1 -0
- package/dist/{chunk-5M7BWNL7.mjs → chunk-CXWZLA5O.mjs} +1 -1
- package/dist/chunk-CXWZLA5O.mjs.map +1 -0
- package/dist/{chunk-2SBUAEFV.js → chunk-SLSTQQJR.js} +8 -2
- package/dist/chunk-SLSTQQJR.js.map +1 -0
- package/dist/{chunk-QD4UVAJS.mjs → chunk-UMB6F2XF.mjs} +8 -2
- package/dist/chunk-UMB6F2XF.mjs.map +1 -0
- package/dist/{chunk-LCCKX3SN.js → chunk-WBI6LXZV.js} +11 -5
- package/dist/chunk-WBI6LXZV.js.map +1 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/NotificationServicesController/index.d.ts +2 -0
- package/dist/types/NotificationServicesController/index.d.ts.map +1 -1
- package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts +8 -5
- package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +1 -1
- package/dist/types/NotificationServicesPushController/index.d.ts +2 -0
- package/dist/types/NotificationServicesPushController/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/notification-services/constants/package.json +9 -0
- package/notification-services/mocks/package.json +9 -0
- package/notification-services/package.json +9 -0
- package/notification-services/processors/package.json +9 -0
- package/notification-services/types/package.json +9 -0
- package/notification-services/ui/package.json +9 -0
- package/package.json +54 -2
- package/push-services/mocks/package.json +9 -0
- package/push-services/package.json +9 -0
- package/push-services/types/package.json +9 -0
- package/push-services/utils/package.json +9 -0
- package/dist/chunk-2SBUAEFV.js.map +0 -1
- package/dist/chunk-5M7BWNL7.mjs.map +0 -1
- package/dist/chunk-AGYH42WJ.mjs.map +0 -1
- package/dist/chunk-KALM2VL3.js.map +0 -1
- package/dist/chunk-LCCKX3SN.js.map +0 -1
- package/dist/chunk-QD4UVAJS.mjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkSLSTQQJRjs = require('../chunk-SLSTQQJR.js');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
var _chunk232HZSEVjs = require('../chunk-232HZSEV.js');
|
|
@@ -46,5 +47,6 @@ require('../chunk-IGY2S5BC.js');
|
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
|
|
51
|
+
exports.Constants = _chunkQY4UST5Vjs.constants_exports; exports.Controller = _chunkRVDEVD2Djs.NotificationServicesController; exports.Mocks = _chunkSLSTQQJRjs.fixtures_exports; exports.Processors = _chunkKWTSMLNDjs.processors_exports; exports.Types = _chunk232HZSEVjs.types_exports; exports.UI = _chunkIG3KWCQUjs.ui_exports; exports.default = _chunkSLSTQQJRjs.NotificationServicesController_default; exports.defaultState = _chunkRVDEVD2Djs.defaultState;
|
|
50
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NotificationServicesController_default,
|
|
2
3
|
fixtures_exports
|
|
3
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-56OOTY2L.mjs";
|
|
4
5
|
import {
|
|
5
6
|
types_exports
|
|
6
7
|
} from "../chunk-B4ECJJ5C.mjs";
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
processors_exports as Processors,
|
|
46
47
|
types_exports as Types,
|
|
47
48
|
ui_exports as UI,
|
|
49
|
+
NotificationServicesController_default as default,
|
|
48
50
|
defaultState
|
|
49
51
|
};
|
|
50
52
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk5CFEVEAVjs = require('../chunk-5CFEVEAV.js');
|
|
5
5
|
require('../chunk-4HOEZMSV.js');
|
|
6
6
|
require('../chunk-GDKHOBJT.js');
|
|
7
7
|
require('../chunk-B25TJ7KS.js');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-SLSTQQJR.js');
|
|
9
9
|
require('../chunk-232HZSEV.js');
|
|
10
10
|
require('../chunk-XZEVRYUE.js');
|
|
11
11
|
require('../chunk-3ZS2HAEG.js');
|
|
@@ -35,5 +35,5 @@ require('../chunk-IGY2S5BC.js');
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
exports.default =
|
|
38
|
+
exports.default = _chunk5CFEVEAVjs.NotificationServicesPushController; exports.defaultState = _chunk5CFEVEAVjs.defaultState;
|
|
39
39
|
//# sourceMappingURL=NotificationServicesPushController.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NotificationServicesPushController,
|
|
3
3
|
defaultState
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-CXWZLA5O.mjs";
|
|
5
5
|
import "../chunk-WGGW6VCR.mjs";
|
|
6
6
|
import "../chunk-YHVXD5WW.mjs";
|
|
7
7
|
import "../chunk-IKWNHNJQ.mjs";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-56OOTY2L.mjs";
|
|
9
9
|
import "../chunk-B4ECJJ5C.mjs";
|
|
10
10
|
import "../chunk-U74Q3BRP.mjs";
|
|
11
11
|
import "../chunk-G52DNXFH.mjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkWBI6LXZVjs = require('../chunk-WBI6LXZV.js');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
var _chunk7LWR54U7js = require('../chunk-7LWR54U7.js');
|
|
@@ -13,11 +14,11 @@ require('../chunk-GETQWOTI.js');
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
var
|
|
17
|
+
var _chunk5CFEVEAVjs = require('../chunk-5CFEVEAV.js');
|
|
17
18
|
require('../chunk-4HOEZMSV.js');
|
|
18
19
|
require('../chunk-GDKHOBJT.js');
|
|
19
20
|
require('../chunk-B25TJ7KS.js');
|
|
20
|
-
require('../chunk-
|
|
21
|
+
require('../chunk-SLSTQQJR.js');
|
|
21
22
|
require('../chunk-232HZSEV.js');
|
|
22
23
|
require('../chunk-XZEVRYUE.js');
|
|
23
24
|
require('../chunk-3ZS2HAEG.js');
|
|
@@ -50,5 +51,6 @@ require('../chunk-IGY2S5BC.js');
|
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
|
|
55
|
+
exports.Controller = _chunk5CFEVEAVjs.NotificationServicesPushController; exports.Mocks = _chunkWBI6LXZVjs.fixtures_exports; exports.Types = _chunk7LWR54U7js.types_exports; exports.Utils = _chunkENRKCWJ6js.utils_exports; exports.default = _chunkWBI6LXZVjs.NotificationServicesPushController_default; exports.defaultState = _chunk5CFEVEAVjs.defaultState;
|
|
54
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NotificationServicesPushController_default,
|
|
2
3
|
fixtures_exports
|
|
3
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-UMB6F2XF.mjs";
|
|
4
5
|
import {
|
|
5
6
|
types_exports
|
|
6
7
|
} from "../chunk-IOMDG67D.mjs";
|
|
@@ -13,11 +14,11 @@ import "../chunk-RAUV5UV4.mjs";
|
|
|
13
14
|
import {
|
|
14
15
|
NotificationServicesPushController,
|
|
15
16
|
defaultState
|
|
16
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-CXWZLA5O.mjs";
|
|
17
18
|
import "../chunk-WGGW6VCR.mjs";
|
|
18
19
|
import "../chunk-YHVXD5WW.mjs";
|
|
19
20
|
import "../chunk-IKWNHNJQ.mjs";
|
|
20
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-56OOTY2L.mjs";
|
|
21
22
|
import "../chunk-B4ECJJ5C.mjs";
|
|
22
23
|
import "../chunk-U74Q3BRP.mjs";
|
|
23
24
|
import "../chunk-G52DNXFH.mjs";
|
|
@@ -49,6 +50,7 @@ export {
|
|
|
49
50
|
fixtures_exports as Mocks,
|
|
50
51
|
types_exports as Types,
|
|
51
52
|
utils_exports as Utils,
|
|
53
|
+
NotificationServicesPushController_default as default,
|
|
52
54
|
defaultState
|
|
53
55
|
};
|
|
54
56
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkGDKHOBJTjs = require('../../../chunk-GDKHOBJT.js');
|
|
7
|
-
require('../../../chunk-
|
|
7
|
+
require('../../../chunk-SLSTQQJR.js');
|
|
8
8
|
require('../../../chunk-232HZSEV.js');
|
|
9
9
|
require('../../../chunk-XZEVRYUE.js');
|
|
10
10
|
require('../../../chunk-3ZS2HAEG.js');
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
listenToPushNotificationsClicked,
|
|
5
5
|
listenToPushNotificationsReceived
|
|
6
6
|
} from "../../../chunk-YHVXD5WW.mjs";
|
|
7
|
-
import "../../../chunk-
|
|
7
|
+
import "../../../chunk-56OOTY2L.mjs";
|
|
8
8
|
import "../../../chunk-B4ECJJ5C.mjs";
|
|
9
9
|
import "../../../chunk-U74Q3BRP.mjs";
|
|
10
10
|
import "../../../chunk-G52DNXFH.mjs";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
var _chunk4HOEZMSVjs = require('../../chunk-4HOEZMSV.js');
|
|
9
9
|
require('../../chunk-GDKHOBJT.js');
|
|
10
10
|
require('../../chunk-B25TJ7KS.js');
|
|
11
|
-
require('../../chunk-
|
|
11
|
+
require('../../chunk-SLSTQQJR.js');
|
|
12
12
|
require('../../chunk-232HZSEV.js');
|
|
13
13
|
require('../../chunk-XZEVRYUE.js');
|
|
14
14
|
require('../../chunk-3ZS2HAEG.js');
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "../../chunk-WGGW6VCR.mjs";
|
|
9
9
|
import "../../chunk-YHVXD5WW.mjs";
|
|
10
10
|
import "../../chunk-IKWNHNJQ.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-56OOTY2L.mjs";
|
|
12
12
|
import "../../chunk-B4ECJJ5C.mjs";
|
|
13
13
|
import "../../chunk-U74Q3BRP.mjs";
|
|
14
14
|
import "../../chunk-G52DNXFH.mjs";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
var _chunkBUT7X5F2js = require('../../chunk-BUT7X5F2.js');
|
|
6
6
|
require('../../chunk-EJ52BDLB.js');
|
|
7
|
-
require('../../chunk-
|
|
7
|
+
require('../../chunk-SLSTQQJR.js');
|
|
8
8
|
require('../../chunk-232HZSEV.js');
|
|
9
9
|
require('../../chunk-XZEVRYUE.js');
|
|
10
10
|
require('../../chunk-3ZS2HAEG.js');
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
isOnChainNotification
|
|
5
5
|
} from "../../chunk-6GUOLD7O.mjs";
|
|
6
6
|
import "../../chunk-ODI2BTKS.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-56OOTY2L.mjs";
|
|
8
8
|
import "../../chunk-B4ECJJ5C.mjs";
|
|
9
9
|
import "../../chunk-U74Q3BRP.mjs";
|
|
10
10
|
import "../../chunk-G52DNXFH.mjs";
|
|
@@ -10,7 +10,7 @@ var _chunkBUT7X5F2js = require('../../chunk-BUT7X5F2.js');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkEJ52BDLBjs = require('../../chunk-EJ52BDLB.js');
|
|
13
|
-
require('../../chunk-
|
|
13
|
+
require('../../chunk-SLSTQQJR.js');
|
|
14
14
|
require('../../chunk-232HZSEV.js');
|
|
15
15
|
require('../../chunk-XZEVRYUE.js');
|
|
16
16
|
require('../../chunk-3ZS2HAEG.js');
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getAmount,
|
|
11
11
|
getLeadingZeroCount
|
|
12
12
|
} from "../../chunk-ODI2BTKS.mjs";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-56OOTY2L.mjs";
|
|
14
14
|
import "../../chunk-B4ECJJ5C.mjs";
|
|
15
15
|
import "../../chunk-U74Q3BRP.mjs";
|
|
16
16
|
import "../../chunk-G52DNXFH.mjs";
|
|
@@ -41,6 +41,7 @@ __export(NotificationServicesController_exports, {
|
|
|
41
41
|
Processors: () => processors_exports,
|
|
42
42
|
Types: () => types_exports,
|
|
43
43
|
UI: () => ui_exports,
|
|
44
|
+
default: () => NotificationServicesController_default,
|
|
44
45
|
defaultState: () => defaultState
|
|
45
46
|
});
|
|
46
47
|
|
|
@@ -922,8 +923,13 @@ var getMockMarkNotificationsAsReadResponse = () => {
|
|
|
922
923
|
};
|
|
923
924
|
};
|
|
924
925
|
|
|
926
|
+
// src/NotificationServicesController/index.ts
|
|
927
|
+
var NotificationServicesController2 = NotificationServicesController;
|
|
928
|
+
var NotificationServicesController_default = NotificationServicesController2;
|
|
929
|
+
|
|
925
930
|
export {
|
|
926
931
|
fixtures_exports,
|
|
932
|
+
NotificationServicesController_default,
|
|
927
933
|
NotificationServicesController_exports
|
|
928
934
|
};
|
|
929
|
-
//# sourceMappingURL=chunk-
|
|
935
|
+
//# sourceMappingURL=chunk-56OOTY2L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/NotificationServicesController/index.ts","../src/NotificationServicesController/__fixtures__/index.ts","../src/NotificationServicesController/__fixtures__/mock-feature-announcements.ts","../src/NotificationServicesController/__fixtures__/mock-notification-trigger.ts","../src/NotificationServicesController/__fixtures__/mock-notification-user-storage.ts","../src/NotificationServicesController/__fixtures__/mock-raw-notifications.ts","../src/NotificationServicesController/__fixtures__/mockResponses.ts"],"sourcesContent":["import Controller from './NotificationServicesController';\n\nconst NotificationServicesController = Controller;\nexport { Controller };\nexport default NotificationServicesController;\nexport * from './NotificationServicesController';\nexport * as Types from './types';\nexport * as Mocks from './__fixtures__';\nexport * as Processors from './processors';\nexport * as Constants from './constants';\nexport * as UI from './ui';\n","export * from './mock-feature-announcements';\nexport * from './mock-notification-trigger';\nexport * from './mock-notification-user-storage';\nexport * from './mock-raw-notifications';\nexport * from './mockResponses';\n","import { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { ContentfulResult } from '../services/feature-announcements';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\n\n/**\n * Mocking Utility - create a mock normalized feature announcement\n *\n * @returns Mock Normalized Feature Announcement\n */\nexport function createMockFeatureAnnouncementAPIResult(): ContentfulResult {\n return {\n sys: {\n type: 'Array',\n },\n total: 17,\n skip: 0,\n limit: 1,\n items: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '1ABRmHaNCgmxROKXXLXsMu',\n type: 'Entry',\n createdAt: '2024-04-09T13:24:01.872Z',\n updatedAt: '2024-04-09T13:24:01.872Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'productAnnouncement',\n },\n },\n locale: 'en-US',\n },\n fields: {\n title: 'Don’t miss out on airdrops and new NFT mints!',\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started. ',\n image: {\n sys: {\n type: 'Link',\n linkType: 'Asset',\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n },\n },\n longDescription: {\n data: {},\n content: [\n {\n data: {},\n content: [\n {\n data: {},\n marks: [],\n value:\n 'You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started. \\n',\n nodeType: 'text',\n },\n ],\n nodeType: 'paragraph',\n },\n ],\n nodeType: 'document',\n },\n link: {\n sys: {\n type: 'Link',\n linkType: 'Entry',\n id: '62xKYM2ydo4F1mS5q97K5q',\n },\n },\n },\n },\n ],\n includes: {\n Entry: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '62xKYM2ydo4F1mS5q97K5q',\n type: 'Entry',\n createdAt: '2024-04-09T13:23:03.636Z',\n updatedAt: '2024-04-09T13:23:03.636Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'link',\n },\n },\n locale: 'en-US',\n },\n fields: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n ],\n Asset: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n type: 'Asset',\n createdAt: '2024-04-09T13:23:13.327Z',\n updatedAt: '2024-04-09T13:23:13.327Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n locale: 'en-US',\n },\n fields: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n file: {\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n details: {\n size: 797731,\n image: {\n width: 2880,\n height: 1921,\n },\n },\n fileName: 'PDAPP notification image_Airdrops & NFT mints.png',\n contentType: 'image/png',\n },\n },\n },\n ],\n },\n } as unknown as ContentfulResult;\n}\n\n/**\n * Mocking Utility - create a mock raw feature announcement\n *\n * @returns Mock Raw Feature Announcement\n */\nexport function createMockFeatureAnnouncementRaw(): FeatureAnnouncementRawNotification {\n return {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: '2999-04-09T13:24:01.872Z',\n data: {\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n title: 'Don’t miss out on airdrops and new NFT mints!',\n longDescription: `<p>You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started.</p>`,\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started.',\n image: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n },\n extensionLink: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n };\n}\n","import { v4 as uuidv4 } from 'uuid';\n\nimport type { NotificationTrigger } from '../utils/utils';\n\n/**\n * Mocking Utility - create a mock Notification Trigger\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock Notification Trigger\n */\nexport function createMockNotificationTrigger(\n override?: Partial<NotificationTrigger>,\n): NotificationTrigger {\n return {\n id: uuidv4(),\n address: '0xFAKE_ADDRESS',\n chainId: '1',\n kind: 'eth_sent',\n enabled: true,\n ...override,\n };\n}\n","import { USER_STORAGE_VERSION_KEY } from '../constants/constants';\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport { initializeUserStorage } from '../utils/utils';\n\nexport const MOCK_USER_STORAGE_ACCOUNT =\n '0x0000000000000000000000000000000000000000';\nexport const MOCK_USER_STORAGE_CHAIN = '1';\n\n/**\n * Mocking Utility - create a mock notification user storage object\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock notification user storage object\n */\nexport function createMockUserStorage(\n override?: Partial<UserStorage>,\n): UserStorage {\n return {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {\n '111-111-111-111': {\n k: TRIGGER_TYPES.ERC20_RECEIVED,\n e: true,\n },\n '222-222-222-222': {\n k: TRIGGER_TYPES.ERC20_SENT,\n e: true,\n },\n },\n },\n ...override,\n };\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object with triggers\n *\n * @param triggers - provide any override configuration for the mock\n * @returns a mock notification user storage object with triggers\n */\nexport function createMockUserStorageWithTriggers(\n triggers: string[] | { id: string; e: boolean; k?: TRIGGER_TYPES }[],\n): UserStorage {\n const userStorage: UserStorage = {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {},\n },\n };\n\n // insert triggerIds\n triggers.forEach((t) => {\n let tId: string;\n let e: boolean;\n let k: TRIGGER_TYPES;\n if (typeof t === 'string') {\n tId = t;\n e = true;\n k = TRIGGER_TYPES.ERC20_RECEIVED;\n } else {\n tId = t.id;\n e = t.e;\n k = t.k ?? TRIGGER_TYPES.ERC20_RECEIVED;\n }\n\n userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {\n k,\n e,\n };\n });\n\n return userStorage;\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object (full/realistic object)\n *\n * @param props - provide any override configuration for the mock\n * @param props.triggersEnabled - choose if all triggers created are enabled/disabled\n * @param props.address - choose a specific address for triggers to be assigned to\n * @returns a mock full notification user storage object\n */\nexport function createMockFullUserStorage(\n props: { triggersEnabled?: boolean; address?: string } = {},\n): UserStorage {\n return initializeUserStorage(\n [{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }],\n props.triggersEnabled ?? true,\n );\n}\n","/* eslint-disable @typescript-eslint/naming-convention */\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { OnChainRawNotification } from '../types/on-chain-notification/on-chain-notification';\n\n/**\n * Mocking Utility - create a mock Eth sent notification\n * @returns Mock raw Eth sent notification\n */\nexport function createMockNotificationEthSent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ETH_SENT,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'eth_sent',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n from: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n to: '0x881D40237659C251811CEC9c364ef91dC08D300D',\n amount: {\n usd: '670.64',\n eth: '0.005',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Eth Received notification\n * @returns Mock raw Eth Received notification\n */\nexport function createMockNotificationEthReceived(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ETH_RECEIVED,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'eth_received',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n from: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n to: '0x881D40237659C251811CEC9c364ef91dC08D300D',\n amount: {\n usd: '670.64',\n eth: '808.000000000000000000',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC20 sent notification\n * @returns Mock raw ERC20 sent notification\n */\nexport function createMockNotificationERC20Sent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC20_SENT,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'erc20_sent',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n to: '0xecc19e177d24551aa7ed6bc6fe566eca726cc8a9',\n from: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae',\n token: {\n usd: '1.00',\n name: 'USDC',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/usdc.svg',\n amount: '4956250000',\n symbol: 'USDC',\n address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n decimals: '6',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC20 received notification\n * @returns Mock raw ERC20 received notification\n */\nexport function createMockNotificationERC20Received(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC20_RECEIVED,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'erc20_received',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n to: '0xeae7380dd4cef6fbd1144f49e4d1e6964258a4f4',\n from: '0x51c72848c68a965f66fa7a88855f9f7784502a7f',\n token: {\n usd: '0.00',\n name: 'SHIBA INU',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/shib.svg',\n amount: '8382798736999999457296646144',\n symbol: 'SHIB',\n address: '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce',\n decimals: '18',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC721 sent notification\n * @returns Mock raw ERC721 sent notification\n */\nexport function createMockNotificationERC721Sent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC721_SENT,\n block_number: 18576643,\n block_timestamp: '1700043467',\n chain_id: 1,\n created_at: '2023-11-15T11:08:17.895407Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0xf47f628fe3bd2595e9ab384bfffc3859b448e451',\n nft: {\n name: 'Captainz #8680',\n image:\n 'https://i.seadn.io/s/raw/files/ae0fc06714ff7fb40217340d8a242c0e.gif?w=500&auto=format',\n token_id: '8680',\n collection: {\n name: 'The Captainz',\n image:\n 'https://i.seadn.io/gcs/files/6df4d75778066bce740050615bc84e21.png?w=500&auto=format',\n symbol: 'Captainz',\n address: '0x769272677fab02575e84945f03eca517acc544cc',\n },\n },\n from: '0x24a0bb54b7e7a8e406e9b28058a9fd6c49e6df4f',\n kind: 'erc721_sent',\n network_fee: {\n gas_price: '24550653274',\n native_token_price_in_usd: '1986.61',\n },\n },\n id: 'a4193058-9814-537e-9df4-79dcac727fb6',\n trigger_id: '028485be-b994-422b-a93b-03fcc01ab715',\n tx_hash:\n '0x0833c69fb41cf972a0f031fceca242939bc3fcf82b964b74606649abcad371bd',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC721 received notification\n * @returns Mock raw ERC721 received notification\n */\nexport function createMockNotificationERC721Received(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC721_RECEIVED,\n block_number: 18571446,\n block_timestamp: '1699980623',\n chain_id: 1,\n created_at: '2023-11-14T17:40:52.319281Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0xba7f3daa8adfdad686574406ab9bd5d2f0a49d2e',\n nft: {\n name: 'The Plague #2722',\n image:\n 'https://i.seadn.io/s/raw/files/a96f90ec8ebf55a2300c66a0c46d6a16.png?w=500&auto=format',\n token_id: '2722',\n collection: {\n name: 'The Plague NFT',\n image:\n 'https://i.seadn.io/gcs/files/4577987a5ca45ca5118b2e31559ee4d1.jpg?w=500&auto=format',\n symbol: 'FROG',\n address: '0xc379e535caff250a01caa6c3724ed1359fe5c29b',\n },\n },\n from: '0x24a0bb54b7e7a8e406e9b28058a9fd6c49e6df4f',\n kind: 'erc721_received',\n network_fee: {\n gas_price: '53701898538',\n native_token_price_in_usd: '2047.01',\n },\n },\n id: '00a79d24-befa-57ed-a55a-9eb8696e1654',\n trigger_id: 'd24ac26a-8579-49ec-9947-d04d63592ebd',\n tx_hash:\n '0xe554c9e29e6eeca8ba94da4d047334ba08b8eb9ca3b801dd69cec08dfdd4ae43',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC1155 sent notification\n * @returns Mock raw ERC1155 sent notification\n */\nexport function createMockNotificationERC1155Sent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC1155_SENT,\n block_number: 18615206,\n block_timestamp: '1700510003',\n chain_id: 1,\n created_at: '2023-11-20T20:44:10.110706Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0x15bd77ccacf2da39b84f0c31fee2e451225bb190',\n nft: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gcs/files/79a77cb37c7b2f1069f752645d29fea7.jpg?w=500&auto=format',\n token_id: '1',\n collection: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gae/LTKz3om2eCQfn3M6PkqEmY7KhLtdMCOm0QVch2318KJq7-KyToCH7NBTMo4UuJ0AZI-oaBh1HcgrAEIEWYbXY3uMcYpuGXunaXEh?w=500&auto=format',\n symbol: 'TRUTH',\n address: '0xe25f0fe686477f9df3c2876c4902d3b85f75f33a',\n },\n },\n from: '0x0000000000000000000000000000000000000000',\n kind: 'erc1155_sent',\n network_fee: {\n gas_price: '33571446596',\n native_token_price_in_usd: '2038.88',\n },\n },\n id: 'a09ff9d1-623a-52ab-a3d4-c7c8c9a58362',\n trigger_id: 'e2130f7d-78b8-4c34-999a-3f3d3bb5b03c',\n tx_hash:\n '0x03381aba290facbaf71c123e263c8dc3dd550aac00ef589cce395182eaeff76f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC1155 received notification\n * @returns Mock raw ERC1155 received notification\n */\nexport function createMockNotificationERC1155Received(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC1155_RECEIVED,\n block_number: 18615206,\n block_timestamp: '1700510003',\n chain_id: 1,\n created_at: '2023-11-20T20:44:10.110706Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0x15bd77ccacf2da39b84f0c31fee2e451225bb190',\n nft: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gcs/files/79a77cb37c7b2f1069f752645d29fea7.jpg?w=500&auto=format',\n token_id: '1',\n collection: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gae/LTKz3om2eCQfn3M6PkqEmY7KhLtdMCOm0QVch2318KJq7-KyToCH7NBTMo4UuJ0AZI-oaBh1HcgrAEIEWYbXY3uMcYpuGXunaXEh?w=500&auto=format',\n symbol: 'TRUTH',\n address: '0xe25f0fe686477f9df3c2876c4902d3b85f75f33a',\n },\n },\n from: '0x0000000000000000000000000000000000000000',\n kind: 'erc1155_received',\n network_fee: {\n gas_price: '33571446596',\n native_token_price_in_usd: '2038.88',\n },\n },\n id: 'b6b93c84-e8dc-54ed-9396-7ea50474843a',\n trigger_id: '710c8abb-43a9-42a5-9d86-9dd258726c82',\n tx_hash:\n '0x03381aba290facbaf71c123e263c8dc3dd550aac00ef589cce395182eaeff76f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock MetaMask Swaps notification\n * @returns Mock raw MetaMask Swaps notification\n */\nexport function createMockNotificationMetaMaskSwapsCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.METAMASK_SWAP_COMPLETED,\n block_number: 18377666,\n block_timestamp: '1697637275',\n chain_id: 1,\n created_at: '2023-10-18T13:58:49.854596Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'metamask_swap_completed',\n rate: '1558.27',\n token_in: {\n usd: '1576.73',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '9000000000000000',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n token_out: {\n usd: '1.00',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/usdt.svg',\n amount: '14024419',\n symbol: 'USDT',\n address: '0xdac17f958d2ee523a2206206994597c13d831ec7',\n decimals: '6',\n name: 'USDT',\n },\n network_fee: {\n gas_price: '15406129273',\n native_token_price_in_usd: '1576.73',\n },\n },\n id: '7ddfe6a1-ac52-5ffe-aa40-f04242db4b8b',\n trigger_id: 'd2eaa2eb-2e6e-4fd5-8763-b70ea571b46c',\n tx_hash:\n '0xf69074290f3aa11bce567aabc9ca0df7a12559dfae1b80ba1a124e9dfe19ecc5',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock RocketPool Stake Completed notification\n * @returns Mock raw RocketPool Stake Completed notification\n */\nexport function createMockNotificationRocketPoolStakeCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED,\n block_number: 18585057,\n block_timestamp: '1700145059',\n chain_id: 1,\n created_at: '2023-11-20T12:02:48.796824Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'rocketpool_stake_completed',\n stake_in: {\n usd: '2031.86',\n name: 'Ethereum',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '190690478063438272',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n },\n stake_out: {\n usd: '2226.49',\n name: 'Rocket Pool ETH',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/rETH.svg',\n amount: '175024360778165879',\n symbol: 'RETH',\n address: '0xae78736Cd615f374D3085123A210448E74Fc6393',\n decimals: '18',\n },\n network_fee: {\n gas_price: '36000000000',\n native_token_price_in_usd: '2031.86',\n },\n },\n id: 'c2a2f225-b2fb-5d6c-ba56-e27a5c71ffb9',\n trigger_id: '5110ff97-acff-40c0-83b4-11d487b8c7b0',\n tx_hash:\n '0xcfc0693bf47995907b0f46ef0644cf16dd9a0de797099b2e00fd481e1b2117d3',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock RocketPool Un-staked notification\n * @returns Mock raw RocketPool Un-staked notification\n */\nexport function createMockNotificationRocketPoolUnStakeCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED,\n block_number: 18384336,\n block_timestamp: '1697718011',\n chain_id: 1,\n created_at: '2023-10-19T13:11:10.623042Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'rocketpool_unstake_completed',\n stake_in: {\n usd: '1686.34',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/rETH.svg',\n amount: '66608041413696770',\n symbol: 'RETH',\n address: '0xae78736Cd615f374D3085123A210448E74Fc6393',\n decimals: '18',\n name: 'Rocketpool Eth',\n },\n stake_out: {\n usd: '1553.75',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '72387843427700824',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n network_fee: {\n gas_price: '5656322987',\n native_token_price_in_usd: '1553.75',\n },\n },\n id: 'd8c246e7-a0a4-5f1d-b079-2b1707665fbc',\n trigger_id: '291ec897-f569-4837-b6c0-21001b198dff',\n tx_hash:\n '0xc7972a7e409abfc62590ec90e633acd70b9b74e76ad02305be8bf133a0e22d5f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Stake Completed notification\n * @returns Mock raw Lido Stake Completed notification\n */\nexport function createMockNotificationLidoStakeCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_STAKE_COMPLETED,\n block_number: 18487118,\n block_timestamp: '1698961091',\n chain_id: 1,\n created_at: '2023-11-02T22:28:49.970865Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_stake_completed',\n stake_in: {\n usd: '1806.33',\n name: 'Ethereum',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '330303634023928032',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n },\n stake_out: {\n usd: '1801.30',\n name: 'Liquid staked Ether 2.0',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg',\n amount: '330303634023928032',\n symbol: 'STETH',\n address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',\n decimals: '18',\n },\n network_fee: {\n gas_price: '26536359866',\n native_token_price_in_usd: '1806.33',\n },\n },\n id: '9d9b1467-b3ee-5492-8ca2-22382657b690',\n trigger_id: 'ec10d66a-f78f-461f-83c9-609aada8cc50',\n tx_hash:\n '0x8cc0fa805f7c3b1743b14f3b91c6b824113b094f26d4ccaf6a71ad8547ce6a0f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Withdrawal Requested notification\n * @returns Mock raw Lido Withdrawal Requested notification\n */\nexport function createMockNotificationLidoWithdrawalRequested(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED,\n block_number: 18377760,\n block_timestamp: '1697638415',\n chain_id: 1,\n created_at: '2023-10-18T15:04:02.482526Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_withdrawal_requested',\n stake_in: {\n usd: '1568.54',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg',\n amount: '97180668792218669859',\n symbol: 'STETH',\n address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',\n decimals: '18',\n name: 'Staked Eth',\n },\n stake_out: {\n usd: '1576.73',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '97180668792218669859',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n network_fee: {\n gas_price: '11658906980',\n native_token_price_in_usd: '1576.73',\n },\n },\n id: '29ddc718-78c6-5f91-936f-2bef13a605f0',\n trigger_id: 'ef003925-3379-4ba7-9e2d-8218690cadc8',\n tx_hash:\n '0x58b5f82e084cb750ea174e02b20fbdfd2ba8d78053deac787f34fc38e5d427aa',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Withdrawal Completed notification\n * @returns Mock raw Lido Withdrawal Completed notification\n */\nexport function createMockNotificationLidoWithdrawalCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED,\n block_number: 18378208,\n block_timestamp: '1697643851',\n chain_id: 1,\n created_at: '2023-10-18T16:35:03.147606Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_withdrawal_completed',\n stake_in: {\n usd: '1570.23',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg',\n amount: '35081997661451346',\n symbol: 'STETH',\n address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',\n decimals: '18',\n name: 'Staked Eth',\n },\n stake_out: {\n usd: '1571.74',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '35081997661451346',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n network_fee: {\n gas_price: '12699495150',\n native_token_price_in_usd: '1571.74',\n },\n },\n id: 'f4ef0b7f-5612-537f-9144-0b5c63ae5391',\n trigger_id: 'd73df14d-ce73-4f38-bad3-ab028154042c',\n tx_hash:\n '0xe6d210d2e601ef3dd1075c48e71452cf35f2daae3886911e964e3babad8ac657',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Withdrawal Ready notification\n * @returns Mock raw Lido Withdrawal Ready notification\n */\nexport function createMockNotificationLidoReadyToBeWithdrawn(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_STAKE_READY_TO_BE_WITHDRAWN,\n block_number: 18378208,\n block_timestamp: '1697643851',\n chain_id: 1,\n created_at: '2023-10-18T16:35:03.147606Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_stake_ready_to_be_withdrawn',\n request_id: '123456789',\n staked_eth: {\n address: '0x881D40237659C251811CEC9c364ef91dC08D300F',\n symbol: 'ETH',\n name: 'Ethereum',\n amount: '2.5',\n decimals: '18',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n usd: '10000.00',\n },\n },\n id: 'f4ef0b7f-5612-537f-9144-0b5c63ae5391',\n trigger_id: 'd73df14d-ce73-4f38-bad3-ab028154042c',\n tx_hash:\n '0xe6d210d2e601ef3dd1075c48e71452cf35f2daae3886911e964e3babad8ac657',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - creates an array of raw on-chain notifications\n * @returns Array of raw on-chain notifications\n */\nexport function createMockRawOnChainNotifications(): OnChainRawNotification[] {\n return [1, 2, 3].map((id) => {\n const notification = createMockNotificationEthSent();\n notification.id += `-${id}`;\n return notification;\n });\n}\n","import { FEATURE_ANNOUNCEMENT_API } from '../services/feature-announcements';\nimport {\n NOTIFICATION_API_LIST_ENDPOINT,\n NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n TRIGGER_API_BATCH_ENDPOINT,\n} from '../services/onchain-notifications';\nimport { createMockFeatureAnnouncementAPIResult } from './mock-feature-announcements';\nimport { createMockRawOnChainNotifications } from './mock-raw-notifications';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const CONTENTFUL_RESPONSE = createMockFeatureAnnouncementAPIResult();\n\nexport const getMockFeatureAnnouncementResponse = () => {\n return {\n url: FEATURE_ANNOUNCEMENT_API,\n requestMethod: 'GET',\n response: CONTENTFUL_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockBatchCreateTriggersResponse = () => {\n return {\n url: TRIGGER_API_BATCH_ENDPOINT,\n requestMethod: 'POST',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockBatchDeleteTriggersResponse = () => {\n return {\n url: TRIGGER_API_BATCH_ENDPOINT,\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const MOCK_RAW_ON_CHAIN_NOTIFICATIONS =\n createMockRawOnChainNotifications();\n\nexport const getMockListNotificationsResponse = () => {\n return {\n url: NOTIFICATION_API_LIST_ENDPOINT,\n requestMethod: 'POST',\n response: MOCK_RAW_ON_CHAIN_NOTIFICATIONS,\n } satisfies MockResponse;\n};\n\nexport const getMockMarkNotificationsAsReadResponse = () => {\n return {\n url: NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n requestMethod: 'POST',\n response: null,\n } satisfies MockResponse;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,SAAS,yCAA2D;AACzE,SAAO;AAAA,IACL,KAAK;AAAA,MACH,MAAM;AAAA,IACR;AAAA,IACA,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,MACL;AAAA,QACE,UAAU;AAAA,UACR,MAAM,CAAC;AAAA,QACT;AAAA,QACA,KAAK;AAAA,UACH,OAAO;AAAA,YACL,KAAK;AAAA,cACH,MAAM;AAAA,cACN,UAAU;AAAA,cACV,IAAI;AAAA,YACN;AAAA,UACF;AAAA,UACA,IAAI;AAAA,UACJ,MAAM;AAAA,UACN,WAAW;AAAA,UACX,WAAW;AAAA,UACX,aAAa;AAAA,YACX,KAAK;AAAA,cACH,IAAI;AAAA,cACJ,MAAM;AAAA,cACN,UAAU;AAAA,YACZ;AAAA,UACF;AAAA,UACA,UAAU;AAAA,UACV,aAAa;AAAA,YACX,KAAK;AAAA,cACH,MAAM;AAAA,cACN,UAAU;AAAA,cACV,IAAI;AAAA,YACN;AAAA,UACF;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,QACA,QAAQ;AAAA,UACN,OAAO;AAAA,UACP,IAAI;AAAA,UACJ,UAAU;AAAA,UACV,kBACE;AAAA,UACF,OAAO;AAAA,YACL,KAAK;AAAA,cACH,MAAM;AAAA,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ACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,qCAAqC,MAAM;AACtD,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,kCACX,kCAAkC;AAE7B,IAAM,mCAAmC,MAAM;AACpD,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,yCAAyC,MAAM;AAC1D,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;;;ANxDA,IAAMA,kCAAiC;AAEvC,IAAO,yCAAQC;","names":["NotificationServicesController","NotificationServicesController"]}
|
|
@@ -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-5CFEVEAV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/NotificationServicesPushController/NotificationServicesPushController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAKA,SAAS,sBAAsB;AAE/B,OAAO,SAAS;AAYhB,IAAM,iBAAiB;AAoEhB,IAAM,eAAwD;AAAA,EACnE,UAAU;AACZ;AACA,IAAM,WAAW;AAAA,EACf,UAAU;AAAA,IACR,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;AA/FA;AAwIA,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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KAAK,IAAI;AAAA,EACxC;AACA,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 ControllerStateChangeEvent,\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 NotificationServicesPushControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n NotificationServicesPushControllerState\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 | NotificationServicesPushControllerGetStateAction\n | NotificationServicesPushControllerEnablePushNotificationsAction\n | NotificationServicesPushControllerDisablePushNotificationsAction\n | NotificationServicesPushControllerUpdateTriggerPushNotificationsAction;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type NotificationServicesPushControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n NotificationServicesPushControllerState\n >;\n\nexport type NotificationServicesPushControllerOnNewNotificationEvent = {\n type: `${typeof controllerName}:onNewNotifications`;\n payload: [Types.INotification];\n};\n\nexport type NotificationServicesPushControllerPushNotificationClickedEvent = {\n type: `${typeof controllerName}:pushNotificationClicked`;\n payload: [Types.INotification];\n};\n\nexport type Events =\n | NotificationServicesPushControllerStateChangeEvent\n | NotificationServicesPushControllerOnNewNotificationEvent\n | NotificationServicesPushControllerPushNotificationClickedEvent;\n\nexport type AllowedEvents = never;\n\nexport type NotificationServicesPushControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | 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\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/NotificationServicesPushController/NotificationServicesPushController.ts"],"sourcesContent":["import type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\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 NotificationServicesPushControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n NotificationServicesPushControllerState\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 | NotificationServicesPushControllerGetStateAction\n | NotificationServicesPushControllerEnablePushNotificationsAction\n | NotificationServicesPushControllerDisablePushNotificationsAction\n | NotificationServicesPushControllerUpdateTriggerPushNotificationsAction;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type NotificationServicesPushControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n NotificationServicesPushControllerState\n >;\n\nexport type NotificationServicesPushControllerOnNewNotificationEvent = {\n type: `${typeof controllerName}:onNewNotifications`;\n payload: [Types.INotification];\n};\n\nexport type NotificationServicesPushControllerPushNotificationClickedEvent = {\n type: `${typeof controllerName}:pushNotificationClicked`;\n payload: [Types.INotification];\n};\n\nexport type Events =\n | NotificationServicesPushControllerStateChangeEvent\n | NotificationServicesPushControllerOnNewNotificationEvent\n | NotificationServicesPushControllerPushNotificationClickedEvent;\n\nexport type AllowedEvents = never;\n\nexport type NotificationServicesPushControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | 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\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"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,SAAS,sBAAsB;AAE/B,OAAO,SAAS;AAYhB,IAAM,iBAAiB;AAoEhB,IAAM,eAAwD;AAAA,EACnE,UAAU;AACZ;AACA,IAAM,WAAW;AAAA,EACf,UAAU;AAAA,IACR,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;AA/FA;AAwIA,IAAqB,qCAArB,cAAgE,eAI9D;AAAA,EAOA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AAAA,MACJ;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A0BA;AAAA,6BAAwB,WAAS;AAC/B,OAAK,gBAAgB;AAAA,IACnB;AAAA,IACA,KAAK,wBAAwB,KAAK,IAAI;AAAA,EACxC;AACA,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;","names":[]}
|
|
@@ -41,6 +41,7 @@ _chunkIGY2S5BCjs.__export.call(void 0, NotificationServicesController_exports, {
|
|
|
41
41
|
Processors: () => _chunkKWTSMLNDjs.processors_exports,
|
|
42
42
|
Types: () => _chunk232HZSEVjs.types_exports,
|
|
43
43
|
UI: () => _chunkIG3KWCQUjs.ui_exports,
|
|
44
|
+
default: () => NotificationServicesController_default,
|
|
44
45
|
defaultState: () => _chunkRVDEVD2Djs.defaultState
|
|
45
46
|
});
|
|
46
47
|
|
|
@@ -922,8 +923,13 @@ var getMockMarkNotificationsAsReadResponse = () => {
|
|
|
922
923
|
};
|
|
923
924
|
};
|
|
924
925
|
|
|
926
|
+
// src/NotificationServicesController/index.ts
|
|
927
|
+
var NotificationServicesController2 = _chunkRVDEVD2Djs.NotificationServicesController;
|
|
928
|
+
var NotificationServicesController_default = NotificationServicesController2;
|
|
929
|
+
|
|
930
|
+
|
|
925
931
|
|
|
926
932
|
|
|
927
933
|
|
|
928
|
-
exports.fixtures_exports = fixtures_exports; exports.NotificationServicesController_exports = NotificationServicesController_exports;
|
|
929
|
-
//# sourceMappingURL=chunk-
|
|
934
|
+
exports.fixtures_exports = fixtures_exports; exports.NotificationServicesController_default = NotificationServicesController_default; exports.NotificationServicesController_exports = NotificationServicesController_exports;
|
|
935
|
+
//# sourceMappingURL=chunk-SLSTQQJR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/NotificationServicesController/index.ts","../src/NotificationServicesController/__fixtures__/index.ts","../src/NotificationServicesController/__fixtures__/mock-feature-announcements.ts","../src/NotificationServicesController/__fixtures__/mock-notification-trigger.ts","../src/NotificationServicesController/__fixtures__/mock-notification-user-storage.ts","../src/NotificationServicesController/__fixtures__/mock-raw-notifications.ts","../src/NotificationServicesController/__fixtures__/mockResponses.ts"],"names":["NotificationServicesController"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,SAAS,yCAA2D;AACzE,SAAO;AAAA,IACL,KAAK;AAAA,MACH,MAAM;AAAA,IACR;AAAA,IACA,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,MACL;AAAA,QACE,UAAU;AAAA,UACR,MAAM,CAAC;AAAA,QACT;AAAA,QACA,KAAK;AAAA,UACH,OAAO;AAAA,YACL,KAAK;AAAA,cACH,MAAM;AAAA,cACN,UAAU;AAAA,cACV,IAAI;AAAA,YACN;AAAA,UACF;AAAA,UACA,IAAI;AAAA,UACJ,MAAM;AAAA,UACN,WAAW;AAAA,UACX,WAAW;AAAA,UACX,aAAa;AAAA,YACX,KAAK;AAAA,cACH,IAAI;AAAA,cACJ,MAAM;AAAA,cACN,UAAU;AAAA,YACZ;AAAA,UACF;A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AI,CAAC,OAAO;AAC3B,UAAM,eAAe,8BAA8B;AACnD,iBAAa,MAAM,IAAI,EAAE;AACzB,WAAO;AAAA,EACT,CAAC;AACH;;;AClpBO,IAAM,sBAAsB,uCAAuC;AAEnE,IAAM,qCAAqC,MAAM;AACtD,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,qCAAqC,MAAM;AACtD,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,qCAAqC,MAAM;AACtD,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,kCACX,kCAAkC;AAE7B,IAAM,mCAAmC,MAAM;AACpD,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;AAEO,IAAM,yCAAyC,MAAM;AAC1D,SAAO;AAAA,IACL,KAAK;AAAA,IACL,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;AACF;;;ANxDA,IAAMA,kCAAiC;AAEvC,IAAO,yCAAQA","sourcesContent":["import Controller from './NotificationServicesController';\n\nconst NotificationServicesController = Controller;\nexport { Controller };\nexport default NotificationServicesController;\nexport * from './NotificationServicesController';\nexport * as Types from './types';\nexport * as Mocks from './__fixtures__';\nexport * as Processors from './processors';\nexport * as Constants from './constants';\nexport * as UI from './ui';\n","export * from './mock-feature-announcements';\nexport * from './mock-notification-trigger';\nexport * from './mock-notification-user-storage';\nexport * from './mock-raw-notifications';\nexport * from './mockResponses';\n","import { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { ContentfulResult } from '../services/feature-announcements';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\n\n/**\n * Mocking Utility - create a mock normalized feature announcement\n *\n * @returns Mock Normalized Feature Announcement\n */\nexport function createMockFeatureAnnouncementAPIResult(): ContentfulResult {\n return {\n sys: {\n type: 'Array',\n },\n total: 17,\n skip: 0,\n limit: 1,\n items: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '1ABRmHaNCgmxROKXXLXsMu',\n type: 'Entry',\n createdAt: '2024-04-09T13:24:01.872Z',\n updatedAt: '2024-04-09T13:24:01.872Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'productAnnouncement',\n },\n },\n locale: 'en-US',\n },\n fields: {\n title: 'Don’t miss out on airdrops and new NFT mints!',\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started. ',\n image: {\n sys: {\n type: 'Link',\n linkType: 'Asset',\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n },\n },\n longDescription: {\n data: {},\n content: [\n {\n data: {},\n content: [\n {\n data: {},\n marks: [],\n value:\n 'You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started. \\n',\n nodeType: 'text',\n },\n ],\n nodeType: 'paragraph',\n },\n ],\n nodeType: 'document',\n },\n link: {\n sys: {\n type: 'Link',\n linkType: 'Entry',\n id: '62xKYM2ydo4F1mS5q97K5q',\n },\n },\n },\n },\n ],\n includes: {\n Entry: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '62xKYM2ydo4F1mS5q97K5q',\n type: 'Entry',\n createdAt: '2024-04-09T13:23:03.636Z',\n updatedAt: '2024-04-09T13:23:03.636Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n contentType: {\n sys: {\n type: 'Link',\n linkType: 'ContentType',\n id: 'link',\n },\n },\n locale: 'en-US',\n },\n fields: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n ],\n Asset: [\n {\n metadata: {\n tags: [],\n },\n sys: {\n space: {\n sys: {\n type: 'Link',\n linkType: 'Space',\n id: 'jdkgyfmyd9sw',\n },\n },\n id: '5jqq8sFeLc6XEoeWlpI3aB',\n type: 'Asset',\n createdAt: '2024-04-09T13:23:13.327Z',\n updatedAt: '2024-04-09T13:23:13.327Z',\n environment: {\n sys: {\n id: 'master',\n type: 'Link',\n linkType: 'Environment',\n },\n },\n revision: 1,\n locale: 'en-US',\n },\n fields: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n file: {\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n details: {\n size: 797731,\n image: {\n width: 2880,\n height: 1921,\n },\n },\n fileName: 'PDAPP notification image_Airdrops & NFT mints.png',\n contentType: 'image/png',\n },\n },\n },\n ],\n },\n } as unknown as ContentfulResult;\n}\n\n/**\n * Mocking Utility - create a mock raw feature announcement\n *\n * @returns Mock Raw Feature Announcement\n */\nexport function createMockFeatureAnnouncementRaw(): FeatureAnnouncementRawNotification {\n return {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: '2999-04-09T13:24:01.872Z',\n data: {\n id: 'dont-miss-out-on-airdrops-and-new-nft-mints',\n category: 'ANNOUNCEMENT',\n title: 'Don’t miss out on airdrops and new NFT mints!',\n longDescription: `<p>You can now verify if any of your connected addresses are eligible for airdrops and other ERC-20 claims in a secure and convenient way. We’ve also added trending NFT mints based on creators you’ve minted from before or other tokens you hold. Head over to the Explore tab to get started.</p>`,\n shortDescription:\n 'Check your airdrop eligibility and see trending NFT drops. Head over to the Explore tab to get started.',\n image: {\n title: 'PDAPP notification image Airdrops & NFT mints',\n description: '',\n url: '//images.ctfassets.net/jdkgyfmyd9sw/5jqq8sFeLc6XEoeWlpI3aB/73ee0f1afa9916c3a7538b0bbee09c26/PDAPP_notification_image_Airdrops___NFT_mints.png',\n },\n extensionLink: {\n extensionLinkText: 'Try now',\n extensionLinkRoute: 'home.html',\n },\n },\n };\n}\n","import { v4 as uuidv4 } from 'uuid';\n\nimport type { NotificationTrigger } from '../utils/utils';\n\n/**\n * Mocking Utility - create a mock Notification Trigger\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock Notification Trigger\n */\nexport function createMockNotificationTrigger(\n override?: Partial<NotificationTrigger>,\n): NotificationTrigger {\n return {\n id: uuidv4(),\n address: '0xFAKE_ADDRESS',\n chainId: '1',\n kind: 'eth_sent',\n enabled: true,\n ...override,\n };\n}\n","import { USER_STORAGE_VERSION_KEY } from '../constants/constants';\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport { initializeUserStorage } from '../utils/utils';\n\nexport const MOCK_USER_STORAGE_ACCOUNT =\n '0x0000000000000000000000000000000000000000';\nexport const MOCK_USER_STORAGE_CHAIN = '1';\n\n/**\n * Mocking Utility - create a mock notification user storage object\n *\n * @param override - provide any override configuration for the mock\n * @returns a mock notification user storage object\n */\nexport function createMockUserStorage(\n override?: Partial<UserStorage>,\n): UserStorage {\n return {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {\n '111-111-111-111': {\n k: TRIGGER_TYPES.ERC20_RECEIVED,\n e: true,\n },\n '222-222-222-222': {\n k: TRIGGER_TYPES.ERC20_SENT,\n e: true,\n },\n },\n },\n ...override,\n };\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object with triggers\n *\n * @param triggers - provide any override configuration for the mock\n * @returns a mock notification user storage object with triggers\n */\nexport function createMockUserStorageWithTriggers(\n triggers: string[] | { id: string; e: boolean; k?: TRIGGER_TYPES }[],\n): UserStorage {\n const userStorage: UserStorage = {\n [USER_STORAGE_VERSION_KEY]: '1',\n [MOCK_USER_STORAGE_ACCOUNT]: {\n [MOCK_USER_STORAGE_CHAIN]: {},\n },\n };\n\n // insert triggerIds\n triggers.forEach((t) => {\n let tId: string;\n let e: boolean;\n let k: TRIGGER_TYPES;\n if (typeof t === 'string') {\n tId = t;\n e = true;\n k = TRIGGER_TYPES.ERC20_RECEIVED;\n } else {\n tId = t.id;\n e = t.e;\n k = t.k ?? TRIGGER_TYPES.ERC20_RECEIVED;\n }\n\n userStorage[MOCK_USER_STORAGE_ACCOUNT][MOCK_USER_STORAGE_CHAIN][tId] = {\n k,\n e,\n };\n });\n\n return userStorage;\n}\n\n/**\n * Mocking Utility - create a mock notification user storage object (full/realistic object)\n *\n * @param props - provide any override configuration for the mock\n * @param props.triggersEnabled - choose if all triggers created are enabled/disabled\n * @param props.address - choose a specific address for triggers to be assigned to\n * @returns a mock full notification user storage object\n */\nexport function createMockFullUserStorage(\n props: { triggersEnabled?: boolean; address?: string } = {},\n): UserStorage {\n return initializeUserStorage(\n [{ address: props.address ?? MOCK_USER_STORAGE_ACCOUNT }],\n props.triggersEnabled ?? true,\n );\n}\n","/* eslint-disable @typescript-eslint/naming-convention */\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { OnChainRawNotification } from '../types/on-chain-notification/on-chain-notification';\n\n/**\n * Mocking Utility - create a mock Eth sent notification\n * @returns Mock raw Eth sent notification\n */\nexport function createMockNotificationEthSent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ETH_SENT,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'eth_sent',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n from: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n to: '0x881D40237659C251811CEC9c364ef91dC08D300D',\n amount: {\n usd: '670.64',\n eth: '0.005',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Eth Received notification\n * @returns Mock raw Eth Received notification\n */\nexport function createMockNotificationEthReceived(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ETH_RECEIVED,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'eth_received',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n from: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n to: '0x881D40237659C251811CEC9c364ef91dC08D300D',\n amount: {\n usd: '670.64',\n eth: '808.000000000000000000',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC20 sent notification\n * @returns Mock raw ERC20 sent notification\n */\nexport function createMockNotificationERC20Sent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC20_SENT,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'erc20_sent',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n to: '0xecc19e177d24551aa7ed6bc6fe566eca726cc8a9',\n from: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae',\n token: {\n usd: '1.00',\n name: 'USDC',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/usdc.svg',\n amount: '4956250000',\n symbol: 'USDC',\n address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n decimals: '6',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC20 received notification\n * @returns Mock raw ERC20 received notification\n */\nexport function createMockNotificationERC20Received(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC20_RECEIVED,\n id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n trigger_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',\n chain_id: 1,\n block_number: 17485840,\n block_timestamp: '2022-03-01T00:00:00Z',\n tx_hash:\n '0xb2256b183f2fb3872f99294ab55fb03e6a479b0d4aca556a3b27568b712505a6',\n unread: true,\n created_at: '2022-03-01T00:00:00Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'erc20_received',\n network_fee: {\n gas_price: '207806259583',\n native_token_price_in_usd: '0.83',\n },\n to: '0xeae7380dd4cef6fbd1144f49e4d1e6964258a4f4',\n from: '0x51c72848c68a965f66fa7a88855f9f7784502a7f',\n token: {\n usd: '0.00',\n name: 'SHIBA INU',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/shib.svg',\n amount: '8382798736999999457296646144',\n symbol: 'SHIB',\n address: '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce',\n decimals: '18',\n },\n },\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC721 sent notification\n * @returns Mock raw ERC721 sent notification\n */\nexport function createMockNotificationERC721Sent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC721_SENT,\n block_number: 18576643,\n block_timestamp: '1700043467',\n chain_id: 1,\n created_at: '2023-11-15T11:08:17.895407Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0xf47f628fe3bd2595e9ab384bfffc3859b448e451',\n nft: {\n name: 'Captainz #8680',\n image:\n 'https://i.seadn.io/s/raw/files/ae0fc06714ff7fb40217340d8a242c0e.gif?w=500&auto=format',\n token_id: '8680',\n collection: {\n name: 'The Captainz',\n image:\n 'https://i.seadn.io/gcs/files/6df4d75778066bce740050615bc84e21.png?w=500&auto=format',\n symbol: 'Captainz',\n address: '0x769272677fab02575e84945f03eca517acc544cc',\n },\n },\n from: '0x24a0bb54b7e7a8e406e9b28058a9fd6c49e6df4f',\n kind: 'erc721_sent',\n network_fee: {\n gas_price: '24550653274',\n native_token_price_in_usd: '1986.61',\n },\n },\n id: 'a4193058-9814-537e-9df4-79dcac727fb6',\n trigger_id: '028485be-b994-422b-a93b-03fcc01ab715',\n tx_hash:\n '0x0833c69fb41cf972a0f031fceca242939bc3fcf82b964b74606649abcad371bd',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC721 received notification\n * @returns Mock raw ERC721 received notification\n */\nexport function createMockNotificationERC721Received(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC721_RECEIVED,\n block_number: 18571446,\n block_timestamp: '1699980623',\n chain_id: 1,\n created_at: '2023-11-14T17:40:52.319281Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0xba7f3daa8adfdad686574406ab9bd5d2f0a49d2e',\n nft: {\n name: 'The Plague #2722',\n image:\n 'https://i.seadn.io/s/raw/files/a96f90ec8ebf55a2300c66a0c46d6a16.png?w=500&auto=format',\n token_id: '2722',\n collection: {\n name: 'The Plague NFT',\n image:\n 'https://i.seadn.io/gcs/files/4577987a5ca45ca5118b2e31559ee4d1.jpg?w=500&auto=format',\n symbol: 'FROG',\n address: '0xc379e535caff250a01caa6c3724ed1359fe5c29b',\n },\n },\n from: '0x24a0bb54b7e7a8e406e9b28058a9fd6c49e6df4f',\n kind: 'erc721_received',\n network_fee: {\n gas_price: '53701898538',\n native_token_price_in_usd: '2047.01',\n },\n },\n id: '00a79d24-befa-57ed-a55a-9eb8696e1654',\n trigger_id: 'd24ac26a-8579-49ec-9947-d04d63592ebd',\n tx_hash:\n '0xe554c9e29e6eeca8ba94da4d047334ba08b8eb9ca3b801dd69cec08dfdd4ae43',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC1155 sent notification\n * @returns Mock raw ERC1155 sent notification\n */\nexport function createMockNotificationERC1155Sent(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC1155_SENT,\n block_number: 18615206,\n block_timestamp: '1700510003',\n chain_id: 1,\n created_at: '2023-11-20T20:44:10.110706Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0x15bd77ccacf2da39b84f0c31fee2e451225bb190',\n nft: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gcs/files/79a77cb37c7b2f1069f752645d29fea7.jpg?w=500&auto=format',\n token_id: '1',\n collection: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gae/LTKz3om2eCQfn3M6PkqEmY7KhLtdMCOm0QVch2318KJq7-KyToCH7NBTMo4UuJ0AZI-oaBh1HcgrAEIEWYbXY3uMcYpuGXunaXEh?w=500&auto=format',\n symbol: 'TRUTH',\n address: '0xe25f0fe686477f9df3c2876c4902d3b85f75f33a',\n },\n },\n from: '0x0000000000000000000000000000000000000000',\n kind: 'erc1155_sent',\n network_fee: {\n gas_price: '33571446596',\n native_token_price_in_usd: '2038.88',\n },\n },\n id: 'a09ff9d1-623a-52ab-a3d4-c7c8c9a58362',\n trigger_id: 'e2130f7d-78b8-4c34-999a-3f3d3bb5b03c',\n tx_hash:\n '0x03381aba290facbaf71c123e263c8dc3dd550aac00ef589cce395182eaeff76f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock ERC1155 received notification\n * @returns Mock raw ERC1155 received notification\n */\nexport function createMockNotificationERC1155Received(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ERC1155_RECEIVED,\n block_number: 18615206,\n block_timestamp: '1700510003',\n chain_id: 1,\n created_at: '2023-11-20T20:44:10.110706Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n to: '0x15bd77ccacf2da39b84f0c31fee2e451225bb190',\n nft: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gcs/files/79a77cb37c7b2f1069f752645d29fea7.jpg?w=500&auto=format',\n token_id: '1',\n collection: {\n name: 'IlluminatiNFT DAO',\n image:\n 'https://i.seadn.io/gae/LTKz3om2eCQfn3M6PkqEmY7KhLtdMCOm0QVch2318KJq7-KyToCH7NBTMo4UuJ0AZI-oaBh1HcgrAEIEWYbXY3uMcYpuGXunaXEh?w=500&auto=format',\n symbol: 'TRUTH',\n address: '0xe25f0fe686477f9df3c2876c4902d3b85f75f33a',\n },\n },\n from: '0x0000000000000000000000000000000000000000',\n kind: 'erc1155_received',\n network_fee: {\n gas_price: '33571446596',\n native_token_price_in_usd: '2038.88',\n },\n },\n id: 'b6b93c84-e8dc-54ed-9396-7ea50474843a',\n trigger_id: '710c8abb-43a9-42a5-9d86-9dd258726c82',\n tx_hash:\n '0x03381aba290facbaf71c123e263c8dc3dd550aac00ef589cce395182eaeff76f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock MetaMask Swaps notification\n * @returns Mock raw MetaMask Swaps notification\n */\nexport function createMockNotificationMetaMaskSwapsCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.METAMASK_SWAP_COMPLETED,\n block_number: 18377666,\n block_timestamp: '1697637275',\n chain_id: 1,\n created_at: '2023-10-18T13:58:49.854596Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'metamask_swap_completed',\n rate: '1558.27',\n token_in: {\n usd: '1576.73',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '9000000000000000',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n token_out: {\n usd: '1.00',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/usdt.svg',\n amount: '14024419',\n symbol: 'USDT',\n address: '0xdac17f958d2ee523a2206206994597c13d831ec7',\n decimals: '6',\n name: 'USDT',\n },\n network_fee: {\n gas_price: '15406129273',\n native_token_price_in_usd: '1576.73',\n },\n },\n id: '7ddfe6a1-ac52-5ffe-aa40-f04242db4b8b',\n trigger_id: 'd2eaa2eb-2e6e-4fd5-8763-b70ea571b46c',\n tx_hash:\n '0xf69074290f3aa11bce567aabc9ca0df7a12559dfae1b80ba1a124e9dfe19ecc5',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock RocketPool Stake Completed notification\n * @returns Mock raw RocketPool Stake Completed notification\n */\nexport function createMockNotificationRocketPoolStakeCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED,\n block_number: 18585057,\n block_timestamp: '1700145059',\n chain_id: 1,\n created_at: '2023-11-20T12:02:48.796824Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'rocketpool_stake_completed',\n stake_in: {\n usd: '2031.86',\n name: 'Ethereum',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '190690478063438272',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n },\n stake_out: {\n usd: '2226.49',\n name: 'Rocket Pool ETH',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/rETH.svg',\n amount: '175024360778165879',\n symbol: 'RETH',\n address: '0xae78736Cd615f374D3085123A210448E74Fc6393',\n decimals: '18',\n },\n network_fee: {\n gas_price: '36000000000',\n native_token_price_in_usd: '2031.86',\n },\n },\n id: 'c2a2f225-b2fb-5d6c-ba56-e27a5c71ffb9',\n trigger_id: '5110ff97-acff-40c0-83b4-11d487b8c7b0',\n tx_hash:\n '0xcfc0693bf47995907b0f46ef0644cf16dd9a0de797099b2e00fd481e1b2117d3',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock RocketPool Un-staked notification\n * @returns Mock raw RocketPool Un-staked notification\n */\nexport function createMockNotificationRocketPoolUnStakeCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED,\n block_number: 18384336,\n block_timestamp: '1697718011',\n chain_id: 1,\n created_at: '2023-10-19T13:11:10.623042Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'rocketpool_unstake_completed',\n stake_in: {\n usd: '1686.34',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/rETH.svg',\n amount: '66608041413696770',\n symbol: 'RETH',\n address: '0xae78736Cd615f374D3085123A210448E74Fc6393',\n decimals: '18',\n name: 'Rocketpool Eth',\n },\n stake_out: {\n usd: '1553.75',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '72387843427700824',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n network_fee: {\n gas_price: '5656322987',\n native_token_price_in_usd: '1553.75',\n },\n },\n id: 'd8c246e7-a0a4-5f1d-b079-2b1707665fbc',\n trigger_id: '291ec897-f569-4837-b6c0-21001b198dff',\n tx_hash:\n '0xc7972a7e409abfc62590ec90e633acd70b9b74e76ad02305be8bf133a0e22d5f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Stake Completed notification\n * @returns Mock raw Lido Stake Completed notification\n */\nexport function createMockNotificationLidoStakeCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_STAKE_COMPLETED,\n block_number: 18487118,\n block_timestamp: '1698961091',\n chain_id: 1,\n created_at: '2023-11-02T22:28:49.970865Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_stake_completed',\n stake_in: {\n usd: '1806.33',\n name: 'Ethereum',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '330303634023928032',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n },\n stake_out: {\n usd: '1801.30',\n name: 'Liquid staked Ether 2.0',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg',\n amount: '330303634023928032',\n symbol: 'STETH',\n address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',\n decimals: '18',\n },\n network_fee: {\n gas_price: '26536359866',\n native_token_price_in_usd: '1806.33',\n },\n },\n id: '9d9b1467-b3ee-5492-8ca2-22382657b690',\n trigger_id: 'ec10d66a-f78f-461f-83c9-609aada8cc50',\n tx_hash:\n '0x8cc0fa805f7c3b1743b14f3b91c6b824113b094f26d4ccaf6a71ad8547ce6a0f',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Withdrawal Requested notification\n * @returns Mock raw Lido Withdrawal Requested notification\n */\nexport function createMockNotificationLidoWithdrawalRequested(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED,\n block_number: 18377760,\n block_timestamp: '1697638415',\n chain_id: 1,\n created_at: '2023-10-18T15:04:02.482526Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_withdrawal_requested',\n stake_in: {\n usd: '1568.54',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg',\n amount: '97180668792218669859',\n symbol: 'STETH',\n address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',\n decimals: '18',\n name: 'Staked Eth',\n },\n stake_out: {\n usd: '1576.73',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '97180668792218669859',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n network_fee: {\n gas_price: '11658906980',\n native_token_price_in_usd: '1576.73',\n },\n },\n id: '29ddc718-78c6-5f91-936f-2bef13a605f0',\n trigger_id: 'ef003925-3379-4ba7-9e2d-8218690cadc8',\n tx_hash:\n '0x58b5f82e084cb750ea174e02b20fbdfd2ba8d78053deac787f34fc38e5d427aa',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Withdrawal Completed notification\n * @returns Mock raw Lido Withdrawal Completed notification\n */\nexport function createMockNotificationLidoWithdrawalCompleted(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED,\n block_number: 18378208,\n block_timestamp: '1697643851',\n chain_id: 1,\n created_at: '2023-10-18T16:35:03.147606Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_withdrawal_completed',\n stake_in: {\n usd: '1570.23',\n image:\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/stETH.svg',\n amount: '35081997661451346',\n symbol: 'STETH',\n address: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',\n decimals: '18',\n name: 'Staked Eth',\n },\n stake_out: {\n usd: '1571.74',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n amount: '35081997661451346',\n symbol: 'ETH',\n address: '0x0000000000000000000000000000000000000000',\n decimals: '18',\n name: 'Ethereum',\n },\n network_fee: {\n gas_price: '12699495150',\n native_token_price_in_usd: '1571.74',\n },\n },\n id: 'f4ef0b7f-5612-537f-9144-0b5c63ae5391',\n trigger_id: 'd73df14d-ce73-4f38-bad3-ab028154042c',\n tx_hash:\n '0xe6d210d2e601ef3dd1075c48e71452cf35f2daae3886911e964e3babad8ac657',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - create a mock Lido Withdrawal Ready notification\n * @returns Mock raw Lido Withdrawal Ready notification\n */\nexport function createMockNotificationLidoReadyToBeWithdrawn(): OnChainRawNotification {\n const mockNotification: OnChainRawNotification = {\n type: TRIGGER_TYPES.LIDO_STAKE_READY_TO_BE_WITHDRAWN,\n block_number: 18378208,\n block_timestamp: '1697643851',\n chain_id: 1,\n created_at: '2023-10-18T16:35:03.147606Z',\n address: '0x881D40237659C251811CEC9c364ef91dC08D300C',\n data: {\n kind: 'lido_stake_ready_to_be_withdrawn',\n request_id: '123456789',\n staked_eth: {\n address: '0x881D40237659C251811CEC9c364ef91dC08D300F',\n symbol: 'ETH',\n name: 'Ethereum',\n amount: '2.5',\n decimals: '18',\n image:\n 'https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg',\n usd: '10000.00',\n },\n },\n id: 'f4ef0b7f-5612-537f-9144-0b5c63ae5391',\n trigger_id: 'd73df14d-ce73-4f38-bad3-ab028154042c',\n tx_hash:\n '0xe6d210d2e601ef3dd1075c48e71452cf35f2daae3886911e964e3babad8ac657',\n unread: true,\n };\n\n return mockNotification;\n}\n\n/**\n * Mocking Utility - creates an array of raw on-chain notifications\n * @returns Array of raw on-chain notifications\n */\nexport function createMockRawOnChainNotifications(): OnChainRawNotification[] {\n return [1, 2, 3].map((id) => {\n const notification = createMockNotificationEthSent();\n notification.id += `-${id}`;\n return notification;\n });\n}\n","import { FEATURE_ANNOUNCEMENT_API } from '../services/feature-announcements';\nimport {\n NOTIFICATION_API_LIST_ENDPOINT,\n NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n TRIGGER_API_BATCH_ENDPOINT,\n} from '../services/onchain-notifications';\nimport { createMockFeatureAnnouncementAPIResult } from './mock-feature-announcements';\nimport { createMockRawOnChainNotifications } from './mock-raw-notifications';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const CONTENTFUL_RESPONSE = createMockFeatureAnnouncementAPIResult();\n\nexport const getMockFeatureAnnouncementResponse = () => {\n return {\n url: FEATURE_ANNOUNCEMENT_API,\n requestMethod: 'GET',\n response: CONTENTFUL_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockBatchCreateTriggersResponse = () => {\n return {\n url: TRIGGER_API_BATCH_ENDPOINT,\n requestMethod: 'POST',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockBatchDeleteTriggersResponse = () => {\n return {\n url: TRIGGER_API_BATCH_ENDPOINT,\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const MOCK_RAW_ON_CHAIN_NOTIFICATIONS =\n createMockRawOnChainNotifications();\n\nexport const getMockListNotificationsResponse = () => {\n return {\n url: NOTIFICATION_API_LIST_ENDPOINT,\n requestMethod: 'POST',\n response: MOCK_RAW_ON_CHAIN_NOTIFICATIONS,\n } satisfies MockResponse;\n};\n\nexport const getMockMarkNotificationsAsReadResponse = () => {\n return {\n url: NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n requestMethod: 'POST',\n response: null,\n } satisfies MockResponse;\n};\n"]}
|