@authing/guard-shim-react 4.5.40-alpha.0 → 4.5.40-alpha.2
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
|
@@ -22477,9 +22477,9 @@ e.SELF_UNLOCKING_VERIFY_CODE="SELF_UNLOCKING_VERIFY_CODE",
|
|
|
22477
22477
|
// 验证码模版
|
|
22478
22478
|
e.VERIFY_CODE="VERIFY_CODE"}(Nc||(Nc={})),function(e){e.Day="DAY",e.Month="MONTH",e.Year="YEAR"}(Ic||(Ic={}));
|
|
22479
22479
|
// EXTERNAL MODULE: ./node_modules/ua-parser-js/src/ua-parser.js
|
|
22480
|
-
var Dc=i(1763),Lc=i.n(Dc),Fc=i(1935),jc=i.n(Fc),Bc=function(){return"undefined"==typeof navigator?null:/MicroMessenger/i.test(null===navigator||void 0===navigator?void 0:navigator.userAgent)&&!/wxwork/i.test(navigator.userAgent)},Uc=function(){return"undefined"==typeof navigator?null:/Lark/i.test(navigator.userAgent)},qc=function(){return"undefined"==typeof navigator?null:/dingtalk/i.test(navigator.userAgent)},Vc=function(e){var t;
|
|
22480
|
+
var Dc=i(1763),Lc=i.n(Dc),Fc=i(1935),jc=i.n(Fc),Bc=function(){return"undefined"==typeof navigator?null:/MicroMessenger/i.test(null===navigator||void 0===navigator?void 0:navigator.userAgent)&&!/wxwork/i.test(navigator.userAgent)},Uc=function(){return"undefined"==typeof navigator?null:/Lark/i.test(navigator.userAgent)},qc=function(){return"undefined"==typeof navigator?null:/dingtalk/i.test(navigator.userAgent)},Vc=function(e){var t;if(void 0===e&&(e=[]),"undefined"==typeof window||"undefined"==typeof navigator)return!0;
|
|
22481
22481
|
// 1. 首先筛选出一定是特殊浏览器的 UA
|
|
22482
|
-
if(
|
|
22482
|
+
if(Bc()||"undefined"!=typeof navigator&&/wxwork/i.test(navigator.userAgent)||Uc()||qc()||"undefined"!=typeof navigator&&/QtWebEngine/i.test(navigator.userAgent)||"undefined"!=typeof navigator&&/MiuiBrowser/i.test(navigator.userAgent)||"undefined"!=typeof navigator&&/MQQBrowser/i.test(navigator.userAgent)||function(){if("undefined"!=typeof window)return window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}()||"undefined"!=typeof navigator&&/webview/i.test(navigator.userAgent)||"undefined"!=typeof navigator&&/ldclient/i.test(navigator.userAgent))return!0;
|
|
22483
22483
|
// 2. 服务级别配置的特殊浏览器
|
|
22484
22484
|
if(e.some((function(e){return new RegExp(e,"i").test(navigator.userAgent)})))return!0;
|
|
22485
22485
|
// 3. 利用 ua-parser-js 进一步判断,筛选出很可能不是特殊浏览器的 UA
|
|
@@ -27477,7 +27477,7 @@ var zD=i(4232),$D=i(4631),HD=i(1062),WD=i(8787),GD={zhCN:zD/* default */.Z,enUS:
|
|
|
27477
27477
|
* 多账号 状态
|
|
27478
27478
|
*/
|
|
27479
27479
|
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},tL=y().createContext(eL),nL=y().createContext({spin:!1,spinChange:function(){}}),rL=function(){return QD(nL)},oL=function(){return QD(tL).publicConfig},iL=function(){return QD(tL).httpClient},aL=function(){return QD(tL).isSpecialBrowser},sL=function(){return QD(tL).appId},cL=function(){return QD(tL).tenantId};function lL(){return QD(tL).initData}var uL=function(){return QD(tL).currentModule},dL=function(){return QD(tL).events},fL=function(){var e=QD(tL);return{changeModule:e.changeModule,backModule:e.backModule,currentModule:e.currentModule}},pL=function(){return QD(tL).finallyConfig},hL=function(){return QD(tL).isAuthFlow},mL=function(){return QD(tL).multipleInstance},vL=function(){return QD(tL).phoneRegex},gL=function(){return QD(tL).defaultLanguageConfig},yL=function(){var e=oL(),t=e.customSecurityEnabled,n=e.appRobotVerify,r=e.userpoolRobotVerify;return t?n:r},bL=function(e){var t,n,r=oL(),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},wL=y().useMemo,CL={"zh-CN":{label:"简体中文"},"zh-TW":{label:"繁體中文"},"en-US":{label:"English"},"ja-JP":{label:"日本語"}},EL=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=QD(tL).guardPageConfig,a=pL(),s=wL((function(){return"g2-change-language-text ".concat(a.mode)}),[a]),c=wL((function(){var e;return null===(e=i.global)||void 0===e?void 0:e.showChangeLanguage}),[i]),l=wL((function(){return Object.keys(CL).includes(o.resolvedLanguage)?o.resolvedLanguage:dd(o.resolvedLanguage)[0]||"en-US"}),[o.resolvedLanguage]),u=wL((function(){return y().createElement(y().Fragment,null,y().createElement("span",null,CL[l].label))}),[l]),d=wL((function(){return Object.keys(CL).filter((function(e){return n.includes(e)})).map((function(e){return{key:e,label:CL[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(wP,{menu:f,trigger:["click"],placement:"bottom",overlayClassName:"authing-g2-change-language-menu"},y().createElement("span",{className:s},u,y().createElement(YD,{type:"authing-arrow-down-s-fill",className:"down-fill-svg"}))))};// CONCATENATED MODULE: ./package.json
|
|
27480
|
-
const kL=JSON.parse('{"i8":"4.5.40-alpha.
|
|
27480
|
+
const kL=JSON.parse('{"i8":"4.5.40-alpha.2"}');// CONCATENATED MODULE: ./src/_utils/getVersion.ts
|
|
27481
27481
|
function SL(){return kL.i8}// CONCATENATED MODULE: ./src/_utils/flowHandleStorage.ts
|
|
27482
27482
|
var xL,_L=function(){return xL},PL=function(e){xL=e},TL=function(){return TL=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},TL.apply(this,arguments)},OL=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())}))},NL=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])}}},IL=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},AL=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))},RL=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return OL(void 0,void 0,void 0,(function(){return NL(this,(function(t){switch(t.label){case 0:return[4/*yield*/,fetch.apply(void 0,AL([],IL(e),!1))];case 1:return[2/*return*/,t.sent().json()]}}))}))},ML=function(e){return new Promise((function(t){setTimeout((function(){t({data:{code:-1}}),e()}),1e4)}))};RL.get=function(e,t,n){return void 0===t&&(t={}),OL(void 0,void 0,void 0,(function(){var r,o,i,a,s;return NL(this,(function(c){switch(c.label){case 0:r=TL(TL({},null==n?void 0:n.headers),((s={"Content-Type":"application/json"})[RL.langHeader]=_X(),s)),""!==RL.tenantId&&(r[RL.tenantHeader]=RL.tenantId),c.label=1;case 1:return c.trys.push([1,3,,4]),o=ma().CancelToken,i=o.source(),[4/*yield*/,Promise.race([ML(i.cancel),ma()("".concat(RL.baseUrl).concat(e).concat(jc().stringify(t,{addQueryPrefix:!0})),TL(TL({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*/]}}))}))},RL.post=function(e,t,n){return OL(void 0,void 0,void 0,(function(){var r,o,i,a,s,c;return NL(this,(function(l){switch(l.label){case 0:r=TL(TL({},null==n?void 0:n.headers),((s={"Content-Type":"application/json"})[RL.langHeader]=cu.resolvedLanguage,s)),""!==RL.tenantId&&(r[RL.tenantHeader]=RL.tenantId),l.label=1;case 1:return l.trys.push([1,3,,4]),o=ma().CancelToken,i=o.source(),[4/*yield*/,Promise.race([ML(i.cancel),ma()("".concat(RL.baseUrl).concat(e),{data:t,method:"POST",withCredentials:!0,cancelToken:i.token,headers:TL(TL({"Content-Type":"application/json"},null==n?void 0:n.headers),(c={},c[RL.langHeader]=_X(),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*/]}}))}))},RL.postForm=function(e,t,n){return OL(void 0,void 0,void 0,(function(){var r,o,i,a;return NL(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),r=ma().CancelToken,o=r.source(),[4/*yield*/,Promise.race([ML(o.cancel),ma()("".concat(RL.baseUrl).concat(e),{method:"POST",data:t,withCredentials:!0,cancelToken:o.token,headers:TL(TL({},null==n?void 0:n.headers),(a={},a[RL.langHeader]=_X(),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*/]}}))}))},RL.baseUrl="",RL.setBaseUrl=function(e){RL.baseUrl=e.replace(/\/$/,"")};var DL,LL="x-authing-lang";RL.langHeader=LL,RL.tenantHeader="x-authing-app-tenant-idåå",RL.tenantId="",RL.setLangHeader=function(e){RL.langHeader=e||LL},RL.setTenantHeader=function(e){RL.tenantHeader=e||LL},RL.setTenantId=function(e){RL.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",
|
|
27483
27483
|
/** 多租户门户选择页 */
|
|
@@ -28336,21 +28336,21 @@ return(null==u?void 0:u.autoRegister)?l("login.inputAccount",{text:OX(t,x,f)}):l
|
|
|
28336
28336
|
function ZW(e){var t=Pu().t;return y().createElement(y().Fragment,null,y().createElement("div",{className:"pending-tips"},y().createElement("div",{className:"code-success"},y().createElement(YD,{type:"authing-checkbox-circle-fill"})),y().createElement("div",null,t("login.otpLoginPendingText"))),y().createElement(sT,null,y().createElement(sT.Item,{className:"authing-g2-sumbit-form"},y().createElement(cy,{block:!0,style:{width:"348px",height:"44px",background:"#F2F3F5",borderRadius:"4px",border:"none"},onClick:function(){e.onCancelLogin()}},t("login.authingOtpPushCancelLogin")))))}// CONCATENATED MODULE: ./src/Login/core/withAuthingOtpPush/index.tsx
|
|
28337
28337
|
var QW=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())}))},XW=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])}}},eG=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},tG=y().useCallback,nG=y().useEffect,rG=y().useRef,oG=y().useState;function iG(e){var t=this,n=e.onLoginSuccess,r=e.multipleInstance,o=e.agreements,i=eG(oG("before"),2),a=i[0],s=i[1],c=eG(oG(""),2),l=c[0],u=c[1],d=eG(oG(!0),2),f=d[0],p=d[1],h=rG(),m=eG(oG(""),2),v=m[0],g=m[1],b=function(){h.current&&clearInterval(h.current)},w=YQ(),C=w.post,E=w.get,k=oL(),S=tG((function(){b(),s("before")}),[]),x=tG((function(e){void 0===e&&(e=!0),p(e)}),[]),_=tG((function(e){return QW(t,void 0,void 0,(function(){var t,n;return XW(this,(function(r){switch(r.label){case 0:return t=e.pushCodeId,n="/api/v3/check-pushcode-status?pushCodeId=".concat(t),[4/*yield*/,E(n)];case 1:return[2/*return*/,r.sent()]}}))}))}),[E]),P=tG((function(e){return QW(t,void 0,void 0,(function(){var t;return XW(this,(function(n){switch(n.label){case 0:return"/api/v2/users/me/info",t={headers:{"x-authing-userpool-id":k.userPoolId,authorization:"Bearer ".concat(e)}},[4/*yield*/,E("/api/v2/users/me/info",{},t)];case 1:return[2/*return*/,n.sent()]}}))}))}),[E,k.userPoolId]),T=function(){return QW(t,void 0,void 0,(function(){var e,t,o,i,a,s,c,u,d;return XW(this,(function(f){switch(f.label){case 0:return[4/*yield*/,_({pushCodeId:l})];case 1:return e=f.sent(),t=e.statusCode,o=e.data,i=e.message,200!==t?(vC.error(i),S(),[2/*return*/]):"AUTHORIZED"!==o.status?[3/*break*/,3]:(a=o.tokenSet.access_token,b(),[4/*yield*/,P(a)]);case 2:if(s=f.sent(),c=s.code,u=s.data,d=s.message,200===c)return null==r||r.setLoginWay("input",zs.AuthingOtpPush),n(u,d),[2/*return*/];f.label=3;case 3:return"PUSHED"!==o.status&&(p(!1),S()),[2/*return*/]}}))}))};nG((function(){if(l)return h.current=setInterval(T,1e3),function(){b()}}),[l,_,P,n,S]);var O={before:y().createElement(JW,{defaultAccount:v,setAccount:g,onPushSuccess:function(e){s("pending"),u(e.pushCodeId)},signinByPush:function(e){return QW(t,void 0,void 0,(function(){var t,n;return XW(this,(function(r){switch(r.label){case 0:return t=e.account,n=e.agreementIds,"/api/v3/signin-by-push",[4/*yield*/,C("/api/v3/signin-by-push",{account:t,agreementIds:n})];case 1:return[2/*return*/,r.sent()]}}))}))},pushLoginStatus:f,onchangePushLoginStatus:x,agreements:o}),pending:y().createElement(ZW,{onCancelLogin:S})};return y().createElement("div",null,O[a])}// CONCATENATED MODULE: ./src/Login/socialLogin/postMessage.ts
|
|
28338
28338
|
// 处理所有使用 postMessage 方式的登录
|
|
28339
|
-
var aG=function(){return aG=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},aG.apply(this,arguments)},sG=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())}))},cG=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])}}},lG=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},uG=SL(),dG=y().useCallback,fG=y().useEffect,pG=y().useState,hG=(y().useMemo,function(e){var t=e.QRConfig,n=e.id,r=
|
|
28339
|
+
var aG=function(){return aG=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},aG.apply(this,arguments)},sG=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())}))},cG=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])}}},lG=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},uG=SL(),dG=y().useCallback,fG=y().useEffect,pG=y().useState,hG=(y().useMemo,function(e){var t=e.QRConfig,n=e.id,r=lG(pG(!0),2),o=r[0],i=r[1],a=iL().get,s=cL(),c=sL(),l=pL(),u=oL(),d=dL(),f=YL(),p=aL(),h=dG((function(){return sG(void 0,void 0,void 0,(function(){var e,r,o,a,d;return cG(this,(function(f){return e=window.WwLogin,r=aG({from_guard:"1",app_id:c,guard_version:"Guard@".concat(uG)},s&&{tenant_id:s}),(null==l?void 0:l.isHost)&&(delete r.from_guard,r.from_hosted_guard="1",p&&(r.redirected="1",(o=MX())&&(
|
|
28340
28340
|
// 如果 isHost 是 true,则从 url 获取 finish_login_url 作为 social.authorize 方法的 targetUrl 参数
|
|
28341
|
-
|
|
28341
|
+
r.redirect_url=null===(d=jc().parse(o.location.search))||void 0===d?void 0:d.finish_login_url))),(a=new e({id:"weCom_qrcode_wrapper-".concat(n),appid:t.corpId,agentid:t.agentId,redirect_uri:encodeURIComponent("".concat(t.redirectUrl,"?").concat(jc().stringify(r))),
|
|
28342
28342
|
// redirect_uri,
|
|
28343
|
-
href:"".concat(null==
|
|
28343
|
+
href:"".concat(null==u?void 0:u.cdnBase,"/guard-assets/wrp_code_friesland.css"),lang:cu.resolvedLanguage.includes("zh")?"zh":"en"})).frame.onload=function(e){i(!1),a.frame.contentWindow.postMessage&&a.frame.contentWindow.postMessage("ask_usePostMessage","*")},[2/*return*/]}))}))}),[t.agentId,t.corpId,t.redirectUrl,c,null==l?void 0:l.isHost,n,null==u?void 0:u.cdnBase,s]);return fG((function(){h()}),[h]),fG((function(){var n=function(n){return sG(void 0,void 0,void 0,(function(){var r,o,i,s;return cG(this,(function(c){switch(c.label){case 0:if(!IX(n))return[3/*break*/,6];c.label=1;case 1:return c.trys.push([1,5,,6]),(null==d?void 0:d.onBeforeLogin)?[4/*yield*/,null==d?void 0:d.onBeforeLogin({type:zs.WechatworkCorpQrconnect,data:n.data},f)]:[3/*break*/,3];case 2:if(!c.sent())return[2/*return*/];c.label=3;case 3:return r=new URL(n.data).search,[4/*yield*/,a("/api/v1/qrcode/".concat(t.identifier,"/verify").concat(r))];case 4:return 200===(o=c.sent()).code?(e.multipleInstance&&e.multipleInstance.setLoginWay("qrcode",zs.WechatworkCorpQrconnect,e.id),e.onLoginSuccess(o.data)):
|
|
28344
28344
|
// 向上层抛出错误
|
|
28345
|
-
(null===(
|
|
28345
|
+
(null===(s=null==o?void 0:o.onGuardHandling)||void 0===s?void 0:s.call(o))===kQ.RENDER_MESSAGE&&e.onLoginFailed(o.code,o.data),[3/*break*/,6];case 5:return i=c.sent(),vC.error(i.message),[3/*break*/,6];case 6:return[2/*return*/]}}))}))};return o||window.addEventListener("message",n,!1),function(){window.removeEventListener("message",n,!1)}}),[t.identifier,f,d,a,o,e]),y().createElement("div",{className:"wecom_container"},o&&y().createElement(uF,null),y().createElement("div",{id:"weCom_qrcode_wrapper-".concat(n),style:{display:o?"none":""}}))}),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)},vG=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())}))},gG=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])}}},yG=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},bG=SL(),wG=y().useCallback,CG=y().useEffect,EG=y().useState,kG=function(e){var t=e.QRConfig,n=e.id,r=yG(EG(!0),2),o=r[0],i=r[1],a=iL().get,s=cL(),c=sL(),l=dL(),u=YL(),d=pL(),f=aL(),p=wG((function(){return vG(void 0,void 0,void 0,(function(){var r,o,p,h,m,v;return gG(this,(function(g){return r=window.DTFrameLogin,o=mG({from_guard:"1",embedded:"1",app_id:c,guard_version:"Guard@".concat(bG)},s&&{tenant_id:s}),p=MX(),(null==d?void 0:d.isHost)&&(delete o.from_guard,o.from_hosted_guard="1",f&&(o.redirected="1",p&&(
|
|
28346
28346
|
// 如果 isHost 是 true,则从 url 获取 finish_login_url 作为 social.authorize 方法的 targetUrl 参数
|
|
28347
|
-
o.redirect_url=null===(m=jc().parse(
|
|
28347
|
+
o.redirect_url=null===(m=jc().parse(p.location.search))||void 0===m?void 0:m.finish_login_url))),h=r({id:"dingtalk_qrcode_wrapper-".concat(n),width:"100%",height:388},{redirect_uri:encodeURIComponent("".concat(d.isHost?t.redirectUrl:null===(v=null==p?void 0:p.location)||void 0===v?void 0:v.origin,"?").concat(jc().stringify(o))),client_id:t.clientId,scope:"openid",response_type:"code",
|
|
28348
28348
|
// state: 'xxxxxxxxx',
|
|
28349
|
-
prompt:"consent"},(function(n){return vG(void 0,void 0,void 0,(function(){var r,i,
|
|
28349
|
+
prompt:"consent"},(function(n){return vG(void 0,void 0,void 0,(function(){var r,i,s,c;return gG(this,(function(d){switch(d.label){case 0:r=n.authCode,d.label=1;case 1:return d.trys.push([1,5,,6]),(null==l?void 0:l.onBeforeLogin)?[4/*yield*/,null==l?void 0:l.onBeforeLogin({type:zs.WechatworkCorpQrconnect,data:n},u)]:[3/*break*/,3];case 2:if(!d.sent())return[2/*return*/];d.label=3;case 3:return[4/*yield*/,a("/api/v1/qrcode/".concat(t.identifier,"/verify?").concat(jc().stringify(o),"&code=").concat(r))];case 4:return 200===(i=d.sent()).code?(e.multipleInstance&&e.multipleInstance.setLoginWay("qrcode",zs.DingTalkQrcode,e.id),e.onLoginSuccess(i.data)):
|
|
28350
28350
|
// 向上层抛出错误
|
|
28351
|
-
(null===(c=null==i?void 0:i.onGuardHandling)||void 0===c?void 0:c.call(i))===kQ.RENDER_MESSAGE&&e.onLoginFailed(i.code,i.data),[3/*break*/,6];case 5:return
|
|
28351
|
+
(null===(c=null==i?void 0:i.onGuardHandling)||void 0===c?void 0:c.call(i))===kQ.RENDER_MESSAGE&&e.onLoginFailed(i.code,i.data),[3/*break*/,6];case 5:return s=d.sent(),vC.error(s.message),[3/*break*/,6];case 6:return[2/*return*/]}}))}))}),(function(e){})),
|
|
28352
28352
|
// frame 页面二维码加载完毕
|
|
28353
|
-
h.onload=function(){setTimeout((function(){
|
|
28353
|
+
h.onload=function(){setTimeout((function(){i(!1)}),500)},[2/*return*/]}))}))}),[t,c,null==d?void 0:d.isHost,s]);return CG((function(){p()}),[p]),y().createElement("div",{className:"wecom_container"},o&&y().createElement(uF,{className:"dingtalk_loading"}),y().createElement("div",{id:"dingtalk_qrcode_wrapper-".concat(n),style:{visibility:o?"hidden":"visible"}}))},SG=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())}))},xG=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])}}},_G=y().useRef,PG=function(e){var t=_G(),n=e.canLoop,r=e.qrConfig,o=e.qrCodeScanOptions,i=iL().responseIntercept,a=dL(),s=YL(),c=Pu().t;if(!n)return null;var l={already:function(e){return y().createElement("span",{className:"qrcode__again-scan",onClick:e},c("login.scanAgain"))},ready:c("login.zjzwScanLogin"),success:c("common.LoginSuccess"),MFA:c("common.LoginSuccess")};
|
|
28354
28354
|
/**
|
|
28355
28355
|
* Sever Status 发生变化
|
|
28356
28356
|
* @param status
|
|
@@ -14,8 +14,8 @@ export declare const isEdgeBrowser: () => boolean;
|
|
|
14
14
|
export declare const isWeiboBrowser: () => boolean | null;
|
|
15
15
|
export declare const isAlipayBrowser: () => boolean | null;
|
|
16
16
|
export declare const isBaiduBrowser: () => boolean | null;
|
|
17
|
-
export declare const isWeComeBrowser: () => boolean;
|
|
18
|
-
export declare const isMobile: () => RegExpMatchArray | null;
|
|
17
|
+
export declare const isWeComeBrowser: () => boolean | null;
|
|
18
|
+
export declare const isMobile: () => RegExpMatchArray | null | undefined;
|
|
19
19
|
export declare const isWebview: () => boolean | null;
|
|
20
20
|
export declare const isLenovoNetdisk: () => boolean | null;
|
|
21
21
|
export declare const computeIsSpecialBrowser: (specialBrowserSymbol?: string[]) => boolean;
|
package/package.json
CHANGED