@frontegg/redux-store 7.112.0 → 7.113.0

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.
@@ -136,8 +136,33 @@ export default ((store, api, sharedActions) => {
136
136
  }
137
137
  };
138
138
 
139
+ /** @private */
140
+ const __refreshTokenWithNativeTokens = async () => {
141
+ try {
142
+ const tokens = await FronteggNativeModule.getTokens();
143
+ const response = await api.auth.silentOAuthRefreshTokenV3(tokens);
144
+ const updatedUser = await __handleUnnecessaryEntitlementsUpdate(response.user);
145
+ actions.afterAuthenticationStateUpdate(_extends({}, response, {
146
+ user: updatedUser
147
+ }), {
148
+ isAuthenticated: true
149
+ });
150
+ } catch (e) {
151
+ contextHolder.setAccessToken(null);
152
+ contextHolder.setUser(null);
153
+ actions.setAuthState({
154
+ user: null,
155
+ isAuthenticated: false
156
+ });
157
+ }
158
+ };
159
+
139
160
  /** @protected */
140
161
  const __refreshToken = async () => {
162
+ if (FronteggNativeModule.isGetTokensAvailable()) {
163
+ await __refreshTokenWithNativeTokens();
164
+ return;
165
+ }
141
166
  const hostedLoginBox = store.auth.hostedLoginBox;
142
167
  if (hostedLoginBox) {
143
168
  await __refreshTokenHosted();
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.112.0
1
+ /** @license Frontegg v7.113.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -143,8 +143,33 @@ var _default = (store, api, sharedActions) => {
143
143
  }
144
144
  };
145
145
 
146
+ /** @private */
147
+ const __refreshTokenWithNativeTokens = async () => {
148
+ try {
149
+ const tokens = await _toolkit.FronteggNativeModule.getTokens();
150
+ const response = await api.auth.silentOAuthRefreshTokenV3(tokens);
151
+ const updatedUser = await __handleUnnecessaryEntitlementsUpdate(response.user);
152
+ actions.afterAuthenticationStateUpdate((0, _extends2.default)({}, response, {
153
+ user: updatedUser
154
+ }), {
155
+ isAuthenticated: true
156
+ });
157
+ } catch (e) {
158
+ contextHolder.setAccessToken(null);
159
+ contextHolder.setUser(null);
160
+ actions.setAuthState({
161
+ user: null,
162
+ isAuthenticated: false
163
+ });
164
+ }
165
+ };
166
+
146
167
  /** @protected */
147
168
  const __refreshToken = async () => {
169
+ if (_toolkit.FronteggNativeModule.isGetTokensAvailable()) {
170
+ await __refreshTokenWithNativeTokens();
171
+ return;
172
+ }
148
173
  const hostedLoginBox = store.auth.hostedLoginBox;
149
174
  if (hostedLoginBox) {
150
175
  await __refreshTokenHosted();
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.112.0
1
+ /** @license Frontegg v7.113.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.112.0",
3
+ "version": "7.113.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
9
  "@frontegg/entitlements-javascript-commons": "1.1.2",
10
- "@frontegg/rest-api": "7.112.0",
10
+ "@frontegg/rest-api": "7.113.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",