@fusionauth/angular-sdk 0.1.7 → 1.0.2

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.
@@ -1,130 +1,309 @@
1
+ import { BehaviorSubject, Observable, catchError } from 'rxjs';
1
2
  import * as i0 from '@angular/core';
2
3
  import { Component, Input, NgModule } from '@angular/core';
3
4
 
5
+ // @ts-nocheck
6
+ const u = Object.defineProperty;
7
+ const d = (r, e, t) => e in r
8
+ ? u(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t })
9
+ : (r[e] = t);
10
+ const i = (r, e, t) => (d(r, typeof e != 'symbol' ? e + '' : e, t), t);
11
+ class g {
12
+ constructor(e) {
13
+ i(this, 'serverUrl');
14
+ i(this, 'clientId');
15
+ i(this, 'redirectUri');
16
+ i(this, 'scope');
17
+ i(this, 'mePath');
18
+ i(this, 'loginPath');
19
+ i(this, 'registerPath');
20
+ i(this, 'logoutPath');
21
+ i(this, 'tokenRefreshPath');
22
+ (this.serverUrl = e.serverUrl),
23
+ (this.clientId = e.clientId),
24
+ (this.redirectUri = e.redirectUri),
25
+ (this.scope = e.scope),
26
+ (this.mePath = e.mePath ?? '/app/me'),
27
+ (this.loginPath = e.loginPath ?? '/app/login'),
28
+ (this.registerPath = e.registerPath ?? '/app/register'),
29
+ (this.logoutPath = e.logoutPath ?? '/app/logout'),
30
+ (this.tokenRefreshPath = e.tokenRefreshPath ?? '/app/refresh');
31
+ }
32
+ getMeUrl() {
33
+ return this.generateUrl(this.mePath);
34
+ }
35
+ getLoginUrl(e) {
36
+ return this.generateUrl(this.loginPath, {
37
+ client_id: this.clientId,
38
+ redirect_uri: this.redirectUri,
39
+ scope: this.scope,
40
+ state: e,
41
+ });
42
+ }
43
+ getRegisterUrl(e) {
44
+ return this.generateUrl(this.registerPath, {
45
+ client_id: this.clientId,
46
+ redirect_uri: this.redirectUri,
47
+ scope: this.scope,
48
+ state: e,
49
+ });
50
+ }
51
+ getLogoutUrl() {
52
+ return this.generateUrl(this.logoutPath, {
53
+ client_id: this.clientId,
54
+ post_logout_redirect_uri: this.redirectUri,
55
+ });
56
+ }
57
+ getTokenRefreshUrl() {
58
+ return this.generateUrl(this.tokenRefreshPath, {
59
+ client_id: this.clientId,
60
+ });
61
+ }
62
+ generateUrl(e, t) {
63
+ const s = new URL(this.serverUrl);
64
+ if (((s.pathname = e), t)) {
65
+ const o = this.generateURLSearchParams(t);
66
+ s.search = o.toString();
67
+ }
68
+ return s;
69
+ }
70
+ generateURLSearchParams(e) {
71
+ const t = new URLSearchParams();
72
+ return (Object.entries(e).forEach(([s, o]) => {
73
+ o && t.append(s, o);
74
+ }),
75
+ t);
76
+ }
77
+ }
78
+ class p {
79
+ constructor() {
80
+ i(this, 'REDIRECT_VALUE', 'fa-sdk-redirect-value');
81
+ }
82
+ handlePreRedirect(e) {
83
+ const t = `${this.generateRandomString()}:${e ?? ''}`;
84
+ localStorage.setItem(this.REDIRECT_VALUE, t);
85
+ }
86
+ handlePostRedirect(e) {
87
+ const t = this.stateValue ?? void 0;
88
+ e == null || e(t), localStorage.removeItem(this.REDIRECT_VALUE);
89
+ }
90
+ get didRedirect() {
91
+ return !!localStorage.getItem(this.REDIRECT_VALUE);
92
+ }
93
+ get stateValue() {
94
+ const e = localStorage.getItem(this.REDIRECT_VALUE);
95
+ if (!e)
96
+ return null;
97
+ const [, ...t] = e.split(':');
98
+ return t.join(':');
99
+ }
100
+ generateRandomString() {
101
+ const e = new Uint32Array(28);
102
+ return (window.crypto.getRandomValues(e),
103
+ Array.from(e, t => ('0' + t.toString(16)).substring(-2)).join(''));
104
+ }
105
+ }
106
+ function m(r = 'app.at_exp') {
107
+ const e = document.cookie
108
+ .split('; ')
109
+ .map(s => s.split('='))
110
+ .find(([s]) => s === r), t = e == null ? void 0 : e[1];
111
+ return t ? parseInt(t) * 1e3 : null;
112
+ }
113
+ class U {
114
+ constructor(e) {
115
+ i(this, 'config');
116
+ i(this, 'urlHelper');
117
+ i(this, 'redirectHelper', new p());
118
+ i(this, 'tokenExpirationTimeout');
119
+ (this.config = e),
120
+ (this.urlHelper = new g({
121
+ serverUrl: e.serverUrl,
122
+ clientId: e.clientId,
123
+ redirectUri: e.redirectUri,
124
+ scope: e.scope,
125
+ mePath: e.mePath,
126
+ loginPath: e.loginPath,
127
+ registerPath: e.registerPath,
128
+ logoutPath: e.logoutPath,
129
+ tokenRefreshPath: e.tokenRefreshPath,
130
+ })),
131
+ this.scheduleTokenExpiration();
132
+ }
133
+ startLogin(e) {
134
+ this.redirectHelper.handlePreRedirect(e),
135
+ window.location.assign(this.urlHelper.getLoginUrl(e));
136
+ }
137
+ startRegister(e) {
138
+ this.redirectHelper.handlePreRedirect(e),
139
+ window.location.assign(this.urlHelper.getRegisterUrl(e));
140
+ }
141
+ startLogout() {
142
+ window.location.assign(this.urlHelper.getLogoutUrl());
143
+ }
144
+ async fetchUserInfo() {
145
+ const e = await fetch(this.urlHelper.getMeUrl(), {
146
+ credentials: 'include',
147
+ });
148
+ if (!e.ok)
149
+ throw new Error(`Unable to fetch userInfo in fusionauth. Request failed with status code ${e == null ? void 0 : e.status}`);
150
+ return await e.json();
151
+ }
152
+ async refreshToken() {
153
+ const e = await fetch(this.urlHelper.getTokenRefreshUrl(), {
154
+ method: 'POST',
155
+ credentials: 'include',
156
+ headers: {
157
+ 'Content-Type': 'text/plain',
158
+ },
159
+ });
160
+ if (!(e.status >= 200 && e.status < 300)) {
161
+ const t = (await (e == null ? void 0 : e.text())) ||
162
+ 'Error refreshing access token in fusionauth';
163
+ throw new Error(t);
164
+ }
165
+ return this.scheduleTokenExpiration(), e;
166
+ }
167
+ initAutoRefresh() {
168
+ const e = this.at_exp, t = this.config.autoRefreshSecondsBeforeExpiry ?? 10;
169
+ if (!e)
170
+ return;
171
+ const s = t * 1e3, o = /* @__PURE__ */ new Date().getTime(), h = e - s, l = Math.max(h - o, 0);
172
+ return setTimeout(async () => {
173
+ let n, a;
174
+ try {
175
+ await this.refreshToken(), this.initAutoRefresh();
176
+ }
177
+ catch (c) {
178
+ (a = (n = this.config).onAutoRefreshFailure) == null || a.call(n, c);
179
+ }
180
+ }, l);
181
+ }
182
+ handlePostRedirect(e) {
183
+ this.isLoggedIn &&
184
+ this.redirectHelper.didRedirect &&
185
+ this.redirectHelper.handlePostRedirect(e);
186
+ }
187
+ get isLoggedIn() {
188
+ return this.at_exp
189
+ ? this.at_exp > /* @__PURE__ */ new Date().getTime()
190
+ : !1;
191
+ }
192
+ /** The moment of access token expiration in milliseconds since epoch. */
193
+ get at_exp() {
194
+ return m(this.config.accessTokenExpireCookieName);
195
+ }
196
+ /** Schedules `onTokenExpiration` at moment of access token expiration. */
197
+ scheduleTokenExpiration() {
198
+ clearTimeout(this.tokenExpirationTimeout);
199
+ const e = this.at_exp ?? -1, t = /* @__PURE__ */ new Date().getTime(), s = e - t;
200
+ s > 0 &&
201
+ (this.tokenExpirationTimeout = setTimeout(this.config.onTokenExpiration, s));
202
+ }
203
+ }
204
+ function P() {
205
+ const r = /* @__PURE__ */ new Date();
206
+ r.setHours(r.getHours() + 1);
207
+ const e = r.getTime() / 1e3;
208
+ document.cookie = `app.at_exp=${e}`;
209
+ }
210
+ function f() {
211
+ document.cookie = 'app.at_exp=;expires=Thu, 01 Jan 1970 00:00:00 GMT';
212
+ }
213
+ function w(r) {
214
+ const e = {
215
+ ...window.location,
216
+ assign: r.fn(),
217
+ };
218
+ return r.spyOn(window, 'location', 'get').mockReturnValue(e), e;
219
+ }
220
+
4
221
  /**
5
222
  * Service class to use with FusionAuth backend endpoints.
6
223
  */
7
224
  class FusionAuthService {
8
225
  constructor(config) {
9
- this.config = config;
226
+ this.core = new U({
227
+ ...config,
228
+ onTokenExpiration: () => {
229
+ this.isLoggedInSubject.next(false);
230
+ },
231
+ });
232
+ this.isLoggedInSubject = new BehaviorSubject(this.core.isLoggedIn);
233
+ this.isLoggedIn$ = this.isLoggedInSubject.asObservable();
234
+ this.core.handlePostRedirect(config.onRedirect);
235
+ if (config.shouldAutoRefresh && this.core.isLoggedIn) {
236
+ this.initAutoRefresh();
237
+ }
238
+ }
239
+ /** A function that returns whether the user is logged in. This returned value is non-observable. */
240
+ isLoggedIn() {
241
+ return this.core.isLoggedIn;
10
242
  }
11
243
  /**
12
- * Calls the 'me' endpoint to retrieve user info.
13
- * @return {Promise<UserInfo>} the user info response.
244
+ * Refreshes the access token a single time.
245
+ * Automatic token refreshing can be enabled if the SDK is configured with `shouldAutoRefresh`.
14
246
  */
15
- async getUserInfo() {
16
- const path = this.config.mePath ? this.config.mePath : '/app/me';
17
- const uri = this.getUrlForPath(path);
18
- const resp = await fetch(uri.href, {
19
- credentials: 'include',
20
- });
21
- return JSON.parse(await resp.text());
247
+ async refreshToken() {
248
+ return await this.core.refreshToken();
22
249
  }
23
250
  /**
24
- * Checks for the 'app.at_exp' cookie and if present sets a timer to refresh the access token.
25
- * Will attempt to refresh the configured seconds before the access token expires (default is ten seconds).
251
+ * Initializes automatic access token refreshing.
252
+ * This is handled automatically if the SDK is configured with `shouldAutoRefresh`.
26
253
  */
27
254
  initAutoRefresh() {
28
- const exp = this.getExpTime();
29
- if (exp) {
30
- const refreshBeforeSeconds = this.config.autoRefreshSecondsBeforeExpiry
31
- ? this.config.autoRefreshSecondsBeforeExpiry
32
- : 10;
33
- const now = new Date().getTime();
34
- const refreshTime = exp - refreshBeforeSeconds * 1000;
35
- let timeTillThen = refreshTime - now;
36
- if (timeTillThen <= 0) {
37
- timeTillThen = 0;
38
- }
39
- setTimeout(async () => {
40
- try {
41
- await this.refreshToken();
42
- this.initAutoRefresh();
43
- }
44
- catch (e) {
45
- console.error(e);
46
- }
47
- }, timeTillThen);
255
+ if (this.autoRefreshTimer) {
256
+ clearTimeout(this.autoRefreshTimer);
48
257
  }
258
+ this.autoRefreshTimer = this.core.initAutoRefresh();
49
259
  }
50
260
  /**
51
- * Checks that the 'app.at_exp' cookie is present and for a time in the future to determine logged-in state.
52
- * @return {boolean} app.at_exp is present and not for a time in the past
261
+ * Returns an observable request that fetches userInfo, and catches error.
53
262
  */
54
- isLoggedIn() {
55
- return (this.getExpTime() ?? 0) > new Date().getTime();
263
+ getUserInfoObservable(callbacks) {
264
+ callbacks?.onBegin?.();
265
+ return new Observable(observer => {
266
+ this.core
267
+ .fetchUserInfo()
268
+ .then(userInfo => {
269
+ observer.next(userInfo);
270
+ })
271
+ .catch(error => {
272
+ observer.error(error);
273
+ })
274
+ .finally(() => {
275
+ callbacks?.onDone?.();
276
+ });
277
+ }).pipe(catchError(error => {
278
+ throw error;
279
+ }));
56
280
  }
57
281
  /**
58
- * Calls the configured 'refresh' endpoint to attempt to refresh the access token cookie.
282
+ * Fetches userInfo from the 'me' endpoint.
283
+ * @throws {Error} - if an error occurred while fetching.
59
284
  */
60
- async refreshToken() {
61
- const path = this.config.tokenRefreshPath
62
- ? `${this.config.tokenRefreshPath}/${this.config.clientId}`
63
- : `/app/refresh/${this.config.clientId}`;
64
- const uri = this.getUrlForPath(path);
65
- const resp = await fetch(uri.href, {
66
- method: 'POST',
67
- credentials: 'include',
68
- headers: {
69
- 'Content-Type': 'text/plain',
70
- },
71
- });
72
- if (!(resp.status >= 200 && resp.status < 300)) {
73
- throw new Error('error refreshing access token in fusionauth');
74
- }
285
+ async getUserInfo() {
286
+ return await this.core.fetchUserInfo();
75
287
  }
76
288
  /**
77
- * Invokes a redirect to the configured 'login' endpoint.
289
+ * Initiates login flow.
290
+ * @param {string} [state] - Optional value to be echoed back to the SDK upon redirect.
78
291
  */
79
292
  startLogin(state) {
80
- const path = this.config.loginPath ? this.config.loginPath : '/app/login';
81
- state
82
- ? this.doRedirectForPath(path, { state })
83
- : this.doRedirectForPath(path);
293
+ this.core.startLogin(state);
84
294
  }
85
295
  /**
86
- * Invokes a redirect to the configured 'refresh' endpoint.
296
+ * Initiates register flow.
297
+ * @param {string} [state] - Optional value to be echoed back to the SDK upon redirect.
87
298
  */
88
299
  startRegistration(state) {
89
- const path = this.config.registerPath
90
- ? this.config.registerPath
91
- : '/app/register';
92
- state
93
- ? this.doRedirectForPath(path, { state })
94
- : this.doRedirectForPath(path);
300
+ this.core.startRegister(state);
95
301
  }
96
302
  /**
97
- * Invokes a redirect to the configured 'logout' endpoint.
303
+ * Initiates logout flow.
98
304
  */
99
305
  logout() {
100
- const path = this.config.logoutPath
101
- ? this.config.logoutPath
102
- : '/app/logout';
103
- this.doRedirectForPath(path);
104
- }
105
- doRedirectForPath(path, params = {}) {
106
- path = path + `/${this.config.clientId}`;
107
- if (this.config.redirectUri) {
108
- params['redirect_uri'] = this.config.redirectUri;
109
- }
110
- const location = this.getUrlForPath(path, params);
111
- window.location.assign(location);
112
- }
113
- getUrlForPath(path, params = {}) {
114
- const url = new URL(this.config.serverUrl);
115
- url.pathname = path;
116
- if (Object.entries(params).length > 0) {
117
- const urlParams = new URLSearchParams(params);
118
- url.search = urlParams.toString();
119
- }
120
- return url;
121
- }
122
- getExpTime() {
123
- const expCookie = document.cookie
124
- .split('; ')
125
- .map(c => c.split('='))
126
- .find(([name]) => name === 'app.at_exp');
127
- return expCookie ? parseInt(expCookie?.[1] ?? '0') * 1000 : null;
306
+ this.core.startLogout();
128
307
  }
129
308
  }
130
309
 
@@ -135,10 +314,10 @@ class FusionAuthLoginButtonComponent {
135
314
  login() {
136
315
  this.fusionAuth.startLogin(this.state);
137
316
  }
138
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthLoginButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
139
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: FusionAuthLoginButtonComponent, selector: "fa-login", inputs: { state: "state" }, ngImport: i0, template: "<button class=\"fa-button\" (click)=\"login()\">\n <span>Login</span>\n</button>\n", styles: [".fa-button{padding:16px 16px 13px;border-radius:8px;background-color:#083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:18px;font-weight:600;text-align:center;color:#fff;width:400px}.fa-button:hover{cursor:pointer}\n"] }); }
317
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthLoginButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
318
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FusionAuthLoginButtonComponent, selector: "fa-login", inputs: { state: "state" }, ngImport: i0, template: "<button class=\"fa-button\" (click)=\"login()\">\n <span>Login</span>\n</button>\n", styles: [".fa-button{padding:16px 16px 13px;border-radius:8px;background-color:#083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:18px;font-weight:600;text-align:center;color:#fff;width:400px}.fa-button:hover{cursor:pointer}\n"] }); }
140
319
  }
141
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthLoginButtonComponent, decorators: [{
320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthLoginButtonComponent, decorators: [{
142
321
  type: Component,
143
322
  args: [{ selector: 'fa-login', template: "<button class=\"fa-button\" (click)=\"login()\">\n <span>Login</span>\n</button>\n", styles: [".fa-button{padding:16px 16px 13px;border-radius:8px;background-color:#083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:18px;font-weight:600;text-align:center;color:#fff;width:400px}.fa-button:hover{cursor:pointer}\n"] }]
144
323
  }], ctorParameters: () => [{ type: FusionAuthService }], propDecorators: { state: [{
@@ -152,10 +331,10 @@ class FusionAuthLogoutButtonComponent {
152
331
  logout() {
153
332
  this.fusionAuth.logout();
154
333
  }
155
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthLogoutButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
156
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: FusionAuthLogoutButtonComponent, selector: "fa-logout", ngImport: i0, template: "<button class=\"fa-logout-button\" (click)=\"logout()\">\n <span>logout</span>\n</button>\n", styles: [".fa-logout-button{padding:7px 13px;border-radius:3px;display:block;border:solid 1px #083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:12px;text-align:center;color:#083b94}.fa-logout-button:hover{cursor:pointer}\n"] }); }
334
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthLogoutButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
335
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FusionAuthLogoutButtonComponent, selector: "fa-logout", ngImport: i0, template: "<button class=\"fa-logout-button\" (click)=\"logout()\">\n <span>logout</span>\n</button>\n", styles: [".fa-logout-button{padding:7px 13px;border-radius:3px;display:block;border:solid 1px #083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:12px;text-align:center;color:#083b94}.fa-logout-button:hover{cursor:pointer}\n"] }); }
157
336
  }
158
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthLogoutButtonComponent, decorators: [{
337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthLogoutButtonComponent, decorators: [{
159
338
  type: Component,
160
339
  args: [{ selector: 'fa-logout', template: "<button class=\"fa-logout-button\" (click)=\"logout()\">\n <span>logout</span>\n</button>\n", styles: [".fa-logout-button{padding:7px 13px;border-radius:3px;display:block;border:solid 1px #083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:12px;text-align:center;color:#083b94}.fa-logout-button:hover{cursor:pointer}\n"] }]
161
340
  }], ctorParameters: () => [{ type: FusionAuthService }] });
@@ -167,10 +346,10 @@ class FusionAuthRegisterButtonComponent {
167
346
  register() {
168
347
  this.fusionAuth.startRegistration(this.state);
169
348
  }
170
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthRegisterButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
171
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: FusionAuthRegisterButtonComponent, selector: "fa-register", inputs: { state: "state" }, ngImport: i0, template: "<button class=\"fa-button\" (click)=\"register()\">\n <span>Register Now</span>\n</button>\n", styles: [".fa-button{padding:16px 16px 13px;border-radius:8px;background-color:#083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:18px;font-weight:600;text-align:center;color:#fff;width:400px}.fa-button:hover{cursor:pointer}\n"] }); }
349
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthRegisterButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
350
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FusionAuthRegisterButtonComponent, selector: "fa-register", inputs: { state: "state" }, ngImport: i0, template: "<button class=\"fa-button\" (click)=\"register()\">\n <span>Register Now</span>\n</button>\n", styles: [".fa-button{padding:16px 16px 13px;border-radius:8px;background-color:#083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:18px;font-weight:600;text-align:center;color:#fff;width:400px}.fa-button:hover{cursor:pointer}\n"] }); }
172
351
  }
173
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthRegisterButtonComponent, decorators: [{
352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthRegisterButtonComponent, decorators: [{
174
353
  type: Component,
175
354
  args: [{ selector: 'fa-register', template: "<button class=\"fa-button\" (click)=\"register()\">\n <span>Register Now</span>\n</button>\n", styles: [".fa-button{padding:16px 16px 13px;border-radius:8px;background-color:#083b94;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol;font-size:18px;font-weight:600;text-align:center;color:#fff;width:400px}.fa-button:hover{cursor:pointer}\n"] }]
176
355
  }], ctorParameters: () => [{ type: FusionAuthService }], propDecorators: { state: [{
@@ -189,15 +368,15 @@ class FusionAuthModule {
189
368
  ],
190
369
  };
191
370
  }
192
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
193
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthModule, declarations: [FusionAuthLoginButtonComponent,
371
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
372
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthModule, declarations: [FusionAuthLoginButtonComponent,
194
373
  FusionAuthLogoutButtonComponent,
195
374
  FusionAuthRegisterButtonComponent], exports: [FusionAuthLoginButtonComponent,
196
375
  FusionAuthLogoutButtonComponent,
197
376
  FusionAuthRegisterButtonComponent] }); }
198
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthModule }); }
377
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthModule }); }
199
378
  }
200
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: FusionAuthModule, decorators: [{
379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FusionAuthModule, decorators: [{
201
380
  type: NgModule,
202
381
  args: [{
203
382
  declarations: [
@@ -1 +1 @@
1
- {"version":3,"file":"fusionauth-angular-sdk.mjs","sources":["../../../projects/fusionauth-angular-sdk/src/lib/fusion-auth.service.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-login.button/fusion-auth-login-button.component.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-login.button/fusion-auth-login-button.component.html","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-logout.button/fusion-auth-logout-button.component.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-logout.button/fusion-auth-logout-button.component.html","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-register.button/fusion-auth-register-button.component.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-register.button/fusion-auth-register-button.component.html","../../../projects/fusionauth-angular-sdk/src/lib/fusion-auth.module.ts","../../../projects/fusionauth-angular-sdk/src/public-api.ts","../../../projects/fusionauth-angular-sdk/src/fusionauth-angular-sdk.ts"],"sourcesContent":["import { FusionAuthConfig, UserInfo } from './types';\n\n/**\n * Service class to use with FusionAuth backend endpoints.\n */\nexport class FusionAuthService {\n constructor(private config: FusionAuthConfig) {}\n\n /**\n * Calls the 'me' endpoint to retrieve user info.\n * @return {Promise<UserInfo>} the user info response.\n */\n async getUserInfo(): Promise<UserInfo> {\n const path = this.config.mePath ? this.config.mePath : '/app/me';\n const uri = this.getUrlForPath(path);\n const resp = await fetch(uri.href, {\n credentials: 'include',\n });\n return JSON.parse(await resp.text()) as UserInfo;\n }\n\n /**\n * Checks for the 'app.at_exp' cookie and if present sets a timer to refresh the access token.\n * Will attempt to refresh the configured seconds before the access token expires (default is ten seconds).\n */\n initAutoRefresh(): void {\n const exp = this.getExpTime();\n if (exp) {\n const refreshBeforeSeconds = this.config.autoRefreshSecondsBeforeExpiry\n ? this.config.autoRefreshSecondsBeforeExpiry\n : 10;\n const now = new Date().getTime();\n const refreshTime = exp - refreshBeforeSeconds * 1000;\n let timeTillThen = refreshTime - now;\n if (timeTillThen <= 0) {\n timeTillThen = 0;\n }\n setTimeout(async () => {\n try {\n await this.refreshToken();\n this.initAutoRefresh();\n } catch (e) {\n console.error(e);\n }\n }, timeTillThen);\n }\n }\n\n /**\n * Checks that the 'app.at_exp' cookie is present and for a time in the future to determine logged-in state.\n * @return {boolean} app.at_exp is present and not for a time in the past\n */\n isLoggedIn(): boolean {\n return (this.getExpTime() ?? 0) > new Date().getTime();\n }\n\n /**\n * Calls the configured 'refresh' endpoint to attempt to refresh the access token cookie.\n */\n async refreshToken(): Promise<void> {\n const path = this.config.tokenRefreshPath\n ? `${this.config.tokenRefreshPath}/${this.config.clientId}`\n : `/app/refresh/${this.config.clientId}`;\n const uri = this.getUrlForPath(path);\n const resp = await fetch(uri.href, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'text/plain',\n },\n });\n if (!(resp.status >= 200 && resp.status < 300)) {\n throw new Error('error refreshing access token in fusionauth');\n }\n }\n\n /**\n * Invokes a redirect to the configured 'login' endpoint.\n */\n startLogin(state?: string): void {\n const path = this.config.loginPath ? this.config.loginPath : '/app/login';\n state\n ? this.doRedirectForPath(path, { state })\n : this.doRedirectForPath(path);\n }\n\n /**\n * Invokes a redirect to the configured 'refresh' endpoint.\n */\n startRegistration(state?: string): void {\n const path = this.config.registerPath\n ? this.config.registerPath\n : '/app/register';\n state\n ? this.doRedirectForPath(path, { state })\n : this.doRedirectForPath(path);\n }\n\n /**\n * Invokes a redirect to the configured 'logout' endpoint.\n */\n logout(): void {\n const path = this.config.logoutPath\n ? this.config.logoutPath\n : '/app/logout';\n this.doRedirectForPath(path);\n }\n\n private doRedirectForPath(path: string, params: Record<string, any> = {}) {\n path = path + `/${this.config.clientId}`;\n if (this.config.redirectUri) {\n params['redirect_uri'] = this.config.redirectUri;\n }\n const location = this.getUrlForPath(path, params);\n window.location.assign(location);\n }\n\n private getUrlForPath(path: string, params: Record<string, any> = {}): URL {\n const url = new URL(this.config.serverUrl);\n url.pathname = path;\n if (Object.entries(params).length > 0) {\n const urlParams = new URLSearchParams(params);\n url.search = urlParams.toString();\n }\n return url;\n }\n\n private getExpTime(): number | null {\n const expCookie = document.cookie\n .split('; ')\n .map(c => c.split('='))\n .find(([name]) => name === 'app.at_exp');\n return expCookie ? parseInt(expCookie?.[1] ?? '0') * 1000 : null;\n }\n}\n","import { Component, Input } from '@angular/core';\nimport { FusionAuthService } from '../../fusion-auth.service';\n\n@Component({\n selector: 'fa-login',\n templateUrl: './fusion-auth-login-button.component.html',\n styleUrls: ['./fusion-auth-login-button.component.scss'],\n})\nexport class FusionAuthLoginButtonComponent {\n @Input() state: string | undefined;\n\n constructor(private fusionAuth: FusionAuthService) {}\n\n login() {\n this.fusionAuth.startLogin(this.state);\n }\n}\n","<button class=\"fa-button\" (click)=\"login()\">\n <span>Login</span>\n</button>\n","import { Component } from '@angular/core';\nimport { FusionAuthService } from '../../fusion-auth.service';\n\n@Component({\n selector: 'fa-logout',\n templateUrl: './fusion-auth-logout-button.component.html',\n styleUrls: ['./fusion-auth-logout-button.component.scss'],\n})\nexport class FusionAuthLogoutButtonComponent {\n constructor(private fusionAuth: FusionAuthService) {}\n\n logout() {\n this.fusionAuth.logout();\n }\n}\n","<button class=\"fa-logout-button\" (click)=\"logout()\">\n <span>logout</span>\n</button>\n","import { Component, Input } from '@angular/core';\nimport { FusionAuthService } from '../../fusion-auth.service';\n\n@Component({\n selector: 'fa-register',\n templateUrl: './fusion-auth-register-button.component.html',\n styleUrls: ['./fusion-auth-register-button.component.scss'],\n})\nexport class FusionAuthRegisterButtonComponent {\n @Input() state: string | undefined;\n\n constructor(private fusionAuth: FusionAuthService) {}\n\n register() {\n this.fusionAuth.startRegistration(this.state);\n }\n}\n","<button class=\"fa-button\" (click)=\"register()\">\n <span>Register Now</span>\n</button>\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { FusionAuthConfig } from './types';\nimport { FusionAuthService } from './fusion-auth.service';\nimport { FusionAuthLoginButtonComponent } from './components/fusionauth-login.button/fusion-auth-login-button.component';\nimport { FusionAuthLogoutButtonComponent } from './components/fusionauth-logout.button/fusion-auth-logout-button.component';\nimport { FusionAuthRegisterButtonComponent } from './components/fusionauth-register.button/fusion-auth-register-button.component';\n\n@NgModule({\n declarations: [\n FusionAuthLoginButtonComponent,\n FusionAuthLogoutButtonComponent,\n FusionAuthRegisterButtonComponent,\n ],\n imports: [],\n exports: [\n FusionAuthLoginButtonComponent,\n FusionAuthLogoutButtonComponent,\n FusionAuthRegisterButtonComponent,\n ],\n})\nexport class FusionAuthModule {\n static forRoot(\n fusionAuthConfig: FusionAuthConfig,\n ): ModuleWithProviders<FusionAuthModule> {\n return {\n ngModule: FusionAuthModule,\n providers: [\n {\n provide: FusionAuthService,\n useValue: new FusionAuthService(fusionAuthConfig),\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of fusionauth-angular-sdk\n */\n\nexport * from './lib/fusion-auth.service';\nexport * from './lib/components/fusionauth-login.button/fusion-auth-login-button.component';\nexport * from './lib/components/fusionauth-logout.button/fusion-auth-logout-button.component';\nexport * from './lib/components/fusionauth-register.button/fusion-auth-register-button.component';\nexport * from './lib/fusion-auth.module';\nexport * from './lib/types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.FusionAuthService"],"mappings":";;;AAEA;;AAEG;MACU,iBAAiB,CAAA;AAC5B,IAAA,WAAA,CAAoB,MAAwB,EAAA;QAAxB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAkB;KAAI;AAEhD;;;AAGG;AACH,IAAA,MAAM,WAAW,GAAA;AACf,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC;QACjE,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;AACjC,YAAA,WAAW,EAAE,SAAS;AACvB,SAAA,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAa,CAAC;KAClD;AAED;;;AAGG;IACH,eAAe,GAAA;AACb,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9B,IAAI,GAAG,EAAE;AACP,YAAA,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,8BAA8B;AACrE,kBAAE,IAAI,CAAC,MAAM,CAAC,8BAA8B;kBAC1C,EAAE,CAAC;YACP,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AACjC,YAAA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QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,iBAXzB,8BAA8B;YAC9B,+BAA+B;AAC/B,YAAA,iCAAiC,aAIjC,8BAA8B;YAC9B,+BAA+B;YAC/B,iCAAiC,CAAA,EAAA,CAAA,CAAA,EAAA;+GAGxB,gBAAgB,EAAA,CAAA,CAAA,EAAA;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAb5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,8BAA8B;wBAC9B,+BAA+B;wBAC/B,iCAAiC;AAClC,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;wBACP,8BAA8B;wBAC9B,+BAA+B;wBAC/B,iCAAiC;AAClC,qBAAA;AACF,iBAAA,CAAA;;;ACnBD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"fusionauth-angular-sdk.mjs","sources":["../../../projects/fusionauth-angular-sdk/src/lib/core.ts","../../../projects/fusionauth-angular-sdk/src/lib/fusion-auth.service.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-login.button/fusion-auth-login-button.component.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-login.button/fusion-auth-login-button.component.html","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-logout.button/fusion-auth-logout-button.component.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-logout.button/fusion-auth-logout-button.component.html","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-register.button/fusion-auth-register-button.component.ts","../../../projects/fusionauth-angular-sdk/src/lib/components/fusionauth-register.button/fusion-auth-register-button.component.html","../../../projects/fusionauth-angular-sdk/src/lib/fusion-auth.module.ts","../../../projects/fusionauth-angular-sdk/src/public-api.ts","../../../projects/fusionauth-angular-sdk/src/fusionauth-angular-sdk.ts"],"sourcesContent":["// @ts-nocheck\nconst u = Object.defineProperty;\nconst d = (r, e, t) =>\n e in r\n ? u(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t })\n : (r[e] = t);\nconst i = (r, e, t) => (d(r, typeof e != 'symbol' ? e + '' : e, t), t);\nclass g {\n constructor(e) {\n i(this, 'serverUrl');\n i(this, 'clientId');\n i(this, 'redirectUri');\n i(this, 'scope');\n i(this, 'mePath');\n i(this, 'loginPath');\n i(this, 'registerPath');\n i(this, 'logoutPath');\n i(this, 'tokenRefreshPath');\n (this.serverUrl = e.serverUrl),\n (this.clientId = e.clientId),\n (this.redirectUri = e.redirectUri),\n (this.scope = e.scope),\n (this.mePath = e.mePath ?? '/app/me'),\n (this.loginPath = e.loginPath ?? '/app/login'),\n (this.registerPath = e.registerPath ?? '/app/register'),\n (this.logoutPath = e.logoutPath ?? '/app/logout'),\n (this.tokenRefreshPath = e.tokenRefreshPath ?? '/app/refresh');\n }\n getMeUrl() {\n return this.generateUrl(this.mePath);\n }\n getLoginUrl(e) {\n return this.generateUrl(this.loginPath, {\n client_id: this.clientId,\n redirect_uri: this.redirectUri,\n scope: this.scope,\n state: e,\n });\n }\n getRegisterUrl(e) {\n return this.generateUrl(this.registerPath, {\n client_id: this.clientId,\n redirect_uri: this.redirectUri,\n scope: this.scope,\n state: e,\n });\n }\n getLogoutUrl() {\n return this.generateUrl(this.logoutPath, {\n client_id: this.clientId,\n post_logout_redirect_uri: this.redirectUri,\n });\n }\n getTokenRefreshUrl() {\n return this.generateUrl(this.tokenRefreshPath, {\n client_id: this.clientId,\n });\n }\n generateUrl(e, t) {\n const s = new URL(this.serverUrl);\n if (((s.pathname = e), t)) {\n const o = this.generateURLSearchParams(t);\n s.search = o.toString();\n }\n return s;\n }\n generateURLSearchParams(e) {\n const t = new URLSearchParams();\n return (\n Object.entries(e).forEach(([s, o]) => {\n o && t.append(s, o);\n }),\n t\n );\n }\n}\nclass p {\n constructor() {\n i(this, 'REDIRECT_VALUE', 'fa-sdk-redirect-value');\n }\n handlePreRedirect(e) {\n const t = `${this.generateRandomString()}:${e ?? ''}`;\n localStorage.setItem(this.REDIRECT_VALUE, t);\n }\n handlePostRedirect(e) {\n const t = this.stateValue ?? void 0;\n e == null || e(t), localStorage.removeItem(this.REDIRECT_VALUE);\n }\n get didRedirect() {\n return !!localStorage.getItem(this.REDIRECT_VALUE);\n }\n get stateValue() {\n const e = localStorage.getItem(this.REDIRECT_VALUE);\n if (!e) return null;\n const [, ...t] = e.split(':');\n return t.join(':');\n }\n generateRandomString() {\n const e = new Uint32Array(28);\n return (\n window.crypto.getRandomValues(e),\n Array.from(e, t => ('0' + t.toString(16)).substring(-2)).join('')\n );\n }\n}\nfunction m(r = 'app.at_exp') {\n const e = document.cookie\n .split('; ')\n .map(s => s.split('='))\n .find(([s]) => s === r),\n t = e == null ? void 0 : e[1];\n return t ? parseInt(t) * 1e3 : null;\n}\nclass U {\n constructor(e) {\n i(this, 'config');\n i(this, 'urlHelper');\n i(this, 'redirectHelper', new p());\n i(this, 'tokenExpirationTimeout');\n (this.config = e),\n (this.urlHelper = new g({\n serverUrl: e.serverUrl,\n clientId: e.clientId,\n redirectUri: e.redirectUri,\n scope: e.scope,\n mePath: e.mePath,\n loginPath: e.loginPath,\n registerPath: e.registerPath,\n logoutPath: e.logoutPath,\n tokenRefreshPath: e.tokenRefreshPath,\n })),\n this.scheduleTokenExpiration();\n }\n startLogin(e) {\n this.redirectHelper.handlePreRedirect(e),\n window.location.assign(this.urlHelper.getLoginUrl(e));\n }\n startRegister(e) {\n this.redirectHelper.handlePreRedirect(e),\n window.location.assign(this.urlHelper.getRegisterUrl(e));\n }\n startLogout() {\n window.location.assign(this.urlHelper.getLogoutUrl());\n }\n async fetchUserInfo() {\n const e = await fetch(this.urlHelper.getMeUrl(), {\n credentials: 'include',\n });\n if (!e.ok)\n throw new Error(\n `Unable to fetch userInfo in fusionauth. Request failed with status code ${e == null ? void 0 : e.status}`,\n );\n return await e.json();\n }\n async refreshToken() {\n const e = await fetch(this.urlHelper.getTokenRefreshUrl(), {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'text/plain',\n },\n });\n if (!(e.status >= 200 && e.status < 300)) {\n const t =\n (await (e == null ? void 0 : e.text())) ||\n 'Error refreshing access token in fusionauth';\n throw new Error(t);\n }\n return this.scheduleTokenExpiration(), e;\n }\n initAutoRefresh() {\n const e = this.at_exp,\n t = this.config.autoRefreshSecondsBeforeExpiry ?? 10;\n if (!e) return;\n const s = t * 1e3,\n o = /* @__PURE__ */ new Date().getTime(),\n h = e - s,\n l = Math.max(h - o, 0);\n return setTimeout(async () => {\n let n, a;\n try {\n await this.refreshToken(), this.initAutoRefresh();\n } catch (c) {\n (a = (n = this.config).onAutoRefreshFailure) == null || a.call(n, c);\n }\n }, l);\n }\n handlePostRedirect(e) {\n this.isLoggedIn &&\n this.redirectHelper.didRedirect &&\n this.redirectHelper.handlePostRedirect(e);\n }\n get isLoggedIn() {\n return this.at_exp\n ? this.at_exp > /* @__PURE__ */ new Date().getTime()\n : !1;\n }\n /** The moment of access token expiration in milliseconds since epoch. */\n get at_exp() {\n return m(this.config.accessTokenExpireCookieName);\n }\n /** Schedules `onTokenExpiration` at moment of access token expiration. */\n scheduleTokenExpiration() {\n clearTimeout(this.tokenExpirationTimeout);\n const e = this.at_exp ?? -1,\n t = /* @__PURE__ */ new Date().getTime(),\n s = e - t;\n s > 0 &&\n (this.tokenExpirationTimeout = setTimeout(\n this.config.onTokenExpiration,\n s,\n ));\n }\n}\nfunction P() {\n const r = /* @__PURE__ */ new Date();\n r.setHours(r.getHours() + 1);\n const e = r.getTime() / 1e3;\n document.cookie = `app.at_exp=${e}`;\n}\nfunction f() {\n document.cookie = 'app.at_exp=;expires=Thu, 01 Jan 1970 00:00:00 GMT';\n}\nfunction w(r) {\n const e = {\n ...window.location,\n assign: r.fn(),\n };\n return r.spyOn(window, 'location', 'get').mockReturnValue(e), e;\n}\nexport {\n U as SDKCore,\n P as mockIsLoggedIn,\n w as mockWindowLocation,\n f as removeAt_expCookie,\n};\n","import { SDKCore } from './core';\nimport { FusionAuthConfig, UserInfo } from './types';\nimport { Observable, catchError, BehaviorSubject } from 'rxjs';\n\n/**\n * Service class to use with FusionAuth backend endpoints.\n */\nexport class FusionAuthService {\n private core: SDKCore;\n private autoRefreshTimer?: NodeJS.Timeout;\n private isLoggedInSubject: BehaviorSubject<boolean>;\n\n constructor(config: FusionAuthConfig) {\n this.core = new SDKCore({\n ...config,\n onTokenExpiration: () => {\n this.isLoggedInSubject.next(false);\n },\n });\n\n this.isLoggedInSubject = new BehaviorSubject(this.core.isLoggedIn);\n this.isLoggedIn$ = this.isLoggedInSubject.asObservable();\n\n this.core.handlePostRedirect(config.onRedirect);\n\n if (config.shouldAutoRefresh && this.core.isLoggedIn) {\n this.initAutoRefresh();\n }\n }\n\n /** An observable representing whether the user is logged in. */\n isLoggedIn$: Observable<boolean>;\n\n /** A function that returns whether the user is logged in. This returned value is non-observable. */\n isLoggedIn() {\n return this.core.isLoggedIn;\n }\n\n /**\n * Refreshes the access token a single time.\n * Automatic token refreshing can be enabled if the SDK is configured with `shouldAutoRefresh`.\n */\n async refreshToken(): Promise<Response> {\n return await this.core.refreshToken();\n }\n\n /**\n * Initializes automatic access token refreshing.\n * This is handled automatically if the SDK is configured with `shouldAutoRefresh`.\n */\n initAutoRefresh(): void {\n if (this.autoRefreshTimer) {\n clearTimeout(this.autoRefreshTimer);\n }\n\n this.autoRefreshTimer = this.core.initAutoRefresh();\n }\n\n /**\n * Returns an observable request that fetches userInfo, and catches error.\n */\n getUserInfoObservable(callbacks?: {\n onBegin?: () => void;\n onDone?: () => void;\n }): Observable<UserInfo> {\n callbacks?.onBegin?.();\n return new Observable<UserInfo>(observer => {\n this.core\n .fetchUserInfo()\n .then(userInfo => {\n observer.next(userInfo);\n })\n .catch(error => {\n observer.error(error);\n })\n .finally(() => {\n callbacks?.onDone?.();\n });\n }).pipe(\n catchError(error => {\n throw error;\n }),\n );\n }\n\n /**\n * Fetches userInfo from the 'me' endpoint.\n * @throws {Error} - if an error occurred while fetching.\n */\n async getUserInfo(): Promise<UserInfo> {\n return await this.core.fetchUserInfo();\n }\n\n /**\n * Initiates login flow.\n * @param {string} [state] - Optional value to be echoed back to the SDK upon redirect.\n */\n startLogin(state?: string): void {\n this.core.startLogin(state);\n }\n\n /**\n * Initiates register flow.\n * @param {string} [state] - Optional value to be echoed back to the SDK upon redirect.\n */\n startRegistration(state?: string): void {\n this.core.startRegister(state);\n }\n\n /**\n * Initiates logout flow.\n */\n logout(): void {\n this.core.startLogout();\n }\n}\n","import { Component, Input } from '@angular/core';\nimport { FusionAuthService } from '../../fusion-auth.service';\n\n@Component({\n selector: 'fa-login',\n templateUrl: './fusion-auth-login-button.component.html',\n styleUrls: ['./fusion-auth-login-button.component.scss'],\n})\nexport class FusionAuthLoginButtonComponent {\n @Input() state: string | undefined;\n\n constructor(private fusionAuth: FusionAuthService) {}\n\n login() {\n this.fusionAuth.startLogin(this.state);\n }\n}\n","<button class=\"fa-button\" (click)=\"login()\">\n <span>Login</span>\n</button>\n","import { Component } from '@angular/core';\nimport { FusionAuthService } from '../../fusion-auth.service';\n\n@Component({\n selector: 'fa-logout',\n templateUrl: './fusion-auth-logout-button.component.html',\n styleUrls: ['./fusion-auth-logout-button.component.scss'],\n})\nexport class FusionAuthLogoutButtonComponent {\n constructor(private fusionAuth: FusionAuthService) {}\n\n logout() {\n this.fusionAuth.logout();\n }\n}\n","<button class=\"fa-logout-button\" (click)=\"logout()\">\n <span>logout</span>\n</button>\n","import { Component, Input } from '@angular/core';\nimport { FusionAuthService } from '../../fusion-auth.service';\n\n@Component({\n selector: 'fa-register',\n templateUrl: './fusion-auth-register-button.component.html',\n styleUrls: ['./fusion-auth-register-button.component.scss'],\n})\nexport class FusionAuthRegisterButtonComponent {\n @Input() state: string | undefined;\n\n constructor(private fusionAuth: FusionAuthService) {}\n\n register() {\n this.fusionAuth.startRegistration(this.state);\n }\n}\n","<button class=\"fa-button\" (click)=\"register()\">\n <span>Register Now</span>\n</button>\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { FusionAuthConfig } from './types';\nimport { FusionAuthService } from './fusion-auth.service';\nimport { FusionAuthLoginButtonComponent } from './components/fusionauth-login.button/fusion-auth-login-button.component';\nimport { FusionAuthLogoutButtonComponent } from './components/fusionauth-logout.button/fusion-auth-logout-button.component';\nimport { FusionAuthRegisterButtonComponent } from './components/fusionauth-register.button/fusion-auth-register-button.component';\n\n@NgModule({\n declarations: [\n FusionAuthLoginButtonComponent,\n FusionAuthLogoutButtonComponent,\n FusionAuthRegisterButtonComponent,\n ],\n imports: [],\n exports: [\n FusionAuthLoginButtonComponent,\n FusionAuthLogoutButtonComponent,\n FusionAuthRegisterButtonComponent,\n ],\n})\nexport class FusionAuthModule {\n static forRoot(\n fusionAuthConfig: FusionAuthConfig,\n ): ModuleWithProviders<FusionAuthModule> {\n return {\n ngModule: FusionAuthModule,\n providers: [\n {\n provide: FusionAuthService,\n useValue: new FusionAuthService(fusionAuthConfig),\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of fusionauth-angular-sdk\n */\n\nexport * from './lib/fusion-auth.service';\nexport * from './lib/components/fusionauth-login.button/fusion-auth-login-button.component';\nexport * from './lib/components/fusionauth-logout.button/fusion-auth-logout-button.component';\nexport * from './lib/components/fusionauth-register.button/fusion-auth-register-button.component';\nexport * from './lib/fusion-auth.module';\nexport * from './lib/types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["SDKCore","i1.FusionAuthService"],"mappings":";;;;AAAA;AACA,MAAM,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC;AAChC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAChB,CAAC,IAAI,CAAC;MACF,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,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,iCAAiC;AAClC,qBAAA;AACD,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE;wBACP,8BAA8B;wBAC9B,+BAA+B;wBAC/B,iCAAiC;AAClC,qBAAA;AACF,iBAAA,CAAA;;;ACnBD;;AAEG;;ACFH;;AAEG;;;;"}
package/lib/core.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ /// <reference types="node" />
2
+ declare class U {
3
+ constructor(e: any);
4
+ startLogin(e: any): void;
5
+ startRegister(e: any): void;
6
+ startLogout(): void;
7
+ fetchUserInfo(): Promise<any>;
8
+ refreshToken(): Promise<Response>;
9
+ initAutoRefresh(): NodeJS.Timeout | undefined;
10
+ handlePostRedirect(e: any): void;
11
+ get isLoggedIn(): boolean;
12
+ /** The moment of access token expiration in milliseconds since epoch. */
13
+ get at_exp(): number | null;
14
+ /** Schedules `onTokenExpiration` at moment of access token expiration. */
15
+ scheduleTokenExpiration(): void;
16
+ }
17
+ declare function P(): void;
18
+ declare function f(): void;
19
+ declare function w(r: any): {
20
+ assign: any;
21
+ ancestorOrigins: DOMStringList;
22
+ hash: string;
23
+ host: string;
24
+ hostname: string;
25
+ href: string;
26
+ toString(): string;
27
+ origin: string;
28
+ pathname: string;
29
+ port: string;
30
+ protocol: string;
31
+ search: string;
32
+ reload(): void;
33
+ replace(url: string | URL): void;
34
+ };
35
+ export { U as SDKCore, P as mockIsLoggedIn, w as mockWindowLocation, f as removeAt_expCookie, };