@metamask/notification-services-controller 0.4.1 → 0.5.1

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 (715) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/dist/NotificationServicesController/NotificationServicesController.cjs +803 -0
  3. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -0
  4. package/dist/{types/NotificationServicesController/NotificationServicesController.d.ts → NotificationServicesController/NotificationServicesController.d.cts} +7 -7
  5. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -0
  6. package/dist/NotificationServicesController/NotificationServicesController.d.mts +238 -0
  7. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -0
  8. package/dist/NotificationServicesController/NotificationServicesController.mjs +779 -17
  9. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
  10. package/dist/NotificationServicesController/__fixtures__/index.cjs +22 -0
  11. package/dist/NotificationServicesController/__fixtures__/index.cjs.map +1 -0
  12. package/dist/NotificationServicesController/__fixtures__/index.d.cts +6 -0
  13. package/dist/NotificationServicesController/__fixtures__/index.d.cts.map +1 -0
  14. package/dist/NotificationServicesController/__fixtures__/index.d.mts +6 -0
  15. package/dist/NotificationServicesController/__fixtures__/index.d.mts.map +1 -0
  16. package/dist/NotificationServicesController/__fixtures__/index.mjs +6 -0
  17. package/dist/NotificationServicesController/__fixtures__/index.mjs.map +1 -0
  18. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs +210 -0
  19. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs.map +1 -0
  20. package/dist/{types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts → NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts} +3 -3
  21. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts.map +1 -0
  22. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts +15 -0
  23. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts.map +1 -0
  24. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs +205 -0
  25. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs.map +1 -0
  26. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs +22 -0
  27. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs.map +1 -0
  28. package/dist/{types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts → NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts} +2 -2
  29. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts.map +1 -0
  30. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts +9 -0
  31. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts.map +1 -0
  32. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs +18 -0
  33. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs.map +1 -0
  34. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs +82 -0
  35. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs.map +1 -0
  36. package/dist/{types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts → NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts} +3 -3
  37. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts.map +1 -0
  38. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts +35 -0
  39. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts.map +1 -0
  40. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs +76 -0
  41. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs.map +1 -0
  42. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs +624 -0
  43. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +1 -0
  44. package/dist/{types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts → NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts} +2 -2
  45. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +1 -0
  46. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts +82 -0
  47. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +1 -0
  48. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs +605 -0
  49. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +1 -0
  50. package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs +50 -0
  51. package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs.map +1 -0
  52. package/dist/{types/NotificationServicesController/__fixtures__/mockResponses.d.ts → NotificationServicesController/__fixtures__/mockResponses.d.cts} +5 -5
  53. package/dist/NotificationServicesController/__fixtures__/mockResponses.d.cts.map +1 -0
  54. package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts +28 -0
  55. package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts.map +1 -0
  56. package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs +42 -0
  57. package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs.map +1 -0
  58. package/dist/NotificationServicesController/__fixtures__/mockServices.cjs +56 -0
  59. package/dist/NotificationServicesController/__fixtures__/mockServices.cjs.map +1 -0
  60. package/dist/{types/NotificationServicesController/__fixtures__/mockServices.d.ts → NotificationServicesController/__fixtures__/mockServices.d.cts} +2 -2
  61. package/dist/NotificationServicesController/__fixtures__/mockServices.d.cts.map +1 -0
  62. package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts +12 -0
  63. package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts.map +1 -0
  64. package/dist/NotificationServicesController/__fixtures__/mockServices.mjs +52 -0
  65. package/dist/NotificationServicesController/__fixtures__/mockServices.mjs.map +1 -0
  66. package/dist/NotificationServicesController/__fixtures__/test-utils.cjs +31 -0
  67. package/dist/NotificationServicesController/__fixtures__/test-utils.cjs.map +1 -0
  68. package/dist/{types/NotificationServicesController/__fixtures__/test-utils.d.ts → NotificationServicesController/__fixtures__/test-utils.d.cts} +1 -1
  69. package/dist/NotificationServicesController/__fixtures__/test-utils.d.cts.map +1 -0
  70. package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts +14 -0
  71. package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts.map +1 -0
  72. package/dist/NotificationServicesController/__fixtures__/test-utils.mjs +27 -0
  73. package/dist/NotificationServicesController/__fixtures__/test-utils.mjs.map +1 -0
  74. package/dist/NotificationServicesController/constants/constants.cjs +7 -0
  75. package/dist/NotificationServicesController/constants/constants.cjs.map +1 -0
  76. package/dist/{types/NotificationServicesController/constants/constants.d.ts → NotificationServicesController/constants/constants.d.cts} +1 -1
  77. package/dist/NotificationServicesController/constants/constants.d.cts.map +1 -0
  78. package/dist/NotificationServicesController/constants/constants.d.mts +3 -0
  79. package/dist/NotificationServicesController/constants/constants.d.mts.map +1 -0
  80. package/dist/NotificationServicesController/constants/constants.mjs +3 -9
  81. package/dist/NotificationServicesController/constants/constants.mjs.map +1 -1
  82. package/dist/NotificationServicesController/constants/index.cjs +19 -0
  83. package/dist/NotificationServicesController/constants/index.cjs.map +1 -0
  84. package/dist/NotificationServicesController/constants/index.d.cts +3 -0
  85. package/dist/NotificationServicesController/constants/index.d.cts.map +1 -0
  86. package/dist/NotificationServicesController/constants/index.d.mts +3 -0
  87. package/dist/NotificationServicesController/constants/index.d.mts.map +1 -0
  88. package/dist/NotificationServicesController/constants/index.mjs +2 -28
  89. package/dist/NotificationServicesController/constants/index.mjs.map +1 -1
  90. package/dist/NotificationServicesController/constants/notification-schema.cjs +170 -0
  91. package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -0
  92. package/dist/{types/NotificationServicesController/constants/notification-schema.d.ts → NotificationServicesController/constants/notification-schema.d.cts} +2 -2
  93. package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -0
  94. package/dist/NotificationServicesController/constants/notification-schema.d.mts +48 -0
  95. package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -0
  96. package/dist/NotificationServicesController/constants/notification-schema.mjs +165 -20
  97. package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
  98. package/dist/NotificationServicesController/index.cjs +46 -0
  99. package/dist/NotificationServicesController/index.cjs.map +1 -0
  100. package/dist/NotificationServicesController/index.d.cts +14 -0
  101. package/dist/NotificationServicesController/index.d.cts.map +1 -0
  102. package/dist/NotificationServicesController/index.d.mts +14 -0
  103. package/dist/NotificationServicesController/index.d.mts.map +1 -0
  104. package/dist/NotificationServicesController/index.mjs +13 -86
  105. package/dist/NotificationServicesController/index.mjs.map +1 -1
  106. package/dist/NotificationServicesController/processors/index.cjs +20 -0
  107. package/dist/NotificationServicesController/processors/index.cjs.map +1 -0
  108. package/dist/NotificationServicesController/processors/index.d.cts +4 -0
  109. package/dist/NotificationServicesController/processors/index.d.cts.map +1 -0
  110. package/dist/NotificationServicesController/processors/index.d.mts +4 -0
  111. package/dist/NotificationServicesController/processors/index.d.mts.map +1 -0
  112. package/dist/NotificationServicesController/processors/index.mjs +3 -21
  113. package/dist/NotificationServicesController/processors/index.mjs.map +1 -1
  114. package/dist/NotificationServicesController/processors/process-feature-announcement.cjs +41 -0
  115. package/dist/{chunk-52CALMRA.js.map → NotificationServicesController/processors/process-feature-announcement.cjs.map} +1 -1
  116. package/dist/{types/NotificationServicesController/processors/process-feature-announcement.d.ts → NotificationServicesController/processors/process-feature-announcement.d.cts} +3 -3
  117. package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts.map +1 -0
  118. package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts +19 -0
  119. package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts.map +1 -0
  120. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs +34 -8
  121. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs.map +1 -1
  122. package/dist/NotificationServicesController/processors/process-notifications.cjs +50 -0
  123. package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -0
  124. package/dist/{types/NotificationServicesController/processors/process-notifications.d.ts → NotificationServicesController/processors/process-notifications.d.cts} +2 -2
  125. package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -0
  126. package/dist/NotificationServicesController/processors/process-notifications.d.mts +19 -0
  127. package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -0
  128. package/dist/NotificationServicesController/processors/process-notifications.mjs +44 -12
  129. package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
  130. package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs +19 -0
  131. package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs.map +1 -0
  132. package/dist/{types/NotificationServicesController/processors/process-onchain-notifications.d.ts → NotificationServicesController/processors/process-onchain-notifications.d.cts} +3 -3
  133. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.cts.map +1 -0
  134. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts +10 -0
  135. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts.map +1 -0
  136. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs +14 -7
  137. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs.map +1 -1
  138. package/dist/NotificationServicesController/services/feature-announcements.cjs +97 -0
  139. package/dist/NotificationServicesController/services/feature-announcements.cjs.map +1 -0
  140. package/dist/{types/NotificationServicesController/services/feature-announcements.d.ts → NotificationServicesController/services/feature-announcements.d.cts} +4 -4
  141. package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +1 -0
  142. package/dist/NotificationServicesController/services/feature-announcements.d.mts +28 -0
  143. package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +1 -0
  144. package/dist/NotificationServicesController/services/feature-announcements.mjs +91 -12
  145. package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -1
  146. package/dist/NotificationServicesController/services/onchain-notifications.cjs +195 -0
  147. package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -0
  148. package/dist/{types/NotificationServicesController/services/onchain-notifications.d.ts → NotificationServicesController/services/onchain-notifications.d.cts} +3 -3
  149. package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -0
  150. package/dist/NotificationServicesController/services/onchain-notifications.d.mts +62 -0
  151. package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -0
  152. package/dist/NotificationServicesController/services/onchain-notifications.mjs +190 -29
  153. package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
  154. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs +3 -0
  155. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map +1 -0
  156. package/dist/{types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts → NotificationServicesController/types/feature-announcement/feature-announcement.d.cts} +3 -3
  157. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts.map +1 -0
  158. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts +32 -0
  159. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts.map +1 -0
  160. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs +1 -1
  161. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +1 -1
  162. package/dist/NotificationServicesController/types/feature-announcement/index.cjs +20 -0
  163. package/dist/NotificationServicesController/types/feature-announcement/index.cjs.map +1 -0
  164. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts +4 -0
  165. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts.map +1 -0
  166. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts +4 -0
  167. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts.map +1 -0
  168. package/dist/NotificationServicesController/types/feature-announcement/index.mjs +3 -4
  169. package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +1 -1
  170. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs +3 -0
  171. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs.map +1 -0
  172. package/dist/{types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts → NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts} +3 -3
  173. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts.map +1 -0
  174. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts +39 -0
  175. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts.map +1 -0
  176. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs +1 -1
  177. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs.map +1 -1
  178. package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs +3 -0
  179. package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs.map +1 -0
  180. package/dist/{types/NotificationServicesController/types/feature-announcement/type-links.d.ts → NotificationServicesController/types/feature-announcement/type-links.d.cts} +1 -1
  181. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.cts.map +1 -0
  182. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts +29 -0
  183. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts.map +1 -0
  184. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs +1 -1
  185. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs.map +1 -1
  186. package/dist/NotificationServicesController/types/index.cjs +21 -0
  187. package/dist/NotificationServicesController/types/index.cjs.map +1 -0
  188. package/dist/NotificationServicesController/types/index.d.cts +5 -0
  189. package/dist/NotificationServicesController/types/index.d.cts.map +1 -0
  190. package/dist/NotificationServicesController/types/index.d.mts +5 -0
  191. package/dist/NotificationServicesController/types/index.d.mts.map +1 -0
  192. package/dist/NotificationServicesController/types/index.mjs +4 -11
  193. package/dist/NotificationServicesController/types/index.mjs.map +1 -1
  194. package/dist/NotificationServicesController/types/notification/index.cjs +18 -0
  195. package/dist/NotificationServicesController/types/notification/index.cjs.map +1 -0
  196. package/dist/NotificationServicesController/types/notification/index.d.cts +2 -0
  197. package/dist/NotificationServicesController/types/notification/index.d.cts.map +1 -0
  198. package/dist/NotificationServicesController/types/notification/index.d.mts +2 -0
  199. package/dist/NotificationServicesController/types/notification/index.d.mts.map +1 -0
  200. package/dist/NotificationServicesController/types/notification/index.mjs +1 -2
  201. package/dist/NotificationServicesController/types/notification/index.mjs.map +1 -1
  202. package/dist/NotificationServicesController/types/notification/notification.cjs +3 -0
  203. package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -0
  204. package/dist/{types/NotificationServicesController/types/notification/notification.d.ts → NotificationServicesController/types/notification/notification.d.cts} +4 -4
  205. package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -0
  206. package/dist/NotificationServicesController/types/notification/notification.d.mts +25 -0
  207. package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -0
  208. package/dist/NotificationServicesController/types/notification/notification.mjs +1 -1
  209. package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
  210. package/dist/NotificationServicesController/types/on-chain-notification/index.cjs +18 -0
  211. package/dist/NotificationServicesController/types/on-chain-notification/index.cjs.map +1 -0
  212. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts +2 -0
  213. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts.map +1 -0
  214. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts +2 -0
  215. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts.map +1 -0
  216. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs +1 -2
  217. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs.map +1 -1
  218. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs +3 -0
  219. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +1 -0
  220. package/dist/{types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts → NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts} +4 -4
  221. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +1 -0
  222. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +43 -0
  223. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +1 -0
  224. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs +1 -1
  225. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -1
  226. package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs +9 -0
  227. package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +1 -0
  228. package/dist/{types/NotificationServicesController/types/on-chain-notification/schema.d.ts → NotificationServicesController/types/on-chain-notification/schema.d.cts} +1 -1
  229. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +1 -0
  230. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts +283 -0
  231. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +1 -0
  232. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs +7 -0
  233. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -1
  234. package/dist/NotificationServicesController/types/type-utils.cjs +3 -0
  235. package/dist/NotificationServicesController/types/type-utils.cjs.map +1 -0
  236. package/dist/{types/NotificationServicesController/types/type-utils.d.ts → NotificationServicesController/types/type-utils.d.cts} +1 -1
  237. package/dist/NotificationServicesController/types/type-utils.d.cts.map +1 -0
  238. package/dist/NotificationServicesController/types/type-utils.d.mts +7 -0
  239. package/dist/NotificationServicesController/types/type-utils.d.mts.map +1 -0
  240. package/dist/NotificationServicesController/types/type-utils.mjs +1 -0
  241. package/dist/NotificationServicesController/types/type-utils.mjs.map +1 -1
  242. package/dist/NotificationServicesController/types/user-storage/index.cjs +18 -0
  243. package/dist/NotificationServicesController/types/user-storage/index.cjs.map +1 -0
  244. package/dist/NotificationServicesController/types/user-storage/index.d.cts +2 -0
  245. package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +1 -0
  246. package/dist/NotificationServicesController/types/user-storage/index.d.mts +2 -0
  247. package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +1 -0
  248. package/dist/NotificationServicesController/types/user-storage/index.mjs +1 -2
  249. package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -1
  250. package/dist/NotificationServicesController/types/user-storage/user-storage.cjs +3 -0
  251. package/dist/NotificationServicesController/types/user-storage/user-storage.cjs.map +1 -0
  252. package/dist/{types/NotificationServicesController/types/user-storage/user-storage.d.ts → NotificationServicesController/types/user-storage/user-storage.d.cts} +3 -3
  253. package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts.map +1 -0
  254. package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts +26 -0
  255. package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts.map +1 -0
  256. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs +1 -1
  257. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs.map +1 -1
  258. package/dist/NotificationServicesController/ui/constants.cjs +62 -0
  259. package/dist/NotificationServicesController/ui/constants.cjs.map +1 -0
  260. package/dist/{types/NotificationServicesController/ui/constants.d.ts → NotificationServicesController/ui/constants.d.cts} +2 -2
  261. package/dist/NotificationServicesController/ui/constants.d.cts.map +1 -0
  262. package/dist/NotificationServicesController/ui/constants.d.mts +54 -0
  263. package/dist/NotificationServicesController/ui/constants.d.mts.map +1 -0
  264. package/dist/NotificationServicesController/ui/constants.mjs +56 -14
  265. package/dist/NotificationServicesController/ui/constants.mjs.map +1 -1
  266. package/dist/NotificationServicesController/ui/index.cjs +18 -0
  267. package/dist/NotificationServicesController/ui/index.cjs.map +1 -0
  268. package/dist/NotificationServicesController/ui/index.d.cts +2 -0
  269. package/dist/NotificationServicesController/ui/index.d.cts.map +1 -0
  270. package/dist/NotificationServicesController/ui/index.d.mts +2 -0
  271. package/dist/NotificationServicesController/ui/index.d.mts.map +1 -0
  272. package/dist/NotificationServicesController/ui/index.mjs +1 -16
  273. package/dist/NotificationServicesController/ui/index.mjs.map +1 -1
  274. package/dist/NotificationServicesController/utils/utils.cjs +348 -0
  275. package/dist/NotificationServicesController/utils/utils.cjs.map +1 -0
  276. package/dist/{types/NotificationServicesController/utils/utils.d.ts → NotificationServicesController/utils/utils.d.cts} +3 -3
  277. package/dist/NotificationServicesController/utils/utils.d.cts.map +1 -0
  278. package/dist/NotificationServicesController/utils/utils.d.mts +142 -0
  279. package/dist/NotificationServicesController/utils/utils.d.mts.map +1 -0
  280. package/dist/NotificationServicesController/utils/utils.mjs +332 -31
  281. package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
  282. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +215 -0
  283. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -0
  284. package/dist/{types/NotificationServicesPushController/NotificationServicesPushController.d.ts → NotificationServicesPushController/NotificationServicesPushController.d.cts} +6 -6
  285. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -0
  286. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +112 -0
  287. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -0
  288. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +214 -37
  289. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
  290. package/dist/NotificationServicesPushController/__fixtures__/index.cjs +18 -0
  291. package/dist/NotificationServicesPushController/__fixtures__/index.cjs.map +1 -0
  292. package/dist/NotificationServicesPushController/__fixtures__/index.d.cts +2 -0
  293. package/dist/NotificationServicesPushController/__fixtures__/index.d.cts.map +1 -0
  294. package/dist/NotificationServicesPushController/__fixtures__/index.d.mts +2 -0
  295. package/dist/NotificationServicesPushController/__fixtures__/index.d.mts.map +1 -0
  296. package/dist/NotificationServicesPushController/__fixtures__/index.mjs +2 -0
  297. package/dist/NotificationServicesPushController/__fixtures__/index.mjs.map +1 -0
  298. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs +57 -0
  299. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs.map +1 -0
  300. package/dist/{types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts → NotificationServicesPushController/__fixtures__/mockResponse.d.cts} +2 -2
  301. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.cts.map +1 -0
  302. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts +43 -0
  303. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts.map +1 -0
  304. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs +50 -0
  305. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs.map +1 -0
  306. package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs +31 -0
  307. package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs.map +1 -0
  308. package/dist/{types/NotificationServicesPushController/__fixtures__/mockServices.d.ts → NotificationServicesPushController/__fixtures__/mockServices.d.cts} +2 -2
  309. package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts.map +1 -0
  310. package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts +9 -0
  311. package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts.map +1 -0
  312. package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs +30 -0
  313. package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs.map +1 -0
  314. package/dist/NotificationServicesPushController/constants.cjs +14 -0
  315. package/dist/NotificationServicesPushController/constants.cjs.map +1 -0
  316. package/dist/{types/NotificationServicesPushController/constants.d.ts → NotificationServicesPushController/constants.d.cts} +1 -1
  317. package/dist/NotificationServicesPushController/constants.d.cts.map +1 -0
  318. package/dist/NotificationServicesPushController/constants.d.mts +11 -0
  319. package/dist/NotificationServicesPushController/constants.d.mts.map +1 -0
  320. package/dist/NotificationServicesPushController/constants.mjs +10 -25
  321. package/dist/NotificationServicesPushController/constants.mjs.map +1 -1
  322. package/dist/NotificationServicesPushController/index.cjs +43 -0
  323. package/dist/NotificationServicesPushController/index.cjs.map +1 -0
  324. package/dist/NotificationServicesPushController/index.d.cts +11 -0
  325. package/dist/NotificationServicesPushController/index.d.cts.map +1 -0
  326. package/dist/NotificationServicesPushController/index.d.mts +11 -0
  327. package/dist/NotificationServicesPushController/index.d.mts.map +1 -0
  328. package/dist/NotificationServicesPushController/index.mjs +10 -71
  329. package/dist/NotificationServicesPushController/index.mjs.map +1 -1
  330. package/dist/NotificationServicesPushController/services/endpoints.cjs +6 -0
  331. package/dist/NotificationServicesPushController/services/endpoints.cjs.map +1 -0
  332. package/dist/{types/NotificationServicesPushController/services/endpoints.d.ts → NotificationServicesPushController/services/endpoints.d.cts} +1 -1
  333. package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +1 -0
  334. package/dist/NotificationServicesPushController/services/endpoints.d.mts +2 -0
  335. package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +1 -0
  336. package/dist/NotificationServicesPushController/services/endpoints.mjs +2 -7
  337. package/dist/NotificationServicesPushController/services/endpoints.mjs.map +1 -1
  338. package/dist/NotificationServicesPushController/services/push/index.cjs +3 -0
  339. package/dist/NotificationServicesPushController/services/push/index.cjs.map +1 -0
  340. package/dist/{types/NotificationServicesPushController/services/push/index.d.ts → NotificationServicesPushController/services/push/index.d.cts} +2 -2
  341. package/dist/NotificationServicesPushController/services/push/index.d.cts.map +1 -0
  342. package/dist/NotificationServicesPushController/services/push/index.d.mts +6 -0
  343. package/dist/NotificationServicesPushController/services/push/index.d.mts.map +1 -0
  344. package/dist/NotificationServicesPushController/services/push/index.mjs +1 -0
  345. package/dist/NotificationServicesPushController/services/push/index.mjs.map +1 -1
  346. package/dist/NotificationServicesPushController/services/push/push-web.cjs +121 -0
  347. package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +1 -0
  348. package/dist/{types/NotificationServicesPushController/services/push/push-web.d.ts → NotificationServicesPushController/services/push/push-web.d.cts} +3 -3
  349. package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +1 -0
  350. package/dist/NotificationServicesPushController/services/push/push-web.d.mts +32 -0
  351. package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +1 -0
  352. package/dist/NotificationServicesPushController/services/push/push-web.mjs +116 -38
  353. package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -1
  354. package/dist/NotificationServicesPushController/services/services.cjs +197 -0
  355. package/dist/NotificationServicesPushController/services/services.cjs.map +1 -0
  356. package/dist/{types/NotificationServicesPushController/services/services.d.ts → NotificationServicesPushController/services/services.d.cts} +4 -4
  357. package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -0
  358. package/dist/NotificationServicesPushController/services/services.d.mts +95 -0
  359. package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -0
  360. package/dist/NotificationServicesPushController/services/services.mjs +168 -45
  361. package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
  362. package/dist/NotificationServicesPushController/types/firebase.cjs +3 -0
  363. package/dist/NotificationServicesPushController/types/firebase.cjs.map +1 -0
  364. package/dist/{types/NotificationServicesPushController/types/firebase.d.ts → NotificationServicesPushController/types/firebase.d.cts} +1 -1
  365. package/dist/NotificationServicesPushController/types/firebase.d.cts.map +1 -0
  366. package/dist/NotificationServicesPushController/types/firebase.d.mts +53 -0
  367. package/dist/NotificationServicesPushController/types/firebase.d.mts.map +1 -0
  368. package/dist/NotificationServicesPushController/types/firebase.mjs +1 -1
  369. package/dist/NotificationServicesPushController/types/firebase.mjs.map +1 -1
  370. package/dist/NotificationServicesPushController/types/index.cjs +18 -0
  371. package/dist/NotificationServicesPushController/types/index.cjs.map +1 -0
  372. package/dist/NotificationServicesPushController/types/index.d.cts +2 -0
  373. package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -0
  374. package/dist/NotificationServicesPushController/types/index.d.mts +2 -0
  375. package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -0
  376. package/dist/NotificationServicesPushController/types/index.mjs +1 -2
  377. package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
  378. package/dist/NotificationServicesPushController/utils/get-notification-data.cjs +84 -0
  379. package/dist/NotificationServicesPushController/utils/get-notification-data.cjs.map +1 -0
  380. package/dist/{types/NotificationServicesPushController/utils/get-notification-data.d.ts → NotificationServicesPushController/utils/get-notification-data.d.cts} +2 -2
  381. package/dist/NotificationServicesPushController/utils/get-notification-data.d.cts.map +1 -0
  382. package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts +42 -0
  383. package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts.map +1 -0
  384. package/dist/NotificationServicesPushController/utils/get-notification-data.mjs +76 -12
  385. package/dist/NotificationServicesPushController/utils/get-notification-data.mjs.map +1 -1
  386. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +190 -0
  387. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +1 -0
  388. package/dist/{types/NotificationServicesPushController/utils/get-notification-message.d.ts → NotificationServicesPushController/utils/get-notification-message.d.cts} +3 -3
  389. package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +1 -0
  390. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts +67 -0
  391. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +1 -0
  392. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +182 -37
  393. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -1
  394. package/dist/NotificationServicesPushController/utils/index.cjs +19 -0
  395. package/dist/NotificationServicesPushController/utils/index.cjs.map +1 -0
  396. package/dist/NotificationServicesPushController/utils/index.d.cts +3 -0
  397. package/dist/NotificationServicesPushController/utils/index.d.cts.map +1 -0
  398. package/dist/NotificationServicesPushController/utils/index.d.mts +3 -0
  399. package/dist/NotificationServicesPushController/utils/index.d.mts.map +1 -0
  400. package/dist/NotificationServicesPushController/utils/index.mjs +2 -48
  401. package/dist/NotificationServicesPushController/utils/index.mjs.map +1 -1
  402. package/dist/index.cjs +29 -0
  403. package/dist/index.cjs.map +1 -0
  404. package/dist/index.d.cts +3 -0
  405. package/dist/index.d.cts.map +1 -0
  406. package/dist/index.d.mts +3 -0
  407. package/dist/index.d.mts.map +1 -0
  408. package/dist/index.mjs +2 -45
  409. package/dist/index.mjs.map +1 -1
  410. package/dist/shared/to-raw-notification.cjs +19 -0
  411. package/dist/shared/to-raw-notification.cjs.map +1 -0
  412. package/dist/{types/shared/to-raw-notification.d.ts → shared/to-raw-notification.d.cts} +2 -2
  413. package/dist/shared/to-raw-notification.d.cts.map +1 -0
  414. package/dist/shared/to-raw-notification.d.mts +11 -0
  415. package/dist/shared/to-raw-notification.d.mts.map +1 -0
  416. package/dist/shared/to-raw-notification.mjs +14 -7
  417. package/dist/shared/to-raw-notification.mjs.map +1 -1
  418. package/package.json +18 -13
  419. package/dist/NotificationServicesController/NotificationServicesController.js +0 -19
  420. package/dist/NotificationServicesController/NotificationServicesController.js.map +0 -1
  421. package/dist/NotificationServicesController/constants/constants.js +0 -10
  422. package/dist/NotificationServicesController/constants/constants.js.map +0 -1
  423. package/dist/NotificationServicesController/constants/index.js +0 -29
  424. package/dist/NotificationServicesController/constants/index.js.map +0 -1
  425. package/dist/NotificationServicesController/constants/notification-schema.js +0 -22
  426. package/dist/NotificationServicesController/constants/notification-schema.js.map +0 -1
  427. package/dist/NotificationServicesController/index.js +0 -87
  428. package/dist/NotificationServicesController/index.js.map +0 -1
  429. package/dist/NotificationServicesController/processors/index.js +0 -22
  430. package/dist/NotificationServicesController/processors/index.js.map +0 -1
  431. package/dist/NotificationServicesController/processors/process-feature-announcement.js +0 -10
  432. package/dist/NotificationServicesController/processors/process-feature-announcement.js.map +0 -1
  433. package/dist/NotificationServicesController/processors/process-notifications.js +0 -13
  434. package/dist/NotificationServicesController/processors/process-notifications.js.map +0 -1
  435. package/dist/NotificationServicesController/processors/process-onchain-notifications.js +0 -8
  436. package/dist/NotificationServicesController/processors/process-onchain-notifications.js.map +0 -1
  437. package/dist/NotificationServicesController/services/feature-announcements.js +0 -14
  438. package/dist/NotificationServicesController/services/feature-announcements.js.map +0 -1
  439. package/dist/NotificationServicesController/services/onchain-notifications.js +0 -30
  440. package/dist/NotificationServicesController/services/onchain-notifications.js.map +0 -1
  441. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js +0 -2
  442. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js.map +0 -1
  443. package/dist/NotificationServicesController/types/feature-announcement/index.js +0 -5
  444. package/dist/NotificationServicesController/types/feature-announcement/index.js.map +0 -1
  445. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js +0 -2
  446. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js.map +0 -1
  447. package/dist/NotificationServicesController/types/feature-announcement/type-links.js +0 -2
  448. package/dist/NotificationServicesController/types/feature-announcement/type-links.js.map +0 -1
  449. package/dist/NotificationServicesController/types/index.js +0 -12
  450. package/dist/NotificationServicesController/types/index.js.map +0 -1
  451. package/dist/NotificationServicesController/types/notification/index.js +0 -3
  452. package/dist/NotificationServicesController/types/notification/index.js.map +0 -1
  453. package/dist/NotificationServicesController/types/notification/notification.js +0 -2
  454. package/dist/NotificationServicesController/types/notification/notification.js.map +0 -1
  455. package/dist/NotificationServicesController/types/on-chain-notification/index.js +0 -3
  456. package/dist/NotificationServicesController/types/on-chain-notification/index.js.map +0 -1
  457. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js +0 -2
  458. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js.map +0 -1
  459. package/dist/NotificationServicesController/types/on-chain-notification/schema.js +0 -1
  460. package/dist/NotificationServicesController/types/on-chain-notification/schema.js.map +0 -1
  461. package/dist/NotificationServicesController/types/type-utils.js +0 -1
  462. package/dist/NotificationServicesController/types/type-utils.js.map +0 -1
  463. package/dist/NotificationServicesController/types/user-storage/index.js +0 -3
  464. package/dist/NotificationServicesController/types/user-storage/index.js.map +0 -1
  465. package/dist/NotificationServicesController/types/user-storage/user-storage.js +0 -2
  466. package/dist/NotificationServicesController/types/user-storage/user-storage.js.map +0 -1
  467. package/dist/NotificationServicesController/ui/constants.js +0 -16
  468. package/dist/NotificationServicesController/ui/constants.js.map +0 -1
  469. package/dist/NotificationServicesController/ui/index.js +0 -17
  470. package/dist/NotificationServicesController/ui/index.js.map +0 -1
  471. package/dist/NotificationServicesController/utils/utils.js +0 -32
  472. package/dist/NotificationServicesController/utils/utils.js.map +0 -1
  473. package/dist/NotificationServicesPushController/NotificationServicesPushController.js +0 -39
  474. package/dist/NotificationServicesPushController/NotificationServicesPushController.js.map +0 -1
  475. package/dist/NotificationServicesPushController/constants.js +0 -26
  476. package/dist/NotificationServicesPushController/constants.js.map +0 -1
  477. package/dist/NotificationServicesPushController/index.js +0 -72
  478. package/dist/NotificationServicesPushController/index.js.map +0 -1
  479. package/dist/NotificationServicesPushController/services/endpoints.js +0 -8
  480. package/dist/NotificationServicesPushController/services/endpoints.js.map +0 -1
  481. package/dist/NotificationServicesPushController/services/push/index.js +0 -1
  482. package/dist/NotificationServicesPushController/services/push/index.js.map +0 -1
  483. package/dist/NotificationServicesPushController/services/push/push-web.js +0 -40
  484. package/dist/NotificationServicesPushController/services/push/push-web.js.map +0 -1
  485. package/dist/NotificationServicesPushController/services/services.js +0 -46
  486. package/dist/NotificationServicesPushController/services/services.js.map +0 -1
  487. package/dist/NotificationServicesPushController/types/firebase.js +0 -2
  488. package/dist/NotificationServicesPushController/types/firebase.js.map +0 -1
  489. package/dist/NotificationServicesPushController/types/index.js +0 -3
  490. package/dist/NotificationServicesPushController/types/index.js.map +0 -1
  491. package/dist/NotificationServicesPushController/utils/get-notification-data.js +0 -14
  492. package/dist/NotificationServicesPushController/utils/get-notification-data.js.map +0 -1
  493. package/dist/NotificationServicesPushController/utils/get-notification-message.js +0 -39
  494. package/dist/NotificationServicesPushController/utils/get-notification-message.js.map +0 -1
  495. package/dist/NotificationServicesPushController/utils/index.js +0 -49
  496. package/dist/NotificationServicesPushController/utils/index.js.map +0 -1
  497. package/dist/chunk-232HZSEV.js +0 -7
  498. package/dist/chunk-232HZSEV.js.map +0 -1
  499. package/dist/chunk-3ZS2HAEG.js +0 -1
  500. package/dist/chunk-3ZS2HAEG.js.map +0 -1
  501. package/dist/chunk-4BTNTREI.mjs +0 -1
  502. package/dist/chunk-4BTNTREI.mjs.map +0 -1
  503. package/dist/chunk-4HOEZMSV.js +0 -149
  504. package/dist/chunk-4HOEZMSV.js.map +0 -1
  505. package/dist/chunk-4QXAPVW3.mjs +0 -1
  506. package/dist/chunk-4QXAPVW3.mjs.map +0 -1
  507. package/dist/chunk-52CALMRA.js +0 -28
  508. package/dist/chunk-5FOQ4IEJ.js +0 -885
  509. package/dist/chunk-5FOQ4IEJ.js.map +0 -1
  510. package/dist/chunk-5FUMSWDD.js +0 -48
  511. package/dist/chunk-5FUMSWDD.js.map +0 -1
  512. package/dist/chunk-5JDAO4ZC.mjs +0 -25
  513. package/dist/chunk-5JDAO4ZC.mjs.map +0 -1
  514. package/dist/chunk-6GUOLD7O.mjs +0 -207
  515. package/dist/chunk-6GUOLD7O.mjs.map +0 -1
  516. package/dist/chunk-6ZDVTRRT.mjs +0 -9
  517. package/dist/chunk-6ZDVTRRT.mjs.map +0 -1
  518. package/dist/chunk-7LWR54U7.js +0 -7
  519. package/dist/chunk-7LWR54U7.js.map +0 -1
  520. package/dist/chunk-7RM3YNTD.mjs +0 -1
  521. package/dist/chunk-7RM3YNTD.mjs.map +0 -1
  522. package/dist/chunk-A2RPVX47.mjs +0 -1
  523. package/dist/chunk-A2RPVX47.mjs.map +0 -1
  524. package/dist/chunk-B25TJ7KS.js +0 -8
  525. package/dist/chunk-B25TJ7KS.js.map +0 -1
  526. package/dist/chunk-B4ECJJ5C.mjs +0 -7
  527. package/dist/chunk-B4ECJJ5C.mjs.map +0 -1
  528. package/dist/chunk-BONB66A2.mjs +0 -14
  529. package/dist/chunk-BONB66A2.mjs.map +0 -1
  530. package/dist/chunk-BUT7X5F2.js +0 -207
  531. package/dist/chunk-BUT7X5F2.js.map +0 -1
  532. package/dist/chunk-C62SK2KY.mjs +0 -92
  533. package/dist/chunk-C62SK2KY.mjs.map +0 -1
  534. package/dist/chunk-D42BBXBM.mjs +0 -28
  535. package/dist/chunk-D42BBXBM.mjs.map +0 -1
  536. package/dist/chunk-DCADU5QI.mjs +0 -31
  537. package/dist/chunk-DCADU5QI.mjs.map +0 -1
  538. package/dist/chunk-DINCLRZT.mjs +0 -12
  539. package/dist/chunk-DINCLRZT.mjs.map +0 -1
  540. package/dist/chunk-DMH4NSLF.js +0 -1
  541. package/dist/chunk-DMH4NSLF.js.map +0 -1
  542. package/dist/chunk-DT6SLUWJ.js +0 -12
  543. package/dist/chunk-DT6SLUWJ.js.map +0 -1
  544. package/dist/chunk-DUS3HEYL.mjs +0 -118
  545. package/dist/chunk-DUS3HEYL.mjs.map +0 -1
  546. package/dist/chunk-EJ52BDLB.js +0 -55
  547. package/dist/chunk-EJ52BDLB.js.map +0 -1
  548. package/dist/chunk-ENRKCWJ6.js +0 -31
  549. package/dist/chunk-ENRKCWJ6.js.map +0 -1
  550. package/dist/chunk-FN6GVBCU.mjs +0 -185
  551. package/dist/chunk-FN6GVBCU.mjs.map +0 -1
  552. package/dist/chunk-G52DNXFH.mjs +0 -1
  553. package/dist/chunk-G52DNXFH.mjs.map +0 -1
  554. package/dist/chunk-GDKHOBJT.js +0 -96
  555. package/dist/chunk-GDKHOBJT.js.map +0 -1
  556. package/dist/chunk-GETQWOTI.js +0 -1
  557. package/dist/chunk-GETQWOTI.js.map +0 -1
  558. package/dist/chunk-GQXPBF7Z.mjs +0 -972
  559. package/dist/chunk-GQXPBF7Z.mjs.map +0 -1
  560. package/dist/chunk-H73GATCU.js +0 -185
  561. package/dist/chunk-H73GATCU.js.map +0 -1
  562. package/dist/chunk-HPUQYDVC.js +0 -1
  563. package/dist/chunk-HPUQYDVC.js.map +0 -1
  564. package/dist/chunk-IBRESN2U.js +0 -231
  565. package/dist/chunk-IBRESN2U.js.map +0 -1
  566. package/dist/chunk-IDO4JFV5.mjs +0 -1
  567. package/dist/chunk-IDO4JFV5.mjs.map +0 -1
  568. package/dist/chunk-IG3KWCQU.js +0 -25
  569. package/dist/chunk-IG3KWCQU.js.map +0 -1
  570. package/dist/chunk-IGY2S5BC.js +0 -36
  571. package/dist/chunk-IGY2S5BC.js.map +0 -1
  572. package/dist/chunk-IKWNHNJQ.mjs +0 -8
  573. package/dist/chunk-IKWNHNJQ.mjs.map +0 -1
  574. package/dist/chunk-ILPTPB4U.mjs +0 -221
  575. package/dist/chunk-ILPTPB4U.mjs.map +0 -1
  576. package/dist/chunk-IOMDG67D.mjs +0 -7
  577. package/dist/chunk-IOMDG67D.mjs.map +0 -1
  578. package/dist/chunk-IPI7BAW3.js +0 -1
  579. package/dist/chunk-IPI7BAW3.js.map +0 -1
  580. package/dist/chunk-J4D2NH6Y.mjs +0 -178
  581. package/dist/chunk-J4D2NH6Y.mjs.map +0 -1
  582. package/dist/chunk-JQ7WKFCI.mjs +0 -1
  583. package/dist/chunk-JQ7WKFCI.mjs.map +0 -1
  584. package/dist/chunk-KCWTVLMK.mjs +0 -48
  585. package/dist/chunk-KCWTVLMK.mjs.map +0 -1
  586. package/dist/chunk-KWTSMLND.js +0 -29
  587. package/dist/chunk-KWTSMLND.js.map +0 -1
  588. package/dist/chunk-LGXHJ24K.js +0 -92
  589. package/dist/chunk-LGXHJ24K.js.map +0 -1
  590. package/dist/chunk-LYEXYTOI.js +0 -14
  591. package/dist/chunk-LYEXYTOI.js.map +0 -1
  592. package/dist/chunk-NOYP2T77.js +0 -221
  593. package/dist/chunk-NOYP2T77.js.map +0 -1
  594. package/dist/chunk-ODI2BTKS.mjs +0 -55
  595. package/dist/chunk-ODI2BTKS.mjs.map +0 -1
  596. package/dist/chunk-PNCS6GEX.mjs +0 -1
  597. package/dist/chunk-PNCS6GEX.mjs.map +0 -1
  598. package/dist/chunk-PROWNV4M.js +0 -1
  599. package/dist/chunk-PROWNV4M.js.map +0 -1
  600. package/dist/chunk-QB5IFRLA.mjs +0 -1
  601. package/dist/chunk-QB5IFRLA.mjs.map +0 -1
  602. package/dist/chunk-QOG3RCXM.js +0 -67
  603. package/dist/chunk-QOG3RCXM.js.map +0 -1
  604. package/dist/chunk-QY4UST5V.js +0 -37
  605. package/dist/chunk-QY4UST5V.js.map +0 -1
  606. package/dist/chunk-RAUV5UV4.mjs +0 -1
  607. package/dist/chunk-RAUV5UV4.mjs.map +0 -1
  608. package/dist/chunk-SHXD7RLQ.mjs +0 -885
  609. package/dist/chunk-SHXD7RLQ.mjs.map +0 -1
  610. package/dist/chunk-TLX5QQK5.js +0 -9
  611. package/dist/chunk-TLX5QQK5.js.map +0 -1
  612. package/dist/chunk-U5UIDVOO.mjs +0 -36
  613. package/dist/chunk-U5UIDVOO.mjs.map +0 -1
  614. package/dist/chunk-U74Q3BRP.mjs +0 -1
  615. package/dist/chunk-U74Q3BRP.mjs.map +0 -1
  616. package/dist/chunk-V5HMYDWE.js +0 -1
  617. package/dist/chunk-V5HMYDWE.js.map +0 -1
  618. package/dist/chunk-V6P5JEPT.js +0 -178
  619. package/dist/chunk-V6P5JEPT.js.map +0 -1
  620. package/dist/chunk-W73MLJQ2.js +0 -118
  621. package/dist/chunk-W73MLJQ2.js.map +0 -1
  622. package/dist/chunk-WGGW6VCR.mjs +0 -149
  623. package/dist/chunk-WGGW6VCR.mjs.map +0 -1
  624. package/dist/chunk-WRYFIWNK.js +0 -1
  625. package/dist/chunk-WRYFIWNK.js.map +0 -1
  626. package/dist/chunk-X42WN3FE.mjs +0 -29
  627. package/dist/chunk-X42WN3FE.mjs.map +0 -1
  628. package/dist/chunk-XZEVRYUE.js +0 -1
  629. package/dist/chunk-XZEVRYUE.js.map +0 -1
  630. package/dist/chunk-YHVXD5WW.mjs +0 -96
  631. package/dist/chunk-YHVXD5WW.mjs.map +0 -1
  632. package/dist/chunk-YZYQYIKS.mjs +0 -67
  633. package/dist/chunk-YZYQYIKS.mjs.map +0 -1
  634. package/dist/chunk-ZBNBZN5H.js +0 -1
  635. package/dist/chunk-ZBNBZN5H.js.map +0 -1
  636. package/dist/chunk-ZHAD55AN.mjs +0 -37
  637. package/dist/chunk-ZHAD55AN.mjs.map +0 -1
  638. package/dist/chunk-ZOI74Y33.mjs +0 -231
  639. package/dist/chunk-ZOI74Y33.mjs.map +0 -1
  640. package/dist/chunk-ZV3DFBO4.js +0 -1
  641. package/dist/chunk-ZV3DFBO4.js.map +0 -1
  642. package/dist/chunk-ZYPKL4AF.js +0 -972
  643. package/dist/chunk-ZYPKL4AF.js.map +0 -1
  644. package/dist/index.js +0 -46
  645. package/dist/index.js.map +0 -1
  646. package/dist/shared/to-raw-notification.js +0 -8
  647. package/dist/shared/to-raw-notification.js.map +0 -1
  648. package/dist/tsconfig.build.tsbuildinfo +0 -1
  649. package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +0 -1
  650. package/dist/types/NotificationServicesController/__fixtures__/index.d.ts +0 -6
  651. package/dist/types/NotificationServicesController/__fixtures__/index.d.ts.map +0 -1
  652. package/dist/types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts.map +0 -1
  653. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts.map +0 -1
  654. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts.map +0 -1
  655. package/dist/types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts.map +0 -1
  656. package/dist/types/NotificationServicesController/__fixtures__/mockResponses.d.ts.map +0 -1
  657. package/dist/types/NotificationServicesController/__fixtures__/mockServices.d.ts.map +0 -1
  658. package/dist/types/NotificationServicesController/__fixtures__/test-utils.d.ts.map +0 -1
  659. package/dist/types/NotificationServicesController/constants/constants.d.ts.map +0 -1
  660. package/dist/types/NotificationServicesController/constants/index.d.ts +0 -3
  661. package/dist/types/NotificationServicesController/constants/index.d.ts.map +0 -1
  662. package/dist/types/NotificationServicesController/constants/notification-schema.d.ts.map +0 -1
  663. package/dist/types/NotificationServicesController/index.d.ts +0 -14
  664. package/dist/types/NotificationServicesController/index.d.ts.map +0 -1
  665. package/dist/types/NotificationServicesController/processors/index.d.ts +0 -4
  666. package/dist/types/NotificationServicesController/processors/index.d.ts.map +0 -1
  667. package/dist/types/NotificationServicesController/processors/process-feature-announcement.d.ts.map +0 -1
  668. package/dist/types/NotificationServicesController/processors/process-notifications.d.ts.map +0 -1
  669. package/dist/types/NotificationServicesController/processors/process-onchain-notifications.d.ts.map +0 -1
  670. package/dist/types/NotificationServicesController/services/feature-announcements.d.ts.map +0 -1
  671. package/dist/types/NotificationServicesController/services/onchain-notifications.d.ts.map +0 -1
  672. package/dist/types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts.map +0 -1
  673. package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts +0 -4
  674. package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts.map +0 -1
  675. package/dist/types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts.map +0 -1
  676. package/dist/types/NotificationServicesController/types/feature-announcement/type-links.d.ts.map +0 -1
  677. package/dist/types/NotificationServicesController/types/index.d.ts +0 -5
  678. package/dist/types/NotificationServicesController/types/index.d.ts.map +0 -1
  679. package/dist/types/NotificationServicesController/types/notification/index.d.ts +0 -2
  680. package/dist/types/NotificationServicesController/types/notification/index.d.ts.map +0 -1
  681. package/dist/types/NotificationServicesController/types/notification/notification.d.ts.map +0 -1
  682. package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts +0 -2
  683. package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts.map +0 -1
  684. package/dist/types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts.map +0 -1
  685. package/dist/types/NotificationServicesController/types/on-chain-notification/schema.d.ts.map +0 -1
  686. package/dist/types/NotificationServicesController/types/type-utils.d.ts.map +0 -1
  687. package/dist/types/NotificationServicesController/types/user-storage/index.d.ts +0 -2
  688. package/dist/types/NotificationServicesController/types/user-storage/index.d.ts.map +0 -1
  689. package/dist/types/NotificationServicesController/types/user-storage/user-storage.d.ts.map +0 -1
  690. package/dist/types/NotificationServicesController/ui/constants.d.ts.map +0 -1
  691. package/dist/types/NotificationServicesController/ui/index.d.ts +0 -2
  692. package/dist/types/NotificationServicesController/ui/index.d.ts.map +0 -1
  693. package/dist/types/NotificationServicesController/utils/utils.d.ts.map +0 -1
  694. package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +0 -1
  695. package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts +0 -2
  696. package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts.map +0 -1
  697. package/dist/types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts.map +0 -1
  698. package/dist/types/NotificationServicesPushController/__fixtures__/mockServices.d.ts.map +0 -1
  699. package/dist/types/NotificationServicesPushController/constants.d.ts.map +0 -1
  700. package/dist/types/NotificationServicesPushController/index.d.ts +0 -11
  701. package/dist/types/NotificationServicesPushController/index.d.ts.map +0 -1
  702. package/dist/types/NotificationServicesPushController/services/endpoints.d.ts.map +0 -1
  703. package/dist/types/NotificationServicesPushController/services/push/index.d.ts.map +0 -1
  704. package/dist/types/NotificationServicesPushController/services/push/push-web.d.ts.map +0 -1
  705. package/dist/types/NotificationServicesPushController/services/services.d.ts.map +0 -1
  706. package/dist/types/NotificationServicesPushController/types/firebase.d.ts.map +0 -1
  707. package/dist/types/NotificationServicesPushController/types/index.d.ts +0 -2
  708. package/dist/types/NotificationServicesPushController/types/index.d.ts.map +0 -1
  709. package/dist/types/NotificationServicesPushController/utils/get-notification-data.d.ts.map +0 -1
  710. package/dist/types/NotificationServicesPushController/utils/get-notification-message.d.ts.map +0 -1
  711. package/dist/types/NotificationServicesPushController/utils/index.d.ts +0 -3
  712. package/dist/types/NotificationServicesPushController/utils/index.d.ts.map +0 -1
  713. package/dist/types/index.d.ts +0 -3
  714. package/dist/types/index.d.ts.map +0 -1
  715. package/dist/types/shared/to-raw-notification.d.ts.map +0 -1
@@ -1,231 +0,0 @@
1
- import {
2
- activatePushNotifications,
3
- deactivatePushNotifications,
4
- listenToPushNotifications,
5
- updateTriggerPushNotifications
6
- } from "./chunk-WGGW6VCR.mjs";
7
- import {
8
- createRegToken,
9
- deleteRegToken
10
- } from "./chunk-YHVXD5WW.mjs";
11
- import {
12
- __privateAdd,
13
- __privateGet,
14
- __privateMethod,
15
- __privateSet
16
- } from "./chunk-U5UIDVOO.mjs";
17
-
18
- // src/NotificationServicesPushController/NotificationServicesPushController.ts
19
- import { BaseController } from "@metamask/base-controller";
20
- import log from "loglevel";
21
- var controllerName = "NotificationServicesPushController";
22
- var defaultState = {
23
- fcmToken: ""
24
- };
25
- var metadata = {
26
- fcmToken: {
27
- persist: true,
28
- anonymous: true
29
- }
30
- };
31
- var _pushListenerUnsubscribe, _env, _config, _registerMessageHandlers, registerMessageHandlers_fn, _getAndAssertBearerToken, getAndAssertBearerToken_fn;
32
- var NotificationServicesPushController = class extends BaseController {
33
- constructor({
34
- messenger,
35
- state,
36
- env,
37
- config
38
- }) {
39
- super({
40
- messenger,
41
- metadata,
42
- name: controllerName,
43
- state: { ...defaultState, ...state }
44
- });
45
- __privateAdd(this, _registerMessageHandlers);
46
- __privateAdd(this, _getAndAssertBearerToken);
47
- __privateAdd(this, _pushListenerUnsubscribe, void 0);
48
- __privateAdd(this, _env, void 0);
49
- __privateAdd(this, _config, void 0);
50
- __privateSet(this, _env, env);
51
- __privateSet(this, _config, config);
52
- __privateMethod(this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
53
- }
54
- async subscribeToPushNotifications() {
55
- if (__privateGet(this, _pushListenerUnsubscribe)) {
56
- __privateGet(this, _pushListenerUnsubscribe).call(this);
57
- __privateSet(this, _pushListenerUnsubscribe, void 0);
58
- }
59
- try {
60
- __privateSet(this, _pushListenerUnsubscribe, await listenToPushNotifications({
61
- env: __privateGet(this, _env),
62
- listenToPushReceived: async (n) => {
63
- this.messagingSystem.publish(
64
- "NotificationServicesPushController:onNewNotifications",
65
- n
66
- );
67
- await __privateGet(this, _config).onPushNotificationReceived(n);
68
- },
69
- listenToPushClicked: (e, n) => {
70
- if (n) {
71
- this.messagingSystem.publish(
72
- "NotificationServicesPushController:pushNotificationClicked",
73
- n
74
- );
75
- }
76
- __privateGet(this, _config).onPushNotificationClicked(e, n);
77
- }
78
- }));
79
- } catch (e) {
80
- }
81
- }
82
- /**
83
- * Enables push notifications for the application.
84
- *
85
- * This method sets up the necessary infrastructure for handling push notifications by:
86
- * 1. Registering the service worker to listen for messages.
87
- * 2. Fetching the Firebase Cloud Messaging (FCM) token from Firebase.
88
- * 3. Sending the FCM token to the server responsible for sending notifications, to register the device.
89
- *
90
- * @param UUIDs - An array of UUIDs to enable push notifications for.
91
- */
92
- async enablePushNotifications(UUIDs) {
93
- if (!__privateGet(this, _config).isPushEnabled) {
94
- return;
95
- }
96
- try {
97
- const bearerToken = await __privateMethod(this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this).catch(
98
- () => null
99
- );
100
- if (bearerToken) {
101
- const regToken = await activatePushNotifications({
102
- bearerToken,
103
- triggers: UUIDs,
104
- env: __privateGet(this, _env),
105
- createRegToken,
106
- platform: __privateGet(this, _config).platform
107
- }).catch(() => null);
108
- if (regToken) {
109
- this.update((state) => {
110
- state.fcmToken = regToken;
111
- });
112
- }
113
- }
114
- } catch {
115
- }
116
- await this.subscribeToPushNotifications();
117
- }
118
- /**
119
- * Disables push notifications for the application.
120
- * This method handles the process of disabling push notifications by:
121
- * 1. Unregistering the service worker to stop listening for messages.
122
- * 2. Sending a request to the server to unregister the device using the FCM token.
123
- * 3. Removing the FCM token from the state to complete the process.
124
- *
125
- * @param UUIDs - An array of UUIDs for which push notifications should be disabled.
126
- */
127
- async disablePushNotifications(UUIDs) {
128
- var _a;
129
- if (!__privateGet(this, _config).isPushEnabled) {
130
- return;
131
- }
132
- const bearerToken = await __privateMethod(this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
133
- let isPushNotificationsDisabled;
134
- try {
135
- isPushNotificationsDisabled = await deactivatePushNotifications({
136
- bearerToken,
137
- triggers: UUIDs,
138
- env: __privateGet(this, _env),
139
- deleteRegToken,
140
- regToken: this.state.fcmToken
141
- });
142
- } catch (error) {
143
- const errorMessage = `Failed to disable push notifications: ${error}`;
144
- log.error(errorMessage);
145
- throw new Error(errorMessage);
146
- }
147
- if (!isPushNotificationsDisabled) {
148
- return;
149
- }
150
- (_a = __privateGet(this, _pushListenerUnsubscribe)) == null ? void 0 : _a.call(this);
151
- if (isPushNotificationsDisabled) {
152
- this.update((state) => {
153
- state.fcmToken = "";
154
- });
155
- }
156
- }
157
- /**
158
- * Updates the triggers for push notifications.
159
- * This method is responsible for updating the server with the new set of UUIDs that should trigger push notifications.
160
- * It uses the current FCM token and a BearerToken for authentication.
161
- *
162
- * @param UUIDs - An array of UUIDs that should trigger push notifications.
163
- */
164
- async updateTriggerPushNotifications(UUIDs) {
165
- if (!__privateGet(this, _config).isPushEnabled) {
166
- return;
167
- }
168
- const bearerToken = await __privateMethod(this, _getAndAssertBearerToken, getAndAssertBearerToken_fn).call(this);
169
- try {
170
- const { fcmToken } = await updateTriggerPushNotifications({
171
- bearerToken,
172
- triggers: UUIDs,
173
- env: __privateGet(this, _env),
174
- createRegToken,
175
- deleteRegToken,
176
- platform: __privateGet(this, _config).platform,
177
- regToken: this.state.fcmToken
178
- });
179
- if (fcmToken) {
180
- this.update((state) => {
181
- state.fcmToken = fcmToken;
182
- });
183
- }
184
- } catch (error) {
185
- const errorMessage = `Failed to update triggers for push notifications: ${error}`;
186
- log.error(errorMessage);
187
- throw new Error(errorMessage);
188
- }
189
- }
190
- };
191
- _pushListenerUnsubscribe = new WeakMap();
192
- _env = new WeakMap();
193
- _config = new WeakMap();
194
- _registerMessageHandlers = new WeakSet();
195
- registerMessageHandlers_fn = function() {
196
- this.messagingSystem.registerActionHandler(
197
- "NotificationServicesPushController:enablePushNotifications",
198
- this.enablePushNotifications.bind(this)
199
- );
200
- this.messagingSystem.registerActionHandler(
201
- "NotificationServicesPushController:disablePushNotifications",
202
- this.disablePushNotifications.bind(this)
203
- );
204
- this.messagingSystem.registerActionHandler(
205
- "NotificationServicesPushController:updateTriggerPushNotifications",
206
- this.updateTriggerPushNotifications.bind(this)
207
- );
208
- this.messagingSystem.registerActionHandler(
209
- "NotificationServicesPushController:subscribeToPushNotifications",
210
- this.subscribeToPushNotifications.bind(this)
211
- );
212
- };
213
- _getAndAssertBearerToken = new WeakSet();
214
- getAndAssertBearerToken_fn = async function() {
215
- const bearerToken = await this.messagingSystem.call(
216
- "AuthenticationController:getBearerToken"
217
- );
218
- if (!bearerToken) {
219
- log.error(
220
- "Failed to enable push notifications: BearerToken token is missing."
221
- );
222
- throw new Error("BearerToken token is missing");
223
- }
224
- return bearerToken;
225
- };
226
-
227
- export {
228
- defaultState,
229
- NotificationServicesPushController
230
- };
231
- //# sourceMappingURL=chunk-ZOI74Y33.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/NotificationServicesPushController/NotificationServicesPushController.ts"],"sourcesContent":["import type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport type { Types } from '../NotificationServicesController';\nimport { createRegToken, deleteRegToken } from './services/push/push-web';\nimport {\n activatePushNotifications,\n deactivatePushNotifications,\n listenToPushNotifications,\n updateTriggerPushNotifications,\n} from './services/services';\nimport type { PushNotificationEnv } from './types';\n\nconst controllerName = 'NotificationServicesPushController';\n\nexport type NotificationServicesPushControllerState = {\n fcmToken: string;\n};\n\nexport type NotificationServicesPushControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n NotificationServicesPushControllerState\n >;\n\nexport type NotificationServicesPushControllerEnablePushNotificationsAction = {\n type: `${typeof controllerName}:enablePushNotifications`;\n handler: NotificationServicesPushController['enablePushNotifications'];\n};\nexport type NotificationServicesPushControllerDisablePushNotificationsAction = {\n type: `${typeof controllerName}:disablePushNotifications`;\n handler: NotificationServicesPushController['disablePushNotifications'];\n};\nexport type NotificationServicesPushControllerUpdateTriggerPushNotificationsAction =\n {\n type: `${typeof controllerName}:updateTriggerPushNotifications`;\n handler: NotificationServicesPushController['updateTriggerPushNotifications'];\n };\nexport type NotificationServicesPushControllerSubscribeToNotificationsAction = {\n type: `${typeof controllerName}:subscribeToPushNotifications`;\n handler: NotificationServicesPushController['subscribeToPushNotifications'];\n};\n\nexport type Actions =\n | NotificationServicesPushControllerGetStateAction\n | NotificationServicesPushControllerEnablePushNotificationsAction\n | NotificationServicesPushControllerDisablePushNotificationsAction\n | NotificationServicesPushControllerUpdateTriggerPushNotificationsAction\n | NotificationServicesPushControllerSubscribeToNotificationsAction;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type NotificationServicesPushControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n NotificationServicesPushControllerState\n >;\n\nexport type NotificationServicesPushControllerOnNewNotificationEvent = {\n type: `${typeof controllerName}:onNewNotifications`;\n payload: [Types.INotification];\n};\n\nexport type NotificationServicesPushControllerPushNotificationClickedEvent = {\n type: `${typeof controllerName}:pushNotificationClicked`;\n payload: [Types.INotification];\n};\n\nexport type Events =\n | NotificationServicesPushControllerStateChangeEvent\n | NotificationServicesPushControllerOnNewNotificationEvent\n | NotificationServicesPushControllerPushNotificationClickedEvent;\n\nexport type AllowedEvents = never;\n\nexport type NotificationServicesPushControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n >;\n\nexport const defaultState: NotificationServicesPushControllerState = {\n fcmToken: '',\n};\nconst metadata: StateMetadata<NotificationServicesPushControllerState> = {\n fcmToken: {\n persist: true,\n anonymous: true,\n },\n};\n\ntype ControllerConfig = {\n /**\n * Config to turn on/off push notifications.\n * This is currently linked to MV3 builds on extension.\n */\n isPushEnabled: boolean;\n\n /**\n * Must handle when a push notification is received.\n * You must call `registration.showNotification` or equivalent to show the notification on web/mobile\n */\n onPushNotificationReceived: (\n notification: Types.INotification,\n ) => void | Promise<void>;\n\n /**\n * Must handle when a push notification is clicked.\n * You must call `event.notification.close();` or equivalent for closing and opening notification in a new window.\n */\n onPushNotificationClicked: (\n event: NotificationEvent,\n notification?: Types.INotification,\n ) => void;\n\n /**\n * determine the config used for push notification services\n */\n platform: 'extension' | 'mobile';\n};\n\n/**\n * Manages push notifications for the application, including enabling, disabling, and updating triggers for push notifications.\n * This controller integrates with Firebase Cloud Messaging (FCM) to handle the registration and management of push notifications.\n * It is responsible for registering and unregistering the service worker that listens for push notifications,\n * managing the FCM token, and communicating with the server to register or unregister the device for push notifications.\n * Additionally, it provides functionality to update the server with new UUIDs that should trigger push notifications.\n *\n * @augments {BaseController<typeof controllerName, NotificationServicesPushControllerState, NotificationServicesPushControllerMessenger>}\n */\nexport default class NotificationServicesPushController extends BaseController<\n typeof controllerName,\n NotificationServicesPushControllerState,\n NotificationServicesPushControllerMessenger\n> {\n #pushListenerUnsubscribe: (() => void) | undefined = undefined;\n\n #env: PushNotificationEnv;\n\n #config: ControllerConfig;\n\n constructor({\n messenger,\n state,\n env,\n config,\n }: {\n messenger: NotificationServicesPushControllerMessenger;\n state: NotificationServicesPushControllerState;\n env: PushNotificationEnv;\n config: ControllerConfig;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#env = env;\n this.#config = config;\n\n this.#registerMessageHandlers();\n }\n\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:enablePushNotifications',\n this.enablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:disablePushNotifications',\n this.disablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:updateTriggerPushNotifications',\n this.updateTriggerPushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:subscribeToPushNotifications',\n this.subscribeToPushNotifications.bind(this),\n );\n }\n\n async #getAndAssertBearerToken() {\n const bearerToken = await this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n );\n if (!bearerToken) {\n log.error(\n 'Failed to enable push notifications: BearerToken token is missing.',\n );\n throw new Error('BearerToken token is missing');\n }\n\n return bearerToken;\n }\n\n async subscribeToPushNotifications() {\n if (this.#pushListenerUnsubscribe) {\n this.#pushListenerUnsubscribe();\n this.#pushListenerUnsubscribe = undefined;\n }\n\n try {\n this.#pushListenerUnsubscribe = await listenToPushNotifications({\n env: this.#env,\n listenToPushReceived: async (n) => {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:onNewNotifications',\n n,\n );\n await this.#config.onPushNotificationReceived(n);\n },\n listenToPushClicked: (e, n) => {\n if (n) {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:pushNotificationClicked',\n n,\n );\n }\n\n this.#config.onPushNotificationClicked(e, n);\n },\n });\n } catch (e) {\n // Do nothing, we are silently failing if push notification registration fails\n }\n }\n\n /**\n * Enables push notifications for the application.\n *\n * This method sets up the necessary infrastructure for handling push notifications by:\n * 1. Registering the service worker to listen for messages.\n * 2. Fetching the Firebase Cloud Messaging (FCM) token from Firebase.\n * 3. Sending the FCM token to the server responsible for sending notifications, to register the device.\n *\n * @param UUIDs - An array of UUIDs to enable push notifications for.\n */\n async enablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n // Handle creating new reg token (if available)\n try {\n const bearerToken = await this.#getAndAssertBearerToken().catch(\n () => null,\n );\n\n // If there is a bearer token, lets try to refresh/create new reg token\n if (bearerToken) {\n // Activate Push Notifications\n const regToken = await activatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n platform: this.#config.platform,\n }).catch(() => null);\n\n if (regToken) {\n this.update((state) => {\n state.fcmToken = regToken;\n });\n }\n }\n } catch {\n // Do nothing, we are silently failing\n }\n\n // New token created, (re)subscribe to push notifications\n await this.subscribeToPushNotifications();\n }\n\n /**\n * Disables push notifications for the application.\n * This method handles the process of disabling push notifications by:\n * 1. Unregistering the service worker to stop listening for messages.\n * 2. Sending a request to the server to unregister the device using the FCM token.\n * 3. Removing the FCM token from the state to complete the process.\n *\n * @param UUIDs - An array of UUIDs for which push notifications should be disabled.\n */\n async disablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n let isPushNotificationsDisabled: boolean;\n\n try {\n // Send a request to the server to unregister the token/device\n isPushNotificationsDisabled = await deactivatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n deleteRegToken,\n regToken: this.state.fcmToken,\n });\n } catch (error) {\n const errorMessage = `Failed to disable push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n // Remove the FCM token from the state\n if (!isPushNotificationsDisabled) {\n return;\n }\n\n // Unsubscribe from push notifications\n this.#pushListenerUnsubscribe?.();\n\n // Update State\n if (isPushNotificationsDisabled) {\n this.update((state) => {\n state.fcmToken = '';\n });\n }\n }\n\n /**\n * Updates the triggers for push notifications.\n * This method is responsible for updating the server with the new set of UUIDs that should trigger push notifications.\n * It uses the current FCM token and a BearerToken for authentication.\n *\n * @param UUIDs - An array of UUIDs that should trigger push notifications.\n */\n async updateTriggerPushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n\n try {\n const { fcmToken } = await updateTriggerPushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n deleteRegToken,\n platform: this.#config.platform,\n regToken: this.state.fcmToken,\n });\n\n // update the state with the new FCM token\n if (fcmToken) {\n this.update((state) => {\n state.fcmToken = fcmToken;\n });\n }\n } catch (error) {\n const errorMessage = `Failed to update triggers for push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,SAAS,sBAAsB;AAE/B,OAAO,SAAS;AAYhB,IAAM,iBAAiB;AAwEhB,IAAM,eAAwD;AAAA,EACnE,UAAU;AACZ;AACA,IAAM,WAAmE;AAAA,EACvE,UAAU;AAAA,IACR,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;AApGA;AA6IA,IAAqB,qCAArB,cAAgE,eAI9D;AAAA,EAOA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,OAAO,EAAE,GAAG,cAAc,GAAG,MAAM;AAAA,IACrC,CAAC;AAQH;AAmBA,uBAAM;AAjDN,iDAAqD;AAErD;AAEA;AAoBE,uBAAK,MAAO;AACZ,uBAAK,SAAU;AAEf,0BAAK,sDAAL;AAAA,EACF;AAAA,EAmCA,MAAM,+BAA+B;AACnC,QAAI,mBAAK,2BAA0B;AACjC,yBAAK,0BAAL;AACA,yBAAK,0BAA2B;AAAA,IAClC;AAEA,QAAI;AACF,yBAAK,0BAA2B,MAAM,0BAA0B;AAAA,QAC9D,KAAK,mBAAK;AAAA,QACV,sBAAsB,OAAO,MAAM;AACjC,eAAK,gBAAgB;AAAA,YACnB;AAAA,YACA;AAAA,UACF;AACA,gBAAM,mBAAK,SAAQ,2BAA2B,CAAC;AAAA,QACjD;AAAA,QACA,qBAAqB,CAAC,GAAG,MAAM;AAC7B,cAAI,GAAG;AACL,iBAAK,gBAAgB;AAAA,cACnB;AAAA,cACA;AAAA,YACF;AAAA,UACF;AAEA,6BAAK,SAAQ,0BAA0B,GAAG,CAAC;AAAA,QAC7C;AAAA,MACF,CAAC;AAAA,IACH,SAAS,GAAG;AAAA,IAEZ;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,wBAAwB,OAAiB;AAC7C,QAAI,CAAC,mBAAK,SAAQ,eAAe;AAC/B;AAAA,IACF;AAGA,QAAI;AACF,YAAM,cAAc,MAAM,sBAAK,sDAAL,WAAgC;AAAA,QACxD,MAAM;AAAA,MACR;AAGA,UAAI,aAAa;AAEf,cAAM,WAAW,MAAM,0BAA0B;AAAA,UAC/C;AAAA,UACA,UAAU;AAAA,UACV,KAAK,mBAAK;AAAA,UACV;AAAA,UACA,UAAU,mBAAK,SAAQ;AAAA,QACzB,CAAC,EAAE,MAAM,MAAM,IAAI;AAEnB,YAAI,UAAU;AACZ,eAAK,OAAO,CAAC,UAAU;AACrB,kBAAM,WAAW;AAAA,UACnB,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF,QAAQ;AAAA,IAER;AAGA,UAAM,KAAK,6BAA6B;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,yBAAyB,OAAiB;AAxSlD;AAySI,QAAI,CAAC,mBAAK,SAAQ,eAAe;AAC/B;AAAA,IACF;AAEA,UAAM,cAAc,MAAM,sBAAK,sDAAL;AAC1B,QAAI;AAEJ,QAAI;AAEF,oCAA8B,MAAM,4BAA4B;AAAA,QAC9D;AAAA,QACA,UAAU;AAAA,QACV,KAAK,mBAAK;AAAA,QACV;AAAA,QACA,UAAU,KAAK,MAAM;AAAA,MACvB,CAAC;AAAA,IACH,SAAS,OAAO;AACd,YAAM,eAAe,yCACnB,KACF;AACA,UAAI,MAAM,YAAY;AACtB,YAAM,IAAI,MAAM,YAAY;AAAA,IAC9B;AAGA,QAAI,CAAC,6BAA6B;AAChC;AAAA,IACF;AAGA,6BAAK,8BAAL;AAGA,QAAI,6BAA6B;AAC/B,WAAK,OAAO,CAAC,UAAU;AACrB,cAAM,WAAW;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,+BAA+B,OAAiB;AACpD,QAAI,CAAC,mBAAK,SAAQ,eAAe;AAC/B;AAAA,IACF;AAEA,UAAM,cAAc,MAAM,sBAAK,sDAAL;AAE1B,QAAI;AACF,YAAM,EAAE,SAAS,IAAI,MAAM,+BAA+B;AAAA,QACxD;AAAA,QACA,UAAU;AAAA,QACV,KAAK,mBAAK;AAAA,QACV;AAAA,QACA;AAAA,QACA,UAAU,mBAAK,SAAQ;AAAA,QACvB,UAAU,KAAK,MAAM;AAAA,MACvB,CAAC;AAGD,UAAI,UAAU;AACZ,aAAK,OAAO,CAAC,UAAU;AACrB,gBAAM,WAAW;AAAA,QACnB,CAAC;AAAA,MACH;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,qDACnB,KACF;AACA,UAAI,MAAM,YAAY;AACtB,YAAM,IAAI,MAAM,YAAY;AAAA,IAC9B;AAAA,EACF;AACF;AAtOE;AAEA;AAEA;AA0BA;AAAA,6BAAwB,WAAS;AAC/B,OAAK,gBAAgB;AAAA,IACnB;AAAA,IACA,KAAK,wBAAwB,KAAK,IAAI;AAAA,EACxC;AACA,OAAK,gBAAgB;AAAA,IACnB;AAAA,IACA,KAAK,yBAAyB,KAAK,IAAI;AAAA,EACzC;AACA,OAAK,gBAAgB;AAAA,IACnB;AAAA,IACA,KAAK,+BAA+B,KAAK,IAAI;AAAA,EAC/C;AACA,OAAK,gBAAgB;AAAA,IACnB;AAAA,IACA,KAAK,6BAA6B,KAAK,IAAI;AAAA,EAC7C;AACF;AAEM;AAAA,6BAAwB,iBAAG;AAC/B,QAAM,cAAc,MAAM,KAAK,gBAAgB;AAAA,IAC7C;AAAA,EACF;AACA,MAAI,CAAC,aAAa;AAChB,QAAI;AAAA,MACF;AAAA,IACF;AACA,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AAEA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- "use strict";//# sourceMappingURL=chunk-ZV3DFBO4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}