Skip to content

Commit

Permalink
Merge pull request #12 from noramp/feature/refresh-on-close
Browse files Browse the repository at this point in the history
change ids and refresh on close
  • Loading branch information
rarepepi authored Apr 30, 2024
2 parents 882b1a3 + 86307b4 commit 100d7ed
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
16 changes: 8 additions & 8 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ const App = () => {
<div className="column dark">
<p className="title">Light theme:</p>
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="light"
type="buy"
buttonTheme="light"
/>

<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="light"
type="book"
buttonTheme="light"
/>

<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="light"
type="donate"
buttonTheme="light"
/>
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="light"
type="plain"
Expand All @@ -44,30 +44,30 @@ const App = () => {
<div className="column light">
<p className="title">Dark theme:</p>
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="dark"
buttonTheme="dark"
/>

<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="dark"
buttonTheme="dark"
type="checkout"
/>

<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="dark"
buttonTheme="dark"
type="continue"
/>

<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme="dark"
type="plain"
Expand Down
12 changes: 6 additions & 6 deletions example/src/routes/checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Checkout = () => {
<div className="grid w-full max-w-4xl grid-cols-1 gap-4 overflow-auto lg:grid-cols-2 ">
<div className="flex">
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
// priceId="price_1EJSx7ToLIsWmMQB6WLGmR"
onSuccess={handleSuccess}
theme={theme}
Expand All @@ -39,7 +39,7 @@ const Checkout = () => {

<div className="flex">
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme={theme}
type="book"
Expand All @@ -49,7 +49,7 @@ const Checkout = () => {

<div className="flex">
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme={theme}
type="donate"
Expand All @@ -59,7 +59,7 @@ const Checkout = () => {

<div className="flex">
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme={theme}
buttonTheme={theme}
Expand All @@ -68,7 +68,7 @@ const Checkout = () => {
</div>
<div className="flex">
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme={theme}
buttonTheme={theme}
Expand All @@ -77,7 +77,7 @@ const Checkout = () => {
</div>
<div className="flex">
<NoRampCheckout
priceId="price_3O7ZpGp3BmILQOQhlzk2Pg"
priceId="pi_0a0CHdzVCUSwvZmvbQ1gjm"
onSuccess={handleSuccess}
theme={theme}
type="plain"
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/useNoRampModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ export const useNoRampModal = (config: NoRampConfig) => {
if (iframeRef.current) {
iframeRef.current.style.display = 'none';

const src = getSrc(config);

iframeRef.current.src = `${src}?reload=${Date.now()}`;

setIsOpen(false);
}
};
Expand Down

0 comments on commit 100d7ed

Please sign in to comment.