UNPKG

34.2 kBJavaScriptView Raw
1!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@soushians/shared"),require("@ngrx/store"),require("rxjs/BehaviorSubject"),require("@soushians/config"),require("@angular/common/http"),require("rxjs/operators"),require("@soushians/authentication"),require("@angular/router"),require("@ngrx/effects"),require("rxjs/observable/of"),require("rxjs"),require("rxjs/Observable"),require("@angular/material"),require("@angular/common"),require("@angular/flex-layout"),require("@angular/platform-browser/animations"),require("@soushians/form")):"function"==typeof define&&define.amd?define("@soushians/user",["exports","@angular/core","@angular/forms","@soushians/shared","@ngrx/store","rxjs/BehaviorSubject","@soushians/config","@angular/common/http","rxjs/operators","@soushians/authentication","@angular/router","@ngrx/effects","rxjs/observable/of","rxjs","rxjs/Observable","@angular/material","@angular/common","@angular/flex-layout","@angular/platform-browser/animations","@soushians/form"],e):e((t.soushians=t.soushians||{},t.soushians.user={}),t.ng.core,t.ng.forms,null,null,t.rxjs.BehaviorSubject,null,t.ng.common.http,t.rxjs.operators,null,t.ng.router,null,t.rxjs["observable/of"],t.rxjs,t.rxjs.Observable,t.ng.material,t.ng.common,t.ng["flex-layout"],t.ng.platformBrowser.animations,null)}(this,function(r,e,o,i,n,a,s,u,c,p,f,l,d,m,h,y,g,x,b,v){"use strict";var R={server:"frontend_server",env:{production:!1,frontend_server:"user/module/frontend/server/did/not/set",server:"user/module/server/did/not/set"},endpoints:{changePassword:"",editProfile:"",getAccountInfo:"",profileInformation:""},forms:{profile_edit:""},dashboardLinks:[],responseToUserInfo:function(t){return t},mapUserDisplayName:function(t){return t.map(function(t){return t.Username})}},S=new e.InjectionToken("UserModuleConfig"),w=function Xt(){this.Roles=[],this.Groups=[]};!function(t){var e=function(){function t(e){void 0===e&&(e={});var n=this;Object.keys(e).forEach(function(t){return n[t]=e[t]})}return t.prototype.getRequestBody=function(){return{Password:this.Password}},Object.defineProperty(t,"formGroup",{get:function(){return new o.FormGroup({Password:new o.FormControl(null,[o.Validators.required,o.Validators.minLength(7)]),Confirm:new o.FormControl(null,[o.Validators.required,i.MatchValidator("Password")])})},enumerable:!0,configurable:!0}),t}();t.Request=e;var n=function r(){};t.Response=n}(r.ChangePasswordModel||(r.ChangePasswordModel={})),function(t){var e=function(){function t(e){var n=this;Object.keys(e).forEach(function(t){return n[t]=e[t]})}return t.prototype.getRequestBody=function(){return{Username:this.Username,Token:this.Token,Captcha:this.Captcha}},Object.defineProperty(t,"formGroup",{get:function(){return new o.FormGroup({Username:new o.FormControl("",[o.Validators.minLength(8),o.Validators.required]),Captcha:new o.FormControl(null,[o.Validators.required]),Token:new o.FormControl(null,[o.Validators.required]),Type:new o.FormControl("sms")})},enumerable:!0,configurable:!0}),t}();t.Request=e;var n=function r(){};t.Response=n}(r.ResetPasswordRequestModel||(r.ResetPasswordRequestModel={})),function(t){var e=function(){function t(e){var n=this;Object.keys(e).forEach(function(t){return n[t]=e[t]})}return t.prototype.getRequestBody=function(){return{Password:this.Password}},Object.defineProperty(t,"formGroup",{get:function(){return new o.FormGroup({Token:new o.FormControl(null,[o.Validators.required]),Password:new o.FormControl("",[o.Validators.minLength(8),o.Validators.required]),Confirm:new o.FormControl(null,[o.Validators.required,i.MatchValidator("Password")])})},enumerable:!0,configurable:!0}),t}();t.Request=e;var n=function r(){};t.Response=n}(r.ResetPasswordModel||(r.ResetPasswordModel={})),function(t){var e=function(){function t(e){void 0===e&&(e={});var n=this;Object.keys(e).forEach(function(t){return n[t]=e[t]})}return t.prototype.getRequestBody=function(){return this},Object.defineProperty(t,"formGroup",{get:function(){return new o.FormGroup({Email:new o.FormControl(null,[o.Validators.required]),Roles:new o.FormControl(null,[o.Validators.required]),Groups:new o.FormControl(null,[o.Validators.required])})},enumerable:!0,configurable:!0}),t}();t.Request=e;var n=function(){function t(e){void 0===e&&(e={});var n=this;Object.keys(e).forEach(function(t){return n[t]=e[t]})}return t.prototype.extractData=function(){return this.Result.User},t}();t.Response=n}(r.EditProfile_ApiModel||(r.EditProfile_ApiModel={}));var E=function(t,e){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var F=function(){return(F=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function P(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(o=t[s])&&(a=(i<3?o(a):3<i?o(e,n,a):o(e,n))||a);return 3<i&&a&&Object.defineProperty(e,n,a),a}function I(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}!function(t){var e=function(){function t(e){var n=this;Object.keys(e).forEach(function(t){return n[t]=e[t]})}return t.prototype.getRequestBody=function(){return{}},Object.defineProperty(t,"formGroup",{get:function(){return new o.FormGroup({Username:new o.FormControl("",[o.Validators.minLength(8),o.Validators.required])})},enumerable:!0,configurable:!0}),t}();t.Request=e;var n=function(t){function e(){return t.call(this)||this}return function r(t,e){function n(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e}(w);t.Response=n}(r.ProfileViewModel||(r.ProfileViewModel={})),function(t){var e=function(){function t(e){var n=this;Object.keys(e).forEach(function(t){return n[t]=e[t]})}return t.prototype.getRequestBody=function(){return{}},Object.defineProperty(t,"formGroup",{get:function(){},enumerable:!0,configurable:!0}),t}();t.Request=e;var n=function r(){this.data=[]};t.Response=n}(r.FailedLoginReportModel||(r.FailedLoginReportModel={}));var t=function Yt(){},O=function(){function t(t,e){var n=this;this.store=e,this.config$=new a.BehaviorSubject(this._config),this._config=Object.assign({},R,t),this.config$.next(this._config),this.store.select(s.getUserModuleConfig).subscribe(function(t){t&&(n._config=Object.assign({},n._config,t.Config),n.config$.next(n._config))})}return Object.defineProperty(t.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:e.Inject,args:[S]}]},{type:n.Store}]},t.ngInjectableDef=e.defineInjectable({factory:function(){return new t(e.inject(S),e.inject(n.Store))},token:t,providedIn:"root"}),t}(),_="[USER][PROFILE] GET_PROFILE",j="[USER][PROFILE] GET_PROFILE_START",C="[USER][PROFILE] GET_PROFILE_SUCCEED",L="[USER][PROFILE] GET_PROFILE_FAILED",A=function Zt(){this.type=_},q=function te(){this.type=j},$=function ee(t){this.payload=t,this.type=C},M=function ne(){this.type=L},k={USER_SELECTED:"[USER] USER_SELECTED",REFRESH_USER_INFO:"[USER] REFRESH_USER_INFO"},U=function re(t){this.payload=t,this.type=k.REFRESH_USER_INFO},D={loaded:!1,data:new w};function T(t,e){switch(void 0===t&&(t=D),e.type){case k.USER_SELECTED:case k.REFRESH_USER_INFO:return F({},t,{loaded:!0,data:e.payload});default:return t}}var G=function(t){return t.data},N=function(){function t(t,e,n){var r=this;this.http=t,this.store=e,this.configurationService=n,this.configurationService.config$.subscribe(function(t){return r.config=t}),setTimeout(function(){r.store.dispatch(new A)},999)}return t.prototype.getAccountInfo=function(){var o=this;return this.configurationService.config$.pipe(c.filter(function(t){return""!=t.endpoints.profileInformation}),c.take(1),c.combineLatest(this.store.select(p.getUser)),c.switchMap(function(t){var e=function u(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i["return"])&&n.call(i)}finally{if(o)throw o.error}}return a}(t,2),n=e[0],r=e[1];return o.http.get(i.stringTemplate(n.env[n.server]+n.endpoints.profileInformation,{user:r.User}))["let"](n.responseToUserInfo).pipe(c.map(function(t){var e=Object.assign({},t);return e.Role&&(e.Roles=[e.Role]),e}))}))},t.prototype.editProfile=function(t){var e=new r.EditProfile_ApiModel.Request(t);return this.http.put(i.stringTemplate(this.config.env[this.config.server]+this.config.endpoints.editProfile,e),e.getRequestBody()).pipe(c.map(function(t){return new r.EditProfile_ApiModel.Response(t).extractData()}))},t.prototype.getInfo=function(t){var e=new r.ProfileViewModel.Request(t);return this.http.get(i.stringTemplate(this.config.env[this.config.server]+this.config.endpoints.getAccountInfo,e)).pipe(c.map(function(t){return t}))},t.prototype.is_role=function(e){return this.store.select(G).pipe(c.filter(function(t){return t&&t.Roles!=undefined}),c.take(1),c.map(function(t){return-1<t.Roles.indexOf(e)}))},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:u.HttpClient},{type:n.Store},{type:O}]},t.ngInjectableDef=e.defineInjectable({factory:function(){return new t(e.inject(u.HttpClient),e.inject(n.Store),e.inject(O))},token:t,providedIn:"root"}),t}(),V="[USER][PASSWORD] EDIT_PROFILE",H="[USER][PASSWORD] EDIT_PROFILE_START",B="[USER][PASSWORD] EDIT_PROFILE_SUCCEED",W="[USER][PASSWORD] EDIT_PROFILE_FAILED",z=function oe(t){this.payload=t,this.type=V},K=function ie(t){this.payload=t,this.type=H},Q=function ae(t){this.payload=t,this.type=B},J=function se(){this.type=W},X=function(){function t(t,e,n){var r=this;this.actions$=t,this.router=e,this.service=n,this.EditProfileRequest$=this.actions$.ofType(V).pipe(c.map(function(t){return t.payload}),c.map(function(t){return new K(t)})),this.RequestEditProfileLink$=this.actions$.ofType(H).pipe(c.map(function(t){return t.payload}),c.switchMap(function(t){return r.service.editProfile(t)}),c.map(function(t){return new Q(t)}),c.catchError(function(){return d.of(new J)})),this.goToView$=this.actions$.ofType(B).pipe(c.map(function(){return r.router.navigate(["/user/profile"]),new A}))}return t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:l.Actions},{type:f.Router},{type:N}]},P([l.Effect(),I("design:type",Object)],t.prototype,"EditProfileRequest$",void 0),P([l.Effect(),I("design:type",Object)],t.prototype,"RequestEditProfileLink$",void 0),P([l.Effect(),I("design:type",Object)],t.prototype,"goToView$",void 0),t}(),Y=function(){function t(t,e){var n=this;this.actions$=t,this.userService=e,this.ProfileRequest$=this.actions$.ofType(_).pipe(c.map(function(t){return t.payload}),c.map(function(t){return new q})),this.getProfile$=this.actions$.ofType(j).pipe(c.map(function(t){return t.payload}),c.switchMap(function(t){return n.userService.getAccountInfo().pipe(c.map(function(t){return new $(t)}),c.catchError(function(){return d.of(new M)}))})),this.refreshUserInfo$=this.actions$.ofType(C).pipe(c.map(function(t){return t.payload}),c.map(function(t){return new U(t)}))}return t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:l.Actions},{type:N}]},P([l.Effect(),I("design:type",Object)],t.prototype,"ProfileRequest$",void 0),P([l.Effect(),I("design:type",Object)],t.prototype,"getProfile$",void 0),P([l.Effect(),I("design:type",Object)],t.prototype,"refreshUserInfo$",void 0),t}(),Z="[USER][PASSWORD] GET_RESET_PASSWORD_LINK",tt="[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_START",et="[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_SUCCEED",nt="[USER][PASSWORD] DISABLE_GET_LINK",rt="[USER][PASSWORD] ENABLE_GET_LINK",ot={numberOfRequested:0,lastRequestedTime:null,disable:!1};function it(t,e){switch(void 0===t&&(t=ot),e.type){case Z:return F({},t);case tt:return F({},t,{numberOfRequested:t.numberOfRequested+1,lastRequestedTime:Date.now().toString()});case et:return F({},t);case nt:return F({},t,{disable:!0});case rt:return F({},t,{disable:!1});default:return t}}var at="[USER][PASSWORD] CHANGE_PASSWORD",st="[USER][PASSWORD] PASSWORD_CHANGED_START",ut="[USER][PASSWORD] PASSWORD_CHANGED_SUCCEED",ct="[USER][PASSWORD] PASSWORD_CHANGED_FAILED",pt=function ue(t){this.payload=t,this.type=at},ft={status:"pristine"};function lt(t,e){switch(void 0===t&&(t=ft),e.type){case at:return{status:"dirty"};case st:return{status:"pending"};case ut:return{status:"succeed"};case ct:return{status:"failed"};default:return ft}}var dt={status:"pristine"};function mt(t,e){switch(void 0===t&&(t=dt),e.type){case V:return{status:"dirty"};case H:return{status:"pending"};case B:return{status:"succeed"};case W:return{status:"failed"};default:return t}}var ht="[USER][SEARCH] SEARCH",yt="[USER][SEARCH] SEARCH_START",gt="[USER][SEARCH] SEARCH_SUCCEED",xt="[USER][SEARCH] SEARCH_FAILED",bt="[USER][SEARCH] CLEAR_SEARCHED_USER",vt=function ce(t){this.payload=t,this.type=ht},Rt=function pe(t){this.payload=t,this.type=yt},St=function fe(t){this.payload=t,this.type=gt},wt=function le(){this.type=xt},Et={status:"pristine",data:{}};function Ft(t,e){switch(void 0===t&&(t=Et),e.type){case ht:return F({},t,{status:"dirty",data:new r.ProfileViewModel.Response});case yt:return F({},t,{status:"pending"});case gt:return F({},t,{status:"succeed",data:e.payload});case xt:return F({},t,{status:"failed"});case bt:return Et;default:return t}}var Pt={user:T,resetPasswordRequest:it,changePassword:lt,searchView:Ft,editProfile:mt},It=n.createFeatureSelector("user"),Ot=n.createSelector(It,function(t){return t.user.loaded}),_t=(n.createSelector(It,function(t){return t.user.loaded}),n.createSelector(It,function(t){return t.resetPasswordRequest})),jt=(n.createSelector(_t,function(t){return t.numberOfRequested}),n.createSelector(_t,function(t){return t.disable}),n.createSelector(It,function(t){return t.user})),Ct=n.createSelector(jt,G),Lt=n.createSelector(It,function(t){return t.searchView}),At=n.createSelector(Lt,function(t){return t.status}),qt=function(){function t(t){this.store=t,this.user$=this.store.select(Ct)}return t.prototype.ngOnInit=function(){},t.decorators=[{type:e.Component,args:[{selector:"user-dashboard-container",template:'\x3c!-- <router-outlet name="links"></router-outlet> --\x3e\n<div fxLayoutAlign="center">\n <router-outlet></router-outlet>\n</div>',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}"]}]}],t.ctorParameters=function(){return[{type:n.Store}]},t}(),$t=function(){function t(t,e){this.userConfigurationService=t,this.store=e,this.links$=this.userConfigurationService.config$.map(function(t){return t.dashboardLinks}),this.links=[{title:"مشاهده حساب کاربری",route:"/user/panel/profile",icon:"person"}]}return t.prototype.ngAfterViewInit=function(){},t.decorators=[{type:e.Component,args:[{selector:"user-dashboard-links",template:"<div fxLayout='row' fxLayoutWrap id=\"con\">\n <button fxFlex=\"31\" class='link' mat-raised-button [routerLink]='link.route' *ngFor='let link of links'>\n <div fxLayout='column' fxLayoutAlign='center center'>\n <mat-icon color='primary'>{{link.icon}}</mat-icon>\n <h3 class='title'>{{link.title}}</h3>\n <div class='description'>{{link.description}}</div>\n </div>\n </button>\n <button fxFlex=\"31\" class='link' mat-raised-button [routerLink]='link.route' *ngFor='let link of links$ | async'>\n <div fxLayout='column' fxLayoutAlign='center center'>\n <mat-icon color='primary'>{{link.icon}}</mat-icon>\n <h3 class='title'>{{link.title}}</h3>\n <div class='description'>{{link.description}}</div>\n </div>\n </button>\n</div>",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%}"]}]}],t.ctorParameters=function(){return[{type:O},{type:n.Store}]},t}(),Mt=function(){function t(t,e,n){this.actions$=t,this.router=e,this.service=n,this.getAccountInfo$=this.actions$.ofType(p.SignInActionTypes.SIGNIN_SUCCEED).pipe(c.map(function(){return new A})),this.signout$=this.actions$.ofType(p.SignInActionTypes.SIGNOUT).pipe(c.map(function(){return new U({})}))}return t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:l.Actions},{type:f.Router},{type:N}]},P([l.Effect(),I("design:type",Object)],t.prototype,"getAccountInfo$",void 0),P([l.Effect(),I("design:type",Object)],t.prototype,"signout$",void 0),t}(),kt=function(){function t(t){this.store=t,this.formGroup=r.ProfileViewModel.Request.formGroup,this.userDataLoaded$=new m.BehaviorSubject(!1),this.userNotFound$=new m.BehaviorSubject(!1),this.user=this.store.select(Ct),this.userStatus$=this.store.select(At)}return t.prototype.ngOnInit=function(){var e=this;this.userStatus$.subscribe(function(t){return e.userDataLoaded$.next(!"pristine|dirty|pending".includes(t))})},t.prototype.search=function(){this.formGroup.valid&&this.store.dispatch(new vt(this.formGroup.value))},t.decorators=[{type:e.Component,args:[{selector:"search",template:"<mat-card fxFlex=\"450px\" *ngIf=\"(userStatus$ | async) == 'succeed'\">\n <mat-card-header>\n <mat-card-title>\n <div fxLayout=\"row\" fxLayoutAlign=\"space-between\">\n <div fxFlex=\"nogrow\">\n \x3c!-- {{(user | async).LastName }}، {{(user | async).FirstName }} --\x3e\n </div>\n <div fxFlex=\"nogrow\">\n \x3c!-- {{(user | async).Email}} --\x3e\n </div>\n </div>\n </mat-card-title>\n </mat-card-header>\n <mat-card-content>\n <div>\n <div class='list-item' fxFlexLayout='row' fxLayoutAlign='center center'>\n <mat-icon fxFlex='nogrow'>local_grocery_store</mat-icon>\n <div fxFlex='15px'></div>\n <p fxFlex='40'>شناسه</p>\n \x3c!-- <p fxFlex='60' fxLayoutAlign=\"end\">{{(user | async)._id }}</p> --\x3e\n </div>\n <div class='list-item' fxFlexLayout='row' fxLayoutAlign='center center'>\n <mat-icon fxFlex='nogrow'>email</mat-icon>\n <div fxFlex='15px'></div>\n <p fxFlex='40'>پست الکترونیکی</p>\n \x3c!-- <p fxFlex='60' fxLayoutAlign=\"end\">{{(user | async).Email }}</p> --\x3e\n </div>\n </div>\n\n </mat-card-content>\n</mat-card>",styles:[""]}]}],t.ctorParameters=function(){return[{type:n.Store}]},t}(),Ut=function(){function t(){this.submited=new e.EventEmitter}return t.prototype.ngOnInit=function(){},t.prototype.submit=function(){},t.prototype.changePassword=function(){this.formGroup.valid&&this.submited.emit(this.formGroup.value)},t.decorators=[{type:e.Component,args:[{selector:"user-change-password",template:'<div fxFlex="450px">\n <form [formGroup]="formGroup" (ngSubmit)="changePassword()" fxLayout="column">\n <mat-card>\n <mat-card-content>\n <mat-form-field fxFlexFill>\n <input type="password" matInput placeholder="کلمه عبور" formControlName="Password">\n </mat-form-field>\n <mat-form-field fxFlexFill>\n <input type="password" matInput placeholder="تکرار کلمه عبور" formControlName="Confirm">\n </mat-form-field>\n </mat-card-content>\n <mat-card-actions fxLayoutAlign="center center">\n <button fxFlex="nogrow" type="submit" mat-raised-button color="primary">تغییر رمز عبور</button>\n <button fxFlex="nogrow" type="button" routerLink="/user/panel" mat-raised-button>بازگشت</button>\n </mat-card-actions>\n </mat-card>\n </form>\n</div>',styles:[""]}]}],t.ctorParameters=function(){return[]},t.propDecorators={formGroup:[{type:e.Input}],submited:[{type:e.Output}]},t}(),Dt=function(){function t(t){this.router=t,this.submited=new e.EventEmitter}return t.prototype.ngOnInit=function(){},t.prototype.editProfile=function(t){t.valid&&this.submited.emit(t.value)},t.prototype.goback=function(){this.router.navigate([".."])},t.decorators=[{type:e.Component,args:[{selector:"profile-edit",template:'<div fxFlex="450px">\n\n \n <ngs-form-view #form [id]="formId" [card]="true" (accept)="editProfile(form.formGroup)" (cancel)="goback()" ></ngs-form-view>\n \x3c!-- <form [formGroup]="formGroup" (ngSubmit)="editProfile()" fxLayout="column">\n <mat-card>\n <mat-card-content>\n </mat-card-content>\n <mat-card-actions align="end">\n <button type="button" routerLink=".." mat-button color="primary">بازگشت</button>\n <button type="submit" mat-raised-button color="primary">ویرایش</button>\n </mat-card-actions>\n </mat-card>\n </form> --\x3e\n</div>'}]}],t.ctorParameters=function(){return[{type:f.Router}]},t.propDecorators={submited:[{type:e.Output}],userInfo:[{type:e.Input}],formId:[{type:e.Input}],roles$:[{type:e.Input,args:["roles"]}],groups:[{type:e.Input}]},t}(),Tt=function(){function t(t){this.snackBar=t,this.submitted=new e.EventEmitter,this.maximumResendingHappend$=new a.BehaviorSubject(!1),this.timer$=h.Observable.timer(0,100).map(function(t){return t+1}).takeWhile(function(t){return 100*t<=3e3}).map(function(t){return 3e3-100*t})}return Object.defineProperty(t.prototype,"pending",{set:function(t){t&&this.formGroup.disable(),this.formGroup.enable()},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var e=this;this.numberOfRequested.subscribe(function(t){2<t&&e.maximumResendingHappend$.next(!0)})},t.prototype.submit=function(){if(this.formGroup.valid){this.submitted.emit(this.formGroup.value);var t=this.maximumResendingHappend$.getValue()?"عدم امکان ...":"پیامک جدید برای شما ارسال گردید.";this.snackBar.open(t,"",{duration:3e3})}},t.decorators=[{type:e.Component,args:[{selector:"user-reset-password-request",template:'<form [formGroup]="formGroup" (ngSubmit)="submit()" fxLayout="column">\n <mat-card>\n <mat-card-header>\n <mat-card-title>\n <h3>درخواست بازیابی رمز عبور</h3>\n </mat-card-title>\n </mat-card-header>\n <mat-card-content>\n <p>برای بازیابی رمز عبور شماره تلفن خود را وارد نمایید</p>\n <mat-radio-group fxFlexFill formControlName="Type">\n <mat-radio-button value="sms">پیامک</mat-radio-button>\n <mat-radio-button value="email">پست الکترونیکی</mat-radio-button>\n </mat-radio-group>\n <mat-form-field fxFlexFill>\n <input matInput placeholder="شماره تلفن همراه" formControlName="Username">\n </mat-form-field>\n </mat-card-content>\n <mat-card-actions>\n \x3c!--<button type="submit" [disabled]=\'(canRequestPin | async) || (maximumResendingHappend$ | async)\' (click)="submit()" mat-raised-button color="primary">--\x3e\n <button type="submit" [disabled]=\'(canRequestPin | async)\' (click)="submit()" mat-raised-button color="primary">\n <span *ngIf=\'!(canRequestPin | async)\'>\n بازیابی رمز عبور\n </span>\n \x3c!--<div *ngIf=\'(canRequestPin | async) && !(maximumResendingHappend$ | async)\'>\n {{timer$ | async}} ثانیه تا امکان در خواست دوباره دریافت پیامک.\n </div>\n <div *ngIf=\'(maximumResendingHappend$ | async)\'>\n عدم امکان درخواست\n </div>--\x3e\n </button>\n <a mat-button routerLink=\'/auth/signin\'>انصراف</a>\n </mat-card-actions>\n </mat-card>\n</form>\n',styles:[""]}]}],t.ctorParameters=function(){return[{type:y.MatSnackBar}]},t.propDecorators={submitted:[{type:e.Output}],formGroup:[{type:e.Input}],numberOfRequested:[{type:e.Input}],canRequestPin:[{type:e.Input}],pending:[{type:e.Input}]},t}(),Gt=(function(){function t(t,e){var n=this;this.actions$=t,this.userService=e,this.canSearch$=this.actions$.ofType(ht).pipe(c.map(function(t){return t.payload}),c.map(function(t){return new Rt(t)})),this.search$=this.actions$.ofType(yt).pipe(c.map(function(t){return t.payload}),c.switchMap(function(t){return n.userService.getInfo(t).pipe(c.map(function(t){return null==t?new wt:new St(t)}),c.catchError(function(){return d.of(new wt)}))}))}t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:l.Actions},{type:N}]},P([l.Effect(),I("design:type",Object)],t.prototype,"canSearch$",void 0),P([l.Effect(),I("design:type",Object)],t.prototype,"search$",void 0)}(),function(){function t(t,e){var n=this;this.route=t,this.store=e,this.route.params.subscribe(function(t){var e=new r.ProfileViewModel.Request({Email:t.Email});n.store.dispatch(new vt(e))})}return t.decorators=[{type:e.Component,args:[{template:"<router-outlet></router-outlet>"}]}],t.ctorParameters=function(){return[{type:f.ActivatedRoute},{type:n.Store}]},t}()),Nt=function(){function t(t,e){this.route=t,this.store=e,this.formGroup=r.ChangePasswordModel.Request.formGroup,this.ChangePasswordModel=new r.ChangePasswordModel.Request}return t.prototype.ngOnInit=function(){this.store.select(Ct).subscribe(function(t){})},t.prototype.changePassword=function(t){this.ChangePasswordModel.Password=this.formGroup.get("Password").value,this.store.dispatch(new pt(this.ChangePasswordModel))},t.decorators=[{type:e.Component,args:[{template:"<user-change-password\n (submited)='changePassword($event)'\n [formGroup]=\"formGroup\"\n ></user-change-password>"}]}],t.ctorParameters=function(){return[{type:f.ActivatedRoute},{type:n.Store}]},t}(),Vt=function(){function t(t,e){this.store=t,this.configService=e,this.userInforamation$=this.store.select(Ct),this.roles$=this.store.select(s.getAppConfig).filter(function(t){return t!=undefined}).map(function(t){return t.Config.Roles}),this.groups=m.of(["test1","test2"]),this.config$=this.configService.config$}return t.prototype.ngOnInit=function(){},t.prototype.updateProfile=function(t){this.store.dispatch(new z(t))},t.decorators=[{type:e.Component,args:[{selector:"profile-edit-contianer",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>'}]}],t.ctorParameters=function(){return[{type:n.Store},{type:O}]},t}(),Ht=function(){function t(){this.info=[]}return Object.defineProperty(t.prototype,"information",{set:function(e){var n=this;e&&Object.keys(e).forEach(function(t){return n.info.push([t,e[t]])})},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){},t.decorators=[{type:e.Component,args:[{selector:"user-profile",template:"<div fxFlex=\"450px\">\n <router-outlet name=\"ngs-user-profile-view\"></router-outlet>\n <router-outlet></router-outlet>\n \x3c!-- <mat-card>\n <mat-card-header>\n <mat-card-title>اطلاعات پروفایل</mat-card-title>\n </mat-card-header>\n <mat-card-content *ngIf='dataStatus$ | async'>\n <div class='list-item' fxFlexLayout='row' *ngFor=\"let item of info\">\n <p fxFlex='40'>{{item[0]}}</p>\n <p fxFlex='60'>{{item[1]}}</p>\n </div>\n \n </mat-card-content>\n\n <mat-card-actions align=\"end\">\n <button mat-button color=\"primary\" routerLink='..'>بازگشت</button>\n <button mat-raised-button color=\"primary\" routerLink='edit'>ویرایش</button>\n </mat-card-actions>\n </mat-card> --\x3e\n</div>\n\n\n\n\x3c!-- <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>ایمیل</p>\n <p fxFlex='60'>{{(information | async).Email}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>roles</p>\n <p fxFlex='60'>{{(information | async).Roles | json}}</p>\n </div> --\x3e\n\x3c!-- <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>نام</p>\n <p fxFlex='60'>{{(userInformation | async).FirstName}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>نام خانوادگی</p>\n <p fxFlex='60'>{{(userInformation | async).LastName}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>نام کاربری</p>\n <p fxFlex='60'>{{(userInformation | async).Username}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>تلفن همراه</p>\n <p fxFlex='60'>{{(userInformation | async).MobileNumber | persianNumber}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>جنسیت</p>\n <p fxFlex='60'>{{sex$ | async}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>تاریخ تولد</p>\n <p fxFlex='60'>{{(userInformation | async).Birthdate | persianDate : false}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>ایمیل</p>\n <p fxFlex='60'>{{(userInformation | async).Email}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>{{(identifierType$ | async)}}</p>\n <p fxFlex='60'>{{(userInformation | async).IdentificationNo | persianNumber}}</p>\n </div>\n <div class='list-item' fxFlexLayout='row'>\n <p fxFlex='40'>تاریخ عضویت</p>\n <p fxFlex='60'>{{(userInformation | async).RegisterDate | persianDate}}</p>\n </div> --\x3e",styles:[""]}]}],t.ctorParameters=function(){return[]},t.propDecorators={information:[{type:e.Input}],dataStatus$:[{type:e.Input}]},t}(),Bt=function(){function t(t){this.store=t,this.data$=this.store.select(Ct),this.dataStatus$=this.store.select(Ot)}return t.prototype.ngOnInit=function(){},t.decorators=[{type:e.Component,args:[{template:"<user-profile\n [information]=\"data$ | async\"\n [dataStatus$]='dataStatus$'\n ></user-profile>"}]}],t.ctorParameters=function(){return[{type:n.Store}]},t}(),Wt=function(){function t(){}return t.forRoot=function(t){return{ngModule:zt,providers:[{provide:S,useValue:t}]}},t.decorators=[{type:e.NgModule,args:[{imports:[u.HttpClientModule,o.FormsModule,f.RouterModule,g.CommonModule,y.MatExpansionModule,y.MatSnackBarModule,y.MatIconModule,y.MatButtonModule,y.MatCardModule,y.MatSelectModule,y.MatInputModule,y.MatFormFieldModule,y.MatTabsModule,x.FlexLayoutModule,y.MatRadioModule,o.ReactiveFormsModule,b.BrowserAnimationsModule,v.NgsFormModule],declarations:[kt,Ht,Ut,Dt,Bt,$t,Tt,Gt,qt,Nt,Vt],exports:[]}]}],t}(),zt=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[Wt,n.StoreModule.forFeature("user",Pt),l.EffectsModule.forFeature([X,Y,Mt])]}]}],t}(),Kt=[{path:"user/panel",component:qt,children:[{path:"",component:$t},{path:"profile",component:Bt},{path:"profile/edit",component:Vt},{path:"password/change",component:Nt}]},{path:"admin/user",children:[{path:"managment",component:kt},{path:":Email",component:Gt,children:[{path:"profile-edit",component:Vt},{path:"change-password",component:Nt}]}]}],Qt=f.RouterModule.forChild(Kt),Jt=function(){function t(t,e){this.store=t,this.configService=e}return t.prototype.getDisplayName=function(){return this.store.select(Ct)["let"](this.configService.config$.getValue().mapUserDisplayName)},t.prototype.getInfo=function(){return this.store.select(Ct)},t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:n.Store},{type:O}]},t.ngInjectableDef=e.defineInjectable({factory:function(){return new t(e.inject(n.Store),e.inject(O))},token:t,providedIn:"root"}),t}();r.NgsUserModuleOutlets={ngs_user_profile_view:"ngs-user-profile-view"},r.UserService=N,r.UserFacadeService=Jt,r.getAccountInfo=Ct,r.UserActionTypes=k,r.MODULE_DEFAULT_CONFIG=R,r.MODULE_CONFIG_TOKEN=S,r.UserModel=w,r.FailedLoginModel=t,r.NgsUserModule=Wt,r.RootNgsUserModule=zt,r.routes=Kt,r.NgsUserRoutingModule=Qt,r.ɵp=Nt,r.ɵu=lt,r.ɵh=Ut,r.ɵs=G,r.ɵr=T,r.ɵo=qt,r.ɵk=$t,r.ɵn=Gt,r.ɵz=Mt,r.ɵx=X,r.ɵw=mt,r.ɵq=Vt,r.ɵi=Dt,r.ɵj=Bt,r.ɵy=Y,r.ɵg=Ht,r.ɵt=it,r.ɵm=Tt,r.ɵv=Ft,r.ɵf=kt,r.ɵl=O,r.ɵb=Pt,r.ɵd=It,r.ɵe=jt,Object.defineProperty(r,"__esModule",{value:!0})});
2//# sourceMappingURL=soushians-user.umd.min.js.map
\No newline at end of file