From 44e64d3750c5cdb9d57ec47aec581b45ee17fca6 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 | 7 ++++++- test/provider.test.jsx | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/provider.jsx b/lib/provider.jsx index 8e96247..8bda93c 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: 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(); + }); + }); });