@adyen/react-native
Version:
Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native
24 lines (21 loc) • 959 B
text/typescript
import { EmbeddedComponentBusWrapper } from './EmbeddedComponentBusWrapper';
import type { AddressLookupItem, PaymentAction } from '../../core';
import type { NativeModuleWithConstants } from '../base/EventListenerWrapper';
import { ModuleMock } from '../base/ModuleMock';
import { NativeModules } from 'react-native';
export interface EmbeddedNativeModule extends NativeModuleWithConstants {
subscribe(viewId: string): void;
unsubscribe(viewId: string): void;
handle(viewId: string, action: PaymentAction): void;
hide(viewId: string, success: boolean, option?: { message?: string }): void;
update(viewId: string, results: AddressLookupItem[]): void;
confirm(
viewId: string,
success: boolean,
body?: AddressLookupItem | { message?: string }
): void;
}
/** Communication bus for all embedded Native Modules. */
export const EmbeddedComponentBus = new EmbeddedComponentBusWrapper(
NativeModules.AdyenComponentBus ?? ModuleMock
);