From 3c801aecaf885d56107f55b80ae5d775ecd1bca9 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Fri, 3 Apr 2026 02:26:30 +0000 Subject: [PATCH] fix(rcart): use popup for Transak in all environments Transak production also sends X-Frame-Options: SAMEORIGIN, blocking iframe embeds. Switch to popup window for all environments, not just staging. Show "payment opened in new window" status with re-open button. Co-Authored-By: Claude Opus 4.6 (1M context) --- modules/rcart/components/folk-payment-page.ts | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/modules/rcart/components/folk-payment-page.ts b/modules/rcart/components/folk-payment-page.ts index 64fcdd3..6fba6ea 100644 --- a/modules/rcart/components/folk-payment-page.ts +++ b/modules/rcart/components/folk-payment-page.ts @@ -158,21 +158,19 @@ class FolkPaymentPage extends HTMLElement { // Listen for Transak postMessage events window.addEventListener('message', this.handleTransakMessage); - // Staging blocks iframes (X-Frame-Options: sameorigin) — use popup - if (this.transakEnv === 'STAGING') { - this.transakPopup = window.open( - data.widgetUrl, - 'transak-payment', - 'width=450,height=700,scrollbars=yes,resizable=yes', - ); - // Poll for popup close (user cancelled) - const popupPoll = setInterval(() => { - if (this.transakPopup?.closed) { - clearInterval(popupPoll); - this.transakPopup = null; - } - }, 1000); - } + // Transak blocks iframes (X-Frame-Options: sameorigin) — always use popup + this.transakPopup = window.open( + data.widgetUrl, + 'transak-payment', + 'width=450,height=700,scrollbars=yes,resizable=yes', + ); + // Poll for popup close (user cancelled) + const popupPoll = setInterval(() => { + if (this.transakPopup?.closed) { + clearInterval(popupPoll); + this.transakPopup = null; + } + }, 1000); } catch (e) { this.error = e instanceof Error ? e.message : String(e); } @@ -570,9 +568,8 @@ class FolkPaymentPage extends HTMLElement { private renderCardTab(): string { if (this.transakUrl) { - // Staging: Transak blocks iframes, show popup status instead - if (this.transakEnv === 'STAGING') { - return ` + // Transak blocks iframes (X-Frame-Options: sameorigin) — show popup status + return `

Transak payment opened in a new window.

@@ -580,11 +577,6 @@ class FolkPaymentPage extends HTMLElement {
`; - } - return ` -
- -
`; } return `