@metamask-previews/notification-services-controller 0.5.0-preview-367cb1da → 0.5.0-preview-cf09c0a

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 (714) hide show
  1. package/dist/NotificationServicesController/NotificationServicesController.cjs +803 -0
  2. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -0
  3. package/dist/{types/NotificationServicesController/NotificationServicesController.d.ts → NotificationServicesController/NotificationServicesController.d.cts} +7 -7
  4. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -0
  5. package/dist/NotificationServicesController/NotificationServicesController.d.mts +238 -0
  6. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -0
  7. package/dist/NotificationServicesController/NotificationServicesController.mjs +779 -17
  8. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
  9. package/dist/NotificationServicesController/__fixtures__/index.cjs +22 -0
  10. package/dist/NotificationServicesController/__fixtures__/index.cjs.map +1 -0
  11. package/dist/NotificationServicesController/__fixtures__/index.d.cts +6 -0
  12. package/dist/NotificationServicesController/__fixtures__/index.d.cts.map +1 -0
  13. package/dist/NotificationServicesController/__fixtures__/index.d.mts +6 -0
  14. package/dist/NotificationServicesController/__fixtures__/index.d.mts.map +1 -0
  15. package/dist/NotificationServicesController/__fixtures__/index.mjs +6 -0
  16. package/dist/NotificationServicesController/__fixtures__/index.mjs.map +1 -0
  17. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs +210 -0
  18. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs.map +1 -0
  19. package/dist/{types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts → NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts} +3 -3
  20. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts.map +1 -0
  21. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts +15 -0
  22. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts.map +1 -0
  23. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs +205 -0
  24. package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs.map +1 -0
  25. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs +22 -0
  26. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs.map +1 -0
  27. package/dist/{types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts → NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts} +2 -2
  28. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts.map +1 -0
  29. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts +9 -0
  30. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts.map +1 -0
  31. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs +18 -0
  32. package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs.map +1 -0
  33. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs +82 -0
  34. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs.map +1 -0
  35. package/dist/{types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts → NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts} +3 -3
  36. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts.map +1 -0
  37. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts +35 -0
  38. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts.map +1 -0
  39. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs +76 -0
  40. package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs.map +1 -0
  41. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs +624 -0
  42. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +1 -0
  43. package/dist/{types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts → NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts} +2 -2
  44. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +1 -0
  45. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts +82 -0
  46. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +1 -0
  47. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs +605 -0
  48. package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +1 -0
  49. package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs +50 -0
  50. package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs.map +1 -0
  51. package/dist/{types/NotificationServicesController/__fixtures__/mockResponses.d.ts → NotificationServicesController/__fixtures__/mockResponses.d.cts} +5 -5
  52. package/dist/NotificationServicesController/__fixtures__/mockResponses.d.cts.map +1 -0
  53. package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts +28 -0
  54. package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts.map +1 -0
  55. package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs +42 -0
  56. package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs.map +1 -0
  57. package/dist/NotificationServicesController/__fixtures__/mockServices.cjs +56 -0
  58. package/dist/NotificationServicesController/__fixtures__/mockServices.cjs.map +1 -0
  59. package/dist/{types/NotificationServicesController/__fixtures__/mockServices.d.ts → NotificationServicesController/__fixtures__/mockServices.d.cts} +2 -2
  60. package/dist/NotificationServicesController/__fixtures__/mockServices.d.cts.map +1 -0
  61. package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts +12 -0
  62. package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts.map +1 -0
  63. package/dist/NotificationServicesController/__fixtures__/mockServices.mjs +52 -0
  64. package/dist/NotificationServicesController/__fixtures__/mockServices.mjs.map +1 -0
  65. package/dist/NotificationServicesController/__fixtures__/test-utils.cjs +31 -0
  66. package/dist/NotificationServicesController/__fixtures__/test-utils.cjs.map +1 -0
  67. package/dist/{types/NotificationServicesController/__fixtures__/test-utils.d.ts → NotificationServicesController/__fixtures__/test-utils.d.cts} +1 -1
  68. package/dist/NotificationServicesController/__fixtures__/test-utils.d.cts.map +1 -0
  69. package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts +14 -0
  70. package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts.map +1 -0
  71. package/dist/NotificationServicesController/__fixtures__/test-utils.mjs +27 -0
  72. package/dist/NotificationServicesController/__fixtures__/test-utils.mjs.map +1 -0
  73. package/dist/NotificationServicesController/constants/constants.cjs +7 -0
  74. package/dist/NotificationServicesController/constants/constants.cjs.map +1 -0
  75. package/dist/{types/NotificationServicesController/constants/constants.d.ts → NotificationServicesController/constants/constants.d.cts} +1 -1
  76. package/dist/NotificationServicesController/constants/constants.d.cts.map +1 -0
  77. package/dist/NotificationServicesController/constants/constants.d.mts +3 -0
  78. package/dist/NotificationServicesController/constants/constants.d.mts.map +1 -0
  79. package/dist/NotificationServicesController/constants/constants.mjs +3 -9
  80. package/dist/NotificationServicesController/constants/constants.mjs.map +1 -1
  81. package/dist/NotificationServicesController/constants/index.cjs +19 -0
  82. package/dist/NotificationServicesController/constants/index.cjs.map +1 -0
  83. package/dist/NotificationServicesController/constants/index.d.cts +3 -0
  84. package/dist/NotificationServicesController/constants/index.d.cts.map +1 -0
  85. package/dist/NotificationServicesController/constants/index.d.mts +3 -0
  86. package/dist/NotificationServicesController/constants/index.d.mts.map +1 -0
  87. package/dist/NotificationServicesController/constants/index.mjs +2 -28
  88. package/dist/NotificationServicesController/constants/index.mjs.map +1 -1
  89. package/dist/NotificationServicesController/constants/notification-schema.cjs +170 -0
  90. package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -0
  91. package/dist/{types/NotificationServicesController/constants/notification-schema.d.ts → NotificationServicesController/constants/notification-schema.d.cts} +2 -2
  92. package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -0
  93. package/dist/NotificationServicesController/constants/notification-schema.d.mts +48 -0
  94. package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -0
  95. package/dist/NotificationServicesController/constants/notification-schema.mjs +165 -20
  96. package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
  97. package/dist/NotificationServicesController/index.cjs +46 -0
  98. package/dist/NotificationServicesController/index.cjs.map +1 -0
  99. package/dist/NotificationServicesController/index.d.cts +14 -0
  100. package/dist/NotificationServicesController/index.d.cts.map +1 -0
  101. package/dist/NotificationServicesController/index.d.mts +14 -0
  102. package/dist/NotificationServicesController/index.d.mts.map +1 -0
  103. package/dist/NotificationServicesController/index.mjs +13 -86
  104. package/dist/NotificationServicesController/index.mjs.map +1 -1
  105. package/dist/NotificationServicesController/processors/index.cjs +20 -0
  106. package/dist/NotificationServicesController/processors/index.cjs.map +1 -0
  107. package/dist/NotificationServicesController/processors/index.d.cts +4 -0
  108. package/dist/NotificationServicesController/processors/index.d.cts.map +1 -0
  109. package/dist/NotificationServicesController/processors/index.d.mts +4 -0
  110. package/dist/NotificationServicesController/processors/index.d.mts.map +1 -0
  111. package/dist/NotificationServicesController/processors/index.mjs +3 -21
  112. package/dist/NotificationServicesController/processors/index.mjs.map +1 -1
  113. package/dist/NotificationServicesController/processors/process-feature-announcement.cjs +41 -0
  114. package/dist/{chunk-52CALMRA.js.map → NotificationServicesController/processors/process-feature-announcement.cjs.map} +1 -1
  115. package/dist/{types/NotificationServicesController/processors/process-feature-announcement.d.ts → NotificationServicesController/processors/process-feature-announcement.d.cts} +3 -3
  116. package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts.map +1 -0
  117. package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts +19 -0
  118. package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts.map +1 -0
  119. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs +34 -8
  120. package/dist/NotificationServicesController/processors/process-feature-announcement.mjs.map +1 -1
  121. package/dist/NotificationServicesController/processors/process-notifications.cjs +50 -0
  122. package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -0
  123. package/dist/{types/NotificationServicesController/processors/process-notifications.d.ts → NotificationServicesController/processors/process-notifications.d.cts} +2 -2
  124. package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -0
  125. package/dist/NotificationServicesController/processors/process-notifications.d.mts +19 -0
  126. package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -0
  127. package/dist/NotificationServicesController/processors/process-notifications.mjs +44 -12
  128. package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
  129. package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs +19 -0
  130. package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs.map +1 -0
  131. package/dist/{types/NotificationServicesController/processors/process-onchain-notifications.d.ts → NotificationServicesController/processors/process-onchain-notifications.d.cts} +3 -3
  132. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.cts.map +1 -0
  133. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts +10 -0
  134. package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts.map +1 -0
  135. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs +14 -7
  136. package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs.map +1 -1
  137. package/dist/NotificationServicesController/services/feature-announcements.cjs +97 -0
  138. package/dist/NotificationServicesController/services/feature-announcements.cjs.map +1 -0
  139. package/dist/{types/NotificationServicesController/services/feature-announcements.d.ts → NotificationServicesController/services/feature-announcements.d.cts} +4 -4
  140. package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +1 -0
  141. package/dist/NotificationServicesController/services/feature-announcements.d.mts +28 -0
  142. package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +1 -0
  143. package/dist/NotificationServicesController/services/feature-announcements.mjs +91 -12
  144. package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -1
  145. package/dist/NotificationServicesController/services/onchain-notifications.cjs +195 -0
  146. package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -0
  147. package/dist/{types/NotificationServicesController/services/onchain-notifications.d.ts → NotificationServicesController/services/onchain-notifications.d.cts} +3 -3
  148. package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -0
  149. package/dist/NotificationServicesController/services/onchain-notifications.d.mts +62 -0
  150. package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -0
  151. package/dist/NotificationServicesController/services/onchain-notifications.mjs +190 -29
  152. package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
  153. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs +3 -0
  154. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map +1 -0
  155. package/dist/{types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts → NotificationServicesController/types/feature-announcement/feature-announcement.d.cts} +3 -3
  156. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts.map +1 -0
  157. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts +32 -0
  158. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts.map +1 -0
  159. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs +1 -1
  160. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +1 -1
  161. package/dist/NotificationServicesController/types/feature-announcement/index.cjs +20 -0
  162. package/dist/NotificationServicesController/types/feature-announcement/index.cjs.map +1 -0
  163. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts +4 -0
  164. package/dist/NotificationServicesController/types/feature-announcement/index.d.cts.map +1 -0
  165. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts +4 -0
  166. package/dist/NotificationServicesController/types/feature-announcement/index.d.mts.map +1 -0
  167. package/dist/NotificationServicesController/types/feature-announcement/index.mjs +3 -4
  168. package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +1 -1
  169. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs +3 -0
  170. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs.map +1 -0
  171. package/dist/{types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts → NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts} +3 -3
  172. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts.map +1 -0
  173. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts +39 -0
  174. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts.map +1 -0
  175. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs +1 -1
  176. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs.map +1 -1
  177. package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs +3 -0
  178. package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs.map +1 -0
  179. package/dist/{types/NotificationServicesController/types/feature-announcement/type-links.d.ts → NotificationServicesController/types/feature-announcement/type-links.d.cts} +1 -1
  180. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.cts.map +1 -0
  181. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts +29 -0
  182. package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts.map +1 -0
  183. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs +1 -1
  184. package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs.map +1 -1
  185. package/dist/NotificationServicesController/types/index.cjs +21 -0
  186. package/dist/NotificationServicesController/types/index.cjs.map +1 -0
  187. package/dist/NotificationServicesController/types/index.d.cts +5 -0
  188. package/dist/NotificationServicesController/types/index.d.cts.map +1 -0
  189. package/dist/NotificationServicesController/types/index.d.mts +5 -0
  190. package/dist/NotificationServicesController/types/index.d.mts.map +1 -0
  191. package/dist/NotificationServicesController/types/index.mjs +4 -11
  192. package/dist/NotificationServicesController/types/index.mjs.map +1 -1
  193. package/dist/NotificationServicesController/types/notification/index.cjs +18 -0
  194. package/dist/NotificationServicesController/types/notification/index.cjs.map +1 -0
  195. package/dist/NotificationServicesController/types/notification/index.d.cts +2 -0
  196. package/dist/NotificationServicesController/types/notification/index.d.cts.map +1 -0
  197. package/dist/NotificationServicesController/types/notification/index.d.mts +2 -0
  198. package/dist/NotificationServicesController/types/notification/index.d.mts.map +1 -0
  199. package/dist/NotificationServicesController/types/notification/index.mjs +1 -2
  200. package/dist/NotificationServicesController/types/notification/index.mjs.map +1 -1
  201. package/dist/NotificationServicesController/types/notification/notification.cjs +3 -0
  202. package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -0
  203. package/dist/{types/NotificationServicesController/types/notification/notification.d.ts → NotificationServicesController/types/notification/notification.d.cts} +4 -4
  204. package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -0
  205. package/dist/NotificationServicesController/types/notification/notification.d.mts +25 -0
  206. package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -0
  207. package/dist/NotificationServicesController/types/notification/notification.mjs +1 -1
  208. package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
  209. package/dist/NotificationServicesController/types/on-chain-notification/index.cjs +18 -0
  210. package/dist/NotificationServicesController/types/on-chain-notification/index.cjs.map +1 -0
  211. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts +2 -0
  212. package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts.map +1 -0
  213. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts +2 -0
  214. package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts.map +1 -0
  215. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs +1 -2
  216. package/dist/NotificationServicesController/types/on-chain-notification/index.mjs.map +1 -1
  217. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs +3 -0
  218. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +1 -0
  219. package/dist/{types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts → NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts} +4 -4
  220. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +1 -0
  221. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +43 -0
  222. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +1 -0
  223. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs +1 -1
  224. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -1
  225. package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs +9 -0
  226. package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +1 -0
  227. package/dist/{types/NotificationServicesController/types/on-chain-notification/schema.d.ts → NotificationServicesController/types/on-chain-notification/schema.d.cts} +1 -1
  228. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +1 -0
  229. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts +283 -0
  230. package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +1 -0
  231. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs +7 -0
  232. package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -1
  233. package/dist/NotificationServicesController/types/type-utils.cjs +3 -0
  234. package/dist/NotificationServicesController/types/type-utils.cjs.map +1 -0
  235. package/dist/{types/NotificationServicesController/types/type-utils.d.ts → NotificationServicesController/types/type-utils.d.cts} +1 -1
  236. package/dist/NotificationServicesController/types/type-utils.d.cts.map +1 -0
  237. package/dist/NotificationServicesController/types/type-utils.d.mts +7 -0
  238. package/dist/NotificationServicesController/types/type-utils.d.mts.map +1 -0
  239. package/dist/NotificationServicesController/types/type-utils.mjs +1 -0
  240. package/dist/NotificationServicesController/types/type-utils.mjs.map +1 -1
  241. package/dist/NotificationServicesController/types/user-storage/index.cjs +18 -0
  242. package/dist/NotificationServicesController/types/user-storage/index.cjs.map +1 -0
  243. package/dist/NotificationServicesController/types/user-storage/index.d.cts +2 -0
  244. package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +1 -0
  245. package/dist/NotificationServicesController/types/user-storage/index.d.mts +2 -0
  246. package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +1 -0
  247. package/dist/NotificationServicesController/types/user-storage/index.mjs +1 -2
  248. package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -1
  249. package/dist/NotificationServicesController/types/user-storage/user-storage.cjs +3 -0
  250. package/dist/NotificationServicesController/types/user-storage/user-storage.cjs.map +1 -0
  251. package/dist/{types/NotificationServicesController/types/user-storage/user-storage.d.ts → NotificationServicesController/types/user-storage/user-storage.d.cts} +3 -3
  252. package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts.map +1 -0
  253. package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts +26 -0
  254. package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts.map +1 -0
  255. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs +1 -1
  256. package/dist/NotificationServicesController/types/user-storage/user-storage.mjs.map +1 -1
  257. package/dist/NotificationServicesController/ui/constants.cjs +62 -0
  258. package/dist/NotificationServicesController/ui/constants.cjs.map +1 -0
  259. package/dist/{types/NotificationServicesController/ui/constants.d.ts → NotificationServicesController/ui/constants.d.cts} +2 -2
  260. package/dist/NotificationServicesController/ui/constants.d.cts.map +1 -0
  261. package/dist/NotificationServicesController/ui/constants.d.mts +54 -0
  262. package/dist/NotificationServicesController/ui/constants.d.mts.map +1 -0
  263. package/dist/NotificationServicesController/ui/constants.mjs +56 -14
  264. package/dist/NotificationServicesController/ui/constants.mjs.map +1 -1
  265. package/dist/NotificationServicesController/ui/index.cjs +18 -0
  266. package/dist/NotificationServicesController/ui/index.cjs.map +1 -0
  267. package/dist/NotificationServicesController/ui/index.d.cts +2 -0
  268. package/dist/NotificationServicesController/ui/index.d.cts.map +1 -0
  269. package/dist/NotificationServicesController/ui/index.d.mts +2 -0
  270. package/dist/NotificationServicesController/ui/index.d.mts.map +1 -0
  271. package/dist/NotificationServicesController/ui/index.mjs +1 -16
  272. package/dist/NotificationServicesController/ui/index.mjs.map +1 -1
  273. package/dist/NotificationServicesController/utils/utils.cjs +348 -0
  274. package/dist/NotificationServicesController/utils/utils.cjs.map +1 -0
  275. package/dist/{types/NotificationServicesController/utils/utils.d.ts → NotificationServicesController/utils/utils.d.cts} +3 -3
  276. package/dist/NotificationServicesController/utils/utils.d.cts.map +1 -0
  277. package/dist/NotificationServicesController/utils/utils.d.mts +142 -0
  278. package/dist/NotificationServicesController/utils/utils.d.mts.map +1 -0
  279. package/dist/NotificationServicesController/utils/utils.mjs +332 -31
  280. package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
  281. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +215 -0
  282. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -0
  283. package/dist/{types/NotificationServicesPushController/NotificationServicesPushController.d.ts → NotificationServicesPushController/NotificationServicesPushController.d.cts} +6 -6
  284. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -0
  285. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +112 -0
  286. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -0
  287. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +214 -37
  288. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
  289. package/dist/NotificationServicesPushController/__fixtures__/index.cjs +18 -0
  290. package/dist/NotificationServicesPushController/__fixtures__/index.cjs.map +1 -0
  291. package/dist/NotificationServicesPushController/__fixtures__/index.d.cts +2 -0
  292. package/dist/NotificationServicesPushController/__fixtures__/index.d.cts.map +1 -0
  293. package/dist/NotificationServicesPushController/__fixtures__/index.d.mts +2 -0
  294. package/dist/NotificationServicesPushController/__fixtures__/index.d.mts.map +1 -0
  295. package/dist/NotificationServicesPushController/__fixtures__/index.mjs +2 -0
  296. package/dist/NotificationServicesPushController/__fixtures__/index.mjs.map +1 -0
  297. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs +57 -0
  298. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs.map +1 -0
  299. package/dist/{types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts → NotificationServicesPushController/__fixtures__/mockResponse.d.cts} +2 -2
  300. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.cts.map +1 -0
  301. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts +43 -0
  302. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts.map +1 -0
  303. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs +50 -0
  304. package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs.map +1 -0
  305. package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs +31 -0
  306. package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs.map +1 -0
  307. package/dist/{types/NotificationServicesPushController/__fixtures__/mockServices.d.ts → NotificationServicesPushController/__fixtures__/mockServices.d.cts} +2 -2
  308. package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts.map +1 -0
  309. package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts +9 -0
  310. package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts.map +1 -0
  311. package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs +30 -0
  312. package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs.map +1 -0
  313. package/dist/NotificationServicesPushController/constants.cjs +14 -0
  314. package/dist/NotificationServicesPushController/constants.cjs.map +1 -0
  315. package/dist/{types/NotificationServicesPushController/constants.d.ts → NotificationServicesPushController/constants.d.cts} +1 -1
  316. package/dist/NotificationServicesPushController/constants.d.cts.map +1 -0
  317. package/dist/NotificationServicesPushController/constants.d.mts +11 -0
  318. package/dist/NotificationServicesPushController/constants.d.mts.map +1 -0
  319. package/dist/NotificationServicesPushController/constants.mjs +10 -25
  320. package/dist/NotificationServicesPushController/constants.mjs.map +1 -1
  321. package/dist/NotificationServicesPushController/index.cjs +43 -0
  322. package/dist/NotificationServicesPushController/index.cjs.map +1 -0
  323. package/dist/NotificationServicesPushController/index.d.cts +11 -0
  324. package/dist/NotificationServicesPushController/index.d.cts.map +1 -0
  325. package/dist/NotificationServicesPushController/index.d.mts +11 -0
  326. package/dist/NotificationServicesPushController/index.d.mts.map +1 -0
  327. package/dist/NotificationServicesPushController/index.mjs +10 -71
  328. package/dist/NotificationServicesPushController/index.mjs.map +1 -1
  329. package/dist/NotificationServicesPushController/services/endpoints.cjs +6 -0
  330. package/dist/NotificationServicesPushController/services/endpoints.cjs.map +1 -0
  331. package/dist/{types/NotificationServicesPushController/services/endpoints.d.ts → NotificationServicesPushController/services/endpoints.d.cts} +1 -1
  332. package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +1 -0
  333. package/dist/NotificationServicesPushController/services/endpoints.d.mts +2 -0
  334. package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +1 -0
  335. package/dist/NotificationServicesPushController/services/endpoints.mjs +2 -7
  336. package/dist/NotificationServicesPushController/services/endpoints.mjs.map +1 -1
  337. package/dist/NotificationServicesPushController/services/push/index.cjs +3 -0
  338. package/dist/NotificationServicesPushController/services/push/index.cjs.map +1 -0
  339. package/dist/{types/NotificationServicesPushController/services/push/index.d.ts → NotificationServicesPushController/services/push/index.d.cts} +2 -2
  340. package/dist/NotificationServicesPushController/services/push/index.d.cts.map +1 -0
  341. package/dist/NotificationServicesPushController/services/push/index.d.mts +6 -0
  342. package/dist/NotificationServicesPushController/services/push/index.d.mts.map +1 -0
  343. package/dist/NotificationServicesPushController/services/push/index.mjs +1 -0
  344. package/dist/NotificationServicesPushController/services/push/index.mjs.map +1 -1
  345. package/dist/NotificationServicesPushController/services/push/push-web.cjs +121 -0
  346. package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +1 -0
  347. package/dist/{types/NotificationServicesPushController/services/push/push-web.d.ts → NotificationServicesPushController/services/push/push-web.d.cts} +3 -3
  348. package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +1 -0
  349. package/dist/NotificationServicesPushController/services/push/push-web.d.mts +32 -0
  350. package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +1 -0
  351. package/dist/NotificationServicesPushController/services/push/push-web.mjs +116 -38
  352. package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -1
  353. package/dist/NotificationServicesPushController/services/services.cjs +197 -0
  354. package/dist/NotificationServicesPushController/services/services.cjs.map +1 -0
  355. package/dist/{types/NotificationServicesPushController/services/services.d.ts → NotificationServicesPushController/services/services.d.cts} +4 -4
  356. package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -0
  357. package/dist/NotificationServicesPushController/services/services.d.mts +95 -0
  358. package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -0
  359. package/dist/NotificationServicesPushController/services/services.mjs +168 -45
  360. package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
  361. package/dist/NotificationServicesPushController/types/firebase.cjs +3 -0
  362. package/dist/NotificationServicesPushController/types/firebase.cjs.map +1 -0
  363. package/dist/{types/NotificationServicesPushController/types/firebase.d.ts → NotificationServicesPushController/types/firebase.d.cts} +1 -1
  364. package/dist/NotificationServicesPushController/types/firebase.d.cts.map +1 -0
  365. package/dist/NotificationServicesPushController/types/firebase.d.mts +53 -0
  366. package/dist/NotificationServicesPushController/types/firebase.d.mts.map +1 -0
  367. package/dist/NotificationServicesPushController/types/firebase.mjs +1 -1
  368. package/dist/NotificationServicesPushController/types/firebase.mjs.map +1 -1
  369. package/dist/NotificationServicesPushController/types/index.cjs +18 -0
  370. package/dist/NotificationServicesPushController/types/index.cjs.map +1 -0
  371. package/dist/NotificationServicesPushController/types/index.d.cts +2 -0
  372. package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -0
  373. package/dist/NotificationServicesPushController/types/index.d.mts +2 -0
  374. package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -0
  375. package/dist/NotificationServicesPushController/types/index.mjs +1 -2
  376. package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
  377. package/dist/NotificationServicesPushController/utils/get-notification-data.cjs +84 -0
  378. package/dist/NotificationServicesPushController/utils/get-notification-data.cjs.map +1 -0
  379. package/dist/{types/NotificationServicesPushController/utils/get-notification-data.d.ts → NotificationServicesPushController/utils/get-notification-data.d.cts} +2 -2
  380. package/dist/NotificationServicesPushController/utils/get-notification-data.d.cts.map +1 -0
  381. package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts +42 -0
  382. package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts.map +1 -0
  383. package/dist/NotificationServicesPushController/utils/get-notification-data.mjs +76 -12
  384. package/dist/NotificationServicesPushController/utils/get-notification-data.mjs.map +1 -1
  385. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +190 -0
  386. package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +1 -0
  387. package/dist/{types/NotificationServicesPushController/utils/get-notification-message.d.ts → NotificationServicesPushController/utils/get-notification-message.d.cts} +3 -3
  388. package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +1 -0
  389. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts +67 -0
  390. package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +1 -0
  391. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +182 -37
  392. package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -1
  393. package/dist/NotificationServicesPushController/utils/index.cjs +19 -0
  394. package/dist/NotificationServicesPushController/utils/index.cjs.map +1 -0
  395. package/dist/NotificationServicesPushController/utils/index.d.cts +3 -0
  396. package/dist/NotificationServicesPushController/utils/index.d.cts.map +1 -0
  397. package/dist/NotificationServicesPushController/utils/index.d.mts +3 -0
  398. package/dist/NotificationServicesPushController/utils/index.d.mts.map +1 -0
  399. package/dist/NotificationServicesPushController/utils/index.mjs +2 -48
  400. package/dist/NotificationServicesPushController/utils/index.mjs.map +1 -1
  401. package/dist/index.cjs +29 -0
  402. package/dist/index.cjs.map +1 -0
  403. package/dist/index.d.cts +3 -0
  404. package/dist/index.d.cts.map +1 -0
  405. package/dist/index.d.mts +3 -0
  406. package/dist/index.d.mts.map +1 -0
  407. package/dist/index.mjs +2 -45
  408. package/dist/index.mjs.map +1 -1
  409. package/dist/shared/to-raw-notification.cjs +19 -0
  410. package/dist/shared/to-raw-notification.cjs.map +1 -0
  411. package/dist/{types/shared/to-raw-notification.d.ts → shared/to-raw-notification.d.cts} +2 -2
  412. package/dist/shared/to-raw-notification.d.cts.map +1 -0
  413. package/dist/shared/to-raw-notification.d.mts +11 -0
  414. package/dist/shared/to-raw-notification.d.mts.map +1 -0
  415. package/dist/shared/to-raw-notification.mjs +14 -7
  416. package/dist/shared/to-raw-notification.mjs.map +1 -1
  417. package/package.json +12 -7
  418. package/dist/NotificationServicesController/NotificationServicesController.js +0 -19
  419. package/dist/NotificationServicesController/NotificationServicesController.js.map +0 -1
  420. package/dist/NotificationServicesController/constants/constants.js +0 -10
  421. package/dist/NotificationServicesController/constants/constants.js.map +0 -1
  422. package/dist/NotificationServicesController/constants/index.js +0 -29
  423. package/dist/NotificationServicesController/constants/index.js.map +0 -1
  424. package/dist/NotificationServicesController/constants/notification-schema.js +0 -22
  425. package/dist/NotificationServicesController/constants/notification-schema.js.map +0 -1
  426. package/dist/NotificationServicesController/index.js +0 -87
  427. package/dist/NotificationServicesController/index.js.map +0 -1
  428. package/dist/NotificationServicesController/processors/index.js +0 -22
  429. package/dist/NotificationServicesController/processors/index.js.map +0 -1
  430. package/dist/NotificationServicesController/processors/process-feature-announcement.js +0 -10
  431. package/dist/NotificationServicesController/processors/process-feature-announcement.js.map +0 -1
  432. package/dist/NotificationServicesController/processors/process-notifications.js +0 -13
  433. package/dist/NotificationServicesController/processors/process-notifications.js.map +0 -1
  434. package/dist/NotificationServicesController/processors/process-onchain-notifications.js +0 -8
  435. package/dist/NotificationServicesController/processors/process-onchain-notifications.js.map +0 -1
  436. package/dist/NotificationServicesController/services/feature-announcements.js +0 -14
  437. package/dist/NotificationServicesController/services/feature-announcements.js.map +0 -1
  438. package/dist/NotificationServicesController/services/onchain-notifications.js +0 -30
  439. package/dist/NotificationServicesController/services/onchain-notifications.js.map +0 -1
  440. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js +0 -2
  441. package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js.map +0 -1
  442. package/dist/NotificationServicesController/types/feature-announcement/index.js +0 -5
  443. package/dist/NotificationServicesController/types/feature-announcement/index.js.map +0 -1
  444. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js +0 -2
  445. package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js.map +0 -1
  446. package/dist/NotificationServicesController/types/feature-announcement/type-links.js +0 -2
  447. package/dist/NotificationServicesController/types/feature-announcement/type-links.js.map +0 -1
  448. package/dist/NotificationServicesController/types/index.js +0 -12
  449. package/dist/NotificationServicesController/types/index.js.map +0 -1
  450. package/dist/NotificationServicesController/types/notification/index.js +0 -3
  451. package/dist/NotificationServicesController/types/notification/index.js.map +0 -1
  452. package/dist/NotificationServicesController/types/notification/notification.js +0 -2
  453. package/dist/NotificationServicesController/types/notification/notification.js.map +0 -1
  454. package/dist/NotificationServicesController/types/on-chain-notification/index.js +0 -3
  455. package/dist/NotificationServicesController/types/on-chain-notification/index.js.map +0 -1
  456. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js +0 -2
  457. package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js.map +0 -1
  458. package/dist/NotificationServicesController/types/on-chain-notification/schema.js +0 -1
  459. package/dist/NotificationServicesController/types/on-chain-notification/schema.js.map +0 -1
  460. package/dist/NotificationServicesController/types/type-utils.js +0 -1
  461. package/dist/NotificationServicesController/types/type-utils.js.map +0 -1
  462. package/dist/NotificationServicesController/types/user-storage/index.js +0 -3
  463. package/dist/NotificationServicesController/types/user-storage/index.js.map +0 -1
  464. package/dist/NotificationServicesController/types/user-storage/user-storage.js +0 -2
  465. package/dist/NotificationServicesController/types/user-storage/user-storage.js.map +0 -1
  466. package/dist/NotificationServicesController/ui/constants.js +0 -16
  467. package/dist/NotificationServicesController/ui/constants.js.map +0 -1
  468. package/dist/NotificationServicesController/ui/index.js +0 -17
  469. package/dist/NotificationServicesController/ui/index.js.map +0 -1
  470. package/dist/NotificationServicesController/utils/utils.js +0 -32
  471. package/dist/NotificationServicesController/utils/utils.js.map +0 -1
  472. package/dist/NotificationServicesPushController/NotificationServicesPushController.js +0 -39
  473. package/dist/NotificationServicesPushController/NotificationServicesPushController.js.map +0 -1
  474. package/dist/NotificationServicesPushController/constants.js +0 -26
  475. package/dist/NotificationServicesPushController/constants.js.map +0 -1
  476. package/dist/NotificationServicesPushController/index.js +0 -72
  477. package/dist/NotificationServicesPushController/index.js.map +0 -1
  478. package/dist/NotificationServicesPushController/services/endpoints.js +0 -8
  479. package/dist/NotificationServicesPushController/services/endpoints.js.map +0 -1
  480. package/dist/NotificationServicesPushController/services/push/index.js +0 -1
  481. package/dist/NotificationServicesPushController/services/push/index.js.map +0 -1
  482. package/dist/NotificationServicesPushController/services/push/push-web.js +0 -40
  483. package/dist/NotificationServicesPushController/services/push/push-web.js.map +0 -1
  484. package/dist/NotificationServicesPushController/services/services.js +0 -46
  485. package/dist/NotificationServicesPushController/services/services.js.map +0 -1
  486. package/dist/NotificationServicesPushController/types/firebase.js +0 -2
  487. package/dist/NotificationServicesPushController/types/firebase.js.map +0 -1
  488. package/dist/NotificationServicesPushController/types/index.js +0 -3
  489. package/dist/NotificationServicesPushController/types/index.js.map +0 -1
  490. package/dist/NotificationServicesPushController/utils/get-notification-data.js +0 -14
  491. package/dist/NotificationServicesPushController/utils/get-notification-data.js.map +0 -1
  492. package/dist/NotificationServicesPushController/utils/get-notification-message.js +0 -39
  493. package/dist/NotificationServicesPushController/utils/get-notification-message.js.map +0 -1
  494. package/dist/NotificationServicesPushController/utils/index.js +0 -49
  495. package/dist/NotificationServicesPushController/utils/index.js.map +0 -1
  496. package/dist/chunk-232HZSEV.js +0 -7
  497. package/dist/chunk-232HZSEV.js.map +0 -1
  498. package/dist/chunk-2P5WP5NT.mjs +0 -37
  499. package/dist/chunk-2P5WP5NT.mjs.map +0 -1
  500. package/dist/chunk-3ZS2HAEG.js +0 -1
  501. package/dist/chunk-3ZS2HAEG.js.map +0 -1
  502. package/dist/chunk-4BTNTREI.mjs +0 -1
  503. package/dist/chunk-4BTNTREI.mjs.map +0 -1
  504. package/dist/chunk-4QXAPVW3.mjs +0 -1
  505. package/dist/chunk-4QXAPVW3.mjs.map +0 -1
  506. package/dist/chunk-52CALMRA.js +0 -28
  507. package/dist/chunk-53F3SYYM.mjs +0 -178
  508. package/dist/chunk-53F3SYYM.mjs.map +0 -1
  509. package/dist/chunk-5FAAZCBK.mjs +0 -29
  510. package/dist/chunk-5FAAZCBK.mjs.map +0 -1
  511. package/dist/chunk-6FLC6CJD.js +0 -149
  512. package/dist/chunk-6FLC6CJD.js.map +0 -1
  513. package/dist/chunk-6ZDVTRRT.mjs +0 -9
  514. package/dist/chunk-6ZDVTRRT.mjs.map +0 -1
  515. package/dist/chunk-77QIITUL.mjs +0 -67
  516. package/dist/chunk-77QIITUL.mjs.map +0 -1
  517. package/dist/chunk-7LWR54U7.js +0 -7
  518. package/dist/chunk-7LWR54U7.js.map +0 -1
  519. package/dist/chunk-7PWKQSM2.mjs +0 -972
  520. package/dist/chunk-7PWKQSM2.mjs.map +0 -1
  521. package/dist/chunk-7RM3YNTD.mjs +0 -1
  522. package/dist/chunk-7RM3YNTD.mjs.map +0 -1
  523. package/dist/chunk-A2RPVX47.mjs +0 -1
  524. package/dist/chunk-A2RPVX47.mjs.map +0 -1
  525. package/dist/chunk-B25TJ7KS.js +0 -8
  526. package/dist/chunk-B25TJ7KS.js.map +0 -1
  527. package/dist/chunk-B4ECJJ5C.mjs +0 -7
  528. package/dist/chunk-B4ECJJ5C.mjs.map +0 -1
  529. package/dist/chunk-BONB66A2.mjs +0 -14
  530. package/dist/chunk-BONB66A2.mjs.map +0 -1
  531. package/dist/chunk-C62SK2KY.mjs +0 -92
  532. package/dist/chunk-C62SK2KY.mjs.map +0 -1
  533. package/dist/chunk-CGPMMFUQ.mjs +0 -96
  534. package/dist/chunk-CGPMMFUQ.mjs.map +0 -1
  535. package/dist/chunk-CWZQMK63.mjs +0 -118
  536. package/dist/chunk-CWZQMK63.mjs.map +0 -1
  537. package/dist/chunk-D42BBXBM.mjs +0 -28
  538. package/dist/chunk-D42BBXBM.mjs.map +0 -1
  539. package/dist/chunk-DINCLRZT.mjs +0 -12
  540. package/dist/chunk-DINCLRZT.mjs.map +0 -1
  541. package/dist/chunk-DMH4NSLF.js +0 -1
  542. package/dist/chunk-DMH4NSLF.js.map +0 -1
  543. package/dist/chunk-DT6SLUWJ.js +0 -12
  544. package/dist/chunk-DT6SLUWJ.js.map +0 -1
  545. package/dist/chunk-EJ52BDLB.js +0 -55
  546. package/dist/chunk-EJ52BDLB.js.map +0 -1
  547. package/dist/chunk-ER475D6V.mjs +0 -231
  548. package/dist/chunk-ER475D6V.mjs.map +0 -1
  549. package/dist/chunk-G52DNXFH.mjs +0 -1
  550. package/dist/chunk-G52DNXFH.mjs.map +0 -1
  551. package/dist/chunk-GETQWOTI.js +0 -1
  552. package/dist/chunk-GETQWOTI.js.map +0 -1
  553. package/dist/chunk-HCDICNYK.js +0 -207
  554. package/dist/chunk-HCDICNYK.js.map +0 -1
  555. package/dist/chunk-HE3P5RM7.js +0 -178
  556. package/dist/chunk-HE3P5RM7.js.map +0 -1
  557. package/dist/chunk-HPUQYDVC.js +0 -1
  558. package/dist/chunk-HPUQYDVC.js.map +0 -1
  559. package/dist/chunk-HT6T5R4U.js +0 -96
  560. package/dist/chunk-HT6T5R4U.js.map +0 -1
  561. package/dist/chunk-IDO4JFV5.mjs +0 -1
  562. package/dist/chunk-IDO4JFV5.mjs.map +0 -1
  563. package/dist/chunk-IGY2S5BC.js +0 -36
  564. package/dist/chunk-IGY2S5BC.js.map +0 -1
  565. package/dist/chunk-IKWNHNJQ.mjs +0 -8
  566. package/dist/chunk-IKWNHNJQ.mjs.map +0 -1
  567. package/dist/chunk-IOMDG67D.mjs +0 -7
  568. package/dist/chunk-IOMDG67D.mjs.map +0 -1
  569. package/dist/chunk-IPI7BAW3.js +0 -1
  570. package/dist/chunk-IPI7BAW3.js.map +0 -1
  571. package/dist/chunk-JIJXHO5V.js +0 -885
  572. package/dist/chunk-JIJXHO5V.js.map +0 -1
  573. package/dist/chunk-JQ7WKFCI.mjs +0 -1
  574. package/dist/chunk-JQ7WKFCI.mjs.map +0 -1
  575. package/dist/chunk-JW3TK3NU.js +0 -221
  576. package/dist/chunk-JW3TK3NU.js.map +0 -1
  577. package/dist/chunk-KGLHGLER.js +0 -231
  578. package/dist/chunk-KGLHGLER.js.map +0 -1
  579. package/dist/chunk-LGXHJ24K.js +0 -92
  580. package/dist/chunk-LGXHJ24K.js.map +0 -1
  581. package/dist/chunk-LYEXYTOI.js +0 -14
  582. package/dist/chunk-LYEXYTOI.js.map +0 -1
  583. package/dist/chunk-LZMC2QML.mjs +0 -25
  584. package/dist/chunk-LZMC2QML.mjs.map +0 -1
  585. package/dist/chunk-MG5QDUDI.mjs +0 -48
  586. package/dist/chunk-MG5QDUDI.mjs.map +0 -1
  587. package/dist/chunk-MNBV5FJI.mjs +0 -31
  588. package/dist/chunk-MNBV5FJI.mjs.map +0 -1
  589. package/dist/chunk-NIPCK74T.js +0 -185
  590. package/dist/chunk-NIPCK74T.js.map +0 -1
  591. package/dist/chunk-O45HYLIV.js +0 -67
  592. package/dist/chunk-O45HYLIV.js.map +0 -1
  593. package/dist/chunk-ODI2BTKS.mjs +0 -55
  594. package/dist/chunk-ODI2BTKS.mjs.map +0 -1
  595. package/dist/chunk-OHFX4S6R.mjs +0 -185
  596. package/dist/chunk-OHFX4S6R.mjs.map +0 -1
  597. package/dist/chunk-OMBFVTP2.js +0 -37
  598. package/dist/chunk-OMBFVTP2.js.map +0 -1
  599. package/dist/chunk-PJMQ2XEG.js +0 -29
  600. package/dist/chunk-PJMQ2XEG.js.map +0 -1
  601. package/dist/chunk-PNCS6GEX.mjs +0 -1
  602. package/dist/chunk-PNCS6GEX.mjs.map +0 -1
  603. package/dist/chunk-PROWNV4M.js +0 -1
  604. package/dist/chunk-PROWNV4M.js.map +0 -1
  605. package/dist/chunk-QAOZN4AX.js +0 -25
  606. package/dist/chunk-QAOZN4AX.js.map +0 -1
  607. package/dist/chunk-QB5IFRLA.mjs +0 -1
  608. package/dist/chunk-QB5IFRLA.mjs.map +0 -1
  609. package/dist/chunk-RAUV5UV4.mjs +0 -1
  610. package/dist/chunk-RAUV5UV4.mjs.map +0 -1
  611. package/dist/chunk-SGLVWM4N.js +0 -48
  612. package/dist/chunk-SGLVWM4N.js.map +0 -1
  613. package/dist/chunk-TLX5QQK5.js +0 -9
  614. package/dist/chunk-TLX5QQK5.js.map +0 -1
  615. package/dist/chunk-U5UIDVOO.mjs +0 -36
  616. package/dist/chunk-U5UIDVOO.mjs.map +0 -1
  617. package/dist/chunk-U74Q3BRP.mjs +0 -1
  618. package/dist/chunk-U74Q3BRP.mjs.map +0 -1
  619. package/dist/chunk-UQ6MTYIR.js +0 -972
  620. package/dist/chunk-UQ6MTYIR.js.map +0 -1
  621. package/dist/chunk-UZHUVXRM.js +0 -31
  622. package/dist/chunk-UZHUVXRM.js.map +0 -1
  623. package/dist/chunk-V5HMYDWE.js +0 -1
  624. package/dist/chunk-V5HMYDWE.js.map +0 -1
  625. package/dist/chunk-VZMQIJMK.mjs +0 -149
  626. package/dist/chunk-VZMQIJMK.mjs.map +0 -1
  627. package/dist/chunk-W7IP4LDB.js +0 -118
  628. package/dist/chunk-W7IP4LDB.js.map +0 -1
  629. package/dist/chunk-WE4RFGT7.mjs +0 -885
  630. package/dist/chunk-WE4RFGT7.mjs.map +0 -1
  631. package/dist/chunk-WGBEAP2F.mjs +0 -207
  632. package/dist/chunk-WGBEAP2F.mjs.map +0 -1
  633. package/dist/chunk-WRYFIWNK.js +0 -1
  634. package/dist/chunk-WRYFIWNK.js.map +0 -1
  635. package/dist/chunk-XZEVRYUE.js +0 -1
  636. package/dist/chunk-XZEVRYUE.js.map +0 -1
  637. package/dist/chunk-YUMIJSUD.mjs +0 -221
  638. package/dist/chunk-YUMIJSUD.mjs.map +0 -1
  639. package/dist/chunk-ZBNBZN5H.js +0 -1
  640. package/dist/chunk-ZBNBZN5H.js.map +0 -1
  641. package/dist/chunk-ZV3DFBO4.js +0 -1
  642. package/dist/chunk-ZV3DFBO4.js.map +0 -1
  643. package/dist/index.js +0 -46
  644. package/dist/index.js.map +0 -1
  645. package/dist/shared/to-raw-notification.js +0 -8
  646. package/dist/shared/to-raw-notification.js.map +0 -1
  647. package/dist/tsconfig.build.tsbuildinfo +0 -1
  648. package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +0 -1
  649. package/dist/types/NotificationServicesController/__fixtures__/index.d.ts +0 -6
  650. package/dist/types/NotificationServicesController/__fixtures__/index.d.ts.map +0 -1
  651. package/dist/types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts.map +0 -1
  652. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts.map +0 -1
  653. package/dist/types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts.map +0 -1
  654. package/dist/types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts.map +0 -1
  655. package/dist/types/NotificationServicesController/__fixtures__/mockResponses.d.ts.map +0 -1
  656. package/dist/types/NotificationServicesController/__fixtures__/mockServices.d.ts.map +0 -1
  657. package/dist/types/NotificationServicesController/__fixtures__/test-utils.d.ts.map +0 -1
  658. package/dist/types/NotificationServicesController/constants/constants.d.ts.map +0 -1
  659. package/dist/types/NotificationServicesController/constants/index.d.ts +0 -3
  660. package/dist/types/NotificationServicesController/constants/index.d.ts.map +0 -1
  661. package/dist/types/NotificationServicesController/constants/notification-schema.d.ts.map +0 -1
  662. package/dist/types/NotificationServicesController/index.d.ts +0 -14
  663. package/dist/types/NotificationServicesController/index.d.ts.map +0 -1
  664. package/dist/types/NotificationServicesController/processors/index.d.ts +0 -4
  665. package/dist/types/NotificationServicesController/processors/index.d.ts.map +0 -1
  666. package/dist/types/NotificationServicesController/processors/process-feature-announcement.d.ts.map +0 -1
  667. package/dist/types/NotificationServicesController/processors/process-notifications.d.ts.map +0 -1
  668. package/dist/types/NotificationServicesController/processors/process-onchain-notifications.d.ts.map +0 -1
  669. package/dist/types/NotificationServicesController/services/feature-announcements.d.ts.map +0 -1
  670. package/dist/types/NotificationServicesController/services/onchain-notifications.d.ts.map +0 -1
  671. package/dist/types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts.map +0 -1
  672. package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts +0 -4
  673. package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts.map +0 -1
  674. package/dist/types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts.map +0 -1
  675. package/dist/types/NotificationServicesController/types/feature-announcement/type-links.d.ts.map +0 -1
  676. package/dist/types/NotificationServicesController/types/index.d.ts +0 -5
  677. package/dist/types/NotificationServicesController/types/index.d.ts.map +0 -1
  678. package/dist/types/NotificationServicesController/types/notification/index.d.ts +0 -2
  679. package/dist/types/NotificationServicesController/types/notification/index.d.ts.map +0 -1
  680. package/dist/types/NotificationServicesController/types/notification/notification.d.ts.map +0 -1
  681. package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts +0 -2
  682. package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts.map +0 -1
  683. package/dist/types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts.map +0 -1
  684. package/dist/types/NotificationServicesController/types/on-chain-notification/schema.d.ts.map +0 -1
  685. package/dist/types/NotificationServicesController/types/type-utils.d.ts.map +0 -1
  686. package/dist/types/NotificationServicesController/types/user-storage/index.d.ts +0 -2
  687. package/dist/types/NotificationServicesController/types/user-storage/index.d.ts.map +0 -1
  688. package/dist/types/NotificationServicesController/types/user-storage/user-storage.d.ts.map +0 -1
  689. package/dist/types/NotificationServicesController/ui/constants.d.ts.map +0 -1
  690. package/dist/types/NotificationServicesController/ui/index.d.ts +0 -2
  691. package/dist/types/NotificationServicesController/ui/index.d.ts.map +0 -1
  692. package/dist/types/NotificationServicesController/utils/utils.d.ts.map +0 -1
  693. package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +0 -1
  694. package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts +0 -2
  695. package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts.map +0 -1
  696. package/dist/types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts.map +0 -1
  697. package/dist/types/NotificationServicesPushController/__fixtures__/mockServices.d.ts.map +0 -1
  698. package/dist/types/NotificationServicesPushController/constants.d.ts.map +0 -1
  699. package/dist/types/NotificationServicesPushController/index.d.ts +0 -11
  700. package/dist/types/NotificationServicesPushController/index.d.ts.map +0 -1
  701. package/dist/types/NotificationServicesPushController/services/endpoints.d.ts.map +0 -1
  702. package/dist/types/NotificationServicesPushController/services/push/index.d.ts.map +0 -1
  703. package/dist/types/NotificationServicesPushController/services/push/push-web.d.ts.map +0 -1
  704. package/dist/types/NotificationServicesPushController/services/services.d.ts.map +0 -1
  705. package/dist/types/NotificationServicesPushController/types/firebase.d.ts.map +0 -1
  706. package/dist/types/NotificationServicesPushController/types/index.d.ts +0 -2
  707. package/dist/types/NotificationServicesPushController/types/index.d.ts.map +0 -1
  708. package/dist/types/NotificationServicesPushController/utils/get-notification-data.d.ts.map +0 -1
  709. package/dist/types/NotificationServicesPushController/utils/get-notification-message.d.ts.map +0 -1
  710. package/dist/types/NotificationServicesPushController/utils/index.d.ts +0 -3
  711. package/dist/types/NotificationServicesPushController/utils/index.d.ts.map +0 -1
  712. package/dist/types/index.d.ts +0 -3
  713. package/dist/types/index.d.ts.map +0 -1
  714. package/dist/types/shared/to-raw-notification.d.ts.map +0 -1
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFeatureAnnouncementNotifications = exports.FEATURE_ANNOUNCEMENT_URL = exports.FEATURE_ANNOUNCEMENT_API = void 0;
4
+ const rich_text_html_renderer_1 = require("@contentful/rich-text-html-renderer");
5
+ const notification_schema_1 = require("../constants/notification-schema.cjs");
6
+ const process_feature_announcement_1 = require("../processors/process-feature-announcement.cjs");
7
+ const DEFAULT_SPACE_ID = ':space_id';
8
+ const DEFAULT_ACCESS_TOKEN = ':access_token';
9
+ const DEFAULT_CLIENT_ID = ':client_id';
10
+ exports.FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;
11
+ exports.FEATURE_ANNOUNCEMENT_URL = `${exports.FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;
12
+ const getFeatureAnnouncementUrl = (env) => exports.FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)
13
+ .replace(DEFAULT_ACCESS_TOKEN, env.accessToken)
14
+ .replace(DEFAULT_CLIENT_ID, env.platform);
15
+ const fetchFeatureAnnouncementNotifications = async (env) => {
16
+ const url = getFeatureAnnouncementUrl(env);
17
+ const data = await fetch(url)
18
+ .then((r) => r.json())
19
+ .catch(() => null);
20
+ if (!data) {
21
+ return [];
22
+ }
23
+ const findIncludedItem = (sysId) => {
24
+ const typedData = data;
25
+ const item = typedData?.includes?.Entry?.find((i) => i?.sys?.id === sysId) ||
26
+ typedData?.includes?.Asset?.find((i) => i?.sys?.id === sysId);
27
+ return item ? item?.fields : null;
28
+ };
29
+ const contentfulNotifications = data?.items ?? [];
30
+ const rawNotifications = contentfulNotifications.map((n) => {
31
+ const { fields } = n;
32
+ const imageFields = fields.image
33
+ ? findIncludedItem(fields.image.sys.id)
34
+ : undefined;
35
+ const externalLinkFields = fields.externalLink
36
+ ? findIncludedItem(fields.externalLink.sys.id)
37
+ : undefined;
38
+ const portfolioLinkFields = fields.portfolioLink
39
+ ? findIncludedItem(fields.portfolioLink.sys.id)
40
+ : undefined;
41
+ const extensionLinkFields = fields.extensionLink
42
+ ? findIncludedItem(fields.extensionLink.sys.id)
43
+ : undefined;
44
+ const mobileLinkFields = fields.mobileLink
45
+ ? findIncludedItem(fields.mobileLink.sys.id)
46
+ : undefined;
47
+ const notification = {
48
+ type: notification_schema_1.TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,
49
+ createdAt: new Date(n.sys.createdAt).toString(),
50
+ data: {
51
+ id: fields.id,
52
+ category: fields.category,
53
+ title: fields.title,
54
+ longDescription: (0, rich_text_html_renderer_1.documentToHtmlString)(fields.longDescription),
55
+ shortDescription: fields.shortDescription,
56
+ image: {
57
+ title: imageFields?.title,
58
+ description: imageFields?.description,
59
+ url: imageFields?.file?.url ?? '',
60
+ },
61
+ externalLink: externalLinkFields && {
62
+ externalLinkText: externalLinkFields?.externalLinkText,
63
+ externalLinkUrl: externalLinkFields?.externalLinkUrl,
64
+ },
65
+ portfolioLink: portfolioLinkFields && {
66
+ portfolioLinkText: portfolioLinkFields?.portfolioLinkText,
67
+ portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl,
68
+ },
69
+ extensionLink: extensionLinkFields && {
70
+ extensionLinkText: extensionLinkFields?.extensionLinkText,
71
+ extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,
72
+ },
73
+ mobileLink: mobileLinkFields && {
74
+ mobileLinkText: mobileLinkFields?.mobileLinkText,
75
+ mobileLinkUrl: mobileLinkFields?.mobileLinkUrl,
76
+ },
77
+ },
78
+ };
79
+ return notification;
80
+ });
81
+ return rawNotifications;
82
+ };
83
+ /**
84
+ * Gets Feature Announcement from our services
85
+ * @param env - environment for feature announcements
86
+ * @returns Raw Feature Announcements
87
+ */
88
+ async function getFeatureAnnouncementNotifications(env) {
89
+ if (env?.accessToken && env?.spaceId && env?.platform) {
90
+ const rawNotifications = await fetchFeatureAnnouncementNotifications(env);
91
+ const notifications = rawNotifications.map((notification) => (0, process_feature_announcement_1.processFeatureAnnouncement)(notification));
92
+ return notifications;
93
+ }
94
+ return [];
95
+ }
96
+ exports.getFeatureAnnouncementNotifications = getFeatureAnnouncementNotifications;
97
+ //# sourceMappingURL=feature-announcements.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-announcements.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":";;;AAAA,iFAA2E;AAG3E,8EAAiE;AACjE,iGAAwF;AAcxF,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAC1B,QAAA,wBAAwB,GAAG,qCAAqC,gBAAgB,8BAA8B,CAAC;AAC/G,QAAA,wBAAwB,GAAG,GAAG,gCAAwB,iBAAiB,oBAAoB,+DAA+D,iBAAiB,EAAE,CAAC;AAqB3L,MAAM,yBAAyB,GAAG,CAAC,GAAQ,EAAE,EAAE,CAC7C,gCAAwB,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC;KAC5D,OAAO,CAAC,oBAAoB,EAAE,GAAG,CAAC,WAAW,CAAC;KAC9C,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;AAE9C,MAAM,qCAAqC,GAAG,KAAK,EACjD,GAAQ,EACuC,EAAE;IACjD,MAAM,GAAG,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAE3C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC;SAC1B,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACrB,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAErB,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,CAAC;KACX;IAED,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE;QACzC,MAAM,SAAS,GAMX,IAAI,CAAC;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AC,CAAC;IAEL,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;;;GAIG;AACI,KAAK,UAAU,mCAAmC,CACvD,GAAQ;IAER,IAAI,GAAG,EAAE,WAAW,IAAI,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,QAAQ,EAAE;QACrD,MAAM,gBAAgB,GAAG,MAAM,qCAAqC,CAAC,GAAG,CAAC,CAAC;QAC1E,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAC1D,IAAA,yDAA0B,EAAC,YAAY,CAAC,CACzC,CAAC;QAEF,OAAO,aAAa,CAAC;KACtB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAbD,kFAaC","sourcesContent":["import { documentToHtmlString } from '@contentful/rich-text-html-renderer';\nimport type { Entry, Asset, EntryCollection } from 'contentful';\n\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport { processFeatureAnnouncement } from '../processors/process-feature-announcement';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n ImageFields,\n TypeFeatureAnnouncement,\n} from '../types/feature-announcement/type-feature-announcement';\nimport type {\n TypeExternalLinkFields,\n TypePortfolioLinkFields,\n TypeExtensionLinkFields,\n TypeMobileLinkFields,\n} from '../types/feature-announcement/type-links';\nimport type { INotification } from '../types/notification/notification';\n\nconst DEFAULT_SPACE_ID = ':space_id';\nconst DEFAULT_ACCESS_TOKEN = ':access_token';\nconst DEFAULT_CLIENT_ID = ':client_id';\nexport const FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;\nexport const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;\n\ntype Env = {\n spaceId: string;\n accessToken: string;\n platform: string;\n};\n\n/**\n * Contentful API Response Shape\n */\nexport type ContentfulResult = {\n includes?: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Entry?: Entry[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Asset?: Asset[];\n };\n items?: TypeFeatureAnnouncement[];\n};\n\nconst getFeatureAnnouncementUrl = (env: Env) =>\n FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)\n .replace(DEFAULT_ACCESS_TOKEN, env.accessToken)\n .replace(DEFAULT_CLIENT_ID, env.platform);\n\nconst fetchFeatureAnnouncementNotifications = async (\n env: Env,\n): Promise<FeatureAnnouncementRawNotification[]> => {\n const url = getFeatureAnnouncementUrl(env);\n\n const data = await fetch(url)\n .then((r) => r.json())\n .catch(() => null);\n\n if (!data) {\n return [];\n }\n\n const findIncludedItem = (sysId: string) => {\n const typedData: EntryCollection<\n | ImageFields\n | TypeExtensionLinkFields\n | TypePortfolioLinkFields\n | TypeMobileLinkFields\n | TypeExternalLinkFields\n > = data;\n const item =\n typedData?.includes?.Entry?.find((i: Entry) => i?.sys?.id === sysId) ||\n typedData?.includes?.Asset?.find((i: Asset) => i?.sys?.id === sysId);\n return item ? item?.fields : null;\n };\n\n const contentfulNotifications = data?.items ?? [];\n const rawNotifications: FeatureAnnouncementRawNotification[] =\n contentfulNotifications.map((n: TypeFeatureAnnouncement) => {\n const { fields } = n;\n const imageFields = fields.image\n ? (findIncludedItem(fields.image.sys.id) as ImageFields['fields'])\n : undefined;\n\n const externalLinkFields = fields.externalLink\n ? (findIncludedItem(\n fields.externalLink.sys.id,\n ) as TypeExternalLinkFields['fields'])\n : undefined;\n const portfolioLinkFields = fields.portfolioLink\n ? (findIncludedItem(\n fields.portfolioLink.sys.id,\n ) as TypePortfolioLinkFields['fields'])\n : undefined;\n const extensionLinkFields = fields.extensionLink\n ? (findIncludedItem(\n fields.extensionLink.sys.id,\n ) as TypeExtensionLinkFields['fields'])\n : undefined;\n const mobileLinkFields = fields.mobileLink\n ? (findIncludedItem(\n fields.mobileLink.sys.id,\n ) as TypeMobileLinkFields['fields'])\n : undefined;\n\n const notification: FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: new Date(n.sys.createdAt).toString(),\n data: {\n id: fields.id,\n category: fields.category,\n title: fields.title,\n longDescription: documentToHtmlString(fields.longDescription),\n shortDescription: fields.shortDescription,\n image: {\n title: imageFields?.title,\n description: imageFields?.description,\n url: imageFields?.file?.url ?? '',\n },\n externalLink: externalLinkFields && {\n externalLinkText: externalLinkFields?.externalLinkText,\n externalLinkUrl: externalLinkFields?.externalLinkUrl,\n },\n portfolioLink: portfolioLinkFields && {\n portfolioLinkText: portfolioLinkFields?.portfolioLinkText,\n portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl,\n },\n extensionLink: extensionLinkFields && {\n extensionLinkText: extensionLinkFields?.extensionLinkText,\n extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,\n },\n mobileLink: mobileLinkFields && {\n mobileLinkText: mobileLinkFields?.mobileLinkText,\n mobileLinkUrl: mobileLinkFields?.mobileLinkUrl,\n },\n },\n };\n\n return notification;\n });\n\n return rawNotifications;\n};\n\n/**\n * Gets Feature Announcement from our services\n * @param env - environment for feature announcements\n * @returns Raw Feature Announcements\n */\nexport async function getFeatureAnnouncementNotifications(\n env: Env,\n): Promise<INotification[]> {\n if (env?.accessToken && env?.spaceId && env?.platform) {\n const rawNotifications = await fetchFeatureAnnouncementNotifications(env);\n const notifications = rawNotifications.map((notification) =>\n processFeatureAnnouncement(notification),\n );\n\n return notifications;\n }\n\n return [];\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { Entry, Asset } from 'contentful';
2
- import type { TypeFeatureAnnouncement } from '../types/feature-announcement/type-feature-announcement';
3
- import type { INotification } from '../types/notification/notification';
1
+ import type { Entry, Asset } from "contentful";
2
+ import type { TypeFeatureAnnouncement } from "../types/feature-announcement/type-feature-announcement.cjs";
3
+ import type { INotification } from "../types/notification/notification.cjs";
4
4
  export declare const FEATURE_ANNOUNCEMENT_API = "https://cdn.contentful.com/spaces/:space_id/environments/master/entries";
5
5
  export declare const FEATURE_ANNOUNCEMENT_URL = "https://cdn.contentful.com/spaces/:space_id/environments/master/entries?access_token=:access_token&content_type=productAnnouncement&include=10&fields.clients=:client_id";
6
6
  type Env = {
@@ -25,4 +25,4 @@ export type ContentfulResult = {
25
25
  */
26
26
  export declare function getFeatureAnnouncementNotifications(env: Env): Promise<INotification[]>;
27
27
  export {};
28
- //# sourceMappingURL=feature-announcements.d.ts.map
28
+ //# sourceMappingURL=feature-announcements.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-announcements.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAmB,mBAAmB;AAKhE,OAAO,KAAK,EAEV,uBAAuB,EACxB,oEAAgE;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,+CAA2C;AAKxE,eAAO,MAAM,wBAAwB,4EAAsF,CAAC;AAC5H,eAAO,MAAM,wBAAwB,6KAAqJ,CAAC;AAE3L,KAAK,GAAG,GAAG;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE;QAET,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;QAEhB,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;KACjB,CAAC;IACF,KAAK,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACnC,CAAC;AAsGF;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,aAAa,EAAE,CAAC,CAW1B"}
@@ -0,0 +1,28 @@
1
+ import type { Entry, Asset } from "contentful";
2
+ import type { TypeFeatureAnnouncement } from "../types/feature-announcement/type-feature-announcement.mjs";
3
+ import type { INotification } from "../types/notification/notification.mjs";
4
+ export declare const FEATURE_ANNOUNCEMENT_API = "https://cdn.contentful.com/spaces/:space_id/environments/master/entries";
5
+ export declare const FEATURE_ANNOUNCEMENT_URL = "https://cdn.contentful.com/spaces/:space_id/environments/master/entries?access_token=:access_token&content_type=productAnnouncement&include=10&fields.clients=:client_id";
6
+ type Env = {
7
+ spaceId: string;
8
+ accessToken: string;
9
+ platform: string;
10
+ };
11
+ /**
12
+ * Contentful API Response Shape
13
+ */
14
+ export type ContentfulResult = {
15
+ includes?: {
16
+ Entry?: Entry[];
17
+ Asset?: Asset[];
18
+ };
19
+ items?: TypeFeatureAnnouncement[];
20
+ };
21
+ /**
22
+ * Gets Feature Announcement from our services
23
+ * @param env - environment for feature announcements
24
+ * @returns Raw Feature Announcements
25
+ */
26
+ export declare function getFeatureAnnouncementNotifications(env: Env): Promise<INotification[]>;
27
+ export {};
28
+ //# sourceMappingURL=feature-announcements.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-announcements.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAmB,mBAAmB;AAKhE,OAAO,KAAK,EAEV,uBAAuB,EACxB,oEAAgE;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,+CAA2C;AAKxE,eAAO,MAAM,wBAAwB,4EAAsF,CAAC;AAC5H,eAAO,MAAM,wBAAwB,6KAAqJ,CAAC;AAE3L,KAAK,GAAG,GAAG;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE;QAET,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;QAEhB,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;KACjB,CAAC;IACF,KAAK,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACnC,CAAC;AAsGF;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,aAAa,EAAE,CAAC,CAW1B"}
@@ -1,14 +1,93 @@
1
- import {
2
- FEATURE_ANNOUNCEMENT_API,
3
- FEATURE_ANNOUNCEMENT_URL,
4
- getFeatureAnnouncementNotifications
5
- } from "../../chunk-C62SK2KY.mjs";
6
- import "../../chunk-D42BBXBM.mjs";
7
- import "../../chunk-53F3SYYM.mjs";
8
- import "../../chunk-U5UIDVOO.mjs";
9
- export {
10
- FEATURE_ANNOUNCEMENT_API,
11
- FEATURE_ANNOUNCEMENT_URL,
12
- getFeatureAnnouncementNotifications
1
+ import { documentToHtmlString } from "@contentful/rich-text-html-renderer";
2
+ import { TRIGGER_TYPES } from "../constants/notification-schema.mjs";
3
+ import { processFeatureAnnouncement } from "../processors/process-feature-announcement.mjs";
4
+ const DEFAULT_SPACE_ID = ':space_id';
5
+ const DEFAULT_ACCESS_TOKEN = ':access_token';
6
+ const DEFAULT_CLIENT_ID = ':client_id';
7
+ export const FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;
8
+ export const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;
9
+ const getFeatureAnnouncementUrl = (env) => FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)
10
+ .replace(DEFAULT_ACCESS_TOKEN, env.accessToken)
11
+ .replace(DEFAULT_CLIENT_ID, env.platform);
12
+ const fetchFeatureAnnouncementNotifications = async (env) => {
13
+ const url = getFeatureAnnouncementUrl(env);
14
+ const data = await fetch(url)
15
+ .then((r) => r.json())
16
+ .catch(() => null);
17
+ if (!data) {
18
+ return [];
19
+ }
20
+ const findIncludedItem = (sysId) => {
21
+ const typedData = data;
22
+ const item = typedData?.includes?.Entry?.find((i) => i?.sys?.id === sysId) ||
23
+ typedData?.includes?.Asset?.find((i) => i?.sys?.id === sysId);
24
+ return item ? item?.fields : null;
25
+ };
26
+ const contentfulNotifications = data?.items ?? [];
27
+ const rawNotifications = contentfulNotifications.map((n) => {
28
+ const { fields } = n;
29
+ const imageFields = fields.image
30
+ ? findIncludedItem(fields.image.sys.id)
31
+ : undefined;
32
+ const externalLinkFields = fields.externalLink
33
+ ? findIncludedItem(fields.externalLink.sys.id)
34
+ : undefined;
35
+ const portfolioLinkFields = fields.portfolioLink
36
+ ? findIncludedItem(fields.portfolioLink.sys.id)
37
+ : undefined;
38
+ const extensionLinkFields = fields.extensionLink
39
+ ? findIncludedItem(fields.extensionLink.sys.id)
40
+ : undefined;
41
+ const mobileLinkFields = fields.mobileLink
42
+ ? findIncludedItem(fields.mobileLink.sys.id)
43
+ : undefined;
44
+ const notification = {
45
+ type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,
46
+ createdAt: new Date(n.sys.createdAt).toString(),
47
+ data: {
48
+ id: fields.id,
49
+ category: fields.category,
50
+ title: fields.title,
51
+ longDescription: documentToHtmlString(fields.longDescription),
52
+ shortDescription: fields.shortDescription,
53
+ image: {
54
+ title: imageFields?.title,
55
+ description: imageFields?.description,
56
+ url: imageFields?.file?.url ?? '',
57
+ },
58
+ externalLink: externalLinkFields && {
59
+ externalLinkText: externalLinkFields?.externalLinkText,
60
+ externalLinkUrl: externalLinkFields?.externalLinkUrl,
61
+ },
62
+ portfolioLink: portfolioLinkFields && {
63
+ portfolioLinkText: portfolioLinkFields?.portfolioLinkText,
64
+ portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl,
65
+ },
66
+ extensionLink: extensionLinkFields && {
67
+ extensionLinkText: extensionLinkFields?.extensionLinkText,
68
+ extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,
69
+ },
70
+ mobileLink: mobileLinkFields && {
71
+ mobileLinkText: mobileLinkFields?.mobileLinkText,
72
+ mobileLinkUrl: mobileLinkFields?.mobileLinkUrl,
73
+ },
74
+ },
75
+ };
76
+ return notification;
77
+ });
78
+ return rawNotifications;
13
79
  };
80
+ /**
81
+ * Gets Feature Announcement from our services
82
+ * @param env - environment for feature announcements
83
+ * @returns Raw Feature Announcements
84
+ */
85
+ export async function getFeatureAnnouncementNotifications(env) {
86
+ if (env?.accessToken && env?.spaceId && env?.platform) {
87
+ const rawNotifications = await fetchFeatureAnnouncementNotifications(env);
88
+ const notifications = rawNotifications.map((notification) => processFeatureAnnouncement(notification));
89
+ return notifications;
90
+ }
91
+ return [];
92
+ }
14
93
  //# sourceMappingURL=feature-announcements.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"feature-announcements.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,4CAA4C;AAG3E,OAAO,EAAE,aAAa,EAAE,6CAAyC;AACjE,OAAO,EAAE,0BAA0B,EAAE,uDAAmD;AAcxF,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,qCAAqC,gBAAgB,8BAA8B,CAAC;AAC5H,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,wBAAwB,iBAAiB,oBAAoB,+DAA+D,iBAAiB,EAAE,CAAC;AAqB3L,MAAM,yBAAyB,GAAG,CAAC,GAAQ,EAAE,EAAE,CAC7C,wBAAwB,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,OAAO,CA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;iBAClC;gBACD,YAAY,EAAE,kBAAkB,IAAI;oBAClC,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB;oBACtD,eAAe,EAAE,kBAAkB,EAAE,eAAe;iBACrD;gBACD,aAAa,EAAE,mBAAmB,IAAI;oBACpC,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB;oBACzD,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB;iBACxD;gBACD,aAAa,EAAE,mBAAmB,IAAI;oBACpC,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB;oBACzD,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB;iBAC5D;gBACD,UAAU,EAAE,gBAAgB,IAAI;oBAC9B,cAAc,EAAE,gBAAgB,EAAE,cAAc;oBAChD,aAAa,EAAE,gBAAgB,EAAE,aAAa;iBAC/C;aACF;SACF,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC,CAAC;IAEL,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,GAAQ;IAER,IAAI,GAAG,EAAE,WAAW,IAAI,GAAG,EAAE,OAAO,IAAI,GAAG,EAAE,QAAQ,EAAE;QACrD,MAAM,gBAAgB,GAAG,MAAM,qCAAqC,CAAC,GAAG,CAAC,CAAC;QAC1E,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAC1D,0BAA0B,CAAC,YAAY,CAAC,CACzC,CAAC;QAEF,OAAO,aAAa,CAAC;KACtB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import { documentToHtmlString } from '@contentful/rich-text-html-renderer';\nimport type { Entry, Asset, EntryCollection } from 'contentful';\n\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport { processFeatureAnnouncement } from '../processors/process-feature-announcement';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n ImageFields,\n TypeFeatureAnnouncement,\n} from '../types/feature-announcement/type-feature-announcement';\nimport type {\n TypeExternalLinkFields,\n TypePortfolioLinkFields,\n TypeExtensionLinkFields,\n TypeMobileLinkFields,\n} from '../types/feature-announcement/type-links';\nimport type { INotification } from '../types/notification/notification';\n\nconst DEFAULT_SPACE_ID = ':space_id';\nconst DEFAULT_ACCESS_TOKEN = ':access_token';\nconst DEFAULT_CLIENT_ID = ':client_id';\nexport const FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;\nexport const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;\n\ntype Env = {\n spaceId: string;\n accessToken: string;\n platform: string;\n};\n\n/**\n * Contentful API Response Shape\n */\nexport type ContentfulResult = {\n includes?: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Entry?: Entry[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Asset?: Asset[];\n };\n items?: TypeFeatureAnnouncement[];\n};\n\nconst getFeatureAnnouncementUrl = (env: Env) =>\n FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)\n .replace(DEFAULT_ACCESS_TOKEN, env.accessToken)\n .replace(DEFAULT_CLIENT_ID, env.platform);\n\nconst fetchFeatureAnnouncementNotifications = async (\n env: Env,\n): Promise<FeatureAnnouncementRawNotification[]> => {\n const url = getFeatureAnnouncementUrl(env);\n\n const data = await fetch(url)\n .then((r) => r.json())\n .catch(() => null);\n\n if (!data) {\n return [];\n }\n\n const findIncludedItem = (sysId: string) => {\n const typedData: EntryCollection<\n | ImageFields\n | TypeExtensionLinkFields\n | TypePortfolioLinkFields\n | TypeMobileLinkFields\n | TypeExternalLinkFields\n > = data;\n const item =\n typedData?.includes?.Entry?.find((i: Entry) => i?.sys?.id === sysId) ||\n typedData?.includes?.Asset?.find((i: Asset) => i?.sys?.id === sysId);\n return item ? item?.fields : null;\n };\n\n const contentfulNotifications = data?.items ?? [];\n const rawNotifications: FeatureAnnouncementRawNotification[] =\n contentfulNotifications.map((n: TypeFeatureAnnouncement) => {\n const { fields } = n;\n const imageFields = fields.image\n ? (findIncludedItem(fields.image.sys.id) as ImageFields['fields'])\n : undefined;\n\n const externalLinkFields = fields.externalLink\n ? (findIncludedItem(\n fields.externalLink.sys.id,\n ) as TypeExternalLinkFields['fields'])\n : undefined;\n const portfolioLinkFields = fields.portfolioLink\n ? (findIncludedItem(\n fields.portfolioLink.sys.id,\n ) as TypePortfolioLinkFields['fields'])\n : undefined;\n const extensionLinkFields = fields.extensionLink\n ? (findIncludedItem(\n fields.extensionLink.sys.id,\n ) as TypeExtensionLinkFields['fields'])\n : undefined;\n const mobileLinkFields = fields.mobileLink\n ? (findIncludedItem(\n fields.mobileLink.sys.id,\n ) as TypeMobileLinkFields['fields'])\n : undefined;\n\n const notification: FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: new Date(n.sys.createdAt).toString(),\n data: {\n id: fields.id,\n category: fields.category,\n title: fields.title,\n longDescription: documentToHtmlString(fields.longDescription),\n shortDescription: fields.shortDescription,\n image: {\n title: imageFields?.title,\n description: imageFields?.description,\n url: imageFields?.file?.url ?? '',\n },\n externalLink: externalLinkFields && {\n externalLinkText: externalLinkFields?.externalLinkText,\n externalLinkUrl: externalLinkFields?.externalLinkUrl,\n },\n portfolioLink: portfolioLinkFields && {\n portfolioLinkText: portfolioLinkFields?.portfolioLinkText,\n portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl,\n },\n extensionLink: extensionLinkFields && {\n extensionLinkText: extensionLinkFields?.extensionLinkText,\n extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,\n },\n mobileLink: mobileLinkFields && {\n mobileLinkText: mobileLinkFields?.mobileLinkText,\n mobileLinkUrl: mobileLinkFields?.mobileLinkUrl,\n },\n },\n };\n\n return notification;\n });\n\n return rawNotifications;\n};\n\n/**\n * Gets Feature Announcement from our services\n * @param env - environment for feature announcements\n * @returns Raw Feature Announcements\n */\nexport async function getFeatureAnnouncementNotifications(\n env: Env,\n): Promise<INotification[]> {\n if (env?.accessToken && env?.spaceId && env?.platform) {\n const rawNotifications = await fetchFeatureAnnouncementNotifications(env);\n const notifications = rawNotifications.map((notification) =>\n processFeatureAnnouncement(notification),\n );\n\n return notifications;\n }\n\n return [];\n}\n"]}
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.markNotificationsAsRead = exports.getOnChainNotifications = exports.deleteOnChainTriggers = exports.createOnChainTriggers = exports.NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = exports.NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = exports.NOTIFICATION_API_LIST_ENDPOINT = exports.TRIGGER_API_BATCH_ENDPOINT = exports.NOTIFICATION_API = exports.TRIGGER_API = void 0;
7
+ const profile_sync_controller_1 = require("@metamask/profile-sync-controller");
8
+ const loglevel_1 = __importDefault(require("loglevel"));
9
+ const to_raw_notification_1 = require("../../shared/to-raw-notification.cjs");
10
+ const utils_1 = require("../utils/utils.cjs");
11
+ exports.TRIGGER_API = 'https://trigger.api.cx.metamask.io';
12
+ exports.NOTIFICATION_API = 'https://notification.api.cx.metamask.io';
13
+ exports.TRIGGER_API_BATCH_ENDPOINT = `${exports.TRIGGER_API}/api/v1/triggers/batch`;
14
+ exports.NOTIFICATION_API_LIST_ENDPOINT = `${exports.NOTIFICATION_API}/api/v1/notifications`;
15
+ const NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = (page) => `${exports.NOTIFICATION_API_LIST_ENDPOINT}?page=${page}&per_page=100`;
16
+ exports.NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY;
17
+ exports.NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = `${exports.NOTIFICATION_API}/api/v1/notifications/mark-as-read`;
18
+ /**
19
+ * Creates on-chain triggers based on the provided notification triggers.
20
+ * This method generates a unique token for each trigger using the trigger ID and storage key,
21
+ * proving ownership of the trigger being updated. It then makes an API call to create these triggers.
22
+ * Upon successful creation, it updates the userStorage to reflect the new trigger status.
23
+ *
24
+ * @param userStorage - The user's storage object where triggers and their statuses are stored.
25
+ * @param storageKey - A key used along with the trigger ID to generate a unique token for each trigger.
26
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
27
+ * @param triggers - An array of notification triggers to be created. Each trigger includes an ID, chain ID, kind, and address.
28
+ * @returns A promise that resolves to void. Throws an error if the API call fails or if there's an issue creating the triggers.
29
+ */
30
+ async function createOnChainTriggers(userStorage, storageKey, bearerToken, triggers) {
31
+ const triggersToCreate = triggers.map((t) => ({
32
+ id: t.id,
33
+ token: profile_sync_controller_1.UserStorageController.createSHA256Hash(t.id + storageKey),
34
+ config: {
35
+ kind: t.kind,
36
+ // eslint-disable-next-line @typescript-eslint/naming-convention
37
+ chain_id: Number(t.chainId),
38
+ address: t.address,
39
+ },
40
+ }));
41
+ if (triggersToCreate.length === 0) {
42
+ return;
43
+ }
44
+ const response = await (0, utils_1.makeApiCall)(bearerToken, exports.TRIGGER_API_BATCH_ENDPOINT, 'POST', triggersToCreate);
45
+ if (!response.ok) {
46
+ const errorData = await response.json().catch(() => undefined);
47
+ loglevel_1.default.error('Error creating triggers:', errorData);
48
+ throw new Error('OnChain Notifications - unable to create triggers');
49
+ }
50
+ // If the trigger creation was fine
51
+ // then update the userStorage
52
+ for (const trigger of triggersToCreate) {
53
+ (0, utils_1.toggleUserStorageTriggerStatus)(userStorage, trigger.config.address, String(trigger.config.chain_id), trigger.id, true);
54
+ }
55
+ }
56
+ exports.createOnChainTriggers = createOnChainTriggers;
57
+ /**
58
+ * Deletes on-chain triggers based on the provided UUIDs.
59
+ * This method generates a unique token for each trigger using the UUID and storage key,
60
+ * proving ownership of the trigger being deleted. It then makes an API call to delete these triggers.
61
+ * Upon successful deletion, it updates the userStorage to remove the deleted trigger statuses.
62
+ *
63
+ * @param userStorage - The user's storage object where triggers and their statuses are stored.
64
+ * @param storageKey - A key used along with the UUID to generate a unique token for each trigger.
65
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
66
+ * @param uuids - An array of UUIDs representing the triggers to be deleted.
67
+ * @returns A promise that resolves to the updated UserStorage object. Throws an error if the API call fails or if there's an issue deleting the triggers.
68
+ */
69
+ async function deleteOnChainTriggers(userStorage, storageKey, bearerToken, uuids) {
70
+ const triggersToDelete = uuids.map((uuid) => ({
71
+ id: uuid,
72
+ token: profile_sync_controller_1.UserStorageController.createSHA256Hash(uuid + storageKey),
73
+ }));
74
+ try {
75
+ const response = await (0, utils_1.makeApiCall)(bearerToken, exports.TRIGGER_API_BATCH_ENDPOINT, 'DELETE', triggersToDelete);
76
+ if (!response.ok) {
77
+ throw new Error(`Failed to delete on-chain notifications for uuids ${uuids.join(', ')}`);
78
+ }
79
+ // Update the state of the deleted trigger to false
80
+ for (const uuid of uuids) {
81
+ for (const address in userStorage) {
82
+ if (address in userStorage) {
83
+ for (const chainId in userStorage[address]) {
84
+ if (userStorage?.[address]?.[chainId]?.[uuid]) {
85
+ delete userStorage[address][chainId][uuid];
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ // Follow-up cleanup, if an address had no triggers whatsoever, then we can delete the address
92
+ const isEmpty = (obj = {}) => Object.keys(obj).length === 0;
93
+ for (const address in userStorage) {
94
+ if (address in userStorage) {
95
+ for (const chainId in userStorage[address]) {
96
+ // Chain isEmpty Check
97
+ if (isEmpty(userStorage?.[address]?.[chainId])) {
98
+ delete userStorage[address][chainId];
99
+ }
100
+ }
101
+ // Address isEmpty Check
102
+ if (isEmpty(userStorage?.[address])) {
103
+ delete userStorage[address];
104
+ }
105
+ }
106
+ }
107
+ }
108
+ catch (err) {
109
+ loglevel_1.default.error(`Error deleting on-chain notifications for uuids ${uuids.join(', ')}:`, err);
110
+ throw err;
111
+ }
112
+ return userStorage;
113
+ }
114
+ exports.deleteOnChainTriggers = deleteOnChainTriggers;
115
+ /**
116
+ * Fetches on-chain notifications for the given user storage and BearerToken.
117
+ * This method iterates through the userStorage to find enabled triggers and fetches notifications for those triggers.
118
+ * It makes paginated API calls to the notifications service, transforming and aggregating the notifications into a single array.
119
+ * The process stops either when all pages have been fetched or when a page has less than 100 notifications, indicating the end of the data.
120
+ *
121
+ * @param userStorage - The user's storage object containing trigger information.
122
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
123
+ * @returns A promise that resolves to an array of OnChainRawNotification objects. If no triggers are enabled or an error occurs, it may return an empty array.
124
+ */
125
+ async function getOnChainNotifications(userStorage, bearerToken) {
126
+ const triggerIds = (0, utils_1.traverseUserStorageTriggers)(userStorage, {
127
+ mapTrigger: (t) => {
128
+ if (!t.enabled) {
129
+ return undefined;
130
+ }
131
+ return t.id;
132
+ },
133
+ });
134
+ if (triggerIds.length === 0) {
135
+ return [];
136
+ }
137
+ const onChainNotifications = [];
138
+ const PAGE_LIMIT = 2;
139
+ for (let page = 1; page <= PAGE_LIMIT; page++) {
140
+ try {
141
+ const response = await (0, utils_1.makeApiCall)(bearerToken, (0, exports.NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY)(page), 'POST',
142
+ // eslint-disable-next-line @typescript-eslint/naming-convention
143
+ { trigger_ids: triggerIds });
144
+ const notifications = (await response.json());
145
+ // Transform and sort notifications
146
+ const transformedNotifications = notifications
147
+ .map((n) => {
148
+ if (!n.data?.kind) {
149
+ return undefined;
150
+ }
151
+ return (0, to_raw_notification_1.toRawOnChainNotification)(n);
152
+ })
153
+ .filter((n) => Boolean(n));
154
+ onChainNotifications.push(...transformedNotifications);
155
+ // if less than 100 notifications on page, then means we reached end
156
+ if (notifications.length < 100) {
157
+ page = PAGE_LIMIT + 1;
158
+ break;
159
+ }
160
+ }
161
+ catch (err) {
162
+ loglevel_1.default.error(`Error fetching on-chain notifications for trigger IDs ${triggerIds.join(', ')}:`, err);
163
+ // do nothing
164
+ }
165
+ }
166
+ return onChainNotifications;
167
+ }
168
+ exports.getOnChainNotifications = getOnChainNotifications;
169
+ /**
170
+ * Marks the specified notifications as read.
171
+ * This method sends a POST request to the notifications service to mark the provided notification IDs as read.
172
+ * If the operation is successful, it completes without error. If the operation fails, it throws an error with details.
173
+ *
174
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
175
+ * @param notificationIds - An array of notification IDs to be marked as read.
176
+ * @returns A promise that resolves to void. The promise will reject if there's an error during the API call or if the response status is not 200.
177
+ */
178
+ async function markNotificationsAsRead(bearerToken, notificationIds) {
179
+ if (notificationIds.length === 0) {
180
+ return;
181
+ }
182
+ try {
183
+ const response = await (0, utils_1.makeApiCall)(bearerToken, exports.NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT, 'POST', { ids: notificationIds });
184
+ if (response.status !== 200) {
185
+ const errorData = await response.json().catch(() => undefined);
186
+ throw new Error(`Error marking notifications as read: ${errorData?.message}`);
187
+ }
188
+ }
189
+ catch (err) {
190
+ loglevel_1.default.error('Error marking notifications as read:', err);
191
+ throw err;
192
+ }
193
+ }
194
+ exports.markNotificationsAsRead = markNotificationsAsRead;
195
+ //# sourceMappingURL=onchain-notifications.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onchain-notifications.cjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/onchain-notifications.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA0E;AAC1E,wDAA2B;AAE3B,8EAA4E;AAM5E,8CAIwB;AASX,QAAA,WAAW,GAAG,oCAAoC,CAAC;AACnD,QAAA,gBAAgB,GAAG,yCAAyC,CAAC;AAC7D,QAAA,0BAA0B,GAAG,GAAG,mBAAW,wBAAwB,CAAC;AAC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ED,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAW,EAChC,WAAW,EACX,kDAA0C,EAC1C,MAAM,EACN,EAAE,GAAG,EAAE,eAAe,EAAE,CACzB,CAAC;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAC3B,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC/D,MAAM,IAAI,KAAK,CACb,wCAAwC,SAAS,EAAE,OAAiB,EAAE,CACvE,CAAC;SACH;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,kBAAG,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,GAAG,CAAC;KACX;AACH,CAAC;AA1BD,0DA0BC","sourcesContent":["import { UserStorageController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport { toRawOnChainNotification } from '../../shared/to-raw-notification';\nimport type {\n OnChainRawNotification,\n UnprocessedOnChainRawNotification,\n} from '../types/on-chain-notification/on-chain-notification';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport {\n makeApiCall,\n toggleUserStorageTriggerStatus,\n traverseUserStorageTriggers,\n} from '../utils/utils';\n\nexport type NotificationTrigger = {\n id: string;\n chainId: string;\n kind: string;\n address: string;\n};\n\nexport const TRIGGER_API = 'https://trigger.api.cx.metamask.io';\nexport const NOTIFICATION_API = 'https://notification.api.cx.metamask.io';\nexport const TRIGGER_API_BATCH_ENDPOINT = `${TRIGGER_API}/api/v1/triggers/batch`;\nexport const NOTIFICATION_API_LIST_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications`;\nexport const NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = (page: number) =>\n `${NOTIFICATION_API_LIST_ENDPOINT}?page=${page}&per_page=100`;\nexport const NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications/mark-as-read`;\n\n/**\n * Creates on-chain triggers based on the provided notification triggers.\n * This method generates a unique token for each trigger using the trigger ID and storage key,\n * proving ownership of the trigger being updated. It then makes an API call to create these triggers.\n * Upon successful creation, it updates the userStorage to reflect the new trigger status.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the trigger ID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param triggers - An array of notification triggers to be created. Each trigger includes an ID, chain ID, kind, and address.\n * @returns A promise that resolves to void. Throws an error if the API call fails or if there's an issue creating the triggers.\n */\nexport async function createOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n triggers: NotificationTrigger[],\n): Promise<void> {\n type RequestPayloadTrigger = {\n id: string;\n // this is the trigger token, generated by using the uuid + storage key. It proves you own the trigger you are updating\n token: string;\n config: {\n kind: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n chain_id: number;\n address: string;\n };\n };\n const triggersToCreate: RequestPayloadTrigger[] = triggers.map((t) => ({\n id: t.id,\n token: UserStorageController.createSHA256Hash(t.id + storageKey),\n config: {\n kind: t.kind,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n chain_id: Number(t.chainId),\n address: t.address,\n },\n }));\n\n if (triggersToCreate.length === 0) {\n return;\n }\n\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'POST',\n triggersToCreate,\n );\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => undefined);\n log.error('Error creating triggers:', errorData);\n throw new Error('OnChain Notifications - unable to create triggers');\n }\n\n // If the trigger creation was fine\n // then update the userStorage\n for (const trigger of triggersToCreate) {\n toggleUserStorageTriggerStatus(\n userStorage,\n trigger.config.address,\n String(trigger.config.chain_id),\n trigger.id,\n true,\n );\n }\n}\n\n/**\n * Deletes on-chain triggers based on the provided UUIDs.\n * This method generates a unique token for each trigger using the UUID and storage key,\n * proving ownership of the trigger being deleted. It then makes an API call to delete these triggers.\n * Upon successful deletion, it updates the userStorage to remove the deleted trigger statuses.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the UUID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param uuids - An array of UUIDs representing the triggers to be deleted.\n * @returns A promise that resolves to the updated UserStorage object. Throws an error if the API call fails or if there's an issue deleting the triggers.\n */\nexport async function deleteOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n uuids: string[],\n): Promise<UserStorage> {\n const triggersToDelete = uuids.map((uuid) => ({\n id: uuid,\n token: UserStorageController.createSHA256Hash(uuid + storageKey),\n }));\n\n try {\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'DELETE',\n triggersToDelete,\n );\n\n if (!response.ok) {\n throw new Error(\n `Failed to delete on-chain notifications for uuids ${uuids.join(', ')}`,\n );\n }\n\n // Update the state of the deleted trigger to false\n for (const uuid of uuids) {\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n if (userStorage?.[address]?.[chainId]?.[uuid]) {\n delete userStorage[address][chainId][uuid];\n }\n }\n }\n }\n }\n\n // Follow-up cleanup, if an address had no triggers whatsoever, then we can delete the address\n const isEmpty = (obj = {}) => Object.keys(obj).length === 0;\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n // Chain isEmpty Check\n if (isEmpty(userStorage?.[address]?.[chainId])) {\n delete userStorage[address][chainId];\n }\n }\n\n // Address isEmpty Check\n if (isEmpty(userStorage?.[address])) {\n delete userStorage[address];\n }\n }\n }\n } catch (err) {\n log.error(\n `Error deleting on-chain notifications for uuids ${uuids.join(', ')}:`,\n err,\n );\n throw err;\n }\n\n return userStorage;\n}\n\n/**\n * Fetches on-chain notifications for the given user storage and BearerToken.\n * This method iterates through the userStorage to find enabled triggers and fetches notifications for those triggers.\n * It makes paginated API calls to the notifications service, transforming and aggregating the notifications into a single array.\n * The process stops either when all pages have been fetched or when a page has less than 100 notifications, indicating the end of the data.\n *\n * @param userStorage - The user's storage object containing trigger information.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @returns A promise that resolves to an array of OnChainRawNotification objects. If no triggers are enabled or an error occurs, it may return an empty array.\n */\nexport async function getOnChainNotifications(\n userStorage: UserStorage,\n bearerToken: string,\n): Promise<OnChainRawNotification[]> {\n const triggerIds = traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (!t.enabled) {\n return undefined;\n }\n return t.id;\n },\n });\n\n if (triggerIds.length === 0) {\n return [];\n }\n\n const onChainNotifications: OnChainRawNotification[] = [];\n const PAGE_LIMIT = 2;\n for (let page = 1; page <= PAGE_LIMIT; page++) {\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY(page),\n 'POST',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n { trigger_ids: triggerIds },\n );\n\n const notifications =\n (await response.json()) as UnprocessedOnChainRawNotification[];\n\n // Transform and sort notifications\n const transformedNotifications = notifications\n .map((n): OnChainRawNotification | undefined => {\n if (!n.data?.kind) {\n return undefined;\n }\n\n return toRawOnChainNotification(n);\n })\n .filter((n): n is OnChainRawNotification => Boolean(n));\n\n onChainNotifications.push(...transformedNotifications);\n\n // if less than 100 notifications on page, then means we reached end\n if (notifications.length < 100) {\n page = PAGE_LIMIT + 1;\n break;\n }\n } catch (err) {\n log.error(\n `Error fetching on-chain notifications for trigger IDs ${triggerIds.join(\n ', ',\n )}:`,\n err,\n );\n // do nothing\n }\n }\n\n return onChainNotifications;\n}\n\n/**\n * Marks the specified notifications as read.\n * This method sends a POST request to the notifications service to mark the provided notification IDs as read.\n * If the operation is successful, it completes without error. If the operation fails, it throws an error with details.\n *\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param notificationIds - An array of notification IDs to be marked as read.\n * @returns A promise that resolves to void. The promise will reject if there's an error during the API call or if the response status is not 200.\n */\nexport async function markNotificationsAsRead(\n bearerToken: string,\n notificationIds: string[],\n): Promise<void> {\n if (notificationIds.length === 0) {\n return;\n }\n\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n 'POST',\n { ids: notificationIds },\n );\n\n if (response.status !== 200) {\n const errorData = await response.json().catch(() => undefined);\n throw new Error(\n `Error marking notifications as read: ${errorData?.message as string}`,\n );\n }\n } catch (err) {\n log.error('Error marking notifications as read:', err);\n throw err;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { OnChainRawNotification } from '../types/on-chain-notification/on-chain-notification';
2
- import type { UserStorage } from '../types/user-storage/user-storage';
1
+ import type { OnChainRawNotification } from "../types/on-chain-notification/on-chain-notification.cjs";
2
+ import type { UserStorage } from "../types/user-storage/user-storage.cjs";
3
3
  export type NotificationTrigger = {
4
4
  id: string;
5
5
  chainId: string;
@@ -59,4 +59,4 @@ export declare function getOnChainNotifications(userStorage: UserStorage, bearer
59
59
  * @returns A promise that resolves to void. The promise will reject if there's an error during the API call or if the response status is not 200.
60
60
  */
61
61
  export declare function markNotificationsAsRead(bearerToken: string, notificationIds: string[]): Promise<void>;
62
- //# sourceMappingURL=onchain-notifications.d.ts.map
62
+ //# sourceMappingURL=onchain-notifications.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onchain-notifications.d.cts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/onchain-notifications.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,sBAAsB,EAEvB,iEAA6D;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,+CAA2C;AAOtE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,uCAAuC,CAAC;AAChE,eAAO,MAAM,gBAAgB,4CAA4C,CAAC;AAC1E,eAAO,MAAM,0BAA0B,6DAAyC,CAAC;AACjF,eAAO,MAAM,8BAA8B,iEAA6C,CAAC;AACzF,eAAO,MAAM,yCAAyC,SAAU,MAAM,WACP,CAAC;AAChE,eAAO,MAAM,0CAA0C,8EAA0D,CAAC;AAElH;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,mBAAmB,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmDf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,CAAC,CA2DtB;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA2DnC;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAuBf"}
@@ -0,0 +1,62 @@
1
+ import type { OnChainRawNotification } from "../types/on-chain-notification/on-chain-notification.mjs";
2
+ import type { UserStorage } from "../types/user-storage/user-storage.mjs";
3
+ export type NotificationTrigger = {
4
+ id: string;
5
+ chainId: string;
6
+ kind: string;
7
+ address: string;
8
+ };
9
+ export declare const TRIGGER_API = "https://trigger.api.cx.metamask.io";
10
+ export declare const NOTIFICATION_API = "https://notification.api.cx.metamask.io";
11
+ export declare const TRIGGER_API_BATCH_ENDPOINT = "https://trigger.api.cx.metamask.io/api/v1/triggers/batch";
12
+ export declare const NOTIFICATION_API_LIST_ENDPOINT = "https://notification.api.cx.metamask.io/api/v1/notifications";
13
+ export declare const NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY: (page: number) => string;
14
+ export declare const NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = "https://notification.api.cx.metamask.io/api/v1/notifications/mark-as-read";
15
+ /**
16
+ * Creates on-chain triggers based on the provided notification triggers.
17
+ * This method generates a unique token for each trigger using the trigger ID and storage key,
18
+ * proving ownership of the trigger being updated. It then makes an API call to create these triggers.
19
+ * Upon successful creation, it updates the userStorage to reflect the new trigger status.
20
+ *
21
+ * @param userStorage - The user's storage object where triggers and their statuses are stored.
22
+ * @param storageKey - A key used along with the trigger ID to generate a unique token for each trigger.
23
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
24
+ * @param triggers - An array of notification triggers to be created. Each trigger includes an ID, chain ID, kind, and address.
25
+ * @returns A promise that resolves to void. Throws an error if the API call fails or if there's an issue creating the triggers.
26
+ */
27
+ export declare function createOnChainTriggers(userStorage: UserStorage, storageKey: string, bearerToken: string, triggers: NotificationTrigger[]): Promise<void>;
28
+ /**
29
+ * Deletes on-chain triggers based on the provided UUIDs.
30
+ * This method generates a unique token for each trigger using the UUID and storage key,
31
+ * proving ownership of the trigger being deleted. It then makes an API call to delete these triggers.
32
+ * Upon successful deletion, it updates the userStorage to remove the deleted trigger statuses.
33
+ *
34
+ * @param userStorage - The user's storage object where triggers and their statuses are stored.
35
+ * @param storageKey - A key used along with the UUID to generate a unique token for each trigger.
36
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
37
+ * @param uuids - An array of UUIDs representing the triggers to be deleted.
38
+ * @returns A promise that resolves to the updated UserStorage object. Throws an error if the API call fails or if there's an issue deleting the triggers.
39
+ */
40
+ export declare function deleteOnChainTriggers(userStorage: UserStorage, storageKey: string, bearerToken: string, uuids: string[]): Promise<UserStorage>;
41
+ /**
42
+ * Fetches on-chain notifications for the given user storage and BearerToken.
43
+ * This method iterates through the userStorage to find enabled triggers and fetches notifications for those triggers.
44
+ * It makes paginated API calls to the notifications service, transforming and aggregating the notifications into a single array.
45
+ * The process stops either when all pages have been fetched or when a page has less than 100 notifications, indicating the end of the data.
46
+ *
47
+ * @param userStorage - The user's storage object containing trigger information.
48
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
49
+ * @returns A promise that resolves to an array of OnChainRawNotification objects. If no triggers are enabled or an error occurs, it may return an empty array.
50
+ */
51
+ export declare function getOnChainNotifications(userStorage: UserStorage, bearerToken: string): Promise<OnChainRawNotification[]>;
52
+ /**
53
+ * Marks the specified notifications as read.
54
+ * This method sends a POST request to the notifications service to mark the provided notification IDs as read.
55
+ * If the operation is successful, it completes without error. If the operation fails, it throws an error with details.
56
+ *
57
+ * @param bearerToken - The JSON Web Token used for authentication in the API call.
58
+ * @param notificationIds - An array of notification IDs to be marked as read.
59
+ * @returns A promise that resolves to void. The promise will reject if there's an error during the API call or if the response status is not 200.
60
+ */
61
+ export declare function markNotificationsAsRead(bearerToken: string, notificationIds: string[]): Promise<void>;
62
+ //# sourceMappingURL=onchain-notifications.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onchain-notifications.d.mts","sourceRoot":"","sources":["../../../src/NotificationServicesController/services/onchain-notifications.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,sBAAsB,EAEvB,iEAA6D;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,+CAA2C;AAOtE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,uCAAuC,CAAC;AAChE,eAAO,MAAM,gBAAgB,4CAA4C,CAAC;AAC1E,eAAO,MAAM,0BAA0B,6DAAyC,CAAC;AACjF,eAAO,MAAM,8BAA8B,iEAA6C,CAAC;AACzF,eAAO,MAAM,yCAAyC,SAAU,MAAM,WACP,CAAC;AAChE,eAAO,MAAM,0CAA0C,8EAA0D,CAAC;AAElH;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,mBAAmB,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmDf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,WAAW,CAAC,CA2DtB;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA2DnC;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAuBf"}