@colijnit/catalog 12.1.44 → 12.1.46

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.
@@ -28,6 +28,7 @@ import { Preset } from '@colijnit/mainapi/build/model/preset.bo';
28
28
  import { UserGroup } from '@colijnit/mainapi/build/model/user-group.bo';
29
29
  import { PriceList } from '@colijnit/transactionapi/build/model/price-list';
30
30
  import { Transaction } from '@colijnit/transactionapi/build/transaction';
31
+ import { ExternalCatalogStartupInfo } from '@colijnit/articleapi/build/model/external-catalog-startup-info';
31
32
  import { ObjectUtils } from '@colijnit/ioneconnector/build/utils/object-utils';
32
33
  import { FileUtils } from '@colijnit/ioneconnector/build/utils/file-utils';
33
34
  import { FilterViewmodel, FilterItemViewmodel, FilterItemModule, InputTextModule, ButtonModule, IconModule, FilterItemMode as FilterItemMode$1, InputDatePickerModule, IconCollapseHandleModule, CoDialogModule, ListOfValuesModule, CheckmarkOverlayModule, ImageModule, OverlayModule, OverlayService, InputSearchModule, PaginationBarModule } from '@colijnit/corecomponents_v12';
@@ -39,14 +40,15 @@ import { DomSanitizer } from '@angular/platform-browser';
39
40
  import { InputCheckboxModule, SliderComponent, IconModule as IconModule$1, CheckboxSelectModule, PriceDisplayPipeModule, ButtonModule as ButtonModule$1, ImageModule as ImageModule$1 } from '@colijnit/corecomponents';
40
41
  import { DomainName } from '@colijnit/mainapi/build/enum/domain-name.enum';
41
42
  import { FilterItemMode } from '@colijnit/corecomponents_v12/';
43
+ import { ExternalCatalogTypes } from '@colijnit/transactionapi/build/enum/external-catalog-types.enum';
42
44
 
43
45
  // this file is dynamically created, do not change this
44
46
  class Version {
45
47
  constructor() {
46
48
  this.name = "@colijnit/catalog";
47
49
  this.description = "iOne Catalog module based on Angular 12";
48
- this.symVer = "12.1.44";
49
- this.publishDate = "22-9-2023 10:21:10";
50
+ this.symVer = "12.1.46";
51
+ this.publishDate = "3-10-2023 17:58:38";
50
52
  }
51
53
  }
52
54
 
@@ -615,6 +617,17 @@ class CatalogConnectorAdapterService {
615
617
  }
616
618
  });
617
619
  }
620
+ getWebViewStartupInfo(request) {
621
+ return __awaiter(this, void 0, void 0, function* () {
622
+ const response = yield this.connector.getWebviewStartupInfo(request);
623
+ if (response && response.validationResult && response.validationResult.success) {
624
+ return this._boFactory.makeWithRawBackendData(ExternalCatalogStartupInfo, response.resultObject);
625
+ }
626
+ else {
627
+ console.error(response.validationMessagesAsString);
628
+ }
629
+ });
630
+ }
618
631
  // will be called in future
619
632
  // public getArticleGroupImages(): Promise<ArticleGroupImage[]> {
620
633
  // return this.connector.getArticleGroupImages();
@@ -1278,6 +1291,11 @@ class CatalogConnectorService {
1278
1291
  return this._adapterService.updatePreset(presetName);
1279
1292
  });
1280
1293
  }
1294
+ getWebViewStartupInfo(request) {
1295
+ return __awaiter(this, void 0, void 0, function* () {
1296
+ return this._adapterService.getWebViewStartupInfo(request);
1297
+ });
1298
+ }
1281
1299
  getDocumentContent(docId, thumbnail = true) {
1282
1300
  return __awaiter(this, void 0, void 0, function* () {
1283
1301
  return this._selectSingleParameterizedCacheService.requestCache(String, (docId, thumbnail) => {
@@ -4301,13 +4319,27 @@ class CatalogExternalSourceComponent {
4301
4319
  this.externalSettings = {};
4302
4320
  this._subs = [];
4303
4321
  }
4304
- set externalSource(value) {
4305
- this._externalSource = value;
4322
+ set container(content) {
4323
+ if (content) {
4324
+ this.catalogFrame = content;
4325
+ this.catalogFrame.nativeElement.setAttribute('data-password', this.password);
4326
+ this.catalogFrame.nativeElement.setAttribute('data-username', this.username);
4327
+ }
4328
+ }
4329
+ set catalogDefinitionId(value) {
4330
+ this._catalogDefinitionId = value;
4331
+ }
4332
+ get catalogDefinitionId() {
4333
+ return this._catalogDefinitionId;
4334
+ }
4335
+ set externalCatalogStartupInfo(value) {
4336
+ this._externalCatalogStartupInfo = value;
4337
+ this._externalSource = value.externalSource;
4306
4338
  this.loaded = false;
4307
4339
  this._prepareExternalSource();
4308
4340
  }
4309
- get externalSource() {
4310
- return this._externalSource;
4341
+ get externalCatalogStartupInfo() {
4342
+ return this._externalCatalogStartupInfo;
4311
4343
  }
4312
4344
  ngOnInit() {
4313
4345
  this._subs.push(this._appEventService.addArticleButtonClick.subscribe((json) => {
@@ -4321,9 +4353,22 @@ class CatalogExternalSourceComponent {
4321
4353
  }
4322
4354
  receiveMessage(event) {
4323
4355
  //if(event.origin === this.externalSource.url) {
4324
- this.iFrameFeedbackReceived.emit(event.data);
4356
+ if (typeof event.data === 'string') {
4357
+ this.iFrameFeedbackReceived.emit(event.data);
4358
+ }
4359
+ else {
4360
+ this.iFrameFeedbackReceived.emit(JSON.stringify(event.data));
4361
+ }
4325
4362
  //}
4326
4363
  }
4364
+ iframeLoaded(event) {
4365
+ if (this.username && this.password) {
4366
+ event.target.contentWindow.postMessage({
4367
+ 'USERNAME': this.username,
4368
+ 'PASSWORD': this.password
4369
+ }, '*');
4370
+ }
4371
+ }
4327
4372
  _prepareExternalSource() {
4328
4373
  return __awaiter(this, void 0, void 0, function* () {
4329
4374
  if (!this._externalSource) {
@@ -4331,22 +4376,34 @@ class CatalogExternalSourceComponent {
4331
4376
  }
4332
4377
  this.externalUrl = undefined;
4333
4378
  this.externalSettings = {};
4334
- if (this.externalSource.type === 'CATF') {
4379
+ if (this._externalSource.type === 'CATF') {
4335
4380
  // get bundle settings from external source
4336
- const bundleSettings = yield this._catalogConnectorService.getCatalogBundleSettings(this.externalSource.url, parseInt(this.externalSource.schema));
4381
+ const bundleSettings = yield this._catalogConnectorService.getCatalogBundleSettings(this._externalSource.url, parseInt(this._externalSource.schema));
4337
4382
  this.externalSettings = JSON.parse(bundleSettings);
4338
4383
  if (this.options) {
4339
4384
  this.externalSettings.options = this.options;
4340
4385
  }
4341
- if (this.externalSource.username && this.externalSource.password) {
4342
- this.externalSettings.username = this.externalSource.username;
4343
- this.externalSettings.password = this.externalSource.password;
4386
+ if (this._externalSource.username && this._externalSource.password) {
4387
+ this.externalSettings.username = this._externalSource.username;
4388
+ this.externalSettings.password = this._externalSource.password;
4344
4389
  }
4345
4390
  // finally show the catalog
4346
4391
  this.showCatalog = true;
4347
4392
  }
4348
4393
  else {
4349
- this.externalUrl = this.externalSource.url;
4394
+ if (this._externalSource.type !== ExternalCatalogTypes.Webshop) {
4395
+ this.externalUrl = this._externalCatalogStartupInfo.apiUrl;
4396
+ if (this._externalSource.type === ExternalCatalogTypes.Vadain) {
4397
+ this.username = this._externalCatalogStartupInfo.username;
4398
+ this.password = this._externalCatalogStartupInfo.password;
4399
+ }
4400
+ else if (this._externalSource.type == ExternalCatalogTypes.Woontotaal) {
4401
+ this.externalUrl += "?token=" + this._externalCatalogStartupInfo.token + "&isEmbedded=true";
4402
+ }
4403
+ }
4404
+ else {
4405
+ this.externalUrl = this._externalSource.url;
4406
+ }
4350
4407
  this.safeUrl = this._sanitizer.bypassSecurityTrustResourceUrl(this.externalUrl);
4351
4408
  this.showCatalog = false;
4352
4409
  window.addEventListener("message", (event) => { this.receiveMessage(event); });
@@ -4372,7 +4429,7 @@ CatalogExternalSourceComponent.decorators = [
4372
4429
  ></co-catalog-search>
4373
4430
  </ng-container>
4374
4431
  <ng-container *ngIf="!showCatalog">
4375
- <iframe width="100%" height="100%" [src]="safeUrl" frameborder="0" allowfullscreen></iframe>
4432
+ <iframe #catalogFrame width="100%" height="100%" [src]="safeUrl" frameborder="0" allowfullscreen (load)="iframeLoaded($event)"></iframe>
4376
4433
  </ng-container>
4377
4434
  </ng-container>
4378
4435
  `,
@@ -4385,7 +4442,10 @@ CatalogExternalSourceComponent.ctorParameters = () => [
4385
4442
  { type: CatalogEventService }
4386
4443
  ];
4387
4444
  CatalogExternalSourceComponent.propDecorators = {
4388
- externalSource: [{ type: Input }],
4445
+ container: [{ type: ViewChild, args: ['catalogFrame', { read: ElementRef },] }],
4446
+ catalogDefinitionId: [{ type: Input }],
4447
+ user: [{ type: Input }],
4448
+ externalCatalogStartupInfo: [{ type: Input }],
4389
4449
  title: [{ type: Input }],
4390
4450
  subTitle: [{ type: Input }],
4391
4451
  searchPlaceholder: [{ type: Input }],