@ozdao/prometheus-framework 0.2.221 → 0.2.223

Sign up to get free protection for your applications and to get access to all the features.
Files changed (491) hide show
  1. package/dist/auth.server.js +4 -4
  2. package/dist/auth.server.mjs +4 -4
  3. package/dist/builder.js +72 -60
  4. package/dist/builder.mjs +72 -60
  5. package/dist/community.server.js +9 -4
  6. package/dist/community.server.mjs +9 -4
  7. package/dist/events.server.js +14 -24
  8. package/dist/events.server.mjs +14 -24
  9. package/dist/files.server.js +1 -1
  10. package/dist/files.server.mjs +1 -1
  11. package/dist/gallery.server.js +42 -76
  12. package/dist/gallery.server.mjs +41 -75
  13. package/dist/index-CsS7qx1d.js +243 -0
  14. package/dist/index-UIHE6Rk3.mjs +244 -0
  15. package/dist/main.css +1 -1
  16. package/dist/node_modules/@capacitor/core/dist/index.cjs +529 -0
  17. package/dist/node_modules/@capacitor/core/dist/index.cjs.map +1 -0
  18. package/dist/node_modules/@capacitor/core/dist/index.js +530 -0
  19. package/dist/node_modules/@capacitor/core/dist/index.js.map +1 -0
  20. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/definitions.cjs +51 -0
  21. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/definitions.cjs.map +1 -0
  22. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/definitions.js +55 -0
  23. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/definitions.js.map +1 -0
  24. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/index.cjs +25 -0
  25. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/index.cjs.map +1 -0
  26. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/index.js +13 -0
  27. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/index.js.map +1 -0
  28. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/web.cjs +67 -0
  29. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/web.cjs.map +1 -0
  30. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/web.js +67 -0
  31. package/dist/node_modules/@capacitor-mlkit/barcode-scanning/dist/esm/web.js.map +1 -0
  32. package/dist/node_modules/@unhead/shared/dist/index.cjs +7 -0
  33. package/dist/node_modules/@unhead/shared/dist/index.cjs.map +1 -0
  34. package/dist/node_modules/@unhead/shared/dist/index.js +7 -0
  35. package/dist/node_modules/@unhead/shared/dist/index.js.map +1 -0
  36. package/dist/node_modules/@unhead/ssr/dist/index.cjs +87 -0
  37. package/dist/node_modules/@unhead/ssr/dist/index.cjs.map +1 -0
  38. package/dist/node_modules/@unhead/ssr/dist/index.js +87 -0
  39. package/dist/node_modules/@unhead/ssr/dist/index.js.map +1 -0
  40. package/dist/orders.server.js +2 -2
  41. package/dist/orders.server.mjs +2 -2
  42. package/dist/organizations.server.js +174 -95
  43. package/dist/organizations.server.mjs +174 -95
  44. package/dist/pages.server.js +1 -1
  45. package/dist/pages.server.mjs +1 -1
  46. package/dist/products.server.js +119 -266
  47. package/dist/products.server.mjs +119 -266
  48. package/dist/prometheus-framework/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs +814 -0
  49. package/dist/prometheus-framework/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs.map +1 -0
  50. package/dist/prometheus-framework/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js +814 -0
  51. package/dist/prometheus-framework/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js.map +1 -0
  52. package/dist/prometheus-framework/node_modules/@vue/shared/dist/shared.esm-bundler.cjs +210 -0
  53. package/dist/prometheus-framework/node_modules/@vue/shared/dist/shared.esm-bundler.cjs.map +1 -0
  54. package/dist/prometheus-framework/node_modules/@vue/shared/dist/shared.esm-bundler.js +210 -0
  55. package/dist/prometheus-framework/node_modules/@vue/shared/dist/shared.esm-bundler.js.map +1 -0
  56. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -2
  57. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs.map +1 -1
  58. package/dist/prometheus-framework/src/components/Button/Button.vue.js +1 -2
  59. package/dist/prometheus-framework/src/components/Button/Button.vue.js.map +1 -1
  60. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +26 -41
  61. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs.map +1 -1
  62. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +27 -42
  63. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js.map +1 -1
  64. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  66. package/dist/prometheus-framework/src/components/FieldTags/BlockTags.vue.cjs +6 -8
  67. package/dist/prometheus-framework/src/components/FieldTags/BlockTags.vue.cjs.map +1 -1
  68. package/dist/prometheus-framework/src/components/FieldTags/BlockTags.vue.js +6 -8
  69. package/dist/prometheus-framework/src/components/FieldTags/BlockTags.vue.js.map +1 -1
  70. package/dist/prometheus-framework/src/components/Slider/Slider.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/components/Slider/Slider.vue.js +1 -1
  72. package/dist/prometheus-framework/src/components/UploadImage/UploadImage.vue.cjs +2 -1
  73. package/dist/prometheus-framework/src/components/UploadImage/UploadImage.vue.cjs.map +1 -1
  74. package/dist/prometheus-framework/src/components/UploadImage/UploadImage.vue.js +2 -1
  75. package/dist/prometheus-framework/src/components/UploadImage/UploadImage.vue.js.map +1 -1
  76. package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
  78. package/dist/prometheus-framework/src/modules/auth/views/components/layouts/Auth.vue.cjs +2 -2
  79. package/dist/prometheus-framework/src/modules/auth/views/components/layouts/Auth.vue.js +2 -2
  80. package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterCode.vue.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterCode.vue.js +1 -1
  82. package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
  84. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Invite.vue.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
  86. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
  88. package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignIn.vue.cjs +2 -1
  89. package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignIn.vue.cjs.map +1 -1
  90. package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignIn.vue.js +2 -1
  91. package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignIn.vue.js.map +1 -1
  92. package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignUp.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs +5 -0
  95. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs.map +1 -1
  96. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js +5 -0
  97. package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js.map +1 -1
  98. package/dist/prometheus-framework/src/modules/auth/views/middlewares/ownership.validation.cjs +44 -0
  99. package/dist/prometheus-framework/src/modules/auth/views/middlewares/ownership.validation.cjs.map +1 -0
  100. package/dist/prometheus-framework/src/modules/auth/views/middlewares/ownership.validation.js +44 -0
  101. package/dist/prometheus-framework/src/modules/auth/views/middlewares/ownership.validation.js.map +1 -0
  102. package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs +37 -35
  103. package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs.map +1 -1
  104. package/dist/prometheus-framework/src/modules/auth/views/store/auth.js +33 -31
  105. package/dist/prometheus-framework/src/modules/auth/views/store/auth.js.map +1 -1
  106. package/dist/prometheus-framework/src/modules/auth/views/store/twofa.cjs +3 -5
  107. package/dist/prometheus-framework/src/modules/auth/views/store/twofa.cjs.map +1 -1
  108. package/dist/prometheus-framework/src/modules/auth/views/store/twofa.js +2 -4
  109. package/dist/prometheus-framework/src/modules/auth/views/store/twofa.js.map +1 -1
  110. package/dist/prometheus-framework/src/modules/auth/views/validations/inputs.validation.cjs +8 -5
  111. package/dist/prometheus-framework/src/modules/auth/views/validations/inputs.validation.cjs.map +1 -1
  112. package/dist/prometheus-framework/src/modules/auth/views/validations/inputs.validation.js +8 -5
  113. package/dist/prometheus-framework/src/modules/auth/views/validations/inputs.validation.js.map +1 -1
  114. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.cjs +4 -2
  115. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.cjs.map +1 -1
  116. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.js +4 -2
  117. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.js.map +1 -1
  118. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +13 -9
  119. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs.map +1 -1
  120. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +14 -10
  121. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js.map +1 -1
  122. package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.cjs +53 -40
  123. package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.cjs.map +1 -1
  124. package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.js +58 -45
  125. package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.js.map +1 -1
  126. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +2 -2
  127. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +2 -2
  128. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs.map +1 -1
  130. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
  131. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js.map +1 -1
  132. package/dist/prometheus-framework/src/modules/community/components/sections/Comments.vue.cjs +16 -15
  133. package/dist/prometheus-framework/src/modules/community/components/sections/Comments.vue.cjs.map +1 -1
  134. package/dist/prometheus-framework/src/modules/community/components/sections/Comments.vue.js +16 -15
  135. package/dist/prometheus-framework/src/modules/community/components/sections/Comments.vue.js.map +1 -1
  136. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +4 -4
  137. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +4 -4
  138. package/dist/prometheus-framework/src/modules/community/router/blogposts.cjs +47 -43
  139. package/dist/prometheus-framework/src/modules/community/router/blogposts.cjs.map +1 -1
  140. package/dist/prometheus-framework/src/modules/community/router/blogposts.js +47 -43
  141. package/dist/prometheus-framework/src/modules/community/router/blogposts.js.map +1 -1
  142. package/dist/prometheus-framework/src/modules/community/store/blogposts.cjs +13 -20
  143. package/dist/prometheus-framework/src/modules/community/store/blogposts.cjs.map +1 -1
  144. package/dist/prometheus-framework/src/modules/community/store/blogposts.js +9 -16
  145. package/dist/prometheus-framework/src/modules/community/store/blogposts.js.map +1 -1
  146. package/dist/prometheus-framework/src/modules/community/store/reactions.cjs +5 -9
  147. package/dist/prometheus-framework/src/modules/community/store/reactions.cjs.map +1 -1
  148. package/dist/prometheus-framework/src/modules/community/store/reactions.js +1 -5
  149. package/dist/prometheus-framework/src/modules/community/store/reactions.js.map +1 -1
  150. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  151. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  152. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  153. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
  154. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +29 -54
  155. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs.map +1 -1
  156. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +30 -55
  157. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js.map +1 -1
  158. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +163 -134
  159. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs.map +1 -1
  160. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +165 -136
  161. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js.map +1 -1
  162. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  163. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
  164. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs +124 -135
  165. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs.map +1 -1
  166. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +133 -144
  167. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js.map +1 -1
  168. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs.map +1 -1
  169. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js.map +1 -1
  170. package/dist/prometheus-framework/src/modules/events/components/pages/EventsBackoffice.vue.cjs +96 -0
  171. package/dist/prometheus-framework/src/modules/events/components/pages/EventsBackoffice.vue.cjs.map +1 -0
  172. package/dist/prometheus-framework/src/modules/events/components/pages/EventsBackoffice.vue.js +96 -0
  173. package/dist/prometheus-framework/src/modules/events/components/pages/EventsBackoffice.vue.js.map +1 -0
  174. package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.cjs +1 -1
  175. package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.js +1 -1
  176. package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.cjs +39 -25
  177. package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.cjs.map +1 -1
  178. package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.js +40 -26
  179. package/dist/prometheus-framework/src/modules/events/components/sections/HeroEvent.vue.js.map +1 -1
  180. package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.cjs +1 -1
  181. package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.js +1 -1
  182. package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.cjs +4 -3
  183. package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.cjs.map +1 -1
  184. package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.js +4 -3
  185. package/dist/prometheus-framework/src/modules/events/components/sections/SectionPreviousEvents.vue.js.map +1 -1
  186. package/dist/prometheus-framework/src/modules/events/router/events.cjs +16 -5
  187. package/dist/prometheus-framework/src/modules/events/router/events.cjs.map +1 -1
  188. package/dist/prometheus-framework/src/modules/events/router/events.js +16 -5
  189. package/dist/prometheus-framework/src/modules/events/router/events.js.map +1 -1
  190. package/dist/prometheus-framework/src/modules/events/store/events.cjs +5 -6
  191. package/dist/prometheus-framework/src/modules/events/store/events.cjs.map +1 -1
  192. package/dist/prometheus-framework/src/modules/events/store/events.js +1 -2
  193. package/dist/prometheus-framework/src/modules/events/store/events.js.map +1 -1
  194. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +20 -11
  195. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs.map +1 -1
  196. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +20 -11
  197. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js.map +1 -1
  198. package/dist/prometheus-framework/src/modules/gallery/router/gallery.backoffice.router.cjs +5 -2
  199. package/dist/prometheus-framework/src/modules/gallery/router/gallery.backoffice.router.cjs.map +1 -1
  200. package/dist/prometheus-framework/src/modules/gallery/router/gallery.backoffice.router.js +5 -2
  201. package/dist/prometheus-framework/src/modules/gallery/router/gallery.backoffice.router.js.map +1 -1
  202. package/dist/prometheus-framework/src/modules/globals/globals.client.cjs +2 -0
  203. package/dist/prometheus-framework/src/modules/globals/globals.client.cjs.map +1 -1
  204. package/dist/prometheus-framework/src/modules/globals/globals.client.js +2 -0
  205. package/dist/prometheus-framework/src/modules/globals/globals.client.js.map +1 -1
  206. package/dist/prometheus-framework/src/modules/globals/views/classes/globals.store.cjs +4 -3
  207. package/dist/prometheus-framework/src/modules/globals/views/classes/globals.store.cjs.map +1 -1
  208. package/dist/prometheus-framework/src/modules/globals/views/classes/globals.store.js +4 -3
  209. package/dist/prometheus-framework/src/modules/globals/views/classes/globals.store.js.map +1 -1
  210. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/BlockFilter.vue.cjs +1 -1
  211. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/BlockFilter.vue.js +1 -1
  212. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/BlockSearch.vue.cjs +1 -1
  213. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/BlockSearch.vue.js +1 -1
  214. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/Card.vue.cjs +64 -0
  215. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/Card.vue.cjs.map +1 -0
  216. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/Card.vue.js +64 -0
  217. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/Card.vue.js.map +1 -0
  218. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +3 -3
  219. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/CardHeader.vue.cjs.map +1 -1
  220. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/CardHeader.vue.js +3 -3
  221. package/dist/prometheus-framework/src/modules/globals/views/components/blocks/CardHeader.vue.js.map +1 -1
  222. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/App.vue.cjs +1 -0
  223. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/App.vue.cjs.map +1 -1
  224. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/App.vue.js +1 -0
  225. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/App.vue.js.map +1 -1
  226. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.cjs +1 -19
  227. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
  228. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.js +1 -19
  229. package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
  230. package/dist/prometheus-framework/src/modules/globals/views/components/partials/LocationSelection.vue.cjs +2 -2
  231. package/dist/prometheus-framework/src/modules/globals/views/components/partials/LocationSelection.vue.js +2 -2
  232. package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs +3 -2
  233. package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs.map +1 -1
  234. package/dist/prometheus-framework/src/modules/globals/views/store/globals.js +3 -2
  235. package/dist/prometheus-framework/src/modules/globals/views/store/globals.js.map +1 -1
  236. package/dist/prometheus-framework/src/modules/globals/views/utils/axios-instance.cjs +17 -0
  237. package/dist/prometheus-framework/src/modules/globals/views/utils/axios-instance.cjs.map +1 -0
  238. package/dist/prometheus-framework/src/modules/globals/views/utils/axios-instance.js +17 -0
  239. package/dist/prometheus-framework/src/modules/globals/views/utils/axios-instance.js.map +1 -0
  240. package/dist/prometheus-framework/src/modules/globals/views/utils/vue-app-renderer.cjs +57 -0
  241. package/dist/prometheus-framework/src/modules/globals/views/utils/vue-app-renderer.cjs.map +1 -0
  242. package/dist/prometheus-framework/src/modules/globals/views/utils/vue-app-renderer.js +57 -0
  243. package/dist/prometheus-framework/src/modules/globals/views/utils/vue-app-renderer.js.map +1 -0
  244. package/dist/prometheus-framework/src/modules/landing/components/sections/SectionGuide.vue.cjs +1 -1
  245. package/dist/prometheus-framework/src/modules/landing/components/sections/SectionGuide.vue.js +1 -1
  246. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +2 -2
  247. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  248. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  249. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
  250. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  251. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
  252. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
  253. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
  254. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +3 -3
  255. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +3 -3
  256. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +6 -7
  257. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs.map +1 -1
  258. package/dist/prometheus-framework/src/modules/orders/store/orders.js +1 -2
  259. package/dist/prometheus-framework/src/modules/orders/store/orders.js.map +1 -1
  260. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  261. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +1 -1
  262. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  263. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  264. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  265. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
  266. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +60 -23
  267. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs.map +1 -1
  268. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +60 -23
  269. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js.map +1 -1
  270. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +2 -1
  271. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs.map +1 -1
  272. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +3 -2
  273. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js.map +1 -1
  274. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  275. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
  276. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +2 -2
  277. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTabSection.vue.js +2 -2
  278. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +2 -2
  279. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
  280. package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.cjs +1 -1
  281. package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.js +1 -1
  282. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  283. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
  284. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +2 -2
  285. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
  286. package/dist/prometheus-framework/src/modules/organizations/router/organizations.cjs +2 -0
  287. package/dist/prometheus-framework/src/modules/organizations/router/organizations.cjs.map +1 -1
  288. package/dist/prometheus-framework/src/modules/organizations/router/organizations.js +2 -0
  289. package/dist/prometheus-framework/src/modules/organizations/router/organizations.js.map +1 -1
  290. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +11 -9
  291. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs.map +1 -1
  292. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +6 -4
  293. package/dist/prometheus-framework/src/modules/organizations/store/departments.js.map +1 -1
  294. package/dist/prometheus-framework/src/modules/organizations/store/organizations.cjs +5 -11
  295. package/dist/prometheus-framework/src/modules/organizations/store/organizations.cjs.map +1 -1
  296. package/dist/prometheus-framework/src/modules/organizations/store/organizations.js +1 -7
  297. package/dist/prometheus-framework/src/modules/organizations/store/organizations.js.map +1 -1
  298. package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +807 -801
  299. package/dist/prometheus-framework/src/modules/pages/pages.client.js +807 -801
  300. package/dist/prometheus-framework/src/modules/pages/views/components/blocks/CardPage.vue.cjs +2 -2
  301. package/dist/prometheus-framework/src/modules/pages/views/components/blocks/CardPage.vue.js +2 -2
  302. package/dist/prometheus-framework/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -1
  303. package/dist/prometheus-framework/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
  304. package/dist/prometheus-framework/src/modules/pages/views/router/pages.backoffice.router.cjs +5 -10
  305. package/dist/prometheus-framework/src/modules/pages/views/router/pages.backoffice.router.cjs.map +1 -1
  306. package/dist/prometheus-framework/src/modules/pages/views/router/pages.backoffice.router.js +5 -10
  307. package/dist/prometheus-framework/src/modules/pages/views/router/pages.backoffice.router.js.map +1 -1
  308. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  309. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  310. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs +12 -7
  311. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs.map +1 -1
  312. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +12 -7
  313. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js.map +1 -1
  314. package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.cjs +1 -1
  315. package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.js +1 -1
  316. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  317. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  318. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  319. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  320. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  321. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  322. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  323. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  324. package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.cjs +1 -1
  325. package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
  326. package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.js +1 -1
  327. package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.js.map +1 -1
  328. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  329. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
  330. package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
  331. package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
  332. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +2 -2
  333. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +2 -2
  334. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  335. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  336. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +2 -2
  337. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
  338. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  339. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  340. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
  341. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.js +1 -1
  342. package/dist/prometheus-framework/src/modules/products/store/categories.cjs +7 -8
  343. package/dist/prometheus-framework/src/modules/products/store/categories.cjs.map +1 -1
  344. package/dist/prometheus-framework/src/modules/products/store/categories.js +1 -2
  345. package/dist/prometheus-framework/src/modules/products/store/categories.js.map +1 -1
  346. package/dist/prometheus-framework/src/modules/products/store/leftovers.cjs +6 -7
  347. package/dist/prometheus-framework/src/modules/products/store/leftovers.cjs.map +1 -1
  348. package/dist/prometheus-framework/src/modules/products/store/leftovers.js +1 -2
  349. package/dist/prometheus-framework/src/modules/products/store/leftovers.js.map +1 -1
  350. package/dist/prometheus-framework/src/modules/products/store/products.cjs +10 -21
  351. package/dist/prometheus-framework/src/modules/products/store/products.cjs.map +1 -1
  352. package/dist/prometheus-framework/src/modules/products/store/products.js +1 -12
  353. package/dist/prometheus-framework/src/modules/products/store/products.js.map +1 -1
  354. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs.map +1 -1
  355. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js.map +1 -1
  356. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  357. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
  358. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
  359. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
  360. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +3 -3
  361. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +3 -3
  362. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.cjs +1 -1
  363. package/dist/prometheus-framework/src/modules/spots/components/pages/Spot.vue.js +1 -1
  364. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +3 -3
  365. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +3 -3
  366. package/dist/prometheus-framework/src/modules/spots/store/spots.cjs +6 -9
  367. package/dist/prometheus-framework/src/modules/spots/store/spots.cjs.map +1 -1
  368. package/dist/prometheus-framework/src/modules/spots/store/spots.js +1 -4
  369. package/dist/prometheus-framework/src/modules/spots/store/spots.js.map +1 -1
  370. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +4 -4
  371. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs.map +1 -1
  372. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +4 -4
  373. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js.map +1 -1
  374. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  375. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +1 -1
  376. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  377. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  378. package/dist/prometheus-framework/src/modules/users/router/users.cjs +2 -2
  379. package/dist/prometheus-framework/src/modules/users/router/users.cjs.map +1 -1
  380. package/dist/prometheus-framework/src/modules/users/router/users.js +2 -2
  381. package/dist/prometheus-framework/src/modules/users/router/users.js.map +1 -1
  382. package/dist/prometheus-framework/src/modules/users/store/users.cjs +5 -6
  383. package/dist/prometheus-framework/src/modules/users/store/users.cjs.map +1 -1
  384. package/dist/prometheus-framework/src/modules/users/store/users.js +1 -2
  385. package/dist/prometheus-framework/src/modules/users/store/users.js.map +1 -1
  386. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.cjs +1 -1
  387. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.js +1 -1
  388. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
  389. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
  390. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +2 -2
  391. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
  392. package/dist/prometheus-framework.cjs.js +17 -17
  393. package/dist/prometheus-framework.es.js +1790 -1790
  394. package/dist/queryProcessor-CU4A6Y4N.mjs +197 -0
  395. package/dist/queryProcessor-CcsJEUBr.js +196 -0
  396. package/dist/spots.server.js +1 -1
  397. package/dist/spots.server.mjs +1 -1
  398. package/dist/verifyAccesses-BsrJOct8.mjs +90 -0
  399. package/dist/verifyAccesses-BvLnOtBN.js +89 -0
  400. package/dist/wallet.server.js +2 -2
  401. package/dist/wallet.server.mjs +2 -2
  402. package/package.json +1 -1
  403. package/src/builder/modes/ssr.dev.js +2 -2
  404. package/src/builder/modes/ssr.prod.js +4 -4
  405. package/src/builder/ssr/ssr-render-html.js +11 -13
  406. package/src/builder/templates/page.html +37 -0
  407. package/src/builder/templates/page.js +4 -0
  408. package/src/builder/webpack/webpack.config.client.js +9 -6
  409. package/src/builder/webpack/webpack.config.ssr.js +1 -1
  410. package/src/components/Button/Button.vue +0 -1
  411. package/src/components/Feed/Feed.vue +34 -55
  412. package/src/components/FieldTags/BlockTags.vue +0 -1
  413. package/src/components/UploadImage/UploadImage.vue +2 -1
  414. package/src/modules/auth/controllers/middlewares/authJwt.js +1 -1
  415. package/src/modules/auth/controllers/middlewares/verifySignUp.js +11 -11
  416. package/src/modules/auth/controllers/routes/auth.routes.js +2 -2
  417. package/src/modules/auth/controllers/services/auth.service.js +1 -0
  418. package/src/modules/auth/views/components/pages/SignIn.vue +1 -0
  419. package/src/modules/auth/views/middlewares/auth.validation.js +17 -1
  420. package/src/modules/auth/views/middlewares/ownership.validation.js +60 -0
  421. package/src/modules/auth/views/store/auth.js +43 -39
  422. package/src/modules/auth/views/store/twofa.js +2 -5
  423. package/src/modules/auth/views/validations/inputs.validation.js +12 -6
  424. package/src/modules/community/components/blocks/CardBlogpost.vue +3 -1
  425. package/src/modules/community/components/layouts/Community.vue +7 -9
  426. package/src/modules/community/components/pages/BlogPost.vue +122 -123
  427. package/src/modules/community/components/pages/CreateBlogPost.vue +1 -1
  428. package/src/modules/community/components/sections/Comments.vue +5 -5
  429. package/src/modules/community/controllers/blog.controller.js +1 -1
  430. package/src/modules/community/models/blogpost.model.js +1 -1
  431. package/src/modules/community/router/blogposts.js +40 -33
  432. package/src/modules/community/routes/blog.routes.js +4 -0
  433. package/src/modules/community/store/blogposts.js +11 -19
  434. package/src/modules/community/store/reactions.js +1 -7
  435. package/src/modules/events/components/elements/ButtonCheck.vue +36 -66
  436. package/src/modules/events/components/pages/EditEvent.vue +76 -59
  437. package/src/modules/events/components/pages/Event.vue +2 -15
  438. package/src/modules/events/components/pages/Events.vue +2 -1
  439. package/src/modules/events/components/pages/EventsBackoffice.vue +122 -0
  440. package/src/modules/events/components/sections/HeroEvent.vue +15 -17
  441. package/src/modules/events/components/sections/SectionPreviousEvents.vue +4 -13
  442. package/src/modules/events/router/events.js +11 -4
  443. package/src/modules/events/store/events.js +2 -4
  444. package/src/modules/gallery/components/sections/BackofficeGallery.vue +24 -13
  445. package/src/modules/gallery/controllers/gallery.controller.js +30 -31
  446. package/src/modules/gallery/router/gallery.backoffice.router.js +5 -1
  447. package/src/modules/gallery/routes/gallery.routes.js +22 -4
  448. package/src/modules/globals/controllers/utils/queryProcessor.js +24 -4
  449. package/src/modules/globals/globals.client.js +2 -0
  450. package/src/modules/globals/views/classes/globals.store.js +4 -3
  451. package/src/modules/globals/views/components/blocks/Card.vue +56 -0
  452. package/src/modules/globals/views/components/blocks/CardHeader.vue +1 -3
  453. package/src/modules/globals/views/components/layouts/App.vue +1 -0
  454. package/src/modules/globals/views/components/layouts/Client.vue +0 -30
  455. package/src/modules/globals/views/store/globals.js +4 -2
  456. package/src/modules/globals/views/utils/axios-instance.js +18 -0
  457. package/src/modules/globals/views/utils/vue-app-renderer.js +87 -0
  458. package/src/modules/integrations/stripe/controllers/services/stripe.service.js +15 -30
  459. package/src/modules/landing/components/pages/Governance.vue +4 -2
  460. package/src/modules/landing/components/sections/SectionHeroToken.vue +12 -10
  461. package/src/modules/landing/components/sections/SectionsSection.vue +5 -8
  462. package/src/modules/landing/router/landing.js +2 -1
  463. package/src/modules/orders/store/orders.js +1 -3
  464. package/src/modules/organizations/components/pages/DepartmentEdit.vue +36 -0
  465. package/src/modules/organizations/components/pages/OrganizationBackoffice.vue +3 -1
  466. package/src/modules/organizations/controllers/organizations.controller.js +28 -35
  467. package/src/modules/organizations/middlewares/verifyAccesses.js +117 -0
  468. package/src/modules/organizations/models/department.model.js +3 -86
  469. package/src/modules/organizations/models/organization.model.js +6 -4
  470. package/src/modules/organizations/models/schemas/accesses.schema.js +142 -0
  471. package/src/modules/organizations/router/organizations.js +2 -0
  472. package/src/modules/organizations/store/departments.js +6 -6
  473. package/src/modules/organizations/store/organizations.js +2 -16
  474. package/src/modules/pages/views/router/pages.backoffice.router.js +5 -7
  475. package/src/modules/products/components/blocks/CardProduct.vue +2 -0
  476. package/src/modules/products/components/pages/Product.vue +1 -1
  477. package/src/modules/products/components/sections/MenuSection.vue +2 -2
  478. package/src/modules/products/controllers/products.controller.js +201 -367
  479. package/src/modules/products/routes/products.routes.js +0 -5
  480. package/src/modules/products/store/categories.js +1 -2
  481. package/src/modules/products/store/leftovers.js +1 -2
  482. package/src/modules/products/store/products.js +1 -13
  483. package/src/modules/reports/components/sections/FormReport.vue +20 -20
  484. package/src/modules/spots/store/spots.js +1 -6
  485. package/src/modules/users/components/pages/Profile.vue +1 -1
  486. package/src/modules/users/router/users.js +2 -2
  487. package/src/modules/users/store/users.js +1 -3
  488. package/src/styles/base/all.scss +0 -2
  489. package/src/styles/config.scss +6 -0
  490. package/src/modules/auth/controllers/middlewares/verifyAccesses.js +0 -114
  491. package/src/modules/users/components/pages/ProfileEvents.vue +0 -69
@@ -0,0 +1,44 @@
1
+ import { state } from "../store/auth.js";
2
+ import { read } from "../../../community/store/blogposts.js";
3
+ import { useGlobalMixins } from "../../../globals/views/mixins/mixins.js";
4
+ const { hasAccess } = useGlobalMixins();
5
+ async function requiresEditAccess(to, from, next) {
6
+ to.params.url;
7
+ const userId = state.user._id;
8
+ try {
9
+ const post = (await read({ url: to.params.url }))[0];
10
+ console.log("post is", post);
11
+ if (!post) {
12
+ return next("/404");
13
+ }
14
+ if (post.owner.type === "organization") {
15
+ const isAccess = hasAccess(post.owner.target._id, "posts", "edit", state.accesses);
16
+ if (!isAccess) {
17
+ return next("/401");
18
+ }
19
+ } else {
20
+ if (post.creator.target._id !== userId) {
21
+ return next("/401");
22
+ }
23
+ }
24
+ next();
25
+ } catch (error) {
26
+ console.error("Error during post access check:", error);
27
+ return next("/500");
28
+ }
29
+ }
30
+ function requiresAccess(resource, action) {
31
+ return (to, from, next) => {
32
+ const isAccess = hasAccess(to.params._id, resource, action, state.accesses);
33
+ if (isAccess) {
34
+ return next();
35
+ } else {
36
+ return next("/401");
37
+ }
38
+ };
39
+ }
40
+ export {
41
+ requiresAccess,
42
+ requiresEditAccess
43
+ };
44
+ //# sourceMappingURL=ownership.validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ownership.validation.js","sources":["../../../../../../../src/modules/auth/views/middlewares/ownership.validation.js"],"sourcesContent":["import * as auth from '@pf/src/modules/auth/views/store/auth'\nimport * as blog from '@pf/src/modules/community/store/blogposts.js';\n\nimport { useGlobalMixins } from \"@pf/src/modules/globals/views/mixins/mixins.js\"\n\nconst { hasAccess } = useGlobalMixins()\n\nasync function requiresEditAccess(to, from, next) {\n const postId = to.params.url; // Предполагается, что `url` является идентификатором поста\n const userId = auth.state.user._id; // Получаем текущего пользователя\n\n try {\n // Получаем данные поста, чтобы проверить его принадлежность к организации или авторство\n const post = (await blog.read({ url: to.params.url }))[0];\n\n console.log('post is', post)\n\n if (!post) {\n return next('/404'); // Если пост не найден, перенаправляем на страницу 404\n }\n\n if (post.owner.type === 'organization') {\n // Если пост принадлежит организации, проверяем права на редактирование через `hasAccess`\n const isAccess = hasAccess(post.owner.target._id, 'posts', 'edit', auth.state.accesses);\n\n if (!isAccess) {\n return next('/401'); // Если у пользователя нет прав на редактирование в организации, перенаправляем на 403\n }\n } else {\n // Если пост не принадлежит организации, проверяем авторство\n if (post.creator.target._id !== userId) {\n return next('/401'); // Если пользователь не является автором, перенаправляем на 403\n }\n }\n\n next(); // Если все проверки прошли, продолжаем\n } catch (error) {\n console.error(\"Error during post access check:\", error);\n return next('/500'); // Если произошла ошибка, перенаправляем на страницу 500\n }\n}\n\nfunction requiresAccess(resource, action) {\n return (to, from, next) => {\n\n const isAccess = hasAccess(to.params._id, resource, action, auth.state.accesses)\n \n if (isAccess) {\n return next();\n } else {\n return next('/401');\n }\n };\n};\n\n\nexport {\n requiresEditAccess,\n requiresAccess\n}"],"names":["auth.state","blog.read"],"mappings":";;;AAKA,MAAM,EAAE,UAAW,IAAG,gBAAiB;AAEvC,eAAe,mBAAmB,IAAI,MAAM,MAAM;AACjC,KAAG,OAAO;AACzB,QAAM,SAASA,MAAW,KAAK;AAE/B,MAAI;AAEF,UAAM,QAAQ,MAAMC,KAAU,EAAE,KAAK,GAAG,OAAO,IAAG,CAAE,GAAG,CAAC;AAExD,YAAQ,IAAI,WAAW,IAAI;AAE3B,QAAI,CAAC,MAAM;AACT,aAAO,KAAK,MAAM;AAAA,IACnB;AAED,QAAI,KAAK,MAAM,SAAS,gBAAgB;AAEtC,YAAM,WAAW,UAAU,KAAK,MAAM,OAAO,KAAK,SAAS,QAAQD,MAAW,QAAQ;AAEtF,UAAI,CAAC,UAAU;AACb,eAAO,KAAK,MAAM;AAAA,MACnB;AAAA,IACP,OAAW;AAEL,UAAI,KAAK,QAAQ,OAAO,QAAQ,QAAQ;AACtC,eAAO,KAAK,MAAM;AAAA,MACnB;AAAA,IACF;AAED;EACD,SAAQ,OAAO;AACd,YAAQ,MAAM,mCAAmC,KAAK;AACtD,WAAO,KAAK,MAAM;AAAA,EACnB;AACH;AAEA,SAAS,eAAe,UAAU,QAAQ;AACxC,SAAO,CAAC,IAAI,MAAM,SAAS;AAEzB,UAAM,WAAW,UAAU,GAAG,OAAO,KAAK,UAAU,QAAQA,MAAW,QAAQ;AAE/E,QAAI,UAAU;AACZ,aAAO,KAAI;AAAA,IACjB,OAAW;AACL,aAAO,KAAK,MAAM;AAAA,IACnB;AAAA,EACL;AACA;"}
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const axios = require("axios");
3
+ const axiosInstance = require("../../../globals/views/utils/axios-instance.cjs");
4
4
  const js_cookie = require("../../../../../../node_modules/js-cookie/dist/js.cookie.cjs");
5
5
  const index = require("../../../../../node_modules/@capacitor/preferences/dist/esm/index.cjs");
6
6
  const vue = require("vue");
7
7
  const globals = require("../../../globals/views/store/globals.cjs");
8
8
  const twofa = require("./twofa.cjs");
9
- const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });
10
9
  const state = vue.reactive({
11
10
  user: {
12
11
  _id: void 0,
@@ -23,36 +22,40 @@ const state = vue.reactive({
23
22
  },
24
23
  accesses: []
25
24
  });
26
- async function initialize() {
27
- try {
28
- const userCookie = await getCookie("user");
29
- console.log("cookie is", userCookie);
30
- if (userCookie) {
31
- const { _id, email, phone, roles, accessToken } = userCookie;
32
- console.log("accessToken is", accessToken);
33
- $axios.interceptors.request.use((config) => {
34
- config.headers["x-access-token"] = accessToken;
35
- return config;
36
- }, (error) => {
37
- return Promise.reject(error);
38
- });
39
- const response = await $axios.get("/api/auth/check-accesses");
40
- const userAccesses = response.data;
41
- Object.assign(state.user, { _id, email, phone });
42
- Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });
43
- state.accesses = userAccesses;
44
- }
45
- } catch (error) {
46
- console.error("Error initializing app:", error);
47
- removeCookie("user");
48
- state.accesses = [];
49
- }
50
- }
51
- initialize();
52
25
  const actions = {
26
+ async initialize(cookie) {
27
+ try {
28
+ const userCookie = cookie ? cookie : await getCookie("user");
29
+ if (userCookie) {
30
+ const { _id, email, phone, roles, accessToken } = userCookie;
31
+ axiosInstance.setAuthToken(accessToken);
32
+ const response = await axiosInstance.default.get("/api/auth/check-accesses");
33
+ const userAccesses = response.data;
34
+ Object.assign(state.user, { _id, email, phone });
35
+ Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });
36
+ state.accesses = userAccesses;
37
+ }
38
+ } catch (error) {
39
+ console.error("Error initializing auth:", error);
40
+ removeCookie("user");
41
+ state.accesses = [];
42
+ state.user = {
43
+ _id: void 0,
44
+ username: "",
45
+ email: "",
46
+ phone: "",
47
+ password: "",
48
+ passwordRepeat: ""
49
+ }, state.access = {
50
+ roles: null,
51
+ token: null,
52
+ status: false
53
+ }, globals.setError(error);
54
+ }
55
+ },
53
56
  async login(user, type) {
54
57
  try {
55
- const response = await $axios.post("/api/auth/signin", {
58
+ const response = await axiosInstance.default.post("/api/auth/signin", {
56
59
  ...user,
57
60
  type
58
61
  });
@@ -65,7 +68,7 @@ const actions = {
65
68
  status: true,
66
69
  roles: response.data.roles
67
70
  });
68
- await initialize();
71
+ await this.initialize();
69
72
  return response.data;
70
73
  } catch (error) {
71
74
  Object.assign(state.access, {
@@ -92,7 +95,7 @@ const actions = {
92
95
  throw new Error(error.response.status);
93
96
  }
94
97
  try {
95
- const response = await $axios.post("/api/auth/signup", {
98
+ const response = await axiosInstance.default.post("/api/auth/signup", {
96
99
  ...user,
97
100
  type,
98
101
  inviteCode: invite
@@ -109,7 +112,7 @@ const actions = {
109
112
  status: true,
110
113
  roles: response.data.roles
111
114
  });
112
- await initialize();
115
+ await this.initialize();
113
116
  return response.data;
114
117
  } catch (error) {
115
118
  globals.setError(error);
@@ -136,7 +139,7 @@ const actions = {
136
139
  },
137
140
  async resetPassword(user, type) {
138
141
  try {
139
- const response = await $axios.post("/api/auth/reset-password", {
142
+ const response = await axiosInstance.default.post("/api/auth/reset-password", {
140
143
  email: user.email,
141
144
  phone: user.phone,
142
145
  type
@@ -163,7 +166,7 @@ const actions = {
163
166
  throw new Error(error.response.status);
164
167
  }
165
168
  try {
166
- const response = await $axios.post("/api/auth/update-password", {
169
+ const response = await axiosInstance.default.post("/api/auth/update-password", {
167
170
  email: user.email,
168
171
  phone: user.phone,
169
172
  password: user.password,
@@ -221,6 +224,5 @@ function removeCookie(name, env = process.env.NODE_ENV) {
221
224
  vue.watch(state, (newState, oldState) => {
222
225
  });
223
226
  exports.actions = actions;
224
- exports.initialize = initialize;
225
227
  exports.state = state;
226
228
  //# sourceMappingURL=auth.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.cjs","sources":["../../../../../../../src/modules/auth/views/store/auth.js"],"sourcesContent":[" // Dependencies\n import axios from 'axios';\n import Cookies from 'js-cookie'\n // Capacitor\n import { Preferences } from '@capacitor/preferences';\n // Vue modules\n import { reactive, watch } from \"vue\";\n // Globals \n import { setError } from '@pf/src/modules/globals/views/store/globals'\n // State\n import * as twofa from './twofa'\n // Setup Axios\n const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });\n // State\n const state = reactive({\n user: {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n },\n access: {\n roles: null,\n token: null,\n status: false\n },\n accesses: [\n ]\n });\n\n async function initialize() {\n try {\n const userCookie = await getCookie('user');\n\n console.log('cookie is', userCookie)\n\n if (userCookie) {\n const { _id, email, phone, roles, accessToken } = userCookie;\n\n console.log('accessToken is', accessToken)\n\n // Установка токена в Axios интерцептор для всех запросов\n $axios.interceptors.request.use(config => {\n config.headers['x-access-token'] = accessToken;\n return config;\n }, error => {\n return Promise.reject(error);\n });\n\n // Проверка токена через серверный маршрут\n const response = await $axios.get('/api/auth/check-accesses');\n const userAccesses = response.data;\n\n // Обновление состояния приложения с информацией о пользователе и его правах доступа\n Object.assign(state.user, { _id, email, phone });\n Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });\n\n // console.log('roles by initilioze is', state.access.roles)\n state.accesses = userAccesses;\n }\n } catch (error) {\n console.error('Error initializing app:', error);\n removeCookie('user'); \n state.accesses = [];\n }\n }\n\n initialize();\n\n const actions = {\n async login(user, type) {\n try {\n const response = await $axios.post('/api/auth/signin', {\n ...user,\n type\n })\n\n setCookie('user', response.data);\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await initialize();\n\n return response.data;\n } catch (error) {\n\n Object.assign(state.access, {\n token: null,\n status: false,\n roles: null\n });\n\n console.log(error)\n setError(error)\n return Promise.reject(error);\n }\n },\n\n async signup(user, type, invite) {\n \n const { password, passwordRepeat } = state.user;\n\n console.log(password)\n console.log(passwordRepeat)\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/signup', {\n ...user,\n type,\n inviteCode: invite\n });\n\n console.log(response)\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await initialize();\n\n return response.data;\n } catch (error) {\n setError(error);\n console.log('Sign up falied');\n throw error;\n }\n },\n\n logout() {\n removeCookie('user');\n\n Object.assign(state.user, {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n });\n\n Object.assign(state.access, {\n roles: null,\n token: null,\n status: false\n });\n\n state.accesses = []\n },\n\n async resetPassword(user, type) {\n try {\n const response = await $axios.post('/api/auth/reset-password', {\n email: user.email,\n phone: user.phone,\n type\n });\n\n Object.assign(twofa.state.code, {\n ...response.data,\n isSended: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n },\n\n async updatePassword(user, type) {\n const { password, passwordRepeat } = state.user;\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/update-password', {\n email: user.email,\n phone: user.phone,\n password: user.password,\n passwordRepeat: user.passwordRepeat,\n type\n });\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n }\n };\n\n // Cookies\n const optionsDefault = {\n development: { secure: false, expires: 7, sameSite: 'Lax' },\n production: { expires: 7, path: '/', domain: process.env.DOMAIN_URL, sameSite: 'none', secure: true }\n };\n\n async function getCookie(name) {\n if (process.env.MOBILE_APP) {\n const { value } = await Preferences.get({ key: name });\n return value ? JSON.parse(value) : null;\n } else {\n const cookie = Cookies.get(name);\n return cookie ? JSON.parse(cookie) : null;\n }\n }\n\n function setCookie(name, data, env = process.env.DOMAIN_URL) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.set({\n key: name,\n value: JSON.stringify(data)\n });\n } else {\n // Для веб-версии\n Cookies.set(name, JSON.stringify(data), optionsDefault[env]);\n }\n }\n\n function removeCookie(name, env = process.env.NODE_ENV) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.remove({ key: name });\n } else {\n // Для веб-версии\n const options = env === 'production' ? { domain: process.env.DOMAIN_URL } : {};\n Cookies.remove(name, options);\n }\n }\n\n // // History\n const history = []\n history.push(state)\n\n // // Watch\n watch(state, (newState, oldState) => {\n history.push(newState)\n })\n\n // Module Export\n export {\n state,\n initialize,\n actions\n };"],"names":["reactive","setError","twofa.state","Preferences","Cookies","watch"],"mappings":";;;;;;;;AAYE,MAAM,SAAS,MAAM,OAAO,EAAE,SAAS,QAAQ,IAAI,SAAS,iBAAiB,KAAM,CAAA;AAE9E,MAAC,QAAQA,IAAAA,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,IACV,gBAAgB;AAAA,EACjB;AAAA,EACD,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,IACP,QAAQ;AAAA,EACT;AAAA,EACD,UAAU,CACT;AACL,CAAG;AAED,eAAe,aAAa;AAC1B,MAAI;AACF,UAAM,aAAa,MAAM,UAAU,MAAM;AAEzC,YAAQ,IAAI,aAAa,UAAU;AAEnC,QAAI,YAAY;AACd,YAAM,EAAE,KAAK,OAAO,OAAO,OAAO,YAAa,IAAG;AAElD,cAAQ,IAAI,kBAAkB,WAAW;AAGzC,aAAO,aAAa,QAAQ,IAAI,YAAU;AACxC,eAAO,QAAQ,gBAAgB,IAAI;AACnC,eAAO;AAAA,MACR,GAAE,WAAS;AACV,eAAO,QAAQ,OAAO,KAAK;AAAA,MACrC,CAAS;AAGD,YAAM,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,IAAI,YAAY;AAC1B,UAAM,EAAE,MAAO,IAAG,MAAME,MAAW,YAAC,IAAI,EAAE,KAAK,KAAI,CAAE;AACrD,WAAO,QAAQ,KAAK,MAAM,KAAK,IAAI;AAAA,EACzC,OAAW;AACL,UAAM,SAASC,UAAAA,QAAQ,IAAI,IAAI;AAC/B,WAAO,SAAS,KAAK,MAAM,MAAM,IAAI;AAAA,EACtC;AACF;AAED,SAAS,UAAU,MAAM,MAAM,MAAM,QAAQ,IAAI,YAAY;AAC3D,MAAI,QAAQ,IAAI,YAAY;AAE1BD,UAAAA,YAAY,IAAI;AAAA,MACd,KAAK;AAAA,MACL,OAAO,KAAK,UAAU,IAAI;AAAA,IAClC,CAAO;AAAA,EACP,OAAW;AAELC,sBAAQ,IAAI,MAAM,KAAK,UAAU,IAAI,GAAG,eAAe,GAAG,CAAC;AAAA,EAC5D;AACF;AAED,SAAS,aAAa,MAAM,MAAM,QAAQ,IAAI,UAAU;AACtD,MAAI,QAAQ,IAAI,YAAY;AAE1BD,UAAAA,YAAY,OAAO,EAAE,KAAK,KAAM,CAAA;AAAA,EACtC,OAAW;AAEL,UAAM,UAAU,QAAQ,eAAe,EAAE,QAAQ,QAAQ,IAAI,WAAY,IAAG;AAC5EC,cAAAA,QAAQ,OAAO,MAAM,OAAO;AAAA,EAC7B;AACF;AAODC,IAAAA,MAAM,OAAO,CAAC,UAAU,aAAa;AAEpC,CAAA;;;;"}
1
+ {"version":3,"file":"auth.cjs","sources":["../../../../../../../src/modules/auth/views/store/auth.js"],"sourcesContent":[" // Dependencies\n import $axios, { setAuthToken } from '@pf/src/modules/globals/views/utils/axios-instance.js';\n import Cookies from 'js-cookie'\n // Capacitor\n import { Preferences } from '@capacitor/preferences';\n // Vue modules\n import { reactive, watch } from \"vue\";\n // Globals \n import { setError } from '@pf/src/modules/globals/views/store/globals'\n // State\n import * as twofa from './twofa'\n // Setup Axios\n // const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });\n // const $axios = axios.create({\n // baseURL: process.env.API_URL,\n // withCredentials: true\n // });\n // State\n const state = reactive({\n user: {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n },\n access: {\n roles: null,\n token: null,\n status: false\n },\n accesses: [\n ]\n });\n\n const actions = {\n async initialize(cookie) {\n try {\n const userCookie = cookie ? cookie : await getCookie('user');\n\n if (userCookie) {\n const { _id, email, phone, roles, accessToken } = userCookie;\n\n setAuthToken(accessToken);\n\n // Проверка токена через серверный маршрут\n const response = await $axios.get('/api/auth/check-accesses');\n const userAccesses = response.data;\n\n // Обновление состояния приложения с информацией о пользователе и его правах доступа\n Object.assign(state.user, { _id, email, phone });\n Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });\n\n state.accesses = userAccesses;\n }\n } catch (error) {\n console.error('Error initializing auth:', error);\n removeCookie('user'); \n state.accesses = [];\n state.user = {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n },\n state.access = {\n roles: null,\n token: null,\n status: false\n },\n setError(error)\n // return Promise.reject(error);\n }\n },\n async login(user, type) {\n try {\n const response = await $axios.post('/api/auth/signin', {\n ...user,\n type\n })\n\n setCookie('user', response.data);\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await this.initialize();\n\n return response.data;\n } catch (error) {\n\n Object.assign(state.access, {\n token: null,\n status: false,\n roles: null\n });\n\n console.log(error)\n setError(error)\n return Promise.reject(error);\n }\n },\n\n async signup(user, type, invite) {\n \n const { password, passwordRepeat } = state.user;\n\n console.log(password)\n console.log(passwordRepeat)\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/signup', {\n ...user,\n type,\n inviteCode: invite\n });\n\n console.log(response)\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await this.initialize();\n\n return response.data;\n } catch (error) {\n setError(error);\n console.log('Sign up falied');\n throw error;\n }\n },\n\n logout() {\n removeCookie('user');\n\n Object.assign(state.user, {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n });\n\n Object.assign(state.access, {\n roles: null,\n token: null,\n status: false\n });\n\n state.accesses = []\n },\n\n async resetPassword(user, type) {\n try {\n const response = await $axios.post('/api/auth/reset-password', {\n email: user.email,\n phone: user.phone,\n type\n });\n\n Object.assign(twofa.state.code, {\n ...response.data,\n isSended: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n },\n\n async updatePassword(user, type) {\n const { password, passwordRepeat } = state.user;\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/update-password', {\n email: user.email,\n phone: user.phone,\n password: user.password,\n passwordRepeat: user.passwordRepeat,\n type\n });\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n }\n };\n\n // Cookies\n const optionsDefault = {\n development: { secure: false, expires: 7, sameSite: 'Lax' },\n production: { expires: 7, path: '/', domain: process.env.DOMAIN_URL, sameSite: 'none', secure: true }\n };\n\n async function getCookie(name) {\n if (process.env.MOBILE_APP) {\n const { value } = await Preferences.get({ key: name });\n return value ? JSON.parse(value) : null;\n } else {\n const cookie = Cookies.get(name);\n return cookie ? JSON.parse(cookie) : null;\n }\n }\n\n function setCookie(name, data, env = process.env.DOMAIN_URL) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.set({\n key: name,\n value: JSON.stringify(data)\n });\n } else {\n // Для веб-версии\n Cookies.set(name, JSON.stringify(data), optionsDefault[env]);\n }\n }\n\n function removeCookie(name, env = process.env.NODE_ENV) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.remove({ key: name });\n } else {\n // Для веб-версии\n const options = env === 'production' ? { domain: process.env.DOMAIN_URL } : {};\n Cookies.remove(name, options);\n }\n }\n\n // // History\n const history = []\n history.push(state)\n\n // // Watch\n watch(state, (newState, oldState) => {\n history.push(newState)\n })\n\n // Module Export\n export {\n state,\n actions\n };"],"names":["reactive","setAuthToken","$axios","setError","twofa.state","Preferences","Cookies","watch"],"mappings":";;;;;;;;AAkBO,MAAC,QAAQA,IAAAA,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,IACV,gBAAgB;AAAA,EACjB;AAAA,EACD,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,IACP,QAAQ;AAAA,EACT;AAAA,EACD,UAAU,CACT;AACL,CAAG;AAEI,MAAC,UAAU;AAAA,EACd,MAAM,WAAW,QAAQ;AACvB,QAAI;AACF,YAAM,aAAa,SAAS,SAAS,MAAM,UAAU,MAAM;AAE3D,UAAI,YAAY;AACd,cAAM,EAAE,KAAK,OAAO,OAAO,OAAO,YAAa,IAAG;AAElDC,sBAAY,aAAC,WAAW;AAGxB,cAAM,WAAW,MAAMC,cAAAA,QAAO,IAAI,0BAA0B;AAC5D,cAAM,eAAe,SAAS;AAG9B,eAAO,OAAO,MAAM,MAAM,EAAE,KAAK,OAAO,MAAK,CAAE;AAC/C,eAAO,OAAO,MAAM,QAAQ,EAAE,OAAO,aAAa,OAAO,QAAQ,CAAC,CAAC,YAAa,CAAA;AAEhF,cAAM,WAAW;AA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QAAQ,IAAI,YAAY;AAC1B,UAAM,EAAE,MAAO,IAAG,MAAME,MAAW,YAAC,IAAI,EAAE,KAAK,KAAI,CAAE;AACrD,WAAO,QAAQ,KAAK,MAAM,KAAK,IAAI;AAAA,EACzC,OAAW;AACL,UAAM,SAASC,UAAAA,QAAQ,IAAI,IAAI;AAC/B,WAAO,SAAS,KAAK,MAAM,MAAM,IAAI;AAAA,EACtC;AACF;AAED,SAAS,UAAU,MAAM,MAAM,MAAM,QAAQ,IAAI,YAAY;AAC3D,MAAI,QAAQ,IAAI,YAAY;AAE1BD,UAAAA,YAAY,IAAI;AAAA,MACd,KAAK;AAAA,MACL,OAAO,KAAK,UAAU,IAAI;AAAA,IAClC,CAAO;AAAA,EACP,OAAW;AAELC,sBAAQ,IAAI,MAAM,KAAK,UAAU,IAAI,GAAG,eAAe,GAAG,CAAC;AAAA,EAC5D;AACF;AAED,SAAS,aAAa,MAAM,MAAM,QAAQ,IAAI,UAAU;AACtD,MAAI,QAAQ,IAAI,YAAY;AAE1BD,UAAAA,YAAY,OAAO,EAAE,KAAK,KAAM,CAAA;AAAA,EACtC,OAAW;AAEL,UAAM,UAAU,QAAQ,eAAe,EAAE,QAAQ,QAAQ,IAAI,WAAY,IAAG;AAC5EC,cAAAA,QAAQ,OAAO,MAAM,OAAO;AAAA,EAC7B;AACF;AAODC,IAAAA,MAAM,OAAO,CAAC,UAAU,aAAa;AAEpC,CAAA;;;"}
@@ -1,10 +1,9 @@
1
- import axios from "axios";
1
+ import $axios, { setAuthToken } from "../../../globals/views/utils/axios-instance.js";
2
2
  import api from "../../../../../../node_modules/js-cookie/dist/js.cookie.js";
3
3
  import { Preferences } from "../../../../../node_modules/@capacitor/preferences/dist/esm/index.js";
4
4
  import { reactive, watch } from "vue";
5
5
  import { setError } from "../../../globals/views/store/globals.js";
6
6
  import { state as state$1 } from "./twofa.js";
7
- const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });
8
7
  const state = reactive({
9
8
  user: {
10
9
  _id: void 0,
@@ -21,33 +20,37 @@ const state = reactive({
21
20
  },
22
21
  accesses: []
23
22
  });
24
- async function initialize() {
25
- try {
26
- const userCookie = await getCookie("user");
27
- console.log("cookie is", userCookie);
28
- if (userCookie) {
29
- const { _id, email, phone, roles, accessToken } = userCookie;
30
- console.log("accessToken is", accessToken);
31
- $axios.interceptors.request.use((config) => {
32
- config.headers["x-access-token"] = accessToken;
33
- return config;
34
- }, (error) => {
35
- return Promise.reject(error);
36
- });
37
- const response = await $axios.get("/api/auth/check-accesses");
38
- const userAccesses = response.data;
39
- Object.assign(state.user, { _id, email, phone });
40
- Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });
41
- state.accesses = userAccesses;
42
- }
43
- } catch (error) {
44
- console.error("Error initializing app:", error);
45
- removeCookie("user");
46
- state.accesses = [];
47
- }
48
- }
49
- initialize();
50
23
  const actions = {
24
+ async initialize(cookie) {
25
+ try {
26
+ const userCookie = cookie ? cookie : await getCookie("user");
27
+ if (userCookie) {
28
+ const { _id, email, phone, roles, accessToken } = userCookie;
29
+ setAuthToken(accessToken);
30
+ const response = await $axios.get("/api/auth/check-accesses");
31
+ const userAccesses = response.data;
32
+ Object.assign(state.user, { _id, email, phone });
33
+ Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });
34
+ state.accesses = userAccesses;
35
+ }
36
+ } catch (error) {
37
+ console.error("Error initializing auth:", error);
38
+ removeCookie("user");
39
+ state.accesses = [];
40
+ state.user = {
41
+ _id: void 0,
42
+ username: "",
43
+ email: "",
44
+ phone: "",
45
+ password: "",
46
+ passwordRepeat: ""
47
+ }, state.access = {
48
+ roles: null,
49
+ token: null,
50
+ status: false
51
+ }, setError(error);
52
+ }
53
+ },
51
54
  async login(user, type) {
52
55
  try {
53
56
  const response = await $axios.post("/api/auth/signin", {
@@ -63,7 +66,7 @@ const actions = {
63
66
  status: true,
64
67
  roles: response.data.roles
65
68
  });
66
- await initialize();
69
+ await this.initialize();
67
70
  return response.data;
68
71
  } catch (error) {
69
72
  Object.assign(state.access, {
@@ -107,7 +110,7 @@ const actions = {
107
110
  status: true,
108
111
  roles: response.data.roles
109
112
  });
110
- await initialize();
113
+ await this.initialize();
111
114
  return response.data;
112
115
  } catch (error) {
113
116
  setError(error);
@@ -220,7 +223,6 @@ watch(state, (newState, oldState) => {
220
223
  });
221
224
  export {
222
225
  actions,
223
- initialize,
224
226
  state
225
227
  };
226
228
  //# sourceMappingURL=auth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sources":["../../../../../../../src/modules/auth/views/store/auth.js"],"sourcesContent":[" // Dependencies\n import axios from 'axios';\n import Cookies from 'js-cookie'\n // Capacitor\n import { Preferences } from '@capacitor/preferences';\n // Vue modules\n import { reactive, watch } from \"vue\";\n // Globals \n import { setError } from '@pf/src/modules/globals/views/store/globals'\n // State\n import * as twofa from './twofa'\n // Setup Axios\n const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });\n // State\n const state = reactive({\n user: {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n },\n access: {\n roles: null,\n token: null,\n status: false\n },\n accesses: [\n ]\n });\n\n async function initialize() {\n try {\n const userCookie = await getCookie('user');\n\n console.log('cookie is', userCookie)\n\n if (userCookie) {\n const { _id, email, phone, roles, accessToken } = userCookie;\n\n console.log('accessToken is', accessToken)\n\n // Установка токена в Axios интерцептор для всех запросов\n $axios.interceptors.request.use(config => {\n config.headers['x-access-token'] = accessToken;\n return config;\n }, error => {\n return Promise.reject(error);\n });\n\n // Проверка токена через серверный маршрут\n const response = await $axios.get('/api/auth/check-accesses');\n const userAccesses = response.data;\n\n // Обновление состояния приложения с информацией о пользователе и его правах доступа\n Object.assign(state.user, { _id, email, phone });\n Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });\n\n // console.log('roles by initilioze is', state.access.roles)\n state.accesses = userAccesses;\n }\n } catch (error) {\n console.error('Error initializing app:', error);\n removeCookie('user'); \n state.accesses = [];\n }\n }\n\n initialize();\n\n const actions = {\n async login(user, type) {\n try {\n const response = await $axios.post('/api/auth/signin', {\n ...user,\n type\n })\n\n setCookie('user', response.data);\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await initialize();\n\n return response.data;\n } catch (error) {\n\n Object.assign(state.access, {\n token: null,\n status: false,\n roles: null\n });\n\n console.log(error)\n setError(error)\n return Promise.reject(error);\n }\n },\n\n async signup(user, type, invite) {\n \n const { password, passwordRepeat } = state.user;\n\n console.log(password)\n console.log(passwordRepeat)\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/signup', {\n ...user,\n type,\n inviteCode: invite\n });\n\n console.log(response)\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await initialize();\n\n return response.data;\n } catch (error) {\n setError(error);\n console.log('Sign up falied');\n throw error;\n }\n },\n\n logout() {\n removeCookie('user');\n\n Object.assign(state.user, {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n });\n\n Object.assign(state.access, {\n roles: null,\n token: null,\n status: false\n });\n\n state.accesses = []\n },\n\n async resetPassword(user, type) {\n try {\n const response = await $axios.post('/api/auth/reset-password', {\n email: user.email,\n phone: user.phone,\n type\n });\n\n Object.assign(twofa.state.code, {\n ...response.data,\n isSended: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n },\n\n async updatePassword(user, type) {\n const { password, passwordRepeat } = state.user;\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/update-password', {\n email: user.email,\n phone: user.phone,\n password: user.password,\n passwordRepeat: user.passwordRepeat,\n type\n });\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n }\n };\n\n // Cookies\n const optionsDefault = {\n development: { secure: false, expires: 7, sameSite: 'Lax' },\n production: { expires: 7, path: '/', domain: process.env.DOMAIN_URL, sameSite: 'none', secure: true }\n };\n\n async function getCookie(name) {\n if (process.env.MOBILE_APP) {\n const { value } = await Preferences.get({ key: name });\n return value ? JSON.parse(value) : null;\n } else {\n const cookie = Cookies.get(name);\n return cookie ? JSON.parse(cookie) : null;\n }\n }\n\n function setCookie(name, data, env = process.env.DOMAIN_URL) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.set({\n key: name,\n value: JSON.stringify(data)\n });\n } else {\n // Для веб-версии\n Cookies.set(name, JSON.stringify(data), optionsDefault[env]);\n }\n }\n\n function removeCookie(name, env = process.env.NODE_ENV) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.remove({ key: name });\n } else {\n // Для веб-версии\n const options = env === 'production' ? { domain: process.env.DOMAIN_URL } : {};\n Cookies.remove(name, options);\n }\n }\n\n // // History\n const history = []\n history.push(state)\n\n // // Watch\n watch(state, (newState, oldState) => {\n history.push(newState)\n })\n\n // Module Export\n export {\n state,\n initialize,\n actions\n };"],"names":["twofa.state","Cookies"],"mappings":";;;;;;AAYE,MAAM,SAAS,MAAM,OAAO,EAAE,SAAS,QAAQ,IAAI,SAAS,iBAAiB,KAAM,CAAA;AAE9E,MAAC,QAAQ,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OA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OAAO,MAAM,OAAO;AAAA,EAC7B;AACF;AAOD,MAAM,OAAO,CAAC,UAAU,aAAa;AAEpC,CAAA;"}
1
+ {"version":3,"file":"auth.js","sources":["../../../../../../../src/modules/auth/views/store/auth.js"],"sourcesContent":[" // Dependencies\n import $axios, { setAuthToken } from '@pf/src/modules/globals/views/utils/axios-instance.js';\n import Cookies from 'js-cookie'\n // Capacitor\n import { Preferences } from '@capacitor/preferences';\n // Vue modules\n import { reactive, watch } from \"vue\";\n // Globals \n import { setError } from '@pf/src/modules/globals/views/store/globals'\n // State\n import * as twofa from './twofa'\n // Setup Axios\n // const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });\n // const $axios = axios.create({\n // baseURL: process.env.API_URL,\n // withCredentials: true\n // });\n // State\n const state = reactive({\n user: {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n },\n access: {\n roles: null,\n token: null,\n status: false\n },\n accesses: [\n ]\n });\n\n const actions = {\n async initialize(cookie) {\n try {\n const userCookie = cookie ? cookie : await getCookie('user');\n\n if (userCookie) {\n const { _id, email, phone, roles, accessToken } = userCookie;\n\n setAuthToken(accessToken);\n\n // Проверка токена через серверный маршрут\n const response = await $axios.get('/api/auth/check-accesses');\n const userAccesses = response.data;\n\n // Обновление состояния приложения с информацией о пользователе и его правах доступа\n Object.assign(state.user, { _id, email, phone });\n Object.assign(state.access, { token: accessToken, roles, status: !!accessToken });\n\n state.accesses = userAccesses;\n }\n } catch (error) {\n console.error('Error initializing auth:', error);\n removeCookie('user'); \n state.accesses = [];\n state.user = {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n },\n state.access = {\n roles: null,\n token: null,\n status: false\n },\n setError(error)\n // return Promise.reject(error);\n }\n },\n async login(user, type) {\n try {\n const response = await $axios.post('/api/auth/signin', {\n ...user,\n type\n })\n\n setCookie('user', response.data);\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await this.initialize();\n\n return response.data;\n } catch (error) {\n\n Object.assign(state.access, {\n token: null,\n status: false,\n roles: null\n });\n\n console.log(error)\n setError(error)\n return Promise.reject(error);\n }\n },\n\n async signup(user, type, invite) {\n \n const { password, passwordRepeat } = state.user;\n\n console.log(password)\n console.log(passwordRepeat)\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/signup', {\n ...user,\n type,\n inviteCode: invite\n });\n\n console.log(response)\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true,\n roles: response.data.roles\n });\n\n await this.initialize();\n\n return response.data;\n } catch (error) {\n setError(error);\n console.log('Sign up falied');\n throw error;\n }\n },\n\n logout() {\n removeCookie('user');\n\n Object.assign(state.user, {\n _id: undefined,\n username: '',\n email: '',\n phone: '',\n password: '',\n passwordRepeat: ''\n });\n\n Object.assign(state.access, {\n roles: null,\n token: null,\n status: false\n });\n\n state.accesses = []\n },\n\n async resetPassword(user, type) {\n try {\n const response = await $axios.post('/api/auth/reset-password', {\n email: user.email,\n phone: user.phone,\n type\n });\n\n Object.assign(twofa.state.code, {\n ...response.data,\n isSended: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n },\n\n async updatePassword(user, type) {\n const { password, passwordRepeat } = state.user;\n\n if (password !== passwordRepeat) {\n const error = {\n response: {\n data: { errorCode: \"PASSWORDS_DO_NOT_MATCH\" }\n }\n };\n setError(error);\n throw new Error(error.response.status);\n }\n\n try {\n const response = await $axios.post('/api/auth/update-password', {\n email: user.email,\n phone: user.phone,\n password: user.password,\n passwordRepeat: user.passwordRepeat,\n type\n });\n\n if (response.data.accessToken) {\n setCookie('user', response.data);\n }\n\n Object.assign(state.user, {\n ...response.data\n });\n\n Object.assign(state.access, {\n token: response.data.accessToken,\n status: true\n });\n\n return response.data;\n } catch (error) {\n setError(error);\n return Promise.reject(error);\n }\n }\n };\n\n // Cookies\n const optionsDefault = {\n development: { secure: false, expires: 7, sameSite: 'Lax' },\n production: { expires: 7, path: '/', domain: process.env.DOMAIN_URL, sameSite: 'none', secure: true }\n };\n\n async function getCookie(name) {\n if (process.env.MOBILE_APP) {\n const { value } = await Preferences.get({ key: name });\n return value ? JSON.parse(value) : null;\n } else {\n const cookie = Cookies.get(name);\n return cookie ? JSON.parse(cookie) : null;\n }\n }\n\n function setCookie(name, data, env = process.env.DOMAIN_URL) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.set({\n key: name,\n value: JSON.stringify(data)\n });\n } else {\n // Для веб-версии\n Cookies.set(name, JSON.stringify(data), optionsDefault[env]);\n }\n }\n\n function removeCookie(name, env = process.env.NODE_ENV) {\n if (process.env.MOBILE_APP) {\n // Если приложение запущено в Capacitor\n Preferences.remove({ key: name });\n } else {\n // Для веб-версии\n const options = env === 'production' ? { domain: process.env.DOMAIN_URL } : {};\n Cookies.remove(name, options);\n }\n }\n\n // // History\n const history = []\n history.push(state)\n\n // // Watch\n watch(state, (newState, oldState) => {\n history.push(newState)\n })\n\n // Module Export\n export {\n state,\n actions\n };"],"names":["twofa.state","Cookies"],"mappings":";;;;;;AAkBO,MAAC,QAAQ,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,IACV,gBAAgB;AAAA,EACjB;AAAA,EACD,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,IACP,QAAQ;AAAA,EACT;AAAA,EACD,UAAU,CACT;AACL,CAAG;AAEI,MAAC,UAAU;AAAA,EACd,MAAM,WAAW,QAAQ;AACvB,QAAI;AACF,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ios = require("axios");
4
- require("../../../../../../node_modules/js-cookie/dist/js.cookie.cjs");
5
3
  const vue = require("vue");
6
4
  const globals = require("../../../globals/views/store/globals.cjs");
7
- const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });
5
+ const axiosInstance = require("../../../globals/views/utils/axios-instance.cjs");
8
6
  const state = vue.reactive({
9
7
  code: {
10
8
  value: "",
@@ -17,7 +15,7 @@ const state = vue.reactive({
17
15
  async function sendCode(user, method, type) {
18
16
  let api = "/api/twofa/sendcode";
19
17
  if (method === "reset-password") api = "/api/twofa/sendcodereset";
20
- return await $axios.post(api, {
18
+ return await axiosInstance.default.post(api, {
21
19
  phone: user.phone,
22
20
  email: user.email,
23
21
  method,
@@ -29,7 +27,7 @@ async function sendCode(user, method, type) {
29
27
  return Promise.resolve(response.data);
30
28
  },
31
29
  (error) => {
32
- console.log(error);
30
+ console.log("error is", error);
33
31
  globals.setError(error);
34
32
  return Promise.reject(error);
35
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"twofa.cjs","sources":["../../../../../../../src/modules/auth/views/store/twofa.js"],"sourcesContent":["// Dependencies\nimport axios from 'axios';\nimport Cookies from 'js-cookie'\n// Vue modules\nimport { reactive, watch } from \"vue\";\n// Globals \nimport { setError } from '@pf/src/modules/globals/views/store/globals'\n// Setup Axios\nconst $axios = axios.create({baseURL: process.env.API_URL, withCredentials: true}) \n// State\nconst state = reactive({\n code: {\n value: '',\n type: '', \n method: '',\n isSended: false,\n isValid: false \n }\n});\n\nasync function sendCode (user, method, type) {\n let api = '/api/twofa/sendcode'\n\n if (method === 'reset-password') api = '/api/twofa/sendcodereset'\n\n return await $axios.post(api, {\n phone: user.phone,\n email: user.email,\n method: method,\n type: type\n })\n .then(\n response => {\n state.code = response.data;\n state.code.isSended = true;\n return Promise.resolve(response.data);\n },\n error => {\n console.log(error)\n setError(error)\n return Promise.reject(error);\n }\n );\n}\n\nfunction validCode () {\n const rightcode = state.status.signup.code.value.code\n const usercode = state.user.code\n\n if ( rightcode == usercode ) {\n state.status.signup.code.isValid = true;\n } else {\n setError({ response: {status: \"Неверный код\", data: { message: \"Вы ввели неверный код. Попробуйте еще раз.\"}}})\n }\n}\n\n// // History\nconst history = []\nhistory.push(state) \n\n// // Watch\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\n// Module Export\nexport {\n state,\n sendCode,\n // validCode,\n}"],"names":["reactive","setError","watch"],"mappings":";;;;;;AAQA,MAAM,SAAS,MAAM,OAAO,EAAC,SAAS,QAAQ,IAAI,SAAS,iBAAiB,KAAI,CAAC;AAE5E,MAAC,QAAQA,IAAAA,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AACH,CAAC;AAED,eAAe,SAAU,MAAM,QAAQ,MAAM;AAC3C,MAAI,MAAM;AAEV,MAAI,WAAW,iBAAkB,OAAM;AAEvC,SAAO,MAAM,OAAO,KAAK,KAAK;AAAA,IAC5B,OAAO,KAAK;AAAA,IACZ,OAAO,KAAK;AAAA,IACZ;AAAA,IACA;AAAA,EACJ,CAAG,EACA;AAAA,IACC,cAAY;AACV,YAAM,OAAO,SAAS;AACtB,YAAM,KAAK,WAAW;AACtB,aAAQ,QAAQ,QAAQ,SAAS,IAAI;AAAA,IACtC;AAAA,IACD,WAAS;AACP,cAAQ,IAAI,KAAK;AACjBC,cAAAA,SAAS,KAAK;AACd,aAAO,QAAQ,OAAO,KAAK;AAAA,IAC5B;AAAA,EACL;AACA;AAkBAC,IAAAA,MAAM,OAAO,CAAC,UAAU,aAAa;AAErC,CAAC;;;"}
1
+ {"version":3,"file":"twofa.cjs","sources":["../../../../../../../src/modules/auth/views/store/twofa.js"],"sourcesContent":["// Vue modules\nimport { reactive, watch } from \"vue\";\n// Globals \nimport { setError } from '@pf/src/modules/globals/views/store/globals'\n// Setup Axios\nimport $axios from '@pf/src/modules/globals/views/utils/axios-instance.js';\n// State\nconst state = reactive({\n code: {\n value: '',\n type: '', \n method: '',\n isSended: false,\n isValid: false \n }\n});\n\nasync function sendCode (user, method, type) {\n let api = '/api/twofa/sendcode'\n\n if (method === 'reset-password') api = '/api/twofa/sendcodereset'\n\n return await $axios.post(api, {\n phone: user.phone,\n email: user.email,\n method: method,\n type: type\n })\n .then(\n response => {\n state.code = response.data;\n state.code.isSended = true;\n return Promise.resolve(response.data);\n },\n error => {\n console.log('error is', error)\n setError(error)\n return Promise.reject(error);\n }\n );\n}\n\nfunction validCode () {\n const rightcode = state.status.signup.code.value.code\n const usercode = state.user.code\n\n if ( rightcode == usercode ) {\n state.status.signup.code.isValid = true;\n } else {\n setError({ response: {status: \"Неверный код\", data: { message: \"Вы ввели неверный код. Попробуйте еще раз.\"}}})\n }\n}\n\n// // History\nconst history = []\nhistory.push(state) \n\n// // Watch\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\n// Module Export\nexport {\n state,\n sendCode,\n // validCode,\n}"],"names":["reactive","$axios","setError","watch"],"mappings":";;;;;AAOK,MAAC,QAAQA,IAAAA,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AACH,CAAC;AAED,eAAe,SAAU,MAAM,QAAQ,MAAM;AAC3C,MAAI,MAAM;AAEV,MAAI,WAAW,iBAAkB,OAAM;AAEvC,SAAO,MAAMC,cAAAA,QAAO,KAAK,KAAK;AAAA,IAC5B,OAAO,KAAK;AAAA,IACZ,OAAO,KAAK;AAAA,IACZ;AAAA,IACA;AAAA,EACJ,CAAG,EACA;AAAA,IACC,cAAY;AACV,YAAM,OAAO,SAAS;AACtB,YAAM,KAAK,WAAW;AACtB,aAAQ,QAAQ,QAAQ,SAAS,IAAI;AAAA,IACtC;AAAA,IACD,WAAS;AACP,cAAQ,IAAI,YAAY,KAAK;AAC7BC,cAAAA,SAAS,KAAK;AACd,aAAO,QAAQ,OAAO,KAAK;AAAA,IAC5B;AAAA,EACL;AACA;AAkBAC,IAAAA,MAAM,OAAO,CAAC,UAAU,aAAa;AAErC,CAAC;;;"}
@@ -1,8 +1,6 @@
1
- import axios from "axios";
2
- import "../../../../../../node_modules/js-cookie/dist/js.cookie.js";
3
1
  import { reactive, watch } from "vue";
4
2
  import { setError } from "../../../globals/views/store/globals.js";
5
- const $axios = axios.create({ baseURL: process.env.API_URL, withCredentials: true });
3
+ import $axios from "../../../globals/views/utils/axios-instance.js";
6
4
  const state = reactive({
7
5
  code: {
8
6
  value: "",
@@ -27,7 +25,7 @@ async function sendCode(user, method, type) {
27
25
  return Promise.resolve(response.data);
28
26
  },
29
27
  (error) => {
30
- console.log(error);
28
+ console.log("error is", error);
31
29
  setError(error);
32
30
  return Promise.reject(error);
33
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"twofa.js","sources":["../../../../../../../src/modules/auth/views/store/twofa.js"],"sourcesContent":["// Dependencies\nimport axios from 'axios';\nimport Cookies from 'js-cookie'\n// Vue modules\nimport { reactive, watch } from \"vue\";\n// Globals \nimport { setError } from '@pf/src/modules/globals/views/store/globals'\n// Setup Axios\nconst $axios = axios.create({baseURL: process.env.API_URL, withCredentials: true}) \n// State\nconst state = reactive({\n code: {\n value: '',\n type: '', \n method: '',\n isSended: false,\n isValid: false \n }\n});\n\nasync function sendCode (user, method, type) {\n let api = '/api/twofa/sendcode'\n\n if (method === 'reset-password') api = '/api/twofa/sendcodereset'\n\n return await $axios.post(api, {\n phone: user.phone,\n email: user.email,\n method: method,\n type: type\n })\n .then(\n response => {\n state.code = response.data;\n state.code.isSended = true;\n return Promise.resolve(response.data);\n },\n error => {\n console.log(error)\n setError(error)\n return Promise.reject(error);\n }\n );\n}\n\nfunction validCode () {\n const rightcode = state.status.signup.code.value.code\n const usercode = state.user.code\n\n if ( rightcode == usercode ) {\n state.status.signup.code.isValid = true;\n } else {\n setError({ response: {status: \"Неверный код\", data: { message: \"Вы ввели неверный код. Попробуйте еще раз.\"}}})\n }\n}\n\n// // History\nconst history = []\nhistory.push(state) \n\n// // Watch\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\n// Module Export\nexport {\n state,\n sendCode,\n // validCode,\n}"],"names":[],"mappings":";;;;AAQA,MAAM,SAAS,MAAM,OAAO,EAAC,SAAS,QAAQ,IAAI,SAAS,iBAAiB,KAAI,CAAC;AAE5E,MAAC,QAAQ,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AACH,CAAC;AAED,eAAe,SAAU,MAAM,QAAQ,MAAM;AAC3C,MAAI,MAAM;AAEV,MAAI,WAAW,iBAAkB,OAAM;AAEvC,SAAO,MAAM,OAAO,KAAK,KAAK;AAAA,IAC5B,OAAO,KAAK;AAAA,IACZ,OAAO,KAAK;AAAA,IACZ;AAAA,IACA;AAAA,EACJ,CAAG,EACA;AAAA,IACC,cAAY;AACV,YAAM,OAAO,SAAS;AACtB,YAAM,KAAK,WAAW;AACtB,aAAQ,QAAQ,QAAQ,SAAS,IAAI;AAAA,IACtC;AAAA,IACD,WAAS;AACP,cAAQ,IAAI,KAAK;AACjB,eAAS,KAAK;AACd,aAAO,QAAQ,OAAO,KAAK;AAAA,IAC5B;AAAA,EACL;AACA;AAkBA,MAAM,OAAO,CAAC,UAAU,aAAa;AAErC,CAAC;"}
1
+ {"version":3,"file":"twofa.js","sources":["../../../../../../../src/modules/auth/views/store/twofa.js"],"sourcesContent":["// Vue modules\nimport { reactive, watch } from \"vue\";\n// Globals \nimport { setError } from '@pf/src/modules/globals/views/store/globals'\n// Setup Axios\nimport $axios from '@pf/src/modules/globals/views/utils/axios-instance.js';\n// State\nconst state = reactive({\n code: {\n value: '',\n type: '', \n method: '',\n isSended: false,\n isValid: false \n }\n});\n\nasync function sendCode (user, method, type) {\n let api = '/api/twofa/sendcode'\n\n if (method === 'reset-password') api = '/api/twofa/sendcodereset'\n\n return await $axios.post(api, {\n phone: user.phone,\n email: user.email,\n method: method,\n type: type\n })\n .then(\n response => {\n state.code = response.data;\n state.code.isSended = true;\n return Promise.resolve(response.data);\n },\n error => {\n console.log('error is', error)\n setError(error)\n return Promise.reject(error);\n }\n );\n}\n\nfunction validCode () {\n const rightcode = state.status.signup.code.value.code\n const usercode = state.user.code\n\n if ( rightcode == usercode ) {\n state.status.signup.code.isValid = true;\n } else {\n setError({ response: {status: \"Неверный код\", data: { message: \"Вы ввели неверный код. Попробуйте еще раз.\"}}})\n }\n}\n\n// // History\nconst history = []\nhistory.push(state) \n\n// // Watch\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\n// Module Export\nexport {\n state,\n sendCode,\n // validCode,\n}"],"names":[],"mappings":";;;AAOK,MAAC,QAAQ,SAAS;AAAA,EACrB,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AACH,CAAC;AAED,eAAe,SAAU,MAAM,QAAQ,MAAM;AAC3C,MAAI,MAAM;AAEV,MAAI,WAAW,iBAAkB,OAAM;AAEvC,SAAO,MAAM,OAAO,KAAK,KAAK;AAAA,IAC5B,OAAO,KAAK;AAAA,IACZ,OAAO,KAAK;AAAA,IACZ;AAAA,IACA;AAAA,EACJ,CAAG,EACA;AAAA,IACC,cAAY;AACV,YAAM,OAAO,SAAS;AACtB,YAAM,KAAK,WAAW;AACtB,aAAQ,QAAQ,QAAQ,SAAS,IAAI;AAAA,IACtC;AAAA,IACD,WAAS;AACP,cAAQ,IAAI,YAAY,KAAK;AAC7B,eAAS,KAAK;AACd,aAAO,QAAQ,OAAO,KAAK;AAAA,IAC5B;AAAA,EACL;AACA;AAkBA,MAAM,OAAO,CAAC,UAAU,aAAa;AAErC,CAAC;"}
@@ -7,11 +7,12 @@ function validatePhone(phone) {
7
7
  };
8
8
  }
9
9
  function validateEmail(email) {
10
- const emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,12}$/;
10
+ const emailRegex = /^[\w-]+(\.[\w-]+)*(\+[\w-]+)?@([\w-]+\.)+[\w-]{2,12}$/;
11
11
  if (!emailRegex.test(email)) {
12
12
  return {
13
13
  status: false,
14
- message: i18n.global.t("validation.email")
14
+ // message: i18n.global.t("validation.email")
15
+ message: "validation.email"
15
16
  };
16
17
  }
17
18
  return {
@@ -23,7 +24,8 @@ function validatePassword(password) {
23
24
  if (password.length < 8) {
24
25
  return {
25
26
  status: false,
26
- message: i18n.global.t("validation.password.minLength")
27
+ // message: i18n.global.t("validation.password.minLength")
28
+ message: "validation.password.minLength"
27
29
  };
28
30
  }
29
31
  return {
@@ -35,12 +37,13 @@ async function validateInputs(input, method, variable, message) {
35
37
  if (!variable) {
36
38
  input.value = {
37
39
  status: false,
38
- message: i18n.global.t("validation.length")
40
+ // message: i18n.global.t("validation.length")
41
+ message: "validation.length"
39
42
  };
40
43
  setTimeout(() => {
41
44
  input.value = null;
42
45
  }, 3e3);
43
- throw new Error(i18n.global.t("validation.length"));
46
+ throw new Error("validation.length");
44
47
  } else {
45
48
  const InputGood = method(variable);
46
49
  if (!InputGood.status) {
@@ -1 +1 @@
1
- {"version":3,"file":"inputs.validation.cjs","sources":["../../../../../../../src/modules/auth/views/validations/inputs.validation.js"],"sourcesContent":["// import i18n from \"@pf/src/modules/globals/views/localization/vue-i18n\";\nconst messages = {\n ru: {\n \"validation\": {\n \"length\": \"Содержимое должно быть не менее 1 символа.\",\n \"maxLength\": \"Содержимое не должно превышать {maxLength} символов.\",\n \"phone\": \"Неверный формат номера\",\n \"email\": \"Неверный формат email\",\n \"password\": {\n \"minLength\": \"Пароль должен быть больше 8 символов\",\n \"lowercase\": \"Должен быть символ в нижнем регистре\",\n \"uppercase\": \"Должен быть символ в верхнем регистре\",\n \"number\": \"Должна быть 1 цифра\",\n \"specialChar\": \"Должен быть 1 специальный символ\"\n }\n }\n },\n en: {\n \"validation\": {\n \"length\": \"Content must be at least 1 character long.\",\n \"maxLength\": \"Content should not exceed {maxLength} characters.\",\n \"phone\": \"Invalid number format\",\n \"email\": \"Invalid email format\",\n \"password\": {\n \"minLength\": \"Password must be longer than 8 characters\",\n \"lowercase\": \"Must contain a lowercase character\",\n \"uppercase\": \"Must contain an uppercase character\",\n \"number\": \"Must contain at least 1 digit\",\n \"specialChar\": \"Must contain at least 1 special character\"\n }\n }\n }\n};\n\n// i18n.global.mergeLocaleMessage('ru', messages.ru);\n// i18n.global.mergeLocaleMessage('en', messages.en);\n\nfunction validateLength(input) {\n const length = input.length;\n\n if (length < 1) {\n return {\n status: false,\n message: i18n.global.t(\"validation.length\")\n };\n }\n\n return {\n status: true,\n message: null\n };\n}\n\nfunction validatePhone(phone) {\n return {\n status: true,\n message: null\n }\n}\n\nfunction validateEmail(email) {\n const emailRegex = /^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,12}$/;\n\n\n if (!emailRegex.test(email)) {\n return {\n status: false,\n message: i18n.global.t(\"validation.email\")\n };\n }\n\n return {\n status: true,\n message: null\n };\n}\n\n\nfunction validatePassword(password) {\n const lowercaseRegex = /[a-z]/;\n const uppercaseRegex = /[A-Z]/;\n const numberRegex = /[0-9]/;\n const specialCharRegex = /[@$!%*?&]/;\n\n if (password.length < 8) {\n return {\n status: false,\n message: i18n.global.t(\"validation.password.minLength\")\n }\n }\n\n // if (!lowercaseRegex.test(password)) {\n // return {\n // status: false,\n // message:i18n.global.t(\"validation.password.lowercase\")\n // }\n // }\n\n // if (!uppercaseRegex.test(password)) {\n // return {\n // status: false,\n // message: i18n.global.t(\"validation.password.uppercase\")\n // }\n // }\n\n // if (!numberRegex.test(password)) {\n // return {\n // status: false,\n // message: i18n.global.t(\"validation.password.number\")\n // }\n // }\n\n // if (!specialCharRegex.test(password)) {\n // return {\n // status: false,\n // message: i18n.global.t(\"validation.password.specialChar\")\n // }\n // }\n\n return {\n status: true,\n message: null\n }\n}\n\nasync function validateInputs(input, method, variable, message) {\n if (!variable) {\n\n input.value = {\n status: false,\n message: i18n.global.t(\"validation.length\")\n }\n \n setTimeout(() => { input.value = null }, 3000);\n throw new Error(i18n.global.t(\"validation.length\"));\n }\n else {\n const InputGood = method(variable)\n\n if (!InputGood.status) {\n input.value = InputGood\n setTimeout(() => { input.value = null }, 3000);\n throw new Error(message)\n }\n }\n}\n\nexport {\n validatePhone,\n validateEmail,\n validatePassword,\n validateLength,\n validateInputs\n}"],"names":[],"mappings":";;AAqDA,SAAS,cAAc,OAAO;AAC5B,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,EACV;AACH;AAEA,SAAS,cAAc,OAAO;AAC5B,QAAM,aAAa;AAGnB,MAAI,CAAC,WAAW,KAAK,KAAK,GAAG;AAC3B,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAU,KAAK,OAAO,EAAE,kBAAkB;AAAA,IAChD;AAAA,EACG;AAED,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,EACb;AACA;AAGA,SAAS,iBAAiB,UAAU;AAMlC,MAAI,SAAS,SAAS,GAAG;AACvB,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAU,KAAK,OAAO,EAAE,+BAA+B;AAAA,IACxD;AAAA,EACF;AA8BD,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,EACV;AACH;AAEA,eAAe,eAAe,OAAO,QAAQ,UAAU,SAAS;AAC7D,MAAI,CAAC,UAAU;AAEd,UAAM,QAAQ;AAAA,MACZ,QAAQ;AAAA,MACR,SAAS,KAAK,OAAO,EAAE,mBAAmB;AAAA,IAC3C;AAED,eAAW,MAAM;AAAE,YAAM,QAAQ;AAAA,IAAI,GAAI,GAAI;AAC7C,UAAM,IAAI,MAAM,KAAK,OAAO,EAAE,mBAAmB,CAAC;AAAA,EACnD,OACI;AACH,UAAM,YAAY,OAAO,QAAQ;AAEjC,QAAI,CAAC,UAAU,QAAQ;AACrB,YAAM,QAAQ;AACd,iBAAW,MAAM;AAAE,cAAM,QAAQ;AAAA,MAAI,GAAI,GAAI;AAC7C,YAAM,IAAI,MAAM,OAAO;AAAA,IACxB;AAAA,EACF;AACH;;;;;"}
1
+ {"version":3,"file":"inputs.validation.cjs","sources":["../../../../../../../src/modules/auth/views/validations/inputs.validation.js"],"sourcesContent":["// import i18n from \"@pf/src/modules/globals/views/localization/vue-i18n\";\nconst messages = {\n ru: {\n \"validation\": {\n \"length\": \"Содержимое должно быть не менее 1 символа.\",\n \"maxLength\": \"Содержимое не должно превышать {maxLength} символов.\",\n \"phone\": \"Неверный формат номера\",\n \"email\": \"Неверный формат email\",\n \"password\": {\n \"minLength\": \"Пароль должен быть больше 8 символов\",\n \"lowercase\": \"Должен быть символ в нижнем регистре\",\n \"uppercase\": \"Должен быть символ в верхнем регистре\",\n \"number\": \"Должна быть 1 цифра\",\n \"specialChar\": \"Должен быть 1 специальный символ\"\n }\n }\n },\n en: {\n \"validation\": {\n \"length\": \"Content must be at least 1 character long.\",\n \"maxLength\": \"Content should not exceed {maxLength} characters.\",\n \"phone\": \"Invalid number format\",\n \"email\": \"Invalid email format\",\n \"password\": {\n \"minLength\": \"Password must be longer than 8 characters\",\n \"lowercase\": \"Must contain a lowercase character\",\n \"uppercase\": \"Must contain an uppercase character\",\n \"number\": \"Must contain at least 1 digit\",\n \"specialChar\": \"Must contain at least 1 special character\"\n }\n }\n }\n};\n\n// i18n.global.mergeLocaleMessage('ru', messages.ru);\n// i18n.global.mergeLocaleMessage('en', messages.en);\n\nfunction validateLength(input) {\n const length = input.length;\n\n if (length < 1) {\n return {\n status: false,\n // message: i18n.global.t(\"validation.length\")\n message: 'validation.length'\n };\n }\n\n return {\n status: true,\n message: null\n };\n}\n\nfunction validatePhone(phone) {\n return {\n status: true,\n message: null\n }\n}\n\nfunction validateEmail(email) {\n // const emailRegex = /^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,12}$/; Not allowing to add +1, +2, +3 and etc after email\n const emailRegex = /^[\\w-]+(\\.[\\w-]+)*(\\+[\\w-]+)?@([\\w-]+\\.)+[\\w-]{2,12}$/;\n\n\n if (!emailRegex.test(email)) {\n return {\n status: false,\n // message: i18n.global.t(\"validation.email\")\n message: 'validation.email'\n };\n }\n\n return {\n status: true,\n message: null\n };\n}\n\n\nfunction validatePassword(password) {\n const lowercaseRegex = /[a-z]/;\n const uppercaseRegex = /[A-Z]/;\n const numberRegex = /[0-9]/;\n const specialCharRegex = /[@$!%*?&]/;\n\n if (password.length < 8) {\n return {\n status: false,\n // message: i18n.global.t(\"validation.password.minLength\")\n message: 'validation.password.minLength'\n }\n }\n\n // if (!lowercaseRegex.test(password)) {\n // return {\n // status: false,\n // message:i18n.global.t(\"validation.password.lowercase\")\n // }\n // }\n\n // if (!uppercaseRegex.test(password)) {\n // return {\n // status: false,\n // message: i18n.global.t(\"validation.password.uppercase\")\n // }\n // }\n\n // if (!numberRegex.test(password)) {\n // return {\n // status: false,\n // message: i18n.global.t(\"validation.password.number\")\n // }\n // }\n\n // if (!specialCharRegex.test(password)) {\n // return {\n // status: false,\n // message: i18n.global.t(\"validation.password.specialChar\")\n // }\n // }\n\n return {\n status: true,\n message: null\n }\n}\n\nasync function validateInputs(input, method, variable, message) {\n if (!variable) {\n\n input.value = {\n status: false,\n // message: i18n.global.t(\"validation.length\")\n message: 'validation.length'\n }\n \n setTimeout(() => { input.value = null }, 3000);\n // throw new Error(i18n.global.t(\"validation.length\"));\n throw new Error('validation.length');\n }\n else {\n const InputGood = method(variable)\n\n if (!InputGood.status) {\n input.value = InputGood\n setTimeout(() => { input.value = null }, 3000);\n throw new Error(message)\n }\n }\n}\n\nexport {\n validatePhone,\n validateEmail,\n validatePassword,\n validateLength,\n validateInputs\n}"],"names":[],"mappings":";;AAsDA,SAAS,cAAc,OAAO;AAC5B,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,EACV;AACH;AAEA,SAAS,cAAc,OAAO;AAE5B,QAAM,aAAa;AAGnB,MAAI,CAAC,WAAW,KAAK,KAAK,GAAG;AAC3B,WAAO;AAAA,MACL,QAAQ;AAAA;AAAA,MAER,SAAU;AAAA,IAChB;AAAA,EACG;AAED,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,EACb;AACA;AAGA,SAAS,iBAAiB,UAAU;AAMlC,MAAI,SAAS,SAAS,GAAG;AACvB,WAAO;AAAA,MACL,QAAQ;AAAA;AAAA,MAER,SAAU;AAAA,IACX;AAAA,EACF;AA8BD,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,SAAS;AAAA,EACV;AACH;AAEA,eAAe,eAAe,OAAO,QAAQ,UAAU,SAAS;AAC7D,MAAI,CAAC,UAAU;AAEd,UAAM,QAAQ;AAAA,MACZ,QAAQ;AAAA;AAAA,MAEP,SAAS;AAAA,IACX;AAED,eAAW,MAAM;AAAE,YAAM,QAAQ;AAAA,IAAI,GAAI,GAAI;AAE7C,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACpC,OACI;AACH,UAAM,YAAY,OAAO,QAAQ;AAEjC,QAAI,CAAC,UAAU,QAAQ;AACrB,YAAM,QAAQ;AACd,iBAAW,MAAM;AAAE,cAAM,QAAQ;AAAA,MAAI,GAAI,GAAI;AAC7C,YAAM,IAAI,MAAM,OAAO;AAAA,IACxB;AAAA,EACF;AACH;;;;;"}
@@ -5,11 +5,12 @@ function validatePhone(phone) {
5
5
  };
6
6
  }
7
7
  function validateEmail(email) {
8
- const emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,12}$/;
8
+ const emailRegex = /^[\w-]+(\.[\w-]+)*(\+[\w-]+)?@([\w-]+\.)+[\w-]{2,12}$/;
9
9
  if (!emailRegex.test(email)) {
10
10
  return {
11
11
  status: false,
12
- message: i18n.global.t("validation.email")
12
+ // message: i18n.global.t("validation.email")
13
+ message: "validation.email"
13
14
  };
14
15
  }
15
16
  return {
@@ -21,7 +22,8 @@ function validatePassword(password) {
21
22
  if (password.length < 8) {
22
23
  return {
23
24
  status: false,
24
- message: i18n.global.t("validation.password.minLength")
25
+ // message: i18n.global.t("validation.password.minLength")
26
+ message: "validation.password.minLength"
25
27
  };
26
28
  }
27
29
  return {
@@ -33,12 +35,13 @@ async function validateInputs(input, method, variable, message) {
33
35
  if (!variable) {
34
36
  input.value = {
35
37
  status: false,
36
- message: i18n.global.t("validation.length")
38
+ // message: i18n.global.t("validation.length")
39
+ message: "validation.length"
37
40
  };
38
41
  setTimeout(() => {
39
42
  input.value = null;
40
43
  }, 3e3);
41
- throw new Error(i18n.global.t("validation.length"));
44
+ throw new Error("validation.length");
42
45
  } else {
43
46
  const InputGood = method(variable);
44
47
  if (!InputGood.status) {