@faststore/api 4.5.1-dev.0 → 4.5.1-dev.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/dist/cjs/index.js +43 -43
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.mjs +300 -302
- package/dist/es/index.mjs.map +1 -1
- package/dist/src/platforms/vtex/utils/intelligentSearchRequest.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/platforms/vtex/utils/intelligentSearchRequest.ts +5 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intelligentSearchRequest.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/vtex/utils/intelligentSearchRequest.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;
|
|
1
|
+
{"version":3,"file":"intelligentSearchRequest.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/vtex/utils/intelligentSearchRequest.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AA6BD,MAAM,MAAM,IAAI,GACZ,YAAY,GACZ,WAAW,GACX,aAAa,GACb,WAAW,GACX,UAAU,GACV,cAAc,GACd,eAAe,GACf,EAAE,CAAA;AAEN,MAAM,MAAM,sBAAsB,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,KAAK,CAAA;AAEhF,MAAM,MAAM,yBAAyB,GACjC,gBAAgB,GAChB,QAAQ,GACR,eAAe,GACf,UAAU,GACV,oBAAoB,GACpB,cAAc,CAAA;AAElB,MAAM,WAAW,yBAAyB;IACxC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,oBAAoB,CAAC,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"version": "4.5.1-dev.
|
|
3
|
+
"version": "4.5.1-dev.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"typings": "dist/src/index.d.ts",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"vite": "7.1.5",
|
|
59
59
|
"vite-plugin-dts": "4.5.4",
|
|
60
60
|
"vitest": "^4.0.7",
|
|
61
|
-
"@faststore/diagnostics": "^4.5.1-dev.
|
|
61
|
+
"@faststore/diagnostics": "^4.5.1-dev.2"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"graphql": "16.11.0",
|
|
65
|
-
"@faststore/diagnostics": "4.5.1-dev.
|
|
65
|
+
"@faststore/diagnostics": "4.5.1-dev.2"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
@@ -30,7 +30,6 @@ type SegmentParams = {
|
|
|
30
30
|
utmiCampaign?: string
|
|
31
31
|
campaigns?: string
|
|
32
32
|
priceTables?: string
|
|
33
|
-
productClusterIds?: string
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
export type Sort =
|
|
@@ -117,8 +116,6 @@ const SHIPPING_FACET_KEYS = new Set([
|
|
|
117
116
|
'pickupPointsHash',
|
|
118
117
|
])
|
|
119
118
|
|
|
120
|
-
const QUERY_PARAM_FACET_KEYS = new Set(['productClusterIds'])
|
|
121
|
-
|
|
122
119
|
const encodeSafeURI = (uri: string) => encodeURI(decodeURI(uri))
|
|
123
120
|
|
|
124
121
|
const removeDiacriticsFromURL = (url: string) =>
|
|
@@ -160,11 +157,9 @@ export function parseSegmentCookie(
|
|
|
160
157
|
|
|
161
158
|
function parseSegmentFacetsString(facetsStr: string): {
|
|
162
159
|
shipping: Record<string, string>
|
|
163
|
-
queryParams: Record<string, string>
|
|
164
160
|
extraFacets: IntelligentSearchFacet[]
|
|
165
161
|
} {
|
|
166
162
|
const shipping: Record<string, string> = {}
|
|
167
|
-
const queryParams: Record<string, string> = {}
|
|
168
163
|
const extraFacets: IntelligentSearchFacet[] = []
|
|
169
164
|
|
|
170
165
|
for (const pair of facetsStr.split(';')) {
|
|
@@ -179,14 +174,15 @@ function parseSegmentFacetsString(facetsStr: string): {
|
|
|
179
174
|
|
|
180
175
|
if (SHIPPING_FACET_KEYS.has(key)) {
|
|
181
176
|
shipping[key] = value
|
|
182
|
-
} else if (QUERY_PARAM_FACET_KEYS.has(key)) {
|
|
183
|
-
queryParams[key] = value
|
|
184
177
|
} else {
|
|
178
|
+
// NOTE: productClusterIds (and any other repeated facet key, e.g. for
|
|
179
|
+
// excludent collections) must stay as path segments, not collapse into
|
|
180
|
+
// a single query param — IS expects productClusterIds/X/productClusterIds/not:Y/.
|
|
185
181
|
extraFacets.push({ key, value })
|
|
186
182
|
}
|
|
187
183
|
}
|
|
188
184
|
|
|
189
|
-
return { shipping,
|
|
185
|
+
return { shipping, extraFacets }
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
function extractSegmentData(segment: Record<string, unknown>): {
|
|
@@ -194,8 +190,7 @@ function extractSegmentData(segment: Record<string, unknown>): {
|
|
|
194
190
|
extraFacets: IntelligentSearchFacet[]
|
|
195
191
|
} {
|
|
196
192
|
const facetsStr = typeof segment.facets === 'string' ? segment.facets : ''
|
|
197
|
-
const { shipping,
|
|
198
|
-
parseSegmentFacetsString(facetsStr)
|
|
193
|
+
const { shipping, extraFacets } = parseSegmentFacetsString(facetsStr)
|
|
199
194
|
|
|
200
195
|
return {
|
|
201
196
|
segmentParams: {
|
|
@@ -214,7 +209,6 @@ function extractSegmentData(segment: Record<string, unknown>): {
|
|
|
214
209
|
campaigns:
|
|
215
210
|
typeof segment.campaigns === 'string' ? segment.campaigns : undefined,
|
|
216
211
|
priceTables: (segment.priceTables as string | undefined) ?? undefined,
|
|
217
|
-
productClusterIds: queryParams.productClusterIds,
|
|
218
212
|
},
|
|
219
213
|
extraFacets,
|
|
220
214
|
}
|
|
@@ -239,7 +233,6 @@ function appendSegmentParams(
|
|
|
239
233
|
['utmiCampaign', segmentParams.utmiCampaign],
|
|
240
234
|
['campaigns', segmentParams.campaigns],
|
|
241
235
|
['priceTables', segmentParams.priceTables],
|
|
242
|
-
['productClusterId', segmentParams.productClusterIds],
|
|
243
236
|
]
|
|
244
237
|
|
|
245
238
|
for (const [key, value] of entries) {
|