@eway-crm/connector 1.0.122 → 1.0.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ApiConnection.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Axios from 'axios';
|
|
1
2
|
import { ReturnCodes } from './ReturnCodes';
|
|
2
3
|
import { HttpMethod } from './HttpMethod';
|
|
3
4
|
import { CredentialsSessionHandler } from './CredentialsSessionHandler';
|
|
@@ -7,7 +8,6 @@ import { OAuthSessionHandler } from './OAuthSessionHandler';
|
|
|
7
8
|
import { HttpRequestError } from './exceptions/HttpRequestError';
|
|
8
9
|
import * as base64url from 'universal-base64url';
|
|
9
10
|
import ErrorHelper from './helpers/ErrorHelper';
|
|
10
|
-
import axiosInstance from './axios/AxiosInstance';
|
|
11
11
|
export class ApiConnection {
|
|
12
12
|
constructor(apiServiceUri, sessionHandler, errorCallback, supportGetItemPreviewMethod) {
|
|
13
13
|
this.createOpenLink = (folderName, guid, fileAs) => {
|
|
@@ -99,7 +99,7 @@ export class ApiConnection {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
const methodUrl = `${this.svcUri}/SaveBinaryAttachment?sessionId=${this.sessionId}&itemGuid=${itemGuid}&fileName=${encodeURIComponent(fileName)}`;
|
|
102
|
-
const promise =
|
|
102
|
+
const promise = Axios.post(methodUrl, data, config);
|
|
103
103
|
ApiConnection.handleCallPromise(promise, successCallback, unsuccessClb, errorClb);
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
@@ -193,10 +193,10 @@ export class ApiConnection {
|
|
|
193
193
|
if (data) {
|
|
194
194
|
throw new Error('Calling api get method with data specified does not make any sense.');
|
|
195
195
|
}
|
|
196
|
-
promise =
|
|
196
|
+
promise = Axios.get(methodUrl, config);
|
|
197
197
|
break;
|
|
198
198
|
case HttpMethod.post:
|
|
199
|
-
promise =
|
|
199
|
+
promise = Axios.post(methodUrl, data, config);
|
|
200
200
|
break;
|
|
201
201
|
default:
|
|
202
202
|
throw new Error(`Unknown http method '${httpMethod}'.`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import Axios from 'axios';
|
|
1
2
|
import * as base64url from 'universal-base64url';
|
|
2
3
|
import jwt_decode from 'jwt-decode';
|
|
3
|
-
import axiosInstance from '../axios/AxiosInstance';
|
|
4
4
|
class OAuthHelper {
|
|
5
5
|
}
|
|
6
6
|
OAuthHelper.finishAuthorization = (wsUrl, clientId, clientSecret, codeVerifier, authorizationCode, redirectUrl, callback) => {
|
|
@@ -33,7 +33,7 @@ OAuthHelper.getUserName = (accessToken) => {
|
|
|
33
33
|
return parts.username;
|
|
34
34
|
};
|
|
35
35
|
OAuthHelper.callTokenEndpoint = (wsUrl, params, callback) => {
|
|
36
|
-
|
|
36
|
+
Axios.post(wsUrl + '/auth/connect/token', params, {
|
|
37
37
|
headers: {
|
|
38
38
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
39
39
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import Axios from 'axios';
|
|
1
2
|
import { HttpRequestError } from '..';
|
|
2
|
-
import axiosInstance from '../axios/AxiosInstance';
|
|
3
3
|
export class TokenizedServiceConnection {
|
|
4
4
|
constructor(obtainTokenMethodName, obtainTokenMethodType, needsSession, invalidTokenReturnCode, urlAndTokenObtainer, connection, errorCallback) {
|
|
5
5
|
this.isEnabled = (enabledCallback, disabledCallback) => {
|
|
@@ -99,7 +99,7 @@ export class TokenizedServiceConnection {
|
|
|
99
99
|
static call(serviceUrl, methodName, data, successCallback, unsuccessCallback, errorCallback) {
|
|
100
100
|
// We count on that we are in Admin/Subdirectory.
|
|
101
101
|
const address = serviceUrl + '/' + methodName;
|
|
102
|
-
|
|
102
|
+
Axios.post(address, data)
|
|
103
103
|
.then((response) => {
|
|
104
104
|
if (response.status === 200) {
|
|
105
105
|
if (response.data.ReturnCodeString === 'Success') {
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eway-crm/connector",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.124",
|
|
4
4
|
"description": "eWay-CRM API JavaScript connector library.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"test": "jest --config jestconfig.json",
|
|
9
10
|
"build": "tsc",
|