Skip to content

frontend: unify vendor iframe shell behavior#3914

Merged
thisconnect merged 1 commit intoBitBoxSwiss:masterfrom
smokyisthatyou:refactor-iframe
Apr 7, 2026
Merged

frontend: unify vendor iframe shell behavior#3914
thisconnect merged 1 commit intoBitBoxSwiss:masterfrom
smokyisthatyou:refactor-iframe

Conversation

@smokyisthatyou
Copy link
Copy Markdown
Contributor

Extract shared iframe shell logic into a reusable hook and adopt it across market and bitsurance vendor widgets. This removes duplicated resize/load/terms state handling and stabilizes signing guards in iframe message flows.

cc @thisconnect

Copy link
Copy Markdown
Collaborator

@thisconnect thisconnect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is indeed a bit repeated code.

Please split into two separate commits, each should add a hook one for resizing the height and the other for managing the terms.

Comment thread frontends/web/src/hooks/vendor-iframe.ts Outdated
@smokyisthatyou smokyisthatyou force-pushed the refactor-iframe branch 3 times, most recently from 0c81c61 to 0069e20 Compare March 17, 2026 14:54
@smokyisthatyou smokyisthatyou marked this pull request as ready for review March 30, 2026 16:23
@smokyisthatyou
Copy link
Copy Markdown
Contributor Author

@thisconnect moving this out from drafts, rebased

Comment thread frontends/web/src/hooks/vendor-iframe.ts Outdated
Comment thread frontends/web/src/hooks/vendor-iframe-terms.ts Outdated
switch (message.type) {
case V0MessageType.RequestAddress:
if (!signing) {
if (!signingRef.current) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: signing got refacotored to ref, but looks good

@thisconnect
Copy link
Copy Markdown
Collaborator

Looks good, please squash

Extract vendor widget resize/height handling and disclaimer
terms state into reusable hooks and use them across market
offerings and the Bitsurance widget to remove duplicated
iframe shell logic.
Copy link
Copy Markdown
Collaborator

@thisconnect thisconnect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested macOS & Android LGTM thanks

}, 200);
};
const { containerRef, height, iframeLoaded, onIframeLoad } = useVendorIframeResizeHeight();
const { agreedTerms, setAgreedTerms } = useVendorTerms(!!config?.frontend?.skipMoonpayDisclaimer);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future after we have PR: #3916
we could only pass the string of the key in the config 'skipMoonpayDisclaimer'
and let the hook access config directly.

@thisconnect thisconnect merged commit 9f8bdaa into BitBoxSwiss:master Apr 7, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants