1 | import { CommonModule } from '@angular/common';
|
2 | import { FlexLayoutModule } from '@angular/flex-layout';
|
3 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
4 | import { NgsFormModule } from '@soushians/form';
|
5 | import { HttpClient, HttpClientModule } from '@angular/common/http';
|
6 | import { Actions, Effect, EffectsModule } from '@ngrx/effects';
|
7 | import { getUser, SignInActionTypes } from '@soushians/authentication';
|
8 | import { __assign, __decorate, __metadata, __read, __extends } from 'tslib';
|
9 | import { Observable } from 'rxjs/Observable';
|
10 | import { MatSnackBar, MatExpansionModule, MatSnackBarModule, MatIconModule, MatButtonModule, MatCardModule, MatSelectModule, MatInputModule, MatFormFieldModule, MatTabsModule, MatRadioModule } from '@angular/material';
|
11 | import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
12 | import { stringTemplate, MatchValidator } from '@soushians/shared';
|
13 | import { of, BehaviorSubject as BehaviorSubject$1 } from 'rxjs';
|
14 | import { getUserModuleConfig, getAppConfig } from '@soushians/config';
|
15 | import { map, filter, take, switchMap, combineLatest, catchError, takeWhile } from 'rxjs/operators';
|
16 | import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
17 | import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
18 | import { InjectionToken, Injectable, Inject, Component, Input, Output, EventEmitter, NgModule, defineInjectable, inject } from '@angular/core';
|
19 | import { Store, createSelector, createFeatureSelector, StoreModule } from '@ngrx/store';
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | var UserModel = (function () {
|
26 | function UserModel() {
|
27 | this.Roles = [];
|
28 | this.Groups = [];
|
29 | }
|
30 | return UserModel;
|
31 | }());
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | var MODULE_DEFAULT_CONFIG = {
|
39 | server: "frontend_server",
|
40 | env: {
|
41 | production: false,
|
42 | frontend_server: "user/module/frontend/server/did/not/set",
|
43 | server: "user/module/server/did/not/set"
|
44 | },
|
45 | endpoints: {
|
46 |
|
47 | changePassword: "",
|
48 | editProfile: "",
|
49 | getAccountInfo: "",
|
50 | profileInformation: ""
|
51 | },
|
52 | forms: {
|
53 | profile_edit: ""
|
54 | },
|
55 | dashboardLinks: [],
|
56 | responseToUserInfo: function (user$) { return user$; },
|
57 | mapUserDisplayName: function (user$) { return user$.pipe(map(function (user) { return user.Username; })); }
|
58 | };
|
59 |
|
60 | var MODULE_CONFIG_TOKEN = new InjectionToken("UserModuleConfig");
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | var UserConfigurationService = (function () {
|
67 | function UserConfigurationService(configFile, store) {
|
68 | var _this = this;
|
69 | this.store = store;
|
70 | this.config$ = new BehaviorSubject(this._config);
|
71 | this._config = Object.assign({}, MODULE_DEFAULT_CONFIG, configFile);
|
72 | this.config$.next(this._config);
|
73 | this.store.select(getUserModuleConfig).subscribe(function (userConfig) {
|
74 | if (!userConfig)
|
75 | return;
|
76 | _this._config = Object.assign({}, _this._config, userConfig.Config);
|
77 | _this.config$.next(_this._config);
|
78 | });
|
79 | }
|
80 | Object.defineProperty(UserConfigurationService.prototype, "config", {
|
81 | get: /**
|
82 | * @return {?}
|
83 | */
|
84 | function () {
|
85 | return this._config;
|
86 | },
|
87 | enumerable: true,
|
88 | configurable: true
|
89 | });
|
90 | UserConfigurationService.decorators = [
|
91 | { type: Injectable, args: [{
|
92 | providedIn: "root"
|
93 | },] }
|
94 | ];
|
95 |
|
96 | UserConfigurationService.ctorParameters = function () { return [
|
97 | { type: undefined, decorators: [{ type: Inject, args: [MODULE_CONFIG_TOKEN,] }] },
|
98 | { type: Store }
|
99 | ]; };
|
100 | UserConfigurationService.ngInjectableDef = defineInjectable({ factory: function UserConfigurationService_Factory() { return new UserConfigurationService(inject(MODULE_CONFIG_TOKEN), inject(Store)); }, token: UserConfigurationService, providedIn: "root" });
|
101 | return UserConfigurationService;
|
102 | }());
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | var ProfileViewActionTypes = {
|
110 | GET_PROFILE: "[USER][PROFILE] GET_PROFILE",
|
111 | GET_PROFILE_START: "[USER][PROFILE] GET_PROFILE_START",
|
112 | GET_PROFILE_SUCCEED: "[USER][PROFILE] GET_PROFILE_SUCCEED",
|
113 | GET_PROFILE_FAILED: "[USER][PROFILE] GET_PROFILE_FAILED",
|
114 | };
|
115 | var GetProfile = (function () {
|
116 | function GetProfile() {
|
117 | this.type = ProfileViewActionTypes.GET_PROFILE;
|
118 | }
|
119 | return GetProfile;
|
120 | }());
|
121 | var GetProfileStart = (function () {
|
122 | function GetProfileStart() {
|
123 | this.type = ProfileViewActionTypes.GET_PROFILE_START;
|
124 | }
|
125 | return GetProfileStart;
|
126 | }());
|
127 | var GetProfileSucceed = (function () {
|
128 | function GetProfileSucceed(payload) {
|
129 | this.payload = payload;
|
130 | this.type = ProfileViewActionTypes.GET_PROFILE_SUCCEED;
|
131 | }
|
132 | return GetProfileSucceed;
|
133 | }());
|
134 | var GetProfileFailed = (function () {
|
135 | function GetProfileFailed() {
|
136 | this.type = ProfileViewActionTypes.GET_PROFILE_FAILED;
|
137 | }
|
138 | return GetProfileFailed;
|
139 | }());
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 | var UserActionTypes = {
|
147 | USER_SELECTED: "[USER] USER_SELECTED",
|
148 | REFRESH_USER_INFO: "[USER] REFRESH_USER_INFO",
|
149 | };
|
150 | var RefreshUserInfoAction = (function () {
|
151 | function RefreshUserInfoAction(payload) {
|
152 | this.payload = payload;
|
153 | this.type = UserActionTypes.REFRESH_USER_INFO;
|
154 | }
|
155 | return RefreshUserInfoAction;
|
156 | }());
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | var initialState = {
|
164 | loaded: false,
|
165 | data: new UserModel()
|
166 | };
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | function userReducer(state, action) {
|
173 | if (state === void 0) { state = initialState; }
|
174 | switch (action.type) {
|
175 | case UserActionTypes.USER_SELECTED: {
|
176 | return __assign({}, state, { loaded: true, data: action.payload });
|
177 | }
|
178 | case UserActionTypes.REFRESH_USER_INFO: {
|
179 | return __assign({}, state, { loaded: true, data: action.payload });
|
180 | }
|
181 | default: {
|
182 | return state;
|
183 | }
|
184 | }
|
185 | }
|
186 |
|
187 | var getAccountInfo = function (state) { return state.data; };
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 | var ProfileViewModel;
|
194 | (function (ProfileViewModel) {
|
195 | var Request = (function () {
|
196 | function Request(initValue) {
|
197 | var _this = this;
|
198 | Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
|
199 | }
|
200 | |
201 |
|
202 |
|
203 | Request.prototype.getRequestBody = |
204 |
|
205 |
|
206 | function () {
|
207 | return {};
|
208 | };
|
209 | Object.defineProperty(Request, "formGroup", {
|
210 | get: /**
|
211 | * @return {?}
|
212 | */
|
213 | function () {
|
214 | return new FormGroup({
|
215 | Username: new FormControl("", [Validators.minLength(8), Validators.required])
|
216 | });
|
217 | },
|
218 | enumerable: true,
|
219 | configurable: true
|
220 | });
|
221 | return Request;
|
222 | }());
|
223 | ProfileViewModel.Request = Request;
|
224 | var Response = (function (_super) {
|
225 | __extends(Response, _super);
|
226 | function Response() {
|
227 | return _super.call(this) || this;
|
228 | }
|
229 | return Response;
|
230 | }(UserModel));
|
231 | ProfileViewModel.Response = Response;
|
232 | })(ProfileViewModel || (ProfileViewModel = {}));
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | var EditProfile_ApiModel;
|
239 | (function (EditProfile_ApiModel) {
|
240 | var Request = (function () {
|
241 | function Request(initValue) {
|
242 | if (initValue === void 0) { initValue = ({}); }
|
243 | var _this = this;
|
244 | Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
|
245 | }
|
246 | |
247 |
|
248 |
|
249 | Request.prototype.getRequestBody = |
250 |
|
251 |
|
252 | function () {
|
253 | return this;
|
254 | };
|
255 | Object.defineProperty(Request, "formGroup", {
|
256 | get: /**
|
257 | * @return {?}
|
258 | */
|
259 | function () {
|
260 | return new FormGroup({
|
261 | Email: new FormControl(null, [Validators.required]),
|
262 | Roles: new FormControl(null, [Validators.required]),
|
263 | Groups: new FormControl(null, [Validators.required])
|
264 | });
|
265 | },
|
266 | enumerable: true,
|
267 | configurable: true
|
268 | });
|
269 | return Request;
|
270 | }());
|
271 | EditProfile_ApiModel.Request = Request;
|
272 | var Response = (function () {
|
273 | function Response(initValue) {
|
274 | if (initValue === void 0) { initValue = ({}); }
|
275 | var _this = this;
|
276 | Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
|
277 | }
|
278 | |
279 |
|
280 |
|
281 | Response.prototype.extractData = |
282 |
|
283 |
|
284 | function () {
|
285 | return this.Result.User;
|
286 | };
|
287 | return Response;
|
288 | }());
|
289 | EditProfile_ApiModel.Response = Response;
|
290 | })(EditProfile_ApiModel || (EditProfile_ApiModel = {}));
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 | var UserService = (function () {
|
297 | function UserService(http, store, configurationService) {
|
298 | var _this = this;
|
299 | this.http = http;
|
300 | this.store = store;
|
301 | this.configurationService = configurationService;
|
302 | this.configurationService.config$.subscribe(function (config) { return (_this.config = config); });
|
303 | setTimeout(function () {
|
304 | _this.store.dispatch(new GetProfile());
|
305 | }, 999);
|
306 | }
|
307 | |
308 |
|
309 |
|
310 | UserService.prototype.getAccountInfo = |
311 |
|
312 |
|
313 | function () {
|
314 | var _this = this;
|
315 | return this.configurationService.config$.pipe(filter(function (config) { return config.endpoints.profileInformation != ""; }), take(1), combineLatest(this.store.select(getUser)), filter(function (_a) {
|
316 | var _b = __read(_a, 2), config = _b[0], user = _b[1];
|
317 | return user != undefined;
|
318 | }), switchMap(function (_a) {
|
319 | var _b = __read(_a, 2), config = _b[0], user = _b[1];
|
320 | return _this.http
|
321 | .get(stringTemplate(config.env[config.server] + config.endpoints.profileInformation, {
|
322 | user: user || {}
|
323 | }))
|
324 | .let(config.responseToUserInfo)
|
325 | .pipe(map(function (response) {
|
326 |
|
327 | var _user = Object.assign({}, response);
|
328 | if (_user.Role) {
|
329 | _user.Roles = [_user.Role];
|
330 | }
|
331 | return _user;
|
332 | }), catchError(function (err) { return of(false); }));
|
333 | }));
|
334 | };
|
335 | |
336 |
|
337 |
|
338 |
|
339 | UserService.prototype.editProfile = |
340 |
|
341 |
|
342 |
|
343 | function (data) {
|
344 |
|
345 | var model = new EditProfile_ApiModel.Request(data);
|
346 | return this.http
|
347 | .put(stringTemplate(this.config.env[this.config.server] + this.config.endpoints.editProfile, model), model.getRequestBody())
|
348 | .pipe(map(function (response) { return new EditProfile_ApiModel.Response(response).extractData(); }));
|
349 | };
|
350 |
|
351 | |
352 |
|
353 |
|
354 |
|
355 | UserService.prototype.getInfo = |
356 |
|
357 |
|
358 |
|
359 | function (data) {
|
360 |
|
361 | var model = new ProfileViewModel.Request(data);
|
362 | return this.http
|
363 | .get(stringTemplate(this.config.env[this.config.server] + this.config.endpoints.getAccountInfo, model))
|
364 | .pipe(map(function (response) { return response; }));
|
365 | };
|
366 | |
367 |
|
368 |
|
369 |
|
370 | UserService.prototype.is_role = |
371 |
|
372 |
|
373 |
|
374 | function (role) {
|
375 | return this.store
|
376 | .select(getAccountInfo)
|
377 | .pipe(filter(function (user) { return user && user.Roles != undefined; }), take(1), map(function (user) { return user.Roles.indexOf(role) > -1; }));
|
378 | };
|
379 | UserService.decorators = [
|
380 | { type: Injectable, args: [{
|
381 | providedIn: "root"
|
382 | },] }
|
383 | ];
|
384 |
|
385 | UserService.ctorParameters = function () { return [
|
386 | { type: HttpClient },
|
387 | { type: Store },
|
388 | { type: UserConfigurationService }
|
389 | ]; };
|
390 | UserService.ngInjectableDef = defineInjectable({ factory: function UserService_Factory() { return new UserService(inject(HttpClient), inject(Store), inject(UserConfigurationService)); }, token: UserService, providedIn: "root" });
|
391 | return UserService;
|
392 | }());
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | var EditProfileActionTypes = {
|
400 | EDIT_PROFILE: "[USER][PASSWORD] EDIT_PROFILE",
|
401 | EDIT_PROFILE_START: "[USER][PASSWORD] EDIT_PROFILE_START",
|
402 | EDIT_PROFILE_SUCCEED: "[USER][PASSWORD] EDIT_PROFILE_SUCCEED",
|
403 | EDIT_PROFILE_FAILED: "[USER][PASSWORD] EDIT_PROFILE_FAILED",
|
404 | };
|
405 | var EditProfile = (function () {
|
406 | function EditProfile(payload) {
|
407 | this.payload = payload;
|
408 | this.type = EditProfileActionTypes.EDIT_PROFILE;
|
409 | }
|
410 | return EditProfile;
|
411 | }());
|
412 | var EditProfileStart = (function () {
|
413 | function EditProfileStart(payload) {
|
414 | this.payload = payload;
|
415 | this.type = EditProfileActionTypes.EDIT_PROFILE_START;
|
416 | }
|
417 | return EditProfileStart;
|
418 | }());
|
419 | var EditProfileSucceed = (function () {
|
420 | function EditProfileSucceed(payload) {
|
421 | this.payload = payload;
|
422 | this.type = EditProfileActionTypes.EDIT_PROFILE_SUCCEED;
|
423 | }
|
424 | return EditProfileSucceed;
|
425 | }());
|
426 | var EditProfileFailed = (function () {
|
427 | function EditProfileFailed() {
|
428 | this.type = EditProfileActionTypes.EDIT_PROFILE_FAILED;
|
429 | }
|
430 | return EditProfileFailed;
|
431 | }());
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 | var EditProfileEffects = (function () {
|
438 | function EditProfileEffects(actions$, router, service) {
|
439 | var _this = this;
|
440 | this.actions$ = actions$;
|
441 | this.router = router;
|
442 | this.service = service;
|
443 | this.EditProfileRequest$ = this.actions$
|
444 | .ofType(EditProfileActionTypes.EDIT_PROFILE)
|
445 | .pipe(map(function (action) { return action.payload; }), map(function (data) { return new EditProfileStart(data); }));
|
446 | this.RequestEditProfileLink$ = this.actions$
|
447 | .ofType(EditProfileActionTypes.EDIT_PROFILE_START)
|
448 | .pipe(map(function (action) { return action.payload; }), switchMap(function (data) { return _this.service.editProfile(data); }), map(function (res) { return new EditProfileSucceed(res); }), catchError(function () { return of(new EditProfileFailed()); }));
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 | this.goToView$ = this.actions$.ofType(EditProfileActionTypes.EDIT_PROFILE_SUCCEED).pipe(map(function () {
|
456 | _this.router.navigate(["/user/profile"]);
|
457 | return new GetProfile();
|
458 | }));
|
459 | }
|
460 | EditProfileEffects.decorators = [
|
461 | { type: Injectable }
|
462 | ];
|
463 |
|
464 | EditProfileEffects.ctorParameters = function () { return [
|
465 | { type: Actions },
|
466 | { type: Router },
|
467 | { type: UserService }
|
468 | ]; };
|
469 | __decorate([
|
470 | Effect(),
|
471 | __metadata("design:type", Object)
|
472 | ], EditProfileEffects.prototype, "EditProfileRequest$", void 0);
|
473 | __decorate([
|
474 | Effect(),
|
475 | __metadata("design:type", Object)
|
476 | ], EditProfileEffects.prototype, "RequestEditProfileLink$", void 0);
|
477 | __decorate([
|
478 | Effect(),
|
479 | __metadata("design:type", Object)
|
480 | ], EditProfileEffects.prototype, "goToView$", void 0);
|
481 | return EditProfileEffects;
|
482 | }());
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 | var ProfileViewEffects = (function () {
|
489 | function ProfileViewEffects(actions$, userService) {
|
490 | var _this = this;
|
491 | this.actions$ = actions$;
|
492 | this.userService = userService;
|
493 | this.ProfileRequest$ = this.actions$
|
494 | .ofType(ProfileViewActionTypes.GET_PROFILE)
|
495 | .pipe(map(function (action) { return action.payload; }), map(function (data) { return new GetProfileStart(); }));
|
496 | this.getProfile$ = this.actions$
|
497 | .ofType(ProfileViewActionTypes.GET_PROFILE_START)
|
498 | .pipe(map(function (action) { return action.payload; }), switchMap(function (data) {
|
499 | return _this.userService
|
500 | .getAccountInfo()
|
501 | .pipe(map(function (res) { return new GetProfileSucceed(res); }), catchError(function () { return of(new GetProfileFailed()); }));
|
502 | }));
|
503 | this.refreshUserInfo$ = this.actions$
|
504 | .ofType(ProfileViewActionTypes.GET_PROFILE_SUCCEED)
|
505 | .pipe(map(function (action) { return action.payload; }), map(function (data) { return new RefreshUserInfoAction(data); }));
|
506 | }
|
507 | ProfileViewEffects.decorators = [
|
508 | { type: Injectable }
|
509 | ];
|
510 |
|
511 | ProfileViewEffects.ctorParameters = function () { return [
|
512 | { type: Actions },
|
513 | { type: UserService }
|
514 | ]; };
|
515 | __decorate([
|
516 | Effect(),
|
517 | __metadata("design:type", Object)
|
518 | ], ProfileViewEffects.prototype, "ProfileRequest$", void 0);
|
519 | __decorate([
|
520 | Effect(),
|
521 | __metadata("design:type", Object)
|
522 | ], ProfileViewEffects.prototype, "getProfile$", void 0);
|
523 | __decorate([
|
524 | Effect(),
|
525 | __metadata("design:type", Object)
|
526 | ], ProfileViewEffects.prototype, "refreshUserInfo$", void 0);
|
527 | return ProfileViewEffects;
|
528 | }());
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 | var UserEffects = (function () {
|
535 | function UserEffects(actions$, router, service) {
|
536 | this.actions$ = actions$;
|
537 | this.router = router;
|
538 | this.service = service;
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | this.getAccountInfo$ = this.actions$.ofType(SignInActionTypes.SIGNIN_SUCCEED).pipe(map(function () {
|
547 | return new GetProfile();
|
548 | }));
|
549 | this.signout$ = this.actions$
|
550 | .ofType(SignInActionTypes.SIGNOUT)
|
551 | .pipe(map(function () { return new RefreshUserInfoAction( ({})); }));
|
552 | }
|
553 | UserEffects.decorators = [
|
554 | { type: Injectable }
|
555 | ];
|
556 |
|
557 | UserEffects.ctorParameters = function () { return [
|
558 | { type: Actions },
|
559 | { type: Router },
|
560 | { type: UserService }
|
561 | ]; };
|
562 | __decorate([
|
563 | Effect(),
|
564 | __metadata("design:type", Object)
|
565 | ], UserEffects.prototype, "getAccountInfo$", void 0);
|
566 | __decorate([
|
567 | Effect(),
|
568 | __metadata("design:type", Object)
|
569 | ], UserEffects.prototype, "signout$", void 0);
|
570 | return UserEffects;
|
571 | }());
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 | var ResetPasswordRequestActionTypes = {
|
579 | GET_RESET_PASSWORD_LINK: "[USER][PASSWORD] GET_RESET_PASSWORD_LINK",
|
580 | RESET_PASSWORD_LINK_REQUEST_START: "[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_START",
|
581 | RESET_PASSWORD_LINK_REQUEST_SUCCEED: "[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_SUCCEED",
|
582 | RESET_PASSWORD_LINK_REQUEST_FAILED: "[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_FAILED",
|
583 | DISABLE_GET_LINK: "[USER][PASSWORD] DISABLE_GET_LINK",
|
584 | ENABLE_GET_LINK: "[USER][PASSWORD] ENABLE_GET_LINK",
|
585 | MAXIMUM_TRY_HAPPEND: "[USER][PASSWORD] MAXIMUM_TRY_HAPPEND",
|
586 | PASSWORD_CHANGED_SUCCEED: "[USER][PASSWORD] PASSWORD_CHANGED_SUCCEED",
|
587 | PASSWORD_CHANGED_FAILED: "[USER][PASSWORD] PASSWORD_CHANGED_FAILED",
|
588 | };
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 | var initialState$1 = {
|
596 | numberOfRequested: 0,
|
597 | lastRequestedTime: null,
|
598 | disable: false
|
599 | };
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 | function reducer(state, action) {
|
606 | if (state === void 0) { state = initialState$1; }
|
607 | switch (action.type) {
|
608 | case ResetPasswordRequestActionTypes.GET_RESET_PASSWORD_LINK: {
|
609 | return __assign({}, state);
|
610 | }
|
611 | case ResetPasswordRequestActionTypes.RESET_PASSWORD_LINK_REQUEST_START: {
|
612 | return __assign({}, state, { numberOfRequested: state.numberOfRequested + 1, lastRequestedTime: Date.now().toString() });
|
613 | }
|
614 | case ResetPasswordRequestActionTypes.RESET_PASSWORD_LINK_REQUEST_SUCCEED: {
|
615 | return __assign({}, state);
|
616 | }
|
617 | case ResetPasswordRequestActionTypes.DISABLE_GET_LINK: {
|
618 | return __assign({}, state, { disable: true });
|
619 | }
|
620 | case ResetPasswordRequestActionTypes.ENABLE_GET_LINK: {
|
621 | return __assign({}, state, { disable: false });
|
622 | }
|
623 | default: {
|
624 | return state;
|
625 | }
|
626 | }
|
627 | }
|
628 |
|
629 | var getNumberOfRequeseted = function (state) { return state.numberOfRequested; };
|
630 |
|
631 | var getStatus = function (state) { return state.disable; };
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 | var ChangePasswordActionTypes = {
|
639 | CHANGE_PASSWORD: "[USER][PASSWORD] CHANGE_PASSWORD",
|
640 | PASSWORD_CHANGED_START: "[USER][PASSWORD] PASSWORD_CHANGED_START",
|
641 | PASSWORD_CHANGED_SUCCEED: "[USER][PASSWORD] PASSWORD_CHANGED_SUCCEED",
|
642 | PASSWORD_CHANGED_FAILED: "[USER][PASSWORD] PASSWORD_CHANGED_FAILED",
|
643 | };
|
644 | var ChangePassword = (function () {
|
645 | function ChangePassword(payload) {
|
646 | this.payload = payload;
|
647 | this.type = ChangePasswordActionTypes.CHANGE_PASSWORD;
|
648 | }
|
649 | return ChangePassword;
|
650 | }());
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 | var initialState$2 = {
|
658 | status: "pristine"
|
659 | };
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 | function reducer$1(state, action) {
|
666 | if (state === void 0) { state = initialState$2; }
|
667 | switch (action.type) {
|
668 | case ChangePasswordActionTypes.CHANGE_PASSWORD: {
|
669 | return {
|
670 | status: "dirty"
|
671 | };
|
672 | }
|
673 | case ChangePasswordActionTypes.PASSWORD_CHANGED_START: {
|
674 | return {
|
675 | status: "pending"
|
676 | };
|
677 | }
|
678 | case ChangePasswordActionTypes.PASSWORD_CHANGED_SUCCEED: {
|
679 | return {
|
680 | status: "succeed"
|
681 | };
|
682 | }
|
683 | case ChangePasswordActionTypes.PASSWORD_CHANGED_FAILED: {
|
684 | return {
|
685 | status: "failed"
|
686 | };
|
687 | }
|
688 | default: {
|
689 | return initialState$2;
|
690 | }
|
691 | }
|
692 | }
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 | var initialState$3 = {
|
700 | status: "pristine"
|
701 | };
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 | function reducer$2(state, action) {
|
708 | if (state === void 0) { state = initialState$3; }
|
709 | switch (action.type) {
|
710 | case EditProfileActionTypes.EDIT_PROFILE: {
|
711 | return {
|
712 | status: "dirty"
|
713 | };
|
714 | }
|
715 | case EditProfileActionTypes.EDIT_PROFILE_START: {
|
716 | return {
|
717 | status: "pending"
|
718 | };
|
719 | }
|
720 | case EditProfileActionTypes.EDIT_PROFILE_SUCCEED: {
|
721 | return {
|
722 | status: "succeed"
|
723 | };
|
724 | }
|
725 | case EditProfileActionTypes.EDIT_PROFILE_FAILED: {
|
726 | return {
|
727 | status: "failed"
|
728 | };
|
729 | }
|
730 | default: {
|
731 | return state;
|
732 | }
|
733 | }
|
734 | }
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 | var SearchActionTypes = {
|
742 | SEARCH: "[USER][SEARCH] SEARCH",
|
743 | SEARCH_START: "[USER][SEARCH] SEARCH_START",
|
744 | SEARCH_SUCCEED: "[USER][SEARCH] SEARCH_SUCCEED",
|
745 | SEARCH_FAILED: "[USER][SEARCH] SEARCH_FAILED",
|
746 | CLEAR_SEARCHED_USER: "[USER][SEARCH] CLEAR_SEARCHED_USER",
|
747 | };
|
748 | var Search = (function () {
|
749 | function Search(payload) {
|
750 | this.payload = payload;
|
751 | this.type = SearchActionTypes.SEARCH;
|
752 | }
|
753 | return Search;
|
754 | }());
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 | var initialState$4 = {
|
762 | status: "pristine",
|
763 | data: ({})
|
764 | };
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 | function reducer$3(state, action) {
|
771 | if (state === void 0) { state = initialState$4; }
|
772 | switch (action.type) {
|
773 | case SearchActionTypes.SEARCH: {
|
774 | return __assign({}, state, { status: "dirty", data: new ProfileViewModel.Response() });
|
775 | }
|
776 | case SearchActionTypes.SEARCH_START: {
|
777 | return __assign({}, state, { status: "pending" });
|
778 | }
|
779 | case SearchActionTypes.SEARCH_SUCCEED: {
|
780 | return __assign({}, state, { status: "succeed", data: action.payload });
|
781 | }
|
782 | case SearchActionTypes.SEARCH_FAILED: {
|
783 | return __assign({}, state, { status: "failed" });
|
784 | }
|
785 | case SearchActionTypes.CLEAR_SEARCHED_USER: {
|
786 | return initialState$4;
|
787 | }
|
788 | default: {
|
789 | return state;
|
790 | }
|
791 | }
|
792 | }
|
793 |
|
794 | var getStatus$3 = function (state) { return state.status; };
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 | var UserReducers = {
|
802 | user: userReducer,
|
803 | resetPasswordRequest: reducer,
|
804 | changePassword: reducer$1,
|
805 | searchView: reducer$3,
|
806 | editProfile: reducer$2
|
807 | };
|
808 |
|
809 | var selectFeatureState = createFeatureSelector("user");
|
810 |
|
811 | var getUserInforamtionStatus = createSelector(selectFeatureState, function (state) { return state.user.loaded; });
|
812 |
|
813 | var isSignedIn = createSelector(selectFeatureState, function (state) { return state.user.loaded; });
|
814 |
|
815 | var selectResetPasswordRequestState = createSelector(selectFeatureState, function (state) { return state.resetPasswordRequest; });
|
816 |
|
817 | var getNumberOfRequeseted$1 = createSelector(selectResetPasswordRequestState, getNumberOfRequeseted);
|
818 |
|
819 | var getResetPasswordRequestStatus = createSelector(selectResetPasswordRequestState, getStatus);
|
820 |
|
821 | var selectUserInformaionState = createSelector(selectFeatureState, function (state) { return state.user; });
|
822 |
|
823 | var getAccountInfo$2 = createSelector(selectUserInformaionState, getAccountInfo);
|
824 |
|
825 | var selectSearchState = createSelector(selectFeatureState, function (state) { return state.searchView; });
|
826 |
|
827 | var getSearchStatus = createSelector(selectSearchState, getStatus$3);
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 | var SearchComponent = (function () {
|
835 | function SearchComponent(store) {
|
836 | this.store = store;
|
837 | this.formGroup = ProfileViewModel.Request.formGroup;
|
838 | this.userDataLoaded$ = new BehaviorSubject$1(false);
|
839 | this.userNotFound$ = new BehaviorSubject$1(false);
|
840 | this.user = this.store.select(getAccountInfo$2);
|
841 | this.userStatus$ = this.store.select(getSearchStatus);
|
842 | }
|
843 | |
844 |
|
845 |
|
846 | SearchComponent.prototype.ngOnInit = |
847 |
|
848 |
|
849 | function () {
|
850 | var _this = this;
|
851 | this.userStatus$.subscribe(function (value) { return _this.userDataLoaded$.next(!"pristine|dirty|pending".includes(value)); });
|
852 | };
|
853 | |
854 |
|
855 |
|
856 | SearchComponent.prototype.search = |
857 |
|
858 |
|
859 | function () {
|
860 | if (!this.formGroup.valid)
|
861 | return;
|
862 | this.store.dispatch(new Search(this.formGroup.value));
|
863 | };
|
864 | SearchComponent.decorators = [
|
865 | { type: Component, args: [{
|
866 | selector: "search",
|
867 | template: "<mat-card fxFlex=\"450px\" *ngIf=\"(userStatus$ | async) == 'succeed'\">\r\n <mat-card-header>\r\n <mat-card-title>\r\n <div fxLayout=\"row\" fxLayoutAlign=\"space-between\">\r\n <div fxFlex=\"nogrow\">\r\n <!-- {{(user | async).LastName }}\u060C {{(user | async).FirstName }} -->\r\n </div>\r\n <div fxFlex=\"nogrow\">\r\n <!-- {{(user | async).Email}} -->\r\n </div>\r\n </div>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div>\r\n <div class='list-item' fxFlexLayout='row' fxLayoutAlign='center center'>\r\n <mat-icon fxFlex='nogrow'>local_grocery_store</mat-icon>\r\n <div fxFlex='15px'></div>\r\n <p fxFlex='40'>\u0634\u0646\u0627\u0633\u0647</p>\r\n <!-- <p fxFlex='60' fxLayoutAlign=\"end\">{{(user | async)._id }}</p> -->\r\n </div>\r\n <div class='list-item' fxFlexLayout='row' fxLayoutAlign='center center'>\r\n <mat-icon fxFlex='nogrow'>email</mat-icon>\r\n <div fxFlex='15px'></div>\r\n <p fxFlex='40'>\u067E\u0633\u062A \u0627\u0644\u06A9\u062A\u0631\u0648\u0646\u06CC\u06A9\u06CC</p>\r\n <!-- <p fxFlex='60' fxLayoutAlign=\"end\">{{(user | async).Email }}</p> -->\r\n </div>\r\n </div>\r\n\r\n </mat-card-content>\r\n</mat-card>",
|
868 | styles: [""]
|
869 | }] }
|
870 | ];
|
871 |
|
872 | SearchComponent.ctorParameters = function () { return [
|
873 | { type: Store }
|
874 | ]; };
|
875 | return SearchComponent;
|
876 | }());
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 | var ChangePasswordComponent = (function () {
|
883 | function ChangePasswordComponent() {
|
884 | this.submited = new EventEmitter();
|
885 | }
|
886 | |
887 |
|
888 |
|
889 | ChangePasswordComponent.prototype.ngOnInit = |
890 |
|
891 |
|
892 | function () { };
|
893 | |
894 |
|
895 |
|
896 | ChangePasswordComponent.prototype.submit = |
897 |
|
898 |
|
899 | function () { };
|
900 | |
901 |
|
902 |
|
903 | ChangePasswordComponent.prototype.changePassword = |
904 |
|
905 |
|
906 | function () {
|
907 | if (!this.formGroup.valid)
|
908 | return;
|
909 | this.submited.emit(this.formGroup.value);
|
910 | };
|
911 | ChangePasswordComponent.decorators = [
|
912 | { type: Component, args: [{
|
913 | selector: "user-change-password",
|
914 | template: "<div fxFlex=\"450px\">\r\n <form [formGroup]=\"formGroup\" (ngSubmit)=\"changePassword()\" fxLayout=\"column\">\r\n <mat-card>\r\n <mat-card-content>\r\n <mat-form-field fxFlexFill>\r\n <input type=\"password\" matInput placeholder=\"\u06A9\u0644\u0645\u0647 \u0639\u0628\u0648\u0631\" formControlName=\"Password\">\r\n </mat-form-field>\r\n <mat-form-field fxFlexFill>\r\n <input type=\"password\" matInput placeholder=\"\u062A\u06A9\u0631\u0627\u0631 \u06A9\u0644\u0645\u0647 \u0639\u0628\u0648\u0631\" formControlName=\"Confirm\">\r\n </mat-form-field>\r\n </mat-card-content>\r\n <mat-card-actions fxLayoutAlign=\"center center\">\r\n <button fxFlex=\"nogrow\" type=\"submit\" mat-raised-button color=\"primary\">\u062A\u063A\u06CC\u06CC\u0631 \u0631\u0645\u0632 \u0639\u0628\u0648\u0631</button>\r\n <button fxFlex=\"nogrow\" type=\"button\" routerLink=\"/user/panel\" mat-raised-button>\u0628\u0627\u0632\u06AF\u0634\u062A</button>\r\n </mat-card-actions>\r\n </mat-card>\r\n </form>\r\n</div>",
|
915 | styles: [""]
|
916 | }] }
|
917 | ];
|
918 |
|
919 | ChangePasswordComponent.ctorParameters = function () { return []; };
|
920 | ChangePasswordComponent.propDecorators = {
|
921 | formGroup: [{ type: Input }],
|
922 | submited: [{ type: Output }]
|
923 | };
|
924 | return ChangePasswordComponent;
|
925 | }());
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 | var ProfileEditComponent = (function () {
|
932 | function ProfileEditComponent(router) {
|
933 | this.router = router;
|
934 | this.submited = new EventEmitter();
|
935 | }
|
936 | |
937 |
|
938 |
|
939 | ProfileEditComponent.prototype.ngOnInit = |
940 |
|
941 |
|
942 | function () { };
|
943 | |
944 |
|
945 |
|
946 |
|
947 | ProfileEditComponent.prototype.editProfile = |
948 |
|
949 |
|
950 |
|
951 | function (form) {
|
952 | if (!form.valid)
|
953 | return;
|
954 | this.submited.emit(form.value);
|
955 | };
|
956 | |
957 |
|
958 |
|
959 | ProfileEditComponent.prototype.goback = |
960 |
|
961 |
|
962 | function () {
|
963 | this.router.navigate([".."]);
|
964 | };
|
965 | ProfileEditComponent.decorators = [
|
966 | { type: Component, args: [{
|
967 | selector: "profile-edit",
|
968 | template: "<div fxFlex=\"450px\">\r\n\r\n \r\n <ngs-form-view #form [id]=\"formId\" [card]=\"true\" (accept)=\"editProfile(form.formGroup)\" (cancel)=\"goback()\" ></ngs-form-view>\r\n <!-- <form [formGroup]=\"formGroup\" (ngSubmit)=\"editProfile()\" fxLayout=\"column\">\r\n <mat-card>\r\n <mat-card-content>\r\n </mat-card-content>\r\n <mat-card-actions align=\"end\">\r\n <button type=\"button\" routerLink=\"..\" mat-button color=\"primary\">\u0628\u0627\u0632\u06AF\u0634\u062A</button>\r\n <button type=\"submit\" mat-raised-button color=\"primary\">\u0648\u06CC\u0631\u0627\u06CC\u0634</button>\r\n </mat-card-actions>\r\n </mat-card>\r\n </form> -->\r\n</div>"
|
969 | }] }
|
970 | ];
|
971 |
|
972 | ProfileEditComponent.ctorParameters = function () { return [
|
973 | { type: Router }
|
974 | ]; };
|
975 | ProfileEditComponent.propDecorators = {
|
976 | submited: [{ type: Output }],
|
977 | userInfo: [{ type: Input }],
|
978 | formId: [{ type: Input }],
|
979 | roles$: [{ type: Input, args: ["roles",] }],
|
980 | groups: [{ type: Input }]
|
981 | };
|
982 | return ProfileEditComponent;
|
983 | }());
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 | var DashboardLinksComponent = (function () {
|
990 | function DashboardLinksComponent(userConfigurationService, store) {
|
991 | this.userConfigurationService = userConfigurationService;
|
992 | this.store = store;
|
993 | this.links$ = this.userConfigurationService.config$.pipe(map(function (data) { return data.dashboardLinks; }));
|
994 | this.links = [
|
995 | {
|
996 | title: "مشاهده حساب کاربری",
|
997 | route: "/user/panel/profile",
|
998 |
|
999 | icon: "person"
|
1000 | }
|
1001 | ];
|
1002 | }
|
1003 | |
1004 |
|
1005 |
|
1006 | DashboardLinksComponent.prototype.ngAfterViewInit = |
1007 |
|
1008 |
|
1009 | function () { };
|
1010 | DashboardLinksComponent.decorators = [
|
1011 | { type: Component, args: [{
|
1012 | selector: "user-dashboard-links",
|
1013 | template: "<div fxLayout='row' fxLayoutWrap id=\"con\">\r\n <button fxFlex=\"31\" class='link' mat-raised-button [routerLink]='link.route' *ngFor='let link of links'>\r\n <div fxLayout='column' fxLayoutAlign='center center'>\r\n <mat-icon color='primary'>{{link.icon}}</mat-icon>\r\n <h3 class='title'>{{link.title}}</h3>\r\n <div class='description'>{{link.description}}</div>\r\n </div>\r\n </button>\r\n <button fxFlex=\"31\" class='link' mat-raised-button [routerLink]='link.route' *ngFor='let link of links$ | async'>\r\n <div fxLayout='column' fxLayoutAlign='center center'>\r\n <mat-icon color='primary'>{{link.icon}}</mat-icon>\r\n <h3 class='title'>{{link.title}}</h3>\r\n <div class='description'>{{link.description}}</div>\r\n </div>\r\n </button>\r\n</div>",
|
1014 | styles: ["#con [fxflex]{margin-right:25px}:host{width:100%;padding:25px 25px 0}button mat-icon{font-size:48px;width:48px;height:48px}button.link{padding:25px 15px;margin-bottom:25px}.title{margin-top:0;margin-bottom:5px}.description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:90%}"]
|
1015 | }] }
|
1016 | ];
|
1017 |
|
1018 | DashboardLinksComponent.ctorParameters = function () { return [
|
1019 | { type: UserConfigurationService },
|
1020 | { type: Store }
|
1021 | ]; };
|
1022 | return DashboardLinksComponent;
|
1023 | }());
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 | var ResetPasswordRequestComponent = (function () {
|
1030 | function ResetPasswordRequestComponent(snackBar) {
|
1031 | this.snackBar = snackBar;
|
1032 | this.submitted = new EventEmitter();
|
1033 | this.maximumResendingHappend$ = new BehaviorSubject(false);
|
1034 | this.timer$ = Observable.timer(0, 100).pipe(map(function (i) { return i + 1; }), takeWhile(function (i) { return i * 100 <= 3000; }), map(function (i) { return 3000 - i * 100; }));
|
1035 | }
|
1036 | Object.defineProperty(ResetPasswordRequestComponent.prototype, "pending", {
|
1037 | set: /**
|
1038 | * @param {?} isPending
|
1039 | * @return {?}
|
1040 | */
|
1041 | function (isPending) {
|
1042 | if (isPending) {
|
1043 | this.formGroup.disable();
|
1044 | }
|
1045 | this.formGroup.enable();
|
1046 | },
|
1047 | enumerable: true,
|
1048 | configurable: true
|
1049 | });
|
1050 | |
1051 |
|
1052 |
|
1053 | ResetPasswordRequestComponent.prototype.ngOnInit = |
1054 |
|
1055 |
|
1056 | function () {
|
1057 | var _this = this;
|
1058 | this.numberOfRequested.subscribe(function (data) {
|
1059 | if (data > 2) {
|
1060 | _this.maximumResendingHappend$.next(true);
|
1061 | }
|
1062 | });
|
1063 | };
|
1064 | |
1065 |
|
1066 |
|
1067 | ResetPasswordRequestComponent.prototype.submit = |
1068 |
|
1069 |
|
1070 | function () {
|
1071 | if (this.formGroup.valid) {
|
1072 | this.submitted.emit(this.formGroup.value);
|
1073 |
|
1074 | var message = this.maximumResendingHappend$.getValue()
|
1075 | ? "عدم امکان ..."
|
1076 | : "پیامک جدید برای شما ارسال گردید.";
|
1077 | this.snackBar.open(message, "", {
|
1078 | duration: 3000
|
1079 | });
|
1080 | }
|
1081 | };
|
1082 | ResetPasswordRequestComponent.decorators = [
|
1083 | { type: Component, args: [{
|
1084 | selector: "user-reset-password-request",
|
1085 | template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"submit()\" fxLayout=\"column\">\r\n <mat-card>\r\n <mat-card-header>\r\n <mat-card-title>\r\n <h3>\u062F\u0631\u062E\u0648\u0627\u0633\u062A \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631</h3>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <p>\u0628\u0631\u0627\u06CC \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631 \u0634\u0645\u0627\u0631\u0647 \u062A\u0644\u0641\u0646 \u062E\u0648\u062F \u0631\u0627 \u0648\u0627\u0631\u062F \u0646\u0645\u0627\u06CC\u06CC\u062F</p>\r\n <mat-radio-group fxFlexFill formControlName=\"Type\">\r\n <mat-radio-button value=\"sms\">\u067E\u06CC\u0627\u0645\u06A9</mat-radio-button>\r\n <mat-radio-button value=\"email\">\u067E\u0633\u062A \u0627\u0644\u06A9\u062A\u0631\u0648\u0646\u06CC\u06A9\u06CC</mat-radio-button>\r\n </mat-radio-group>\r\n <mat-form-field fxFlexFill>\r\n <input matInput placeholder=\"\u0634\u0645\u0627\u0631\u0647 \u062A\u0644\u0641\u0646 \u0647\u0645\u0631\u0627\u0647\" formControlName=\"Username\">\r\n </mat-form-field>\r\n </mat-card-content>\r\n <mat-card-actions>\r\n <!--<button type=\"submit\" [disabled]='(canRequestPin | async) || (maximumResendingHappend$ | async)' (click)=\"submit()\" mat-raised-button color=\"primary\">-->\r\n <button type=\"submit\" [disabled]='(canRequestPin | async)' (click)=\"submit()\" mat-raised-button color=\"primary\">\r\n <span *ngIf='!(canRequestPin | async)'>\r\n \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631\r\n </span>\r\n <!--<div *ngIf='(canRequestPin | async) && !(maximumResendingHappend$ | async)'>\r\n {{timer$ | async}} \u062B\u0627\u0646\u06CC\u0647 \u062A\u0627 \u0627\u0645\u06A9\u0627\u0646 \u062F\u0631 \u062E\u0648\u0627\u0633\u062A \u062F\u0648\u0628\u0627\u0631\u0647 \u062F\u0631\u06CC\u0627\u0641\u062A \u067E\u06CC\u0627\u0645\u06A9.\r\n </div>\r\n <div *ngIf='(maximumResendingHappend$ | async)'>\r\n \u0639\u062F\u0645 \u0627\u0645\u06A9\u0627\u0646 \u062F\u0631\u062E\u0648\u0627\u0633\u062A\r\n </div>-->\r\n </button>\r\n <a mat-button routerLink='/auth/signin'>\u0627\u0646\u0635\u0631\u0627\u0641</a>\r\n </mat-card-actions>\r\n </mat-card>\r\n</form>\r\n",
|
1086 | styles: [""]
|
1087 | }] }
|
1088 | ];
|
1089 |
|
1090 | ResetPasswordRequestComponent.ctorParameters = function () { return [
|
1091 | { type: MatSnackBar }
|
1092 | ]; };
|
1093 | ResetPasswordRequestComponent.propDecorators = {
|
1094 | submitted: [{ type: Output }],
|
1095 | formGroup: [{ type: Input }],
|
1096 | numberOfRequested: [{ type: Input }],
|
1097 | canRequestPin: [{ type: Input }],
|
1098 | pending: [{ type: Input }]
|
1099 | };
|
1100 | return ResetPasswordRequestComponent;
|
1101 | }());
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 | var FeatureContainerComponent = (function () {
|
1108 | function FeatureContainerComponent(route, store) {
|
1109 | var _this = this;
|
1110 | this.route = route;
|
1111 | this.store = store;
|
1112 | this.route.params.subscribe(function (params) {
|
1113 |
|
1114 | var model = new ProfileViewModel.Request( ({ Email: params["Email"] }));
|
1115 | _this.store.dispatch(new Search(model));
|
1116 | });
|
1117 | }
|
1118 | FeatureContainerComponent.decorators = [
|
1119 | { type: Component, args: [{
|
1120 | template: "<router-outlet></router-outlet>"
|
1121 | }] }
|
1122 | ];
|
1123 |
|
1124 | FeatureContainerComponent.ctorParameters = function () { return [
|
1125 | { type: ActivatedRoute },
|
1126 | { type: Store }
|
1127 | ]; };
|
1128 | return FeatureContainerComponent;
|
1129 | }());
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 | var ChangePasswordModel;
|
1136 | (function (ChangePasswordModel) {
|
1137 | var Request = (function () {
|
1138 | function Request(initValue) {
|
1139 | if (initValue === void 0) { initValue = ({}); }
|
1140 | var _this = this;
|
1141 | Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
|
1142 | }
|
1143 | |
1144 |
|
1145 |
|
1146 | Request.prototype.getRequestBody = |
1147 |
|
1148 |
|
1149 | function () {
|
1150 | return {
|
1151 | Password: this.Password
|
1152 | };
|
1153 | };
|
1154 | Object.defineProperty(Request, "formGroup", {
|
1155 | get: /**
|
1156 | * @return {?}
|
1157 | */
|
1158 | function () {
|
1159 | return new FormGroup({
|
1160 | Password: new FormControl(null, [Validators.required, Validators.minLength(7)]),
|
1161 | Confirm: new FormControl(null, [Validators.required, MatchValidator("Password")])
|
1162 | });
|
1163 | },
|
1164 | enumerable: true,
|
1165 | configurable: true
|
1166 | });
|
1167 | return Request;
|
1168 | }());
|
1169 | ChangePasswordModel.Request = Request;
|
1170 | var Response = (function () {
|
1171 | function Response() {
|
1172 | }
|
1173 | return Response;
|
1174 | }());
|
1175 | ChangePasswordModel.Response = Response;
|
1176 | })(ChangePasswordModel || (ChangePasswordModel = {}));
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 | var ChangePasswordContainerComponent = (function () {
|
1183 | function ChangePasswordContainerComponent(route, store) {
|
1184 | this.route = route;
|
1185 | this.store = store;
|
1186 | this.formGroup = ChangePasswordModel.Request.formGroup;
|
1187 | this.ChangePasswordModel = new ChangePasswordModel.Request();
|
1188 | }
|
1189 | |
1190 |
|
1191 |
|
1192 | ChangePasswordContainerComponent.prototype.ngOnInit = |
1193 |
|
1194 |
|
1195 | function () {
|
1196 | this.store.select(getAccountInfo$2).subscribe(function (userInfo) {
|
1197 | if (!userInfo)
|
1198 | return;
|
1199 |
|
1200 |
|
1201 | });
|
1202 | };
|
1203 | |
1204 |
|
1205 |
|
1206 |
|
1207 | ChangePasswordContainerComponent.prototype.changePassword = |
1208 |
|
1209 |
|
1210 |
|
1211 | function (event) {
|
1212 | this.ChangePasswordModel.Password = this.formGroup.get("Password").value;
|
1213 | this.store.dispatch(new ChangePassword(this.ChangePasswordModel));
|
1214 | };
|
1215 | ChangePasswordContainerComponent.decorators = [
|
1216 | { type: Component, args: [{
|
1217 | template: "<user-change-password\n (submited)='changePassword($event)'\n [formGroup]=\"formGroup\"\n ></user-change-password>"
|
1218 | }] }
|
1219 | ];
|
1220 |
|
1221 | ChangePasswordContainerComponent.ctorParameters = function () { return [
|
1222 | { type: ActivatedRoute },
|
1223 | { type: Store }
|
1224 | ]; };
|
1225 | return ChangePasswordContainerComponent;
|
1226 | }());
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 | var ProfileEditContainerComponent = (function () {
|
1233 | function ProfileEditContainerComponent(store, configService) {
|
1234 | this.store = store;
|
1235 | this.configService = configService;
|
1236 | this.userInforamation$ = this.store.select(getAccountInfo$2);
|
1237 | this.roles$ = this.store
|
1238 | .select(getAppConfig)
|
1239 | .pipe(filter(function (config) { return config != undefined; }), map(function (config) { return config.Config.Roles; }));
|
1240 |
|
1241 |
|
1242 | this.groups = of(["test1", "test2"]);
|
1243 | this.config$ = this.configService.config$;
|
1244 | }
|
1245 | |
1246 |
|
1247 |
|
1248 | ProfileEditContainerComponent.prototype.ngOnInit = |
1249 |
|
1250 |
|
1251 | function () { };
|
1252 | |
1253 |
|
1254 |
|
1255 |
|
1256 | ProfileEditContainerComponent.prototype.updateProfile = |
1257 |
|
1258 |
|
1259 |
|
1260 | function (data) {
|
1261 | this.store.dispatch(new EditProfile(data));
|
1262 | };
|
1263 | ProfileEditContainerComponent.decorators = [
|
1264 | { type: Component, args: [{
|
1265 | selector: "profile-edit-contianer",
|
1266 | template: "<profile-edit\n (submited)='updateProfile($event)'\n [userInfo]=\"userInforamation$ | async\"\n [roles]=\"roles$\"\n\t\t\t\t[groups]=\"groups | async\"\n\t\t\t\t[formId]=\"(config$|async)?.forms.profile_edit\"\n ></profile-edit>"
|
1267 | }] }
|
1268 | ];
|
1269 |
|
1270 | ProfileEditContainerComponent.ctorParameters = function () { return [
|
1271 | { type: Store },
|
1272 | { type: UserConfigurationService }
|
1273 | ]; };
|
1274 | return ProfileEditContainerComponent;
|
1275 | }());
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 | var DashboardContainerComponent = (function () {
|
1282 |
|
1283 | function DashboardContainerComponent(store) {
|
1284 | this.store = store;
|
1285 | this.user$ = this.store.select(getAccountInfo);
|
1286 |
|
1287 | }
|
1288 | |
1289 |
|
1290 |
|
1291 | DashboardContainerComponent.prototype.ngOnInit = |
1292 |
|
1293 |
|
1294 | function () { };
|
1295 | DashboardContainerComponent.decorators = [
|
1296 | { type: Component, args: [{
|
1297 | selector: "user-dashboard-container",
|
1298 | template: "<!-- <router-outlet name=\"links\"></router-outlet> -->\r\n<div fxLayoutAlign=\"center\">\r\n <router-outlet></router-outlet>\r\n</div>",
|
1299 | styles: ["#box-left{background:#fff}#box-bottom{background:#2b0033}#box-right{background:#000833;padding-top:10px!important;padding-bottom:10px!important}#box-right div{background:#fff;opacity:.5}#banner:not(.active){height:100%;-webkit-filter:grayscale(100%) brightness(1.5) opacity(.2) blur(2px);filter:grayscale(100%) brightness(1.5) opacity(.2) blur(2px)}#s1{background:#aaa}#s2{background:#bbb}#s3{background:#ccc}.personal-info{background-color:rgba(255,255,255,.5);position:relative;right:10%;width:90%;height:469px}.personal-info h2{color:#00bcd4;font-weight:400;font-size:24px;font-family:iran-sans-light!important}.personal-info h6{font-weight:400;font-size:12px;float:right;width:50%;margin:0;color:#555;border-bottom:2px solid #ececec}.personal-info p{float:right;width:30%;margin:0;font-size:13px;padding-right:30px;border-bottom:2px solid #ececec}.personal-info div{width:100%;height:50px;position:relative;line-height:52px;right:17px}.quick-box{width:100%;height:50px;position:relative;line-height:52px;padding-top:79px}.quick-btn{background-color:#00bcd4;margin:12px 10px;height:100px;text-align:center;line-height:100px;font-size:17px;color:#fff}.banner-section{text-align:center}.info-section{padding:60px 25px 10px;background-color:#f7f7f7;background-image:url(https://www.toptal.com/designers/subtlepatterns/patterns/grey.png)!important;height:1040px;padding-bottom:120px!important}"]
|
1300 | }] }
|
1301 | ];
|
1302 |
|
1303 | DashboardContainerComponent.ctorParameters = function () { return [
|
1304 | { type: Store }
|
1305 | ]; };
|
1306 | return DashboardContainerComponent;
|
1307 | }());
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 | var ProfileComponent = (function () {
|
1314 | function ProfileComponent() {
|
1315 | this.info = [];
|
1316 | }
|
1317 | Object.defineProperty(ProfileComponent.prototype, "information", {
|
1318 | set: /**
|
1319 | * @param {?} information
|
1320 | * @return {?}
|
1321 | */
|
1322 | function (information) {
|
1323 | var _this = this;
|
1324 | if (!information)
|
1325 | return;
|
1326 | Object.keys(information).forEach(function (k) { return _this.info.push([k, information[k]]); });
|
1327 | },
|
1328 | enumerable: true,
|
1329 | configurable: true
|
1330 | });
|
1331 | |
1332 |
|
1333 |
|
1334 | ProfileComponent.prototype.ngOnInit = |
1335 |
|
1336 |
|
1337 | function () { };
|
1338 | ProfileComponent.decorators = [
|
1339 | { type: Component, args: [{
|
1340 | selector: "user-profile",
|
1341 | template: "<div fxFlex=\"450px\">\r\n <router-outlet name=\"ngs-user-profile-view\"></router-outlet>\r\n <router-outlet></router-outlet>\r\n <!-- <mat-card>\r\n <mat-card-header>\r\n <mat-card-title>\u0627\u0637\u0644\u0627\u0639\u0627\u062A \u067E\u0631\u0648\u0641\u0627\u06CC\u0644</mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content *ngIf='dataStatus$ | async'>\r\n <div class='list-item' fxFlexLayout='row' *ngFor=\"let item of info\">\r\n <p fxFlex='40'>{{item[0]}}</p>\r\n <p fxFlex='60'>{{item[1]}}</p>\r\n </div>\r\n \r\n </mat-card-content>\r\n\r\n <mat-card-actions align=\"end\">\r\n <button mat-button color=\"primary\" routerLink='..'>\u0628\u0627\u0632\u06AF\u0634\u062A</button>\r\n <button mat-raised-button color=\"primary\" routerLink='edit'>\u0648\u06CC\u0631\u0627\u06CC\u0634</button>\r\n </mat-card-actions>\r\n </mat-card> -->\r\n</div>\r\n\r\n\r\n\r\n<!-- <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0627\u06CC\u0645\u06CC\u0644</p>\r\n <p fxFlex='60'>{{(information | async).Email}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>roles</p>\r\n <p fxFlex='60'>{{(information | async).Roles | json}}</p>\r\n </div> -->\r\n<!-- <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0646\u0627\u0645</p>\r\n <p fxFlex='60'>{{(userInformation | async).FirstName}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0646\u0627\u0645 \u062E\u0627\u0646\u0648\u0627\u062F\u06AF\u06CC</p>\r\n <p fxFlex='60'>{{(userInformation | async).LastName}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0646\u0627\u0645 \u06A9\u0627\u0631\u0628\u0631\u06CC</p>\r\n <p fxFlex='60'>{{(userInformation | async).Username}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062A\u0644\u0641\u0646 \u0647\u0645\u0631\u0627\u0647</p>\r\n <p fxFlex='60'>{{(userInformation | async).MobileNumber | persianNumber}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062C\u0646\u0633\u06CC\u062A</p>\r\n <p fxFlex='60'>{{sex$ | async}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062A\u0627\u0631\u06CC\u062E \u062A\u0648\u0644\u062F</p>\r\n <p fxFlex='60'>{{(userInformation | async).Birthdate | persianDate : false}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0627\u06CC\u0645\u06CC\u0644</p>\r\n <p fxFlex='60'>{{(userInformation | async).Email}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>{{(identifierType$ | async)}}</p>\r\n <p fxFlex='60'>{{(userInformation | async).IdentificationNo | persianNumber}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062A\u0627\u0631\u06CC\u062E \u0639\u0636\u0648\u06CC\u062A</p>\r\n <p fxFlex='60'>{{(userInformation | async).RegisterDate | persianDate}}</p>\r\n </div> -->",
|
1342 | styles: [""]
|
1343 | }] }
|
1344 | ];
|
1345 |
|
1346 | ProfileComponent.ctorParameters = function () { return []; };
|
1347 | ProfileComponent.propDecorators = {
|
1348 | information: [{ type: Input }],
|
1349 | dataStatus$: [{ type: Input }]
|
1350 | };
|
1351 | return ProfileComponent;
|
1352 | }());
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 | var ProfileContainerComponent = (function () {
|
1359 | function ProfileContainerComponent(store) {
|
1360 | this.store = store;
|
1361 | this.data$ = this.store.select(getAccountInfo$2);
|
1362 | this.dataStatus$ = this.store.select(getUserInforamtionStatus);
|
1363 | }
|
1364 | |
1365 |
|
1366 |
|
1367 | ProfileContainerComponent.prototype.ngOnInit = |
1368 |
|
1369 |
|
1370 | function () { };
|
1371 | ProfileContainerComponent.decorators = [
|
1372 | { type: Component, args: [{
|
1373 | template: "<user-profile\n [information]=\"data$ | async\"\n [dataStatus$]='dataStatus$'\n ></user-profile>"
|
1374 | }] }
|
1375 | ];
|
1376 |
|
1377 | ProfileContainerComponent.ctorParameters = function () { return [
|
1378 | { type: Store }
|
1379 | ]; };
|
1380 | return ProfileContainerComponent;
|
1381 | }());
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 | var NgsUserModule = (function () {
|
1388 | function NgsUserModule() {
|
1389 | }
|
1390 | |
1391 |
|
1392 |
|
1393 |
|
1394 | NgsUserModule.forRoot = |
1395 |
|
1396 |
|
1397 |
|
1398 | function (config) {
|
1399 | return {
|
1400 | ngModule: RootNgsUserModule,
|
1401 | providers: [{ provide: MODULE_CONFIG_TOKEN, useValue: config }]
|
1402 | };
|
1403 | };
|
1404 | NgsUserModule.decorators = [
|
1405 | { type: NgModule, args: [{
|
1406 | imports: [
|
1407 | HttpClientModule,
|
1408 | FormsModule,
|
1409 | RouterModule,
|
1410 | CommonModule,
|
1411 | MatExpansionModule,
|
1412 | MatSnackBarModule,
|
1413 | MatIconModule,
|
1414 | MatButtonModule,
|
1415 | MatCardModule,
|
1416 | MatSelectModule,
|
1417 | MatInputModule,
|
1418 | MatFormFieldModule,
|
1419 | MatTabsModule,
|
1420 | FlexLayoutModule,
|
1421 | MatRadioModule,
|
1422 | ReactiveFormsModule,
|
1423 | BrowserAnimationsModule,
|
1424 | NgsFormModule
|
1425 | ],
|
1426 | declarations: [
|
1427 | SearchComponent,
|
1428 | ProfileComponent,
|
1429 | ChangePasswordComponent,
|
1430 | ProfileEditComponent,
|
1431 | ProfileContainerComponent,
|
1432 | DashboardLinksComponent,
|
1433 | ResetPasswordRequestComponent,
|
1434 | FeatureContainerComponent,
|
1435 | DashboardContainerComponent,
|
1436 | ChangePasswordContainerComponent,
|
1437 | ProfileEditContainerComponent
|
1438 | ],
|
1439 | exports: []
|
1440 | },] }
|
1441 | ];
|
1442 | return NgsUserModule;
|
1443 | }());
|
1444 | var RootNgsUserModule = (function () {
|
1445 | function RootNgsUserModule() {
|
1446 | }
|
1447 | RootNgsUserModule.decorators = [
|
1448 | { type: NgModule, args: [{
|
1449 | imports: [
|
1450 | NgsUserModule,
|
1451 | StoreModule.forFeature("user", UserReducers),
|
1452 | EffectsModule.forFeature([
|
1453 | EditProfileEffects,
|
1454 | ProfileViewEffects,
|
1455 | UserEffects
|
1456 | ])
|
1457 | ]
|
1458 | },] }
|
1459 | ];
|
1460 | return RootNgsUserModule;
|
1461 | }());
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 | var routes = [
|
1469 | {
|
1470 | path: "user/panel",
|
1471 | component: DashboardContainerComponent,
|
1472 | children: [
|
1473 | {
|
1474 | path: "",
|
1475 | component: DashboardLinksComponent
|
1476 | },
|
1477 | {
|
1478 | path: "profile",
|
1479 | component: ProfileContainerComponent
|
1480 | },
|
1481 | {
|
1482 | path: "profile/edit",
|
1483 | component: ProfileEditContainerComponent
|
1484 | }
|
1485 | ]
|
1486 | },
|
1487 | {
|
1488 | path: "admin/user",
|
1489 | children: [
|
1490 |
|
1491 | {
|
1492 | path: ":Email",
|
1493 | component: FeatureContainerComponent,
|
1494 | children: [
|
1495 | {
|
1496 | path: "profile-edit",
|
1497 | component: ProfileEditContainerComponent
|
1498 | }
|
1499 | ]
|
1500 | }
|
1501 | ]
|
1502 | }
|
1503 | ];
|
1504 |
|
1505 | var NgsUserRoutingModule = RouterModule.forChild(routes);
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 | var NgsUserModuleOutlets = {
|
1513 | ngs_user_profile_view: "ngs-user-profile-view",
|
1514 | };
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 | var UserFacadeService = (function () {
|
1521 | function UserFacadeService(store, configService) {
|
1522 | this.store = store;
|
1523 | this.configService = configService;
|
1524 | }
|
1525 | |
1526 |
|
1527 |
|
1528 | UserFacadeService.prototype.getDisplayName = |
1529 |
|
1530 |
|
1531 | function () {
|
1532 | return this.store.select(getAccountInfo$2).let(this.configService.config$.getValue().mapUserDisplayName);
|
1533 |
|
1534 | };
|
1535 | |
1536 |
|
1537 |
|
1538 | UserFacadeService.prototype.getInfo = |
1539 |
|
1540 |
|
1541 | function () {
|
1542 | return this.store.select(getAccountInfo$2);
|
1543 | };
|
1544 | UserFacadeService.decorators = [
|
1545 | { type: Injectable, args: [{
|
1546 | providedIn: "root"
|
1547 | },] }
|
1548 | ];
|
1549 |
|
1550 | UserFacadeService.ctorParameters = function () { return [
|
1551 | { type: Store },
|
1552 | { type: UserConfigurationService }
|
1553 | ]; };
|
1554 | UserFacadeService.ngInjectableDef = defineInjectable({ factory: function UserFacadeService_Factory() { return new UserFacadeService(inject(Store), inject(UserConfigurationService)); }, token: UserFacadeService, providedIn: "root" });
|
1555 | return UserFacadeService;
|
1556 | }());
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 | export { UserModel, NgsUserModule, NgsUserRoutingModule, NgsUserModuleOutlets, UserService, UserFacadeService, getAccountInfo$2 as getAccountInfo, UserActionTypes, ChangePasswordContainerComponent as ɵr, reducer$1 as ɵw, ChangePasswordComponent as ɵj, getAccountInfo as ɵu, userReducer as ɵt, DashboardContainerComponent as ɵq, DashboardLinksComponent as ɵm, FeatureContainerComponent as ɵp, UserEffects as ɵbb, EditProfileEffects as ɵz, reducer$2 as ɵy, ProfileEditContainerComponent as ɵs, ProfileEditComponent as ɵk, ProfileContainerComponent as ɵl, ProfileViewEffects as ɵba, ProfileComponent as ɵi, reducer as ɵv, ResetPasswordRequestComponent as ɵo, reducer$3 as ɵx, SearchComponent as ɵh, UserConfigurationService as ɵn, MODULE_CONFIG_TOKEN as ɵa, RootNgsUserModule as ɵb, UserReducers as ɵd, selectFeatureState as ɵf, selectUserInformaionState as ɵg, routes as ɵc };
|
1569 |
|
1570 |
|
\ | No newline at end of file |