@metamask-previews/notification-services-controller 27.0.2-preview-6eff555ee → 28.0.0-preview-0a30e47

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 (657) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/dist/NotificationServicesController/{NotificationServicesController-method-action-types.d.mts → NotificationServicesController-method-action-types.d.ts} +2 -2
  3. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.ts.map +1 -0
  4. package/dist/NotificationServicesController/{NotificationServicesController-method-action-types.mjs → NotificationServicesController-method-action-types.js} +1 -1
  5. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.js.map +1 -0
  6. package/dist/NotificationServicesController/{NotificationServicesController.d.cts → NotificationServicesController.d.ts} +15 -15
  7. package/dist/NotificationServicesController/NotificationServicesController.d.ts.map +1 -0
  8. package/dist/NotificationServicesController/{NotificationServicesController.mjs → NotificationServicesController.js} +411 -386
  9. package/dist/NotificationServicesController/NotificationServicesController.js.map +1 -0
  10. package/dist/NotificationServicesController/constants/index.d.ts +2 -0
  11. package/dist/NotificationServicesController/constants/index.d.ts.map +1 -0
  12. package/dist/NotificationServicesController/constants/index.js +2 -0
  13. package/dist/NotificationServicesController/constants/index.js.map +1 -0
  14. package/dist/NotificationServicesController/constants/{notification-schema.d.cts → notification-schema.d.ts} +1 -1
  15. package/dist/NotificationServicesController/constants/notification-schema.d.ts.map +1 -0
  16. package/dist/NotificationServicesController/constants/{notification-schema.mjs → notification-schema.js} +1 -1
  17. package/dist/NotificationServicesController/constants/notification-schema.js.map +1 -0
  18. package/dist/NotificationServicesController/{index.d.cts → index.d.ts} +14 -14
  19. package/dist/NotificationServicesController/index.d.ts.map +1 -0
  20. package/dist/NotificationServicesController/index.js +13 -0
  21. package/dist/NotificationServicesController/index.js.map +1 -0
  22. package/dist/NotificationServicesController/mocks/index.d.ts +5 -0
  23. package/dist/NotificationServicesController/mocks/index.d.ts.map +1 -0
  24. package/dist/NotificationServicesController/mocks/index.js +5 -0
  25. package/dist/NotificationServicesController/mocks/index.js.map +1 -0
  26. package/dist/NotificationServicesController/mocks/{mock-feature-announcements.d.cts → mock-feature-announcements.d.ts} +3 -3
  27. package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.ts.map +1 -0
  28. package/dist/NotificationServicesController/mocks/{mock-feature-announcements.mjs → mock-feature-announcements.js} +2 -2
  29. package/dist/NotificationServicesController/mocks/mock-feature-announcements.js.map +1 -0
  30. package/dist/NotificationServicesController/mocks/{mock-raw-notifications.d.cts → mock-raw-notifications.d.ts} +2 -2
  31. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.ts.map +1 -0
  32. package/dist/NotificationServicesController/mocks/{mock-raw-notifications.mjs → mock-raw-notifications.js} +2 -2
  33. package/dist/NotificationServicesController/mocks/mock-raw-notifications.js.map +1 -0
  34. package/dist/NotificationServicesController/mocks/{mock-snap-notification.d.cts → mock-snap-notification.d.ts} +2 -2
  35. package/dist/NotificationServicesController/mocks/mock-snap-notification.d.ts.map +1 -0
  36. package/dist/NotificationServicesController/mocks/{mock-snap-notification.mjs → mock-snap-notification.js} +2 -2
  37. package/dist/NotificationServicesController/mocks/mock-snap-notification.js.map +1 -0
  38. package/dist/NotificationServicesController/mocks/{mockResponses.d.cts → mockResponses.d.ts} +3 -3
  39. package/dist/NotificationServicesController/mocks/mockResponses.d.ts.map +1 -0
  40. package/dist/NotificationServicesController/mocks/{mockResponses.mjs → mockResponses.js} +6 -6
  41. package/dist/NotificationServicesController/mocks/mockResponses.js.map +1 -0
  42. package/dist/NotificationServicesController/processors/index.d.ts +4 -0
  43. package/dist/NotificationServicesController/processors/index.d.ts.map +1 -0
  44. package/dist/NotificationServicesController/processors/index.js +4 -0
  45. package/dist/NotificationServicesController/processors/index.js.map +1 -0
  46. package/dist/NotificationServicesController/processors/{process-api-notifications.d.cts → process-api-notifications.d.ts} +3 -3
  47. package/dist/NotificationServicesController/processors/process-api-notifications.d.ts.map +1 -0
  48. package/dist/NotificationServicesController/processors/{process-api-notifications.mjs → process-api-notifications.js} +3 -3
  49. package/dist/NotificationServicesController/processors/process-api-notifications.js.map +1 -0
  50. package/dist/NotificationServicesController/processors/{process-feature-announcement.d.mts → process-feature-announcement.d.ts} +3 -3
  51. package/dist/NotificationServicesController/processors/process-feature-announcement.d.ts.map +1 -0
  52. package/dist/NotificationServicesController/processors/{process-feature-announcement.mjs → process-feature-announcement.js} +3 -3
  53. package/dist/NotificationServicesController/processors/process-feature-announcement.js.map +1 -0
  54. package/dist/NotificationServicesController/processors/{process-notifications.d.cts → process-notifications.d.ts} +2 -2
  55. package/dist/NotificationServicesController/processors/process-notifications.d.ts.map +1 -0
  56. package/dist/NotificationServicesController/processors/{process-notifications.mjs → process-notifications.js} +5 -5
  57. package/dist/NotificationServicesController/processors/process-notifications.js.map +1 -0
  58. package/dist/NotificationServicesController/processors/{process-snap-notifications.d.cts → process-snap-notifications.d.ts} +3 -3
  59. package/dist/NotificationServicesController/processors/process-snap-notifications.d.ts.map +1 -0
  60. package/dist/NotificationServicesController/processors/{process-snap-notifications.mjs → process-snap-notifications.js} +3 -3
  61. package/dist/NotificationServicesController/processors/process-snap-notifications.js.map +1 -0
  62. package/dist/NotificationServicesController/services/{api-notifications.d.cts → api-notifications.d.ts} +2 -2
  63. package/dist/NotificationServicesController/services/api-notifications.d.ts.map +1 -0
  64. package/dist/NotificationServicesController/services/{api-notifications.mjs → api-notifications.js} +5 -12
  65. package/dist/NotificationServicesController/services/api-notifications.js.map +1 -0
  66. package/dist/NotificationServicesController/services/{feature-announcements.d.mts → feature-announcements.d.ts} +4 -4
  67. package/dist/NotificationServicesController/services/feature-announcements.d.ts.map +1 -0
  68. package/dist/NotificationServicesController/services/{feature-announcements.mjs → feature-announcements.js} +5 -5
  69. package/dist/NotificationServicesController/services/feature-announcements.js.map +1 -0
  70. package/dist/NotificationServicesController/services/{notification-config-cache.d.mts → notification-config-cache.d.ts} +1 -1
  71. package/dist/NotificationServicesController/services/notification-config-cache.d.ts.map +1 -0
  72. package/dist/NotificationServicesController/services/notification-config-cache.js +43 -0
  73. package/dist/NotificationServicesController/services/notification-config-cache.js.map +1 -0
  74. package/dist/NotificationServicesController/services/{perp-notifications.d.cts → perp-notifications.d.ts} +2 -2
  75. package/dist/NotificationServicesController/services/perp-notifications.d.ts.map +1 -0
  76. package/dist/NotificationServicesController/services/{perp-notifications.mjs → perp-notifications.js} +2 -2
  77. package/dist/NotificationServicesController/services/perp-notifications.js.map +1 -0
  78. package/dist/NotificationServicesController/types/feature-announcement/{feature-announcement.d.cts → feature-announcement.d.ts} +3 -3
  79. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts.map +1 -0
  80. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js +2 -0
  81. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js.map +1 -0
  82. package/dist/NotificationServicesController/types/feature-announcement/index.d.ts +4 -0
  83. package/dist/NotificationServicesController/types/feature-announcement/index.d.ts.map +1 -0
  84. package/dist/NotificationServicesController/types/feature-announcement/index.js +2 -0
  85. package/dist/NotificationServicesController/types/feature-announcement/index.js.map +1 -0
  86. package/dist/NotificationServicesController/types/feature-announcement/{type-feature-announcement.d.cts → type-feature-announcement.d.ts} +3 -3
  87. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts.map +1 -0
  88. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js +2 -0
  89. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js.map +1 -0
  90. package/dist/NotificationServicesController/types/feature-announcement/{type-links.d.cts → type-links.d.ts} +1 -1
  91. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.ts.map +1 -0
  92. package/dist/NotificationServicesController/types/feature-announcement/type-links.js +2 -0
  93. package/dist/NotificationServicesController/types/feature-announcement/type-links.js.map +1 -0
  94. package/dist/NotificationServicesController/types/index.d.ts +6 -0
  95. package/dist/NotificationServicesController/types/index.d.ts.map +1 -0
  96. package/dist/NotificationServicesController/types/index.js +2 -0
  97. package/dist/NotificationServicesController/types/index.js.map +1 -0
  98. package/dist/NotificationServicesController/types/notification/index.d.ts +2 -0
  99. package/dist/NotificationServicesController/types/notification/index.d.ts.map +1 -0
  100. package/dist/NotificationServicesController/types/notification/index.js +2 -0
  101. package/dist/NotificationServicesController/types/notification/index.js.map +1 -0
  102. package/dist/NotificationServicesController/types/notification/{notification.d.cts → notification.d.ts} +5 -5
  103. package/dist/NotificationServicesController/types/notification/notification.d.ts.map +1 -0
  104. package/dist/NotificationServicesController/types/notification/notification.js +2 -0
  105. package/dist/NotificationServicesController/types/notification/notification.js.map +1 -0
  106. package/dist/NotificationServicesController/types/notification-api/index.d.ts +3 -0
  107. package/dist/NotificationServicesController/types/notification-api/index.d.ts.map +1 -0
  108. package/dist/NotificationServicesController/types/notification-api/index.js +2 -0
  109. package/dist/NotificationServicesController/types/notification-api/index.js.map +1 -0
  110. package/dist/NotificationServicesController/types/notification-api/{notification-api.d.mts → notification-api.d.ts} +4 -4
  111. package/dist/NotificationServicesController/types/notification-api/notification-api.d.ts.map +1 -0
  112. package/dist/NotificationServicesController/types/notification-api/notification-api.js +2 -0
  113. package/dist/NotificationServicesController/types/notification-api/notification-api.js.map +1 -0
  114. package/dist/NotificationServicesController/types/notification-api/{schema.d.cts → schema.d.ts} +1 -1
  115. package/dist/NotificationServicesController/types/notification-api/schema.d.ts.map +1 -0
  116. package/dist/NotificationServicesController/types/notification-api/{schema.mjs → schema.js} +1 -1
  117. package/dist/NotificationServicesController/types/notification-api/schema.js.map +1 -0
  118. package/dist/NotificationServicesController/types/perps/index.d.ts +2 -0
  119. package/dist/NotificationServicesController/types/perps/index.d.ts.map +1 -0
  120. package/dist/NotificationServicesController/types/perps/index.js +2 -0
  121. package/dist/NotificationServicesController/types/perps/index.js.map +1 -0
  122. package/dist/NotificationServicesController/types/perps/perp-types.d.ts +3 -0
  123. package/dist/NotificationServicesController/types/perps/perp-types.d.ts.map +1 -0
  124. package/dist/NotificationServicesController/types/perps/perp-types.js +2 -0
  125. package/dist/NotificationServicesController/types/perps/perp-types.js.map +1 -0
  126. package/dist/NotificationServicesController/types/perps/{schema.d.cts → schema.d.ts} +1 -1
  127. package/dist/NotificationServicesController/types/perps/schema.d.ts.map +1 -0
  128. package/dist/NotificationServicesController/types/perps/{schema.mjs → schema.js} +1 -1
  129. package/dist/NotificationServicesController/types/perps/schema.js.map +1 -0
  130. package/dist/NotificationServicesController/types/snaps/index.d.ts +2 -0
  131. package/dist/NotificationServicesController/types/snaps/index.d.ts.map +1 -0
  132. package/dist/NotificationServicesController/types/snaps/index.js +2 -0
  133. package/dist/NotificationServicesController/types/snaps/index.js.map +1 -0
  134. package/dist/NotificationServicesController/types/snaps/{snaps.d.cts → snaps.d.ts} +2 -2
  135. package/dist/NotificationServicesController/types/snaps/snaps.d.ts.map +1 -0
  136. package/dist/NotificationServicesController/types/snaps/snaps.js +2 -0
  137. package/dist/NotificationServicesController/types/snaps/snaps.js.map +1 -0
  138. package/dist/NotificationServicesController/types/{type-utils.d.cts → type-utils.d.ts} +1 -1
  139. package/dist/NotificationServicesController/types/type-utils.d.ts.map +1 -0
  140. package/dist/NotificationServicesController/types/type-utils.js +2 -0
  141. package/dist/NotificationServicesController/types/type-utils.js.map +1 -0
  142. package/dist/NotificationServicesController/utils/{get-notification-subtype.d.cts → get-notification-subtype.d.ts} +2 -2
  143. package/dist/NotificationServicesController/utils/get-notification-subtype.d.ts.map +1 -0
  144. package/dist/NotificationServicesController/utils/{get-notification-subtype.mjs → get-notification-subtype.js} +3 -3
  145. package/dist/NotificationServicesController/utils/get-notification-subtype.js.map +1 -0
  146. package/dist/NotificationServicesController/utils/{isVersionInBounds.d.cts → isVersionInBounds.d.ts} +1 -1
  147. package/dist/NotificationServicesController/utils/isVersionInBounds.d.ts.map +1 -0
  148. package/dist/NotificationServicesController/utils/{isVersionInBounds.mjs → isVersionInBounds.js} +2 -2
  149. package/dist/NotificationServicesController/utils/isVersionInBounds.js.map +1 -0
  150. package/dist/NotificationServicesController/utils/{should-auto-expire.d.cts → should-auto-expire.d.ts} +1 -1
  151. package/dist/NotificationServicesController/utils/should-auto-expire.d.ts.map +1 -0
  152. package/dist/NotificationServicesController/utils/{should-auto-expire.mjs → should-auto-expire.js} +1 -1
  153. package/dist/NotificationServicesController/utils/should-auto-expire.js.map +1 -0
  154. package/dist/NotificationServicesController/utils/{utils.d.cts → utils.d.ts} +1 -1
  155. package/dist/NotificationServicesController/utils/utils.d.ts.map +1 -0
  156. package/dist/NotificationServicesController/utils/{utils.mjs → utils.js} +1 -1
  157. package/dist/NotificationServicesController/utils/utils.js.map +1 -0
  158. package/dist/NotificationServicesPushController/{NotificationServicesPushController-method-action-types.d.cts → NotificationServicesPushController-method-action-types.d.ts} +2 -2
  159. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.ts.map +1 -0
  160. package/dist/NotificationServicesPushController/{NotificationServicesPushController-method-action-types.mjs → NotificationServicesPushController-method-action-types.js} +1 -1
  161. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.js.map +1 -0
  162. package/dist/NotificationServicesPushController/{NotificationServicesPushController.d.cts → NotificationServicesPushController.d.ts} +9 -9
  163. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +1 -0
  164. package/dist/NotificationServicesPushController/NotificationServicesPushController.js +326 -0
  165. package/dist/NotificationServicesPushController/NotificationServicesPushController.js.map +1 -0
  166. package/dist/NotificationServicesPushController/{index.d.cts → index.d.ts} +9 -9
  167. package/dist/NotificationServicesPushController/index.d.ts.map +1 -0
  168. package/dist/NotificationServicesPushController/index.js +8 -0
  169. package/dist/NotificationServicesPushController/index.js.map +1 -0
  170. package/dist/NotificationServicesPushController/mocks/index.d.ts +2 -0
  171. package/dist/NotificationServicesPushController/mocks/index.d.ts.map +1 -0
  172. package/dist/NotificationServicesPushController/mocks/index.js +2 -0
  173. package/dist/NotificationServicesPushController/mocks/index.js.map +1 -0
  174. package/dist/NotificationServicesPushController/mocks/{mockResponse.d.mts → mockResponse.d.ts} +1 -1
  175. package/dist/NotificationServicesPushController/mocks/mockResponse.d.ts.map +1 -0
  176. package/dist/NotificationServicesPushController/mocks/{mockResponse.mjs → mockResponse.js} +2 -2
  177. package/dist/NotificationServicesPushController/mocks/mockResponse.js.map +1 -0
  178. package/dist/NotificationServicesPushController/services/{endpoints.d.cts → endpoints.d.ts} +1 -1
  179. package/dist/NotificationServicesPushController/services/endpoints.d.ts.map +1 -0
  180. package/dist/NotificationServicesPushController/services/{endpoints.mjs → endpoints.js} +1 -1
  181. package/dist/NotificationServicesPushController/services/endpoints.js.map +1 -0
  182. package/dist/NotificationServicesPushController/services/{services.d.mts → services.d.ts} +4 -4
  183. package/dist/NotificationServicesPushController/services/services.d.ts.map +1 -0
  184. package/dist/NotificationServicesPushController/services/{services.mjs → services.js} +2 -2
  185. package/dist/NotificationServicesPushController/services/services.js.map +1 -0
  186. package/dist/NotificationServicesPushController/types/{firebase.d.mts → firebase.d.ts} +1 -1
  187. package/dist/NotificationServicesPushController/types/firebase.d.ts.map +1 -0
  188. package/dist/NotificationServicesPushController/types/firebase.js +2 -0
  189. package/dist/NotificationServicesPushController/types/firebase.js.map +1 -0
  190. package/dist/NotificationServicesPushController/types/index.d.ts +4 -0
  191. package/dist/NotificationServicesPushController/types/index.d.ts.map +1 -0
  192. package/dist/NotificationServicesPushController/types/index.js +2 -0
  193. package/dist/NotificationServicesPushController/types/index.js.map +1 -0
  194. package/dist/NotificationServicesPushController/types/{push-analytics.d.cts → push-analytics.d.ts} +1 -1
  195. package/dist/NotificationServicesPushController/types/push-analytics.d.ts.map +1 -0
  196. package/dist/NotificationServicesPushController/types/{push-analytics.mjs → push-analytics.js} +1 -1
  197. package/dist/NotificationServicesPushController/types/push-analytics.js.map +1 -0
  198. package/dist/NotificationServicesPushController/types/{push-service-interface.d.cts → push-service-interface.d.ts} +2 -2
  199. package/dist/NotificationServicesPushController/types/push-service-interface.d.ts.map +1 -0
  200. package/dist/NotificationServicesPushController/types/push-service-interface.js +2 -0
  201. package/dist/NotificationServicesPushController/types/push-service-interface.js.map +1 -0
  202. package/dist/NotificationServicesPushController/utils/{get-notification-data.d.cts → get-notification-data.d.ts} +2 -2
  203. package/dist/NotificationServicesPushController/utils/get-notification-data.d.ts.map +1 -0
  204. package/dist/NotificationServicesPushController/utils/{get-notification-data.mjs → get-notification-data.js} +2 -2
  205. package/dist/NotificationServicesPushController/utils/get-notification-data.js.map +1 -0
  206. package/dist/NotificationServicesPushController/utils/{get-notification-message.d.mts → get-notification-message.d.ts} +3 -3
  207. package/dist/NotificationServicesPushController/utils/get-notification-message.d.ts.map +1 -0
  208. package/dist/NotificationServicesPushController/utils/{get-notification-message.mjs → get-notification-message.js} +2 -2
  209. package/dist/NotificationServicesPushController/utils/get-notification-message.js.map +1 -0
  210. package/dist/NotificationServicesPushController/utils/index.d.ts +4 -0
  211. package/dist/NotificationServicesPushController/utils/index.d.ts.map +1 -0
  212. package/dist/NotificationServicesPushController/utils/index.js +4 -0
  213. package/dist/NotificationServicesPushController/utils/index.js.map +1 -0
  214. package/dist/NotificationServicesPushController/utils/{to-push-analytics-payload.d.cts → to-push-analytics-payload.d.ts} +2 -2
  215. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.ts.map +1 -0
  216. package/dist/NotificationServicesPushController/utils/{to-push-analytics-payload.mjs → to-push-analytics-payload.js} +1 -1
  217. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.js.map +1 -0
  218. package/dist/NotificationServicesPushController/web/index.d.ts +2 -0
  219. package/dist/NotificationServicesPushController/web/index.d.ts.map +1 -0
  220. package/dist/NotificationServicesPushController/web/index.js +2 -0
  221. package/dist/NotificationServicesPushController/web/index.js.map +1 -0
  222. package/dist/NotificationServicesPushController/web/{push-utils.d.cts → push-utils.d.ts} +4 -5
  223. package/dist/NotificationServicesPushController/web/push-utils.d.ts.map +1 -0
  224. package/dist/NotificationServicesPushController/web/{push-utils.mjs → push-utils.js} +7 -14
  225. package/dist/NotificationServicesPushController/web/push-utils.js.map +1 -0
  226. package/dist/index.d.ts +4 -0
  227. package/dist/index.d.ts.map +1 -0
  228. package/dist/index.js +4 -0
  229. package/dist/index.js.map +1 -0
  230. package/dist/shared/index.d.ts +4 -0
  231. package/dist/shared/index.d.ts.map +1 -0
  232. package/dist/shared/index.js +4 -0
  233. package/dist/shared/index.js.map +1 -0
  234. package/dist/shared/{is-onchain-notification.d.cts → is-onchain-notification.d.ts} +2 -2
  235. package/dist/shared/is-onchain-notification.d.ts.map +1 -0
  236. package/dist/shared/{is-onchain-notification.mjs → is-onchain-notification.js} +2 -2
  237. package/dist/shared/is-onchain-notification.js.map +1 -0
  238. package/dist/shared/{notification-api-type-guards.d.mts → notification-api-type-guards.d.ts} +2 -2
  239. package/dist/shared/notification-api-type-guards.d.ts.map +1 -0
  240. package/dist/shared/{notification-api-type-guards.mjs → notification-api-type-guards.js} +1 -1
  241. package/dist/shared/notification-api-type-guards.js.map +1 -0
  242. package/dist/shared/{to-raw-notification.d.cts → to-raw-notification.d.ts} +2 -2
  243. package/dist/shared/to-raw-notification.d.ts.map +1 -0
  244. package/dist/shared/{to-raw-notification.mjs → to-raw-notification.js} +3 -3
  245. package/dist/shared/to-raw-notification.js.map +1 -0
  246. package/package.json +31 -65
  247. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.cjs +0 -7
  248. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.cjs.map +0 -1
  249. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.cts +0 -206
  250. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.cts.map +0 -1
  251. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.mts.map +0 -1
  252. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.mjs.map +0 -1
  253. package/dist/NotificationServicesController/NotificationServicesController.cjs +0 -1056
  254. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +0 -1
  255. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +0 -1
  256. package/dist/NotificationServicesController/NotificationServicesController.d.mts +0 -292
  257. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +0 -1
  258. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +0 -1
  259. package/dist/NotificationServicesController/constants/index.cjs +0 -18
  260. package/dist/NotificationServicesController/constants/index.cjs.map +0 -1
  261. package/dist/NotificationServicesController/constants/index.d.cts +0 -2
  262. package/dist/NotificationServicesController/constants/index.d.cts.map +0 -1
  263. package/dist/NotificationServicesController/constants/index.d.mts +0 -2
  264. package/dist/NotificationServicesController/constants/index.d.mts.map +0 -1
  265. package/dist/NotificationServicesController/constants/index.mjs +0 -2
  266. package/dist/NotificationServicesController/constants/index.mjs.map +0 -1
  267. package/dist/NotificationServicesController/constants/notification-schema.cjs +0 -46
  268. package/dist/NotificationServicesController/constants/notification-schema.cjs.map +0 -1
  269. package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +0 -1
  270. package/dist/NotificationServicesController/constants/notification-schema.d.mts +0 -22
  271. package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +0 -1
  272. package/dist/NotificationServicesController/constants/notification-schema.mjs.map +0 -1
  273. package/dist/NotificationServicesController/index.cjs +0 -44
  274. package/dist/NotificationServicesController/index.cjs.map +0 -1
  275. package/dist/NotificationServicesController/index.d.cts.map +0 -1
  276. package/dist/NotificationServicesController/index.d.mts +0 -16
  277. package/dist/NotificationServicesController/index.d.mts.map +0 -1
  278. package/dist/NotificationServicesController/index.mjs +0 -13
  279. package/dist/NotificationServicesController/index.mjs.map +0 -1
  280. package/dist/NotificationServicesController/mocks/index.cjs +0 -21
  281. package/dist/NotificationServicesController/mocks/index.cjs.map +0 -1
  282. package/dist/NotificationServicesController/mocks/index.d.cts +0 -5
  283. package/dist/NotificationServicesController/mocks/index.d.cts.map +0 -1
  284. package/dist/NotificationServicesController/mocks/index.d.mts +0 -5
  285. package/dist/NotificationServicesController/mocks/index.d.mts.map +0 -1
  286. package/dist/NotificationServicesController/mocks/index.mjs +0 -5
  287. package/dist/NotificationServicesController/mocks/index.mjs.map +0 -1
  288. package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs +0 -210
  289. package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs.map +0 -1
  290. package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.cts.map +0 -1
  291. package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.mts +0 -15
  292. package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.mts.map +0 -1
  293. package/dist/NotificationServicesController/mocks/mock-feature-announcements.mjs.map +0 -1
  294. package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs +0 -830
  295. package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs.map +0 -1
  296. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.cts.map +0 -1
  297. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts +0 -104
  298. package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts.map +0 -1
  299. package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs.map +0 -1
  300. package/dist/NotificationServicesController/mocks/mock-snap-notification.cjs +0 -29
  301. package/dist/NotificationServicesController/mocks/mock-snap-notification.cjs.map +0 -1
  302. package/dist/NotificationServicesController/mocks/mock-snap-notification.d.cts.map +0 -1
  303. package/dist/NotificationServicesController/mocks/mock-snap-notification.d.mts +0 -8
  304. package/dist/NotificationServicesController/mocks/mock-snap-notification.d.mts.map +0 -1
  305. package/dist/NotificationServicesController/mocks/mock-snap-notification.mjs.map +0 -1
  306. package/dist/NotificationServicesController/mocks/mockResponses.cjs +0 -61
  307. package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +0 -1
  308. package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +0 -1
  309. package/dist/NotificationServicesController/mocks/mockResponses.d.mts +0 -15
  310. package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +0 -1
  311. package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +0 -1
  312. package/dist/NotificationServicesController/processors/index.cjs +0 -20
  313. package/dist/NotificationServicesController/processors/index.cjs.map +0 -1
  314. package/dist/NotificationServicesController/processors/index.d.cts +0 -4
  315. package/dist/NotificationServicesController/processors/index.d.cts.map +0 -1
  316. package/dist/NotificationServicesController/processors/index.d.mts +0 -4
  317. package/dist/NotificationServicesController/processors/index.d.mts.map +0 -1
  318. package/dist/NotificationServicesController/processors/index.mjs +0 -4
  319. package/dist/NotificationServicesController/processors/index.mjs.map +0 -1
  320. package/dist/NotificationServicesController/processors/process-api-notifications.cjs +0 -24
  321. package/dist/NotificationServicesController/processors/process-api-notifications.cjs.map +0 -1
  322. package/dist/NotificationServicesController/processors/process-api-notifications.d.cts.map +0 -1
  323. package/dist/NotificationServicesController/processors/process-api-notifications.d.mts +0 -10
  324. package/dist/NotificationServicesController/processors/process-api-notifications.d.mts.map +0 -1
  325. package/dist/NotificationServicesController/processors/process-api-notifications.mjs.map +0 -1
  326. package/dist/NotificationServicesController/processors/process-feature-announcement.cjs +0 -38
  327. package/dist/NotificationServicesController/processors/process-feature-announcement.cjs.map +0 -1
  328. package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts +0 -19
  329. package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts.map +0 -1
  330. package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts.map +0 -1
  331. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs.map +0 -1
  332. package/dist/NotificationServicesController/processors/process-notifications.cjs +0 -60
  333. package/dist/NotificationServicesController/processors/process-notifications.cjs.map +0 -1
  334. package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +0 -1
  335. package/dist/NotificationServicesController/processors/process-notifications.d.mts +0 -20
  336. package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +0 -1
  337. package/dist/NotificationServicesController/processors/process-notifications.mjs.map +0 -1
  338. package/dist/NotificationServicesController/processors/process-snap-notifications.cjs +0 -25
  339. package/dist/NotificationServicesController/processors/process-snap-notifications.cjs.map +0 -1
  340. package/dist/NotificationServicesController/processors/process-snap-notifications.d.cts.map +0 -1
  341. package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts +0 -10
  342. package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts.map +0 -1
  343. package/dist/NotificationServicesController/processors/process-snap-notifications.mjs.map +0 -1
  344. package/dist/NotificationServicesController/services/api-notifications.cjs +0 -167
  345. package/dist/NotificationServicesController/services/api-notifications.cjs.map +0 -1
  346. package/dist/NotificationServicesController/services/api-notifications.d.cts.map +0 -1
  347. package/dist/NotificationServicesController/services/api-notifications.d.mts +0 -65
  348. package/dist/NotificationServicesController/services/api-notifications.d.mts.map +0 -1
  349. package/dist/NotificationServicesController/services/api-notifications.mjs.map +0 -1
  350. package/dist/NotificationServicesController/services/feature-announcements.cjs +0 -140
  351. package/dist/NotificationServicesController/services/feature-announcements.cjs.map +0 -1
  352. package/dist/NotificationServicesController/services/feature-announcements.d.cts +0 -32
  353. package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +0 -1
  354. package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +0 -1
  355. package/dist/NotificationServicesController/services/feature-announcements.mjs.map +0 -1
  356. package/dist/NotificationServicesController/services/notification-config-cache.cjs +0 -61
  357. package/dist/NotificationServicesController/services/notification-config-cache.cjs.map +0 -1
  358. package/dist/NotificationServicesController/services/notification-config-cache.d.cts +0 -15
  359. package/dist/NotificationServicesController/services/notification-config-cache.d.cts.map +0 -1
  360. package/dist/NotificationServicesController/services/notification-config-cache.d.mts.map +0 -1
  361. package/dist/NotificationServicesController/services/notification-config-cache.mjs +0 -57
  362. package/dist/NotificationServicesController/services/notification-config-cache.mjs.map +0 -1
  363. package/dist/NotificationServicesController/services/perp-notifications.cjs +0 -31
  364. package/dist/NotificationServicesController/services/perp-notifications.cjs.map +0 -1
  365. package/dist/NotificationServicesController/services/perp-notifications.d.cts.map +0 -1
  366. package/dist/NotificationServicesController/services/perp-notifications.d.mts +0 -11
  367. package/dist/NotificationServicesController/services/perp-notifications.d.mts.map +0 -1
  368. package/dist/NotificationServicesController/services/perp-notifications.mjs.map +0 -1
  369. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs +0 -3
  370. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map +0 -1
  371. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts.map +0 -1
  372. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts +0 -32
  373. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts.map +0 -1
  374. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs +0 -2
  375. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +0 -1
  376. package/dist/NotificationServicesController/types/feature-announcement/index.cjs +0 -3
  377. package/dist/NotificationServicesController/types/feature-announcement/index.cjs.map +0 -1
  378. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts +0 -4
  379. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts.map +0 -1
  380. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts +0 -4
  381. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts.map +0 -1
  382. package/dist/NotificationServicesController/types/feature-announcement/index.mjs +0 -2
  383. package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +0 -1
  384. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs +0 -3
  385. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs.map +0 -1
  386. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts.map +0 -1
  387. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts +0 -43
  388. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts.map +0 -1
  389. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs +0 -2
  390. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs.map +0 -1
  391. package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs +0 -3
  392. package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs.map +0 -1
  393. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.cts.map +0 -1
  394. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts +0 -29
  395. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts.map +0 -1
  396. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs +0 -2
  397. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs.map +0 -1
  398. package/dist/NotificationServicesController/types/index.cjs +0 -3
  399. package/dist/NotificationServicesController/types/index.cjs.map +0 -1
  400. package/dist/NotificationServicesController/types/index.d.cts +0 -6
  401. package/dist/NotificationServicesController/types/index.d.cts.map +0 -1
  402. package/dist/NotificationServicesController/types/index.d.mts +0 -6
  403. package/dist/NotificationServicesController/types/index.d.mts.map +0 -1
  404. package/dist/NotificationServicesController/types/index.mjs +0 -2
  405. package/dist/NotificationServicesController/types/index.mjs.map +0 -1
  406. package/dist/NotificationServicesController/types/notification/index.cjs +0 -3
  407. package/dist/NotificationServicesController/types/notification/index.cjs.map +0 -1
  408. package/dist/NotificationServicesController/types/notification/index.d.cts +0 -2
  409. package/dist/NotificationServicesController/types/notification/index.d.cts.map +0 -1
  410. package/dist/NotificationServicesController/types/notification/index.d.mts +0 -2
  411. package/dist/NotificationServicesController/types/notification/index.d.mts.map +0 -1
  412. package/dist/NotificationServicesController/types/notification/index.mjs +0 -2
  413. package/dist/NotificationServicesController/types/notification/index.mjs.map +0 -1
  414. package/dist/NotificationServicesController/types/notification/notification.cjs +0 -3
  415. package/dist/NotificationServicesController/types/notification/notification.cjs.map +0 -1
  416. package/dist/NotificationServicesController/types/notification/notification.d.cts.map +0 -1
  417. package/dist/NotificationServicesController/types/notification/notification.d.mts +0 -22
  418. package/dist/NotificationServicesController/types/notification/notification.d.mts.map +0 -1
  419. package/dist/NotificationServicesController/types/notification/notification.mjs +0 -2
  420. package/dist/NotificationServicesController/types/notification/notification.mjs.map +0 -1
  421. package/dist/NotificationServicesController/types/notification-api/index.cjs +0 -3
  422. package/dist/NotificationServicesController/types/notification-api/index.cjs.map +0 -1
  423. package/dist/NotificationServicesController/types/notification-api/index.d.cts +0 -3
  424. package/dist/NotificationServicesController/types/notification-api/index.d.cts.map +0 -1
  425. package/dist/NotificationServicesController/types/notification-api/index.d.mts +0 -3
  426. package/dist/NotificationServicesController/types/notification-api/index.d.mts.map +0 -1
  427. package/dist/NotificationServicesController/types/notification-api/index.mjs +0 -2
  428. package/dist/NotificationServicesController/types/notification-api/index.mjs.map +0 -1
  429. package/dist/NotificationServicesController/types/notification-api/notification-api.cjs +0 -4
  430. package/dist/NotificationServicesController/types/notification-api/notification-api.cjs.map +0 -1
  431. package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts +0 -59
  432. package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts.map +0 -1
  433. package/dist/NotificationServicesController/types/notification-api/notification-api.d.mts.map +0 -1
  434. package/dist/NotificationServicesController/types/notification-api/notification-api.mjs +0 -2
  435. package/dist/NotificationServicesController/types/notification-api/notification-api.mjs.map +0 -1
  436. package/dist/NotificationServicesController/types/notification-api/schema.cjs +0 -6
  437. package/dist/NotificationServicesController/types/notification-api/schema.cjs.map +0 -1
  438. package/dist/NotificationServicesController/types/notification-api/schema.d.cts.map +0 -1
  439. package/dist/NotificationServicesController/types/notification-api/schema.d.mts +0 -752
  440. package/dist/NotificationServicesController/types/notification-api/schema.d.mts.map +0 -1
  441. package/dist/NotificationServicesController/types/notification-api/schema.mjs.map +0 -1
  442. package/dist/NotificationServicesController/types/perps/index.cjs +0 -3
  443. package/dist/NotificationServicesController/types/perps/index.cjs.map +0 -1
  444. package/dist/NotificationServicesController/types/perps/index.d.cts +0 -2
  445. package/dist/NotificationServicesController/types/perps/index.d.cts.map +0 -1
  446. package/dist/NotificationServicesController/types/perps/index.d.mts +0 -2
  447. package/dist/NotificationServicesController/types/perps/index.d.mts.map +0 -1
  448. package/dist/NotificationServicesController/types/perps/index.mjs +0 -2
  449. package/dist/NotificationServicesController/types/perps/index.mjs.map +0 -1
  450. package/dist/NotificationServicesController/types/perps/perp-types.cjs +0 -3
  451. package/dist/NotificationServicesController/types/perps/perp-types.cjs.map +0 -1
  452. package/dist/NotificationServicesController/types/perps/perp-types.d.cts +0 -3
  453. package/dist/NotificationServicesController/types/perps/perp-types.d.cts.map +0 -1
  454. package/dist/NotificationServicesController/types/perps/perp-types.d.mts +0 -3
  455. package/dist/NotificationServicesController/types/perps/perp-types.d.mts.map +0 -1
  456. package/dist/NotificationServicesController/types/perps/perp-types.mjs +0 -2
  457. package/dist/NotificationServicesController/types/perps/perp-types.mjs.map +0 -1
  458. package/dist/NotificationServicesController/types/perps/schema.cjs +0 -6
  459. package/dist/NotificationServicesController/types/perps/schema.cjs.map +0 -1
  460. package/dist/NotificationServicesController/types/perps/schema.d.cts.map +0 -1
  461. package/dist/NotificationServicesController/types/perps/schema.d.mts +0 -133
  462. package/dist/NotificationServicesController/types/perps/schema.d.mts.map +0 -1
  463. package/dist/NotificationServicesController/types/perps/schema.mjs.map +0 -1
  464. package/dist/NotificationServicesController/types/snaps/index.cjs +0 -3
  465. package/dist/NotificationServicesController/types/snaps/index.cjs.map +0 -1
  466. package/dist/NotificationServicesController/types/snaps/index.d.cts +0 -2
  467. package/dist/NotificationServicesController/types/snaps/index.d.cts.map +0 -1
  468. package/dist/NotificationServicesController/types/snaps/index.d.mts +0 -2
  469. package/dist/NotificationServicesController/types/snaps/index.d.mts.map +0 -1
  470. package/dist/NotificationServicesController/types/snaps/index.mjs +0 -2
  471. package/dist/NotificationServicesController/types/snaps/index.mjs.map +0 -1
  472. package/dist/NotificationServicesController/types/snaps/snaps.cjs +0 -3
  473. package/dist/NotificationServicesController/types/snaps/snaps.cjs.map +0 -1
  474. package/dist/NotificationServicesController/types/snaps/snaps.d.cts.map +0 -1
  475. package/dist/NotificationServicesController/types/snaps/snaps.d.mts +0 -23
  476. package/dist/NotificationServicesController/types/snaps/snaps.d.mts.map +0 -1
  477. package/dist/NotificationServicesController/types/snaps/snaps.mjs +0 -2
  478. package/dist/NotificationServicesController/types/snaps/snaps.mjs.map +0 -1
  479. package/dist/NotificationServicesController/types/type-utils.cjs +0 -3
  480. package/dist/NotificationServicesController/types/type-utils.cjs.map +0 -1
  481. package/dist/NotificationServicesController/types/type-utils.d.cts.map +0 -1
  482. package/dist/NotificationServicesController/types/type-utils.d.mts +0 -7
  483. package/dist/NotificationServicesController/types/type-utils.d.mts.map +0 -1
  484. package/dist/NotificationServicesController/types/type-utils.mjs +0 -2
  485. package/dist/NotificationServicesController/types/type-utils.mjs.map +0 -1
  486. package/dist/NotificationServicesController/utils/get-notification-subtype.cjs +0 -33
  487. package/dist/NotificationServicesController/utils/get-notification-subtype.cjs.map +0 -1
  488. package/dist/NotificationServicesController/utils/get-notification-subtype.d.cts.map +0 -1
  489. package/dist/NotificationServicesController/utils/get-notification-subtype.d.mts +0 -17
  490. package/dist/NotificationServicesController/utils/get-notification-subtype.d.mts.map +0 -1
  491. package/dist/NotificationServicesController/utils/get-notification-subtype.mjs.map +0 -1
  492. package/dist/NotificationServicesController/utils/isVersionInBounds.cjs +0 -37
  493. package/dist/NotificationServicesController/utils/isVersionInBounds.cjs.map +0 -1
  494. package/dist/NotificationServicesController/utils/isVersionInBounds.d.cts.map +0 -1
  495. package/dist/NotificationServicesController/utils/isVersionInBounds.d.mts +0 -18
  496. package/dist/NotificationServicesController/utils/isVersionInBounds.d.mts.map +0 -1
  497. package/dist/NotificationServicesController/utils/isVersionInBounds.mjs.map +0 -1
  498. package/dist/NotificationServicesController/utils/should-auto-expire.cjs +0 -12
  499. package/dist/NotificationServicesController/utils/should-auto-expire.cjs.map +0 -1
  500. package/dist/NotificationServicesController/utils/should-auto-expire.d.cts.map +0 -1
  501. package/dist/NotificationServicesController/utils/should-auto-expire.d.mts +0 -2
  502. package/dist/NotificationServicesController/utils/should-auto-expire.d.mts.map +0 -1
  503. package/dist/NotificationServicesController/utils/should-auto-expire.mjs.map +0 -1
  504. package/dist/NotificationServicesController/utils/utils.cjs +0 -25
  505. package/dist/NotificationServicesController/utils/utils.cjs.map +0 -1
  506. package/dist/NotificationServicesController/utils/utils.d.cts.map +0 -1
  507. package/dist/NotificationServicesController/utils/utils.d.mts +0 -11
  508. package/dist/NotificationServicesController/utils/utils.d.mts.map +0 -1
  509. package/dist/NotificationServicesController/utils/utils.mjs.map +0 -1
  510. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.cjs +0 -7
  511. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.cjs.map +0 -1
  512. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.cts.map +0 -1
  513. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.mts +0 -72
  514. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.mts.map +0 -1
  515. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.mjs.map +0 -1
  516. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +0 -342
  517. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +0 -1
  518. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +0 -1
  519. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +0 -123
  520. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +0 -1
  521. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +0 -342
  522. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +0 -1
  523. package/dist/NotificationServicesPushController/index.cjs +0 -37
  524. package/dist/NotificationServicesPushController/index.cjs.map +0 -1
  525. package/dist/NotificationServicesPushController/index.d.cts.map +0 -1
  526. package/dist/NotificationServicesPushController/index.d.mts +0 -11
  527. package/dist/NotificationServicesPushController/index.d.mts.map +0 -1
  528. package/dist/NotificationServicesPushController/index.mjs +0 -8
  529. package/dist/NotificationServicesPushController/index.mjs.map +0 -1
  530. package/dist/NotificationServicesPushController/mocks/index.cjs +0 -18
  531. package/dist/NotificationServicesPushController/mocks/index.cjs.map +0 -1
  532. package/dist/NotificationServicesPushController/mocks/index.d.cts +0 -2
  533. package/dist/NotificationServicesPushController/mocks/index.d.cts.map +0 -1
  534. package/dist/NotificationServicesPushController/mocks/index.d.mts +0 -2
  535. package/dist/NotificationServicesPushController/mocks/index.d.mts.map +0 -1
  536. package/dist/NotificationServicesPushController/mocks/index.mjs +0 -2
  537. package/dist/NotificationServicesPushController/mocks/index.mjs.map +0 -1
  538. package/dist/NotificationServicesPushController/mocks/mockResponse.cjs +0 -48
  539. package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +0 -1
  540. package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts +0 -22
  541. package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +0 -1
  542. package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +0 -1
  543. package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +0 -1
  544. package/dist/NotificationServicesPushController/services/endpoints.cjs +0 -13
  545. package/dist/NotificationServicesPushController/services/endpoints.cjs.map +0 -1
  546. package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +0 -1
  547. package/dist/NotificationServicesPushController/services/endpoints.d.mts +0 -4
  548. package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +0 -1
  549. package/dist/NotificationServicesPushController/services/endpoints.mjs.map +0 -1
  550. package/dist/NotificationServicesPushController/services/services.cjs +0 -133
  551. package/dist/NotificationServicesPushController/services/services.cjs.map +0 -1
  552. package/dist/NotificationServicesPushController/services/services.d.cts +0 -90
  553. package/dist/NotificationServicesPushController/services/services.d.cts.map +0 -1
  554. package/dist/NotificationServicesPushController/services/services.d.mts.map +0 -1
  555. package/dist/NotificationServicesPushController/services/services.mjs.map +0 -1
  556. package/dist/NotificationServicesPushController/types/firebase.cjs +0 -3
  557. package/dist/NotificationServicesPushController/types/firebase.cjs.map +0 -1
  558. package/dist/NotificationServicesPushController/types/firebase.d.cts +0 -53
  559. package/dist/NotificationServicesPushController/types/firebase.d.cts.map +0 -1
  560. package/dist/NotificationServicesPushController/types/firebase.d.mts.map +0 -1
  561. package/dist/NotificationServicesPushController/types/firebase.mjs +0 -2
  562. package/dist/NotificationServicesPushController/types/firebase.mjs.map +0 -1
  563. package/dist/NotificationServicesPushController/types/index.cjs +0 -3
  564. package/dist/NotificationServicesPushController/types/index.cjs.map +0 -1
  565. package/dist/NotificationServicesPushController/types/index.d.cts +0 -4
  566. package/dist/NotificationServicesPushController/types/index.d.cts.map +0 -1
  567. package/dist/NotificationServicesPushController/types/index.d.mts +0 -4
  568. package/dist/NotificationServicesPushController/types/index.d.mts.map +0 -1
  569. package/dist/NotificationServicesPushController/types/index.mjs +0 -2
  570. package/dist/NotificationServicesPushController/types/index.mjs.map +0 -1
  571. package/dist/NotificationServicesPushController/types/push-analytics.cjs +0 -5
  572. package/dist/NotificationServicesPushController/types/push-analytics.cjs.map +0 -1
  573. package/dist/NotificationServicesPushController/types/push-analytics.d.cts.map +0 -1
  574. package/dist/NotificationServicesPushController/types/push-analytics.d.mts +0 -18
  575. package/dist/NotificationServicesPushController/types/push-analytics.d.mts.map +0 -1
  576. package/dist/NotificationServicesPushController/types/push-analytics.mjs.map +0 -1
  577. package/dist/NotificationServicesPushController/types/push-service-interface.cjs +0 -3
  578. package/dist/NotificationServicesPushController/types/push-service-interface.cjs.map +0 -1
  579. package/dist/NotificationServicesPushController/types/push-service-interface.d.cts.map +0 -1
  580. package/dist/NotificationServicesPushController/types/push-service-interface.d.mts +0 -30
  581. package/dist/NotificationServicesPushController/types/push-service-interface.d.mts.map +0 -1
  582. package/dist/NotificationServicesPushController/types/push-service-interface.mjs +0 -2
  583. package/dist/NotificationServicesPushController/types/push-service-interface.mjs.map +0 -1
  584. package/dist/NotificationServicesPushController/utils/get-notification-data.cjs +0 -84
  585. package/dist/NotificationServicesPushController/utils/get-notification-data.cjs.map +0 -1
  586. package/dist/NotificationServicesPushController/utils/get-notification-data.d.cts.map +0 -1
  587. package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts +0 -42
  588. package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts.map +0 -1
  589. package/dist/NotificationServicesPushController/utils/get-notification-data.mjs.map +0 -1
  590. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +0 -171
  591. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +0 -1
  592. package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts +0 -62
  593. package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +0 -1
  594. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +0 -1
  595. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +0 -1
  596. package/dist/NotificationServicesPushController/utils/index.cjs +0 -20
  597. package/dist/NotificationServicesPushController/utils/index.cjs.map +0 -1
  598. package/dist/NotificationServicesPushController/utils/index.d.cts +0 -4
  599. package/dist/NotificationServicesPushController/utils/index.d.cts.map +0 -1
  600. package/dist/NotificationServicesPushController/utils/index.d.mts +0 -4
  601. package/dist/NotificationServicesPushController/utils/index.d.mts.map +0 -1
  602. package/dist/NotificationServicesPushController/utils/index.mjs +0 -4
  603. package/dist/NotificationServicesPushController/utils/index.mjs.map +0 -1
  604. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.cjs +0 -26
  605. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.cjs.map +0 -1
  606. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.cts.map +0 -1
  607. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.mts +0 -12
  608. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.mts.map +0 -1
  609. package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.mjs.map +0 -1
  610. package/dist/NotificationServicesPushController/web/index.cjs +0 -8
  611. package/dist/NotificationServicesPushController/web/index.cjs.map +0 -1
  612. package/dist/NotificationServicesPushController/web/index.d.cts +0 -2
  613. package/dist/NotificationServicesPushController/web/index.d.cts.map +0 -1
  614. package/dist/NotificationServicesPushController/web/index.d.mts +0 -2
  615. package/dist/NotificationServicesPushController/web/index.d.mts.map +0 -1
  616. package/dist/NotificationServicesPushController/web/index.mjs +0 -2
  617. package/dist/NotificationServicesPushController/web/index.mjs.map +0 -1
  618. package/dist/NotificationServicesPushController/web/push-utils.cjs +0 -169
  619. package/dist/NotificationServicesPushController/web/push-utils.cjs.map +0 -1
  620. package/dist/NotificationServicesPushController/web/push-utils.d.cts.map +0 -1
  621. package/dist/NotificationServicesPushController/web/push-utils.d.mts +0 -37
  622. package/dist/NotificationServicesPushController/web/push-utils.d.mts.map +0 -1
  623. package/dist/NotificationServicesPushController/web/push-utils.mjs.map +0 -1
  624. package/dist/index.cjs +0 -34
  625. package/dist/index.cjs.map +0 -1
  626. package/dist/index.d.cts +0 -4
  627. package/dist/index.d.cts.map +0 -1
  628. package/dist/index.d.mts +0 -4
  629. package/dist/index.d.mts.map +0 -1
  630. package/dist/index.mjs +0 -4
  631. package/dist/index.mjs.map +0 -1
  632. package/dist/shared/index.cjs +0 -20
  633. package/dist/shared/index.cjs.map +0 -1
  634. package/dist/shared/index.d.cts +0 -4
  635. package/dist/shared/index.d.cts.map +0 -1
  636. package/dist/shared/index.d.mts +0 -4
  637. package/dist/shared/index.d.mts.map +0 -1
  638. package/dist/shared/index.mjs +0 -4
  639. package/dist/shared/index.mjs.map +0 -1
  640. package/dist/shared/is-onchain-notification.cjs +0 -15
  641. package/dist/shared/is-onchain-notification.cjs.map +0 -1
  642. package/dist/shared/is-onchain-notification.d.cts.map +0 -1
  643. package/dist/shared/is-onchain-notification.d.mts +0 -9
  644. package/dist/shared/is-onchain-notification.d.mts.map +0 -1
  645. package/dist/shared/is-onchain-notification.mjs.map +0 -1
  646. package/dist/shared/notification-api-type-guards.cjs +0 -24
  647. package/dist/shared/notification-api-type-guards.cjs.map +0 -1
  648. package/dist/shared/notification-api-type-guards.d.cts +0 -16
  649. package/dist/shared/notification-api-type-guards.d.cts.map +0 -1
  650. package/dist/shared/notification-api-type-guards.d.mts.map +0 -1
  651. package/dist/shared/notification-api-type-guards.mjs.map +0 -1
  652. package/dist/shared/to-raw-notification.cjs +0 -30
  653. package/dist/shared/to-raw-notification.cjs.map +0 -1
  654. package/dist/shared/to-raw-notification.d.cts.map +0 -1
  655. package/dist/shared/to-raw-notification.d.mts +0 -11
  656. package/dist/shared/to-raw-notification.d.mts.map +0 -1
  657. package/dist/shared/to-raw-notification.mjs.map +0 -1
@@ -1,34 +1,14 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _NotificationServicesController_instances, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_locale, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_env, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_enableAuth, _NotificationServicesController_getBearerToken, _NotificationServicesController_registerPushNotifications, _NotificationServicesController_setIsUpdatingMetamaskNotifications, _NotificationServicesController_setIsFetchingMetamaskNotifications, _NotificationServicesController_setIsCheckingAccountsPresence, _NotificationServicesController_updateUpdatingAccountsState, _NotificationServicesController_clearUpdatingAccountsState;
13
- function $importDefault(module) {
14
- if (module?.__esModule) {
15
- return module.default;
16
- }
17
- return module;
18
- }
19
- import { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES } from "@metamask/authenticated-user-storage";
20
- import { BaseController } from "@metamask/base-controller";
21
- import { isValidHexAddress, toChecksumHexAddress } from "@metamask/controller-utils";
22
- import { assert } from "@metamask/utils";
23
- import $lodash from "lodash";
24
- const { debounce } = $lodash;
25
- import $log from "loglevel";
26
- const log = $importDefault($log);
27
- import { TRIGGER_TYPES } from "./constants/notification-schema.mjs";
28
- import { processAndFilterNotifications, safeProcessNotification } from "./processors/process-notifications.mjs";
29
- import { getAPINotifications, getNotificationsApiConfigCached, markNotificationsAsRead, updateOnChainNotifications } from "./services/api-notifications.mjs";
30
- import { getFeatureAnnouncementNotifications } from "./services/feature-announcements.mjs";
31
- import { createPerpOrderNotification } from "./services/perp-notifications.mjs";
1
+ import { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from '@metamask/authenticated-user-storage';
2
+ import { BaseController } from '@metamask/base-controller';
3
+ import { isValidHexAddress, toChecksumHexAddress, } from '@metamask/controller-utils';
4
+ import { assert } from '@metamask/utils';
5
+ import { debounce } from 'lodash-es';
6
+ import log from 'loglevel';
7
+ import { TRIGGER_TYPES } from './constants/notification-schema.js';
8
+ import { processAndFilterNotifications, safeProcessNotification, } from './processors/process-notifications.js';
9
+ import { getAPINotifications, getNotificationsApiConfigCached, markNotificationsAsRead, updateOnChainNotifications, } from './services/api-notifications.js';
10
+ import { getFeatureAnnouncementNotifications } from './services/feature-announcements.js';
11
+ import { createPerpOrderNotification } from './services/perp-notifications.js';
32
12
  // Unique name for the controller
33
13
  const controllerName = 'NotificationServicesController';
34
14
  export const ACCOUNTS_UPDATE_DEBOUNCE_TIME_MS = 1000;
@@ -127,7 +107,7 @@ export const DEFAULT_SOCIAL_AI_PREFERENCES = {
127
107
  txAmountLimit: 500,
128
108
  mutedTraderProfileIds: [],
129
109
  };
130
- export { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES } from "@metamask/authenticated-user-storage";
110
+ export { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from '@metamask/authenticated-user-storage';
131
111
  /**
132
112
  * Returns the subset of `accounts` that has a wallet-activity subscription in
133
113
  * the Trigger API, which is the source of truth for the per-address enabled bit.
@@ -203,6 +183,233 @@ const MESSENGER_EXPOSED_METHODS = [
203
183
  * Controller that enables wallet notifications and feature announcements
204
184
  */
205
185
  export class NotificationServicesController extends BaseController {
186
+ #keyringController = {
187
+ isUnlocked: false,
188
+ setupLockedStateSubscriptions: (onUnlock) => {
189
+ const { isUnlocked } = this.messenger.call('KeyringController:getState');
190
+ this.#keyringController.isUnlocked = isUnlocked;
191
+ this.messenger.subscribe('KeyringController:unlock', () => {
192
+ this.#keyringController.isUnlocked = true;
193
+ // messaging system cannot await promises
194
+ // we don't need to wait for a result on this.
195
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
196
+ onUnlock();
197
+ });
198
+ this.messenger.subscribe('KeyringController:lock', () => {
199
+ this.#keyringController.isUnlocked = false;
200
+ });
201
+ },
202
+ };
203
+ #auth = {
204
+ getBearerToken: async () => {
205
+ return await this.messenger.call('AuthenticationController:getBearerToken');
206
+ },
207
+ isSignedIn: () => {
208
+ return this.messenger.call('AuthenticationController:isSignedIn');
209
+ },
210
+ signIn: async () => {
211
+ return await this.messenger.call('AuthenticationController:performSignIn');
212
+ },
213
+ };
214
+ #pushNotifications = {
215
+ // Flag to check is notifications have been setup when the browser/extension is initialized.
216
+ // We want to re-initialize push notifications when the browser/extension is refreshed
217
+ // To ensure we subscribe to the most up-to-date notifications
218
+ isSetup: false,
219
+ subscribeToPushNotifications: async () => {
220
+ await this.messenger.call('NotificationServicesPushController:subscribeToPushNotifications');
221
+ },
222
+ enablePushNotifications: async (addresses) => {
223
+ try {
224
+ await this.messenger.call('NotificationServicesPushController:enablePushNotifications', addresses);
225
+ }
226
+ catch {
227
+ // Do nothing, failing silently.
228
+ }
229
+ },
230
+ addPushNotificationLinks: async (addresses) => {
231
+ try {
232
+ await this.messenger.call('NotificationServicesPushController:addPushNotificationLinks', addresses);
233
+ }
234
+ catch {
235
+ // Do nothing, failing silently.
236
+ }
237
+ },
238
+ disablePushNotifications: async () => {
239
+ try {
240
+ await this.messenger.call('NotificationServicesPushController:disablePushNotifications');
241
+ }
242
+ catch {
243
+ // Do nothing, failing silently.
244
+ }
245
+ },
246
+ deletePushNotificationLinks: async (addresses) => {
247
+ try {
248
+ await this.messenger.call('NotificationServicesPushController:deletePushNotificationLinks', addresses);
249
+ }
250
+ catch {
251
+ // Do nothing, failing silently.
252
+ }
253
+ },
254
+ subscribe: () => {
255
+ // Coalesce pushes: at most one fetch in-flight, one queued.
256
+ // Re-fetch after completion because the new row may not be visible yet when the push arrives.
257
+ let pushFetchInFlight = false;
258
+ let pendingPushRefetch = false;
259
+ const fetchOnPush = async () => {
260
+ pushFetchInFlight = true;
261
+ try {
262
+ await this.fetchAndUpdateMetamaskNotifications();
263
+ }
264
+ finally {
265
+ pushFetchInFlight = false;
266
+ if (pendingPushRefetch) {
267
+ pendingPushRefetch = false;
268
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
269
+ fetchOnPush();
270
+ }
271
+ }
272
+ };
273
+ this.messenger.subscribe('NotificationServicesPushController:onNewNotifications', () => {
274
+ if (pushFetchInFlight) {
275
+ pendingPushRefetch = true;
276
+ return;
277
+ }
278
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
279
+ fetchOnPush();
280
+ });
281
+ },
282
+ initializePushNotifications: async () => {
283
+ if (!this.state.isNotificationServicesEnabled) {
284
+ return;
285
+ }
286
+ if (this.#pushNotifications.isSetup) {
287
+ return;
288
+ }
289
+ // If wallet is unlocked, we can create a fresh push subscription
290
+ // Otherwise we can subscribe to original subscription
291
+ try {
292
+ if (!this.#keyringController.isUnlocked) {
293
+ throw new Error('Keyring is locked');
294
+ }
295
+ await this.enablePushNotifications();
296
+ this.#pushNotifications.isSetup = true;
297
+ }
298
+ catch {
299
+ await this.#pushNotifications
300
+ .subscribeToPushNotifications()
301
+ .catch(() => {
302
+ // do nothing
303
+ });
304
+ }
305
+ },
306
+ };
307
+ #accounts = {
308
+ // Flag to ensure we only setup once
309
+ isNotificationAccountsSetup: false,
310
+ getNotificationAccounts: () => {
311
+ const { keyrings } = this.messenger.call('KeyringController:getState');
312
+ const keyringAccounts = [
313
+ ...new Set(keyrings
314
+ .flatMap((keyring) => keyring.accounts)
315
+ .map((address) => {
316
+ try {
317
+ return toChecksumHexAddress(address);
318
+ }
319
+ catch {
320
+ return null;
321
+ }
322
+ })
323
+ .filter((address) => address !== null && isValidHexAddress(address))),
324
+ ];
325
+ return keyringAccounts.length > 0 ? keyringAccounts : null;
326
+ },
327
+ /**
328
+ * Used to get list of addresses from keyring (wallet addresses)
329
+ *
330
+ * @returns addresses removed, added, and latest list of addresses
331
+ */
332
+ listAccounts: () => {
333
+ // Get previous and current account sets
334
+ const nonChecksumAccounts = this.#accounts.getNotificationAccounts();
335
+ if (!nonChecksumAccounts) {
336
+ return {
337
+ accountsAdded: [],
338
+ accountsRemoved: [],
339
+ accounts: [],
340
+ };
341
+ }
342
+ const accounts = nonChecksumAccounts
343
+ .map((address) => toChecksumHexAddress(address))
344
+ .filter((address) => isValidHexAddress(address));
345
+ const currentAccountsSet = new Set(accounts);
346
+ const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);
347
+ // Invalid value you cannot have zero accounts
348
+ // Only occurs when the Accounts controller is initializing.
349
+ if (accounts.length === 0) {
350
+ return {
351
+ accountsAdded: [],
352
+ accountsRemoved: [],
353
+ accounts: [],
354
+ };
355
+ }
356
+ // Calculate added and removed addresses
357
+ const accountsAdded = accounts.filter((account) => !prevAccountsSet.has(account));
358
+ const accountsRemoved = [...prevAccountsSet.values()].filter((account) => !currentAccountsSet.has(account));
359
+ // Update accounts seen
360
+ this.update((state) => {
361
+ state.subscriptionAccountsSeen = [...currentAccountsSet];
362
+ });
363
+ return {
364
+ accountsAdded,
365
+ accountsRemoved,
366
+ accounts,
367
+ };
368
+ },
369
+ /**
370
+ * Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.
371
+ */
372
+ initialize: () => {
373
+ if (this.#keyringController.isUnlocked &&
374
+ !this.#accounts.isNotificationAccountsSetup) {
375
+ this.#accounts.listAccounts();
376
+ this.#accounts.isNotificationAccountsSetup = true;
377
+ }
378
+ },
379
+ /**
380
+ * Subscription to any state change in the keyring controller (aka wallet accounts).
381
+ * We can call the `listAccounts` defined above to find out about any accounts added, removed
382
+ * And call effects to subscribe/unsubscribe to notifications.
383
+ */
384
+ subscribe: () => {
385
+ const debouncedUpdateAccountNotifications = debounce(async (totalAccounts, prevTotalAccounts) => {
386
+ const hasTotalAccountsChanged = totalAccounts !== prevTotalAccounts;
387
+ if (!this.state.isNotificationServicesEnabled ||
388
+ !hasTotalAccountsChanged) {
389
+ return;
390
+ }
391
+ const { accountsAdded, accountsRemoved } = this.#accounts.listAccounts();
392
+ const promises = [];
393
+ if (accountsAdded.length > 0) {
394
+ promises.push(this.enableAccounts(accountsAdded));
395
+ }
396
+ if (accountsRemoved.length > 0) {
397
+ promises.push(this.disableAccounts(accountsRemoved));
398
+ }
399
+ await Promise.allSettled(promises);
400
+ }, ACCOUNTS_UPDATE_DEBOUNCE_TIME_MS);
401
+ this.messenger.subscribe('KeyringController:stateChange',
402
+ // Using void return for async callback - result is intentionally ignored
403
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
404
+ debouncedUpdateAccountNotifications, (state) => {
405
+ return (state?.keyrings?.flatMap?.((keyring) => keyring.accounts)?.length ??
406
+ 0);
407
+ });
408
+ },
409
+ };
410
+ #locale;
411
+ #featureAnnouncementEnv;
412
+ #env;
206
413
  /**
207
414
  * Creates a NotificationServicesController instance.
208
415
  *
@@ -221,271 +428,158 @@ export class NotificationServicesController extends BaseController {
221
428
  name: controllerName,
222
429
  state: { ...defaultState, ...state },
223
430
  });
224
- _NotificationServicesController_instances.add(this);
225
- _NotificationServicesController_keyringController.set(this, {
226
- isUnlocked: false,
227
- setupLockedStateSubscriptions: (onUnlock) => {
228
- const { isUnlocked } = this.messenger.call('KeyringController:getState');
229
- __classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked = isUnlocked;
230
- this.messenger.subscribe('KeyringController:unlock', () => {
231
- __classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked = true;
232
- // messaging system cannot await promises
233
- // we don't need to wait for a result on this.
234
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
235
- onUnlock();
236
- });
237
- this.messenger.subscribe('KeyringController:lock', () => {
238
- __classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked = false;
239
- });
240
- },
431
+ this.#featureAnnouncementEnv = env.featureAnnouncements;
432
+ this.#locale = env.locale ?? (() => 'en');
433
+ this.#env = env.env ?? 'prd';
434
+ this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
435
+ this.#clearLoadingStates();
436
+ }
437
+ init() {
438
+ this.#keyringController.setupLockedStateSubscriptions(async () => {
439
+ this.#accounts.initialize();
440
+ await this.#pushNotifications.initializePushNotifications();
241
441
  });
242
- _NotificationServicesController_auth.set(this, {
243
- getBearerToken: async () => {
244
- return await this.messenger.call('AuthenticationController:getBearerToken');
245
- },
246
- isSignedIn: () => {
247
- return this.messenger.call('AuthenticationController:isSignedIn');
248
- },
249
- signIn: async () => {
250
- return await this.messenger.call('AuthenticationController:performSignIn');
251
- },
442
+ this.#accounts.initialize();
443
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
444
+ this.#pushNotifications.initializePushNotifications();
445
+ this.#accounts.subscribe();
446
+ this.#pushNotifications.subscribe();
447
+ }
448
+ #clearLoadingStates() {
449
+ this.update((state) => {
450
+ state.isUpdatingMetamaskNotifications = false;
451
+ state.isCheckingAccountsPresence = false;
452
+ state.isFetchingMetamaskNotifications = false;
453
+ state.isUpdatingMetamaskNotificationsAccount = [];
252
454
  });
253
- _NotificationServicesController_pushNotifications.set(this, {
254
- // Flag to check is notifications have been setup when the browser/extension is initialized.
255
- // We want to re-initialize push notifications when the browser/extension is refreshed
256
- // To ensure we subscribe to the most up-to-date notifications
257
- isSetup: false,
258
- subscribeToPushNotifications: async () => {
259
- await this.messenger.call('NotificationServicesPushController:subscribeToPushNotifications');
260
- },
261
- enablePushNotifications: async (addresses) => {
262
- try {
263
- await this.messenger.call('NotificationServicesPushController:enablePushNotifications', addresses);
264
- }
265
- catch {
266
- // Do nothing, failing silently.
267
- }
268
- },
269
- addPushNotificationLinks: async (addresses) => {
270
- try {
271
- await this.messenger.call('NotificationServicesPushController:addPushNotificationLinks', addresses);
272
- }
273
- catch {
274
- // Do nothing, failing silently.
275
- }
276
- },
277
- disablePushNotifications: async () => {
278
- try {
279
- await this.messenger.call('NotificationServicesPushController:disablePushNotifications');
280
- }
281
- catch {
282
- // Do nothing, failing silently.
283
- }
284
- },
285
- deletePushNotificationLinks: async (addresses) => {
286
- try {
287
- await this.messenger.call('NotificationServicesPushController:deletePushNotificationLinks', addresses);
288
- }
289
- catch {
290
- // Do nothing, failing silently.
291
- }
292
- },
293
- subscribe: () => {
294
- // Coalesce pushes: at most one fetch in-flight, one queued.
295
- // Re-fetch after completion because the new row may not be visible yet when the push arrives.
296
- let pushFetchInFlight = false;
297
- let pendingPushRefetch = false;
298
- const fetchOnPush = async () => {
299
- pushFetchInFlight = true;
300
- try {
301
- await this.fetchAndUpdateMetamaskNotifications();
302
- }
303
- finally {
304
- pushFetchInFlight = false;
305
- if (pendingPushRefetch) {
306
- pendingPushRefetch = false;
307
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
308
- fetchOnPush();
309
- }
310
- }
311
- };
312
- this.messenger.subscribe('NotificationServicesPushController:onNewNotifications', () => {
313
- if (pushFetchInFlight) {
314
- pendingPushRefetch = true;
315
- return;
316
- }
317
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
318
- fetchOnPush();
319
- });
320
- },
321
- initializePushNotifications: async () => {
322
- if (!this.state.isNotificationServicesEnabled) {
323
- return;
324
- }
325
- if (__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isSetup) {
326
- return;
327
- }
328
- // If wallet is unlocked, we can create a fresh push subscription
329
- // Otherwise we can subscribe to original subscription
330
- try {
331
- if (!__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked) {
332
- throw new Error('Keyring is locked');
333
- }
334
- await this.enablePushNotifications();
335
- __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isSetup = true;
336
- }
337
- catch {
338
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f")
339
- .subscribeToPushNotifications()
340
- .catch(() => {
341
- // do nothing
342
- });
343
- }
344
- },
455
+ }
456
+ #assertAuthEnabled() {
457
+ if (!this.#auth.isSignedIn()) {
458
+ this.update((state) => {
459
+ state.isNotificationServicesEnabled = false;
460
+ });
461
+ throw new Error('User is not signed in.');
462
+ }
463
+ }
464
+ async #enableAuth() {
465
+ const isSignedIn = this.#auth.isSignedIn();
466
+ if (!isSignedIn) {
467
+ await this.#auth.signIn();
468
+ }
469
+ }
470
+ async #getBearerToken() {
471
+ this.#assertAuthEnabled();
472
+ const bearerToken = await this.#auth.getBearerToken();
473
+ if (!bearerToken) {
474
+ throw new Error('Missing BearerToken');
475
+ }
476
+ return { bearerToken };
477
+ }
478
+ /**
479
+ * Registers this device for push notifications on the given addresses.
480
+ *
481
+ * An empty list cannot be sent: the push API rejects a registration with no
482
+ * addresses, and because that request is what performs the delete-and-reinsert
483
+ * of the device's links, a rejection leaves the previous links in place and
484
+ * push keeps arriving. So "no addresses" has to mean unregistering the device.
485
+ *
486
+ * @param addresses - The addresses to receive push notifications for.
487
+ */
488
+ async #registerPushNotifications(addresses) {
489
+ if (addresses.length === 0) {
490
+ await this.#pushNotifications.disablePushNotifications();
491
+ return;
492
+ }
493
+ await this.#pushNotifications.enablePushNotifications(addresses);
494
+ }
495
+ /**
496
+ * Sets the state of notification creation process.
497
+ *
498
+ * This method updates the `isUpdatingMetamaskNotifications` state, which can be used to indicate
499
+ * whether the notification creation process is currently active or not. This is useful
500
+ * for UI elements that need to reflect the state of ongoing operations, such as loading
501
+ * indicators or disabled buttons during processing.
502
+ *
503
+ * @param isUpdatingMetamaskNotifications - A boolean value representing the new state of the notification creation process.
504
+ */
505
+ #setIsUpdatingMetamaskNotifications(isUpdatingMetamaskNotifications) {
506
+ this.update((state) => {
507
+ state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;
345
508
  });
346
- _NotificationServicesController_accounts.set(this, {
347
- // Flag to ensure we only setup once
348
- isNotificationAccountsSetup: false,
349
- getNotificationAccounts: () => {
350
- const { keyrings } = this.messenger.call('KeyringController:getState');
351
- const keyringAccounts = [
352
- ...new Set(keyrings
353
- .flatMap((keyring) => keyring.accounts)
354
- .map((address) => {
355
- try {
356
- return toChecksumHexAddress(address);
357
- }
358
- catch {
359
- return null;
360
- }
361
- })
362
- .filter((address) => address !== null && isValidHexAddress(address))),
363
- ];
364
- return keyringAccounts.length > 0 ? keyringAccounts : null;
365
- },
366
- /**
367
- * Used to get list of addresses from keyring (wallet addresses)
368
- *
369
- * @returns addresses removed, added, and latest list of addresses
370
- */
371
- listAccounts: () => {
372
- // Get previous and current account sets
373
- const nonChecksumAccounts = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").getNotificationAccounts();
374
- if (!nonChecksumAccounts) {
375
- return {
376
- accountsAdded: [],
377
- accountsRemoved: [],
378
- accounts: [],
379
- };
380
- }
381
- const accounts = nonChecksumAccounts
382
- .map((address) => toChecksumHexAddress(address))
383
- .filter((address) => isValidHexAddress(address));
384
- const currentAccountsSet = new Set(accounts);
385
- const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);
386
- // Invalid value you cannot have zero accounts
387
- // Only occurs when the Accounts controller is initializing.
388
- if (accounts.length === 0) {
389
- return {
390
- accountsAdded: [],
391
- accountsRemoved: [],
392
- accounts: [],
393
- };
394
- }
395
- // Calculate added and removed addresses
396
- const accountsAdded = accounts.filter((account) => !prevAccountsSet.has(account));
397
- const accountsRemoved = [...prevAccountsSet.values()].filter((account) => !currentAccountsSet.has(account));
398
- // Update accounts seen
399
- this.update((state) => {
400
- state.subscriptionAccountsSeen = [...currentAccountsSet];
401
- });
402
- return {
403
- accountsAdded,
404
- accountsRemoved,
405
- accounts,
406
- };
407
- },
408
- /**
409
- * Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.
410
- */
411
- initialize: () => {
412
- if (__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked &&
413
- !__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup) {
414
- __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
415
- __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup = true;
416
- }
417
- },
418
- /**
419
- * Subscription to any state change in the keyring controller (aka wallet accounts).
420
- * We can call the `listAccounts` defined above to find out about any accounts added, removed
421
- * And call effects to subscribe/unsubscribe to notifications.
422
- */
423
- subscribe: () => {
424
- const debouncedUpdateAccountNotifications = debounce(async (totalAccounts, prevTotalAccounts) => {
425
- const hasTotalAccountsChanged = totalAccounts !== prevTotalAccounts;
426
- if (!this.state.isNotificationServicesEnabled ||
427
- !hasTotalAccountsChanged) {
428
- return;
429
- }
430
- const { accountsAdded, accountsRemoved } = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
431
- const promises = [];
432
- if (accountsAdded.length > 0) {
433
- promises.push(this.enableAccounts(accountsAdded));
434
- }
435
- if (accountsRemoved.length > 0) {
436
- promises.push(this.disableAccounts(accountsRemoved));
437
- }
438
- await Promise.allSettled(promises);
439
- }, ACCOUNTS_UPDATE_DEBOUNCE_TIME_MS);
440
- this.messenger.subscribe('KeyringController:stateChange',
441
- // Using void return for async callback - result is intentionally ignored
442
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
443
- debouncedUpdateAccountNotifications, (state) => {
444
- return (state?.keyrings?.flatMap?.((keyring) => keyring.accounts)?.length ??
445
- 0);
446
- });
447
- },
509
+ }
510
+ /**
511
+ * Updates the state to indicate whether fetching of MetaMask notifications is in progress.
512
+ *
513
+ * This method is used to set the `isFetchingMetamaskNotifications` state, which can be utilized
514
+ * to show or hide loading indicators in the UI when notifications are being fetched.
515
+ *
516
+ * @param isFetchingMetamaskNotifications - A boolean value representing the fetching state.
517
+ */
518
+ #setIsFetchingMetamaskNotifications(isFetchingMetamaskNotifications) {
519
+ this.update((state) => {
520
+ state.isFetchingMetamaskNotifications = isFetchingMetamaskNotifications;
448
521
  });
449
- _NotificationServicesController_locale.set(this, void 0);
450
- _NotificationServicesController_featureAnnouncementEnv.set(this, void 0);
451
- _NotificationServicesController_env.set(this, void 0);
452
- __classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
453
- __classPrivateFieldSet(this, _NotificationServicesController_locale, env.locale ?? (() => 'en'), "f");
454
- __classPrivateFieldSet(this, _NotificationServicesController_env, env.env ?? 'prd', "f");
455
- this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
456
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
457
522
  }
458
- init() {
459
- __classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").setupLockedStateSubscriptions(async () => {
460
- __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").initialize();
461
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
523
+ /**
524
+ * Updates the state to indicate that the checking of accounts presence is in progress.
525
+ *
526
+ * This method modifies the `isCheckingAccountsPresence` state, which can be used to manage UI elements
527
+ * that depend on the status of account presence checks, such as displaying loading indicators or disabling
528
+ * buttons while the check is ongoing.
529
+ *
530
+ * @param isCheckingAccountsPresence - A boolean value indicating whether the account presence check is currently active.
531
+ */
532
+ #setIsCheckingAccountsPresence(isCheckingAccountsPresence) {
533
+ this.update((state) => {
534
+ state.isCheckingAccountsPresence = isCheckingAccountsPresence;
535
+ });
536
+ }
537
+ /**
538
+ * Updates the state to indicate that account updates are in progress.
539
+ * Removes duplicate accounts before updating the state.
540
+ *
541
+ * @param accounts - The accounts being updated.
542
+ */
543
+ #updateUpdatingAccountsState(accounts) {
544
+ this.update((state) => {
545
+ const uniqueAccounts = new Set([
546
+ ...state.isUpdatingMetamaskNotificationsAccount,
547
+ ...accounts,
548
+ ]);
549
+ state.isUpdatingMetamaskNotificationsAccount = Array.from(uniqueAccounts);
550
+ });
551
+ }
552
+ /**
553
+ * Clears the state indicating that account updates are complete.
554
+ *
555
+ * @param accounts - The accounts that have finished updating.
556
+ */
557
+ #clearUpdatingAccountsState(accounts) {
558
+ this.update((state) => {
559
+ state.isUpdatingMetamaskNotificationsAccount =
560
+ state.isUpdatingMetamaskNotificationsAccount.filter((existingAccount) => !accounts.includes(existingAccount));
462
561
  });
463
- __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").initialize();
464
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
465
- __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
466
- __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").subscribe();
467
- __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").subscribe();
468
562
  }
469
563
  /**
470
564
  * Public method to expose enabling push notifications
471
565
  */
472
566
  async enablePushNotifications() {
473
567
  try {
474
- const { accounts } = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
475
- if (!__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked || accounts.length === 0) {
568
+ const { accounts } = this.#accounts.listAccounts();
569
+ if (!this.#keyringController.isUnlocked || accounts.length === 0) {
476
570
  // no keyring accounts could be caused by calling this function while keyring is locked
477
571
  // it does not mean the user does not have any enabled accounts on Trigger API
478
572
  return;
479
573
  }
480
- const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getBearerToken).call(this);
481
- const enabledAddresses = await getEnabledAccounts(bearerToken, accounts, __classPrivateFieldGet(this, _NotificationServicesController_env, "f"));
574
+ const { bearerToken } = await this.#getBearerToken();
575
+ const enabledAddresses = await getEnabledAccounts(bearerToken, accounts, this.#env);
482
576
  if (enabledAddresses === null) {
483
577
  // "No addresses" unregisters the device, so an unreadable subscription
484
578
  // list must not be treated as an empty one: leave the existing links
485
579
  // alone until we can read the real state.
486
580
  return;
487
581
  }
488
- await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerPushNotifications).call(this, enabledAddresses);
582
+ await this.#registerPushNotifications(enabledAddresses);
489
583
  }
490
584
  catch {
491
585
  // Do nothing, failing silently.
@@ -495,13 +589,13 @@ export class NotificationServicesController extends BaseController {
495
589
  * Public method to expose disabling push notifications
496
590
  */
497
591
  async disablePushNotifications() {
498
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
592
+ await this.#pushNotifications.disablePushNotifications();
499
593
  }
500
594
  async checkAccountsPresence(accounts) {
501
595
  try {
502
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsCheckingAccountsPresence).call(this, true);
503
- const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getBearerToken).call(this);
504
- const triggerConfig = await getNotificationsApiConfigCached(bearerToken, accounts, __classPrivateFieldGet(this, _NotificationServicesController_env, "f"));
596
+ this.#setIsCheckingAccountsPresence(true);
597
+ const { bearerToken } = await this.#getBearerToken();
598
+ const triggerConfig = await getNotificationsApiConfigCached(bearerToken, accounts, this.#env);
505
599
  if (triggerConfig === null) {
506
600
  // Reporting every account as disabled would misrepresent the user's
507
601
  // settings, so surface the failure instead.
@@ -522,7 +616,7 @@ export class NotificationServicesController extends BaseController {
522
616
  throw error;
523
617
  }
524
618
  finally {
525
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsCheckingAccountsPresence).call(this, false);
619
+ this.#setIsCheckingAccountsPresence(false);
526
620
  }
527
621
  }
528
622
  /**
@@ -565,14 +659,14 @@ export class NotificationServicesController extends BaseController {
565
659
  */
566
660
  async createOnChainTriggers(opts = {}) {
567
661
  try {
568
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
569
- const { accounts } = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
570
- if (!__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked || accounts.length === 0) {
662
+ this.#setIsUpdatingMetamaskNotifications(true);
663
+ const { accounts } = this.#accounts.listAccounts();
664
+ if (!this.#keyringController.isUnlocked || accounts.length === 0) {
571
665
  // no keyring accounts could be caused by calling this function while keyring is locked
572
666
  // it does not mean the user does not have any enabled accounts on Trigger API
573
667
  return;
574
668
  }
575
- const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getBearerToken).call(this);
669
+ const { bearerToken } = await this.#getBearerToken();
576
670
  // 1. Read existing AUS notification preferences. Their absence is what
577
671
  // marks a first-time setup, and they are initialized in step 3.
578
672
  const preferences = await this.messenger.call('AuthenticatedUserStorageService:getNotificationPreferences');
@@ -589,7 +683,7 @@ export class NotificationServicesController extends BaseController {
589
683
  // Even at first-time setup, existing subscriptions win: a user upgrading
590
684
  // from a client that never wrote a preferences blob keeps whichever
591
685
  // accounts they had already disabled.
592
- let accountsWithNotifications = await getEnabledAccounts(bearerToken, accounts, __classPrivateFieldGet(this, _NotificationServicesController_env, "f"));
686
+ let accountsWithNotifications = await getEnabledAccounts(bearerToken, accounts, this.#env);
593
687
  if (accountsWithNotifications === null) {
594
688
  // An unreadable subscription list is not an empty one. Subscribing
595
689
  // every account here would re-enable ones the user had turned off, and
@@ -598,7 +692,7 @@ export class NotificationServicesController extends BaseController {
598
692
  throw new Error('Failed to read wallet-activity subscriptions');
599
693
  }
600
694
  if (isFirstTimeSetup && accountsWithNotifications.length === 0) {
601
- await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })), __classPrivateFieldGet(this, _NotificationServicesController_env, "f"));
695
+ await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })), this.#env);
602
696
  // Match the lower-case form the Trigger API echoes back, which is what
603
697
  // every other path feeding the push API uses.
604
698
  accountsWithNotifications = accounts.map((address) => address.toLowerCase());
@@ -609,11 +703,11 @@ export class NotificationServicesController extends BaseController {
609
703
  // failed subscribe leave the user enabled with no accounts subscribed
610
704
  // and no second chance to seed them.
611
705
  if (isFirstTimeSetup) {
612
- await this.messenger.call('AuthenticatedUserStorageService:putNotificationPreferences', buildFreshPreferences(hasMarketingConsent, productAnnouncementEnabled), __classPrivateFieldGet(this, _NotificationServicesController_featureAnnouncementEnv, "f").platform);
706
+ await this.messenger.call('AuthenticatedUserStorageService:putNotificationPreferences', buildFreshPreferences(hasMarketingConsent, productAnnouncementEnabled), this.#featureAnnouncementEnv.platform);
613
707
  }
614
708
  if (opts.registerPushNotifications ?? true) {
615
709
  // Attempt FCM/device registration only; clients must request OS permission separately.
616
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerPushNotifications).call(this, accountsWithNotifications).catch(() => {
710
+ this.#registerPushNotifications(accountsWithNotifications).catch(() => {
617
711
  // Do Nothing
618
712
  });
619
713
  }
@@ -637,7 +731,7 @@ export class NotificationServicesController extends BaseController {
637
731
  throw new Error('Failed to create On Chain triggers');
638
732
  }
639
733
  finally {
640
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
734
+ this.#setIsUpdatingMetamaskNotifications(false);
641
735
  }
642
736
  }
643
737
  /**
@@ -649,8 +743,8 @@ export class NotificationServicesController extends BaseController {
649
743
  */
650
744
  async enableMetamaskNotifications(opts = {}) {
651
745
  try {
652
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
653
- await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_enableAuth).call(this);
746
+ this.#setIsUpdatingMetamaskNotifications(true);
747
+ await this.#enableAuth();
654
748
  await this.createOnChainTriggers(opts);
655
749
  }
656
750
  catch (error) {
@@ -658,7 +752,7 @@ export class NotificationServicesController extends BaseController {
658
752
  throw new Error('Unable to enable notifications');
659
753
  }
660
754
  finally {
661
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
755
+ this.#setIsUpdatingMetamaskNotifications(false);
662
756
  }
663
757
  }
664
758
  /**
@@ -670,10 +764,10 @@ export class NotificationServicesController extends BaseController {
670
764
  * @throws {Error} If the user is not authenticated or if there is an error during the process.
671
765
  */
672
766
  async disableNotificationServices() {
673
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
767
+ this.#setIsUpdatingMetamaskNotifications(true);
674
768
  // Attempt Disable Push Notifications
675
769
  try {
676
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
770
+ await this.#pushNotifications.disablePushNotifications();
677
771
  }
678
772
  catch {
679
773
  // Do nothing
@@ -688,7 +782,7 @@ export class NotificationServicesController extends BaseController {
688
782
  state.metamaskNotificationsList = snapNotifications;
689
783
  });
690
784
  // Finish Updating State
691
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
785
+ this.#setIsUpdatingMetamaskNotifications(false);
692
786
  }
693
787
  /**
694
788
  * Deletes on-chain triggers associated with a specific account/s.
@@ -705,16 +799,16 @@ export class NotificationServicesController extends BaseController {
705
799
  */
706
800
  async disableAccounts(accounts) {
707
801
  try {
708
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_updateUpdatingAccountsState).call(this, accounts);
709
- const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getBearerToken).call(this);
710
- await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: false })), __classPrivateFieldGet(this, _NotificationServicesController_env, "f"));
711
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").deletePushNotificationLinks(accounts);
802
+ this.#updateUpdatingAccountsState(accounts);
803
+ const { bearerToken } = await this.#getBearerToken();
804
+ await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: false })), this.#env);
805
+ await this.#pushNotifications.deletePushNotificationLinks(accounts);
712
806
  }
713
807
  catch {
714
808
  throw new Error('Failed to delete OnChain triggers');
715
809
  }
716
810
  finally {
717
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearUpdatingAccountsState).call(this, accounts);
811
+ this.#clearUpdatingAccountsState(accounts);
718
812
  }
719
813
  }
720
814
  /**
@@ -734,17 +828,17 @@ export class NotificationServicesController extends BaseController {
734
828
  */
735
829
  async enableAccounts(accounts) {
736
830
  try {
737
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_updateUpdatingAccountsState).call(this, accounts);
738
- const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getBearerToken).call(this);
739
- await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })), __classPrivateFieldGet(this, _NotificationServicesController_env, "f"));
740
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").addPushNotificationLinks(accounts);
831
+ this.#updateUpdatingAccountsState(accounts);
832
+ const { bearerToken } = await this.#getBearerToken();
833
+ await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })), this.#env);
834
+ await this.#pushNotifications.addPushNotificationLinks(accounts);
741
835
  }
742
836
  catch (error) {
743
837
  log.error('Failed to update OnChain triggers', error);
744
838
  throw new Error('Failed to update OnChain triggers');
745
839
  }
746
840
  finally {
747
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearUpdatingAccountsState).call(this, accounts);
841
+ this.#clearUpdatingAccountsState(accounts);
748
842
  }
749
843
  }
750
844
  /**
@@ -759,7 +853,7 @@ export class NotificationServicesController extends BaseController {
759
853
  */
760
854
  async fetchAndUpdateMetamaskNotifications(previewToken) {
761
855
  try {
762
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsFetchingMetamaskNotifications).call(this, true);
856
+ this.#setIsFetchingMetamaskNotifications(true);
763
857
  // This is used by Feature Announcement & On Chain
764
858
  // Not used by Snaps
765
859
  const isGlobalNotifsEnabled = this.state.isNotificationServicesEnabled;
@@ -771,20 +865,20 @@ export class NotificationServicesController extends BaseController {
771
865
  // Raw Feature Notifications
772
866
  const rawAnnouncements = isGlobalNotifsEnabled &&
773
867
  notificationPreferences?.marketing.inAppNotificationsEnabled
774
- ? await getFeatureAnnouncementNotifications(__classPrivateFieldGet(this, _NotificationServicesController_featureAnnouncementEnv, "f"), previewToken).catch(() => [])
868
+ ? await getFeatureAnnouncementNotifications(this.#featureAnnouncementEnv, previewToken).catch(() => [])
775
869
  : [];
776
870
  // Raw On Chain Notifications
777
871
  const rawOnChainNotifications = [];
778
872
  if (isGlobalNotifsEnabled) {
779
873
  try {
780
- const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getBearerToken).call(this);
874
+ const { bearerToken } = await this.#getBearerToken();
781
875
  // Addresses come from the keyring, so this installation can only ever
782
876
  // ask for activity on accounts it actually holds. The Trigger API
783
877
  // narrows that to the ones the user has enabled.
784
- const { accounts } = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
785
- const addressesWithNotifications = await getEnabledAccounts(bearerToken, accounts, __classPrivateFieldGet(this, _NotificationServicesController_env, "f"));
878
+ const { accounts } = this.#accounts.listAccounts();
879
+ const addressesWithNotifications = await getEnabledAccounts(bearerToken, accounts, this.#env);
786
880
  if (addressesWithNotifications !== null) {
787
- const notifications = await getAPINotifications(bearerToken, addressesWithNotifications, __classPrivateFieldGet(this, _NotificationServicesController_locale, "f").call(this), __classPrivateFieldGet(this, _NotificationServicesController_featureAnnouncementEnv, "f").platform, __classPrivateFieldGet(this, _NotificationServicesController_env, "f")).catch(() => []);
881
+ const notifications = await getAPINotifications(bearerToken, addressesWithNotifications, this.#locale(), this.#featureAnnouncementEnv.platform, this.#env).catch(() => []);
788
882
  rawOnChainNotifications.push(...notifications);
789
883
  }
790
884
  }
@@ -810,11 +904,11 @@ export class NotificationServicesController extends BaseController {
810
904
  state.metamaskNotificationsList = metamaskNotifications;
811
905
  });
812
906
  this.messenger.publish(`${controllerName}:notificationsListUpdated`, this.state.metamaskNotificationsList);
813
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsFetchingMetamaskNotifications).call(this, false);
907
+ this.#setIsFetchingMetamaskNotifications(false);
814
908
  return metamaskNotifications;
815
909
  }
816
910
  catch (error) {
817
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsFetchingMetamaskNotifications).call(this, false);
911
+ this.#setIsFetchingMetamaskNotifications(false);
818
912
  log.error('Failed to fetch notifications', error);
819
913
  throw new Error('Failed to fetch notifications');
820
914
  }
@@ -893,10 +987,10 @@ export class NotificationServicesController extends BaseController {
893
987
  }, [[], [], []]);
894
988
  // Mark On-Chain Notifications as Read
895
989
  if (onChainNotifications.length > 0) {
896
- const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
990
+ const bearerToken = await this.#auth.getBearerToken();
897
991
  if (bearerToken) {
898
992
  onchainNotificationIds = onChainNotifications.map((notification) => notification.id);
899
- await markNotificationsAsRead(bearerToken, onchainNotificationIds, __classPrivateFieldGet(this, _NotificationServicesController_env, "f")).catch(() => {
993
+ await markNotificationsAsRead(bearerToken, onchainNotificationIds, this.#env).catch(() => {
900
994
  onchainNotificationIds = [];
901
995
  log.warn('Unable to mark onchain notifications as read');
902
996
  });
@@ -975,7 +1069,7 @@ export class NotificationServicesController extends BaseController {
975
1069
  */
976
1070
  async sendPerpPlaceOrderNotification(input) {
977
1071
  try {
978
- const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getBearerToken).call(this);
1072
+ const { bearerToken } = await this.#getBearerToken();
979
1073
  await createPerpOrderNotification(bearerToken, input);
980
1074
  }
981
1075
  catch {
@@ -983,73 +1077,4 @@ export class NotificationServicesController extends BaseController {
983
1077
  }
984
1078
  }
985
1079
  }
986
- _NotificationServicesController_keyringController = new WeakMap(), _NotificationServicesController_auth = new WeakMap(), _NotificationServicesController_pushNotifications = new WeakMap(), _NotificationServicesController_accounts = new WeakMap(), _NotificationServicesController_locale = new WeakMap(), _NotificationServicesController_featureAnnouncementEnv = new WeakMap(), _NotificationServicesController_env = new WeakMap(), _NotificationServicesController_instances = new WeakSet(), _NotificationServicesController_clearLoadingStates = function _NotificationServicesController_clearLoadingStates() {
987
- this.update((state) => {
988
- state.isUpdatingMetamaskNotifications = false;
989
- state.isCheckingAccountsPresence = false;
990
- state.isFetchingMetamaskNotifications = false;
991
- state.isUpdatingMetamaskNotificationsAccount = [];
992
- });
993
- }, _NotificationServicesController_assertAuthEnabled = function _NotificationServicesController_assertAuthEnabled() {
994
- if (!__classPrivateFieldGet(this, _NotificationServicesController_auth, "f").isSignedIn()) {
995
- this.update((state) => {
996
- state.isNotificationServicesEnabled = false;
997
- });
998
- throw new Error('User is not signed in.');
999
- }
1000
- }, _NotificationServicesController_enableAuth = async function _NotificationServicesController_enableAuth() {
1001
- const isSignedIn = __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").isSignedIn();
1002
- if (!isSignedIn) {
1003
- await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").signIn();
1004
- }
1005
- }, _NotificationServicesController_getBearerToken = async function _NotificationServicesController_getBearerToken() {
1006
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertAuthEnabled).call(this);
1007
- const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
1008
- if (!bearerToken) {
1009
- throw new Error('Missing BearerToken');
1010
- }
1011
- return { bearerToken };
1012
- }, _NotificationServicesController_registerPushNotifications =
1013
- /**
1014
- * Registers this device for push notifications on the given addresses.
1015
- *
1016
- * An empty list cannot be sent: the push API rejects a registration with no
1017
- * addresses, and because that request is what performs the delete-and-reinsert
1018
- * of the device's links, a rejection leaves the previous links in place and
1019
- * push keeps arriving. So "no addresses" has to mean unregistering the device.
1020
- *
1021
- * @param addresses - The addresses to receive push notifications for.
1022
- */
1023
- async function _NotificationServicesController_registerPushNotifications(addresses) {
1024
- if (addresses.length === 0) {
1025
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
1026
- return;
1027
- }
1028
- await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(addresses);
1029
- }, _NotificationServicesController_setIsUpdatingMetamaskNotifications = function _NotificationServicesController_setIsUpdatingMetamaskNotifications(isUpdatingMetamaskNotifications) {
1030
- this.update((state) => {
1031
- state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;
1032
- });
1033
- }, _NotificationServicesController_setIsFetchingMetamaskNotifications = function _NotificationServicesController_setIsFetchingMetamaskNotifications(isFetchingMetamaskNotifications) {
1034
- this.update((state) => {
1035
- state.isFetchingMetamaskNotifications = isFetchingMetamaskNotifications;
1036
- });
1037
- }, _NotificationServicesController_setIsCheckingAccountsPresence = function _NotificationServicesController_setIsCheckingAccountsPresence(isCheckingAccountsPresence) {
1038
- this.update((state) => {
1039
- state.isCheckingAccountsPresence = isCheckingAccountsPresence;
1040
- });
1041
- }, _NotificationServicesController_updateUpdatingAccountsState = function _NotificationServicesController_updateUpdatingAccountsState(accounts) {
1042
- this.update((state) => {
1043
- const uniqueAccounts = new Set([
1044
- ...state.isUpdatingMetamaskNotificationsAccount,
1045
- ...accounts,
1046
- ]);
1047
- state.isUpdatingMetamaskNotificationsAccount = Array.from(uniqueAccounts);
1048
- });
1049
- }, _NotificationServicesController_clearUpdatingAccountsState = function _NotificationServicesController_clearUpdatingAccountsState(accounts) {
1050
- this.update((state) => {
1051
- state.isUpdatingMetamaskNotificationsAccount =
1052
- state.isUpdatingMetamaskNotificationsAccount.filter((existingAccount) => !accounts.includes(existingAccount));
1053
- });
1054
- };
1055
- //# sourceMappingURL=NotificationServicesController.mjs.map
1080
+ //# sourceMappingURL=NotificationServicesController.js.map