@scayle/storefront-core 7.49.4 → 7.50.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 +19 -0
- package/dist/bapi/init.cjs +6 -18
- package/dist/bapi/init.d.ts +9 -9
- package/dist/bapi/init.mjs +6 -18
- package/dist/errors/BAPIError.cjs +2 -2
- package/dist/errors/BAPIError.d.ts +1 -1
- package/dist/errors/BAPIError.mjs +1 -1
- package/dist/helpers/attributeHelpers.cjs +3 -3
- package/dist/helpers/attributeHelpers.d.ts +4 -4
- package/dist/helpers/attributeHelpers.mjs +1 -1
- package/dist/helpers/autobind.d.ts +1 -1
- package/dist/helpers/basketHelpers.d.ts +1 -1
- package/dist/helpers/filterHelper.cjs +4 -4
- package/dist/helpers/filterHelper.d.ts +12 -13
- package/dist/helpers/filterHelper.mjs +1 -1
- package/dist/helpers/imageHelpers.cjs +2 -2
- package/dist/helpers/imageHelpers.mjs +1 -1
- package/dist/helpers/productHelpers.cjs +5 -5
- package/dist/helpers/productHelpers.d.ts +7 -8
- package/dist/helpers/productHelpers.mjs +1 -3
- package/dist/helpers/sortingHelper.cjs +12 -12
- package/dist/helpers/sortingHelper.d.ts +1 -1
- package/dist/helpers/sortingHelper.mjs +1 -1
- package/dist/rpc/methods/basket/basket.d.ts +1 -1
- package/dist/rpc/methods/navigationTrees.d.ts +1 -2
- package/dist/rpc/methods/products.cjs +3 -1
- package/dist/rpc/methods/products.d.ts +11 -2
- package/dist/rpc/methods/products.mjs +3 -1
- package/dist/rpc/methods/search.d.ts +2 -2
- package/dist/rpc/methods/shopConfiguration.d.ts +1 -1
- package/dist/rpc/methods/variants.d.ts +1 -2
- package/dist/rpc/methods/wishlist.d.ts +1 -1
- package/dist/types/api/context.d.ts +2 -2
- package/dist/types/bapi/basket.d.ts +1 -3
- package/dist/types/bapi/brand.d.ts +2 -2
- package/dist/types/bapi/campaign.d.ts +1 -1
- package/dist/types/bapi/category.d.ts +2 -6
- package/dist/types/bapi/filter.d.ts +3 -6
- package/dist/types/bapi/navigation.d.ts +2 -3
- package/dist/types/bapi/product.d.ts +10 -13
- package/dist/types/bapi/productFilter.d.ts +1 -1
- package/dist/types/bapi/promotion.d.ts +2 -2
- package/dist/types/bapi/redirects.d.ts +1 -1
- package/dist/types/bapi/search.d.ts +6 -7
- package/dist/types/bapi/sorting.d.ts +1 -1
- package/dist/types/bapi/variant.d.ts +1 -1
- package/dist/types/bapi/wishlist.d.ts +1 -1
- package/dist/types/index.cjs +31 -11
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.mjs +1 -1
- package/dist/utils/user.d.ts +4 -4
- package/package.json +3 -3
- package/dist/types/bapi/pagination.cjs +0 -1
- package/dist/types/bapi/pagination.d.ts +0 -13
- package/dist/types/bapi/pagination.mjs +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.50.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add missing `BuyXGetYEffect` and `AutomaticDiscountEffect` exports
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @scayle/storefront-api@17.0.1
|
|
10
|
+
|
|
11
|
+
## 7.50.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Upgraded to `@scayle/storefront-api@v17.0.0` and replaced `@aboutyou/backbone`
|
|
16
|
+
|
|
17
|
+
Noticeable changes are:
|
|
18
|
+
|
|
19
|
+
- Rename `BapiClient` to `StorefrontAPIClient`
|
|
20
|
+
- Removed basic auth support from `initBapi`
|
|
21
|
+
|
|
3
22
|
## 7.49.4
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/bapi/init.cjs
CHANGED
|
@@ -4,27 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.init = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
8
8
|
const init = config => {
|
|
9
|
-
|
|
10
|
-
if (config.authentication === "basic") {
|
|
11
|
-
auth = {
|
|
12
|
-
type: config.authentication,
|
|
13
|
-
username: config.username,
|
|
14
|
-
password: config.password
|
|
15
|
-
};
|
|
16
|
-
} else if (config.authentication === "token") {
|
|
17
|
-
auth = {
|
|
18
|
-
type: config.authentication,
|
|
19
|
-
token: config.token
|
|
20
|
-
};
|
|
21
|
-
} else {
|
|
22
|
-
throw new Error("Invalid BAPI authentication type");
|
|
23
|
-
}
|
|
24
|
-
return new _backbone.BapiClient({
|
|
9
|
+
return new _storefrontApi.StorefrontAPIClient({
|
|
25
10
|
host: config.host,
|
|
26
11
|
shopId: config.shopId,
|
|
27
|
-
auth
|
|
12
|
+
auth: {
|
|
13
|
+
type: config.authentication,
|
|
14
|
+
token: config.token
|
|
15
|
+
}
|
|
28
16
|
});
|
|
29
17
|
};
|
|
30
18
|
exports.init = init;
|
package/dist/bapi/init.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { StorefrontAPIClient } from '@scayle/storefront-api';
|
|
2
|
+
interface StorefrontAPIConfig {
|
|
3
3
|
host: string;
|
|
4
4
|
shopId: number;
|
|
5
|
-
} & ({
|
|
6
|
-
authentication: 'basic';
|
|
7
|
-
username: string;
|
|
8
|
-
password: string;
|
|
9
|
-
} | {
|
|
10
5
|
authentication: 'token';
|
|
11
6
|
token: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a new Storefront API Client.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
export declare const init: (config: StorefrontAPIConfig) => StorefrontAPIClient;
|
|
14
14
|
export {};
|
package/dist/bapi/init.mjs
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StorefrontAPIClient } from "@scayle/storefront-api";
|
|
2
2
|
export const init = (config) => {
|
|
3
|
-
|
|
4
|
-
if (config.authentication === "basic") {
|
|
5
|
-
auth = {
|
|
6
|
-
type: config.authentication,
|
|
7
|
-
username: config.username,
|
|
8
|
-
password: config.password
|
|
9
|
-
};
|
|
10
|
-
} else if (config.authentication === "token") {
|
|
11
|
-
auth = {
|
|
12
|
-
type: config.authentication,
|
|
13
|
-
token: config.token
|
|
14
|
-
};
|
|
15
|
-
} else {
|
|
16
|
-
throw new Error("Invalid BAPI authentication type");
|
|
17
|
-
}
|
|
18
|
-
return new BapiClient({
|
|
3
|
+
return new StorefrontAPIClient({
|
|
19
4
|
host: config.host,
|
|
20
5
|
shopId: config.shopId,
|
|
21
|
-
auth
|
|
6
|
+
auth: {
|
|
7
|
+
type: config.authentication,
|
|
8
|
+
token: config.token
|
|
9
|
+
}
|
|
22
10
|
});
|
|
23
11
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BAPIFetchError = exports.BAPIError = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
8
8
|
var _constants = require("../constants/index.cjs");
|
|
9
9
|
var _baseError = require("./baseError.cjs");
|
|
10
10
|
class BAPIError extends _baseError.BaseError {
|
|
@@ -15,4 +15,4 @@ class BAPIError extends _baseError.BaseError {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.BAPIError = BAPIError;
|
|
18
|
-
const BAPIFetchError = exports.BAPIFetchError =
|
|
18
|
+
const BAPIFetchError = exports.BAPIFetchError = _storefrontApi.FetchError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchError } from "@
|
|
1
|
+
import { FetchError } from "@scayle/storefront-api";
|
|
2
2
|
import { HttpStatusCode, HttpStatusMessage } from "../constants/index.mjs";
|
|
3
3
|
import { BaseError } from "./baseError.mjs";
|
|
4
4
|
export class BAPIError extends BaseError {
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getManyAttributeValueTuples = exports.getFirstAttributeValue = exports.getAttributeValueTuples = exports.getAttributeValue = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
8
8
|
const getFirstAttributeValue = (attributes, attributeName) => {
|
|
9
|
-
return (0,
|
|
9
|
+
return (0, _storefrontApi.getFirstAttributeValue)(attributes, attributeName);
|
|
10
10
|
};
|
|
11
11
|
exports.getFirstAttributeValue = getFirstAttributeValue;
|
|
12
12
|
const getAttributeValue = (attributes, attributeName) => {
|
|
@@ -15,7 +15,7 @@ const getAttributeValue = (attributes, attributeName) => {
|
|
|
15
15
|
};
|
|
16
16
|
exports.getAttributeValue = getAttributeValue;
|
|
17
17
|
const getAttributeValueTuples = (attributes, attributeName) => {
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, _storefrontApi.getAttributeValues)(attributes, attributeName);
|
|
19
19
|
};
|
|
20
20
|
exports.getAttributeValueTuples = getAttributeValueTuples;
|
|
21
21
|
const getManyAttributeValueTuples = (attributes, attributeNames) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Attributes } from '@
|
|
2
|
-
export declare const getFirstAttributeValue: (attributes: Attributes | undefined, attributeName: string) => import("@
|
|
1
|
+
import type { Attributes } from '@scayle/storefront-api';
|
|
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
|
-
export declare const getAttributeValueTuples: (attributes: Attributes | undefined, attributeName: string) => import("@
|
|
5
|
-
export declare const getManyAttributeValueTuples: (attributes: Attributes | undefined, attributeNames: string[]) => (import("@
|
|
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)[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAttributeValues as _getAttributeValues,
|
|
3
3
|
getFirstAttributeValue as _getFirstAttributeValue
|
|
4
|
-
} from "@
|
|
4
|
+
} from "@scayle/storefront-api";
|
|
5
5
|
export const getFirstAttributeValue = (attributes, attributeName) => {
|
|
6
6
|
return _getFirstAttributeValue(attributes, attributeName);
|
|
7
7
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BasketPackageInformation } from '@
|
|
1
|
+
import type { BasketPackageInformation } from '@scayle/storefront-api';
|
|
2
2
|
export declare const getShippingDates: (packages: BasketPackageInformation[]) => (string | null)[];
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.transformToWhereCondition = exports.transformStateToFilters = exports.transformSortToFilter = exports.transformMinAndMaxPriceToFilter = exports.serializeFilters = exports.mergeFilters = exports.isFilterActive = exports.groupFiltersByKey = exports.groupFilterableValuesByKey = exports.getGroupedFilterableValues = exports.getFilterablePriceValue = exports.getActiveFilters = exports.deserializeFilters = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
8
8
|
var _radash = require("radash");
|
|
9
9
|
var _sortingHelper = require("./sortingHelper.cjs");
|
|
10
10
|
const transformToWhereCondition = conditions => {
|
|
@@ -36,9 +36,9 @@ const transformToWhereCondition = conditions => {
|
|
|
36
36
|
exports.transformToWhereCondition = transformToWhereCondition;
|
|
37
37
|
const _getFilterValueByType = (value, type) => {
|
|
38
38
|
switch (type) {
|
|
39
|
-
case
|
|
39
|
+
case _storefrontApi.FilterTypes.BOOLEAN:
|
|
40
40
|
return value.name;
|
|
41
|
-
case
|
|
41
|
+
case _storefrontApi.FilterTypes.RANGE:
|
|
42
42
|
return {
|
|
43
43
|
min: value.min,
|
|
44
44
|
max: value.max
|
|
@@ -55,7 +55,7 @@ const groupFilterableValuesByKey = (filters, filterableKeys, {
|
|
|
55
55
|
const enabledFilters = filterableKeys ? filters.filter(filter => filterableKeys.includes(filter.slug)) : filters;
|
|
56
56
|
const transformedAvailableFilters = enabledFilters.reduce((availableFilters, filter) => {
|
|
57
57
|
filter.values.forEach(value => {
|
|
58
|
-
const isBoolean = filter.type ===
|
|
58
|
+
const isBoolean = filter.type === _storefrontApi.FilterTypes.BOOLEAN;
|
|
59
59
|
const hasNameInValue = ("name" in value);
|
|
60
60
|
if (isBoolean && hasNameInValue && value.name === false) {
|
|
61
61
|
return;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ProductSearchQuery } from '@
|
|
2
|
-
import type { CentAmount } from '@aboutyou/backbone/types/BapiProduct';
|
|
1
|
+
import type { CentAmount, ProductSearchQuery } from '@scayle/storefront-api';
|
|
3
2
|
import type { ProductFilter } from '../types';
|
|
4
3
|
export interface TransformedFilter {
|
|
5
4
|
key: string;
|
|
@@ -37,32 +36,32 @@ export declare const getActiveFilters: (filters: Record<string, any>, activeFilt
|
|
|
37
36
|
export declare const groupFiltersByKey: (filters: TransformedFilter[]) => any[];
|
|
38
37
|
export declare const transformMinAndMaxPriceToFilter: (prices: (CentAmount | undefined)[]) => any;
|
|
39
38
|
export declare const transformSortToFilter: (sort: string) => {
|
|
40
|
-
by: import("@
|
|
41
|
-
direction: import("@
|
|
39
|
+
by: import("@scayle/storefront-api").APISortOption;
|
|
40
|
+
direction: import("@scayle/storefront-api").APISortOrder;
|
|
42
41
|
name: "topseller";
|
|
43
42
|
query: "topseller";
|
|
44
43
|
} | {
|
|
45
|
-
by: import("@
|
|
44
|
+
by: import("@scayle/storefront-api").APISortOption;
|
|
46
45
|
name: "date_newest";
|
|
47
46
|
query: "date-newest";
|
|
48
47
|
} | {
|
|
49
|
-
by: import("@
|
|
50
|
-
direction: import("@
|
|
48
|
+
by: import("@scayle/storefront-api").APISortOption;
|
|
49
|
+
direction: import("@scayle/storefront-api").APISortOrder;
|
|
51
50
|
name: "price_desc";
|
|
52
51
|
query: "price-desc";
|
|
53
52
|
} | {
|
|
54
|
-
by: import("@
|
|
55
|
-
direction: import("@
|
|
53
|
+
by: import("@scayle/storefront-api").APISortOption;
|
|
54
|
+
direction: import("@scayle/storefront-api").APISortOrder;
|
|
56
55
|
name: "price_asc";
|
|
57
56
|
query: "price-asc";
|
|
58
57
|
} | {
|
|
59
|
-
by: import("@
|
|
60
|
-
direction: import("@
|
|
58
|
+
by: import("@scayle/storefront-api").APISortOption;
|
|
59
|
+
direction: import("@scayle/storefront-api").APISortOrder;
|
|
61
60
|
name: "reduction_desc";
|
|
62
61
|
query: "reduction-desc";
|
|
63
62
|
} | {
|
|
64
|
-
by: import("@
|
|
65
|
-
direction: import("@
|
|
63
|
+
by: import("@scayle/storefront-api").APISortOption;
|
|
64
|
+
direction: import("@scayle/storefront-api").APISortOrder;
|
|
66
65
|
name: "reduction_asc";
|
|
67
66
|
query: "reduction-asc";
|
|
68
67
|
};
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getImageFromList = void 0;
|
|
7
7
|
exports.isImageType = isImageType;
|
|
8
|
-
var
|
|
8
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
9
9
|
var _attributeHelpers = require("./attributeHelpers.cjs");
|
|
10
10
|
function isImageType(type, image) {
|
|
11
|
-
const attributeValue = (0,
|
|
11
|
+
const attributeValue = (0, _storefrontApi.getFirstAttributeValue)(image.attributes, "imageType");
|
|
12
12
|
if (attributeValue) {
|
|
13
13
|
return attributeValue.value === type;
|
|
14
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getFirstAttributeValue } from "@
|
|
1
|
+
import { getFirstAttributeValue } from "@scayle/storefront-api";
|
|
2
2
|
import { getAttributeValue } from "./attributeHelpers.mjs";
|
|
3
3
|
export function isImageType(type, image) {
|
|
4
4
|
const attributeValue = getFirstAttributeValue(image.attributes, "imageType");
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.slugify = exports.isVariantInStock = exports.isInStock = exports.getVariantCrosssellingValues = exports.getVariantBySize = exports.getVariant = exports.getTotalAppliedReductions = exports.getSizeFromVariant = exports.getSizeFromSpecificVariant = exports.getProductSiblings = exports.getProductPath = exports.getProductColors = exports.getProductAndSiblingsColors = exports.getPrice = exports.getOriginalPrice = exports.getLowestPrice = exports.getLatestCategory = exports.getCategoriesByRoute = exports.getBadgeLabel = exports.getAttribute = exports.getAppliedReductionsByCategory = exports.getAllSizesFromVariants = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
8
8
|
var _radash = require("radash");
|
|
9
9
|
var _slugify = _interopRequireDefault(require("slugify"));
|
|
10
10
|
var _product = require("../constants/product.cjs");
|
|
@@ -83,7 +83,7 @@ const getAppliedReductionsByCategory = (price, category) => {
|
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
85
|
exports.getAppliedReductionsByCategory = getAppliedReductionsByCategory;
|
|
86
|
-
const getSizeFromVariant = (variant, attributeName = "shopSize") => (0,
|
|
86
|
+
const getSizeFromVariant = (variant, attributeName = "shopSize") => (0, _storefrontApi.getFirstAttributeValue)(variant.attributes, attributeName);
|
|
87
87
|
exports.getSizeFromVariant = getSizeFromVariant;
|
|
88
88
|
const getSizeFromSpecificVariant = (product, variantId) => {
|
|
89
89
|
if (!product.variants) {
|
|
@@ -97,7 +97,7 @@ const getVariant = (variants, id) => {
|
|
|
97
97
|
return variants?.find(variant => variant.id === id);
|
|
98
98
|
};
|
|
99
99
|
exports.getVariant = getVariant;
|
|
100
|
-
const getAllSizesFromVariants = (variantsAttributes, attributeName = "shopSize") => (0, _radash.unique)(variantsAttributes.map(variant => (0,
|
|
100
|
+
const getAllSizesFromVariants = (variantsAttributes, attributeName = "shopSize") => (0, _radash.unique)(variantsAttributes.map(variant => (0, _storefrontApi.getFirstAttributeValue)(variant.attributes, attributeName)).filter(Boolean), it => it?.id);
|
|
101
101
|
exports.getAllSizesFromVariants = getAllSizesFromVariants;
|
|
102
102
|
const getProductSiblings = (product, colorAttributeName = "colorDetail") => {
|
|
103
103
|
if (!product) {
|
|
@@ -170,8 +170,8 @@ const getLatestCategory = categories => {
|
|
|
170
170
|
};
|
|
171
171
|
exports.getLatestCategory = getLatestCategory;
|
|
172
172
|
const getProductAndSiblingsColors = (product, colorAttributeName = "colorDetail") => {
|
|
173
|
-
const productColor = (0,
|
|
174
|
-
const siblingsColors = (product.siblings ?? []).filter(sibling => sibling.isActive).map(sibling => (0,
|
|
173
|
+
const productColor = (0, _storefrontApi.getFirstAttributeValue)(product.attributes, colorAttributeName);
|
|
174
|
+
const siblingsColors = (product.siblings ?? []).filter(sibling => sibling.isActive).map(sibling => (0, _storefrontApi.getFirstAttributeValue)(sibling.attributes, colorAttributeName));
|
|
175
175
|
return [productColor, ...siblingsColors].filter(color => !!color);
|
|
176
176
|
};
|
|
177
177
|
exports.getProductAndSiblingsColors = getProductAndSiblingsColors;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { AppliedReduction, BapiPrice as Price, BapiProduct as Product, Value, Variant } from '@aboutyou/backbone/types/BapiProduct';
|
|
1
|
+
import type { AppliedReduction, BasketItemPrice, Product, Value, Variant, VariantPrice } from '@scayle/storefront-api';
|
|
3
2
|
import type { ProductSibling } from '../types/bapi/product';
|
|
4
3
|
interface Route {
|
|
5
4
|
path?: string;
|
|
6
5
|
}
|
|
7
6
|
export declare const slugify: (url: string | undefined) => string;
|
|
8
|
-
export declare const getPrice: (variant: Variant) =>
|
|
7
|
+
export declare const getPrice: (variant: Variant) => VariantPrice;
|
|
9
8
|
type BadgeLabelParamsKeys = 'isNew' | 'isSoldOut' | 'isOnlineOnly' | 'isSustainable' | 'isPremium';
|
|
10
9
|
type BadgeLabelParams = Partial<Record<BadgeLabelParamsKeys, boolean>>;
|
|
11
10
|
/**
|
|
@@ -14,7 +13,7 @@ type BadgeLabelParams = Partial<Record<BadgeLabelParamsKeys, boolean>>;
|
|
|
14
13
|
* @deprecated
|
|
15
14
|
*/
|
|
16
15
|
export declare const getBadgeLabel: (params?: BadgeLabelParams) => string;
|
|
17
|
-
export declare const getOriginalPrice: (price:
|
|
16
|
+
export declare const getOriginalPrice: (price: VariantPrice) => number;
|
|
18
17
|
export declare const getTotalAppliedReductions: (price: {
|
|
19
18
|
appliedReductions: {
|
|
20
19
|
amount: {
|
|
@@ -26,8 +25,8 @@ export declare const getTotalAppliedReductions: (price: {
|
|
|
26
25
|
absoluteWithTax: number;
|
|
27
26
|
relative: number;
|
|
28
27
|
};
|
|
29
|
-
export declare const getLowestPrice: (variants: Variant[]) =>
|
|
30
|
-
export declare const getAppliedReductionsByCategory: (price:
|
|
28
|
+
export declare const getLowestPrice: (variants: Variant[]) => VariantPrice;
|
|
29
|
+
export declare const getAppliedReductionsByCategory: (price: VariantPrice | BasketItemPrice, category: AppliedReduction['category']) => AppliedReduction[];
|
|
31
30
|
export declare const getSizeFromVariant: (variant: Variant, attributeName?: string) => Value | undefined;
|
|
32
31
|
export declare const getSizeFromSpecificVariant: (product: Product, variantId?: number) => Value | null | undefined;
|
|
33
32
|
export declare const getVariant: (variants: Variant[], id: number) => Variant | undefined;
|
|
@@ -39,8 +38,8 @@ export declare const isInStock: (variant: Variant) => boolean;
|
|
|
39
38
|
export declare const isVariantInStock: (variants: Variant[], size: Value, sizeAttributeName?: string) => boolean;
|
|
40
39
|
export declare const getAttribute: (product: Product, key: string) => any;
|
|
41
40
|
export declare const getProductPath: (product: Product) => string;
|
|
42
|
-
export declare const getCategoriesByRoute: (product: Product | null, route: Route | null) => import("@
|
|
43
|
-
export declare const getLatestCategory: (categories?: Product['categories']) => import("@
|
|
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;
|
|
44
43
|
export declare const getProductAndSiblingsColors: (product: Product, colorAttributeName?: string) => Value[];
|
|
45
44
|
export declare const getVariantCrosssellingValues: (variants: Variant[] | undefined) => (string | number)[];
|
|
46
45
|
export {};
|
|
@@ -4,42 +4,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getSortingValues = exports.getSortByValue = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
8
8
|
var _radash = require("radash");
|
|
9
9
|
var _sorting = require("../constants/sorting.cjs");
|
|
10
10
|
const SORTING_VALUES = {
|
|
11
11
|
topSeller: {
|
|
12
|
-
by:
|
|
13
|
-
direction:
|
|
12
|
+
by: _storefrontApi.APISortOption.Price,
|
|
13
|
+
direction: _storefrontApi.APISortOrder.Descending,
|
|
14
14
|
name: _sorting.SortName.TOPSELLER,
|
|
15
15
|
query: _sorting.SortQuery.TOPSELLER
|
|
16
16
|
},
|
|
17
17
|
dateNewest: {
|
|
18
|
-
by:
|
|
18
|
+
by: _storefrontApi.APISortOption.DateAdded,
|
|
19
19
|
name: _sorting.SortName.DATE_NEWEST,
|
|
20
20
|
query: _sorting.SortQuery.DATE_NEWEST
|
|
21
21
|
},
|
|
22
22
|
priceDesc: {
|
|
23
|
-
by:
|
|
24
|
-
direction:
|
|
23
|
+
by: _storefrontApi.APISortOption.Price,
|
|
24
|
+
direction: _storefrontApi.APISortOrder.Descending,
|
|
25
25
|
name: _sorting.SortName.PRICE_DESC,
|
|
26
26
|
query: _sorting.SortQuery.PRICE_DESC
|
|
27
27
|
},
|
|
28
28
|
priceAsc: {
|
|
29
|
-
by:
|
|
30
|
-
direction:
|
|
29
|
+
by: _storefrontApi.APISortOption.Price,
|
|
30
|
+
direction: _storefrontApi.APISortOrder.Ascending,
|
|
31
31
|
name: _sorting.SortName.PRICE_ASC,
|
|
32
32
|
query: _sorting.SortQuery.PRICE_ASC
|
|
33
33
|
},
|
|
34
34
|
reductionDesc: {
|
|
35
|
-
by:
|
|
36
|
-
direction:
|
|
35
|
+
by: _storefrontApi.APISortOption.Reduction,
|
|
36
|
+
direction: _storefrontApi.APISortOrder.Descending,
|
|
37
37
|
name: _sorting.SortName.REDUCTION_DESC,
|
|
38
38
|
query: _sorting.SortQuery.REDUCTION_DESC
|
|
39
39
|
},
|
|
40
40
|
reductionAsc: {
|
|
41
|
-
by:
|
|
42
|
-
direction:
|
|
41
|
+
by: _storefrontApi.APISortOption.Reduction,
|
|
42
|
+
direction: _storefrontApi.APISortOrder.Ascending,
|
|
43
43
|
name: _sorting.SortName.REDUCTION_ASC,
|
|
44
44
|
query: _sorting.SortQuery.REDUCTION_ASC
|
|
45
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APISortOption, APISortOrder } from '@
|
|
1
|
+
import { APISortOption, APISortOrder } from '@scayle/storefront-api';
|
|
2
2
|
import type { Query, SortingValueKey } from '../index';
|
|
3
3
|
export declare const getSortingValues: (options?: Array<SortingValueKey>) => Pick<{
|
|
4
4
|
topSeller: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AddOrUpdateItemError } from '@
|
|
1
|
+
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 & {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { NavigationTree } from '@
|
|
2
|
-
import type { NavigationAllEndpointResponseData } from '@aboutyou/backbone/endpoints/navigation/navigation';
|
|
1
|
+
import type { NavigationAllEndpointResponseData, NavigationTree } from '@scayle/storefront-api';
|
|
3
2
|
import type { FetchNavigationTreeByIdParams, FetchNavigationTreesParams } from '../../types';
|
|
4
3
|
export declare const fetchAllNavigationTrees: ({ params }: FetchNavigationTreesParams, { bapiClient: { navigation }, cached }: import("../../types").RpcContext) => Promise<NavigationAllEndpointResponseData>;
|
|
5
4
|
export declare const fetchNavigationTreeById: ({ treeId, params }: FetchNavigationTreeByIdParams, { bapiClient: { navigation }, cached }: import("../../types").RpcContext) => Promise<NavigationTree>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FiltersEndpointResponseData } from '@
|
|
1
|
+
import type { FiltersEndpointResponseData } from '@scayle/storefront-api';
|
|
2
2
|
import type { FetchFiltersParams, FetchProductParams, FetchProductsByCategoryParams, FetchProductsByIdsParams, FetchProductsByReferenceKeysParams, FetchProductsCountParams, Product, RpcContext } from '../../types';
|
|
3
3
|
export declare const getProductById: (options: FetchProductParams, { bapiClient, cached, campaignKey, withParams }: RpcContext) => Promise<Product>;
|
|
4
4
|
export declare const getProductsByIds: (options: FetchProductsByIdsParams, { bapiClient, cached, campaignKey, withParams }: RpcContext) => Promise<Product[]>;
|
|
@@ -19,5 +19,14 @@ export declare const getFilters: ({ category, includedFilters, where, includeSol
|
|
|
19
19
|
}>;
|
|
20
20
|
export declare const getProductsByCategory: ({ category, cache, with: _with, perPage, page, where, sort, pricePromotionKey, includeSellableForFree, includeSoldOut, orFiltersOperator, }: FetchProductsByCategoryParams, context: RpcContext) => Promise<{
|
|
21
21
|
products: Product[];
|
|
22
|
-
pagination:
|
|
22
|
+
pagination: {
|
|
23
|
+
current: number;
|
|
24
|
+
total: number;
|
|
25
|
+
perPage: number;
|
|
26
|
+
page: number;
|
|
27
|
+
first: number;
|
|
28
|
+
prev: number;
|
|
29
|
+
next: number;
|
|
30
|
+
last: number;
|
|
31
|
+
};
|
|
23
32
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TypeaheadSuggestionsEndpointRequestParameters, TypeaheadSuggestionsEndpointResponseData } from '@
|
|
1
|
+
import type { TypeaheadSuggestionsEndpointRequestParameters, TypeaheadSuggestionsEndpointResponseData } from '@scayle/storefront-api';
|
|
2
2
|
import type { SearchV2ResolveEndpointParameters, SearchV2SuggestionsEndpointParameters, SearchV2SuggestionsEndpointResponseData } from '../../types/bapi/search';
|
|
3
3
|
type SearchWith = TypeaheadSuggestionsEndpointRequestParameters['with'];
|
|
4
4
|
/** @deprecated `searchProducts` is deprecated. Please, use `getSuggestions` or `resolve` RPC methods */
|
|
@@ -9,5 +9,5 @@ export declare const searchProducts: ({ term, slug, with: _with, productLimit }:
|
|
|
9
9
|
productLimit?: number | undefined;
|
|
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
|
-
export declare const resolveSearch: ({ term, with: _with, categoryId }: SearchV2ResolveEndpointParameters, { cached, bapiClient, withParams }: import("../../types").RpcContext) => Promise<import("@
|
|
12
|
+
export declare const resolveSearch: ({ term, with: _with, categoryId }: SearchV2ResolveEndpointParameters, { cached, bapiClient, withParams }: import("../../types").RpcContext) => Promise<import("@scayle/storefront-api").SearchEntity | null>;
|
|
13
13
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ShopConfigurationResponseData } from '@
|
|
1
|
+
import type { ShopConfigurationResponseData } from '@scayle/storefront-api';
|
|
2
2
|
import type { RpcContext } from '../../types';
|
|
3
3
|
declare const getShopConfiguration: ({ cached, bapiClient }: RpcContext) => Promise<ShopConfigurationResponseData>;
|
|
4
4
|
export { getShopConfiguration };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ProductWith } from '@
|
|
2
|
-
import type { VariantDetail } from '@aboutyou/backbone/endpoints/variants/variantsByIds';
|
|
1
|
+
import type { ProductWith, VariantDetail } from '@scayle/storefront-api';
|
|
3
2
|
import type { RpcContext } from '../../types';
|
|
4
3
|
export interface FetchVariantsParams {
|
|
5
4
|
ids: number[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WishlistResponseData } from '@
|
|
1
|
+
import type { WishlistResponseData } from '@scayle/storefront-api';
|
|
2
2
|
import type { RpcContext, WishlistWithOptions } from '../../types';
|
|
3
3
|
export declare const getWishlist: (options: WishlistWithOptions | undefined, context: RpcContext) => Promise<WishlistResponseData>;
|
|
4
4
|
export declare const addItemToWishlist: (options: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StorefrontAPIClient } from '@scayle/storefront-api';
|
|
2
2
|
import type { Log } from '../../utils';
|
|
3
3
|
import type { CachedType } from '../../cache/cached';
|
|
4
4
|
import type { ShopUser } from '../user';
|
|
@@ -54,7 +54,7 @@ export type RpcContext = {
|
|
|
54
54
|
*/
|
|
55
55
|
cbdExpiration?: number;
|
|
56
56
|
};
|
|
57
|
-
bapiClient:
|
|
57
|
+
bapiClient: StorefrontAPIClient;
|
|
58
58
|
cached: CachedType;
|
|
59
59
|
isCmsPreview: boolean;
|
|
60
60
|
shopId: number;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { CreateBasketItemParameters } from '@
|
|
2
|
-
import type { BasketItemDisplayData, BasketItemDisplayDataKey, BasketResponseData, BasketWith, BaskteItemDisplayDataItem, ItemGroup } from '@aboutyou/backbone/endpoints/basket/getBasket';
|
|
3
|
-
import type { BasketResponse } from '@aboutyou/backbone/helpers/BapiClient';
|
|
1
|
+
import type { BasketItemDisplayData, BasketItemDisplayDataKey, BasketResponse, BasketResponseData, BasketWith, BaskteItemDisplayDataItem, CreateBasketItemParameters, ItemGroup } from '@scayle/storefront-api';
|
|
4
2
|
export type BasketCustomData = Pick<CreateBasketItemParameters, 'customData'>;
|
|
5
3
|
export type BasketDisplayData = Partial<Record<BasketItemDisplayDataKey, BaskteItemDisplayDataItem>>;
|
|
6
4
|
export type { BasketItemDisplayData, BaskteItemDisplayDataItem, BasketResponseData, BasketWith, BasketResponse, ItemGroup, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { Brand, BrandCustomData } from '@
|
|
2
|
-
export type { BrandsEndpointRequestParameters, BrandsEndpointResponseData, } from '@
|
|
1
|
+
export type { Brand, BrandCustomData } from '@scayle/storefront-api';
|
|
2
|
+
export type { BrandsEndpointRequestParameters, BrandsEndpointResponseData, } from '@scayle/storefront-api';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Campaign } from '@
|
|
1
|
+
export type { Campaign } from '@scayle/storefront-api';
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { ProductCategoryWith } from '@aboutyou/backbone/types/ProductWith';
|
|
4
|
-
export type { BapiCategory as Category };
|
|
5
|
-
export type { BapiProductCategory as ProductCategory };
|
|
6
|
-
export type { ProductCategoryWith };
|
|
1
|
+
import type { Category, ProductCategory, ProductCategoryWith } from '@scayle/storefront-api';
|
|
2
|
+
export type { ProductCategoryWith, ProductCategory, Category };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { ProductSortConfig, ProductsSearchEndpointParameters } from '@
|
|
2
|
-
import type { ProductSearchQuery } from '@aboutyou/backbone/types/ProductSearchQuery';
|
|
3
|
-
import type { AttributeWithBooleanValueFilter, AttributeWithValuesFilter } from '@aboutyou/backbone/types/AttributeOrAttributeValueFilter';
|
|
4
|
-
import type { FiltersEndpointResponseData } from '@aboutyou/backbone/endpoints/filters/filters';
|
|
1
|
+
import type { AttributeWithBooleanValueFilter, AttributeWithValuesFilter, FiltersEndpointResponseData, ProductSearchQuery, ProductSortConfig, ProductsSearchEndpointParameters } from '@scayle/storefront-api';
|
|
5
2
|
import type { Query } from './router';
|
|
6
|
-
export type { AttributesFilterItemWithValues } from '@
|
|
7
|
-
export type { AttributeWithBooleanValueFilter, AttributeWithValuesFilter, AttributeKey, } from '@
|
|
3
|
+
export type { AttributesFilterItemWithValues } from '@scayle/storefront-api';
|
|
4
|
+
export type { AttributeWithBooleanValueFilter, AttributeWithValuesFilter, AttributeKey, } from '@scayle/storefront-api';
|
|
8
5
|
export interface FilterParams {
|
|
9
6
|
page?: number;
|
|
10
7
|
perPage?: number;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { GetNavigationParameters } from '@
|
|
2
|
-
|
|
3
|
-
export type { NavigationItems, NavigationTree, NavigationItemExternal, NavigationItemPage, NavigationItemCategory, } from '@aboutyou/backbone/types/navigation';
|
|
1
|
+
import type { GetNavigationParameters, NavigationItems } from '@scayle/storefront-api';
|
|
2
|
+
export type { NavigationItems, NavigationTree, NavigationItemExternal, NavigationItemPage, NavigationItemCategory, } from '@scayle/storefront-api';
|
|
4
3
|
export type NavigationTreeItem = NavigationItems[0];
|
|
5
4
|
export interface FetchNavigationTreesParams {
|
|
6
5
|
params?: GetNavigationParameters;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import type { ProductSearchQuery } from '@
|
|
2
|
-
import type { ProductWith, VariantWith } from '@aboutyou/backbone/types/ProductWith';
|
|
3
|
-
import type { BapiProduct as Product, ProductImage, ProductsSearchEndpointParameters, Value } from '@aboutyou/backbone';
|
|
1
|
+
import type { Product, ProductImage, ProductSearchQuery, ProductWith, ProductsByIdsEndpointResponseData, ProductsSearchEndpointParameters, Value, VariantWith } from '@scayle/storefront-api';
|
|
4
2
|
import type { CacheOptions } from '../../cache';
|
|
5
3
|
import type { FilterParams } from './filter';
|
|
6
|
-
|
|
7
|
-
export type {
|
|
8
|
-
export type {
|
|
9
|
-
export type {
|
|
10
|
-
export type {
|
|
11
|
-
export type {
|
|
12
|
-
export type { ProductSortConfig, ProductsSearchEndpointParameters, ProductsSearchEndpointResponseData, } from '@aboutyou/backbone/endpoints/products/products';
|
|
4
|
+
export type { AttributeGroup, AttributeGroupSingle, AttributeGroupMulti, RFC33339Date, } from '@scayle/storefront-api';
|
|
5
|
+
export type { ProductImage, Value } from '@scayle/storefront-api';
|
|
6
|
+
export type { BasketItem, BasketTotalPrice } from '@scayle/storefront-api';
|
|
7
|
+
export type { WishlistItem } from '@scayle/storefront-api';
|
|
8
|
+
export type { AdvancedAttribute, AdvancedAttributes, Attributes, Product, VariantPrice as Price, CentAmount, Stock, Variant, LowestPriorPrice, AppliedReduction, } from '@scayle/storefront-api';
|
|
9
|
+
export type { ProductSortConfig, ProductsSearchEndpointParameters, ProductsSearchEndpointResponseData, } from '@scayle/storefront-api';
|
|
13
10
|
export type { ProductWith, VariantWith, ProductSearchQuery };
|
|
14
11
|
export type VariantId = number;
|
|
15
12
|
export type FieldSet = Array<Array<{
|
|
@@ -67,10 +64,10 @@ export interface FetchProductsByCategoryParams {
|
|
|
67
64
|
includeSoldOut?: boolean;
|
|
68
65
|
orFiltersOperator?: ProductsSearchEndpointParameters['orFiltersOperator'];
|
|
69
66
|
}
|
|
70
|
-
export
|
|
67
|
+
export interface FetchProductsByCategoryResponse {
|
|
71
68
|
products: Product[];
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
pagination: ProductsByIdsEndpointResponseData['pagination'];
|
|
70
|
+
}
|
|
74
71
|
export interface FetchProductsCountParams {
|
|
75
72
|
category?: string;
|
|
76
73
|
categoryId?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttributesFilterValue, FilterItemWithValues, IdentifierFilterValue } from '@
|
|
1
|
+
import type { AttributesFilterValue, FilterItemWithValues, IdentifierFilterValue } from '@scayle/storefront-api';
|
|
2
2
|
export type ProductFilter = FilterItemWithValues;
|
|
3
3
|
export type ProductFilterValues = ProductFilter['values'];
|
|
4
4
|
export type ProductFilterValue = AttributesFilterValue | {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { PromotionsEndpointResponseData as PromotionsResponseData, PromotionsEndpointRequestParameters as PromotionsParams, } from '@
|
|
2
|
-
export type
|
|
1
|
+
export type { PromotionsEndpointResponseData as PromotionsResponseData, PromotionsEndpointRequestParameters as PromotionsParams, } from '@scayle/storefront-api';
|
|
2
|
+
export type { Promotion, PromotionCondition, PromotionCustomData, PromotionEffect, AutomaticDiscountEffect, BuyXGetYEffect, } from '@scayle/storefront-api';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Redirect } from '@
|
|
1
|
+
export type { Redirect } from '@scayle/storefront-api';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ProductWith } from '@
|
|
2
|
-
import type { TypeaheadSuggestionsEndpointRequestParameters } from '@aboutyou/backbone/endpoints/typeahead/typeahead';
|
|
1
|
+
import type { ProductWith, TypeaheadSuggestionsEndpointRequestParameters } from '@scayle/storefront-api';
|
|
3
2
|
import type { Query } from '../index';
|
|
4
|
-
export type { BrandOrCategorySuggestion, ProductSuggestion, TypeaheadSuggestion, TypeaheadBrandOrCategorySuggestion, TypeaheadProductSuggestion, TypeaheadSuggestionsEndpointResponseData, } from '@
|
|
5
|
-
export type { SearchV2With } from '@
|
|
6
|
-
export type { SearchV2SuggestionsEndpointResponseData, SearchV2SuggestionsEndpointParameters, } from '@
|
|
7
|
-
export type { SearchV2ResolveEndpointResponseData, SearchV2ResolveEndpointParameters, } from '@
|
|
8
|
-
export type
|
|
3
|
+
export type { BrandOrCategorySuggestion, ProductSuggestion, TypeaheadSuggestion, TypeaheadBrandOrCategorySuggestion, TypeaheadProductSuggestion, TypeaheadSuggestionsEndpointResponseData, } from '@scayle/storefront-api';
|
|
4
|
+
export type { SearchV2With } from '@scayle/storefront-api';
|
|
5
|
+
export type { SearchV2SuggestionsEndpointResponseData, SearchV2SuggestionsEndpointParameters, } from '@scayle/storefront-api';
|
|
6
|
+
export type { SearchV2ResolveEndpointResponseData, SearchV2ResolveEndpointParameters, } from '@scayle/storefront-api';
|
|
7
|
+
export type { SearchEntity, CategorySearchSuggestion, ProductSearchSuggestion, } from '@scayle/storefront-api';
|
|
9
8
|
export interface SearchInput {
|
|
10
9
|
term?: Query;
|
|
11
10
|
slug?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { APISortOption, APISortOrder } from '@
|
|
1
|
+
import type { APISortOption, APISortOrder } from '@scayle/storefront-api';
|
|
2
2
|
import type { SortName, SortQuery } from '../../constants';
|
|
3
3
|
export { APISortOption, APISortOrder };
|
|
4
4
|
export type SortingValueKey = 'topSeller' | 'dateNewest' | 'priceDesc' | 'priceAsc' | 'reductionDesc' | 'reductionAsc';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type { VariantDetail, Variant, VariantWith, VariantsByIdsEndpointParameters, VariantsByIdsEndpointResponseData, } from '@scayle/storefront-api';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WishlistResponseData, WishlistWith } from '@
|
|
1
|
+
import type { WishlistResponseData, WishlistWith } from '@scayle/storefront-api';
|
|
2
2
|
export type { WishlistResponseData, WishlistWith };
|
|
3
3
|
export interface WishlistWithOptions extends WishlistWith {
|
|
4
4
|
pricePromotionKey?: string;
|
package/dist/types/index.cjs
CHANGED
|
@@ -3,9 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
StorefrontAPIClient: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "StorefrontAPIClient", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _storefrontApi.StorefrontAPIClient;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
6
15
|
var _promises = require("./promises.cjs");
|
|
7
16
|
Object.keys(_promises).forEach(function (key) {
|
|
8
17
|
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
9
19
|
if (key in exports && exports[key] === _promises[key]) return;
|
|
10
20
|
Object.defineProperty(exports, key, {
|
|
11
21
|
enumerable: true,
|
|
@@ -17,6 +27,7 @@ Object.keys(_promises).forEach(function (key) {
|
|
|
17
27
|
var _user = require("./user.cjs");
|
|
18
28
|
Object.keys(_user).forEach(function (key) {
|
|
19
29
|
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
31
|
if (key in exports && exports[key] === _user[key]) return;
|
|
21
32
|
Object.defineProperty(exports, key, {
|
|
22
33
|
enumerable: true,
|
|
@@ -28,6 +39,7 @@ Object.keys(_user).forEach(function (key) {
|
|
|
28
39
|
var _breadcrumb = require("./breadcrumb.cjs");
|
|
29
40
|
Object.keys(_breadcrumb).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
43
|
if (key in exports && exports[key] === _breadcrumb[key]) return;
|
|
32
44
|
Object.defineProperty(exports, key, {
|
|
33
45
|
enumerable: true,
|
|
@@ -39,6 +51,7 @@ Object.keys(_breadcrumb).forEach(function (key) {
|
|
|
39
51
|
var _rpc = require("./api/rpc.cjs");
|
|
40
52
|
Object.keys(_rpc).forEach(function (key) {
|
|
41
53
|
if (key === "default" || key === "__esModule") return;
|
|
54
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
55
|
if (key in exports && exports[key] === _rpc[key]) return;
|
|
43
56
|
Object.defineProperty(exports, key, {
|
|
44
57
|
enumerable: true,
|
|
@@ -50,6 +63,7 @@ Object.keys(_rpc).forEach(function (key) {
|
|
|
50
63
|
var _context = require("./api/context.cjs");
|
|
51
64
|
Object.keys(_context).forEach(function (key) {
|
|
52
65
|
if (key === "default" || key === "__esModule") return;
|
|
66
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
53
67
|
if (key in exports && exports[key] === _context[key]) return;
|
|
54
68
|
Object.defineProperty(exports, key, {
|
|
55
69
|
enumerable: true,
|
|
@@ -61,6 +75,7 @@ Object.keys(_context).forEach(function (key) {
|
|
|
61
75
|
var _auth = require("./api/auth.cjs");
|
|
62
76
|
Object.keys(_auth).forEach(function (key) {
|
|
63
77
|
if (key === "default" || key === "__esModule") return;
|
|
78
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
64
79
|
if (key in exports && exports[key] === _auth[key]) return;
|
|
65
80
|
Object.defineProperty(exports, key, {
|
|
66
81
|
enumerable: true,
|
|
@@ -69,9 +84,11 @@ Object.keys(_auth).forEach(function (key) {
|
|
|
69
84
|
}
|
|
70
85
|
});
|
|
71
86
|
});
|
|
87
|
+
var _storefrontApi = require("@scayle/storefront-api");
|
|
72
88
|
var _basket = require("./bapi/basket.cjs");
|
|
73
89
|
Object.keys(_basket).forEach(function (key) {
|
|
74
90
|
if (key === "default" || key === "__esModule") return;
|
|
91
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
75
92
|
if (key in exports && exports[key] === _basket[key]) return;
|
|
76
93
|
Object.defineProperty(exports, key, {
|
|
77
94
|
enumerable: true,
|
|
@@ -83,6 +100,7 @@ Object.keys(_basket).forEach(function (key) {
|
|
|
83
100
|
var _brand = require("./bapi/brand.cjs");
|
|
84
101
|
Object.keys(_brand).forEach(function (key) {
|
|
85
102
|
if (key === "default" || key === "__esModule") return;
|
|
103
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
86
104
|
if (key in exports && exports[key] === _brand[key]) return;
|
|
87
105
|
Object.defineProperty(exports, key, {
|
|
88
106
|
enumerable: true,
|
|
@@ -94,6 +112,7 @@ Object.keys(_brand).forEach(function (key) {
|
|
|
94
112
|
var _campaign = require("./bapi/campaign.cjs");
|
|
95
113
|
Object.keys(_campaign).forEach(function (key) {
|
|
96
114
|
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
97
116
|
if (key in exports && exports[key] === _campaign[key]) return;
|
|
98
117
|
Object.defineProperty(exports, key, {
|
|
99
118
|
enumerable: true,
|
|
@@ -105,6 +124,7 @@ Object.keys(_campaign).forEach(function (key) {
|
|
|
105
124
|
var _category = require("./bapi/category.cjs");
|
|
106
125
|
Object.keys(_category).forEach(function (key) {
|
|
107
126
|
if (key === "default" || key === "__esModule") return;
|
|
127
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
108
128
|
if (key in exports && exports[key] === _category[key]) return;
|
|
109
129
|
Object.defineProperty(exports, key, {
|
|
110
130
|
enumerable: true,
|
|
@@ -116,6 +136,7 @@ Object.keys(_category).forEach(function (key) {
|
|
|
116
136
|
var _filter = require("./bapi/filter.cjs");
|
|
117
137
|
Object.keys(_filter).forEach(function (key) {
|
|
118
138
|
if (key === "default" || key === "__esModule") return;
|
|
139
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
119
140
|
if (key in exports && exports[key] === _filter[key]) return;
|
|
120
141
|
Object.defineProperty(exports, key, {
|
|
121
142
|
enumerable: true,
|
|
@@ -127,6 +148,7 @@ Object.keys(_filter).forEach(function (key) {
|
|
|
127
148
|
var _navigation = require("./bapi/navigation.cjs");
|
|
128
149
|
Object.keys(_navigation).forEach(function (key) {
|
|
129
150
|
if (key === "default" || key === "__esModule") return;
|
|
151
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
130
152
|
if (key in exports && exports[key] === _navigation[key]) return;
|
|
131
153
|
Object.defineProperty(exports, key, {
|
|
132
154
|
enumerable: true,
|
|
@@ -138,6 +160,7 @@ Object.keys(_navigation).forEach(function (key) {
|
|
|
138
160
|
var _order = require("./bapi/order.cjs");
|
|
139
161
|
Object.keys(_order).forEach(function (key) {
|
|
140
162
|
if (key === "default" || key === "__esModule") return;
|
|
163
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
141
164
|
if (key in exports && exports[key] === _order[key]) return;
|
|
142
165
|
Object.defineProperty(exports, key, {
|
|
143
166
|
enumerable: true,
|
|
@@ -149,6 +172,7 @@ Object.keys(_order).forEach(function (key) {
|
|
|
149
172
|
var _product = require("./bapi/product.cjs");
|
|
150
173
|
Object.keys(_product).forEach(function (key) {
|
|
151
174
|
if (key === "default" || key === "__esModule") return;
|
|
175
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
152
176
|
if (key in exports && exports[key] === _product[key]) return;
|
|
153
177
|
Object.defineProperty(exports, key, {
|
|
154
178
|
enumerable: true,
|
|
@@ -160,6 +184,7 @@ Object.keys(_product).forEach(function (key) {
|
|
|
160
184
|
var _productFilter = require("./bapi/productFilter.cjs");
|
|
161
185
|
Object.keys(_productFilter).forEach(function (key) {
|
|
162
186
|
if (key === "default" || key === "__esModule") return;
|
|
187
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
163
188
|
if (key in exports && exports[key] === _productFilter[key]) return;
|
|
164
189
|
Object.defineProperty(exports, key, {
|
|
165
190
|
enumerable: true,
|
|
@@ -171,6 +196,7 @@ Object.keys(_productFilter).forEach(function (key) {
|
|
|
171
196
|
var _redirects = require("./bapi/redirects.cjs");
|
|
172
197
|
Object.keys(_redirects).forEach(function (key) {
|
|
173
198
|
if (key === "default" || key === "__esModule") return;
|
|
199
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
174
200
|
if (key in exports && exports[key] === _redirects[key]) return;
|
|
175
201
|
Object.defineProperty(exports, key, {
|
|
176
202
|
enumerable: true,
|
|
@@ -182,6 +208,7 @@ Object.keys(_redirects).forEach(function (key) {
|
|
|
182
208
|
var _router = require("./bapi/router.cjs");
|
|
183
209
|
Object.keys(_router).forEach(function (key) {
|
|
184
210
|
if (key === "default" || key === "__esModule") return;
|
|
211
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
185
212
|
if (key in exports && exports[key] === _router[key]) return;
|
|
186
213
|
Object.defineProperty(exports, key, {
|
|
187
214
|
enumerable: true,
|
|
@@ -193,6 +220,7 @@ Object.keys(_router).forEach(function (key) {
|
|
|
193
220
|
var _search = require("./bapi/search.cjs");
|
|
194
221
|
Object.keys(_search).forEach(function (key) {
|
|
195
222
|
if (key === "default" || key === "__esModule") return;
|
|
223
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
196
224
|
if (key in exports && exports[key] === _search[key]) return;
|
|
197
225
|
Object.defineProperty(exports, key, {
|
|
198
226
|
enumerable: true,
|
|
@@ -204,6 +232,7 @@ Object.keys(_search).forEach(function (key) {
|
|
|
204
232
|
var _sorting = require("./bapi/sorting.cjs");
|
|
205
233
|
Object.keys(_sorting).forEach(function (key) {
|
|
206
234
|
if (key === "default" || key === "__esModule") return;
|
|
235
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
207
236
|
if (key in exports && exports[key] === _sorting[key]) return;
|
|
208
237
|
Object.defineProperty(exports, key, {
|
|
209
238
|
enumerable: true,
|
|
@@ -215,6 +244,7 @@ Object.keys(_sorting).forEach(function (key) {
|
|
|
215
244
|
var _wishlist = require("./bapi/wishlist.cjs");
|
|
216
245
|
Object.keys(_wishlist).forEach(function (key) {
|
|
217
246
|
if (key === "default" || key === "__esModule") return;
|
|
247
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
218
248
|
if (key in exports && exports[key] === _wishlist[key]) return;
|
|
219
249
|
Object.defineProperty(exports, key, {
|
|
220
250
|
enumerable: true,
|
|
@@ -223,20 +253,10 @@ Object.keys(_wishlist).forEach(function (key) {
|
|
|
223
253
|
}
|
|
224
254
|
});
|
|
225
255
|
});
|
|
226
|
-
var _pagination = require("./bapi/pagination.cjs");
|
|
227
|
-
Object.keys(_pagination).forEach(function (key) {
|
|
228
|
-
if (key === "default" || key === "__esModule") return;
|
|
229
|
-
if (key in exports && exports[key] === _pagination[key]) return;
|
|
230
|
-
Object.defineProperty(exports, key, {
|
|
231
|
-
enumerable: true,
|
|
232
|
-
get: function () {
|
|
233
|
-
return _pagination[key];
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
256
|
var _promotion = require("./bapi/promotion.cjs");
|
|
238
257
|
Object.keys(_promotion).forEach(function (key) {
|
|
239
258
|
if (key === "default" || key === "__esModule") return;
|
|
259
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
240
260
|
if (key in exports && exports[key] === _promotion[key]) return;
|
|
241
261
|
Object.defineProperty(exports, key, {
|
|
242
262
|
enumerable: true,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './breadcrumb';
|
|
|
4
4
|
export * from './api/rpc';
|
|
5
5
|
export * from './api/context';
|
|
6
6
|
export * from './api/auth';
|
|
7
|
-
export
|
|
7
|
+
export { StorefrontAPIClient } from '@scayle/storefront-api';
|
|
8
8
|
export * from './bapi/basket';
|
|
9
9
|
export * from './bapi/brand';
|
|
10
10
|
export * from './bapi/campaign';
|
|
@@ -19,5 +19,4 @@ export * from './bapi/router';
|
|
|
19
19
|
export * from './bapi/search';
|
|
20
20
|
export * from './bapi/sorting';
|
|
21
21
|
export * from './bapi/wishlist';
|
|
22
|
-
export * from './bapi/pagination';
|
|
23
22
|
export * from './bapi/promotion';
|
package/dist/types/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./breadcrumb.mjs";
|
|
|
4
4
|
export * from "./api/rpc.mjs";
|
|
5
5
|
export * from "./api/context.mjs";
|
|
6
6
|
export * from "./api/auth.mjs";
|
|
7
|
+
export { StorefrontAPIClient } from "@scayle/storefront-api";
|
|
7
8
|
export * from "./bapi/basket.mjs";
|
|
8
9
|
export * from "./bapi/brand.mjs";
|
|
9
10
|
export * from "./bapi/campaign.mjs";
|
|
@@ -18,5 +19,4 @@ export * from "./bapi/router.mjs";
|
|
|
18
19
|
export * from "./bapi/search.mjs";
|
|
19
20
|
export * from "./bapi/sorting.mjs";
|
|
20
21
|
export * from "./bapi/wishlist.mjs";
|
|
21
|
-
export * from "./bapi/pagination.mjs";
|
|
22
22
|
export * from "./bapi/promotion.mjs";
|
package/dist/utils/user.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ 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;
|
|
5
|
-
basket: import("@
|
|
5
|
+
basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
|
|
6
6
|
} | {
|
|
7
7
|
readonly type: "success";
|
|
8
|
-
readonly basket: import("@
|
|
8
|
+
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
|
|
9
9
|
} | {
|
|
10
10
|
readonly type: "failure";
|
|
11
|
-
readonly basket: import("@
|
|
12
|
-
readonly errors: import("@
|
|
11
|
+
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
|
|
12
|
+
readonly errors: import("@scayle/storefront-api").AddOrUpdateItemError[];
|
|
13
13
|
} | undefined>;
|
|
14
14
|
export declare const mergeWishlists: (fromWishlistKey: string, toWishlistKey: string, withOptions: BasketWithOptions, context: RpcContext) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.50.1",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@
|
|
62
|
+
"@scayle/storefront-api": "17.0.1",
|
|
63
63
|
"crypto-js": "4.2.0",
|
|
64
64
|
"jose": "5.3.0",
|
|
65
65
|
"radash": "12.1.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"utility-types": "3.11.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@scayle/eslint-config-storefront": "4.
|
|
72
|
+
"@scayle/eslint-config-storefront": "4.2.0",
|
|
73
73
|
"@types/crypto-js": "4.2.2",
|
|
74
74
|
"@types/node": "20.12.12",
|
|
75
75
|
"@types/webpack-env": "1.18.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface Pagination {
|
|
2
|
-
current: number;
|
|
3
|
-
total: number;
|
|
4
|
-
perPage: number;
|
|
5
|
-
page: number;
|
|
6
|
-
first: number;
|
|
7
|
-
prev: number;
|
|
8
|
-
next: number;
|
|
9
|
-
last: number;
|
|
10
|
-
}
|
|
11
|
-
export type PaginatedResponse<Response = any> = {
|
|
12
|
-
pagination: Pagination;
|
|
13
|
-
} & Response;
|
|
File without changes
|