@bitsocial/bitsocial-react-hooks 0.1.0

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 (269) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +1365 -0
  3. package/dist/hooks/accounts/accounts.d.ts +64 -0
  4. package/dist/hooks/accounts/accounts.d.ts.map +1 -0
  5. package/dist/hooks/accounts/accounts.js +706 -0
  6. package/dist/hooks/accounts/accounts.js.map +1 -0
  7. package/dist/hooks/accounts/index.d.ts +2 -0
  8. package/dist/hooks/accounts/index.d.ts.map +1 -0
  9. package/dist/hooks/accounts/index.js +2 -0
  10. package/dist/hooks/accounts/index.js.map +1 -0
  11. package/dist/hooks/accounts/utils.d.ts +6 -0
  12. package/dist/hooks/accounts/utils.d.ts.map +1 -0
  13. package/dist/hooks/accounts/utils.js +226 -0
  14. package/dist/hooks/accounts/utils.js.map +1 -0
  15. package/dist/hooks/actions/actions.d.ts +19 -0
  16. package/dist/hooks/actions/actions.d.ts.map +1 -0
  17. package/dist/hooks/actions/actions.js +552 -0
  18. package/dist/hooks/actions/actions.js.map +1 -0
  19. package/dist/hooks/actions/index.d.ts +2 -0
  20. package/dist/hooks/actions/index.d.ts.map +1 -0
  21. package/dist/hooks/actions/index.js +2 -0
  22. package/dist/hooks/actions/index.js.map +1 -0
  23. package/dist/hooks/authors/author-avatars.d.ts +28 -0
  24. package/dist/hooks/authors/author-avatars.d.ts.map +1 -0
  25. package/dist/hooks/authors/author-avatars.js +191 -0
  26. package/dist/hooks/authors/author-avatars.js.map +1 -0
  27. package/dist/hooks/authors/authors.d.ts +37 -0
  28. package/dist/hooks/authors/authors.d.ts.map +1 -0
  29. package/dist/hooks/authors/authors.js +509 -0
  30. package/dist/hooks/authors/authors.js.map +1 -0
  31. package/dist/hooks/authors/index.d.ts +2 -0
  32. package/dist/hooks/authors/index.d.ts.map +1 -0
  33. package/dist/hooks/authors/index.js +2 -0
  34. package/dist/hooks/authors/index.js.map +1 -0
  35. package/dist/hooks/authors/utils.d.ts +4 -0
  36. package/dist/hooks/authors/utils.d.ts.map +1 -0
  37. package/dist/hooks/authors/utils.js +21 -0
  38. package/dist/hooks/authors/utils.js.map +1 -0
  39. package/dist/hooks/comments.d.ts +17 -0
  40. package/dist/hooks/comments.d.ts.map +1 -0
  41. package/dist/hooks/comments.js +351 -0
  42. package/dist/hooks/comments.js.map +1 -0
  43. package/dist/hooks/communities.d.ts +31 -0
  44. package/dist/hooks/communities.d.ts.map +1 -0
  45. package/dist/hooks/communities.js +389 -0
  46. package/dist/hooks/communities.js.map +1 -0
  47. package/dist/hooks/feeds/feeds.d.ts +18 -0
  48. package/dist/hooks/feeds/feeds.d.ts.map +1 -0
  49. package/dist/hooks/feeds/feeds.js +315 -0
  50. package/dist/hooks/feeds/feeds.js.map +1 -0
  51. package/dist/hooks/feeds/index.d.ts +2 -0
  52. package/dist/hooks/feeds/index.d.ts.map +1 -0
  53. package/dist/hooks/feeds/index.js +2 -0
  54. package/dist/hooks/feeds/index.js.map +1 -0
  55. package/dist/hooks/pkc-rpc.d.ts +7 -0
  56. package/dist/hooks/pkc-rpc.d.ts.map +1 -0
  57. package/dist/hooks/pkc-rpc.js +88 -0
  58. package/dist/hooks/pkc-rpc.js.map +1 -0
  59. package/dist/hooks/replies.d.ts +5 -0
  60. package/dist/hooks/replies.d.ts.map +1 -0
  61. package/dist/hooks/replies.js +155 -0
  62. package/dist/hooks/replies.js.map +1 -0
  63. package/dist/hooks/states.d.ts +15 -0
  64. package/dist/hooks/states.d.ts.map +1 -0
  65. package/dist/hooks/states.js +213 -0
  66. package/dist/hooks/states.js.map +1 -0
  67. package/dist/hooks/utils/use-interval.d.ts +3 -0
  68. package/dist/hooks/utils/use-interval.d.ts.map +1 -0
  69. package/dist/hooks/utils/use-interval.js +36 -0
  70. package/dist/hooks/utils/use-interval.js.map +1 -0
  71. package/dist/hooks/utils/use-previous.d.ts +1 -0
  72. package/dist/hooks/utils/use-previous.js +10 -0
  73. package/dist/index.d.ts +82 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +128 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/lib/chain/chain.d.ts +36 -0
  78. package/dist/lib/chain/chain.d.ts.map +1 -0
  79. package/dist/lib/chain/chain.js +195 -0
  80. package/dist/lib/chain/chain.js.map +1 -0
  81. package/dist/lib/chain/index.d.ts +4 -0
  82. package/dist/lib/chain/index.d.ts.map +1 -0
  83. package/dist/lib/chain/index.js +4 -0
  84. package/dist/lib/chain/index.js.map +1 -0
  85. package/dist/lib/community-address.d.ts +6 -0
  86. package/dist/lib/community-address.d.ts.map +1 -0
  87. package/dist/lib/community-address.js +26 -0
  88. package/dist/lib/community-address.js.map +1 -0
  89. package/dist/lib/community-ref.d.ts +23 -0
  90. package/dist/lib/community-ref.d.ts.map +1 -0
  91. package/dist/lib/community-ref.js +113 -0
  92. package/dist/lib/community-ref.js.map +1 -0
  93. package/dist/lib/debug-utils.d.ts +9 -0
  94. package/dist/lib/debug-utils.d.ts.map +1 -0
  95. package/dist/lib/debug-utils.js +21 -0
  96. package/dist/lib/debug-utils.js.map +1 -0
  97. package/dist/lib/feed-sort-type.d.ts +2 -0
  98. package/dist/lib/feed-sort-type.d.ts.map +1 -0
  99. package/dist/lib/feed-sort-type.js +22 -0
  100. package/dist/lib/feed-sort-type.js.map +1 -0
  101. package/dist/lib/localforage-lru/index.d.ts +3 -0
  102. package/dist/lib/localforage-lru/index.d.ts.map +1 -0
  103. package/dist/lib/localforage-lru/index.js +46 -0
  104. package/dist/lib/localforage-lru/index.js.map +1 -0
  105. package/dist/lib/localforage-lru/localforage-lru.d.ts +6 -0
  106. package/dist/lib/localforage-lru/localforage-lru.d.ts.map +1 -0
  107. package/dist/lib/localforage-lru/localforage-lru.js +182 -0
  108. package/dist/lib/localforage-lru/localforage-lru.js.map +1 -0
  109. package/dist/lib/pkc-compat.d.ts +25 -0
  110. package/dist/lib/pkc-compat.d.ts.map +1 -0
  111. package/dist/lib/pkc-compat.js +131 -0
  112. package/dist/lib/pkc-compat.js.map +1 -0
  113. package/dist/lib/pkc-js/fixtures/markdown-example.d.ts +3 -0
  114. package/dist/lib/pkc-js/fixtures/markdown-example.d.ts.map +1 -0
  115. package/dist/lib/pkc-js/fixtures/markdown-example.js +280 -0
  116. package/dist/lib/pkc-js/fixtures/markdown-example.js.map +1 -0
  117. package/dist/lib/pkc-js/index.d.ts +11 -0
  118. package/dist/lib/pkc-js/index.d.ts.map +1 -0
  119. package/dist/lib/pkc-js/index.js +85 -0
  120. package/dist/lib/pkc-js/index.js.map +1 -0
  121. package/dist/lib/pkc-js/pkc-js-mock-content.d.ts +3 -0
  122. package/dist/lib/pkc-js/pkc-js-mock-content.d.ts.map +1 -0
  123. package/dist/lib/pkc-js/pkc-js-mock-content.js +1235 -0
  124. package/dist/lib/pkc-js/pkc-js-mock-content.js.map +1 -0
  125. package/dist/lib/pkc-js/pkc-js-mock.d.ts +137 -0
  126. package/dist/lib/pkc-js/pkc-js-mock.d.ts.map +1 -0
  127. package/dist/lib/pkc-js/pkc-js-mock.js +644 -0
  128. package/dist/lib/pkc-js/pkc-js-mock.js.map +1 -0
  129. package/dist/lib/polyfill.d.ts +3 -0
  130. package/dist/lib/polyfill.d.ts.map +1 -0
  131. package/dist/lib/polyfill.js +14 -0
  132. package/dist/lib/polyfill.js.map +1 -0
  133. package/dist/lib/protocol-compat.d.ts +14 -0
  134. package/dist/lib/protocol-compat.d.ts.map +1 -0
  135. package/dist/lib/protocol-compat.js +67 -0
  136. package/dist/lib/protocol-compat.js.map +1 -0
  137. package/dist/lib/test-utils.d.ts +29 -0
  138. package/dist/lib/test-utils.d.ts.map +1 -0
  139. package/dist/lib/test-utils.js +184 -0
  140. package/dist/lib/test-utils.js.map +1 -0
  141. package/dist/lib/utils/comment-moderation.d.ts +4 -0
  142. package/dist/lib/utils/comment-moderation.d.ts.map +1 -0
  143. package/dist/lib/utils/comment-moderation.js +56 -0
  144. package/dist/lib/utils/comment-moderation.js.map +1 -0
  145. package/dist/lib/utils/index.d.ts +4 -0
  146. package/dist/lib/utils/index.d.ts.map +1 -0
  147. package/dist/lib/utils/index.js +4 -0
  148. package/dist/lib/utils/index.js.map +1 -0
  149. package/dist/lib/utils/utils.d.ts +23 -0
  150. package/dist/lib/utils/utils.d.ts.map +1 -0
  151. package/dist/lib/utils/utils.js +375 -0
  152. package/dist/lib/utils/utils.js.map +1 -0
  153. package/dist/lib/validator.d.ts +30 -0
  154. package/dist/lib/validator.d.ts.map +1 -0
  155. package/dist/lib/validator.js +307 -0
  156. package/dist/lib/validator.js.map +1 -0
  157. package/dist/stores/accounts/account-generator.d.ts +51 -0
  158. package/dist/stores/accounts/account-generator.d.ts.map +1 -0
  159. package/dist/stores/accounts/account-generator.js +160 -0
  160. package/dist/stores/accounts/account-generator.js.map +1 -0
  161. package/dist/stores/accounts/accounts-actions-internal.d.ts +8 -0
  162. package/dist/stores/accounts/accounts-actions-internal.d.ts.map +1 -0
  163. package/dist/stores/accounts/accounts-actions-internal.js +403 -0
  164. package/dist/stores/accounts/accounts-actions-internal.js.map +1 -0
  165. package/dist/stores/accounts/accounts-actions.d.ts +46 -0
  166. package/dist/stores/accounts/accounts-actions.d.ts.map +1 -0
  167. package/dist/stores/accounts/accounts-actions.js +1341 -0
  168. package/dist/stores/accounts/accounts-actions.js.map +1 -0
  169. package/dist/stores/accounts/accounts-database.d.ts +34 -0
  170. package/dist/stores/accounts/accounts-database.d.ts.map +1 -0
  171. package/dist/stores/accounts/accounts-database.js +685 -0
  172. package/dist/stores/accounts/accounts-database.js.map +1 -0
  173. package/dist/stores/accounts/accounts-store.d.ts +32 -0
  174. package/dist/stores/accounts/accounts-store.d.ts.map +1 -0
  175. package/dist/stores/accounts/accounts-store.js +169 -0
  176. package/dist/stores/accounts/accounts-store.js.map +1 -0
  177. package/dist/stores/accounts/index.d.ts +4 -0
  178. package/dist/stores/accounts/index.d.ts.map +1 -0
  179. package/dist/stores/accounts/index.js +4 -0
  180. package/dist/stores/accounts/index.js.map +1 -0
  181. package/dist/stores/accounts/utils.d.ts +49 -0
  182. package/dist/stores/accounts/utils.d.ts.map +1 -0
  183. package/dist/stores/accounts/utils.js +419 -0
  184. package/dist/stores/accounts/utils.js.map +1 -0
  185. package/dist/stores/authors-comments/authors-comments-store.d.ts +37 -0
  186. package/dist/stores/authors-comments/authors-comments-store.d.ts.map +1 -0
  187. package/dist/stores/authors-comments/authors-comments-store.js +338 -0
  188. package/dist/stores/authors-comments/authors-comments-store.js.map +1 -0
  189. package/dist/stores/authors-comments/index.d.ts +4 -0
  190. package/dist/stores/authors-comments/index.d.ts.map +1 -0
  191. package/dist/stores/authors-comments/index.js +4 -0
  192. package/dist/stores/authors-comments/index.js.map +1 -0
  193. package/dist/stores/authors-comments/utils.d.ts +14 -0
  194. package/dist/stores/authors-comments/utils.d.ts.map +1 -0
  195. package/dist/stores/authors-comments/utils.js +81 -0
  196. package/dist/stores/authors-comments/utils.js.map +1 -0
  197. package/dist/stores/comments/comments-store.d.ts +19 -0
  198. package/dist/stores/comments/comments-store.d.ts.map +1 -0
  199. package/dist/stores/comments/comments-store.js +385 -0
  200. package/dist/stores/comments/comments-store.js.map +1 -0
  201. package/dist/stores/comments/index.d.ts +4 -0
  202. package/dist/stores/comments/index.d.ts.map +1 -0
  203. package/dist/stores/comments/index.js +4 -0
  204. package/dist/stores/comments/index.js.map +1 -0
  205. package/dist/stores/communities/communities-store.d.ts +17 -0
  206. package/dist/stores/communities/communities-store.d.ts.map +1 -0
  207. package/dist/stores/communities/communities-store.js +304 -0
  208. package/dist/stores/communities/communities-store.js.map +1 -0
  209. package/dist/stores/communities/index.d.ts +4 -0
  210. package/dist/stores/communities/index.d.ts.map +1 -0
  211. package/dist/stores/communities/index.js +4 -0
  212. package/dist/stores/communities/index.js.map +1 -0
  213. package/dist/stores/communities-pages/communities-pages-store.d.ts +23 -0
  214. package/dist/stores/communities-pages/communities-pages-store.d.ts.map +1 -0
  215. package/dist/stores/communities-pages/communities-pages-store.js +316 -0
  216. package/dist/stores/communities-pages/communities-pages-store.js.map +1 -0
  217. package/dist/stores/communities-pages/index.d.ts +4 -0
  218. package/dist/stores/communities-pages/index.d.ts.map +1 -0
  219. package/dist/stores/communities-pages/index.js +4 -0
  220. package/dist/stores/communities-pages/index.js.map +1 -0
  221. package/dist/stores/feeds/feed-sorter.d.ts +5 -0
  222. package/dist/stores/feeds/feed-sorter.d.ts.map +1 -0
  223. package/dist/stores/feeds/feed-sorter.js +135 -0
  224. package/dist/stores/feeds/feed-sorter.js.map +1 -0
  225. package/dist/stores/feeds/feeds-store.d.ts +25 -0
  226. package/dist/stores/feeds/feeds-store.d.ts.map +1 -0
  227. package/dist/stores/feeds/feeds-store.js +459 -0
  228. package/dist/stores/feeds/feeds-store.js.map +1 -0
  229. package/dist/stores/feeds/index.d.ts +4 -0
  230. package/dist/stores/feeds/index.d.ts.map +1 -0
  231. package/dist/stores/feeds/index.js +4 -0
  232. package/dist/stores/feeds/index.js.map +1 -0
  233. package/dist/stores/feeds/utils.d.ts +43 -0
  234. package/dist/stores/feeds/utils.d.ts.map +1 -0
  235. package/dist/stores/feeds/utils.js +736 -0
  236. package/dist/stores/feeds/utils.js.map +1 -0
  237. package/dist/stores/replies/index.d.ts +4 -0
  238. package/dist/stores/replies/index.d.ts.map +1 -0
  239. package/dist/stores/replies/index.js +4 -0
  240. package/dist/stores/replies/index.js.map +1 -0
  241. package/dist/stores/replies/replies-comments-store.d.ts +8 -0
  242. package/dist/stores/replies/replies-comments-store.d.ts.map +1 -0
  243. package/dist/stores/replies/replies-comments-store.js +23 -0
  244. package/dist/stores/replies/replies-comments-store.js.map +1 -0
  245. package/dist/stores/replies/replies-store.d.ts +29 -0
  246. package/dist/stores/replies/replies-store.d.ts.map +1 -0
  247. package/dist/stores/replies/replies-store.js +413 -0
  248. package/dist/stores/replies/replies-store.js.map +1 -0
  249. package/dist/stores/replies/utils.d.ts +25 -0
  250. package/dist/stores/replies/utils.d.ts.map +1 -0
  251. package/dist/stores/replies/utils.js +549 -0
  252. package/dist/stores/replies/utils.js.map +1 -0
  253. package/dist/stores/replies-pages/index.d.ts +4 -0
  254. package/dist/stores/replies-pages/index.d.ts.map +1 -0
  255. package/dist/stores/replies-pages/index.js +4 -0
  256. package/dist/stores/replies-pages/index.js.map +1 -0
  257. package/dist/stores/replies-pages/replies-pages-store.d.ts +20 -0
  258. package/dist/stores/replies-pages/replies-pages-store.d.ts.map +1 -0
  259. package/dist/stores/replies-pages/replies-pages-store.js +270 -0
  260. package/dist/stores/replies-pages/replies-pages-store.js.map +1 -0
  261. package/dist/stores/replies-pages/utils.d.ts +3 -0
  262. package/dist/stores/replies-pages/utils.d.ts.map +1 -0
  263. package/dist/stores/replies-pages/utils.js +43 -0
  264. package/dist/stores/replies-pages/utils.js.map +1 -0
  265. package/dist/types.d.ts +638 -0
  266. package/dist/types.d.ts.map +1 -0
  267. package/dist/types.js +3 -0
  268. package/dist/types.js.map +1 -0
  269. package/package.json +160 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-generator.js","sourceRoot":"","sources":["../../../src/stores/accounts/account-generator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,MAAM,GAAG,GAAG,MAAM,CAAC,uCAAuC,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,qCAAqC,CAAC;AAEzE,0BAA0B;AAC1B,MAAM,cAAc,GAAmB;IACrC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CAAC,CAAA,CAAC;AAEF,MAAM,kCAAkC,GAAG,GAAS,EAAE;IACpD,MAAM,UAAU,GACd,MAAM,gBAAgB,CAAC,wBAAwB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACxE,MAAM,YAAY,GAAG,EAAE,CAAC;IACxB,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAoB,MAAM,gBAAgB,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACjF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,CAAA,EAAE,CAAC;QAC1B,OAAO,WAAW,aAAa,EAAE,CAAC;IACpC,CAAC;IACD,SAAS,CAAC,oCAAoC,CAAC,YAAY,CAAC,CAAC;IAE7D,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IAC9C,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,WAAW,GAAG,WAAW,aAAa,EAAE,CAAC;QAC/C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YACtC,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,aAAa,EAAE,CAAC;IAClB,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACvB,sBAAsB;IACtB,oBAAoB;CACrB,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import PkcJs from \"../../lib/pkc-js\";\nimport validator from \"../../lib/validator\";\nimport chain from \"../../lib/chain\";\nimport { v4 as uuid } from \"uuid\";\nimport accountsDatabase from \"./accounts-database\";\nimport { Accounts, AccountCommunity, ChainProviders } from \"../../types\";\nimport {\n getPkcClientOptions,\n normalizeAccountProtocolConfig,\n withProtocolAliases,\n} from \"../../lib/pkc-compat\";\nimport Logger from \"@pkcprotocol/pkc-logger\";\nconst log = Logger(\"bitsocial-react-hooks:accounts:stores\");\n\nexport const DEFAULT_ETH_RPC_URL = \"https://ethereum-rpc.publicnode.com\";\n\n// default chain providers\nconst chainProviders: ChainProviders = {\n eth: {\n // default should not use a url, but rather ethers' default provider\n urls: [DEFAULT_ETH_RPC_URL, \"viem\", \"ethers.js\"],\n chainId: 1,\n },\n matic: {\n urls: [\"https://polygon-rpc.com\"],\n chainId: 137,\n },\n};\n\n// force using these options or can cause bugs\nexport const overwritePkcOptions = {\n resolveAuthorNames: false,\n resolveAuthorAddresses: false,\n validatePages: false,\n};\n\nconst aliasProtocolOptions = (options: Record<string, any>) => ({\n ...options,\n resolveAuthorNames: options.resolveAuthorNames ?? options.resolveAuthorAddresses ?? false,\n resolveAuthorAddresses: options.resolveAuthorAddresses ?? options.resolveAuthorNames ?? false,\n});\n\nconst addMissingChainProviders = (options: Record<string, any>) => {\n const optionsWithChainProviders = { ...options };\n if (!optionsWithChainProviders.chainProviders) {\n optionsWithChainProviders.chainProviders = {};\n }\n for (const chainTicker in chainProviders) {\n if (!optionsWithChainProviders.chainProviders[chainTicker]) {\n optionsWithChainProviders.chainProviders[chainTicker] = chainProviders[chainTicker];\n }\n }\n return optionsWithChainProviders;\n};\n\nexport const getDefaultChainProviders = () => {\n // @ts-ignore\n const defaultWindowOptions = window.defaultPkcOptions;\n const windowChainProviders = defaultWindowOptions?.chainProviders\n ? JSON.parse(JSON.stringify(defaultWindowOptions.chainProviders))\n : undefined;\n return addMissingChainProviders({\n chainProviders: windowChainProviders,\n }).chainProviders as ChainProviders;\n};\n\n// default options aren't saved to database so they can be changed\nexport const getDefaultPkcOptions = () => {\n // default PKC options defined by the electron process\n // @ts-ignore\n const defaultWindowOptions = window.defaultPkcOptions;\n if (defaultWindowOptions) {\n // @ts-ignore\n const defaultPkcOptions: any = JSON.parse(\n JSON.stringify({ ...defaultWindowOptions, libp2pJsClientsOptions: undefined }),\n );\n delete defaultPkcOptions.chainProviders;\n delete defaultPkcOptions.nameResolversChainProviders;\n // @ts-ignore\n defaultPkcOptions.libp2pJsClientsOptions = defaultWindowOptions.libp2pJsClientsOptions; // libp2pJsClientsOptions is not always just json\n return aliasProtocolOptions({ ...defaultPkcOptions, ...overwritePkcOptions });\n }\n // default PKC options for web client\n return aliasProtocolOptions({\n ipfsGatewayUrls: [\n \"https://ipfsgateway.xyz\",\n \"https://gateway.plebpubsub.xyz\",\n \"https://gateway.forumindex.com\",\n ],\n kuboRpcClientsOptions: undefined,\n pubsubKuboRpcClientsOptions: [\n \"https://pubsubprovider.xyz/api/v0\",\n \"https://plebpubsub.xyz/api/v0\",\n \"https://rannithepleb.com/api/v0\",\n ],\n httpRoutersOptions: [\n \"https://routing.lol\",\n \"https://peers.pleb.bot\",\n \"https://peers.plebpubsub.xyz\",\n \"https://peers.forumindex.com\",\n ],\n ...overwritePkcOptions,\n });\n};\n\n// the gateway to use in <img src> for nft avatars\n// @ts-ignore\nconst defaultMediaIpfsGatewayUrl = window.defaultMediaIpfsGatewayUrl || \"https://ipfs.io\";\n\nconst generateDefaultAccount = async () => {\n const pkcOptions = getDefaultPkcOptions();\n const chainProviders = getDefaultChainProviders();\n const pkc = await PkcJs.PKC(\n getPkcClientOptions(\n {\n chainProviders,\n pkcOptions,\n },\n pkcOptions,\n ),\n );\n // handle errors or error events are uncaught\n // no need to log them because pkc-js already logs them\n pkc.on(\"error\", (error: any) =>\n log.error(\"uncaught pkc instance error, should never happen\", { error }),\n );\n\n const signer = await pkc.createSigner();\n const author = {\n address: signer.address,\n wallets: {\n eth: await chain.getEthWalletFromPkcPrivateKey(signer.privateKey, signer.address),\n },\n };\n\n const accountName = await getNextAvailableDefaultAccountName();\n\n // communities where the account has a role, like moderator, admin, owner, etc.\n const communities: { [communityAddress: string]: AccountCommunity } = {};\n\n const account = normalizeAccountProtocolConfig(\n withProtocolAliases(\n {\n id: uuid(),\n version: accountsDatabase.accountVersion,\n name: accountName,\n author,\n signer,\n chainProviders,\n pkcOptions,\n subscriptions: [],\n blockedAddresses: {},\n blockedCids: {},\n communities,\n mediaIpfsGatewayUrl: defaultMediaIpfsGatewayUrl,\n },\n pkc,\n pkcOptions,\n ),\n chainProviders,\n );\n return account;\n};\n\nconst getNextAvailableDefaultAccountName = async () => {\n const accountIds: string[] | null =\n await accountsDatabase.accountsMetadataDatabase.getItem(\"accountIds\");\n const accountNames = [];\n if (accountIds?.length) {\n const accounts: Accounts | null = await accountsDatabase.getAccounts(accountIds);\n for (const accountId of accountIds) {\n accountNames.push(accounts[accountId].name);\n }\n }\n let accountNumber = 1;\n if (!accountNames?.length) {\n return `Account ${accountNumber}`;\n }\n validator.validateAccountsDatabaseAccountNames(accountNames);\n\n const accountNamesSet = new Set(accountNames);\n while (true) {\n const accountName = `Account ${accountNumber}`;\n if (!accountNamesSet.has(accountName)) {\n return accountName;\n }\n accountNumber++;\n }\n};\n\nconst accountGenerator = {\n generateDefaultAccount,\n getDefaultPkcOptions,\n};\n\nexport default accountGenerator;\n"]}
@@ -0,0 +1,8 @@
1
+ import { Account, Comment, Community } from "../../types.js";
2
+ export declare const startUpdatingAccountCommentOnCommentUpdateEvents: (comment: Comment, account: Account, accountCommentIndex: number) => Promise<void>;
3
+ export declare const addCidToAccountComment: (comment: Comment) => Promise<void>;
4
+ export declare const ensureAccountEditsLoaded: (accountId: string) => Promise<void>;
5
+ export declare const resetLazyAccountHistoryLoaders: () => void;
6
+ export declare const markNotificationsAsRead: (account: Account) => Promise<void>;
7
+ export declare const addCommunityRoleToAccountsCommunities: (community: Community) => Promise<void>;
8
+ //# sourceMappingURL=accounts-actions-internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts-actions-internal.d.ts","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions-internal.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,OAAO,EAEP,OAAO,EAGP,SAAS,EACV,MAAM,aAAa,CAAC;AAmFrB,eAAO,MAAM,gDAAgD,GAC3D,SAAS,OAAO,EAChB,SAAS,OAAO,EAChB,qBAAqB,MAAM,kBAgM5B,CAAC;AAIF,eAAO,MAAM,sBAAsB,GAAU,SAAS,OAAO,kBAkE5D,CAAC;AAwCF,eAAO,MAAM,wBAAwB,GAAU,WAAW,MAAM,kBA8B/D,CAAC;AAEF,eAAO,MAAM,8BAA8B,YAE1C,CAAC;AAGF,eAAO,MAAM,uBAAuB,GAAU,SAAS,OAAO,kBAyC7D,CAAC;AAIF,eAAO,MAAM,qCAAqC,GAAU,WAAW,SAAS,kBAqE/E,CAAC"}
@@ -0,0 +1,403 @@
1
+ // internal accounts actions that are not called by the user
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import accountsStore, { listeners } from "./accounts-store.js";
12
+ import accountsDatabase from "./accounts-database.js";
13
+ import Logger from "@pkcprotocol/pkc-logger";
14
+ import assert from "assert";
15
+ import isEqual from "lodash.isequal";
16
+ const log = Logger("bitsocial-react-hooks:accounts:stores");
17
+ import utils from "../../lib/utils/index.js";
18
+ import { backfillPublicationCommunityAddress, getCommentCommunityAddress, normalizePublicationOptionsForPkc, normalizePublicationOptionsForStore, } from "../../lib/pkc-compat.js";
19
+ import { addShortAddressesToAccountComment, getAccountsCommentsIndexes, sanitizeStoredAccountComment, } from "./utils.js";
20
+ const accountEditsLoadPromises = new Map();
21
+ const doesStoredAccountEditMatch = (storedAccountEdit, targetStoredAccountEdit) => (storedAccountEdit === null || storedAccountEdit === void 0 ? void 0 : storedAccountEdit.clientId) && (targetStoredAccountEdit === null || targetStoredAccountEdit === void 0 ? void 0 : targetStoredAccountEdit.clientId)
22
+ ? storedAccountEdit.clientId === targetStoredAccountEdit.clientId
23
+ : isEqual(storedAccountEdit, targetStoredAccountEdit);
24
+ const mergeLoadedAccountEdits = (loadedAccountEdits, currentAccountEdits) => {
25
+ const mergedAccountEdits = Object.assign({}, (loadedAccountEdits || {}));
26
+ const editTargets = new Set([
27
+ ...Object.keys(loadedAccountEdits || {}),
28
+ ...Object.keys(currentAccountEdits || {}),
29
+ ]);
30
+ for (const editTarget of editTargets) {
31
+ const mergedTargetEdits = [...((loadedAccountEdits === null || loadedAccountEdits === void 0 ? void 0 : loadedAccountEdits[editTarget]) || [])];
32
+ for (const currentAccountEdit of (currentAccountEdits === null || currentAccountEdits === void 0 ? void 0 : currentAccountEdits[editTarget]) || []) {
33
+ const alreadyLoaded = mergedTargetEdits.some((loadedAccountEdit) => doesStoredAccountEditMatch(loadedAccountEdit, currentAccountEdit));
34
+ if (!alreadyLoaded) {
35
+ mergedTargetEdits.push(currentAccountEdit);
36
+ }
37
+ }
38
+ if (mergedTargetEdits.length > 0) {
39
+ mergedAccountEdits[editTarget] = mergedTargetEdits.sort((a, b) => ((a === null || a === void 0 ? void 0 : a.timestamp) || 0) - ((b === null || b === void 0 ? void 0 : b.timestamp) || 0));
40
+ }
41
+ }
42
+ return mergedAccountEdits;
43
+ };
44
+ const backfillLiveCommentCommunityAddress = (comment, communityAddress) => {
45
+ if (!comment || comment.communityAddress || !communityAddress) {
46
+ return;
47
+ }
48
+ try {
49
+ Object.defineProperty(comment, "communityAddress", {
50
+ value: communityAddress,
51
+ writable: true,
52
+ configurable: true,
53
+ enumerable: false,
54
+ });
55
+ }
56
+ catch (error) {
57
+ try {
58
+ comment.communityAddress = communityAddress;
59
+ }
60
+ catch (assignmentError) {
61
+ log.trace("backfillLiveCommentCommunityAddress failed", {
62
+ cid: comment.cid,
63
+ error,
64
+ assignmentError,
65
+ });
66
+ }
67
+ }
68
+ };
69
+ // TODO: we currently subscribe to updates for every single comment
70
+ // in the user's account history. This probably does not scale, we
71
+ // need to eventually schedule and queue older comments to look
72
+ // for updates at a lower priority.
73
+ export const startUpdatingAccountCommentOnCommentUpdateEvents = (comment, account, accountCommentIndex) => __awaiter(void 0, void 0, void 0, function* () {
74
+ var _a;
75
+ assert(typeof accountCommentIndex === "number", `startUpdatingAccountCommentOnCommentUpdateEvents accountCommentIndex '${accountCommentIndex}' not a number`);
76
+ assert(typeof (account === null || account === void 0 ? void 0 : account.id) === "string", `startUpdatingAccountCommentOnCommentUpdateEvents account '${account}' account.id '${account === null || account === void 0 ? void 0 : account.id}' not a string`);
77
+ const commentArgument = comment;
78
+ // comment doesn't have a cid yet, so can't receive updates
79
+ if (!comment.cid) {
80
+ return;
81
+ }
82
+ // account comment already updating
83
+ if (accountsStore.getState().accountsCommentsUpdating[comment.cid]) {
84
+ return;
85
+ }
86
+ accountsStore.setState(({ accountsCommentsUpdating }) => ({
87
+ accountsCommentsUpdating: Object.assign(Object.assign({}, accountsCommentsUpdating), { [comment.cid]: true }),
88
+ }));
89
+ // comment is not a `Comment` instance
90
+ if (!comment.on) {
91
+ comment = backfillPublicationCommunityAddress(yield account.pkc.createComment(normalizePublicationOptionsForPkc(account.pkc, comment)), comment);
92
+ }
93
+ const initialStoredComment = (_a = accountsStore.getState().accountsComments[account.id]) === null || _a === void 0 ? void 0 : _a[accountCommentIndex];
94
+ backfillLiveCommentCommunityAddress(comment, getCommentCommunityAddress(commentArgument) ||
95
+ (initialStoredComment === null || initialStoredComment === void 0 ? void 0 : initialStoredComment.communityAddress) ||
96
+ (initialStoredComment === null || initialStoredComment === void 0 ? void 0 : initialStoredComment.communityAddress));
97
+ comment.on("update", (updatedComment) => __awaiter(void 0, void 0, void 0, function* () {
98
+ var _a, _b;
99
+ const mapping = accountsStore.getState().commentCidsToAccountsComments[updatedComment.cid || ""];
100
+ if (!mapping || mapping.accountId !== account.id) {
101
+ accountsStore.setState(({ accountsCommentsUpdating }) => {
102
+ const next = Object.assign({}, accountsCommentsUpdating);
103
+ delete next[updatedComment.cid || ""];
104
+ return { accountsCommentsUpdating: next };
105
+ });
106
+ try {
107
+ if (typeof comment.removeAllListeners === "function")
108
+ comment.removeAllListeners();
109
+ if (typeof comment.stop === "function")
110
+ comment.stop();
111
+ }
112
+ catch (e) {
113
+ log.trace("startUpdatingAccountCommentOnCommentUpdateEvents stop/removeAllListeners", {
114
+ cid: updatedComment.cid,
115
+ error: e,
116
+ });
117
+ }
118
+ return;
119
+ }
120
+ const currentIndex = mapping.accountCommentIndex;
121
+ // merge should not be needed if pkc-js is implemented properly, but no harm in fixing potential errors
122
+ const storedComment = (_a = accountsStore.getState().accountsComments[account.id]) === null || _a === void 0 ? void 0 : _a[currentIndex];
123
+ updatedComment = utils.merge(commentArgument, comment, updatedComment);
124
+ updatedComment.communityAddress =
125
+ getCommentCommunityAddress(updatedComment) ||
126
+ getCommentCommunityAddress(comment) ||
127
+ getCommentCommunityAddress(commentArgument) ||
128
+ (storedComment === null || storedComment === void 0 ? void 0 : storedComment.communityAddress) ||
129
+ (storedComment === null || storedComment === void 0 ? void 0 : storedComment.communityAddress);
130
+ const normalizedUpdatedComment = addShortAddressesToAccountComment(normalizePublicationOptionsForStore(updatedComment));
131
+ const storedUpdatedComment = sanitizeStoredAccountComment(normalizedUpdatedComment);
132
+ yield accountsDatabase.addAccountComment(account.id, storedUpdatedComment, currentIndex);
133
+ log("startUpdatingAccountCommentOnCommentUpdateEvents comment update", {
134
+ commentCid: comment.cid,
135
+ accountCommentIndex: currentIndex,
136
+ updatedComment: storedUpdatedComment,
137
+ account,
138
+ });
139
+ accountsStore.setState(({ accountsComments, accountsCommentsIndexes }) => {
140
+ // account no longer exists
141
+ if (!accountsComments[account.id]) {
142
+ log.error(`startUpdatingAccountCommentOnCommentUpdateEvents comment.on('update') invalid accountsStore.accountsComments['${account.id}'] '${accountsComments[account.id]}', account may have been deleted`);
143
+ return {};
144
+ }
145
+ const updatedAccountComments = [...accountsComments[account.id]];
146
+ const previousComment = updatedAccountComments[currentIndex];
147
+ const updatedAccountComment = utils.clone(Object.assign(Object.assign({}, storedUpdatedComment), { index: currentIndex, accountId: account.id }));
148
+ updatedAccountComments[currentIndex] = updatedAccountComment;
149
+ const nextAccountsComments = Object.assign(Object.assign({}, accountsComments), { [account.id]: updatedAccountComments });
150
+ return {
151
+ accountsComments: nextAccountsComments,
152
+ accountsCommentsIndexes: Object.assign(Object.assign({}, accountsCommentsIndexes), { [account.id]: getAccountsCommentsIndexes({
153
+ [account.id]: updatedAccountComments,
154
+ })[account.id] }),
155
+ };
156
+ });
157
+ // update AccountCommentsReplies with new replies if has any new replies
158
+ const replyPageArray = Object.values(((_b = normalizedUpdatedComment.replies) === null || _b === void 0 ? void 0 : _b.pages) || {});
159
+ const getReplyCount = (replyPage) => { var _a, _b; return (_b = (_a = replyPage === null || replyPage === void 0 ? void 0 : replyPage.comments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; };
160
+ const replyCount = replyPageArray.length > 0
161
+ ? replyPageArray.map(getReplyCount).reduce((prev, curr) => prev + curr)
162
+ : 0;
163
+ const hasReplies = replyCount > 0;
164
+ const repliesAreValid = yield utils.repliesAreValid(normalizedUpdatedComment, { validateReplies: false, blockCommunity: true }, account.pkc);
165
+ if (hasReplies && repliesAreValid) {
166
+ accountsStore.setState(({ accountsCommentsReplies }) => {
167
+ var _a, _b;
168
+ // account no longer exists
169
+ if (!accountsCommentsReplies[account.id]) {
170
+ log.error(`startUpdatingAccountCommentOnCommentUpdateEvents comment.on('update') invalid accountsStore.accountsCommentsReplies['${account.id}'] '${accountsCommentsReplies[account.id]}', account may have been deleted`);
171
+ return {};
172
+ }
173
+ // check which replies are read or not
174
+ const updatedAccountCommentsReplies = {};
175
+ for (const replyPage of replyPageArray) {
176
+ for (const reply of (replyPage === null || replyPage === void 0 ? void 0 : replyPage.comments) || []) {
177
+ const normalizedReply = normalizePublicationOptionsForStore(reply);
178
+ normalizedReply.communityAddress =
179
+ getCommentCommunityAddress(normalizedReply) ||
180
+ normalizedUpdatedComment.communityAddress ||
181
+ storedUpdatedComment.communityAddress;
182
+ const markedAsRead = ((_b = (_a = accountsCommentsReplies[account.id]) === null || _a === void 0 ? void 0 : _a[reply.cid]) === null || _b === void 0 ? void 0 : _b.markedAsRead) === true
183
+ ? true
184
+ : false;
185
+ updatedAccountCommentsReplies[normalizedReply.cid] = Object.assign(Object.assign({}, normalizedReply), { markedAsRead });
186
+ }
187
+ }
188
+ // add all to database
189
+ const promises = [];
190
+ for (const replyCid in updatedAccountCommentsReplies) {
191
+ promises.push(accountsDatabase.addAccountCommentReply(account.id, updatedAccountCommentsReplies[replyCid]));
192
+ }
193
+ Promise.all(promises);
194
+ // set new store
195
+ const newAccountCommentsReplies = Object.assign(Object.assign({}, accountsCommentsReplies[account.id]), updatedAccountCommentsReplies);
196
+ return {
197
+ accountsCommentsReplies: Object.assign(Object.assign({}, accountsCommentsReplies), { [account.id]: newAccountCommentsReplies }),
198
+ };
199
+ });
200
+ }
201
+ }));
202
+ listeners.push(comment);
203
+ comment.update().catch((error) => log.trace("comment.update error", { comment, error }));
204
+ });
205
+ // internal accounts action: the comment CID is not known at the time of publishing, so every time
206
+ // we fetch a new comment, check if its our own, and attempt to add the CID
207
+ export const addCidToAccountComment = (comment) => __awaiter(void 0, void 0, void 0, function* () {
208
+ var _a;
209
+ const { accounts } = accountsStore.getState();
210
+ assert(accounts, `can't use accountsStore.accountActions before initialized`);
211
+ const accountCommentsWithoutCids = getAccountsCommentsWithoutCids()[(_a = comment === null || comment === void 0 ? void 0 : comment.author) === null || _a === void 0 ? void 0 : _a.address];
212
+ if (!accountCommentsWithoutCids) {
213
+ return;
214
+ }
215
+ for (const accountComment of accountCommentsWithoutCids) {
216
+ // if author address and timestamp is the same, we assume it's the right comment
217
+ if (accountComment.timestamp && accountComment.timestamp === comment.timestamp) {
218
+ const commentWithCid = utils.merge(accountComment, comment);
219
+ yield accountsDatabase.addAccountComment(accountComment.accountId, commentWithCid, accountComment.index);
220
+ log("accountsActions.addCidToAccountComment", {
221
+ commentCid: comment.cid,
222
+ accountCommentIndex: accountComment.index,
223
+ accountComment: commentWithCid,
224
+ });
225
+ accountsStore.setState(({ accountsComments, accountsCommentsIndexes, commentCidsToAccountsComments }) => {
226
+ const updatedAccountComments = [...accountsComments[accountComment.accountId]];
227
+ updatedAccountComments[accountComment.index] = commentWithCid;
228
+ const newAccountsComments = Object.assign(Object.assign({}, accountsComments), { [accountComment.accountId]: updatedAccountComments });
229
+ return {
230
+ accountsComments: newAccountsComments,
231
+ accountsCommentsIndexes: Object.assign(Object.assign({}, accountsCommentsIndexes), { [accountComment.accountId]: getAccountsCommentsIndexes({
232
+ [accountComment.accountId]: updatedAccountComments,
233
+ })[accountComment.accountId] }),
234
+ commentCidsToAccountsComments: Object.assign(Object.assign({}, commentCidsToAccountsComments), { [comment.cid]: {
235
+ accountId: accountComment.accountId,
236
+ accountCommentIndex: accountComment.index,
237
+ } }),
238
+ };
239
+ });
240
+ startUpdatingAccountCommentOnCommentUpdateEvents(comment, accounts[accountComment.accountId], accountComment.index).catch((error) => log.error("accountsActions.addCidToAccountComment startUpdatingAccountCommentOnCommentUpdateEvents error", {
241
+ comment,
242
+ account: accounts[accountComment.accountId],
243
+ accountCommentIndex: accountComment.index,
244
+ error,
245
+ }));
246
+ break;
247
+ }
248
+ }
249
+ });
250
+ // cache the last result of this function
251
+ let previousAccountsCommentsJson;
252
+ let previousAccountsCommentsWithoutCids = {};
253
+ const getAccountsCommentsWithoutCids = () => {
254
+ var _a;
255
+ const { accounts, accountsComments } = accountsStore.getState();
256
+ // same accounts comments as last time, return cached value
257
+ const accountsCommentsJson = JSON.stringify(accountsComments);
258
+ if (accountsCommentsJson === previousAccountsCommentsJson) {
259
+ return previousAccountsCommentsWithoutCids;
260
+ }
261
+ previousAccountsCommentsJson = accountsCommentsJson;
262
+ const accountsCommentsWithoutCids = {};
263
+ if (!accounts || !accountsComments) {
264
+ return accountsCommentsWithoutCids;
265
+ }
266
+ for (const accountId in accountsComments) {
267
+ const accountComments = accountsComments[accountId];
268
+ const account = accounts[accountId];
269
+ for (const accountCommentIndex in accountComments) {
270
+ const accountComment = accountComments[accountCommentIndex];
271
+ if (!accountComment.cid) {
272
+ const authorAddress = (_a = account === null || account === void 0 ? void 0 : account.author) === null || _a === void 0 ? void 0 : _a.address;
273
+ if (!authorAddress) {
274
+ continue;
275
+ }
276
+ if (!accountsCommentsWithoutCids[authorAddress]) {
277
+ accountsCommentsWithoutCids[authorAddress] = [];
278
+ }
279
+ accountsCommentsWithoutCids[authorAddress].push(accountComment);
280
+ }
281
+ }
282
+ }
283
+ previousAccountsCommentsWithoutCids = accountsCommentsWithoutCids;
284
+ return accountsCommentsWithoutCids;
285
+ };
286
+ export const ensureAccountEditsLoaded = (accountId) => __awaiter(void 0, void 0, void 0, function* () {
287
+ assert(accountId && typeof accountId === "string", `ensureAccountEditsLoaded invalid '${accountId}'`);
288
+ if (accountsStore.getState().accountsEditsLoaded[accountId]) {
289
+ return;
290
+ }
291
+ const existingPromise = accountEditsLoadPromises.get(accountId);
292
+ if (existingPromise) {
293
+ return existingPromise;
294
+ }
295
+ const loadPromise = accountsDatabase
296
+ .getAccountEdits(accountId)
297
+ .then((loadedAccountEdits) => {
298
+ accountsStore.setState(({ accountsEdits, accountsEditsLoaded }) => ({
299
+ accountsEdits: Object.assign(Object.assign({}, accountsEdits), { [accountId]: mergeLoadedAccountEdits(loadedAccountEdits, accountsEdits[accountId]) }),
300
+ accountsEditsLoaded: Object.assign(Object.assign({}, accountsEditsLoaded), { [accountId]: true }),
301
+ }));
302
+ })
303
+ .finally(() => {
304
+ accountEditsLoadPromises.delete(accountId);
305
+ });
306
+ accountEditsLoadPromises.set(accountId, loadPromise);
307
+ return loadPromise;
308
+ });
309
+ export const resetLazyAccountHistoryLoaders = () => {
310
+ accountEditsLoadPromises.clear();
311
+ };
312
+ // internal accounts action: mark an account's notifications as read
313
+ export const markNotificationsAsRead = (account) => __awaiter(void 0, void 0, void 0, function* () {
314
+ const { accountsCommentsReplies } = accountsStore.getState();
315
+ assert(typeof (account === null || account === void 0 ? void 0 : account.id) === "string", `accountsStore.markNotificationsAsRead invalid account argument '${account}'`);
316
+ // find all unread replies
317
+ const repliesToMarkAsRead = {};
318
+ for (const replyCid in accountsCommentsReplies[account.id]) {
319
+ if (!accountsCommentsReplies[account.id][replyCid].markedAsRead) {
320
+ repliesToMarkAsRead[replyCid] = Object.assign(Object.assign({}, accountsCommentsReplies[account.id][replyCid]), { markedAsRead: true });
321
+ }
322
+ }
323
+ // add all to database
324
+ const promises = [];
325
+ for (const replyCid in repliesToMarkAsRead) {
326
+ promises.push(accountsDatabase.addAccountCommentReply(account.id, repliesToMarkAsRead[replyCid]));
327
+ }
328
+ yield Promise.all(promises);
329
+ // add all to react store
330
+ log("accountsActions.markNotificationsAsRead", { account, repliesToMarkAsRead });
331
+ accountsStore.setState(({ accountsCommentsReplies }) => {
332
+ const updatedAccountCommentsReplies = Object.assign(Object.assign({}, accountsCommentsReplies[account.id]), repliesToMarkAsRead);
333
+ return {
334
+ accountsCommentsReplies: Object.assign(Object.assign({}, accountsCommentsReplies), { [account.id]: updatedAccountCommentsReplies }),
335
+ };
336
+ });
337
+ });
338
+ // internal accounts action: if a community has a role with an account's address
339
+ // add it to the account.communities database
340
+ export const addCommunityRoleToAccountsCommunities = (community) => __awaiter(void 0, void 0, void 0, function* () {
341
+ if (!community) {
342
+ return;
343
+ }
344
+ const { accounts } = accountsStore.getState();
345
+ assert(accounts, `can't use accountsStore.accountActions before initialized`);
346
+ // find community roles to add and remove
347
+ const getRole = (community, authorAddress) => community.roles && community.roles[authorAddress];
348
+ const getChange = (accounts, community) => {
349
+ var _a;
350
+ const toUpsert = [];
351
+ const toRemove = [];
352
+ for (const accountId in accounts) {
353
+ const account = accounts[accountId];
354
+ const role = getRole(community, account.author.address);
355
+ if (!role) {
356
+ if (account.communities[community.address]) {
357
+ toRemove.push(accountId);
358
+ }
359
+ }
360
+ else {
361
+ const currentRole = (_a = account.communities[community.address]) === null || _a === void 0 ? void 0 : _a.role;
362
+ if (!currentRole || currentRole.role !== role.role) {
363
+ toUpsert.push(accountId);
364
+ }
365
+ }
366
+ }
367
+ return {
368
+ toUpsert,
369
+ toRemove,
370
+ hasChange: toUpsert.length !== 0 || toRemove.length !== 0,
371
+ };
372
+ };
373
+ const { hasChange } = getChange(accounts, community);
374
+ if (!hasChange) {
375
+ return;
376
+ }
377
+ accountsStore.setState(({ accounts }) => {
378
+ const { toUpsert, toRemove } = getChange(accounts, community);
379
+ const nextAccounts = Object.assign({}, accounts);
380
+ // edit databases and build next accounts (toUpsert implies role exists from getChange)
381
+ for (const accountId of toUpsert) {
382
+ const account = Object.assign({}, nextAccounts[accountId]);
383
+ const role = community.roles[account.author.address];
384
+ account.communities = Object.assign(Object.assign({}, account.communities), { [community.address]: Object.assign(Object.assign({}, account.communities[community.address]), { role }) });
385
+ nextAccounts[accountId] = account;
386
+ accountsDatabase.addAccount(account);
387
+ }
388
+ for (const accountId of toRemove) {
389
+ const account = Object.assign({}, nextAccounts[accountId]);
390
+ account.communities = Object.assign({}, account.communities);
391
+ delete account.communities[community.address];
392
+ nextAccounts[accountId] = account;
393
+ accountsDatabase.addAccount(account);
394
+ }
395
+ log("accountsActions.addCommunityRoleToAccountsCommunities", {
396
+ community,
397
+ toUpsert,
398
+ toRemove,
399
+ });
400
+ return { accounts: nextAccounts };
401
+ });
402
+ });
403
+ //# sourceMappingURL=accounts-actions-internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts-actions-internal.js","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions-internal.ts"],"names":[],"mappings":"AAAA,4DAA4D;;;;;;;;;;AAE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AAE;QACtC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9D,MAAM,YAAY,qBAAQ,QAAQ,CAAE,CAAC;QAErC,uFAAuF;QACvF,KAAK,MAAM,SAAS,IAAI,QAAQ,EAAE,CAAC;YACjC,MAAM,OAAO,qBAAQ,YAAY,CAAC,SAAS,CAAC,CAAE,CAAC;YAC/C,MAAM,IAAI,GAAG,SAAS,CAAC,KAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACtD,OAAO,CAAC,WAAW,mCACd,OAAO,CAAC,WAAW,KACtB,CAAC,SAAS,CAAC,OAAO,CAAC,kCAAO,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,KAAE,IAAI,MACvE,CAAC;YACF,YAAY,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;YAClC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QACD,KAAK,MAAM,SAAS,IAAI,QAAQ,EAAE,CAAC;YACjC,MAAM,OAAO,qBAAQ,YAAY,CAAC,SAAS,CAAC,CAAE,CAAC;YAC/C,OAAO,CAAC,WAAW,qBAAQ,OAAO,CAAC,WAAW,CAAE,CAAC;YACjD,OAAO,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC9C,YAAY,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;YAClC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QAED,GAAG,CAAC,uDAAuD,EAAE;YAC3D,SAAS;YACT,QAAQ;YACR,QAAQ;SACT,CAAC,CAAC;QACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC","sourcesContent":["// internal accounts actions that are not called by the user\n\nimport accountsStore, { listeners } from \"./accounts-store\";\nimport accountsDatabase from \"./accounts-database\";\nimport Logger from \"@pkcprotocol/pkc-logger\";\nimport assert from \"assert\";\nimport isEqual from \"lodash.isequal\";\nconst log = Logger(\"bitsocial-react-hooks:accounts:stores\");\nimport {\n Account,\n AccountCommentReply,\n Comment,\n AccountsComments,\n AccountCommentsReplies,\n Community,\n} from \"../../types\";\nimport utils from \"../../lib/utils\";\nimport {\n backfillPublicationCommunityAddress,\n getCommentCommunityAddress,\n normalizePublicationOptionsForPkc,\n normalizePublicationOptionsForStore,\n} from \"../../lib/pkc-compat\";\nimport {\n addShortAddressesToAccountComment,\n getAccountsCommentsIndexes,\n sanitizeStoredAccountComment,\n} from \"./utils\";\n\nconst accountEditsLoadPromises = new Map<string, Promise<void>>();\n\nconst doesStoredAccountEditMatch = (storedAccountEdit: any, targetStoredAccountEdit: any) =>\n storedAccountEdit?.clientId && targetStoredAccountEdit?.clientId\n ? storedAccountEdit.clientId === targetStoredAccountEdit.clientId\n : isEqual(storedAccountEdit, targetStoredAccountEdit);\n\nconst mergeLoadedAccountEdits = (\n loadedAccountEdits: Record<string, any[]> | undefined,\n currentAccountEdits: Record<string, any[]> | undefined,\n) => {\n const mergedAccountEdits: Record<string, any[]> = { ...(loadedAccountEdits || {}) };\n const editTargets = new Set([\n ...Object.keys(loadedAccountEdits || {}),\n ...Object.keys(currentAccountEdits || {}),\n ]);\n\n for (const editTarget of editTargets) {\n const mergedTargetEdits = [...(loadedAccountEdits?.[editTarget] || [])];\n for (const currentAccountEdit of currentAccountEdits?.[editTarget] || []) {\n const alreadyLoaded = mergedTargetEdits.some((loadedAccountEdit) =>\n doesStoredAccountEditMatch(loadedAccountEdit, currentAccountEdit),\n );\n if (!alreadyLoaded) {\n mergedTargetEdits.push(currentAccountEdit);\n }\n }\n if (mergedTargetEdits.length > 0) {\n mergedAccountEdits[editTarget] = mergedTargetEdits.sort(\n (a, b) => (a?.timestamp || 0) - (b?.timestamp || 0),\n );\n }\n }\n\n return mergedAccountEdits;\n};\n\nconst backfillLiveCommentCommunityAddress = (\n comment: Comment | undefined,\n communityAddress: string | undefined,\n) => {\n if (!comment || comment.communityAddress || !communityAddress) {\n return;\n }\n\n try {\n Object.defineProperty(comment, \"communityAddress\", {\n value: communityAddress,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n } catch (error) {\n try {\n comment.communityAddress = communityAddress;\n } catch (assignmentError) {\n log.trace(\"backfillLiveCommentCommunityAddress failed\", {\n cid: comment.cid,\n error,\n assignmentError,\n });\n }\n }\n};\n\n// TODO: we currently subscribe to updates for every single comment\n// in the user's account history. This probably does not scale, we\n// need to eventually schedule and queue older comments to look\n// for updates at a lower priority.\nexport const startUpdatingAccountCommentOnCommentUpdateEvents = async (\n comment: Comment,\n account: Account,\n accountCommentIndex: number,\n) => {\n assert(\n typeof accountCommentIndex === \"number\",\n `startUpdatingAccountCommentOnCommentUpdateEvents accountCommentIndex '${accountCommentIndex}' not a number`,\n );\n assert(\n typeof account?.id === \"string\",\n `startUpdatingAccountCommentOnCommentUpdateEvents account '${account}' account.id '${account?.id}' not a string`,\n );\n const commentArgument = comment;\n\n // comment doesn't have a cid yet, so can't receive updates\n if (!comment.cid) {\n return;\n }\n\n // account comment already updating\n if (accountsStore.getState().accountsCommentsUpdating[comment.cid]) {\n return;\n }\n accountsStore.setState(({ accountsCommentsUpdating }) => ({\n accountsCommentsUpdating: { ...accountsCommentsUpdating, [comment.cid]: true },\n }));\n\n // comment is not a `Comment` instance\n if (!comment.on) {\n comment = backfillPublicationCommunityAddress(\n await account.pkc.createComment(normalizePublicationOptionsForPkc(account.pkc, comment)),\n comment,\n );\n }\n\n const initialStoredComment =\n accountsStore.getState().accountsComments[account.id]?.[accountCommentIndex];\n backfillLiveCommentCommunityAddress(\n comment,\n getCommentCommunityAddress(commentArgument) ||\n initialStoredComment?.communityAddress ||\n initialStoredComment?.communityAddress,\n );\n\n comment.on(\"update\", async (updatedComment: Comment) => {\n const mapping =\n accountsStore.getState().commentCidsToAccountsComments[updatedComment.cid || \"\"];\n if (!mapping || mapping.accountId !== account.id) {\n accountsStore.setState(({ accountsCommentsUpdating }) => {\n const next = { ...accountsCommentsUpdating };\n delete next[updatedComment.cid || \"\"];\n return { accountsCommentsUpdating: next };\n });\n try {\n if (typeof comment.removeAllListeners === \"function\") comment.removeAllListeners();\n if (typeof (comment as any).stop === \"function\") (comment as any).stop();\n } catch (e) {\n log.trace(\"startUpdatingAccountCommentOnCommentUpdateEvents stop/removeAllListeners\", {\n cid: updatedComment.cid,\n error: e,\n });\n }\n return;\n }\n const currentIndex = mapping.accountCommentIndex;\n\n // merge should not be needed if pkc-js is implemented properly, but no harm in fixing potential errors\n const storedComment = accountsStore.getState().accountsComments[account.id]?.[currentIndex];\n updatedComment = utils.merge(commentArgument, comment, updatedComment);\n updatedComment.communityAddress =\n getCommentCommunityAddress(updatedComment) ||\n getCommentCommunityAddress(comment) ||\n getCommentCommunityAddress(commentArgument) ||\n storedComment?.communityAddress ||\n storedComment?.communityAddress;\n const normalizedUpdatedComment = addShortAddressesToAccountComment(\n normalizePublicationOptionsForStore(updatedComment) as Comment,\n ) as Comment;\n const storedUpdatedComment = sanitizeStoredAccountComment(normalizedUpdatedComment) as Comment;\n await accountsDatabase.addAccountComment(account.id, storedUpdatedComment, currentIndex);\n log(\"startUpdatingAccountCommentOnCommentUpdateEvents comment update\", {\n commentCid: comment.cid,\n accountCommentIndex: currentIndex,\n updatedComment: storedUpdatedComment,\n account,\n });\n accountsStore.setState(({ accountsComments, accountsCommentsIndexes }) => {\n // account no longer exists\n if (!accountsComments[account.id]) {\n log.error(\n `startUpdatingAccountCommentOnCommentUpdateEvents comment.on('update') invalid accountsStore.accountsComments['${account.id}'] '${\n accountsComments[account.id]\n }', account may have been deleted`,\n );\n return {};\n }\n\n const updatedAccountComments = [...accountsComments[account.id]];\n const previousComment = updatedAccountComments[currentIndex];\n const updatedAccountComment = utils.clone({\n ...storedUpdatedComment,\n index: currentIndex,\n accountId: account.id,\n });\n updatedAccountComments[currentIndex] = updatedAccountComment;\n const nextAccountsComments = {\n ...accountsComments,\n [account.id]: updatedAccountComments,\n };\n return {\n accountsComments: nextAccountsComments,\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [account.id]: getAccountsCommentsIndexes({\n [account.id]: updatedAccountComments,\n } as AccountsComments)[account.id],\n },\n };\n });\n\n // update AccountCommentsReplies with new replies if has any new replies\n const replyPageArray: any[] = Object.values(normalizedUpdatedComment.replies?.pages || {});\n const getReplyCount = (replyPage: any) => replyPage?.comments?.length ?? 0;\n const replyCount =\n replyPageArray.length > 0\n ? replyPageArray.map(getReplyCount).reduce((prev, curr) => prev + curr)\n : 0;\n const hasReplies = replyCount > 0;\n const repliesAreValid = await utils.repliesAreValid(\n normalizedUpdatedComment,\n { validateReplies: false, blockCommunity: true },\n account.pkc,\n );\n\n if (hasReplies && repliesAreValid) {\n accountsStore.setState(({ accountsCommentsReplies }) => {\n // account no longer exists\n if (!accountsCommentsReplies[account.id]) {\n log.error(\n `startUpdatingAccountCommentOnCommentUpdateEvents comment.on('update') invalid accountsStore.accountsCommentsReplies['${account.id}'] '${\n accountsCommentsReplies[account.id]\n }', account may have been deleted`,\n );\n return {};\n }\n\n // check which replies are read or not\n const updatedAccountCommentsReplies: { [replyCid: string]: AccountCommentReply } = {};\n for (const replyPage of replyPageArray) {\n for (const reply of replyPage?.comments || []) {\n const normalizedReply = normalizePublicationOptionsForStore(reply) as Comment;\n normalizedReply.communityAddress =\n getCommentCommunityAddress(normalizedReply) ||\n normalizedUpdatedComment.communityAddress ||\n storedUpdatedComment.communityAddress;\n const markedAsRead =\n accountsCommentsReplies[account.id]?.[reply.cid]?.markedAsRead === true\n ? true\n : false;\n updatedAccountCommentsReplies[normalizedReply.cid] = {\n ...normalizedReply,\n markedAsRead,\n };\n }\n }\n\n // add all to database\n const promises = [];\n for (const replyCid in updatedAccountCommentsReplies) {\n promises.push(\n accountsDatabase.addAccountCommentReply(\n account.id,\n updatedAccountCommentsReplies[replyCid],\n ),\n );\n }\n Promise.all(promises);\n\n // set new store\n const newAccountCommentsReplies = {\n ...accountsCommentsReplies[account.id],\n ...updatedAccountCommentsReplies,\n };\n return {\n accountsCommentsReplies: {\n ...accountsCommentsReplies,\n [account.id]: newAccountCommentsReplies,\n },\n };\n });\n }\n });\n listeners.push(comment);\n comment.update().catch((error: unknown) => log.trace(\"comment.update error\", { comment, error }));\n};\n\n// internal accounts action: the comment CID is not known at the time of publishing, so every time\n// we fetch a new comment, check if its our own, and attempt to add the CID\nexport const addCidToAccountComment = async (comment: Comment) => {\n const { accounts } = accountsStore.getState();\n assert(accounts, `can't use accountsStore.accountActions before initialized`);\n const accountCommentsWithoutCids = getAccountsCommentsWithoutCids()[comment?.author?.address];\n if (!accountCommentsWithoutCids) {\n return;\n }\n for (const accountComment of accountCommentsWithoutCids) {\n // if author address and timestamp is the same, we assume it's the right comment\n if (accountComment.timestamp && accountComment.timestamp === comment.timestamp) {\n const commentWithCid = utils.merge(accountComment, comment);\n await accountsDatabase.addAccountComment(\n accountComment.accountId,\n commentWithCid,\n accountComment.index,\n );\n log(\"accountsActions.addCidToAccountComment\", {\n commentCid: comment.cid,\n accountCommentIndex: accountComment.index,\n accountComment: commentWithCid,\n });\n accountsStore.setState(\n ({ accountsComments, accountsCommentsIndexes, commentCidsToAccountsComments }) => {\n const updatedAccountComments = [...accountsComments[accountComment.accountId]];\n updatedAccountComments[accountComment.index] = commentWithCid;\n const newAccountsComments = {\n ...accountsComments,\n [accountComment.accountId]: updatedAccountComments,\n };\n return {\n accountsComments: newAccountsComments,\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [accountComment.accountId]: getAccountsCommentsIndexes({\n [accountComment.accountId]: updatedAccountComments,\n } as AccountsComments)[accountComment.accountId],\n },\n commentCidsToAccountsComments: {\n ...commentCidsToAccountsComments,\n [comment.cid]: {\n accountId: accountComment.accountId,\n accountCommentIndex: accountComment.index,\n },\n },\n };\n },\n );\n\n startUpdatingAccountCommentOnCommentUpdateEvents(\n comment,\n accounts[accountComment.accountId],\n accountComment.index,\n ).catch((error: unknown) =>\n log.error(\n \"accountsActions.addCidToAccountComment startUpdatingAccountCommentOnCommentUpdateEvents error\",\n {\n comment,\n account: accounts[accountComment.accountId],\n accountCommentIndex: accountComment.index,\n error,\n },\n ),\n );\n break;\n }\n }\n};\n\n// cache the last result of this function\nlet previousAccountsCommentsJson: string;\nlet previousAccountsCommentsWithoutCids: any = {};\nconst getAccountsCommentsWithoutCids = () => {\n const { accounts, accountsComments } = accountsStore.getState();\n\n // same accounts comments as last time, return cached value\n const accountsCommentsJson = JSON.stringify(accountsComments);\n if (accountsCommentsJson === previousAccountsCommentsJson) {\n return previousAccountsCommentsWithoutCids;\n }\n previousAccountsCommentsJson = accountsCommentsJson;\n\n const accountsCommentsWithoutCids: AccountsComments = {};\n if (!accounts || !accountsComments) {\n return accountsCommentsWithoutCids;\n }\n for (const accountId in accountsComments) {\n const accountComments = accountsComments[accountId];\n const account = accounts[accountId];\n for (const accountCommentIndex in accountComments) {\n const accountComment = accountComments[accountCommentIndex];\n if (!accountComment.cid) {\n const authorAddress = account?.author?.address;\n if (!authorAddress) {\n continue;\n }\n if (!accountsCommentsWithoutCids[authorAddress]) {\n accountsCommentsWithoutCids[authorAddress] = [];\n }\n accountsCommentsWithoutCids[authorAddress].push(accountComment);\n }\n }\n }\n previousAccountsCommentsWithoutCids = accountsCommentsWithoutCids;\n return accountsCommentsWithoutCids;\n};\n\nexport const ensureAccountEditsLoaded = async (accountId: string) => {\n assert(\n accountId && typeof accountId === \"string\",\n `ensureAccountEditsLoaded invalid '${accountId}'`,\n );\n\n if (accountsStore.getState().accountsEditsLoaded[accountId]) {\n return;\n }\n const existingPromise = accountEditsLoadPromises.get(accountId);\n if (existingPromise) {\n return existingPromise;\n }\n\n const loadPromise = accountsDatabase\n .getAccountEdits(accountId)\n .then((loadedAccountEdits) => {\n accountsStore.setState(({ accountsEdits, accountsEditsLoaded }) => ({\n accountsEdits: {\n ...accountsEdits,\n [accountId]: mergeLoadedAccountEdits(loadedAccountEdits, accountsEdits[accountId]),\n },\n accountsEditsLoaded: { ...accountsEditsLoaded, [accountId]: true },\n }));\n })\n .finally(() => {\n accountEditsLoadPromises.delete(accountId);\n });\n accountEditsLoadPromises.set(accountId, loadPromise);\n return loadPromise;\n};\n\nexport const resetLazyAccountHistoryLoaders = () => {\n accountEditsLoadPromises.clear();\n};\n\n// internal accounts action: mark an account's notifications as read\nexport const markNotificationsAsRead = async (account: Account) => {\n const { accountsCommentsReplies } = accountsStore.getState();\n assert(\n typeof account?.id === \"string\",\n `accountsStore.markNotificationsAsRead invalid account argument '${account}'`,\n );\n\n // find all unread replies\n const repliesToMarkAsRead: AccountCommentsReplies = {};\n for (const replyCid in accountsCommentsReplies[account.id]) {\n if (!accountsCommentsReplies[account.id][replyCid].markedAsRead) {\n repliesToMarkAsRead[replyCid] = {\n ...accountsCommentsReplies[account.id][replyCid],\n markedAsRead: true,\n };\n }\n }\n\n // add all to database\n const promises = [];\n for (const replyCid in repliesToMarkAsRead) {\n promises.push(\n accountsDatabase.addAccountCommentReply(account.id, repliesToMarkAsRead[replyCid]),\n );\n }\n await Promise.all(promises);\n\n // add all to react store\n log(\"accountsActions.markNotificationsAsRead\", { account, repliesToMarkAsRead });\n accountsStore.setState(({ accountsCommentsReplies }) => {\n const updatedAccountCommentsReplies = {\n ...accountsCommentsReplies[account.id],\n ...repliesToMarkAsRead,\n };\n return {\n accountsCommentsReplies: {\n ...accountsCommentsReplies,\n [account.id]: updatedAccountCommentsReplies,\n },\n };\n });\n};\n\n// internal accounts action: if a community has a role with an account's address\n// add it to the account.communities database\nexport const addCommunityRoleToAccountsCommunities = async (community: Community) => {\n if (!community) {\n return;\n }\n const { accounts } = accountsStore.getState();\n assert(accounts, `can't use accountsStore.accountActions before initialized`);\n\n // find community roles to add and remove\n const getRole = (community: any, authorAddress: string) =>\n community.roles && community.roles[authorAddress];\n const getChange = (accounts: any, community: any) => {\n const toUpsert: string[] = [];\n const toRemove: string[] = [];\n for (const accountId in accounts) {\n const account = accounts[accountId];\n const role = getRole(community, account.author.address);\n if (!role) {\n if (account.communities[community.address]) {\n toRemove.push(accountId);\n }\n } else {\n const currentRole = account.communities[community.address]?.role;\n if (!currentRole || currentRole.role !== role.role) {\n toUpsert.push(accountId);\n }\n }\n }\n return {\n toUpsert,\n toRemove,\n hasChange: toUpsert.length !== 0 || toRemove.length !== 0,\n };\n };\n\n const { hasChange } = getChange(accounts, community);\n if (!hasChange) {\n return;\n }\n\n accountsStore.setState(({ accounts }) => {\n const { toUpsert, toRemove } = getChange(accounts, community);\n const nextAccounts = { ...accounts };\n\n // edit databases and build next accounts (toUpsert implies role exists from getChange)\n for (const accountId of toUpsert) {\n const account = { ...nextAccounts[accountId] };\n const role = community.roles![account.author.address];\n account.communities = {\n ...account.communities,\n [community.address]: { ...account.communities[community.address], role },\n };\n nextAccounts[accountId] = account;\n accountsDatabase.addAccount(account);\n }\n for (const accountId of toRemove) {\n const account = { ...nextAccounts[accountId] };\n account.communities = { ...account.communities };\n delete account.communities[community.address];\n nextAccounts[accountId] = account;\n accountsDatabase.addAccount(account);\n }\n\n log(\"accountsActions.addCommunityRoleToAccountsCommunities\", {\n community,\n toUpsert,\n toRemove,\n });\n return { accounts: nextAccounts };\n });\n};\n"]}
@@ -0,0 +1,46 @@
1
+ import { Account, PublishCommentOptions, PublishVoteOptions, PublishCommentEditOptions, PublishCommentModerationOptions, PublishCommunityEditOptions, CreateCommunityOptions } from "../../types.js";
2
+ /** Returns state update or {} when accountComment not yet in state (no-op). Exported for coverage. */
3
+ export declare const maybeUpdateAccountComment: (accountsComments: Record<string, any[]>, accountId: string, index: number, updater: (accountComments: any[], accountComment: any) => void) => {
4
+ accountsComments?: undefined;
5
+ } | {
6
+ accountsComments: {
7
+ [x: string]: any[];
8
+ };
9
+ };
10
+ export declare const doesStoredAccountEditMatch: (storedAccountEdit: any, targetStoredAccountEdit: any) => boolean;
11
+ export declare const sanitizeStoredAccountEdit: (storedAccountEdit: any) => any;
12
+ export declare const addStoredAccountEditSummaryToState: (accountsEditsSummaries: Record<string, Record<string, any>>, accountId: string, storedAccountEdit: any) => {
13
+ accountsEditsSummaries: Record<string, Record<string, any>>;
14
+ };
15
+ export declare const removeStoredAccountEditSummaryFromState: (accountsEditsSummaries: Record<string, Record<string, any>>, accountsEdits: Record<string, Record<string, any[]>>, accountId: string, storedAccountEdit: any) => {
16
+ accountsEditsSummaries: Record<string, Record<string, any>>;
17
+ };
18
+ export declare const hasTerminalChallengeVerificationError: (challengeVerification: any) => boolean;
19
+ export declare const addStoredAccountEditToState: (accountsEdits: Record<string, Record<string, any[]>>, accountId: string, storedAccountEdit: any) => {
20
+ accountsEdits: Record<string, Record<string, any[]>>;
21
+ };
22
+ export declare const removeStoredAccountEditFromState: (accountsEdits: Record<string, Record<string, any[]>>, accountId: string, storedAccountEdit: any) => {
23
+ accountsEdits: Record<string, Record<string, any[]>>;
24
+ };
25
+ export declare const createAccount: (accountName?: string) => Promise<void>;
26
+ export declare const deleteAccount: (accountName?: string) => Promise<void>;
27
+ export declare const setActiveAccount: (accountName: string) => Promise<void>;
28
+ export declare const setAccount: (account: Account) => Promise<void>;
29
+ export declare const setAccountsOrder: (newOrderedAccountNames: string[]) => Promise<void>;
30
+ export declare const importAccount: (serializedAccount: string) => Promise<void>;
31
+ export declare const exportAccount: (accountName?: string) => Promise<string>;
32
+ export declare const subscribe: (communityAddress: string, accountName?: string) => Promise<void>;
33
+ export declare const unsubscribe: (communityAddress: string, accountName?: string) => Promise<void>;
34
+ export declare const blockAddress: (address: string, accountName?: string) => Promise<void>;
35
+ export declare const unblockAddress: (address: string, accountName?: string) => Promise<void>;
36
+ export declare const blockCid: (cid: string, accountName?: string) => Promise<void>;
37
+ export declare const unblockCid: (cid: string, accountName?: string) => Promise<void>;
38
+ export declare const publishComment: (publishCommentOptions: PublishCommentOptions, accountName?: string) => Promise<any>;
39
+ export declare const deleteComment: (commentCidOrAccountCommentIndex: string | number, accountName?: string) => Promise<void>;
40
+ export declare const publishVote: (publishVoteOptions: PublishVoteOptions, accountName?: string) => Promise<void>;
41
+ export declare const publishCommentEdit: (publishCommentEditOptions: PublishCommentEditOptions, accountName?: string) => Promise<void>;
42
+ export declare const publishCommentModeration: (publishCommentModerationOptions: PublishCommentModerationOptions, accountName?: string) => Promise<void>;
43
+ export declare const publishCommunityEdit: (communityAddress: string, publishCommunityEditOptions: PublishCommunityEditOptions, accountName?: string) => Promise<void>;
44
+ export declare const createCommunity: (createCommunityOptions: CreateCommunityOptions, accountName?: string) => Promise<any>;
45
+ export declare const deleteCommunity: (communityAddress: string, accountName?: string) => Promise<void>;
46
+ //# sourceMappingURL=accounts-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts-actions.d.ts","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,OAAO,EAEP,qBAAqB,EAGrB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,2BAA2B,EAC3B,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAsIrB,sGAAsG;AACtG,eAAO,MAAM,yBAAyB,GACpC,kBAAkB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EACvC,WAAW,MAAM,EACjB,OAAO,MAAM,EACb,SAAS,CAAC,eAAe,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI;;;;;;CAO/D,CAAC;AA2BF,eAAO,MAAM,0BAA0B,GAAI,mBAAmB,GAAG,EAAE,yBAAyB,GAAG,YAGtC,CAAC;AAE1D,eAAO,MAAM,yBAAyB,GAAI,mBAAmB,GAAG,QAK/D,CAAC;AAgCF,eAAO,MAAM,kCAAkC,GAC7C,wBAAwB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAC3D,WAAW,MAAM,EACjB,mBAAmB,GAAG;;CAqCvB,CAAC;AAE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