@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
|
@@ -34,6 +34,7 @@ export declare class ImageCarouselComponent implements OnInit, OnDestroy {
|
|
|
34
34
|
handleThumbClick(index: number): void;
|
|
35
35
|
onForceRenderImage(): void;
|
|
36
36
|
getImageSrc(image: CoDocument | CustomEvent): SafeUrl;
|
|
37
|
+
private _filterValidImages;
|
|
37
38
|
private _loadImages;
|
|
38
39
|
private _scrollCarouselToIndex;
|
|
39
40
|
}
|
|
@@ -9,12 +9,15 @@ import { DeliveryPrognosis } from '@colijnit/articleapi/build/model/delivery-pro
|
|
|
9
9
|
import { DocumentContent } from '@colijnit/articleapi/build/model/document-content';
|
|
10
10
|
import { Transaction } from '@colijnit/transactionapi/build/transaction';
|
|
11
11
|
import { ArticleListObjectExtended } from '@colijnit/articleapi/build/model/article-list-object-extended.bo';
|
|
12
|
+
import { ProductEventService } from './product-event.service';
|
|
12
13
|
export declare class ProductConnectorAdapterService implements OnDestroy {
|
|
14
|
+
private _eventService;
|
|
13
15
|
readonly showLoader: Subject<boolean>;
|
|
14
16
|
articleConnector?: Articles;
|
|
15
17
|
transactionConnector: Transaction;
|
|
16
18
|
private _boFactory;
|
|
17
|
-
|
|
19
|
+
private _subs;
|
|
20
|
+
constructor(_eventService: ProductEventService);
|
|
18
21
|
ngOnDestroy(): void;
|
|
19
22
|
initConnector(options: Options): Promise<void>;
|
|
20
23
|
setInstance(instanceId: string): void;
|
|
@@ -3,6 +3,7 @@ import { ArticleListObject } from '@colijnit/articleapi/build/model/article-list
|
|
|
3
3
|
import { Selection } from '@colijnit/articleapi/build/model/selection';
|
|
4
4
|
import { ArticleQuickSel } from '@colijnit/articleapi/build/model/article-quick-sel';
|
|
5
5
|
import { ArticleListObjectExtended } from '@colijnit/articleapi/build/model/article-list-object-extended.bo';
|
|
6
|
+
import { ValidationMessage } from '@colijnit/ioneconnector/build/model/validation-message';
|
|
6
7
|
export declare class ProductEventService {
|
|
7
8
|
onAddToCart: Subject<{
|
|
8
9
|
article: string | ArticleListObjectExtended;
|
|
@@ -19,4 +20,5 @@ export declare class ProductEventService {
|
|
|
19
20
|
onDraftRenderImageReceived: Subject<string>;
|
|
20
21
|
onArticleInfoReceived: Subject<string>;
|
|
21
22
|
onUpdateProductInfoTab: Subject<number>;
|
|
23
|
+
errorMessage: Subject<ValidationMessage[]>;
|
|
22
24
|
}
|
|
@@ -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.
|
|
35
|
-
this.publishDate = "
|
|
34
|
+
this.symVer = "256.1.2";
|
|
35
|
+
this.publishDate = "8-11-2024 14:14:34";
|
|
36
36
|
}
|
|
37
37
|
return Version;
|
|
38
38
|
}());
|
|
@@ -598,15 +598,40 @@
|
|
|
598
598
|
return ProductSettings;
|
|
599
599
|
}());
|
|
600
600
|
|
|
601
|
+
var ProductEventService = /** @class */ (function () {
|
|
602
|
+
function ProductEventService() {
|
|
603
|
+
this.onAddToCart = new rxjs.Subject();
|
|
604
|
+
this.onAlternativeClick = new rxjs.Subject();
|
|
605
|
+
this.onAddToQuote = new rxjs.Subject();
|
|
606
|
+
this.onForceRenderImage = new rxjs.Subject();
|
|
607
|
+
this.onArticleReceived = new rxjs.Subject();
|
|
608
|
+
this.onSelectionsReceived = new rxjs.Subject();
|
|
609
|
+
this.onImageReceived = new rxjs.Subject();
|
|
610
|
+
this.onRenderStarted = new rxjs.Subject();
|
|
611
|
+
this.onRenderImageReceived = new rxjs.Subject();
|
|
612
|
+
this.onDraftRenderImageReceived = new rxjs.Subject();
|
|
613
|
+
this.onArticleInfoReceived = new rxjs.Subject();
|
|
614
|
+
this.onUpdateProductInfoTab = new rxjs.Subject();
|
|
615
|
+
this.errorMessage = new rxjs.Subject();
|
|
616
|
+
}
|
|
617
|
+
return ProductEventService;
|
|
618
|
+
}());
|
|
619
|
+
ProductEventService.decorators = [
|
|
620
|
+
{ type: i0.Directive },
|
|
621
|
+
{ type: i0.Injectable }
|
|
622
|
+
];
|
|
623
|
+
|
|
601
624
|
// 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.
|
|
602
625
|
// Only to be used by the IOneControllerService.
|
|
603
626
|
var ProductConnectorAdapterService = /** @class */ (function () {
|
|
604
|
-
function ProductConnectorAdapterService() {
|
|
627
|
+
function ProductConnectorAdapterService(_eventService) {
|
|
628
|
+
this._eventService = _eventService;
|
|
605
629
|
this.showLoader = new rxjs.Subject();
|
|
606
630
|
this._boFactory = new businessObjectFactory.BusinessObjectFactory();
|
|
631
|
+
this._subs = [];
|
|
607
632
|
}
|
|
608
633
|
ProductConnectorAdapterService.prototype.ngOnDestroy = function () {
|
|
609
|
-
this.
|
|
634
|
+
this._subs.forEach(function (s) { return s.unsubscribe(); });
|
|
610
635
|
};
|
|
611
636
|
ProductConnectorAdapterService.prototype.initConnector = function (options) {
|
|
612
637
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -619,7 +644,9 @@
|
|
|
619
644
|
case 1:
|
|
620
645
|
_a.sent();
|
|
621
646
|
this.transactionConnector = new transaction.Transaction(options);
|
|
622
|
-
this.
|
|
647
|
+
this._subs.push(
|
|
648
|
+
// @ts-ignore
|
|
649
|
+
this.articleConnector.showLoader.subscribe(function (value) { return _this.showLoader.next(value); }));
|
|
623
650
|
return [2 /*return*/];
|
|
624
651
|
}
|
|
625
652
|
});
|
|
@@ -750,8 +777,12 @@
|
|
|
750
777
|
if (externalSource === void 0) { externalSource = false; }
|
|
751
778
|
if (showLoader === void 0) { showLoader = true; }
|
|
752
779
|
return __awaiter(this, void 0, void 0, function () {
|
|
780
|
+
var _this = this;
|
|
753
781
|
return __generator(this, function (_a) {
|
|
754
|
-
return [2 /*return*/, this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics)
|
|
782
|
+
return [2 /*return*/, this.articleConnector.getJsonArticleFlatTree(goodId, goodType, quantity, externalSource, showLoader, instanceId, configuratorStatistics).catch(function (messages) {
|
|
783
|
+
_this._eventService.errorMessage.next(messages);
|
|
784
|
+
return null;
|
|
785
|
+
})];
|
|
755
786
|
});
|
|
756
787
|
});
|
|
757
788
|
};
|
|
@@ -854,7 +885,9 @@
|
|
|
854
885
|
ProductConnectorAdapterService.decorators = [
|
|
855
886
|
{ type: i0.Injectable }
|
|
856
887
|
];
|
|
857
|
-
ProductConnectorAdapterService.ctorParameters = function () { return [
|
|
888
|
+
ProductConnectorAdapterService.ctorParameters = function () { return [
|
|
889
|
+
{ type: ProductEventService }
|
|
890
|
+
]; };
|
|
858
891
|
|
|
859
892
|
var LanguageCode;
|
|
860
893
|
(function (LanguageCode) {
|
|
@@ -1256,34 +1289,6 @@
|
|
|
1256
1289
|
{ type: ProductSettingsService }
|
|
1257
1290
|
]; };
|
|
1258
1291
|
|
|
1259
|
-
var ProductEventService = /** @class */ (function () {
|
|
1260
|
-
function ProductEventService() {
|
|
1261
|
-
this.onAddToCart = new rxjs.Subject();
|
|
1262
|
-
this.onAlternativeClick = new rxjs.Subject();
|
|
1263
|
-
this.onAddToQuote = new rxjs.Subject();
|
|
1264
|
-
this.onForceRenderImage = new rxjs.Subject();
|
|
1265
|
-
this.onArticleReceived = new rxjs.Subject();
|
|
1266
|
-
this.onSelectionsReceived = new rxjs.Subject();
|
|
1267
|
-
this.onImageReceived = new rxjs.Subject();
|
|
1268
|
-
this.onRenderStarted = new rxjs.Subject();
|
|
1269
|
-
this.onRenderImageReceived = new rxjs.Subject();
|
|
1270
|
-
this.onDraftRenderImageReceived = new rxjs.Subject();
|
|
1271
|
-
this.onArticleInfoReceived = new rxjs.Subject();
|
|
1272
|
-
this.onUpdateProductInfoTab = new rxjs.Subject();
|
|
1273
|
-
}
|
|
1274
|
-
return ProductEventService;
|
|
1275
|
-
}());
|
|
1276
|
-
ProductEventService.decorators = [
|
|
1277
|
-
{ type: i0.Directive },
|
|
1278
|
-
{ type: i0.Injectable }
|
|
1279
|
-
];
|
|
1280
|
-
ProductEventService.propDecorators = {
|
|
1281
|
-
onAddToCart: [{ type: i0.Output }],
|
|
1282
|
-
onAlternativeClick: [{ type: i0.Output }],
|
|
1283
|
-
onAddToQuote: [{ type: i0.Output }],
|
|
1284
|
-
onForceRenderImage: [{ type: i0.Output }]
|
|
1285
|
-
};
|
|
1286
|
-
|
|
1287
1292
|
var IoneProductComponent = /** @class */ (function () {
|
|
1288
1293
|
function IoneProductComponent(_dictionary, _jsonUtils, _ione, _changeDetector, _appEventService, _settingsService) {
|
|
1289
1294
|
var _this = this;
|
|
@@ -1885,7 +1890,7 @@
|
|
|
1885
1890
|
},
|
|
1886
1891
|
set: function (value) {
|
|
1887
1892
|
if (value && value.length > 0) {
|
|
1888
|
-
this._images = value;
|
|
1893
|
+
this._images = this._filterValidImages(value);
|
|
1889
1894
|
this._loadImages();
|
|
1890
1895
|
this._changeDetector.detectChanges();
|
|
1891
1896
|
}
|
|
@@ -1949,6 +1954,15 @@
|
|
|
1949
1954
|
}
|
|
1950
1955
|
return this._domSanitizer.bypassSecurityTrustUrl(source);
|
|
1951
1956
|
};
|
|
1957
|
+
ImageCarouselComponent.prototype._filterValidImages = function (value) {
|
|
1958
|
+
if (!value) {
|
|
1959
|
+
return [];
|
|
1960
|
+
}
|
|
1961
|
+
return value.filter(function (doc) {
|
|
1962
|
+
var pattern = /\.(jpg|jpeg|png|gif|bmp|tiff|webp)$/i;
|
|
1963
|
+
return pattern.test(doc.fileName) || !!doc.filePath;
|
|
1964
|
+
});
|
|
1965
|
+
};
|
|
1952
1966
|
ImageCarouselComponent.prototype._loadImages = function () {
|
|
1953
1967
|
var _this = this;
|
|
1954
1968
|
if (this._images) {
|
|
@@ -2291,30 +2305,40 @@
|
|
|
2291
2305
|
};
|
|
2292
2306
|
ProductAddtocartComponent.prototype.handleAddToCartClick = function (quantity) {
|
|
2293
2307
|
return __awaiter(this, void 0, void 0, function () {
|
|
2294
|
-
var
|
|
2295
|
-
return __generator(this, function (
|
|
2296
|
-
switch (
|
|
2308
|
+
var article, article, article;
|
|
2309
|
+
return __generator(this, function (_a) {
|
|
2310
|
+
switch (_a.label) {
|
|
2297
2311
|
case 0:
|
|
2298
|
-
if (!this.createFrozenArticle) return [3 /*break*/,
|
|
2312
|
+
if (!this.createFrozenArticle) return [3 /*break*/, 7];
|
|
2299
2313
|
if (!(this.article.goodType === 'B')) return [3 /*break*/, 2];
|
|
2300
|
-
_b = (_a = this._appEventService.onAddToCart).next;
|
|
2301
|
-
_c = {};
|
|
2302
2314
|
return [4 /*yield*/, this._getJSONFromArticleObject({ article: this.article, quantity: quantity })];
|
|
2303
2315
|
case 1:
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2316
|
+
article = _a.sent();
|
|
2317
|
+
if (article) {
|
|
2318
|
+
this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
|
|
2319
|
+
}
|
|
2320
|
+
return [3 /*break*/, 6];
|
|
2308
2321
|
case 2:
|
|
2309
|
-
article =
|
|
2310
|
-
this.
|
|
2311
|
-
|
|
2312
|
-
case 3:
|
|
2322
|
+
article = void 0;
|
|
2323
|
+
if (!!!this.externalSource) return [3 /*break*/, 4];
|
|
2324
|
+
return [4 /*yield*/, this._getJSONFromArticleObject({ article: this.article, quantity: quantity })];
|
|
2325
|
+
case 3:
|
|
2326
|
+
article = _a.sent();
|
|
2327
|
+
return [3 /*break*/, 5];
|
|
2313
2328
|
case 4:
|
|
2329
|
+
article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
|
|
2330
|
+
_a.label = 5;
|
|
2331
|
+
case 5:
|
|
2332
|
+
if (article) {
|
|
2333
|
+
this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
|
|
2334
|
+
}
|
|
2335
|
+
_a.label = 6;
|
|
2336
|
+
case 6: return [3 /*break*/, 8];
|
|
2337
|
+
case 7:
|
|
2314
2338
|
article = this._ioneControllerService.convertArticleFullObjectToArticleExtended(this.article);
|
|
2315
2339
|
this._appEventService.onAddToCart.next({ article: article, quantity: quantity });
|
|
2316
|
-
|
|
2317
|
-
case
|
|
2340
|
+
_a.label = 8;
|
|
2341
|
+
case 8: return [2 /*return*/];
|
|
2318
2342
|
}
|
|
2319
2343
|
});
|
|
2320
2344
|
});
|
|
@@ -3214,7 +3238,10 @@
|
|
|
3214
3238
|
IoneProductComponent
|
|
3215
3239
|
],
|
|
3216
3240
|
providers: [
|
|
3217
|
-
ProductSettingsService
|
|
3241
|
+
ProductSettingsService,
|
|
3242
|
+
ProductConnectorService,
|
|
3243
|
+
ProductEventService,
|
|
3244
|
+
ProductConnectorAdapterService
|
|
3218
3245
|
]
|
|
3219
3246
|
},] }
|
|
3220
3247
|
];
|
|
@@ -3316,7 +3343,6 @@
|
|
|
3316
3343
|
selector: 'co-product-external-source',
|
|
3317
3344
|
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=\"!showProduct\">\n <iframe width=\"100%\" height=\"100%\" [src]=\"safeUrl\" frameborder=\"0\" allowfullscreen></iframe>\n </ng-container>\n </ng-container>\n ",
|
|
3318
3345
|
providers: [
|
|
3319
|
-
ProductEventService,
|
|
3320
3346
|
ProductSettingsService,
|
|
3321
3347
|
ProductConnectorAdapterService,
|
|
3322
3348
|
ProductConnectorService
|