UNPKG

@dynamic-labs/sdk-react-core

Version:

A React SDK for implementing wallet web3 authentication and authorization to your website.

50 lines (45 loc) 2.15 kB
'use client' 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); require('@dynamic-labs/sdk-api-core'); require('../../constants/values.cjs'); require('@dynamic-labs/utils'); require('../../../../../_virtual/_tslib.cjs'); require('@dynamic-labs/multi-wallet'); var getActiveOauthCredential = require('../getActiveOauthCredential/getActiveOauthCredential.cjs'); require('../../../shared/logger.cjs'); require('../../constants/colors.cjs'); require('react-international-phone'); var shortenEmail = require('../../../shared/utils/functions/shortenEmail/shortenEmail.cjs'); var formatPhone = require('../formatPhone/formatPhone.cjs'); require('@dynamic-labs/iconic'); require('@dynamic-labs/wallet-connector-core'); require('react'); require('react/jsx-runtime'); require('../../../context/ViewContext/ViewContext.cjs'); require('@dynamic-labs/wallet-book'); require('../../../shared/consts/index.cjs'); require('../../../store/state/nonce/nonce.cjs'); require('../../../store/state/projectSettings/projectSettings.cjs'); require('../../../config/ApiEndpoint.cjs'); require('../../../store/state/user/user.cjs'); require('../../../locale/locale.cjs'); require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs'); require('../../../store/state/primaryWalletId/primaryWalletId.cjs'); require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs'); /** * This will return a string which we can present to the user as his identifier, such as * his email address or phone number. */ const getUserIdentifier = (user) => { const oauthCredential = getActiveOauthCredential.getActiveOauthCredential(user); if (oauthCredential === null || oauthCredential === void 0 ? void 0 : oauthCredential.publicIdentifier) { return oauthCredential.publicIdentifier; } if (user === null || user === void 0 ? void 0 : user.email) return shortenEmail.shortenEmail(user.email); if (user === null || user === void 0 ? void 0 : user.phoneNumber) return formatPhone.formatPhone(user.phoneNumber); return 'My Profile'; }; exports.getUserIdentifier = getUserIdentifier;