@leapdev/auth-agent 2.2.13-beta.0 → 2.2.13-beta.1

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## 2.2.*
4
4
 
5
+ ### [2.2.13]
6
+ #### Bugfixes
7
+ * remove sourceMap files and build using CommonJS
8
+
5
9
  ### [2.2.12]
6
10
  #### Bugfixes
7
11
  * Update pubnub to v7.4.0 to fix Vulnerability warnings from Synopsis scan
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapdev/auth-agent",
3
- "version": "2.2.13-beta.0",
3
+ "version": "2.2.13-beta.1",
4
4
  "description": "LEAP Auth Agent",
5
5
  "license": "LEAP Legal Software, PTY LTD",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./lib/auth-agent"), exports);
1
+ export * from './lib/auth-agent';
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthAgent = void 0;
4
- const tslib_1 = require("tslib");
5
- const authentication_1 = require("./authentication");
6
- const idle_timer_1 = require("./idle-timer");
7
- const types_1 = require("./types");
1
+ import { __awaiter } from "tslib";
2
+ import { Authentication } from './authentication';
3
+ import { IdleTimer } from './idle-timer';
4
+ import { HookName } from './types';
8
5
  let auth;
9
- const init = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
10
- auth = new authentication_1.Authentication(options);
6
+ const init = (options) => __awaiter(void 0, void 0, void 0, function* () {
7
+ auth = new Authentication(options);
11
8
  if (!auth) {
12
9
  return false;
13
10
  }
14
11
  const autoLogout = auth.autoLogout();
15
12
  if (autoLogout) {
16
13
  const timeoutInMinutes = auth.idleTimeoutInMinutes();
17
- const idleTimer = new idle_timer_1.IdleTimer({ timeoutInMinutes, onTimeout: logout });
14
+ const idleTimer = new IdleTimer({ timeoutInMinutes, onTimeout: logout });
18
15
  idleTimer.tracker();
19
16
  }
20
17
  const done = yield auth.checkAuthCode();
@@ -35,7 +32,7 @@ const init = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* ()
35
32
  }
36
33
  return true;
37
34
  });
38
- const verifySession = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
35
+ const verifySession = () => __awaiter(void 0, void 0, void 0, function* () {
39
36
  if (!auth) {
40
37
  throw Error('Not init yet');
41
38
  }
@@ -44,10 +41,10 @@ const verifySession = () => tslib_1.__awaiter(void 0, void 0, void 0, function*
44
41
  const getAccessToken = () => {
45
42
  return !auth ? '' : auth.getAccessToken();
46
43
  };
47
- const getRefreshedAccessToken = (force) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
44
+ const getRefreshedAccessToken = (force) => __awaiter(void 0, void 0, void 0, function* () {
48
45
  return !auth ? '' : yield auth.getRefreshedAccessToken(force);
49
46
  });
50
- const login = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
47
+ const login = () => __awaiter(void 0, void 0, void 0, function* () {
51
48
  if (!auth) {
52
49
  throw Error('Not init yet');
53
50
  }
@@ -55,11 +52,11 @@ const login = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
55
52
  return token && auth ? auth.afterAuthenticated() : undefined;
56
53
  });
57
54
  });
58
- const logout = (force = false, redirectUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
55
+ const logout = (force = false, redirectUrl) => __awaiter(void 0, void 0, void 0, function* () {
59
56
  if (!auth) {
60
57
  throw Error('Not init yet');
61
58
  }
62
- return auth.triggerHooks(types_1.HookName.beforeLogout)
59
+ return auth.triggerHooks(HookName.beforeLogout)
63
60
  .then(() => {
64
61
  if (auth) {
65
62
  auth.destroyNotification();
@@ -87,7 +84,7 @@ const getDecodedAccessToken = () => {
87
84
  }
88
85
  return auth.getDecodedAccessToken();
89
86
  };
90
- const getDecodedRefreshedAccessToken = (force) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
87
+ const getDecodedRefreshedAccessToken = (force) => __awaiter(void 0, void 0, void 0, function* () {
91
88
  if (!auth) {
92
89
  throw Error('Not init yet');
93
90
  }
@@ -99,13 +96,13 @@ const userInfo = () => {
99
96
  }
100
97
  return auth.getUserInfo();
101
98
  };
102
- const linkUser = (redirectUrl, newWindow, callback) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
99
+ const linkUser = (redirectUrl, newWindow, callback) => __awaiter(void 0, void 0, void 0, function* () {
103
100
  if (!auth) {
104
101
  throw Error('Not init yet');
105
102
  }
106
103
  yield auth.linkUser({ redirectUrl, newWindow, callback });
107
104
  });
108
- const unlinkUser = (redirectUrl, newWindow, callback) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
105
+ const unlinkUser = (redirectUrl, newWindow, callback) => __awaiter(void 0, void 0, void 0, function* () {
109
106
  if (!auth) {
110
107
  throw Error('Not init yet');
111
108
  }
@@ -191,13 +188,13 @@ const registerEventListener = (topic, messageType, callback) => {
191
188
  }
192
189
  auth.registerEventListenerForUserChannel({ topic, messageType, callback });
193
190
  };
194
- const passthrough = (url, newWindow = false, authHost) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
191
+ const passthrough = (url, newWindow = false, authHost) => __awaiter(void 0, void 0, void 0, function* () {
195
192
  if (!auth) {
196
193
  throw Error('Not init yet');
197
194
  }
198
195
  yield auth.passthrough({ url, newWindow, authHost });
199
196
  });
200
- exports.AuthAgent = {
197
+ export const AuthAgent = {
201
198
  init,
202
199
  registerHook,
203
200
  login,
@@ -1,24 +1,21 @@
1
- "use strict";
2
1
  var _LeapAuthService_authHost, _LeapAuthService_clientId, _LeapAuthService_xhr, _LeapAuthService_redirectUrl;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.LeapAuthService = void 0;
5
- const tslib_1 = require("tslib");
6
- const lodash_1 = require("lodash");
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
+ import { isFunction, merge } from 'lodash';
7
4
  const LEAP_AUTH_CLOSE_WINDOW_URL = '/oauth/close';
8
- class LeapAuthService {
5
+ export class LeapAuthService {
9
6
  constructor(authHost, clientId) {
10
7
  _LeapAuthService_authHost.set(this, void 0);
11
8
  _LeapAuthService_clientId.set(this, void 0);
12
9
  this.getAccessTokenByJti = (jti) => {
13
10
  return new Promise((resolve, reject) => {
14
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
11
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
15
12
  method: 'POST',
16
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/oauth/token`,
13
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/oauth/token`,
17
14
  options: {
18
15
  body: {
19
16
  assertion: jti,
20
17
  grant_type: "urn:ietf:params:oauth:grant-type:jti",
21
- client_id: tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
18
+ client_id: __classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
22
19
  },
23
20
  },
24
21
  accessToken: undefined,
@@ -32,7 +29,7 @@ class LeapAuthService {
32
29
  };
33
30
  this.getRedirections = () => {
34
31
  return new Promise((resolve, reject) => {
35
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
32
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
36
33
  method: 'GET',
37
34
  endpoint: 'https://cdn.leap.com.au/leap_auth/auth_agent/redirections_v2.json',
38
35
  options: null,
@@ -47,15 +44,15 @@ class LeapAuthService {
47
44
  };
48
45
  this.exchangeAuthCodeForAccessToken = (params) => {
49
46
  return new Promise((resolve, reject) => {
50
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
47
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
51
48
  method: 'POST',
52
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/oauth/token`,
49
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/oauth/token`,
53
50
  options: {
54
51
  body: {
55
52
  grant_type: 'authorization_code',
56
53
  code: params.code,
57
54
  code_verifier: params.verifier,
58
- client_id: tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
55
+ client_id: __classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
59
56
  redirect_uri: params.redirectUri,
60
57
  },
61
58
  },
@@ -70,15 +67,15 @@ class LeapAuthService {
70
67
  };
71
68
  this.renewAccessToken = (params) => {
72
69
  return new Promise((resolve, reject) => {
73
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
70
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
74
71
  method: 'POST',
75
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/oauth/token`,
72
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/oauth/token`,
76
73
  options: {
77
74
  body: {
78
75
  grant_type: 'refresh_token',
79
76
  refresh_token: params.refreshToken,
80
77
  code_verifier: params.verifier,
81
- client_id: tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
78
+ client_id: __classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
82
79
  },
83
80
  },
84
81
  accessToken: undefined,
@@ -92,9 +89,9 @@ class LeapAuthService {
92
89
  };
93
90
  this.userInfo = (token) => {
94
91
  return new Promise((resolve, reject) => {
95
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
92
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
96
93
  method: 'GET',
97
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/api/userinfo`,
94
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/api/userinfo`,
98
95
  options: null,
99
96
  accessToken: token,
100
97
  }, (response, status) => {
@@ -108,23 +105,23 @@ class LeapAuthService {
108
105
  this.linkUser = (params) => {
109
106
  const { jti, newWindow, callback } = params;
110
107
  const redirectUrl = newWindow
111
- ? tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
108
+ ? __classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
112
109
  : params.redirectUrl;
113
- const requestUrl = `/cloudprovider/link?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}&prompt=none&jti=${jti}&callback=${redirectUrl}`;
114
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
110
+ const requestUrl = `/cloudprovider/link?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}&prompt=none&jti=${jti}&callback=${redirectUrl}`;
111
+ __classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
115
112
  };
116
113
  this.unlinkUser = (params) => {
117
114
  const { jti, newWindow, callback } = params;
118
115
  const redirectUrl = newWindow
119
- ? tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
116
+ ? __classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
120
117
  : params.redirectUrl;
121
- const requestUrl = `/cloudprovider/unlink?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}&jti=${jti}&callback=${redirectUrl}`;
122
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
118
+ const requestUrl = `/cloudprovider/unlink?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}&jti=${jti}&callback=${redirectUrl}`;
119
+ __classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
123
120
  };
124
121
  this.getCloudProviderToken = (token, jti) => {
125
- const url = `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/accesstoken` + (jti ? '/' + jti : '');
122
+ const url = `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/accesstoken` + (jti ? '/' + jti : '');
126
123
  return new Promise((resolve, reject) => {
127
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
124
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
128
125
  method: 'GET',
129
126
  endpoint: url,
130
127
  options: null,
@@ -139,9 +136,9 @@ class LeapAuthService {
139
136
  };
140
137
  this.cloudProviderUserInfo = (token) => {
141
138
  return new Promise((resolve, reject) => {
142
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
139
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
143
140
  method: 'GET',
144
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/userinfo`,
141
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/userinfo`,
145
142
  options: null,
146
143
  accessToken: token,
147
144
  }, (response, status) => {
@@ -155,16 +152,16 @@ class LeapAuthService {
155
152
  this.cloudProviderReauthenticate = (params) => {
156
153
  const { nonce, newWindow, callback } = params;
157
154
  const redirectUrl = newWindow
158
- ? tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
155
+ ? __classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
159
156
  : params.redirectUrl;
160
157
  const requestUrl = `/cloudprovider/reauthenticate?nonce=${nonce}&redirectUrl=${redirectUrl}`;
161
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
158
+ __classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
162
159
  };
163
160
  this.cloudProviderReauthenticateLink = (token) => {
164
161
  return new Promise((resolve, reject) => {
165
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
162
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
166
163
  method: 'GET',
167
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/reauthenticate/link`,
164
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/reauthenticate/link`,
168
165
  options: null,
169
166
  accessToken: token,
170
167
  }, (response, status) => {
@@ -178,9 +175,9 @@ class LeapAuthService {
178
175
  this.cloudProviderUpdate = (params) => {
179
176
  const { firmId, cloudProviderId, token } = params;
180
177
  return new Promise((resolve, reject) => {
181
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
178
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
182
179
  method: 'PUT',
183
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/api/firms/${firmId}`,
180
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/api/firms/${firmId}`,
184
181
  options: {
185
182
  body: { id: firmId, cloudProviderId: cloudProviderId }
186
183
  },
@@ -195,9 +192,9 @@ class LeapAuthService {
195
192
  };
196
193
  this.statusAdminConsent = (token) => {
197
194
  return new Promise((resolve, reject) => {
198
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
195
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
199
196
  method: 'GET',
200
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/adminconsent/status?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`,
197
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/adminconsent/status?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`,
201
198
  options: null,
202
199
  accessToken: token,
203
200
  }, (response, status) => {
@@ -211,16 +208,16 @@ class LeapAuthService {
211
208
  this.getAdminConsent = (params) => {
212
209
  const { domain, newWindow, callback } = params;
213
210
  const redirectUrl = newWindow
214
- ? tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
211
+ ? __classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL
215
212
  : params.redirectUrl;
216
- const requestUrl = `/cloudprovider/adminconsent?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}&redirectUrl=${redirectUrl}${domain ? '&domain=' + domain : ''}`;
217
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
213
+ const requestUrl = `/cloudprovider/adminconsent?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}&redirectUrl=${redirectUrl}${domain ? '&domain=' + domain : ''}`;
214
+ __classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, { requestUrl, newWindow, callback });
218
215
  };
219
216
  this.revokeAdminConsent = (token) => {
220
217
  return new Promise((resolve, reject) => {
221
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
218
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
222
219
  method: 'DELETE',
223
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/adminconsent?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`,
220
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/adminconsent?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`,
224
221
  options: null,
225
222
  accessToken: token,
226
223
  }, (response, status) => {
@@ -233,9 +230,9 @@ class LeapAuthService {
233
230
  };
234
231
  this.getLinkMap = (token, allUsers) => {
235
232
  return new Promise((resolve, reject) => {
236
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
233
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
237
234
  method: 'GET',
238
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/linkmap?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}${allUsers ? '&allUsers=true' : ''}`,
235
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/linkmap?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}${allUsers ? '&allUsers=true' : ''}`,
239
236
  options: null,
240
237
  accessToken: token,
241
238
  }, (response, status) => {
@@ -248,9 +245,9 @@ class LeapAuthService {
248
245
  };
249
246
  this.setLinkMap = (token, linkMap) => {
250
247
  return new Promise((resolve, reject) => {
251
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
248
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
252
249
  method: 'PUT',
253
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/linkmap?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`,
250
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/cloudprovider/linkmap?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`,
254
251
  options: { body: linkMap },
255
252
  accessToken: token,
256
253
  }, (response, status) => {
@@ -264,14 +261,14 @@ class LeapAuthService {
264
261
  this.authoriseSupport = (token, params) => {
265
262
  const { code, duration } = params;
266
263
  return new Promise((resolve, reject) => {
267
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
264
+ __classPrivateFieldGet(this, _LeapAuthService_xhr, "f").call(this, {
268
265
  method: 'POST',
269
- endpoint: `${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/support/authorization`,
266
+ endpoint: `${__classPrivateFieldGet(this, _LeapAuthService_authHost, "f")}/support/authorization`,
270
267
  options: {
271
268
  body: {
272
269
  requestCode: code,
273
270
  duration,
274
- client_id: tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
271
+ client_id: __classPrivateFieldGet(this, _LeapAuthService_clientId, "f"),
275
272
  },
276
273
  },
277
274
  accessToken: token,
@@ -285,12 +282,12 @@ class LeapAuthService {
285
282
  };
286
283
  this.changePassword = (params) => {
287
284
  const { newWindow, callback, redirectUrl } = params;
288
- let changePasswordUrl = `/oauth/changepassword?client_id=${tslib_1.__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`;
285
+ let changePasswordUrl = `/oauth/changepassword?client_id=${__classPrivateFieldGet(this, _LeapAuthService_clientId, "f")}`;
289
286
  let redirect_uri = '';
290
287
  let noListener = false;
291
288
  if (newWindow) {
292
289
  if (!!callback && typeof callback === 'function') {
293
- redirect_uri = tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL;
290
+ redirect_uri = __classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + LEAP_AUTH_CLOSE_WINDOW_URL;
294
291
  }
295
292
  else {
296
293
  redirect_uri = '';
@@ -299,7 +296,7 @@ class LeapAuthService {
299
296
  }
300
297
  else {
301
298
  redirect_uri =
302
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f") +
299
+ __classPrivateFieldGet(this, _LeapAuthService_authHost, "f") +
303
300
  '/oauth/logout?force=true' +
304
301
  '&redirect_uri=' +
305
302
  (redirectUrl || window.location.href);
@@ -307,7 +304,7 @@ class LeapAuthService {
307
304
  if (redirect_uri) {
308
305
  changePasswordUrl += `&redirect_uri=${encodeURIComponent(redirect_uri)}`;
309
306
  }
310
- tslib_1.__classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, {
307
+ __classPrivateFieldGet(this, _LeapAuthService_redirectUrl, "f").call(this, {
311
308
  requestUrl: changePasswordUrl,
312
309
  newWindow,
313
310
  callback,
@@ -317,7 +314,7 @@ class LeapAuthService {
317
314
  _LeapAuthService_xhr.set(this, (params, onload) => {
318
315
  const { method, endpoint, accessToken } = params;
319
316
  let { options } = params;
320
- options = (0, lodash_1.merge)({}, {
317
+ options = merge({}, {
321
318
  contentType: 'application/json',
322
319
  accessControlAllowOrigin: '*',
323
320
  body: undefined,
@@ -345,13 +342,13 @@ class LeapAuthService {
345
342
  });
346
343
  _LeapAuthService_redirectUrl.set(this, (params) => {
347
344
  const { requestUrl, newWindow, callback, noListener } = params;
348
- const fullUrl = tslib_1.__classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + requestUrl;
345
+ const fullUrl = __classPrivateFieldGet(this, _LeapAuthService_authHost, "f") + requestUrl;
349
346
  if (newWindow) {
350
347
  const childWindow = window.open(fullUrl, '_blank');
351
348
  const eventHandler = (event) => {
352
349
  if (event && event.data === 'closeMe' && childWindow) {
353
350
  childWindow.close();
354
- if ((0, lodash_1.isFunction)(callback)) {
351
+ if (isFunction(callback)) {
355
352
  callback();
356
353
  window.removeEventListener('message', eventHandler, false);
357
354
  }
@@ -365,9 +362,8 @@ class LeapAuthService {
365
362
  window.location.href = fullUrl;
366
363
  }
367
364
  });
368
- tslib_1.__classPrivateFieldSet(this, _LeapAuthService_authHost, authHost, "f");
369
- tslib_1.__classPrivateFieldSet(this, _LeapAuthService_clientId, clientId, "f");
365
+ __classPrivateFieldSet(this, _LeapAuthService_authHost, authHost, "f");
366
+ __classPrivateFieldSet(this, _LeapAuthService_clientId, clientId, "f");
370
367
  }
371
368
  }
372
- exports.LeapAuthService = LeapAuthService;
373
369
  _LeapAuthService_authHost = new WeakMap(), _LeapAuthService_clientId = new WeakMap(), _LeapAuthService_xhr = new WeakMap(), _LeapAuthService_redirectUrl = new WeakMap();