@scayle/storefront-core 7.48.0 → 7.48.2

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,17 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.48.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixes an issue where the `refreshToken` was not exposed on the `RPCContext` even if the user is logged in.
8
+
9
+ ## 7.48.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated `purifySensitiveData` to ensure that empty secrets are logged as empty strings, enhancing clarity in logged configurations.
14
+
3
15
  ## 7.48.0
4
16
 
5
17
  ### Minor Changes
@@ -8,8 +20,8 @@
8
20
 
9
21
  ```ts
10
22
  const { data: externalIDPRedirects } = await useIDP({
11
- queryParams: { redirectTo: '/account' },
12
- })
23
+ queryParams: { redirectTo: "/account" },
24
+ });
13
25
  ```
14
26
 
15
27
  Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
@@ -626,7 +638,7 @@
626
638
 
627
639
  ```js
628
640
  env: {
629
- SFC_OMIT_MD5: true
641
+ SFC_OMIT_MD5: true;
630
642
  }
631
643
  ```
632
644
 
@@ -634,7 +646,7 @@
634
646
 
635
647
  ```js
636
648
  env: {
637
- SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
649
+ SFC_OMIT_MD5: process.env.SFC_OMIT_MD5;
638
650
  }
639
651
  ```
640
652
 
@@ -672,7 +684,7 @@
672
684
 
673
685
  ```js
674
686
  env: {
675
- SFC_OMIT_MD5: true
687
+ SFC_OMIT_MD5: true;
676
688
  }
677
689
  ```
678
690
 
@@ -680,7 +692,7 @@
680
692
 
681
693
  ```js
682
694
  env: {
683
- SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
695
+ SFC_OMIT_MD5: process.env.SFC_OMIT_MD5;
684
696
  }
685
697
  ```
686
698
 
@@ -15,7 +15,7 @@ const purifySensitiveData = (data = {}, blacklistedKeys = ["password"]) => {
15
15
  return purifiedPayload;
16
16
  }
17
17
  const isSensitiveData = blacklistedKeys.some(excludedKey => key.includes(excludedKey));
18
- purifiedPayload[key] = isSensitiveData ? SANITIZATION_MASK : value;
18
+ purifiedPayload[key] = isSensitiveData && value !== "" ? SANITIZATION_MASK : value;
19
19
  return purifiedPayload;
20
20
  }, {});
21
21
  };
@@ -11,7 +11,7 @@ export const purifySensitiveData = (data = {}, blacklistedKeys = ["password"]) =
11
11
  const isSensitiveData = blacklistedKeys.some(
12
12
  (excludedKey) => key.includes(excludedKey)
13
13
  );
14
- purifiedPayload[key] = isSensitiveData ? SANITIZATION_MASK : value;
14
+ purifiedPayload[key] = isSensitiveData && value !== "" ? SANITIZATION_MASK : value;
15
15
  return purifiedPayload;
16
16
  },
17
17
  {}
@@ -17,23 +17,25 @@ export type WithParams = Partial<{
17
17
  export interface RuntimeConfiguration {
18
18
  [key: string]: any;
19
19
  }
20
- interface ContextWithSession {
20
+ export interface ContextWithSession {
21
21
  wishlistKey: string;
22
22
  basketKey: string;
23
23
  sessionId: string;
24
- user?: ShopUser;
25
- accessToken?: string;
24
+ user: ShopUser | undefined;
25
+ accessToken: string | undefined;
26
+ refreshToken: string | undefined;
26
27
  destroySession: () => Promise<void>;
27
28
  createUserBoundSession: () => Promise<void>;
28
29
  updateUser: (user: ShopUser) => void;
29
30
  updateTokens: (tokens: OAuthTokens) => void;
30
31
  }
31
- interface ContextNoSession {
32
+ export interface ContextWithoutSession {
32
33
  wishlistKey: undefined;
33
34
  basketKey: undefined;
34
35
  sessionId: undefined;
35
36
  user: undefined;
36
37
  accessToken: undefined;
38
+ refreshToken: undefined;
37
39
  destroySession: undefined;
38
40
  createUserBoundSession: undefined;
39
41
  updateUser: undefined;
@@ -54,7 +56,6 @@ export type RpcContext = {
54
56
  };
55
57
  bapiClient: BapiClient;
56
58
  cached: CachedType;
57
- refreshToken?: string;
58
59
  isCmsPreview: boolean;
59
60
  shopId: number;
60
61
  domain: string;
@@ -78,9 +79,6 @@ export type RpcContext = {
78
79
  runtimeConfiguration: RuntimeConfiguration;
79
80
  idp?: IDPConfig;
80
81
  headers: Headers;
81
- } & (ContextNoSession | ContextWithSession);
82
- export type RpcContextWithSession = RpcContext & {
83
- sessionId: string;
84
- };
82
+ } & (ContextWithoutSession | ContextWithSession);
83
+ export type RpcContextWithSession = RpcContext & ContextWithSession;
85
84
  export declare function assertSession(context: RpcContext): asserts context is RpcContextWithSession;
86
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.48.0",
3
+ "version": "7.48.2",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "@aboutyou/backbone": "16.2.1",
63
63
  "crypto-js": "4.2.0",
64
- "jose": "5.2.3",
64
+ "jose": "5.2.4",
65
65
  "radash": "12.1.0",
66
66
  "slugify": "1.6.6",
67
67
  "ufo": "1.5.3",
@@ -69,21 +69,21 @@
69
69
  "utility-types": "3.11.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@scayle/eslint-config-storefront": "3.2.6",
72
+ "@scayle/eslint-config-storefront": "3.2.7",
73
73
  "@types/crypto-js": "4.2.2",
74
- "@types/node": "20.12.5",
74
+ "@types/node": "20.12.7",
75
75
  "@types/webpack-env": "1.18.4",
76
- "@vitest/coverage-v8": "1.4.0",
76
+ "@vitest/coverage-v8": "1.5.0",
77
77
  "dprint": "0.45.1",
78
78
  "eslint": "8.57.0",
79
79
  "eslint-formatter-gitlab": "5.1.0",
80
80
  "publint": "0.2.7",
81
81
  "rimraf": "5.0.5",
82
82
  "ts-node": "10.9.2",
83
- "typescript": "5.4.4",
83
+ "typescript": "5.4.5",
84
84
  "unbuild": "2.0.0",
85
85
  "unstorage": "1.10.2",
86
- "vitest": "1.4.0"
86
+ "vitest": "1.5.0"
87
87
  },
88
88
  "optionalDependencies": {
89
89
  "redis": "4"