@strapi/admin 4.16.2 → 4.18.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 (804) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +1 -1
  3. package/package.json +55 -41
  4. package/strapi-server.js +3 -3
  5. package/dist/_chunks/AuthenticatedApp-342bf22f.js +0 -1476
  6. package/dist/_chunks/AuthenticatedApp-342bf22f.js.map +0 -1
  7. package/dist/_chunks/AuthenticatedApp-bb31f306.mjs +0 -1450
  8. package/dist/_chunks/AuthenticatedApp-bb31f306.mjs.map +0 -1
  9. package/dist/_chunks/DragLayer-bff96835.mjs +0 -44
  10. package/dist/_chunks/DragLayer-bff96835.mjs.map +0 -1
  11. package/dist/_chunks/DragLayer-f07eee6c.js +0 -43
  12. package/dist/_chunks/DragLayer-f07eee6c.js.map +0 -1
  13. package/dist/_chunks/HomePage-0c7717c0.mjs +0 -49
  14. package/dist/_chunks/HomePage-0c7717c0.mjs.map +0 -1
  15. package/dist/_chunks/HomePage-175f79c7.js +0 -49
  16. package/dist/_chunks/HomePage-175f79c7.js.map +0 -1
  17. package/dist/_chunks/HomePage-246cc590.mjs +0 -542
  18. package/dist/_chunks/HomePage-246cc590.mjs.map +0 -1
  19. package/dist/_chunks/HomePage-6ff9e578.js +0 -563
  20. package/dist/_chunks/HomePage-6ff9e578.js.map +0 -1
  21. package/dist/_chunks/InstalledPluginsPage-170aff77.mjs +0 -134
  22. package/dist/_chunks/InstalledPluginsPage-170aff77.mjs.map +0 -1
  23. package/dist/_chunks/InstalledPluginsPage-3ae5dbb6.js +0 -153
  24. package/dist/_chunks/InstalledPluginsPage-3ae5dbb6.js.map +0 -1
  25. package/dist/_chunks/InternalErrorPage-040dc993.mjs +0 -41
  26. package/dist/_chunks/InternalErrorPage-040dc993.mjs.map +0 -1
  27. package/dist/_chunks/InternalErrorPage-d0e51ac2.js +0 -41
  28. package/dist/_chunks/InternalErrorPage-d0e51ac2.js.map +0 -1
  29. package/dist/_chunks/Layout-4b3e434a.js +0 -92
  30. package/dist/_chunks/Layout-4b3e434a.js.map +0 -1
  31. package/dist/_chunks/Layout-72fa2ace.mjs +0 -90
  32. package/dist/_chunks/Layout-72fa2ace.mjs.map +0 -1
  33. package/dist/_chunks/LimitsModal-203482b8.js +0 -84
  34. package/dist/_chunks/LimitsModal-203482b8.js.map +0 -1
  35. package/dist/_chunks/LimitsModal-da04700e.mjs +0 -82
  36. package/dist/_chunks/LimitsModal-da04700e.mjs.map +0 -1
  37. package/dist/_chunks/Login-576bbc11.js +0 -64
  38. package/dist/_chunks/Login-576bbc11.js.map +0 -1
  39. package/dist/_chunks/Login-d627bb0a.mjs +0 -62
  40. package/dist/_chunks/Login-d627bb0a.mjs.map +0 -1
  41. package/dist/_chunks/MarketplacePage-1cbfa8fd.mjs +0 -1011
  42. package/dist/_chunks/MarketplacePage-1cbfa8fd.mjs.map +0 -1
  43. package/dist/_chunks/MarketplacePage-e7cd973b.js +0 -1035
  44. package/dist/_chunks/MarketplacePage-e7cd973b.js.map +0 -1
  45. package/dist/_chunks/ProfilePage-52844daa.js +0 -665
  46. package/dist/_chunks/ProfilePage-52844daa.js.map +0 -1
  47. package/dist/_chunks/ProfilePage-ef400907.mjs +0 -642
  48. package/dist/_chunks/ProfilePage-ef400907.mjs.map +0 -1
  49. package/dist/_chunks/SSOProviders-62bfad92.mjs +0 -58
  50. package/dist/_chunks/SSOProviders-62bfad92.mjs.map +0 -1
  51. package/dist/_chunks/SSOProviders-b395a4e6.js +0 -59
  52. package/dist/_chunks/SSOProviders-b395a4e6.js.map +0 -1
  53. package/dist/_chunks/SalesPage-4a0a68fb.js +0 -51
  54. package/dist/_chunks/SalesPage-4a0a68fb.js.map +0 -1
  55. package/dist/_chunks/SalesPage-56bf9463.mjs +0 -48
  56. package/dist/_chunks/SalesPage-56bf9463.mjs.map +0 -1
  57. package/dist/_chunks/SalesPage-66f9ea32.js +0 -51
  58. package/dist/_chunks/SalesPage-66f9ea32.js.map +0 -1
  59. package/dist/_chunks/SalesPage-d0cdc1a7.js +0 -48
  60. package/dist/_chunks/SalesPage-d0cdc1a7.js.map +0 -1
  61. package/dist/_chunks/SalesPage-f9597ae7.mjs +0 -51
  62. package/dist/_chunks/SalesPage-f9597ae7.mjs.map +0 -1
  63. package/dist/_chunks/SalesPage-fceedf48.mjs +0 -51
  64. package/dist/_chunks/SalesPage-fceedf48.mjs.map +0 -1
  65. package/dist/_chunks/ar-21279f4c.js +0 -936
  66. package/dist/_chunks/ar-21279f4c.js.map +0 -1
  67. package/dist/_chunks/ar-62e5e2b3.mjs +0 -936
  68. package/dist/_chunks/ar-62e5e2b3.mjs.map +0 -1
  69. package/dist/_chunks/build-1026ce7c.mjs +0 -68
  70. package/dist/_chunks/build-1026ce7c.mjs.map +0 -1
  71. package/dist/_chunks/build-d99bcc06.js +0 -68
  72. package/dist/_chunks/build-d99bcc06.js.map +0 -1
  73. package/dist/_chunks/ca-d05fb350.js +0 -724
  74. package/dist/_chunks/ca-d05fb350.js.map +0 -1
  75. package/dist/_chunks/ca-e99de225.mjs +0 -724
  76. package/dist/_chunks/ca-e99de225.mjs.map +0 -1
  77. package/dist/_chunks/colors-c24a54f0.js +0 -33
  78. package/dist/_chunks/colors-c24a54f0.js.map +0 -1
  79. package/dist/_chunks/colors-e7489dd4.mjs +0 -34
  80. package/dist/_chunks/colors-e7489dd4.mjs.map +0 -1
  81. package/dist/_chunks/constants-2a8f4e41.mjs +0 -11
  82. package/dist/_chunks/constants-2a8f4e41.mjs.map +0 -1
  83. package/dist/_chunks/constants-40ffa931.js +0 -11
  84. package/dist/_chunks/constants-40ffa931.js.map +0 -1
  85. package/dist/_chunks/constants-4aca55b6.js +0 -85
  86. package/dist/_chunks/constants-4aca55b6.js.map +0 -1
  87. package/dist/_chunks/constants-64899732.js +0 -30
  88. package/dist/_chunks/constants-64899732.js.map +0 -1
  89. package/dist/_chunks/constants-6c68e9a0.js +0 -229
  90. package/dist/_chunks/constants-6c68e9a0.js.map +0 -1
  91. package/dist/_chunks/constants-6ecddc43.mjs +0 -111
  92. package/dist/_chunks/constants-6ecddc43.mjs.map +0 -1
  93. package/dist/_chunks/constants-74b8a935.mjs +0 -52
  94. package/dist/_chunks/constants-74b8a935.mjs.map +0 -1
  95. package/dist/_chunks/constants-7596f6f3.js +0 -132
  96. package/dist/_chunks/constants-7596f6f3.js.map +0 -1
  97. package/dist/_chunks/constants-8092eeb5.mjs +0 -59
  98. package/dist/_chunks/constants-8092eeb5.mjs.map +0 -1
  99. package/dist/_chunks/constants-85da8cc4.js +0 -58
  100. package/dist/_chunks/constants-85da8cc4.js.map +0 -1
  101. package/dist/_chunks/constants-a6fd64fc.mjs +0 -80
  102. package/dist/_chunks/constants-a6fd64fc.mjs.map +0 -1
  103. package/dist/_chunks/constants-a92ce583.mjs +0 -7
  104. package/dist/_chunks/constants-a92ce583.mjs.map +0 -1
  105. package/dist/_chunks/constants-ae0b83df.mjs +0 -227
  106. package/dist/_chunks/constants-ae0b83df.mjs.map +0 -1
  107. package/dist/_chunks/constants-c1f1f698.mjs +0 -85
  108. package/dist/_chunks/constants-c1f1f698.mjs.map +0 -1
  109. package/dist/_chunks/constants-d3dd8ed6.mjs +0 -7
  110. package/dist/_chunks/constants-d3dd8ed6.mjs.map +0 -1
  111. package/dist/_chunks/constants-d5d67ca8.js +0 -6
  112. package/dist/_chunks/constants-d5d67ca8.js.map +0 -1
  113. package/dist/_chunks/constants-da2542a3.js +0 -6
  114. package/dist/_chunks/constants-da2542a3.js.map +0 -1
  115. package/dist/_chunks/constants-ddd2d586.js +0 -82
  116. package/dist/_chunks/constants-ddd2d586.js.map +0 -1
  117. package/dist/_chunks/constants-def33545.mjs +0 -30
  118. package/dist/_chunks/constants-def33545.mjs.map +0 -1
  119. package/dist/_chunks/constants-e05f06d4.js +0 -52
  120. package/dist/_chunks/constants-e05f06d4.js.map +0 -1
  121. package/dist/_chunks/cs-2fa881a2.mjs +0 -291
  122. package/dist/_chunks/cs-2fa881a2.mjs.map +0 -1
  123. package/dist/_chunks/cs-eee75b10.js +0 -291
  124. package/dist/_chunks/cs-eee75b10.js.map +0 -1
  125. package/dist/_chunks/de-28f8bc28.mjs +0 -716
  126. package/dist/_chunks/de-28f8bc28.mjs.map +0 -1
  127. package/dist/_chunks/de-976cc986.js +0 -716
  128. package/dist/_chunks/de-976cc986.js.map +0 -1
  129. package/dist/_chunks/develop-72394876.mjs +0 -61
  130. package/dist/_chunks/develop-72394876.mjs.map +0 -1
  131. package/dist/_chunks/develop-da585b1e.js +0 -61
  132. package/dist/_chunks/develop-da585b1e.js.map +0 -1
  133. package/dist/_chunks/dk-0b759a56.mjs +0 -634
  134. package/dist/_chunks/dk-0b759a56.mjs.map +0 -1
  135. package/dist/_chunks/dk-6189917e.js +0 -634
  136. package/dist/_chunks/dk-6189917e.js.map +0 -1
  137. package/dist/_chunks/edit-29bdf5d6.js +0 -50
  138. package/dist/_chunks/edit-29bdf5d6.js.map +0 -1
  139. package/dist/_chunks/edit-923cefa0.mjs +0 -32
  140. package/dist/_chunks/edit-923cefa0.mjs.map +0 -1
  141. package/dist/_chunks/en-0e9e9327.js +0 -1022
  142. package/dist/_chunks/en-0e9e9327.js.map +0 -1
  143. package/dist/_chunks/en-e728accb.mjs +0 -1022
  144. package/dist/_chunks/en-e728accb.mjs.map +0 -1
  145. package/dist/_chunks/es-18b29db2.mjs +0 -796
  146. package/dist/_chunks/es-18b29db2.mjs.map +0 -1
  147. package/dist/_chunks/es-3ee0992a.js +0 -796
  148. package/dist/_chunks/es-3ee0992a.js.map +0 -1
  149. package/dist/_chunks/eu-8fd773c2.mjs +0 -832
  150. package/dist/_chunks/eu-8fd773c2.mjs.map +0 -1
  151. package/dist/_chunks/eu-be749f31.js +0 -832
  152. package/dist/_chunks/eu-be749f31.js.map +0 -1
  153. package/dist/_chunks/formatAPIErrors-b599cf27.js +0 -20
  154. package/dist/_chunks/formatAPIErrors-b599cf27.js.map +0 -1
  155. package/dist/_chunks/formatAPIErrors-db6ed675.mjs +0 -21
  156. package/dist/_chunks/formatAPIErrors-db6ed675.mjs.map +0 -1
  157. package/dist/_chunks/fr-29c84e1f.js +0 -762
  158. package/dist/_chunks/fr-29c84e1f.js.map +0 -1
  159. package/dist/_chunks/fr-f37df086.mjs +0 -762
  160. package/dist/_chunks/fr-f37df086.mjs.map +0 -1
  161. package/dist/_chunks/gu-377a4b46.js +0 -623
  162. package/dist/_chunks/gu-377a4b46.js.map +0 -1
  163. package/dist/_chunks/gu-69f0e13a.mjs +0 -623
  164. package/dist/_chunks/gu-69f0e13a.mjs.map +0 -1
  165. package/dist/_chunks/he-aec27352.js +0 -326
  166. package/dist/_chunks/he-aec27352.js.map +0 -1
  167. package/dist/_chunks/he-bd769d7e.mjs +0 -326
  168. package/dist/_chunks/he-bd769d7e.mjs.map +0 -1
  169. package/dist/_chunks/hi-1bdc7a46.js +0 -722
  170. package/dist/_chunks/hi-1bdc7a46.js.map +0 -1
  171. package/dist/_chunks/hi-d397a24b.mjs +0 -722
  172. package/dist/_chunks/hi-d397a24b.mjs.map +0 -1
  173. package/dist/_chunks/hu-e2c05f40.js +0 -832
  174. package/dist/_chunks/hu-e2c05f40.js.map +0 -1
  175. package/dist/_chunks/hu-eb88bd0c.mjs +0 -832
  176. package/dist/_chunks/hu-eb88bd0c.mjs.map +0 -1
  177. package/dist/_chunks/id-586df3a2.js +0 -448
  178. package/dist/_chunks/id-586df3a2.js.map +0 -1
  179. package/dist/_chunks/id-f47699e6.mjs +0 -448
  180. package/dist/_chunks/id-f47699e6.mjs.map +0 -1
  181. package/dist/_chunks/index-10a05917.mjs +0 -51
  182. package/dist/_chunks/index-10a05917.mjs.map +0 -1
  183. package/dist/_chunks/index-115d317b.mjs +0 -244
  184. package/dist/_chunks/index-115d317b.mjs.map +0 -1
  185. package/dist/_chunks/index-171715e4.js +0 -697
  186. package/dist/_chunks/index-171715e4.js.map +0 -1
  187. package/dist/_chunks/index-176cc121.mjs +0 -469
  188. package/dist/_chunks/index-176cc121.mjs.map +0 -1
  189. package/dist/_chunks/index-1bac5263.js +0 -338
  190. package/dist/_chunks/index-1bac5263.js.map +0 -1
  191. package/dist/_chunks/index-200c5a6a.js +0 -51
  192. package/dist/_chunks/index-200c5a6a.js.map +0 -1
  193. package/dist/_chunks/index-215b5421.mjs +0 -51
  194. package/dist/_chunks/index-215b5421.mjs.map +0 -1
  195. package/dist/_chunks/index-23401c29.js +0 -418
  196. package/dist/_chunks/index-23401c29.js.map +0 -1
  197. package/dist/_chunks/index-242c859c.js +0 -335
  198. package/dist/_chunks/index-242c859c.js.map +0 -1
  199. package/dist/_chunks/index-26fcb3ca.mjs +0 -1432
  200. package/dist/_chunks/index-26fcb3ca.mjs.map +0 -1
  201. package/dist/_chunks/index-28dd9303.mjs +0 -51
  202. package/dist/_chunks/index-28dd9303.mjs.map +0 -1
  203. package/dist/_chunks/index-296c14bf.mjs +0 -362
  204. package/dist/_chunks/index-296c14bf.mjs.map +0 -1
  205. package/dist/_chunks/index-2de06c32.js +0 -51
  206. package/dist/_chunks/index-2de06c32.js.map +0 -1
  207. package/dist/_chunks/index-2eb69b5d.mjs +0 -399
  208. package/dist/_chunks/index-2eb69b5d.mjs.map +0 -1
  209. package/dist/_chunks/index-2f61e3ae.js +0 -585
  210. package/dist/_chunks/index-2f61e3ae.js.map +0 -1
  211. package/dist/_chunks/index-308b73ba.mjs +0 -60
  212. package/dist/_chunks/index-308b73ba.mjs.map +0 -1
  213. package/dist/_chunks/index-34e41e15.js +0 -134
  214. package/dist/_chunks/index-34e41e15.js.map +0 -1
  215. package/dist/_chunks/index-38115cde.js +0 -66
  216. package/dist/_chunks/index-38115cde.js.map +0 -1
  217. package/dist/_chunks/index-383efae4.mjs +0 -55
  218. package/dist/_chunks/index-383efae4.mjs.map +0 -1
  219. package/dist/_chunks/index-3b426575.js +0 -47
  220. package/dist/_chunks/index-3b426575.js.map +0 -1
  221. package/dist/_chunks/index-47af1603.js +0 -253
  222. package/dist/_chunks/index-47af1603.js.map +0 -1
  223. package/dist/_chunks/index-49b7e6ff.mjs +0 -1266
  224. package/dist/_chunks/index-49b7e6ff.mjs.map +0 -1
  225. package/dist/_chunks/index-4d9b2cb9.js +0 -47
  226. package/dist/_chunks/index-4d9b2cb9.js.map +0 -1
  227. package/dist/_chunks/index-4de70b5d.js +0 -3404
  228. package/dist/_chunks/index-4de70b5d.js.map +0 -1
  229. package/dist/_chunks/index-59b1f604.js +0 -380
  230. package/dist/_chunks/index-59b1f604.js.map +0 -1
  231. package/dist/_chunks/index-5a5217e0.mjs +0 -308
  232. package/dist/_chunks/index-5a5217e0.mjs.map +0 -1
  233. package/dist/_chunks/index-5da07c41.js +0 -418
  234. package/dist/_chunks/index-5da07c41.js.map +0 -1
  235. package/dist/_chunks/index-600cb5dd.js +0 -51
  236. package/dist/_chunks/index-600cb5dd.js.map +0 -1
  237. package/dist/_chunks/index-608d8d10.mjs +0 -393
  238. package/dist/_chunks/index-608d8d10.mjs.map +0 -1
  239. package/dist/_chunks/index-74812118.mjs +0 -53
  240. package/dist/_chunks/index-74812118.mjs.map +0 -1
  241. package/dist/_chunks/index-7d578921.js +0 -847
  242. package/dist/_chunks/index-7d578921.js.map +0 -1
  243. package/dist/_chunks/index-8109fa91.mjs +0 -676
  244. package/dist/_chunks/index-8109fa91.mjs.map +0 -1
  245. package/dist/_chunks/index-82c7a120.js +0 -15401
  246. package/dist/_chunks/index-82c7a120.js.map +0 -1
  247. package/dist/_chunks/index-83d53962.js +0 -62
  248. package/dist/_chunks/index-83d53962.js.map +0 -1
  249. package/dist/_chunks/index-88298941.js +0 -54
  250. package/dist/_chunks/index-88298941.js.map +0 -1
  251. package/dist/_chunks/index-8933483b.mjs +0 -3374
  252. package/dist/_chunks/index-8933483b.mjs.map +0 -1
  253. package/dist/_chunks/index-91df57b1.mjs +0 -826
  254. package/dist/_chunks/index-91df57b1.mjs.map +0 -1
  255. package/dist/_chunks/index-973c363e.mjs +0 -63
  256. package/dist/_chunks/index-973c363e.mjs.map +0 -1
  257. package/dist/_chunks/index-989bbeec.mjs +0 -232
  258. package/dist/_chunks/index-989bbeec.mjs.map +0 -1
  259. package/dist/_chunks/index-9910dda4.js +0 -55
  260. package/dist/_chunks/index-9910dda4.js.map +0 -1
  261. package/dist/_chunks/index-9afb163a.js +0 -418
  262. package/dist/_chunks/index-9afb163a.js.map +0 -1
  263. package/dist/_chunks/index-9f61bef8.js +0 -51
  264. package/dist/_chunks/index-9f61bef8.js.map +0 -1
  265. package/dist/_chunks/index-ab31623a.mjs +0 -273
  266. package/dist/_chunks/index-ab31623a.mjs.map +0 -1
  267. package/dist/_chunks/index-ac85118a.mjs +0 -47
  268. package/dist/_chunks/index-ac85118a.mjs.map +0 -1
  269. package/dist/_chunks/index-ad8e55c0.mjs +0 -866
  270. package/dist/_chunks/index-ad8e55c0.mjs.map +0 -1
  271. package/dist/_chunks/index-aedeaf5a.js +0 -311
  272. package/dist/_chunks/index-aedeaf5a.js.map +0 -1
  273. package/dist/_chunks/index-bbac142a.js +0 -125
  274. package/dist/_chunks/index-bbac142a.js.map +0 -1
  275. package/dist/_chunks/index-bd18f803.mjs +0 -15320
  276. package/dist/_chunks/index-bd18f803.mjs.map +0 -1
  277. package/dist/_chunks/index-c8b8a2ee.mjs +0 -359
  278. package/dist/_chunks/index-c8b8a2ee.mjs.map +0 -1
  279. package/dist/_chunks/index-c97f5820.js +0 -1456
  280. package/dist/_chunks/index-c97f5820.js.map +0 -1
  281. package/dist/_chunks/index-cb6a72d2.mjs +0 -127
  282. package/dist/_chunks/index-cb6a72d2.mjs.map +0 -1
  283. package/dist/_chunks/index-cbc7c054.js +0 -266
  284. package/dist/_chunks/index-cbc7c054.js.map +0 -1
  285. package/dist/_chunks/index-ce5995cd.mjs +0 -132
  286. package/dist/_chunks/index-ce5995cd.mjs.map +0 -1
  287. package/dist/_chunks/index-d1152896.js +0 -294
  288. package/dist/_chunks/index-d1152896.js.map +0 -1
  289. package/dist/_chunks/index-d1dd825b.js +0 -365
  290. package/dist/_chunks/index-d1dd825b.js.map +0 -1
  291. package/dist/_chunks/index-d2d9df41.mjs +0 -270
  292. package/dist/_chunks/index-d2d9df41.mjs.map +0 -1
  293. package/dist/_chunks/index-d3e1fd86.js +0 -490
  294. package/dist/_chunks/index-d3e1fd86.js.map +0 -1
  295. package/dist/_chunks/index-d4517ac4.mjs +0 -582
  296. package/dist/_chunks/index-d4517ac4.mjs.map +0 -1
  297. package/dist/_chunks/index-d49fa655.js +0 -873
  298. package/dist/_chunks/index-d49fa655.js.map +0 -1
  299. package/dist/_chunks/index-d6694cab.mjs +0 -125
  300. package/dist/_chunks/index-d6694cab.mjs.map +0 -1
  301. package/dist/_chunks/index-e117c643.mjs +0 -55
  302. package/dist/_chunks/index-e117c643.mjs.map +0 -1
  303. package/dist/_chunks/index-e1b90981.mjs +0 -314
  304. package/dist/_chunks/index-e1b90981.mjs.map +0 -1
  305. package/dist/_chunks/index-e24df0bf.js +0 -403
  306. package/dist/_chunks/index-e24df0bf.js.map +0 -1
  307. package/dist/_chunks/index-e2d2f58e.mjs +0 -47
  308. package/dist/_chunks/index-e2d2f58e.mjs.map +0 -1
  309. package/dist/_chunks/index-e369d741.mjs +0 -383
  310. package/dist/_chunks/index-e369d741.mjs.map +0 -1
  311. package/dist/_chunks/index-e79b2b9e.mjs +0 -338
  312. package/dist/_chunks/index-e79b2b9e.mjs.map +0 -1
  313. package/dist/_chunks/index-ea18ff22.mjs +0 -51
  314. package/dist/_chunks/index-ea18ff22.mjs.map +0 -1
  315. package/dist/_chunks/index-eb67694f.mjs +0 -261
  316. package/dist/_chunks/index-eb67694f.mjs.map +0 -1
  317. package/dist/_chunks/index-ed3696ec.js +0 -272
  318. package/dist/_chunks/index-ed3696ec.js.map +0 -1
  319. package/dist/_chunks/index-ee1ea38b.js +0 -129
  320. package/dist/_chunks/index-ee1ea38b.js.map +0 -1
  321. package/dist/_chunks/index-efc967f5.js +0 -55
  322. package/dist/_chunks/index-efc967f5.js.map +0 -1
  323. package/dist/_chunks/index-fc700e52.js +0 -263
  324. package/dist/_chunks/index-fc700e52.js.map +0 -1
  325. package/dist/_chunks/index-fd4e5616.mjs +0 -412
  326. package/dist/_chunks/index-fd4e5616.mjs.map +0 -1
  327. package/dist/_chunks/index-ffd2f664.js +0 -1337
  328. package/dist/_chunks/index-ffd2f664.js.map +0 -1
  329. package/dist/_chunks/it-4006227c.mjs +0 -459
  330. package/dist/_chunks/it-4006227c.mjs.map +0 -1
  331. package/dist/_chunks/it-9c4295f1.js +0 -459
  332. package/dist/_chunks/it-9c4295f1.js.map +0 -1
  333. package/dist/_chunks/ja-db43ca3d.mjs +0 -633
  334. package/dist/_chunks/ja-db43ca3d.mjs.map +0 -1
  335. package/dist/_chunks/ja-eb74520f.js +0 -633
  336. package/dist/_chunks/ja-eb74520f.js.map +0 -1
  337. package/dist/_chunks/ko-18e71df4.js +0 -631
  338. package/dist/_chunks/ko-18e71df4.js.map +0 -1
  339. package/dist/_chunks/ko-a7826e25.mjs +0 -631
  340. package/dist/_chunks/ko-a7826e25.mjs.map +0 -1
  341. package/dist/_chunks/ml-90131768.mjs +0 -722
  342. package/dist/_chunks/ml-90131768.mjs.map +0 -1
  343. package/dist/_chunks/ml-c5199364.js +0 -722
  344. package/dist/_chunks/ml-c5199364.js.map +0 -1
  345. package/dist/_chunks/ms-bc514df6.js +0 -342
  346. package/dist/_chunks/ms-bc514df6.js.map +0 -1
  347. package/dist/_chunks/ms-f4f16a83.mjs +0 -342
  348. package/dist/_chunks/ms-f4f16a83.mjs.map +0 -1
  349. package/dist/_chunks/nl-887ce2c3.mjs +0 -828
  350. package/dist/_chunks/nl-887ce2c3.mjs.map +0 -1
  351. package/dist/_chunks/nl-f1aedbe2.js +0 -828
  352. package/dist/_chunks/nl-f1aedbe2.js.map +0 -1
  353. package/dist/_chunks/no-ec6c2927.js +0 -310
  354. package/dist/_chunks/no-ec6c2927.js.map +0 -1
  355. package/dist/_chunks/no-f0b02541.mjs +0 -310
  356. package/dist/_chunks/no-f0b02541.mjs.map +0 -1
  357. package/dist/_chunks/pl-9be86414.js +0 -721
  358. package/dist/_chunks/pl-9be86414.js.map +0 -1
  359. package/dist/_chunks/pl-9ccd35d9.mjs +0 -721
  360. package/dist/_chunks/pl-9ccd35d9.mjs.map +0 -1
  361. package/dist/_chunks/pt-4fcc08f1.js +0 -296
  362. package/dist/_chunks/pt-4fcc08f1.js.map +0 -1
  363. package/dist/_chunks/pt-8acb6ac1.mjs +0 -296
  364. package/dist/_chunks/pt-8acb6ac1.mjs.map +0 -1
  365. package/dist/_chunks/pt-BR-d43239e3.js +0 -794
  366. package/dist/_chunks/pt-BR-d43239e3.js.map +0 -1
  367. package/dist/_chunks/pt-BR-fd73cb13.mjs +0 -794
  368. package/dist/_chunks/pt-BR-fd73cb13.mjs.map +0 -1
  369. package/dist/_chunks/ru-9aad40c5.mjs +0 -993
  370. package/dist/_chunks/ru-9aad40c5.mjs.map +0 -1
  371. package/dist/_chunks/ru-c0293425.js +0 -993
  372. package/dist/_chunks/ru-c0293425.js.map +0 -1
  373. package/dist/_chunks/sa-6bf4c20e.mjs +0 -722
  374. package/dist/_chunks/sa-6bf4c20e.mjs.map +0 -1
  375. package/dist/_chunks/sa-8ffb7ca7.js +0 -722
  376. package/dist/_chunks/sa-8ffb7ca7.js.map +0 -1
  377. package/dist/_chunks/schema-260fec28.js +0 -514
  378. package/dist/_chunks/schema-260fec28.js.map +0 -1
  379. package/dist/_chunks/schema-6bd8bd85.mjs +0 -490
  380. package/dist/_chunks/schema-6bd8bd85.mjs.map +0 -1
  381. package/dist/_chunks/sk-58d31b17.mjs +0 -690
  382. package/dist/_chunks/sk-58d31b17.mjs.map +0 -1
  383. package/dist/_chunks/sk-a9308737.js +0 -690
  384. package/dist/_chunks/sk-a9308737.js.map +0 -1
  385. package/dist/_chunks/sv-0f5ffd1e.js +0 -827
  386. package/dist/_chunks/sv-0f5ffd1e.js.map +0 -1
  387. package/dist/_chunks/sv-d80ad633.mjs +0 -827
  388. package/dist/_chunks/sv-d80ad633.mjs.map +0 -1
  389. package/dist/_chunks/th-a53bbf7a.js +0 -430
  390. package/dist/_chunks/th-a53bbf7a.js.map +0 -1
  391. package/dist/_chunks/th-e72c6a22.mjs +0 -430
  392. package/dist/_chunks/th-e72c6a22.mjs.map +0 -1
  393. package/dist/_chunks/tr-b84a68b0.js +0 -785
  394. package/dist/_chunks/tr-b84a68b0.js.map +0 -1
  395. package/dist/_chunks/tr-e35ecfe8.mjs +0 -785
  396. package/dist/_chunks/tr-e35ecfe8.mjs.map +0 -1
  397. package/dist/_chunks/uk-de367ec1.mjs +0 -343
  398. package/dist/_chunks/uk-de367ec1.mjs.map +0 -1
  399. package/dist/_chunks/uk-e5226227.js +0 -343
  400. package/dist/_chunks/uk-e5226227.js.map +0 -1
  401. package/dist/_chunks/useAdminRolePermissions-603a2709.mjs +0 -2322
  402. package/dist/_chunks/useAdminRolePermissions-603a2709.mjs.map +0 -1
  403. package/dist/_chunks/useAdminRolePermissions-cb1a3ee2.js +0 -2337
  404. package/dist/_chunks/useAdminRolePermissions-cb1a3ee2.js.map +0 -1
  405. package/dist/_chunks/useAdminRoles-68d5d608.js +0 -62
  406. package/dist/_chunks/useAdminRoles-68d5d608.js.map +0 -1
  407. package/dist/_chunks/useAdminRoles-7ab5d521.mjs +0 -44
  408. package/dist/_chunks/useAdminRoles-7ab5d521.mjs.map +0 -1
  409. package/dist/_chunks/useAdminUsers-05d6b26a.js +0 -61
  410. package/dist/_chunks/useAdminUsers-05d6b26a.js.map +0 -1
  411. package/dist/_chunks/useAdminUsers-09f86a58.mjs +0 -43
  412. package/dist/_chunks/useAdminUsers-09f86a58.mjs.map +0 -1
  413. package/dist/_chunks/useContentTypes-53b449bb.mjs +0 -67
  414. package/dist/_chunks/useContentTypes-53b449bb.mjs.map +0 -1
  415. package/dist/_chunks/useContentTypes-7da293cc.js +0 -85
  416. package/dist/_chunks/useContentTypes-7da293cc.js.map +0 -1
  417. package/dist/_chunks/useDebounce-4712871e.js +0 -35
  418. package/dist/_chunks/useDebounce-4712871e.js.map +0 -1
  419. package/dist/_chunks/useDebounce-9364f340.mjs +0 -17
  420. package/dist/_chunks/useDebounce-9364f340.mjs.map +0 -1
  421. package/dist/_chunks/useLicenseLimitNotification-1fd756fa.mjs +0 -80
  422. package/dist/_chunks/useLicenseLimitNotification-1fd756fa.mjs.map +0 -1
  423. package/dist/_chunks/useLicenseLimitNotification-8a4d7fc1.js +0 -100
  424. package/dist/_chunks/useLicenseLimitNotification-8a4d7fc1.js.map +0 -1
  425. package/dist/_chunks/useLicenseLimits-13a102d3.mjs +0 -31
  426. package/dist/_chunks/useLicenseLimits-13a102d3.mjs.map +0 -1
  427. package/dist/_chunks/useLicenseLimits-81ef3cce.js +0 -49
  428. package/dist/_chunks/useLicenseLimits-81ef3cce.js.map +0 -1
  429. package/dist/_chunks/useReviewWorkflows-799e0305.js +0 -59
  430. package/dist/_chunks/useReviewWorkflows-799e0305.js.map +0 -1
  431. package/dist/_chunks/useReviewWorkflows-9e6b8986.mjs +0 -41
  432. package/dist/_chunks/useReviewWorkflows-9e6b8986.mjs.map +0 -1
  433. package/dist/_chunks/validateWorkflow-5693ea2d.js +0 -1124
  434. package/dist/_chunks/validateWorkflow-5693ea2d.js.map +0 -1
  435. package/dist/_chunks/validateWorkflow-7a2b6ab8.mjs +0 -1101
  436. package/dist/_chunks/validateWorkflow-7a2b6ab8.mjs.map +0 -1
  437. package/dist/_chunks/vi-096bccbb.mjs +0 -298
  438. package/dist/_chunks/vi-096bccbb.mjs.map +0 -1
  439. package/dist/_chunks/vi-c5fabb75.js +0 -298
  440. package/dist/_chunks/vi-c5fabb75.js.map +0 -1
  441. package/dist/_chunks/zh-24f618cb.js +0 -836
  442. package/dist/_chunks/zh-24f618cb.js.map +0 -1
  443. package/dist/_chunks/zh-Hans-35d2c374.js +0 -957
  444. package/dist/_chunks/zh-Hans-35d2c374.js.map +0 -1
  445. package/dist/_chunks/zh-Hans-ccf4be4b.mjs +0 -957
  446. package/dist/_chunks/zh-Hans-ccf4be4b.mjs.map +0 -1
  447. package/dist/_chunks/zh-ba29b2e1.mjs +0 -836
  448. package/dist/_chunks/zh-ba29b2e1.mjs.map +0 -1
  449. package/dist/admin/index.js +0 -34
  450. package/dist/admin/index.js.map +0 -1
  451. package/dist/admin/index.mjs +0 -34
  452. package/dist/admin/index.mjs.map +0 -1
  453. package/dist/admin/src/App.d.ts +0 -6
  454. package/dist/admin/src/StrapiApp.d.ts +0 -140
  455. package/dist/admin/src/components/AuthenticatedApp.d.ts +0 -2
  456. package/dist/admin/src/components/ConfigurationProvider.d.ts +0 -11
  457. package/dist/admin/src/components/DefaultDocument.d.ts +0 -5
  458. package/dist/admin/src/components/DragLayer.d.ts +0 -10
  459. package/dist/admin/src/components/GuidedTour/Homepage.d.ts +0 -2
  460. package/dist/admin/src/components/GuidedTour/Modal.d.ts +0 -2
  461. package/dist/admin/src/components/GuidedTour/Ornaments.d.ts +0 -13
  462. package/dist/admin/src/components/GuidedTour/Provider.d.ts +0 -6
  463. package/dist/admin/src/components/GuidedTour/constants.d.ts +0 -165
  464. package/dist/admin/src/components/LanguageProvider.d.ts +0 -19
  465. package/dist/admin/src/components/LeftMenu.d.ts +0 -5
  466. package/dist/admin/src/components/NoJavascript.d.ts +0 -7
  467. package/dist/admin/src/components/NpsSurvey.d.ts +0 -17
  468. package/dist/admin/src/components/Onboarding.d.ts +0 -2
  469. package/dist/admin/src/components/PluginsInitializer.d.ts +0 -5
  470. package/dist/admin/src/components/PrivateRoute.d.ts +0 -8
  471. package/dist/admin/src/components/Providers.d.ts +0 -13
  472. package/dist/admin/src/components/RBACProvider.d.ts +0 -27
  473. package/dist/admin/src/components/Theme.d.ts +0 -6
  474. package/dist/admin/src/components/ThemeToggleProvider.d.ts +0 -12
  475. package/dist/admin/src/components/UnauthenticatedLogo.d.ts +0 -2
  476. package/dist/admin/src/constants.d.ts +0 -195
  477. package/dist/admin/src/content-manager/components/BlocksInput/BlocksContent.d.ts +0 -5
  478. package/dist/admin/src/content-manager/components/BlocksInput/BlocksEditor.d.ts +0 -34
  479. package/dist/admin/src/content-manager/components/BlocksInput/BlocksInput.d.ts +0 -18
  480. package/dist/admin/src/content-manager/components/BlocksInput/BlocksToolbar.d.ts +0 -2
  481. package/dist/admin/src/content-manager/components/BlocksInput/hooks/useBlocksStore.d.ts +0 -32
  482. package/dist/admin/src/content-manager/components/BlocksInput/hooks/useModifiersStore.d.ts +0 -20
  483. package/dist/admin/src/content-manager/components/BlocksInput/plugins/withLinks.d.ts +0 -8
  484. package/dist/admin/src/content-manager/components/BlocksInput/plugins/withStrapiSchema.d.ts +0 -8
  485. package/dist/admin/src/content-manager/components/BlocksInput/tests/mock-schema.d.ts +0 -2
  486. package/dist/admin/src/content-manager/components/BlocksInput/utils/links.d.ts +0 -10
  487. package/dist/admin/src/content-manager/components/BlocksInput/utils/types.d.ts +0 -6
  488. package/dist/admin/src/contexts/admin.d.ts +0 -14
  489. package/dist/admin/src/contexts/apiTokenPermissions.d.ts +0 -36
  490. package/dist/admin/src/contexts/configuration.d.ts +0 -27
  491. package/dist/admin/src/contexts/themeToggle.d.ts +0 -22
  492. package/dist/admin/src/core/apis/Components.d.ts +0 -10
  493. package/dist/admin/src/core/apis/CustomFields.d.ts +0 -8
  494. package/dist/admin/src/core/apis/Fields.d.ts +0 -10
  495. package/dist/admin/src/core/apis/Middlewares.d.ts +0 -9
  496. package/dist/admin/src/core/apis/Plugin.d.ts +0 -19
  497. package/dist/admin/src/core/apis/Reducers.d.ts +0 -10
  498. package/dist/admin/src/core/store/configure.d.ts +0 -29
  499. package/dist/admin/src/core/store/hooks.d.ts +0 -37
  500. package/dist/admin/src/core/utils/basename.d.ts +0 -1
  501. package/dist/admin/src/core/utils/createHook.d.ts +0 -10
  502. package/dist/admin/src/hooks/__mocks__/useAdminUsers.d.ts +0 -2
  503. package/dist/admin/src/hooks/__mocks__/useContentTypes.d.ts +0 -2
  504. package/dist/admin/src/hooks/__mocks__/useSettingsMenu.d.ts +0 -2
  505. package/dist/admin/src/hooks/useAdminRoles.d.ts +0 -13
  506. package/dist/admin/src/hooks/useAdminUsers.d.ts +0 -19
  507. package/dist/admin/src/hooks/useContentTypes.d.ts +0 -7
  508. package/dist/admin/src/hooks/useDebounce.d.ts +0 -1
  509. package/dist/admin/src/hooks/useEnterprise.d.ts +0 -8
  510. package/dist/admin/src/hooks/useInjectReducer.d.ts +0 -10
  511. package/dist/admin/src/hooks/useLicenseLimitNotification.d.ts +0 -1
  512. package/dist/admin/src/hooks/useMenu.d.ts +0 -9
  513. package/dist/admin/src/hooks/useSettingsMenu.d.ts +0 -24
  514. package/dist/admin/src/index.d.ts +0 -3
  515. package/dist/admin/src/layouts/AppLayout.d.ts +0 -7
  516. package/dist/admin/src/layouts/UnauthenticatedLayout.d.ts +0 -11
  517. package/dist/admin/src/pages/Admin.d.ts +0 -7
  518. package/dist/admin/src/pages/Auth/AuthPage.d.ts +0 -6
  519. package/dist/admin/src/pages/Auth/components/FieldActionWrapper.d.ts +0 -3
  520. package/dist/admin/src/pages/Auth/components/ForgotPassword.d.ts +0 -3
  521. package/dist/admin/src/pages/Auth/components/ForgotPasswordSuccess.d.ts +0 -2
  522. package/dist/admin/src/pages/Auth/components/Login.d.ts +0 -8
  523. package/dist/admin/src/pages/Auth/components/Oops.d.ts +0 -2
  524. package/dist/admin/src/pages/Auth/components/Register.d.ts +0 -7
  525. package/dist/admin/src/pages/Auth/components/ResetPassword.d.ts +0 -3
  526. package/dist/admin/src/pages/Auth/constants.d.ts +0 -14
  527. package/dist/admin/src/pages/HomePage.d.ts +0 -3
  528. package/dist/admin/src/pages/InstalledPluginsPage.d.ts +0 -3
  529. package/dist/admin/src/pages/InternalErrorPage.d.ts +0 -7
  530. package/dist/admin/src/pages/Marketplace/MarketplacePage.d.ts +0 -19
  531. package/dist/admin/src/pages/Marketplace/components/NpmPackageCard.d.ts +0 -13
  532. package/dist/admin/src/pages/Marketplace/components/NpmPackagesFilters.d.ts +0 -13
  533. package/dist/admin/src/pages/Marketplace/components/NpmPackagesGrid.d.ts +0 -13
  534. package/dist/admin/src/pages/Marketplace/components/OfflineLayout.d.ts +0 -2
  535. package/dist/admin/src/pages/Marketplace/components/PageHeader.d.ts +0 -8
  536. package/dist/admin/src/pages/Marketplace/components/SortSelect.d.ts +0 -51
  537. package/dist/admin/src/pages/Marketplace/hooks/__mocks__/useNavigatorOnline.d.ts +0 -1
  538. package/dist/admin/src/pages/Marketplace/hooks/useMarketplaceData.d.ts +0 -92
  539. package/dist/admin/src/pages/Marketplace/hooks/useNavigatorOnline.d.ts +0 -5
  540. package/dist/admin/src/pages/NotFoundPage.d.ts +0 -1
  541. package/dist/admin/src/pages/ProfilePage.d.ts +0 -2
  542. package/dist/admin/src/pages/SettingsPage/hooks/useRegenerate.d.ts +0 -4
  543. package/dist/admin/src/pages/SettingsPage/pages/Roles/EditPage/hooks/usePermissionsDataManager.d.ts +0 -24
  544. package/dist/admin/src/pages/SettingsPage/pages/Roles/hooks/__mocks__/useAdminRolePermissions.d.ts +0 -2
  545. package/dist/admin/src/pages/SettingsPage/pages/Roles/hooks/useAdminRolePermissions.d.ts +0 -11
  546. package/dist/admin/src/pages/SettingsPage/utils/makeUniqueRoutes.d.ts +0 -6
  547. package/dist/admin/src/pages/UseCasePage.d.ts +0 -8
  548. package/dist/admin/src/reducer.d.ts +0 -21
  549. package/dist/admin/src/render.d.ts +0 -10
  550. package/dist/admin/src/selectors.d.ts +0 -21
  551. package/dist/admin/src/shared/components/InjectionZone.d.ts +0 -53
  552. package/dist/admin/src/shared/hooks/__mocks__/useInjectionZone.d.ts +0 -1
  553. package/dist/admin/src/shared/hooks/useInjectionZone.d.ts +0 -2
  554. package/dist/admin/src/translations/languageNativeNames.d.ts +0 -36
  555. package/dist/admin/src/types/permissions.d.ts +0 -17
  556. package/dist/admin/src/utils/createRoute.d.ts +0 -6
  557. package/dist/admin/src/utils/formatAPIErrors.d.ts +0 -6
  558. package/dist/admin/src/utils/getFullName.d.ts +0 -1
  559. package/dist/admin/src/utils/hashAdminUserEmail.d.ts +0 -6
  560. package/dist/cli.js +0 -48
  561. package/dist/cli.js.map +0 -1
  562. package/dist/cli.mjs +0 -48
  563. package/dist/cli.mjs.map +0 -1
  564. package/dist/ee/admin/src/constants.d.ts +0 -55
  565. package/dist/ee/admin/src/hooks/useLicenseLimitNotification.d.ts +0 -1
  566. package/dist/ee/admin/src/pages/AuthPage/components/Login.d.ts +0 -3
  567. package/dist/ee/admin/src/pages/AuthPage/components/Providers.d.ts +0 -2
  568. package/dist/ee/admin/src/pages/AuthPage/components/SSOProviders.d.ts +0 -8
  569. package/dist/ee/admin/src/pages/AuthPage/constants.d.ts +0 -3
  570. package/dist/ee/admin/src/pages/AuthResponse.d.ts +0 -2
  571. package/dist/ee/admin/src/pages/HomePage.d.ts +0 -1
  572. package/dist/shared/contracts/admin.d.ts +0 -23
  573. package/dist/shared/contracts/authentication.d.ts +0 -126
  574. package/dist/shared/contracts/providers.d.ts +0 -34
  575. package/dist/shared/contracts/roles.d.ts +0 -52
  576. package/dist/shared/contracts/shared.d.ts +0 -39
  577. package/dist/shared/contracts/user.d.ts +0 -40
  578. package/dist/shared/contracts/users.d.ts +0 -52
  579. package/dist/shared/schema.d.ts +0 -7
  580. package/ee/server/bootstrap.js +0 -41
  581. package/ee/server/config/admin-actions.js +0 -72
  582. package/ee/server/constants/default-stages.json +0 -18
  583. package/ee/server/constants/default-workflow.json +0 -3
  584. package/ee/server/constants/webhookEvents.js +0 -5
  585. package/ee/server/constants/workflows.js +0 -33
  586. package/ee/server/content-types/index.js +0 -9
  587. package/ee/server/content-types/workflow/index.js +0 -41
  588. package/ee/server/content-types/workflow-stage/index.js +0 -51
  589. package/ee/server/controllers/__tests__/stages.test.js +0 -174
  590. package/ee/server/controllers/admin.js +0 -50
  591. package/ee/server/controllers/audit-logs.js +0 -24
  592. package/ee/server/controllers/authentication/constants.js +0 -11
  593. package/ee/server/controllers/authentication/index.js +0 -11
  594. package/ee/server/controllers/authentication/middlewares.js +0 -117
  595. package/ee/server/controllers/authentication/utils.js +0 -23
  596. package/ee/server/controllers/authentication.js +0 -64
  597. package/ee/server/controllers/index.js +0 -12
  598. package/ee/server/controllers/role.js +0 -64
  599. package/ee/server/controllers/user.js +0 -110
  600. package/ee/server/controllers/workflows/assignees/index.js +0 -44
  601. package/ee/server/controllers/workflows/index.js +0 -188
  602. package/ee/server/controllers/workflows/stages/index.js +0 -189
  603. package/ee/server/destroy.js +0 -12
  604. package/ee/server/index.js +0 -11
  605. package/ee/server/middlewares/__tests__/review-workflows.test.js +0 -40
  606. package/ee/server/middlewares/review-workflows.js +0 -40
  607. package/ee/server/migrations/audit-logs-table.js +0 -45
  608. package/ee/server/migrations/review-workflows-content-types.js +0 -29
  609. package/ee/server/migrations/review-workflows-deleted-ct-in-workflows.js +0 -39
  610. package/ee/server/migrations/review-workflows-stage-attribute.js +0 -49
  611. package/ee/server/migrations/review-workflows-stages-color.js +0 -20
  612. package/ee/server/migrations/review-workflows-stages-roles.js +0 -68
  613. package/ee/server/migrations/review-workflows-workflow-name.js +0 -28
  614. package/ee/server/register.js +0 -40
  615. package/ee/server/routes/audit-logs.js +0 -43
  616. package/ee/server/routes/index.js +0 -8
  617. package/ee/server/routes/license-limit.js +0 -29
  618. package/ee/server/routes/review-workflows.js +0 -164
  619. package/ee/server/routes/sso.js +0 -69
  620. package/ee/server/routes/utils.js +0 -15
  621. package/ee/server/services/__tests__/assignees.test.js +0 -76
  622. package/ee/server/services/__tests__/audit-logs.test.js +0 -300
  623. package/ee/server/services/__tests__/passport.test.js +0 -95
  624. package/ee/server/services/__tests__/review-workflows-validation.test.js +0 -100
  625. package/ee/server/services/__tests__/review-workflows.test.js +0 -163
  626. package/ee/server/services/__tests__/sso.test.js +0 -117
  627. package/ee/server/services/__tests__/stages.test.js +0 -275
  628. package/ee/server/services/__tests__/workflows.test.js +0 -203
  629. package/ee/server/services/audit-logs.js +0 -236
  630. package/ee/server/services/auth.js +0 -75
  631. package/ee/server/services/index.js +0 -18
  632. package/ee/server/services/passport/provider-registry.js +0 -27
  633. package/ee/server/services/passport/sso.js +0 -37
  634. package/ee/server/services/passport.js +0 -46
  635. package/ee/server/services/review-workflows/__tests__/entity-service-decorator.test.js +0 -211
  636. package/ee/server/services/review-workflows/assignees.js +0 -54
  637. package/ee/server/services/review-workflows/entity-service-decorator.js +0 -101
  638. package/ee/server/services/review-workflows/metrics/__tests__/weekly-metrics.test.js +0 -65
  639. package/ee/server/services/review-workflows/metrics/index.js +0 -56
  640. package/ee/server/services/review-workflows/metrics/weekly-metrics.js +0 -76
  641. package/ee/server/services/review-workflows/review-workflows.js +0 -133
  642. package/ee/server/services/review-workflows/stage-permissions.js +0 -60
  643. package/ee/server/services/review-workflows/stages.js +0 -384
  644. package/ee/server/services/review-workflows/validation.js +0 -68
  645. package/ee/server/services/review-workflows/workflows/__tests__/content-types.test.js +0 -146
  646. package/ee/server/services/review-workflows/workflows/content-types.js +0 -89
  647. package/ee/server/services/review-workflows/workflows/index.js +0 -237
  648. package/ee/server/services/role.js +0 -24
  649. package/ee/server/services/seat-enforcement.js +0 -114
  650. package/ee/server/services/user.js +0 -234
  651. package/ee/server/utils/__tests__/persisted-tables.test.js +0 -38
  652. package/ee/server/utils/__tests__/sso-lock.test.js +0 -84
  653. package/ee/server/utils/index.js +0 -8
  654. package/ee/server/utils/persisted-tables.js +0 -139
  655. package/ee/server/utils/review-workflows.js +0 -39
  656. package/ee/server/utils/sso-lock.js +0 -42
  657. package/ee/server/validation/audit-logs.js +0 -18
  658. package/ee/server/validation/authentication.js +0 -36
  659. package/ee/server/validation/review-workflows.js +0 -92
  660. package/ee/server/validation/role.js +0 -68
  661. package/ee/server/validation/user.js +0 -27
  662. package/ee/strapi-server.js +0 -3
  663. package/server/bootstrap.js +0 -101
  664. package/server/config/admin-actions.js +0 -216
  665. package/server/config/admin-conditions.js +0 -26
  666. package/server/config/email-templates/forgot-password.js +0 -25
  667. package/server/config/index.js +0 -9
  668. package/server/config/settings.js +0 -9
  669. package/server/content-types/Permission.js +0 -64
  670. package/server/content-types/Role.js +0 -59
  671. package/server/content-types/User.js +0 -112
  672. package/server/content-types/api-token-permission.js +0 -36
  673. package/server/content-types/api-token.js +0 -76
  674. package/server/content-types/index.js +0 -11
  675. package/server/content-types/transfer-token-permission.js +0 -36
  676. package/server/content-types/transfer-token.js +0 -66
  677. package/server/controllers/__tests__/admin.test.js +0 -106
  678. package/server/controllers/__tests__/api-token.test.js +0 -496
  679. package/server/controllers/__tests__/content-api.test.js +0 -173
  680. package/server/controllers/__tests__/permission.test.js +0 -200
  681. package/server/controllers/__tests__/role.test.js +0 -201
  682. package/server/controllers/__tests__/transfer/token.test.js +0 -520
  683. package/server/controllers/__tests__/user.test.js +0 -326
  684. package/server/controllers/admin.js +0 -151
  685. package/server/controllers/api-token.js +0 -135
  686. package/server/controllers/authenticated-user.js +0 -52
  687. package/server/controllers/authentication.js +0 -172
  688. package/server/controllers/content-api.js +0 -15
  689. package/server/controllers/formatters/conditions.js +0 -12
  690. package/server/controllers/formatters/format-actions-by-sections.js +0 -40
  691. package/server/controllers/formatters/index.js +0 -9
  692. package/server/controllers/index.js +0 -14
  693. package/server/controllers/permission.js +0 -45
  694. package/server/controllers/role.js +0 -198
  695. package/server/controllers/transfer/index.js +0 -13
  696. package/server/controllers/transfer/runner.js +0 -28
  697. package/server/controllers/transfer/token.js +0 -131
  698. package/server/controllers/user.js +0 -141
  699. package/server/controllers/webhooks.js +0 -132
  700. package/server/destroy.js +0 -10
  701. package/server/domain/action/__tests__/action-domain.test.js +0 -230
  702. package/server/domain/action/__tests__/action-provider.test.js +0 -376
  703. package/server/domain/action/index.js +0 -142
  704. package/server/domain/action/provider.js +0 -83
  705. package/server/domain/condition/__tests__/condition-domain.test.js +0 -122
  706. package/server/domain/condition/__tests__/condition-provider.test.js +0 -156
  707. package/server/domain/condition/index.js +0 -92
  708. package/server/domain/condition/provider.js +0 -42
  709. package/server/domain/permission/__tests__/permission-domain.test.js +0 -285
  710. package/server/domain/permission/index.js +0 -156
  711. package/server/domain/user.js +0 -28
  712. package/server/index.js +0 -26
  713. package/server/middlewares/data-transfer.js +0 -29
  714. package/server/middlewares/index.js +0 -8
  715. package/server/middlewares/rateLimit.js +0 -47
  716. package/server/policies/hasPermissions.js +0 -38
  717. package/server/policies/index.js +0 -7
  718. package/server/policies/isAuthenticatedAdmin.js +0 -5
  719. package/server/policies/isTelemetryEnabled.js +0 -16
  720. package/server/register.js +0 -19
  721. package/server/routes/admin.js +0 -71
  722. package/server/routes/api-tokens.js +0 -70
  723. package/server/routes/authentication.js +0 -57
  724. package/server/routes/content-api.js +0 -20
  725. package/server/routes/index.js +0 -28
  726. package/server/routes/permissions.js +0 -20
  727. package/server/routes/roles.js +0 -107
  728. package/server/routes/serve-admin-panel.js +0 -71
  729. package/server/routes/transfer.js +0 -102
  730. package/server/routes/users.js +0 -88
  731. package/server/routes/webhooks.js +0 -81
  732. package/server/services/__tests__/action.test.js +0 -98
  733. package/server/services/__tests__/api-token.test.js +0 -980
  734. package/server/services/__tests__/auth.test.js +0 -319
  735. package/server/services/__tests__/content-type.test.js +0 -405
  736. package/server/services/__tests__/metrics.test.js +0 -65
  737. package/server/services/__tests__/passport.test.js +0 -90
  738. package/server/services/__tests__/permission.test.js +0 -177
  739. package/server/services/__tests__/permissions-manager-sanitize.test.js +0 -117
  740. package/server/services/__tests__/permissions-manager-validate.test.js +0 -119
  741. package/server/services/__tests__/permissions-manager.test.js +0 -318
  742. package/server/services/__tests__/permissions.section-builder.section.test.js +0 -136
  743. package/server/services/__tests__/project-settings.test.js +0 -397
  744. package/server/services/__tests__/role.test.js +0 -970
  745. package/server/services/__tests__/token.test.js +0 -217
  746. package/server/services/__tests__/transfer/token.test.js +0 -878
  747. package/server/services/__tests__/user.test.js +0 -786
  748. package/server/services/action.js +0 -35
  749. package/server/services/api-token.js +0 -453
  750. package/server/services/auth.js +0 -117
  751. package/server/services/condition.js +0 -14
  752. package/server/services/constants.js +0 -37
  753. package/server/services/content-type.js +0 -208
  754. package/server/services/index.js +0 -18
  755. package/server/services/metrics.js +0 -44
  756. package/server/services/passport/local-strategy.js +0 -28
  757. package/server/services/passport.js +0 -45
  758. package/server/services/permission/engine.js +0 -85
  759. package/server/services/permission/permissions-manager/index.js +0 -53
  760. package/server/services/permission/permissions-manager/query-builders.js +0 -72
  761. package/server/services/permission/permissions-manager/sanitize.js +0 -286
  762. package/server/services/permission/permissions-manager/validate.js +0 -218
  763. package/server/services/permission/queries.js +0 -190
  764. package/server/services/permission/sections-builder/builder.js +0 -84
  765. package/server/services/permission/sections-builder/handlers.js +0 -156
  766. package/server/services/permission/sections-builder/index.js +0 -50
  767. package/server/services/permission/sections-builder/section.js +0 -71
  768. package/server/services/permission/sections-builder/utils.js +0 -26
  769. package/server/services/permission.js +0 -33
  770. package/server/services/project-settings.js +0 -174
  771. package/server/services/role.js +0 -471
  772. package/server/services/token.js +0 -70
  773. package/server/services/transfer/index.js +0 -7
  774. package/server/services/transfer/permission.js +0 -22
  775. package/server/services/transfer/token.js +0 -449
  776. package/server/services/transfer/utils.js +0 -38
  777. package/server/services/user.js +0 -363
  778. package/server/strategies/__tests__/admin.test.js +0 -118
  779. package/server/strategies/__tests__/api-token.test.js +0 -364
  780. package/server/strategies/admin.js +0 -52
  781. package/server/strategies/api-token.js +0 -140
  782. package/server/strategies/data-transfer.js +0 -113
  783. package/server/strategies/index.js +0 -26
  784. package/server/utils/index.d.ts +0 -25
  785. package/server/utils/index.js +0 -9
  786. package/server/validation/__tests__/common-functions.test.js +0 -54
  787. package/server/validation/action-provider.js +0 -67
  788. package/server/validation/api-tokens.js +0 -32
  789. package/server/validation/authentication/forgot-password.js +0 -14
  790. package/server/validation/authentication/index.js +0 -19
  791. package/server/validation/authentication/register.js +0 -45
  792. package/server/validation/authentication/renew-token.js +0 -7
  793. package/server/validation/authentication/reset-password.js +0 -15
  794. package/server/validation/common-functions/check-fields-are-correctly-nested.js +0 -28
  795. package/server/validation/common-functions/check-fields-dont-have-duplicates.js +0 -17
  796. package/server/validation/common-functions/index.js +0 -9
  797. package/server/validation/common-validators.js +0 -209
  798. package/server/validation/permission.js +0 -53
  799. package/server/validation/policies/hasPermissions.js +0 -27
  800. package/server/validation/project-settings.js +0 -48
  801. package/server/validation/role.js +0 -59
  802. package/server/validation/transfer/index.js +0 -5
  803. package/server/validation/transfer/token.js +0 -42
  804. package/server/validation/user.js +0 -65
@@ -1,3404 +0,0 @@
1
- "use strict";
2
- const jsxRuntime = require("react/jsx-runtime");
3
- const helperPlugin = require("@strapi/helper-plugin");
4
- const client = require("react-dom/client");
5
- const designSystem = require("@strapi/design-system");
6
- const invariant = require("invariant");
7
- const isFunction = require("lodash/isFunction");
8
- const merge = require("lodash/merge");
9
- const pick = require("lodash/pick");
10
- const reactHelmet = require("react-helmet");
11
- const reactRouterDom = require("react-router-dom");
12
- const React = require("react");
13
- const reactIntl = require("react-intl");
14
- const reactRedux = require("react-redux");
15
- const reactContext = require("@radix-ui/react-context");
16
- const v2 = require("@strapi/design-system/v2");
17
- const Icons = require("@strapi/icons");
18
- const formik = require("formik");
19
- const camelCase = require("lodash/camelCase");
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");
26
- const produce = require("immer");
27
- const get = require("lodash/get");
28
- const set = require("lodash/set");
29
- const toolkit = require("@reduxjs/toolkit");
30
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
31
- function _interopNamespace(e) {
32
- if (e && e.__esModule)
33
- return e;
34
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
35
- if (e) {
36
- for (const k in e) {
37
- if (k !== "default") {
38
- const d = Object.getOwnPropertyDescriptor(e, k);
39
- Object.defineProperty(n, k, d.get ? d : {
40
- enumerable: true,
41
- get: () => e[k]
42
- });
43
- }
44
- }
45
- }
46
- n.default = e;
47
- return Object.freeze(n);
48
- }
49
- const invariant__default = /* @__PURE__ */ _interopDefault(invariant);
50
- const isFunction__default = /* @__PURE__ */ _interopDefault(isFunction);
51
- const merge__default = /* @__PURE__ */ _interopDefault(merge);
52
- const pick__default = /* @__PURE__ */ _interopDefault(pick);
53
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
54
- const camelCase__default = /* @__PURE__ */ _interopDefault(camelCase);
55
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
56
- const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
57
- const defaultsDeep__default = /* @__PURE__ */ _interopDefault(defaultsDeep);
58
- const omit__default = /* @__PURE__ */ _interopDefault(omit);
59
- const produce__default = /* @__PURE__ */ _interopDefault(produce);
60
- const get__default = /* @__PURE__ */ _interopDefault(get);
61
- const set__default = /* @__PURE__ */ _interopDefault(set);
62
- const styles = `
63
- .strapi--root {
64
- position: absolute;
65
- top: 0;
66
- right: 0;
67
- left: 0;
68
- bottom: 0;
69
- background: #fff;
70
- }
71
-
72
- .strapi--no-js {
73
- position: absolute;
74
- top: 50%;
75
- left: 50%;
76
- transform: translate(-50%, -50%);
77
- text-align: center;
78
- font-family: helvetica, arial, sans-serif;
79
- }
80
- `;
81
- const NoJavascript = () => {
82
- return /* @__PURE__ */ jsxRuntime.jsx("noscript", { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "strapi--root", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "strapi--no-js", children: [
83
- /* @__PURE__ */ jsxRuntime.jsx("style", { type: "text/css", children: styles }),
84
- /* @__PURE__ */ jsxRuntime.jsx("h1", { children: "JavaScript disabled" }),
85
- /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
86
- "Please ",
87
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://www.enable-javascript.com/", children: "enable JavaScript" }),
88
- " in your browser and reload the page to proceed."
89
- ] })
90
- ] }) }) });
91
- };
92
- const globalStyles = `
93
- html,
94
- body,
95
- #strapi {
96
- height: 100%;
97
- }
98
- body {
99
- margin: 0;
100
- -webkit-font-smoothing: antialiased;
101
- }
102
- `;
103
- const DefaultDocument = () => {
104
- return /* @__PURE__ */ jsxRuntime.jsxs("html", { lang: "en", children: [
105
- /* @__PURE__ */ jsxRuntime.jsxs("head", { children: [
106
- /* @__PURE__ */ jsxRuntime.jsx("meta", { charSet: "utf-8" }),
107
- /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1, viewport-fit=cover" }),
108
- /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "robots", content: "noindex" }),
109
- /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "referrer", content: "same-origin" }),
110
- /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Strapi Admin" }),
111
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: globalStyles })
112
- ] }),
113
- /* @__PURE__ */ jsxRuntime.jsxs("body", { children: [
114
- /* @__PURE__ */ jsxRuntime.jsx("div", { id: "strapi" }),
115
- /* @__PURE__ */ jsxRuntime.jsx(NoJavascript, {})
116
- ] })
117
- ] });
118
- };
119
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
120
- const v = glob[path];
121
- if (v) {
122
- return typeof v === "function" ? v() : Promise.resolve(v);
123
- }
124
- return new Promise((_, reject) => {
125
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
126
- });
127
- };
128
- const PrivateRoute = ({
129
- component: Component,
130
- path,
131
- ...rest
132
- }) => {
133
- const { pathname, search } = reactRouterDom.useLocation();
134
- return /* @__PURE__ */ jsxRuntime.jsx(
135
- reactRouterDom.Route,
136
- {
137
- path,
138
- render: (props) => helperPlugin.auth.getToken() !== null ? /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, ...props }) : /* @__PURE__ */ jsxRuntime.jsx(
139
- reactRouterDom.Redirect,
140
- {
141
- to: {
142
- pathname: "/auth/login",
143
- search: pathname !== "/" ? `?redirectTo=${encodeURIComponent(`${pathname}${search}`)}` : void 0
144
- }
145
- }
146
- )
147
- }
148
- );
149
- };
150
- const ADMIN_PERMISSIONS_CE = {
151
- contentManager: {
152
- main: [],
153
- collectionTypesConfigurations: [
154
- {
155
- action: "plugin::content-manager.collection-types.configure-view",
156
- subject: null
157
- }
158
- ],
159
- componentsConfigurations: [
160
- {
161
- action: "plugin::content-manager.components.configure-layout",
162
- subject: null
163
- }
164
- ],
165
- singleTypesConfigurations: [
166
- {
167
- action: "plugin::content-manager.single-types.configure-view",
168
- subject: null
169
- }
170
- ]
171
- },
172
- marketplace: {
173
- main: [{ action: "admin::marketplace.read", subject: null }],
174
- read: [{ action: "admin::marketplace.read", subject: null }]
175
- },
176
- settings: {
177
- roles: {
178
- main: [
179
- { action: "admin::roles.create", subject: null },
180
- { action: "admin::roles.update", subject: null },
181
- { action: "admin::roles.read", subject: null },
182
- { action: "admin::roles.delete", subject: null }
183
- ],
184
- create: [{ action: "admin::roles.create", subject: null }],
185
- delete: [{ action: "admin::roles.delete", subject: null }],
186
- read: [{ action: "admin::roles.read", subject: null }],
187
- update: [{ action: "admin::roles.update", subject: null }]
188
- },
189
- users: {
190
- main: [
191
- { action: "admin::users.create", subject: null },
192
- { action: "admin::users.read", subject: null },
193
- { action: "admin::users.update", subject: null },
194
- { action: "admin::users.delete", subject: null }
195
- ],
196
- create: [{ action: "admin::users.create", subject: null }],
197
- delete: [{ action: "admin::users.delete", subject: null }],
198
- read: [{ action: "admin::users.read", subject: null }],
199
- update: [{ action: "admin::users.update", subject: null }]
200
- },
201
- webhooks: {
202
- main: [
203
- { action: "admin::webhooks.create", subject: null },
204
- { action: "admin::webhooks.read", subject: null },
205
- { action: "admin::webhooks.update", subject: null },
206
- { action: "admin::webhooks.delete", subject: null }
207
- ],
208
- create: [{ action: "admin::webhooks.create", subject: null }],
209
- delete: [{ action: "admin::webhooks.delete", subject: null }],
210
- read: [
211
- { action: "admin::webhooks.read", subject: null },
212
- // NOTE: We need to check with the API
213
- { action: "admin::webhooks.update", subject: null },
214
- { action: "admin::webhooks.delete", subject: null }
215
- ],
216
- update: [{ action: "admin::webhooks.update", subject: null }]
217
- },
218
- "api-tokens": {
219
- main: [{ action: "admin::api-tokens.access", subject: null }],
220
- create: [{ action: "admin::api-tokens.create", subject: null }],
221
- delete: [{ action: "admin::api-tokens.delete", subject: null }],
222
- read: [{ action: "admin::api-tokens.read", subject: null }],
223
- update: [{ action: "admin::api-tokens.update", subject: null }],
224
- regenerate: [{ action: "admin::api-tokens.regenerate", subject: null }]
225
- },
226
- "transfer-tokens": {
227
- main: [{ action: "admin::transfer.tokens.access", subject: null }],
228
- create: [{ action: "admin::transfer.tokens.create", subject: null }],
229
- delete: [{ action: "admin::transfer.tokens.delete", subject: null }],
230
- read: [{ action: "admin::transfer.tokens.read", subject: null }],
231
- update: [{ action: "admin::transfer.tokens.update", subject: null }],
232
- regenerate: [{ action: "admin::transfer.tokens.regenerate", subject: null }]
233
- },
234
- "project-settings": {
235
- read: [{ action: "admin::project-settings.read", subject: null }],
236
- update: [{ action: "admin::project-settings.update", subject: null }]
237
- }
238
- }
239
- };
240
- const HOOKS = {
241
- /**
242
- * Hook that allows to mutate the displayed headers of the list view table
243
- * @constant
244
- * @type {string}
245
- */
246
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
247
- /**
248
- * Hook that allows to mutate the CM's collection types links pre-set filters
249
- * @constant
250
- * @type {string}
251
- */
252
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
253
- /**
254
- * Hook that allows to mutate the CM's edit view layout
255
- * @constant
256
- * @type {string}
257
- */
258
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
259
- /**
260
- * Hook that allows to mutate the CM's single types links pre-set filters
261
- * @constant
262
- * @type {string}
263
- */
264
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
265
- };
266
- const ACTION_SET_APP_RUNTIME_STATUS = "StrapiAdmin/APP/SET_APP_RUNTIME_STATUS";
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
- });
334
- const [ConfigurationContextProvider, useConfigurationContext] = reactContext.createContext("ConfigurationContext");
335
- const useConfiguration = () => useConfigurationContext("useConfiguration");
336
- function isEnterprise() {
337
- return window.strapi.isEE;
338
- }
339
- const useEnterprise = (ceData, eeCallback, opts = {}) => {
340
- const { defaultValue = null, combine = (_ceData, eeData) => eeData, enabled = true } = opts;
341
- const eeCallbackRef = helperPlugin.useCallbackRef(eeCallback);
342
- const combineCallbackRef = helperPlugin.useCallbackRef(combine);
343
- const [{ data }, setData] = React__namespace.useState({
344
- data: isEnterprise() && enabled ? defaultValue : ceData
345
- });
346
- React__namespace.useEffect(() => {
347
- async function importEE() {
348
- const eeData = await eeCallbackRef();
349
- const combinedValue = combineCallbackRef(ceData, eeData);
350
- setData({ data: combinedValue ? combinedValue : eeData });
351
- }
352
- if (isEnterprise() && enabled) {
353
- importEE();
354
- }
355
- }, [ceData, eeCallbackRef, combineCallbackRef, enabled]);
356
- return data;
357
- };
358
- const [LocalesContextProvider, useLocalesContext] = reactContext.createContext("LocalesContext");
359
- const useLocales = () => useLocalesContext("useLocales");
360
- const LANGUAGE_LOCAL_STORAGE_KEY = "strapi-admin-language";
361
- const LanguageProvider = ({ children, localeNames, messages }) => {
362
- const [{ locale }, dispatch] = React__namespace.useReducer(
363
- reducer$2,
364
- initialState$7,
365
- () => {
366
- const languageFromLocaleStorage = window.localStorage.getItem(LANGUAGE_LOCAL_STORAGE_KEY);
367
- if (languageFromLocaleStorage && localeNames[languageFromLocaleStorage]) {
368
- return {
369
- locale: languageFromLocaleStorage,
370
- localeNames
371
- };
372
- } else {
373
- return {
374
- locale: "en",
375
- localeNames
376
- };
377
- }
378
- }
379
- );
380
- React__namespace.useEffect(() => {
381
- window.localStorage.setItem(LANGUAGE_LOCAL_STORAGE_KEY, locale);
382
- document.documentElement.setAttribute("lang", locale);
383
- }, [locale]);
384
- const changeLocale = React__namespace.useCallback((locale2) => {
385
- dispatch({
386
- type: "CHANGE_LOCALE",
387
- locale: locale2
388
- });
389
- }, []);
390
- const appMessages = defaultsDeep__default.default(messages[locale], messages.en);
391
- return /* @__PURE__ */ jsxRuntime.jsx(reactIntl.IntlProvider, { locale, defaultLocale: "en", messages: appMessages, textComponent: "span", children: /* @__PURE__ */ jsxRuntime.jsx(LocalesContextProvider, { changeLocale, localeNames, children }) });
392
- };
393
- const initialState$7 = {
394
- localeNames: { en: "English" },
395
- locale: "en"
396
- };
397
- const reducer$2 = (state = initialState$7, action) => {
398
- switch (action.type) {
399
- case "CHANGE_LOCALE": {
400
- const { locale } = action;
401
- if (!state.localeNames[locale]) {
402
- return state;
403
- }
404
- return { ...state, locale };
405
- }
406
- default: {
407
- return state;
408
- }
409
- }
410
- };
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
- const Wrapper = styled__default.default(designSystem.Box)`
421
- margin: 0 auto;
422
- width: 552px;
423
- `;
424
- const Column = styled__default.default(designSystem.Flex)`
425
- flex-direction: column;
426
- `;
427
- const LocaleToggle = () => {
428
- const { changeLocale, localeNames } = useLocales();
429
- const { formatMessage, locale } = reactIntl.useIntl();
430
- return /* @__PURE__ */ jsxRuntime.jsx(
431
- designSystem.SingleSelect,
432
- {
433
- "aria-label": formatMessage({
434
- id: "global.localeToggle.label",
435
- defaultMessage: "Select interface language"
436
- }),
437
- value: locale,
438
- onChange: (language) => {
439
- changeLocale(language);
440
- },
441
- children: Object.entries(localeNames).map(([language, name]) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: language, children: name }, language))
442
- }
443
- );
444
- };
445
- const LayoutContent = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(
446
- Wrapper,
447
- {
448
- shadow: "tableShadow",
449
- hasRadius: true,
450
- paddingTop: 9,
451
- paddingBottom: 9,
452
- paddingLeft: 10,
453
- paddingRight: 10,
454
- background: "neutral0",
455
- children
456
- }
457
- );
458
- const UnauthenticatedLayout = ({ children }) => {
459
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
460
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { as: "header", justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingRight: 8, children: /* @__PURE__ */ jsxRuntime.jsx(LocaleToggle, {}) }) }),
461
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, paddingBottom: 11, children })
462
- ] });
463
- };
464
- const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
465
- svg {
466
- height: 1rem;
467
- width: 1rem;
468
- path {
469
- fill: ${({ theme }) => theme.colors.neutral600};
470
- }
471
- }
472
- `;
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);
481
- const { formatMessage } = reactIntl.useIntl();
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: [
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
- ] }),
531
- /* @__PURE__ */ jsxRuntime.jsx(
532
- formik.Formik,
533
- {
534
- enableReinitialize: true,
535
- initialValues: {
536
- email: "",
537
- password: "",
538
- rememberMe: false
539
- },
540
- onSubmit: (values) => {
541
- mutation.mutate(values);
542
- },
543
- validationSchema: LOGIN_SCHEMA,
544
- validateOnChange: false,
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
- ] }) })
618
- }
619
- ),
620
- children
621
- ] }),
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({
623
- id: "Auth.link.forgot-password",
624
- defaultMessage: "Forgot your password?"
625
- }) }) }) })
626
- ] }) });
627
- };
628
- const PasswordInput$2 = styled__default.default(designSystem.TextInput)`
629
- ::-ms-reveal {
630
- display: none;
631
- }
632
- `;
633
- const ForgotPassword = () => {
634
- const { push } = reactRouterDom.useHistory();
635
- const { post } = helperPlugin.useFetchClient();
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
- );
647
- return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { 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: [
675
- /* @__PURE__ */ jsxRuntime.jsx(
676
- designSystem.TextInput,
677
- {
678
- error: errors.email ? formatMessage({
679
- id: errors.email,
680
- defaultMessage: "This email is invalid."
681
- }) : "",
682
- value: values.email,
683
- onChange: handleChange,
684
- label: formatMessage({ id: "Auth.form.email.label", defaultMessage: "Email" }),
685
- placeholder: formatMessage({
686
- id: "Auth.form.email.placeholder",
687
- defaultMessage: "kai@doe.com"
688
- }),
689
- name: "email",
690
- required: true
691
- }
692
- ),
693
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", fullWidth: true, children: formatMessage({
694
- id: "Auth.form.button.forgot-password",
695
- defaultMessage: "Send Email"
696
- }) })
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?" }) }) }) })
702
- ] }) });
703
- };
704
- const ForgotPasswordSuccess = () => {
705
- const { formatMessage } = reactIntl.useIntl();
706
- return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
707
- /* @__PURE__ */ jsxRuntime.jsx(LayoutContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
708
- /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
709
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", children: formatMessage({
710
- id: "app.containers.AuthPage.ForgotPasswordSuccess.title",
711
- defaultMessage: "Email sent"
712
- }) }) }),
713
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
714
- id: "app.containers.AuthPage.ForgotPasswordSuccess.text.email",
715
- defaultMessage: "It can take a few minutes to receive your password recovery link."
716
- }) }),
717
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
718
- id: "app.containers.AuthPage.ForgotPasswordSuccess.text.contact-admin",
719
- defaultMessage: "If you do not receive this link, please contact your administrator."
720
- }) }) })
721
- ] }) }),
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" }) }) }) })
723
- ] }) });
724
- };
725
- const Oops = () => {
726
- const { formatMessage } = reactIntl.useIntl();
727
- const query = helperPlugin.useQuery();
728
- const message = query.get("info") || formatMessage({
729
- id: "Auth.components.Oops.text",
730
- defaultMessage: "Your account has been suspended."
731
- });
732
- return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
733
- /* @__PURE__ */ jsxRuntime.jsx(LayoutContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(Column, { children: [
734
- /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
735
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h1", variant: "alpha", children: formatMessage({ id: "Auth.components.Oops.title", defaultMessage: "Oops..." }) }) }),
736
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: message }),
737
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
738
- id: "Auth.components.Oops.text.admin",
739
- defaultMessage: "If this is a mistake, please contact your administrator."
740
- }) }) })
741
- ] }) }),
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" }) }) }) })
743
- ] }) });
744
- };
745
- const FieldWrapper = styled__default.default(designSystem.Field)`
746
- height: ${32 / 16}rem;
747
- width: ${32 / 16}rem;
748
-
749
- > label,
750
- ~ input {
751
- display: block;
752
- position: absolute;
753
- top: 0;
754
- left: 0;
755
- right: 0;
756
- bottom: 0;
757
- }
758
-
759
- > label {
760
- color: inherit;
761
- cursor: pointer;
762
- padding: ${({ theme }) => theme.spaces[2]};
763
- text-align: center;
764
- vertical-align: middle;
765
- }
766
-
767
- &:hover,
768
- &:focus-within {
769
- background-color: ${({ theme }) => theme.colors.neutral0};
770
- }
771
-
772
- &:active,
773
- &.selected {
774
- color: ${({ theme }) => theme.colors.primary700};
775
- background-color: ${({ theme }) => theme.colors.neutral0};
776
- border-color: ${({ theme }) => theme.colors.primary700};
777
- }
778
- `;
779
- const delays = {
780
- postResponse: 90 * 24 * 60 * 60 * 1e3,
781
- // 90 days in ms
782
- postFirstDismissal: 7 * 24 * 60 * 60 * 1e3,
783
- // 7 days in ms
784
- postSubsequentDismissal: 90 * 24 * 60 * 60 * 1e3,
785
- // 90 days in ms
786
- display: 5 * 60 * 1e3
787
- // 5 minutes in ms
788
- };
789
- const ratingArray = [...Array(11).keys()];
790
- const checkIfShouldShowSurvey = (settings) => {
791
- const { enabled, lastResponseDate, firstDismissalDate, lastDismissalDate } = settings;
792
- if (window.strapi.flags.nps === false) {
793
- return false;
794
- }
795
- if (enabled === false) {
796
- return false;
797
- }
798
- if (lastResponseDate) {
799
- const timeSinceLastResponse = Date.now() - new Date(lastResponseDate).getTime();
800
- if (timeSinceLastResponse >= delays.postResponse) {
801
- return true;
802
- }
803
- return false;
804
- }
805
- if (lastDismissalDate) {
806
- const timeSinceLastDismissal = Date.now() - new Date(lastDismissalDate).getTime();
807
- if (timeSinceLastDismissal >= delays.postSubsequentDismissal) {
808
- return true;
809
- }
810
- return false;
811
- }
812
- if (firstDismissalDate) {
813
- const timeSinceFirstDismissal = Date.now() - new Date(firstDismissalDate).getTime();
814
- if (timeSinceFirstDismissal >= delays.postFirstDismissal) {
815
- return true;
816
- }
817
- return false;
818
- }
819
- return true;
820
- };
821
- const NpsSurvey = () => {
822
- const theme = styled.useTheme();
823
- const { formatMessage } = reactIntl.useIntl();
824
- const { npsSurveySettings, setNpsSurveySettings } = useNpsSurveySettings();
825
- const [isFeedbackResponse, setIsFeedbackResponse] = React__namespace.useState(false);
826
- const toggleNotification = helperPlugin.useNotification();
827
- const { currentEnvironment, strapiVersion } = helperPlugin.useAppInfo();
828
- const { mutate, isLoading } = reactQuery.useMutation(
829
- async (form) => {
830
- const res = await fetch("https://analytics.strapi.io/submit-nps", {
831
- method: "POST",
832
- headers: {
833
- "Content-Type": "application/json"
834
- },
835
- body: JSON.stringify(form)
836
- });
837
- if (!res.ok) {
838
- throw new Error("Failed to submit NPS survey");
839
- }
840
- return res;
841
- },
842
- {
843
- onSuccess() {
844
- setNpsSurveySettings((settings) => ({
845
- ...settings,
846
- lastResponseDate: (/* @__PURE__ */ new Date()).toString(),
847
- firstDismissalDate: null,
848
- lastDismissalDate: null
849
- }));
850
- setIsFeedbackResponse(true);
851
- setTimeout(() => {
852
- setSurveyIsShown(false);
853
- }, 3e3);
854
- },
855
- onError() {
856
- toggleNotification({
857
- type: "warning",
858
- message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
859
- });
860
- }
861
- }
862
- );
863
- const [surveyIsShown, setSurveyIsShown] = React__namespace.useState(
864
- checkIfShouldShowSurvey(npsSurveySettings)
865
- );
866
- const [displaySurvey, setDisplaySurvey] = React__namespace.useState(false);
867
- React__namespace.useEffect(() => {
868
- const displayTime = setTimeout(() => {
869
- setDisplaySurvey(true);
870
- }, delays.display);
871
- return () => {
872
- clearTimeout(displayTime);
873
- };
874
- }, []);
875
- if (!displaySurvey) {
876
- return null;
877
- }
878
- if (!surveyIsShown) {
879
- return null;
880
- }
881
- const handleSubmitResponse = ({
882
- npsSurveyRating,
883
- npsSurveyFeedback
884
- }) => {
885
- const userInfo = helperPlugin.auth.getUserInfo();
886
- mutate({
887
- email: typeof userInfo === "object" && userInfo !== null ? userInfo.email : "",
888
- rating: npsSurveyRating,
889
- comment: npsSurveyFeedback,
890
- environment: currentEnvironment,
891
- version: strapiVersion ?? void 0,
892
- license: window.strapi.projectType
893
- });
894
- };
895
- const handleDismiss = () => {
896
- setNpsSurveySettings((settings) => {
897
- const nextSettings = {
898
- ...settings,
899
- lastResponseDate: null
900
- };
901
- if (settings.firstDismissalDate) {
902
- nextSettings.lastDismissalDate = (/* @__PURE__ */ new Date()).toString();
903
- } else {
904
- nextSettings.firstDismissalDate = (/* @__PURE__ */ new Date()).toString();
905
- }
906
- return nextSettings;
907
- });
908
- setSurveyIsShown(false);
909
- };
910
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
911
- formik.Formik,
912
- {
913
- initialValues: { npsSurveyFeedback: "", npsSurveyRating: null },
914
- onSubmit: handleSubmitResponse,
915
- validationSchema: yup__namespace.object({
916
- npsSurveyFeedback: yup__namespace.string(),
917
- npsSurveyRating: yup__namespace.number().required()
918
- }),
919
- children: ({ values, handleChange, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsx(formik.Form, { name: "npsSurveyForm", children: /* @__PURE__ */ jsxRuntime.jsx(
920
- designSystem.Flex,
921
- {
922
- hasRadius: true,
923
- direction: "column",
924
- padding: 4,
925
- borderColor: "primary200",
926
- background: "neutral0",
927
- shadow: "popupShadow",
928
- position: "fixed",
929
- bottom: 0,
930
- left: "50%",
931
- transform: "translateX(-50%)",
932
- zIndex: theme.zIndices[2],
933
- width: "50%",
934
- children: isFeedbackResponse ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", children: formatMessage({
935
- id: "app.components.NpsSurvey.feedback-response",
936
- defaultMessage: "Thank you very much for your feedback!"
937
- }) }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { as: "fieldset", width: "100%", children: [
938
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", width: "100%", children: [
939
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginLeft: "auto", marginRight: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", as: "legend", children: formatMessage({
940
- id: "app.components.NpsSurvey.banner-title",
941
- defaultMessage: "How likely are you to recommend Strapi to a friend or colleague?"
942
- }) }) }),
943
- /* @__PURE__ */ jsxRuntime.jsx(
944
- designSystem.IconButton,
945
- {
946
- onClick: handleDismiss,
947
- "aria-label": formatMessage({
948
- id: "app.components.NpsSurvey.dismiss-survey-label",
949
- defaultMessage: "Dismiss survey"
950
- }),
951
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {})
952
- }
953
- )
954
- ] }),
955
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, marginTop: 2, marginBottom: 2, justifyContent: "center", children: [
956
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage({
957
- id: "app.components.NpsSurvey.no-recommendation",
958
- defaultMessage: "Not at all likely"
959
- }) }),
960
- ratingArray.map((number) => {
961
- return /* @__PURE__ */ jsxRuntime.jsx(
962
- FieldWrapper,
963
- {
964
- className: values.npsSurveyRating === number ? "selected" : void 0,
965
- hasRadius: true,
966
- background: "primary100",
967
- borderColor: "primary200",
968
- color: "primary600",
969
- position: "relative",
970
- cursor: "pointer",
971
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.FieldLabel, { htmlFor: `nps-survey-rating-${number}-input`, children: [
972
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
973
- designSystem.FieldInput,
974
- {
975
- type: "radio",
976
- id: `nps-survey-rating-${number}-input`,
977
- name: "npsSurveyRating",
978
- checked: values.npsSurveyRating === number,
979
- onChange: (e) => setFieldValue("npsSurveyRating", parseInt(e.target.value, 10)),
980
- value: number
981
- }
982
- ) }),
983
- number
984
- ] })
985
- },
986
- number
987
- );
988
- }),
989
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage({
990
- id: "app.components.NpsSurvey.happy-to-recommend",
991
- defaultMessage: "Extremely likely"
992
- }) })
993
- ] }),
994
- values.npsSurveyRating !== null && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", children: [
995
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { htmlFor: "npsSurveyFeedback", fontWeight: "semiBold", fontSize: 2, children: formatMessage({
996
- id: "app.components.NpsSurvey.feedback-question",
997
- defaultMessage: "Do you have any suggestion for improvements?"
998
- }) }) }),
999
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "62%", marginTop: 3, marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
1000
- designSystem.Textarea,
1001
- {
1002
- id: "npsSurveyFeedback",
1003
- width: "100%",
1004
- onChange: handleChange,
1005
- children: values.npsSurveyFeedback
1006
- }
1007
- ) }),
1008
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { marginBottom: 2, type: "submit", loading: isLoading, children: formatMessage({
1009
- id: "app.components.NpsSurvey.submit-feedback",
1010
- defaultMessage: "Submit Feedback"
1011
- }) })
1012
- ] })
1013
- ] })
1014
- }
1015
- ) })
1016
- }
1017
- ) });
1018
- };
1019
- function useNpsSurveySettings() {
1020
- const [npsSurveySettings, setNpsSurveySettings] = helperPlugin.usePersistentState(
1021
- "STRAPI_NPS_SURVEY_SETTINGS",
1022
- {
1023
- enabled: true,
1024
- lastResponseDate: null,
1025
- firstDismissalDate: null,
1026
- lastDismissalDate: null
1027
- }
1028
- );
1029
- return { npsSurveySettings, setNpsSurveySettings };
1030
- }
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 }) => {
1046
- const toggleNotification = helperPlugin.useNotification();
1047
- const { push } = reactRouterDom.useHistory();
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();
1052
- const { trackUsage } = helperPlugin.useTracking();
1053
- const { formatMessage } = reactIntl.useIntl();
1054
- const { setSkipped } = helperPlugin.useGuidedTour();
1055
- const query = helperPlugin.useQuery();
1056
- const match = reactRouterDom.useRouteMatch(
1057
- "/auth/:authType"
1058
- );
1059
- const { formatAPIError } = helperPlugin.useAPIErrorHandler();
1060
- const { get: get2, post } = helperPlugin.useFetchClient();
1061
- const { setNpsSurveySettings } = useNpsSurveySettings();
1062
- const registrationToken = query.get("registrationToken");
1063
- const { data: userInfo } = reactQuery.useQuery({
1064
- queryKey: ["admin", "registration-info", registrationToken],
1065
- async queryFn() {
1066
- const {
1067
- data: { data }
1068
- } = await get2(`/admin/registration-info`, {
1069
- params: {
1070
- registrationToken
1071
- }
1072
- });
1073
- return data;
1074
- },
1075
- enabled: !!registrationToken,
1076
- initialData: {},
1077
- onError(err) {
1078
- const message = formatAPIError(err);
1079
- toggleNotification({
1080
- type: "warning",
1081
- message
1082
- });
1083
- push(`/auth/oops?info=${encodeURIComponent(message)}`);
1084
- }
1085
- });
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("/");
1114
- }
1115
- },
1116
- onError(err) {
1117
- trackUsage("didNotCreateFirstAdmin");
1118
- const error = formatAPIError(err);
1119
- setApiError(error);
1120
- }
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;
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
- ] }),
1169
- /* @__PURE__ */ jsxRuntime.jsx(
1170
- formik.Formik,
1171
- {
1172
- enableReinitialize: true,
1173
- initialValues: {
1174
- firstname: userInfo?.firstname || "",
1175
- lastname: userInfo?.lastname || "",
1176
- email: userInfo?.email || "",
1177
- password: "",
1178
- confirmPassword: "",
1179
- registrationToken: registrationToken || void 0,
1180
- news: false
1181
- },
1182
- onSubmit: async (data, formik2) => {
1183
- const normalizedData = normalizeData(data);
1184
- try {
1185
- await schema.validate(normalizedData, { abortEarly: false });
1186
- if (submitCount > 0 && isAdminRegistration) {
1187
- trackUsage("didSubmitWithErrorsFirstAdmin", { count: submitCount.toString() });
1188
- }
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
- });
1200
- } else {
1201
- registerAdminMutation.mutate(
1202
- omit__default.default(normalizedData, ["registrationToken", "confirmPassword"])
1203
- );
1204
- }
1205
- } catch (err) {
1206
- if (err instanceof yup.ValidationError) {
1207
- const errors = helperPlugin.getYupInnerErrors(err);
1208
- formik2.setErrors(errors);
1209
- }
1210
- setSubmitCount(submitCount + 1);
1211
- }
1212
- },
1213
- validateOnChange: false,
1214
- children: ({ values, errors, handleChange }) => {
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(
1218
- designSystem.TextInput,
1219
- {
1220
- name: "firstname",
1221
- required: true,
1222
- value: values.firstname,
1223
- error: errors.firstname ? formatMessage(errors.firstname) : void 0,
1224
- onChange: handleChange,
1225
- label: formatMessage({
1226
- id: "Auth.form.firstname.label",
1227
- defaultMessage: "Firstname"
1228
- })
1229
- }
1230
- ) }),
1231
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
1232
- designSystem.TextInput,
1233
- {
1234
- name: "lastname",
1235
- value: values.lastname,
1236
- onChange: handleChange,
1237
- label: formatMessage({
1238
- id: "Auth.form.lastname.label",
1239
- defaultMessage: "Lastname"
1240
- })
1241
- }
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);
1273
- },
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
- ] }) }) });
1364
- }
1365
- }
1366
- ),
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({
1368
- id: "Auth.link.signin.account",
1369
- defaultMessage: "Already have an account?"
1370
- }) }) }) })
1371
- ] }) });
1372
- };
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)`
1393
- ::-ms-reveal {
1394
- display: none;
1395
- }
1396
- `;
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);
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
- );
1429
- return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { 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: [
1456
- /* @__PURE__ */ jsxRuntime.jsx(
1457
- PasswordInput,
1458
- {
1459
- name: "password",
1460
- onChange: handleChange,
1461
- value: values.password,
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,
1471
- endAction: /* @__PURE__ */ jsxRuntime.jsx(
1472
- FieldActionWrapper,
1473
- {
1474
- onClick: (e) => {
1475
- e.preventDefault();
1476
- setPasswordShown((prev) => !prev);
1477
- },
1478
- label: formatMessage(
1479
- passwordShown ? {
1480
- id: "Auth.form.password.show-password",
1481
- defaultMessage: "Show password"
1482
- } : {
1483
- id: "Auth.form.password.hide-password",
1484
- defaultMessage: "Hide password"
1485
- }
1486
- ),
1487
- children: passwordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
1488
- }
1489
- ),
1490
- hint: formatMessage({
1491
- id: "Auth.form.password.hint",
1492
- defaultMessage: "Password must contain at least 8 characters, 1 uppercase, 1 lowercase and 1 number"
1493
- }),
1494
- required: true,
1495
- label: formatMessage({
1496
- id: "global.password",
1497
- defaultMessage: "Password"
1498
- }),
1499
- type: passwordShown ? "text" : "password"
1500
- }
1501
- ),
1502
- /* @__PURE__ */ jsxRuntime.jsx(
1503
- PasswordInput,
1504
- {
1505
- name: "confirmPassword",
1506
- onChange: handleChange,
1507
- value: values.confirmPassword,
1508
- error: errors.confirmPassword ? formatMessage({
1509
- id: errors.confirmPassword,
1510
- defaultMessage: "This value is required."
1511
- }) : void 0,
1512
- endAction: /* @__PURE__ */ jsxRuntime.jsx(
1513
- FieldActionWrapper,
1514
- {
1515
- onClick: (e) => {
1516
- e.preventDefault();
1517
- setConfirmPasswordShown((prev) => !prev);
1518
- },
1519
- label: formatMessage(
1520
- passwordShown ? {
1521
- id: "Auth.form.password.show-password",
1522
- defaultMessage: "Show password"
1523
- } : {
1524
- id: "Auth.form.password.hide-password",
1525
- defaultMessage: "Hide password"
1526
- }
1527
- ),
1528
- children: confirmPasswordShown ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Eye, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.EyeStriked, {})
1529
- }
1530
- ),
1531
- required: true,
1532
- label: formatMessage({
1533
- id: "Auth.form.confirmPassword.label",
1534
- defaultMessage: "Confirm Password"
1535
- }),
1536
- type: confirmPasswordShown ? "text" : "password"
1537
- }
1538
- ),
1539
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, type: "submit", children: formatMessage({
1540
- id: "global.change-password",
1541
- defaultMessage: "Change password"
1542
- }) })
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?" }) }) }) })
1548
- ] }) });
1549
- };
1550
- const PasswordInput = styled__default.default(designSystem.TextInput)`
1551
- ::-ms-reveal {
1552
- display: none;
1553
- }
1554
- `;
1555
- const FORMS = {
1556
- "forgot-password": ForgotPassword,
1557
- "forgot-password-success": ForgotPasswordSuccess,
1558
- // the `Component` attribute is set after all forms and CE/EE components are loaded, but since we
1559
- // are here outside of a React component we can not use the hook directly
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 }) => {
1568
- const {
1569
- location: { search }
1570
- } = reactRouterDom.useHistory();
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-576bbc11.js"))).LoginEE
1576
- );
1577
- const forms = useEnterprise(
1578
- FORMS,
1579
- async () => (await Promise.resolve().then(() => require("./constants-ddd2d586.js"))).FORMS,
1580
- {
1581
- combine(ceForms, eeForms) {
1582
- return {
1583
- ...ceForms,
1584
- ...eeForms
1585
- };
1586
- },
1587
- defaultValue: FORMS
1588
- }
1589
- );
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()) {
1595
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Redirect, { to: "/" });
1596
- }
1597
- if (!hasAdmin && authType !== "register-admin") {
1598
- return /* @__PURE__ */ jsxRuntime.jsx(
1599
- reactRouterDom.Redirect,
1600
- {
1601
- to: {
1602
- pathname: "/auth/register-admin",
1603
- // Forward the `?redirectTo` from /auth/login
1604
- // /abc => /auth/login?redirectTo=%2Fabc => /auth/register-admin?redirectTo=%2Fabc
1605
- search
1606
- }
1607
- }
1608
- );
1609
- }
1610
- if (Login$1 && authType === "login") {
1611
- return /* @__PURE__ */ jsxRuntime.jsx(Login$1, {});
1612
- } else if (authType === "login" && !Login$1) {
1613
- return null;
1614
- }
1615
- return /* @__PURE__ */ jsxRuntime.jsx(Component, { hasAdmin });
1616
- };
1617
- const NotFoundPage = () => {
1618
- const { formatMessage } = reactIntl.useIntl();
1619
- helperPlugin.useFocusWhenNavigate();
1620
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { labelledBy: "title", children: [
1621
- /* @__PURE__ */ jsxRuntime.jsx(
1622
- designSystem.HeaderLayout,
1623
- {
1624
- id: "title",
1625
- title: formatMessage({
1626
- id: "content-manager.pageNotFound",
1627
- defaultMessage: "Page not found"
1628
- })
1629
- }
1630
- ),
1631
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsx(
1632
- designSystem.EmptyStateLayout,
1633
- {
1634
- action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.LinkButton, { variant: "secondary", endIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowRight, {}), to: "/", children: formatMessage({
1635
- id: "app.components.NotFoundPage.back",
1636
- defaultMessage: "Back to homepage"
1637
- }) }),
1638
- content: formatMessage({
1639
- id: "app.page.not.found",
1640
- defaultMessage: "Oops! We can't seem to find the page you're looging for..."
1641
- }),
1642
- hasRadius: true,
1643
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.EmptyPictures, { width: "10rem" }),
1644
- shadow: "tableShadow"
1645
- }
1646
- ) })
1647
- ] });
1648
- };
1649
- const NotFoundPage$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1650
- __proto__: null,
1651
- NotFoundPage
1652
- }, Symbol.toStringTag, { value: "Module" }));
1653
- const options = [
1654
- {
1655
- intlLabel: {
1656
- id: "Usecase.front-end",
1657
- defaultMessage: "Front-end developer"
1658
- },
1659
- value: "front_end_developer"
1660
- },
1661
- {
1662
- intlLabel: {
1663
- id: "Usecase.back-end",
1664
- defaultMessage: "Back-end developer"
1665
- },
1666
- value: "back_end_developer"
1667
- },
1668
- {
1669
- intlLabel: {
1670
- id: "Usecase.full-stack",
1671
- defaultMessage: "Full-stack developer"
1672
- },
1673
- value: "full_stack_developer"
1674
- },
1675
- {
1676
- intlLabel: {
1677
- id: "global.content-manager",
1678
- defaultMessage: "Content Manager"
1679
- },
1680
- value: "content_manager"
1681
- },
1682
- {
1683
- intlLabel: {
1684
- id: "Usecase.content-creator",
1685
- defaultMessage: "Content Creator"
1686
- },
1687
- value: "content_creator"
1688
- },
1689
- {
1690
- intlLabel: {
1691
- id: "Usecase.other",
1692
- defaultMessage: "Other"
1693
- },
1694
- value: "other"
1695
- }
1696
- ];
1697
- const TypographyCenter = styled__default.default(designSystem.Typography)`
1698
- text-align: center;
1699
- `;
1700
- const UseCasePage = () => {
1701
- const toggleNotification = helperPlugin.useNotification();
1702
- const { push, location } = reactRouterDom.useHistory();
1703
- const { formatMessage } = reactIntl.useIntl();
1704
- const [role, setRole] = React__namespace.useState(null);
1705
- const [otherRole, setOtherRole] = React__namespace.useState("");
1706
- const { post } = helperPlugin.useFetchClient();
1707
- const { firstname, email } = helperPlugin.auth.get("userInfo") ?? {};
1708
- const { hasAdmin } = qs.parse(location?.search, { ignoreQueryPrefix: true });
1709
- const isOther = role === "other";
1710
- const handleSubmit = async (event, skipPersona) => {
1711
- event.preventDefault();
1712
- try {
1713
- await post("https://analytics.strapi.io/register", {
1714
- email,
1715
- username: firstname,
1716
- firstAdmin: Boolean(!hasAdmin),
1717
- persona: {
1718
- role: skipPersona ? void 0 : role,
1719
- otherRole: skipPersona ? void 0 : otherRole
1720
- }
1721
- });
1722
- toggleNotification({
1723
- type: "success",
1724
- message: {
1725
- id: "Usecase.notification.success.project-created",
1726
- defaultMessage: "Project has been successfully created"
1727
- }
1728
- });
1729
- push("/");
1730
- } catch (err) {
1731
- }
1732
- };
1733
- return /* @__PURE__ */ jsxRuntime.jsx(UnauthenticatedLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { labelledBy: "usecase-title", children: [
1734
- /* @__PURE__ */ jsxRuntime.jsx(LayoutContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: (e) => handleSubmit(e, false), children: [
1735
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", paddingBottom: 7, children: [
1736
- /* @__PURE__ */ jsxRuntime.jsx(Logo, {}),
1737
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 6, paddingBottom: 1, width: helperPlugin.pxToRem(250), children: /* @__PURE__ */ jsxRuntime.jsx(TypographyCenter, { variant: "alpha", as: "h1", id: "usecase-title", children: formatMessage({
1738
- id: "Usecase.title",
1739
- defaultMessage: "Tell us a bit more about yourself"
1740
- }) }) })
1741
- ] }),
1742
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
1743
- /* @__PURE__ */ jsxRuntime.jsx(
1744
- designSystem.Select,
1745
- {
1746
- id: "usecase",
1747
- "data-testid": "usecase",
1748
- label: formatMessage({
1749
- id: "Usecase.input.work-type",
1750
- defaultMessage: "What type of work do you do?"
1751
- }),
1752
- onChange: (value) => setRole(value),
1753
- value: role,
1754
- children: options.map(({ intlLabel, value }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Option, { value, children: formatMessage(intlLabel) }, value))
1755
- }
1756
- ),
1757
- isOther && /* @__PURE__ */ jsxRuntime.jsx(
1758
- designSystem.TextInput,
1759
- {
1760
- name: "other",
1761
- label: formatMessage({ id: "Usecase.other", defaultMessage: "Other" }),
1762
- value: otherRole,
1763
- onChange: (e) => setOtherRole(e.target.value),
1764
- "data-testid": "other"
1765
- }
1766
- ),
1767
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", size: "L", fullWidth: true, disabled: !role, children: formatMessage({ id: "global.finish", defaultMessage: "Finish" }) })
1768
- ] })
1769
- ] }) }),
1770
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.TextButton, { onClick: (event) => handleSubmit(event, true), children: formatMessage({
1771
- id: "Usecase.button.skip",
1772
- defaultMessage: "Skip this question"
1773
- }) }) }) })
1774
- ] }) });
1775
- };
1776
- const LazyCompo = ({ loadComponent }) => {
1777
- const [Compo, setCompo] = React__namespace.useState(null);
1778
- React__namespace.useEffect(() => {
1779
- const loadCompo = async () => {
1780
- try {
1781
- const loadedCompo = await loadComponent();
1782
- if (typeof loadedCompo === "function") {
1783
- setCompo(() => loadedCompo);
1784
- } else if (loadedCompo.default) {
1785
- setCompo(() => loadedCompo.default);
1786
- }
1787
- } catch (err) {
1788
- }
1789
- };
1790
- loadCompo();
1791
- }, [loadComponent]);
1792
- if (Compo) {
1793
- return /* @__PURE__ */ jsxRuntime.jsx(Compo, {});
1794
- }
1795
- return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {});
1796
- };
1797
- const createRoute = (loadComponent, to, exact = false) => {
1798
- return /* @__PURE__ */ jsxRuntime.jsx(
1799
- reactRouterDom.Route,
1800
- {
1801
- render: () => /* @__PURE__ */ jsxRuntime.jsx(LazyCompo, { loadComponent }),
1802
- path: to,
1803
- exact: exact || false
1804
- },
1805
- to
1806
- );
1807
- };
1808
- const ROUTES_CE = null;
1809
- const AuthenticatedApp = React__namespace.lazy(
1810
- () => Promise.resolve().then(() => require("./AuthenticatedApp-342bf22f.js")).then((n) => n.AuthenticatedApp).then((mod) => ({ default: mod.AuthenticatedApp }))
1811
- );
1812
- const App = () => {
1813
- const adminPermissions = useEnterprise(
1814
- ADMIN_PERMISSIONS_CE,
1815
- async () => (await Promise.resolve().then(() => require("./constants-7596f6f3.js"))).ADMIN_PERMISSIONS_EE,
1816
- {
1817
- combine(cePermissions, eePermissions) {
1818
- return merge__default.default({}, cePermissions, eePermissions);
1819
- },
1820
- defaultValue: ADMIN_PERMISSIONS_CE
1821
- }
1822
- );
1823
- const routes = useEnterprise(
1824
- ROUTES_CE,
1825
- async () => (await Promise.resolve().then(() => require("./constants-7596f6f3.js"))).ROUTES_EE,
1826
- {
1827
- defaultValue: []
1828
- }
1829
- );
1830
- const toggleNotification = helperPlugin.useNotification();
1831
- const { updateProjectSettings } = useConfiguration();
1832
- const { formatMessage } = reactIntl.useIntl();
1833
- const [{ isLoading, hasAdmin, uuid, deviceId }, setState] = React__namespace.useState({
1834
- isLoading: true,
1835
- deviceId: void 0,
1836
- hasAdmin: false,
1837
- uuid: false
1838
- });
1839
- const dispatch = reactRedux.useDispatch();
1840
- const appInfo = helperPlugin.useAppInfo();
1841
- const { get: get2, post } = helperPlugin.useFetchClient();
1842
- const authRoutes = React__namespace.useMemo(() => {
1843
- if (!routes) {
1844
- return null;
1845
- }
1846
- return routes.map(({ to, Component, exact }) => createRoute(Component, to, exact));
1847
- }, [routes]);
1848
- const [telemetryProperties, setTelemetryProperties] = React__namespace.useState(void 0);
1849
- React__namespace.useEffect(() => {
1850
- dispatch({ type: ACTION_SET_ADMIN_PERMISSIONS, payload: adminPermissions });
1851
- }, [adminPermissions, dispatch]);
1852
- React__namespace.useEffect(() => {
1853
- const currentToken = helperPlugin.auth.getToken();
1854
- const renewToken = async () => {
1855
- try {
1856
- const {
1857
- data: {
1858
- data: { token }
1859
- }
1860
- } = await post("/admin/renew-token", { token: currentToken });
1861
- helperPlugin.auth.updateToken(token);
1862
- } catch (err) {
1863
- helperPlugin.auth.clearAppStorage();
1864
- window.location.reload();
1865
- }
1866
- };
1867
- if (currentToken) {
1868
- renewToken();
1869
- }
1870
- }, [post]);
1871
- React__namespace.useEffect(() => {
1872
- const getData = async () => {
1873
- try {
1874
- const {
1875
- data: {
1876
- data: { hasAdmin: hasAdmin2, uuid: uuid2, menuLogo, authLogo }
1877
- }
1878
- } = await get2(`/admin/init`);
1879
- updateProjectSettings({
1880
- menuLogo: helperPlugin.prefixFileUrlWithBackendUrl(menuLogo),
1881
- authLogo: helperPlugin.prefixFileUrlWithBackendUrl(authLogo)
1882
- });
1883
- if (uuid2) {
1884
- const {
1885
- data: { data: properties }
1886
- } = await get2(`/admin/telemetry-properties`, {
1887
- // NOTE: needed because the interceptors of the fetchClient redirect to /login when receive a 401 and it would end up in an infinite loop when the user doesn't have a session.
1888
- validateStatus: (status) => status < 500
1889
- });
1890
- setTelemetryProperties(properties);
1891
- try {
1892
- const event = "didInitializeAdministration";
1893
- await post(
1894
- "https://analytics.strapi.io/api/v2/track",
1895
- {
1896
- // This event is anonymous
1897
- event,
1898
- userId: "",
1899
- deviceId,
1900
- eventPropeties: {},
1901
- userProperties: { environment: appInfo.currentEnvironment },
1902
- groupProperties: { ...properties, projectId: uuid2 }
1903
- },
1904
- {
1905
- headers: {
1906
- "X-Strapi-Event": event
1907
- }
1908
- }
1909
- );
1910
- } catch (e) {
1911
- }
1912
- }
1913
- setState({ isLoading: false, hasAdmin: hasAdmin2, uuid: uuid2, deviceId });
1914
- } catch (err) {
1915
- toggleNotification({
1916
- type: "warning",
1917
- message: { id: "app.containers.App.notification.error.init" }
1918
- });
1919
- }
1920
- };
1921
- getData();
1922
- }, [toggleNotification, updateProjectSettings]);
1923
- const trackingInfo = React__namespace.useMemo(
1924
- () => ({
1925
- uuid,
1926
- telemetryProperties,
1927
- deviceId
1928
- }),
1929
- [uuid, telemetryProperties, deviceId]
1930
- );
1931
- if (isLoading) {
1932
- return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {});
1933
- }
1934
- return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}), children: [
1935
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SkipToContent, { children: formatMessage({ id: "skipToContent", defaultMessage: "Skip to content" }) }),
1936
- /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.TrackingProvider, { value: trackingInfo, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Switch, { children: [
1937
- authRoutes,
1938
- /* @__PURE__ */ jsxRuntime.jsx(
1939
- reactRouterDom.Route,
1940
- {
1941
- path: "/auth/:authType",
1942
- render: (routerProps) => /* @__PURE__ */ jsxRuntime.jsx(AuthPage, { ...routerProps, hasAdmin }),
1943
- exact: true
1944
- }
1945
- ),
1946
- /* @__PURE__ */ jsxRuntime.jsx(PrivateRoute, { path: "/usecase", component: UseCasePage }),
1947
- /* @__PURE__ */ jsxRuntime.jsx(PrivateRoute, { path: "/", component: AuthenticatedApp }),
1948
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "", component: NotFoundPage })
1949
- ] }) })
1950
- ] });
1951
- };
1952
- const StrapiLogo = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjgwMCIgdmlld0JveD0iMCAwIDgwMCA4MDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aCBkPSJNMzkgMjgyYzAtMTE4IDAtMTc2LjkgMzYuNi0yMTMuNUMxMTIuMiAzMiAxNzEuMSAzMiAyODguOSAzMmgyMjEuMmMxMTcuOCAwIDE3Ni43IDAgMjEzLjMgMzYuNkM3NjAgMTA1LjIgNzYwIDE2NC4xIDc2MCAyODEuOXYyMjEuMmMwIDExNy44IDAgMTc2LjctMzYuNiAyMTMuM0M2ODYuOCA3NTMgNjI3LjkgNzUzIDUxMC4xIDc1M0gyODguOWMtMTE3LjggMC0xNzYuNyAwLTIxMy4zLTM2LjZDMzkgNjc5LjggMzkgNjIwLjkgMzkgNTAzLjFWMjgxLjlaIiBmaWxsPSIjNDk0NUZGIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTUzNi40IDI1MC43SDI5My43djEyMy44aDEyMy44djEyMy43aDEyMy44VjI1NS41YzAtMi42LTIuMi00LjgtNC45LTQuOFoiIGZpbGw9IiNmZmYiLz4KICAgIDxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik00MTIuNyAzNzQuNWg0Ljh2NC44aC00Ljh6Ii8+CiAgICA8cGF0aCBkPSJNMjkzLjggMzc0LjVoMTE5YzIuNiAwIDQuOCAyLjEgNC44IDQuOHYxMTloLTExOWE0LjggNC44IDAgMCAxLTQuOC00Ljl2LTExOVoiIGZpbGw9IiM5NTkzRkYiLz4KICAgIDxwYXRoIGQ9Ik00MTcuNSA0OTguMmgxMjMuOEw0MjEuNiA2MThhMi40IDIuNCAwIDAgMS00LTEuN3YtMTE4Wk0yOTMuOCAzNzQuNWgtMTE4YTIuNCAyLjQgMCAwIDEtMS43LTQuMWwxMTkuNy0xMTkuN3YxMjMuOFoiIGZpbGw9IiM5NTkzRkYiLz4KPC9zdmc+Cg==";
1953
- const [AdminContextProvider, useAdminContext] = reactContext.createContext("AdminContext");
1954
- const useAdmin = () => useAdminContext("useAdmin");
1955
- const ConfigurationProvider = ({
1956
- children,
1957
- authLogo: defaultAuthLogo,
1958
- menuLogo: defaultMenuLogo,
1959
- showReleaseNotification = false,
1960
- showTutorials = false
1961
- }) => {
1962
- const [{ menuLogo, authLogo }, setLogos] = React__namespace.useState({
1963
- menuLogo: null,
1964
- authLogo: null
1965
- });
1966
- const updateProjectSettings = React__namespace.useCallback(
1967
- ({ menuLogo: menuLogo2, authLogo: authLogo2 }) => {
1968
- setLogos({
1969
- menuLogo: menuLogo2 || defaultMenuLogo,
1970
- authLogo: authLogo2 || defaultAuthLogo
1971
- });
1972
- },
1973
- [defaultAuthLogo, defaultMenuLogo]
1974
- );
1975
- return /* @__PURE__ */ jsxRuntime.jsx(
1976
- ConfigurationContextProvider,
1977
- {
1978
- updateProjectSettings,
1979
- showReleaseNotification,
1980
- showTutorials,
1981
- logos: {
1982
- menu: { custom: menuLogo, default: defaultMenuLogo },
1983
- auth: { custom: authLogo, default: defaultAuthLogo }
1984
- },
1985
- children
1986
- }
1987
- );
1988
- };
1989
- const GuidedTourProvider = ({ children }) => {
1990
- const [{ currentStep, guidedTourState, isGuidedTourVisible, isSkipped }, dispatch] = React__namespace.useReducer(reducer$1, initialState$6, initialiseState);
1991
- const setCurrentStep = (step) => {
1992
- if (step !== null) {
1993
- const isStepAlreadyDone = get__default.default(guidedTourState, step);
1994
- const [sectionName, stepName] = step.split(".");
1995
- const sectionArray = Object.entries(guidedTourState[sectionName]);
1996
- const currentStepIndex = sectionArray.findIndex(([key]) => key === stepName);
1997
- const previousSteps = sectionArray.slice(0, currentStepIndex);
1998
- const isStepToShow = previousSteps.every(([, sectionValue]) => sectionValue);
1999
- if (isStepAlreadyDone || isSkipped || !isStepToShow) {
2000
- return null;
2001
- }
2002
- }
2003
- helperPlugin.auth.set(null, "GUIDED_TOUR_CURRENT_STEP", true);
2004
- return dispatch({
2005
- type: "SET_CURRENT_STEP",
2006
- step
2007
- });
2008
- };
2009
- const setGuidedTourVisibility = (value) => {
2010
- dispatch({
2011
- type: "SET_GUIDED_TOUR_VISIBILITY",
2012
- value
2013
- });
2014
- };
2015
- const setStepState = (currentStep2, value) => {
2016
- addCompletedStep(currentStep2);
2017
- dispatch({
2018
- type: "SET_STEP_STATE",
2019
- currentStep: currentStep2,
2020
- value
2021
- });
2022
- };
2023
- const startSection = (sectionName) => {
2024
- const sectionSteps = guidedTourState[sectionName];
2025
- if (sectionSteps) {
2026
- const guidedTourArray = Object.entries(guidedTourState);
2027
- const currentSectionIndex = guidedTourArray.findIndex(([key]) => key === sectionName);
2028
- const previousSections = guidedTourArray.slice(0, currentSectionIndex);
2029
- const isSectionToShow = previousSections.every(
2030
- ([, sectionValue]) => Object.values(sectionValue).every(Boolean)
2031
- );
2032
- const [firstStep] = Object.keys(sectionSteps);
2033
- const isFirstStepDone = sectionSteps[firstStep];
2034
- if (isSectionToShow && !currentStep && !isFirstStepDone) {
2035
- setCurrentStep(`${sectionName}.${firstStep}`);
2036
- }
2037
- }
2038
- };
2039
- const setSkipped = (value) => {
2040
- helperPlugin.auth.set(value, "GUIDED_TOUR_SKIPPED", true);
2041
- dispatch({
2042
- type: "SET_SKIPPED",
2043
- value
2044
- });
2045
- };
2046
- return /* @__PURE__ */ jsxRuntime.jsx(
2047
- helperPlugin.GuidedTourProvider,
2048
- {
2049
- guidedTourState,
2050
- currentStep,
2051
- setCurrentStep,
2052
- setGuidedTourVisibility,
2053
- setSkipped,
2054
- setStepState,
2055
- startSection,
2056
- isGuidedTourVisible,
2057
- isSkipped,
2058
- children
2059
- }
2060
- );
2061
- };
2062
- const initialState$6 = {
2063
- currentStep: null,
2064
- guidedTourState: {
2065
- contentTypeBuilder: {
2066
- create: false,
2067
- success: false
2068
- },
2069
- contentManager: {
2070
- create: false,
2071
- success: false
2072
- },
2073
- apiTokens: {
2074
- create: false,
2075
- success: false
2076
- }
2077
- },
2078
- isGuidedTourVisible: false,
2079
- isSkipped: false
2080
- };
2081
- const reducer$1 = (state = initialState$6, action) => produce__default.default(state, (draftState) => {
2082
- switch (action.type) {
2083
- case "SET_CURRENT_STEP": {
2084
- draftState.currentStep = action.step;
2085
- break;
2086
- }
2087
- case "SET_STEP_STATE": {
2088
- const [section, step] = action.currentStep.split(".");
2089
- draftState.guidedTourState[section][step] = action.value;
2090
- break;
2091
- }
2092
- case "SET_SKIPPED": {
2093
- draftState.isSkipped = action.value;
2094
- break;
2095
- }
2096
- case "SET_GUIDED_TOUR_VISIBILITY": {
2097
- draftState.isGuidedTourVisible = action.value;
2098
- break;
2099
- }
2100
- default: {
2101
- return draftState;
2102
- }
2103
- }
2104
- });
2105
- const initialiseState = (initialState2) => {
2106
- const copyInitialState = { ...initialState2 };
2107
- const guidedTourLocaleStorage = helperPlugin.auth.get("GUIDED_TOUR_COMPLETED_STEPS");
2108
- const currentStepLocaleStorage = helperPlugin.auth.get("GUIDED_TOUR_CURRENT_STEP");
2109
- const skippedLocaleStorage = helperPlugin.auth.get("GUIDED_TOUR_SKIPPED");
2110
- if (Array.isArray(guidedTourLocaleStorage)) {
2111
- guidedTourLocaleStorage.forEach((step) => {
2112
- const [sectionName, stepName] = step.split(".");
2113
- set__default.default(copyInitialState, ["guidedTourState", sectionName, stepName], true);
2114
- });
2115
- }
2116
- if (currentStepLocaleStorage) {
2117
- const [sectionName, stepName] = currentStepLocaleStorage.split(".");
2118
- set__default.default(copyInitialState, ["guidedTourState", sectionName, stepName], true);
2119
- addCompletedStep(currentStepLocaleStorage);
2120
- helperPlugin.auth.set(null, "GUIDED_TOUR_CURRENT_STEP", true);
2121
- }
2122
- if (skippedLocaleStorage !== null) {
2123
- set__default.default(copyInitialState, "isSkipped", skippedLocaleStorage);
2124
- }
2125
- return copyInitialState;
2126
- };
2127
- const addCompletedStep = (completedStep) => {
2128
- const currentSteps = helperPlugin.auth.get("GUIDED_TOUR_COMPLETED_STEPS") ?? [];
2129
- if (!Array.isArray(currentSteps)) {
2130
- return;
2131
- }
2132
- const isAlreadyStored = currentSteps.includes(completedStep);
2133
- if (isAlreadyStored) {
2134
- return;
2135
- }
2136
- helperPlugin.auth.set([...currentSteps, completedStep], "GUIDED_TOUR_COMPLETED_STEPS", true);
2137
- };
2138
- const [ThemeToggleContextProvider, useThemeToggleContext] = reactContext.createContext("ThemeToggleContext");
2139
- const useThemeToggle = () => useThemeToggleContext("useThemeToggle");
2140
- const Theme = ({ children }) => {
2141
- const { currentTheme, themes, systemTheme } = useThemeToggle();
2142
- const { locale } = reactIntl.useIntl();
2143
- const computedThemeName = currentTheme === "system" ? systemTheme : currentTheme;
2144
- return /* @__PURE__ */ jsxRuntime.jsxs(
2145
- designSystem.DesignSystemProvider,
2146
- {
2147
- locale,
2148
- theme: themes?.[computedThemeName || "light"],
2149
- children: [
2150
- children,
2151
- /* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, {})
2152
- ]
2153
- }
2154
- );
2155
- };
2156
- const GlobalStyle = styled.createGlobalStyle`
2157
- body {
2158
- background: ${({ theme }) => theme.colors.neutral100};
2159
- }
2160
- `;
2161
- const THEME_KEY = "STRAPI_THEME";
2162
- const getDefaultTheme = () => {
2163
- const persistedTheme = localStorage.getItem(THEME_KEY);
2164
- return persistedTheme || "system";
2165
- };
2166
- const ThemeToggleProvider = ({ children, themes }) => {
2167
- const [currentTheme, setCurrentTheme] = React__namespace.useState(getDefaultTheme());
2168
- const [systemTheme, setSystemTheme] = React__namespace.useState();
2169
- const handleChangeTheme = React__namespace.useCallback(
2170
- (nextTheme) => {
2171
- setCurrentTheme(nextTheme);
2172
- localStorage.setItem(THEME_KEY, nextTheme);
2173
- },
2174
- [setCurrentTheme]
2175
- );
2176
- React__namespace.useEffect(() => {
2177
- const themeWatcher = window.matchMedia("(prefers-color-scheme: dark)");
2178
- setSystemTheme(themeWatcher.matches ? "dark" : "light");
2179
- const listener = (event) => {
2180
- setSystemTheme(event.matches ? "dark" : "light");
2181
- };
2182
- themeWatcher.addEventListener("change", listener);
2183
- return () => {
2184
- themeWatcher.removeEventListener("change", listener);
2185
- };
2186
- }, []);
2187
- return /* @__PURE__ */ jsxRuntime.jsx(
2188
- ThemeToggleContextProvider,
2189
- {
2190
- currentTheme,
2191
- onChangeTheme: handleChangeTheme,
2192
- themes,
2193
- systemTheme,
2194
- children
2195
- }
2196
- );
2197
- };
2198
- const queryClient = new reactQuery.QueryClient({
2199
- defaultOptions: {
2200
- queries: {
2201
- refetchOnWindowFocus: false
2202
- }
2203
- }
2204
- });
2205
- const Providers = ({
2206
- authLogo,
2207
- children,
2208
- components,
2209
- customFields,
2210
- fields,
2211
- getAdminInjectedComponents,
2212
- getPlugin,
2213
- localeNames,
2214
- menu,
2215
- menuLogo,
2216
- messages,
2217
- plugins,
2218
- runHookParallel,
2219
- runHookSeries,
2220
- runHookWaterfall,
2221
- settings,
2222
- showReleaseNotification,
2223
- showTutorials,
2224
- store,
2225
- themes
2226
- }) => {
2227
- return /* @__PURE__ */ jsxRuntime.jsx(LanguageProvider, { messages, localeNames, children: /* @__PURE__ */ jsxRuntime.jsx(ThemeToggleProvider, { themes, children: /* @__PURE__ */ jsxRuntime.jsx(Theme, { children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(reactRedux.Provider, { store, children: /* @__PURE__ */ jsxRuntime.jsx(AdminContextProvider, { getAdminInjectedComponents, children: /* @__PURE__ */ jsxRuntime.jsx(
2228
- ConfigurationProvider,
2229
- {
2230
- authLogo,
2231
- menuLogo,
2232
- showReleaseNotification,
2233
- showTutorials,
2234
- children: /* @__PURE__ */ jsxRuntime.jsx(
2235
- helperPlugin.StrapiAppProvider,
2236
- {
2237
- getPlugin,
2238
- menu,
2239
- plugins,
2240
- runHookParallel,
2241
- runHookWaterfall,
2242
- runHookSeries,
2243
- settings,
2244
- children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LibraryProvider, { components, fields, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CustomFieldsProvider, { customFields, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AutoReloadOverlayBlockerProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.OverlayBlockerProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(GuidedTourProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.NotificationsProvider, { children }) }) }) }) }) })
2245
- }
2246
- )
2247
- }
2248
- ) }) }) }) }) }) });
2249
- };
2250
- class Components {
2251
- components;
2252
- constructor() {
2253
- this.components = {};
2254
- }
2255
- add(component) {
2256
- const { name, Component } = component;
2257
- invariant__default.default(Component, "A Component must be provided");
2258
- invariant__default.default(name, "A name must be provided");
2259
- invariant__default.default(this.components[name] === void 0, "A similar field already exists");
2260
- this.components[name] = Component;
2261
- }
2262
- }
2263
- const ALLOWED_TYPES = [
2264
- "biginteger",
2265
- "boolean",
2266
- "date",
2267
- "datetime",
2268
- "decimal",
2269
- "email",
2270
- "enumeration",
2271
- "float",
2272
- "integer",
2273
- "json",
2274
- "password",
2275
- "richtext",
2276
- "string",
2277
- "text",
2278
- "time",
2279
- "uid"
2280
- ];
2281
- const ALLOWED_ROOT_LEVEL_OPTIONS = [
2282
- "min",
2283
- "minLength",
2284
- "max",
2285
- "maxLength",
2286
- "required",
2287
- "regex",
2288
- "enum",
2289
- "unique",
2290
- "private",
2291
- "default"
2292
- ];
2293
- class CustomFields {
2294
- customFields;
2295
- constructor() {
2296
- this.customFields = {};
2297
- }
2298
- register(customFields) {
2299
- if (Array.isArray(customFields)) {
2300
- customFields.forEach((customField) => {
2301
- this.register(customField);
2302
- });
2303
- } else {
2304
- const { name, pluginId, type, intlLabel, intlDescription, components, options: options2 } = customFields;
2305
- invariant__default.default(name, "A name must be provided");
2306
- invariant__default.default(type, "A type must be provided");
2307
- invariant__default.default(intlLabel, "An intlLabel must be provided");
2308
- invariant__default.default(intlDescription, "An intlDescription must be provided");
2309
- invariant__default.default(components, "A components object must be provided");
2310
- invariant__default.default(components.Input, "An Input component must be provided");
2311
- invariant__default.default(
2312
- ALLOWED_TYPES.includes(type),
2313
- `Custom field type: '${type}' is not a valid Strapi type or it can't be used with a Custom Field`
2314
- );
2315
- const isValidObjectKey = /^(?![0-9])[a-zA-Z0-9$_-]+$/g;
2316
- invariant__default.default(
2317
- isValidObjectKey.test(name),
2318
- `Custom field name: '${name}' is not a valid object key`
2319
- );
2320
- const allFormOptions = [...options2?.base || [], ...options2?.advanced || []];
2321
- if (allFormOptions.length) {
2322
- const optionPathValidations = allFormOptions.reduce(optionsValidationReducer, []);
2323
- optionPathValidations.forEach(({ isValidOptionPath, errorMessage }) => {
2324
- invariant__default.default(isValidOptionPath, errorMessage);
2325
- });
2326
- }
2327
- const uid = pluginId ? `plugin::${pluginId}.${name}` : `global::${name}`;
2328
- const uidAlreadyUsed = Object.prototype.hasOwnProperty.call(this.customFields, uid);
2329
- invariant__default.default(!uidAlreadyUsed, `Custom field: '${uid}' has already been registered`);
2330
- this.customFields[uid] = customFields;
2331
- }
2332
- }
2333
- getAll() {
2334
- return this.customFields;
2335
- }
2336
- get(uid) {
2337
- return this.customFields[uid];
2338
- }
2339
- }
2340
- const optionsValidationReducer = (acc, option) => {
2341
- if ("items" in option) {
2342
- return option.items.reduce(optionsValidationReducer, acc);
2343
- }
2344
- if (!option.name) {
2345
- acc.push({
2346
- isValidOptionPath: false,
2347
- errorMessage: "The 'name' property is required on an options object"
2348
- });
2349
- } else {
2350
- acc.push({
2351
- isValidOptionPath: option.name.startsWith("options") || ALLOWED_ROOT_LEVEL_OPTIONS.includes(option.name),
2352
- errorMessage: `'${option.name}' must be prefixed with 'options.'`
2353
- });
2354
- }
2355
- return acc;
2356
- };
2357
- class Fields {
2358
- fields;
2359
- constructor() {
2360
- this.fields = {};
2361
- }
2362
- add(field) {
2363
- const { type, Component } = field;
2364
- invariant__default.default(Component, "A Component must be provided");
2365
- invariant__default.default(type, "A type must be provided");
2366
- this.fields[type] = Component;
2367
- }
2368
- }
2369
- class Middlewares {
2370
- middlewares;
2371
- constructor() {
2372
- this.middlewares = [];
2373
- }
2374
- add(middleware) {
2375
- this.middlewares.push(middleware);
2376
- }
2377
- }
2378
- class Plugin {
2379
- apis;
2380
- initializer;
2381
- injectionZones;
2382
- isReady;
2383
- name;
2384
- pluginId;
2385
- constructor(pluginConf) {
2386
- this.apis = pluginConf.apis || {};
2387
- this.initializer = pluginConf.initializer || null;
2388
- this.injectionZones = pluginConf.injectionZones || {};
2389
- this.isReady = pluginConf.isReady !== void 0 ? pluginConf.isReady : true;
2390
- this.name = pluginConf.name;
2391
- this.pluginId = pluginConf.id;
2392
- }
2393
- getInjectedComponents(containerName, blockName) {
2394
- try {
2395
- return this.injectionZones[containerName][blockName] || [];
2396
- } catch (err) {
2397
- console.error("Cannot get injected component", err);
2398
- return [];
2399
- }
2400
- }
2401
- injectComponent(containerName, blockName, component) {
2402
- try {
2403
- this.injectionZones[containerName][blockName].push(component);
2404
- } catch (err) {
2405
- console.error("Cannot inject component", err);
2406
- }
2407
- }
2408
- }
2409
- class Reducers {
2410
- reducers;
2411
- constructor({ appReducers = {} } = {}) {
2412
- this.reducers = { ...appReducers };
2413
- }
2414
- add(reducerName, reducer2) {
2415
- this.reducers[reducerName] = reducer2;
2416
- }
2417
- }
2418
- const useTypedDispatch = reactRedux.useDispatch;
2419
- const useTypedStore = reactRedux.useStore;
2420
- const useTypedSelector = reactRedux.useSelector;
2421
- const createTypedSelector = (selector) => toolkit.createSelector((state) => state, selector);
2422
- const RBACProvider = ({ children, permissions, refetchPermissions }) => {
2423
- const allPermissions = useTypedSelector((state) => state.rbacProvider.allPermissions);
2424
- const dispatch = useTypedDispatch();
2425
- React__namespace.useEffect(() => {
2426
- dispatch(setPermissionsAction(permissions));
2427
- return () => {
2428
- dispatch(resetStoreAction());
2429
- };
2430
- }, [permissions, dispatch]);
2431
- if (!allPermissions) {
2432
- return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {});
2433
- }
2434
- return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.RBACContext.Provider, { value: { allPermissions, refetchPermissions }, children });
2435
- };
2436
- const initialState$5 = {
2437
- allPermissions: null,
2438
- collectionTypesRelatedPermissions: {}
2439
- };
2440
- const RESET_STORE = "StrapiAdmin/RBACProvider/RESET_STORE";
2441
- const SET_PERMISSIONS$1 = "StrapiAdmin/RBACProvider/SET_PERMISSIONS";
2442
- const resetStoreAction = () => ({ type: RESET_STORE });
2443
- const setPermissionsAction = (permissions) => ({
2444
- type: SET_PERMISSIONS$1,
2445
- permissions
2446
- });
2447
- const RBACReducer = (state = initialState$5, action) => produce__default.default(state, (draftState) => {
2448
- switch (action.type) {
2449
- case SET_PERMISSIONS$1: {
2450
- draftState.allPermissions = action.permissions;
2451
- draftState.collectionTypesRelatedPermissions = action.permissions.filter((perm) => perm.subject).reduce((acc, current) => {
2452
- const { subject, action: action2 } = current;
2453
- if (!subject)
2454
- return acc;
2455
- if (!acc[subject]) {
2456
- acc[subject] = {};
2457
- }
2458
- acc[subject] = acc[subject][action2] ? { ...acc[subject], [action2]: [...acc[subject][action2], current] } : { ...acc[subject], [action2]: [current] };
2459
- return acc;
2460
- }, {});
2461
- break;
2462
- }
2463
- case RESET_STORE: {
2464
- return initialState$5;
2465
- }
2466
- default:
2467
- return state;
2468
- }
2469
- });
2470
- const SET_PERMISSIONS = "ContentManager/RBACManager/SET_PERMISSIONS";
2471
- const RESET_PERMISSIONS = "ContentManager/RBACManager/RESET_PERMISSIONS";
2472
- const initialState$4 = {
2473
- permissions: null
2474
- };
2475
- const rbacManagerReducer = (state = initialState$4, action) => (
2476
- // eslint-disable-next-line consistent-return
2477
- produce__default.default(state, (draftState) => {
2478
- switch (action.type) {
2479
- case SET_PERMISSIONS: {
2480
- draftState.permissions = Object.entries(action.permissions).reduce((acc, current) => {
2481
- return [...acc, ...current[1]];
2482
- }, []);
2483
- break;
2484
- }
2485
- case RESET_PERMISSIONS: {
2486
- draftState.permissions = null;
2487
- break;
2488
- }
2489
- default:
2490
- return draftState;
2491
- }
2492
- })
2493
- );
2494
- const GET_INIT_DATA = "ContentManager/App/GET_INIT_DATA";
2495
- const RESET_INIT_DATA = "ContentManager/App/RESET_INIT_DATA";
2496
- const SET_INIT_DATA = "ContentManager/App/SET_INIT_DATA";
2497
- const initialState$3 = {
2498
- components: [],
2499
- status: "loading",
2500
- models: [],
2501
- collectionTypeLinks: [],
2502
- singleTypeLinks: []
2503
- };
2504
- const mainReducer = (state = initialState$3, action) => produce__default.default(state, (draftState) => {
2505
- switch (action.type) {
2506
- case GET_INIT_DATA: {
2507
- draftState.status = "loading";
2508
- break;
2509
- }
2510
- case RESET_INIT_DATA: {
2511
- return initialState$3;
2512
- }
2513
- case SET_INIT_DATA: {
2514
- draftState.collectionTypeLinks = action.data.authorizedCollectionTypeLinks.filter(
2515
- ({ isDisplayed }) => isDisplayed
2516
- );
2517
- draftState.singleTypeLinks = action.data.authorizedSingleTypeLinks.filter(
2518
- ({ isDisplayed }) => isDisplayed
2519
- );
2520
- draftState.components = action.data.components;
2521
- draftState.models = action.data.contentTypeSchemas;
2522
- draftState.fieldSizes = action.data.fieldSizes;
2523
- draftState.status = "resolved";
2524
- break;
2525
- }
2526
- default:
2527
- return draftState;
2528
- }
2529
- });
2530
- const SET_LAYOUT = "ContentManager/EditViewLayoutManager/SET_LAYOUT";
2531
- const RESET_PROPS$2 = "ContentManager/EditViewLayoutManager/RESET_PROPS";
2532
- const initialState$2 = {
2533
- currentLayout: null
2534
- };
2535
- const editViewManagerReducer = (state = initialState$2, action) => (
2536
- // eslint-disable-next-line consistent-return
2537
- produce__default.default(state, (draftState) => {
2538
- switch (action.type) {
2539
- case RESET_PROPS$2: {
2540
- draftState.currentLayout = null;
2541
- break;
2542
- }
2543
- case SET_LAYOUT: {
2544
- draftState.currentLayout = action.layout;
2545
- break;
2546
- }
2547
- default:
2548
- return draftState;
2549
- }
2550
- })
2551
- );
2552
- const GET_DATA$1 = "ContentManager/ListView/GET_DATA";
2553
- const GET_DATA_SUCCEEDED$1 = "ContentManager/ListView/GET_DATA_SUCCEEDED";
2554
- const RESET_PROPS$1 = "ContentManager/ListView/RESET_PROPS";
2555
- const ON_CHANGE_LIST_HEADERS = "ContentManager/ListView/ON_CHANGE_LIST_HEADERS ";
2556
- const ON_RESET_LIST_HEADERS = "ContentManager/ListView/ON_RESET_LIST_HEADERS ";
2557
- const SET_LIST_LAYOUT = "ContentManager/ListView/SET_LIST_LAYOUT ";
2558
- const initialState$1 = {
2559
- data: [],
2560
- isLoading: true,
2561
- contentType: {},
2562
- components: [],
2563
- initialDisplayedHeaders: [],
2564
- displayedHeaders: [],
2565
- pagination: {
2566
- total: 0
2567
- }
2568
- };
2569
- const listViewReducer = (state = initialState$1, action) => (
2570
- // eslint-disable-next-line consistent-return
2571
- produce__default.default(state, (draftState) => {
2572
- switch (action.type) {
2573
- case GET_DATA$1: {
2574
- return {
2575
- ...initialState$1,
2576
- contentType: state.contentType,
2577
- components: state.components,
2578
- initialDisplayedHeaders: state.initialDisplayedHeaders,
2579
- displayedHeaders: state.displayedHeaders
2580
- };
2581
- }
2582
- case GET_DATA_SUCCEEDED$1: {
2583
- draftState.pagination = action.pagination;
2584
- draftState.data = action.data;
2585
- draftState.isLoading = false;
2586
- break;
2587
- }
2588
- case ON_CHANGE_LIST_HEADERS: {
2589
- const {
2590
- target: { name, value }
2591
- } = action;
2592
- if (!value) {
2593
- const { metadatas, attributes, uid } = state.contentType;
2594
- const metas = metadatas[name].list;
2595
- const header = {
2596
- name,
2597
- fieldSchema: attributes[name],
2598
- metadatas: metas,
2599
- key: `__${name}_key__`
2600
- };
2601
- switch (attributes[name].type) {
2602
- case "component": {
2603
- const componentName = attributes[name].component;
2604
- const mainFieldName = get__default.default(
2605
- state,
2606
- ["components", componentName, "settings", "mainField"],
2607
- null
2608
- );
2609
- const mainFieldAttribute = get__default.default(state, [
2610
- "components",
2611
- componentName,
2612
- "attributes",
2613
- mainFieldName
2614
- ]);
2615
- draftState.displayedHeaders.push({
2616
- ...header,
2617
- metadatas: {
2618
- ...metas,
2619
- mainField: {
2620
- ...mainFieldAttribute,
2621
- name: mainFieldName
2622
- }
2623
- }
2624
- });
2625
- break;
2626
- }
2627
- case "relation":
2628
- draftState.displayedHeaders.push({
2629
- ...header,
2630
- queryInfos: {
2631
- defaultParams: {},
2632
- endPoint: `collection-types/${uid}`
2633
- }
2634
- });
2635
- break;
2636
- default:
2637
- draftState.displayedHeaders.push(header);
2638
- }
2639
- } else {
2640
- draftState.displayedHeaders = state.displayedHeaders.filter(
2641
- (header) => header.name !== name
2642
- );
2643
- }
2644
- break;
2645
- }
2646
- case ON_RESET_LIST_HEADERS: {
2647
- draftState.displayedHeaders = state.initialDisplayedHeaders;
2648
- break;
2649
- }
2650
- case RESET_PROPS$1: {
2651
- return initialState$1;
2652
- }
2653
- case SET_LIST_LAYOUT: {
2654
- const { contentType, components, displayedHeaders } = action;
2655
- draftState.contentType = contentType;
2656
- draftState.components = components;
2657
- draftState.displayedHeaders = displayedHeaders;
2658
- draftState.initialDisplayedHeaders = displayedHeaders;
2659
- break;
2660
- }
2661
- default:
2662
- return draftState;
2663
- }
2664
- })
2665
- );
2666
- const GET_DATA = "ContentManager/CrudReducer/GET_DATA";
2667
- const GET_DATA_SUCCEEDED = "ContentManager/CrudReducer/GET_DATA_SUCCEEDED";
2668
- const INIT_FORM = "ContentManager/CrudReducer/INIT_FORM";
2669
- const RESET_PROPS = "ContentManager/CrudReducer/RESET_PROPS";
2670
- const SET_DATA_STRUCTURES = "ContentManager/CrudReducer/SET_DATA_STRUCTURES";
2671
- const SET_STATUS = "ContentManager/CrudReducer/SET_STATUS";
2672
- const SUBMIT_SUCCEEDED = "ContentManager/CrudReducer/SUBMIT_SUCCEEDED";
2673
- const CLEAR_SET_MODIFIED_DATA_ONLY = "ContentManager/CrudReducer/CLEAR_SET_MODIFIED_DATA_ONLY";
2674
- const crudInitialState = {
2675
- componentsDataStructure: {},
2676
- contentTypeDataStructure: {},
2677
- isLoading: true,
2678
- data: null,
2679
- status: "resolved",
2680
- setModifiedDataOnly: false
2681
- };
2682
- const crudReducer = (state = crudInitialState, action) => produce__default.default(state, (draftState) => {
2683
- switch (action.type) {
2684
- case GET_DATA: {
2685
- draftState.isLoading = true;
2686
- draftState.data = null;
2687
- break;
2688
- }
2689
- case GET_DATA_SUCCEEDED: {
2690
- draftState.isLoading = false;
2691
- draftState.data = action.data;
2692
- draftState.setModifiedDataOnly = action.setModifiedDataOnly ?? false;
2693
- break;
2694
- }
2695
- case INIT_FORM: {
2696
- if (action.data) {
2697
- draftState.isLoading = false;
2698
- draftState.data = action.data;
2699
- break;
2700
- }
2701
- draftState.isLoading = false;
2702
- draftState.data = state.contentTypeDataStructure;
2703
- break;
2704
- }
2705
- case RESET_PROPS: {
2706
- return crudInitialState;
2707
- }
2708
- case SET_DATA_STRUCTURES: {
2709
- draftState.componentsDataStructure = action.componentsDataStructure;
2710
- draftState.contentTypeDataStructure = action.contentTypeDataStructure;
2711
- break;
2712
- }
2713
- case SET_STATUS: {
2714
- draftState.status = action.status;
2715
- break;
2716
- }
2717
- case SUBMIT_SUCCEEDED: {
2718
- draftState.data = action.data;
2719
- break;
2720
- }
2721
- case CLEAR_SET_MODIFIED_DATA_ONLY: {
2722
- draftState.setModifiedDataOnly = false;
2723
- break;
2724
- }
2725
- default:
2726
- return draftState;
2727
- }
2728
- });
2729
- const initialState = {
2730
- permissions: {},
2731
- status: "init"
2732
- };
2733
- const reducer = (state = initialState, action) => (
2734
- /* eslint-disable-next-line consistent-return */
2735
- produce__default.default(state, (draftState) => {
2736
- switch (action.type) {
2737
- case ACTION_SET_APP_RUNTIME_STATUS: {
2738
- draftState.status = "runtime";
2739
- break;
2740
- }
2741
- case ACTION_SET_ADMIN_PERMISSIONS: {
2742
- draftState.permissions = action.payload;
2743
- break;
2744
- }
2745
- default:
2746
- return draftState;
2747
- }
2748
- })
2749
- );
2750
- const staticReducers = {
2751
- admin_app: reducer,
2752
- rbacProvider: RBACReducer,
2753
- "content-manager_app": mainReducer,
2754
- "content-manager_listView": listViewReducer,
2755
- "content-manager_rbacManager": rbacManagerReducer,
2756
- "content-manager_editViewLayoutManager": editViewManagerReducer,
2757
- "content-manager_editViewCrudReducer": crudReducer
2758
- };
2759
- const injectReducerStoreEnhancer = (appReducers) => (next) => (...args) => {
2760
- const store = next(...args);
2761
- const asyncReducers = {};
2762
- return {
2763
- ...store,
2764
- asyncReducers,
2765
- injectReducer: (key, asyncReducer) => {
2766
- asyncReducers[key] = asyncReducer;
2767
- store.replaceReducer(
2768
- // @ts-expect-error we dynamically add reducers which makes the types uncomfortable.
2769
- toolkit.combineReducers({
2770
- ...appReducers,
2771
- ...asyncReducers
2772
- })
2773
- );
2774
- }
2775
- };
2776
- };
2777
- const configureStoreImpl = (appMiddlewares = [], injectedReducers = {}) => {
2778
- const coreReducers = { ...staticReducers, ...injectedReducers };
2779
- const store = toolkit.configureStore({
2780
- reducer: coreReducers,
2781
- devTools: process.env.NODE_ENV !== "production",
2782
- middleware: (getDefaultMiddleware) => [
2783
- ...getDefaultMiddleware(),
2784
- ...appMiddlewares.map((m) => m())
2785
- ],
2786
- enhancers: [injectReducerStoreEnhancer(coreReducers)]
2787
- });
2788
- return store;
2789
- };
2790
- const getBasename = () => (process.env.ADMIN_PATH ?? "").replace(window.location.origin, "");
2791
- const createHook = () => {
2792
- const _handlers = [];
2793
- return {
2794
- register(fn) {
2795
- _handlers.push(fn);
2796
- },
2797
- delete(handler) {
2798
- _handlers.splice(_handlers.indexOf(handler), 1);
2799
- },
2800
- runWaterfall(args, store) {
2801
- return _handlers.reduce((acc, fn) => fn(acc, store), args);
2802
- },
2803
- async runWaterfallAsync(args, store) {
2804
- let result = args;
2805
- for (const fn of _handlers) {
2806
- result = await fn(result, store);
2807
- }
2808
- return result;
2809
- },
2810
- runSeries(...args) {
2811
- return _handlers.map((fn) => fn(...args));
2812
- },
2813
- async runSeriesAsync(...args) {
2814
- const result = [];
2815
- for (const fn of _handlers) {
2816
- result.push(await fn(...args));
2817
- }
2818
- return result;
2819
- },
2820
- runParallel(...args) {
2821
- return Promise.all(
2822
- _handlers.map((fn) => {
2823
- return fn(...args);
2824
- })
2825
- );
2826
- }
2827
- };
2828
- };
2829
- const useInjectionZone = (area) => {
2830
- const { getAdminInjectedComponents } = useAdmin();
2831
- const [moduleName, page, position] = area.split(".");
2832
- return getAdminInjectedComponents(moduleName, page, position);
2833
- };
2834
- const INJECTION_ZONES = {
2835
- admin: {
2836
- // Temporary injection zone, support for the react-tour plugin in foodadvisor
2837
- tutorials: {
2838
- links: []
2839
- }
2840
- },
2841
- contentManager: {
2842
- editView: { informations: [], "right-links": [] },
2843
- listView: {
2844
- actions: [],
2845
- deleteModalAdditionalInfos: [],
2846
- publishModalAdditionalInfos: [],
2847
- unpublishModalAdditionalInfos: []
2848
- }
2849
- }
2850
- };
2851
- const InjectionZone = ({ area, ...props }) => {
2852
- const components = useInjectionZone(area);
2853
- return components.map((component) => /* @__PURE__ */ jsxRuntime.jsx(component.Component, { ...props }, component.name));
2854
- };
2855
- const languageNativeNames = {
2856
- ar: "العربية",
2857
- ca: "Català",
2858
- cs: "Čeština",
2859
- de: "Deutsch",
2860
- dk: "Dansk",
2861
- en: "English",
2862
- es: "Español",
2863
- eu: "Euskara",
2864
- fr: "Français",
2865
- gu: "Gujarati",
2866
- he: "עברית",
2867
- hu: "Magyar",
2868
- id: "Indonesian",
2869
- it: "Italiano",
2870
- ja: "日本語",
2871
- ko: "한국어",
2872
- ml: "Malayalam",
2873
- ms: "Melayu",
2874
- nl: "Nederlands",
2875
- no: "Norwegian",
2876
- pl: "Polski",
2877
- "pt-BR": "Português (Brasil)",
2878
- pt: "Português (Portugal)",
2879
- ru: "Русский",
2880
- sk: "Slovenčina",
2881
- sv: "Swedish",
2882
- th: "ไทย",
2883
- tr: "Türkçe",
2884
- uk: "Українська",
2885
- vi: "Tiếng Việt",
2886
- "zh-Hans": "中文 (简体)",
2887
- zh: "中文 (繁體)",
2888
- sa: "संस्कृत",
2889
- hi: "हिन्दी"
2890
- };
2891
- const {
2892
- INJECT_COLUMN_IN_TABLE,
2893
- MUTATE_COLLECTION_TYPES_LINKS,
2894
- MUTATE_EDIT_VIEW_LAYOUT,
2895
- MUTATE_SINGLE_TYPES_LINKS
2896
- } = HOOKS;
2897
- class StrapiApp {
2898
- admin;
2899
- appPlugins;
2900
- configurations;
2901
- customBootstrapConfiguration;
2902
- customConfigurations;
2903
- customFields;
2904
- hooksDict;
2905
- library;
2906
- menu;
2907
- middlewares;
2908
- plugins;
2909
- reducers;
2910
- settings;
2911
- translations;
2912
- constructor({ adminConfig, appPlugins } = {}) {
2913
- this.customConfigurations = adminConfig?.config ?? {};
2914
- this.customBootstrapConfiguration = adminConfig?.bootstrap;
2915
- this.configurations = {
2916
- authLogo: StrapiLogo,
2917
- head: { favicon: "" },
2918
- locales: ["en"],
2919
- menuLogo: StrapiLogo,
2920
- notifications: { releases: true },
2921
- themes: { light: designSystem.lightTheme, dark: designSystem.darkTheme },
2922
- translations: {},
2923
- tutorials: true
2924
- };
2925
- this.appPlugins = appPlugins || {};
2926
- this.library = {
2927
- components: new Components(),
2928
- fields: new Fields()
2929
- };
2930
- this.middlewares = new Middlewares();
2931
- this.plugins = {};
2932
- this.reducers = new Reducers();
2933
- this.translations = {};
2934
- this.hooksDict = {};
2935
- this.admin = {
2936
- injectionZones: INJECTION_ZONES
2937
- };
2938
- this.customFields = new CustomFields();
2939
- this.menu = [];
2940
- this.settings = {
2941
- global: {
2942
- id: "global",
2943
- intlLabel: {
2944
- id: "Settings.global",
2945
- defaultMessage: "Global Settings"
2946
- },
2947
- links: []
2948
- }
2949
- };
2950
- }
2951
- addComponents = (components) => {
2952
- if (Array.isArray(components)) {
2953
- components.map((compo) => this.library.components.add(compo));
2954
- } else {
2955
- this.library.components.add(components);
2956
- }
2957
- };
2958
- addCorePluginMenuLink = (link) => {
2959
- const stringifiedLink = JSON.stringify(link);
2960
- invariant__default.default(link.to, `link.to should be defined for ${stringifiedLink}`);
2961
- invariant__default.default(
2962
- typeof link.to === "string",
2963
- `Expected link.to to be a string instead received ${typeof link.to}`
2964
- );
2965
- invariant__default.default(
2966
- ["/plugins/content-type-builder", "/plugins/upload"].includes(link.to),
2967
- "This method is not available for your plugin"
2968
- );
2969
- invariant__default.default(
2970
- link.intlLabel?.id && link.intlLabel?.defaultMessage,
2971
- `link.intlLabel.id & link.intlLabel.defaultMessage for ${stringifiedLink}`
2972
- );
2973
- this.menu.push(link);
2974
- };
2975
- addFields = (fields) => {
2976
- if (Array.isArray(fields)) {
2977
- fields.map((field) => this.library.fields.add(field));
2978
- } else {
2979
- this.library.fields.add(fields);
2980
- }
2981
- };
2982
- addMenuLink = (link) => {
2983
- const stringifiedLink = JSON.stringify(link);
2984
- invariant__default.default(link.to, `link.to should be defined for ${stringifiedLink}`);
2985
- invariant__default.default(
2986
- typeof link.to === "string",
2987
- `Expected link.to to be a string instead received ${typeof link.to}`
2988
- );
2989
- invariant__default.default(
2990
- link.intlLabel?.id && link.intlLabel?.defaultMessage,
2991
- `link.intlLabel.id & link.intlLabel.defaultMessage for ${stringifiedLink}`
2992
- );
2993
- invariant__default.default(
2994
- link.Component && typeof link.Component === "function",
2995
- `link.Component should be a valid React Component`
2996
- );
2997
- invariant__default.default(
2998
- link.icon && typeof link.icon === "function",
2999
- `link.Icon should be a valid React Component`
3000
- );
3001
- this.menu.push(link);
3002
- };
3003
- addMiddlewares = (middlewares) => {
3004
- middlewares.forEach((middleware) => {
3005
- this.middlewares.add(middleware);
3006
- });
3007
- };
3008
- addReducers = (reducers) => {
3009
- Object.keys(reducers).forEach((reducerName) => {
3010
- this.reducers.add(reducerName, reducers[reducerName]);
3011
- });
3012
- };
3013
- addSettingsLink = (sectionId, link) => {
3014
- invariant__default.default(this.settings[sectionId], "The section does not exist");
3015
- const stringifiedLink = JSON.stringify(link);
3016
- invariant__default.default(link.id, `link.id should be defined for ${stringifiedLink}`);
3017
- invariant__default.default(
3018
- link.intlLabel?.id && link.intlLabel?.defaultMessage,
3019
- `link.intlLabel.id & link.intlLabel.defaultMessage for ${stringifiedLink}`
3020
- );
3021
- invariant__default.default(link.to, `link.to should be defined for ${stringifiedLink}`);
3022
- invariant__default.default(
3023
- link.Component && typeof link.Component === "function",
3024
- `link.Component should be a valid React Component`
3025
- );
3026
- this.settings[sectionId].links.push(link);
3027
- };
3028
- addSettingsLinks = (sectionId, links) => {
3029
- invariant__default.default(this.settings[sectionId], "The section does not exist");
3030
- invariant__default.default(Array.isArray(links), "TypeError expected links to be an array");
3031
- links.forEach((link) => {
3032
- this.addSettingsLink(sectionId, link);
3033
- });
3034
- };
3035
- async bootstrap() {
3036
- Object.keys(this.appPlugins).forEach((plugin) => {
3037
- const bootstrap = this.appPlugins[plugin].bootstrap;
3038
- if (bootstrap) {
3039
- bootstrap({
3040
- addSettingsLink: this.addSettingsLink,
3041
- addSettingsLinks: this.addSettingsLinks,
3042
- getPlugin: this.getPlugin,
3043
- injectContentManagerComponent: this.injectContentManagerComponent,
3044
- injectAdminComponent: this.injectAdminComponent,
3045
- registerHook: this.registerHook
3046
- });
3047
- }
3048
- });
3049
- if (isFunction__default.default(this.customBootstrapConfiguration)) {
3050
- this.customBootstrapConfiguration({
3051
- addComponents: this.addComponents,
3052
- addFields: this.addFields,
3053
- addMenuLink: this.addMenuLink,
3054
- addReducers: this.addReducers,
3055
- addSettingsLink: this.addSettingsLink,
3056
- addSettingsLinks: this.addSettingsLinks,
3057
- getPlugin: this.getPlugin,
3058
- injectContentManagerComponent: this.injectContentManagerComponent,
3059
- injectAdminComponent: this.injectAdminComponent,
3060
- registerHook: this.registerHook
3061
- });
3062
- }
3063
- }
3064
- bootstrapAdmin = async () => {
3065
- await this.createCustomConfigurations();
3066
- this.createHook(INJECT_COLUMN_IN_TABLE);
3067
- this.createHook(MUTATE_COLLECTION_TYPES_LINKS);
3068
- this.createHook(MUTATE_SINGLE_TYPES_LINKS);
3069
- this.createHook(MUTATE_EDIT_VIEW_LAYOUT);
3070
- return Promise.resolve();
3071
- };
3072
- createCustomConfigurations = async () => {
3073
- if (this.customConfigurations?.locales) {
3074
- this.configurations.locales = [
3075
- "en",
3076
- ...this.customConfigurations.locales?.filter((loc) => loc !== "en") || []
3077
- ];
3078
- }
3079
- if (this.customConfigurations?.auth?.logo) {
3080
- this.configurations.authLogo = this.customConfigurations.auth.logo;
3081
- }
3082
- if (this.customConfigurations?.menu?.logo) {
3083
- this.configurations.menuLogo = this.customConfigurations.menu.logo;
3084
- }
3085
- if (this.customConfigurations?.head?.favicon) {
3086
- this.configurations.head.favicon = this.customConfigurations.head.favicon;
3087
- }
3088
- if (this.customConfigurations?.theme) {
3089
- const darkTheme2 = this.customConfigurations.theme.dark;
3090
- const lightTheme2 = this.customConfigurations.theme.light;
3091
- if (!darkTheme2 && !lightTheme2) {
3092
- console.warn(
3093
- `[deprecated] In future versions, Strapi will stop supporting this theme customization syntax. The theme configuration accepts a light and a dark key to customize each theme separately. See https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#theme-extension.`
3094
- );
3095
- merge__default.default(this.configurations.themes.light, this.customConfigurations.theme);
3096
- }
3097
- if (lightTheme2)
3098
- merge__default.default(this.configurations.themes.light, lightTheme2);
3099
- if (darkTheme2)
3100
- merge__default.default(this.configurations.themes.dark, darkTheme2);
3101
- }
3102
- if (this.customConfigurations?.notifications?.releases !== void 0) {
3103
- this.configurations.notifications.releases = this.customConfigurations.notifications.releases;
3104
- }
3105
- if (this.customConfigurations?.tutorials !== void 0) {
3106
- this.configurations.tutorials = this.customConfigurations.tutorials;
3107
- }
3108
- };
3109
- createHook = (name) => {
3110
- this.hooksDict[name] = createHook();
3111
- };
3112
- createSettingSection = (section, links) => {
3113
- invariant__default.default(section.id, "section.id should be defined");
3114
- invariant__default.default(
3115
- section.intlLabel?.id && section.intlLabel?.defaultMessage,
3116
- "section.intlLabel should be defined"
3117
- );
3118
- invariant__default.default(Array.isArray(links), "TypeError expected links to be an array");
3119
- invariant__default.default(this.settings[section.id] === void 0, "A similar section already exists");
3120
- this.settings[section.id] = { ...section, links: [] };
3121
- links.forEach((link) => {
3122
- this.addSettingsLink(section.id, link);
3123
- });
3124
- };
3125
- createStore = () => {
3126
- const store = configureStoreImpl(this.middlewares.middlewares, this.reducers.reducers);
3127
- return store;
3128
- };
3129
- getAdminInjectedComponents = (moduleName, containerName, blockName) => {
3130
- try {
3131
- return this.admin.injectionZones[moduleName][containerName][blockName] || [];
3132
- } catch (err) {
3133
- console.error("Cannot get injected component", err);
3134
- return [];
3135
- }
3136
- };
3137
- getPlugin = (pluginId) => {
3138
- return this.plugins[pluginId];
3139
- };
3140
- async initialize() {
3141
- Object.keys(this.appPlugins).forEach((plugin) => {
3142
- this.appPlugins[plugin].register(this);
3143
- });
3144
- }
3145
- injectContentManagerComponent = (containerName, blockName, component) => {
3146
- invariant__default.default(
3147
- this.admin.injectionZones.contentManager[containerName]?.[blockName],
3148
- `The ${containerName} ${String(blockName)} zone is not defined in the content manager`
3149
- );
3150
- invariant__default.default(component, "A Component must be provided");
3151
- this.admin.injectionZones.contentManager[containerName][blockName].push(component);
3152
- };
3153
- injectAdminComponent = (containerName, blockName, component) => {
3154
- invariant__default.default(
3155
- this.admin.injectionZones.admin[containerName]?.[blockName],
3156
- `The ${containerName} ${String(blockName)} zone is not defined in the admin`
3157
- );
3158
- invariant__default.default(component, "A Component must be provided");
3159
- this.admin.injectionZones.admin[containerName][blockName].push(component);
3160
- };
3161
- /**
3162
- * Load the admin translations
3163
- * @returns {Object} The imported admin translations
3164
- */
3165
- async loadAdminTrads() {
3166
- const arrayOfPromises = this.configurations.locales.map((locale) => {
3167
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-21279f4c.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-d05fb350.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-eee75b10.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-976cc986.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-6189917e.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-0e9e9327.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-3ee0992a.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-be749f31.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-29c84e1f.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-377a4b46.js")), "./translations/he.json": () => Promise.resolve().then(() => require("./he-aec27352.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-1bdc7a46.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-e2c05f40.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-586df3a2.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-9c4295f1.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-eb74520f.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-18e71df4.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-c5199364.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-bc514df6.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-f1aedbe2.js")), "./translations/no.json": () => Promise.resolve().then(() => require("./no-ec6c2927.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-9be86414.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-d43239e3.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-4fcc08f1.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-c0293425.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-8ffb7ca7.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-a9308737.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-0f5ffd1e.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-a53bbf7a.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-b84a68b0.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-e5226227.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-c5fabb75.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-35d2c374.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-24f618cb.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
3168
- return { data, locale };
3169
- }).catch(() => {
3170
- return { data: null, locale };
3171
- });
3172
- });
3173
- const adminLocales = await Promise.all(arrayOfPromises);
3174
- const translations = adminLocales.reduce(
3175
- (acc, current) => {
3176
- if (current.data) {
3177
- acc[current.locale] = current.data;
3178
- }
3179
- return acc;
3180
- },
3181
- {}
3182
- );
3183
- return translations;
3184
- }
3185
- /**
3186
- * Load the application's translations and merged the custom translations
3187
- * with the default ones.
3188
- *
3189
- */
3190
- async loadTrads() {
3191
- const adminTranslations = await this.loadAdminTrads();
3192
- const arrayOfPromises = Object.keys(this.appPlugins).map((plugin) => {
3193
- const registerTrads = this.appPlugins[plugin].registerTrads;
3194
- if (registerTrads) {
3195
- return registerTrads({ locales: this.configurations.locales });
3196
- }
3197
- return null;
3198
- }).filter((a) => a);
3199
- const pluginsTrads = await Promise.all(arrayOfPromises);
3200
- const mergedTrads = pluginsTrads.reduce(
3201
- (acc, currentPluginTrads) => {
3202
- const pluginTrads = currentPluginTrads.reduce(
3203
- (acc1, current) => {
3204
- acc1[current.locale] = current.data;
3205
- return acc1;
3206
- },
3207
- {}
3208
- );
3209
- Object.keys(pluginTrads).forEach((locale) => {
3210
- acc[locale] = { ...acc[locale], ...pluginTrads[locale] };
3211
- });
3212
- return acc;
3213
- },
3214
- {}
3215
- );
3216
- const translations = this.configurations.locales.reduce((acc, current) => {
3217
- acc[current] = {
3218
- ...adminTranslations[current],
3219
- ...mergedTrads[current] || {},
3220
- ...this.customConfigurations?.translations?.[current] ?? {}
3221
- };
3222
- return acc;
3223
- }, {});
3224
- this.configurations.translations = translations;
3225
- return Promise.resolve();
3226
- }
3227
- registerHook = (name, fn) => {
3228
- invariant__default.default(
3229
- this.hooksDict[name],
3230
- `The hook ${name} is not defined. You are trying to register a hook that does not exist in the application.`
3231
- );
3232
- this.hooksDict[name].register(fn);
3233
- };
3234
- registerPlugin = (pluginConf) => {
3235
- const plugin = new Plugin(pluginConf);
3236
- this.plugins[plugin.pluginId] = plugin;
3237
- };
3238
- runHookSeries = (name, asynchronous = false) => asynchronous ? this.hooksDict[name].runSeriesAsync() : this.hooksDict[name].runSeries();
3239
- runHookWaterfall = (name, initialValue, asynchronous = false, store) => {
3240
- return asynchronous ? this.hooksDict[name].runWaterfallAsync(initialValue, store) : this.hooksDict[name].runWaterfall(initialValue, store);
3241
- };
3242
- runHookParallel = (name) => this.hooksDict[name].runParallel();
3243
- render() {
3244
- const store = this.createStore();
3245
- const localeNames = pick__default.default(languageNativeNames, this.configurations.locales || []);
3246
- const {
3247
- components: { components },
3248
- fields: { fields }
3249
- } = this.library;
3250
- return /* @__PURE__ */ jsxRuntime.jsxs(
3251
- Providers,
3252
- {
3253
- authLogo: this.configurations.authLogo,
3254
- components,
3255
- fields,
3256
- customFields: this.customFields,
3257
- localeNames,
3258
- getAdminInjectedComponents: this.getAdminInjectedComponents,
3259
- getPlugin: this.getPlugin,
3260
- messages: this.configurations.translations,
3261
- menu: this.menu,
3262
- menuLogo: this.configurations.menuLogo,
3263
- plugins: this.plugins,
3264
- runHookParallel: this.runHookParallel,
3265
- runHookWaterfall: (name, initialValue, async = false) => {
3266
- return this.runHookWaterfall(name, initialValue, async, store);
3267
- },
3268
- runHookSeries: this.runHookSeries,
3269
- themes: this.configurations.themes,
3270
- settings: this.settings,
3271
- showTutorials: this.configurations.tutorials,
3272
- showReleaseNotification: this.configurations.notifications.releases,
3273
- store,
3274
- children: [
3275
- /* @__PURE__ */ jsxRuntime.jsx(
3276
- reactHelmet.Helmet,
3277
- {
3278
- htmlAttributes: { lang: localStorage.getItem(LANGUAGE_LOCAL_STORAGE_KEY) || "en" }
3279
- }
3280
- ),
3281
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { basename: getBasename(), children: /* @__PURE__ */ jsxRuntime.jsx(App, {}) })
3282
- ]
3283
- }
3284
- );
3285
- }
3286
- }
3287
- const renderAdmin = async (mountNode, { plugins, customisations, features }) => {
3288
- if (!mountNode) {
3289
- throw new Error("[@strapi/admin]: Could not find the root element to mount the admin app");
3290
- }
3291
- window.strapi = {
3292
- /**
3293
- * This ENV variable is passed from the strapi instance, by default no url is set
3294
- * in the config and therefore the instance returns you an empty string so URLs are relative.
3295
- *
3296
- * To ensure that the backendURL is always set, we use the window.location.origin as a fallback.
3297
- */
3298
- backendURL: process.env.STRAPI_ADMIN_BACKEND_URL || window.location.origin,
3299
- isEE: false,
3300
- telemetryDisabled: process.env.STRAPI_TELEMETRY_DISABLED === "true" ? true : false,
3301
- future: {
3302
- isEnabled: (name) => {
3303
- return features?.future?.[name] === true;
3304
- }
3305
- },
3306
- // @ts-expect-error – there's pollution from the global scope of Node.
3307
- features: {
3308
- SSO: "sso",
3309
- AUDIT_LOGS: "audit-logs",
3310
- REVIEW_WORKFLOWS: "review-workflows",
3311
- /**
3312
- * If we don't get the license then we know it's not EE
3313
- * so no feature is enabled.
3314
- */
3315
- isEnabled: () => false
3316
- },
3317
- projectType: "Community",
3318
- flags: {
3319
- nps: false,
3320
- promoteEE: true
3321
- }
3322
- };
3323
- const { get: get2 } = helperPlugin.getFetchClient();
3324
- try {
3325
- const {
3326
- data: {
3327
- data: { isEE, features: features2, flags }
3328
- }
3329
- } = await get2("/admin/project-type");
3330
- window.strapi.isEE = isEE;
3331
- window.strapi.flags = flags;
3332
- window.strapi.features = {
3333
- ...window.strapi.features,
3334
- isEnabled: (featureName) => features2.some((feature) => feature.name === featureName)
3335
- };
3336
- window.strapi.projectType = isEE ? "Enterprise" : "Community";
3337
- } catch (err) {
3338
- console.error(err);
3339
- }
3340
- const app = new StrapiApp({
3341
- adminConfig: customisations,
3342
- appPlugins: plugins
3343
- });
3344
- await app.bootstrapAdmin();
3345
- await app.initialize();
3346
- await app.bootstrap();
3347
- await app.loadTrads();
3348
- client.createRoot(mountNode).render(app.render());
3349
- if (typeof module !== "undefined" && module && "hot" in module && typeof module.hot === "object" && module.hot !== null && "accept" in module.hot && typeof module.hot.accept === "function") {
3350
- module.hot.accept();
3351
- }
3352
- };
3353
- exports.ACTION_SET_APP_RUNTIME_STATUS = ACTION_SET_APP_RUNTIME_STATUS;
3354
- exports.CLEAR_SET_MODIFIED_DATA_ONLY = CLEAR_SET_MODIFIED_DATA_ONLY;
3355
- exports.Column = Column;
3356
- exports.DefaultDocument = DefaultDocument;
3357
- exports.GET_DATA = GET_DATA;
3358
- exports.GET_DATA$1 = GET_DATA$1;
3359
- exports.GET_DATA_SUCCEEDED = GET_DATA_SUCCEEDED;
3360
- exports.GET_DATA_SUCCEEDED$1 = GET_DATA_SUCCEEDED$1;
3361
- exports.GET_INIT_DATA = GET_INIT_DATA;
3362
- exports.HOOKS = HOOKS;
3363
- exports.INIT_FORM = INIT_FORM;
3364
- exports.InjectionZone = InjectionZone;
3365
- exports.LayoutContent = LayoutContent;
3366
- exports.Login = Login;
3367
- exports.Logo = Logo;
3368
- exports.NotFoundPage = NotFoundPage$1;
3369
- exports.NpsSurvey = NpsSurvey;
3370
- exports.ON_CHANGE_LIST_HEADERS = ON_CHANGE_LIST_HEADERS;
3371
- exports.ON_RESET_LIST_HEADERS = ON_RESET_LIST_HEADERS;
3372
- exports.RBACProvider = RBACProvider;
3373
- exports.RESET_INIT_DATA = RESET_INIT_DATA;
3374
- exports.RESET_PERMISSIONS = RESET_PERMISSIONS;
3375
- exports.RESET_PROPS = RESET_PROPS$2;
3376
- exports.RESET_PROPS$1 = RESET_PROPS;
3377
- exports.RESET_PROPS$2 = RESET_PROPS$1;
3378
- exports.SETTINGS_LINKS_CE = SETTINGS_LINKS_CE;
3379
- exports.SET_DATA_STRUCTURES = SET_DATA_STRUCTURES;
3380
- exports.SET_INIT_DATA = SET_INIT_DATA;
3381
- exports.SET_LAYOUT = SET_LAYOUT;
3382
- exports.SET_LIST_LAYOUT = SET_LIST_LAYOUT;
3383
- exports.SET_PERMISSIONS = SET_PERMISSIONS;
3384
- exports.SET_STATUS = SET_STATUS;
3385
- exports.SUBMIT_SUCCEEDED = SUBMIT_SUCCEEDED;
3386
- exports.StrapiLogo = StrapiLogo;
3387
- exports.UnauthenticatedLayout = UnauthenticatedLayout;
3388
- exports.createRoute = createRoute;
3389
- exports.createTypedSelector = createTypedSelector;
3390
- exports.crudInitialState = crudInitialState;
3391
- exports.crudReducer = crudReducer;
3392
- exports.getBasename = getBasename;
3393
- exports.initialState = initialState$1;
3394
- exports.initialState$1 = initialState$3;
3395
- exports.renderAdmin = renderAdmin;
3396
- exports.useConfiguration = useConfiguration;
3397
- exports.useEnterprise = useEnterprise;
3398
- exports.useInjectionZone = useInjectionZone;
3399
- exports.useLocales = useLocales;
3400
- exports.useThemeToggle = useThemeToggle;
3401
- exports.useTypedDispatch = useTypedDispatch;
3402
- exports.useTypedSelector = useTypedSelector;
3403
- exports.useTypedStore = useTypedStore;
3404
- //# sourceMappingURL=index-4de70b5d.js.map