@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 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/NotificationServicesController/types/user-storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from '../../constants/constants';
2
+ import type { SUPPORTED_CHAINS, TRIGGER_TYPES } from '../../constants/notification-schema';
3
+ export type UserStorage = {
4
+ /**
5
+ * The Version 'v' of the User Storage.
6
+ * NOTE - will allow us to support upgrade/downgrades in the future
7
+ */
8
+ [USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;
9
+ [address: string]: {
10
+ [chain in (typeof SUPPORTED_CHAINS)[number]]: {
11
+ [uuid: string]: {
12
+ /** Trigger Kind 'k' */
13
+ k: TRIGGER_TYPES;
14
+ /**
15
+ * Trigger Enabled 'e'
16
+ * This is mostly an 'acknowledgement' to determine if a trigger has been made
17
+ * For example if we fail to create a trigger, we can set to false & retry (on re-log in, or elsewhere)
18
+ *
19
+ * Most of the time this is 'true', as triggers when deleted are also removed from User Storage
20
+ */
21
+ e: boolean;
22
+ };
23
+ };
24
+ };
25
+ };
26
+ //# sourceMappingURL=user-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-storage.d.ts","sourceRoot":"","sources":["../../../../../src/NotificationServicesController/types/user-storage/user-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,qCAAqC,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,CAAC,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACxD,CAAC,OAAO,EAAE,MAAM,GAAG;SAChB,KAAK,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,GAAG;YAC5C,CAAC,IAAI,EAAE,MAAM,GAAG;gBACd,uBAAuB;gBACvB,CAAC,EAAE,aAAa,CAAC;gBACjB;;;;;;mBAMG;gBACH,CAAC,EAAE,OAAO,CAAC;aACZ,CAAC;SACH;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,144 @@
1
+ import type { TRIGGER_TYPES } from '../constants/notification-schema';
2
+ import type { UserStorage } from '../types/user-storage/user-storage';
3
+ export type NotificationTrigger = {
4
+ id: string;
5
+ chainId: string;
6
+ kind: string;
7
+ address: string;
8
+ enabled: boolean;
9
+ };
10
+ type MapTriggerFn<Result> = (trigger: NotificationTrigger) => Result | undefined;
11
+ type TraverseTriggerOpts<Result> = {
12
+ address?: string;
13
+ mapTrigger?: MapTriggerFn<Result>;
14
+ };
15
+ /**
16
+ * Create a completely new user storage object with the given accounts and state.
17
+ * This method initializes the user storage with a version key and iterates over each account to populate it with triggers.
18
+ * Each trigger is associated with supported chains, and for each chain, a unique identifier (UUID) is generated.
19
+ * The trigger object contains a kind (`k`) indicating the type of trigger and an enabled state (`e`).
20
+ * The kind and enabled state are stored with abbreviated keys to reduce the JSON size.
21
+ *
22
+ * This is used primarily for creating a new user storage (e.g. when first signing in/enabling notification profile syncing),
23
+ * caution is needed in case you need to remove triggers that you don't want (due to notification setting filters)
24
+ *
25
+ * @param accounts - An array of account objects, each optionally containing an address.
26
+ * @param state - A boolean indicating the initial enabled state for all triggers in the user storage.
27
+ * @returns A `UserStorage` object populated with triggers for each account and chain.
28
+ */
29
+ export declare function initializeUserStorage(accounts: {
30
+ address?: string;
31
+ }[], state: boolean): UserStorage;
32
+ /**
33
+ * Iterates over user storage to find and optionally transform notification triggers.
34
+ * This method allows for flexible retrieval and transformation of triggers based on provided options.
35
+ *
36
+ * @param userStorage - The user storage object containing notification triggers.
37
+ * @param options - Optional parameters to filter and map triggers:
38
+ * - `address`: If provided, only triggers for this address are considered.
39
+ * - `mapTrigger`: A function to transform each trigger. If not provided, triggers are returned as is.
40
+ * @returns An array of triggers, potentially transformed by the `mapTrigger` function.
41
+ */
42
+ export declare function traverseUserStorageTriggers<ResultTriggers = NotificationTrigger>(userStorage: UserStorage, options?: TraverseTriggerOpts<ResultTriggers>): ResultTriggers[];
43
+ /**
44
+ * Verifies the presence of specified accounts and their chains in the user storage.
45
+ * This method checks if each provided account exists in the user storage and if all its supported chains are present.
46
+ *
47
+ * @param userStorage - The user storage object containing notification triggers.
48
+ * @param accounts - An array of account addresses to check for presence.
49
+ * @returns A record where each key is an account address and each value is a boolean indicating whether the account and all its supported chains are present in the user storage.
50
+ */
51
+ export declare function checkAccountsPresence(userStorage: UserStorage, accounts: string[]): Record<string, boolean>;
52
+ /**
53
+ * Infers and returns an array of enabled notification trigger kinds from the user storage.
54
+ * This method counts the occurrences of each kind of trigger and returns the kinds that are present.
55
+ *
56
+ * @param userStorage - The user storage object containing notification triggers.
57
+ * @returns An array of trigger kinds (`TRIGGER_TYPES`) that are enabled in the user storage.
58
+ */
59
+ export declare function inferEnabledKinds(userStorage: UserStorage): TRIGGER_TYPES[];
60
+ /**
61
+ * Retrieves all UUIDs associated with a specific account address from the user storage.
62
+ * This function utilizes `traverseUserStorageTriggers` with a mapping function to extract
63
+ * just the UUIDs of the notification triggers for the given address.
64
+ *
65
+ * @param userStorage - The user storage object containing notification triggers.
66
+ * @param address - The specific account address to retrieve UUIDs for.
67
+ * @returns An array of UUID strings associated with the given account address.
68
+ */
69
+ export declare function getUUIDsForAccount(userStorage: UserStorage, address: string): string[];
70
+ /**
71
+ * Retrieves all UUIDs from the user storage, regardless of the account address or chain ID.
72
+ * This method leverages `traverseUserStorageTriggers` with a specific mapping function (`triggerToId`)
73
+ * to extract only the UUIDs from all notification triggers present in the user storage.
74
+ *
75
+ * @param userStorage - The user storage object containing notification triggers.
76
+ * @returns An array of UUID strings from all notification triggers in the user storage.
77
+ */
78
+ export declare function getAllUUIDs(userStorage: UserStorage): string[];
79
+ /**
80
+ * Retrieves UUIDs for notification triggers that match any of the specified kinds.
81
+ * This method filters triggers based on their kind and returns an array of UUIDs for those that match the allowed kinds.
82
+ * It utilizes `traverseUserStorageTriggers` with a custom mapping function that checks if a trigger's kind is in the allowed list.
83
+ *
84
+ * @param userStorage - The user storage object containing notification triggers.
85
+ * @param allowedKinds - An array of kinds (as strings) to filter the triggers by.
86
+ * @returns An array of UUID strings for triggers that match the allowed kinds.
87
+ */
88
+ export declare function getUUIDsForKinds(userStorage: UserStorage, allowedKinds: string[]): string[];
89
+ /**
90
+ * Retrieves notification triggers for a specific account address that match any of the specified kinds.
91
+ * This method filters triggers both by the account address and their kind, returning triggers that match the allowed kinds for the specified address.
92
+ * It leverages `traverseUserStorageTriggers` with a custom mapping function to filter and return only the relevant triggers.
93
+ *
94
+ * @param userStorage - The user storage object containing notification triggers.
95
+ * @param address - The specific account address for which to retrieve triggers.
96
+ * @param allowedKinds - An array of trigger kinds (`TRIGGER_TYPES`) to filter the triggers by.
97
+ * @returns An array of `NotificationTrigger` objects that match the allowed kinds for the specified account address.
98
+ */
99
+ export declare function getUUIDsForAccountByKinds(userStorage: UserStorage, address: string, allowedKinds: TRIGGER_TYPES[]): NotificationTrigger[];
100
+ /**
101
+ * Upserts (updates or inserts) notification triggers for a given account across all supported chains.
102
+ * This method ensures that each supported trigger type exists for each chain associated with the account.
103
+ * If a trigger type does not exist for a chain, it creates a new trigger with a unique UUID.
104
+ *
105
+ * @param _account - The account address for which to upsert triggers. The address is normalized to lowercase.
106
+ * @param userStorage - The user storage object to be updated with new or existing triggers.
107
+ * @returns The updated user storage object with upserted triggers for the specified account.
108
+ */
109
+ export declare function upsertAddressTriggers(_account: string, userStorage: UserStorage): UserStorage;
110
+ /**
111
+ * Upserts (updates or inserts) notification triggers of a specific type across all accounts and chains in user storage.
112
+ * This method ensures that a trigger of the specified type exists for each account and chain. If a trigger of the specified type
113
+ * does not exist for an account and chain, it creates a new trigger with a unique UUID.
114
+ *
115
+ * @param triggerType - The type of trigger to upsert across all accounts and chains.
116
+ * @param userStorage - The user storage object to be updated with new or existing triggers of the specified type.
117
+ * @returns The updated user storage object with upserted triggers of the specified type for all accounts and chains.
118
+ */
119
+ export declare function upsertTriggerTypeTriggers(triggerType: TRIGGER_TYPES, userStorage: UserStorage): UserStorage;
120
+ /**
121
+ * Toggles the enabled status of a user storage trigger.
122
+ *
123
+ * @param userStorage - The user storage object.
124
+ * @param address - The user's address.
125
+ * @param chainId - The chain ID.
126
+ * @param uuid - The unique identifier for the trigger.
127
+ * @param enabled - The new enabled status.
128
+ * @returns The updated user storage object.
129
+ */
130
+ export declare function toggleUserStorageTriggerStatus(userStorage: UserStorage, address: string, chainId: string, uuid: string, enabled: boolean): UserStorage;
131
+ /**
132
+ * Performs an API call with automatic retries on failure.
133
+ *
134
+ * @param bearerToken - The JSON Web Token for authorization.
135
+ * @param endpoint - The URL of the API endpoint to call.
136
+ * @param method - The HTTP method ('POST' or 'DELETE').
137
+ * @param body - The body of the request. It should be an object that can be serialized to JSON.
138
+ * @param retries - The number of retry attempts in case of failure (default is 3).
139
+ * @param retryDelay - The delay between retries in milliseconds (default is 1000).
140
+ * @returns A Promise that resolves to the response of the fetch request.
141
+ */
142
+ export declare function makeApiCall<Body>(bearerToken: string, endpoint: string, method: 'POST' | 'DELETE', body: Body, retries?: number, retryDelay?: number): Promise<Response>;
143
+ export {};
144
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesController/utils/utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,YAAY,CAAC,MAAM,IAAI,CAC1B,OAAO,EAAE,mBAAmB,KACzB,MAAM,GAAG,SAAS,CAAC;AAExB,KAAK,mBAAmB,CAAC,MAAM,IAAI;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CACnC,CAAC;AAuBF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAChC,KAAK,EAAE,OAAO,GACb,WAAW,CA+Bb;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,cAAc,GAAG,mBAAmB,EAEpC,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC,GAC5C,cAAc,EAAE,CAkClB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AA+CD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,aAAa,EAAE,CAU3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAKV;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CAI9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE,CAMV;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,aAAa,EAAE,GAC5B,mBAAmB,EAAE,CAWvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,GACvB,WAAW,CA8Bb;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,aAAa,EAC1B,WAAW,EAAE,WAAW,GACvB,WAAW,CA0Bb;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GACf,WAAW,CAMb;AA2CD;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,IAAI,EACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,QAAQ,EACzB,IAAI,EAAE,IAAI,EACV,OAAO,SAAI,EACX,UAAU,SAAO,GAChB,OAAO,CAAC,QAAQ,CAAC,CAWnB"}
@@ -0,0 +1,103 @@
1
+ import type { RestrictedControllerMessenger, ControllerGetStateAction } from '@metamask/base-controller';
2
+ import { BaseController } from '@metamask/base-controller';
3
+ import type { AuthenticationController } from '@metamask/profile-sync-controller';
4
+ import type { Types } from '../NotificationServicesController';
5
+ import type { PushNotificationEnv } from './types';
6
+ declare const controllerName = "NotificationServicesPushController";
7
+ export type NotificationServicesPushControllerState = {
8
+ fcmToken: string;
9
+ };
10
+ export type NotificationServicesPushControllerEnablePushNotificationsAction = {
11
+ type: `${typeof controllerName}:enablePushNotifications`;
12
+ handler: NotificationServicesPushController['enablePushNotifications'];
13
+ };
14
+ export type NotificationServicesPushControllerDisablePushNotificationsAction = {
15
+ type: `${typeof controllerName}:disablePushNotifications`;
16
+ handler: NotificationServicesPushController['disablePushNotifications'];
17
+ };
18
+ export type NotificationServicesPushControllerUpdateTriggerPushNotificationsAction = {
19
+ type: `${typeof controllerName}:updateTriggerPushNotifications`;
20
+ handler: NotificationServicesPushController['updateTriggerPushNotifications'];
21
+ };
22
+ export type Actions = NotificationServicesPushControllerEnablePushNotificationsAction | NotificationServicesPushControllerDisablePushNotificationsAction | NotificationServicesPushControllerUpdateTriggerPushNotificationsAction | ControllerGetStateAction<'state', NotificationServicesPushControllerState>;
23
+ export type AllowedActions = AuthenticationController.AuthenticationControllerGetBearerToken;
24
+ export type NotificationServicesPushControllerOnNewNotificationEvent = {
25
+ type: `${typeof controllerName}:onNewNotifications`;
26
+ payload: [Types.INotification];
27
+ };
28
+ export type NotificationServicesPushControllerPushNotificationClicked = {
29
+ type: `${typeof controllerName}:pushNotificationClicked`;
30
+ payload: [Types.INotification];
31
+ };
32
+ export type AllowedEvents = NotificationServicesPushControllerOnNewNotificationEvent | NotificationServicesPushControllerPushNotificationClicked;
33
+ export type NotificationServicesPushControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
34
+ type ControllerConfig = {
35
+ /**
36
+ * Config to turn on/off push notifications.
37
+ * This is currently linked to MV3 builds on extension.
38
+ */
39
+ isPushEnabled: boolean;
40
+ /**
41
+ * Must handle when a push notification is received.
42
+ * You must call `registration.showNotification` or equivalent to show the notification on web/mobile
43
+ */
44
+ onPushNotificationReceived: (notification: Types.INotification) => void | Promise<void>;
45
+ /**
46
+ * Must handle when a push notification is clicked.
47
+ * You must call `event.notification.close();` or equivalent for closing and opening notification in a new window.
48
+ */
49
+ onPushNotificationClicked: (event: NotificationEvent, notification?: Types.INotification) => void;
50
+ /**
51
+ * determine the config used for push notification services
52
+ */
53
+ platform: 'extension' | 'mobile';
54
+ };
55
+ /**
56
+ * Manages push notifications for the application, including enabling, disabling, and updating triggers for push notifications.
57
+ * This controller integrates with Firebase Cloud Messaging (FCM) to handle the registration and management of push notifications.
58
+ * It is responsible for registering and unregistering the service worker that listens for push notifications,
59
+ * managing the FCM token, and communicating with the server to register or unregister the device for push notifications.
60
+ * Additionally, it provides functionality to update the server with new UUIDs that should trigger push notifications.
61
+ *
62
+ * @augments {BaseController<typeof controllerName, NotificationServicesPushControllerState, NotificationServicesPushControllerMessenger>}
63
+ */
64
+ export declare class NotificationServicesPushController extends BaseController<typeof controllerName, NotificationServicesPushControllerState, NotificationServicesPushControllerMessenger> {
65
+ #private;
66
+ constructor({ messenger, state, env, config, }: {
67
+ messenger: NotificationServicesPushControllerMessenger;
68
+ state: NotificationServicesPushControllerState;
69
+ env: PushNotificationEnv;
70
+ config: ControllerConfig;
71
+ });
72
+ /**
73
+ * Enables push notifications for the application.
74
+ *
75
+ * This method sets up the necessary infrastructure for handling push notifications by:
76
+ * 1. Registering the service worker to listen for messages.
77
+ * 2. Fetching the Firebase Cloud Messaging (FCM) token from Firebase.
78
+ * 3. Sending the FCM token to the server responsible for sending notifications, to register the device.
79
+ *
80
+ * @param UUIDs - An array of UUIDs to enable push notifications for.
81
+ */
82
+ enablePushNotifications(UUIDs: string[]): Promise<void>;
83
+ /**
84
+ * Disables push notifications for the application.
85
+ * This method handles the process of disabling push notifications by:
86
+ * 1. Unregistering the service worker to stop listening for messages.
87
+ * 2. Sending a request to the server to unregister the device using the FCM token.
88
+ * 3. Removing the FCM token from the state to complete the process.
89
+ *
90
+ * @param UUIDs - An array of UUIDs for which push notifications should be disabled.
91
+ */
92
+ disablePushNotifications(UUIDs: string[]): Promise<void>;
93
+ /**
94
+ * Updates the triggers for push notifications.
95
+ * This method is responsible for updating the server with the new set of UUIDs that should trigger push notifications.
96
+ * It uses the current FCM token and a BearerToken for authentication.
97
+ *
98
+ * @param UUIDs - An array of UUIDs that should trigger push notifications.
99
+ */
100
+ updateTriggerPushNotifications(UUIDs: string[]): Promise<void>;
101
+ }
102
+ export {};
103
+ //# sourceMappingURL=NotificationServicesPushController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationServicesPushController.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/NotificationServicesPushController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGlF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAQ/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,QAAA,MAAM,cAAc,uCAAuC,CAAC;AAE5D,MAAM,MAAM,uCAAuC,GAAG;IACpD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,+DAA+D,GAAG;IAC5E,IAAI,EAAE,GAAG,OAAO,cAAc,0BAA0B,CAAC;IACzD,OAAO,EAAE,kCAAkC,CAAC,yBAAyB,CAAC,CAAC;CACxE,CAAC;AAEF,MAAM,MAAM,gEAAgE,GAAG;IAC7E,IAAI,EAAE,GAAG,OAAO,cAAc,2BAA2B,CAAC;IAC1D,OAAO,EAAE,kCAAkC,CAAC,0BAA0B,CAAC,CAAC;CACzE,CAAC;AACF,MAAM,MAAM,sEAAsE,GAChF;IACE,IAAI,EAAE,GAAG,OAAO,cAAc,iCAAiC,CAAC;IAChE,OAAO,EAAE,kCAAkC,CAAC,gCAAgC,CAAC,CAAC;CAC/E,CAAC;AAEJ,MAAM,MAAM,OAAO,GACf,+DAA+D,GAC/D,gEAAgE,GAChE,sEAAsE,GACtE,wBAAwB,CAAC,OAAO,EAAE,uCAAuC,CAAC,CAAC;AAE/E,MAAM,MAAM,cAAc,GACxB,wBAAwB,CAAC,sCAAsC,CAAC;AAElE,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,GAAG,OAAO,cAAc,qBAAqB,CAAC;IACpD,OAAO,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,GAAG,OAAO,cAAc,0BAA0B,CAAC;IACzD,OAAO,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB,wDAAwD,GACxD,yDAAyD,CAAC;AAE9D,MAAM,MAAM,2CAA2C,GACrD,6BAA6B,CAC3B,OAAO,cAAc,EACrB,OAAO,GAAG,cAAc,EACxB,aAAa,EACb,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC;AASJ,KAAK,gBAAgB,GAAG;IACtB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,0BAA0B,EAAE,CAC1B,YAAY,EAAE,KAAK,CAAC,aAAa,KAC9B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;OAGG;IACH,yBAAyB,EAAE,CACzB,KAAK,EAAE,iBAAiB,EACxB,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,KAC/B,IAAI,CAAC;IAEV;;OAEG;IACH,QAAQ,EAAE,WAAW,GAAG,QAAQ,CAAC;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,kCAAmC,SAAQ,cAAc,CACpE,OAAO,cAAc,EACrB,uCAAuC,EACvC,2CAA2C,CAC5C;;gBAOa,EACV,SAAS,EACT,KAAK,EACL,GAAG,EACH,MAAM,GACP,EAAE;QACD,SAAS,EAAE,2CAA2C,CAAC;QACvD,KAAK,EAAE,uCAAuC,CAAC;QAC/C,GAAG,EAAE,mBAAmB,CAAC;QACzB,MAAM,EAAE,gBAAgB,CAAC;KAC1B;IA6CD;;;;;;;;;OASG;IACG,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE;IAoD7C;;;;;;;;OAQG;IACG,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE;IAyC9C;;;;;;OAMG;IACG,8BAA8B,CAAC,KAAK,EAAE,MAAM,EAAE;CAgCrD"}
@@ -0,0 +1,3 @@
1
+ export * from './mockResponse';
2
+ export * from './mockServices';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesPushController/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { LinksResult } from '../services/services';
2
+ export declare const MOCK_REG_TOKEN = "REG_TOKEN";
3
+ export declare const MOCK_LINKS_RESPONSE: LinksResult;
4
+ export declare const getMockRetrievePushNotificationLinksResponse: () => {
5
+ url: string;
6
+ requestMethod: "GET";
7
+ response: LinksResult;
8
+ };
9
+ export declare const getMockUpdatePushNotificationLinksResponse: () => {
10
+ url: string;
11
+ requestMethod: "POST";
12
+ response: null;
13
+ };
14
+ export declare const MOCK_FCM_RESPONSE: {
15
+ name: string;
16
+ token: string;
17
+ web: {
18
+ endpoint: string;
19
+ p256dh: string;
20
+ auth: string;
21
+ applicationPubKey: string;
22
+ };
23
+ };
24
+ export declare const getMockCreateFCMRegistrationTokenResponse: () => {
25
+ url: RegExp;
26
+ requestMethod: "POST";
27
+ response: {
28
+ name: string;
29
+ token: string;
30
+ web: {
31
+ endpoint: string;
32
+ p256dh: string;
33
+ auth: string;
34
+ applicationPubKey: string;
35
+ };
36
+ };
37
+ };
38
+ export declare const getMockDeleteFCMRegistrationTokenResponse: () => {
39
+ url: RegExp;
40
+ requestMethod: "POST";
41
+ response: {};
42
+ };
43
+ //# sourceMappingURL=mockResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockResponse.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesPushController/__fixtures__/mockResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQxD,eAAO,MAAM,cAAc,cAAc,CAAC;AAC1C,eAAO,MAAM,mBAAmB,EAAE,WAQjC,CAAC;AAEF,eAAO,MAAM,4CAA4C;;;;CAMxD,CAAC;AAEF,eAAO,MAAM,0CAA0C;;;;CAMtD,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;CAS7B,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;CAMrD,CAAC;AAEF,eAAO,MAAM,yCAAyC;;;;CAMrD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import nock from 'nock';
2
+ type MockReply = {
3
+ status: nock.StatusCode;
4
+ body?: nock.Body;
5
+ };
6
+ export declare const mockEndpointGetPushNotificationLinks: (mockReply?: MockReply) => nock.Scope;
7
+ export declare const mockEndpointUpdatePushNotificationLinks: (mockReply?: MockReply) => nock.Scope;
8
+ export {};
9
+ //# sourceMappingURL=mockServices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockServices.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesPushController/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,oCAAoC,eAAgB,SAAS,eAYzE,CAAC;AAEF,eAAO,MAAM,uCAAuC,eACtC,SAAS,eAWtB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const ENABLE_MV3 = true;
2
+ export declare const PUSH_NOTIFICATIONS_SERVICE_URL = "https://push.api.cx.metamask.io";
3
+ export declare const FIREBASE_API_KEY = "";
4
+ export declare const FIREBASE_AUTH_DOMAIN = "";
5
+ export declare const FIREBASE_STORAGE_BUCKET = "";
6
+ export declare const FIREBASE_PROJECT_ID = "";
7
+ export declare const FIREBASE_MESSAGING_SENDER_ID = "";
8
+ export declare const FIREBASE_APP_ID = "";
9
+ export declare const FIREBASE_MEASUREMENT_ID = "";
10
+ export declare const VAPID_KEY = "";
11
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,OAAO,CAAC;AAC/B,eAAO,MAAM,8BAA8B,oCAAoC,CAAC;AAEhF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAC/C,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,SAAS,KAAK,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './NotificationServicesPushController';
2
+ export * as Types from './types';
3
+ export * as Utils from './utils';
4
+ export * as Mocks from './__fixtures__';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const REGISTRATION_TOKENS_ENDPOINT: string;
2
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesPushController/services/endpoints.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,4BAA4B,QAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type * as Web from './push-web';
2
+ export type CreateRegToken = typeof Web.createRegToken;
3
+ export type DeleteRegToken = typeof Web.deleteRegToken;
4
+ export type ListenToPushNotificationsReceived = typeof Web.listenToPushNotificationsReceived;
5
+ export type ListenToPushNotificationsClicked = typeof Web.listenToPushNotificationsClicked;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/NotificationServicesPushController/services/push/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,CAAC,cAAc,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,CAAC,cAAc,CAAC;AACvD,MAAM,MAAM,iCAAiC,GAC3C,OAAO,GAAG,CAAC,iCAAiC,CAAC;AAC/C,MAAM,MAAM,gCAAgC,GAC1C,OAAO,GAAG,CAAC,gCAAgC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /// <reference lib="webworker" />
2
+ import type { Types } from '../../../NotificationServicesController';
3
+ import type { PushNotificationEnv } from '../../types/firebase';
4
+ /**
5
+ * Creates a registration token for Firebase Cloud Messaging.
6
+ *
7
+ * @param env - env to configure push notifications
8
+ * @returns A promise that resolves with the registration token or null if an error occurs.
9
+ */
10
+ export declare function createRegToken(env: PushNotificationEnv): Promise<string | null>;
11
+ /**
12
+ * Deletes the Firebase Cloud Messaging registration token.
13
+ *
14
+ * @param env - env to configure push notifications
15
+ * @returns A promise that resolves with true if the token was successfully deleted, false otherwise.
16
+ */
17
+ export declare function deleteRegToken(env: PushNotificationEnv): Promise<boolean>;
18
+ /**
19
+ * Service Worker Listener for when push notifications are received.
20
+ * @param env - push notification environment
21
+ * @param handler - handler to actually showing notification, MUST BE PROVEDED
22
+ * @returns unsubscribe handler
23
+ */
24
+ export declare function listenToPushNotificationsReceived(env: PushNotificationEnv, handler: (notification: Types.INotification) => void | Promise<void>): Promise<() => void>;
25
+ /**
26
+ * Service Worker Listener for when a notification is clicked
27
+ *
28
+ * @param handler - listen to NotificationEvent from the service worker
29
+ * @returns unsubscribe handler
30
+ */
31
+ export declare function listenToPushNotificationsClicked(handler: (e: NotificationEvent, notification?: Types.INotification) => void): () => void;
32
+ //# sourceMappingURL=push-web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-web.d.ts","sourceRoot":"","sources":["../../../../../src/NotificationServicesPushController/services/push/push-web.ts"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AA8BhE;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,mBAAmB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,mBAAmB,GACvB,OAAO,CAAC,OAAO,CAAC,CAQlB;AAED;;;;;GAKG;AACH,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,mBAAmB,EACxB,OAAO,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,uBA+BrE;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,CAAC,CAAC,EAAE,iBAAiB,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,cAY5E"}
@@ -0,0 +1,95 @@
1
+ import type { Types } from '../../NotificationServicesController';
2
+ import type { PushNotificationEnv } from '../types';
3
+ import type { CreateRegToken, DeleteRegToken } from './push';
4
+ export type RegToken = {
5
+ token: string;
6
+ platform: 'extension' | 'mobile' | 'portfolio';
7
+ };
8
+ /**
9
+ * Links API Response Shape
10
+ */
11
+ export type LinksResult = {
12
+ trigger_ids: string[];
13
+ registration_tokens: RegToken[];
14
+ };
15
+ /**
16
+ * Fetches push notification links from a remote endpoint using a BearerToken for authorization.
17
+ *
18
+ * @param bearerToken - The JSON Web Token used for authorization.
19
+ * @returns A promise that resolves with the links result or null if an error occurs.
20
+ */
21
+ export declare function getPushNotificationLinks(bearerToken: string): Promise<LinksResult | null>;
22
+ /**
23
+ * Updates the push notification links on a remote API.
24
+ *
25
+ * @param bearerToken - The JSON Web Token used for authorization.
26
+ * @param triggers - An array of trigger identifiers.
27
+ * @param regTokens - An array of registration tokens.
28
+ * @returns A promise that resolves with true if the update was successful, false otherwise.
29
+ */
30
+ export declare function updateLinksAPI(bearerToken: string, triggers: string[], regTokens: RegToken[]): Promise<boolean>;
31
+ type ActivatePushNotificationsParams = {
32
+ bearerToken: string;
33
+ triggers: string[];
34
+ env: PushNotificationEnv;
35
+ createRegToken: CreateRegToken;
36
+ platform: 'extension' | 'mobile' | 'portfolio';
37
+ };
38
+ /**
39
+ * Enables push notifications by registering the device and linking triggers.
40
+ *
41
+ * @param params - Activate Push Params
42
+ * @returns A promise that resolves with an object containing the success status and the BearerToken token.
43
+ */
44
+ export declare function activatePushNotifications(params: ActivatePushNotificationsParams): Promise<string | null>;
45
+ type DeactivatePushNotificationsParams = {
46
+ regToken: string;
47
+ bearerToken: string;
48
+ triggers: string[];
49
+ env: PushNotificationEnv;
50
+ deleteRegToken: DeleteRegToken;
51
+ };
52
+ /**
53
+ * Disables push notifications by removing the registration token and unlinking triggers.
54
+ *
55
+ * @param params - Deactivate Push Params
56
+ * @returns A promise that resolves with true if notifications were successfully disabled, false otherwise.
57
+ */
58
+ export declare function deactivatePushNotifications(params: DeactivatePushNotificationsParams): Promise<boolean>;
59
+ type UpdateTriggerPushNotificationsParams = {
60
+ regToken: string;
61
+ bearerToken: string;
62
+ triggers: string[];
63
+ env: PushNotificationEnv;
64
+ createRegToken: CreateRegToken;
65
+ platform: 'extension' | 'mobile' | 'portfolio';
66
+ deleteRegToken: DeleteRegToken;
67
+ };
68
+ /**
69
+ * Updates the triggers linked to push notifications for a given registration token.
70
+ * If the provided registration token does not exist or is not in the current set of registration tokens,
71
+ * a new registration token is created and used for the update.
72
+ *
73
+ * @param params - Update Push Params
74
+ * @returns A promise that resolves with an object containing:
75
+ * - isTriggersLinkedToPushNotifications: boolean indicating if the triggers were successfully updated.
76
+ * - fcmToken: the new or existing Firebase Cloud Messaging token used for the update, if applicable.
77
+ */
78
+ export declare function updateTriggerPushNotifications(params: UpdateTriggerPushNotificationsParams): Promise<{
79
+ isTriggersLinkedToPushNotifications: boolean;
80
+ fcmToken?: string | null;
81
+ }>;
82
+ type ListenToPushNotificationsParams = {
83
+ env: PushNotificationEnv;
84
+ listenToPushReceived: (notification: Types.INotification) => void | Promise<void>;
85
+ listenToPushClicked: (event: NotificationEvent, notification?: Types.INotification) => void;
86
+ };
87
+ /**
88
+ * Listens to push notifications and invokes the provided callback function with the received notification data.
89
+ *
90
+ * @param params - listen params
91
+ * @returns A promise that resolves to an unsubscribe function to stop listening to push notifications.
92
+ */
93
+ export declare function listenToPushNotifications(params: ListenToPushNotificationsParams): Promise<() => void>;
94
+ export {};
95
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesPushController/services/services.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAM7D,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IAExB,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,mBAAmB,EAAE,QAAQ,EAAE,CAAC;CACjC,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAc7B;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAED,KAAK,+BAA+B,GAAG;IAErC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;CAChD,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmBxB;AAED,KAAK,iCAAiC,GAAG;IAEvC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,OAAO,CAAC,CAgClB;AAED,KAAK,oCAAoC,GAAG;IAE1C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IAGnB,GAAG,EAAE,mBAAmB,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAG/C,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAAC;IACT,mCAAmC,EAAE,OAAO,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC,CA4CD;AAED,KAAK,+BAA+B,GAAG;IACrC,GAAG,EAAE,mBAAmB,CAAC;IACzB,oBAAoB,EAAE,CACpB,YAAY,EAAE,KAAK,CAAC,aAAa,KAC9B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,mBAAmB,EAAE,CACnB,KAAK,EAAE,iBAAiB,EACxB,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,KAC/B,IAAI,CAAC;CACX,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,MAAM,IAAI,CAAC,CAqBrB"}
@@ -0,0 +1,53 @@
1
+ export type PushNotificationEnv = {
2
+ apiKey: string;
3
+ authDomain: string;
4
+ storageBucket: string;
5
+ projectId: string;
6
+ messagingSenderId: string;
7
+ appId: string;
8
+ measurementId: string;
9
+ vapidKey: string;
10
+ };
11
+ export type Messaging = {
12
+ app: FirebaseApp;
13
+ };
14
+ export type FirebaseApp = {
15
+ readonly name: string;
16
+ readonly options: FirebaseOptions;
17
+ automaticDataCollectionEnabled: boolean;
18
+ };
19
+ export type FirebaseOptions = {
20
+ apiKey?: string;
21
+ authDomain?: string;
22
+ databaseURL?: string;
23
+ projectId?: string;
24
+ storageBucket?: string;
25
+ messagingSenderId?: string;
26
+ appId?: string;
27
+ measurementId?: string;
28
+ };
29
+ export type NotificationPayload = {
30
+ title?: string;
31
+ body?: string;
32
+ image?: string;
33
+ icon?: string;
34
+ };
35
+ export type FcmOptions = {
36
+ link?: string;
37
+ analyticsLabel?: string;
38
+ };
39
+ export type MessagePayload = {
40
+ notification?: NotificationPayload;
41
+ data?: {
42
+ [key: string]: string;
43
+ };
44
+ fcmOptions?: FcmOptions;
45
+ from: string;
46
+ collapseKey: string;
47
+ messageId: string;
48
+ };
49
+ export type GetTokenOptions = {
50
+ vapidKey?: string;
51
+ serviceWorkerRegistration?: ServiceWorkerRegistration;
52
+ };
53
+ //# sourceMappingURL=firebase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesPushController/types/firebase.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,WAAW,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,8BAA8B,EAAE,OAAO,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACjC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CACvD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './firebase';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/NotificationServicesPushController/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}