@metron-labs/quote-react 0.1.14 → 0.1.16

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.
@@ -16,7 +16,12 @@ export function candidateToCartItem(candidate, line) {
16
16
  uoiCount: candidate?.uoi_count ?? null,
17
17
  saleUnit: candidate?.conversion?.sale_unit ?? null,
18
18
  saleUnitQuantity: candidate?.conversion?.sale_unit_quantity ?? null,
19
- unitConversions: candidate?.conversion?.unit_conversions?.map((conversion) => ({ requestUom: conversion.request_uom, quantityPerSaleUnit: conversion.quantity_per_sale_unit, evidence: conversion.evidence, confidence: conversion.confidence })),
19
+ unitConversions: candidate?.conversion?.unit_conversions?.map((conversion) => ({
20
+ requestUom: conversion.request_uom,
21
+ quantityPerSaleUnit: conversion.quantity_per_sale_unit,
22
+ evidence: conversion.evidence,
23
+ confidence: conversion.confidence,
24
+ })),
20
25
  pdpPhotoUrl: candidate?.pdp_photo_url ?? null,
21
26
  measurementsMm: candidate?.measurements_mm ?? [],
22
27
  conversionType: candidate?.conversion?.conversion_type ?? null,
@@ -28,7 +28,16 @@ export function CartProvider({ children, onOpenBasket }) {
28
28
  });
29
29
  }, []);
30
30
  const updateCartQty = useCallback((lineId, qty) => {
31
- setCart((prev) => (prev[lineId] ? { ...prev, [lineId]: { ...prev[lineId], qty, sellUnitsOverride: null } } : prev));
31
+ setCart((prev) => prev[lineId]
32
+ ? {
33
+ ...prev,
34
+ [lineId]: {
35
+ ...prev[lineId],
36
+ qty,
37
+ sellUnitsOverride: null,
38
+ },
39
+ }
40
+ : prev);
32
41
  }, []);
33
42
  const updateCartSellUnits = useCallback((lineId, sellUnitsOverride) => {
34
43
  setCart((prev) => (prev[lineId] ? { ...prev, [lineId]: { ...prev[lineId], sellUnitsOverride } } : prev));
@@ -23,26 +23,26 @@ export function productImageSrc(description, productId, pdpPhotoUrl) {
23
23
  if (photo)
24
24
  return assetUrl(photo.path);
25
25
  if (text.includes("insulation")) {
26
- return encodeSvg(`
27
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
28
- <rect width="640" height="420" fill="#fbf1cf"/>
29
- <rect x="88" y="78" width="432" height="264" rx="16" fill="#f0c43f"/>
30
- <rect x="120" y="110" width="368" height="200" rx="10" fill="#ffd95e"/>
31
- <g stroke="#e2b12e" stroke-width="8" opacity="0.75">
32
- <line x1="140" y1="140" x2="468" y2="140"/>
33
- <line x1="140" y1="190" x2="468" y2="190"/>
34
- <line x1="140" y1="240" x2="468" y2="240"/>
35
- </g>
36
- </svg>
26
+ return encodeSvg(`
27
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
28
+ <rect width="640" height="420" fill="#fbf1cf"/>
29
+ <rect x="88" y="78" width="432" height="264" rx="16" fill="#f0c43f"/>
30
+ <rect x="120" y="110" width="368" height="200" rx="10" fill="#ffd95e"/>
31
+ <g stroke="#e2b12e" stroke-width="8" opacity="0.75">
32
+ <line x1="140" y1="140" x2="468" y2="140"/>
33
+ <line x1="140" y1="190" x2="468" y2="190"/>
34
+ <line x1="140" y1="240" x2="468" y2="240"/>
35
+ </g>
36
+ </svg>
37
37
  `);
38
38
  }
39
- return encodeSvg(`
40
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
41
- <rect width="640" height="420" fill="#edf1f5"/>
42
- <rect x="132" y="108" width="376" height="204" rx="18" fill="#d5dde6"/>
43
- <rect x="168" y="144" width="304" height="24" rx="12" fill="#9aa6b2"/>
44
- <rect x="168" y="188" width="250" height="24" rx="12" fill="#aab5c0"/>
45
- <rect x="168" y="232" width="220" height="24" rx="12" fill="#aab5c0"/>
46
- </svg>
39
+ return encodeSvg(`
40
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 420">
41
+ <rect width="640" height="420" fill="#edf1f5"/>
42
+ <rect x="132" y="108" width="376" height="204" rx="18" fill="#d5dde6"/>
43
+ <rect x="168" y="144" width="304" height="24" rx="12" fill="#9aa6b2"/>
44
+ <rect x="168" y="188" width="250" height="24" rx="12" fill="#aab5c0"/>
45
+ <rect x="168" y="232" width="220" height="24" rx="12" fill="#aab5c0"/>
46
+ </svg>
47
47
  `);
48
48
  }