@fusionauth/angular-sdk 0.1.5 → 1.0.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/README.md +42 -69
- package/{esm2020 → esm2022}/lib/components/fusionauth-login.button/fusion-auth-login-button.component.mjs +5 -5
- package/esm2022/lib/components/fusionauth-logout.button/fusion-auth-logout-button.component.mjs +18 -0
- package/esm2022/lib/components/fusionauth-register.button/fusion-auth-register-button.component.mjs +20 -0
- package/esm2022/lib/core.mjs +241 -0
- package/esm2022/lib/fusion-auth.module.mjs +43 -0
- package/esm2022/lib/fusion-auth.service.mjs +91 -0
- package/esm2022/lib/types.mjs +2 -0
- package/fesm2022/fusionauth-angular-sdk.mjs +429 -0
- package/fesm2022/fusionauth-angular-sdk.mjs.map +1 -0
- package/lib/components/fusionauth-login.button/fusion-auth-login-button.component.d.ts +1 -1
- package/lib/components/fusionauth-register.button/fusion-auth-register-button.component.d.ts +1 -1
- package/lib/core.d.ts +57 -0
- package/lib/fusion-auth.service.d.ts +26 -17
- package/lib/types.d.ts +44 -2
- package/package.json +9 -21
- package/esm2020/lib/components/fusionauth-logout.button/fusion-auth-logout-button.component.mjs +0 -18
- package/esm2020/lib/components/fusionauth-register.button/fusion-auth-register-button.component.mjs +0 -20
- package/esm2020/lib/fusion-auth.module.mjs +0 -40
- package/esm2020/lib/fusion-auth.service.mjs +0 -126
- package/esm2020/lib/types.mjs +0 -2
- package/fesm2015/fusionauth-angular-sdk.mjs +0 -228
- package/fesm2015/fusionauth-angular-sdk.mjs.map +0 -1
- package/fesm2020/fusionauth-angular-sdk.mjs +0 -222
- package/fesm2020/fusionauth-angular-sdk.mjs.map +0 -1
- /package/{esm2020 → esm2022}/fusionauth-angular-sdk.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from 'tslib';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { Component, Input, NgModule } from '@angular/core';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Service class to use with FusionAuth backend endpoints.
|
|
7
|
-
*/
|
|
8
|
-
class FusionAuthService {
|
|
9
|
-
constructor(config) {
|
|
10
|
-
this.config = config;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Calls the 'me' endpoint to retrieve user info.
|
|
14
|
-
* @return {Promise<UserInfo>} the user info response.
|
|
15
|
-
*/
|
|
16
|
-
getUserInfo() {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const path = !!this.config.mePath
|
|
19
|
-
? this.config.mePath
|
|
20
|
-
: '/app/me';
|
|
21
|
-
const uri = this.getUrlForPath(path);
|
|
22
|
-
const resp = yield fetch(uri.href, {
|
|
23
|
-
credentials: 'include',
|
|
24
|
-
});
|
|
25
|
-
return JSON.parse(yield resp.text());
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Checks for the 'app.at_exp' cookie and if present sets a timer to refresh the access token.
|
|
30
|
-
* Will attempt to refresh the configured seconds before the access token expires (default is ten seconds).
|
|
31
|
-
*/
|
|
32
|
-
initAutoRefresh() {
|
|
33
|
-
const exp = this.getExpTime();
|
|
34
|
-
if (exp) {
|
|
35
|
-
const refreshBeforeSeconds = this.config.autoRefreshSecondsBeforeExpiry
|
|
36
|
-
? this.config.autoRefreshSecondsBeforeExpiry
|
|
37
|
-
: 10;
|
|
38
|
-
const now = new Date().getTime();
|
|
39
|
-
const refreshTime = exp - (refreshBeforeSeconds * 1000);
|
|
40
|
-
let timeTillThen = refreshTime - now;
|
|
41
|
-
if (timeTillThen <= 0) {
|
|
42
|
-
timeTillThen = 0;
|
|
43
|
-
}
|
|
44
|
-
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
try {
|
|
46
|
-
yield this.refreshToken();
|
|
47
|
-
this.initAutoRefresh();
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
console.error(e);
|
|
51
|
-
}
|
|
52
|
-
}), timeTillThen);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Checks that the 'app.at_exp' cookie is present and for a time in the future to determine logged-in state.
|
|
57
|
-
* @return {boolean} app.at_exp is present and not for a time in the past
|
|
58
|
-
*/
|
|
59
|
-
isLoggedIn() {
|
|
60
|
-
var _a;
|
|
61
|
-
return ((_a = this.getExpTime()) !== null && _a !== void 0 ? _a : 0) > new Date().getTime();
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Calls the configured 'refresh' endpoint to attempt to refresh the access token cookie.
|
|
65
|
-
*/
|
|
66
|
-
refreshToken() {
|
|
67
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
const path = !!this.config.tokenRefreshPath
|
|
69
|
-
? `${this.config.tokenRefreshPath}/${this.config.clientId}`
|
|
70
|
-
: `/app/refresh/${this.config.clientId}`;
|
|
71
|
-
const uri = this.getUrlForPath(path);
|
|
72
|
-
const resp = yield fetch(uri.href, {
|
|
73
|
-
method: 'POST',
|
|
74
|
-
credentials: 'include',
|
|
75
|
-
headers: {
|
|
76
|
-
'Content-Type': 'text/plain',
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
if (!(resp.status >= 200 && resp.status < 300)) {
|
|
80
|
-
throw new Error('error refreshing access token in fusionauth');
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Invokes a redirect to the configured 'login' endpoint.
|
|
86
|
-
*/
|
|
87
|
-
startLogin(state) {
|
|
88
|
-
const path = !!this.config.loginPath
|
|
89
|
-
? this.config.loginPath
|
|
90
|
-
: '/app/login';
|
|
91
|
-
!!state ? this.doRedirectForPath(path, { state }) : this.doRedirectForPath(path);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Invokes a redirect to the configured 'refresh' endpoint.
|
|
95
|
-
*/
|
|
96
|
-
startRegistration(state) {
|
|
97
|
-
const path = !!this.config.registerPath
|
|
98
|
-
? this.config.registerPath
|
|
99
|
-
: '/app/register';
|
|
100
|
-
!!state ? this.doRedirectForPath(path, { state }) : this.doRedirectForPath(path);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Invokes a redirect to the configured 'logout' endpoint.
|
|
104
|
-
*/
|
|
105
|
-
logout() {
|
|
106
|
-
const path = !!this.config.logoutPath
|
|
107
|
-
? this.config.logoutPath
|
|
108
|
-
: '/app/logout';
|
|
109
|
-
this.doRedirectForPath(path);
|
|
110
|
-
}
|
|
111
|
-
doRedirectForPath(path, params = {}) {
|
|
112
|
-
path = path + `/${this.config.clientId}`;
|
|
113
|
-
if (this.config.redirectUri) {
|
|
114
|
-
params['redirect_uri'] = this.config.redirectUri;
|
|
115
|
-
}
|
|
116
|
-
let location = this.getUrlForPath(path, params);
|
|
117
|
-
window.location.assign(location);
|
|
118
|
-
}
|
|
119
|
-
getUrlForPath(path, params = {}) {
|
|
120
|
-
let url = new URL(this.config.serverUrl);
|
|
121
|
-
url.pathname = path;
|
|
122
|
-
if (Object.entries(params).length > 0) {
|
|
123
|
-
const urlParams = new URLSearchParams(params);
|
|
124
|
-
url.search = urlParams.toString();
|
|
125
|
-
}
|
|
126
|
-
return url;
|
|
127
|
-
}
|
|
128
|
-
getExpTime() {
|
|
129
|
-
const expCookie = document.cookie.split('; ')
|
|
130
|
-
.map(c => c.split('='))
|
|
131
|
-
.find(([name]) => name === 'app.at_exp');
|
|
132
|
-
return expCookie ? parseInt(expCookie[1]) * 1000 : null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
class FusionAuthLoginButtonComponent {
|
|
137
|
-
constructor(fusionAuth) {
|
|
138
|
-
this.fusionAuth = fusionAuth;
|
|
139
|
-
}
|
|
140
|
-
login() {
|
|
141
|
-
this.fusionAuth.startLogin(this.state);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
FusionAuthLoginButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLoginButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
145
|
-
FusionAuthLoginButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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"] });
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLoginButtonComponent, decorators: [{
|
|
147
|
-
type: Component,
|
|
148
|
-
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"] }]
|
|
149
|
-
}], ctorParameters: function () { return [{ type: FusionAuthService }]; }, propDecorators: { state: [{
|
|
150
|
-
type: Input
|
|
151
|
-
}] } });
|
|
152
|
-
|
|
153
|
-
class FusionAuthLogoutButtonComponent {
|
|
154
|
-
constructor(fusionAuth) {
|
|
155
|
-
this.fusionAuth = fusionAuth;
|
|
156
|
-
}
|
|
157
|
-
logout() {
|
|
158
|
-
this.fusionAuth.logout();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
FusionAuthLogoutButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLogoutButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
162
|
-
FusionAuthLogoutButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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"] });
|
|
163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLogoutButtonComponent, decorators: [{
|
|
164
|
-
type: Component,
|
|
165
|
-
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"] }]
|
|
166
|
-
}], ctorParameters: function () { return [{ type: FusionAuthService }]; } });
|
|
167
|
-
|
|
168
|
-
class FusionAuthRegisterButtonComponent {
|
|
169
|
-
constructor(fusionAuth) {
|
|
170
|
-
this.fusionAuth = fusionAuth;
|
|
171
|
-
}
|
|
172
|
-
register() {
|
|
173
|
-
this.fusionAuth.startRegistration(this.state);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
FusionAuthRegisterButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthRegisterButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
177
|
-
FusionAuthRegisterButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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"] });
|
|
178
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthRegisterButtonComponent, decorators: [{
|
|
179
|
-
type: Component,
|
|
180
|
-
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"] }]
|
|
181
|
-
}], ctorParameters: function () { return [{ type: FusionAuthService }]; }, propDecorators: { state: [{
|
|
182
|
-
type: Input
|
|
183
|
-
}] } });
|
|
184
|
-
|
|
185
|
-
class FusionAuthModule {
|
|
186
|
-
static forRoot(fusionAuthConfig) {
|
|
187
|
-
return {
|
|
188
|
-
ngModule: FusionAuthModule,
|
|
189
|
-
providers: [
|
|
190
|
-
{ provide: FusionAuthService, useValue: new FusionAuthService(fusionAuthConfig) }
|
|
191
|
-
],
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
FusionAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
196
|
-
FusionAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule, declarations: [FusionAuthLoginButtonComponent,
|
|
197
|
-
FusionAuthLogoutButtonComponent,
|
|
198
|
-
FusionAuthRegisterButtonComponent], exports: [FusionAuthLoginButtonComponent,
|
|
199
|
-
FusionAuthLogoutButtonComponent,
|
|
200
|
-
FusionAuthRegisterButtonComponent] });
|
|
201
|
-
FusionAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule });
|
|
202
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule, decorators: [{
|
|
203
|
-
type: NgModule,
|
|
204
|
-
args: [{
|
|
205
|
-
declarations: [
|
|
206
|
-
FusionAuthLoginButtonComponent,
|
|
207
|
-
FusionAuthLogoutButtonComponent,
|
|
208
|
-
FusionAuthRegisterButtonComponent,
|
|
209
|
-
],
|
|
210
|
-
imports: [],
|
|
211
|
-
exports: [
|
|
212
|
-
FusionAuthLoginButtonComponent,
|
|
213
|
-
FusionAuthLogoutButtonComponent,
|
|
214
|
-
FusionAuthRegisterButtonComponent,
|
|
215
|
-
]
|
|
216
|
-
}]
|
|
217
|
-
}] });
|
|
218
|
-
|
|
219
|
-
/*
|
|
220
|
-
* Public API Surface of fusionauth-angular-sdk
|
|
221
|
-
*/
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Generated bundle index. Do not edit.
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
export { FusionAuthLoginButtonComponent, FusionAuthLogoutButtonComponent, FusionAuthModule, FusionAuthRegisterButtonComponent, FusionAuthService };
|
|
228
|
-
//# sourceMappingURL=fusionauth-angular-sdk.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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\n constructor(\n private config: FusionAuthConfig,\n ) { }\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\n ? this.config.mePath\n : '/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\n ? this.config.loginPath\n : '/app/login';\n !!state ? this.doRedirectForPath(path, {state}) : 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 ? this.doRedirectForPath(path, {state}) : 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 let location = this.getUrlForPath(path, params) ;\n window.location.assign(location);\n }\n\n private getUrlForPath(path: string, params: Record<string, any> = {}): URL {\n let 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.split('; ')\n .map(c => c.split('='))\n .find(([name]) => name === 'app.at_exp');\n return expCookie ? parseInt(expCookie[1]) * 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(\n private fusionAuth: FusionAuthService,\n ) {}\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(\n private fusionAuth: FusionAuthService,\n ) {}\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 {\n FusionAuthLogoutButtonComponent\n} from './components/fusionauth-logout.button/fusion-auth-logout-button.component';\nimport {\n FusionAuthRegisterButtonComponent\n} 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 ],\n exports: [\n FusionAuthLoginButtonComponent,\n FusionAuthLogoutButtonComponent,\n FusionAuthRegisterButtonComponent,\n ]\n})\nexport class FusionAuthModule {\n static forRoot(fusionAuthConfig: FusionAuthConfig): ModuleWithProviders<FusionAuthModule> {\n return {\n ngModule: FusionAuthModule,\n providers: [\n { provide: FusionAuthService, useValue: new FusionAuthService(fusionAuthConfig) }\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;AAE5B,IAAA,WAAA,CACU,MAAwB,EAAA;AAAxB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAkB;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AAA;AACR,oBAAA,YAAY,EAAE;wBACZ,8BAA8B;wBAC9B,+BAA+B;wBAC/B,iCAAiC;AAClC,qBAAA;AACD,oBAAA,OAAO,EAAE,EACR;AACD,oBAAA,OAAO,EAAE;wBACP,8BAA8B;wBAC9B,+BAA+B;wBAC/B,iCAAiC;AAClC,qBAAA;iBACF,CAAA;;;ACxBD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Input, NgModule } from '@angular/core';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Service class to use with FusionAuth backend endpoints.
|
|
6
|
-
*/
|
|
7
|
-
class FusionAuthService {
|
|
8
|
-
constructor(config) {
|
|
9
|
-
this.config = config;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Calls the 'me' endpoint to retrieve user info.
|
|
13
|
-
* @return {Promise<UserInfo>} the user info response.
|
|
14
|
-
*/
|
|
15
|
-
async getUserInfo() {
|
|
16
|
-
const path = !!this.config.mePath
|
|
17
|
-
? this.config.mePath
|
|
18
|
-
: '/app/me';
|
|
19
|
-
const uri = this.getUrlForPath(path);
|
|
20
|
-
const resp = await fetch(uri.href, {
|
|
21
|
-
credentials: 'include',
|
|
22
|
-
});
|
|
23
|
-
return JSON.parse(await resp.text());
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Checks for the 'app.at_exp' cookie and if present sets a timer to refresh the access token.
|
|
27
|
-
* Will attempt to refresh the configured seconds before the access token expires (default is ten seconds).
|
|
28
|
-
*/
|
|
29
|
-
initAutoRefresh() {
|
|
30
|
-
const exp = this.getExpTime();
|
|
31
|
-
if (exp) {
|
|
32
|
-
const refreshBeforeSeconds = this.config.autoRefreshSecondsBeforeExpiry
|
|
33
|
-
? this.config.autoRefreshSecondsBeforeExpiry
|
|
34
|
-
: 10;
|
|
35
|
-
const now = new Date().getTime();
|
|
36
|
-
const refreshTime = exp - (refreshBeforeSeconds * 1000);
|
|
37
|
-
let timeTillThen = refreshTime - now;
|
|
38
|
-
if (timeTillThen <= 0) {
|
|
39
|
-
timeTillThen = 0;
|
|
40
|
-
}
|
|
41
|
-
setTimeout(async () => {
|
|
42
|
-
try {
|
|
43
|
-
await this.refreshToken();
|
|
44
|
-
this.initAutoRefresh();
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
console.error(e);
|
|
48
|
-
}
|
|
49
|
-
}, timeTillThen);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Checks that the 'app.at_exp' cookie is present and for a time in the future to determine logged-in state.
|
|
54
|
-
* @return {boolean} app.at_exp is present and not for a time in the past
|
|
55
|
-
*/
|
|
56
|
-
isLoggedIn() {
|
|
57
|
-
return (this.getExpTime() ?? 0) > new Date().getTime();
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Calls the configured 'refresh' endpoint to attempt to refresh the access token cookie.
|
|
61
|
-
*/
|
|
62
|
-
async refreshToken() {
|
|
63
|
-
const path = !!this.config.tokenRefreshPath
|
|
64
|
-
? `${this.config.tokenRefreshPath}/${this.config.clientId}`
|
|
65
|
-
: `/app/refresh/${this.config.clientId}`;
|
|
66
|
-
const uri = this.getUrlForPath(path);
|
|
67
|
-
const resp = await fetch(uri.href, {
|
|
68
|
-
method: 'POST',
|
|
69
|
-
credentials: 'include',
|
|
70
|
-
headers: {
|
|
71
|
-
'Content-Type': 'text/plain',
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
if (!(resp.status >= 200 && resp.status < 300)) {
|
|
75
|
-
throw new Error('error refreshing access token in fusionauth');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Invokes a redirect to the configured 'login' endpoint.
|
|
80
|
-
*/
|
|
81
|
-
startLogin(state) {
|
|
82
|
-
const path = !!this.config.loginPath
|
|
83
|
-
? this.config.loginPath
|
|
84
|
-
: '/app/login';
|
|
85
|
-
!!state ? this.doRedirectForPath(path, { state }) : this.doRedirectForPath(path);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Invokes a redirect to the configured 'refresh' endpoint.
|
|
89
|
-
*/
|
|
90
|
-
startRegistration(state) {
|
|
91
|
-
const path = !!this.config.registerPath
|
|
92
|
-
? this.config.registerPath
|
|
93
|
-
: '/app/register';
|
|
94
|
-
!!state ? this.doRedirectForPath(path, { state }) : this.doRedirectForPath(path);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Invokes a redirect to the configured 'logout' endpoint.
|
|
98
|
-
*/
|
|
99
|
-
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
|
-
let location = this.getUrlForPath(path, params);
|
|
111
|
-
window.location.assign(location);
|
|
112
|
-
}
|
|
113
|
-
getUrlForPath(path, params = {}) {
|
|
114
|
-
let 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.split('; ')
|
|
124
|
-
.map(c => c.split('='))
|
|
125
|
-
.find(([name]) => name === 'app.at_exp');
|
|
126
|
-
return expCookie ? parseInt(expCookie[1]) * 1000 : null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
class FusionAuthLoginButtonComponent {
|
|
131
|
-
constructor(fusionAuth) {
|
|
132
|
-
this.fusionAuth = fusionAuth;
|
|
133
|
-
}
|
|
134
|
-
login() {
|
|
135
|
-
this.fusionAuth.startLogin(this.state);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
FusionAuthLoginButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLoginButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
139
|
-
FusionAuthLoginButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLoginButtonComponent, decorators: [{
|
|
141
|
-
type: Component,
|
|
142
|
-
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"] }]
|
|
143
|
-
}], ctorParameters: function () { return [{ type: FusionAuthService }]; }, propDecorators: { state: [{
|
|
144
|
-
type: Input
|
|
145
|
-
}] } });
|
|
146
|
-
|
|
147
|
-
class FusionAuthLogoutButtonComponent {
|
|
148
|
-
constructor(fusionAuth) {
|
|
149
|
-
this.fusionAuth = fusionAuth;
|
|
150
|
-
}
|
|
151
|
-
logout() {
|
|
152
|
-
this.fusionAuth.logout();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
FusionAuthLogoutButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLogoutButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
156
|
-
FusionAuthLogoutButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthLogoutButtonComponent, decorators: [{
|
|
158
|
-
type: Component,
|
|
159
|
-
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"] }]
|
|
160
|
-
}], ctorParameters: function () { return [{ type: FusionAuthService }]; } });
|
|
161
|
-
|
|
162
|
-
class FusionAuthRegisterButtonComponent {
|
|
163
|
-
constructor(fusionAuth) {
|
|
164
|
-
this.fusionAuth = fusionAuth;
|
|
165
|
-
}
|
|
166
|
-
register() {
|
|
167
|
-
this.fusionAuth.startRegistration(this.state);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
FusionAuthRegisterButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthRegisterButtonComponent, deps: [{ token: FusionAuthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
171
|
-
FusionAuthRegisterButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthRegisterButtonComponent, decorators: [{
|
|
173
|
-
type: Component,
|
|
174
|
-
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"] }]
|
|
175
|
-
}], ctorParameters: function () { return [{ type: FusionAuthService }]; }, propDecorators: { state: [{
|
|
176
|
-
type: Input
|
|
177
|
-
}] } });
|
|
178
|
-
|
|
179
|
-
class FusionAuthModule {
|
|
180
|
-
static forRoot(fusionAuthConfig) {
|
|
181
|
-
return {
|
|
182
|
-
ngModule: FusionAuthModule,
|
|
183
|
-
providers: [
|
|
184
|
-
{ provide: FusionAuthService, useValue: new FusionAuthService(fusionAuthConfig) }
|
|
185
|
-
],
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
FusionAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
190
|
-
FusionAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule, declarations: [FusionAuthLoginButtonComponent,
|
|
191
|
-
FusionAuthLogoutButtonComponent,
|
|
192
|
-
FusionAuthRegisterButtonComponent], exports: [FusionAuthLoginButtonComponent,
|
|
193
|
-
FusionAuthLogoutButtonComponent,
|
|
194
|
-
FusionAuthRegisterButtonComponent] });
|
|
195
|
-
FusionAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule });
|
|
196
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FusionAuthModule, decorators: [{
|
|
197
|
-
type: NgModule,
|
|
198
|
-
args: [{
|
|
199
|
-
declarations: [
|
|
200
|
-
FusionAuthLoginButtonComponent,
|
|
201
|
-
FusionAuthLogoutButtonComponent,
|
|
202
|
-
FusionAuthRegisterButtonComponent,
|
|
203
|
-
],
|
|
204
|
-
imports: [],
|
|
205
|
-
exports: [
|
|
206
|
-
FusionAuthLoginButtonComponent,
|
|
207
|
-
FusionAuthLogoutButtonComponent,
|
|
208
|
-
FusionAuthRegisterButtonComponent,
|
|
209
|
-
]
|
|
210
|
-
}]
|
|
211
|
-
}] });
|
|
212
|
-
|
|
213
|
-
/*
|
|
214
|
-
* Public API Surface of fusionauth-angular-sdk
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Generated bundle index. Do not edit.
|
|
219
|
-
*/
|
|
220
|
-
|
|
221
|
-
export { FusionAuthLoginButtonComponent, FusionAuthLogoutButtonComponent, FusionAuthModule, FusionAuthRegisterButtonComponent, FusionAuthService };
|
|
222
|
-
//# sourceMappingURL=fusionauth-angular-sdk.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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\n constructor(\n private config: FusionAuthConfig,\n ) { }\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\n ? this.config.mePath\n : '/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\n ? this.config.loginPath\n : '/app/login';\n !!state ? this.doRedirectForPath(path, {state}) : 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 ? this.doRedirectForPath(path, {state}) : 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 let location = this.getUrlForPath(path, params) ;\n window.location.assign(location);\n }\n\n private getUrlForPath(path: string, params: Record<string, any> = {}): URL {\n let 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.split('; ')\n .map(c => c.split('='))\n .find(([name]) => name === 'app.at_exp');\n return expCookie ? parseInt(expCookie[1]) * 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(\n private fusionAuth: FusionAuthService,\n ) {}\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(\n private fusionAuth: FusionAuthService,\n ) {}\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 {\n FusionAuthLogoutButtonComponent\n} from './components/fusionauth-logout.button/fusion-auth-logout-button.component';\nimport {\n FusionAuthRegisterButtonComponent\n} 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 ],\n exports: [\n FusionAuthLoginButtonComponent,\n FusionAuthLogoutButtonComponent,\n FusionAuthRegisterButtonComponent,\n ]\n})\nexport class FusionAuthModule {\n static forRoot(fusionAuthConfig: FusionAuthConfig): ModuleWithProviders<FusionAuthModule> {\n return {\n ngModule: FusionAuthModule,\n providers: [\n { provide: FusionAuthService, useValue: new FusionAuthService(fusionAuthConfig) }\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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