@standhigher/besttrack-page-extension 0.5.3 → 0.5.4
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 +6 -1
- package/dist/index.js +14 -5
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -312,12 +312,17 @@ type ReadyToGoRuntimeProviderProps = {
|
|
|
312
312
|
transport?: ShopifyTrackPageTransport;
|
|
313
313
|
/** When omitted, URL deep-link auto-query is on only for the Shopify Track Page `transport` path. */
|
|
314
314
|
autoQueryFromUrl?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Preview-only: query the form's demo tracking number on mount.
|
|
317
|
+
* Live storefronts must omit this so consumers still submit the form.
|
|
318
|
+
*/
|
|
319
|
+
autoQueryDemo?: boolean;
|
|
315
320
|
/** Host-decided display state. Omitted values follow the original powered-by hide rule. */
|
|
316
321
|
watermark?: TrackingPageWatermark;
|
|
317
322
|
/** Admin-only promotion preview; live storefronts continue to use result.ad. */
|
|
318
323
|
adPreview?: TrackingPageAd | null;
|
|
319
324
|
};
|
|
320
|
-
declare function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, watermark, adPreview }: ReadyToGoRuntimeProviderProps): react.JSX.Element;
|
|
325
|
+
declare function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, autoQueryDemo, watermark, adPreview }: ReadyToGoRuntimeProviderProps): react.JSX.Element;
|
|
321
326
|
|
|
322
327
|
/**
|
|
323
328
|
* Compatibility metadata for template-aware hosts.
|
package/dist/index.js
CHANGED
|
@@ -1109,6 +1109,7 @@ var initialRuntime = {
|
|
|
1109
1109
|
phase: "idle",
|
|
1110
1110
|
recommendations: { phase: "idle", items: [] },
|
|
1111
1111
|
autoQueryFromUrl: false,
|
|
1112
|
+
autoQueryDemo: false,
|
|
1112
1113
|
async query() {
|
|
1113
1114
|
return void 0;
|
|
1114
1115
|
}
|
|
@@ -1138,7 +1139,7 @@ function previewReadyToGoTracking(trackingNumber = "BT-2048-DEMO") {
|
|
|
1138
1139
|
async function queryMockReadyToGoTracking(request) {
|
|
1139
1140
|
return previewReadyToGoTracking(request.mode === "tracking" ? request.trackingNumber : request.orderNumber);
|
|
1140
1141
|
}
|
|
1141
|
-
function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, watermark, adPreview }) {
|
|
1142
|
+
function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, autoQueryDemo = false, watermark, adPreview }) {
|
|
1142
1143
|
const [state, setState] = useState2({ phase: "idle" });
|
|
1143
1144
|
const [recommendations, setRecommendations] = useState2(() => queryRecommendations || transport ? { phase: "loading", items: [] } : { phase: "success", items: previewReadyToGoTracking().recommendations ?? [] });
|
|
1144
1145
|
const requestId = useRef(0);
|
|
@@ -1184,7 +1185,7 @@ function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecomme
|
|
|
1184
1185
|
() => watermark ?? { visible: !shouldHidePoweredBy() },
|
|
1185
1186
|
[watermark]
|
|
1186
1187
|
);
|
|
1187
|
-
const value = useMemo2(() => ({ ...state, adPreview, query, recommendations, autoQueryFromUrl: resolveAutoQuery, watermark: resolvedWatermark }), [adPreview, query, recommendations, resolveAutoQuery, resolvedWatermark, state]);
|
|
1188
|
+
const value = useMemo2(() => ({ ...state, adPreview, query, recommendations, autoQueryFromUrl: resolveAutoQuery, autoQueryDemo, watermark: resolvedWatermark }), [adPreview, autoQueryDemo, query, recommendations, resolveAutoQuery, resolvedWatermark, state]);
|
|
1188
1189
|
return /* @__PURE__ */ jsx3(ReadyToGoRuntimeContext.Provider, { value, children });
|
|
1189
1190
|
}
|
|
1190
1191
|
function useReadyToGoRuntime() {
|
|
@@ -1421,14 +1422,22 @@ function ReadyToGoQueryBlock(props) {
|
|
|
1421
1422
|
const [email, setEmail] = useState2(locationState?.email ?? "");
|
|
1422
1423
|
const [localError, setLocalError] = useState2("");
|
|
1423
1424
|
const autoQueryStarted = useRef(false);
|
|
1425
|
+
const previewDemoTrackingNumber = useRef(trackingNumber);
|
|
1424
1426
|
const heading = text(props, "heading");
|
|
1425
1427
|
const submitLabel = text(props, "submitLabel", "Track Your Order");
|
|
1426
1428
|
const trackingTabLabel = text(props, "trackingTabLabel", "Tracking Number");
|
|
1427
1429
|
const orderTabLabel = text(props, "orderTabLabel", "Order Number");
|
|
1428
1430
|
useEffect2(() => {
|
|
1429
|
-
if (
|
|
1431
|
+
if (autoQueryStarted.current) return;
|
|
1432
|
+
if (locationState?.canAutoQuery) {
|
|
1433
|
+
autoQueryStarted.current = true;
|
|
1434
|
+
void runtime.query(locationState.tab === "tracking" ? { mode: "tracking", trackingNumber: locationState.trackingNumber } : { mode: "order", orderNumber: locationState.orderNumber, email: locationState.email });
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
const demoTrackingNumber = previewDemoTrackingNumber.current.trim();
|
|
1438
|
+
if (!runtime.autoQueryDemo || !demoTrackingNumber) return;
|
|
1430
1439
|
autoQueryStarted.current = true;
|
|
1431
|
-
void runtime.query(
|
|
1440
|
+
void runtime.query({ mode: "tracking", trackingNumber: demoTrackingNumber });
|
|
1432
1441
|
}, [locationState, runtime]);
|
|
1433
1442
|
const submit = (event) => {
|
|
1434
1443
|
event.preventDefault();
|
|
@@ -1490,7 +1499,7 @@ function ReadyToGoProgressBlock(props) {
|
|
|
1490
1499
|
/* @__PURE__ */ jsx3(SkeletonRow, {})
|
|
1491
1500
|
] }) : null,
|
|
1492
1501
|
runtime.phase === "error" ? /* @__PURE__ */ jsx3("p", { style: { margin: 0, color: "#b42318" }, children: "Shipment progress is temporarily unavailable." }) : null,
|
|
1493
|
-
runtime.phase === "success" && result ? /* @__PURE__ */ jsx3(ProgressResult, { result, color: text(props, "progressColor") }) : null
|
|
1502
|
+
runtime.phase === "success" && result ? /* @__PURE__ */ jsx3(ProgressResult, { result, showEstimatedDelivery: !runtime.autoQueryDemo, color: text(props, "progressColor") }) : null
|
|
1494
1503
|
] }) });
|
|
1495
1504
|
}
|
|
1496
1505
|
function ReadyToGoDeliveryBlock(props) {
|
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.4",
|
|
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.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"tsup": "^8.5.1",
|