@hanzo/commerce 4.4.1 → 4.4.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { type PropsWithChildren } from 'react'
|
|
3
3
|
import { observer } from 'mobx-react-lite'
|
|
4
4
|
|
|
5
5
|
import { Button } from '@hanzo/ui/primitives'
|
|
@@ -9,21 +9,23 @@ import { useCommerce } from '../../service/context'
|
|
|
9
9
|
import { formatPrice } from '../../util'
|
|
10
10
|
|
|
11
11
|
import CartLineItem from './cart-line-item'
|
|
12
|
-
import CheckoutPanel from '../checkout-panel'
|
|
13
12
|
|
|
14
13
|
const CartPanel: React.FC<PropsWithChildren & {
|
|
15
14
|
className?: string
|
|
16
15
|
isMobile?: boolean,
|
|
17
16
|
noCheckout?: boolean
|
|
17
|
+
onCheckoutOpen?: () => void
|
|
18
18
|
}> = observer(({
|
|
19
19
|
/** Children is the heading area. */
|
|
20
20
|
children,
|
|
21
21
|
className='',
|
|
22
22
|
isMobile=false,
|
|
23
|
-
noCheckout=false
|
|
23
|
+
noCheckout=false,
|
|
24
|
+
onCheckoutOpen,
|
|
24
25
|
}) => {
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
/* TODO: onCheckoutOpen is a hackish way fix a bug with multiple dialog opened at the same time.
|
|
27
|
+
* Needs refactor with context or so.
|
|
28
|
+
**/
|
|
27
29
|
const cmmc = useCommerce()
|
|
28
30
|
if (!cmmc) {
|
|
29
31
|
return <div />
|
|
@@ -48,12 +50,11 @@ const CartPanel: React.FC<PropsWithChildren & {
|
|
|
48
50
|
variant='primary'
|
|
49
51
|
rounded='lg'
|
|
50
52
|
className='mt-12 mx-auto w-full'
|
|
51
|
-
onClick={
|
|
53
|
+
onClick={onCheckoutOpen}
|
|
52
54
|
>
|
|
53
55
|
Checkout
|
|
54
56
|
</Button>
|
|
55
57
|
)}
|
|
56
|
-
{checkoutOpen && <CheckoutPanel open={checkoutOpen} setOpen={setCheckoutOpen}/>}
|
|
57
58
|
</>)}
|
|
58
59
|
</div>
|
|
59
60
|
)
|
|
@@ -26,10 +26,10 @@ import { formatPrice, useCommerce } from '../..'
|
|
|
26
26
|
|
|
27
27
|
const CheckoutPanel: React.FC<{
|
|
28
28
|
open: boolean
|
|
29
|
-
|
|
29
|
+
onCheckoutClose: () => void
|
|
30
30
|
}> = observer(({
|
|
31
31
|
open,
|
|
32
|
-
|
|
32
|
+
onCheckoutClose
|
|
33
33
|
}) => {
|
|
34
34
|
|
|
35
35
|
const cmmc = useCommerce()
|
|
@@ -62,7 +62,7 @@ const CheckoutPanel: React.FC<{
|
|
|
62
62
|
|
|
63
63
|
const onClose = () => {
|
|
64
64
|
setStep(1)
|
|
65
|
-
|
|
65
|
+
onCheckoutClose()
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
return (
|
|
@@ -98,8 +98,8 @@ const CheckoutPanel: React.FC<{
|
|
|
98
98
|
</Accordion>
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
|
-
<div className='bg-level-1 flex flex-row items-start justify-start'>
|
|
102
|
-
<div className='h-full w-full max-w-[750px] relative flex flex-col gap-8 sm:gap-14
|
|
101
|
+
<div className='bg-level-1 flex flex-row items-start justify-start md:overflow-y-auto'>
|
|
102
|
+
<div className='h-full w-full max-w-[750px] relative flex flex-col gap-8 sm:gap-14 px-8 pb-6 pt-6 md:pt-14'>
|
|
103
103
|
<Toaster/>
|
|
104
104
|
<AuthWidget hideLogin className='hidden md:flex absolute top-4 right-4 '/>
|
|
105
105
|
<StepIndicator steps={steps} currentStep={step} className='flex gap-2 mx-auto items-center text-xxs sm:text-base' />
|
|
@@ -116,7 +116,7 @@ const PayWithCrypto: React.FC<{
|
|
|
116
116
|
})
|
|
117
117
|
}
|
|
118
118
|
} catch (err) {
|
|
119
|
-
toast(
|
|
119
|
+
toast('Please switch your wallet to the Ethereum network.')
|
|
120
120
|
return
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -161,7 +161,7 @@ const PayWithCrypto: React.FC<{
|
|
|
161
161
|
} catch (err) {
|
|
162
162
|
console.log(err)
|
|
163
163
|
// :aa TODO string table
|
|
164
|
-
toast(
|
|
164
|
+
toast('Not enough funds in your wallet')
|
|
165
165
|
}
|
|
166
166
|
})()
|
|
167
167
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/commerce",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2",
|
|
4
4
|
"description": "Library with shopping cart components.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"square": "^35.0.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@hanzo/auth": "^2.2.
|
|
42
|
-
"@hanzo/ui": "^3.0.
|
|
41
|
+
"@hanzo/auth": "^2.2.1",
|
|
42
|
+
"@hanzo/ui": "^3.0.6",
|
|
43
43
|
"@hookform/resolvers": "^3.3.4",
|
|
44
44
|
"firebase": "^10.8.0",
|
|
45
45
|
"lucide-react": "^0.307.0",
|
|
46
46
|
"mobx": "^6.12.0",
|
|
47
47
|
"mobx-react-lite": "^4.0.5",
|
|
48
48
|
"mobx-utils": "^6.0.8",
|
|
49
|
-
"next": "
|
|
49
|
+
"next": "14.1.3",
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"react-dom": "^18.2.0",
|
|
52
52
|
"react-hook-form": "7.50.1",
|