@crystaldesign/product-detail-page 25.2.0-beta.3 → 25.2.0-beta.30
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 +64 -16
- package/build/types/product-detail-page/src/components/mainComponents/Variants/useVariants.d.ts +1 -0
- package/build/types/product-detail-page/src/components/mainComponents/Variants/useVariants.d.ts.map +1 -1
- package/build/types/product-detail-page/src/useDetailPage.d.ts.map +1 -1
- package/build/umd/product-detail-page.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -898,6 +898,7 @@ function useVariants (_ref) {
|
|
|
898
898
|
})) === null || _variant$media === void 0 ? void 0 : _variant$media.url,
|
|
899
899
|
variant: variant,
|
|
900
900
|
optName: variantAny[_key3].optName,
|
|
901
|
+
opt: variantAny[_key3].opt,
|
|
901
902
|
opvName: variantAny[_key3].opvName
|
|
902
903
|
});
|
|
903
904
|
},
|
|
@@ -909,6 +910,15 @@ function useVariants (_ref) {
|
|
|
909
910
|
});
|
|
910
911
|
var irrelevantGroups = [];
|
|
911
912
|
for (var _key4 in sortedGroups) {
|
|
913
|
+
var _firstItem$variant, _firstItem$variant2;
|
|
914
|
+
var group = sortedGroups[_key4];
|
|
915
|
+
var firstItem = group[0];
|
|
916
|
+
var variants = firstItem !== null && firstItem !== void 0 && firstItem.opt ? firstItem === null || firstItem === void 0 || (_firstItem$variant = firstItem.variant) === null || _firstItem$variant === void 0 || (_firstItem$variant = _firstItem$variant.configuration) === null || _firstItem$variant === void 0 || (_firstItem$variant = _firstItem$variant.OrderSets[0].Variant) === null || _firstItem$variant === void 0 ? void 0 : _firstItem$variant['OPT' + firstItem.opt] : undefined;
|
|
917
|
+
if (firstItem !== null && firstItem !== void 0 && (_firstItem$variant2 = firstItem.variant) !== null && _firstItem$variant2 !== void 0 && _firstItem$variant2.configuration && !variants) {
|
|
918
|
+
irrelevantGroups.push(_key4);
|
|
919
|
+
} else if (group.length <= 1) {
|
|
920
|
+
irrelevantGroups.push(_key4);
|
|
921
|
+
}
|
|
912
922
|
if (sortedGroups[_key4].length <= 1) {
|
|
913
923
|
irrelevantGroups.push(_key4);
|
|
914
924
|
}
|
|
@@ -1385,6 +1395,9 @@ function recursiveReplaceActions(content, productVariants, product, language, se
|
|
|
1385
1395
|
return content;
|
|
1386
1396
|
}
|
|
1387
1397
|
|
|
1398
|
+
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; } } }; }
|
|
1399
|
+
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; } }
|
|
1400
|
+
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
1401
|
var LOG = getLogger('ProductDetailPage', 'ProductDetailPage');
|
|
1389
1402
|
function useDetailPage(_ref) {
|
|
1390
1403
|
var settings = _ref.settings,
|
|
@@ -1426,7 +1439,6 @@ function useDetailPage(_ref) {
|
|
|
1426
1439
|
setParsedContent = _useState10[1];
|
|
1427
1440
|
useEffect(function () {
|
|
1428
1441
|
DivaUtils$1.businessMetrics.setConfiguratorSessionId();
|
|
1429
|
-
LOG.businessEvent('onOpenPDP', 'ProductDetailPage', 'User in Product Detail Page');
|
|
1430
1442
|
}, []);
|
|
1431
1443
|
useEffect(function () {
|
|
1432
1444
|
updateCssInDom(settings.cssUrl, settings.css);
|
|
@@ -1435,7 +1447,7 @@ function useDetailPage(_ref) {
|
|
|
1435
1447
|
if (!productId) throw new Error('productId is required');
|
|
1436
1448
|
(function () {
|
|
1437
1449
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(productId) {
|
|
1438
|
-
var newVariants, products;
|
|
1450
|
+
var newVariants, products, _iterator, _step, product;
|
|
1439
1451
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1440
1452
|
while (1) switch (_context.prev = _context.next) {
|
|
1441
1453
|
case 0:
|
|
@@ -1458,29 +1470,60 @@ function useDetailPage(_ref) {
|
|
|
1458
1470
|
setProductVariants(products);
|
|
1459
1471
|
newVariants = products;
|
|
1460
1472
|
case 13:
|
|
1473
|
+
_iterator = _createForOfIteratorHelper(newVariants);
|
|
1474
|
+
_context.prev = 14;
|
|
1475
|
+
_iterator.s();
|
|
1476
|
+
case 16:
|
|
1477
|
+
if ((_step = _iterator.n()).done) {
|
|
1478
|
+
_context.next = 23;
|
|
1479
|
+
break;
|
|
1480
|
+
}
|
|
1481
|
+
product = _step.value;
|
|
1482
|
+
if (!(product._id == productId)) {
|
|
1483
|
+
_context.next = 21;
|
|
1484
|
+
break;
|
|
1485
|
+
}
|
|
1486
|
+
LOG.businessEvent('onLoadProductPDP', 'ProductDetailPage', 'Neues Product in PDP geladen.', {
|
|
1487
|
+
productId: productId,
|
|
1488
|
+
catalogName: product.modelName,
|
|
1489
|
+
catalogCodex: product.catCodex
|
|
1490
|
+
});
|
|
1491
|
+
return _context.abrupt("break", 23);
|
|
1492
|
+
case 21:
|
|
1493
|
+
_context.next = 16;
|
|
1494
|
+
break;
|
|
1495
|
+
case 23:
|
|
1496
|
+
_context.next = 28;
|
|
1497
|
+
break;
|
|
1498
|
+
case 25:
|
|
1499
|
+
_context.prev = 25;
|
|
1500
|
+
_context.t0 = _context["catch"](14);
|
|
1501
|
+
_iterator.e(_context.t0);
|
|
1502
|
+
case 28:
|
|
1503
|
+
_context.prev = 28;
|
|
1504
|
+
_iterator.f();
|
|
1505
|
+
return _context.finish(28);
|
|
1506
|
+
case 31:
|
|
1461
1507
|
selectProduct(productId, newVariants);
|
|
1462
|
-
_context.next =
|
|
1508
|
+
_context.next = 38;
|
|
1463
1509
|
break;
|
|
1464
|
-
case
|
|
1465
|
-
_context.prev =
|
|
1466
|
-
_context.
|
|
1510
|
+
case 34:
|
|
1511
|
+
_context.prev = 34;
|
|
1512
|
+
_context.t1 = _context["catch"](2);
|
|
1467
1513
|
//TODO: show the diva error page?
|
|
1468
1514
|
LOG.error(new DivaError('Error loading products', {
|
|
1469
|
-
cause: _context.
|
|
1515
|
+
cause: _context.t1
|
|
1470
1516
|
}));
|
|
1471
1517
|
setError(true);
|
|
1472
|
-
case
|
|
1473
|
-
_context.prev =
|
|
1518
|
+
case 38:
|
|
1519
|
+
_context.prev = 38;
|
|
1474
1520
|
setLoading(false);
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
});
|
|
1478
|
-
return _context.finish(20);
|
|
1479
|
-
case 24:
|
|
1521
|
+
return _context.finish(38);
|
|
1522
|
+
case 41:
|
|
1480
1523
|
case "end":
|
|
1481
1524
|
return _context.stop();
|
|
1482
1525
|
}
|
|
1483
|
-
}, _callee, null, [[2,
|
|
1526
|
+
}, _callee, null, [[2, 34, 38, 41], [14, 25, 28, 31]]);
|
|
1484
1527
|
}));
|
|
1485
1528
|
return function (_x) {
|
|
1486
1529
|
return _ref2.apply(this, arguments);
|
|
@@ -1539,8 +1582,13 @@ function useDetailPage(_ref) {
|
|
|
1539
1582
|
if (event.type == 'closeConfiguratorOverlay' && currentProduct) {
|
|
1540
1583
|
closeComponentInFullscreen();
|
|
1541
1584
|
}
|
|
1542
|
-
if (event.type == 'onFullscreenClose') {
|
|
1585
|
+
if (event.type == 'onFullscreenClose' && currentProduct) {
|
|
1543
1586
|
DivaUtils$1.businessMetrics.setConfiguratorSessionId();
|
|
1587
|
+
LOG.businessEvent('onLoadProductPDP', 'ProductDetailPage', 'Neues Product in PDP geladen.', {
|
|
1588
|
+
productId: productId,
|
|
1589
|
+
catalogName: currentProduct.modelName,
|
|
1590
|
+
catalogCodex: currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.catCodex
|
|
1591
|
+
});
|
|
1544
1592
|
}
|
|
1545
1593
|
};
|
|
1546
1594
|
return {
|
package/build/types/product-detail-page/src/components/mainComponents/Variants/useVariants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/mainComponents/Variants/useVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,UAAU,KAAK;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,oBAAoB,CAAC,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;IACtE,OAAO,EAAE,WAAW,CAAC;CACtB;AACD,MAAM,WAAW,MAAM;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,QAAQ,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,KAAK;;
|
|
1
|
+
{"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/mainComponents/Variants/useVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,UAAU,KAAK;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,oBAAoB,CAAC,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;IACtE,OAAO,EAAE,WAAW,CAAC;CACtB;AACD,MAAM,WAAW,MAAM;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,QAAQ,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,KAAK;;EAuH1E"}
|
|
@@ -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"}
|