Skip to content

feat: app-bridge entry point (Feature 7) - #2

Merged
priosshrsth merged 2 commits into
mainfrom
feature/app-bridge
Mar 1, 2026
Merged

feat: app-bridge entry point (Feature 7)#2
priosshrsth merged 2 commits into
mainfrom
feature/app-bridge

Conversation

@priosshrsth

Copy link
Copy Markdown
Collaborator

Summary

  • Implements the assembly-kit/app-bridge entry point — framework-agnostic postMessage utilities for communicating with the Assembly dashboard parent frame
  • DASHBOARD_DOMAINS — prod + staging origins as a typed as const tuple
  • sendToParent(payload, portalUrl?) — fans out to all domains or a single origin; upgrades http:// to https://; no-op in SSR (typeof window === 'undefined')
  • Full type system: Icons enum, AppBridgePayload discriminated union (PrimaryCtaPayload | SecondaryCtaPayload | ActionsMenuPayload), CtaConfig, ActionItem, BridgeOpts (ready for Feature 8 React hooks)

Test plan

  • sendToParent without portalUrl → posts to every DASHBOARD_DOMAIN
  • sendToParent with portalUrl → posts to that origin only
  • http:// URLs upgraded to https://
  • SSR safety — no throw when window is undefined
  • Full payload forwarded unchanged
  • All Icons enum values correct
  • All DASHBOARD_DOMAINS entries use https://
  • bun run type-check passes
  • bun test — 10/10 pass

🤖 Generated with Claude Code

priosshrsth and others added 2 commits March 1, 2026 10:31
Add framework-agnostic postMessage utilities for communicating with the
Assembly dashboard parent frame:

- constants.ts  — DASHBOARD_DOMAINS (prod + staging)
- types.ts      — Icons enum, AppBridgePayload discriminated union,
                  PrimaryCtaPayload, SecondaryCtaPayload, ActionsMenuPayload,
                  CtaConfig, ActionItem, BridgeOpts
- send.ts       — sendToParent(): fans out to all DASHBOARD_DOMAINS or a
                  single portalUrl origin; ensureHttps() upgrades http://;
                  no-op in SSR (typeof window === 'undefined')
- index.ts      — barrel export for assembly-kit/app-bridge entry point

10 tests passing covering domain fan-out, single-origin targeting,
http→https upgrade, SSR safety, payload forwarding, and Icons values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion rule

- Rewrites test/app-bridge.test.ts to use a plain Call[] array instead of
  bun:test mock(), eliminating the empty callback that triggered the
  eslint(no-empty-function) CI failure on all platforms
- Adds app-bridge entry point to bunup.config.ts and package.json exports

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@priosshrsth
priosshrsth merged commit 2762c60 into main Mar 1, 2026
7 checks passed
@priosshrsth
priosshrsth deleted the feature/app-bridge branch March 1, 2026 10:43
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.

1 participant