'use client'
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../../../../../_virtual/_tslib.cjs');
require('@dynamic-labs-sdk/client');
require('@dynamic-labs/utils');
require('@dynamic-labs/sdk-api-core');
require('@dynamic-labs-sdk/client/core');
require('react');
require('eventemitter3');
require('../../../config/ApiEndpoint.cjs');
require('@dynamic-labs/iconic');
require('@dynamic-labs/wallet-connector-core');
require('react/jsx-runtime');
require('../../ViewContext/ViewContext.cjs');
require('../../../shared/logger.cjs');
require('@dynamic-labs/wallet-book');
require('../../../utils/constants/colors.cjs');
require('../../../utils/constants/values.cjs');
require('../../../shared/consts/index.cjs');
require('@dynamic-labs/multi-wallet');
require('react-international-phone');
require('../../../store/state/nonce/nonce.cjs');
require('@dynamic-labs-wallet/browser-wallet-client');
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
require('../../../events/dynamicEvents.cjs');
var sms = require('../../../data/api/sms/sms.cjs');
var buildSmsOtpHandler = require('./buildSmsOtpHandler/buildSmsOtpHandler.cjs');
var otpVerificationStorage = require('./otpVerificationStorage/otpVerificationStorage.cjs');

const createSmsHandler = (environmentId, embeddedWalletSessionKeys) => (phone, captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
    const { verificationUUID } = yield sms.createSmsVerification({
        captchaToken,
        environmentId,
        isoCountryCode: phone.iso2,
        phoneCountryCode: phone.dialCode,
        phoneNumber: phone.phone,
    });
    otpVerificationStorage.persistOtpVerificationState({
        captchaToken,
        destination: phone,
        type: 'sms',
        verificationUUID,
    });
    return buildSmsOtpHandler.buildSmsOtpHandler({
        captchaToken,
        embeddedWalletSessionKeys,
        environmentId,
        phone,
        verificationUUID,
    });
});

exports.createSmsHandler = createSmsHandler;
