@hanzo/commerce 6.2.2 → 6.2.4
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, { useRef, useEffect, type ComponentType } from 'react'
|
|
2
|
+
import React, { useRef, useEffect, type ComponentType, useState } from 'react'
|
|
3
3
|
import { observer } from 'mobx-react-lite'
|
|
4
4
|
|
|
5
5
|
import { cn } from '@hanzo/ui/util'
|
|
@@ -16,8 +16,7 @@ import type {
|
|
|
16
16
|
} from '../../types'
|
|
17
17
|
|
|
18
18
|
import { useCommerce } from '../../service/context'
|
|
19
|
-
import
|
|
20
|
-
import { ObsStringMutator, getSelectionUISpecifier } from '../../util'
|
|
19
|
+
import { getSelectionUISpecifier } from '../../util'
|
|
21
20
|
|
|
22
21
|
import { CarouselItemSelector, ButtonItemSelector } from '../item-selector'
|
|
23
22
|
import FamilyCarousel from '../select-family/family-carousel'
|
|
@@ -63,6 +62,8 @@ const CarouselBuyCard: React.FC<{
|
|
|
63
62
|
}
|
|
64
63
|
} | undefined>(undefined)
|
|
65
64
|
|
|
65
|
+
const [changeMeToRerender, setChangeMeToRerender] = useState<boolean>(false)
|
|
66
|
+
|
|
66
67
|
useEffect(() => {
|
|
67
68
|
|
|
68
69
|
const peek = cmmc.peek(skuPath)
|
|
@@ -83,18 +84,17 @@ const CarouselBuyCard: React.FC<{
|
|
|
83
84
|
|
|
84
85
|
if (peek.role === 'single-family') {
|
|
85
86
|
|
|
86
|
-
const singleSpec = uiSpec.singleFamily
|
|
87
|
-
const Selector: ComponentType<ItemSelectorProps> =
|
|
88
|
-
(singleSpec?.type === 'buttons') ? ButtonItemSelector : CarouselItemSelector
|
|
89
|
-
const selOptions = singleSpec?.options
|
|
90
87
|
const items = peek.family!.products as LineItem[]
|
|
88
|
+
const Selector: ComponentType<ItemSelectorProps> =
|
|
89
|
+
(uiSpec.singleFamily?.type === 'buttons') ? ButtonItemSelector : CarouselItemSelector
|
|
90
|
+
const selOptions = uiSpec.singleFamily?.options
|
|
91
91
|
|
|
92
92
|
r.current.single = {
|
|
93
93
|
items,
|
|
94
94
|
Selector,
|
|
95
95
|
selOptions,
|
|
96
96
|
scrollable: !!(items.length > SCROLL.scrollAfter),
|
|
97
|
-
showItemMedia:
|
|
97
|
+
showItemMedia: uiSpec.singleFamily?.type !== 'carousel'
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
const currItem = peek.item ?? peek.family!.products[0]
|
|
@@ -106,7 +106,11 @@ const CarouselBuyCard: React.FC<{
|
|
|
106
106
|
cmmc.setCurrentItem(currItem.sku)
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
// Must do this since Dialog code takes this comp out of the React shadow DOM
|
|
110
|
+
// (only in prod apparently.)
|
|
111
|
+
setChangeMeToRerender(!changeMeToRerender)
|
|
112
|
+
|
|
113
|
+
}, [skuPath])
|
|
110
114
|
|
|
111
115
|
const TitleArea: React.FC<{
|
|
112
116
|
title: string
|
|
@@ -200,13 +204,4 @@ const CarouselBuyCard: React.FC<{
|
|
|
200
204
|
)
|
|
201
205
|
})
|
|
202
206
|
|
|
203
|
-
/* Above family carousel
|
|
204
|
-
<TitleArea
|
|
205
|
-
title={r.current?.node.label ?? ''}
|
|
206
|
-
byline={r.current?.node.subNodesLabel}
|
|
207
|
-
clx={'mb-2 '}
|
|
208
|
-
bylineClx='!text-center font-bold text-muted mt-3'
|
|
209
|
-
/>
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
207
|
export default CarouselBuyCard
|
|
@@ -83,7 +83,7 @@ const CartPanel: React.FC<PropsWithChildren & {
|
|
|
83
83
|
|
|
84
84
|
const Main: React.FC = observer(() => (<>
|
|
85
85
|
{cmmc.cartEmpty ? (
|
|
86
|
-
<p className={cn('text-center
|
|
86
|
+
<p className={cn('text-center my-3', noItemsClx)}>No items</p>
|
|
87
87
|
) : (<>
|
|
88
88
|
{cmmc.cartItems.map((item) => (
|
|
89
89
|
<CartLineItem
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/commerce",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.4",
|
|
4
4
|
"description": "e-commerce framework.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"square": "^35.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@hanzo/auth": "^2.3.
|
|
44
|
-
"@hanzo/ui": "^3.5.
|
|
43
|
+
"@hanzo/auth": "^2.3.5",
|
|
44
|
+
"@hanzo/ui": "^3.5.3",
|
|
45
45
|
"@hookform/resolvers": "^3.3.4",
|
|
46
46
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
47
47
|
"firebase": "^10.8.0",
|