@propeller-commerce/propeller-v2-react-ui 0.4.23 → 0.4.25
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/CHANGELOG.md +41 -0
- package/dist/index.cjs +103 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +103 -64
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +13 -12
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +13 -0
- package/dist/pure.d.ts +13 -0
- package/dist/pure.js +13 -12
- package/dist/pure.js.map +1 -1
- package/package.json +1 -1
package/dist/pure.cjs
CHANGED
|
@@ -433,11 +433,13 @@ function OrderSummary(props) {
|
|
|
433
433
|
const showRemarks = props.showRemarks !== void 0 ? props.showRemarks : true;
|
|
434
434
|
const orderNumber = order?.id || "";
|
|
435
435
|
const orderDate = order?.createdAt || "";
|
|
436
|
-
const
|
|
436
|
+
const rawStatus = order?.status || "";
|
|
437
|
+
const orderStatus = rawStatus ? props.statusLabels?.[rawStatus] || rawStatus : "";
|
|
437
438
|
const orderTotal = Number(order?.total?.net || 0);
|
|
438
439
|
const orderReference = order?.reference || "";
|
|
439
440
|
const orderRemarks = order?.remarks || "";
|
|
440
|
-
const
|
|
441
|
+
const rawPaymentMethod = order?.paymentData?.method || "";
|
|
442
|
+
const paymentMethod = rawPaymentMethod ? props.paymethodLabels?.[rawPaymentMethod.toLowerCase()] || rawPaymentMethod : "";
|
|
441
443
|
const carrierName = order?.postageData?.carrier || "";
|
|
442
444
|
const addresses = order?.addresses || [];
|
|
443
445
|
const invoiceAddress = addresses.find((a) => a.type === "invoice") || null;
|
|
@@ -448,15 +450,18 @@ function OrderSummary(props) {
|
|
|
448
450
|
}
|
|
449
451
|
return propellerV2CoreUi.formatPrice(price || 0, { symbol: props.currency ?? "\u20AC" });
|
|
450
452
|
}
|
|
453
|
+
function numericDate(dateString) {
|
|
454
|
+
const d = new Date(dateString);
|
|
455
|
+
if (isNaN(d.getTime())) return dateString;
|
|
456
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
457
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
458
|
+
return `${day}-${month}-${d.getFullYear()}`;
|
|
459
|
+
}
|
|
451
460
|
function formatOrderDate(dateString) {
|
|
452
461
|
if (props.formatDate) {
|
|
453
462
|
return props.formatDate(dateString);
|
|
454
463
|
}
|
|
455
|
-
|
|
456
|
-
return new Date(dateString).toLocaleDateString("en-US");
|
|
457
|
-
} catch {
|
|
458
|
-
return dateString;
|
|
459
|
-
}
|
|
464
|
+
return numericDate(dateString);
|
|
460
465
|
}
|
|
461
466
|
const requestDateRaw = order?.postageData?.requestDate;
|
|
462
467
|
let requestDate = "";
|
|
@@ -464,11 +469,7 @@ function OrderSummary(props) {
|
|
|
464
469
|
if (props.formatDate) {
|
|
465
470
|
requestDate = props.formatDate(requestDateRaw);
|
|
466
471
|
} else {
|
|
467
|
-
|
|
468
|
-
requestDate = new Date(requestDateRaw).toLocaleDateString("en-US");
|
|
469
|
-
} catch {
|
|
470
|
-
requestDate = requestDateRaw;
|
|
471
|
-
}
|
|
472
|
+
requestDate = numericDate(requestDateRaw);
|
|
472
473
|
}
|
|
473
474
|
}
|
|
474
475
|
const getCountryName = (code) => propellerV2CoreUi.getCountryName(code, props.countries);
|