@colijnit/ioneconnector 1.0.140 → 1.0.142
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/build/connector-auth.d.ts +1 -0
- package/build/connector-auth.js +3 -0
- package/build/connector-public.d.ts +1 -0
- package/build/connector-public.js +3 -0
- package/build/connector.d.ts +3 -0
- package/build/connector.js +21 -1
- package/build/connector.unit.test.js +12 -0
- package/build/enum/article-object-name.enum.d.ts +1 -0
- package/build/enum/article-object-name.enum.js +1 -0
- package/build/enum/hd-service-method.d.ts +1 -0
- package/build/enum/hd-service-method.js +1 -0
- package/build/ione-api-connection.d.ts +1 -0
- package/build/model/selector-structure-price.d.ts +5 -0
- package/build/model/selector-structure-price.js +6 -0
- package/build/model/session.d.ts +1 -0
- package/build/model/session.js +1 -0
- package/build/provider/ajax.service.d.ts +0 -1
- package/build/provider/ajax.service.js +9 -15
- package/build/provider/base-backend-connection.service.d.ts +3 -2
- package/build/provider/base-backend-connection.service.js +2 -1
- package/build/provider/data-repository.service.d.ts +1 -0
- package/build/provider/data-repository.service.js +11 -0
- package/build/service/datasession.service.d.ts +3 -3
- package/build/service/datasession.service.js +6 -9
- package/build/service/hd-data.service.d.ts +1 -0
- package/build/service/hd-data.service.js +16 -1
- package/build/service/login.service.d.ts +5 -0
- package/build/service/login.service.js +51 -10
- package/build/service/public.service.d.ts +3 -3
- package/build/service/public.service.js +5 -8
- package/package.json +1 -1
|
@@ -53,6 +53,7 @@ export declare class ConnectorAuth implements IoneApiConnection {
|
|
|
53
53
|
getArticleFullObject(goodId: number): Promise<ArticleFullObject>;
|
|
54
54
|
getGoodIdFromArticleNr(skuOrId: string): Promise<number>;
|
|
55
55
|
getQuestionAndAnswers(): Promise<any>;
|
|
56
|
+
getSelectorStructurePrices(): Promise<any>;
|
|
56
57
|
getDeliveryPrognosis(goodId: number, branchNr: string): Promise<any>;
|
|
57
58
|
getDeliveryPrognosisForArticle(goodId: number): Promise<any>;
|
|
58
59
|
getSelectorActiveOptionValuesPrices(): Promise<any>;
|
package/build/connector-auth.js
CHANGED
|
@@ -64,6 +64,9 @@ class ConnectorAuth {
|
|
|
64
64
|
getQuestionAndAnswers() {
|
|
65
65
|
return this.dataRepository.getQuestionAndAnswers();
|
|
66
66
|
}
|
|
67
|
+
getSelectorStructurePrices() {
|
|
68
|
+
return this.dataRepository.getSelectorStructurePrices();
|
|
69
|
+
}
|
|
67
70
|
getDeliveryPrognosis(goodId, branchNr) {
|
|
68
71
|
return this.dataRepository.getDeliveryPrognosis(goodId);
|
|
69
72
|
}
|
|
@@ -48,6 +48,7 @@ export declare class ConnectorPublic implements IoneApiConnection {
|
|
|
48
48
|
getArticleFullObject(goodId: number): Promise<ArticleFullObject>;
|
|
49
49
|
getGoodIdFromArticleNr(skuOrId: string): Promise<number>;
|
|
50
50
|
getQuestionAndAnswers(): Promise<any>;
|
|
51
|
+
getSelectorStructurePrices(): Promise<any>;
|
|
51
52
|
getDeliveryPrognosis(goodId: number, branchNr: string): Promise<any>;
|
|
52
53
|
getDeliveryPrognosisForArticle(goodId: number): Promise<any>;
|
|
53
54
|
getSelectorActiveOptionValuesPrices(): Promise<any>;
|
|
@@ -60,6 +60,9 @@ class ConnectorPublic {
|
|
|
60
60
|
getQuestionAndAnswers() {
|
|
61
61
|
return this.dataService.getSelectorActiveOptionValues();
|
|
62
62
|
}
|
|
63
|
+
getSelectorStructurePrices() {
|
|
64
|
+
return this.dataService.getSelectorStructurePrices();
|
|
65
|
+
}
|
|
63
66
|
getDeliveryPrognosis(goodId, branchNr) {
|
|
64
67
|
return this.dataService.getDeliveryPrognosis(goodId, branchNr);
|
|
65
68
|
}
|
package/build/connector.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ import { ArticleExtendedDto } from "./model/article-extended-dto";
|
|
|
36
36
|
import { InternalParam } from "./enum/internal-param.enum";
|
|
37
37
|
import { QuestionAndAnswer } from "./model/question-and-answer";
|
|
38
38
|
import { ConfiguratorStatisticsEnvironment } from "./model/configurator-statistics-environment";
|
|
39
|
+
import { SelectorStructurePrice } from "./model/selector-structure-price";
|
|
39
40
|
export declare class Connector {
|
|
40
41
|
goodId: number;
|
|
41
42
|
useWebsocket: boolean;
|
|
@@ -83,6 +84,7 @@ export declare class Connector {
|
|
|
83
84
|
getFullArticle(skuOrId: string): Promise<ArticleFullObject>;
|
|
84
85
|
getQuestionAndAnswers(): void;
|
|
85
86
|
getQuestionAndAnswersAsync(): Promise<QuestionAndAnswer>;
|
|
87
|
+
getSelectorStructurePrices(): Promise<SelectorStructurePrice[]>;
|
|
86
88
|
getSkipButtonImageAndText(goodId?: number): Promise<SkipButtonInfo>;
|
|
87
89
|
getDeliveryPrognosisForArticle(goodId: number): Promise<{}>;
|
|
88
90
|
getAnswersPrices(): Promise<AnswerPrice[]>;
|
|
@@ -137,4 +139,5 @@ export declare class Connector {
|
|
|
137
139
|
private _prepareAnswersAndImages;
|
|
138
140
|
private _handleSelectionAnswers;
|
|
139
141
|
private _applicationClose;
|
|
142
|
+
private _handleSeparatePrices;
|
|
140
143
|
}
|
package/build/connector.js
CHANGED
|
@@ -193,6 +193,7 @@ class Connector {
|
|
|
193
193
|
answers.push(answer);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
+
this._handleSeparatePrices(answers);
|
|
196
197
|
const rawQuestion = rawDatas.data && rawDatas.data.length > 0 ? rawDatas.data[0] : null;
|
|
197
198
|
const question = rawQuestion ? this.boFactory.makeWithRawBackendData(question_1.Question, rawQuestion) : null;
|
|
198
199
|
result.question = question;
|
|
@@ -200,6 +201,18 @@ class Connector {
|
|
|
200
201
|
}
|
|
201
202
|
return result;
|
|
202
203
|
}
|
|
204
|
+
async getSelectorStructurePrices() {
|
|
205
|
+
const rawData = await this.connection.getSelectorStructurePrices();
|
|
206
|
+
if (rawData) {
|
|
207
|
+
if (rawData.data && rawData.data.resultObjects && rawData.data.resultObjects.length > 0) {
|
|
208
|
+
return rawData.data.resultObjects;
|
|
209
|
+
}
|
|
210
|
+
else if (rawData[''] && rawData[''].length > 0) {
|
|
211
|
+
return rawData[''];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return [];
|
|
215
|
+
}
|
|
203
216
|
getSkipButtonImageAndText(goodId) {
|
|
204
217
|
return this.connection.getSkipButtonImageAndText(goodId);
|
|
205
218
|
}
|
|
@@ -604,7 +617,7 @@ class Connector {
|
|
|
604
617
|
return frozenart;
|
|
605
618
|
}
|
|
606
619
|
static createConnector(options, externalStorage) {
|
|
607
|
-
if (options.username && options.password) {
|
|
620
|
+
if ((options.username && options.password) || options.session) {
|
|
608
621
|
return new connector_auth_1.ConnectorAuth(options, externalStorage);
|
|
609
622
|
}
|
|
610
623
|
else {
|
|
@@ -645,5 +658,12 @@ class Connector {
|
|
|
645
658
|
});
|
|
646
659
|
selection.answerTree = JSON.stringify(answerTree);
|
|
647
660
|
}
|
|
661
|
+
_handleSeparatePrices(answers) {
|
|
662
|
+
this.getSelectorStructurePrices().then((results) => {
|
|
663
|
+
results.forEach((price) => {
|
|
664
|
+
answers.find((node) => node.id === price.id).price = price.salesAdditionalPrice;
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
}
|
|
648
668
|
}
|
|
649
669
|
exports.Connector = Connector;
|
|
@@ -14,6 +14,14 @@ const options = {
|
|
|
14
14
|
password: "patrick",
|
|
15
15
|
useLoginEncryption: true
|
|
16
16
|
};
|
|
17
|
+
const developRemoteOptions = {
|
|
18
|
+
url: "http://130.62.7.55:8888/ione/",
|
|
19
|
+
schema: "815",
|
|
20
|
+
version: "252",
|
|
21
|
+
username: "patrick",
|
|
22
|
+
password: "patrick",
|
|
23
|
+
useLoginEncryption: true
|
|
24
|
+
};
|
|
17
25
|
describe("Connector", () => {
|
|
18
26
|
let connector;
|
|
19
27
|
beforeEach(() => {
|
|
@@ -136,4 +144,8 @@ describe("Connector", () => {
|
|
|
136
144
|
const catalogDefinitions = await connector.getCatalogDefinitions();
|
|
137
145
|
expect(catalogDefinitions).toBeDefined();
|
|
138
146
|
});
|
|
147
|
+
it('getSelectorStructurePrices', async () => {
|
|
148
|
+
const prices = await connector.getSelectorStructurePrices();
|
|
149
|
+
expect(prices).toBeDefined();
|
|
150
|
+
});
|
|
139
151
|
});
|
|
@@ -2,6 +2,7 @@ export declare enum ArticledObjectName {
|
|
|
2
2
|
SelectorStructure = "SelectorStructure",
|
|
3
3
|
SelectorDeco = "SelectorDeco",
|
|
4
4
|
SelectorSelections = "SelectorSelections",
|
|
5
|
+
SelectorStructurePrices = "SelectorStructurePrices",
|
|
5
6
|
SelectorActiveOptionValuesPrices = "SelectorActiveOptionValuesPrices",
|
|
6
7
|
CoText = "CoText",
|
|
7
8
|
ArticleListObjectExtended = "ArticleListObjectExtended",
|
|
@@ -5,6 +5,7 @@ var ArticledObjectName;
|
|
|
5
5
|
ArticledObjectName["SelectorStructure"] = "SelectorStructure";
|
|
6
6
|
ArticledObjectName["SelectorDeco"] = "SelectorDeco";
|
|
7
7
|
ArticledObjectName["SelectorSelections"] = "SelectorSelections";
|
|
8
|
+
ArticledObjectName["SelectorStructurePrices"] = "SelectorStructurePrices";
|
|
8
9
|
ArticledObjectName["SelectorActiveOptionValuesPrices"] = "SelectorActiveOptionValuesPrices";
|
|
9
10
|
ArticledObjectName["CoText"] = "CoText";
|
|
10
11
|
ArticledObjectName["ArticleListObjectExtended"] = "ArticleListObjectExtended";
|
|
@@ -22,6 +22,7 @@ export declare enum HdServiceMethod {
|
|
|
22
22
|
SelectorActiveNodes = "selectorActiveNodes",
|
|
23
23
|
SelectorActiveNodesPr = "selectorActiveNodesPr",
|
|
24
24
|
SelectorStructure = "selectorStructure",
|
|
25
|
+
SelectorStructurePrices = "SelectorStructurePrices",
|
|
25
26
|
GetSelectorDeliveryDate = "getSelectorDeliveryDate",
|
|
26
27
|
GetDeliveryDate2 = "getDeliveryDate2",
|
|
27
28
|
GetStockForArtNode = "getStockForArtNode",
|
|
@@ -25,6 +25,7 @@ var HdServiceMethod;
|
|
|
25
25
|
HdServiceMethod["SelectorActiveNodes"] = "selectorActiveNodes";
|
|
26
26
|
HdServiceMethod["SelectorActiveNodesPr"] = "selectorActiveNodesPr";
|
|
27
27
|
HdServiceMethod["SelectorStructure"] = "selectorStructure";
|
|
28
|
+
HdServiceMethod["SelectorStructurePrices"] = "SelectorStructurePrices";
|
|
28
29
|
HdServiceMethod["GetSelectorDeliveryDate"] = "getSelectorDeliveryDate";
|
|
29
30
|
HdServiceMethod["GetDeliveryDate2"] = "getDeliveryDate2";
|
|
30
31
|
HdServiceMethod["GetStockForArtNode"] = "getStockForArtNode";
|
|
@@ -38,6 +38,7 @@ export interface IoneApiConnection {
|
|
|
38
38
|
getGoodIdFromArticleNr(skuOrId: string): Promise<number>;
|
|
39
39
|
getArticleFullObject(goodId: number): Promise<ArticleFullObject>;
|
|
40
40
|
getQuestionAndAnswers(): Promise<any>;
|
|
41
|
+
getSelectorStructurePrices(): Promise<any>;
|
|
41
42
|
getDeliveryPrognosis(goodId: number, branchNr: string): Promise<any>;
|
|
42
43
|
getDeliveryPrognosisForArticle(goodId: number): Promise<any>;
|
|
43
44
|
getSelectorActiveOptionValuesPrices(): Promise<any>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const business_object_1 = require("./business-object");
|
|
4
|
+
class SelectorStructurePrice extends business_object_1.BusinessObject {
|
|
5
|
+
}
|
|
6
|
+
exports.SelectorStructurePrice = SelectorStructurePrice;
|
package/build/model/session.d.ts
CHANGED
package/build/model/session.js
CHANGED
|
@@ -6,7 +6,6 @@ import { BaseBackendConnectionService } from "./base-backend-connection.service"
|
|
|
6
6
|
import { Session } from "../model/session";
|
|
7
7
|
export declare class AjaxService extends BaseBackendConnectionService {
|
|
8
8
|
private _showLoaderRequests;
|
|
9
|
-
private _timeout;
|
|
10
9
|
constructor(url: string, options: Options, session?: Session, externalStorage?: ExternalStorage, secure?: boolean);
|
|
11
10
|
call(method: string, data?: DataServiceData, showLoader?: boolean, service?: BackendServiceName): Promise<any>;
|
|
12
11
|
protected waitForLogin(): Promise<boolean>;
|
|
@@ -11,30 +11,24 @@ class AjaxService extends base_backend_connection_service_1.BaseBackendConnectio
|
|
|
11
11
|
constructor(url, options, session = undefined, externalStorage = undefined, secure = false) {
|
|
12
12
|
super(url, options, session, externalStorage, secure);
|
|
13
13
|
this._showLoaderRequests = 0;
|
|
14
|
-
this._timeout = 180000;
|
|
15
14
|
if (options && options.timeoutInMs) {
|
|
16
|
-
this.
|
|
15
|
+
this.timeout = options.timeoutInMs;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
async call(method, data = {}, showLoader = true, service = backend_service_name_enum_1.BackendServiceName.LoginService) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
service === backend_service_name_enum_1.BackendServiceName.DatasessionService) {
|
|
23
|
-
return this._doCall(method, data, showLoader, service);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
await this.waitForLogin();
|
|
27
|
-
return this._doCall(method, data, showLoader, service);
|
|
28
|
-
}
|
|
19
|
+
await this.waitForLogin();
|
|
20
|
+
return this._doCall(method, data, showLoader, service);
|
|
29
21
|
}
|
|
30
22
|
async waitForLogin() {
|
|
31
23
|
if (this.session && this.session.created) {
|
|
32
24
|
return true;
|
|
33
25
|
}
|
|
34
|
-
if (
|
|
35
|
-
await this.loginService.
|
|
26
|
+
if (this.session.loggingIn) {
|
|
27
|
+
return await this.loginService.waitForLoginToFinish();
|
|
36
28
|
}
|
|
37
|
-
|
|
29
|
+
this.session.loggingIn = true;
|
|
30
|
+
await this.loginService.loginAndCreateDataSession();
|
|
31
|
+
this.session.loggingIn = false;
|
|
38
32
|
}
|
|
39
33
|
_doCall(method, data = {}, showLoader = true, service = backend_service_name_enum_1.BackendServiceName.LoginService) {
|
|
40
34
|
if (showLoader) {
|
|
@@ -55,7 +49,7 @@ class AjaxService extends base_backend_connection_service_1.BaseBackendConnectio
|
|
|
55
49
|
method: 'post',
|
|
56
50
|
url: url,
|
|
57
51
|
data: message,
|
|
58
|
-
timeout: this.
|
|
52
|
+
timeout: this.timeout
|
|
59
53
|
}).then(response => {
|
|
60
54
|
resolve(response.data);
|
|
61
55
|
}).catch(error => {
|
|
@@ -8,11 +8,12 @@ import { ConnectionEndpoint } from "./connection-endpoint";
|
|
|
8
8
|
export declare abstract class BaseBackendConnectionService implements ConnectionEndpoint {
|
|
9
9
|
readonly showLoader: Subject<boolean>;
|
|
10
10
|
readonly connectionResetInactivity: Subject<void>;
|
|
11
|
+
timeout: number;
|
|
11
12
|
session: Session;
|
|
12
13
|
options: Options;
|
|
13
14
|
externalStorage: ExternalStorage;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
callId: string;
|
|
16
|
+
url: string;
|
|
16
17
|
protected secure: boolean;
|
|
17
18
|
protected loginService: LoginService;
|
|
18
19
|
private _datasessionService;
|
|
@@ -10,6 +10,7 @@ class BaseBackendConnectionService {
|
|
|
10
10
|
constructor(url, options, session = undefined, externalStorage = undefined, secure = false) {
|
|
11
11
|
this.showLoader = new rxjs_1.Subject();
|
|
12
12
|
this.connectionResetInactivity = new rxjs_1.Subject();
|
|
13
|
+
this.timeout = 180000;
|
|
13
14
|
this.callId = "1";
|
|
14
15
|
this.url = this.addEndpointToUrl(url);
|
|
15
16
|
this.options = options;
|
|
@@ -23,7 +24,7 @@ class BaseBackendConnectionService {
|
|
|
23
24
|
this.session = this._createNewSession();
|
|
24
25
|
}
|
|
25
26
|
this.loginService = new login_service_1.LoginService(this);
|
|
26
|
-
this._datasessionService = new datasession_service_1.DatasessionService(this);
|
|
27
|
+
this._datasessionService = new datasession_service_1.DatasessionService(this.loginService);
|
|
27
28
|
}
|
|
28
29
|
async commit() {
|
|
29
30
|
return this._datasessionService.commit();
|
|
@@ -54,6 +54,7 @@ export declare class DataRepositoryService {
|
|
|
54
54
|
getCatalogDefinitions(showLoader?: boolean): Promise<any>;
|
|
55
55
|
getInternalParameter(parameter: InternalParam): Promise<string>;
|
|
56
56
|
getQuestionAndAnswers(): Promise<any>;
|
|
57
|
+
getSelectorStructurePrices(): Promise<DataServiceResponseRoot>;
|
|
57
58
|
initNode(id: any): Promise<any>;
|
|
58
59
|
initNodeInstance(id: any): Promise<any>;
|
|
59
60
|
changeConnection(oldConnection: string, newConnection: string): Promise<any>;
|
|
@@ -331,6 +331,14 @@ class DataRepositoryService {
|
|
|
331
331
|
getQuestionAndAnswers() {
|
|
332
332
|
return this.getSelectorActiveOptionValues();
|
|
333
333
|
}
|
|
334
|
+
getSelectorStructurePrices() {
|
|
335
|
+
const data = {
|
|
336
|
+
objectName: article_object_name_enum_1.ArticledObjectName.SelectorStructurePrices,
|
|
337
|
+
moduleName: module_name_enum_1.ModuleName.Articles,
|
|
338
|
+
refCursorAsArray: true
|
|
339
|
+
};
|
|
340
|
+
return this.call(data, data_service_method_enum_1.DataServiceMethod.SelectMultipleObjects);
|
|
341
|
+
}
|
|
334
342
|
initNode(id) {
|
|
335
343
|
return new Promise((resolve, reject) => {
|
|
336
344
|
const params = { goodId: id, pubicationCode: 4 };
|
|
@@ -841,6 +849,9 @@ class DataRepositoryService {
|
|
|
841
849
|
moduleName: module_name_enum_1.ModuleName.Articles,
|
|
842
850
|
refCursorAsArray: true
|
|
843
851
|
};
|
|
852
|
+
data.parameterValues = {
|
|
853
|
+
doCalculatePrices: false
|
|
854
|
+
};
|
|
844
855
|
return this.call(data, data_service_method_enum_1.DataServiceMethod.SelectMultipleObjects);
|
|
845
856
|
}
|
|
846
857
|
callSelectorSelections() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoginService } from './login.service';
|
|
2
2
|
export declare class DatasessionService {
|
|
3
|
-
protected
|
|
4
|
-
constructor(
|
|
3
|
+
protected loginService: LoginService;
|
|
4
|
+
constructor(loginService: LoginService);
|
|
5
5
|
createDataSession(id: string): Promise<any>;
|
|
6
6
|
commit(): Promise<boolean>;
|
|
7
7
|
private _call;
|
|
@@ -3,23 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const backend_service_name_enum_1 = require("../enum/backend-service-name.enum");
|
|
4
4
|
const datasession_service_method_enum_1 = require("../enum/datasession-service-method.enum");
|
|
5
5
|
class DatasessionService {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
6
|
+
constructor(loginService) {
|
|
7
|
+
this.loginService = loginService;
|
|
8
8
|
}
|
|
9
9
|
createDataSession(id) {
|
|
10
|
-
return this._call(datasession_service_method_enum_1.DatasessionServiceMethod.OpenDataSession, { moduleName: id }
|
|
10
|
+
return this._call(datasession_service_method_enum_1.DatasessionServiceMethod.OpenDataSession, { moduleName: id });
|
|
11
11
|
}
|
|
12
12
|
async commit() {
|
|
13
|
-
return await this._call(datasession_service_method_enum_1.DatasessionServiceMethod.Commit, {}
|
|
13
|
+
return await this._call(datasession_service_method_enum_1.DatasessionServiceMethod.Commit, {});
|
|
14
14
|
}
|
|
15
|
-
_call(method, data
|
|
15
|
+
_call(method, data) {
|
|
16
16
|
if (data === undefined) {
|
|
17
17
|
data = {};
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
showLoader = true;
|
|
21
|
-
}
|
|
22
|
-
return this.backendConnection.call(method, data, showLoader, backend_service_name_enum_1.BackendServiceName.DatasessionService);
|
|
19
|
+
return this.loginService.call(method, data, backend_service_name_enum_1.BackendServiceName.DatasessionService);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
exports.DatasessionService = DatasessionService;
|
|
@@ -57,6 +57,7 @@ export declare class HdDataService {
|
|
|
57
57
|
getSelectorActiveOptionValues(): Promise<any>;
|
|
58
58
|
getSelectorActiveOptionValuesPrices(): Promise<any>;
|
|
59
59
|
private getSelectorStructure;
|
|
60
|
+
getSelectorStructurePrices(): Promise<string>;
|
|
60
61
|
getDeliveryPrognosis(goodId: number, branchNr?: string): Promise<any>;
|
|
61
62
|
getDeliveryDate2(params: any, branchNr?: string): Promise<any>;
|
|
62
63
|
getStockForArtNode(branchNo: string, selNodeId: number): Promise<number>;
|
|
@@ -320,7 +320,7 @@ class HdDataService {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
async getSelectorStructure() {
|
|
323
|
-
const params = { instanceId: this._instanceId };
|
|
323
|
+
const params = { instanceId: this._instanceId, doCalculatePrices: false };
|
|
324
324
|
const data = { ...this.createServiceRequestData(), parameterValues: params };
|
|
325
325
|
const response = await this._sessionService.call(hd_service_method_1.HdServiceMethod.SelectorStructure, data)
|
|
326
326
|
.catch((e) => {
|
|
@@ -335,6 +335,21 @@ class HdDataService {
|
|
|
335
335
|
return null;
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
+
async getSelectorStructurePrices() {
|
|
339
|
+
const params = { instanceId: this._instanceId };
|
|
340
|
+
const data = { ...this.createServiceRequestData(), parameterValues: params };
|
|
341
|
+
const response = await this._sessionService.call(hd_service_method_1.HdServiceMethod.SelectorStructurePrices, data)
|
|
342
|
+
.catch((e) => {
|
|
343
|
+
return Promise.reject(e);
|
|
344
|
+
});
|
|
345
|
+
const result = response.data;
|
|
346
|
+
if (result.validationResult && result.validationResult.success) {
|
|
347
|
+
return result.resultObject;
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
338
353
|
async getDeliveryPrognosis(goodId, branchNr) {
|
|
339
354
|
const params = { instanceId: this._instanceId };
|
|
340
355
|
const data = { ...this.createServiceRequestData(), parameterValues: params };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { BackendServiceName } from "../enum/backend-service-name.enum";
|
|
1
2
|
import { Login } from "../model/login";
|
|
2
3
|
import { BaseBackendConnectionService } from "../provider/base-backend-connection.service";
|
|
4
|
+
import { DataServiceData } from '../model/data-service-data';
|
|
3
5
|
export declare class LoginService {
|
|
4
6
|
private static HEARTBEAT_INTERVAL_MS;
|
|
5
7
|
initialized: boolean;
|
|
@@ -13,9 +15,12 @@ export declare class LoginService {
|
|
|
13
15
|
private _useEncryption;
|
|
14
16
|
private _publicService;
|
|
15
17
|
private _datasessionService;
|
|
18
|
+
private _dataSessionCreated;
|
|
16
19
|
constructor(backendConnection: BaseBackendConnectionService);
|
|
17
20
|
loginAndCreateDataSession(): Promise<any>;
|
|
21
|
+
waitForLoginToFinish(): Promise<boolean>;
|
|
18
22
|
logout(): Promise<any>;
|
|
23
|
+
call(method: string, data?: DataServiceData, service?: BackendServiceName): Promise<any>;
|
|
19
24
|
private _login;
|
|
20
25
|
private _startHeartBeat;
|
|
21
26
|
private _stopHeartBeat;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const login_service_method_enum_1 = require("../enum/login-service-method.enum");
|
|
4
7
|
const backend_service_name_enum_1 = require("../enum/backend-service-name.enum");
|
|
@@ -6,6 +9,9 @@ const login_1 = require("../model/login");
|
|
|
6
9
|
const encrypt_service_1 = require("./encrypt.service");
|
|
7
10
|
const public_service_1 = require("./public.service");
|
|
8
11
|
const datasession_service_1 = require("./datasession.service");
|
|
12
|
+
const rxjs_1 = require("rxjs");
|
|
13
|
+
const url_utils_1 = require("../utils/url-utils");
|
|
14
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
15
|
class LoginService {
|
|
10
16
|
constructor(backendConnection) {
|
|
11
17
|
this.initialized = false;
|
|
@@ -13,6 +19,7 @@ class LoginService {
|
|
|
13
19
|
this.loggingOut = false;
|
|
14
20
|
this.windowsSessionId = 1;
|
|
15
21
|
this._useEncryption = false;
|
|
22
|
+
this._dataSessionCreated = new rxjs_1.Subject();
|
|
16
23
|
this.backendConnection = backendConnection;
|
|
17
24
|
this.loginModel = new login_1.Login();
|
|
18
25
|
if (this.backendConnection.options.schema === "") {
|
|
@@ -30,8 +37,8 @@ class LoginService {
|
|
|
30
37
|
this.loginModel.clientLanguage = this.backendConnection.options.languageCode;
|
|
31
38
|
this._useEncryption = this.backendConnection.options.useLoginEncryption;
|
|
32
39
|
this._encryptionService = new encrypt_service_1.EncryptService();
|
|
33
|
-
this._publicService = new public_service_1.PublicService(this
|
|
34
|
-
this._datasessionService = new datasession_service_1.DatasessionService(this
|
|
40
|
+
this._publicService = new public_service_1.PublicService(this, this._encryptionService);
|
|
41
|
+
this._datasessionService = new datasession_service_1.DatasessionService(this);
|
|
35
42
|
}
|
|
36
43
|
loginAndCreateDataSession() {
|
|
37
44
|
this.loggingIn = true;
|
|
@@ -43,6 +50,7 @@ class LoginService {
|
|
|
43
50
|
if (response.data === true) {
|
|
44
51
|
this.backendConnection.session.created = true;
|
|
45
52
|
this.loggingIn = false;
|
|
53
|
+
this._dataSessionCreated.next();
|
|
46
54
|
this._startHeartBeat();
|
|
47
55
|
resolve();
|
|
48
56
|
}
|
|
@@ -61,13 +69,49 @@ class LoginService {
|
|
|
61
69
|
});
|
|
62
70
|
});
|
|
63
71
|
}
|
|
72
|
+
async waitForLoginToFinish() {
|
|
73
|
+
return new Promise((resolve) => {
|
|
74
|
+
this._dataSessionCreated.subscribe(() => {
|
|
75
|
+
resolve(true);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
64
79
|
logout() {
|
|
65
80
|
this.loggingOut = true;
|
|
66
|
-
return this._call(login_service_method_enum_1.LoginServiceMethod.LogoutUser, {}
|
|
81
|
+
return this._call(login_service_method_enum_1.LoginServiceMethod.LogoutUser, {}).then((userData) => {
|
|
67
82
|
this.loggingOut = false;
|
|
68
83
|
this._stopHeartBeat();
|
|
69
84
|
});
|
|
70
85
|
}
|
|
86
|
+
call(method, data = {}, service = backend_service_name_enum_1.BackendServiceName.LoginService) {
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
const url = url_utils_1.UrlUtils.createReadableUrl(method, data, this.backendConnection.url);
|
|
89
|
+
const message = JSON.stringify({
|
|
90
|
+
service: service,
|
|
91
|
+
method: method,
|
|
92
|
+
id: this.backendConnection.callId,
|
|
93
|
+
data: data,
|
|
94
|
+
dataSessionId: this.backendConnection.session ? this.backendConnection.session.dataSessionId : "",
|
|
95
|
+
windowSessionId: this.backendConnection.session ? this.backendConnection.session.windowsId : "1",
|
|
96
|
+
sessionId: this.backendConnection.session ? this.backendConnection.session.id : ""
|
|
97
|
+
});
|
|
98
|
+
axios_1.default({
|
|
99
|
+
method: 'post',
|
|
100
|
+
url: url,
|
|
101
|
+
data: message,
|
|
102
|
+
timeout: this.backendConnection.timeout
|
|
103
|
+
}).then(response => {
|
|
104
|
+
resolve(response.data);
|
|
105
|
+
}).catch(error => {
|
|
106
|
+
if (error.code === "ECONNABORTED") {
|
|
107
|
+
reject("ECONNABORTED");
|
|
108
|
+
}
|
|
109
|
+
reject(error);
|
|
110
|
+
});
|
|
111
|
+
}).then(response => {
|
|
112
|
+
return new Promise((resolve) => { return resolve(response); });
|
|
113
|
+
});
|
|
114
|
+
}
|
|
71
115
|
_login() {
|
|
72
116
|
return new Promise((resolve, reject) => {
|
|
73
117
|
this._callLogin()
|
|
@@ -92,7 +136,7 @@ class LoginService {
|
|
|
92
136
|
_startHeartBeat() {
|
|
93
137
|
if (!this.heartbeatTimer) {
|
|
94
138
|
this.heartbeatTimer = setInterval(() => {
|
|
95
|
-
this._call(login_service_method_enum_1.LoginServiceMethod.GetHeartBeat, {}
|
|
139
|
+
this._call(login_service_method_enum_1.LoginServiceMethod.GetHeartBeat, {});
|
|
96
140
|
}, LoginService.HEARTBEAT_INTERVAL_MS);
|
|
97
141
|
}
|
|
98
142
|
}
|
|
@@ -118,17 +162,14 @@ class LoginService {
|
|
|
118
162
|
}
|
|
119
163
|
_callLogin() {
|
|
120
164
|
return this._checkEncryption().then(() => {
|
|
121
|
-
return this._call(login_service_method_enum_1.LoginServiceMethod.Login, this.loginModel.getSerialized()
|
|
165
|
+
return this._call(login_service_method_enum_1.LoginServiceMethod.Login, this.loginModel.getSerialized());
|
|
122
166
|
});
|
|
123
167
|
}
|
|
124
|
-
_call(method, data
|
|
168
|
+
_call(method, data) {
|
|
125
169
|
if (data === undefined) {
|
|
126
170
|
data = {};
|
|
127
171
|
}
|
|
128
|
-
|
|
129
|
-
showLoader = true;
|
|
130
|
-
}
|
|
131
|
-
return this.backendConnection.call(method, data, showLoader, backend_service_name_enum_1.BackendServiceName.LoginService);
|
|
172
|
+
return this.call(method, data, backend_service_name_enum_1.BackendServiceName.LoginService);
|
|
132
173
|
}
|
|
133
174
|
}
|
|
134
175
|
exports.LoginService = LoginService;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BaseBackendConnectionService } from '../provider/base-backend-connection.service';
|
|
2
1
|
import { EncryptService } from './encrypt.service';
|
|
2
|
+
import { LoginService } from './login.service';
|
|
3
3
|
export declare class PublicService {
|
|
4
|
-
protected
|
|
4
|
+
protected loginService: LoginService;
|
|
5
5
|
private _encryptionService;
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(loginService: LoginService, encryptionService: EncryptService);
|
|
7
7
|
getPublicKey(): Promise<void>;
|
|
8
8
|
private _call;
|
|
9
9
|
}
|
|
@@ -3,26 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const backend_service_name_enum_1 = require("../enum/backend-service-name.enum");
|
|
4
4
|
const public_service_method_enum_1 = require("../enum/public-service-method.enum");
|
|
5
5
|
class PublicService {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
6
|
+
constructor(loginService, encryptionService) {
|
|
7
|
+
this.loginService = loginService;
|
|
8
8
|
this._encryptionService = encryptionService;
|
|
9
9
|
}
|
|
10
10
|
getPublicKey() {
|
|
11
11
|
return new Promise((resolve) => {
|
|
12
|
-
this._call(public_service_method_enum_1.PublicServiceMethod.GetPublicKey, {}
|
|
12
|
+
this._call(public_service_method_enum_1.PublicServiceMethod.GetPublicKey, {}).then((result) => {
|
|
13
13
|
this._encryptionService.publicKey = result.data;
|
|
14
14
|
resolve();
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
_call(method, data
|
|
18
|
+
_call(method, data) {
|
|
19
19
|
if (data === undefined) {
|
|
20
20
|
data = {};
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
showLoader = true;
|
|
24
|
-
}
|
|
25
|
-
return this.backendConnection.call(method, data, showLoader, backend_service_name_enum_1.BackendServiceName.PublicService);
|
|
22
|
+
return this.loginService.call(method, data, backend_service_name_enum_1.BackendServiceName.PublicService);
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
exports.PublicService = PublicService;
|