@metamask-previews/notification-services-controller 0.19.0-preview-958adf52 → 0.20.0-preview-83e41399

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 (176) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs +22 -1
  3. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +1 -1
  4. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts +22 -0
  5. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +1 -1
  6. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts +22 -0
  7. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +1 -1
  8. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs +22 -1
  9. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +1 -1
  10. package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs +2 -2
  11. package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs.map +1 -1
  12. package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs +2 -2
  13. package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs.map +1 -1
  14. package/dist/NotificationServicesController/__fixtures__/test-utils.cjs +1 -1
  15. package/dist/NotificationServicesController/__fixtures__/test-utils.cjs.map +1 -1
  16. package/dist/NotificationServicesController/__fixtures__/test-utils.mjs +1 -1
  17. package/dist/NotificationServicesController/__fixtures__/test-utils.mjs.map +1 -1
  18. package/dist/NotificationServicesController/constants/notification-schema.cjs +0 -1
  19. package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -1
  20. package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -1
  21. package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -1
  22. package/dist/NotificationServicesController/constants/notification-schema.mjs +0 -1
  23. package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
  24. package/dist/NotificationServicesController/index.cjs +1 -3
  25. package/dist/NotificationServicesController/index.cjs.map +1 -1
  26. package/dist/NotificationServicesController/index.d.cts +2 -2
  27. package/dist/NotificationServicesController/index.d.cts.map +1 -1
  28. package/dist/NotificationServicesController/index.d.mts +2 -2
  29. package/dist/NotificationServicesController/index.d.mts.map +1 -1
  30. package/dist/NotificationServicesController/index.mjs +0 -2
  31. package/dist/NotificationServicesController/index.mjs.map +1 -1
  32. package/dist/NotificationServicesController/processors/process-notifications.cjs +1 -1
  33. package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
  34. package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
  35. package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
  36. package/dist/NotificationServicesController/processors/process-notifications.mjs +1 -1
  37. package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
  38. package/dist/NotificationServicesController/services/feature-announcements.cjs +1 -0
  39. package/dist/NotificationServicesController/services/feature-announcements.cjs.map +1 -1
  40. package/dist/NotificationServicesController/services/feature-announcements.d.cts +1 -0
  41. package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +1 -1
  42. package/dist/NotificationServicesController/services/feature-announcements.d.mts +1 -0
  43. package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +1 -1
  44. package/dist/NotificationServicesController/services/feature-announcements.mjs +1 -0
  45. package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -1
  46. package/dist/NotificationServicesController/services/onchain-notifications.cjs +1 -4
  47. package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -1
  48. package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -1
  49. package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -1
  50. package/dist/NotificationServicesController/services/onchain-notifications.mjs +1 -4
  51. package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
  52. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map +1 -1
  53. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts +1 -1
  54. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts.map +1 -1
  55. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts +1 -1
  56. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts.map +1 -1
  57. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +1 -1
  58. package/dist/NotificationServicesController/types/feature-announcement/index.cjs +0 -17
  59. package/dist/NotificationServicesController/types/feature-announcement/index.cjs.map +1 -1
  60. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts +3 -3
  61. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts.map +1 -1
  62. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts +3 -3
  63. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts.map +1 -1
  64. package/dist/NotificationServicesController/types/feature-announcement/index.mjs +1 -3
  65. package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +1 -1
  66. package/dist/NotificationServicesController/types/index.cjs +0 -19
  67. package/dist/NotificationServicesController/types/index.cjs.map +1 -1
  68. package/dist/NotificationServicesController/types/index.d.cts +5 -5
  69. package/dist/NotificationServicesController/types/index.d.cts.map +1 -1
  70. package/dist/NotificationServicesController/types/index.d.mts +5 -5
  71. package/dist/NotificationServicesController/types/index.d.mts.map +1 -1
  72. package/dist/NotificationServicesController/types/index.mjs +1 -5
  73. package/dist/NotificationServicesController/types/index.mjs.map +1 -1
  74. package/dist/NotificationServicesController/types/notification/index.cjs +0 -15
  75. package/dist/NotificationServicesController/types/notification/index.cjs.map +1 -1
  76. package/dist/NotificationServicesController/types/notification/index.d.cts +1 -1
  77. package/dist/NotificationServicesController/types/notification/index.d.cts.map +1 -1
  78. package/dist/NotificationServicesController/types/notification/index.d.mts +1 -1
  79. package/dist/NotificationServicesController/types/notification/index.d.mts.map +1 -1
  80. package/dist/NotificationServicesController/types/notification/index.mjs +1 -1
  81. package/dist/NotificationServicesController/types/notification/index.mjs.map +1 -1
  82. package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -1
  83. package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -1
  84. package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -1
  85. package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
  86. package/dist/NotificationServicesController/types/on-chain-notification/index.cjs +0 -15
  87. package/dist/NotificationServicesController/types/on-chain-notification/index.cjs.map +1 -1
  88. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts +1 -1
  89. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts.map +1 -1
  90. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts +1 -1
  91. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts.map +1 -1
  92. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs +1 -1
  93. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs.map +1 -1
  94. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +1 -1
  95. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts +1 -1
  96. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +1 -1
  97. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +1 -1
  98. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +1 -1
  99. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -1
  100. package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs +2 -1
  101. package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +1 -1
  102. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +1 -1
  103. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +1 -1
  104. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs +2 -1
  105. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -1
  106. package/dist/NotificationServicesController/types/snaps/index.cjs +0 -15
  107. package/dist/NotificationServicesController/types/snaps/index.cjs.map +1 -1
  108. package/dist/NotificationServicesController/types/snaps/index.d.cts +1 -1
  109. package/dist/NotificationServicesController/types/snaps/index.d.cts.map +1 -1
  110. package/dist/NotificationServicesController/types/snaps/index.d.mts +1 -1
  111. package/dist/NotificationServicesController/types/snaps/index.d.mts.map +1 -1
  112. package/dist/NotificationServicesController/types/snaps/index.mjs +1 -1
  113. package/dist/NotificationServicesController/types/snaps/index.mjs.map +1 -1
  114. package/dist/NotificationServicesController/types/user-storage/index.cjs +0 -15
  115. package/dist/NotificationServicesController/types/user-storage/index.cjs.map +1 -1
  116. package/dist/NotificationServicesController/types/user-storage/index.d.cts +1 -1
  117. package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +1 -1
  118. package/dist/NotificationServicesController/types/user-storage/index.d.mts +1 -1
  119. package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +1 -1
  120. package/dist/NotificationServicesController/types/user-storage/index.mjs +1 -1
  121. package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -1
  122. package/dist/NotificationServicesController/utils/utils.cjs.map +1 -1
  123. package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
  124. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +1 -3
  125. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
  126. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +1 -3
  127. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
  128. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +1 -3
  129. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
  130. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +1 -3
  131. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
  132. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs +0 -2
  133. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs.map +1 -1
  134. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.cts.map +1 -1
  135. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts.map +1 -1
  136. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs +0 -2
  137. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs.map +1 -1
  138. package/dist/NotificationServicesPushController/index.cjs +1 -3
  139. package/dist/NotificationServicesPushController/index.cjs.map +1 -1
  140. package/dist/NotificationServicesPushController/index.d.cts +2 -2
  141. package/dist/NotificationServicesPushController/index.d.cts.map +1 -1
  142. package/dist/NotificationServicesPushController/index.d.mts +2 -2
  143. package/dist/NotificationServicesPushController/index.d.mts.map +1 -1
  144. package/dist/NotificationServicesPushController/index.mjs +0 -2
  145. package/dist/NotificationServicesPushController/index.mjs.map +1 -1
  146. package/dist/NotificationServicesPushController/services/push/push-web.cjs +2 -1
  147. package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +1 -1
  148. package/dist/NotificationServicesPushController/services/push/push-web.d.cts +1 -0
  149. package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +1 -1
  150. package/dist/NotificationServicesPushController/services/push/push-web.d.mts +1 -0
  151. package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +1 -1
  152. package/dist/NotificationServicesPushController/services/push/push-web.mjs +2 -1
  153. package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -1
  154. package/dist/NotificationServicesPushController/services/services.cjs +0 -2
  155. package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
  156. package/dist/NotificationServicesPushController/services/services.d.cts +1 -1
  157. package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
  158. package/dist/NotificationServicesPushController/services/services.d.mts +1 -1
  159. package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
  160. package/dist/NotificationServicesPushController/services/services.mjs +0 -2
  161. package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
  162. package/dist/NotificationServicesPushController/types/index.cjs +0 -15
  163. package/dist/NotificationServicesPushController/types/index.cjs.map +1 -1
  164. package/dist/NotificationServicesPushController/types/index.d.cts +1 -1
  165. package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -1
  166. package/dist/NotificationServicesPushController/types/index.d.mts +1 -1
  167. package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -1
  168. package/dist/NotificationServicesPushController/types/index.mjs +1 -1
  169. package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
  170. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +2 -2
  171. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +1 -1
  172. package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +1 -1
  173. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +1 -1
  174. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +2 -2
  175. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -1
  176. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"get-notification-message.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,uDAA6C;AAClE,OAAO,EAAE,SAAS,EAAE,uDAA6C;AAGjE,MAAM,MAAM,eAAe,GAAG;IAC5B,uCAAuC,EAAE,MAAM,MAAM,CAAC;IACtD,oDAAoD,EAAE,MAAM,MAAM,CAAC;IACnE,6CAA6C,EAAE,CAC7C,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC;IACZ,2CAA2C,EAAE,MAAM,MAAM,CAAC;IAC1D,wDAAwD,EAAE,MAAM,MAAM,CAAC;IACvE,iDAAiD,EAAE,CACjD,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC;IACZ,2CAA2C,EAAE,MAAM,MAAM,CAAC;IAC1D,iD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M,qCAAqC,oBAC/B,eAAe,KAC/B,uBAuKF,CAAC;AAYF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,OAAO,GACT,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAWnC;AAED;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,CAAC,EAAE,KAAK,CAAC,aAAa,EACtB,YAAY,EAAE,eAAe,GAC5B,uBAAuB,GAAG,IAAI,CA0BhC"}
1
+ {"version":3,"file":"get-notification-message.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,uDAA6C;AAClE,OAAO,EAAE,SAAS,EAAE,uDAA6C;AAEjE,MAAM,MAAM,eAAe,GAAG;IAC5B,uCAAuC,EAAE,MAAM,MAAM,CAAC;IACtD,oDAAoD,EAAE,MAAM,MAAM,CAAC;IACnE,6CAA6C,EAAE,CAC7C,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC;IACZ,2CAA2C,EAAE,MAAM,MAAM,CAAC;IAC1D,wDAAwD,EAAE,MAAM,MAAM,CAAC;IACvE,iDAAiD,EAAE,CACjD,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC;IACZ,2CAA2C,EAAE,MAAM,MAAM,CAAC;IAC1D,iDAAiD,EAAE,MAAM,MAAM,CAAC;IAChE,qCAAqC,EAAE,MAAM,MAAM,CAAC;IACpD,2CAA2C,EAAE,MAAM,MAAM,CAAC;IAC1D,yCAAyC,EAAE,MAAM,MAAM,CAAC;IACxD,+CAA+C,EAAE,MAAM,MAAM,CAAC;IAC9D,6DAA6D,EAAE,MAAM,MAAM,CAAC;IAC5E,mEAAmE,EAAE,MAAM,MAAM,CAAC;IAClF,+DAA+D,EAAE,MAAM,MAAM,CAAC;IAC9E,qEAAqE,EAAE,MAAM,MAAM,CAA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AAEF,KAAK,uBAAuB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,CAAC,CAAC,SAAS,KAAK,CAAC,aAAa,IAAI;IACxD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC;CAC1C,CAAC;AAEF,KAAK,uBAAuB,GAAG;KAC5B,CAAC,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,mBAAmB,CAClD,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAC1C;CACF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,oBAC/B,eAAe,KAC/B,uBAuKF,CAAC;AAYF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,OAAO,GACT,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAWnC;AAED;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,CAAC,EAAE,KAAK,CAAC,aAAa,EACtB,YAAY,EAAE,eAAe,GAC5B,uBAAuB,GAAG,IAAI,CA0BhC"}
1
+ {"version":3,"file":"get-notification-message.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,uDAA6C;AAClE,OAAO,EAAE,SAAS,EAAE,uDAA6C;AAEjE,MAAM,MAAM,eAAe,GAAG;IAC5B,uCAAuC,EAAE,MAAM,MAAM,CAAC;IACtD,oDAAoD,EAAE,MAAM,MAAM,CAAC;IACnE,6CAA6C,EAAE,CAC7C,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,C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AEF,KAAK,uBAAuB,GAAG;KAC5B,CAAC,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,mBAAmB,CAClD,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAC1C;CACF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,oBAC/B,eAAe,KAC/B,uBAuKF,CAAC;AAYF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,OAAO,GACT,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAWnC;AAED;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,CAAC,EAAE,KAAK,CAAC,aAAa,EACtB,YAAY,EAAE,eAAe,GAC5B,uBAAuB,GAAG,IAAI,CA0BhC"}
@@ -1,5 +1,5 @@
1
- import { Constants } from "../../NotificationServicesController/index.mjs";
2
1
  import { getAmount, formatAmount } from "./get-notification-data.mjs";
2
+ import { Constants } from "../../NotificationServicesController/index.mjs";
3
3
  /**
4
4
  * On Chain Push Notification Messages.
5
5
  * This is a list of all the push notifications we support. Update this for synced notifications on mobile and extension
@@ -173,7 +173,7 @@ export function createOnChainPushNotificationMessage(n, translations) {
173
173
  notificationMessage.defaultDescription ??
174
174
  null;
175
175
  }
176
- catch (e) {
176
+ catch {
177
177
  description = notificationMessage.defaultDescription ?? null;
178
178
  }
179
179
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"get-notification-message.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,uDAA6C;AACjE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,oCAAgC;AAkDlE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,eAAgC,EACP,EAAE;IAI3B,MAAM,CAAC,GAAkB,CAAC,GAAG,IAAI,EAAE,EAAE;QACnC,MAAM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;QACV,WAAW,GAAG,mBAAmB,CAAC,kBAAkB,IAAI,IAAI,CAAC;KAC9D;IAED,OAAO;QACL,KAAK,EAAE,mBAAmB,CAAC,KAAK,IAAI,EAAE;QACtC,WAAW,EAAE,WAAW,IAAI,EAAE,EAAE,mCAAmC;KACpE,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { Types } from '../../NotificationServicesController';\nimport { Constants } from '../../NotificationServicesController';\nimport { getAmount, formatAmount } from './get-notification-data';\n\nexport type TranslationKeys = {\n pushPlatformNotificationsFundsSentTitle: () => string;\n pushPlatformNotificationsFundsSentDescriptionDefault: () => string;\n pushPlatformNotificationsFundsSentDescription: (\n ...args: [string, string]\n ) => string;\n pushPlatformNotificationsFundsReceivedTitle: () => string;\n pushPlatformNotificationsFundsReceivedDescriptionDefault: () => string;\n pushPlatformNotificationsFundsReceivedDescription: (\n ...args: [string, string]\n ) => string;\n pushPlatformNotificationsSwapCompletedTitle: () => string;\n pushPlatformNotificationsSwapCompletedDescription: () => string;\n pushPlatformNotificationsNftSentTitle: () => string;\n pushPlatformNotificationsNftSentDescription: () => string;\n pushPlatformNotificationsNftReceivedTitle: () => string;\n pushPlatformNotificationsNftReceivedDescription: () => string;\n pushPlatformNotificationsStakingRocketpoolStakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingRocketpoolStakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingRocketpoolUnstakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingRocketpoolUnstakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingLidoStakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingLidoStakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnTitle: () => string;\n pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnDescription: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalRequestedTitle: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalRequestedDescription: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalCompletedTitle: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalCompletedDescription: () => string;\n};\n\ntype PushNotificationMessage = {\n title: string;\n description: string;\n};\n\ntype NotificationMessage<N extends Types.INotification> = {\n title: string | null;\n defaultDescription: string | null;\n getDescription?: (n: N) => string | null;\n};\n\ntype NotificationMessageDict = {\n [K in Constants.TRIGGER_TYPES]?: NotificationMessage<\n Extract<Types.INotification, { type: K }>\n >;\n};\n\n/**\n * On Chain Push Notification Messages.\n * This is a list of all the push notifications we support. Update this for synced notifications on mobile and extension\n *\n * @param translationKeys - all translations supported\n * @returns A translation push message object.\n */\nexport const createOnChainPushNotificationMessages = (\n translationKeys: TranslationKeys,\n): NotificationMessageDict => {\n type TranslationFn = <K extends keyof TranslationKeys>(\n ...args: [K, ...Parameters<TranslationKeys[K]>]\n ) => string;\n const t: TranslationFn = (...args) => {\n const [key, ...otherArgs] = args;\n\n // Coerce types for the translation function\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fn: any = translationKeys[key];\n return fn(...otherArgs);\n };\n\n return {\n erc20_sent: {\n title: t('pushPlatformNotificationsFundsSentTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsSentDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = n?.data?.token?.symbol;\n const tokenAmount = n?.data?.token?.amount;\n const tokenDecimals = n?.data?.token?.decimals;\n if (!symbol || !tokenAmount || !tokenDecimals) {\n return null;\n }\n\n const amount = getAmount(tokenAmount, tokenDecimals, {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsSentDescription',\n amount,\n symbol,\n );\n },\n },\n eth_sent: {\n title: t('pushPlatformNotificationsFundsSentTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsSentDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = getChainSymbol(n?.chain_id);\n const tokenAmount = n?.data?.amount?.eth;\n if (!symbol || !tokenAmount) {\n return null;\n }\n\n const amount = formatAmount(parseFloat(tokenAmount), {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsSentDescription',\n amount,\n symbol,\n );\n },\n },\n erc20_received: {\n title: t('pushPlatformNotificationsFundsReceivedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsReceivedDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = n?.data?.token?.symbol;\n const tokenAmount = n?.data?.token?.amount;\n const tokenDecimals = n?.data?.token?.decimals;\n if (!symbol || !tokenAmount || !tokenDecimals) {\n return null;\n }\n\n const amount = getAmount(tokenAmount, tokenDecimals, {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsReceivedDescription',\n amount,\n symbol,\n );\n },\n },\n eth_received: {\n title: t('pushPlatformNotificationsFundsReceivedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsReceivedDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = getChainSymbol(n?.chain_id);\n const tokenAmount = n?.data?.amount?.eth;\n if (!symbol || !tokenAmount) {\n return null;\n }\n\n const amount = formatAmount(parseFloat(tokenAmount), {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsReceivedDescription',\n amount,\n symbol,\n );\n },\n },\n metamask_swap_completed: {\n title: t('pushPlatformNotificationsSwapCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsSwapCompletedDescription',\n ),\n },\n erc721_sent: {\n title: t('pushPlatformNotificationsNftSentTitle'),\n defaultDescription: t('pushPlatformNotificationsNftSentDescription'),\n },\n erc1155_sent: {\n title: t('pushPlatformNotificationsNftSentTitle'),\n defaultDescription: t('pushPlatformNotificationsNftSentDescription'),\n },\n erc721_received: {\n title: t('pushPlatformNotificationsNftReceivedTitle'),\n defaultDescription: t('pushPlatformNotificationsNftReceivedDescription'),\n },\n erc1155_received: {\n title: t('pushPlatformNotificationsNftReceivedTitle'),\n defaultDescription: t('pushPlatformNotificationsNftReceivedDescription'),\n },\n rocketpool_stake_completed: {\n title: t('pushPlatformNotificationsStakingRocketpoolStakeCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingRocketpoolStakeCompletedDescription',\n ),\n },\n rocketpool_unstake_completed: {\n title: t(\n 'pushPlatformNotificationsStakingRocketpoolUnstakeCompletedTitle',\n ),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingRocketpoolUnstakeCompletedDescription',\n ),\n },\n lido_stake_completed: {\n title: t('pushPlatformNotificationsStakingLidoStakeCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoStakeCompletedDescription',\n ),\n },\n lido_stake_ready_to_be_withdrawn: {\n title: t(\n 'pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnTitle',\n ),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnDescription',\n ),\n },\n lido_withdrawal_requested: {\n title: t('pushPlatformNotificationsStakingLidoWithdrawalRequestedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoWithdrawalRequestedDescription',\n ),\n },\n lido_withdrawal_completed: {\n title: t('pushPlatformNotificationsStakingLidoWithdrawalCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoWithdrawalCompletedDescription',\n ),\n },\n };\n};\n\n/**\n * Retrieves the symbol associated with a given chain ID.\n *\n * @param chainId - The ID of the chain.\n * @returns The symbol associated with the chain ID, or null if not found.\n */\nfunction getChainSymbol(chainId: number) {\n return Constants.CHAIN_SYMBOLS[chainId] ?? null;\n}\n\n/**\n * Checks if the given value is an OnChainRawNotification object.\n *\n * @param n - The value to check.\n * @returns True if the value is an OnChainRawNotification object, false otherwise.\n */\nexport function isOnChainNotification(\n n: unknown,\n): n is Types.OnChainRawNotification {\n const assumed = n as Types.OnChainRawNotification;\n\n // We don't have a validation/parsing library to check all possible types of an on chain notification\n // It is safe enough just to check \"some\" fields, and catch any errors down the line if the shape is bad.\n const isValidEnoughToBeOnChainNotification = [\n assumed?.id,\n assumed?.data,\n assumed?.trigger_id,\n ].every((field) => field !== undefined);\n return isValidEnoughToBeOnChainNotification;\n}\n\n/**\n * Creates a push notification message based on the given on-chain raw notification.\n *\n * @param n - processed notification.\n * @param translations - translates keys into text\n * @returns The push notification message object, or null if the notification is invalid.\n */\nexport function createOnChainPushNotificationMessage(\n n: Types.INotification,\n translations: TranslationKeys,\n): PushNotificationMessage | null {\n if (!n?.type) {\n return null;\n }\n const notificationMessage =\n createOnChainPushNotificationMessages(translations)[n.type];\n\n if (!notificationMessage) {\n return null;\n }\n\n let description: string | null = null;\n try {\n description =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n notificationMessage?.getDescription?.(n as any) ??\n notificationMessage.defaultDescription ??\n null;\n } catch (e) {\n description = notificationMessage.defaultDescription ?? null;\n }\n\n return {\n title: notificationMessage.title ?? '', // Ensure title is always a string\n description: description ?? '', // Fallback to empty string if null\n };\n}\n"]}
1
+ {"version":3,"file":"get-notification-message.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,oCAAgC;AAElE,OAAO,EAAE,SAAS,EAAE,uDAA6C;AAkDjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,eAAgC,EACP,EAAE;IAI3B,MAAM,CAAC,GAAkB,CAAC,GAAG,IAAI,EAAE,EAAE;QACnC,MAAM,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC;QAEjC,4CAA4C;QAC5C,8DAA8D;QAC9D,MAAM,EAAE,GAAQ,eAAe,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO;QACL,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,CAAC,yCAAyC,CAAC;YACnD,kBAAkB,EAAE,CAAC,CACnB,sDAAsD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C,OAAO,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,CAAU;IAEV,MAAM,OAAO,GAAG,CAAiC,CAAC;IAElD,qGAAqG;IACrG,yGAAyG;IACzG,MAAM,oCAAoC,GAAG;QAC3C,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,UAAU;KACpB,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;IACxC,OAAO,oCAAoC,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oCAAoC,CAClD,CAAsB,EACtB,YAA6B;IAE7B,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;IACD,MAAM,mBAAmB,GACvB,qCAAqC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE9D,IAAI,CAAC,mBAAmB,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,WAAW,GAAkB,IAAI,CAAC;IACtC,IAAI;QACF,WAAW;YACT,8DAA8D;YAC9D,mBAAmB,EAAE,cAAc,EAAE,CAAC,CAAQ,CAAC;gBAC/C,mBAAmB,CAAC,kBAAkB;gBACtC,IAAI,CAAC;KACR;IAAC,MAAM;QACN,WAAW,GAAG,mBAAmB,CAAC,kBAAkB,IAAI,IAAI,CAAC;KAC9D;IAED,OAAO;QACL,KAAK,EAAE,mBAAmB,CAAC,KAAK,IAAI,EAAE;QACtC,WAAW,EAAE,WAAW,IAAI,EAAE,EAAE,mCAAmC;KACpE,CAAC;AACJ,CAAC","sourcesContent":["import { getAmount, formatAmount } from './get-notification-data';\nimport type { Types } from '../../NotificationServicesController';\nimport { Constants } from '../../NotificationServicesController';\n\nexport type TranslationKeys = {\n pushPlatformNotificationsFundsSentTitle: () => string;\n pushPlatformNotificationsFundsSentDescriptionDefault: () => string;\n pushPlatformNotificationsFundsSentDescription: (\n ...args: [string, string]\n ) => string;\n pushPlatformNotificationsFundsReceivedTitle: () => string;\n pushPlatformNotificationsFundsReceivedDescriptionDefault: () => string;\n pushPlatformNotificationsFundsReceivedDescription: (\n ...args: [string, string]\n ) => string;\n pushPlatformNotificationsSwapCompletedTitle: () => string;\n pushPlatformNotificationsSwapCompletedDescription: () => string;\n pushPlatformNotificationsNftSentTitle: () => string;\n pushPlatformNotificationsNftSentDescription: () => string;\n pushPlatformNotificationsNftReceivedTitle: () => string;\n pushPlatformNotificationsNftReceivedDescription: () => string;\n pushPlatformNotificationsStakingRocketpoolStakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingRocketpoolStakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingRocketpoolUnstakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingRocketpoolUnstakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingLidoStakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingLidoStakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnTitle: () => string;\n pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnDescription: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalRequestedTitle: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalRequestedDescription: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalCompletedTitle: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalCompletedDescription: () => string;\n};\n\ntype PushNotificationMessage = {\n title: string;\n description: string;\n};\n\ntype NotificationMessage<N extends Types.INotification> = {\n title: string | null;\n defaultDescription: string | null;\n getDescription?: (n: N) => string | null;\n};\n\ntype NotificationMessageDict = {\n [K in Constants.TRIGGER_TYPES]?: NotificationMessage<\n Extract<Types.INotification, { type: K }>\n >;\n};\n\n/**\n * On Chain Push Notification Messages.\n * This is a list of all the push notifications we support. Update this for synced notifications on mobile and extension\n *\n * @param translationKeys - all translations supported\n * @returns A translation push message object.\n */\nexport const createOnChainPushNotificationMessages = (\n translationKeys: TranslationKeys,\n): NotificationMessageDict => {\n type TranslationFn = <K extends keyof TranslationKeys>(\n ...args: [K, ...Parameters<TranslationKeys[K]>]\n ) => string;\n const t: TranslationFn = (...args) => {\n const [key, ...otherArgs] = args;\n\n // Coerce types for the translation function\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fn: any = translationKeys[key];\n return fn(...otherArgs);\n };\n\n return {\n erc20_sent: {\n title: t('pushPlatformNotificationsFundsSentTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsSentDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = n?.data?.token?.symbol;\n const tokenAmount = n?.data?.token?.amount;\n const tokenDecimals = n?.data?.token?.decimals;\n if (!symbol || !tokenAmount || !tokenDecimals) {\n return null;\n }\n\n const amount = getAmount(tokenAmount, tokenDecimals, {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsSentDescription',\n amount,\n symbol,\n );\n },\n },\n eth_sent: {\n title: t('pushPlatformNotificationsFundsSentTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsSentDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = getChainSymbol(n?.chain_id);\n const tokenAmount = n?.data?.amount?.eth;\n if (!symbol || !tokenAmount) {\n return null;\n }\n\n const amount = formatAmount(parseFloat(tokenAmount), {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsSentDescription',\n amount,\n symbol,\n );\n },\n },\n erc20_received: {\n title: t('pushPlatformNotificationsFundsReceivedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsReceivedDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = n?.data?.token?.symbol;\n const tokenAmount = n?.data?.token?.amount;\n const tokenDecimals = n?.data?.token?.decimals;\n if (!symbol || !tokenAmount || !tokenDecimals) {\n return null;\n }\n\n const amount = getAmount(tokenAmount, tokenDecimals, {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsReceivedDescription',\n amount,\n symbol,\n );\n },\n },\n eth_received: {\n title: t('pushPlatformNotificationsFundsReceivedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsFundsReceivedDescriptionDefault',\n ),\n getDescription: (n) => {\n const symbol = getChainSymbol(n?.chain_id);\n const tokenAmount = n?.data?.amount?.eth;\n if (!symbol || !tokenAmount) {\n return null;\n }\n\n const amount = formatAmount(parseFloat(tokenAmount), {\n shouldEllipse: true,\n });\n return t(\n 'pushPlatformNotificationsFundsReceivedDescription',\n amount,\n symbol,\n );\n },\n },\n metamask_swap_completed: {\n title: t('pushPlatformNotificationsSwapCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsSwapCompletedDescription',\n ),\n },\n erc721_sent: {\n title: t('pushPlatformNotificationsNftSentTitle'),\n defaultDescription: t('pushPlatformNotificationsNftSentDescription'),\n },\n erc1155_sent: {\n title: t('pushPlatformNotificationsNftSentTitle'),\n defaultDescription: t('pushPlatformNotificationsNftSentDescription'),\n },\n erc721_received: {\n title: t('pushPlatformNotificationsNftReceivedTitle'),\n defaultDescription: t('pushPlatformNotificationsNftReceivedDescription'),\n },\n erc1155_received: {\n title: t('pushPlatformNotificationsNftReceivedTitle'),\n defaultDescription: t('pushPlatformNotificationsNftReceivedDescription'),\n },\n rocketpool_stake_completed: {\n title: t('pushPlatformNotificationsStakingRocketpoolStakeCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingRocketpoolStakeCompletedDescription',\n ),\n },\n rocketpool_unstake_completed: {\n title: t(\n 'pushPlatformNotificationsStakingRocketpoolUnstakeCompletedTitle',\n ),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingRocketpoolUnstakeCompletedDescription',\n ),\n },\n lido_stake_completed: {\n title: t('pushPlatformNotificationsStakingLidoStakeCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoStakeCompletedDescription',\n ),\n },\n lido_stake_ready_to_be_withdrawn: {\n title: t(\n 'pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnTitle',\n ),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnDescription',\n ),\n },\n lido_withdrawal_requested: {\n title: t('pushPlatformNotificationsStakingLidoWithdrawalRequestedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoWithdrawalRequestedDescription',\n ),\n },\n lido_withdrawal_completed: {\n title: t('pushPlatformNotificationsStakingLidoWithdrawalCompletedTitle'),\n defaultDescription: t(\n 'pushPlatformNotificationsStakingLidoWithdrawalCompletedDescription',\n ),\n },\n };\n};\n\n/**\n * Retrieves the symbol associated with a given chain ID.\n *\n * @param chainId - The ID of the chain.\n * @returns The symbol associated with the chain ID, or null if not found.\n */\nfunction getChainSymbol(chainId: number) {\n return Constants.CHAIN_SYMBOLS[chainId] ?? null;\n}\n\n/**\n * Checks if the given value is an OnChainRawNotification object.\n *\n * @param n - The value to check.\n * @returns True if the value is an OnChainRawNotification object, false otherwise.\n */\nexport function isOnChainNotification(\n n: unknown,\n): n is Types.OnChainRawNotification {\n const assumed = n as Types.OnChainRawNotification;\n\n // We don't have a validation/parsing library to check all possible types of an on chain notification\n // It is safe enough just to check \"some\" fields, and catch any errors down the line if the shape is bad.\n const isValidEnoughToBeOnChainNotification = [\n assumed?.id,\n assumed?.data,\n assumed?.trigger_id,\n ].every((field) => field !== undefined);\n return isValidEnoughToBeOnChainNotification;\n}\n\n/**\n * Creates a push notification message based on the given on-chain raw notification.\n *\n * @param n - processed notification.\n * @param translations - translates keys into text\n * @returns The push notification message object, or null if the notification is invalid.\n */\nexport function createOnChainPushNotificationMessage(\n n: Types.INotification,\n translations: TranslationKeys,\n): PushNotificationMessage | null {\n if (!n?.type) {\n return null;\n }\n const notificationMessage =\n createOnChainPushNotificationMessages(translations)[n.type];\n\n if (!notificationMessage) {\n return null;\n }\n\n let description: string | null = null;\n try {\n description =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n notificationMessage?.getDescription?.(n as any) ??\n notificationMessage.defaultDescription ??\n null;\n } catch {\n description = notificationMessage.defaultDescription ?? null;\n }\n\n return {\n title: notificationMessage.title ?? '', // Ensure title is always a string\n description: description ?? '', // Fallback to empty string if null\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/notification-services-controller",
3
- "version": "0.19.0-preview-958adf52",
3
+ "version": "0.20.0-preview-83e41399",
4
4
  "description": "Manages New MetaMask decentralized Notification system",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -112,8 +112,8 @@
112
112
  "@lavamoat/allow-scripts": "^3.0.4",
113
113
  "@lavamoat/preinstall-always-fail": "^2.1.0",
114
114
  "@metamask/auto-changelog": "^3.4.4",
115
- "@metamask/keyring-controller": "^19.0.5",
116
- "@metamask/profile-sync-controller": "^6.0.0",
115
+ "@metamask/keyring-controller": "^19.0.6",
116
+ "@metamask/profile-sync-controller": "^7.0.0",
117
117
  "@types/jest": "^27.4.1",
118
118
  "@types/readable-stream": "^2.3.0",
119
119
  "contentful": "^10.15.0",
@@ -128,7 +128,7 @@
128
128
  },
129
129
  "peerDependencies": {
130
130
  "@metamask/keyring-controller": "^19.0.0",
131
- "@metamask/profile-sync-controller": "^6.0.0"
131
+ "@metamask/profile-sync-controller": "^7.0.0"
132
132
  },
133
133
  "engines": {
134
134
  "node": "^18.18 || >=20"