@colijnit/catalog 12.1.44 → 12.1.45

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';
@@ -45,8 +46,8 @@ class Version {
45
46
  constructor() {
46
47
  this.name = "@colijnit/catalog";
47
48
  this.description = "iOne Catalog module based on Angular 12";
48
- this.symVer = "12.1.44";
49
- this.publishDate = "22-9-2023 10:21:10";
49
+ this.symVer = "12.1.45";
50
+ this.publishDate = "2-10-2023 19:34:19";
50
51
  }
51
52
  }
52
53
 
@@ -615,6 +616,17 @@ class CatalogConnectorAdapterService {
615
616
  }
616
617
  });
617
618
  }
619
+ getWebViewStartupInfo(request) {
620
+ return __awaiter(this, void 0, void 0, function* () {
621
+ const response = yield this.connector.getWebviewStartupInfo(request);
622
+ if (response && response.validationResult && response.validationResult.success) {
623
+ return this._boFactory.makeWithRawBackendData(ExternalCatalogStartupInfo, response.resultObject);
624
+ }
625
+ else {
626
+ console.error(response.validationMessagesAsString);
627
+ }
628
+ });
629
+ }
618
630
  // will be called in future
619
631
  // public getArticleGroupImages(): Promise<ArticleGroupImage[]> {
620
632
  // return this.connector.getArticleGroupImages();
@@ -1278,6 +1290,11 @@ class CatalogConnectorService {
1278
1290
  return this._adapterService.updatePreset(presetName);
1279
1291
  });
1280
1292
  }
1293
+ getWebViewStartupInfo(request) {
1294
+ return __awaiter(this, void 0, void 0, function* () {
1295
+ return this._adapterService.getWebViewStartupInfo(request);
1296
+ });
1297
+ }
1281
1298
  getDocumentContent(docId, thumbnail = true) {
1282
1299
  return __awaiter(this, void 0, void 0, function* () {
1283
1300
  return this._selectSingleParameterizedCacheService.requestCache(String, (docId, thumbnail) => {
@@ -4301,13 +4318,27 @@ class CatalogExternalSourceComponent {
4301
4318
  this.externalSettings = {};
4302
4319
  this._subs = [];
4303
4320
  }
4304
- set externalSource(value) {
4305
- this._externalSource = value;
4321
+ set container(content) {
4322
+ if (content) {
4323
+ this.catalogFrame = content;
4324
+ this.catalogFrame.nativeElement.setAttribute('data-password', this.password);
4325
+ this.catalogFrame.nativeElement.setAttribute('data-username', this.username);
4326
+ }
4327
+ }
4328
+ set catalogDefinitionId(value) {
4329
+ this._catalogDefinitionId = value;
4330
+ }
4331
+ get catalogDefinitionId() {
4332
+ return this._catalogDefinitionId;
4333
+ }
4334
+ set externalCatalogStartupInfo(value) {
4335
+ this._externalCatalogStartupInfo = value;
4336
+ this._externalSource = value.externalSource;
4306
4337
  this.loaded = false;
4307
4338
  this._prepareExternalSource();
4308
4339
  }
4309
- get externalSource() {
4310
- return this._externalSource;
4340
+ get externalCatalogStartupInfo() {
4341
+ return this._externalCatalogStartupInfo;
4311
4342
  }
4312
4343
  ngOnInit() {
4313
4344
  this._subs.push(this._appEventService.addArticleButtonClick.subscribe((json) => {
@@ -4321,9 +4352,20 @@ class CatalogExternalSourceComponent {
4321
4352
  }
4322
4353
  receiveMessage(event) {
4323
4354
  //if(event.origin === this.externalSource.url) {
4324
- this.iFrameFeedbackReceived.emit(event.data);
4355
+ if (typeof event.data === 'string') {
4356
+ this.iFrameFeedbackReceived.emit(event.data);
4357
+ }
4358
+ else {
4359
+ this.iFrameFeedbackReceived.emit(JSON.stringify(event.data));
4360
+ }
4325
4361
  //}
4326
4362
  }
4363
+ iframeLoaded(event) {
4364
+ event.target.contentWindow.postMessage({
4365
+ 'USERNAME': this.username,
4366
+ 'PASSWORD': this.password
4367
+ }, '*');
4368
+ }
4327
4369
  _prepareExternalSource() {
4328
4370
  return __awaiter(this, void 0, void 0, function* () {
4329
4371
  if (!this._externalSource) {
@@ -4331,22 +4373,29 @@ class CatalogExternalSourceComponent {
4331
4373
  }
4332
4374
  this.externalUrl = undefined;
4333
4375
  this.externalSettings = {};
4334
- if (this.externalSource.type === 'CATF') {
4376
+ if (this._externalSource.type === 'CATF') {
4335
4377
  // get bundle settings from external source
4336
- const bundleSettings = yield this._catalogConnectorService.getCatalogBundleSettings(this.externalSource.url, parseInt(this.externalSource.schema));
4378
+ const bundleSettings = yield this._catalogConnectorService.getCatalogBundleSettings(this._externalSource.url, parseInt(this._externalSource.schema));
4337
4379
  this.externalSettings = JSON.parse(bundleSettings);
4338
4380
  if (this.options) {
4339
4381
  this.externalSettings.options = this.options;
4340
4382
  }
4341
- if (this.externalSource.username && this.externalSource.password) {
4342
- this.externalSettings.username = this.externalSource.username;
4343
- this.externalSettings.password = this.externalSource.password;
4383
+ if (this._externalSource.username && this._externalSource.password) {
4384
+ this.externalSettings.username = this._externalSource.username;
4385
+ this.externalSettings.password = this._externalSource.password;
4344
4386
  }
4345
4387
  // finally show the catalog
4346
4388
  this.showCatalog = true;
4347
4389
  }
4348
4390
  else {
4349
- this.externalUrl = this.externalSource.url;
4391
+ if (this._externalSource.type !== 'WEBS') {
4392
+ this.externalUrl = this._externalCatalogStartupInfo.apiUrl;
4393
+ this.username = this._externalCatalogStartupInfo.username;
4394
+ this.password = this._externalCatalogStartupInfo.password;
4395
+ }
4396
+ else {
4397
+ this.externalUrl = this._externalSource.url;
4398
+ }
4350
4399
  this.safeUrl = this._sanitizer.bypassSecurityTrustResourceUrl(this.externalUrl);
4351
4400
  this.showCatalog = false;
4352
4401
  window.addEventListener("message", (event) => { this.receiveMessage(event); });
@@ -4372,7 +4421,7 @@ CatalogExternalSourceComponent.decorators = [
4372
4421
  ></co-catalog-search>
4373
4422
  </ng-container>
4374
4423
  <ng-container *ngIf="!showCatalog">
4375
- <iframe width="100%" height="100%" [src]="safeUrl" frameborder="0" allowfullscreen></iframe>
4424
+ <iframe #catalogFrame width="100%" height="100%" [src]="safeUrl" frameborder="0" allowfullscreen (load)="iframeLoaded($event)"></iframe>
4376
4425
  </ng-container>
4377
4426
  </ng-container>
4378
4427
  `,
@@ -4385,7 +4434,10 @@ CatalogExternalSourceComponent.ctorParameters = () => [
4385
4434
  { type: CatalogEventService }
4386
4435
  ];
4387
4436
  CatalogExternalSourceComponent.propDecorators = {
4388
- externalSource: [{ type: Input }],
4437
+ container: [{ type: ViewChild, args: ['catalogFrame', { read: ElementRef },] }],
4438
+ catalogDefinitionId: [{ type: Input }],
4439
+ user: [{ type: Input }],
4440
+ externalCatalogStartupInfo: [{ type: Input }],
4389
4441
  title: [{ type: Input }],
4390
4442
  subTitle: [{ type: Input }],
4391
4443
  searchPlaceholder: [{ type: Input }],