@metamask-previews/notification-services-controller 0.19.0-preview-2a6578b3 → 0.20.0-preview-224dff25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs +22 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts +22 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts +22 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs +22 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs +2 -2
- package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs +2 -2
- package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs +1 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs +1 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.cjs +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
- package/dist/NotificationServicesController/index.cjs +1 -3
- package/dist/NotificationServicesController/index.cjs.map +1 -1
- package/dist/NotificationServicesController/index.d.cts +2 -2
- package/dist/NotificationServicesController/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/index.d.mts +2 -2
- package/dist/NotificationServicesController/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/index.mjs +0 -2
- package/dist/NotificationServicesController/index.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.cjs +1 -0
- package/dist/NotificationServicesController/services/feature-announcements.cjs.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.cts +1 -0
- package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.mts +1 -0
- package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.mjs +1 -0
- package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.cjs +1 -4
- package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +1 -4
- package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.cjs +0 -17
- package/dist/NotificationServicesController/types/feature-announcement/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.d.cts +3 -3
- package/dist/NotificationServicesController/types/feature-announcement/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.d.mts +3 -3
- package/dist/NotificationServicesController/types/feature-announcement/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.mjs +1 -3
- package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/index.cjs +0 -19
- package/dist/NotificationServicesController/types/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/index.d.cts +5 -5
- package/dist/NotificationServicesController/types/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/index.d.mts +5 -5
- package/dist/NotificationServicesController/types/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/index.mjs +1 -5
- package/dist/NotificationServicesController/types/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/index.cjs +0 -15
- package/dist/NotificationServicesController/types/notification/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/index.d.cts +1 -1
- package/dist/NotificationServicesController/types/notification/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/notification/index.d.mts +1 -1
- package/dist/NotificationServicesController/types/notification/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/notification/index.mjs +1 -1
- package/dist/NotificationServicesController/types/notification/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.cjs +0 -15
- package/dist/NotificationServicesController/types/on-chain-notification/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.mjs +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs +2 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs +2 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -1
- package/dist/NotificationServicesController/types/snaps/index.cjs +0 -15
- package/dist/NotificationServicesController/types/snaps/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/snaps/index.d.cts +1 -1
- package/dist/NotificationServicesController/types/snaps/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/snaps/index.d.mts +1 -1
- package/dist/NotificationServicesController/types/snaps/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/snaps/index.mjs +1 -1
- package/dist/NotificationServicesController/types/snaps/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.cjs +0 -15
- package/dist/NotificationServicesController/types/user-storage/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.d.cts +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.d.mts +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.mjs +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.cjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +1 -3
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +1 -3
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +1 -3
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +1 -3
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs +0 -2
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs.map +1 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs +0 -2
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs.map +1 -1
- package/dist/NotificationServicesPushController/index.cjs +1 -3
- package/dist/NotificationServicesPushController/index.cjs.map +1 -1
- package/dist/NotificationServicesPushController/index.d.cts +2 -2
- package/dist/NotificationServicesPushController/index.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/index.d.mts +2 -2
- package/dist/NotificationServicesPushController/index.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/index.mjs +0 -2
- package/dist/NotificationServicesPushController/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.cjs +2 -1
- package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.d.cts +1 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.d.mts +1 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.mjs +2 -1
- package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.cjs +0 -2
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +0 -2
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/dist/NotificationServicesPushController/types/index.cjs +0 -15
- package/dist/NotificationServicesPushController/types/index.cjs.map +1 -1
- package/dist/NotificationServicesPushController/types/index.d.cts +1 -1
- package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/types/index.d.mts +1 -1
- package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/types/index.mjs +1 -1
- package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +2 -2
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +2 -2
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -33,7 +33,6 @@ export async function createOnChainTriggers(userStorage, storageKey, bearerToken
|
|
|
33
33
|
token: UserStorageController.createSHA256Hash(t.id + storageKey),
|
|
34
34
|
config: {
|
|
35
35
|
kind: t.kind,
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
37
36
|
chain_id: Number(t.chainId),
|
|
38
37
|
address: t.address,
|
|
39
38
|
},
|
|
@@ -136,9 +135,7 @@ export async function getOnChainNotifications(userStorage, bearerToken) {
|
|
|
136
135
|
const PAGE_LIMIT = 2;
|
|
137
136
|
for (let page = 1; page <= PAGE_LIMIT; page++) {
|
|
138
137
|
try {
|
|
139
|
-
const response = await makeApiCall(bearerToken, NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY(page), 'POST',
|
|
140
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
141
|
-
{ trigger_ids: triggerIds });
|
|
138
|
+
const response = await makeApiCall(bearerToken, NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY(page), 'POST', { trigger_ids: triggerIds });
|
|
142
139
|
const notifications = (await response.json());
|
|
143
140
|
// Transform and sort notifications
|
|
144
141
|
const transformedNotifications = notifications
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onchain-notifications.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/onchain-notifications.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,qBAAqB,EAAE,0CAA0C;AAC1E,OAAO,IAAG,iBAAiB;;AAE3B,OAAO,EAAE,wBAAwB,EAAE,6CAAyC;AAM5E,OAAO,EACL,WAAW,EACX,8BAA8B,EAC9B,2BAA2B,EAC5B,2BAAuB;AAS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ACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,WAAmB,EACnB,eAAyB;IAEzB,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,OAAO;KACR;IAED,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,WAAW,CAChC,WAAW,EACX,0CAA0C,EAC1C,MAAM,EACN,EAAE,GAAG,EAAE,eAAe,EAAE,CACzB,CAAC;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAC3B,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC/D,MAAM,IAAI,KAAK,CACb,wCAAwC,SAAS,EAAE,OAAiB,EAAE,CACvE,CAAC;SACH;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,GAAG,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,GAAG,CAAC;KACX;AACH,CAAC","sourcesContent":["import { UserStorageController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport { toRawOnChainNotification } from '../../shared/to-raw-notification';\nimport type {\n OnChainRawNotification,\n UnprocessedOnChainRawNotification,\n} from '../types/on-chain-notification/on-chain-notification';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport {\n makeApiCall,\n toggleUserStorageTriggerStatus,\n traverseUserStorageTriggers,\n} from '../utils/utils';\n\nexport type NotificationTrigger = {\n id: string;\n chainId: string;\n kind: string;\n address: string;\n};\n\nexport const TRIGGER_API = 'https://trigger.api.cx.metamask.io';\nexport const NOTIFICATION_API = 'https://notification.api.cx.metamask.io';\nexport const TRIGGER_API_BATCH_ENDPOINT = `${TRIGGER_API}/api/v1/triggers/batch`;\nexport const NOTIFICATION_API_LIST_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications`;\nexport const NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = (page: number) =>\n `${NOTIFICATION_API_LIST_ENDPOINT}?page=${page}&per_page=100`;\nexport const NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications/mark-as-read`;\n\n/**\n * Creates on-chain triggers based on the provided notification triggers.\n * This method generates a unique token for each trigger using the trigger ID and storage key,\n * proving ownership of the trigger being updated. It then makes an API call to create these triggers.\n * Upon successful creation, it updates the userStorage to reflect the new trigger status.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the trigger ID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param triggers - An array of notification triggers to be created. Each trigger includes an ID, chain ID, kind, and address.\n * @returns A promise that resolves to void. Throws an error if the API call fails or if there's an issue creating the triggers.\n */\nexport async function createOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n triggers: NotificationTrigger[],\n): Promise<void> {\n type RequestPayloadTrigger = {\n id: string;\n // this is the trigger token, generated by using the uuid + storage key. It proves you own the trigger you are updating\n token: string;\n config: {\n kind: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n chain_id: number;\n address: string;\n };\n };\n const triggersToCreate: RequestPayloadTrigger[] = triggers.map((t) => ({\n id: t.id,\n token: UserStorageController.createSHA256Hash(t.id + storageKey),\n config: {\n kind: t.kind,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n chain_id: Number(t.chainId),\n address: t.address,\n },\n }));\n\n if (triggersToCreate.length === 0) {\n return;\n }\n\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'POST',\n triggersToCreate,\n );\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => undefined);\n log.error('Error creating triggers:', errorData);\n throw new Error('OnChain Notifications - unable to create triggers');\n }\n\n // If the trigger creation was fine\n // then update the userStorage\n for (const trigger of triggersToCreate) {\n toggleUserStorageTriggerStatus(\n userStorage,\n trigger.config.address,\n String(trigger.config.chain_id),\n trigger.id,\n true,\n );\n }\n}\n\n/**\n * Deletes on-chain triggers based on the provided UUIDs.\n * This method generates a unique token for each trigger using the UUID and storage key,\n * proving ownership of the trigger being deleted. It then makes an API call to delete these triggers.\n * Upon successful deletion, it updates the userStorage to remove the deleted trigger statuses.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the UUID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param uuids - An array of UUIDs representing the triggers to be deleted.\n * @returns A promise that resolves to the updated UserStorage object. Throws an error if the API call fails or if there's an issue deleting the triggers.\n */\nexport async function deleteOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n uuids: string[],\n): Promise<UserStorage> {\n const triggersToDelete = uuids.map((uuid) => ({\n id: uuid,\n token: UserStorageController.createSHA256Hash(uuid + storageKey),\n }));\n\n try {\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'DELETE',\n triggersToDelete,\n );\n\n if (!response.ok) {\n throw new Error(\n `Failed to delete on-chain notifications for uuids ${uuids.join(', ')}`,\n );\n }\n\n // Update the state of the deleted trigger to false\n for (const uuid of uuids) {\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n if (userStorage?.[address]?.[chainId]?.[uuid]) {\n delete userStorage[address][chainId][uuid];\n }\n }\n }\n }\n }\n\n // Follow-up cleanup, if an address had no triggers whatsoever, then we can delete the address\n const isEmpty = (obj = {}) => Object.keys(obj).length === 0;\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n // Chain isEmpty Check\n if (isEmpty(userStorage?.[address]?.[chainId])) {\n delete userStorage[address][chainId];\n }\n }\n\n // Address isEmpty Check\n if (isEmpty(userStorage?.[address])) {\n delete userStorage[address];\n }\n }\n }\n } catch (err) {\n log.error(\n `Error deleting on-chain notifications for uuids ${uuids.join(', ')}:`,\n err,\n );\n throw err;\n }\n\n return userStorage;\n}\n\n/**\n * Fetches on-chain notifications for the given user storage and BearerToken.\n * This method iterates through the userStorage to find enabled triggers and fetches notifications for those triggers.\n * It makes paginated API calls to the notifications service, transforming and aggregating the notifications into a single array.\n * The process stops either when all pages have been fetched or when a page has less than 100 notifications, indicating the end of the data.\n *\n * @param userStorage - The user's storage object containing trigger information.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @returns A promise that resolves to an array of OnChainRawNotification objects. If no triggers are enabled or an error occurs, it may return an empty array.\n */\nexport async function getOnChainNotifications(\n userStorage: UserStorage,\n bearerToken: string,\n): Promise<OnChainRawNotification[]> {\n const triggerIds = traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (!t.enabled) {\n return undefined;\n }\n return t.id;\n },\n });\n\n if (triggerIds.length === 0) {\n return [];\n }\n\n const onChainNotifications: OnChainRawNotification[] = [];\n const PAGE_LIMIT = 2;\n for (let page = 1; page <= PAGE_LIMIT; page++) {\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY(page),\n 'POST',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n { trigger_ids: triggerIds },\n );\n\n const notifications =\n (await response.json()) as UnprocessedOnChainRawNotification[];\n\n // Transform and sort notifications\n const transformedNotifications = notifications\n .map((n): OnChainRawNotification | undefined => {\n if (!n.data?.kind) {\n return undefined;\n }\n\n return toRawOnChainNotification(n);\n })\n .filter((n): n is OnChainRawNotification => Boolean(n));\n\n onChainNotifications.push(...transformedNotifications);\n\n // if less than 100 notifications on page, then means we reached end\n if (notifications.length < 100) {\n page = PAGE_LIMIT + 1;\n break;\n }\n } catch (err) {\n log.error(\n `Error fetching on-chain notifications for trigger IDs ${triggerIds.join(\n ', ',\n )}:`,\n err,\n );\n // do nothing\n }\n }\n\n return onChainNotifications;\n}\n\n/**\n * Marks the specified notifications as read.\n * This method sends a POST request to the notifications service to mark the provided notification IDs as read.\n * If the operation is successful, it completes without error. If the operation fails, it throws an error with details.\n *\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param notificationIds - An array of notification IDs to be marked as read.\n * @returns A promise that resolves to void. The promise will reject if there's an error during the API call or if the response status is not 200.\n */\nexport async function markNotificationsAsRead(\n bearerToken: string,\n notificationIds: string[],\n): Promise<void> {\n if (notificationIds.length === 0) {\n return;\n }\n\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n 'POST',\n { ids: notificationIds },\n );\n\n if (response.status !== 200) {\n const errorData = await response.json().catch(() => undefined);\n throw new Error(\n `Error marking notifications as read: ${errorData?.message as string}`,\n );\n }\n } catch (err) {\n log.error('Error marking notifications as read:', err);\n throw err;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"onchain-notifications.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/onchain-notifications.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,qBAAqB,EAAE,0CAA0C;AAC1E,OAAO,IAAG,iBAAiB;;AAE3B,OAAO,EAAE,wBAAwB,EAAE,6CAAyC;AAM5E,OAAO,EACL,WAAW,EACX,8BAA8B,EAC9B,2BAA2B,EAC5B,2BAAuB;AASxB,MAAM,CAAC,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,yCAAyC,CAAC;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,WAAW,wBAAwB,CAAC;AACjF,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,gBAAgB,uBAAuB,CAAC;AACzF,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,IAAY,EAAE,EAAE,CACxE,GAAG,8BAA8B,SAAS,IAAI,eAAe,CAAC;AAChE,MAAM,CAAC,MAAM,0CAA0C,GAAG,GAAG,gBAAgB,oCAAoC,CAAC;AAElH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,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F;IAAC,OAAO,GAAG,EAAE;QACZ,GAAG,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,GAAG,CAAC;KACX;AACH,CAAC","sourcesContent":["import { UserStorageController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport { toRawOnChainNotification } from '../../shared/to-raw-notification';\nimport type {\n OnChainRawNotification,\n UnprocessedOnChainRawNotification,\n} from '../types/on-chain-notification/on-chain-notification';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport {\n makeApiCall,\n toggleUserStorageTriggerStatus,\n traverseUserStorageTriggers,\n} from '../utils/utils';\n\nexport type NotificationTrigger = {\n id: string;\n chainId: string;\n kind: string;\n address: string;\n};\n\nexport const TRIGGER_API = 'https://trigger.api.cx.metamask.io';\nexport const NOTIFICATION_API = 'https://notification.api.cx.metamask.io';\nexport const TRIGGER_API_BATCH_ENDPOINT = `${TRIGGER_API}/api/v1/triggers/batch`;\nexport const NOTIFICATION_API_LIST_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications`;\nexport const NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = (page: number) =>\n `${NOTIFICATION_API_LIST_ENDPOINT}?page=${page}&per_page=100`;\nexport const NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications/mark-as-read`;\n\n/**\n * Creates on-chain triggers based on the provided notification triggers.\n * This method generates a unique token for each trigger using the trigger ID and storage key,\n * proving ownership of the trigger being updated. It then makes an API call to create these triggers.\n * Upon successful creation, it updates the userStorage to reflect the new trigger status.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the trigger ID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param triggers - An array of notification triggers to be created. Each trigger includes an ID, chain ID, kind, and address.\n * @returns A promise that resolves to void. Throws an error if the API call fails or if there's an issue creating the triggers.\n */\nexport async function createOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n triggers: NotificationTrigger[],\n): Promise<void> {\n type RequestPayloadTrigger = {\n id: string;\n // this is the trigger token, generated by using the uuid + storage key. It proves you own the trigger you are updating\n token: string;\n config: {\n kind: string;\n chain_id: number;\n address: string;\n };\n };\n const triggersToCreate: RequestPayloadTrigger[] = triggers.map((t) => ({\n id: t.id,\n token: UserStorageController.createSHA256Hash(t.id + storageKey),\n config: {\n kind: t.kind,\n chain_id: Number(t.chainId),\n address: t.address,\n },\n }));\n\n if (triggersToCreate.length === 0) {\n return;\n }\n\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'POST',\n triggersToCreate,\n );\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => undefined);\n log.error('Error creating triggers:', errorData);\n throw new Error('OnChain Notifications - unable to create triggers');\n }\n\n // If the trigger creation was fine\n // then update the userStorage\n for (const trigger of triggersToCreate) {\n toggleUserStorageTriggerStatus(\n userStorage,\n trigger.config.address,\n String(trigger.config.chain_id),\n trigger.id,\n true,\n );\n }\n}\n\n/**\n * Deletes on-chain triggers based on the provided UUIDs.\n * This method generates a unique token for each trigger using the UUID and storage key,\n * proving ownership of the trigger being deleted. It then makes an API call to delete these triggers.\n * Upon successful deletion, it updates the userStorage to remove the deleted trigger statuses.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the UUID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param uuids - An array of UUIDs representing the triggers to be deleted.\n * @returns A promise that resolves to the updated UserStorage object. Throws an error if the API call fails or if there's an issue deleting the triggers.\n */\nexport async function deleteOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n uuids: string[],\n): Promise<UserStorage> {\n const triggersToDelete = uuids.map((uuid) => ({\n id: uuid,\n token: UserStorageController.createSHA256Hash(uuid + storageKey),\n }));\n\n try {\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'DELETE',\n triggersToDelete,\n );\n\n if (!response.ok) {\n throw new Error(\n `Failed to delete on-chain notifications for uuids ${uuids.join(', ')}`,\n );\n }\n\n // Update the state of the deleted trigger to false\n for (const uuid of uuids) {\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n if (userStorage?.[address]?.[chainId]?.[uuid]) {\n delete userStorage[address][chainId][uuid];\n }\n }\n }\n }\n }\n\n // Follow-up cleanup, if an address had no triggers whatsoever, then we can delete the address\n const isEmpty = (obj = {}) => Object.keys(obj).length === 0;\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n // Chain isEmpty Check\n if (isEmpty(userStorage?.[address]?.[chainId])) {\n delete userStorage[address][chainId];\n }\n }\n\n // Address isEmpty Check\n if (isEmpty(userStorage?.[address])) {\n delete userStorage[address];\n }\n }\n }\n } catch (err) {\n log.error(\n `Error deleting on-chain notifications for uuids ${uuids.join(', ')}:`,\n err,\n );\n throw err;\n }\n\n return userStorage;\n}\n\n/**\n * Fetches on-chain notifications for the given user storage and BearerToken.\n * This method iterates through the userStorage to find enabled triggers and fetches notifications for those triggers.\n * It makes paginated API calls to the notifications service, transforming and aggregating the notifications into a single array.\n * The process stops either when all pages have been fetched or when a page has less than 100 notifications, indicating the end of the data.\n *\n * @param userStorage - The user's storage object containing trigger information.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @returns A promise that resolves to an array of OnChainRawNotification objects. If no triggers are enabled or an error occurs, it may return an empty array.\n */\nexport async function getOnChainNotifications(\n userStorage: UserStorage,\n bearerToken: string,\n): Promise<OnChainRawNotification[]> {\n const triggerIds = traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (!t.enabled) {\n return undefined;\n }\n return t.id;\n },\n });\n\n if (triggerIds.length === 0) {\n return [];\n }\n\n const onChainNotifications: OnChainRawNotification[] = [];\n const PAGE_LIMIT = 2;\n for (let page = 1; page <= PAGE_LIMIT; page++) {\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY(page),\n 'POST',\n { trigger_ids: triggerIds },\n );\n\n const notifications =\n (await response.json()) as UnprocessedOnChainRawNotification[];\n\n // Transform and sort notifications\n const transformedNotifications = notifications\n .map((n): OnChainRawNotification | undefined => {\n if (!n.data?.kind) {\n return undefined;\n }\n\n return toRawOnChainNotification(n);\n })\n .filter((n): n is OnChainRawNotification => Boolean(n));\n\n onChainNotifications.push(...transformedNotifications);\n\n // if less than 100 notifications on page, then means we reached end\n if (notifications.length < 100) {\n page = PAGE_LIMIT + 1;\n break;\n }\n } catch (err) {\n log.error(\n `Error fetching on-chain notifications for trigger IDs ${triggerIds.join(\n ', ',\n )}:`,\n err,\n );\n // do nothing\n }\n }\n\n return onChainNotifications;\n}\n\n/**\n * Marks the specified notifications as read.\n * This method sends a POST request to the notifications service to mark the provided notification IDs as read.\n * If the operation is successful, it completes without error. If the operation fails, it throws an error with details.\n *\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param notificationIds - An array of notification IDs to be marked as read.\n * @returns A promise that resolves to void. The promise will reject if there's an error during the API call or if the response status is not 200.\n */\nexport async function markNotificationsAsRead(\n bearerToken: string,\n notificationIds: string[],\n): Promise<void> {\n if (notificationIds.length === 0) {\n return;\n }\n\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n 'POST',\n { ids: notificationIds },\n );\n\n if (response.status !== 200) {\n const errorData = await response.json().catch(() => undefined);\n throw new Error(\n `Error marking notifications as read: ${errorData?.message as string}`,\n );\n }\n } catch (err) {\n log.error('Error marking notifications as read:', err);\n throw err;\n }\n}\n"]}
|
package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-announcement.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"feature-announcement.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"","sourcesContent":["import type { TypeFeatureAnnouncement } from './type-feature-announcement';\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\n\nexport type FeatureAnnouncementRawNotificationData = Omit<\n TypeFeatureAnnouncement['fields'],\n | 'image'\n | 'longDescription'\n | 'extensionLink'\n | 'portfolioLink'\n | 'externalLink'\n | 'mobileLink'\n> & {\n longDescription: string;\n image: {\n title?: string;\n description?: string;\n url: string;\n };\n\n // External Link\n externalLink?: {\n externalLinkText: string;\n externalLinkUrl: string;\n };\n\n // Portfolio Link\n portfolioLink?: {\n portfolioLinkText: string;\n portfolioLinkUrl: string;\n };\n\n // Extension Link\n extensionLink?: {\n extensionLinkText: string;\n extensionLinkRoute: string;\n };\n\n // Mobile Link\n mobileLink?: {\n mobileLinkText: string;\n mobileLinkUrl: string;\n };\n};\n\nexport type FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT;\n createdAt: string;\n data: FeatureAnnouncementRawNotificationData;\n};\n"]}
|
package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TRIGGER_TYPES } from "../../constants/notification-schema.cjs";
|
|
2
1
|
import type { TypeFeatureAnnouncement } from "./type-feature-announcement.cjs";
|
|
2
|
+
import type { TRIGGER_TYPES } from "../../constants/notification-schema.cjs";
|
|
3
3
|
export type FeatureAnnouncementRawNotificationData = Omit<TypeFeatureAnnouncement['fields'], 'image' | 'longDescription' | 'extensionLink' | 'portfolioLink' | 'externalLink' | 'mobileLink'> & {
|
|
4
4
|
longDescription: string;
|
|
5
5
|
image: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-announcement.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"feature-announcement.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,wCAAoC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AAEzE,MAAM,MAAM,sCAAsC,GAAG,IAAI,CACvD,uBAAuB,CAAC,QAAQ,CAAC,EAC/B,OAAO,GACP,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,cAAc,GACd,YAAY,CACf,GAAG;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IAGF,YAAY,CAAC,EAAE;QACb,gBAAgB,EAAE,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IAGF,aAAa,CAAC,EAAE;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IAGF,aAAa,CAAC,EAAE;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;IAGF,UAAU,CAAC,EAAE;QACX,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,aAAa,CAAC,qBAAqB,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,sCAAsC,CAAC;CAC9C,CAAC"}
|
package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TRIGGER_TYPES } from "../../constants/notification-schema.mjs";
|
|
2
1
|
import type { TypeFeatureAnnouncement } from "./type-feature-announcement.mjs";
|
|
2
|
+
import type { TRIGGER_TYPES } from "../../constants/notification-schema.mjs";
|
|
3
3
|
export type FeatureAnnouncementRawNotificationData = Omit<TypeFeatureAnnouncement['fields'], 'image' | 'longDescription' | 'extensionLink' | 'portfolioLink' | 'externalLink' | 'mobileLink'> & {
|
|
4
4
|
longDescription: string;
|
|
5
5
|
image: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-announcement.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"feature-announcement.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,wCAAoC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AAEzE,MAAM,MAAM,sCAAsC,GAAG,IAAI,CACvD,uBAAuB,CAAC,QAAQ,CAAC,EAC/B,OAAO,GACP,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,cAAc,GACd,YAAY,CACf,GAAG;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IAGF,YAAY,CAAC,EAAE;QACb,gBAAgB,EAAE,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IAGF,aAAa,CAAC,EAAE;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IAGF,aAAa,CAAC,EAAE;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;IAGF,UAAU,CAAC,EAAE;QACX,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,aAAa,CAAC,qBAAqB,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,sCAAsC,CAAC;CAC9C,CAAC"}
|
package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-announcement.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"feature-announcement.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/feature-announcement.ts"],"names":[],"mappings":"","sourcesContent":["import type { TypeFeatureAnnouncement } from './type-feature-announcement';\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\n\nexport type FeatureAnnouncementRawNotificationData = Omit<\n TypeFeatureAnnouncement['fields'],\n | 'image'\n | 'longDescription'\n | 'extensionLink'\n | 'portfolioLink'\n | 'externalLink'\n | 'mobileLink'\n> & {\n longDescription: string;\n image: {\n title?: string;\n description?: string;\n url: string;\n };\n\n // External Link\n externalLink?: {\n externalLinkText: string;\n externalLinkUrl: string;\n };\n\n // Portfolio Link\n portfolioLink?: {\n portfolioLinkText: string;\n portfolioLinkUrl: string;\n };\n\n // Extension Link\n extensionLink?: {\n extensionLinkText: string;\n extensionLinkRoute: string;\n };\n\n // Mobile Link\n mobileLink?: {\n mobileLinkText: string;\n mobileLinkUrl: string;\n };\n};\n\nexport type FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT;\n createdAt: string;\n data: FeatureAnnouncementRawNotificationData;\n};\n"]}
|
|
@@ -1,20 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./feature-announcement.cjs"), exports);
|
|
18
|
-
__exportStar(require("./type-links.cjs"), exports);
|
|
19
|
-
__exportStar(require("./type-feature-announcement.cjs"), exports);
|
|
20
3
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './feature-announcement';\nexport type * from './type-links';\nexport type * from './type-feature-announcement';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./feature-announcement.cjs";
|
|
2
|
-
export * from "./type-links.cjs";
|
|
3
|
-
export * from "./type-feature-announcement.cjs";
|
|
1
|
+
export type * from "./feature-announcement.cjs";
|
|
2
|
+
export type * from "./type-links.cjs";
|
|
3
|
+
export type * from "./type-feature-announcement.cjs";
|
|
4
4
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"AAAA,gDAA4C;AAC5C,sCAAkC;AAClC,qDAAiD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./feature-announcement.mjs";
|
|
2
|
-
export * from "./type-links.mjs";
|
|
3
|
-
export * from "./type-feature-announcement.mjs";
|
|
1
|
+
export type * from "./feature-announcement.mjs";
|
|
2
|
+
export type * from "./type-links.mjs";
|
|
3
|
+
export type * from "./type-feature-announcement.mjs";
|
|
4
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"AAAA,gDAA4C;AAC5C,sCAAkC;AAClC,qDAAiD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/feature-announcement/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './feature-announcement';\nexport type * from './type-links';\nexport type * from './type-feature-announcement';\n"]}
|
|
@@ -1,22 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./feature-announcement/index.cjs"), exports);
|
|
18
|
-
__exportStar(require("./notification/index.cjs"), exports);
|
|
19
|
-
__exportStar(require("./on-chain-notification/index.cjs"), exports);
|
|
20
|
-
__exportStar(require("./user-storage/index.cjs"), exports);
|
|
21
|
-
__exportStar(require("./snaps/snaps.cjs"), exports);
|
|
22
3
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './feature-announcement';\nexport type * from './notification';\nexport type * from './on-chain-notification';\nexport type * from './user-storage';\nexport type * from './snaps/snaps';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./feature-announcement/index.cjs";
|
|
2
|
-
export * from "./notification/index.cjs";
|
|
3
|
-
export * from "./on-chain-notification/index.cjs";
|
|
4
|
-
export * from "./user-storage/index.cjs";
|
|
5
|
-
export * from "./snaps/snaps.cjs";
|
|
1
|
+
export type * from "./feature-announcement/index.cjs";
|
|
2
|
+
export type * from "./notification/index.cjs";
|
|
3
|
+
export type * from "./on-chain-notification/index.cjs";
|
|
4
|
+
export type * from "./user-storage/index.cjs";
|
|
5
|
+
export type * from "./snaps/snaps.cjs";
|
|
6
6
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"AAAA,sDAA4C;AAC5C,8CAAoC;AACpC,uDAA6C;AAC7C,8CAAoC;AACpC,uCAAmC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./feature-announcement/index.mjs";
|
|
2
|
-
export * from "./notification/index.mjs";
|
|
3
|
-
export * from "./on-chain-notification/index.mjs";
|
|
4
|
-
export * from "./user-storage/index.mjs";
|
|
5
|
-
export * from "./snaps/snaps.mjs";
|
|
1
|
+
export type * from "./feature-announcement/index.mjs";
|
|
2
|
+
export type * from "./notification/index.mjs";
|
|
3
|
+
export type * from "./on-chain-notification/index.mjs";
|
|
4
|
+
export type * from "./user-storage/index.mjs";
|
|
5
|
+
export type * from "./snaps/snaps.mjs";
|
|
6
6
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"AAAA,sDAA4C;AAC5C,8CAAoC;AACpC,uDAA6C;AAC7C,8CAAoC;AACpC,uCAAmC"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./notification/index.mjs";
|
|
3
|
-
export * from "./on-chain-notification/index.mjs";
|
|
4
|
-
export * from "./user-storage/index.mjs";
|
|
5
|
-
export * from "./snaps/snaps.mjs";
|
|
1
|
+
export {};
|
|
6
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './feature-announcement';\nexport type * from './notification';\nexport type * from './on-chain-notification';\nexport type * from './user-storage';\nexport type * from './snaps/snaps';\n"]}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./notification.cjs"), exports);
|
|
18
3
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './notification';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./notification.cjs";
|
|
1
|
+
export type * from "./notification.cjs";
|
|
2
2
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"AAAA,wCAAoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./notification.mjs";
|
|
1
|
+
export type * from "./notification.mjs";
|
|
2
2
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"AAAA,wCAAoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './notification';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n
|
|
1
|
+
{"version":3,"file":"notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n token_id: string;\n image: string;\n collection?: {\n name: string;\n image: string;\n };\n};\n\nexport type MarkAsReadNotificationsParam = Pick<\n INotification,\n 'id' | 'type' | 'isRead'\n>[];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;
|
|
1
|
+
{"version":3,"file":"notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,aAAa,EACb,IAAI,GAAG,MAAM,GAAG,QAAQ,CACzB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;
|
|
1
|
+
{"version":3,"file":"notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,yDAAqD;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,2DAAuD;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAAiB;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAC/B,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,GACvD,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,GAC3C,CAAC,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAC1E,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,aAAa,EACb,IAAI,GAAG,MAAM,GAAG,QAAQ,CACzB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n
|
|
1
|
+
{"version":3,"file":"notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/notification/notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../feature-announcement/feature-announcement';\nimport type { OnChainRawNotification } from '../on-chain-notification/on-chain-notification';\nimport type { RawSnapNotification } from '../snaps';\nimport type { Compute } from '../type-utils';\n\nexport type BaseNotification = {\n id: string;\n createdAt: string;\n isRead: boolean;\n};\n\nexport type RawNotificationUnion =\n | OnChainRawNotification\n | FeatureAnnouncementRawNotification\n | RawSnapNotification;\n\n/**\n * The shape of a \"generic\" notification.\n * Other than the fields listed below, tt will also contain:\n * - `type` field (declared in the Raw shapes)\n * - `data` field (declared in the Raw shapes)\n */\nexport type INotification = Compute<\n | (FeatureAnnouncementRawNotification & BaseNotification)\n | (OnChainRawNotification & BaseNotification)\n | (RawSnapNotification & BaseNotification & { readDate?: string | null })\n>;\n\n// NFT\nexport type NFT = {\n token_id: string;\n image: string;\n collection?: {\n name: string;\n image: string;\n };\n};\n\nexport type MarkAsReadNotificationsParam = Pick<\n INotification,\n 'id' | 'type' | 'isRead'\n>[];\n"]}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./on-chain-notification.cjs"), exports);
|
|
18
3
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './on-chain-notification';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./on-chain-notification.cjs";
|
|
1
|
+
export type * from "./on-chain-notification.cjs";
|
|
2
2
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"AAAA,iDAA6C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./on-chain-notification.mjs";
|
|
1
|
+
export type * from "./on-chain-notification.mjs";
|
|
2
2
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"AAAA,iDAA6C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './on-chain-notification';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"on-chain-notification.cjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { components } from './schema';\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\n\nexport type Data_MetamaskSwapCompleted =\n components['schemas']['Data_MetamaskSwapCompleted'];\nexport type Data_LidoStakeReadyToBeWithdrawn =\n components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];\nexport type Data_LidoStakeCompleted =\n components['schemas']['Data_LidoStakeCompleted'];\nexport type Data_LidoWithdrawalRequested =\n components['schemas']['Data_LidoWithdrawalRequested'];\nexport type Data_LidoWithdrawalCompleted =\n components['schemas']['Data_LidoWithdrawalCompleted'];\nexport type Data_RocketPoolStakeCompleted =\n components['schemas']['Data_RocketPoolStakeCompleted'];\nexport type Data_RocketPoolUnstakeCompleted =\n components['schemas']['Data_RocketPoolUnstakeCompleted'];\nexport type Data_ETHSent = components['schemas']['Data_ETHSent'];\nexport type Data_ETHReceived = components['schemas']['Data_ETHReceived'];\nexport type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];\nexport type Data_ERC20Received = components['schemas']['Data_ERC20Received'];\nexport type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];\nexport type Data_ERC721Received = components['schemas']['Data_ERC721Received'];\n\n// Web3Notifications\nexport type Data_AaveV3HealthFactor =\n components['schemas']['Data_AaveV3HealthFactor'];\nexport type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];\nexport type Data_LidoStakingRewards =\n components['schemas']['Data_LidoStakingRewards'];\nexport type Data_RocketpoolStakingRewards =\n components['schemas']['Data_RocketpoolStakingRewards'];\nexport type Data_NotionalLoanExpiration =\n components['schemas']['Data_NotionalLoanExpiration'];\nexport type Data_SparkFiHealthFactor =\n components['schemas']['Data_SparkFiHealthFactor'];\n\ntype Notification =\n | components['schemas']['WalletNotification']\n | components['schemas']['Web3Notification'];\ntype ConvertToEnum<Kind> = {\n [K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;\n}[TRIGGER_TYPES];\n\n/**\n * Type-Computation.\n * 1. Adds a `type` field to the notification, it converts the schema type into the ENUM we use.\n * 2. It ensures that the `data` field is the correct Notification data for this `type`\n * - The `Compute` utility merges the intersections (`&`) for a prettier type.\n */\ntype NormalizeNotification<\n N extends Notification,\n NotificationDataKinds extends string = NonNullable<N['data']>['kind'],\n> = {\n [K in NotificationDataKinds]: Compute<\n Omit<N, 'data'> & {\n type: ConvertToEnum<K>;\n data: Extract<N['data'], { kind: K }>;\n }\n >;\n}[NotificationDataKinds];\n\nexport type OnChainRawNotification = Compute<\n | NormalizeNotification<components['schemas']['WalletNotification']>\n | NormalizeNotification<components['schemas']['Web3Notification']>\n>;\n\nexport type UnprocessedOnChainRawNotification = Notification;\n\nexport type OnChainRawNotificationsWithNetworkFields = Extract<\n OnChainRawNotification,\n { data: { network_fee: unknown } }\n>;\n"]}
|
package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { components } from "./schema.cjs";
|
|
1
2
|
import type { TRIGGER_TYPES } from "../../constants/notification-schema.cjs";
|
|
2
3
|
import type { Compute } from "../type-utils.cjs";
|
|
3
|
-
import type { components } from "./schema.cjs";
|
|
4
4
|
export type Data_MetamaskSwapCompleted = components['schemas']['Data_MetamaskSwapCompleted'];
|
|
5
5
|
export type Data_LidoStakeReadyToBeWithdrawn = components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];
|
|
6
6
|
export type Data_LidoStakeCompleted = components['schemas']['Data_LidoStakeCompleted'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"on-chain-notification.d.cts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAiB;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;AAE7C,MAAM,MAAM,0BAA0B,GACpC,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAC;AACtD,MAAM,MAAM,gCAAgC,GAC1C,UAAU,CAAC,SAAS,CAAC,CAAC,kCAAkC,CAAC,CAAC;AAC5D,MAAM,MAAM,uBAAuB,GACjC,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACnD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,4BAA4B,GACtC,UAAU,CAAC,SAAS,CAAC,CAAC,8BAA8B,CAAC,CAAC;AACxD,MAAM,MAAM,6BAA6B,GACvC,UAAU,CAAC,SAAS,CAAC,CAAC,+BAA+B,CAAC,CAAC;AACzD,MAAM,MAAM,+BAA+B,GACzC,UAAU,CAAC,SAAS,CAAC,CAAC,iCAAiC,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAC7E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,UAA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,CACF;CACF,CAAC,qBAAqB,CAAC,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG,OAAO,CACxC,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC,GAClE,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,CACnE,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,YAAY,CAAC;AAE7D,MAAM,MAAM,wCAAwC,GAAG,OAAO,CAC5D,sBAAsB,EACtB;IAAE,IAAI,EAAE;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,CACnC,CAAC"}
|
package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { components } from "./schema.mjs";
|
|
1
2
|
import type { TRIGGER_TYPES } from "../../constants/notification-schema.mjs";
|
|
2
3
|
import type { Compute } from "../type-utils.mjs";
|
|
3
|
-
import type { components } from "./schema.mjs";
|
|
4
4
|
export type Data_MetamaskSwapCompleted = components['schemas']['Data_MetamaskSwapCompleted'];
|
|
5
5
|
export type Data_LidoStakeReadyToBeWithdrawn = components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];
|
|
6
6
|
export type Data_LidoStakeCompleted = components['schemas']['Data_LidoStakeCompleted'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"on-chain-notification.d.mts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAiB;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,gDAA4C;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAsB;A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B,CAAC,CAAC,CACnE,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,YAAY,CAAC;AAE7D,MAAM,MAAM,wCAAwC,GAAG,OAAO,CAC5D,sBAAsB,EACtB;IAAE,IAAI,EAAE;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-chain-notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"on-chain-notification.mjs","sourceRoot":"","sources":["../../../../src/NotificationServicesController/types/on-chain-notification/on-chain-notification.ts"],"names":[],"mappings":"","sourcesContent":["import type { components } from './schema';\nimport type { TRIGGER_TYPES } from '../../constants/notification-schema';\nimport type { Compute } from '../type-utils';\n\nexport type Data_MetamaskSwapCompleted =\n components['schemas']['Data_MetamaskSwapCompleted'];\nexport type Data_LidoStakeReadyToBeWithdrawn =\n components['schemas']['Data_LidoStakeReadyToBeWithdrawn'];\nexport type Data_LidoStakeCompleted =\n components['schemas']['Data_LidoStakeCompleted'];\nexport type Data_LidoWithdrawalRequested =\n components['schemas']['Data_LidoWithdrawalRequested'];\nexport type Data_LidoWithdrawalCompleted =\n components['schemas']['Data_LidoWithdrawalCompleted'];\nexport type Data_RocketPoolStakeCompleted =\n components['schemas']['Data_RocketPoolStakeCompleted'];\nexport type Data_RocketPoolUnstakeCompleted =\n components['schemas']['Data_RocketPoolUnstakeCompleted'];\nexport type Data_ETHSent = components['schemas']['Data_ETHSent'];\nexport type Data_ETHReceived = components['schemas']['Data_ETHReceived'];\nexport type Data_ERC20Sent = components['schemas']['Data_ERC20Sent'];\nexport type Data_ERC20Received = components['schemas']['Data_ERC20Received'];\nexport type Data_ERC721Sent = components['schemas']['Data_ERC721Sent'];\nexport type Data_ERC721Received = components['schemas']['Data_ERC721Received'];\n\n// Web3Notifications\nexport type Data_AaveV3HealthFactor =\n components['schemas']['Data_AaveV3HealthFactor'];\nexport type Data_EnsExpiration = components['schemas']['Data_EnsExpiration'];\nexport type Data_LidoStakingRewards =\n components['schemas']['Data_LidoStakingRewards'];\nexport type Data_RocketpoolStakingRewards =\n components['schemas']['Data_RocketpoolStakingRewards'];\nexport type Data_NotionalLoanExpiration =\n components['schemas']['Data_NotionalLoanExpiration'];\nexport type Data_SparkFiHealthFactor =\n components['schemas']['Data_SparkFiHealthFactor'];\n\ntype Notification =\n | components['schemas']['WalletNotification']\n | components['schemas']['Web3Notification'];\ntype ConvertToEnum<Kind> = {\n [K in TRIGGER_TYPES]: Kind extends `${K}` ? K : never;\n}[TRIGGER_TYPES];\n\n/**\n * Type-Computation.\n * 1. Adds a `type` field to the notification, it converts the schema type into the ENUM we use.\n * 2. It ensures that the `data` field is the correct Notification data for this `type`\n * - The `Compute` utility merges the intersections (`&`) for a prettier type.\n */\ntype NormalizeNotification<\n N extends Notification,\n NotificationDataKinds extends string = NonNullable<N['data']>['kind'],\n> = {\n [K in NotificationDataKinds]: Compute<\n Omit<N, 'data'> & {\n type: ConvertToEnum<K>;\n data: Extract<N['data'], { kind: K }>;\n }\n >;\n}[NotificationDataKinds];\n\nexport type OnChainRawNotification = Compute<\n | NormalizeNotification<components['schemas']['WalletNotification']>\n | NormalizeNotification<components['schemas']['Web3Notification']>\n>;\n\nexport type UnprocessedOnChainRawNotification = Notification;\n\nexport type OnChainRawNotificationsWithNetworkFields = Extract<\n OnChainRawNotification,\n { data: { network_fee: unknown } }\n>;\n"]}
|