@colijnit/articleapi 262.1.3 → 262.1.5

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.
@@ -48,6 +48,7 @@ export declare class ArticlesAuth extends IoneApiArticles {
48
48
  getBrandsFilter(request: ArticleExtendedRequest): Promise<DataServiceResponseData>;
49
49
  getCatalogDefinitions(showLoader?: boolean): Promise<DataServiceResponseData>;
50
50
  getExternalSource(externalSourceId: number, showLoader?: boolean): Promise<DataServiceResponseData>;
51
+ getExternalSourceInfo(externalSourceId: number, showLoader?: boolean): Promise<DataServiceResponseData>;
51
52
  getArticleFullObject(id: number, showLoader?: boolean): Promise<DataServiceResponseData>;
52
53
  getArticleFlat(sku: string): Promise<DataServiceResponseData>;
53
54
  getWarehouses(goodId: number): Promise<DataServiceResponseData>;
@@ -283,6 +283,17 @@ export class ArticlesAuth extends IoneApiArticles {
283
283
  return this._call(DataServiceMethod.SelectSingleObject, data, BackendServiceName.DataService, showLoader);
284
284
  });
285
285
  }
286
+ getExternalSourceInfo(externalSourceId_1) {
287
+ return __awaiter(this, arguments, void 0, function* (externalSourceId, showLoader = true) {
288
+ const data = {
289
+ moduleName: ModuleName.MasterData,
290
+ objectName: MasterDataObjectName.ExternalSourceInfo,
291
+ refCursorAsArray: true,
292
+ objectId: externalSourceId
293
+ };
294
+ return this._call(DataServiceMethod.SelectSingleObject, data, BackendServiceName.DataService, showLoader);
295
+ });
296
+ }
286
297
  getArticleFullObject(id, showLoader = true) {
287
298
  const data = {
288
299
  moduleName: ModuleName.Articles,
@@ -48,6 +48,7 @@ export declare class ArticlesPublic extends IoneApiArticles {
48
48
  getBrandsFilter(request: ArticleExtendedRequest): Promise<DataServiceResponseData>;
49
49
  getCatalogDefinitions(showLoader?: boolean): Promise<DataServiceResponseData>;
50
50
  getExternalSource(externalSourceId: number, showLoader?: boolean): Promise<DataServiceResponseData>;
51
+ getExternalSourceInfo(externalSourceId: number, showLoader?: boolean): Promise<DataServiceResponseData>;
51
52
  getGoodIdFromArticleNr(sku: string): Promise<DataServiceResponseData>;
52
53
  getArticleFullObject(goodId: number, showLoader?: boolean): Promise<DataServiceResponseData>;
53
54
  getArticleFlat(sku: string): Promise<DataServiceResponseData>;
@@ -132,6 +132,13 @@ export class ArticlesPublic extends IoneApiArticles {
132
132
  return this._call(PublicServiceMethod.GetExternalSource, data, showLoader);
133
133
  });
134
134
  }
135
+ getExternalSourceInfo(externalSourceId_1) {
136
+ return __awaiter(this, arguments, void 0, function* (externalSourceId, showLoader = true) {
137
+ const params = { id: externalSourceId };
138
+ const data = Object.assign(Object.assign({}, this.createServiceRequestData()), { parameterValues: params });
139
+ return this._call(PublicServiceMethod.GetExternalSourceInfo, data, showLoader);
140
+ });
141
+ }
135
142
  getGoodIdFromArticleNr(sku) {
136
143
  return __awaiter(this, void 0, void 0, function* () {
137
144
  const params = { artikelnr: sku };
@@ -69,6 +69,7 @@ export declare class Articles {
69
69
  getBrandsFilter(request: ArticleExtendedRequest): Promise<DataServiceResponseData>;
70
70
  getCatalogDefinitions(showLoader?: boolean): Promise<DataServiceResponseData>;
71
71
  getExternalSource(externalSourceId: number, showLoader?: boolean): Promise<DataServiceResponseData>;
72
+ getExternalSourceInfo(externalSourceId: number, showLoader?: boolean): Promise<DataServiceResponseData>;
72
73
  getArticleFullObject(id: number, showLoader?: boolean): Promise<DataServiceResponseData>;
73
74
  getArticleFlat(sku: string): Promise<DataServiceResponseData>;
74
75
  getWarehouses(goodId: number): Promise<DataServiceResponseData>;
@@ -118,6 +119,7 @@ export declare class Articles {
118
119
  getArticleListWithBarcodeArticleNrEanCode(searchString: string, showLoader?: boolean): Promise<DataServiceResponseData>;
119
120
  getCategoryTypes(): Promise<DataServiceResponseData>;
120
121
  getCategoryDesigns(): Promise<DataServiceResponseData>;
122
+ prepareArticleForCart(userType: string, transactionType: string, domain: string, goodId: number, shouldGetArticleTree?: boolean, quantity?: number, instanceId?: string, showLoader?: boolean): Promise<DataServiceResponseData>;
121
123
  getJsonConfiguredArticles(configuratorStatistics?: ConfiguratorStatisticsEnvironment, showLoader?: boolean, instanceId?: string): Promise<DataServiceResponseData>;
122
124
  getJsonArticleFlatTree(goodId: number, goodType: string, quantity: number, externalSource?: boolean, showLoader?: boolean, instanceId?: string, configuratorStatistics?: ConfiguratorStatisticsEnvironment): Promise<string>;
123
125
  getGeneratedArtDirectly(goodId: number, showLoader: boolean): Promise<string>;
@@ -129,8 +131,10 @@ export declare class Articles {
129
131
  getFileUploadComplete(uploadId: string, uploadType: string): Promise<DataServiceResponseData>;
130
132
  cancelFileUpload(uploadId: string, uploadType: string): Promise<DataServiceResponseData>;
131
133
  getConversionUnitsForDefaultArticleUnitByGoodIdAndTransactionKind(goodId: number, transactionKind: string): Promise<DataServiceResponseData>;
134
+ private _getJSONFromArticleObject;
132
135
  convertAmountByUnitCodeToDefaultUnitOfArticle(request: ConvertQuantityToDefaultUnitRequest): Promise<DataServiceResponseData>;
133
136
  private _getFrozenArticle;
134
137
  private _getArticleFlatTree;
135
138
  private _getGeneratedArtDirectly;
139
+ private _getArticleFullObject;
136
140
  }
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();
@@ -129,6 +133,9 @@ export class Articles {
129
133
  getExternalSource(externalSourceId, showLoader = true) {
130
134
  return this.articles.getExternalSource(externalSourceId, showLoader);
131
135
  }
136
+ getExternalSourceInfo(externalSourceId, showLoader = true) {
137
+ return this.articles.getExternalSourceInfo(externalSourceId, showLoader);
138
+ }
132
139
  getArticleFullObject(id, showLoader = true) {
133
140
  return this.articles.getArticleFullObject(id, showLoader);
134
141
  }
@@ -276,6 +283,35 @@ export class Articles {
276
283
  getCategoryDesigns() {
277
284
  return this.articles.getCategoryDesigns();
278
285
  }
286
+ prepareArticleForCart(userType_1, transactionType_1, domain_1, goodId_1) {
287
+ return __awaiter(this, arguments, void 0, function* (userType, transactionType, domain, goodId, shouldGetArticleTree = false, quantity = 1, instanceId = undefined, showLoader = true) {
288
+ if (goodId) {
289
+ const article = yield this._getArticleFullObject(goodId, showLoader);
290
+ const goodType = article.goodType;
291
+ let returnArticle;
292
+ if (goodType === GoodType.BaseArticle) {
293
+ if (article.isConfigurable) {
294
+ returnArticle = yield this._getJSONFromArticleObject(userType, transactionType, domain, article, quantity, shouldGetArticleTree, showLoader, instanceId);
295
+ }
296
+ else {
297
+ returnArticle = this.boFactory.makeWithRawBackendData(ArticleFullObject, article);
298
+ }
299
+ }
300
+ else {
301
+ if (shouldGetArticleTree) {
302
+ returnArticle = yield this._getJSONFromArticleObject(userType, transactionType, domain, article, quantity, shouldGetArticleTree, showLoader);
303
+ }
304
+ else {
305
+ returnArticle = this.boFactory.makeWithRawBackendData(ArticleFullObject, article);
306
+ }
307
+ }
308
+ if (returnArticle) {
309
+ return Promise.resolve(new DataServiceResponseData({ resultObject: returnArticle, validationResult: { success: true } }));
310
+ }
311
+ }
312
+ return Promise.resolve(new DataServiceResponseData({ validationResult: { success: false, messages: ['UNKNOWN_ERROR'] } }));
313
+ });
314
+ }
279
315
  getJsonConfiguredArticles(configuratorStatistics, showLoader = true, instanceId = undefined) {
280
316
  return this.articles.getFrozenArticle(configuratorStatistics, showLoader, instanceId);
281
317
  }
@@ -350,6 +386,18 @@ export class Articles {
350
386
  getConversionUnitsForDefaultArticleUnitByGoodIdAndTransactionKind(goodId, transactionKind) {
351
387
  return this.articles.getConversionUnitsForDefaultArticleUnitByGoodIdAndTransactionKind(goodId, transactionKind);
352
388
  }
389
+ _getJSONFromArticleObject(userType_1, transactionType_1, domain_1, article_1, quantity_1) {
390
+ return __awaiter(this, arguments, void 0, function* (userType, transactionType, domain, article, quantity, shouldGetArticleTree = false, showLoader = true, instanceId = undefined) {
391
+ const configuratorStatistics = new ConfiguratorStatisticsEnvironment();
392
+ configuratorStatistics.userType = userType;
393
+ configuratorStatistics.transactionType = transactionType;
394
+ configuratorStatistics.actionDomain = domain;
395
+ configuratorStatistics.sessionId = this._connector.getSessionId() ? this._connector.getSessionId() : 'unknown';
396
+ configuratorStatistics.webHost = window.location.host;
397
+ configuratorStatistics.bundleHost = window.location.host;
398
+ return yield this.getJsonArticleFlatTree(article.goodId, article.goodType, quantity, shouldGetArticleTree, showLoader, instanceId, configuratorStatistics);
399
+ });
400
+ }
353
401
  convertAmountByUnitCodeToDefaultUnitOfArticle(request) {
354
402
  return this.articles.convertAmountByUnitCodeToDefaultUnitOfArticle(request);
355
403
  }
@@ -402,4 +450,15 @@ export class Articles {
402
450
  return;
403
451
  });
404
452
  }
453
+ _getArticleFullObject(goodId, showLoader) {
454
+ return __awaiter(this, void 0, void 0, function* () {
455
+ const response = yield this.articles.getArticleFullObject(goodId, showLoader);
456
+ if (response && response.validationResult && response.validationResult.success) {
457
+ if (response.resultObject) {
458
+ return this.boFactory.makeWithRawBackendData(ArticleFullObject, response.resultObject);
459
+ }
460
+ }
461
+ return;
462
+ });
463
+ }
405
464
  }
@@ -21,10 +21,10 @@ import { ArticleFlat } from "./model/article-flat.bo";
21
21
  const localOptions = {
22
22
  url: "https://develop.colijn-it.nl/",
23
23
  schema: "815",
24
- version: "259",
24
+ version: "300",
25
25
  useLoginEncryption: true,
26
- username: "elske",
27
- password: "elske1"
26
+ username: "patrick",
27
+ password: "vankeulen1234567890!"
28
28
  };
29
29
  const remoteOptions = {
30
30
  url: "http://130.62.7.55:8888/ione",
@@ -240,6 +240,11 @@ describe("ArticlesAPI", () => {
240
240
  const result = yield articles.getExternalSource(94);
241
241
  expect(result).toBeDefined();
242
242
  }));
243
+ it('getExternalSourceInfo', () => __awaiter(void 0, void 0, void 0, function* () {
244
+ yield articles.connect();
245
+ const result = yield articles.getExternalSourceInfo(148);
246
+ expect(result).toBeDefined();
247
+ }));
243
248
  it('getTurnoverGroupImages', () => __awaiter(void 0, void 0, void 0, function* () {
244
249
  const result = yield articles.getTurnoverGroups();
245
250
  expect(result).toBeDefined();
@@ -10,6 +10,7 @@ export declare enum MasterDataObjectName {
10
10
  DeliveryMethod = "DeliveryMethod",
11
11
  DeliveryOption = "DeliveryOption",
12
12
  ExternalSource = "ExternalSource",
13
+ ExternalSourceInfo = "ExternalSourceInfo",
13
14
  MarketingCode = "MarketingCode",
14
15
  PrivacySettingDTO = "PrivacySettingDTO",
15
16
  SuperArticle = "SuperArticle",
@@ -11,6 +11,7 @@ export var MasterDataObjectName;
11
11
  MasterDataObjectName["DeliveryMethod"] = "DeliveryMethod";
12
12
  MasterDataObjectName["DeliveryOption"] = "DeliveryOption";
13
13
  MasterDataObjectName["ExternalSource"] = "ExternalSource";
14
+ MasterDataObjectName["ExternalSourceInfo"] = "ExternalSourceInfo";
14
15
  MasterDataObjectName["MarketingCode"] = "MarketingCode";
15
16
  MasterDataObjectName["PrivacySettingDTO"] = "PrivacySettingDTO";
16
17
  MasterDataObjectName["SuperArticle"] = "SuperArticle";
@@ -87,6 +87,7 @@ export declare enum PublicServiceMethod {
87
87
  getBrandsUsedInArticles = "getBrandsUsedInArticles",
88
88
  GetCatalogDefinitions = "getCatalogDefinitions",
89
89
  GetExternalSource = "getExternalSource",
90
+ GetExternalSourceInfo = "getExternalSourceInfo",
90
91
  getGeneratedArtDirectly = "getGeneratedArtDirectly",
91
92
  StorePreset = "storePreset"
92
93
  }
@@ -88,6 +88,7 @@ export var PublicServiceMethod;
88
88
  PublicServiceMethod["getBrandsUsedInArticles"] = "getBrandsUsedInArticles";
89
89
  PublicServiceMethod["GetCatalogDefinitions"] = "getCatalogDefinitions";
90
90
  PublicServiceMethod["GetExternalSource"] = "getExternalSource";
91
+ PublicServiceMethod["GetExternalSourceInfo"] = "getExternalSourceInfo";
91
92
  PublicServiceMethod["getGeneratedArtDirectly"] = "getGeneratedArtDirectly";
92
93
  PublicServiceMethod["StorePreset"] = "storePreset";
93
94
  })(PublicServiceMethod || (PublicServiceMethod = {}));
@@ -1,9 +1,9 @@
1
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';
2
+ import { ArticleFullObject } from '../model/article-full-object';
3
+ import { ExternalSourceInfo } from '../model/external-source-info.bo';
4
4
  export interface ExternalSourceArticleAddInterface {
5
5
  quantity: number;
6
- article: string | ArticleListObjectExtended;
6
+ article: string | ArticleFullObject;
7
7
  catalogDefinition: CatalogDefinition;
8
- externalSource: ExternalSource;
8
+ externalSource: ExternalSourceInfo;
9
9
  }
@@ -1,10 +1,10 @@
1
1
  import { ArticleListObjectExtended } from '../model/article-list-object-extended.bo';
2
2
  import { CatalogDefinition } from '../model/catalog-definition.bo';
3
- import { ExternalSource } from '../model/external-source.bo';
4
3
  import { ExternalSettingsInterface } from './external-settings.interface';
4
+ import { ExternalSourceInfo } from '../model/external-source-info.bo';
5
5
  export interface ExternalSourceArticleClickInterface {
6
6
  article: string | ArticleListObjectExtended;
7
7
  settings: ExternalSettingsInterface;
8
8
  catalogDefinition: CatalogDefinition;
9
- externalSource: ExternalSource;
9
+ externalSource: ExternalSourceInfo;
10
10
  }
@@ -54,6 +54,7 @@ export declare abstract class IoneApiArticles {
54
54
  abstract getBrandsFilter(request: ArticleExtendedRequest): Promise<DataServiceResponseData>;
55
55
  abstract getCatalogDefinitions(showLoader: boolean): Promise<DataServiceResponseData>;
56
56
  abstract getExternalSource(externalSourceId: number, showLoader: boolean): Promise<DataServiceResponseData>;
57
+ abstract getExternalSourceInfo(externalSourceId: number, showLoader: boolean): Promise<DataServiceResponseData>;
57
58
  abstract getArticleFullObject(id: number, showLoader: boolean): Promise<DataServiceResponseData>;
58
59
  abstract getArticleFlat(sku: string): Promise<DataServiceResponseData>;
59
60
  abstract getWarehouses(goodId: number): Promise<DataServiceResponseData>;
@@ -1,7 +1,7 @@
1
- import { BusinessObject } from "@colijnit/ioneconnector/build/model/business-object";
2
- import { ExternalSource } from "./external-source.bo";
1
+ import { BusinessObject } from '@colijnit/ioneconnector/build/model/business-object';
2
+ import { ExternalSourceInfo } from './external-source-info.bo';
3
3
  export declare class ExternalCatalogStartupInfo extends BusinessObject {
4
- externalSource: ExternalSource;
4
+ externalSource: ExternalSourceInfo;
5
5
  username: string;
6
6
  password: string;
7
7
  token: string;
@@ -1,3 +1,3 @@
1
- import { BusinessObject } from "@colijnit/ioneconnector/build/model/business-object";
1
+ import { BusinessObject } from '@colijnit/ioneconnector/build/model/business-object';
2
2
  export class ExternalCatalogStartupInfo extends BusinessObject {
3
3
  }
@@ -0,0 +1,18 @@
1
+ import { BusinessObject } from '@colijnit/ioneconnector/build/model/business-object';
2
+ import { ExternalSourceParameter } from './external-source-parameter.bo';
3
+ export declare class ExternalSourceInfo extends BusinessObject {
4
+ sourceId: number;
5
+ type: string;
6
+ branchNr: string;
7
+ description: string;
8
+ url: string;
9
+ domain: string;
10
+ schema: string;
11
+ language: string;
12
+ retailFormulas: string[];
13
+ parameters: ExternalSourceParameter[];
14
+ supplierNr: number;
15
+ constructor();
16
+ getId(): number;
17
+ setId(value: number): void;
18
+ }
@@ -0,0 +1,25 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { BusinessObject } from '@colijnit/ioneconnector/build/model/business-object';
8
+ import { ComplexArray } from '@colijnit/ioneconnector/build/factory/decorators/complex-array.decorator';
9
+ import { ExternalSourceParameter } from './external-source-parameter.bo';
10
+ export class ExternalSourceInfo extends BusinessObject {
11
+ constructor() {
12
+ super();
13
+ this.retailFormulas = [];
14
+ this.parameters = [];
15
+ }
16
+ getId() {
17
+ return this.sourceId;
18
+ }
19
+ setId(value) {
20
+ this.sourceId = value;
21
+ }
22
+ }
23
+ __decorate([
24
+ ComplexArray(ExternalSourceParameter)
25
+ ], ExternalSourceInfo.prototype, "parameters", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colijnit/articleapi",
3
- "version": "262.1.3",
3
+ "version": "262.1.5",
4
4
  "scripts": {
5
5
  "build": "grunt clean && tsc",
6
6
  "browserify": "browserify build/connector.js --s colijn -o dist/out-tsc/bundle.js",