@hanzo/commerce 1.1.2 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/commerce",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Library with shopping cart components.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -9,10 +9,12 @@ import {
9
9
  } from 'next-usequerystate'
10
10
 
11
11
  import { useCommerce } from '../service/context'
12
+ import type { FacetsValue } from '../types'
12
13
 
13
14
  const PLEASE_SELECT_FACETS = 'Please select an option from each group above.'
14
15
 
15
16
  const useSyncSkuParamWithCurrentItem = (
17
+ categoryLevel: number,
16
18
  setMessage: (m: string | undefined) => void,
17
19
  setLoading?: (l: boolean) => void
18
20
  ) => {
@@ -53,10 +55,11 @@ const useSyncSkuParamWithCurrentItem = (
53
55
 
54
56
  const setCurrentCategoryFromSku = (sku: string) => {
55
57
  const toks: string[] = sku.split('-')
56
- cmmc.setFacets({
57
- 1: [toks[1]],
58
- 2: [toks[2]]
59
- })
58
+ const fv: FacetsValue = {}
59
+ for (let i = 1; i < categoryLevel; i++) {
60
+ fv[i] = [toks[i]]
61
+ }
62
+ cmmc.setFacets(fv)
60
63
  }
61
64
 
62
65
  // setCI returns true if it's a recognized sku