@metamask-previews/notification-services-controller 0.0.0-preview-b09c2ed

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 (391) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +20 -0
  3. package/README.md +15 -0
  4. package/dist/NotificationServicesController/NotificationServicesController.js +18 -0
  5. package/dist/NotificationServicesController/NotificationServicesController.js.map +1 -0
  6. package/dist/NotificationServicesController/NotificationServicesController.mjs +18 -0
  7. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -0
  8. package/dist/NotificationServicesController/constants/constants.js +10 -0
  9. package/dist/NotificationServicesController/constants/constants.js.map +1 -0
  10. package/dist/NotificationServicesController/constants/constants.mjs +10 -0
  11. package/dist/NotificationServicesController/constants/constants.mjs.map +1 -0
  12. package/dist/NotificationServicesController/constants/index.js +27 -0
  13. package/dist/NotificationServicesController/constants/index.js.map +1 -0
  14. package/dist/NotificationServicesController/constants/index.mjs +27 -0
  15. package/dist/NotificationServicesController/constants/index.mjs.map +1 -0
  16. package/dist/NotificationServicesController/constants/notification-schema.js +20 -0
  17. package/dist/NotificationServicesController/constants/notification-schema.js.map +1 -0
  18. package/dist/NotificationServicesController/constants/notification-schema.mjs +20 -0
  19. package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -0
  20. package/dist/NotificationServicesController/index.js +44 -0
  21. package/dist/NotificationServicesController/index.js.map +1 -0
  22. package/dist/NotificationServicesController/index.mjs +44 -0
  23. package/dist/NotificationServicesController/index.mjs.map +1 -0
  24. package/dist/NotificationServicesController/processors/index.js +22 -0
  25. package/dist/NotificationServicesController/processors/index.js.map +1 -0
  26. package/dist/NotificationServicesController/processors/index.mjs +22 -0
  27. package/dist/NotificationServicesController/processors/index.mjs.map +1 -0
  28. package/dist/NotificationServicesController/processors/process-feature-announcement.js +10 -0
  29. package/dist/NotificationServicesController/processors/process-feature-announcement.js.map +1 -0
  30. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs +10 -0
  31. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs.map +1 -0
  32. package/dist/NotificationServicesController/processors/process-notifications.js +13 -0
  33. package/dist/NotificationServicesController/processors/process-notifications.js.map +1 -0
  34. package/dist/NotificationServicesController/processors/process-notifications.mjs +13 -0
  35. package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -0
  36. package/dist/NotificationServicesController/processors/process-onchain-notifications.js +8 -0
  37. package/dist/NotificationServicesController/processors/process-onchain-notifications.js.map +1 -0
  38. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs +8 -0
  39. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs.map +1 -0
  40. package/dist/NotificationServicesController/services/feature-announcements.js +14 -0
  41. package/dist/NotificationServicesController/services/feature-announcements.js.map +1 -0
  42. package/dist/NotificationServicesController/services/feature-announcements.mjs +14 -0
  43. package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -0
  44. package/dist/NotificationServicesController/services/onchain-notifications.js +29 -0
  45. package/dist/NotificationServicesController/services/onchain-notifications.js.map +1 -0
  46. package/dist/NotificationServicesController/services/onchain-notifications.mjs +29 -0
  47. package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -0
  48. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js +2 -0
  49. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js.map +1 -0
  50. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs +2 -0
  51. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +1 -0
  52. package/dist/NotificationServicesController/types/feature-announcement/index.js +5 -0
  53. package/dist/NotificationServicesController/types/feature-announcement/index.js.map +1 -0
  54. package/dist/NotificationServicesController/types/feature-announcement/index.mjs +5 -0
  55. package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +1 -0
  56. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js +2 -0
  57. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js.map +1 -0
  58. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs +2 -0
  59. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs.map +1 -0
  60. package/dist/NotificationServicesController/types/feature-announcement/type-links.js +2 -0
  61. package/dist/NotificationServicesController/types/feature-announcement/type-links.js.map +1 -0
  62. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs +2 -0
  63. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs.map +1 -0
  64. package/dist/NotificationServicesController/types/index.js +12 -0
  65. package/dist/NotificationServicesController/types/index.js.map +1 -0
  66. package/dist/NotificationServicesController/types/index.mjs +12 -0
  67. package/dist/NotificationServicesController/types/index.mjs.map +1 -0
  68. package/dist/NotificationServicesController/types/notification/index.js +3 -0
  69. package/dist/NotificationServicesController/types/notification/index.js.map +1 -0
  70. package/dist/NotificationServicesController/types/notification/index.mjs +3 -0
  71. package/dist/NotificationServicesController/types/notification/index.mjs.map +1 -0
  72. package/dist/NotificationServicesController/types/notification/notification.js +2 -0
  73. package/dist/NotificationServicesController/types/notification/notification.js.map +1 -0
  74. package/dist/NotificationServicesController/types/notification/notification.mjs +2 -0
  75. package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -0
  76. package/dist/NotificationServicesController/types/on-chain-notification/index.js +3 -0
  77. package/dist/NotificationServicesController/types/on-chain-notification/index.js.map +1 -0
  78. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs +3 -0
  79. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs.map +1 -0
  80. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js +2 -0
  81. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js.map +1 -0
  82. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs +2 -0
  83. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -0
  84. package/dist/NotificationServicesController/types/on-chain-notification/schema.js +1 -0
  85. package/dist/NotificationServicesController/types/on-chain-notification/schema.js.map +1 -0
  86. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs +1 -0
  87. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -0
  88. package/dist/NotificationServicesController/types/type-utils.js +1 -0
  89. package/dist/NotificationServicesController/types/type-utils.js.map +1 -0
  90. package/dist/NotificationServicesController/types/type-utils.mjs +1 -0
  91. package/dist/NotificationServicesController/types/type-utils.mjs.map +1 -0
  92. package/dist/NotificationServicesController/types/user-storage/index.js +3 -0
  93. package/dist/NotificationServicesController/types/user-storage/index.js.map +1 -0
  94. package/dist/NotificationServicesController/types/user-storage/index.mjs +3 -0
  95. package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -0
  96. package/dist/NotificationServicesController/types/user-storage/user-storage.js +2 -0
  97. package/dist/NotificationServicesController/types/user-storage/user-storage.js.map +1 -0
  98. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs +2 -0
  99. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs.map +1 -0
  100. package/dist/NotificationServicesController/utils/utils.js +32 -0
  101. package/dist/NotificationServicesController/utils/utils.js.map +1 -0
  102. package/dist/NotificationServicesController/utils/utils.mjs +32 -0
  103. package/dist/NotificationServicesController/utils/utils.mjs.map +1 -0
  104. package/dist/NotificationServicesPushController/NotificationServicesPushController.js +34 -0
  105. package/dist/NotificationServicesPushController/NotificationServicesPushController.js.map +1 -0
  106. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +34 -0
  107. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -0
  108. package/dist/NotificationServicesPushController/constants.js +26 -0
  109. package/dist/NotificationServicesPushController/constants.js.map +1 -0
  110. package/dist/NotificationServicesPushController/constants.mjs +26 -0
  111. package/dist/NotificationServicesPushController/constants.mjs.map +1 -0
  112. package/dist/NotificationServicesPushController/index.js +49 -0
  113. package/dist/NotificationServicesPushController/index.js.map +1 -0
  114. package/dist/NotificationServicesPushController/index.mjs +49 -0
  115. package/dist/NotificationServicesPushController/index.mjs.map +1 -0
  116. package/dist/NotificationServicesPushController/services/endpoints.js +8 -0
  117. package/dist/NotificationServicesPushController/services/endpoints.js.map +1 -0
  118. package/dist/NotificationServicesPushController/services/endpoints.mjs +8 -0
  119. package/dist/NotificationServicesPushController/services/endpoints.mjs.map +1 -0
  120. package/dist/NotificationServicesPushController/services/push/index.js +1 -0
  121. package/dist/NotificationServicesPushController/services/push/index.js.map +1 -0
  122. package/dist/NotificationServicesPushController/services/push/index.mjs +1 -0
  123. package/dist/NotificationServicesPushController/services/push/index.mjs.map +1 -0
  124. package/dist/NotificationServicesPushController/services/push/push-web.js +37 -0
  125. package/dist/NotificationServicesPushController/services/push/push-web.js.map +1 -0
  126. package/dist/NotificationServicesPushController/services/push/push-web.mjs +37 -0
  127. package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -0
  128. package/dist/NotificationServicesPushController/services/services.js +43 -0
  129. package/dist/NotificationServicesPushController/services/services.js.map +1 -0
  130. package/dist/NotificationServicesPushController/services/services.mjs +43 -0
  131. package/dist/NotificationServicesPushController/services/services.mjs.map +1 -0
  132. package/dist/NotificationServicesPushController/types/firebase.js +2 -0
  133. package/dist/NotificationServicesPushController/types/firebase.js.map +1 -0
  134. package/dist/NotificationServicesPushController/types/firebase.mjs +2 -0
  135. package/dist/NotificationServicesPushController/types/firebase.mjs.map +1 -0
  136. package/dist/NotificationServicesPushController/types/index.js +3 -0
  137. package/dist/NotificationServicesPushController/types/index.js.map +1 -0
  138. package/dist/NotificationServicesPushController/types/index.mjs +3 -0
  139. package/dist/NotificationServicesPushController/types/index.mjs.map +1 -0
  140. package/dist/NotificationServicesPushController/utils/get-notification-data.js +14 -0
  141. package/dist/NotificationServicesPushController/utils/get-notification-data.js.map +1 -0
  142. package/dist/NotificationServicesPushController/utils/get-notification-data.mjs +14 -0
  143. package/dist/NotificationServicesPushController/utils/get-notification-data.mjs.map +1 -0
  144. package/dist/NotificationServicesPushController/utils/get-notification-message.js +36 -0
  145. package/dist/NotificationServicesPushController/utils/get-notification-message.js.map +1 -0
  146. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +36 -0
  147. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -0
  148. package/dist/NotificationServicesPushController/utils/index.js +46 -0
  149. package/dist/NotificationServicesPushController/utils/index.js.map +1 -0
  150. package/dist/NotificationServicesPushController/utils/index.mjs +46 -0
  151. package/dist/NotificationServicesPushController/utils/index.mjs.map +1 -0
  152. package/dist/chunk-232HZSEV.js +7 -0
  153. package/dist/chunk-232HZSEV.js.map +1 -0
  154. package/dist/chunk-26CCETCM.mjs +70 -0
  155. package/dist/chunk-26CCETCM.mjs.map +1 -0
  156. package/dist/chunk-3F4M3OUO.mjs +119 -0
  157. package/dist/chunk-3F4M3OUO.mjs.map +1 -0
  158. package/dist/chunk-3ZS2HAEG.js +1 -0
  159. package/dist/chunk-3ZS2HAEG.js.map +1 -0
  160. package/dist/chunk-4BTNTREI.mjs +1 -0
  161. package/dist/chunk-4BTNTREI.mjs.map +1 -0
  162. package/dist/chunk-4QXAPVW3.mjs +1 -0
  163. package/dist/chunk-4QXAPVW3.mjs.map +1 -0
  164. package/dist/chunk-52CALMRA.js +28 -0
  165. package/dist/chunk-52CALMRA.js.map +1 -0
  166. package/dist/chunk-52NKJDI2.mjs +93 -0
  167. package/dist/chunk-52NKJDI2.mjs.map +1 -0
  168. package/dist/chunk-5OYPOYXZ.mjs +802 -0
  169. package/dist/chunk-5OYPOYXZ.mjs.map +1 -0
  170. package/dist/chunk-5WWCWQCE.js +214 -0
  171. package/dist/chunk-5WWCWQCE.js.map +1 -0
  172. package/dist/chunk-6B5FOWRH.js +119 -0
  173. package/dist/chunk-6B5FOWRH.js.map +1 -0
  174. package/dist/chunk-6ZDVTRRT.mjs +9 -0
  175. package/dist/chunk-6ZDVTRRT.mjs.map +1 -0
  176. package/dist/chunk-7LWR54U7.js +7 -0
  177. package/dist/chunk-7LWR54U7.js.map +1 -0
  178. package/dist/chunk-7RM3YNTD.mjs +1 -0
  179. package/dist/chunk-7RM3YNTD.mjs.map +1 -0
  180. package/dist/chunk-A2RPVX47.mjs +1 -0
  181. package/dist/chunk-A2RPVX47.mjs.map +1 -0
  182. package/dist/chunk-B25TJ7KS.js +8 -0
  183. package/dist/chunk-B25TJ7KS.js.map +1 -0
  184. package/dist/chunk-B4ECJJ5C.mjs +7 -0
  185. package/dist/chunk-B4ECJJ5C.mjs.map +1 -0
  186. package/dist/chunk-BONB66A2.mjs +14 -0
  187. package/dist/chunk-BONB66A2.mjs.map +1 -0
  188. package/dist/chunk-CQ6CGSKZ.js +35 -0
  189. package/dist/chunk-CQ6CGSKZ.js.map +1 -0
  190. package/dist/chunk-D42BBXBM.mjs +28 -0
  191. package/dist/chunk-D42BBXBM.mjs.map +1 -0
  192. package/dist/chunk-DMH4NSLF.js +1 -0
  193. package/dist/chunk-DMH4NSLF.js.map +1 -0
  194. package/dist/chunk-DNTK4U5M.js +4300 -0
  195. package/dist/chunk-DNTK4U5M.js.map +1 -0
  196. package/dist/chunk-DY4ELDRQ.js +176 -0
  197. package/dist/chunk-DY4ELDRQ.js.map +1 -0
  198. package/dist/chunk-EJ52BDLB.js +55 -0
  199. package/dist/chunk-EJ52BDLB.js.map +1 -0
  200. package/dist/chunk-EQWVJX6K.mjs +91 -0
  201. package/dist/chunk-EQWVJX6K.mjs.map +1 -0
  202. package/dist/chunk-FFQNSBPU.js +31 -0
  203. package/dist/chunk-FFQNSBPU.js.map +1 -0
  204. package/dist/chunk-G52DNXFH.mjs +1 -0
  205. package/dist/chunk-G52DNXFH.mjs.map +1 -0
  206. package/dist/chunk-GETQWOTI.js +1 -0
  207. package/dist/chunk-GETQWOTI.js.map +1 -0
  208. package/dist/chunk-GFAESVZA.js +48 -0
  209. package/dist/chunk-GFAESVZA.js.map +1 -0
  210. package/dist/chunk-HPUQYDVC.js +1 -0
  211. package/dist/chunk-HPUQYDVC.js.map +1 -0
  212. package/dist/chunk-IDO4JFV5.mjs +1 -0
  213. package/dist/chunk-IDO4JFV5.mjs.map +1 -0
  214. package/dist/chunk-IKWNHNJQ.mjs +8 -0
  215. package/dist/chunk-IKWNHNJQ.mjs.map +1 -0
  216. package/dist/chunk-IOMDG67D.mjs +7 -0
  217. package/dist/chunk-IOMDG67D.mjs.map +1 -0
  218. package/dist/chunk-IPI7BAW3.js +1 -0
  219. package/dist/chunk-IPI7BAW3.js.map +1 -0
  220. package/dist/chunk-JLHFZ2UG.mjs +31 -0
  221. package/dist/chunk-JLHFZ2UG.mjs.map +1 -0
  222. package/dist/chunk-JQ7WKFCI.mjs +1 -0
  223. package/dist/chunk-JQ7WKFCI.mjs.map +1 -0
  224. package/dist/chunk-KTQP5UDT.mjs +4300 -0
  225. package/dist/chunk-KTQP5UDT.mjs.map +1 -0
  226. package/dist/chunk-LYEXYTOI.js +14 -0
  227. package/dist/chunk-LYEXYTOI.js.map +1 -0
  228. package/dist/chunk-NJBJIZLR.js +93 -0
  229. package/dist/chunk-NJBJIZLR.js.map +1 -0
  230. package/dist/chunk-NMLYB3XT.js +149 -0
  231. package/dist/chunk-NMLYB3XT.js.map +1 -0
  232. package/dist/chunk-ODI2BTKS.mjs +55 -0
  233. package/dist/chunk-ODI2BTKS.mjs.map +1 -0
  234. package/dist/chunk-OUPWMPLU.mjs +214 -0
  235. package/dist/chunk-OUPWMPLU.mjs.map +1 -0
  236. package/dist/chunk-PGMXFZ6Y.js +207 -0
  237. package/dist/chunk-PGMXFZ6Y.js.map +1 -0
  238. package/dist/chunk-PIZCE3JD.js +243 -0
  239. package/dist/chunk-PIZCE3JD.js.map +1 -0
  240. package/dist/chunk-PNCS6GEX.mjs +1 -0
  241. package/dist/chunk-PNCS6GEX.mjs.map +1 -0
  242. package/dist/chunk-PROWNV4M.js +1 -0
  243. package/dist/chunk-PROWNV4M.js.map +1 -0
  244. package/dist/chunk-QB5IFRLA.mjs +1 -0
  245. package/dist/chunk-QB5IFRLA.mjs.map +1 -0
  246. package/dist/chunk-QTK2RMF7.mjs +29 -0
  247. package/dist/chunk-QTK2RMF7.mjs.map +1 -0
  248. package/dist/chunk-RAUV5UV4.mjs +1 -0
  249. package/dist/chunk-RAUV5UV4.mjs.map +1 -0
  250. package/dist/chunk-RQWUD2FB.mjs +48 -0
  251. package/dist/chunk-RQWUD2FB.mjs.map +1 -0
  252. package/dist/chunk-SMKJEA45.mjs +243 -0
  253. package/dist/chunk-SMKJEA45.mjs.map +1 -0
  254. package/dist/chunk-SSWX2N73.mjs +207 -0
  255. package/dist/chunk-SSWX2N73.mjs.map +1 -0
  256. package/dist/chunk-TLX5QQK5.js +9 -0
  257. package/dist/chunk-TLX5QQK5.js.map +1 -0
  258. package/dist/chunk-TT56I53C.mjs +149 -0
  259. package/dist/chunk-TT56I53C.mjs.map +1 -0
  260. package/dist/chunk-U74Q3BRP.mjs +1 -0
  261. package/dist/chunk-U74Q3BRP.mjs.map +1 -0
  262. package/dist/chunk-UIRZIKC3.mjs +187 -0
  263. package/dist/chunk-UIRZIKC3.mjs.map +1 -0
  264. package/dist/chunk-UPVIT75F.js +29 -0
  265. package/dist/chunk-UPVIT75F.js.map +1 -0
  266. package/dist/chunk-V46WVGWN.js +70 -0
  267. package/dist/chunk-V46WVGWN.js.map +1 -0
  268. package/dist/chunk-V5HMYDWE.js +1 -0
  269. package/dist/chunk-V5HMYDWE.js.map +1 -0
  270. package/dist/chunk-VC6J62JI.mjs +176 -0
  271. package/dist/chunk-VC6J62JI.mjs.map +1 -0
  272. package/dist/chunk-VE4DTN4R.mjs +35 -0
  273. package/dist/chunk-VE4DTN4R.mjs.map +1 -0
  274. package/dist/chunk-VOZ7Y2OO.js +187 -0
  275. package/dist/chunk-VOZ7Y2OO.js.map +1 -0
  276. package/dist/chunk-WRYFIWNK.js +1 -0
  277. package/dist/chunk-WRYFIWNK.js.map +1 -0
  278. package/dist/chunk-XNBTOK6G.js +802 -0
  279. package/dist/chunk-XNBTOK6G.js.map +1 -0
  280. package/dist/chunk-XZEVRYUE.js +1 -0
  281. package/dist/chunk-XZEVRYUE.js.map +1 -0
  282. package/dist/chunk-ZBNBZN5H.js +1 -0
  283. package/dist/chunk-ZBNBZN5H.js.map +1 -0
  284. package/dist/chunk-ZMNXLHAC.js +91 -0
  285. package/dist/chunk-ZMNXLHAC.js.map +1 -0
  286. package/dist/chunk-ZV3DFBO4.js +1 -0
  287. package/dist/chunk-ZV3DFBO4.js.map +1 -0
  288. package/dist/index.js +43 -0
  289. package/dist/index.js.map +1 -0
  290. package/dist/index.mjs +43 -0
  291. package/dist/index.mjs.map +1 -0
  292. package/dist/tsconfig.build.tsbuildinfo +1 -0
  293. package/dist/types/NotificationServicesController/NotificationServicesController.d.ts +222 -0
  294. package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +1 -0
  295. package/dist/types/NotificationServicesController/__fixtures__/index.d.ts +7 -0
  296. package/dist/types/NotificationServicesController/__fixtures__/index.d.ts.map +1 -0
  297. package/dist/types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts +15 -0
  298. package/dist/types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts.map +1 -0
  299. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts +9 -0
  300. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts.map +1 -0
  301. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts +35 -0
  302. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts.map +1 -0
  303. package/dist/types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts +82 -0
  304. package/dist/types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts.map +1 -0
  305. package/dist/types/NotificationServicesController/__fixtures__/mockResponses.d.ts +28 -0
  306. package/dist/types/NotificationServicesController/__fixtures__/mockResponses.d.ts.map +1 -0
  307. package/dist/types/NotificationServicesController/__fixtures__/mockServices.d.ts +12 -0
  308. package/dist/types/NotificationServicesController/__fixtures__/mockServices.d.ts.map +1 -0
  309. package/dist/types/NotificationServicesController/__fixtures__/test-utils.d.ts +14 -0
  310. package/dist/types/NotificationServicesController/__fixtures__/test-utils.d.ts.map +1 -0
  311. package/dist/types/NotificationServicesController/constants/constants.d.ts +3 -0
  312. package/dist/types/NotificationServicesController/constants/constants.d.ts.map +1 -0
  313. package/dist/types/NotificationServicesController/constants/index.d.ts +3 -0
  314. package/dist/types/NotificationServicesController/constants/index.d.ts.map +1 -0
  315. package/dist/types/NotificationServicesController/constants/notification-schema.d.ts +42 -0
  316. package/dist/types/NotificationServicesController/constants/notification-schema.d.ts.map +1 -0
  317. package/dist/types/NotificationServicesController/index.d.ts +6 -0
  318. package/dist/types/NotificationServicesController/index.d.ts.map +1 -0
  319. package/dist/types/NotificationServicesController/processors/index.d.ts +4 -0
  320. package/dist/types/NotificationServicesController/processors/index.d.ts.map +1 -0
  321. package/dist/types/NotificationServicesController/processors/process-feature-announcement.d.ts +19 -0
  322. package/dist/types/NotificationServicesController/processors/process-feature-announcement.d.ts.map +1 -0
  323. package/dist/types/NotificationServicesController/processors/process-notifications.d.ts +19 -0
  324. package/dist/types/NotificationServicesController/processors/process-notifications.d.ts.map +1 -0
  325. package/dist/types/NotificationServicesController/processors/process-onchain-notifications.d.ts +10 -0
  326. package/dist/types/NotificationServicesController/processors/process-onchain-notifications.d.ts.map +1 -0
  327. package/dist/types/NotificationServicesController/services/feature-announcements.d.ts +28 -0
  328. package/dist/types/NotificationServicesController/services/feature-announcements.d.ts.map +1 -0
  329. package/dist/types/NotificationServicesController/services/onchain-notifications.d.ts +62 -0
  330. package/dist/types/NotificationServicesController/services/onchain-notifications.d.ts.map +1 -0
  331. package/dist/types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts +30 -0
  332. package/dist/types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts.map +1 -0
  333. package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts +4 -0
  334. package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts.map +1 -0
  335. package/dist/types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts +38 -0
  336. package/dist/types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts.map +1 -0
  337. package/dist/types/NotificationServicesController/types/feature-announcement/type-links.d.ts +24 -0
  338. package/dist/types/NotificationServicesController/types/feature-announcement/type-links.d.ts.map +1 -0
  339. package/dist/types/NotificationServicesController/types/index.d.ts +5 -0
  340. package/dist/types/NotificationServicesController/types/index.d.ts.map +1 -0
  341. package/dist/types/NotificationServicesController/types/notification/index.d.ts +2 -0
  342. package/dist/types/NotificationServicesController/types/notification/index.d.ts.map +1 -0
  343. package/dist/types/NotificationServicesController/types/notification/notification.d.ts +25 -0
  344. package/dist/types/NotificationServicesController/types/notification/notification.d.ts.map +1 -0
  345. package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts +2 -0
  346. package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts.map +1 -0
  347. package/dist/types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts +42 -0
  348. package/dist/types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts.map +1 -0
  349. package/dist/types/NotificationServicesController/types/on-chain-notification/schema.d.ts +283 -0
  350. package/dist/types/NotificationServicesController/types/on-chain-notification/schema.d.ts.map +1 -0
  351. package/dist/types/NotificationServicesController/types/type-utils.d.ts +7 -0
  352. package/dist/types/NotificationServicesController/types/type-utils.d.ts.map +1 -0
  353. package/dist/types/NotificationServicesController/types/user-storage/index.d.ts +2 -0
  354. package/dist/types/NotificationServicesController/types/user-storage/index.d.ts.map +1 -0
  355. package/dist/types/NotificationServicesController/types/user-storage/user-storage.d.ts +26 -0
  356. package/dist/types/NotificationServicesController/types/user-storage/user-storage.d.ts.map +1 -0
  357. package/dist/types/NotificationServicesController/utils/utils.d.ts +144 -0
  358. package/dist/types/NotificationServicesController/utils/utils.d.ts.map +1 -0
  359. package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts +103 -0
  360. package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +1 -0
  361. package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts +3 -0
  362. package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts.map +1 -0
  363. package/dist/types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts +43 -0
  364. package/dist/types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts.map +1 -0
  365. package/dist/types/NotificationServicesPushController/__fixtures__/mockServices.d.ts +9 -0
  366. package/dist/types/NotificationServicesPushController/__fixtures__/mockServices.d.ts.map +1 -0
  367. package/dist/types/NotificationServicesPushController/constants.d.ts +11 -0
  368. package/dist/types/NotificationServicesPushController/constants.d.ts.map +1 -0
  369. package/dist/types/NotificationServicesPushController/index.d.ts +5 -0
  370. package/dist/types/NotificationServicesPushController/index.d.ts.map +1 -0
  371. package/dist/types/NotificationServicesPushController/services/endpoints.d.ts +2 -0
  372. package/dist/types/NotificationServicesPushController/services/endpoints.d.ts.map +1 -0
  373. package/dist/types/NotificationServicesPushController/services/push/index.d.ts +6 -0
  374. package/dist/types/NotificationServicesPushController/services/push/index.d.ts.map +1 -0
  375. package/dist/types/NotificationServicesPushController/services/push/push-web.d.ts +32 -0
  376. package/dist/types/NotificationServicesPushController/services/push/push-web.d.ts.map +1 -0
  377. package/dist/types/NotificationServicesPushController/services/services.d.ts +95 -0
  378. package/dist/types/NotificationServicesPushController/services/services.d.ts.map +1 -0
  379. package/dist/types/NotificationServicesPushController/types/firebase.d.ts +53 -0
  380. package/dist/types/NotificationServicesPushController/types/firebase.d.ts.map +1 -0
  381. package/dist/types/NotificationServicesPushController/types/index.d.ts +2 -0
  382. package/dist/types/NotificationServicesPushController/types/index.d.ts.map +1 -0
  383. package/dist/types/NotificationServicesPushController/utils/get-notification-data.d.ts +42 -0
  384. package/dist/types/NotificationServicesPushController/utils/get-notification-data.d.ts.map +1 -0
  385. package/dist/types/NotificationServicesPushController/utils/get-notification-message.d.ts +67 -0
  386. package/dist/types/NotificationServicesPushController/utils/get-notification-message.d.ts.map +1 -0
  387. package/dist/types/NotificationServicesPushController/utils/index.d.ts +3 -0
  388. package/dist/types/NotificationServicesPushController/utils/index.d.ts.map +1 -0
  389. package/dist/types/index.d.ts +3 -0
  390. package/dist/types/index.d.ts.map +1 -0
  391. package/package.json +80 -0
@@ -0,0 +1,176 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/NotificationServicesController/constants/notification-schema.ts
2
+ var TRIGGER_TYPES = /* @__PURE__ */ ((TRIGGER_TYPES2) => {
3
+ TRIGGER_TYPES2["FEATURES_ANNOUNCEMENT"] = "features_announcement";
4
+ TRIGGER_TYPES2["METAMASK_SWAP_COMPLETED"] = "metamask_swap_completed";
5
+ TRIGGER_TYPES2["ERC20_SENT"] = "erc20_sent";
6
+ TRIGGER_TYPES2["ERC20_RECEIVED"] = "erc20_received";
7
+ TRIGGER_TYPES2["ETH_SENT"] = "eth_sent";
8
+ TRIGGER_TYPES2["ETH_RECEIVED"] = "eth_received";
9
+ TRIGGER_TYPES2["ROCKETPOOL_STAKE_COMPLETED"] = "rocketpool_stake_completed";
10
+ TRIGGER_TYPES2["ROCKETPOOL_UNSTAKE_COMPLETED"] = "rocketpool_unstake_completed";
11
+ TRIGGER_TYPES2["LIDO_STAKE_COMPLETED"] = "lido_stake_completed";
12
+ TRIGGER_TYPES2["LIDO_WITHDRAWAL_REQUESTED"] = "lido_withdrawal_requested";
13
+ TRIGGER_TYPES2["LIDO_WITHDRAWAL_COMPLETED"] = "lido_withdrawal_completed";
14
+ TRIGGER_TYPES2["LIDO_STAKE_READY_TO_BE_WITHDRAWN"] = "lido_stake_ready_to_be_withdrawn";
15
+ TRIGGER_TYPES2["ERC721_SENT"] = "erc721_sent";
16
+ TRIGGER_TYPES2["ERC721_RECEIVED"] = "erc721_received";
17
+ TRIGGER_TYPES2["ERC1155_SENT"] = "erc1155_sent";
18
+ TRIGGER_TYPES2["ERC1155_RECEIVED"] = "erc1155_received";
19
+ return TRIGGER_TYPES2;
20
+ })(TRIGGER_TYPES || {});
21
+ var TRIGGER_TYPES_WALLET_SET = /* @__PURE__ */ new Set([
22
+ "metamask_swap_completed" /* METAMASK_SWAP_COMPLETED */,
23
+ "erc20_sent" /* ERC20_SENT */,
24
+ "erc20_received" /* ERC20_RECEIVED */,
25
+ "eth_sent" /* ETH_SENT */,
26
+ "eth_received" /* ETH_RECEIVED */,
27
+ "rocketpool_stake_completed" /* ROCKETPOOL_STAKE_COMPLETED */,
28
+ "rocketpool_unstake_completed" /* ROCKETPOOL_UNSTAKE_COMPLETED */,
29
+ "lido_stake_completed" /* LIDO_STAKE_COMPLETED */,
30
+ "lido_withdrawal_requested" /* LIDO_WITHDRAWAL_REQUESTED */,
31
+ "lido_withdrawal_completed" /* LIDO_WITHDRAWAL_COMPLETED */,
32
+ "lido_stake_ready_to_be_withdrawn" /* LIDO_STAKE_READY_TO_BE_WITHDRAWN */,
33
+ "erc721_sent" /* ERC721_SENT */,
34
+ "erc721_received" /* ERC721_RECEIVED */,
35
+ "erc1155_sent" /* ERC1155_SENT */,
36
+ "erc1155_received" /* ERC1155_RECEIVED */
37
+ ]);
38
+ var TRIGGER_TYPES_GROUPS = /* @__PURE__ */ ((TRIGGER_TYPES_GROUPS2) => {
39
+ TRIGGER_TYPES_GROUPS2["RECEIVED"] = "received";
40
+ TRIGGER_TYPES_GROUPS2["SENT"] = "sent";
41
+ TRIGGER_TYPES_GROUPS2["DEFI"] = "defi";
42
+ return TRIGGER_TYPES_GROUPS2;
43
+ })(TRIGGER_TYPES_GROUPS || {});
44
+ var NOTIFICATION_CHAINS = {
45
+ ETHEREUM: "1",
46
+ OPTIMISM: "10",
47
+ BSC: "56",
48
+ POLYGON: "137",
49
+ ARBITRUM: "42161",
50
+ AVALANCHE: "43114",
51
+ LINEA: "59144"
52
+ };
53
+ var CHAIN_SYMBOLS = {
54
+ [NOTIFICATION_CHAINS.ETHEREUM]: "ETH",
55
+ [NOTIFICATION_CHAINS.OPTIMISM]: "ETH",
56
+ [NOTIFICATION_CHAINS.BSC]: "BNB",
57
+ [NOTIFICATION_CHAINS.POLYGON]: "MATIC",
58
+ [NOTIFICATION_CHAINS.ARBITRUM]: "ETH",
59
+ [NOTIFICATION_CHAINS.AVALANCHE]: "AVAX",
60
+ [NOTIFICATION_CHAINS.LINEA]: "ETH"
61
+ };
62
+ var SUPPORTED_CHAINS = [
63
+ NOTIFICATION_CHAINS.ETHEREUM,
64
+ NOTIFICATION_CHAINS.OPTIMISM,
65
+ NOTIFICATION_CHAINS.BSC,
66
+ NOTIFICATION_CHAINS.POLYGON,
67
+ NOTIFICATION_CHAINS.ARBITRUM,
68
+ NOTIFICATION_CHAINS.AVALANCHE,
69
+ NOTIFICATION_CHAINS.LINEA
70
+ ];
71
+ var TRIGGERS = {
72
+ ["metamask_swap_completed" /* METAMASK_SWAP_COMPLETED */]: {
73
+ supported_chains: [
74
+ NOTIFICATION_CHAINS.ETHEREUM,
75
+ NOTIFICATION_CHAINS.OPTIMISM,
76
+ NOTIFICATION_CHAINS.BSC,
77
+ NOTIFICATION_CHAINS.POLYGON,
78
+ NOTIFICATION_CHAINS.ARBITRUM,
79
+ NOTIFICATION_CHAINS.AVALANCHE
80
+ ]
81
+ },
82
+ ["erc20_sent" /* ERC20_SENT */]: {
83
+ supported_chains: [
84
+ NOTIFICATION_CHAINS.ETHEREUM,
85
+ NOTIFICATION_CHAINS.OPTIMISM,
86
+ NOTIFICATION_CHAINS.BSC,
87
+ NOTIFICATION_CHAINS.POLYGON,
88
+ NOTIFICATION_CHAINS.ARBITRUM,
89
+ NOTIFICATION_CHAINS.AVALANCHE,
90
+ NOTIFICATION_CHAINS.LINEA
91
+ ]
92
+ },
93
+ ["erc20_received" /* ERC20_RECEIVED */]: {
94
+ supported_chains: [
95
+ NOTIFICATION_CHAINS.ETHEREUM,
96
+ NOTIFICATION_CHAINS.OPTIMISM,
97
+ NOTIFICATION_CHAINS.BSC,
98
+ NOTIFICATION_CHAINS.POLYGON,
99
+ NOTIFICATION_CHAINS.ARBITRUM,
100
+ NOTIFICATION_CHAINS.AVALANCHE,
101
+ NOTIFICATION_CHAINS.LINEA
102
+ ]
103
+ },
104
+ ["erc721_sent" /* ERC721_SENT */]: {
105
+ supported_chains: [
106
+ NOTIFICATION_CHAINS.ETHEREUM,
107
+ NOTIFICATION_CHAINS.POLYGON
108
+ ]
109
+ },
110
+ ["erc721_received" /* ERC721_RECEIVED */]: {
111
+ supported_chains: [
112
+ NOTIFICATION_CHAINS.ETHEREUM,
113
+ NOTIFICATION_CHAINS.POLYGON
114
+ ]
115
+ },
116
+ ["erc1155_sent" /* ERC1155_SENT */]: {
117
+ supported_chains: [
118
+ NOTIFICATION_CHAINS.ETHEREUM,
119
+ NOTIFICATION_CHAINS.POLYGON
120
+ ]
121
+ },
122
+ ["erc1155_received" /* ERC1155_RECEIVED */]: {
123
+ supported_chains: [
124
+ NOTIFICATION_CHAINS.ETHEREUM,
125
+ NOTIFICATION_CHAINS.POLYGON
126
+ ]
127
+ },
128
+ ["eth_sent" /* ETH_SENT */]: {
129
+ supported_chains: [
130
+ NOTIFICATION_CHAINS.ETHEREUM,
131
+ NOTIFICATION_CHAINS.OPTIMISM,
132
+ NOTIFICATION_CHAINS.BSC,
133
+ NOTIFICATION_CHAINS.POLYGON,
134
+ NOTIFICATION_CHAINS.ARBITRUM,
135
+ NOTIFICATION_CHAINS.AVALANCHE,
136
+ NOTIFICATION_CHAINS.LINEA
137
+ ]
138
+ },
139
+ ["eth_received" /* ETH_RECEIVED */]: {
140
+ supported_chains: [
141
+ NOTIFICATION_CHAINS.ETHEREUM,
142
+ NOTIFICATION_CHAINS.OPTIMISM,
143
+ NOTIFICATION_CHAINS.BSC,
144
+ NOTIFICATION_CHAINS.POLYGON,
145
+ NOTIFICATION_CHAINS.ARBITRUM,
146
+ NOTIFICATION_CHAINS.AVALANCHE,
147
+ NOTIFICATION_CHAINS.LINEA
148
+ ]
149
+ },
150
+ ["rocketpool_stake_completed" /* ROCKETPOOL_STAKE_COMPLETED */]: {
151
+ supported_chains: [NOTIFICATION_CHAINS.ETHEREUM]
152
+ },
153
+ ["rocketpool_unstake_completed" /* ROCKETPOOL_UNSTAKE_COMPLETED */]: {
154
+ supported_chains: [NOTIFICATION_CHAINS.ETHEREUM]
155
+ },
156
+ ["lido_stake_completed" /* LIDO_STAKE_COMPLETED */]: {
157
+ supported_chains: [NOTIFICATION_CHAINS.ETHEREUM]
158
+ },
159
+ ["lido_withdrawal_requested" /* LIDO_WITHDRAWAL_REQUESTED */]: {
160
+ supported_chains: [NOTIFICATION_CHAINS.ETHEREUM]
161
+ },
162
+ ["lido_withdrawal_completed" /* LIDO_WITHDRAWAL_COMPLETED */]: {
163
+ supported_chains: [NOTIFICATION_CHAINS.ETHEREUM]
164
+ }
165
+ };
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+ exports.TRIGGER_TYPES = TRIGGER_TYPES; exports.TRIGGER_TYPES_WALLET_SET = TRIGGER_TYPES_WALLET_SET; exports.TRIGGER_TYPES_GROUPS = TRIGGER_TYPES_GROUPS; exports.NOTIFICATION_CHAINS = NOTIFICATION_CHAINS; exports.CHAIN_SYMBOLS = CHAIN_SYMBOLS; exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS; exports.TRIGGERS = TRIGGERS;
176
+ //# sourceMappingURL=chunk-DY4ELDRQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesController/constants/notification-schema.ts"],"names":["TRIGGER_TYPES","TRIGGER_TYPES_GROUPS"],"mappings":"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","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nexport enum TRIGGER_TYPES {\n FEATURES_ANNOUNCEMENT = 'features_announcement',\n METAMASK_SWAP_COMPLETED = 'metamask_swap_completed',\n ERC20_SENT = 'erc20_sent',\n ERC20_RECEIVED = 'erc20_received',\n ETH_SENT = 'eth_sent',\n ETH_RECEIVED = 'eth_received',\n ROCKETPOOL_STAKE_COMPLETED = 'rocketpool_stake_completed',\n ROCKETPOOL_UNSTAKE_COMPLETED = 'rocketpool_unstake_completed',\n LIDO_STAKE_COMPLETED = 'lido_stake_completed',\n LIDO_WITHDRAWAL_REQUESTED = 'lido_withdrawal_requested',\n LIDO_WITHDRAWAL_COMPLETED = 'lido_withdrawal_completed',\n LIDO_STAKE_READY_TO_BE_WITHDRAWN = 'lido_stake_ready_to_be_withdrawn',\n ERC721_SENT = 'erc721_sent',\n ERC721_RECEIVED = 'erc721_received',\n ERC1155_SENT = 'erc1155_sent',\n ERC1155_RECEIVED = 'erc1155_received',\n}\n\nexport const TRIGGER_TYPES_WALLET_SET: Set<string> = new Set([\n TRIGGER_TYPES.METAMASK_SWAP_COMPLETED,\n TRIGGER_TYPES.ERC20_SENT,\n TRIGGER_TYPES.ERC20_RECEIVED,\n TRIGGER_TYPES.ETH_SENT,\n TRIGGER_TYPES.ETH_RECEIVED,\n TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED,\n TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED,\n TRIGGER_TYPES.LIDO_STAKE_COMPLETED,\n TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED,\n TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED,\n TRIGGER_TYPES.LIDO_STAKE_READY_TO_BE_WITHDRAWN,\n TRIGGER_TYPES.ERC721_SENT,\n TRIGGER_TYPES.ERC721_RECEIVED,\n TRIGGER_TYPES.ERC1155_SENT,\n TRIGGER_TYPES.ERC1155_RECEIVED,\n]) satisfies Set<Exclude<TRIGGER_TYPES, TRIGGER_TYPES.FEATURES_ANNOUNCEMENT>>;\n\nexport enum TRIGGER_TYPES_GROUPS {\n RECEIVED = 'received',\n SENT = 'sent',\n DEFI = 'defi',\n}\n\nexport const NOTIFICATION_CHAINS = {\n ETHEREUM: '1',\n OPTIMISM: '10',\n BSC: '56',\n POLYGON: '137',\n ARBITRUM: '42161',\n AVALANCHE: '43114',\n LINEA: '59144',\n};\n\nexport const CHAIN_SYMBOLS = {\n [NOTIFICATION_CHAINS.ETHEREUM]: 'ETH',\n [NOTIFICATION_CHAINS.OPTIMISM]: 'ETH',\n [NOTIFICATION_CHAINS.BSC]: 'BNB',\n [NOTIFICATION_CHAINS.POLYGON]: 'MATIC',\n [NOTIFICATION_CHAINS.ARBITRUM]: 'ETH',\n [NOTIFICATION_CHAINS.AVALANCHE]: 'AVAX',\n [NOTIFICATION_CHAINS.LINEA]: 'ETH',\n};\n\nexport const SUPPORTED_CHAINS = [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n];\n\nexport type Trigger = {\n supported_chains: (typeof SUPPORTED_CHAINS)[number][];\n};\n\nexport const TRIGGERS: Partial<Record<TRIGGER_TYPES, Trigger>> = {\n [TRIGGER_TYPES.METAMASK_SWAP_COMPLETED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n ],\n },\n [TRIGGER_TYPES.ERC20_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ERC20_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ERC721_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC721_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC1155_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ERC1155_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.POLYGON,\n ],\n },\n [TRIGGER_TYPES.ETH_SENT]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ETH_RECEIVED]: {\n supported_chains: [\n NOTIFICATION_CHAINS.ETHEREUM,\n NOTIFICATION_CHAINS.OPTIMISM,\n NOTIFICATION_CHAINS.BSC,\n NOTIFICATION_CHAINS.POLYGON,\n NOTIFICATION_CHAINS.ARBITRUM,\n NOTIFICATION_CHAINS.AVALANCHE,\n NOTIFICATION_CHAINS.LINEA,\n ],\n },\n [TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_STAKE_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n [TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED]: {\n supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],\n },\n};\n"]}
@@ -0,0 +1,55 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/NotificationServicesPushController/utils/get-notification-data.ts
2
+ var _bignumberjs = require('bignumber.js');
3
+ var defaultFormatOptions = {
4
+ decimalPlaces: 4
5
+ };
6
+ function calcTokenAmount(value, decimals) {
7
+ const multiplier = Math.pow(10, Number(decimals || 0));
8
+ return new (0, _bignumberjs.BigNumber)(String(value)).div(multiplier);
9
+ }
10
+ var getLeadingZeroCount = (num) => {
11
+ const numToString = new (0, _bignumberjs.BigNumber)(num, 10).toString(10);
12
+ const fractionalPart = numToString.split(".")[1] ?? "";
13
+ return fractionalPart.match(/^0*/u)?.[0]?.length || 0;
14
+ };
15
+ var formatAmount = (numericAmount, opts) => {
16
+ const options = { ...defaultFormatOptions, ...opts };
17
+ const leadingZeros = getLeadingZeroCount(numericAmount);
18
+ const isDecimal = numericAmount.toString().includes(".") || leadingZeros > 0;
19
+ const isLargeNumber = numericAmount > 999;
20
+ const handleShouldEllipse = (decimalPlaces) => Boolean(options?.shouldEllipse) && leadingZeros >= decimalPlaces;
21
+ if (isLargeNumber) {
22
+ return Intl.NumberFormat("en-US", {
23
+ notation: "compact",
24
+ compactDisplay: "short",
25
+ maximumFractionDigits: 2
26
+ }).format(numericAmount);
27
+ }
28
+ if (isDecimal) {
29
+ const ellipse = handleShouldEllipse(options.decimalPlaces);
30
+ const formattedValue = Intl.NumberFormat("en-US", {
31
+ minimumFractionDigits: ellipse ? options.decimalPlaces : void 0,
32
+ maximumFractionDigits: options.decimalPlaces
33
+ }).format(numericAmount);
34
+ return ellipse ? `${formattedValue}...` : formattedValue;
35
+ }
36
+ return numericAmount.toString();
37
+ };
38
+ var getAmount = (amount, decimals, options) => {
39
+ if (!amount || !decimals) {
40
+ return "";
41
+ }
42
+ const numericAmount = calcTokenAmount(
43
+ amount,
44
+ parseFloat(decimals)
45
+ ).toNumber();
46
+ return formatAmount(numericAmount, options);
47
+ };
48
+
49
+
50
+
51
+
52
+
53
+
54
+ exports.calcTokenAmount = calcTokenAmount; exports.getLeadingZeroCount = getLeadingZeroCount; exports.formatAmount = formatAmount; exports.getAmount = getAmount;
55
+ //# sourceMappingURL=chunk-EJ52BDLB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesPushController/utils/get-notification-data.ts"],"names":[],"mappings":";AAAA,SAAS,iBAAiB;AAM1B,IAAM,uBAAuB;AAAA,EAC3B,eAAe;AACjB;AASO,SAAS,gBAAgB,OAAe,UAAkB;AAC/D,QAAM,aAAa,KAAK,IAAI,IAAI,OAAO,YAAY,CAAC,CAAC;AACrD,SAAO,IAAI,UAAU,OAAO,KAAK,CAAC,EAAE,IAAI,UAAU;AACpD;AAcO,IAAM,sBAAsB,CAAC,QAAyB;AAC3D,QAAM,cAAc,IAAI,UAAU,KAAK,EAAE,EAAE,SAAS,EAAE;AACtD,QAAM,iBAAiB,YAAY,MAAM,GAAG,EAAE,CAAC,KAAK;AACpD,SAAO,eAAe,MAAM,MAAM,IAAI,CAAC,GAAG,UAAU;AACtD;AAcO,IAAM,eAAe,CAAC,eAAuB,SAAyB;AAE3E,QAAM,UAAU,EAAE,GAAG,sBAAsB,GAAG,KAAK;AAEnD,QAAM,eAAe,oBAAoB,aAAa;AACtD,QAAM,YAAY,cAAc,SAAS,EAAE,SAAS,GAAG,KAAK,eAAe;AAC3E,QAAM,gBAAgB,gBAAgB;AAEtC,QAAM,sBAAsB,CAAC,kBAC3B,QAAQ,SAAS,aAAa,KAAK,gBAAgB;AAErD,MAAI,eAAe;AACjB,WAAO,KAAK,aAAa,SAAS;AAAA,MAChC,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,uBAAuB;AAAA,IACzB,CAAC,EAAE,OAAO,aAAa;AAAA,EACzB;AAEA,MAAI,WAAW;AACb,UAAM,UAAU,oBAAoB,QAAQ,aAAa;AACzD,UAAM,iBAAiB,KAAK,aAAa,SAAS;AAAA,MAChD,uBAAuB,UAAU,QAAQ,gBAAgB;AAAA,MACzD,uBAAuB,QAAQ;AAAA,IACjC,CAAC,EAAE,OAAO,aAAa;AAEvB,WAAO,UAAU,GAAG,cAAc,QAAQ;AAAA,EAC5C;AAGA,SAAO,cAAc,SAAS;AAChC;AAEO,IAAM,YAAY,CACvB,QACA,UACA,YACG;AACH,MAAI,CAAC,UAAU,CAAC,UAAU;AACxB,WAAO;AAAA,EACT;AAEA,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA,WAAW,QAAQ;AAAA,EACrB,EAAE,SAAS;AAEX,SAAO,aAAa,eAAe,OAAO;AAC5C","sourcesContent":["import { BigNumber } from 'bignumber.js';\n\ntype FormatOptions = {\n decimalPlaces?: number;\n shouldEllipse?: boolean;\n};\nconst defaultFormatOptions = {\n decimalPlaces: 4,\n};\n\n/**\n * Calculates the token amount based on the given value and decimals.\n *\n * @param value - The value to calculate the token amount from.\n * @param decimals - The number of decimals to use for the calculation.\n * @returns The calculated token amount.\n */\nexport function calcTokenAmount(value: string, decimals: number) {\n const multiplier = Math.pow(10, Number(decimals || 0));\n return new BigNumber(String(value)).div(multiplier);\n}\n\n/**\n * Calculates the number of leading zeros in the fractional part of a number.\n *\n * This function converts a number or a string representation of a number into\n * its decimal form and then counts the number of leading zeros present in the\n * fractional part of the number. This is useful for determining the precision\n * of very small numbers.\n *\n * @param num - The number to analyze, which can be in the form\n * of a number or a string.\n * @returns The count of leading zeros in the fractional part of the number.\n */\nexport const getLeadingZeroCount = (num: number | string) => {\n const numToString = new BigNumber(num, 10).toString(10);\n const fractionalPart = numToString.split('.')[1] ?? '';\n return fractionalPart.match(/^0*/u)?.[0]?.length || 0;\n};\n\n/**\n * This formats a number using Intl\n * It abbreviates large numbers (using K, M, B, T)\n * And abbreviates small numbers in 2 ways:\n * - Will format to the given number of decimal places\n * - Will format up to 4 decimal places\n * - Will ellipse the number if longer than given decimal places\n *\n * @param numericAmount - The number to format\n * @param opts - The options to use when formatting\n * @returns The formatted number\n */\nexport const formatAmount = (numericAmount: number, opts?: FormatOptions) => {\n // create options with defaults\n const options = { ...defaultFormatOptions, ...opts };\n\n const leadingZeros = getLeadingZeroCount(numericAmount);\n const isDecimal = numericAmount.toString().includes('.') || leadingZeros > 0;\n const isLargeNumber = numericAmount > 999;\n\n const handleShouldEllipse = (decimalPlaces: number) =>\n Boolean(options?.shouldEllipse) && leadingZeros >= decimalPlaces;\n\n if (isLargeNumber) {\n return Intl.NumberFormat('en-US', {\n notation: 'compact',\n compactDisplay: 'short',\n maximumFractionDigits: 2,\n }).format(numericAmount);\n }\n\n if (isDecimal) {\n const ellipse = handleShouldEllipse(options.decimalPlaces);\n const formattedValue = Intl.NumberFormat('en-US', {\n minimumFractionDigits: ellipse ? options.decimalPlaces : undefined,\n maximumFractionDigits: options.decimalPlaces,\n }).format(numericAmount);\n\n return ellipse ? `${formattedValue}...` : formattedValue;\n }\n\n // Default to showing the raw amount\n return numericAmount.toString();\n};\n\nexport const getAmount = (\n amount: string,\n decimals: string,\n options?: FormatOptions,\n) => {\n if (!amount || !decimals) {\n return '';\n }\n\n const numericAmount = calcTokenAmount(\n amount,\n parseFloat(decimals),\n ).toNumber();\n\n return formatAmount(numericAmount, options);\n};\n"]}
@@ -0,0 +1,91 @@
1
+ import {
2
+ processFeatureAnnouncement
3
+ } from "./chunk-D42BBXBM.mjs";
4
+
5
+ // src/NotificationServicesController/services/feature-announcements.ts
6
+ import { documentToHtmlString } from "@contentful/rich-text-html-renderer";
7
+ import log from "loglevel";
8
+ var DEFAULT_SPACE_ID = ":space_id";
9
+ var DEFAULT_ACCESS_TOKEN = ":access_token";
10
+ var DEFAULT_CLIENT_ID = ":client_id";
11
+ var FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;
12
+ var FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;
13
+ var fetchFromContentful = async (url, retries = 3, retryDelay = 1e3) => {
14
+ let lastError = null;
15
+ for (let i = 0; i < retries; i++) {
16
+ try {
17
+ const response = await fetch(url);
18
+ if (!response.ok) {
19
+ throw new Error(`Fetch failed with status: ${response.status}`);
20
+ }
21
+ return await response.json();
22
+ } catch (error) {
23
+ if (error instanceof Error) {
24
+ lastError = error;
25
+ }
26
+ if (i < retries - 1) {
27
+ await new Promise((resolve) => setTimeout(resolve, retryDelay));
28
+ }
29
+ }
30
+ }
31
+ log.error(
32
+ `Error fetching from Contentful after ${retries} retries:`,
33
+ lastError
34
+ );
35
+ return null;
36
+ };
37
+ var fetchFeatureAnnouncementNotifications = async (env) => {
38
+ const url = FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId).replace(DEFAULT_ACCESS_TOKEN, env.accessToken).replace(DEFAULT_CLIENT_ID, env.platform);
39
+ const data = await fetchFromContentful(url);
40
+ if (!data) {
41
+ return [];
42
+ }
43
+ const findIncludedItem = (sysId) => {
44
+ const item = data?.includes?.Entry?.find((i) => i?.sys?.id === sysId) || data?.includes?.Asset?.find((i) => i?.sys?.id === sysId);
45
+ return item ? item?.fields : null;
46
+ };
47
+ const contentfulNotifications = data?.items ?? [];
48
+ const rawNotifications = contentfulNotifications.map((n) => {
49
+ const { fields } = n;
50
+ const imageFields = fields.image ? findIncludedItem(fields.image.sys.id) : void 0;
51
+ const extensionLinkFields = fields.extensionLink ? findIncludedItem(
52
+ fields.extensionLink.sys.id
53
+ ) : void 0;
54
+ const notification = {
55
+ type: "features_announcement" /* FEATURES_ANNOUNCEMENT */,
56
+ createdAt: new Date(n.sys.createdAt).toString(),
57
+ data: {
58
+ id: fields.id,
59
+ category: fields.category,
60
+ title: fields.title,
61
+ longDescription: documentToHtmlString(fields.longDescription),
62
+ shortDescription: fields.shortDescription,
63
+ image: {
64
+ title: imageFields?.title,
65
+ description: imageFields?.description,
66
+ url: imageFields?.file?.url ?? ""
67
+ },
68
+ extensionLink: extensionLinkFields && {
69
+ extensionLinkText: extensionLinkFields?.extensionLinkText,
70
+ extensionLinkRoute: extensionLinkFields?.extensionLinkRoute
71
+ }
72
+ }
73
+ };
74
+ return notification;
75
+ });
76
+ return rawNotifications;
77
+ };
78
+ async function getFeatureAnnouncementNotifications(env) {
79
+ const rawNotifications = await fetchFeatureAnnouncementNotifications(env);
80
+ const notifications = rawNotifications.map(
81
+ (notification) => processFeatureAnnouncement(notification)
82
+ );
83
+ return notifications;
84
+ }
85
+
86
+ export {
87
+ FEATURE_ANNOUNCEMENT_API,
88
+ FEATURE_ANNOUNCEMENT_URL,
89
+ getFeatureAnnouncementNotifications
90
+ };
91
+ //# sourceMappingURL=chunk-EQWVJX6K.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesController/services/feature-announcements.ts"],"sourcesContent":["import { documentToHtmlString } from '@contentful/rich-text-html-renderer';\nimport type { Entry, Asset } from 'contentful';\nimport log from 'loglevel';\n\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport { processFeatureAnnouncement } from '../processors/process-feature-announcement';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n ImageFields,\n TypeFeatureAnnouncement,\n} from '../types/feature-announcement/type-feature-announcement';\nimport type { TypeExtensionLinkFields } from '../types/feature-announcement/type-links';\nimport type { INotification } from '../types/notification/notification';\n\nconst DEFAULT_SPACE_ID = ':space_id';\nconst DEFAULT_ACCESS_TOKEN = ':access_token';\nconst DEFAULT_CLIENT_ID = ':client_id';\nexport const FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;\nexport const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;\n\ntype Env = {\n spaceId: string;\n accessToken: string;\n platform: string;\n};\n\n/**\n * Contentful API Response Shape\n */\nexport type ContentfulResult = {\n includes?: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Entry?: Entry[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Asset?: Asset[];\n };\n items?: TypeFeatureAnnouncement[];\n};\n\nconst fetchFromContentful = async (\n url: string,\n retries = 3,\n retryDelay = 1000,\n): Promise<ContentfulResult | null> => {\n let lastError: Error | null = null;\n\n for (let i = 0; i < retries; i++) {\n try {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Fetch failed with status: ${response.status}`);\n }\n return await response.json();\n } catch (error) {\n if (error instanceof Error) {\n lastError = error;\n }\n if (i < retries - 1) {\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n }\n }\n }\n\n log.error(\n `Error fetching from Contentful after ${retries} retries:`,\n lastError,\n );\n return null;\n};\n\nconst fetchFeatureAnnouncementNotifications = async (\n env: Env,\n): Promise<FeatureAnnouncementRawNotification[]> => {\n const url = FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)\n .replace(DEFAULT_ACCESS_TOKEN, env.accessToken)\n .replace(DEFAULT_CLIENT_ID, env.platform);\n const data = await fetchFromContentful(url);\n\n if (!data) {\n return [];\n }\n\n const findIncludedItem = (sysId: string) => {\n const item =\n data?.includes?.Entry?.find((i: Entry) => i?.sys?.id === sysId) ||\n data?.includes?.Asset?.find((i: Asset) => i?.sys?.id === sysId);\n return item ? item?.fields : null;\n };\n\n const contentfulNotifications = data?.items ?? [];\n const rawNotifications: FeatureAnnouncementRawNotification[] =\n contentfulNotifications.map((n: TypeFeatureAnnouncement) => {\n const { fields } = n;\n const imageFields = fields.image\n ? (findIncludedItem(fields.image.sys.id) as ImageFields['fields'])\n : undefined;\n const extensionLinkFields = fields.extensionLink\n ? (findIncludedItem(\n fields.extensionLink.sys.id,\n ) as TypeExtensionLinkFields['fields'])\n : undefined;\n\n const notification: FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: new Date(n.sys.createdAt).toString(),\n data: {\n id: fields.id,\n category: fields.category,\n title: fields.title,\n longDescription: documentToHtmlString(fields.longDescription),\n shortDescription: fields.shortDescription,\n image: {\n title: imageFields?.title,\n description: imageFields?.description,\n url: imageFields?.file?.url ?? '',\n },\n extensionLink: extensionLinkFields && {\n extensionLinkText: extensionLinkFields?.extensionLinkText,\n extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,\n },\n },\n };\n\n return notification;\n });\n\n return rawNotifications;\n};\n\n/**\n * Gets Feature Announcement from our services\n * @param env - environment for feature announcements\n * @returns Raw Feature Announcements\n */\nexport async function getFeatureAnnouncementNotifications(\n env: Env,\n): Promise<INotification[]> {\n const rawNotifications = await fetchFeatureAnnouncementNotifications(env);\n const notifications = rawNotifications.map((notification) =>\n processFeatureAnnouncement(notification),\n );\n\n return notifications;\n}\n"],"mappings":";;;;;AAAA,SAAS,4BAA4B;AAErC,OAAO,SAAS;AAYhB,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAC7B,IAAM,oBAAoB;AACnB,IAAM,2BAA2B,qCAAqC,gBAAgB;AACtF,IAAM,2BAA2B,GAAG,wBAAwB,iBAAiB,oBAAoB,+DAA+D,iBAAiB;AAqBxL,IAAM,sBAAsB,OAC1B,KACA,UAAU,GACV,aAAa,QACwB;AACrC,MAAI,YAA0B;AAE9B,WAAS,IAAI,GAAG,IAAI,SAAS,KAAK;AAChC,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,IAAI,MAAM,6BAA6B,SAAS,MAAM,EAAE;AAAA,MAChE;AACA,aAAO,MAAM,SAAS,KAAK;AAAA,IAC7B,SAAS,OAAO;AACd,UAAI,iBAAiB,OAAO;AAC1B,oBAAY;AAAA,MACd;AACA,UAAI,IAAI,UAAU,GAAG;AACnB,cAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,UAAU,CAAC;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAEA,MAAI;AAAA,IACF,wCAAwC,OAAO;AAAA,IAC/C;AAAA,EACF;AACA,SAAO;AACT;AAEA,IAAM,wCAAwC,OAC5C,QACkD;AAClD,QAAM,MAAM,yBAAyB,QAAQ,kBAAkB,IAAI,OAAO,EACvE,QAAQ,sBAAsB,IAAI,WAAW,EAC7C,QAAQ,mBAAmB,IAAI,QAAQ;AAC1C,QAAM,OAAO,MAAM,oBAAoB,GAAG;AAE1C,MAAI,CAAC,MAAM;AACT,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,mBAAmB,CAAC,UAAkB;AAC1C,UAAM,OACJ,MAAM,UAAU,OAAO,KAAK,CAAC,MAAa,GAAG,KAAK,OAAO,KAAK,KAC9D,MAAM,UAAU,OAAO,KAAK,CAAC,MAAa,GAAG,KAAK,OAAO,KAAK;AAChE,WAAO,OAAO,MAAM,SAAS;AAAA,EAC/B;AAEA,QAAM,0BAA0B,MAAM,SAAS,CAAC;AAChD,QAAM,mBACJ,wBAAwB,IAAI,CAAC,MAA+B;AAC1D,UAAM,EAAE,OAAO,IAAI;AACnB,UAAM,cAAc,OAAO,QACtB,iBAAiB,OAAO,MAAM,IAAI,EAAE,IACrC;AACJ,UAAM,sBAAsB,OAAO,gBAC9B;AAAA,MACC,OAAO,cAAc,IAAI;AAAA,IAC3B,IACA;AAEJ,UAAM,eAAmD;AAAA,MACvD;AAAA,MACA,WAAW,IAAI,KAAK,EAAE,IAAI,SAAS,EAAE,SAAS;AAAA,MAC9C,MAAM;AAAA,QACJ,IAAI,OAAO;AAAA,QACX,UAAU,OAAO;AAAA,QACjB,OAAO,OAAO;AAAA,QACd,iBAAiB,qBAAqB,OAAO,eAAe;AAAA,QAC5D,kBAAkB,OAAO;AAAA,QACzB,OAAO;AAAA,UACL,OAAO,aAAa;AAAA,UACpB,aAAa,aAAa;AAAA,UAC1B,KAAK,aAAa,MAAM,OAAO;AAAA,QACjC;AAAA,QACA,eAAe,uBAAuB;AAAA,UACpC,mBAAmB,qBAAqB;AAAA,UACxC,oBAAoB,qBAAqB;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT,CAAC;AAEH,SAAO;AACT;AAOA,eAAsB,oCACpB,KAC0B;AAC1B,QAAM,mBAAmB,MAAM,sCAAsC,GAAG;AACxE,QAAM,gBAAgB,iBAAiB;AAAA,IAAI,CAAC,iBAC1C,2BAA2B,YAAY;AAAA,EACzC;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkPGMXFZ6Yjs = require('./chunk-PGMXFZ6Y.js');
6
+
7
+
8
+
9
+
10
+
11
+ var _chunkEJ52BDLBjs = require('./chunk-EJ52BDLB.js');
12
+
13
+
14
+ var _chunkV46WVGWNjs = require('./chunk-V46WVGWN.js');
15
+
16
+ // src/NotificationServicesPushController/utils/index.ts
17
+ var utils_exports = {};
18
+ _chunkV46WVGWNjs.__export.call(void 0, utils_exports, {
19
+ calcTokenAmount: () => _chunkEJ52BDLBjs.calcTokenAmount,
20
+ createOnChainPushNotificationMessage: () => _chunkPGMXFZ6Yjs.createOnChainPushNotificationMessage,
21
+ createOnChainPushNotificationMessages: () => _chunkPGMXFZ6Yjs.createOnChainPushNotificationMessages,
22
+ formatAmount: () => _chunkEJ52BDLBjs.formatAmount,
23
+ getAmount: () => _chunkEJ52BDLBjs.getAmount,
24
+ getLeadingZeroCount: () => _chunkEJ52BDLBjs.getLeadingZeroCount,
25
+ isOnChainNotification: () => _chunkPGMXFZ6Yjs.isOnChainNotification
26
+ });
27
+
28
+
29
+
30
+ exports.utils_exports = utils_exports;
31
+ //# sourceMappingURL=chunk-FFQNSBPU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesPushController/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './get-notification-data';\nexport * from './get-notification-message';\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-G52DNXFH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=chunk-GETQWOTI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkLYEXYTOIjs = require('./chunk-LYEXYTOI.js');
4
+
5
+
6
+
7
+ var _chunk52CALMRAjs = require('./chunk-52CALMRA.js');
8
+
9
+
10
+ var _chunkDY4ELDRQjs = require('./chunk-DY4ELDRQ.js');
11
+
12
+ // src/NotificationServicesController/processors/process-notifications.ts
13
+ var isOnChainNotification = (n) => Object.values(_chunkDY4ELDRQjs.TRIGGER_TYPES).includes(n.type);
14
+ var isFeatureAnnouncement = (n) => n.type === "features_announcement" /* FEATURES_ANNOUNCEMENT */;
15
+ function processNotification(notification, readNotifications = []) {
16
+ const exhaustedAllCases = (_) => {
17
+ const type = notification?.type;
18
+ throw new Error(`No processor found for notification kind ${type}`);
19
+ };
20
+ if (isFeatureAnnouncement(notification)) {
21
+ const n = _chunk52CALMRAjs.processFeatureAnnouncement.call(void 0,
22
+ notification
23
+ );
24
+ n.isRead = _chunk52CALMRAjs.isFeatureAnnouncementRead.call(void 0, n, readNotifications);
25
+ return n;
26
+ }
27
+ if (isOnChainNotification(notification)) {
28
+ return _chunkLYEXYTOIjs.processOnChainNotification.call(void 0, notification);
29
+ }
30
+ return exhaustedAllCases(notification);
31
+ }
32
+ function safeProcessNotification(notification, readNotifications = []) {
33
+ try {
34
+ const processedNotification = processNotification(
35
+ notification,
36
+ readNotifications
37
+ );
38
+ return processedNotification;
39
+ } catch {
40
+ return void 0;
41
+ }
42
+ }
43
+
44
+
45
+
46
+
47
+ exports.processNotification = processNotification; exports.safeProcessNotification = safeProcessNotification;
48
+ //# sourceMappingURL=chunk-GFAESVZA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesController/processors/process-notifications.ts"],"names":[],"mappings":";;;;;;;;;;;;AAaA,IAAM,wBAAwB,CAC5B,MACgC,OAAO,OAAO,aAAa,EAAE,SAAS,EAAE,IAAI;AAE9E,IAAM,wBAAwB,CAC5B,MAEA,EAAE;AAUG,SAAS,oBACd,cACA,oBAA8B,CAAC,GAChB;AACf,QAAM,oBAAoB,CAAC,MAAa;AACtC,UAAM,OAAe,cAAc;AACnC,UAAM,IAAI,MAAM,4CAA4C,IAAI,EAAE;AAAA,EACpE;AAEA,MAAI,sBAAsB,YAAY,GAAG;AACvC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACA,MAAE,SAAS,0BAA0B,GAAG,iBAAiB;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,sBAAsB,YAAY,GAAG;AACvC,WAAO,2BAA2B,YAAsC;AAAA,EAC1E;AAEA,SAAO,kBAAkB,YAAqB;AAChD;AASO,SAAS,wBACd,cACA,oBAA8B,CAAC,GACJ;AAC3B,MAAI;AACF,UAAM,wBAAwB;AAAA,MAC5B;AAAA,MACA;AAAA,IACF;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF","sourcesContent":["import { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n INotification,\n NotificationUnion,\n} from '../types/notification/notification';\nimport type { OnChainRawNotification } from '../types/on-chain-notification/on-chain-notification';\nimport {\n isFeatureAnnouncementRead,\n processFeatureAnnouncement,\n} from './process-feature-announcement';\nimport { processOnChainNotification } from './process-onchain-notifications';\n\nconst isOnChainNotification = (\n n: NotificationUnion,\n): n is OnChainRawNotification => Object.values(TRIGGER_TYPES).includes(n.type);\n\nconst isFeatureAnnouncement = (\n n: NotificationUnion,\n): n is FeatureAnnouncementRawNotification =>\n n.type === TRIGGER_TYPES.FEATURES_ANNOUNCEMENT;\n\n/**\n * Process feature announcement and wallet notifications into a shared/normalised notification shape.\n * We can still differentiate notifications by the `type` property\n *\n * @param notification - a feature announcement or on chain notification\n * @param readNotifications - all read notifications currently\n * @returns a processed notification\n */\nexport function processNotification(\n notification: NotificationUnion,\n readNotifications: string[] = [],\n): INotification {\n const exhaustedAllCases = (_: never) => {\n const type: string = notification?.type;\n throw new Error(`No processor found for notification kind ${type}`);\n };\n\n if (isFeatureAnnouncement(notification)) {\n const n = processFeatureAnnouncement(\n notification as FeatureAnnouncementRawNotification,\n );\n n.isRead = isFeatureAnnouncementRead(n, readNotifications);\n return n;\n }\n\n if (isOnChainNotification(notification)) {\n return processOnChainNotification(notification as OnChainRawNotification);\n }\n\n return exhaustedAllCases(notification as never);\n}\n\n/**\n * Safe version of processing a notification. Rather than throwing an error if failed to process, it will return the Notification or undefined\n *\n * @param notification - notification to processes\n * @param readNotifications - all read notifications currently\n * @returns a process notification or undefined if failed to process\n */\nexport function safeProcessNotification(\n notification: NotificationUnion,\n readNotifications: string[] = [],\n): INotification | undefined {\n try {\n const processedNotification = processNotification(\n notification,\n readNotifications,\n );\n return processedNotification;\n } catch {\n return undefined;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=chunk-HPUQYDVC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-IDO4JFV5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,8 @@
1
+ // src/NotificationServicesPushController/services/endpoints.ts
2
+ var url = "https://push.api.cx.metamask.io";
3
+ var REGISTRATION_TOKENS_ENDPOINT = `${url}/v1/link`;
4
+
5
+ export {
6
+ REGISTRATION_TOKENS_ENDPOINT
7
+ };
8
+ //# sourceMappingURL=chunk-IKWNHNJQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesPushController/services/endpoints.ts"],"sourcesContent":["const url = 'https://push.api.cx.metamask.io';\nexport const REGISTRATION_TOKENS_ENDPOINT = `${url}/v1/link`;\n"],"mappings":";AAAA,IAAM,MAAM;AACL,IAAM,+BAA+B,GAAG,GAAG;","names":[]}
@@ -0,0 +1,7 @@
1
+ // src/NotificationServicesPushController/types/index.ts
2
+ var types_exports = {};
3
+
4
+ export {
5
+ types_exports
6
+ };
7
+ //# sourceMappingURL=chunk-IOMDG67D.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesPushController/types/index.ts"],"sourcesContent":["export * from './firebase';\n"],"mappings":";AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=chunk-IPI7BAW3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import {
2
+ createOnChainPushNotificationMessage,
3
+ createOnChainPushNotificationMessages,
4
+ isOnChainNotification
5
+ } from "./chunk-SSWX2N73.mjs";
6
+ import {
7
+ calcTokenAmount,
8
+ formatAmount,
9
+ getAmount,
10
+ getLeadingZeroCount
11
+ } from "./chunk-ODI2BTKS.mjs";
12
+ import {
13
+ __export
14
+ } from "./chunk-26CCETCM.mjs";
15
+
16
+ // src/NotificationServicesPushController/utils/index.ts
17
+ var utils_exports = {};
18
+ __export(utils_exports, {
19
+ calcTokenAmount: () => calcTokenAmount,
20
+ createOnChainPushNotificationMessage: () => createOnChainPushNotificationMessage,
21
+ createOnChainPushNotificationMessages: () => createOnChainPushNotificationMessages,
22
+ formatAmount: () => formatAmount,
23
+ getAmount: () => getAmount,
24
+ getLeadingZeroCount: () => getLeadingZeroCount,
25
+ isOnChainNotification: () => isOnChainNotification
26
+ });
27
+
28
+ export {
29
+ utils_exports
30
+ };
31
+ //# sourceMappingURL=chunk-JLHFZ2UG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NotificationServicesPushController/utils/index.ts"],"sourcesContent":["export * from './get-notification-data';\nexport * from './get-notification-message';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-JQ7WKFCI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}