@colijnit/articleapi 255.1.5 → 255.1.6
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/articles.d.ts +3 -1
- package/build/articles.js +43 -41
- package/build/interface/json-article-flat-tree.interface.d.ts +7 -0
- package/build/interface/json-article-flat-tree.interface.js +1 -0
- package/build/model/article-flat-tree.bo.d.ts +2 -0
- package/build/model/article-flat-tree.bo.js +5 -0
- package/package.json +2 -2
package/build/articles.d.ts
CHANGED
|
@@ -113,7 +113,9 @@ export declare class Articles {
|
|
|
113
113
|
storeCatFarmCompositionArticle(catalogId: number, articleFlatTree: ArticleFlatTreeDTO): Promise<DataServiceResponseData>;
|
|
114
114
|
getArticleListWithBarcodeArticleNrEanCode(searchString: string, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
115
115
|
getJsonConfiguredArticles(configuratorStatistics?: ConfiguratorStatisticsEnvironment, showLoader?: boolean, instanceId?: number): Promise<DataServiceResponseData>;
|
|
116
|
-
getJsonArticleFlatTree(goodId: number, goodType: string, quantity: number, showLoader?: boolean, instanceId?: number, configuratorStatistics?: ConfiguratorStatisticsEnvironment): Promise<string>;
|
|
116
|
+
getJsonArticleFlatTree(goodId: number, goodType: string, quantity: number, externalSource?: boolean, showLoader?: boolean, instanceId?: number, configuratorStatistics?: ConfiguratorStatisticsEnvironment): Promise<string>;
|
|
117
117
|
static createConnector(isPublicSession: boolean, sessionExists: boolean): IoneApiArticles;
|
|
118
|
+
private _getFrozenArticle;
|
|
119
|
+
private _getArticleFlatTree;
|
|
118
120
|
private _handleConnectionReset;
|
|
119
121
|
}
|
package/build/articles.js
CHANGED
|
@@ -13,6 +13,7 @@ import { ArticlesPublic } from './articles-public';
|
|
|
13
13
|
import { Connector } from '@colijnit/ioneconnector/build/connector';
|
|
14
14
|
import { SelectorArticle } from './model/selector-article';
|
|
15
15
|
import { BusinessObjectFactory } from '@colijnit/ioneconnector/build/service/business-object-factory';
|
|
16
|
+
import { ArticleFlatTreeDTO } from "./model/article-flat-tree.bo";
|
|
16
17
|
export class Articles {
|
|
17
18
|
constructor(options) {
|
|
18
19
|
this.showLoader = new Subject();
|
|
@@ -259,54 +260,24 @@ export class Articles {
|
|
|
259
260
|
getJsonConfiguredArticles(configuratorStatistics, showLoader = true, instanceId = undefined) {
|
|
260
261
|
return this.articles.getFrozenArticle(configuratorStatistics, showLoader, instanceId);
|
|
261
262
|
}
|
|
262
|
-
getJsonArticleFlatTree(goodId, goodType, quantity, showLoader = true, instanceId = undefined, configuratorStatistics) {
|
|
263
|
+
getJsonArticleFlatTree(goodId, goodType, quantity, externalSource = false, showLoader = true, instanceId = undefined, configuratorStatistics) {
|
|
263
264
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
264
|
-
const returnObject = { goodId:
|
|
265
|
-
returnObject.baseGoodId = goodId;
|
|
266
|
-
returnObject.selectorData = {};
|
|
267
|
-
returnObject.quantity = quantity;
|
|
265
|
+
const returnObject = { goodId: goodId, baseGoodId: goodId, selectorData: {}, quantity: quantity, articleTree: {} };
|
|
268
266
|
if (goodType === 'B') {
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
const articles = this.boFactory.makeBOArrayFromRawBackendDataArray(SelectorArticle, rawArray);
|
|
273
|
-
const composedArticle = !!articles[0].compositionArticleNo;
|
|
274
|
-
let frozenart;
|
|
275
|
-
frozenart = this.boFactory.makeWithRawBackendData(SelectorArticle, articles[0]);
|
|
276
|
-
if (composedArticle) {
|
|
277
|
-
frozenart.compositions = [];
|
|
278
|
-
frozenart.compositions.push(articles);
|
|
279
|
-
}
|
|
280
|
-
const selectorDataObject = frozenart;
|
|
281
|
-
returnObject.goodId = (selectorDataObject.hasOwnProperty('compositionGoodId') &&
|
|
282
|
-
selectorDataObject['compositionGoodId'] !== undefined &&
|
|
283
|
-
selectorDataObject['compositionGoodId'] !== null) ? selectorDataObject['compositionGoodId'] : selectorDataObject.goodId;
|
|
284
|
-
returnObject.selectorData = selectorDataObject;
|
|
285
|
-
const articleFlatTreeResponse = yield this.articles.getJsonArticleFlatTree(returnObject.goodId, showLoader);
|
|
286
|
-
if (articleFlatTreeResponse && articleFlatTreeResponse.validationResult && articleFlatTreeResponse.validationResult.success) {
|
|
287
|
-
if (articleFlatTreeResponse.resultObject) {
|
|
288
|
-
returnObject.articleTree = articleFlatTreeResponse.resultObject;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
reject(articleFlatTreeResponse);
|
|
293
|
-
}
|
|
267
|
+
const frozenArt = yield this._getFrozenArticle(instanceId, configuratorStatistics, showLoader);
|
|
268
|
+
if (!frozenArt) {
|
|
269
|
+
reject("");
|
|
294
270
|
}
|
|
295
|
-
|
|
296
|
-
|
|
271
|
+
returnObject.goodId = (frozenArt.hasOwnProperty('compositionGoodId') &&
|
|
272
|
+
frozenArt['compositionGoodId'] !== undefined &&
|
|
273
|
+
frozenArt['compositionGoodId'] !== null) ? frozenArt['compositionGoodId'] : frozenArt.goodId;
|
|
274
|
+
returnObject.selectorData = frozenArt;
|
|
275
|
+
if (externalSource) {
|
|
276
|
+
returnObject.articleTree = yield this._getArticleFlatTree(returnObject.goodId, showLoader);
|
|
297
277
|
}
|
|
298
278
|
}
|
|
299
279
|
else {
|
|
300
280
|
returnObject.goodId = goodId;
|
|
301
|
-
const articleFlatTreeResponse = yield this.articles.getJsonArticleFlatTree(returnObject.goodId, showLoader);
|
|
302
|
-
if (articleFlatTreeResponse && articleFlatTreeResponse.validationResult && articleFlatTreeResponse.validationResult.success) {
|
|
303
|
-
if (articleFlatTreeResponse.resultObject) {
|
|
304
|
-
returnObject.articleTree = articleFlatTreeResponse.resultObject;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
reject(articleFlatTreeResponse);
|
|
309
|
-
}
|
|
310
281
|
}
|
|
311
282
|
resolve(JSON.stringify(returnObject));
|
|
312
283
|
}));
|
|
@@ -317,6 +288,37 @@ export class Articles {
|
|
|
317
288
|
}
|
|
318
289
|
return new ArticlesPublic();
|
|
319
290
|
}
|
|
291
|
+
_getFrozenArticle(instanceId, configuratorStatistics, showLoader) {
|
|
292
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
const frozenArticleResponse = yield this.articles.getFrozenArticle(configuratorStatistics, showLoader, instanceId);
|
|
294
|
+
if (frozenArticleResponse && frozenArticleResponse.validationResult && frozenArticleResponse.validationResult.success) {
|
|
295
|
+
const rawArray = frozenArticleResponse.resultObject;
|
|
296
|
+
const articles = this.boFactory.makeBOArrayFromRawBackendDataArray(SelectorArticle, rawArray);
|
|
297
|
+
const composedArticle = !!articles[0].compositionArticleNo;
|
|
298
|
+
let frozenart;
|
|
299
|
+
frozenart = this.boFactory.makeWithRawBackendData(SelectorArticle, articles[0]);
|
|
300
|
+
if (composedArticle) {
|
|
301
|
+
frozenart.compositions = [];
|
|
302
|
+
frozenart.compositions.push(articles);
|
|
303
|
+
}
|
|
304
|
+
return frozenart;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
_getArticleFlatTree(goodId, showLoader) {
|
|
312
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
313
|
+
const articleFlatTreeResponse = yield this.articles.getJsonArticleFlatTree(goodId, showLoader);
|
|
314
|
+
if (articleFlatTreeResponse && articleFlatTreeResponse.validationResult && articleFlatTreeResponse.validationResult.success) {
|
|
315
|
+
if (articleFlatTreeResponse.resultObject) {
|
|
316
|
+
return this.boFactory.makeWithRawBackendData(ArticleFlatTreeDTO, articleFlatTreeResponse.resultObject);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return null;
|
|
320
|
+
});
|
|
321
|
+
}
|
|
320
322
|
_handleConnectionReset() {
|
|
321
323
|
this.connectionResetInactivity.next();
|
|
322
324
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import { CompositeGood } from "./composite-good";
|
|
|
5
5
|
import { ArticlePriceList } from "./article-price-list";
|
|
6
6
|
import { PriceListInfo } from "./price-list-info";
|
|
7
7
|
import { CoDocument } from "./co-document.bo";
|
|
8
|
+
import { CoText } from '@colijnit/mainapi/build/model/co-text';
|
|
8
9
|
export declare class ArticleFlatTreeDTO extends BusinessObject {
|
|
9
10
|
article: ArticleFlat;
|
|
10
11
|
subArticles: ArticleFlat[];
|
|
@@ -14,4 +15,5 @@ export declare class ArticleFlatTreeDTO extends BusinessObject {
|
|
|
14
15
|
priceLists: PriceListInfo[];
|
|
15
16
|
supplierIdToNumber: Object;
|
|
16
17
|
documents: CoDocument[];
|
|
18
|
+
articleTexts: CoText[];
|
|
17
19
|
}
|
|
@@ -13,6 +13,7 @@ import { PriceListInfo } from "./price-list-info";
|
|
|
13
13
|
import { CoDocument } from "./co-document.bo";
|
|
14
14
|
import { ComplexField } from "@colijnit/ioneconnector/build/factory/decorators/complex-field.decorator";
|
|
15
15
|
import { ComplexArray } from "@colijnit/ioneconnector/build/factory/decorators/complex-array.decorator";
|
|
16
|
+
import { CoText } from '@colijnit/mainapi/build/model/co-text';
|
|
16
17
|
export class ArticleFlatTreeDTO extends BusinessObject {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
@@ -23,6 +24,7 @@ export class ArticleFlatTreeDTO extends BusinessObject {
|
|
|
23
24
|
this.priceLists = [];
|
|
24
25
|
this.supplierIdToNumber = {};
|
|
25
26
|
this.documents = [];
|
|
27
|
+
this.articleTexts = [];
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
__decorate([
|
|
@@ -46,3 +48,6 @@ __decorate([
|
|
|
46
48
|
__decorate([
|
|
47
49
|
ComplexArray(CoDocument)
|
|
48
50
|
], ArticleFlatTreeDTO.prototype, "documents", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
ComplexArray(CoText)
|
|
53
|
+
], ArticleFlatTreeDTO.prototype, "articleTexts", void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colijnit/articleapi",
|
|
3
|
-
"version": "255.1.
|
|
3
|
+
"version": "255.1.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "grunt clean && tsc",
|
|
6
6
|
"browserify": "browserify build/connector.js --s colijn -o dist/out-tsc/bundle.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"unit": "jest unit",
|
|
14
14
|
"integration": "jest int"
|
|
15
15
|
},
|
|
16
|
-
"description": "public api for ione backend specific for articles and version 2.5.
|
|
16
|
+
"description": "public api for ione backend specific for articles and version 2.5.5.",
|
|
17
17
|
"repository": "npm/npm",
|
|
18
18
|
"author": "Colijn IT",
|
|
19
19
|
"license": "ISC",
|