@scayle/storefront-core 7.58.2 → 7.58.3

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.58.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Upgrades to the new Wishlist from @scayle/storefront-api
8
+ - `getDefaultFractionDigits` will return 2 if `maximumFractionDigits` is not defined
9
+ - Updated dependencies
10
+ - @scayle/storefront-api@17.3.0
11
+
3
12
  ## 7.58.2
4
13
 
5
14
  ### Patch Changes
@@ -2,4 +2,4 @@ import type { Attributes } from '@scayle/storefront-api';
2
2
  export declare const getFirstAttributeValue: (attributes: Attributes | undefined, attributeName: string) => import("@scayle/storefront-api").Value | undefined;
3
3
  export declare const getAttributeValue: (attributes: Attributes | undefined, attributeName: string) => string | undefined;
4
4
  export declare const getAttributeValueTuples: (attributes: Attributes | undefined, attributeName: string) => import("@scayle/storefront-api").Value[];
5
- export declare const getManyAttributeValueTuples: (attributes: Attributes | undefined, attributeNames: string[]) => (import("@scayle/storefront-api").Value | undefined)[];
5
+ export declare const getManyAttributeValueTuples: (attributes: Attributes | undefined, attributeNames: string[]) => import("@scayle/storefront-api").Value[];
@@ -8,9 +8,9 @@ export interface TransformedFilter {
8
8
  whereCondition: Record<string, any>;
9
9
  }
10
10
  export declare const transformToWhereCondition: (conditions: Record<string, any>) => {
11
- minPrice?: ProductSearchQuery['minPrice'];
12
- maxPrice?: ProductSearchQuery['maxPrice'];
13
- attributes: ProductSearchQuery['attributes'];
11
+ minPrice?: ProductSearchQuery["minPrice"];
12
+ maxPrice?: ProductSearchQuery["maxPrice"];
13
+ attributes: ProductSearchQuery["attributes"];
14
14
  };
15
15
  /**
16
16
  * Compute an array of filters that can be used to render the quick filters, for example.
@@ -68,7 +68,7 @@ export declare const transformSortToFilter: (sort: string) => {
68
68
  export declare const getGroupedFilterableValues: (keys: Array<string>, filterableValues: ProductFilter[], { sortable }?: {
69
69
  sortable: boolean;
70
70
  }) => Record<string, TransformedFilter[]>;
71
- export declare const getFilterablePriceValue: (filterableValues: Record<string, any>, key?: 'min' | 'max') => any;
71
+ export declare const getFilterablePriceValue: (filterableValues: Record<string, any>, key?: "min" | "max") => any;
72
72
  export type SerializedFilter = Record<string, string>;
73
73
  export type Filter = Record<string, string | number | (string | number | null)[]>;
74
74
  /**
@@ -1,4 +1,4 @@
1
1
  import type { ProductImageType } from '../constants/product';
2
2
  import type { Product, ProductImage } from '../index';
3
3
  export declare function isImageType(type: ProductImageType, image: ProductImage): boolean;
4
- export declare const getImageFromList: (images: Product['images'], imageType: string, imageView: string, fallback?: boolean) => ProductImage | null;
4
+ export declare const getImageFromList: (images: Product["images"], imageType: string, imageView: string, fallback?: boolean) => ProductImage | null;
@@ -8,6 +8,6 @@ const getDefaultFractionDigits = (locale, currency) => {
8
8
  return new Intl.NumberFormat(locale, {
9
9
  style: "currency",
10
10
  currency
11
- }).resolvedOptions().maximumFractionDigits;
11
+ }).resolvedOptions().maximumFractionDigits ?? 2;
12
12
  };
13
13
  exports.getDefaultFractionDigits = getDefaultFractionDigits;
@@ -2,5 +2,5 @@ export const getDefaultFractionDigits = (locale, currency) => {
2
2
  return new Intl.NumberFormat(locale, {
3
3
  style: "currency",
4
4
  currency
5
- }).resolvedOptions().maximumFractionDigits;
5
+ }).resolvedOptions().maximumFractionDigits ?? 2;
6
6
  };
@@ -1,67 +1,67 @@
1
1
  import type { Order } from '../types';
2
2
  export declare const getUniqueItemsFromOrder: (order: Order) => {
3
- id?: number | undefined;
4
- availableQuantity?: number | undefined;
5
- currency?: string | undefined;
3
+ id?: import("../types").UniqueNumericIdentifierOfTheItem;
4
+ availableQuantity?: import("../types").AvailableQuantityInTheWarehouse;
5
+ currency?: import("../types").CharacterCurrencyCode1;
6
6
  customData?: {
7
7
  [k: string]: unknown;
8
- } | undefined;
9
- deliveryForecast?: import("../types").DeliveryForecastFromWarehouse | undefined;
10
- isManuallyReturnedByCci?: boolean | undefined;
11
- itemGroup?: {
8
+ };
9
+ deliveryForecast?: import("../types").DeliveryForecastFromWarehouse;
10
+ isManuallyReturnedByCci?: import("../types").TheReturnShipmentHasBeenTriggeredByCCI;
11
+ itemGroup?: null | {
12
12
  id: string;
13
13
  isMainItem: boolean;
14
14
  isRequired: boolean;
15
- } | null | undefined;
16
- key: string;
17
- lowestPriorPrice?: {
15
+ };
16
+ key: import("../types").UniqueIdentifierOfTheItem;
17
+ lowestPriorPrice?: null | {
18
18
  relativeDifferenceToPrice: number;
19
19
  withTax: number;
20
- } | null | undefined;
20
+ };
21
21
  merchant?: {
22
- [k: string]: unknown;
23
22
  id: number;
24
- } | undefined;
25
- packageId: number;
23
+ [k: string]: unknown;
24
+ };
25
+ packageId: import("../types").PackageReference;
26
26
  price: {
27
27
  appliedReductions?: {
28
28
  amount: {
29
- absoluteWithTax: number;
29
+ absoluteWithTax: import("../types").ThisFieldRepresentsTheDiscountAmountIncludingTheTaxes1;
30
30
  relative: number;
31
31
  };
32
- category: "voucher" | "sale" | "campaign";
33
- code?: string | undefined;
34
- type: "absolute" | "relative";
35
- }[] | undefined;
36
- overrideWithoutTax?: number | undefined;
37
- overrideWithTax?: number | undefined;
32
+ category: "sale" | "campaign" | "voucher";
33
+ code?: string;
34
+ type: "relative" | "absolute";
35
+ }[];
36
+ overrideWithoutTax?: number;
37
+ overrideWithTax?: number;
38
38
  reference?: {
39
- size?: string | undefined;
40
- unit?: string | undefined;
41
- withTax?: number | undefined;
42
- } | undefined;
39
+ size?: string;
40
+ unit?: string;
41
+ withTax?: number;
42
+ };
43
43
  tax: {
44
44
  [k: string]: {
45
- amount: number;
46
- rate: number;
45
+ amount: import("../types").AbsoluteValueOfTheAppliedTax1;
46
+ rate: import("../types").RelativeValueOfTheAppliedTax;
47
47
  };
48
48
  };
49
- undiscountedWithOutTax?: number | undefined;
50
- undiscountedWithTax?: number | undefined;
51
- withoutTax: number;
52
- withTax: number;
49
+ undiscountedWithOutTax?: import("../types").UndiscountedItemPriceExcludingTaxes;
50
+ undiscountedWithTax?: import("../types").UndiscountedItemPriceIncludingTaxes;
51
+ withoutTax: import("../types").ItemPriceExcludingTaxes1;
52
+ withTax: import("../types").ItemPriceIncludingTaxes1;
53
53
  };
54
54
  product: {
55
55
  [k: string]: unknown;
56
56
  };
57
- reservationKey?: string | undefined;
57
+ reservationKey?: string;
58
58
  status: "available" | "cancelled" | "delivered" | "returned" | "unavailable";
59
59
  variant: {
60
60
  [k: string]: unknown;
61
61
  };
62
- warehouseId?: import("../types").PickingWarehouseId | undefined;
63
- warehousePackageGroupId?: import("../types").WarehousePackageReference | undefined;
64
- createdAt: string;
65
- updatedAt: string;
62
+ warehouseId?: import("../types").PickingWarehouseId;
63
+ warehousePackageGroupId?: import("../types").WarehousePackageReference;
64
+ createdAt: import("../types").TimestampOfItemCreation;
65
+ updatedAt: import("../types").TimestampOfLastItemUpdate;
66
66
  }[] | undefined;
67
67
  export declare const getItemQuantityFromOrder: (order: Order, variantId: number) => number | undefined;
@@ -26,7 +26,7 @@ export declare const getTotalAppliedReductions: (price: {
26
26
  relative: number;
27
27
  };
28
28
  export declare const getLowestPrice: (variants: Variant[]) => VariantPrice;
29
- export declare const getAppliedReductionsByCategory: (price: VariantPrice | BasketItemPrice, category: AppliedReduction['category']) => AppliedReduction[];
29
+ export declare const getAppliedReductionsByCategory: (price: VariantPrice | BasketItemPrice, category: AppliedReduction["category"]) => AppliedReduction[];
30
30
  export declare const getSizeFromVariant: (variant: Variant, attributeName?: string) => Value | undefined;
31
31
  export declare const getSizeFromSpecificVariant: (product: Product, variantId?: number) => Value | null | undefined;
32
32
  export declare const getVariant: (variants: Variant[], id: number) => Variant | undefined;
@@ -39,7 +39,7 @@ export declare const isVariantInStock: (variants: Variant[], size: Value, sizeAt
39
39
  export declare const getAttribute: (product: Product, key: string) => any;
40
40
  export declare const getProductPath: (product: Product) => string;
41
41
  export declare const getCategoriesByRoute: (product: Product | null, route: Route | null) => import("@scayle/storefront-api").ProductCategory[];
42
- export declare const getLatestCategory: (categories?: Product['categories']) => import("@scayle/storefront-api").ProductCategory | undefined;
42
+ export declare const getLatestCategory: (categories?: Product["categories"]) => import("@scayle/storefront-api").ProductCategory | undefined;
43
43
  export declare const getProductAndSiblingsColors: (product: Product, colorAttributeName?: string) => Value[];
44
44
  export declare const getVariantCrosssellingValues: (variants: Variant[] | undefined) => (string | number)[];
45
45
  export {};
@@ -2,24 +2,24 @@ import type { AddOrUpdateItemError } from '@scayle/storefront-api';
2
2
  import type { AddOrUpdateItemType, BasketResponseData, BasketWithOptions, Product, RpcContext, Variant } from '../../../types';
3
3
  import { ExistingItemHandling } from '../../../constants';
4
4
  export declare const addItemToBasket: ({ variantId, promotionId, quantity, displayData, customData, existingItemHandling, itemGroup, with: _with, }: AddOrUpdateItemType & {
5
- existingItemHandling?: 0 | 1 | 2 | 3 | undefined;
6
- with?: BasketWithOptions | undefined;
5
+ existingItemHandling?: ExistingItemHandling;
6
+ with?: BasketWithOptions;
7
7
  }, context: RpcContext) => Promise<BasketResponseData<Product, Variant>>;
8
8
  export declare const addItemsToBasket: (params: {
9
9
  items: AddOrUpdateItemType[];
10
10
  existingItemHandling: ExistingItemHandling;
11
- with?: BasketWithOptions | undefined;
11
+ with?: BasketWithOptions;
12
12
  }, context: RpcContext) => Promise<BasketResponseData<Product, Variant>>;
13
13
  export declare const getBasket: (options: BasketWithOptions | undefined, context: RpcContext) => Promise<BasketResponseData<Product, Variant>>;
14
14
  export declare const removeItemFromBasket: (options: {
15
15
  itemKey: string;
16
- with?: BasketWithOptions | undefined;
16
+ with?: BasketWithOptions;
17
17
  }, context: RpcContext) => Promise<BasketResponseData<Product, Variant>>;
18
18
  export declare const clearBasket: (context: RpcContext) => Promise<boolean>;
19
19
  export declare const mergeBaskets: ({ fromBasketKey, toBasketKey, with: _with }: {
20
20
  fromBasketKey: string;
21
21
  toBasketKey: string;
22
- with?: BasketWithOptions | undefined;
22
+ with?: BasketWithOptions;
23
23
  }, context: RpcContext) => Promise<{
24
24
  type: "failure";
25
25
  statusCode: number;
@@ -1,23 +1,23 @@
1
1
  import type { Category, ProductCategoryPropertyWith } from '../../types';
2
2
  export declare const getRootCategories: ({ children, includeHidden, properties }: {
3
- children?: number | undefined;
4
- includeHidden?: true | undefined;
5
- properties?: ProductCategoryPropertyWith | undefined;
3
+ children?: number;
4
+ includeHidden?: true;
5
+ properties?: ProductCategoryPropertyWith;
6
6
  }, { cached, bapiClient }: import("../../types").RpcContext) => Promise<{
7
7
  categories: Category[];
8
8
  activeNode: undefined;
9
9
  }>;
10
10
  export declare const getCategoryByPath: ({ path, children, includeHidden, properties }: {
11
11
  path: string;
12
- children?: number | undefined;
13
- includeHidden?: true | undefined;
14
- properties?: ProductCategoryPropertyWith | undefined;
12
+ children?: number;
13
+ includeHidden?: true;
14
+ properties?: ProductCategoryPropertyWith;
15
15
  }, context: import("../../types").RpcContext) => Promise<Category>;
16
16
  export declare const getCategoriesByPath: ({ path, children, includeHidden, properties }: {
17
17
  path: string;
18
- children?: number | undefined;
19
- includeHidden?: true | undefined;
20
- properties?: ProductCategoryPropertyWith | undefined;
18
+ children?: number;
19
+ includeHidden?: true;
20
+ properties?: ProductCategoryPropertyWith;
21
21
  }, context: import("../../types").RpcContext) => Promise<{
22
22
  categories: Category[];
23
23
  activeNode: undefined;
@@ -27,7 +27,7 @@ export declare const getCategoriesByPath: ({ path, children, includeHidden, prop
27
27
  }>;
28
28
  export declare const getCategoryById: ({ id, children, includeHidden, properties }: {
29
29
  id: number;
30
- children?: number | undefined;
31
- includeHidden?: true | undefined;
32
- properties?: ProductCategoryPropertyWith | undefined;
30
+ children?: number;
31
+ includeHidden?: true;
32
+ properties?: ProductCategoryPropertyWith;
33
33
  }, context: import("../../types").RpcContext) => Promise<Category>;
@@ -31,7 +31,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
31
31
  carrier,
32
32
  basketId: context.basketKey,
33
33
  campaignKey: context.campaignKey
34
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.1"}`).setProtectedHeader({
34
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.2"}`).setProtectedHeader({
35
35
  alg: "HS256",
36
36
  typ: "JWT"
37
37
  }).sign(secret);
@@ -21,7 +21,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
21
21
  carrier,
22
22
  basketId: context.basketKey,
23
23
  campaignKey: context.campaignKey
24
- }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.1"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
24
+ }).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.58.2"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
25
25
  return {
26
26
  accessToken: refreshedAccessToken,
27
27
  checkoutJwt
@@ -7,7 +7,7 @@ export declare const getProductsCount: ({ category, categoryId, where, includeSo
7
7
  count: number;
8
8
  }>;
9
9
  export declare const fetchAllFiltersForCategory: ({ includedFilters, category }: {
10
- includedFilters?: string[] | undefined;
10
+ includedFilters?: string[];
11
11
  category: {
12
12
  slug: string;
13
13
  id: number;
@@ -4,9 +4,9 @@ type SearchWith = TypeaheadSuggestionsEndpointRequestParameters['with'];
4
4
  /** @deprecated `searchProducts` is deprecated. Please, use `getSuggestions` or `resolve` RPC methods */
5
5
  export declare const searchProducts: ({ term, slug, with: _with, productLimit }: {
6
6
  term: string;
7
- slug?: string | undefined;
7
+ slug?: string;
8
8
  with?: SearchWith;
9
- productLimit?: number | undefined;
9
+ productLimit?: number;
10
10
  }, { cached, bapiClient, withParams }: import("../../types").RpcContext) => Promise<TypeaheadSuggestionsEndpointResponseData>;
11
11
  export declare const getSearchSuggestions: ({ term, with: _with, categoryId }: SearchV2SuggestionsEndpointParameters, { bapiClient, withParams }: import("../../types").RpcContext) => Promise<SearchV2SuggestionsEndpointResponseData>;
12
12
  export declare const resolveSearch: ({ term, with: _with, categoryId }: SearchV2ResolveEndpointParameters, { cached, bapiClient, withParams }: import("../../types").RpcContext) => Promise<import("@scayle/storefront-api").SearchEntity | null>;
@@ -17,6 +17,6 @@ declare const refreshUser: (context: RpcContext) => Promise<{
17
17
  user: ShopUser;
18
18
  }>;
19
19
  declare const getAccessToken: ({ forceTokenRefresh }: {
20
- forceTokenRefresh?: boolean | undefined;
20
+ forceTokenRefresh?: boolean;
21
21
  }, context: RpcContext) => Promise<string | Response>;
22
22
  export { getUser, fetchUser, refreshUser, getAccessToken };
@@ -1,13 +1,13 @@
1
- import type { WishlistResponseData } from '@scayle/storefront-api';
1
+ import type { Wishlist } from '@scayle/storefront-api';
2
2
  import type { RpcContext, WishlistWithOptions } from '../../types';
3
- export declare const getWishlist: (options: WishlistWithOptions | undefined, context: RpcContext) => Promise<WishlistResponseData>;
3
+ export declare const getWishlist: (options: WishlistWithOptions | undefined, context: RpcContext) => Promise<Wishlist>;
4
4
  export declare const addItemToWishlist: (options: {
5
- variantId?: number | undefined;
6
- productId?: number | undefined;
7
- with?: WishlistWithOptions | undefined;
8
- }, context: RpcContext) => Promise<WishlistResponseData | Response>;
5
+ variantId?: number;
6
+ productId?: number;
7
+ with?: WishlistWithOptions;
8
+ }, context: RpcContext) => Promise<Wishlist | Response>;
9
9
  export declare const removeItemFromWishlist: (options: {
10
10
  itemKey: string;
11
- with?: WishlistWithOptions | undefined;
12
- }, context: RpcContext) => Promise<WishlistResponseData>;
13
- export declare const clearWishlist: (context: RpcContext) => Promise<WishlistResponseData>;
11
+ with?: WishlistWithOptions;
12
+ }, context: RpcContext) => Promise<Wishlist>;
13
+ export declare const clearWishlist: (context: RpcContext) => Promise<Wishlist>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.58.2",
3
+ "version": "7.58.3",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -59,9 +59,9 @@
59
59
  "test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit"
60
60
  },
61
61
  "dependencies": {
62
- "@scayle/storefront-api": "17.2.0",
62
+ "@scayle/storefront-api": "17.3.0",
63
63
  "crypto-js": "4.2.0",
64
- "jose": "5.4.1",
64
+ "jose": "5.5.0",
65
65
  "radash": "12.1.0",
66
66
  "slugify": "1.6.6",
67
67
  "ufo": "1.5.3",
@@ -71,7 +71,7 @@
71
71
  "devDependencies": {
72
72
  "@scayle/eslint-config-storefront": "4.2.0",
73
73
  "@types/crypto-js": "4.2.2",
74
- "@types/node": "20.14.7",
74
+ "@types/node": "20.14.9",
75
75
  "@types/webpack-env": "1.18.5",
76
76
  "@vitest/coverage-v8": "1.6.0",
77
77
  "dprint": "0.46.3",
@@ -80,7 +80,7 @@
80
80
  "publint": "0.2.8",
81
81
  "rimraf": "5.0.7",
82
82
  "ts-node": "10.9.2",
83
- "typescript": "5.4.5",
83
+ "typescript": "5.5.2",
84
84
  "unbuild": "2.0.0",
85
85
  "unstorage": "1.10.2",
86
86
  "vitest": "1.6.0"