@daffodil/auth 0.94.1 → 0.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/daffodil-auth-driver-in-memory.mjs +356 -249
- package/fesm2022/daffodil-auth-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-auth-driver-magento-2.4.7.mjs +459 -0
- package/fesm2022/daffodil-auth-driver-magento-2.4.7.mjs.map +1 -0
- package/fesm2022/daffodil-auth-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-auth-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-auth-driver-testing.mjs +220 -126
- package/fesm2022/daffodil-auth-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-auth-driver.mjs +99 -126
- package/fesm2022/daffodil-auth-driver.mjs.map +1 -1
- package/fesm2022/daffodil-auth-routing.mjs +392 -257
- package/fesm2022/daffodil-auth-routing.mjs.map +1 -1
- package/fesm2022/daffodil-auth-state-testing.mjs +209 -106
- package/fesm2022/daffodil-auth-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-auth-state.mjs +867 -852
- package/fesm2022/daffodil-auth-state.mjs.map +1 -1
- package/fesm2022/daffodil-auth-testing.mjs +132 -76
- package/fesm2022/daffodil-auth-testing.mjs.map +1 -1
- package/fesm2022/daffodil-auth.mjs +65 -57
- package/fesm2022/daffodil-auth.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-auth-driver-in-memory.d.ts +62 -62
- package/types/daffodil-auth-driver-magento-2.4.7.d.ts +119 -0
- package/types/daffodil-auth-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-auth-driver-testing.d.ts +37 -36
- package/types/daffodil-auth-driver.d.ts +93 -112
- package/types/daffodil-auth-routing.d.ts +100 -104
- package/types/daffodil-auth-state-testing.d.ts +44 -43
- package/types/daffodil-auth-state.d.ts +265 -306
- package/types/daffodil-auth-testing.d.ts +28 -33
- package/types/daffodil-auth.d.ts +51 -62
- package/fesm2022/daffodil-auth-driver-magento.mjs +0 -385
- package/fesm2022/daffodil-auth-driver-magento.mjs.map +0 -1
- package/types/daffodil-auth-driver-magento.d.ts +0 -135
|
@@ -1,262 +1,397 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { Inject, Injectable,
|
|
3
|
-
import * as i3 from
|
|
4
|
-
import {
|
|
5
|
-
import * as i4 from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import * as i2 from
|
|
9
|
-
import * as i1 from
|
|
10
|
-
import { DAFF_AUTH_UNAUTHENTICATED_ERROR_CODES } from
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { isPlatformServer } from
|
|
14
|
-
import * as i1
|
|
15
|
-
import { createEffect, ofType,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Inject, Injectable, NgModule, PLATFORM_ID, inject, makeEnvironmentProviders } from "@angular/core";
|
|
3
|
+
import * as i3 from "@angular/router";
|
|
4
|
+
import { ActivatedRoute, Router } from "@angular/router";
|
|
5
|
+
import * as i4 from "@ngrx/store";
|
|
6
|
+
import { EMPTY, from, of } from "rxjs";
|
|
7
|
+
import { catchError, filter, map, switchMap, tap } from "rxjs/operators";
|
|
8
|
+
import * as i2 from "@daffodil/auth";
|
|
9
|
+
import * as i1$1 from "@daffodil/auth/driver";
|
|
10
|
+
import { DAFF_AUTH_UNAUTHENTICATED_ERROR_CODES } from "@daffodil/auth/driver";
|
|
11
|
+
import { DAFF_AUTH_ERROR_MATCHER, DAFF_AUTH_UNAUTHENTICATED_HOOKS, DaffAuthActionTypes, DaffAuthFacade, DaffAuthGuardLogout, DaffAuthLoginActionTypes, DaffAuthRegisterActionTypes, DaffAuthResetPasswordActionTypes, DaffResetPasswordLanding } from "@daffodil/auth/state";
|
|
12
|
+
import { createConfigInjectionToken, createSingleInjectionToken } from "@daffodil/core";
|
|
13
|
+
import { isPlatformServer } from "@angular/common";
|
|
14
|
+
import * as i1 from "@ngrx/effects";
|
|
15
|
+
import { EffectsModule, createEffect, ofType, provideEffects } from "@ngrx/effects";
|
|
16
|
+
const { token: DaffAuthMemberOnlyGuardRedirectUrl, provider: provideDaffAuthMemberOnlyGuardRedirectUrl } = createSingleInjectionToken("DaffAuthMemberOnlyGuardRedirectUrl", { factory: () => "/" });
|
|
17
|
+
var MemberOnlyGuard = class MemberOnlyGuard {
|
|
18
|
+
constructor(tokenCheck, storage, router, store, errorMatcher, redirectUrl) {
|
|
19
|
+
this.tokenCheck = tokenCheck;
|
|
20
|
+
this.storage = storage;
|
|
21
|
+
this.router = router;
|
|
22
|
+
this.store = store;
|
|
23
|
+
this.errorMatcher = errorMatcher;
|
|
24
|
+
this.redirectUrl = redirectUrl;
|
|
25
|
+
}
|
|
26
|
+
canActivate() {
|
|
27
|
+
return this.isAuthenticated().pipe(tap((result) => {
|
|
28
|
+
if (!result) this.router.navigateByUrl(this.redirectUrl);
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
isAuthenticated() {
|
|
32
|
+
return this.tokenCheck.check().pipe(map(() => true), catchError((error) => {
|
|
33
|
+
if (DAFF_AUTH_UNAUTHENTICATED_ERROR_CODES[error.code]) this.store.dispatch(new DaffAuthGuardLogout(this.errorMatcher(error)));
|
|
34
|
+
return of(false);
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
static {
|
|
38
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
39
|
+
minVersion: "12.0.0",
|
|
40
|
+
version: "22.2.4",
|
|
41
|
+
ngImport: i0,
|
|
42
|
+
type: MemberOnlyGuard,
|
|
43
|
+
deps: [
|
|
44
|
+
{ token: i1$1.DaffAuthDriverTokenCheck },
|
|
45
|
+
{ token: i2.DaffAuthStorageService },
|
|
46
|
+
{ token: i3.Router },
|
|
47
|
+
{ token: i4.Store },
|
|
48
|
+
{ token: DAFF_AUTH_ERROR_MATCHER },
|
|
49
|
+
{ token: DaffAuthMemberOnlyGuardRedirectUrl }
|
|
50
|
+
],
|
|
51
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
static {
|
|
55
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
56
|
+
minVersion: "12.0.0",
|
|
57
|
+
version: "22.2.4",
|
|
58
|
+
ngImport: i0,
|
|
59
|
+
type: MemberOnlyGuard,
|
|
60
|
+
providedIn: "any"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
65
|
+
minVersion: "12.0.0",
|
|
66
|
+
version: "22.2.4",
|
|
67
|
+
ngImport: i0,
|
|
68
|
+
type: MemberOnlyGuard,
|
|
69
|
+
decorators: [{
|
|
70
|
+
type: Injectable,
|
|
71
|
+
args: [{ providedIn: "any" }]
|
|
72
|
+
}],
|
|
73
|
+
ctorParameters: () => [
|
|
74
|
+
{ type: i1$1.DaffAuthDriverTokenCheck },
|
|
75
|
+
{ type: i2.DaffAuthStorageService },
|
|
76
|
+
{ type: i3.Router },
|
|
77
|
+
{ type: i4.Store },
|
|
78
|
+
{
|
|
79
|
+
type: void 0,
|
|
80
|
+
decorators: [{
|
|
81
|
+
type: Inject,
|
|
82
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
83
|
+
}]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: void 0,
|
|
87
|
+
decorators: [{
|
|
88
|
+
type: Inject,
|
|
89
|
+
args: [DaffAuthMemberOnlyGuardRedirectUrl]
|
|
90
|
+
}]
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
const { token: DaffAuthGuestOnlyGuardRedirectUrl, provider: provideDaffAuthGuestOnlyGuardRedirectUrl } = createSingleInjectionToken("DaffAuthGuestOnlyGuardRedirectUrl", { factory: () => "/" });
|
|
95
|
+
var GuestOnlyGuard = class GuestOnlyGuard {
|
|
96
|
+
constructor(tokenCheck, storage, router, store, errorMatcher, redirectUrl) {
|
|
97
|
+
this.tokenCheck = tokenCheck;
|
|
98
|
+
this.storage = storage;
|
|
99
|
+
this.router = router;
|
|
100
|
+
this.store = store;
|
|
101
|
+
this.errorMatcher = errorMatcher;
|
|
102
|
+
this.redirectUrl = redirectUrl;
|
|
103
|
+
}
|
|
104
|
+
canActivate() {
|
|
105
|
+
return this.isUnauthenticated().pipe(tap((result) => {
|
|
106
|
+
if (!result) this.router.navigateByUrl(this.redirectUrl);
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
isUnauthenticated() {
|
|
110
|
+
return this.tokenCheck.check().pipe(map(() => false), catchError((error) => {
|
|
111
|
+
if (DAFF_AUTH_UNAUTHENTICATED_ERROR_CODES[error.code]) this.store.dispatch(new DaffAuthGuardLogout(this.errorMatcher(error)));
|
|
112
|
+
return of(true);
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
static {
|
|
116
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
117
|
+
minVersion: "12.0.0",
|
|
118
|
+
version: "22.2.4",
|
|
119
|
+
ngImport: i0,
|
|
120
|
+
type: GuestOnlyGuard,
|
|
121
|
+
deps: [
|
|
122
|
+
{ token: i1$1.DaffAuthDriverTokenCheck },
|
|
123
|
+
{ token: i2.DaffAuthStorageService },
|
|
124
|
+
{ token: i3.Router },
|
|
125
|
+
{ token: i4.Store },
|
|
126
|
+
{ token: DAFF_AUTH_ERROR_MATCHER },
|
|
127
|
+
{ token: DaffAuthGuestOnlyGuardRedirectUrl }
|
|
128
|
+
],
|
|
129
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
static {
|
|
133
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
134
|
+
minVersion: "12.0.0",
|
|
135
|
+
version: "22.2.4",
|
|
136
|
+
ngImport: i0,
|
|
137
|
+
type: GuestOnlyGuard,
|
|
138
|
+
providedIn: "any"
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
143
|
+
minVersion: "12.0.0",
|
|
144
|
+
version: "22.2.4",
|
|
145
|
+
ngImport: i0,
|
|
146
|
+
type: GuestOnlyGuard,
|
|
147
|
+
decorators: [{
|
|
148
|
+
type: Injectable,
|
|
149
|
+
args: [{ providedIn: "any" }]
|
|
150
|
+
}],
|
|
151
|
+
ctorParameters: () => [
|
|
152
|
+
{ type: i1$1.DaffAuthDriverTokenCheck },
|
|
153
|
+
{ type: i2.DaffAuthStorageService },
|
|
154
|
+
{ type: i3.Router },
|
|
155
|
+
{ type: i4.Store },
|
|
156
|
+
{
|
|
157
|
+
type: void 0,
|
|
158
|
+
decorators: [{
|
|
159
|
+
type: Inject,
|
|
160
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
161
|
+
}]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: void 0,
|
|
165
|
+
decorators: [{
|
|
166
|
+
type: Inject,
|
|
167
|
+
args: [DaffAuthGuestOnlyGuardRedirectUrl]
|
|
168
|
+
}]
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
});
|
|
109
172
|
const DAFF_AUTH_ROUTING_CONFIG_DEFAULT = {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
173
|
+
resetPasswordTokenParam: "token",
|
|
174
|
+
redirectUrlParam: "redirect",
|
|
175
|
+
authCompleteRedirectPath: "/",
|
|
176
|
+
logoutRedirectPath: "/",
|
|
177
|
+
tokenExpirationRedirectPath: "/",
|
|
178
|
+
resetPasswordRedirectPath: "/"
|
|
116
179
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
180
|
+
const { token: DAFF_AUTH_ROUTING_CONFIG, provider: provideDaffAuthRoutingConfig } = createConfigInjectionToken(DAFF_AUTH_ROUTING_CONFIG_DEFAULT, "DAFF_AUTH_ROUTING_CONFIG");
|
|
181
|
+
var DaffAuthResetPasswordGuard = class DaffAuthResetPasswordGuard {
|
|
182
|
+
constructor() {
|
|
183
|
+
this.facade = inject(DaffAuthFacade);
|
|
184
|
+
this.config = inject(DAFF_AUTH_ROUTING_CONFIG);
|
|
185
|
+
this.platformId = inject(PLATFORM_ID);
|
|
186
|
+
this.router = inject(Router);
|
|
187
|
+
}
|
|
188
|
+
canActivate(route) {
|
|
189
|
+
if (isPlatformServer(this.platformId)) return true;
|
|
190
|
+
const token = route.queryParamMap.get(this.config.resetPasswordTokenParam);
|
|
191
|
+
if (!token) return this.router.parseUrl(this.config.resetPasswordRedirectPath);
|
|
192
|
+
this.facade.dispatch(new DaffResetPasswordLanding(token));
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
static {
|
|
196
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
197
|
+
minVersion: "12.0.0",
|
|
198
|
+
version: "22.2.4",
|
|
199
|
+
ngImport: i0,
|
|
200
|
+
type: DaffAuthResetPasswordGuard,
|
|
201
|
+
deps: [],
|
|
202
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
static {
|
|
206
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
207
|
+
minVersion: "12.0.0",
|
|
208
|
+
version: "22.2.4",
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
type: DaffAuthResetPasswordGuard,
|
|
211
|
+
providedIn: "any"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
216
|
+
minVersion: "12.0.0",
|
|
217
|
+
version: "22.2.4",
|
|
218
|
+
ngImport: i0,
|
|
219
|
+
type: DaffAuthResetPasswordGuard,
|
|
220
|
+
decorators: [{
|
|
221
|
+
type: Injectable,
|
|
222
|
+
args: [{ providedIn: "any" }]
|
|
223
|
+
}]
|
|
224
|
+
});
|
|
156
225
|
function daffAuthRoutingRedirectUnauthenticatedHookFactory(router, route, config) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return of(null);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
class DaffAuthRoutingModule {
|
|
171
|
-
static withConfig(config) {
|
|
172
|
-
return {
|
|
173
|
-
ngModule: DaffAuthRoutingModule,
|
|
174
|
-
providers: [
|
|
175
|
-
provideDaffAuthRoutingConfig(config),
|
|
176
|
-
],
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
180
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRoutingModule }); }
|
|
181
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRoutingModule, providers: [
|
|
182
|
-
DaffAuthResetPasswordGuard,
|
|
183
|
-
MemberOnlyGuard,
|
|
184
|
-
GuestOnlyGuard,
|
|
185
|
-
] }); }
|
|
186
|
-
}
|
|
187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRoutingModule, decorators: [{
|
|
188
|
-
type: NgModule,
|
|
189
|
-
args: [{
|
|
190
|
-
providers: [
|
|
191
|
-
DaffAuthResetPasswordGuard,
|
|
192
|
-
MemberOnlyGuard,
|
|
193
|
-
GuestOnlyGuard,
|
|
194
|
-
],
|
|
195
|
-
}]
|
|
196
|
-
}] });
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Redirects the user to certain pages based on certain auth actions.
|
|
200
|
-
*/
|
|
201
|
-
class DaffAuthRedirectEffects {
|
|
202
|
-
constructor(actions$, router, route, config) {
|
|
203
|
-
this.actions$ = actions$;
|
|
204
|
-
this.router = router;
|
|
205
|
-
this.route = route;
|
|
206
|
-
this.config = config;
|
|
207
|
-
this.redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction, DaffAuthRegisterActionTypes.RegisterSuccessAction, DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction), filter((action) => {
|
|
208
|
-
if ((action.type === DaffAuthRegisterActionTypes.RegisterSuccessAction || action.type === DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction) && !action.token) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
return true;
|
|
212
|
-
}), tap((action) => {
|
|
213
|
-
this.router.navigateByUrl(this.route.snapshot.queryParamMap.get(this.config.redirectUrlParam) || this.config.authCompleteRedirectPath);
|
|
214
|
-
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
215
|
-
}
|
|
216
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRedirectEffects, deps: [{ token: i1$1.Actions }, { token: i3.Router }, { token: i3.ActivatedRoute }, { token: DAFF_AUTH_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
217
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRedirectEffects }); }
|
|
226
|
+
return (trigger) => {
|
|
227
|
+
switch (trigger) {
|
|
228
|
+
case DaffAuthLoginActionTypes.LogoutSuccessAction: return from(router.navigateByUrl(route.snapshot.queryParamMap.get(config.redirectUrlParam) || config.logoutRedirectPath));
|
|
229
|
+
case DaffAuthActionTypes.AuthCheckFailureAction:
|
|
230
|
+
case DaffAuthActionTypes.AuthGuardLogoutAction: return from(router.navigateByUrl(route.snapshot.queryParamMap.get(config.redirectUrlParam) || config.tokenExpirationRedirectPath));
|
|
231
|
+
default: return of(null);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
218
234
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
235
|
+
var DaffAuthRedirectEffects = class DaffAuthRedirectEffects {
|
|
236
|
+
constructor(actions$, router, route, config) {
|
|
237
|
+
this.actions$ = actions$;
|
|
238
|
+
this.router = router;
|
|
239
|
+
this.route = route;
|
|
240
|
+
this.config = config;
|
|
241
|
+
this.redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction, DaffAuthRegisterActionTypes.RegisterSuccessAction, DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction), filter((action) => {
|
|
242
|
+
if ((action.type === DaffAuthRegisterActionTypes.RegisterSuccessAction || action.type === DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction) && !action.token) return false;
|
|
243
|
+
return true;
|
|
244
|
+
}), tap((action) => {
|
|
245
|
+
this.router.navigateByUrl(this.route.snapshot.queryParamMap.get(this.config.redirectUrlParam) || this.config.authCompleteRedirectPath);
|
|
246
|
+
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
247
|
+
}
|
|
248
|
+
static {
|
|
249
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
250
|
+
minVersion: "12.0.0",
|
|
251
|
+
version: "22.2.4",
|
|
252
|
+
ngImport: i0,
|
|
253
|
+
type: DaffAuthRedirectEffects,
|
|
254
|
+
deps: [
|
|
255
|
+
{ token: i1.Actions },
|
|
256
|
+
{ token: i3.Router },
|
|
257
|
+
{ token: i3.ActivatedRoute },
|
|
258
|
+
{ token: DAFF_AUTH_ROUTING_CONFIG }
|
|
259
|
+
],
|
|
260
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
static {
|
|
264
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
265
|
+
minVersion: "12.0.0",
|
|
266
|
+
version: "22.2.4",
|
|
267
|
+
ngImport: i0,
|
|
268
|
+
type: DaffAuthRedirectEffects
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
273
|
+
minVersion: "12.0.0",
|
|
274
|
+
version: "22.2.4",
|
|
275
|
+
ngImport: i0,
|
|
276
|
+
type: DaffAuthRedirectEffects,
|
|
277
|
+
decorators: [{ type: Injectable }],
|
|
278
|
+
ctorParameters: () => [
|
|
279
|
+
{ type: i1.Actions },
|
|
280
|
+
{ type: i3.Router },
|
|
281
|
+
{ type: i3.ActivatedRoute },
|
|
282
|
+
{
|
|
283
|
+
type: void 0,
|
|
284
|
+
decorators: [{
|
|
285
|
+
type: Inject,
|
|
286
|
+
args: [DAFF_AUTH_ROUTING_CONFIG]
|
|
287
|
+
}]
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
});
|
|
291
|
+
const provideDaffAuthRouting = (config) => makeEnvironmentProviders([
|
|
292
|
+
DaffAuthResetPasswordGuard,
|
|
293
|
+
MemberOnlyGuard,
|
|
294
|
+
GuestOnlyGuard,
|
|
295
|
+
provideDaffAuthRoutingConfig(config)
|
|
296
|
+
]);
|
|
297
|
+
const provideDaffAuthRoutingRedirect = () => makeEnvironmentProviders([provideEffects(DaffAuthRedirectEffects), {
|
|
298
|
+
provide: DAFF_AUTH_UNAUTHENTICATED_HOOKS,
|
|
299
|
+
multi: true,
|
|
300
|
+
useFactory: () => daffAuthRoutingRedirectUnauthenticatedHookFactory(inject(Router), inject(ActivatedRoute), inject(DAFF_AUTH_ROUTING_CONFIG))
|
|
301
|
+
}]);
|
|
302
|
+
var DaffAuthRoutingModule = class DaffAuthRoutingModule {
|
|
303
|
+
static withConfig(config) {
|
|
304
|
+
return {
|
|
305
|
+
ngModule: DaffAuthRoutingModule,
|
|
306
|
+
providers: [provideDaffAuthRouting(config)]
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
static {
|
|
310
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
311
|
+
minVersion: "12.0.0",
|
|
312
|
+
version: "22.2.4",
|
|
313
|
+
ngImport: i0,
|
|
314
|
+
type: DaffAuthRoutingModule,
|
|
315
|
+
deps: [],
|
|
316
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
static {
|
|
320
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
321
|
+
minVersion: "14.0.0",
|
|
322
|
+
version: "22.2.4",
|
|
323
|
+
ngImport: i0,
|
|
324
|
+
type: DaffAuthRoutingModule
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
static {
|
|
328
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
329
|
+
minVersion: "12.0.0",
|
|
330
|
+
version: "22.2.4",
|
|
331
|
+
ngImport: i0,
|
|
332
|
+
type: DaffAuthRoutingModule
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
337
|
+
minVersion: "12.0.0",
|
|
338
|
+
version: "22.2.4",
|
|
339
|
+
ngImport: i0,
|
|
340
|
+
type: DaffAuthRoutingModule,
|
|
341
|
+
decorators: [{ type: NgModule }]
|
|
342
|
+
});
|
|
343
|
+
var DaffAuthRoutingRedirectModule = class DaffAuthRoutingRedirectModule {
|
|
344
|
+
static {
|
|
345
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
346
|
+
minVersion: "12.0.0",
|
|
347
|
+
version: "22.2.4",
|
|
348
|
+
ngImport: i0,
|
|
349
|
+
type: DaffAuthRoutingRedirectModule,
|
|
350
|
+
deps: [],
|
|
351
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
static {
|
|
355
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
356
|
+
minVersion: "14.0.0",
|
|
357
|
+
version: "22.2.4",
|
|
358
|
+
ngImport: i0,
|
|
359
|
+
type: DaffAuthRoutingRedirectModule,
|
|
360
|
+
imports: [i1.EffectsFeatureModule]
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
static {
|
|
364
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
365
|
+
minVersion: "12.0.0",
|
|
366
|
+
version: "22.2.4",
|
|
367
|
+
ngImport: i0,
|
|
368
|
+
type: DaffAuthRoutingRedirectModule,
|
|
369
|
+
providers: [{
|
|
370
|
+
provide: DAFF_AUTH_UNAUTHENTICATED_HOOKS,
|
|
371
|
+
multi: true,
|
|
372
|
+
useFactory: (() => daffAuthRoutingRedirectUnauthenticatedHookFactory(inject(Router), inject(ActivatedRoute), inject(DAFF_AUTH_ROUTING_CONFIG)))
|
|
373
|
+
}],
|
|
374
|
+
imports: [EffectsModule.forFeature([DaffAuthRedirectEffects])]
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
379
|
+
minVersion: "12.0.0",
|
|
380
|
+
version: "22.2.4",
|
|
381
|
+
ngImport: i0,
|
|
382
|
+
type: DaffAuthRoutingRedirectModule,
|
|
383
|
+
decorators: [{
|
|
384
|
+
type: NgModule,
|
|
385
|
+
args: [{
|
|
386
|
+
imports: [EffectsModule.forFeature([DaffAuthRedirectEffects])],
|
|
387
|
+
providers: [{
|
|
388
|
+
provide: DAFF_AUTH_UNAUTHENTICATED_HOOKS,
|
|
389
|
+
multi: true,
|
|
390
|
+
useFactory: (() => daffAuthRoutingRedirectUnauthenticatedHookFactory(inject(Router), inject(ActivatedRoute), inject(DAFF_AUTH_ROUTING_CONFIG)))
|
|
391
|
+
}]
|
|
392
|
+
}]
|
|
393
|
+
}]
|
|
394
|
+
});
|
|
395
|
+
export { DAFF_AUTH_ROUTING_CONFIG, DAFF_AUTH_ROUTING_CONFIG_DEFAULT, DaffAuthGuestOnlyGuardRedirectUrl, DaffAuthMemberOnlyGuardRedirectUrl, DaffAuthResetPasswordGuard, DaffAuthRoutingModule, DaffAuthRoutingRedirectModule, GuestOnlyGuard, MemberOnlyGuard, daffAuthRoutingRedirectUnauthenticatedHookFactory, provideDaffAuthGuestOnlyGuardRedirectUrl, provideDaffAuthMemberOnlyGuardRedirectUrl, provideDaffAuthRouting, provideDaffAuthRoutingConfig, provideDaffAuthRoutingRedirect };
|
|
260
396
|
|
|
261
|
-
|
|
262
|
-
//# sourceMappingURL=daffodil-auth-routing.mjs.map
|
|
397
|
+
//# sourceMappingURL=daffodil-auth-routing.mjs.map
|