@crystaldesign/product-detail-page 25.2.0-beta.2 → 25.2.0-beta.20
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/build/esm/index.js
CHANGED
|
@@ -1385,6 +1385,9 @@ function recursiveReplaceActions(content, productVariants, product, language, se
|
|
|
1385
1385
|
return content;
|
|
1386
1386
|
}
|
|
1387
1387
|
|
|
1388
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
1389
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
1390
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1388
1391
|
var LOG = getLogger('ProductDetailPage', 'ProductDetailPage');
|
|
1389
1392
|
function useDetailPage(_ref) {
|
|
1390
1393
|
var settings = _ref.settings,
|
|
@@ -1426,7 +1429,6 @@ function useDetailPage(_ref) {
|
|
|
1426
1429
|
setParsedContent = _useState10[1];
|
|
1427
1430
|
useEffect(function () {
|
|
1428
1431
|
DivaUtils$1.businessMetrics.setConfiguratorSessionId();
|
|
1429
|
-
LOG.businessEvent('onOpenPDP', 'ProductDetailPage', 'User in Product Detail Page');
|
|
1430
1432
|
}, []);
|
|
1431
1433
|
useEffect(function () {
|
|
1432
1434
|
updateCssInDom(settings.cssUrl, settings.css);
|
|
@@ -1435,7 +1437,7 @@ function useDetailPage(_ref) {
|
|
|
1435
1437
|
if (!productId) throw new Error('productId is required');
|
|
1436
1438
|
(function () {
|
|
1437
1439
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(productId) {
|
|
1438
|
-
var newVariants, products;
|
|
1440
|
+
var newVariants, products, _iterator, _step, product;
|
|
1439
1441
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1440
1442
|
while (1) switch (_context.prev = _context.next) {
|
|
1441
1443
|
case 0:
|
|
@@ -1458,29 +1460,60 @@ function useDetailPage(_ref) {
|
|
|
1458
1460
|
setProductVariants(products);
|
|
1459
1461
|
newVariants = products;
|
|
1460
1462
|
case 13:
|
|
1463
|
+
_iterator = _createForOfIteratorHelper(newVariants);
|
|
1464
|
+
_context.prev = 14;
|
|
1465
|
+
_iterator.s();
|
|
1466
|
+
case 16:
|
|
1467
|
+
if ((_step = _iterator.n()).done) {
|
|
1468
|
+
_context.next = 23;
|
|
1469
|
+
break;
|
|
1470
|
+
}
|
|
1471
|
+
product = _step.value;
|
|
1472
|
+
if (!(product._id == productId)) {
|
|
1473
|
+
_context.next = 21;
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
LOG.businessEvent('onLoadProductPDP', 'ProductDetailPage', 'Neues Product in PDP geladen.', {
|
|
1477
|
+
productId: productId,
|
|
1478
|
+
catalogName: product.modelName,
|
|
1479
|
+
catalogCodex: product.catCodex
|
|
1480
|
+
});
|
|
1481
|
+
return _context.abrupt("break", 23);
|
|
1482
|
+
case 21:
|
|
1483
|
+
_context.next = 16;
|
|
1484
|
+
break;
|
|
1485
|
+
case 23:
|
|
1486
|
+
_context.next = 28;
|
|
1487
|
+
break;
|
|
1488
|
+
case 25:
|
|
1489
|
+
_context.prev = 25;
|
|
1490
|
+
_context.t0 = _context["catch"](14);
|
|
1491
|
+
_iterator.e(_context.t0);
|
|
1492
|
+
case 28:
|
|
1493
|
+
_context.prev = 28;
|
|
1494
|
+
_iterator.f();
|
|
1495
|
+
return _context.finish(28);
|
|
1496
|
+
case 31:
|
|
1461
1497
|
selectProduct(productId, newVariants);
|
|
1462
|
-
_context.next =
|
|
1498
|
+
_context.next = 38;
|
|
1463
1499
|
break;
|
|
1464
|
-
case
|
|
1465
|
-
_context.prev =
|
|
1466
|
-
_context.
|
|
1500
|
+
case 34:
|
|
1501
|
+
_context.prev = 34;
|
|
1502
|
+
_context.t1 = _context["catch"](2);
|
|
1467
1503
|
//TODO: show the diva error page?
|
|
1468
1504
|
LOG.error(new DivaError('Error loading products', {
|
|
1469
|
-
cause: _context.
|
|
1505
|
+
cause: _context.t1
|
|
1470
1506
|
}));
|
|
1471
1507
|
setError(true);
|
|
1472
|
-
case
|
|
1473
|
-
_context.prev =
|
|
1508
|
+
case 38:
|
|
1509
|
+
_context.prev = 38;
|
|
1474
1510
|
setLoading(false);
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
});
|
|
1478
|
-
return _context.finish(20);
|
|
1479
|
-
case 24:
|
|
1511
|
+
return _context.finish(38);
|
|
1512
|
+
case 41:
|
|
1480
1513
|
case "end":
|
|
1481
1514
|
return _context.stop();
|
|
1482
1515
|
}
|
|
1483
|
-
}, _callee, null, [[2,
|
|
1516
|
+
}, _callee, null, [[2, 34, 38, 41], [14, 25, 28, 31]]);
|
|
1484
1517
|
}));
|
|
1485
1518
|
return function (_x) {
|
|
1486
1519
|
return _ref2.apply(this, arguments);
|
|
@@ -1539,8 +1572,13 @@ function useDetailPage(_ref) {
|
|
|
1539
1572
|
if (event.type == 'closeConfiguratorOverlay' && currentProduct) {
|
|
1540
1573
|
closeComponentInFullscreen();
|
|
1541
1574
|
}
|
|
1542
|
-
if (event.type == 'onFullscreenClose') {
|
|
1575
|
+
if (event.type == 'onFullscreenClose' && currentProduct) {
|
|
1543
1576
|
DivaUtils$1.businessMetrics.setConfiguratorSessionId();
|
|
1577
|
+
LOG.businessEvent('onLoadProductPDP', 'ProductDetailPage', 'Neues Product in PDP geladen.', {
|
|
1578
|
+
productId: productId,
|
|
1579
|
+
catalogName: currentProduct.modelName,
|
|
1580
|
+
catalogCodex: currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.catCodex
|
|
1581
|
+
});
|
|
1544
1582
|
}
|
|
1545
1583
|
};
|
|
1546
1584
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/useDetailPage.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/useDetailPage.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,WAAW,EAAoD,MAAM,0BAA0B,CAAC;AAGnI,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAmB,SAAS,EAAE,MAAM,SAAS,CAAC;AAUrD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,KAAK;;;;;;+BAqFjE,MAAM,gBAAgB,WAAW,EAAE;;;EAoDlD"}
|