@authing/guard-shim-react 4.5.40-alpha.13 → 4.5.40-alpha.14
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 +17 -16
- package/dist/typings/src/Guard/core/hooks/useMultipleAccounts.d.ts +2 -2
- package/dist/typings/src/Login/hooks/useLoginMultiple.d.ts +2 -2
- package/dist/typings/src/_utils/compute.d.ts +1 -1
- package/dist/typings/src/_utils/config/index.d.ts +1 -1
- package/dist/typings/src/_utils/context.d.ts +1 -1
- package/package.json +1 -1
package/dist/guard.min.js
CHANGED
|
@@ -22479,14 +22479,14 @@ e.VERIFY_CODE="VERIFY_CODE"}(Nc||(Nc={})),function(e){e.Day="DAY",e.Month="MONTH
|
|
|
22479
22479
|
// EXTERNAL MODULE: ./node_modules/ua-parser-js/src/ua-parser.js
|
|
22480
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;
|
|
22481
22481
|
// 1. 首先筛选出一定是特殊浏览器的 UA
|
|
22482
|
-
if(void 0===e&&(e=[]),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)||
|
|
22482
|
+
if(void 0===e&&(e=[]),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)||"undefined"!=typeof window&&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
|
|
22486
22486
|
// 由于一些特殊浏览器也可能会被误判为非特殊,所以需要首先经过第 1, 2 步筛选
|
|
22487
22487
|
var n=Lc()();return!["Chrome","Firefox","Safari","Opera","IE","Edge"].includes(null!==(t=n.browser.name)&&void 0!==t?t:"");
|
|
22488
22488
|
// 4. 可能有一些 UA 没有任何特征,这种情况下一律默认为特殊浏览器
|
|
22489
|
-
},zc=function(){var e=jc().parse(window.location.search,{ignoreQueryPrefix:!0});try{if(e.login_page_context)return JSON.parse(e.login_page_context).phone||""}catch(e){return""}},$c=i(7061),Hc=i.n($c);// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
22489
|
+
},zc=function(){if("undefined"==typeof window)return"";var e=jc().parse(window.location.search,{ignoreQueryPrefix:!0});try{if(e.login_page_context)return JSON.parse(e.login_page_context).phone||""}catch(e){return""}},$c=i(7061),Hc=i.n($c);// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
22490
22490
|
function Wc(e){return Wc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wc(e)}// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
22491
22491
|
function Gc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
22492
22492
|
function Kc(e){var t=// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
@@ -27477,7 +27477,7 @@ var $D=i(4232),HD=i(4631),WD=i(1062),GD=i(8787),KD={zhCN:$D/* 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},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(fd)?fd:dd(fd)[0]||"en-US"}),[fd]),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(CP,{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
|
|
27480
|
-
const SL=JSON.parse('{"i8":"4.5.40-alpha.
|
|
27480
|
+
const SL=JSON.parse('{"i8":"4.5.40-alpha.14"}');// CONCATENATED MODULE: ./src/_utils/getVersion.ts
|
|
27481
27481
|
function xL(){return SL.i8}// CONCATENATED MODULE: ./src/_utils/flowHandleStorage.ts
|
|
27482
27482
|
var _L,PL=function(){return _L},TL=function(e){_L=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=ma().CancelToken,i=o.source(),[4/*yield*/,Promise.race([DL(i.cancel),ma()("".concat(ML.baseUrl).concat(e).concat(jc().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]=cu.resolvedLanguage,s)),""!==ML.tenantId&&(r[ML.tenantHeader]=ML.tenantId),l.label=1;case 1:return l.trys.push([1,3,,4]),o=ma().CancelToken,i=o.source(),[4/*yield*/,Promise.race([DL(i.cancel),ma()("".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=ma().CancelToken,o=r.source(),[4/*yield*/,Promise.race([DL(o.cancel),ma()("".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",
|
|
27483
27483
|
/** 多租户门户选择页 */
|
|
@@ -28072,7 +28072,7 @@ o.redirect_url=null===(t=jc().parse(i.location.search))||void 0===t?void 0:t.fin
|
|
|
28072
28072
|
// 托管登录页,直接写死登录 URL
|
|
28073
28073
|
o.identifier=e.identifier;var a=iF[e.protocol];if(!a)return null;r="".concat(n).concat(a,"?").concat(jc().stringify(o))}else{var s=aF[e.protocol];if(!s)return null;
|
|
28074
28074
|
// 嵌入式组件,从配置字段获取登录 URL
|
|
28075
|
-
r=e.config[s]}o.redirected
|
|
28075
|
+
r=e.config[s]}if(o.redirected){if("undefined"==typeof window)return;window.location.replace(r)}else ZQ(r)}(s.identityProvider):ne("fail"),[3/*break*/,6];case 4:return[4/*yield*/,ae(o)];case 5:c=g.sent(),ce(c,t.account),g.label=6;case 6:return[3/*break*/,9];case 7:throw g.sent();case 8:
|
|
28076
28076
|
// 图形验证码出现后,不管是「图形验证码」错了,还是「账号」「密码」错了,都要重新发验证码
|
|
28077
28077
|
return z&&$(jz(e.host)),[7/*endfinally*/];case 9:return[2/*return*/]}}))}))},onFinishFailed:function(){return j.current.onError()},autoComplete:"off",form:f,onValuesChange:function(e){(null==e?void 0:e.account)&&a&&a(zs.Password,null==e?void 0:e.account)}},y().createElement(hz,{name:"account",className:"authing-g2-input-form",validPasswordLoginMethods:(null===(t=null==M?void 0:M.passwordTabConfig)||void 0===t?void 0:t.validLoginMethods)||[],initialValue:w===zs.Password?b:""},y().createElement(yz,{className:"authing-g2-input",autoComplete:"off",size:"large",autoFocus:!x,prefix:y().createElement(JD,{type:"authing-a-user-line1",style:{color:"#878A95"}}),
|
|
28078
28078
|
// onChange={e => {
|
|
@@ -28259,11 +28259,11 @@ var t=e.i,n=e.appId,r=e.appHost,o=e.isHost,i=Pu().t,a=lL(),s=xL(),c=sL(),l=_H((f
|
|
|
28259
28259
|
// 如果 isHost 是 true,则从 url 获取 finish_login_url 作为 social.authorize 方法的 targetUrl 参数
|
|
28260
28260
|
u.redirect_url=null===(e=jc().parse(d.location.search))||void 0===e?void 0:e.finish_login_url)}if(null==t?void 0:t.provider){
|
|
28261
28261
|
// 社交身份源
|
|
28262
|
-
var f="authing-".concat(t.provider.replace(/:/g,"-"));return y().createElement(wj,{key:t.identifier,className:"g2-guard-third-login-btn",block:!0,size:"large",icon:y().createElement(JD,{type:"".concat(f,"-fill"),style:{fontSize:20,marginRight:8}}),onClick:function(){var e,n;if(t.action===sj.Message)gC.error(i("login.socialConnectionMessage",{provider:null!==(n=null!==(e=t.displayName)&&void 0!==e?e:"zh-CN"===cu.resolvedLanguage?t.name:t.name_en)&&void 0!==n?n:t.provider}));else if(t.action===sj.Auth){var o="".concat(r,"/connections/social/").concat(t.identifier,"?").concat(jc().stringify(u));u.redirected
|
|
28262
|
+
var f="authing-".concat(t.provider.replace(/:/g,"-"));return y().createElement(wj,{key:t.identifier,className:"g2-guard-third-login-btn",block:!0,size:"large",icon:y().createElement(JD,{type:"".concat(f,"-fill"),style:{fontSize:20,marginRight:8}}),onClick:function(){var e,n;if(t.action===sj.Message)gC.error(i("login.socialConnectionMessage",{provider:null!==(n=null!==(e=t.displayName)&&void 0!==e?e:"zh-CN"===cu.resolvedLanguage?t.name:t.name_en)&&void 0!==n?n:t.provider}));else if(t.action===sj.Auth){var o="".concat(r,"/connections/social/").concat(t.identifier,"?").concat(jc().stringify(u));if(u.redirected){if("undefined"==typeof window)return;window.location.replace(o)}else ZQ(o)}}},i("login.loginBy",{name:t.displayName}))}if(o){
|
|
28263
28263
|
// 托管登录页,直接写死登录 URL
|
|
28264
28264
|
u.identifier=t.identifier;var p=iF[t.protocol];if(!p)return null;l="".concat(r).concat(p,"?").concat(jc().stringify(u))}else{var h=aF[t.protocol];if(!h)return null;
|
|
28265
28265
|
// 嵌入式组件,从配置字段获取登录 URL
|
|
28266
|
-
l=t.config[h]}return y().createElement(wj,{key:t.identifier,className:"g2-guard-third-login-btn",block:!0,size:"large",icon:y().createElement(bv,{size:20,src:t.logo,style:{marginRight:8}}),onClick:function(){u.redirected
|
|
28266
|
+
l=t.config[h]}return y().createElement(wj,{key:t.identifier,className:"g2-guard-third-login-btn",block:!0,size:"large",icon:y().createElement(bv,{size:20,src:t.logo,style:{marginRight:8}}),onClick:function(){if(u.redirected){if("undefined"==typeof window)return;window.location.replace(l)}else ZQ(l)}},i("login.loginBy",{name:t.displayName}))}),[n,t,i,o,r,a]);return l()};// CONCATENATED MODULE: ./node_modules/@github/webauthn-json/dist/esm/webauthn-json.js
|
|
28267
28267
|
// src/webauthn-json/base64url.ts
|
|
28268
28268
|
function TH(e){const t="==".slice(0,(4-e.length%4)%4),n=e.replace(/-/g,"+").replace(/_/g,"/")+t,r=atob(n),o=new ArrayBuffer(r.length),i=new Uint8Array(o);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return o}function OH(e){const t=new Uint8Array(e);let n="";for(const e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}
|
|
28269
28269
|
// src/webauthn-json/convert.ts
|
|
@@ -28276,7 +28276,7 @@ function(e){return AH(TH,BH,e)}(e));return function(e){return AH(OH,UH,e)}(t)}as
|
|
|
28276
28276
|
// CONCATENATED MODULE: ./src/Login/socialLogin/PasskeyButton/index.tsx
|
|
28277
28277
|
var HH,WH=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())}))},GH=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])}}},KH=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},YH=y().useCallback,JH=function(e){var t=e.onLoginFailed,n=e.onLoginSuccess,r=iL(),o=KH((0,g.useState)(),2),i=o[0],a=o[1],s=KH((0,g.useState)(!1),2),c=s[0],l=s[1],u=hL().host,d=cL(),f=xL(),p=aL().responseIntercept,h=Pu().t,m=YH((function(){return!!r.passkeyEnabled&&!!(navigator.credentials&&navigator.credentials.create&&navigator.credentials.get&&window.PublicKeyCredential)}),[r]);return y().createElement(y().Fragment,null,m()&&y().createElement(wj,{className:"g2-guard-third-login-btn",block:!0,loading:c,size:"large",onClick:function(){return WH(void 0,void 0,void 0,(function(){var e,o,s,c,h,m,v,g,y,b,w,C,E,k,S,x,_;return GH(this,(function(P){switch(P.label){case 0:l(!0),P.label=1;case 1:return P.trys.push([1,7,8,9]),e="".concat(u,"/api/v3/webauthn/login/initialize"),[4/*yield*/,fetch(e,{method:"POST",body:JSON.stringify({}),credentials:"include",headers:(x={"Content-Type":"application/json"},x[ML.langHeader]=fd,x["x-authing-userpool-id"]=r.userPoolId,x["x-authing-app-id"]=d,x["x-authing-sdk-version"]=f,x["x-authing-request-from"]="Guard@".concat(f),x)})];case 2:return[4/*yield*/,P.sent().json()];case 3:return o=P.sent(),s=p(o),c=s.statusCode,h=s.data,m=s.message,200!==c?(t(c,void 0,m),[2/*return*/]):(h.mediation="required",h.signal=function(){i&&i.abort();var e=new AbortController;return a(e),e.signal}(),v=h.ticket,[4/*yield*/,$H(h)]);case 4:return g=P.sent(),y="".concat(u,"/api/v3/webauthn/login/finalize"),[4/*yield*/,fetch(y,{method:"POST",body:JSON.stringify({credential:g,ticket:v}),credentials:"include",headers:(_={"Content-Type":"application/json"},_[ML.langHeader]=fd,_["x-authing-userpool-id"]=r.userPoolId,_["x-authing-app-id"]=d,_["x-authing-sdk-version"]=f,_["x-authing-request-from"]="Guard@".concat(f),_)})];case 5:return[4/*yield*/,P.sent().json()];case 6:return b=P.sent(),w=p(b),C=w.statusCode,E=w.data,k=w.message,200!==C?(t(C,void 0,k),[2/*return*/]):(n(E),[3/*break*/,9]);case 7:return S=P.sent(),t(500,void 0,S.message),[3/*break*/,9];case 8:return l(!1),[7/*endfinally*/];case 9:return[2/*return*/]}}))}))},icon:y().createElement(JD,{type:"authing-slideshow-3-line",style:{fontSize:16,marginRight:8,color:"#215AE5"}})},h("login.loginWithPasskey")))},ZH=function(e){var t,n=e.appId,r=e.config,o=e.enterpriseConnectionObjs,i=e.socialConnectionObjs,a=e.onLoginSuccess,s=e.onLoginFailed,c=!(null===(t=null==r?void 0:r.loginMethods)||void 0===t?void 0:t.length),l=iL(),u=null==l?void 0:l.userPoolId,d=Pu().t,f=mj().isPhoneMedia,p=lL(),h=sL(),m=o.map((function(e){return y().createElement(PH,{key:e.identifier,i:e,appId:n,appHost:null==r?void 0:r.host,userPoolId:u,isHost:null==r?void 0:r.isHost})})),v=i.map((function(e){var t,o,i,a,s,l,u,m="authing-".concat(e.provider.replace(/:/g,"-")),v=xL(),g={from_guard:"1",app_id:n,guard_version:"Guard@".concat(v)};if(p&&(g.tenant_id=p),(null==r?void 0:r.isHost)&&(g.from_hosted_guard="1",h)){g.redirected="1";var b=DX();b&&(
|
|
28278
28278
|
// 如果 isHost 是 true,则从 url 获取 finish_login_url 作为 social.authorize 方法的 targetUrl 参数
|
|
28279
|
-
g.redirect_url=null===(t=SH.parse(b.location.search))||void 0===t?void 0:t.finish_login_url)}var w=function(){var t,n;if(e.action===sj.Message)gC.error(d("login.socialConnectionMessage",{provider:null!==(n=null!==(t=e.displayName)&&void 0!==t?t:"zh-CN"===cu.resolvedLanguage?e.name:e.name_en)&&void 0!==n?n:e.provider}));else if(e.action===sj.Auth){var o="".concat(r.host,"/connections/social/").concat(e.identifier,"?").concat(SH.stringify(g));g.redirected
|
|
28279
|
+
g.redirect_url=null===(t=SH.parse(b.location.search))||void 0===t?void 0:t.finish_login_url)}var w=function(){var t,n;if(e.action===sj.Message)gC.error(d("login.socialConnectionMessage",{provider:null!==(n=null!==(t=e.displayName)&&void 0!==t?t:"zh-CN"===cu.resolvedLanguage?e.name:e.name_en)&&void 0!==n?n:e.provider}));else if(e.action===sj.Auth){var o="".concat(r.host,"/connections/social/").concat(e.identifier,"?").concat(SH.stringify(g));if(g.redirected){if("undefined"==typeof window)return;window.location.replace(o)}else ZQ(o)}},C=r.socialConnectionsBtnShape;return"button"===C?y().createElement(wj,{key:e.id,block:!0,size:"large",className:"g2-guard-third-login-btn",icon:y().createElement(JD,{type:"".concat(m,"-fill"),style:{fontSize:20,marginRight:8}}),onClick:w,style:{marginBottom:8}},null!==(i=null!==(o=e.displayName)&&void 0!==o?o:"zh-CN"===cu.resolvedLanguage?e.name:e.name_en)&&void 0!==i?i:e.provider):"icon"===C?f?y().createElement(wj,{className:"g2-social-login-item",onClick:w,icon:y().createElement(JD,{type:"".concat(m,"-fill")})}):y().createElement(fv,{key:e.id,title:(null===(a=e.tooltip)||void 0===a?void 0:a[cu.resolvedLanguage])||e.name,trigger:["hover","click","contextMenu"]},y().createElement(wj,{className:"g2-social-login-item",onClick:w,icon:y().createElement(JD,{type:"".concat(m,"-fill")})})):c?y().createElement(wj,{key:e.id,block:!0,size:"large",className:"g2-guard-third-login-btn",icon:y().createElement(JD,{type:"".concat(m,"-fill"),style:{fontSize:20,marginRight:8}}),onClick:w},null!==(l=null!==(s=e.displayName)&&void 0!==s?s:"zh-CN"===cu.resolvedLanguage?e.name:e.name_en)&&void 0!==l?l:e.provider):f?y().createElement(wj,{className:"g2-social-login-item",onClick:w,key:e.id,icon:y().createElement(JD,{type:"".concat(m,"-fill")})}):y().createElement(fv,{overlayStyle:{fontFamily:"sans-serif"},key:e.id,title:e.displayName||(null===(u=e.tooltip)||void 0===u?void 0:u[cu.resolvedLanguage])||e.name,trigger:["hover","click","contextMenu"]},y().createElement(wj,{className:"g2-social-login-item",onClick:w,icon:y().createElement(JD,{type:"".concat(m,"-fill")})}))})),g=o.length?y().createElement(y().Fragment,null,!c&&y().createElement("div",{className:"g2-social-login-title"},cu.t("login.otherLoginWay")),y().createElement("div",{className:"g2-social-login-list g2-enterprise-connection-space"},m)):null,b=v.length>0&&c?y().createElement(mP,{size:c?0:12,className:"g2-guard-full-width-space no-login-methods",direction:"vertical"},v):v.length>0&&y().createElement(y().Fragment,null,y().createElement("div",{className:"g2-social-login-title"},d("login.thridAccLogin")),y().createElement("div",{className:"g2-social-login-list g2-social-connection-space"},v)),w=y().createElement("div",{className:"g2-social-login-list",style:{marginTop:-8}},y().createElement(JH,{onLoginSuccess:a,onLoginFailed:s}));return y().createElement(y().Fragment,null,!c&&y().createElement("div",{style:{flex:1,minHeight:16}}),y().createElement(mP,{size:c?0:8,direction:"vertical",className:"g2-guard-full-width-space"},!(null==l?void 0:l.ssoPageComponentDisplay.idpBtns)||g,w,!(null==l?void 0:l.ssoPageComponentDisplay.socialLoginBtns)||b))},QH=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},XH=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))},eW=y().useMemo,tW=y().useCallback,nW=function(e){var t=e.lists,n=e.handleDel,r=e.onClick,o=Pu().t,i=mj().isPhoneMedia,a=eW((function(){return i?"click":"hover"}),[i]),s=eW((function(){return XH(XH([],QH(t),!1),[{operation:!1,id:"other",title:o("login.useOtherAccount"),element:y().createElement("div",{className:"g2-multiple__icon--add-line"},y().createElement(JD,{style:{fontSize:24,color:"#4E5969"},type:"authing-add-line"}))}],!1)}),[t,o]),c=tW((function(e,t){n(t),e.stopPropagation()}),[n]),l=eW((function(){return s.map((function(e){var t=e,n=t.photo,i=t.title,s=t.description,l=t.id,u=t.operation,d=void 0===u||u,f=t.element;return y().createElement("li",{className:"g2-multiple__li",key:l,onClick:function(){return r(l)}},f||y().createElement("img",{className:"g2-multiple__avatar",alt:"",src:n}),y().createElement("section",{className:"g2-multiple__body"},i&&y().createElement("span",{className:"g2-multiple__title"},i),y().createElement("span",{className:i?"g2-multiple__desc":"g2-multiple__title"},s)),d&&y().createElement("span",{className:"g2-multiple__op",onClick:function(e){return e.stopPropagation()}},y().createElement(vv,{trigger:a,overlayClassName:"g2-multiple__op-wrapper",getPopupContainer:function(e){return e},content:y().createElement("div",{className:"g2-multiple__del",onClick:function(e){return c(e,l)}},y().createElement(JD,{style:{fontSize:20,marginRight:8},type:"authing-indeterminate-circle-line"}),o("common.del"))},y().createElement("div",{className:"g2-multiple__icon"},y().createElement(JD,{type:"authing-more-fill"})))))}))}),[s,r,c,o,a]);return y().createElement("ul",{className:"g2-multiple"},l)},rW=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},oW=y().useCallback,iW=y().useState,aW=y().memo((function(e){var t=rW(iW(0),2)[1],n=e.multipleInstance,r=e.referMultipleState,o=null==n?void 0:n.getMemoUser(),i=oW((function(){return t(Math.random)}),[]);if(!o)
|
|
28280
28280
|
// 这里应该额外处理下 其实本质上应该是存在的
|
|
28281
28281
|
return null;
|
|
28282
28282
|
/**
|
|
@@ -28336,21 +28336,21 @@ return(null==u?void 0:u.autoRegister)?l("login.inputAccount",{text:NX(t,x,f)}):l
|
|
|
28336
28336
|
function QW(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(JD,{type:"authing-checkbox-circle-fill"})),y().createElement("div",null,t("login.otpLoginPendingText"))),y().createElement(cT,null,y().createElement(cT.Item,{className:"authing-g2-sumbit-form"},y().createElement(ly,{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 XW=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())}))},eG=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])}}},tG=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},nG=y().useCallback,rG=y().useEffect,oG=y().useRef,iG=y().useState;function aG(e){var t=this,n=e.onLoginSuccess,r=e.multipleInstance,o=e.agreements,i=tG(iG("before"),2),a=i[0],s=i[1],c=tG(iG(""),2),l=c[0],u=c[1],d=tG(iG(!0),2),f=d[0],p=d[1],h=oG(),m=tG(iG(""),2),v=m[0],g=m[1],b=function(){h.current&&clearInterval(h.current)},w=JQ(),C=w.post,E=w.get,k=iL(),S=nG((function(){b(),s("before")}),[]),x=nG((function(e){void 0===e&&(e=!0),p(e)}),[]),_=nG((function(e){return XW(t,void 0,void 0,(function(){var t,n;return eG(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=nG((function(e){return XW(t,void 0,void 0,(function(){var t;return eG(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 XW(t,void 0,void 0,(function(){var e,t,o,i,a,s,c,u,d;return eG(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?(gC.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*/]}}))}))};rG((function(){if(l)return h.current=setInterval(T,1e3),function(){b()}}),[l,_,P,n,S]);var O={before:y().createElement(ZW,{defaultAccount:v,setAccount:g,onPushSuccess:function(e){s("pending"),u(e.pushCodeId)},signinByPush:function(e){return XW(t,void 0,void 0,(function(){var t,n;return eG(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(QW,{onCancelLogin:S})};return y().createElement("div",null,O[a])}// CONCATENATED MODULE: ./src/Login/socialLogin/postMessage.ts
|
|
28338
28338
|
// 处理所有使用 postMessage 方式的登录
|
|
28339
|
-
var sG=function(){return sG=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},sG.apply(this,arguments)},cG=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])}}},uG=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},dG=xL(),fG=y().useCallback,pG=y().useEffect,hG=y().useState,mG=(y().useMemo,function(e){var t=e.QRConfig,n=e.id,r=
|
|
28339
|
+
var sG=function(){return sG=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},sG.apply(this,arguments)},cG=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])}}},uG=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},dG=xL(),fG=y().useCallback,pG=y().useEffect,hG=y().useState,mG=(y().useMemo,function(e){var t=e.QRConfig,n=e.id,r=uG(hG(!0),2),o=r[0],i=r[1],a=aL().get,s=lL(),c=cL(),l=hL(),u=iL(),d=fL(),f=JL(),p=sL(),h=fG((function(){return cG(void 0,void 0,void 0,(function(){var e,r,o,a,d;return lG(this,(function(f){return"undefined"==typeof window||(e=window.WwLogin,r=sG({from_guard:"1",app_id:c,guard_version:"Guard@".concat(dG)},s&&{tenant_id:s}),(null==l?void 0:l.isHost)&&(delete r.from_guard,r.from_hosted_guard="1",p&&(r.redirected="1",(o=DX())&&(
|
|
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:fd.includes("zh")?"zh":"en"})).frame.onload=function(e){i(!1),a.frame.contentWindow.postMessage&&a.frame.contentWindow.postMessage("ask_usePostMessage","*")}),[2/*return*/]}))}))}),[t,c,l,n,null==u?void 0:u.cdnBase,s]);return pG((function(){h()}),[h]),pG((function(){if("undefined"!=typeof window){var n=function(n){return cG(void 0,void 0,void 0,(function(){var r,o,i,s;return lG(this,(function(c){switch(c.label){case 0:if(!AX(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))===SQ.RENDER_MESSAGE&&e.onLoginFailed(o.code,o.data,o.message),[3/*break*/,6];case 5:return i=c.sent(),gC.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(dF,null),y().createElement("div",{id:"weCom_qrcode_wrapper-".concat(n),style:{display:o?"none":""}}))}),vG=function(){return vG=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},vG.apply(this,arguments)},gG=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())}))},yG=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])}}},bG=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},wG=xL(),CG=y().useCallback,EG=y().useEffect,kG=y().useState,SG=function(e){var t=e.QRConfig,n=e.id,r=bG(kG(!0),2),o=r[0],i=r[1],a=aL().get,s=lL(),c=cL(),l=fL(),u=JL(),d=hL(),f=sL(),p=CG((function(){return gG(void 0,void 0,void 0,(function(){var r,o,p,h,m;return yG(this,(function(v){return"undefined"==typeof window||(r=window.DTFrameLogin,o=vG({from_guard:"1",embedded:"1",app_id:c,guard_version:"Guard@".concat(wG)},s&&{tenant_id:s}),(null==d?void 0:d.isHost)&&(delete o.from_guard,o.from_hosted_guard="1",f&&(o.redirected="1",(p=DX())&&(
|
|
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:window.location.origin,"?").concat(jc().stringify(o))),client_id:t.clientId,scope:"openid",response_type:"code",
|
|
28348
28348
|
// state: 'xxxxxxxxx',
|
|
28349
|
-
prompt:"consent"},(function(n){return gG(void 0,void 0,void 0,(function(){var r,i,
|
|
28349
|
+
prompt:"consent"},(function(n){return gG(void 0,void 0,void 0,(function(){var r,i,s,c;return yG(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))===SQ.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))===SQ.RENDER_MESSAGE&&e.onLoginFailed(i.code,i.data),[3/*break*/,6];case 5:return s=d.sent(),gC.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 EG((function(){p()}),[p]),y().createElement("div",{className:"wecom_container"},o&&y().createElement(dF,{className:"dingtalk_loading"}),y().createElement("div",{id:"dingtalk_qrcode_wrapper-".concat(n),style:{visibility:o?"hidden":"visible"}}))},xG=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())}))},_G=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])}}},PG=y().useRef,TG=function(e){var t=PG(),n=e.canLoop,r=e.qrConfig,o=e.qrCodeScanOptions,i=aL().responseIntercept,a=fL(),s=JL(),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
|
|
@@ -28674,8 +28674,9 @@ else{var s=0;for(var c in e)if(o.insertRule){var l=c+" {"+e[c]+"}";o.insertRule(
|
|
|
28674
28674
|
/**
|
|
28675
28675
|
* @description 在托管页下上传query.login_page_context中指定的用户自定义字段进行补全(/oidc/auth发起的认证只会携带 login_page_context)
|
|
28676
28676
|
*/
|
|
28677
|
-
var fX,pX=function(){var e=[]
|
|
28677
|
+
var fX,pX=function(){var e=[];if("undefined"==typeof window)return e;
|
|
28678
28678
|
// 解析查询字符串
|
|
28679
|
+
var t=jc().parse(window.location.search,{ignoreQueryPrefix:!0}).login_page_context;
|
|
28679
28680
|
// 尝试将 loginPageContext 从字符串转换为 JSON 对象
|
|
28680
28681
|
if("string"==typeof t)try{t=JSON.parse(t)}catch(e){}
|
|
28681
28682
|
// 提取键值对函数,避免代码重复
|
|
@@ -250,7 +250,7 @@ declare class MultipleAccount {
|
|
|
250
250
|
id: string;
|
|
251
251
|
loginAccount?: string | undefined;
|
|
252
252
|
usertype?: string | undefined;
|
|
253
|
-
}, "
|
|
253
|
+
}, "way" | "tab" | "phoneCountryCode">) => void;
|
|
254
254
|
setLoginWayByHttpData: (account: string, data: {
|
|
255
255
|
username?: string | undefined;
|
|
256
256
|
phone?: string | undefined;
|
|
@@ -294,7 +294,7 @@ declare const useSelectAccounts: ({ appId, finallyConfig }: {
|
|
|
294
294
|
id: string;
|
|
295
295
|
loginAccount?: string | undefined;
|
|
296
296
|
usertype?: string | undefined;
|
|
297
|
-
}, "
|
|
297
|
+
}, "way" | "tab" | "phoneCountryCode">) => void;
|
|
298
298
|
setLoginWayByHttpData: (account: string, data: {
|
|
299
299
|
username?: string | undefined;
|
|
300
300
|
phone?: string | undefined;
|
|
@@ -39,7 +39,7 @@ declare function useLoginSelectAccount(setLoginWay: React.Dispatch<any>): {
|
|
|
39
39
|
id: string;
|
|
40
40
|
loginAccount?: string | undefined;
|
|
41
41
|
usertype?: string | undefined;
|
|
42
|
-
}, "
|
|
42
|
+
}, "way" | "tab" | "phoneCountryCode">) => void;
|
|
43
43
|
setLoginWayByHttpData: (account: string, data: {
|
|
44
44
|
username?: string | undefined;
|
|
45
45
|
phone?: string | undefined;
|
|
@@ -61,7 +61,7 @@ declare function useLoginSelectAccount(setLoginWay: React.Dispatch<any>): {
|
|
|
61
61
|
getOriginAccount: () => string;
|
|
62
62
|
getOriginWay: () => string;
|
|
63
63
|
} | undefined;
|
|
64
|
-
referMultipleState: ((type: "
|
|
64
|
+
referMultipleState: ((type: "login" | "multiple") => void) | undefined;
|
|
65
65
|
backfillData: BackFillMultipleState | undefined;
|
|
66
66
|
defaultQrWay: string | undefined;
|
|
67
67
|
};
|
|
@@ -15,7 +15,7 @@ export declare const isWeiboBrowser: () => boolean | null;
|
|
|
15
15
|
export declare const isAlipayBrowser: () => boolean | null;
|
|
16
16
|
export declare const isBaiduBrowser: () => boolean | null;
|
|
17
17
|
export declare const isWeComeBrowser: () => boolean | null;
|
|
18
|
-
export declare const isMobile: () => RegExpMatchArray | null
|
|
18
|
+
export declare const isMobile: () => RegExpMatchArray | null;
|
|
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;
|
|
@@ -53,7 +53,7 @@ export declare const useFetchConsoleConfig: (forceUpdate: number, appId?: string
|
|
|
53
53
|
loginMethods?: LoginMethods[] | undefined;
|
|
54
54
|
passwordLoginMethods?: string[] | undefined;
|
|
55
55
|
socialConnections?: import("../../Type").SocialConnectionProvider[] | undefined;
|
|
56
|
-
socialConnectionsBtnShape?: "button" | "
|
|
56
|
+
socialConnectionsBtnShape?: "button" | "default" | "icon" | undefined;
|
|
57
57
|
enterpriseConnections?: string[] | undefined;
|
|
58
58
|
qrCodeScanOptions?: {
|
|
59
59
|
extIdpConnId?: string | undefined;
|
|
@@ -123,7 +123,7 @@ export declare const useGuardAccountSelectInstance: () => {
|
|
|
123
123
|
id: string;
|
|
124
124
|
loginAccount?: string | undefined;
|
|
125
125
|
usertype?: string | undefined;
|
|
126
|
-
}, "
|
|
126
|
+
}, "way" | "tab" | "phoneCountryCode">) => void;
|
|
127
127
|
setLoginWayByHttpData: (account: string, data: {
|
|
128
128
|
username?: string | undefined;
|
|
129
129
|
phone?: string | undefined;
|
package/package.json
CHANGED