@standhigher/besttrack-page-extension 0.5.0 → 0.5.2

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.d.ts CHANGED
@@ -314,8 +314,10 @@ type ReadyToGoRuntimeProviderProps = {
314
314
  autoQueryFromUrl?: boolean;
315
315
  /** Host-decided display state. Omitted values follow the original powered-by hide rule. */
316
316
  watermark?: TrackingPageWatermark;
317
+ /** Admin-only promotion preview; live storefronts continue to use result.ad. */
318
+ adPreview?: TrackingPageAd | null;
317
319
  };
318
- declare function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, watermark }: ReadyToGoRuntimeProviderProps): react.JSX.Element;
320
+ declare function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, watermark, adPreview }: ReadyToGoRuntimeProviderProps): react.JSX.Element;
319
321
 
320
322
  /**
321
323
  * Compatibility metadata for template-aware hosts.
package/dist/index.js CHANGED
@@ -834,9 +834,22 @@ var pageFont = { fontFamily: "var(--pb-font-family, Inter, system-ui, sans-serif
834
834
  var contentWidth = {
835
835
  width: "min(1248px, 100%)",
836
836
  margin: "0 auto",
837
- padding: "48px 24px",
837
+ padding: "48px clamp(16px, 4%, 24px)",
838
838
  boxSizing: "border-box"
839
839
  };
840
+ var trackingProgressStyles = `
841
+ .bt-progress { container-type: inline-size; }
842
+ .bt-progress__icon { width: 44px; height: 44px; }
843
+ .bt-progress__line { top: 19px; }
844
+ .bt-progress__copy { margin-top: 16px; }
845
+ .bt-progress__label { font-size: 16px; line-height: 20px; }
846
+ @container (max-width: 640px) {
847
+ .bt-progress__icon { width: 32px; height: 32px; }
848
+ .bt-progress__line { top: 13px; }
849
+ .bt-progress__copy { margin-top: 8px; }
850
+ .bt-progress__label { font-size: 11px; line-height: 14px; }
851
+ }
852
+ `;
840
853
  function text(props, key, fallback = "") {
841
854
  return typeof props[key] === "string" ? props[key] : fallback;
842
855
  }
@@ -902,21 +915,26 @@ function ProductImage({ src, alt, size = 60 }) {
902
915
  }
903
916
  function TrackingProgress({ steps }) {
904
917
  const cells = Math.max(steps.length, 1);
905
- const columns = cells <= 1 ? "44px" : Array.from({ length: cells - 1 }, () => "44px minmax(20px, 1fr)").join(" ") + " 44px";
906
- return /* @__PURE__ */ jsx("div", { role: "region", "aria-label": "Delivery progress", style: { marginTop: 32, width: "100%", maxWidth: 1200, marginLeft: "auto", marginRight: "auto", overflow: "visible" }, children: /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: columns, alignItems: "start", columnGap: 8, width: "100%" }, children: steps.map((step, index) => {
907
- const done = step.state === "complete" || step.state === "current";
908
- const nextDone = steps[index + 1]?.state === "complete" || steps[index + 1]?.state === "current";
909
- return /* @__PURE__ */ jsxs("div", { style: { display: "contents" }, children: [
910
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", overflow: "visible" }, children: [
911
- /* @__PURE__ */ jsx("span", { "aria-label": step.label + " " + step.state, style: { display: "flex", width: 44, height: 44, flexShrink: 0, alignItems: "center", justifyContent: "center", borderRadius: 9999, border: "1px solid #0f172a", background: done ? "#0f172a" : "#fff", color: "#0f172a" }, children: /* @__PURE__ */ jsx(StepIcon, { name: step.icon ?? (index === 0 || index === steps.length - 1 ? "check" : index === 1 ? "bag" : index === 2 ? "truck" : "box"), done }) }),
912
- /* @__PURE__ */ jsxs("div", { style: { width: "max-content", textAlign: "center", marginTop: 16 }, children: [
913
- /* @__PURE__ */ jsx("p", { style: { margin: 0, fontSize: 16, lineHeight: "20px", fontWeight: 500, color: "#334155" }, children: step.label }),
914
- step.date ? /* @__PURE__ */ jsx("p", { style: { margin: "8px 0 0", fontSize: 14, lineHeight: "18px", color: "#94a3b8" }, children: step.date }) : null
915
- ] })
916
- ] }),
917
- index < steps.length - 1 ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { display: "block", width: "100%", minWidth: 0, height: 6, marginTop: 19, borderRadius: 999, background: done && nextDone ? "#1a1a1a" : "rgba(0, 0, 0, 0.25)" } }) : null
918
- ] }, step.id);
919
- }) }) });
918
+ return /* @__PURE__ */ jsxs("div", { className: "bt-progress", role: "region", "aria-label": "Delivery progress", style: { marginTop: 32, width: "100%", maxWidth: 1200, marginLeft: "auto", marginRight: "auto", overflow: "visible" }, children: [
919
+ /* @__PURE__ */ jsx("style", { children: trackingProgressStyles }),
920
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative", display: "grid", gridTemplateColumns: `repeat(${cells}, minmax(0, 1fr))`, columnGap: 4, width: "100%", alignItems: "start" }, children: [
921
+ cells > 1 ? /* @__PURE__ */ jsx("div", { className: "bt-progress__line", "aria-hidden": "true", style: { position: "absolute", left: `calc(50% / ${cells})`, right: `calc(50% / ${cells})`, height: 6, display: "flex", zIndex: 0, pointerEvents: "none" }, children: steps.slice(0, -1).map((step, index) => {
922
+ const done = step.state === "complete" || step.state === "current";
923
+ const nextDone = steps[index + 1]?.state === "complete" || steps[index + 1]?.state === "current";
924
+ return /* @__PURE__ */ jsx("span", { style: { flex: 1, height: 6, borderRadius: 999, background: done && nextDone ? "#1a1a1a" : "rgba(0, 0, 0, 0.25)" } }, step.id + "-line");
925
+ }) }) : null,
926
+ steps.map((step, index) => {
927
+ const done = step.state === "complete" || step.state === "current";
928
+ return /* @__PURE__ */ jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", alignItems: "center", position: "relative", zIndex: 1 }, children: [
929
+ /* @__PURE__ */ jsx("span", { className: "bt-progress__icon", "aria-label": step.label + " " + step.state, style: { display: "flex", flexShrink: 0, alignItems: "center", justifyContent: "center", borderRadius: 9999, border: "1px solid #0f172a", background: done ? "#0f172a" : "#fff", color: "#0f172a" }, children: /* @__PURE__ */ jsx(StepIcon, { name: step.icon ?? (index === 0 || index === steps.length - 1 ? "check" : index === 1 ? "bag" : index === 2 ? "truck" : "box"), done }) }),
930
+ /* @__PURE__ */ jsxs("div", { className: "bt-progress__copy", style: { width: "100%", maxWidth: "100%", boxSizing: "border-box", textAlign: "center", padding: "0 2px" }, children: [
931
+ /* @__PURE__ */ jsx("p", { className: "bt-progress__label", style: { margin: 0, fontWeight: 500, color: "#334155", overflowWrap: "anywhere", wordBreak: "break-word" }, children: step.label }),
932
+ step.date ? /* @__PURE__ */ jsx("p", { style: { margin: "6px 0 0", fontSize: 12, lineHeight: "16px", color: "#94a3b8", overflowWrap: "anywhere" }, children: step.date }) : null
933
+ ] })
934
+ ] }, step.id);
935
+ })
936
+ ] })
937
+ ] });
920
938
  }
921
939
  function ShippingTimeline({ events }) {
922
940
  if (!events.length) {
@@ -968,11 +986,11 @@ function RecommendationCards({ items }) {
968
986
  }, [emblaApi]);
969
987
  useEffect(() => {
970
988
  if (!emblaApi) return;
989
+ const frame = window.requestAnimationFrame(onSelect);
971
990
  emblaApi.on("select", onSelect);
972
991
  emblaApi.on("reInit", onSelect);
973
- const frame = requestAnimationFrame(onSelect);
974
992
  return () => {
975
- cancelAnimationFrame(frame);
993
+ window.cancelAnimationFrame(frame);
976
994
  emblaApi.off("select", onSelect);
977
995
  emblaApi.off("reInit", onSelect);
978
996
  };
@@ -981,12 +999,9 @@ function RecommendationCards({ items }) {
981
999
  if (typeof window.matchMedia !== "function") return;
982
1000
  const media = window.matchMedia("(max-width: 768px)");
983
1001
  const update = () => setHideButtons(media.matches);
984
- const frame = requestAnimationFrame(update);
1002
+ update();
985
1003
  media.addEventListener("change", update);
986
- return () => {
987
- cancelAnimationFrame(frame);
988
- media.removeEventListener("change", update);
989
- };
1004
+ return () => media.removeEventListener("change", update);
990
1005
  }, []);
991
1006
  if (items.length === 0) return null;
992
1007
  const arrow = (points) => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("polyline", { points }) });
@@ -1007,7 +1022,7 @@ function RecommendationCards({ items }) {
1007
1022
  color: "#333",
1008
1023
  padding: 0
1009
1024
  };
1010
- return /* @__PURE__ */ jsxs("div", { "aria-label": "Recommended products carousel", style: { position: "relative", marginLeft: 48, marginRight: 48 }, children: [
1025
+ return /* @__PURE__ */ jsxs("div", { "aria-label": "Recommended products carousel", style: { position: "relative", marginLeft: "min(48px, 4%)", marginRight: "min(48px, 4%)" }, children: [
1011
1026
  !hideButtons && canScrollPrev ? /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Previous", onClick: () => emblaApi?.scrollPrev(), style: { ...buttonStyle, left: -40 }, children: arrow("15 18 9 12 15 6") }) : null,
1012
1027
  /* @__PURE__ */ jsx("div", { ref: emblaRef, style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx("div", { style: { display: "flex" }, children: items.map((item) => {
1013
1028
  const href = safeHref(item.href);
@@ -1024,14 +1039,30 @@ function RecommendationCards({ items }) {
1024
1039
  !hideButtons && canScrollNext ? /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Next", onClick: () => emblaApi?.scrollNext(), style: { ...buttonStyle, right: -40 }, children: arrow("9 18 15 12 9 6") }) : null
1025
1040
  ] });
1026
1041
  }
1027
- function TrackingPageAdSlot({ ad }) {
1042
+ var trackingPageAdSlotStyle = {
1043
+ display: "block",
1044
+ width: "100%",
1045
+ maxWidth: 500,
1046
+ aspectRatio: "20 / 9",
1047
+ borderRadius: 8,
1048
+ overflow: "hidden",
1049
+ textDecoration: "none"
1050
+ };
1051
+ var trackingPageAdImageStyle = {
1052
+ display: "block",
1053
+ width: "100%",
1054
+ height: "100%",
1055
+ objectFit: "fill",
1056
+ objectPosition: "center"
1057
+ };
1058
+ function TrackingPageAdSlot({ ad, disableLink = false }) {
1028
1059
  const [failedUrl, setFailedUrl] = useState();
1029
1060
  const imageUrl = safeImageUrl(ad?.imageUrl);
1030
1061
  if (!imageUrl || failedUrl === imageUrl) return null;
1031
- const content = /* @__PURE__ */ jsx("img", { src: imageUrl, alt: ad?.alt ?? "Promotion", loading: "lazy", onError: () => setFailedUrl(imageUrl), style: { display: "block", width: "100%", height: "auto", objectFit: "cover" } });
1062
+ const content = /* @__PURE__ */ jsx("img", { src: imageUrl, alt: ad?.alt ?? "Promotion", loading: "lazy", onError: () => setFailedUrl(imageUrl), style: trackingPageAdImageStyle });
1032
1063
  const href = safeHref(ad?.href);
1033
- if (!href) return /* @__PURE__ */ jsx("div", { "data-tracking-page-ad": true, children: content });
1034
- return /* @__PURE__ */ jsx("a", { "data-tracking-page-ad": true, href, target: "_blank", rel: "noopener noreferrer", children: content });
1064
+ if (!href || disableLink) return /* @__PURE__ */ jsx("div", { "data-tracking-page-ad": true, style: trackingPageAdSlotStyle, children: content });
1065
+ return /* @__PURE__ */ jsx("a", { "data-tracking-page-ad": true, href, target: "_blank", rel: "noopener noreferrer", style: trackingPageAdSlotStyle, children: content });
1035
1066
  }
1036
1067
  function EstimatedDeliveryCard({ dateText }) {
1037
1068
  return /* @__PURE__ */ jsxs("div", { "aria-label": "Est. Delivery", style: { margin: "16px auto 0", width: "100%", boxSizing: "border-box", border: "1px solid transparent", borderRadius: 10, backgroundColor: "#eaf4ff", padding: "20px 22px 18px", textAlign: "left" }, children: [
@@ -1047,7 +1078,11 @@ function IdleMessage({ children }) {
1047
1078
  return /* @__PURE__ */ jsx("p", { style: { margin: 0, textAlign: "center", color: "var(--pb-color-muted, #64748b)" }, children });
1048
1079
  }
1049
1080
  function SkeletonRow() {
1050
- return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: { display: "grid", gridTemplateColumns: "44px minmax(20px, 1fr) 44px minmax(20px, 1fr) 44px minmax(20px, 1fr) 44px minmax(20px, 1fr) 44px", columnGap: 8, width: "100%", maxWidth: 1200, margin: "32px auto 0" }, children: Array.from({ length: 5 }, (_, index) => /* @__PURE__ */ jsx("span", { style: { display: "block", width: 44, height: 44, borderRadius: 9999, background: "#e2e8f0" } }, index)).flatMap((circle, index, list) => index < list.length - 1 ? [circle, /* @__PURE__ */ jsx("span", { style: { display: "block", height: 6, marginTop: 19, borderRadius: 999, background: "#e2e8f0" } }, "line-" + index)] : [circle]) });
1081
+ return /* @__PURE__ */ jsxs("div", { className: "bt-progress", "aria-hidden": "true", style: { position: "relative", display: "grid", gridTemplateColumns: "repeat(5, minmax(0, 1fr))", columnGap: 4, width: "100%", maxWidth: 1200, margin: "32px auto 0" }, children: [
1082
+ /* @__PURE__ */ jsx("style", { children: trackingProgressStyles }),
1083
+ /* @__PURE__ */ jsx("span", { className: "bt-progress__line", style: { position: "absolute", left: "10%", right: "10%", height: 6, borderRadius: 999, background: "#e2e8f0" } }),
1084
+ Array.from({ length: 5 }, (_, index) => /* @__PURE__ */ jsx("span", { className: "bt-progress__icon", style: { display: "block", justifySelf: "center", borderRadius: 9999, background: "#e2e8f0" } }, index))
1085
+ ] });
1051
1086
  }
1052
1087
 
1053
1088
  // src/shopify-track-page/assets/not-found.png.ts
@@ -1097,7 +1132,7 @@ function previewReadyToGoTracking(trackingNumber = "BT-2048-DEMO") {
1097
1132
  async function queryMockReadyToGoTracking(request) {
1098
1133
  return previewReadyToGoTracking(request.mode === "tracking" ? request.trackingNumber : request.orderNumber);
1099
1134
  }
1100
- function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, watermark }) {
1135
+ function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, watermark, adPreview }) {
1101
1136
  const [state, setState] = useState2({ phase: "idle" });
1102
1137
  const [recommendations, setRecommendations] = useState2(() => queryRecommendations || transport ? { phase: "loading", items: [] } : { phase: "success", items: previewReadyToGoTracking().recommendations ?? [] });
1103
1138
  const requestId = useRef(0);
@@ -1143,7 +1178,7 @@ function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecomme
1143
1178
  () => watermark ?? { visible: !shouldHidePoweredBy() },
1144
1179
  [watermark]
1145
1180
  );
1146
- const value = useMemo2(() => ({ ...state, query, recommendations, autoQueryFromUrl: resolveAutoQuery, watermark: resolvedWatermark }), [query, recommendations, resolveAutoQuery, resolvedWatermark, state]);
1181
+ const value = useMemo2(() => ({ ...state, adPreview, query, recommendations, autoQueryFromUrl: resolveAutoQuery, watermark: resolvedWatermark }), [adPreview, query, recommendations, resolveAutoQuery, resolvedWatermark, state]);
1147
1182
  return /* @__PURE__ */ jsx3(ReadyToGoRuntimeContext.Provider, { value, children });
1148
1183
  }
1149
1184
  function useReadyToGoRuntime() {
@@ -1160,7 +1195,7 @@ var heroStyle = {
1160
1195
  placeItems: "center",
1161
1196
  overflow: "hidden",
1162
1197
  backgroundColor: "#fff",
1163
- padding: "48px 24px",
1198
+ padding: "48px clamp(16px, 4%, 24px)",
1164
1199
  boxSizing: "border-box"
1165
1200
  };
1166
1201
  var editorHeroStyle = {
@@ -1169,7 +1204,7 @@ var editorHeroStyle = {
1169
1204
  display: "grid",
1170
1205
  placeItems: "center",
1171
1206
  backgroundColor: "#fff",
1172
- padding: "48px 24px",
1207
+ padding: "48px clamp(16px, 4%, 24px)",
1173
1208
  boxSizing: "border-box"
1174
1209
  };
1175
1210
  var formCardStyle = {
@@ -1181,7 +1216,7 @@ var formCardStyle = {
1181
1216
  borderRadius: "var(--pb-radius, 8px)",
1182
1217
  background: "var(--pb-color-surface, #fff)",
1183
1218
  color: "var(--pb-color-text, #0f172a)",
1184
- padding: 40,
1219
+ padding: "clamp(20px, 7%, 40px)",
1185
1220
  boxSizing: "border-box",
1186
1221
  boxShadow: "0 8px 24px rgba(0, 0, 0, 0.12)"
1187
1222
  };
@@ -1189,9 +1224,10 @@ var editorFormCardStyle = { ...formCardStyle, minHeight: 0 };
1189
1224
  var tabStyle = (active) => ({
1190
1225
  appearance: "none",
1191
1226
  flex: 1,
1227
+ minWidth: 0,
1192
1228
  minHeight: 53,
1193
1229
  margin: 0,
1194
- padding: "16px 10px",
1230
+ padding: "12px 6px",
1195
1231
  font: "inherit",
1196
1232
  fontSize: 15,
1197
1233
  lineHeight: "21px",
@@ -1201,7 +1237,9 @@ var tabStyle = (active) => ({
1201
1237
  borderBottom: active ? "2px solid #0f172a" : "2px solid transparent",
1202
1238
  borderRadius: 0,
1203
1239
  color: active ? "#0f172a" : "#94a3b8",
1204
- cursor: "pointer"
1240
+ cursor: "pointer",
1241
+ textAlign: "center",
1242
+ overflowWrap: "anywhere"
1205
1243
  });
1206
1244
  var inputStyle = {
1207
1245
  width: "100%",
@@ -1216,6 +1254,28 @@ var inputStyle = {
1216
1254
  color: "#334155",
1217
1255
  boxSizing: "border-box"
1218
1256
  };
1257
+ var hexColor = /^#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/i;
1258
+ var defaultSubmitButtonColor = "var(--pb-color-primary, #111)";
1259
+ function submitButtonBackground(props, loading = false) {
1260
+ if (loading) return "#475569";
1261
+ const value = text(props, "submitButtonColor");
1262
+ return hexColor.test(value) ? value : defaultSubmitButtonColor;
1263
+ }
1264
+ function submitButtonStyle(props, loading = false) {
1265
+ return {
1266
+ display: "flex",
1267
+ alignItems: "center",
1268
+ justifyContent: "center",
1269
+ width: "100%",
1270
+ minHeight: 58,
1271
+ marginTop: 8,
1272
+ borderRadius: "var(--pb-radius, 8px)",
1273
+ background: submitButtonBackground(props, loading),
1274
+ color: "#fff",
1275
+ fontSize: 15,
1276
+ fontWeight: 600
1277
+ };
1278
+ }
1219
1279
  function ReadyToGoTextField({ value, onChange }) {
1220
1280
  return /* @__PURE__ */ jsx3("input", { "aria-label": "Ready-to-go text", value: typeof value === "string" ? value : "", onChange: (event) => onChange(event.target.value) });
1221
1281
  }
@@ -1259,23 +1319,23 @@ function eventsFrom(result) {
1259
1319
  function ProgressResult({ result, showEstimatedDelivery = true }) {
1260
1320
  const steps = result.progress?.length ? result.progress : defaultProgress(result.status);
1261
1321
  return /* @__PURE__ */ jsxs3(Fragment2, { children: [
1262
- /* @__PURE__ */ jsxs3("p", { style: { margin: 0, fontSize: 20, lineHeight: 1.4, color: "#000" }, children: [
1322
+ /* @__PURE__ */ jsxs3("p", { style: { margin: 0, fontSize: 20, lineHeight: 1.4, color: "#000", overflowWrap: "anywhere" }, children: [
1263
1323
  "Tracking: ",
1264
1324
  result.trackingNumber
1265
1325
  ] }),
1266
- /* @__PURE__ */ jsx3("h2", { style: { margin: "48px 0 0", fontSize: 32, lineHeight: "40px", fontWeight: 700, color: "#303030" }, children: result.status }),
1326
+ /* @__PURE__ */ jsx3("h2", { style: { margin: "clamp(24px, 8%, 48px) 0 0", fontSize: 32, lineHeight: 1.25, fontWeight: 700, color: "#303030", overflowWrap: "anywhere" }, children: result.status }),
1267
1327
  showEstimatedDelivery && result.estimatedDelivery ? /* @__PURE__ */ jsx3(EstimatedDeliveryCard, { dateText: result.estimatedDelivery }) : null,
1268
1328
  /* @__PURE__ */ jsx3(TrackingProgress, { steps })
1269
1329
  ] });
1270
1330
  }
1271
- function DeliveryResult({ heading, contentsHeading, carrierHeading, result }) {
1331
+ function DeliveryResult({ heading, contentsHeading, carrierHeading, result, editing }) {
1272
1332
  return /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth, display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 280px), 500px))", gap: 40, justifyContent: "center", alignItems: "start" }, children: [
1273
1333
  /* @__PURE__ */ jsxs3("div", { children: [
1274
1334
  /* @__PURE__ */ jsx3("h3", { style: { margin: 0, fontSize: 20, lineHeight: "20px", fontWeight: 700 }, children: heading }),
1275
1335
  /* @__PURE__ */ jsx3(ShippingTimeline, { events: eventsFrom(result) })
1276
1336
  ] }),
1277
1337
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: 24 }, children: [
1278
- /* @__PURE__ */ jsx3(TrackingPageAdSlot, { ad: result.ad }),
1338
+ /* @__PURE__ */ jsx3(TrackingPageAdSlot, { ad: result.ad, disableLink: editing }),
1279
1339
  /* @__PURE__ */ jsxs3("div", { children: [
1280
1340
  /* @__PURE__ */ jsx3("h3", { style: { margin: "0 0 12px", fontSize: 18, fontWeight: 700 }, children: contentsHeading }),
1281
1341
  /* @__PURE__ */ jsx3(PackageContents, { items: result.orderItems ?? [] })
@@ -1290,7 +1350,7 @@ function DeliveryResult({ heading, contentsHeading, carrierHeading, result }) {
1290
1350
  }
1291
1351
  function ReadyToGoQueryEditor(block) {
1292
1352
  return /* @__PURE__ */ jsx3("section", { "aria-label": "Ready-to-go query editor", style: editorHeroStyle, children: /* @__PURE__ */ jsxs3("div", { role: "region", "aria-label": "Ready-to-go tracking query", style: editorFormCardStyle, children: [
1293
- /* @__PURE__ */ jsx3("h1", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 28, lineHeight: 1.15 }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "heading", fallback: "Track your order" }) }),
1353
+ /* @__PURE__ */ jsx3("h1", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 28, lineHeight: 1.15, overflowWrap: "anywhere" }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "heading", fallback: "Track your order" }) }),
1294
1354
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", width: "100%", borderBottom: "1px solid #cbd5e1" }, children: [
1295
1355
  /* @__PURE__ */ jsx3("div", { style: { ...tabStyle(true), display: "flex", alignItems: "center", justifyContent: "center", cursor: "default" }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "trackingTabLabel", fallback: "Tracking Number" }) }),
1296
1356
  /* @__PURE__ */ jsx3("div", { style: { ...tabStyle(false), display: "flex", alignItems: "center", justifyContent: "center", cursor: "default" }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "orderTabLabel", fallback: "Order Number" }) })
@@ -1311,7 +1371,7 @@ function ReadyToGoQueryEditor(block) {
1311
1371
  }
1312
1372
  }
1313
1373
  ),
1314
- /* @__PURE__ */ jsx3("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", minHeight: 58, marginTop: 8, borderRadius: "var(--pb-radius, 8px)", background: "var(--pb-color-primary, #111)", color: "#fff", fontSize: 15, fontWeight: 600 }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "submitLabel", fallback: "Track Your Order" }) })
1374
+ /* @__PURE__ */ jsx3("div", { style: submitButtonStyle(block), children: /* @__PURE__ */ jsx3(InlineText, { block, name: "submitLabel", fallback: "Track Your Order" }) })
1315
1375
  ] }),
1316
1376
  /* @__PURE__ */ jsx3("p", { style: { marginTop: "auto", paddingTop: 28, textAlign: "center", fontSize: 12, lineHeight: "17px", fontStyle: "italic", color: "#b8b8b8" }, children: "Powered by BestTrack" })
1317
1377
  ] }) });
@@ -1320,13 +1380,15 @@ function ReadyToGoProgressEditor() {
1320
1380
  return /* @__PURE__ */ jsx3("section", { "aria-label": "Ready-to-go progress editor", style: { ...pageFont, background: "var(--pb-color-background, #fff)", color: "var(--pb-color-text, #0f172a)", borderBottom: "1px solid #f1f5f9" }, children: /* @__PURE__ */ jsx3("div", { style: { ...contentWidth, textAlign: "center", width: "min(1248px, 100%)" }, children: /* @__PURE__ */ jsx3(ProgressResult, { result: previewReadyToGoTracking(), showEstimatedDelivery: false }) }) });
1321
1381
  }
1322
1382
  function ReadyToGoDeliveryEditor(block) {
1383
+ const { adPreview } = useReadyToGoRuntime();
1323
1384
  return /* @__PURE__ */ jsx3("section", { "aria-label": "Ready-to-go delivery editor", style: { ...pageFont, background: "var(--pb-color-background, #fff)", color: "var(--pb-color-text, #0f172a)", borderBottom: "1px solid #f1f5f9" }, children: /* @__PURE__ */ jsx3(
1324
1385
  DeliveryResult,
1325
1386
  {
1326
1387
  heading: /* @__PURE__ */ jsx3(InlineText, { block, name: "heading", fallback: "Shipping Details" }),
1327
1388
  contentsHeading: /* @__PURE__ */ jsx3(InlineText, { block, name: "contentsHeading", fallback: "Package Contents" }),
1328
1389
  carrierHeading: /* @__PURE__ */ jsx3(InlineText, { block, name: "carrierHeading", fallback: "Carrier" }),
1329
- result: previewReadyToGoTracking()
1390
+ editing: true,
1391
+ result: { ...previewReadyToGoTracking(), ad: adPreview ?? void 0 }
1330
1392
  }
1331
1393
  ) });
1332
1394
  }
@@ -1339,7 +1401,7 @@ function ReadyToGoRecommendationsEditor(block) {
1339
1401
  href: product.handle ? `/products/${product.handle}` : void 0
1340
1402
  }));
1341
1403
  const items = selected.length ? selected : previewReadyToGoTracking().recommendations ?? [];
1342
- return /* @__PURE__ */ jsx3("section", { "aria-label": "Ready-to-go recommendations editor", style: { ...pageFont, background: "var(--pb-color-background, #fff)", color: "var(--pb-color-text, #0f172a)" }, children: /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth, padding: "48px 24px" }, children: [
1404
+ return /* @__PURE__ */ jsx3("section", { "aria-label": "Ready-to-go recommendations editor", style: { ...pageFont, background: "var(--pb-color-background, #fff)", color: "var(--pb-color-text, #0f172a)" }, children: /* @__PURE__ */ jsxs3("div", { style: contentWidth, children: [
1343
1405
  /* @__PURE__ */ jsx3("h3", { style: { margin: 0, textAlign: "center", fontSize: 20, lineHeight: "20px", fontWeight: 700 }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "heading", fallback: "You may also like..." }) }),
1344
1406
  /* @__PURE__ */ jsx3("div", { style: { marginTop: 24 }, children: /* @__PURE__ */ jsx3(RecommendationCards, { items }) })
1345
1407
  ] }) });
@@ -1383,7 +1445,7 @@ function ReadyToGoQueryBlock(props) {
1383
1445
  };
1384
1446
  const loading = runtime.phase === "loading";
1385
1447
  return /* @__PURE__ */ jsx3("section", { style: heroStyle, children: /* @__PURE__ */ jsxs3("div", { role: "region", "aria-label": "Ready-to-go tracking query", style: formCardStyle, children: [
1386
- heading ? /* @__PURE__ */ jsx3("h1", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 28, lineHeight: 1.15 }, children: heading }) : null,
1448
+ heading ? /* @__PURE__ */ jsx3("h1", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 28, lineHeight: 1.15, overflowWrap: "anywhere" }, children: heading }) : null,
1387
1449
  /* @__PURE__ */ jsxs3("div", { role: "tablist", "aria-label": "Tracking method", style: { display: "flex", width: "100%", borderBottom: "1px solid #cbd5e1" }, children: [
1388
1450
  /* @__PURE__ */ jsx3("button", { type: "button", role: "tab", "aria-selected": mode === "tracking", onClick: () => {
1389
1451
  setMode("tracking");
@@ -1405,7 +1467,7 @@ function ReadyToGoQueryBlock(props) {
1405
1467
  /* @__PURE__ */ jsx3("input", { id: "ready-to-go-tracking-number", "aria-label": "Tracking number", value: trackingNumber, onChange: (event) => setTrackingNumber(event.target.value), placeholder: "Tracking Number", style: inputStyle })
1406
1468
  ] }),
1407
1469
  localError ? /* @__PURE__ */ jsx3("p", { style: { margin: 0, textAlign: "center", fontSize: 12, color: "#f43f5e" }, children: localError }) : null,
1408
- /* @__PURE__ */ jsx3("button", { type: "submit", disabled: loading, style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", minHeight: 58, marginTop: 8, border: 0, borderRadius: "var(--pb-radius, 8px)", background: loading ? "#475569" : "var(--pb-color-primary, #111)", color: "#fff", font: "inherit", fontSize: 15, fontWeight: 600, cursor: loading ? "wait" : "pointer", opacity: loading ? 0.7 : 1 }, children: loading ? "Tracking..." : submitLabel }),
1470
+ /* @__PURE__ */ jsx3("button", { type: "submit", disabled: loading, style: { ...submitButtonStyle(props, loading), border: 0, font: "inherit", fontSize: 15, fontWeight: 600, cursor: loading ? "wait" : "pointer", opacity: loading ? 0.7 : 1 }, children: loading ? "Tracking..." : submitLabel }),
1409
1471
  runtime.phase === "error" ? /* @__PURE__ */ jsx3("p", { role: "alert", style: { margin: 0, textAlign: "center", fontSize: 12, color: "#f43f5e" }, children: runtime.error }) : null
1410
1472
  ] }),
1411
1473
  /* @__PURE__ */ jsx3(RuntimeWatermark, { watermark: runtime.watermark })
@@ -1442,7 +1504,7 @@ function ReadyToGoRecommendationsBlock(props) {
1442
1504
  const runtime = useReadyToGoRuntime();
1443
1505
  const heading = text(props, "heading", "You may also like...");
1444
1506
  if (runtime.recommendations.phase !== "success" || runtime.recommendations.items.length === 0) return null;
1445
- return /* @__PURE__ */ jsx3(SectionShell, { title: heading, bordered: false, children: /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth, padding: "48px 24px" }, children: [
1507
+ return /* @__PURE__ */ jsx3(SectionShell, { title: heading, bordered: false, children: /* @__PURE__ */ jsxs3("div", { style: contentWidth, children: [
1446
1508
  /* @__PURE__ */ jsx3("h3", { style: { margin: 0, textAlign: "center", fontSize: 20, lineHeight: "20px", fontWeight: 700 }, children: heading }),
1447
1509
  /* @__PURE__ */ jsx3("div", { style: { marginTop: 24 }, children: /* @__PURE__ */ jsx3(RecommendationCards, { items: runtime.recommendations.items }) })
1448
1510
  ] }) });
@@ -1477,6 +1539,7 @@ var readyToGoBlocks = withTemplatePolicy([
1477
1539
  defaultProps: {
1478
1540
  heading: "Track your order",
1479
1541
  submitLabel: "Track Your Order",
1542
+ submitButtonColor: "#111111",
1480
1543
  defaultTrackingNumber: "BT-2048-DEMO",
1481
1544
  defaultOrderNumber: "",
1482
1545
  defaultQueryMode: "tracking",
@@ -1488,6 +1551,7 @@ var readyToGoBlocks = withTemplatePolicy([
1488
1551
  fields: {
1489
1552
  heading: text2("Heading"),
1490
1553
  submitLabel: text2("Button label"),
1554
+ submitButtonColor: { field: "besttrack.ready-to-go.text", label: "Button color", control: "color", group: "Style" },
1491
1555
  defaultTrackingNumber: text2("Default tracking number"),
1492
1556
  defaultOrderNumber: text2("Default order number"),
1493
1557
  defaultQueryMode: text2("Default query mode"),
@@ -1517,7 +1581,13 @@ var readyToGoBlocks = withTemplatePolicy([
1517
1581
  defaultProps: { heading: "Shipping Details", contentsHeading: "Package Contents", carrierHeading: "Carrier" },
1518
1582
  defaultVariant: "default",
1519
1583
  variants: [{ id: "default", label: "Default" }, { id: "compact", label: "Compact", theme: { spacing: "12px" } }],
1520
- fields: { heading: text2("Heading"), contentsHeading: text2("Package contents heading"), carrierHeading: text2("Carrier heading") },
1584
+ fields: {
1585
+ heading: text2("Heading"),
1586
+ contentsHeading: text2("Package contents heading"),
1587
+ carrierHeading: text2("Carrier heading"),
1588
+ adImageUrl: { field: "besttrack.ready-to-go.asset", label: "Advertisement image", control: "asset", persist: false, group: "Advertisement" },
1589
+ adLinkUrl: { field: "besttrack.ready-to-go.url", label: "Advertisement link", control: "url", persist: false, group: "Advertisement", validation: { allowRelativeUrl: true, allowedUrlProtocols: ["https:", "http:"] } }
1590
+ },
1521
1591
  render: { web: ReadyToGoDeliveryBlock, editor: ReadyToGoDeliveryEditor }
1522
1592
  },
1523
1593
  {
@@ -6,6 +6,7 @@ import {
6
6
 
7
7
  // src/validation.ts
8
8
  var textField = { field: "besttrack.validation.text", control: "text" };
9
+ var colorField = { field: "besttrack.validation.color", control: "color" };
9
10
  var productsField = { field: "besttrack.validation.products", control: "products" };
10
11
  var strictUrlField = {
11
12
  field: "besttrack.validation.url",
@@ -13,7 +14,7 @@ var strictUrlField = {
13
14
  validation: { allowRelativeUrl: false, allowedUrlProtocols: ["https:"], allowLocalhost: true }
14
15
  };
15
16
  function fields(keys, urlKeys = [], resourceKeys = [], productsKeys = []) {
16
- return Object.fromEntries(keys.map((key) => [key, productsKeys.includes(key) ? productsField : resourceKeys.includes(key) ? { field: "besttrack.validation.resource" } : urlKeys.includes(key) ? strictUrlField : textField]));
17
+ return Object.fromEntries(keys.map((key) => [key, productsKeys.includes(key) ? productsField : resourceKeys.includes(key) ? { field: "besttrack.validation.resource" } : urlKeys.includes(key) ? strictUrlField : /color$/i.test(key) ? colorField : textField]));
17
18
  }
18
19
  function block(type, version, keys, variants, validate, urlKeys = [], resourceKeys = [], productsKeys = []) {
19
20
  return {
@@ -67,7 +68,7 @@ function validateFeaturedProduct(props) {
67
68
  return issues;
68
69
  }
69
70
  var readyToGoContracts = [
70
- block("besttrack.ready-to-go.query", 1, ["heading", "submitLabel", "defaultTrackingNumber", "defaultOrderNumber", "defaultQueryMode", "trackingTabLabel", "orderTabLabel"], ["default"]),
71
+ block("besttrack.ready-to-go.query", 1, ["heading", "submitLabel", "submitButtonColor", "defaultTrackingNumber", "defaultOrderNumber", "defaultQueryMode", "trackingTabLabel", "orderTabLabel"], ["default"]),
71
72
  block("besttrack.ready-to-go.progress", 1, [], ["default"]),
72
73
  block("besttrack.ready-to-go.delivery", 1, ["heading", "contentsHeading", "carrierHeading"], ["default", "compact"]),
73
74
  block("besttrack.ready-to-go.recommendations", 1, ["heading", "products"], ["default", "grid"], void 0, [], [], ["products"])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standhigher/besttrack-page-extension",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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.0"
25
+ "@standhigher/puck-page-builder": "0.12.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsup": "^8.5.1",