@hanzo/commerce 7.0.0 → 7.0.1
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/carousel-buy-card.tsx +1 -1
- package/components/buy/multi-family/all-variants-carousel.tsx +4 -2
- package/components/cart/cart-panel/cart-line-item.tsx +1 -1
- package/context/commerce-ui.ts +6 -8
- package/context/index.tsx +5 -2
- package/index.ts +1 -0
- package/package.json +1 -1
- package/util/line-item-ref.ts +1 -0
|
@@ -203,7 +203,7 @@ const CarouselBuyCard: React.FC<{
|
|
|
203
203
|
<div className={clx}>
|
|
204
204
|
<AddToCartWidget
|
|
205
205
|
item={cmmc.currentItem}
|
|
206
|
-
registerAdd={
|
|
206
|
+
registerAdd={true}
|
|
207
207
|
onQuantityChanged={onQuantityChanged}
|
|
208
208
|
variant={cmmc.cartEmpty ? 'primary' : 'outline'}
|
|
209
209
|
className={addBtnClx}
|
|
@@ -242,8 +242,10 @@ const AllVariantsCarousel: React.FC<MultiFamilySelectorProps> = ({
|
|
|
242
242
|
</CarouselItem>
|
|
243
243
|
))}
|
|
244
244
|
</CarouselContent>
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
{r.current.items.length > 1 && (<>
|
|
246
|
+
<CarouselPrevious className='left-1'/>
|
|
247
|
+
<CarouselNext className='right-1'/>
|
|
248
|
+
</>)}
|
|
247
249
|
</Carousel>
|
|
248
250
|
)}
|
|
249
251
|
<ItemInfo labelClx='!text-base font-medium'/>
|
|
@@ -61,7 +61,7 @@ const CartLineItem: React.FC<{
|
|
|
61
61
|
</div>
|
|
62
62
|
<div className='flex flex-row items-center justify-between w-full'>
|
|
63
63
|
<div className='flex flex-row items-center'>
|
|
64
|
-
<AddToCartWidget variant='minimal' item={item} buttonClx='!h-8 md:!h-6' />
|
|
64
|
+
<AddToCartWidget variant='minimal' registerAdd={false} item={item} buttonClx='!h-8 md:!h-6' />
|
|
65
65
|
{item.quantity > 1 && (<span className='pl-2.5'>{'@' + formatCurrencyValue(item.price)}</span>)}
|
|
66
66
|
</div>
|
|
67
67
|
<div className='flex flex-row gap-1 items-center justify-end'>
|
package/context/commerce-ui.ts
CHANGED
|
@@ -4,22 +4,20 @@ import {
|
|
|
4
4
|
makeObservable,
|
|
5
5
|
observable,
|
|
6
6
|
} from 'mobx'
|
|
7
|
-
import type { CommerceService, LineItem } from '../types'
|
|
7
|
+
import type { CommerceService, LineItem, ObsLineItemRef } from '../types'
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
interface CommerceUI {
|
|
10
|
+
interface CommerceUI extends ObsLineItemRef {
|
|
12
11
|
showBuyOptions: (skuPath: string) => void
|
|
13
12
|
hideBuyOptions: () => void
|
|
14
13
|
get buyOptionsSkuPath(): string | undefined
|
|
15
14
|
|
|
16
|
-
itemQuantityChanged(item: LineItem, val: number, prevVal: number): void
|
|
17
|
-
get activeItem(): LineItem | undefined
|
|
15
|
+
itemQuantityChanged(item: LineItem, val: number, prevVal: number): void
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
class CommerceUIStore implements CommerceUI {
|
|
21
19
|
|
|
22
|
-
static readonly TIMEOUT =
|
|
20
|
+
static readonly TIMEOUT = 1500
|
|
23
21
|
_buyOptionsSkuPath: string | undefined = undefined
|
|
24
22
|
_paused: boolean = false
|
|
25
23
|
_activeItem: LineItem | undefined = undefined
|
|
@@ -36,7 +34,7 @@ class CommerceUIStore implements CommerceUI {
|
|
|
36
34
|
buyOptionsSkuPath: computed,
|
|
37
35
|
itemQuantityChanged: action,
|
|
38
36
|
tick: action,
|
|
39
|
-
|
|
37
|
+
item: computed
|
|
40
38
|
})
|
|
41
39
|
}
|
|
42
40
|
|
|
@@ -92,7 +90,7 @@ class CommerceUIStore implements CommerceUI {
|
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
get
|
|
93
|
+
get item(): LineItem | undefined {
|
|
96
94
|
return this._activeItem
|
|
97
95
|
}
|
|
98
96
|
}
|
package/context/index.tsx
CHANGED
|
@@ -37,19 +37,22 @@ const CommerceProvider: React.FC<PropsWithChildren & {
|
|
|
37
37
|
rootNode: CategoryNode
|
|
38
38
|
options?: ServiceOptions
|
|
39
39
|
uiSpecs?: Record<string, SelectionUISpecifier>
|
|
40
|
+
DEBUG_NO_TICK?: boolean
|
|
40
41
|
}> = ({
|
|
41
42
|
children,
|
|
42
43
|
families,
|
|
43
44
|
rootNode,
|
|
44
45
|
options,
|
|
45
|
-
uiSpecs
|
|
46
|
+
uiSpecs,
|
|
47
|
+
DEBUG_NO_TICK=false
|
|
46
48
|
}) => {
|
|
47
49
|
|
|
48
50
|
useEffect(() => {
|
|
51
|
+
if (DEBUG_NO_TICK) return
|
|
49
52
|
const intervalId = setInterval(() => {
|
|
50
53
|
(valueRef.current.ui as CommerceUIStore).tick()
|
|
51
54
|
}, 250)
|
|
52
|
-
return () => {clearInterval(intervalId)}
|
|
55
|
+
return () => { clearInterval(intervalId) }
|
|
53
56
|
}, [])
|
|
54
57
|
|
|
55
58
|
// TODO: Inject Promo fixture here from siteDef
|
package/index.ts
CHANGED
package/package.json
CHANGED