UNPKG

@azure/msal-browser

Version:
61 lines (58 loc) • 3.44 kB
/*! @azure/msal-browser v5.30.0 2026-11-18 */ 'use strict'; import { CustomAuthResultV2 } from '../../../../core/auth_flow/v2/CustomAuthResultV2.mjs'; import { AuthMethodRegistrationRequiredStateV2 } from '../../../../core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs'; import { CustomAuthError } from '../../../../core/error/CustomAuthError.mjs'; import { FLOW_SIGN_UP_PASSWORD_REQUIRED_V2, FLOW_ATTRIBUTES_REQUIRED_V2, FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2, FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2 } from '../../../../core/interaction_client/v2/result/FlowActionResultV2.mjs'; import { UNSUPPORTED_FLOW_TRANSITION } from '../../../../core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs'; import { SignInContinuationStateV2 } from '../../../../sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs'; import { AttributesRequiredStateV2 } from './AttributesRequiredStateV2.mjs'; import { PasswordRequiredStateV2 } from '../../../../core/auth_flow/v2/state/PasswordRequiredStateV2.mjs'; /* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ class SignUpStateTransitionHandlerV2 { /** * Maps new-account verification and attribute-submission outcomes to public states. */ handleAttributeSubmission(result, stateParameters, submission) { const resultType = result.type; const commonStateParameters = this.createCommonStateParameters(result, stateParameters); if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) { return new CustomAuthResultV2(new PasswordRequiredStateV2({ ...commonStateParameters, requestedPasswordAttribute: result.requestedPasswordAttribute, }), undefined, result.continuationState.scenario); } if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) { return new CustomAuthResultV2(new AttributesRequiredStateV2({ ...commonStateParameters, attributes: result.attributes, }), undefined, result.continuationState.scenario); } if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) { return new CustomAuthResultV2(new SignInContinuationStateV2(commonStateParameters), undefined, result.continuationState.scenario); } if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) { return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({ ...commonStateParameters, methods: result.methods, }), undefined, result.continuationState.scenario); } throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${resultType}' is not supported.`, stateParameters.correlationId); } createCommonStateParameters(result, stateParameters) { return { correlationId: result.correlationId, logger: stateParameters.logger, config: stateParameters.config, flowClient: stateParameters.flowClient, continuationState: result.continuationState, cacheClient: stateParameters.cacheClient, signUpStateTransitionHandler: stateParameters.signUpStateTransitionHandler, }; } } export { SignUpStateTransitionHandlerV2 }; //# sourceMappingURL=SignUpStateTransitionHandlerV2.mjs.map