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(); + }); + }); });