@eway-crm/connector 1.0.261 → 1.0.263
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/README.md +72 -72
- package/lib/cjs/enumerations/EmailConversionSource.d.ts +4 -0
- package/lib/cjs/exceptions/HttpRequestError.d.ts +2 -2
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +2 -2
- package/lib/esm/enumerations/EmailConversionSource.d.ts +4 -0
- package/lib/esm/exceptions/HttpRequestError.d.ts +2 -2
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.js +1 -1
- package/lib/index.d.ts +8 -3
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-

|
|
2
|
-
# eWay-CRM API
|
|
3
|
-
API used for communication with [eWay-CRM](http://www.eway-crm.com/) web service. This library is a wrapper over HTTP/S communication and sessions. See our [documentation](https://kb.eway-crm.com/documentation/6-add-ins/6-7-api-1) for more information.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
The simpliest way to start using this library is to get the [NPM Package](https://www.npmjs.com/package/@eway-crm/connector). To do that, just run this command in your NodeJS project's root dir:
|
|
7
|
-
|
|
8
|
-
```
|
|
9
|
-
npm i @eway-crm/connector
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
To get the best dev experience, we also recommend using [TypeScript](https://www.typescriptlang.org/) since this library contains the types headers.
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
This library wraps the communication with JSON API. For HTTP requests, it uses [Axios](https://github.com/axios/axios). To provide the most variability, it lets you input JSON data and fetch JSON data in the same structure as the server uses. The only thing you don't have to care about is the `sessionId`.
|
|
17
|
-
|
|
18
|
-
The actual usage is then the same as it would be for example with [PHP](https://github.com/rstefko/eway-crm-php-lib). See the [documentation](https://kb.eway-crm.com/documentation/6-add-ins/6-7-api-1) for more.
|
|
19
|
-
|
|
20
|
-
## Version Compatibility
|
|
21
|
-
|
|
22
|
-
This library is compatible with **eWay-CRM 6.0.1 and higher**. If you have got a lower version of your eWay-CRM, check the Updates section in the eWay-CRM Administration Application. If there is no update available, contact your eWay-CRM account manager or via other channel listed on our [web page](https://www.eway-crm.com/contact/).
|
|
23
|
-
|
|
24
|
-
## Establishing Connection
|
|
25
|
-
|
|
26
|
-
To communicate with eWay-CRM web service, we first have to establish connection. This must be done prior to every action we want to accomplish with use of the web service. To do that, we have to create new instance of ```ApiConnection``` with seven parameters:
|
|
27
|
-
1. Service url address (same as the one you use in Outlook)
|
|
28
|
-
2. Username
|
|
29
|
-
3. Password hash (md5 of the user's UTF8 password or hash created by the tool from eWay-CRM server component)
|
|
30
|
-
4. App version identifier (name and version of the connecting client app - must consist of alphabet string and digits at the end)
|
|
31
|
-
5. Client machine identifier (unique identifier of the connecting machine - MAC address for instance)
|
|
32
|
-
6. Client machine name (human readable client machine - PC name for instance)
|
|
33
|
-
7. Error handling callback (this callback is called everytime an unexpected error occurs)
|
|
34
|
-
|
|
35
|
-
```JS
|
|
36
|
-
import ApiConnection from '@eway-crm/connector';
|
|
37
|
-
|
|
38
|
-
const serviceUrl = 'https://free.eway-crm.com/31994';
|
|
39
|
-
const username = 'api';
|
|
40
|
-
const passwordHash = '470AE7216203E23E1983EF1851E72947';
|
|
41
|
-
|
|
42
|
-
const connection = ApiConnection.create(serviceUrl, username, passwordHash, 'JSSample1', '00:00:00:00:00', 'SampleTestMachine', (err) => console.error(err));
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
⚠️ The code above does not support [Microsoft Account Authenticaion](https://kb.eway-crm.com/documentation/2-installation/2-3-installation-the-server-part/adjust-eway-crm-web-service-for-azure-login-office-365?set_language=en). If you log into eWay-CRM with your Microsoft account, you need to implement your own OAuth2 client.
|
|
46
|
-
|
|
47
|
-
## CORS
|
|
48
|
-
|
|
49
|
-
If you are developing a web app running on a different host than your eWay-CRM web service, you need to configure your eWay-CRM web service to allow cross-origin requests. To achieve that, put the following setting into `appSettings` section of your web service's web.config file.
|
|
50
|
-
|
|
51
|
-
```XML
|
|
52
|
-
<add key="AccessControlAllowOrigin" value="https://YOUR-ORIGIN:PORT" />
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
⚠ If you add the setting above to your web.config, the web-based eWay-CRM Administration Center won't work in Internet Explorer, which will be a huge loss for the whole humankind.
|
|
56
|
-
|
|
57
|
-
## Using the Connection Object
|
|
58
|
-
|
|
59
|
-
Once having the `ApiConnection` instance, the API requests look like this searching of our user record.
|
|
60
|
-
|
|
61
|
-
```JS
|
|
62
|
-
connection.callMethod(
|
|
63
|
-
'SearchUsers',
|
|
64
|
-
{
|
|
65
|
-
transmitObject: { Username: username },
|
|
66
|
-
},
|
|
67
|
-
(result) => {
|
|
68
|
-
console.log('My user detail follows:');
|
|
69
|
-
console.log(result.Data[0]);
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
```
|
|
1
|
+

|
|
2
|
+
# eWay-CRM API
|
|
3
|
+
API used for communication with [eWay-CRM](http://www.eway-crm.com/) web service. This library is a wrapper over HTTP/S communication and sessions. See our [documentation](https://kb.eway-crm.com/documentation/6-add-ins/6-7-api-1) for more information.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
The simpliest way to start using this library is to get the [NPM Package](https://www.npmjs.com/package/@eway-crm/connector). To do that, just run this command in your NodeJS project's root dir:
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
npm i @eway-crm/connector
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
To get the best dev experience, we also recommend using [TypeScript](https://www.typescriptlang.org/) since this library contains the types headers.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
This library wraps the communication with JSON API. For HTTP requests, it uses [Axios](https://github.com/axios/axios). To provide the most variability, it lets you input JSON data and fetch JSON data in the same structure as the server uses. The only thing you don't have to care about is the `sessionId`.
|
|
17
|
+
|
|
18
|
+
The actual usage is then the same as it would be for example with [PHP](https://github.com/rstefko/eway-crm-php-lib). See the [documentation](https://kb.eway-crm.com/documentation/6-add-ins/6-7-api-1) for more.
|
|
19
|
+
|
|
20
|
+
## Version Compatibility
|
|
21
|
+
|
|
22
|
+
This library is compatible with **eWay-CRM 6.0.1 and higher**. If you have got a lower version of your eWay-CRM, check the Updates section in the eWay-CRM Administration Application. If there is no update available, contact your eWay-CRM account manager or via other channel listed on our [web page](https://www.eway-crm.com/contact/).
|
|
23
|
+
|
|
24
|
+
## Establishing Connection
|
|
25
|
+
|
|
26
|
+
To communicate with eWay-CRM web service, we first have to establish connection. This must be done prior to every action we want to accomplish with use of the web service. To do that, we have to create new instance of ```ApiConnection``` with seven parameters:
|
|
27
|
+
1. Service url address (same as the one you use in Outlook)
|
|
28
|
+
2. Username
|
|
29
|
+
3. Password hash (md5 of the user's UTF8 password or hash created by the tool from eWay-CRM server component)
|
|
30
|
+
4. App version identifier (name and version of the connecting client app - must consist of alphabet string and digits at the end)
|
|
31
|
+
5. Client machine identifier (unique identifier of the connecting machine - MAC address for instance)
|
|
32
|
+
6. Client machine name (human readable client machine - PC name for instance)
|
|
33
|
+
7. Error handling callback (this callback is called everytime an unexpected error occurs)
|
|
34
|
+
|
|
35
|
+
```JS
|
|
36
|
+
import ApiConnection from '@eway-crm/connector';
|
|
37
|
+
|
|
38
|
+
const serviceUrl = 'https://free.eway-crm.com/31994';
|
|
39
|
+
const username = 'api';
|
|
40
|
+
const passwordHash = '470AE7216203E23E1983EF1851E72947';
|
|
41
|
+
|
|
42
|
+
const connection = ApiConnection.create(serviceUrl, username, passwordHash, 'JSSample1', '00:00:00:00:00', 'SampleTestMachine', (err) => console.error(err));
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
⚠️ The code above does not support [Microsoft Account Authenticaion](https://kb.eway-crm.com/documentation/2-installation/2-3-installation-the-server-part/adjust-eway-crm-web-service-for-azure-login-office-365?set_language=en). If you log into eWay-CRM with your Microsoft account, you need to implement your own OAuth2 client.
|
|
46
|
+
|
|
47
|
+
## CORS
|
|
48
|
+
|
|
49
|
+
If you are developing a web app running on a different host than your eWay-CRM web service, you need to configure your eWay-CRM web service to allow cross-origin requests. To achieve that, put the following setting into `appSettings` section of your web service's web.config file.
|
|
50
|
+
|
|
51
|
+
```XML
|
|
52
|
+
<add key="AccessControlAllowOrigin" value="https://YOUR-ORIGIN:PORT" />
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
⚠ If you add the setting above to your web.config, the web-based eWay-CRM Administration Center won't work in Internet Explorer, which will be a huge loss for the whole humankind.
|
|
56
|
+
|
|
57
|
+
## Using the Connection Object
|
|
58
|
+
|
|
59
|
+
Once having the `ApiConnection` instance, the API requests look like this searching of our user record.
|
|
60
|
+
|
|
61
|
+
```JS
|
|
62
|
+
connection.callMethod(
|
|
63
|
+
'SearchUsers',
|
|
64
|
+
{
|
|
65
|
+
transmitObject: { Username: username },
|
|
66
|
+
},
|
|
67
|
+
(result) => {
|
|
68
|
+
console.log('My user detail follows:');
|
|
69
|
+
console.log(result.Data[0]);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
```
|
|
@@ -3,8 +3,8 @@ export type TUnionError = Error | HttpRequestError | WebServiceError;
|
|
|
3
3
|
export declare class HttpRequestError extends Error {
|
|
4
4
|
statusCode: number;
|
|
5
5
|
message: string;
|
|
6
|
-
readonly responseData?: unknown;
|
|
7
|
-
constructor(statusCode: number, message: string, responseData?: unknown);
|
|
6
|
+
readonly responseData?: unknown | undefined;
|
|
7
|
+
constructor(statusCode: number, message: string, responseData?: unknown | undefined);
|
|
8
8
|
/**
|
|
9
9
|
* Builds the error from a non-200 HTTP response. Prefers the API result body's Description over the HTTP
|
|
10
10
|
* status text, which is empty over HTTP/2. The body is kept in
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ import type { TApiUnlinkInquiryResultType } from './data/IApiUnlinkInquiryResult
|
|
|
40
40
|
import DateHelper from './helpers/DateHelper';
|
|
41
41
|
import type { ImportResult } from './constants/ImportResult';
|
|
42
42
|
import { TransformItemFormats } from './enumerations/TransformItemFormats';
|
|
43
|
+
import { EmailConversionSource } from './enumerations/EmailConversionSource';
|
|
43
44
|
import type QuerySources from './helpers/QueryHelper/QuerySources';
|
|
44
45
|
import { ApiFetchClient } from './ApiFetchClient';
|
|
45
46
|
import { OpenItemLinkHelper } from './helpers/OpenItemLinkHelper';
|
|
@@ -112,4 +113,4 @@ export * from './data/query/IApiQueryFilters';
|
|
|
112
113
|
export * from './constants/ImportResult';
|
|
113
114
|
export * from './interfaces/ITranslatableString';
|
|
114
115
|
export * from './interfaces/ITokenData';
|
|
115
|
-
export { OpenItemLinkHelper, ImportResult, SentimentTone, HttpMethod, ISessionHandler, ReturnCodes, ITokenizedApiResult, TokenizedServiceConnection, CommonDataConnection, ApiMethods, GlobalSettingsNames, FolderNames, TFolderName, OAuthHelper, HttpRequestError, TUnionError, TInputData, FieldNames, EnumTypes, RelationTypes, RelationTypeIds, TRelationType, ColumnPermissionPermissionRules, ColumnPermissionMandatoryRules, Edition, Feature, Functionality, CustomizationStatsItemKeys, LicenseRestrictionKeys, ExpirationReason, LicenseKeyInvoiceSeverity, ErrorHelper, VersionHelperBase, OAuthSessionHandlerBase, OAuthSessionHandler, FieldTypes, TFieldType, TNumericValidatorType, IApiEvent, IApiSetFieldValueAction, ObjectTypeIds, IApiHubItemsCountsQueryResponseItem, QueryHelper, QuerySources, IApiServiceAuthSettingsResponse, ApiConnection as ApiConnectionAsNonDefaultExport, IApiUnlinkInquiryResult, TApiUnlinkInquiryResultType, VersionHelper, Version, StringHelper, DateHelper, TransformItemFormats, ApiFetchClient };
|
|
116
|
+
export { OpenItemLinkHelper, ImportResult, SentimentTone, HttpMethod, ISessionHandler, ReturnCodes, ITokenizedApiResult, TokenizedServiceConnection, CommonDataConnection, ApiMethods, GlobalSettingsNames, FolderNames, TFolderName, OAuthHelper, HttpRequestError, TUnionError, TInputData, FieldNames, EnumTypes, RelationTypes, RelationTypeIds, TRelationType, ColumnPermissionPermissionRules, ColumnPermissionMandatoryRules, Edition, Feature, Functionality, CustomizationStatsItemKeys, LicenseRestrictionKeys, ExpirationReason, LicenseKeyInvoiceSeverity, ErrorHelper, VersionHelperBase, OAuthSessionHandlerBase, OAuthSessionHandler, FieldTypes, TFieldType, TNumericValidatorType, IApiEvent, IApiSetFieldValueAction, ObjectTypeIds, IApiHubItemsCountsQueryResponseItem, QueryHelper, QuerySources, IApiServiceAuthSettingsResponse, ApiConnection as ApiConnectionAsNonDefaultExport, IApiUnlinkInquiryResult, TApiUnlinkInquiryResultType, VersionHelper, Version, StringHelper, DateHelper, TransformItemFormats, EmailConversionSource, ApiFetchClient };
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("axios"),t=require("universal-base64url"),r=require("jwt-decode"),n=require("compare-versions");function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var s=o(t),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var a,l={exports:{}},c=l.exports=function(){function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,o=void 0,s=void 0,a=function(e,t){T[n]=e,T[n+1]=t,2===(n+=2)&&(s?s(S):I())};function l(e){s=e}function c(e){a=e}var u="undefined"!=typeof window?window:void 0,d=u||{},m=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function y(){return function(){return process.nextTick(S)}}function C(){return void 0!==o?function(){o(S)}:P()}function f(){var e=0,t=new m(S),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function g(){var e=new MessageChannel;return e.port1.onmessage=S,function(){return e.port2.postMessage(0)}}function P(){var e=setTimeout;return function(){return e(S,1)}}var T=new Array(1e3);function S(){for(var e=0;e<n;e+=2)(0,T[e])(T[e+1]),T[e]=void 0,T[e+1]=void 0;n=0}function E(){try{var e=Function("return this")().require("vertx");return o=e.runOnLoop||e.runOnContext,C()}catch(e){return P()}}var I=void 0;function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("axios"),t=require("universal-base64url"),r=require("jwt-decode"),n=require("compare-versions");function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var s=o(t),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var a,l={exports:{}},c=l.exports=function(){function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,o=void 0,s=void 0,a=function(e,t){T[n]=e,T[n+1]=t,2===(n+=2)&&(s?s(S):I())};function l(e){s=e}function c(e){a=e}var u="undefined"!=typeof window?window:void 0,d=u||{},m=d.MutationObserver||d.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function y(){return function(){return process.nextTick(S)}}function C(){return void 0!==o?function(){o(S)}:P()}function f(){var e=0,t=new m(S),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function g(){var e=new MessageChannel;return e.port1.onmessage=S,function(){return e.port2.postMessage(0)}}function P(){var e=setTimeout;return function(){return e(S,1)}}var T=new Array(1e3);function S(){for(var e=0;e<n;e+=2)(0,T[e])(T[e+1]),T[e]=void 0,T[e+1]=void 0;n=0}function E(){try{var e=Function("return this")().require("vertx");return o=e.runOnLoop||e.runOnContext,C()}catch(e){return P()}}var I=void 0;function v(e,t){var r=this,n=new this.constructor(D);void 0===n[k]&&$(n);var o=r._state;if(o){var s=arguments[o-1];a(function(){return W(o,n,s,r._result)})}else j(r,n,e,t);return n}function A(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(D);return V(r,e),r}I=p?y():m?f():h?g():void 0===u?E():P();var k=Math.random().toString(36).substring(2);function D(){}var b=void 0,w=1,x=2;function F(){return new TypeError("You cannot resolve a promise with itself")}function O(){return new TypeError("A promises callback cannot return that same promise.")}function N(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}function R(e,t,r){a(function(e){var n=!1,o=N(r,t,function(r){n||(n=!0,t!==r?V(e,r):_(e,r))},function(t){n||(n=!0,G(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,G(e,o))},e)}function L(e,t){t._state===w?_(e,t._result):t._state===x?G(e,t._result):j(t,void 0,function(t){return V(e,t)},function(t){return G(e,t)})}function M(e,r,n){r.constructor===e.constructor&&n===v&&r.constructor.resolve===A?L(e,r):void 0===n?_(e,r):t(n)?R(e,r,n):_(e,r)}function V(t,r){if(t===r)G(t,F());else if(e(r)){var n=void 0;try{n=r.then}catch(e){return void G(t,e)}M(t,r,n)}else _(t,r)}function U(e){e._onerror&&e._onerror(e._result),B(e)}function _(e,t){e._state===b&&(e._result=t,e._state=w,0!==e._subscribers.length&&a(B,e))}function G(e,t){e._state===b&&(e._state=x,e._result=t,a(U,e))}function j(e,t,r,n){var o=e._subscribers,s=o.length;e._onerror=null,o[s]=t,o[s+w]=r,o[s+x]=n,0===s&&e._state&&a(B,e)}function B(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,s=e._result,i=0;i<t.length;i+=3)n=t[i],o=t[i+r],n?W(r,n,o,s):o(s);e._subscribers.length=0}}function W(e,r,n,o){var s=t(n),i=void 0,a=void 0,l=!0;if(s){try{i=n(o)}catch(e){l=!1,a=e}if(r===i)return void G(r,O())}else i=o;r._state!==b||(s&&l?V(r,i):!1===l?G(r,a):e===w?_(r,i):e===x&&G(r,i))}function H(e,t){try{t(function(t){V(e,t)},function(t){G(e,t)})}catch(t){G(e,t)}}var z=0;function Q(){return z++}function $(e){e[k]=z++,e._state=void 0,e._result=void 0,e._subscribers=[]}function q(){return new Error("Array Methods must be provided an Array")}var J=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(D),this.promise[k]||$(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?_(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&_(this.promise,this._result))):G(this.promise,q())}return e.prototype._enumerate=function(e){for(var t=0;this._state===b&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===A){var o=void 0,s=void 0,i=!1;try{o=e.then}catch(e){i=!0,s=e}if(o===v&&e._state!==b)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===te){var a=new r(D);i?G(a,s):M(a,e,o),this._willSettleAt(a,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===b&&(this._remaining--,e===x?G(n,r):this._result[t]=r),0===this._remaining&&_(n,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;j(e,void 0,function(e){return r._settledAt(w,t,e)},function(e){return r._settledAt(x,t,e)})},e}();function X(e){return new J(this,e).promise}function K(e){var t=this;return r(e)?new t(function(r,n){for(var o=e.length,s=0;s<o;s++)t.resolve(e[s]).then(r,n)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})}function Y(e){var t=new this(D);return G(t,e),t}function Z(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ee(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var te=function(){function e(t){this[k]=Q(),this._result=this._state=void 0,this._subscribers=[],D!==t&&("function"!=typeof t&&Z(),this instanceof e?H(this,t):ee())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var r=this,n=r.constructor;return t(e)?r.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){throw t})}):r.then(e,e)},e}();function re(){var e=void 0;if(void 0!==i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=te}return te.prototype.then=v,te.all=X,te.race=K,te.resolve=A,te.reject=Y,te._setScheduler=l,te._setAsap=c,te._asap=a,te.polyfill=re,te.Promise=te,te}();
|
|
2
2
|
/*!
|
|
3
3
|
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
4
4
|
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
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 u{}u.rcSuccess="rcSuccess",u.rcBadSession="rcBadSession",u.rcDuplicateContact="rcDuplicateContact",u.rcWebServiceMoved="rcWebServiceMoved",u.rcAccessDenied="rcAccessDenied",u.rcLoginUserNameChanged="rcLoginUserNameChanged",u.rcLicenseExpired="rcLicenseExpired",u.rcBadAccessToken="rcBadAccessToken",exports.HttpMethod=void 0,(a=exports.HttpMethod||(exports.HttpMethod={})).get="get",a.post="post";class d{}d.absence="Absence",d.bonusType="BonusType",d.busyStatus="BusyStatus",d.cartType="CartType",d.companyType="CompanyType",d.contactType="ContactType",d.countryCode="CountryCode",d.currency="Currency",d.customFieldCategory="CustomFieldCategory",d.dayType="DayType",d.documentOfflineState="DocumentOfflineState",d.documentType="DocumentType",d.emailCampaignWorkflowStatus="EmailCampaignWorkflowStatus",d.emailOfflineState="EmailOfflineState",d.emailType="EmailType",d.familyStatus="FamilyStatus",d.firstContact="FirstContact",d.globalSettingsCategory="GlobalSettingsCategory",d.goalType="GoalType",d.groupColor="GroupColor",d.importance="Importance",d.journalType="JournalType",d.knowledgeLevel="KnowledgeLevel",d.knowledgeTitle="KnowledgeTitle",d.knowledgeType="KnowledgeType",d.leadType="LeadType",d.marketingType="MarketingType",d.paymentType="PaymentType",d.prefixType="PrefixType",d.productType="ProductType",d.projectOrigin="ProjectOrigin",d.projectType="ProjectType",d.reportCategory="ReportCategory",d.responseForm="ResponseForm",d.responseType="ResponseType",d.salaryDate="SalaryDate",d.salaryType="SalaryType",d.salePriceType="SalePriceType",d.sentimentTone="SentimentTone",d.suffixType="SuffixType",d.taskImportance="TaskImportance",d.tasksSnoozePeriod="TasksSnoozePeriod",d.taskStatus="TaskStatus",d.taskType="TaskType",d.trainingGrade="TrainingGrade",d.trainingTitle="TrainingTitle",d.translations="Translations",d.units="Units",d.userType="UserType",d.usStatesDistrictsTerritories="USStatesDistrictsTerritories",d.vacationType="VacationType",d.vat="VAT",d.workLoad="WorkLoad",d.workReportType="WorkReportType";class m{}m.isValidFolderName=e=>Object.values(m).includes(e),m.actions="Actions",m.additionalFields="AdditionalFields",m.bonuses="Bonuses",m.calendar="Calendar",m.capacityNotes="CapacityNotes",m.capacityNoteTypes="CapacityNoteTypes",m.carts="Carts",m.columnPermissions="ColumnPermissions",m.companies="Companies",m.contacts="Contacts",m.contactsSuggestions="ContactsSuggestions",m.currencyExchangeRates="CurrencyExchangeRates",m.documents="Documents",m.emails="Emails",m.enumTypes="EnumTypes",m.enumValues="EnumValues",m.enumValuesRelations="EnumValuesRelations",m.features="Features",m.flows="Flows",m.globalSettings="GlobalSettings",m.goals="Goals",m.goods="Goods",m.goodsInCart="GoodsInCart",m.goodsInSet="GoodsInSet",m.groups="Groups",m.history="History",m.holidays="Holidays",m.children="Children",m.individualDiscounts="IndividualDiscounts",m.invoiceItems="InvoiceItems",m.invoices="Invoices",m.itemCopyRelations="ItemCopyRelations",m.journal="Journal",m.knowledge="Knowledge",m.layouts="Layouts",m.layoutsModels="LayoutsModels",m.leads="Leads",m.ledger="Ledger",m.mappings="Mappings",m.marketing="Marketing",m.marketingList="MarketingList",m.marketingListSources="MarketingListSources",m.models="Models",m.modulePermissions="ModulePermissions",m.objectTypesOptions="ObjectTypesOptions",m.payments="Payments",m.priceListGroups="PriceListGroups",m.projectAssignments="ProjectAssignments",m.projectAssignmentsPerUserProject="ProjectAssignmentsPerUserProject",m.projectAssignmentsTotal="ProjectAssignmentsTotal",m.projectAssignmentsTotalUserProject="ProjectAssignmentsTotalUserProject",m.projectList="ProjectList",m.projects="Projects",m.projectUsersInCaPlan="ProjectUsersInCaPlan",m.relationData="RelationData",m.relations="Relations",m.reports="Reports",m.revisionsHistory="RevisionsHistory",m.salaries="Salaries",m.salePrices="SalePrices",m.prices="Prices",m.sqlObjects="SqlObjects",m.tasks="Tasks",m.recurrencePatterns="RecurrencePatterns",m.teamRoles="TeamRoles",m.templates="Templates",m.training="Training",m.unifiedRelations="UnifiedRelations",m.users="Users",m.userSettings="UserSettings",m.vacation="Vacation",m.webAccess2Options="WebAccess2Options",m.webAccessOptions="WebAccessOptions",m.workCommitments="WorkCommitments",m.workflowHistory="WorkflowHistory",m.workReports="WorkReports",m.wrongClientVersions="WrongClientVersions",m.xsltTransformations="XsltTransformations",m.xsltTransformationsModels="XsltTransformationsModels",m.getEnumTypeName=e=>e===m.bonuses?d.bonusType:e===m.carts?d.cartType:e===m.companies?d.companyType:e===m.contacts?d.contactType:e===m.documents?d.documentType:e===m.emails?d.emailType:e===m.goals?d.goalType:e===m.goods?d.productType:e===m.journal?d.journalType:e===m.knowledge?d.knowledgeType:e===m.leads?d.leadType:e===m.marketing?d.marketingType:e===m.projects?d.projectType:e===m.salaries?d.salaryType:e===m.salePrices?d.salePriceType:e===m.tasks?d.taskType:e===m.training?d.trainingTitle:e===m.users?d.userType:e===m.vacation?d.vacationType:e===m.workReports?d.workReportType:null,m.getFolderNameByEnumTypeName=e=>e===d.bonusType?m.bonuses:e===d.cartType?m.carts:e===d.companyType?m.companies:e===d.contactType?m.contacts:e===d.documentType?m.documents:e===d.emailType?m.emails:e===d.goalType?m.goals:e===d.journalType?m.journal:e===d.knowledgeType?m.knowledge:e===d.leadType?m.leads:e===d.marketingType?m.marketing:e===d.productType?m.goods:e===d.projectType?m.projects:e===d.salaryType?m.salaries:e===d.salePriceType?m.salePrices:e===d.taskType?m.tasks:e===d.trainingTitle?m.training:e===d.userType?m.users:e===d.vacationType?m.vacation:e===d.workReportType?m.workReports:null;class p{}p.getAllEmailAttachments="GetAllEmailAttachments",p.getCalendarsByItemGuids="GetCalendarsByItemGuids",p.getEmailAttachment="GetEmailAttachment",p.getItemPreview="GetItemPreview",p.getJournalsByItemGuids="GetJournalsByItemGuids",p.getMarketingCampaignsByItemGuids="GetMarketingCampaignsByItemGuids",p.getMarketingListsRecordsByItemGuids="GetMarketingListsRecordsByItemGuids",p.getRevisionHistoryRecordsByItemGuids="GetRevisionHistoryRecordsByItemGuids",p.getVacationsByItemGuids="GetVacationsByItemGuids",p.getWorkflowHistoryRecordsByItemGuids="GetWorkflowHistoryRecordsByItemGuids",p.getCompanyInformationFromTaxRegister="GetCompanyInformationFromTaxRegister",p.logIn="LogIn",p.logOut="LogOut",p.query="Query",p.queryAmount="QueryAmount",p.getServiceAuthSettings="GetServiceAuthSettings",p.getVersion="GetVersion",p.getBinaryAttachment="GetBinaryAttachment",p.getBinaryAttachmentLatestRevision="GetBinaryAttachmentLatestRevision",p.transformItem="TransformItem",p.canUnlinkItems="CanUnlinkItems",p.unlinkItems="UnlinkItems",p.getGoodsFinalPrices="GetGoodsFinalPrices",p.saveItemCopyRelation="SaveItemCopyRelation",p.getXsltTransormationDefinition="GetXsltTransformationDefinition",p.saveBinaryAttachment="SaveBinaryAttachment",p.saveBinaryXsltTransformation="SaveBinaryXsltTransformation",p.GetLoginHistory="GetLoginHistory",p.GetMyLoginHistory="GetMyLoginHistory",p.getFolderNameForApiMethod=e=>{switch(e){case m.calendar:return"Calendars";case m.journal:return"Journals";case m.marketing:return"MarketingCampaigns";case m.marketingList:return"MarketingListsRecords";case m.revisionsHistory:return"RevisionHistoryRecords";case m.vacation:return"Vacations";case m.workflowHistory:return"WorkflowHistoryRecords";default:return e}},p.getGetFolderNameByItemGuidsMethodName=e=>`Get${p.getFolderNameForApiMethod(e)}ByItemGuids`,p.getGetFolderNameMethodName=e=>`Get${p.getFolderNameForApiMethod(e)}`,p.getSearchFolderNameMethodName=e=>`Search${p.getFolderNameForApiMethod(e)}`;class h{constructor(e,t,r,n,o,s){if(this.invalidateSessionId=(e,t)=>{t&&t()},this.getSessionId=(e,t)=>{e.callWithoutSession(p.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=o,this.errorCallback=s}}class y{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 C{static createAuthorizeUrl(e,t,r,n,o,s,i=!1,a){if(o&&!s||!o&&s)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)}`),o&&s&&(l+=`&code_challenge=${encodeURIComponent(o)}&code_challenge_method=${encodeURIComponent(s)}`),a&&(l+=`&url=${encodeURIComponent(a)}`),l}}C.finishAuthorization=(e,t,r,n,o,s,i)=>{const a=new URLSearchParams;a.append("code_verifier",n),a.append("client_id",t),a.append("client_secret",r),a.append("code",o),a.append("redirect_uri",s),a.append("grant_type","authorization_code"),C.callTokenEndpoint(e,a,i)},C.refreshToken=(e,t,r,n,o)=>{const s=new URLSearchParams;s.append("client_id",t),s.append("client_secret",r),s.append("refresh_token",n),s.append("grant_type","refresh_token"),C.callTokenEndpoint(e,s,o)},C.getWebServiceUrl=e=>{const t=e.split(".");if(2!==t.length)throw new Error("Invalid token supplied");return s.decode(t[1])},C.getUserName=e=>C.decodeAccessToken(e).username,C.decodeAccessToken=e=>r(e),C.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 f extends Error{constructor(e,t){super(),this.returnCode=e,this.message=t}}class g{constructor(e,t,r,n,o){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=o}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(p.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 f(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 P extends g{constructor(e,t,r,n,o,s,i,a){if(!(e&&n&&t&&r))throw new Error("Non of the arguments 'username', 'clientId', 'clientSecret', 'refreshToken' can be empty.");super(e,o,s,(e,t)=>{C.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 T extends Error{constructor(e,t,r){super(t),this.statusCode=e,this.message=t,this.responseData=r}}T.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 T(e.status,n,e.data)};class S{}S.stringifyError=e=>JSON.stringify(e,S.replaceErrors),S.replaceErrors=(e,t)=>{if(t instanceof Error){const e={};return Object.getOwnPropertyNames(t).forEach(r=>{e[r]=t[r]}),e}return t};class E{}E.openItemLinkRegEx=/https:\/\/open\.eway-crm\.(dev|com)\/\?[-a-zA-Z0-9()@:%_\+.~#?&\/=]*/gi,E.itemParamName="l",E.openLinkDomainLength=7,E.getOpenLinkDomain=e=>e?"open.eway-crm.dev":"open.eway-crm.com",E.isOpenItemLinkInText=e=>E.openItemLinkRegEx.test(e),E.getOpenLinksFromString=e=>e.match(E.openItemLinkRegEx),E.getItemLinksFromOpenLinks=e=>{try{return e.map(e=>new URL(e).searchParams.get(E.itemParamName))}catch(e){console.error("Invalid string passed for cretaing url while getting links from open links")}},E.getItemInfoFromLink=e=>{const t=s.decode(e).substring(E.openLinkDomainLength).split("/");if(Object.keys(m).some(e=>m[e]===t[0])&&t[1]){return{folderName:t[0],itemGuid:t[1]}}},E.getAllItemsFromTextWithLinks=e=>{const t={};if(E.isOpenItemLinkInText(e)){const r=E.getOpenLinksFromString(e);if(!r)return;const n=E.getItemLinksFromOpenLinks(r);null==n||n.forEach(e=>{var r;if(!e)return;const n=E.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 I{constructor(t,r,n,o){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,t,r,n)=>{const o=s.encode(this.baseUri);let i="eway://"+t;r&&(i+="/"+(null==r?void 0:r.toLowerCase()));const a=E.getOpenLinkDomain(e);i=s.encode(i);let l="https://"+a+"/?ws="+o+`&${E.itemParamName}=`+i;return n&&(l+="&n="+encodeURIComponent(n)),l},this.askCustomUploadMethod=(e,t,r,n,o)=>new Promise((s,i)=>{const a=o?e=>{throw i(e),e}:i;this.callCustomUploadMethod(e,t,r,s,a,a,n)}),this.askUploadMethod=(e,t,r,n,o)=>new Promise((s,i)=>{const a=o?e=>{throw i(e),e}:i;this.callUploadMethod(e,t,r,s,a,a,n)}),this.callCustomUploadMethod=(t,r,n,o,s,i,a)=>{const l=()=>{this.sessionHandler.getSessionId(this,e=>{this.sessionId=e,this.callCustomUploadMethod(t,r,n,o,s,i,a)})},c=this.sessionId;if(!c)return void l();const d=new URLSearchParams(r),m=`${this.svcUri}/${n}?sessionId=${this.sessionId}&${d.toString()}`,p=e.post(m,t,a);I.handleCallPromise(p,o,e=>{if(e.ReturnCode===u.rcBadSession)return this.sessionId=null,void this.sessionHandler.invalidateSessionId(c,l);if(s)s(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+": "+S.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,o,s,i)=>{this.callCustomUploadMethod(r,{itemGuid:e,fileName:t},p.saveBinaryAttachment,n,o,s,i)},this.askMethod=(e,t,r,n)=>new Promise((o,s)=>{const i=n?e=>{throw s(e),e}:s;this.callMethod(e,t,o,i,r,i)}),this.callMethod=(e,t,r,n,o,s)=>{o||(o=exports.HttpMethod.post);const i=()=>{this.sessionHandler.getSessionId(this,i=>{this.sessionId=i,this.callMethod(e,t,r,n,o,s)})},a=this.sessionId;if(!a)return void i();t.sessionId=a;const l=e!==p.logOut?r:e=>{this.sessionId=null,r(e)};this.callWithoutSession(e,t,l,r=>{if(r.ReturnCode!==u.rcBadSession||(this.sessionId=null,e===p.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(a,i)},null,o,s)},this.callWithoutSession=(t,r,n,o,s,i,a)=>{var l;i||(i=exports.HttpMethod.post);const c=this.svcUri+"/"+t;let u,d;switch(s&&(u={headers:s,withCredentials:null!==(l=this.supportGetItemPreviewMethod)&&void 0!==l?l:t===p.logIn}),i){case exports.HttpMethod.get:if(r)throw new Error("Calling api get method with data specified does not make any sense.");d=e.get(c,u);break;case exports.HttpMethod.post:d=e.post(c,r,u);break;default:throw new Error(`Unknown http method '${i}'.`)}I.handleCallPromise(d,n,o,e=>{if(a)try{a(e)}catch(e){if(!this.errorCallback)throw e;this.errorCallback(e,r)}else{const t=new Error("Unhandled connection error when calling "+c+": "+S.stringifyError(e));if(!this.errorCallback)throw t;this.errorCallback(t,r)}})},this.getItemPreviewGetMethodUrl=(e,t,r)=>this.svcUri+"/"+p.getItemPreview+"?folderName="+encodeURIComponent(e)+"&itemGuid="+encodeURIComponent(t)+(r||0===r?"&itemVersion="+encodeURIComponent(r.toString()):""),this.getEmailAttachmentGetMethodUrl=(e,t)=>this.svcUri+"/"+p.getEmailAttachment+"?itemGuid="+encodeURIComponent(e)+"&contentId="+encodeURIComponent(t),this.getAllEmailAttachmentsZipGetMethodUrl=e=>this.svcUri+"/"+p.getAllEmailAttachments+"?itemGuid="+encodeURIComponent(e),this.getBinaryAttachmentGetMethodUrl=(e,t)=>"number"==typeof t?this.svcUri+"/"+p.getBinaryAttachment+"?itemGuid="+encodeURIComponent(e)+`&revision=${t}`:this.svcUri+"/"+p.getBinaryAttachmentLatestRevision+"?itemGuid="+encodeURIComponent(e),this.getTransformItemMethodUrl=(e,t,r,n,o)=>`${this.svcUri}/${p.transformItem}?itemGuid=${encodeURIComponent(e)}&itemFolderName=${encodeURIComponent(t)}&transformationGuid=${encodeURIComponent(r)}&outputFormat=${n}${o?`&lang=${encodeURIComponent(o)}`:""}`,this.getXsltTransformationDefinitionMethodUrl=e=>`${this.svcUri}/${p.getXsltTransormationDefinition}?itemGuid=${encodeURIComponent(e)}`,this.getActiveSessionId=()=>this.sessionId,this.setActiveSessionId=e=>{this.sessionId=e},!t)throw new Error("The argument 'apiServiceUri' cannot be empty.");if(t.length<8||"https://"!==t.substr(0,8).toLowerCase()&&"http://"!==t.substr(0,7).toLowerCase())throw new Error("Api service uri must start either with 'https://' or with 'http://'.");if(".svc"===t.substr(t.length-4).toLowerCase()){this.svcUri=t;const e=["/API.svc","/InsecureAPI.svc","/WcfService/Service.svc"].find(e=>e.toLowerCase()===t.substr(t.length-e.length).toLowerCase())||"";this.baseUri=t.substr(0,t.length-e.length)}else this.baseUri=I.normalizeWsUrl(t)||t,"https://"===t.substr(0,8).toLowerCase()?this.svcUri=this.baseUri+"/API.svc":this.svcUri=this.baseUri+"/InsecureAPI.svc";this.sessionHandler=r,this.errorCallback=n,this.sessionId=null,this.supportGetItemPreviewMethod=null!=o&&o}get supportsGetItemPreviewMethod(){return this.supportGetItemPreviewMethod}static create(e,t,r,n,o,s,i,a){return new I(e,new h(t,r,n,o,s,i),i,a)}static createAnonymous(e,t){return new I(e,new y,t)}static createUsingOAuth(e,t,r,n,o,s,i,a,l,c){return new I(e,new P(t,r,n,o,s,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(I.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===u.rcSuccess?t(e.data):r(e.data):n(T.from(e))}).catch(e=>{e.response?n(T.from(e.response)):n(e)})}}class A{constructor(e,t,r,n,o,s,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((o,s)=>{t.token=s,A.call(o,e,t,r,o=>{if(o.ReturnCodeString!==this.invalidTokenReturnCode){if(n)n(o);else if(this.generalErrorCallback){const e=new Error("Unhandled tokenized service connection return code "+o.ReturnCodeString+".\nDescription: "+o.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=o,this.connection=s,this.generalErrorCallback=i||null,this.url=null,this.token=null,this.isActive=!0}static call(t,r,n,o,s,i){const a=t+"/"+r;e.post(a,n).then(e=>{200===e.status?"Success"===e.data.ReturnCodeString?o(e.data):s(e.data):i(T.from(e))}).catch(e=>{e.response?i(T.from(e.response)):i(e)})}}const v=e=>({url:e.ServiceUrl,token:e.Token});class k{}k.acceptableBackwardWorkReportDays="AcceptableBackwardWorkReportDays",k.adminAppInactiveLogoutTime="AdminAppInactiveLogoutTime",k.allowChangeGoodsInCartListPrice="AllowChangeGoodsInCartListPrice",k.applyGeneralDataProtectionRules="ApplyGeneralDataProtectionRules",k.automaticallyCreateJournalAfterCallDuration="AutomaticallyCreateJournalAfterCallDuration",k.bonusesCompletedState="BonusesCompletedState",k.cartInvoicedState="CartInvoicedState",k.cartOrderCanceledState="CartOrderCanceledState",k.cartOrderInProcessState="CartOrderInProcessState",k.cartOrderProcessedState="CartOrderProcessedState",k.cartPaidState="CartPaidState",k.cartProposalInProcessState="CartProposalInProcessState",k.cartProposalProcessedState="CartProposalProcessedState",k.cartSalesVoucherIssuedState="CartSalesVoucherIssuedState",k.cartToBeInvoicedState="CartToBeInvoicedState",k.cartVoidedState="CartVoidedState",k.clickToCallScheme="ClickToCallScheme",k.companyDuplicityCheckEnabled="CompanyDuplicityCheckEnabled",k.completedStateName="CompletedStateName",k.contactDuplicityCheckEnabled="ContactDuplicityCheckEnabled",k.createCompanyWhileImportingContactFromOutlook="CreateCompanyWhileImportingContactFromOutlook",k.defaultProposalValidityPeriod="DefaultProposalValidityPeriod",k.enableContactsTwoWaySyncWithM365="EnableContactsTwoWaySyncWithM365",k.deadStateName="DeadStateName",k.enableCompaniesSyncIntoMobileDeviceContacts="EnableCompaniesSyncIntoMobileDeviceContacts",k.enableContactsSyncIntoMobileDevice="EnableContactsSyncIntoMobileDevice",k.enableLeadsSyncIntoMobileDeviceContacts="EnableLeadsSyncIntoMobileDeviceContacts",k.enableLlamaAiFeatures="EnableLlamaAiFeatures",k.enableUsersSyncIntoMobileDeviceContacts="EnableUsersSyncIntoMobileDeviceContacts",k.emailsActiveProjectsLeadsFilter="EmailsActiveProjectsLeadsFilter",k.trackToAddressesOnly="TrackToAddressesOnly",k.exchangeRatesAdminGroupName="ExchangeRatesAdminGroupName",k.forcedEmailTrackingGroups="ForcedEmailTrackingGroups",k.ignoreEmailsFromDomainsOnEmailsTracking="IgnoreEmailsFromDomainsOnEmailsTracking",k.trackEmailsFromDomains="TrackEmailsFromDomains",k.groupsForAllUnpaidInvoicesNotification="GroupsForAllUnpaidInvoicesNotification",k.itemPreviewMaxHeight="ItemPreviewMaxHeight",k.lastActivityAttributes="LastActivityAttributes",k.leadsCompletedState="LeadsCompletedState",k.leadDeadlineAlertGroups="LeadDeadlineAlertGroups",k.leadsDeadState="LeadsDeadState",k.marketingCompletedState="MarketingCompletedState",k.marketingDeadState="MarketingDeadState",k.minimumPasswordLength="MinimumPasswordLength",k.nextStepAttributes="NextStepAttributes",k.notifyAboutInvoicedInvoiceInPohodaGroup="NotifyAboutInvoicedInvoiceInPohodaGroup",k.notifyAboutLeadsDeadline="NotifyAboutLeadsDeadline",k.notifyAboutPaidInvoiceInPohodaGroup="NotifyAboutPaidInvoiceInPohodaGroup",k.notifyAboutProjectDeadline="NotifyAboutProjectDeadline",k.numberOfDecimalPlaces="NumberOfDecimalPlaces",k.phoneListTaskSolverGroup="PhoneListTaskSolverGroup",k.projectDeadlineAlert="ProjectDeadlineAlert",k.serverUpdateProgressNotificationGroup="ServerUpdateProgressNotificationGroup",k.sumarizeCartsPricesOnLeads="SumarizeCartsPricesOnLeads",k.sumarizeCartsPricesOnProjects="SumarizeCartsPricesOnProjects",k.sumarizePeopleExpensesOnProjects="SumarizePeopleExpensesOnProjects",k.systemHealthNotificationGroup="SystemHealthNotificationGroup",k.tasksCompletedState="TasksCompletedState",k.tasksDeferredState="TasksDeferredState",k.tasksInProgressState="TasksInProgressState",k.tasksNotStartedState="TasksNotStartedState",k.tasksWaitOnSomeoneElseState="TasksWaitOnSomeoneElseState",k.trackDocumentVersions="TrackDocumentVersions",k.vacationCompletedState="VacationCompletedState",k.workReportApprovedState="WorkReportApprovedState",k.defaultLanguage="DefaultLanguage",k.defaultCurrency="DefaultCurrency",k.myCompanyCountry="MyCompanyCountry",k.myCompanyName="MyCompanyName",k.myCompanyStreet="MyCompanyStreet",k.myCompanyCity="MyCompanyCity",k.myCompanyState="MyCompanyState",k.myCompanyZip="MyCompanyZIP",k.myCompanyId="MyCompanyID",k.myCompanyVat="MyCompanyVAT",k.mergeGoodsInCart="MergeGoodsInCart",k.cartRefreshLogic="CartRefreshLogic",k.goodsDefaultQuantity="GoodsDefaultQuantity",k.goodsDefaultVAT="GoodsDefaultVAT",k.goodsDefaultVATIncluded="GoodsDefaultVATIncluded",k.recalculateOnListPriceChange="RecalculateOnListPriceChange",k.recalculateOnPurchasePriceChange="RecalculateOnPurchasePriceChange";class D{}D.ServerCommon={Server_ID:"Server_ID",Server_ItemCreated:"Server_ItemCreated",Server_ItemChanged:"Server_ItemChanged"},D.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"},D.Calendar={Location:"Location",StartDate:"StartDate",EndDate:"EndDate",AllDayEvent:"AllDayEvent",SuperiorItem:"SuperiorItem",BusyStatus:"BusyStatus",GraphID:"GraphID",GraphCalendarID:"GraphCalendarID",Note:"Note"},D.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"},D.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"},D.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"},D.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:D.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"},D.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"},D.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"},D.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"},D.Goods=Object.assign(Object.assign({},D.GoodsBase),{PriceListGroupGUID:"PriceListGroupGUID",InventoryQuantity:"InventoryQuantity"}),D.GoodsInCart=Object.assign(Object.assign({},D.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"}),D.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"},D.Vacation={StartDate:"StartDate",EndDate:"EndDate",User:"User",Duration:"Duration",Place:"Place",Note:"Note",AllDay:"AllDay",TypeEn:"TypeEn",StateEn:"StateEn",IsPrivate:"Private"},D.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"},D.Projects={HumanID:"HID",FileAs:"FileAs",ProjectName:"ProjectName",ProjectOriginEn:"ProjectOriginEn",TypeEn:"TypeEn",StateEn:"StateEn",PaymentTypeEn:"PaymentTypeEn",ProjectStart:"ProjectStart",ProjectRealEnd:"ProjectRealEnd",EstimatedEnd:"ProjectEnd",CurrencyEn:D.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"},D.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"},D.Training={TitleEn:"TitleEn"},D.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"},D.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"},D.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"},D.PriceListGroups={Note:"Note"},D.Prices={SalePriceGUID:"SalePriceGUID",GoodsItemGUID:"GoodsItemGUID",Price:"Price",CurrencyEn:"CurrencyEn"},D.SalePrices={Note:"Note",Discount:"Discount",TypeEn:"TypeEn",StateEn:"StateEn",PrevStateEn:"PrevStateEn"},D.XsltTransformations={LangCode:"LangCode",Definition:"Definition",Namespace:"Namespace",ObjectTypeID:"ObjectTypeID",TransformationVersion:"TransformationVersion"},D.XsltTransformationsModels={ObjectTypeID:"ObjectTypeID",TransformationGUID:"TransformationGUID",ItemTypeGUID:"ItemTypeGUID"},D.allTypeEnNames=["TypeEn",D.Documents.DocTypeEn,D.WorkReports.WorkReportEn,"TitleEn"],D.getFolderFileAs=e=>{switch(e){case m.leads:return D.Leads.FileAs;case m.projects:return D.Projects.ProjectName;case m.documents:return D.Documents.DocName;case m.companies:return D.Companies.CompanyName;case m.contacts:case m.users:return D.Common.FileAs;case m.emails:return D.Emails.Subject;case m.journal:return D.Journal.FileAs;case m.tasks:return D.Tasks.Subject;case m.workReports:return D.WorkReports.Subject;case m.vacation:return D.Vacation.TypeEn;case m.carts:case m.goods:case m.goodsInCart:return D.Common.FileAs;case m.groups:return D.Groups.GroupName;case m.xsltTransformations:return D.Common.FileAs;default:return console.warn(`FileAs col name not defined for folderName ${e}`),D.Common.FileAs}};class b{}b.general="GENERAL",b.group="GROUP",b.contactPerson="CONTACTPERSON",b.contact="CONTACT",b.customer="CUSTOMER",b.company="COMPANY",b.outlookProject="OUTLOOKPROJECT",b.supervisor="SUPERVISOR",b.projectOrigin="PROJECT_ORIGIN",b.cart="CART",b.goodsInCart="GOODSINCART",b.superiorItem="SUPERIORITEM",b.taskParent="TASKPARENT";class w{}w.general=1,w.group=2,w.contactPerson=10,w.contact=11,w.customer=12,w.company=13,w.outlookProject=28,w.supervisor=32,w.projectOrigin=25,w.cart=9,w.goodsInCart=15,w.superiorItem=31,w.taskParent=38;class x{}x.all="All",x.own="Own",x.readonly="Readonly",x.invisible="Invisible",x.none="None";class F{}var O,N,R,L;F.mandatory="Mandatory",F.optional="Optional",F.unique="Unique",F.none="None",exports.Edition=void 0,(O=exports.Edition||(exports.Edition={})).Free="Free",O.Basic="Basic",O.Professional="Professional",O.Enterprise="Enterprise",exports.Feature=void 0,(N=exports.Feature||(exports.Feature={})).ContactsAndCompanies="ContactsAndCompanies",N.Sales="Sales",N.Projects="Projects",N.Marketing="Marketing",exports.SentimentTone=void 0,(R=exports.SentimentTone||(exports.SentimentTone={}))[R.Negative=0]="Negative",R[R.Neutral=1]="Neutral",R[R.Positive=2]="Positive";class M{}M.contactsSynchronizationWithOutlook="ContactsSynchronizationWithOutlook",M.wordAddin="WordAddin",M.excelAddin="ExcelAddin",M.tasksRecurrentTasks="TasksRecurrentTasks",M.tasksSubtasks="TasksSubtasks",M.tasksSynchronizationWithOutlook="TasksSynchronizationWithOutlook",M.calendarSynchronizationWithOutlook="CalendarSynchronizationWithOutlook",M.emailsAutomaticTracking="EmailsAutomaticTracking",M.convertEmailToProject="ConvertEmailToProject",M.duplicityChecker="DuplicityChecker",M.nextStepAndLastActivityCustomization="NextStepAndLastActivityCustomization",M.subProjects="SubProjects",M.resourceAndPlanning="ResourceAndPlanning",M.professionalEmailCampaigns="ProfessionalEmailCampaigns",M.professionalEmailCampaignsAdvancedStatistics="ProfessionalEmailCampaignsAdvancedStatistics",M.wordEmailMerge="WordEmailMerge",M.printLabels="PrintLabels",M.printEnvelopes="PrintEnvelopes",M.userViews="UserViews",M.sharedUserViews="SharedUserViews",M.gridConditionalFormating="GridConditionalFormating",M.multipleCurrencies="MultipleCurrencies",M.historyTracking="HistoryTracking",M.privateItems="PrivateItems",M.itemTypes="ItemTypes",M.formLayoutCustomization="FormLayoutCustomization",M.workflowBasicDefinitions="WorkflowBasicDefinitions",M.workflowAdvancedDefinitions="WorkflowAdvancedDefinitions",M.workflowAdvancedDefinitionsRules="WorkflowAdvancedDefinitionsRules",M.workflowAdvancedDefinitionsActions="WorkflowAdvancedDefinitionsActions",M.workflowGroupLevelActions="WorkflowGroupLevelActions",M.customFields="CustomFields",M.importantFields="ImportantFields",M.mandatoryFields="MandatoryFields",M.uniqueFields="UniqueFields",M.readOnlyFields="ReadOnlyFields",M.transformationCustomTemplates="TransformationCustomTemplates",M.userRoles="UserRoles",M.modulePermissions="ModulePermissions",M.columnPermissions="ColumnPermissions",M.api="API",M.gate="Gate",M.threeCXIntegration="ThreeCXIntegration",M.tapiIntegration="TapiIntegration",M.pohodaIntegration="PohodaIntegration",M.pohodaSynchronizationIntervalCustomization="PohodaSynchronizationIntervalCustomization",M.pohodaSynchronizationFieldMappingCustomization="PohodaSynchronizationFieldMappingCustomization",M.quickBooksIntegration="QuickBooksIntegration",M.saveBinaryDataOnDisk="SaveBinaryDataOnDisk",M.activeDirectoryLogin="ActiveDirectoryLogin",M.callerIdentificationOnApple="CallerIdentificationOnApple",M.legacyAdministration="LegacyAdministration";class V{}V.customAdditionalFieldsCount="CustomAdditionalFieldsCount",V.customEnabledAdvancedWorkflowsCount="CustomEnabledAdvancedWorkflowsCount",V.customEnabledBasicWorkflowsCount="CustomEnabledBasicWorkflowsCount",V.customMandatoryFieldsCount="CustomMandatoryFieldsCount",V.customOptionalFieldsCount="CustomOptionalFieldsCount",V.customReadonlyFieldsCount="CustomReadonlyFieldsCount",V.customUniqueFieldsCount="CustomUniqueFieldsCount",V.customVisibleTypesCount="CustomVisibleTypesCount",V.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"}(_||(_={}));var j=_;class B{}B.getIsDebug=e=>{var t;return!!(null===(t=null==e?void 0:e.sessionHandler.lastSuccessfulLoginResponse)||void 0===t?void 0:t.Debug)},B.supportsFeaturesOf=(e,t)=>{var r;const n=null===(r=e.sessionHandler.lastSuccessfulLoginResponse)||void 0===r?void 0:r.WcfVersion;return!!n&&B.supportsVersionFeaturesOf(n,t)},B.supportsVersionFeaturesOf=(e,t)=>n.compare(e,t,">=")||n.compare(e,"1.0.0.0","=");class W{}W.textBox="TextBox",W.comboBox="ComboBox",W.numericBox="NumericBox",W.relation="Relation",W.checkBox="CheckBox",W.linkTextBox="LinkTextBox",W.dateEdit="DateEdit",W.memoBox="MemoBox",W.multiSelectComboBox="MultiSelectComboBox",W.workflowState="WorkflowState",W.image="Image",W.multiSelectRelation="MultiSelectRelation";const H={[m.relations]:0,[m.unifiedRelations]:1,[m.users]:2,[m.groups]:3,[m.enumTypes]:4,[m.enumValues]:5,[m.additionalFields]:6};var z,Q,$,q;exports.Version=void 0,(z=exports.Version||(exports.Version={})).Version75="7.5",z.Version76="7.6",z.Version77="7.7",z.Version80="8.0",z.Version81="8.1",z.Version82="8.2",z.Version83="8.3",z.Version90="9.0",z.Version91="9.1",z.Version92="9.2",z.Version93="9.3",z.Version94="9.4",z.Version100="10.0",z.Version101="10.1";class J extends B{}J.is75OrLater=e=>B.supportsFeaturesOf(e,exports.Version.Version75),J.is76OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version76),J.is77OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version77),J.is80OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version80),J.is81OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version81),J.is82OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version82),J.is83OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version83),J.is90OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version90),J.is91OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version91),J.is92OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version92),J.is93OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version93),J.is94OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version94),J.is100OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version100),J.is101OrLater=e=>J.supportsFeaturesOf(e,exports.Version.Version101),J.isFeatureSupported=(e,t)=>J.supportsFeaturesOf(e,t);class X{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 K{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]}}}K.column=e=>({__type:"Column:#EQ",Source:X.mainTable(),Name:e}),K.multiSelectComboColumnLegacy=(e,t,r)=>({__type:"Column:#EQ",Source:X.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues]({0}, '${e}', '${t}')`,Alias:null!=r?r:e}),K.multiSelectComboColumn=(e,t,r,n,o)=>{if(!J.is77OrLater(e))return K.multiSelectComboColumnLegacy(r,n,o);return{__type:"Column:#EQ",Source:X.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues_WithObjectTypeID]({0}, dbo.GetObjectTypeID('${t}'), '${r}', '${n}')`,Alias:null!=o?o:r}},K.joinColumn=(e,t,r,n,o)=>K.joinColumnFromKey(e,K.column(t),r,n,o),K.joinColumnFromKey=(e,t,r,n,o)=>{const s={__type:"Column:#EQ",Source:X.join(e,t,o),Name:r};return n&&(s.Alias=n),s},K.singleVariatedColumn=(e,t,r)=>K.variatedColumn([K.columnVariation(e,t)],r),K.variatedColumn=(e,t)=>{const r={__type:"VariatedColumn:#EQ",Source:X.mainTable(),Variations:e};return t&&(r.Alias=t),r},K.columnVariation=(e,t,r)=>{const n={FolderName:t,Field:{__type:"Column:#EQ",Source:X.mainTable(),Name:e}};return r&&(n.Field.Transformation=r),n},K.joinColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:X.join(t,K.column(r)),Name:n}}),K.relationColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:X.relation(r,t,1),Name:n}}),K.relatedColumn=(e,t,r,n)=>{const o={__type:"Column:#EQ",Source:X.relation(t,e,1),Name:r};return n&&(o.Alias=n),o},K.relatedSubstituableColumn=(e,t,r,n,o)=>{const s={__type:"SubstituableColumn:#EQ",Source:X.relation(t,e,1),Name:r,Substitute:n};return o&&(s.Alias=o),s},K.relatedColumnFolderNameToken=(e,t,r)=>({__type:"Token:#EQ",Source:X.relation(t,e,1),TypeName:"ItemType",Alias:r}),K.hubRelationColumn=(e,t)=>({__type:"Column:#EQ",Source:X.hubRelation(t),Name:e}),K.aggregateColumn=(e,t,r)=>({__type:"AggregateColumn:#EQ",FunctionName:e,Source:t.Source,AggregatedField:t,Alias:r}),K.folderNameToken=e=>({__type:"Token:#EQ",Source:X.mainTable(),TypeName:"ItemType",Alias:null!=e?e:"FolderName"}),K.equalsFilterExpression=(e,t)=>({__type:"EqualsFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.notEqualsExpression=(e,t)=>({__type:"NotFilterExpression:#EQ",Child:K.equalsFilterExpression(e,t)}),K.andFilterExpression=e=>({__type:"AndFilterExpressionOperator:#EQ",Children:e}),K.orFilterExpression=e=>({__type:"OrFilterExpressionOperator:#EQ",Children:e}),K.lessFilterExpression=(e,t)=>({__type:"LessFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.lessOrEqualFilterExpression=(e,t)=>({__type:"LessOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.greaterFilterExpression=(e,t)=>({__type:"GreaterFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.greaterOrEqualFilterExpression=(e,t)=>({__type:"GreaterOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.likeFilterExpression=(e,t)=>({__type:"LikeFilterExpressionPredicate:#EQ",Field:e,Value:`%${t}%`}),K.inFilterExpression=(e,t)=>({__type:"InFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.relatedToExpression=(e,t)=>({__type:"RelatedToFilterExpressionPredicate:#EQ",Value:e,RelationType:t}),K.isNullOrEmptyFilterExpression=e=>K.orFilterExpression([K.equalsFilterExpression(K.column(e),null),K.equalsFilterExpression(K.column(e),"")]);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(o,s){function i(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(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),exports.TransformItemFormats=void 0,(Q=exports.TransformItemFormats||(exports.TransformItemFormats={})).OpenXmlDocx="OpenXmlDocx",Q.Pdf="Pdf",Q.WordMlXml="WordMlXml","function"==typeof SuppressedError&&SuppressedError;exports.EnumTypeEditMode=void 0,($=exports.EnumTypeEditMode||(exports.EnumTypeEditMode={})).Readonly="Readonly",$.VisibleRankDefaultOnly="VisibleRankDefaultOnly",$.Editable="Editable",exports.ImportResult=void 0,(q=exports.ImportResult||(exports.ImportResult={})).Success="Success",q.Failure="Failed",q.FailureDuplicityFound="Failed_DuplicityFound",q.FailureItemAlreadyRemoved="Failed_ItemAlreadyRemoved",q.FailureColumnsLockedWFAction="Failed_ColumnsLocked",q.FailureItemLockedWFAction="Failed_ItemLocked",q.FailureLicenseLimitReached="Failed_LicenseLimitReached",q.FailureInssuficientModulePermission="Failed_InsufficientModulePermission",q.FailureInssuficientColumnsPermission="Failed_InsufficientColumnsPermission",c.polyfill(),exports.ApiConnectionAsNonDefaultExport=I,exports.ApiFetchClient=class{constructor(e,t,r,n,o){let s;if(this.sessionId=null,this.isAdmin=null,this.loginResponse=null,!(r||(s=C.decodeAccessToken(t),r=s.ws)))throw new Error("Failed to get web service URL from JWT");if(!(n||(s||(s=C.decodeAccessToken(t)),n=s.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=o||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 o={query:{__type:"MainTableQuery:#EQ",ItemTypes:[e],Fields:t,Paging:{Skip:0,Take:500}}};return r&&(o.query.Filter=r),n&&(o.query.Sort=n),this.callMethod("Query",o)})}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}),o=yield fetch(n);if(!o.ok)throw new Error(`Error calling method ${e}: ${o.statusText}`);const s=200===o.status?yield o.json():void 0;if(!s||"rcSuccess"!==s.ReturnCode)throw new Error(`API call failed (${null==s?void 0:s.ReturnCode}): ${null==s?void 0:s.Description}`);return s})}static getTokenData(e,t,r,n,o){return Z(this,void 0,void 0,function*(){const s=new URLSearchParams;s.append("client_id",n),s.append("client_secret",o),s.append("code",t),s.append("redirect_uri",r),s.append("grant_type","authorization_code");const i=new Request(`${e}/auth/connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s.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})}},exports.ApiMethods=p,exports.ColumnPermissionMandatoryRules=F,exports.ColumnPermissionPermissionRules=x,exports.CommonDataConnection=class{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 A("ObtainCommonDataApiAccessToken",exports.HttpMethod.get,!1,"InvalidCommonDataToken",v,e,t)}},exports.CustomizationStatsItemKeys=V,exports.DateHelper=Y,exports.EWItem=class{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 m.contacts:{const e=this.baseItem;return e.Email1Address||e.Email2Address||e.Email3Address}case m.leads:return this.baseItem.Email;case m.companies:return this.baseItem.Email;case m.users:{const e=this.baseItem;return e.Email1Address||e.Email2Address}default:return null}}getInitials(){switch(this.folderName){case m.contacts:{const e=this.baseItem;return this.getInitialsInternal(e.FirstName,e.LastName)}case m.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 m.contacts:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}case m.users:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}default:return null}}},exports.EnumTypes=d,exports.ErrorHelper=S,exports.ExpirationReason=G,exports.FieldNames=D,exports.FieldTypes=W,exports.FolderNames=m,exports.Functionality=M,exports.GlobalSettingsNames=k,exports.HttpRequestError=T,exports.LicenseKeyInvoiceSeverity=j,exports.LicenseRestrictionKeys=U,exports.OAuthHelper=C,exports.OAuthSessionHandler=P,exports.OAuthSessionHandlerBase=g,exports.ObjectTypeIds=H,exports.OpenItemLinkHelper=E,exports.QueryHelper=K,exports.RelationTypeIds=w,exports.RelationTypes=b,exports.ReturnCodes=u,exports.StringHelper=class{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}},exports.TokenizedServiceConnection=A,exports.VersionHelper=J,exports.VersionHelperBase=B,exports.default=I;
|
|
8
|
+
*/class u{}u.rcSuccess="rcSuccess",u.rcBadSession="rcBadSession",u.rcDuplicateContact="rcDuplicateContact",u.rcWebServiceMoved="rcWebServiceMoved",u.rcAccessDenied="rcAccessDenied",u.rcLoginUserNameChanged="rcLoginUserNameChanged",u.rcLicenseExpired="rcLicenseExpired",u.rcBadAccessToken="rcBadAccessToken",exports.HttpMethod=void 0,(a=exports.HttpMethod||(exports.HttpMethod={})).get="get",a.post="post";class d{}d.absence="Absence",d.bonusType="BonusType",d.busyStatus="BusyStatus",d.cartType="CartType",d.companyType="CompanyType",d.contactType="ContactType",d.countryCode="CountryCode",d.currency="Currency",d.customFieldCategory="CustomFieldCategory",d.dayType="DayType",d.documentOfflineState="DocumentOfflineState",d.documentType="DocumentType",d.emailCampaignWorkflowStatus="EmailCampaignWorkflowStatus",d.emailOfflineState="EmailOfflineState",d.emailType="EmailType",d.familyStatus="FamilyStatus",d.firstContact="FirstContact",d.globalSettingsCategory="GlobalSettingsCategory",d.goalType="GoalType",d.groupColor="GroupColor",d.importance="Importance",d.journalType="JournalType",d.knowledgeLevel="KnowledgeLevel",d.knowledgeTitle="KnowledgeTitle",d.knowledgeType="KnowledgeType",d.leadType="LeadType",d.marketingType="MarketingType",d.paymentType="PaymentType",d.prefixType="PrefixType",d.productType="ProductType",d.projectOrigin="ProjectOrigin",d.projectType="ProjectType",d.reportCategory="ReportCategory",d.responseForm="ResponseForm",d.responseType="ResponseType",d.salaryDate="SalaryDate",d.salaryType="SalaryType",d.salePriceType="SalePriceType",d.sentimentTone="SentimentTone",d.suffixType="SuffixType",d.taskImportance="TaskImportance",d.tasksSnoozePeriod="TasksSnoozePeriod",d.taskStatus="TaskStatus",d.taskType="TaskType",d.trainingGrade="TrainingGrade",d.trainingTitle="TrainingTitle",d.translations="Translations",d.units="Units",d.userType="UserType",d.usStatesDistrictsTerritories="USStatesDistrictsTerritories",d.vacationType="VacationType",d.vat="VAT",d.workLoad="WorkLoad",d.workReportType="WorkReportType";class m{}m.isValidFolderName=e=>Object.values(m).includes(e),m.actions="Actions",m.additionalFields="AdditionalFields",m.bonuses="Bonuses",m.calendar="Calendar",m.capacityNotes="CapacityNotes",m.capacityNoteTypes="CapacityNoteTypes",m.carts="Carts",m.columnPermissions="ColumnPermissions",m.companies="Companies",m.contacts="Contacts",m.contactsSuggestions="ContactsSuggestions",m.currencyExchangeRates="CurrencyExchangeRates",m.documents="Documents",m.emails="Emails",m.enumTypes="EnumTypes",m.enumValues="EnumValues",m.enumValuesRelations="EnumValuesRelations",m.features="Features",m.flows="Flows",m.globalSettings="GlobalSettings",m.goals="Goals",m.goods="Goods",m.goodsInCart="GoodsInCart",m.goodsInSet="GoodsInSet",m.groups="Groups",m.history="History",m.holidays="Holidays",m.children="Children",m.individualDiscounts="IndividualDiscounts",m.invoiceItems="InvoiceItems",m.invoices="Invoices",m.itemCopyRelations="ItemCopyRelations",m.journal="Journal",m.knowledge="Knowledge",m.layouts="Layouts",m.layoutsModels="LayoutsModels",m.leads="Leads",m.ledger="Ledger",m.mappings="Mappings",m.marketing="Marketing",m.marketingList="MarketingList",m.marketingListSources="MarketingListSources",m.models="Models",m.modulePermissions="ModulePermissions",m.objectTypesOptions="ObjectTypesOptions",m.payments="Payments",m.priceListGroups="PriceListGroups",m.projectAssignments="ProjectAssignments",m.projectAssignmentsPerUserProject="ProjectAssignmentsPerUserProject",m.projectAssignmentsTotal="ProjectAssignmentsTotal",m.projectAssignmentsTotalUserProject="ProjectAssignmentsTotalUserProject",m.projectList="ProjectList",m.projects="Projects",m.projectUsersInCaPlan="ProjectUsersInCaPlan",m.relationData="RelationData",m.relations="Relations",m.reports="Reports",m.revisionsHistory="RevisionsHistory",m.salaries="Salaries",m.salePrices="SalePrices",m.prices="Prices",m.sqlObjects="SqlObjects",m.tasks="Tasks",m.recurrencePatterns="RecurrencePatterns",m.teamRoles="TeamRoles",m.templates="Templates",m.training="Training",m.unifiedRelations="UnifiedRelations",m.users="Users",m.userSettings="UserSettings",m.vacation="Vacation",m.webAccess2Options="WebAccess2Options",m.webAccessOptions="WebAccessOptions",m.workCommitments="WorkCommitments",m.workflowHistory="WorkflowHistory",m.workReports="WorkReports",m.wrongClientVersions="WrongClientVersions",m.xsltTransformations="XsltTransformations",m.xsltTransformationsModels="XsltTransformationsModels",m.getEnumTypeName=e=>e===m.bonuses?d.bonusType:e===m.carts?d.cartType:e===m.companies?d.companyType:e===m.contacts?d.contactType:e===m.documents?d.documentType:e===m.emails?d.emailType:e===m.goals?d.goalType:e===m.goods?d.productType:e===m.journal?d.journalType:e===m.knowledge?d.knowledgeType:e===m.leads?d.leadType:e===m.marketing?d.marketingType:e===m.projects?d.projectType:e===m.salaries?d.salaryType:e===m.salePrices?d.salePriceType:e===m.tasks?d.taskType:e===m.training?d.trainingTitle:e===m.users?d.userType:e===m.vacation?d.vacationType:e===m.workReports?d.workReportType:null,m.getFolderNameByEnumTypeName=e=>e===d.bonusType?m.bonuses:e===d.cartType?m.carts:e===d.companyType?m.companies:e===d.contactType?m.contacts:e===d.documentType?m.documents:e===d.emailType?m.emails:e===d.goalType?m.goals:e===d.journalType?m.journal:e===d.knowledgeType?m.knowledge:e===d.leadType?m.leads:e===d.marketingType?m.marketing:e===d.productType?m.goods:e===d.projectType?m.projects:e===d.salaryType?m.salaries:e===d.salePriceType?m.salePrices:e===d.taskType?m.tasks:e===d.trainingTitle?m.training:e===d.userType?m.users:e===d.vacationType?m.vacation:e===d.workReportType?m.workReports:null;class p{}p.getAllEmailAttachments="GetAllEmailAttachments",p.getCalendarsByItemGuids="GetCalendarsByItemGuids",p.getEmailAttachment="GetEmailAttachment",p.getItemPreview="GetItemPreview",p.getJournalsByItemGuids="GetJournalsByItemGuids",p.getMarketingCampaignsByItemGuids="GetMarketingCampaignsByItemGuids",p.getMarketingListsRecordsByItemGuids="GetMarketingListsRecordsByItemGuids",p.getRevisionHistoryRecordsByItemGuids="GetRevisionHistoryRecordsByItemGuids",p.getVacationsByItemGuids="GetVacationsByItemGuids",p.getWorkflowHistoryRecordsByItemGuids="GetWorkflowHistoryRecordsByItemGuids",p.getCompanyInformationFromTaxRegister="GetCompanyInformationFromTaxRegister",p.logIn="LogIn",p.logOut="LogOut",p.query="Query",p.queryAmount="QueryAmount",p.getServiceAuthSettings="GetServiceAuthSettings",p.getVersion="GetVersion",p.getBinaryAttachment="GetBinaryAttachment",p.getBinaryAttachmentLatestRevision="GetBinaryAttachmentLatestRevision",p.transformItem="TransformItem",p.canUnlinkItems="CanUnlinkItems",p.unlinkItems="UnlinkItems",p.getGoodsFinalPrices="GetGoodsFinalPrices",p.saveItemCopyRelation="SaveItemCopyRelation",p.getXsltTransormationDefinition="GetXsltTransformationDefinition",p.saveBinaryAttachment="SaveBinaryAttachment",p.saveBinaryXsltTransformation="SaveBinaryXsltTransformation",p.GetLoginHistory="GetLoginHistory",p.GetMyLoginHistory="GetMyLoginHistory",p.getFolderNameForApiMethod=e=>{switch(e){case m.calendar:return"Calendars";case m.journal:return"Journals";case m.marketing:return"MarketingCampaigns";case m.marketingList:return"MarketingListsRecords";case m.revisionsHistory:return"RevisionHistoryRecords";case m.vacation:return"Vacations";case m.workflowHistory:return"WorkflowHistoryRecords";default:return e}},p.getGetFolderNameByItemGuidsMethodName=e=>`Get${p.getFolderNameForApiMethod(e)}ByItemGuids`,p.getGetFolderNameMethodName=e=>`Get${p.getFolderNameForApiMethod(e)}`,p.getSearchFolderNameMethodName=e=>`Search${p.getFolderNameForApiMethod(e)}`;class h{constructor(e,t,r,n,o,s){if(this.invalidateSessionId=(e,t)=>{t&&t()},this.getSessionId=(e,t)=>{e.callWithoutSession(p.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=o,this.errorCallback=s}}class y{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 C{static createAuthorizeUrl(e,t,r,n,o,s,i=!1,a){if(o&&!s||!o&&s)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)}`),o&&s&&(l+=`&code_challenge=${encodeURIComponent(o)}&code_challenge_method=${encodeURIComponent(s)}`),a&&(l+=`&url=${encodeURIComponent(a)}`),l}}C.finishAuthorization=(e,t,r,n,o,s,i)=>{const a=new URLSearchParams;a.append("code_verifier",n),a.append("client_id",t),a.append("client_secret",r),a.append("code",o),a.append("redirect_uri",s),a.append("grant_type","authorization_code"),C.callTokenEndpoint(e,a,i)},C.refreshToken=(e,t,r,n,o)=>{const s=new URLSearchParams;s.append("client_id",t),s.append("client_secret",r),s.append("refresh_token",n),s.append("grant_type","refresh_token"),C.callTokenEndpoint(e,s,o)},C.getWebServiceUrl=e=>{const t=e.split(".");if(2!==t.length)throw new Error("Invalid token supplied");return s.decode(t[1])},C.getUserName=e=>C.decodeAccessToken(e).username,C.decodeAccessToken=e=>r(e),C.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 f extends Error{constructor(e,t){super(),this.returnCode=e,this.message=t}}class g{constructor(e,t,r,n,o){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=o}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(p.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 f(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 P extends g{constructor(e,t,r,n,o,s,i,a){if(!(e&&n&&t&&r))throw new Error("Non of the arguments 'username', 'clientId', 'clientSecret', 'refreshToken' can be empty.");super(e,o,s,(e,t)=>{C.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 T extends Error{constructor(e,t,r){super(t),this.statusCode=e,this.message=t,this.responseData=r}}T.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 T(e.status,n,e.data)};class S{}S.stringifyError=e=>JSON.stringify(e,S.replaceErrors),S.replaceErrors=(e,t)=>{if(t instanceof Error){const e={};return Object.getOwnPropertyNames(t).forEach(r=>{e[r]=t[r]}),e}return t};class E{}E.openItemLinkRegEx=/https:\/\/open\.eway-crm\.(dev|com)\/\?[-a-zA-Z0-9()@:%_+.~#?&/=]*/gi,E.itemParamName="l",E.openLinkDomainLength=7,E.getOpenLinkDomain=e=>e?"open.eway-crm.dev":"open.eway-crm.com",E.isOpenItemLinkInText=e=>E.openItemLinkRegEx.test(e),E.getOpenLinksFromString=e=>e.match(E.openItemLinkRegEx),E.getItemLinksFromOpenLinks=e=>{try{return e.map(e=>new URL(e).searchParams.get(E.itemParamName))}catch(e){console.error("Invalid string passed for cretaing url while getting links from open links",e)}},E.getItemInfoFromLink=e=>{const t=s.decode(e).substring(E.openLinkDomainLength).split("/");if(Object.keys(m).some(e=>m[e]===t[0])&&t[1]){return{folderName:t[0],itemGuid:t[1]}}},E.getAllItemsFromTextWithLinks=e=>{const t={};if(E.isOpenItemLinkInText(e)){const r=E.getOpenLinksFromString(e);if(!r)return;const n=E.getItemLinksFromOpenLinks(r);null==n||n.forEach(e=>{var r;if(!e)return;const n=E.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 I{constructor(t,r,n,o){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,t,r,n)=>{const o=s.encode(this.baseUri);let i="eway://"+t;r&&(i+="/"+(null==r?void 0:r.toLowerCase()));const a=E.getOpenLinkDomain(e);i=s.encode(i);let l="https://"+a+"/?ws="+o+`&${E.itemParamName}=`+i;return n&&(l+="&n="+encodeURIComponent(n)),l},this.askCustomUploadMethod=(e,t,r,n,o)=>new Promise((s,i)=>{const a=o?e=>{throw i(e),e}:i;this.callCustomUploadMethod(e,t,r,s,a,a,n)}),this.askUploadMethod=(e,t,r,n,o)=>new Promise((s,i)=>{const a=o?e=>{throw i(e),e}:i;this.callUploadMethod(e,t,r,s,a,a,n)}),this.callCustomUploadMethod=(t,r,n,o,s,i,a)=>{const l=()=>{this.sessionHandler.getSessionId(this,e=>{this.sessionId=e,this.callCustomUploadMethod(t,r,n,o,s,i,a)})},c=this.sessionId;if(!c)return void l();const d=new URLSearchParams(r),m=`${this.svcUri}/${n}?sessionId=${this.sessionId}&${d.toString()}`,p=e.post(m,t,a);I.handleCallPromise(p,o,e=>{if(e.ReturnCode===u.rcBadSession)return this.sessionId=null,void this.sessionHandler.invalidateSessionId(c,l);if(s)s(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+": "+S.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,o,s,i)=>{this.callCustomUploadMethod(r,{itemGuid:e,fileName:t},p.saveBinaryAttachment,n,o,s,i)},this.askMethod=(e,t,r,n)=>new Promise((o,s)=>{const i=n?e=>{throw s(e),e}:s;this.callMethod(e,t,o,i,r,i)}),this.callMethod=(e,t,r,n,o,s)=>{o||(o=exports.HttpMethod.post);const i=()=>{this.sessionHandler.getSessionId(this,i=>{this.sessionId=i,this.callMethod(e,t,r,n,o,s)})},a=this.sessionId;if(!a)return void i();t.sessionId=a;const l=e!==p.logOut?r:e=>{this.sessionId=null,r(e)};this.callWithoutSession(e,t,l,r=>{if(r.ReturnCode!==u.rcBadSession||(this.sessionId=null,e===p.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(a,i)},null,o,s)},this.callWithoutSession=(t,r,n,o,s,i,a)=>{var l;i||(i=exports.HttpMethod.post);const c=this.svcUri+"/"+t;let u,d;switch(s&&(u={headers:s,withCredentials:null!==(l=this.supportGetItemPreviewMethod)&&void 0!==l?l:t===p.logIn}),i){case exports.HttpMethod.get:if(r)throw new Error("Calling api get method with data specified does not make any sense.");d=e.get(c,u);break;case exports.HttpMethod.post:d=e.post(c,r,u);break;default:throw new Error(`Unknown http method '${i}'.`)}I.handleCallPromise(d,n,o,e=>{if(a)try{a(e)}catch(e){if(!this.errorCallback)throw e;this.errorCallback(e,r)}else{const t=new Error("Unhandled connection error when calling "+c+": "+S.stringifyError(e));if(!this.errorCallback)throw t;this.errorCallback(t,r)}})},this.getItemPreviewGetMethodUrl=(e,t,r)=>this.svcUri+"/"+p.getItemPreview+"?folderName="+encodeURIComponent(e)+"&itemGuid="+encodeURIComponent(t)+(r||0===r?"&itemVersion="+encodeURIComponent(r.toString()):""),this.getEmailAttachmentGetMethodUrl=(e,t)=>this.svcUri+"/"+p.getEmailAttachment+"?itemGuid="+encodeURIComponent(e)+"&contentId="+encodeURIComponent(t),this.getAllEmailAttachmentsZipGetMethodUrl=e=>this.svcUri+"/"+p.getAllEmailAttachments+"?itemGuid="+encodeURIComponent(e),this.getBinaryAttachmentGetMethodUrl=(e,t)=>"number"==typeof t?this.svcUri+"/"+p.getBinaryAttachment+"?itemGuid="+encodeURIComponent(e)+`&revision=${t}`:this.svcUri+"/"+p.getBinaryAttachmentLatestRevision+"?itemGuid="+encodeURIComponent(e),this.getTransformItemMethodUrl=(e,t,r,n,o)=>`${this.svcUri}/${p.transformItem}?itemGuid=${encodeURIComponent(e)}&itemFolderName=${encodeURIComponent(t)}&transformationGuid=${encodeURIComponent(r)}&outputFormat=${n}${o?`&lang=${encodeURIComponent(o)}`:""}`,this.getXsltTransformationDefinitionMethodUrl=e=>`${this.svcUri}/${p.getXsltTransormationDefinition}?itemGuid=${encodeURIComponent(e)}`,this.getActiveSessionId=()=>this.sessionId,this.setActiveSessionId=e=>{this.sessionId=e},!t)throw new Error("The argument 'apiServiceUri' cannot be empty.");if(t.length<8||"https://"!==t.substr(0,8).toLowerCase()&&"http://"!==t.substr(0,7).toLowerCase())throw new Error("Api service uri must start either with 'https://' or with 'http://'.");if(".svc"===t.substr(t.length-4).toLowerCase()){this.svcUri=t;const e=["/API.svc","/InsecureAPI.svc","/WcfService/Service.svc"].find(e=>e.toLowerCase()===t.substr(t.length-e.length).toLowerCase())||"";this.baseUri=t.substr(0,t.length-e.length)}else this.baseUri=I.normalizeWsUrl(t)||t,"https://"===t.substr(0,8).toLowerCase()?this.svcUri=this.baseUri+"/API.svc":this.svcUri=this.baseUri+"/InsecureAPI.svc";this.sessionHandler=r,this.errorCallback=n,this.sessionId=null,this.supportGetItemPreviewMethod=null!=o&&o}get supportsGetItemPreviewMethod(){return this.supportGetItemPreviewMethod}static create(e,t,r,n,o,s,i,a){return new I(e,new h(t,r,n,o,s,i),i,a)}static createAnonymous(e,t){return new I(e,new y,t)}static createUsingOAuth(e,t,r,n,o,s,i,a,l,c){return new I(e,new P(t,r,n,o,s,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(I.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===u.rcSuccess?t(e.data):r(e.data):n(T.from(e))}).catch(e=>{e.response?n(T.from(e.response)):n(e)})}}class v{constructor(e,t,r,n,o,s,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((o,s)=>{t.token=s,v.call(o,e,t,r,o=>{if(o.ReturnCodeString!==this.invalidTokenReturnCode){if(n)n(o);else if(this.generalErrorCallback){const e=new Error("Unhandled tokenized service connection return code "+o.ReturnCodeString+".\nDescription: "+o.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=o,this.connection=s,this.generalErrorCallback=i||null,this.url=null,this.token=null,this.isActive=!0}static call(t,r,n,o,s,i){const a=t+"/"+r;e.post(a,n).then(e=>{200===e.status?"Success"===e.data.ReturnCodeString?o(e.data):s(e.data):i(T.from(e))}).catch(e=>{e.response?i(T.from(e.response)):i(e)})}}const A=e=>({url:e.ServiceUrl,token:e.Token});class k{}k.acceptableBackwardWorkReportDays="AcceptableBackwardWorkReportDays",k.adminAppInactiveLogoutTime="AdminAppInactiveLogoutTime",k.allowChangeGoodsInCartListPrice="AllowChangeGoodsInCartListPrice",k.applyGeneralDataProtectionRules="ApplyGeneralDataProtectionRules",k.automaticallyCreateJournalAfterCallDuration="AutomaticallyCreateJournalAfterCallDuration",k.bonusesCompletedState="BonusesCompletedState",k.cartInvoicedState="CartInvoicedState",k.cartOrderCanceledState="CartOrderCanceledState",k.cartOrderInProcessState="CartOrderInProcessState",k.cartOrderProcessedState="CartOrderProcessedState",k.cartPaidState="CartPaidState",k.cartProposalInProcessState="CartProposalInProcessState",k.cartProposalProcessedState="CartProposalProcessedState",k.cartSalesVoucherIssuedState="CartSalesVoucherIssuedState",k.cartToBeInvoicedState="CartToBeInvoicedState",k.cartVoidedState="CartVoidedState",k.clickToCallScheme="ClickToCallScheme",k.companyDuplicityCheckEnabled="CompanyDuplicityCheckEnabled",k.completedStateName="CompletedStateName",k.contactDuplicityCheckEnabled="ContactDuplicityCheckEnabled",k.createCompanyWhileImportingContactFromOutlook="CreateCompanyWhileImportingContactFromOutlook",k.defaultProposalValidityPeriod="DefaultProposalValidityPeriod",k.enableContactsTwoWaySyncWithM365="EnableContactsTwoWaySyncWithM365",k.deadStateName="DeadStateName",k.enableCompaniesSyncIntoMobileDeviceContacts="EnableCompaniesSyncIntoMobileDeviceContacts",k.enableContactsSyncIntoMobileDevice="EnableContactsSyncIntoMobileDevice",k.enableLeadsSyncIntoMobileDeviceContacts="EnableLeadsSyncIntoMobileDeviceContacts",k.enableLlamaAiFeatures="EnableLlamaAiFeatures",k.enableUsersSyncIntoMobileDeviceContacts="EnableUsersSyncIntoMobileDeviceContacts",k.emailsActiveProjectsLeadsFilter="EmailsActiveProjectsLeadsFilter",k.trackToAddressesOnly="TrackToAddressesOnly",k.exchangeRatesAdminGroupName="ExchangeRatesAdminGroupName",k.forcedEmailTrackingGroups="ForcedEmailTrackingGroups",k.ignoreEmailsFromDomainsOnEmailsTracking="IgnoreEmailsFromDomainsOnEmailsTracking",k.trackEmailsFromDomains="TrackEmailsFromDomains",k.groupsForAllUnpaidInvoicesNotification="GroupsForAllUnpaidInvoicesNotification",k.itemPreviewMaxHeight="ItemPreviewMaxHeight",k.lastActivityAttributes="LastActivityAttributes",k.leadsCompletedState="LeadsCompletedState",k.leadDeadlineAlertGroups="LeadDeadlineAlertGroups",k.leadsDeadState="LeadsDeadState",k.marketingCompletedState="MarketingCompletedState",k.marketingDeadState="MarketingDeadState",k.minimumPasswordLength="MinimumPasswordLength",k.nextStepAttributes="NextStepAttributes",k.notifyAboutInvoicedInvoiceInPohodaGroup="NotifyAboutInvoicedInvoiceInPohodaGroup",k.notifyAboutLeadsDeadline="NotifyAboutLeadsDeadline",k.notifyAboutPaidInvoiceInPohodaGroup="NotifyAboutPaidInvoiceInPohodaGroup",k.notifyAboutProjectDeadline="NotifyAboutProjectDeadline",k.numberOfDecimalPlaces="NumberOfDecimalPlaces",k.phoneListTaskSolverGroup="PhoneListTaskSolverGroup",k.projectDeadlineAlert="ProjectDeadlineAlert",k.serverUpdateProgressNotificationGroup="ServerUpdateProgressNotificationGroup",k.sumarizeCartsPricesOnLeads="SumarizeCartsPricesOnLeads",k.sumarizeCartsPricesOnProjects="SumarizeCartsPricesOnProjects",k.sumarizePeopleExpensesOnProjects="SumarizePeopleExpensesOnProjects",k.systemHealthNotificationGroup="SystemHealthNotificationGroup",k.tasksCompletedState="TasksCompletedState",k.tasksDeferredState="TasksDeferredState",k.tasksInProgressState="TasksInProgressState",k.tasksNotStartedState="TasksNotStartedState",k.tasksWaitOnSomeoneElseState="TasksWaitOnSomeoneElseState",k.trackDocumentVersions="TrackDocumentVersions",k.vacationCompletedState="VacationCompletedState",k.workReportApprovedState="WorkReportApprovedState",k.defaultLanguage="DefaultLanguage",k.defaultCurrency="DefaultCurrency",k.myCompanyCountry="MyCompanyCountry",k.myCompanyName="MyCompanyName",k.myCompanyStreet="MyCompanyStreet",k.myCompanyCity="MyCompanyCity",k.myCompanyState="MyCompanyState",k.myCompanyZip="MyCompanyZIP",k.myCompanyId="MyCompanyID",k.myCompanyVat="MyCompanyVAT",k.mergeGoodsInCart="MergeGoodsInCart",k.cartRefreshLogic="CartRefreshLogic",k.goodsDefaultQuantity="GoodsDefaultQuantity",k.goodsDefaultVAT="GoodsDefaultVAT",k.goodsDefaultVATIncluded="GoodsDefaultVATIncluded",k.recalculateOnListPriceChange="RecalculateOnListPriceChange",k.recalculateOnPurchasePriceChange="RecalculateOnPurchasePriceChange";class D{}D.ServerCommon={Server_ID:"Server_ID",Server_ItemCreated:"Server_ItemCreated",Server_ItemChanged:"Server_ItemChanged"},D.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"},D.Calendar={Location:"Location",StartDate:"StartDate",EndDate:"EndDate",AllDayEvent:"AllDayEvent",SuperiorItem:"SuperiorItem",BusyStatus:"BusyStatus",GraphID:"GraphID",GraphCalendarID:"GraphCalendarID",Note:"Note"},D.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"},D.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"},D.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"},D.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:D.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"},D.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"},D.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"},D.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"},D.Goods=Object.assign(Object.assign({},D.GoodsBase),{PriceListGroupGUID:"PriceListGroupGUID",InventoryQuantity:"InventoryQuantity"}),D.GoodsInCart=Object.assign(Object.assign({},D.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"}),D.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"},D.Vacation={StartDate:"StartDate",EndDate:"EndDate",User:"User",Duration:"Duration",Place:"Place",Note:"Note",AllDay:"AllDay",TypeEn:"TypeEn",StateEn:"StateEn",IsPrivate:"Private"},D.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"},D.Projects={HumanID:"HID",FileAs:"FileAs",ProjectName:"ProjectName",ProjectOriginEn:"ProjectOriginEn",TypeEn:"TypeEn",StateEn:"StateEn",PaymentTypeEn:"PaymentTypeEn",ProjectStart:"ProjectStart",ProjectRealEnd:"ProjectRealEnd",EstimatedEnd:"ProjectEnd",CurrencyEn:D.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"},D.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"},D.Training={TitleEn:"TitleEn"},D.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"},D.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"},D.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"},D.PriceListGroups={Note:"Note"},D.Prices={SalePriceGUID:"SalePriceGUID",GoodsItemGUID:"GoodsItemGUID",Price:"Price",CurrencyEn:"CurrencyEn"},D.SalePrices={Note:"Note",Discount:"Discount",TypeEn:"TypeEn",StateEn:"StateEn",PrevStateEn:"PrevStateEn"},D.XsltTransformations={LangCode:"LangCode",Definition:"Definition",Namespace:"Namespace",ObjectTypeID:"ObjectTypeID",TransformationVersion:"TransformationVersion"},D.XsltTransformationsModels={ObjectTypeID:"ObjectTypeID",TransformationGUID:"TransformationGUID",ItemTypeGUID:"ItemTypeGUID"},D.allTypeEnNames=["TypeEn",D.Documents.DocTypeEn,D.WorkReports.WorkReportEn,"TitleEn"],D.getFolderFileAs=e=>{switch(e){case m.leads:return D.Leads.FileAs;case m.projects:return D.Projects.ProjectName;case m.documents:return D.Documents.DocName;case m.companies:return D.Companies.CompanyName;case m.contacts:case m.users:return D.Common.FileAs;case m.emails:return D.Emails.Subject;case m.journal:return D.Journal.FileAs;case m.tasks:return D.Tasks.Subject;case m.workReports:return D.WorkReports.Subject;case m.vacation:return D.Vacation.TypeEn;case m.carts:case m.goods:case m.goodsInCart:return D.Common.FileAs;case m.groups:return D.Groups.GroupName;case m.xsltTransformations:return D.Common.FileAs;default:return console.warn(`FileAs col name not defined for folderName ${e}`),D.Common.FileAs}};class b{}b.general="GENERAL",b.group="GROUP",b.contactPerson="CONTACTPERSON",b.contact="CONTACT",b.customer="CUSTOMER",b.company="COMPANY",b.outlookProject="OUTLOOKPROJECT",b.supervisor="SUPERVISOR",b.projectOrigin="PROJECT_ORIGIN",b.cart="CART",b.goodsInCart="GOODSINCART",b.superiorItem="SUPERIORITEM",b.taskParent="TASKPARENT";class w{}w.general=1,w.group=2,w.contactPerson=10,w.contact=11,w.customer=12,w.company=13,w.outlookProject=28,w.supervisor=32,w.projectOrigin=25,w.cart=9,w.goodsInCart=15,w.superiorItem=31,w.taskParent=38;class x{}x.all="All",x.own="Own",x.readonly="Readonly",x.invisible="Invisible",x.none="None";class F{}var O,N,R,L;F.mandatory="Mandatory",F.optional="Optional",F.unique="Unique",F.none="None",exports.Edition=void 0,(O=exports.Edition||(exports.Edition={})).Free="Free",O.Basic="Basic",O.Professional="Professional",O.Enterprise="Enterprise",exports.Feature=void 0,(N=exports.Feature||(exports.Feature={})).ContactsAndCompanies="ContactsAndCompanies",N.Sales="Sales",N.Projects="Projects",N.Marketing="Marketing",exports.SentimentTone=void 0,(R=exports.SentimentTone||(exports.SentimentTone={}))[R.Negative=0]="Negative",R[R.Neutral=1]="Neutral",R[R.Positive=2]="Positive";class M{}M.contactsSynchronizationWithOutlook="ContactsSynchronizationWithOutlook",M.wordAddin="WordAddin",M.excelAddin="ExcelAddin",M.tasksRecurrentTasks="TasksRecurrentTasks",M.tasksSubtasks="TasksSubtasks",M.tasksSynchronizationWithOutlook="TasksSynchronizationWithOutlook",M.calendarSynchronizationWithOutlook="CalendarSynchronizationWithOutlook",M.emailsAutomaticTracking="EmailsAutomaticTracking",M.convertEmailToProject="ConvertEmailToProject",M.duplicityChecker="DuplicityChecker",M.nextStepAndLastActivityCustomization="NextStepAndLastActivityCustomization",M.subProjects="SubProjects",M.resourceAndPlanning="ResourceAndPlanning",M.professionalEmailCampaigns="ProfessionalEmailCampaigns",M.professionalEmailCampaignsAdvancedStatistics="ProfessionalEmailCampaignsAdvancedStatistics",M.wordEmailMerge="WordEmailMerge",M.printLabels="PrintLabels",M.printEnvelopes="PrintEnvelopes",M.userViews="UserViews",M.sharedUserViews="SharedUserViews",M.gridConditionalFormating="GridConditionalFormating",M.multipleCurrencies="MultipleCurrencies",M.historyTracking="HistoryTracking",M.privateItems="PrivateItems",M.itemTypes="ItemTypes",M.formLayoutCustomization="FormLayoutCustomization",M.workflowBasicDefinitions="WorkflowBasicDefinitions",M.workflowAdvancedDefinitions="WorkflowAdvancedDefinitions",M.workflowAdvancedDefinitionsRules="WorkflowAdvancedDefinitionsRules",M.workflowAdvancedDefinitionsActions="WorkflowAdvancedDefinitionsActions",M.workflowGroupLevelActions="WorkflowGroupLevelActions",M.customFields="CustomFields",M.importantFields="ImportantFields",M.mandatoryFields="MandatoryFields",M.uniqueFields="UniqueFields",M.readOnlyFields="ReadOnlyFields",M.transformationCustomTemplates="TransformationCustomTemplates",M.userRoles="UserRoles",M.modulePermissions="ModulePermissions",M.columnPermissions="ColumnPermissions",M.api="API",M.gate="Gate",M.threeCXIntegration="ThreeCXIntegration",M.tapiIntegration="TapiIntegration",M.pohodaIntegration="PohodaIntegration",M.pohodaSynchronizationIntervalCustomization="PohodaSynchronizationIntervalCustomization",M.pohodaSynchronizationFieldMappingCustomization="PohodaSynchronizationFieldMappingCustomization",M.quickBooksIntegration="QuickBooksIntegration",M.saveBinaryDataOnDisk="SaveBinaryDataOnDisk",M.activeDirectoryLogin="ActiveDirectoryLogin",M.callerIdentificationOnApple="CallerIdentificationOnApple",M.legacyAdministration="LegacyAdministration";class V{}V.customAdditionalFieldsCount="CustomAdditionalFieldsCount",V.customEnabledAdvancedWorkflowsCount="CustomEnabledAdvancedWorkflowsCount",V.customEnabledBasicWorkflowsCount="CustomEnabledBasicWorkflowsCount",V.customMandatoryFieldsCount="CustomMandatoryFieldsCount",V.customOptionalFieldsCount="CustomOptionalFieldsCount",V.customReadonlyFieldsCount="CustomReadonlyFieldsCount",V.customUniqueFieldsCount="CustomUniqueFieldsCount",V.customVisibleTypesCount="CustomVisibleTypesCount",V.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"}(_||(_={}));var j=_;class B{}B.getIsDebug=e=>{var t;return!!(null===(t=null==e?void 0:e.sessionHandler.lastSuccessfulLoginResponse)||void 0===t?void 0:t.Debug)},B.supportsFeaturesOf=(e,t)=>{var r;const n=null===(r=e.sessionHandler.lastSuccessfulLoginResponse)||void 0===r?void 0:r.WcfVersion;return!!n&&B.supportsVersionFeaturesOf(n,t)},B.supportsVersionFeaturesOf=(e,t)=>n.compare(e,t,">=")||n.compare(e,"1.0.0.0","=");class W{}W.textBox="TextBox",W.comboBox="ComboBox",W.numericBox="NumericBox",W.relation="Relation",W.checkBox="CheckBox",W.linkTextBox="LinkTextBox",W.dateEdit="DateEdit",W.memoBox="MemoBox",W.multiSelectComboBox="MultiSelectComboBox",W.workflowState="WorkflowState",W.image="Image",W.multiSelectRelation="MultiSelectRelation";const H={[m.relations]:0,[m.unifiedRelations]:1,[m.users]:2,[m.groups]:3,[m.enumTypes]:4,[m.enumValues]:5,[m.additionalFields]:6};var z,Q,$,q,J;exports.Version=void 0,(z=exports.Version||(exports.Version={})).Version75="7.5",z.Version76="7.6",z.Version77="7.7",z.Version80="8.0",z.Version81="8.1",z.Version82="8.2",z.Version83="8.3",z.Version90="9.0",z.Version91="9.1",z.Version92="9.2",z.Version93="9.3",z.Version94="9.4",z.Version100="10.0",z.Version101="10.1";class X extends B{}X.is75OrLater=e=>B.supportsFeaturesOf(e,exports.Version.Version75),X.is76OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version76),X.is77OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version77),X.is80OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version80),X.is81OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version81),X.is82OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version82),X.is83OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version83),X.is90OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version90),X.is91OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version91),X.is92OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version92),X.is93OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version93),X.is94OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version94),X.is100OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version100),X.is101OrLater=e=>X.supportsFeaturesOf(e,exports.Version.Version101),X.isFeatureSupported=(e,t)=>X.supportsFeaturesOf(e,t);class K{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!==t&&(n.IsToParentDirection=t),r&&(n.ChildrenFolderNames=r),n}}class Y{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]}}}Y.column=e=>({__type:"Column:#EQ",Source:K.mainTable(),Name:e}),Y.multiSelectComboColumnLegacy=(e,t,r)=>({__type:"Column:#EQ",Source:K.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues]({0}, '${e}', '${t}')`,Alias:null!=r?r:e}),Y.multiSelectComboColumn=(e,t,r,n,o)=>{if(!X.is77OrLater(e))return Y.multiSelectComboColumnLegacy(r,n,o);return{__type:"Column:#EQ",Source:K.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues_WithObjectTypeID]({0}, dbo.GetObjectTypeID('${t}'), '${r}', '${n}')`,Alias:null!=o?o:r}},Y.joinColumn=(e,t,r,n,o)=>Y.joinColumnFromKey(e,Y.column(t),r,n,o),Y.joinColumnFromKey=(e,t,r,n,o)=>{const s={__type:"Column:#EQ",Source:K.join(e,t,o),Name:r};return n&&(s.Alias=n),s},Y.singleVariatedColumn=(e,t,r)=>Y.variatedColumn([Y.columnVariation(e,t)],r),Y.variatedColumn=(e,t)=>{const r={__type:"VariatedColumn:#EQ",Source:K.mainTable(),Variations:e};return t&&(r.Alias=t),r},Y.columnVariation=(e,t,r)=>{const n={FolderName:t,Field:{__type:"Column:#EQ",Source:K.mainTable(),Name:e}};return r&&(n.Field.Transformation=r),n},Y.joinColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:K.join(t,Y.column(r)),Name:n}}),Y.relationColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:K.relation(r,t,1),Name:n}}),Y.relatedColumn=(e,t,r,n)=>{const o={__type:"Column:#EQ",Source:K.relation(t,e,1),Name:r};return n&&(o.Alias=n),o},Y.relatedSubstituableColumn=(e,t,r,n,o)=>{const s={__type:"SubstituableColumn:#EQ",Source:K.relation(t,e,1),Name:r,Substitute:n};return o&&(s.Alias=o),s},Y.relatedColumnFolderNameToken=(e,t,r)=>({__type:"Token:#EQ",Source:K.relation(t,e,1),TypeName:"ItemType",Alias:r}),Y.hubRelationColumn=(e,t)=>({__type:"Column:#EQ",Source:K.hubRelation(t),Name:e}),Y.aggregateColumn=(e,t,r)=>({__type:"AggregateColumn:#EQ",FunctionName:e,Source:t.Source,AggregatedField:t,Alias:r}),Y.folderNameToken=e=>({__type:"Token:#EQ",Source:K.mainTable(),TypeName:"ItemType",Alias:null!=e?e:"FolderName"}),Y.equalsFilterExpression=(e,t)=>({__type:"EqualsFilterExpressionPredicate:#EQ",Field:e,Value:t}),Y.notEqualsExpression=(e,t)=>({__type:"NotFilterExpression:#EQ",Child:Y.equalsFilterExpression(e,t)}),Y.andFilterExpression=e=>({__type:"AndFilterExpressionOperator:#EQ",Children:e}),Y.orFilterExpression=e=>({__type:"OrFilterExpressionOperator:#EQ",Children:e}),Y.lessFilterExpression=(e,t)=>({__type:"LessFilterExpressionPredicate:#EQ",Field:e,Value:t}),Y.lessOrEqualFilterExpression=(e,t)=>({__type:"LessOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),Y.greaterFilterExpression=(e,t)=>({__type:"GreaterFilterExpressionPredicate:#EQ",Field:e,Value:t}),Y.greaterOrEqualFilterExpression=(e,t)=>({__type:"GreaterOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),Y.likeFilterExpression=(e,t)=>({__type:"LikeFilterExpressionPredicate:#EQ",Field:e,Value:`%${t}%`}),Y.inFilterExpression=(e,t)=>({__type:"InFilterExpressionPredicate:#EQ",Field:e,Value:t}),Y.relatedToExpression=(e,t)=>({__type:"RelatedToFilterExpressionPredicate:#EQ",Value:e,RelationType:t}),Y.isNullOrEmptyFilterExpression=e=>Y.orFilterExpression([Y.equalsFilterExpression(Y.column(e),null),Y.equalsFilterExpression(Y.column(e),"")]);class Z{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 ee(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(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())})}Z.isValid=e=>e instanceof Date&&!isNaN(e.getTime()),Z.areDaysEqual=(e,t)=>{const r=Z.clearTime(e),n=Z.clearTime(t);return r.getTime()===n.getTime()},Z.areTimesEqual=(e,t)=>e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes(),Z.areDatesEqual=(e,t)=>!!e&&!!t&&Z.areDaysEqual(e,t)&&Z.areTimesEqual(e,t),Z.clearTime=e=>{const t=new Date(e);return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t},Z.isWithoutTime=e=>0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds(),Z.getFormattedSqlDateTime=e=>e.toISOString().slice(0,19).replace("T"," "),Z.getRfcWithoutTimezone=e=>e.slice(0,19),exports.TransformItemFormats=void 0,(Q=exports.TransformItemFormats||(exports.TransformItemFormats={})).OpenXmlDocx="OpenXmlDocx",Q.Pdf="Pdf",Q.WordMlXml="WordMlXml",exports.EmailConversionSource=void 0,($=exports.EmailConversionSource||(exports.EmailConversionSource={})).Manual="Manual",$.SuggestedContacts="SuggestedContacts","function"==typeof SuppressedError&&SuppressedError;exports.EnumTypeEditMode=void 0,(q=exports.EnumTypeEditMode||(exports.EnumTypeEditMode={})).Readonly="Readonly",q.VisibleRankDefaultOnly="VisibleRankDefaultOnly",q.Editable="Editable",exports.ImportResult=void 0,(J=exports.ImportResult||(exports.ImportResult={})).Success="Success",J.Failure="Failed",J.FailureDuplicityFound="Failed_DuplicityFound",J.FailureItemAlreadyRemoved="Failed_ItemAlreadyRemoved",J.FailureColumnsLockedWFAction="Failed_ColumnsLocked",J.FailureItemLockedWFAction="Failed_ItemLocked",J.FailureLicenseLimitReached="Failed_LicenseLimitReached",J.FailureInssuficientModulePermission="Failed_InsufficientModulePermission",J.FailureInssuficientColumnsPermission="Failed_InsufficientColumnsPermission",c.polyfill(),exports.ApiConnectionAsNonDefaultExport=I,exports.ApiFetchClient=class{constructor(e,t,r,n,o){let s;if(this.sessionId=null,this.isAdmin=null,this.loginResponse=null,!(r||(s=C.decodeAccessToken(t),r=s.ws)))throw new Error("Failed to get web service URL from JWT");if(!(n||(s||(s=C.decodeAccessToken(t)),n=s.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=o||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 ee(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 ee(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 ee(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 ee(this,void 0,void 0,function*(){return(yield this.callMethod("GetObjectTypes",{})).Data})}getLicense(){return ee(this,void 0,void 0,function*(){return(yield this.callMethod("GetLicense",{})).Datum})}getClientVersionId(e){return ee(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 ee(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 ee(this,arguments,void 0,function*(e,t=null,r=null,n=null){const o={query:{__type:"MainTableQuery:#EQ",ItemTypes:[e],Fields:t,Paging:{Skip:0,Take:500}}};return r&&(o.query.Filter=r),n&&(o.query.Sort=n),this.callMethod("Query",o)})}callMethod(e,t){return ee(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}),o=yield fetch(n);if(!o.ok)throw new Error(`Error calling method ${e}: ${o.statusText}`);const s=200===o.status?yield o.json():void 0;if(!s||"rcSuccess"!==s.ReturnCode)throw new Error(`API call failed (${null==s?void 0:s.ReturnCode}): ${null==s?void 0:s.Description}`);return s})}static getTokenData(e,t,r,n,o){return ee(this,void 0,void 0,function*(){const s=new URLSearchParams;s.append("client_id",n),s.append("client_secret",o),s.append("code",t),s.append("redirect_uri",r),s.append("grant_type","authorization_code");const i=new Request(`${e}/auth/connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s.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})}},exports.ApiMethods=p,exports.ColumnPermissionMandatoryRules=F,exports.ColumnPermissionPermissionRules=x,exports.CommonDataConnection=class{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 v("ObtainCommonDataApiAccessToken",exports.HttpMethod.get,!1,"InvalidCommonDataToken",A,e,t)}},exports.CustomizationStatsItemKeys=V,exports.DateHelper=Z,exports.EWItem=class{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 m.contacts:{const e=this.baseItem;return e.Email1Address||e.Email2Address||e.Email3Address}case m.leads:return this.baseItem.Email;case m.companies:return this.baseItem.Email;case m.users:{const e=this.baseItem;return e.Email1Address||e.Email2Address}default:return null}}getInitials(){switch(this.folderName){case m.contacts:{const e=this.baseItem;return this.getInitialsInternal(e.FirstName,e.LastName)}case m.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 m.contacts:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}case m.users:{const e=this.baseItem;return e.ProfilePicture?{imageData:e.ProfilePicture,width:e.ProfilePictureWidth||0,height:e.ProfilePictureHeight||0}:null}default:return null}}},exports.EnumTypes=d,exports.ErrorHelper=S,exports.ExpirationReason=G,exports.FieldNames=D,exports.FieldTypes=W,exports.FolderNames=m,exports.Functionality=M,exports.GlobalSettingsNames=k,exports.HttpRequestError=T,exports.LicenseKeyInvoiceSeverity=j,exports.LicenseRestrictionKeys=U,exports.OAuthHelper=C,exports.OAuthSessionHandler=P,exports.OAuthSessionHandlerBase=g,exports.ObjectTypeIds=H,exports.OpenItemLinkHelper=E,exports.QueryHelper=Y,exports.RelationTypeIds=w,exports.RelationTypes=b,exports.ReturnCodes=u,exports.StringHelper=class{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}},exports.TokenizedServiceConnection=v,exports.VersionHelper=X,exports.VersionHelperBase=B,exports.default=I;
|
|
@@ -3,8 +3,8 @@ export type TUnionError = Error | HttpRequestError | WebServiceError;
|
|
|
3
3
|
export declare class HttpRequestError extends Error {
|
|
4
4
|
statusCode: number;
|
|
5
5
|
message: string;
|
|
6
|
-
readonly responseData?: unknown;
|
|
7
|
-
constructor(statusCode: number, message: string, responseData?: unknown);
|
|
6
|
+
readonly responseData?: unknown | undefined;
|
|
7
|
+
constructor(statusCode: number, message: string, responseData?: unknown | undefined);
|
|
8
8
|
/**
|
|
9
9
|
* Builds the error from a non-200 HTTP response. Prefers the API result body's Description over the HTTP
|
|
10
10
|
* status text, which is empty over HTTP/2. The body is kept in
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ import type { TApiUnlinkInquiryResultType } from './data/IApiUnlinkInquiryResult
|
|
|
40
40
|
import DateHelper from './helpers/DateHelper';
|
|
41
41
|
import type { ImportResult } from './constants/ImportResult';
|
|
42
42
|
import { TransformItemFormats } from './enumerations/TransformItemFormats';
|
|
43
|
+
import { EmailConversionSource } from './enumerations/EmailConversionSource';
|
|
43
44
|
import type QuerySources from './helpers/QueryHelper/QuerySources';
|
|
44
45
|
import { ApiFetchClient } from './ApiFetchClient';
|
|
45
46
|
import { OpenItemLinkHelper } from './helpers/OpenItemLinkHelper';
|
|
@@ -112,4 +113,4 @@ export * from './data/query/IApiQueryFilters';
|
|
|
112
113
|
export * from './constants/ImportResult';
|
|
113
114
|
export * from './interfaces/ITranslatableString';
|
|
114
115
|
export * from './interfaces/ITokenData';
|
|
115
|
-
export { OpenItemLinkHelper, ImportResult, SentimentTone, HttpMethod, ISessionHandler, ReturnCodes, ITokenizedApiResult, TokenizedServiceConnection, CommonDataConnection, ApiMethods, GlobalSettingsNames, FolderNames, TFolderName, OAuthHelper, HttpRequestError, TUnionError, TInputData, FieldNames, EnumTypes, RelationTypes, RelationTypeIds, TRelationType, ColumnPermissionPermissionRules, ColumnPermissionMandatoryRules, Edition, Feature, Functionality, CustomizationStatsItemKeys, LicenseRestrictionKeys, ExpirationReason, LicenseKeyInvoiceSeverity, ErrorHelper, VersionHelperBase, OAuthSessionHandlerBase, OAuthSessionHandler, FieldTypes, TFieldType, TNumericValidatorType, IApiEvent, IApiSetFieldValueAction, ObjectTypeIds, IApiHubItemsCountsQueryResponseItem, QueryHelper, QuerySources, IApiServiceAuthSettingsResponse, ApiConnection as ApiConnectionAsNonDefaultExport, IApiUnlinkInquiryResult, TApiUnlinkInquiryResultType, VersionHelper, Version, StringHelper, DateHelper, TransformItemFormats, ApiFetchClient };
|
|
116
|
+
export { OpenItemLinkHelper, ImportResult, SentimentTone, HttpMethod, ISessionHandler, ReturnCodes, ITokenizedApiResult, TokenizedServiceConnection, CommonDataConnection, ApiMethods, GlobalSettingsNames, FolderNames, TFolderName, OAuthHelper, HttpRequestError, TUnionError, TInputData, FieldNames, EnumTypes, RelationTypes, RelationTypeIds, TRelationType, ColumnPermissionPermissionRules, ColumnPermissionMandatoryRules, Edition, Feature, Functionality, CustomizationStatsItemKeys, LicenseRestrictionKeys, ExpirationReason, LicenseKeyInvoiceSeverity, ErrorHelper, VersionHelperBase, OAuthSessionHandlerBase, OAuthSessionHandler, FieldTypes, TFieldType, TNumericValidatorType, IApiEvent, IApiSetFieldValueAction, ObjectTypeIds, IApiHubItemsCountsQueryResponseItem, QueryHelper, QuerySources, IApiServiceAuthSettingsResponse, ApiConnection as ApiConnectionAsNonDefaultExport, IApiUnlinkInquiryResult, TApiUnlinkInquiryResultType, VersionHelper, Version, StringHelper, DateHelper, TransformItemFormats, EmailConversionSource, ApiFetchClient };
|
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",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};
|
|
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",e)}},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,$,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 J extends j{}J.is75OrLater=e=>j.supportsFeaturesOf(e,H.Version75),J.is76OrLater=e=>J.supportsFeaturesOf(e,H.Version76),J.is77OrLater=e=>J.supportsFeaturesOf(e,H.Version77),J.is80OrLater=e=>J.supportsFeaturesOf(e,H.Version80),J.is81OrLater=e=>J.supportsFeaturesOf(e,H.Version81),J.is82OrLater=e=>J.supportsFeaturesOf(e,H.Version82),J.is83OrLater=e=>J.supportsFeaturesOf(e,H.Version83),J.is90OrLater=e=>J.supportsFeaturesOf(e,H.Version90),J.is91OrLater=e=>J.supportsFeaturesOf(e,H.Version91),J.is92OrLater=e=>J.supportsFeaturesOf(e,H.Version92),J.is93OrLater=e=>J.supportsFeaturesOf(e,H.Version93),J.is94OrLater=e=>J.supportsFeaturesOf(e,H.Version94),J.is100OrLater=e=>J.supportsFeaturesOf(e,H.Version100),J.is101OrLater=e=>J.supportsFeaturesOf(e,H.Version101),J.isFeatureSupported=(e,t)=>J.supportsFeaturesOf(e,t);class X{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!==t&&(n.IsToParentDirection=t),r&&(n.ChildrenFolderNames=r),n}}class K{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]}}}K.column=e=>({__type:"Column:#EQ",Source:X.mainTable(),Name:e}),K.multiSelectComboColumnLegacy=(e,t,r)=>({__type:"Column:#EQ",Source:X.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues]({0}, '${e}', '${t}')`,Alias:null!=r?r:e}),K.multiSelectComboColumn=(e,t,r,n,s)=>{if(!J.is77OrLater(e))return K.multiSelectComboColumnLegacy(r,n,s);return{__type:"Column:#EQ",Source:X.mainTable(),Name:"ItemGUID",Transformation:`[dbo].[GetConcatenatedEnumValuesRelationsValues_WithObjectTypeID]({0}, dbo.GetObjectTypeID('${t}'), '${r}', '${n}')`,Alias:null!=s?s:r}},K.joinColumn=(e,t,r,n,s)=>K.joinColumnFromKey(e,K.column(t),r,n,s),K.joinColumnFromKey=(e,t,r,n,s)=>{const o={__type:"Column:#EQ",Source:X.join(e,t,s),Name:r};return n&&(o.Alias=n),o},K.singleVariatedColumn=(e,t,r)=>K.variatedColumn([K.columnVariation(e,t)],r),K.variatedColumn=(e,t)=>{const r={__type:"VariatedColumn:#EQ",Source:X.mainTable(),Variations:e};return t&&(r.Alias=t),r},K.columnVariation=(e,t,r)=>{const n={FolderName:t,Field:{__type:"Column:#EQ",Source:X.mainTable(),Name:e}};return r&&(n.Field.Transformation=r),n},K.joinColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:X.join(t,K.column(r)),Name:n}}),K.relationColumnVariation=(e,t,r,n)=>({FolderName:e,Field:{__type:"Column:#EQ",Source:X.relation(r,t,1),Name:n}}),K.relatedColumn=(e,t,r,n)=>{const s={__type:"Column:#EQ",Source:X.relation(t,e,1),Name:r};return n&&(s.Alias=n),s},K.relatedSubstituableColumn=(e,t,r,n,s)=>{const o={__type:"SubstituableColumn:#EQ",Source:X.relation(t,e,1),Name:r,Substitute:n};return s&&(o.Alias=s),o},K.relatedColumnFolderNameToken=(e,t,r)=>({__type:"Token:#EQ",Source:X.relation(t,e,1),TypeName:"ItemType",Alias:r}),K.hubRelationColumn=(e,t)=>({__type:"Column:#EQ",Source:X.hubRelation(t),Name:e}),K.aggregateColumn=(e,t,r)=>({__type:"AggregateColumn:#EQ",FunctionName:e,Source:t.Source,AggregatedField:t,Alias:r}),K.folderNameToken=e=>({__type:"Token:#EQ",Source:X.mainTable(),TypeName:"ItemType",Alias:null!=e?e:"FolderName"}),K.equalsFilterExpression=(e,t)=>({__type:"EqualsFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.notEqualsExpression=(e,t)=>({__type:"NotFilterExpression:#EQ",Child:K.equalsFilterExpression(e,t)}),K.andFilterExpression=e=>({__type:"AndFilterExpressionOperator:#EQ",Children:e}),K.orFilterExpression=e=>({__type:"OrFilterExpressionOperator:#EQ",Children:e}),K.lessFilterExpression=(e,t)=>({__type:"LessFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.lessOrEqualFilterExpression=(e,t)=>({__type:"LessOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.greaterFilterExpression=(e,t)=>({__type:"GreaterFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.greaterOrEqualFilterExpression=(e,t)=>({__type:"GreaterOrEqualFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.likeFilterExpression=(e,t)=>({__type:"LikeFilterExpressionPredicate:#EQ",Field:e,Value:`%${t}%`}),K.inFilterExpression=(e,t)=>({__type:"InFilterExpressionPredicate:#EQ",Field:e,Value:t}),K.relatedToExpression=(e,t)=>({__type:"RelatedToFilterExpressionPredicate:#EQ",Value:e,RelationType:t}),K.isNullOrEmptyFilterExpression=e=>K.orFilterExpression([K.equalsFilterExpression(K.column(e),null),K.equalsFilterExpression(K.column(e),"")]);class Y{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 Z{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 ee(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())})}Z.isValid=e=>e instanceof Date&&!isNaN(e.getTime()),Z.areDaysEqual=(e,t)=>{const r=Z.clearTime(e),n=Z.clearTime(t);return r.getTime()===n.getTime()},Z.areTimesEqual=(e,t)=>e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes(),Z.areDatesEqual=(e,t)=>!!e&&!!t&&Z.areDaysEqual(e,t)&&Z.areTimesEqual(e,t),Z.clearTime=e=>{const t=new Date(e);return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t},Z.isWithoutTime=e=>0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds(),Z.getFormattedSqlDateTime=e=>e.toISOString().slice(0,19).replace("T"," "),Z.getRfcWithoutTimezone=e=>e.slice(0,19),function(e){e.OpenXmlDocx="OpenXmlDocx",e.Pdf="Pdf",e.WordMlXml="WordMlXml"}(z||(z={})),function(e){e.Manual="Manual",e.SuggestedContacts="SuggestedContacts"}(Q||(Q={})),"function"==typeof SuppressedError&&SuppressedError;class te{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 ee(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 ee(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 ee(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 ee(this,void 0,void 0,function*(){return(yield this.callMethod("GetObjectTypes",{})).Data})}getLicense(){return ee(this,void 0,void 0,function*(){return(yield this.callMethod("GetLicense",{})).Datum})}getClientVersionId(e){return ee(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 ee(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 ee(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 ee(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 ee(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 re{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"}($||($={})),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"}(q||(q={})),a.polyfill();export{S as ApiConnectionAsNonDefaultExport,te as ApiFetchClient,d as ApiMethods,F as ColumnPermissionMandatoryRules,w as ColumnPermissionPermissionRules,A as CommonDataConnection,M as CustomizationStatsItemKeys,Z as DateHelper,re as EWItem,O as Edition,Q as EmailConversionSource,$ 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,q as ImportResult,V as LicenseKeyInvoiceSeverity,U as LicenseRestrictionKeys,h as OAuthHelper,f as OAuthSessionHandler,C as OAuthSessionHandlerBase,W as ObjectTypeIds,T as OpenItemLinkHelper,K as QueryHelper,b as RelationTypeIds,D as RelationTypes,l as ReturnCodes,R as SentimentTone,Y as StringHelper,E as TokenizedServiceConnection,z as TransformItemFormats,H as Version,J as VersionHelper,j as VersionHelperBase,S as default};
|
package/lib/index.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ type TUnionError = Error | HttpRequestError | WebServiceError;
|
|
|
21
21
|
declare class HttpRequestError extends Error {
|
|
22
22
|
statusCode: number;
|
|
23
23
|
message: string;
|
|
24
|
-
readonly responseData?: unknown;
|
|
25
|
-
constructor(statusCode: number, message: string, responseData?: unknown);
|
|
24
|
+
readonly responseData?: unknown | undefined;
|
|
25
|
+
constructor(statusCode: number, message: string, responseData?: unknown | undefined);
|
|
26
26
|
/**
|
|
27
27
|
* Builds the error from a non-200 HTTP response. Prefers the API result body's Description over the HTTP
|
|
28
28
|
* status text, which is empty over HTTP/2. The body is kept in
|
|
@@ -1758,6 +1758,11 @@ declare enum ImportResult {
|
|
|
1758
1758
|
FailureInssuficientColumnsPermission = "Failed_InsufficientColumnsPermission"
|
|
1759
1759
|
}
|
|
1760
1760
|
|
|
1761
|
+
declare enum EmailConversionSource {
|
|
1762
|
+
Manual = "Manual",
|
|
1763
|
+
SuggestedContacts = "SuggestedContacts"
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1761
1766
|
/**
|
|
1762
1767
|
* ApiClient provides methods to interact with the eWay-CRM API using a JWT access token.
|
|
1763
1768
|
* Fetch method is used instead of Axios which is not supported in Cloudflare Workers.
|
|
@@ -3010,4 +3015,4 @@ interface IApiGoodFinalPrice {
|
|
|
3010
3015
|
AdditionalDiscount: number | null;
|
|
3011
3016
|
}
|
|
3012
3017
|
|
|
3013
|
-
export { ApiConnection as ApiConnectionAsNonDefaultExport, ApiFetchClient, ApiMethods, ColumnPermissionMandatoryRules, ColumnPermissionPermissionRules, CommonDataConnection, CustomizationStatsItemKeys, DateHelper, EWItem, Edition, EnumTypeEditMode, EnumTypes, ErrorHelper, ExpirationReason, Feature, FieldNames, FieldTypes, FolderNames, Functionality, GlobalSettingsNames, HttpMethod, HttpRequestError, IApiAdditionalField, IApiAvailableBundle, IApiAvailableVersionResponse, IApiBooleanResponse, IApiBoundRelation, IApiCalendar, IApiCapacityAvailableBundle, IApiCart, IApiClientVersion, IApiColumn, IApiColumnPermission, IApiCompany, IApiContact, IApiContactsSuggestion, IApiCurrencyExchangeRate, IApiCurrentUserLicenseInfo, IApiCustomizationStatsItem, IApiDataImportResponse, IApiDataResponse, IApiDatumResponse, IApiDocument, IApiEmail, IApiEnumType, IApiEnumValue, IApiEnumValuesRelation, IApiEvent, IApiFeature, IApiFeaturesLicenseBundle, IApiFlow, IApiGlobalSetting, IApiGoal, IApiGood, IApiGoodFinalPrice, IApiGoodInCart, IApiGoodInSet, IApiGroup, IApiHubItemsCountsQueryResponseItem, IApiItemBase, IApiItemBaseWithoutPrivate, IApiItemIdentifier, IApiItemUsageStatus, IApiJournal, IApiLayout, IApiLayoutsModel, IApiLead, IApiLicense, IApiLicenseBundleBase, IApiLicenseDbSizeModel, IApiLicenseExpiration, IApiLicenseKeyInvoice, IApiLicenseProductsModel, IApiLicenseSyncLicenseModel, IApiLocalizedLicenseBundle, IApiLoginResponse, IApiMarketingList, IApiModulePermission, IApiObjectType, IApiPasswordStrength, IApiPayment, IApiProject, IApiQueryAggregateColumn, IApiQueryAndFilterExpressionOperator, IApiQueryColumn, IApiQueryColumnVariation, IApiQueryEqualsFilterExpressionPredicate, IApiQueryGreaterFilterExpressionPredicate, IApiQueryGreaterOrEqualFilterExpressionPredicate, IApiQueryHubRelationSource, IApiQueryInFilterExpressionPredicate, IApiQueryJoinTableSource, IApiQueryLessFilterExpressionPredicate, IApiQueryLessOrEqualFilterExpressionPredicate, IApiQueryLikeFilterExpressionPredicate, IApiQueryMainTableSource, IApiQueryNotFilterExpression, IApiQueryOrFilterExpressionOperator, IApiQueryRelatedToFilterExpressionPredicate, IApiQueryRelationSource, IApiQuerySubstituableColumn, IApiQueryToken, IApiQueryVariatedColumn, IApiRecurrencePattern, IApiResult, IApiSaveResponse, IApiServiceAuthSettingsResponse, IApiSetFieldValueAction, IApiTask, IApiUnlinkInquiryResult, IApiUser, IApiUserSetting, IApiWebServiceTaskStatus, IApiWorkReport, IApiWorkflowActionDerivedItem, IApiWorkflowModel, IApiXsltTransformation, IApiXsltTransformationsModel, ISessionHandler, ITokenData, ITokenError, ITokenSuccess, ITokenizedApiResult, ITranslatableString, ImportResult, LicenseKeyInvoiceSeverity, LicenseRestrictionKeys, OAuthHelper, OAuthSessionHandler, OAuthSessionHandlerBase, ObjectTypeIds, OpenItemLinkHelper, QueryHelper, QuerySources, RelationTypeIds, RelationTypes, ReturnCodes, SentimentTone, StringHelper, TApiColumnPermissionMandatoryRuleOptions, TApiColumnPermissionPermissionRuleOptions, TApiItemWithReleations, TApiModulePermissionOptions, TApiQueryAggregateFunction, TApiQueryField, TApiQueryFilterExpression, TApiUnlinkInquiryResultType, TFeatureWithEdition, TFieldType, TFolderName, TInputData, TNumericValidatorType, TRelationType, TUnionError, TokenizedServiceConnection, TransformItemFormats, Version, VersionHelper, VersionHelperBase, ApiConnection as default };
|
|
3018
|
+
export { ApiConnection as ApiConnectionAsNonDefaultExport, ApiFetchClient, ApiMethods, ColumnPermissionMandatoryRules, ColumnPermissionPermissionRules, CommonDataConnection, CustomizationStatsItemKeys, DateHelper, EWItem, Edition, EmailConversionSource, EnumTypeEditMode, EnumTypes, ErrorHelper, ExpirationReason, Feature, FieldNames, FieldTypes, FolderNames, Functionality, GlobalSettingsNames, HttpMethod, HttpRequestError, IApiAdditionalField, IApiAvailableBundle, IApiAvailableVersionResponse, IApiBooleanResponse, IApiBoundRelation, IApiCalendar, IApiCapacityAvailableBundle, IApiCart, IApiClientVersion, IApiColumn, IApiColumnPermission, IApiCompany, IApiContact, IApiContactsSuggestion, IApiCurrencyExchangeRate, IApiCurrentUserLicenseInfo, IApiCustomizationStatsItem, IApiDataImportResponse, IApiDataResponse, IApiDatumResponse, IApiDocument, IApiEmail, IApiEnumType, IApiEnumValue, IApiEnumValuesRelation, IApiEvent, IApiFeature, IApiFeaturesLicenseBundle, IApiFlow, IApiGlobalSetting, IApiGoal, IApiGood, IApiGoodFinalPrice, IApiGoodInCart, IApiGoodInSet, IApiGroup, IApiHubItemsCountsQueryResponseItem, IApiItemBase, IApiItemBaseWithoutPrivate, IApiItemIdentifier, IApiItemUsageStatus, IApiJournal, IApiLayout, IApiLayoutsModel, IApiLead, IApiLicense, IApiLicenseBundleBase, IApiLicenseDbSizeModel, IApiLicenseExpiration, IApiLicenseKeyInvoice, IApiLicenseProductsModel, IApiLicenseSyncLicenseModel, IApiLocalizedLicenseBundle, IApiLoginResponse, IApiMarketingList, IApiModulePermission, IApiObjectType, IApiPasswordStrength, IApiPayment, IApiProject, IApiQueryAggregateColumn, IApiQueryAndFilterExpressionOperator, IApiQueryColumn, IApiQueryColumnVariation, IApiQueryEqualsFilterExpressionPredicate, IApiQueryGreaterFilterExpressionPredicate, IApiQueryGreaterOrEqualFilterExpressionPredicate, IApiQueryHubRelationSource, IApiQueryInFilterExpressionPredicate, IApiQueryJoinTableSource, IApiQueryLessFilterExpressionPredicate, IApiQueryLessOrEqualFilterExpressionPredicate, IApiQueryLikeFilterExpressionPredicate, IApiQueryMainTableSource, IApiQueryNotFilterExpression, IApiQueryOrFilterExpressionOperator, IApiQueryRelatedToFilterExpressionPredicate, IApiQueryRelationSource, IApiQuerySubstituableColumn, IApiQueryToken, IApiQueryVariatedColumn, IApiRecurrencePattern, IApiResult, IApiSaveResponse, IApiServiceAuthSettingsResponse, IApiSetFieldValueAction, IApiTask, IApiUnlinkInquiryResult, IApiUser, IApiUserSetting, IApiWebServiceTaskStatus, IApiWorkReport, IApiWorkflowActionDerivedItem, IApiWorkflowModel, IApiXsltTransformation, IApiXsltTransformationsModel, ISessionHandler, ITokenData, ITokenError, ITokenSuccess, ITokenizedApiResult, ITranslatableString, ImportResult, LicenseKeyInvoiceSeverity, LicenseRestrictionKeys, OAuthHelper, OAuthSessionHandler, OAuthSessionHandlerBase, ObjectTypeIds, OpenItemLinkHelper, QueryHelper, QuerySources, RelationTypeIds, RelationTypes, ReturnCodes, SentimentTone, StringHelper, TApiColumnPermissionMandatoryRuleOptions, TApiColumnPermissionPermissionRuleOptions, TApiItemWithReleations, TApiModulePermissionOptions, TApiQueryAggregateFunction, TApiQueryField, TApiQueryFilterExpression, TApiUnlinkInquiryResultType, TFeatureWithEdition, TFieldType, TFolderName, TInputData, TNumericValidatorType, TRelationType, TUnionError, TokenizedServiceConnection, TransformItemFormats, Version, VersionHelper, VersionHelperBase, ApiConnection as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eway-crm/connector",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.263",
|
|
4
4
|
"description": "eWay-CRM API JavaScript connector library.",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "vitest run",
|
|
10
10
|
"build": "rollup -c",
|
|
11
11
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
12
|
-
"lint": "eslint
|
|
12
|
+
"lint": "eslint src",
|
|
13
13
|
"prepare": "npm run build",
|
|
14
14
|
"prepublishOnly": "npm test && npm run lint",
|
|
15
15
|
"preversion": "npm run lint",
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/eway-crm/js-lib#readme",
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@eway-crm/eslint-config": "^1.
|
|
37
|
+
"@eway-crm/eslint-config": "^2.1.1",
|
|
38
38
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
39
39
|
"@rollup/plugin-json": "^6.0.0",
|
|
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
43
|
"@types/node": "^20.19.42",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
45
|
-
"@typescript-eslint/parser": "^
|
|
46
|
-
"eslint": "^
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.65.0",
|
|
46
|
+
"eslint": "^9.39.5",
|
|
47
47
|
"prettier": "^2.8.8",
|
|
48
48
|
"rollup": "^3.23.0",
|
|
49
49
|
"rollup-plugin-delete": "^2.0.0",
|
|
50
50
|
"rollup-plugin-dts": "^5.3.0",
|
|
51
51
|
"tslib": "^2.8.1",
|
|
52
|
-
"typescript": "
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
53
|
"vitest": "^4.1.8"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|