@faststore/api 1.8.15 → 1.8.18
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 +27 -0
- package/dist/api.cjs.development.js +50 -9
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +50 -9
- package/dist/api.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/platforms/vtex/clients/search/index.ts +44 -8
- package/src/platforms/vtex/resolvers/query.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.8.18 (2022-05-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @faststore/api
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.8.17 (2022-05-13)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **UI:** Add `ProductCard` component ([#1272](https://github.com/vtex/faststore/issues/1272)) ([ea62210](https://github.com/vtex/faststore/commit/ea6221080da8b3538551f7a77df61a14d8de297d))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## 1.8.16 (2022-05-13)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @faststore/api
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## 1.8.15 (2022-05-13)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @faststore/api
|
|
@@ -107,27 +107,68 @@ const VtexCommerce = ({
|
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
+
const POLICY_KEY = 'trade-policy';
|
|
111
|
+
const REGION_KEY = 'region-id';
|
|
112
|
+
const CHANNEL_KEYS = /*#__PURE__*/new Set([POLICY_KEY, REGION_KEY]);
|
|
110
113
|
const IntelligentSearch = ({
|
|
111
114
|
account,
|
|
112
115
|
environment,
|
|
113
116
|
hideUnavailableItems
|
|
114
117
|
}, ctx) => {
|
|
115
118
|
const base = `https://${account}.${environment}.com.br/api/io`;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
|
|
120
|
+
const getPolicyFacet = () => {
|
|
121
|
+
const {
|
|
122
|
+
salesChannel
|
|
123
|
+
} = ctx.storage.channel;
|
|
124
|
+
|
|
125
|
+
if (!salesChannel) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
key: POLICY_KEY,
|
|
131
|
+
value: salesChannel
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const getRegionFacet = () => {
|
|
136
|
+
const {
|
|
137
|
+
regionId
|
|
138
|
+
} = ctx.storage.channel;
|
|
139
|
+
|
|
140
|
+
if (!regionId) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
key: REGION_KEY,
|
|
146
|
+
value: regionId
|
|
147
|
+
};
|
|
119
148
|
};
|
|
120
149
|
|
|
121
150
|
const addDefaultFacets = facets => {
|
|
122
|
-
|
|
151
|
+
var _facets$find, _facets$find2;
|
|
152
|
+
|
|
153
|
+
const withDefaltFacets = facets.filter(({
|
|
154
|
+
key
|
|
155
|
+
}) => !CHANNEL_KEYS.has(key));
|
|
156
|
+
const policyFacet = (_facets$find = facets.find(({
|
|
157
|
+
key
|
|
158
|
+
}) => key === POLICY_KEY)) != null ? _facets$find : getPolicyFacet();
|
|
159
|
+
const regionFacet = (_facets$find2 = facets.find(({
|
|
123
160
|
key
|
|
124
|
-
}) => key ===
|
|
161
|
+
}) => key === REGION_KEY)) != null ? _facets$find2 : getRegionFacet();
|
|
162
|
+
|
|
163
|
+
if (policyFacet !== null) {
|
|
164
|
+
withDefaltFacets.push(policyFacet);
|
|
165
|
+
}
|
|
125
166
|
|
|
126
|
-
if (
|
|
127
|
-
|
|
167
|
+
if (regionFacet !== null) {
|
|
168
|
+
withDefaltFacets.push(regionFacet);
|
|
128
169
|
}
|
|
129
170
|
|
|
130
|
-
return
|
|
171
|
+
return withDefaltFacets;
|
|
131
172
|
};
|
|
132
173
|
|
|
133
174
|
const search = ({
|
|
@@ -1087,7 +1128,7 @@ const Query = {
|
|
|
1087
1128
|
skuLoader
|
|
1088
1129
|
}
|
|
1089
1130
|
} = ctx;
|
|
1090
|
-
return skuLoader.load(locator
|
|
1131
|
+
return skuLoader.load(locator);
|
|
1091
1132
|
},
|
|
1092
1133
|
collection: (_, {
|
|
1093
1134
|
slug
|