@adyen/react-native
Version:
Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native
37 lines (36 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ComponentWrapper = void 0;
var _constants = require("../core/constants");
/**
* Wrapper for all Native Modules that do not support Action handling.
* */
class ComponentWrapper {
constructor(nativeModule, events) {
this.nativeModule = nativeModule;
this.events = [_constants.Event.onError, _constants.Event.onSubmit, _constants.Event.onComplete];
events?.forEach(element => this.events.push(element));
}
addListener(eventType) {
this.nativeModule.addListener(eventType);
}
removeListeners(count) {
this.nativeModule.removeListeners(count);
}
open(paymentMethods, configuration) {
this.nativeModule.open(paymentMethods, configuration);
}
hide(success, option) {
if (option?.message) {
this.nativeModule.hide(success, option);
} else {
this.nativeModule.hide(success, {
message: ''
});
}
}
}
exports.ComponentWrapper = ComponentWrapper;
//# sourceMappingURL=ComponentWrapper.js.map