@hanzo/commerce 6.2.2 → 6.2.3

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'
@@ -63,6 +63,8 @@ const CarouselBuyCard: React.FC<{
63
63
  }
64
64
  } | undefined>(undefined)
65
65
 
66
+ const [changeMeToRerender, setChangeMeToRerender] = useState<boolean>(false)
67
+
66
68
  useEffect(() => {
67
69
 
68
70
  const peek = cmmc.peek(skuPath)
@@ -83,18 +85,17 @@ const CarouselBuyCard: React.FC<{
83
85
 
84
86
  if (peek.role === 'single-family') {
85
87
 
86
- const singleSpec = uiSpec.singleFamily
87
- const Selector: ComponentType<ItemSelectorProps> =
88
- (singleSpec?.type === 'buttons') ? ButtonItemSelector : CarouselItemSelector
89
- const selOptions = singleSpec?.options
90
88
  const items = peek.family!.products as LineItem[]
89
+ const Selector: ComponentType<ItemSelectorProps> =
90
+ (uiSpec.singleFamily?.type === 'buttons') ? ButtonItemSelector : CarouselItemSelector
91
+ const selOptions = uiSpec.singleFamily?.options
91
92
 
92
93
  r.current.single = {
93
94
  items,
94
95
  Selector,
95
96
  selOptions,
96
97
  scrollable: !!(items.length > SCROLL.scrollAfter),
97
- showItemMedia: singleSpec?.type !== 'carousel'
98
+ showItemMedia: uiSpec.singleFamily?.type !== 'carousel'
98
99
  }
99
100
 
100
101
  const currItem = peek.item ?? peek.family!.products[0]
@@ -106,7 +107,11 @@ const CarouselBuyCard: React.FC<{
106
107
  cmmc.setCurrentItem(currItem.sku)
107
108
  }
108
109
 
109
- }, [])
110
+ // Must do this since Dialog code takes this comp out of the React shadow DOM
111
+ // (only in prod apparently.)
112
+ setChangeMeToRerender(!changeMeToRerender)
113
+
114
+ }, [skuPath])
110
115
 
111
116
  const TitleArea: React.FC<{
112
117
  title: string
@@ -200,13 +205,4 @@ const CarouselBuyCard: React.FC<{
200
205
  )
201
206
  })
202
207
 
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
208
  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 mt-4', noItemsClx)}>No items in cart</p>
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.2",
3
+ "version": "6.2.3",
4
4
  "description": "e-commerce framework.",
5
5
  "type": "module",
6
6
  "publishConfig": {