@colijnit/product 257.1.3 → 257.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.
@@ -7,6 +7,7 @@ import { ProductEventService } from '../../service/product-event.service';
7
7
  import { CatalogDefinition } from '@colijnit/articleapi/build/model/catalog-definition.bo';
8
8
  import { ExternalSourceArticleAddInterface } from '@colijnit/articleapi/build/interface/external-source-article-add.interface';
9
9
  import { ExternalCatalogStartupInfo } from '@colijnit/articleapi/build/model/external-catalog-startup-info';
10
+ import { ExternalSourceParameter } from '@colijnit/articleapi/build/model/external-source-parameter.bo';
10
11
  export declare class ProductExternalSourceComponent implements OnInit, OnDestroy {
11
12
  private _sanitizer;
12
13
  private _productConnectorService;
@@ -32,6 +33,7 @@ export declare class ProductExternalSourceComponent implements OnInit, OnDestroy
32
33
  externalSettings: any;
33
34
  token: string;
34
35
  variant: string;
36
+ urlParams: ExternalSourceParameter[];
35
37
  private _externalSource;
36
38
  private _externalCatalogStartupInfo;
37
39
  private _subs;
@@ -1,5 +1,6 @@
1
1
  import { ElementRef, EventEmitter, OnDestroy, Renderer2 } from '@angular/core';
2
2
  import { ProductScriptLoaderService } from '../../service/product-script-loader.service';
3
+ import { ExternalSourceParameter } from '@colijnit/articleapi/build/model/external-source-parameter.bo';
3
4
  export declare class ProductHdComponent implements OnDestroy {
4
5
  private _scriptLoader;
5
6
  private _renderer;
@@ -8,6 +9,7 @@ export declare class ProductHdComponent implements OnDestroy {
8
9
  get sku(): string;
9
10
  token: string;
10
11
  variant: string;
12
+ urlParams: ExternalSourceParameter[];
11
13
  configuratorFinished: EventEmitter<string>;
12
14
  configurationError: EventEmitter<any>;
13
15
  showClass: boolean;
@@ -18,5 +20,6 @@ export declare class ProductHdComponent implements OnDestroy {
18
20
  handleConfigurationFinished(event: CustomEvent): void;
19
21
  handleError(event: CustomEvent): void;
20
22
  private _prepareAttributes;
23
+ private _prepareConfiguratorUrls;
21
24
  private _loadTheScripts;
22
25
  }
@@ -31,8 +31,8 @@
31
31
  function Version() {
32
32
  this.name = "@colijnit/product";
33
33
  this.description = "Product detail page project for iOne";
34
- this.symVer = "257.1.3";
35
- this.publishDate = "04/02/2025, 08:44:04";
34
+ this.symVer = "257.1.4";
35
+ this.publishDate = "8-2-2025 19:30:37";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -1421,7 +1421,7 @@
1421
1421
  IoneProductComponent.decorators = [
1422
1422
  { type: i0.Component, args: [{
1423
1423
  selector: 'app-ione-product',
1424
- template: "\n <app-product-page *ngIf=\"settingsLoaded\"\n [createFrozenArticle]=\"handleAddArticleInternally\"\n [isReturn]=\"isReturn\"\n (openStockEvent)=\"openStock()\"\n [sku]=\"sku\"\n [showRelatedProductsPopup]=\"showRelatedProductsPopup\"\n ></app-product-page>\n<!-- <co-button [label]=\"'click'\" (click)=\"showHD = !showHD\"></co-button>\n <co-product-hd [sku]=\"'657946ca-e1e1-41fd-7ae0-08dbf7df0cef'\" *ngIf=\"showHD\"></co-product-hd>-->\n ",
1424
+ template: "\n <app-product-page *ngIf=\"settingsLoaded\"\n [createFrozenArticle]=\"handleAddArticleInternally\"\n [isReturn]=\"isReturn\"\n (openStockEvent)=\"openStock()\"\n [sku]=\"sku\"\n [showRelatedProductsPopup]=\"showRelatedProductsPopup\"\n ></app-product-page>\n <!-- <co-button [label]=\"'click'\" (click)=\"showHD = !showHD\"></co-button>\n <co-product-hd [sku]=\"'657946ca-e1e1-41fd-7ae0-08dbf7df0cef'\" *ngIf=\"showHD\"></co-product-hd>-->\n ",
1425
1425
  encapsulation: i0.ViewEncapsulation.Emulated,
1426
1426
  styles: [""]
1427
1427
  },] }
@@ -3407,6 +3407,7 @@
3407
3407
  this._scriptLoader = _scriptLoader;
3408
3408
  this._renderer = _renderer;
3409
3409
  this.variant = '';
3410
+ this.urlParams = [];
3410
3411
  this.configuratorFinished = new i0.EventEmitter();
3411
3412
  this.configurationError = new i0.EventEmitter();
3412
3413
  this.showClass = true;
@@ -3445,7 +3446,10 @@
3445
3446
  this.configurationError.emit(event.detail.status);
3446
3447
  };
3447
3448
  ProductHdComponent.prototype._prepareAttributes = function () {
3448
- if (this.hdeConfigurator && this.hdeConfigurator.nativeElement && this.token && (this.sku || this.variant)) {
3449
+ if (this.hdeConfigurator && this.hdeConfigurator.nativeElement && this.urlParams && this.token && (this.sku || this.variant)) {
3450
+ //for local testing please turn off for packing and publishing!
3451
+ //this.prepareTestingUrlparams();
3452
+ this._prepareConfiguratorUrls();
3449
3453
  this.hdeConfigurator.nativeElement.setAttribute('bearerToken', this.token);
3450
3454
  if (this._sku) {
3451
3455
  this.hdeConfigurator.nativeElement.setAttribute('data-productId', this._sku);
@@ -3456,34 +3460,54 @@
3456
3460
  this._loadTheScripts();
3457
3461
  }
3458
3462
  };
3459
- // load external scripts
3463
+ //set necessary references to configurator.
3464
+ ProductHdComponent.prototype._prepareConfiguratorUrls = function () {
3465
+ //fetch the setting from the external source
3466
+ var apiurl = this.urlParams.find(function (item) { return item.key === 'apiurl'; }).value;
3467
+ var productVariantCommandApiUrl = this.urlParams.find(function (item) { return item.key === 'productVariantCommandApiUrl'; }).value;
3468
+ var productVariantQueryApiUrl = this.urlParams.find(function (item) { return item.key === 'productVariantQueryApiUrl'; }).value;
3469
+ var localizationApiUrl = this.urlParams.find(function (item) { return item.key === 'localizationApiUrl'; }).value;
3470
+ //apply to configurator
3471
+ this.hdeConfigurator.nativeElement.setAttribute('apiurl', apiurl);
3472
+ this.hdeConfigurator.nativeElement.setAttribute('productVariantCommandApiUrl', productVariantCommandApiUrl);
3473
+ this.hdeConfigurator.nativeElement.setAttribute('productVariantQueryApiUrl', productVariantQueryApiUrl);
3474
+ this.hdeConfigurator.nativeElement.setAttribute('localizationApiUrl', localizationApiUrl);
3475
+ };
3476
+ // load external scripts into client
3460
3477
  ProductHdComponent.prototype._loadTheScripts = function () {
3461
3478
  return __awaiter(this, void 0, void 0, function () {
3462
- var scripts, i;
3479
+ var headerUrls, headerArray, i, styles, stylesArray, j;
3463
3480
  return __generator(this, function (_a) {
3464
3481
  switch (_a.label) {
3465
3482
  case 0:
3466
- scripts = [
3467
- // hard-coded for now, should come from the external source
3468
- 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/polyfills.js',
3469
- 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/runtime.js',
3470
- 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/main.js'
3471
- ];
3483
+ headerUrls = this.urlParams.find(function (item) { return item.key === 'header'; }).value;
3484
+ headerArray = headerUrls.replace(/\s+/g, '').split(',');
3472
3485
  i = 0;
3473
3486
  _a.label = 1;
3474
3487
  case 1:
3475
- if (!(i < scripts.length)) return [3 /*break*/, 4];
3476
- return [4 /*yield*/, this._scriptLoader.loadScript(scripts[i], this._renderer).catch(function (error) { return console.error(error); })];
3488
+ if (!(i < headerArray.length)) return [3 /*break*/, 4];
3489
+ return [4 /*yield*/, this._scriptLoader.loadScript(headerArray[i], this._renderer).catch(function (error) { return console.error(error); })];
3477
3490
  case 2:
3478
3491
  _a.sent();
3479
3492
  _a.label = 3;
3480
3493
  case 3:
3481
3494
  i++;
3482
3495
  return [3 /*break*/, 1];
3483
- case 4: return [4 /*yield*/, this._scriptLoader.addStyleSheet('https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/styles.css', this._renderer)];
3496
+ case 4:
3497
+ styles = this.urlParams.find(function (item) { return item.key === 'stylesheet'; }).value;
3498
+ stylesArray = styles.replace(/\s+/g, '').split(',');
3499
+ j = 0;
3500
+ _a.label = 5;
3484
3501
  case 5:
3502
+ if (!(j < stylesArray.length)) return [3 /*break*/, 8];
3503
+ return [4 /*yield*/, this._scriptLoader.addStyleSheet(stylesArray[j], this._renderer)];
3504
+ case 6:
3485
3505
  _a.sent();
3486
- return [2 /*return*/];
3506
+ _a.label = 7;
3507
+ case 7:
3508
+ j++;
3509
+ return [3 /*break*/, 5];
3510
+ case 8: return [2 /*return*/];
3487
3511
  }
3488
3512
  });
3489
3513
  });
@@ -3493,7 +3517,7 @@
3493
3517
  ProductHdComponent.decorators = [
3494
3518
  { type: i0.Component, args: [{
3495
3519
  selector: 'co-product-hd',
3496
- template: "\n <hde-configurator #hdeConfigurator\n apiurl=\"https://bmsproductconfigurator-acceptance.azurewebsites.net/api/configurator/\"\n productVariantCommandApiUrl=\"https://bmsproductvariantcommand-acceptance.azurewebsites.net/\"\n productVariantQueryApiUrl=\"https://bmsproductvariantquery-acceptance.azurewebsites.net/\"\n language=\"nl\"\n localizationApiUrl=\"https://hde-cdn.azureedge.net/libs/BMS.DST.Localization/\"\n localizationFileExtension=\".json\"\n (configurationFinished)=\"handleConfigurationFinished($event)\"\n (configurationFailed)=\"handleError($event)\"\n >\n <hde-progress-bar></hde-progress-bar>\n </hde-configurator>\n ",
3520
+ template: "\n <hde-configurator #hdeConfigurator\n language=\"nl\"\n localizationFileExtension=\".json\"\n (configurationFinished)=\"handleConfigurationFinished($event)\"\n (configurationFailed)=\"handleError($event)\"\n >\n <hde-progress-bar></hde-progress-bar>\n </hde-configurator>\n ",
3497
3521
  encapsulation: i0.ViewEncapsulation.None
3498
3522
  },] }
3499
3523
  ];
@@ -3506,6 +3530,7 @@
3506
3530
  sku: [{ type: i0.Input }],
3507
3531
  token: [{ type: i0.Input }],
3508
3532
  variant: [{ type: i0.Input }],
3533
+ urlParams: [{ type: i0.Input }],
3509
3534
  configuratorFinished: [{ type: i0.Output }],
3510
3535
  configurationError: [{ type: i0.Output }],
3511
3536
  showClass: [{ type: i0.HostBinding, args: ['class.co-product-hd',] }]
@@ -3550,6 +3575,7 @@
3550
3575
  this.externalSettings = {};
3551
3576
  this.token = ""; //= "eyJhbGciOiJSUzI1NiIsImtpZCI6IkYxOThERkVEOEUwQTQ1MzY3M0M1MUE2Rjk1QUVDQzU3RTM0NjM4RkRSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1dCI6IjhaamY3WTRLUlRaenhScHZsYTdNVi1OR09QMCJ9.eyJuYmYiO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uTRMoTIiRi67-wTxx8cQ";
3552
3577
  this.variant = "";
3578
+ this.urlParams = [];
3553
3579
  this._subs = [];
3554
3580
  }
3555
3581
  Object.defineProperty(ProductExternalSourceComponent.prototype, "externalSource", {
@@ -3569,10 +3595,12 @@
3569
3595
  return this._externalCatalogStartupInfo;
3570
3596
  },
3571
3597
  set: function (value) {
3572
- this._externalCatalogStartupInfo = value;
3573
- this.externalSource = value.externalSource;
3574
- this.loaded = false;
3575
- this._prepareExternalSource();
3598
+ if (value) {
3599
+ this._externalCatalogStartupInfo = value;
3600
+ this.externalSource = value.externalSource;
3601
+ this.loaded = false;
3602
+ this._prepareExternalSource();
3603
+ }
3576
3604
  },
3577
3605
  enumerable: false,
3578
3606
  configurable: true
@@ -3664,6 +3692,7 @@
3664
3692
  this.token = this.externalCatalogStartupInfo.token;
3665
3693
  this.sku = this.externalCatalogStartupInfo.externalGoodId;
3666
3694
  this.variant = this.externalCatalogStartupInfo.flattenedGoodId;
3695
+ this.urlParams = this.externalCatalogStartupInfo.externalSource.parameters;
3667
3696
  this.switchToConfigurator();
3668
3697
  this.loaded = true;
3669
3698
  }
@@ -3694,7 +3723,7 @@
3694
3723
  ProductExternalSourceComponent.decorators = [
3695
3724
  { type: i0.Component, args: [{
3696
3725
  selector: 'co-product-external-source',
3697
- template: "\n <ng-container *ngIf=\"loaded\">\n <ng-container *ngIf=\"showProduct\">\n <app-product-page\n [sku]=\"sku\"\n [settings]=\"externalSettings\"\n [externalSource]=\"externalSource\"\n ></app-product-page>\n </ng-container>\n <ng-container *ngIf=\"showSource\">\n <iframe width=\"100%\" height=\"100%\" [src]=\"safeUrl\" frameborder=\"0\" allowfullscreen></iframe>\n </ng-container>\n <ng-container *ngIf=\"showConfigurator\">\n <co-product-hd width=\"100%\" height=\"100%\"\n [sku]=\"sku\"\n [variant]=\"variant\"\n [token]=\"token\"\n (configuratorFinished)=\"handleConfigurationFinished($event)\"></co-product-hd>\n </ng-container>\n </ng-container>\n ",
3726
+ template: "\n <ng-container *ngIf=\"loaded\">\n <ng-container *ngIf=\"showProduct\">\n <app-product-page\n [sku]=\"sku\"\n [settings]=\"externalSettings\"\n [externalSource]=\"externalSource\"\n ></app-product-page>\n </ng-container>\n <ng-container *ngIf=\"showSource\">\n <iframe width=\"100%\" height=\"100%\" [src]=\"safeUrl\" frameborder=\"0\" allowfullscreen></iframe>\n </ng-container>\n <ng-container *ngIf=\"showConfigurator\">\n <co-product-hd width=\"100%\" height=\"100%\"\n [sku]=\"sku\"\n [variant]=\"variant\"\n [token]=\"token\"\n [urlParams]=\"urlParams\"\n (configuratorFinished)=\"handleConfigurationFinished($event)\"></co-product-hd>\n </ng-container>\n </ng-container>\n ",
3698
3727
  providers: [
3699
3728
  ProductSettingsService,
3700
3729
  ProductConnectorAdapterService,