@dynamic-labs/sdk-react-core
Version:
A React SDK for implementing wallet web3 authentication and authorization to your website.
37 lines (34 loc) • 1.19 kB
JavaScript
'use client'
import EventEmitter from 'eventemitter3';
// ATTENTION
// Everything below should be made public soon, but we need to plan this out first
// Main issues:
// 1. How should we map customer callback names to our dynamic event names?
// -> Gui's suggestion: breaking change to rename customer callbacks so they fit these events names
// 2. We would have to remove these callbacks from the useCustomerCallbacks hook
/** Which events are accessible by our clients */
const externalEvents = [
'authFailure',
'authFlowCancelled',
'authFlowClose',
'authFlowOpen',
'authInit',
'emailVerificationResult',
'embeddedWalletCreated',
'logout',
'mfaCompletionFailure',
'mfaCompletionSuccess',
'primaryWalletChanged',
'primaryWalletNetworkChanged',
'smsVerificationResult',
'walletAdded',
'walletRemoved',
'userWalletsChanged',
'walletConnectedForFunding',
'walletTabSelected',
];
// Full internal event emitter
const dynamicEvents = new EventEmitter();
// Limited public event emitter with subset of events
const publicDynamicEvents = dynamicEvents;
export { dynamicEvents, externalEvents, publicDynamicEvents };