@scayle/storefront-core 7.48.2 → 7.49.0

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 +10 -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 +3 -3
  16. package/dist/helpers/advancedAttributeHelpers.d.ts +3 -3
  17. package/dist/helpers/advancedAttributeHelpers.mjs +1 -1
  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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.49.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add optional `state` attribute to order address for US addresses
8
+
9
+ ### Patch Changes
10
+
11
+ - Add better type support for `getFlattenedVariantCrosssellings` with generic type
12
+
3
13
  ## 7.48.2
4
14
 
5
15
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import type { ShopUserAddress, Order, ShopUser, Gender, RpcContext } from '../types';
1
+ import type { Gender, Order, RpcContext, ShopUser, ShopUserAddress } from '../types';
2
2
  interface PaginatedResponse<EntityType> {
3
3
  entities: EntityType[];
4
4
  pagination: {
@@ -1,7 +1,7 @@
1
1
  export interface Cache {
2
2
  set: (key: string, value: any, ttl: number, tags?: string[]) => Promise<void>;
3
- get(key: string): Promise<any>;
4
- has(key: string): Promise<boolean>;
3
+ get: (key: string) => Promise<any>;
4
+ has: (key: string) => Promise<boolean>;
5
5
  purgeTags: (tags: string[]) => Promise<void>;
6
6
  purgeKeys: (keys: string[]) => Promise<void>;
7
7
  purgeAll: () => Promise<void>;
@@ -1,5 +1,5 @@
1
- import { Log } from '../utils';
2
- import { Cache as CacheInterface } from './cache';
1
+ import { type Log } from '../utils';
2
+ import type { Cache as CacheInterface } from './cache';
3
3
  export declare const MINUTE = 60;
4
4
  export type CacheOptions = Partial<{
5
5
  ttl: number;
@@ -1,6 +1,6 @@
1
- import { RedisClientType } from 'redis';
2
- import { Log } from '../../utils';
3
- import { Cache as CacheInterface } from '../../cache/cache';
1
+ import { type RedisClientType } from 'redis';
2
+ import type { Log } from '../../utils';
3
+ import type { Cache as CacheInterface } from '../../cache/cache';
4
4
  export interface RedisOptions {
5
5
  username?: string;
6
6
  password?: string;
@@ -1,5 +1,5 @@
1
1
  import type { Storage } from 'unstorage';
2
- import { Cache as CacheInterface } from '../cache';
2
+ import type { Cache as CacheInterface } from '../cache';
3
3
  export declare class UnstorageCache implements CacheInterface {
4
4
  storage: Storage;
5
5
  prefix: string;
@@ -1,4 +1,4 @@
1
- import { ValuesType } from 'utility-types';
1
+ import type { ValuesType } from 'utility-types';
2
2
  export declare const ExistingItemHandling: {
3
3
  readonly KeepExisting: 0;
4
4
  readonly AddQuantityToExisting: 1;
@@ -1,4 +1,4 @@
1
- import { ValuesType } from 'utility-types';
1
+ import type { ValuesType } from 'utility-types';
2
2
  export declare const HashAlgorithm: {
3
3
  readonly MD5: "md5";
4
4
  readonly SHA256: "sha256";
@@ -1,4 +1,4 @@
1
- import { ValuesType } from 'utility-types';
1
+ import type { ValuesType } from 'utility-types';
2
2
  declare const HttpStatusCode: {
3
3
  /**
4
4
  * The server has received the request headers and the client should proceed to send the request body
@@ -1,4 +1,4 @@
1
- import { ValuesType } from 'utility-types';
1
+ import type { ValuesType } from 'utility-types';
2
2
  export declare const ProductImageType: {
3
3
  readonly MODEL: "model";
4
4
  readonly BUST: "bust";
@@ -1,4 +1,4 @@
1
- import { PromotionEffect } from '../types';
1
+ import type { PromotionEffect } from '../types';
2
2
  export declare const PROMOTION_PAGE_DEFAULT = 1;
3
3
  export declare const PROMOTION_PER_PAGE_DEFAULT = 100;
4
4
  export declare const PromotionEffectType: {
@@ -1,4 +1,4 @@
1
- import { ValuesType } from 'utility-types';
1
+ import type { ValuesType } from 'utility-types';
2
2
  declare const SortName: {
3
3
  readonly TOPSELLER: "topseller";
4
4
  readonly DATE_NEWEST: "date_newest";
@@ -1,4 +1,4 @@
1
- import type { SearchWith, BasketWith, ProductWith, WishlistWith } from '../types';
1
+ import type { BasketWith, ProductWith, SearchWith, WishlistWith } from '../types';
2
2
  declare const DEFAULT_WITH_LISTING: {
3
3
  items: {
4
4
  product: {
@@ -1,4 +1,4 @@
1
- import { HttpStatusCode } from '../constants';
1
+ import type { HttpStatusCode } from '../constants';
2
2
  export declare class BaseError extends Error {
3
3
  statusCode: HttpStatusCode;
4
4
  constructor(name: string, statusCode: HttpStatusCode, description: string);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getFlattenedVariantCrosssellings = exports.getFlattenedMaterialComposition = exports.flattenFieldSet = void 0;
6
+ exports.getFlattenedMaterialComposition = exports.getFlattenAdvancedAttribute = exports.flattenFieldSet = void 0;
7
7
  var _arrayHelpers = require("./arrayHelpers.cjs");
8
8
  var _objectHelpers = require("./objectHelpers.cjs");
9
9
  const flattenFieldSet = fieldSet => {
@@ -17,10 +17,10 @@ const getFlattenedMaterialComposition = materialCompositions => {
17
17
  }));
18
18
  };
19
19
  exports.getFlattenedMaterialComposition = getFlattenedMaterialComposition;
20
- const getFlattenedVariantCrosssellings = variantCrosssellings => {
20
+ const getFlattenAdvancedAttribute = variantCrosssellings => {
21
21
  return variantCrosssellings.map(variantCrossselling => ({
22
22
  ...(0, _arrayHelpers.flattenDeep)(flattenFieldSet(variantCrossselling.fieldSet))[0],
23
23
  values: (0, _arrayHelpers.flattenDeep)(variantCrossselling.groupSet.map(g => flattenFieldSet(g.fieldSet)))
24
24
  }));
25
25
  };
26
- exports.getFlattenedVariantCrosssellings = getFlattenedVariantCrosssellings;
26
+ exports.getFlattenAdvancedAttribute = getFlattenAdvancedAttribute;
@@ -5,8 +5,8 @@ export declare const flattenFieldSet: (fieldSet: FieldSet) => {
5
5
  export declare const getFlattenedMaterialComposition: (materialCompositions: Array<{
6
6
  fieldSet: FieldSet;
7
7
  groupSet: GroupSet;
8
- }>) => {}[];
9
- export declare const getFlattenedVariantCrosssellings: (variantCrosssellings: Array<{
8
+ }>) => object[];
9
+ export declare const getFlattenAdvancedAttribute: <T>(variantCrosssellings: Array<{
10
10
  fieldSet: FieldSet;
11
11
  groupSet: GroupSet;
12
- }>) => {}[];
12
+ }>) => T[];
@@ -11,7 +11,7 @@ export const getFlattenedMaterialComposition = (materialCompositions) => {
11
11
  )
12
12
  }));
13
13
  };
14
- export const getFlattenedVariantCrosssellings = (variantCrosssellings) => {
14
+ export const getFlattenAdvancedAttribute = (variantCrosssellings) => {
15
15
  return variantCrosssellings.map((variantCrossselling) => ({
16
16
  ...flattenDeep(flattenFieldSet(variantCrossselling.fieldSet))[0],
17
17
  values: flattenDeep(
@@ -1,5 +1,5 @@
1
1
  import type { Category, ProductCategory } from '../types/bapi/category';
2
- import { BreadcrumbItem } from '../types/breadcrumb';
2
+ import type { BreadcrumbItem } from '../types/breadcrumb';
3
3
  export declare const getBreadcrumbsFromProductCategories: (categories: ProductCategory[] | Category[]) => BreadcrumbItem[];
4
4
  export declare const getBreadcrumbsFromCategory: (category: Category, activeNode?: Category) => BreadcrumbItem[];
5
5
  export declare const getBreadcrumbsFromPath: (path?: string, shopLocale?: string) => BreadcrumbItem[];
@@ -34,6 +34,19 @@ const transformToWhereCondition = conditions => {
34
34
  return where;
35
35
  };
36
36
  exports.transformToWhereCondition = transformToWhereCondition;
37
+ const _getFilterValueByType = (value, type) => {
38
+ switch (type) {
39
+ case _backbone.FilterTypes.BOOLEAN:
40
+ return value.name;
41
+ case _backbone.FilterTypes.RANGE:
42
+ return {
43
+ min: value.min,
44
+ max: value.max
45
+ };
46
+ default:
47
+ return value.id;
48
+ }
49
+ };
37
50
  const groupFilterableValuesByKey = (filters, filterableKeys, {
38
51
  sortable
39
52
  } = {
@@ -64,15 +77,15 @@ const groupFilterableValuesByKey = (filters, filterableKeys, {
64
77
  return sortable ? transformedAvailableFilters.sort((a, b) => a.displayName.localeCompare(b.displayName)) : transformedAvailableFilters;
65
78
  };
66
79
  exports.groupFilterableValuesByKey = groupFilterableValuesByKey;
67
- const transformStateToFilters = state => {
68
- return Object.values(state).reduce((objectToReturn, filter) => Object.assign(objectToReturn, generateFilterKeyAndValue(filter)), {});
69
- };
70
- exports.transformStateToFilters = transformStateToFilters;
71
80
  const generateFilterKeyAndValue = filter => {
72
81
  return filter.reduce((objectToReturn, f) => Object.assign(objectToReturn, objectToReturn[f.key] ? objectToReturn[f.key].push(f.value) : {
73
82
  [f.key]: [f.value]
74
83
  }), {});
75
84
  };
85
+ const transformStateToFilters = state => {
86
+ return Object.values(state).reduce((objectToReturn, filter) => Object.assign(objectToReturn, generateFilterKeyAndValue(filter)), {});
87
+ };
88
+ exports.transformStateToFilters = transformStateToFilters;
76
89
  const mergeFilters = filters => {
77
90
  const mergedFilter = {};
78
91
  filters.forEach(item => {
@@ -85,6 +98,11 @@ const mergeFilters = filters => {
85
98
  return mergedFilter;
86
99
  };
87
100
  exports.mergeFilters = mergeFilters;
101
+ const isFilterActive = (filters, filterToCheck) => {
102
+ const key = filterToCheck.key;
103
+ return filters[key] && (filters[key].toString() === filterToCheck.value.toString() || Array.isArray(filters[key]) && filters[key].includes(filterToCheck.value));
104
+ };
105
+ exports.isFilterActive = isFilterActive;
88
106
  const getActiveFilters = (filters, activeFilters) => {
89
107
  return [].concat(...Object.values(filters)).filter(item => isFilterActive(activeFilters, item)) || [];
90
108
  };
@@ -118,11 +136,6 @@ const getGroupedFilterableValues = (keys, filterableValues, {
118
136
  }, {});
119
137
  };
120
138
  exports.getGroupedFilterableValues = getGroupedFilterableValues;
121
- const isFilterActive = (filters, filterToCheck) => {
122
- const key = filterToCheck.key;
123
- return filters[key] && (filters[key].toString() === filterToCheck.value.toString() || Array.isArray(filters[key]) && filters[key].includes(filterToCheck.value));
124
- };
125
- exports.isFilterActive = isFilterActive;
126
139
  const getFilterablePriceValue = (filterableValues, key = "min") => {
127
140
  const prices = filterableValues.prices[0];
128
141
  if (!prices) {
@@ -131,19 +144,6 @@ const getFilterablePriceValue = (filterableValues, key = "min") => {
131
144
  return prices.value[key];
132
145
  };
133
146
  exports.getFilterablePriceValue = getFilterablePriceValue;
134
- const _getFilterValueByType = (value, type) => {
135
- switch (type) {
136
- case _backbone.FilterTypes.BOOLEAN:
137
- return value.name;
138
- case _backbone.FilterTypes.RANGE:
139
- return {
140
- min: value.min,
141
- max: value.max
142
- };
143
- default:
144
- return value.id;
145
- }
146
- };
147
147
  const serializeFilters = filter => {
148
148
  if ((0, _radash.isEmpty)(filter)) {
149
149
  return void 0;
@@ -1,13 +1,13 @@
1
1
  import type { ProductSearchQuery } from '@aboutyou/backbone/types/ProductSearchQuery';
2
2
  import type { CentAmount } from '@aboutyou/backbone/types/BapiProduct';
3
3
  import type { ProductFilter } from '../types';
4
- export type TransformedFilter = {
4
+ export interface TransformedFilter {
5
5
  key: string;
6
6
  displayName: string;
7
7
  count: number;
8
8
  value: string | number;
9
9
  whereCondition: Record<string, any>;
10
- };
10
+ }
11
11
  export declare const transformToWhereCondition: (conditions: Record<string, any>) => {
12
12
  minPrice?: ProductSearchQuery['minPrice'];
13
13
  maxPrice?: ProductSearchQuery['maxPrice'];
@@ -32,6 +32,7 @@ export declare const transformStateToFilters: (state: {
32
32
  [key: string]: TransformedFilter[];
33
33
  }) => any;
34
34
  export declare const mergeFilters: (filters: TransformedFilter[]) => Record<string, any>;
35
+ export declare const isFilterActive: (filters: Record<string, any>, filterToCheck: TransformedFilter) => any;
35
36
  export declare const getActiveFilters: (filters: Record<string, any>, activeFilters: Record<string, any>) => TransformedFilter[];
36
37
  export declare const groupFiltersByKey: (filters: TransformedFilter[]) => any[];
37
38
  export declare const transformMinAndMaxPriceToFilter: (prices: (CentAmount | undefined)[]) => any;
@@ -68,7 +69,6 @@ export declare const transformSortToFilter: (sort: string) => {
68
69
  export declare const getGroupedFilterableValues: (keys: Array<string>, filterableValues: ProductFilter[], { sortable }?: {
69
70
  sortable: boolean;
70
71
  }) => Record<string, TransformedFilter[]>;
71
- export declare const isFilterActive: (filters: Record<string, any>, filterToCheck: TransformedFilter) => any;
72
72
  export declare const getFilterablePriceValue: (filterableValues: Record<string, any>, key?: 'min' | 'max') => any;
73
73
  export type SerializedFilter = Record<string, string>;
74
74
  export type Filter = Record<string, string | number | (string | number | null)[]>;
@@ -25,6 +25,16 @@ export const transformToWhereCondition = (conditions) => {
25
25
  });
26
26
  return where;
27
27
  };
28
+ const _getFilterValueByType = (value, type) => {
29
+ switch (type) {
30
+ case FilterTypes.BOOLEAN:
31
+ return value.name;
32
+ case FilterTypes.RANGE:
33
+ return { min: value.min, max: value.max };
34
+ default:
35
+ return value.id;
36
+ }
37
+ };
28
38
  export const groupFilterableValuesByKey = (filters, filterableKeys, { sortable } = { sortable: true }) => {
29
39
  const enabledFilters = filterableKeys ? filters.filter((filter) => filterableKeys.includes(filter.slug)) : filters;
30
40
  const transformedAvailableFilters = enabledFilters.reduce((availableFilters, filter) => {
@@ -52,12 +62,6 @@ export const groupFilterableValuesByKey = (filters, filterableKeys, { sortable }
52
62
  (a, b) => a.displayName.localeCompare(b.displayName)
53
63
  ) : transformedAvailableFilters;
54
64
  };
55
- export const transformStateToFilters = (state) => {
56
- return Object.values(state).reduce(
57
- (objectToReturn, filter) => Object.assign(objectToReturn, generateFilterKeyAndValue(filter)),
58
- {}
59
- );
60
- };
61
65
  const generateFilterKeyAndValue = (filter) => {
62
66
  return filter.reduce(
63
67
  (objectToReturn, f) => Object.assign(
@@ -67,6 +71,12 @@ const generateFilterKeyAndValue = (filter) => {
67
71
  {}
68
72
  );
69
73
  };
74
+ export const transformStateToFilters = (state) => {
75
+ return Object.values(state).reduce(
76
+ (objectToReturn, filter) => Object.assign(objectToReturn, generateFilterKeyAndValue(filter)),
77
+ {}
78
+ );
79
+ };
70
80
  export const mergeFilters = (filters) => {
71
81
  const mergedFilter = {};
72
82
  filters.forEach((item) => {
@@ -78,6 +88,10 @@ export const mergeFilters = (filters) => {
78
88
  });
79
89
  return mergedFilter;
80
90
  };
91
+ export const isFilterActive = (filters, filterToCheck) => {
92
+ const key = filterToCheck.key;
93
+ return filters[key] && (filters[key].toString() === filterToCheck.value.toString() || Array.isArray(filters[key]) && filters[key].includes(filterToCheck.value));
94
+ };
81
95
  export const getActiveFilters = (filters, activeFilters) => {
82
96
  return [].concat(...Object.values(filters)).filter((item) => isFilterActive(activeFilters, item)) || [];
83
97
  };
@@ -105,10 +119,6 @@ export const getGroupedFilterableValues = (keys, filterableValues, { sortable }
105
119
  {}
106
120
  );
107
121
  };
108
- export const isFilterActive = (filters, filterToCheck) => {
109
- const key = filterToCheck.key;
110
- return filters[key] && (filters[key].toString() === filterToCheck.value.toString() || Array.isArray(filters[key]) && filters[key].includes(filterToCheck.value));
111
- };
112
122
  export const getFilterablePriceValue = (filterableValues, key = "min") => {
113
123
  const prices = filterableValues.prices[0];
114
124
  if (!prices) {
@@ -116,16 +126,6 @@ export const getFilterablePriceValue = (filterableValues, key = "min") => {
116
126
  }
117
127
  return prices.value[key];
118
128
  };
119
- const _getFilterValueByType = (value, type) => {
120
- switch (type) {
121
- case FilterTypes.BOOLEAN:
122
- return value.name;
123
- case FilterTypes.RANGE:
124
- return { min: value.min, max: value.max };
125
- default:
126
- return value.id;
127
- }
128
- };
129
129
  export const serializeFilters = (filter) => {
130
130
  if (isEmpty(filter)) {
131
131
  return void 0;
@@ -1,4 +1,4 @@
1
- import { ProductImageType } from '../constants/product';
2
- import { Product, ProductImage } from '../index';
1
+ import type { ProductImageType } from '../constants/product';
2
+ import type { Product, ProductImage } from '../index';
3
3
  export declare function isImageType(type: ProductImageType, image: ProductImage): boolean;
4
4
  export declare const getImageFromList: (images: Product['images'], imageType: string, imageView: string, fallback?: boolean) => ProductImage | null;
@@ -1,4 +1,4 @@
1
- import { Order } from '../types';
1
+ import type { Order } from '../types';
2
2
  export declare const getUniqueItemsFromOrder: (order: Order) => {
3
3
  id?: number | undefined;
4
4
  availableQuantity?: number | undefined;
@@ -5,6 +5,6 @@ export declare const getRowByIndex: (index: number, options?: {
5
5
  }) => number;
6
6
  export declare const getDisruptorsForRow: (row: number, disruptors: {
7
7
  insert_in_row: string;
8
- }[]) => {}[];
8
+ }[]) => object[];
9
9
  export declare const isFirstIndexOfRow: (index: number, columns: number) => boolean;
10
10
  export declare const hasDisruptorAtRow: (row: number, disruptorRows: string[]) => boolean;
@@ -83,6 +83,8 @@ const getAppliedReductionsByCategory = (price, category) => {
83
83
  });
84
84
  };
85
85
  exports.getAppliedReductionsByCategory = getAppliedReductionsByCategory;
86
+ const getSizeFromVariant = (variant, attributeName = "shopSize") => (0, _backbone.getFirstAttributeValue)(variant.attributes, attributeName);
87
+ exports.getSizeFromVariant = getSizeFromVariant;
86
88
  const getSizeFromSpecificVariant = (product, variantId) => {
87
89
  if (!product.variants) {
88
90
  return null;
@@ -95,8 +97,6 @@ const getVariant = (variants, id) => {
95
97
  return variants?.find(variant => variant.id === id);
96
98
  };
97
99
  exports.getVariant = getVariant;
98
- const getSizeFromVariant = (variant, attributeName = "shopSize") => (0, _backbone.getFirstAttributeValue)(variant.attributes, attributeName);
99
- exports.getSizeFromVariant = getSizeFromVariant;
100
100
  const getAllSizesFromVariants = (variantsAttributes, attributeName = "shopSize") => (0, _radash.unique)(variantsAttributes.map(variant => (0, _backbone.getFirstAttributeValue)(variant.attributes, attributeName)).filter(Boolean), it => it?.id);
101
101
  exports.getAllSizesFromVariants = getAllSizesFromVariants;
102
102
  const getProductSiblings = (product, colorAttributeName = "colorDetail") => {
@@ -1,6 +1,6 @@
1
- import { BasketItemPrice } from '@aboutyou/backbone';
1
+ import { type BasketItemPrice } from '@aboutyou/backbone';
2
2
  import type { AppliedReduction, BapiPrice as Price, BapiProduct as Product, Value, Variant } from '@aboutyou/backbone/types/BapiProduct';
3
- import { ProductSibling } from '../types/bapi/product';
3
+ import type { ProductSibling } from '../types/bapi/product';
4
4
  interface Route {
5
5
  path?: string;
6
6
  }
@@ -23,9 +23,9 @@ export declare const getTotalAppliedReductions: (price: {
23
23
  };
24
24
  export declare const getLowestPrice: (variants: Variant[]) => Price;
25
25
  export declare const getAppliedReductionsByCategory: (price: Price | BasketItemPrice, category: AppliedReduction['category']) => AppliedReduction[];
26
+ export declare const getSizeFromVariant: (variant: Variant, attributeName?: string) => Value | undefined;
26
27
  export declare const getSizeFromSpecificVariant: (product: Product, variantId?: number) => Value | null | undefined;
27
28
  export declare const getVariant: (variants: Variant[], id: number) => Variant | undefined;
28
- export declare const getSizeFromVariant: (variant: Variant, attributeName?: string) => Value | undefined;
29
29
  export declare const getAllSizesFromVariants: (variantsAttributes: Variant[], attributeName?: string) => (Value | undefined)[];
30
30
  export declare const getProductSiblings: (product?: Product | null, colorAttributeName?: string) => ProductSibling[];
31
31
  export declare const getProductColors: (product: Product, colorAttributeName?: string) => string[];
@@ -1,4 +1,6 @@
1
- import { getFirstAttributeValue } from "@aboutyou/backbone";
1
+ import {
2
+ getFirstAttributeValue
3
+ } from "@aboutyou/backbone";
2
4
  import { unique } from "radash";
3
5
  import baseSlugify from "slugify";
4
6
  import { ProductImageType } from "../constants/product.mjs";
@@ -62,6 +64,7 @@ export const getAppliedReductionsByCategory = (price, category) => {
62
64
  return reduction.category === category;
63
65
  });
64
66
  };
67
+ export const getSizeFromVariant = (variant, attributeName = "shopSize") => getFirstAttributeValue(variant.attributes, attributeName);
65
68
  export const getSizeFromSpecificVariant = (product, variantId) => {
66
69
  if (!product.variants) {
67
70
  return null;
@@ -72,7 +75,6 @@ export const getSizeFromSpecificVariant = (product, variantId) => {
72
75
  export const getVariant = (variants, id) => {
73
76
  return variants?.find((variant) => variant.id === id);
74
77
  };
75
- export const getSizeFromVariant = (variant, attributeName = "shopSize") => getFirstAttributeValue(variant.attributes, attributeName);
76
78
  export const getAllSizesFromVariants = (variantsAttributes, attributeName = "shopSize") => unique(
77
79
  variantsAttributes.map(
78
80
  (variant) => getFirstAttributeValue(variant.attributes, attributeName)
@@ -174,7 +174,7 @@ function parseBasketError(response) {
174
174
  parsedError.statusCode = response.statusCode;
175
175
  } else {
176
176
  const [error] = response.errors;
177
- parsedError.message = response.errors?.map(error2 => `${error2.operation !== "delete" ? error2.kind + ":" : ""}${error2.operation}:${error2.variantId} - ${error2.message}`).join(" | ");
177
+ parsedError.message = response.errors?.map(error2 => `${error2.operation !== "delete" ? `${error2.kind}:` : ""}${error2.operation}:${error2.variantId} - ${error2.message}`).join(" | ");
178
178
  parsedError.statusCode = error.statusCode;
179
179
  }
180
180
  return parsedError;
@@ -1,5 +1,5 @@
1
- import { AddOrUpdateItemError } from '@aboutyou/backbone/helpers/BapiClient';
2
- import { AddOrUpdateItemType, BasketResponseData, BasketWithOptions, Product, Variant, RpcContext } from '../../../types';
1
+ import type { AddOrUpdateItemError } from '@aboutyou/backbone/helpers/BapiClient';
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
5
  existingItemHandling?: 0 | 1 | 2 | 3 | undefined;
@@ -1,7 +1,5 @@
1
1
  import { BAPIError } from "../../../errors/index.mjs";
2
- import {
3
- assertSession
4
- } from "../../../types/index.mjs";
2
+ import { assertSession } from "../../../types/index.mjs";
5
3
  import {
6
4
  ExistingItemHandling,
7
5
  MIN_WITH_PARAMS_BASKET
@@ -179,7 +177,7 @@ function parseBasketError(response) {
179
177
  } else {
180
178
  const [error] = response.errors;
181
179
  parsedError.message = response.errors?.map(
182
- (error2) => `${error2.operation !== "delete" ? error2.kind + ":" : ""}${error2.operation}:${error2.variantId} - ${error2.message}`
180
+ (error2) => `${error2.operation !== "delete" ? `${error2.kind}:` : ""}${error2.operation}:${error2.variantId} - ${error2.message}`
183
181
  ).join(" | ");
184
182
  parsedError.statusCode = error.statusCode;
185
183
  }
@@ -1,4 +1,4 @@
1
- import { Brand, BrandsEndpointRequestParameters, BrandsEndpointResponseData } from '../../types';
1
+ import type { Brand, BrandsEndpointRequestParameters, BrandsEndpointResponseData } from '../../types';
2
2
  export declare const getBrands: ({ pagination }: BrandsEndpointRequestParameters, { bapiClient, cached }: import("../../types").RpcContext) => Promise<BrandsEndpointResponseData>;
3
3
  export declare const getBrandById: ({ brandId }: {
4
4
  brandId: number;
@@ -1,4 +1,4 @@
1
- import { Category } from '../../types';
1
+ import type { Category } from '../../types';
2
2
  export declare const getRootCategories: ({ children, includeHidden }: {
3
3
  children?: number | undefined;
4
4
  includeHidden?: true | undefined;
@@ -1,4 +1,4 @@
1
- import { Order } from '../../../types';
1
+ import type { Order } from '../../../types';
2
2
  export declare const getOrderById: ({ orderId }: {
3
3
  orderId: number;
4
4
  }, context: import("../../../types").RpcContext) => Promise<Order>;
@@ -1,4 +1,4 @@
1
- import type { UpdatePasswordParams, ShopUser } from '../../../types';
1
+ import type { ShopUser, UpdatePasswordParams } from '../../../types';
2
2
  export declare const updateShopUser: (payload: Partial<ShopUser>, context: import("../../../types").RpcContext) => Promise<{
3
3
  user: ShopUser;
4
4
  }>;
@@ -1,5 +1,5 @@
1
1
  import type { NavigationTree } from '@aboutyou/backbone/types/navigation';
2
2
  import type { NavigationAllEndpointResponseData } from '@aboutyou/backbone/endpoints/navigation/navigation';
3
- import { FetchNavigationTreesParams, FetchNavigationTreeByIdParams } from '../../types';
3
+ import type { FetchNavigationTreeByIdParams, FetchNavigationTreesParams } from '../../types';
4
4
  export declare const fetchAllNavigationTrees: ({ params }: FetchNavigationTreesParams, { bapiClient: { navigation }, cached }: import("../../types").RpcContext) => Promise<NavigationAllEndpointResponseData>;
5
5
  export declare const fetchNavigationTreeById: ({ treeId, params }: FetchNavigationTreeByIdParams, { bapiClient: { navigation }, cached }: import("../../types").RpcContext) => Promise<NavigationTree>;