@colijnit/product 256.1.4 → 256.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.
@@ -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 = "256.1.4";
35
- this.publishDate = "22-1-2025 20:45:30";
34
+ this.symVer = "256.1.5";
35
+ this.publishDate = "8-2-2025 23:16:14";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -3376,6 +3376,7 @@
3376
3376
  this._scriptLoader = _scriptLoader;
3377
3377
  this._renderer = _renderer;
3378
3378
  this.variant = '';
3379
+ this.urlParams = [];
3379
3380
  this.configuratorFinished = new i0.EventEmitter();
3380
3381
  this.configurationError = new i0.EventEmitter();
3381
3382
  this.showClass = true;
@@ -3414,7 +3415,10 @@
3414
3415
  this.configurationError.emit(event.detail.status);
3415
3416
  };
3416
3417
  ProductHdComponent.prototype._prepareAttributes = function () {
3417
- if (this.hdeConfigurator && this.hdeConfigurator.nativeElement && this.token && (this.sku || this.variant)) {
3418
+ if (this.hdeConfigurator && this.hdeConfigurator.nativeElement && this.urlParams && this.token && (this.sku || this.variant)) {
3419
+ //for local testing please turn off for packing and publishing!
3420
+ //this.prepareTestingUrlparams();
3421
+ this._prepareConfiguratorUrls();
3418
3422
  this.hdeConfigurator.nativeElement.setAttribute('bearerToken', this.token);
3419
3423
  if (this._sku) {
3420
3424
  this.hdeConfigurator.nativeElement.setAttribute('data-productId', this._sku);
@@ -3425,34 +3429,54 @@
3425
3429
  this._loadTheScripts();
3426
3430
  }
3427
3431
  };
3428
- // load external scripts
3432
+ //set necessary references to configurator.
3433
+ ProductHdComponent.prototype._prepareConfiguratorUrls = function () {
3434
+ //fetch the setting from the external source
3435
+ var apiurl = this.urlParams.find(function (item) { return item.key === 'apiurl'; }).value;
3436
+ var productVariantCommandApiUrl = this.urlParams.find(function (item) { return item.key === 'productVariantCommandApiUrl'; }).value;
3437
+ var productVariantQueryApiUrl = this.urlParams.find(function (item) { return item.key === 'productVariantQueryApiUrl'; }).value;
3438
+ var localizationApiUrl = this.urlParams.find(function (item) { return item.key === 'localizationApiUrl'; }).value;
3439
+ //apply to configurator
3440
+ this.hdeConfigurator.nativeElement.setAttribute('apiurl', apiurl);
3441
+ this.hdeConfigurator.nativeElement.setAttribute('productVariantCommandApiUrl', productVariantCommandApiUrl);
3442
+ this.hdeConfigurator.nativeElement.setAttribute('productVariantQueryApiUrl', productVariantQueryApiUrl);
3443
+ this.hdeConfigurator.nativeElement.setAttribute('localizationApiUrl', localizationApiUrl);
3444
+ };
3445
+ // load external scripts into client
3429
3446
  ProductHdComponent.prototype._loadTheScripts = function () {
3430
3447
  return __awaiter(this, void 0, void 0, function () {
3431
- var scripts, i;
3448
+ var headerUrls, headerArray, i, styles, stylesArray, j;
3432
3449
  return __generator(this, function (_a) {
3433
3450
  switch (_a.label) {
3434
3451
  case 0:
3435
- scripts = [
3436
- // hard-coded for now, should come from the external source
3437
- 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/polyfills.js',
3438
- 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/runtime.js',
3439
- 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/main.js'
3440
- ];
3452
+ headerUrls = this.urlParams.find(function (item) { return item.key === 'header'; }).value;
3453
+ headerArray = headerUrls.replace(/\s+/g, '').split(',');
3441
3454
  i = 0;
3442
3455
  _a.label = 1;
3443
3456
  case 1:
3444
- if (!(i < scripts.length)) return [3 /*break*/, 4];
3445
- return [4 /*yield*/, this._scriptLoader.loadScript(scripts[i], this._renderer).catch(function (error) { return console.error(error); })];
3457
+ if (!(i < headerArray.length)) return [3 /*break*/, 4];
3458
+ return [4 /*yield*/, this._scriptLoader.loadScript(headerArray[i], this._renderer).catch(function (error) { return console.error(error); })];
3446
3459
  case 2:
3447
3460
  _a.sent();
3448
3461
  _a.label = 3;
3449
3462
  case 3:
3450
3463
  i++;
3451
3464
  return [3 /*break*/, 1];
3452
- case 4: return [4 /*yield*/, this._scriptLoader.addStyleSheet('https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/styles.css', this._renderer)];
3465
+ case 4:
3466
+ styles = this.urlParams.find(function (item) { return item.key === 'stylesheet'; }).value;
3467
+ stylesArray = styles.replace(/\s+/g, '').split(',');
3468
+ j = 0;
3469
+ _a.label = 5;
3453
3470
  case 5:
3471
+ if (!(j < stylesArray.length)) return [3 /*break*/, 8];
3472
+ return [4 /*yield*/, this._scriptLoader.addStyleSheet(stylesArray[j], this._renderer)];
3473
+ case 6:
3454
3474
  _a.sent();
3455
- return [2 /*return*/];
3475
+ _a.label = 7;
3476
+ case 7:
3477
+ j++;
3478
+ return [3 /*break*/, 5];
3479
+ case 8: return [2 /*return*/];
3456
3480
  }
3457
3481
  });
3458
3482
  });
@@ -3462,7 +3486,7 @@
3462
3486
  ProductHdComponent.decorators = [
3463
3487
  { type: i0.Component, args: [{
3464
3488
  selector: 'co-product-hd',
3465
- 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 ",
3489
+ 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 ",
3466
3490
  encapsulation: i0.ViewEncapsulation.None
3467
3491
  },] }
3468
3492
  ];
@@ -3475,6 +3499,7 @@
3475
3499
  sku: [{ type: i0.Input }],
3476
3500
  token: [{ type: i0.Input }],
3477
3501
  variant: [{ type: i0.Input }],
3502
+ urlParams: [{ type: i0.Input }],
3478
3503
  configuratorFinished: [{ type: i0.Output }],
3479
3504
  configurationError: [{ type: i0.Output }],
3480
3505
  showClass: [{ type: i0.HostBinding, args: ['class.co-product-hd',] }]
@@ -3519,6 +3544,7 @@
3519
3544
  this.externalSettings = {};
3520
3545
  this.token = ""; //= "eyJhbGciOiJSUzI1NiIsImtpZCI6IkYxOThERkVEOEUwQTQ1MzY3M0M1MUE2Rjk1QUVDQzU3RTM0NjM4RkRSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1dCI6IjhaamY3WTRLUlRaenhScHZsYTdNVi1OR09QMCJ9.eyJuYmYiOjE3MzIxOTkyOTUsImV4cCI6MTczMjIwMjg5NSwiaXNzIjoiaHR0cHM6Ly9ibXNpZGVudGl0eS1hY2NlcHRhbmNlLmF6dXJld2Vic2l0ZXMubmV0IiwiYXVkIjpbImNhdGFsb2dxdWVyeWFwaSIsImNvbmZpZ3VyYXRvcmFwaSIsInByb2R1Y3R2YXJpYW50Y29tbWFuZGFwaSIsInByb2R1Y3R2YXJpYW50cXVlcnlhcGkiXSwiY2xpZW50X2lkIjoiaW1wZXJzb25hdGlvbi5jbGllbnQiLCJzdWIiOiIwOTMwZDI4Mi05NGU4LTQ5MGEtOGI2NC1mYTk1YmIyYzE1ODIiLCJhdXRoX3RpbWUiOjE3MzIxOTkyOTUsImlkcCI6ImxvY2FsIiwiZW52aXJvbm1lbnQiOiJNU0wiLCJzZWxsZXIiOiJTRTAwMDA5NiIsInNlbGxlcmd1aWQiOiIxMDk1MWJjNS1hZmMzLTQ1MGEtNmVkMS0wOGQ4NDNlNmE5OTQiLCJwZXJtaXNzaW9uIjpbInNhbGVzLmV4cG9ydHRlbXBsYXRlcy5yZWFkIiwiZG9jdW1lbnRsaWJyYXJ5LnRhZy5yZWFkIiwiZG9jdW1lbnRsaWJyYXJ5LmRvY3VtZW50LnJlYWQiLCJkb2N1bWVudGxpYnJhcnkudGFnZ3J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yaWFudHF1ZXJ5YXBpIl0sImFtciI6WyJpbXBlcnNvbmF0aW9uIl19.rbguVPnkXXDzsM6QKgXulhrF41jIjCuGDV13ig1GC8MewLCJ7wA038OSwT26sx2mCexjvuGYt45YScfPwfTkDy3ErPmHRods64X1dJWZnf-23NTP2iI32K_1vMZH5GOGbMzuFtbKAFQv4hgFAxoyWqFVWyJvuOtQcWyZStROyPHwjAnpnj-x1cVQpOhbO-kQUFvy_VUrPpF3aYVCcO2cFirQTXR6kxSGcYGGcsPY-_eiAd93UdG2EM6xLAocDLaFV72CQI6XEs0WQG1f4SqvH52v3OTkgWBLgYV35gpyIe0-2nazGL0R8pTNuDqrOb7OGmuTRMoTIiRi67-wTxx8cQ";
3521
3546
  this.variant = "";
3547
+ this.urlParams = [];
3522
3548
  this._subs = [];
3523
3549
  }
3524
3550
  Object.defineProperty(ProductExternalSourceComponent.prototype, "externalSource", {
@@ -3538,10 +3564,12 @@
3538
3564
  return this._externalCatalogStartupInfo;
3539
3565
  },
3540
3566
  set: function (value) {
3541
- this._externalCatalogStartupInfo = value;
3542
- this.externalSource = value.externalSource;
3543
- this.loaded = false;
3544
- this._prepareExternalSource();
3567
+ if (value) {
3568
+ this._externalCatalogStartupInfo = value;
3569
+ this.externalSource = value.externalSource;
3570
+ this.loaded = false;
3571
+ this._prepareExternalSource();
3572
+ }
3545
3573
  },
3546
3574
  enumerable: false,
3547
3575
  configurable: true
@@ -3633,6 +3661,7 @@
3633
3661
  this.token = this.externalCatalogStartupInfo.token;
3634
3662
  this.sku = this.externalCatalogStartupInfo.externalGoodId;
3635
3663
  this.variant = this.externalCatalogStartupInfo.flattenedGoodId;
3664
+ this.urlParams = this.externalCatalogStartupInfo.externalSource.parameters;
3636
3665
  this.switchToConfigurator();
3637
3666
  this.loaded = true;
3638
3667
  }
@@ -3663,7 +3692,7 @@
3663
3692
  ProductExternalSourceComponent.decorators = [
3664
3693
  { type: i0.Component, args: [{
3665
3694
  selector: 'co-product-external-source',
3666
- 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 ",
3695
+ 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 ",
3667
3696
  providers: [
3668
3697
  ProductSettingsService,
3669
3698
  ProductConnectorAdapterService,