@usereactify/search 5.29.0 → 5.29.2
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
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [5.29.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.29.1...release-v5.29.2) (2023-08-17)
|
|
6
|
+
|
|
7
|
+
### [5.29.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.29.0...release-v5.29.1) (2023-08-17)
|
|
8
|
+
|
|
5
9
|
## [5.29.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.28.0...release-v5.29.0) (2023-08-16)
|
|
6
10
|
|
|
7
11
|
|
package/dist/package.json
CHANGED
|
@@ -32,7 +32,12 @@ const useIndices = () => {
|
|
|
32
32
|
};
|
|
33
33
|
react_1.default.useEffect(() => {
|
|
34
34
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
-
const response = yield fetch(`https
|
|
35
|
+
const response = yield fetch(`https://api.search.reactify.app/_cat/indices?format=json`, {
|
|
36
|
+
headers: {
|
|
37
|
+
"x-reactify-index": config.index,
|
|
38
|
+
"x-reactify-skip-cache": "true",
|
|
39
|
+
},
|
|
40
|
+
}).then((response) => response.json());
|
|
36
41
|
const regexp = new RegExp(`${shopName}-[0-9]`);
|
|
37
42
|
setIndices(response
|
|
38
43
|
.map((item) => item.index)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIndices.js","sourceRoot":"","sources":["../../../src/hooks/useIndices.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,yEAAsE;AAO/D,MAAM,UAAU,GAAG,GAAe,EAAE;IACzC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG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E,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEtB,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,eAAe,EAAE,eAAe;KACjC,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,UAAU,cAgDrB","sourcesContent":["import React from \"react\";\nimport { useReactifySearchContext } from \"./useReactifySearchContext\";\n\nexport type UseIndices = {\n indices: Array<string>;\n indexNameFormat: (indexName: string) => string;\n};\n\nexport const useIndices = (): UseIndices => {\n const { config, options } = useReactifySearchContext();\n const shopName = options.shopifyPermanentDomain.replace(\".myshopify.com\", \"\");\n\n const [indices, setIndices] = React.useState<UseIndices[\"indices\"]>([]);\n\n const indexNameFormat: UseIndices[\"indexNameFormat\"] = (indexName) => {\n let indexNameFormatted = indexName;\n try {\n const indexDate = indexName.split(`${shopName}-`)[1];\n\n indexNameFormatted = `${shopName} ${new Date(\n parseInt(indexDate)\n ).toLocaleString()} (${indexDate})`;\n } catch (error) {\n console.error(error);\n }\n\n return indexNameFormatted;\n };\n\n React.useEffect(() => {\n (async () => {\n const response: Array<{ index: string }> = await fetch(\n `https://api.search.reactify.app/_cat/indices?format=json`,\n {\n headers: {\n \"x-reactify-index\": config.index,\n \"x-reactify-skip-cache\": \"true\",\n },\n }\n ).then((response) => response.json());\n\n const regexp = new RegExp(`${shopName}-[0-9]`);\n\n setIndices(\n response\n .map((item) => item.index)\n .filter((item) => regexp.test(item))\n .sort((a, b) => (a > b ? -1 : 1))\n );\n })();\n }, [config.endpoint]);\n\n return {\n indices: indices,\n indexNameFormat: indexNameFormat,\n };\n};\n"]}
|