feat: add Customer Portal Gutenberg block#66
Draft
evrpress wants to merge 13 commits into
Draft
Conversation
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>
3edd30a to
dcfdebf
Compare
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.
evrpress
commented
Jun 29, 2026
| listenerWindow.removeEventListener( 'message', fn, false ); | ||
| }; | ||
| } else { | ||
| attachListener = ( fn ) => { |
Collaborator
Author
There was a problem hiding this comment.
Not sure if we need to support attachEvent anymore unless we need to support IE 8 or below.
evrpress
commented
Jun 29, 2026
|
|
||
| if ( ! container || ! storeId || ! publicKey ) return undefined; | ||
|
|
||
| if ( ! allowInIframe && isRunningInIframe( win ) ) { |
Collaborator
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.