Add popup runtime integration - #76
Open
anyelopetit wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8b78c1d. Configure here.
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.

Summary
Adds Capture Popup runtime support for Pop-ups on issue #783
The SDK can now mount a dashboard-configured popup on merchant websites, render the server-provided popup HTML, evaluate display rules client-side, handle bubble/open/close behavior, validate multi-step inputs, submit captured data, and show the completed state.
Issue
Capture Popups V1 now has a Rails-side builder, install flow, public render endpoint, and public submissions endpoint. The missing SDK piece was the storefront integration:
hellotext.jsneeded to load the installed popup and make it behave like it would on a third-party merchant site.Required runtime behavior:
popup.id.Solution
Popup configuration
Configuration.popup.popup: falsedisables popup mounting.popup.containerdefaults tobody.popup.devicedefaults toauto.business.popupconfig is merged with localconfig.popup.popup.idcan override the dashboard popup id.Popup API
API.popups.get(id)forGET /v1/public/popups/:id.API.popups.submit(id, data)forPOST /v1/public/popups/:id/submissions.Hellotext.headers.<article>root.Popup model
Popupmodel.API.popups.Popup runtime controller
hellotext--popupStimulus controller.Styles, docs, and types
styles/index.css.Popupmodel.README.md.Decisions And Trade-Offs
hellotext.jsowns browser behavior, validation, rules, mounting, and submission.popupconfig, so existing forms and webchat behavior remain unchanged.Compatibility
Backward-compatible for existing SDK consumers:
Hellotext.initialize(BUSINESS_ID)behavior remains valid.popup: falseexplicitly disables popup mounting.hellotext--popupprefixed classes.Runtime dependency:
GET /v1/public/popups/:idPOST /v1/public/popups/:id/submissionsbusiness.popupin the public business payload for automatic installsData And Rollout
Production Risks
Pre-Deploy Checklist
/v1/public/popups/:idreturns popup HTML for an active visible popup./v1/public/popups/:id/submissionsaccepts email and phone submissions.popup.id.business.popup.Post-Deploy Checklist
hellotext--popup.Test Verification
Focused SDK tests passed:
yarn test __tests__/api/popups_test.js __tests__/models/popup_test.js __tests__/controllers/popup_controller_test.js __tests__/core/configuration_test.js __tests__/hellotext_test.js __tests__/api/whatsapp_widgets_test.js __tests__/core/whatsapp_configuration_test.js __tests__/models/whatsapp_widget_test.jsResult:
Additional checks:
Manual Verification
Recommended manual flow:
business.metadata.pixel.popup.id.Hellotext.initialize(BUSINESS_ID).popup.id.Follow-Ups
Note
Medium Risk
New customer-facing capture UI that mounts on merchant sites and submits PII (email/phone), but it follows existing webchat/widget patterns and is opt-in/backward compatible.
Overview
Adds Hellotext Popups so merchant sites can mount dashboard-configured capture popups at initialize time.
Popups load from dashboard
business.popupmetadata or an explicitpopup.id, withpopup: falseto disable. Local options (container,device) merge over dashboard defaults. The SDK fetches server-rendered HTML, waits for styles, and mounts into the configured container.A new
hellotext--popupcontroller handles bubble/open/close, device targeting, AND display rules (page properties, scroll depth, viewed state), multi-step validation, submission, and the completed state.Reviewed by Cursor Bugbot for commit a3adf5c. Bugbot is set up for automated code reviews on this repo. Configure here.