@colijnit/articleapi 255.1.4 → 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.
@@ -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: 0, baseGoodId: 0, selectorData: {}, quantity: 0, articleTree: {} };
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 frozenArticleResponse = yield this.articles.getFrozenArticle(configuratorStatistics, showLoader, instanceId);
270
- if (frozenArticleResponse && frozenArticleResponse.validationResult && frozenArticleResponse.validationResult.success) {
271
- const rawArray = frozenArticleResponse.resultObject;
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
- else {
296
- reject(frozenArticleResponse);
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
  }
@@ -21,7 +21,7 @@ import { ArticleFlat } from "./model/article-flat.bo";
21
21
  const localOptions = {
22
22
  url: "http://localhost:8080/ione",
23
23
  schema: "815",
24
- version: "252",
24
+ version: "253",
25
25
  useLoginEncryption: true,
26
26
  username: "elske",
27
27
  password: "elske1"
@@ -42,7 +42,7 @@ const publicOptions = {
42
42
  describe("ArticlesAPI", () => {
43
43
  let articles;
44
44
  const articleExtendedRequest = {
45
- general: 'elixir',
45
+ articleNumber: '1000234793',
46
46
  paging: new PagingParameters(1, 20, 20)
47
47
  };
48
48
  const articleNrArticleExtendedRequest = {
@@ -0,0 +1,4 @@
1
+ export interface ExternalSettingsInterface {
2
+ name: string;
3
+ settings: any;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { CatalogDefinition } from '../model/catalog-definition.bo';
2
+ import { ExternalSource } from '../model/external-source.bo';
3
+ import { ArticleListObjectExtended } from '../model/article-list-object-extended.bo';
4
+ export interface ExternalSourceArticleAddInterface {
5
+ quantity: number;
6
+ article: string | ArticleListObjectExtended;
7
+ catalogDefinition: CatalogDefinition;
8
+ externalSource: ExternalSource;
9
+ }
@@ -0,0 +1,10 @@
1
+ import { ArticleListObjectExtended } from '../model/article-list-object-extended.bo';
2
+ import { CatalogDefinition } from '../model/catalog-definition.bo';
3
+ import { ExternalSource } from '../model/external-source.bo';
4
+ import { ExternalSettingsInterface } from './external-settings.interface';
5
+ export interface ExternalSourceArticleClickInterface {
6
+ article: string | ArticleListObjectExtended;
7
+ settings: ExternalSettingsInterface;
8
+ catalogDefinition: CatalogDefinition;
9
+ externalSource: ExternalSource;
10
+ }
@@ -0,0 +1,7 @@
1
+ export interface JsonArticleFlatTree {
2
+ goodId: number;
3
+ baseGoodId: number;
4
+ selectorData?: {};
5
+ quantity: number;
6
+ articleTree?: {};
7
+ }
@@ -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.4",
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.4.",
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",