Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- BoltReactNativeSdk (0.6.1):
- BoltReactNativeSdk (0.7.2):
- hermes-engine
- RCTRequired
- RCTTypeSafety
Expand Down Expand Up @@ -2063,7 +2063,7 @@ EXTERNAL SOURCES:
:path: "../../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
BoltReactNativeSdk: 39c8b5101365cc76c9b46468a9a2243c0230b2d4
BoltReactNativeSdk: f0c75d2043963259b5da2534cc13e55ffa8006a6
FBLazyVector: c12d2108050e27952983d565a232f6f7b1ad5e69
hermes-engine: 7e38620e1a649887e872d251528805867fa4d0b6
RCTDeprecation: 3280799c14232a56e5a44f92981a8ee33bc69fd9
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"typecheck": "tsc",
"test": "jest",
"release": "release-it",
"pod": "cd example/ios && pod install",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"inject-telemetry-config": "node scripts/inject-telemetry-config.js",
"gen-dev-telemetry-config": "node scripts/gen-dev-telemetry-config.js",
Expand Down
25 changes: 22 additions & 3 deletions src/payments/ApplePayWebView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,28 @@ export const ApplePayWebView = ({
try {
const outer = JSON.parse(raw);

// Unwrap bridge postMessage envelope produced by injectedBridge.ts
let unwrapped = outer;
if (
unwrapped?.__boltBridge === true &&
unwrapped.type === 'postMessage' &&
unwrapped.data !== undefined
) {
const inner = unwrapped.data;
if (typeof inner === 'string') {
try {
unwrapped = JSON.parse(inner);
} catch {
// Inner payload is a plain string, keep as-is
unwrapped = inner;
}
} else {
unwrapped = inner;
}
}

// Height change from iframe
let msg = outer;
let msg = unwrapped;
if (typeof msg === 'string') {
try {
msg = JSON.parse(msg);
Expand All @@ -129,9 +149,8 @@ export const ApplePayWebView = ({
}

// Apple Pay result messages
const applePayMsg = parseBoltMessage(raw);
const applePayMsg = parseBoltMessage(unwrapped);
if (!applePayMsg) return;

if (applePayMsg.type === 'addCardFromApplePaySuccess') {
const message = applePayMsg.message as Record<string, unknown>;
const tokenResult = message.token as
Expand Down
Loading