@salesforce/commerce-sdk-react 3.3.0-preview.0 → 3.4.0-nightly-20250526080400

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,8 +1,11 @@
1
- ## v3.3.0-preview.0 (May 20, 2025)
2
- ## v3.3.0-dev.1 (Apr 30, 2025)
3
- - Fix inconsistency between dwsid and access token for guest login when hybrid authentication is enabled [#2397](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2397)
1
+ ## v3.4.0-nightly-20250526080400 (May 26, 2025)
2
+ ## v3.4.0-dev.0 (May 26, 2025)
3
+ ## v3.11.0-nightly-20250526080400 (May 26, 2025)
4
+ ## v3.4.0-dev.0 (May 23, 2025)
5
+
6
+ ## v3.3.0 (May 22, 2025)
4
7
 
5
- ## v3.3.0-dev (Feb 18, 2025)
8
+ - Fix inconsistency between dwsid and access token for guest login when hybrid authentication is enabled [#2397](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2397)
6
9
  - Invalidate cache instead of removing cache when triggering logout [#2323](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2323)
7
10
  - Fix dependencies vulnerabilities [#2338](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2338)
8
11
  - Allow custom parameters/body to be passed to SLAS authorize/authenticate calls via commerce-sdk-react auth helpers [#2358](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2358)
package/auth/index.js CHANGED
@@ -412,7 +412,7 @@ class Auth {
412
412
  this.set('usid', usid);
413
413
  this.set('customer_type', isGuest ? 'guest' : 'registered');
414
414
  accessToken = sfraAuthToken;
415
- // SFRA -> PWA access token cookie handoff is succesful so we clear the SFRA made cookies.
415
+ // SFRA -> PWA access token cookie handoff is successful so we clear the SFRA made cookies.
416
416
  // We don't want these cookies to persist and continue overriding what is in local store.
417
417
  this.clearSFRAAuthToken();
418
418
  }
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _useAuthContext = _interopRequireDefault(require("./useAuthContext"));
8
8
  var _useLocalStorage = _interopRequireDefault(require("./useLocalStorage"));
9
9
  var _useConfig = _interopRequireDefault(require("./useConfig"));
10
+ var _utils = require("../utils");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /*
12
13
  * Copyright (c) 2022, salesforce.com, inc.
@@ -15,8 +16,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
15
16
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
16
17
  */
17
18
 
18
- const onClient = typeof window !== 'undefined';
19
-
20
19
  /**
21
20
  * @group Shopper Authentication helpers
22
21
  */
@@ -31,7 +30,7 @@ const onClient = typeof window !== 'undefined';
31
30
  const useAccessToken = () => {
32
31
  const config = (0, _useConfig.default)();
33
32
  const auth = (0, _useAuthContext.default)();
34
- const token = onClient ?
33
+ const token = (0, _utils.onClient)() ?
35
34
  // This conditional is a constant value based on the environment, so the same path will
36
35
  // always be followed., and the "rule of hooks" is not violated.
37
36
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _useAuthContext = _interopRequireDefault(require("./useAuthContext"));
8
8
  var _useLocalStorage = _interopRequireDefault(require("./useLocalStorage"));
9
9
  var _useConfig = _interopRequireDefault(require("./useConfig"));
10
+ var _utils = require("../utils");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /*
12
13
  * Copyright (c) 2022, salesforce.com, inc.
@@ -15,8 +16,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
15
16
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
16
17
  */
17
18
 
18
- const onClient = typeof window !== 'undefined';
19
-
20
19
  /**
21
20
  * Hook that returns the customer ID.
22
21
  *
@@ -24,7 +23,7 @@ const onClient = typeof window !== 'undefined';
24
23
  * @category Shopper Authentication
25
24
  */
26
25
  const useCustomerId = () => {
27
- if (onClient) {
26
+ if ((0, _utils.onClient)()) {
28
27
  // `onClient` is a constant, so the hooks will always have the same execution order,
29
28
  // despite technically being inside a conditional.
30
29
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _useAuthContext = _interopRequireDefault(require("./useAuthContext"));
8
8
  var _useLocalStorage = _interopRequireDefault(require("./useLocalStorage"));
9
9
  var _useConfig = _interopRequireDefault(require("./useConfig"));
10
+ var _utils = require("../utils");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /*
12
13
  * Copyright (c) 2023, salesforce.com, inc.
@@ -15,7 +16,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
15
16
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
16
17
  */
17
18
 
18
- const onClient = typeof window !== 'undefined';
19
19
  /**
20
20
  * A hook to return customer auth type.
21
21
  *
@@ -34,7 +34,7 @@ const onClient = typeof window !== 'undefined';
34
34
  const useCustomerType = () => {
35
35
  const config = (0, _useConfig.default)();
36
36
  const auth = (0, _useAuthContext.default)();
37
- let customerType = onClient ?
37
+ let customerType = (0, _utils.onClient)() ?
38
38
  // This conditional is a constant value based on the environment, so the same path will
39
39
  // always be followed., and the "rule of hooks" is not violated.
40
40
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -47,7 +47,7 @@ const useCustomerType = () => {
47
47
 
48
48
  // The `uido` is a value within the `isb` claim of the SLAS access token that denotes the IDP origin of the user
49
49
  // If `uido` is not equal to `slas` or `ecom`, the user is considered an external user
50
- const uido = onClient ?
50
+ const uido = (0, _utils.onClient)() ?
51
51
  // eslint-disable-next-line react-hooks/rules-of-hooks
52
52
  (0, _useLocalStorage.default)(`uido_${config.siteId}`) : auth.get('uido');
53
53
  const isExternal = customerType === 'registered' && uido !== 'slas' && uido !== 'ecom';
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _useAuthContext = _interopRequireDefault(require("./useAuthContext"));
8
8
  var _useLocalStorage = _interopRequireDefault(require("./useLocalStorage"));
9
9
  var _useConfig = _interopRequireDefault(require("./useConfig"));
10
+ var _utils = require("../utils");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /*
12
13
  * Copyright (c) 2022, salesforce.com, inc.
@@ -15,8 +16,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
15
16
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
16
17
  */
17
18
 
18
- const onClient = typeof window !== 'undefined';
19
-
20
19
  /**
21
20
  * @group Shopper Authentication helpers
22
21
  */
@@ -33,7 +32,7 @@ const onClient = typeof window !== 'undefined';
33
32
  const useEncUserId = () => {
34
33
  const config = (0, _useConfig.default)();
35
34
  const auth = (0, _useAuthContext.default)();
36
- const encUserId = onClient ?
35
+ const encUserId = (0, _utils.onClient)() ?
37
36
  // This conditional is a constant value based on the environment, so the same path will
38
37
  // always be followed., and the "rule of hooks" is not violated.
39
38
  // eslint-disable-next-line react-hooks/rules-of-hooks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/commerce-sdk-react",
3
- "version": "3.3.0-preview.0",
3
+ "version": "3.4.0-nightly-20250526080400",
4
4
  "description": "A library that provides react hooks for fetching data from Commerce Cloud",
5
5
  "homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/ecom-react-hooks#readme",
6
6
  "bugs": {
@@ -45,7 +45,7 @@
45
45
  "jwt-decode": "^4.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@salesforce/pwa-kit-dev": "3.10.0-preview.0",
48
+ "@salesforce/pwa-kit-dev": "3.11.0-nightly-20250526080400",
49
49
  "@tanstack/react-query": "^4.28.0",
50
50
  "@testing-library/jest-dom": "^5.16.5",
51
51
  "@testing-library/react": "^14.0.0",
@@ -60,7 +60,7 @@
60
60
  "@types/react-helmet": "~6.1.6",
61
61
  "@types/react-router-dom": "~5.3.3",
62
62
  "cross-env": "^5.2.1",
63
- "internal-lib-build": "3.10.0-preview.0",
63
+ "internal-lib-build": "3.11.0-nightly-20250526080400",
64
64
  "jsonwebtoken": "^9.0.0",
65
65
  "nock": "^13.3.0",
66
66
  "nodemon": "^2.0.22",
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "directory": "dist"
92
92
  },
93
- "gitHead": "0fc3889936f16af3d92e9c1c42821968349f6599"
93
+ "gitHead": "f7cdce47d5702c370abf36a0a639bd6e7fee89c6"
94
94
  }