@eway-crm/connector 1.0.260 → 1.0.261

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.
package/lib/esm/index.js CHANGED
@@ -5,4 +5,4 @@ import e from"axios";import*as t from"universal-base64url";import r from"jwt-dec
5
5
  * @license Licensed under MIT license
6
6
  * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
7
7
  * @version v4.2.8+1e68dce6
8
- */class l{}l.rcSuccess="rcSuccess",l.rcBadSession="rcBadSession",l.rcDuplicateContact="rcDuplicateContact",l.rcWebServiceMoved="rcWebServiceMoved",l.rcAccessDenied="rcAccessDenied",l.rcLoginUserNameChanged="rcLoginUserNameChanged",l.rcLicenseExpired="rcLicenseExpired",function(e){e.get="get",e.post="post"}(o||(o={}));class c{}c.absence="Absence",c.bonusType="BonusType",c.busyStatus="BusyStatus",c.cartType="CartType",c.companyType="CompanyType",c.contactType="ContactType",c.countryCode="CountryCode",c.currency="Currency",c.customFieldCategory="CustomFieldCategory",c.dayType="DayType",c.documentOfflineState="DocumentOfflineState",c.documentType="DocumentType",c.emailCampaignWorkflowStatus="EmailCampaignWorkflowStatus",c.emailOfflineState="EmailOfflineState",c.emailType="EmailType",c.familyStatus="FamilyStatus",c.firstContact="FirstContact",c.globalSettingsCategory="GlobalSettingsCategory",c.goalType="GoalType",c.groupColor="GroupColor",c.importance="Importance",c.journalType="JournalType",c.knowledgeLevel="KnowledgeLevel",c.knowledgeTitle="KnowledgeTitle",c.knowledgeType="KnowledgeType",c.leadType="LeadType",c.marketingType="MarketingType",c.paymentType="PaymentType",c.prefixType="PrefixType",c.productType="ProductType",c.projectOrigin="ProjectOrigin",c.projectType="ProjectType",c.reportCategory="ReportCategory",c.responseForm="ResponseForm",c.responseType="ResponseType",c.salaryDate="SalaryDate",c.salaryType="SalaryType",c.salePriceType="SalePriceType",c.sentimentTone="SentimentTone",c.suffixType="SuffixType",c.taskImportance="TaskImportance",c.tasksSnoozePeriod="TasksSnoozePeriod",c.taskStatus="TaskStatus",c.taskType="TaskType",c.trainingGrade="TrainingGrade",c.trainingTitle="TrainingTitle",c.translations="Translations",c.units="Units",c.userType="UserType",c.usStatesDistrictsTerritories="USStatesDistrictsTerritories",c.vacationType="VacationType",c.vat="VAT",c.workLoad="WorkLoad",c.workReportType="WorkReportType";class u{}u.isValidFolderName=e=>Object.values(u).includes(e),u.actions="Actions",u.additionalFields="AdditionalFields",u.bonuses="Bonuses",u.calendar="Calendar",u.capacityNotes="CapacityNotes",u.capacityNoteTypes="CapacityNoteTypes",u.carts="Carts",u.columnPermissions="ColumnPermissions",u.companies="Companies",u.contacts="Contacts",u.contactsSuggestions="ContactsSuggestions",u.currencyExchangeRates="CurrencyExchangeRates",u.documents="Documents",u.emails="Emails",u.enumTypes="EnumTypes",u.enumValues="EnumValues",u.enumValuesRelations="EnumValuesRelations",u.features="Features",u.flows="Flows",u.globalSettings="GlobalSettings",u.goals="Goals",u.goods="Goods",u.goodsInCart="GoodsInCart",u.goodsInSet="GoodsInSet",u.groups="Groups",u.history="History",u.holidays="Holidays",u.children="Children",u.individualDiscounts="IndividualDiscounts",u.invoiceItems="InvoiceItems",u.invoices="Invoices",u.itemCopyRelations="ItemCopyRelations",u.journal="Journal",u.knowledge="Knowledge",u.layouts="Layouts",u.layoutsModels="LayoutsModels",u.leads="Leads",u.ledger="Ledger",u.mappings="Mappings",u.marketing="Marketing",u.marketingList="MarketingList",u.marketingListSources="MarketingListSources",u.models="Models",u.modulePermissions="ModulePermissions",u.objectTypesOptions="ObjectTypesOptions",u.payments="Payments",u.priceListGroups="PriceListGroups",u.projectAssignments="ProjectAssignments",u.projectAssignmentsPerUserProject="ProjectAssignmentsPerUserProject",u.projectAssignmentsTotal="ProjectAssignmentsTotal",u.projectAssignmentsTotalUserProject="ProjectAssignmentsTotalUserProject",u.projectList="ProjectList",u.projects="Projects",u.projectUsersInCaPlan="ProjectUsersInCaPlan",u.relationData="RelationData",u.relations="Relations",u.reports="Reports",u.revisionsHistory="RevisionsHistory",u.salaries="Salaries",u.salePrices="SalePrices",u.prices="Prices",u.sqlObjects="SqlObjects",u.tasks="Tasks",u.recurrencePatterns="RecurrencePatterns",u.teamRoles="TeamRoles",u.templates="Templates",u.training="Training",u.unifiedRelations="UnifiedRelations",u.users="Users",u.userSettings="UserSettings",u.vacation="Vacation",u.webAccess2Options="WebAccess2Options",u.webAccessOptions="WebAccessOptions",u.workCommitments="WorkCommitments",u.workflowHistory="WorkflowHistory",u.workReports="WorkReports",u.wrongClientVersions="WrongClientVersions",u.xsltTransformations="XsltTransformations",u.xsltTransformationsModels="XsltTransformationsModels",u.getEnumTypeName=e=>e===u.bonuses?c.bonusType:e===u.carts?c.cartType:e===u.companies?c.companyType:e===u.contacts?c.contactType:e===u.documents?c.documentType:e===u.emails?c.emailType:e===u.goals?c.goalType:e===u.goods?c.productType:e===u.journal?c.journalType:e===u.knowledge?c.knowledgeType:e===u.leads?c.leadType:e===u.marketing?c.marketingType:e===u.projects?c.projectType:e===u.salaries?c.salaryType:e===u.salePrices?c.salePriceType:e===u.tasks?c.taskType:e===u.training?c.trainingTitle:e===u.users?c.userType:e===u.vacation?c.vacationType:e===u.workReports?c.workReportType:null,u.getFolderNameByEnumTypeName=e=>e===c.bonusType?u.bonuses:e===c.cartType?u.carts:e===c.companyType?u.companies:e===c.contactType?u.contacts:e===c.documentType?u.documents:e===c.emailType?u.emails:e===c.goalType?u.goals:e===c.journalType?u.journal:e===c.knowledgeType?u.knowledge:e===c.leadType?u.leads:e===c.marketingType?u.marketing:e===c.productType?u.goods:e===c.projectType?u.projects:e===c.salaryType?u.salaries:e===c.salePriceType?u.salePrices:e===c.taskType?u.tasks:e===c.trainingTitle?u.training:e===c.userType?u.users:e===c.vacationType?u.vacation:e===c.workReportType?u.workReports:null;class d{}d.getAllEmailAttachments="GetAllEmailAttachments",d.getCalendarsByItemGuids="GetCalendarsByItemGuids",d.getEmailAttachment="GetEmailAttachment",d.getItemPreview="GetItemPreview",d.getJournalsByItemGuids="GetJournalsByItemGuids",d.getMarketingCampaignsByItemGuids="GetMarketingCampaignsByItemGuids",d.getMarketingListsRecordsByItemGuids="GetMarketingListsRecordsByItemGuids",d.getRevisionHistoryRecordsByItemGuids="GetRevisionHistoryRecordsByItemGuids",d.getVacationsByItemGuids="GetVacationsByItemGuids",d.getWorkflowHistoryRecordsByItemGuids="GetWorkflowHistoryRecordsByItemGuids",d.getCompanyInformationFromTaxRegister="GetCompanyInformationFromTaxRegister",d.logIn="LogIn",d.logOut="LogOut",d.query="Query",d.queryAmount="QueryAmount",d.getServiceAuthSettings="GetServiceAuthSettings",d.getVersion="GetVersion",d.getBinaryAttachment="GetBinaryAttachment",d.getBinaryAttachmentLatestRevision="GetBinaryAttachmentLatestRevision",d.transformItem="TransformItem",d.canUnlinkItems="CanUnlinkItems",d.unlinkItems="UnlinkItems",d.getGoodsFinalPrices="GetGoodsFinalPrices",d.saveItemCopyRelation="SaveItemCopyRelation",d.getXsltTransormationDefinition="GetXsltTransformationDefinition",d.saveBinaryAttachment="SaveBinaryAttachment",d.saveBinaryXsltTransformation="SaveBinaryXsltTransformation",d.GetLoginHistory="GetLoginHistory",d.GetMyLoginHistory="GetMyLoginHistory",d.getFolderNameForApiMethod=e=>{switch(e){case u.calendar:return"Calendars";case u.journal:return"Journals";case u.marketing:return"MarketingCampaigns";case u.marketingList:return"MarketingListsRecords";case u.revisionsHistory:return"RevisionHistoryRecords";case u.vacation:return"Vacations";case u.workflowHistory:return"WorkflowHistoryRecords";default:return e}},d.getGetFolderNameByItemGuidsMethodName=e=>`Get${d.getFolderNameForApiMethod(e)}ByItemGuids`,d.getGetFolderNameMethodName=e=>`Get${d.getFolderNameForApiMethod(e)}`,d.getSearchFolderNameMethodName=e=>`Search${d.getFolderNameForApiMethod(e)}`;class m{constructor(e,t,r,n,s,o){if(this.invalidateSessionId=(e,t)=>{t&&t()},this.getSessionId=(e,t)=>{e.callWithoutSession(d.logIn,{userName:this.username,passwordHash:this.passwordHash,appVersion:this.appVersion,clientMachineIdentifier:this.clientMachineIdentifier,clientMachineName:this.clientMachineName,createSessionCookie:e.supportsGetItemPreviewMethod},e=>{this.lastSuccessfulLoginResponse=e;const r=e.SessionId;if(!r){const e=new Error("Successful login but no session came.");if(!this.errorCallback)throw e;return void this.errorCallback(e)}t&&t(r,e)},e=>{const t=new Error("Unable to login. Error response follows.\n"+JSON.stringify(e));if(!this.errorCallback)throw t;this.errorCallback(t)})},!e||!t)throw new Error("Non of the arguments 'username', 'passwordHash' can be empty.");this.username=e,this.passwordHash=t,this.appVersion=r,this.clientMachineIdentifier=n,this.clientMachineName=s,this.errorCallback=o}}class p{constructor(){this.getSessionId=(e,t)=>{throw new Error("With anonymous session handler, use only connection methods without session.")},this.invalidateSessionId=(e,t)=>{throw new Error("With anonymous session handler, use only connection methods without session.")}}}class h{static createAuthorizeUrl(e,t,r,n,s,o,i=!1,a){if(s&&!o||!s&&o)throw new Error("If codeChallenge is defined, codeChallengeMethod must also be defined and vice versa");let l=`https://login.eway-crm.${i?"dev":"com"}?scope=${encodeURIComponent(t.join(" "))}&prompt=login&response_type=code&redirect_uri=${encodeURIComponent(r)}&client_id=${e}`;return n&&(l+=`&state=${encodeURIComponent(n)}`),s&&o&&(l+=`&code_challenge=${encodeURIComponent(s)}&code_challenge_method=${encodeURIComponent(o)}`),a&&(l+=`&url=${encodeURIComponent(a)}`),l}}h.finishAuthorization=(e,t,r,n,s,o,i)=>{const a=new URLSearchParams;a.append("code_verifier",n),a.append("client_id",t),a.append("client_secret",r),a.append("code",s),a.append("redirect_uri",o),a.append("grant_type","authorization_code"),h.callTokenEndpoint(e,a,i)},h.refreshToken=(e,t,r,n,s)=>{const o=new URLSearchParams;o.append("client_id",t),o.append("client_secret",r),o.append("refresh_token",n),o.append("grant_type","refresh_token"),h.callTokenEndpoint(e,o,s)},h.getWebServiceUrl=e=>{const r=e.split(".");if(2!==r.length)throw new Error("Invalid token supplied");return t.decode(r[1])},h.getUserName=e=>h.decodeAccessToken(e).username,h.decodeAccessToken=e=>r(e),h.callTokenEndpoint=(t,r,n)=>{e.post(t+"/auth/connect/token",r,{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(e=>{n(e.data)}).catch(e=>{e.response&&400===e.response.status?n(e.response.data):n({error:"Token request failed"})})};class y extends Error{constructor(e,t){super(),this.returnCode=e,this.message=t}}class C{constructor(e,t,r,n,s){if(!e)throw new Error("Non of the arguments 'username', 'clientId', 'clientSecret', 'refreshToken' can be empty.");this.username=e,this.accessToken=t,this.appVersion=r,this.getNewAccessTokenCallback=n,this.errorCallback=s}invalidateSessionId(e,t){t&&t()}getSessionId(e,t){const r={userName:this.username,appVersion:this.appVersion,createSessionCookie:e.supportsGetItemPreviewMethod},n={Authorization:"Bearer "+this.accessToken};e.callWithoutSession(d.logIn,r,e=>{this.lastSuccessfulLoginResponse=e;const r=e.SessionId;if(!r){const e=new Error("Successful login but no session came.");if(!this.errorCallback)throw e;return void this.errorCallback(e)}t&&t(r,e)},e=>{const t=new y(e.ReturnCode,"Unable to login. Error response follows.\n"+JSON.stringify(e));if(!this.errorCallback)throw t;this.errorCallback(t)},n,void 0,r=>{if(401!==(null==r?void 0:r.statusCode)){if(!this.errorCallback)throw r;this.errorCallback(r)}else this.getNewAccessTokenCallback(e,r=>{this.accessToken=r.accessToken,r.error||this.getSessionId(e,t)})})}}class f extends C{constructor(e,t,r,n,s,o,i,a){if(!(e&&n&&t&&r))throw new Error("Non of the arguments 'username', 'clientId', 'clientSecret', 'refreshToken' can be empty.");super(e,s,o,(e,t)=>{h.refreshToken(e.wsUrl,this.clientId,this.clientSecret,this.refreshToken,e=>{try{this.refreshTokenCallback&&this.refreshTokenCallback(e)}catch(e){this.errorCallback&&this.errorCallback(new Error("Refresh token callback failed.\n"+JSON.stringify(e)))}void 0!==e.error?t({error:e.error}):t({accessToken:e.access_token})})},i),this.refreshToken=n,this.clientId=t,this.clientSecret=r,this.refreshTokenCallback=a}}class g extends Error{constructor(e,t){super(),this.statusCode=e,this.message=t}}class P{}P.stringifyError=e=>JSON.stringify(e,P.replaceErrors),P.replaceErrors=(e,t)=>{if(t instanceof Error){const e={};return Object.getOwnPropertyNames(t).forEach(r=>{e[r]=t[r]}),e}return t};class T{}T.openItemLinkRegEx=/https:\/\/open\.eway-crm\.(dev|com)\/\?[-a-zA-Z0-9()@:%_\+.~#?&\/=]*/gi,T.itemParamName="l",T.openLinkDomainLength=7,T.getOpenLinkDomain=e=>e?"open.eway-crm.dev":"open.eway-crm.com",T.isOpenItemLinkInText=e=>T.openItemLinkRegEx.test(e),T.getOpenLinksFromString=e=>e.match(T.openItemLinkRegEx),T.getItemLinksFromOpenLinks=e=>{try{return e.map(e=>new URL(e).searchParams.get(T.itemParamName))}catch(e){console.error("Invalid string passed for cretaing url while getting links from open links")}},T.getItemInfoFromLink=e=>{const r=t.decode(e).substring(T.openLinkDomainLength).split("/");if(Object.keys(u).some(e=>u[e]===r[0])&&r[1]){return{folderName:r[0],itemGuid:r[1]}}},T.getAllItemsFromTextWithLinks=e=>{const t={};if(T.isOpenItemLinkInText(e)){const r=T.getOpenLinksFromString(e);if(!r)return;const n=T.getItemLinksFromOpenLinks(r);null==n||n.forEach(e=>{var r;if(!e)return;const n=T.getItemInfoFromLink(e);n&&(t[n.folderName]=t[n.folderName]?[...null!==(r=t[n.folderName])&&void 0!==r?r:[],n.itemGuid]:[n.itemGuid])})}return t};class S{constructor(r,n,s,i){if(this.ensureLogin=()=>new Promise((e,t)=>{if(this.sessionId)e();else{const r=r=>{r&&(this.sessionId=r,e()),t("Session Id cannot be empty")};this.sessionHandler.getSessionId(this,r)}}),this.createOpenLink=(e,r,n,s)=>{const o=t.encode(this.baseUri);let i="eway://"+r;n&&(i+="/"+(null==n?void 0:n.toLowerCase()));const a=T.getOpenLinkDomain(e);i=t.encode(i);let l="https://"+a+"/?ws="+o+`&${T.itemParamName}=`+i;return s&&(l+="&n="+encodeURIComponent(s)),l},this.askCustomUploadMethod=(e,t,r,n,s)=>new Promise((o,i)=>{const a=s?e=>{throw i(e),e}:i;this.callCustomUploadMethod(e,t,r,o,a,a,n)}),this.askUploadMethod=(e,t,r,n,s)=>new Promise((o,i)=>{const a=s?e=>{throw i(e),e}:i;this.callUploadMethod(e,t,r,o,a,a,n)}),this.callCustomUploadMethod=(t,r,n,s,o,i,a)=>{const c=()=>{this.sessionHandler.getSessionId(this,e=>{this.sessionId=e,this.callCustomUploadMethod(t,r,n,s,o,i,a)})},u=this.sessionId;if(!u)return void c();const d=new URLSearchParams(r),m=`${this.svcUri}/${n}?sessionId=${this.sessionId}&${d.toString()}`,p=e.post(m,t,a);S.handleCallPromise(p,s,e=>{if(e.ReturnCode===l.rcBadSession)return this.sessionId=null,void this.sessionHandler.invalidateSessionId(u,c);if(o)o(e);else{const t=new Error("Unhandled connection return code "+e.ReturnCode+": "+e.Description);if(!this.errorCallback)throw t;this.errorCallback(t)}},e=>{let t=new Error("Unhandled connection error when calling "+m+": "+P.stringifyError(e));if("statusCode"in e&&413===e.statusCode&&(t=new Error("The file has exceeded the maximum allowed file size for uploading. You can contact your IT administrator or eWay-CRM support if you would like to increase the limit.")),i)i(t);else{if(!this.errorCallback)throw t;this.errorCallback(t)}})},this.callUploadMethod=(e,t,r,n,s,o,i)=>{this.callCustomUploadMethod(r,{itemGuid:e,fileName:t},d.saveBinaryAttachment,n,s,o,i)},this.askMethod=(e,t,r,n)=>new Promise((s,o)=>{const i=n?e=>{throw o(e),e}:o;this.callMethod(e,t,s,i,r,i)}),this.callMethod=(e,t,r,n,s,i)=>{s||(s=o.post);const a=()=>{this.sessionHandler.getSessionId(this,o=>{this.sessionId=o,this.callMethod(e,t,r,n,s,i)})},c=this.sessionId;if(!c)return void a();t.sessionId=c;const u=e!==d.logOut?r:e=>{this.sessionId=null,r(e)};this.callWithoutSession(e,t,u,r=>{if(r.ReturnCode!==l.rcBadSession||(this.sessionId=null,e===d.logOut))if(n)n(r);else{const e=new Error("Unhandled connection return code "+r.ReturnCode+": "+r.Description);if(!this.errorCallback)throw e;this.errorCallback(e,t)}else this.sessionHandler.invalidateSessionId(c,a)},null,s,i)},this.callWithoutSession=(t,r,n,s,i,a,l)=>{var c;a||(a=o.post);const u=this.svcUri+"/"+t;let m,p;switch(i&&(m={headers:i,withCredentials:null!==(c=this.supportGetItemPreviewMethod)&&void 0!==c?c:t===d.logIn}),a){case o.get:if(r)throw new Error("Calling api get method with data specified does not make any sense.");p=e.get(u,m);break;case o.post:p=e.post(u,r,m);break;default:throw new Error(`Unknown http method '${a}'.`)}S.handleCallPromise(p,n,s,e=>{if(l)try{l(e)}catch(e){if(!this.errorCallback)throw e;this.errorCallback(e,r)}else{const t=new Error("Unhandled connection error when calling "+u+": "+P.stringifyError(e));if(!this.errorCallback)throw t;this.errorCallback(t,r)}})},this.getItemPreviewGetMethodUrl=(e,t,r)=>this.svcUri+"/"+d.getItemPreview+"?folderName="+encodeURIComponent(e)+"&itemGuid="+encodeURIComponent(t)+(r||0===r?"&itemVersion="+encodeURIComponent(r.toString()):""),this.getEmailAttachmentGetMethodUrl=(e,t)=>this.svcUri+"/"+d.getEmailAttachment+"?itemGuid="+encodeURIComponent(e)+"&contentId="+encodeURIComponent(t),this.getAllEmailAttachmentsZipGetMethodUrl=e=>this.svcUri+"/"+d.getAllEmailAttachments+"?itemGuid="+encodeURIComponent(e),this.getBinaryAttachmentGetMethodUrl=(e,t)=>"number"==typeof t?this.svcUri+"/"+d.getBinaryAttachment+"?itemGuid="+encodeURIComponent(e)+`&revision=${t}`:this.svcUri+"/"+d.getBinaryAttachmentLatestRevision+"?itemGuid="+encodeURIComponent(e),this.getTransformItemMethodUrl=(e,t,r,n,s)=>`${this.svcUri}/${d.transformItem}?itemGuid=${encodeURIComponent(e)}&itemFolderName=${encodeURIComponent(t)}&transformationGuid=${encodeURIComponent(r)}&outputFormat=${n}${s?`&lang=${encodeURIComponent(s)}`:""}`,this.getXsltTransformationDefinitionMethodUrl=e=>`${this.svcUri}/${d.getXsltTransormationDefinition}?itemGuid=${encodeURIComponent(e)}`,this.getActiveSessionId=()=>this.sessionId,this.setActiveSessionId=e=>{this.sessionId=e},!r)throw new Error("The argument 'apiServiceUri' cannot be empty.");if(r.length<8||"https://"!==r.substr(0,8).toLowerCase()&&"http://"!==r.substr(0,7).toLowerCase())throw new Error("Api service uri must start either with 'https://' or with 'http://'.");if(".svc"===r.substr(r.length-4).toLowerCase()){this.svcUri=r;const e=["/API.svc","/InsecureAPI.svc","/WcfService/Service.svc"].find(e=>e.toLowerCase()===r.substr(r.length-e.length).toLowerCase())||"";this.baseUri=r.substr(0,r.length-e.length)}else this.baseUri=S.normalizeWsUrl(r)||r,"https://"===r.substr(0,8).toLowerCase()?this.svcUri=this.baseUri+"/API.svc":this.svcUri=this.baseUri+"/InsecureAPI.svc";this.sessionHandler=n,this.errorCallback=s,this.sessionId=null,this.supportGetItemPreviewMethod=null!=i&&i}get supportsGetItemPreviewMethod(){return this.supportGetItemPreviewMethod}static create(e,t,r,n,s,o,i,a){return new S(e,new m(t,r,n,s,o,i),i,a)}static createAnonymous(e,t){return new S(e,new p,t)}static createUsingOAuth(e,t,r,n,s,o,i,a,l,c){return new S(e,new f(t,r,n,s,o,i,a,l),a,c)}static normalizeWsUrl(e){return e&&e.endsWith("/")&&(e=e.substring(0,e.length-1)),e}static isCloudUrl(e,t){const r=new URL(e),n=new Set;return n.add("eway-crm.com"),n.add("eway-crm.us"),t&&(n.add("eway-crm.dev"),n.add("localhost")),n.has(S.getRootDomain(r.hostname))}static getRootDomain(e){const t=e.split(".");return!t||t.length<=2?e:t.slice(-2).join(".")}get wsUrl(){return this.baseUri}static handleCallPromise(e,t,r,n){e.then(e=>{200===e.status?e.data.ReturnCode===l.rcSuccess?t(e.data):r(e.data):n(new g(e.status,e.statusText))}).catch(e=>{e.response?n(new g(e.response.status,e.response.statusText)):n(e)})}}class E{constructor(e,t,r,n,s,o,i){this.isEnabled=(e,t)=>{const r=()=>{this.url&&this.token?e(this.url,this.token):t()};this.url&&this.token?e(this.url,this.token):this.obtainToken(r)},this.callTokenizedApi=(e,t,r,n)=>{this.isEnabled((s,o)=>{t.token=o,E.call(s,e,t,r,s=>{if(s.ReturnCodeString!==this.invalidTokenReturnCode){if(n)n(s);else if(this.generalErrorCallback){const e=new Error("Unhandled tokenized service connection return code "+s.ReturnCodeString+".\nDescription: "+s.Description);this.generalErrorCallback(e)}}else this.obtainToken(()=>{this.callTokenizedApi(e,t,r,n)})},e=>{if(this.generalErrorCallback){const t=new Error("Unhandled tokenized service connection communication error: "+JSON.stringify(e));this.generalErrorCallback(t)}})},()=>{n&&n(null)})},this.obtainToken=e=>{if(!this.isActive)return this.url=null,this.token=null,void e();const t=t=>{const r=this.urlAndTokenObtainer(t);r.url&&r.token?(this.url=r.url,this.token=r.token,this.isActive=!0,e()):(this.url=null,this.token=null,this.isActive=!1,e())},r=()=>{this.url=null,this.token=null,this.isActive=!1,e()};this.needsSession?this.connection.callMethod(this.obtainTokenMethodName,{},t,r,this.obtainTokenMethodType):this.connection.callWithoutSession(this.obtainTokenMethodName,null,t,r,null,this.obtainTokenMethodType)},this.obtainTokenMethodName=e,this.obtainTokenMethodType=t,this.needsSession=r,this.invalidTokenReturnCode=n,this.urlAndTokenObtainer=s,this.connection=o,this.generalErrorCallback=i||null,this.url=null,this.token=null,this.isActive=!0}static call(t,r,n,s,o,i){const a=t+"/"+r;e.post(a,n).then(e=>{200===e.status?"Success"===e.data.ReturnCodeString?s(e.data):o(e.data):i(new g(e.status,e.statusText))}).catch(e=>{e.response?i(new g(e.response.status,e.response.statusText)):i(e)})}}const I=e=>({url:e.ServiceUrl,token:e.Token});class A{constructor(e,t){this.isCommonDataApiEnabled=(e,t)=>{this.tokenizedConnection.isEnabled(e,t)},this.callCommonDataApi=(e,t,r,n)=>{this.tokenizedConnection.callTokenizedApi(e,t,r,n)},this.tokenizedConnection=new E("ObtainCommonDataApiAccessToken",o.get,!1,"InvalidCommonDataToken",I,e,t)}}class v{}v.acceptableBackwardWorkReportDays="AcceptableBackwardWorkReportDays",v.adminAppInactiveLogoutTime="AdminAppInactiveLogoutTime",v.allowChangeGoodsInCartListPrice="AllowChangeGoodsInCartListPrice",v.applyGeneralDataProtectionRules="ApplyGeneralDataProtectionRules",v.automaticallyCreateJournalAfterCallDuration="AutomaticallyCreateJournalAfterCallDuration",v.bonusesCompletedState="BonusesCompletedState",v.cartInvoicedState="CartInvoicedState",v.cartOrderCanceledState="CartOrderCanceledState",v.cartOrderInProcessState="CartOrderInProcessState",v.cartOrderProcessedState="CartOrderProcessedState",v.cartPaidState="CartPaidState",v.cartProposalInProcessState="CartProposalInProcessState",v.cartProposalProcessedState="CartProposalProcessedState",v.cartSalesVoucherIssuedState="CartSalesVoucherIssuedState",v.cartToBeInvoicedState="CartToBeInvoicedState",v.cartVoidedState="CartVoidedState",v.clickToCallScheme="ClickToCallScheme",v.companyDuplicityCheckEnabled="CompanyDuplicityCheckEnabled",v.completedStateName="CompletedStateName",v.contactDuplicityCheckEnabled="ContactDuplicityCheckEnabled",v.createCompanyWhileImportingContactFromOutlook="CreateCompanyWhileImportingContactFromOutlook",v.defaultProposalValidityPeriod="DefaultProposalValidityPeriod",v.enableContactsTwoWaySyncWithM365="EnableContactsTwoWaySyncWithM365",v.deadStateName="DeadStateName",v.enableCompaniesSyncIntoMobileDeviceContacts="EnableCompaniesSyncIntoMobileDeviceContacts",v.enableContactsSyncIntoMobileDevice="EnableContactsSyncIntoMobileDevice",v.enableLeadsSyncIntoMobileDeviceContacts="EnableLeadsSyncIntoMobileDeviceContacts",v.enableLlamaAiFeatures="EnableLlamaAiFeatures",v.enableUsersSyncIntoMobileDeviceContacts="EnableUsersSyncIntoMobileDeviceContacts",v.emailsActiveProjectsLeadsFilter="EmailsActiveProjectsLeadsFilter",v.trackToAddressesOnly="TrackToAddressesOnly",v.exchangeRatesAdminGroupName="ExchangeRatesAdminGroupName",v.forcedEmailTrackingGroups="ForcedEmailTrackingGroups",v.ignoreEmailsFromDomainsOnEmailsTracking="IgnoreEmailsFromDomainsOnEmailsTracking",v.trackEmailsFromDomains="TrackEmailsFromDomains",v.groupsForAllUnpaidInvoicesNotification="GroupsForAllUnpaidInvoicesNotification",v.itemPreviewMaxHeight="ItemPreviewMaxHeight",v.lastActivityAttributes="LastActivityAttributes",v.leadsCompletedState="LeadsCompletedState",v.leadDeadlineAlertGroups="LeadDeadlineAlertGroups",v.leadsDeadState="LeadsDeadState",v.marketingCompletedState="MarketingCompletedState",v.marketingDeadState="MarketingDeadState",v.minimumPasswordLength="MinimumPasswordLength",v.nextStepAttributes="NextStepAttributes",v.notifyAboutInvoicedInvoiceInPohodaGroup="NotifyAboutInvoicedInvoiceInPohodaGroup",v.notifyAboutLeadsDeadline="NotifyAboutLeadsDeadline",v.notifyAboutPaidInvoiceInPohodaGroup="NotifyAboutPaidInvoiceInPohodaGroup",v.notifyAboutProjectDeadline="NotifyAboutProjectDeadline",v.numberOfDecimalPlaces="NumberOfDecimalPlaces",v.phoneListTaskSolverGroup="PhoneListTaskSolverGroup",v.projectDeadlineAlert="ProjectDeadlineAlert",v.serverUpdateProgressNotificationGroup="ServerUpdateProgressNotificationGroup",v.sumarizeCartsPricesOnLeads="SumarizeCartsPricesOnLeads",v.sumarizeCartsPricesOnProjects="SumarizeCartsPricesOnProjects",v.sumarizePeopleExpensesOnProjects="SumarizePeopleExpensesOnProjects",v.systemHealthNotificationGroup="SystemHealthNotificationGroup",v.tasksCompletedState="TasksCompletedState",v.tasksDeferredState="TasksDeferredState",v.tasksInProgressState="TasksInProgressState",v.tasksNotStartedState="TasksNotStartedState",v.tasksWaitOnSomeoneElseState="TasksWaitOnSomeoneElseState",v.trackDocumentVersions="TrackDocumentVersions",v.vacationCompletedState="VacationCompletedState",v.workReportApprovedState="WorkReportApprovedState",v.defaultLanguage="DefaultLanguage",v.defaultCurrency="DefaultCurrency",v.myCompanyCountry="MyCompanyCountry",v.myCompanyName="MyCompanyName",v.myCompanyStreet="MyCompanyStreet",v.myCompanyCity="MyCompanyCity",v.myCompanyState="MyCompanyState",v.myCompanyZip="MyCompanyZIP",v.myCompanyId="MyCompanyID",v.myCompanyVat="MyCompanyVAT",v.mergeGoodsInCart="MergeGoodsInCart",v.cartRefreshLogic="CartRefreshLogic",v.goodsDefaultQuantity="GoodsDefaultQuantity",v.goodsDefaultVAT="GoodsDefaultVAT",v.goodsDefaultVATIncluded="GoodsDefaultVATIncluded",v.recalculateOnListPriceChange="RecalculateOnListPriceChange",v.recalculateOnPurchasePriceChange="RecalculateOnPurchasePriceChange";class k{}k.ServerCommon={Server_ID:"Server_ID",Server_ItemCreated:"Server_ItemCreated",Server_ItemChanged:"Server_ItemChanged"},k.Common={CreatedByGUID:"CreatedByGUID",CurrencyEn:"CurrencyEn",DefaultCurrencySuffix:"DefaultCurrency",FileAs:"FileAs",ItemCreated:"ItemCreated",ItemChanged:"ItemChanged",ItemGUID:"ItemGUID",ItemVersion:"ItemVersion",ModifiedByGUID:"ModifiedByGUID",OwnerGUID:"OwnerGUID",ParentCurrencySuffix:"ParentCurrency",Picture:"Picture"},k.Calendar={Location:"Location",StartDate:"StartDate",EndDate:"EndDate",AllDayEvent:"AllDayEvent",SuperiorItem:"SuperiorItem",BusyStatus:"BusyStatus",GraphID:"GraphID",GraphCalendarID:"GraphCalendarID",Note:"Note"},k.Carts={SuperiorItem:"SuperiorItem",Customer:"Customer",Contact:"Contact",TypeEn:"TypeEn",StateEn:"StateEn",PriceTotal:"PriceTotal",PriceTotalExcludingVAT:"PriceTotalExcludingVAT",ForPayment:"ForPayment",Paid:"Paid",CurrencyEn:"CurrencyEn",EffectiveFrom:"EffectiveFrom",ValidUntil:"ValidUntil",Active:"Active",Note:"Note",ID:"ID",AccountingCaseDate:"AccountingCaseDate",TaxableSupplyDate:"TaxableSupplyDate",PaymentDate:"PaymentDate",VAT:"VAT",GoodsInCartCount:"GoodsInCartCount",PriceTotalDefaultCurrency:"PriceTotalDefaultCurrency",PriceTotalParentCurrency:"PriceTotalParentCurrency",ForPaymentDefaultCurrency:"ForPaymentDefaultCurrency",ForPaymentParentCurrency:"ForPaymentParentCurrency",PaidDefaultCurrency:"PaidDefaultCurrency",PaidParentCurrency:"PaidParentCurrency",PaidChanged:"PaidChanged",PriceTotalChanged:"PriceTotalChanged",PriceTotalExcludingVATDefaultCurrency:"PriceTotalExcludingVATDefaultCurrency",PriceTotalExcludingVATParentCurrency:"PriceTotalExcludingVATParentCurrency",VATDefaultCurrency:"VATDefaultCurrency",VATParentCurrency:"VATParentCurrency",PrevStateEn:"PrevStateEn",PurchaseExpenses:"PurchaseExpenses",PurchaseExpensesDefaultCurrency:"PurchaseExpensesDefaultCurrency",PurchaseExpensesParentCurrency:"PurchaseExpensesParentCurrency",PurchaseExpensesChanged:"PurchaseExpensesChanged",Profit:"Profit",ProfitDefaultCurrency:"ProfitDefaultCurrency",ProfitParentCurrency:"ProfitParentCurrency",ProfitChanged:"ProfitChanged"},k.Companies={ID:"ID",CompanyName:"CompanyName",Department:"Department",AccountNumber:"AccountNumber",IdentificationNumber:"IdentificationNumber",VatNumber:"VatNumber",Sales:"Reversal",EmployeesCount:"EmployeesCount",Purchaser:"Purchaser",Suppliers:"Suppliers",Competitor:"Competitor",Address1Street:"Address1Street",Address1City:"Address1City",Address1PostalCode:"Address1PostalCode",Address1CountryEn:"Address1CountryEn",Address1State:"Address1State",Address1POBox:"Address1POBox",Address2Street:"Address2Street",Address2City:"Address2City",Address2PostalCode:"Address2PostalCode",Address2CountryEn:"Address2CountryEn",Address2State:"Address2State",Address2POBox:"Address2POBox",Address3Street:"Address3Street",Address3City:"Address3City",Address3PostalCode:"Address3PostalCode",Address3CountryEn:"Address3CountryEn",Address3State:"Address3State",Address3POBox:"Address3POBox",InvoiceAddress:"InvoiceAddress",PostalAddress:"PostalAddress",Phone:"Phone",Mobile:"Mobile",Fax:"Fax",WebPage:"WebPage",TrackedDomains:"TrackedDomains",Email:"Email",ICQ:"ICQ",MSN:"MSN",Skype:"Skype",ImportanceEn:"ImportanceEn",FirstContactEn:"FirstContactEn",LineOfBusiness:"LineOfBusiness",EmailOptOut:"EmailOptOut",MailingListOther:"MailingListOther",MailingListOtherValue:"MailingListOtherValue",Note:"Note",IsPrivate:"IsPrivate",NextStep:"NextStep",LastActivity:"LastActivity",AdditionalDiscount:"AdditionalDiscount"},k.Contacts={ProfilePicture:"ProfilePicture",Title:"Title",Email1Address:"Email1Address",Email2Address:"Email2Address",Email3Address:"Email3Address",DoNotSendNewsletter:"DoNotSendNewsletter",ImportanceEn:"ImportanceEn",PrefixEn:"PrefixEn",FirstName:"FirstName",MiddleName:"MiddleName",LastName:"LastName",SuffixEn:"SuffixEn",BusinessAddressStreet:"BusinessAddressStreet",BusinessAddressCity:"BusinessAddressCity",BusinessAddressPostalCode:"BusinessAddressPostalCode",BusinessAddressCountryEn:"BusinessAddressCountryEn",BusinessAddressState:"BusinessAddressState",BusinessAddressPoBox:"BusinessAddressPOBox",HomeAddressStreet:"HomeAddressStreet",HomeAddressCity:"HomeAddressCity",HomeAddressPostalCode:"HomeAddressPostalCode",HomeAddressCountryEn:"HomeAddressCountryEn",HomeAddressState:"HomeAddressState",HomeAddressPOBox:"HomeAddressPOBox",OtherAddressStreet:"OtherAddressStreet",OtherAddressCity:"OtherAddressCity",OtherAddressPostalCode:"OtherAddressPostalCode",OtherAddressCountryEn:"OtherAddressCountryEn",OtherAddressState:"OtherAddressState",OtherAddressPOBox:"OtherAddressPOBox",BusinessPhoneNumber:"TelephoneNumber1",BusinessPhoneNumber2:"TelephoneNumber5",BusinessFaxNumber:"TelephoneNumber6",MobilePhoneNumber:"TelephoneNumber3",HomePhoneNumber:"TelephoneNumber2",OtherPhoneNumber:"TelephoneNumber4",ICQ:"ICQ",MSN:"MSN",Skype:"Skype",WebPage:"WebPage",Note:"Note",Department:"Department",Company:"Company",IsPrivate:"Private",NextStep:"NextStep",LastActivity:"LastActivity"},k.Leads={ID:"ID",FileAs:"FileAs",HumanID:"HID",Customer:"Customer",ContactPerson:"ContactPerson",Marketing:"Marketing",ReceiveDate:"ReceiveDate",Email:"Email",Phone:"Phone",Street:"Street",State:"State",CountryEn:"CountryEn",City:"City",POBox:"POBox",Zip:"Zip",Price:"Price",PriceChanged:"PriceChanged",CurrencyEn:k.Common.CurrencyEn,EstimatedEnd:"EstimatedEnd",Probability:"Probability",LeadOriginEn:"LeadOriginEn",PriceDefaultCurrency:"PriceDefaultCurrency",EstimatedValue:"EstimatedValue",EstimatedValueDefaultCurrency:"EstimatedValueDefaultCurrency",Note:"Note",TypeEn:"TypeEn",StateEn:"StateEn",PrevStateEn:"PrevStateEn",IsPrivate:"Private",EmailOptOut:"EmailOptOut",NextStep:"NextStep",LastActivity:"LastActivity",ItemVersion:"ItemVersion",EstimatedRevenue:"EstimatedRevenue",EstimatedRevenueDefaultCurrency:"EstimatedRevenueDefaultCurrency",CompletedDate:"CompletedDate",LostDate:"LostDate"},k.Documents={FileAs:"FileAs",DocName:"DocName",Preview:"Preview",PreviewWidth:"PreviewWidth",PreviewHeight:"PreviewHeight",DocTypeEn:"DocTypeEn",StateEn:"StateEn",ImportanceEn:"ImportanceEn",SuperiorItem:"SuperiorItem",SuperiorCompany:"Company",SuperiorContact:"Contact",DocSize:"DocSize",Extension:"Extension",CreationTime:"CreationTime",LastWriteTime:"LastWriteTime",IsPrivate:"Private",Note:"Note",ExternalUrl:"ExternalUrl"},k.Emails={To:"To",From:"SenderEmailAddress",Cc:"Cc",Subject:"Subject",ImportanceEn:"ImportanceEn",SuperiorItem:"SuperiorItem",SentOn:"SentOn",ReceivedTime:"ReceivedTime",FileSize:"FileSize",AttachmentsCount:"AttachmentsCount",Note:"Note",SentimentTone:"SentimentTone",Summary:"Summary"},k.GoodsBase={Code:"Code",Structure:"Structure",Note:"Note",Description:"Description",TypeEn:"TypeEn",SaleCurrencyEn:"SaleCurrencyEn",PurchaseCurrencyEn:"PurchaseCurrencyEn",UnitEn:"UnitEn",PurchasePrice:"PurchasePrice",PurchasePriceDefaultCurrency:"PurchasePriceDefaultCurrency",PurchasePriceChanged:"PurchasePriceChanged",SalePrice:"SalePrice",SalePriceDefaultCurrency:"SalePriceDefaultCurrency",SalePriceChanged:"SalePriceChanged",IsPriceSum:"IsPriceSum",VATRate:"VATRate",VATIncluded:"VATIncluded",Picture:"Picture",PictureHeight:"PictureHeight",PictureWidth:"PictureWidth",Margin:"Margin",Markup:"Markup"},k.Goods=Object.assign(Object.assign({},k.GoodsBase),{PriceListGroupGUID:"PriceListGroupGUID",InventoryQuantity:"InventoryQuantity"}),k.GoodsInCart=Object.assign(Object.assign({},k.GoodsBase),{Cart:"Cart",GoodsInfo:"GoodsInfo",SuperiorItem:"SuperiorItem",Quantity:"Quantity",PriceTotal:"PriceTotal",PriceTotalDefaultCurrency:"PriceTotalDefaultCurrency",PriceTotalParentCurrency:"PriceTotalParentCurrency",PriceTotalChanged:"PriceTotalChanged",PriceTotalExcludingVAT:"PriceTotalExcludingVAT",PriceTotalExcludingVATDefaultCurrency:"PriceTotalExcludingVATDefaultCurrency",PriceTotalExcludingVATParentCurrency:"PriceTotalExcludingVATParentCurrency",VATTotal:"VATTotal",VATTotalDefaultCurrency:"VATTotalDefaultCurrency",VATTotalParentCurrency:"VATTotalParentCurrency",SalePriceExcludingVAT:"SalePriceExcludingVAT",SalePriceExcludingVATDefaultCurrency:"SalePriceExcludingVATDefaultCurrency",SalePriceExcludingVATParentCurrency:"SalePriceExcludingVATParentCurrency",VAT:"VAT",VATDefaultCurrency:"VATDefaultCurrency",VATParentCurrency:"VATParentCurrency",PurchasePriceParentCurrency:"PurchasePriceParentCurrency",SalePriceParentCurrency:"SalePriceParentCurrency",ListPrice:"ListPrice",ListPriceDefaultCurrency:"ListPriceDefaultCurrency",ListPriceParentCurrency:"ListPriceParentCurrency",ListPriceChanged:"ListPriceChanged",Discount:"Discount",HierarchyInSet:"HierarchyInSet",IsFromSet:"IsFromSet",ParentGUID:"ParentGUID",Rank:"Rank",IncludeInCartPrice:"IncludeInCartPrice",ListPriceCustomized:"ListPriceCustomized",ChildItemsCount:"ChildItemsCount",JoinedToGUID:"JoinedToGUID",PurchasePriceTotal:"PurchasePriceTotal",PurchasePriceTotalDefaultCurrency:"PurchasePriceTotalDefaultCurrency",PurchasePriceTotalParentCurrency:"PurchasePriceTotalParentCurrency",PurchasePriceTotalChanged:"PurchasePriceTotalChanged"}),k.Journal={FileAs:"FileAs",Subject:"Subject",TypeEn:"TypeEn",StateEn:"StateEn",ImportanceEn:"ImportanceEn",EventStart:"EventStart",EventEnd:"EventEnd",SuperiorItem:"SuperiorItem",Company:"Company",Contact:"Contact",Marketing:"Marketing",IsSystem:"System",IsPrivate:"Private",Note:"Note",Phone:"Phone"},k.Vacation={StartDate:"StartDate",EndDate:"EndDate",User:"User",Duration:"Duration",Place:"Place",Note:"Note",AllDay:"AllDay",TypeEn:"TypeEn",StateEn:"StateEn",IsPrivate:"Private"},k.Marketing={HumanID:"HumanID",EstimatedStart:"EstimatedStart",EstimatedEnd:"EstimatedEnd",RealStart:"RealStart",RealEnd:"RealEnd",TargetGroup:"TargetGroup",EmailsSent:"EmailsSent",EmailsDelivered:"EmailsDelivered",EmailsViewed:"EmailsViewed",PeopleUnsubscribed:"PeopleUnsubscribed",FinalRevenues:"FinalRevenues",TypeEn:"TypeEn",StateEn:"StateEn"},k.Projects={HumanID:"HID",FileAs:"FileAs",ProjectName:"ProjectName",ProjectOriginEn:"ProjectOriginEn",TypeEn:"TypeEn",StateEn:"StateEn",PaymentTypeEn:"PaymentTypeEn",ProjectStart:"ProjectStart",ProjectRealEnd:"ProjectRealEnd",EstimatedEnd:"ProjectEnd",CurrencyEn:k.Common.CurrencyEn,DefaultCurrencyEn:"DefaultCurrencyEn",EstimatedMargin:"EstimatedMargin",EstimatedPeopleExpenses:"EstimatedPeopleExpenses",EstimatedPeopleExpensesDefaultCurrency:"EstimatedPeopleExpensesDefaultCurrency",EstimatedOtherExpenses:"EstimatedOtherExpenses",EstimatedOtherExpensesDefaultCurrency:"EstimatedOtherExpensesDefaultCurrency",EstimatedPrice:"EstimatedPrice",EstimatedPriceDefaultCurrency:"EstimatedPriceDefaultCurrency",EstimatedProfit:"EstimatedProfit",EstimatedProfitDefaultCurrency:"EstimatedProfitDefaultCurrency",EstimatedPriceChanged:"EstimatedPriceChanged",EstimatedPeopleExpensesChanged:"EstimatedPeopleExpensesChanged",EstimatedOtherExpensesChanged:"EstimatedOtherExpensesChanged",Delay:"Delay",EstimatedWorkHours:"EstimatedWorkHours",TotalWorkHours:"TotalWorkHours",PeopleExpenses:"PeopleExpenses",OtherExpenses:"OtherExpenses",PeopleExpensesDefaultCurrency:"PeopleExpensesDefaultCurrency",OtherExpensesDefaultCurrency:"OtherExpensesDefaultCurrency",PeopleExpensesChanged:"PeopleExpensesChanged",OtherExpensesChanged:"OtherExpensesChanged",Price:"Price",PriceDefaultCurrency:"PriceDefaultCurrency",Profit:"Profit",ProfitDefaultCurrency:"ProfitDefaultCurrency",Margin:"Margin",PriceChanged:"PriceChanged",SuperiorProject:"SuperiorProject",Customer:"Customer",ContactPerson:"ContactPerson",Users:"Users",ProjectManager:"ProjectManager",InvoicePaymentDate:"InvoicePaymentDate",PaymentMaturity:"PaymentMaturity",InvoiceIssueDate:"InvoiceIssueDate",LicensesCount:"LicensesCount",LicensePrice:"LicensePrice",LicensePriceDefaultCurrency:"LicensePriceDefaultCurrency",NextStep:"NextStep",LastActivity:"LastActivity",IsPrivate:"Private",LicensePriceChanged:"LicensePriceChanged",Note:"Note",CompletedDate:"CompletedDate",LostDate:"LostDate"},k.Tasks={FileAs:"FileAs",Subject:"Subject",RootItem:"RootItem",SuperiorItem:"SuperiorItem",Company:"Company",Contact:"Contact",StartDate:"StartDate",DueDate:"DueDate",Reminder:"Reminder",ReminderDate:"ReminderDate",ImportanceEn:"ImportanceEn",IsCompleted:"Complete",PercentComplete:"PercentComplete",PercentCompleteDecimal:"PercentCompleteDecimal",CompletedDate:"CompletedDate",Solver:"Solver",Delegator:"Delegator",Level:"Level",IsPrivate:"Private",ActualWorkHours:"ActualWorkHours",TotalWorkHours:"TotalWorkHours",Body:"Body",TypeEn:"TypeEn",StateEn:"StateEn"},k.Training={TitleEn:"TitleEn"},k.WorkReports={Task:"Task",ProjectName:"ProjectName",UserName:"UserName",Subject:"Subject",Date:"Date",FromTime:"FromTime",ToTime:"ToTime",Overtime:"Overtime",Month:"Month",Year:"Year",IsPrivate:"Private",Note:"Note",Duration:"Duration",WorkReportEn:"WorkReportEn",StateEn:"StateEn"},k.Users={ProfilePicture:"ProfilePicture",UserName:"UserName",JobTitle:"JobTitle",IDCardNumber:"IDCardNumber",Birthdate:"Birthdate",BirthPlace:"BirthPlace",PersonalIdentificationNumber:"PersonalIdentificationNumber",Active:"Active",FamilyStatusEn:"FamilyStatusEn",HomeAddressStreet:"HomeAddressStreet",HomeAddressCity:"HomeAddressCity",HomeAddressPostalCode:"HomeAddressPostalCode",HomeAddressCountryEn:"HomeAddressCountryEn",HomeAddressState:"HomeAddressState",HomeAddressPOBox:"HomeAddressPOBox",BankAccount:"BankAccount",BusinessPhoneNumber:"BusinessPhoneNumber",MobilePhoneNumber:"MobilePhoneNumber",Email1Address:"Email1Address",Email2Address:"Email2Address",ICQ:"ICQ",MSN:"MSN",Skype:"Skype",IdentificationNumber:"IdentificationNumber",HealthInsurance:"HealthInsurance",HolidayLength:"HolidayLength",RemainingDaysOfHoliday:"RemainingDaysOfHoliday",SalaryDateEn:"SalaryDateEn",Supervisor:"Supervisor",TravelDistance:"TravelDistance",TimeAccessibility:"TimeAccessibility",TransportMode:"TransportMode",WorkdayStartTime:"WorkdayStartTime",Note:"Note",IsSystem:"IsSystem"},k.Groups={IsAdmin:"IsAdmin",GroupName:"GroupName",FileAs:"FileAs",Description:"Description",IsPM:"IsPM",System:"System",IsRole:"IsRole",IsCategory:"IsCategory",DisallowControlModulePermissions:"DisallowControlModulePermissions",DisallowControlColumnPermissions:"DisallowControlColumnPermissions",IsOutlookCategory:"IsOutlookCategory",DisallowControlUserAssignment:"DisallowControlUserAssignment",ColorEn:"ColorEn",Picture:"Picture"},k.PriceListGroups={Note:"Note"},k.Prices={SalePriceGUID:"SalePriceGUID",GoodsItemGUID:"GoodsItemGUID",Price:"Price",CurrencyEn:"CurrencyEn"},k.SalePrices={Note:"Note",Discount:"Discount",TypeEn:"TypeEn",StateEn:"StateEn",PrevStateEn:"PrevStateEn"},k.XsltTransformations={LangCode:"LangCode",Definition:"Definition",Namespace:"Namespace",ObjectTypeID:"ObjectTypeID",TransformationVersion:"TransformationVersion"},k.XsltTransformationsModels={ObjectTypeID:"ObjectTypeID",TransformationGUID:"TransformationGUID",ItemTypeGUID:"ItemTypeGUID"},k.allTypeEnNames=["TypeEn",k.Documents.DocTypeEn,k.WorkReports.WorkReportEn,"TitleEn"],k.getFolderFileAs=e=>{switch(e){case u.leads:return k.Leads.FileAs;case u.projects:return k.Projects.ProjectName;case u.documents:return k.Documents.DocName;case u.companies:return k.Companies.CompanyName;case u.contacts:case u.users:return k.Common.FileAs;case u.emails:return k.Emails.Subject;case u.journal:return k.Journal.FileAs;case u.tasks:return k.Tasks.Subject;case u.workReports:return k.WorkReports.Subject;case u.vacation:return k.Vacation.TypeEn;case u.carts:case u.goods:case u.goodsInCart:return k.Common.FileAs;case u.groups:return k.Groups.GroupName;case u.xsltTransformations:return k.Common.FileAs;default:return console.warn(`FileAs col name not defined for folderName ${e}`),k.Common.FileAs}};class D{}D.general="GENERAL",D.group="GROUP",D.contactPerson="CONTACTPERSON",D.contact="CONTACT",D.customer="CUSTOMER",D.company="COMPANY",D.outlookProject="OUTLOOKPROJECT",D.supervisor="SUPERVISOR",D.projectOrigin="PROJECT_ORIGIN",D.cart="CART",D.goodsInCart="GOODSINCART",D.superiorItem="SUPERIORITEM",D.taskParent="TASKPARENT";class b{}b.general=1,b.group=2,b.contactPerson=10,b.contact=11,b.customer=12,b.company=13,b.outlookProject=28,b.supervisor=32,b.projectOrigin=25,b.cart=9,b.goodsInCart=15,b.superiorItem=31,b.taskParent=38;class w{}w.all="All",w.own="Own",w.readonly="Readonly",w.invisible="Invisible",w.none="None";class F{}var O,N,R,L;F.mandatory="Mandatory",F.optional="Optional",F.unique="Unique",F.none="None",function(e){e.Free="Free",e.Basic="Basic",e.Professional="Professional",e.Enterprise="Enterprise"}(O||(O={})),function(e){e.ContactsAndCompanies="ContactsAndCompanies",e.Sales="Sales",e.Projects="Projects",e.Marketing="Marketing"}(N||(N={})),function(e){e[e.Negative=0]="Negative",e[e.Neutral=1]="Neutral",e[e.Positive=2]="Positive"}(R||(R={}));class x{}x.contactsSynchronizationWithOutlook="ContactsSynchronizationWithOutlook",x.wordAddin="WordAddin",x.excelAddin="ExcelAddin",x.tasksRecurrentTasks="TasksRecurrentTasks",x.tasksSubtasks="TasksSubtasks",x.tasksSynchronizationWithOutlook="TasksSynchronizationWithOutlook",x.calendarSynchronizationWithOutlook="CalendarSynchronizationWithOutlook",x.emailsAutomaticTracking="EmailsAutomaticTracking",x.convertEmailToProject="ConvertEmailToProject",x.duplicityChecker="DuplicityChecker",x.nextStepAndLastActivityCustomization="NextStepAndLastActivityCustomization",x.subProjects="SubProjects",x.resourceAndPlanning="ResourceAndPlanning",x.professionalEmailCampaigns="ProfessionalEmailCampaigns",x.professionalEmailCampaignsAdvancedStatistics="ProfessionalEmailCampaignsAdvancedStatistics",x.wordEmailMerge="WordEmailMerge",x.printLabels="PrintLabels",x.printEnvelopes="PrintEnvelopes",x.userViews="UserViews",x.sharedUserViews="SharedUserViews",x.gridConditionalFormating="GridConditionalFormating",x.multipleCurrencies="MultipleCurrencies",x.historyTracking="HistoryTracking",x.privateItems="PrivateItems",x.itemTypes="ItemTypes",x.formLayoutCustomization="FormLayoutCustomization",x.workflowBasicDefinitions="WorkflowBasicDefinitions",x.workflowAdvancedDefinitions="WorkflowAdvancedDefinitions",x.workflowAdvancedDefinitionsRules="WorkflowAdvancedDefinitionsRules",x.workflowAdvancedDefinitionsActions="WorkflowAdvancedDefinitionsActions",x.workflowGroupLevelActions="WorkflowGroupLevelActions",x.customFields="CustomFields",x.importantFields="ImportantFields",x.mandatoryFields="MandatoryFields",x.uniqueFields="UniqueFields",x.readOnlyFields="ReadOnlyFields",x.transformationCustomTemplates="TransformationCustomTemplates",x.userRoles="UserRoles",x.modulePermissions="ModulePermissions",x.columnPermissions="ColumnPermissions",x.api="API",x.gate="Gate",x.threeCXIntegration="ThreeCXIntegration",x.tapiIntegration="TapiIntegration",x.pohodaIntegration="PohodaIntegration",x.pohodaSynchronizationIntervalCustomization="PohodaSynchronizationIntervalCustomization",x.pohodaSynchronizationFieldMappingCustomization="PohodaSynchronizationFieldMappingCustomization",x.quickBooksIntegration="QuickBooksIntegration",x.saveBinaryDataOnDisk="SaveBinaryDataOnDisk",x.activeDirectoryLogin="ActiveDirectoryLogin",x.callerIdentificationOnApple="CallerIdentificationOnApple",x.legacyAdministration="LegacyAdministration";class M{}M.customAdditionalFieldsCount="CustomAdditionalFieldsCount",M.customEnabledAdvancedWorkflowsCount="CustomEnabledAdvancedWorkflowsCount",M.customEnabledBasicWorkflowsCount="CustomEnabledBasicWorkflowsCount",M.customMandatoryFieldsCount="CustomMandatoryFieldsCount",M.customOptionalFieldsCount="CustomOptionalFieldsCount",M.customReadonlyFieldsCount="CustomReadonlyFieldsCount",M.customUniqueFieldsCount="CustomUniqueFieldsCount",M.customVisibleTypesCount="CustomVisibleTypesCount",M.visibleCurrenciesCount="VisibleCurrenciesCount";class U{}U.contactsAutomaticSynchronizationWithOutlook="ContactsAutomaticSynchronizationWithOutlook",U.contactsSynchronizationWithOutlook="ContactsSynchronizationWithOutlook",U.contactsSynchronizationWithAndroid="ContactsSynchronizationWithAndroid",U.documentsRevisions="DocumentsRevisions",U.wordAddin="WordAddin",U.excelAddin="ExcelAddin",U.tasksReminders="TasksReminders",U.tasksRecurrentTasks="TasksRecurrentTasks",U.tasksSubtasks="TasksSubtasks",U.tasksSynchronizationWithOutlook="TasksSynchronizationWithOutlook",U.calendarSynchronizationWithOutlook="CalendarSynchronizationWithOutlook",U.emailsManualTracking="EmailsManualTracking",U.emailsAutomaticTracking="EmailsAutomaticTracking",U.emailSummaryAndSentimentToneFromAi="EmailSummaryAndSentimentToneFromAi",U.convertEmailToContact="ConvertEmailToContact",U.convertEmailToDeal="ConvertEmailToDeal",U.convertEmailToProject="ConvertEmailToProject",U.convertEmailToTask="ConvertEmailToTask",U.convertFromSuggestedContact="ConvertFromSuggestedContact",U.gravatarIntegration="GravatarIntegration",U.logoboxIntegration="LogoboxIntegration",U.companiesBussinesRegisterApiIntegration="CompaniesBussinesRegisterApiIntegration",U.duplicityChecker="DuplicityChecker",U.nextStepAndLastActivityCustomization="NextStepAndLastActivityCustomization",U.subProjects="SubProjects",U.resourceAndPlanning="ResourceAndPlanning",U.professionalEmailCampaigns="ProfessionalEmailCampaigns",U.professionalEmailCampaignsAdvancedStatistics="ProfessionalEmailCampaignsAdvancedStatistics",U.wordEmailMerge="WordEmailMerge",U.printLabels="PrintLabels",U.printEnvelopes="PrintEnvelopes",U.userViews="UserViews",U.sharedUserViews="SharedUserViews",U.gridRowSummary="GridRowSummary",U.gridConditionalFormating="GridConditionalFormating",U.multipleCurrencies="MultipleCurrencies",U.historyTracking="HistoryTracking",U.privateItems="PrivateItems",U.itemTypes="ItemTypes",U.formLayoutCustomization="FormLayoutCustomization",U.workflowBasicDefinitions="WorkflowBasicDefinitions",U.workflowAdvancedDefinitions="WorkflowAdvancedDefinitions",U.workflowAdvancedDefinitionsRules="WorkflowAdvancedDefinitionsRules",U.workflowAdvancedDefinitionsActions="WorkflowAdvancedDefinitionsActions",U.workflowGroupLevelActions="WorkflowGroupLevelActions",U.customFields="CustomFields",U.importantFields="ImportantFields",U.mandatoryFields="MandatoryFields",U.uniqueFields="UniqueFields",U.readOnlyFields="ReadOnlyFields",U.transformationCustomTemplates="TransformationCustomTemplates",U.userRoles="UserRoles",U.modulePermissions="ModulePermissions",U.columnPermissions="ColumnPermissions",U.commonDataAPI="CommonDataAPI",U.eWayCrmAPI="eWayCrmAPI",U.threeCXIntegration="ThreeCXIntegration",U.tapiIntegration="TapiIntegration",U.pohodaIntegration="PohodaIntegration",U.pohodaSynchronizationIntervalCustomization="PohodaSynchronizationIntervalCustomization",U.pohodaSynchronizationFieldMappingCustomization="PohodaSynchronizationFieldMappingCustomization",U.quickBooksIntegration="QuickBooksIntegration",U.shareByTeams="ShareByTeams",U.convertEmailToContactWithDataFromAi="ConvertEmailToContactWithDataFromAi",U.convertEmailToDealWithDataFromAi="ConvertEmailToDealWithDataFromAi",U.convertEmailToProjectWithDataFromAi="ConvertEmailToProjectWithDataFromAi",U.xsltTransformationsAdministrationForCaCAndRest="XsltTransformationsAdministrationForCaCAndRest",U.xsltTransformationsAdministrationForSales="XsltTransformationsAdministrationForSales",U.xsltTransformationsAdministrationForProjects="XsltTransformationsAdministrationForProjects",U.xsltTransformationsAdministrationForMarketing="XsltTransformationsAdministrationForMarketing",function(e){e.UnpaidImportantInvoices="UnpaidImportantInvoices",e.UncollectableSubscriptionPayment="UncollectableSubscriptionPayment",e.UncollectableSubscriptionPaymentWithExpiredCard="UncollectableSubscriptionPaymentWithExpiredCard",e.StandardSubscriptionPeriod="StandardSubscriptionPeriod"}(L||(L={}));var G,_=L;!function(e){e.License="License",e.CloudLicense="CloudLicense",e.MiscLicense="MiscLicense",e.Support="Support",e.Service="Service"}(G||(G={}));var V=G;class j{}j.getIsDebug=e=>{var t;return!!(null===(t=null==e?void 0:e.sessionHandler.lastSuccessfulLoginResponse)||void 0===t?void 0:t.Debug)},j.supportsFeaturesOf=(e,t)=>{var r;const n=null===(r=e.sessionHandler.lastSuccessfulLoginResponse)||void 0===r?void 0:r.WcfVersion;return!!n&&j.supportsVersionFeaturesOf(n,t)},j.supportsVersionFeaturesOf=(e,t)=>n(e,t,">=")||n(e,"1.0.0.0","=");class B{}B.textBox="TextBox",B.comboBox="ComboBox",B.numericBox="NumericBox",B.relation="Relation",B.checkBox="CheckBox",B.linkTextBox="LinkTextBox",B.dateEdit="DateEdit",B.memoBox="MemoBox",B.multiSelectComboBox="MultiSelectComboBox",B.workflowState="WorkflowState",B.image="Image",B.multiSelectRelation="MultiSelectRelation";const W={[u.relations]:0,[u.unifiedRelations]:1,[u.users]:2,[u.groups]:3,[u.enumTypes]:4,[u.enumValues]:5,[u.additionalFields]:6};var H,z,Q,$;!function(e){e.Version75="7.5",e.Version76="7.6",e.Version77="7.7",e.Version80="8.0",e.Version81="8.1",e.Version82="8.2",e.Version83="8.3",e.Version90="9.0",e.Version91="9.1",e.Version92="9.2",e.Version93="9.3",e.Version94="9.4",e.Version100="10.0",e.Version101="10.1"}(H||(H={}));class q extends j{}q.is75OrLater=e=>j.supportsFeaturesOf(e,H.Version75),q.is76OrLater=e=>q.supportsFeaturesOf(e,H.Version76),q.is77OrLater=e=>q.supportsFeaturesOf(e,H.Version77),q.is80OrLater=e=>q.supportsFeaturesOf(e,H.Version80),q.is81OrLater=e=>q.supportsFeaturesOf(e,H.Version81),q.is82OrLater=e=>q.supportsFeaturesOf(e,H.Version82),q.is83OrLater=e=>q.supportsFeaturesOf(e,H.Version83),q.is90OrLater=e=>q.supportsFeaturesOf(e,H.Version90),q.is91OrLater=e=>q.supportsFeaturesOf(e,H.Version91),q.is92OrLater=e=>q.supportsFeaturesOf(e,H.Version92),q.is93OrLater=e=>q.supportsFeaturesOf(e,H.Version93),q.is94OrLater=e=>q.supportsFeaturesOf(e,H.Version94),q.is100OrLater=e=>q.supportsFeaturesOf(e,H.Version100),q.is101OrLater=e=>q.supportsFeaturesOf(e,H.Version101),q.isFeatureSupported=(e,t)=>q.supportsFeaturesOf(e,t);class J{static mainTable(){return{__type:"MainTable:#EQ"}}static relation(e,t,r){return{__type:"Relation:#EQ",Direction:r,ItemTypes:e,RelationType:t}}static join(e,t,r){const n={__type:"Join:#EQ",ItemType:e,Key:t};return r&&(n.TargetColumnName=r),n}static hubRelation(e){const{isToParentDirection:t,childrenFolderNames:r}=e,n={__type:"HubRelation:#EQ"};return void 0!==typeof t&&(n.IsToParentDirection=t),r&&(n.ChildrenFolderNames=r),n}}class X{static createHubItemsCountsQuery(e,t,r,n){return{__type:"HubItemsCountsQuery:#EQ",ParentItemGuids:e,ItemTypes:t,ExcludeSystemItems:r,SplitDate:n}}static createRelatedTableQuery(e,t,r){return{__type:r?"RelatedTableQuery:#EQ":"TypelessRelatedTableQuery:#EQ",BaseItemID:e,ItemTypes:Array.isArray(t)?t:[t],RelationType:r}}static createMainTableQuery(e){return{__type:"MainTableQuery:#EQ",ItemTypes:Array.isArray(e)?e:[e]}}}X.column=e=>({__type:"Column:#EQ",Source:J.mainTable(),Name:e}),X.multiSelectComboColumnLegacy=(e,t,r)=>({__type:"Column:#EQ",Source:J.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues]({0}, '${e}', '${t}')`,Alias:null!=r?r:e}),X.multiSelectComboColumn=(e,t,r,n,s)=>{if(!q.is77OrLater(e))return X.multiSelectComboColumnLegacy(r,n,s);return{__type:"Column:#EQ",Source:J.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues_WithObjectTypeID]({0}, dbo.GetObjectTypeID('${t}'), '${r}', '${n}')`,Alias:null!=s?s:r}},X.joinColumn=(e,t,r,n,s)=>X.joinColumnFromKey(e,X.column(t),r,n,s),X.joinColumnFromKey=(e,t,r,n,s)=>{const o={__type:"Column:#EQ",Source:J.join(e,t,s),Name:r};return n&&(o.Alias=n),o},X.singleVariatedColumn=(e,t,r)=>X.variatedColumn([X.columnVariation(e,t)],r),X.variatedColumn=(e,t)=>{const r={__type:"VariatedColumn:#EQ",Source:J.mainTable(),Variations:e};return t&&(r.Alias=t),r},X.columnVariation=(e,t,r)=>{const n={FolderName:t,Field:{__type:"Column:#EQ",Source:J.mainTable(),Name:e}};return r&&(n.Field.Transformation=r),n},X.joinColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:J.join(t,X.column(r)),Name:n}}),X.relationColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:J.relation(r,t,1),Name:n}}),X.relatedColumn=(e,t,r,n)=>{const s={__type:"Column:#EQ",Source:J.relation(t,e,1),Name:r};return n&&(s.Alias=n),s},X.relatedSubstituableColumn=(e,t,r,n,s)=>{const o={__type:"SubstituableColumn:#EQ",Source:J.relation(t,e,1),Name:r,Substitute:n};return s&&(o.Alias=s),o},X.relatedColumnFolderNameToken=(e,t,r)=>({__type:"Token:#EQ",Source:J.relation(t,e,1),TypeName:"ItemType",Alias:r}),X.hubRelationColumn=(e,t)=>({__type:"Column:#EQ",Source:J.hubRelation(t),Name:e}),X.aggregateColumn=(e,t,r)=>({__type:"AggregateColumn:#EQ",FunctionName:e,Source:t.Source,AggregatedField:t,Alias:r}),X.folderNameToken=e=>({__type:"Token:#EQ",Source:J.mainTable(),TypeName:"ItemType",Alias:null!=e?e:"FolderName"}),X.equalsFilterExpression=(e,t)=>({__type:"EqualsFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.notEqualsExpression=(e,t)=>({__type:"NotFilterExpression:#EQ",Child:X.equalsFilterExpression(e,t)}),X.andFilterExpression=e=>({__type:"AndFilterExpressionOperator:#EQ",Children:e}),X.orFilterExpression=e=>({__type:"OrFilterExpressionOperator:#EQ",Children:e}),X.lessFilterExpression=(e,t)=>({__type:"LessFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.lessOrEqualFilterExpression=(e,t)=>({__type:"LessOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.greaterFilterExpression=(e,t)=>({__type:"GreaterFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.greaterOrEqualFilterExpression=(e,t)=>({__type:"GreaterOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.likeFilterExpression=(e,t)=>({__type:"LikeFilterExpressionPredicate:#EQ",Field:e,Value:`%${t}%`}),X.inFilterExpression=(e,t)=>({__type:"InFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.relatedToExpression=(e,t)=>({__type:"RelatedToFilterExpressionPredicate:#EQ",Value:e,RelationType:t}),X.isNullOrEmptyFilterExpression=e=>X.orFilterExpression([X.equalsFilterExpression(X.column(e),null),X.equalsFilterExpression(X.column(e),"")]);class K{static trim(e,t,r=!1){if(null==e)return e;let n=e.trim();return n.length<=t||(n=n.substring(0,t-(r?3:0)),r&&(n+="...")),n}}class Y{static toRfc3339String(e){const t=e=>e<10?`0${e}`:String(e);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}${(e=>{if(0===e)return"Z";const r=e>0?"-":"+";return e=Math.abs(e),`${r}${t(Math.floor(e/60))}:${t(e%60)}`})(e.getTimezoneOffset())}`}}function Z(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}l((n=n.apply(e,t||[])).next())})}Y.isValid=e=>e instanceof Date&&!isNaN(e.getTime()),Y.areDaysEqual=(e,t)=>{const r=Y.clearTime(e),n=Y.clearTime(t);return r.getTime()===n.getTime()},Y.areTimesEqual=(e,t)=>e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes(),Y.areDatesEqual=(e,t)=>!!e&&!!t&&Y.areDaysEqual(e,t)&&Y.areTimesEqual(e,t),Y.clearTime=e=>{const t=new Date(e);return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t},Y.isWithoutTime=e=>0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds(),Y.getFormattedSqlDateTime=e=>e.toISOString().slice(0,19).replace("T"," "),Y.getRfcWithoutTimezone=e=>e.slice(0,19),function(e){e.OpenXmlDocx="OpenXmlDocx",e.Pdf="Pdf",e.WordMlXml="WordMlXml"}(z||(z={})),"function"==typeof SuppressedError&&SuppressedError;class ee{constructor(e,t,r,n,s){let o;if(this.sessionId=null,this.isAdmin=null,this.loginResponse=null,!(r||(o=h.decodeAccessToken(t),r=o.ws)))throw new Error("Failed to get web service URL from JWT");if(!(n||(o||(o=h.decodeAccessToken(t)),n=o.username)))throw new Error("Failed to get username from JWT");this.appName=e,this.wsUrl=r,this.userName=n,this.endpoint=r.startsWith("http://")?"InsecureAPI.svc":"API.svc",this.accessToken=t,this.sessionId=s||null}hasAdminRights(){return this.isAdmin}getWsUrl(){return this.wsUrl}getUserName(){return this.userName}getOutlookClientVersion(){var e;return null===(e=this.loginResponse)||void 0===e?void 0:e.OutlookClientVersion}getWebServiceVersion(){var e;return null===(e=this.loginResponse)||void 0===e?void 0:e.WcfVersion}getSessionId(){return this.sessionId}login(){return Z(this,void 0,void 0,function*(){const e={userName:this.userName,appVersion:this.appName},t=new Request(`${this.wsUrl}/${this.endpoint}/Login`,{method:"POST",headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(e)}),r=yield fetch(t),n=200===r.status?yield r.json():void 0;if(!n||"rcSuccess"!==n.ReturnCode)throw new Error(`Login failed: ${(null==n?void 0:n.Description)||r.statusText}`);this.sessionId=null==n?void 0:n.SessionId,this.isAdmin=null==n?void 0:n.IsAdmin,this.loginResponse=n})}logout(){return Z(this,void 0,void 0,function*(){if(!this.sessionId)throw new Error("Session ID is not set. Please call login() first.");const e=new Request(`${this.wsUrl}/${this.endpoint}/LogOut`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.sessionId})}),t=yield fetch(e);if("rcSuccess"!==(yield t.json()).ReturnCode)throw new Error("Failed to logout")})}validateSession(){return Z(this,void 0,void 0,function*(){if(!this.sessionId)throw new Error("Session ID is not set. Please call login() first.");const e=new Request(`${this.wsUrl}/${this.endpoint}/IsSessionValid`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.sessionId})}),t=yield fetch(e),r=yield t.json();if("rcSuccess"!==r.ReturnCode)throw new Error("Failed to validate session");return r.Result||!1})}getObjectTypes(){return Z(this,void 0,void 0,function*(){return(yield this.callMethod("GetObjectTypes",{})).Data})}getLicense(){return Z(this,void 0,void 0,function*(){return(yield this.callMethod("GetLicense",{})).Datum})}getClientVersionId(e){var t;return Z(this,void 0,void 0,function*(){const r={versionName:e};return null===(t=(yield this.callMethod("GetClientVersion",r)).Datum)||void 0===t?void 0:t.Id})}queryAmount(e,t=null){return Z(this,void 0,void 0,function*(){const r={query:{__type:"MainTableQuery:#EQ",ItemTypes:[e],Fields:[{__type:"Column:#EQ",Source:{__type:"MainTable:#EQ"},Name:"ItemGUID"}]}};return t&&(r.query.Filter=t),this.callMethod("QueryAmount",r)})}query(e,t=null,r=null,n=null){return Z(this,void 0,void 0,function*(){const s={query:{__type:"MainTableQuery:#EQ",ItemTypes:[e],Fields:t,Paging:{Skip:0,Take:500}}};return r&&(s.query.Filter=r),n&&(s.query.Sort=n),this.callMethod("Query",s)})}callMethod(e,t,r="POST"){return Z(this,void 0,void 0,function*(){if(!this.sessionId)throw new Error("Session ID is not set. Please call login() first.");t.sessionId=this.sessionId;const n=new Request(`${this.wsUrl}/${this.endpoint}/${e}`,{method:r,headers:{"Content-Type":"application/json"},body:"POST"===r?JSON.stringify(t):void 0}),s=yield fetch(n);if(!s.ok)throw new Error(`Error calling method ${e}: ${s.statusText}`);const o=200===s.status?yield s.json():void 0;if(!o||"rcSuccess"!==o.ReturnCode)throw new Error(`API call failed (${null==o?void 0:o.ReturnCode}): ${null==o?void 0:o.Description}`);return o})}static getTokenData(e,t,r,n,s){return Z(this,void 0,void 0,function*(){const o=new URLSearchParams;o.append("client_id",n),o.append("client_secret",s),o.append("code",t),o.append("redirect_uri",r),o.append("grant_type","authorization_code");const i=new Request(`${e}/auth/connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString()}),a=yield fetch(i);if(!a.ok)throw new Error(`Error calling token endpoint: ${a.statusText}`);const l=yield a.json();if(!l||!l.access_token)throw new Error("Failed to get access token");return l})}}class te{constructor(e,t){if(!e||!t)throw new Error("Both folderName and baseItem has to be defined!");this.folderName=e,this.baseItem=t}getEmailAddress(){switch(this.folderName){case u.contacts:{const e=this.baseItem;return e.Email1Address||e.Email2Address||e.Email3Address}case u.leads:return this.baseItem.Email;case u.companies:return this.baseItem.Email;case u.users:{const e=this.baseItem;return e.Email1Address||e.Email2Address}default:return null}}getInitials(){switch(this.folderName){case u.contacts:{const e=this.baseItem;return this.getInitialsInternal(e.FirstName,e.LastName)}case u.users:{const e=this.baseItem;return this.getInitialsInternal(e.FirstName,e.LastName)}default:return null}}getInitialsInternal(e,t){const r=((null==e?void 0:e.substr(0,1))||"")+((null==t?void 0:t.substr(0,1))||"");return""===r?null:r}getItemPreview(){switch(this.folderName){case u.contacts:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}case u.users:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}default:return null}}}!function(e){e.Readonly="Readonly",e.VisibleRankDefaultOnly="VisibleRankDefaultOnly",e.Editable="Editable"}(Q||(Q={})),function(e){e.Success="Success",e.Failure="Failed",e.FailureDuplicityFound="Failed_DuplicityFound",e.FailureItemAlreadyRemoved="Failed_ItemAlreadyRemoved",e.FailureColumnsLockedWFAction="Failed_ColumnsLocked",e.FailureItemLockedWFAction="Failed_ItemLocked",e.FailureLicenseLimitReached="Failed_LicenseLimitReached",e.FailureInssuficientModulePermission="Failed_InsufficientModulePermission",e.FailureInssuficientColumnsPermission="Failed_InsufficientColumnsPermission"}($||($={})),a.polyfill();export{S as ApiConnectionAsNonDefaultExport,ee as ApiFetchClient,d as ApiMethods,F as ColumnPermissionMandatoryRules,w as ColumnPermissionPermissionRules,A as CommonDataConnection,M as CustomizationStatsItemKeys,Y as DateHelper,te as EWItem,O as Edition,Q as EnumTypeEditMode,c as EnumTypes,P as ErrorHelper,_ as ExpirationReason,N as Feature,k as FieldNames,B as FieldTypes,u as FolderNames,x as Functionality,v as GlobalSettingsNames,o as HttpMethod,g as HttpRequestError,$ as ImportResult,V as LicenseKeyInvoiceSeverity,U as LicenseRestrictionKeys,h as OAuthHelper,f as OAuthSessionHandler,C as OAuthSessionHandlerBase,W as ObjectTypeIds,T as OpenItemLinkHelper,X as QueryHelper,b as RelationTypeIds,D as RelationTypes,l as ReturnCodes,R as SentimentTone,K as StringHelper,E as TokenizedServiceConnection,z as TransformItemFormats,H as Version,q as VersionHelper,j as VersionHelperBase,S as default};
8
+ */class l{}l.rcSuccess="rcSuccess",l.rcBadSession="rcBadSession",l.rcDuplicateContact="rcDuplicateContact",l.rcWebServiceMoved="rcWebServiceMoved",l.rcAccessDenied="rcAccessDenied",l.rcLoginUserNameChanged="rcLoginUserNameChanged",l.rcLicenseExpired="rcLicenseExpired",l.rcBadAccessToken="rcBadAccessToken",function(e){e.get="get",e.post="post"}(o||(o={}));class c{}c.absence="Absence",c.bonusType="BonusType",c.busyStatus="BusyStatus",c.cartType="CartType",c.companyType="CompanyType",c.contactType="ContactType",c.countryCode="CountryCode",c.currency="Currency",c.customFieldCategory="CustomFieldCategory",c.dayType="DayType",c.documentOfflineState="DocumentOfflineState",c.documentType="DocumentType",c.emailCampaignWorkflowStatus="EmailCampaignWorkflowStatus",c.emailOfflineState="EmailOfflineState",c.emailType="EmailType",c.familyStatus="FamilyStatus",c.firstContact="FirstContact",c.globalSettingsCategory="GlobalSettingsCategory",c.goalType="GoalType",c.groupColor="GroupColor",c.importance="Importance",c.journalType="JournalType",c.knowledgeLevel="KnowledgeLevel",c.knowledgeTitle="KnowledgeTitle",c.knowledgeType="KnowledgeType",c.leadType="LeadType",c.marketingType="MarketingType",c.paymentType="PaymentType",c.prefixType="PrefixType",c.productType="ProductType",c.projectOrigin="ProjectOrigin",c.projectType="ProjectType",c.reportCategory="ReportCategory",c.responseForm="ResponseForm",c.responseType="ResponseType",c.salaryDate="SalaryDate",c.salaryType="SalaryType",c.salePriceType="SalePriceType",c.sentimentTone="SentimentTone",c.suffixType="SuffixType",c.taskImportance="TaskImportance",c.tasksSnoozePeriod="TasksSnoozePeriod",c.taskStatus="TaskStatus",c.taskType="TaskType",c.trainingGrade="TrainingGrade",c.trainingTitle="TrainingTitle",c.translations="Translations",c.units="Units",c.userType="UserType",c.usStatesDistrictsTerritories="USStatesDistrictsTerritories",c.vacationType="VacationType",c.vat="VAT",c.workLoad="WorkLoad",c.workReportType="WorkReportType";class u{}u.isValidFolderName=e=>Object.values(u).includes(e),u.actions="Actions",u.additionalFields="AdditionalFields",u.bonuses="Bonuses",u.calendar="Calendar",u.capacityNotes="CapacityNotes",u.capacityNoteTypes="CapacityNoteTypes",u.carts="Carts",u.columnPermissions="ColumnPermissions",u.companies="Companies",u.contacts="Contacts",u.contactsSuggestions="ContactsSuggestions",u.currencyExchangeRates="CurrencyExchangeRates",u.documents="Documents",u.emails="Emails",u.enumTypes="EnumTypes",u.enumValues="EnumValues",u.enumValuesRelations="EnumValuesRelations",u.features="Features",u.flows="Flows",u.globalSettings="GlobalSettings",u.goals="Goals",u.goods="Goods",u.goodsInCart="GoodsInCart",u.goodsInSet="GoodsInSet",u.groups="Groups",u.history="History",u.holidays="Holidays",u.children="Children",u.individualDiscounts="IndividualDiscounts",u.invoiceItems="InvoiceItems",u.invoices="Invoices",u.itemCopyRelations="ItemCopyRelations",u.journal="Journal",u.knowledge="Knowledge",u.layouts="Layouts",u.layoutsModels="LayoutsModels",u.leads="Leads",u.ledger="Ledger",u.mappings="Mappings",u.marketing="Marketing",u.marketingList="MarketingList",u.marketingListSources="MarketingListSources",u.models="Models",u.modulePermissions="ModulePermissions",u.objectTypesOptions="ObjectTypesOptions",u.payments="Payments",u.priceListGroups="PriceListGroups",u.projectAssignments="ProjectAssignments",u.projectAssignmentsPerUserProject="ProjectAssignmentsPerUserProject",u.projectAssignmentsTotal="ProjectAssignmentsTotal",u.projectAssignmentsTotalUserProject="ProjectAssignmentsTotalUserProject",u.projectList="ProjectList",u.projects="Projects",u.projectUsersInCaPlan="ProjectUsersInCaPlan",u.relationData="RelationData",u.relations="Relations",u.reports="Reports",u.revisionsHistory="RevisionsHistory",u.salaries="Salaries",u.salePrices="SalePrices",u.prices="Prices",u.sqlObjects="SqlObjects",u.tasks="Tasks",u.recurrencePatterns="RecurrencePatterns",u.teamRoles="TeamRoles",u.templates="Templates",u.training="Training",u.unifiedRelations="UnifiedRelations",u.users="Users",u.userSettings="UserSettings",u.vacation="Vacation",u.webAccess2Options="WebAccess2Options",u.webAccessOptions="WebAccessOptions",u.workCommitments="WorkCommitments",u.workflowHistory="WorkflowHistory",u.workReports="WorkReports",u.wrongClientVersions="WrongClientVersions",u.xsltTransformations="XsltTransformations",u.xsltTransformationsModels="XsltTransformationsModels",u.getEnumTypeName=e=>e===u.bonuses?c.bonusType:e===u.carts?c.cartType:e===u.companies?c.companyType:e===u.contacts?c.contactType:e===u.documents?c.documentType:e===u.emails?c.emailType:e===u.goals?c.goalType:e===u.goods?c.productType:e===u.journal?c.journalType:e===u.knowledge?c.knowledgeType:e===u.leads?c.leadType:e===u.marketing?c.marketingType:e===u.projects?c.projectType:e===u.salaries?c.salaryType:e===u.salePrices?c.salePriceType:e===u.tasks?c.taskType:e===u.training?c.trainingTitle:e===u.users?c.userType:e===u.vacation?c.vacationType:e===u.workReports?c.workReportType:null,u.getFolderNameByEnumTypeName=e=>e===c.bonusType?u.bonuses:e===c.cartType?u.carts:e===c.companyType?u.companies:e===c.contactType?u.contacts:e===c.documentType?u.documents:e===c.emailType?u.emails:e===c.goalType?u.goals:e===c.journalType?u.journal:e===c.knowledgeType?u.knowledge:e===c.leadType?u.leads:e===c.marketingType?u.marketing:e===c.productType?u.goods:e===c.projectType?u.projects:e===c.salaryType?u.salaries:e===c.salePriceType?u.salePrices:e===c.taskType?u.tasks:e===c.trainingTitle?u.training:e===c.userType?u.users:e===c.vacationType?u.vacation:e===c.workReportType?u.workReports:null;class d{}d.getAllEmailAttachments="GetAllEmailAttachments",d.getCalendarsByItemGuids="GetCalendarsByItemGuids",d.getEmailAttachment="GetEmailAttachment",d.getItemPreview="GetItemPreview",d.getJournalsByItemGuids="GetJournalsByItemGuids",d.getMarketingCampaignsByItemGuids="GetMarketingCampaignsByItemGuids",d.getMarketingListsRecordsByItemGuids="GetMarketingListsRecordsByItemGuids",d.getRevisionHistoryRecordsByItemGuids="GetRevisionHistoryRecordsByItemGuids",d.getVacationsByItemGuids="GetVacationsByItemGuids",d.getWorkflowHistoryRecordsByItemGuids="GetWorkflowHistoryRecordsByItemGuids",d.getCompanyInformationFromTaxRegister="GetCompanyInformationFromTaxRegister",d.logIn="LogIn",d.logOut="LogOut",d.query="Query",d.queryAmount="QueryAmount",d.getServiceAuthSettings="GetServiceAuthSettings",d.getVersion="GetVersion",d.getBinaryAttachment="GetBinaryAttachment",d.getBinaryAttachmentLatestRevision="GetBinaryAttachmentLatestRevision",d.transformItem="TransformItem",d.canUnlinkItems="CanUnlinkItems",d.unlinkItems="UnlinkItems",d.getGoodsFinalPrices="GetGoodsFinalPrices",d.saveItemCopyRelation="SaveItemCopyRelation",d.getXsltTransormationDefinition="GetXsltTransformationDefinition",d.saveBinaryAttachment="SaveBinaryAttachment",d.saveBinaryXsltTransformation="SaveBinaryXsltTransformation",d.GetLoginHistory="GetLoginHistory",d.GetMyLoginHistory="GetMyLoginHistory",d.getFolderNameForApiMethod=e=>{switch(e){case u.calendar:return"Calendars";case u.journal:return"Journals";case u.marketing:return"MarketingCampaigns";case u.marketingList:return"MarketingListsRecords";case u.revisionsHistory:return"RevisionHistoryRecords";case u.vacation:return"Vacations";case u.workflowHistory:return"WorkflowHistoryRecords";default:return e}},d.getGetFolderNameByItemGuidsMethodName=e=>`Get${d.getFolderNameForApiMethod(e)}ByItemGuids`,d.getGetFolderNameMethodName=e=>`Get${d.getFolderNameForApiMethod(e)}`,d.getSearchFolderNameMethodName=e=>`Search${d.getFolderNameForApiMethod(e)}`;class m{constructor(e,t,r,n,s,o){if(this.invalidateSessionId=(e,t)=>{t&&t()},this.getSessionId=(e,t)=>{e.callWithoutSession(d.logIn,{userName:this.username,passwordHash:this.passwordHash,appVersion:this.appVersion,clientMachineIdentifier:this.clientMachineIdentifier,clientMachineName:this.clientMachineName,createSessionCookie:e.supportsGetItemPreviewMethod},e=>{this.lastSuccessfulLoginResponse=e;const r=e.SessionId;if(!r){const e=new Error("Successful login but no session came.");if(!this.errorCallback)throw e;return void this.errorCallback(e)}t&&t(r,e)},e=>{const t=new Error("Unable to login. Error response follows.\n"+JSON.stringify(e));if(!this.errorCallback)throw t;this.errorCallback(t)})},!e||!t)throw new Error("Non of the arguments 'username', 'passwordHash' can be empty.");this.username=e,this.passwordHash=t,this.appVersion=r,this.clientMachineIdentifier=n,this.clientMachineName=s,this.errorCallback=o}}class p{constructor(){this.getSessionId=(e,t)=>{throw new Error("With anonymous session handler, use only connection methods without session.")},this.invalidateSessionId=(e,t)=>{throw new Error("With anonymous session handler, use only connection methods without session.")}}}class h{static createAuthorizeUrl(e,t,r,n,s,o,i=!1,a){if(s&&!o||!s&&o)throw new Error("If codeChallenge is defined, codeChallengeMethod must also be defined and vice versa");let l=`https://login.eway-crm.${i?"dev":"com"}?scope=${encodeURIComponent(t.join(" "))}&prompt=login&response_type=code&redirect_uri=${encodeURIComponent(r)}&client_id=${e}`;return n&&(l+=`&state=${encodeURIComponent(n)}`),s&&o&&(l+=`&code_challenge=${encodeURIComponent(s)}&code_challenge_method=${encodeURIComponent(o)}`),a&&(l+=`&url=${encodeURIComponent(a)}`),l}}h.finishAuthorization=(e,t,r,n,s,o,i)=>{const a=new URLSearchParams;a.append("code_verifier",n),a.append("client_id",t),a.append("client_secret",r),a.append("code",s),a.append("redirect_uri",o),a.append("grant_type","authorization_code"),h.callTokenEndpoint(e,a,i)},h.refreshToken=(e,t,r,n,s)=>{const o=new URLSearchParams;o.append("client_id",t),o.append("client_secret",r),o.append("refresh_token",n),o.append("grant_type","refresh_token"),h.callTokenEndpoint(e,o,s)},h.getWebServiceUrl=e=>{const r=e.split(".");if(2!==r.length)throw new Error("Invalid token supplied");return t.decode(r[1])},h.getUserName=e=>h.decodeAccessToken(e).username,h.decodeAccessToken=e=>r(e),h.callTokenEndpoint=(t,r,n)=>{e.post(t+"/auth/connect/token",r,{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(e=>{n(e.data)}).catch(e=>{e.response&&400===e.response.status?n(e.response.data):n({error:"Token request failed"})})};class y extends Error{constructor(e,t){super(),this.returnCode=e,this.message=t}}class C{constructor(e,t,r,n,s){if(!e)throw new Error("Non of the arguments 'username', 'clientId', 'clientSecret', 'refreshToken' can be empty.");this.username=e,this.accessToken=t,this.appVersion=r,this.getNewAccessTokenCallback=n,this.errorCallback=s}invalidateSessionId(e,t){t&&t()}getSessionId(e,t){const r={userName:this.username,appVersion:this.appVersion,createSessionCookie:e.supportsGetItemPreviewMethod},n={Authorization:"Bearer "+this.accessToken};e.callWithoutSession(d.logIn,r,e=>{this.lastSuccessfulLoginResponse=e;const r=e.SessionId;if(!r){const e=new Error("Successful login but no session came.");if(!this.errorCallback)throw e;return void this.errorCallback(e)}t&&t(r,e)},e=>{const t=new y(e.ReturnCode,"Unable to login. Error response follows.\n"+JSON.stringify(e));if(!this.errorCallback)throw t;this.errorCallback(t)},n,void 0,r=>{if(401!==(null==r?void 0:r.statusCode)){if(!this.errorCallback)throw r;this.errorCallback(r)}else this.getNewAccessTokenCallback(e,r=>{this.accessToken=r.accessToken,r.error||this.getSessionId(e,t)})})}}class f extends C{constructor(e,t,r,n,s,o,i,a){if(!(e&&n&&t&&r))throw new Error("Non of the arguments 'username', 'clientId', 'clientSecret', 'refreshToken' can be empty.");super(e,s,o,(e,t)=>{h.refreshToken(e.wsUrl,this.clientId,this.clientSecret,this.refreshToken,e=>{try{this.refreshTokenCallback&&this.refreshTokenCallback(e)}catch(e){this.errorCallback&&this.errorCallback(new Error("Refresh token callback failed.\n"+JSON.stringify(e)))}void 0!==e.error?t({error:e.error}):t({accessToken:e.access_token})})},i),this.refreshToken=n,this.clientId=t,this.clientSecret=r,this.refreshTokenCallback=a}}class g extends Error{constructor(e,t,r){super(t),this.statusCode=e,this.message=t,this.responseData=r}}g.from=e=>{var t;const r=null===(t=e.data)||void 0===t?void 0:t.Description,n="string"==typeof r&&r?r:e.statusText;return new g(e.status,n,e.data)};class P{}P.stringifyError=e=>JSON.stringify(e,P.replaceErrors),P.replaceErrors=(e,t)=>{if(t instanceof Error){const e={};return Object.getOwnPropertyNames(t).forEach(r=>{e[r]=t[r]}),e}return t};class T{}T.openItemLinkRegEx=/https:\/\/open\.eway-crm\.(dev|com)\/\?[-a-zA-Z0-9()@:%_\+.~#?&\/=]*/gi,T.itemParamName="l",T.openLinkDomainLength=7,T.getOpenLinkDomain=e=>e?"open.eway-crm.dev":"open.eway-crm.com",T.isOpenItemLinkInText=e=>T.openItemLinkRegEx.test(e),T.getOpenLinksFromString=e=>e.match(T.openItemLinkRegEx),T.getItemLinksFromOpenLinks=e=>{try{return e.map(e=>new URL(e).searchParams.get(T.itemParamName))}catch(e){console.error("Invalid string passed for cretaing url while getting links from open links")}},T.getItemInfoFromLink=e=>{const r=t.decode(e).substring(T.openLinkDomainLength).split("/");if(Object.keys(u).some(e=>u[e]===r[0])&&r[1]){return{folderName:r[0],itemGuid:r[1]}}},T.getAllItemsFromTextWithLinks=e=>{const t={};if(T.isOpenItemLinkInText(e)){const r=T.getOpenLinksFromString(e);if(!r)return;const n=T.getItemLinksFromOpenLinks(r);null==n||n.forEach(e=>{var r;if(!e)return;const n=T.getItemInfoFromLink(e);n&&(t[n.folderName]=t[n.folderName]?[...null!==(r=t[n.folderName])&&void 0!==r?r:[],n.itemGuid]:[n.itemGuid])})}return t};class S{constructor(r,n,s,i){if(this.ensureLogin=()=>new Promise((e,t)=>{if(this.sessionId)e();else{const r=r=>{r&&(this.sessionId=r,e()),t("Session Id cannot be empty")};this.sessionHandler.getSessionId(this,r)}}),this.createOpenLink=(e,r,n,s)=>{const o=t.encode(this.baseUri);let i="eway://"+r;n&&(i+="/"+(null==n?void 0:n.toLowerCase()));const a=T.getOpenLinkDomain(e);i=t.encode(i);let l="https://"+a+"/?ws="+o+`&${T.itemParamName}=`+i;return s&&(l+="&n="+encodeURIComponent(s)),l},this.askCustomUploadMethod=(e,t,r,n,s)=>new Promise((o,i)=>{const a=s?e=>{throw i(e),e}:i;this.callCustomUploadMethod(e,t,r,o,a,a,n)}),this.askUploadMethod=(e,t,r,n,s)=>new Promise((o,i)=>{const a=s?e=>{throw i(e),e}:i;this.callUploadMethod(e,t,r,o,a,a,n)}),this.callCustomUploadMethod=(t,r,n,s,o,i,a)=>{const c=()=>{this.sessionHandler.getSessionId(this,e=>{this.sessionId=e,this.callCustomUploadMethod(t,r,n,s,o,i,a)})},u=this.sessionId;if(!u)return void c();const d=new URLSearchParams(r),m=`${this.svcUri}/${n}?sessionId=${this.sessionId}&${d.toString()}`,p=e.post(m,t,a);S.handleCallPromise(p,s,e=>{if(e.ReturnCode===l.rcBadSession)return this.sessionId=null,void this.sessionHandler.invalidateSessionId(u,c);if(o)o(e);else{const t=new Error("Unhandled connection return code "+e.ReturnCode+": "+e.Description);if(!this.errorCallback)throw t;this.errorCallback(t)}},e=>{let t=new Error("Unhandled connection error when calling "+m+": "+P.stringifyError(e));if("statusCode"in e&&413===e.statusCode&&(t=new Error("The file has exceeded the maximum allowed file size for uploading. You can contact your IT administrator or eWay-CRM support if you would like to increase the limit.")),i)i(t);else{if(!this.errorCallback)throw t;this.errorCallback(t)}})},this.callUploadMethod=(e,t,r,n,s,o,i)=>{this.callCustomUploadMethod(r,{itemGuid:e,fileName:t},d.saveBinaryAttachment,n,s,o,i)},this.askMethod=(e,t,r,n)=>new Promise((s,o)=>{const i=n?e=>{throw o(e),e}:o;this.callMethod(e,t,s,i,r,i)}),this.callMethod=(e,t,r,n,s,i)=>{s||(s=o.post);const a=()=>{this.sessionHandler.getSessionId(this,o=>{this.sessionId=o,this.callMethod(e,t,r,n,s,i)})},c=this.sessionId;if(!c)return void a();t.sessionId=c;const u=e!==d.logOut?r:e=>{this.sessionId=null,r(e)};this.callWithoutSession(e,t,u,r=>{if(r.ReturnCode!==l.rcBadSession||(this.sessionId=null,e===d.logOut))if(n)n(r);else{const e=new Error("Unhandled connection return code "+r.ReturnCode+": "+r.Description);if(!this.errorCallback)throw e;this.errorCallback(e,t)}else this.sessionHandler.invalidateSessionId(c,a)},null,s,i)},this.callWithoutSession=(t,r,n,s,i,a,l)=>{var c;a||(a=o.post);const u=this.svcUri+"/"+t;let m,p;switch(i&&(m={headers:i,withCredentials:null!==(c=this.supportGetItemPreviewMethod)&&void 0!==c?c:t===d.logIn}),a){case o.get:if(r)throw new Error("Calling api get method with data specified does not make any sense.");p=e.get(u,m);break;case o.post:p=e.post(u,r,m);break;default:throw new Error(`Unknown http method '${a}'.`)}S.handleCallPromise(p,n,s,e=>{if(l)try{l(e)}catch(e){if(!this.errorCallback)throw e;this.errorCallback(e,r)}else{const t=new Error("Unhandled connection error when calling "+u+": "+P.stringifyError(e));if(!this.errorCallback)throw t;this.errorCallback(t,r)}})},this.getItemPreviewGetMethodUrl=(e,t,r)=>this.svcUri+"/"+d.getItemPreview+"?folderName="+encodeURIComponent(e)+"&itemGuid="+encodeURIComponent(t)+(r||0===r?"&itemVersion="+encodeURIComponent(r.toString()):""),this.getEmailAttachmentGetMethodUrl=(e,t)=>this.svcUri+"/"+d.getEmailAttachment+"?itemGuid="+encodeURIComponent(e)+"&contentId="+encodeURIComponent(t),this.getAllEmailAttachmentsZipGetMethodUrl=e=>this.svcUri+"/"+d.getAllEmailAttachments+"?itemGuid="+encodeURIComponent(e),this.getBinaryAttachmentGetMethodUrl=(e,t)=>"number"==typeof t?this.svcUri+"/"+d.getBinaryAttachment+"?itemGuid="+encodeURIComponent(e)+`&revision=${t}`:this.svcUri+"/"+d.getBinaryAttachmentLatestRevision+"?itemGuid="+encodeURIComponent(e),this.getTransformItemMethodUrl=(e,t,r,n,s)=>`${this.svcUri}/${d.transformItem}?itemGuid=${encodeURIComponent(e)}&itemFolderName=${encodeURIComponent(t)}&transformationGuid=${encodeURIComponent(r)}&outputFormat=${n}${s?`&lang=${encodeURIComponent(s)}`:""}`,this.getXsltTransformationDefinitionMethodUrl=e=>`${this.svcUri}/${d.getXsltTransormationDefinition}?itemGuid=${encodeURIComponent(e)}`,this.getActiveSessionId=()=>this.sessionId,this.setActiveSessionId=e=>{this.sessionId=e},!r)throw new Error("The argument 'apiServiceUri' cannot be empty.");if(r.length<8||"https://"!==r.substr(0,8).toLowerCase()&&"http://"!==r.substr(0,7).toLowerCase())throw new Error("Api service uri must start either with 'https://' or with 'http://'.");if(".svc"===r.substr(r.length-4).toLowerCase()){this.svcUri=r;const e=["/API.svc","/InsecureAPI.svc","/WcfService/Service.svc"].find(e=>e.toLowerCase()===r.substr(r.length-e.length).toLowerCase())||"";this.baseUri=r.substr(0,r.length-e.length)}else this.baseUri=S.normalizeWsUrl(r)||r,"https://"===r.substr(0,8).toLowerCase()?this.svcUri=this.baseUri+"/API.svc":this.svcUri=this.baseUri+"/InsecureAPI.svc";this.sessionHandler=n,this.errorCallback=s,this.sessionId=null,this.supportGetItemPreviewMethod=null!=i&&i}get supportsGetItemPreviewMethod(){return this.supportGetItemPreviewMethod}static create(e,t,r,n,s,o,i,a){return new S(e,new m(t,r,n,s,o,i),i,a)}static createAnonymous(e,t){return new S(e,new p,t)}static createUsingOAuth(e,t,r,n,s,o,i,a,l,c){return new S(e,new f(t,r,n,s,o,i,a,l),a,c)}static normalizeWsUrl(e){return e&&e.endsWith("/")&&(e=e.substring(0,e.length-1)),e}static isCloudUrl(e,t){const r=new URL(e),n=new Set;return n.add("eway-crm.com"),n.add("eway-crm.us"),t&&(n.add("eway-crm.dev"),n.add("localhost")),n.has(S.getRootDomain(r.hostname))}static getRootDomain(e){const t=e.split(".");return!t||t.length<=2?e:t.slice(-2).join(".")}get wsUrl(){return this.baseUri}static handleCallPromise(e,t,r,n){e.then(e=>{200===e.status?e.data.ReturnCode===l.rcSuccess?t(e.data):r(e.data):n(g.from(e))}).catch(e=>{e.response?n(g.from(e.response)):n(e)})}}class E{constructor(e,t,r,n,s,o,i){this.isEnabled=(e,t)=>{const r=()=>{this.url&&this.token?e(this.url,this.token):t()};this.url&&this.token?e(this.url,this.token):this.obtainToken(r)},this.callTokenizedApi=(e,t,r,n)=>{this.isEnabled((s,o)=>{t.token=o,E.call(s,e,t,r,s=>{if(s.ReturnCodeString!==this.invalidTokenReturnCode){if(n)n(s);else if(this.generalErrorCallback){const e=new Error("Unhandled tokenized service connection return code "+s.ReturnCodeString+".\nDescription: "+s.Description);this.generalErrorCallback(e)}}else this.obtainToken(()=>{this.callTokenizedApi(e,t,r,n)})},e=>{if(this.generalErrorCallback){const t=new Error("Unhandled tokenized service connection communication error: "+JSON.stringify(e));this.generalErrorCallback(t)}})},()=>{n&&n(null)})},this.obtainToken=e=>{if(!this.isActive)return this.url=null,this.token=null,void e();const t=t=>{const r=this.urlAndTokenObtainer(t);r.url&&r.token?(this.url=r.url,this.token=r.token,this.isActive=!0,e()):(this.url=null,this.token=null,this.isActive=!1,e())},r=()=>{this.url=null,this.token=null,this.isActive=!1,e()};this.needsSession?this.connection.callMethod(this.obtainTokenMethodName,{},t,r,this.obtainTokenMethodType):this.connection.callWithoutSession(this.obtainTokenMethodName,null,t,r,null,this.obtainTokenMethodType)},this.obtainTokenMethodName=e,this.obtainTokenMethodType=t,this.needsSession=r,this.invalidTokenReturnCode=n,this.urlAndTokenObtainer=s,this.connection=o,this.generalErrorCallback=i||null,this.url=null,this.token=null,this.isActive=!0}static call(t,r,n,s,o,i){const a=t+"/"+r;e.post(a,n).then(e=>{200===e.status?"Success"===e.data.ReturnCodeString?s(e.data):o(e.data):i(g.from(e))}).catch(e=>{e.response?i(g.from(e.response)):i(e)})}}const I=e=>({url:e.ServiceUrl,token:e.Token});class A{constructor(e,t){this.isCommonDataApiEnabled=(e,t)=>{this.tokenizedConnection.isEnabled(e,t)},this.callCommonDataApi=(e,t,r,n)=>{this.tokenizedConnection.callTokenizedApi(e,t,r,n)},this.tokenizedConnection=new E("ObtainCommonDataApiAccessToken",o.get,!1,"InvalidCommonDataToken",I,e,t)}}class v{}v.acceptableBackwardWorkReportDays="AcceptableBackwardWorkReportDays",v.adminAppInactiveLogoutTime="AdminAppInactiveLogoutTime",v.allowChangeGoodsInCartListPrice="AllowChangeGoodsInCartListPrice",v.applyGeneralDataProtectionRules="ApplyGeneralDataProtectionRules",v.automaticallyCreateJournalAfterCallDuration="AutomaticallyCreateJournalAfterCallDuration",v.bonusesCompletedState="BonusesCompletedState",v.cartInvoicedState="CartInvoicedState",v.cartOrderCanceledState="CartOrderCanceledState",v.cartOrderInProcessState="CartOrderInProcessState",v.cartOrderProcessedState="CartOrderProcessedState",v.cartPaidState="CartPaidState",v.cartProposalInProcessState="CartProposalInProcessState",v.cartProposalProcessedState="CartProposalProcessedState",v.cartSalesVoucherIssuedState="CartSalesVoucherIssuedState",v.cartToBeInvoicedState="CartToBeInvoicedState",v.cartVoidedState="CartVoidedState",v.clickToCallScheme="ClickToCallScheme",v.companyDuplicityCheckEnabled="CompanyDuplicityCheckEnabled",v.completedStateName="CompletedStateName",v.contactDuplicityCheckEnabled="ContactDuplicityCheckEnabled",v.createCompanyWhileImportingContactFromOutlook="CreateCompanyWhileImportingContactFromOutlook",v.defaultProposalValidityPeriod="DefaultProposalValidityPeriod",v.enableContactsTwoWaySyncWithM365="EnableContactsTwoWaySyncWithM365",v.deadStateName="DeadStateName",v.enableCompaniesSyncIntoMobileDeviceContacts="EnableCompaniesSyncIntoMobileDeviceContacts",v.enableContactsSyncIntoMobileDevice="EnableContactsSyncIntoMobileDevice",v.enableLeadsSyncIntoMobileDeviceContacts="EnableLeadsSyncIntoMobileDeviceContacts",v.enableLlamaAiFeatures="EnableLlamaAiFeatures",v.enableUsersSyncIntoMobileDeviceContacts="EnableUsersSyncIntoMobileDeviceContacts",v.emailsActiveProjectsLeadsFilter="EmailsActiveProjectsLeadsFilter",v.trackToAddressesOnly="TrackToAddressesOnly",v.exchangeRatesAdminGroupName="ExchangeRatesAdminGroupName",v.forcedEmailTrackingGroups="ForcedEmailTrackingGroups",v.ignoreEmailsFromDomainsOnEmailsTracking="IgnoreEmailsFromDomainsOnEmailsTracking",v.trackEmailsFromDomains="TrackEmailsFromDomains",v.groupsForAllUnpaidInvoicesNotification="GroupsForAllUnpaidInvoicesNotification",v.itemPreviewMaxHeight="ItemPreviewMaxHeight",v.lastActivityAttributes="LastActivityAttributes",v.leadsCompletedState="LeadsCompletedState",v.leadDeadlineAlertGroups="LeadDeadlineAlertGroups",v.leadsDeadState="LeadsDeadState",v.marketingCompletedState="MarketingCompletedState",v.marketingDeadState="MarketingDeadState",v.minimumPasswordLength="MinimumPasswordLength",v.nextStepAttributes="NextStepAttributes",v.notifyAboutInvoicedInvoiceInPohodaGroup="NotifyAboutInvoicedInvoiceInPohodaGroup",v.notifyAboutLeadsDeadline="NotifyAboutLeadsDeadline",v.notifyAboutPaidInvoiceInPohodaGroup="NotifyAboutPaidInvoiceInPohodaGroup",v.notifyAboutProjectDeadline="NotifyAboutProjectDeadline",v.numberOfDecimalPlaces="NumberOfDecimalPlaces",v.phoneListTaskSolverGroup="PhoneListTaskSolverGroup",v.projectDeadlineAlert="ProjectDeadlineAlert",v.serverUpdateProgressNotificationGroup="ServerUpdateProgressNotificationGroup",v.sumarizeCartsPricesOnLeads="SumarizeCartsPricesOnLeads",v.sumarizeCartsPricesOnProjects="SumarizeCartsPricesOnProjects",v.sumarizePeopleExpensesOnProjects="SumarizePeopleExpensesOnProjects",v.systemHealthNotificationGroup="SystemHealthNotificationGroup",v.tasksCompletedState="TasksCompletedState",v.tasksDeferredState="TasksDeferredState",v.tasksInProgressState="TasksInProgressState",v.tasksNotStartedState="TasksNotStartedState",v.tasksWaitOnSomeoneElseState="TasksWaitOnSomeoneElseState",v.trackDocumentVersions="TrackDocumentVersions",v.vacationCompletedState="VacationCompletedState",v.workReportApprovedState="WorkReportApprovedState",v.defaultLanguage="DefaultLanguage",v.defaultCurrency="DefaultCurrency",v.myCompanyCountry="MyCompanyCountry",v.myCompanyName="MyCompanyName",v.myCompanyStreet="MyCompanyStreet",v.myCompanyCity="MyCompanyCity",v.myCompanyState="MyCompanyState",v.myCompanyZip="MyCompanyZIP",v.myCompanyId="MyCompanyID",v.myCompanyVat="MyCompanyVAT",v.mergeGoodsInCart="MergeGoodsInCart",v.cartRefreshLogic="CartRefreshLogic",v.goodsDefaultQuantity="GoodsDefaultQuantity",v.goodsDefaultVAT="GoodsDefaultVAT",v.goodsDefaultVATIncluded="GoodsDefaultVATIncluded",v.recalculateOnListPriceChange="RecalculateOnListPriceChange",v.recalculateOnPurchasePriceChange="RecalculateOnPurchasePriceChange";class k{}k.ServerCommon={Server_ID:"Server_ID",Server_ItemCreated:"Server_ItemCreated",Server_ItemChanged:"Server_ItemChanged"},k.Common={CreatedByGUID:"CreatedByGUID",CurrencyEn:"CurrencyEn",DefaultCurrencySuffix:"DefaultCurrency",FileAs:"FileAs",ItemCreated:"ItemCreated",ItemChanged:"ItemChanged",ItemGUID:"ItemGUID",ItemVersion:"ItemVersion",ModifiedByGUID:"ModifiedByGUID",OwnerGUID:"OwnerGUID",ParentCurrencySuffix:"ParentCurrency",Picture:"Picture"},k.Calendar={Location:"Location",StartDate:"StartDate",EndDate:"EndDate",AllDayEvent:"AllDayEvent",SuperiorItem:"SuperiorItem",BusyStatus:"BusyStatus",GraphID:"GraphID",GraphCalendarID:"GraphCalendarID",Note:"Note"},k.Carts={SuperiorItem:"SuperiorItem",Customer:"Customer",Contact:"Contact",TypeEn:"TypeEn",StateEn:"StateEn",PriceTotal:"PriceTotal",PriceTotalExcludingVAT:"PriceTotalExcludingVAT",ForPayment:"ForPayment",Paid:"Paid",CurrencyEn:"CurrencyEn",EffectiveFrom:"EffectiveFrom",ValidUntil:"ValidUntil",Active:"Active",Note:"Note",ID:"ID",AccountingCaseDate:"AccountingCaseDate",TaxableSupplyDate:"TaxableSupplyDate",PaymentDate:"PaymentDate",VAT:"VAT",GoodsInCartCount:"GoodsInCartCount",PriceTotalDefaultCurrency:"PriceTotalDefaultCurrency",PriceTotalParentCurrency:"PriceTotalParentCurrency",ForPaymentDefaultCurrency:"ForPaymentDefaultCurrency",ForPaymentParentCurrency:"ForPaymentParentCurrency",PaidDefaultCurrency:"PaidDefaultCurrency",PaidParentCurrency:"PaidParentCurrency",PaidChanged:"PaidChanged",PriceTotalChanged:"PriceTotalChanged",PriceTotalExcludingVATDefaultCurrency:"PriceTotalExcludingVATDefaultCurrency",PriceTotalExcludingVATParentCurrency:"PriceTotalExcludingVATParentCurrency",VATDefaultCurrency:"VATDefaultCurrency",VATParentCurrency:"VATParentCurrency",PrevStateEn:"PrevStateEn",PurchaseExpenses:"PurchaseExpenses",PurchaseExpensesDefaultCurrency:"PurchaseExpensesDefaultCurrency",PurchaseExpensesParentCurrency:"PurchaseExpensesParentCurrency",PurchaseExpensesChanged:"PurchaseExpensesChanged",Profit:"Profit",ProfitDefaultCurrency:"ProfitDefaultCurrency",ProfitParentCurrency:"ProfitParentCurrency",ProfitChanged:"ProfitChanged"},k.Companies={ID:"ID",CompanyName:"CompanyName",Department:"Department",AccountNumber:"AccountNumber",IdentificationNumber:"IdentificationNumber",VatNumber:"VatNumber",Sales:"Reversal",EmployeesCount:"EmployeesCount",Purchaser:"Purchaser",Suppliers:"Suppliers",Competitor:"Competitor",Address1Street:"Address1Street",Address1City:"Address1City",Address1PostalCode:"Address1PostalCode",Address1CountryEn:"Address1CountryEn",Address1State:"Address1State",Address1POBox:"Address1POBox",Address2Street:"Address2Street",Address2City:"Address2City",Address2PostalCode:"Address2PostalCode",Address2CountryEn:"Address2CountryEn",Address2State:"Address2State",Address2POBox:"Address2POBox",Address3Street:"Address3Street",Address3City:"Address3City",Address3PostalCode:"Address3PostalCode",Address3CountryEn:"Address3CountryEn",Address3State:"Address3State",Address3POBox:"Address3POBox",InvoiceAddress:"InvoiceAddress",PostalAddress:"PostalAddress",Phone:"Phone",Mobile:"Mobile",Fax:"Fax",WebPage:"WebPage",TrackedDomains:"TrackedDomains",Email:"Email",ICQ:"ICQ",MSN:"MSN",Skype:"Skype",ImportanceEn:"ImportanceEn",FirstContactEn:"FirstContactEn",LineOfBusiness:"LineOfBusiness",EmailOptOut:"EmailOptOut",MailingListOther:"MailingListOther",MailingListOtherValue:"MailingListOtherValue",Note:"Note",IsPrivate:"IsPrivate",NextStep:"NextStep",LastActivity:"LastActivity",AdditionalDiscount:"AdditionalDiscount"},k.Contacts={ProfilePicture:"ProfilePicture",Title:"Title",Email1Address:"Email1Address",Email2Address:"Email2Address",Email3Address:"Email3Address",DoNotSendNewsletter:"DoNotSendNewsletter",ImportanceEn:"ImportanceEn",PrefixEn:"PrefixEn",FirstName:"FirstName",MiddleName:"MiddleName",LastName:"LastName",SuffixEn:"SuffixEn",BusinessAddressStreet:"BusinessAddressStreet",BusinessAddressCity:"BusinessAddressCity",BusinessAddressPostalCode:"BusinessAddressPostalCode",BusinessAddressCountryEn:"BusinessAddressCountryEn",BusinessAddressState:"BusinessAddressState",BusinessAddressPoBox:"BusinessAddressPOBox",HomeAddressStreet:"HomeAddressStreet",HomeAddressCity:"HomeAddressCity",HomeAddressPostalCode:"HomeAddressPostalCode",HomeAddressCountryEn:"HomeAddressCountryEn",HomeAddressState:"HomeAddressState",HomeAddressPOBox:"HomeAddressPOBox",OtherAddressStreet:"OtherAddressStreet",OtherAddressCity:"OtherAddressCity",OtherAddressPostalCode:"OtherAddressPostalCode",OtherAddressCountryEn:"OtherAddressCountryEn",OtherAddressState:"OtherAddressState",OtherAddressPOBox:"OtherAddressPOBox",BusinessPhoneNumber:"TelephoneNumber1",BusinessPhoneNumber2:"TelephoneNumber5",BusinessFaxNumber:"TelephoneNumber6",MobilePhoneNumber:"TelephoneNumber3",HomePhoneNumber:"TelephoneNumber2",OtherPhoneNumber:"TelephoneNumber4",ICQ:"ICQ",MSN:"MSN",Skype:"Skype",WebPage:"WebPage",Note:"Note",Department:"Department",Company:"Company",IsPrivate:"Private",NextStep:"NextStep",LastActivity:"LastActivity"},k.Leads={ID:"ID",FileAs:"FileAs",HumanID:"HID",Customer:"Customer",ContactPerson:"ContactPerson",Marketing:"Marketing",ReceiveDate:"ReceiveDate",Email:"Email",Phone:"Phone",Street:"Street",State:"State",CountryEn:"CountryEn",City:"City",POBox:"POBox",Zip:"Zip",Price:"Price",PriceChanged:"PriceChanged",CurrencyEn:k.Common.CurrencyEn,EstimatedEnd:"EstimatedEnd",Probability:"Probability",LeadOriginEn:"LeadOriginEn",PriceDefaultCurrency:"PriceDefaultCurrency",EstimatedValue:"EstimatedValue",EstimatedValueDefaultCurrency:"EstimatedValueDefaultCurrency",Note:"Note",TypeEn:"TypeEn",StateEn:"StateEn",PrevStateEn:"PrevStateEn",IsPrivate:"Private",EmailOptOut:"EmailOptOut",NextStep:"NextStep",LastActivity:"LastActivity",ItemVersion:"ItemVersion",EstimatedRevenue:"EstimatedRevenue",EstimatedRevenueDefaultCurrency:"EstimatedRevenueDefaultCurrency",CompletedDate:"CompletedDate",LostDate:"LostDate"},k.Documents={FileAs:"FileAs",DocName:"DocName",Preview:"Preview",PreviewWidth:"PreviewWidth",PreviewHeight:"PreviewHeight",DocTypeEn:"DocTypeEn",StateEn:"StateEn",ImportanceEn:"ImportanceEn",SuperiorItem:"SuperiorItem",SuperiorCompany:"Company",SuperiorContact:"Contact",DocSize:"DocSize",Extension:"Extension",CreationTime:"CreationTime",LastWriteTime:"LastWriteTime",IsPrivate:"Private",Note:"Note",ExternalUrl:"ExternalUrl"},k.Emails={To:"To",From:"SenderEmailAddress",Cc:"Cc",Subject:"Subject",ImportanceEn:"ImportanceEn",SuperiorItem:"SuperiorItem",SentOn:"SentOn",ReceivedTime:"ReceivedTime",FileSize:"FileSize",AttachmentsCount:"AttachmentsCount",Note:"Note",SentimentTone:"SentimentTone",Summary:"Summary"},k.GoodsBase={Code:"Code",Structure:"Structure",Note:"Note",Description:"Description",TypeEn:"TypeEn",SaleCurrencyEn:"SaleCurrencyEn",PurchaseCurrencyEn:"PurchaseCurrencyEn",UnitEn:"UnitEn",PurchasePrice:"PurchasePrice",PurchasePriceDefaultCurrency:"PurchasePriceDefaultCurrency",PurchasePriceChanged:"PurchasePriceChanged",SalePrice:"SalePrice",SalePriceDefaultCurrency:"SalePriceDefaultCurrency",SalePriceChanged:"SalePriceChanged",IsPriceSum:"IsPriceSum",VATRate:"VATRate",VATIncluded:"VATIncluded",Picture:"Picture",PictureHeight:"PictureHeight",PictureWidth:"PictureWidth",Margin:"Margin",Markup:"Markup"},k.Goods=Object.assign(Object.assign({},k.GoodsBase),{PriceListGroupGUID:"PriceListGroupGUID",InventoryQuantity:"InventoryQuantity"}),k.GoodsInCart=Object.assign(Object.assign({},k.GoodsBase),{Cart:"Cart",GoodsInfo:"GoodsInfo",SuperiorItem:"SuperiorItem",Quantity:"Quantity",PriceTotal:"PriceTotal",PriceTotalDefaultCurrency:"PriceTotalDefaultCurrency",PriceTotalParentCurrency:"PriceTotalParentCurrency",PriceTotalChanged:"PriceTotalChanged",PriceTotalExcludingVAT:"PriceTotalExcludingVAT",PriceTotalExcludingVATDefaultCurrency:"PriceTotalExcludingVATDefaultCurrency",PriceTotalExcludingVATParentCurrency:"PriceTotalExcludingVATParentCurrency",VATTotal:"VATTotal",VATTotalDefaultCurrency:"VATTotalDefaultCurrency",VATTotalParentCurrency:"VATTotalParentCurrency",SalePriceExcludingVAT:"SalePriceExcludingVAT",SalePriceExcludingVATDefaultCurrency:"SalePriceExcludingVATDefaultCurrency",SalePriceExcludingVATParentCurrency:"SalePriceExcludingVATParentCurrency",VAT:"VAT",VATDefaultCurrency:"VATDefaultCurrency",VATParentCurrency:"VATParentCurrency",PurchasePriceParentCurrency:"PurchasePriceParentCurrency",SalePriceParentCurrency:"SalePriceParentCurrency",ListPrice:"ListPrice",ListPriceDefaultCurrency:"ListPriceDefaultCurrency",ListPriceParentCurrency:"ListPriceParentCurrency",ListPriceChanged:"ListPriceChanged",Discount:"Discount",HierarchyInSet:"HierarchyInSet",IsFromSet:"IsFromSet",ParentGUID:"ParentGUID",Rank:"Rank",IncludeInCartPrice:"IncludeInCartPrice",ListPriceCustomized:"ListPriceCustomized",ChildItemsCount:"ChildItemsCount",JoinedToGUID:"JoinedToGUID",PurchasePriceTotal:"PurchasePriceTotal",PurchasePriceTotalDefaultCurrency:"PurchasePriceTotalDefaultCurrency",PurchasePriceTotalParentCurrency:"PurchasePriceTotalParentCurrency",PurchasePriceTotalChanged:"PurchasePriceTotalChanged"}),k.Journal={FileAs:"FileAs",Subject:"Subject",TypeEn:"TypeEn",StateEn:"StateEn",ImportanceEn:"ImportanceEn",EventStart:"EventStart",EventEnd:"EventEnd",SuperiorItem:"SuperiorItem",Company:"Company",Contact:"Contact",Marketing:"Marketing",IsSystem:"System",IsPrivate:"Private",Note:"Note",Phone:"Phone"},k.Vacation={StartDate:"StartDate",EndDate:"EndDate",User:"User",Duration:"Duration",Place:"Place",Note:"Note",AllDay:"AllDay",TypeEn:"TypeEn",StateEn:"StateEn",IsPrivate:"Private"},k.Marketing={HumanID:"HumanID",EstimatedStart:"EstimatedStart",EstimatedEnd:"EstimatedEnd",RealStart:"RealStart",RealEnd:"RealEnd",TargetGroup:"TargetGroup",EmailsSent:"EmailsSent",EmailsDelivered:"EmailsDelivered",EmailsViewed:"EmailsViewed",PeopleUnsubscribed:"PeopleUnsubscribed",FinalRevenues:"FinalRevenues",TypeEn:"TypeEn",StateEn:"StateEn"},k.Projects={HumanID:"HID",FileAs:"FileAs",ProjectName:"ProjectName",ProjectOriginEn:"ProjectOriginEn",TypeEn:"TypeEn",StateEn:"StateEn",PaymentTypeEn:"PaymentTypeEn",ProjectStart:"ProjectStart",ProjectRealEnd:"ProjectRealEnd",EstimatedEnd:"ProjectEnd",CurrencyEn:k.Common.CurrencyEn,DefaultCurrencyEn:"DefaultCurrencyEn",EstimatedMargin:"EstimatedMargin",EstimatedPeopleExpenses:"EstimatedPeopleExpenses",EstimatedPeopleExpensesDefaultCurrency:"EstimatedPeopleExpensesDefaultCurrency",EstimatedOtherExpenses:"EstimatedOtherExpenses",EstimatedOtherExpensesDefaultCurrency:"EstimatedOtherExpensesDefaultCurrency",EstimatedPrice:"EstimatedPrice",EstimatedPriceDefaultCurrency:"EstimatedPriceDefaultCurrency",EstimatedProfit:"EstimatedProfit",EstimatedProfitDefaultCurrency:"EstimatedProfitDefaultCurrency",EstimatedPriceChanged:"EstimatedPriceChanged",EstimatedPeopleExpensesChanged:"EstimatedPeopleExpensesChanged",EstimatedOtherExpensesChanged:"EstimatedOtherExpensesChanged",Delay:"Delay",EstimatedWorkHours:"EstimatedWorkHours",TotalWorkHours:"TotalWorkHours",PeopleExpenses:"PeopleExpenses",OtherExpenses:"OtherExpenses",PeopleExpensesDefaultCurrency:"PeopleExpensesDefaultCurrency",OtherExpensesDefaultCurrency:"OtherExpensesDefaultCurrency",PeopleExpensesChanged:"PeopleExpensesChanged",OtherExpensesChanged:"OtherExpensesChanged",Price:"Price",PriceDefaultCurrency:"PriceDefaultCurrency",Profit:"Profit",ProfitDefaultCurrency:"ProfitDefaultCurrency",Margin:"Margin",PriceChanged:"PriceChanged",SuperiorProject:"SuperiorProject",Customer:"Customer",ContactPerson:"ContactPerson",Users:"Users",ProjectManager:"ProjectManager",InvoicePaymentDate:"InvoicePaymentDate",PaymentMaturity:"PaymentMaturity",InvoiceIssueDate:"InvoiceIssueDate",LicensesCount:"LicensesCount",LicensePrice:"LicensePrice",LicensePriceDefaultCurrency:"LicensePriceDefaultCurrency",NextStep:"NextStep",LastActivity:"LastActivity",IsPrivate:"Private",LicensePriceChanged:"LicensePriceChanged",Note:"Note",CompletedDate:"CompletedDate",LostDate:"LostDate"},k.Tasks={FileAs:"FileAs",Subject:"Subject",RootItem:"RootItem",SuperiorItem:"SuperiorItem",Company:"Company",Contact:"Contact",StartDate:"StartDate",DueDate:"DueDate",Reminder:"Reminder",ReminderDate:"ReminderDate",ImportanceEn:"ImportanceEn",IsCompleted:"Complete",PercentComplete:"PercentComplete",PercentCompleteDecimal:"PercentCompleteDecimal",CompletedDate:"CompletedDate",Solver:"Solver",Delegator:"Delegator",Level:"Level",IsPrivate:"Private",ActualWorkHours:"ActualWorkHours",TotalWorkHours:"TotalWorkHours",Body:"Body",TypeEn:"TypeEn",StateEn:"StateEn"},k.Training={TitleEn:"TitleEn"},k.WorkReports={Task:"Task",ProjectName:"ProjectName",UserName:"UserName",Subject:"Subject",Date:"Date",FromTime:"FromTime",ToTime:"ToTime",Overtime:"Overtime",Month:"Month",Year:"Year",IsPrivate:"Private",Note:"Note",Duration:"Duration",WorkReportEn:"WorkReportEn",StateEn:"StateEn"},k.Users={ProfilePicture:"ProfilePicture",UserName:"UserName",JobTitle:"JobTitle",IDCardNumber:"IDCardNumber",Birthdate:"Birthdate",BirthPlace:"BirthPlace",PersonalIdentificationNumber:"PersonalIdentificationNumber",Active:"Active",FamilyStatusEn:"FamilyStatusEn",HomeAddressStreet:"HomeAddressStreet",HomeAddressCity:"HomeAddressCity",HomeAddressPostalCode:"HomeAddressPostalCode",HomeAddressCountryEn:"HomeAddressCountryEn",HomeAddressState:"HomeAddressState",HomeAddressPOBox:"HomeAddressPOBox",BankAccount:"BankAccount",BusinessPhoneNumber:"BusinessPhoneNumber",MobilePhoneNumber:"MobilePhoneNumber",Email1Address:"Email1Address",Email2Address:"Email2Address",ICQ:"ICQ",MSN:"MSN",Skype:"Skype",IdentificationNumber:"IdentificationNumber",HealthInsurance:"HealthInsurance",HolidayLength:"HolidayLength",RemainingDaysOfHoliday:"RemainingDaysOfHoliday",SalaryDateEn:"SalaryDateEn",Supervisor:"Supervisor",TravelDistance:"TravelDistance",TimeAccessibility:"TimeAccessibility",TransportMode:"TransportMode",WorkdayStartTime:"WorkdayStartTime",Note:"Note",IsSystem:"IsSystem"},k.Groups={IsAdmin:"IsAdmin",GroupName:"GroupName",FileAs:"FileAs",Description:"Description",IsPM:"IsPM",System:"System",IsRole:"IsRole",IsCategory:"IsCategory",DisallowControlModulePermissions:"DisallowControlModulePermissions",DisallowControlColumnPermissions:"DisallowControlColumnPermissions",IsOutlookCategory:"IsOutlookCategory",DisallowControlUserAssignment:"DisallowControlUserAssignment",ColorEn:"ColorEn",Picture:"Picture"},k.PriceListGroups={Note:"Note"},k.Prices={SalePriceGUID:"SalePriceGUID",GoodsItemGUID:"GoodsItemGUID",Price:"Price",CurrencyEn:"CurrencyEn"},k.SalePrices={Note:"Note",Discount:"Discount",TypeEn:"TypeEn",StateEn:"StateEn",PrevStateEn:"PrevStateEn"},k.XsltTransformations={LangCode:"LangCode",Definition:"Definition",Namespace:"Namespace",ObjectTypeID:"ObjectTypeID",TransformationVersion:"TransformationVersion"},k.XsltTransformationsModels={ObjectTypeID:"ObjectTypeID",TransformationGUID:"TransformationGUID",ItemTypeGUID:"ItemTypeGUID"},k.allTypeEnNames=["TypeEn",k.Documents.DocTypeEn,k.WorkReports.WorkReportEn,"TitleEn"],k.getFolderFileAs=e=>{switch(e){case u.leads:return k.Leads.FileAs;case u.projects:return k.Projects.ProjectName;case u.documents:return k.Documents.DocName;case u.companies:return k.Companies.CompanyName;case u.contacts:case u.users:return k.Common.FileAs;case u.emails:return k.Emails.Subject;case u.journal:return k.Journal.FileAs;case u.tasks:return k.Tasks.Subject;case u.workReports:return k.WorkReports.Subject;case u.vacation:return k.Vacation.TypeEn;case u.carts:case u.goods:case u.goodsInCart:return k.Common.FileAs;case u.groups:return k.Groups.GroupName;case u.xsltTransformations:return k.Common.FileAs;default:return console.warn(`FileAs col name not defined for folderName ${e}`),k.Common.FileAs}};class D{}D.general="GENERAL",D.group="GROUP",D.contactPerson="CONTACTPERSON",D.contact="CONTACT",D.customer="CUSTOMER",D.company="COMPANY",D.outlookProject="OUTLOOKPROJECT",D.supervisor="SUPERVISOR",D.projectOrigin="PROJECT_ORIGIN",D.cart="CART",D.goodsInCart="GOODSINCART",D.superiorItem="SUPERIORITEM",D.taskParent="TASKPARENT";class b{}b.general=1,b.group=2,b.contactPerson=10,b.contact=11,b.customer=12,b.company=13,b.outlookProject=28,b.supervisor=32,b.projectOrigin=25,b.cart=9,b.goodsInCart=15,b.superiorItem=31,b.taskParent=38;class w{}w.all="All",w.own="Own",w.readonly="Readonly",w.invisible="Invisible",w.none="None";class F{}var O,N,R,L;F.mandatory="Mandatory",F.optional="Optional",F.unique="Unique",F.none="None",function(e){e.Free="Free",e.Basic="Basic",e.Professional="Professional",e.Enterprise="Enterprise"}(O||(O={})),function(e){e.ContactsAndCompanies="ContactsAndCompanies",e.Sales="Sales",e.Projects="Projects",e.Marketing="Marketing"}(N||(N={})),function(e){e[e.Negative=0]="Negative",e[e.Neutral=1]="Neutral",e[e.Positive=2]="Positive"}(R||(R={}));class x{}x.contactsSynchronizationWithOutlook="ContactsSynchronizationWithOutlook",x.wordAddin="WordAddin",x.excelAddin="ExcelAddin",x.tasksRecurrentTasks="TasksRecurrentTasks",x.tasksSubtasks="TasksSubtasks",x.tasksSynchronizationWithOutlook="TasksSynchronizationWithOutlook",x.calendarSynchronizationWithOutlook="CalendarSynchronizationWithOutlook",x.emailsAutomaticTracking="EmailsAutomaticTracking",x.convertEmailToProject="ConvertEmailToProject",x.duplicityChecker="DuplicityChecker",x.nextStepAndLastActivityCustomization="NextStepAndLastActivityCustomization",x.subProjects="SubProjects",x.resourceAndPlanning="ResourceAndPlanning",x.professionalEmailCampaigns="ProfessionalEmailCampaigns",x.professionalEmailCampaignsAdvancedStatistics="ProfessionalEmailCampaignsAdvancedStatistics",x.wordEmailMerge="WordEmailMerge",x.printLabels="PrintLabels",x.printEnvelopes="PrintEnvelopes",x.userViews="UserViews",x.sharedUserViews="SharedUserViews",x.gridConditionalFormating="GridConditionalFormating",x.multipleCurrencies="MultipleCurrencies",x.historyTracking="HistoryTracking",x.privateItems="PrivateItems",x.itemTypes="ItemTypes",x.formLayoutCustomization="FormLayoutCustomization",x.workflowBasicDefinitions="WorkflowBasicDefinitions",x.workflowAdvancedDefinitions="WorkflowAdvancedDefinitions",x.workflowAdvancedDefinitionsRules="WorkflowAdvancedDefinitionsRules",x.workflowAdvancedDefinitionsActions="WorkflowAdvancedDefinitionsActions",x.workflowGroupLevelActions="WorkflowGroupLevelActions",x.customFields="CustomFields",x.importantFields="ImportantFields",x.mandatoryFields="MandatoryFields",x.uniqueFields="UniqueFields",x.readOnlyFields="ReadOnlyFields",x.transformationCustomTemplates="TransformationCustomTemplates",x.userRoles="UserRoles",x.modulePermissions="ModulePermissions",x.columnPermissions="ColumnPermissions",x.api="API",x.gate="Gate",x.threeCXIntegration="ThreeCXIntegration",x.tapiIntegration="TapiIntegration",x.pohodaIntegration="PohodaIntegration",x.pohodaSynchronizationIntervalCustomization="PohodaSynchronizationIntervalCustomization",x.pohodaSynchronizationFieldMappingCustomization="PohodaSynchronizationFieldMappingCustomization",x.quickBooksIntegration="QuickBooksIntegration",x.saveBinaryDataOnDisk="SaveBinaryDataOnDisk",x.activeDirectoryLogin="ActiveDirectoryLogin",x.callerIdentificationOnApple="CallerIdentificationOnApple",x.legacyAdministration="LegacyAdministration";class M{}M.customAdditionalFieldsCount="CustomAdditionalFieldsCount",M.customEnabledAdvancedWorkflowsCount="CustomEnabledAdvancedWorkflowsCount",M.customEnabledBasicWorkflowsCount="CustomEnabledBasicWorkflowsCount",M.customMandatoryFieldsCount="CustomMandatoryFieldsCount",M.customOptionalFieldsCount="CustomOptionalFieldsCount",M.customReadonlyFieldsCount="CustomReadonlyFieldsCount",M.customUniqueFieldsCount="CustomUniqueFieldsCount",M.customVisibleTypesCount="CustomVisibleTypesCount",M.visibleCurrenciesCount="VisibleCurrenciesCount";class U{}U.contactsAutomaticSynchronizationWithOutlook="ContactsAutomaticSynchronizationWithOutlook",U.contactsSynchronizationWithOutlook="ContactsSynchronizationWithOutlook",U.contactsSynchronizationWithAndroid="ContactsSynchronizationWithAndroid",U.documentsRevisions="DocumentsRevisions",U.wordAddin="WordAddin",U.excelAddin="ExcelAddin",U.tasksReminders="TasksReminders",U.tasksRecurrentTasks="TasksRecurrentTasks",U.tasksSubtasks="TasksSubtasks",U.tasksSynchronizationWithOutlook="TasksSynchronizationWithOutlook",U.calendarSynchronizationWithOutlook="CalendarSynchronizationWithOutlook",U.emailsManualTracking="EmailsManualTracking",U.emailsAutomaticTracking="EmailsAutomaticTracking",U.emailSummaryAndSentimentToneFromAi="EmailSummaryAndSentimentToneFromAi",U.convertEmailToContact="ConvertEmailToContact",U.convertEmailToDeal="ConvertEmailToDeal",U.convertEmailToProject="ConvertEmailToProject",U.convertEmailToTask="ConvertEmailToTask",U.convertFromSuggestedContact="ConvertFromSuggestedContact",U.gravatarIntegration="GravatarIntegration",U.logoboxIntegration="LogoboxIntegration",U.companiesBussinesRegisterApiIntegration="CompaniesBussinesRegisterApiIntegration",U.duplicityChecker="DuplicityChecker",U.nextStepAndLastActivityCustomization="NextStepAndLastActivityCustomization",U.subProjects="SubProjects",U.resourceAndPlanning="ResourceAndPlanning",U.professionalEmailCampaigns="ProfessionalEmailCampaigns",U.professionalEmailCampaignsAdvancedStatistics="ProfessionalEmailCampaignsAdvancedStatistics",U.wordEmailMerge="WordEmailMerge",U.printLabels="PrintLabels",U.printEnvelopes="PrintEnvelopes",U.userViews="UserViews",U.sharedUserViews="SharedUserViews",U.gridRowSummary="GridRowSummary",U.gridConditionalFormating="GridConditionalFormating",U.multipleCurrencies="MultipleCurrencies",U.historyTracking="HistoryTracking",U.privateItems="PrivateItems",U.itemTypes="ItemTypes",U.formLayoutCustomization="FormLayoutCustomization",U.workflowBasicDefinitions="WorkflowBasicDefinitions",U.workflowAdvancedDefinitions="WorkflowAdvancedDefinitions",U.workflowAdvancedDefinitionsRules="WorkflowAdvancedDefinitionsRules",U.workflowAdvancedDefinitionsActions="WorkflowAdvancedDefinitionsActions",U.workflowGroupLevelActions="WorkflowGroupLevelActions",U.customFields="CustomFields",U.importantFields="ImportantFields",U.mandatoryFields="MandatoryFields",U.uniqueFields="UniqueFields",U.readOnlyFields="ReadOnlyFields",U.transformationCustomTemplates="TransformationCustomTemplates",U.userRoles="UserRoles",U.modulePermissions="ModulePermissions",U.columnPermissions="ColumnPermissions",U.commonDataAPI="CommonDataAPI",U.eWayCrmAPI="eWayCrmAPI",U.threeCXIntegration="ThreeCXIntegration",U.tapiIntegration="TapiIntegration",U.pohodaIntegration="PohodaIntegration",U.pohodaSynchronizationIntervalCustomization="PohodaSynchronizationIntervalCustomization",U.pohodaSynchronizationFieldMappingCustomization="PohodaSynchronizationFieldMappingCustomization",U.quickBooksIntegration="QuickBooksIntegration",U.shareByTeams="ShareByTeams",U.convertEmailToContactWithDataFromAi="ConvertEmailToContactWithDataFromAi",U.convertEmailToDealWithDataFromAi="ConvertEmailToDealWithDataFromAi",U.convertEmailToProjectWithDataFromAi="ConvertEmailToProjectWithDataFromAi",U.xsltTransformationsAdministrationForCaCAndRest="XsltTransformationsAdministrationForCaCAndRest",U.xsltTransformationsAdministrationForSales="XsltTransformationsAdministrationForSales",U.xsltTransformationsAdministrationForProjects="XsltTransformationsAdministrationForProjects",U.xsltTransformationsAdministrationForMarketing="XsltTransformationsAdministrationForMarketing",function(e){e.UnpaidImportantInvoices="UnpaidImportantInvoices",e.UncollectableSubscriptionPayment="UncollectableSubscriptionPayment",e.UncollectableSubscriptionPaymentWithExpiredCard="UncollectableSubscriptionPaymentWithExpiredCard",e.StandardSubscriptionPeriod="StandardSubscriptionPeriod"}(L||(L={}));var G,_=L;!function(e){e.License="License",e.CloudLicense="CloudLicense",e.MiscLicense="MiscLicense",e.Support="Support",e.Service="Service"}(G||(G={}));var V=G;class j{}j.getIsDebug=e=>{var t;return!!(null===(t=null==e?void 0:e.sessionHandler.lastSuccessfulLoginResponse)||void 0===t?void 0:t.Debug)},j.supportsFeaturesOf=(e,t)=>{var r;const n=null===(r=e.sessionHandler.lastSuccessfulLoginResponse)||void 0===r?void 0:r.WcfVersion;return!!n&&j.supportsVersionFeaturesOf(n,t)},j.supportsVersionFeaturesOf=(e,t)=>n(e,t,">=")||n(e,"1.0.0.0","=");class B{}B.textBox="TextBox",B.comboBox="ComboBox",B.numericBox="NumericBox",B.relation="Relation",B.checkBox="CheckBox",B.linkTextBox="LinkTextBox",B.dateEdit="DateEdit",B.memoBox="MemoBox",B.multiSelectComboBox="MultiSelectComboBox",B.workflowState="WorkflowState",B.image="Image",B.multiSelectRelation="MultiSelectRelation";const W={[u.relations]:0,[u.unifiedRelations]:1,[u.users]:2,[u.groups]:3,[u.enumTypes]:4,[u.enumValues]:5,[u.additionalFields]:6};var H,z,Q,$;!function(e){e.Version75="7.5",e.Version76="7.6",e.Version77="7.7",e.Version80="8.0",e.Version81="8.1",e.Version82="8.2",e.Version83="8.3",e.Version90="9.0",e.Version91="9.1",e.Version92="9.2",e.Version93="9.3",e.Version94="9.4",e.Version100="10.0",e.Version101="10.1"}(H||(H={}));class q extends j{}q.is75OrLater=e=>j.supportsFeaturesOf(e,H.Version75),q.is76OrLater=e=>q.supportsFeaturesOf(e,H.Version76),q.is77OrLater=e=>q.supportsFeaturesOf(e,H.Version77),q.is80OrLater=e=>q.supportsFeaturesOf(e,H.Version80),q.is81OrLater=e=>q.supportsFeaturesOf(e,H.Version81),q.is82OrLater=e=>q.supportsFeaturesOf(e,H.Version82),q.is83OrLater=e=>q.supportsFeaturesOf(e,H.Version83),q.is90OrLater=e=>q.supportsFeaturesOf(e,H.Version90),q.is91OrLater=e=>q.supportsFeaturesOf(e,H.Version91),q.is92OrLater=e=>q.supportsFeaturesOf(e,H.Version92),q.is93OrLater=e=>q.supportsFeaturesOf(e,H.Version93),q.is94OrLater=e=>q.supportsFeaturesOf(e,H.Version94),q.is100OrLater=e=>q.supportsFeaturesOf(e,H.Version100),q.is101OrLater=e=>q.supportsFeaturesOf(e,H.Version101),q.isFeatureSupported=(e,t)=>q.supportsFeaturesOf(e,t);class J{static mainTable(){return{__type:"MainTable:#EQ"}}static relation(e,t,r){return{__type:"Relation:#EQ",Direction:r,ItemTypes:e,RelationType:t}}static join(e,t,r){const n={__type:"Join:#EQ",ItemType:e,Key:t};return r&&(n.TargetColumnName=r),n}static hubRelation(e){const{isToParentDirection:t,childrenFolderNames:r}=e,n={__type:"HubRelation:#EQ"};return void 0!==typeof t&&(n.IsToParentDirection=t),r&&(n.ChildrenFolderNames=r),n}}class X{static createHubItemsCountsQuery(e,t,r,n){return{__type:"HubItemsCountsQuery:#EQ",ParentItemGuids:e,ItemTypes:t,ExcludeSystemItems:r,SplitDate:n}}static createRelatedTableQuery(e,t,r){return{__type:r?"RelatedTableQuery:#EQ":"TypelessRelatedTableQuery:#EQ",BaseItemID:e,ItemTypes:Array.isArray(t)?t:[t],RelationType:r}}static createMainTableQuery(e){return{__type:"MainTableQuery:#EQ",ItemTypes:Array.isArray(e)?e:[e]}}}X.column=e=>({__type:"Column:#EQ",Source:J.mainTable(),Name:e}),X.multiSelectComboColumnLegacy=(e,t,r)=>({__type:"Column:#EQ",Source:J.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues]({0}, '${e}', '${t}')`,Alias:null!=r?r:e}),X.multiSelectComboColumn=(e,t,r,n,s)=>{if(!q.is77OrLater(e))return X.multiSelectComboColumnLegacy(r,n,s);return{__type:"Column:#EQ",Source:J.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues_WithObjectTypeID]({0}, dbo.GetObjectTypeID('${t}'), '${r}', '${n}')`,Alias:null!=s?s:r}},X.joinColumn=(e,t,r,n,s)=>X.joinColumnFromKey(e,X.column(t),r,n,s),X.joinColumnFromKey=(e,t,r,n,s)=>{const o={__type:"Column:#EQ",Source:J.join(e,t,s),Name:r};return n&&(o.Alias=n),o},X.singleVariatedColumn=(e,t,r)=>X.variatedColumn([X.columnVariation(e,t)],r),X.variatedColumn=(e,t)=>{const r={__type:"VariatedColumn:#EQ",Source:J.mainTable(),Variations:e};return t&&(r.Alias=t),r},X.columnVariation=(e,t,r)=>{const n={FolderName:t,Field:{__type:"Column:#EQ",Source:J.mainTable(),Name:e}};return r&&(n.Field.Transformation=r),n},X.joinColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:J.join(t,X.column(r)),Name:n}}),X.relationColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:J.relation(r,t,1),Name:n}}),X.relatedColumn=(e,t,r,n)=>{const s={__type:"Column:#EQ",Source:J.relation(t,e,1),Name:r};return n&&(s.Alias=n),s},X.relatedSubstituableColumn=(e,t,r,n,s)=>{const o={__type:"SubstituableColumn:#EQ",Source:J.relation(t,e,1),Name:r,Substitute:n};return s&&(o.Alias=s),o},X.relatedColumnFolderNameToken=(e,t,r)=>({__type:"Token:#EQ",Source:J.relation(t,e,1),TypeName:"ItemType",Alias:r}),X.hubRelationColumn=(e,t)=>({__type:"Column:#EQ",Source:J.hubRelation(t),Name:e}),X.aggregateColumn=(e,t,r)=>({__type:"AggregateColumn:#EQ",FunctionName:e,Source:t.Source,AggregatedField:t,Alias:r}),X.folderNameToken=e=>({__type:"Token:#EQ",Source:J.mainTable(),TypeName:"ItemType",Alias:null!=e?e:"FolderName"}),X.equalsFilterExpression=(e,t)=>({__type:"EqualsFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.notEqualsExpression=(e,t)=>({__type:"NotFilterExpression:#EQ",Child:X.equalsFilterExpression(e,t)}),X.andFilterExpression=e=>({__type:"AndFilterExpressionOperator:#EQ",Children:e}),X.orFilterExpression=e=>({__type:"OrFilterExpressionOperator:#EQ",Children:e}),X.lessFilterExpression=(e,t)=>({__type:"LessFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.lessOrEqualFilterExpression=(e,t)=>({__type:"LessOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.greaterFilterExpression=(e,t)=>({__type:"GreaterFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.greaterOrEqualFilterExpression=(e,t)=>({__type:"GreaterOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.likeFilterExpression=(e,t)=>({__type:"LikeFilterExpressionPredicate:#EQ",Field:e,Value:`%${t}%`}),X.inFilterExpression=(e,t)=>({__type:"InFilterExpressionPredicate:#EQ",Field:e,Value:t}),X.relatedToExpression=(e,t)=>({__type:"RelatedToFilterExpressionPredicate:#EQ",Value:e,RelationType:t}),X.isNullOrEmptyFilterExpression=e=>X.orFilterExpression([X.equalsFilterExpression(X.column(e),null),X.equalsFilterExpression(X.column(e),"")]);class K{static trim(e,t,r=!1){if(null==e)return e;let n=e.trim();return n.length<=t||(n=n.substring(0,t-(r?3:0)),r&&(n+="...")),n}}class Y{static toRfc3339String(e){const t=e=>e<10?`0${e}`:String(e);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}${(e=>{if(0===e)return"Z";const r=e>0?"-":"+";return e=Math.abs(e),`${r}${t(Math.floor(e/60))}:${t(e%60)}`})(e.getTimezoneOffset())}`}}function Z(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}l((n=n.apply(e,t||[])).next())})}Y.isValid=e=>e instanceof Date&&!isNaN(e.getTime()),Y.areDaysEqual=(e,t)=>{const r=Y.clearTime(e),n=Y.clearTime(t);return r.getTime()===n.getTime()},Y.areTimesEqual=(e,t)=>e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes(),Y.areDatesEqual=(e,t)=>!!e&&!!t&&Y.areDaysEqual(e,t)&&Y.areTimesEqual(e,t),Y.clearTime=e=>{const t=new Date(e);return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t},Y.isWithoutTime=e=>0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds(),Y.getFormattedSqlDateTime=e=>e.toISOString().slice(0,19).replace("T"," "),Y.getRfcWithoutTimezone=e=>e.slice(0,19),function(e){e.OpenXmlDocx="OpenXmlDocx",e.Pdf="Pdf",e.WordMlXml="WordMlXml"}(z||(z={})),"function"==typeof SuppressedError&&SuppressedError;class ee{constructor(e,t,r,n,s){let o;if(this.sessionId=null,this.isAdmin=null,this.loginResponse=null,!(r||(o=h.decodeAccessToken(t),r=o.ws)))throw new Error("Failed to get web service URL from JWT");if(!(n||(o||(o=h.decodeAccessToken(t)),n=o.username)))throw new Error("Failed to get username from JWT");this.appName=e,this.wsUrl=r,this.userName=n,this.endpoint=r.startsWith("http://")?"InsecureAPI.svc":"API.svc",this.accessToken=t,this.sessionId=s||null}hasAdminRights(){return this.isAdmin}getWsUrl(){return this.wsUrl}getUserName(){return this.userName}getOutlookClientVersion(){var e;return null===(e=this.loginResponse)||void 0===e?void 0:e.OutlookClientVersion}getWebServiceVersion(){var e;return null===(e=this.loginResponse)||void 0===e?void 0:e.WcfVersion}getSessionId(){return this.sessionId}login(){return Z(this,void 0,void 0,function*(){const e={userName:this.userName,appVersion:this.appName},t=new Request(`${this.wsUrl}/${this.endpoint}/Login`,{method:"POST",headers:{Authorization:`Bearer ${this.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(e)}),r=yield fetch(t),n=200===r.status?yield r.json():void 0;if(!n||"rcSuccess"!==n.ReturnCode)throw new Error(`Login failed: ${(null==n?void 0:n.Description)||r.statusText}`);this.sessionId=null==n?void 0:n.SessionId,this.isAdmin=null==n?void 0:n.IsAdmin,this.loginResponse=n})}logout(){return Z(this,void 0,void 0,function*(){if(!this.sessionId)throw new Error("Session ID is not set. Please call login() first.");const e=new Request(`${this.wsUrl}/${this.endpoint}/LogOut`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.sessionId})}),t=yield fetch(e);if("rcSuccess"!==(yield t.json()).ReturnCode)throw new Error("Failed to logout")})}validateSession(){return Z(this,void 0,void 0,function*(){if(!this.sessionId)throw new Error("Session ID is not set. Please call login() first.");const e=new Request(`${this.wsUrl}/${this.endpoint}/IsSessionValid`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.sessionId})}),t=yield fetch(e),r=yield t.json();if("rcSuccess"!==r.ReturnCode)throw new Error("Failed to validate session");return r.Result||!1})}getObjectTypes(){return Z(this,void 0,void 0,function*(){return(yield this.callMethod("GetObjectTypes",{})).Data})}getLicense(){return Z(this,void 0,void 0,function*(){return(yield this.callMethod("GetLicense",{})).Datum})}getClientVersionId(e){return Z(this,void 0,void 0,function*(){var t;const r={versionName:e};return null===(t=(yield this.callMethod("GetClientVersion",r)).Datum)||void 0===t?void 0:t.Id})}queryAmount(e){return Z(this,arguments,void 0,function*(e,t=null){const r={query:{__type:"MainTableQuery:#EQ",ItemTypes:[e],Fields:[{__type:"Column:#EQ",Source:{__type:"MainTable:#EQ"},Name:"ItemGUID"}]}};return t&&(r.query.Filter=t),this.callMethod("QueryAmount",r)})}query(e){return Z(this,arguments,void 0,function*(e,t=null,r=null,n=null){const s={query:{__type:"MainTableQuery:#EQ",ItemTypes:[e],Fields:t,Paging:{Skip:0,Take:500}}};return r&&(s.query.Filter=r),n&&(s.query.Sort=n),this.callMethod("Query",s)})}callMethod(e,t){return Z(this,arguments,void 0,function*(e,t,r="POST"){if(!this.sessionId)throw new Error("Session ID is not set. Please call login() first.");t.sessionId=this.sessionId;const n=new Request(`${this.wsUrl}/${this.endpoint}/${e}`,{method:r,headers:{"Content-Type":"application/json"},body:"POST"===r?JSON.stringify(t):void 0}),s=yield fetch(n);if(!s.ok)throw new Error(`Error calling method ${e}: ${s.statusText}`);const o=200===s.status?yield s.json():void 0;if(!o||"rcSuccess"!==o.ReturnCode)throw new Error(`API call failed (${null==o?void 0:o.ReturnCode}): ${null==o?void 0:o.Description}`);return o})}static getTokenData(e,t,r,n,s){return Z(this,void 0,void 0,function*(){const o=new URLSearchParams;o.append("client_id",n),o.append("client_secret",s),o.append("code",t),o.append("redirect_uri",r),o.append("grant_type","authorization_code");const i=new Request(`${e}/auth/connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString()}),a=yield fetch(i);if(!a.ok)throw new Error(`Error calling token endpoint: ${a.statusText}`);const l=yield a.json();if(!l||!l.access_token)throw new Error("Failed to get access token");return l})}}class te{constructor(e,t){if(!e||!t)throw new Error("Both folderName and baseItem has to be defined!");this.folderName=e,this.baseItem=t}getEmailAddress(){switch(this.folderName){case u.contacts:{const e=this.baseItem;return e.Email1Address||e.Email2Address||e.Email3Address}case u.leads:return this.baseItem.Email;case u.companies:return this.baseItem.Email;case u.users:{const e=this.baseItem;return e.Email1Address||e.Email2Address}default:return null}}getInitials(){switch(this.folderName){case u.contacts:{const e=this.baseItem;return this.getInitialsInternal(e.FirstName,e.LastName)}case u.users:{const e=this.baseItem;return this.getInitialsInternal(e.FirstName,e.LastName)}default:return null}}getInitialsInternal(e,t){const r=((null==e?void 0:e.substr(0,1))||"")+((null==t?void 0:t.substr(0,1))||"");return""===r?null:r}getItemPreview(){switch(this.folderName){case u.contacts:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}case u.users:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}default:return null}}}!function(e){e.Readonly="Readonly",e.VisibleRankDefaultOnly="VisibleRankDefaultOnly",e.Editable="Editable"}(Q||(Q={})),function(e){e.Success="Success",e.Failure="Failed",e.FailureDuplicityFound="Failed_DuplicityFound",e.FailureItemAlreadyRemoved="Failed_ItemAlreadyRemoved",e.FailureColumnsLockedWFAction="Failed_ColumnsLocked",e.FailureItemLockedWFAction="Failed_ItemLocked",e.FailureLicenseLimitReached="Failed_LicenseLimitReached",e.FailureInssuficientModulePermission="Failed_InsufficientModulePermission",e.FailureInssuficientColumnsPermission="Failed_InsufficientColumnsPermission"}($||($={})),a.polyfill();export{S as ApiConnectionAsNonDefaultExport,ee as ApiFetchClient,d as ApiMethods,F as ColumnPermissionMandatoryRules,w as ColumnPermissionPermissionRules,A as CommonDataConnection,M as CustomizationStatsItemKeys,Y as DateHelper,te as EWItem,O as Edition,Q as EnumTypeEditMode,c as EnumTypes,P as ErrorHelper,_ as ExpirationReason,N as Feature,k as FieldNames,B as FieldTypes,u as FolderNames,x as Functionality,v as GlobalSettingsNames,o as HttpMethod,g as HttpRequestError,$ as ImportResult,V as LicenseKeyInvoiceSeverity,U as LicenseRestrictionKeys,h as OAuthHelper,f as OAuthSessionHandler,C as OAuthSessionHandlerBase,W as ObjectTypeIds,T as OpenItemLinkHelper,X as QueryHelper,b as RelationTypeIds,D as RelationTypes,l as ReturnCodes,R as SentimentTone,K as StringHelper,E as TokenizedServiceConnection,z as TransformItemFormats,H as Version,q as VersionHelper,j as VersionHelperBase,S as default};
@@ -5,5 +5,5 @@ export declare class CommonDataConnection {
5
5
  private readonly tokenizedConnection;
6
6
  constructor(connection: ApiConnection, errorCallback?: (error: Error) => void);
7
7
  readonly isCommonDataApiEnabled: (enabledCallback: (url: string, token: string) => void, disabledCallback: () => void) => void;
8
- readonly callCommonDataApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null | undefined) => void;
8
+ readonly callCommonDataApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null) => void;
9
9
  }
@@ -19,7 +19,7 @@ export declare class TokenizedServiceConnection<TObtainResponse extends IApiResu
19
19
  token: string | null;
20
20
  }, connection: ApiConnection, errorCallback?: (error: Error) => void);
21
21
  readonly isEnabled: (enabledCallback: (url: string, token: string) => void, disabledCallback: () => void) => void;
22
- readonly callTokenizedApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null | undefined) => void;
22
+ readonly callTokenizedApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null) => void;
23
23
  private readonly obtainToken;
24
24
  private static call;
25
25
  }
package/lib/index.d.ts CHANGED
@@ -21,7 +21,19 @@ type TUnionError = Error | HttpRequestError | WebServiceError;
21
21
  declare class HttpRequestError extends Error {
22
22
  statusCode: number;
23
23
  message: string;
24
- constructor(statusCode: number, message: string);
24
+ readonly responseData?: unknown;
25
+ constructor(statusCode: number, message: string, responseData?: unknown);
26
+ /**
27
+ * Builds the error from a non-200 HTTP response. Prefers the API result body's Description over the HTTP
28
+ * status text, which is empty over HTTP/2. The body is kept in
29
+ * responseData so callers can inspect the ReturnCode; it is typed unknown because a non-200 body may as well
30
+ * be a proxy/server error page instead of the API json.
31
+ */
32
+ static readonly from: (response: {
33
+ status: number;
34
+ statusText: string;
35
+ data: unknown;
36
+ }) => HttpRequestError;
25
37
  }
26
38
 
27
39
  interface ITokenError {
@@ -193,7 +205,7 @@ declare class ApiConnection {
193
205
  * @param errorCallback Optional. Handler callback for any other failures. If not supplied, the global error handler is used.
194
206
  * @param config Optional. Additional config for the request.
195
207
  */
196
- readonly callCustomUploadMethod: <TResult extends IApiResult>(file: File, data: Record<string, string>, methodName: string, successCallback: (res: TResult) => void, unsuccessCallback?: ((e: IApiResult) => void) | undefined, errorCallback?: ((e: TUnionError) => void) | undefined, config?: AxiosRequestConfig) => void;
208
+ readonly callCustomUploadMethod: <TResult extends IApiResult>(file: File, data: Record<string, string>, methodName: string, successCallback: (res: TResult) => void, unsuccessCallback?: (e: IApiResult) => void, errorCallback?: (e: TUnionError) => void, config?: AxiosRequestConfig) => void;
197
209
  /**
198
210
  * Asynchronously uploads file using binary stream
199
211
  * @param itemGuid Item identificator. Ex. '9ac561be-9b7d-4938-8e55-4cce97142483'.
@@ -204,7 +216,7 @@ declare class ApiConnection {
204
216
  * @param errorCallback Optional. Handler callback for any other failures. If not supplied, the global error handler is used.
205
217
  * @param config Optional. Additional config for the request.
206
218
  */
207
- readonly callUploadMethod: (itemGuid: string, fileName: string, file: File, successCallback: (res: IApiResult) => void, unsuccessCallback?: ((e: IApiResult) => void) | undefined, errorCallback?: ((e: TUnionError) => void) | undefined, config?: AxiosRequestConfig) => void;
219
+ readonly callUploadMethod: (itemGuid: string, fileName: string, file: File, successCallback: (res: IApiResult) => void, unsuccessCallback?: (e: IApiResult) => void, errorCallback?: (e: TUnionError) => void, config?: AxiosRequestConfig) => void;
208
220
  /**
209
221
  * Creates a promise for async API method call.
210
222
  * @param methodName API method name. Ex. 'GetUsers'.
@@ -222,8 +234,8 @@ declare class ApiConnection {
222
234
  * @param httpMethod Optional. The used HTTP method. POST or GET. Default is POST.
223
235
  * @param errorCallback Optional. Handler callback for any other failures. If not supplied, the global error handler is used.
224
236
  */
225
- readonly callMethod: <TResult extends IApiResult>(methodName: string, data: TInputData, successCallback: (result: TResult) => void, unsuccessCallback?: ((result: TResult) => void) | undefined, httpMethod?: HttpMethod, errorCallback?: ((error: TUnionError) => void) | undefined) => void;
226
- readonly callWithoutSession: <TResult extends IApiResult>(methodName: string, data: TInputData | null, successCallback: (result: TResult) => void, unsuccessCallback: (result: TResult) => void, headers?: Record<string, string> | null, httpMethod?: HttpMethod, errorCallback?: ((error: TUnionError) => void) | undefined) => void;
237
+ readonly callMethod: <TResult extends IApiResult>(methodName: string, data: TInputData, successCallback: (result: TResult) => void, unsuccessCallback?: (result: TResult) => void, httpMethod?: HttpMethod, errorCallback?: (error: TUnionError) => void) => void;
238
+ readonly callWithoutSession: <TResult extends IApiResult>(methodName: string, data: TInputData | null, successCallback: (result: TResult) => void, unsuccessCallback: (result: TResult) => void, headers?: Record<string, string> | null, httpMethod?: HttpMethod, errorCallback?: (error: TUnionError) => void) => void;
227
239
  readonly getItemPreviewGetMethodUrl: (folderName: string, itemGuid: string, itemVersion?: number) => string;
228
240
  readonly getEmailAttachmentGetMethodUrl: (itemGuid: string, contentId: string) => string;
229
241
  readonly getAllEmailAttachmentsZipGetMethodUrl: (itemGuid: string) => string;
@@ -243,6 +255,7 @@ declare class ReturnCodes {
243
255
  static readonly rcAccessDenied = "rcAccessDenied";
244
256
  static readonly rcLoginUserNameChanged = "rcLoginUserNameChanged";
245
257
  static readonly rcLicenseExpired = "rcLicenseExpired";
258
+ static readonly rcBadAccessToken = "rcBadAccessToken";
246
259
  }
247
260
 
248
261
  interface ITokenizedApiResult {
@@ -266,7 +279,7 @@ declare class TokenizedServiceConnection<TObtainResponse extends IApiResult> {
266
279
  token: string | null;
267
280
  }, connection: ApiConnection, errorCallback?: (error: Error) => void);
268
281
  readonly isEnabled: (enabledCallback: (url: string, token: string) => void, disabledCallback: () => void) => void;
269
- readonly callTokenizedApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null | undefined) => void;
282
+ readonly callTokenizedApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null) => void;
270
283
  private readonly obtainToken;
271
284
  private static call;
272
285
  }
@@ -275,7 +288,7 @@ declare class CommonDataConnection {
275
288
  private readonly tokenizedConnection;
276
289
  constructor(connection: ApiConnection, errorCallback?: (error: Error) => void);
277
290
  readonly isCommonDataApiEnabled: (enabledCallback: (url: string, token: string) => void, disabledCallback: () => void) => void;
278
- readonly callCommonDataApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null | undefined) => void;
291
+ readonly callCommonDataApi: <TResult extends ITokenizedApiResult>(methodName: string, data: TInputData, successCallback: (data: TResult) => void, unsuccessCallback?: ((data: TResult | null) => void) | null) => void;
279
292
  }
280
293
 
281
294
  declare class ApiMethods {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@eway-crm/connector",
3
- "version": "1.0.260",
3
+ "version": "1.0.261",
4
4
  "description": "eWay-CRM API JavaScript connector library.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "scripts": {
9
- "test": "jest --config jestconfig.json",
9
+ "test": "vitest run",
10
10
  "build": "rollup -c",
11
11
  "format": "prettier --write \"src/**/*.ts\"",
12
12
  "lint": "eslint -c .eslintrc.json --ext .ts src",
@@ -40,18 +40,17 @@
40
40
  "@rollup/plugin-node-resolve": "^15.0.1",
41
41
  "@rollup/plugin-terser": "^1.0.0",
42
42
  "@rollup/plugin-typescript": "^11.0.0",
43
- "@types/jest": "^29.5.1",
43
+ "@types/node": "^20.19.42",
44
44
  "@typescript-eslint/eslint-plugin": "^7.1.1",
45
45
  "@typescript-eslint/parser": "^7.1.1",
46
46
  "eslint": "^8.57.0",
47
- "jest": "^29.5.0",
48
47
  "prettier": "^2.8.8",
49
48
  "rollup": "^3.23.0",
50
49
  "rollup-plugin-delete": "^2.0.0",
51
50
  "rollup-plugin-dts": "^5.3.0",
52
- "ts-jest": "^29.1.0",
51
+ "tslib": "^2.8.1",
53
52
  "typescript": ">=5.3.3 <5.6.0",
54
- "tslib": "^2.8.1"
53
+ "vitest": "^4.1.8"
55
54
  },
56
55
  "files": [
57
56
  "lib/**/*"