Skip to content

PIQ-5366: Add updateStyles action — runtime style updates without reload - #45

Merged
sorin-matei-worldline merged 4 commits into
masterfrom
PIQ-5366-runtime-update-styles
Jul 28, 2026
Merged

sorin-matei-worldline merged 4 commits into
masterfrom
PIQ-5366-runtime-update-styles

Conversation

@mellyynda

@mellyynda mellyynda commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a public HostedFields.updateStyles(styles) method so integrators can change the custom styles of already rendered hosted fields at runtime, without re-running setup() and reloading the iframes (which causes flicker and clears user input). Styles were previously load-time-only: sent once per iframe load in the setupContent / setupSingleIframeContent postMessage.

Jira: https://paymentiq.atlassian.net/browse/PIQ-5366

Changes

  • src/sdk/api/actions.js: new updateStyles action constant.
  • src/sdk/api/index.js: new updateStyles(newStyles) function — updates the stored module styles var (so subsequent setups reuse it) and postMessages {action: 'updateStyles', styles} to all registered targets, which covers both multiple (iframe per field) and single renderMode; exported on the HostedFields object.
  • index.d.ts: updateStyles(styles: string): void added to the HostedFields interface.
  • README.md: updateStyles documented 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.
  • Message contract manually traced against the iframe-side handler in the sibling PR: same action name updateStyles and payload key styles, targeted with the existing hostedfieldsurl origin like all other outgoing messages.
  • Not run: 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

mellyynda and others added 4 commits July 14, 2026 09:16
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>
@sorin-matei-worldline
sorin-matei-worldline merged commit 7cabe21 into master Jul 28, 2026
1 check passed
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.

3 participants