@authing/guard-shim-react18 4.5.33-alpha.0 → 4.5.33-alpha.1

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.
package/dist/guard.min.js CHANGED
@@ -17752,7 +17752,7 @@ var $D=i(4232),HD=i(4631),WD=i(1062),GD=i(8787),KD={zhCN:$D/* default */.Z,enUS:
17752
17752
  * 多账号 状态
17753
17753
  */
17754
17754
  multipleInstance:{isMultipleAccount:!1,instance:void 0,referMultipleState:void 0,multipleAccountData:void 0,clearBackFillData:void 0},phoneRegex:null,defaultLanguageConfig:"zh-CN",tenantInstance:void 0,isSpecialBrowser:!1},nL=y().createContext(tL),rL=y().createContext({spin:!1,spinChange:function(){}}),oL=function(){return XD(rL)},iL=function(){return XD(nL).publicConfig},aL=function(){return XD(nL).httpClient},sL=function(){return XD(nL).isSpecialBrowser},cL=function(){return XD(nL).appId},lL=function(){return XD(nL).tenantId};function uL(){return XD(nL).initData}var dL=function(){return XD(nL).currentModule},fL=function(){return XD(nL).events},pL=function(){var e=XD(nL);return{changeModule:e.changeModule,backModule:e.backModule,currentModule:e.currentModule}},hL=function(){return XD(nL).finallyConfig},mL=function(){return XD(nL).isAuthFlow},vL=function(){return XD(nL).multipleInstance},gL=function(){return XD(nL).phoneRegex},yL=function(){return XD(nL).defaultLanguageConfig},bL=function(){var e=iL(),t=e.customSecurityEnabled,n=e.appRobotVerify,r=e.userpoolRobotVerify;return t?n:r},wL=function(e){var t,n,r=iL(),o=r.loginSmsConfig,i=r.registerSmsConfig,a=!1;switch(e){case"login":a="ON"===(null===(t=null==o?void 0:o.robot)||void 0===t?void 0:t.switch);break;case"register":a="ON"===(null===(n=null==i?void 0:i.robot)||void 0===n?void 0:n.switch)}return a},CL=y().useMemo,EL={"zh-CN":{label:"简体中文"},"zh-TW":{label:"繁體中文"},"en-US":{label:"English"},"ja-JP":{label:"日本語"}},kL=function(e){var t=e.langRange,n=void 0===t?["zh-CN","zh-TW","en-US","ja-JP"]:t,r=e.onLangChange,o=Pu().i18n,i=XD(nL).guardPageConfig,a=hL(),s=CL((function(){return"g2-change-language-text ".concat(a.mode)}),[a]),c=CL((function(){var e;return null===(e=i.global)||void 0===e?void 0:e.showChangeLanguage}),[i]),l=CL((function(){return Object.keys(EL).includes(o.resolvedLanguage)?o.resolvedLanguage:ud(o.resolvedLanguage)[0]||"en-US"}),[o.resolvedLanguage]),u=CL((function(){return y().createElement(y().Fragment,null,y().createElement("span",null,EL[l].label))}),[l]),d=CL((function(){return Object.keys(EL).filter((function(e){return n.includes(e)})).map((function(e){return{key:e,label:EL[e].label}}))}),[n]);if(!c||0===n.length)return null;var f={items:d,onClick:function(e){l!==e.key&&(o.changeLanguage(e.key),null==r||r(e.key))}};return y().createElement("div",{className:"g2-change-language-container"},y().createElement(C_,{menu:f,trigger:["click"],placement:"bottom",overlayClassName:"authing-g2-change-language-menu"},y().createElement("span",{className:s},u,y().createElement(JD,{type:"authing-arrow-down-s-fill",className:"down-fill-svg"}))))};// CONCATENATED MODULE: ./package.json
17755
- const SL=JSON.parse('{"i8":"4.5.33-alpha.0"}');// CONCATENATED MODULE: ./src/_utils/getVersion.ts
17755
+ const SL=JSON.parse('{"i8":"4.5.33-alpha.1"}');// CONCATENATED MODULE: ./src/_utils/getVersion.ts
17756
17756
  function xL(){return SL.i8}// CONCATENATED MODULE: ./src/_utils/flowHandleStorage.ts
17757
17757
  var PL,_L=function(){return PL},TL=function(e){PL=e},OL=function(){return OL=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},OL.apply(this,arguments)},NL=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},IL=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},AL=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},RL=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},ML=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return NL(void 0,void 0,void 0,(function(){return IL(this,(function(t){switch(t.label){case 0:return[4/*yield*/,fetch.apply(void 0,RL([],AL(e),!1))];case 1:return[2/*return*/,t.sent().json()]}}))}))},DL=function(e){return new Promise((function(t){setTimeout((function(){t({data:{code:-1}}),e()}),1e4)}))};ML.get=function(e,t,n){return void 0===t&&(t={}),NL(void 0,void 0,void 0,(function(){var r,o,i,a,s;return IL(this,(function(c){switch(c.label){case 0:r=OL(OL({},null==n?void 0:n.headers),((s={"Content-Type":"application/json"})[ML.langHeader]=pX(),s)),""!==ML.tenantId&&(r[ML.tenantHeader]=ML.tenantId),c.label=1;case 1:return c.trys.push([1,3,,4]),o=ha().CancelToken,i=o.source(),[4/*yield*/,Promise.race([DL(i.cancel),ha()("".concat(ML.baseUrl).concat(e).concat(Fc().stringify(t,{addQueryPrefix:!0})),OL(OL({method:"GET"},n),{withCredentials:!0,headers:r,cancelToken:i.token}))])];case 2:return[2/*return*/,null==(a=c.sent())?void 0:a.data];case 3:return c.sent(),[2/*return*/,Promise.resolve({code:-2})];case 4:return[2/*return*/]}}))}))},ML.post=function(e,t,n){return NL(void 0,void 0,void 0,(function(){var r,o,i,a,s,c;return IL(this,(function(l){switch(l.label){case 0:r=OL(OL({},null==n?void 0:n.headers),((s={"Content-Type":"application/json"})[ML.langHeader]=su.resolvedLanguage,s)),""!==ML.tenantId&&(r[ML.tenantHeader]=ML.tenantId),l.label=1;case 1:return l.trys.push([1,3,,4]),o=ha().CancelToken,i=o.source(),[4/*yield*/,Promise.race([DL(i.cancel),ha()("".concat(ML.baseUrl).concat(e),{data:t,method:"POST",withCredentials:!0,cancelToken:i.token,headers:OL(OL({"Content-Type":"application/json"},null==n?void 0:n.headers),(c={},c[ML.langHeader]=pX(),c))})])];case 2:return[2/*return*/,null==(a=l.sent())?void 0:a.data];case 3:return l.sent(),[2/*return*/,Promise.resolve({code:-2})];case 4:return[2/*return*/]}}))}))},ML.postForm=function(e,t,n){return NL(void 0,void 0,void 0,(function(){var r,o,i,a;return IL(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),r=ha().CancelToken,o=r.source(),[4/*yield*/,Promise.race([DL(o.cancel),ha()("".concat(ML.baseUrl).concat(e),{method:"POST",data:t,withCredentials:!0,cancelToken:o.token,headers:OL(OL({},null==n?void 0:n.headers),(a={},a[ML.langHeader]=pX(),a))})])];case 1:return[2/*return*/,null==(i=s.sent())?void 0:i.data];case 2:return s.sent(),[2/*return*/,Promise.resolve({code:-2})];case 3:return[2/*return*/]}}))}))},ML.baseUrl="",ML.setBaseUrl=function(e){ML.baseUrl=e.replace(/\/$/,"")};var LL,FL="x-authing-lang";ML.langHeader=FL,ML.tenantHeader="x-authing-app-tenant-idåå",ML.tenantId="",ML.setLangHeader=function(e){ML.langHeader=e||FL},ML.setTenantHeader=function(e){ML.tenantHeader=e||FL},ML.setTenantId=function(e){ML.tenantId=e},function(e){e.ERROR="error",e.LOGIN="login",e.REGISTER="register",e.MFA="mfa",e.FORGET_PWD="forgetPassword",e.FORCED_PASSWORD_RESET="forcedPasswordReset",e.NOTICE_PASSWORD_RESET="noticePasswordReset",e.FIRST_LOGIN_PASSWORD="firstLoginPassword",e.UNSAFE_PASSWORD_RESET="unsafePasswordReset",e.DOWNLOAD_AT="downloadAT",e.BIND_TOTP="bindTotp",e.ANY_QUESTIONS="anyQuestions",e.LOGIN_COMPLETE_INFO="loginCompleteInfo",e.REGISTER_PASSWORD="registerPassword",e.REGISTER_COMPLETE_INFO="registerCompleteInfo",e.RECOVERY_CODE="recoveryCode",e.SUBMIT_SUCCESS="submitSuccess",e.IDENTITY_BINDING_ASK="identityBindingAsk",e.IDENTITY_BINDING="identityBinding",e.IDENTITY_BINDING_NO_ASK="identityBindingNoAsk",e.SELF_UNLOCK="selfUnlock",e.FLOW_SELECT_ACCOUNT="flowSelectAccount",
17758
17758
  /** 多租户门户选择页 */
@@ -18642,70 +18642,70 @@ if("authing"===(o||{}).source){
18642
18642
  // 如果直接为 200 代表成功了
18643
18643
  if(200===i)return{code:i,data:r,onGuardHandling:void 0};
18644
18644
  // TODO 完整的登陆信息 在 message 中 以 Json 的形式返回 待优化
18645
- var a;try{a=JSON.parse(n)}catch(e){return}var s=a.code,c=a.statusCode,l=a.apiCode,d=a.message,f=a.data,p=a.flowHandle;return u({statusCode:c,apiCode:l,data:f,message:d,code:s,flowHandle:p})}}),_=CG(SG(p||C),2),T=_[0],O=_[1];yB({currentTab:T,changeTab:O});var N=function(e){var t=xz(),n=vL(),r=n.instance,o=n.referMultipleState,i=n.isMultipleAccount,a=n.multipleAccountData,s=Sz((function(n){var r=n.way,o=n.qrCodeId,i=o?r+o:r;t.current=i,e(r)}),[e]);
18645
+ var a;try{a=JSON.parse(n)}catch(e){return}var s=a.code,c=a.statusCode,l=a.apiCode,d=a.message,f=a.data,p=a.flowHandle;return u({statusCode:c,apiCode:l,data:f,message:d,code:s,flowHandle:p})}}),_=CG(SG(p||C),2),T=_[0],O=_[1],N=CG(SG("collapsed"),2),I=N[0],A=N[1];yB({currentTab:T,changeTab:O});var R=function(e){var t=xz(),n=vL(),r=n.instance,o=n.referMultipleState,i=n.isMultipleAccount,a=n.multipleAccountData,s=Sz((function(n){var r=n.way,o=n.qrCodeId,i=o?r+o:r;t.current=i,e(r)}),[e]);
18646
18646
  // 多账号实例
18647
18647
  // 没办法了 TODO: 我真的是没办法了... 只有Default方式去硬逻辑加载
18648
18648
  return(null==a?void 0:a.qrCodeId)&&(t.current=a.way+(null==a?void 0:a.qrCodeId)),Pz((function(){
18649
18649
  // 非多账号登录页面 并且存在返回值
18650
- !i&&a&&s(a)}),[i,a,s]),{isMultipleAccount:i,multipleInstance:r,referMultipleState:o,backfillData:a,defaultQrWay:t.current}}(O),I=N.defaultQrWay,A=N.backfillData,R=N.multipleInstance,M=N.isMultipleAccount,D=N.referMultipleState,L=CG(SG(!1),2),F=L[0],j=L[1],B=JL(),U=null==b?void 0:b.qrcodeTabsSettings,q=(null==b?void 0:b.socialConnections)||[],V=CG(SG(0),2),z=V[0],$=V[1],H=CG(SG(!1),2),W=H[0],G=H[1],K=xG({}),Y=XD(nL).tenantInstance,J=PG((function(){return[(null==Y?void 0:Y.isTenantConsole())&&{name:su.t("login.tenant.consoleManage")},(null==Y?void 0:Y.isTenantSSOLaunchPad())&&{name:x("login.tenant.ssoPad")}].filter(Boolean)}),[x,Y]),Q=null==h?void 0:h.publicKey,Z=null==h?void 0:h.loginMethods,X=TG.filter((function(e){return null==Z?void 0:Z.includes(e)}))[0],ee=OG.filter((function(e){return null==Z?void 0:Z.includes(e)}))[0],te=function(e){var t=e.config,n=t.disableResetPwd,r=t.disableRegister,o=e.loginWay,i=e.autoRegister;return o===Vs.PhoneCode&&(n=!0),[Vs.LDAP,Vs.AuthingOtpPush].includes(o)&&(n=!0,r=!0),o===Vs.AD&&(
18650
+ !i&&a&&s(a)}),[i,a,s]),{isMultipleAccount:i,multipleInstance:r,referMultipleState:o,backfillData:a,defaultQrWay:t.current}}(O),M=R.defaultQrWay,D=R.backfillData,L=R.multipleInstance,F=R.isMultipleAccount,j=R.referMultipleState,B=CG(SG(!1),2),U=B[0],q=B[1],V=JL(),z=null==b?void 0:b.qrcodeTabsSettings,$=(null==b?void 0:b.socialConnections)||[],H=CG(SG(0),2),W=H[0],G=H[1],K=CG(SG(!1),2),Y=K[0],J=K[1],Q=xG({}),Z=XD(nL).tenantInstance,X=PG((function(){return[(null==Z?void 0:Z.isTenantConsole())&&{name:su.t("login.tenant.consoleManage")},(null==Z?void 0:Z.isTenantSSOLaunchPad())&&{name:x("login.tenant.ssoPad")}].filter(Boolean)}),[x,Z]),ee=null==h?void 0:h.publicKey,te=null==h?void 0:h.loginMethods,ne=TG.filter((function(e){return null==te?void 0:te.includes(e)}))[0],re=OG.filter((function(e){return null==te?void 0:te.includes(e)}))[0],oe=function(e){var t=e.config,n=t.disableResetPwd,r=t.disableRegister,o=e.loginWay,i=e.autoRegister;return o===Vs.PhoneCode&&(n=!0),[Vs.LDAP,Vs.AuthingOtpPush].includes(o)&&(n=!0,r=!0),o===Vs.AD&&(
18651
18651
  // TODO P0 需求暂时先取消掉
18652
18652
  // disableResetPwd = true
18653
- r=!0),!0===i&&(r=!0),{disableResetPwd:n,disableRegister:r}}({config:h,loginWay:T,autoRegister:null==h?void 0:h.autoRegister}),ne=te.disableResetPwd,re=te.disableRegister,oe=PG((function(){var e=Z?Z.filter((function(e){return OG.includes(e)})):[];//取到扫码登录类型
18654
- return!(e.length>1)&&(!!e.includes(Vs.AppQr)||(!U||!function(e,t){return t.some((function(t){var n;return(null===(n=null==e?void 0:e[t])||void 0===n?void 0:n.length)>1}))}(U,NG)))}),[Z,U]),ie=PG((function(){var e,t;
18653
+ r=!0),!0===i&&(r=!0),{disableResetPwd:n,disableRegister:r}}({config:h,loginWay:T,autoRegister:null==h?void 0:h.autoRegister}),ie=oe.disableResetPwd,ae=oe.disableRegister,se=PG((function(){var e=te?te.filter((function(e){return OG.includes(e)})):[];//取到扫码登录类型
18654
+ return!(e.length>1)&&(!!e.includes(Vs.AppQr)||(!z||!function(e,t){return t.some((function(t){var n;return(null===(n=null==e?void 0:e[t])||void 0===n?void 0:n.length)>1}))}(z,NG)))}),[te,z]),ce=PG((function(){var e,t;
18655
18655
  // 如果存在多账号的二维码方式
18656
- if(I)return I;if(NG.includes(C)){var n=null===(t=null===(e=null==U?void 0:U[C])||void 0===e?void 0:e.find((function(e){return e.isDefault})))||void 0===t?void 0:t.id;return C+n}return C}),[I,C,U]),ae=_G((function(e,t){var n;null===(n=null==g?void 0:g.onLogin)||void 0===n||n.call(g,e,B)}),[B,g]),se=_G((function(e,t){var n;K.current=wG(wG({},K.current),((n={})[e]=fX(t),n))}),[]);
18656
+ if(M)return M;if(NG.includes(C)){var n=null===(t=null===(e=null==z?void 0:z[C])||void 0===e?void 0:e.find((function(e){return e.isDefault})))||void 0===t?void 0:t.id;return C+n}return C}),[M,C,z]),le=_G((function(e,t){var n;null===(n=null==g?void 0:g.onLogin)||void 0===n||n.call(g,e,V)}),[V,g]),ue=_G((function(e,t){var n;Q.current=wG(wG({},Q.current),((n={})[e]=fX(t),n))}),[]);
18657
18657
  // 重置用户名页面
18658
- EG((function(){f&&gC.info({content:su.t("common.resetAccount.message"),className:"g2-view-message-info"})}),[f]);var ce=_G((function(e,t,n){var r,o=hH[e];
18658
+ EG((function(){f&&gC.info({content:su.t("common.resetAccount.message"),className:"g2-view-message-info"})}),[f]);var de=_G((function(e,t,n){var r,o=hH[e];
18659
18659
  // TODO 与拦截器中 render-message 同步
18660
- "message"===(null==o?void 0:o.action)&&$(z+1),"accountLock"===(null==o?void 0:o.action)&&G(!0),null===(r=null==g?void 0:g.onLoginError)||void 0===r||r.call(g,{code:e,data:t,message:n})}),[z,g]),le=_G((function(e){var t;return(null==g?void 0:g.onBeforeLogin)?null===(t=null==g?void 0:g.onBeforeLogin)||void 0===t?void 0:t.call(g,e,B):function(){}}),[B,g]);EG((function(){OG.includes(T)?j(!0):j(!1);
18660
+ "message"===(null==o?void 0:o.action)&&G(W+1),"accountLock"===(null==o?void 0:o.action)&&J(!0),null===(r=null==g?void 0:g.onLoginError)||void 0===r||r.call(g,{code:e,data:t,message:n})}),[W,g]),fe=_G((function(e){var t;return(null==g?void 0:g.onBeforeLogin)?null===(t=null==g?void 0:g.onBeforeLogin)||void 0===t?void 0:t.call(g,e,V):function(){}}),[V,g]);EG((function(){OG.includes(T)?q(!0):q(!1);
18661
18661
  // 可以设定 = fasle 的时候关闭 qrcode 的几个定时器
18662
18662
  // 不关的话,第二次进入会更快,也没什么代价(只有轮询)
18663
- }),[T]);var ue=function(e){var t=su.t("login.scanLogin");return OG.includes(e)&&(t=su.t("login.moreWays")),{switchText:t,inputNone:TG.includes(e)?"":"none",qrcodeNone:OG.includes(e)?"":"none"}}(T),de=ue.switchText,fe=ue.inputNone,pe=ue.qrcodeNone,he=PG((function(){var e,t;return S&&null!==(t=null===(e=null==h?void 0:h.agreements)||void 0===e?void 0:e.filter((function(e){return ud(su.resolvedLanguage).find((function(t){return t.includes(e.lang)}))&&((null==h?void 0:h.autoRegister)||!!(null==e?void 0:e.availableAt))})))&&void 0!==t?t:[]}),[S,null==h?void 0:h.autoRegister,null==h?void 0:h.agreements,su.resolvedLanguage]),me=PG((function(){var e,t;return null!==(t=null===(e=null==b?void 0:b.verifyCodeTabConfig)||void 0===e?void 0:e.enabledLoginMethods)&&void 0!==t?t:["phone-code"]}),[null===(t=null==b?void 0:b.verifyCodeTabConfig)||void 0===t?void 0:t.enabledLoginMethods]),ve=CG(gj({config:h,publicConfig:b}),3),ge=ve[0],ye=ve[1],be=ve[2],we=!(null===(n=null==h?void 0:h.loginMethods)||void 0===n?void 0:n.length),Ce=mj().isPhoneMedia;
18663
+ }),[T]);var pe=function(e){var t=su.t("login.scanLogin");return OG.includes(e)&&(t=su.t("login.moreWays")),{switchText:t,inputNone:TG.includes(e)?"":"none",qrcodeNone:OG.includes(e)?"":"none"}}(T),he=pe.switchText,me=pe.inputNone,ve=pe.qrcodeNone,ge=PG((function(){var e,t;return S&&null!==(t=null===(e=null==h?void 0:h.agreements)||void 0===e?void 0:e.filter((function(e){return ud(su.resolvedLanguage).find((function(t){return t.includes(e.lang)}))&&((null==h?void 0:h.autoRegister)||!!(null==e?void 0:e.availableAt))})))&&void 0!==t?t:[]}),[S,null==h?void 0:h.autoRegister,null==h?void 0:h.agreements,su.resolvedLanguage]),ye=PG((function(){var e,t;return null!==(t=null===(e=null==b?void 0:b.verifyCodeTabConfig)||void 0===e?void 0:e.enabledLoginMethods)&&void 0!==t?t:["phone-code"]}),[null===(t=null==b?void 0:b.verifyCodeTabConfig)||void 0===t?void 0:t.enabledLoginMethods]),be=CG(gj({config:h,publicConfig:b}),3),we=be[0],Ce=be[1],Ee=be[2],ke=!(null===(n=null==h?void 0:h.loginMethods)||void 0===n?void 0:n.length),Se=mj().isPhoneMedia;
18664
18664
  //availableAt 0或者null-注册时,1-登录时,2-注册和登录时 注册登录合并时应该登录注册协议全部显示
18665
18665
  // 渲染前执行
18666
- kG((function(){var e;if(we&&!Ce){
18666
+ kG((function(){var e;if(ke&&!Se){
18667
18667
  // 无表单登录方式,且不是手机端
18668
18668
  var t=null===(e=id().getElementsByClassName("g2-view-container"))||void 0===e?void 0:e[0];
18669
18669
  // pc 下
18670
18670
  if(t)
18671
18671
  // @ts-ignore
18672
- return t.style["min-height"]=be?"456px":"280px",t.classList.add("no-login-methods-view"),function(){
18672
+ return t.style["min-height"]=Ee?"456px":"280px",t.classList.add("no-login-methods-view"),function(){
18673
18673
  // @ts-ignore
18674
- t.style["min-height"]="540px",t.classList.remove("no-login-methods-view")}}}),[be,Ce,we]),EG((function(){var e,t=id(),n=null===(e=t.getElementsByClassName("g2-view-header"))||void 0===e?void 0:e[0],r=t.querySelector(".g2-view-login>.g2-view-container-inner");return Ce&&we?(n&&n.classList.add("g2-view-header-mobile"),r&&r.classList.add("g2-view-login-mobile-inner")):(null==n||n.classList.remove("g2-view-header-mobile"),null==r||r.classList.remove("g2-view-login-mobile-inner")),function(){null==n||n.classList.remove("g2-view-header-mobile"),null==r||r.classList.remove("g2-view-login-mobile-inner")}}),[Ce,we]);
18674
+ t.style["min-height"]="540px",t.classList.remove("no-login-methods-view")}}}),[Ee,Se,ke]),EG((function(){var e,t=id(),n=null===(e=t.getElementsByClassName("g2-view-header"))||void 0===e?void 0:e[0],r=t.querySelector(".g2-view-login>.g2-view-container-inner");return Se&&ke?(n&&n.classList.add("g2-view-header-mobile"),r&&r.classList.add("g2-view-login-mobile-inner")):(null==n||n.classList.remove("g2-view-header-mobile"),null==r||r.classList.remove("g2-view-login-mobile-inner")),function(){null==n||n.classList.remove("g2-view-header-mobile"),null==r||r.classList.remove("g2-view-login-mobile-inner")}}),[Se,ke]);
18675
18675
  // 获取登录 tab 多语言
18676
- var Ee=(null===(r=null==b?void 0:b.ssoPageComponentDisplay)||void 0===r?void 0:r.loginMethodsI18nDisplaySettings)||{},ke=Ee.password,Se=Ee.verifyCode,xe=Ee.ad,Pe=Ee.ldap,_e=PG((function(){var e,t,n,r;return(null==Z?void 0:Z.includes(Vs.Password))&&y().createElement(xR.TabPane,{key:Vs.Password,tab:AG((null===(t=null===(e=null==ke?void 0:ke.tab)||void 0===e?void 0:e.i18n)||void 0===t?void 0:t[su.resolvedLanguage])||(null===(n=null==ke?void 0:ke.tab)||void 0===n?void 0:n.default)||x("login.pwdLogin"))},y().createElement(Uz,{loginWay:T,publicKey:Q,autoRegister:null==h?void 0:h.autoRegister,host:null==h?void 0:h.host,
18676
+ var xe=(null===(r=null==b?void 0:b.ssoPageComponentDisplay)||void 0===r?void 0:r.loginMethodsI18nDisplaySettings)||{},Pe=xe.password,_e=xe.verifyCode,Te=xe.ad,Oe=xe.ldap,Ne=PG((function(){var e,t,n,r;return(null==te?void 0:te.includes(Vs.Password))&&y().createElement(xR.TabPane,{key:Vs.Password,tab:AG((null===(t=null===(e=null==Pe?void 0:Pe.tab)||void 0===e?void 0:e.i18n)||void 0===t?void 0:t[su.resolvedLanguage])||(null===(n=null==Pe?void 0:Pe.tab)||void 0===n?void 0:n.default)||x("login.pwdLogin"))},y().createElement(Uz,{loginWay:T,publicKey:ee,autoRegister:null==h?void 0:h.autoRegister,host:null==h?void 0:h.host,
18677
18677
  // onLogin={onLogin}
18678
- backfillData:A,onLoginSuccess:ae,onLoginFailed:ce,onBeforeLogin:le,saveIdentify:se,passwordLoginMethods:null!==(r=null==h?void 0:h.passwordLoginMethods)&&void 0!==r?r:[],agreements:he,multipleInstance:R}))}),[he,Z,R,A,h,Q,T,le,se,ce,ae,x,ke]),Te=PG((function(){var e,t,n,r,o,i,a,s,c,l,u;if(!(null==Z?void 0:Z.includes(Vs.PhoneCode)))return y().createElement(y().Fragment,null);
18678
+ backfillData:D,onLoginSuccess:le,onLoginFailed:de,onBeforeLogin:fe,saveIdentify:ue,passwordLoginMethods:null!==(r=null==h?void 0:h.passwordLoginMethods)&&void 0!==r?r:[],agreements:ge,multipleInstance:L}))}),[ge,te,L,D,h,ee,T,fe,ue,de,le,x,Pe]),Ie=PG((function(){var e,t,n,r,o,i,a,s,c,l,u;if(!(null==te?void 0:te.includes(Vs.PhoneCode)))return y().createElement(y().Fragment,null);
18679
18679
  // 是否开启了国际化短信功能
18680
18680
  var d=[],f=!1;
18681
18681
  // 开启国际化短信时要将短信和邮箱 tab 拆分,方便下拉选取手机区号
18682
- return(null===(e=null==b?void 0:b.internationalSmsConfig)||void 0===e?void 0:e.enabled)||!1?((null===(n=null===(t=b.verifyCodeTabConfig)||void 0===t?void 0:t.enabledLoginMethods)||void 0===n?void 0:n.includes("phone-code"))&&(f=!0,d.push(y().createElement(xR.TabPane,{key:Vs.PhoneCode,tab:AG((null===(o=null===(r=null==Se?void 0:Se.tab)||void 0===r?void 0:r.i18n)||void 0===o?void 0:o[su.resolvedLanguage])||(null===(i=null==Se?void 0:Se.tab)||void 0===i?void 0:i.default)||x("common.phoneCodeTab"))},y().createElement(CW,{verifyCodeLength:null==b?void 0:b.verifyCodeLength,autoRegister:null==h?void 0:h.autoRegister,onBeforeLogin:le,
18682
+ return(null===(e=null==b?void 0:b.internationalSmsConfig)||void 0===e?void 0:e.enabled)||!1?((null===(n=null===(t=b.verifyCodeTabConfig)||void 0===t?void 0:t.enabledLoginMethods)||void 0===n?void 0:n.includes("phone-code"))&&(f=!0,d.push(y().createElement(xR.TabPane,{key:Vs.PhoneCode,tab:AG((null===(o=null===(r=null==_e?void 0:_e.tab)||void 0===r?void 0:r.i18n)||void 0===o?void 0:o[su.resolvedLanguage])||(null===(i=null==_e?void 0:_e.tab)||void 0===i?void 0:i.default)||x("common.phoneCodeTab"))},y().createElement(CW,{verifyCodeLength:null==b?void 0:b.verifyCodeLength,autoRegister:null==h?void 0:h.autoRegister,onBeforeLogin:fe,
18683
18683
  // onLogin={onLogin}
18684
- onLoginSuccess:ae,onLoginFailed:ce,saveIdentify:se,agreements:he,methods:["phone-code"],backfillData:A,multipleInstance:R,specifyCodeMethod:LH.Phone})))),(null===(s=null===(a=b.verifyCodeTabConfig)||void 0===a?void 0:a.enabledLoginMethods)||void 0===s?void 0:s.includes("email-code"))&&d.push(y().createElement(xR.TabPane,{key:f?Vs.EmailCode:Vs.PhoneCode,
18684
+ onLoginSuccess:le,onLoginFailed:de,saveIdentify:ue,agreements:ge,methods:["phone-code"],backfillData:D,multipleInstance:L,specifyCodeMethod:LH.Phone})))),(null===(s=null===(a=b.verifyCodeTabConfig)||void 0===a?void 0:a.enabledLoginMethods)||void 0===s?void 0:s.includes("email-code"))&&d.push(y().createElement(xR.TabPane,{key:f?Vs.EmailCode:Vs.PhoneCode,
18685
18685
  // TODO 后续需要单独抽出来
18686
- tab:AG(x("common.emailCodeTab"))},y().createElement(CW,{verifyCodeLength:null==b?void 0:b.verifyCodeLength,autoRegister:null==h?void 0:h.autoRegister,onBeforeLogin:le,
18686
+ tab:AG(x("common.emailCodeTab"))},y().createElement(CW,{verifyCodeLength:null==b?void 0:b.verifyCodeLength,autoRegister:null==h?void 0:h.autoRegister,onBeforeLogin:fe,
18687
18687
  // onLogin={onLogin}
18688
- onLoginSuccess:ae,onLoginFailed:ce,saveIdentify:se,agreements:he,methods:["email-code"],backfillData:A,multipleInstance:R,specifyCodeMethod:LH.Email}))),d):y().createElement(xR.TabPane,{key:Vs.PhoneCode,tab:AG((null===(l=null===(c=null==Se?void 0:Se.tab)||void 0===c?void 0:c.i18n)||void 0===l?void 0:l[su.resolvedLanguage])||(null===(u=null==Se?void 0:Se.tab)||void 0===u?void 0:u.default)||x("common.verifyCodeLogin"))},y().createElement(CW,{verifyCodeLength:null==b?void 0:b.verifyCodeLength,autoRegister:null==h?void 0:h.autoRegister,onBeforeLogin:le,
18688
+ onLoginSuccess:le,onLoginFailed:de,saveIdentify:ue,agreements:ge,methods:["email-code"],backfillData:D,multipleInstance:L,specifyCodeMethod:LH.Email}))),d):y().createElement(xR.TabPane,{key:Vs.PhoneCode,tab:AG((null===(l=null===(c=null==_e?void 0:_e.tab)||void 0===c?void 0:c.i18n)||void 0===l?void 0:l[su.resolvedLanguage])||(null===(u=null==_e?void 0:_e.tab)||void 0===u?void 0:u.default)||x("common.verifyCodeLogin"))},y().createElement(CW,{verifyCodeLength:null==b?void 0:b.verifyCodeLength,autoRegister:null==h?void 0:h.autoRegister,onBeforeLogin:fe,
18689
18689
  // onLogin={onLogin}
18690
- onLoginSuccess:ae,onLoginFailed:ce,saveIdentify:se,agreements:he,methods:me,backfillData:A,multipleInstance:R}))}),[Z,null===(o=null==b?void 0:b.internationalSmsConfig)||void 0===o?void 0:o.enabled,null===(i=b.verifyCodeTabConfig)||void 0===i?void 0:i.enabledLoginMethods,null==b?void 0:b.verifyCodeLength,x,null==h?void 0:h.autoRegister,le,ae,ce,se,he,me,A,R,null===(a=null==Se?void 0:Se.tab)||void 0===a?void 0:a.i18n,null===(s=null==Se?void 0:Se.tab)||void 0===s?void 0:s.default]),Oe=PG((function(){var e,t,n;return(null==Z?void 0:Z.includes(Vs.LDAP))&&y().createElement(xR.TabPane,{key:Vs.LDAP,tab:AG((null===(t=null===(e=null==Pe?void 0:Pe.tab)||void 0===e?void 0:e.i18n)||void 0===t?void 0:t[su.resolvedLanguage])||(null===(n=null==Pe?void 0:Pe.tab)||void 0===n?void 0:n.default)||x("login.ldapLogin"))},y().createElement(Wz,{publicKey:Q,autoRegister:null==h?void 0:h.autoRegister,host:null==h?void 0:h.host,
18690
+ onLoginSuccess:le,onLoginFailed:de,saveIdentify:ue,agreements:ge,methods:ye,backfillData:D,multipleInstance:L}))}),[te,null===(o=null==b?void 0:b.internationalSmsConfig)||void 0===o?void 0:o.enabled,null===(i=b.verifyCodeTabConfig)||void 0===i?void 0:i.enabledLoginMethods,null==b?void 0:b.verifyCodeLength,x,null==h?void 0:h.autoRegister,fe,le,de,ue,ge,ye,D,L,null===(a=null==_e?void 0:_e.tab)||void 0===a?void 0:a.i18n,null===(s=null==_e?void 0:_e.tab)||void 0===s?void 0:s.default]),Ae=PG((function(){var e,t,n;return(null==te?void 0:te.includes(Vs.LDAP))&&y().createElement(xR.TabPane,{key:Vs.LDAP,tab:AG((null===(t=null===(e=null==Oe?void 0:Oe.tab)||void 0===e?void 0:e.i18n)||void 0===t?void 0:t[su.resolvedLanguage])||(null===(n=null==Oe?void 0:Oe.tab)||void 0===n?void 0:n.default)||x("login.ldapLogin"))},y().createElement(Wz,{publicKey:ee,autoRegister:null==h?void 0:h.autoRegister,host:null==h?void 0:h.host,
18691
18691
  // onLogin={onLogin}
18692
- onLoginSuccess:ae,onLoginFailed:ce,onBeforeLogin:le,agreements:he,backfillData:A,multipleInstance:R}))}),[he,A,null==h?void 0:h.autoRegister,null==h?void 0:h.host,R,le,ce,ae,Q,Z,x,Pe]),Ne=PG((function(){var e,t,n;return(null==Z?void 0:Z.includes(Vs.AD))&&y().createElement(xR.TabPane,{key:Vs.AD,tab:AG((null===(t=null===(e=null==xe?void 0:xe.tab)||void 0===e?void 0:e.i18n)||void 0===t?void 0:t[su.resolvedLanguage])||(null===(n=null==xe?void 0:xe.tab)||void 0===n?void 0:n.default)||x("login.adLogin"))},y().createElement(Xz,{backfillData:A,multipleInstance:R,publicKey:Q,autoRegister:null==h?void 0:h.autoRegister,
18692
+ onLoginSuccess:le,onLoginFailed:de,onBeforeLogin:fe,agreements:ge,backfillData:D,multipleInstance:L}))}),[ge,D,null==h?void 0:h.autoRegister,null==h?void 0:h.host,L,fe,de,le,ee,te,x,Oe]),Re=PG((function(){var e,t,n;return(null==te?void 0:te.includes(Vs.AD))&&y().createElement(xR.TabPane,{key:Vs.AD,tab:AG((null===(t=null===(e=null==Te?void 0:Te.tab)||void 0===e?void 0:e.i18n)||void 0===t?void 0:t[su.resolvedLanguage])||(null===(n=null==Te?void 0:Te.tab)||void 0===n?void 0:n.default)||x("login.adLogin"))},y().createElement(Xz,{backfillData:D,multipleInstance:L,publicKey:ee,autoRegister:null==h?void 0:h.autoRegister,
18693
18693
  // onLogin={onLogin}
18694
- onLoginSuccess:ae,onLoginFailed:ce,onBeforeLogin:le,agreements:he}))}),[he,A,null==h?void 0:h.autoRegister,R,le,ce,ae,Q,Z,x,xe]),Ie=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.WxMinQr+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.scanLogin")},y().createElement(uH,{id:e.id,multipleInstance:R,onLoginSuccess:ae,canLoop:F,qrCodeScanOptions:{extIdpConnId:e.id}}))}),[F,R,ae,x]),Ae=_G((function(){return y().createElement(xR.TabPane,{key:Vs.AppQr,tab:x("login.appScanLogin")},y().createElement(sH,{multipleInstance:R,onLoginSuccess:ae,canLoop:F}))}),[F,R,ae,x]),Re=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.ZJZWFWQrcode+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.zjzwScanLogin")},y().createElement(bG,{qrCodeScanOptions:{extIdpConnId:e.id},qrConfig:e.QRConfig,multipleInstance:R,onLoginSuccess:ae,canLoop:F}))}),[F,R,ae,x]),Me=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.WechatMpQrcode+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.wechatmpQrcode")},y().createElement(pH,{id:e.id,multipleInstance:R,onLoginSuccess:ae,canLoop:F,qrCodeScanOptions:{extIdpConnId:e.id}}))}),[F,R,ae,x]),De=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.WechatworkCorpQrconnect+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.wecomScanLogin")},y().createElement(aG,{id:e.id,QRConfig:e.QRConfig,onLoginSuccess:ae,onLoginFailed:ce}))}),[F,R,ae,x]),Le=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.DingTalkQrcode+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.wecomScanLogin")},y().createElement(mG,{id:e.id,QRConfig:e.QRConfig,onLoginSuccess:ae,onLoginFailed:ce}))}),[F,R,ae,x]),Fe=PG((function(){return(null==Z?void 0:Z.includes(Vs.AuthingOtpPush))&&y().createElement(xR.TabPane,{key:Vs.AuthingOtpPush,tab:x("login.authingOtpPushLogin")},y().createElement(QW,{onLoginSuccess:ae,multipleInstance:R,initData:A,agreements:he}))}),[Z,ae,x,A,R,he]),je=PG((function(){var e;return(e={})[Vs.Password]=_e,e[Vs.PhoneCode]=Te,e[Vs.LDAP]=Oe,e[Vs.AD]=Ne,e[Vs.AuthingOtpPush]=Fe,e}),[_e,Te,Oe,Ne,Fe]),Be=PG((function(){var e,t=null==Z?void 0:Z.filter((function(e){return[Vs.Password,Vs.PhoneCode,Vs.LDAP,Vs.AD,Vs.AuthingOtpPush].includes(e)}));return t?gX(t,null!==(e=h.defaultLoginMethod)&&void 0!==e?e:"").map((function(e){return je[e]})):null}),[h.defaultLoginMethod,Z,je]),Ue=PG((function(){var e;return(e={})[Vs.AppQr]=Ae,e[Vs.WechatMpQrcode]=Me,e[Vs.WxMinQr]=Ie,e[Vs.WechatworkCorpQrconnect]=De,e[Vs.WECHATWORKQRCONNECTOFAUTHINGAGENCY]=De,e[Vs.WECHATWORKAGENCYQRCONNECT]=De,e[Vs.DingTalkQrcode]=Le,e[Vs.ZJZWFWQrcode]=Re,e}),[Ae,Me,Ie]),qe=PG((function(){var e,t={};Object.keys(U).forEach((function(e){U[e].forEach((function(n){t[n.id]={type:e,title:n.title,id:n.id,QRConfig:n.QRConfig}}))}));var n=(null===(e=b.qrCodeSortConfig)||void 0===e?void 0:e.loginMethodsSort)||[],r=(n||[]).map((function(e){var n;return{key:e,type:(null===(n=t[e])||void 0===n?void 0:n.type)||Vs.AppQr}})),o=null==r?void 0:r.findIndex((function(e){return e.type===C}));if(o>0){var i=n.splice(o,1);n.unshift(i[0])}return(n||[]).map((function(e){var n;return t[e]?null===(n=Ue[t[e].type])||void 0===n?void 0:n.call(Ue,t[e]):Ue[Vs.AppQr]()}))}),[Ue,U,null===(c=b.qrCodeSortConfig)||void 0===c?void 0:c.loginMethodsSort,C]);return EG((function(){var e=function(e){
18694
+ onLoginSuccess:le,onLoginFailed:de,onBeforeLogin:fe,agreements:ge}))}),[ge,D,null==h?void 0:h.autoRegister,L,fe,de,le,ee,te,x,Te]),Me=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.WxMinQr+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.scanLogin")},y().createElement(uH,{id:e.id,multipleInstance:L,onLoginSuccess:le,canLoop:U,qrCodeScanOptions:{extIdpConnId:e.id}}))}),[U,L,le,x]),De=_G((function(){return y().createElement(xR.TabPane,{key:Vs.AppQr,tab:x("login.appScanLogin")},y().createElement(sH,{multipleInstance:L,onLoginSuccess:le,canLoop:U}))}),[U,L,le,x]),Le=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.ZJZWFWQrcode+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.zjzwScanLogin")},y().createElement(bG,{qrCodeScanOptions:{extIdpConnId:e.id},qrConfig:e.QRConfig,multipleInstance:L,onLoginSuccess:le,canLoop:U}))}),[U,L,le,x]),Fe=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.WechatMpQrcode+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.wechatmpQrcode")},y().createElement(pH,{id:e.id,multipleInstance:L,onLoginSuccess:le,canLoop:U,qrCodeScanOptions:{extIdpConnId:e.id}}))}),[U,L,le,x]),je=_G((function(e){var t,n=e.type||Vs.WechatworkCorpQrconnect;return y().createElement(xR.TabPane,{key:n+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.wecomScanLogin")},y().createElement(aG,{id:e.id,QRConfig:e.QRConfig,onLoginSuccess:le,onLoginFailed:de}))}),[U,L,le,x]),Be=_G((function(e){var t;return y().createElement(xR.TabPane,{key:Vs.DingTalkQrcode+e.id,tab:null!==(t=e.title)&&void 0!==t?t:x("login.wecomScanLogin")},y().createElement(mG,{id:e.id,QRConfig:e.QRConfig,onLoginSuccess:le,onLoginFailed:de}))}),[U,L,le,x]),Ue=PG((function(){return(null==te?void 0:te.includes(Vs.AuthingOtpPush))&&y().createElement(xR.TabPane,{key:Vs.AuthingOtpPush,tab:x("login.authingOtpPushLogin")},y().createElement(QW,{onLoginSuccess:le,multipleInstance:L,initData:D,agreements:ge}))}),[te,le,x,D,L,ge]),qe=PG((function(){var e;return(e={})[Vs.Password]=Ne,e[Vs.PhoneCode]=Ie,e[Vs.LDAP]=Ae,e[Vs.AD]=Re,e[Vs.AuthingOtpPush]=Ue,e}),[Ne,Ie,Ae,Re,Ue]),Ve=PG((function(){var e,t=null==te?void 0:te.filter((function(e){return[Vs.Password,Vs.PhoneCode,Vs.LDAP,Vs.AD,Vs.AuthingOtpPush].includes(e)}));return t?gX(t,null!==(e=h.defaultLoginMethod)&&void 0!==e?e:"").map((function(e){return qe[e]})):null}),[h.defaultLoginMethod,te,qe]),ze=PG((function(){var e;return(e={})[Vs.AppQr]=De,e[Vs.WechatMpQrcode]=Fe,e[Vs.WxMinQr]=Me,e[Vs.WechatworkCorpQrconnect]=je,e[Vs.WECHATWORKQRCONNECTOFAUTHINGAGENCY]=function(e){return je(wG(wG({},e),{type:Vs.WECHATWORKQRCONNECTOFAUTHINGAGENCY}))},e[Vs.WECHATWORKAGENCYQRCONNECT]=function(e){return je(wG(wG({},e),{type:Vs.WECHATWORKAGENCYQRCONNECT}))},e[Vs.DingTalkQrcode]=Be,e[Vs.ZJZWFWQrcode]=Le,e}),[De,Fe,Me]),$e=PG((function(){var e,t={};Object.keys(z).forEach((function(e){z[e].forEach((function(n){t[n.id]={type:e,title:n.title,id:n.id,QRConfig:n.QRConfig}}))}));var n=(null===(e=b.qrCodeSortConfig)||void 0===e?void 0:e.loginMethodsSort)||[],r=(n||[]).map((function(e){var n;return{key:e,type:(null===(n=t[e])||void 0===n?void 0:n.type)||Vs.AppQr}})),o=null==r?void 0:r.findIndex((function(e){return e.type===C}));if(o>0){var i=n.splice(o,1);n.unshift(i[0])}return(n||[]).map((function(e){var n;return t[e]?null===(n=ze[t[e].type])||void 0===n?void 0:n.call(ze,t[e]):ze[Vs.AppQr]()}))}),[ze,z,null===(c=b.qrCodeSortConfig)||void 0===c?void 0:c.loginMethodsSort,C]);return EG((function(){var e=function(e){
18695
18695
  // 去掉钉钉和企微域下的postmessage处理 由他们内部自己监听的message控制 避免重复触发
18696
18696
  /** 是否存在开启内嵌模式的身份源 */
18697
- var t=q.filter((function(e){return e.embedded}));
18697
+ var t=$.filter((function(e){return e.embedded}));
18698
18698
  /** 处于扫码登录方式 */if(t.length>0&&OG.includes(T)){if(t.find((function(e){return[$s.WECHATWORK_CORP_QRCONNECT,$s.WECHATWORK_AGENCY_QRCONNECT,$s.WECHATWORK_QRCONNECT_OF_AUTHING_AGENCY].includes(e.provider)}))&&yX(e))return;if(t.find((function(e){return[$s.DINGTALK].includes(e.provider)}))&&bX(e.origin))return}var n=P(e);if(n){
18699
18699
  // 更新本次登录方式
18700
- R&&R.setLoginWay("input","social");var r=n.code,o=n.data,i=n.onGuardHandling,a=n.message;if(200===r)ae(o);else
18700
+ L&&L.setLoginWay("input","social");var r=n.code,o=n.data,i=n.onGuardHandling,a=n.message;if(200===r)le(o);else
18701
18701
  // 向上层抛出错误
18702
- (null==i?void 0:i())===uZ.RENDER_MESSAGE&&ce(r,o,a)}},t=CX();
18702
+ (null==i?void 0:i())===uZ.RENDER_MESSAGE&&de(r,o,a)}},t=CX();
18703
18703
  // 如果有第三方身份源开启监听
18704
- return(ge.length>0||ye.length>0)&&(null==t||t.addEventListener("message",e)),function(){null==t||t.removeEventListener("message",e)}}),[ce,R,ae,P]),y().createElement("div",{className:"g2-view-container g2-view-login"},y().createElement("div",{className:"g2-view-container-inner"},be?y().createElement(y().Fragment,null,y().createElement("div",{className:"g2-view-header"},y().createElement("img",{src:null==h?void 0:h.logo,alt:"",className:"icon"}),y().createElement("div",{className:"title"},null==h?void 0:h.title),!!(null==b?void 0:b.welcomeMessage)&&y().createElement("div",{className:"title-description"},null==b?void 0:b.welcomeMessage[su.resolvedLanguage])),y().createElement("div",{className:"no-login-methods-view"},y().createElement(JD,{type:"authing-bianzu",style:{width:178,height:120}}),y().createElement("span",{className:"no-login-methods-desc"},x("login.noLoginMethodsDesc")))):y().createElement(y().Fragment,null,!M&&E&&k&&y().createElement("div",{className:"g2-qrcode-switch"},y().createElement(vv,{placement:"leftTop",content:de,overlayClassName:de===su.t("login.moreWays")?"long-switch-text":"switch-text",getPopupContainer:function(e){return e?e.parentElement:document.body}},y().createElement("div",{className:"switch-img",onClick:function(){gC.destroy(),TG.includes(T)?O(ee):OG.includes(T)&&O(X)}},y().createElement("div",{className:"imgae-mask"}),y().createElement(JD,{type:"authing-a-erweima22",className:"qrcode-switch-image ".concat(fe)}),y().createElement(JD,{type:"authing-diannao",className:"qrcode-switch-image ".concat(pe)})))),y().createElement("div",{className:"g2-view-header"},y().createElement("img",{src:null==h?void 0:h.logo,alt:"",className:"icon"}),y().createElement("div",{className:"title"},M?x("login.selectLoginAccount"):null==h?void 0:h.title),!!(null==b?void 0:b.welcomeMessage)&&y().createElement("div",{className:"title-description"},null==b?void 0:b.welcomeMessage[su.resolvedLanguage]),null===(l=null==J?void 0:J.map)||void 0===l?void 0:l.call(J,(function(e,t){
18704
+ return(we.length>0||Ce.length>0)&&(null==t||t.addEventListener("message",e)),function(){null==t||t.removeEventListener("message",e)}}),[de,L,le,P]),y().createElement("div",{className:"g2-view-container g2-view-login"},y().createElement("div",{className:"g2-view-container-inner"},Ee?y().createElement(y().Fragment,null,y().createElement("div",{className:"g2-view-header"},y().createElement("img",{src:null==h?void 0:h.logo,alt:"",className:"icon"}),y().createElement("div",{className:"title"},null==h?void 0:h.title),!!(null==b?void 0:b.welcomeMessage)&&y().createElement("div",{className:"title-description"},null==b?void 0:b.welcomeMessage[su.resolvedLanguage])),y().createElement("div",{className:"no-login-methods-view"},y().createElement(JD,{type:"authing-bianzu",style:{width:178,height:120}}),y().createElement("span",{className:"no-login-methods-desc"},x("login.noLoginMethodsDesc")))):y().createElement(y().Fragment,null,!F&&E&&k&&y().createElement("div",{className:"g2-qrcode-switch"},y().createElement(vv,{placement:"leftTop",content:he,overlayClassName:he===su.t("login.moreWays")?"long-switch-text":"switch-text",getPopupContainer:function(e){return e?e.parentElement:document.body}},y().createElement("div",{className:"switch-img",onClick:function(){gC.destroy(),TG.includes(T)?(A("qrcode"),O(re)):OG.includes(T)&&(A("input"),O(ne))}},y().createElement("div",{className:"imgae-mask"}),y().createElement(JD,{type:"authing-a-erweima22",className:"qrcode-switch-image ".concat(me)}),y().createElement(JD,{type:"authing-diannao",className:"qrcode-switch-image ".concat(ve)})))),y().createElement("div",{className:"g2-view-header"},y().createElement("img",{src:null==h?void 0:h.logo,alt:"",className:"icon"}),y().createElement("div",{className:"title"},F?x("login.selectLoginAccount"):null==h?void 0:h.title),!!(null==b?void 0:b.welcomeMessage)&&y().createElement("div",{className:"title-description"},null==b?void 0:b.welcomeMessage[su.resolvedLanguage]),null===(l=null==X?void 0:X.map)||void 0===l?void 0:l.call(X,(function(e,t){
18705
18705
  // @ts-ignore
18706
- return y().createElement(yE,{className:"authing-header-tag",style:{color:null==e?void 0:e.color,backgroundColor:null==e?void 0:e.backgroundColor},key:t},e.name)}))),M?y().createElement(QH,{multipleInstance:R,referMultipleState:D,changeModule:v}):y().createElement(y().Fragment,null,E&&y().createElement("div",{className:fe},f?y().createElement(aW,null):y().createElement("div",{className:"g2-view-tabs"},y().createElement(xR,{destroyInactiveTabPane:!0,onChange:function(e){var t;O(e),gC.destroy(),null===(t=null==g?void 0:g.onLoginTabChange)||void 0===t||t.call(g,e)},activeKey:T},null==Be?void 0:Be.flat())),y().createElement("div",{className:"g2-tips-line"},!ne&&!f&&y().createElement("div",null,y().createElement(wj,{type:"link",className:"link-like forget-password-link",onClick:function(){return null==v?void 0:v(LL.FORGET_PWD,{})}},x("login.forgetPwd")),(z>=2||W)&&y().createElement("span",{style:{margin:"0 4px",color:"#EAEBEE"}},"丨")),f&&y().createElement(wj,{type:"link",onClick:function(){null==v||v(LL.LOGIN)}},x("common.backLoginPage")),(z>=2||W)&&y().createElement(fv,{title:x("common.feedback")},y().createElement("div",{className:"touch-tip question-feedback",onClick:function(){return null==v?void 0:v(LL.ANY_QUESTIONS,{identify:K.current[T]})}},y().createElement(JD,{type:"authing-a-question-line1",style:{fontSize:16}}))),!re&&y().createElement("span",{className:"go-to-register"},y().createElement(wj,{type:"link",className:"link-like register-link",onClick:function(){return null==v?void 0:v(LL.REGISTER,{})}},x("common.registerImmediate"))))),k&&y().createElement("div",{className:"g2-view-tabs ".concat(pe," ").concat(oe&&"hidden_tab")},y().createElement(xR,{destroyInactiveTabPane:!0,defaultActiveKey:ie,onChange:function(e){var t;gC.destroy(),null===(t=null==g?void 0:g.onLoginTabChange)||void 0===t||t.call(g,e)}},qe))),y().createElement("div",{className:"g2-social-login"},y().createElement(VH,{appId:m,config:h,multipleInstance:R,
18706
+ return y().createElement(yE,{className:"authing-header-tag",style:{color:null==e?void 0:e.color,backgroundColor:null==e?void 0:e.backgroundColor},key:t},e.name)}))),F?y().createElement(QH,{multipleInstance:L,referMultipleState:j,changeModule:v}):y().createElement(y().Fragment,null,E&&["input","collapsed"].includes(I)&&y().createElement("div",{className:me},f?y().createElement(aW,null):y().createElement("div",{className:"g2-view-tabs"},y().createElement(xR,{destroyInactiveTabPane:!0,onChange:function(e){var t;O(e),gC.destroy(),null===(t=null==g?void 0:g.onLoginTabChange)||void 0===t||t.call(g,e)},activeKey:T},null==Ve?void 0:Ve.flat())),y().createElement("div",{className:"g2-tips-line"},!ie&&!f&&y().createElement("div",null,y().createElement(wj,{type:"link",className:"link-like forget-password-link",onClick:function(){return null==v?void 0:v(LL.FORGET_PWD,{})}},x("login.forgetPwd")),(W>=2||Y)&&y().createElement("span",{style:{margin:"0 4px",color:"#EAEBEE"}},"丨")),f&&y().createElement(wj,{type:"link",onClick:function(){null==v||v(LL.LOGIN)}},x("common.backLoginPage")),(W>=2||Y)&&y().createElement(fv,{title:x("common.feedback")},y().createElement("div",{className:"touch-tip question-feedback",onClick:function(){return null==v?void 0:v(LL.ANY_QUESTIONS,{identify:Q.current[T]})}},y().createElement(JD,{type:"authing-a-question-line1",style:{fontSize:16}}))),!ae&&y().createElement("span",{className:"go-to-register"},y().createElement(wj,{type:"link",className:"link-like register-link",onClick:function(){return null==v?void 0:v(LL.REGISTER,{})}},x("common.registerImmediate"))))),k&&["qrcode","collapsed"].includes(I)&&y().createElement("div",{className:"g2-view-tabs ".concat(ve," ").concat(se&&"hidden_tab")},y().createElement(xR,{destroyInactiveTabPane:!0,defaultActiveKey:ce,onChange:function(e){var t;gC.destroy(),null===(t=null==g?void 0:g.onLoginTabChange)||void 0===t||t.call(g,e)}},$e))),y().createElement("div",{className:"g2-social-login"},y().createElement(VH,{appId:m,config:h,multipleInstance:L,
18707
18707
  // onLogin={onLogin}
18708
- onLoginSuccess:ae,onLoginFailed:ce,socialConnectionObjs:ge,enterpriseConnectionObjs:ye})))),y().createElement(kL,{langRange:null==h?void 0:h.langRange,onLangChange:null==g?void 0:g.onLangChange}))},MG=function(){return MG=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},MG.apply(this,arguments)},DG=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},LG=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};!function(e){e.VerifyEmail="verify-email",e.VerifySms="verify-sms",e.VerifyTotp="verify-totp",e.VerifyFace="verify-face",e.AssociateFace="associate-face",e.PasskeyBind="passkey-bind",e.PasskeyVerify="passkey-verify"}(IG||(IG={}));var FG=function(e,t){return DG(void 0,void 0,void 0,(function(){return LG(this,(function(n){switch(n.label){case 0:return[4/*yield*/,(0,DZ().authFlow)(e,MG({},t))];case 1:return[2/*return*/,n.sent()]}}))}))},jG=function(){var e,t=mL();return(e={})[IG.VerifyEmail]=function(e){return t?FG(IG.VerifyEmail,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n,r;return LG(this,(function(o){switch(o.label){case 0:return t=e.email,n=e.code,r=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/email/verify",{email:t,code:n},{headers:{authorization:"Bearer ".concat(r)}})];case 1:return[2/*return*/,o.sent()]}}))}))}(e)},e[IG.VerifySms]=function(e){return t?FG(IG.VerifySms,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n,r,o;return LG(this,(function(i){switch(i.label){case 0:return t=e.phone,n=e.code,r=e.mfaToken,o=e.phoneCountryCode,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/sms/verify",{phone:t,code:n,phoneCountryCode:o},{headers:{authorization:"Bearer ".concat(r)}})];case 1:return[2/*return*/,i.sent()]}}))}))}(e)},e[IG.VerifyTotp]=function(e){return t?FG(IG.VerifyTotp,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n;return LG(this,(function(r){switch(r.label){case 0:return t=e.totp,n=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/totp/verify",{totp:t},{headers:{authorization:"Bearer ".concat(n)}})];case 1:return[2/*return*/,r.sent()]}}))}))}(e)},e[IG.VerifyFace]=function(e){return t?FG(IG.VerifyFace,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n;return LG(this,(function(r){switch(r.label){case 0:return t=e.photo,n=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/face/verify",{photo:t},{headers:{authorization:"Bearer ".concat(n)}})];case 1:return[2/*return*/,r.sent()]}}))}))}(e)},e[IG.AssociateFace]=function(e){return t?FG(IG.AssociateFace,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n,r,o;return LG(this,(function(i){switch(i.label){case 0:return t=e.photoA,n=e.photoB,r=e.isExternalPhoto,o=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/mfa/face/associate",{photoA:t,photoB:n,isExternalPhoto:r},{headers:{authorization:"Bearer ".concat(o)}})];case 1:return[2/*return*/,i.sent()]}}))}))}(e)},e[IG.PasskeyBind]=function(e){return t?FG(IG.PasskeyBind,e):null;
18708
+ onLoginSuccess:le,onLoginFailed:de,socialConnectionObjs:we,enterpriseConnectionObjs:Ce})))),y().createElement(kL,{langRange:null==h?void 0:h.langRange,onLangChange:null==g?void 0:g.onLangChange}))},MG=function(){return MG=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},MG.apply(this,arguments)},DG=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},LG=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};!function(e){e.VerifyEmail="verify-email",e.VerifySms="verify-sms",e.VerifyTotp="verify-totp",e.VerifyFace="verify-face",e.AssociateFace="associate-face",e.PasskeyBind="passkey-bind",e.PasskeyVerify="passkey-verify"}(IG||(IG={}));var FG=function(e,t){return DG(void 0,void 0,void 0,(function(){return LG(this,(function(n){switch(n.label){case 0:return[4/*yield*/,(0,DZ().authFlow)(e,MG({},t))];case 1:return[2/*return*/,n.sent()]}}))}))},jG=function(){var e,t=mL();return(e={})[IG.VerifyEmail]=function(e){return t?FG(IG.VerifyEmail,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n,r;return LG(this,(function(o){switch(o.label){case 0:return t=e.email,n=e.code,r=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/email/verify",{email:t,code:n},{headers:{authorization:"Bearer ".concat(r)}})];case 1:return[2/*return*/,o.sent()]}}))}))}(e)},e[IG.VerifySms]=function(e){return t?FG(IG.VerifySms,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n,r,o;return LG(this,(function(i){switch(i.label){case 0:return t=e.phone,n=e.code,r=e.mfaToken,o=e.phoneCountryCode,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/sms/verify",{phone:t,code:n,phoneCountryCode:o},{headers:{authorization:"Bearer ".concat(r)}})];case 1:return[2/*return*/,i.sent()]}}))}))}(e)},e[IG.VerifyTotp]=function(e){return t?FG(IG.VerifyTotp,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n;return LG(this,(function(r){switch(r.label){case 0:return t=e.totp,n=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/totp/verify",{totp:t},{headers:{authorization:"Bearer ".concat(n)}})];case 1:return[2/*return*/,r.sent()]}}))}))}(e)},e[IG.VerifyFace]=function(e){return t?FG(IG.VerifyFace,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n;return LG(this,(function(r){switch(r.label){case 0:return t=e.photo,n=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/applications/mfa/face/verify",{photo:t},{headers:{authorization:"Bearer ".concat(n)}})];case 1:return[2/*return*/,r.sent()]}}))}))}(e)},e[IG.AssociateFace]=function(e){return t?FG(IG.AssociateFace,e):function(e){return DG(void 0,void 0,void 0,(function(){var t,n,r,o;return LG(this,(function(i){switch(i.label){case 0:return t=e.photoA,n=e.photoB,r=e.isExternalPhoto,o=e.mfaToken,[4/*yield*/,(0,DZ().post)("/api/v2/mfa/face/associate",{photoA:t,photoB:n,isExternalPhoto:r},{headers:{authorization:"Bearer ".concat(o)}})];case 1:return[2/*return*/,i.sent()]}}))}))}(e)},e[IG.PasskeyBind]=function(e){return t?FG(IG.PasskeyBind,e):null;
18709
18709
  // return AssociateFace(content)
18710
18710
  },e[IG.PasskeyVerify]=function(e){return t?FG(IG.PasskeyVerify,e):null;
18711
18711
  // return AssociateFace(content)
@@ -125,6 +125,7 @@ export interface QrCodeItem {
125
125
  id: string;
126
126
  title: string;
127
127
  isDefault?: boolean;
128
+ type?: LoginMethods;
128
129
  QRConfig?: {
129
130
  corpId: string;
130
131
  agentId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authing/guard-shim-react18",
3
- "version": "4.5.33-alpha.0",
3
+ "version": "4.5.33-alpha.1",
4
4
  "description": "Guard shim for react 18, only be used to internal",
5
5
  "types": "dist/typings/src/index.d.ts",
6
6
  "module": "dist/guard.min.js",