Skip to content

feat: add getInstanceUrl() to plugins SDK to expose Staffbase frontend domain#299

Merged
maximizeIT merged 2 commits intomainfrom
feat/add-get-instance-url
Apr 8, 2026
Merged

feat: add getInstanceUrl() to plugins SDK to expose Staffbase frontend domain#299
maximizeIT merged 2 commits intomainfrom
feat/add-get-instance-url

Conversation

@maximizeIT
Copy link
Copy Markdown
Contributor

@maximizeIT maximizeIT commented Apr 7, 2026

Description:

Summary

Adds a new getInstanceUrl() method to the plugins-client-sdk that returns the URL of the Staffbase frontend instance hosting the plugin.

Changes

  • src/lib/connection/commands.js — added instanceUrl: 'instance-url' command
  • src/lib/connection/connector/postmessage.js — destructures instance from HELLO payload, stores instanceUrl
  • src/lib/connection/connector/fallback-handlers.js — added getInstanceUrl() fallback using ancestorOrigins / document.referrer
  • src/lib/connection/connector/fallback.js — added case action.instanceUrl
  • src/lib/app.js — added getInstanceUrl() public API method
  • src/main.js — exported getInstanceUrl
  • docs/api.md + docs/usage.md — documented new method
  • resources/index.html — added demo section
  • Tests updated: app.test.js, connection.test.js, fallback.test.js.snap

Related PRs

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING part in the readme.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Test plan:

@maximizeIT maximizeIT requested a review from a team as a code owner April 7, 2026 09:08
Co-authored-by: GitHub Copilot <copilot@noreply.github.com>
@maximizeIT maximizeIT force-pushed the feat/add-get-instance-url branch from 5a0f082 to a147b63 Compare April 7, 2026 09:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

size-limit report 📦

Path Size
src/main.js 6.71 KB (+1.39% 🔺)

Copy link
Copy Markdown
Contributor

@Ninerian Ninerian left a comment

Choose a reason for hiding this comment

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

Just one small nit.

@maximizeIT maximizeIT merged commit bc1027c into main Apr 8, 2026
8 checks passed
@maximizeIT maximizeIT deleted the feat/add-get-instance-url branch April 8, 2026 09:36
@staffbase-actions
Copy link
Copy Markdown

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants