@strapi/admin 4.15.1 → 4.15.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/dist/_chunks/{AuthenticatedApp-092ef2be.js → AuthenticatedApp-26a57d48.js} +30 -30
  2. package/dist/_chunks/{AuthenticatedApp-092ef2be.js.map → AuthenticatedApp-26a57d48.js.map} +1 -1
  3. package/dist/_chunks/{AuthenticatedApp-b0ada7e9.mjs → AuthenticatedApp-332b40a8.mjs} +30 -30
  4. package/dist/_chunks/{AuthenticatedApp-b0ada7e9.mjs.map → AuthenticatedApp-332b40a8.mjs.map} +1 -1
  5. package/dist/_chunks/{HomePage-5798ba6f.mjs → HomePage-332764b2.mjs} +7 -8
  6. package/dist/_chunks/{HomePage-5798ba6f.mjs.map → HomePage-332764b2.mjs.map} +1 -1
  7. package/dist/_chunks/{HomePage-bdcb51be.js → HomePage-74c5c19b.js} +12 -13
  8. package/dist/_chunks/HomePage-74c5c19b.js.map +1 -0
  9. package/dist/_chunks/{HomePage-5ae473e6.js → HomePage-8022e4f9.js} +7 -8
  10. package/dist/_chunks/{HomePage-5ae473e6.js.map → HomePage-8022e4f9.js.map} +1 -1
  11. package/dist/_chunks/{HomePage-a3cc32d2.mjs → HomePage-ebb9bd4d.mjs} +12 -13
  12. package/dist/_chunks/HomePage-ebb9bd4d.mjs.map +1 -0
  13. package/dist/_chunks/{InstalledPluginsPage-cc2d6a36.js → InstalledPluginsPage-08915bd0.js} +10 -12
  14. package/dist/_chunks/{InstalledPluginsPage-cc2d6a36.js.map → InstalledPluginsPage-08915bd0.js.map} +1 -1
  15. package/dist/_chunks/{InstalledPluginsPage-6284aaff.mjs → InstalledPluginsPage-33ed21ac.mjs} +10 -12
  16. package/dist/_chunks/{InstalledPluginsPage-6284aaff.mjs.map → InstalledPluginsPage-33ed21ac.mjs.map} +1 -1
  17. package/dist/_chunks/{index-305a03f4.mjs → Login-4e7ab11a.mjs} +25 -29
  18. package/dist/_chunks/Login-4e7ab11a.mjs.map +1 -0
  19. package/dist/_chunks/{index-137490ba.js → Login-7c938e98.js} +25 -30
  20. package/dist/_chunks/Login-7c938e98.js.map +1 -0
  21. package/dist/_chunks/{MarketplacePage-209ec658.js → MarketplacePage-3c080568.js} +6 -8
  22. package/dist/_chunks/{MarketplacePage-209ec658.js.map → MarketplacePage-3c080568.js.map} +1 -1
  23. package/dist/_chunks/{MarketplacePage-7dee72f5.mjs → MarketplacePage-b82389f1.mjs} +6 -8
  24. package/dist/_chunks/{MarketplacePage-7dee72f5.mjs.map → MarketplacePage-b82389f1.mjs.map} +1 -1
  25. package/dist/_chunks/{ProfilePage-26c14ba4.mjs → ProfilePage-2f0d41e0.mjs} +7 -9
  26. package/dist/_chunks/{ProfilePage-26c14ba4.mjs.map → ProfilePage-2f0d41e0.mjs.map} +1 -1
  27. package/dist/_chunks/{ProfilePage-4f8c127b.js → ProfilePage-9911a1aa.js} +7 -9
  28. package/dist/_chunks/{ProfilePage-4f8c127b.js.map → ProfilePage-9911a1aa.js.map} +1 -1
  29. package/dist/_chunks/{SSOProviders-1d062c95.mjs → SSOProviders-62bfad92.mjs} +29 -61
  30. package/dist/_chunks/SSOProviders-62bfad92.mjs.map +1 -0
  31. package/dist/_chunks/{SSOProviders-1ef0a89e.js → SSOProviders-b395a4e6.js} +28 -80
  32. package/dist/_chunks/SSOProviders-b395a4e6.js.map +1 -0
  33. package/dist/_chunks/{build-f36bfc97.js → build-55ba3e68.js} +4 -2
  34. package/dist/_chunks/{build-f36bfc97.js.map → build-55ba3e68.js.map} +1 -1
  35. package/dist/_chunks/{build-e1ca35da.mjs → build-b67ecc59.mjs} +4 -2
  36. package/dist/_chunks/{build-e1ca35da.mjs.map → build-b67ecc59.mjs.map} +1 -1
  37. package/dist/_chunks/{constants-a773ff9b.js → constants-2bd3e15b.js} +13 -12
  38. package/dist/_chunks/{constants-a773ff9b.js.map → constants-2bd3e15b.js.map} +1 -1
  39. package/dist/_chunks/{constants-90c20a6f.mjs → constants-6082c0ef.mjs} +11 -12
  40. package/dist/_chunks/{constants-90c20a6f.mjs.map → constants-6082c0ef.mjs.map} +1 -1
  41. package/dist/_chunks/{constants-921eda17.mjs → constants-6ecddc43.mjs} +43 -15
  42. package/dist/_chunks/constants-6ecddc43.mjs.map +1 -0
  43. package/dist/_chunks/{constants-86aa3e70.js → constants-7596f6f3.js} +60 -13
  44. package/dist/_chunks/constants-7596f6f3.js.map +1 -0
  45. package/dist/_chunks/{constants-9de7641c.mjs → constants-889d52fe.mjs} +28 -28
  46. package/dist/_chunks/constants-889d52fe.mjs.map +1 -0
  47. package/dist/_chunks/{constants-70e05152.js → constants-9d60a039.js} +6 -6
  48. package/dist/_chunks/{constants-70e05152.js.map → constants-9d60a039.js.map} +1 -1
  49. package/dist/_chunks/{constants-6157f648.mjs → constants-b9efe215.mjs} +6 -6
  50. package/dist/_chunks/{constants-6157f648.mjs.map → constants-b9efe215.mjs.map} +1 -1
  51. package/dist/_chunks/{constants-27319180.mjs → constants-c5bbe308.mjs} +13 -12
  52. package/dist/_chunks/{constants-27319180.mjs.map → constants-c5bbe308.mjs.map} +1 -1
  53. package/dist/_chunks/{constants-32975b2e.js → constants-df81febb.js} +11 -12
  54. package/dist/_chunks/{constants-32975b2e.js.map → constants-df81febb.js.map} +1 -1
  55. package/dist/_chunks/{constants-727a113c.js → constants-efc88bf2.js} +26 -26
  56. package/dist/_chunks/constants-efc88bf2.js.map +1 -0
  57. package/dist/_chunks/{develop-513c9644.js → develop-69e28e61.js} +4 -2
  58. package/dist/_chunks/{develop-513c9644.js.map → develop-69e28e61.js.map} +1 -1
  59. package/dist/_chunks/{develop-e45b460e.mjs → develop-d97e7494.mjs} +4 -2
  60. package/dist/_chunks/{develop-e45b460e.mjs.map → develop-d97e7494.mjs.map} +1 -1
  61. package/dist/_chunks/formatAPIErrors-b599cf27.js +20 -0
  62. package/dist/_chunks/formatAPIErrors-b599cf27.js.map +1 -0
  63. package/dist/_chunks/formatAPIErrors-db6ed675.mjs +21 -0
  64. package/dist/_chunks/formatAPIErrors-db6ed675.mjs.map +1 -0
  65. package/dist/_chunks/{index-edc9bb0b.js → index-0134922e.js} +673 -811
  66. package/dist/_chunks/index-0134922e.js.map +1 -0
  67. package/dist/_chunks/{index-6a512cec.js → index-01a3932c.js} +8 -9
  68. package/dist/_chunks/{index-6a512cec.js.map → index-01a3932c.js.map} +1 -1
  69. package/dist/_chunks/{index-284c5926.js → index-13a08117.js} +33 -47
  70. package/dist/_chunks/index-13a08117.js.map +1 -0
  71. package/dist/_chunks/{index-1b7e986c.mjs → index-14462502.mjs} +14 -13
  72. package/dist/_chunks/{index-1b7e986c.mjs.map → index-14462502.mjs.map} +1 -1
  73. package/dist/_chunks/{index-85069cac.mjs → index-22fbd8cc.mjs} +9 -10
  74. package/dist/_chunks/{index-85069cac.mjs.map → index-22fbd8cc.mjs.map} +1 -1
  75. package/dist/_chunks/{index-73ba6bdd.mjs → index-259a5ab3.mjs} +3 -3
  76. package/dist/_chunks/{index-73ba6bdd.mjs.map → index-259a5ab3.mjs.map} +1 -1
  77. package/dist/_chunks/{index-7d40adea.mjs → index-287b49b0.mjs} +8 -7
  78. package/dist/_chunks/{index-7d40adea.mjs.map → index-287b49b0.mjs.map} +1 -1
  79. package/dist/_chunks/{index-77e0e5d7.js → index-293f112c.js} +8 -7
  80. package/dist/_chunks/{index-77e0e5d7.js.map → index-293f112c.js.map} +1 -1
  81. package/dist/_chunks/{index-0af587c3.js → index-2ca9ffb3.js} +78 -147
  82. package/dist/_chunks/index-2ca9ffb3.js.map +1 -0
  83. package/dist/_chunks/{index-4c5acc70.js → index-2e47d9aa.js} +9 -10
  84. package/dist/_chunks/{index-4c5acc70.js.map → index-2e47d9aa.js.map} +1 -1
  85. package/dist/_chunks/{index-59d22949.mjs → index-3d323e1b.mjs} +8 -9
  86. package/dist/_chunks/{index-59d22949.mjs.map → index-3d323e1b.mjs.map} +1 -1
  87. package/dist/_chunks/{index-5752584c.mjs → index-44360544.mjs} +182 -76
  88. package/dist/_chunks/index-44360544.mjs.map +1 -0
  89. package/dist/_chunks/{index-34a2909e.mjs → index-46245c2d.mjs} +12 -12
  90. package/dist/_chunks/{index-34a2909e.mjs.map → index-46245c2d.mjs.map} +1 -1
  91. package/dist/_chunks/{index-5ad8482b.mjs → index-486f5166.mjs} +7 -7
  92. package/dist/_chunks/{index-5ad8482b.mjs.map → index-486f5166.mjs.map} +1 -1
  93. package/dist/_chunks/{index-58db145d.mjs → index-49b41e57.mjs} +3 -3
  94. package/dist/_chunks/{index-58db145d.mjs.map → index-49b41e57.mjs.map} +1 -1
  95. package/dist/_chunks/{index-da04b144.js → index-4bdd41f2.js} +14 -13
  96. package/dist/_chunks/{index-da04b144.js.map → index-4bdd41f2.js.map} +1 -1
  97. package/dist/_chunks/{index-7aed99db.js → index-4ff5f2a8.js} +12 -12
  98. package/dist/_chunks/{index-7aed99db.js.map → index-4ff5f2a8.js.map} +1 -1
  99. package/dist/_chunks/{index-56ced4ab.mjs → index-5221021e.mjs} +8 -7
  100. package/dist/_chunks/{index-56ced4ab.mjs.map → index-5221021e.mjs.map} +1 -1
  101. package/dist/_chunks/{index-a4348f3b.js → index-54a7f1f4.js} +12 -12
  102. package/dist/_chunks/index-54a7f1f4.js.map +1 -0
  103. package/dist/_chunks/{index-1da8c640.mjs → index-5502f0f9.mjs} +9 -10
  104. package/dist/_chunks/{index-1da8c640.mjs.map → index-5502f0f9.mjs.map} +1 -1
  105. package/dist/_chunks/{index-36e0d449.mjs → index-5af78a9d.mjs} +32 -45
  106. package/dist/_chunks/index-5af78a9d.mjs.map +1 -0
  107. package/dist/_chunks/{index-1f1e2465.js → index-5be49e36.js} +9 -11
  108. package/dist/_chunks/{index-1f1e2465.js.map → index-5be49e36.js.map} +1 -1
  109. package/dist/_chunks/{index-4565fcbd.js → index-5bf8300a.js} +3 -3
  110. package/dist/_chunks/{index-4565fcbd.js.map → index-5bf8300a.js.map} +1 -1
  111. package/dist/_chunks/{index-48322669.mjs → index-663f37fb.mjs} +3 -3
  112. package/dist/_chunks/index-663f37fb.mjs.map +1 -0
  113. package/dist/_chunks/{index-35e4bad6.mjs → index-6999385d.mjs} +8 -9
  114. package/dist/_chunks/{index-35e4bad6.mjs.map → index-6999385d.mjs.map} +1 -1
  115. package/dist/_chunks/{index-928b18d2.mjs → index-70ad05e1.mjs} +3 -3
  116. package/dist/_chunks/{index-928b18d2.mjs.map → index-70ad05e1.mjs.map} +1 -1
  117. package/dist/_chunks/{index-e22d1a84.mjs → index-72195b26.mjs} +14 -13
  118. package/dist/_chunks/{index-e22d1a84.mjs.map → index-72195b26.mjs.map} +1 -1
  119. package/dist/_chunks/{index-c604806d.js → index-73b1ca6d.js} +12 -12
  120. package/dist/_chunks/{index-c604806d.js.map → index-73b1ca6d.js.map} +1 -1
  121. package/dist/_chunks/{index-62b4b3fc.js → index-76459a60.js} +11 -11
  122. package/dist/_chunks/{index-62b4b3fc.js.map → index-76459a60.js.map} +1 -1
  123. package/dist/_chunks/{index-6b9e3d60.js → index-77b91009.js} +9 -10
  124. package/dist/_chunks/{index-6b9e3d60.js.map → index-77b91009.js.map} +1 -1
  125. package/dist/_chunks/{index-24189ec9.js → index-84321b2e.js} +6 -6
  126. package/dist/_chunks/{index-24189ec9.js.map → index-84321b2e.js.map} +1 -1
  127. package/dist/_chunks/{index-b2257157.js → index-866d1aaf.js} +49 -12
  128. package/dist/_chunks/index-866d1aaf.js.map +1 -0
  129. package/dist/_chunks/{index-066ee02e.js → index-891738bc.js} +8 -10
  130. package/dist/_chunks/{index-066ee02e.js.map → index-891738bc.js.map} +1 -1
  131. package/dist/_chunks/{index-cadd3ee0.js → index-89cb437c.js} +4 -4
  132. package/dist/_chunks/{index-cadd3ee0.js.map → index-89cb437c.js.map} +1 -1
  133. package/dist/_chunks/{index-8ea5a488.js → index-901d8afc.js} +9 -10
  134. package/dist/_chunks/{index-8ea5a488.js.map → index-901d8afc.js.map} +1 -1
  135. package/dist/_chunks/{index-d1620260.js → index-9c56225f.js} +13 -14
  136. package/dist/_chunks/{index-d1620260.js.map → index-9c56225f.js.map} +1 -1
  137. package/dist/_chunks/{index-6dbc94a9.mjs → index-9e3fc4fe.mjs} +6 -6
  138. package/dist/_chunks/{index-6dbc94a9.mjs.map → index-9e3fc4fe.mjs.map} +1 -1
  139. package/dist/_chunks/{index-bdfc1149.mjs → index-a16075f2.mjs} +49 -12
  140. package/dist/_chunks/index-a16075f2.mjs.map +1 -0
  141. package/dist/_chunks/{index-6cc54f3b.mjs → index-a1c1b833.mjs} +8 -9
  142. package/dist/_chunks/{index-6cc54f3b.mjs.map → index-a1c1b833.mjs.map} +1 -1
  143. package/dist/_chunks/{index-acd6d64f.js → index-aaffa28c.js} +8 -7
  144. package/dist/_chunks/{index-acd6d64f.js.map → index-aaffa28c.js.map} +1 -1
  145. package/dist/_chunks/{index-be2ca313.mjs → index-abcea3d3.mjs} +13 -13
  146. package/dist/_chunks/{index-be2ca313.mjs.map → index-abcea3d3.mjs.map} +1 -1
  147. package/dist/_chunks/{index-af69bc98.mjs → index-acdd9b71.mjs} +11 -11
  148. package/dist/_chunks/{index-af69bc98.mjs.map → index-acdd9b71.mjs.map} +1 -1
  149. package/dist/_chunks/{index-89d27faa.js → index-adc85ed8.js} +14 -13
  150. package/dist/_chunks/{index-89d27faa.js.map → index-adc85ed8.js.map} +1 -1
  151. package/dist/_chunks/{index-f448aed2.js → index-af5e137f.js} +13 -12
  152. package/dist/_chunks/{index-f448aed2.js.map → index-af5e137f.js.map} +1 -1
  153. package/dist/_chunks/{index-16030b74.js → index-b11e88f3.js} +3 -3
  154. package/dist/_chunks/index-b11e88f3.js.map +1 -0
  155. package/dist/_chunks/{index-e414353b.js → index-b47862fc.js} +8 -8
  156. package/dist/_chunks/{index-e414353b.js.map → index-b47862fc.js.map} +1 -1
  157. package/dist/_chunks/{index-51a15b27.js → index-bea39602.js} +4 -4
  158. package/dist/_chunks/{index-51a15b27.js.map → index-bea39602.js.map} +1 -1
  159. package/dist/_chunks/{index-53ba81f9.mjs → index-c202e78f.mjs} +9 -10
  160. package/dist/_chunks/{index-53ba81f9.mjs.map → index-c202e78f.mjs.map} +1 -1
  161. package/dist/_chunks/{index-8d4d361d.mjs → index-c9f9b444.mjs} +13 -13
  162. package/dist/_chunks/{index-8d4d361d.mjs.map → index-c9f9b444.mjs.map} +1 -1
  163. package/dist/_chunks/{index-ea23ee9f.mjs → index-caecca36.mjs} +9 -11
  164. package/dist/_chunks/{index-ea23ee9f.mjs.map → index-caecca36.mjs.map} +1 -1
  165. package/dist/_chunks/{index-86dfbe3a.js → index-cce8ecb6.js} +178 -72
  166. package/dist/_chunks/index-cce8ecb6.js.map +1 -0
  167. package/dist/_chunks/{index-34de382e.mjs → index-cd461a87.mjs} +688 -824
  168. package/dist/_chunks/index-cd461a87.mjs.map +1 -0
  169. package/dist/_chunks/{index-5d8d89a7.js → index-cdfb1568.js} +13 -13
  170. package/dist/_chunks/{index-5d8d89a7.js.map → index-cdfb1568.js.map} +1 -1
  171. package/dist/_chunks/{index-1763a04f.js → index-cf87a6f0.js} +8 -9
  172. package/dist/_chunks/{index-1763a04f.js.map → index-cf87a6f0.js.map} +1 -1
  173. package/dist/_chunks/{index-b81f7273.mjs → index-d33930a8.mjs} +78 -147
  174. package/dist/_chunks/index-d33930a8.mjs.map +1 -0
  175. package/dist/_chunks/{index-fcd5bc14.mjs → index-d4473456.mjs} +14 -13
  176. package/dist/_chunks/{index-fcd5bc14.mjs.map → index-d4473456.mjs.map} +1 -1
  177. package/dist/_chunks/{index-3c58de6f.js → index-d74efba3.js} +14 -13
  178. package/dist/_chunks/{index-3c58de6f.js.map → index-d74efba3.js.map} +1 -1
  179. package/dist/_chunks/{index-1e973c03.mjs → index-d7bc095b.mjs} +14 -13
  180. package/dist/_chunks/{index-1e973c03.mjs.map → index-d7bc095b.mjs.map} +1 -1
  181. package/dist/_chunks/{index-00202c8a.mjs → index-dbbda762.mjs} +13 -12
  182. package/dist/_chunks/{index-00202c8a.mjs.map → index-dbbda762.mjs.map} +1 -1
  183. package/dist/_chunks/{index-f5342ea5.js → index-dfb03b19.js} +14 -13
  184. package/dist/_chunks/{index-f5342ea5.js.map → index-dfb03b19.js.map} +1 -1
  185. package/dist/_chunks/{index-bb8093ea.mjs → index-e10dd15d.mjs} +12 -12
  186. package/dist/_chunks/{index-bb8093ea.mjs.map → index-e10dd15d.mjs.map} +1 -1
  187. package/dist/_chunks/{index-370a4ee8.mjs → index-e4f7fa95.mjs} +12 -12
  188. package/dist/_chunks/index-e4f7fa95.mjs.map +1 -0
  189. package/dist/_chunks/{index-b98ea3ce.mjs → index-e749e6ef.mjs} +13 -14
  190. package/dist/_chunks/{index-b98ea3ce.mjs.map → index-e749e6ef.mjs.map} +1 -1
  191. package/dist/_chunks/{index-332f319e.mjs → index-ef5a0b8f.mjs} +8 -10
  192. package/dist/_chunks/{index-332f319e.mjs.map → index-ef5a0b8f.mjs.map} +1 -1
  193. package/dist/_chunks/{index-f179c7ea.js → index-f03c4e70.js} +13 -13
  194. package/dist/_chunks/{index-f179c7ea.js.map → index-f03c4e70.js.map} +1 -1
  195. package/dist/_chunks/{index-52b5db8a.js → index-fc0191f3.js} +8 -9
  196. package/dist/_chunks/{index-52b5db8a.js.map → index-fc0191f3.js.map} +1 -1
  197. package/dist/_chunks/{schema-a95f2514.mjs → schema-4d12cff6.mjs} +2 -2
  198. package/dist/_chunks/{schema-a95f2514.mjs.map → schema-4d12cff6.mjs.map} +1 -1
  199. package/dist/_chunks/{schema-f49c76d7.js → schema-c6ce9e01.js} +2 -2
  200. package/dist/_chunks/{schema-f49c76d7.js.map → schema-c6ce9e01.js.map} +1 -1
  201. package/dist/_chunks/{validateWorkflow-e66d7d2e.js → validateWorkflow-155f5778.js} +3 -3
  202. package/dist/_chunks/{validateWorkflow-e66d7d2e.js.map → validateWorkflow-155f5778.js.map} +1 -1
  203. package/dist/_chunks/{validateWorkflow-d051b610.mjs → validateWorkflow-e0166061.mjs} +3 -3
  204. package/dist/_chunks/{validateWorkflow-d051b610.mjs.map → validateWorkflow-e0166061.mjs.map} +1 -1
  205. package/dist/admin/index.js +9 -10
  206. package/dist/admin/index.js.map +1 -1
  207. package/dist/admin/index.mjs +9 -10
  208. package/dist/admin/index.mjs.map +1 -1
  209. package/dist/admin/src/constants.d.ts +10 -0
  210. package/dist/admin/src/contexts/admin.d.ts +2 -2
  211. package/dist/admin/src/hooks/__mocks__/useSettingsMenu.d.ts +2 -0
  212. package/dist/admin/src/hooks/useEnterprise.d.ts +6 -4
  213. package/dist/admin/src/hooks/useSettingsMenu.d.ts +24 -0
  214. package/dist/admin/src/pages/Auth/AuthPage.d.ts +6 -0
  215. package/dist/admin/src/pages/Auth/components/FieldActionWrapper.d.ts +3 -0
  216. package/dist/admin/src/pages/Auth/components/ForgotPassword.d.ts +3 -0
  217. package/dist/admin/src/pages/Auth/components/ForgotPasswordSuccess.d.ts +2 -0
  218. package/dist/admin/src/pages/Auth/components/Login.d.ts +8 -0
  219. package/dist/admin/src/pages/Auth/components/Oops.d.ts +2 -0
  220. package/dist/admin/src/pages/Auth/components/Register.d.ts +7 -0
  221. package/dist/admin/src/pages/Auth/components/ResetPassword.d.ts +3 -0
  222. package/dist/admin/src/pages/Auth/constants.d.ts +14 -0
  223. package/dist/admin/src/pages/Marketplace/hooks/useMarketplaceData.d.ts +2 -2
  224. package/dist/admin/src/types/permissions.d.ts +10 -0
  225. package/dist/cli.js +3 -1
  226. package/dist/cli.js.map +1 -1
  227. package/dist/cli.mjs +3 -1
  228. package/dist/cli.mjs.map +1 -1
  229. package/dist/ee/admin/src/constants.d.ts +3 -1
  230. package/dist/ee/admin/src/pages/AuthPage/components/Login.d.ts +3 -0
  231. package/dist/ee/admin/src/pages/AuthPage/components/Providers.d.ts +2 -0
  232. package/dist/ee/admin/src/pages/AuthPage/components/SSOProviders.d.ts +8 -0
  233. package/dist/ee/admin/src/pages/AuthPage/constants.d.ts +3 -0
  234. package/dist/ee/admin/src/pages/AuthResponse.d.ts +2 -0
  235. package/dist/ee/admin/src/pages/HomePage.d.ts +1 -1
  236. package/dist/shared/contracts/authentication.d.ts +126 -0
  237. package/dist/shared/contracts/providers.d.ts +18 -0
  238. package/ee/LICENSE +1 -0
  239. package/package.json +21 -21
  240. package/dist/_chunks/HomePage-a3cc32d2.mjs.map +0 -1
  241. package/dist/_chunks/HomePage-bdcb51be.js.map +0 -1
  242. package/dist/_chunks/SSOProviders-1d062c95.mjs.map +0 -1
  243. package/dist/_chunks/SSOProviders-1ef0a89e.js.map +0 -1
  244. package/dist/_chunks/constants-12dfb222.mjs +0 -34
  245. package/dist/_chunks/constants-12dfb222.mjs.map +0 -1
  246. package/dist/_chunks/constants-1aea1185.js +0 -34
  247. package/dist/_chunks/constants-1aea1185.js.map +0 -1
  248. package/dist/_chunks/constants-727a113c.js.map +0 -1
  249. package/dist/_chunks/constants-86aa3e70.js.map +0 -1
  250. package/dist/_chunks/constants-921eda17.mjs.map +0 -1
  251. package/dist/_chunks/constants-9de7641c.mjs.map +0 -1
  252. package/dist/_chunks/index-0af587c3.js.map +0 -1
  253. package/dist/_chunks/index-137490ba.js.map +0 -1
  254. package/dist/_chunks/index-16030b74.js.map +0 -1
  255. package/dist/_chunks/index-284c5926.js.map +0 -1
  256. package/dist/_chunks/index-305a03f4.mjs.map +0 -1
  257. package/dist/_chunks/index-34de382e.mjs.map +0 -1
  258. package/dist/_chunks/index-36e0d449.mjs.map +0 -1
  259. package/dist/_chunks/index-370a4ee8.mjs.map +0 -1
  260. package/dist/_chunks/index-48322669.mjs.map +0 -1
  261. package/dist/_chunks/index-5752584c.mjs.map +0 -1
  262. package/dist/_chunks/index-86dfbe3a.js.map +0 -1
  263. package/dist/_chunks/index-a4348f3b.js.map +0 -1
  264. package/dist/_chunks/index-b2257157.js.map +0 -1
  265. package/dist/_chunks/index-b81f7273.mjs.map +0 -1
  266. package/dist/_chunks/index-bdfc1149.mjs.map +0 -1
  267. package/dist/_chunks/index-edc9bb0b.js.map +0 -1
@@ -13,20 +13,19 @@ const React = require("react");
13
13
  const reactIntl = require("react-intl");
14
14
  const reactRedux = require("react-redux");
15
15
  const reactContext = require("@radix-ui/react-context");
16
- const axios = require("axios");
17
- const camelCase = require("lodash/camelCase");
18
- const get = require("lodash/get");
19
- const omit = require("lodash/omit");
20
- const PropTypes = require("prop-types");
21
- const defaultsDeep = require("lodash/defaultsDeep");
22
- const styled = require("styled-components");
16
+ const v2 = require("@strapi/design-system/v2");
23
17
  const Icons = require("@strapi/icons");
24
18
  const formik = require("formik");
25
- const yup = require("yup");
19
+ const camelCase = require("lodash/camelCase");
26
20
  const reactQuery = require("react-query");
21
+ const styled = require("styled-components");
22
+ const yup = require("yup");
23
+ const defaultsDeep = require("lodash/defaultsDeep");
24
+ const omit = require("lodash/omit");
25
+ const qs = require("qs");
27
26
  const produce = require("immer");
27
+ const get = require("lodash/get");
28
28
  const set = require("lodash/set");
29
- const qs = require("qs");
30
29
  const toolkit = require("@reduxjs/toolkit");
31
30
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
32
31
  function _interopNamespace(e) {
@@ -52,15 +51,13 @@ const isFunction__default = /* @__PURE__ */ _interopDefault(isFunction);
52
51
  const merge__default = /* @__PURE__ */ _interopDefault(merge);
53
52
  const pick__default = /* @__PURE__ */ _interopDefault(pick);
54
53
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
55
- const axios__default = /* @__PURE__ */ _interopDefault(axios);
56
54
  const camelCase__default = /* @__PURE__ */ _interopDefault(camelCase);
57
- const get__default = /* @__PURE__ */ _interopDefault(get);
58
- const omit__default = /* @__PURE__ */ _interopDefault(omit);
59
- const PropTypes__default = /* @__PURE__ */ _interopDefault(PropTypes);
60
- const defaultsDeep__default = /* @__PURE__ */ _interopDefault(defaultsDeep);
61
55
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
62
56
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
57
+ const defaultsDeep__default = /* @__PURE__ */ _interopDefault(defaultsDeep);
58
+ const omit__default = /* @__PURE__ */ _interopDefault(omit);
63
59
  const produce__default = /* @__PURE__ */ _interopDefault(produce);
60
+ const get__default = /* @__PURE__ */ _interopDefault(get);
64
61
  const set__default = /* @__PURE__ */ _interopDefault(set);
65
62
  const styles = `
66
63
  .strapi--root {
@@ -268,16 +265,79 @@ const HOOKS = {
268
265
  };
269
266
  const ACTION_SET_APP_RUNTIME_STATUS = "StrapiAdmin/APP/SET_APP_RUNTIME_STATUS";
270
267
  const ACTION_SET_ADMIN_PERMISSIONS = "StrapiAdmin/App/SET_ADMIN_PERMISSIONS";
268
+ const SETTINGS_LINKS_CE = () => ({
269
+ global: [
270
+ {
271
+ intlLabel: { id: "Settings.application.title", defaultMessage: "Overview" },
272
+ to: "/settings/application-infos",
273
+ id: "000-application-infos"
274
+ },
275
+ {
276
+ intlLabel: { id: "Settings.webhooks.title", defaultMessage: "Webhooks" },
277
+ to: "/settings/webhooks",
278
+ id: "webhooks"
279
+ },
280
+ {
281
+ intlLabel: { id: "Settings.apiTokens.title", defaultMessage: "API Tokens" },
282
+ to: "/settings/api-tokens?sort=name:ASC",
283
+ id: "api-tokens"
284
+ },
285
+ {
286
+ intlLabel: { id: "Settings.transferTokens.title", defaultMessage: "Transfer Tokens" },
287
+ to: "/settings/transfer-tokens?sort=name:ASC",
288
+ id: "transfer-tokens"
289
+ },
290
+ // If the Enterprise feature is not enabled and if the config doesn't disable it, we promote the Enterprise feature by displaying them in the settings menu.
291
+ // Disable this by adding "promoteEE: false" to your `./config/admin.js` file
292
+ ...!window.strapi.features.isEnabled(window.strapi.features.SSO) && window.strapi?.flags?.promoteEE ? [
293
+ {
294
+ intlLabel: { id: "Settings.sso.title", defaultMessage: "Single Sign-On" },
295
+ to: "/settings/purchase-single-sign-on",
296
+ id: "sso",
297
+ lockIcon: true
298
+ }
299
+ ] : [],
300
+ ...!window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS) && window.strapi?.flags?.promoteEE ? [
301
+ {
302
+ intlLabel: {
303
+ id: "Settings.review-workflows.page.title",
304
+ defaultMessage: "Review Workflows"
305
+ },
306
+ to: "/settings/purchase-review-workflows",
307
+ id: "review-workflows",
308
+ lockIcon: true
309
+ }
310
+ ] : []
311
+ ],
312
+ admin: [
313
+ {
314
+ intlLabel: { id: "global.roles", defaultMessage: "Roles" },
315
+ to: "/settings/roles",
316
+ id: "roles"
317
+ },
318
+ {
319
+ intlLabel: { id: "global.users", defaultMessage: "Users" },
320
+ // Init the search params directly
321
+ to: "/settings/users?pageSize=10&page=1&sort=firstname",
322
+ id: "users"
323
+ },
324
+ ...!window.strapi.features.isEnabled(window.strapi.features.AUDIT_LOGS) && window.strapi?.flags?.promoteEE ? [
325
+ {
326
+ intlLabel: { id: "global.auditLogs", defaultMessage: "Audit Logs" },
327
+ to: "/settings/purchase-audit-logs",
328
+ id: "auditLogs",
329
+ lockIcon: true
330
+ }
331
+ ] : []
332
+ ]
333
+ });
271
334
  const [ConfigurationContextProvider, useConfigurationContext] = reactContext.createContext("ConfigurationContext");
272
335
  const useConfiguration = () => useConfigurationContext("useConfiguration");
273
336
  function isEnterprise() {
274
337
  return window.strapi.isEE;
275
338
  }
276
- function useEnterprise(ceData, eeCallback, {
277
- defaultValue = null,
278
- combine = (ceData2, eeData) => eeData,
279
- enabled = true
280
- } = {}) {
339
+ const useEnterprise = (ceData, eeCallback, opts = {}) => {
340
+ const { defaultValue = null, combine = (_ceData, eeData) => eeData, enabled = true } = opts;
281
341
  const eeCallbackRef = helperPlugin.useCallbackRef(eeCallback);
282
342
  const combineCallbackRef = helperPlugin.useCallbackRef(combine);
283
343
  const [{ data }, setData] = React__namespace.useState({
@@ -286,21 +346,22 @@ function useEnterprise(ceData, eeCallback, {
286
346
  React__namespace.useEffect(() => {
287
347
  async function importEE() {
288
348
  const eeData = await eeCallbackRef();
289
- setData({ data: combineCallbackRef(ceData, eeData) });
349
+ const combinedValue = combineCallbackRef(ceData, eeData);
350
+ setData({ data: combinedValue ? combinedValue : eeData });
290
351
  }
291
352
  if (isEnterprise() && enabled) {
292
353
  importEE();
293
354
  }
294
355
  }, [ceData, eeCallbackRef, combineCallbackRef, enabled]);
295
356
  return data;
296
- }
357
+ };
297
358
  const [LocalesContextProvider, useLocalesContext] = reactContext.createContext("LocalesContext");
298
359
  const useLocales = () => useLocalesContext("useLocales");
299
360
  const LANGUAGE_LOCAL_STORAGE_KEY = "strapi-admin-language";
300
361
  const LanguageProvider = ({ children, localeNames, messages }) => {
301
362
  const [{ locale }, dispatch] = React__namespace.useReducer(
302
- reducer$3,
303
- initialState$8,
363
+ reducer$2,
364
+ initialState$7,
304
365
  () => {
305
366
  const languageFromLocaleStorage = window.localStorage.getItem(LANGUAGE_LOCAL_STORAGE_KEY);
306
367
  if (languageFromLocaleStorage && localeNames[languageFromLocaleStorage]) {
@@ -329,11 +390,11 @@ const LanguageProvider = ({ children, localeNames, messages }) => {
329
390
  const appMessages = defaultsDeep__default.default(messages[locale], messages.en);
330
391
  return /* @__PURE__ */ jsxRuntime.jsx(reactIntl.IntlProvider, { locale, defaultLocale: "en", messages: appMessages, textComponent: "span", children: /* @__PURE__ */ jsxRuntime.jsx(LocalesContextProvider, { changeLocale, localeNames, children }) });
331
392
  };
332
- const initialState$8 = {
393
+ const initialState$7 = {
333
394
  localeNames: { en: "English" },
334
395
  locale: "en"
335
396
  };
336
- const reducer$3 = (state = initialState$8, action) => {
397
+ const reducer$2 = (state = initialState$7, action) => {
337
398
  switch (action.type) {
338
399
  case "CHANGE_LOCALE": {
339
400
  const { locale } = action;
@@ -347,22 +408,14 @@ const reducer$3 = (state = initialState$8, action) => {
347
408
  }
348
409
  }
349
410
  };
350
- const formatAPIErrors = ({ data }) => {
351
- try {
352
- return Object.keys(data).reduce(
353
- (acc, current) => {
354
- const errorMessage = data[current][0];
355
- acc[current] = {
356
- id: errorMessage,
357
- defaultMessage: errorMessage
358
- };
359
- return acc;
360
- },
361
- {}
362
- );
363
- } catch (err) {
364
- return {};
365
- }
411
+ const Img = styled__default.default.img`
412
+ height: ${72 / 16}rem;
413
+ `;
414
+ const Logo = () => {
415
+ const {
416
+ logos: { auth }
417
+ } = useConfiguration();
418
+ return /* @__PURE__ */ jsxRuntime.jsx(Img, { src: auth?.custom ?? auth.default, "aria-hidden": true, alt: "" });
366
419
  };
367
420
  const Wrapper = styled__default.default(designSystem.Box)`
368
421
  margin: 0 auto;
@@ -408,15 +461,6 @@ const UnauthenticatedLayout = ({ children }) => {
408
461
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, paddingBottom: 11, children })
409
462
  ] });
410
463
  };
411
- const Img = styled__default.default.img`
412
- height: ${72 / 16}rem;
413
- `;
414
- const Logo = () => {
415
- const {
416
- logos: { auth }
417
- } = useConfiguration();
418
- return /* @__PURE__ */ jsxRuntime.jsx(Img, { src: auth?.custom ?? auth.default, "aria-hidden": true, alt: "" });
419
- };
420
464
  const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
421
465
  svg {
422
466
  height: 1rem;
@@ -426,16 +470,64 @@ const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
426
470
  }
427
471
  }
428
472
  `;
429
- const PasswordInput$2 = styled__default.default(designSystem.TextInput)`
430
- ::-ms-reveal {
431
- display: none;
432
- }
433
- `;
434
- const Login = ({ onSubmit, schema, children }) => {
435
- const [passwordShown, setPasswordShown] = React.useState(false);
473
+ const LOGIN_SCHEMA = yup__namespace.object().shape({
474
+ email: yup__namespace.string().email(helperPlugin.translatedErrors.email).required(helperPlugin.translatedErrors.required),
475
+ password: yup__namespace.string().required(helperPlugin.translatedErrors.required),
476
+ rememberMe: yup__namespace.bool().nullable()
477
+ });
478
+ const Login = ({ children }) => {
479
+ const [apiError, setApiError] = React__namespace.useState();
480
+ const [passwordShown, setPasswordShown] = React__namespace.useState(false);
436
481
  const { formatMessage } = reactIntl.useIntl();
437
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
482
+ const { post } = helperPlugin.useFetchClient();
483
+ const { changeLocale } = useLocales();
484
+ const query = helperPlugin.useQuery();
485
+ const { push } = reactRouterDom.useHistory();
486
+ const mutation = reactQuery.useMutation(
487
+ async (body) => {
488
+ const {
489
+ data: { data }
490
+ } = await post("/admin/login", body);
491
+ return { ...data, rememberMe: body.rememberMe };
492
+ },
493
+ {
494
+ onSuccess(data) {
495
+ if (data) {
496
+ const { token, user } = data;
497
+ if (user.preferedLanguage) {
498
+ changeLocale(user.preferedLanguage);
499
+ }
500
+ helperPlugin.auth.setToken(token, data.rememberMe);
501
+ helperPlugin.auth.setUserInfo(user, data.rememberMe);
502
+ const redirectTo = query.get("redirectTo");
503
+ const redirectUrl = redirectTo ? decodeURIComponent(redirectTo) : "/";
504
+ push(redirectUrl);
505
+ }
506
+ },
507
+ onError(err) {
508
+ const message = err.response?.data?.error?.message ?? "Something went wrong";
509
+ if (camelCase__default.default(message).toLowerCase() === "usernotactive") {
510
+ push("/auth/oops");
511
+ return;
512
+ }
513
+ setApiError(message);
514
+ }
515
+ }
516
+ );
517
+ return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
438
518
  /* @__PURE__ */ jsxRuntime.jsxs(LayoutContent, { children: [
519
+ /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
520
+ /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
521
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h1", children: formatMessage({
522
+ id: "Auth.form.welcome.title",
523
+ defaultMessage: "Welcome!"
524
+ }) }) }),
525
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
526
+ id: "Auth.form.welcome.subtitle",
527
+ defaultMessage: "Log in to your Strapi account"
528
+ }) }) }),
529
+ mutation.isError && apiError ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "global-form-error", role: "alert", tabIndex: -1, textColor: "danger600", children: apiError }) : null
530
+ ] }),
439
531
  /* @__PURE__ */ jsxRuntime.jsx(
440
532
  formik.Formik,
441
533
  {
@@ -445,171 +537,141 @@ const Login = ({ onSubmit, schema, children }) => {
445
537
  password: "",
446
538
  rememberMe: false
447
539
  },
448
- onSubmit,
449
- validationSchema: schema,
540
+ onSubmit: (values) => {
541
+ mutation.mutate(values);
542
+ },
543
+ validationSchema: LOGIN_SCHEMA,
450
544
  validateOnChange: false,
451
- children: ({ values, errors, handleChange }) => /* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Form, { noValidate: true, children: [
452
- /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
453
- /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
454
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h1", children: formatMessage({
455
- id: "Auth.form.welcome.title",
456
- defaultMessage: "Welcome!"
457
- }) }) }),
458
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({
459
- id: "Auth.form.welcome.subtitle",
460
- defaultMessage: "Log in to your Strapi account"
461
- }) }) }),
462
- errors.errorMessage && /* @__PURE__ */ jsxRuntime.jsx(
463
- designSystem.Typography,
464
- {
465
- id: "global-form-error",
466
- role: "alert",
467
- tabIndex: -1,
468
- textColor: "danger600",
469
- children: errors.errorMessage
470
- }
471
- )
472
- ] }),
473
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
474
- /* @__PURE__ */ jsxRuntime.jsx(
475
- designSystem.TextInput,
476
- {
477
- error: errors.email ? formatMessage({
478
- id: errors.email,
479
- defaultMessage: "This value is required."
480
- }) : "",
481
- value: values.email,
482
- onChange: handleChange,
483
- label: formatMessage({ id: "Auth.form.email.label", defaultMessage: "Email" }),
484
- placeholder: formatMessage({
485
- id: "Auth.form.email.placeholder",
486
- defaultMessage: "kai@doe.com"
487
- }),
488
- name: "email",
489
- required: true
490
- }
491
- ),
492
- /* @__PURE__ */ jsxRuntime.jsx(
493
- PasswordInput$2,
494
- {
495
- error: errors.password ? formatMessage({
496
- id: errors.password,
497
- defaultMessage: "This value is required."
498
- }) : "",
499
- onChange: handleChange,
500
- value: values.password,
501
- label: formatMessage({
502
- id: "global.password",
503
- defaultMessage: "Password"
504
- }),
505
- name: "password",
506
- type: passwordShown ? "text" : "password",
507
- endAction: /* @__PURE__ */ jsxRuntime.jsx(
508
- FieldActionWrapper,
509
- {
510
- onClick: (e) => {
511
- e.stopPropagation();
512
- setPasswordShown((prev) => !prev);
513
- },
514
- label: formatMessage(
515
- passwordShown ? {
516
- id: "Auth.form.password.show-password",
517
- defaultMessage: "Show password"
518
- } : {
519
- id: "Auth.form.password.hide-password",
520
- defaultMessage: "Hide password"
521
- }
522
- ),
523
- children: passwordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
524
- }
525
- ),
526
- required: true
527
- }
528
- ),
529
- /* @__PURE__ */ jsxRuntime.jsx(
530
- designSystem.Checkbox,
531
- {
532
- onValueChange: (checked) => {
533
- handleChange({ target: { value: checked, name: "rememberMe" } });
534
- },
535
- value: values.rememberMe,
536
- "aria-label": "rememberMe",
537
- name: "rememberMe",
538
- children: formatMessage({
539
- id: "Auth.form.rememberMe.label",
540
- defaultMessage: "Remember me"
541
- })
542
- }
543
- ),
544
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, type: "submit", children: formatMessage({ id: "Auth.form.button.login", defaultMessage: "Login" }) })
545
- ] })
546
- ] })
545
+ children: ({ values, errors, handleChange }) => /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Form, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
546
+ /* @__PURE__ */ jsxRuntime.jsx(
547
+ designSystem.TextInput,
548
+ {
549
+ error: errors.email ? formatMessage({
550
+ id: errors.email,
551
+ defaultMessage: "This value is required."
552
+ }) : "",
553
+ value: values.email,
554
+ onChange: handleChange,
555
+ label: formatMessage({ id: "Auth.form.email.label", defaultMessage: "Email" }),
556
+ placeholder: formatMessage({
557
+ id: "Auth.form.email.placeholder",
558
+ defaultMessage: "kai@doe.com"
559
+ }),
560
+ name: "email",
561
+ required: true
562
+ }
563
+ ),
564
+ /* @__PURE__ */ jsxRuntime.jsx(
565
+ PasswordInput$2,
566
+ {
567
+ error: errors.password ? formatMessage({
568
+ id: errors.password,
569
+ defaultMessage: "This value is required."
570
+ }) : "",
571
+ onChange: handleChange,
572
+ value: values.password,
573
+ label: formatMessage({
574
+ id: "global.password",
575
+ defaultMessage: "Password"
576
+ }),
577
+ name: "password",
578
+ type: passwordShown ? "text" : "password",
579
+ endAction: /* @__PURE__ */ jsxRuntime.jsx(
580
+ FieldActionWrapper,
581
+ {
582
+ onClick: (e) => {
583
+ e.stopPropagation();
584
+ setPasswordShown((prev) => !prev);
585
+ },
586
+ label: formatMessage(
587
+ passwordShown ? {
588
+ id: "Auth.form.password.show-password",
589
+ defaultMessage: "Show password"
590
+ } : {
591
+ id: "Auth.form.password.hide-password",
592
+ defaultMessage: "Hide password"
593
+ }
594
+ ),
595
+ children: passwordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
596
+ }
597
+ ),
598
+ required: true
599
+ }
600
+ ),
601
+ /* @__PURE__ */ jsxRuntime.jsx(
602
+ designSystem.Checkbox,
603
+ {
604
+ onValueChange: (checked) => {
605
+ handleChange({ target: { value: checked, name: "rememberMe" } });
606
+ },
607
+ value: values.rememberMe,
608
+ "aria-label": "rememberMe",
609
+ name: "rememberMe",
610
+ children: formatMessage({
611
+ id: "Auth.form.rememberMe.label",
612
+ defaultMessage: "Remember me"
613
+ })
614
+ }
615
+ ),
616
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, type: "submit", children: formatMessage({ id: "Auth.form.button.login", defaultMessage: "Login" }) })
617
+ ] }) })
547
618
  }
548
619
  ),
549
620
  children
550
621
  ] }),
551
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Link, { to: "/auth/forgot-password", children: formatMessage({
622
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { as: reactRouterDom.NavLink, to: "/auth/forgot-password", children: formatMessage({
552
623
  id: "Auth.link.forgot-password",
553
624
  defaultMessage: "Forgot your password?"
554
625
  }) }) }) })
555
- ] });
626
+ ] }) });
556
627
  };
557
- Login.defaultProps = {
558
- children: null,
559
- onSubmit() {
628
+ const PasswordInput$2 = styled__default.default(designSystem.TextInput)`
629
+ ::-ms-reveal {
630
+ display: none;
560
631
  }
561
- };
562
- Login.propTypes = {
563
- children: PropTypes__default.default.node,
564
- onSubmit: PropTypes__default.default.func,
565
- schema: PropTypes__default.default.shape({
566
- type: PropTypes__default.default.string.isRequired
567
- }).isRequired
568
- };
569
- const LoginCE = (loginProps) => {
570
- return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(Login, { ...loginProps }) });
571
- };
572
- LoginCE.defaultProps = {
573
- onSubmit: (e) => e.preventDefault()
574
- };
575
- LoginCE.propTypes = {
576
- onSubmit: PropTypes__default.default.func
577
- };
578
- const ForgotPassword$1 = ({ onSubmit, schema }) => {
632
+ `;
633
+ const ForgotPassword = () => {
634
+ const { push } = reactRouterDom.useHistory();
635
+ const { post } = helperPlugin.useFetchClient();
579
636
  const { formatMessage } = reactIntl.useIntl();
637
+ const { mutate, isError } = reactQuery.useMutation(
638
+ async (body) => {
639
+ await post("/admin/forgot-password", body);
640
+ },
641
+ {
642
+ onSuccess() {
643
+ push("/auth/forgot-password-success");
644
+ }
645
+ }
646
+ );
580
647
  return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
581
- /* @__PURE__ */ jsxRuntime.jsx(LayoutContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
582
- formik.Formik,
583
- {
584
- enableReinitialize: true,
585
- initialValues: {
586
- email: ""
587
- },
588
- onSubmit,
589
- validationSchema: schema,
590
- validateOnChange: false,
591
- children: ({ values, errors, handleChange }) => /* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Form, { noValidate: true, children: [
592
- /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
593
- /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
594
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", children: formatMessage({
595
- id: "Auth.form.button.password-recovery",
596
- defaultMessage: "Password Recovery"
597
- }) }) }),
598
- errors.errorMessage && /* @__PURE__ */ jsxRuntime.jsx(
599
- designSystem.Typography,
600
- {
601
- id: "global-form-error",
602
- role: "alert",
603
- tabIndex: -1,
604
- textColor: "danger600",
605
- children: formatMessage({
606
- id: errors.errorMessage,
607
- defaultMessage: "An error occurred"
608
- })
609
- }
610
- )
611
- ] }),
612
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
648
+ /* @__PURE__ */ jsxRuntime.jsxs(LayoutContent, { children: [
649
+ /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
650
+ /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
651
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", children: formatMessage({
652
+ id: "Auth.form.button.password-recovery",
653
+ defaultMessage: "Password Recovery"
654
+ }) }) }),
655
+ isError ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "global-form-error", role: "alert", tabIndex: -1, textColor: "danger600", children: formatMessage({
656
+ id: "notification.error",
657
+ defaultMessage: "An error occurred"
658
+ }) }) : null
659
+ ] }),
660
+ /* @__PURE__ */ jsxRuntime.jsx(
661
+ formik.Formik,
662
+ {
663
+ enableReinitialize: true,
664
+ initialValues: {
665
+ email: ""
666
+ },
667
+ onSubmit: (values) => {
668
+ mutate(values);
669
+ },
670
+ validationSchema: yup__namespace.object().shape({
671
+ email: yup__namespace.string().email(helperPlugin.translatedErrors.email).required(helperPlugin.translatedErrors.required)
672
+ }),
673
+ validateOnChange: false,
674
+ children: ({ values, errors, handleChange }) => /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Form, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
613
675
  /* @__PURE__ */ jsxRuntime.jsx(
614
676
  designSystem.TextInput,
615
677
  {
@@ -632,22 +694,13 @@ const ForgotPassword$1 = ({ onSubmit, schema }) => {
632
694
  id: "Auth.form.button.forgot-password",
633
695
  defaultMessage: "Send Email"
634
696
  }) })
635
- ] })
636
- ] })
637
- }
638
- ) }),
639
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Link, { to: "/auth/login", children: formatMessage({ id: "Auth.link.ready", defaultMessage: "Ready to sign in?" }) }) }) })
697
+ ] }) })
698
+ }
699
+ )
700
+ ] }),
701
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { as: reactRouterDom.NavLink, to: "/auth/login", children: formatMessage({ id: "Auth.link.ready", defaultMessage: "Ready to sign in?" }) }) }) })
640
702
  ] }) });
641
703
  };
642
- ForgotPassword$1.defaultProps = {
643
- onSubmit: (e) => e.preventDefault()
644
- };
645
- ForgotPassword$1.propTypes = {
646
- onSubmit: PropTypes__default.default.func,
647
- schema: PropTypes__default.default.shape({
648
- type: PropTypes__default.default.string.isRequired
649
- }).isRequired
650
- };
651
704
  const ForgotPasswordSuccess = () => {
652
705
  const { formatMessage } = reactIntl.useIntl();
653
706
  return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
@@ -666,7 +719,7 @@ const ForgotPasswordSuccess = () => {
666
719
  defaultMessage: "If you do not receive this link, please contact your administrator."
667
720
  }) }) })
668
721
  ] }) }),
669
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Link, { to: "/auth/login", children: formatMessage({ id: "Auth.link.signin", defaultMessage: "Sign in" }) }) }) })
722
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { as: reactRouterDom.NavLink, to: "/auth/login", children: formatMessage({ id: "Auth.link.signin", defaultMessage: "Sign in" }) }) }) })
670
723
  ] }) });
671
724
  };
672
725
  const Oops = () => {
@@ -686,7 +739,7 @@ const Oops = () => {
686
739
  defaultMessage: "If this is a mistake, please contact your administrator."
687
740
  }) }) })
688
741
  ] }) }),
689
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Link, { to: "/auth/login", children: formatMessage({ id: "Auth.link.signin", defaultMessage: "Sign in" }) }) }) })
742
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { as: reactRouterDom.NavLink, to: "/auth/login", children: formatMessage({ id: "Auth.link.signin", defaultMessage: "Sign in" }) }) }) })
690
743
  ] }) });
691
744
  };
692
745
  const FieldWrapper = styled__default.default(designSystem.Field)`
@@ -975,25 +1028,36 @@ function useNpsSurveySettings() {
975
1028
  );
976
1029
  return { npsSurveySettings, setNpsSurveySettings };
977
1030
  }
978
- const A = styled__default.default.a`
979
- color: ${({ theme }) => theme.colors.primary600};
980
- `;
981
- const PasswordInput$1 = styled__default.default(designSystem.TextInput)`
982
- ::-ms-reveal {
983
- display: none;
984
- }
985
- `;
986
- const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) => {
1031
+ const REGISTER_USER_SCHEMA = yup__namespace.object().shape({
1032
+ firstname: yup__namespace.string().trim().required(helperPlugin.translatedErrors.required),
1033
+ lastname: yup__namespace.string().nullable(),
1034
+ password: yup__namespace.string().min(8, helperPlugin.translatedErrors.minLength).matches(/[a-z]/, "components.Input.error.contain.lowercase").matches(/[A-Z]/, "components.Input.error.contain.uppercase").matches(/\d/, "components.Input.error.contain.number").required(helperPlugin.translatedErrors.required),
1035
+ confirmPassword: yup__namespace.string().oneOf([yup__namespace.ref("password"), null], "components.Input.error.password.noMatch").required(helperPlugin.translatedErrors.required),
1036
+ registrationToken: yup__namespace.string().required(helperPlugin.translatedErrors.required)
1037
+ });
1038
+ const REGISTER_ADMIN_SCHEMA = yup__namespace.object().shape({
1039
+ firstname: yup__namespace.string().trim().required(helperPlugin.translatedErrors.required),
1040
+ lastname: yup__namespace.string().nullable(),
1041
+ password: yup__namespace.string().min(8, helperPlugin.translatedErrors.minLength).matches(/[a-z]/, "components.Input.error.contain.lowercase").matches(/[A-Z]/, "components.Input.error.contain.uppercase").matches(/\d/, "components.Input.error.contain.number").required(helperPlugin.translatedErrors.required),
1042
+ email: yup__namespace.string().email(helperPlugin.translatedErrors.email).strict().lowercase(helperPlugin.translatedErrors.lowercase).required(helperPlugin.translatedErrors.required),
1043
+ confirmPassword: yup__namespace.string().oneOf([yup__namespace.ref("password"), null], "components.Input.error.password.noMatch").required(helperPlugin.translatedErrors.required)
1044
+ });
1045
+ const Register = ({ hasAdmin }) => {
987
1046
  const toggleNotification = helperPlugin.useNotification();
988
1047
  const { push } = reactRouterDom.useHistory();
989
- const [passwordShown, setPasswordShown] = React.useState(false);
990
- const [confirmPasswordShown, setConfirmPasswordShown] = React.useState(false);
991
- const [submitCount, setSubmitCount] = React.useState(0);
1048
+ const [passwordShown, setPasswordShown] = React__namespace.useState(false);
1049
+ const [confirmPasswordShown, setConfirmPasswordShown] = React__namespace.useState(false);
1050
+ const [submitCount, setSubmitCount] = React__namespace.useState(0);
1051
+ const [apiError, setApiError] = React__namespace.useState();
992
1052
  const { trackUsage } = helperPlugin.useTracking();
993
1053
  const { formatMessage } = reactIntl.useIntl();
1054
+ const { setSkipped } = helperPlugin.useGuidedTour();
994
1055
  const query = helperPlugin.useQuery();
1056
+ const match = reactRouterDom.useRouteMatch(
1057
+ "/auth/:authType"
1058
+ );
995
1059
  const { formatAPIError } = helperPlugin.useAPIErrorHandler();
996
- const { get: get2 } = helperPlugin.useFetchClient();
1060
+ const { get: get2, post } = helperPlugin.useFetchClient();
997
1061
  const { setNpsSurveySettings } = useNpsSurveySettings();
998
1062
  const registrationToken = query.get("registrationToken");
999
1063
  const { data: userInfo } = reactQuery.useQuery({
@@ -1019,28 +1083,97 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
1019
1083
  push(`/auth/oops?info=${encodeURIComponent(message)}`);
1020
1084
  }
1021
1085
  });
1022
- function normalizeData(data) {
1023
- return Object.entries(data).reduce((acc, [key, value]) => {
1024
- let normalizedvalue = value;
1025
- if (!["password", "confirmPassword"].includes(key) && typeof value === "string") {
1026
- normalizedvalue = normalizedvalue.trim();
1027
- if (key === "lastname") {
1028
- normalizedvalue = normalizedvalue || null;
1086
+ const registerAdminMutation = reactQuery.useMutation(
1087
+ async (body) => {
1088
+ const { news, ...restBody } = body;
1089
+ const { data } = await post("/admin/register-admin", restBody);
1090
+ return { ...data.data, news };
1091
+ },
1092
+ {
1093
+ onSuccess(data) {
1094
+ const { token, user, news } = data;
1095
+ helperPlugin.auth.setToken(token, false);
1096
+ helperPlugin.auth.setUserInfo(user, false);
1097
+ const { roles } = user;
1098
+ if (roles) {
1099
+ const isUserSuperAdmin = roles.find(({ code }) => code === "strapi-super-admin");
1100
+ if (isUserSuperAdmin) {
1101
+ helperPlugin.auth.set(false, "GUIDED_TOUR_SKIPPED", true);
1102
+ setSkipped(false);
1103
+ trackUsage("didLaunchGuidedtour");
1104
+ }
1105
+ }
1106
+ if (news) {
1107
+ setNpsSurveySettings((s) => ({ ...s, enabled: true }));
1108
+ push({
1109
+ pathname: "/usecase",
1110
+ search: `?hasAdmin=${true}`
1111
+ });
1112
+ } else {
1113
+ push("/");
1029
1114
  }
1115
+ },
1116
+ onError(err) {
1117
+ trackUsage("didNotCreateFirstAdmin");
1118
+ const error = formatAPIError(err);
1119
+ setApiError(error);
1030
1120
  }
1031
- acc[key] = normalizedvalue;
1032
- return acc;
1033
- }, {});
1034
- }
1121
+ }
1122
+ );
1123
+ const registerUserMutation = reactQuery.useMutation(
1124
+ async (body) => {
1125
+ const { news, ...restBody } = body;
1126
+ const { data } = await post("/admin/register", restBody);
1127
+ return { ...data.data, news };
1128
+ },
1129
+ {
1130
+ onSuccess(data) {
1131
+ const { token, user, news } = data;
1132
+ helperPlugin.auth.setToken(token, false);
1133
+ helperPlugin.auth.setUserInfo(user, false);
1134
+ if (news) {
1135
+ setNpsSurveySettings((s) => ({ ...s, enabled: true }));
1136
+ push({
1137
+ pathname: "/usecase",
1138
+ search: `?hasAdmin=${hasAdmin}`
1139
+ });
1140
+ } else {
1141
+ push("/");
1142
+ }
1143
+ },
1144
+ onError(err) {
1145
+ trackUsage("didNotCreateFirstAdmin");
1146
+ const error = formatAPIError(err);
1147
+ setApiError(error);
1148
+ }
1149
+ }
1150
+ );
1151
+ if (!match || match.params.authType !== "register" && match.params.authType !== "register-admin") {
1152
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Redirect, { to: "/" });
1153
+ }
1154
+ const isAdminRegistration = match.params.authType === "register-admin";
1155
+ const schema = isAdminRegistration ? REGISTER_ADMIN_SCHEMA : REGISTER_USER_SCHEMA;
1035
1156
  return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(LayoutContent, { children: [
1157
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 3, children: [
1158
+ /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
1159
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", textAlign: "center", children: formatMessage({
1160
+ id: "Auth.form.welcome.title",
1161
+ defaultMessage: "Welcome to Strapi!"
1162
+ }) }),
1163
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", textAlign: "center", children: formatMessage({
1164
+ id: "Auth.form.register.subtitle",
1165
+ defaultMessage: "Credentials are only used to authenticate in Strapi. All saved data will be stored in your database."
1166
+ }) }),
1167
+ apiError ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "global-form-error", role: "alert", tabIndex: -1, textColor: "danger600", children: apiError }) : null
1168
+ ] }),
1036
1169
  /* @__PURE__ */ jsxRuntime.jsx(
1037
1170
  formik.Formik,
1038
1171
  {
1039
1172
  enableReinitialize: true,
1040
1173
  initialValues: {
1041
- firstname: userInfo.firstname || "",
1042
- lastname: userInfo.lastname || "",
1043
- email: userInfo.email || "",
1174
+ firstname: userInfo?.firstname || "",
1175
+ lastname: userInfo?.lastname || "",
1176
+ email: userInfo?.email || "",
1044
1177
  password: "",
1045
1178
  confirmPassword: "",
1046
1179
  registrationToken: registrationToken || void 0,
@@ -1050,265 +1183,291 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
1050
1183
  const normalizedData = normalizeData(data);
1051
1184
  try {
1052
1185
  await schema.validate(normalizedData, { abortEarly: false });
1053
- if (submitCount > 0 && authType === "register-admin") {
1186
+ if (submitCount > 0 && isAdminRegistration) {
1054
1187
  trackUsage("didSubmitWithErrorsFirstAdmin", { count: submitCount.toString() });
1055
1188
  }
1056
- if (registrationToken) {
1057
- onSubmit(
1058
- { userInfo: omit__default.default(normalizedData, ["registrationToken"]), registrationToken },
1059
- formik2
1060
- );
1189
+ if (normalizedData.registrationToken) {
1190
+ registerUserMutation.mutate({
1191
+ userInfo: omit__default.default(normalizedData, [
1192
+ "registrationToken",
1193
+ "confirmPassword",
1194
+ "email",
1195
+ "news"
1196
+ ]),
1197
+ registrationToken: normalizedData.registrationToken,
1198
+ news: normalizedData.news
1199
+ });
1061
1200
  } else {
1062
- onSubmit(normalizedData, formik2);
1201
+ registerAdminMutation.mutate(
1202
+ omit__default.default(normalizedData, ["registrationToken", "confirmPassword"])
1203
+ );
1063
1204
  }
1064
- setNpsSurveySettings({ enabled: data.news });
1065
1205
  } catch (err) {
1066
- const errors = helperPlugin.getYupInnerErrors(err);
1206
+ if (err instanceof yup.ValidationError) {
1207
+ const errors = helperPlugin.getYupInnerErrors(err);
1208
+ formik2.setErrors(errors);
1209
+ }
1067
1210
  setSubmitCount(submitCount + 1);
1068
- formik2.setErrors(errors);
1069
1211
  }
1070
1212
  },
1071
1213
  validateOnChange: false,
1072
1214
  children: ({ values, errors, handleChange }) => {
1073
- return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Form, { noValidate: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
1074
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 3, children: [
1075
- /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
1076
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", textAlign: "center", children: formatMessage({
1077
- id: "Auth.form.welcome.title",
1078
- defaultMessage: "Welcome to Strapi!"
1079
- }) }),
1080
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", textAlign: "center", children: formatMessage({
1081
- id: "Auth.form.register.subtitle",
1082
- defaultMessage: "Credentials are only used to authenticate in Strapi. All saved data will be stored in your database."
1083
- }) })
1084
- ] }),
1085
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, marginTop: 7, children: [
1086
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { gap: 4, children: [
1087
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
1088
- designSystem.TextInput,
1089
- {
1090
- name: "firstname",
1091
- required: true,
1092
- value: values.firstname,
1093
- error: errors.firstname ? formatMessage(errors.firstname) : void 0,
1094
- onChange: handleChange,
1095
- label: formatMessage({
1096
- id: "Auth.form.firstname.label",
1097
- defaultMessage: "Firstname"
1098
- })
1099
- }
1100
- ) }),
1101
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
1102
- designSystem.TextInput,
1103
- {
1104
- name: "lastname",
1105
- value: values.lastname,
1106
- onChange: handleChange,
1107
- label: formatMessage({
1108
- id: "Auth.form.lastname.label",
1109
- defaultMessage: "Lastname"
1110
- })
1111
- }
1112
- ) })
1113
- ] }),
1114
- /* @__PURE__ */ jsxRuntime.jsx(
1215
+ return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Form, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, marginTop: 7, children: [
1216
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { gap: 4, children: [
1217
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
1115
1218
  designSystem.TextInput,
1116
1219
  {
1117
- name: "email",
1118
- disabled: fieldsToDisable.includes("email"),
1119
- value: values.email,
1120
- onChange: handleChange,
1121
- error: errors.email ? formatMessage(errors.email) : void 0,
1220
+ name: "firstname",
1122
1221
  required: true,
1123
- label: formatMessage({
1124
- id: "Auth.form.email.label",
1125
- defaultMessage: "Email"
1126
- }),
1127
- type: "email"
1128
- }
1129
- ),
1130
- /* @__PURE__ */ jsxRuntime.jsx(
1131
- PasswordInput$1,
1132
- {
1133
- name: "password",
1222
+ value: values.firstname,
1223
+ error: errors.firstname ? formatMessage(errors.firstname) : void 0,
1134
1224
  onChange: handleChange,
1135
- value: values.password,
1136
- error: errors.password ? formatMessage(errors.password) : void 0,
1137
- endAction: /* @__PURE__ */ jsxRuntime.jsx(
1138
- FieldActionWrapper,
1139
- {
1140
- onClick: (e) => {
1141
- e.preventDefault();
1142
- setPasswordShown((prev) => !prev);
1143
- },
1144
- label: formatMessage(
1145
- passwordShown ? {
1146
- id: "Auth.form.password.show-password",
1147
- defaultMessage: "Show password"
1148
- } : {
1149
- id: "Auth.form.password.hide-password",
1150
- defaultMessage: "Hide password"
1151
- }
1152
- ),
1153
- children: passwordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
1154
- }
1155
- ),
1156
- hint: formatMessage({
1157
- id: "Auth.form.password.hint",
1158
- defaultMessage: "Must be at least 8 characters, 1 uppercase, 1 lowercase & 1 number"
1159
- }),
1160
- required: true,
1161
1225
  label: formatMessage({
1162
- id: "global.password",
1163
- defaultMessage: "Password"
1164
- }),
1165
- type: passwordShown ? "text" : "password"
1226
+ id: "Auth.form.firstname.label",
1227
+ defaultMessage: "Firstname"
1228
+ })
1166
1229
  }
1167
- ),
1168
- /* @__PURE__ */ jsxRuntime.jsx(
1169
- PasswordInput$1,
1230
+ ) }),
1231
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
1232
+ designSystem.TextInput,
1170
1233
  {
1171
- name: "confirmPassword",
1234
+ name: "lastname",
1235
+ value: values.lastname,
1172
1236
  onChange: handleChange,
1173
- value: values.confirmPassword,
1174
- error: errors.confirmPassword ? formatMessage(errors.confirmPassword) : void 0,
1175
- endAction: /* @__PURE__ */ jsxRuntime.jsx(
1176
- FieldActionWrapper,
1177
- {
1178
- onClick: (e) => {
1179
- e.preventDefault();
1180
- setConfirmPasswordShown((prev) => !prev);
1181
- },
1182
- label: formatMessage(
1183
- confirmPasswordShown ? {
1184
- id: "Auth.form.password.show-password",
1185
- defaultMessage: "Show password"
1186
- } : {
1187
- id: "Auth.form.password.hide-password",
1188
- defaultMessage: "Hide password"
1189
- }
1190
- ),
1191
- children: confirmPasswordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
1192
- }
1193
- ),
1194
- required: true,
1195
1237
  label: formatMessage({
1196
- id: "Auth.form.confirmPassword.label",
1197
- defaultMessage: "Confirm Password"
1198
- }),
1199
- type: confirmPasswordShown ? "text" : "password"
1238
+ id: "Auth.form.lastname.label",
1239
+ defaultMessage: "Lastname"
1240
+ })
1200
1241
  }
1201
- ),
1202
- /* @__PURE__ */ jsxRuntime.jsx(
1203
- designSystem.Checkbox,
1204
- {
1205
- onValueChange: (checked) => {
1206
- handleChange({ target: { value: checked, name: "news" } });
1207
- },
1208
- value: values.news,
1209
- name: "news",
1210
- "aria-label": "news",
1211
- children: formatMessage(
1212
- {
1213
- id: "Auth.form.register.news.label",
1214
- defaultMessage: "Keep me updated about new features & upcoming improvements (by doing this you accept the {terms} and the {policy})."
1242
+ ) })
1243
+ ] }),
1244
+ /* @__PURE__ */ jsxRuntime.jsx(
1245
+ designSystem.TextInput,
1246
+ {
1247
+ name: "email",
1248
+ disabled: !isAdminRegistration,
1249
+ value: values.email,
1250
+ onChange: handleChange,
1251
+ error: errors.email ? formatMessage(errors.email) : void 0,
1252
+ required: true,
1253
+ label: formatMessage({
1254
+ id: "Auth.form.email.label",
1255
+ defaultMessage: "Email"
1256
+ }),
1257
+ type: "email"
1258
+ }
1259
+ ),
1260
+ /* @__PURE__ */ jsxRuntime.jsx(
1261
+ PasswordInput$1,
1262
+ {
1263
+ name: "password",
1264
+ onChange: handleChange,
1265
+ value: values.password,
1266
+ error: errors.password ? formatMessage(errors.password) : void 0,
1267
+ endAction: /* @__PURE__ */ jsxRuntime.jsx(
1268
+ FieldActionWrapper,
1269
+ {
1270
+ onClick: (e) => {
1271
+ e.preventDefault();
1272
+ setPasswordShown((prev) => !prev);
1215
1273
  },
1216
- {
1217
- terms: /* @__PURE__ */ jsxRuntime.jsx(A, { target: "_blank", href: "https://strapi.io/terms", rel: "noreferrer", children: formatMessage({
1218
- id: "Auth.privacy-policy-agreement.terms",
1219
- defaultMessage: "terms"
1220
- }) }),
1221
- policy: /* @__PURE__ */ jsxRuntime.jsx(A, { target: "_blank", href: "https://strapi.io/privacy", rel: "noreferrer", children: formatMessage({
1222
- id: "Auth.privacy-policy-agreement.policy",
1223
- defaultMessage: "policy"
1224
- }) })
1225
- }
1226
- )
1227
- }
1228
- ),
1229
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, size: "L", type: "submit", children: formatMessage({
1230
- id: "Auth.form.button.register",
1231
- defaultMessage: "Let's start"
1232
- }) })
1233
- ] })
1234
- ] }) });
1274
+ label: formatMessage(
1275
+ passwordShown ? {
1276
+ id: "Auth.form.password.show-password",
1277
+ defaultMessage: "Show password"
1278
+ } : {
1279
+ id: "Auth.form.password.hide-password",
1280
+ defaultMessage: "Hide password"
1281
+ }
1282
+ ),
1283
+ children: passwordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
1284
+ }
1285
+ ),
1286
+ hint: formatMessage({
1287
+ id: "Auth.form.password.hint",
1288
+ defaultMessage: "Must be at least 8 characters, 1 uppercase, 1 lowercase & 1 number"
1289
+ }),
1290
+ required: true,
1291
+ label: formatMessage({
1292
+ id: "global.password",
1293
+ defaultMessage: "Password"
1294
+ }),
1295
+ type: passwordShown ? "text" : "password"
1296
+ }
1297
+ ),
1298
+ /* @__PURE__ */ jsxRuntime.jsx(
1299
+ PasswordInput$1,
1300
+ {
1301
+ name: "confirmPassword",
1302
+ onChange: handleChange,
1303
+ value: values.confirmPassword,
1304
+ error: errors.confirmPassword ? formatMessage(errors.confirmPassword) : void 0,
1305
+ endAction: /* @__PURE__ */ jsxRuntime.jsx(
1306
+ FieldActionWrapper,
1307
+ {
1308
+ onClick: (e) => {
1309
+ e.preventDefault();
1310
+ setConfirmPasswordShown((prev) => !prev);
1311
+ },
1312
+ label: formatMessage(
1313
+ confirmPasswordShown ? {
1314
+ id: "Auth.form.password.show-password",
1315
+ defaultMessage: "Show password"
1316
+ } : {
1317
+ id: "Auth.form.password.hide-password",
1318
+ defaultMessage: "Hide password"
1319
+ }
1320
+ ),
1321
+ children: confirmPasswordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
1322
+ }
1323
+ ),
1324
+ required: true,
1325
+ label: formatMessage({
1326
+ id: "Auth.form.confirmPassword.label",
1327
+ defaultMessage: "Confirm Password"
1328
+ }),
1329
+ type: confirmPasswordShown ? "text" : "password"
1330
+ }
1331
+ ),
1332
+ /* @__PURE__ */ jsxRuntime.jsx(
1333
+ designSystem.Checkbox,
1334
+ {
1335
+ onValueChange: (checked) => {
1336
+ handleChange({ target: { value: checked, name: "news" } });
1337
+ },
1338
+ value: values.news,
1339
+ name: "news",
1340
+ "aria-label": "news",
1341
+ children: formatMessage(
1342
+ {
1343
+ id: "Auth.form.register.news.label",
1344
+ defaultMessage: "Keep me updated about new features & upcoming improvements (by doing this you accept the {terms} and the {policy})."
1345
+ },
1346
+ {
1347
+ terms: /* @__PURE__ */ jsxRuntime.jsx(A, { target: "_blank", href: "https://strapi.io/terms", rel: "noreferrer", children: formatMessage({
1348
+ id: "Auth.privacy-policy-agreement.terms",
1349
+ defaultMessage: "terms"
1350
+ }) }),
1351
+ policy: /* @__PURE__ */ jsxRuntime.jsx(A, { target: "_blank", href: "https://strapi.io/privacy", rel: "noreferrer", children: formatMessage({
1352
+ id: "Auth.privacy-policy-agreement.policy",
1353
+ defaultMessage: "policy"
1354
+ }) })
1355
+ }
1356
+ )
1357
+ }
1358
+ ),
1359
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, size: "L", type: "submit", children: formatMessage({
1360
+ id: "Auth.form.button.register",
1361
+ defaultMessage: "Let's start"
1362
+ }) })
1363
+ ] }) }) });
1235
1364
  }
1236
1365
  }
1237
1366
  ),
1238
- !noSignin && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Link, { label: "Auth.link.signin", to: "/auth/login", children: formatMessage({
1367
+ match?.params.authType === "register" && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { as: reactRouterDom.NavLink, to: "/auth/login", children: formatMessage({
1239
1368
  id: "Auth.link.signin.account",
1240
1369
  defaultMessage: "Already have an account?"
1241
1370
  }) }) }) })
1242
1371
  ] }) });
1243
1372
  };
1244
- Register.defaultProps = {
1245
- fieldsToDisable: [],
1246
- noSignin: false,
1247
- onSubmit: (e) => e.preventDefault()
1248
- };
1249
- Register.propTypes = {
1250
- authType: PropTypes__default.default.string.isRequired,
1251
- fieldsToDisable: PropTypes__default.default.array,
1252
- noSignin: PropTypes__default.default.bool,
1253
- onSubmit: PropTypes__default.default.func,
1254
- schema: PropTypes__default.default.shape({
1255
- validate: PropTypes__default.default.func.isRequired,
1256
- type: PropTypes__default.default.string.isRequired
1257
- }).isRequired
1258
- };
1259
- const PasswordInput = styled__default.default(designSystem.TextInput)`
1373
+ function normalizeData(data) {
1374
+ return Object.entries(data).reduce(
1375
+ (acc, [key, value]) => {
1376
+ if (!["password", "confirmPassword"].includes(key) && typeof value === "string") {
1377
+ acc[key] = value.trim();
1378
+ if (key === "lastname") {
1379
+ acc[key] = value || void 0;
1380
+ }
1381
+ } else {
1382
+ acc[key] = value;
1383
+ }
1384
+ return acc;
1385
+ },
1386
+ {}
1387
+ );
1388
+ }
1389
+ const A = styled__default.default.a`
1390
+ color: ${({ theme }) => theme.colors.primary600};
1391
+ `;
1392
+ const PasswordInput$1 = styled__default.default(designSystem.TextInput)`
1260
1393
  ::-ms-reveal {
1261
1394
  display: none;
1262
1395
  }
1263
1396
  `;
1264
- const ForgotPassword = ({ onSubmit, schema }) => {
1265
- const [passwordShown, setPasswordShown] = React.useState(false);
1266
- const [confirmPasswordShown, setConfirmPasswordShown] = React.useState(false);
1397
+ const RESET_PASSWORD_SCHEMA = yup__namespace.object().shape({
1398
+ password: yup__namespace.string().min(8, helperPlugin.translatedErrors.minLength).matches(/[a-z]/, "components.Input.error.contain.lowercase").matches(/[A-Z]/, "components.Input.error.contain.uppercase").matches(/\d/, "components.Input.error.contain.number").required(helperPlugin.translatedErrors.required),
1399
+ confirmPassword: yup__namespace.string().oneOf([yup__namespace.ref("password"), null], "components.Input.error.password.noMatch").required(helperPlugin.translatedErrors.required)
1400
+ });
1401
+ const ResetPassword = () => {
1402
+ const [passwordShown, setPasswordShown] = React__namespace.useState(false);
1403
+ const [confirmPasswordShown, setConfirmPasswordShown] = React__namespace.useState(false);
1267
1404
  const { formatMessage } = reactIntl.useIntl();
1405
+ const { post } = helperPlugin.useFetchClient();
1406
+ const { push } = reactRouterDom.useHistory();
1407
+ const query = helperPlugin.useQuery();
1408
+ const { mutate, isError } = reactQuery.useMutation(
1409
+ async (body) => {
1410
+ const {
1411
+ data: { data }
1412
+ } = await post("/admin/reset-password", {
1413
+ ...body,
1414
+ resetPasswordToken: query.get("code")
1415
+ });
1416
+ return data;
1417
+ },
1418
+ {
1419
+ onSuccess(data) {
1420
+ if (data) {
1421
+ const { token, user } = data;
1422
+ helperPlugin.auth.setToken(token, false);
1423
+ helperPlugin.auth.setUserInfo(user, false);
1424
+ push("/");
1425
+ }
1426
+ }
1427
+ }
1428
+ );
1268
1429
  return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
1269
- /* @__PURE__ */ jsxRuntime.jsx(LayoutContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
1270
- formik.Formik,
1271
- {
1272
- enableReinitialize: true,
1273
- initialValues: {
1274
- password: "",
1275
- confirmPassword: ""
1276
- },
1277
- onSubmit,
1278
- validationSchema: schema,
1279
- validateOnChange: false,
1280
- children: ({ values, errors, handleChange }) => /* @__PURE__ */ jsxRuntime.jsxs(helperPlugin.Form, { noValidate: true, children: [
1281
- /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
1282
- /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
1283
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", children: formatMessage({
1284
- id: "global.reset-password",
1285
- defaultMessage: "Reset password"
1286
- }) }) }),
1287
- errors.errorMessage && /* @__PURE__ */ jsxRuntime.jsx(
1288
- designSystem.Typography,
1289
- {
1290
- id: "global-form-error",
1291
- role: "alert",
1292
- tabIndex: -1,
1293
- textColor: "danger600",
1294
- children: formatMessage({
1295
- id: errors.errorMessage,
1296
- defaultMessage: "An error occurred"
1297
- })
1298
- }
1299
- )
1300
- ] }),
1301
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
1430
+ /* @__PURE__ */ jsxRuntime.jsxs(LayoutContent, { children: [
1431
+ /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
1432
+ /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
1433
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", children: formatMessage({
1434
+ id: "global.reset-password",
1435
+ defaultMessage: "Reset password"
1436
+ }) }) }),
1437
+ isError ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "global-form-error", role: "alert", tabIndex: -1, textColor: "danger600", children: formatMessage({
1438
+ id: "notification.error",
1439
+ defaultMessage: "An error occurred"
1440
+ }) }) : null
1441
+ ] }),
1442
+ /* @__PURE__ */ jsxRuntime.jsx(
1443
+ formik.Formik,
1444
+ {
1445
+ enableReinitialize: true,
1446
+ initialValues: {
1447
+ password: "",
1448
+ confirmPassword: ""
1449
+ },
1450
+ onSubmit: (values) => {
1451
+ mutate({ password: values.password });
1452
+ },
1453
+ validationSchema: RESET_PASSWORD_SCHEMA,
1454
+ validateOnChange: false,
1455
+ children: ({ values, errors, handleChange }) => /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Form, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
1302
1456
  /* @__PURE__ */ jsxRuntime.jsx(
1303
1457
  PasswordInput,
1304
1458
  {
1305
1459
  name: "password",
1306
1460
  onChange: handleChange,
1307
1461
  value: values.password,
1308
- error: errors.password ? formatMessage({
1309
- id: errors.password,
1310
- defaultMessage: "This field is required."
1311
- }) : void 0,
1462
+ error: errors.password ? formatMessage(
1463
+ {
1464
+ id: errors.password,
1465
+ defaultMessage: "This field is required."
1466
+ },
1467
+ {
1468
+ min: 8
1469
+ }
1470
+ ) : void 0,
1312
1471
  endAction: /* @__PURE__ */ jsxRuntime.jsx(
1313
1472
  FieldActionWrapper,
1314
1473
  {
@@ -1377,161 +1536,47 @@ const ForgotPassword = ({ onSubmit, schema }) => {
1377
1536
  type: confirmPasswordShown ? "text" : "password"
1378
1537
  }
1379
1538
  ),
1380
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullwidth: true, type: "submit", children: formatMessage({
1539
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, type: "submit", children: formatMessage({
1381
1540
  id: "global.change-password",
1382
1541
  defaultMessage: "Change password"
1383
1542
  }) })
1384
- ] })
1385
- ] })
1386
- }
1387
- ) }),
1388
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.Link, { to: "/auth/login", children: formatMessage({ id: "Auth.link.ready", defaultMessage: "Ready to sign in?" }) }) }) })
1543
+ ] }) })
1544
+ }
1545
+ )
1546
+ ] }),
1547
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { as: reactRouterDom.NavLink, to: "/auth/login", children: formatMessage({ id: "Auth.link.ready", defaultMessage: "Ready to sign in?" }) }) }) })
1389
1548
  ] }) });
1390
1549
  };
1391
- ForgotPassword.defaultProps = {
1392
- onSubmit: (e) => e.preventDefault()
1393
- };
1394
- ForgotPassword.propTypes = {
1395
- onSubmit: PropTypes__default.default.func,
1396
- schema: PropTypes__default.default.shape({
1397
- type: PropTypes__default.default.string.isRequired
1398
- }).isRequired
1399
- };
1550
+ const PasswordInput = styled__default.default(designSystem.TextInput)`
1551
+ ::-ms-reveal {
1552
+ display: none;
1553
+ }
1554
+ `;
1400
1555
  const FORMS = {
1401
- "forgot-password": {
1402
- Component: ForgotPassword$1,
1403
- endPoint: "forgot-password",
1404
- fieldsToDisable: [],
1405
- fieldsToOmit: [],
1406
- schema: yup__namespace.object().shape({
1407
- email: yup__namespace.string().email(helperPlugin.translatedErrors.email).required(helperPlugin.translatedErrors.required)
1408
- }),
1409
- inputsPrefix: ""
1410
- },
1411
- "forgot-password-success": {
1412
- Component: ForgotPasswordSuccess,
1413
- endPoint: "",
1414
- fieldsToDisable: [],
1415
- fieldsToOmit: [],
1416
- schema: null,
1417
- inputsPrefix: ""
1418
- },
1556
+ "forgot-password": ForgotPassword,
1557
+ "forgot-password-success": ForgotPasswordSuccess,
1419
1558
  // the `Component` attribute is set after all forms and CE/EE components are loaded, but since we
1420
1559
  // are here outside of a React component we can not use the hook directly
1421
- login: {
1422
- endPoint: "login",
1423
- fieldsToDisable: [],
1424
- fieldsToOmit: ["rememberMe"],
1425
- schema: yup__namespace.object().shape({
1426
- email: yup__namespace.string().email(helperPlugin.translatedErrors.email).required(helperPlugin.translatedErrors.required),
1427
- password: yup__namespace.string().required(helperPlugin.translatedErrors.required),
1428
- rememberMe: yup__namespace.bool().nullable()
1429
- }),
1430
- inputsPrefix: ""
1431
- },
1432
- oops: {
1433
- Component: Oops,
1434
- endPoint: null,
1435
- fieldsToDisable: [],
1436
- fieldsToOmit: [],
1437
- schema: null,
1438
- inputsPrefix: ""
1439
- },
1440
- register: {
1441
- Component: Register,
1442
- endPoint: "register",
1443
- fieldsToDisable: ["email"],
1444
- fieldsToOmit: ["userInfo.confirmPassword", "userInfo.news", "userInfo.email"],
1445
- schema: yup__namespace.object().shape({
1446
- firstname: yup__namespace.string().trim().required(helperPlugin.translatedErrors.required),
1447
- lastname: yup__namespace.string().nullable(),
1448
- password: yup__namespace.string().min(8, helperPlugin.translatedErrors.minLength).matches(/[a-z]/, "components.Input.error.contain.lowercase").matches(/[A-Z]/, "components.Input.error.contain.uppercase").matches(/\d/, "components.Input.error.contain.number").required(helperPlugin.translatedErrors.required),
1449
- confirmPassword: yup__namespace.string().oneOf([yup__namespace.ref("password"), null], "components.Input.error.password.noMatch").required(helperPlugin.translatedErrors.required),
1450
- registrationToken: yup__namespace.string().required(helperPlugin.translatedErrors.required)
1451
- }),
1452
- inputsPrefix: "userInfo."
1453
- },
1454
- "register-admin": {
1455
- Component: Register,
1456
- endPoint: "register-admin",
1457
- noSignin: true,
1458
- fieldsToDisable: [],
1459
- fieldsToOmit: ["confirmPassword", "news"],
1460
- schema: yup__namespace.object().shape({
1461
- firstname: yup__namespace.string().trim().required(helperPlugin.translatedErrors.required),
1462
- lastname: yup__namespace.string().nullable(),
1463
- password: yup__namespace.string().min(8, helperPlugin.translatedErrors.minLength).matches(/[a-z]/, "components.Input.error.contain.lowercase").matches(/[A-Z]/, "components.Input.error.contain.uppercase").matches(/\d/, "components.Input.error.contain.number").required(helperPlugin.translatedErrors.required),
1464
- email: yup__namespace.string().email(helperPlugin.translatedErrors.email).strict().lowercase(helperPlugin.translatedErrors.lowercase).required(helperPlugin.translatedErrors.required),
1465
- confirmPassword: yup__namespace.string().oneOf([yup__namespace.ref("password"), null], "components.Input.error.password.noMatch").required(helperPlugin.translatedErrors.required)
1466
- }),
1467
- inputsPrefix: ""
1468
- },
1469
- "reset-password": {
1470
- Component: ForgotPassword,
1471
- endPoint: "reset-password",
1472
- fieldsToDisable: [],
1473
- fieldsToOmit: ["confirmPassword"],
1474
- schema: yup__namespace.object().shape({
1475
- password: yup__namespace.string().min(8, helperPlugin.translatedErrors.minLength).matches(/[a-z]/, "components.Input.error.contain.lowercase").matches(/[A-Z]/, "components.Input.error.contain.uppercase").matches(/\d/, "components.Input.error.contain.number").required(helperPlugin.translatedErrors.required),
1476
- confirmPassword: yup__namespace.string().oneOf([yup__namespace.ref("password"), null], "components.Input.error.password.noMatch").required(helperPlugin.translatedErrors.required)
1477
- })
1478
- }
1479
- };
1480
- const init = (initialState2) => {
1481
- return initialState2;
1482
- };
1483
- const initialState$7 = {
1484
- formErrors: {},
1485
- modifiedData: {},
1486
- requestError: null
1487
- };
1488
- const reducer$2 = (state, action) => produce__default.default(state, (draftState) => {
1489
- switch (action.type) {
1490
- case "ON_CHANGE": {
1491
- set__default.default(draftState.modifiedData, action.keys.split("."), action.value);
1492
- break;
1493
- }
1494
- case "RESET_PROPS": {
1495
- return initialState$7;
1496
- }
1497
- case "SET_DATA": {
1498
- draftState.modifiedData = action.data;
1499
- break;
1500
- }
1501
- case "SET_ERRORS": {
1502
- draftState.formErrors = action.errors;
1503
- break;
1504
- }
1505
- case "SET_REQUEST_ERROR": {
1506
- draftState.requestError = {
1507
- errorMessage: action.errorMessage,
1508
- errorStatus: action.errorStatus
1509
- };
1510
- break;
1511
- }
1512
- default:
1513
- return draftState;
1514
- }
1515
- });
1516
- const AuthPage = ({ hasAdmin, setHasAdmin }) => {
1560
+ login: () => null,
1561
+ oops: Oops,
1562
+ register: Register,
1563
+ "register-admin": Register,
1564
+ "reset-password": ResetPassword,
1565
+ providers: () => null
1566
+ };
1567
+ const AuthPage = ({ hasAdmin }) => {
1517
1568
  const {
1518
- push,
1519
1569
  location: { search }
1520
1570
  } = reactRouterDom.useHistory();
1521
- const { changeLocale } = useLocales();
1522
- const { setSkipped } = helperPlugin.useGuidedTour();
1523
- const { trackUsage } = helperPlugin.useTracking();
1524
- const {
1525
- params: { authType }
1526
- } = reactRouterDom.useRouteMatch("/auth/:authType");
1527
- const query = helperPlugin.useQuery();
1528
- const Login2 = useEnterprise(
1529
- LoginCE,
1530
- async () => (await Promise.resolve().then(() => require("./index-137490ba.js"))).LoginEE
1571
+ const match = reactRouterDom.useRouteMatch("/auth/:authType");
1572
+ const authType = match?.params.authType;
1573
+ const Login$1 = useEnterprise(
1574
+ Login,
1575
+ async () => (await Promise.resolve().then(() => require("./Login-7c938e98.js"))).LoginEE
1531
1576
  );
1532
1577
  const forms = useEnterprise(
1533
1578
  FORMS,
1534
- async () => (await Promise.resolve().then(() => require("./constants-727a113c.js"))).FORMS,
1579
+ async () => (await Promise.resolve().then(() => require("./constants-efc88bf2.js"))).FORMS,
1535
1580
  {
1536
1581
  combine(ceForms, eeForms) {
1537
1582
  return {
@@ -1542,170 +1587,11 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
1542
1587
  defaultValue: FORMS
1543
1588
  }
1544
1589
  );
1545
- const [{ formErrors, modifiedData, requestError }, dispatch] = React.useReducer(
1546
- reducer$2,
1547
- initialState$7,
1548
- init
1549
- );
1550
- const CancelToken = axios__default.default.CancelToken;
1551
- const source = CancelToken.source();
1552
- const { endPoint, fieldsToDisable, fieldsToOmit, inputsPrefix, schema, ...rest } = forms?.[authType] ?? {};
1553
- React.useEffect(() => {
1554
- return () => {
1555
- source.cancel("Component unmounted");
1556
- };
1557
- }, []);
1558
- const { post } = helperPlugin.useFetchClient();
1559
- React.useEffect(() => {
1560
- dispatch({
1561
- type: "RESET_PROPS"
1562
- });
1563
- }, [authType]);
1564
- const handleChange = ({ target: { name, value } }) => {
1565
- dispatch({
1566
- type: "ON_CHANGE",
1567
- keys: name,
1568
- value
1569
- });
1570
- };
1571
- const handleSubmit = async (e, { setSubmitting, setErrors }) => {
1572
- setSubmitting(true);
1573
- const body = omit__default.default(e, fieldsToOmit);
1574
- const requestURL = `/admin/${endPoint}`;
1575
- if (authType === "login") {
1576
- await loginRequest(e, requestURL, { setSubmitting, setErrors });
1577
- }
1578
- if (authType === "register" || authType === "register-admin") {
1579
- await registerRequest(e, requestURL, { setSubmitting, setErrors });
1580
- }
1581
- if (authType === "forgot-password") {
1582
- await forgotPasswordRequest(body, requestURL, { setSubmitting, setErrors });
1583
- }
1584
- if (authType === "reset-password") {
1585
- await resetPasswordRequest(body, requestURL, { setSubmitting, setErrors });
1586
- }
1587
- };
1588
- const forgotPasswordRequest = async (body, requestURL, { setSubmitting, setErrors }) => {
1589
- try {
1590
- await post(requestURL, body, { cancelToken: source.token });
1591
- push("/auth/forgot-password-success");
1592
- } catch (err) {
1593
- console.error(err);
1594
- setErrors({ errorMessage: "notification.error" });
1595
- } finally {
1596
- setSubmitting(false);
1597
- }
1598
- };
1599
- const loginRequest = async (body, requestURL, { setSubmitting, setErrors }) => {
1600
- try {
1601
- const {
1602
- data: {
1603
- data: { token, user }
1604
- }
1605
- } = await post(requestURL, omit__default.default(body, fieldsToOmit), { cancelToken: source.token });
1606
- if (user.preferedLanguage) {
1607
- changeLocale(user.preferedLanguage);
1608
- }
1609
- helperPlugin.auth.setToken(token, body.rememberMe);
1610
- helperPlugin.auth.setUserInfo(user, body.rememberMe);
1611
- redirectToPreviousLocation();
1612
- } catch (err) {
1613
- if (err.response) {
1614
- const errorMessage = get__default.default(
1615
- err,
1616
- ["response", "data", "error", "message"],
1617
- "Something went wrong"
1618
- );
1619
- if (camelCase__default.default(errorMessage).toLowerCase() === "usernotactive") {
1620
- push("/auth/oops");
1621
- dispatch({
1622
- type: "RESET_PROPS"
1623
- });
1624
- return;
1625
- }
1626
- setErrors({ errorMessage });
1627
- }
1628
- } finally {
1629
- setSubmitting(false);
1630
- }
1631
- };
1632
- const registerRequest = async (body, requestURL, { setSubmitting, setErrors }) => {
1633
- try {
1634
- trackUsage("willCreateFirstAdmin");
1635
- const {
1636
- data: {
1637
- data: { token, user }
1638
- }
1639
- } = await post(requestURL, omit__default.default(body, fieldsToOmit), { cancelToken: source.token });
1640
- helperPlugin.auth.setToken(token, false);
1641
- helperPlugin.auth.setUserInfo(user, false);
1642
- setSubmitting(false);
1643
- setHasAdmin(true);
1644
- const { roles } = user;
1645
- if (roles) {
1646
- const isUserSuperAdmin = roles.find(({ code }) => code === "strapi-super-admin");
1647
- if (isUserSuperAdmin) {
1648
- helperPlugin.auth.set(false, "GUIDED_TOUR_SKIPPED", true);
1649
- setSkipped(false);
1650
- trackUsage("didLaunchGuidedtour");
1651
- }
1652
- }
1653
- if (authType === "register" && body.userInfo.news === true || authType === "register-admin" && body.news === true) {
1654
- push({
1655
- pathname: "/usecase",
1656
- search: `?hasAdmin=${hasAdmin}`
1657
- });
1658
- return;
1659
- }
1660
- redirectToPreviousLocation();
1661
- } catch (err) {
1662
- trackUsage("didNotCreateFirstAdmin");
1663
- if (err.response) {
1664
- const { data } = err.response;
1665
- const apiErrors = formatAPIErrors(data);
1666
- setErrors({ apiErrors });
1667
- }
1668
- }
1669
- };
1670
- const resetPasswordRequest = async (body, requestURL, { setErrors, setSubmitting }) => {
1671
- try {
1672
- const {
1673
- data: {
1674
- data: { token, user }
1675
- }
1676
- } = await post(
1677
- requestURL,
1678
- { ...body, resetPasswordToken: query.get("code") },
1679
- { cancelToken: source.token }
1680
- );
1681
- helperPlugin.auth.setToken(token, false);
1682
- helperPlugin.auth.setUserInfo(user, false);
1683
- push("/");
1684
- } catch (err) {
1685
- if (err.response) {
1686
- const errorMessage = get__default.default(err, ["response", "data", "message"], "Something went wrong");
1687
- const errorStatus = get__default.default(err, ["response", "data", "statusCode"], 400);
1688
- dispatch({
1689
- type: "SET_REQUEST_ERROR",
1690
- errorMessage,
1691
- errorStatus
1692
- });
1693
- setErrors({ errorMessage });
1694
- }
1695
- } finally {
1696
- setSubmitting(false);
1697
- }
1698
- };
1699
- const redirectToPreviousLocation = () => {
1700
- if (authType === "login") {
1701
- const redirectTo = query.get("redirectTo");
1702
- const redirectUrl = redirectTo ? decodeURIComponent(redirectTo) : "/";
1703
- push(redirectUrl);
1704
- } else {
1705
- push("/");
1706
- }
1707
- };
1708
- if (!forms[authType] || hasAdmin && authType === "register-admin" || helperPlugin.auth.getToken()) {
1590
+ if (!authType || !forms) {
1591
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Redirect, { to: "/" });
1592
+ }
1593
+ const Component = forms[authType];
1594
+ if (!Component || hasAdmin && authType === "register-admin" || helperPlugin.auth.getToken()) {
1709
1595
  return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Redirect, { to: "/" });
1710
1596
  }
1711
1597
  if (!hasAdmin && authType !== "register-admin") {
@@ -1721,35 +1607,12 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
1721
1607
  }
1722
1608
  );
1723
1609
  }
1724
- if (Login2) {
1725
- forms.login.Component = Login2;
1726
- }
1727
- if (!Login2) {
1610
+ if (Login$1 && authType === "login") {
1611
+ return /* @__PURE__ */ jsxRuntime.jsx(Login$1, {});
1612
+ } else if (authType === "login" && !Login$1) {
1728
1613
  return null;
1729
1614
  }
1730
- const { Component } = forms?.[authType] ?? {};
1731
- return /* @__PURE__ */ jsxRuntime.jsx(
1732
- Component,
1733
- {
1734
- ...rest,
1735
- authType,
1736
- fieldsToDisable,
1737
- formErrors,
1738
- inputsPrefix,
1739
- modifiedData,
1740
- onChange: handleChange,
1741
- onSubmit: handleSubmit,
1742
- requestError,
1743
- schema
1744
- }
1745
- );
1746
- };
1747
- AuthPage.defaultProps = {
1748
- hasAdmin: false
1749
- };
1750
- AuthPage.propTypes = {
1751
- hasAdmin: PropTypes__default.default.bool,
1752
- setHasAdmin: PropTypes__default.default.func.isRequired
1615
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { hasAdmin });
1753
1616
  };
1754
1617
  const NotFoundPage = () => {
1755
1618
  const { formatMessage } = reactIntl.useIntl();
@@ -1944,12 +1807,12 @@ const createRoute = (loadComponent, to, exact = false) => {
1944
1807
  };
1945
1808
  const ROUTES_CE = null;
1946
1809
  const AuthenticatedApp = React__namespace.lazy(
1947
- () => Promise.resolve().then(() => require("./AuthenticatedApp-092ef2be.js")).then((n) => n.AuthenticatedApp).then((mod) => ({ default: mod.AuthenticatedApp }))
1810
+ () => Promise.resolve().then(() => require("./AuthenticatedApp-26a57d48.js")).then((n) => n.AuthenticatedApp).then((mod) => ({ default: mod.AuthenticatedApp }))
1948
1811
  );
1949
1812
  const App = () => {
1950
1813
  const adminPermissions = useEnterprise(
1951
1814
  ADMIN_PERMISSIONS_CE,
1952
- async () => (await Promise.resolve().then(() => require("./constants-86aa3e70.js"))).ADMIN_PERMISSIONS_EE,
1815
+ async () => (await Promise.resolve().then(() => require("./constants-7596f6f3.js"))).ADMIN_PERMISSIONS_EE,
1953
1816
  {
1954
1817
  combine(cePermissions, eePermissions) {
1955
1818
  return merge__default.default({}, cePermissions, eePermissions);
@@ -1959,7 +1822,7 @@ const App = () => {
1959
1822
  );
1960
1823
  const routes = useEnterprise(
1961
1824
  ROUTES_CE,
1962
- async () => (await Promise.resolve().then(() => require("./constants-86aa3e70.js"))).ROUTES_EE,
1825
+ async () => (await Promise.resolve().then(() => require("./constants-7596f6f3.js"))).ROUTES_EE,
1963
1826
  {
1964
1827
  defaultValue: []
1965
1828
  }
@@ -2057,7 +1920,6 @@ const App = () => {
2057
1920
  };
2058
1921
  getData();
2059
1922
  }, [toggleNotification, updateProjectSettings]);
2060
- const setHasAdmin = (hasAdmin2) => setState((prev) => ({ ...prev, hasAdmin: hasAdmin2 }));
2061
1923
  const trackingInfo = React__namespace.useMemo(
2062
1924
  () => ({
2063
1925
  uuid,
@@ -2077,7 +1939,7 @@ const App = () => {
2077
1939
  reactRouterDom.Route,
2078
1940
  {
2079
1941
  path: "/auth/:authType",
2080
- render: (routerProps) => /* @__PURE__ */ jsxRuntime.jsx(AuthPage, { ...routerProps, setHasAdmin, hasAdmin }),
1942
+ render: (routerProps) => /* @__PURE__ */ jsxRuntime.jsx(AuthPage, { ...routerProps, hasAdmin }),
2081
1943
  exact: true
2082
1944
  }
2083
1945
  ),
@@ -3507,6 +3369,7 @@ exports.RESET_PERMISSIONS = RESET_PERMISSIONS;
3507
3369
  exports.RESET_PROPS = RESET_PROPS$2;
3508
3370
  exports.RESET_PROPS$1 = RESET_PROPS;
3509
3371
  exports.RESET_PROPS$2 = RESET_PROPS$1;
3372
+ exports.SETTINGS_LINKS_CE = SETTINGS_LINKS_CE;
3510
3373
  exports.SET_DATA_STRUCTURES = SET_DATA_STRUCTURES;
3511
3374
  exports.SET_INIT_DATA = SET_INIT_DATA;
3512
3375
  exports.SET_LAYOUT = SET_LAYOUT;
@@ -3520,7 +3383,6 @@ exports.createRoute = createRoute;
3520
3383
  exports.createTypedSelector = createTypedSelector;
3521
3384
  exports.crudInitialState = crudInitialState;
3522
3385
  exports.crudReducer = crudReducer;
3523
- exports.formatAPIErrors = formatAPIErrors;
3524
3386
  exports.getBasename = getBasename;
3525
3387
  exports.initialState = initialState$1;
3526
3388
  exports.initialState$1 = initialState$3;
@@ -3533,4 +3395,4 @@ exports.useThemeToggle = useThemeToggle;
3533
3395
  exports.useTypedDispatch = useTypedDispatch;
3534
3396
  exports.useTypedSelector = useTypedSelector;
3535
3397
  exports.useTypedStore = useTypedStore;
3536
- //# sourceMappingURL=index-edc9bb0b.js.map
3398
+ //# sourceMappingURL=index-0134922e.js.map