@dynamic-labs/sdk-react-core
Version:
A React SDK for implementing wallet web3 authentication and authorization to your website.
35 lines (32 loc) • 2.11 kB
JavaScript
'use client'
import { useEffect } from 'react';
import { EnvironmentEnum } from '@dynamic-labs/sdk-api-core';
import { logger } from '../../../shared/logger.js';
import '@dynamic-labs/iconic';
import '@dynamic-labs/wallet-connector-core';
import 'react/jsx-runtime';
import '../../../context/ViewContext/ViewContext.js';
import '@dynamic-labs/wallet-book';
import '@dynamic-labs/utils';
import '../../constants/colors.js';
import '../../constants/values.js';
import '../../../shared/consts/index.js';
let didLog = false;
const useEndUserWarning = ({ suppress = false, projectSettings, }) => {
useEffect(() => {
var _a;
if (!suppress &&
!didLog &&
(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName) === EnvironmentEnum.Live) {
didLog = true;
logger.info('%cWarning!', 'color: red; font-size: 32px;');
logger.info('%cThis is a browser feature intended for developers. You are reading this message because you opened the browser console, a developer tool.\n\n%c1. Never share your tokens or sensitive information with anyone.\n2. Do not paste any code you do not fully understand.\n3. If someone instructed you to do this, it is likely a scam.\n\n%cInjecting code into your browser could result in loss of tokens or control of your account that cannot be recovered or protected.', 'font-size: 16px;', 'font-size: 12px;', 'color: red; font-size: 12px;');
if (((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportUrls) &&
Object.values(projectSettings.general.supportUrls).length > 0) {
logger.info(`%cFor more information, visit ${Object.values(projectSettings.general.supportUrls)[0]}`, 'font-size: 12px;');
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.environmentName, suppress]);
};
export { useEndUserWarning };