@superlogic/spree-pay 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/build/index.cjs +366 -297
- package/build/index.css +75 -21
- package/build/index.d.cts +4 -2
- package/build/index.d.ts +4 -2
- package/build/index.js +366 -297
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ npm i @superlogic/spree-pay
|
|
|
14
14
|
import { useState } from 'react';
|
|
15
15
|
|
|
16
16
|
import { SpreePay, SpreePayProvider, useSpreePay } from '@superlogic/spree-pay';
|
|
17
|
+
import '@superlogic/spree-pay/styles.css';
|
|
17
18
|
|
|
18
19
|
const spreeEnv = {
|
|
19
20
|
tenantId: 'moca' // Keep moca for crypto payments on BASE network
|
|
@@ -31,7 +32,7 @@ function Checkout() {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
function CheckoutContent() {
|
|
34
|
-
const { process } = useSpreePay(); // Access payment process function (must be inside provider)
|
|
35
|
+
const { process, selectedPaymentMethod, isProcessing } = useSpreePay(); // Access payment process function and processing state (must be inside provider)
|
|
35
36
|
const [status, setStatus] = useState<'idle' | 'processing' | 'success' | 'error'>('idle');
|
|
36
37
|
|
|
37
38
|
async function handleProcess() {
|
|
@@ -48,7 +49,7 @@ function CheckoutContent() {
|
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
51
|
<div style={{ maxWidth: 540 }}>
|
|
51
|
-
<SpreePay amount={99} onProcess={handleProcess} />
|
|
52
|
+
<SpreePay isLoading={status === 'processing'} amount={99} onProcess={handleProcess} />
|
|
52
53
|
{status === 'success' && <p>Payment successful! Thank you for your order.</p>}
|
|
53
54
|
{status === 'error' && <p>Payment failed. Please try again.</p>}
|
|
54
55
|
</div>
|