Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

accountmanager.js 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3. return new (P || (P = Promise))(function (resolve, reject) {
  4. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  5. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  7. step((generator = generator.apply(thisArg, _arguments || [])).next());
  8. });
  9. };
  10. var Unibase;
  11. (function (Unibase) {
  12. let Platform;
  13. (function (Platform) {
  14. let Membership;
  15. (function (Membership) {
  16. let Managers;
  17. (function (Managers) {
  18. class AccountManager extends Platform.Core.BaseManager {
  19. validateLogin(request) {
  20. return __awaiter(this, void 0, void 0, function* () {
  21. const url = _appsettings.authentication_url() + 'account/login';
  22. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  23. var actionResponse = response;
  24. return actionResponse;
  25. });
  26. });
  27. }
  28. changePassword(request) {
  29. var identity = Membership.Infos.Identity.getCurrentUser();
  30. identity.userId;
  31. }
  32. getIdentity(session) {
  33. Membership.Infos.Identity.setCurrentUser(null);
  34. }
  35. getIndustries() {
  36. return __awaiter(this, void 0, void 0, function* () {
  37. const url = 'account/getindustries';
  38. return yield this.dataHelper().getAsync(url).then(function (response) {
  39. var selectResponse = response;
  40. return selectResponse;
  41. }).fail(function () {
  42. });
  43. });
  44. }
  45. anonymousLogin() {
  46. return __awaiter(this, void 0, void 0, function* () {
  47. const url = 'account/anonymouslogin';
  48. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  49. var actionResponse = response;
  50. return actionResponse;
  51. });
  52. });
  53. }
  54. parentanonymouslogin() {
  55. return __awaiter(this, void 0, void 0, function* () {
  56. const url = 'account/parentanonymouslogin';
  57. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  58. var actionResponse = response;
  59. return actionResponse;
  60. });
  61. });
  62. }
  63. getUser(phone, email) {
  64. return __awaiter(this, void 0, void 0, function* () {
  65. const url = 'account/getuserbyphoneormail/' + phone + '/' + email;
  66. return yield this.dataHelper().getAsync(url).then(function (response) {
  67. var selectResponse = response;
  68. return selectResponse;
  69. }).fail(function () {
  70. });
  71. });
  72. }
  73. sendOtp(request) {
  74. return __awaiter(this, void 0, void 0, function* () {
  75. const url = 'account/sendotp';
  76. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  77. return response;
  78. }).fail(function () {
  79. });
  80. });
  81. }
  82. verifyOtp(request) {
  83. return __awaiter(this, void 0, void 0, function* () {
  84. const url = 'account/verifyotp';
  85. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  86. return response;
  87. }).fail(function () {
  88. });
  89. });
  90. }
  91. signUp_Old(request) {
  92. return __awaiter(this, void 0, void 0, function* () {
  93. const url = 'account/registertenant';
  94. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  95. return response;
  96. }).fail(function () {
  97. });
  98. });
  99. }
  100. signUp(request) {
  101. return __awaiter(this, void 0, void 0, function* () {
  102. const url = 'account/AllocateEmptyTenantAsync';
  103. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  104. return response;
  105. }).fail(function () {
  106. });
  107. });
  108. }
  109. getTenants() {
  110. return __awaiter(this, void 0, void 0, function* () {
  111. const url = 'account/gettenants';
  112. return yield this.dataHelper().getAsync(url).then(function (response) {
  113. var selectResponse = response;
  114. return selectResponse;
  115. }).fail(function () {
  116. });
  117. });
  118. }
  119. getUserTenants(phoneOrEmail) {
  120. return __awaiter(this, void 0, void 0, function* () {
  121. const url = 'account/gettenants/' + phoneOrEmail;
  122. return yield this.dataHelper().getAsync(url).then(function (response) {
  123. var selectResponse = response;
  124. return selectResponse;
  125. }).fail(function () {
  126. });
  127. });
  128. }
  129. registerUser(request) {
  130. return __awaiter(this, void 0, void 0, function* () {
  131. const url = 'account/registeruser';
  132. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  133. return response;
  134. }).fail(function () {
  135. });
  136. });
  137. }
  138. getContact(phoneOrEmail, tenantId) {
  139. return __awaiter(this, void 0, void 0, function* () {
  140. const url = 'account/getcontactbyphoneormail/' + phoneOrEmail + '/' + tenantId;
  141. return yield this.dataHelper().getAsync(url).then(function (response) {
  142. return response;
  143. }).fail(function () {
  144. });
  145. });
  146. }
  147. updatePassword(request) {
  148. return __awaiter(this, void 0, void 0, function* () {
  149. const url = 'account/updatepassword';
  150. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  151. return response;
  152. }).fail(function () {
  153. });
  154. });
  155. }
  156. getfollowerbyfollowid(userid, followid) {
  157. return __awaiter(this, void 0, void 0, function* () {
  158. const url = 'apis/v4/unibase/platform/followers/getfollowerbyfollowid/userid/' + userid + '/followid/' + followid;
  159. return yield this.dataHelper().getAsync(url).then(function (response) {
  160. if (response.result !== null && response.result !== "")
  161. response.result = JSON.parse(response.result);
  162. return response;
  163. }).fail(function () {
  164. });
  165. });
  166. }
  167. getfollowermanagers(userId) {
  168. return __awaiter(this, void 0, void 0, function* () {
  169. const url = 'apis/v4/unibase/platform/followers/getmanagerfollowersbyuserid/userid/' + userId;
  170. return yield this.dataHelper().getAsync(url).then(function (response) {
  171. if (response.result !== null)
  172. response.result = JSON.parse(response.result);
  173. return response;
  174. }).fail(function () {
  175. });
  176. });
  177. }
  178. deleteManagerFollower(managerFollowerId, contactId) {
  179. return __awaiter(this, void 0, void 0, function* () {
  180. const url = 'apis/v4/unibase/platform/followers/deletemanagerfollower/managerfollowerid/' + managerFollowerId + '/contactid/' + contactId;
  181. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  182. if (response.result !== null)
  183. response.result = JSON.parse(response.result);
  184. return response;
  185. });
  186. });
  187. }
  188. savemanager(obj) {
  189. return __awaiter(this, void 0, void 0, function* () {
  190. const url = 'apis/v4/unibase/platform/followers/savemanager';
  191. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  192. if (response.result != null) {
  193. response.result = JSON.parse(response.result);
  194. }
  195. return response;
  196. });
  197. });
  198. }
  199. deleteFollower(followerId, contactId) {
  200. return __awaiter(this, void 0, void 0, function* () {
  201. const url = 'apis/v4/unibase/platform/followers/deletefollower/followerid/' + followerId + '/contactid/' + contactId;
  202. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  203. if (response.result !== null)
  204. response.result = JSON.parse(response.result);
  205. return response;
  206. });
  207. });
  208. }
  209. savefollower(obj) {
  210. return __awaiter(this, void 0, void 0, function* () {
  211. const url = 'apis/v4/unibase/platform/followers/savefollower';
  212. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  213. if (response.result != null) {
  214. response.result = JSON.parse(response.result);
  215. }
  216. return response;
  217. });
  218. });
  219. }
  220. lobs(tenantid) {
  221. return __awaiter(this, void 0, void 0, function* () {
  222. const url = 'account/getlobs/' + tenantid + '';
  223. return yield this.dataHelper().getAsync(url).then(function (response) {
  224. var selectResponse = response;
  225. return selectResponse;
  226. }).fail(function () {
  227. });
  228. });
  229. }
  230. getchildtags(tenantid) {
  231. return __awaiter(this, void 0, void 0, function* () {
  232. const url = 'account/getchildtags/' + tenantid + '';
  233. return yield this.dataHelper().getAsync(url).then(function (response) {
  234. var selectResponse = response;
  235. return selectResponse;
  236. }).fail(function () {
  237. });
  238. });
  239. }
  240. registercontact(contactname, phonenumber, emailaddress, tagid, tenantid, password, firmname) {
  241. return __awaiter(this, void 0, void 0, function* () {
  242. const url = 'account/registercontact/' + contactname + '/' + phonenumber + '/' + emailaddress + '/' + tagid + '/' + tenantid + '/' + password + '/' + firmname + '';
  243. return yield this.dataHelper().getAsync(url).then(function (response) {
  244. var selectResponse = response;
  245. return selectResponse;
  246. }).fail(function () {
  247. });
  248. });
  249. }
  250. childlobs(LobId, tenantid) {
  251. return __awaiter(this, void 0, void 0, function* () {
  252. const url = 'account/getchildlobs/' + LobId + '/' + tenantid;
  253. return yield this.dataHelper().getAsync(url).then(function (response) {
  254. var selectResponse = response;
  255. return selectResponse;
  256. }).fail(function () {
  257. });
  258. });
  259. }
  260. registercmnUser(request) {
  261. return __awaiter(this, void 0, void 0, function* () {
  262. const url = 'account/register';
  263. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  264. return response;
  265. }).fail(function () {
  266. });
  267. });
  268. }
  269. register(request) {
  270. return __awaiter(this, void 0, void 0, function* () {
  271. const url = 'account/contactregister';
  272. return yield this.dataHelper().postAsync(url, request).then(function (response) {
  273. return response;
  274. }).fail(function () {
  275. });
  276. });
  277. }
  278. userLogin(unibaseid) {
  279. return __awaiter(this, void 0, void 0, function* () {
  280. const serverurl = 'Account/UserLogin/UserName/' + unibaseid;
  281. return yield this.dataHelper().postAsync(serverurl, null).then(function (response) {
  282. return response;
  283. });
  284. });
  285. }
  286. userLogoff(sessionid) {
  287. return __awaiter(this, void 0, void 0, function* () {
  288. const serverurl = 'Account/UserLogOff/Session/' + sessionid;
  289. return yield this.dataHelper().postAsync(serverurl, null).then(function (response) {
  290. return response;
  291. });
  292. });
  293. }
  294. deleteUserDevices(unibaseid) {
  295. return __awaiter(this, void 0, void 0, function* () {
  296. const url = 'apis/v4/unibase/platform/common/deleteuserdevices/unibaseid/' + unibaseid;
  297. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  298. if (response.result !== null)
  299. response.result = JSON.parse(response.result);
  300. return response;
  301. });
  302. });
  303. }
  304. updateUserDeviceStatus(deviceuniqueid, status) {
  305. return __awaiter(this, void 0, void 0, function* () {
  306. const url = 'apis/v4/unibase/platform/common/updateuserdevicestatus/deviceuniqueid/' + deviceuniqueid + '/status/' + status;
  307. return yield this.dataHelper().postAsync(url, null).then(function (response) {
  308. if (response.result !== null)
  309. response.result = JSON.parse(response.result);
  310. return response;
  311. });
  312. });
  313. }
  314. generatesession(token) {
  315. return __awaiter(this, void 0, void 0, function* () {
  316. const serverurl = 'Account/GenerateSession/Token/' + token;
  317. return yield this.dataHelper().postAsync(serverurl, null).then(function (response) {
  318. return response;
  319. });
  320. });
  321. }
  322. generatesessionbytenantid(token, tid) {
  323. return __awaiter(this, void 0, void 0, function* () {
  324. const serverurl = 'Account/GenerateSession/Token/' + token + '/tid/' + tid;
  325. return yield this.dataHelper().getAsync(serverurl).then(function (response) {
  326. return response;
  327. });
  328. });
  329. }
  330. setTenantAsDefault(tenantid, username) {
  331. return __awaiter(this, void 0, void 0, function* () {
  332. const serverurl = 'Account/SetTenantAsDefault/TenantId/' + tenantid + '/UserName/' + username;
  333. return yield this.dataHelper().postAsync(serverurl, null).then(function (response) {
  334. return response;
  335. });
  336. });
  337. }
  338. savesupportusers(obj) {
  339. return __awaiter(this, void 0, void 0, function* () {
  340. const url = 'Account/SaveSupportUser';
  341. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  342. if (response.result !== null)
  343. response.result = JSON.parse(response.result);
  344. return response;
  345. }).fail(function () {
  346. });
  347. });
  348. }
  349. GetSupportUserSession(SessionId) {
  350. return __awaiter(this, void 0, void 0, function* () {
  351. const serverurl = 'Account/GetSupportUserSession/SessionId/' + SessionId;
  352. return yield this.dataHelper().getAsync(serverurl).then(function (response) {
  353. return response;
  354. });
  355. });
  356. }
  357. getuserbyuserid(userid) {
  358. return __awaiter(this, void 0, void 0, function* () {
  359. const url = 'Account/GetUser/' + userid;
  360. return yield this.dataHelper().getAsync(url).then(function (response) {
  361. return response;
  362. }).fail(function () {
  363. });
  364. });
  365. }
  366. getdomainloadjs() {
  367. return __awaiter(this, void 0, void 0, function* () {
  368. const url = _appsettings.authentication_url() + 'Account/Domain';
  369. return yield this.dataHelper().getAsync(url).then(function (response) {
  370. return response;
  371. }).fail(function () {
  372. });
  373. });
  374. }
  375. getSharedTenants() {
  376. return __awaiter(this, void 0, void 0, function* () {
  377. const url = 'Account/Tenants/GetSharedTenants';
  378. return yield this.dataHelper().getAsync(url).then(function (response) {
  379. return response;
  380. }).fail(function () {
  381. });
  382. });
  383. }
  384. switchtosecondary(EnableSecData) {
  385. return __awaiter(this, void 0, void 0, function* () {
  386. const url = 'Account/SwitchtoSecondary/Enable/' + EnableSecData;
  387. return yield this.dataHelper().getAsync(url).then(function (response) {
  388. if (response.result !== null) {
  389. Unibase.Platform.Membership.Infos.Identity.setCurrentUser(response.result);
  390. window.location.reload();
  391. }
  392. }).fail(function () {
  393. });
  394. });
  395. }
  396. switchtotenant(tenantid) {
  397. return __awaiter(this, void 0, void 0, function* () {
  398. const url = 'Account/SwitchtoTenant/' + tenantid;
  399. return yield this.dataHelper().getAsync(url).then(function (response) {
  400. if (response.result !== null) {
  401. Unibase.Platform.Membership.Infos.Identity.setCurrentUser(response.result);
  402. window.location.reload();
  403. }
  404. }).fail(function () {
  405. });
  406. });
  407. }
  408. getconnectedtenant(parenttenantid, childtenant) {
  409. return __awaiter(this, void 0, void 0, function* () {
  410. const url = 'account/gettenant/' + parenttenantid + '/' + childtenant;
  411. return yield this.dataHelper().getAsync(url).then(function (response) {
  412. var selectResponse = response;
  413. return selectResponse;
  414. }).fail(function () {
  415. });
  416. });
  417. }
  418. IsValidSession() {
  419. return __awaiter(this, void 0, void 0, function* () {
  420. const url = _appsettings.authentication_url() + 'account/session/validate';
  421. return yield this.dataHelper().getAsync(url).then(function (response) {
  422. return response;
  423. }).fail(function () {
  424. });
  425. });
  426. }
  427. MapUser(orgContactId, assaignedTenantId) {
  428. return __awaiter(this, void 0, void 0, function* () {
  429. const url = 'apis/v4/bizgaze/crm/organization/usermaping/orgcontactid/' + orgContactId + '/assaignedtenantid/' + assaignedTenantId;
  430. return yield this.dataHelper().getAsync(url).then(function (response) {
  431. if (response.result !== null)
  432. response.result = JSON.parse(response.result);
  433. return response;
  434. });
  435. });
  436. }
  437. updateUserDetails(obj) {
  438. return __awaiter(this, void 0, void 0, function* () {
  439. const url = 'apis/v4/unibase/platform/membership/updateuserdetails';
  440. return yield this.dataHelper().postAsync(url, obj).then(function (response) {
  441. if (response.result != null) {
  442. response.result = JSON.parse(response.result);
  443. }
  444. return response;
  445. });
  446. });
  447. }
  448. ChangeUsersLockStatus(status, tenantid) {
  449. return __awaiter(this, void 0, void 0, function* () {
  450. const serverurl = 'account/Status/' + status + '/TenantId/' + tenantid + '/ChangeUsersLockStatus';
  451. return yield this.dataHelper().postAsync(serverurl, null).then(function (response) {
  452. return response;
  453. });
  454. });
  455. }
  456. ValidateUsersLockStatus(tenantid) {
  457. return __awaiter(this, void 0, void 0, function* () {
  458. const serverurl = 'account/ValidateUsersLockStatus/TenantId/' + tenantid;
  459. return yield this.dataHelper().postAsync(serverurl, null).then(function (response) {
  460. return response;
  461. });
  462. });
  463. }
  464. getTenantUserByUserId(userId) {
  465. return __awaiter(this, void 0, void 0, function* () {
  466. const url = 'apis/v4/unibase/platform/users/getuserbyuserid/' + userId;
  467. return yield this.dataHelper().getAsync(url).then(function (response) {
  468. if (response.result !== null)
  469. response.result = JSON.parse(response.result);
  470. return response;
  471. });
  472. });
  473. }
  474. static Instance() {
  475. return new AccountManager();
  476. }
  477. }
  478. Managers.AccountManager = AccountManager;
  479. })(Managers = Membership.Managers || (Membership.Managers = {}));
  480. })(Membership = Platform.Membership || (Platform.Membership = {}));
  481. })(Platform = Unibase.Platform || (Unibase.Platform = {}));
  482. })(Unibase || (Unibase = {}));