From f4324122ccf47b27fd1f2bccc5ff8e4ab2bd73dc Mon Sep 17 00:00:00 2001 From: Vadym Shaveiko Date: Sun, 17 May 2026 01:14:00 -0400 Subject: [PATCH] Self-hosted embed: JWT shim + Rails-side glue for cross-origin iframe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lets the EnWella EHR mount (and -form) without a paid Pro license. Upstream's `EmbedScriptsController` returns an "Upgrade to Pro" stub; we override it via the static-asset path so the real shim wins without touching the controller. JS shim (public/js/builder.js) - Web component that decodes the JWT minted by the embedder (`name`, `document_urls`, `external_id`, optional `template_id`). - Iframes /templates/:id/edit for existing templates, /new?... for the upload-from-URL flow. - Relays a `save` postMessage from the inner builder up as a DOM `CustomEvent('save')` on the outer element so @docuseal/react's onSave callback fires. - Discovers host from its own