Skip to content

Conversation

@ricardofiorani
Copy link

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR enhances the loadHyper function to allow passing a full script URL via the publishableKey field.

If the provided scriptURL starts with http:// or https://, it will now be treated as a direct URL to the HyperLoader.js script, overriding the default logic based on environment or key prefix. This makes it possible to load a custom or self-hosted version of the Hyperswitch loader.


How did you test it?

  • Manually verified that passing a full URL as publishableKey correctly loads the specified script.
  • Confirmed fallback logic continues to load the appropriate default script for regular keys (pk_*).
  • Ensured duplicate loader warning is still respected.
  • Tested integration inside a real app using a custom Hyperswitch instance.

Usage Notes

  • ✅ No breaking changes.

  • 🔧 New optional behavior for advanced users.

  • Consumers can now do:

    loadHyper(publishableKey, {
        scriptURL: "https://my-custom-script.com/script.js",
    })
  • Existing usage with pk_test_* or pk_prd_* remains unchanged.


Checklist

  • I ran npm run re:build and verified the build artifacts.
  • I reviewed the code for style, readability, and consistency.
  • I verified the changes are backward compatible (if applicable).
  • I tested this change in a real or simulated consuming project.
  • I updated documentation, README, or usage examples if necessary.

Screenshots or Logs

N/A

@github-actions github-actions bot added the S-conventions-not-followed Some Github conventions not followed label Jun 23, 2025
@ricardofiorani
Copy link
Author

I didn't found any CONTRIBUTING file, so sorry I didn't followed your convention but none was explicitly set.

@ricardofiorani ricardofiorani changed the title Allow custom script URLs feat: Allow custom script URLs Jun 23, 2025
@github-actions github-actions bot removed the S-conventions-not-followed Some Github conventions not followed label Jun 23, 2025
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.

1 participant