@authing/react-ui-components 3.0.2-beta.7 → 3.0.3-rc.4

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 (260) hide show
  1. package/lib/index.d.ts +4263 -0
  2. package/lib/index.min.css +2 -0
  3. package/lib/index.min.js +2 -0
  4. package/{build/static/js/2.142555a1.chunk.js.LICENSE.txt → lib/index.min.js.LICENSE.txt} +8 -31
  5. package/{build → lib}/static/media/loading.4a67a5f3.svg +0 -0
  6. package/package.json +35 -12
  7. package/.eslintignore +0 -6
  8. package/.eslintrc.js +0 -7
  9. package/.prettierrc +0 -5
  10. package/build/asset-manifest.json +0 -26
  11. package/build/favicon.ico +0 -0
  12. package/build/index.html +0 -1
  13. package/build/logo192.png +0 -0
  14. package/build/logo512.png +0 -0
  15. package/build/manifest.json +0 -25
  16. package/build/robots.txt +0 -3
  17. package/build/static/css/2.5c23c9b8.chunk.css +0 -3
  18. package/build/static/css/2.5c23c9b8.chunk.css.map +0 -1
  19. package/build/static/css/main.6a8701e8.chunk.css +0 -2
  20. package/build/static/css/main.6a8701e8.chunk.css.map +0 -1
  21. package/build/static/js/2.142555a1.chunk.js +0 -3
  22. package/build/static/js/2.142555a1.chunk.js.map +0 -1
  23. package/build/static/js/3.ed27e06b.chunk.js +0 -2
  24. package/build/static/js/3.ed27e06b.chunk.js.map +0 -1
  25. package/build/static/js/main.8d075e4d.chunk.js +0 -2
  26. package/build/static/js/main.8d075e4d.chunk.js.map +0 -1
  27. package/build/static/js/runtime-main.9a428724.js +0 -2
  28. package/build/static/js/runtime-main.9a428724.js.map +0 -1
  29. package/components/AuthingDropdown/index.tsx +0 -52
  30. package/components/AuthingDropdown/style.less +0 -43
  31. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  32. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  33. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  34. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  35. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  36. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  37. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  38. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  39. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  40. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  41. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  42. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  43. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  44. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  45. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  46. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  47. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  48. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  49. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  50. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  51. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  52. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  53. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  54. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  55. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  56. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  57. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  58. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  59. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  60. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  61. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  62. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  63. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  64. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  65. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  66. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  67. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  68. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  69. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  70. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  71. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  72. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  73. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  74. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  75. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  76. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  77. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  78. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  79. package/components/AuthingGuard/Forms/index.ts +0 -13
  80. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  81. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  82. package/components/AuthingGuard/Header/index.tsx +0 -25
  83. package/components/AuthingGuard/Header/style.less +0 -52
  84. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  85. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  86. package/components/AuthingGuard/IconFont/style.less +0 -6
  87. package/components/AuthingGuard/IconFont/svg.js +0 -2
  88. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  89. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  90. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  91. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  92. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  93. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  94. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  95. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  96. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  97. package/components/AuthingGuard/api/appConfig.ts +0 -146
  98. package/components/AuthingGuard/api/index.ts +0 -3
  99. package/components/AuthingGuard/api/sso.ts +0 -29
  100. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  101. package/components/AuthingGuard/constants.ts +0 -107
  102. package/components/AuthingGuard/hooks/index.tsx +0 -70
  103. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  104. package/components/AuthingGuard/index.tsx +0 -126
  105. package/components/AuthingGuard/style.less +0 -103
  106. package/components/AuthingGuard/types/Forms.ts +0 -94
  107. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  108. package/components/AuthingGuard/types/GuardState.ts +0 -7
  109. package/components/AuthingGuard/types/Locales.ts +0 -12
  110. package/components/AuthingGuard/types/index.ts +0 -4
  111. package/components/AuthingTabs/index.tsx +0 -98
  112. package/components/AuthingTabs/style.less +0 -135
  113. package/components/BindTotp/core/bindSuccess.tsx +0 -72
  114. package/components/BindTotp/core/securityCode.tsx +0 -108
  115. package/components/BindTotp/index.tsx +0 -134
  116. package/components/BindTotp/interface.ts +0 -30
  117. package/components/BindTotp/styles.less +0 -57
  118. package/components/ChangeLanguage/index.tsx +0 -35
  119. package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
  120. package/components/ChangePassword/core/rotateReset.tsx +0 -125
  121. package/components/ChangePassword/index.tsx +0 -72
  122. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  123. package/components/CompleteInfo/index.tsx +0 -45
  124. package/components/CompleteInfo/interface.ts +0 -40
  125. package/components/CompleteInfo/styles.less +0 -7
  126. package/components/CopyAbleText/index.tsx +0 -54
  127. package/components/CopyAbleText/style.less +0 -13
  128. package/components/DownloadAuthenticator/index.tsx +0 -97
  129. package/components/DownloadAuthenticator/interface.ts +0 -22
  130. package/components/DownloadAuthenticator/styles.less +0 -52
  131. package/components/Error/index.tsx +0 -21
  132. package/components/Error/interface.ts +0 -9
  133. package/components/Error/styles.less +0 -12
  134. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  135. package/components/ForgetPassword/index.tsx +0 -78
  136. package/components/ForgetPassword/interface.ts +0 -32
  137. package/components/Guard/Guard.tsx +0 -295
  138. package/components/Guard/authClient.ts +0 -44
  139. package/components/Guard/config.ts +0 -19
  140. package/components/Guard/event.ts +0 -52
  141. package/components/Guard/index.tsx +0 -4
  142. package/components/Guard/module.ts +0 -20
  143. package/components/Guard/stateMachine.ts +0 -152
  144. package/components/Guard/styles.less +0 -461
  145. package/components/IconFont/iconfont.js +0 -74
  146. package/components/IconFont/index.tsx +0 -16
  147. package/components/IconFont/style.less +0 -6
  148. package/components/IconFont/svg.js +0 -2
  149. package/components/ImagePro/index.tsx +0 -53
  150. package/components/ImagePro/styles.less +0 -40
  151. package/components/InputNumber/index.tsx +0 -33
  152. package/components/Login/codemap.ts +0 -49
  153. package/components/Login/core/withAD.tsx +0 -9
  154. package/components/Login/core/withAppQrcode.tsx +0 -49
  155. package/components/Login/core/withLDAP.tsx +0 -146
  156. package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
  157. package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
  158. package/components/Login/core/withPassword/InputAccount.tsx +0 -64
  159. package/components/Login/core/withPassword/index.tsx +0 -173
  160. package/components/Login/core/withPhonecode.tsx +0 -122
  161. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  162. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  163. package/components/Login/index.tsx +0 -374
  164. package/components/Login/interface.ts +0 -74
  165. package/components/Login/socialLogin/index.tsx +0 -407
  166. package/components/Login/socialLogin/style.less +0 -69
  167. package/components/Login/styles.less +0 -53
  168. package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
  169. package/components/MFA/VerifyCodeInput/index.tsx +0 -145
  170. package/components/MFA/VerifyCodeInput/style.less +0 -35
  171. package/components/MFA/codemap.ts +0 -24
  172. package/components/MFA/core/email.tsx +0 -203
  173. package/components/MFA/core/face.tsx +0 -297
  174. package/components/MFA/core/face_deps.tsx +0 -37
  175. package/components/MFA/core/sms.tsx +0 -203
  176. package/components/MFA/core/totp.tsx +0 -122
  177. package/components/MFA/index.tsx +0 -143
  178. package/components/MFA/interface.ts +0 -51
  179. package/components/MFA/mfaMethods/index.tsx +0 -88
  180. package/components/MFA/mfaMethods/style.less +0 -39
  181. package/components/MFA/styles.less +0 -100
  182. package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
  183. package/components/NeedHelpView/index.tsx +0 -47
  184. package/components/RecoveryCode/core/useCode.tsx +0 -71
  185. package/components/RecoveryCode/index.tsx +0 -27
  186. package/components/RecoveryCode/interface.ts +0 -31
  187. package/components/RecoveryCode/style.less +0 -13
  188. package/components/Register/codemap.ts +0 -12
  189. package/components/Register/components/Agreements/index.tsx +0 -81
  190. package/components/Register/components/Agreements/style.less +0 -44
  191. package/components/Register/core/WithEmail.tsx +0 -242
  192. package/components/Register/core/WithPhone.tsx +0 -184
  193. package/components/Register/index.tsx +0 -139
  194. package/components/Register/interface.ts +0 -50
  195. package/components/SendCode/SendCodeBtn.tsx +0 -96
  196. package/components/SendCode/index.tsx +0 -94
  197. package/components/SendCode/style.less +0 -31
  198. package/components/ShieldSpin/index.tsx +0 -27
  199. package/components/ShieldSpin/loading.svg +0 -29
  200. package/components/SubmitButton/index.tsx +0 -50
  201. package/components/SubmitSuccess/index.tsx +0 -66
  202. package/components/SubmitSuccess/interface.ts +0 -17
  203. package/components/Type/index.ts +0 -52
  204. package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
  205. package/components/ValidatorRules/index.ts +0 -20
  206. package/components/VerifyCodeInput/index.tsx +0 -76
  207. package/components/VerifyCodeInput/style.less +0 -24
  208. package/components/_utils/GuardErrorCode.ts +0 -9
  209. package/components/_utils/clipboard.ts +0 -27
  210. package/components/_utils/config.ts +0 -116
  211. package/components/_utils/guradHttp.ts +0 -101
  212. package/components/_utils/hooks/index.ts +0 -64
  213. package/components/_utils/http.ts +0 -85
  214. package/components/_utils/index.ts +0 -326
  215. package/components/_utils/locales/en/common.json +0 -229
  216. package/components/_utils/locales/en/index.ts +0 -6
  217. package/components/_utils/locales/en/login.json +0 -96
  218. package/components/_utils/locales/en/map.json +0 -4
  219. package/components/_utils/locales/en/user.json +0 -82
  220. package/components/_utils/locales/index.ts +0 -45
  221. package/components/_utils/locales/zh/common.json +0 -229
  222. package/components/_utils/locales/zh/index.ts +0 -6
  223. package/components/_utils/locales/zh/login.json +0 -96
  224. package/components/_utils/locales/zh/map.json +0 -4
  225. package/components/_utils/locales/zh/user.json +0 -83
  226. package/components/_utils/popupCenter.ts +0 -48
  227. package/components/assets/images/error.png +0 -0
  228. package/components/context/base.tsx +0 -28
  229. package/components/context/global/context.tsx +0 -39
  230. package/components/context/global/reducer.tsx +0 -56
  231. package/components/context/module/context.tsx +0 -23
  232. package/components/index.ts +0 -9
  233. package/config/antdReplacer.js +0 -51
  234. package/config/env.js +0 -104
  235. package/config/getHttpsConfig.js +0 -66
  236. package/config/jest/cssTransform.js +0 -14
  237. package/config/jest/fileTransform.js +0 -40
  238. package/config/modules.js +0 -134
  239. package/config/paths.js +0 -71
  240. package/config/pnpTs.js +0 -35
  241. package/config/webpack.config.js +0 -835
  242. package/config/webpackDevServer.config.js +0 -130
  243. package/examples.tsx +0 -87
  244. package/index.js +0 -1
  245. package/logo.svg +0 -7
  246. package/public/favicon.ico +0 -0
  247. package/public/index.html +0 -43
  248. package/public/logo192.png +0 -0
  249. package/public/logo512.png +0 -0
  250. package/public/manifest.json +0 -25
  251. package/public/robots.txt +0 -3
  252. package/react-app-env.d.ts +0 -71
  253. package/reportWebVitals.ts +0 -15
  254. package/scripts/build.js +0 -208
  255. package/scripts/lib.js +0 -200
  256. package/scripts/publish.js +0 -57
  257. package/scripts/start.js +0 -162
  258. package/scripts/test.js +0 -49
  259. package/setupTests.ts +0 -5
  260. package/tsconfig.json +0 -30
@@ -1,2 +0,0 @@
1
- !function(e){function t(t){for(var n,i,a=t[0],c=t[1],l=t[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);p.length;)p.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"ed27e06b"}[e]+".chunk.js"}(e);var c=new Error;u=function(t){a.onerror=a.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this["webpackJsonp@authing/react-ui-components"]=this["webpackJsonp@authing/react-ui-components"]||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var f=c;r()}([]);
2
- //# sourceMappingURL=runtime-main.9a428724.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","p","jsonpScriptSrc","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property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GACpHC,EAAmBF,EAAWlF,KAAK2E,KAAKO,GAC5CA,EAAWlF,KAAOf,EAClBiG,EAAaA,EAAWG,QACxB,IAAI,IAAI7F,EAAI,EAAGA,EAAI0F,EAAWxF,OAAQF,IAAKP,EAAqBiG,EAAW1F,IAC3E,IAAIU,EAAsBkF,EAI1B9E,I","file":"static/js/runtime-main.9a428724.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"static/js/\" + ({}[chunkId]||chunkId) + \".\" + {\"3\":\"ed27e06b\"}[chunkId] + \".chunk.js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = this[\"webpackJsonp@authing/react-ui-components\"] = this[\"webpackJsonp@authing/react-ui-components\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""}
@@ -1,52 +0,0 @@
1
- import { DownOutlined } from '@ant-design/icons'
2
- import React, { FC, useState } from 'react'
3
- import { getClassnames } from '../_utils'
4
-
5
- import './style.less'
6
-
7
- /**
8
- * 不使用 antd 的 dropdown,因为里面会用 tooltip,体积过大
9
- */
10
- export const AuthingDropdown: FC<{
11
- className?: string
12
- menus: {
13
- label: React.ReactNode
14
- key: string | number
15
- onClick?: (
16
- key: string | number,
17
- evt: React.MouseEvent<HTMLDivElement, MouseEvent>
18
- ) => void
19
- }[]
20
- }> = ({ menus, children, className }) => {
21
- const [visible, setVisible] = useState(false)
22
-
23
- return (
24
- <div
25
- className={getClassnames(['authing-dropdown', className])}
26
- onMouseEnter={() => setVisible(true)}
27
- onMouseLeave={() => setVisible(false)}
28
- >
29
- <div className="authing-dropdown-trigger">{children}</div>
30
- <div
31
- className={getClassnames([
32
- 'authing-dropdown-menu-container',
33
- visible && 'authing-dropdown-menu-container__visible',
34
- ])}
35
- >
36
- {menus.map((item) => (
37
- <div
38
- className="authing-dropdown-menu-item"
39
- onClick={(evt) => {
40
- setVisible(false)
41
- item.onClick?.(item.key, evt)
42
- }}
43
- key={item.key}
44
- >
45
- {item.label}
46
- </div>
47
- ))}
48
- </div>
49
- <DownOutlined className="authing-dropdown-icon" />
50
- </div>
51
- )
52
- }
@@ -1,43 +0,0 @@
1
- .authing-dropdown {
2
- display: inline-flex;
3
- position: relative;
4
- align-items: center;
5
- }
6
-
7
- .authing-dropdown-trigger {
8
- cursor: pointer;
9
- }
10
-
11
- .authing-dropdown-menu-container {
12
- height: 0;
13
- opacity: 0;
14
- position: absolute;
15
- top: 100%;
16
- left: 0;
17
- transition: all 0.3s;
18
- cursor: pointer;
19
- background-color: #fff;
20
- padding: 4px 0;
21
- border-radius: 2px;
22
- box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
23
- 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
24
- pointer-events: none;
25
- }
26
-
27
- .authing-dropdown-menu-container__visible {
28
- height: auto;
29
- opacity: 1;
30
- pointer-events: unset;
31
- }
32
-
33
- .authing-dropdown-menu-item {
34
- padding: 5px 12px;
35
- transition: all 0.3s;
36
- &:hover {
37
- background-color: #f5f5f5;
38
- }
39
- }
40
-
41
- .authing-dropdown-icon {
42
- margin-left: 8px;
43
- }
@@ -1,74 +0,0 @@
1
- import { message } from 'antd'
2
- import { User } from 'authing-js-sdk'
3
- import React, { FC, useState } from 'react'
4
- import { useTranslation } from 'react-i18next'
5
- import { AuthingDropdown } from '../../AuthingDropdown'
6
-
7
- import {
8
- EmailMfaVerifyForm,
9
- SmsMfaVerifyForm,
10
- } from '../../../components/AuthingGuard/Forms'
11
- import { useGuardContext } from '../../context/global/context'
12
- import { ApplicationMfaType, ApplicationMfaTypeLabel } from '../api'
13
-
14
- import './style.less'
15
-
16
- export interface MfaLayoutProps {}
17
-
18
- export const AppMfaLayout: FC<MfaLayoutProps> = () => {
19
- const { t } = useTranslation()
20
- const {
21
- state: { guardEvents, authClient, mfaData },
22
- } = useGuardContext()
23
-
24
- const [type, setType] = useState(ApplicationMfaType.SMS)
25
-
26
- const onSuccess = (user: User) => {
27
- message.success(t('common.LoginSuccess'))
28
- guardEvents.onLogin?.(user, authClient)
29
- }
30
-
31
- const onFail = (error: any) => {
32
- guardEvents.onLoginError?.(error, authClient)
33
- }
34
-
35
- const formProps = {
36
- onSuccess,
37
- onFail,
38
- }
39
-
40
- const formMap = {
41
- [ApplicationMfaType.EMAIL]: <EmailMfaVerifyForm {...formProps} />,
42
- [ApplicationMfaType.SMS]: <SmsMfaVerifyForm {...formProps} />,
43
- }
44
-
45
- const availableMfaType = mfaData.applicationMfa
46
- ?.filter(
47
- (item) =>
48
- item.status && Object.keys(ApplicationMfaType).includes(item.mfaPolicy)
49
- )
50
- ?.sort((a, b) => a.sort - b.sort)
51
- ?.map((item) => ({
52
- label: ApplicationMfaTypeLabel()[item.mfaPolicy],
53
- key: item.mfaPolicy,
54
- onClick() {
55
- setType(item.mfaPolicy)
56
- },
57
- }))
58
-
59
- return (
60
- <div className="authing-text-center">
61
- {formMap[type]}
62
- {(availableMfaType?.length || 0 > 1) && (
63
- <AuthingDropdown
64
- className="toggle-mfa-dropdown"
65
- menus={availableMfaType!}
66
- >
67
- <span className="authing-toggle-mfa">
68
- {t('login.otherVerifyWay')}
69
- </span>
70
- </AuthingDropdown>
71
- )}
72
- </div>
73
- )
74
- }
@@ -1,12 +0,0 @@
1
- .authing-toggle-mfa,
2
- .toggle-mfa-dropdown .authing-dropdown-icon {
3
- color: #999;
4
- }
5
-
6
- .toggle-mfa-dropdown {
7
- margin-top: 30px;
8
- align-self: center;
9
- .authing-dropdown-menu-item {
10
- white-space: nowrap;
11
- }
12
- }
@@ -1,29 +0,0 @@
1
- import React, { FC } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { useGuardContext } from '../../context/global/context'
4
- import { CompleteUserInfoForm } from '../Forms/CompleteUserInfoForm'
5
-
6
- import './style.less'
7
-
8
- export const CompleteUserInfoLayout: FC = () => {
9
- const {
10
- state: { guardTitle },
11
- } = useGuardContext()
12
-
13
- const { t } = useTranslation()
14
- return (
15
- <div>
16
- <h2 className="authing-guard-complete-info-title">
17
- {t('common.perfectUserInfo')}
18
- </h2>
19
-
20
- <p className="authing-guard-complete-info-msg">
21
- {t('common.welcomeDoc', {
22
- name: guardTitle,
23
- })}
24
- </p>
25
-
26
- <CompleteUserInfoForm />
27
- </div>
28
- )
29
- }
@@ -1,8 +0,0 @@
1
- .authing-guard-complete-info-title {
2
- font-size: 20px;
3
- text-align: center;
4
- color: #333;
5
- }
6
- .authing-guard-complete-info-msg {
7
- color: #b2b2b2;
8
- }
@@ -1,117 +0,0 @@
1
- import { Input, Form, message } from 'antd'
2
- import { FormInstance } from 'antd/lib/form'
3
- import { UserOutlined, LockOutlined } from '@ant-design/icons'
4
- import React, { forwardRef, useImperativeHandle, useState } from 'react'
5
-
6
- import { useGuardContext } from '../../../context/global/context'
7
- import {
8
- ADLoginFormProps,
9
- LoginMethods,
10
- } from '../../../../components/AuthingGuard/types'
11
- import { LoginFormFooter } from '../../../../components/AuthingGuard/Forms/LoginFormFooter'
12
- import { useTranslation } from 'react-i18next'
13
- import { getRequiredRules } from '../../../_utils'
14
-
15
- export const ADLoginForm = forwardRef<FormInstance, ADLoginFormProps>(
16
- ({ onSuccess, onValidateFail, onFail }, ref) => {
17
- const { t } = useTranslation()
18
- const { state } = useGuardContext()
19
- const { authClient, guardEvents } = state
20
-
21
- const [loading, setLoading] = useState(false)
22
-
23
- const onFinishFailed = (errorInfo: any) => {
24
- setLoading(false)
25
- onValidateFail && onValidateFail(errorInfo)
26
- }
27
-
28
- const [rawForm] = Form.useForm()
29
-
30
- const onFinish = async (values: any) => {
31
- if (guardEvents.onBeforeLogin) {
32
- try {
33
- const canLogin = await guardEvents.onBeforeLogin(
34
- {
35
- type: LoginMethods.AD,
36
- data: {
37
- identity: values.identity,
38
- password: values.password,
39
- },
40
- },
41
- authClient
42
- )
43
-
44
- if (!canLogin) {
45
- setLoading(false)
46
- return
47
- }
48
- } catch (e) {
49
- if (typeof e === 'string') {
50
- message.error(e)
51
- } else {
52
- message.error(e.message)
53
- }
54
- setLoading(false)
55
- return
56
- }
57
- }
58
-
59
- try {
60
- const identity = values.identity && values.identity.trim()
61
- const password = values.password && values.password.trim()
62
- const user = await authClient.loginByAd(identity, password)
63
- onSuccess && onSuccess(user)
64
- } catch (error) {
65
- if (typeof error.message === 'string') {
66
- // js sdk httpclient 的报错,这里只有一种情况就是用户开启了 mfa 的报错
67
- try {
68
- const errorData = JSON.parse(error.message)
69
- onFail && onFail(errorData)
70
- return
71
- } catch (_) {
72
- // do nothing
73
- }
74
- }
75
- onFail && onFail(error)
76
- } finally {
77
- setLoading(false)
78
- }
79
- }
80
-
81
- useImperativeHandle(ref, () => rawForm)
82
-
83
- return (
84
- <Form
85
- form={rawForm}
86
- onSubmitCapture={() => setLoading(true)}
87
- onFinishFailed={onFinishFailed}
88
- onFinish={onFinish}
89
- >
90
- <Form.Item
91
- name="identity"
92
- rules={getRequiredRules(t('login.inputAdUsername'))}
93
- >
94
- <Input
95
- autoComplete="email,username,tel"
96
- size="large"
97
- placeholder={t('login.inputAdUsername')}
98
- prefix={<UserOutlined style={{ color: '#ddd' }} />}
99
- />
100
- </Form.Item>
101
- <Form.Item
102
- name="password"
103
- rules={getRequiredRules(t('login.inputAdPwd'))}
104
- >
105
- <Input.Password
106
- autoComplete="current-password"
107
- size="large"
108
- visibilityToggle={false}
109
- placeholder={t('login.inputAdPwd')}
110
- prefix={<LockOutlined style={{ color: '#ddd' }} />}
111
- />
112
- </Form.Item>
113
- <LoginFormFooter loading={loading}></LoginFormFooter>
114
- </Form>
115
- )
116
- }
117
- )
@@ -1,81 +0,0 @@
1
- import React, { FC, useState, useMemo, useEffect } from 'react'
2
- import { Space, Checkbox } from 'antd'
3
- import { Agreement } from '../../api'
4
- import './style.less'
5
- import { getClassnames } from '../../../_utils'
6
-
7
- export interface AgreementsProps {
8
- value?: boolean
9
- onChange?: (value: boolean) => void
10
- style?: React.CSSProperties
11
- agreements: Agreement[]
12
- showError?: boolean
13
- }
14
-
15
- export const Agreements: FC<AgreementsProps> = ({
16
- showError,
17
- onChange = () => {},
18
- style,
19
- agreements,
20
- }) => {
21
- const [acceptList, setAcceptList] = useState<(string | number)[]>([])
22
-
23
- const toggleItemCheck = (id: string | number) => {
24
- setAcceptList((prev) => {
25
- if (prev.includes(id)) {
26
- return prev.filter((item) => item !== id)
27
- }
28
- return [...prev, id]
29
- })
30
- }
31
-
32
- /** 是否可以注册 */
33
- const isAccept = useMemo(() => {
34
- /** 所有必须勾选的都勾了就可以通过 */
35
- return agreements
36
- .filter((item) => item.required)
37
- .every((item) => acceptList.includes(item.id))
38
- }, [acceptList, agreements])
39
-
40
- useEffect(() => {
41
- onChange(isAccept)
42
- }, [isAccept, onChange])
43
-
44
- return (
45
- <div
46
- className={getClassnames([
47
- 'authing-agreements',
48
- showError && 'authing-agreements-error',
49
- ])}
50
- >
51
- {agreements.map((item) => {
52
- return (
53
- <div
54
- key={item.id}
55
- style={{ ...style }}
56
- className={getClassnames([
57
- 'authing-agreements-item',
58
- item.required &&
59
- !acceptList.includes(item.id) &&
60
- 'authing-agreements-item-invalid',
61
- ])}
62
- onClick={() => toggleItemCheck(item.id)}
63
- >
64
- <Space align="start" size={5}>
65
- <Checkbox
66
- className="authing-agreements-checkbox"
67
- checked={acceptList.includes(item.id)}
68
- />
69
- <div
70
- className="authing-agreements-item-content"
71
- dangerouslySetInnerHTML={{
72
- __html: item.title,
73
- }}
74
- ></div>
75
- </Space>
76
- </div>
77
- )
78
- })}
79
- </div>
80
- )
81
- }
@@ -1,44 +0,0 @@
1
- .authing-agreements {
2
- margin-top: 20px;
3
- margin-bottom: 20px;
4
- &.authing-agreements-error {
5
- .authing-agreements-item-invalid {
6
- color: #ff4d4f;
7
- a {
8
- color: #ff4d4f;
9
- }
10
- :global(.ant-checkbox-inner) {
11
- border-color: #ff4d4f;
12
- }
13
- }
14
- }
15
- }
16
-
17
- .authing-agreements-item {
18
- color: #999999;
19
- user-select: none;
20
- cursor: pointer;
21
- font-size: 12px;
22
- &:not(:first-child) {
23
- margin-top: 4px;
24
- }
25
- p {
26
- margin-bottom: 0;
27
- display: inline-block;
28
- }
29
- }
30
-
31
- .authing-agreements-checkbox {
32
- margin-bottom: 2px;
33
- :global(.ant-checkbox-inner) {
34
- width: 14px;
35
- height: 14px;
36
- &::after {
37
- left: 20%;
38
- }
39
- }
40
- }
41
-
42
- .authing-agreements-item-content {
43
- line-height: 23px;
44
- }
@@ -1,139 +0,0 @@
1
- import { Button, Form, Input, message, Spin } from 'antd'
2
- import { useForm } from 'antd/lib/form/Form'
3
- import React, { FC, useEffect, useState } from 'react'
4
- import { useGuardContext } from '../../../context/global/context'
5
- import { User } from 'authing-js-sdk'
6
- import { UploadImage } from '../UploadImage'
7
- import { requestClient } from '../../../_utils/http'
8
- import { CompleteUserInfoFormProps } from '../../types'
9
- import { useTranslation } from 'react-i18next'
10
- import { i18n } from '../../../_utils/locales'
11
-
12
- export const CompleteUserInfoForm: FC<CompleteUserInfoFormProps> = ({
13
- onSuccess,
14
- }) => {
15
- const { t } = useTranslation()
16
- const [rawForm] = useForm()
17
- const [submitting, setSubmitting] = useState(false)
18
-
19
- const [loading, setLoading] = useState(false)
20
-
21
- const {
22
- state: { config, authClient, guardEvents, userPoolId },
23
- } = useGuardContext()
24
-
25
- const { extendsFields } = config
26
-
27
- const [, setUser] = useState<User | null>()
28
- const [definitions, setDefinitions] = useState<any[]>([])
29
-
30
- const onFinish = async (values: any) => {
31
- const internalFields: any = {}
32
- const userFields: any[] = []
33
- Object.entries(values).forEach(([key, value]) => {
34
- const [type, nameOrId] = key.split(' ')
35
- if (type === 'internal') {
36
- internalFields[nameOrId] = value
37
- } else if (type === 'user') {
38
- userFields.push({ nameOrId, value })
39
- }
40
- })
41
-
42
- const udfs = userFields.map(({ nameOrId, value }) => ({
43
- definition: definitions.find((def) => def.id === nameOrId),
44
- value,
45
- }))
46
-
47
- try {
48
- const user = await authClient.updateProfile(internalFields)
49
-
50
- setUser(user)
51
-
52
- await requestClient.post(
53
- `/api/v2/udfs/values`,
54
- {
55
- udfs,
56
- },
57
- {
58
- headers: {
59
- authorization: user?.token,
60
- 'x-authing-userpool-id': userPoolId,
61
- },
62
- }
63
- )
64
-
65
- message.success(t('common.saveSuccess'))
66
- guardEvents.onRegisterInfoCompleted?.(user, udfs, authClient)
67
- onSuccess?.(user)
68
- } catch (e) {
69
- guardEvents.onRegisterInfoCompletedError?.(e, udfs, authClient)
70
- setSubmitting(false)
71
- } finally {
72
- setSubmitting(false)
73
- }
74
- }
75
-
76
- useEffect(() => {
77
- setLoading(true)
78
- ;(async () => {
79
- const user = await authClient.getCurrentUser()
80
- setUser(user)
81
- const { data } = await requestClient.get<any>(
82
- '/api/v2/udfs/definitions',
83
- undefined,
84
- {
85
- headers: {
86
- authorization: user?.token!,
87
- 'x-authing-userpool-id': userPoolId,
88
- },
89
- }
90
- )
91
- setDefinitions(data)
92
- setLoading(false)
93
- })()
94
- }, [authClient, userPoolId])
95
-
96
- const onFinishFailed = () => {}
97
-
98
- const INPUT_MAP: Record<string, React.ReactNode | undefined> = {
99
- image: <UploadImage />,
100
- }
101
-
102
- const formFields = extendsFields.map((def) => {
103
- const key = `${def.type} ${def.type === 'internal' ? def.name : def.id}`
104
-
105
- const label = i18n.language === 'zh-CN' ? def.label : def.name
106
-
107
- return (
108
- <Form.Item key={key} name={key} label={label} style={{ marginBottom: 8 }}>
109
- {INPUT_MAP[def.inputType] || (
110
- <Input type={def.inputType} size="large" />
111
- )}
112
- </Form.Item>
113
- )
114
- })
115
-
116
- return (
117
- <Spin spinning={loading}>
118
- <Form
119
- layout="vertical"
120
- form={rawForm}
121
- onSubmitCapture={() => setSubmitting(true)}
122
- onFinishFailed={onFinishFailed}
123
- onFinish={onFinish}
124
- >
125
- {formFields}
126
-
127
- <Button
128
- size="large"
129
- loading={submitting}
130
- type="primary"
131
- block
132
- htmlType="submit"
133
- >
134
- {t('common.problem.form.submit')}
135
- </Button>
136
- </Form>
137
- </Spin>
138
- )
139
- }