You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add openPopup App Bridge action for widgets (#6667)
* feat(extensions): add openPopup App Bridge action for widgets
Lets a WIDGET extension open one of its own app's POPUP extensions
("full mode") that is co-located on the same page. The action carries a
per-app-unique extension `identifier` and an arbitrary JSON payload that
is serialized into a single `appParams` query param on the popup URL.
- New `openPopup` action: gated to WIDGET frames, resolved against the
page's loaded extensions filtered by app id + identifier + POPUP target
(same-app enforced by construction), reusing the existing popup dialog.
- Failures (wrong source / not found / wrong target / oversized payload)
return ok:false and console.error on the dashboard.
- Adds an extension registry so the global popup context can resolve
against extensions the current page already fetched (no extra query).
The `identifier` field is faked into the GraphQL schema until Saleor Core
ships it; the action type is declared locally until @saleor/app-sdk does.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: sync GraphQL schema and regenerate types
Core now ships AppExtension.identifier (previously faked locally); fetch
brings in the real field and regenerates. Adds fromCache to the openPopup
test fixture after the main merge.
* refactor(extensions): forward app-serialized appParams verbatim
openPopup now takes a pre-serialized (base64) appParams string from the
app and forwards it into the popup URL unchanged; the Dashboard only
length-validates it instead of JSON-serializing the payload itself.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(extensions): keep openPopup JWT fresh on long-open dashboard
Widgets never refreshed their access token: AppWidgetExtensionItem
mounted AppFrame without a refetch, so useTokenRefresh was a no-op and
the ExtensionList query token was fetched once and left to expire. The
openPopup path read that same token from the registry and only rejected
an empty token, never an expired one -- so a long-open dashboard could
open a popup with a dead JWT and fail the handshake.
- add isTokenFresh (jwt-decode, 5s margin; lenient on undecodable tokens)
- thread the query refetch onto Extension + into the widget AppFrame so
useTokenRefresh keeps the widget JWT current (also keeps the registry,
and any co-located popup, fresh)
- gate openPopupByIdentifier on token freshness: on stale, kick a refetch
and reject with console.error so the retry gets a fresh token
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* iframe height
* use real sdk
* changeset
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Widgets can now open a full-mode popup. A WIDGET extension can dispatch the new `openPopup` App Bridge action to open one of its app's POPUP extensions declared on the same page, passing an arbitrary JSON payload to it. This lets an app render a compact widget inline and let the user expand it into a larger popup view on demand. The popup always opens with a fresh access token and fills the full popup height.
0 commit comments