@scayle/storefront-core 7.48.2 → 7.49.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 (56) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api/customer.d.ts +1 -1
  3. package/dist/cache/cache.d.ts +2 -2
  4. package/dist/cache/cached.d.ts +2 -2
  5. package/dist/cache/providers/redis.d.ts +3 -3
  6. package/dist/cache/providers/unstorage.d.ts +1 -1
  7. package/dist/constants/basket.d.ts +1 -1
  8. package/dist/constants/hash.d.ts +1 -1
  9. package/dist/constants/httpStatus.d.ts +1 -1
  10. package/dist/constants/product.d.ts +1 -1
  11. package/dist/constants/promotion.d.ts +1 -1
  12. package/dist/constants/sorting.d.ts +1 -1
  13. package/dist/constants/withParameters.d.ts +1 -1
  14. package/dist/errors/baseError.d.ts +1 -1
  15. package/dist/helpers/advancedAttributeHelpers.cjs +9 -5
  16. package/dist/helpers/advancedAttributeHelpers.d.ts +7 -3
  17. package/dist/helpers/advancedAttributeHelpers.mjs +7 -4
  18. package/dist/helpers/categoryHelper.d.ts +1 -1
  19. package/dist/helpers/filterHelper.cjs +22 -22
  20. package/dist/helpers/filterHelper.d.ts +3 -3
  21. package/dist/helpers/filterHelper.mjs +20 -20
  22. package/dist/helpers/imageHelpers.d.ts +2 -2
  23. package/dist/helpers/orderHelpers.d.ts +1 -1
  24. package/dist/helpers/productDisruptorHelper.d.ts +1 -1
  25. package/dist/helpers/productHelpers.cjs +2 -2
  26. package/dist/helpers/productHelpers.d.ts +3 -3
  27. package/dist/helpers/productHelpers.mjs +4 -2
  28. package/dist/rpc/methods/basket/basket.cjs +1 -1
  29. package/dist/rpc/methods/basket/basket.d.ts +2 -2
  30. package/dist/rpc/methods/basket/basket.mjs +2 -4
  31. package/dist/rpc/methods/brands.d.ts +1 -1
  32. package/dist/rpc/methods/categories.d.ts +1 -1
  33. package/dist/rpc/methods/checkout/order.d.ts +1 -1
  34. package/dist/rpc/methods/checkout/shopUser.d.ts +1 -1
  35. package/dist/rpc/methods/navigationTrees.d.ts +1 -1
  36. package/dist/rpc/methods/products.cjs +107 -107
  37. package/dist/rpc/methods/products.d.ts +10 -10
  38. package/dist/rpc/methods/products.mjs +92 -92
  39. package/dist/rpc/methods/promotion.d.ts +1 -1
  40. package/dist/rpc/methods/search.cjs +10 -10
  41. package/dist/rpc/methods/search.d.ts +1 -1
  42. package/dist/rpc/methods/search.mjs +10 -10
  43. package/dist/rpc/methods/shopConfiguration.d.ts +2 -2
  44. package/dist/rpc/methods/variants.d.ts +1 -1
  45. package/dist/rpc/methods/wishlist.cjs +16 -16
  46. package/dist/rpc/methods/wishlist.d.ts +1 -1
  47. package/dist/rpc/methods/wishlist.mjs +10 -10
  48. package/dist/types/api/context.d.ts +2 -2
  49. package/dist/types/api/rpc.d.ts +1 -1
  50. package/dist/types/bapi/order.d.ts +2 -0
  51. package/dist/types/bapi/search.d.ts +7 -7
  52. package/dist/types/user.d.ts +6 -6
  53. package/dist/utils/compression.mjs +1 -1
  54. package/dist/utils/log.d.ts +1 -1
  55. package/dist/utils/user.d.ts +1 -1
  56. package/package.json +5 -5
@@ -1,11 +1,11 @@
1
1
  import type { WishlistResponseData } from '@aboutyou/backbone/endpoints/wishlist/getWishlist';
2
2
  import type { RpcContext, WishlistWithOptions } from '../../types';
3
+ export declare const getWishlist: (options: WishlistWithOptions | undefined, context: RpcContext) => Promise<WishlistResponseData>;
3
4
  export declare const addItemToWishlist: (options: {
4
5
  variantId?: number | undefined;
5
6
  productId?: number | undefined;
6
7
  with?: WishlistWithOptions | undefined;
7
8
  }, context: RpcContext) => Promise<WishlistResponseData | Response>;
8
- export declare const getWishlist: (options: WishlistWithOptions | undefined, context: RpcContext) => Promise<WishlistResponseData>;
9
9
  export declare const removeItemFromWishlist: (options: {
10
10
  itemKey: string;
11
11
  with?: WishlistWithOptions | undefined;
@@ -4,6 +4,16 @@ import { unwrap } from "../../utils/response.mjs";
4
4
  function getWithParams(params, context) {
5
5
  return params.with ?? context.withParams?.basket ?? MIN_WITH_PARAMS_WISHLIST;
6
6
  }
7
+ export const getWishlist = async function getWishlist2(options, context) {
8
+ assertSession(context);
9
+ const { bapiClient, campaignKey, wishlistKey } = context;
10
+ const resolvedWith = getWithParams({ with: options }, context);
11
+ return await bapiClient.wishlist.get(wishlistKey, {
12
+ with: resolvedWith,
13
+ campaignKey,
14
+ pricePromotionKey: resolvedWith?.pricePromotionKey ?? ""
15
+ });
16
+ };
7
17
  export const addItemToWishlist = async function addItemToWishlist2(options, context) {
8
18
  assertSession(context);
9
19
  const { bapiClient, campaignKey, wishlistKey } = context;
@@ -30,16 +40,6 @@ export const addItemToWishlist = async function addItemToWishlist2(options, cont
30
40
  return new Response(JSON.stringify({ message }), { status: code });
31
41
  }
32
42
  };
33
- export const getWishlist = async function getWishlist2(options, context) {
34
- assertSession(context);
35
- const { bapiClient, campaignKey, wishlistKey } = context;
36
- const resolvedWith = getWithParams({ with: options }, context);
37
- return await bapiClient.wishlist.get(wishlistKey, {
38
- with: resolvedWith,
39
- campaignKey,
40
- pricePromotionKey: resolvedWith?.pricePromotionKey ?? ""
41
- });
42
- };
43
43
  export const removeItemFromWishlist = async function removeItemFromWishlist2(options, context) {
44
44
  assertSession(context);
45
45
  const { bapiClient, campaignKey, wishlistKey } = context;
@@ -2,8 +2,8 @@ import type { BapiClient } from '@aboutyou/backbone';
2
2
  import type { Log } from '../../utils';
3
3
  import type { CachedType } from '../../cache/cached';
4
4
  import type { ShopUser } from '../user';
5
- import type { WishlistWithOptions, BasketWithOptions, ProductWith, VariantWith, SearchWith, SearchV2With, CategoryWith, ProductCategoryWith } from '../';
6
- import { OAuthTokens, IDPConfig } from './auth';
5
+ import type { BasketWithOptions, CategoryWith, ProductCategoryWith, ProductWith, SearchV2With, SearchWith, VariantWith, WishlistWithOptions } from '../';
6
+ import type { IDPConfig, OAuthTokens } from './auth';
7
7
  export type WithParams = Partial<{
8
8
  basket: BasketWithOptions;
9
9
  wishlist: WishlistWithOptions;
@@ -1,4 +1,4 @@
1
- import { RpcContext } from './context';
1
+ import type { RpcContext } from './context';
2
2
  export type ParamRpcHandler<Params extends Record<string, any>, ResponseType> = (params: Params, context: RpcContext) => Promise<(ResponseType extends undefined ? void : ResponseType) | Response> | ResponseType | Response;
3
3
  export type NoParamRpcHandler<ResponseType> = (context: RpcContext) => Promise<ResponseType | Response> | ResponseType | Response;
4
4
  export type RpcHandler<A, B = void> = B extends void ? NoParamRpcHandler<A> : ParamRpcHandler<A, B>;
@@ -167,6 +167,7 @@ export interface Order {
167
167
  zipCode: string;
168
168
  createdAt: string;
169
169
  updatedAt: string;
170
+ state?: string;
170
171
  };
171
172
  forward?: {
172
173
  /**
@@ -236,6 +237,7 @@ export interface Order {
236
237
  zipCode: string;
237
238
  createdAt: string;
238
239
  updatedAt: string;
240
+ state?: string;
239
241
  };
240
242
  };
241
243
  /**
@@ -1,25 +1,25 @@
1
1
  import type { ProductWith } from '@aboutyou/backbone/types/ProductWith';
2
2
  import type { TypeaheadSuggestionsEndpointRequestParameters } from '@aboutyou/backbone/endpoints/typeahead/typeahead';
3
- import { Query } from '../index';
3
+ import type { Query } from '../index';
4
4
  export type { BrandOrCategorySuggestion, ProductSuggestion, TypeaheadSuggestion, TypeaheadBrandOrCategorySuggestion, TypeaheadProductSuggestion, TypeaheadSuggestionsEndpointResponseData, } from '@aboutyou/backbone/endpoints/typeahead/typeahead';
5
5
  export type { SearchV2With } from '@aboutyou/backbone/endpoints/searchv2/includes';
6
6
  export type { SearchV2SuggestionsEndpointResponseData, SearchV2SuggestionsEndpointParameters, } from '@aboutyou/backbone/endpoints/searchv2/suggestions';
7
7
  export type { SearchV2ResolveEndpointResponseData, SearchV2ResolveEndpointParameters, } from '@aboutyou/backbone/endpoints/searchv2/resolve';
8
8
  export type * from '@aboutyou/backbone/types/Search';
9
- export type SearchInput = {
9
+ export interface SearchInput {
10
10
  term?: Query;
11
11
  slug?: string;
12
12
  productLimit?: number;
13
- };
14
- export type CategoryWith = {
13
+ }
14
+ export interface CategoryWith {
15
15
  parents?: 'all';
16
16
  children?: number;
17
- };
18
- export type SearchOptions = {
17
+ }
18
+ export interface SearchOptions {
19
19
  key?: string;
20
20
  with?: {
21
21
  products?: ProductWith;
22
22
  categories?: CategoryWith;
23
23
  };
24
- };
24
+ }
25
25
  export type SearchWith = TypeaheadSuggestionsEndpointRequestParameters['with'];
@@ -1,10 +1,10 @@
1
- import { UseBasketParams } from './bapi/basket';
2
- import { UseWishlistParams } from './bapi/wishlist';
1
+ import type { UseBasketParams } from './bapi/basket';
2
+ import type { UseWishlistParams } from './bapi/wishlist';
3
3
  export type Gender = 'm' | 'f' | 'd';
4
- export type UpdatePasswordParams = {
4
+ export interface UpdatePasswordParams {
5
5
  oldPassword: string;
6
6
  newPassword: string;
7
- };
7
+ }
8
8
  export interface UseUserParams {
9
9
  key?: string;
10
10
  autoFetch?: boolean;
@@ -92,9 +92,9 @@ export interface ShopUser {
92
92
  };
93
93
  loginShopId?: number;
94
94
  }
95
- export type UseUserFacetParams = {
95
+ export interface UseUserFacetParams {
96
96
  userParams: UseUserParams;
97
97
  basketParams: UseBasketParams;
98
98
  wishlistParams: UseWishlistParams;
99
- };
99
+ }
100
100
  export {};
@@ -1,5 +1,5 @@
1
1
  import { promisify } from "util";
2
- import { gzip, gunzip } from "zlib";
2
+ import { gunzip, gzip } from "zlib";
3
3
  const asyncDeflate = promisify(gzip);
4
4
  const asyncUnzip = promisify(gunzip);
5
5
  export const compress = async (data) => {
@@ -3,7 +3,7 @@ export interface LogEntry {
3
3
  level: LogLevel;
4
4
  space: string;
5
5
  message: string;
6
- data?: Object;
6
+ data?: object;
7
7
  }
8
8
  export type LogHandler = (entry: LogEntry) => void;
9
9
  export interface LogOptions {
@@ -1,4 +1,4 @@
1
- import { BasketWithOptions, RpcContext } from '../types';
1
+ import type { BasketWithOptions, RpcContext } from '../types';
2
2
  export declare const mergeBaskets: (fromBasketKey: string, toBasketKey: string, withOptions: BasketWithOptions, context: RpcContext) => Promise<{
3
3
  type: "failure";
4
4
  statusCode: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.48.2",
3
+ "version": "7.49.1",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -69,13 +69,13 @@
69
69
  "utility-types": "3.11.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@scayle/eslint-config-storefront": "3.2.7",
72
+ "@scayle/eslint-config-storefront": "4.1.0",
73
73
  "@types/crypto-js": "4.2.2",
74
74
  "@types/node": "20.12.7",
75
75
  "@types/webpack-env": "1.18.4",
76
- "@vitest/coverage-v8": "1.5.0",
76
+ "@vitest/coverage-v8": "1.5.1",
77
77
  "dprint": "0.45.1",
78
- "eslint": "8.57.0",
78
+ "eslint": "9.0.0",
79
79
  "eslint-formatter-gitlab": "5.1.0",
80
80
  "publint": "0.2.7",
81
81
  "rimraf": "5.0.5",
@@ -83,7 +83,7 @@
83
83
  "typescript": "5.4.5",
84
84
  "unbuild": "2.0.0",
85
85
  "unstorage": "1.10.2",
86
- "vitest": "1.5.0"
86
+ "vitest": "1.5.1"
87
87
  },
88
88
  "optionalDependencies": {
89
89
  "redis": "4"