Skip to content

feat: add Customer Portal Gutenberg block#66

Draft
evrpress wants to merge 13 commits into
developfrom
feature/customer-portal
Draft

feat: add Customer Portal Gutenberg block#66
evrpress wants to merge 13 commits into
developfrom
feature/customer-portal

Conversation

@evrpress

@evrpress evrpress commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Adds a Freemius Customer Portal block that embeds the hosted members dashboard via iframe and postMessage, with per-block store credentials and resizable height in the editor.

Replaces the legacy customers.freemius.com/js/v1 embed script with a local React embed SDK (PortalEmbed component, usePortalEmbed and usePostMessageHub hooks) that implements the v1 parent-page protocol. The shared PortalEmbed component powers both the block editor preview and frontend rendering. Registers the block in class-freemius-blocks.php. Theming and style variations are deferred.

Site owners can embed the Freemius customer portal without loading third-party embed scripts.

Open WordPress Playground Preview

evrpress and others added 10 commits June 29, 2026 14:47
Adds a Freemius Customer Portal block that embeds the hosted members dashboard via iframe and postMessage, with per-block store credentials and resizable height in the editor.

Replaces the legacy customers.freemius.com/js/v1 embed script with a local React embed SDK (PortalEmbed component, usePortalEmbed and usePostMessageHub hooks) that implements the v1 parent-page protocol. The shared PortalEmbed component powers both the block editor preview and frontend rendering. Registers the block in class-freemius-blocks.php. Theming and style variations are deferred.

Site owners can embed the Freemius customer portal without loading third-party embed scripts.
…ment

Added a new style sheet for the Freemius Customer Portal block, introducing CSS variables for dynamic height management. Updated the PortalEmbed component to utilize these styles, improving the iframe's responsiveness and visibility handling. The height is now set via a dedicated function, streamlining the integration of the portal's height adjustments.
…djustments

Enhanced the Freemius Customer Portal block by allowing the portal block height to adapt dynamically based on iframe content, supporting various CSS units. Updated the block editor to reflect these changes, ensuring a better user experience with improved preview height management and responsive design. The PortalEmbed component now utilizes these enhancements for better integration and display.
Updated the createNoJQueryPostMessageTransport function to accept an optional listenerWindow parameter, allowing for more flexible message handling across different window contexts. This change improves the transport's adaptability and ensures that message events are correctly attached and detached from the specified window. Additionally, modified the createParentPostMessageHub function to utilize the new parameter for better integration.
…ds and placeholder

Added functionality to the Freemius Customer Portal block, introducing new fields for Store ID and Public Key, along with a placeholder form for user input. Implemented a responsive design that adapts the block's preview based on the presence of credentials, improving user experience. Updated styles for better layout and accessibility in the editor.
Removed unused eslint dependency and updated node engine requirement in package.json. Adjusted package-lock.json to reflect changes in dependencies, including the addition of new dev dependencies. Improved code formatting across various files for better readability and consistency, particularly in the Freemius Customer Portal block files.
…sample data

Refactored the content.xml file to align with the latest WordPress export standards. Updated the XML header, added a new title and description, and included sample posts with relevant metadata. This change enhances the usability of the export file for site migrations and improves compatibility with newer WordPress versions.
Generate blueprint.json during the preview build from
.wordpress-org/blueprints/blueprint.json and point importWxr at
content.xml from the PR head commit. Publish uses blueprint-from-artifact
instead of a hardcoded develop blueprint.

Co-authored-by: Cursor <cursoragent@cursor.com>
Modified the landing page reference in blueprint.json to point to the correct post ID. Updated timestamps in content.xml to reflect the latest creation and modification times. Additionally, added new items for navigation and page templates to enhance the export structure.
Co-authored-by: Cursor <cursoragent@cursor.com>
@evrpress evrpress force-pushed the feature/customer-portal branch from 3edd30a to dcfdebf Compare June 29, 2026 14:42
evrpress added 2 commits June 29, 2026 16:44
Adjusted the creation and publication timestamps in content.xml to reflect accurate times. Removed unnecessary items from the export structure to streamline the file, enhancing clarity and usability for WordPress imports.
Refactored the footer section in content.xml to enhance its structure and usability. Updated the post ID, timestamps, and modified the post type to 'wp_template_part'. Added new content elements for improved layout and social links, ensuring better integration with WordPress themes.
listenerWindow.removeEventListener( 'message', fn, false );
};
} else {
attachListener = ( fn ) => {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if we need to support attachEvent anymore unless we need to support IE 8 or below.


if ( ! container || ! storeId || ! publicKey ) return undefined;

if ( ! allowInIframe && isRunningInIframe( win ) ) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This also prevents also Playground from running the portal. I guess this was done to prevent clickjacking.

We should find a way to address this as playground should work out of the box (imo)

…nent

Added a new CSS class for the loader overlay in style.scss, enhancing its appearance and positioning. Refactored the PortalLoader component to utilize the new styles, removing inline styles for better maintainability. Also, removed the MAX_ZINDEX constant from portal-utils.js as it was no longer needed.
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