@daffodil/auth 0.94.1 → 0.95.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/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,893 +1,908 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as i1 from
|
|
4
|
-
import {
|
|
5
|
-
import * as i0 from
|
|
6
|
-
import { Injectable,
|
|
7
|
-
import * as i1
|
|
8
|
-
import { createEffect, ofType,
|
|
9
|
-
import {
|
|
10
|
-
import * as
|
|
11
|
-
import { DaffAuthStorageService } from
|
|
12
|
-
import {
|
|
13
|
-
import * as i2 from
|
|
14
|
-
import { DAFF_AUTH_UNAUTHENTICATED_ERROR_CODES, DaffLoginDriver, DaffRegisterDriver, DaffResetPasswordDriver } from
|
|
15
|
-
import { DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE } from
|
|
16
|
-
|
|
1
|
+
import { daffCompleteOperation, daffComposeReducers, daffOperationFailed, daffOperationInitialState, daffOperationStateSelectorFactory, daffStartMutation, daffStartResolution, daffTransformErrorToStateError } from "@daffodil/core/state";
|
|
2
|
+
import { DaffServerSideStorageError, DaffStorageServiceError, createConfigInjectionToken, createMultiInjectionToken, createSingleInjectionToken } from "@daffodil/core";
|
|
3
|
+
import * as i1$1 from "@ngrx/store";
|
|
4
|
+
import { StoreModule, combineReducers, createFeatureSelector, createSelector, defaultMemoize, provideState, select } from "@ngrx/store";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import { Inject, Injectable, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
|
|
7
|
+
import * as i1 from "@ngrx/effects";
|
|
8
|
+
import { EffectsModule, createEffect, ofType, provideEffects } from "@ngrx/effects";
|
|
9
|
+
import { EMPTY, Observable, combineLatest, defer, iif, of } from "rxjs";
|
|
10
|
+
import * as i3 from "@daffodil/auth";
|
|
11
|
+
import { DaffAuthStorageService } from "@daffodil/auth";
|
|
12
|
+
import { catchError, filter, map, switchMap, tap } from "rxjs/operators";
|
|
13
|
+
import * as i2 from "@daffodil/auth/driver";
|
|
14
|
+
import { DAFF_AUTH_UNAUTHENTICATED_ERROR_CODES, DaffLoginDriver, DaffRegisterDriver, DaffResetPasswordDriver } from "@daffodil/auth/driver";
|
|
15
|
+
import { DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE } from "@daffodil/driver";
|
|
17
16
|
var DaffAuthActionTypes;
|
|
18
|
-
(function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
(function(DaffAuthActionTypes) {
|
|
18
|
+
DaffAuthActionTypes["ResetToUnauthenticatedAction"] = "[@daffodil/auth] Reset To Unauthenticated Action";
|
|
19
|
+
DaffAuthActionTypes["AuthStorageFailureAction"] = "[@daffodil/auth] Auth Storage Failure Action";
|
|
20
|
+
DaffAuthActionTypes["AuthGuardLogoutAction"] = "[@daffodil/auth] Auth Guard Logout Action";
|
|
21
|
+
DaffAuthActionTypes["AuthServerSideAction"] = "[@daffodil/auth] Auth Server Side Action";
|
|
22
|
+
DaffAuthActionTypes["AuthCheckAction"] = "[@daffodil/auth] Auth Check Action";
|
|
23
|
+
DaffAuthActionTypes["AuthCheckSuccessAction"] = "[@daffodil/auth] Auth Check Success Action";
|
|
24
|
+
DaffAuthActionTypes["AuthCheckFailureAction"] = "[@daffodil/auth] Auth Check Failure Action";
|
|
26
25
|
})(DaffAuthActionTypes || (DaffAuthActionTypes = {}));
|
|
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
|
-
class DaffAuthCheck {
|
|
69
|
-
constructor() {
|
|
70
|
-
this.type = DaffAuthActionTypes.AuthCheckAction;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* An action triggered upon a successful auth check.
|
|
75
|
-
*
|
|
76
|
-
* @param token - the customer access token
|
|
77
|
-
*/
|
|
78
|
-
class DaffAuthCheckSuccess {
|
|
79
|
-
constructor() {
|
|
80
|
-
this.type = DaffAuthActionTypes.AuthCheckSuccessAction;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* An action triggered upon a failed auth check request.
|
|
85
|
-
*
|
|
86
|
-
* @param errorMessage - an error message
|
|
87
|
-
*/
|
|
88
|
-
class DaffAuthCheckFailure {
|
|
89
|
-
constructor(errorMessage) {
|
|
90
|
-
this.errorMessage = errorMessage;
|
|
91
|
-
this.type = DaffAuthActionTypes.AuthCheckFailureAction;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
26
|
+
var DaffAuthResetToUnauthenticated = class {
|
|
27
|
+
constructor(reason) {
|
|
28
|
+
this.reason = reason;
|
|
29
|
+
this.type = DaffAuthActionTypes.ResetToUnauthenticatedAction;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var DaffAuthStorageFailure = class {
|
|
33
|
+
constructor(errorMessage) {
|
|
34
|
+
this.errorMessage = errorMessage;
|
|
35
|
+
this.type = DaffAuthActionTypes.AuthStorageFailureAction;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var DaffAuthGuardLogout = class {
|
|
39
|
+
constructor(errorMessage) {
|
|
40
|
+
this.errorMessage = errorMessage;
|
|
41
|
+
this.type = DaffAuthActionTypes.AuthGuardLogoutAction;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var DaffAuthServerSide = class {
|
|
45
|
+
constructor(errorMessage) {
|
|
46
|
+
this.errorMessage = errorMessage;
|
|
47
|
+
this.type = DaffAuthActionTypes.AuthServerSideAction;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var DaffAuthCheck = class {
|
|
51
|
+
constructor() {
|
|
52
|
+
this.type = DaffAuthActionTypes.AuthCheckAction;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var DaffAuthCheckSuccess = class {
|
|
56
|
+
constructor() {
|
|
57
|
+
this.type = DaffAuthActionTypes.AuthCheckSuccessAction;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var DaffAuthCheckFailure = class {
|
|
61
|
+
constructor(errorMessage) {
|
|
62
|
+
this.errorMessage = errorMessage;
|
|
63
|
+
this.type = DaffAuthActionTypes.AuthCheckFailureAction;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
95
66
|
var DaffAuthLoginActionTypes;
|
|
96
|
-
(function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
67
|
+
(function(DaffAuthLoginActionTypes) {
|
|
68
|
+
DaffAuthLoginActionTypes["LoginAction"] = "[@daffodil/auth] Login Action";
|
|
69
|
+
DaffAuthLoginActionTypes["LoginSuccessAction"] = "[@daffodil/auth] Login Success Action";
|
|
70
|
+
DaffAuthLoginActionTypes["LoginFailureAction"] = "[@daffodil/auth] Login Failure Action";
|
|
71
|
+
DaffAuthLoginActionTypes["LogoutAction"] = "[@daffodil/auth] Logout Action";
|
|
72
|
+
DaffAuthLoginActionTypes["LogoutSuccessAction"] = "[@daffodil/auth] Logout Success Action";
|
|
73
|
+
DaffAuthLoginActionTypes["LogoutFailureAction"] = "[@daffodil/auth] Logout Failure Action";
|
|
103
74
|
})(DaffAuthLoginActionTypes || (DaffAuthLoginActionTypes = {}));
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
class DaffAuthLogout {
|
|
139
|
-
constructor() {
|
|
140
|
-
this.type = DaffAuthLoginActionTypes.LogoutAction;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* An action triggered upon a successful logout.
|
|
145
|
-
*
|
|
146
|
-
* @param token - the customer access token
|
|
147
|
-
*/
|
|
148
|
-
class DaffAuthLogoutSuccess {
|
|
149
|
-
constructor() {
|
|
150
|
-
this.type = DaffAuthLoginActionTypes.LogoutSuccessAction;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* An action triggered upon a failed logout request.
|
|
155
|
-
*
|
|
156
|
-
* @param errorMessage - an error message
|
|
157
|
-
*/
|
|
158
|
-
class DaffAuthLogoutFailure {
|
|
159
|
-
constructor(errorMessage) {
|
|
160
|
-
this.errorMessage = errorMessage;
|
|
161
|
-
this.type = DaffAuthLoginActionTypes.LogoutFailureAction;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
75
|
+
var DaffAuthLogin = class {
|
|
76
|
+
constructor(loginInfo) {
|
|
77
|
+
this.loginInfo = loginInfo;
|
|
78
|
+
this.type = DaffAuthLoginActionTypes.LoginAction;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var DaffAuthLoginSuccess = class {
|
|
82
|
+
constructor(auth) {
|
|
83
|
+
this.auth = auth;
|
|
84
|
+
this.type = DaffAuthLoginActionTypes.LoginSuccessAction;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var DaffAuthLoginFailure = class {
|
|
88
|
+
constructor(errorMessage) {
|
|
89
|
+
this.errorMessage = errorMessage;
|
|
90
|
+
this.type = DaffAuthLoginActionTypes.LoginFailureAction;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var DaffAuthLogout = class {
|
|
94
|
+
constructor() {
|
|
95
|
+
this.type = DaffAuthLoginActionTypes.LogoutAction;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var DaffAuthLogoutSuccess = class {
|
|
99
|
+
constructor() {
|
|
100
|
+
this.type = DaffAuthLoginActionTypes.LogoutSuccessAction;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var DaffAuthLogoutFailure = class {
|
|
104
|
+
constructor(errorMessage) {
|
|
105
|
+
this.errorMessage = errorMessage;
|
|
106
|
+
this.type = DaffAuthLoginActionTypes.LogoutFailureAction;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
165
109
|
var DaffAuthRegisterActionTypes;
|
|
166
|
-
(function
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
110
|
+
(function(DaffAuthRegisterActionTypes) {
|
|
111
|
+
DaffAuthRegisterActionTypes["RegisterAction"] = "[@daffodil/auth] Register Action";
|
|
112
|
+
DaffAuthRegisterActionTypes["RegisterSuccessAction"] = "[@daffodil/auth] Register Success Action";
|
|
113
|
+
DaffAuthRegisterActionTypes["RegisterFailureAction"] = "[@daffodil/auth] Register Failure Action";
|
|
170
114
|
})(DaffAuthRegisterActionTypes || (DaffAuthRegisterActionTypes = {}));
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.token = token;
|
|
191
|
-
this.type = DaffAuthRegisterActionTypes.RegisterSuccessAction;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* An action triggered upon a failed auth request.
|
|
196
|
-
*
|
|
197
|
-
* @param errorMessage - an error message
|
|
198
|
-
*/
|
|
199
|
-
class DaffAuthRegisterFailure {
|
|
200
|
-
constructor(errorMessage) {
|
|
201
|
-
this.errorMessage = errorMessage;
|
|
202
|
-
this.type = DaffAuthRegisterActionTypes.RegisterFailureAction;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
115
|
+
var DaffAuthRegister = class {
|
|
116
|
+
constructor(registration, autoLogin = true) {
|
|
117
|
+
this.registration = registration;
|
|
118
|
+
this.autoLogin = autoLogin;
|
|
119
|
+
this.type = DaffAuthRegisterActionTypes.RegisterAction;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var DaffAuthRegisterSuccess = class {
|
|
123
|
+
constructor(token) {
|
|
124
|
+
this.token = token;
|
|
125
|
+
this.type = DaffAuthRegisterActionTypes.RegisterSuccessAction;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var DaffAuthRegisterFailure = class {
|
|
129
|
+
constructor(errorMessage) {
|
|
130
|
+
this.errorMessage = errorMessage;
|
|
131
|
+
this.type = DaffAuthRegisterActionTypes.RegisterFailureAction;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
206
134
|
var DaffAuthResetPasswordActionTypes;
|
|
207
|
-
(function
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
135
|
+
(function(DaffAuthResetPasswordActionTypes) {
|
|
136
|
+
DaffAuthResetPasswordActionTypes["SendResetEmailAction"] = "[@daffodil/auth] Send Reset Email Action";
|
|
137
|
+
DaffAuthResetPasswordActionTypes["SendResetEmailSuccessAction"] = "[@daffodil/auth] Send Reset Email Success Action";
|
|
138
|
+
DaffAuthResetPasswordActionTypes["SendResetEmailFailureAction"] = "[@daffodil/auth] Send Reset Email Failure Action";
|
|
139
|
+
DaffAuthResetPasswordActionTypes["ResetPasswordAction"] = "[@daffodil/auth] Reset Password Action";
|
|
140
|
+
DaffAuthResetPasswordActionTypes["ResetPasswordSuccessAction"] = "[@daffodil/auth] Reset Password Success Action";
|
|
141
|
+
DaffAuthResetPasswordActionTypes["ResetPasswordFailureAction"] = "[@daffodil/auth] Reset Password Failure Action";
|
|
142
|
+
DaffAuthResetPasswordActionTypes["ResetPasswordLandingAction"] = "[@daffodil/auth] Reset Password Landing Action";
|
|
215
143
|
})(DaffAuthResetPasswordActionTypes || (DaffAuthResetPasswordActionTypes = {}));
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
constructor(token) {
|
|
259
|
-
this.token = token;
|
|
260
|
-
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* An action triggered upon a failed logout request.
|
|
265
|
-
*
|
|
266
|
-
* @param errorMessage - an error message
|
|
267
|
-
*/
|
|
268
|
-
class DaffResetPasswordFailure {
|
|
269
|
-
constructor(errorMessage) {
|
|
270
|
-
this.errorMessage = errorMessage;
|
|
271
|
-
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordFailureAction;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* An action triggered upon the user navigating to the reset password page from the link in their email.
|
|
276
|
-
*
|
|
277
|
-
* @param token - The token with which the password can be reset
|
|
278
|
-
*/
|
|
279
|
-
class DaffResetPasswordLanding {
|
|
280
|
-
constructor(token) {
|
|
281
|
-
this.token = token;
|
|
282
|
-
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordLandingAction;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
144
|
+
var DaffSendResetEmail = class {
|
|
145
|
+
constructor(email) {
|
|
146
|
+
this.email = email;
|
|
147
|
+
this.type = DaffAuthResetPasswordActionTypes.SendResetEmailAction;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var DaffSendResetEmailSuccess = class {
|
|
151
|
+
constructor() {
|
|
152
|
+
this.type = DaffAuthResetPasswordActionTypes.SendResetEmailSuccessAction;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var DaffSendResetEmailFailure = class {
|
|
156
|
+
constructor(errorMessage) {
|
|
157
|
+
this.errorMessage = errorMessage;
|
|
158
|
+
this.type = DaffAuthResetPasswordActionTypes.SendResetEmailFailureAction;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
var DaffResetPassword = class {
|
|
162
|
+
constructor(info, autoLogin = true) {
|
|
163
|
+
this.info = info;
|
|
164
|
+
this.autoLogin = autoLogin;
|
|
165
|
+
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordAction;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
var DaffResetPasswordSuccess = class {
|
|
169
|
+
constructor(token) {
|
|
170
|
+
this.token = token;
|
|
171
|
+
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
var DaffResetPasswordFailure = class {
|
|
175
|
+
constructor(errorMessage) {
|
|
176
|
+
this.errorMessage = errorMessage;
|
|
177
|
+
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordFailureAction;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var DaffResetPasswordLanding = class {
|
|
181
|
+
constructor(token) {
|
|
182
|
+
this.token = token;
|
|
183
|
+
this.type = DaffAuthResetPasswordActionTypes.ResetPasswordLandingAction;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
286
186
|
const daffAuthInitialState = {
|
|
287
|
-
|
|
288
|
-
|
|
187
|
+
...daffOperationInitialState,
|
|
188
|
+
loggedIn: false
|
|
289
189
|
};
|
|
290
|
-
|
|
291
190
|
function daffAuthReducer(state = daffAuthInitialState, action) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
} : state;
|
|
325
|
-
case DaffAuthLoginActionTypes.LogoutSuccessAction:
|
|
326
|
-
return {
|
|
327
|
-
...state,
|
|
328
|
-
loggedIn: false,
|
|
329
|
-
};
|
|
330
|
-
default:
|
|
331
|
-
return state;
|
|
332
|
-
}
|
|
191
|
+
switch (action.type) {
|
|
192
|
+
case DaffAuthActionTypes.AuthCheckAction: return daffStartResolution(state);
|
|
193
|
+
case DaffAuthActionTypes.AuthCheckSuccessAction: return {
|
|
194
|
+
...daffCompleteOperation(state),
|
|
195
|
+
loggedIn: true
|
|
196
|
+
};
|
|
197
|
+
case DaffAuthActionTypes.AuthCheckFailureAction: return {
|
|
198
|
+
...daffOperationFailed([action.errorMessage], state),
|
|
199
|
+
loggedIn: false
|
|
200
|
+
};
|
|
201
|
+
case DaffAuthActionTypes.AuthGuardLogoutAction: return {
|
|
202
|
+
...daffCompleteOperation(state),
|
|
203
|
+
daffErrors: [action.errorMessage],
|
|
204
|
+
loggedIn: false
|
|
205
|
+
};
|
|
206
|
+
case DaffAuthActionTypes.AuthServerSideAction:
|
|
207
|
+
case DaffAuthActionTypes.AuthStorageFailureAction: return daffOperationFailed([action.errorMessage], state);
|
|
208
|
+
case DaffAuthLoginActionTypes.LoginSuccessAction: return {
|
|
209
|
+
...state,
|
|
210
|
+
loggedIn: true
|
|
211
|
+
};
|
|
212
|
+
case DaffAuthRegisterActionTypes.RegisterSuccessAction:
|
|
213
|
+
case DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction: return action.token ? {
|
|
214
|
+
...state,
|
|
215
|
+
loggedIn: true
|
|
216
|
+
} : state;
|
|
217
|
+
case DaffAuthLoginActionTypes.LogoutSuccessAction: return {
|
|
218
|
+
...state,
|
|
219
|
+
loggedIn: false
|
|
220
|
+
};
|
|
221
|
+
default: return state;
|
|
222
|
+
}
|
|
333
223
|
}
|
|
334
|
-
|
|
335
224
|
const daffAuthLoginInitialState = daffOperationInitialState;
|
|
336
|
-
|
|
337
225
|
function daffAuthLoginReducer(state = daffAuthLoginInitialState, action) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return daffOperationFailed([action.errorMessage], state);
|
|
348
|
-
default:
|
|
349
|
-
return state;
|
|
350
|
-
}
|
|
226
|
+
switch (action.type) {
|
|
227
|
+
case DaffAuthLoginActionTypes.LoginAction:
|
|
228
|
+
case DaffAuthLoginActionTypes.LogoutAction: return daffStartMutation(state);
|
|
229
|
+
case DaffAuthLoginActionTypes.LoginSuccessAction:
|
|
230
|
+
case DaffAuthLoginActionTypes.LogoutSuccessAction: return daffCompleteOperation(state);
|
|
231
|
+
case DaffAuthLoginActionTypes.LoginFailureAction:
|
|
232
|
+
case DaffAuthLoginActionTypes.LogoutFailureAction: return daffOperationFailed([action.errorMessage], state);
|
|
233
|
+
default: return state;
|
|
234
|
+
}
|
|
351
235
|
}
|
|
352
|
-
|
|
353
236
|
const daffAuthRegisterInitialState = daffOperationInitialState;
|
|
354
|
-
|
|
355
237
|
function daffAuthRegisterReducer(state = daffAuthRegisterInitialState, action) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return daffOperationFailed([action.errorMessage], state);
|
|
363
|
-
default:
|
|
364
|
-
return state;
|
|
365
|
-
}
|
|
238
|
+
switch (action.type) {
|
|
239
|
+
case DaffAuthRegisterActionTypes.RegisterAction: return daffStartMutation(state);
|
|
240
|
+
case DaffAuthRegisterActionTypes.RegisterSuccessAction: return daffCompleteOperation(state);
|
|
241
|
+
case DaffAuthRegisterActionTypes.RegisterFailureAction: return daffOperationFailed([action.errorMessage], state);
|
|
242
|
+
default: return state;
|
|
243
|
+
}
|
|
366
244
|
}
|
|
367
|
-
|
|
368
245
|
const daffAuthResetPasswordInitialState = {
|
|
369
|
-
|
|
370
|
-
|
|
246
|
+
...daffOperationInitialState,
|
|
247
|
+
token: null
|
|
371
248
|
};
|
|
372
|
-
|
|
373
249
|
function daffAuthResetPasswordReducer(state = daffAuthResetPasswordInitialState, action) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
return state;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
const {
|
|
395
|
-
/**
|
|
396
|
-
* A token to hold the injectable extra reducers.
|
|
397
|
-
*
|
|
398
|
-
* Prefer using {@link daffAuthProvideExtraReducers}.
|
|
399
|
-
*/
|
|
400
|
-
token: DAFF_AUTH_EXTRA_REDUCERS,
|
|
401
|
-
/**
|
|
402
|
-
* Provides additional reducers that run after the standard Daffodil auth reducers.
|
|
403
|
-
*
|
|
404
|
-
* @example
|
|
405
|
-
* ```ts
|
|
406
|
-
* providers: [
|
|
407
|
-
* ...daffAuthProvideExtraReducers(
|
|
408
|
-
* myReducer1,
|
|
409
|
-
* myReducer2
|
|
410
|
-
* )
|
|
411
|
-
* ]
|
|
412
|
-
* ```
|
|
413
|
-
*/
|
|
414
|
-
provider: daffAuthProvideExtraReducers, } = createMultiInjectionToken('DAFF_AUTH_EXTRA_REDUCERS');
|
|
415
|
-
|
|
416
|
-
const DAFF_AUTH_STORE_FEATURE_KEY = 'daffAuth';
|
|
417
|
-
|
|
250
|
+
switch (action.type) {
|
|
251
|
+
case DaffAuthResetPasswordActionTypes.ResetPasswordAction:
|
|
252
|
+
case DaffAuthResetPasswordActionTypes.SendResetEmailAction: return daffStartMutation(state);
|
|
253
|
+
case DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction:
|
|
254
|
+
case DaffAuthResetPasswordActionTypes.SendResetEmailSuccessAction: return daffCompleteOperation(state);
|
|
255
|
+
case DaffAuthResetPasswordActionTypes.ResetPasswordFailureAction:
|
|
256
|
+
case DaffAuthResetPasswordActionTypes.SendResetEmailFailureAction: return daffOperationFailed([action.errorMessage], state);
|
|
257
|
+
case DaffAuthResetPasswordActionTypes.ResetPasswordLandingAction: return {
|
|
258
|
+
...state,
|
|
259
|
+
token: action.token
|
|
260
|
+
};
|
|
261
|
+
default: return state;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const { token: DAFF_AUTH_EXTRA_REDUCERS, provider: daffAuthProvideExtraReducers } = createMultiInjectionToken("DAFF_AUTH_EXTRA_REDUCERS");
|
|
265
|
+
const DAFF_AUTH_STORE_FEATURE_KEY = "daffAuth";
|
|
418
266
|
const daffAuthReducers = {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
267
|
+
auth: daffAuthReducer,
|
|
268
|
+
login: daffAuthLoginReducer,
|
|
269
|
+
register: daffAuthRegisterReducer,
|
|
270
|
+
resetPassword: daffAuthResetPasswordReducer
|
|
423
271
|
};
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Feature State Selector
|
|
427
|
-
*/
|
|
428
272
|
const getDaffAuthFeatureStateSelector = defaultMemoize(() => createFeatureSelector(DAFF_AUTH_STORE_FEATURE_KEY)).memoized;
|
|
429
|
-
|
|
430
273
|
const createAuthSelectors = () => {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
274
|
+
const selectAuthState = createSelector(getDaffAuthFeatureStateSelector(), (state) => state.auth);
|
|
275
|
+
const selectAuthLoggedIn = createSelector(selectAuthState, (state) => state.loggedIn);
|
|
276
|
+
return {
|
|
277
|
+
...daffOperationStateSelectorFactory(selectAuthState),
|
|
278
|
+
selectAuthState,
|
|
279
|
+
selectAuthLoggedIn
|
|
280
|
+
};
|
|
438
281
|
};
|
|
439
282
|
const daffAuthSelectorFactory = defaultMemoize(() => createAuthSelectors()).memoized;
|
|
440
|
-
|
|
441
283
|
const createLoginSelectors = () => {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
284
|
+
const selectAuthLoginState = createSelector(getDaffAuthFeatureStateSelector(), (state) => state.login);
|
|
285
|
+
return {
|
|
286
|
+
...daffOperationStateSelectorFactory(selectAuthLoginState),
|
|
287
|
+
selectAuthLoginState
|
|
288
|
+
};
|
|
447
289
|
};
|
|
448
290
|
const daffAuthLoginSelectorFactory = defaultMemoize(() => createLoginSelectors()).memoized;
|
|
449
|
-
|
|
450
291
|
const createRegisterSelectors = () => {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
292
|
+
const selectAuthRegisterState = createSelector(getDaffAuthFeatureStateSelector(), (state) => state.register);
|
|
293
|
+
return {
|
|
294
|
+
...daffOperationStateSelectorFactory(selectAuthRegisterState),
|
|
295
|
+
selectAuthRegisterState
|
|
296
|
+
};
|
|
456
297
|
};
|
|
457
298
|
const daffAuthRegisterSelectorFactory = defaultMemoize(() => createRegisterSelectors()).memoized;
|
|
458
|
-
|
|
459
299
|
const createResetPasswordSelectors = () => {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
300
|
+
const selectAuthResetPasswordState = createSelector(getDaffAuthFeatureStateSelector(), (state) => state.resetPassword);
|
|
301
|
+
const selectAuthResetPasswordToken = createSelector(selectAuthResetPasswordState, (state) => state.token);
|
|
302
|
+
return {
|
|
303
|
+
...daffOperationStateSelectorFactory(selectAuthResetPasswordState),
|
|
304
|
+
selectAuthResetPasswordState,
|
|
305
|
+
selectAuthResetPasswordToken
|
|
306
|
+
};
|
|
467
307
|
};
|
|
468
308
|
const daffAuthResetPasswordSelectorFactory = defaultMemoize(() => createResetPasswordSelectors()).memoized;
|
|
469
|
-
|
|
470
309
|
const getDaffAuthSelectors = defaultMemoize(() => ({
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
310
|
+
...daffAuthSelectorFactory(),
|
|
311
|
+
...daffAuthLoginSelectorFactory(),
|
|
312
|
+
...daffAuthRegisterSelectorFactory(),
|
|
313
|
+
...daffAuthResetPasswordSelectorFactory(),
|
|
314
|
+
selectAuthFeatureState: getDaffAuthFeatureStateSelector()
|
|
476
315
|
})).memoized;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
i0.ɵɵ
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
this.store = store;
|
|
508
|
-
const { selectLoading, selectErrors, } = daffAuthLoginSelectorFactory();
|
|
509
|
-
this.loading$ = this.store.pipe(select(selectLoading));
|
|
510
|
-
this.errors$ = this.store.pipe(select(selectErrors));
|
|
511
|
-
}
|
|
512
|
-
dispatch(action) {
|
|
513
|
-
this.store.dispatch(action);
|
|
514
|
-
}
|
|
515
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthLoginFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
516
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthLoginFacade, providedIn: 'root' }); }
|
|
517
|
-
}
|
|
518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthLoginFacade, decorators: [{
|
|
519
|
-
type: Injectable,
|
|
520
|
-
args: [{
|
|
521
|
-
providedIn: 'root',
|
|
522
|
-
}]
|
|
523
|
-
}], ctorParameters: () => [{ type: i1.Store }] });
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* @inheritdoc
|
|
527
|
-
*/
|
|
528
|
-
class DaffAuthRegisterFacade {
|
|
529
|
-
constructor(store) {
|
|
530
|
-
this.store = store;
|
|
531
|
-
const { selectLoading, selectErrors, } = daffAuthRegisterSelectorFactory();
|
|
532
|
-
this.loading$ = this.store.pipe(select(selectLoading));
|
|
533
|
-
this.errors$ = this.store.pipe(select(selectErrors));
|
|
534
|
-
}
|
|
535
|
-
dispatch(action) {
|
|
536
|
-
this.store.dispatch(action);
|
|
537
|
-
}
|
|
538
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRegisterFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
539
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRegisterFacade, providedIn: 'root' }); }
|
|
540
|
-
}
|
|
541
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRegisterFacade, decorators: [{
|
|
542
|
-
type: Injectable,
|
|
543
|
-
args: [{
|
|
544
|
-
providedIn: 'root',
|
|
545
|
-
}]
|
|
546
|
-
}], ctorParameters: () => [{ type: i1.Store }] });
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* @inheritdoc
|
|
550
|
-
*/
|
|
551
|
-
class DaffAuthResetPasswordFacade {
|
|
552
|
-
constructor(store) {
|
|
553
|
-
this.store = store;
|
|
554
|
-
const { selectLoading, selectErrors, selectAuthResetPasswordToken, } = daffAuthResetPasswordSelectorFactory();
|
|
555
|
-
this.token$ = this.store.pipe(select(selectAuthResetPasswordToken));
|
|
556
|
-
this.loading$ = this.store.pipe(select(selectLoading));
|
|
557
|
-
this.errors$ = this.store.pipe(select(selectErrors));
|
|
558
|
-
}
|
|
559
|
-
dispatch(action) {
|
|
560
|
-
this.store.dispatch(action);
|
|
561
|
-
}
|
|
562
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthResetPasswordFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
563
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthResetPasswordFacade, providedIn: 'root' }); }
|
|
564
|
-
}
|
|
565
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthResetPasswordFacade, decorators: [{
|
|
566
|
-
type: Injectable,
|
|
567
|
-
args: [{
|
|
568
|
-
providedIn: 'root',
|
|
569
|
-
}]
|
|
570
|
-
}], ctorParameters: () => [{ type: i1.Store }] });
|
|
571
|
-
|
|
572
|
-
const TWENTY_MINUTES = 1.2e6;
|
|
573
|
-
const daffAuthStateDefaultConfig = {
|
|
574
|
-
checkInterval: TWENTY_MINUTES,
|
|
316
|
+
var DaffAuthFacade = class DaffAuthFacade {
|
|
317
|
+
constructor(store) {
|
|
318
|
+
this.store = store;
|
|
319
|
+
const { selectLoading, selectErrors, selectAuthLoggedIn } = daffAuthSelectorFactory();
|
|
320
|
+
this.loading$ = this.store.pipe(select(selectLoading));
|
|
321
|
+
this.errors$ = this.store.pipe(select(selectErrors));
|
|
322
|
+
this.loggedIn$ = this.store.pipe(select(selectAuthLoggedIn));
|
|
323
|
+
}
|
|
324
|
+
dispatch(action) {
|
|
325
|
+
this.store.dispatch(action);
|
|
326
|
+
}
|
|
327
|
+
static {
|
|
328
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
329
|
+
minVersion: "12.0.0",
|
|
330
|
+
version: "22.2.4",
|
|
331
|
+
ngImport: i0,
|
|
332
|
+
type: DaffAuthFacade,
|
|
333
|
+
deps: [{ token: i1$1.Store }],
|
|
334
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
static {
|
|
338
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
339
|
+
minVersion: "12.0.0",
|
|
340
|
+
version: "22.2.4",
|
|
341
|
+
ngImport: i0,
|
|
342
|
+
type: DaffAuthFacade,
|
|
343
|
+
providedIn: "root"
|
|
344
|
+
});
|
|
345
|
+
}
|
|
575
346
|
};
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
* See {@link DaffAuthUnauthenticatedHook}.
|
|
587
|
-
*
|
|
588
|
-
* Prefer using {@link daffAuthProvideUnauthenticatedHooks}.
|
|
589
|
-
*/
|
|
590
|
-
token: DAFF_AUTH_UNAUTHENTICATED_HOOKS,
|
|
591
|
-
/**
|
|
592
|
-
* Provides {@link DAFF_AUTH_UNAUTHENTICATED_HOOKS}.
|
|
593
|
-
*
|
|
594
|
-
* @example
|
|
595
|
-
* ```ts
|
|
596
|
-
* providers: [
|
|
597
|
-
* ...daffAuthProvideUnauthenticatedHooks(
|
|
598
|
-
* myHook1,
|
|
599
|
-
* myHook2
|
|
600
|
-
* )
|
|
601
|
-
* ]
|
|
602
|
-
* ```
|
|
603
|
-
*/
|
|
604
|
-
provider: daffAuthProvideUnauthenticatedHooks, } = createMultiInjectionToken('DAFF_AUTH_UNAUTHENTICATED_HOOKS');
|
|
605
|
-
|
|
606
|
-
const {
|
|
607
|
-
/**
|
|
608
|
-
* Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
|
|
609
|
-
* Can be used to further refine Daffodil errors into more specific app errors.
|
|
610
|
-
*/
|
|
611
|
-
token: DAFF_AUTH_ERROR_MATCHER,
|
|
612
|
-
/**
|
|
613
|
-
* Provider function for {@link DAFF_AUTH_ERROR_MATCHER}.
|
|
614
|
-
*/
|
|
615
|
-
provider: provideDaffAuthErrorMatcher, } = createSingleInjectionToken('DAFF_AUTH_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
|
|
616
|
-
|
|
617
|
-
const {
|
|
618
|
-
/**
|
|
619
|
-
* An internal token to hold the unauthenticated hook.
|
|
620
|
-
* Combines the multi provided hooks into a single function.
|
|
621
|
-
*
|
|
622
|
-
* @docs-private
|
|
623
|
-
*/
|
|
624
|
-
token: DAFF_AUTH_UNAUTHENTICATED_HOOK,
|
|
625
|
-
/**
|
|
626
|
-
* Provider function for {@link DAFF_AUTH_UNAUTHENTICATED_HOOK}.
|
|
627
|
-
*/
|
|
628
|
-
provider: provideDaffAuthUnauthenticatedHook, } = createSingleInjectionToken('DAFF_AUTH_UNAUTHENTICATED_HOOK', {
|
|
629
|
-
factory: () => {
|
|
630
|
-
const hooks = inject(DAFF_AUTH_UNAUTHENTICATED_HOOKS);
|
|
631
|
-
return (action) => combineLatest(hooks.map((hook) => hook(action)));
|
|
632
|
-
},
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
348
|
+
minVersion: "12.0.0",
|
|
349
|
+
version: "22.2.4",
|
|
350
|
+
ngImport: i0,
|
|
351
|
+
type: DaffAuthFacade,
|
|
352
|
+
decorators: [{
|
|
353
|
+
type: Injectable,
|
|
354
|
+
args: [{ providedIn: "root" }]
|
|
355
|
+
}],
|
|
356
|
+
ctorParameters: () => [{ type: i1$1.Store }]
|
|
633
357
|
});
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
this.clearClientCache$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.ResetToUnauthenticatedAction), switchMap((action) => this.unauthenticatedHook(action.reason)), tap(() => {
|
|
675
|
-
this.clientCache.reset();
|
|
676
|
-
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
677
|
-
}
|
|
678
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthEffects, deps: [{ token: i1$1.Actions }, { token: i2.DaffAuthDriverTokenCheck }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }, { token: DAFF_AUTH_STATE_CONFIG }, { token: DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE }, { token: DAFF_AUTH_UNAUTHENTICATED_HOOK }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
679
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthEffects }); }
|
|
680
|
-
}
|
|
681
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthEffects, decorators: [{
|
|
682
|
-
type: Injectable
|
|
683
|
-
}], ctorParameters: () => [{ type: i1$1.Actions }, { type: i2.DaffAuthDriverTokenCheck }, { type: undefined, decorators: [{
|
|
684
|
-
type: Inject,
|
|
685
|
-
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
686
|
-
}] }, { type: i2$1.DaffAuthStorageService }, { type: undefined, decorators: [{
|
|
687
|
-
type: Inject,
|
|
688
|
-
args: [DAFF_AUTH_STATE_CONFIG]
|
|
689
|
-
}] }, { type: undefined, decorators: [{
|
|
690
|
-
type: Inject,
|
|
691
|
-
args: [DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE]
|
|
692
|
-
}] }, { type: undefined, decorators: [{
|
|
693
|
-
type: Inject,
|
|
694
|
-
args: [DAFF_AUTH_UNAUTHENTICATED_HOOK]
|
|
695
|
-
}] }, { type: i0.NgZone }] });
|
|
696
|
-
|
|
697
|
-
class DaffAuthLoginEffects {
|
|
698
|
-
constructor(actions$, loginDriver, errorMatcher, storage) {
|
|
699
|
-
this.actions$ = actions$;
|
|
700
|
-
this.loginDriver = loginDriver;
|
|
701
|
-
this.errorMatcher = errorMatcher;
|
|
702
|
-
this.storage = storage;
|
|
703
|
-
this.login$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginAction), switchMap((action) => this.loginDriver.login(action.loginInfo)
|
|
704
|
-
.pipe(map((resp) => new DaffAuthLoginSuccess(resp)), tap((success) => this.storage.setAuthToken(success.auth.token)), catchError((error) => {
|
|
705
|
-
switch (true) {
|
|
706
|
-
case error instanceof DaffServerSideStorageError:
|
|
707
|
-
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
708
|
-
case error instanceof DaffStorageServiceError:
|
|
709
|
-
default:
|
|
710
|
-
return of(new DaffAuthLoginFailure(this.errorMatcher(error)));
|
|
711
|
-
}
|
|
712
|
-
})))));
|
|
713
|
-
this.logout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutAction), switchMap((action) => this.loginDriver.logout().pipe(map(() => new DaffAuthLogoutSuccess()), catchError((error) => {
|
|
714
|
-
switch (true) {
|
|
715
|
-
case error instanceof DaffServerSideStorageError:
|
|
716
|
-
return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
717
|
-
case error instanceof DaffStorageServiceError:
|
|
718
|
-
return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
719
|
-
default:
|
|
720
|
-
return of(new DaffAuthLogoutFailure(this.errorMatcher(error)));
|
|
721
|
-
}
|
|
722
|
-
})))));
|
|
723
|
-
}
|
|
724
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthLoginEffects, deps: [{ token: i1$1.Actions }, { token: DaffLoginDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
725
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthLoginEffects }); }
|
|
726
|
-
}
|
|
727
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthLoginEffects, decorators: [{
|
|
728
|
-
type: Injectable
|
|
729
|
-
}], ctorParameters: () => [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
730
|
-
type: Inject,
|
|
731
|
-
args: [DaffLoginDriver]
|
|
732
|
-
}] }, { type: undefined, decorators: [{
|
|
733
|
-
type: Inject,
|
|
734
|
-
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
735
|
-
}] }, { type: i2$1.DaffAuthStorageService }] });
|
|
736
|
-
|
|
737
|
-
class DaffAuthRegisterEffects {
|
|
738
|
-
constructor(actions$, registerDriver, errorMatcher, storage) {
|
|
739
|
-
this.actions$ = actions$;
|
|
740
|
-
this.registerDriver = registerDriver;
|
|
741
|
-
this.errorMatcher = errorMatcher;
|
|
742
|
-
this.storage = storage;
|
|
743
|
-
this.register$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthRegisterActionTypes.RegisterAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.registerDriver.register(action.registration).pipe(tap(token => this.storage.setAuthToken(token)), map((token) => new DaffAuthRegisterSuccess(token)))), defer(() => this.registerDriver.registerOnly(action.registration).pipe(map(() => new DaffAuthRegisterSuccess())))).pipe(catchError((error) => {
|
|
744
|
-
switch (true) {
|
|
745
|
-
case error instanceof DaffServerSideStorageError:
|
|
746
|
-
return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
747
|
-
case error instanceof DaffStorageServiceError:
|
|
748
|
-
return of(new DaffAuthStorageFailure(this.errorMatcher(error)), new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
749
|
-
default:
|
|
750
|
-
return of(new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
751
|
-
}
|
|
752
|
-
})))));
|
|
753
|
-
}
|
|
754
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRegisterEffects, deps: [{ token: i1$1.Actions }, { token: DaffRegisterDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
755
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRegisterEffects }); }
|
|
756
|
-
}
|
|
757
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthRegisterEffects, decorators: [{
|
|
758
|
-
type: Injectable
|
|
759
|
-
}], ctorParameters: () => [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
760
|
-
type: Inject,
|
|
761
|
-
args: [DaffRegisterDriver]
|
|
762
|
-
}] }, { type: undefined, decorators: [{
|
|
763
|
-
type: Inject,
|
|
764
|
-
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
765
|
-
}] }, { type: i2$1.DaffAuthStorageService }] });
|
|
766
|
-
|
|
767
|
-
class DaffAuthResetPasswordEffects {
|
|
768
|
-
constructor(actions$, driver, errorMatcher, storage) {
|
|
769
|
-
this.actions$ = actions$;
|
|
770
|
-
this.driver = driver;
|
|
771
|
-
this.errorMatcher = errorMatcher;
|
|
772
|
-
this.storage = storage;
|
|
773
|
-
this.sendResetEmail$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.SendResetEmailAction), switchMap((action) => this.driver.sendResetEmail(action.email).pipe(map(() => new DaffSendResetEmailSuccess()), catchError((error) => of(new DaffSendResetEmailFailure(this.errorMatcher(error))))))));
|
|
774
|
-
this.resetPassword$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.ResetPasswordAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.driver.resetPassword(action.info).pipe(tap(token => this.storage.setAuthToken(token)), map((token) => new DaffResetPasswordSuccess(token)))), defer(() => this.driver.resetPasswordOnly(action.info).pipe(map(() => new DaffResetPasswordSuccess())))).pipe(catchError((error) => {
|
|
775
|
-
switch (true) {
|
|
776
|
-
case error instanceof DaffServerSideStorageError:
|
|
777
|
-
return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
778
|
-
case error instanceof DaffStorageServiceError:
|
|
779
|
-
return of(new DaffAuthStorageFailure(this.errorMatcher(error)), new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
780
|
-
default:
|
|
781
|
-
return of(new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
782
|
-
}
|
|
783
|
-
})))));
|
|
784
|
-
}
|
|
785
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthResetPasswordEffects, deps: [{ token: i1$1.Actions }, { token: DaffResetPasswordDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2$1.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
786
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthResetPasswordEffects }); }
|
|
787
|
-
}
|
|
788
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffAuthResetPasswordEffects, decorators: [{
|
|
789
|
-
type: Injectable
|
|
790
|
-
}], ctorParameters: () => [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
791
|
-
type: Inject,
|
|
792
|
-
args: [DaffResetPasswordDriver]
|
|
793
|
-
}] }, { type: undefined, decorators: [{
|
|
794
|
-
type: Inject,
|
|
795
|
-
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
796
|
-
}] }, { type: i2$1.DaffAuthStorageService }] });
|
|
797
|
-
|
|
798
|
-
const {
|
|
799
|
-
/**
|
|
800
|
-
* An internal token to hold the Daffodil auth reducers.
|
|
801
|
-
* Includes the extra and standard reducers.
|
|
802
|
-
*
|
|
803
|
-
* @docs-private
|
|
804
|
-
*/
|
|
805
|
-
token: DAFF_AUTH_REDUCERS,
|
|
806
|
-
/**
|
|
807
|
-
* Provider function for {@link DAFF_AUTH_REDUCERS}.
|
|
808
|
-
*/
|
|
809
|
-
provider: provideDaffAuthReducers, } = createSingleInjectionToken('DAFF_AUTH_REDUCERS', {
|
|
810
|
-
factory: () => daffComposeReducers([
|
|
811
|
-
combineReducers(daffAuthReducers),
|
|
812
|
-
...inject(DAFF_AUTH_EXTRA_REDUCERS),
|
|
813
|
-
]),
|
|
358
|
+
var DaffAuthLoginFacade = class DaffAuthLoginFacade {
|
|
359
|
+
constructor(store) {
|
|
360
|
+
this.store = store;
|
|
361
|
+
const { selectLoading, selectErrors } = daffAuthLoginSelectorFactory();
|
|
362
|
+
this.loading$ = this.store.pipe(select(selectLoading));
|
|
363
|
+
this.errors$ = this.store.pipe(select(selectErrors));
|
|
364
|
+
}
|
|
365
|
+
dispatch(action) {
|
|
366
|
+
this.store.dispatch(action);
|
|
367
|
+
}
|
|
368
|
+
static {
|
|
369
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
370
|
+
minVersion: "12.0.0",
|
|
371
|
+
version: "22.2.4",
|
|
372
|
+
ngImport: i0,
|
|
373
|
+
type: DaffAuthLoginFacade,
|
|
374
|
+
deps: [{ token: i1$1.Store }],
|
|
375
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
static {
|
|
379
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
380
|
+
minVersion: "12.0.0",
|
|
381
|
+
version: "22.2.4",
|
|
382
|
+
ngImport: i0,
|
|
383
|
+
type: DaffAuthLoginFacade,
|
|
384
|
+
providedIn: "root"
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
389
|
+
minVersion: "12.0.0",
|
|
390
|
+
version: "22.2.4",
|
|
391
|
+
ngImport: i0,
|
|
392
|
+
type: DaffAuthLoginFacade,
|
|
393
|
+
decorators: [{
|
|
394
|
+
type: Injectable,
|
|
395
|
+
args: [{ providedIn: "root" }]
|
|
396
|
+
}],
|
|
397
|
+
ctorParameters: () => [{ type: i1$1.Store }]
|
|
814
398
|
});
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
399
|
+
var DaffAuthRegisterFacade = class DaffAuthRegisterFacade {
|
|
400
|
+
constructor(store) {
|
|
401
|
+
this.store = store;
|
|
402
|
+
const { selectLoading, selectErrors } = daffAuthRegisterSelectorFactory();
|
|
403
|
+
this.loading$ = this.store.pipe(select(selectLoading));
|
|
404
|
+
this.errors$ = this.store.pipe(select(selectErrors));
|
|
405
|
+
}
|
|
406
|
+
dispatch(action) {
|
|
407
|
+
this.store.dispatch(action);
|
|
408
|
+
}
|
|
409
|
+
static {
|
|
410
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
411
|
+
minVersion: "12.0.0",
|
|
412
|
+
version: "22.2.4",
|
|
413
|
+
ngImport: i0,
|
|
414
|
+
type: DaffAuthRegisterFacade,
|
|
415
|
+
deps: [{ token: i1$1.Store }],
|
|
416
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
static {
|
|
420
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
421
|
+
minVersion: "12.0.0",
|
|
422
|
+
version: "22.2.4",
|
|
423
|
+
ngImport: i0,
|
|
424
|
+
type: DaffAuthRegisterFacade,
|
|
425
|
+
providedIn: "root"
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
430
|
+
minVersion: "12.0.0",
|
|
431
|
+
version: "22.2.4",
|
|
432
|
+
ngImport: i0,
|
|
433
|
+
type: DaffAuthRegisterFacade,
|
|
434
|
+
decorators: [{
|
|
435
|
+
type: Injectable,
|
|
436
|
+
args: [{ providedIn: "root" }]
|
|
437
|
+
}],
|
|
438
|
+
ctorParameters: () => [{ type: i1$1.Store }]
|
|
439
|
+
});
|
|
440
|
+
var DaffAuthResetPasswordFacade = class DaffAuthResetPasswordFacade {
|
|
441
|
+
constructor(store) {
|
|
442
|
+
this.store = store;
|
|
443
|
+
const { selectLoading, selectErrors, selectAuthResetPasswordToken } = daffAuthResetPasswordSelectorFactory();
|
|
444
|
+
this.token$ = this.store.pipe(select(selectAuthResetPasswordToken));
|
|
445
|
+
this.loading$ = this.store.pipe(select(selectLoading));
|
|
446
|
+
this.errors$ = this.store.pipe(select(selectErrors));
|
|
447
|
+
}
|
|
448
|
+
dispatch(action) {
|
|
449
|
+
this.store.dispatch(action);
|
|
450
|
+
}
|
|
451
|
+
static {
|
|
452
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
453
|
+
minVersion: "12.0.0",
|
|
454
|
+
version: "22.2.4",
|
|
455
|
+
ngImport: i0,
|
|
456
|
+
type: DaffAuthResetPasswordFacade,
|
|
457
|
+
deps: [{ token: i1$1.Store }],
|
|
458
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
static {
|
|
462
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
463
|
+
minVersion: "12.0.0",
|
|
464
|
+
version: "22.2.4",
|
|
465
|
+
ngImport: i0,
|
|
466
|
+
type: DaffAuthResetPasswordFacade,
|
|
467
|
+
providedIn: "root"
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
472
|
+
minVersion: "12.0.0",
|
|
473
|
+
version: "22.2.4",
|
|
474
|
+
ngImport: i0,
|
|
475
|
+
type: DaffAuthResetPasswordFacade,
|
|
476
|
+
decorators: [{
|
|
477
|
+
type: Injectable,
|
|
478
|
+
args: [{ providedIn: "root" }]
|
|
479
|
+
}],
|
|
480
|
+
ctorParameters: () => [{ type: i1$1.Store }]
|
|
481
|
+
});
|
|
482
|
+
const daffAuthStateDefaultConfig = { checkInterval: 12e5 };
|
|
483
|
+
const { token: DAFF_AUTH_STATE_CONFIG, provider: provideDaffAuthStateConfig } = createConfigInjectionToken(daffAuthStateDefaultConfig, "DAFF_AUTH_STATE_CONFIG");
|
|
484
|
+
const { token: DAFF_AUTH_UNAUTHENTICATED_HOOKS, provider: daffAuthProvideUnauthenticatedHooks } = createMultiInjectionToken("DAFF_AUTH_UNAUTHENTICATED_HOOKS");
|
|
485
|
+
const { token: DAFF_AUTH_ERROR_MATCHER, provider: provideDaffAuthErrorMatcher } = createSingleInjectionToken("DAFF_AUTH_ERROR_MATCHER", { factory: () => daffTransformErrorToStateError });
|
|
486
|
+
const { token: DAFF_AUTH_UNAUTHENTICATED_HOOK, provider: provideDaffAuthUnauthenticatedHook } = createSingleInjectionToken("DAFF_AUTH_UNAUTHENTICATED_HOOK", { factory: () => {
|
|
487
|
+
const hooks = inject(DAFF_AUTH_UNAUTHENTICATED_HOOKS);
|
|
488
|
+
return (action) => combineLatest(hooks.map((hook) => hook(action)));
|
|
489
|
+
} });
|
|
490
|
+
var DaffAuthEffects = class DaffAuthEffects {
|
|
491
|
+
constructor(actions$, tokenCheck, errorMatcher, storage, config, clientCache, unauthenticatedHook, zone) {
|
|
492
|
+
this.actions$ = actions$;
|
|
493
|
+
this.tokenCheck = tokenCheck;
|
|
494
|
+
this.errorMatcher = errorMatcher;
|
|
495
|
+
this.storage = storage;
|
|
496
|
+
this.config = config;
|
|
497
|
+
this.clientCache = clientCache;
|
|
498
|
+
this.unauthenticatedHook = unauthenticatedHook;
|
|
499
|
+
this.zone = zone;
|
|
500
|
+
this.check$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckAction), switchMap((action) => this.tokenCheck.check().pipe(map(() => new DaffAuthCheckSuccess()), catchError((error) => of(new DaffAuthCheckFailure(this.errorMatcher(error))))))));
|
|
501
|
+
this.authCheckInterval$ = createEffect(() => new Observable((subscriber) => {
|
|
502
|
+
const intervalId = this.zone.runOutsideAngular(() => setInterval(() => {
|
|
503
|
+
subscriber.next(new DaffAuthCheck());
|
|
504
|
+
}, this.config.checkInterval));
|
|
505
|
+
subscriber.next(new DaffAuthCheck());
|
|
506
|
+
return () => {
|
|
507
|
+
clearInterval(intervalId);
|
|
508
|
+
};
|
|
509
|
+
}).pipe(filter(() => !!this.storage.getAuthToken()), catchError((error) => {
|
|
510
|
+
switch (true) {
|
|
511
|
+
case error instanceof DaffServerSideStorageError: return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
512
|
+
case error instanceof DaffStorageServiceError: return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
513
|
+
default: return EMPTY;
|
|
514
|
+
}
|
|
515
|
+
})));
|
|
516
|
+
this.resetToUnauthenticated$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckFailureAction, DaffAuthActionTypes.AuthGuardLogoutAction, DaffAuthLoginActionTypes.LogoutSuccessAction), filter((action) => {
|
|
517
|
+
if (action.type === DaffAuthActionTypes.AuthCheckFailureAction && !DAFF_AUTH_UNAUTHENTICATED_ERROR_CODES[action.errorMessage.code]) return false;
|
|
518
|
+
return true;
|
|
519
|
+
}), map((action) => new DaffAuthResetToUnauthenticated(action.type))));
|
|
520
|
+
this.clearClientCache$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.ResetToUnauthenticatedAction), switchMap((action) => this.unauthenticatedHook(action.reason)), tap(() => {
|
|
521
|
+
this.clientCache.reset();
|
|
522
|
+
}), switchMap(() => EMPTY)), { dispatch: false });
|
|
523
|
+
}
|
|
524
|
+
static {
|
|
525
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
526
|
+
minVersion: "12.0.0",
|
|
527
|
+
version: "22.2.4",
|
|
528
|
+
ngImport: i0,
|
|
529
|
+
type: DaffAuthEffects,
|
|
530
|
+
deps: [
|
|
531
|
+
{ token: i1.Actions },
|
|
532
|
+
{ token: i2.DaffAuthDriverTokenCheck },
|
|
533
|
+
{ token: DAFF_AUTH_ERROR_MATCHER },
|
|
534
|
+
{ token: i3.DaffAuthStorageService },
|
|
535
|
+
{ token: DAFF_AUTH_STATE_CONFIG },
|
|
536
|
+
{ token: DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE },
|
|
537
|
+
{ token: DAFF_AUTH_UNAUTHENTICATED_HOOK },
|
|
538
|
+
{ token: i0.NgZone }
|
|
539
|
+
],
|
|
540
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
static {
|
|
544
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
545
|
+
minVersion: "12.0.0",
|
|
546
|
+
version: "22.2.4",
|
|
547
|
+
ngImport: i0,
|
|
548
|
+
type: DaffAuthEffects
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
553
|
+
minVersion: "12.0.0",
|
|
554
|
+
version: "22.2.4",
|
|
555
|
+
ngImport: i0,
|
|
556
|
+
type: DaffAuthEffects,
|
|
557
|
+
decorators: [{ type: Injectable }],
|
|
558
|
+
ctorParameters: () => [
|
|
559
|
+
{ type: i1.Actions },
|
|
560
|
+
{ type: i2.DaffAuthDriverTokenCheck },
|
|
561
|
+
{
|
|
562
|
+
type: void 0,
|
|
563
|
+
decorators: [{
|
|
564
|
+
type: Inject,
|
|
565
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
566
|
+
}]
|
|
567
|
+
},
|
|
568
|
+
{ type: i3.DaffAuthStorageService },
|
|
569
|
+
{
|
|
570
|
+
type: void 0,
|
|
571
|
+
decorators: [{
|
|
572
|
+
type: Inject,
|
|
573
|
+
args: [DAFF_AUTH_STATE_CONFIG]
|
|
574
|
+
}]
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
type: void 0,
|
|
578
|
+
decorators: [{
|
|
579
|
+
type: Inject,
|
|
580
|
+
args: [DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE]
|
|
581
|
+
}]
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
type: void 0,
|
|
585
|
+
decorators: [{
|
|
586
|
+
type: Inject,
|
|
587
|
+
args: [DAFF_AUTH_UNAUTHENTICATED_HOOK]
|
|
588
|
+
}]
|
|
589
|
+
},
|
|
590
|
+
{ type: i0.NgZone }
|
|
591
|
+
]
|
|
592
|
+
});
|
|
593
|
+
var DaffAuthLoginEffects = class DaffAuthLoginEffects {
|
|
594
|
+
constructor(actions$, loginDriver, errorMatcher, storage) {
|
|
595
|
+
this.actions$ = actions$;
|
|
596
|
+
this.loginDriver = loginDriver;
|
|
597
|
+
this.errorMatcher = errorMatcher;
|
|
598
|
+
this.storage = storage;
|
|
599
|
+
this.login$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginAction), switchMap((action) => this.loginDriver.login(action.loginInfo).pipe(map((resp) => new DaffAuthLoginSuccess(resp)), tap((success) => this.storage.setAuthToken(success.auth.token)), catchError((error) => {
|
|
600
|
+
switch (true) {
|
|
601
|
+
case error instanceof DaffServerSideStorageError: return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
602
|
+
case error instanceof DaffStorageServiceError:
|
|
603
|
+
default: return of(new DaffAuthLoginFailure(this.errorMatcher(error)));
|
|
604
|
+
}
|
|
605
|
+
})))));
|
|
606
|
+
this.logout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutAction), switchMap((action) => this.loginDriver.logout().pipe(map(() => new DaffAuthLogoutSuccess()), catchError((error) => {
|
|
607
|
+
switch (true) {
|
|
608
|
+
case error instanceof DaffServerSideStorageError: return of(new DaffAuthServerSide(this.errorMatcher(error)));
|
|
609
|
+
case error instanceof DaffStorageServiceError: return of(new DaffAuthStorageFailure(this.errorMatcher(error)));
|
|
610
|
+
default: return of(new DaffAuthLogoutFailure(this.errorMatcher(error)));
|
|
611
|
+
}
|
|
612
|
+
})))));
|
|
613
|
+
}
|
|
614
|
+
static {
|
|
615
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
616
|
+
minVersion: "12.0.0",
|
|
617
|
+
version: "22.2.4",
|
|
618
|
+
ngImport: i0,
|
|
619
|
+
type: DaffAuthLoginEffects,
|
|
620
|
+
deps: [
|
|
621
|
+
{ token: i1.Actions },
|
|
622
|
+
{ token: DaffLoginDriver },
|
|
623
|
+
{ token: DAFF_AUTH_ERROR_MATCHER },
|
|
624
|
+
{ token: i3.DaffAuthStorageService }
|
|
625
|
+
],
|
|
626
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
static {
|
|
630
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
631
|
+
minVersion: "12.0.0",
|
|
632
|
+
version: "22.2.4",
|
|
633
|
+
ngImport: i0,
|
|
634
|
+
type: DaffAuthLoginEffects
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
639
|
+
minVersion: "12.0.0",
|
|
640
|
+
version: "22.2.4",
|
|
641
|
+
ngImport: i0,
|
|
642
|
+
type: DaffAuthLoginEffects,
|
|
643
|
+
decorators: [{ type: Injectable }],
|
|
644
|
+
ctorParameters: () => [
|
|
645
|
+
{ type: i1.Actions },
|
|
646
|
+
{
|
|
647
|
+
type: void 0,
|
|
648
|
+
decorators: [{
|
|
649
|
+
type: Inject,
|
|
650
|
+
args: [DaffLoginDriver]
|
|
651
|
+
}]
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
type: void 0,
|
|
655
|
+
decorators: [{
|
|
656
|
+
type: Inject,
|
|
657
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
658
|
+
}]
|
|
659
|
+
},
|
|
660
|
+
{ type: i3.DaffAuthStorageService }
|
|
661
|
+
]
|
|
662
|
+
});
|
|
663
|
+
var DaffAuthRegisterEffects = class DaffAuthRegisterEffects {
|
|
664
|
+
constructor(actions$, registerDriver, errorMatcher, storage) {
|
|
665
|
+
this.actions$ = actions$;
|
|
666
|
+
this.registerDriver = registerDriver;
|
|
667
|
+
this.errorMatcher = errorMatcher;
|
|
668
|
+
this.storage = storage;
|
|
669
|
+
this.register$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthRegisterActionTypes.RegisterAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.registerDriver.register(action.registration).pipe(tap((token) => this.storage.setAuthToken(token)), map((token) => new DaffAuthRegisterSuccess(token)))), defer(() => this.registerDriver.registerOnly(action.registration).pipe(map(() => new DaffAuthRegisterSuccess())))).pipe(catchError((error) => {
|
|
670
|
+
switch (true) {
|
|
671
|
+
case error instanceof DaffServerSideStorageError: return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
672
|
+
case error instanceof DaffStorageServiceError: return of(new DaffAuthStorageFailure(this.errorMatcher(error)), new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
673
|
+
default: return of(new DaffAuthRegisterFailure(this.errorMatcher(error)));
|
|
674
|
+
}
|
|
675
|
+
})))));
|
|
676
|
+
}
|
|
677
|
+
static {
|
|
678
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
679
|
+
minVersion: "12.0.0",
|
|
680
|
+
version: "22.2.4",
|
|
681
|
+
ngImport: i0,
|
|
682
|
+
type: DaffAuthRegisterEffects,
|
|
683
|
+
deps: [
|
|
684
|
+
{ token: i1.Actions },
|
|
685
|
+
{ token: DaffRegisterDriver },
|
|
686
|
+
{ token: DAFF_AUTH_ERROR_MATCHER },
|
|
687
|
+
{ token: i3.DaffAuthStorageService }
|
|
688
|
+
],
|
|
689
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
static {
|
|
693
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
694
|
+
minVersion: "12.0.0",
|
|
695
|
+
version: "22.2.4",
|
|
696
|
+
ngImport: i0,
|
|
697
|
+
type: DaffAuthRegisterEffects
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
702
|
+
minVersion: "12.0.0",
|
|
703
|
+
version: "22.2.4",
|
|
704
|
+
ngImport: i0,
|
|
705
|
+
type: DaffAuthRegisterEffects,
|
|
706
|
+
decorators: [{ type: Injectable }],
|
|
707
|
+
ctorParameters: () => [
|
|
708
|
+
{ type: i1.Actions },
|
|
709
|
+
{
|
|
710
|
+
type: void 0,
|
|
711
|
+
decorators: [{
|
|
712
|
+
type: Inject,
|
|
713
|
+
args: [DaffRegisterDriver]
|
|
714
|
+
}]
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
type: void 0,
|
|
718
|
+
decorators: [{
|
|
719
|
+
type: Inject,
|
|
720
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
721
|
+
}]
|
|
722
|
+
},
|
|
723
|
+
{ type: i3.DaffAuthStorageService }
|
|
724
|
+
]
|
|
725
|
+
});
|
|
726
|
+
var DaffAuthResetPasswordEffects = class DaffAuthResetPasswordEffects {
|
|
727
|
+
constructor(actions$, driver, errorMatcher, storage) {
|
|
728
|
+
this.actions$ = actions$;
|
|
729
|
+
this.driver = driver;
|
|
730
|
+
this.errorMatcher = errorMatcher;
|
|
731
|
+
this.storage = storage;
|
|
732
|
+
this.sendResetEmail$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.SendResetEmailAction), switchMap((action) => this.driver.sendResetEmail(action.email).pipe(map(() => new DaffSendResetEmailSuccess()), catchError((error) => of(new DaffSendResetEmailFailure(this.errorMatcher(error))))))));
|
|
733
|
+
this.resetPassword$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.ResetPasswordAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.driver.resetPassword(action.info).pipe(tap((token) => this.storage.setAuthToken(token)), map((token) => new DaffResetPasswordSuccess(token)))), defer(() => this.driver.resetPasswordOnly(action.info).pipe(map(() => new DaffResetPasswordSuccess())))).pipe(catchError((error) => {
|
|
734
|
+
switch (true) {
|
|
735
|
+
case error instanceof DaffServerSideStorageError: return of(new DaffAuthServerSide(this.errorMatcher(error)), new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
736
|
+
case error instanceof DaffStorageServiceError: return of(new DaffAuthStorageFailure(this.errorMatcher(error)), new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
737
|
+
default: return of(new DaffResetPasswordFailure(this.errorMatcher(error)));
|
|
738
|
+
}
|
|
739
|
+
})))));
|
|
740
|
+
}
|
|
741
|
+
static {
|
|
742
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
743
|
+
minVersion: "12.0.0",
|
|
744
|
+
version: "22.2.4",
|
|
745
|
+
ngImport: i0,
|
|
746
|
+
type: DaffAuthResetPasswordEffects,
|
|
747
|
+
deps: [
|
|
748
|
+
{ token: i1.Actions },
|
|
749
|
+
{ token: DaffResetPasswordDriver },
|
|
750
|
+
{ token: DAFF_AUTH_ERROR_MATCHER },
|
|
751
|
+
{ token: i3.DaffAuthStorageService }
|
|
752
|
+
],
|
|
753
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
static {
|
|
757
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
758
|
+
minVersion: "12.0.0",
|
|
759
|
+
version: "22.2.4",
|
|
760
|
+
ngImport: i0,
|
|
761
|
+
type: DaffAuthResetPasswordEffects
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
766
|
+
minVersion: "12.0.0",
|
|
767
|
+
version: "22.2.4",
|
|
768
|
+
ngImport: i0,
|
|
769
|
+
type: DaffAuthResetPasswordEffects,
|
|
770
|
+
decorators: [{ type: Injectable }],
|
|
771
|
+
ctorParameters: () => [
|
|
772
|
+
{ type: i1.Actions },
|
|
773
|
+
{
|
|
774
|
+
type: void 0,
|
|
775
|
+
decorators: [{
|
|
776
|
+
type: Inject,
|
|
777
|
+
args: [DaffResetPasswordDriver]
|
|
778
|
+
}]
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
type: void 0,
|
|
782
|
+
decorators: [{
|
|
783
|
+
type: Inject,
|
|
784
|
+
args: [DAFF_AUTH_ERROR_MATCHER]
|
|
785
|
+
}]
|
|
786
|
+
},
|
|
787
|
+
{ type: i3.DaffAuthStorageService }
|
|
788
|
+
]
|
|
789
|
+
});
|
|
790
|
+
const { token: DAFF_AUTH_REDUCERS, provider: provideDaffAuthReducers, factoryProvider: provideDaffAuthReducersFactory } = createSingleInjectionToken("DAFF_AUTH_REDUCERS");
|
|
791
|
+
var DaffAuthStateModule = class DaffAuthStateModule {
|
|
792
|
+
static withConfig(config = {}) {
|
|
793
|
+
return {
|
|
794
|
+
ngModule: DaffAuthStateModule,
|
|
795
|
+
providers: [provideDaffAuthStateConfig({
|
|
796
|
+
...daffAuthStateDefaultConfig,
|
|
797
|
+
...config
|
|
798
|
+
})]
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
static {
|
|
802
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
803
|
+
minVersion: "12.0.0",
|
|
804
|
+
version: "22.2.4",
|
|
805
|
+
ngImport: i0,
|
|
806
|
+
type: DaffAuthStateModule,
|
|
807
|
+
deps: [],
|
|
808
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
static {
|
|
812
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
813
|
+
minVersion: "14.0.0",
|
|
814
|
+
version: "22.2.4",
|
|
815
|
+
ngImport: i0,
|
|
816
|
+
type: DaffAuthStateModule,
|
|
817
|
+
imports: [i1$1.StoreFeatureModule, i1.EffectsFeatureModule]
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
static {
|
|
821
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
822
|
+
minVersion: "12.0.0",
|
|
823
|
+
version: "22.2.4",
|
|
824
|
+
ngImport: i0,
|
|
825
|
+
type: DaffAuthStateModule,
|
|
826
|
+
providers: [{
|
|
827
|
+
provide: DAFF_AUTH_UNAUTHENTICATED_HOOKS,
|
|
828
|
+
useFactory: (() => {
|
|
829
|
+
const storage = inject(DaffAuthStorageService);
|
|
830
|
+
const hook = (() => {
|
|
831
|
+
try {
|
|
832
|
+
return of(storage.removeAuthToken());
|
|
833
|
+
} catch {
|
|
834
|
+
return of(null);
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
return hook;
|
|
838
|
+
}),
|
|
839
|
+
multi: true
|
|
840
|
+
}, provideDaffAuthReducersFactory((() => daffComposeReducers([combineReducers(daffAuthReducers), ...inject(DAFF_AUTH_EXTRA_REDUCERS)])))],
|
|
841
|
+
imports: [StoreModule.forFeature(DAFF_AUTH_STORE_FEATURE_KEY, DAFF_AUTH_REDUCERS), EffectsModule.forFeature([
|
|
842
|
+
DaffAuthEffects,
|
|
843
|
+
DaffAuthLoginEffects,
|
|
844
|
+
DaffAuthRegisterEffects,
|
|
845
|
+
DaffAuthResetPasswordEffects
|
|
846
|
+
])]
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
851
|
+
minVersion: "12.0.0",
|
|
852
|
+
version: "22.2.4",
|
|
853
|
+
ngImport: i0,
|
|
854
|
+
type: DaffAuthStateModule,
|
|
855
|
+
decorators: [{
|
|
856
|
+
type: NgModule,
|
|
857
|
+
args: [{
|
|
858
|
+
imports: [StoreModule.forFeature(DAFF_AUTH_STORE_FEATURE_KEY, DAFF_AUTH_REDUCERS), EffectsModule.forFeature([
|
|
859
|
+
DaffAuthEffects,
|
|
860
|
+
DaffAuthLoginEffects,
|
|
861
|
+
DaffAuthRegisterEffects,
|
|
862
|
+
DaffAuthResetPasswordEffects
|
|
863
|
+
])],
|
|
864
|
+
providers: [{
|
|
865
|
+
provide: DAFF_AUTH_UNAUTHENTICATED_HOOKS,
|
|
866
|
+
useFactory: (() => {
|
|
867
|
+
const storage = inject(DaffAuthStorageService);
|
|
868
|
+
const hook = (() => {
|
|
869
|
+
try {
|
|
870
|
+
return of(storage.removeAuthToken());
|
|
871
|
+
} catch {
|
|
872
|
+
return of(null);
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
return hook;
|
|
876
|
+
}),
|
|
877
|
+
multi: true
|
|
878
|
+
}, provideDaffAuthReducersFactory((() => daffComposeReducers([combineReducers(daffAuthReducers), ...inject(DAFF_AUTH_EXTRA_REDUCERS)])))]
|
|
879
|
+
}]
|
|
880
|
+
}]
|
|
881
|
+
});
|
|
882
|
+
const provideDaffAuthState = (config = {}) => makeEnvironmentProviders([
|
|
883
|
+
provideState(DAFF_AUTH_STORE_FEATURE_KEY, DAFF_AUTH_REDUCERS),
|
|
884
|
+
provideEffects(DaffAuthEffects, DaffAuthLoginEffects, DaffAuthRegisterEffects, DaffAuthResetPasswordEffects),
|
|
885
|
+
{
|
|
886
|
+
provide: DAFF_AUTH_UNAUTHENTICATED_HOOKS,
|
|
887
|
+
useFactory: () => {
|
|
888
|
+
const storage = inject(DaffAuthStorageService);
|
|
889
|
+
const hook = () => {
|
|
890
|
+
try {
|
|
891
|
+
return of(storage.removeAuthToken());
|
|
892
|
+
} catch {
|
|
893
|
+
return of(null);
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
return hook;
|
|
897
|
+
},
|
|
898
|
+
multi: true
|
|
899
|
+
},
|
|
900
|
+
provideDaffAuthReducersFactory(() => daffComposeReducers([combineReducers(daffAuthReducers), ...inject(DAFF_AUTH_EXTRA_REDUCERS)])),
|
|
901
|
+
provideDaffAuthStateConfig({
|
|
902
|
+
...daffAuthStateDefaultConfig,
|
|
903
|
+
...config
|
|
904
|
+
})
|
|
905
|
+
]);
|
|
906
|
+
export { DAFF_AUTH_ERROR_MATCHER, DAFF_AUTH_EXTRA_REDUCERS, DAFF_AUTH_STATE_CONFIG, DAFF_AUTH_STORE_FEATURE_KEY, DAFF_AUTH_UNAUTHENTICATED_HOOKS, DaffAuthActionTypes, DaffAuthCheck, DaffAuthCheckFailure, DaffAuthCheckSuccess, DaffAuthFacade, DaffAuthGuardLogout, DaffAuthLogin, DaffAuthLoginActionTypes, DaffAuthLoginFacade, DaffAuthLoginFailure, DaffAuthLoginSuccess, DaffAuthLogout, DaffAuthLogoutFailure, DaffAuthLogoutSuccess, DaffAuthRegister, DaffAuthRegisterActionTypes, DaffAuthRegisterFacade, DaffAuthRegisterFailure, DaffAuthRegisterSuccess, DaffAuthResetPasswordActionTypes, DaffAuthResetPasswordFacade, DaffAuthResetToUnauthenticated, DaffAuthServerSide, DaffAuthStateModule, DaffAuthStorageFailure, DaffResetPassword, DaffResetPasswordFailure, DaffResetPasswordLanding, DaffResetPasswordSuccess, DaffSendResetEmail, DaffSendResetEmailFailure, DaffSendResetEmailSuccess, daffAuthInitialState, daffAuthLoginInitialState, daffAuthLoginReducer, daffAuthLoginSelectorFactory, daffAuthProvideExtraReducers, daffAuthProvideUnauthenticatedHooks, daffAuthReducer, daffAuthReducers, daffAuthRegisterInitialState, daffAuthRegisterReducer, daffAuthRegisterSelectorFactory, daffAuthResetPasswordInitialState, daffAuthResetPasswordReducer, daffAuthResetPasswordSelectorFactory, daffAuthSelectorFactory, daffAuthStateDefaultConfig, getDaffAuthSelectors, provideDaffAuthErrorMatcher, provideDaffAuthState, provideDaffAuthStateConfig };
|
|
907
|
+
|
|
908
|
+
//# sourceMappingURL=daffodil-auth-state.mjs.map
|