From 09e8c62f04c29c56898201a3db6b91accdf98e9c Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 13:08:40 +0100 Subject: [PATCH 1/8] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e358e03..a3d084d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ to trigger the Dropin. > story](https://gocardless.github.io/react-dropin/?path=/story/dropin-gocardlessdropinbutton--base) ```typescript -import React, { useCallback, useState } from "react"; +import React, { useCallback, useState, useEffect } from "react"; import { useGoCardlessDropin, GoCardlessDropinOptions, @@ -64,7 +64,7 @@ const App: FunctionComponent = () => { // // See an example of this at Taking an Instant Bank Payment: // https://developer.gocardless.com/getting-started/billing-requests/taking-an-instant-bank-payment/ - React.useEffect(() => { + useEffect(() => { async function createFlow() { // Expecting a JSON body like: // { @@ -80,7 +80,7 @@ const App: FunctionComponent = () => { }, []); // Only show the button once we have a Billing Request Flow ID - return token === null ? ( + return flowID === null ? (
) : ( From a15186856ee07f10de6bbc1fffb911fdbdc4aa79 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 13:12:55 +0100 Subject: [PATCH 2/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3d084d..98c733a 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ to trigger the Dropin. > story](https://gocardless.github.io/react-dropin/?path=/story/dropin-gocardlessdropinbutton--base) ```typescript -import React, { useCallback, useState, useEffect } from "react"; +import React, { FunctionComponent, useCallback, useState, useEffect } from "react"; import { useGoCardlessDropin, GoCardlessDropinOptions, From 1ba7a23821f412dd48e623cda84e1a367cb1a378 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 13:14:23 +0100 Subject: [PATCH 3/8] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98c733a..2f06413 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ const DropinButton = (options: GoCardlessDropinOptions) => { // Example checkout flow, where we create a Billing Request Flow ID by talking // with our backend API. const App: FunctionComponent = () => { - const [flowID, setFlowID] = useState(null); + const [flowID, setFlowID] = useState(""); // Build your backend with an API endpoint that: // @@ -80,7 +80,7 @@ const App: FunctionComponent = () => { }, []); // Only show the button once we have a Billing Request Flow ID - return flowID === null ? ( + return flowID ? (
) : ( From bb5c528f1bede62e8f202881605fe94f6b209b8a Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 13:53:14 +0100 Subject: [PATCH 4/8] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f06413..cf3d2f0 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,7 @@ import React, { FunctionComponent, useCallback, useState, useEffect } from "reac import { useGoCardlessDropin, GoCardlessDropinOptions, - GoCardlessDropinOnSuccess, -} +} from '@gocardless/react-dropin' // Display a button that opens the Dropin on click, starting a checkout // flow for the specified Billing Request Flow. From e30157af9c67a1655bb5f34d4fd14b00838c2ed1 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 13:56:13 +0100 Subject: [PATCH 5/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf3d2f0..a52404d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ to trigger the Dropin. > story](https://gocardless.github.io/react-dropin/?path=/story/dropin-gocardlessdropinbutton--base) ```typescript -import React, { FunctionComponent, useCallback, useState, useEffect } from "react"; +import React, { FunctionComponent, useState, useEffect } from "react"; import { useGoCardlessDropin, GoCardlessDropinOptions, From b028613101a6750257c9d50248618f4c0b0a6988 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 13:57:16 +0100 Subject: [PATCH 6/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a52404d..1107a0a 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ import { // Display a button that opens the Dropin on click, starting a checkout // flow for the specified Billing Request Flow. -const DropinButton = (options: GoCardlessDropinOptions) => { +const DropinButton: FunctionComponent = (options) => { const { open } = useGoCardlessDropin({ ...options }); return ( From d484bad873a1c1a1e92509dae03a71e95351d283 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 13:58:09 +0100 Subject: [PATCH 7/8] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1107a0a..a59dcd2 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ to trigger the Dropin. > story](https://gocardless.github.io/react-dropin/?path=/story/dropin-gocardlessdropinbutton--base) ```typescript -import React, { FunctionComponent, useState, useEffect } from "react"; +import React, { FC, useState, useEffect } from "react"; import { useGoCardlessDropin, GoCardlessDropinOptions, @@ -39,7 +39,7 @@ import { // Display a button that opens the Dropin on click, starting a checkout // flow for the specified Billing Request Flow. -const DropinButton: FunctionComponent = (options) => { +const DropinButton: FC = (options) => { const { open } = useGoCardlessDropin({ ...options }); return ( @@ -52,7 +52,7 @@ const DropinButton: FunctionComponent = (options) => { // Example checkout flow, where we create a Billing Request Flow ID by talking // with our backend API. -const App: FunctionComponent = () => { +const App: FC = () => { const [flowID, setFlowID] = useState(""); // Build your backend with an API endpoint that: From f48252d86f49ec7c90fb36088d14fd70a21cfbca Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 25 Oct 2022 14:20:58 +0100 Subject: [PATCH 8/8] Improve types --- src/types/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/index.ts b/src/types/index.ts index 8e2faae..b9e11f2 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -40,7 +40,7 @@ type CommonOptions = ClientCallbacks & { /** * Environment name, one of live or sandbox. */ - environment: string; + environment: "live" | "sandbox"; /** * Domain override if using a custom environment (for internal use only). */