class HeadlessB2BRecoveryCodesClient {
    _networkClient;
    _subscriptionService;
    dfpProtectedAuth;
    recover;
    constructor(_networkClient, _subscriptionService, dfpProtectedAuth){
        this._networkClient = _networkClient;
        this._subscriptionService = _subscriptionService;
        this.dfpProtectedAuth = dfpProtectedAuth;
        this.recover = this._subscriptionService.withUpdateSession(async (data)=>{
            const { dfp_telemetry_id, captcha_token } = await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
            const requestBody = {
                ...data,
                dfp_telemetry_id,
                captcha_token,
                intermediate_session_token: this._subscriptionService.getIntermediateSessionToken() || undefined
            };
            return this._networkClient.retriableFetchSDK({
                url: '/b2b/recovery_codes/recover',
                body: requestBody,
                method: 'POST',
                retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
            });
        });
    }
    async rotate() {
        const { dfp_telemetry_id, captcha_token } = await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
        return this._networkClient.retriableFetchSDK({
            url: '/b2b/recovery_codes/rotate',
            body: {
                dfp_telemetry_id,
                captcha_token
            },
            method: 'POST',
            retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
        });
    }
    async get() {
        return this._networkClient.fetchSDK({
            url: '/b2b/recovery_codes',
            method: 'GET'
        });
    }
}

export { HeadlessB2BRecoveryCodesClient };
//# sourceMappingURL=HeadlessB2BRecoveryCodesClient.mjs.map
