@colijnit/articleapi 262.1.3 → 262.1.4
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
CHANGED
|
@@ -118,6 +118,7 @@ export declare class Articles {
|
|
|
118
118
|
getArticleListWithBarcodeArticleNrEanCode(searchString: string, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
119
119
|
getCategoryTypes(): Promise<DataServiceResponseData>;
|
|
120
120
|
getCategoryDesigns(): Promise<DataServiceResponseData>;
|
|
121
|
+
prepareArticleForCart(userType: string, transactionType: string, domain: string, goodId: number, shouldGetArticleTree?: boolean, quantity?: number, instanceId?: string, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
121
122
|
getJsonConfiguredArticles(configuratorStatistics?: ConfiguratorStatisticsEnvironment, showLoader?: boolean, instanceId?: string): Promise<DataServiceResponseData>;
|
|
122
123
|
getJsonArticleFlatTree(goodId: number, goodType: string, quantity: number, externalSource?: boolean, showLoader?: boolean, instanceId?: string, configuratorStatistics?: ConfiguratorStatisticsEnvironment): Promise<string>;
|
|
123
124
|
getGeneratedArtDirectly(goodId: number, showLoader: boolean): Promise<string>;
|
|
@@ -129,8 +130,10 @@ export declare class Articles {
|
|
|
129
130
|
getFileUploadComplete(uploadId: string, uploadType: string): Promise<DataServiceResponseData>;
|
|
130
131
|
cancelFileUpload(uploadId: string, uploadType: string): Promise<DataServiceResponseData>;
|
|
131
132
|
getConversionUnitsForDefaultArticleUnitByGoodIdAndTransactionKind(goodId: number, transactionKind: string): Promise<DataServiceResponseData>;
|
|
133
|
+
private _getJSONFromArticleObject;
|
|
132
134
|
convertAmountByUnitCodeToDefaultUnitOfArticle(request: ConvertQuantityToDefaultUnitRequest): Promise<DataServiceResponseData>;
|
|
133
135
|
private _getFrozenArticle;
|
|
134
136
|
private _getArticleFlatTree;
|
|
135
137
|
private _getGeneratedArtDirectly;
|
|
138
|
+
private _getArticleFullObject;
|
|
136
139
|
}
|
package/build/articles.js
CHANGED
|
@@ -11,9 +11,13 @@ import { ArticlesAuth } from './articles-auth';
|
|
|
11
11
|
import { Subject } from 'rxjs';
|
|
12
12
|
import { ArticlesPublic } from './articles-public';
|
|
13
13
|
import { Connector } from '@colijnit/ioneconnector/build/connector';
|
|
14
|
+
import { ConfiguratorStatisticsEnvironment } from './model/configurator-statistics-environment';
|
|
14
15
|
import { SelectorArticle } from './model/selector-article';
|
|
16
|
+
import { DataServiceResponseData } from '@colijnit/ioneconnector/build/model/data-service-response-data';
|
|
15
17
|
import { BusinessObjectFactory } from '@colijnit/ioneconnector/build/service/business-object-factory';
|
|
16
18
|
import { ArticleFlatTreeDTO } from './model/article-flat-tree.bo';
|
|
19
|
+
import { ArticleFullObject } from './model/article-full-object';
|
|
20
|
+
import { GoodType } from './enum/refcode/good-type.enum';
|
|
17
21
|
export class Articles {
|
|
18
22
|
constructor(options) {
|
|
19
23
|
this.showLoader = new Subject();
|
|
@@ -276,6 +280,35 @@ export class Articles {
|
|
|
276
280
|
getCategoryDesigns() {
|
|
277
281
|
return this.articles.getCategoryDesigns();
|
|
278
282
|
}
|
|
283
|
+
prepareArticleForCart(userType_1, transactionType_1, domain_1, goodId_1) {
|
|
284
|
+
return __awaiter(this, arguments, void 0, function* (userType, transactionType, domain, goodId, shouldGetArticleTree = false, quantity = 1, instanceId = undefined, showLoader = true) {
|
|
285
|
+
if (goodId) {
|
|
286
|
+
const article = yield this._getArticleFullObject(goodId, showLoader);
|
|
287
|
+
const goodType = article.goodType;
|
|
288
|
+
let returnArticle;
|
|
289
|
+
if (goodType === GoodType.BaseArticle) {
|
|
290
|
+
if (article.isConfigurable) {
|
|
291
|
+
returnArticle = yield this._getJSONFromArticleObject(userType, transactionType, domain, article, quantity, shouldGetArticleTree, showLoader, instanceId);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
returnArticle = this.boFactory.makeWithRawBackendData(ArticleFullObject, article);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
if (shouldGetArticleTree) {
|
|
299
|
+
returnArticle = yield this._getJSONFromArticleObject(userType, transactionType, domain, article, quantity, shouldGetArticleTree, showLoader);
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
returnArticle = this.boFactory.makeWithRawBackendData(ArticleFullObject, article);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (returnArticle) {
|
|
306
|
+
return Promise.resolve(new DataServiceResponseData({ resultObject: returnArticle, validationResult: { success: true } }));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return Promise.resolve(new DataServiceResponseData({ validationResult: { success: false, messages: ['UNKNOWN_ERROR'] } }));
|
|
310
|
+
});
|
|
311
|
+
}
|
|
279
312
|
getJsonConfiguredArticles(configuratorStatistics, showLoader = true, instanceId = undefined) {
|
|
280
313
|
return this.articles.getFrozenArticle(configuratorStatistics, showLoader, instanceId);
|
|
281
314
|
}
|
|
@@ -350,6 +383,18 @@ export class Articles {
|
|
|
350
383
|
getConversionUnitsForDefaultArticleUnitByGoodIdAndTransactionKind(goodId, transactionKind) {
|
|
351
384
|
return this.articles.getConversionUnitsForDefaultArticleUnitByGoodIdAndTransactionKind(goodId, transactionKind);
|
|
352
385
|
}
|
|
386
|
+
_getJSONFromArticleObject(userType_1, transactionType_1, domain_1, article_1, quantity_1) {
|
|
387
|
+
return __awaiter(this, arguments, void 0, function* (userType, transactionType, domain, article, quantity, shouldGetArticleTree = false, showLoader = true, instanceId = undefined) {
|
|
388
|
+
const configuratorStatistics = new ConfiguratorStatisticsEnvironment();
|
|
389
|
+
configuratorStatistics.userType = userType;
|
|
390
|
+
configuratorStatistics.transactionType = transactionType;
|
|
391
|
+
configuratorStatistics.actionDomain = domain;
|
|
392
|
+
configuratorStatistics.sessionId = this._connector.getSessionId() ? this._connector.getSessionId() : 'unknown';
|
|
393
|
+
configuratorStatistics.webHost = window.location.host;
|
|
394
|
+
configuratorStatistics.bundleHost = window.location.host;
|
|
395
|
+
return yield this.getJsonArticleFlatTree(article.goodId, article.goodType, quantity, shouldGetArticleTree, showLoader, instanceId, configuratorStatistics);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
353
398
|
convertAmountByUnitCodeToDefaultUnitOfArticle(request) {
|
|
354
399
|
return this.articles.convertAmountByUnitCodeToDefaultUnitOfArticle(request);
|
|
355
400
|
}
|
|
@@ -402,4 +447,15 @@ export class Articles {
|
|
|
402
447
|
return;
|
|
403
448
|
});
|
|
404
449
|
}
|
|
450
|
+
_getArticleFullObject(goodId, showLoader) {
|
|
451
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
452
|
+
const response = yield this.articles.getArticleFullObject(goodId, showLoader);
|
|
453
|
+
if (response && response.validationResult && response.validationResult.success) {
|
|
454
|
+
if (response.resultObject) {
|
|
455
|
+
return this.boFactory.makeWithRawBackendData(ArticleFullObject, response.resultObject);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return;
|
|
459
|
+
});
|
|
460
|
+
}
|
|
405
461
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CatalogDefinition } from '../model/catalog-definition.bo';
|
|
2
2
|
import { ExternalSource } from '../model/external-source.bo';
|
|
3
|
-
import {
|
|
3
|
+
import { ArticleFullObject } from '../model/article-full-object';
|
|
4
4
|
export interface ExternalSourceArticleAddInterface {
|
|
5
5
|
quantity: number;
|
|
6
|
-
article: string |
|
|
6
|
+
article: string | ArticleFullObject;
|
|
7
7
|
catalogDefinition: CatalogDefinition;
|
|
8
8
|
externalSource: ExternalSource;
|
|
9
9
|
}
|