@colijnit/product 256.1.0 → 256.1.2
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.
- package/app/components/image-carousel/image-carousel.component.d.ts +1 -0
- package/app/service/product-connector-adapter.service.d.ts +4 -1
- package/app/service/product-event.service.d.ts +2 -0
- package/bundles/colijnit-product.umd.js +80 -54
- package/bundles/colijnit-product.umd.js.map +1 -1
- package/colijnit-product.metadata.json +1 -1
- package/esm2015/app/components/image-carousel/image-carousel.component.js +11 -2
- package/esm2015/app/components/product-addtocart/product-addtocart.component.js +15 -7
- package/esm2015/app/components/product-external-source/product-external-source.component.js +1 -2
- package/esm2015/app/components/product-page/product-page.component.js +1 -1
- package/esm2015/app/ione-product.module.js +8 -2
- package/esm2015/app/product-version.js +3 -3
- package/esm2015/app/service/product-connector-adapter.service.js +16 -6
- package/esm2015/app/service/product-event.service.js +3 -8
- package/fesm2015/colijnit-product.js +67 -44
- package/fesm2015/colijnit-product.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Directive,
|
|
2
|
+
import { Injectable, Directive, EventEmitter, Component, ViewEncapsulation, ChangeDetectorRef, Input, Output, Renderer2, ViewChild, ElementRef, Pipe, NgModule, HostListener, HostBinding, SecurityContext, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
3
|
import { __awaiter } from 'tslib';
|
|
4
4
|
import { Subject, BehaviorSubject } from 'rxjs';
|
|
5
5
|
import { Options } from '@colijnit/ioneconnector/build/model/options';
|
|
@@ -30,8 +30,8 @@ class Version {
|
|
|
30
30
|
constructor() {
|
|
31
31
|
this.name = "@colijnit/product";
|
|
32
32
|
this.description = "Product detail page project for iOne";
|
|
33
|
-
this.symVer = "256.1.
|
|
34
|
-
this.publishDate = "
|
|
33
|
+
this.symVer = "256.1.2";
|
|
34
|
+
this.publishDate = "8-11-2024 14:14:34";
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -104,22 +104,48 @@ class ProductSettings {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
class ProductEventService {
|
|
108
|
+
constructor() {
|
|
109
|
+
this.onAddToCart = new Subject();
|
|
110
|
+
this.onAlternativeClick = new Subject();
|
|
111
|
+
this.onAddToQuote = new Subject();
|
|
112
|
+
this.onForceRenderImage = new Subject();
|
|
113
|
+
this.onArticleReceived = new Subject();
|
|
114
|
+
this.onSelectionsReceived = new Subject();
|
|
115
|
+
this.onImageReceived = new Subject();
|
|
116
|
+
this.onRenderStarted = new Subject();
|
|
117
|
+
this.onRenderImageReceived = new Subject();
|
|
118
|
+
this.onDraftRenderImageReceived = new Subject();
|
|
119
|
+
this.onArticleInfoReceived = new Subject();
|
|
120
|
+
this.onUpdateProductInfoTab = new Subject();
|
|
121
|
+
this.errorMessage = new Subject();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
ProductEventService.decorators = [
|
|
125
|
+
{ type: Directive },
|
|
126
|
+
{ type: Injectable }
|
|
127
|
+
];
|
|
128
|
+
|
|
107
129
|
// Sole responsibility is simply to wrap around a colijn.Connector to create a stable inner interface to the library in a 1:1 method way.
|
|
108
130
|
// Only to be used by the IOneControllerService.
|
|
109
131
|
class ProductConnectorAdapterService {
|
|
110
|
-
constructor() {
|
|
132
|
+
constructor(_eventService) {
|
|
133
|
+
this._eventService = _eventService;
|
|
111
134
|
this.showLoader = new Subject();
|
|
112
135
|
this._boFactory = new BusinessObjectFactory();
|
|
136
|
+
this._subs = [];
|
|
113
137
|
}
|
|
114
138
|
ngOnDestroy() {
|
|
115
|
-
this.
|
|
139
|
+
this._subs.forEach(s => s.unsubscribe());
|
|
116
140
|
}
|
|
117
141
|
initConnector(options) {
|
|
118
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
143
|
this.articleConnector = new Articles(options);
|
|
120
144
|
yield this.articleConnector.connect();
|
|
121
145
|
this.transactionConnector = new Transaction(options);
|
|
122
|
-
this.
|
|
146
|
+
this._subs.push(
|
|
147
|
+
// @ts-ignore
|
|
148
|
+
this.articleConnector.showLoader.subscribe(value => this.showLoader.next(value)));
|
|
123
149
|
});
|
|
124
150
|
}
|
|
125
151
|
setInstance(instanceId) {
|
|
@@ -198,7 +224,10 @@ class ProductConnectorAdapterService {
|
|
|
198
224
|
}
|
|
199
225
|
getJsonArticleFlatTree(goodId, goodType, quantity, externalSource = false, showLoader = true, instanceId, configuratorStatistics) {
|
|
200
226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
return this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics)
|
|
227
|
+
return this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics).catch((messages) => {
|
|
228
|
+
this._eventService.errorMessage.next(messages);
|
|
229
|
+
return null;
|
|
230
|
+
});
|
|
202
231
|
});
|
|
203
232
|
}
|
|
204
233
|
getGoodIdFromArticleNr(sku) {
|
|
@@ -259,7 +288,9 @@ class ProductConnectorAdapterService {
|
|
|
259
288
|
ProductConnectorAdapterService.decorators = [
|
|
260
289
|
{ type: Injectable }
|
|
261
290
|
];
|
|
262
|
-
ProductConnectorAdapterService.ctorParameters = () => [
|
|
291
|
+
ProductConnectorAdapterService.ctorParameters = () => [
|
|
292
|
+
{ type: ProductEventService }
|
|
293
|
+
];
|
|
263
294
|
|
|
264
295
|
var LanguageCode;
|
|
265
296
|
(function (LanguageCode) {
|
|
@@ -599,33 +630,6 @@ ProductConnectorService.ctorParameters = () => [
|
|
|
599
630
|
{ type: ProductSettingsService }
|
|
600
631
|
];
|
|
601
632
|
|
|
602
|
-
class ProductEventService {
|
|
603
|
-
constructor() {
|
|
604
|
-
this.onAddToCart = new Subject();
|
|
605
|
-
this.onAlternativeClick = new Subject();
|
|
606
|
-
this.onAddToQuote = new Subject();
|
|
607
|
-
this.onForceRenderImage = new Subject();
|
|
608
|
-
this.onArticleReceived = new Subject();
|
|
609
|
-
this.onSelectionsReceived = new Subject();
|
|
610
|
-
this.onImageReceived = new Subject();
|
|
611
|
-
this.onRenderStarted = new Subject();
|
|
612
|
-
this.onRenderImageReceived = new Subject();
|
|
613
|
-
this.onDraftRenderImageReceived = new Subject();
|
|
614
|
-
this.onArticleInfoReceived = new Subject();
|
|
615
|
-
this.onUpdateProductInfoTab = new Subject();
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
ProductEventService.decorators = [
|
|
619
|
-
{ type: Directive },
|
|
620
|
-
{ type: Injectable }
|
|
621
|
-
];
|
|
622
|
-
ProductEventService.propDecorators = {
|
|
623
|
-
onAddToCart: [{ type: Output }],
|
|
624
|
-
onAlternativeClick: [{ type: Output }],
|
|
625
|
-
onAddToQuote: [{ type: Output }],
|
|
626
|
-
onForceRenderImage: [{ type: Output }]
|
|
627
|
-
};
|
|
628
|
-
|
|
629
633
|
class IoneProductComponent {
|
|
630
634
|
constructor(_dictionary, _jsonUtils, _ione, _changeDetector, _appEventService, _settingsService) {
|
|
631
635
|
// this.sku = 'CF-HILL';
|
|
@@ -1177,7 +1181,7 @@ class ImageCarouselComponent {
|
|
|
1177
1181
|
}
|
|
1178
1182
|
set images(value) {
|
|
1179
1183
|
if (value && value.length > 0) {
|
|
1180
|
-
this._images = value;
|
|
1184
|
+
this._images = this._filterValidImages(value);
|
|
1181
1185
|
this._loadImages();
|
|
1182
1186
|
this._changeDetector.detectChanges();
|
|
1183
1187
|
}
|
|
@@ -1236,6 +1240,15 @@ class ImageCarouselComponent {
|
|
|
1236
1240
|
}
|
|
1237
1241
|
return this._domSanitizer.bypassSecurityTrustUrl(source);
|
|
1238
1242
|
}
|
|
1243
|
+
_filterValidImages(value) {
|
|
1244
|
+
if (!value) {
|
|
1245
|
+
return [];
|
|
1246
|
+
}
|
|
1247
|
+
return value.filter(doc => {
|
|
1248
|
+
const pattern = /\.(jpg|jpeg|png|gif|bmp|tiff|webp)$/i;
|
|
1249
|
+
return pattern.test(doc.fileName) || !!doc.filePath;
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1239
1252
|
_loadImages() {
|
|
1240
1253
|
if (this._images) {
|
|
1241
1254
|
this._images.forEach((i) => {
|
|
@@ -1595,14 +1608,22 @@ class ProductAddtocartComponent {
|
|
|
1595
1608
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1596
1609
|
if (this.createFrozenArticle) {
|
|
1597
1610
|
if (this.article.goodType === 'B') {
|
|
1598
|
-
this.
|
|
1599
|
-
|
|
1600
|
-
quantity: quantity
|
|
1601
|
-
}
|
|
1611
|
+
const article = yield this._getJSONFromArticleObject({ article: this.article, quantity: quantity });
|
|
1612
|
+
if (article) {
|
|
1613
|
+
this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
|
|
1614
|
+
}
|
|
1602
1615
|
}
|
|
1603
1616
|
else {
|
|
1604
|
-
|
|
1605
|
-
this.
|
|
1617
|
+
let article;
|
|
1618
|
+
if (!!this.externalSource) {
|
|
1619
|
+
article = yield this._getJSONFromArticleObject({ article: this.article, quantity: quantity });
|
|
1620
|
+
}
|
|
1621
|
+
else {
|
|
1622
|
+
article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
|
|
1623
|
+
}
|
|
1624
|
+
if (article) {
|
|
1625
|
+
this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
|
|
1626
|
+
}
|
|
1606
1627
|
}
|
|
1607
1628
|
}
|
|
1608
1629
|
else {
|
|
@@ -2489,7 +2510,10 @@ IoneProductModule.decorators = [
|
|
|
2489
2510
|
IoneProductComponent
|
|
2490
2511
|
],
|
|
2491
2512
|
providers: [
|
|
2492
|
-
ProductSettingsService
|
|
2513
|
+
ProductSettingsService,
|
|
2514
|
+
ProductConnectorService,
|
|
2515
|
+
ProductEventService,
|
|
2516
|
+
ProductConnectorAdapterService
|
|
2493
2517
|
]
|
|
2494
2518
|
},] }
|
|
2495
2519
|
];
|
|
@@ -2589,7 +2613,6 @@ ProductExternalSourceComponent.decorators = [
|
|
|
2589
2613
|
</ng-container>
|
|
2590
2614
|
`,
|
|
2591
2615
|
providers: [
|
|
2592
|
-
ProductEventService,
|
|
2593
2616
|
ProductSettingsService,
|
|
2594
2617
|
ProductConnectorAdapterService,
|
|
2595
2618
|
ProductConnectorService
|