UNPKG

@azure/msal-browser

Version:
61 lines (58 loc) • 3.34 kB
/*! @azure/msal-browser v5.25.0 2026-10-06 */ 'use strict'; import { CustomAuthResultV2 } from '../../../../core/auth_flow/v2/CustomAuthResultV2.mjs'; import { CodeRequiredStateV2 } from '../../../../core/auth_flow/v2/state/CodeRequiredStateV2.mjs'; import { CustomAuthError } from '../../../../core/error/CustomAuthError.mjs'; import { FLOW_CODE_REQUIRED_V2, FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2, FLOW_ATTRIBUTES_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 { SignUpPasswordRequiredStateV2 } from './SignUpPasswordRequiredStateV2.mjs'; /* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ class SignUpStateTransitionHandlerV2 { handleAttributeSubmission(result, stateParameters, submission) { const commonStateParameters = this.createCommonStateParameters(result, stateParameters); if (result.type === FLOW_CODE_REQUIRED_V2) { return new CustomAuthResultV2(new CodeRequiredStateV2({ ...commonStateParameters, sentTo: result.sentTo, channel: result.channel, codeLength: result.codeLength, }), undefined, result.continuationState.scenario); } if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) { return new CustomAuthResultV2(new SignInContinuationStateV2(commonStateParameters), undefined, result.continuationState.scenario); } throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${result.type}' is not supported.`, stateParameters.correlationId); } handleVerification(result, stateParameters) { const commonStateParameters = this.createCommonStateParameters(result, stateParameters); if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) { return new CustomAuthResultV2(new AttributesRequiredStateV2({ ...commonStateParameters, attributes: result.attributes, }), undefined, result.continuationState.scenario); } return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({ ...commonStateParameters, attributes: result.attributes, requiredPasswordAttribute: result.requiredPasswordAttribute, }), undefined, result.continuationState.scenario); } 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