@scayle/storefront-core 8.50.0 → 8.52.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
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 8.52.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Extended the `OrderItem` type to support `'promotion'` as a valid category in `appliedReductions`, enabling proper type checking for promotion-based discounts in order items.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
**Dependencies**
|
|
12
|
+
|
|
13
|
+
- Updated dependency to @scayle/storefront-api@18.18.1
|
|
14
|
+
- Updated dependency to @scayle/unstorage-scayle-kv-driver@2.0.8
|
|
15
|
+
|
|
16
|
+
## 8.51.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- Added an email hash (`emailHash`) property to the user object returned by the `fetchUser` RPC method.
|
|
21
|
+
|
|
22
|
+
The `emailHash` property is automatically included in all user objects returned by the RPCs.
|
|
23
|
+
The email hash is calculated server-side using SHA256 and is automatically included when a user has an email address.
|
|
24
|
+
This can be used e.g., for compliant user tracking and analytics without exposing sensitive email information.
|
|
25
|
+
|
|
3
26
|
## 8.50.0
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -37,7 +37,7 @@ export const getCheckoutToken = defineRpcHandler(async (jwtPayload = {}, context
|
|
|
37
37
|
...customData,
|
|
38
38
|
...orderCustomData
|
|
39
39
|
}
|
|
40
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.
|
|
40
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.52.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
|
|
41
41
|
return {
|
|
42
42
|
accessToken: refreshedAccessToken,
|
|
43
43
|
checkoutJwt
|
|
@@ -5,6 +5,7 @@ import { HttpStatusCode, HttpStatusMessage } from "../../constants/index.mjs";
|
|
|
5
5
|
import { ErrorResponse } from "../../errors/index.mjs";
|
|
6
6
|
import { FetchError } from "../../utils/fetch.mjs";
|
|
7
7
|
import { defineRpcHandler } from "../../utils/rpc.mjs";
|
|
8
|
+
import { sha256 } from "../../utils/index.mjs";
|
|
8
9
|
const getUser = defineRpcHandler(
|
|
9
10
|
(context) => {
|
|
10
11
|
const { user } = context;
|
|
@@ -27,6 +28,9 @@ const fetchUser = defineRpcHandler(async ({ accessToken }, context) => {
|
|
|
27
28
|
type: "idp"
|
|
28
29
|
};
|
|
29
30
|
}
|
|
31
|
+
if (user.email) {
|
|
32
|
+
user.emailHash = await sha256(user.email);
|
|
33
|
+
}
|
|
30
34
|
user.orderSummary = user.orderSummary?.filter(
|
|
31
35
|
({ shopId: shopId2 }) => shopId2 === context.shopId
|
|
32
36
|
);
|
|
@@ -172,7 +172,7 @@ export interface OrderItem<Product = Record<string, unknown>, Variant = Record<s
|
|
|
172
172
|
*/
|
|
173
173
|
relative: number;
|
|
174
174
|
};
|
|
175
|
-
category: 'sale' | 'campaign' | 'voucher';
|
|
175
|
+
category: 'sale' | 'campaign' | 'voucher' | 'promotion';
|
|
176
176
|
code?: string;
|
|
177
177
|
type: 'relative' | 'absolute';
|
|
178
178
|
}[];
|
package/dist/types/user.d.ts
CHANGED
|
@@ -180,6 +180,8 @@ export interface ShopUser {
|
|
|
180
180
|
status?: ShopUserStatus;
|
|
181
181
|
/** The user's title (e.g., Mr., Mrs.). */
|
|
182
182
|
title?: string;
|
|
183
|
+
/** The user's email as `sha256` hash. */
|
|
184
|
+
emailHash?: string;
|
|
183
185
|
/** Custom data associated with the user. */
|
|
184
186
|
customData?: {
|
|
185
187
|
memberRoles?: MemberRole[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.52.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"unbuild": "3.6.1",
|
|
67
67
|
"unstorage": "1.17.2",
|
|
68
68
|
"vitest": "3.2.4",
|
|
69
|
-
"@scayle/eslint-config-storefront": "4.7.
|
|
69
|
+
"@scayle/eslint-config-storefront": "4.7.13",
|
|
70
70
|
"@scayle/vitest-config-storefront": "1.0.0"
|
|
71
71
|
},
|
|
72
72
|
"volta": {
|