@scayle/storefront-core 7.29.0 → 7.31.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.
- package/CHANGELOG.md +16 -0
- package/dist/api/oauth.d.ts +4 -4
- package/dist/errors/BAPIError.cjs +4 -2
- package/dist/errors/BAPIError.d.ts +2 -0
- package/dist/errors/BAPIError.mjs +2 -0
- package/dist/helpers/filterHelper.cjs +13 -3
- package/dist/helpers/filterHelper.mjs +9 -3
- package/dist/types/bapi/basket.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Update SAPI SDK to v16
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Fix filter helper to not return null values
|
|
12
|
+
|
|
13
|
+
## 7.30.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- Allow `null` values for `promotionId` within the basket payload
|
|
18
|
+
|
|
3
19
|
## 7.29.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/dist/api/oauth.d.ts
CHANGED
|
@@ -16,19 +16,19 @@ export declare class OAuthClient {
|
|
|
16
16
|
* Register a user and retrieve a token set
|
|
17
17
|
* @param payload
|
|
18
18
|
*/
|
|
19
|
-
register(payload: RegisterRequest): Oauth
|
|
19
|
+
register(payload: RegisterRequest): Promise<Oauth>;
|
|
20
20
|
/**
|
|
21
21
|
* Execute a user login on the OAuth API and receive a token set
|
|
22
22
|
* @param payload
|
|
23
23
|
*/
|
|
24
24
|
login(payload: LoginRequest & {
|
|
25
25
|
shopId: string;
|
|
26
|
-
}): Oauth
|
|
26
|
+
}): Promise<Oauth>;
|
|
27
27
|
/**
|
|
28
28
|
* Execute a guest user login on the OAuth API and receive a token set
|
|
29
29
|
* @param payload
|
|
30
30
|
*/
|
|
31
|
-
guestLogin(payload: GuestRequest): Oauth
|
|
31
|
+
guestLogin(payload: GuestRequest): Promise<Oauth>;
|
|
32
32
|
/**
|
|
33
33
|
* Send a password reset email
|
|
34
34
|
* @param payload
|
|
@@ -38,7 +38,7 @@ export declare class OAuthClient {
|
|
|
38
38
|
* Update password by hash
|
|
39
39
|
* @param payload
|
|
40
40
|
*/
|
|
41
|
-
updatePasswordByHash(payload: UpdatePasswordByHashRequest): Oauth
|
|
41
|
+
updatePasswordByHash(payload: UpdatePasswordByHashRequest): Promise<Oauth>;
|
|
42
42
|
/**
|
|
43
43
|
* Generate a new access token via a refresh token
|
|
44
44
|
* @param payload
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.BAPIError = void 0;
|
|
6
|
+
exports.BAPIFetchError = exports.BAPIError = void 0;
|
|
7
|
+
var _backbone = require("@aboutyou/backbone");
|
|
7
8
|
var _constants = require("../constants/index.cjs");
|
|
8
9
|
var _baseError = require("./baseError.cjs");
|
|
9
10
|
class BAPIError extends _baseError.BaseError {
|
|
@@ -13,4 +14,5 @@ class BAPIError extends _baseError.BaseError {
|
|
|
13
14
|
this.url = url;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
exports.BAPIError = BAPIError;
|
|
17
|
+
exports.BAPIError = BAPIError;
|
|
18
|
+
const BAPIFetchError = exports.BAPIFetchError = _backbone.FetchError;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { FetchError } from '@aboutyou/backbone';
|
|
1
2
|
import { HttpStatusCode, HttpStatusMessage } from '../constants';
|
|
2
3
|
import { BaseError } from './baseError';
|
|
3
4
|
export declare class BAPIError extends BaseError {
|
|
4
5
|
url?: string;
|
|
5
6
|
constructor(name?: HttpStatusMessage | string, statusCode?: HttpStatusCode, description?: string, url?: string);
|
|
6
7
|
}
|
|
8
|
+
export declare const BAPIFetchError: typeof FetchError;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FetchError } from "@aboutyou/backbone";
|
|
1
2
|
import { HttpStatusCode, HttpStatusMessage } from "../constants/index.mjs";
|
|
2
3
|
import { BaseError } from "./baseError.mjs";
|
|
3
4
|
export class BAPIError extends BaseError {
|
|
@@ -7,3 +8,4 @@ export class BAPIError extends BaseError {
|
|
|
7
8
|
this.url = url;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
11
|
+
export const BAPIFetchError = FetchError;
|
|
@@ -136,9 +136,19 @@ const serializeFilters = filter => {
|
|
|
136
136
|
if ((0, _radash.isEmpty)(filter)) {
|
|
137
137
|
return void 0;
|
|
138
138
|
}
|
|
139
|
-
return Object.assign({}, ...Object.entries(filter).map(([filterName, filterValue]) =>
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
return Object.assign({}, ...Object.entries(filter).map(([filterName, filterValue]) => {
|
|
140
|
+
if (Array.isArray(filterValue)) {
|
|
141
|
+
return {
|
|
142
|
+
[filterName]: filterValue.join(",")
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (filterValue === null || filterValue === void 0) {
|
|
146
|
+
return {};
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
[filterName]: String(filterValue)
|
|
150
|
+
};
|
|
151
|
+
}));
|
|
142
152
|
};
|
|
143
153
|
exports.serializeFilters = serializeFilters;
|
|
144
154
|
const deserializeFilters = serializedFilter => {
|
|
@@ -125,9 +125,15 @@ export const serializeFilters = (filter) => {
|
|
|
125
125
|
}
|
|
126
126
|
return Object.assign(
|
|
127
127
|
{},
|
|
128
|
-
...Object.entries(filter).map(([filterName, filterValue]) =>
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
...Object.entries(filter).map(([filterName, filterValue]) => {
|
|
129
|
+
if (Array.isArray(filterValue)) {
|
|
130
|
+
return { [filterName]: filterValue.join(",") };
|
|
131
|
+
}
|
|
132
|
+
if (filterValue === null || filterValue === void 0) {
|
|
133
|
+
return {};
|
|
134
|
+
}
|
|
135
|
+
return { [filterName]: String(filterValue) };
|
|
136
|
+
})
|
|
131
137
|
);
|
|
132
138
|
};
|
|
133
139
|
export const deserializeFilters = (serializedFilter) => {
|
|
@@ -13,7 +13,7 @@ export type AddOrUpdateItemType = {
|
|
|
13
13
|
};
|
|
14
14
|
itemGroup?: ItemGroup;
|
|
15
15
|
includeItemsWithoutProductData?: boolean;
|
|
16
|
-
promotionId?: string;
|
|
16
|
+
promotionId?: string | null;
|
|
17
17
|
};
|
|
18
18
|
export interface BasketWithOptions extends BasketWith {
|
|
19
19
|
pricePromotionKey?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.31.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test:ci": "jest --passWithNoTests --runInBand --coverage --reporters=default --reporters=jest-junit"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@aboutyou/backbone": "
|
|
59
|
+
"@aboutyou/backbone": "16.0.1",
|
|
60
60
|
"crypto-js": "4.2.0",
|
|
61
61
|
"jose": "^4.14.4",
|
|
62
62
|
"radash": "^11.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"utility-types": "^3.10.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@scayle/eslint-config-storefront": "3.2.
|
|
69
|
+
"@scayle/eslint-config-storefront": "3.2.6",
|
|
70
70
|
"@scayle/prettier-config-storefront": "2.0.2",
|
|
71
71
|
"@types/crypto-js": "4.2.1",
|
|
72
72
|
"@types/jest": "29.5.11",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"publint": "0.2.6",
|
|
82
82
|
"rimraf": "5.0.5",
|
|
83
83
|
"ts-jest": "29.1.1",
|
|
84
|
-
"ts-node": "10.9.
|
|
84
|
+
"ts-node": "10.9.2",
|
|
85
85
|
"typescript": "5.3.3",
|
|
86
86
|
"unstorage": "1.10.1"
|
|
87
87
|
},
|