fix(rcart): use popup for Transak payment in all envs #3

Merged
jeffemmett merged 1 commits from dev into main 2026-04-03 04:26:48 +02:00
1 changed files with 15 additions and 23 deletions

View File

@ -158,21 +158,19 @@ class FolkPaymentPage extends HTMLElement {
// Listen for Transak postMessage events // Listen for Transak postMessage events
window.addEventListener('message', this.handleTransakMessage); window.addEventListener('message', this.handleTransakMessage);
// Staging blocks iframes (X-Frame-Options: sameorigin) — use popup // Transak blocks iframes (X-Frame-Options: sameorigin) — always use popup
if (this.transakEnv === 'STAGING') { this.transakPopup = window.open(
this.transakPopup = window.open( data.widgetUrl,
data.widgetUrl, 'transak-payment',
'transak-payment', 'width=450,height=700,scrollbars=yes,resizable=yes',
'width=450,height=700,scrollbars=yes,resizable=yes', );
); // Poll for popup close (user cancelled)
// Poll for popup close (user cancelled) const popupPoll = setInterval(() => {
const popupPoll = setInterval(() => { if (this.transakPopup?.closed) {
if (this.transakPopup?.closed) { clearInterval(popupPoll);
clearInterval(popupPoll); this.transakPopup = null;
this.transakPopup = null; }
} }, 1000);
}, 1000);
}
} catch (e) { } catch (e) {
this.error = e instanceof Error ? e.message : String(e); this.error = e instanceof Error ? e.message : String(e);
} }
@ -570,9 +568,8 @@ class FolkPaymentPage extends HTMLElement {
private renderCardTab(): string { private renderCardTab(): string {
if (this.transakUrl) { if (this.transakUrl) {
// Staging: Transak blocks iframes, show popup status instead // Transak blocks iframes (X-Frame-Options: sameorigin) — show popup status
if (this.transakEnv === 'STAGING') { return `
return `
<div class="tab-body" style="text-align:center"> <div class="tab-body" style="text-align:center">
<div class="transak-popup-status"> <div class="transak-popup-status">
<p class="tab-desc">Transak payment opened in a new window.</p> <p class="tab-desc">Transak payment opened in a new window.</p>
@ -580,11 +577,6 @@ class FolkPaymentPage extends HTMLElement {
<button class="btn" data-action="reopen-transak" style="margin-top:0.5rem">Re-open Payment Window</button> <button class="btn" data-action="reopen-transak" style="margin-top:0.5rem">Re-open Payment Window</button>
</div> </div>
</div>`; </div>`;
}
return `
<div class="transak-container">
<iframe src="${this.transakUrl}" class="transak-iframe" allow="camera;microphone;payment" frameborder="0"></iframe>
</div>`;
} }
return ` return `