@djust-b2b/djust-front-sdk 1.21.17 → 1.21.18

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.
@@ -122,10 +122,11 @@ const hybridRoutePatterns = [
122
122
  "/v2/shop/autocomplete",
123
123
  "/v2/shop/search",
124
124
  ];
125
- const routeNeedToken = (path, method) => {
125
+ const routeIsPublic = (path, method) => {
126
126
  var _a;
127
- return (!publicRoutePatterns.some((pattern) => path.startsWith(pattern)) ||
128
- !((_a = publicRoutes.get(path)) === null || _a === void 0 ? void 0 : _a.has(method)));
127
+ if (publicRoutes.has(path) && ((_a = publicRoutes.get(path)) === null || _a === void 0 ? void 0 : _a.has(method)))
128
+ return true;
129
+ return publicRoutePatterns.some((pattern) => path.startsWith(pattern));
129
130
  };
130
131
  const isHybridRoute = (path) => {
131
132
  return hybridRoutePatterns.some((pattern) => path.startsWith(pattern));
@@ -145,7 +146,7 @@ const enhancedFetch = async ({ path, method, params = {}, body, }) => {
145
146
  "dj-api-key": apiKey,
146
147
  "Content-Type": "application/json",
147
148
  });
148
- if (routeNeedToken(path, method)) {
149
+ if (!routeIsPublic(path, method) && !isHybridRoute) {
149
150
  if (!accessToken) {
150
151
  const error = new Error("[Djust SDK] Private route need accessToken.");
151
152
  Sentry.captureException(error, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "1.21.17",
3
+ "version": "1.21.18",
4
4
  "description": "DJUST Front SDK is a versatile JavaScript Software Development Kit (SDK) ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",