@colijnit/configurator 1.0.13 → 1.0.17
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/builder.d.ts +12 -11
- package/app/components/answers/answer/answer.component.d.ts +0 -1
- package/app/services/configurator.service.d.ts +9 -14
- package/app/services/locator.service.d.ts +4 -0
- package/bundles/colijnit-configurator.umd.js +207 -76
- package/bundles/colijnit-configurator.umd.js.map +1 -1
- package/bundles/colijnit-configurator.umd.min.js +2 -2
- package/bundles/colijnit-configurator.umd.min.js.map +1 -1
- package/colijnit-configurator.d.ts +6 -7
- package/colijnit-configurator.metadata.json +1 -1
- package/esm2015/app/builder.js +67 -25
- package/esm2015/app/components/answers/answer/answer.component.js +26 -17
- package/esm2015/app/components/answers/answers.component.js +16 -13
- package/esm2015/app/components/selections/selections.component.js +45 -25
- package/esm2015/app/services/configurator.service.js +36 -21
- package/esm2015/app/services/image-cache.service.js +3 -1
- package/esm2015/app/services/locator.service.js +10 -0
- package/esm2015/colijnit-configurator.js +7 -8
- package/esm2015/public_api.js +2 -1
- package/esm5/app/builder.js +116 -34
- package/esm5/app/components/answers/answer/answer.component.js +20 -10
- package/esm5/app/components/answers/answers.component.js +3 -3
- package/esm5/app/components/selections/selections.component.js +4 -4
- package/esm5/app/services/configurator.service.js +55 -22
- package/esm5/app/services/image-cache.service.js +3 -1
- package/esm5/app/services/locator.service.js +13 -0
- package/esm5/colijnit-configurator.js +7 -8
- package/esm5/public_api.js +2 -1
- package/fesm2015/colijnit-configurator.js +192 -96
- package/fesm2015/colijnit-configurator.js.map +1 -1
- package/fesm5/colijnit-configurator.js +203 -68
- package/fesm5/colijnit-configurator.js.map +1 -1
- package/package.json +2 -2
- package/public_api.d.ts +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __generator, __extends, __decorate, __values } from 'tslib';
|
|
2
|
-
import { Mesh, ObjectLoader, Camera, Group, TextureLoader, RepeatWrapping, Object3D, Box3, Vector3, Vector2, Euler, Quaternion, Color, Texture, sRGBEncoding, MeshPhongMaterial, MeshStandardMaterial } from 'three';
|
|
2
|
+
import { Mesh, ObjectLoader, Camera, Group, TextureLoader, RepeatWrapping, Object3D, Box3, Vector3, Vector2, Euler, Quaternion, Color, Texture, sRGBEncoding, MeshPhongMaterial, MeshStandardMaterial, Scene } from 'three';
|
|
3
|
+
import { Options } from '@colijnit/configuratorapi/build/model/options';
|
|
3
4
|
import { DecoNode } from '@colijnit/configuratorapi/build/model/deco-node';
|
|
4
5
|
import { BusinessObjectFactory } from '@colijnit/configuratorapi/build/service/business-object-factory';
|
|
5
6
|
import { Selection } from '@colijnit/configuratorapi/build/model/selection';
|
|
@@ -8,8 +9,11 @@ import axios from 'axios';
|
|
|
8
9
|
import { DecoNodeKind } from '@colijnit/configuratorapi/build/enum/deco-node-kind.enum';
|
|
9
10
|
import * as JSZip from 'jszip';
|
|
10
11
|
import { Article } from '@colijnit/configuratorapi/build/model/article';
|
|
11
|
-
import { ɵɵdefineInjectable,
|
|
12
|
+
import { Injectable, Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, EventEmitter, Input, Output, Component, Directive, ElementRef, NgModule } from '@angular/core';
|
|
12
13
|
import { Configurator } from '@colijnit/configuratorapi/build/configurator';
|
|
14
|
+
import { notNill } from '@colijnit/configuratorapi/build/utils/function/not-nill.function';
|
|
15
|
+
import { NodeType } from '@colijnit/configuratorapi/build/enum/node-type.enum';
|
|
16
|
+
import { isNill } from '@colijnit/configuratorapi/build/utils/function/is-nill.function';
|
|
13
17
|
import { BehaviorSubject } from 'rxjs';
|
|
14
18
|
import { CommonModule } from '@angular/common';
|
|
15
19
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
@@ -1347,22 +1351,25 @@ var VariationHelper = /** @class */ (function () {
|
|
|
1347
1351
|
return VariationHelper;
|
|
1348
1352
|
}());
|
|
1349
1353
|
|
|
1354
|
+
var ServiceLocator = /** @class */ (function () {
|
|
1355
|
+
function ServiceLocator() {
|
|
1356
|
+
}
|
|
1357
|
+
ServiceLocator.injector = undefined;
|
|
1358
|
+
ServiceLocator = __decorate([
|
|
1359
|
+
Injectable()
|
|
1360
|
+
], ServiceLocator);
|
|
1361
|
+
return ServiceLocator;
|
|
1362
|
+
}());
|
|
1363
|
+
|
|
1350
1364
|
var ConfiguratorService = /** @class */ (function () {
|
|
1351
|
-
function ConfiguratorService() {
|
|
1352
|
-
this.
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1365
|
+
function ConfiguratorService(_injector) {
|
|
1366
|
+
this._injector = _injector;
|
|
1367
|
+
if (!ServiceLocator.injector) {
|
|
1368
|
+
ServiceLocator.injector = _injector;
|
|
1369
|
+
}
|
|
1356
1370
|
}
|
|
1357
|
-
ConfiguratorService.prototype.ngOnDestroy = function () {
|
|
1358
|
-
this._subs.forEach(function (subscription) {
|
|
1359
|
-
subscription.unsubscribe();
|
|
1360
|
-
});
|
|
1361
|
-
};
|
|
1362
1371
|
ConfiguratorService.prototype.initApi = function (options) {
|
|
1363
|
-
var _this = this;
|
|
1364
1372
|
this._configuratorApi = new Configurator(options);
|
|
1365
|
-
this._subs.push(this._configuratorApi.selectionsReceived.subscribe(function (selections) { return _this.selectionsReceived.next(selections); }), this._configuratorApi.answersReceived.subscribe(function (answers) { return _this.answersReceived.next(answers); }), this._configuratorApi.questionReceived.subscribe(function (question) { return _this.questionReceived.next(question); }));
|
|
1366
1373
|
};
|
|
1367
1374
|
ConfiguratorService.prototype.initNodeInstance = function (goodId) {
|
|
1368
1375
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1407,13 +1414,21 @@ var ConfiguratorService = /** @class */ (function () {
|
|
|
1407
1414
|
});
|
|
1408
1415
|
});
|
|
1409
1416
|
};
|
|
1410
|
-
ConfiguratorService.prototype.getSelections = function (showLoader) {
|
|
1417
|
+
ConfiguratorService.prototype.getSelections = function (showLoader, publicationCode) {
|
|
1411
1418
|
if (showLoader === void 0) { showLoader = false; }
|
|
1419
|
+
if (publicationCode === void 0) { publicationCode = 2; }
|
|
1412
1420
|
return __awaiter(this, void 0, void 0, function () {
|
|
1421
|
+
var selections;
|
|
1413
1422
|
return __generator(this, function (_a) {
|
|
1414
1423
|
switch (_a.label) {
|
|
1415
1424
|
case 0: return [4 /*yield*/, this._configuratorApi.getSelections(showLoader)];
|
|
1416
|
-
case 1:
|
|
1425
|
+
case 1:
|
|
1426
|
+
selections = _a.sent();
|
|
1427
|
+
selections.resultObjects.filter(function (s) {
|
|
1428
|
+
(isNill(s.hierarchicalPublicationCode) || ((s.hierarchicalPublicationCode & publicationCode) > 0)) && ((s.nodeType === NodeType.Question && (((s.questionPublicationCode & publicationCode) > 0) || isNill(s.questionPublicationCode))) ||
|
|
1429
|
+
(s.nodeType === NodeType.Answer && (((s.answerPublicationCode & publicationCode) > 0) || isNill(s.answerPublicationCode))));
|
|
1430
|
+
});
|
|
1431
|
+
return [2 /*return*/, selections];
|
|
1417
1432
|
}
|
|
1418
1433
|
});
|
|
1419
1434
|
});
|
|
@@ -1429,11 +1444,23 @@ var ConfiguratorService = /** @class */ (function () {
|
|
|
1429
1444
|
});
|
|
1430
1445
|
});
|
|
1431
1446
|
};
|
|
1432
|
-
ConfiguratorService.prototype.getQuestionAndAnswers = function (showLoader) {
|
|
1447
|
+
ConfiguratorService.prototype.getQuestionAndAnswers = function (showLoader, publicationCode) {
|
|
1433
1448
|
if (showLoader === void 0) { showLoader = false; }
|
|
1449
|
+
if (publicationCode === void 0) { publicationCode = 2; }
|
|
1434
1450
|
return __awaiter(this, void 0, void 0, function () {
|
|
1451
|
+
var questionAndAnswers;
|
|
1435
1452
|
return __generator(this, function (_a) {
|
|
1436
|
-
|
|
1453
|
+
switch (_a.label) {
|
|
1454
|
+
case 0: return [4 /*yield*/, this._configuratorApi.getQuestionAndAnswers(showLoader)];
|
|
1455
|
+
case 1:
|
|
1456
|
+
questionAndAnswers = _a.sent();
|
|
1457
|
+
questionAndAnswers.answers.filter(function (answer) {
|
|
1458
|
+
(notNill(answer.hierarchicalPublicationCode) && (answer.hierarchicalPublicationCode & publicationCode) === 0) ||
|
|
1459
|
+
(answer.type === NodeType.Question && (answer.questionPublicationCode & publicationCode) === 0 && notNill(answer.questionPublicationCode)) ||
|
|
1460
|
+
(answer.type === NodeType.Answer && (answer.publicationCode & publicationCode) === 0 && notNill(answer.publicationCode));
|
|
1461
|
+
});
|
|
1462
|
+
return [2 /*return*/, questionAndAnswers];
|
|
1463
|
+
}
|
|
1437
1464
|
});
|
|
1438
1465
|
});
|
|
1439
1466
|
};
|
|
@@ -1453,13 +1480,30 @@ var ConfiguratorService = /** @class */ (function () {
|
|
|
1453
1480
|
};
|
|
1454
1481
|
ConfiguratorService.prototype.selectSelection = function (selection, showLoader) {
|
|
1455
1482
|
if (showLoader === void 0) { showLoader = false; }
|
|
1456
|
-
this
|
|
1483
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1484
|
+
return __generator(this, function (_a) {
|
|
1485
|
+
switch (_a.label) {
|
|
1486
|
+
case 0: return [4 /*yield*/, this._configuratorApi.selectSelection(selection, showLoader)];
|
|
1487
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
});
|
|
1457
1491
|
};
|
|
1458
1492
|
ConfiguratorService.prototype.selectAnswer = function (answer, showLoader) {
|
|
1459
1493
|
if (showLoader === void 0) { showLoader = false; }
|
|
1460
|
-
this
|
|
1494
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1495
|
+
return __generator(this, function (_a) {
|
|
1496
|
+
switch (_a.label) {
|
|
1497
|
+
case 0: return [4 /*yield*/, this._configuratorApi.selectAnswer(answer, showLoader)];
|
|
1498
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
});
|
|
1461
1502
|
};
|
|
1462
|
-
ConfiguratorService
|
|
1503
|
+
ConfiguratorService.ctorParameters = function () { return [
|
|
1504
|
+
{ type: Injector }
|
|
1505
|
+
]; };
|
|
1506
|
+
ConfiguratorService.ɵprov = ɵɵdefineInjectable({ factory: function ConfiguratorService_Factory() { return new ConfiguratorService(ɵɵinject(INJECTOR)); }, token: ConfiguratorService, providedIn: "root" });
|
|
1463
1507
|
ConfiguratorService = __decorate([
|
|
1464
1508
|
Injectable({
|
|
1465
1509
|
providedIn: 'root'
|
|
@@ -1469,71 +1513,76 @@ var ConfiguratorService = /** @class */ (function () {
|
|
|
1469
1513
|
}());
|
|
1470
1514
|
|
|
1471
1515
|
var Builder = /** @class */ (function () {
|
|
1472
|
-
function Builder(
|
|
1473
|
-
var _this = this;
|
|
1474
|
-
this._configuratorService = _configuratorService;
|
|
1516
|
+
function Builder(scene, options, useInAngular) {
|
|
1475
1517
|
this.selectionsReceived = new BehaviorSubject([]);
|
|
1476
1518
|
this.answersReceived = new BehaviorSubject([]);
|
|
1477
|
-
this.
|
|
1519
|
+
this.modelLoaded = new BehaviorSubject(null);
|
|
1478
1520
|
this._selections = [];
|
|
1521
|
+
this._answers = [];
|
|
1479
1522
|
this._decos = [];
|
|
1480
1523
|
this._placedAdjustables = [];
|
|
1481
1524
|
this._placedAddables = [];
|
|
1482
1525
|
this._adjustables = [];
|
|
1483
1526
|
this._addables = [];
|
|
1484
1527
|
this._articleCache = new Map();
|
|
1485
|
-
this._subs = [];
|
|
1486
1528
|
this._boFactory = new BusinessObjectFactory();
|
|
1487
1529
|
this._threedUtils = new ThreedUtils();
|
|
1488
1530
|
this._variationHelper = new VariationHelper();
|
|
1489
|
-
this._subs.push(this._configuratorService.selectionsReceived.subscribe(function (selections) { return _this.selectionsReceived.next(selections); }), this._configuratorService.answersReceived.subscribe(function (answers) { return _this.answersReceived.next(answers); }), this._configuratorService.questionReceived.subscribe(function (question) { return _this.questionReceived.next(question); }));
|
|
1490
|
-
}
|
|
1491
|
-
Builder.prototype.init = function (scene, options) {
|
|
1492
1531
|
if (!scene) {
|
|
1493
1532
|
throw 'No scene object provided!';
|
|
1494
1533
|
}
|
|
1495
1534
|
if (!options) {
|
|
1496
1535
|
throw 'No connection options provided!';
|
|
1497
1536
|
}
|
|
1498
|
-
if (
|
|
1499
|
-
this._configuratorService =
|
|
1537
|
+
if (useInAngular) {
|
|
1538
|
+
this._configuratorService = ServiceLocator.injector.get(ConfiguratorService);
|
|
1539
|
+
}
|
|
1540
|
+
else {
|
|
1541
|
+
this._configuratorService = new ConfiguratorService(undefined);
|
|
1500
1542
|
}
|
|
1501
1543
|
this._configuratorService.initApi(options);
|
|
1502
1544
|
this._scene = scene;
|
|
1503
|
-
}
|
|
1504
|
-
Builder.prototype.buildModel = function (
|
|
1545
|
+
}
|
|
1546
|
+
Builder.prototype.buildModel = function (sku, instanceId, goodId) {
|
|
1505
1547
|
return __awaiter(this, void 0, void 0, function () {
|
|
1506
1548
|
var promises, e_1;
|
|
1507
1549
|
return __generator(this, function (_a) {
|
|
1508
1550
|
switch (_a.label) {
|
|
1509
1551
|
case 0:
|
|
1510
|
-
if (!this._scene
|
|
1552
|
+
if (!this._scene) {
|
|
1511
1553
|
return [2 /*return*/];
|
|
1512
1554
|
}
|
|
1513
1555
|
_a.label = 1;
|
|
1514
1556
|
case 1:
|
|
1515
|
-
_a.trys.push([1,
|
|
1516
|
-
return [4 /*yield*/, this.
|
|
1557
|
+
_a.trys.push([1, 8, , 9]);
|
|
1558
|
+
return [4 /*yield*/, this._setInstanceId(sku, instanceId, goodId)];
|
|
1517
1559
|
case 2:
|
|
1518
1560
|
_a.sent();
|
|
1519
|
-
|
|
1520
|
-
return [4 /*yield*/, this._configuratorService.setInstanceToConfigure(instanceId)];
|
|
1561
|
+
return [4 /*yield*/, this._prepareConfiguration(this._sku, this._goodId)];
|
|
1521
1562
|
case 3:
|
|
1563
|
+
_a.sent();
|
|
1564
|
+
if (!this._source) return [3 /*break*/, 6];
|
|
1565
|
+
return [4 /*yield*/, this._configuratorService.setInstanceToConfigure(this._instanceId)];
|
|
1566
|
+
case 4:
|
|
1522
1567
|
_a.sent();
|
|
1523
1568
|
promises = [];
|
|
1524
|
-
promises.push(this.
|
|
1569
|
+
promises.push(this.getQuestionAndAnswers());
|
|
1570
|
+
promises.push(this._getSelections(this._instanceId));
|
|
1525
1571
|
promises.push(this._getDecos());
|
|
1526
1572
|
return [4 /*yield*/, Promise.all(promises)];
|
|
1527
|
-
case
|
|
1573
|
+
case 5:
|
|
1528
1574
|
_a.sent();
|
|
1575
|
+
if (this._answers.length > 0) {
|
|
1576
|
+
return [2 /*return*/];
|
|
1577
|
+
}
|
|
1529
1578
|
this._linkSelectionsAndDecos();
|
|
1530
|
-
return [2 /*return*/, this._build(
|
|
1531
|
-
case
|
|
1532
|
-
case
|
|
1533
|
-
case
|
|
1579
|
+
return [2 /*return*/, this._build(this._instanceId)];
|
|
1580
|
+
case 6: throw 'GLB source not found!';
|
|
1581
|
+
case 7: return [3 /*break*/, 9];
|
|
1582
|
+
case 8:
|
|
1534
1583
|
e_1 = _a.sent();
|
|
1535
1584
|
throw e_1;
|
|
1536
|
-
case
|
|
1585
|
+
case 9: return [2 /*return*/];
|
|
1537
1586
|
}
|
|
1538
1587
|
});
|
|
1539
1588
|
});
|
|
@@ -1546,17 +1595,87 @@ var Builder = /** @class */ (function () {
|
|
|
1546
1595
|
this._variationHelper.clearCache();
|
|
1547
1596
|
};
|
|
1548
1597
|
Builder.prototype.selectSelection = function (selection) {
|
|
1549
|
-
this
|
|
1598
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1599
|
+
return __generator(this, function (_a) {
|
|
1600
|
+
switch (_a.label) {
|
|
1601
|
+
case 0: return [4 /*yield*/, this._configuratorService.selectSelection(selection, false)];
|
|
1602
|
+
case 1:
|
|
1603
|
+
_a.sent();
|
|
1604
|
+
this.getQuestionAndAnswers();
|
|
1605
|
+
return [2 /*return*/];
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
});
|
|
1550
1609
|
};
|
|
1551
|
-
Builder.prototype.getQuestionAndAnswers = function () {
|
|
1610
|
+
Builder.prototype.getQuestionAndAnswers = function (publicationCode) {
|
|
1552
1611
|
return __awaiter(this, void 0, void 0, function () {
|
|
1612
|
+
var questionsAndAnswers;
|
|
1553
1613
|
return __generator(this, function (_a) {
|
|
1554
|
-
|
|
1614
|
+
switch (_a.label) {
|
|
1615
|
+
case 0: return [4 /*yield*/, this._configuratorService.getQuestionAndAnswers(false, publicationCode)];
|
|
1616
|
+
case 1:
|
|
1617
|
+
questionsAndAnswers = _a.sent();
|
|
1618
|
+
this._answers = questionsAndAnswers.answers;
|
|
1619
|
+
this.answersReceived.next(questionsAndAnswers.answers);
|
|
1620
|
+
return [2 /*return*/];
|
|
1621
|
+
}
|
|
1555
1622
|
});
|
|
1556
1623
|
});
|
|
1557
1624
|
};
|
|
1558
1625
|
Builder.prototype.selectAnswer = function (answer) {
|
|
1559
|
-
this
|
|
1626
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1627
|
+
var _a, _b;
|
|
1628
|
+
return __generator(this, function (_c) {
|
|
1629
|
+
switch (_c.label) {
|
|
1630
|
+
case 0: return [4 /*yield*/, this._configuratorService.selectAnswer(answer, false)];
|
|
1631
|
+
case 1:
|
|
1632
|
+
_c.sent();
|
|
1633
|
+
_b = (_a = this.modelLoaded).next;
|
|
1634
|
+
return [4 /*yield*/, this.buildModel()];
|
|
1635
|
+
case 2:
|
|
1636
|
+
_b.apply(_a, [_c.sent()]);
|
|
1637
|
+
return [2 /*return*/];
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
});
|
|
1641
|
+
};
|
|
1642
|
+
Builder.prototype._setInstanceId = function (sku, instanceId, goodId) {
|
|
1643
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1644
|
+
var result;
|
|
1645
|
+
return __generator(this, function (_a) {
|
|
1646
|
+
switch (_a.label) {
|
|
1647
|
+
case 0:
|
|
1648
|
+
if (!(!instanceId && !this._instanceId)) return [3 /*break*/, 4];
|
|
1649
|
+
if (!!goodId) return [3 /*break*/, 2];
|
|
1650
|
+
return [4 /*yield*/, this._getGoodIdFromSku(sku)];
|
|
1651
|
+
case 1:
|
|
1652
|
+
goodId = _a.sent();
|
|
1653
|
+
_a.label = 2;
|
|
1654
|
+
case 2:
|
|
1655
|
+
this._goodId = goodId;
|
|
1656
|
+
return [4 /*yield*/, this.initNodeInstance(this._goodId)];
|
|
1657
|
+
case 3:
|
|
1658
|
+
result = _a.sent();
|
|
1659
|
+
if (result && result.resultObject) {
|
|
1660
|
+
this._instanceId = result.resultObject;
|
|
1661
|
+
}
|
|
1662
|
+
else {
|
|
1663
|
+
throw 'Failed to initialize node instance';
|
|
1664
|
+
}
|
|
1665
|
+
return [3 /*break*/, 5];
|
|
1666
|
+
case 4:
|
|
1667
|
+
if (!this._instanceId) {
|
|
1668
|
+
this._instanceId = instanceId;
|
|
1669
|
+
}
|
|
1670
|
+
_a.label = 5;
|
|
1671
|
+
case 5:
|
|
1672
|
+
if (!this._sku) {
|
|
1673
|
+
this._sku = sku;
|
|
1674
|
+
}
|
|
1675
|
+
return [2 /*return*/];
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
});
|
|
1560
1679
|
};
|
|
1561
1680
|
Builder.prototype._prepareConfiguration = function (sku, goodId) {
|
|
1562
1681
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1841,19 +1960,21 @@ var Builder = /** @class */ (function () {
|
|
|
1841
1960
|
});
|
|
1842
1961
|
});
|
|
1843
1962
|
};
|
|
1844
|
-
Builder.prototype._getSelections = function (instanceId) {
|
|
1963
|
+
Builder.prototype._getSelections = function (instanceId, publicationCode) {
|
|
1845
1964
|
return __awaiter(this, void 0, void 0, function () {
|
|
1846
1965
|
var selectionResponse;
|
|
1847
1966
|
return __generator(this, function (_a) {
|
|
1848
1967
|
switch (_a.label) {
|
|
1849
1968
|
case 0:
|
|
1850
|
-
this._selections
|
|
1851
|
-
return [4 /*yield*/, this._configuratorService.getSelections(false)];
|
|
1969
|
+
this._selections = [];
|
|
1970
|
+
return [4 /*yield*/, this._configuratorService.getSelections(false, publicationCode)];
|
|
1852
1971
|
case 1:
|
|
1853
1972
|
selectionResponse = _a.sent();
|
|
1854
1973
|
if (selectionResponse.resultObjects && selectionResponse.resultObjects.length > 0) {
|
|
1855
1974
|
this._selections = this._boFactory.makeBOArrayFromRawBackendDataArray(Selection, selectionResponse.resultObjects);
|
|
1856
1975
|
this._selections.forEach(function (s) { return s.instanceId = instanceId; });
|
|
1976
|
+
// const filtered: Selection[] = this._selections.filter(s => s.nodeType !== NodeType.Article && s.presentationLevel === 1);
|
|
1977
|
+
this.selectionsReceived.next(this._selections);
|
|
1857
1978
|
}
|
|
1858
1979
|
else {
|
|
1859
1980
|
throw 'No selections found!';
|
|
@@ -1869,7 +1990,7 @@ var Builder = /** @class */ (function () {
|
|
|
1869
1990
|
return __generator(this, function (_a) {
|
|
1870
1991
|
switch (_a.label) {
|
|
1871
1992
|
case 0:
|
|
1872
|
-
this._decos
|
|
1993
|
+
this._decos = [];
|
|
1873
1994
|
return [4 /*yield*/, this._configuratorService.getDecos(false)];
|
|
1874
1995
|
case 1:
|
|
1875
1996
|
decosResponse = _a.sent();
|
|
@@ -1954,7 +2075,9 @@ var Builder = /** @class */ (function () {
|
|
|
1954
2075
|
this._prepareTheSelections();
|
|
1955
2076
|
};
|
|
1956
2077
|
Builder.ctorParameters = function () { return [
|
|
1957
|
-
{ type:
|
|
2078
|
+
{ type: Scene },
|
|
2079
|
+
{ type: Options },
|
|
2080
|
+
{ type: Boolean }
|
|
1958
2081
|
]; };
|
|
1959
2082
|
Builder = __decorate([
|
|
1960
2083
|
Injectable()
|
|
@@ -1979,8 +2102,8 @@ var AnswersComponent = /** @class */ (function () {
|
|
|
1979
2102
|
AnswersComponent = __decorate([
|
|
1980
2103
|
Component({
|
|
1981
2104
|
selector: "answers",
|
|
1982
|
-
template: "\n <
|
|
1983
|
-
styles: ["
|
|
2105
|
+
template: "\n <div class=\"ione-configurator\">\n <div class=\"rp-answers-slideout\">\n <h2 class=\"answers-title\" [textContent]=\"selectionTitle\"></h2>\n <div class=\"answers-container\" visibilityObserverMaster>\n <answer *ngFor=\"let answer of answers\"\n (click)=\"answerClick.emit(answer)\"\n [answer]=\"answer\"\n visibilityObserver\n #intersection=\"intersection\"\n [observerEnabled]=\"true\"\n [showing]=\"intersection.isIntersecting\"\n ></answer>\n </div>\n \n </div>\n </div>\n ",
|
|
2106
|
+
styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:700;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-content,.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid #000;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:0 0;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;-ms-grid-row-align:center;align-self:center;margin-left:14px}"]
|
|
1984
2107
|
})
|
|
1985
2108
|
], AnswersComponent);
|
|
1986
2109
|
return AnswersComponent;
|
|
@@ -2022,6 +2145,8 @@ var ImageCacheService = /** @class */ (function () {
|
|
|
2022
2145
|
var base64 = ImageCacheService_1._handleResponseData(includeMimeType, thumb, responseData);
|
|
2023
2146
|
_this._imageCache.set(object.nodeId, base64);
|
|
2024
2147
|
resolve(base64);
|
|
2148
|
+
}).catch(function () {
|
|
2149
|
+
reject();
|
|
2025
2150
|
});
|
|
2026
2151
|
}
|
|
2027
2152
|
else {
|
|
@@ -2049,13 +2174,16 @@ var ImageCacheService = /** @class */ (function () {
|
|
|
2049
2174
|
var AnswerComponent = /** @class */ (function () {
|
|
2050
2175
|
function AnswerComponent(_imageCacheService) {
|
|
2051
2176
|
this._imageCacheService = _imageCacheService;
|
|
2052
|
-
this.thumbnailLoaded = false;
|
|
2053
2177
|
}
|
|
2054
2178
|
Object.defineProperty(AnswerComponent.prototype, "showing", {
|
|
2055
2179
|
set: function (value) {
|
|
2056
|
-
|
|
2180
|
+
this.answer.imageData = '';
|
|
2181
|
+
if (value && this.answer.answer !== 'Skip / Cancel') {
|
|
2057
2182
|
this._loadThumbnail(this.answer);
|
|
2058
2183
|
}
|
|
2184
|
+
else {
|
|
2185
|
+
this.answer.imageData = null;
|
|
2186
|
+
}
|
|
2059
2187
|
},
|
|
2060
2188
|
enumerable: true,
|
|
2061
2189
|
configurable: true
|
|
@@ -2063,10 +2191,17 @@ var AnswerComponent = /** @class */ (function () {
|
|
|
2063
2191
|
AnswerComponent.prototype.ngOnInit = function () {
|
|
2064
2192
|
};
|
|
2065
2193
|
AnswerComponent.prototype._loadThumbnail = function (answer) {
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2194
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2195
|
+
return __generator(this, function (_a) {
|
|
2196
|
+
switch (_a.label) {
|
|
2197
|
+
case 0: return [4 /*yield*/, this._imageCacheService.getImageForSelectionOrAnswer(answer).then(function (imageSrc) {
|
|
2198
|
+
answer.imageData = imageSrc === "" ? null : imageSrc;
|
|
2199
|
+
})];
|
|
2200
|
+
case 1:
|
|
2201
|
+
_a.sent();
|
|
2202
|
+
return [2 /*return*/];
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2070
2205
|
});
|
|
2071
2206
|
};
|
|
2072
2207
|
AnswerComponent.ctorParameters = function () { return [
|
|
@@ -2081,7 +2216,7 @@ var AnswerComponent = /** @class */ (function () {
|
|
|
2081
2216
|
AnswerComponent = __decorate([
|
|
2082
2217
|
Component({
|
|
2083
2218
|
selector: 'answer',
|
|
2084
|
-
template: "\n <
|
|
2219
|
+
template: "\n <div class=\"ione-configurator\">\n <div class=\"answer-wrapper\">\n <div class=\"answer-content\" @answerAppear>\n <div class=\"answer-thumbnail\">\n <rp-loader *ngIf=\"answer.imageData === ''\"></rp-loader>\n <img *ngIf=\"answer.imageData !== '' && answer.imageData !== null\" class=\"answer-img\" [src]=\"answer.imageData\">\n </div>\n <div class=\"answer-title-wrapper\">\n <span class=\"answer-title\" [textContent]=\"answer.commercialAnswer\"></span>\n </div>\n <div class=\"price\">\n <span class=\"price-value\"></span>\n </div>\n </div>\n </div>\n </div>\n ",
|
|
2085
2220
|
animations: [
|
|
2086
2221
|
trigger('answerAppear', [
|
|
2087
2222
|
state('void', style({ 'background': '#dbdbdb' })),
|
|
@@ -2089,7 +2224,7 @@ var AnswerComponent = /** @class */ (function () {
|
|
|
2089
2224
|
transition('void <=> *', animate(500))
|
|
2090
2225
|
])
|
|
2091
2226
|
],
|
|
2092
|
-
styles: [".answer{font-size:12px;position:relative;overflow:hidden;cursor:pointer}
|
|
2227
|
+
styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:700;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-content,.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid #000;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:0 0;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;-ms-grid-row-align:center;align-self:center;margin-left:14px}"]
|
|
2093
2228
|
})
|
|
2094
2229
|
], AnswerComponent);
|
|
2095
2230
|
return AnswerComponent;
|
|
@@ -2308,7 +2443,7 @@ var SelectionsComponent = /** @class */ (function () {
|
|
|
2308
2443
|
return __generator(this, function (_a) {
|
|
2309
2444
|
switch (_a.label) {
|
|
2310
2445
|
case 0: return [4 /*yield*/, this._imageCacheService.getImageForSelectionOrAnswer(viewModel.selection).then(function (imageSrc) {
|
|
2311
|
-
viewModel.thumbnail = imageSrc;
|
|
2446
|
+
viewModel.thumbnail = imageSrc === "" ? null : imageSrc;
|
|
2312
2447
|
})];
|
|
2313
2448
|
case 1:
|
|
2314
2449
|
_a.sent();
|
|
@@ -2350,7 +2485,7 @@ var SelectionsComponent = /** @class */ (function () {
|
|
|
2350
2485
|
SelectionsComponent = __decorate([
|
|
2351
2486
|
Component({
|
|
2352
2487
|
selector: "selections",
|
|
2353
|
-
template: "\n <
|
|
2488
|
+
template: "\n <div class=\"ione-configurator\">\n <div class=\"rp-selections-summary\">\n <header class=\"drawer__header\">\n <h2 class=\"mat-title\" [textContent]=\"'Configuratie'\"></h2>\n <!--<button>-->\n <!---->\n <!--</button>-->\n </header>\n <div class=\"selections-content\">\n <ng-container *ngFor=\"let selectionViewModel of selectionViewModels\">\n\n <div class=\"co-summary-line\" (click)=\"selectSelection(selectionViewModel.selection, $event)\">\n <div class=\"selection-thumbnail\">\n <rp-loader *ngIf=\"selectionViewModel.thumbnail === ''\"></rp-loader>\n <img visibilityObserver *ngIf=\"selectionViewModel.thumbnail !== '' && selectionViewModel.thumbnail !== null\" class=\"selection-img\" [src]=\"selectionViewModel.thumbnail\">\n </div>\n <div class=\"titles\">\n <div class=\"title-wrapper\">\n <label class=\"question\" [textContent]=\"selectionViewModel.selection.question\"></label>\n <span class=\"answer\" [textContent]=\"selectionViewModel.selection.answer\"></span>\n <div *ngIf=\"selectionViewModel.children.length > 0 && selectionViewModel.expanded\" @showHideChildren>\n <div class=\"child-selection\" *ngFor=\"let selection of selectionViewModel.children\"\n (click)=\"selectSelection(selection, $event)\"\n >\n <label class=\"question\" [textContent]=\"selection.commercialQuestion\"></label>\n <span class=\"answer\" [textContent]=\"selection.answer\"></span>\n </div>\n </div>\n </div>\n </div>\n \n <div class=\"price-wrapper\">\n <span class=\"price-value\"></span>\n </div>\n\n <div class=\"collapse-wrapper\">\n <div class=\"collapse-content\">\n <div class=\"collapse-handle\" [class.expanded]=\"selectionViewModel.expanded\"\n *ngIf=\"selectionViewModel.children.length > 0\" (click)=\"expandClicked(selectionViewModel, $event)\"></div>\n </div>\n </div>\n </div>\n\n </ng-container>\n </div>\n </div>\n </div>\n ",
|
|
2354
2489
|
animations: [
|
|
2355
2490
|
trigger('showHideChildren', [
|
|
2356
2491
|
state('void', style({ 'height': '0' })),
|
|
@@ -2358,7 +2493,7 @@ var SelectionsComponent = /** @class */ (function () {
|
|
|
2358
2493
|
transition('void <=> *', animate(200))
|
|
2359
2494
|
])
|
|
2360
2495
|
],
|
|
2361
|
-
styles: ["
|
|
2496
|
+
styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:700;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-content,.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid #000;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:0 0;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid #d3d3d3;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px rgba(211,211,211,.5);background:#fff}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;-ms-grid-row-align:center;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;-ms-grid-row-align:center;align-self:center;margin-left:14px}"]
|
|
2362
2497
|
})
|
|
2363
2498
|
], SelectionsComponent);
|
|
2364
2499
|
return SelectionsComponent;
|
|
@@ -2388,5 +2523,5 @@ var SelectionsModule = /** @class */ (function () {
|
|
|
2388
2523
|
* Generated bundle index. Do not edit.
|
|
2389
2524
|
*/
|
|
2390
2525
|
|
|
2391
|
-
export { AnswersComponent, AnswersModule, Builder, SelectionsComponent, SelectionsModule,
|
|
2526
|
+
export { AnswersComponent, AnswersModule, Builder, ConfiguratorService, SelectionsComponent, SelectionsModule, SharedModule as ɵa, LoaderComponent as ɵb, AnswerComponent as ɵc, ImageCacheService as ɵd, VisibilityObserverDirective as ɵe, VisibilityObserverMasterDirective as ɵf };
|
|
2392
2527
|
//# sourceMappingURL=colijnit-configurator.js.map
|