UNPKG

@adyen/react-native

Version:

Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native

26 lines (23 loc) 869 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useAdyenCheckout = exports.AdyenCheckoutContext = void 0; var _react = require("react"); /** * Shape of the AdyenCheckout context value. */ const AdyenCheckoutContext = exports.AdyenCheckoutContext = /*#__PURE__*/(0, _react.createContext)(null); /** * Returns AdyenCheckout context. This context allows you to initiate payment with Drop-in or any payment method available in `paymentMethods` collection. */ const useAdyenCheckout = () => { const context = (0, _react.useContext)(AdyenCheckoutContext); if (context !== null) { return context; } throw new Error(MISSING_CONTEXT_ERROR); }; exports.useAdyenCheckout = useAdyenCheckout; const MISSING_CONTEXT_ERROR = 'useAdyenCheckout must be used within an AdyenCheckout'; //# sourceMappingURL=useAdyenCheckout.js.map