@hanzo/commerce 6.1.8 → 6.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/components/buy/{_to_deprecate_select-category-item-card.tsx → _to_deprecate_select-family-item-card.tsx} +3 -3
- package/components/buy/{_to_deprecate_select-category-item-panel.tsx → _to_deprecate_select-family-item-panel.tsx} +20 -20
- package/components/buy/add-to-cart-widget.tsx +2 -2
- package/components/buy/buy-card.tsx +56 -54
- package/components/buy/buy-drawer.tsx +25 -11
- package/components/buy/carousel-buy-card.tsx +261 -0
- package/components/cart/cart-panel/index.tsx +1 -1
- package/components/checkout/payment-step-form/index.tsx +1 -1
- package/components/checkout/payment-step-form/methods/card.tsx +1 -1
- package/components/checkout/payment-step-form/methods/crypto.tsx +1 -1
- package/components/checkout/shipping-step-form.tsx +1 -1
- package/components/index.ts +4 -4
- package/components/item/product-card.tsx +2 -2
- package/components/select-family/family-carousel/family-slide.tsx +36 -0
- package/components/select-family/family-carousel/index.tsx +78 -0
- package/components/{level-nodes-widget → select-family/level-nodes-widget}/index.tsx +1 -1
- package/components/{level-nodes-widget → select-family/level-nodes-widget}/node-image.tsx +1 -1
- package/components/{select → select-product}/carousel-selector.tsx +8 -8
- package/components/{select → select-product}/image-selector.tsx +3 -3
- package/components/{select → select-product}/radio-selector.tsx +3 -3
- package/index.ts +8 -1
- package/package.json +2 -4
- package/service/context.tsx +4 -4
- package/service/impls/standalone/actual-line-item.ts +9 -9
- package/service/impls/standalone/index.ts +4 -4
- package/service/impls/standalone/standalone-service.ts +39 -53
- package/types/commerce-service.ts +18 -9
- package/types/{category.ts → family.ts} +2 -2
- package/types/index.ts +1 -1
- package/types/item-selector.ts +2 -2
- package/types/product.ts +4 -7
- package/util/buy-ui-conf.ts +2 -1
- package/util/sep.ts +5 -0
- package/util/use-sync-sku-param-w-current-item.ts +9 -8
- package/components/item/item-media.tsx +0 -51
|
@@ -8,10 +8,10 @@ import { Skeleton } from '@hanzo/ui/primitives'
|
|
|
8
8
|
import type { ItemSelector, LineItem } from '../../types'
|
|
9
9
|
|
|
10
10
|
import AddToCartWidget from './add-to-cart-widget'
|
|
11
|
-
import RadioItemSelector from '../select/radio-selector'
|
|
11
|
+
import RadioItemSelector from '../select-product/radio-selector'
|
|
12
12
|
import { formatCurrencyValue } from '../../util'
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const SelectFamilyItemCard: React.FC<React.HTMLAttributes<HTMLDivElement> & ItemSelector & {
|
|
15
15
|
isLoading?: boolean
|
|
16
16
|
mobile?: boolean
|
|
17
17
|
title?: string
|
|
@@ -108,4 +108,4 @@ const SelectCategoryItemCard: React.FC<React.HTMLAttributes<HTMLDivElement> & It
|
|
|
108
108
|
)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
export default
|
|
111
|
+
export default SelectFamilyItemCard
|
|
@@ -6,17 +6,17 @@ import { observer } from 'mobx-react-lite'
|
|
|
6
6
|
import { cn } from '@hanzo/ui/util'
|
|
7
7
|
import { Skeleton } from '@hanzo/ui/primitives'
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { Family, ObsLineItemRef, LineItem } from '../../types'
|
|
10
10
|
import { formatCurrencyValue } from '../../util'
|
|
11
11
|
import { Icons } from '../Icons'
|
|
12
12
|
|
|
13
13
|
import AddToCartWidget from './add-to-cart-widget'
|
|
14
|
-
import RadioItemSelector from '../select/radio-selector'
|
|
14
|
+
import RadioItemSelector from '../select-product/radio-selector'
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const SelectFamilyItemPanel: React.FC<
|
|
17
17
|
React.HTMLAttributes<HTMLDivElement> &
|
|
18
18
|
{
|
|
19
|
-
|
|
19
|
+
family: Family
|
|
20
20
|
selectedItemRef: ObsLineItemRef
|
|
21
21
|
selectSku: (sku: string) => void
|
|
22
22
|
showQuantity?: boolean
|
|
@@ -24,7 +24,7 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
24
24
|
mobile?: boolean
|
|
25
25
|
}
|
|
26
26
|
> = /* NOT observer */ ({
|
|
27
|
-
|
|
27
|
+
family,
|
|
28
28
|
selectedItemRef,
|
|
29
29
|
selectSku,
|
|
30
30
|
className,
|
|
@@ -34,9 +34,9 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
34
34
|
...props
|
|
35
35
|
}) => {
|
|
36
36
|
|
|
37
|
-
const soleOption =
|
|
37
|
+
const soleOption = family.products.length === 1
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const FamilyImage: React.FC<{ className?: string }> = ({ className = '' }) => {
|
|
40
40
|
|
|
41
41
|
if (isLoading) {
|
|
42
42
|
// deliberately not Skeleton to have a better overall pulse effect.
|
|
@@ -46,16 +46,16 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
46
46
|
className)} />
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
return
|
|
49
|
+
return family.img ? (
|
|
50
50
|
// TODO: Why so many div's?
|
|
51
51
|
<div className={cn('flex flex-col justify-start', className)}>
|
|
52
52
|
<div className={cn('w-full border rounded-xl p-6 ')}>
|
|
53
53
|
<div className={cn('w-full aspect-square relative')}>
|
|
54
54
|
<Image
|
|
55
|
-
src={
|
|
55
|
+
src={family.img.src}
|
|
56
56
|
fill
|
|
57
57
|
sizes="(max-width: 480px) 100vw, (max-width: 768px) 50vw, (max-width: 1200px) 50vw, 20vw"
|
|
58
|
-
alt={
|
|
58
|
+
alt={family.title}
|
|
59
59
|
className=''
|
|
60
60
|
loading='lazy'
|
|
61
61
|
style={{ objectFit: 'contain' }} />
|
|
@@ -77,7 +77,7 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
77
77
|
const AvailableAmounts: React.FC<{ className?: string }> = observer(({ className = '' }) => {
|
|
78
78
|
|
|
79
79
|
if (soleOption) return null
|
|
80
|
-
const mobilePicker = (mobile &&
|
|
80
|
+
const mobilePicker = (mobile && family.products.length > 8)
|
|
81
81
|
|
|
82
82
|
return isLoading ? (
|
|
83
83
|
<Skeleton className={'min-h-[120px] w-pr-60 mx-auto ' + className} />
|
|
@@ -92,7 +92,7 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
92
92
|
<div className={'h-[1px] bg-muted-3 ' + (mobilePicker ? 'w-pr-55' : 'w-pr-60') } />
|
|
93
93
|
</div>
|
|
94
94
|
<RadioItemSelector
|
|
95
|
-
items={
|
|
95
|
+
items={family.products as LineItem[]}
|
|
96
96
|
selectedItemRef={selectedItemRef}
|
|
97
97
|
selectSku={selectSku}
|
|
98
98
|
showQuantity={showQuantity}
|
|
@@ -119,10 +119,10 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
119
119
|
|
|
120
120
|
<div className={cn('flex flex-col justify-start items-center', className)}>
|
|
121
121
|
<h3 className='text-base md:text-lg lg:text-2xl font-heading text-center'>
|
|
122
|
-
{
|
|
123
|
-
<span>{
|
|
122
|
+
{family.parentTitle && (
|
|
123
|
+
<span>{family.parentTitle}<br className='md:hidden' /><span className='xs:hidden md:inline '>, </span></span>
|
|
124
124
|
)}
|
|
125
|
-
<span>{
|
|
125
|
+
<span>{family.title}</span>
|
|
126
126
|
</h3>
|
|
127
127
|
{selectedItemRef.item?.sku ? (
|
|
128
128
|
<h6 className='text-center font-semibold'>
|
|
@@ -136,7 +136,7 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
136
136
|
isLoading ? (
|
|
137
137
|
<Skeleton className={'min-h-20 w-full grow mx-auto ' + className} />
|
|
138
138
|
) : (
|
|
139
|
-
<p className={cn('text-base lg:text-lg mb-6 xs:mb-0', className)}>{
|
|
139
|
+
<p className={cn('text-base lg:text-lg mb-6 xs:mb-0', className)}>{family.desc}</p>
|
|
140
140
|
)
|
|
141
141
|
)
|
|
142
142
|
|
|
@@ -151,7 +151,7 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
151
151
|
>
|
|
152
152
|
<div /* id='CV_TITLE_AND_IMAGE_ROW' */ className='flex flex-row justify-between items-start w-full'>
|
|
153
153
|
{isLoading ? ( <Skeleton className={'min-h-30 w-full '} /> ) : (<>
|
|
154
|
-
<
|
|
154
|
+
<FamilyImage className='w-pr-33' />
|
|
155
155
|
<TitleArea className='grow pt-3 mb-0' />
|
|
156
156
|
</>)}
|
|
157
157
|
</div>
|
|
@@ -163,11 +163,11 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
163
163
|
<div /* id='CV_OUTERMOST' */>
|
|
164
164
|
<div /* id='CV_OUTER' */ className={cn('w-full flex flex-row justify-between items-stretch gap-6 sm:gap-4', className)} {...props}>
|
|
165
165
|
<div /* id='CV_IMAGE_COL_SEP' */ className={'relative ' + (!isLoading ? 'md:hidden sm:min-w-[185px] xl:flex xl:w-pr-40' : '')}>
|
|
166
|
-
<
|
|
166
|
+
<FamilyImage className='w-full' />
|
|
167
167
|
</div>
|
|
168
168
|
<div /* id='CV_CONTENT_COL */ className={'flex flex-col xl:w-pr-60 justify-center ' + (soleOption ? '' : 'gap-6') }>
|
|
169
169
|
<div /* id='CV_MD_IMAGE_AND_TITLE */ className='hidden md:flex xl:hidden flex-row gap-x-3'>
|
|
170
|
-
<
|
|
170
|
+
<FamilyImage className='min-w-pr-30' />
|
|
171
171
|
<TitleArea className='grow' />
|
|
172
172
|
</div>
|
|
173
173
|
|
|
@@ -190,4 +190,4 @@ const SelectCategoryItemPanel: React.FC<
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
|
|
193
|
-
export default
|
|
193
|
+
export default SelectFamilyItemPanel
|
|
@@ -56,7 +56,7 @@ const AddToCartWidget: React.FC<{
|
|
|
56
56
|
items: [{
|
|
57
57
|
item_id: item.sku,
|
|
58
58
|
item_name: item.title,
|
|
59
|
-
item_category: item.
|
|
59
|
+
item_category: item.familyId,
|
|
60
60
|
price: item.price,
|
|
61
61
|
quantity: item.quantity
|
|
62
62
|
}],
|
|
@@ -93,7 +93,7 @@ const AddToCartWidget: React.FC<{
|
|
|
93
93
|
items: [{
|
|
94
94
|
item_id: item.sku,
|
|
95
95
|
item_name: item.title,
|
|
96
|
-
item_category: item.
|
|
96
|
+
item_category: item.familyId,
|
|
97
97
|
price: item.price,
|
|
98
98
|
quantity: item.quantity
|
|
99
99
|
}],
|
|
@@ -4,23 +4,23 @@ import { reaction, type IReactionDisposer } from 'mobx'
|
|
|
4
4
|
import { observer } from 'mobx-react-lite'
|
|
5
5
|
|
|
6
6
|
import { cn } from '@hanzo/ui/util'
|
|
7
|
+
import { ApplyTypography, MediaStack } from '@hanzo/ui/primitives'
|
|
7
8
|
|
|
8
9
|
import type {
|
|
9
10
|
SelectedPaths,
|
|
10
11
|
ItemSelectorProps,
|
|
11
12
|
ItemSelectorCompProps,
|
|
12
13
|
LineItem,
|
|
13
|
-
|
|
14
|
+
Family,
|
|
14
15
|
ProductTreeNode,
|
|
15
16
|
} from '../../types'
|
|
16
17
|
|
|
17
18
|
import { useCommerce } from '../../service/context'
|
|
19
|
+
import SEP from '../../util/sep'
|
|
18
20
|
import { getFacetValuesMutator, ObsStringMutator } from '../../util'
|
|
19
21
|
|
|
20
|
-
import LevelNodesWidget from '../level-nodes-widget'
|
|
22
|
+
import LevelNodesWidget from '../select-family/level-nodes-widget'
|
|
21
23
|
import AddToCartWidget from './add-to-cart-widget'
|
|
22
|
-
import ItemMedia from '../item/item-media'
|
|
23
|
-
import { ApplyTypography } from '@hanzo/ui/primitives'
|
|
24
24
|
|
|
25
25
|
const BuyCard: React.FC<{
|
|
26
26
|
skuPath: string
|
|
@@ -36,20 +36,20 @@ const BuyCard: React.FC<{
|
|
|
36
36
|
scrollHeightClx?: string
|
|
37
37
|
|
|
38
38
|
clx?: string
|
|
39
|
-
|
|
39
|
+
famWidgetClx?: string
|
|
40
40
|
addWidgetClx?: string
|
|
41
41
|
|
|
42
42
|
selector: ComponentType<ItemSelectorProps>
|
|
43
43
|
selectorProps?: ItemSelectorCompProps
|
|
44
44
|
|
|
45
|
-
/** Show all items from all sibling
|
|
46
|
-
* If skuPath defines a
|
|
45
|
+
/** Show all items from all sibling families
|
|
46
|
+
* If skuPath defines a Family, the first of it's items will
|
|
47
47
|
* be selected. The facet widget will just select a the first
|
|
48
|
-
* item in the chosen
|
|
48
|
+
* item in the chosen Family without changings the overall set
|
|
49
49
|
* of choices. */
|
|
50
50
|
allVariants?: boolean
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
familyTabAs?: 'image' | 'label' | 'image-and-label'
|
|
53
53
|
showItemMedia?: boolean
|
|
54
54
|
|
|
55
55
|
onQuantityChanged?: (sku: string, oldV: number, newV: number) => void
|
|
@@ -59,7 +59,7 @@ const BuyCard: React.FC<{
|
|
|
59
59
|
scrollAfter=5,
|
|
60
60
|
scrollHeightClx='h-[80vh]',
|
|
61
61
|
clx='',
|
|
62
|
-
|
|
62
|
+
famWidgetClx='',
|
|
63
63
|
addWidgetClx='',
|
|
64
64
|
selector: Selector,
|
|
65
65
|
selectorProps={
|
|
@@ -68,7 +68,7 @@ const BuyCard: React.FC<{
|
|
|
68
68
|
itemClx: '',
|
|
69
69
|
ext: {}
|
|
70
70
|
},
|
|
71
|
-
|
|
71
|
+
familyTabAs='image-and-label',
|
|
72
72
|
showItemMedia=true,
|
|
73
73
|
allVariants=false,
|
|
74
74
|
mobile=false,
|
|
@@ -78,19 +78,19 @@ const BuyCard: React.FC<{
|
|
|
78
78
|
const cmmc = useCommerce()
|
|
79
79
|
const inst = useRef<{
|
|
80
80
|
level: number,
|
|
81
|
-
|
|
81
|
+
requestedFamily : Family | undefined
|
|
82
82
|
requestedNode: ProductTreeNode | undefined
|
|
83
|
-
|
|
83
|
+
currentFamily: ObsStringMutator
|
|
84
84
|
disposers: IReactionDisposer[]
|
|
85
85
|
} | undefined>(undefined)
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
useEffect(() => {
|
|
89
89
|
|
|
90
|
-
let
|
|
91
|
-
let requestedNode =
|
|
92
|
-
let
|
|
93
|
-
const toks = skuPath.split(
|
|
90
|
+
let requestedFamily = cmmc.getFamily(skuPath)
|
|
91
|
+
let requestedNode = requestedFamily ? undefined : cmmc.getNodeAtPath(skuPath)
|
|
92
|
+
let initialFamily = undefined
|
|
93
|
+
const toks = skuPath.split(SEP.TOK)
|
|
94
94
|
const level = toks.length - 1
|
|
95
95
|
if (level === 0) {
|
|
96
96
|
throw new Error('BuyCard.useEffect(): must specify at least at least one Level in skuPath!')
|
|
@@ -99,14 +99,14 @@ const BuyCard: React.FC<{
|
|
|
99
99
|
for (let l = 1; l <= level; l++ ) {
|
|
100
100
|
paths[l] = [toks[l]]
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
102
|
+
if (requestedFamily) {
|
|
103
103
|
if (allVariants && level >= 2) {
|
|
104
|
-
// select all siblings of
|
|
104
|
+
// select all siblings of requestedFamily.
|
|
105
105
|
// ie, go one level back
|
|
106
106
|
delete paths[level]
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
requestedNode = cmmc.getNodeAtPath(toks.slice(0, -1).join(
|
|
107
|
+
initialFamily = requestedFamily
|
|
108
|
+
requestedFamily = undefined
|
|
109
|
+
requestedNode = cmmc.getNodeAtPath(toks.slice(0, -1).join(SEP.TOK))
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
@@ -114,35 +114,37 @@ const BuyCard: React.FC<{
|
|
|
114
114
|
if (allVariants) {
|
|
115
115
|
paths[level + 1] = [...requestedNode!.subNodes!.map((node) => (node.skuToken))]
|
|
116
116
|
}
|
|
117
|
-
// Actually select the the first
|
|
117
|
+
// Actually select the the first fam at the fam level,
|
|
118
118
|
else {
|
|
119
119
|
paths[level + 1] = [requestedNode!.subNodes![0].skuToken]
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
cmmc.setCurrentItem(
|
|
126
|
-
const
|
|
123
|
+
const selectedFams = cmmc.selectPaths(paths)
|
|
124
|
+
initialFamily = initialFamily ? initialFamily : (requestedFamily ? requestedFamily : selectedFams[0])
|
|
125
|
+
cmmc.setCurrentItem(initialFamily.products[0].sku)
|
|
126
|
+
const currentFamily = new ObsStringMutator(initialFamily!.id.split(SEP.TOK).pop()!)
|
|
127
127
|
|
|
128
128
|
inst.current = {
|
|
129
129
|
level,
|
|
130
|
-
|
|
130
|
+
requestedFamily,
|
|
131
131
|
requestedNode,
|
|
132
|
-
|
|
132
|
+
currentFamily,
|
|
133
133
|
disposers: []
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
if (!allVariants) {
|
|
137
137
|
inst.current?.disposers.push(reaction(
|
|
138
138
|
() => {
|
|
139
|
-
const
|
|
140
|
-
return (
|
|
139
|
+
const fams = cmmc.selectedFamilies
|
|
140
|
+
return (fams.length > 0) ? fams[0].id : undefined
|
|
141
141
|
},
|
|
142
|
-
(
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
145
|
-
|
|
142
|
+
(famId) => {
|
|
143
|
+
if (famId && famId !== cmmc.currentItem?.familyId) {
|
|
144
|
+
const fam = cmmc.getFamily(famId)
|
|
145
|
+
if (fam) {
|
|
146
|
+
cmmc.setCurrentItem(fam.products[0].sku)
|
|
147
|
+
}
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
))
|
|
@@ -154,11 +156,11 @@ const BuyCard: React.FC<{
|
|
|
154
156
|
|
|
155
157
|
}, [])
|
|
156
158
|
|
|
157
|
-
const
|
|
158
|
-
if (inst.current?.
|
|
159
|
-
inst.current?.
|
|
159
|
+
const setFamilyPath = (pathValue: string | null) => {
|
|
160
|
+
if (inst.current?.currentFamily.get() !== pathValue) {
|
|
161
|
+
inst.current?.currentFamily.set(pathValue)
|
|
160
162
|
}
|
|
161
|
-
const found = cmmc.selectedItems.find((item) => (item.
|
|
163
|
+
const found = cmmc.selectedItems.find((item) => (item.familyId.endsWith(pathValue!)))
|
|
162
164
|
if (found) {
|
|
163
165
|
cmmc.setCurrentItem(found.sku)
|
|
164
166
|
}
|
|
@@ -166,16 +168,16 @@ const BuyCard: React.FC<{
|
|
|
166
168
|
|
|
167
169
|
const selectSku = (sku: string) => {
|
|
168
170
|
cmmc.setCurrentItem(sku)
|
|
169
|
-
const pathValue = cmmc.currentItem?.
|
|
170
|
-
if (pathValue !== inst.current?.
|
|
171
|
-
inst.current?.
|
|
171
|
+
const pathValue = cmmc.currentItem?.familyId.split(SEP.TOK).pop()!
|
|
172
|
+
if (pathValue !== inst.current?.currentFamily.get()) {
|
|
173
|
+
inst.current?.currentFamily.set(pathValue)
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
const
|
|
177
|
+
const famTitle = inst.current?.requestedFamily ? inst.current.requestedFamily.title : cmmc.selectedFamilies?.[0]?.title
|
|
176
178
|
|
|
177
179
|
const itemsToShow = (!cmmc.hasSelection) ? undefined :
|
|
178
|
-
allVariants ? cmmc.selectedItems : cmmc.
|
|
180
|
+
allVariants ? cmmc.selectedItems : cmmc.selectedFamilies[0].products as LineItem[]
|
|
179
181
|
|
|
180
182
|
|
|
181
183
|
const TitleArea: React.FC<{
|
|
@@ -212,13 +214,13 @@ const BuyCard: React.FC<{
|
|
|
212
214
|
'grid gap-0 align-stretch justify-normal ' + `grid-cols-${inst.current.requestedNode.subNodes!.length}`,
|
|
213
215
|
'border-b-2 rounded-lg border-level-3 mb-4 -mr-2 -ml-2 max-w-[460px] h-10', // height is needed for iPhone bug
|
|
214
216
|
(scroll ? 'shrink-0' : ''),
|
|
215
|
-
|
|
217
|
+
famWidgetClx
|
|
216
218
|
)}
|
|
217
219
|
mobile={mobile}
|
|
218
220
|
mutator={allVariants ?
|
|
219
221
|
{
|
|
220
|
-
get: () => (inst.current!.
|
|
221
|
-
set:
|
|
222
|
+
get: () => (inst.current!.currentFamily.s),
|
|
223
|
+
set: setFamilyPath
|
|
222
224
|
}
|
|
223
225
|
:
|
|
224
226
|
getFacetValuesMutator(inst.current.level + 1, cmmc)
|
|
@@ -229,14 +231,14 @@ const BuyCard: React.FC<{
|
|
|
229
231
|
'!border-level-3'
|
|
230
232
|
}
|
|
231
233
|
levelNodes={inst.current.requestedNode.subNodes!}
|
|
232
|
-
show={
|
|
234
|
+
show={familyTabAs}
|
|
233
235
|
/>
|
|
234
236
|
</>)}
|
|
235
|
-
{!inst.current?.requestedNode &&
|
|
236
|
-
<TitleArea title={
|
|
237
|
+
{!inst.current?.requestedNode && famTitle && (
|
|
238
|
+
<TitleArea title={famTitle} clx=''/>
|
|
237
239
|
)}
|
|
238
240
|
{(cmmc.currentItem && showItemMedia) && (
|
|
239
|
-
<
|
|
241
|
+
<MediaStack media={cmmc.currentItem} constrainTo={{w: 200, h: 200}} clx={(scroll ? 'shrink-0' : '')}/>
|
|
240
242
|
)}
|
|
241
243
|
{itemsToShow && (
|
|
242
244
|
<Selector
|
|
@@ -245,10 +247,10 @@ const BuyCard: React.FC<{
|
|
|
245
247
|
selectSku={selectSku}
|
|
246
248
|
{...selectorProps}
|
|
247
249
|
scrollList={scroll}
|
|
248
|
-
|
|
249
|
-
selectorProps.
|
|
250
|
+
showFamily={selectorProps.showFamily ?
|
|
251
|
+
selectorProps.showFamily
|
|
250
252
|
:
|
|
251
|
-
(allVariants && !inst.current?.
|
|
253
|
+
(allVariants && !inst.current?.requestedFamily)
|
|
252
254
|
}
|
|
253
255
|
/>
|
|
254
256
|
)}
|
|
@@ -14,10 +14,12 @@ import { cn } from '@hanzo/ui/util'
|
|
|
14
14
|
|
|
15
15
|
import { getUISpecFromPath } from '../../util'
|
|
16
16
|
|
|
17
|
-
import BuyCard from './buy-card'
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
import
|
|
17
|
+
//import BuyCard from './buy-card'
|
|
18
|
+
import FamilyCar from '../select-family/family-carousel'
|
|
19
|
+
|
|
20
|
+
import RadioItemSelector from '../select-product/radio-selector'
|
|
21
|
+
import ImageItemSelector from '../select-product/image-selector'
|
|
22
|
+
import CarouselItemSelector from '../select-product/carousel-selector'
|
|
21
23
|
|
|
22
24
|
const BuyDrawer: React.FC<{
|
|
23
25
|
skuPath: string
|
|
@@ -59,18 +61,15 @@ const BuyDrawer: React.FC<{
|
|
|
59
61
|
<DrawerContent
|
|
60
62
|
className={cn('rounded-t-xl mt-6 pb-12 h-auto min-h-[35vh] pt-6 md:max-w-[550px] md:mx-auto', drawerClx)}
|
|
61
63
|
>
|
|
62
|
-
|
|
64
|
+
|
|
65
|
+
<FamilyCar
|
|
63
66
|
skuPath={skuPath}
|
|
64
|
-
scrollAfter={spec.selector === 'carousel' ? 999 : undefined}
|
|
65
67
|
mobile={mobile}
|
|
66
68
|
onQuantityChanged={onQuantityChanged}
|
|
67
69
|
clx={cn('w-full', cardClx)}
|
|
68
|
-
|
|
69
|
-
selectorProps={{soleItemClx:'mb-3'}}
|
|
70
|
-
showItemMedia={spec.selector !== 'carousel'}
|
|
71
|
-
categoryTabAs='label'
|
|
72
|
-
allVariants={spec.allVariants}
|
|
70
|
+
|
|
73
71
|
/>
|
|
72
|
+
|
|
74
73
|
<Button
|
|
75
74
|
variant='ghost'
|
|
76
75
|
size='icon'
|
|
@@ -86,3 +85,18 @@ const BuyDrawer: React.FC<{
|
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
export default BuyDrawer
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
<BuyCard
|
|
91
|
+
skuPath={skuPath}
|
|
92
|
+
scrollAfter={spec.selector === 'carousel' ? 999 : undefined}
|
|
93
|
+
mobile={mobile}
|
|
94
|
+
onQuantityChanged={onQuantityChanged}
|
|
95
|
+
clx={cn('w-full', cardClx)}
|
|
96
|
+
selector={selector}
|
|
97
|
+
selectorProps={{soleItemClx:'mb-3'}}
|
|
98
|
+
showItemMedia={spec.selector !== 'carousel'}
|
|
99
|
+
familyTabAs='label'
|
|
100
|
+
allVariants={spec.allVariants}
|
|
101
|
+
/>
|
|
102
|
+
*/
|