@usereactify/search 4.4.0-beta.0 → 5.0.0-beta.1

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.
Files changed (104) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/package.json +8 -10
  3. package/dist/filter/Filter.d.ts +0 -12
  4. package/dist/filter/Filter.js +0 -71
  5. package/dist/filter/FilterList.d.ts +0 -4
  6. package/dist/filter/FilterList.js +0 -15
  7. package/dist/filter/FilterStack.d.ts +0 -11
  8. package/dist/filter/FilterStack.js +0 -25
  9. package/dist/filter/index.d.ts +0 -3
  10. package/dist/filter/index.js +0 -15
  11. package/dist/hooks/index.d.ts +0 -14
  12. package/dist/hooks/index.js +0 -26
  13. package/dist/hooks/reactivesearch/index.d.ts +0 -5
  14. package/dist/hooks/reactivesearch/index.js +0 -17
  15. package/dist/hooks/reactivesearch/useReactiveBaseProps.d.ts +0 -7
  16. package/dist/hooks/reactivesearch/useReactiveBaseProps.js +0 -43
  17. package/dist/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +0 -28
  18. package/dist/hooks/reactivesearch/useReactiveDataSearchProps.js +0 -71
  19. package/dist/hooks/reactivesearch/useReactiveFilterListProps.d.ts +0 -68
  20. package/dist/hooks/reactivesearch/useReactiveFilterListProps.js +0 -106
  21. package/dist/hooks/reactivesearch/useReactiveReactProp.d.ts +0 -3
  22. package/dist/hooks/reactivesearch/useReactiveReactProp.js +0 -25
  23. package/dist/hooks/reactivesearch/useReactiveResultListProps.d.ts +0 -19
  24. package/dist/hooks/reactivesearch/useReactiveResultListProps.js +0 -32
  25. package/dist/hooks/useAnalytics.d.ts +0 -95
  26. package/dist/hooks/useAnalytics.js +0 -110
  27. package/dist/hooks/useCollection.d.ts +0 -1
  28. package/dist/hooks/useCollection.js +0 -6
  29. package/dist/hooks/useConfig.d.ts +0 -1
  30. package/dist/hooks/useConfig.js +0 -6
  31. package/dist/hooks/useCuration.d.ts +0 -1
  32. package/dist/hooks/useCuration.js +0 -6
  33. package/dist/hooks/useFilterCollapsedState.d.ts +0 -8
  34. package/dist/hooks/useFilterCollapsedState.js +0 -27
  35. package/dist/hooks/useFilterListProps.d.ts +0 -22
  36. package/dist/hooks/useFilterListProps.js +0 -35
  37. package/dist/hooks/useFilterStack.d.ts +0 -1
  38. package/dist/hooks/useFilterStack.js +0 -6
  39. package/dist/hooks/useFilters.d.ts +0 -1
  40. package/dist/hooks/useFilters.js +0 -17
  41. package/dist/hooks/useLiveConfig.d.ts +0 -4
  42. package/dist/hooks/useLiveConfig.js +0 -74
  43. package/dist/hooks/usePages.d.ts +0 -10
  44. package/dist/hooks/usePages.js +0 -97
  45. package/dist/hooks/useProductPrice.d.ts +0 -12
  46. package/dist/hooks/useProductPrice.js +0 -61
  47. package/dist/hooks/useSearch.d.ts +0 -8
  48. package/dist/hooks/useSearch.js +0 -16
  49. package/dist/hooks/useSort.d.ts +0 -5
  50. package/dist/hooks/useSort.js +0 -24
  51. package/dist/index.d.ts +0 -9
  52. package/dist/index.js +0 -24
  53. package/dist/provider.d.ts +0 -78
  54. package/dist/provider.js +0 -287
  55. package/dist/result/ResultCard.d.ts +0 -14
  56. package/dist/result/ResultCard.js +0 -66
  57. package/dist/result/ResultCardCallout.d.ts +0 -13
  58. package/dist/result/ResultCardCallout.js +0 -53
  59. package/dist/result/ResultList.d.ts +0 -34
  60. package/dist/result/ResultList.js +0 -93
  61. package/dist/result/ResultLoadMoreButton.d.ts +0 -10
  62. package/dist/result/ResultLoadMoreButton.js +0 -61
  63. package/dist/result/ResultPagination.d.ts +0 -10
  64. package/dist/result/ResultPagination.js +0 -60
  65. package/dist/result/ResultPaginationNextPrev.d.ts +0 -8
  66. package/dist/result/ResultPaginationNextPrev.js +0 -30
  67. package/dist/result/ResultStateProvider.d.ts +0 -7
  68. package/dist/result/ResultStateProvider.js +0 -10
  69. package/dist/result/index.d.ts +0 -6
  70. package/dist/result/index.js +0 -18
  71. package/dist/search/SearchInput.d.ts +0 -9
  72. package/dist/search/SearchInput.js +0 -17
  73. package/dist/search/index.d.ts +0 -1
  74. package/dist/search/index.js +0 -13
  75. package/dist/sensor/SensorCollection.d.ts +0 -2
  76. package/dist/sensor/SensorCollection.js +0 -41
  77. package/dist/sensor/SensorInventoryAvailable.d.ts +0 -2
  78. package/dist/sensor/SensorInventoryAvailable.js +0 -52
  79. package/dist/sensor/SensorPublished.d.ts +0 -2
  80. package/dist/sensor/SensorPublished.js +0 -16
  81. package/dist/sensor/SensorSearch.d.ts +0 -2
  82. package/dist/sensor/SensorSearch.js +0 -82
  83. package/dist/sensor/SensorSort.d.ts +0 -2
  84. package/dist/sensor/SensorSort.js +0 -205
  85. package/dist/sensor/SensorSortScore.d.ts +0 -2
  86. package/dist/sensor/SensorSortScore.js +0 -12
  87. package/dist/sensor/SensorStack.d.ts +0 -2
  88. package/dist/sensor/SensorStack.js +0 -31
  89. package/dist/sensor/index.d.ts +0 -8
  90. package/dist/sensor/index.js +0 -29
  91. package/dist/types/config.d.ts +0 -25
  92. package/dist/types/config.js +0 -2
  93. package/dist/types/elastic.d.ts +0 -209
  94. package/dist/types/elastic.js +0 -18
  95. package/dist/types/firestore.d.ts +0 -280
  96. package/dist/types/firestore.js +0 -18
  97. package/dist/types/graphql.d.ts +0 -26545
  98. package/dist/types/graphql.js +0 -4687
  99. package/dist/types/reactivesearch.d.ts +0 -73
  100. package/dist/types/reactivesearch.js +0 -2
  101. package/dist/types/shopify.d.ts +0 -21
  102. package/dist/types/shopify.js +0 -27
  103. package/dist/utility/UtilityAuthenticatedReactiveBase.d.ts +0 -2
  104. package/dist/utility/UtilityAuthenticatedReactiveBase.js +0 -14
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const SensorPublished: React.FC;
@@ -1,16 +0,0 @@
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.SensorPublished = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
9
- const SensorPublished = () => (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorPublished", customQuery: () => ({
10
- query: {
11
- match: {
12
- published: true,
13
- },
14
- },
15
- }) }));
16
- exports.SensorPublished = SensorPublished;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const SensorSearch: React.FC;
@@ -1,82 +0,0 @@
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.SensorSearch = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const DataSearch_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/search/DataSearch"));
9
- const hooks_1 = require("../hooks");
10
- const SensorSearch = () => {
11
- const { fields } = (0, hooks_1.useConfig)();
12
- const { searchQuery } = (0, hooks_1.useSearch)();
13
- // ignore search fields only set for instant search
14
- const searchFields = react_1.default.useMemo(() => fields.filter((field) => ["always_search", "search_page"].includes(field.searchType)), [fields]);
15
- if (!searchQuery || !searchFields.length) {
16
- return null;
17
- }
18
- return (react_1.default.createElement(react_1.default.Fragment, null,
19
- react_1.default.createElement(DataSearch_1.default, { fuzziness: 1, queryFormat: "and", autosuggest: false, value: searchQuery, componentId: "SensorSearch", style: { display: "none" }, dataField: searchFields.map((field) => field.field), fieldWeights: searchFields.map((field) => field.importance), customQuery: (value, props) => {
20
- const { dataField, fieldWeights } = props;
21
- const fieldsCrossFields = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
22
- const fieldsPhrase = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
23
- const fieldsPhrasePrefix = dataField
24
- .filter((field) => !field.includes("."))
25
- .map((field, index) => `${field}^${fieldWeights[index]}`);
26
- const query = {
27
- bool: {
28
- should: [
29
- {
30
- nested: {
31
- path: "curations",
32
- query: {
33
- term: {
34
- "curations.searchTerm.keyword": value === null || value === void 0 ? void 0 : value.toLowerCase(),
35
- },
36
- },
37
- },
38
- },
39
- ...(fieldsCrossFields.length > 0
40
- ? [
41
- {
42
- multi_match: {
43
- query: value,
44
- fields: fieldsCrossFields,
45
- type: "cross_fields",
46
- operator: "and",
47
- },
48
- },
49
- ]
50
- : []),
51
- ...(fieldsPhrase.length > 0
52
- ? [
53
- {
54
- multi_match: {
55
- query: value,
56
- fields: fieldsPhrase,
57
- type: "phrase",
58
- operator: "and",
59
- },
60
- },
61
- ]
62
- : []),
63
- ...(fieldsPhrasePrefix.length > 0
64
- ? [
65
- {
66
- multi_match: {
67
- query: value,
68
- fields: fieldsPhrasePrefix,
69
- type: "phrase_prefix",
70
- operator: "and",
71
- },
72
- },
73
- ]
74
- : []),
75
- ],
76
- minimum_should_match: "1",
77
- },
78
- };
79
- return { query };
80
- } })));
81
- };
82
- exports.SensorSearch = SensorSearch;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const SensorSort: React.FC;
@@ -1,205 +0,0 @@
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.SensorSort = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
9
- const hooks_1 = require("../hooks");
10
- const debug = require("debug")("reactify-search:SensorSort");
11
- const SensorSort = () => {
12
- const config = (0, hooks_1.useConfig)();
13
- const curation = (0, hooks_1.useCuration)();
14
- const collection = (0, hooks_1.useCollection)();
15
- const globalCuration = (curation === null || curation === void 0 ? void 0 : curation.id) === "global";
16
- const { sortOption } = (0, hooks_1.useSort)();
17
- const searchQuery = react_1.default.useMemo(() => {
18
- if (typeof window === "undefined")
19
- return "";
20
- const urlParams = new URLSearchParams(window.location.search);
21
- return urlParams.get("q") || "";
22
- }, []);
23
- const { sort, query } = react_1.default.useMemo(() => {
24
- return {
25
- sort: buildSort({
26
- config,
27
- sortOption,
28
- collection,
29
- curation,
30
- globalCuration,
31
- }),
32
- query: buildQuery({
33
- sortOption,
34
- curation,
35
- globalCuration,
36
- }),
37
- };
38
- }, [config, sortOption, curation]);
39
- react_1.default.useEffect(() => {
40
- debug("searchQuery", searchQuery);
41
- debug("sort", sort);
42
- debug("query", query);
43
- }, [searchQuery, sort]);
44
- return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorSort", customQuery: () => ({
45
- sort,
46
- query,
47
- }) }));
48
- };
49
- exports.SensorSort = SensorSort;
50
- const buildSort = (args) => {
51
- var _a;
52
- const { config, curation, sortOption, collection, globalCuration } = args;
53
- debug("buildSortQuery.start", {
54
- config,
55
- curation,
56
- sortOption,
57
- });
58
- // return default sort option if unset
59
- if (!sortOption) {
60
- return collection
61
- ? mapCollectionPositionSortClause(collection)
62
- : ["_score"];
63
- }
64
- // curation positions are only applied for the default `collections.position` or `_score` sort
65
- // if the sort is something else, apply a normal sort which applies what the user has requested
66
- if (!["_score", "collections.position"].includes(sortOption.field)) {
67
- return [{ [sortOption.field]: sortOption.direction }];
68
- }
69
- // no matching curation, return default sort clause
70
- if (!curation) {
71
- return collection
72
- ? mapCollectionPositionSortClause(collection)
73
- : ["_score"];
74
- }
75
- const sorts = [];
76
- // show pins first
77
- if (globalCuration && collection) {
78
- sorts.push(...mapCollectionPositionSortClause(collection));
79
- }
80
- else {
81
- sorts.push({
82
- "curations.position": {
83
- unmapped_type: "long",
84
- order: "asc",
85
- nested: {
86
- path: "curations",
87
- filter: {
88
- term: {
89
- [`curations.${"collection" === curation.type
90
- ? "collectionHandle"
91
- : "searchTerm"}.keyword`]: "collection" === curation.type
92
- ? curation.collectionHandle
93
- : (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
94
- },
95
- },
96
- },
97
- },
98
- });
99
- }
100
- if (0 < curation.boosting.groupings.length) {
101
- const groupings = curation.boosting.groupings.sort((a, b) => a.position > b.position ? 1 : -1);
102
- for (const grouping of groupings) {
103
- try {
104
- const query = JSON.parse(grouping.query);
105
- if (query)
106
- sorts.push(query);
107
- }
108
- catch (_b) {
109
- console.error(`query could not be parsed for boost grouping`, grouping);
110
- }
111
- }
112
- }
113
- if (0 < curation.boosting.sortings.length) {
114
- const sortings = curation.boosting.sortings.sort((a, b) => a.position > b.position ? 1 : -1);
115
- for (const sorting of sortings) {
116
- try {
117
- const query = JSON.parse(sorting.query);
118
- if (query)
119
- sorts.push(query);
120
- }
121
- catch (_c) {
122
- console.error(`query could not be parsed for boost sorting`, sorting);
123
- }
124
- }
125
- }
126
- // finally, for collections, if no other sorting is defined, sort by index order to provide
127
- // a consistent order
128
- if ("collection" === curation.type && sorts.length === 0) {
129
- sorts.push("_doc");
130
- }
131
- // finally, for search, sort by score
132
- if ("search" === curation.type) {
133
- sorts.push("_score");
134
- }
135
- return sorts;
136
- };
137
- /**
138
- * Return a sort clause which sorts by position within the given collection.
139
- */
140
- function mapCollectionPositionSortClause(collection) {
141
- return [
142
- {
143
- "collections.position": {
144
- order: "asc",
145
- nested: {
146
- path: "collections",
147
- filter: {
148
- term: {
149
- "collections.handle.keyword": collection.handle,
150
- },
151
- },
152
- },
153
- },
154
- },
155
- ];
156
- }
157
- const buildQuery = (args) => {
158
- var _a;
159
- const { curation, sortOption, globalCuration } = args;
160
- if (!curation || globalCuration) {
161
- return undefined;
162
- }
163
- return {
164
- bool: {
165
- must_not: [
166
- {
167
- nested: {
168
- path: "curations",
169
- query: {
170
- bool: {
171
- must: [
172
- {
173
- term: {
174
- [`curations.${"collection" === curation.type
175
- ? "collectionHandle"
176
- : "searchTerm"}.keyword`]: "collection" === curation.type
177
- ? curation.collectionHandle
178
- : (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
179
- },
180
- },
181
- {
182
- term: {
183
- "curations.hidden": true,
184
- },
185
- },
186
- ],
187
- },
188
- },
189
- },
190
- },
191
- // hide callout when not sorting by _score or collections.position
192
- ...(sortOption &&
193
- !["_score", "collections.position"].includes(sortOption.field)
194
- ? [
195
- {
196
- term: {
197
- type: "callout",
198
- },
199
- },
200
- ]
201
- : []),
202
- ],
203
- },
204
- };
205
- };
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const SensorSortScore: React.FC;
@@ -1,12 +0,0 @@
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.SensorSortScore = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
9
- const SensorSortScore = () => (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorSortScore", customQuery: () => ({
10
- sort: { _score: "desc" },
11
- }) }));
12
- exports.SensorSortScore = SensorSortScore;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const SensorStack: React.FC;
@@ -1,31 +0,0 @@
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.SensorStack = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const hooks_1 = require("../hooks");
9
- const SensorSort_1 = require("./SensorSort");
10
- const SensorSearch_1 = require("./SensorSearch");
11
- const SensorSortScore_1 = require("./SensorSortScore");
12
- const SensorPublished_1 = require("./SensorPublished");
13
- const SensorCollection_1 = require("./SensorCollection");
14
- const SensorInventoryAvailable_1 = require("./SensorInventoryAvailable");
15
- const SensorStack = () => {
16
- const { instantSearch } = (0, hooks_1.useSearch)();
17
- // instant search mode
18
- if (instantSearch) {
19
- return (react_1.default.createElement(react_1.default.Fragment, null,
20
- react_1.default.createElement(SensorPublished_1.SensorPublished, null),
21
- react_1.default.createElement(SensorSortScore_1.SensorSortScore, null)));
22
- }
23
- // result grid mode
24
- return (react_1.default.createElement(react_1.default.Fragment, null,
25
- react_1.default.createElement(SensorSort_1.SensorSort, null),
26
- react_1.default.createElement(SensorSearch_1.SensorSearch, null),
27
- react_1.default.createElement(SensorPublished_1.SensorPublished, null),
28
- react_1.default.createElement(SensorCollection_1.SensorCollection, null),
29
- react_1.default.createElement(SensorInventoryAvailable_1.SensorInventoryAvailable, null)));
30
- };
31
- exports.SensorStack = SensorStack;
@@ -1,8 +0,0 @@
1
- export * from "./SensorSort";
2
- export * from "./SensorSearch";
3
- export * from "./SensorPublished";
4
- export * from "./SensorSortScore";
5
- export * from "./SensorCollection";
6
- export * from "./SensorInventoryAvailable";
7
- export * from "./SensorStack";
8
- export declare const SENSOR_IDS: string[];
@@ -1,29 +0,0 @@
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
- exports.SENSOR_IDS = void 0;
14
- __exportStar(require("./SensorSort"), exports);
15
- __exportStar(require("./SensorSearch"), exports);
16
- __exportStar(require("./SensorPublished"), exports);
17
- __exportStar(require("./SensorSortScore"), exports);
18
- __exportStar(require("./SensorCollection"), exports);
19
- __exportStar(require("./SensorInventoryAvailable"), exports);
20
- __exportStar(require("./SensorStack"), exports);
21
- // this is consumed by the react prop in various components
22
- exports.SENSOR_IDS = [
23
- "SensorSort",
24
- "SensorSearch",
25
- "SensorSortScore",
26
- "SensorPublished",
27
- "SensorCollection",
28
- "SensorInventoryAvailable",
29
- ];
@@ -1,25 +0,0 @@
1
- import { Sort, Filter, FilterOption, Redirect, Field, Curation } from "./firestore";
2
- export interface Config {
3
- sort: ConfigSort[];
4
- fields: ConfigField[];
5
- filters: ConfigFilter[];
6
- redirects: ConfigRedirect[];
7
- curations: ConfigCuration[];
8
- }
9
- export declare type ConfigSort = Omit<Sort, "enabled">;
10
- export declare type ConfigField = Omit<Field, "enabled">;
11
- export declare type ConfigRedirect = Omit<Redirect, "enabled" | "keywords">;
12
- export declare type ConfigFilter = Omit<Filter, "enabled" | "keywords"> & {
13
- options: Omit<FilterOption, "enabled">[];
14
- };
15
- export declare type ConfigFilterOption = Omit<FilterOption, "enabled">;
16
- export declare type ConfigCuration = Omit<Curation, "keywords" | "boosting" | "longRunningTask" | "callouts"> & {
17
- boosting: {
18
- groupings: (NonNullable<NonNullable<Curation["boosting"]>["groupings"]>[0] & {
19
- query: string;
20
- })[];
21
- sortings: (NonNullable<NonNullable<Curation["boosting"]>["sortings"]>[0] & {
22
- query: string;
23
- })[];
24
- };
25
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,209 +0,0 @@
1
- import { Callout } from "./firestore";
2
- import { Maybe, ProductVariantInventoryPolicy, MetafieldValueType } from "./graphql";
3
- export declare enum ElasticDocumentType {
4
- Callout = "callout",
5
- Product = "product"
6
- }
7
- export declare type ElasticDocument = ElasticCallout | ElasticProduct;
8
- export interface ElasticCallout {
9
- type: ElasticDocumentType.Callout;
10
- key: string;
11
- callout: Omit<Callout, "keywords">;
12
- /** elastic callouts are always published */
13
- published: true;
14
- /** elastic callouts are always attached to one curation */
15
- curations: [ElasticCuration];
16
- }
17
- export interface ElasticProduct {
18
- type: ElasticDocumentType.Product;
19
- /** the log id from which this product was last uploaded */
20
- lastLogId: string;
21
- /** legacy resource id */
22
- id: number;
23
- storefrontId: string;
24
- title: string;
25
- description: string;
26
- vendor: string;
27
- product_type: string;
28
- handle: string;
29
- url: string;
30
- tags: string[];
31
- collection_titles: string[];
32
- /** tag prefixes defined in tagKeys are split to their own attributes */
33
- [key: `tags_${string}`]: string[] | undefined;
34
- /** decimal number e.g. 99.95 */
35
- price_min: number;
36
- /** decimal number e.g. 99.95 */
37
- price_max: number;
38
- /** array of option names e.g. ["Colour", "Size"] */
39
- options: string[];
40
- /** @todo it would be better to use ProductStatus directly, which has uppercase */
41
- status: "active" | "archived" | "draft";
42
- published: boolean;
43
- /** ISO 8601 datetime */
44
- published_at: Maybe<string>;
45
- /** ISO 8601 datetime */
46
- updated_at: string;
47
- /** ISO 8601 datetime */
48
- created_at: string;
49
- tracks_inventory: boolean;
50
- /** originalSrc URL for featured image */
51
- image: Maybe<string>;
52
- /** array of images (undefined if images are disabled in sync settings) */
53
- images?: ElasticImage[];
54
- /** array of variants attached to product (undefined if variants are disabled in sync settings) */
55
- variants?: ElasticVariant[];
56
- /** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */
57
- presentment_price_ranges?: {
58
- min_variant_price: ElasticPresentmentPrice[];
59
- max_variant_price: ElasticPresentmentPrice[];
60
- };
61
- /** array of variant skus (undefined if variants are disabled in sync settings) */
62
- variant_skus?: string[];
63
- /** combined array of option values from all option types (undefined if variants are disabled in sync settings) */
64
- variant_options?: string[];
65
- /** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */
66
- collections?: ElasticCollection[];
67
- /** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */
68
- metafields?: ElasticMetafield[];
69
- /** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */
70
- discount_amount?: number;
71
- /** combined inventory for all variants (undefined if variants are disabled in sync settings) */
72
- inventory_total?: number;
73
- /** number of days since published, null if unpublished */
74
- published_days: Maybe<number>;
75
- /** collection of curations that this product is attached to */
76
- curations?: ElasticCuration[];
77
- }
78
- export interface ElasticVariant {
79
- /** legacy resource id */
80
- id: number;
81
- storefrontId: string;
82
- title: string;
83
- sku: Maybe<string>;
84
- barcode: Maybe<string>;
85
- /** array of presentment prices (undefined if presentment prices are disabled in sync settings) */
86
- presentment_prices?: {
87
- price: ElasticPresentmentPrice;
88
- compare_at_price: Maybe<ElasticPresentmentPrice>;
89
- }[];
90
- /** decimal number e.g. 99.95 */
91
- price: number;
92
- /** decimal number e.g. 99.95 */
93
- compare_at_price: Maybe<number>;
94
- /** value string for option 1 e.g. Blue */
95
- option1: Maybe<string>;
96
- /** value string for option 2 e.g. Medium */
97
- option2: Maybe<string>;
98
- /** value string for option 3 */
99
- option3: Maybe<string>;
100
- /** sort position within the product */
101
- position: number;
102
- inventory_policy: ProductVariantInventoryPolicy;
103
- inventory_quantity: number;
104
- available: boolean;
105
- /** 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[];
107
- }
108
- export interface ElasticCollection {
109
- /** legacy resource id */
110
- id: number;
111
- storefrontId: string;
112
- handle: string;
113
- title: string;
114
- position: number;
115
- }
116
- export interface ElasticMetafield {
117
- key: string;
118
- type: string;
119
- value: string;
120
- namespace: string;
121
- /**
122
- * Legacy valueType attribute which is no longer provided by Shopify. We still
123
- * populate this field to prevent any frontends breaking which rely on it.
124
- *
125
- * @see https://shopify.dev/apps/metafields/definitions/types
126
- */
127
- value_type: MetafieldValueType;
128
- }
129
- export interface ElasticPresentmentPrice {
130
- /** decimal number e.g. 99.95 */
131
- amount: number;
132
- currency_code: string;
133
- }
134
- export interface ElasticImage {
135
- /** originalSrc URL */
136
- src: string;
137
- /** alt text */
138
- alt: Maybe<string>;
139
- }
140
- export interface ElasticCuration {
141
- id: string;
142
- hidden: boolean;
143
- position?: number;
144
- searchTerm?: string;
145
- collectionHandle?: string;
146
- }
147
- export declare type ElasticBulkOperationUpdate = [
148
- {
149
- update: {
150
- _index: string;
151
- _id: string;
152
- };
153
- },
154
- {
155
- script?: {
156
- lang: "painless";
157
- source: string;
158
- params?: Record<string, any>;
159
- };
160
- upsert?: Partial<ElasticProduct>;
161
- scripted_upsert?: true;
162
- doc?: Partial<ElasticProduct>;
163
- doc_as_upsert?: true;
164
- }
165
- ];
166
- export declare type ElasticBulkOperationIndex = [
167
- {
168
- index: {
169
- _index: string;
170
- _id: string;
171
- };
172
- },
173
- ElasticDocument
174
- ];
175
- export declare type ElasticBulkOperation = ElasticBulkOperationUpdate | ElasticBulkOperationIndex;
176
- export declare type ElasticSearchResult<T = ElasticDocument> = {
177
- hits: {
178
- hits: ElasticHit<T>[];
179
- };
180
- };
181
- export declare type ElasticHit<T = ElasticDocument> = {
182
- _id: string;
183
- _source: T;
184
- _score: number | null;
185
- };
186
- export declare enum ElasticDataType {
187
- Text = "text",
188
- Long = "long",
189
- Date = "date",
190
- Float = "float",
191
- Nested = "nested",
192
- Keyword = "keyword",
193
- Boolean = "boolean"
194
- }
195
- export interface ElasticProperty {
196
- analyzer?: string;
197
- type: ElasticDataType;
198
- ignore_above?: number;
199
- fields?: {
200
- [key: string]: ElasticField;
201
- };
202
- properties?: {
203
- [key: string]: ElasticProperty;
204
- };
205
- }
206
- export interface ElasticField {
207
- type: ElasticDataType;
208
- ignore_above?: number;
209
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElasticDataType = exports.ElasticDocumentType = void 0;
4
- var ElasticDocumentType;
5
- (function (ElasticDocumentType) {
6
- ElasticDocumentType["Callout"] = "callout";
7
- ElasticDocumentType["Product"] = "product";
8
- })(ElasticDocumentType = exports.ElasticDocumentType || (exports.ElasticDocumentType = {}));
9
- var ElasticDataType;
10
- (function (ElasticDataType) {
11
- ElasticDataType["Text"] = "text";
12
- ElasticDataType["Long"] = "long";
13
- ElasticDataType["Date"] = "date";
14
- ElasticDataType["Float"] = "float";
15
- ElasticDataType["Nested"] = "nested";
16
- ElasticDataType["Keyword"] = "keyword";
17
- ElasticDataType["Boolean"] = "boolean";
18
- })(ElasticDataType = exports.ElasticDataType || (exports.ElasticDataType = {}));