@scayle/storefront-core 7.69.0 → 7.69.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.69.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Extend `FetchProductsByCategoryParams` type to support `trackSearchAnalyticsEvent?: boolean`
8
+ - Allow passing of the `trackSearchAnalyticsEvent` parameter into the `getProductsByCategory` RPC method.
9
+ **NOTE**: To prevent logging the search term on every page request when when paginating with the `page` parameter, the `trackSearchAnalyticsEvent` parameter is only passed on the first page (`page === 1`).
10
+ For more details on how to utilize this, check the [SCAYLE Search Analytics section](https://scayle.dev/en/developer-guide/products/search#scayle-search-analytics) in the SCAYLE Resource Center.
11
+
3
12
  ## 7.69.0
4
13
 
5
14
  ### Minor Changes
@@ -37,7 +37,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
37
37
  carrier,
38
38
  basketId: context.basketKey,
39
39
  campaignKey: context.campaignKey
40
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.69.0"}`).setProtectedHeader({
40
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.69.1"}`).setProtectedHeader({
41
41
  alg: "HS256",
42
42
  typ: "JWT"
43
43
  }).sign(secret);
@@ -35,7 +35,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
35
35
  carrier,
36
36
  basketId: context.basketKey,
37
37
  campaignKey: context.campaignKey
38
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.69.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
38
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.69.1"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
39
39
  return {
40
40
  accessToken: refreshedAccessToken,
41
41
  checkoutJwt
@@ -248,7 +248,8 @@ const getProductsByCategory = exports.getProductsByCategory = async function get
248
248
  pricePromotionKey = "",
249
249
  includeSellableForFree = void 0,
250
250
  includeSoldOut = void 0,
251
- orFiltersOperator = void 0
251
+ orFiltersOperator = void 0,
252
+ trackSearchAnalyticsEvent = void 0
252
253
  } = params;
253
254
  const {
254
255
  cached,
@@ -290,7 +291,13 @@ const getProductsByCategory = exports.getProductsByCategory = async function get
290
291
  orFiltersOperator,
291
292
  pricePromotionKey,
292
293
  with: _with ?? context.withParams?.product ?? _constants.MIN_WITH_PARAMS_PRODUCT,
293
- sort
294
+ sort,
295
+ // NOTE: We only pass the parameter value through and don't implement a custom check.
296
+ // The consuming project should not include trackSearchAnalyticsEvent parameter when paginating through
297
+ // results with the page parameter, as this logs the search term on every page request.
298
+ // Instead, log the term only once, when the search is first performed.
299
+ // https://scayle.dev/en/developer-guide/products/search#scayle-search-analytics
300
+ trackSearchAnalyticsEvent
294
301
  });
295
302
  return {
296
303
  products,
@@ -228,7 +228,8 @@ export const getProductsByCategory = async function getProductsByCategory2(param
228
228
  pricePromotionKey = "",
229
229
  includeSellableForFree = void 0,
230
230
  includeSoldOut = void 0,
231
- orFiltersOperator = void 0
231
+ orFiltersOperator = void 0,
232
+ trackSearchAnalyticsEvent = void 0
232
233
  } = params;
233
234
  const { cached, sapiClient, campaignKey } = context;
234
235
  const { category, categoryId } = await resolveCategoryIdFromParams(
@@ -274,7 +275,13 @@ export const getProductsByCategory = async function getProductsByCategory2(param
274
275
  orFiltersOperator,
275
276
  pricePromotionKey,
276
277
  with: _with ?? context.withParams?.product ?? MIN_WITH_PARAMS_PRODUCT,
277
- sort
278
+ sort,
279
+ // NOTE: We only pass the parameter value through and don't implement a custom check.
280
+ // The consuming project should not include trackSearchAnalyticsEvent parameter when paginating through
281
+ // results with the page parameter, as this logs the search term on every page request.
282
+ // Instead, log the term only once, when the search is first performed.
283
+ // https://scayle.dev/en/developer-guide/products/search#scayle-search-analytics
284
+ trackSearchAnalyticsEvent
278
285
  });
279
286
  return {
280
287
  products,
@@ -62,6 +62,7 @@ export type FetchProductsByCategoryParams = {
62
62
  includeSellableForFree?: boolean;
63
63
  includeSoldOut?: boolean;
64
64
  orFiltersOperator?: ProductsSearchEndpointParameters['orFiltersOperator'];
65
+ trackSearchAnalyticsEvent?: boolean;
65
66
  } & ({
66
67
  category?: string;
67
68
  categoryId?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.69.0",
3
+ "version": "7.69.1",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@
85
85
  "@types/crypto-js": "4.2.2",
86
86
  "@types/node": "22.9.0",
87
87
  "@types/webpack-env": "1.18.5",
88
- "@vitest/coverage-v8": "2.1.4",
88
+ "@vitest/coverage-v8": "2.1.5",
89
89
  "dprint": "0.47.5",
90
90
  "eslint": "9.14.0",
91
91
  "eslint-formatter-gitlab": "5.1.0",
@@ -95,7 +95,7 @@
95
95
  "typescript": "5.6.3",
96
96
  "unbuild": "2.0.0",
97
97
  "unstorage": "1.13.1",
98
- "vitest": "2.1.4"
98
+ "vitest": "2.1.5"
99
99
  },
100
100
  "optionalDependencies": {
101
101
  "redis": "4"