@colijnit/product 256.1.3 → 257.1.0

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.
@@ -0,0 +1,19 @@
1
+ import { ElementRef, Renderer2 } from '@angular/core';
2
+ import { ProductScriptLoaderService } from '../../service/product-script-loader.service';
3
+ export declare class ProductHdComponent {
4
+ private _scriptLoader;
5
+ private _renderer;
6
+ set content(child: any);
7
+ set sku(value: string);
8
+ get sku(): string;
9
+ showClass: boolean;
10
+ token: string;
11
+ variant: string;
12
+ hdeConfigurator: ElementRef;
13
+ private _sku;
14
+ constructor(_scriptLoader: ProductScriptLoaderService, _renderer: Renderer2);
15
+ handleConfigurationFinished(event: CustomEvent): void;
16
+ handleError(event: CustomEvent): void;
17
+ private _prepareAttributes;
18
+ private _loadTheScripts;
19
+ }
@@ -0,0 +1,2 @@
1
+ export declare class ProductHdModule {
2
+ }
@@ -0,0 +1,7 @@
1
+ import { Renderer2 } from '@angular/core';
2
+ export declare class ProductScriptLoaderService {
3
+ private platformId;
4
+ constructor(platformId: any);
5
+ loadScript(url: string, renderer: Renderer2): Promise<void>;
6
+ addStyleSheet(url: string, renderer: Renderer2): Promise<void>;
7
+ }
@@ -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.3";
35
- this.publishDate = "20-11-2024 10:30:57";
34
+ this.symVer = "257.1.0";
35
+ this.publishDate = "1/14/2025, 12:10:32 PM";
36
36
  }
37
37
  return Version;
38
38
  }());
@@ -1389,7 +1389,7 @@
1389
1389
  IoneProductComponent.decorators = [
1390
1390
  { type: i0.Component, args: [{
1391
1391
  selector: 'app-ione-product',
1392
- 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\n ",
1392
+ 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<!--\n <co-product-hd [sku]=\"'8f108aa9-f6cb-4d86-7826-08d87757dac1'\"></co-product-hd>\n-->\n ",
1393
1393
  encapsulation: i0.ViewEncapsulation.Emulated,
1394
1394
  styles: [""]
1395
1395
  },] }
@@ -3302,6 +3302,184 @@
3302
3302
  },] }
3303
3303
  ];
3304
3304
 
3305
+ var ProductScriptLoaderService = /** @class */ (function () {
3306
+ function ProductScriptLoaderService(platformId) {
3307
+ this.platformId = platformId;
3308
+ }
3309
+ ProductScriptLoaderService.prototype.loadScript = function (url, renderer) {
3310
+ var _this = this;
3311
+ return new Promise(function (resolve, reject) {
3312
+ if (!common.isPlatformBrowser(_this.platformId)) {
3313
+ reject('Not in browser environment');
3314
+ return;
3315
+ }
3316
+ var existingScript = document.getElementById(url);
3317
+ if (existingScript) {
3318
+ resolve(); // Script already loaded
3319
+ return;
3320
+ }
3321
+ var script = renderer.createElement('script');
3322
+ script.id = url;
3323
+ script.src = url;
3324
+ script.type = 'text/javascript';
3325
+ script.async = true;
3326
+ script.onload = function () { return resolve(); };
3327
+ script.onerror = function (error) { return reject("Error loading script: " + url); };
3328
+ renderer.appendChild(document.head, script);
3329
+ });
3330
+ };
3331
+ ProductScriptLoaderService.prototype.addStyleSheet = function (url, renderer) {
3332
+ var _this = this;
3333
+ return new Promise(function (resolve, reject) {
3334
+ if (!common.isPlatformBrowser(_this.platformId)) {
3335
+ reject('Not in browser environment');
3336
+ return;
3337
+ }
3338
+ var existingStyleSheet = document.getElementById(url);
3339
+ if (existingStyleSheet) {
3340
+ resolve(); // Script already loaded
3341
+ return;
3342
+ }
3343
+ var link = renderer.createElement('link');
3344
+ link.id = url;
3345
+ link.href = url;
3346
+ link.rel = 'stylesheet';
3347
+ link.onload = function () { return resolve(); };
3348
+ link.onerror = function (error) { return reject("Error loading styleSheet: " + url); };
3349
+ renderer.appendChild(document.head, link);
3350
+ });
3351
+ };
3352
+ return ProductScriptLoaderService;
3353
+ }());
3354
+ ProductScriptLoaderService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ProductScriptLoaderService_Factory() { return new ProductScriptLoaderService(i0__namespace.ɵɵinject(i0__namespace.PLATFORM_ID)); }, token: ProductScriptLoaderService, providedIn: "root" });
3355
+ ProductScriptLoaderService.decorators = [
3356
+ { type: i0.Injectable, args: [{
3357
+ providedIn: 'root'
3358
+ },] }
3359
+ ];
3360
+ ProductScriptLoaderService.ctorParameters = function () { return [
3361
+ { type: undefined, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] }
3362
+ ]; };
3363
+
3364
+ var ProductHdComponent = /** @class */ (function () {
3365
+ function ProductHdComponent(_scriptLoader, _renderer) {
3366
+ this._scriptLoader = _scriptLoader;
3367
+ this._renderer = _renderer;
3368
+ this.showClass = true;
3369
+ this.token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IkYxOThERkVEOEUwQTQ1MzY3M0M1MUE2Rjk1QUVDQzU3RTM0NjM4RkRSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1dCI6IjhaamY3WTRLUlRaenhScHZsYTdNVi1OR09QMCJ9.eyJuYmYiOjE3MzIxOTkyOTUsImV4cCI6MTczMjIwMjg5NSwiaXNzIjoiaHR0cHM6Ly9ibXNpZGVudGl0eS1hY2NlcHRhbmNlLmF6dXJld2Vic2l0ZXMubmV0IiwiYXVkIjpbImNhdGFsb2dxdWVyeWFwaSIsImNvbmZpZ3VyYXRvcmFwaSIsInByb2R1Y3R2YXJpYW50Y29tbWFuZGFwaSIsInByb2R1Y3R2YXJpYW50cXVlcnlhcGkiXSwiY2xpZW50X2lkIjoiaW1wZXJzb25hdGlvbi5jbGllbnQiLCJzdW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b2R1Y3RwcmljZS5zZXR0aW5ncy5yZWFkIiwic2VsbGVyLnByb2R1Y3RwcmljZS5zZXR0aW5ncy53cml0ZSIsImNvbmZpZ3VyYXRvci5wdXJjaGFzZXByaWNlLnJlYWQiLCJzdG9jay5mYWJyaWMucmVhZCJdLCJuYW1lIjoiUm9iaW4iLCJmYW1pbHlfbmFtZSI6ImRlIFdpbnRlciAoQ29saWpuLUlUKSIsInJvbGUiOlsic2VsbGVyIiwiZGVhbGVyX21hbmFnZXIiXSwiaWF0IjoxNzMyMTk5Mjk1LCJzY29wZSI6WyJjYXRhbG9ncXVlcnlhcGkiLCJjb25maWd1cmF0b3JhcGkiLCJwcm9kdWN0dmFyaWFudGNvbW1hbmRhcGkiLCJwcm9kdWN0dmFyaWFudHF1ZXJ5YXBpIl0sImFtciI6WyJpbXBlcnNvbmF0aW9uIl19.rbguVPnkXXDzsM6QKgXulhrF41jIjCuGDV13ig1GC8MewLCJ7wA038OSwT26sx2mCexjvuGYt45YScfPwfTkDy3ErPmHRods64X1dJWZnf-23NTP2iI32K_1vMZH5GOGbMzuFtbKAFQv4hgFAxoyWqFVWyJvuOtQcWyZStROyPHwjAnpnj-x1cVQpOhbO-kQUFvy_VUrPpF3aYVCcO2cFirQTXR6kxSGcYGGcsPY-_eiAd93UdG2EM6xLAocDLaFV72CQI6XEs0WQG1f4SqvH52v3OTkgWBLgYV35gpyIe0-2nazGL0R8pTNuDqrOb7OGmuTRMoTIiRi67-wTxx8cQ";
3370
+ this.variant = "";
3371
+ }
3372
+ Object.defineProperty(ProductHdComponent.prototype, "content", {
3373
+ set: function (child) {
3374
+ this.hdeConfigurator = child;
3375
+ this._prepareAttributes();
3376
+ },
3377
+ enumerable: false,
3378
+ configurable: true
3379
+ });
3380
+ Object.defineProperty(ProductHdComponent.prototype, "sku", {
3381
+ get: function () {
3382
+ return this._sku;
3383
+ },
3384
+ set: function (value) {
3385
+ this._sku = value;
3386
+ this._prepareAttributes();
3387
+ },
3388
+ enumerable: false,
3389
+ configurable: true
3390
+ });
3391
+ ProductHdComponent.prototype.handleConfigurationFinished = function (event) {
3392
+ console.log(event.detail);
3393
+ };
3394
+ ProductHdComponent.prototype.handleError = function (event) {
3395
+ console.error(event.detail);
3396
+ };
3397
+ ProductHdComponent.prototype._prepareAttributes = function () {
3398
+ if (this.hdeConfigurator && this.hdeConfigurator.nativeElement && this.token && (this.sku || this.variant)) {
3399
+ this.hdeConfigurator.nativeElement.setAttribute('bearerToken', this.token);
3400
+ if (this._sku) {
3401
+ this.hdeConfigurator.nativeElement.setAttribute('data-productId', this._sku);
3402
+ }
3403
+ if (this.variant) {
3404
+ this.hdeConfigurator.nativeElement.setAttribute('data-productVariantId', this.variant);
3405
+ }
3406
+ this._loadTheScripts();
3407
+ }
3408
+ };
3409
+ // load external scripts
3410
+ ProductHdComponent.prototype._loadTheScripts = function () {
3411
+ return __awaiter(this, void 0, void 0, function () {
3412
+ var scripts, i;
3413
+ return __generator(this, function (_a) {
3414
+ switch (_a.label) {
3415
+ case 0:
3416
+ scripts = [
3417
+ // hard-coded for now, should come from the external source
3418
+ 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/polyfills.js',
3419
+ 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/runtime.js',
3420
+ 'https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/main.js'
3421
+ ];
3422
+ i = 0;
3423
+ _a.label = 1;
3424
+ case 1:
3425
+ if (!(i < scripts.length)) return [3 /*break*/, 4];
3426
+ return [4 /*yield*/, this._scriptLoader.loadScript(scripts[i], this._renderer).catch(function (error) { return console.error(error); })];
3427
+ case 2:
3428
+ _a.sent();
3429
+ _a.label = 3;
3430
+ case 3:
3431
+ i++;
3432
+ return [3 /*break*/, 1];
3433
+ case 4: return [4 /*yield*/, this._scriptLoader.addStyleSheet("https://hde-cdn.azureedge.net/libs/components/Configurator/1.0.33/styles.css", this._renderer)];
3434
+ case 5:
3435
+ _a.sent();
3436
+ return [2 /*return*/];
3437
+ }
3438
+ });
3439
+ });
3440
+ };
3441
+ return ProductHdComponent;
3442
+ }());
3443
+ ProductHdComponent.decorators = [
3444
+ { type: i0.Component, args: [{
3445
+ selector: 'co-product-hd',
3446
+ 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 ",
3447
+ encapsulation: i0.ViewEncapsulation.None
3448
+ },] }
3449
+ ];
3450
+ ProductHdComponent.ctorParameters = function () { return [
3451
+ { type: ProductScriptLoaderService },
3452
+ { type: i0.Renderer2 }
3453
+ ]; };
3454
+ ProductHdComponent.propDecorators = {
3455
+ content: [{ type: i0.ViewChild, args: ['hdeConfigurator', { read: i0.ElementRef },] }],
3456
+ sku: [{ type: i0.Input }],
3457
+ showClass: [{ type: i0.HostBinding, args: ['class.co-product-hd',] }]
3458
+ };
3459
+
3460
+ var ProductHdModule = /** @class */ (function () {
3461
+ function ProductHdModule() {
3462
+ }
3463
+ return ProductHdModule;
3464
+ }());
3465
+ ProductHdModule.decorators = [
3466
+ { type: i0.NgModule, args: [{
3467
+ imports: [
3468
+ common.CommonModule
3469
+ ],
3470
+ declarations: [
3471
+ ProductHdComponent
3472
+ ],
3473
+ schemas: [
3474
+ i0.CUSTOM_ELEMENTS_SCHEMA,
3475
+ i0.NO_ERRORS_SCHEMA
3476
+ ],
3477
+ exports: [
3478
+ ProductHdComponent
3479
+ ]
3480
+ },] }
3481
+ ];
3482
+
3305
3483
  var IoneProductModule = /** @class */ (function () {
3306
3484
  function IoneProductModule() {
3307
3485
  }
@@ -3313,7 +3491,7 @@
3313
3491
  // BrowserAnimationsModule,
3314
3492
  common.CommonModule,
3315
3493
  ProductPageModule,
3316
- corecomponents_v12.LoaderModule
3494
+ ProductHdModule
3317
3495
  ],
3318
3496
  declarations: [
3319
3497
  IoneProductComponent
@@ -3321,6 +3499,10 @@
3321
3499
  exports: [
3322
3500
  IoneProductComponent
3323
3501
  ],
3502
+ schemas: [
3503
+ i0.CUSTOM_ELEMENTS_SCHEMA,
3504
+ i0.NO_ERRORS_SCHEMA
3505
+ ],
3324
3506
  bootstrap: [
3325
3507
  IoneProductComponent
3326
3508
  ],
@@ -3501,6 +3683,9 @@
3501
3683
  exports["ɵbk"] = ProductDialogModule;
3502
3684
  exports["ɵbl"] = ProductDialogComponent;
3503
3685
  exports["ɵbm"] = ProductPageComponent;
3686
+ exports["ɵbn"] = ProductHdModule;
3687
+ exports["ɵbo"] = ProductHdComponent;
3688
+ exports["ɵbp"] = ProductScriptLoaderService;
3504
3689
  exports["ɵc"] = PipeModule;
3505
3690
  exports["ɵd"] = LocalizePipe;
3506
3691
  exports["ɵe"] = DictionaryService;