@steroidsjs/core 2.2.105 → 2.2.107

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.
@@ -9,13 +9,13 @@ export declare const openModal: (modal: any, props?: IModalProps) => {
9
9
  group: any;
10
10
  props: IModalProps;
11
11
  };
12
- export declare const modalMarkClosing: (id: any, group?: any) => {
12
+ export declare const modalMarkClosing: (id: string, group?: string | null) => {
13
13
  type: string;
14
- id: any;
15
- group: any;
14
+ id: string;
15
+ group: string;
16
16
  };
17
- export declare const closeModal: (id: any, group?: any) => {
17
+ export declare const closeModal: (id: string, group?: string | null) => {
18
18
  type: string;
19
- id: any;
20
- group: any;
19
+ id: string;
20
+ group: string;
21
21
  };
@@ -5,9 +5,9 @@ export interface IShowNotificationParameters {
5
5
  position?: 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left' | string;
6
6
  timeOut?: number;
7
7
  }
8
- export declare const closeNotification: (id?: any) => {
8
+ export declare const closeNotification: (id?: string | null) => {
9
9
  type: string;
10
- id: any;
10
+ id: string;
11
11
  };
12
12
  export declare const showNotification: (message: string, level?: ColorName, params?: IShowNotificationParameters) => (dispatch: any) => void;
13
13
  export declare const setFlashes: (flashes: any) => ((dispatch: any) => void)[][];
@@ -1,3 +1,4 @@
1
+ declare type TParams = Record<string, any> | null;
1
2
  export declare const ROUTER_INIT_ROUTES = "ROUTER_INIT_ROUTES";
2
3
  export declare const ROUTER_SET_PARAMS = "ROUTER_SET_PARAMS";
3
4
  export declare const ROUTER_SET_DATA = "ROUTER_SET_DATA";
@@ -9,7 +10,8 @@ export declare const initParams: (params: any) => {
9
10
  type: string;
10
11
  params: any;
11
12
  };
12
- export declare const goToRoute: (routeId: any, params?: any, isReplace?: boolean) => (dispatch: any, getState: any, { store }: {
13
+ export declare const goToRoute: (routeId: any, params?: TParams, isReplace?: boolean) => (dispatch: any, getState: any, { store }: {
13
14
  store: any;
14
15
  }) => any;
15
16
  export declare const goToParent: (level?: number) => (dispatch: any, getState: any) => any;
17
+ export {};
@@ -102,34 +102,43 @@ var JwtHttpComponent = /** @class */ (function (_super) {
102
102
  JwtHttpComponent.prototype.setRefreshTokenInterceptor = function (axiosInstance) {
103
103
  var _this = this;
104
104
  axiosInstance.interceptors.response.use(function (config) { return config; }, function (error) { return __awaiter(_this, void 0, void 0, function () {
105
- var originalRequest, store, response, accessToken;
106
- var _a;
107
- var _b, _c;
108
- return __generator(this, function (_d) {
109
- switch (_d.label) {
105
+ var originalRequest, store, response, accessToken, _a;
106
+ var _b;
107
+ var _c, _d;
108
+ return __generator(this, function (_e) {
109
+ switch (_e.label) {
110
110
  case 0:
111
111
  originalRequest = error.config;
112
112
  if (!(error.response.status === 401
113
113
  && error.config
114
114
  && !error.config._isRetry
115
- && originalRequest.url !== this.getUrl((_b = this.refreshTokenRequest) === null || _b === void 0 ? void 0 : _b.url))) return [3 /*break*/, 2];
115
+ && originalRequest.url !== this.getUrl((_c = this.refreshTokenRequest) === null || _c === void 0 ? void 0 : _c.url))) return [3 /*break*/, 5];
116
116
  this.removeAccessToken();
117
117
  store = this._components.store;
118
- return [4 /*yield*/, this.send(this.refreshTokenRequest.method, this.refreshTokenRequest.url, (_a = {},
119
- _a[this.refreshTokenKey] = this._refreshToken,
120
- _a))];
118
+ _e.label = 1;
121
119
  case 1:
122
- response = _d.sent();
123
- accessToken = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c[this.accessTokenKey];
120
+ _e.trys.push([1, 3, , 4]);
121
+ return [4 /*yield*/, this.send(this.refreshTokenRequest.method, this.refreshTokenRequest.url, (_b = {},
122
+ _b[this.refreshTokenKey] = this._refreshToken,
123
+ _b))];
124
+ case 2:
125
+ response = _e.sent();
126
+ accessToken = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d[this.accessTokenKey];
124
127
  if (accessToken) {
125
128
  this.setAccessToken(accessToken);
126
129
  originalRequest._isRetry = true;
127
130
  originalRequest.headers.Authorization = 'Bearer ' + accessToken;
128
131
  return [2 /*return*/, axiosInstance.request(originalRequest)];
129
132
  }
133
+ return [3 /*break*/, 4];
134
+ case 3:
135
+ _a = _e.sent();
130
136
  store.dispatch(auth_1.logout());
131
- _d.label = 2;
132
- case 2: throw error;
137
+ return [3 /*break*/, 4];
138
+ case 4:
139
+ store.dispatch(auth_1.logout());
140
+ _e.label = 5;
141
+ case 5: throw error;
133
142
  }
134
143
  });
135
144
  }); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "2.2.105",
3
+ "version": "2.2.107",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -1,7 +1,8 @@
1
- declare const _default: (state: {
1
+ export declare type TNotificationsState = {
2
2
  items: any[];
3
3
  position: string;
4
- }, action: any) => {
4
+ };
5
+ declare const _default: (state: TNotificationsState, action: any) => {
5
6
  items: any[];
6
7
  position: any;
7
8
  };
@@ -1,14 +1,14 @@
1
- export declare const SCREE_PHONE = "phone";
1
+ export declare const SCREEN_PHONE = "phone";
2
2
  export declare const SCREEN_TABLET = "tablet";
3
3
  export declare const SCREEN_DESKTOP = "desktop";
4
- declare const _default: (state: {
4
+ export declare type TMediaDevice = typeof SCREEN_PHONE | typeof SCREEN_TABLET | typeof SCREEN_DESKTOP;
5
+ export interface IScreenInitialState {
5
6
  width: number;
6
7
  media: {
7
- phone: number;
8
- tablet: number;
9
- desktop: number;
8
+ [key in TMediaDevice]: number;
10
9
  };
11
- }, action: any) => {
10
+ }
11
+ declare const _default: (state: IScreenInitialState, action: any) => {
12
12
  width: any;
13
13
  media: {
14
14
  phone: number;
@@ -12,15 +12,15 @@ var __assign = (this && this.__assign) || function () {
12
12
  };
13
13
  var _a;
14
14
  exports.__esModule = true;
15
- exports.isDesktop = exports.isTablet = exports.isPhone = exports.getDeviceType = exports.SCREEN_DESKTOP = exports.SCREEN_TABLET = exports.SCREE_PHONE = void 0;
15
+ exports.isDesktop = exports.isTablet = exports.isPhone = exports.getDeviceType = exports.SCREEN_DESKTOP = exports.SCREEN_TABLET = exports.SCREEN_PHONE = void 0;
16
16
  var screen_1 = require("../actions/screen");
17
- exports.SCREE_PHONE = 'phone';
17
+ exports.SCREEN_PHONE = 'phone';
18
18
  exports.SCREEN_TABLET = 'tablet';
19
19
  exports.SCREEN_DESKTOP = 'desktop';
20
20
  var initialState = {
21
21
  width: 1280,
22
22
  media: (_a = {},
23
- _a[exports.SCREE_PHONE] = 320,
23
+ _a[exports.SCREEN_PHONE] = 320,
24
24
  _a[exports.SCREEN_TABLET] = 768,
25
25
  _a[exports.SCREEN_DESKTOP] = 1024,
26
26
  _a)
@@ -38,7 +38,7 @@ exports["default"] = (function (state, action) {
38
38
  });
39
39
  var getDeviceType = function (state) {
40
40
  if (state.screen.width < state.screen.media[exports.SCREEN_TABLET]) {
41
- return exports.SCREE_PHONE;
41
+ return exports.SCREEN_PHONE;
42
42
  }
43
43
  if (state.screen.width < state.screen.media[exports.SCREEN_DESKTOP]) {
44
44
  return exports.SCREEN_TABLET;
@@ -46,7 +46,7 @@ var getDeviceType = function (state) {
46
46
  return exports.SCREEN_DESKTOP;
47
47
  };
48
48
  exports.getDeviceType = getDeviceType;
49
- var isPhone = function (state) { return exports.getDeviceType(state) === exports.SCREE_PHONE; };
49
+ var isPhone = function (state) { return exports.getDeviceType(state) === exports.SCREEN_PHONE; };
50
50
  exports.isPhone = isPhone;
51
51
  var isTablet = function (state) { return exports.getDeviceType(state) === exports.SCREEN_TABLET; };
52
52
  exports.isTablet = isTablet;