From fcb835250bb411a0534da4b05eb6f48701ae5b8d Mon Sep 17 00:00:00 2001 From: Christopher Rogers Date: Fri, 29 Sep 2023 09:47:18 -0400 Subject: [PATCH] Adds hostname configuration --- lib/provider.jsx | 9 +++++++-- package-lock.json | 4 ++-- test/provider.test.jsx | 8 ++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/provider.jsx b/lib/provider.jsx index 8e96247..198dd2e 100644 --- a/lib/provider.jsx +++ b/lib/provider.jsx @@ -20,6 +20,11 @@ export default class RecurlyProvider extends React.Component { * [API Access](https://app.recurly.com/go/developer/api_access). */ publicKey: PropTypes.string, + + /** + * Register the current hostname + */ + hostname: PropTypes.string, /** * Sets a default currency */ @@ -56,7 +61,7 @@ export default class RecurlyProvider extends React.Component { constructor (props) { super(props); - if (!this.props.publicKey) { + if (!(this.props.publicKey || this.props.hostname)) { throw new Error(` Please pass your 'publicKey' value to this RecurlyProvider. Example: @@ -82,7 +87,7 @@ export default class RecurlyProvider extends React.Component { } } - render() { + render () { return ( {this.props.children} ); diff --git a/package-lock.json b/package-lock.json index 0cd1c4f..40e17cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17622,8 +17622,8 @@ } }, "node_modules/recurly.js": { - "version": "4.24.0", - "resolved": "git+ssh://git@github.com/recurly/recurly-js.git#ab1a2d922d86586174b04218a7c5a88bc8b5a1c6", + "version": "4.25.10", + "resolved": "git+ssh://git@github.com/recurly/recurly-js.git#4f3aa85a477aeae2561f90282f42125efa665a60", "dev": true, "license": "MIT", "workspaces": [ diff --git a/test/provider.test.jsx b/test/provider.test.jsx index 3c0b77a..a82fbdf 100644 --- a/test/provider.test.jsx +++ b/test/provider.test.jsx @@ -122,4 +122,12 @@ describe('', function () { } }); }); + + describe('with a hostname', function () { + it('does not throw an error', function () { + expect(() => { + render(); + }).not.toThrow(); + }); + }); });