@metamask-previews/notification-services-controller 0.0.0-preview-23a96ae → 0.0.0-preview-7ff4bd7f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/NotificationServicesController/NotificationServicesController.js +3 -3
  2. package/dist/NotificationServicesController/NotificationServicesController.mjs +3 -3
  3. package/dist/NotificationServicesController/index.js +4 -4
  4. package/dist/NotificationServicesController/index.mjs +4 -4
  5. package/dist/NotificationServicesController/services/onchain-notifications.js +2 -2
  6. package/dist/NotificationServicesController/services/onchain-notifications.mjs +1 -1
  7. package/dist/NotificationServicesPushController/NotificationServicesPushController.js +5 -5
  8. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +5 -5
  9. package/dist/NotificationServicesPushController/index.js +6 -6
  10. package/dist/NotificationServicesPushController/index.mjs +6 -6
  11. package/dist/NotificationServicesPushController/services/push/push-web.js +3 -3
  12. package/dist/NotificationServicesPushController/services/push/push-web.mjs +3 -3
  13. package/dist/NotificationServicesPushController/services/services.js +3 -3
  14. package/dist/NotificationServicesPushController/services/services.mjs +3 -3
  15. package/dist/NotificationServicesPushController/utils/get-notification-message.js +3 -3
  16. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +3 -3
  17. package/dist/NotificationServicesPushController/utils/index.js +3 -3
  18. package/dist/NotificationServicesPushController/utils/index.mjs +3 -3
  19. package/dist/{chunk-AXZU6W3P.js → chunk-3NF7QYJN.js} +7 -7
  20. package/dist/chunk-3NF7QYJN.js.map +1 -0
  21. package/dist/{chunk-53Y2GNFU.js → chunk-3O5NGZWB.js} +336 -1
  22. package/dist/chunk-3O5NGZWB.js.map +1 -0
  23. package/dist/{chunk-5WWCWQCE.js → chunk-DKQBDI4C.js} +1 -1
  24. package/dist/chunk-DKQBDI4C.js.map +1 -0
  25. package/dist/{chunk-G5RGQ3AG.js → chunk-EG5NZ5DA.js} +5 -5
  26. package/dist/chunk-EG5NZ5DA.js.map +1 -0
  27. package/dist/{chunk-F6TSWKZK.mjs → chunk-IG3CMJBW.mjs} +336 -1
  28. package/dist/chunk-IG3CMJBW.mjs.map +1 -0
  29. package/dist/{chunk-ZDG7PIUJ.js → chunk-KPO4QJHS.js} +10 -10
  30. package/dist/chunk-KPO4QJHS.js.map +1 -0
  31. package/dist/{chunk-OUPWMPLU.mjs → chunk-ODZ6V4PH.mjs} +1 -1
  32. package/dist/chunk-ODZ6V4PH.mjs.map +1 -0
  33. package/dist/{chunk-6PPEQMF5.mjs → chunk-RNE2I5IN.mjs} +4 -4
  34. package/dist/chunk-RNE2I5IN.mjs.map +1 -0
  35. package/dist/{chunk-KKWCKF5W.mjs → chunk-UZXBH6WS.mjs} +2 -2
  36. package/dist/chunk-UZXBH6WS.mjs.map +1 -0
  37. package/dist/{chunk-G2ROCNJN.mjs → chunk-ZJRT7ACU.mjs} +4 -4
  38. package/dist/chunk-ZJRT7ACU.mjs.map +1 -0
  39. package/dist/index.js +6 -6
  40. package/dist/index.mjs +5 -5
  41. package/dist/tsconfig.build.tsbuildinfo +1 -1
  42. package/dist/types/NotificationServicesController/NotificationServicesController.d.ts +1 -1
  43. package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +1 -1
  44. package/dist/types/NotificationServicesController/index.d.ts +2 -0
  45. package/dist/types/NotificationServicesController/index.d.ts.map +1 -1
  46. package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts +1 -1
  47. package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +1 -1
  48. package/dist/types/NotificationServicesPushController/index.d.ts +2 -0
  49. package/dist/types/NotificationServicesPushController/index.d.ts.map +1 -1
  50. package/package.json +1 -1
  51. package/dist/chunk-53Y2GNFU.js.map +0 -1
  52. package/dist/chunk-5WWCWQCE.js.map +0 -1
  53. package/dist/chunk-6PPEQMF5.mjs.map +0 -1
  54. package/dist/chunk-AXZU6W3P.js.map +0 -1
  55. package/dist/chunk-F6TSWKZK.mjs.map +0 -1
  56. package/dist/chunk-G2ROCNJN.mjs.map +0 -1
  57. package/dist/chunk-G5RGQ3AG.js.map +0 -1
  58. package/dist/chunk-KKWCKF5W.mjs.map +0 -1
  59. package/dist/chunk-OUPWMPLU.mjs.map +0 -1
  60. package/dist/chunk-ZDG7PIUJ.js.map +0 -1
@@ -7,7 +7,7 @@ var _chunk232HZSEVjs = require('./chunk-232HZSEV.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkAXZU6W3Pjs = require('./chunk-AXZU6W3P.js');
10
+ var _chunk3NF7QYJNjs = require('./chunk-3NF7QYJN.js');
11
11
 
12
12
 
13
13
  var _chunkZMNXLHACjs = require('./chunk-ZMNXLHAC.js');
@@ -16,7 +16,7 @@ var _chunkZMNXLHACjs = require('./chunk-ZMNXLHAC.js');
16
16
 
17
17
 
18
18
 
19
- var _chunk53Y2GNFUjs = require('./chunk-53Y2GNFU.js');
19
+ var _chunk3O5NGZWBjs = require('./chunk-3O5NGZWB.js');
20
20
 
21
21
 
22
22
  var _chunkPIZCE3JDjs = require('./chunk-PIZCE3JD.js');
@@ -35,11 +35,11 @@ var _chunkV46WVGWNjs = require('./chunk-V46WVGWN.js');
35
35
  var NotificationServicesController_exports = {};
36
36
  _chunkV46WVGWNjs.__export.call(void 0, NotificationServicesController_exports, {
37
37
  Constants: () => _chunkCQ6CGSKZjs.constants_exports,
38
+ Controller: () => _chunk3NF7QYJNjs.NotificationServicesController,
38
39
  Mocks: () => fixtures_exports,
39
- NotificationServicesController: () => _chunkAXZU6W3Pjs.NotificationServicesController,
40
40
  Processors: () => _chunkUPVIT75Fjs.processors_exports,
41
41
  Types: () => _chunk232HZSEVjs.types_exports,
42
- defaultState: () => _chunkAXZU6W3Pjs.defaultState
42
+ defaultState: () => _chunk3NF7QYJNjs.defaultState
43
43
  });
44
44
 
45
45
  // src/NotificationServicesController/__fixtures__/index.ts
@@ -897,14 +897,14 @@ var getMockFeatureAnnouncementResponse = () => {
897
897
  };
898
898
  var getMockBatchCreateTriggersResponse = () => {
899
899
  return {
900
- url: _chunk53Y2GNFUjs.TRIGGER_API_BATCH_ENDPOINT,
900
+ url: _chunk3O5NGZWBjs.TRIGGER_API_BATCH_ENDPOINT,
901
901
  requestMethod: "POST",
902
902
  response: null
903
903
  };
904
904
  };
905
905
  var getMockBatchDeleteTriggersResponse = () => {
906
906
  return {
907
- url: _chunk53Y2GNFUjs.TRIGGER_API_BATCH_ENDPOINT,
907
+ url: _chunk3O5NGZWBjs.TRIGGER_API_BATCH_ENDPOINT,
908
908
  requestMethod: "DELETE",
909
909
  response: null
910
910
  };
@@ -912,21 +912,21 @@ var getMockBatchDeleteTriggersResponse = () => {
912
912
  var MOCK_RAW_ON_CHAIN_NOTIFICATIONS = createMockRawOnChainNotifications();
913
913
  var getMockListNotificationsResponse = () => {
914
914
  return {
915
- url: _chunk53Y2GNFUjs.NOTIFICATION_API_LIST_ENDPOINT,
915
+ url: _chunk3O5NGZWBjs.NOTIFICATION_API_LIST_ENDPOINT,
916
916
  requestMethod: "POST",
917
917
  response: MOCK_RAW_ON_CHAIN_NOTIFICATIONS
918
918
  };
919
919
  };
920
920
  var getMockMarkNotificationsAsReadResponse = () => {
921
921
  return {
922
- url: _chunk53Y2GNFUjs.NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,
922
+ url: _chunk3O5NGZWBjs.NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,
923
923
  requestMethod: "POST",
924
924
  response: null
925
925
  };
926
926
  };
927
927
 
928
928
  // src/NotificationServicesController/__fixtures__/mockServices.ts
929
- var import_nock = _chunkV46WVGWNjs.__toESM.call(void 0, _chunk53Y2GNFUjs.require_nock.call(void 0, ));
929
+ var import_nock = _chunkV46WVGWNjs.__toESM.call(void 0, _chunk3O5NGZWBjs.require_nock.call(void 0, ));
930
930
  var mockFetchFeatureAnnouncementNotifications = (mockReply) => {
931
931
  const mockResponse = getMockFeatureAnnouncementResponse();
932
932
  const reply = mockReply ?? { status: 200, body: mockResponse.response };
@@ -962,4 +962,4 @@ var mockMarkNotificationsAsRead = (mockReply) => {
962
962
 
963
963
 
964
964
  exports.fixtures_exports = fixtures_exports; exports.NotificationServicesController_exports = NotificationServicesController_exports;
965
- //# sourceMappingURL=chunk-ZDG7PIUJ.js.map
965
+ //# sourceMappingURL=chunk-KPO4QJHS.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","../src/NotificationServicesController/__fixtures__/mockServices.ts"],"names":["nock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;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,WA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YAAAA,SAAK,aAAa,GAAG,EACvC,KAAK,EAAE,EACP,MAAM,MAAM,QAAQ,MAAM,IAAI;AAEjC,SAAO;AACT;AAEO,IAAM,0BAA0B,CAAC,cAA0B;AAChE,QAAM,eAAe,mCAAmC;AACxD,QAAM,QAAQ,aAAa,EAAE,QAAQ,IAAI;AAEzC,QAAM,mBAAe,YAAAA,SAAK,aAAa,GAAG,EACvC,OAAO,EAAE,EACT,MAAM,MAAM,QAAQ,MAAM,IAAI;AAEjC,SAAO;AACT;AAEO,IAAM,wBAAwB,CAAC,cAA0B;AAC9D,QAAM,eAAe,iCAAiC;AACtD,QAAM,QAAQ,aAAa,EAAE,QAAQ,KAAK,MAAM,aAAa,SAAS;AAEtE,QAAM,mBAAe,YAAAA,SAAK,aAAa,GAAG,EACvC,KAAK,EAAE,EACP,MAAM,IAAI,EACV,MAAM,MAAM,QAAQ,MAAM,IAAI;AAEjC,SAAO;AACT;AAEO,IAAM,8BAA8B,CAAC,cAA0B;AACpE,QAAM,eAAe,uCAAuC;AAC5D,QAAM,QAAQ,aAAa,EAAE,QAAQ,IAAI;AAEzC,QAAM,mBAAe,YAAAA,SAAK,aAAa,GAAG,EACvC,KAAK,EAAE,EACP,MAAM,MAAM,QAAQ,MAAM,IAAI;AAEjC,SAAO;AACT","sourcesContent":["import Controller from './NotificationServicesController';\n\nexport { Controller };\nexport * from './NotificationServicesController';\nexport * as Types from './types';\nexport * as Mocks from './__fixtures__';\nexport * as Processors from './processors';\nexport * as Constants from './constants';\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';\nexport * from './mockServices';\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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","import nock from 'nock';\n\nimport {\n getMockBatchCreateTriggersResponse,\n getMockBatchDeleteTriggersResponse,\n getMockFeatureAnnouncementResponse,\n getMockListNotificationsResponse,\n getMockMarkNotificationsAsReadResponse,\n} from './mockResponses';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nexport const mockFetchFeatureAnnouncementNotifications = (\n mockReply?: MockReply,\n) => {\n const mockResponse = getMockFeatureAnnouncementResponse();\n const reply = mockReply ?? { status: 200, body: mockResponse.response };\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .query(true)\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockBatchCreateTriggers = (mockReply?: MockReply) => {\n const mockResponse = getMockBatchCreateTriggersResponse();\n const reply = mockReply ?? { status: 204 };\n\n const mockEndpoint = nock(mockResponse.url)\n .post('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockBatchDeleteTriggers = (mockReply?: MockReply) => {\n const mockResponse = getMockBatchDeleteTriggersResponse();\n const reply = mockReply ?? { status: 204 };\n\n const mockEndpoint = nock(mockResponse.url)\n .delete('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockListNotifications = (mockReply?: MockReply) => {\n const mockResponse = getMockListNotificationsResponse();\n const reply = mockReply ?? { status: 200, body: mockResponse.response };\n\n const mockEndpoint = nock(mockResponse.url)\n .post('')\n .query(true)\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockMarkNotificationsAsRead = (mockReply?: MockReply) => {\n const mockResponse = getMockMarkNotificationsAsReadResponse();\n const reply = mockReply ?? { status: 200 };\n\n const mockEndpoint = nock(mockResponse.url)\n .post('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n"]}
@@ -211,4 +211,4 @@ getAndAssertBearerToken_fn = async function() {
211
211
  export {
212
212
  NotificationServicesPushController
213
213
  };
214
- //# sourceMappingURL=chunk-OUPWMPLU.mjs.map
214
+ //# sourceMappingURL=chunk-ODZ6V4PH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesPushController/NotificationServicesPushController.ts"],"sourcesContent":["import type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport type { Types } from '../NotificationServicesController';\nimport { createRegToken, deleteRegToken } from './services/push/push-web';\nimport {\n activatePushNotifications,\n deactivatePushNotifications,\n listenToPushNotifications,\n updateTriggerPushNotifications,\n} from './services/services';\nimport type { PushNotificationEnv } from './types';\n\nconst controllerName = 'NotificationServicesPushController';\n\nexport type NotificationServicesPushControllerState = {\n fcmToken: string;\n};\n\nexport type NotificationServicesPushControllerEnablePushNotificationsAction = {\n type: `${typeof controllerName}:enablePushNotifications`;\n handler: NotificationServicesPushController['enablePushNotifications'];\n};\n\nexport type NotificationServicesPushControllerDisablePushNotificationsAction = {\n type: `${typeof controllerName}:disablePushNotifications`;\n handler: NotificationServicesPushController['disablePushNotifications'];\n};\nexport type NotificationServicesPushControllerUpdateTriggerPushNotificationsAction =\n {\n type: `${typeof controllerName}:updateTriggerPushNotifications`;\n handler: NotificationServicesPushController['updateTriggerPushNotifications'];\n };\n\nexport type Actions =\n | NotificationServicesPushControllerEnablePushNotificationsAction\n | NotificationServicesPushControllerDisablePushNotificationsAction\n | NotificationServicesPushControllerUpdateTriggerPushNotificationsAction\n | ControllerGetStateAction<'state', NotificationServicesPushControllerState>;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type NotificationServicesPushControllerOnNewNotificationEvent = {\n type: `${typeof controllerName}:onNewNotifications`;\n payload: [Types.INotification];\n};\n\nexport type NotificationServicesPushControllerPushNotificationClicked = {\n type: `${typeof controllerName}:pushNotificationClicked`;\n payload: [Types.INotification];\n};\n\nexport type AllowedEvents =\n | NotificationServicesPushControllerOnNewNotificationEvent\n | NotificationServicesPushControllerPushNotificationClicked;\n\nexport type NotificationServicesPushControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n >;\n\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: {\n fcmToken: state?.fcmToken || '',\n },\n });\n\n this.#env = env;\n this.#config = config;\n\n this.#registerMessageHandlers();\n }\n\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:enablePushNotifications',\n this.enablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:disablePushNotifications',\n this.disablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:updateTriggerPushNotifications',\n this.updateTriggerPushNotifications.bind(this),\n );\n }\n\n async #getAndAssertBearerToken() {\n const bearerToken = await this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n );\n if (!bearerToken) {\n log.error(\n 'Failed to enable push notifications: BearerToken token is missing.',\n );\n throw new Error('BearerToken token is missing');\n }\n\n return bearerToken;\n }\n\n /**\n * Enables push notifications for the application.\n *\n * This method sets up the necessary infrastructure for handling push notifications by:\n * 1. Registering the service worker to listen for messages.\n * 2. Fetching the Firebase Cloud Messaging (FCM) token from Firebase.\n * 3. Sending the FCM token to the server responsible for sending notifications, to register the device.\n *\n * @param UUIDs - An array of UUIDs to enable push notifications for.\n */\n async enablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n\n try {\n // Activate Push Notifications\n const regToken = await activatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n platform: this.#config.platform,\n });\n\n if (!regToken) {\n return;\n }\n\n this.#pushListenerUnsubscribe = await listenToPushNotifications({\n env: this.#env,\n listenToPushReceived: async (n) => {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:onNewNotifications',\n n,\n );\n await this.#config.onPushNotificationReceived(n);\n },\n listenToPushClicked: (e, n) => {\n if (n) {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:pushNotificationClicked',\n n,\n );\n }\n\n this.#config.onPushNotificationClicked(e);\n },\n });\n\n // Update state\n this.update((state) => {\n state.fcmToken = regToken;\n });\n } catch (error) {\n log.error('Failed to enable push notifications:', error);\n throw new Error('Failed to enable push notifications');\n }\n }\n\n /**\n * Disables push notifications for the application.\n * This method handles the process of disabling push notifications by:\n * 1. Unregistering the service worker to stop listening for messages.\n * 2. Sending a request to the server to unregister the device using the FCM token.\n * 3. Removing the FCM token from the state to complete the process.\n *\n * @param UUIDs - An array of UUIDs for which push notifications should be disabled.\n */\n async disablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n let isPushNotificationsDisabled: boolean;\n\n try {\n // Send a request to the server to unregister the token/device\n isPushNotificationsDisabled = await deactivatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n deleteRegToken,\n regToken: this.state.fcmToken,\n });\n } catch (error) {\n const errorMessage = `Failed to disable push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n // Remove the FCM token from the state\n if (!isPushNotificationsDisabled) {\n return;\n }\n\n // Unsubscribe from push notifications\n this.#pushListenerUnsubscribe?.();\n\n // Update State\n if (isPushNotificationsDisabled) {\n this.update((state) => {\n state.fcmToken = '';\n });\n }\n }\n\n /**\n * Updates the triggers for push notifications.\n * This method is responsible for updating the server with the new set of UUIDs that should trigger push notifications.\n * It uses the current FCM token and a BearerToken for authentication.\n *\n * @param UUIDs - An array of UUIDs that should trigger push notifications.\n */\n async updateTriggerPushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n\n try {\n const { fcmToken } = await updateTriggerPushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n deleteRegToken,\n platform: this.#config.platform,\n regToken: this.state.fcmToken,\n });\n\n // update the state with the new FCM token\n if (fcmToken) {\n this.update((state) => {\n state.fcmToken = fcmToken;\n });\n }\n } catch (error) {\n const errorMessage = `Failed to update triggers for push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n }\n}\n"],"mappings":";;;;;;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AAAA,QACvB,UAAU,KAAK,MAAM;AAAA,MACvB,CAAC;AAGD,UAAI,UAAU;AACZ,aAAK,OAAO,CAAC,UAAU;AACrB,gBAAM,WAAW;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,qDACnB,KACF;AACA,UAAI,MAAM,YAAY;AACtB,YAAM,IAAI,MAAM,YAAY;AAAA,IAC9B;AAAA,EACF;AACF;AApNE;AAEA;AAEA;AA4BA;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":[]}
@@ -6,13 +6,13 @@ import {
6
6
  } from "./chunk-IOMDG67D.mjs";
7
7
  import {
8
8
  NotificationServicesPushController
9
- } from "./chunk-OUPWMPLU.mjs";
9
+ } from "./chunk-ODZ6V4PH.mjs";
10
10
  import {
11
11
  REGISTRATION_TOKENS_ENDPOINT
12
12
  } from "./chunk-IKWNHNJQ.mjs";
13
13
  import {
14
14
  require_nock
15
- } from "./chunk-F6TSWKZK.mjs";
15
+ } from "./chunk-IG3CMJBW.mjs";
16
16
  import {
17
17
  __export,
18
18
  __toESM
@@ -21,8 +21,8 @@ import {
21
21
  // src/NotificationServicesPushController/index.ts
22
22
  var NotificationServicesPushController_exports = {};
23
23
  __export(NotificationServicesPushController_exports, {
24
+ Controller: () => NotificationServicesPushController,
24
25
  Mocks: () => fixtures_exports,
25
- NotificationServicesPushController: () => NotificationServicesPushController,
26
26
  Types: () => types_exports,
27
27
  Utils: () => utils_exports
28
28
  });
@@ -116,4 +116,4 @@ export {
116
116
  fixtures_exports,
117
117
  NotificationServicesPushController_exports
118
118
  };
119
- //# sourceMappingURL=chunk-6PPEQMF5.mjs.map
119
+ //# sourceMappingURL=chunk-RNE2I5IN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesPushController/index.ts","../src/NotificationServicesPushController/__fixtures__/index.ts","../src/NotificationServicesPushController/__fixtures__/mockResponse.ts","../src/NotificationServicesPushController/__fixtures__/mockServices.ts"],"sourcesContent":["import Controller from './NotificationServicesPushController';\n\nexport { Controller };\nexport * from './NotificationServicesPushController';\nexport * as Types from './types';\nexport * as Utils from './utils';\nexport * as Mocks from './__fixtures__';\n","export * from './mockResponse';\nexport * from './mockServices';\n","import { REGISTRATION_TOKENS_ENDPOINT } from '../services/endpoints';\nimport type { LinksResult } from '../services/services';\n\ntype MockResponse = {\n url: string | RegExp;\n requestMethod: 'GET' | 'POST' | 'PUT';\n response: unknown;\n};\n\nexport const MOCK_REG_TOKEN = 'REG_TOKEN';\nexport const MOCK_LINKS_RESPONSE: LinksResult = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n trigger_ids: ['1', '2', '3'],\n // eslint-disable-next-line @typescript-eslint/naming-convention\n registration_tokens: [\n { token: 'reg_token_1', platform: 'portfolio' },\n { token: 'reg_token_2', platform: 'extension' },\n ],\n};\n\nexport const getMockRetrievePushNotificationLinksResponse = () => {\n return {\n url: REGISTRATION_TOKENS_ENDPOINT,\n requestMethod: 'GET',\n response: MOCK_LINKS_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockUpdatePushNotificationLinksResponse = () => {\n return {\n url: REGISTRATION_TOKENS_ENDPOINT,\n requestMethod: 'POST',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const MOCK_FCM_RESPONSE = {\n name: '',\n token: 'fcm-token',\n web: {\n endpoint: '',\n p256dh: '',\n auth: '',\n applicationPubKey: '',\n },\n};\n\nexport const getMockCreateFCMRegistrationTokenResponse = () => {\n return {\n url: /^https:\\/\\/fcmregistrations\\.googleapis\\.com\\/v1\\/projects\\/.*$/u,\n requestMethod: 'POST',\n response: MOCK_FCM_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const getMockDeleteFCMRegistrationTokenResponse = () => {\n return {\n url: /^https:\\/\\/fcmregistrations\\.googleapis\\.com\\/v1\\/projects\\/.*$/u,\n requestMethod: 'POST',\n response: {},\n } satisfies MockResponse;\n};\n","import nock from 'nock';\n\nimport {\n getMockRetrievePushNotificationLinksResponse,\n getMockUpdatePushNotificationLinksResponse,\n} from './mockResponse';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nexport const mockEndpointGetPushNotificationLinks = (mockReply?: MockReply) => {\n const mockResponse = getMockRetrievePushNotificationLinksResponse();\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockEndpointUpdatePushNotificationLinks = (\n mockReply?: MockReply,\n) => {\n const mockResponse = getMockUpdatePushNotificationLinksResponse();\n const reply = mockReply ?? {\n status: 200,\n body: mockResponse.response,\n };\n\n const mockEndpoint = nock(mockResponse.url).post('').reply(reply.status);\n\n return mockEndpoint;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,iBAAiB;AACvB,IAAM,sBAAmC;AAAA;AAAA,EAE9C,aAAa,CAAC,KAAK,KAAK,GAAG;AAAA;AAAA,EAE3B,qBAAqB;AAAA,IACnB,EA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9
9
  deleteOnChainTriggers,
10
10
  getOnChainNotifications,
11
11
  markNotificationsAsRead
12
- } from "./chunk-F6TSWKZK.mjs";
12
+ } from "./chunk-IG3CMJBW.mjs";
13
13
  import {
14
14
  checkAccountsPresence,
15
15
  getAllUUIDs,
@@ -799,4 +799,4 @@ export {
799
799
  defaultState,
800
800
  NotificationServicesController
801
801
  };
802
- //# sourceMappingURL=chunk-KKWCKF5W.mjs.map
802
+ //# sourceMappingURL=chunk-UZXBH6WS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesController/NotificationServicesController.ts"],"sourcesContent":["import type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { toChecksumHexAddress } from '@metamask/controller-utils';\nimport type {\n KeyringControllerGetAccountsAction,\n KeyringControllerStateChangeEvent,\n} from '@metamask/keyring-controller';\nimport type {\n AuthenticationController,\n UserStorageController,\n} from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport { USER_STORAGE_VERSION_KEY } from './constants/constants';\nimport { TRIGGER_TYPES } from './constants/notification-schema';\nimport { safeProcessNotification } from './processors/process-notifications';\nimport * as FeatureNotifications from './services/feature-announcements';\nimport * as OnChainNotifications from './services/onchain-notifications';\nimport type {\n INotification,\n MarkAsReadNotificationsParam,\n NotificationUnion,\n} from './types/notification/notification';\nimport type { OnChainRawNotification } from './types/on-chain-notification/on-chain-notification';\nimport type { UserStorage } from './types/user-storage/user-storage';\nimport * as Utils from './utils/utils';\n\n// TODO: Fix Circular Type Dependencies\n// This indicates that control flow of messages is everywhere, lets orchestrate these better\nexport type NotificationServicesPushControllerEnablePushNotifications = {\n type: `NotificationServicesPushController:enablePushNotifications`;\n handler: (UUIDs: string[]) => Promise<void>;\n};\n\nexport type NotificationServicesPushControllerDisablePushNotifications = {\n type: `NotificationServicesPushController:disablePushNotifications`;\n handler: (UUIDs: string[]) => Promise<void>;\n};\n\nexport type NotificationServicesPushControllerUpdateTriggerPushNotifications = {\n type: `NotificationServicesPushController:updateTriggerPushNotifications`;\n handler: (UUIDs: string[]) => Promise<void>;\n};\n\nexport type NotificationServicesPushControllerOnNewNotification = {\n type: `NotificationServicesPushController:onNewNotifications`;\n payload: [INotification];\n};\n\n// Unique name for the controller\nconst controllerName = 'NotificationServicesController';\n\n/**\n * State shape for NotificationServicesController\n */\nexport type NotificationServicesControllerState = {\n /**\n * We store and manage accounts that have been seen/visted through the\n * account subscription. This allows us to track and add notifications for new accounts and not previous accounts added.\n */\n subscriptionAccountsSeen: string[];\n\n /**\n * Flag that indicates if the metamask notifications feature has been seen\n */\n isMetamaskNotificationsFeatureSeen: boolean;\n\n /**\n * Flag that indicates if the metamask notifications are enabled\n */\n isNotificationServicesEnabled: boolean;\n\n /**\n * Flag that indicates if the feature announcements are enabled\n */\n isFeatureAnnouncementsEnabled: boolean;\n\n /**\n * List of metamask notifications\n */\n metamaskNotificationsList: INotification[];\n\n /**\n * List of read metamask notifications\n */\n metamaskNotificationsReadList: string[];\n /**\n * Flag that indicates that the creating notifications is in progress\n */\n isUpdatingMetamaskNotifications: boolean;\n /**\n * Flag that indicates that the fetching notifications is in progress\n * This is used to show a loading spinner in the UI\n * when fetching notifications\n */\n isFetchingMetamaskNotifications: boolean;\n /**\n * Flag that indicates that the updating notifications for a specific address is in progress\n */\n isUpdatingMetamaskNotificationsAccount: string[];\n /**\n * Flag that indicates that the checking accounts presence is in progress\n */\n isCheckingAccountsPresence: boolean;\n};\n\nconst metadata: StateMetadata<NotificationServicesControllerState> = {\n subscriptionAccountsSeen: {\n persist: true,\n anonymous: true,\n },\n\n isMetamaskNotificationsFeatureSeen: {\n persist: true,\n anonymous: false,\n },\n isNotificationServicesEnabled: {\n persist: true,\n anonymous: false,\n },\n isFeatureAnnouncementsEnabled: {\n persist: true,\n anonymous: false,\n },\n metamaskNotificationsList: {\n persist: true,\n anonymous: true,\n },\n metamaskNotificationsReadList: {\n persist: true,\n anonymous: true,\n },\n isUpdatingMetamaskNotifications: {\n persist: false,\n anonymous: false,\n },\n isFetchingMetamaskNotifications: {\n persist: false,\n anonymous: false,\n },\n isUpdatingMetamaskNotificationsAccount: {\n persist: false,\n anonymous: false,\n },\n isCheckingAccountsPresence: {\n persist: false,\n anonymous: false,\n },\n};\nexport const defaultState: NotificationServicesControllerState = {\n subscriptionAccountsSeen: [],\n isMetamaskNotificationsFeatureSeen: false,\n isNotificationServicesEnabled: false,\n isFeatureAnnouncementsEnabled: false,\n metamaskNotificationsList: [],\n metamaskNotificationsReadList: [],\n isUpdatingMetamaskNotifications: false,\n isFetchingMetamaskNotifications: false,\n isUpdatingMetamaskNotificationsAccount: [],\n isCheckingAccountsPresence: false,\n};\n\nexport type NotificationServicesControllerUpdateMetamaskNotificationsList = {\n type: `${typeof controllerName}:updateMetamaskNotificationsList`;\n handler: NotificationServicesController['updateMetamaskNotificationsList'];\n};\n\nexport type NotificationServicesControllerDisableNotificationServices = {\n type: `${typeof controllerName}:disableNotificationServices`;\n handler: NotificationServicesController['disableNotificationServices'];\n};\n\nexport type NotificationServicesControllerSelectIsNotificationServicesEnabled =\n {\n type: `${typeof controllerName}:selectIsNotificationServicesEnabled`;\n handler: NotificationServicesController['selectIsNotificationServicesEnabled'];\n };\n\n// Messenger Actions\nexport type Actions =\n | NotificationServicesControllerUpdateMetamaskNotificationsList\n | NotificationServicesControllerDisableNotificationServices\n | NotificationServicesControllerSelectIsNotificationServicesEnabled\n | ControllerGetStateAction<'state', NotificationServicesControllerState>;\n\n// Allowed Actions\nexport type AllowedActions =\n // Keyring Controller Requests\n | KeyringControllerGetAccountsAction\n // Auth Controller Requests\n | AuthenticationController.AuthenticationControllerGetBearerToken\n | AuthenticationController.AuthenticationControllerIsSignedIn\n // User Storage Controller Requests\n | UserStorageController.UserStorageControllerEnableProfileSyncing\n | UserStorageController.UserStorageControllerGetStorageKey\n | UserStorageController.UserStorageControllerPerformGetStorage\n | UserStorageController.UserStorageControllerPerformSetStorage\n // Push Notifications Controller Requests\n | NotificationServicesPushControllerEnablePushNotifications\n | NotificationServicesPushControllerDisablePushNotifications\n | NotificationServicesPushControllerUpdateTriggerPushNotifications;\n\n// Events\nexport type NotificationServicesControllerMessengerEvents =\n ControllerStateChangeEvent<\n typeof controllerName,\n NotificationServicesControllerState\n >;\n\n// Allowed Events\nexport type AllowedEvents =\n | KeyringControllerStateChangeEvent\n | NotificationServicesPushControllerOnNewNotification;\n\n// Type for the messenger of NotificationServicesController\nexport type NotificationServicesControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n >;\n\ntype FeatureAnnouncementEnv = {\n spaceId: string;\n accessToken: string;\n platform: 'extension' | 'mobile';\n};\n\n/**\n * Controller that enables wallet notifications and feature announcements\n */\nexport default class NotificationServicesController extends BaseController<\n typeof controllerName,\n NotificationServicesControllerState,\n NotificationServicesControllerMessenger\n> {\n #auth = {\n getBearerToken: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n );\n },\n isSignedIn: () => {\n return this.messagingSystem.call('AuthenticationController:isSignedIn');\n },\n };\n\n #storage = {\n enableProfileSyncing: async () => {\n return await this.messagingSystem.call(\n 'UserStorageController:enableProfileSyncing',\n );\n },\n getStorageKey: () => {\n return this.messagingSystem.call('UserStorageController:getStorageKey');\n },\n getNotificationStorage: async () => {\n return await this.messagingSystem.call(\n 'UserStorageController:performGetStorage',\n 'notificationSettings',\n );\n },\n setNotificationStorage: async (state: string) => {\n return await this.messagingSystem.call(\n 'UserStorageController:performSetStorage',\n 'notificationSettings',\n state,\n );\n },\n };\n\n #pushNotifications = {\n enablePushNotifications: async (UUIDs: string[]) => {\n return await this.messagingSystem.call(\n 'NotificationServicesPushController:enablePushNotifications',\n UUIDs,\n );\n },\n disablePushNotifications: async (UUIDs: string[]) => {\n return await this.messagingSystem.call(\n 'NotificationServicesPushController:disablePushNotifications',\n UUIDs,\n );\n },\n updatePushNotifications: async (UUIDs: string[]) => {\n return await this.messagingSystem.call(\n 'NotificationServicesPushController:updateTriggerPushNotifications',\n UUIDs,\n );\n },\n subscribe: () => {\n this.messagingSystem.subscribe(\n 'NotificationServicesPushController:onNewNotifications',\n (notification) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.updateMetamaskNotificationsList(notification);\n },\n );\n },\n initializePushNotifications: async () => {\n if (!this.state.isNotificationServicesEnabled) {\n return;\n }\n\n const storage = await this.#getUserStorage();\n if (!storage) {\n return;\n }\n\n const uuids = Utils.getAllUUIDs(storage);\n await this.#pushNotifications.enablePushNotifications(uuids);\n },\n };\n\n #accounts = {\n /**\n * Used to get list of addresses from keyring (wallet addresses)\n *\n * @returns addresses removed, added, and latest list of addresses\n */\n listAccounts: async () => {\n // Get previous and current account sets\n const nonChecksumAccounts = await this.messagingSystem.call(\n 'KeyringController:getAccounts',\n );\n const accounts = nonChecksumAccounts.map((a) => toChecksumHexAddress(a));\n const currentAccountsSet = new Set(accounts);\n const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);\n\n // Invalid value you cannot have zero accounts\n // Only occurs when the Accounts controller is initializing.\n if (accounts.length === 0) {\n return {\n accountsAdded: [],\n accountsRemoved: [],\n accounts: [],\n };\n }\n\n // Calculate added and removed addresses\n const accountsAdded = accounts.filter((a) => !prevAccountsSet.has(a));\n const accountsRemoved = [...prevAccountsSet.values()].filter(\n (a) => !currentAccountsSet.has(a),\n );\n\n // Update accounts seen\n this.update((state) => {\n state.subscriptionAccountsSeen = [...prevAccountsSet, ...accountsAdded];\n });\n\n return {\n accountsAdded,\n accountsRemoved,\n accounts,\n };\n },\n\n /**\n * Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.\n *\n * @returns result from list accounts\n */\n initialize: () => {\n return this.#accounts.listAccounts();\n },\n\n /**\n * Subscription to any state change in the keyring controller (aka wallet accounts).\n * We can call the `listAccounts` defined above to find out about any accounts added, removed\n * And call effects to subscribe/unsubscribe to notifications.\n */\n subscribe: () => {\n this.messagingSystem.subscribe(\n 'KeyringController:stateChange',\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async () => {\n if (!this.state.isNotificationServicesEnabled) {\n return;\n }\n\n const { accountsAdded, accountsRemoved } =\n await this.#accounts.listAccounts();\n\n const promises: Promise<unknown>[] = [];\n if (accountsAdded.length > 0) {\n promises.push(this.updateOnChainTriggersByAccount(accountsAdded));\n }\n if (accountsRemoved.length > 0) {\n promises.push(this.deleteOnChainTriggersByAccount(accountsRemoved));\n }\n await Promise.all(promises);\n },\n );\n },\n };\n\n #featureAnnouncementEnv: FeatureAnnouncementEnv;\n\n /**\n * Creates a NotificationServicesController instance.\n *\n * @param args - The arguments to this function.\n * @param args.messenger - Messenger used to communicate with BaseV2 controller.\n * @param args.state - Initial state to set on this controller.\n * @param args.env - environment variables for a given controller.\n * @param args.env.featureAnnouncements - env variables for feature announcements.\n */\n constructor({\n messenger,\n state,\n env,\n }: {\n messenger: NotificationServicesControllerMessenger;\n state?: Partial<NotificationServicesControllerState>;\n env: {\n featureAnnouncements: FeatureAnnouncementEnv;\n };\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#featureAnnouncementEnv = env.featureAnnouncements;\n this.#registerMessageHandlers();\n this.#clearLoadingStates();\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.#accounts.initialize();\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.#pushNotifications.initializePushNotifications();\n this.#accounts.subscribe();\n this.#pushNotifications.subscribe();\n }\n\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n `${controllerName}:updateMetamaskNotificationsList`,\n this.updateMetamaskNotificationsList.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${controllerName}:disableNotificationServices`,\n this.disableNotificationServices.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${controllerName}:selectIsNotificationServicesEnabled`,\n this.selectIsNotificationServicesEnabled.bind(this),\n );\n }\n\n #clearLoadingStates(): void {\n this.update((state) => {\n state.isUpdatingMetamaskNotifications = false;\n state.isCheckingAccountsPresence = false;\n state.isFetchingMetamaskNotifications = false;\n state.isUpdatingMetamaskNotificationsAccount = [];\n });\n }\n\n #assertAuthEnabled() {\n if (!this.#auth.isSignedIn()) {\n this.update((state) => {\n state.isNotificationServicesEnabled = false;\n });\n throw new Error('User is not signed in.');\n }\n }\n\n async #getValidStorageKeyAndBearerToken() {\n this.#assertAuthEnabled();\n\n const bearerToken = await this.#auth.getBearerToken();\n const storageKey = await this.#storage.getStorageKey();\n\n if (!bearerToken || !storageKey) {\n throw new Error('Missing BearerToken or storage key');\n }\n\n return { bearerToken, storageKey };\n }\n\n #performEnableProfileSyncing = async () => {\n try {\n await this.#storage.enableProfileSyncing();\n } catch (e) {\n log.error('Failed to enable profile syncing', e);\n throw new Error('Failed to enable profile syncing');\n }\n };\n\n #assertUserStorage(\n storage: UserStorage | null,\n ): asserts storage is UserStorage {\n if (!storage) {\n throw new Error('User Storage does not exist');\n }\n }\n\n /**\n * Retrieves and parses the user storage from the storage key.\n *\n * This method attempts to retrieve the user storage using the specified storage key,\n * then parses the JSON string to an object. If the storage is not found or cannot be parsed,\n * it throws an error.\n *\n * @returns The parsed user storage object or null\n */\n async #getUserStorage(): Promise<UserStorage | null> {\n const userStorageString: string | null =\n await this.#storage.getNotificationStorage();\n\n if (!userStorageString) {\n return null;\n }\n\n try {\n const userStorage: UserStorage = JSON.parse(userStorageString);\n return userStorage;\n } catch (error) {\n log.error('Unable to parse User Storage');\n return null;\n }\n }\n\n /**\n * Retrieves the current enabled state of MetaMask notifications.\n *\n * This method directly returns the boolean value of `isMetamaskNotificationsEnabled`\n * from the controller's state, indicating whether MetaMask notifications are currently enabled.\n *\n * @returns The enabled state of MetaMask notifications.\n */\n public selectIsNotificationServicesEnabled(): boolean {\n return this.state.isNotificationServicesEnabled;\n }\n\n /**\n * Sets the state of notification creation process.\n *\n * This method updates the `isUpdatingMetamaskNotifications` state, which can be used to indicate\n * whether the notification creation process is currently active or not. This is useful\n * for UI elements that need to reflect the state of ongoing operations, such as loading\n * indicators or disabled buttons during processing.\n *\n * @param isUpdatingMetamaskNotifications - A boolean value representing the new state of the notification creation process.\n */\n #setIsUpdatingMetamaskNotifications(\n isUpdatingMetamaskNotifications: boolean,\n ) {\n this.update((state) => {\n state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;\n });\n }\n\n /**\n * Updates the state to indicate whether fetching of MetaMask notifications is in progress.\n *\n * This method is used to set the `isFetchingMetamaskNotifications` state, which can be utilized\n * to show or hide loading indicators in the UI when notifications are being fetched.\n *\n * @param isFetchingMetamaskNotifications - A boolean value representing the fetching state.\n */\n #setIsFetchingMetamaskNotifications(\n isFetchingMetamaskNotifications: boolean,\n ) {\n this.update((state) => {\n state.isFetchingMetamaskNotifications = isFetchingMetamaskNotifications;\n });\n }\n\n /**\n * Updates the state to indicate that the checking of accounts presence is in progress.\n *\n * This method modifies the `isCheckingAccountsPresence` state, which can be used to manage UI elements\n * that depend on the status of account presence checks, such as displaying loading indicators or disabling\n * buttons while the check is ongoing.\n *\n * @param isCheckingAccountsPresence - A boolean value indicating whether the account presence check is currently active.\n */\n #setIsCheckingAccountsPresence(isCheckingAccountsPresence: boolean) {\n this.update((state) => {\n state.isCheckingAccountsPresence = isCheckingAccountsPresence;\n });\n }\n\n /**\n * Updates the state to indicate that account updates are in progress.\n * Removes duplicate accounts before updating the state.\n *\n * @param accounts - The accounts being updated.\n */\n #updateUpdatingAccountsState(accounts: string[]) {\n this.update((state) => {\n const uniqueAccounts = new Set([\n ...state.isUpdatingMetamaskNotificationsAccount,\n ...accounts,\n ]);\n state.isUpdatingMetamaskNotificationsAccount = Array.from(uniqueAccounts);\n });\n }\n\n /**\n * Clears the state indicating that account updates are complete.\n *\n * @param accounts - The accounts that have finished updating.\n */\n #clearUpdatingAccountsState(accounts: string[]) {\n this.update((state) => {\n state.isUpdatingMetamaskNotificationsAccount =\n state.isUpdatingMetamaskNotificationsAccount.filter(\n (existingAccount) => !accounts.includes(existingAccount),\n );\n });\n }\n\n public async checkAccountsPresence(\n accounts: string[],\n ): Promise<Record<string, boolean>> {\n try {\n this.#setIsCheckingAccountsPresence(true);\n\n // Retrieve user storage\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n\n const presence = Utils.checkAccountsPresence(userStorage, accounts);\n return presence;\n } catch (error) {\n log.error('Failed to check accounts presence', error);\n throw error;\n } finally {\n this.#setIsCheckingAccountsPresence(false);\n }\n }\n\n /**\n * Sets the enabled state of feature announcements.\n *\n * **Action** - used in the notification settings to enable/disable feature announcements.\n *\n * @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements.\n * @async\n * @throws {Error} If fails to update\n */\n public async setFeatureAnnouncementsEnabled(\n featureAnnouncementsEnabled: boolean,\n ) {\n try {\n this.update((s) => {\n s.isFeatureAnnouncementsEnabled = featureAnnouncementsEnabled;\n });\n } catch (e) {\n log.error('Unable to toggle feature announcements', e);\n throw new Error('Unable to toggle feature announcements');\n }\n }\n\n /**\n * This creates/re-creates on-chain triggers defined in User Storage.\n *\n * **Action** - Used during Sign In / Enabling of notifications.\n *\n * @returns The updated or newly created user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async createOnChainTriggers(): Promise<UserStorage> {\n try {\n this.#setIsUpdatingMetamaskNotifications(true);\n\n await this.#performEnableProfileSyncing();\n\n const { bearerToken, storageKey } =\n await this.#getValidStorageKeyAndBearerToken();\n\n const { accounts } = await this.#accounts.listAccounts();\n\n let userStorage = await this.#getUserStorage();\n\n // If userStorage does not exist, create a new one\n // All the triggers created are set as: \"disabled\"\n if (userStorage?.[USER_STORAGE_VERSION_KEY] === undefined) {\n userStorage = Utils.initializeUserStorage(\n accounts.map((account) => ({ address: account })),\n false,\n );\n\n // Write the userStorage\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n }\n\n // Create the triggers\n const triggers = Utils.traverseUserStorageTriggers(userStorage);\n await OnChainNotifications.createOnChainTriggers(\n userStorage,\n storageKey,\n bearerToken,\n triggers,\n );\n\n // Create push notifications triggers\n const allUUIDS = Utils.getAllUUIDs(userStorage);\n await this.#pushNotifications.enablePushNotifications(allUUIDS);\n\n // Write the new userStorage (triggers are now \"enabled\")\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n\n // Update the state of the controller\n this.update((state) => {\n state.isNotificationServicesEnabled = true;\n state.isFeatureAnnouncementsEnabled = true;\n state.isMetamaskNotificationsFeatureSeen = true;\n });\n\n return userStorage;\n } catch (err) {\n log.error('Failed to create On Chain triggers', err);\n throw new Error('Failed to create On Chain triggers');\n } finally {\n this.#setIsUpdatingMetamaskNotifications(false);\n }\n }\n\n /**\n * Enables all MetaMask notifications for the user.\n * This is identical flow when initializing notifications for the first time.\n * 1. Enable Profile Syncing\n * 2. Get or Create Notification User Storage\n * 3. Upsert Triggers\n * 4. Update Push notifications\n *\n * @throws {Error} If there is an error during the process of enabling notifications.\n */\n public async enableMetamaskNotifications() {\n try {\n this.#setIsUpdatingMetamaskNotifications(true);\n await this.createOnChainTriggers();\n } catch (e) {\n log.error('Unable to enable notifications', e);\n throw new Error('Unable to enable notifications');\n } finally {\n this.#setIsUpdatingMetamaskNotifications(false);\n }\n }\n\n /**\n * Disables all MetaMask notifications for the user.\n * This method ensures that the user is authenticated, retrieves all linked accounts,\n * and disables on-chain triggers for each account. It also sets the global notification\n * settings for MetaMask, feature announcements to false.\n *\n * @throws {Error} If the user is not authenticated or if there is an error during the process.\n */\n public async disableNotificationServices() {\n try {\n this.#setIsUpdatingMetamaskNotifications(true);\n\n // Disable Push Notifications\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n const UUIDs = Utils.getAllUUIDs(userStorage);\n await this.#pushNotifications.disablePushNotifications(UUIDs);\n\n // Clear Notification States (toggles and list)\n this.update((state) => {\n state.isNotificationServicesEnabled = false;\n state.isFeatureAnnouncementsEnabled = false;\n state.metamaskNotificationsList = [];\n });\n } catch (e) {\n log.error('Unable to disable notifications', e);\n throw new Error('Unable to disable notifications');\n } finally {\n this.#setIsUpdatingMetamaskNotifications(false);\n }\n }\n\n /**\n * Deletes on-chain triggers associated with a specific account.\n * This method performs several key operations:\n * 1. Validates Auth & Storage\n * 2. Finds and deletes all triggers associated with the account\n * 3. Disables any related push notifications\n * 4. Updates Storage to reflect new state.\n *\n * **Action** - When a user disables notifications for a given account in settings.\n *\n * @param accounts - The account for which on-chain triggers are to be deleted.\n * @returns A promise that resolves to void or an object containing a success message.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async deleteOnChainTriggersByAccount(\n accounts: string[],\n ): Promise<UserStorage> {\n try {\n this.#updateUpdatingAccountsState(accounts);\n // Get and Validate BearerToken and User Storage Key\n const { bearerToken, storageKey } =\n await this.#getValidStorageKeyAndBearerToken();\n\n // Get & Validate User Storage\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n\n // Get the UUIDs to delete\n const UUIDs = accounts\n .map((a) => Utils.getUUIDsForAccount(userStorage, a.toLowerCase()))\n .flat();\n\n if (UUIDs.length === 0) {\n return userStorage;\n }\n\n // Delete these UUIDs (Mutates User Storage)\n await OnChainNotifications.deleteOnChainTriggers(\n userStorage,\n storageKey,\n bearerToken,\n UUIDs,\n );\n\n // Delete these UUIDs from the push notifications\n await this.#pushNotifications.disablePushNotifications(UUIDs);\n\n // Update User Storage\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n return userStorage;\n } catch (err) {\n log.error('Failed to delete OnChain triggers', err);\n throw new Error('Failed to delete OnChain triggers');\n } finally {\n this.#clearUpdatingAccountsState(accounts);\n }\n }\n\n /**\n * Updates/Creates on-chain triggers for a specific account.\n *\n * This method performs several key operations:\n * 1. Validates Auth & Storage\n * 2. Finds and creates any missing triggers associated with the account\n * 3. Enables any related push notifications\n * 4. Updates Storage to reflect new state.\n *\n * **Action** - When a user enables notifications for an account\n *\n * @param accounts - List of accounts you want to update.\n * @returns A promise that resolves to the updated user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async updateOnChainTriggersByAccount(\n accounts: string[],\n ): Promise<UserStorage> {\n try {\n this.#updateUpdatingAccountsState(accounts);\n // Get and Validate BearerToken and User Storage Key\n const { bearerToken, storageKey } =\n await this.#getValidStorageKeyAndBearerToken();\n\n // Get & Validate User Storage\n const userStorage = await this.#getUserStorage();\n this.#assertUserStorage(userStorage);\n\n // Add any missing triggers\n accounts.forEach((a) => Utils.upsertAddressTriggers(a, userStorage));\n\n const newTriggers = Utils.traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (!t.enabled) {\n return t;\n }\n return undefined;\n },\n });\n\n // Create any missing triggers.\n if (newTriggers.length > 0) {\n // Write te updated userStorage (where triggers are disabled)\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n\n // Create the triggers\n const triggers = Utils.traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (\n accounts.some((a) => a.toLowerCase() === t.address.toLowerCase())\n ) {\n return t;\n }\n return undefined;\n },\n });\n await OnChainNotifications.createOnChainTriggers(\n userStorage,\n storageKey,\n bearerToken,\n triggers,\n );\n }\n\n // Update Push Notifications Triggers\n const UUIDs = Utils.getAllUUIDs(userStorage);\n await this.#pushNotifications.updatePushNotifications(UUIDs);\n\n // Update the userStorage (where triggers are enabled)\n await this.#storage.setNotificationStorage(JSON.stringify(userStorage));\n return userStorage;\n } catch (err) {\n log.error('Failed to update OnChain triggers', err);\n throw new Error('Failed to update OnChain triggers');\n } finally {\n this.#clearUpdatingAccountsState(accounts);\n }\n }\n\n /**\n * Fetches the list of metamask notifications.\n * This includes OnChain notifications and Feature Announcements.\n *\n * **Action** - When a user views the notification list page/dropdown\n *\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\n public async fetchAndUpdateMetamaskNotifications(): Promise<INotification[]> {\n try {\n this.#setIsFetchingMetamaskNotifications(true);\n\n // Raw Feature Notifications\n const rawFeatureAnnouncementNotifications = this.state\n .isFeatureAnnouncementsEnabled\n ? await FeatureNotifications.getFeatureAnnouncementNotifications(\n this.#featureAnnouncementEnv,\n ).catch(() => [])\n : [];\n\n // Raw On Chain Notifications\n const rawOnChainNotifications: OnChainRawNotification[] = [];\n const userStorage = await this.#storage\n .getNotificationStorage()\n .then((s) => s && (JSON.parse(s) as UserStorage))\n .catch(() => null);\n const bearerToken = await this.#auth.getBearerToken().catch(() => null);\n if (userStorage && bearerToken) {\n const notifications =\n await OnChainNotifications.getOnChainNotifications(\n userStorage,\n bearerToken,\n ).catch(() => []);\n\n rawOnChainNotifications.push(...notifications);\n }\n\n const readIds = this.state.metamaskNotificationsReadList;\n\n // Combined Notifications\n const isNotUndefined = <Item>(t?: Item): t is Item => Boolean(t);\n const processAndFilter = (ns: NotificationUnion[]) =>\n ns\n .map((n) => safeProcessNotification(n, readIds))\n .filter(isNotUndefined);\n\n const featureAnnouncementNotifications = processAndFilter(\n rawFeatureAnnouncementNotifications,\n );\n const onChainNotifications = processAndFilter(rawOnChainNotifications);\n\n const metamaskNotifications: INotification[] = [\n ...featureAnnouncementNotifications,\n ...onChainNotifications,\n ];\n metamaskNotifications.sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),\n );\n\n // Update State\n this.update((state) => {\n state.metamaskNotificationsList = metamaskNotifications;\n });\n\n this.#setIsFetchingMetamaskNotifications(false);\n return metamaskNotifications;\n } catch (err) {\n this.#setIsFetchingMetamaskNotifications(false);\n log.error('Failed to fetch notifications', err);\n throw new Error('Failed to fetch notifications');\n }\n }\n\n /**\n * Marks specified metamask notifications as read.\n *\n * @param notifications - An array of notifications to be marked as read. Each notification should include its type and read status.\n * @returns A promise that resolves when the operation is complete.\n */\n public async markMetamaskNotificationsAsRead(\n notifications: MarkAsReadNotificationsParam,\n ): Promise<void> {\n let onchainNotificationIds: string[] = [];\n let featureAnnouncementNotificationIds: string[] = [];\n\n try {\n // Filter unread on/off chain notifications\n const onChainNotifications = notifications.filter(\n (notification) =>\n notification.type !== TRIGGER_TYPES.FEATURES_ANNOUNCEMENT &&\n !notification.isRead,\n );\n\n const featureAnnouncementNotifications = notifications.filter(\n (notification) =>\n notification.type === TRIGGER_TYPES.FEATURES_ANNOUNCEMENT &&\n !notification.isRead,\n );\n\n // Mark On-Chain Notifications as Read\n if (onChainNotifications.length > 0) {\n const bearerToken = await this.#auth.getBearerToken();\n\n if (bearerToken) {\n onchainNotificationIds = onChainNotifications.map(\n (notification) => notification.id,\n );\n await OnChainNotifications.markNotificationsAsRead(\n bearerToken,\n onchainNotificationIds,\n ).catch(() => {\n onchainNotificationIds = [];\n log.warn('Unable to mark onchain notifications as read');\n });\n }\n }\n\n // Mark Off-Chain notifications as Read\n if (featureAnnouncementNotifications.length > 0) {\n featureAnnouncementNotificationIds =\n featureAnnouncementNotifications.map(\n (notification) => notification.id,\n );\n }\n } catch (err) {\n log.warn('Something failed when marking notifications as read', err);\n }\n\n // Update the state (state is also used on counter & badge)\n this.update((state) => {\n const currentReadList = state.metamaskNotificationsReadList;\n const newReadIds = [...featureAnnouncementNotificationIds];\n state.metamaskNotificationsReadList = [\n ...new Set([...currentReadList, ...newReadIds]),\n ];\n\n state.metamaskNotificationsList = state.metamaskNotificationsList.map(\n (notification: INotification) => {\n if (\n newReadIds.includes(notification.id) ||\n onchainNotificationIds.includes(notification.id)\n ) {\n return { ...notification, isRead: true };\n }\n return notification;\n },\n );\n });\n }\n\n /**\n * Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.\n * This method ensures that the most recent notification is displayed first in the UI.\n *\n * @param notification - The new notification object to be added to the list.\n * @returns A promise that resolves when the notification list has been successfully updated.\n */\n public async updateMetamaskNotificationsList(\n notification: INotification,\n ): Promise<void> {\n if (\n this.state.metamaskNotificationsList.some((n) => n.id === notification.id)\n ) {\n return;\n }\n\n const processedNotification = safeProcessNotification(notification);\n\n if (processedNotification) {\n this.update((state) => {\n const existingNotificationIds = new Set(\n state.metamaskNotificationsList.map((n) => n.id),\n );\n // Add the new notification only if its ID is not already present in the list\n if (!existingNotificationIds.has(notification.id)) {\n state.metamaskNotificationsList = [\n notification,\n ...state.metamaskNotificationsList,\n ];\n }\n });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AASrC,OAAO,SAAS;AAuChB,IAAM,iBAAiB;AAwDvB,IAAM,WAA+D;AAAA,EACnE,0BAA0B;AAAA,IACxB,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EAEA,oCAAoC;AAAA,IAClC,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,+BAA+B;AAAA,IAC7B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,+BAA+B;AAAA,IAC7B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,2BAA2B;AAAA,IACzB,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,+BAA+B;AAAA,IAC7B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,iCAAiC;AAAA,IAC/B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,iCAAiC;AAAA,IAC/B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,wCAAwC;AAAA,IACtC,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,4BAA4B;AAAA,IAC1B,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;AACO,IAAM,eAAoD;AAAA,EAC/D,0BAA0B,CAAC;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,+BAA+B;AAAA,EAC/B,2BAA2B,CAAC;AAAA,EAC5B,+BAA+B,CAAC;AAAA,EAChC,iCAAiC;AAAA,EACjC,iCAAiC;A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otificationServicesController,
9
9
  defaultState
10
- } from "./chunk-KKWCKF5W.mjs";
10
+ } from "./chunk-UZXBH6WS.mjs";
11
11
  import {
12
12
  FEATURE_ANNOUNCEMENT_API
13
13
  } from "./chunk-EQWVJX6K.mjs";
@@ -16,7 +16,7 @@ import {
16
16
  NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,
17
17
  TRIGGER_API_BATCH_ENDPOINT,
18
18
  require_nock
19
- } from "./chunk-F6TSWKZK.mjs";
19
+ } from "./chunk-IG3CMJBW.mjs";
20
20
  import {
21
21
  initializeUserStorage
22
22
  } from "./chunk-SMKJEA45.mjs";
@@ -35,8 +35,8 @@ import {
35
35
  var NotificationServicesController_exports = {};
36
36
  __export(NotificationServicesController_exports, {
37
37
  Constants: () => constants_exports,
38
+ Controller: () => NotificationServicesController,
38
39
  Mocks: () => fixtures_exports,
39
- NotificationServicesController: () => NotificationServicesController,
40
40
  Processors: () => processors_exports,
41
41
  Types: () => types_exports,
42
42
  defaultState: () => defaultState
@@ -962,4 +962,4 @@ export {
962
962
  fixtures_exports,
963
963
  NotificationServicesController_exports
964
964
  };
965
- //# sourceMappingURL=chunk-G2ROCNJN.mjs.map
965
+ //# sourceMappingURL=chunk-ZJRT7ACU.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","../src/NotificationServicesController/__fixtures__/mockServices.ts"],"sourcesContent":["import Controller from './NotificationServicesController';\n\nexport { Controller };\nexport * from './NotificationServicesController';\nexport * as Types from './types';\nexport * as Mocks from './__fixtures__';\nexport * as Processors from './processors';\nexport * as Constants from './constants';\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';\nexport * from './mockServices';\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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: '0x881D40237659C251811CEC9c364ef91dC08D300C',\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","import nock from 'nock';\n\nimport {\n getMockBatchCreateTriggersResponse,\n getMockBatchDeleteTriggersResponse,\n getMockFeatureAnnouncementResponse,\n getMockListNotificationsResponse,\n getMockMarkNotificationsAsReadResponse,\n} from './mockResponses';\n\ntype MockReply = {\n status: nock.StatusCode;\n body?: nock.Body;\n};\n\nexport const mockFetchFeatureAnnouncementNotifications = (\n mockReply?: MockReply,\n) => {\n const mockResponse = getMockFeatureAnnouncementResponse();\n const reply = mockReply ?? { status: 200, body: mockResponse.response };\n const mockEndpoint = nock(mockResponse.url)\n .get('')\n .query(true)\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockBatchCreateTriggers = (mockReply?: MockReply) => {\n const mockResponse = getMockBatchCreateTriggersResponse();\n const reply = mockReply ?? { status: 204 };\n\n const mockEndpoint = nock(mockResponse.url)\n .post('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockBatchDeleteTriggers = (mockReply?: MockReply) => {\n const mockResponse = getMockBatchDeleteTriggersResponse();\n const reply = mockReply ?? { status: 204 };\n\n const mockEndpoint = nock(mockResponse.url)\n .delete('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockListNotifications = (mockReply?: MockReply) => {\n const mockResponse = getMockListNotificationsResponse();\n const reply = mockReply ?? { status: 200, body: mockResponse.response };\n\n const mockEndpoint = nock(mockResponse.url)\n .post('')\n .query(true)\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n\nexport const mockMarkNotificationsAsRead = (mockReply?: MockReply) => {\n const mockResponse = getMockMarkNotificationsAsReadResponse();\n const reply = mockReply ?? { status: 200 };\n\n const mockEndpoint = nock(mockResponse.url)\n .post('')\n .reply(reply.status, reply.body);\n\n return mockEndpoint;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;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,c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