@frontegg/redux-store 7.111.0-alpha.3 → 7.111.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.
@@ -4,6 +4,7 @@ import { HOSTED_LOGIN_VERIFIER_KEY } from '../../../constants';
4
4
  import { getBaseNameWithoutSlashSuffix, getSearchParam, isOauthCallbackRoute, TENANT_ID_PARAM_KEY } from '../helpers';
5
5
  import { getUri, isSteppedUp } from '../../helpers';
6
6
  import { SHOULD_STEP_UP_KEY } from '../../StepUpState/consts';
7
+ import { FronteggNativeModule } from '../../../toolkit';
7
8
  export default ((store, api, sharedActions) => {
8
9
  const actions = sharedActions;
9
10
 
@@ -11,8 +12,15 @@ export default ((store, api, sharedActions) => {
11
12
  * @protected
12
13
  */
13
14
  const __requestHostedLoginSilentAuthorize = async () => {
14
- const response = await api.auth.silentOAuthRefreshTokenV2();
15
- if (response != null && response.user) {
15
+ var _response;
16
+ let response;
17
+ if (FronteggNativeModule.isMobileSDK()) {
18
+ const tokens = await FronteggNativeModule.getTokens();
19
+ response = await api.auth.silentOAuthRefreshTokenV3(tokens);
20
+ } else {
21
+ response = await api.auth.silentOAuthRefreshTokenV2();
22
+ }
23
+ if ((_response = response) != null && _response.user) {
16
24
  await actions.afterAuthenticationStateUpdate(response, {
17
25
  isAuthenticated: true,
18
26
  isLoading: false
@@ -79,6 +87,9 @@ export default ((store, api, sharedActions) => {
79
87
  if (tenantId) {
80
88
  params['tenantId'] = tenantId;
81
89
  }
90
+ if (FronteggNativeModule.isMobileSDK()) {
91
+ return FronteggNativeModule.closeWindow('not_authorized');
92
+ }
82
93
  const searchParams = new URLSearchParams(params);
83
94
  const url = `${oauthUrl}?${searchParams.toString()}`;
84
95
  onRedirectTo(url, {
@@ -129,6 +140,9 @@ export default ((store, api, sharedActions) => {
129
140
  additionalParams = additionalParams || {};
130
141
  additionalParams['login_direct_action'] = btoa(JSON.stringify(loginDirectAction));
131
142
  }
143
+ if (FronteggNativeModule.isMobileSDK()) {
144
+ return FronteggNativeModule.requestAuthorize(payload);
145
+ }
132
146
  if (((_additionalParams = additionalParams) == null ? void 0 : _additionalParams['prompt']) === 'login') {
133
147
  return await requestHostedLoginAuthorize(additionalParams);
134
148
  }
@@ -409,23 +409,27 @@ export default ((store, api, sharedActions) => {
409
409
  }, 2000);
410
410
  }
411
411
  } else {
412
- var _ref5;
413
- await ssoPreloginFailed({
414
- email: (_ref5 = email != null ? email : username) != null ? _ref5 : '',
412
+ await ssoPreloginFailed(_extends({}, username ? {
413
+ username
414
+ } : {
415
+ email: email != null ? email : ''
416
+ }, {
415
417
  recaptchaToken,
416
418
  callback,
417
419
  invitationToken
418
- });
420
+ }));
419
421
  }
420
422
  } catch (e) {
421
- var _ref6;
422
- await ssoPreloginFailed({
423
- email: (_ref6 = email != null ? email : username) != null ? _ref6 : '',
423
+ await ssoPreloginFailed(_extends({}, username ? {
424
+ username
425
+ } : {
426
+ email: email != null ? email : ''
427
+ }, {
424
428
  recaptchaToken,
425
429
  callback,
426
430
  invitationToken,
427
431
  error: e
428
- });
432
+ }));
429
433
  }
430
434
  };
431
435
  const postLogin = async payload => {
@@ -1376,11 +1380,11 @@ export default ((store, api, sharedActions) => {
1376
1380
  preserveQueryParams: true
1377
1381
  });
1378
1382
  } else {
1379
- var _ref7;
1383
+ var _ref5;
1380
1384
  if (user.id) {
1381
1385
  localStorage.setItem('userId', user.id);
1382
1386
  }
1383
- const quickLoginToRegister = (_ref7 = localStorage.getItem('register-quick-login')) != null ? _ref7 : loginState.quickLoginToRegister;
1387
+ const quickLoginToRegister = (_ref5 = localStorage.getItem('register-quick-login')) != null ? _ref5 : loginState.quickLoginToRegister;
1384
1388
  const shouldNavigateToRegisterQuickLogin = __shouldNavigateToRegisterQuickLogin(user);
1385
1389
  actions.afterAuthenticationStateUpdate({
1386
1390
  user: updatedUser,
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.111.0-alpha.3
1
+ /** @license Frontegg v7.111.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.
@@ -11,6 +11,7 @@ var _constants = require("../../../constants");
11
11
  var _helpers2 = require("../helpers");
12
12
  var _helpers3 = require("../../helpers");
13
13
  var _consts = require("../../StepUpState/consts");
14
+ var _toolkit = require("../../../toolkit");
14
15
  var _default = (store, api, sharedActions) => {
15
16
  const actions = sharedActions;
16
17
 
@@ -18,8 +19,15 @@ var _default = (store, api, sharedActions) => {
18
19
  * @protected
19
20
  */
20
21
  const __requestHostedLoginSilentAuthorize = async () => {
21
- const response = await api.auth.silentOAuthRefreshTokenV2();
22
- if (response != null && response.user) {
22
+ var _response;
23
+ let response;
24
+ if (_toolkit.FronteggNativeModule.isMobileSDK()) {
25
+ const tokens = await _toolkit.FronteggNativeModule.getTokens();
26
+ response = await api.auth.silentOAuthRefreshTokenV3(tokens);
27
+ } else {
28
+ response = await api.auth.silentOAuthRefreshTokenV2();
29
+ }
30
+ if ((_response = response) != null && _response.user) {
23
31
  await actions.afterAuthenticationStateUpdate(response, {
24
32
  isAuthenticated: true,
25
33
  isLoading: false
@@ -86,6 +94,9 @@ var _default = (store, api, sharedActions) => {
86
94
  if (tenantId) {
87
95
  params['tenantId'] = tenantId;
88
96
  }
97
+ if (_toolkit.FronteggNativeModule.isMobileSDK()) {
98
+ return _toolkit.FronteggNativeModule.closeWindow('not_authorized');
99
+ }
89
100
  const searchParams = new URLSearchParams(params);
90
101
  const url = `${oauthUrl}?${searchParams.toString()}`;
91
102
  onRedirectTo(url, {
@@ -136,6 +147,9 @@ var _default = (store, api, sharedActions) => {
136
147
  additionalParams = additionalParams || {};
137
148
  additionalParams['login_direct_action'] = btoa(JSON.stringify(loginDirectAction));
138
149
  }
150
+ if (_toolkit.FronteggNativeModule.isMobileSDK()) {
151
+ return _toolkit.FronteggNativeModule.requestAuthorize(payload);
152
+ }
139
153
  if (((_additionalParams = additionalParams) == null ? void 0 : _additionalParams['prompt']) === 'login') {
140
154
  return await requestHostedLoginAuthorize(additionalParams);
141
155
  }
@@ -416,23 +416,27 @@ var _default = (store, api, sharedActions) => {
416
416
  }, 2000);
417
417
  }
418
418
  } else {
419
- var _ref5;
420
- await ssoPreloginFailed({
421
- email: (_ref5 = email != null ? email : username) != null ? _ref5 : '',
419
+ await ssoPreloginFailed((0, _extends2.default)({}, username ? {
420
+ username
421
+ } : {
422
+ email: email != null ? email : ''
423
+ }, {
422
424
  recaptchaToken,
423
425
  callback,
424
426
  invitationToken
425
- });
427
+ }));
426
428
  }
427
429
  } catch (e) {
428
- var _ref6;
429
- await ssoPreloginFailed({
430
- email: (_ref6 = email != null ? email : username) != null ? _ref6 : '',
430
+ await ssoPreloginFailed((0, _extends2.default)({}, username ? {
431
+ username
432
+ } : {
433
+ email: email != null ? email : ''
434
+ }, {
431
435
  recaptchaToken,
432
436
  callback,
433
437
  invitationToken,
434
438
  error: e
435
- });
439
+ }));
436
440
  }
437
441
  };
438
442
  const postLogin = async payload => {
@@ -1383,11 +1387,11 @@ var _default = (store, api, sharedActions) => {
1383
1387
  preserveQueryParams: true
1384
1388
  });
1385
1389
  } else {
1386
- var _ref7;
1390
+ var _ref5;
1387
1391
  if (user.id) {
1388
1392
  localStorage.setItem('userId', user.id);
1389
1393
  }
1390
- const quickLoginToRegister = (_ref7 = localStorage.getItem('register-quick-login')) != null ? _ref7 : loginState.quickLoginToRegister;
1394
+ const quickLoginToRegister = (_ref5 = localStorage.getItem('register-quick-login')) != null ? _ref5 : loginState.quickLoginToRegister;
1391
1395
  const shouldNavigateToRegisterQuickLogin = __shouldNavigateToRegisterQuickLogin(user);
1392
1396
  actions.afterAuthenticationStateUpdate({
1393
1397
  user: updatedUser,
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.111.0-alpha.3
1
+ /** @license Frontegg v7.111.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.
@@ -8,6 +8,7 @@ const FRONTEGG_EXTERNAL_MOBILE_BROWSER_KEY = 'frontegg_external_mobile_browser';
8
8
  class FronteggNativeModule {
9
9
  constructor() {
10
10
  this.backToLoginImpl = undefined;
11
+ this.callbackSeq = 0;
11
12
  this.loginWithSSO = identifier => {
12
13
  if (this.isIOSNativeBridgeAvailable()) {
13
14
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
@@ -85,6 +86,46 @@ class FronteggNativeModule {
85
86
  var _window$FronteggNativ6, _window$FronteggNativ7;
86
87
  return (_window$FronteggNativ6 = (_window$FronteggNativ7 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ7['shouldPromptSocialLoginConsent']) != null ? _window$FronteggNativ6 : false;
87
88
  };
89
+ this.isMobileSDK = () => {
90
+ return this.isIOSNativeBridgeAvailable() || this.isAndroidNativeBridgeAvailable();
91
+ };
92
+ this.isGetTokensAvailable = () => {
93
+ return this.isAvailable('getTokens');
94
+ };
95
+ this.getTokens = () => {
96
+ if (!this.isIOSNativeBridgeAvailable() && !this.isAndroidNativeBridgeAvailable()) {
97
+ return Promise.reject(new Error('FronteggNativeBridge is not available'));
98
+ }
99
+ const {
100
+ callbackId,
101
+ promise
102
+ } = this.registerCallback();
103
+ if (this.isIOSNativeBridgeAvailable()) {
104
+ this.postMessageIOS('getTokens', '', callbackId);
105
+ } else {
106
+ var _window$FronteggNativ8, _window$FronteggNativ9;
107
+ (_window$FronteggNativ8 = window.FronteggNativeBridge) == null ? void 0 : (_window$FronteggNativ9 = _window$FronteggNativ8.getTokens) == null ? void 0 : _window$FronteggNativ9.call(_window$FronteggNativ8, callbackId);
108
+ }
109
+ return promise;
110
+ };
111
+ this.requestAuthorize = payload => {
112
+ const serialized = JSON.stringify(payload != null ? payload : {});
113
+ if (this.isIOSNativeBridgeAvailable()) {
114
+ this.postMessageIOS('requestAuthorize', serialized);
115
+ } else if (this.isAndroidNativeBridgeAvailable()) {
116
+ var _window$FronteggNativ10, _window$FronteggNativ11;
117
+ (_window$FronteggNativ10 = window.FronteggNativeBridge) == null ? void 0 : (_window$FronteggNativ11 = _window$FronteggNativ10.requestAuthorize) == null ? void 0 : _window$FronteggNativ11.call(_window$FronteggNativ10, serialized);
118
+ }
119
+ };
120
+ this.closeWindow = reason => {
121
+ const r = reason != null ? reason : '';
122
+ if (this.isIOSNativeBridgeAvailable()) {
123
+ this.postMessageIOS('closeWindow', r);
124
+ } else if (this.isAndroidNativeBridgeAvailable()) {
125
+ var _window$FronteggNativ12, _window$FronteggNativ13;
126
+ (_window$FronteggNativ12 = window.FronteggNativeBridge) == null ? void 0 : (_window$FronteggNativ13 = _window$FronteggNativ12.closeWindow) == null ? void 0 : _window$FronteggNativ13.call(_window$FronteggNativ12, r);
127
+ }
128
+ };
88
129
  }
89
130
  isIOSNativeBridgeAvailable() {
90
131
  var _window$webkit6, _window$webkit6$messa;
@@ -132,11 +173,47 @@ class FronteggNativeModule {
132
173
  }
133
174
  isAvailable(method) {
134
175
  if (this.isIOSNativeBridgeAvailable() || this.isAndroidNativeBridgeAvailable()) {
135
- var _window$FronteggNativ8, _window$FronteggNativ9;
136
- return (_window$FronteggNativ8 = (_window$FronteggNativ9 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ9[method]) != null ? _window$FronteggNativ8 : false;
176
+ var _window$FronteggNativ14, _window$FronteggNativ15;
177
+ return (_window$FronteggNativ14 = (_window$FronteggNativ15 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ15[method]) != null ? _window$FronteggNativ14 : false;
137
178
  }
138
179
  return false;
139
180
  }
181
+ postMessageIOS(action, payload, callbackId) {
182
+ var _window$webkit7, _window$webkit7$messa, _window$webkit7$messa2;
183
+ (_window$webkit7 = window.webkit) == null ? void 0 : (_window$webkit7$messa = _window$webkit7.messageHandlers) == null ? void 0 : (_window$webkit7$messa2 = _window$webkit7$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit7$messa2.postMessage(JSON.stringify({
184
+ action,
185
+ payload,
186
+ callbackId
187
+ }));
188
+ }
189
+ registerCallback(timeoutMs = 20000) {
190
+ if (!window.FronteggNativeBridgeCallbacks) {
191
+ window.FronteggNativeBridgeCallbacks = {};
192
+ }
193
+ this.callbackSeq += 1;
194
+ const callbackId = `fe_cb_${Date.now()}_${this.callbackSeq}`;
195
+ const promise = new Promise((resolve, reject) => {
196
+ const timer = setTimeout(() => {
197
+ var _window$FronteggNativ16;
198
+ (_window$FronteggNativ16 = window.FronteggNativeBridgeCallbacks) == null ? true : delete _window$FronteggNativ16[callbackId];
199
+ reject(new Error('native_bridge_timeout'));
200
+ }, timeoutMs);
201
+ window.FronteggNativeBridgeCallbacks[callbackId] = {
202
+ resolve: value => {
203
+ clearTimeout(timer);
204
+ resolve(value);
205
+ },
206
+ reject: reason => {
207
+ clearTimeout(timer);
208
+ reject(reason instanceof Error ? reason : new Error(String(reason != null ? reason : 'native_bridge_error')));
209
+ }
210
+ };
211
+ });
212
+ return {
213
+ callbackId,
214
+ promise
215
+ };
216
+ }
140
217
  }
141
218
  var _default = new FronteggNativeModule();
142
219
  exports.default = _default;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.111.0-alpha.3",
3
+ "version": "7.111.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.111.0-alpha.3",
10
+ "@frontegg/rest-api": "7.111.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",
@@ -1,9 +1,21 @@
1
+ export interface FronteggNativeOAuthTokens {
2
+ accessToken: string;
3
+ refreshToken: string;
4
+ }
1
5
  export interface FronteggNativeBridge {
2
6
  loginWithSSO: (email: string) => void;
3
7
  loginWithSocialLogin: (url: string) => void;
4
8
  loginWithSocialLoginProvider: (provider: string) => void;
5
9
  loginWithCustomSocialLoginProvider: (providerId: string) => void;
6
10
  suggestSavePassword: (email: string, password: string) => void;
11
+ isMobileSDK?: () => boolean;
12
+ getTokens?: (callbackId: string) => void;
13
+ requestAuthorize?: (payload: string) => void;
14
+ closeWindow?: (reason: string) => void;
15
+ }
16
+ export interface FronteggNativeBridgeCallback {
17
+ resolve: (value: any) => void;
18
+ reject: (reason?: any) => void;
7
19
  }
8
20
  declare global {
9
21
  interface Window {
@@ -16,10 +28,12 @@ declare global {
16
28
  };
17
29
  FronteggNativeBridge?: FronteggNativeBridge;
18
30
  FronteggNativeBridgeFunctions?: Record<string, boolean>;
31
+ FronteggNativeBridgeCallbacks?: Record<string, FronteggNativeBridgeCallback>;
19
32
  }
20
33
  }
21
34
  declare class FronteggNativeModule {
22
35
  private backToLoginImpl?;
36
+ private callbackSeq;
23
37
  isIOSNativeBridgeAvailable(): boolean;
24
38
  isAndroidNativeBridgeAvailable(): boolean;
25
39
  /**
@@ -50,6 +64,13 @@ declare class FronteggNativeModule {
50
64
  loginWithCustomSocialLoginProvider: (providerId: string) => void;
51
65
  suggestSavePassword: (email: string, password: string) => void;
52
66
  promptSocialLoginConsent: () => boolean;
67
+ isMobileSDK: () => boolean;
68
+ isGetTokensAvailable: () => boolean;
69
+ private postMessageIOS;
70
+ private registerCallback;
71
+ getTokens: () => Promise<FronteggNativeOAuthTokens>;
72
+ requestAuthorize: (payload?: Record<string, any>) => void;
73
+ closeWindow: (reason?: string) => void;
53
74
  }
54
75
  declare const _default: FronteggNativeModule;
55
76
  export default _default;
@@ -2,6 +2,7 @@ const FRONTEGG_EXTERNAL_MOBILE_BROWSER_KEY = 'frontegg_external_mobile_browser';
2
2
  class FronteggNativeModule {
3
3
  constructor() {
4
4
  this.backToLoginImpl = undefined;
5
+ this.callbackSeq = 0;
5
6
  this.loginWithSSO = identifier => {
6
7
  if (this.isIOSNativeBridgeAvailable()) {
7
8
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
@@ -79,6 +80,46 @@ class FronteggNativeModule {
79
80
  var _window$FronteggNativ6, _window$FronteggNativ7;
80
81
  return (_window$FronteggNativ6 = (_window$FronteggNativ7 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ7['shouldPromptSocialLoginConsent']) != null ? _window$FronteggNativ6 : false;
81
82
  };
83
+ this.isMobileSDK = () => {
84
+ return this.isIOSNativeBridgeAvailable() || this.isAndroidNativeBridgeAvailable();
85
+ };
86
+ this.isGetTokensAvailable = () => {
87
+ return this.isAvailable('getTokens');
88
+ };
89
+ this.getTokens = () => {
90
+ if (!this.isIOSNativeBridgeAvailable() && !this.isAndroidNativeBridgeAvailable()) {
91
+ return Promise.reject(new Error('FronteggNativeBridge is not available'));
92
+ }
93
+ const {
94
+ callbackId,
95
+ promise
96
+ } = this.registerCallback();
97
+ if (this.isIOSNativeBridgeAvailable()) {
98
+ this.postMessageIOS('getTokens', '', callbackId);
99
+ } else {
100
+ var _window$FronteggNativ8, _window$FronteggNativ9;
101
+ (_window$FronteggNativ8 = window.FronteggNativeBridge) == null ? void 0 : (_window$FronteggNativ9 = _window$FronteggNativ8.getTokens) == null ? void 0 : _window$FronteggNativ9.call(_window$FronteggNativ8, callbackId);
102
+ }
103
+ return promise;
104
+ };
105
+ this.requestAuthorize = payload => {
106
+ const serialized = JSON.stringify(payload != null ? payload : {});
107
+ if (this.isIOSNativeBridgeAvailable()) {
108
+ this.postMessageIOS('requestAuthorize', serialized);
109
+ } else if (this.isAndroidNativeBridgeAvailable()) {
110
+ var _window$FronteggNativ10, _window$FronteggNativ11;
111
+ (_window$FronteggNativ10 = window.FronteggNativeBridge) == null ? void 0 : (_window$FronteggNativ11 = _window$FronteggNativ10.requestAuthorize) == null ? void 0 : _window$FronteggNativ11.call(_window$FronteggNativ10, serialized);
112
+ }
113
+ };
114
+ this.closeWindow = reason => {
115
+ const r = reason != null ? reason : '';
116
+ if (this.isIOSNativeBridgeAvailable()) {
117
+ this.postMessageIOS('closeWindow', r);
118
+ } else if (this.isAndroidNativeBridgeAvailable()) {
119
+ var _window$FronteggNativ12, _window$FronteggNativ13;
120
+ (_window$FronteggNativ12 = window.FronteggNativeBridge) == null ? void 0 : (_window$FronteggNativ13 = _window$FronteggNativ12.closeWindow) == null ? void 0 : _window$FronteggNativ13.call(_window$FronteggNativ12, r);
121
+ }
122
+ };
82
123
  }
83
124
  isIOSNativeBridgeAvailable() {
84
125
  var _window$webkit6, _window$webkit6$messa;
@@ -126,10 +167,46 @@ class FronteggNativeModule {
126
167
  }
127
168
  isAvailable(method) {
128
169
  if (this.isIOSNativeBridgeAvailable() || this.isAndroidNativeBridgeAvailable()) {
129
- var _window$FronteggNativ8, _window$FronteggNativ9;
130
- return (_window$FronteggNativ8 = (_window$FronteggNativ9 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ9[method]) != null ? _window$FronteggNativ8 : false;
170
+ var _window$FronteggNativ14, _window$FronteggNativ15;
171
+ return (_window$FronteggNativ14 = (_window$FronteggNativ15 = window.FronteggNativeBridgeFunctions) == null ? void 0 : _window$FronteggNativ15[method]) != null ? _window$FronteggNativ14 : false;
131
172
  }
132
173
  return false;
133
174
  }
175
+ postMessageIOS(action, payload, callbackId) {
176
+ var _window$webkit7, _window$webkit7$messa, _window$webkit7$messa2;
177
+ (_window$webkit7 = window.webkit) == null ? void 0 : (_window$webkit7$messa = _window$webkit7.messageHandlers) == null ? void 0 : (_window$webkit7$messa2 = _window$webkit7$messa.FronteggNativeBridge) == null ? void 0 : _window$webkit7$messa2.postMessage(JSON.stringify({
178
+ action,
179
+ payload,
180
+ callbackId
181
+ }));
182
+ }
183
+ registerCallback(timeoutMs = 20000) {
184
+ if (!window.FronteggNativeBridgeCallbacks) {
185
+ window.FronteggNativeBridgeCallbacks = {};
186
+ }
187
+ this.callbackSeq += 1;
188
+ const callbackId = `fe_cb_${Date.now()}_${this.callbackSeq}`;
189
+ const promise = new Promise((resolve, reject) => {
190
+ const timer = setTimeout(() => {
191
+ var _window$FronteggNativ16;
192
+ (_window$FronteggNativ16 = window.FronteggNativeBridgeCallbacks) == null ? true : delete _window$FronteggNativ16[callbackId];
193
+ reject(new Error('native_bridge_timeout'));
194
+ }, timeoutMs);
195
+ window.FronteggNativeBridgeCallbacks[callbackId] = {
196
+ resolve: value => {
197
+ clearTimeout(timer);
198
+ resolve(value);
199
+ },
200
+ reject: reason => {
201
+ clearTimeout(timer);
202
+ reject(reason instanceof Error ? reason : new Error(String(reason != null ? reason : 'native_bridge_error')));
203
+ }
204
+ };
205
+ });
206
+ return {
207
+ callbackId,
208
+ promise
209
+ };
210
+ }
134
211
  }
135
212
  export default new FronteggNativeModule();