-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.js.map
1 lines (1 loc) · 7.75 KB
/
common.js.map
1
{"version":3,"file":"common.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAMgB,MAAM,GAAG,IAAIhB,4DAAJ,CAAW,cAAX,CAAf;;SACeiB;;;;;wVAAf,kBAA4BC,IAA5B,EAAkCC,qBAAlC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBACQ,CAACX,mDAAD,IAAS,OAAOA,mEAAP,KAAgC,UADjD;AAAA;AAAA;AAAA;;AAAA,kBAEc,IAAIa,KAAJ,CAAUR,qDAAV,CAFd;;AAAA;AAAA,gBAMSS,aAAa,CAACJ,IAAD,CANtB;AAAA;AAAA;AAAA;;AAOQC,YAAAA,qBAAqB,CAAChB,+DAAD,EAAqBe,IAArB,CAArB;AAPR;;AAAA;AAAA;AAAA;AAAA,mBAW2BV,mEAAA,CAAqBU,IAArB,CAX3B;;AAAA;AAWcM,YAAAA,IAXd;;AAYQ,gBAAI,CAACvB,0DAAO,CAACuB,IAAI,CAACC,QAAN,CAAR,IAA2BxB,0DAAO,CAACuB,IAAI,CAACE,UAAN,CAAtC,EAAyD;AACrDP,cAAAA,qBAAqB,CAAChB,+DAAD,EAAqBe,IAArB,CAArB;AACH,aAFD,MAGK;AACKS,cAAAA,OADL,GACeC,MAAM,CAACC,MAAP,CAAcX,IAAd,EAAoBM,IAApB,CADf;AAEDL,cAAAA,qBAAqB,CAAChB,oEAAD,EAA0BwB,OAA1B,CAArB;AACH;;AAlBT;AAAA;;AAAA;AAAA;AAAA;AAqBQZ,YAAAA,uDAAqB,cAArB;;AArBR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;AAwBA,IAAMgB,YAAY;AAAA,mVAAG,iBAAOC,QAAP,EAAiBC,QAAjB,EAA2Bd,qBAA3B,EAAkDe,aAAlD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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_modules/@aws-amplify/ui-components/dist/esm/auth-helpers-475f7fa4.js"],"sourcesContent":["import { Logger, isEmpty } from '@aws-amplify/core';\nimport { A as AuthState, C as ChallengeName, U as UsernameAlias } from './auth-types-78df304e.js';\nimport { Auth, CognitoUser } from '@aws-amplify/auth';\nimport { T as Translations } from './Translations-c833f663.js';\nimport { N as NO_AUTH_MODULE_FOUND } from './constants-c8ecaa24.js';\nimport { a as dispatchToastHubEvent } from './helpers-9703fe65.js';\n\nconst logger = new Logger('auth-helpers');\nasync function checkContact(user, handleAuthStateChange) {\n if (!Auth || typeof Auth.verifiedContact !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n // If `user` is a federated user, we shouldn't call `verifiedContact`\n // since `user` isn't `CognitoUser`\n if (!isCognitoUser(user)) {\n handleAuthStateChange(AuthState.SignedIn, user);\n return;\n }\n try {\n const data = await Auth.verifiedContact(user);\n if (!isEmpty(data.verified) || isEmpty(data.unverified)) {\n handleAuthStateChange(AuthState.SignedIn, user);\n }\n else {\n const newUser = Object.assign(user, data);\n handleAuthStateChange(AuthState.VerifyContact, newUser);\n }\n }\n catch (error) {\n dispatchToastHubEvent(error);\n }\n}\nconst handleSignIn = async (username, password, handleAuthStateChange, usernameAlias) => {\n if (!Auth || typeof Auth.signIn !== 'function') {\n throw new Error(NO_AUTH_MODULE_FOUND);\n }\n try {\n const user = await Auth.signIn(username, password);\n logger.debug(user);\n if (user.challengeName === ChallengeName.SMSMFA ||\n user.challengeName === ChallengeName.SoftwareTokenMFA) {\n logger.debug('confirm user with ' + user.challengeName);\n handleAuthStateChange(AuthState.ConfirmSignIn, user);\n }\n else if (user.challengeName === ChallengeName.NewPasswordRequired) {\n logger.debug('require new password', user.challengeParam);\n handleAuthStateChange(AuthState.ResetPassword, user);\n }\n else if (user.challengeName === ChallengeName.MFASetup) {\n logger.debug('TOTP setup', user.challengeParam);\n handleAuthStateChange(AuthState.TOTPSetup, user);\n }\n else if (user.challengeName === ChallengeName.CustomChallenge &&\n user.challengeParam &&\n user.challengeParam.trigger === 'true') {\n logger.debug('custom challenge', user.challengeParam);\n handleAuthStateChange(AuthState.CustomConfirmSignIn, user);\n }\n else {\n await checkContact(user, handleAuthStateChange);\n }\n }\n catch (error) {\n if (error.code === 'UserNotConfirmedException') {\n logger.debug('the user is not confirmed');\n handleAuthStateChange(AuthState.ConfirmSignUp, { username });\n }\n else if (error.code === 'PasswordResetRequiredException') {\n logger.debug('the user requires a new password');\n handleAuthStateChange(AuthState.ForgotPassword, { username });\n }\n else if (error.code === 'InvalidParameterException' && password === '') {\n logger.debug('Password cannot be empty');\n error.message = Translations.EMPTY_PASSWORD;\n }\n else if (error.message === Translations.EMPTY_USERNAME) {\n if (usernameAlias === UsernameAlias.email) {\n error.message = Translations.EMPTY_EMAIL;\n }\n if (usernameAlias === UsernameAlias.phone_number) {\n error.message = Translations.EMPTY_PHONE;\n }\n }\n dispatchToastHubEvent(error);\n }\n};\nconst isCognitoUser = (user) => {\n return user instanceof CognitoUser;\n};\n\nexport { checkContact as c, handleSignIn as h };\n"],"names":["Logger","isEmpty","A","AuthState","C","ChallengeName","U","UsernameAlias","Auth","CognitoUser","T","Translations","N","NO_AUTH_MODULE_FOUND","a","dispatchToastHubEvent","logger","checkContact","user","handleAuthStateChange","verifiedContact","Error","isCognitoUser","SignedIn","data","verified","unverified","newUser","Object","assign","VerifyContact","handleSignIn","username","password","usernameAlias","signIn","debug","challengeName","SMSMFA","SoftwareTokenMFA","ConfirmSignIn","NewPasswordRequired","challengeParam","ResetPassword","MFASetup","TOTPSetup","CustomChallenge","trigger","CustomConfirmSignIn","code","ConfirmSignUp","ForgotPassword","message","EMPTY_PASSWORD","EMPTY_USERNAME","email","EMPTY_EMAIL","phone_number","EMPTY_PHONE","c","h"],"sourceRoot":"webpack:///"}