@smartbills/sdk 0.0.2-alpha.19 → 0.0.2-alpha.21
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/dist/cjs/packages/sdk/package.json.cjs +1 -1
- package/dist/cjs/services/oauth/AuthorizationCodeResponse.cjs +2 -2
- package/dist/cjs/services/oauth/AuthorizationCodeResponse.cjs.map +1 -1
- package/dist/cjs/services/oauth/OAuthService.cjs +6 -12
- package/dist/cjs/services/oauth/OAuthService.cjs.map +1 -1
- package/dist/esm/packages/sdk/package.json.mjs +1 -1
- package/dist/esm/services/oauth/AuthorizationCodeResponse.mjs +2 -2
- package/dist/esm/services/oauth/AuthorizationCodeResponse.mjs.map +1 -1
- package/dist/esm/services/oauth/OAuthService.mjs +6 -12
- package/dist/esm/services/oauth/OAuthService.mjs.map +1 -1
- package/dist/umd/index.js +10 -16
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var defineProperty = require('../../node_modules/@babel/runtime/helpers/esm/defineProperty.cjs');
|
|
4
|
-
var
|
|
4
|
+
var nodeHtmlParser = require('node-html-parser');
|
|
5
5
|
|
|
6
6
|
class AuthorizationCodeResponse {
|
|
7
7
|
constructor(response) {
|
|
@@ -9,7 +9,7 @@ class AuthorizationCodeResponse {
|
|
|
9
9
|
defineProperty.default(this, "code", void 0);
|
|
10
10
|
defineProperty.default(this, "session_state", void 0);
|
|
11
11
|
defineProperty.default(this, "scope", void 0);
|
|
12
|
-
const parsedHTML =
|
|
12
|
+
const parsedHTML = nodeHtmlParser.parse(response);
|
|
13
13
|
this.redirectUrl = parsedHTML.querySelector("form").attributes.action;
|
|
14
14
|
const inputs = parsedHTML.querySelectorAll("input");
|
|
15
15
|
this.code = this.findInputValue(inputs, "code");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationCodeResponse.cjs","sources":["../../../../src/services/oauth/AuthorizationCodeResponse.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"AuthorizationCodeResponse.cjs","sources":["../../../../src/services/oauth/AuthorizationCodeResponse.ts"],"sourcesContent":["import { parse, HTMLElement } from \"node-html-parser\";\n\nexport class AuthorizationCodeResponse {\n\tpublic constructor(response: string) {\n\t\tconst parsedHTML = parse(response);\n\t\tthis.redirectUrl = parsedHTML.querySelector(\"form\").attributes.action;\n\t\tconst inputs = parsedHTML.querySelectorAll(\"input\");\n\t\tthis.code = this.findInputValue(inputs, \"code\");\n\t\tthis.session_state = this.findInputValue(inputs, \"session_state\");\n\t\tthis.scope = this.findInputValue(inputs, \"scope\");\n\t}\n\tprivate findInputValue(inputs: HTMLElement[], name: string) {\n\t\treturn inputs.find((x) => x.attributes.name == name).attributes.value;\n\t}\n\n\tpublic redirectUrl: string;\n\tpublic code: string;\n\tpublic session_state: string;\n\tpublic scope: string;\n}\n"],"names":["AuthorizationCodeResponse","constructor","response","_defineProperty","parsedHTML","parse","redirectUrl","querySelector","attributes","action","inputs","querySelectorAll","code","findInputValue","session_state","scope","name","find","x","value"],"mappings":";;;;;MAEaA,yBAAyB,CAAA;EACrCC,WAAAA,CAAmBC,QAAgB,EAAA;IAAAC,sBAAA,CAAA,IAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,sBAAA,CAAA,IAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,sBAAA,CAAA,IAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,sBAAA,CAAA,IAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAClC,IAAA,MAAMC,UAAU,GAAGC,oBAAK,CAACH,QAAQ,CAAC,CAAA;AAClC,IAAA,IAAI,CAACI,WAAW,GAAGF,UAAU,CAACG,aAAa,CAAC,MAAM,CAAC,CAACC,UAAU,CAACC,MAAM,CAAA;AACrE,IAAA,MAAMC,MAAM,GAAGN,UAAU,CAACO,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACnD,IAAI,CAACC,IAAI,GAAG,IAAI,CAACC,cAAc,CAACH,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/C,IAAI,CAACI,aAAa,GAAG,IAAI,CAACD,cAAc,CAACH,MAAM,EAAE,eAAe,CAAC,CAAA;IACjE,IAAI,CAACK,KAAK,GAAG,IAAI,CAACF,cAAc,CAACH,MAAM,EAAE,OAAO,CAAC,CAAA;AAClD,GAAA;AACQG,EAAAA,cAAcA,CAACH,MAAqB,EAAEM,IAAY,EAAA;AACzD,IAAA,OAAON,MAAM,CAACO,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACV,UAAU,CAACQ,IAAI,IAAIA,IAAI,CAAC,CAACR,UAAU,CAACW,KAAK,CAAA;AACtE,GAAA;AAMA;;;;"}
|
|
@@ -10,8 +10,7 @@ class OAuthService extends SBService.SBService {
|
|
|
10
10
|
super(options);
|
|
11
11
|
}
|
|
12
12
|
async getAuthorizationCode(request) {
|
|
13
|
-
const response = await super.
|
|
14
|
-
url: "/connect/authorize",
|
|
13
|
+
const response = await super.createEntity("/connect/authorize", null, null, {
|
|
15
14
|
params: {
|
|
16
15
|
response_mode: "form_post",
|
|
17
16
|
...request
|
|
@@ -23,19 +22,14 @@ class OAuthService extends SBService.SBService {
|
|
|
23
22
|
return new AuthorizationCodeResponse.AuthorizationCodeResponse(response);
|
|
24
23
|
}
|
|
25
24
|
async getToken(request) {
|
|
26
|
-
return await super.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
withCredentials: true
|
|
25
|
+
return await super.createEntity("/connect/token", qs.stringify(request), null, {
|
|
26
|
+
params: {
|
|
27
|
+
withCredentials: true
|
|
28
|
+
}
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
31
|
async refreshToken(loginRequest) {
|
|
34
|
-
return await super.
|
|
35
|
-
url: "/connect/token",
|
|
36
|
-
method: "POST",
|
|
37
|
-
data: qs.stringify(loginRequest)
|
|
38
|
-
});
|
|
32
|
+
return await super.createEntity("/connect/token", qs.stringify(loginRequest));
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthService.cjs","sources":["../../../../src/services/oauth/OAuthService.ts"],"sourcesContent":["import {\n\tSBServiceOptions,\n\tdefaultAuthServiceoptions,\n} from \"@/client/SBServiceOptions\";\nimport { SBService } from \"@/services/SBService\";\nimport { AccessTokenResponse } from \"./AccessTokenResponse\";\nimport { AuthorizationCodeResponse } from \"./AuthorizationCodeResponse\";\nimport { AuthorizeRequest } from \"./AuthorizeRequest\";\nimport { GetTokenRequest } from \"./GetTokenRequest\";\nimport { RefreshTokenRequest } from \"./RefreshTokenRequest\";\nimport qs from \"query-string\";\nexport class OAuthService extends SBService {\n\tpublic constructor(options: SBServiceOptions = defaultAuthServiceoptions) {\n\t\tsuper(options);\n\t}\n\n\tpublic async getAuthorizationCode(\n\t\trequest: AuthorizeRequest,\n\t): Promise<AuthorizationCodeResponse> {\n\t\tconst response = await super.
|
|
1
|
+
{"version":3,"file":"OAuthService.cjs","sources":["../../../../src/services/oauth/OAuthService.ts"],"sourcesContent":["import {\n\tSBServiceOptions,\n\tdefaultAuthServiceoptions,\n} from \"@/client/SBServiceOptions\";\nimport { SBService } from \"@/services/SBService\";\nimport { AccessTokenResponse } from \"./AccessTokenResponse\";\nimport { AuthorizationCodeResponse } from \"./AuthorizationCodeResponse\";\nimport { AuthorizeRequest } from \"./AuthorizeRequest\";\nimport { GetTokenRequest } from \"./GetTokenRequest\";\nimport { RefreshTokenRequest } from \"./RefreshTokenRequest\";\nimport qs from \"query-string\";\nexport class OAuthService extends SBService {\n\tpublic constructor(options: SBServiceOptions = defaultAuthServiceoptions) {\n\t\tsuper(options);\n\t}\n\n\tpublic async getAuthorizationCode(\n\t\trequest: AuthorizeRequest,\n\t): Promise<AuthorizationCodeResponse> {\n\t\tconst response = await super.createEntity<void, string>(\n\t\t\t\"/connect/authorize\",\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t{\n\t\t\t\tparams: { response_mode: \"form_post\", ...request },\n\t\t\t\theaders: {\n\t\t\t\t\t\"content-type\": \"application/x-www-form-urlencoded\",\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\treturn new AuthorizationCodeResponse(response);\n\t}\n\n\tpublic async getToken(\n\t\trequest: GetTokenRequest,\n\t): Promise<AccessTokenResponse> {\n\t\treturn await super.createEntity(\n\t\t\t\"/connect/token\",\n\t\t\tqs.stringify(request),\n\t\t\tnull,\n\t\t\t{ params: { withCredentials: true } },\n\t\t);\n\t}\n\n\tpublic async refreshToken(\n\t\tloginRequest: RefreshTokenRequest,\n\t): Promise<AccessTokenResponse> {\n\t\treturn await super.createEntity(\n\t\t\t\"/connect/token\",\n\t\t\tqs.stringify(loginRequest),\n\t\t);\n\t}\n}\n"],"names":["OAuthService","SBService","constructor","options","defaultAuthServiceoptions","getAuthorizationCode","request","response","createEntity","params","response_mode","headers","AuthorizationCodeResponse","getToken","qs","stringify","withCredentials","refreshToken","loginRequest"],"mappings":";;;;;;;AAWM,MAAOA,YAAa,SAAQC,mBAAS,CAAA;AAC1CC,EAAAA,WAAAA,CAAmBC,UAA4BC,0CAAyB,EAAA;IACvE,KAAK,CAACD,OAAO,CAAC,CAAA;AACf,GAAA;EAEO,MAAME,oBAAoBA,CAChCC,OAAyB,EAAA;AAEzB,IAAA,MAAMC,QAAQ,GAAG,MAAM,KAAK,CAACC,YAAY,CACxC,oBAAoB,EACpB,IAAI,EACJ,IAAI,EACJ;AACCC,MAAAA,MAAM,EAAE;AAAEC,QAAAA,aAAa,EAAE,WAAW;QAAE,GAAGJ,OAAAA;OAAS;AAClDK,MAAAA,OAAO,EAAE;AACR,QAAA,cAAc,EAAE,mCAAA;AAChB,OAAA;AACD,KAAA,CACD,CAAA;AACD,IAAA,OAAO,IAAIC,mDAAyB,CAACL,QAAQ,CAAC,CAAA;AAC/C,GAAA;EAEO,MAAMM,QAAQA,CACpBP,OAAwB,EAAA;AAExB,IAAA,OAAO,MAAM,KAAK,CAACE,YAAY,CAC9B,gBAAgB,EAChBM,EAAE,CAACC,SAAS,CAACT,OAAO,CAAC,EACrB,IAAI,EACJ;AAAEG,MAAAA,MAAM,EAAE;AAAEO,QAAAA,eAAe,EAAE,IAAA;AAAI,OAAA;AAAI,KAAA,CACrC,CAAA;AACF,GAAA;EAEO,MAAMC,YAAYA,CACxBC,YAAiC,EAAA;AAEjC,IAAA,OAAO,MAAM,KAAK,CAACV,YAAY,CAC9B,gBAAgB,EAChBM,EAAE,CAACC,SAAS,CAACG,YAAY,CAAC,CAC1B,CAAA;AACF,GAAA;AACA;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from '../../node_modules/@babel/runtime/helpers/esm/defineProperty.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { parse } from 'node-html-parser';
|
|
3
3
|
|
|
4
4
|
class AuthorizationCodeResponse {
|
|
5
5
|
constructor(response) {
|
|
@@ -7,7 +7,7 @@ class AuthorizationCodeResponse {
|
|
|
7
7
|
_defineProperty(this, "code", void 0);
|
|
8
8
|
_defineProperty(this, "session_state", void 0);
|
|
9
9
|
_defineProperty(this, "scope", void 0);
|
|
10
|
-
const parsedHTML =
|
|
10
|
+
const parsedHTML = parse(response);
|
|
11
11
|
this.redirectUrl = parsedHTML.querySelector("form").attributes.action;
|
|
12
12
|
const inputs = parsedHTML.querySelectorAll("input");
|
|
13
13
|
this.code = this.findInputValue(inputs, "code");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationCodeResponse.mjs","sources":["../../../../src/services/oauth/AuthorizationCodeResponse.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"AuthorizationCodeResponse.mjs","sources":["../../../../src/services/oauth/AuthorizationCodeResponse.ts"],"sourcesContent":["import { parse, HTMLElement } from \"node-html-parser\";\n\nexport class AuthorizationCodeResponse {\n\tpublic constructor(response: string) {\n\t\tconst parsedHTML = parse(response);\n\t\tthis.redirectUrl = parsedHTML.querySelector(\"form\").attributes.action;\n\t\tconst inputs = parsedHTML.querySelectorAll(\"input\");\n\t\tthis.code = this.findInputValue(inputs, \"code\");\n\t\tthis.session_state = this.findInputValue(inputs, \"session_state\");\n\t\tthis.scope = this.findInputValue(inputs, \"scope\");\n\t}\n\tprivate findInputValue(inputs: HTMLElement[], name: string) {\n\t\treturn inputs.find((x) => x.attributes.name == name).attributes.value;\n\t}\n\n\tpublic redirectUrl: string;\n\tpublic code: string;\n\tpublic session_state: string;\n\tpublic scope: string;\n}\n"],"names":["AuthorizationCodeResponse","constructor","response","_defineProperty","parsedHTML","parse","redirectUrl","querySelector","attributes","action","inputs","querySelectorAll","code","findInputValue","session_state","scope","name","find","x","value"],"mappings":";;;MAEaA,yBAAyB,CAAA;EACrCC,WAAAA,CAAmBC,QAAgB,EAAA;IAAAC,eAAA,CAAA,IAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAClC,IAAA,MAAMC,UAAU,GAAGC,KAAK,CAACH,QAAQ,CAAC,CAAA;AAClC,IAAA,IAAI,CAACI,WAAW,GAAGF,UAAU,CAACG,aAAa,CAAC,MAAM,CAAC,CAACC,UAAU,CAACC,MAAM,CAAA;AACrE,IAAA,MAAMC,MAAM,GAAGN,UAAU,CAACO,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACnD,IAAI,CAACC,IAAI,GAAG,IAAI,CAACC,cAAc,CAACH,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/C,IAAI,CAACI,aAAa,GAAG,IAAI,CAACD,cAAc,CAACH,MAAM,EAAE,eAAe,CAAC,CAAA;IACjE,IAAI,CAACK,KAAK,GAAG,IAAI,CAACF,cAAc,CAACH,MAAM,EAAE,OAAO,CAAC,CAAA;AAClD,GAAA;AACQG,EAAAA,cAAcA,CAACH,MAAqB,EAAEM,IAAY,EAAA;AACzD,IAAA,OAAON,MAAM,CAACO,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACV,UAAU,CAACQ,IAAI,IAAIA,IAAI,CAAC,CAACR,UAAU,CAACW,KAAK,CAAA;AACtE,GAAA;AAMA;;;;"}
|
|
@@ -8,8 +8,7 @@ class OAuthService extends SBService {
|
|
|
8
8
|
super(options);
|
|
9
9
|
}
|
|
10
10
|
async getAuthorizationCode(request) {
|
|
11
|
-
const response = await super.
|
|
12
|
-
url: "/connect/authorize",
|
|
11
|
+
const response = await super.createEntity("/connect/authorize", null, null, {
|
|
13
12
|
params: {
|
|
14
13
|
response_mode: "form_post",
|
|
15
14
|
...request
|
|
@@ -21,19 +20,14 @@ class OAuthService extends SBService {
|
|
|
21
20
|
return new AuthorizationCodeResponse(response);
|
|
22
21
|
}
|
|
23
22
|
async getToken(request) {
|
|
24
|
-
return await super.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
withCredentials: true
|
|
23
|
+
return await super.createEntity("/connect/token", qs.stringify(request), null, {
|
|
24
|
+
params: {
|
|
25
|
+
withCredentials: true
|
|
26
|
+
}
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
29
|
async refreshToken(loginRequest) {
|
|
32
|
-
return await super.
|
|
33
|
-
url: "/connect/token",
|
|
34
|
-
method: "POST",
|
|
35
|
-
data: qs.stringify(loginRequest)
|
|
36
|
-
});
|
|
30
|
+
return await super.createEntity("/connect/token", qs.stringify(loginRequest));
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthService.mjs","sources":["../../../../src/services/oauth/OAuthService.ts"],"sourcesContent":["import {\n\tSBServiceOptions,\n\tdefaultAuthServiceoptions,\n} from \"@/client/SBServiceOptions\";\nimport { SBService } from \"@/services/SBService\";\nimport { AccessTokenResponse } from \"./AccessTokenResponse\";\nimport { AuthorizationCodeResponse } from \"./AuthorizationCodeResponse\";\nimport { AuthorizeRequest } from \"./AuthorizeRequest\";\nimport { GetTokenRequest } from \"./GetTokenRequest\";\nimport { RefreshTokenRequest } from \"./RefreshTokenRequest\";\nimport qs from \"query-string\";\nexport class OAuthService extends SBService {\n\tpublic constructor(options: SBServiceOptions = defaultAuthServiceoptions) {\n\t\tsuper(options);\n\t}\n\n\tpublic async getAuthorizationCode(\n\t\trequest: AuthorizeRequest,\n\t): Promise<AuthorizationCodeResponse> {\n\t\tconst response = await super.
|
|
1
|
+
{"version":3,"file":"OAuthService.mjs","sources":["../../../../src/services/oauth/OAuthService.ts"],"sourcesContent":["import {\n\tSBServiceOptions,\n\tdefaultAuthServiceoptions,\n} from \"@/client/SBServiceOptions\";\nimport { SBService } from \"@/services/SBService\";\nimport { AccessTokenResponse } from \"./AccessTokenResponse\";\nimport { AuthorizationCodeResponse } from \"./AuthorizationCodeResponse\";\nimport { AuthorizeRequest } from \"./AuthorizeRequest\";\nimport { GetTokenRequest } from \"./GetTokenRequest\";\nimport { RefreshTokenRequest } from \"./RefreshTokenRequest\";\nimport qs from \"query-string\";\nexport class OAuthService extends SBService {\n\tpublic constructor(options: SBServiceOptions = defaultAuthServiceoptions) {\n\t\tsuper(options);\n\t}\n\n\tpublic async getAuthorizationCode(\n\t\trequest: AuthorizeRequest,\n\t): Promise<AuthorizationCodeResponse> {\n\t\tconst response = await super.createEntity<void, string>(\n\t\t\t\"/connect/authorize\",\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t{\n\t\t\t\tparams: { response_mode: \"form_post\", ...request },\n\t\t\t\theaders: {\n\t\t\t\t\t\"content-type\": \"application/x-www-form-urlencoded\",\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\treturn new AuthorizationCodeResponse(response);\n\t}\n\n\tpublic async getToken(\n\t\trequest: GetTokenRequest,\n\t): Promise<AccessTokenResponse> {\n\t\treturn await super.createEntity(\n\t\t\t\"/connect/token\",\n\t\t\tqs.stringify(request),\n\t\t\tnull,\n\t\t\t{ params: { withCredentials: true } },\n\t\t);\n\t}\n\n\tpublic async refreshToken(\n\t\tloginRequest: RefreshTokenRequest,\n\t): Promise<AccessTokenResponse> {\n\t\treturn await super.createEntity(\n\t\t\t\"/connect/token\",\n\t\t\tqs.stringify(loginRequest),\n\t\t);\n\t}\n}\n"],"names":["OAuthService","SBService","constructor","options","defaultAuthServiceoptions","getAuthorizationCode","request","response","createEntity","params","response_mode","headers","AuthorizationCodeResponse","getToken","qs","stringify","withCredentials","refreshToken","loginRequest"],"mappings":";;;;;AAWM,MAAOA,YAAa,SAAQC,SAAS,CAAA;AAC1CC,EAAAA,WAAAA,CAAmBC,UAA4BC,yBAAyB,EAAA;IACvE,KAAK,CAACD,OAAO,CAAC,CAAA;AACf,GAAA;EAEO,MAAME,oBAAoBA,CAChCC,OAAyB,EAAA;AAEzB,IAAA,MAAMC,QAAQ,GAAG,MAAM,KAAK,CAACC,YAAY,CACxC,oBAAoB,EACpB,IAAI,EACJ,IAAI,EACJ;AACCC,MAAAA,MAAM,EAAE;AAAEC,QAAAA,aAAa,EAAE,WAAW;QAAE,GAAGJ,OAAAA;OAAS;AAClDK,MAAAA,OAAO,EAAE;AACR,QAAA,cAAc,EAAE,mCAAA;AAChB,OAAA;AACD,KAAA,CACD,CAAA;AACD,IAAA,OAAO,IAAIC,yBAAyB,CAACL,QAAQ,CAAC,CAAA;AAC/C,GAAA;EAEO,MAAMM,QAAQA,CACpBP,OAAwB,EAAA;AAExB,IAAA,OAAO,MAAM,KAAK,CAACE,YAAY,CAC9B,gBAAgB,EAChBM,EAAE,CAACC,SAAS,CAACT,OAAO,CAAC,EACrB,IAAI,EACJ;AAAEG,MAAAA,MAAM,EAAE;AAAEO,QAAAA,eAAe,EAAE,IAAA;AAAI,OAAA;AAAI,KAAA,CACrC,CAAA;AACF,GAAA;EAEO,MAAMC,YAAYA,CACxBC,YAAiC,EAAA;AAEjC,IAAA,OAAO,MAAM,KAAK,CAACV,YAAY,CAC9B,gBAAgB,EAChBM,EAAE,CAACC,SAAS,CAACG,YAAY,CAAC,CAC1B,CAAA;AACF,GAAA;AACA;;;;"}
|
package/dist/umd/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('uuid'), require('axios'), require('query-string'), require('mime'), require('node-html-parser')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'uuid', 'axios', 'query-string', 'mime', 'node-html-parser'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Smartbills = {}, global.uuid, global.axios, global.qs, global.mime, global.
|
|
5
|
-
})(this, (function (exports, uuid, axios, qs, mime,
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Smartbills = {}, global.uuid, global.axios, global.qs, global.mime, global.nodeHtmlParser));
|
|
5
|
+
})(this, (function (exports, uuid, axios, qs, mime, nodeHtmlParser) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _typeof(o) {
|
|
8
8
|
"@babel/helpers - typeof";
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
var version = "0.0.2-alpha.
|
|
99
|
+
var version = "0.0.2-alpha.20";
|
|
100
100
|
|
|
101
101
|
const isBrowser = typeof window !== "undefined";
|
|
102
102
|
class SBInstance {
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
_defineProperty(this, "code", void 0);
|
|
552
552
|
_defineProperty(this, "session_state", void 0);
|
|
553
553
|
_defineProperty(this, "scope", void 0);
|
|
554
|
-
const parsedHTML =
|
|
554
|
+
const parsedHTML = nodeHtmlParser.parse(response);
|
|
555
555
|
this.redirectUrl = parsedHTML.querySelector("form").attributes.action;
|
|
556
556
|
const inputs = parsedHTML.querySelectorAll("input");
|
|
557
557
|
this.code = this.findInputValue(inputs, "code");
|
|
@@ -568,8 +568,7 @@
|
|
|
568
568
|
super(options);
|
|
569
569
|
}
|
|
570
570
|
async getAuthorizationCode(request) {
|
|
571
|
-
const response = await super.
|
|
572
|
-
url: "/connect/authorize",
|
|
571
|
+
const response = await super.createEntity("/connect/authorize", null, null, {
|
|
573
572
|
params: {
|
|
574
573
|
response_mode: "form_post",
|
|
575
574
|
...request
|
|
@@ -581,19 +580,14 @@
|
|
|
581
580
|
return new AuthorizationCodeResponse(response);
|
|
582
581
|
}
|
|
583
582
|
async getToken(request) {
|
|
584
|
-
return await super.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
withCredentials: true
|
|
583
|
+
return await super.createEntity("/connect/token", qs.stringify(request), null, {
|
|
584
|
+
params: {
|
|
585
|
+
withCredentials: true
|
|
586
|
+
}
|
|
589
587
|
});
|
|
590
588
|
}
|
|
591
589
|
async refreshToken(loginRequest) {
|
|
592
|
-
return await super.
|
|
593
|
-
url: "/connect/token",
|
|
594
|
-
method: "POST",
|
|
595
|
-
data: qs.stringify(loginRequest)
|
|
596
|
-
});
|
|
590
|
+
return await super.createEntity("/connect/token", qs.stringify(loginRequest));
|
|
597
591
|
}
|
|
598
592
|
}
|
|
599
593
|
|