@escapenavigator/services 1.10.133 → 1.10.135

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.
@@ -24,6 +24,16 @@ export type InitApiClientOptions = {
24
24
  * (см. `appyApiOptions` в каждом фронте).
25
25
  */
26
26
  onError?: (error: unknown, ctx: ApiErrorContext) => void;
27
+ /**
28
+ * Слать ли credentials (cookies) с каждым запросом. Default — `true`
29
+ * для обратной совместимости (admin/auth/app полагаются на
30
+ * session-cookie). Виджет, наоборот, явно передаёт `false`: cookies
31
+ * на gateway-домене больше не нужны (auth — через
32
+ * `Authorization: Bearer`), и их отправка из embed-виджета на
33
+ * чужом домене провоцировала cross-profile collision (см.
34
+ * `WidgetGuard` / `SlotDetailsService`).
35
+ */
36
+ withCredentials?: boolean;
27
37
  };
28
38
  export type ErrorData = {
29
39
  errorId: string;
package/dist/api/index.js CHANGED
@@ -102,10 +102,10 @@ function initApi(apiDeclaration, baseURL, clientOptions) {
102
102
  }
103
103
  return __awaiter(_this, __spreadArray([], args_1, true), void 0, function (params) {
104
104
  var etag, axiosConfig, headers, mergedHeaders, hasConditionalHeaders, result, error_1, e, redirectUrl;
105
- var _a;
105
+ var _a, _b;
106
106
  if (params === void 0) { params = undefined; }
107
- return __generator(this, function (_b) {
108
- switch (_b.label) {
107
+ return __generator(this, function (_c) {
108
+ switch (_c.label) {
109
109
  case 0:
110
110
  etag = params === null || params === void 0 ? void 0 : params.etag;
111
111
  if (etag) {
@@ -115,24 +115,24 @@ function initApi(apiDeclaration, baseURL, clientOptions) {
115
115
  headers = axiosConfig.headers;
116
116
  mergedHeaders = __assign(__assign({}, (headers || {})), (etag ? { 'If-None-Match': etag } : {}));
117
117
  hasConditionalHeaders = Boolean(mergedHeaders['If-None-Match']);
118
- axiosConfig = __assign(__assign(__assign({}, axiosConfig), { baseURL: baseURL, withCredentials: true, headers: mergedHeaders }), (hasConditionalHeaders
118
+ axiosConfig = __assign(__assign(__assign({}, axiosConfig), { baseURL: baseURL, withCredentials: (_a = clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.withCredentials) !== null && _a !== void 0 ? _a : true, headers: mergedHeaders }), (hasConditionalHeaders
119
119
  ? {
120
120
  validateStatus: function (status) {
121
121
  return (status >= 200 && status < 300) || status === 304;
122
122
  },
123
123
  }
124
124
  : {}));
125
- _b.label = 1;
125
+ _c.label = 1;
126
126
  case 1:
127
- _b.trys.push([1, 3, , 4]);
127
+ _c.trys.push([1, 3, , 4]);
128
128
  return [4 /*yield*/, http(axiosConfig)];
129
129
  case 2:
130
- result = _b.sent();
130
+ result = _c.sent();
131
131
  return [2 /*return*/, result];
132
132
  case 3:
133
- error_1 = _b.sent();
133
+ error_1 = _c.sent();
134
134
  e = error_1;
135
- if (((_a = e === null || e === void 0 ? void 0 : e.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
135
+ if (((_b = e === null || e === void 0 ? void 0 : e.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
136
136
  if (clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.onUnauthorized) {
137
137
  clientOptions.onUnauthorized();
138
138
  }
@@ -149,7 +149,7 @@ function initApi(apiDeclaration, baseURL, clientOptions) {
149
149
  try {
150
150
  clientOptions.onError(e, buildErrorContext(e, axiosConfig, key));
151
151
  }
152
- catch (_c) {
152
+ catch (_d) {
153
153
  // онError — observer-уровень, не должен ломать основной flow
154
154
  }
155
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escapenavigator/services",
3
- "version": "1.10.133",
3
+ "version": "1.10.135",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,10 +12,10 @@
12
12
  "scripts": {
13
13
  "build": "rm -rf dist && tsc --project tsconfig.json"
14
14
  },
15
- "gitHead": "95bbddd22cbec3e4671d134dc1ff3b6db962329b",
15
+ "gitHead": "725d5bb466c14160683c9b578184c8f432d11915",
16
16
  "dependencies": {
17
- "@escapenavigator/types": "^1.10.124",
18
- "@escapenavigator/utils": "^1.10.128",
17
+ "@escapenavigator/types": "^1.10.126",
18
+ "@escapenavigator/utils": "^1.10.130",
19
19
  "axios": "^0.21.4",
20
20
  "class-transformer": "^0.5.1",
21
21
  "class-validator": "^0.13.2",