@salesforce/commerce-sdk-react 3.2.0 → 3.3.0-dev

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,3 +1,10 @@
1
+ ## v3.3.0-dev (Feb 18, 2025)
2
+ - Invalidate cache instead of removing cache when triggering logout [#2323](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2323)
3
+ - Fix dependencies vulnerabilities [#2338](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2338)
4
+
5
+ ## v3.2.1 (Mar 05, 2025)
6
+ - Update PWA-Kit SDKs to v3.9.1 [#2301](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2301)
7
+
1
8
  ## v3.2.0 (Feb 18, 2025)
2
9
 
3
10
  - Allow cookies for ShopperLogin API [#2190](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2190
package/auth/index.js CHANGED
@@ -582,7 +582,7 @@ class Auth {
582
582
  var _this3 = this;
583
583
  return _asyncToGenerator(function* () {
584
584
  const queue = _this3.pendingToken ?? Promise.resolve();
585
- _this3.pendingToken = queue.then( /*#__PURE__*/_asyncToGenerator(function* () {
585
+ _this3.pendingToken = queue.then(/*#__PURE__*/_asyncToGenerator(function* () {
586
586
  const token = yield fn();
587
587
  _this3.handleTokenResponse(token, isGuest);
588
588
  // Q: Why don't we just return token? Why re-construct the same object again?
@@ -15,8 +15,8 @@ const _excluded = ["data"];
15
15
  */
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
18
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
18
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
20
20
  const ComponentNotFound = ({
21
21
  typeId
22
22
  }) => /*#__PURE__*/_react.default.createElement("div", null, `Component type '${typeId}' not found!`);
@@ -22,8 +22,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
22
22
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
23
23
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
24
24
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
25
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
26
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
25
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
26
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
27
27
  // This context will hold the component map as well as any other future context.
28
28
  const PageContext = exports.PageContext = /*#__PURE__*/_react.default.createContext(undefined);
29
29
 
@@ -17,8 +17,8 @@ const _excluded = ["region", "className"];
17
17
  */
18
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
19
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
20
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
20
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
22
22
  /**
23
23
  * This PropType represents a `region` object from the ShopperExperience API.
24
24
  */
@@ -87,7 +87,7 @@ const cacheUpdateMatrix = {
87
87
  loginGuestUser: noop,
88
88
  logout() {
89
89
  return {
90
- remove: [{
90
+ invalidate: [{
91
91
  queryKey: ['/commerce-sdk-react']
92
92
  }]
93
93
  };
@@ -42,7 +42,7 @@ const useAuthorizationHeader = method => {
42
42
  headers: _objectSpread({
43
43
  Authorization: `Bearer ${access_token}`
44
44
  }, options.headers)
45
- })).catch( /*#__PURE__*/function () {
45
+ })).catch(/*#__PURE__*/function () {
46
46
  var _ref2 = _asyncToGenerator(function* (error) {
47
47
  const {
48
48
  access_token
@@ -61,7 +61,7 @@ const useCustomMutation = (apiOptions, mutationOptions) => {
61
61
  const {
62
62
  access_token
63
63
  } = yield auth.ready();
64
- return yield _commerceSdkIsomorphic.helpers.callCustomEndpoint((0, _helpers.generateCustomEndpointOptions)(apiOptions, globalConfig, access_token, args)).catch( /*#__PURE__*/function () {
64
+ return yield _commerceSdkIsomorphic.helpers.callCustomEndpoint((0, _helpers.generateCustomEndpointOptions)(apiOptions, globalConfig, access_token, args)).catch(/*#__PURE__*/function () {
65
65
  var _ref2 = _asyncToGenerator(function* (error) {
66
66
  const {
67
67
  access_token
package/hooks/useQuery.js CHANGED
@@ -86,7 +86,7 @@ const useCustomQuery = (apiOptions, queryOptions) => {
86
86
  access_token
87
87
  } = yield auth.ready();
88
88
  const customEndpointOptions = (0, _helpers.generateCustomEndpointOptions)(options, config, access_token);
89
- return yield _commerceSdkIsomorphic.helpers.callCustomEndpoint(customEndpointOptions).catch( /*#__PURE__*/function () {
89
+ return yield _commerceSdkIsomorphic.helpers.callCustomEndpoint(customEndpointOptions).catch(/*#__PURE__*/function () {
90
90
  var _ref3 = _asyncToGenerator(function* (error) {
91
91
  const {
92
92
  access_token
@@ -127,7 +127,7 @@ const useTrustedAgent = () => {
127
127
  const authorizeTrustedAgent = (0, _reactQuery.useMutation)(auth.authorizeTrustedAgent.bind(auth));
128
128
  const loginTrustedAgent = (0, _reactQuery.useMutation)(auth.loginTrustedAgent.bind(auth));
129
129
  const logoutTrustedAgent = (0, _reactQuery.useMutation)(auth.logout.bind(auth));
130
- const login = (0, _react.useCallback)( /*#__PURE__*/function () {
130
+ const login = (0, _react.useCallback)(/*#__PURE__*/function () {
131
131
  var _ref2 = _asyncToGenerator(function* (loginId, usid, refresh = false) {
132
132
  if (!(0, _utils.onClient)()) {
133
133
  throw new Error('Something went wrong, this client side method is invoked on the server.');
@@ -154,7 +154,7 @@ const useTrustedAgent = () => {
154
154
  return _ref2.apply(this, arguments);
155
155
  };
156
156
  }(), [auth]);
157
- const logout = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator(function* () {
157
+ const logout = (0, _react.useCallback)(/*#__PURE__*/_asyncToGenerator(function* () {
158
158
  return yield logoutTrustedAgent.mutateAsync();
159
159
  }), [auth]);
160
160
  (0, _react.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/commerce-sdk-react",
3
- "version": "3.2.0",
3
+ "version": "3.3.0-dev",
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.9.0",
48
+ "@salesforce/pwa-kit-dev": "3.10.0-dev",
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.9.0",
63
+ "internal-lib-build": "3.10.0-dev",
64
64
  "jsonwebtoken": "^9.0.0",
65
65
  "nock": "^13.3.0",
66
66
  "nodemon": "^2.0.22",
@@ -69,7 +69,7 @@
69
69
  "react-helmet": "^6.1.0",
70
70
  "react-router-dom": "^5.3.4",
71
71
  "semver": "^7.5.2",
72
- "shelljs": "^0.8.5",
72
+ "shelljs": "^0.9.2",
73
73
  "typedoc": "^0.24.7",
74
74
  "typedoc-plugin-missing-exports": "^2.0.0",
75
75
  "typescript": "4.9.5"
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "directory": "dist"
92
92
  },
93
- "gitHead": "bb69324df47c107d592f50aa9a5e7069ae89fccd"
93
+ "gitHead": "d86dc7bea3fe03a0f475ecf1a0ab878374f07026"
94
94
  }