@metamask-previews/notification-services-controller 24.3.0-preview-429f86194 → 24.3.0-preview-ef063ff2d

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 (48) hide show
  1. package/CHANGELOG.md +0 -19
  2. package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs +16 -32
  3. package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs.map +1 -1
  4. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.cts.map +1 -1
  5. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts.map +1 -1
  6. package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs +16 -32
  7. package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs.map +1 -1
  8. package/dist/NotificationServicesController/services/api-notifications.cjs +2 -2
  9. package/dist/NotificationServicesController/services/api-notifications.cjs.map +1 -1
  10. package/dist/NotificationServicesController/services/api-notifications.mjs +2 -2
  11. package/dist/NotificationServicesController/services/api-notifications.mjs.map +1 -1
  12. package/dist/NotificationServicesController/types/notification-api/notification-api.cjs +0 -1
  13. package/dist/NotificationServicesController/types/notification-api/notification-api.cjs.map +1 -1
  14. package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts +14 -7
  15. package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts.map +1 -1
  16. package/dist/NotificationServicesController/types/notification-api/notification-api.d.mts +14 -7
  17. package/dist/NotificationServicesController/types/notification-api/notification-api.d.mts.map +1 -1
  18. package/dist/NotificationServicesController/types/notification-api/notification-api.mjs +1 -1
  19. package/dist/NotificationServicesController/types/notification-api/notification-api.mjs.map +1 -1
  20. package/dist/NotificationServicesController/types/notification-api/schema.cjs.map +1 -1
  21. package/dist/NotificationServicesController/types/notification-api/schema.d.cts +2 -366
  22. package/dist/NotificationServicesController/types/notification-api/schema.d.cts.map +1 -1
  23. package/dist/NotificationServicesController/types/notification-api/schema.d.mts +2 -366
  24. package/dist/NotificationServicesController/types/notification-api/schema.d.mts.map +1 -1
  25. package/dist/NotificationServicesController/types/notification-api/schema.mjs.map +1 -1
  26. package/dist/shared/index.cjs +0 -1
  27. package/dist/shared/index.cjs.map +1 -1
  28. package/dist/shared/index.d.cts +0 -1
  29. package/dist/shared/index.d.cts.map +1 -1
  30. package/dist/shared/index.d.mts +0 -1
  31. package/dist/shared/index.d.mts.map +1 -1
  32. package/dist/shared/index.mjs +0 -1
  33. package/dist/shared/index.mjs.map +1 -1
  34. package/dist/shared/to-raw-notification.cjs +13 -8
  35. package/dist/shared/to-raw-notification.cjs.map +1 -1
  36. package/dist/shared/to-raw-notification.d.cts.map +1 -1
  37. package/dist/shared/to-raw-notification.d.mts.map +1 -1
  38. package/dist/shared/to-raw-notification.mjs +13 -8
  39. package/dist/shared/to-raw-notification.mjs.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/shared/notification-api-type-guards.cjs +0 -24
  42. package/dist/shared/notification-api-type-guards.cjs.map +0 -1
  43. package/dist/shared/notification-api-type-guards.d.cts +0 -16
  44. package/dist/shared/notification-api-type-guards.d.cts.map +0 -1
  45. package/dist/shared/notification-api-type-guards.d.mts +0 -16
  46. package/dist/shared/notification-api-type-guards.d.mts.map +0 -1
  47. package/dist/shared/notification-api-type-guards.mjs +0 -19
  48. package/dist/shared/notification-api-type-guards.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"to-raw-notification.cjs","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":";;;AAOA,6GAAgG;AAChG,qFAAuE;AAEvE;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAClC,IAAgC;IAEhC,IAAI,IAAA,oDAAqB,EAAC,IAAI,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;SACH,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,IAAI,EAAE,mCAAa,CAAC,QAAQ;KACF,CAAC;AAC/B,CAAC;AAnBD,oDAmBC","sourcesContent":["import type {\n UnprocessedRawNotification,\n NormalisedAPINotification,\n OnChainRawNotification,\n PlatformRawNotification,\n} from 'src/NotificationServicesController/types/notification-api';\n\nimport { TRIGGER_TYPES } from '../NotificationServicesController/constants/notification-schema';\nimport { isOnChainNotification } from './notification-api-type-guards';\n\n/**\n * A true \"raw notification\" does not have some fields that exist on this type. E.g. the `type` field.\n * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.\n * We use this to ensure that the correct missing fields are added to the raw shapes\n *\n * @param data - raw onchain notification\n * @returns a complete raw onchain notification\n */\nexport function toRawAPINotification(\n data: UnprocessedRawNotification,\n): NormalisedAPINotification {\n if (isOnChainNotification(data)) {\n if (!data.payload.data?.kind) {\n throw new Error(\n 'toRawAPINotification - No kind found for on-chain notification',\n );\n }\n return {\n ...data,\n type: data.payload.data.kind,\n } as OnChainRawNotification;\n }\n\n return {\n ...data,\n type: TRIGGER_TYPES.PLATFORM,\n } as PlatformRawNotification;\n}\n"]}
1
+ {"version":3,"file":"to-raw-notification.cjs","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":";;;AAOA;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAClC,IAAgC;IAEhC,MAAM,iBAAiB,GAAG,CAAC,CAAQ,EAAS,EAAE;QAC5C,MAAM,IAAI,GAAW,IAAI,EAAE,iBAAiB,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,mEAAmE,IAAI,EAAE,CAC1E,CAAC;IACJ,CAAC,CAAC;IAEF,IAAI,IAAI,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC1C,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;SACH,CAAC;IAC9B,CAAC;IAED,IAAI,IAAI,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC1C,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,CAAC,iBAAiB;SACF,CAAC;IAC/B,CAAC;IAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AA9BD,oDA8BC","sourcesContent":["import type {\n UnprocessedRawNotification,\n NormalisedAPINotification,\n OnChainRawNotification,\n PlatformRawNotification,\n} from 'src/NotificationServicesController/types/notification-api';\n\n/**\n * A true \"raw notification\" does not have some fields that exist on this type. E.g. the `type` field.\n * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.\n * We use this to ensure that the correct missing fields are added to the raw shapes\n *\n * @param data - raw onchain notification\n * @returns a complete raw onchain notification\n */\nexport function toRawAPINotification(\n data: UnprocessedRawNotification,\n): NormalisedAPINotification {\n const exhaustedAllCases = (_: never): never => {\n const type: string = data?.notification_type;\n throw new Error(\n `toRawAPINotification - No processor found for notification kind ${type}`,\n );\n };\n\n if (data.notification_type === 'on-chain') {\n if (!data?.payload?.data?.kind) {\n throw new Error(\n 'toRawAPINotification - No kind found for on-chain notification',\n );\n }\n return {\n ...data,\n type: data.payload.data.kind,\n } as OnChainRawNotification;\n }\n\n if (data.notification_type === 'platform') {\n return {\n ...data,\n type: data.notification_type,\n } as PlatformRawNotification;\n }\n\n return exhaustedAllCases(data);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"to-raw-notification.d.cts","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EAG1B,kEAAkE;AAKnE;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,0BAA0B,GAC/B,yBAAyB,CAiB3B"}
1
+ {"version":3,"file":"to-raw-notification.d.cts","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EAG1B,kEAAkE;AAEnE;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,0BAA0B,GAC/B,yBAAyB,CA4B3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"to-raw-notification.d.mts","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EAG1B,kEAAkE;AAKnE;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,0BAA0B,GAC/B,yBAAyB,CAiB3B"}
1
+ {"version":3,"file":"to-raw-notification.d.mts","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EAG1B,kEAAkE;AAEnE;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,0BAA0B,GAC/B,yBAAyB,CA4B3B"}
@@ -1,5 +1,3 @@
1
- import { TRIGGER_TYPES } from "../NotificationServicesController/constants/notification-schema.mjs";
2
- import { isOnChainNotification } from "./notification-api-type-guards.mjs";
3
1
  /**
4
2
  * A true "raw notification" does not have some fields that exist on this type. E.g. the `type` field.
5
3
  * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.
@@ -9,8 +7,12 @@ import { isOnChainNotification } from "./notification-api-type-guards.mjs";
9
7
  * @returns a complete raw onchain notification
10
8
  */
11
9
  export function toRawAPINotification(data) {
12
- if (isOnChainNotification(data)) {
13
- if (!data.payload.data?.kind) {
10
+ const exhaustedAllCases = (_) => {
11
+ const type = data?.notification_type;
12
+ throw new Error(`toRawAPINotification - No processor found for notification kind ${type}`);
13
+ };
14
+ if (data.notification_type === 'on-chain') {
15
+ if (!data?.payload?.data?.kind) {
14
16
  throw new Error('toRawAPINotification - No kind found for on-chain notification');
15
17
  }
16
18
  return {
@@ -18,9 +20,12 @@ export function toRawAPINotification(data) {
18
20
  type: data.payload.data.kind,
19
21
  };
20
22
  }
21
- return {
22
- ...data,
23
- type: TRIGGER_TYPES.PLATFORM,
24
- };
23
+ if (data.notification_type === 'platform') {
24
+ return {
25
+ ...data,
26
+ type: data.notification_type,
27
+ };
28
+ }
29
+ return exhaustedAllCases(data);
25
30
  }
26
31
  //# sourceMappingURL=to-raw-notification.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-raw-notification.mjs","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,4EAAwE;AAChG,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAEvE;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAgC;IAEhC,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;SACH,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,IAAI,EAAE,aAAa,CAAC,QAAQ;KACF,CAAC;AAC/B,CAAC","sourcesContent":["import type {\n UnprocessedRawNotification,\n NormalisedAPINotification,\n OnChainRawNotification,\n PlatformRawNotification,\n} from 'src/NotificationServicesController/types/notification-api';\n\nimport { TRIGGER_TYPES } from '../NotificationServicesController/constants/notification-schema';\nimport { isOnChainNotification } from './notification-api-type-guards';\n\n/**\n * A true \"raw notification\" does not have some fields that exist on this type. E.g. the `type` field.\n * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.\n * We use this to ensure that the correct missing fields are added to the raw shapes\n *\n * @param data - raw onchain notification\n * @returns a complete raw onchain notification\n */\nexport function toRawAPINotification(\n data: UnprocessedRawNotification,\n): NormalisedAPINotification {\n if (isOnChainNotification(data)) {\n if (!data.payload.data?.kind) {\n throw new Error(\n 'toRawAPINotification - No kind found for on-chain notification',\n );\n }\n return {\n ...data,\n type: data.payload.data.kind,\n } as OnChainRawNotification;\n }\n\n return {\n ...data,\n type: TRIGGER_TYPES.PLATFORM,\n } as PlatformRawNotification;\n}\n"]}
1
+ {"version":3,"file":"to-raw-notification.mjs","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAgC;IAEhC,MAAM,iBAAiB,GAAG,CAAC,CAAQ,EAAS,EAAE;QAC5C,MAAM,IAAI,GAAW,IAAI,EAAE,iBAAiB,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,mEAAmE,IAAI,EAAE,CAC1E,CAAC;IACJ,CAAC,CAAC;IAEF,IAAI,IAAI,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC1C,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;SACH,CAAC;IAC9B,CAAC;IAED,IAAI,IAAI,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC1C,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,CAAC,iBAAiB;SACF,CAAC;IAC/B,CAAC;IAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type {\n UnprocessedRawNotification,\n NormalisedAPINotification,\n OnChainRawNotification,\n PlatformRawNotification,\n} from 'src/NotificationServicesController/types/notification-api';\n\n/**\n * A true \"raw notification\" does not have some fields that exist on this type. E.g. the `type` field.\n * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.\n * We use this to ensure that the correct missing fields are added to the raw shapes\n *\n * @param data - raw onchain notification\n * @returns a complete raw onchain notification\n */\nexport function toRawAPINotification(\n data: UnprocessedRawNotification,\n): NormalisedAPINotification {\n const exhaustedAllCases = (_: never): never => {\n const type: string = data?.notification_type;\n throw new Error(\n `toRawAPINotification - No processor found for notification kind ${type}`,\n );\n };\n\n if (data.notification_type === 'on-chain') {\n if (!data?.payload?.data?.kind) {\n throw new Error(\n 'toRawAPINotification - No kind found for on-chain notification',\n );\n }\n return {\n ...data,\n type: data.payload.data.kind,\n } as OnChainRawNotification;\n }\n\n if (data.notification_type === 'platform') {\n return {\n ...data,\n type: data.notification_type,\n } as PlatformRawNotification;\n }\n\n return exhaustedAllCases(data);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/notification-services-controller",
3
- "version": "24.3.0-preview-429f86194",
3
+ "version": "24.3.0-preview-ef063ff2d",
4
4
  "description": "Manages New MetaMask decentralized Notification system",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPlatformNotification = exports.isOnChainNotification = void 0;
4
- /**
5
- * Narrows a v4 API notification to an on-chain notification.
6
- *
7
- * @param notification - Unprocessed v4 API notification.
8
- * @returns Whether the notification is an on-chain notification.
9
- */
10
- function isOnChainNotification(notification) {
11
- return notification.notification_type === 'wallet_activity';
12
- }
13
- exports.isOnChainNotification = isOnChainNotification;
14
- /**
15
- * Narrows a v4 API notification to a platform notification.
16
- *
17
- * @param notification - Unprocessed v4 API notification.
18
- * @returns Whether the notification is a platform notification.
19
- */
20
- function isPlatformNotification(notification) {
21
- return !isOnChainNotification(notification);
22
- }
23
- exports.isPlatformNotification = isPlatformNotification;
24
- //# sourceMappingURL=notification-api-type-guards.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-api-type-guards.cjs","sourceRoot":"","sources":["../../src/shared/notification-api-type-guards.ts"],"names":[],"mappings":";;;AAMA;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,YAAwC;IAExC,OAAO,YAAY,CAAC,iBAAiB,KAAK,iBAAiB,CAAC;AAC9D,CAAC;AAJD,sDAIC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,YAAwC;IAExC,OAAO,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAC9C,CAAC;AAJD,wDAIC","sourcesContent":["import type {\n UnprocessedRawNotification,\n OnChainNotification,\n PlatformNotification,\n} from '../NotificationServicesController/types/notification-api';\n\n/**\n * Narrows a v4 API notification to an on-chain notification.\n *\n * @param notification - Unprocessed v4 API notification.\n * @returns Whether the notification is an on-chain notification.\n */\nexport function isOnChainNotification(\n notification: UnprocessedRawNotification,\n): notification is OnChainNotification {\n return notification.notification_type === 'wallet_activity';\n}\n\n/**\n * Narrows a v4 API notification to a platform notification.\n *\n * @param notification - Unprocessed v4 API notification.\n * @returns Whether the notification is a platform notification.\n */\nexport function isPlatformNotification(\n notification: UnprocessedRawNotification,\n): notification is PlatformNotification {\n return !isOnChainNotification(notification);\n}\n"]}
@@ -1,16 +0,0 @@
1
- import type { UnprocessedRawNotification, OnChainNotification, PlatformNotification } from "../NotificationServicesController/types/notification-api/index.cjs";
2
- /**
3
- * Narrows a v4 API notification to an on-chain notification.
4
- *
5
- * @param notification - Unprocessed v4 API notification.
6
- * @returns Whether the notification is an on-chain notification.
7
- */
8
- export declare function isOnChainNotification(notification: UnprocessedRawNotification): notification is OnChainNotification;
9
- /**
10
- * Narrows a v4 API notification to a platform notification.
11
- *
12
- * @param notification - Unprocessed v4 API notification.
13
- * @returns Whether the notification is a platform notification.
14
- */
15
- export declare function isPlatformNotification(notification: UnprocessedRawNotification): notification is PlatformNotification;
16
- //# sourceMappingURL=notification-api-type-guards.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-api-type-guards.d.cts","sourceRoot":"","sources":["../../src/shared/notification-api-type-guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACrB,2EAAiE;AAElE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,0BAA0B,GACvC,YAAY,IAAI,mBAAmB,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,0BAA0B,GACvC,YAAY,IAAI,oBAAoB,CAEtC"}
@@ -1,16 +0,0 @@
1
- import type { UnprocessedRawNotification, OnChainNotification, PlatformNotification } from "../NotificationServicesController/types/notification-api/index.mjs";
2
- /**
3
- * Narrows a v4 API notification to an on-chain notification.
4
- *
5
- * @param notification - Unprocessed v4 API notification.
6
- * @returns Whether the notification is an on-chain notification.
7
- */
8
- export declare function isOnChainNotification(notification: UnprocessedRawNotification): notification is OnChainNotification;
9
- /**
10
- * Narrows a v4 API notification to a platform notification.
11
- *
12
- * @param notification - Unprocessed v4 API notification.
13
- * @returns Whether the notification is a platform notification.
14
- */
15
- export declare function isPlatformNotification(notification: UnprocessedRawNotification): notification is PlatformNotification;
16
- //# sourceMappingURL=notification-api-type-guards.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-api-type-guards.d.mts","sourceRoot":"","sources":["../../src/shared/notification-api-type-guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACrB,2EAAiE;AAElE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,0BAA0B,GACvC,YAAY,IAAI,mBAAmB,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,0BAA0B,GACvC,YAAY,IAAI,oBAAoB,CAEtC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Narrows a v4 API notification to an on-chain notification.
3
- *
4
- * @param notification - Unprocessed v4 API notification.
5
- * @returns Whether the notification is an on-chain notification.
6
- */
7
- export function isOnChainNotification(notification) {
8
- return notification.notification_type === 'wallet_activity';
9
- }
10
- /**
11
- * Narrows a v4 API notification to a platform notification.
12
- *
13
- * @param notification - Unprocessed v4 API notification.
14
- * @returns Whether the notification is a platform notification.
15
- */
16
- export function isPlatformNotification(notification) {
17
- return !isOnChainNotification(notification);
18
- }
19
- //# sourceMappingURL=notification-api-type-guards.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification-api-type-guards.mjs","sourceRoot":"","sources":["../../src/shared/notification-api-type-guards.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAwC;IAExC,OAAO,YAAY,CAAC,iBAAiB,KAAK,iBAAiB,CAAC;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAAwC;IAExC,OAAO,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import type {\n UnprocessedRawNotification,\n OnChainNotification,\n PlatformNotification,\n} from '../NotificationServicesController/types/notification-api';\n\n/**\n * Narrows a v4 API notification to an on-chain notification.\n *\n * @param notification - Unprocessed v4 API notification.\n * @returns Whether the notification is an on-chain notification.\n */\nexport function isOnChainNotification(\n notification: UnprocessedRawNotification,\n): notification is OnChainNotification {\n return notification.notification_type === 'wallet_activity';\n}\n\n/**\n * Narrows a v4 API notification to a platform notification.\n *\n * @param notification - Unprocessed v4 API notification.\n * @returns Whether the notification is a platform notification.\n */\nexport function isPlatformNotification(\n notification: UnprocessedRawNotification,\n): notification is PlatformNotification {\n return !isOnChainNotification(notification);\n}\n"]}