'use client'
'use strict';

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

var jsxRuntime = require('react/jsx-runtime');
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
require('../../../../utils/constants/values.cjs');
require('@dynamic-labs/utils');
require('../../../../../../_virtual/_tslib.cjs');
require('@dynamic-labs/multi-wallet');
var logger = require('../../../../shared/logger.cjs');
require('react-international-phone');
require('../../../../utils/constants/colors.cjs');
require('@dynamic-labs/iconic');
require('@dynamic-labs/wallet-connector-core');
require('react');
require('../../../../context/ViewContext/ViewContext.cjs');
require('@dynamic-labs/wallet-book');
require('../../../../shared/consts/index.cjs');
var getSocialSignInProviderFromString = require('../../../../utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.cjs');
require('../../../../store/state/nonce/nonce.cjs');
var isProviderEnabled = require('../../../../utils/functions/isProviderEnabled/isProviderEnabled.cjs');
require('@dynamic-labs-wallet/browser-wallet-client');
require('@dynamic-labs-sdk/client/core');
require('eventemitter3');
require('@dynamic-labs-sdk/client');
require('../../../../config/ApiEndpoint.cjs');
require('../../../../events/dynamicEvents.cjs');
var useProjectSettings = require('../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.cjs');
require('@dynamic-labs/locale');
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
require('../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
var MagicSocialSignIn = require('./MagicSocialSignIn/MagicSocialSignIn.cjs');
var DynamicSocialSignIn = require('./DynamicSocialSignIn/DynamicSocialSignIn.cjs');

const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
    var _a, _b, _c;
    const projectSettings = useProjectSettings.useProjectSettings();
    if (!projectSettings) {
        logger.logger.debug('Failed to render SocialSignInSection - no project settings');
        return null;
    }
    const providers = (_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [];
    const componentProps = {
        collapsedLayout,
        defaultProvider: getSocialSignInProviderFromString.getSocialSignInProviderFromString(sectionData.defaultItem),
        numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
    };
    const isMagicEnabled = isProviderEnabled.isProviderEnabled(providers, sdkApiCore.ProviderEnum.MagicLink);
    if (isMagicEnabled &&
        ((_b = projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
            sdkApiCore.SignInProviderEnum.MagicLink) {
        return jsxRuntime.jsx(MagicSocialSignIn.MagicSocialSignIn, Object.assign({}, componentProps));
    }
    if (((_c = projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
        sdkApiCore.SignInProviderEnum.Dynamic) {
        return jsxRuntime.jsx(DynamicSocialSignIn.DynamicSocialSignIn, Object.assign({}, componentProps));
    }
    logger.logger.error('Failed to render SocialSignInSection - no sign in provider enabled');
    return null;
};

exports.SocialSignInSection = SocialSignInSection;
