@reachfive/identity-ui 1.20.2 → 1.22.0
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/CHANGELOG.md +27 -2
- package/cjs/identity-ui.js +264 -285
- package/es/identity-ui.js +269 -289
- package/package.json +2 -2
- package/umd/identity-ui.js +279 -334
- package/umd/identity-ui.min.js +1 -1
package/umd/identity-ui.js
CHANGED
|
@@ -8006,34 +8006,34 @@
|
|
|
8006
8006
|
*/function decodeBase64(str){// Cf: https://stackoverflow.com/questions/30106476/using-javascripts-atob-to-decode-base64-doesnt-properly-decode-utf-8-strings
|
|
8007
8007
|
return decodeURIComponent(Array.prototype.map.call(window.atob(str),function(c){return '%'+('00'+c.charCodeAt(0).toString(16)).slice(-2);}).join(''));}function parseJwtTokenPayload(token){var bodyPart=token.split('.')[1];return camelCaseProperties(JSON.parse(decodeBase64UrlSafe(bodyPart)));}/**
|
|
8008
8008
|
* Parse the id token, if present, and add the payload to the AuthResult
|
|
8009
|
-
*/function enrichAuthResult(response){if(response.idToken){try{var idTokenPayload=parseJwtTokenPayload(response.idToken);return _assign(_assign({},response),{idTokenPayload:idTokenPayload});}catch(e){logError('ID Token parsing error',e);}}return response;}var AuthResult;(function(AuthResult){function isAuthResult(thing){return thing&&(thing.accessToken||thing.idToken||thing.code);}AuthResult.isAuthResult=isAuthResult;})(AuthResult||(AuthResult={}));function popupSize(provider){switch(provider){case'amazon':return {width:715,height:525};case'facebook':return {width:650,height:400};case'google':return {width:560,height:630};case'kakaotalk':return {width:450,height:400};case'line':return {width:440,height:550};case'mailru':return {width:450,height:400};case'qq':return {width:450,height:400};case'twitter':return {width:800,height:440};case'vkontakte':return {width:655,height:430};case'yandex':return {width:655,height:700};default:return {width:400,height:550};}}function randomBase64String(){var randomValues=window.crypto.getRandomValues(new Uint8Array(32));return encodeToBase64(randomValues);}function computePkceParams(){var codeVerifier=randomBase64String();sessionStorage.setItem('verifier_key',codeVerifier);return computeCodeChallenge(codeVerifier).then(function(challenge){return {codeChallenge:challenge,codeChallengeMethod:'S256'};});}function computeCodeChallenge(verifier){var binaryChallenge=buffer_1.from(verifier,'utf-8');return new Promise(function(resolve){window.crypto.subtle.digest('SHA-256',binaryChallenge).then(function(hash){return resolve(encodeToBase64(hash));});});}/**
|
|
8009
|
+
*/function enrichAuthResult(response){if(response.idToken){try{var idTokenPayload=parseJwtTokenPayload(response.idToken);return _assign(_assign({},response),{idTokenPayload:idTokenPayload});}catch(e){logError('ID Token parsing error',e);}}return response;}var AuthResult;(function(AuthResult){function isAuthResult(thing){return thing&&(thing.accessToken||thing.idToken||thing.code);}AuthResult.isAuthResult=isAuthResult;})(AuthResult||(AuthResult={}));function popupSize(provider){switch(provider){case'amazon':return {width:715,height:525};case'facebook':return {width:650,height:400};case'google':return {width:560,height:630};case'kakaotalk':return {width:450,height:400};case'line':return {width:440,height:550};case'mailru':return {width:450,height:400};case'qq':return {width:450,height:400};case'twitter':return {width:800,height:440};case'vkontakte':return {width:655,height:430};case'yandex':return {width:655,height:700};default:return {width:400,height:550};}}function randomBase64String(){var randomValues=window.crypto.getRandomValues(new Uint8Array(32));return encodeToBase64(randomValues);}function computePkceParams(){var codeVerifier=randomBase64String();sessionStorage.setItem('verifier_key',codeVerifier);return computeCodeChallenge(codeVerifier).then(function(challenge){return {codeChallenge:challenge,codeChallengeMethod:'S256'};});}function computeCodeChallenge(verifier){var binaryChallenge=buffer_1.from(verifier,'utf-8');return new Promise(function(resolve){window.crypto.subtle.digest('SHA-256',binaryChallenge).then(function(hash){return resolve(encodeToBase64(hash));});});}function getWithExpiry(key){var storedValue=sessionStorage.getItem(key);if(!storedValue){return null;}try{var item=JSON.parse(storedValue);var now=new Date();if(now.getTime()>item.expiry){sessionStorage.removeItem(key);return null;}return item.value;}catch(e){return null;}}function setWithExpiry(key,value,ttl){var now=new Date();var item={value:value,expiry:now.getTime()+ttl};sessionStorage.setItem(key,JSON.stringify(item));}/**
|
|
8010
8010
|
* Identity Rest API Client
|
|
8011
|
-
*/var OAuthClient=/** @class */function(){function OAuthClient(props){this.config=props.config;this.http=props.http;this.eventManager=props.eventManager;this.authorizeUrl=this.config.baseUrl+"/oauth/authorize";this.customTokenUrl=this.config.baseUrl+"/identity/v1/custom-token/login";this.logoutUrl=this.config.baseUrl+"/identity/v1/logout";this.passwordlessVerifyUrl=this.config.baseUrl+"/identity/v1/passwordless/verify";this.popupRelayUrl=this.config.baseUrl+"/popup/relay";this.tokenUrl=this.config.baseUrl+"/oauth/token";this.passwordlessVerifyAuthCodeUrl='/verify-auth-code';this.passwordLoginUrl='/password/login';this.passwordlessStartUrl='/passwordless/start';this.sessionInfoUrl='/sso/data';this.signupUrl='/signup';this.signupTokenUrl='/signup-token';}OAuthClient.prototype.checkSession=function(opts){var _this=this;if(opts===void 0){opts={};}if(!this.config.sso)return Promise.reject(new Error("Cannot call 'checkSession' if SSO is not enabled."));var authParams=this.authParams(_assign(_assign({},opts),{responseType:'code',useWebMessage:true}));return this.getPkceParams(authParams).then(function(maybeChallenge){var params=_assign(_assign({},authParams),maybeChallenge);var authorizationUrl=_this.getAuthorizationUrl(params);return _this.getWebMessage(authorizationUrl,_this.config.baseUrl,opts.redirectUri);});};OAuthClient.prototype.exchangeAuthorizationCodeWithPkce=function(params){var _this=this;return this.http.post(this.tokenUrl,{body:_assign({clientId:this.config.clientId,grantType:'authorization_code',codeVerifier:sessionStorage.getItem('verifier_key')},params)}).then(function(authResult){_this.eventManager.fireEvent('authenticated',authResult);return enrichAuthResult(authResult);});};OAuthClient.prototype.getSessionInfo=function(){return this.http.get(this.sessionInfoUrl,{query:{clientId:this.config.clientId},withCookies:true});};OAuthClient.prototype.loginFromSession=function(opts){var _this=this;if(opts===void 0){opts={};}if(!this.config.sso)return Promise.reject(new Error("Cannot call 'loginFromSession' if SSO is not enabled."));var authParams=this.authParams(_assign(_assign({},opts),{useWebMessage:false}));return this.getPkceParams(authParams).then(function(maybeChallenge){var params=_assign(_assign({},authParams),maybeChallenge);return _this.redirectThruAuthorization(params);});};OAuthClient.prototype.loginWithCredentials=function(params){var _this=this;if(navigator.credentials&&navigator.credentials.get){var request={password:true,mediation:params.mediation||'silent'};return navigator.credentials.get(request).then(function(credentials){if(!isUndefined_1(credentials)&&credentials instanceof PasswordCredential&&credentials.password){var loginParams={email:credentials.id,password:credentials.password,auth:params.auth};return _this.ropcPasswordLogin(loginParams);}return Promise.reject(new Error('Invalid credentials'));});}else {return Promise.reject(new Error('Unsupported Credentials Management API'));}};OAuthClient.prototype.loginWithCustomToken=function(params){var token=params.token,auth=params.auth;var queryString=toQueryString(_assign(_assign({},this.authParams(auth)),{token:token}));// Non existent endpoint URL
|
|
8012
|
-
window.location.assign(this.customTokenUrl+"?"+queryString);};OAuthClient.prototype.loginWithPassword=function(params){var _this=this;var _a=params.auth,auth=_a===void 0?{}:_a,rest=__rest(params,["auth"]);var loginPromise=window.cordova?this.ropcPasswordLogin(params).then(function(authResult){return _this.storeCredentialsInBrowser(params).then(function(){return enrichAuthResult(authResult);});}):this.http.post(this.passwordLoginUrl,{body:_assign({clientId:this.config.clientId,scope:resolveScope(auth,this.config.scope)},rest)}).then(function(tkn){return _this.storeCredentialsInBrowser(params).then(function(){return tkn;});}).then(function(tkn){return _this.loginCallback(
|
|
8011
|
+
*/var OAuthClient=/** @class */function(){function OAuthClient(props){this.config=props.config;this.http=props.http;this.eventManager=props.eventManager;this.authorizeUrl=this.config.baseUrl+"/oauth/authorize";this.customTokenUrl=this.config.baseUrl+"/identity/v1/custom-token/login";this.logoutUrl=this.config.baseUrl+"/identity/v1/logout";this.revokeUrl=this.config.baseUrl+"/oauth/revoke";this.passwordlessVerifyUrl=this.config.baseUrl+"/identity/v1/passwordless/verify";this.popupRelayUrl=this.config.baseUrl+"/popup/relay";this.tokenUrl=this.config.baseUrl+"/oauth/token";this.passwordlessVerifyAuthCodeUrl='/verify-auth-code';this.passwordLoginUrl='/password/login';this.passwordlessStartUrl='/passwordless/start';this.sessionInfoUrl='/sso/data';this.signupUrl='/signup';this.signupTokenUrl='/signup-token';}OAuthClient.prototype.setMfaClient=function(mfaClient){this.mfaClient=mfaClient;};OAuthClient.prototype.checkSession=function(opts){var _this=this;if(opts===void 0){opts={};}if(!this.config.sso)return Promise.reject(new Error("Cannot call 'checkSession' if SSO is not enabled."));var authParams=this.authParams(_assign(_assign({},opts),{responseType:'code',useWebMessage:true}));if(this.isAuthorizationLocked()||this.isSessionLocked())return Promise.reject(new Error('An ongoing authorization flow has not yet completed.'));this.acquireSessionLock();return this.getPkceParams(authParams).then(function(maybeChallenge){var params=_assign(_assign({},authParams),maybeChallenge);var authorizationUrl=_this.getAuthorizationUrl(params);return _this.getWebMessage(authorizationUrl,_this.config.baseUrl,opts.redirectUri);});};OAuthClient.prototype.exchangeAuthorizationCodeWithPkce=function(params){var _this=this;return this.http.post(this.tokenUrl,{body:_assign({clientId:this.config.clientId,grantType:'authorization_code',codeVerifier:sessionStorage.getItem('verifier_key')},params)}).then(function(authResult){_this.eventManager.fireEvent('authenticated',authResult);return enrichAuthResult(authResult);})["finally"](function(){_this.releaseAuthorizationLock();_this.releaseSessionLock();});};OAuthClient.prototype.getSessionInfo=function(){return this.http.get(this.sessionInfoUrl,{query:{clientId:this.config.clientId},withCookies:true});};OAuthClient.prototype.loginFromSession=function(opts){var _this=this;if(opts===void 0){opts={};}if(!this.config.sso)return Promise.reject(new Error("Cannot call 'loginFromSession' if SSO is not enabled."));if(this.isAuthorizationLocked()||this.isSessionLocked())return Promise.reject(new Error('An ongoing authorization flow has not yet completed.'));this.acquireSessionLock();var authParams=this.authParams(_assign(_assign({},opts),{useWebMessage:false}));return this.getPkceParams(authParams).then(function(maybeChallenge){var params=_assign(_assign({},authParams),maybeChallenge);return _this.redirectThruAuthorization(params);});};OAuthClient.prototype.loginWithCredentials=function(params){var _this=this;if(navigator.credentials&&navigator.credentials.get){var request={password:true,mediation:params.mediation||'silent'};return navigator.credentials.get(request).then(function(credentials){if(!isUndefined_1(credentials)&&credentials instanceof PasswordCredential&&credentials.password){var loginParams={email:credentials.id,password:credentials.password,auth:params.auth};return _this.ropcPasswordLogin(loginParams);}return Promise.reject(new Error('Invalid credentials'));});}else {return Promise.reject(new Error('Unsupported Credentials Management API'));}};OAuthClient.prototype.loginWithCustomToken=function(params){var token=params.token,auth=params.auth;var queryString=toQueryString(_assign(_assign({},this.authParams(auth)),{token:token}));// Non existent endpoint URL
|
|
8012
|
+
window.location.assign(this.customTokenUrl+"?"+queryString);};OAuthClient.prototype.loginWithPassword=function(params){var _this=this;var _a=params.auth,auth=_a===void 0?{}:_a,rest=__rest(params,["auth"]);this.acquireAuthorizationLock();var loginPromise=window.cordova?this.ropcPasswordLogin(params).then(function(authResult){return _this.storeCredentialsInBrowser(params).then(function(){return enrichAuthResult(authResult);});}):this.http.post(this.passwordLoginUrl,{body:_assign({clientId:this.config.clientId,scope:resolveScope(auth,this.config.scope)},rest)}).then(function(tkn){return _this.storeCredentialsInBrowser(params).then(function(){return tkn;});}).then(function(authenticationToken){var _a;if(authenticationToken.mfaRequired){return _this.mfaClient?(_a=_this.mfaClient)===null||_a===void 0?void 0:_a.getMfaStepUpToken({tkn:authenticationToken.tkn,options:auth}).then(function(res){return {stepUpToken:res.token,amr:res.amr};}):Promise.reject(new Error("Error during client instantiation"));}return _this.loginCallback(authenticationToken,auth);});return loginPromise["catch"](function(err){if(err.error){_this.eventManager.fireEvent('login_failed',err);}return Promise.reject(err);});};OAuthClient.prototype.loginWithSocialProvider=function(provider,opts){var _this=this;if(opts===void 0){opts={};}if(this.config.orchestrationToken){var params=_assign(_assign({},this.orchestratedFlowParams(this.config.orchestrationToken,_assign(_assign({},opts),{useWebMessage:false}))),{provider:provider});if('cordova'in window){return this.loginWithCordovaInAppBrowser(params);}else if(params.display==='popup'){return this.loginWithPopup(params);}else {return this.redirectThruAuthorization(params);}}else {var authParams_1=this.authParams(_assign(_assign({},opts),{useWebMessage:false}),{acceptPopupMode:true});return this.getPkceParams(authParams_1).then(function(maybeChallenge){var params=_assign(_assign(_assign({},authParams_1),{provider:provider}),maybeChallenge);if('cordova'in window){return _this.loginWithCordovaInAppBrowser(params);}else if(params.display==='popup'){return _this.loginWithPopup(params);}else {return _this.redirectThruAuthorization(params);}});}};OAuthClient.prototype.loginWithIdToken=function(provider,idToken,nonce,opts){if(opts===void 0){opts={};}var authParams=this.authParams(_assign({},opts));if(opts.useWebMessage){var queryString=toQueryString(_assign(_assign({},authParams),{provider:provider,idToken:idToken,nonce:nonce}));return this.getWebMessage(this.authorizeUrl+"?"+queryString,this.config.baseUrl,opts.redirectUri).then();}else {return this.redirectThruAuthorization(_assign(_assign({},authParams),{provider:provider,idToken:idToken,nonce:nonce}));}};OAuthClient.prototype.googleOneTap=function(opts,nonce){var _this=this;if(opts===void 0){opts={};}if(nonce===void 0){nonce=randomBase64String();}var binaryNonce=buffer_1.from(nonce,'utf-8');return window.crypto.subtle.digest('SHA-256',binaryNonce).then(function(hash){var googleIdConfiguration={client_id:_this.config.googleClientId,callback:function callback(response){return _this.loginWithIdToken("google",response.credential,nonce,opts);},nonce:encodeToBase64(hash),// Enable auto sign-in
|
|
8013
8013
|
auto_select:true};window.google.accounts.id.initialize(googleIdConfiguration);// Activate Google One Tap
|
|
8014
|
-
window.google.accounts.id.prompt();});};OAuthClient.prototype.instantiateOneTap=function(opts){var _this=this;var _a,_b;if(opts===void 0){opts={};}if((_a=this.config)===null||_a===void 0?void 0:_a.googleClientId){var script=document.createElement("script");script.src="https://accounts.google.com/gsi/client";script.onload=function(){return _this.googleOneTap(opts);};script.async=true;script.defer=true;(_b=document.querySelector("body"))===null||_b===void 0?void 0:_b.appendChild(script);}else {logError('Google configuration missing.');}};OAuthClient.prototype.logout=function(opts){if(opts===void 0){opts={};}if(navigator.credentials&&navigator.credentials.preventSilentAccess&&opts.removeCredentials===true){navigator.credentials.preventSilentAccess();}window.location.assign(this.logoutUrl+"?"+toQueryString(opts));};OAuthClient.prototype.refreshTokens=function(params){var result=this.http.post(this.tokenUrl,{body:_assign({clientId:this.config.clientId,grantType:'refresh_token',refreshToken:params.refreshToken},pick_1(params,'scope'))});return result.then(enrichAuthResult);};OAuthClient.prototype.signup=function(params){var _this=this;var data=params.data,auth=params.auth,redirectUrl=params.redirectUrl,returnToAfterEmailConfirmation=params.returnToAfterEmailConfirmation,saveCredentials=params.saveCredentials,captchaToken=params.captchaToken;var clientId=this.config.clientId;var scope=resolveScope(auth,this.config.scope);var loginParams=_assign(_assign({},data.phoneNumber?{phoneNumber:data.phoneNumber}:{email:data.email||""}),{password:data.password,saveCredentials:saveCredentials,auth:auth});var resultPromise=window.cordova?this.http.post(this.signupTokenUrl,{body:_assign(_assign({clientId:clientId,redirectUrl:redirectUrl,scope:scope},pick_1(auth,'origin')),{data:data,returnToAfterEmailConfirmation:returnToAfterEmailConfirmation,captchaToken:captchaToken})}).then(function(authResult){_this.eventManager.fireEvent('authenticated',authResult);return _this.storeCredentialsInBrowser(loginParams).then(function(){return enrichAuthResult(authResult);});}):this.http.post(this.signupUrl,{body:{clientId:clientId,redirectUrl:redirectUrl,scope:scope,data:data,returnToAfterEmailConfirmation:returnToAfterEmailConfirmation,captchaToken:captchaToken}}).then(function(tkn){return _this.storeCredentialsInBrowser(loginParams).then(function(){return tkn;});}).then(function(tkn){return _this.loginCallback(tkn,auth);});return resultPromise["catch"](function(err){if(err.error){_this.eventManager.fireEvent('signup_failed',err);}return Promise.reject(err);});};OAuthClient.prototype.startPasswordless=function(params,auth){var _this=this;if(auth===void 0){auth={};}var passwordlessPayload='stepUp'in params?Promise.resolve(params):this.resolveSingleFactorPasswordlessParams(params,auth);return passwordlessPayload.then(function(payload){return _this.http.post(_this.passwordlessStartUrl,{body:payload});});};OAuthClient.prototype.verifyPasswordless=function(params,auth){var _this=this;if(auth===void 0){auth={};}return 'challengeId'in params?Promise.resolve(this.loginWithVerificationCode(params)):this.http.post(this.passwordlessVerifyAuthCodeUrl,{body:params})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);}).then(function(){return _this.loginWithVerificationCode(params,auth);});};OAuthClient.prototype.getAuthorizationUrl=function(queryString){return this.authorizeUrl+"?"+toQueryString(queryString);};OAuthClient.prototype.getWebMessage=function(src,origin,redirectUri){var _this=this;var iframe=document.createElement('iframe');// "wm" needed to make sure the randomized id is valid
|
|
8014
|
+
window.google.accounts.id.prompt();});};OAuthClient.prototype.instantiateOneTap=function(opts){var _this=this;var _a,_b;if(opts===void 0){opts={};}if((_a=this.config)===null||_a===void 0?void 0:_a.googleClientId){var script=document.createElement("script");script.src="https://accounts.google.com/gsi/client";script.onload=function(){return _this.googleOneTap(opts);};script.async=true;script.defer=true;(_b=document.querySelector("body"))===null||_b===void 0?void 0:_b.appendChild(script);}else {logError('Google configuration missing.');}};OAuthClient.prototype.logout=function(opts,revocationParams){var _this=this;if(opts===void 0){opts={};}if(navigator.credentials&&navigator.credentials.preventSilentAccess&&opts.removeCredentials===true){navigator.credentials.preventSilentAccess();}if(this.config.isPublic&&revocationParams){return this.revokeToken(revocationParams).then(function(_){return window.location.assign(_this.logoutUrl+"?"+toQueryString(opts));});}else {return Promise.resolve(window.location.assign(this.logoutUrl+"?"+toQueryString(opts)));}};OAuthClient.prototype.revokeToken=function(revocationParams){var _this=this;var revocationsCalls=revocationParams.tokens.map(function(token){return _this.http.post(_this.revokeUrl,{body:{clientId:_this.config.clientId,token:token}});});return Promise.all(revocationsCalls);};OAuthClient.prototype.refreshTokens=function(params){var result=this.http.post(this.tokenUrl,{body:_assign({clientId:this.config.clientId,grantType:'refresh_token',refreshToken:params.refreshToken},pick_1(params,'scope'))});return result.then(enrichAuthResult);};OAuthClient.prototype.signup=function(params){var _this=this;var data=params.data,auth=params.auth,redirectUrl=params.redirectUrl,returnToAfterEmailConfirmation=params.returnToAfterEmailConfirmation,saveCredentials=params.saveCredentials,captchaToken=params.captchaToken;var clientId=this.config.clientId;var scope=resolveScope(auth,this.config.scope);var loginParams=_assign(_assign({},data.phoneNumber?{phoneNumber:data.phoneNumber}:{email:data.email||""}),{password:data.password,saveCredentials:saveCredentials,auth:auth});var resultPromise=window.cordova?this.http.post(this.signupTokenUrl,{body:_assign(_assign({clientId:clientId,redirectUrl:redirectUrl,scope:scope},pick_1(auth,'origin')),{data:data,returnToAfterEmailConfirmation:returnToAfterEmailConfirmation,captchaToken:captchaToken})}).then(function(authResult){_this.eventManager.fireEvent('authenticated',authResult);return _this.storeCredentialsInBrowser(loginParams).then(function(){return enrichAuthResult(authResult);});}):this.http.post(this.signupUrl,{body:{clientId:clientId,redirectUrl:redirectUrl,scope:scope,data:data,returnToAfterEmailConfirmation:returnToAfterEmailConfirmation,captchaToken:captchaToken}}).then(function(tkn){return _this.storeCredentialsInBrowser(loginParams).then(function(){return tkn;});}).then(function(tkn){return _this.loginCallback(tkn,auth);});return resultPromise["catch"](function(err){if(err.error){_this.eventManager.fireEvent('signup_failed',err);}return Promise.reject(err);});};OAuthClient.prototype.startPasswordless=function(params,auth){var _this=this;if(auth===void 0){auth={};}var passwordlessPayload='stepUp'in params?Promise.resolve(params):this.resolveSingleFactorPasswordlessParams(params,auth);return passwordlessPayload.then(function(payload){return _this.http.post(_this.passwordlessStartUrl,{body:payload});});};OAuthClient.prototype.verifyPasswordless=function(params,auth){var _this=this;if(auth===void 0){auth={};}return 'challengeId'in params?Promise.resolve(this.loginWithVerificationCode(params)):this.http.post(this.passwordlessVerifyAuthCodeUrl,{body:params})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);}).then(function(){return _this.loginWithVerificationCode(params,auth);});};OAuthClient.prototype.getAuthorizationUrl=function(queryString){return this.authorizeUrl+"?"+toQueryString(queryString);};OAuthClient.prototype.getWebMessage=function(src,origin,redirectUri){var _this=this;var iframe=document.createElement('iframe');// "wm" needed to make sure the randomized id is valid
|
|
8015
8015
|
var id="wm"+randomBase64String();iframe.setAttribute('width','0');iframe.setAttribute('height','0');iframe.setAttribute('style','display:none;');iframe.setAttribute('id',id);iframe.setAttribute('src',src);return new Promise(function(resolve,reject){var listener=function listener(event){// Verify the event's origin
|
|
8016
8016
|
if(event.origin!==origin)return;// Verify the event's syntax
|
|
8017
8017
|
var data=camelCaseProperties(event.data);if(data.type!=='authorization_response')return;// The iframe is no longer needed, clean it up ..
|
|
8018
8018
|
if(window.document.body.contains(iframe)){window.document.body.removeChild(iframe);}var result=data.response;if(AuthResult.isAuthResult(result)){if(result.code){resolve(_this.exchangeAuthorizationCodeWithPkce({code:result.code,redirectUri:redirectUri||window.location.origin}));}else {_this.eventManager.fireEvent('authenticated',data.response);resolve(enrichAuthResult(data.response));}}else if(ErrorResponse.isErrorResponse(result)){// The 'authentication_failed' event must not be triggered because it is not a real authentication failure.
|
|
8019
|
-
reject(result);}else {reject({error:'unexpected_error',errorDescription:'Unexpected error occurred'});}window.removeEventListener('message',listener,false);};window.addEventListener('message',listener,false);document.body.appendChild(iframe);});};OAuthClient.prototype.loginWithPopup=function(opts){var _this=this;var responseType=opts.responseType,redirectUri=opts.redirectUri,provider=opts.provider;winchan.open({url:this.authorizeUrl+"?"+toQueryString(opts),relay_url:this.popupRelayUrl,window_features:this.computeProviderPopupOptions(provider)},function(err,result){if(err){logError(err);_this.eventManager.fireEvent('authentication_failed',{errorDescription:'Unexpected error occurred',error:'server_error'});return;}var r=camelCaseProperties(result);if(r.success){if(responseType==='code'){window.location.assign(redirectUri+"?code="+r.data.code);}else {_this.eventManager.fireEvent('authenticated',r.data);}}else {_this.eventManager.fireEvent('authentication_failed',r.data);}});return Promise.resolve();};OAuthClient.prototype.computeProviderPopupOptions=function(provider){try{var opts=popupSize(provider);var left=Math.max(0,(screen.width-opts.width)/2);var top_1=Math.max(0,(screen.height-opts.height)/2);var width=Math.min(screen.width,opts.width);var height=Math.min(screen.height,opts.height);return "menubar=0,toolbar=0,resizable=1,scrollbars=1,width="+width+",height="+height+",top="+top_1+",left="+left;}catch(e){return 'menubar=0,toolbar=0,resizable=1,scrollbars=1,width=960,height=680';}};OAuthClient.prototype.redirectThruAuthorization=function(queryString){var location=this.getAuthorizationUrl(queryString);window.location.assign(location);return Promise.resolve();};OAuthClient.prototype.loginWithVerificationCode=function(params,auth){if(auth===void 0){auth={};}var queryString=toQueryString(_assign(_assign({},this.authParams(auth)),params));window.location.assign(this.passwordlessVerifyUrl+"?"+queryString);};OAuthClient.prototype.ropcPasswordLogin=function(params){var _this=this;var auth=params.auth;return this.http.post(this.tokenUrl,{body:_assign({clientId:this.config.clientId,grantType:'password',username:this.getAuthenticationId(params),password:params.password,scope:resolveScope(auth,this.config.scope)},pick_1(auth,'origin'))}).then(function(authResult){_this.eventManager.fireEvent('authenticated',authResult);return enrichAuthResult(authResult);});};OAuthClient.prototype.loginWithCordovaInAppBrowser=function(opts){return this.openInCordovaSystemBrowser(this.getAuthorizationUrl(_assign(_assign({},opts),{display:'page'})));};OAuthClient.prototype.openInCordovaSystemBrowser=function(url){return this.getAvailableBrowserTabPlugin().then(function(maybeBrowserTab){if(!window.cordova){return Promise.reject(new Error('Cordova environnement not detected.'));}if(maybeBrowserTab){maybeBrowserTab.openUrl(url,function(){},logError);return Promise.resolve();}if(window.cordova.InAppBrowser){var ref=window.cordova.platformId==='ios'?// Open a webview (to pass Apple validation tests)
|
|
8019
|
+
reject(result);}else {reject({error:'unexpected_error',errorDescription:'Unexpected error occurred'});}window.removeEventListener('message',listener,false);};window.addEventListener('message',listener,false);document.body.appendChild(iframe);})["finally"](function(){_this.releaseAuthorizationLock();_this.releaseSessionLock();});};OAuthClient.prototype.loginWithPopup=function(opts){var _this=this;var responseType=opts.responseType,redirectUri=opts.redirectUri,provider=opts.provider;winchan.open({url:this.authorizeUrl+"?"+toQueryString(opts),relay_url:this.popupRelayUrl,window_features:this.computeProviderPopupOptions(provider)},function(err,result){if(err){logError(err);_this.eventManager.fireEvent('authentication_failed',{errorDescription:'Unexpected error occurred',error:'server_error'});return;}var r=camelCaseProperties(result);if(r.success){if(responseType==='code'){window.location.assign(redirectUri+"?code="+r.data.code);}else {_this.eventManager.fireEvent('authenticated',r.data);}}else {_this.eventManager.fireEvent('authentication_failed',r.data);}});return Promise.resolve();};OAuthClient.prototype.computeProviderPopupOptions=function(provider){try{var opts=popupSize(provider);var left=Math.max(0,(screen.width-opts.width)/2);var top_1=Math.max(0,(screen.height-opts.height)/2);var width=Math.min(screen.width,opts.width);var height=Math.min(screen.height,opts.height);return "menubar=0,toolbar=0,resizable=1,scrollbars=1,width="+width+",height="+height+",top="+top_1+",left="+left;}catch(e){return 'menubar=0,toolbar=0,resizable=1,scrollbars=1,width=960,height=680';}};OAuthClient.prototype.redirectThruAuthorization=function(queryString){var location=this.getAuthorizationUrl(queryString);this.releaseAuthorizationLock();this.releaseSessionLock();window.location.assign(location);return Promise.resolve();};OAuthClient.prototype.loginWithVerificationCode=function(params,auth){if(auth===void 0){auth={};}var queryString=toQueryString(_assign(_assign({},this.authParams(auth)),params));window.location.assign(this.passwordlessVerifyUrl+"?"+queryString);};OAuthClient.prototype.ropcPasswordLogin=function(params){var _this=this;var auth=params.auth;return this.http.post(this.tokenUrl,{body:_assign({clientId:this.config.clientId,grantType:'password',username:this.getAuthenticationId(params),password:params.password,scope:resolveScope(auth,this.config.scope)},pick_1(auth,'origin'))}).then(function(authResult){_this.eventManager.fireEvent('authenticated',authResult);return enrichAuthResult(authResult);});};OAuthClient.prototype.loginWithCordovaInAppBrowser=function(opts){return this.openInCordovaSystemBrowser(this.getAuthorizationUrl(_assign(_assign({},opts),{display:'page'})));};OAuthClient.prototype.openInCordovaSystemBrowser=function(url){return this.getAvailableBrowserTabPlugin().then(function(maybeBrowserTab){if(!window.cordova){return Promise.reject(new Error('Cordova environnement not detected.'));}if(maybeBrowserTab){maybeBrowserTab.openUrl(url,function(){},logError);return Promise.resolve();}if(window.cordova.InAppBrowser){var ref=window.cordova.platformId==='ios'?// Open a webview (to pass Apple validation tests)
|
|
8020
8020
|
window.cordova.InAppBrowser.open(url,'_blank'):// Open the system browser
|
|
8021
8021
|
window.cordova.InAppBrowser.open(url,'_system');return Promise.resolve(ref);}return Promise.reject(new Error('Cordova plugin "InAppBrowser" is required.'));});};OAuthClient.prototype.getAvailableBrowserTabPlugin=function(){return new Promise(function(resolve,reject){var cordova=window.cordova;if(!cordova||!cordova.plugins||!cordova.plugins.browsertab)return resolve(undefined);var plugin=cordova.plugins.browsertab;plugin.isAvailable(function(isAvailable){return resolve(isAvailable?plugin:undefined);},reject);});};OAuthClient.prototype.storeCredentialsInBrowser=function(params){if(!params.saveCredentials)return Promise.resolve();if(navigator.credentials&&navigator.credentials.create&&navigator.credentials.store){var credentialParams={password:{password:params.password,id:this.getAuthenticationId(params)}};return navigator.credentials.create(credentialParams).then(function(credentials){return !isUndefined_1(credentials)&&credentials?navigator.credentials.store(credentials).then(function(){}):Promise.resolve();});}else {logError('Unsupported Credentials Management API');return Promise.resolve();}};// TODO: Make passwordless able to handle web_message
|
|
8022
8022
|
// Asana https://app.asana.com/0/982150578058310/1200173806808689/f
|
|
8023
8023
|
OAuthClient.prototype.resolveSingleFactorPasswordlessParams=function(params,auth){if(auth===void 0){auth={};}var authType=params.authType,email=params.email,phoneNumber=params.phoneNumber,captchaToken=params.captchaToken;if(this.config.orchestrationToken){var authParams=this.orchestratedFlowParams(this.config.orchestrationToken,auth);return Promise.resolve(_assign(_assign({},authParams),{authType:authType,email:email,phoneNumber:phoneNumber,captchaToken:captchaToken}));}else {var authParams_2=this.authParams(auth);return this.getPkceParams(authParams_2).then(function(maybeChallenge){return _assign(_assign(_assign({},authParams_2),{authType:authType,email:email,phoneNumber:phoneNumber,captchaToken:captchaToken}),maybeChallenge);});}};OAuthClient.prototype.hasLoggedWithEmail=function(params){return params.email!==undefined;};OAuthClient.prototype.hasLoggedWithPhoneNumber=function(params){return params.phoneNumber!==undefined;};OAuthClient.prototype.getAuthenticationId=function(params){if(this.hasLoggedWithEmail(params)){return params.email;}else if(this.hasLoggedWithPhoneNumber(params)){return params.phoneNumber;}else {return params.customIdentifier;}};// TODO: Shared among the clients
|
|
8024
8024
|
OAuthClient.prototype.loginCallback=function(tkn,auth){var _this=this;if(auth===void 0){auth={};}if(this.config.orchestrationToken){var authParams_3=_assign(_assign({},this.orchestratedFlowParams(this.config.orchestrationToken,auth)),pick_1(tkn,'tkn'));return Promise.resolve().then(function(_){return _this.redirectThruAuthorization(authParams_3);});}else {var authParams_4=this.authParams(auth);return this.getPkceParams(authParams_4).then(function(maybeChallenge){var params=_assign(_assign(_assign({},authParams_4),maybeChallenge),pick_1(tkn,'tkn'));if(auth.useWebMessage){return _this.getWebMessage(_this.getAuthorizationUrl(params),_this.config.baseUrl,auth.redirectUri);}else {return _this.redirectThruAuthorization(params);}});}};// In an orchestrated flow, only parameters from the original request are to be considered,
|
|
8025
8025
|
// as well as parameters that depend on user action
|
|
8026
|
-
OAuthClient.prototype.orchestratedFlowParams=function(orchestrationToken,authOptions){if(authOptions===void 0){authOptions={};}var authParams=computeAuthOptions(authOptions);var correctedAuthParams=_assign({clientId:this.config.clientId,r5_request_token:orchestrationToken},pick_1(authParams,'responseType','redirectUri','clientId','persistent'));var uselessParams=difference_1(keys_1(authParams),keys_1(correctedAuthParams));if(uselessParams.length!==0)console.debug("Orchestrated flow: pruned parameters: "+uselessParams);return correctedAuthParams;};OAuthClient.prototype.authParams=function(opts,_a){var _b=(_a===void 0?{}:_a).acceptPopupMode,acceptPopupMode=_b===void 0?false:_b;var isConfidentialCodeWebMsg=!this.config.isPublic&&!!opts.useWebMessage&&(opts.responseType==='code'||opts.redirectUri);var overrideResponseType=isConfidentialCodeWebMsg?{responseType:'token',redirectUri:undefined}:{};return _assign({clientId:this.config.clientId},computeAuthOptions(_assign(_assign({},opts),overrideResponseType),{acceptPopupMode:acceptPopupMode},this.config.scope));};OAuthClient.prototype.getPkceParams=function(authParams){if(this.config.isPublic&&authParams.responseType==='code')return computePkceParams();else if(authParams.responseType==='token'&&this.config.pkceEnforced)return Promise.reject(new Error('Cannot use implicit flow when PKCE is enforced'));else return Promise.resolve({});};return OAuthClient;}();var EventManager=/** @class */function(){function EventManager(){this.listeners={};}EventManager.prototype.fire=function(name,data){this.getListeners(name).forEach(function(listener){try{listener(data);}catch(e){logError(e);}});};EventManager.prototype.on=function(name,listener){this.getListeners(name).push(listener);};EventManager.prototype.off=function(name,listener){pull_1(this.getListeners(name),listener);};EventManager.prototype.getListeners=function(name){var listeners=this.listeners[name];if(!listeners){listeners=this.listeners[name]=[];}return listeners;};return EventManager;}();function createEventManager(){var eventManager=new EventManager();return {on:function on(eventName,listener){eventManager.on(eventName,listener);},off:function off(eventName,listener){eventManager.off(eventName,listener);},fireEvent:function fireEvent(eventName,data){if(eventName==='authenticated'){var ar=enrichAuthResult(data);eventManager.fire(eventName,ar);}else {eventManager.fire(eventName,data);}}};}function createUrlParser(eventManager){return {checkUrlFragment:function checkUrlFragment(url){var authResult=this.parseUrlFragment(url);if(AuthResult.isAuthResult(authResult)){eventManager.fireEvent('authenticated',authResult);return true;}else if(ErrorResponse.isErrorResponse(authResult)){eventManager.fireEvent('authentication_failed',authResult);return true;}return false;},parseUrlFragment:function parseUrlFragment(url){if(url===void 0){url='';}var separatorIndex=url.indexOf('#');if(separatorIndex>=0){var parsed=parseQueryString(url.substr(separatorIndex+1));var expiresIn=parsed.expiresIn?parseInt(parsed.expiresIn,10):undefined;if(AuthResult.isAuthResult(parsed)){return _assign(_assign({},parsed),{expiresIn:expiresIn});}return ErrorResponse.isErrorResponse(parsed)?parsed:undefined;}return undefined;}};}function createHttpClient(config){function get(path,params){return request(path,_assign(_assign({},params),{method:'GET'}));}function remove(path,params){return request(path,_assign(_assign({},params),{method:'DELETE'}));}function post(path,params){return request(path,_assign(_assign({},params),{method:'POST'}));}function request(path,params){var _a=params.method,method=_a===void 0?'GET':_a,_b=params.query,query=_b===void 0?{}:_b,body=params.body,_c=params.accessToken,accessToken=_c===void 0?null:_c,_d=params.withCookies,withCookies=_d===void 0?false:_d;var fullPath=query&&!isEmpty_1(query)?path+"?"+toQueryString(query):path;var url=fullPath.startsWith('http')?fullPath:config.baseUrl+fullPath;var fetchOptions=_assign(_assign({method:method,headers:_assign(_assign(_assign({},accessToken&&{Authorization:'Bearer '+accessToken}),config.language&&{'Accept-Language':config.language}),body&&{'Content-Type':'application/json;charset=UTF-8'})},withCookies&&config.acceptCookies&&{credentials:'include'}),body&&{body:JSON.stringify(snakeCaseProperties(body))});return rawRequest(url,fetchOptions);}return {get:get,remove:remove,post:post,request:request};}/**
|
|
8026
|
+
OAuthClient.prototype.orchestratedFlowParams=function(orchestrationToken,authOptions){if(authOptions===void 0){authOptions={};}var authParams=computeAuthOptions(authOptions);var correctedAuthParams=_assign({clientId:this.config.clientId,r5_request_token:orchestrationToken},pick_1(authParams,'responseType','redirectUri','clientId','persistent'));var uselessParams=difference_1(keys_1(authParams),keys_1(correctedAuthParams));if(uselessParams.length!==0)console.debug("Orchestrated flow: pruned parameters: "+uselessParams);return correctedAuthParams;};OAuthClient.prototype.authParams=function(opts,_a){var _b=(_a===void 0?{}:_a).acceptPopupMode,acceptPopupMode=_b===void 0?false:_b;var isConfidentialCodeWebMsg=!this.config.isPublic&&!!opts.useWebMessage&&(opts.responseType==='code'||opts.redirectUri);var overrideResponseType=isConfidentialCodeWebMsg?{responseType:'token',redirectUri:undefined}:{};return _assign({clientId:this.config.clientId},computeAuthOptions(_assign(_assign({},opts),overrideResponseType),{acceptPopupMode:acceptPopupMode},this.config.scope));};OAuthClient.prototype.getPkceParams=function(authParams){if(this.config.isPublic&&authParams.responseType==='code')return computePkceParams();else if(authParams.responseType==='token'&&this.config.pkceEnforced)return Promise.reject(new Error('Cannot use implicit flow when PKCE is enforced'));else return Promise.resolve({});};OAuthClient.prototype.acquireAuthorizationLock=function(){setWithExpiry('authorize_state','state',20000);};OAuthClient.prototype.acquireSessionLock=function(){setWithExpiry('session_state','state',20000);};OAuthClient.prototype.releaseSessionLock=function(){sessionStorage.removeItem('session_state');};OAuthClient.prototype.isSessionLocked=function(){return getWithExpiry('session_state')!==null;};OAuthClient.prototype.releaseAuthorizationLock=function(){sessionStorage.removeItem('authorize_state');};OAuthClient.prototype.isAuthorizationLocked=function(){return getWithExpiry('authorize_state')!==null;};return OAuthClient;}();var EventManager=/** @class */function(){function EventManager(){this.listeners={};}EventManager.prototype.fire=function(name,data){this.getListeners(name).forEach(function(listener){try{listener(data);}catch(e){logError(e);}});};EventManager.prototype.on=function(name,listener){this.getListeners(name).push(listener);};EventManager.prototype.off=function(name,listener){pull_1(this.getListeners(name),listener);};EventManager.prototype.getListeners=function(name){var listeners=this.listeners[name];if(!listeners){listeners=this.listeners[name]=[];}return listeners;};return EventManager;}();function createEventManager(){var eventManager=new EventManager();return {on:function on(eventName,listener){eventManager.on(eventName,listener);},off:function off(eventName,listener){eventManager.off(eventName,listener);},fireEvent:function fireEvent(eventName,data){if(eventName==='authenticated'){var ar=enrichAuthResult(data);eventManager.fire(eventName,ar);}else {eventManager.fire(eventName,data);}}};}function createUrlParser(eventManager){return {checkUrlFragment:function checkUrlFragment(url){var authResult=this.parseUrlFragment(url);if(AuthResult.isAuthResult(authResult)){eventManager.fireEvent('authenticated',authResult);return true;}else if(ErrorResponse.isErrorResponse(authResult)){eventManager.fireEvent('authentication_failed',authResult);return true;}return false;},parseUrlFragment:function parseUrlFragment(url){if(url===void 0){url='';}var separatorIndex=url.indexOf('#');if(separatorIndex>=0){var parsed=parseQueryString(url.substr(separatorIndex+1));var expiresIn=parsed.expiresIn?parseInt(parsed.expiresIn,10):undefined;if(AuthResult.isAuthResult(parsed)){return _assign(_assign({},parsed),{expiresIn:expiresIn});}return ErrorResponse.isErrorResponse(parsed)?parsed:undefined;}return undefined;}};}function createHttpClient(config){function get(path,params){return request(path,_assign(_assign({},params),{method:'GET'}));}function remove(path,params){return request(path,_assign(_assign({},params),{method:'DELETE'}));}function post(path,params){return request(path,_assign(_assign({},params),{method:'POST'}));}function request(path,params){var _a=params.method,method=_a===void 0?'GET':_a,_b=params.query,query=_b===void 0?{}:_b,body=params.body,_c=params.accessToken,accessToken=_c===void 0?null:_c,_d=params.withCookies,withCookies=_d===void 0?false:_d;var fullPath=query&&!isEmpty_1(query)?path+"?"+toQueryString(query):path;var url=fullPath.startsWith('http')?fullPath:config.baseUrl+fullPath;var fetchOptions=_assign(_assign({method:method,headers:_assign(_assign(_assign({},accessToken&&{Authorization:'Bearer '+accessToken}),config.language&&{'Accept-Language':config.language}),body&&{'Content-Type':'application/json;charset=UTF-8'})},withCookies&&config.acceptCookies&&{credentials:'include'}),body&&{body:JSON.stringify(snakeCaseProperties(body))});return rawRequest(url,fetchOptions);}return {get:get,remove:remove,post:post,request:request};}/**
|
|
8027
8027
|
* Low level HTTP client
|
|
8028
8028
|
*/function rawRequest(url,fetchOptions){return fetch(url,fetchOptions).then(function(response){if(response.status!==204){var dataP=response.json().then(camelCaseProperties);return response.ok?dataP:dataP.then(function(data){return Promise.reject(data);});}return undefined;});}function initCordovaCallbackIfNecessary(urlParser){if(!window.cordova)return;if(window.handleOpenURL)return;window.handleOpenURL=function(url){var cordova=window.cordova;if(!cordova)return;var parsed=urlParser.checkUrlFragment(url);if(parsed&&cordova.plugins&&cordova.plugins.browsertab){cordova.plugins.browsertab.close();}};}/**
|
|
8029
8029
|
* Identity Rest API Client
|
|
8030
|
-
*/var MfaClient=/** @class */function(){function MfaClient(props){this.http=props.http;this.oAuthClient=props.oAuthClient;this.credentialsUrl='/mfa/credentials';this.emailCredentialUrl=this.credentialsUrl+"/emails";this.emailCredentialVerifyUrl=this.emailCredentialUrl+"/verify";this.passwordlessVerifyUrl='/passwordless/verify';this.phoneNumberCredentialUrl=this.credentialsUrl+"/phone-numbers";this.phoneNumberCredentialVerifyUrl=this.phoneNumberCredentialUrl+"/verify";this.stepUpUrl='/mfa/stepup';}MfaClient.prototype.getMfaStepUpToken=function(params){var _this=this;var _a;var authParams=this.oAuthClient.authParams((_a=params.options)!==null&&_a!==void 0?_a:{});return this.oAuthClient.getPkceParams(authParams).then(function(challenge){return _this.http.post(_this.stepUpUrl,{body:_assign(_assign({},authParams),challenge),withCookies:params.accessToken===undefined,accessToken:params.accessToken});});};MfaClient.prototype.listMfaCredentials=function(accessToken){return this.http.get(this.credentialsUrl,{accessToken:accessToken});};MfaClient.prototype.removeMfaEmail=function(params){var accessToken=params.accessToken;return this.http.remove(this.emailCredentialUrl,{accessToken:accessToken});};MfaClient.prototype.removeMfaPhoneNumber=function(params){var accessToken=params.accessToken,phoneNumber=params.phoneNumber;return this.http.remove(this.phoneNumberCredentialUrl,{body:{phoneNumber:phoneNumber},accessToken:accessToken});};MfaClient.prototype.startMfaEmailRegistration=function(params){var accessToken=params.accessToken;return this.http.post(this.emailCredentialUrl,{accessToken:accessToken});};MfaClient.prototype.startMfaPhoneNumberRegistration=function(params){var accessToken=params.accessToken,phoneNumber=params.phoneNumber;return this.http.post(this.phoneNumberCredentialUrl,{body:{phoneNumber:phoneNumber},accessToken:accessToken});};MfaClient.prototype.verifyMfaEmailRegistration=function(params){var accessToken=params.accessToken,verificationCode=params.verificationCode;return this.http.post(this.emailCredentialVerifyUrl,{body:{verificationCode:verificationCode},accessToken:accessToken});};MfaClient.prototype.verifyMfaPasswordless=function(params){var challengeId=params.challengeId,verificationCode=params.verificationCode,
|
|
8030
|
+
*/var MfaClient=/** @class */function(){function MfaClient(props){this.http=props.http;this.oAuthClient=props.oAuthClient;this.credentialsUrl='/mfa/credentials';this.emailCredentialUrl=this.credentialsUrl+"/emails";this.emailCredentialVerifyUrl=this.emailCredentialUrl+"/verify";this.passwordlessVerifyUrl='/passwordless/verify';this.phoneNumberCredentialUrl=this.credentialsUrl+"/phone-numbers";this.phoneNumberCredentialVerifyUrl=this.phoneNumberCredentialUrl+"/verify";this.stepUpUrl='/mfa/stepup';this.trustedDeviceUrl='/mfa/trusteddevices';}MfaClient.prototype.getMfaStepUpToken=function(params){var _this=this;var _a;var authParams=this.oAuthClient.authParams((_a=params.options)!==null&&_a!==void 0?_a:{});return this.oAuthClient.getPkceParams(authParams).then(function(challenge){return _this.http.post(_this.stepUpUrl,{body:_assign(_assign(_assign({},authParams),{tkn:params.tkn}),challenge),withCookies:params.accessToken===undefined,accessToken:params.accessToken});});};MfaClient.prototype.listMfaCredentials=function(accessToken){return this.http.get(this.credentialsUrl,{accessToken:accessToken});};MfaClient.prototype.removeMfaEmail=function(params){var accessToken=params.accessToken;return this.http.remove(this.emailCredentialUrl,{accessToken:accessToken});};MfaClient.prototype.removeMfaPhoneNumber=function(params){var accessToken=params.accessToken,phoneNumber=params.phoneNumber;return this.http.remove(this.phoneNumberCredentialUrl,{body:{phoneNumber:phoneNumber},accessToken:accessToken});};MfaClient.prototype.startMfaEmailRegistration=function(params){var accessToken=params.accessToken;return this.http.post(this.emailCredentialUrl,{accessToken:accessToken});};MfaClient.prototype.startMfaPhoneNumberRegistration=function(params){var accessToken=params.accessToken,phoneNumber=params.phoneNumber;return this.http.post(this.phoneNumberCredentialUrl,{body:{phoneNumber:phoneNumber},accessToken:accessToken});};MfaClient.prototype.verifyMfaEmailRegistration=function(params){var accessToken=params.accessToken,verificationCode=params.verificationCode;return this.http.post(this.emailCredentialVerifyUrl,{body:{verificationCode:verificationCode},accessToken:accessToken});};MfaClient.prototype.verifyMfaPasswordless=function(params){var challengeId=params.challengeId,verificationCode=params.verificationCode,trustDevice=params.trustDevice;return this.http.post(this.passwordlessVerifyUrl,{body:{challengeId:challengeId,verificationCode:verificationCode,trustDevice:trustDevice}});};MfaClient.prototype.verifyMfaPhoneNumberRegistration=function(params){var accessToken=params.accessToken,verificationCode=params.verificationCode;return this.http.post(this.phoneNumberCredentialVerifyUrl,{body:{verificationCode:verificationCode},accessToken:accessToken});};MfaClient.prototype.listTrustedDevices=function(accessToken){return this.http.get(this.trustedDeviceUrl,{accessToken:accessToken});};MfaClient.prototype.deleteTrustedDevices=function(params){var accessToken=params.accessToken,trustedDeviceId=params.trustedDeviceId;return this.http.remove(this.trustedDeviceUrl+'/'+trustedDeviceId,{accessToken:accessToken});};return MfaClient;}();/**
|
|
8031
8031
|
* Identity Rest API Client
|
|
8032
|
-
*/var ProfileClient=/** @class */function(){function ProfileClient(props){this.config=props.config;this.http=props.http;this.eventManager=props.eventManager;this.sendEmailVerificationUrl='/send-email-verification';this.sendPhoneNumberVerificationUrl='/send-phone-number-verification';this.signupDataUrl='/signup/data';this.unlinkUrl='/unlink';this.updateEmailUrl='/update-email';this.updatePasswordUrl='/update-password';this.updatePhoneNumberUrl='/update-phone-number';this.updateProfileUrl='/update-profile';this.userInfoUrl='/userinfo';this.verifyPhoneNumberUrl='/verify-phone-number';}ProfileClient.prototype.getSignupData=function(signupToken){return this.http.get(this.signupDataUrl,{query:{clientId:this.config.clientId,token:signupToken}});};ProfileClient.prototype.getUser=function(params){var accessToken=params.accessToken,fields=params.fields;return this.http.get(this.userInfoUrl,{query:{fields:fields},accessToken:accessToken});};ProfileClient.prototype.requestPasswordReset=function(params){return this.http.post('/forgot-password',{body:_assign({clientId:this.config.clientId},params)});};ProfileClient.prototype.sendEmailVerification=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.sendEmailVerificationUrl,{body:_assign({},data),accessToken:accessToken});};ProfileClient.prototype.sendPhoneNumberVerification=function(params){var accessToken=params.accessToken;return this.http.post(this.sendPhoneNumberVerificationUrl,{accessToken:accessToken});};ProfileClient.prototype.unlink=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.unlinkUrl,{body:data,accessToken:accessToken});};ProfileClient.prototype.updateEmail=function(params){var accessToken=params.accessToken,email=params.email,redirectUrl=params.redirectUrl;return this.http.post(this.updateEmailUrl,{body:{email:email,redirectUrl:redirectUrl},accessToken:accessToken});};ProfileClient.prototype.updatePhoneNumber=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.updatePhoneNumberUrl,{body:data,accessToken:accessToken});};ProfileClient.prototype.updateProfile=function(params){var _this=this;var accessToken=params.accessToken,redirectUrl=params.redirectUrl,data=params.data;return this.http.post(this.updateProfileUrl,{body:_assign(_assign({},data),{redirectUrl:redirectUrl}),accessToken:accessToken}).then(function(){return _this.eventManager.fireEvent('profile_updated',data);});};ProfileClient.prototype.updatePassword=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.updatePasswordUrl,{body:_assign({clientId:this.config.clientId},data),accessToken:accessToken});};ProfileClient.prototype.verifyPhoneNumber=function(params){var _this=this;var accessToken=params.accessToken,data=__rest(params,["accessToken"]);var phoneNumber=data.phoneNumber;return this.http.post(this.verifyPhoneNumberUrl,{body:data,accessToken:accessToken}).then(function(){return _this.eventManager.fireEvent('profile_updated',{phoneNumber:phoneNumber,phoneNumberVerified:true});});};return ProfileClient;}();var publicKeyCredentialType='public-key';function encodePublicKeyCredentialCreationOptions(serializedOptions){return _assign(_assign({},serializedOptions),{challenge:buffer_1.from(serializedOptions.challenge,'base64'),user:_assign(_assign({},serializedOptions.user),{id:buffer_1.from(serializedOptions.user.id,'base64')}),excludeCredentials:serializedOptions.excludeCredentials&&serializedOptions.excludeCredentials.map(function(excludeCredential){return _assign(_assign({},excludeCredential),{id:buffer_1.from(excludeCredential.id,'base64')});})});}function encodePublicKeyCredentialRequestOptions(serializedOptions){return _assign(_assign({},serializedOptions),{challenge:buffer_1.from(serializedOptions.challenge,'base64'),allowCredentials:serializedOptions.allowCredentials.map(function(allowCrendential){return _assign(_assign({},allowCrendential),{id:buffer_1.from(allowCrendential.id,'base64')});})});}function serializeRegistrationPublicKeyCredential(encodedPublicKey){var response=encodedPublicKey.response;return {id:encodedPublicKey.id,rawId:encodeToBase64(encodedPublicKey.rawId),type:encodedPublicKey.type,response:{clientDataJSON:encodeToBase64(response.clientDataJSON),attestationObject:encodeToBase64(response.attestationObject)}};}function serializeAuthenticationPublicKeyCredential(encodedPublicKey){var response=encodedPublicKey.response;return {id:encodedPublicKey.id,rawId:encodeToBase64(encodedPublicKey.rawId),type:encodedPublicKey.type,response:{authenticatorData:encodeToBase64(response.authenticatorData),clientDataJSON:encodeToBase64(response.clientDataJSON),signature:encodeToBase64(response.signature),userHandle:response.userHandle&&encodeToBase64(response.userHandle)}};}/**
|
|
8032
|
+
*/var ProfileClient=/** @class */function(){function ProfileClient(props){this.config=props.config;this.http=props.http;this.eventManager=props.eventManager;this.sendEmailVerificationUrl='/send-email-verification';this.sendPhoneNumberVerificationUrl='/send-phone-number-verification';this.signupDataUrl='/signup/data';this.unlinkUrl='/unlink';this.updateEmailUrl='/update-email';this.updatePasswordUrl='/update-password';this.updatePhoneNumberUrl='/update-phone-number';this.updateProfileUrl='/update-profile';this.userInfoUrl='/userinfo';this.verifyPhoneNumberUrl='/verify-phone-number';}ProfileClient.prototype.getSignupData=function(signupToken){return this.http.get(this.signupDataUrl,{query:{clientId:this.config.clientId,token:signupToken}});};ProfileClient.prototype.getUser=function(params){var accessToken=params.accessToken,fields=params.fields;return this.http.get(this.userInfoUrl,{query:{fields:fields},accessToken:accessToken});};ProfileClient.prototype.requestPasswordReset=function(params){return this.http.post('/forgot-password',{body:_assign({clientId:this.config.clientId},params)});};ProfileClient.prototype.sendEmailVerification=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.sendEmailVerificationUrl,{body:_assign({},data),accessToken:accessToken});};ProfileClient.prototype.sendPhoneNumberVerification=function(params){var accessToken=params.accessToken;return this.http.post(this.sendPhoneNumberVerificationUrl,{accessToken:accessToken});};ProfileClient.prototype.unlink=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.unlinkUrl,{body:data,accessToken:accessToken});};ProfileClient.prototype.updateEmail=function(params){var accessToken=params.accessToken,email=params.email,redirectUrl=params.redirectUrl,captchaToken=params.captchaToken;return this.http.post(this.updateEmailUrl,{body:{email:email,redirectUrl:redirectUrl,captchaToken:captchaToken},accessToken:accessToken});};ProfileClient.prototype.updatePhoneNumber=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.updatePhoneNumberUrl,{body:data,accessToken:accessToken});};ProfileClient.prototype.updateProfile=function(params){var _this=this;var accessToken=params.accessToken,redirectUrl=params.redirectUrl,data=params.data;return this.http.post(this.updateProfileUrl,{body:_assign(_assign({},data),{redirectUrl:redirectUrl}),accessToken:accessToken}).then(function(){return _this.eventManager.fireEvent('profile_updated',data);});};ProfileClient.prototype.updatePassword=function(params){var accessToken=params.accessToken,data=__rest(params,["accessToken"]);return this.http.post(this.updatePasswordUrl,{body:_assign({clientId:this.config.clientId},data),accessToken:accessToken});};ProfileClient.prototype.verifyPhoneNumber=function(params){var _this=this;var accessToken=params.accessToken,data=__rest(params,["accessToken"]);var phoneNumber=data.phoneNumber;return this.http.post(this.verifyPhoneNumberUrl,{body:data,accessToken:accessToken}).then(function(){return _this.eventManager.fireEvent('profile_updated',{phoneNumber:phoneNumber,phoneNumberVerified:true});});};return ProfileClient;}();var publicKeyCredentialType='public-key';function encodePublicKeyCredentialCreationOptions(serializedOptions){return _assign(_assign({},serializedOptions),{challenge:buffer_1.from(serializedOptions.challenge,'base64'),user:_assign(_assign({},serializedOptions.user),{id:buffer_1.from(serializedOptions.user.id,'base64')}),excludeCredentials:serializedOptions.excludeCredentials&&serializedOptions.excludeCredentials.map(function(excludeCredential){return _assign(_assign({},excludeCredential),{id:buffer_1.from(excludeCredential.id,'base64')});})});}function encodePublicKeyCredentialRequestOptions(serializedOptions){return _assign(_assign({},serializedOptions),{challenge:buffer_1.from(serializedOptions.challenge,'base64'),allowCredentials:serializedOptions.allowCredentials.map(function(allowCrendential){return _assign(_assign({},allowCrendential),{id:buffer_1.from(allowCrendential.id,'base64')});})});}function serializeRegistrationPublicKeyCredential(encodedPublicKey){var response=encodedPublicKey.response;return {id:encodedPublicKey.id,rawId:encodeToBase64(encodedPublicKey.rawId),type:encodedPublicKey.type,response:{clientDataJSON:encodeToBase64(response.clientDataJSON),attestationObject:encodeToBase64(response.attestationObject)}};}function serializeAuthenticationPublicKeyCredential(encodedPublicKey){var response=encodedPublicKey.response;return {id:encodedPublicKey.id,rawId:encodeToBase64(encodedPublicKey.rawId),type:encodedPublicKey.type,response:{authenticatorData:encodeToBase64(response.authenticatorData),clientDataJSON:encodeToBase64(response.clientDataJSON),signature:encodeToBase64(response.signature),userHandle:response.userHandle&&encodeToBase64(response.userHandle)}};}/**
|
|
8033
8033
|
* Identity Rest API Client
|
|
8034
|
-
*/var WebAuthnClient=/** @class */function(){function WebAuthnClient(props){this.authenticationOptionsUrl='/webauthn/authentication-options';this.authenticationUrl='/webauthn/authentication';this.registrationOptionsUrl='/webauthn/registration-options';this.registrationUrl='/webauthn/registration';this.signupOptionsUrl='/webauthn/signup-options';this.signupUrl='/webauthn/signup';this.config=props.config;this.http=props.http;this.eventManager=props.eventManager;this.oAuthClient=props.oAuthClient;this.authenticationOptionsUrl='/webauthn/authentication-options';this.authenticationUrl='/webauthn/authentication';this.registrationOptionsUrl='/webauthn/registration-options';this.registrationUrl='/webauthn/registration';this.signupOptionsUrl='/webauthn/signup-options';this.signupUrl='/webauthn/signup';}WebAuthnClient.prototype.addNewWebAuthnDevice=function(accessToken,friendlyName){var _this=this;if(window.PublicKeyCredential){var body={origin:window.location.origin,friendlyName:friendlyName||window.navigator.platform};return this.http.post(this.registrationOptionsUrl,{body:body,accessToken:accessToken}).then(function(response){var publicKey=encodePublicKeyCredentialCreationOptions(response.options.publicKey);return navigator.credentials.create({publicKey:publicKey});}).then(function(credentials){if(!credentials||credentials.type!==publicKeyCredentialType){return Promise.reject(new Error('Unable to register invalid public key credentials.'));}var serializedCredentials=serializeRegistrationPublicKeyCredential(credentials);return _this.http.post(_this.registrationUrl,{body:_assign({},serializedCredentials),accessToken:accessToken});})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);});}else {return Promise.reject(new Error('Unsupported WebAuthn API'));}};WebAuthnClient.prototype.listWebAuthnDevices=function(accessToken){return this.http.get(this.registrationUrl,{accessToken:accessToken});};WebAuthnClient.prototype.loginWithWebAuthn=function(params){var _this=this;if(window.PublicKeyCredential){var body={clientId:this.config.clientId,origin:window.location.origin,scope:resolveScope(params.auth,this.config.scope),email:params.email,phoneNumber:params.phoneNumber};return this.http.post(this.authenticationOptionsUrl,{body:body}).then(function(response){var options=encodePublicKeyCredentialRequestOptions(response.publicKey);return navigator.credentials.get({publicKey:options});}).then(function(credentials){if(!credentials||credentials.type!==publicKeyCredentialType){return Promise.reject(new Error('Unable to authenticate with invalid public key credentials.'));}var serializedCredentials=serializeAuthenticationPublicKeyCredential(credentials);return _this.http.post(_this.authenticationUrl,{body:_assign({},serializedCredentials)}).then(function(tkn){return _this.oAuthClient.loginCallback(tkn,params.auth);});})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);});}else {return Promise.reject(new Error('Unsupported WebAuthn API'));}};WebAuthnClient.prototype.removeWebAuthnDevice=function(accessToken,deviceId){return this.http.remove(this.registrationUrl+"/"+deviceId,{accessToken:accessToken});};WebAuthnClient.prototype.signupWithWebAuthn=function(params,auth){var _this=this;if(window.PublicKeyCredential){var body={origin:window.location.origin,clientId:this.config.clientId,friendlyName:params.friendlyName||window.navigator.platform,profile:params.profile,scope:resolveScope(auth,this.config.scope),redirectUrl:params.redirectUrl,returnToAfterEmailConfirmation:params.returnToAfterEmailConfirmation};var registrationOptionsPromise=this.http.post(this.signupOptionsUrl,{body:body});var credentialsPromise=registrationOptionsPromise.then(function(response){var publicKey=encodePublicKeyCredentialCreationOptions(response.options.publicKey);return navigator.credentials.create({publicKey:publicKey});});return Promise.all([registrationOptionsPromise,credentialsPromise]).then(function(_a){var registrationOptions=_a[0],credentials=_a[1];if(!credentials||credentials.type!==publicKeyCredentialType){return Promise.reject(new Error('Unable to register invalid public key credentials.'));}var serializedCredentials=serializeRegistrationPublicKeyCredential(credentials);return _this.http.post(_this.signupUrl,{body:{publicKeyCredential:serializedCredentials,webauthnId:registrationOptions.options.publicKey.user.id}}).then(function(tkn){return _this.oAuthClient.loginCallback(tkn,auth);});})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);});}else {return Promise.reject(new Error('Unsupported WebAuthn API'));}};return WebAuthnClient;}();function checkParam(data,key){var value=data[key];if(value===undefined||value===null){throw new Error("The reach5 creation config has errors: "+key+" is not set");}}function createClient(creationConfig){checkParam(creationConfig,'domain');checkParam(creationConfig,'clientId');var domain=creationConfig.domain,clientId=creationConfig.clientId,language=creationConfig.language;var eventManager=createEventManager();var urlParser=createUrlParser(eventManager);initCordovaCallbackIfNecessary(urlParser);var baseUrl="https://"+domain;var baseIdentityUrl=baseUrl+"/identity/v1";var remoteSettings=rawRequest("https://"+domain+"/identity/v1/config?"+toQueryString({clientId:clientId,lang:language}));var apiClients=remoteSettings.then(function(remoteConfig){var language=remoteConfig.language,sso=remoteConfig.sso;var params=new URLSearchParams(window.location.search);var orchestrationToken=params.get('r5_request_token')||undefined;var config=_assign({clientId:clientId,baseUrl:baseUrl,orchestrationToken:orchestrationToken},remoteConfig);var http=createHttpClient({baseUrl:baseIdentityUrl,language:language,acceptCookies:sso});var oAuthClient=new OAuthClient({config:config,http:http,eventManager:eventManager});
|
|
8034
|
+
*/var WebAuthnClient=/** @class */function(){function WebAuthnClient(props){this.authenticationOptionsUrl='/webauthn/authentication-options';this.authenticationUrl='/webauthn/authentication';this.registrationOptionsUrl='/webauthn/registration-options';this.registrationUrl='/webauthn/registration';this.signupOptionsUrl='/webauthn/signup-options';this.signupUrl='/webauthn/signup';this.config=props.config;this.http=props.http;this.eventManager=props.eventManager;this.oAuthClient=props.oAuthClient;this.authenticationOptionsUrl='/webauthn/authentication-options';this.authenticationUrl='/webauthn/authentication';this.registrationOptionsUrl='/webauthn/registration-options';this.registrationUrl='/webauthn/registration';this.signupOptionsUrl='/webauthn/signup-options';this.signupUrl='/webauthn/signup';}WebAuthnClient.prototype.addNewWebAuthnDevice=function(accessToken,friendlyName){var _this=this;if(window.PublicKeyCredential){var body={origin:window.location.origin,friendlyName:friendlyName||window.navigator.platform};return this.http.post(this.registrationOptionsUrl,{body:body,accessToken:accessToken}).then(function(response){var publicKey=encodePublicKeyCredentialCreationOptions(response.options.publicKey);return navigator.credentials.create({publicKey:publicKey});}).then(function(credentials){if(!credentials||credentials.type!==publicKeyCredentialType){return Promise.reject(new Error('Unable to register invalid public key credentials.'));}var serializedCredentials=serializeRegistrationPublicKeyCredential(credentials);return _this.http.post(_this.registrationUrl,{body:_assign({},serializedCredentials),accessToken:accessToken});})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);});}else {return Promise.reject(new Error('Unsupported WebAuthn API'));}};WebAuthnClient.prototype.listWebAuthnDevices=function(accessToken){return this.http.get(this.registrationUrl,{accessToken:accessToken});};WebAuthnClient.prototype.loginWithWebAuthn=function(params){var _this=this;if(window.PublicKeyCredential){var body={clientId:this.config.clientId,origin:window.location.origin,scope:resolveScope(params.auth,this.config.scope),email:params.email,phoneNumber:params.phoneNumber};return this.http.post(this.authenticationOptionsUrl,{body:body}).then(function(response){var options=encodePublicKeyCredentialRequestOptions(response.publicKey);return navigator.credentials.get({publicKey:options});}).then(function(credentials){if(!credentials||credentials.type!==publicKeyCredentialType){return Promise.reject(new Error('Unable to authenticate with invalid public key credentials.'));}var serializedCredentials=serializeAuthenticationPublicKeyCredential(credentials);return _this.http.post(_this.authenticationUrl,{body:_assign({},serializedCredentials)}).then(function(tkn){return _this.oAuthClient.loginCallback(tkn,params.auth);});})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);});}else {return Promise.reject(new Error('Unsupported WebAuthn API'));}};WebAuthnClient.prototype.removeWebAuthnDevice=function(accessToken,deviceId){return this.http.remove(this.registrationUrl+"/"+deviceId,{accessToken:accessToken});};WebAuthnClient.prototype.signupWithWebAuthn=function(params,auth){var _this=this;if(window.PublicKeyCredential){var body={origin:window.location.origin,clientId:this.config.clientId,friendlyName:params.friendlyName||window.navigator.platform,profile:params.profile,scope:resolveScope(auth,this.config.scope),redirectUrl:params.redirectUrl,returnToAfterEmailConfirmation:params.returnToAfterEmailConfirmation};var registrationOptionsPromise=this.http.post(this.signupOptionsUrl,{body:body});var credentialsPromise=registrationOptionsPromise.then(function(response){var publicKey=encodePublicKeyCredentialCreationOptions(response.options.publicKey);return navigator.credentials.create({publicKey:publicKey});});return Promise.all([registrationOptionsPromise,credentialsPromise]).then(function(_a){var registrationOptions=_a[0],credentials=_a[1];if(!credentials||credentials.type!==publicKeyCredentialType){return Promise.reject(new Error('Unable to register invalid public key credentials.'));}var serializedCredentials=serializeRegistrationPublicKeyCredential(credentials);return _this.http.post(_this.signupUrl,{body:{publicKeyCredential:serializedCredentials,webauthnId:registrationOptions.options.publicKey.user.id}}).then(function(tkn){return _this.oAuthClient.loginCallback(tkn,auth);});})["catch"](function(err){if(err.error)_this.eventManager.fireEvent('login_failed',err);return Promise.reject(err);});}else {return Promise.reject(new Error('Unsupported WebAuthn API'));}};return WebAuthnClient;}();function checkParam(data,key){var value=data[key];if(value===undefined||value===null){throw new Error("The reach5 creation config has errors: "+key+" is not set");}}function createClient(creationConfig){checkParam(creationConfig,'domain');checkParam(creationConfig,'clientId');var domain=creationConfig.domain,clientId=creationConfig.clientId,language=creationConfig.language;var eventManager=createEventManager();var urlParser=createUrlParser(eventManager);initCordovaCallbackIfNecessary(urlParser);var baseUrl="https://"+domain;var baseIdentityUrl=baseUrl+"/identity/v1";var remoteSettings=rawRequest("https://"+domain+"/identity/v1/config?"+toQueryString({clientId:clientId,lang:language}));var apiClients=remoteSettings.then(function(remoteConfig){var language=remoteConfig.language,sso=remoteConfig.sso;var params=new URLSearchParams(window.location.search);var orchestrationToken=params.get('r5_request_token')||undefined;var config=_assign({clientId:clientId,baseUrl:baseUrl,orchestrationToken:orchestrationToken},remoteConfig);var http=createHttpClient({baseUrl:baseIdentityUrl,language:language,acceptCookies:sso});var oAuthClient=new OAuthClient({config:config,http:http,eventManager:eventManager});var mfaClient=new MfaClient({http:http,oAuthClient:oAuthClient});oAuthClient.setMfaClient(mfaClient);return {oAuth:oAuthClient,mfa:mfaClient,webAuthn:new WebAuthnClient({config:config,http:http,eventManager:eventManager,oAuthClient:oAuthClient}),profile:new ProfileClient({config:config,http:http,eventManager:eventManager})};});function addNewWebAuthnDevice(accessToken,friendlyName){return apiClients.then(function(clients){return clients.webAuthn.addNewWebAuthnDevice(accessToken,friendlyName);});}function checkSession(options){if(options===void 0){options={};}return apiClients.then(function(clients){return clients.oAuth.checkSession(options);});}function checkUrlFragment(url){if(url===void 0){url=window.location.href;}var authResponseDetected=urlParser.checkUrlFragment(url);if(authResponseDetected&&url===window.location.href){window.location.hash='';}return authResponseDetected;}function exchangeAuthorizationCodeWithPkce(params){return apiClients.then(function(clients){return clients.oAuth.exchangeAuthorizationCodeWithPkce(params);});}function getMfaStepUpToken(params){return apiClients.then(function(clients){return clients.mfa.getMfaStepUpToken(params);});}function getSessionInfo(){return apiClients.then(function(clients){return clients.oAuth.getSessionInfo();});}function getSignupData(signupToken){return apiClients.then(function(clients){return clients.profile.getSignupData(signupToken);});}function getUser(params){return apiClients.then(function(clients){return clients.profile.getUser(params);});}function listMfaCredentials(accessToken){return apiClients.then(function(clients){return clients.mfa.listMfaCredentials(accessToken);});}function listWebAuthnDevices(accessToken){return apiClients.then(function(clients){return clients.webAuthn.listWebAuthnDevices(accessToken);});}function loginFromSession(options){if(options===void 0){options={};}return apiClients.then(function(clients){return clients.oAuth.loginFromSession(options);});}function loginWithCredentials(params){return apiClients.then(function(clients){return clients.oAuth.loginWithCredentials(params);});}function loginWithCustomToken(params){return apiClients.then(function(clients){return clients.oAuth.loginWithCustomToken(params);});}function loginWithPassword(params){return apiClients.then(function(clients){return clients.oAuth.loginWithPassword(params);});}function instantiateOneTap(opts){if(opts===void 0){opts={};}return apiClients.then(function(clients){return clients.oAuth.instantiateOneTap(opts);});}function listTrustedDevices(accessToken){return apiClients.then(function(clients){return clients.mfa.listTrustedDevices(accessToken);});}function loginWithSocialProvider(provider,options){if(options===void 0){options={};}return apiClients.then(function(clients){return clients.oAuth.loginWithSocialProvider(provider,options);});}function loginWithWebAuthn(params){return apiClients.then(function(clients){return clients.webAuthn.loginWithWebAuthn(params);});}function logout(params,revocationParams){if(params===void 0){params={};}return apiClients.then(function(clients){return clients.oAuth.logout(params,revocationParams);});}function off(eventName,listener){return eventManager.off(eventName,listener);}function on(eventName,listener){eventManager.on(eventName,listener);if(eventName==='authenticated'||eventName==='authentication_failed'){// This call must be asynchronous to ensure the listener cannot be called synchronously
|
|
8035
8035
|
// (this type of behavior is generally unexpected for the developer)
|
|
8036
|
-
setTimeout(function(){return checkUrlFragment();},0);}}function refreshTokens(params){return apiClients.then(function(clients){return clients.oAuth.refreshTokens(params);});}function removeMfaEmail(params){return apiClients.then(function(clients){return clients.mfa.removeMfaEmail(params);});}function removeMfaPhoneNumber(params){return apiClients.then(function(clients){return clients.mfa.removeMfaPhoneNumber(params);});}function removeWebAuthnDevice(accessToken,deviceId){return apiClients.then(function(clients){return clients.webAuthn.removeWebAuthnDevice(accessToken,deviceId);});}function requestPasswordReset(params){return apiClients.then(function(clients){return clients.profile.requestPasswordReset(params);});}function sendEmailVerification(params){return apiClients.then(function(clients){return clients.profile.sendEmailVerification(params);});}function sendPhoneNumberVerification(params){return apiClients.then(function(clients){return clients.profile.sendPhoneNumberVerification(params);});}function signup(params){return apiClients.then(function(clients){return clients.oAuth.signup(params);});}function signupWithWebAuthn(params,auth){return apiClients.then(function(clients){return clients.webAuthn.signupWithWebAuthn(params,auth);});}function startMfaEmailRegistration(params){return apiClients.then(function(clients){return clients.mfa.startMfaEmailRegistration(params);});}function startMfaPhoneNumberRegistration(params){return apiClients.then(function(clients){return clients.mfa.startMfaPhoneNumberRegistration(params);});}function startPasswordless(params,options){if(options===void 0){options={};}return apiClients.then(function(clients){return clients.oAuth.startPasswordless(params,options);});}function unlink(params){return apiClients.then(function(clients){return clients.profile.unlink(params);});}function updateEmail(params){return apiClients.then(function(clients){return clients.profile.updateEmail(params);});}function updatePassword(params){return apiClients.then(function(clients){return clients.profile.updatePassword(params);});}function updatePhoneNumber(params){return apiClients.then(function(clients){return clients.profile.updatePhoneNumber(params);});}function updateProfile(params){return apiClients.then(function(clients){return clients.profile.updateProfile(params);});}function verifyMfaEmailRegistration(params){return apiClients.then(function(clients){return clients.mfa.verifyMfaEmailRegistration(params);});}function verifyMfaPasswordless(params){return apiClients.then(function(clients){return clients.mfa.verifyMfaPasswordless(params);});}function verifyMfaPhoneNumberRegistration(params){return apiClients.then(function(clients){return clients.mfa.verifyMfaPhoneNumberRegistration(params);});}function verifyPasswordless(params,auth){return apiClients.then(function(clients){return clients.oAuth.verifyPasswordless(params,auth);});}function verifyPhoneNumber(params){return apiClients.then(function(clients){return clients.profile.verifyPhoneNumber(params);});}return {addNewWebAuthnDevice:addNewWebAuthnDevice,checkSession:checkSession,checkUrlFragment:checkUrlFragment,exchangeAuthorizationCodeWithPkce:exchangeAuthorizationCodeWithPkce,getMfaStepUpToken:getMfaStepUpToken,getSessionInfo:getSessionInfo,getSignupData:getSignupData,getUser:getUser,listMfaCredentials:listMfaCredentials,listWebAuthnDevices:listWebAuthnDevices,loginFromSession:loginFromSession,loginWithCredentials:loginWithCredentials,loginWithCustomToken:loginWithCustomToken,loginWithPassword:loginWithPassword,instantiateOneTap:instantiateOneTap,loginWithSocialProvider:loginWithSocialProvider,loginWithWebAuthn:loginWithWebAuthn,logout:logout,off:off,on:on,refreshTokens:refreshTokens,remoteSettings:remoteSettings,removeMfaEmail:removeMfaEmail,removeMfaPhoneNumber:removeMfaPhoneNumber,removeWebAuthnDevice:removeWebAuthnDevice,requestPasswordReset:requestPasswordReset,sendEmailVerification:sendEmailVerification,sendPhoneNumberVerification:sendPhoneNumberVerification,signup:signup,signupWithWebAuthn:signupWithWebAuthn,startMfaEmailRegistration:startMfaEmailRegistration,startMfaPhoneNumberRegistration:startMfaPhoneNumberRegistration,startPasswordless:startPasswordless,unlink:unlink,updateEmail:updateEmail,updatePassword:updatePassword,updatePhoneNumber:updatePhoneNumber,updateProfile:updateProfile,verifyMfaEmailRegistration:verifyMfaEmailRegistration,verifyMfaPasswordless:verifyMfaPasswordless,verifyMfaPhoneNumberRegistration:verifyMfaPhoneNumberRegistration,verifyPasswordless:verifyPasswordless,verifyPhoneNumber:verifyPhoneNumber};}
|
|
8036
|
+
setTimeout(function(){return checkUrlFragment();},0);}}function refreshTokens(params){return apiClients.then(function(clients){return clients.oAuth.refreshTokens(params);});}function removeMfaEmail(params){return apiClients.then(function(clients){return clients.mfa.removeMfaEmail(params);});}function removeMfaPhoneNumber(params){return apiClients.then(function(clients){return clients.mfa.removeMfaPhoneNumber(params);});}function removeTrustedDevice(params){return apiClients.then(function(clients){return clients.mfa.deleteTrustedDevices(params);});}function removeWebAuthnDevice(accessToken,deviceId){return apiClients.then(function(clients){return clients.webAuthn.removeWebAuthnDevice(accessToken,deviceId);});}function requestPasswordReset(params){return apiClients.then(function(clients){return clients.profile.requestPasswordReset(params);});}function sendEmailVerification(params){return apiClients.then(function(clients){return clients.profile.sendEmailVerification(params);});}function sendPhoneNumberVerification(params){return apiClients.then(function(clients){return clients.profile.sendPhoneNumberVerification(params);});}function signup(params){return apiClients.then(function(clients){return clients.oAuth.signup(params);});}function signupWithWebAuthn(params,auth){return apiClients.then(function(clients){return clients.webAuthn.signupWithWebAuthn(params,auth);});}function startMfaEmailRegistration(params){return apiClients.then(function(clients){return clients.mfa.startMfaEmailRegistration(params);});}function startMfaPhoneNumberRegistration(params){return apiClients.then(function(clients){return clients.mfa.startMfaPhoneNumberRegistration(params);});}function startPasswordless(params,options){if(options===void 0){options={};}return apiClients.then(function(clients){return clients.oAuth.startPasswordless(params,options);});}function unlink(params){return apiClients.then(function(clients){return clients.profile.unlink(params);});}function updateEmail(params){return apiClients.then(function(clients){return clients.profile.updateEmail(params);});}function updatePassword(params){return apiClients.then(function(clients){return clients.profile.updatePassword(params);});}function updatePhoneNumber(params){return apiClients.then(function(clients){return clients.profile.updatePhoneNumber(params);});}function updateProfile(params){return apiClients.then(function(clients){return clients.profile.updateProfile(params);});}function verifyMfaEmailRegistration(params){return apiClients.then(function(clients){return clients.mfa.verifyMfaEmailRegistration(params);});}function verifyMfaPasswordless(params){return apiClients.then(function(clients){return clients.mfa.verifyMfaPasswordless(params);});}function verifyMfaPhoneNumberRegistration(params){return apiClients.then(function(clients){return clients.mfa.verifyMfaPhoneNumberRegistration(params);});}function verifyPasswordless(params,auth){return apiClients.then(function(clients){return clients.oAuth.verifyPasswordless(params,auth);});}function verifyPhoneNumber(params){return apiClients.then(function(clients){return clients.profile.verifyPhoneNumber(params);});}return {addNewWebAuthnDevice:addNewWebAuthnDevice,checkSession:checkSession,checkUrlFragment:checkUrlFragment,exchangeAuthorizationCodeWithPkce:exchangeAuthorizationCodeWithPkce,getMfaStepUpToken:getMfaStepUpToken,getSessionInfo:getSessionInfo,getSignupData:getSignupData,getUser:getUser,listMfaCredentials:listMfaCredentials,listTrustedDevices:listTrustedDevices,listWebAuthnDevices:listWebAuthnDevices,loginFromSession:loginFromSession,loginWithCredentials:loginWithCredentials,loginWithCustomToken:loginWithCustomToken,loginWithPassword:loginWithPassword,instantiateOneTap:instantiateOneTap,loginWithSocialProvider:loginWithSocialProvider,loginWithWebAuthn:loginWithWebAuthn,logout:logout,off:off,on:on,refreshTokens:refreshTokens,remoteSettings:remoteSettings,removeMfaEmail:removeMfaEmail,removeMfaPhoneNumber:removeMfaPhoneNumber,removeTrustedDevice:removeTrustedDevice,removeWebAuthnDevice:removeWebAuthnDevice,requestPasswordReset:requestPasswordReset,sendEmailVerification:sendEmailVerification,sendPhoneNumberVerification:sendPhoneNumberVerification,signup:signup,signupWithWebAuthn:signupWithWebAuthn,startMfaEmailRegistration:startMfaEmailRegistration,startMfaPhoneNumberRegistration:startMfaPhoneNumberRegistration,startPasswordless:startPasswordless,unlink:unlink,updateEmail:updateEmail,updatePassword:updatePassword,updatePhoneNumber:updatePhoneNumber,updateProfile:updateProfile,verifyMfaEmailRegistration:verifyMfaEmailRegistration,verifyMfaPasswordless:verifyMfaPasswordless,verifyMfaPhoneNumberRegistration:verifyMfaPhoneNumberRegistration,verifyPasswordless:verifyPasswordless,verifyPhoneNumber:verifyPhoneNumber};}
|
|
8037
8037
|
|
|
8038
8038
|
/*
|
|
8039
8039
|
object-assign
|
|
@@ -17529,41 +17529,6 @@
|
|
|
17529
17529
|
}
|
|
17530
17530
|
return PolishedError;
|
|
17531
17531
|
}( /*#__PURE__*/_wrapNativeSuper$1(Error));
|
|
17532
|
-
|
|
17533
|
-
/**
|
|
17534
|
-
* CSS to contain a float (credit to CSSMojo).
|
|
17535
|
-
*
|
|
17536
|
-
* @example
|
|
17537
|
-
* // Styles as object usage
|
|
17538
|
-
* const styles = {
|
|
17539
|
-
* ...clearFix(),
|
|
17540
|
-
* }
|
|
17541
|
-
*
|
|
17542
|
-
* // styled-components usage
|
|
17543
|
-
* const div = styled.div`
|
|
17544
|
-
* ${clearFix()}
|
|
17545
|
-
* `
|
|
17546
|
-
*
|
|
17547
|
-
* // CSS as JS Output
|
|
17548
|
-
*
|
|
17549
|
-
* '&::after': {
|
|
17550
|
-
* 'clear': 'both',
|
|
17551
|
-
* 'content': '""',
|
|
17552
|
-
* 'display': 'table'
|
|
17553
|
-
* }
|
|
17554
|
-
*/
|
|
17555
|
-
function clearFix(parent) {
|
|
17556
|
-
var _ref;
|
|
17557
|
-
if (parent === void 0) {
|
|
17558
|
-
parent = '&';
|
|
17559
|
-
}
|
|
17560
|
-
var pseudoSelector = parent + "::after";
|
|
17561
|
-
return _ref = {}, _ref[pseudoSelector] = {
|
|
17562
|
-
clear: 'both',
|
|
17563
|
-
content: '""',
|
|
17564
|
-
display: 'table'
|
|
17565
|
-
}, _ref;
|
|
17566
|
-
}
|
|
17567
17532
|
function colorToInt(color) {
|
|
17568
17533
|
return Math.round(color * 255);
|
|
17569
17534
|
}
|
|
@@ -30993,75 +30958,88 @@
|
|
|
30993
30958
|
icon: icon$e
|
|
30994
30959
|
};
|
|
30995
30960
|
|
|
30996
|
-
var icon$f = "data:image/svg+xml,%3Csvg%20width%3D%
|
|
30961
|
+
var icon$f = "data:image/svg+xml,%3Csvg%20width%3D%22800px%22%20height%3D%22800px%22%20viewBox%3D%220%200%20128%20128%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20aria-hidden%3D%22true%22%20role%3D%22img%22%20class%3D%22iconify%20iconify--noto%22%20preserveAspectRatio%3D%22xMidYMid%20meet%22%3E%3Cpath%20d%3D%22M72.51%2015.42H34.65c-.15%200-.28.06-.42.08h-6.47c-1.24%200-2.24%201-2.24%202.24v100.97c0%201.24%201%202.24%202.24%202.24h21.9c1.24%200%202.24-1%202.24-2.24V86.63h20.61c19.83%200%2035.96-15.97%2035.96-35.6c.01-19.63-16.13-35.61-35.96-35.61zm-1.72%2050.22c-.35.03-.7.06-1.06.06H52.28c-.05%200-.09-.04-.14-.06a.513.513%200%200%201-.24-.1a.577.577%200%200%201-.21-.43V36.94c0-.18.09-.32.21-.43c.06-.06.14-.07.22-.09c.06-.02.09-.06.15-.06h17.45c.4%200%20.8.03%201.19.06c7.25.63%2012.97%206.94%2012.97%2014.61c.01%207.71-5.77%2014.05-13.09%2014.61z%22%20fill%3D%22%23fff%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E";
|
|
30962
|
+
|
|
30963
|
+
var ping = {
|
|
30964
|
+
key: 'ping',
|
|
30965
|
+
name: 'Ping',
|
|
30966
|
+
color: '#c90917',
|
|
30967
|
+
icon: icon$f,
|
|
30968
|
+
windowSize: {
|
|
30969
|
+
width: 450,
|
|
30970
|
+
height: 400
|
|
30971
|
+
}
|
|
30972
|
+
};
|
|
30973
|
+
|
|
30974
|
+
var icon$g = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M270%20806q-8-19-8-52%200-20%2011-49t24-45q-1-22%207.5-53t22.5-43q0-139%2092.5-288.5t217.5-209.5q139-66%20324-66%20133%200%20266%2055%2049%2021%2090%2048t71%2056%2055%2068%2042%2074%2032.5%2084.5%2025.5%2089.5%2022%2098l1%205q55%2083%2055%20150%200%2014-9%2040t-9%2038q0%201%201.5%203.5t3.5%205%202%203.5q77%20114%20120.5%20214.5t43.5%20208.5q0%2043-19.5%20100t-55.5%2057q-9%200-19.5-7.5t-19-17.5-19-26-16-26.5-13.5-26-9-17.5q-1-1-3-1l-5%204q-59%20154-132%20223%2020%2020%2061.5%2038.5t69%2041.5%2035.5%2065q-2%204-4%2016t-7%2018q-64%2097-302%2097-53%200-110.5-9t-98-20-104.5-30q-15-5-23-7-14-4-46-4.5t-40-1.5q-41%2045-127.5%2065t-168.5%2020q-35%200-69-1.5t-93-9-101-20.5-74.5-40-32.5-64q0-40%2010-59.5t41-48.5q11-2%2040.5-13t49.5-12q4%200%2014-2%202-2%202-4l-2-3q-48-11-108-105.5t-73-156.5l-5-3q-4%200-12%2020-18%2041-54.5%2074.5t-77.5%2037.5h-1q-4%200-6-4.5t-5-5.5q-23-54-23-100%200-275%20252-466z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
30997
30975
|
|
|
30998
30976
|
var qq = {
|
|
30999
30977
|
key: 'qq',
|
|
31000
30978
|
name: 'QQ',
|
|
31001
30979
|
color: '#0071c3',
|
|
31002
|
-
icon: icon$
|
|
30980
|
+
icon: icon$g,
|
|
31003
30981
|
windowSize: {
|
|
31004
30982
|
width: 450,
|
|
31005
30983
|
height: 400
|
|
31006
30984
|
}
|
|
31007
30985
|
};
|
|
31008
30986
|
|
|
31009
|
-
var icon$
|
|
30987
|
+
var icon$h = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1684%20408q-67%2098-162%20167%201%2014%201%2042%200%20130-38%20259.5t-115.5%20248.5-184.5%20210.5-258%20146-323%2054.5q-271%200-496-145%2035%204%2078%204%20225%200%20401-138-105-2-188-64.5t-114-159.5q33%205%2061%205%2043%200%2085-11-112-23-185.5-111.5t-73.5-205.5v-4q68%2038%20146%2041-66-44-105-115t-39-154q0-88%2044-163%20121%20149%20294.5%20238.5t371.5%2099.5q-8-38-8-74%200-134%2094.5-228.5t228.5-94.5q140%200%20236%20102%20109-21%20205-78-37%20115-142%20178%2093-10%20186-50z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
31010
30988
|
|
|
31011
30989
|
var twitter = {
|
|
31012
30990
|
key: 'twitter',
|
|
31013
30991
|
name: 'Twitter',
|
|
31014
30992
|
color: '#55acee',
|
|
31015
|
-
icon: icon$
|
|
30993
|
+
icon: icon$h,
|
|
31016
30994
|
windowSize: {
|
|
31017
30995
|
width: 800,
|
|
31018
30996
|
height: 440
|
|
31019
30997
|
}
|
|
31020
30998
|
};
|
|
31021
30999
|
|
|
31022
|
-
var icon$
|
|
31000
|
+
var icon$i = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1853%20520q23%2064-150%20294-24%2032-65%2085-78%20100-90%20131-17%2041%2014%2081%2017%2021%2081%2082h1l1%201%201%201%202%202q141%20131%20191%20221%203%205%206.5%2012.5t7%2026.5-.5%2034-25%2027.5-59%2012.5l-256%204q-24%205-56-5t-52-22l-20-12q-30-21-70-64t-68.5-77.5-61-58-56.5-15.5q-3%201-8%203.5t-17%2014.5-21.5%2029.5-17%2052-6.5%2077.5q0%2015-3.5%2027.5t-7.5%2018.5l-4%205q-18%2019-53%2022h-115q-71%204-146-16.5t-131.5-53-103-66-70.5-57.5l-25-24q-10-10-27.5-30t-71.5-91-106-151-122.5-211-130.5-272q-6-16-6-27t3-16l4-6q15-19%2057-19l274-2q12%202%2023%206.5t16%208.5l5%203q16%2011%2024%2032%2020%2050%2046%20103.5t41%2081.5l16%2029q29%2060%2056%20104t48.5%2068.5%2041.5%2038.5%2034%2014%2027-5q2-1%205-5t12-22%2013.5-47%209.5-81%200-125q-2-40-9-73t-14-46l-6-12q-25-34-85-43-13-2%205-24%2017-19%2038-30%2053-26%20239-24%2082%201%20135%2013%2020%205%2033.5%2013.5t20.5%2024%2010.5%2032%203.5%2045.5-1%2055-2.5%2070.5-1.5%2082.5q0%2011-1%2042t-.5%2048%203.5%2040.5%2011.5%2039%2022.5%2024.5q8%202%2017%204t26-11%2038-34.5%2052-67%2068-107.5q60-104%20107-225%204-10%2010-17.5t11-10.5l4-3%205-2.5%2013-3%2020-.5%20288-2q39-5%2064%202.5t31%2016.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
31023
31001
|
|
|
31024
31002
|
var vkontakte = {
|
|
31025
31003
|
key: 'vkontakte',
|
|
31026
31004
|
fontKey: 'vk',
|
|
31027
31005
|
name: 'VKontakte',
|
|
31028
31006
|
color: '#45668e',
|
|
31029
|
-
icon: icon$
|
|
31007
|
+
icon: icon$i,
|
|
31030
31008
|
windowSize: {
|
|
31031
31009
|
width: 655,
|
|
31032
31010
|
height: 430
|
|
31033
31011
|
}
|
|
31034
31012
|
};
|
|
31035
31013
|
|
|
31036
|
-
var icon$
|
|
31014
|
+
var icon$j = "data:image/svg+xml,%3Csvg%20width%3D%222048%22%20height%3D%221792%22%20viewBox%3D%220%200%202048%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M580%20461q0-41-25-66t-66-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2066-24.5t25-65.5zm743%20507q0-28-25.5-50t-65.5-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q40%200%2065.5-22t25.5-51zm-236-507q0-41-24.5-66t-65.5-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2065.5-24.5t24.5-65.5zm635%20507q0-28-26-50t-65-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q39%200%2065-22t26-51zm-266-397q-31-4-70-4-169%200-311%2077t-223.5%20208.5-81.5%20287.5q0%2078%2023%20152-35%203-68%203-26%200-50-1.5t-55-6.5-44.5-7-54.5-10.5-50-10.5l-253%20127%2072-218q-290-203-290-490%200-169%2097.5-311t264-223.5%20363.5-81.5q176%200%20332.5%2066t262%20182.5%20136.5%20260.5zm592%20561q0%20117-68.5%20223.5t-185.5%20193.5l55%20181-199-109q-150%2037-218%2037-169%200-311-70.5t-223.5-191.5-81.5-264%2081.5-264%20223.5-191.5%20311-70.5q161%200%20303%2070.5t227.5%20192%2085.5%20263.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
31037
31015
|
|
|
31038
31016
|
var wechat = {
|
|
31039
31017
|
key: 'wechat',
|
|
31040
31018
|
name: 'WeChat',
|
|
31041
31019
|
color: '#44b549',
|
|
31042
|
-
icon: icon$
|
|
31020
|
+
icon: icon$j,
|
|
31043
31021
|
windowSize: {
|
|
31044
31022
|
width: 450,
|
|
31045
31023
|
height: 400
|
|
31046
31024
|
}
|
|
31047
31025
|
};
|
|
31048
31026
|
|
|
31049
|
-
var icon$
|
|
31027
|
+
var icon$k = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M675%201284q21-34%2011-69t-45-50q-34-14-73-1t-60%2046q-22%2034-13%2068.5t43%2050.5%2074.5%202.5%2062.5-47.5zm94-121q8-13%203.5-26.5t-17.5-18.5q-14-5-28.5.5t-21.5%2018.5q-17%2031%2013%2045%2014%205%2029-.5t22-18.5zm174%20107q-45%20102-158%20150t-224%2012q-107-34-147.5-126.5t6.5-187.5q47-93%20151.5-139t210.5-19q111%2029%20158.5%20119.5t2.5%20190.5zm312-160q-9-96-89-170t-208.5-109-274.5-21q-223%2023-369.5%20141.5t-132.5%20264.5q9%2096%2089%20170t208.5%20109%20274.5%2021q223-23%20369.5-141.5t132.5-264.5zm308%204q0%2068-37%20139.5t-109%20137-168.5%20117.5-226%2083-270.5%2031-275-33.5-240.5-93-171.5-151-65-199.5q0-115%2069.5-245t197.5-258q169-169%20341.5-236t246.5%207q65%2064%2020%20209-4%2014-1%2020t10%207%2014.5-.5%2013.5-3.5l6-2q139-59%20246-59t153%2061q45%2063%200%20178-2%2013-4.5%2020t4.5%2012.5%2012%207.5%2017%206q57%2018%20103%2047t80%2081.5%2034%20116.5zm-74-624q42%2047%2054.5%20108.5t-6.5%20117.5q-8%2023-29.5%2034t-44.5%204q-23-8-34-29.5t-4-44.5q20-63-24-111t-107-35q-24%205-45-8t-25-37q-5-24%208-44.5t37-25.5q60-13%20119%205.5t101%2065.5zm181-163q87%2096%20112.5%20222.5t-13.5%20241.5q-9%2027-34%2040t-52%204-40-34-5-52q28-82%2010-172t-80-158q-62-69-148-95.5t-173-8.5q-28%206-52-9.5t-30-43.5%209.5-51.5%2043.5-29.5q123-26%20244%2011.5t208%20134.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
31050
31028
|
|
|
31051
31029
|
var weibo = {
|
|
31052
31030
|
key: 'weibo',
|
|
31053
31031
|
name: 'Weibo',
|
|
31054
31032
|
color: '#e71d34',
|
|
31055
|
-
icon: icon$
|
|
31033
|
+
icon: icon$k
|
|
31056
31034
|
};
|
|
31057
31035
|
|
|
31058
|
-
var icon$
|
|
31036
|
+
var icon$l = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M937%201004l266-499h-112l-157%20312q-24%2048-44%2092l-42-92-155-312h-120l263%20493v324h101v-318zm727-588v960q0%20119-84.5%20203.5t-203.5%2084.5h-960q-119%200-203.5-84.5t-84.5-203.5v-960q0-119%2084.5-203.5t203.5-84.5h960q119%200%20203.5%2084.5t84.5%20203.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
31059
31037
|
|
|
31060
31038
|
var yandex = {
|
|
31061
31039
|
key: 'yandex',
|
|
31062
31040
|
name: 'Yandex',
|
|
31063
31041
|
color: '#d43b2f',
|
|
31064
|
-
icon: icon$
|
|
31042
|
+
icon: icon$l,
|
|
31065
31043
|
windowSize: {
|
|
31066
31044
|
width: 655,
|
|
31067
31045
|
height: 700
|
|
@@ -31085,6 +31063,7 @@
|
|
|
31085
31063
|
oney: oney,
|
|
31086
31064
|
orange: orange,
|
|
31087
31065
|
paypal: paypal,
|
|
31066
|
+
ping: ping,
|
|
31088
31067
|
qq: qq,
|
|
31089
31068
|
twitter: twitter,
|
|
31090
31069
|
vkontakte: vkontakte,
|
|
@@ -38402,7 +38381,7 @@
|
|
|
38402
38381
|
module.exports = exports["default"];
|
|
38403
38382
|
module.exports["default"] = exports["default"];
|
|
38404
38383
|
});
|
|
38405
|
-
var
|
|
38384
|
+
var validator = /*@__PURE__*/unwrapExports(validator_1);
|
|
38406
38385
|
|
|
38407
38386
|
// This file is a workaround for a bug in web browsers' "native"
|
|
38408
38387
|
// ES6 importing system which is uncapable of importing "*.json" files.
|
|
@@ -45024,12 +45003,6 @@
|
|
|
45024
45003
|
var unwrap = isObject$2(v) ? v[rawProperty] : v;
|
|
45025
45004
|
return unwrap !== null && unwrap !== undefined && unwrap !== '' && !Number.isNaN(unwrap) && (Array.isArray(unwrap) ? unwrap.length > 0 : true);
|
|
45026
45005
|
}
|
|
45027
|
-
function formatISO8601Date(year, month, day) {
|
|
45028
|
-
if (isValued(year) && isValued(month) && isValued(day)) {
|
|
45029
|
-
return "".concat(year, "-").concat(month.toString().padStart(2, '0'), "-").concat(day.toString().padStart(2, '0'));
|
|
45030
|
-
}
|
|
45031
|
-
return null;
|
|
45032
|
-
}
|
|
45033
45006
|
function specializeIdentifierData(data) {
|
|
45034
45007
|
return data.identifier ? _objectSpread2(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
45035
45008
|
identifier: undefined
|
|
@@ -45122,15 +45095,15 @@
|
|
|
45122
45095
|
hint: 'checked'
|
|
45123
45096
|
});
|
|
45124
45097
|
var email = new Validator({
|
|
45125
|
-
rule:
|
|
45098
|
+
rule: validator.isEmail,
|
|
45126
45099
|
hint: 'email'
|
|
45127
45100
|
});
|
|
45128
45101
|
var integer = new Validator({
|
|
45129
|
-
rule:
|
|
45102
|
+
rule: validator.isInt,
|
|
45130
45103
|
hint: 'integer'
|
|
45131
45104
|
});
|
|
45132
45105
|
var _float = new Validator({
|
|
45133
|
-
rule:
|
|
45106
|
+
rule: validator.isFloat,
|
|
45134
45107
|
hint: 'float'
|
|
45135
45108
|
});
|
|
45136
45109
|
|
|
@@ -46412,6 +46385,7 @@
|
|
|
46412
46385
|
var _this$props$value = this.props.value,
|
|
46413
46386
|
userInput = _this$props$value.userInput,
|
|
46414
46387
|
country = _this$props$value.country;
|
|
46388
|
+
if (!userInput) return;
|
|
46415
46389
|
try {
|
|
46416
46390
|
var parsed = parse$1(userInput, country);
|
|
46417
46391
|
var phoneValue = country === parsed.country ? format(parsed, 'National') : userInput;
|
|
@@ -47629,50 +47603,6 @@
|
|
|
47629
47603
|
}));
|
|
47630
47604
|
}
|
|
47631
47605
|
|
|
47632
|
-
var formatDate = function formatDate(formValue) {
|
|
47633
|
-
if (formValue && formValue.length) {
|
|
47634
|
-
var _formValue$split = formValue.split('/'),
|
|
47635
|
-
_formValue$split2 = _slicedToArray(_formValue$split, 3),
|
|
47636
|
-
month = _formValue$split2[0],
|
|
47637
|
-
day = _formValue$split2[1],
|
|
47638
|
-
year = _formValue$split2[2];
|
|
47639
|
-
if (year && year.length && month && month.length && day && day.length) {
|
|
47640
|
-
return formatISO8601Date(year, month, day);
|
|
47641
|
-
}
|
|
47642
|
-
}
|
|
47643
|
-
return null;
|
|
47644
|
-
};
|
|
47645
|
-
function dateField(config) {
|
|
47646
|
-
return simpleField(_objectSpread2(_objectSpread2({
|
|
47647
|
-
placeholder: 'mm/dd/yyyy'
|
|
47648
|
-
}, config), {}, {
|
|
47649
|
-
type: 'text',
|
|
47650
|
-
format: {
|
|
47651
|
-
bind: function bind(modelValue) {
|
|
47652
|
-
if (modelValue && modelValue.length) {
|
|
47653
|
-
var _modelValue$split = modelValue.split('-'),
|
|
47654
|
-
_modelValue$split2 = _slicedToArray(_modelValue$split, 3),
|
|
47655
|
-
_modelValue$split2$ = _modelValue$split2[0],
|
|
47656
|
-
year = _modelValue$split2$ === void 0 ? '' : _modelValue$split2$,
|
|
47657
|
-
_modelValue$split2$2 = _modelValue$split2[1],
|
|
47658
|
-
month = _modelValue$split2$2 === void 0 ? '' : _modelValue$split2$2,
|
|
47659
|
-
_modelValue$split2$3 = _modelValue$split2[2],
|
|
47660
|
-
day = _modelValue$split2$3 === void 0 ? '' : _modelValue$split2$3;
|
|
47661
|
-
return "".concat(month, "/").concat(day, "/").concat(year);
|
|
47662
|
-
}
|
|
47663
|
-
},
|
|
47664
|
-
unbind: formatDate
|
|
47665
|
-
},
|
|
47666
|
-
validator: new Validator({
|
|
47667
|
-
rule: function rule(value) {
|
|
47668
|
-
var date = formatDate(value);
|
|
47669
|
-
return !date || isISO8601(date);
|
|
47670
|
-
},
|
|
47671
|
-
hint: 'date'
|
|
47672
|
-
})
|
|
47673
|
-
}));
|
|
47674
|
-
}
|
|
47675
|
-
|
|
47676
47606
|
// these aren't really private, but nor are they really useful to document
|
|
47677
47607
|
/**
|
|
47678
47608
|
* @private
|
|
@@ -55826,231 +55756,248 @@
|
|
|
55826
55756
|
}
|
|
55827
55757
|
}
|
|
55828
55758
|
|
|
55829
|
-
var
|
|
55830
|
-
|
|
55831
|
-
|
|
55832
|
-
|
|
55833
|
-
|
|
55834
|
-
|
|
55835
|
-
|
|
55836
|
-
|
|
55759
|
+
var useDebounce = function useDebounce(value, milliSeconds) {
|
|
55760
|
+
var _useState = react.useState(value),
|
|
55761
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55762
|
+
debouncedValue = _useState2[0],
|
|
55763
|
+
setDebouncedValue = _useState2[1];
|
|
55764
|
+
react.useEffect(function () {
|
|
55765
|
+
var handler = setTimeout(function () {
|
|
55766
|
+
setDebouncedValue(value);
|
|
55767
|
+
}, milliSeconds);
|
|
55768
|
+
return function () {
|
|
55769
|
+
clearTimeout(handler);
|
|
55837
55770
|
};
|
|
55838
|
-
});
|
|
55771
|
+
}, [value, milliSeconds]);
|
|
55772
|
+
return debouncedValue;
|
|
55839
55773
|
};
|
|
55774
|
+
|
|
55775
|
+
var _templateObject$a, _templateObject2$5;
|
|
55840
55776
|
var inputRowGutter = 10;
|
|
55841
|
-
var InputRow = styled.div(_templateObject$a || (_templateObject$a = _taggedTemplateLiteral(["\n
|
|
55842
|
-
var InputCol = styled.div(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n
|
|
55777
|
+
var InputRow = styled.div(_templateObject$a || (_templateObject$a = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n gap: ", "px;\n"])), inputRowGutter);
|
|
55778
|
+
var InputCol = styled.div(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n flex-basis: ", "%;\n"])), function (props) {
|
|
55843
55779
|
return props.width;
|
|
55844
55780
|
});
|
|
55845
|
-
var
|
|
55846
|
-
var
|
|
55847
|
-
|
|
55848
|
-
|
|
55849
|
-
|
|
55850
|
-
|
|
55851
|
-
|
|
55852
|
-
|
|
55853
|
-
|
|
55854
|
-
|
|
55855
|
-
|
|
55856
|
-
|
|
55857
|
-
|
|
55858
|
-
|
|
55859
|
-
|
|
55860
|
-
|
|
55861
|
-
|
|
55862
|
-
|
|
55863
|
-
|
|
55864
|
-
|
|
55865
|
-
|
|
55866
|
-
|
|
55867
|
-
|
|
55868
|
-
|
|
55869
|
-
|
|
55870
|
-
|
|
55871
|
-
|
|
55872
|
-
|
|
55781
|
+
var DateField = function DateField(_ref) {
|
|
55782
|
+
var i18n = _ref.i18n,
|
|
55783
|
+
inputId = _ref.inputId,
|
|
55784
|
+
label = _ref.label,
|
|
55785
|
+
locale = _ref.locale,
|
|
55786
|
+
onChange = _ref.onChange,
|
|
55787
|
+
path = _ref.path,
|
|
55788
|
+
required = _ref.required,
|
|
55789
|
+
showLabel = _ref.showLabel,
|
|
55790
|
+
validation = _ref.validation,
|
|
55791
|
+
value = _ref.value;
|
|
55792
|
+
var _useState = react.useState(isValued(value) ? value.raw.day : undefined),
|
|
55793
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55794
|
+
day = _useState2[0],
|
|
55795
|
+
setDay = _useState2[1];
|
|
55796
|
+
var _useState3 = react.useState(isValued(value) ? value.raw.month : undefined),
|
|
55797
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
55798
|
+
month = _useState4[0],
|
|
55799
|
+
setMonth = _useState4[1];
|
|
55800
|
+
var _useState5 = react.useState(isValued(value) ? value.raw.year : undefined),
|
|
55801
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
55802
|
+
year = _useState6[0],
|
|
55803
|
+
setYear = _useState6[1];
|
|
55804
|
+
|
|
55805
|
+
// debounce year value to delay value update when user is currently editing it
|
|
55806
|
+
var debouncedYear = useDebounce(year, 1000);
|
|
55807
|
+
var setDatePart = function setDatePart(setter, value) {
|
|
55808
|
+
if (Number.isNaN(Number(value))) return; // only accept number value
|
|
55809
|
+
setter(Number(value));
|
|
55810
|
+
};
|
|
55811
|
+
var handleDayChange = function handleDayChange(event) {
|
|
55812
|
+
return setDatePart(setDay, event.target.value);
|
|
55813
|
+
};
|
|
55814
|
+
var handleMonthChange = function handleMonthChange(event) {
|
|
55815
|
+
return setDatePart(setMonth, event.target.value);
|
|
55816
|
+
};
|
|
55817
|
+
var handleYearChange = function handleYearChange(event) {
|
|
55818
|
+
return setDatePart(setYear, event.target.value);
|
|
55819
|
+
};
|
|
55820
|
+
react.useEffect(function () {
|
|
55821
|
+
if (day && month && debouncedYear) {
|
|
55822
|
+
onChange(function () {
|
|
55823
|
+
return {
|
|
55824
|
+
value: {
|
|
55825
|
+
raw: DateTime.fromObject({
|
|
55826
|
+
year: debouncedYear,
|
|
55827
|
+
month: month,
|
|
55828
|
+
day: day
|
|
55829
|
+
})
|
|
55830
|
+
},
|
|
55873
55831
|
isDirty: true
|
|
55874
|
-
}
|
|
55832
|
+
};
|
|
55875
55833
|
});
|
|
55876
|
-
}
|
|
55877
|
-
};
|
|
55878
|
-
|
|
55834
|
+
}
|
|
55835
|
+
}, [debouncedYear, month, day]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
55836
|
+
|
|
55837
|
+
var months = react.useMemo(function () {
|
|
55838
|
+
return Info$1.months("long", {
|
|
55839
|
+
locale: locale
|
|
55840
|
+
});
|
|
55841
|
+
}, [locale]);
|
|
55842
|
+
var daysInMonth = react.useMemo(function () {
|
|
55843
|
+
return Array.from({
|
|
55844
|
+
length: DateTime.fromObject({
|
|
55845
|
+
year: debouncedYear,
|
|
55846
|
+
month: month
|
|
55847
|
+
}).daysInMonth
|
|
55848
|
+
}, function (_value, index) {
|
|
55849
|
+
return index + 1;
|
|
55850
|
+
});
|
|
55851
|
+
}, [debouncedYear, month]);
|
|
55852
|
+
|
|
55853
|
+
// reset day if current value is out of range
|
|
55854
|
+
if (day && !daysInMonth.includes(day)) {
|
|
55855
|
+
setDay(undefined);
|
|
55856
|
+
}
|
|
55857
|
+
var parts = react.useMemo(function () {
|
|
55858
|
+
return DateTime.now().setLocale(locale).toLocaleParts().map(function (part) {
|
|
55859
|
+
return part.type;
|
|
55860
|
+
}).filter(function (type) {
|
|
55861
|
+
return type !== 'literal';
|
|
55862
|
+
});
|
|
55863
|
+
}, [locale]);
|
|
55864
|
+
var error = _typeof(validation) === 'object' && 'error' in validation ? validation.error : null;
|
|
55865
|
+
var fields = {
|
|
55866
|
+
day: /*#__PURE__*/react.createElement(InputCol, {
|
|
55867
|
+
key: "day",
|
|
55868
|
+
width: 20
|
|
55869
|
+
}, /*#__PURE__*/react.createElement(Select, {
|
|
55870
|
+
name: "".concat(path, ".day"),
|
|
55871
|
+
value: day || '',
|
|
55872
|
+
hasError: error,
|
|
55873
|
+
required: required,
|
|
55874
|
+
onChange: handleDayChange,
|
|
55875
|
+
placeholder: i18n('day'),
|
|
55876
|
+
options: daysInMonth.map(function (day) {
|
|
55877
|
+
return {
|
|
55878
|
+
value: day,
|
|
55879
|
+
label: day
|
|
55880
|
+
};
|
|
55881
|
+
}),
|
|
55882
|
+
"data-testid": "".concat(path, ".day"),
|
|
55883
|
+
"aria-label": i18n('day')
|
|
55884
|
+
})),
|
|
55885
|
+
month: /*#__PURE__*/react.createElement(InputCol, {
|
|
55886
|
+
key: "month",
|
|
55887
|
+
width: 50
|
|
55888
|
+
}, /*#__PURE__*/react.createElement(Select, {
|
|
55889
|
+
name: "".concat(path, ".month"),
|
|
55890
|
+
value: month || '',
|
|
55891
|
+
hasError: error,
|
|
55892
|
+
required: required,
|
|
55893
|
+
onChange: handleMonthChange,
|
|
55894
|
+
placeholder: i18n('month'),
|
|
55895
|
+
options: months.map(function (month, index) {
|
|
55896
|
+
return {
|
|
55897
|
+
value: index + 1,
|
|
55898
|
+
label: month
|
|
55899
|
+
};
|
|
55900
|
+
}),
|
|
55901
|
+
"data-testid": "".concat(path, ".month"),
|
|
55902
|
+
"aria-label": i18n('month')
|
|
55903
|
+
})),
|
|
55904
|
+
year: /*#__PURE__*/react.createElement(InputCol, {
|
|
55905
|
+
key: "year",
|
|
55906
|
+
width: 30
|
|
55907
|
+
}, /*#__PURE__*/react.createElement(Input, {
|
|
55908
|
+
type: "number",
|
|
55909
|
+
maxlength: "4",
|
|
55910
|
+
inputmode: "numeric",
|
|
55911
|
+
name: "".concat(path, ".year"),
|
|
55912
|
+
value: year || '',
|
|
55913
|
+
hasError: error,
|
|
55914
|
+
required: required,
|
|
55915
|
+
onChange: handleYearChange,
|
|
55916
|
+
placeholder: i18n('year'),
|
|
55917
|
+
"data-testid": "".concat(path, ".year"),
|
|
55918
|
+
"aria-label": i18n('year')
|
|
55919
|
+
}))
|
|
55920
|
+
};
|
|
55921
|
+
return /*#__PURE__*/react.createElement(FormGroup, {
|
|
55879
55922
|
inputId: inputId,
|
|
55880
|
-
labelText: label
|
|
55881
|
-
|
|
55923
|
+
labelText: label,
|
|
55924
|
+
error: error,
|
|
55882
55925
|
showLabel: showLabel
|
|
55883
|
-
}
|
|
55884
|
-
|
|
55885
|
-
}
|
|
55886
|
-
type: "text",
|
|
55887
|
-
id: inputId,
|
|
55888
|
-
name: "".concat(BIRTHDAY_PATH, ".day"),
|
|
55889
|
-
maxlength: "2",
|
|
55890
|
-
inputmode: "numeric",
|
|
55891
|
-
value: day.value,
|
|
55892
|
-
hasError: !!validation.day,
|
|
55893
|
-
required: required,
|
|
55894
|
-
placeholder: i18n('day'),
|
|
55895
|
-
onChange: handleFieldChange('day'),
|
|
55896
|
-
onBlur: handleFieldBlur('day'),
|
|
55897
|
-
"data-testid": "".concat(BIRTHDAY_PATH, ".day")
|
|
55898
|
-
})), /*#__PURE__*/react.createElement(InputCol, {
|
|
55899
|
-
width: 50
|
|
55900
|
-
}, /*#__PURE__*/react.createElement(Select, {
|
|
55901
|
-
name: "".concat(BIRTHDAY_PATH, ".month"),
|
|
55902
|
-
value: month.value || '',
|
|
55903
|
-
hasError: !!validation.month,
|
|
55904
|
-
required: required,
|
|
55905
|
-
onChange: handleFieldChange('month'),
|
|
55906
|
-
onBlur: handleFieldBlur('month'),
|
|
55907
|
-
placeholder: i18n('month'),
|
|
55908
|
-
options: months,
|
|
55909
|
-
"data-testid": "".concat(BIRTHDAY_PATH, ".month")
|
|
55910
|
-
})), /*#__PURE__*/react.createElement(InputCol, {
|
|
55911
|
-
width: 30
|
|
55912
|
-
}, /*#__PURE__*/react.createElement(Input, {
|
|
55913
|
-
type: "text",
|
|
55914
|
-
name: "".concat(BIRTHDAY_PATH, ".year"),
|
|
55915
|
-
maxlength: "4",
|
|
55916
|
-
inputmode: "numeric",
|
|
55917
|
-
value: year.value,
|
|
55918
|
-
hasError: !!validation.year,
|
|
55919
|
-
required: required,
|
|
55920
|
-
placeholder: i18n('year'),
|
|
55921
|
-
onChange: handleFieldChange('year'),
|
|
55922
|
-
onBlur: handleFieldBlur('year'),
|
|
55923
|
-
"data-testid": "".concat(BIRTHDAY_PATH, ".year")
|
|
55924
|
-
}))));
|
|
55925
|
-
};
|
|
55926
|
-
var validateLimitAge = function validateLimitAge(day, month, year) {
|
|
55927
|
-
var yearNbr = parseInt(year, 10);
|
|
55928
|
-
var dayNbr = parseInt(day, 10);
|
|
55929
|
-
var monthNbr = parseInt(month, 10);
|
|
55930
|
-
var age = DateTime.now().diff(DateTime.local(yearNbr, monthNbr, dayNbr), "years").years;
|
|
55931
|
-
if (age < 6 || age > 129) {
|
|
55932
|
-
return 'birthdate.yearLimit';
|
|
55933
|
-
}
|
|
55934
|
-
return false;
|
|
55926
|
+
}, /*#__PURE__*/react.createElement(InputRow, null, parts.map(function (part) {
|
|
55927
|
+
return fields[part];
|
|
55928
|
+
})));
|
|
55935
55929
|
};
|
|
55936
|
-
var
|
|
55937
|
-
|
|
55938
|
-
|
|
55939
|
-
|
|
55940
|
-
|
|
55941
|
-
|
|
55942
|
-
|
|
55943
|
-
|
|
55944
|
-
|
|
55945
|
-
|
|
55946
|
-
|
|
55947
|
-
return {
|
|
55948
|
-
path: BIRTHDAY_PATH,
|
|
55949
|
-
create: function create(_ref5) {
|
|
55950
|
-
var i18n = _ref5.i18n,
|
|
55951
|
-
showLabel = _ref5.showLabel;
|
|
55952
|
-
var staticProps = {
|
|
55953
|
-
inputId: generateId$1(),
|
|
55954
|
-
label: label || i18n(BIRTHDAY_PATH),
|
|
55955
|
-
months: months$1(i18n),
|
|
55956
|
-
required: required,
|
|
55957
|
-
i18n: i18n,
|
|
55958
|
-
showLabel: showLabel
|
|
55959
|
-
};
|
|
55960
|
-
return {
|
|
55961
|
-
key: BIRTHDAY_PATH,
|
|
55962
|
-
modelPath: BIRTHDAY_PATH,
|
|
55963
|
-
render: function render(_ref6) {
|
|
55964
|
-
var state = _ref6.state,
|
|
55965
|
-
props = _objectWithoutProperties(_ref6, _excluded$7);
|
|
55966
|
-
return /*#__PURE__*/react.createElement(BirthdateField, _extends({
|
|
55967
|
-
key: BIRTHDAY_PATH
|
|
55968
|
-
}, state, props, staticProps));
|
|
55969
|
-
},
|
|
55970
|
-
initialize: function initialize(model) {
|
|
55971
|
-
var modelValue = model.birthdate || defaultValue;
|
|
55972
|
-
var _ref7 = modelValue ? modelValue.split('-') : [],
|
|
55973
|
-
_ref8 = _slicedToArray(_ref7, 3),
|
|
55974
|
-
_ref8$ = _ref8[0],
|
|
55975
|
-
year = _ref8$ === void 0 ? '' : _ref8$,
|
|
55976
|
-
_ref8$2 = _ref8[1],
|
|
55977
|
-
month = _ref8$2 === void 0 ? '' : _ref8$2,
|
|
55978
|
-
_ref8$3 = _ref8[2],
|
|
55979
|
-
day = _ref8$3 === void 0 ? '' : _ref8$3;
|
|
55980
|
-
return {
|
|
55981
|
-
day: {
|
|
55982
|
-
value: day,
|
|
55983
|
-
isDirty: false
|
|
55984
|
-
},
|
|
55985
|
-
month: {
|
|
55986
|
-
value: parseInt(month),
|
|
55987
|
-
isDirty: false
|
|
55988
|
-
},
|
|
55989
|
-
year: {
|
|
55990
|
-
value: year,
|
|
55991
|
-
isDirty: false
|
|
55992
|
-
}
|
|
55993
|
-
};
|
|
55994
|
-
},
|
|
55995
|
-
unbind: function unbind(model, state) {
|
|
55996
|
-
return _objectSpread2(_objectSpread2({}, model), {}, {
|
|
55997
|
-
birthdate: format$1(state)
|
|
55998
|
-
});
|
|
55999
|
-
},
|
|
56000
|
-
validate: function validate(state, _ref9) {
|
|
56001
|
-
var isSubmitted = _ref9.isSubmitted;
|
|
56002
|
-
var required = staticProps.required;
|
|
56003
|
-
var day = state.day,
|
|
56004
|
-
month = state.month,
|
|
56005
|
-
year = state.year;
|
|
56006
|
-
var missingFields = ['day', 'month', 'year'].filter(function (field) {
|
|
56007
|
-
return (isSubmitted || state[field].isDirty) && !isValued(state[field].value);
|
|
56008
|
-
});
|
|
56009
|
-
if (missingFields.length) {
|
|
56010
|
-
return required || missingFields.length < 3 ? _objectSpread2({
|
|
56011
|
-
error: i18n('validation.required')
|
|
56012
|
-
}, missingFields.reduce(function (acc, field) {
|
|
56013
|
-
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, field, true));
|
|
56014
|
-
}, {})) : {};
|
|
56015
|
-
}
|
|
56016
|
-
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
56017
|
-
if (!isISO8601.isNumeric(year.value.toString()) || !DateTime.fromObject({
|
|
56018
|
-
year: parseInt(year.value, 10)
|
|
56019
|
-
}).isValid) {
|
|
56020
|
-
return {
|
|
56021
|
-
error: i18n("validation.birthdate.year"),
|
|
56022
|
-
year: true
|
|
56023
|
-
};
|
|
56024
|
-
}
|
|
56025
|
-
var birthdate = format$1(state);
|
|
56026
|
-
if (!birthdate || !isISO8601.isISO8601(birthdate)) {
|
|
56027
|
-
return {
|
|
56028
|
-
error: i18n('validation.birthdate.dayOfMonth'),
|
|
56029
|
-
day: true
|
|
56030
|
-
};
|
|
56031
|
-
}
|
|
56032
|
-
if (!(isISO8601.isNumeric(month.value.toString()) && isISO8601.isNumeric(day.value.toString())) || !DateTime.fromObject({
|
|
56033
|
-
year: year.value,
|
|
56034
|
-
month: month.value,
|
|
56035
|
-
day: day.value
|
|
56036
|
-
}).isValid) {
|
|
56037
|
-
return {
|
|
56038
|
-
error: i18n("validation.birthdate.dayOfMonth"),
|
|
56039
|
-
day: true
|
|
56040
|
-
};
|
|
56041
|
-
}
|
|
56042
|
-
var limitAge = validateLimitAge(day.value, month.value, year.value);
|
|
56043
|
-
if (limitAge) {
|
|
56044
|
-
return {
|
|
56045
|
-
error: i18n("validation.".concat(limitAge))
|
|
56046
|
-
};
|
|
56047
|
-
}
|
|
56048
|
-
}
|
|
56049
|
-
return {};
|
|
56050
|
-
}
|
|
56051
|
-
};
|
|
55930
|
+
var dateFormat = function dateFormat(locale) {
|
|
55931
|
+
return DateTime.now().setLocale(locale).toLocaleParts().map(function (part) {
|
|
55932
|
+
switch (part.type) {
|
|
55933
|
+
case 'day':
|
|
55934
|
+
return 'dd';
|
|
55935
|
+
case 'month':
|
|
55936
|
+
return 'mm';
|
|
55937
|
+
case 'year':
|
|
55938
|
+
return 'yyyy';
|
|
55939
|
+
case 'literal':
|
|
55940
|
+
return part.value;
|
|
56052
55941
|
}
|
|
56053
|
-
};
|
|
55942
|
+
}).join('');
|
|
55943
|
+
};
|
|
55944
|
+
var datetimeValidator = function datetimeValidator(locale) {
|
|
55945
|
+
return new Validator({
|
|
55946
|
+
rule: function rule(value) {
|
|
55947
|
+
return isValued(value) && value.raw.isValid;
|
|
55948
|
+
},
|
|
55949
|
+
hint: 'date',
|
|
55950
|
+
parameters: {
|
|
55951
|
+
format: dateFormat(locale)
|
|
55952
|
+
}
|
|
55953
|
+
});
|
|
55954
|
+
};
|
|
55955
|
+
function dateField(props, config) {
|
|
55956
|
+
return createField(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
55957
|
+
format: {
|
|
55958
|
+
bind: function bind(value) {
|
|
55959
|
+
var dt = value ? DateTime.fromISO(value) : DateTime.invalid('empty value');
|
|
55960
|
+
return dt.isValid ? {
|
|
55961
|
+
raw: dt
|
|
55962
|
+
} : undefined;
|
|
55963
|
+
},
|
|
55964
|
+
unbind: function unbind(value) {
|
|
55965
|
+
return value.raw.toISODate();
|
|
55966
|
+
}
|
|
55967
|
+
},
|
|
55968
|
+
validator: props.validator ? datetimeValidator(config.language).and(props.validator) : datetimeValidator(config.language),
|
|
55969
|
+
component: DateField,
|
|
55970
|
+
extendedParams: {
|
|
55971
|
+
locale: config.language
|
|
55972
|
+
}
|
|
55973
|
+
}));
|
|
55974
|
+
}
|
|
55975
|
+
|
|
55976
|
+
var _excluded$7 = ["min", "max", "label"];
|
|
55977
|
+
var ageLimitValidator = function ageLimitValidator() {
|
|
55978
|
+
var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
|
|
55979
|
+
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 129;
|
|
55980
|
+
return new Validator({
|
|
55981
|
+
rule: function rule(value) {
|
|
55982
|
+
var age = DateTime.now().diff(value.raw, 'years').years;
|
|
55983
|
+
return min < age && age < max;
|
|
55984
|
+
},
|
|
55985
|
+
hint: 'birthdate.yearLimit',
|
|
55986
|
+
parameters: {
|
|
55987
|
+
min: min,
|
|
55988
|
+
max: max
|
|
55989
|
+
}
|
|
55990
|
+
});
|
|
55991
|
+
};
|
|
55992
|
+
function birthdateField(_ref, config) {
|
|
55993
|
+
var min = _ref.min,
|
|
55994
|
+
max = _ref.max,
|
|
55995
|
+
label = _ref.label,
|
|
55996
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
55997
|
+
return dateField(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
55998
|
+
label: label || 'birthdate',
|
|
55999
|
+
validator: ageLimitValidator(min, max)
|
|
56000
|
+
}), config);
|
|
56054
56001
|
}
|
|
56055
56002
|
|
|
56056
56003
|
var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
@@ -58342,7 +58289,7 @@
|
|
|
58342
58289
|
}, cfg));
|
|
58343
58290
|
}
|
|
58344
58291
|
};
|
|
58345
|
-
function customFieldComponent(customField, cfg) {
|
|
58292
|
+
function customFieldComponent(customField, cfg, config) {
|
|
58346
58293
|
var baseConfig = _objectSpread2(_objectSpread2({
|
|
58347
58294
|
label: customField.name
|
|
58348
58295
|
}, cfg), {}, {
|
|
@@ -58354,7 +58301,7 @@
|
|
|
58354
58301
|
}) : _objectSpread2({}, baseConfig);
|
|
58355
58302
|
return checkboxField(checkboxConfig);
|
|
58356
58303
|
} else if (customField.dataType === 'date') {
|
|
58357
|
-
return dateField(baseConfig);
|
|
58304
|
+
return dateField(baseConfig, config);
|
|
58358
58305
|
} else if (customField.dataType === 'integer') {
|
|
58359
58306
|
return simpleField(_objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
58360
58307
|
type: 'number',
|
|
@@ -58449,7 +58396,7 @@
|
|
|
58449
58396
|
}
|
|
58450
58397
|
var customField = findCustomField(config, camelPath);
|
|
58451
58398
|
if (customField) {
|
|
58452
|
-
return customFieldComponent(customField, fieldConfig);
|
|
58399
|
+
return customFieldComponent(customField, fieldConfig, config);
|
|
58453
58400
|
}
|
|
58454
58401
|
var camelPathSplit = camelPath.split('.v'); // TODO What if consent start with a `v`?
|
|
58455
58402
|
var consentField = findConsentField(config, camelPathSplit[0]);
|
|
@@ -58984,12 +58931,10 @@
|
|
|
58984
58931
|
var _this5$props = _this5.props,
|
|
58985
58932
|
apiClient = _this5$props.apiClient,
|
|
58986
58933
|
auth = _this5$props.auth,
|
|
58987
|
-
challengeId = _this5$props.challengeId
|
|
58988
|
-
accessToken = _this5$props.accessToken;
|
|
58934
|
+
challengeId = _this5$props.challengeId;
|
|
58989
58935
|
return apiClient.verifyMfaPasswordless({
|
|
58990
58936
|
challengeId: challengeId,
|
|
58991
|
-
verificationCode: data.verificationCode
|
|
58992
|
-
accessToken: accessToken
|
|
58937
|
+
verificationCode: data.verificationCode
|
|
58993
58938
|
}).then(function (resp) {
|
|
58994
58939
|
return window.location.replace(auth.redirectUri + "?" + toQueryString$1(resp));
|
|
58995
58940
|
});
|
|
@@ -60213,7 +60158,7 @@
|
|
|
60213
60158
|
var CardContent = withTheme(styled.div(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteral(["\n margin-left: ", "px;\n white-space: initial;\n"])), function (props) {
|
|
60214
60159
|
return props.theme.get('_blockInnerHeight');
|
|
60215
60160
|
}));
|
|
60216
|
-
var dateFormat = function dateFormat(dateString, locales) {
|
|
60161
|
+
var dateFormat$1 = function dateFormat(dateString, locales) {
|
|
60217
60162
|
return new Date(dateString).toLocaleDateString(locales, {
|
|
60218
60163
|
timeZone: 'UTC'
|
|
60219
60164
|
});
|
|
@@ -60236,7 +60181,7 @@
|
|
|
60236
60181
|
}
|
|
60237
60182
|
}, friendlyName), /*#__PURE__*/react.createElement("div", null, email || phoneNumber), /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement("span", null, i18n('mfaList.createdAt'), "\xA0: "), /*#__PURE__*/react.createElement("time", {
|
|
60238
60183
|
dateTime: createdAt
|
|
60239
|
-
}, dateFormat(createdAt, config.language)))));
|
|
60184
|
+
}, dateFormat$1(createdAt, config.language)))));
|
|
60240
60185
|
}));
|
|
60241
60186
|
});
|
|
60242
60187
|
var mfaListWidget = createWidget({
|