var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var Unibase; (function (Unibase) { let Platform; (function (Platform) { let Membership; (function (Membership) { let Managers; (function (Managers) { class AccountManager extends Platform.Core.BaseManager { validateLogin(request) { return __awaiter(this, void 0, void 0, function* () { const url = _appsettings.authentication_url() + 'account/login'; return yield this.dataHelper().postAsync(url, request).then(function (response) { var actionResponse = response; return actionResponse; }); }); } changePassword(request) { var identity = Membership.Infos.Identity.getCurrentUser(); identity.userId; } getIdentity(session) { Membership.Infos.Identity.setCurrentUser(null); } getIndustries() { return __awaiter(this, void 0, void 0, function* () { const url = 'account/getindustries'; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } anonymousLogin() { return __awaiter(this, void 0, void 0, function* () { const url = 'account/anonymouslogin'; return yield this.dataHelper().postAsync(url, null).then(function (response) { var actionResponse = response; return actionResponse; }); }); } parentanonymouslogin() { return __awaiter(this, void 0, void 0, function* () { const url = 'account/parentanonymouslogin'; return yield this.dataHelper().postAsync(url, null).then(function (response) { var actionResponse = response; return actionResponse; }); }); } getUser(phone, email) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/getuserbyphoneormail/' + phone + '/' + email; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } sendOtp(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/sendotp'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } verifyOtp(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/verifyotp'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } signUp_Old(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/registertenant'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } signUp(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/AllocateEmptyTenantAsync'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } getTenants() { return __awaiter(this, void 0, void 0, function* () { const url = 'account/gettenants'; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } getUserTenants(phoneOrEmail) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/gettenants/' + phoneOrEmail; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } registerUser(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/registeruser'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } getContact(phoneOrEmail, tenantId) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/getcontactbyphoneormail/' + phoneOrEmail + '/' + tenantId; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }).fail(function () { }); }); } updatePassword(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/updatepassword'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } getfollowerbyfollowid(userid, followid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/followers/getfollowerbyfollowid/userid/' + userid + '/followid/' + followid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null && response.result !== "") response.result = JSON.parse(response.result); return response; }).fail(function () { }); }); } getfollowermanagers(userId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/followers/getmanagerfollowersbyuserid/userid/' + userId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }).fail(function () { }); }); } deleteManagerFollower(managerFollowerId, contactId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/followers/deletemanagerfollower/managerfollowerid/' + managerFollowerId + '/contactid/' + contactId; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } savemanager(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/followers/savemanager'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } deleteFollower(followerId, contactId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/followers/deletefollower/followerid/' + followerId + '/contactid/' + contactId; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } savefollower(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/followers/savefollower'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } lobs(tenantid) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/getlobs/' + tenantid + ''; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } getchildtags(tenantid) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/getchildtags/' + tenantid + ''; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } registercontact(contactname, phonenumber, emailaddress, tagid, tenantid, password, firmname) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/registercontact/' + contactname + '/' + phonenumber + '/' + emailaddress + '/' + tagid + '/' + tenantid + '/' + password + '/' + firmname + ''; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } childlobs(LobId, tenantid) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/getchildlobs/' + LobId + '/' + tenantid; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } registercmnUser(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/register'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } register(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/contactregister'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }).fail(function () { }); }); } userLogin(unibaseid) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'Account/UserLogin/UserName/' + unibaseid; return yield this.dataHelper().postAsync(serverurl, null).then(function (response) { return response; }); }); } userLogoff(sessionid) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'Account/UserLogOff/Session/' + sessionid; return yield this.dataHelper().postAsync(serverurl, null).then(function (response) { return response; }); }); } deleteUserDevices(unibaseid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/common/deleteuserdevices/unibaseid/' + unibaseid; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } updateUserDeviceStatus(deviceuniqueid, status) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/common/updateuserdevicestatus/deviceuniqueid/' + deviceuniqueid + '/status/' + status; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } generatesession(token) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'Account/GenerateSession/Token/' + token; return yield this.dataHelper().postAsync(serverurl, null).then(function (response) { return response; }); }); } generatesessionbytenantid(token, tid) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'Account/GenerateSession/Token/' + token + '/tid/' + tid; return yield this.dataHelper().getAsync(serverurl).then(function (response) { return response; }); }); } setTenantAsDefault(tenantid, username) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'Account/SetTenantAsDefault/TenantId/' + tenantid + '/UserName/' + username; return yield this.dataHelper().postAsync(serverurl, null).then(function (response) { return response; }); }); } savesupportusers(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'Account/SaveSupportUser'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }).fail(function () { }); }); } GetSupportUserSession(SessionId) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'Account/GetSupportUserSession/SessionId/' + SessionId; return yield this.dataHelper().getAsync(serverurl).then(function (response) { return response; }); }); } getuserbyuserid(userid) { return __awaiter(this, void 0, void 0, function* () { const url = 'Account/GetUser/' + userid; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }).fail(function () { }); }); } getdomainloadjs() { return __awaiter(this, void 0, void 0, function* () { const url = _appsettings.authentication_url() + 'Account/Domain'; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }).fail(function () { }); }); } getSharedTenants() { return __awaiter(this, void 0, void 0, function* () { const url = 'Account/Tenants/GetSharedTenants'; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }).fail(function () { }); }); } switchtosecondary(EnableSecData) { return __awaiter(this, void 0, void 0, function* () { const url = 'Account/SwitchtoSecondary/Enable/' + EnableSecData; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { Unibase.Platform.Membership.Infos.Identity.setCurrentUser(response.result); window.location.reload(); } }).fail(function () { }); }); } switchtotenant(tenantid) { return __awaiter(this, void 0, void 0, function* () { const url = 'Account/SwitchtoTenant/' + tenantid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { Unibase.Platform.Membership.Infos.Identity.setCurrentUser(response.result); window.location.reload(); } }).fail(function () { }); }); } getconnectedtenant(parenttenantid, childtenant) { return __awaiter(this, void 0, void 0, function* () { const url = 'account/gettenant/' + parenttenantid + '/' + childtenant; return yield this.dataHelper().getAsync(url).then(function (response) { var selectResponse = response; return selectResponse; }).fail(function () { }); }); } IsValidSession() { return __awaiter(this, void 0, void 0, function* () { const url = _appsettings.authentication_url() + 'account/session/validate'; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }).fail(function () { }); }); } MapUser(orgContactId, assaignedTenantId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/crm/organization/usermaping/orgcontactid/' + orgContactId + '/assaignedtenantid/' + assaignedTenantId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } updateUserDetails(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/membership/updateuserdetails'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } ChangeUsersLockStatus(status, tenantid) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'account/Status/' + status + '/TenantId/' + tenantid + '/ChangeUsersLockStatus'; return yield this.dataHelper().postAsync(serverurl, null).then(function (response) { return response; }); }); } ValidateUsersLockStatus(tenantid) { return __awaiter(this, void 0, void 0, function* () { const serverurl = 'account/ValidateUsersLockStatus/TenantId/' + tenantid; return yield this.dataHelper().postAsync(serverurl, null).then(function (response) { return response; }); }); } getTenantUserByUserId(userId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/users/getuserbyuserid/' + userId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } static Instance() { return new AccountManager(); } } Managers.AccountManager = AccountManager; })(Managers = Membership.Managers || (Membership.Managers = {})); })(Membership = Platform.Membership || (Platform.Membership = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));