@graphcommerce/algolia-search 6.2.0-canary.76 → 6.2.0-canary.78

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @graphcommerce/algolia-search
2
2
 
3
+ ## 6.2.0-canary.78
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1988](https://github.com/graphcommerce-org/graphcommerce/pull/1988) [`af8e0d176`](https://github.com/graphcommerce-org/graphcommerce/commit/af8e0d176af8197a0c13b9a29b438cb54cc29ce4) - Multi website with multiple duplicates locales support. Use `en-us-website1`, `en-us-website2` as the locale declaration. ([@hnsr](https://github.com/hnsr))
8
+
9
+ ## 6.2.0-canary.77
10
+
3
11
  ## 6.2.0-canary.76
4
12
 
5
13
  ## 6.2.0-canary.75
@@ -1,8 +1,9 @@
1
1
  import { storefrontConfig } from '@graphcommerce/next-ui'
2
- import { i18n } from '@lingui/core'
2
+ import { useRouter } from 'next/router'
3
3
 
4
4
  export function useAlgoliaSearchIndexConfig(suffix: string) {
5
- return storefrontConfig(i18n.locale)?.algoliaSearchIndexConfig.find((ai) =>
5
+ const { locale } = useRouter()
6
+ return storefrontConfig(locale)?.algoliaSearchIndexConfig.find((ai) =>
6
7
  ai.searchIndex.includes(suffix),
7
8
  )
8
9
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/algolia-search",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.2.0-canary.76",
5
+ "version": "6.2.0-canary.78",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,20 +12,20 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "6.2.0-canary.76",
16
- "@graphcommerce/next-config": "^6.2.0-canary.76",
17
- "@graphcommerce/prettier-config-pwa": "6.2.0-canary.76",
18
- "@graphcommerce/typescript-config-pwa": "6.2.0-canary.76"
15
+ "@graphcommerce/eslint-config-pwa": "6.2.0-canary.78",
16
+ "@graphcommerce/next-config": "^6.2.0-canary.78",
17
+ "@graphcommerce/prettier-config-pwa": "6.2.0-canary.78",
18
+ "@graphcommerce/typescript-config-pwa": "6.2.0-canary.78"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/graphql": "6.2.0-canary.76",
22
- "@graphcommerce/ecommerce-ui": "6.2.0-canary.76",
23
- "@graphcommerce/magento-search": "6.2.0-canary.76",
24
- "@graphcommerce/next-config": "^6.2.0-canary.76",
25
- "@graphcommerce/next-ui": "6.2.0-canary.76",
26
- "@graphcommerce/magento-product": "6.2.0-canary.76",
27
- "@graphcommerce/graphql-mesh": "6.2.0-canary.76",
28
- "@graphcommerce/magento-store": "6.2.0-canary.76",
21
+ "@graphcommerce/graphql": "6.2.0-canary.78",
22
+ "@graphcommerce/ecommerce-ui": "6.2.0-canary.78",
23
+ "@graphcommerce/magento-search": "6.2.0-canary.78",
24
+ "@graphcommerce/next-config": "^6.2.0-canary.78",
25
+ "@graphcommerce/next-ui": "6.2.0-canary.78",
26
+ "@graphcommerce/magento-product": "6.2.0-canary.78",
27
+ "@graphcommerce/graphql-mesh": "6.2.0-canary.78",
28
+ "@graphcommerce/magento-store": "6.2.0-canary.78",
29
29
  "algoliasearch": "^4.15.0",
30
30
  "react-instantsearch-hooks-web": "^6.41.0"
31
31
  },
@@ -2,6 +2,7 @@ import { ProductFiltersProps } from '@graphcommerce/magento-product'
2
2
  import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { storefrontConfig } from '@graphcommerce/next-ui'
4
4
  import { i18n } from '@lingui/core'
5
+ import { useRouter } from 'next/router'
5
6
  import { useSortBy } from 'react-instantsearch-hooks-web'
6
7
  import { RenderChip } from '../components/Chip/RenderChip'
7
8
 
@@ -11,10 +12,14 @@ export const ifConfig: IfConfig = 'algoliaApplicationId'
11
12
 
12
13
  function AlgoliaProductSortPlugin(props: PluginProps<ProductFiltersProps>) {
13
14
  const { Prev, ...rest } = props
15
+ const { locale } = useRouter()
16
+ const options = storefrontConfig(locale)?.sortOptions
14
17
  const sort = useSortBy({
15
- items: storefrontConfig(i18n.locale)?.sortOptions ?? [],
18
+ items: options ?? [],
16
19
  })
17
20
 
21
+ if (!options) return null
22
+
18
23
  return (
19
24
  <RenderChip
20
25
  __typename='Sort'