UNPKG

trustly-react-native-webview

Version:

Trustly ReactNative WebView needed when integrating Trustly Checkout in a ReactNative application.

29 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.trustlyCustomBridge = exports.trustlyApplicationName = exports.NativeEventTypes = void 0; exports.NativeEventTypes = { SUCCESS: 'onTrustlyCheckoutSuccess', ERROR: 'onTrustlyCheckoutError', REDIRECT: 'onTrustlyCheckoutRedirect', ABORT: 'onTrustlyCheckoutAbort', }; exports.trustlyApplicationName = 'TrustlyReactNativeWebView/v1'; exports.trustlyCustomBridge = ` window.addEventListener('message', (e) => { try { const data = e.data; const message = typeof data !== 'string' ? JSON.stringify(data) : data; if (window.ReactNativeWebView) { window.ReactNativeWebView.postMessage(message, '*'); } } catch (e) { console.log('An error occurred while trying to handle message from Trustly SDK listener: ', e.message); } }); /* NOTE: this is required, or you'll sometimes get silent failures */ true; `; //# sourceMappingURL=common.js.map