Repository navigation
PIQ-5366: Add updateStyles action — runtime style updates without reload - #45
Merged
Merged
Conversation
Adds HostedFields.updateStyles(styles): stores the new styles and
postMessages {action: 'updateStyles', styles} to all registered target
iframes, covering both single and multiple renderMode. Previously styles
were only sent once per iframe load (setupContent /
setupSingleIframeContent), so changing them required a full
HostedFields.setup() and an iframe reload.
Also bumps to 1.3.2, updates CHANGES.md, README and index.d.ts.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The updateStyles source additions weren't reflected in the committed dist/ (this repo tracks built output). Rebuilt via `npm run build` so cjs + esm dist match src. CI rebuilds on publish regardless, but keep the tracked artifact in sync for git consumers / hygiene. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The iframe-side updateStyles handler ships in PaymentIQ-Hosted-Fields 1.1.9 (1.1.8 was the Rupay BIN regex release, without the handler). Correct the README note and CHANGES entry from 1.1.8+ to 1.1.9+. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Seras3
approved these changes
Jul 27, 2026
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 a public
HostedFields.updateStyles(styles)method so integrators can change the custom styles of already rendered hosted fields at runtime, without re-runningsetup()and reloading the iframes (which causes flicker and clears user input). Styles were previously load-time-only: sent once per iframe load in thesetupContent/setupSingleIframeContentpostMessage.Jira: https://paymentiq.atlassian.net/browse/PIQ-5366
Changes
src/sdk/api/actions.js: newupdateStylesaction constant.src/sdk/api/index.js: newupdateStyles(newStyles)function — updates the stored modulestylesvar (so subsequent setups reuse it) and postMessages{action: 'updateStyles', styles}to all registeredtargets, which covers bothmultiple(iframe per field) andsinglerenderMode; exported on theHostedFieldsobject.index.d.ts:updateStyles(styles: string): voidadded to theHostedFieldsinterface.README.md:updateStylesdocumented in the exposed-functions list plus a usage section (incl. note that the iframe side needs hosted fields 1.1.8+; older versions ignore the message).CHANGES.md+package.json: version bump to 1.3.2, following the repo convention.Verification
node --check(ESM) passes on the changed source files.updateStylesand payload keystyles, targeted with the existinghostedfieldsurlorigin like all other outgoing messages.npm run eslint/ build / unit tests — the repo has no test suite ("test": "test"stub) and node_modules is not installed in this environment (no installs per task constraints).dist/intentionally not rebuilt; publishing/build is handled by the release process.Sibling PR (iframe side): https://github.com/devcode-git/PaymentIQ-Hosted-Fields/pull/323
🤖 Generated with Claude Code