@authing/react-ui-components 3.0.2-beta.3 → 3.0.2-beta.7

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 (60) hide show
  1. package/build/asset-manifest.json +18 -18
  2. package/build/index.html +1 -1
  3. package/build/static/css/2.5c23c9b8.chunk.css +3 -0
  4. package/build/static/css/2.5c23c9b8.chunk.css.map +1 -0
  5. package/build/static/css/main.6a8701e8.chunk.css +2 -0
  6. package/build/static/css/main.6a8701e8.chunk.css.map +1 -0
  7. package/build/static/js/2.142555a1.chunk.js +3 -0
  8. package/build/static/js/{2.1105ecfb.chunk.js.LICENSE.txt → 2.142555a1.chunk.js.LICENSE.txt} +0 -0
  9. package/build/static/js/2.142555a1.chunk.js.map +1 -0
  10. package/build/static/js/{3.fd17f196.chunk.js → 3.ed27e06b.chunk.js} +2 -2
  11. package/build/static/js/{3.fd17f196.chunk.js.map → 3.ed27e06b.chunk.js.map} +1 -1
  12. package/build/static/js/main.8d075e4d.chunk.js +2 -0
  13. package/build/static/js/main.8d075e4d.chunk.js.map +1 -0
  14. package/build/static/js/{runtime-main.ef138021.js → runtime-main.9a428724.js} +2 -2
  15. package/build/static/js/{runtime-main.ef138021.js.map → runtime-main.9a428724.js.map} +1 -1
  16. package/components/BindTotp/interface.ts +1 -1
  17. package/components/ChangePassword/core/firstLoginReset.tsx +14 -7
  18. package/components/ChangePassword/core/rotateReset.tsx +19 -8
  19. package/components/ChangePassword/index.tsx +21 -8
  20. package/components/CompleteInfo/interface.ts +1 -1
  21. package/components/Guard/Guard.tsx +99 -59
  22. package/components/Guard/config.ts +2 -2
  23. package/components/Guard/event.ts +2 -2
  24. package/components/Guard/stateMachine.ts +19 -0
  25. package/components/Login/codemap.ts +3 -1
  26. package/components/Login/core/withPassword/index.tsx +3 -3
  27. package/components/Login/index.tsx +6 -5
  28. package/components/Login/{props.ts → interface.ts} +0 -0
  29. package/components/Login/socialLogin/index.tsx +1 -1
  30. package/components/MFA/core/email.tsx +1 -1
  31. package/components/MFA/core/sms.tsx +1 -1
  32. package/components/MFA/core/totp.tsx +1 -1
  33. package/components/MFA/index.tsx +1 -1
  34. package/components/MFA/{props.ts → interface.ts} +0 -0
  35. package/components/MFA/mfaMethods/index.tsx +1 -1
  36. package/components/Register/index.tsx +1 -1
  37. package/components/Register/{props.ts → interface.ts} +0 -0
  38. package/components/_utils/config.ts +2 -4
  39. package/components/_utils/guradHttp.ts +4 -0
  40. package/components/_utils/index.ts +5 -1
  41. package/components/_utils/locales/en/common.json +3 -1
  42. package/components/_utils/locales/zh/common.json +3 -1
  43. package/components/_utils/locales/zh/user.json +1 -0
  44. package/components/index.ts +4 -7
  45. package/examples.tsx +35 -35
  46. package/package.json +1 -1
  47. package/.vscode/settings.json +0 -31
  48. package/build/static/css/2.9512539b.chunk.css +0 -3
  49. package/build/static/css/2.9512539b.chunk.css.map +0 -1
  50. package/build/static/css/main.0ff9e24a.chunk.css +0 -2
  51. package/build/static/css/main.0ff9e24a.chunk.css.map +0 -1
  52. package/build/static/js/2.1105ecfb.chunk.js +0 -3
  53. package/build/static/js/2.1105ecfb.chunk.js.map +0 -1
  54. package/build/static/js/main.a47645ff.chunk.js +0 -2
  55. package/build/static/js/main.a47645ff.chunk.js.map +0 -1
  56. package/lib/index.d.ts +0 -2278
  57. package/lib/index.min.css +0 -2
  58. package/lib/index.min.js +0 -2
  59. package/lib/index.min.js.LICENSE.txt +0 -69
  60. package/lib/static/media/loading.4a67a5f3.svg +0 -29
@@ -1,2 +1,2 @@
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:"fd17f196"}[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.ef138021.js.map
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 +1 @@
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","oe","err","console","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,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021.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\":\"fd17f196\"}[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
+ {"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","oe","err","console","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BX,EAAgBY,KAAcF,GAAY,GAE3C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AOF,GAIR3D,EAAoB+D,EAAI,SAAS1D,GAChC,IAAI0C,EAAS1C,GAAUA,EAAOqD,WAC7B,WAAwB,OAAOrD,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAL,EAAoB8C,EAAEC,EAAQ,IAAKA,GAC5BA,GAIR/C,EAAoBgD,EAAI,SAASgB,EAAQC,GAAY,OAAOnF,OAAOC,UAAUC,eAAeC,KAAK+E,EAAQC,IAGzGjE,EAAoBuB,EAAI,IAGxBvB,EAAoBkE,GAAK,SAASC,GAA2B,MAApBC,QAAQ3C,MAAM0C,GAAYA,GAEnE,IAAIE,EAAaC,KAAK,4CAA8CA,KAAK,6CAA+C,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,6 +1,6 @@
1
1
  import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
2
2
  import { AuthenticationClient, User } from '..'
3
- import { GuardMFAInitData } from '../MFA/props'
3
+ import { GuardMFAInitData } from '../MFA/interface'
4
4
 
5
5
  export interface BindTotpConfig extends IG2Config {}
6
6
 
@@ -1,6 +1,6 @@
1
1
  import React, { useRef } from 'react'
2
2
  import { useTranslation } from 'react-i18next'
3
- import { Form, Input } from 'antd'
3
+ import { Form, Input, message } from 'antd'
4
4
 
5
5
  import { LockOutlined } from '@ant-design/icons'
6
6
 
@@ -21,12 +21,19 @@ export const FirstLoginReset = (props: FirstLoginResetProps) => {
21
21
 
22
22
  const onFinish = async (values: any) => {
23
23
  let newPassword = values.password
24
- // let newPassword2 = values.password2
25
- let res = await client.resetPasswordByFirstLoginToken({
26
- token: props.initData.token,
27
- password: newPassword,
28
- })
29
- props.onReset(res)
24
+ submitButtonRef.current?.onSpin(false)
25
+ try {
26
+ let res = await client.resetPasswordByFirstLoginToken({
27
+ token: props.initData.token,
28
+ password: newPassword,
29
+ })
30
+ props.onReset(res)
31
+ } catch (error) {
32
+ message.error(error.message)
33
+ submitButtonRef?.current?.onError()
34
+ } finally {
35
+ submitButtonRef.current?.onSpin(false)
36
+ }
30
37
  }
31
38
 
32
39
  return (
@@ -1,11 +1,12 @@
1
1
  import React, { useRef } from 'react'
2
2
  import { useTranslation } from 'react-i18next'
3
- import { Form, Input } from 'antd'
3
+ import { Form, Input, message } from 'antd'
4
4
 
5
5
  import { LockOutlined } from '@ant-design/icons'
6
6
 
7
7
  import { getPasswordValidate } from '../../_utils'
8
8
  import SubmitButton from '../../SubmitButton'
9
+ import { useAuthClient } from '../../Guard/authClient'
9
10
 
10
11
  interface RotateResetProps {
11
12
  onReset: any
@@ -16,16 +17,26 @@ interface RotateResetProps {
16
17
  export const RotateReset = (props: RotateResetProps) => {
17
18
  const { t } = useTranslation()
18
19
  let [form] = Form.useForm()
19
- // let client = useAuthClient()
20
+ let authClient = useAuthClient()
20
21
  let submitButtonRef = useRef<any>(null)
21
22
 
22
23
  const onFinish = async (values: any) => {
23
- // let newPassword = values.password
24
- // let res = await client.resetPasswordByFirstLoginToken({
25
- // token: props.initData.token,
26
- // password: newPassword,
27
- // })
28
- // props.onReset(res)
24
+ let { password, oldPassword } = values
25
+ submitButtonRef?.current?.onSpin(true)
26
+
27
+ try {
28
+ let res = await authClient.resetPasswordByForceResetToken({
29
+ token: props.initData.token,
30
+ newPassword: password,
31
+ oldPassword: oldPassword,
32
+ })
33
+ props.onReset(res)
34
+ } catch (error) {
35
+ message.error(error.message)
36
+ submitButtonRef?.current?.onError()
37
+ } finally {
38
+ submitButtonRef?.current?.onSpin(false)
39
+ }
29
40
  }
30
41
 
31
42
  return (
@@ -1,4 +1,5 @@
1
- import React from 'react'
1
+ import React, { useMemo } from 'react'
2
+ import { useTranslation } from 'react-i18next'
2
3
  import { GuardModuleType } from '../Guard/module'
3
4
  import { ImagePro } from '../ImagePro'
4
5
  import { FirstLoginReset } from './core/firstLoginReset'
@@ -9,9 +10,7 @@ import { RotateReset } from './core/rotateReset'
9
10
  export const GuardChangePassword = (props: any) => {
10
11
  let { initData, config } = props
11
12
  let publicConfig = config.__publicConfig__
12
- // let [resetType] = useState<'inital' | 'rotate'>(initData.type) //
13
- // console.log('******', initData.type)
14
- // let publicConfig = props.config.__publicConfig__
13
+ const { t } = useTranslation()
15
14
 
16
15
  const onReset = (res: any) => {
17
16
  let code = res.code
@@ -23,6 +22,22 @@ export const GuardChangePassword = (props: any) => {
23
22
  }
24
23
  }
25
24
 
25
+ const typeContent = useMemo(() => {
26
+ if (initData.type === 'inital') {
27
+ return {
28
+ title: `${t('common.welcome')} ${config.title}`,
29
+ explain: t('common.initPasswordText'),
30
+ }
31
+ } else {
32
+ return {
33
+ title: t('user.modifyPwd'),
34
+ explain: t('user.modifyPwdText', {
35
+ number: 1,
36
+ }),
37
+ }
38
+ }
39
+ }, [config.title, initData.type, t])
40
+
26
41
  return (
27
42
  <div className="g2-view-container">
28
43
  <div className="g2-view-header">
@@ -33,10 +48,8 @@ export const GuardChangePassword = (props: any) => {
33
48
  alt=""
34
49
  className="icon"
35
50
  />
36
- <div className="title">欢迎访问 {config.title}</div>
37
- <div className="title-explain">
38
- 你的密码连续使用超过 xxx,可能存在风险。请重新设置密码。
39
- </div>
51
+ <div className="title">{typeContent.title}</div>
52
+ <div className="title-explain">{typeContent.explain}</div>
40
53
  </div>
41
54
  <div className="g2-view-tabs">
42
55
  {initData.type === 'inital' && (
@@ -7,7 +7,7 @@ const defaultConfig: CompleteInfoConfig = {
7
7
  ...getDefaultG2Config(),
8
8
  }
9
9
 
10
- export const getDefaultLoginConfig = (): CompleteInfoConfig => ({
10
+ export const getDefaultCompleteInfoConfig = (): CompleteInfoConfig => ({
11
11
  ...getDefaultG2Config(),
12
12
  ...defaultConfig,
13
13
  })
@@ -13,7 +13,7 @@ import { initAuthClient } from './authClient'
13
13
  import { GuardEvents, guardEventsFilter } from './event'
14
14
  import { initConfig } from '../_utils/config'
15
15
  import { insertStyles } from '../_utils'
16
- import { initGuardHttp } from '../_utils/guradHttp'
16
+ import { getGuardHttp, GuardHttp, initGuardHttp } from '../_utils/guradHttp'
17
17
  import { initI18n } from '..//_utils/locales'
18
18
  import { IG2FCProps } from '../Type'
19
19
  import { getDefaultGuardLocalConfig, GuardLocalConfig } from './config'
@@ -22,7 +22,11 @@ import { GuardModuleType } from './module'
22
22
  import { GuardMFAView } from '../MFA'
23
23
  import { GuardRegisterView } from '../Register'
24
24
  import { GuardDownloadATView } from '../DownloadAuthenticator'
25
- import { GuardStateMachine, useHistoryHijack } from './stateMachine'
25
+ import {
26
+ GuardStateMachine,
27
+ initGuardStateMachine,
28
+ useHistoryHijack,
29
+ } from './stateMachine'
26
30
  import { GuardBindTotpView } from '../BindTotp'
27
31
  import { GuardForgetPassword } from '../ForgetPassword'
28
32
  import { GuardChangePassword } from '../ChangePassword'
@@ -32,7 +36,7 @@ import { GuardRecoveryCodeView } from '../RecoveryCode'
32
36
  import './styles.less'
33
37
  import { IconFont } from '../AuthingGuard/IconFont'
34
38
  import { GuardErrorView } from '../Error'
35
- import { GuardMode } from '..'
39
+ import { AuthenticationClient, GuardMode } from '..'
36
40
  import { GuardSubmitSuccessView } from '../SubmitSuccess'
37
41
 
38
42
  const PREFIX_CLS = 'authing-ant'
@@ -65,6 +69,12 @@ const ComponentsMapping: Record<
65
69
  ),
66
70
  }
67
71
 
72
+ // 首页 init 数据
73
+ const initState: ModuleState = {
74
+ moduleName: GuardModuleType.LOGIN,
75
+ initData: {},
76
+ }
77
+
68
78
  export interface GuardProps extends GuardEvents, IG2FCProps {
69
79
  tenantId?: string
70
80
  config?: Partial<GuardLocalConfig>
@@ -88,19 +98,19 @@ interface ModuleState {
88
98
 
89
99
  export const Guard = (props: GuardProps) => {
90
100
  const { appId, tenantId, config } = props
91
- // 整合一下 所有的事件
92
- const events = guardEventsFilter(props)
93
101
 
94
102
  // 初始化 Loading 标识
95
103
  const [initSettingEnd, setInitSettingEnd] = useState(false)
96
104
 
97
105
  const [initError, setInitError] = useState(false)
98
- const [errorMessage, setErrorMessage] = useState('')
106
+ const [errorData, setErrorData] = useState<any>()
99
107
 
100
108
  // Config
101
- const [GuardLocalConfig, setGuardLocalConfig] = useState<GuardLocalConfig>(
102
- getDefaultGuardLocalConfig()
103
- )
109
+ const [GuardLocalConfig, setGuardLocalConfig] = useState<GuardLocalConfig>()
110
+
111
+ const [events, setEvents] = useState<GuardEvents>()
112
+ const [authClint, setAuthClint] = useState<AuthenticationClient>()
113
+ const [httpClint, setHttpClint] = useState<GuardHttp>()
104
114
 
105
115
  // 状态机
106
116
  const [
@@ -111,12 +121,6 @@ export const Guard = (props: GuardProps) => {
111
121
  // 劫持浏览器 History
112
122
  const [historyNext] = useHistoryHijack(guardStateMachine?.back)
113
123
 
114
- // 首页 init 数据
115
- const initState: ModuleState = {
116
- moduleName: GuardModuleType.LOGIN,
117
- initData: {},
118
- }
119
-
120
124
  // modules 定义
121
125
  const moduleReducer: (
122
126
  state: ModuleState,
@@ -141,16 +145,59 @@ export const Guard = (props: GuardProps) => {
141
145
  })
142
146
  }
143
147
 
144
- // 初始化 Guard 一系列的东西
145
- const initGuardSetting = useCallback(async () => {
146
- try {
147
- // Rest 初始化
148
- const httpClient = initGuardHttp(
149
- config?.host ?? getDefaultGuardLocalConfig().host
150
- )
151
- httpClient.setAppId(appId)
152
- tenantId && httpClient.setTenantId(tenantId)
148
+ // HttpClint
149
+ useEffect(() => {
150
+ if (!appId) return
151
+
152
+ const httpClient = initGuardHttp(
153
+ config?.host ?? getDefaultGuardLocalConfig().host
154
+ )
155
+ httpClient.setAppId(appId)
156
+ tenantId && httpClient.setTenantId(tenantId)
157
+ setHttpClint(httpClient)
158
+ }, [appId, config?.host, tenantId])
159
+
160
+ useEffect(() => {
161
+ if (httpClint && GuardLocalConfig && GuardLocalConfig.__appHost__) {
162
+ httpClint?.setBaseUrl(GuardLocalConfig.__appHost__)
163
+ }
164
+ }, [GuardLocalConfig, httpClint])
165
+
166
+ // I18n
167
+ useEffect(() => {
168
+ // TODO 国际化 这部分有点小问题 等待优化
169
+ initI18n({}, config?.lang)
170
+ }, [config?.lang])
171
+
172
+ // AuthClient
173
+ useEffect(() => {
174
+ if (appId && GuardLocalConfig) {
175
+ const authClint = initAuthClient(GuardLocalConfig, appId, tenantId)
176
+ setAuthClint(authClint)
177
+ }
178
+ }, [GuardLocalConfig, appId, tenantId])
179
+
180
+ // initEvents
181
+ useEffect(() => {
182
+ const events = guardEventsFilter(props)
183
+ setEvents(events)
184
+ }, [props])
185
+
186
+ // 状态机相关
187
+ useEffect(() => {
188
+ const guardStateMachine = initGuardStateMachine(onChangeModule, initState)
189
+ setGuardStateMachine(guardStateMachine)
190
+ }, [])
191
+
192
+ // 设置 config
193
+ useEffect(() => {
194
+ if (guardStateMachine && GuardLocalConfig)
195
+ guardStateMachine.setConfig(GuardLocalConfig)
196
+ }, [GuardLocalConfig, guardStateMachine])
153
197
 
198
+ const initPublicConfig = useCallback(async () => {
199
+ if (!config && !appId) return
200
+ try {
154
201
  // Config 初始化
155
202
  const { config: mergedConfig, publicConfig } = await initConfig(
156
203
  appId,
@@ -158,48 +205,41 @@ export const Guard = (props: GuardProps) => {
158
205
  getDefaultGuardLocalConfig()
159
206
  )
160
207
 
161
- httpClient.setUserpoolId(publicConfig.userPoolId)
162
208
  setGuardLocalConfig(mergedConfig)
163
209
 
164
- // TODO 国际化 这部分有点小问题 等待优化
165
- initI18n({}, mergedConfig.lang)
166
-
167
- // Authing JS SDK
168
- const authClient = initAuthClient(mergedConfig, appId, tenantId)
169
-
170
- events?.onLoad?.(authClient)
171
-
172
- // 状态机 初始化
173
- const guardStateMachine = new GuardStateMachine(onChangeModule, initState)
174
- guardStateMachine.setConfig(mergedConfig)
175
- setGuardStateMachine(guardStateMachine)
210
+ getGuardHttp().setUserpoolId(publicConfig.userPoolId)
176
211
  } catch (error: any) {
177
- events?.onLoadError?.(error)
178
-
179
- setErrorMessage(error.message)
212
+ setErrorData(error)
180
213
  setInitError(true)
181
-
182
- console.error(error)
183
214
  } finally {
184
215
  // 初始化 结束
185
216
  setInitSettingEnd(true)
186
217
  }
187
- // eslint-disable-next-line react-hooks/exhaustive-deps
188
- }, [])
218
+ }, [appId, config])
219
+
220
+ useEffect(() => {
221
+ initPublicConfig()
222
+ }, [initPublicConfig])
189
223
 
190
224
  useEffect(() => {
191
- initGuardSetting()
192
- console.log('useEffect')
193
- }, [initGuardSetting])
225
+ if (GuardLocalConfig && GuardLocalConfig.contentCss)
226
+ insertStyles(GuardLocalConfig.contentCss)
227
+ }, [GuardLocalConfig])
194
228
 
195
229
  useEffect(() => {
196
- insertStyles(GuardLocalConfig.contentCss)
197
- }, [GuardLocalConfig.contentCss])
230
+ if (GuardLocalConfig && authClint) events?.onLoad?.(authClint)
231
+ }, [GuardLocalConfig, authClint, events])
232
+
233
+ useEffect(() => {
234
+ if (initError) {
235
+ events?.onLoadError?.(errorData)
236
+ }
237
+ }, [errorData, events, initError])
198
238
 
199
239
  const renderModule = useMemo(() => {
200
- if (initSettingEnd) {
201
- if (initError)
202
- return <GuardErrorView initData={{ messages: errorMessage }} />
240
+ if (initError)
241
+ return <GuardErrorView initData={{ messages: errorData?.message }} />
242
+ if (initSettingEnd && GuardLocalConfig) {
203
243
  return ComponentsMapping[moduleState.moduleName]({
204
244
  appId,
205
245
  initData: moduleState.initData,
@@ -218,16 +258,16 @@ export const Guard = (props: GuardProps) => {
218
258
  )
219
259
  }
220
260
  }, [
221
- appId,
222
- errorMessage,
223
- events,
261
+ initSettingEnd,
224
262
  GuardLocalConfig,
225
- guardStateMachine,
226
- historyNext,
227
263
  initError,
228
- initSettingEnd,
229
- moduleState.initData,
264
+ errorData?.message,
230
265
  moduleState.moduleName,
266
+ moduleState.initData,
267
+ appId,
268
+ events,
269
+ historyNext,
270
+ guardStateMachine,
231
271
  ])
232
272
 
233
273
  return (
@@ -1,5 +1,5 @@
1
- import { getDefaultLoginConfig, LoginConfig } from '../Login/props'
2
- import { getDefaultRegisterConfig, RegisterConfig } from '../Register/props'
1
+ import { getDefaultLoginConfig, LoginConfig } from '../Login/interface'
2
+ import { getDefaultRegisterConfig, RegisterConfig } from '../Register/interface'
3
3
 
4
4
  export interface GuardComponentConifg extends Partial<GuardLocalConfig> {}
5
5
 
@@ -1,8 +1,8 @@
1
1
  import { message } from 'antd'
2
2
  import { CompleteInfoEvents } from '../CompleteInfo/interface'
3
3
  import { ForgetPasswordEvents } from '../ForgetPassword/interface'
4
- import { LoginEvents } from '../Login/props'
5
- import { RegisterEvents } from '../Register/props'
4
+ import { LoginEvents } from '../Login/interface'
5
+ import { RegisterEvents } from '../Register/interface'
6
6
  import { i18n } from '../_utils/locales'
7
7
 
8
8
  export interface GuardEvents
@@ -24,6 +24,9 @@ export type ChangeModuleEvent = (
24
24
  nextModelu: GuardModuleType,
25
25
  initData?: any
26
26
  ) => void
27
+
28
+ let guardStateMachine: GuardStateMachine
29
+
27
30
  export class GuardStateMachine {
28
31
  // 计数器
29
32
  private order: number = 0
@@ -131,3 +134,19 @@ export const useHistoryHijack = (back?: () => void) => {
131
134
 
132
135
  return [next]
133
136
  }
137
+
138
+ export const initGuardStateMachine = (
139
+ changeMouleEvent: ChangeModuleEvent,
140
+ initData: ModuleState
141
+ ) => {
142
+ guardStateMachine = new GuardStateMachine(changeMouleEvent, initData)
143
+ return guardStateMachine
144
+ }
145
+
146
+ export const getGuardStateMachine = () => {
147
+ if (!guardStateMachine) throw new Error('Please initialize GuardStateMachine')
148
+
149
+ return guardStateMachine
150
+ }
151
+
152
+ export const useGuardStateMachine = () => getGuardStateMachine()
@@ -11,7 +11,9 @@ export const codeMap: Record<number, GuardModuleAction> = {
11
11
  // 需要输入图形验证码
12
12
  action: 'message',
13
13
  },
14
-
14
+ 500: {
15
+ action: 'message',
16
+ },
15
17
  1639: {
16
18
  // 首次登陆,跳转去修改密码
17
19
  action: 'changeModule',
@@ -45,7 +45,7 @@ export const LoginWithPassword = (props: LoginWithPasswordProps) => {
45
45
  const onFinish = async (values: any) => {
46
46
  setRemainCount(0)
47
47
  // onBeforeLogin
48
- submitButtonRef.current.onSpin(true)
48
+ submitButtonRef?.current.onSpin(true)
49
49
  let loginInfo = {
50
50
  type: LoginMethods.Password,
51
51
  data: {
@@ -56,7 +56,7 @@ export const LoginWithPassword = (props: LoginWithPasswordProps) => {
56
56
  }
57
57
  let context = await props.onBeforeLogin(loginInfo)
58
58
  if (!context) {
59
- submitButtonRef.current.onSpin(false)
59
+ submitButtonRef?.current.onSpin(false)
60
60
  return
61
61
  }
62
62
 
@@ -88,7 +88,7 @@ export const LoginWithPassword = (props: LoginWithPasswordProps) => {
88
88
  setRemainCount((data as any)?.remainCount ?? 0)
89
89
  }
90
90
  }
91
- submitButtonRef.current.onSpin(false)
91
+ submitButtonRef?.current.onSpin(false)
92
92
  props.onLogin(code, data, message)
93
93
  }
94
94
 
@@ -12,7 +12,7 @@ import { LoginWithWechatMiniQrcode } from './core/withWechatMiniQrcode'
12
12
  import { LoginWithWechatmpQrcode } from './core/withWechatmpQrcode'
13
13
  import { codeMap } from './codemap'
14
14
  import { SocialLogin } from './socialLogin'
15
- import { GuardLoginViewProps } from './props'
15
+ import { GuardLoginViewProps } from './interface'
16
16
 
17
17
  import { useAuthClient } from '../Guard/authClient'
18
18
  import { GuardModuleType } from '../Guard/module'
@@ -107,7 +107,7 @@ export const GuardLoginView = (props: GuardLoginViewProps) => {
107
107
 
108
108
  if (!action) {
109
109
  return (initData?: any) => {
110
- initData?.__messag && message.error(initData?.__messag)
110
+ initData?._messag && message.error(initData?._messag)
111
111
  console.error('未捕获 code', code)
112
112
  }
113
113
  }
@@ -121,14 +121,15 @@ export const GuardLoginView = (props: GuardLoginViewProps) => {
121
121
  }
122
122
  if (action?.action === 'message') {
123
123
  return (initData?: any) => {
124
- message.error(initData?.__message)
124
+ message.error(initData?._message)
125
125
  }
126
126
  }
127
127
 
128
128
  // 最终结果
129
- return () => {
129
+ return (initData?: any) => {
130
130
  // props.onLoginError?.(data, client!) // 未捕获 code
131
131
  console.error('last action at loginview')
132
+ message.error(initData?._message)
132
133
  }
133
134
  }
134
135
 
@@ -144,7 +145,7 @@ export const GuardLoginView = (props: GuardLoginViewProps) => {
144
145
  if (!data) {
145
146
  data = {}
146
147
  }
147
- data.__message = message
148
+ data._message = message
148
149
  callback?.(data)
149
150
  }
150
151
 
File without changes
@@ -26,7 +26,7 @@ import {
26
26
  import { useScreenSize } from '../../AuthingGuard/hooks/useScreenSize'
27
27
  import { useAuthClient } from '../../Guard/authClient'
28
28
  import { IconFont } from '../../IconFont'
29
- import { LoginConfig } from '../props'
29
+ import { LoginConfig } from '../interface'
30
30
  import './style.less'
31
31
 
32
32
  export interface SocialLoginProps {
@@ -9,7 +9,7 @@ import { useAuthClient } from '../../Guard/authClient'
9
9
  import { SendCodeBtn } from '../../SendCode/SendCodeBtn'
10
10
  import SubmitButton from '../../SubmitButton'
11
11
  import { EmailFormItem, ICheckProps } from '../../ValidatorRules'
12
- import { MFAConfig } from '../props'
12
+ import { MFAConfig } from '../interface'
13
13
  import { VerifyCodeFormItem } from '../VerifyCodeInput/VerifyCodeFormItem'
14
14
 
15
15
  interface BindMFAEmailProps {
@@ -10,7 +10,7 @@ import { SendCodeBtn } from '../../SendCode/SendCodeBtn'
10
10
  import SubmitButton from '../../SubmitButton'
11
11
  import { ICheckProps, PhoneFormItem } from '../../ValidatorRules'
12
12
  import { VerifyCodeFormItem } from '../VerifyCodeInput/VerifyCodeFormItem'
13
- import { MFAConfig } from '../props'
13
+ import { MFAConfig } from '../interface'
14
14
  import { InputNumber } from '../../InputNumber'
15
15
  export interface BindMFASmsProps {
16
16
  mfaToken: string