@standhigher/besttrack-page-extension 0.5.5 → 0.5.6
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/dist/index.js +21 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -910,12 +910,15 @@ var contentWidth = {
|
|
|
910
910
|
boxSizing: "border-box"
|
|
911
911
|
};
|
|
912
912
|
var trackingProgressStyles = `
|
|
913
|
+
.bt-progress-band { container-type: inline-size; }
|
|
914
|
+
.bt-edd-card { --bt-progress-icon: 44px; }
|
|
913
915
|
.bt-progress { container-type: inline-size; }
|
|
914
916
|
.bt-progress__icon { width: 44px; height: 44px; }
|
|
915
917
|
.bt-progress__line { top: 19px; }
|
|
916
918
|
.bt-progress__copy { margin-top: 16px; }
|
|
917
919
|
.bt-progress__label { font-size: 16px; line-height: 20px; }
|
|
918
920
|
@container (max-width: 640px) {
|
|
921
|
+
.bt-edd-card { --bt-progress-icon: 32px; }
|
|
919
922
|
.bt-progress__icon { width: 32px; height: 32px; }
|
|
920
923
|
.bt-progress__line { top: 13px; }
|
|
921
924
|
.bt-progress__copy { margin-top: 8px; }
|
|
@@ -1145,8 +1148,9 @@ function TrackingPageAdSlot({ ad, disableLink = false }) {
|
|
|
1145
1148
|
if (!href || disableLink) return /* @__PURE__ */ jsx("div", { "data-tracking-page-ad": true, style: trackingPageAdSlotStyle, children: content });
|
|
1146
1149
|
return /* @__PURE__ */ jsx("a", { "data-tracking-page-ad": true, href, target: "_blank", rel: "noopener noreferrer", style: trackingPageAdSlotStyle, children: content });
|
|
1147
1150
|
}
|
|
1148
|
-
function EstimatedDeliveryCard({ dateText }) {
|
|
1149
|
-
|
|
1151
|
+
function EstimatedDeliveryCard({ dateText, steps = 5 }) {
|
|
1152
|
+
const trackInset = `max(0px, calc(50% / ${Math.max(steps, 1)} - var(--bt-progress-icon, 44px) / 2))`;
|
|
1153
|
+
return /* @__PURE__ */ jsxs("div", { "aria-label": "Est. Delivery", className: "bt-edd-card", style: { margin: `16px ${trackInset} 0`, width: "auto", boxSizing: "border-box", border: "1px solid transparent", borderRadius: 10, backgroundColor: "#eaf4ff", padding: "20px 22px 18px", textAlign: "left" }, children: [
|
|
1150
1154
|
/* @__PURE__ */ jsx("p", { style: { margin: 0, color: "#202124", fontSize: 13, fontWeight: 700, lineHeight: 1.3 }, children: "Est. Delivery" }),
|
|
1151
1155
|
/* @__PURE__ */ jsx("p", { style: { margin: "6px 0 0", color: "#202124", fontSize: 22, fontWeight: 700, lineHeight: 1.15, letterSpacing: 0, overflowWrap: "anywhere", wordBreak: "break-word" }, children: dateText }),
|
|
1152
1156
|
/* @__PURE__ */ jsx("p", { style: { margin: "6px 0 0", color: "#5f6368", fontSize: 13, fontWeight: 400, lineHeight: 1.35 }, children: "Estimated time may update as tracking progresses." })
|
|
@@ -1449,8 +1453,10 @@ function ProgressResult({ result, showEstimatedDelivery = true, color }) {
|
|
|
1449
1453
|
result.trackingNumber
|
|
1450
1454
|
] }),
|
|
1451
1455
|
/* @__PURE__ */ jsx4("h2", { style: { margin: "clamp(24px, 8%, 48px) 0 0", fontSize: 32, lineHeight: 1.25, fontWeight: 700, color: "#303030", overflowWrap: "anywhere" }, children: result.status }),
|
|
1452
|
-
|
|
1453
|
-
|
|
1456
|
+
/* @__PURE__ */ jsxs4("div", { className: "bt-progress-band", children: [
|
|
1457
|
+
showEstimatedDelivery && result.estimatedDelivery ? /* @__PURE__ */ jsx4(EstimatedDeliveryCard, { dateText: result.estimatedDelivery, steps: steps.length }) : null,
|
|
1458
|
+
/* @__PURE__ */ jsx4(TrackingProgress, { steps, color })
|
|
1459
|
+
] })
|
|
1454
1460
|
] });
|
|
1455
1461
|
}
|
|
1456
1462
|
function DeliveryResult({ heading, contentsHeading, carrierHeading, result, editing }) {
|
|
@@ -1475,7 +1481,6 @@ function DeliveryResult({ heading, contentsHeading, carrierHeading, result, edit
|
|
|
1475
1481
|
}
|
|
1476
1482
|
function ReadyToGoQueryEditor(block) {
|
|
1477
1483
|
return /* @__PURE__ */ jsx4("section", { "aria-label": "Ready-to-go query editor", style: editorHeroStyle, children: /* @__PURE__ */ jsxs4("div", { role: "region", "aria-label": "Ready-to-go tracking query", style: editorFormCardStyle, children: [
|
|
1478
|
-
/* @__PURE__ */ jsx4("h1", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 28, lineHeight: 1.15, overflowWrap: "anywhere" }, children: /* @__PURE__ */ jsx4(InlineText, { block, name: "heading", fallback: "Track your order" }) }),
|
|
1479
1484
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", width: "100%", borderBottom: "1px solid #cbd5e1" }, children: [
|
|
1480
1485
|
/* @__PURE__ */ jsx4("div", { style: { ...tabStyle(true), display: "flex", alignItems: "center", justifyContent: "center", cursor: "default" }, children: /* @__PURE__ */ jsx4(InlineText, { block, name: "trackingTabLabel", fallback: "Tracking Number" }) }),
|
|
1481
1486
|
/* @__PURE__ */ jsx4("div", { style: { ...tabStyle(false), display: "flex", alignItems: "center", justifyContent: "center", cursor: "default" }, children: /* @__PURE__ */ jsx4(InlineText, { block, name: "orderTabLabel", fallback: "Order Number" }) })
|
|
@@ -1544,7 +1549,6 @@ function ReadyToGoQueryBlock(props) {
|
|
|
1544
1549
|
const [localError, setLocalError] = useState2("");
|
|
1545
1550
|
const autoQueryStarted = useRef(false);
|
|
1546
1551
|
const previewDemoTrackingNumber = useRef(trackingNumber);
|
|
1547
|
-
const heading = text(props, "heading");
|
|
1548
1552
|
const submitLabel = text(props, "submitLabel", "Track Your Order");
|
|
1549
1553
|
const trackingTabLabel = text(props, "trackingTabLabel", "Tracking Number");
|
|
1550
1554
|
const orderTabLabel = text(props, "orderTabLabel", "Order Number");
|
|
@@ -1582,7 +1586,6 @@ function ReadyToGoQueryBlock(props) {
|
|
|
1582
1586
|
};
|
|
1583
1587
|
const loading = runtime.phase === "loading";
|
|
1584
1588
|
return /* @__PURE__ */ jsx4("section", { style: heroStyle, children: /* @__PURE__ */ jsxs4("div", { role: "region", "aria-label": "Ready-to-go tracking query", style: formCardStyle, children: [
|
|
1585
|
-
heading ? /* @__PURE__ */ jsx4("h1", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 28, lineHeight: 1.15, overflowWrap: "anywhere" }, children: heading }) : null,
|
|
1586
1589
|
/* @__PURE__ */ jsxs4("div", { role: "tablist", "aria-label": "Tracking method", style: { display: "flex", width: "100%", borderBottom: "1px solid #cbd5e1" }, children: [
|
|
1587
1590
|
/* @__PURE__ */ jsx4("button", { type: "button", role: "tab", "aria-selected": mode === "tracking", onClick: () => {
|
|
1588
1591
|
setMode("tracking");
|
|
@@ -1672,7 +1675,7 @@ var readyToGoBlocks = withTemplatePolicy([
|
|
|
1672
1675
|
category: "BestTrack Ready-to-go",
|
|
1673
1676
|
targets: ["web"],
|
|
1674
1677
|
defaultProps: {
|
|
1675
|
-
heading: "
|
|
1678
|
+
heading: "",
|
|
1676
1679
|
submitLabel: "Track Your Order",
|
|
1677
1680
|
submitButtonColor: "#111111",
|
|
1678
1681
|
defaultTrackingNumber: "BT-2048-DEMO",
|
|
@@ -1684,14 +1687,13 @@ var readyToGoBlocks = withTemplatePolicy([
|
|
|
1684
1687
|
defaultVariant: "default",
|
|
1685
1688
|
variants: [{ id: "default", label: "Default" }],
|
|
1686
1689
|
fields: {
|
|
1687
|
-
|
|
1688
|
-
submitLabel: text2("Button label"),
|
|
1690
|
+
submitLabel: text2("Button label", { validation: { maxLength: 52 } }),
|
|
1689
1691
|
submitButtonColor: { field: "besttrack.ready-to-go.text", label: "Button color", control: "color", group: "Style" },
|
|
1690
|
-
defaultTrackingNumber: text2("Default tracking number"),
|
|
1692
|
+
defaultTrackingNumber: text2("Default tracking number", { validation: { maxLength: 52 } }),
|
|
1691
1693
|
defaultOrderNumber: text2("Default order number"),
|
|
1692
1694
|
defaultQueryMode: text2("Default query mode"),
|
|
1693
|
-
trackingTabLabel: text2("Tracking tab label"),
|
|
1694
|
-
orderTabLabel: text2("Order tab label")
|
|
1695
|
+
trackingTabLabel: text2("Tracking tab label", { validation: { maxLength: 52 } }),
|
|
1696
|
+
orderTabLabel: text2("Order tab label", { validation: { maxLength: 52 } })
|
|
1695
1697
|
},
|
|
1696
1698
|
render: { web: ReadyToGoQueryBlock, editor: ReadyToGoQueryEditor }
|
|
1697
1699
|
},
|
|
@@ -1719,9 +1721,9 @@ var readyToGoBlocks = withTemplatePolicy([
|
|
|
1719
1721
|
defaultVariant: "default",
|
|
1720
1722
|
variants: [{ id: "default", label: "Default" }, { id: "compact", label: "Compact", theme: { spacing: "12px" } }],
|
|
1721
1723
|
fields: {
|
|
1722
|
-
heading: text2("Heading"),
|
|
1723
|
-
contentsHeading: text2("Package contents heading"),
|
|
1724
|
-
carrierHeading: text2("Carrier heading"),
|
|
1724
|
+
heading: text2("Heading", { validation: { maxLength: 52 } }),
|
|
1725
|
+
contentsHeading: text2("Package contents heading", { validation: { maxLength: 52 } }),
|
|
1726
|
+
carrierHeading: text2("Carrier heading", { validation: { maxLength: 52 } }),
|
|
1725
1727
|
adImageUrl: { field: "besttrack.ready-to-go.asset", label: "Advertisement image", control: "asset", persist: false, group: "Advertisement" },
|
|
1726
1728
|
adLinkUrl: { field: "besttrack.ready-to-go.url", label: "Advertisement link", control: "url", persist: false, group: "Advertisement", validation: { allowRelativeUrl: true, allowedUrlProtocols: ["https:", "http:"] } }
|
|
1727
1729
|
},
|
|
@@ -1737,17 +1739,17 @@ var readyToGoBlocks = withTemplatePolicy([
|
|
|
1737
1739
|
defaultVariant: "default",
|
|
1738
1740
|
variants: [{ id: "default", label: "Default" }, { id: "grid", label: "Grid", theme: { "color.surface": "#ffffff" } }],
|
|
1739
1741
|
fields: {
|
|
1740
|
-
heading: text2("Heading"),
|
|
1742
|
+
heading: text2("Heading", { validation: { maxLength: 100 } }),
|
|
1741
1743
|
products: { field: "besttrack.ready-to-go.products", label: "\u63A8\u8350\u5546\u54C1 (Shopify)", control: "products", group: "Content" }
|
|
1742
1744
|
},
|
|
1743
1745
|
render: { web: ReadyToGoRecommendationsBlock, editor: ReadyToGoRecommendationsEditor }
|
|
1744
1746
|
}
|
|
1745
|
-
], ["besttrack.ready-to-go.query"]);
|
|
1747
|
+
], ["besttrack.ready-to-go.query", "besttrack.ready-to-go.progress", "besttrack.ready-to-go.delivery"]);
|
|
1746
1748
|
var readyToGoTemplatePolicy = defineTemplatePolicy(
|
|
1747
1749
|
"besttrack.ready-to-go",
|
|
1748
1750
|
"Ready-to-go",
|
|
1749
1751
|
readyToGoBlocks.map((block) => block.type),
|
|
1750
|
-
["besttrack.ready-to-go.query"]
|
|
1752
|
+
["besttrack.ready-to-go.query", "besttrack.ready-to-go.progress", "besttrack.ready-to-go.delivery"]
|
|
1751
1753
|
);
|
|
1752
1754
|
function createReadyToGoTemplate() {
|
|
1753
1755
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standhigher/besttrack-page-extension",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "BestTrack business extension entry point for @standhigher/puck-page-builder.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"embla-carousel-autoplay": "^8.6.0",
|
|
24
24
|
"embla-carousel-react": "^8.6.0",
|
|
25
|
-
"@standhigher/puck-page-builder": "0.12.
|
|
25
|
+
"@standhigher/puck-page-builder": "0.12.6"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsup": "^8.5.1",
|