@ozdao/prometheus-framework 0.2.133 → 0.2.135

Sign up to get free protection for your applications and to get access to all the features.
Files changed (326) hide show
  1. package/dist/_virtual/alignment-pattern.cjs +1 -0
  2. package/dist/_virtual/alignment-pattern.js +4 -0
  3. package/dist/_virtual/browser.cjs +1 -0
  4. package/dist/_virtual/browser.js +4 -0
  5. package/dist/_virtual/canvas.cjs +1 -0
  6. package/dist/_virtual/canvas.js +4 -0
  7. package/dist/_virtual/dijkstra.cjs +1 -0
  8. package/dist/_virtual/dijkstra.js +4 -0
  9. package/dist/_virtual/error-correction-code.cjs +1 -0
  10. package/dist/_virtual/error-correction-code.js +4 -0
  11. package/dist/_virtual/error-correction-level.cjs +1 -0
  12. package/dist/_virtual/error-correction-level.js +4 -0
  13. package/dist/_virtual/finder-pattern.cjs +1 -0
  14. package/dist/_virtual/finder-pattern.js +4 -0
  15. package/dist/_virtual/format-info.cjs +1 -0
  16. package/dist/_virtual/format-info.js +4 -0
  17. package/dist/_virtual/galois-field.cjs +1 -0
  18. package/dist/_virtual/galois-field.js +4 -0
  19. package/dist/_virtual/mask-pattern.cjs +1 -0
  20. package/dist/_virtual/mask-pattern.js +4 -0
  21. package/dist/_virtual/mode.cjs +1 -0
  22. package/dist/_virtual/mode.js +4 -0
  23. package/dist/_virtual/polynomial.cjs +1 -0
  24. package/dist/_virtual/polynomial.js +4 -0
  25. package/dist/_virtual/qrcode.cjs +1 -0
  26. package/dist/_virtual/qrcode.js +4 -0
  27. package/dist/_virtual/regex.cjs +1 -0
  28. package/dist/_virtual/regex.js +4 -0
  29. package/dist/_virtual/segments.cjs +1 -0
  30. package/dist/_virtual/segments.js +4 -0
  31. package/dist/_virtual/svg-tag.cjs +1 -0
  32. package/dist/_virtual/svg-tag.js +4 -0
  33. package/dist/_virtual/utils.cjs +1 -0
  34. package/dist/_virtual/utils.js +4 -0
  35. package/dist/_virtual/utils2.cjs +1 -0
  36. package/dist/_virtual/utils2.js +4 -0
  37. package/dist/_virtual/version-check.cjs +1 -0
  38. package/dist/_virtual/version-check.js +4 -0
  39. package/dist/_virtual/version.cjs +1 -0
  40. package/dist/_virtual/version.js +4 -0
  41. package/dist/auth.server.js +1 -1
  42. package/dist/auth.server.mjs +1 -1
  43. package/dist/community.server.js +1 -1
  44. package/dist/community.server.mjs +1 -1
  45. package/dist/events.server.js +1 -1
  46. package/dist/events.server.mjs +1 -1
  47. package/dist/files.server.js +1 -1
  48. package/dist/files.server.mjs +1 -1
  49. package/dist/gallery.server.js +1 -1
  50. package/dist/gallery.server.mjs +1 -1
  51. package/dist/index-C-8xOJnM.mjs +244 -0
  52. package/dist/index-CDbtWkBj.js +243 -0
  53. package/dist/main-5IrI2IOV.js +92 -0
  54. package/dist/main-BY2OvGB9.mjs +14509 -0
  55. package/dist/main.css +1 -1
  56. package/dist/middlewares.server.js +1 -1
  57. package/dist/middlewares.server.mjs +1 -1
  58. package/dist/node_modules/dijkstrajs/dijkstra.cjs +1 -0
  59. package/dist/node_modules/dijkstrajs/dijkstra.js +70 -0
  60. package/dist/node_modules/encode-utf8/index.cjs +1 -0
  61. package/dist/node_modules/encode-utf8/index.js +30 -0
  62. package/dist/node_modules/qrcode/lib/browser.cjs +1 -0
  63. package/dist/node_modules/qrcode/lib/browser.js +45 -0
  64. package/dist/node_modules/qrcode/lib/can-promise.cjs +1 -0
  65. package/dist/node_modules/qrcode/lib/can-promise.js +6 -0
  66. package/dist/node_modules/qrcode/lib/core/alignment-pattern.cjs +1 -0
  67. package/dist/node_modules/qrcode/lib/core/alignment-pattern.js +21 -0
  68. package/dist/node_modules/qrcode/lib/core/alphanumeric-data.cjs +1 -0
  69. package/dist/node_modules/qrcode/lib/core/alphanumeric-data.js +73 -0
  70. package/dist/node_modules/qrcode/lib/core/bit-buffer.cjs +1 -0
  71. package/dist/node_modules/qrcode/lib/core/bit-buffer.js +24 -0
  72. package/dist/node_modules/qrcode/lib/core/bit-matrix.cjs +1 -0
  73. package/dist/node_modules/qrcode/lib/core/bit-matrix.js +22 -0
  74. package/dist/node_modules/qrcode/lib/core/byte-data.cjs +1 -0
  75. package/dist/node_modules/qrcode/lib/core/byte-data.js +24 -0
  76. package/dist/node_modules/qrcode/lib/core/error-correction-code.cjs +1 -0
  77. package/dist/node_modules/qrcode/lib/core/error-correction-code.js +359 -0
  78. package/dist/node_modules/qrcode/lib/core/error-correction-level.cjs +1 -0
  79. package/dist/node_modules/qrcode/lib/core/error-correction-level.js +35 -0
  80. package/dist/node_modules/qrcode/lib/core/finder-pattern.cjs +1 -0
  81. package/dist/node_modules/qrcode/lib/core/finder-pattern.js +18 -0
  82. package/dist/node_modules/qrcode/lib/core/format-info.cjs +1 -0
  83. package/dist/node_modules/qrcode/lib/core/format-info.js +14 -0
  84. package/dist/node_modules/qrcode/lib/core/galois-field.cjs +1 -0
  85. package/dist/node_modules/qrcode/lib/core/galois-field.js +22 -0
  86. package/dist/node_modules/qrcode/lib/core/kanji-data.cjs +2 -0
  87. package/dist/node_modules/qrcode/lib/core/kanji-data.js +37 -0
  88. package/dist/node_modules/qrcode/lib/core/mask-pattern.cjs +1 -0
  89. package/dist/node_modules/qrcode/lib/core/mask-pattern.js +96 -0
  90. package/dist/node_modules/qrcode/lib/core/mode.cjs +1 -0
  91. package/dist/node_modules/qrcode/lib/core/mode.js +64 -0
  92. package/dist/node_modules/qrcode/lib/core/numeric-data.cjs +1 -0
  93. package/dist/node_modules/qrcode/lib/core/numeric-data.js +26 -0
  94. package/dist/node_modules/qrcode/lib/core/polynomial.cjs +1 -0
  95. package/dist/node_modules/qrcode/lib/core/polynomial.js +29 -0
  96. package/dist/node_modules/qrcode/lib/core/qrcode.cjs +4 -0
  97. package/dist/node_modules/qrcode/lib/core/qrcode.js +159 -0
  98. package/dist/node_modules/qrcode/lib/core/reed-solomon-encoder.cjs +1 -0
  99. package/dist/node_modules/qrcode/lib/core/reed-solomon-encoder.js +25 -0
  100. package/dist/node_modules/qrcode/lib/core/regex.cjs +2 -0
  101. package/dist/node_modules/qrcode/lib/core/regex.js +24 -0
  102. package/dist/node_modules/qrcode/lib/core/segments.cjs +2 -0
  103. package/dist/node_modules/qrcode/lib/core/segments.js +143 -0
  104. package/dist/node_modules/qrcode/lib/core/utils.cjs +1 -0
  105. package/dist/node_modules/qrcode/lib/core/utils.js +74 -0
  106. package/dist/node_modules/qrcode/lib/core/version-check.cjs +1 -0
  107. package/dist/node_modules/qrcode/lib/core/version-check.js +7 -0
  108. package/dist/node_modules/qrcode/lib/core/version.cjs +1 -0
  109. package/dist/node_modules/qrcode/lib/core/version.js +74 -0
  110. package/dist/node_modules/qrcode/lib/renderer/canvas.cjs +1 -0
  111. package/dist/node_modules/qrcode/lib/renderer/canvas.js +27 -0
  112. package/dist/node_modules/qrcode/lib/renderer/svg-tag.cjs +2 -0
  113. package/dist/node_modules/qrcode/lib/renderer/svg-tag.js +28 -0
  114. package/dist/node_modules/qrcode/lib/renderer/utils.cjs +1 -0
  115. package/dist/node_modules/qrcode/lib/renderer/utils.js +52 -0
  116. package/dist/orders.server.js +1 -1
  117. package/dist/orders.server.mjs +1 -1
  118. package/dist/organizations.server.js +1 -1
  119. package/dist/organizations.server.mjs +1 -1
  120. package/dist/products.server.js +1 -1
  121. package/dist/products.server.mjs +1 -1
  122. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  123. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +1 -1
  124. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  125. package/dist/prometheus-framework/src/components/Field/Field.vue.js +19 -20
  126. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  127. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +5 -5
  128. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +2 -2
  130. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  131. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  132. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  133. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +16 -16
  134. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  135. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +16 -16
  136. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  137. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +13 -13
  138. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  139. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +36 -36
  140. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  141. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +29 -29
  142. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
  143. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
  144. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
  145. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
  146. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  147. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  148. package/dist/prometheus-framework/src/modules/community/components/pages/Blog.vue.cjs +1 -1
  149. package/dist/prometheus-framework/src/modules/community/components/pages/Blog.vue.js +1 -1
  150. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  151. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +3 -3
  152. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  153. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +23 -23
  154. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  155. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +2 -2
  156. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  157. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +14 -14
  158. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  159. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
  160. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
  161. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +2 -2
  162. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  163. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  164. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  165. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +12 -12
  166. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  167. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +21 -21
  168. package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.cjs +1 -1
  169. package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.js +1 -1
  170. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  171. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +5 -5
  172. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  173. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +7 -7
  174. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  175. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
  176. package/dist/prometheus-framework/src/modules/globals/localization/vue-i18n.cjs +1 -1
  177. package/dist/prometheus-framework/src/modules/globals/localization/vue-i18n.js +8 -8
  178. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  179. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +3 -3
  180. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
  181. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
  182. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  183. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +4 -4
  184. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  185. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +3 -3
  186. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
  187. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +5 -5
  188. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
  189. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +8 -8
  190. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
  191. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
  192. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  193. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  194. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  195. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  196. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  197. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +4 -4
  198. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  199. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +2 -2
  200. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  201. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  202. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
  203. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
  204. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  205. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +76 -46
  206. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
  207. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +2 -2
  208. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  209. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +12 -12
  210. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  211. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +16 -16
  212. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  213. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +6 -6
  214. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  215. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +19 -19
  216. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  217. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  218. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  219. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +7 -7
  220. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  221. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  222. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  223. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
  224. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  225. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +13 -13
  226. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  227. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +18 -18
  228. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  229. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +32 -32
  230. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  231. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +10 -10
  232. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  233. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +5 -5
  234. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  235. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  236. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  237. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +3 -3
  238. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  239. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
  240. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -0
  241. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +64 -0
  242. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotSub.vue.cjs +1 -0
  243. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotSub.vue.js +24 -0
  244. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +1 -0
  245. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +181 -0
  246. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs +1 -0
  247. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js +478 -0
  248. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.cjs +1 -0
  249. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.js +121 -0
  250. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -0
  251. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +203 -0
  252. package/dist/prometheus-framework/src/modules/spots/router/spots.cjs +1 -0
  253. package/dist/prometheus-framework/src/modules/spots/router/spots.js +92 -0
  254. package/dist/prometheus-framework/src/modules/spots/spots.client.cjs +1 -0
  255. package/dist/prometheus-framework/src/modules/spots/spots.client.js +37 -0
  256. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  257. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +4 -4
  258. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  259. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +9 -9
  260. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardBalanceReplenished.vue.cjs +1 -0
  261. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardBalanceReplenished.vue.js +34 -0
  262. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.cjs +1 -0
  263. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.js +42 -0
  264. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CashDeposit.vue.cjs +1 -0
  265. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CashDeposit.vue.js +26 -0
  266. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -0
  267. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +76 -0
  268. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDepositProcessing.vue.cjs +1 -0
  269. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDepositProcessing.vue.js +105 -0
  270. package/dist/prometheus-framework/src/modules/wallet/views/components/elements/ConnectMetamask.vue.cjs +1 -0
  271. package/dist/prometheus-framework/src/modules/wallet/views/components/elements/ConnectMetamask.vue.js +106 -0
  272. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  273. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +140 -125
  274. package/dist/prometheus-framework/src/modules/wallet/views/localization/wallet.json.cjs +1 -0
  275. package/dist/prometheus-framework/src/modules/wallet/views/localization/wallet.json.js +41 -0
  276. package/dist/prometheus-framework/src/modules/wallet/views/store/wallet.store.cjs +1 -1
  277. package/dist/prometheus-framework/src/modules/wallet/views/store/wallet.store.js +98 -22
  278. package/dist/prometheus-framework.cjs.js +1 -1
  279. package/dist/prometheus-framework.es.js +1 -1
  280. package/dist/reports.server.js +1 -1
  281. package/dist/reports.server.mjs +1 -1
  282. package/dist/spots.server.js +169 -0
  283. package/dist/spots.server.mjs +170 -0
  284. package/dist/style.css +1 -1
  285. package/dist/wallet.server.js +103 -13
  286. package/dist/wallet.server.mjs +103 -13
  287. package/dist/web-5eyiz9L7.mjs +54 -0
  288. package/dist/web-C04IcLk4.js +1 -0
  289. package/package.json +1 -1
  290. package/src/components/Field/Field.vue +1 -1
  291. package/src/modules/community/components/pages/Blog.vue +1 -1
  292. package/src/modules/globals/components/layouts/Client.vue +10 -8
  293. package/src/modules/globals/components/partials/Header.vue +2 -2
  294. package/src/modules/globals/components/sections/Walkthrough.vue +4 -4
  295. package/src/modules/globals/globals.client.js +5 -5
  296. package/src/modules/globals/localization/vue-i18n.js +5 -5
  297. package/src/modules/landing/components/sections/HowToBuyWDR.vue +2 -3
  298. package/src/modules/landing/components/sections/SectionEarn.vue +1 -6
  299. package/src/modules/middlewares/server/authSecret.js +22 -0
  300. package/src/modules/middlewares/server/index.js +7 -5
  301. package/src/modules/organizations/components/pages/OrganizationEdit.vue +29 -1
  302. package/src/modules/spots/components/layouts/Spots.vue +1 -1
  303. package/src/modules/spots/components/pages/SpotEdit.vue +8 -53
  304. package/src/modules/spots/models/spot.model.js +7 -7
  305. package/src/modules/spots/router/spots.js +65 -61
  306. package/src/modules/spots/spots.client.js +43 -0
  307. package/src/modules/spots/spots.server.js +31 -0
  308. package/src/modules/wallet/controllers/factories/rewards.factory.js +87 -2
  309. package/src/modules/wallet/controllers/routes/rewards.routes.js +27 -3
  310. package/src/modules/wallet/models/wallet.model.js +5 -5
  311. package/src/modules/wallet/{components → views/components}/blocks/CardBalanceReplenished.vue +17 -7
  312. package/src/modules/wallet/{components/blocks/CardDeposite.vue → views/components/blocks/CardDeposit.vue} +4 -4
  313. package/src/modules/wallet/views/components/blocks/CryptoDeposit.vue +98 -0
  314. package/src/modules/wallet/views/components/blocks/CryptoDepositProcessing.vue +144 -0
  315. package/src/modules/wallet/views/components/elements/ConnectMetamask.vue +131 -0
  316. package/src/modules/wallet/views/components/pages/Wallet.vue +95 -68
  317. package/src/modules/wallet/views/localization/wallet.json +37 -0
  318. package/src/modules/wallet/views/store/wallet.store.js +145 -28
  319. package/src/modules/wallet/wallet.server.js +2 -2
  320. package/src/modules/spots/components/sections/PlaceModify.vue +0 -113
  321. package/src/modules/spots/components/sections/Places.vue +0 -119
  322. package/src/modules/wallet/components/blocks/CryptoDeposite.vue +0 -55
  323. package/src/modules/wallet/controllers/factories/rewards.factory.aggr.js +0 -181
  324. package/src/modules/wallet/controllers/factories/rewards.factory.population.js +0 -213
  325. package/src/modules/wallet/localization/Wallet.json +0 -22
  326. /package/src/modules/wallet/{components/blocks/CashDeposite.vue → views/components/blocks/CashDeposit.vue} +0 -0
@@ -2,6 +2,8 @@ import axios from 'axios';
2
2
  import { reactive } from 'vue';
3
3
  import { BigNumber } from 'bignumber.js';
4
4
 
5
+ import { setError } from "@pf/src/modules/globals/store/globals";
6
+
5
7
  const API_CRYPTO_PATH = '/api/crypto';
6
8
  const WDT_SUPPLY = 20_000_000;
7
9
 
@@ -13,46 +15,161 @@ const state = reactive({
13
15
  share: '0',
14
16
  account: null,
15
17
  web3: null,
18
+ depositInfo: null,
19
+ depositRequestIsActive: false,
20
+ websocket: null,
21
+ config: null,
22
+ chosenNetwork: null,
16
23
  });
17
24
 
25
+ const timer = reactive({ remaining: 0, interval: null });
26
+
18
27
  const actions = {
19
- listRewards: () => $axios
20
- .get(`${API_CRYPTO_PATH}/rewards`)
21
- .then((r) => {
28
+ loadConfig: async () => {
29
+ await $axios
30
+ .get(`${API_CRYPTO_PATH}/deposit/config`)
31
+ .then((r) => {
32
+ state.config = r.data;
33
+ state.chosenNetwork = {
34
+ name: `polygon-WDT`,
35
+ value: {
36
+ token: state.config.polygon.tokens.WDT,
37
+ network: 'polygon'
38
+ }
39
+ }
40
+ })
41
+ .catch((e) => console.error(e));
42
+ },
43
+
44
+ connectWebSocket: () => {
45
+ state.websocket = new WebSocket(process.env.WSS_URL);
46
+
47
+ state.websocket.onmessage = (event) => {
48
+ const message = JSON.parse(event.data);
49
+
50
+ if (message.id === state.depositInfo.id) {
51
+ const confirmations = state.depositInfo.confirmations;
52
+
53
+ state.depositInfo = message;
54
+ state.depositInfo.confirmations = confirmations;
55
+ }
56
+
57
+ if (message.hash === state.depositInfo.tx.hash) {
58
+ state.depositInfo.confirmations = message.confirmations;
59
+ }
60
+ };
61
+
62
+ state.websocket.onerror = (err) => console.error(err);
63
+ },
64
+
65
+ disconnectWebSocket: () => {
66
+ if (state.websocket) {
67
+ state.websocket.close();
68
+ state.websocket = null;
69
+ }
70
+ },
71
+
72
+ listRewards: async () => {
73
+ try {
74
+ const r = await $axios.get(`${API_CRYPTO_PATH}/rewards`);
75
+
22
76
  state.rewards = r.data;
23
77
  state.tokenBalance = r.data
24
78
  .reduce((acc, v) => acc.plus(v.amount), new BigNumber('0'))
25
79
  .toString();
80
+
26
81
  state.share = new BigNumber(state.tokenBalance)
27
82
  .div(WDT_SUPPLY)
28
83
  .multipliedBy(100)
29
84
  .toFormat(6);
30
- })
31
- .catch((e) => console.error(e)),
32
-
33
- collectRewards: () => $axios
34
- .post(`${API_CRYPTO_PATH}/collect`, { recipient: state.account })
35
- .then(() => actions.listRewards())
36
- .catch((e) => console.error(e)),
37
-
38
- disconnectWallet: () => window.ethereum
39
- .request({ method: "wallet_revokePermissions", params: [{ "eth_accounts": {} }] })
40
- .then(() => { state.account = null; })
41
- .catch((e) => console.error(e)),
42
-
43
- connectWallet: () => state.web3.eth
44
- .requestAccounts()
45
- .then((accounts) => { state.account = accounts[0] })
46
- .catch((e) => console.error(e)),
47
-
48
- tryReconnectWallet: () => state.web3.eth
49
- .getAccounts()
50
- .then((a) => {
85
+ } catch (e) {
86
+ console.error(e);
87
+ }
88
+ },
89
+
90
+ collectRewards: async () => {
91
+ try {
92
+ await $axios.post(`${API_CRYPTO_PATH}/collect`, { recipient: state.account });
93
+ await actions.listRewards();
94
+ } catch (e) {
95
+ console.error(e);
96
+ }
97
+ },
98
+
99
+ disconnectWallet: async () => {
100
+ try {
101
+ await window.ethereum.request({ method: "wallet_revokePermissions", params: [{ "eth_accounts": {} }] });
102
+ state.account = null;
103
+ } catch (e) {
104
+ console.error(e);
105
+ }
106
+ },
107
+
108
+ connectWallet: async () => {
109
+ try {
110
+ const accounts = await state.web3.eth.requestAccounts();
111
+ state.account = accounts[0];
112
+ } catch (e) {
113
+ console.error(e);
114
+ }
115
+ },
116
+
117
+ tryReconnectWallet: async () => {
118
+ try {
119
+ const a = await state.web3.eth.getAccounts();
51
120
  if (a.length > 0) {
52
- return actions.connectWallet();
121
+ await actions.connectWallet();
53
122
  }
54
- })
55
- .catch((e) => console.error(e)),
123
+ } catch (e) {
124
+ console.error(e);
125
+ }
126
+ },
127
+
128
+ requestCryptoDeposit: async (amount) => {
129
+ state.depositRequestIsActive = true;
130
+
131
+ await $axios
132
+ .post(`${API_CRYPTO_PATH}/deposit`, {
133
+ network: state.chosenNetwork.value.network,
134
+ amount: new BigNumber(amount).shiftedBy(8).toString(),
135
+ token: state.chosenNetwork.value.token
136
+ })
137
+ .then((r) => {
138
+ state.depositInfo = r.data;
139
+
140
+ const createTimestamp = new Date(r.data.createdAt).getTime();
141
+ const dead = createTimestamp + state.config[state.chosenNetwork.value.network].waitingTime;
142
+ timer.remaining = Math.floor((dead - Date.now()) / 1000);
143
+
144
+ timer.interval = setInterval(
145
+ () => {
146
+ timer.remaining -= 1;
147
+
148
+ if (timer.remaining === 0) {
149
+ clearInterval(timer.interval);
150
+ }
151
+ },
152
+ 1000
153
+ );
154
+ })
155
+ .catch((e) => console.error(e));
156
+
157
+ state.depositRequestIsActive = false;
158
+
159
+ actions.connectWebSocket();
160
+ },
161
+
162
+ stopTimer: () => {
163
+ clearInterval(timer.interval);
164
+ },
165
+
166
+ cancelDeposit: async () => {
167
+ await $axios
168
+ .post(`${API_CRYPTO_PATH}/deposit/cancel`, { id: state.depositInfo.id })
169
+ .then(() => actions.stopTimer())
170
+ .then(() => actions.disconnectWebSocket())
171
+ .catch((e) => console.error(e));
172
+ }
56
173
  };
57
174
 
58
- export { state, actions };
175
+ export { state, actions, timer };
@@ -8,7 +8,7 @@ const RoutesRewards = require('./controllers/routes/rewards.routes.js');
8
8
  const FactoryPayments = require('./controllers/factories/payments.factory.js');
9
9
 
10
10
  // Initialization function for setting up the module within the application
11
- function initializePayments(app, db, wdmClient, origins, publicPath) {
11
+ function initializePayments(app, db, wss, wdmClient, origins, publicPath) {
12
12
  // Setup models in the database object
13
13
  db.wallet = ModelWallet(db);
14
14
  db.payment = ModelPayment(db);
@@ -17,7 +17,7 @@ function initializePayments(app, db, wdmClient, origins, publicPath) {
17
17
  // Setup routes if the app object is provided
18
18
  if (app) {
19
19
  RoutesPayments(app, db, origins, publicPath)
20
- RoutesRewards(app, db, wdmClient, origins)
20
+ RoutesRewards(app, db, wss, wdmClient, origins)
21
21
  }
22
22
  }
23
23
 
@@ -1,113 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="br-grey-transp-25 radius-small mn-b-small">
4
- <Select
5
- :options="[
6
- {name: 'Кафе', value: 'cafe'},
7
- {name: 'Бар', value: 'bar'},
8
- {name: 'Ресторан', value: 'restaraunt'},
9
- {name: 'Пиццерия', value: 'pizzeria'},
10
- {name: 'Ночной клуб', value: 'night-club'},
11
- {name: 'Шаверма', value: 'shaverma'},
12
- {name: 'Кофейня', value: 'coffee'}
13
- ]"
14
- :prop="placeForm"
15
- content="type"
16
- label="Тип"
17
- placeholder="Тип заведения"
18
- size="small"
19
- />
20
-
21
- <Field
22
- v-model:field="placeForm.name"
23
- label="Название"
24
- :validation="placeValidation"
25
- placeholder="Введите название места"
26
- />
27
-
28
- <Field
29
- v-model:field="placeForm.address"
30
- label="Адрес"
31
- :validation="placeValidation"
32
- placeholder="Введите адрес места"
33
- />
34
-
35
- <Field
36
- v-model:field="placeForm.phone"
37
- label="Телефон"
38
- :validation="placeValidation"
39
- placeholder="Введите телефон места"
40
- />
41
- </div>
42
-
43
- <button @click="submitForm" class="w-100 button bg-second t-white">
44
- {{ props.place !== null ? "Редактировать заведение" : "Добавить заведение" }}
45
- </button>
46
- </div>
47
- </template>
48
- <script setup>
49
- import { ref } from 'vue';
50
- import Field from '@pf/src/components/Field/Field.vue';
51
- import Select from '@pf/src/components/Select/Select.vue';
52
- import * as inputsValidation from '@pf/src/modules/validations/client/inputs.validation';
53
-
54
- const props = defineProps({
55
- isPopupOpen: Boolean,
56
- place: Number,
57
- places: Array,
58
- });
59
-
60
- const emits = defineEmits(['callback']);
61
-
62
- const placeForm = ref({
63
- logo: '',
64
- name: '',
65
- address: '',
66
- });
67
-
68
- const placeValidation = ref(null);
69
-
70
- if (props.place !== null) {
71
- placeForm.value = props.places[props.place];
72
- }
73
-
74
- async function submitForm() {
75
- try {
76
- await inputsValidation.validateInputs(
77
- placeValidation,
78
- inputsValidation.validateLength,
79
- placeForm.value.name,
80
- 'Некорректное название'
81
- );
82
- } catch (error) {
83
- throw new Error();
84
- }
85
-
86
- if (props.place !== null) {
87
- props.places[props.place] = placeForm.value;
88
- emits('callback');
89
- } else {
90
- props.places.push(placeForm.value);
91
- emits('callback');
92
- }
93
- }
94
- </script>
95
-
96
-
97
- <style scoped>
98
- .form-group {
99
- margin-bottom: 1rem;
100
- }
101
-
102
- label {
103
- display: block;
104
- margin-bottom: 0.5rem;
105
- }
106
-
107
- input {
108
- width: 100%;
109
- padding: 0.5rem;
110
- border: 1px solid #ccc;
111
- border-radius: 5px;
112
- }
113
- </style>
@@ -1,119 +0,0 @@
1
- <template>
2
- <div>
3
-
4
- <div class="br-grey-transp-25 radius-small mn-b-small">
5
- <Select
6
- :options="[
7
- {name: 'Кафе', value: 'cafe'},
8
- {name: 'Бар', value: 'bar'},
9
- {name: 'Ресторан', value: 'restaraunt'},
10
- {name: 'Пиццерия', value: 'pizzeria'},
11
- {name: 'Ночной клуб', value: 'night-club'},
12
- {name: 'Шаверма', value: 'shaverma'},
13
- {name: 'Кофейня', value: 'coffee'}
14
- ]"
15
- :prop="placeForm"
16
- content="type"
17
- label="Тип"
18
- placeholder="Тип заведения"
19
- size="small"
20
- />
21
-
22
- <Field
23
- v-model:field="placeForm.name"
24
- label="Название"
25
- :validation="placeValidation"
26
- placeholder="Введите название места"
27
-
28
- />
29
-
30
- <Field
31
- v-model:field="placeForm.address"
32
- label="Адрес"
33
- :validation="placeValidation"
34
- placeholder="Введите адрес места"
35
-
36
- />
37
-
38
- <Field
39
- v-model:field="placeForm.phone"
40
- label="Телефон"
41
- :validation="placeValidation"
42
- placeholder="Введите телефон места"
43
-
44
- />
45
- </div>
46
-
47
- <button @click="submitForm" class="w-100 button bg-second t-white">
48
- {{ props.place !== null ? "Редактировать заведение" : "Добавить заведение" }}
49
- </button>
50
- </div>
51
- </template>
52
-
53
- <script setup>
54
- import { ref, watch } from "vue";
55
-
56
- import * as inputsValidation from '@pf/src/modules/middlewares/client/inputs.validation'
57
- import Field from "@pf/src/components/Field/Field.vue";
58
- import Select from "@pf/src/components/Select/Select.vue";
59
-
60
- const props = defineProps({
61
- isPopupOpen: Boolean,
62
- place: Number,
63
- places: Array,
64
- });
65
-
66
- const emits = defineEmits(['callback'])
67
-
68
- const placeForm = ref({
69
- logo: "",
70
- name: "",
71
- address: "",
72
- });
73
-
74
- if (props.place !== null) {
75
- placeForm.value = props.places[props.place]
76
- }
77
-
78
-
79
- const placeValidation = ref(null)
80
-
81
- async function submitForm() {
82
- try {
83
- await inputsValidation.validateInputs(
84
- placeValidation,
85
- inputsValidation.validateLength,
86
- placeForm.value.name,
87
- 'Некорректное название'
88
- )
89
- } catch (error) {
90
- throw new Error
91
- }
92
-
93
- if (props.place !== null) {
94
- props.places[props.place] = placeForm.value
95
- emits("callback");
96
- } else {
97
- props.places.push(placeForm.value);
98
- emits("callback");
99
- }
100
- }
101
- </script>
102
-
103
- <style scoped>
104
- .form-group {
105
- margin-bottom: 1rem;
106
- }
107
-
108
- label {
109
- display: block;
110
- margin-bottom: 0.5rem;
111
- }
112
-
113
- input {
114
- width: 100%;
115
- padding: 0.5rem;
116
- border: 1px solid #ccc;
117
- border-radius: 5px;
118
- }
119
- </style>
@@ -1,55 +0,0 @@
1
- <template>
2
- <h2 class="mn-b-small t-center t-bold">{{ t('depositeWithCrypto') }}</h2>
3
-
4
- <div class="bg-grey radius-big mn-t-semi mn-b-semi flex flex-justify-between">
5
- <Field
6
- :placeholder="t('enterAmount')"
7
- class="pd-medium radius-small"
8
- />
9
-
10
- <div class="uppercase flex flex-justify-center flex-items-center mn-r-semi t-semi">
11
- POLY USDT
12
- </div>
13
- </div>
14
-
15
- <h3 class="t-semi">You will receieve: 0 WDT</h3>
16
-
17
- <button
18
- class="uppercase w-100 bg-main t-black pd-thin radius-medium t-center br-solid br-2px br-black-transp-10 mn-t-small"
19
- @click="switchMenu(3)"
20
- >
21
- {{ t('pay') }}
22
- </button>
23
-
24
- <button
25
- class="uppercase w-100 bg-main t-black pd-thin radius-medium t-center br-solid br-2px br-black-transp-10 mn-t-small"
26
- @click="backSelection"
27
- >
28
- {{ t('backToSelection') }}
29
- </button>
30
- </template>
31
-
32
- <script setup>
33
- import text from '@pf/src/modules/wallet/localization/Wallet.json'
34
- import Field from '@pf/src/components/Field/Field.vue'
35
- import { useI18n } from 'vue-i18n'
36
-
37
- const emits = defineEmits(['back-selection', 'switch-menu'])
38
-
39
- // Localization
40
- const { t } = useI18n({
41
- useScope: 'global',
42
- ...text
43
- })
44
-
45
- function backSelection() {
46
- emits("back-selection")
47
- }
48
-
49
- function switchMenu(screen = 0) {
50
- emits("switch-menu", screen)
51
- }
52
- </script>
53
-
54
- <style scoped>
55
- </style>
@@ -1,181 +0,0 @@
1
- const ObjectId = require('mongoose').Types.ObjectId;
2
- const { BigNumber } = require('bignumber.js');
3
-
4
- const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
5
-
6
- const VIEWS_REWARD_COEFF = '0.1';
7
- const WDT_DECIMALS = 8;
8
-
9
- const calculateRewardForPost = (snapshot, viewsCount, reactionsCount, commentsCount) => {
10
-
11
- console.log('views',viewsCount)
12
- console.log('reactions',reactionsCount)
13
- console.log('comments',commentsCount)
14
-
15
- if (snapshot) {
16
- return new BigNumber(Math.max(viewsCount - snapshot.views, 0))
17
- .multipliedBy(VIEWS_REWARD_COEFF)
18
- .plus(Math.max(reactionsCount - snapshot.reactions, 0))
19
- .plus(Math.max(commentsCount - snapshot.comments, 0));
20
- }
21
-
22
- return new BigNumber('10')
23
- .plus(new BigNumber(viewsCount).multipliedBy(VIEWS_REWARD_COEFF))
24
- .plus(reactionsCount)
25
- .plus(commentsCount);
26
- };
27
-
28
- const rewardsControllerFactory = (db, wdmClient) => {
29
- const Blogpost = db.blogpost;
30
- const Reaction = db.reaction;
31
- const Comment = db.comment;
32
- const Reward = db.reward;
33
-
34
-
35
-
36
- const listRewards = async (req, res) => {
37
- try {
38
- const aggregationResults = await Blogpost.aggregate([
39
- // Соответствие блогпостов для данного пользователя
40
- { $match: { "creator.target": new ObjectId(req.userId) } },
41
-
42
- // Добавление информации о реакциях и комментариях
43
- {
44
- $lookup: {
45
- from: "reactions",
46
- localField: "_id",
47
- foreignField: "target",
48
- as: "reactions"
49
- }
50
- },
51
- {
52
- $lookup: {
53
- from: "comments",
54
- localField: "_id",
55
- foreignField: "target",
56
- as: "comments"
57
- }
58
- },
59
-
60
- // Добавление информации о предыдущей награде
61
- {
62
- $lookup: {
63
- from: "rewards",
64
- let: { blogId: "$_id" },
65
- pipeline: [
66
- {
67
- $match: {
68
- $expr: {
69
- $and: [
70
- { $eq: ["$user", req.userId] },
71
- { $eq: ["$type", "blogpost"] },
72
- { $eq: ["$target", "$$blogId"] }
73
- ]
74
- }
75
- }
76
- },
77
- { $sort: { createdAt: -1 } },
78
- { $limit: 1 }
79
- ],
80
- as: "previousReward"
81
- }
82
- },
83
-
84
- // Преобразование результатов
85
- {
86
- $project: {
87
- _id: 1,
88
- user: req.userId,
89
- type: "blogpost",
90
- views: 1,
91
- reactionsCount: { $size: "$reactions" },
92
- commentsCount: { $size: "$comments" },
93
- previousReward: { $arrayElemAt: ["$previousReward", 0] },
94
- name: 1,
95
- content: 1,
96
- url: 1
97
- }
98
- }
99
- ])
100
-
101
- const rewards = aggregationResults.map(result => ({
102
- user: result.user,
103
- type: result.type,
104
- amount: calculateRewardForPost(
105
- result.previousReward?.snapshot,
106
- result.views,
107
- result.reactionsCount,
108
- result.commentsCount
109
- ),
110
- name: result.name,
111
- content: result.content,
112
- url: result.url
113
- }));
114
-
115
- res.status(200).send(rewards);
116
- } catch (error) {
117
- res.status(500).send({ message: "Произошла ошибка при получении наград", error: error.message });
118
- }
119
- };
120
-
121
- const collectTokens = async (req, res) => {
122
- const blogs = await Blogpost.find({ "creator.target": req.userId }).exec();
123
-
124
- let totalRewards = new BigNumber(0);
125
-
126
- for (const blog of blogs) {
127
- const reactions = await Reaction.countDocuments({ target: { $in: blog._id } }).exec();
128
- const comments = await Comment.countDocuments({ target: { $in: blog._id } }).exec();
129
-
130
- const previousReward = await Reward
131
- .findOne({ user: req.userId, type: 'blogpost', target: blog._id })
132
- .sort({ createdAt: -1 })
133
- .exec();
134
-
135
- const reward = calculateRewardForPost(
136
- previousReward?.snapshot,
137
- blog.views,
138
- reactions,
139
- comments
140
- );
141
-
142
- if (reward.gt(0)) {
143
- totalRewards = totalRewards.plus(reward);
144
-
145
- const snapshot = {
146
- views: previousReward ?
147
- previousReward.snapshot.views < blog.views ? blog.views : previousReward.snapshot.views
148
- : blog.views,
149
- reactions: previousReward ?
150
- previousReward.snapshot.reactions < reactions ? reactions : previousReward.snapshot.reactions
151
- : reactions,
152
- comments: previousReward ?
153
- previousReward.snapshot.comments < comments ? comments : previousReward.snapshot.comments
154
- : comments,
155
- };
156
-
157
- await Reward.create({
158
- user: req.userId,
159
- type: 'blogpost',
160
- target: blog._id,
161
- amount: reward.toString(),
162
- snapshot: snapshot,
163
- });
164
- }
165
- }
166
-
167
- if (totalRewards.gt(0)) {
168
- await wdmClient.transfer(
169
- totalRewards.shiftedBy(WDT_DECIMALS).toString(),
170
- req.body.recipient,
171
- req.userId
172
- );
173
- }
174
-
175
- res.status(200).send();
176
- };
177
-
178
- return { listRewards, collectTokens };
179
- };
180
-
181
- module.exports = rewardsControllerFactory;