@social-mail/social-mail-client 1.2.321 → 1.2.322

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.
@@ -4964,7 +4964,7 @@ html, body {
4964
4964
  }
4965
4965
  }
4966
4966
 
4967
- `.withId("global-styles").withOrder("medium").installGlobal()}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/style/GlobalStyle");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/di/Inject","./EntityService","../model/model","../common/SocialMailApp","@web-atoms/core/dist/App","@web-atoms/core/dist/core/sleep","@web-atoms/date-time/dist/DateTime"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,DISingleton,Inject,EntityService,LoginSession,SocialMailApp,App,sleep,DateTime,LoginService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_EntityService){EntityService=_EntityService.default},function(_modelModel){LoginSession=_modelModel.LoginSession},function(_commonSocialMailApp){SocialMailApp=_commonSocialMailApp.default},function(_webAtomsCoreDistApp){App=_webAtomsCoreDistApp.App},function(_webAtomsCoreDistCoreSleep){sleep=_webAtomsCoreDistCoreSleep.default},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default}],execute:function(){LoginService=class LoginService{getUser(){var _a,_b;return __awaiter(this,void 0,void 0,(function*(){(_a=this.user)!==null&&_a!==void 0?_a:this.user=(_b=yield this.entityService.query(LoginSession,"currentUser").firstOrDefault())===null||_b===void 0?void 0:_b.user;SocialMailApp.user=this.user;return this.user}))}login(session){return __awaiter(this,void 0,void 0,(function*(){const result=yield this.entityService.save(session);if(session.invalid){if(session.verificationToken){this.checkSession(session).catch(console.error)}return session.status}location.reload()}))}checkSession(session){return __awaiter(this,void 0,void 0,(function*(){do{yield sleep(5e3);session.dateUpdated=DateTime.now;yield this.entityService.save(session);if(!session.invalid){location.reload()}}while(true)}))}updateRegistration(s){return __awaiter(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}logout(){return __awaiter(this,void 0,void 0,(function*(){const session=yield this.entityService.query(LoginSession,"currentUser").firstOrDefault();session.invalid=true;const cloner=this.entityService.cloner(session);yield this.entityService.save(cloner.copy);yield sleep(1e3);location.reload()}))}};__decorate([Inject,__metadata("design:type",EntityService)],LoginService.prototype,"entityService",void 0);__decorate([Inject,__metadata("design:type",App)],LoginService.prototype,"app",void 0);LoginService=__decorate([DISingleton()],LoginService);_export("default",LoginService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/LoginService");System.register(["tslib","@web-atoms/core/dist/core/Bind","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/style/styled","@web-atoms/web-controls/dist/basic/Form","@web-atoms/web-controls/dist/basic/FormField","@web-atoms/web-controls/dist/mobile-app/MobileApp","../../../controls/countries/CountrySelect","@web-atoms/web-controls/dist/basic/MaskedInput","@web-atoms/core/dist/services/FetchBuilder","@web-atoms/core/dist/view-model/Action","@web-atoms/core/dist/web/services/PopupService","@web-atoms/web-controls/dist/basic/PasswordBox","../../../apiPath"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,Bind,XNode,styled,Form,FormField,ContentPage,CountrySelect,formatForCountry,isdForCountry,MaskedInput,FetchBuilder,Action,PopupService,PasswordBox,apiPath,ForgotPassword,css;_export("default",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistCoreBind){Bind=_webAtomsCoreDistCoreBind.default},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsCoreDistStyleStyled){styled=_webAtomsCoreDistStyleStyled.default},function(_webAtomsWebControlsDistBasicForm){Form=_webAtomsWebControlsDistBasicForm.default},function(_webAtomsWebControlsDistBasicFormField){FormField=_webAtomsWebControlsDistBasicFormField.default},function(_webAtomsWebControlsDistMobileAppMobileApp){ContentPage=_webAtomsWebControlsDistMobileAppMobileApp.ContentPage},function(_controlsCountriesCountrySelect){CountrySelect=_controlsCountriesCountrySelect.CountrySelect;formatForCountry=_controlsCountriesCountrySelect.formatForCountry;isdForCountry=_controlsCountriesCountrySelect.isdForCountry},function(_webAtomsWebControlsDistBasicMaskedInput){MaskedInput=_webAtomsWebControlsDistBasicMaskedInput.default},function(_webAtomsCoreDistServicesFetchBuilder){FetchBuilder=_webAtomsCoreDistServicesFetchBuilder.default},function(_webAtomsCoreDistViewModelAction){Action=_webAtomsCoreDistViewModelAction.default},function(_webAtomsCoreDistWebServicesPopupService){PopupService=_webAtomsCoreDistWebServicesPopupService.default},function(_webAtomsWebControlsDistBasicPasswordBox){PasswordBox=_webAtomsWebControlsDistBasicPasswordBox.default},function(_apiPath){apiPath=_apiPath.apiPath}],execute:function(){css=styled.css`
4967
+ `.withId("global-styles").withOrder("medium").installGlobal()}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/style/GlobalStyle");System.register(["tslib","@web-atoms/core/dist/di/DISingleton","@web-atoms/core/dist/di/Inject","./EntityService","../model/model","../common/SocialMailApp","@web-atoms/core/dist/App","@web-atoms/core/dist/core/sleep","@web-atoms/date-time/dist/DateTime"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,DISingleton,Inject,EntityService,LoginSession,SocialMailApp,App,sleep,DateTime,LoginService;return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistDiDISingleton){DISingleton=_webAtomsCoreDistDiDISingleton.default},function(_webAtomsCoreDistDiInject){Inject=_webAtomsCoreDistDiInject.Inject},function(_EntityService){EntityService=_EntityService.default},function(_modelModel){LoginSession=_modelModel.LoginSession},function(_commonSocialMailApp){SocialMailApp=_commonSocialMailApp.default},function(_webAtomsCoreDistApp){App=_webAtomsCoreDistApp.App},function(_webAtomsCoreDistCoreSleep){sleep=_webAtomsCoreDistCoreSleep.default},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default}],execute:function(){LoginService=class LoginService{getUser(){var _a,_b;return __awaiter(this,void 0,void 0,(function*(){(_a=this.user)!==null&&_a!==void 0?_a:this.user=(_b=yield this.entityService.query(LoginSession,"currentUser").firstOrDefault())===null||_b===void 0?void 0:_b.user;SocialMailApp.user=this.user;return this.user}))}login(session){return __awaiter(this,void 0,void 0,(function*(){const result=yield this.entityService.save(session);if(session.invalid){if(session.verificationToken){this.checkSession(session).catch(console.error)}return session.status}location.reload()}))}checkSession(session){return __awaiter(this,void 0,void 0,(function*(){do{yield sleep(5e3);session.dateUpdated=DateTime.now;yield this.entityService.save(session);if(!session.invalid){location.reload()}}while(true)}))}updateRegistration(s){return __awaiter(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}logout(){return __awaiter(this,void 0,void 0,(function*(){const session=yield this.entityService.query(LoginSession,"currentUser").firstOrDefault();session.invalid=true;const cloner=this.entityService.cloner(session);yield this.entityService.save(cloner.copy);yield sleep(1e3);location.reload()}))}};__decorate([Inject,__metadata("design:type",EntityService)],LoginService.prototype,"entityService",void 0);__decorate([Inject,__metadata("design:type",App)],LoginService.prototype,"app",void 0);LoginService=__decorate([DISingleton()],LoginService);_export("default",LoginService)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/services/LoginService");System.register(["tslib","@web-atoms/core/dist/core/Bind","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/style/styled","@web-atoms/web-controls/dist/basic/Form","@web-atoms/web-controls/dist/basic/FormField","@web-atoms/web-controls/dist/mobile-app/MobileApp","../../../controls/countries/CountrySelect","@web-atoms/web-controls/dist/basic/MaskedInput","@web-atoms/core/dist/services/FetchBuilder","@web-atoms/core/dist/view-model/Action","@web-atoms/core/dist/web/services/PopupService","@web-atoms/web-controls/dist/basic/PasswordBox","../../../apiPath","../../../controls/qrcode/QRCode","@web-atoms/core/dist/core/sleep"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,Bind,XNode,styled,Form,FormField,ContentPage,CountrySelect,formatForCountry,isdForCountry,MaskedInput,FetchBuilder,Action,PopupService,PasswordBox,apiPath,QRCodeControl,sleep,ForgotPassword,css;_export("default",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistCoreBind){Bind=_webAtomsCoreDistCoreBind.default},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsCoreDistStyleStyled){styled=_webAtomsCoreDistStyleStyled.default},function(_webAtomsWebControlsDistBasicForm){Form=_webAtomsWebControlsDistBasicForm.default},function(_webAtomsWebControlsDistBasicFormField){FormField=_webAtomsWebControlsDistBasicFormField.default},function(_webAtomsWebControlsDistMobileAppMobileApp){ContentPage=_webAtomsWebControlsDistMobileAppMobileApp.ContentPage},function(_controlsCountriesCountrySelect){CountrySelect=_controlsCountriesCountrySelect.CountrySelect;formatForCountry=_controlsCountriesCountrySelect.formatForCountry;isdForCountry=_controlsCountriesCountrySelect.isdForCountry},function(_webAtomsWebControlsDistBasicMaskedInput){MaskedInput=_webAtomsWebControlsDistBasicMaskedInput.default},function(_webAtomsCoreDistServicesFetchBuilder){FetchBuilder=_webAtomsCoreDistServicesFetchBuilder.default},function(_webAtomsCoreDistViewModelAction){Action=_webAtomsCoreDistViewModelAction.default},function(_webAtomsCoreDistWebServicesPopupService){PopupService=_webAtomsCoreDistWebServicesPopupService.default},function(_webAtomsWebControlsDistBasicPasswordBox){PasswordBox=_webAtomsWebControlsDistBasicPasswordBox.default},function(_apiPath){apiPath=_apiPath.apiPath},function(_controlsQrcodeQRCode){QRCodeControl=_controlsQrcodeQRCode.default},function(_webAtomsCoreDistCoreSleep){sleep=_webAtomsCoreDistCoreSleep.default}],execute:function(){css=styled.css`
4968
4968
  & [data-border=frame] {
4969
4969
  padding: 10px;
4970
4970
  border-radius: 10px;
@@ -4982,7 +4982,7 @@ html, body {
4982
4982
  min-width: 250px;
4983
4983
  }
4984
4984
  }
4985
- `.installLocal();_export("default",ForgotPassword=class ForgotPassword extends ContentPage{constructor(){super(...arguments);this.model={username:"",password:"",passwordAgain:"",phoneNumber:"",country:"US",phoneNumberText:"",phone:{code:""},captcha:{code:""}}}init(){return __awaiter(this,void 0,void 0,(function*(){this.hideToolbar=true;this.title="Reset Password";const{id}=yield FetchBuilder.put(apiPath("/api/users/captcha")).responseAsJson();this.model.captcha.id=id;this.render(XNode.create("div",{class:css},XNode.create("div",{"data-layout":"center-all"},XNode.create(Form,{"data-border":"frame"},XNode.create("h3",null,"To reset password, enter following."),XNode.create(FormField,{label:"Username"},XNode.create("input",{autofocus:true,value:Bind.twoWaysImmediate((()=>this.model.username))})),XNode.create(FormField,{label:"Phone Number"},XNode.create("div",{"data-layout":"row"},XNode.create(CountrySelect,{value:Bind.twoWaysImmediate((()=>this.model.country))}),XNode.create(MaskedInput,{"data-mask":Bind.oneWayAsync((()=>formatForCountry(this.model.country))),value:Bind.twoWaysImmediate((()=>this.model.phoneNumberText))}))),XNode.create(FormField,{label:"Captcha"},XNode.create("img",{src:apiPath(`/api/users/captcha/${id}`)})),XNode.create(FormField,{label:"Enter 5 Digit Code"},XNode.create("input",{type:"tel",value:Bind.twoWaysImmediate((()=>this.model.captcha.code))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"data-layout":"go-button","data-submit-event":"ask-code"},"Next"))))))}))}resetPassword(){return __awaiter(this,void 0,void 0,(function*(){const{model}=this;if(model.phone.verified){if(!model.password){throw new Error("Password is required")}}if(model.password){if(model.password.length<7){throw new Error("Password is cannot be less than 7 characters")}if(/\s/i.test(model.password)){throw new Error("Password must not any whitespace characters")}if(model.passwordAgain!==model.password){throw new Error("Passwords do not match")}}const isdCode=yield isdForCountry(model.country);const phoneNumber=model.phoneNumberText.replace(/[^0-9]/g,"");model.phoneNumber=isdCode.startsWith("+")?isdCode+phoneNumber:`+${isdCode}${phoneNumber}`;const{userID,phone,captcha}=yield FetchBuilder.post(apiPath("/api/users/password/reset/")).jsonBody(this.model).responseAsJson();if(captcha===null||captcha===void 0?void 0:captcha.verified){model.captcha.verified=captcha.verified}if(userID){yield PopupService.alert({message:"Password has been reset successfully, please login with your new password."});location.href="/";return}if(phone.verified){this.model.phone.verified=phone.verified;this.askPasswords();return}if(phone.id){this.model.phone.id=phone.id}this.askCode()}))}askCode(){this.renderer=XNode.create("div",{class:css},XNode.create("div",{"data-layout":"center-all"},XNode.create(Form,{"data-border":"frame"},XNode.create("h3",null,"Enter verification code."),XNode.create(FormField,{label:"Code"},XNode.create("input",{type:"tel",value:Bind.twoWaysImmediate((()=>this.model.phone.code))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"data-layout":"go-button","data-submit-event":"ask-code"},"Next")))))}askPasswords(){this.renderer=XNode.create("div",{class:css},XNode.create("div",{"data-layout":"center-all"},XNode.create(Form,{"data-border":"frame"},XNode.create("h3",null,"Enter new password."),XNode.create(FormField,{label:"Password"},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.password))})),XNode.create(FormField,{label:"Password Again"},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.passwordAgain))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"data-layout":"go-button","data-submit-event":"ask-code"},"Next")))))}});__decorate([Action({onEvent:"ask-code"}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],ForgotPassword.prototype,"resetPassword",null)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/pages/user/forgot/ForgotPassword");System.register(["tslib","@web-atoms/core/dist/core/XNode","@web-atoms/web-controls/dist/mobile-app/MobileApp","@web-atoms/web-controls/dist/basic/FormField","../../../../model/model","@web-atoms/core/dist/core/Bind","@web-atoms/web-controls/dist/basic/PasswordBox","@web-atoms/core/dist/view-model/Action","@web-atoms/core/dist/core/InjectProperty","../../../../services/LoginService","../../../controls/password/PasswordStrength","../../../validators/Validators","../../../controls/buttons/IconButton","@web-atoms/web-controls/dist/PageNavigator","../forgot/ForgotPassword","@web-atoms/core/dist/web/services/PopupService","../../../form/AppForm","../../../../web/commands/AppCommands","@web-atoms/date-time/dist/DateTime","../../../controls/qrcode/QRCode"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,XNode,ContentPage,FormField,LoginSession,Bind,PasswordBox,Action,InjectProperty,LoginService,PasswordStrength,Validators,SaveIconTextButton,PageNavigator,ForgotPassword,PopupService,AppForm,AppCommands,DateTime,QRCode,LoginPage,isSocialMail;_export("default",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsWebControlsDistMobileAppMobileApp){ContentPage=_webAtomsWebControlsDistMobileAppMobileApp.ContentPage},function(_webAtomsWebControlsDistBasicFormField){FormField=_webAtomsWebControlsDistBasicFormField.default},function(_modelModel){LoginSession=_modelModel.LoginSession},function(_webAtomsCoreDistCoreBind){Bind=_webAtomsCoreDistCoreBind.default},function(_webAtomsWebControlsDistBasicPasswordBox){PasswordBox=_webAtomsWebControlsDistBasicPasswordBox.default},function(_webAtomsCoreDistViewModelAction){Action=_webAtomsCoreDistViewModelAction.default},function(_webAtomsCoreDistCoreInjectProperty){InjectProperty=_webAtomsCoreDistCoreInjectProperty.default},function(_servicesLoginService){LoginService=_servicesLoginService.default},function(_controlsPasswordPasswordStrength){PasswordStrength=_controlsPasswordPasswordStrength.default},function(_validatorsValidators){Validators=_validatorsValidators.Validators},function(_controlsButtonsIconButton){SaveIconTextButton=_controlsButtonsIconButton.SaveIconTextButton},function(_webAtomsWebControlsDistPageNavigator){PageNavigator=_webAtomsWebControlsDistPageNavigator.default},function(_forgotForgotPassword){ForgotPassword=_forgotForgotPassword.default},function(_webAtomsCoreDistWebServicesPopupService){PopupService=_webAtomsCoreDistWebServicesPopupService.default},function(_formAppForm){AppForm=_formAppForm.default},function(_webCommandsAppCommands){AppCommands=_webCommandsAppCommands.default},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default},function(_controlsQrcodeQRCode){QRCode=_controlsQrcodeQRCode.default}],execute:function(){isSocialMail=/socialmail\.(me|in)/i.test(location.href)||/\d+.\d+.\d+.\d+/i.test(location.href);_export("default",LoginPage=class LoginPage extends ContentPage{constructor(){super(...arguments);this.password=""}init(){return __awaiter(this,void 0,void 0,(function*(){this.footerRenderer=()=>XNode.create("div",{"data-layout":"row"},XNode.create("a",{target:"_blank","data-margin-left":"auto",href:"https://socialmail.me"},"Social Mail"));this.hideToolbar=true;this.model=LoginSession.create({});this.model.userName="";this.model.checkPassword="";this.model.timeToken="";this.model.oneTimePassword="";this.render(XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,XNode.create("h3",null,"Sign in to continue"),XNode.create(FormField,{label:"Username"},XNode.create("input",{autofocus:true,value:Bind.twoWaysImmediate((()=>this.model.userName))})),XNode.create(FormField,{label:"Password"},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.checkPassword))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"data-layout":"accent-button","data-submit-event":"login",text:"Login"})),isSocialMail&&XNode.create("div",{"data-layout":"row"},XNode.create("span",{"data-click-event":"forgot-password","data-layout":"link"},"Forgot password?")),isSocialMail&&XNode.create("div",{"data-layout":"row"},XNode.create("a",{"data-click-event":"route",href:AppCommands.signup.displayRoute({})},"Sign Up"))))))}))}login(){return __awaiter(this,void 0,void 0,(function*(){this.model.dateUpdated=DateTime.now;const status=yield this.userService.login(this.model);if(!status){return}if(status==="change-password"){yield this.showChangePassword();return}this.showOtherFactors()}))}showOtherFactors(){const smsConfig=this.model.verificationToken;this.renderer=XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,(smsConfig===null||smsConfig===void 0?void 0:smsConfig.smsConfig)&&XNode.create(QRCode,{smsConfig:smsConfig.smsConfig}),XNode.create("h4",null,"OR"),XNode.create("h4",null,"Enter Authenticator Code"),XNode.create(FormField,{label:"Code"},XNode.create("input",{autofocus:true,type:"tel",value:Bind.twoWaysImmediate((()=>this.model.timeToken))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"event-click":()=>this.showOTP(),"data-layout":"link"},"Enter One Time Password instead.")),XNode.create("div",{"data-layout":"command-row"},XNode.create(SaveIconTextButton,{"event-click":()=>this.login(),text:"Go"}))))}showOTP(){this.renderer=XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,XNode.create("h4",null,"Enter One Time Password"),XNode.create(FormField,{label:"Password"},XNode.create("input",{autofocus:true,type:"tel",value:Bind.twoWaysImmediate((()=>this.model.oneTimePassword))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"event-click":()=>this.showOtherFactors(),"data-layout":"link"},"Enter Authenticator Code instad.")),XNode.create("div",{"data-layout":"command-row"},XNode.create(SaveIconTextButton,{"event-click":()=>this.login(),text:"Go"}))))}showChangePassword(){return __awaiter(this,void 0,void 0,(function*(){this.model.newPassword="";this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,XNode.create("div",null,"Update your password, your one time password is expired."),XNode.create(FormField,{label:"Password",autofocus:true,required:true,error:Bind.oneWay((()=>Validators.isValidPassword(this.password)?"":"Password must contain one symbol, one number and should be minimum 7 characters"))},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.password))})),XNode.create(PasswordStrength,{password:Bind.oneWay((()=>this.password))}),XNode.create(FormField,{label:"Password Again",required:true,error:Bind.oneWay((()=>this.model.newPassword!==this.password?"Passwords do not match":""))},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.newPassword))})),XNode.create("div",{"data-layout":"command-row"},XNode.create("button",{"data-submit-event":"login",text:"Change Password & Login"})))))}))}forgotPassword(){return __awaiter(this,void 0,void 0,(function*(){if(isSocialMail){PageNavigator.openPage(ForgotPassword);return}yield PopupService.alert({message:"Please contact your administrator"})}))}});__decorate([InjectProperty,__metadata("design:type",LoginService)],LoginPage.prototype,"userService",void 0);__decorate([Action({onEvent:"login"}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],LoginPage.prototype,"login",null);__decorate([Action({onEvent:"forgot-password"}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],LoginPage.prototype,"forgotPassword",null)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/pages/user/login/LoginPage");System.register(["tslib","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/style/styled"],(function(_export,_context){"use strict";var __rest,XNode,styled;function MenuItem(_a){var{label,icon=void 0,click=undefined,title=label,description=void 0,href="",commandLink="",target=undefined,bell=void 0,bellTitle=void 0,bellClick=void 0}=_a,a=__rest(_a,["label","icon","click","title","description","href","commandLink","target","bell","bellTitle","bellClick"]);return href||commandLink?XNode.create("a",Object.assign({"data-layout":"menu-item","data-text-decoration":"none",title,"data-click-event":commandLink?"route":void 0,href:href||commandLink,target,"event-click":click},a),icon&&XNode.create("i",{class:icon}),XNode.create("span",{text:label}),description&&XNode.create("small",{text:description}),bell!==void 0&&XNode.create("i",Object.assign({"data-element":"badge",title:bellTitle,class:bell?"fad fa-bell":"fad fa-bell-slash"},typeof bellClick==="string"?{"data-click-event":bellClick}:{"data-click-event":"none","event-click":bellClick}))):XNode.create("div",Object.assign({title,"data-layout":"menu-item","event-click":click},a),icon&&XNode.create("i",{class:icon}),XNode.create("span",{text:label}),description&&XNode.create("small",{text:description}),bell!==void 0&&XNode.create("i",{"data-click-event":bellClick,"data-element":"badge",title:bellTitle,class:bell?"fad fa-bell":"fad fa-bell-slash"}))}_export("default",MenuItem);return{setters:[function(_tslib){__rest=_tslib.__rest},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsCoreDistStyleStyled){styled=_webAtomsCoreDistStyleStyled.default}],execute:function(){styled.css`
4985
+ `.installLocal();_export("default",ForgotPassword=class ForgotPassword extends ContentPage{constructor(){super(...arguments);this.model={username:"",password:"",passwordAgain:"",phoneNumber:"",country:"US",phoneNumberText:"",phone:{code:""},captcha:{code:""}}}init(){return __awaiter(this,void 0,void 0,(function*(){this.hideToolbar=true;this.title="Reset Password";const{id}=yield FetchBuilder.put(apiPath("/api/users/captcha")).responseAsJson();this.model.captcha.id=id;this.render(XNode.create("div",{class:css},XNode.create("div",{"data-layout":"center-all"},XNode.create(Form,{"data-border":"frame"},XNode.create("h3",null,"To reset password, enter following."),XNode.create(FormField,{label:"Username"},XNode.create("input",{autofocus:true,value:Bind.twoWaysImmediate((()=>this.model.username))})),XNode.create(FormField,{label:"Phone Number"},XNode.create("div",{"data-layout":"row"},XNode.create(CountrySelect,{value:Bind.twoWaysImmediate((()=>this.model.country))}),XNode.create(MaskedInput,{"data-mask":Bind.oneWayAsync((()=>formatForCountry(this.model.country))),value:Bind.twoWaysImmediate((()=>this.model.phoneNumberText))}))),XNode.create(FormField,{label:"Captcha"},XNode.create("img",{src:apiPath(`/api/users/captcha/${id}`)})),XNode.create(FormField,{label:"Enter 5 Digit Code"},XNode.create("input",{type:"tel",value:Bind.twoWaysImmediate((()=>this.model.captcha.code))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"data-layout":"go-button","data-submit-event":"ask-code"},"Next"))))))}))}resetPassword(){return __awaiter(this,void 0,void 0,(function*(){const{model}=this;if(model.phone.verified){if(!model.password){throw new Error("Password is required")}}if(model.password){if(model.password.length<7){throw new Error("Password is cannot be less than 7 characters")}if(/\s/i.test(model.password)){throw new Error("Password must not any whitespace characters")}if(model.passwordAgain!==model.password){throw new Error("Passwords do not match")}}const isdCode=yield isdForCountry(model.country);const phoneNumber=model.phoneNumberText.replace(/[^0-9]/g,"");model.phoneNumber=isdCode.startsWith("+")?isdCode+phoneNumber:`+${isdCode}${phoneNumber}`;const{userID,phone,captcha}=yield FetchBuilder.post(apiPath("/api/users/password/reset/")).jsonBody(this.model).responseAsJson();if(captcha===null||captcha===void 0?void 0:captcha.verified){model.captcha.verified=captcha.verified}if(userID){yield PopupService.alert({message:"Password has been reset successfully, please login with your new password."});location.href="/";return}if(phone.verified){this.model.phone.verified=phone.verified;this.askPasswords();return}if(phone.id){this.model.phone.id=phone.id;this.model.phone.smsConfig=phone.smsConfig}yield this.askCode()}))}askCode(){return __awaiter(this,void 0,void 0,(function*(){this.renderer=XNode.create("div",{class:css},XNode.create("div",{"data-layout":"center-all"},XNode.create(QRCodeControl,{smsConfig:this.model.phone.smsConfig})));yield sleep(3e3);yield this.resetPassword()}))}askPasswords(){this.renderer=XNode.create("div",{class:css},XNode.create("div",{"data-layout":"center-all"},XNode.create(Form,{"data-border":"frame"},XNode.create("h3",null,"Enter new password."),XNode.create(FormField,{label:"Password"},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.password))})),XNode.create(FormField,{label:"Password Again"},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.passwordAgain))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"data-layout":"go-button","data-submit-event":"ask-code"},"Next")))))}});__decorate([Action({onEvent:"ask-code"}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],ForgotPassword.prototype,"resetPassword",null)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/pages/user/forgot/ForgotPassword");System.register(["tslib","@web-atoms/core/dist/core/XNode","@web-atoms/web-controls/dist/mobile-app/MobileApp","@web-atoms/web-controls/dist/basic/FormField","../../../../model/model","@web-atoms/core/dist/core/Bind","@web-atoms/web-controls/dist/basic/PasswordBox","@web-atoms/core/dist/view-model/Action","@web-atoms/core/dist/core/InjectProperty","../../../../services/LoginService","../../../controls/password/PasswordStrength","../../../validators/Validators","../../../controls/buttons/IconButton","@web-atoms/web-controls/dist/PageNavigator","../forgot/ForgotPassword","@web-atoms/core/dist/web/services/PopupService","../../../form/AppForm","../../../../web/commands/AppCommands","@web-atoms/date-time/dist/DateTime","../../../controls/qrcode/QRCode"],(function(_export,_context){"use strict";var __awaiter,__decorate,__metadata,XNode,ContentPage,FormField,LoginSession,Bind,PasswordBox,Action,InjectProperty,LoginService,PasswordStrength,Validators,SaveIconTextButton,PageNavigator,ForgotPassword,PopupService,AppForm,AppCommands,DateTime,QRCode,LoginPage,isSocialMail;_export("default",void 0);return{setters:[function(_tslib){__awaiter=_tslib.__awaiter;__decorate=_tslib.__decorate;__metadata=_tslib.__metadata},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsWebControlsDistMobileAppMobileApp){ContentPage=_webAtomsWebControlsDistMobileAppMobileApp.ContentPage},function(_webAtomsWebControlsDistBasicFormField){FormField=_webAtomsWebControlsDistBasicFormField.default},function(_modelModel){LoginSession=_modelModel.LoginSession},function(_webAtomsCoreDistCoreBind){Bind=_webAtomsCoreDistCoreBind.default},function(_webAtomsWebControlsDistBasicPasswordBox){PasswordBox=_webAtomsWebControlsDistBasicPasswordBox.default},function(_webAtomsCoreDistViewModelAction){Action=_webAtomsCoreDistViewModelAction.default},function(_webAtomsCoreDistCoreInjectProperty){InjectProperty=_webAtomsCoreDistCoreInjectProperty.default},function(_servicesLoginService){LoginService=_servicesLoginService.default},function(_controlsPasswordPasswordStrength){PasswordStrength=_controlsPasswordPasswordStrength.default},function(_validatorsValidators){Validators=_validatorsValidators.Validators},function(_controlsButtonsIconButton){SaveIconTextButton=_controlsButtonsIconButton.SaveIconTextButton},function(_webAtomsWebControlsDistPageNavigator){PageNavigator=_webAtomsWebControlsDistPageNavigator.default},function(_forgotForgotPassword){ForgotPassword=_forgotForgotPassword.default},function(_webAtomsCoreDistWebServicesPopupService){PopupService=_webAtomsCoreDistWebServicesPopupService.default},function(_formAppForm){AppForm=_formAppForm.default},function(_webCommandsAppCommands){AppCommands=_webCommandsAppCommands.default},function(_webAtomsDateTimeDistDateTime){DateTime=_webAtomsDateTimeDistDateTime.default},function(_controlsQrcodeQRCode){QRCode=_controlsQrcodeQRCode.default}],execute:function(){isSocialMail=/socialmail\.(me|in)/i.test(location.href)||/\d+.\d+.\d+.\d+/i.test(location.href);_export("default",LoginPage=class LoginPage extends ContentPage{constructor(){super(...arguments);this.password=""}init(){return __awaiter(this,void 0,void 0,(function*(){this.footerRenderer=()=>XNode.create("div",{"data-layout":"row"},XNode.create("a",{target:"_blank","data-margin-left":"auto",href:"https://socialmail.me"},"Social Mail"));this.hideToolbar=true;this.model=LoginSession.create({});this.model.userName="";this.model.checkPassword="";this.model.timeToken="";this.model.oneTimePassword="";this.render(XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,XNode.create("h3",null,"Sign in to continue"),XNode.create(FormField,{label:"Username"},XNode.create("input",{autofocus:true,value:Bind.twoWaysImmediate((()=>this.model.userName))})),XNode.create(FormField,{label:"Password"},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.checkPassword))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"data-layout":"accent-button","data-submit-event":"login",text:"Login"})),isSocialMail&&XNode.create("div",{"data-layout":"row"},XNode.create("span",{"data-click-event":"forgot-password","data-layout":"link"},"Forgot password?")),isSocialMail&&XNode.create("div",{"data-layout":"row"},XNode.create("a",{"data-click-event":"route",href:AppCommands.signup.displayRoute({})},"Sign Up"))))))}))}login(){return __awaiter(this,void 0,void 0,(function*(){this.model.dateUpdated=DateTime.now;const status=yield this.userService.login(this.model);if(!status){return}if(status==="change-password"){yield this.showChangePassword();return}this.showOtherFactors()}))}showOtherFactors(){const smsConfig=this.model.verificationToken;this.renderer=XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,(smsConfig===null||smsConfig===void 0?void 0:smsConfig.smsConfig)&&XNode.create(QRCode,{smsConfig:smsConfig.smsConfig}),XNode.create("h4",null,"OR"),XNode.create("h4",null,"Enter Authenticator Code"),XNode.create(FormField,{label:"Code"},XNode.create("input",{autofocus:true,type:"tel",value:Bind.twoWaysImmediate((()=>this.model.timeToken))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"event-click":()=>this.showOTP(),"data-layout":"link"},"Enter One Time Password instead.")),XNode.create("div",{"data-layout":"command-row"},XNode.create(SaveIconTextButton,{"event-click":()=>this.login(),text:"Go"}))))}showOTP(){this.renderer=XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,XNode.create("h4",null,"Enter One Time Password"),XNode.create(FormField,{label:"Password"},XNode.create("input",{autofocus:true,type:"tel",value:Bind.twoWaysImmediate((()=>this.model.oneTimePassword))})),XNode.create("div",{"data-layout":"row"},XNode.create("button",{"event-click":()=>this.showOtherFactors(),"data-layout":"link"},"Enter Authenticator Code instad.")),XNode.create("div",{"data-layout":"command-row"},XNode.create(SaveIconTextButton,{"event-click":()=>this.login(),text:"Go"}))))}showChangePassword(){return __awaiter(this,void 0,void 0,(function*(){this.model.newPassword="";this.renderer=XNode.create("div",null,XNode.create("div",{"data-layout":"center-all"},XNode.create(AppForm,null,XNode.create("div",null,"Update your password, your one time password is expired."),XNode.create(FormField,{label:"Password",autofocus:true,required:true,error:Bind.oneWay((()=>Validators.isValidPassword(this.password)?"":"Password must contain one symbol, one number and should be minimum 7 characters"))},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.password))})),XNode.create(PasswordStrength,{password:Bind.oneWay((()=>this.password))}),XNode.create(FormField,{label:"Password Again",required:true,error:Bind.oneWay((()=>this.model.newPassword!==this.password?"Passwords do not match":""))},XNode.create(PasswordBox,{value:Bind.twoWaysImmediate((()=>this.model.newPassword))})),XNode.create("div",{"data-layout":"command-row"},XNode.create("button",{"data-submit-event":"login",text:"Change Password & Login"})))))}))}forgotPassword(){return __awaiter(this,void 0,void 0,(function*(){if(isSocialMail){PageNavigator.openPage(ForgotPassword);return}yield PopupService.alert({message:"Please contact your administrator"})}))}});__decorate([InjectProperty,__metadata("design:type",LoginService)],LoginPage.prototype,"userService",void 0);__decorate([Action({onEvent:"login"}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],LoginPage.prototype,"login",null);__decorate([Action({onEvent:"forgot-password"}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",Promise)],LoginPage.prototype,"forgotPassword",null)}}}));AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/pages/user/login/LoginPage");System.register(["tslib","@web-atoms/core/dist/core/XNode","@web-atoms/core/dist/style/styled"],(function(_export,_context){"use strict";var __rest,XNode,styled;function MenuItem(_a){var{label,icon=void 0,click=undefined,title=label,description=void 0,href="",commandLink="",target=undefined,bell=void 0,bellTitle=void 0,bellClick=void 0}=_a,a=__rest(_a,["label","icon","click","title","description","href","commandLink","target","bell","bellTitle","bellClick"]);return href||commandLink?XNode.create("a",Object.assign({"data-layout":"menu-item","data-text-decoration":"none",title,"data-click-event":commandLink?"route":void 0,href:href||commandLink,target,"event-click":click},a),icon&&XNode.create("i",{class:icon}),XNode.create("span",{text:label}),description&&XNode.create("small",{text:description}),bell!==void 0&&XNode.create("i",Object.assign({"data-element":"badge",title:bellTitle,class:bell?"fad fa-bell":"fad fa-bell-slash"},typeof bellClick==="string"?{"data-click-event":bellClick}:{"data-click-event":"none","event-click":bellClick}))):XNode.create("div",Object.assign({title,"data-layout":"menu-item","event-click":click},a),icon&&XNode.create("i",{class:icon}),XNode.create("span",{text:label}),description&&XNode.create("small",{text:description}),bell!==void 0&&XNode.create("i",{"data-click-event":bellClick,"data-element":"badge",title:bellTitle,class:bell?"fad fa-bell":"fad fa-bell-slash"}))}_export("default",MenuItem);return{setters:[function(_tslib){__rest=_tslib.__rest},function(_webAtomsCoreDistCoreXNode){XNode=_webAtomsCoreDistCoreXNode.default},function(_webAtomsCoreDistStyleStyled){styled=_webAtomsCoreDistStyleStyled.default}],execute:function(){styled.css`
4986
4986
  display: grid;
4987
4987
  grid-template-columns: auto 1fr auto;
4988
4988
  grid-template-rows: 1fr auto;