UNPKG

@rnw-community/react-native-payments

Version:

Accept Payments with Apple Pay and Android Pay using the Payment Request API.

33 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NativePayments = void 0; const react_native_1 = require("react-native"); const shared_1 = require("@rnw-community/shared"); const LINKING_ERROR = `The package 'react-native-payments' doesn't seem to be linked. Make sure: \n\n${react_native_1.Platform.select({ ios: "- You have run 'pod install'\n", default: '', })}- You rebuilt the app after installing the package\n- You are not using Expo Go\n`; const optionalNativeMethodNames = new Set([ 'addListener', 'removeListeners', 'retry', 'setActiveEvents', 'updatePaymentDetails', ]); // @ts-expect-error Temporary hack // eslint-disable-next-line no-underscore-dangle const isTurboModuleEnabled = (0, shared_1.isDefined)(global.__turboModuleProxy); const PaymentsModule = isTurboModuleEnabled ? // eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-unsafe-member-access require('../../NativePayments').default : react_native_1.NativeModules.Payments; const PaymentsProxy = new Proxy({}, { get(_target, propertyName) { if (optionalNativeMethodNames.has(propertyName)) { return void 0; } throw new Error(LINKING_ERROR); }, }); exports.NativePayments = (0, shared_1.isDefined)(PaymentsModule) ? PaymentsModule : PaymentsProxy; //# sourceMappingURL=native-payments.js.map