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 Apps; (function (Apps) { let Managers; (function (Managers) { class AppManager extends Platform.Core.BaseManager { getAppGroups() { return __awaiter(this, void 0, void 0, function* () { let appgroupname = 'Sales'; const url = 'apis/v4/unibase/platform/apps/' + appgroupname; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } previewDocument(documentFileId) { var instance = this; Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/files/managers/filemanager.js', function () { Unibase.Platform.Files.Managers.FileManager.Instance().getDocumentFile(documentFileId).then(function (response) { var filePath = response.result.DocumentFilePath; var result = response.result; var byteCharacters = atob(result.FileData); var byteNumbers = new Array(byteCharacters.length); for (var i = 0; i < byteCharacters.length; i++) { byteNumbers[i] = byteCharacters.charCodeAt(i); } var byteArray = new Uint8Array(byteNumbers); var file = new Blob([byteArray], { type: result.DocumentFilePath + ';base64' }); var fileURL = URL.createObjectURL(file); var fileName = result.DocumentFileName + "." + result.FileType; window.open(result.DocumentFilePath); }); }); } refreshApps() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/refreshapps/np'; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getParentApps() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getparentapps'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } updateAppProvider(appproviderid, datalistid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/updatereportid/appproviderid/' + appproviderid + '/datalistid/' + datalistid; var result = ""; yield this.dataHelper().post(url, null, function (response) { result = JSON.parse(response.result); }, function (response) { result = JSON.parse(response.result); }); return result; }); } saveDynamicApp(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/savedynamicapp'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } updateDynamicApp(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/updatedynamicapp'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } geAppInfoandappConfigurationInfo(installeappid, appconfigurationid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getappinfoandconfigurationinfo/installedappid/' + installeappid + '/appconfigurationid/' + appconfigurationid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } updateAppStatus(installedAppId, statusId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/updateappstatus/installedappid/' + installedAppId + '/statusid/' + statusId; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } updateWishList(installedAppId, statusId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/updatewishlist/installedappid/' + installedAppId + '/status/' + statusId; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } saveStatus(statusid, doctypeid, recordid, versionguid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/savestatus/statusid/' + statusid + '/doctypeid/' + doctypeid + '/recordid/' + recordid + '/versionguid/' + versionguid; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getInstallApp(installeappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getinstalledapp/id/' + installeappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getAppVersion(versionid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getappversionid/id/' + versionid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getApp(appid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getappid/id/' + appid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getDocumentFileId(documentid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getdocumentfileid/id/' + documentid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getWidgetVersion(widgetid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getwidgetid/id/' + widgetid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getDashboardVersion(portletid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getportletid/id/' + portletid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getCurrentDashboardVersion(portletid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getcurrentportletversion/id/' + portletid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getReportVersion(reportId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getreportid/id/' + reportId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getCurrentReportVersion(reportId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getcurrentversiond/id/' + reportId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getAllApps(installeappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getallapps/installedappid/' + installeappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getInstallAppId(uniqueid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getinstalledappid/uniqueid/' + uniqueid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } getInstalledApps() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getinstalledapps'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getChildApps(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getchildapps/parentid/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getChilds(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getchilds/parentid/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getdependentApps(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getdependentapps/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } updateAppIndex(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/updateindexes/'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } duplicateApp(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/duplicateapp'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getAppPermission(apppermissionid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getapppermission/apppermissionid/' + apppermissionid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getAppPermissions(installedAppId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getapppermissions/installedappid/' + installedAppId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } saveAppPermission(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/saveapppermissionid'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } deleteAppPermission(apppermissionid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/deleteapppermission/apppermissionid/' + apppermissionid; return yield this.dataHelper().postAsync(url, null); }); } getAppPermissionBySystemName(installedAppId, SystemName) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getapppermissions/installedappid/' + installedAppId + "/systemname/" + SystemName; var approlesettings; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getAllAppConfigurations(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getappconfigurations/installedappid/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getListAppConfigurations(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/listappconfigurations/installedappid/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getDetailAppConfigurations(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/detailappconfigurations/installedappid/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getFormAppConfigurations(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getformconfigurations/installedappid/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getAppConfiguration(appconfigurationid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getconfiguration/id/' + appconfigurationid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getAppConfigurationByUniqueId(uniqueId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getconfiguration/uniqueid/' + uniqueId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } saveAppConfiguration(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/saveappconfiguration'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } deleteAppConfiguration(appConfigurationId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/delete/id/' + appConfigurationId; return yield this.dataHelper().postAsync(url, null); }); } updateConfigurationStatus(appConfigurationId, statusId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/updatestatus/appconfigurationid/' + appConfigurationId + '/statusid/' + statusId; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getUserApps() { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/userapps/contactid/" + Platform.Membership.Infos.Identity.getCurrentUser().userId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getMyApps() { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/myapps"; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } exportApp(installedappid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/exportapp/' + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = response.result; } return response; }); }); } exportAppRoleSettings() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/exportapprolesettings'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = response.result; } return response; }); }); } saveVersion(obj) { return __awaiter(this, void 0, void 0, function* () { debugger; const url = 'apis/v4/unibase/platform/apps/saveversion'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getCurrentVersionByApp(installedappid) { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/getcurrentversionbyapp/" + installedappid; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } upgradeApp(installedappid, versionno) { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/upgradeappversion/installedappid/" + installedappid + "/versionno/" + versionno; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } upgradeAvailableApp(installedappid) { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/UpgradeAppAvailable/installedappid/" + installedappid; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } upgradeWidgetVersionAvailable(widgetid) { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/upgradewidgetversionavailable/widgetid/" + widgetid; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } upgradeDashboardVersionAvailable(portletid) { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/upgradedashboardversionavailable/portletid/" + portletid; return yield this.dataHelper().postAsync(url, null).then(function (response) { debugger; if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } upgradeReportVersionAvailable(reportId) { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/upgradereportversion/reportid/" + reportId; return yield this.dataHelper().postAsync(url, null).then(function (response) { debugger; if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } checkAppPermission(installedAppId) { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/checkapppermission/installedappid/" + installedAppId; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } exportAppPermissions(appId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/exportapppermissions/installedappid/' + appId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = response.result; } return response; }); }); } getSettingApps() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getsettingapps'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getDevApps() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getdevapps'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } executeProc(procName) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/executestoredprocedure/procname/' + procName; return yield this.dataHelper().postAsync(url, '{}').then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } getActiveUserApps() { return __awaiter(this, void 0, void 0, function* () { var url = "apis/v4/unibase/platform/apps/getactiveuserapps"; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getConfigurationApps() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/getconfigurationapps'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { response.result = JSON.parse(response.result); } return response; }); }); } static Instance() { if (this._instance === undefined) this._instance = new AppManager(); return this._instance; } } Managers.AppManager = AppManager; })(Managers = Apps.Managers || (Apps.Managers = {})); })(Apps = Platform.Apps || (Platform.Apps = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));