@usereactify/search 5.17.2 → 5.18.0

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,14 @@
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.18.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.17.2...release-v5.18.0) (2023-03-17)
6
+
7
+
8
+ ### Features
9
+
10
+ * add Suggestions component ([21514bb](https://bitbucket.org/usereactify/reactify-search-ui/commit/21514bb7d643647b1ac2a19b57ec649e5a0684b3))
11
+ * improve elasticsearch types and add related field ([dd88e8a](https://bitbucket.org/usereactify/reactify-search-ui/commit/dd88e8a3ee5e1dce990495aa03b8fe814e35d6c5))
12
+
5
13
  ### [5.17.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.17.1...release-v5.17.2) (2023-01-23)
6
14
 
7
15
 
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.17.2",
4
+ "version": "5.18.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { SuggestionsProps } from "../../components";
3
+ export declare type ExampleSuggestionsProps = React.ComponentProps<NonNullable<SuggestionsProps["render"]>>;
4
+ export declare const ExampleSuggestions: React.FC<ExampleSuggestionsProps>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ExampleSuggestions = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const hooks_1 = require("../../hooks");
9
+ const ExampleSuggestions = (props) => {
10
+ const { setSearchTerm } = (0, hooks_1.useSearch)();
11
+ return (react_1.default.createElement(react_1.default.Fragment, null,
12
+ react_1.default.createElement("h3", null, "Suggestions"),
13
+ react_1.default.createElement("ul", null, props.suggestions.map((suggestion) => (react_1.default.createElement("li", { onClick: () => setSearchTerm(suggestion.text) }, suggestion.text))))));
14
+ };
15
+ exports.ExampleSuggestions = ExampleSuggestions;
16
+ //# sourceMappingURL=ExampleSuggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExampleSuggestions.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleSuggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAwC;AAMjC,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEtC,OAAO,CACL;QACE,wDAAoB;QACpB,0CACG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CACrC,sCAAI,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAC9C,UAAU,CAAC,IAAI,CACb,CACN,CAAC,CACC,CACJ,CACJ,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B","sourcesContent":["import React from \"react\";\n\nimport { SuggestionsProps } from \"../../components\";\nimport { useSearch } from \"../../hooks\";\n\nexport type ExampleSuggestionsProps = React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n>;\n\nexport const ExampleSuggestions: React.FC<ExampleSuggestionsProps> = (\n props\n) => {\n const { setSearchTerm } = useSearch();\n\n return (\n <>\n <h3>Suggestions</h3>\n <ul>\n {props.suggestions.map((suggestion) => (\n <li onClick={() => setSearchTerm(suggestion.text)}>\n {suggestion.text}\n </li>\n ))}\n </ul>\n </>\n );\n};\n"]}
@@ -17,6 +17,7 @@ export * from "./ExampleResultPaginationNextPrev";
17
17
  export * from "./ExampleSearch";
18
18
  export * from "./ExampleSortBy";
19
19
  export * from "./ExampleStats";
20
+ export * from "./ExampleSuggestions";
20
21
  export * from "./ExampleHookUseFilters";
21
22
  export * from "./ExampleHookUseResults";
22
23
  export * from "./ExampleHookUseSearch";
@@ -29,6 +29,7 @@ __exportStar(require("./ExampleResultPaginationNextPrev"), exports);
29
29
  __exportStar(require("./ExampleSearch"), exports);
30
30
  __exportStar(require("./ExampleSortBy"), exports);
31
31
  __exportStar(require("./ExampleStats"), exports);
32
+ __exportStar(require("./ExampleSuggestions"), exports);
32
33
  __exportStar(require("./ExampleHookUseFilters"), exports);
33
34
  __exportStar(require("./ExampleHookUseResults"), exports);
34
35
  __exportStar(require("./ExampleHookUseSearch"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAE/B,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC","sourcesContent":["export * from \"./ExampleClearAll\";\nexport * from \"./ExampleCustomComponent\";\nexport * from \"./ExampleFilterList\";\nexport * from \"./ExampleFilterRange\";\nexport * from \"./ExampleFilterSlider\";\nexport * from \"./ExampleFilters\";\nexport * from \"./ExampleFiltersSelected\";\nexport * from \"./ExampleReactiveSearchProviderCollection\";\nexport * from \"./ExampleReactiveSearchProviderInstantSearch\";\nexport * from \"./ExampleReactiveSearchProviderSearch\";\nexport * from \"./ExampleResultCardCallout\";\nexport * from \"./ExampleResultCardProduct\";\nexport * from \"./ExampleResultPaginationNumbered\";\nexport * from \"./ExampleResultPaginationLoadMore\";\nexport * from \"./ExampleResultPaginationInfiniteScroll\";\nexport * from \"./ExampleResultPaginationNextPrev\";\nexport * from \"./ExampleSearch\";\nexport * from \"./ExampleSortBy\";\nexport * from \"./ExampleStats\";\n\nexport * from \"./ExampleHookUseFilters\";\nexport * from \"./ExampleHookUseResults\";\nexport * from \"./ExampleHookUseSearch\";\nexport * from \"./ExampleHookUseSortBy\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAC/B,uDAAqC;AAErC,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC","sourcesContent":["export * from \"./ExampleClearAll\";\nexport * from \"./ExampleCustomComponent\";\nexport * from \"./ExampleFilterList\";\nexport * from \"./ExampleFilterRange\";\nexport * from \"./ExampleFilterSlider\";\nexport * from \"./ExampleFilters\";\nexport * from \"./ExampleFiltersSelected\";\nexport * from \"./ExampleReactiveSearchProviderCollection\";\nexport * from \"./ExampleReactiveSearchProviderInstantSearch\";\nexport * from \"./ExampleReactiveSearchProviderSearch\";\nexport * from \"./ExampleResultCardCallout\";\nexport * from \"./ExampleResultCardProduct\";\nexport * from \"./ExampleResultPaginationNumbered\";\nexport * from \"./ExampleResultPaginationLoadMore\";\nexport * from \"./ExampleResultPaginationInfiniteScroll\";\nexport * from \"./ExampleResultPaginationNextPrev\";\nexport * from \"./ExampleSearch\";\nexport * from \"./ExampleSortBy\";\nexport * from \"./ExampleStats\";\nexport * from \"./ExampleSuggestions\";\n\nexport * from \"./ExampleHookUseFilters\";\nexport * from \"./ExampleHookUseResults\";\nexport * from \"./ExampleHookUseSearch\";\nexport * from \"./ExampleHookUseSortBy\";\n"]}
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export declare type SuggestionsProps = {
3
+ /** The field which should be used for autocompletion */
4
+ field: "title";
5
+ /** Render method */
6
+ render?: React.FC<{
7
+ suggestions: Array<{
8
+ text: string;
9
+ }>;
10
+ }>;
11
+ };
12
+ export declare const Suggestions: React.FC<SuggestionsProps>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Suggestions = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const components_1 = require("../../components");
9
+ const hooks_1 = require("../../hooks");
10
+ const Suggestions = (props) => {
11
+ var _a;
12
+ const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleSuggestions;
13
+ const { searchTerm } = (0, hooks_1.useSearch)();
14
+ return (react_1.default.createElement(components_1.CustomComponent, { componentId: "SensorSuggestions", defaultQuery: () => {
15
+ return {
16
+ suggest: {
17
+ suggestions: {
18
+ text: searchTerm,
19
+ term: {
20
+ field: props.field,
21
+ sort: "score",
22
+ suggest_mode: "always",
23
+ },
24
+ },
25
+ },
26
+ };
27
+ }, react: {
28
+ and: components_1.SENSOR_IDS,
29
+ }, render: (renderProps) => {
30
+ var _a, _b, _c;
31
+ const props = {
32
+ suggestions: [],
33
+ };
34
+ if ((_b = (_a = renderProps.rawData) === null || _a === void 0 ? void 0 : _a.suggest) === null || _b === void 0 ? void 0 : _b.suggestions.length) {
35
+ const options = (_c = renderProps.rawData.suggest.suggestions[renderProps.rawData.suggest.suggestions.length - 1]) === null || _c === void 0 ? void 0 : _c.options;
36
+ props.suggestions.push(...options.map((option) => ({
37
+ text: option.text,
38
+ })));
39
+ }
40
+ return react_1.default.createElement(RenderComponent, Object.assign({}, props));
41
+ } }));
42
+ };
43
+ exports.Suggestions = Suggestions;
44
+ //# sourceMappingURL=Suggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAI0B;AAC1B,uCAAwC;AAajC,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;;IAC/D,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,+BAAkB,CAAC;IAE3D,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,OAAO,CACL,8BAAC,4BAAe,IACd,WAAW,EAAC,mBAAmB,EAC/B,YAAY,EAAE,GAAG,EAAE;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP,WAAW,EAAE;wBACX,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE;4BACJ,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,IAAI,EAAE,OAAO;4BACb,YAAY,EAAE,QAAQ;yBACvB;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,EACD,KAAK,EAAE;YACL,GAAG,EAAE,uBAAU;SAChB,EACD,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;;YACtB,MAAM,KAAK,GAEP;gBACF,WAAW,EAAE,EAAE;aAChB,CAAC;YAEF,IAAI,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,OAAO,0CAAE,WAAW,CAAC,MAAM,EAAE;gBACpD,MAAM,OAAO,GACX,MAAA,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACrC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CACnD,0CAAE,OAAO,CAAC;gBACb,KAAK,CAAC,WAAW,CAAC,IAAI,CACpB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAsC,EAAE,EAAE,CAAC,CAAC;oBAC1D,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB,CAAC,CAAC,CACJ,CAAC;aACH;YAED,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;QACxC,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,WAAW,eAgDtB","sourcesContent":["import React from \"react\";\n\nimport {\n CustomComponent,\n ExampleSuggestions,\n SENSOR_IDS,\n} from \"../../components\";\nimport { useSearch } from \"../../hooks\";\n\nexport type SuggestionsProps = {\n /** The field which should be used for autocompletion */\n field: \"title\";\n /** Render method */\n render?: React.FC<{\n suggestions: Array<{\n text: string;\n }>;\n }>;\n};\n\nexport const Suggestions: React.FC<SuggestionsProps> = (props) => {\n const RenderComponent = props.render ?? ExampleSuggestions;\n\n const { searchTerm } = useSearch();\n\n return (\n <CustomComponent\n componentId=\"SensorSuggestions\"\n defaultQuery={() => {\n return {\n suggest: {\n suggestions: {\n text: searchTerm,\n term: {\n field: props.field,\n sort: \"score\",\n suggest_mode: \"always\",\n },\n },\n },\n };\n }}\n react={{\n and: SENSOR_IDS,\n }}\n render={(renderProps) => {\n const props: React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n > = {\n suggestions: [],\n };\n\n if (renderProps.rawData?.suggest?.suggestions.length) {\n const options =\n renderProps.rawData.suggest.suggestions[\n renderProps.rawData.suggest.suggestions.length - 1\n ]?.options;\n props.suggestions.push(\n ...options.map((option: { text: string; freq: number }) => ({\n text: option.text,\n }))\n );\n }\n\n return <RenderComponent {...props} />;\n }}\n />\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ export * from "./Suggestions";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Suggestions"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA8B","sourcesContent":["export * from \"./Suggestions\";\n"]}
@@ -8,4 +8,5 @@ export * from "./Search";
8
8
  export * from "./Sensor";
9
9
  export * from "./SortBy";
10
10
  export * from "./Stats";
11
+ export * from "./Suggestions";
11
12
  export * from "./Utility";
@@ -20,5 +20,6 @@ __exportStar(require("./Search"), exports);
20
20
  __exportStar(require("./Sensor"), exports);
21
21
  __exportStar(require("./SortBy"), exports);
22
22
  __exportStar(require("./Stats"), exports);
23
+ __exportStar(require("./Suggestions"), exports);
23
24
  __exportStar(require("./Utility"), exports);
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,2CAAyB;AACzB,2DAAyC;AACzC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B","sourcesContent":["export * from \"./Example\";\nexport * from \"./CustomComponent\";\nexport * from \"./ClearAll\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchProvider\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./SortBy\";\nexport * from \"./Stats\";\nexport * from \"./Utility\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,2CAAyB;AACzB,2DAAyC;AACzC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,gDAA8B;AAC9B,4CAA0B","sourcesContent":["export * from \"./Example\";\nexport * from \"./CustomComponent\";\nexport * from \"./ClearAll\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchProvider\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./SortBy\";\nexport * from \"./Stats\";\nexport * from \"./Suggestions\";\nexport * from \"./Utility\";\n"]}
@@ -27,16 +27,16 @@ export interface ElasticProduct {
27
27
  product_type: string;
28
28
  handle: string;
29
29
  url: string;
30
- tags: string[];
31
- collection_titles: string[];
30
+ tags: Array<string>;
31
+ collection_titles: Array<string>;
32
32
  /** tag prefixes defined in tagKeys are split to their own attributes */
33
- [key: `tags_${string}`]: string[] | undefined;
33
+ [key: `tags_${string}`]: Array<string> | undefined;
34
34
  /** decimal number e.g. 99.95 */
35
35
  price_min: number;
36
36
  /** decimal number e.g. 99.95 */
37
37
  price_max: number;
38
38
  /** array of option names e.g. ["Colour", "Size"] */
39
- options: string[];
39
+ options: Array<string>;
40
40
  /** @todo it would be better to use ProductStatus directly, which has uppercase */
41
41
  status: "active" | "archived" | "draft";
42
42
  published: boolean;
@@ -50,22 +50,22 @@ export interface ElasticProduct {
50
50
  /** originalSrc URL for featured image */
51
51
  image: Maybe<string>;
52
52
  /** array of images (undefined if images are disabled in sync settings) */
53
- images?: ElasticImage[];
53
+ images?: Array<ElasticImage>;
54
54
  /** array of variants attached to product (undefined if variants are disabled in sync settings) */
55
- variants?: ElasticVariant[];
55
+ variants?: Array<ElasticVariant>;
56
56
  /** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */
57
57
  presentment_price_ranges?: {
58
- min_variant_price: ElasticPresentmentPrice[];
59
- max_variant_price: ElasticPresentmentPrice[];
58
+ min_variant_price: Array<ElasticPresentmentPrice>;
59
+ max_variant_price: Array<ElasticPresentmentPrice>;
60
60
  };
61
61
  /** array of variant skus (undefined if variants are disabled in sync settings) */
62
- variant_skus?: string[];
62
+ variant_skus?: Array<string>;
63
63
  /** combined array of option values from all option types (undefined if variants are disabled in sync settings) */
64
- variant_options?: string[];
64
+ variant_options?: Array<string>;
65
65
  /** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */
66
- collections?: ElasticCollection[];
66
+ collections?: Array<ElasticCollection>;
67
67
  /** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */
68
- metafields?: ElasticMetafield[];
68
+ metafields?: Array<ElasticMetafield>;
69
69
  /** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */
70
70
  discount_amount?: number;
71
71
  /** combined inventory for all variants (undefined if variants are disabled in sync settings) */
@@ -73,7 +73,43 @@ export interface ElasticProduct {
73
73
  /** number of days since published, null if unpublished */
74
74
  published_days: Maybe<number>;
75
75
  /** collection of curations that this product is attached to */
76
- curations?: ElasticCuration[];
76
+ curations?: Array<ElasticCuration>;
77
+ /** related products **/
78
+ related?: Array<ElasticProductRelated>;
79
+ }
80
+ export interface ElasticProductRelated {
81
+ createdAt: string;
82
+ description: string;
83
+ featuredImage: {
84
+ originalSrc: "https://cdn.shopify.com/s/files/1/0614/3977/0777/p…71d6-e7fd-4f5f-aa99-c722e2832d01.jpg?v=1660776345";
85
+ };
86
+ handle: string;
87
+ id: string;
88
+ images: Array<ElasticImage>;
89
+ legacyResourceId: string;
90
+ metafields?: Array<ElasticMetafield>;
91
+ options: Array<{
92
+ name: string;
93
+ }>;
94
+ priceRangeV2: {
95
+ maxVariantPrice: {
96
+ amount: string;
97
+ };
98
+ minVariantPrice: {
99
+ amount: string;
100
+ };
101
+ };
102
+ productType: string;
103
+ publishedAt: string;
104
+ status: "ACTIVE" | "ARCHIVED" | "DRAFT";
105
+ storefrontId: string;
106
+ tags: Array<string>;
107
+ title: string;
108
+ tracksInventory: boolean;
109
+ updatedAt: string;
110
+ variants: Array<ElasticVariant>;
111
+ vendor: string;
112
+ __typename: "Product";
77
113
  }
78
114
  export interface ElasticVariant {
79
115
  /** legacy resource id */
@@ -83,10 +119,10 @@ export interface ElasticVariant {
83
119
  sku: Maybe<string>;
84
120
  barcode: Maybe<string>;
85
121
  /** array of presentment prices (undefined if presentment prices are disabled in sync settings) */
86
- presentment_prices?: {
122
+ presentment_prices?: Array<{
87
123
  price: ElasticPresentmentPrice;
88
124
  compare_at_price: Maybe<ElasticPresentmentPrice>;
89
- }[];
125
+ }>;
90
126
  /** decimal number e.g. 99.95 */
91
127
  price: number;
92
128
  /** decimal number e.g. 99.95 */
@@ -103,7 +139,7 @@ export interface ElasticVariant {
103
139
  inventory_quantity: number;
104
140
  available: boolean;
105
141
  /** array of images (only available if this variant has been merged from another product and if images are enabled in sync settings) */
106
- images?: ElasticImage[];
142
+ images?: Array<ElasticImage>;
107
143
  }
108
144
  export interface ElasticCollection {
109
145
  /** legacy resource id */
@@ -175,7 +211,7 @@ export declare type ElasticBulkOperationIndex = [
175
211
  export declare type ElasticBulkOperation = ElasticBulkOperationUpdate | ElasticBulkOperationIndex;
176
212
  export declare type ElasticSearchResult<T = ElasticDocument> = {
177
213
  hits: {
178
- hits: ElasticHit<T>[];
214
+ hits: Array<ElasticHit<T>>;
179
215
  };
180
216
  };
181
217
  export declare type ElasticHit<T = ElasticDocument> = {
@@ -1 +1 @@
1
- {"version":3,"file":"elastic.js","sourceRoot":"","sources":["../../../src/types/elastic.ts"],"names":[],"mappings":";;;AAOA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACrB,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AA6LD,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EARW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAQ1B","sourcesContent":["import { Callout } from \"./firestore\";\nimport {\n Maybe,\n ProductVariantInventoryPolicy,\n MetafieldValueType,\n} from \"./graphql\";\n\nexport enum ElasticDocumentType {\n Callout = \"callout\",\n Product = \"product\",\n}\n\nexport type ElasticDocument = ElasticCallout | ElasticProduct;\n\nexport interface ElasticCallout {\n type: ElasticDocumentType.Callout;\n key: string;\n callout: Omit<Callout, \"keywords\">;\n /** elastic callouts are always published */\n published: true;\n /** elastic callouts are always attached to one curation */\n curations: [ElasticCuration];\n}\n\nexport interface ElasticProduct {\n type: ElasticDocumentType.Product;\n /** the log id from which this product was last uploaded */\n lastLogId: string;\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n description: string;\n vendor: string;\n product_type: string;\n handle: string;\n url: string;\n tags: string[];\n collection_titles: string[];\n /** tag prefixes defined in tagKeys are split to their own attributes */\n [key: `tags_${string}`]: string[] | undefined;\n /** decimal number e.g. 99.95 */\n price_min: number;\n /** decimal number e.g. 99.95 */\n price_max: number;\n /** array of option names e.g. [\"Colour\", \"Size\"] */\n options: string[];\n /** @todo it would be better to use ProductStatus directly, which has uppercase */\n status: \"active\" | \"archived\" | \"draft\";\n published: boolean;\n /** ISO 8601 datetime */\n published_at: Maybe<string>;\n /** ISO 8601 datetime */\n updated_at: string;\n /** ISO 8601 datetime */\n created_at: string;\n tracks_inventory: boolean;\n /** originalSrc URL for featured image */\n image: Maybe<string>;\n /** array of images (undefined if images are disabled in sync settings) */\n images?: ElasticImage[];\n /** array of variants attached to product (undefined if variants are disabled in sync settings) */\n variants?: ElasticVariant[];\n /** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */\n presentment_price_ranges?: {\n min_variant_price: ElasticPresentmentPrice[];\n max_variant_price: ElasticPresentmentPrice[];\n };\n /** array of variant skus (undefined if variants are disabled in sync settings) */\n variant_skus?: string[];\n /** combined array of option values from all option types (undefined if variants are disabled in sync settings) */\n variant_options?: string[];\n /** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */\n collections?: ElasticCollection[];\n /** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */\n metafields?: ElasticMetafield[];\n /** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */\n discount_amount?: number;\n /** combined inventory for all variants (undefined if variants are disabled in sync settings) */\n inventory_total?: number;\n /** number of days since published, null if unpublished */\n published_days: Maybe<number>;\n /** collection of curations that this product is attached to */\n curations?: ElasticCuration[];\n}\n\nexport interface ElasticVariant {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n sku: Maybe<string>;\n barcode: Maybe<string>;\n /** array of presentment prices (undefined if presentment prices are disabled in sync settings) */\n presentment_prices?: {\n price: ElasticPresentmentPrice;\n compare_at_price: Maybe<ElasticPresentmentPrice>;\n }[];\n /** decimal number e.g. 99.95 */\n price: number;\n /** decimal number e.g. 99.95 */\n compare_at_price: Maybe<number>;\n /** value string for option 1 e.g. Blue */\n option1: Maybe<string>;\n /** value string for option 2 e.g. Medium */\n option2: Maybe<string>;\n /** value string for option 3 */\n option3: Maybe<string>;\n /** sort position within the product */\n position: number;\n inventory_policy: ProductVariantInventoryPolicy;\n inventory_quantity: number;\n available: boolean;\n /** array of images (only available if this variant has been merged from another product and if images are enabled in sync settings) */\n images?: ElasticImage[];\n}\n\nexport interface ElasticCollection {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n handle: string;\n title: string;\n position: number;\n}\n\nexport interface ElasticMetafield {\n key: string;\n type: string;\n value: string;\n namespace: string;\n /**\n * Legacy valueType attribute which is no longer provided by Shopify. We still\n * populate this field to prevent any frontends breaking which rely on it.\n *\n * @see https://shopify.dev/apps/metafields/definitions/types\n */\n value_type: MetafieldValueType;\n}\n\nexport interface ElasticPresentmentPrice {\n /** decimal number e.g. 99.95 */\n amount: number;\n currency_code: string;\n}\n\nexport interface ElasticImage {\n /** originalSrc URL */\n src: string;\n /** alt text */\n alt: Maybe<string>;\n}\n\nexport interface ElasticCuration {\n id: string;\n hidden: boolean;\n position?: number;\n searchTerm?: string;\n collectionHandle?: string;\n}\n\n// non-exhaustive type for bulk request\n// https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-bulk.html\nexport type ElasticBulkOperationUpdate = [\n { update: { _index: string; _id: string } },\n {\n script?: {\n lang: \"painless\";\n source: string;\n params?: Record<string, any>;\n };\n upsert?: Partial<ElasticProduct>;\n scripted_upsert?: true;\n doc?: Partial<ElasticProduct>;\n doc_as_upsert?: true;\n }\n];\n\nexport type ElasticBulkOperationIndex = [\n { index: { _index: string; _id: string } },\n ElasticDocument\n];\n\nexport type ElasticBulkOperation =\n | ElasticBulkOperationUpdate\n | ElasticBulkOperationIndex;\n\nexport type ElasticSearchResult<T = ElasticDocument> = {\n hits: {\n hits: ElasticHit<T>[];\n };\n};\n\nexport type ElasticHit<T = ElasticDocument> = {\n _id: string;\n _source: T;\n _score: number | null;\n};\n\nexport enum ElasticDataType {\n Text = \"text\",\n Long = \"long\",\n Date = \"date\",\n Float = \"float\",\n Nested = \"nested\",\n Keyword = \"keyword\",\n Boolean = \"boolean\",\n}\n\nexport interface ElasticProperty {\n analyzer?: string;\n type: ElasticDataType;\n ignore_above?: number;\n fields?: { [key: string]: ElasticField };\n properties?: { [key: string]: ElasticProperty };\n}\n\nexport interface ElasticField {\n type: ElasticDataType;\n ignore_above?: number;\n}\n"]}
1
+ {"version":3,"file":"elastic.js","sourceRoot":"","sources":["../../../src/types/elastic.ts"],"names":[],"mappings":";;;AAOA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACrB,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AAkOD,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EARW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAQ1B","sourcesContent":["import { Callout } from \"./firestore\";\nimport {\n Maybe,\n ProductVariantInventoryPolicy,\n MetafieldValueType,\n} from \"./graphql\";\n\nexport enum ElasticDocumentType {\n Callout = \"callout\",\n Product = \"product\",\n}\n\nexport type ElasticDocument = ElasticCallout | ElasticProduct;\n\nexport interface ElasticCallout {\n type: ElasticDocumentType.Callout;\n key: string;\n callout: Omit<Callout, \"keywords\">;\n /** elastic callouts are always published */\n published: true;\n /** elastic callouts are always attached to one curation */\n curations: [ElasticCuration];\n}\n\nexport interface ElasticProduct {\n type: ElasticDocumentType.Product;\n /** the log id from which this product was last uploaded */\n lastLogId: string;\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n description: string;\n vendor: string;\n product_type: string;\n handle: string;\n url: string;\n tags: Array<string>;\n collection_titles: Array<string>;\n /** tag prefixes defined in tagKeys are split to their own attributes */\n [key: `tags_${string}`]: Array<string> | undefined;\n /** decimal number e.g. 99.95 */\n price_min: number;\n /** decimal number e.g. 99.95 */\n price_max: number;\n /** array of option names e.g. [\"Colour\", \"Size\"] */\n options: Array<string>;\n /** @todo it would be better to use ProductStatus directly, which has uppercase */\n status: \"active\" | \"archived\" | \"draft\";\n published: boolean;\n /** ISO 8601 datetime */\n published_at: Maybe<string>;\n /** ISO 8601 datetime */\n updated_at: string;\n /** ISO 8601 datetime */\n created_at: string;\n tracks_inventory: boolean;\n /** originalSrc URL for featured image */\n image: Maybe<string>;\n /** array of images (undefined if images are disabled in sync settings) */\n images?: Array<ElasticImage>;\n /** array of variants attached to product (undefined if variants are disabled in sync settings) */\n variants?: Array<ElasticVariant>;\n /** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */\n presentment_price_ranges?: {\n min_variant_price: Array<ElasticPresentmentPrice>;\n max_variant_price: Array<ElasticPresentmentPrice>;\n };\n /** array of variant skus (undefined if variants are disabled in sync settings) */\n variant_skus?: Array<string>;\n /** combined array of option values from all option types (undefined if variants are disabled in sync settings) */\n variant_options?: Array<string>;\n /** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */\n collections?: Array<ElasticCollection>;\n /** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */\n metafields?: Array<ElasticMetafield>;\n /** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */\n discount_amount?: number;\n /** combined inventory for all variants (undefined if variants are disabled in sync settings) */\n inventory_total?: number;\n /** number of days since published, null if unpublished */\n published_days: Maybe<number>;\n /** collection of curations that this product is attached to */\n curations?: Array<ElasticCuration>;\n /** related products **/\n related?: Array<ElasticProductRelated>;\n}\n\nexport interface ElasticProductRelated {\n createdAt: string;\n description: string;\n featuredImage: {\n originalSrc: \"https://cdn.shopify.com/s/files/1/0614/3977/0777/p…71d6-e7fd-4f5f-aa99-c722e2832d01.jpg?v=1660776345\";\n };\n handle: string;\n id: string;\n images: Array<ElasticImage>;\n legacyResourceId: string;\n metafields?: Array<ElasticMetafield>;\n options: Array<{\n name: string;\n }>;\n priceRangeV2: {\n maxVariantPrice: {\n amount: string;\n };\n minVariantPrice: {\n amount: string;\n };\n };\n productType: string;\n publishedAt: string;\n status: \"ACTIVE\" | \"ARCHIVED\" | \"DRAFT\";\n storefrontId: string;\n tags: Array<string>;\n title: string;\n tracksInventory: boolean;\n updatedAt: string;\n variants: Array<ElasticVariant>;\n vendor: string;\n __typename: \"Product\";\n}\n\nexport interface ElasticVariant {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n sku: Maybe<string>;\n barcode: Maybe<string>;\n /** array of presentment prices (undefined if presentment prices are disabled in sync settings) */\n presentment_prices?: Array<{\n price: ElasticPresentmentPrice;\n compare_at_price: Maybe<ElasticPresentmentPrice>;\n }>;\n /** decimal number e.g. 99.95 */\n price: number;\n /** decimal number e.g. 99.95 */\n compare_at_price: Maybe<number>;\n /** value string for option 1 e.g. Blue */\n option1: Maybe<string>;\n /** value string for option 2 e.g. Medium */\n option2: Maybe<string>;\n /** value string for option 3 */\n option3: Maybe<string>;\n /** sort position within the product */\n position: number;\n inventory_policy: ProductVariantInventoryPolicy;\n inventory_quantity: number;\n available: boolean;\n /** array of images (only available if this variant has been merged from another product and if images are enabled in sync settings) */\n images?: Array<ElasticImage>;\n}\n\nexport interface ElasticCollection {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n handle: string;\n title: string;\n position: number;\n}\n\nexport interface ElasticMetafield {\n key: string;\n type: string;\n value: string;\n namespace: string;\n /**\n * Legacy valueType attribute which is no longer provided by Shopify. We still\n * populate this field to prevent any frontends breaking which rely on it.\n *\n * @see https://shopify.dev/apps/metafields/definitions/types\n */\n value_type: MetafieldValueType;\n}\n\nexport interface ElasticPresentmentPrice {\n /** decimal number e.g. 99.95 */\n amount: number;\n currency_code: string;\n}\n\nexport interface ElasticImage {\n /** originalSrc URL */\n src: string;\n /** alt text */\n alt: Maybe<string>;\n}\n\nexport interface ElasticCuration {\n id: string;\n hidden: boolean;\n position?: number;\n searchTerm?: string;\n collectionHandle?: string;\n}\n\n// non-exhaustive type for bulk request\n// https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-bulk.html\nexport type ElasticBulkOperationUpdate = [\n { update: { _index: string; _id: string } },\n {\n script?: {\n lang: \"painless\";\n source: string;\n params?: Record<string, any>;\n };\n upsert?: Partial<ElasticProduct>;\n scripted_upsert?: true;\n doc?: Partial<ElasticProduct>;\n doc_as_upsert?: true;\n }\n];\n\nexport type ElasticBulkOperationIndex = [\n { index: { _index: string; _id: string } },\n ElasticDocument\n];\n\nexport type ElasticBulkOperation =\n | ElasticBulkOperationUpdate\n | ElasticBulkOperationIndex;\n\nexport type ElasticSearchResult<T = ElasticDocument> = {\n hits: {\n hits: Array<ElasticHit<T>>;\n };\n};\n\nexport type ElasticHit<T = ElasticDocument> = {\n _id: string;\n _source: T;\n _score: number | null;\n};\n\nexport enum ElasticDataType {\n Text = \"text\",\n Long = \"long\",\n Date = \"date\",\n Float = \"float\",\n Nested = \"nested\",\n Keyword = \"keyword\",\n Boolean = \"boolean\",\n}\n\nexport interface ElasticProperty {\n analyzer?: string;\n type: ElasticDataType;\n ignore_above?: number;\n fields?: { [key: string]: ElasticField };\n properties?: { [key: string]: ElasticProperty };\n}\n\nexport interface ElasticField {\n type: ElasticDataType;\n ignore_above?: number;\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.17.2",
4
+ "version": "5.18.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",