@standhigher/besttrack-page-extension 0.2.1 → 0.4.0
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/README.md +69 -12
- package/dist/chunk-KD7KFFFK.js +127 -0
- package/dist/index.d.ts +396 -34
- package/dist/index.js +2065 -413
- package/dist/validation.d.ts +9 -0
- package/dist/validation.js +121 -0
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,828 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatTrackingPageMoney,
|
|
3
|
+
getResolvedShopifyResource,
|
|
4
|
+
getShopifyResourceResolutionError,
|
|
5
|
+
isEmptyTrackingPageResult,
|
|
6
|
+
isSafeTrackingPageUrl,
|
|
7
|
+
isShopifyResourceReference,
|
|
8
|
+
isTrackingPageResourceReference,
|
|
9
|
+
isValidOrderEmail,
|
|
10
|
+
isValidOrderNumber,
|
|
11
|
+
isValidTrackingNumber,
|
|
12
|
+
resolveShopifyResources,
|
|
13
|
+
safeTrackingPageUrl
|
|
14
|
+
} from "./chunk-KD7KFFFK.js";
|
|
15
|
+
|
|
1
16
|
// src/ready-to-go.tsx
|
|
2
|
-
import { createContext, useCallback, useContext, useMemo, useState as useState2 } from "react";
|
|
17
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState as useState2 } from "react";
|
|
18
|
+
|
|
19
|
+
// src/shopify-track-page/i18n/locales.ts
|
|
20
|
+
var SUPPORTED_LOCALES = [
|
|
21
|
+
"EN",
|
|
22
|
+
"ZH-HANS",
|
|
23
|
+
"FR",
|
|
24
|
+
"ES",
|
|
25
|
+
"DE",
|
|
26
|
+
"PT-BR",
|
|
27
|
+
"IT",
|
|
28
|
+
"ID",
|
|
29
|
+
"VI",
|
|
30
|
+
"TH"
|
|
31
|
+
];
|
|
32
|
+
var LOCALE_STORAGE_KEY = "bestrack_locale";
|
|
33
|
+
function isSupportedLocale(value) {
|
|
34
|
+
return SUPPORTED_LOCALES.includes(value);
|
|
35
|
+
}
|
|
36
|
+
function normalizeLocale(value) {
|
|
37
|
+
if (!value) return null;
|
|
38
|
+
const normalized = value.trim();
|
|
39
|
+
const canonical = normalized.toUpperCase();
|
|
40
|
+
if (isSupportedLocale(canonical)) return canonical;
|
|
41
|
+
const lower = normalized.toLowerCase();
|
|
42
|
+
if (lower === "zh" || lower === "zh-cn" || lower === "zh-hans") return "ZH-HANS";
|
|
43
|
+
if (lower === "en" || lower.startsWith("en-")) return "EN";
|
|
44
|
+
if (lower === "fr" || lower.startsWith("fr-")) return "FR";
|
|
45
|
+
if (lower === "es" || lower.startsWith("es-")) return "ES";
|
|
46
|
+
if (lower === "de" || lower.startsWith("de-")) return "DE";
|
|
47
|
+
if (lower === "pt" || lower.startsWith("pt-")) return "PT-BR";
|
|
48
|
+
if (lower === "it" || lower.startsWith("it-")) return "IT";
|
|
49
|
+
if (lower === "id" || lower.startsWith("id-")) return "ID";
|
|
50
|
+
if (lower === "vi" || lower.startsWith("vi-")) return "VI";
|
|
51
|
+
if (lower === "th" || lower.startsWith("th-")) return "TH";
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function resolveInitialLocale() {
|
|
55
|
+
if (typeof window !== "undefined") {
|
|
56
|
+
const urlLocale = normalizeLocale(new URLSearchParams(window.location.search).get("lang"));
|
|
57
|
+
if (urlLocale) return urlLocale;
|
|
58
|
+
const storedLocale = normalizeLocale(window.localStorage.getItem(LOCALE_STORAGE_KEY));
|
|
59
|
+
if (storedLocale) return storedLocale;
|
|
60
|
+
}
|
|
61
|
+
return "EN";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/shopify-track-page/i18n/dateTime.ts
|
|
65
|
+
var localeMap = {
|
|
66
|
+
EN: "en-US",
|
|
67
|
+
"ZH-HANS": "zh-CN",
|
|
68
|
+
FR: "fr-FR",
|
|
69
|
+
ES: "es-ES",
|
|
70
|
+
DE: "de-DE",
|
|
71
|
+
"PT-BR": "pt-BR",
|
|
72
|
+
IT: "it-IT",
|
|
73
|
+
ID: "id-ID",
|
|
74
|
+
VI: "vi-VN",
|
|
75
|
+
TH: "th-TH"
|
|
76
|
+
};
|
|
77
|
+
var tryParseDate = (time) => {
|
|
78
|
+
const normalized = time.trim();
|
|
79
|
+
if (!normalized) return null;
|
|
80
|
+
const isoCandidate = /\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(normalized) && !normalized.includes("T") ? normalized.replace(" ", "T") : normalized;
|
|
81
|
+
const parsed = Date.parse(isoCandidate);
|
|
82
|
+
if (Number.isNaN(parsed)) return null;
|
|
83
|
+
return new Date(parsed);
|
|
84
|
+
};
|
|
85
|
+
var getFormatter = (locale, options) => new Intl.DateTimeFormat(localeMap[locale], options);
|
|
86
|
+
function formatTrackingDateLabel(time, locale, options = {}) {
|
|
87
|
+
const date = tryParseDate(time);
|
|
88
|
+
if (!date) return time;
|
|
89
|
+
return getFormatter(locale, {
|
|
90
|
+
month: "short",
|
|
91
|
+
day: "numeric",
|
|
92
|
+
...options
|
|
93
|
+
}).format(date);
|
|
94
|
+
}
|
|
95
|
+
function formatTrackingDateTime(time, locale, options = {}) {
|
|
96
|
+
const date = tryParseDate(time);
|
|
97
|
+
if (!date) return time;
|
|
98
|
+
return getFormatter(locale, {
|
|
99
|
+
month: "short",
|
|
100
|
+
day: "numeric",
|
|
101
|
+
hour: "numeric",
|
|
102
|
+
minute: "2-digit",
|
|
103
|
+
hour12: locale === "EN",
|
|
104
|
+
...options
|
|
105
|
+
}).format(date);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/shopify-track-page/timeline.ts
|
|
109
|
+
var DEFAULT_INFO_NODE = {
|
|
110
|
+
node: "InfoReceived",
|
|
111
|
+
description: "",
|
|
112
|
+
time: "",
|
|
113
|
+
location: "",
|
|
114
|
+
country: "",
|
|
115
|
+
state: "",
|
|
116
|
+
city: "",
|
|
117
|
+
street: "",
|
|
118
|
+
carrier: ""
|
|
119
|
+
};
|
|
120
|
+
function normalizeExternalUrl(url) {
|
|
121
|
+
const trimmedUrl = url.trim();
|
|
122
|
+
if (!trimmedUrl) return "";
|
|
123
|
+
if (/^[a-z][a-z\d+.-]*:\/\//i.test(trimmedUrl)) return trimmedUrl;
|
|
124
|
+
if (trimmedUrl.startsWith("//")) return `https:${trimmedUrl}`;
|
|
125
|
+
return `https://${trimmedUrl}`;
|
|
126
|
+
}
|
|
127
|
+
function getUrlParam(params, key) {
|
|
128
|
+
return params.get(key)?.trim() ?? "";
|
|
129
|
+
}
|
|
130
|
+
var baseTrackingSteps = [
|
|
131
|
+
{
|
|
132
|
+
key: "ordered",
|
|
133
|
+
label: "Ordered",
|
|
134
|
+
date: "Aug 7",
|
|
135
|
+
done: true,
|
|
136
|
+
icon: "check"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "ready",
|
|
140
|
+
label: "Order Ready",
|
|
141
|
+
date: "Aug 8",
|
|
142
|
+
done: false,
|
|
143
|
+
icon: "bag"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
key: "transit",
|
|
147
|
+
label: "In Transit",
|
|
148
|
+
date: "Aug 9",
|
|
149
|
+
done: false,
|
|
150
|
+
icon: "truck"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: "out",
|
|
154
|
+
label: "Out for Delivery",
|
|
155
|
+
date: "Aug 16",
|
|
156
|
+
done: false,
|
|
157
|
+
icon: "box"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
key: "delivered",
|
|
161
|
+
label: "Delivered",
|
|
162
|
+
date: "Aug 16",
|
|
163
|
+
done: false,
|
|
164
|
+
icon: "check"
|
|
165
|
+
}
|
|
166
|
+
];
|
|
167
|
+
var trackingStatusMappings = [
|
|
168
|
+
{ stage: "InfoReceived", subStatus: "InfoReceived", stepKey: "ordered" },
|
|
169
|
+
{ stage: "InTransit", subStatus: "InTransit_PickedUp", stepKey: "ready" },
|
|
170
|
+
{ stage: "InTransit", subStatus: "InTransit_Other", stepKey: "transit" },
|
|
171
|
+
{ stage: "InTransit", subStatus: "InTransit_Departure", stepKey: "transit" },
|
|
172
|
+
{ stage: "InTransit", subStatus: "InTransit_Arrival", stepKey: "transit" },
|
|
173
|
+
{ stage: "InTransit", subStatus: "InTransit_CustomsProcessing", stepKey: "transit" },
|
|
174
|
+
{ stage: "InTransit", subStatus: "InTransit_CustomsReleased", stepKey: "transit" },
|
|
175
|
+
{ stage: "InTransit", subStatus: "InTransit_CustomsRequiringInformation", stepKey: "transit" },
|
|
176
|
+
{ stage: "Expired", subStatus: "Expired_Other", stepKey: "transit" },
|
|
177
|
+
{ stage: "AvailableForPickup", subStatus: "AvailableForPickup_Other", stepKey: "transit" },
|
|
178
|
+
{ stage: "OutForDelivery", subStatus: "OutForDelivery_Other", stepKey: "out" },
|
|
179
|
+
{ stage: "DeliveryFailure", subStatus: "DeliveryFailure_Other", stepKey: "out" },
|
|
180
|
+
{ stage: "DeliveryFailure", subStatus: "DeliveryFailure_NoBody", stepKey: "out" },
|
|
181
|
+
{ stage: "DeliveryFailure", subStatus: "DeliveryFailure_Security", stepKey: "out" },
|
|
182
|
+
{ stage: "DeliveryFailure", subStatus: "DeliveryFailure_Rejected", stepKey: "out" },
|
|
183
|
+
{ stage: "DeliveryFailure", subStatus: "DeliveryFailure_InvalidAddress", stepKey: "out" },
|
|
184
|
+
{ stage: "Delivered", subStatus: "Delivered_Other", stepKey: "delivered" }
|
|
185
|
+
];
|
|
186
|
+
var subStatusStepMap = new Map(
|
|
187
|
+
trackingStatusMappings.map(({ subStatus, stepKey }) => [subStatus, stepKey])
|
|
188
|
+
);
|
|
189
|
+
var stageStepMap = new Map(
|
|
190
|
+
trackingStatusMappings.map(({ stage, stepKey }) => [stage, stepKey])
|
|
191
|
+
);
|
|
192
|
+
var legacyNodeStepMap = /* @__PURE__ */ new Map([
|
|
193
|
+
["InfoReceived", "ordered"],
|
|
194
|
+
["PickedUp", "ready"],
|
|
195
|
+
["Departure", "transit"],
|
|
196
|
+
["Arrival", "transit"],
|
|
197
|
+
["AvailableForPickup", "transit"],
|
|
198
|
+
["OutForDelivery", "out"],
|
|
199
|
+
["Delivered", "delivered"],
|
|
200
|
+
["Returned", "delivered"],
|
|
201
|
+
["Returning", "delivered"]
|
|
202
|
+
]);
|
|
203
|
+
var getStepKeyForStatus = (status) => {
|
|
204
|
+
const normalized = status?.trim() ?? "";
|
|
205
|
+
if (!normalized) return null;
|
|
206
|
+
const exactMatch = subStatusStepMap.get(normalized) ?? legacyNodeStepMap.get(normalized);
|
|
207
|
+
if (exactMatch) return exactMatch;
|
|
208
|
+
const stage = normalized.split("_")[0];
|
|
209
|
+
return stageStepMap.get(stage) ?? null;
|
|
210
|
+
};
|
|
211
|
+
var getStepKeyForStatusRecord = (record) => getStepKeyForStatus(record.status) ?? (record.fallbackStatus ? getStepKeyForStatus(record.fallbackStatus) : null);
|
|
212
|
+
var getStepIndexForStatusRecord = (record) => {
|
|
213
|
+
const stepKey = getStepKeyForStatusRecord(record);
|
|
214
|
+
return stepKey ? baseTrackingSteps.findIndex((step) => step.key === stepKey) : -1;
|
|
215
|
+
};
|
|
216
|
+
var buildStepsFromStatusRecords = (records, locale) => {
|
|
217
|
+
let maxIndex = -1;
|
|
218
|
+
records.forEach((record) => {
|
|
219
|
+
const index = getStepIndexForStatusRecord(record);
|
|
220
|
+
if (index > maxIndex) {
|
|
221
|
+
maxIndex = index;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return baseTrackingSteps.map((step, index) => {
|
|
225
|
+
const matchedRecord = records.find((record) => getStepKeyForStatusRecord(record) === step.key);
|
|
226
|
+
const date = matchedRecord ? formatNodeDateLabel(matchedRecord.time, locale) : "";
|
|
227
|
+
return {
|
|
228
|
+
...step,
|
|
229
|
+
done: maxIndex >= 0 ? index <= maxIndex : step.done,
|
|
230
|
+
date: matchedRecord ? date : ""
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
var buildStepsFromRawEvents = (events, locale) => buildStepsFromStatusRecords(
|
|
235
|
+
events.map((event) => ({
|
|
236
|
+
status: event.sub_status || event.stage || "",
|
|
237
|
+
fallbackStatus: event.stage,
|
|
238
|
+
time: event.time
|
|
239
|
+
})),
|
|
240
|
+
locale
|
|
241
|
+
);
|
|
242
|
+
var buildStepsFromNodes = (nodeList, locale) => buildStepsFromStatusRecords(
|
|
243
|
+
nodeList.map((node) => ({
|
|
244
|
+
status: node.node,
|
|
245
|
+
time: node.time
|
|
246
|
+
})),
|
|
247
|
+
locale
|
|
248
|
+
);
|
|
249
|
+
var monthIndexMap = /* @__PURE__ */ new Map([
|
|
250
|
+
["jan", 0],
|
|
251
|
+
["january", 0],
|
|
252
|
+
["feb", 1],
|
|
253
|
+
["february", 1],
|
|
254
|
+
["mar", 2],
|
|
255
|
+
["march", 2],
|
|
256
|
+
["apr", 3],
|
|
257
|
+
["april", 3],
|
|
258
|
+
["may", 4],
|
|
259
|
+
["jun", 5],
|
|
260
|
+
["june", 5],
|
|
261
|
+
["jul", 6],
|
|
262
|
+
["july", 6],
|
|
263
|
+
["aug", 7],
|
|
264
|
+
["august", 7],
|
|
265
|
+
["sep", 8],
|
|
266
|
+
["sept", 8],
|
|
267
|
+
["september", 8],
|
|
268
|
+
["oct", 9],
|
|
269
|
+
["october", 9],
|
|
270
|
+
["nov", 10],
|
|
271
|
+
["november", 10],
|
|
272
|
+
["dec", 11],
|
|
273
|
+
["december", 11]
|
|
274
|
+
]);
|
|
275
|
+
var normalizeNodeTime = (time) => time.replace(/\s+/g, " ").trim();
|
|
276
|
+
var toParsedNodeTime = ({
|
|
277
|
+
year,
|
|
278
|
+
monthIndex,
|
|
279
|
+
day,
|
|
280
|
+
hourInput,
|
|
281
|
+
minute,
|
|
282
|
+
period
|
|
283
|
+
}) => {
|
|
284
|
+
if (day < 1 || day > 31 || hourInput < 1 || hourInput > 12 || minute < 0 || minute > 59) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
let hour = hourInput % 12;
|
|
288
|
+
if (period.toLowerCase() === "pm") {
|
|
289
|
+
hour += 12;
|
|
290
|
+
}
|
|
291
|
+
const hasYear = year !== void 0;
|
|
292
|
+
const timestamp = Date.UTC(hasYear ? year : 2001, monthIndex, day, hour, minute);
|
|
293
|
+
return { timestamp, hasYear, monthIndex, day, hour, minute };
|
|
294
|
+
};
|
|
295
|
+
var parseMonthNameTime = (time) => {
|
|
296
|
+
const match = time.match(/^([a-z]+)\s+(\d{1,2})(?:,?\s+(\d{4}))?\s+(\d{1,2}):(\d{2})\s*(am|pm)$/i);
|
|
297
|
+
if (!match) return null;
|
|
298
|
+
const [, monthName, dayValue, yearValue, hourValue, minuteValue, period] = match;
|
|
299
|
+
const monthIndex = monthIndexMap.get(monthName.toLowerCase());
|
|
300
|
+
if (monthIndex === void 0) return null;
|
|
301
|
+
return toParsedNodeTime({
|
|
302
|
+
year: yearValue ? Number(yearValue) : void 0,
|
|
303
|
+
monthIndex,
|
|
304
|
+
day: Number(dayValue),
|
|
305
|
+
hourInput: Number(hourValue),
|
|
306
|
+
minute: Number(minuteValue),
|
|
307
|
+
period
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
var parseYearFirstMonthNameTime = (time) => {
|
|
311
|
+
const match = time.match(/^(\d{4})\s+([a-z]+)\s+(\d{1,2})\s+(\d{1,2}):(\d{2})\s*(am|pm)$/i);
|
|
312
|
+
if (!match) return null;
|
|
313
|
+
const [, yearValue, monthName, dayValue, hourValue, minuteValue, period] = match;
|
|
314
|
+
const monthIndex = monthIndexMap.get(monthName.toLowerCase());
|
|
315
|
+
if (monthIndex === void 0) return null;
|
|
316
|
+
return toParsedNodeTime({
|
|
317
|
+
year: Number(yearValue),
|
|
318
|
+
monthIndex,
|
|
319
|
+
day: Number(dayValue),
|
|
320
|
+
hourInput: Number(hourValue),
|
|
321
|
+
minute: Number(minuteValue),
|
|
322
|
+
period
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
var parseNumericDateTime = (time) => {
|
|
326
|
+
const match = time.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})[ T](\d{1,2}):(\d{2})(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?$/);
|
|
327
|
+
if (!match) return null;
|
|
328
|
+
const [, yearValue, monthValue, dayValue, hourValue, minuteValue] = match;
|
|
329
|
+
const year = Number(yearValue);
|
|
330
|
+
const monthIndex = Number(monthValue) - 1;
|
|
331
|
+
const day = Number(dayValue);
|
|
332
|
+
const hour = Number(hourValue);
|
|
333
|
+
const minute = Number(minuteValue);
|
|
334
|
+
if (monthIndex < 0 || monthIndex > 11 || day < 1 || day > 31 || hour < 0 || hour > 23 || minute < 0 || minute > 59) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
timestamp: Date.UTC(year, monthIndex, day, hour, minute),
|
|
339
|
+
hasYear: true,
|
|
340
|
+
monthIndex,
|
|
341
|
+
day,
|
|
342
|
+
hour,
|
|
343
|
+
minute
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
var parseNativeDateTime = (time) => {
|
|
347
|
+
const isoCandidate = /\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(time) && !time.includes("T") ? time.replace(" ", "T") : time;
|
|
348
|
+
const parsed = Date.parse(isoCandidate);
|
|
349
|
+
if (Number.isNaN(parsed)) return null;
|
|
350
|
+
const date = new Date(parsed);
|
|
351
|
+
return {
|
|
352
|
+
timestamp: parsed,
|
|
353
|
+
hasYear: /\d{4}/.test(time),
|
|
354
|
+
monthIndex: date.getMonth(),
|
|
355
|
+
day: date.getDate(),
|
|
356
|
+
hour: date.getHours(),
|
|
357
|
+
minute: date.getMinutes()
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
var getNodeTimeMeta = (time) => {
|
|
361
|
+
const normalized = normalizeNodeTime(time);
|
|
362
|
+
if (!normalized) return null;
|
|
363
|
+
return parseMonthNameTime(normalized) ?? parseYearFirstMonthNameTime(normalized) ?? parseNumericDateTime(normalized) ?? parseNativeDateTime(normalized);
|
|
364
|
+
};
|
|
365
|
+
var formatNodeTime = (time, locale) => formatTrackingDateTime(normalizeNodeTime(time), locale);
|
|
366
|
+
var formatNodeDateLabel = (time, locale) => formatTrackingDateLabel(normalizeNodeTime(time), locale);
|
|
367
|
+
function formatEstimatedDelivery(estimatedDelivery, locale) {
|
|
368
|
+
if (!estimatedDelivery || !locale) return null;
|
|
369
|
+
const from = estimatedDelivery.from.trim();
|
|
370
|
+
const to = estimatedDelivery.to.trim();
|
|
371
|
+
if (!from || !to) return null;
|
|
372
|
+
const dateText = from === to ? formatTrackingDateLabel(from, locale) : `${formatTrackingDateLabel(from, locale)}-${formatTrackingDateLabel(to, locale)}`;
|
|
373
|
+
return {
|
|
374
|
+
dateText,
|
|
375
|
+
fromLabel: formatTrackingDateLabel(from, locale),
|
|
376
|
+
toLabel: formatTrackingDateLabel(to, locale)
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
var getComparisonDateTimestamp = (value, now = /* @__PURE__ */ new Date()) => {
|
|
380
|
+
const normalized = normalizeNodeTime(value);
|
|
381
|
+
if (!normalized) return null;
|
|
382
|
+
const dateOnlyMatch = normalized.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/);
|
|
383
|
+
if (dateOnlyMatch) {
|
|
384
|
+
const [, year, month, day] = dateOnlyMatch;
|
|
385
|
+
return Date.UTC(Number(year), Number(month) - 1, Number(day));
|
|
386
|
+
}
|
|
387
|
+
const parsed = getNodeTimeMeta(normalized);
|
|
388
|
+
if (parsed) {
|
|
389
|
+
const year = parsed.hasYear ? new Date(parsed.timestamp).getUTCFullYear() : now.getFullYear();
|
|
390
|
+
return Date.UTC(year, parsed.monthIndex, parsed.day);
|
|
391
|
+
}
|
|
392
|
+
const nativeTimestamp = Date.parse(normalized);
|
|
393
|
+
if (Number.isNaN(nativeTimestamp)) return null;
|
|
394
|
+
const date = new Date(nativeTimestamp);
|
|
395
|
+
return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
|
|
396
|
+
};
|
|
397
|
+
var getLatestTrackingTimestamp = (milestone, now = /* @__PURE__ */ new Date()) => {
|
|
398
|
+
const times = (milestone.rawEventList?.length ? milestone.rawEventList.map((event) => event.time) : milestone.nodeList.map((node) => node.time)).map((time) => getComparisonDateTimestamp(time, now)).filter((timestamp) => timestamp !== null);
|
|
399
|
+
return times.length > 0 ? Math.max(...times) : null;
|
|
400
|
+
};
|
|
401
|
+
var hasActualDelivery = (milestone) => {
|
|
402
|
+
const statuses = milestone.rawEventList?.length ? milestone.rawEventList.flatMap((event) => [event.sub_status, event.stage]) : milestone.nodeList.map((node) => node.node);
|
|
403
|
+
return statuses.some((status) => /^delivered(?:_|$)/i.test(status.trim()));
|
|
404
|
+
};
|
|
405
|
+
function shouldShowEstimatedDelivery(milestone, now = /* @__PURE__ */ new Date()) {
|
|
406
|
+
const estimatedDelivery = milestone?.estimated_delivery;
|
|
407
|
+
if (!milestone || !estimatedDelivery) return false;
|
|
408
|
+
if (hasActualDelivery(milestone)) return false;
|
|
409
|
+
const endTimestamp = getComparisonDateTimestamp(estimatedDelivery.to, now);
|
|
410
|
+
if (endTimestamp === null) return false;
|
|
411
|
+
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
|
|
412
|
+
const latestTracking = getLatestTrackingTimestamp(milestone, now) ?? today;
|
|
413
|
+
return endTimestamp >= Math.max(today, latestTracking);
|
|
414
|
+
}
|
|
415
|
+
var fixYearBoundary = (details) => {
|
|
416
|
+
if (details.some((d) => d.hasYear)) return details;
|
|
417
|
+
const valid = details.map((d) => d.timestamp).filter((t) => t !== null);
|
|
418
|
+
if (valid.length < 2) return details;
|
|
419
|
+
const minTs = Math.min(...valid);
|
|
420
|
+
const maxTs = Math.max(...valid);
|
|
421
|
+
const SIX_MONTHS_MS = 6 * 30 * 24 * 60 * 60 * 1e3;
|
|
422
|
+
const ONE_YEAR_MS = 365 * 24 * 60 * 60 * 1e3;
|
|
423
|
+
if (maxTs - minTs <= SIX_MONTHS_MS) return details;
|
|
424
|
+
return details.map((d) => {
|
|
425
|
+
if (d.timestamp === null || d.timestamp - minTs <= SIX_MONTHS_MS) return d;
|
|
426
|
+
return { ...d, timestamp: d.timestamp - ONE_YEAR_MS };
|
|
427
|
+
});
|
|
428
|
+
};
|
|
429
|
+
var normalizeSyntheticPrefixTimeline = (details, syntheticPrefixLength = 0) => {
|
|
430
|
+
if (syntheticPrefixLength <= 0) return details;
|
|
431
|
+
if (details.some((item) => item.hasYear)) return details;
|
|
432
|
+
const syntheticDetails = details.slice(0, syntheticPrefixLength);
|
|
433
|
+
const realDetails = details.slice(syntheticPrefixLength);
|
|
434
|
+
const syntheticTimestamps = syntheticDetails.map((item) => item.timestamp).filter((timestamp) => timestamp !== null);
|
|
435
|
+
const realTimestamps = realDetails.map((item) => item.timestamp).filter((timestamp) => timestamp !== null);
|
|
436
|
+
if (syntheticTimestamps.length === 0 || realTimestamps.length === 0) return details;
|
|
437
|
+
const minSyntheticTs = Math.min(...syntheticTimestamps);
|
|
438
|
+
const maxRealTs = Math.max(...realTimestamps);
|
|
439
|
+
if (minSyntheticTs <= maxRealTs) return details;
|
|
440
|
+
const THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
441
|
+
if (minSyntheticTs - maxRealTs <= THIRTY_DAYS_MS) return details;
|
|
442
|
+
const minRealTs = Math.min(...realTimestamps);
|
|
443
|
+
const ONE_YEAR_MS = 365 * 24 * 60 * 60 * 1e3;
|
|
444
|
+
const shiftYears = Math.ceil((minSyntheticTs - minRealTs + 1) / ONE_YEAR_MS);
|
|
445
|
+
return details.map((item, index) => {
|
|
446
|
+
if (index >= syntheticPrefixLength || item.timestamp === null) return item;
|
|
447
|
+
return { ...item, timestamp: item.timestamp - shiftYears * ONE_YEAR_MS };
|
|
448
|
+
});
|
|
449
|
+
};
|
|
450
|
+
var sortShippingDetailsByTime = (details, syntheticPrefixLength = 0) => {
|
|
451
|
+
const adjustedDetails = normalizeSyntheticPrefixTimeline(
|
|
452
|
+
fixYearBoundary(details),
|
|
453
|
+
syntheticPrefixLength
|
|
454
|
+
);
|
|
455
|
+
const hasTimestamp = adjustedDetails.some((item) => item.timestamp !== null);
|
|
456
|
+
return hasTimestamp ? [...adjustedDetails].sort((a, b) => {
|
|
457
|
+
if (a.timestamp === null && b.timestamp === null) {
|
|
458
|
+
return a.index - b.index;
|
|
459
|
+
}
|
|
460
|
+
if (a.timestamp === null) {
|
|
461
|
+
return 1;
|
|
462
|
+
}
|
|
463
|
+
if (b.timestamp === null) {
|
|
464
|
+
return -1;
|
|
465
|
+
}
|
|
466
|
+
return b.timestamp - a.timestamp || a.index - b.index;
|
|
467
|
+
}) : adjustedDetails;
|
|
468
|
+
};
|
|
469
|
+
var buildShippingDetailsFromRecords = (records, locale) => {
|
|
470
|
+
const filtered = records.filter(
|
|
471
|
+
(record) => record.location.trim() || record.description.trim() || record.time.trim()
|
|
472
|
+
);
|
|
473
|
+
if (filtered.length === 0) return [];
|
|
474
|
+
const rawDetails = filtered.map((record, index) => {
|
|
475
|
+
const timeMeta = getNodeTimeMeta(record.time);
|
|
476
|
+
return {
|
|
477
|
+
index,
|
|
478
|
+
description: [record.location.trim(), record.description.trim()].filter(Boolean).join(", "),
|
|
479
|
+
time: formatNodeTime(record.time, locale),
|
|
480
|
+
timestamp: timeMeta?.timestamp ?? null,
|
|
481
|
+
hasYear: timeMeta?.hasYear ?? false
|
|
482
|
+
};
|
|
483
|
+
});
|
|
484
|
+
const sortedDetails = sortShippingDetailsByTime(rawDetails);
|
|
485
|
+
return sortedDetails.map((item, index) => ({
|
|
486
|
+
description: item.description,
|
|
487
|
+
time: item.time,
|
|
488
|
+
isLatest: index === 0
|
|
489
|
+
}));
|
|
490
|
+
};
|
|
491
|
+
var buildShippingDetails = (nodeList, locale) => buildShippingDetailsFromRecords(nodeList, locale);
|
|
492
|
+
var hasRawTrackingSignal = (event) => Boolean(
|
|
493
|
+
event.sub_status.trim() || event.location.trim() || event.country.trim() || event.state.trim() || event.city.trim() || event.street.trim() || getStepKeyForStatus(event.stage)
|
|
494
|
+
);
|
|
495
|
+
var getSyntheticRawEventPrefixLength = (events) => {
|
|
496
|
+
const firstEventStage = events[0]?.stage.trim().toLowerCase();
|
|
497
|
+
if (firstEventStage !== "order confirmed" && firstEventStage !== "package picked up") {
|
|
498
|
+
return 0;
|
|
499
|
+
}
|
|
500
|
+
let length = 0;
|
|
501
|
+
for (const event of events) {
|
|
502
|
+
if (hasRawTrackingSignal(event)) break;
|
|
503
|
+
length += 1;
|
|
504
|
+
}
|
|
505
|
+
return length;
|
|
506
|
+
};
|
|
507
|
+
var getMilestoneNodeList = (milestone) => {
|
|
508
|
+
const rawNodeList = milestone?.nodeList ?? [];
|
|
509
|
+
return rawNodeList.length > 0 ? rawNodeList : [DEFAULT_INFO_NODE];
|
|
510
|
+
};
|
|
511
|
+
function buildTrackingStepsFromMilestone(milestone, locale) {
|
|
512
|
+
const rawEvents = milestone?.rawEventList ?? [];
|
|
513
|
+
return rawEvents.length > 0 ? buildStepsFromRawEvents(rawEvents, locale) : buildStepsFromNodes(getMilestoneNodeList(milestone), locale);
|
|
514
|
+
}
|
|
515
|
+
function buildShippingDetailsFromMilestone(milestone, locale) {
|
|
516
|
+
const rawEvents = milestone?.rawEventList ?? [];
|
|
517
|
+
return rawEvents.length > 0 ? buildShippingDetailsFromRawEvents(rawEvents, locale) : buildShippingDetails(milestone?.nodeList ?? [], locale);
|
|
518
|
+
}
|
|
519
|
+
var buildShippingDetailsFromRawEvents = (events, locale) => {
|
|
520
|
+
const filtered = events.filter(
|
|
521
|
+
(event) => event.location.trim() || event.description.trim() || event.time.trim()
|
|
522
|
+
);
|
|
523
|
+
if (filtered.length === 0) return [];
|
|
524
|
+
const syntheticPrefixLength = getSyntheticRawEventPrefixLength(filtered);
|
|
525
|
+
const rawDetails = filtered.map((event, index) => {
|
|
526
|
+
const timeMeta = getNodeTimeMeta(event.time);
|
|
527
|
+
return {
|
|
528
|
+
index,
|
|
529
|
+
description: [event.location.trim(), event.description.trim()].filter(Boolean).join(", "),
|
|
530
|
+
time: formatNodeTime(event.time, locale),
|
|
531
|
+
timestamp: timeMeta?.timestamp ?? null,
|
|
532
|
+
hasYear: timeMeta?.hasYear ?? false
|
|
533
|
+
};
|
|
534
|
+
});
|
|
535
|
+
const sortedDetails = sortShippingDetailsByTime(rawDetails, syntheticPrefixLength);
|
|
536
|
+
return sortedDetails.map((item, index) => ({
|
|
537
|
+
description: item.description,
|
|
538
|
+
time: item.time,
|
|
539
|
+
isLatest: index === 0
|
|
540
|
+
}));
|
|
541
|
+
};
|
|
542
|
+
function normalizeOrderValue(value) {
|
|
543
|
+
return value.trim();
|
|
544
|
+
}
|
|
545
|
+
function syncTrackingQueryToUrl(type, value, contactValue = "") {
|
|
546
|
+
if (typeof window === "undefined") return;
|
|
547
|
+
const normalizedValue = value.trim();
|
|
548
|
+
if (!normalizedValue) return;
|
|
549
|
+
const normalizedContactValue = contactValue.trim();
|
|
550
|
+
const url = new URL(window.location.href);
|
|
551
|
+
const params = new URLSearchParams(url.hash.replace(/^#/, ""));
|
|
552
|
+
params.delete("order_number");
|
|
553
|
+
params.delete("tracking_number");
|
|
554
|
+
params.delete("email");
|
|
555
|
+
if (type === "order") {
|
|
556
|
+
params.set("order_number", normalizedValue);
|
|
557
|
+
if (normalizedContactValue) {
|
|
558
|
+
params.set("email", normalizedContactValue);
|
|
559
|
+
}
|
|
560
|
+
} else {
|
|
561
|
+
params.set("tracking_number", normalizedValue);
|
|
562
|
+
}
|
|
563
|
+
url.hash = params.toString();
|
|
564
|
+
window.history.replaceState(window.history.state, "", url);
|
|
565
|
+
}
|
|
566
|
+
function readTrackingQueryLocationState(search = typeof window === "undefined" ? "" : window.location.search, hash = typeof window === "undefined" ? "" : window.location.hash) {
|
|
567
|
+
const searchParams = new URLSearchParams(search);
|
|
568
|
+
const hashParams = new URLSearchParams(hash.replace(/^#/, ""));
|
|
569
|
+
const getParam = (key) => getUrlParam(searchParams, key) || getUrlParam(hashParams, key);
|
|
570
|
+
const trackingNumber = getParam("tracking_number");
|
|
571
|
+
const orderNumber = normalizeOrderValue(getParam("order_number"));
|
|
572
|
+
const email = getParam("email");
|
|
573
|
+
if (trackingNumber) {
|
|
574
|
+
return { tab: "tracking", trackingNumber, orderNumber: "", email: "", canAutoQuery: true };
|
|
575
|
+
}
|
|
576
|
+
if (orderNumber) {
|
|
577
|
+
return { tab: "order", trackingNumber: "", orderNumber, email, canAutoQuery: Boolean(email) };
|
|
578
|
+
}
|
|
579
|
+
return { tab: "tracking", trackingNumber: "", orderNumber: "", email: "", canAutoQuery: false };
|
|
580
|
+
}
|
|
581
|
+
function readTrackingQueryFromLocation(search = typeof window === "undefined" ? "" : window.location.search, hash = typeof window === "undefined" ? "" : window.location.hash) {
|
|
582
|
+
const state = readTrackingQueryLocationState(search, hash);
|
|
583
|
+
if (!state.canAutoQuery) return void 0;
|
|
584
|
+
if (state.tab === "tracking") return { mode: "tracking", trackingNumber: state.trackingNumber };
|
|
585
|
+
return { mode: "order", orderNumber: state.orderNumber, email: state.email };
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// src/shopify-track-page/poweredBy.ts
|
|
589
|
+
var POWERED_BY_HIDDEN_STORE_DOMAINS = /* @__PURE__ */ new Set([
|
|
590
|
+
"nbstore-unlrgjwn.myshopify.com",
|
|
591
|
+
"wavvveglobal.com"
|
|
592
|
+
]);
|
|
593
|
+
function getUrlParam2(params, key) {
|
|
594
|
+
return params.get(key)?.trim() ?? "";
|
|
595
|
+
}
|
|
596
|
+
var normalizeStoreDomain = (value) => {
|
|
597
|
+
const trimmedValue = value.trim().toLowerCase();
|
|
598
|
+
if (!trimmedValue) return "";
|
|
599
|
+
const host = trimmedValue.replace(/^[a-z][a-z\d+.-]*:\/\//i, "").replace(/^\/\//, "").split(/[/?#]/)[0].replace(/:\d+$/, "");
|
|
600
|
+
return host.replace(/^www\./, "");
|
|
601
|
+
};
|
|
602
|
+
function shouldHidePoweredBy(targetWindow) {
|
|
603
|
+
const runtimeWindow = targetWindow ?? (typeof window === "undefined" ? void 0 : window);
|
|
604
|
+
if (!runtimeWindow) return false;
|
|
605
|
+
const shopifyWindow = runtimeWindow;
|
|
606
|
+
if (shopifyWindow.__BESTRACK__?.featureFlags?.enableTrackingPageWatermarkRemoval === true) {
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
609
|
+
const searchParams = new URLSearchParams(runtimeWindow.location.search);
|
|
610
|
+
const hashParams = new URLSearchParams(runtimeWindow.location.hash.replace(/^#/, ""));
|
|
611
|
+
const candidateDomains = [
|
|
612
|
+
runtimeWindow.location.hostname,
|
|
613
|
+
getUrlParam2(searchParams, "shop"),
|
|
614
|
+
getUrlParam2(searchParams, "shop_domain"),
|
|
615
|
+
getUrlParam2(hashParams, "shop"),
|
|
616
|
+
getUrlParam2(hashParams, "shop_domain"),
|
|
617
|
+
shopifyWindow.Shopify?.shop ?? "",
|
|
618
|
+
shopifyWindow.Shopify?.domain ?? ""
|
|
619
|
+
];
|
|
620
|
+
return candidateDomains.map(normalizeStoreDomain).some((domain) => POWERED_BY_HIDDEN_STORE_DOMAINS.has(domain));
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// src/shopify-track-query.ts
|
|
624
|
+
var SHOPIFY_TRACK_QUERY_PATH = "/track/query";
|
|
625
|
+
var SHOPIFY_RECOMMEND_PATH = "/products/recommend";
|
|
626
|
+
function resolveShopifyTrackQueryLocale(locale) {
|
|
627
|
+
const resolved = typeof locale === "function" ? locale() : locale;
|
|
628
|
+
return resolved ?? resolveInitialLocale();
|
|
629
|
+
}
|
|
630
|
+
function withShopifyAppProxyPrefix(path, prefix) {
|
|
631
|
+
const trimmed = prefix.trim();
|
|
632
|
+
const normalizedPrefix = !trimmed || trimmed === "/" ? "" : (trimmed.startsWith("/") ? trimmed : `/${trimmed}`).replace(/\/+$/, "");
|
|
633
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
634
|
+
return `${normalizedPrefix}${normalizedPath}`;
|
|
635
|
+
}
|
|
636
|
+
var emptyResult = () => ({
|
|
637
|
+
outcome: "empty",
|
|
638
|
+
trackingNumber: "",
|
|
639
|
+
status: ""
|
|
640
|
+
});
|
|
641
|
+
function withShopifyTrackCacheBust(url, now = Date.now()) {
|
|
642
|
+
const separator = url.includes("?") ? "&" : "?";
|
|
643
|
+
return `${url}${separator}_t=${now}`;
|
|
644
|
+
}
|
|
645
|
+
function buildShopifyTrackQueryPayload(request, locale = "EN") {
|
|
646
|
+
return {
|
|
647
|
+
order_number: request.mode === "order" ? request.orderNumber.trim() : "",
|
|
648
|
+
email: request.mode === "order" ? request.email.trim() : "",
|
|
649
|
+
tracking_number: request.mode === "tracking" ? request.trackingNumber.trim() : "",
|
|
650
|
+
lang: locale
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
function buildShopifyRecommendPayload(page = 1, pageSize = 20) {
|
|
654
|
+
return { page, page_size: pageSize };
|
|
655
|
+
}
|
|
656
|
+
function toProgress(steps) {
|
|
657
|
+
let lastDone = -1;
|
|
658
|
+
steps.forEach((step, index) => {
|
|
659
|
+
if (step.done) lastDone = index;
|
|
660
|
+
});
|
|
661
|
+
return steps.map((step, index) => ({
|
|
662
|
+
id: step.key,
|
|
663
|
+
label: step.label,
|
|
664
|
+
date: step.date || void 0,
|
|
665
|
+
icon: step.icon,
|
|
666
|
+
state: !step.done ? "upcoming" : index === lastDone ? "current" : "complete"
|
|
667
|
+
}));
|
|
668
|
+
}
|
|
669
|
+
function toEvents(details) {
|
|
670
|
+
return details.map((detail, index) => ({
|
|
671
|
+
id: `event-${index}`,
|
|
672
|
+
title: detail.description,
|
|
673
|
+
at: detail.time || void 0,
|
|
674
|
+
state: detail.isLatest ? "current" : "complete"
|
|
675
|
+
}));
|
|
676
|
+
}
|
|
677
|
+
function toOrderItems(items) {
|
|
678
|
+
return (items ?? []).map((item, index) => ({
|
|
679
|
+
id: item.variant_id || item.product_id || `item-${index}`,
|
|
680
|
+
title: [item.title, item.variant_title].filter(Boolean).join(" - "),
|
|
681
|
+
quantity: item.quantity,
|
|
682
|
+
imageUrl: item.image_url || void 0
|
|
683
|
+
}));
|
|
684
|
+
}
|
|
685
|
+
function cityRegion(milestone) {
|
|
686
|
+
const records = milestone?.rawEventList?.length ? milestone.rawEventList : milestone?.nodeList ?? [];
|
|
687
|
+
for (const record of records) {
|
|
688
|
+
const value = [record.city, record.state, record.country].map((part) => part.trim()).filter(Boolean).join(", ");
|
|
689
|
+
if (value) return value;
|
|
690
|
+
}
|
|
691
|
+
return void 0;
|
|
692
|
+
}
|
|
693
|
+
function mapAd(ad) {
|
|
694
|
+
const imageUrl = ad?.image_url?.trim();
|
|
695
|
+
if (!ad || !imageUrl) return void 0;
|
|
696
|
+
const href = ad.link_url?.trim() ? normalizeExternalUrl(ad.link_url) : void 0;
|
|
697
|
+
return href ? { imageUrl, href } : { imageUrl };
|
|
698
|
+
}
|
|
699
|
+
function mapMilestone(milestone, locale, index) {
|
|
700
|
+
const steps = toProgress(buildTrackingStepsFromMilestone(milestone, locale));
|
|
701
|
+
const events = toEvents(buildShippingDetailsFromMilestone(milestone, locale));
|
|
702
|
+
const current = [...steps].reverse().find((step) => step.state !== "upcoming");
|
|
703
|
+
const estimatedDelivery = shouldShowEstimatedDelivery(milestone) ? formatEstimatedDelivery(milestone?.estimated_delivery, locale)?.dateText : void 0;
|
|
704
|
+
return {
|
|
705
|
+
id: milestone?.tracking_number || `shipment-${index}`,
|
|
706
|
+
label: `Shipment ${index + 1}`,
|
|
707
|
+
trackingNumber: milestone?.tracking_number || void 0,
|
|
708
|
+
status: current?.label || "Ordered",
|
|
709
|
+
carrier: milestone?.carrier || void 0,
|
|
710
|
+
latestEvent: events[0]?.title,
|
|
711
|
+
updatedAt: events[0]?.at,
|
|
712
|
+
destination: cityRegion(milestone),
|
|
713
|
+
estimatedDelivery,
|
|
714
|
+
progress: steps,
|
|
715
|
+
events,
|
|
716
|
+
orderItems: toOrderItems(milestone?.package_items),
|
|
717
|
+
ad: void 0
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
function mapShopifyTrackQueryResponse(response, request, locale = "EN") {
|
|
721
|
+
if (response.code !== 0) {
|
|
722
|
+
return emptyResult();
|
|
723
|
+
}
|
|
724
|
+
const data = response.data;
|
|
725
|
+
const milestones = data?.mileStoneList ?? [];
|
|
726
|
+
const shipments = milestones.map((milestone, index) => mapMilestone(milestone, locale, index));
|
|
727
|
+
const primary = shipments[0] ?? mapMilestone(void 0, locale, 0);
|
|
728
|
+
const trackingNumber = request.mode === "tracking" ? request.trackingNumber.trim() : primary.trackingNumber || "";
|
|
729
|
+
const ad = mapAd(data?.ad_config ?? null);
|
|
730
|
+
return {
|
|
731
|
+
outcome: "found",
|
|
732
|
+
trackingNumber,
|
|
733
|
+
status: primary.status || "Ordered",
|
|
734
|
+
carrier: primary.carrier,
|
|
735
|
+
latestEvent: primary.latestEvent,
|
|
736
|
+
updatedAt: primary.updatedAt,
|
|
737
|
+
destination: primary.destination,
|
|
738
|
+
orderNumber: data?.order_number || (request.mode === "order" ? request.orderNumber : void 0),
|
|
739
|
+
estimatedDelivery: primary.estimatedDelivery,
|
|
740
|
+
progress: primary.progress,
|
|
741
|
+
events: primary.events,
|
|
742
|
+
orderItems: primary.orderItems,
|
|
743
|
+
ad,
|
|
744
|
+
shipments: shipments.map((shipment) => ({ ...shipment, ad }))
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
function parseRecommendPrice(value) {
|
|
748
|
+
if (!value) return void 0;
|
|
749
|
+
const numeric = Number(value.replace(/[^0-9.]/g, ""));
|
|
750
|
+
if (!Number.isFinite(numeric)) return void 0;
|
|
751
|
+
const amount = Math.round(numeric * 100);
|
|
752
|
+
if (!Number.isInteger(amount)) return void 0;
|
|
753
|
+
return { amount, currencyCode: "USD" };
|
|
754
|
+
}
|
|
755
|
+
function resolveShopifyRecommendHref(onlineStoreUrl, handle) {
|
|
756
|
+
const trimmedUrl = onlineStoreUrl?.trim();
|
|
757
|
+
if (trimmedUrl) {
|
|
758
|
+
if (trimmedUrl.startsWith("/") && typeof window !== "undefined") {
|
|
759
|
+
return new URL(trimmedUrl, window.location.origin).toString();
|
|
760
|
+
}
|
|
761
|
+
return normalizeExternalUrl(trimmedUrl) || void 0;
|
|
762
|
+
}
|
|
763
|
+
const trimmedHandle = handle?.trim();
|
|
764
|
+
if (!trimmedHandle) return void 0;
|
|
765
|
+
const relative = `/products/${trimmedHandle}`;
|
|
766
|
+
if (typeof window !== "undefined") return new URL(relative, window.location.origin).toString();
|
|
767
|
+
return relative;
|
|
768
|
+
}
|
|
769
|
+
function mapShopifyRecommendationsResponse(response) {
|
|
770
|
+
const products = response.data?.products ?? [];
|
|
771
|
+
return products.map((product) => ({
|
|
772
|
+
id: product.id,
|
|
773
|
+
title: product.title,
|
|
774
|
+
description: "",
|
|
775
|
+
imageUrl: product.featuredImage?.url,
|
|
776
|
+
href: resolveShopifyRecommendHref(product.onlineStoreUrl, product.handle),
|
|
777
|
+
price: parseRecommendPrice(product.price || product.variants?.[0]?.price)
|
|
778
|
+
}));
|
|
779
|
+
}
|
|
780
|
+
async function postWithRetry(post, url, body, retries) {
|
|
781
|
+
let lastError;
|
|
782
|
+
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
783
|
+
try {
|
|
784
|
+
return await post(withShopifyTrackCacheBust(url), body);
|
|
785
|
+
} catch (error) {
|
|
786
|
+
lastError = error;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
throw lastError ?? new Error("track query failed");
|
|
790
|
+
}
|
|
791
|
+
function createShopifyTrackQuery(transport) {
|
|
792
|
+
const retries = transport.retries ?? 1;
|
|
793
|
+
return async (request) => {
|
|
794
|
+
const locale = resolveShopifyTrackQueryLocale(transport.locale);
|
|
795
|
+
const payload = buildShopifyTrackQueryPayload(request, locale);
|
|
796
|
+
try {
|
|
797
|
+
const response = await postWithRetry(transport.post, SHOPIFY_TRACK_QUERY_PATH, { ...payload }, retries);
|
|
798
|
+
const mapped = mapShopifyTrackQueryResponse(response, request, locale);
|
|
799
|
+
if (mapped.outcome !== "empty" || !transport.fallbackToEnglish || locale === "EN") return mapped;
|
|
800
|
+
} catch {
|
|
801
|
+
if (!transport.fallbackToEnglish || locale === "EN") return emptyResult();
|
|
802
|
+
}
|
|
803
|
+
try {
|
|
804
|
+
const fallback = await postWithRetry(
|
|
805
|
+
transport.post,
|
|
806
|
+
SHOPIFY_TRACK_QUERY_PATH,
|
|
807
|
+
{ ...buildShopifyTrackQueryPayload(request, "EN") },
|
|
808
|
+
retries
|
|
809
|
+
);
|
|
810
|
+
return mapShopifyTrackQueryResponse(fallback, request, "EN");
|
|
811
|
+
} catch {
|
|
812
|
+
return emptyResult();
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
function createShopifyRecommendationsQuery(post) {
|
|
817
|
+
return async () => {
|
|
818
|
+
try {
|
|
819
|
+
const response = await post(SHOPIFY_RECOMMEND_PATH, { ...buildShopifyRecommendPayload() });
|
|
820
|
+
return mapShopifyRecommendationsResponse(response);
|
|
821
|
+
} catch {
|
|
822
|
+
return [];
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
}
|
|
3
826
|
|
|
4
827
|
// src/track-page-display.tsx
|
|
5
828
|
import { useState } from "react";
|
|
@@ -15,23 +838,10 @@ function text(props, key, fallback = "") {
|
|
|
15
838
|
return typeof props[key] === "string" ? props[key] : fallback;
|
|
16
839
|
}
|
|
17
840
|
function safeHref(value) {
|
|
18
|
-
|
|
19
|
-
if (value.startsWith("/")) return value;
|
|
20
|
-
try {
|
|
21
|
-
const url = new URL(value);
|
|
22
|
-
return url.protocol === "https:" || url.protocol === "http:" ? url.toString() : "#";
|
|
23
|
-
} catch {
|
|
24
|
-
return "#";
|
|
25
|
-
}
|
|
841
|
+
return safeTrackingPageUrl(value);
|
|
26
842
|
}
|
|
27
843
|
function safeImageUrl(value) {
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const url = new URL(value);
|
|
31
|
-
return url.protocol === "https:" || url.protocol === "http:" ? url.toString() : "";
|
|
32
|
-
} catch {
|
|
33
|
-
return "";
|
|
34
|
-
}
|
|
844
|
+
return safeTrackingPageUrl(value);
|
|
35
845
|
}
|
|
36
846
|
function defaultProgress(status) {
|
|
37
847
|
const steps = [
|
|
@@ -136,7 +946,7 @@ function PackageContents({ items }) {
|
|
|
136
946
|
"x",
|
|
137
947
|
item.quantity
|
|
138
948
|
] }),
|
|
139
|
-
item.href ? /* @__PURE__ */ jsx("a", { href: safeHref(item.href), style: { display: "inline-flex", minHeight: 32, alignItems: "center", padding: "6px 16px", border: "1px solid #cbd5e1", borderRadius: 6, color: "#1e293b", fontSize: 13, fontWeight: 500, textDecoration: "none" }, children: "Reorder" }) : null
|
|
949
|
+
safeHref(item.href) ? /* @__PURE__ */ jsx("a", { href: safeHref(item.href), style: { display: "inline-flex", minHeight: 32, alignItems: "center", padding: "6px 16px", border: "1px solid #cbd5e1", borderRadius: 6, color: "#1e293b", fontSize: 13, fontWeight: 500, textDecoration: "none" }, children: "Reorder" }) : null
|
|
140
950
|
] })
|
|
141
951
|
] })
|
|
142
952
|
] }, item.id);
|
|
@@ -147,11 +957,27 @@ function RecommendationCards({ items }) {
|
|
|
147
957
|
/* @__PURE__ */ jsx("div", { style: { width: 262, height: 262, maxWidth: "100%", borderRadius: "var(--pb-radius, 8px)", border: "1px solid #E3E3E3", overflow: "hidden", background: "#f1f5f9" }, children: /* @__PURE__ */ jsx(ProductImage, { src: item.imageUrl, alt: item.title, size: 262 }) }),
|
|
148
958
|
/* @__PURE__ */ jsxs("div", { style: { padding: "12px 8px", textAlign: "center", fontSize: 14 }, children: [
|
|
149
959
|
/* @__PURE__ */ jsx("p", { style: { margin: 0, color: "#334155" }, children: item.title }),
|
|
150
|
-
item.price ? /* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", fontWeight: 600, color: "#0f172a" }, children: item.price }) : null,
|
|
960
|
+
item.price && formatTrackingPageMoney(item.price)?.amount ? /* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", fontWeight: 600, color: "#0f172a" }, children: formatTrackingPageMoney(item.price).amount }) : null,
|
|
151
961
|
item.description ? /* @__PURE__ */ jsx("p", { style: { margin: "4px 0 0", color: "#64748b", fontSize: 13 }, children: item.description }) : null
|
|
152
962
|
] })
|
|
153
963
|
] }, item.id)) });
|
|
154
964
|
}
|
|
965
|
+
function TrackingPageAdSlot({ ad, editor = false }) {
|
|
966
|
+
const [failedUrl, setFailedUrl] = useState();
|
|
967
|
+
const imageUrl = safeImageUrl(ad?.imageUrl);
|
|
968
|
+
if ((!imageUrl || failedUrl === imageUrl) && !editor) return null;
|
|
969
|
+
const content = imageUrl && failedUrl !== imageUrl ? /* @__PURE__ */ jsx("img", { src: imageUrl, alt: ad?.alt ?? "Promotion", loading: "lazy", onError: () => setFailedUrl(imageUrl), style: { display: "block", width: "100%", height: "auto", objectFit: "cover" } }) : /* @__PURE__ */ jsx("div", { "aria-label": "Advertisement placeholder", style: { display: "grid", minHeight: 120, placeItems: "center", border: "1px dashed #cbd5e1", background: "#f8fafc", color: "#64748b", fontSize: 13 }, children: "Advertisement space" });
|
|
970
|
+
const href = safeHref(ad?.href);
|
|
971
|
+
if (!imageUrl || !href) return /* @__PURE__ */ jsx("div", { "data-tracking-page-ad": true, children: content });
|
|
972
|
+
return /* @__PURE__ */ jsx("a", { "data-tracking-page-ad": true, href, target: "_blank", rel: "noopener noreferrer", children: content });
|
|
973
|
+
}
|
|
974
|
+
function EstimatedDeliveryCard({ dateText }) {
|
|
975
|
+
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: [
|
|
976
|
+
/* @__PURE__ */ jsx("p", { style: { margin: 0, color: "#202124", fontSize: 13, fontWeight: 700, lineHeight: 1.3 }, children: "Est. Delivery" }),
|
|
977
|
+
/* @__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 }),
|
|
978
|
+
/* @__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." })
|
|
979
|
+
] });
|
|
980
|
+
}
|
|
155
981
|
function SectionShell({ title, children, bordered = true }) {
|
|
156
982
|
return /* @__PURE__ */ jsx("section", { "aria-label": title, style: { ...pageFont, background: "var(--pb-color-background, #fff)", color: "var(--pb-color-text, #0f172a)", borderBottom: bordered ? "1px solid #f1f5f9" : "0" }, children });
|
|
157
983
|
}
|
|
@@ -162,11 +988,28 @@ function SkeletonRow() {
|
|
|
162
988
|
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]) });
|
|
163
989
|
}
|
|
164
990
|
|
|
991
|
+
// src/shopify-track-page/assets/not-found.png.ts
|
|
992
|
+
var not_found_png_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAAHECAYAAACnX1ofAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxj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BC2lAgErIOoEmurq4uzszMLEpLSD5fWubWqgnLZWkJOwi6b+lnTL0lhJCeUCASMiBGqwSL4YV1u6WdAjIvbX+lfd+NY+GF40sQaLruuLQ1vmxJoUcIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQsh08P8D6wH8vd+UWaQAAAAASUVORK5CYII=";
|
|
993
|
+
|
|
994
|
+
// src/tracking-not-found.tsx
|
|
995
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
996
|
+
function TrackingNotFound() {
|
|
997
|
+
return /* @__PURE__ */ jsxs2("section", { "aria-label": "Order not found", role: "status", style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: "80px 24px", gap: 16 }, children: [
|
|
998
|
+
/* @__PURE__ */ jsx2("img", { src: not_found_png_default, alt: "", width: 180, height: 180, style: { width: 180, height: 180, objectFit: "contain" } }),
|
|
999
|
+
/* @__PURE__ */ jsx2("p", { style: { margin: 0, fontSize: 16, fontWeight: 500, color: "#475569" }, children: "Can not find order" })
|
|
1000
|
+
] });
|
|
1001
|
+
}
|
|
1002
|
+
|
|
165
1003
|
// src/ready-to-go.tsx
|
|
166
|
-
import { Fragment, jsx as
|
|
167
|
-
var initialRuntime = {
|
|
168
|
-
|
|
169
|
-
|
|
1004
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1005
|
+
var initialRuntime = {
|
|
1006
|
+
phase: "idle",
|
|
1007
|
+
recommendations: { phase: "idle", items: [] },
|
|
1008
|
+
autoQueryFromUrl: false,
|
|
1009
|
+
async query() {
|
|
1010
|
+
return void 0;
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
170
1013
|
var ReadyToGoRuntimeContext = createContext(initialRuntime);
|
|
171
1014
|
function previewReadyToGoTracking(trackingNumber = "BT-2048-DEMO") {
|
|
172
1015
|
return {
|
|
@@ -175,7 +1018,7 @@ function previewReadyToGoTracking(trackingNumber = "BT-2048-DEMO") {
|
|
|
175
1018
|
carrier: "BestTrack demo carrier",
|
|
176
1019
|
latestEvent: "Shipment accepted at the regional hub",
|
|
177
1020
|
updatedAt: "Sep 17, 10:00 AM",
|
|
178
|
-
|
|
1021
|
+
destination: "Shanghai",
|
|
179
1022
|
estimatedDelivery: "Sep 22 - Sep 24",
|
|
180
1023
|
progress: defaultProgress("In transit"),
|
|
181
1024
|
events: [
|
|
@@ -184,30 +1027,72 @@ function previewReadyToGoTracking(trackingNumber = "BT-2048-DEMO") {
|
|
|
184
1027
|
],
|
|
185
1028
|
orderItems: [{ id: "demo-order-item", title: "Demo shipment item", quantity: 1, description: "Product details are available in your order." }],
|
|
186
1029
|
recommendations: [
|
|
187
|
-
{ id: "shipping-protection", title: "Shipping protection", description: "Extra assurance for your next delivery.", price: "
|
|
188
|
-
{ id: "delivery-alerts", title: "Delivery alerts", description: "Receive an update at every milestone.", price: "
|
|
1030
|
+
{ id: "shipping-protection", title: "Shipping protection", description: "Extra assurance for your next delivery.", price: { amount: 900, currencyCode: "USD" } },
|
|
1031
|
+
{ id: "delivery-alerts", title: "Delivery alerts", description: "Receive an update at every milestone.", price: { amount: 400, currencyCode: "USD" } }
|
|
189
1032
|
]
|
|
190
1033
|
};
|
|
191
1034
|
}
|
|
192
|
-
async function queryMockReadyToGoTracking(
|
|
193
|
-
return previewReadyToGoTracking(trackingNumber);
|
|
1035
|
+
async function queryMockReadyToGoTracking(request) {
|
|
1036
|
+
return previewReadyToGoTracking(request.mode === "tracking" ? request.trackingNumber : request.orderNumber);
|
|
194
1037
|
}
|
|
195
|
-
function ReadyToGoRuntimeProvider({ children,
|
|
1038
|
+
function ReadyToGoRuntimeProvider({ children, query: injectedQuery, queryRecommendations, transport, autoQueryFromUrl, watermark }) {
|
|
196
1039
|
const [state, setState] = useState2({ phase: "idle" });
|
|
197
|
-
const
|
|
1040
|
+
const [recommendations, setRecommendations] = useState2(() => ({
|
|
1041
|
+
phase: queryRecommendations || transport && !injectedQuery ? "loading" : "idle",
|
|
1042
|
+
items: []
|
|
1043
|
+
}));
|
|
1044
|
+
const requestId = useRef(0);
|
|
1045
|
+
const resolvedQuery = useMemo(() => {
|
|
1046
|
+
if (injectedQuery) return injectedQuery;
|
|
1047
|
+
if (transport) return createShopifyTrackQuery(transport);
|
|
1048
|
+
return void 0;
|
|
1049
|
+
}, [injectedQuery, transport]);
|
|
1050
|
+
const resolvedRecommendations = useMemo(() => {
|
|
1051
|
+
if (queryRecommendations) return queryRecommendations;
|
|
1052
|
+
if (transport && !injectedQuery) return createShopifyRecommendationsQuery(transport.post);
|
|
1053
|
+
return void 0;
|
|
1054
|
+
}, [injectedQuery, queryRecommendations, transport]);
|
|
1055
|
+
const live = Boolean(resolvedQuery);
|
|
1056
|
+
useEffect(() => {
|
|
1057
|
+
if (!resolvedRecommendations) return;
|
|
1058
|
+
let active = true;
|
|
1059
|
+
void resolvedRecommendations().then((items) => {
|
|
1060
|
+
if (!active) return;
|
|
1061
|
+
setRecommendations({ phase: items.length ? "success" : "empty", items });
|
|
1062
|
+
}).catch(() => {
|
|
1063
|
+
if (!active) return;
|
|
1064
|
+
setRecommendations({ phase: "error", items: [] });
|
|
1065
|
+
});
|
|
1066
|
+
return () => {
|
|
1067
|
+
active = false;
|
|
1068
|
+
};
|
|
1069
|
+
}, [resolvedRecommendations]);
|
|
1070
|
+
const query = useCallback(async (request) => {
|
|
1071
|
+
const currentRequestId = ++requestId.current;
|
|
198
1072
|
setState({ phase: "loading" });
|
|
199
1073
|
try {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
setState({ phase:
|
|
1074
|
+
const result = live ? await resolvedQuery(request) : await queryMockReadyToGoTracking(request);
|
|
1075
|
+
if (currentRequestId !== requestId.current) return;
|
|
1076
|
+
setState({ phase: isEmptyTrackingPageResult(result) ? "empty" : "success", result });
|
|
1077
|
+
} catch {
|
|
1078
|
+
if (currentRequestId !== requestId.current) return;
|
|
1079
|
+
setState({ phase: "error", error: "We couldn\u2019t retrieve this order right now. Please try again later." });
|
|
203
1080
|
}
|
|
204
|
-
}, [
|
|
205
|
-
const
|
|
206
|
-
|
|
1081
|
+
}, [live, resolvedQuery]);
|
|
1082
|
+
const resolveAutoQuery = autoQueryFromUrl ?? Boolean(transport && !injectedQuery);
|
|
1083
|
+
const resolvedWatermark = useMemo(
|
|
1084
|
+
() => watermark ?? { visible: !shouldHidePoweredBy() },
|
|
1085
|
+
[watermark]
|
|
1086
|
+
);
|
|
1087
|
+
const value = useMemo(() => ({ ...state, query, recommendations, autoQueryFromUrl: resolveAutoQuery, watermark: resolvedWatermark }), [query, recommendations, resolveAutoQuery, resolvedWatermark, state]);
|
|
1088
|
+
return /* @__PURE__ */ jsx3(ReadyToGoRuntimeContext.Provider, { value, children });
|
|
207
1089
|
}
|
|
208
1090
|
function useReadyToGoRuntime() {
|
|
209
1091
|
return useContext(ReadyToGoRuntimeContext);
|
|
210
1092
|
}
|
|
1093
|
+
function RuntimeWatermark({ watermark }) {
|
|
1094
|
+
return watermark?.visible ? /* @__PURE__ */ jsx3("small", { style: { display: "block", marginTop: "auto", paddingTop: 28, textAlign: "center", fontSize: 12, lineHeight: "17px", fontStyle: "italic", color: "#b8b8b8" }, children: watermark.label || "Powered by BestTrack" }) : null;
|
|
1095
|
+
}
|
|
211
1096
|
var heroStyle = {
|
|
212
1097
|
...pageFont,
|
|
213
1098
|
position: "relative",
|
|
@@ -219,6 +1104,15 @@ var heroStyle = {
|
|
|
219
1104
|
padding: "48px 24px",
|
|
220
1105
|
boxSizing: "border-box"
|
|
221
1106
|
};
|
|
1107
|
+
var editorHeroStyle = {
|
|
1108
|
+
...pageFont,
|
|
1109
|
+
position: "relative",
|
|
1110
|
+
display: "grid",
|
|
1111
|
+
placeItems: "center",
|
|
1112
|
+
backgroundColor: "#fff",
|
|
1113
|
+
padding: "48px 24px",
|
|
1114
|
+
boxSizing: "border-box"
|
|
1115
|
+
};
|
|
222
1116
|
var formCardStyle = {
|
|
223
1117
|
display: "flex",
|
|
224
1118
|
flexDirection: "column",
|
|
@@ -232,6 +1126,7 @@ var formCardStyle = {
|
|
|
232
1126
|
boxSizing: "border-box",
|
|
233
1127
|
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.12)"
|
|
234
1128
|
};
|
|
1129
|
+
var editorFormCardStyle = { ...formCardStyle, minHeight: 0 };
|
|
235
1130
|
var tabStyle = (active) => ({
|
|
236
1131
|
appearance: "none",
|
|
237
1132
|
flex: 1,
|
|
@@ -263,12 +1158,12 @@ var inputStyle = {
|
|
|
263
1158
|
boxSizing: "border-box"
|
|
264
1159
|
};
|
|
265
1160
|
function ReadyToGoTextField({ value, onChange }) {
|
|
266
|
-
return /* @__PURE__ */
|
|
1161
|
+
return /* @__PURE__ */ jsx3("input", { "aria-label": "Ready-to-go text", value: typeof value === "string" ? value : "", onChange: (event) => onChange(event.target.value) });
|
|
267
1162
|
}
|
|
268
1163
|
function InlineText({ block, name, fallback }) {
|
|
269
1164
|
const value = text(block, name, fallback);
|
|
270
|
-
if (!block.selected) return /* @__PURE__ */
|
|
271
|
-
return /* @__PURE__ */
|
|
1165
|
+
if (!block.selected) return /* @__PURE__ */ jsx3("span", { "data-ready-to-go-editor-field": name, children: value });
|
|
1166
|
+
return /* @__PURE__ */ jsx3(
|
|
272
1167
|
"input",
|
|
273
1168
|
{
|
|
274
1169
|
"aria-label": "Canvas " + name,
|
|
@@ -277,7 +1172,23 @@ function InlineText({ block, name, fallback }) {
|
|
|
277
1172
|
onMouseDown: (event) => event.stopPropagation(),
|
|
278
1173
|
onClick: (event) => event.stopPropagation(),
|
|
279
1174
|
onChange: (event) => block.onPropsChange({ [name]: event.currentTarget.value }),
|
|
280
|
-
style: {
|
|
1175
|
+
style: {
|
|
1176
|
+
display: "inline-block",
|
|
1177
|
+
width: "100%",
|
|
1178
|
+
minWidth: "5ch",
|
|
1179
|
+
boxSizing: "border-box",
|
|
1180
|
+
/* border: "1px dashed currentColor", */
|
|
1181
|
+
border: "none",
|
|
1182
|
+
borderRadius: 3,
|
|
1183
|
+
padding: "2px 5px",
|
|
1184
|
+
background: "transparent",
|
|
1185
|
+
color: "inherit",
|
|
1186
|
+
font: "inherit",
|
|
1187
|
+
fontWeight: "inherit",
|
|
1188
|
+
lineHeight: "inherit",
|
|
1189
|
+
letterSpacing: "inherit",
|
|
1190
|
+
textAlign: "inherit"
|
|
1191
|
+
}
|
|
281
1192
|
}
|
|
282
1193
|
);
|
|
283
1194
|
}
|
|
@@ -288,47 +1199,45 @@ function eventsFrom(result) {
|
|
|
288
1199
|
}
|
|
289
1200
|
function ProgressResult({ result, showEstimatedDelivery = true }) {
|
|
290
1201
|
const steps = result.progress?.length ? result.progress : defaultProgress(result.status);
|
|
291
|
-
return /* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
1202
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1203
|
+
/* @__PURE__ */ jsxs3("p", { style: { margin: 0, fontSize: 20, lineHeight: 1.4, color: "#000" }, children: [
|
|
293
1204
|
"Tracking: ",
|
|
294
1205
|
result.trackingNumber
|
|
295
1206
|
] }),
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
showEstimatedDelivery && result.estimatedDelivery ? /* @__PURE__ */
|
|
298
|
-
|
|
299
|
-
/* @__PURE__ */ jsx2("p", { style: { margin: "6px 0 0", fontSize: 22, fontWeight: 700, color: "#202124" }, children: result.estimatedDelivery })
|
|
300
|
-
] }) : null,
|
|
301
|
-
/* @__PURE__ */ jsx2(TrackingProgress, { steps })
|
|
1207
|
+
/* @__PURE__ */ jsx3("h2", { style: { margin: "48px 0 0", fontSize: 32, lineHeight: "40px", fontWeight: 700, color: "#303030" }, children: result.status }),
|
|
1208
|
+
showEstimatedDelivery && result.estimatedDelivery ? /* @__PURE__ */ jsx3(EstimatedDeliveryCard, { dateText: result.estimatedDelivery }) : null,
|
|
1209
|
+
/* @__PURE__ */ jsx3(TrackingProgress, { steps })
|
|
302
1210
|
] });
|
|
303
1211
|
}
|
|
304
|
-
function DeliveryResult({ heading, contentsHeading, carrierHeading, result }) {
|
|
305
|
-
return /* @__PURE__ */
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
1212
|
+
function DeliveryResult({ heading, contentsHeading, carrierHeading, result, editor = false }) {
|
|
1213
|
+
return /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth, display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 280px), 500px))", gap: 40, justifyContent: "center", alignItems: "start" }, children: [
|
|
1214
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1215
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: 0, fontSize: 20, lineHeight: "20px", fontWeight: 700 }, children: heading }),
|
|
1216
|
+
/* @__PURE__ */ jsx3(ShippingTimeline, { events: eventsFrom(result) })
|
|
309
1217
|
] }),
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
|
|
313
|
-
/* @__PURE__ */
|
|
1218
|
+
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: 24 }, children: [
|
|
1219
|
+
/* @__PURE__ */ jsx3(TrackingPageAdSlot, { ad: result.ad, editor }),
|
|
1220
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1221
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: "0 0 12px", fontSize: 18, fontWeight: 700 }, children: contentsHeading }),
|
|
1222
|
+
/* @__PURE__ */ jsx3(PackageContents, { items: result.orderItems ?? [] })
|
|
314
1223
|
] }),
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
318
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1225
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: "0 0 12px", fontSize: 18, fontWeight: 700 }, children: carrierHeading }),
|
|
1226
|
+
/* @__PURE__ */ jsx3("p", { style: { margin: 0, fontSize: 14, fontWeight: 600, color: "#1e293b" }, children: result.carrier ?? "Not available" }),
|
|
1227
|
+
/* @__PURE__ */ jsx3("p", { style: { margin: "8px 0 0", fontSize: 14, color: "#64748b" }, children: result.destination ?? "Destination details are not available." })
|
|
319
1228
|
] })
|
|
320
1229
|
] })
|
|
321
1230
|
] });
|
|
322
1231
|
}
|
|
323
1232
|
function ReadyToGoQueryEditor(block) {
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
1233
|
+
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: [
|
|
1234
|
+
/* @__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" }) }),
|
|
1235
|
+
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", width: "100%", borderBottom: "1px solid #cbd5e1" }, children: [
|
|
1236
|
+
/* @__PURE__ */ jsx3("div", { style: { ...tabStyle(true), display: "flex", alignItems: "center", justifyContent: "center", cursor: "default" }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "trackingTabLabel", fallback: "Tracking Number" }) }),
|
|
1237
|
+
/* @__PURE__ */ jsx3("div", { style: { ...tabStyle(false), display: "flex", alignItems: "center", justifyContent: "center", cursor: "default" }, children: /* @__PURE__ */ jsx3(InlineText, { block, name: "orderTabLabel", fallback: "Order Number" }) })
|
|
329
1238
|
] }),
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
/* @__PURE__ */
|
|
1239
|
+
/* @__PURE__ */ jsxs3("div", { style: { marginTop: 24, display: "flex", flexDirection: "column", gap: 16, flex: 1 }, children: [
|
|
1240
|
+
/* @__PURE__ */ jsx3(
|
|
332
1241
|
"input",
|
|
333
1242
|
{
|
|
334
1243
|
"aria-label": "Canvas default tracking number",
|
|
@@ -337,135 +1246,178 @@ function ReadyToGoQueryEditor(block) {
|
|
|
337
1246
|
onMouseDown: (event) => block.selected && event.stopPropagation(),
|
|
338
1247
|
onClick: (event) => block.selected && event.stopPropagation(),
|
|
339
1248
|
onChange: (event) => block.onPropsChange({ defaultTrackingNumber: event.currentTarget.value }),
|
|
340
|
-
style: {
|
|
1249
|
+
style: {
|
|
1250
|
+
...inputStyle
|
|
1251
|
+
/* , border: block.selected ? "1px dashed #111" : inputStyle.border */
|
|
1252
|
+
}
|
|
341
1253
|
}
|
|
342
1254
|
),
|
|
343
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__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" }) })
|
|
344
1256
|
] }),
|
|
345
|
-
/* @__PURE__ */
|
|
1257
|
+
/* @__PURE__ */ jsx3("p", { style: { marginTop: "auto", paddingTop: 28, textAlign: "center", fontSize: 12, lineHeight: "17px", fontStyle: "italic", color: "#b8b8b8" }, children: "Powered by BestTrack" })
|
|
346
1258
|
] }) });
|
|
347
1259
|
}
|
|
348
|
-
function ReadyToGoProgressEditor(
|
|
349
|
-
return /* @__PURE__ */
|
|
1260
|
+
function ReadyToGoProgressEditor() {
|
|
1261
|
+
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() }) }) });
|
|
350
1262
|
}
|
|
351
1263
|
function ReadyToGoDeliveryEditor(block) {
|
|
352
|
-
return /* @__PURE__ */
|
|
1264
|
+
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(
|
|
353
1265
|
DeliveryResult,
|
|
354
1266
|
{
|
|
355
|
-
heading: /* @__PURE__ */
|
|
356
|
-
contentsHeading: /* @__PURE__ */
|
|
357
|
-
carrierHeading: /* @__PURE__ */
|
|
358
|
-
result: previewReadyToGoTracking()
|
|
1267
|
+
heading: /* @__PURE__ */ jsx3(InlineText, { block, name: "heading", fallback: "Shipping Details" }),
|
|
1268
|
+
contentsHeading: /* @__PURE__ */ jsx3(InlineText, { block, name: "contentsHeading", fallback: "Package Contents" }),
|
|
1269
|
+
carrierHeading: /* @__PURE__ */ jsx3(InlineText, { block, name: "carrierHeading", fallback: "Carrier" }),
|
|
1270
|
+
result: previewReadyToGoTracking(),
|
|
1271
|
+
editor: true
|
|
359
1272
|
}
|
|
360
1273
|
) });
|
|
361
1274
|
}
|
|
362
1275
|
function ReadyToGoRecommendationsEditor(block) {
|
|
363
1276
|
const preview = previewReadyToGoTracking();
|
|
364
|
-
return /* @__PURE__ */
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
1277
|
+
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: [
|
|
1278
|
+
/* @__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..." }) }),
|
|
1279
|
+
/* @__PURE__ */ jsx3("div", { style: { marginTop: 24 }, children: /* @__PURE__ */ jsx3(RecommendationCards, { items: preview.recommendations ?? [] }) })
|
|
367
1280
|
] }) });
|
|
368
1281
|
}
|
|
369
1282
|
function ReadyToGoQueryBlock(props) {
|
|
370
1283
|
const runtime = useReadyToGoRuntime();
|
|
371
|
-
const [
|
|
372
|
-
const [
|
|
373
|
-
const [
|
|
374
|
-
const [
|
|
1284
|
+
const [locationState] = useState2(() => runtime.autoQueryFromUrl ? readTrackingQueryLocationState() : void 0);
|
|
1285
|
+
const [mode, setMode] = useState2(locationState?.tab ?? (text(props, "defaultQueryMode", "tracking") === "order" ? "order" : "tracking"));
|
|
1286
|
+
const [trackingNumber, setTrackingNumber] = useState2(locationState?.trackingNumber || text(props, "defaultTrackingNumber", "BT-2048-DEMO"));
|
|
1287
|
+
const [orderNumber, setOrderNumber] = useState2(locationState?.orderNumber || text(props, "defaultOrderNumber", ""));
|
|
1288
|
+
const [email, setEmail] = useState2(locationState?.email ?? "");
|
|
375
1289
|
const [localError, setLocalError] = useState2("");
|
|
1290
|
+
const autoQueryStarted = useRef(false);
|
|
376
1291
|
const heading = text(props, "heading");
|
|
377
1292
|
const submitLabel = text(props, "submitLabel", "Track Your Order");
|
|
378
1293
|
const trackingTabLabel = text(props, "trackingTabLabel", "Tracking Number");
|
|
379
1294
|
const orderTabLabel = text(props, "orderTabLabel", "Order Number");
|
|
1295
|
+
useEffect(() => {
|
|
1296
|
+
if (!locationState?.canAutoQuery || autoQueryStarted.current) return;
|
|
1297
|
+
autoQueryStarted.current = true;
|
|
1298
|
+
void runtime.query(locationState.tab === "tracking" ? { mode: "tracking", trackingNumber: locationState.trackingNumber } : { mode: "order", orderNumber: locationState.orderNumber, email: locationState.email });
|
|
1299
|
+
}, [locationState, runtime]);
|
|
380
1300
|
const submit = (event) => {
|
|
381
1301
|
event.preventDefault();
|
|
382
1302
|
setLocalError("");
|
|
383
1303
|
if (mode === "order") {
|
|
384
1304
|
if (!orderNumber.trim() || !email.trim()) {
|
|
385
|
-
setLocalError("
|
|
1305
|
+
setLocalError("Please enter your order number and email address");
|
|
386
1306
|
return;
|
|
387
1307
|
}
|
|
388
|
-
|
|
1308
|
+
syncTrackingQueryToUrl("order", orderNumber.trim(), email.trim());
|
|
1309
|
+
void runtime.query({ mode: "order", orderNumber: orderNumber.trim(), email: email.trim() });
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
if (!trackingNumber.trim()) {
|
|
1313
|
+
setLocalError("Please enter your tracking number");
|
|
389
1314
|
return;
|
|
390
1315
|
}
|
|
391
|
-
|
|
1316
|
+
syncTrackingQueryToUrl("tracking", trackingNumber.trim());
|
|
1317
|
+
void runtime.query({ mode: "tracking", trackingNumber: trackingNumber.trim() });
|
|
392
1318
|
};
|
|
393
1319
|
const loading = runtime.phase === "loading";
|
|
394
|
-
return /* @__PURE__ */
|
|
395
|
-
heading ? /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
1320
|
+
return /* @__PURE__ */ jsx3("section", { style: heroStyle, children: /* @__PURE__ */ jsxs3("div", { role: "region", "aria-label": "Ready-to-go tracking query", style: formCardStyle, children: [
|
|
1321
|
+
heading ? /* @__PURE__ */ jsx3("h1", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 28, lineHeight: 1.15 }, children: heading }) : null,
|
|
1322
|
+
/* @__PURE__ */ jsxs3("div", { role: "tablist", "aria-label": "Tracking method", style: { display: "flex", width: "100%", borderBottom: "1px solid #cbd5e1" }, children: [
|
|
1323
|
+
/* @__PURE__ */ jsx3("button", { type: "button", role: "tab", "aria-selected": mode === "tracking", onClick: () => {
|
|
398
1324
|
setMode("tracking");
|
|
399
1325
|
setLocalError("");
|
|
400
1326
|
}, style: tabStyle(mode === "tracking"), children: trackingTabLabel }),
|
|
401
|
-
/* @__PURE__ */
|
|
1327
|
+
/* @__PURE__ */ jsx3("button", { type: "button", role: "tab", "aria-selected": mode === "order", onClick: () => {
|
|
402
1328
|
setMode("order");
|
|
403
1329
|
setLocalError("");
|
|
404
1330
|
}, style: tabStyle(mode === "order"), children: orderTabLabel })
|
|
405
1331
|
] }),
|
|
406
|
-
/* @__PURE__ */
|
|
407
|
-
mode === "order" ? /* @__PURE__ */
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
/* @__PURE__ */
|
|
411
|
-
/* @__PURE__ */
|
|
412
|
-
] }) : /* @__PURE__ */
|
|
413
|
-
/* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ jsxs3("form", { onSubmit: submit, style: { marginTop: 24, display: "flex", flexDirection: "column", gap: 16, flex: 1 }, children: [
|
|
1333
|
+
mode === "order" ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1334
|
+
/* @__PURE__ */ jsx3("label", { htmlFor: "ready-to-go-order-number", style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clipPath: "inset(50%)" }, children: "Order number" }),
|
|
1335
|
+
/* @__PURE__ */ jsx3("input", { id: "ready-to-go-order-number", "aria-label": "Order number", value: orderNumber, onChange: (event) => setOrderNumber(event.target.value), placeholder: "Order Number", style: inputStyle }),
|
|
1336
|
+
/* @__PURE__ */ jsx3("label", { htmlFor: "ready-to-go-email", style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clipPath: "inset(50%)" }, children: "Email" }),
|
|
1337
|
+
/* @__PURE__ */ jsx3("input", { id: "ready-to-go-email", "aria-label": "Email", value: email, onChange: (event) => setEmail(event.target.value), placeholder: "Email", style: inputStyle })
|
|
1338
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1339
|
+
/* @__PURE__ */ jsx3("label", { htmlFor: "ready-to-go-tracking-number", style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clipPath: "inset(50%)" }, children: "Tracking number" }),
|
|
1340
|
+
/* @__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 })
|
|
415
1341
|
] }),
|
|
416
|
-
localError ? /* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
runtime.phase === "error" ? /* @__PURE__ */
|
|
1342
|
+
localError ? /* @__PURE__ */ jsx3("p", { style: { margin: 0, textAlign: "center", fontSize: 12, color: "#f43f5e" }, children: localError }) : null,
|
|
1343
|
+
/* @__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 }),
|
|
1344
|
+
runtime.phase === "error" ? /* @__PURE__ */ jsx3("p", { role: "alert", style: { margin: 0, textAlign: "center", fontSize: 12, color: "#f43f5e" }, children: runtime.error }) : null
|
|
419
1345
|
] }),
|
|
420
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ jsx3(RuntimeWatermark, { watermark: runtime.watermark })
|
|
421
1347
|
] }) });
|
|
422
1348
|
}
|
|
423
1349
|
function ReadyToGoProgressBlock() {
|
|
424
1350
|
const runtime = useReadyToGoRuntime();
|
|
425
1351
|
const result = runtime.result;
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
1352
|
+
if (runtime.phase === "idle") return null;
|
|
1353
|
+
if (runtime.phase === "empty") return /* @__PURE__ */ jsx3(TrackingNotFound, {});
|
|
1354
|
+
return /* @__PURE__ */ jsx3(SectionShell, { title: "Shipment progress", children: /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth, textAlign: "center", width: "min(1248px, 100%)" }, children: [
|
|
1355
|
+
runtime.phase === "loading" ? /* @__PURE__ */ jsxs3("div", { "aria-label": "Loading shipment progress", children: [
|
|
1356
|
+
/* @__PURE__ */ jsx3(IdleMessage, { children: "Loading shipment progress\u2026" }),
|
|
1357
|
+
/* @__PURE__ */ jsx3(SkeletonRow, {})
|
|
430
1358
|
] }) : null,
|
|
431
|
-
runtime.phase === "error" ? /* @__PURE__ */
|
|
432
|
-
runtime.phase === "
|
|
433
|
-
runtime.phase === "success" && result ? /* @__PURE__ */ jsx2(ProgressResult, { result }) : null
|
|
1359
|
+
runtime.phase === "error" ? /* @__PURE__ */ jsx3("p", { style: { margin: 0, color: "#b42318" }, children: "Shipment progress is temporarily unavailable." }) : null,
|
|
1360
|
+
runtime.phase === "success" && result ? /* @__PURE__ */ jsx3(ProgressResult, { result }) : null
|
|
434
1361
|
] }) });
|
|
435
1362
|
}
|
|
436
1363
|
function ReadyToGoDeliveryBlock(props) {
|
|
437
1364
|
const runtime = useReadyToGoRuntime();
|
|
1365
|
+
if (runtime.phase === "idle" || runtime.phase === "empty") return null;
|
|
438
1366
|
const heading = text(props, "heading", "Shipping Details");
|
|
439
1367
|
const contentsHeading = text(props, "contentsHeading", "Package Contents");
|
|
440
1368
|
const carrierHeading = text(props, "carrierHeading", "Carrier");
|
|
441
1369
|
const result = runtime.result;
|
|
442
|
-
return /* @__PURE__ */
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
runtime.phase === "loading" ? /* @__PURE__ */
|
|
445
|
-
runtime.phase === "error" ? /* @__PURE__ */
|
|
446
|
-
runtime.phase === "idle" ? /* @__PURE__ */ jsx2("p", { style: { margin: "16px 0 0", color: "#64748b" }, children: "Delivery details will appear after a successful query." }) : null
|
|
1370
|
+
return /* @__PURE__ */ jsx3(SectionShell, { title: heading, children: runtime.phase === "success" && result ? /* @__PURE__ */ jsx3(DeliveryResult, { heading, contentsHeading, carrierHeading, result }) : /* @__PURE__ */ jsx3("div", { style: { ...contentWidth, display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 280px), 500px))", gap: 40, justifyContent: "center", alignItems: "start" }, children: /* @__PURE__ */ jsxs3("div", { children: [
|
|
1371
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: 0, fontSize: 20, lineHeight: "20px", fontWeight: 700 }, children: heading }),
|
|
1372
|
+
runtime.phase === "loading" ? /* @__PURE__ */ jsx3(IdleMessage, { children: "Loading delivery details\u2026" }) : null,
|
|
1373
|
+
runtime.phase === "error" ? /* @__PURE__ */ jsx3("p", { style: { margin: "16px 0 0", color: "#b42318" }, children: "Delivery details are temporarily unavailable." }) : null
|
|
447
1374
|
] }) }) });
|
|
448
1375
|
}
|
|
449
1376
|
function ReadyToGoRecommendationsBlock(props) {
|
|
450
1377
|
const runtime = useReadyToGoRuntime();
|
|
451
1378
|
const heading = text(props, "heading", "You may also like...");
|
|
1379
|
+
const independent = runtime.recommendations.phase !== "idle";
|
|
1380
|
+
if (independent) {
|
|
1381
|
+
if (runtime.recommendations.phase !== "success" || runtime.recommendations.items.length === 0) return null;
|
|
1382
|
+
return /* @__PURE__ */ jsx3(SectionShell, { title: heading, bordered: false, children: /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth, padding: "48px 24px" }, children: [
|
|
1383
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: 0, textAlign: "center", fontSize: 20, lineHeight: "20px", fontWeight: 700 }, children: heading }),
|
|
1384
|
+
/* @__PURE__ */ jsx3("div", { style: { marginTop: 24 }, children: /* @__PURE__ */ jsx3(RecommendationCards, { items: runtime.recommendations.items }) })
|
|
1385
|
+
] }) });
|
|
1386
|
+
}
|
|
1387
|
+
if (runtime.phase === "empty") return null;
|
|
452
1388
|
const recommendations = runtime.result?.recommendations ?? [];
|
|
453
|
-
return /* @__PURE__ */
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
runtime.phase === "loading" ? /* @__PURE__ */
|
|
457
|
-
runtime.phase === "error" ? /* @__PURE__ */
|
|
458
|
-
runtime.phase === "idle" ? /* @__PURE__ */
|
|
459
|
-
runtime.phase === "success" && recommendations.length ? /* @__PURE__ */
|
|
460
|
-
runtime.phase === "success" && !recommendations.length ? /* @__PURE__ */
|
|
1389
|
+
return /* @__PURE__ */ jsx3(SectionShell, { title: heading, bordered: false, children: /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth, padding: "48px 24px" }, children: [
|
|
1390
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: 0, textAlign: "center", fontSize: 20, lineHeight: "20px", fontWeight: 700 }, children: heading }),
|
|
1391
|
+
/* @__PURE__ */ jsxs3("div", { style: { marginTop: 24 }, children: [
|
|
1392
|
+
runtime.phase === "loading" ? /* @__PURE__ */ jsx3(IdleMessage, { children: "Loading recommendations\u2026" }) : null,
|
|
1393
|
+
runtime.phase === "error" ? /* @__PURE__ */ jsx3("p", { style: { margin: 0, textAlign: "center", color: "#b42318" }, children: "Recommendations are temporarily unavailable." }) : null,
|
|
1394
|
+
runtime.phase === "idle" ? /* @__PURE__ */ jsx3(IdleMessage, { children: "Recommendations appear with your shipment result." }) : null,
|
|
1395
|
+
runtime.phase === "success" && recommendations.length ? /* @__PURE__ */ jsx3(RecommendationCards, { items: recommendations }) : null,
|
|
1396
|
+
runtime.phase === "success" && !recommendations.length ? /* @__PURE__ */ jsx3(IdleMessage, { children: "No recommendations are available for this shipment." }) : null
|
|
461
1397
|
] })
|
|
462
1398
|
] }) });
|
|
463
1399
|
}
|
|
464
1400
|
|
|
465
1401
|
// src/ready-to-go-definition.ts
|
|
466
1402
|
import { createPageDocument } from "@standhigher/puck-page-builder/runtime";
|
|
1403
|
+
|
|
1404
|
+
// src/template-policy.ts
|
|
1405
|
+
function defineTemplatePolicy(templateId, displayName, defaultBlockOrder, lockedBlockTypes) {
|
|
1406
|
+
return Object.freeze({
|
|
1407
|
+
templateId,
|
|
1408
|
+
displayName,
|
|
1409
|
+
defaultBlockOrder: Object.freeze([...defaultBlockOrder]),
|
|
1410
|
+
blocks: Object.freeze(defaultBlockOrder.map((blockType) => Object.freeze({ blockType, singleton: true, deletable: !lockedBlockTypes.includes(blockType) }))),
|
|
1411
|
+
enforcement: "core-block-policy"
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// src/ready-to-go-definition.ts
|
|
467
1416
|
var text2 = (label, options = {}) => ({ field: "besttrack.ready-to-go.text", label, control: "text", ...options });
|
|
468
|
-
|
|
1417
|
+
function withTemplatePolicy(blocks, protectedBlocks) {
|
|
1418
|
+
return blocks.map((block) => ({ ...block, policy: { singleton: true, ...protectedBlocks.includes(block.type) ? { required: true, allowDelete: false } : {} } }));
|
|
1419
|
+
}
|
|
1420
|
+
var readyToGoBlocks = withTemplatePolicy([
|
|
469
1421
|
{
|
|
470
1422
|
type: "besttrack.ready-to-go.query",
|
|
471
1423
|
version: 1,
|
|
@@ -476,6 +1428,7 @@ var readyToGoBlocks = [
|
|
|
476
1428
|
heading: "Track your order",
|
|
477
1429
|
submitLabel: "Track Your Order",
|
|
478
1430
|
defaultTrackingNumber: "BT-2048-DEMO",
|
|
1431
|
+
defaultOrderNumber: "",
|
|
479
1432
|
defaultQueryMode: "tracking",
|
|
480
1433
|
trackingTabLabel: "Tracking Number",
|
|
481
1434
|
orderTabLabel: "Order Number"
|
|
@@ -486,6 +1439,7 @@ var readyToGoBlocks = [
|
|
|
486
1439
|
heading: text2("Heading"),
|
|
487
1440
|
submitLabel: text2("Button label"),
|
|
488
1441
|
defaultTrackingNumber: text2("Default tracking number"),
|
|
1442
|
+
defaultOrderNumber: text2("Default order number"),
|
|
489
1443
|
defaultQueryMode: text2("Default query mode"),
|
|
490
1444
|
trackingTabLabel: text2("Tracking tab label"),
|
|
491
1445
|
orderTabLabel: text2("Order tab label")
|
|
@@ -528,7 +1482,13 @@ var readyToGoBlocks = [
|
|
|
528
1482
|
fields: { heading: text2("Heading") },
|
|
529
1483
|
render: { web: ReadyToGoRecommendationsBlock, editor: ReadyToGoRecommendationsEditor }
|
|
530
1484
|
}
|
|
531
|
-
];
|
|
1485
|
+
], ["besttrack.ready-to-go.query"]);
|
|
1486
|
+
var readyToGoTemplatePolicy = defineTemplatePolicy(
|
|
1487
|
+
"besttrack.ready-to-go",
|
|
1488
|
+
"Ready-to-go",
|
|
1489
|
+
readyToGoBlocks.map((block) => block.type),
|
|
1490
|
+
["besttrack.ready-to-go.query"]
|
|
1491
|
+
);
|
|
532
1492
|
function createReadyToGoTemplate() {
|
|
533
1493
|
return {
|
|
534
1494
|
id: "besttrack.ready-to-go",
|
|
@@ -577,8 +1537,347 @@ var bestTrackPageExtension = Object.freeze({
|
|
|
577
1537
|
import { createPageDocument as createPageDocument2 } from "@standhigher/puck-page-builder/runtime";
|
|
578
1538
|
|
|
579
1539
|
// src/branded.tsx
|
|
580
|
-
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useMemo as useMemo2, useState as
|
|
581
|
-
|
|
1540
|
+
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
1541
|
+
|
|
1542
|
+
// src/tracking-query-experience.tsx
|
|
1543
|
+
import { useEffect as useEffect2, useId, useRef as useRef2, useState as useState3 } from "react";
|
|
1544
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1545
|
+
var srOnly = {
|
|
1546
|
+
position: "absolute",
|
|
1547
|
+
width: 1,
|
|
1548
|
+
height: 1,
|
|
1549
|
+
padding: 0,
|
|
1550
|
+
margin: -1,
|
|
1551
|
+
overflow: "hidden",
|
|
1552
|
+
clip: "rect(0, 0, 0, 0)",
|
|
1553
|
+
whiteSpace: "nowrap",
|
|
1554
|
+
border: 0
|
|
1555
|
+
};
|
|
1556
|
+
var defaultTabStyle = (active) => ({
|
|
1557
|
+
minHeight: 44,
|
|
1558
|
+
border: 0,
|
|
1559
|
+
borderBottom: active ? "2px solid currentColor" : "2px solid transparent",
|
|
1560
|
+
background: "transparent",
|
|
1561
|
+
color: "inherit",
|
|
1562
|
+
font: "inherit",
|
|
1563
|
+
fontWeight: active ? 700 : 400,
|
|
1564
|
+
cursor: "pointer"
|
|
1565
|
+
});
|
|
1566
|
+
var defaultInputStyle = {
|
|
1567
|
+
boxSizing: "border-box",
|
|
1568
|
+
width: "100%",
|
|
1569
|
+
minHeight: 48,
|
|
1570
|
+
padding: "12px 16px",
|
|
1571
|
+
border: "1px solid #cbd5e1",
|
|
1572
|
+
borderRadius: 8,
|
|
1573
|
+
background: "#fff",
|
|
1574
|
+
color: "#0f172a",
|
|
1575
|
+
font: "inherit"
|
|
1576
|
+
};
|
|
1577
|
+
var defaultSubmitStyle = (loading) => ({
|
|
1578
|
+
width: "100%",
|
|
1579
|
+
minHeight: 48,
|
|
1580
|
+
border: 0,
|
|
1581
|
+
borderRadius: 8,
|
|
1582
|
+
background: loading ? "#64748b" : "#111827",
|
|
1583
|
+
color: "#fff",
|
|
1584
|
+
font: "inherit",
|
|
1585
|
+
fontWeight: 700,
|
|
1586
|
+
cursor: loading ? "wait" : "pointer"
|
|
1587
|
+
});
|
|
1588
|
+
function fieldError(field) {
|
|
1589
|
+
if (field === "tracking") return "Enter a valid tracking number.";
|
|
1590
|
+
if (field === "order") return "Enter a valid order number.";
|
|
1591
|
+
return "Enter a valid email address.";
|
|
1592
|
+
}
|
|
1593
|
+
function TrackingQueryCard({
|
|
1594
|
+
phase,
|
|
1595
|
+
onQuery,
|
|
1596
|
+
heading,
|
|
1597
|
+
submitLabel,
|
|
1598
|
+
initialTrackingNumber,
|
|
1599
|
+
initialOrderNumber = "",
|
|
1600
|
+
initialMode = "tracking",
|
|
1601
|
+
trackingTabLabel = "Tracking Number",
|
|
1602
|
+
orderTabLabel = "Order Number",
|
|
1603
|
+
trackingPlaceholder = "Enter your tracking number",
|
|
1604
|
+
orderPlaceholder = "Enter your order number",
|
|
1605
|
+
emailPlaceholder = "Enter your email",
|
|
1606
|
+
loadingLabel = "Querying...",
|
|
1607
|
+
loadingMessage = "Checking your order...",
|
|
1608
|
+
emptyMessage = "We couldn't find an order or shipment for that number.",
|
|
1609
|
+
errorMessage = "We couldn't retrieve this order right now. Please try again later.",
|
|
1610
|
+
trackingInputLabel = "Tracking number",
|
|
1611
|
+
orderInputLabel = "Order number",
|
|
1612
|
+
emailInputLabel = "Email",
|
|
1613
|
+
cardDataAttribute,
|
|
1614
|
+
resultDataAttribute,
|
|
1615
|
+
resultTestId,
|
|
1616
|
+
result,
|
|
1617
|
+
watermark,
|
|
1618
|
+
cardStyle: cardStyle2,
|
|
1619
|
+
headingStyle,
|
|
1620
|
+
tabListStyle,
|
|
1621
|
+
tabStyle: tabStyle2 = defaultTabStyle,
|
|
1622
|
+
formStyle,
|
|
1623
|
+
inputStyle: inputStyle2 = defaultInputStyle,
|
|
1624
|
+
submitStyle = defaultSubmitStyle,
|
|
1625
|
+
messageStyle,
|
|
1626
|
+
resultStyle
|
|
1627
|
+
}) {
|
|
1628
|
+
const trackingInputId = useId();
|
|
1629
|
+
const orderInputId = useId();
|
|
1630
|
+
const emailInputId = useId();
|
|
1631
|
+
const trackingTabId = useId();
|
|
1632
|
+
const orderTabId = useId();
|
|
1633
|
+
const tabPanelId = useId();
|
|
1634
|
+
const queryStatusId = useId();
|
|
1635
|
+
const [mode, setMode] = useState3(initialMode);
|
|
1636
|
+
const [trackingNumber, setTrackingNumber] = useState3(initialTrackingNumber);
|
|
1637
|
+
const [orderNumber, setOrderNumber] = useState3(initialOrderNumber);
|
|
1638
|
+
const [email, setEmail] = useState3("");
|
|
1639
|
+
const [errors, setErrors] = useState3({});
|
|
1640
|
+
const cardRef = useRef2(null);
|
|
1641
|
+
const resultRef = useRef2(null);
|
|
1642
|
+
const trackingInputRef = useRef2(null);
|
|
1643
|
+
const orderInputRef = useRef2(null);
|
|
1644
|
+
const emailInputRef = useRef2(null);
|
|
1645
|
+
const tabRefs = useRef2({ tracking: null, order: null });
|
|
1646
|
+
const loading = phase === "loading";
|
|
1647
|
+
const terminalPhase = phase === "success" || phase === "empty" || phase === "error";
|
|
1648
|
+
useEffect2(() => {
|
|
1649
|
+
if (!terminalPhase) return;
|
|
1650
|
+
const card = cardRef.current;
|
|
1651
|
+
const resultNode = resultRef.current;
|
|
1652
|
+
if (card && resultNode && typeof card.scrollTo === "function") {
|
|
1653
|
+
card.scrollTo({ top: Math.max(0, resultNode.offsetTop - card.offsetTop - 16), behavior: "smooth" });
|
|
1654
|
+
}
|
|
1655
|
+
resultNode?.focus({ preventScroll: true });
|
|
1656
|
+
}, [phase, terminalPhase]);
|
|
1657
|
+
const focusField = (field) => {
|
|
1658
|
+
const input = field === "tracking" ? trackingInputRef.current : field === "order" ? orderInputRef.current : emailInputRef.current;
|
|
1659
|
+
input?.focus();
|
|
1660
|
+
};
|
|
1661
|
+
const setActiveMode = (nextMode, moveFocus = false) => {
|
|
1662
|
+
setMode(nextMode);
|
|
1663
|
+
setErrors({});
|
|
1664
|
+
if (moveFocus) tabRefs.current[nextMode]?.focus();
|
|
1665
|
+
};
|
|
1666
|
+
const onTabKeyDown = (event, currentMode) => {
|
|
1667
|
+
const modes = ["tracking", "order"];
|
|
1668
|
+
const currentIndex = modes.indexOf(currentMode);
|
|
1669
|
+
const nextMode = event.key === "ArrowRight" ? modes[(currentIndex + 1) % modes.length] : event.key === "ArrowLeft" ? modes[(currentIndex - 1 + modes.length) % modes.length] : event.key === "Home" ? modes[0] : event.key === "End" ? modes[modes.length - 1] : void 0;
|
|
1670
|
+
if (!nextMode) return;
|
|
1671
|
+
event.preventDefault();
|
|
1672
|
+
setActiveMode(nextMode, true);
|
|
1673
|
+
};
|
|
1674
|
+
const clearError = (field) => {
|
|
1675
|
+
setErrors((current) => {
|
|
1676
|
+
if (!current[field]) return current;
|
|
1677
|
+
const next = { ...current };
|
|
1678
|
+
delete next[field];
|
|
1679
|
+
return next;
|
|
1680
|
+
});
|
|
1681
|
+
};
|
|
1682
|
+
const submit = (event) => {
|
|
1683
|
+
event.preventDefault();
|
|
1684
|
+
const nextErrors = {};
|
|
1685
|
+
const normalizedTrackingNumber = trackingNumber.trim();
|
|
1686
|
+
const normalizedOrderNumber = orderNumber.trim();
|
|
1687
|
+
const normalizedEmail = email.trim();
|
|
1688
|
+
if (mode === "tracking" && !isValidTrackingNumber(normalizedTrackingNumber)) nextErrors.tracking = fieldError("tracking");
|
|
1689
|
+
if (mode === "order" && !isValidOrderNumber(normalizedOrderNumber)) nextErrors.order = fieldError("order");
|
|
1690
|
+
if (mode === "order" && !isValidOrderEmail(normalizedEmail)) nextErrors.email = fieldError("email");
|
|
1691
|
+
const firstInvalidField = mode === "tracking" ? "tracking" : nextErrors.order ? "order" : nextErrors.email ? "email" : void 0;
|
|
1692
|
+
if (firstInvalidField && nextErrors[firstInvalidField]) {
|
|
1693
|
+
setErrors(nextErrors);
|
|
1694
|
+
focusField(firstInvalidField);
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
setErrors({});
|
|
1698
|
+
void onQuery(mode === "tracking" ? { mode, trackingNumber: normalizedTrackingNumber } : { mode, orderNumber: normalizedOrderNumber, email: normalizedEmail });
|
|
1699
|
+
};
|
|
1700
|
+
const errorFor = (field) => errors[field];
|
|
1701
|
+
const inputWithError = (field) => ({ ...inputStyle2, borderColor: errorFor(field) ? "#b42318" : inputStyle2.borderColor ?? "#cbd5e1" });
|
|
1702
|
+
const message = phase === "loading" ? loadingMessage : phase === "empty" ? emptyMessage : phase === "error" ? errorMessage : void 0;
|
|
1703
|
+
const cardData = cardDataAttribute ? { [cardDataAttribute]: "true" } : {};
|
|
1704
|
+
const resultData = resultDataAttribute ? { [resultDataAttribute]: "true" } : {};
|
|
1705
|
+
const activeTabId = mode === "tracking" ? trackingTabId : orderTabId;
|
|
1706
|
+
const resultLabel = phase === "success" ? "Tracking result" : "Tracking query status";
|
|
1707
|
+
return /* @__PURE__ */ jsxs4("div", { ref: cardRef, "data-tracking-query-card": true, ...cardData, "aria-busy": loading || void 0, style: { boxSizing: "border-box", minWidth: 0, maxWidth: "100%", overflowX: "hidden", overflowY: "auto", overscrollBehavior: "contain", scrollPaddingBlock: 16, ...cardStyle2 }, children: [
|
|
1708
|
+
/* @__PURE__ */ jsx4("h1", { style: { margin: "0 0 28px", textAlign: "center", ...headingStyle }, children: heading }),
|
|
1709
|
+
/* @__PURE__ */ jsxs4("div", { role: "tablist", "aria-label": "Tracking method", style: { display: "grid", gridTemplateColumns: "1fr 1fr", borderBottom: "1px solid #cbd5e1", marginBottom: 18, ...tabListStyle }, children: [
|
|
1710
|
+
/* @__PURE__ */ jsx4("button", { ref: (element) => {
|
|
1711
|
+
tabRefs.current.tracking = element;
|
|
1712
|
+
}, id: trackingTabId, type: "button", role: "tab", "aria-selected": mode === "tracking", "aria-controls": tabPanelId, tabIndex: mode === "tracking" ? 0 : -1, onClick: () => setActiveMode("tracking"), onKeyDown: (event) => onTabKeyDown(event, "tracking"), style: tabStyle2(mode === "tracking"), children: trackingTabLabel }),
|
|
1713
|
+
/* @__PURE__ */ jsx4("button", { ref: (element) => {
|
|
1714
|
+
tabRefs.current.order = element;
|
|
1715
|
+
}, id: orderTabId, type: "button", role: "tab", "aria-selected": mode === "order", "aria-controls": tabPanelId, tabIndex: mode === "order" ? 0 : -1, onClick: () => setActiveMode("order"), onKeyDown: (event) => onTabKeyDown(event, "order"), style: tabStyle2(mode === "order"), children: orderTabLabel })
|
|
1716
|
+
] }),
|
|
1717
|
+
/* @__PURE__ */ jsx4("div", { id: tabPanelId, role: "tabpanel", "aria-labelledby": activeTabId, children: /* @__PURE__ */ jsxs4("form", { noValidate: true, onSubmit: submit, style: { display: "grid", gap: 12, minWidth: 0, ...formStyle }, children: [
|
|
1718
|
+
mode === "tracking" ? /* @__PURE__ */ jsxs4("div", { children: [
|
|
1719
|
+
/* @__PURE__ */ jsx4("label", { htmlFor: trackingInputId, style: srOnly, children: trackingInputLabel }),
|
|
1720
|
+
/* @__PURE__ */ jsx4("input", { ref: trackingInputRef, id: trackingInputId, "aria-label": trackingInputLabel, "aria-invalid": Boolean(errorFor("tracking")), "aria-describedby": errorFor("tracking") ? trackingInputId + "-error" : void 0, value: trackingNumber, onChange: (event) => {
|
|
1721
|
+
setTrackingNumber(event.target.value);
|
|
1722
|
+
clearError("tracking");
|
|
1723
|
+
}, placeholder: trackingPlaceholder, style: inputWithError("tracking") }),
|
|
1724
|
+
errorFor("tracking") ? /* @__PURE__ */ jsx4("p", { id: trackingInputId + "-error", role: "alert", style: { margin: "6px 0 0", color: "#b42318", fontSize: 13 }, children: errorFor("tracking") }) : null
|
|
1725
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1726
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1727
|
+
/* @__PURE__ */ jsx4("label", { htmlFor: orderInputId, style: srOnly, children: orderInputLabel }),
|
|
1728
|
+
/* @__PURE__ */ jsx4("input", { ref: orderInputRef, id: orderInputId, "aria-label": orderInputLabel, "aria-invalid": Boolean(errorFor("order")), "aria-describedby": errorFor("order") ? orderInputId + "-error" : void 0, value: orderNumber, onChange: (event) => {
|
|
1729
|
+
setOrderNumber(event.target.value);
|
|
1730
|
+
clearError("order");
|
|
1731
|
+
}, placeholder: orderPlaceholder, style: inputWithError("order") }),
|
|
1732
|
+
errorFor("order") ? /* @__PURE__ */ jsx4("p", { id: orderInputId + "-error", role: "alert", style: { margin: "6px 0 0", color: "#b42318", fontSize: 13 }, children: errorFor("order") }) : null
|
|
1733
|
+
] }),
|
|
1734
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1735
|
+
/* @__PURE__ */ jsx4("label", { htmlFor: emailInputId, style: srOnly, children: emailInputLabel }),
|
|
1736
|
+
/* @__PURE__ */ jsx4("input", { ref: emailInputRef, id: emailInputId, type: "email", "aria-label": emailInputLabel, "aria-invalid": Boolean(errorFor("email")), "aria-describedby": errorFor("email") ? emailInputId + "-error" : void 0, value: email, onChange: (event) => {
|
|
1737
|
+
setEmail(event.target.value);
|
|
1738
|
+
clearError("email");
|
|
1739
|
+
}, placeholder: emailPlaceholder, style: inputWithError("email") }),
|
|
1740
|
+
errorFor("email") ? /* @__PURE__ */ jsx4("p", { id: emailInputId + "-error", role: "alert", style: { margin: "6px 0 0", color: "#b42318", fontSize: 13 }, children: errorFor("email") }) : null
|
|
1741
|
+
] })
|
|
1742
|
+
] }),
|
|
1743
|
+
/* @__PURE__ */ jsx4("button", { type: "submit", disabled: loading, style: submitStyle(loading), children: loading ? loadingLabel : submitLabel })
|
|
1744
|
+
] }) }),
|
|
1745
|
+
message ? /* @__PURE__ */ jsx4("p", { id: queryStatusId, role: phase === "error" ? "alert" : "status", "aria-live": phase === "error" ? "assertive" : "polite", style: { margin: "16px 0 0", color: phase === "error" ? "#b42318" : "#64748b", ...messageStyle }, children: message }) : null,
|
|
1746
|
+
phase === "success" ? /* @__PURE__ */ jsx4("p", { id: queryStatusId, role: "status", "aria-live": "polite", style: srOnly, children: "Tracking details loaded." }) : null,
|
|
1747
|
+
terminalPhase ? /* @__PURE__ */ jsx4("div", { ref: resultRef, role: "region", "aria-label": resultLabel, "aria-describedby": queryStatusId, "data-tracking-query-result": true, ...resultData, "data-testid": resultTestId, tabIndex: -1, style: { minWidth: 0, overflowWrap: "anywhere", marginTop: phase === "success" ? 20 : 0, ...resultStyle }, children: phase === "success" ? result : null }) : null,
|
|
1748
|
+
watermark
|
|
1749
|
+
] });
|
|
1750
|
+
}
|
|
1751
|
+
function defaultProgress2(status) {
|
|
1752
|
+
const steps = [
|
|
1753
|
+
{ id: "ordered", label: "Ordered", icon: "check" },
|
|
1754
|
+
{ id: "ready", label: "Order Ready", icon: "bag" },
|
|
1755
|
+
{ id: "transit", label: "In Transit", icon: "truck" },
|
|
1756
|
+
{ id: "out", label: "Out for Delivery", icon: "box" },
|
|
1757
|
+
{ id: "delivered", label: "Delivered", icon: "check" }
|
|
1758
|
+
];
|
|
1759
|
+
const normalized = status.toLowerCase();
|
|
1760
|
+
const current = normalized.includes("deliver") ? normalized.includes("out for") ? 3 : 4 : normalized.includes("transit") ? 2 : normalized.includes("ready") ? 1 : 0;
|
|
1761
|
+
return steps.map((step, index) => ({ ...step, state: index < current ? "complete" : index === current ? "current" : "upcoming" }));
|
|
1762
|
+
}
|
|
1763
|
+
function TrackingProgressDetails({ steps }) {
|
|
1764
|
+
return /* @__PURE__ */ jsx4("ol", { "aria-label": "Delivery progress", style: { display: "grid", gridTemplateColumns: "repeat(5, minmax(0, 1fr))", gap: 4, margin: "20px 0 0", padding: 0, listStyle: "none" }, children: steps.slice(0, 5).map((step, index) => /* @__PURE__ */ jsxs4("li", { style: { minWidth: 0, textAlign: "center", color: step.state === "upcoming" ? "#64748b" : "#0f172a" }, children: [
|
|
1765
|
+
/* @__PURE__ */ jsx4("span", { "aria-label": step.label + " " + step.state, style: { display: "grid", placeItems: "center", width: 28, height: 28, margin: "0 auto", border: "1px solid " + (step.state === "upcoming" ? "#94a3b8" : "#0f172a"), borderRadius: "50%", background: step.state === "current" ? "#0f172a" : "#fff", color: step.state === "current" ? "#fff" : "#0f172a", fontSize: 13, fontWeight: 700 }, children: step.state === "complete" || step.state === "current" ? "\u2713" : index + 1 }),
|
|
1766
|
+
/* @__PURE__ */ jsx4("span", { style: { display: "block", marginTop: 6, overflowWrap: "anywhere", fontSize: 11, lineHeight: 1.25 }, children: step.label }),
|
|
1767
|
+
step.date ? /* @__PURE__ */ jsx4("span", { style: { display: "block", marginTop: 3, color: "#94a3b8", fontSize: 10, lineHeight: 1.2 }, children: step.date }) : null
|
|
1768
|
+
] }, step.id)) });
|
|
1769
|
+
}
|
|
1770
|
+
function TrackingEvents({ result }) {
|
|
1771
|
+
const [expanded, setExpanded] = useState3(false);
|
|
1772
|
+
const events = result.events ?? (result.latestEvent ? [{ id: "latest", title: result.latestEvent, at: result.updatedAt, state: "current" }] : []);
|
|
1773
|
+
if (!events.length) return /* @__PURE__ */ jsx4("p", { style: { margin: "12px 0 0", color: "#64748b", fontSize: 14 }, children: "Tracking events are not available yet. Please try again later." });
|
|
1774
|
+
const visibleEvents = events.slice(0, expanded ? 50 : 3);
|
|
1775
|
+
return /* @__PURE__ */ jsxs4("div", { "aria-label": "Shipping events", style: { marginTop: 16 }, children: [
|
|
1776
|
+
/* @__PURE__ */ jsx4("ol", { style: { display: "grid", gap: 14, margin: 0, padding: 0, listStyle: "none" }, children: visibleEvents.map((event, index) => /* @__PURE__ */ jsxs4("li", { style: { position: "relative", minWidth: 0, paddingLeft: 22, overflowWrap: "anywhere" }, children: [
|
|
1777
|
+
/* @__PURE__ */ jsx4("span", { "aria-hidden": "true", style: { position: "absolute", left: 0, top: 4, width: 10, height: 10, borderRadius: "50%", background: event.state === "current" || index === 0 ? "#111827" : "#cbd5e1" } }),
|
|
1778
|
+
/* @__PURE__ */ jsx4("strong", { style: { display: "block", fontSize: 14 }, children: event.title }),
|
|
1779
|
+
event.detail ? /* @__PURE__ */ jsx4("span", { style: { display: "block", marginTop: 2, color: "#64748b", fontSize: 13 }, children: event.detail }) : null,
|
|
1780
|
+
event.at ? /* @__PURE__ */ jsx4("time", { style: { display: "block", marginTop: 3, color: "#94a3b8", fontSize: 12 }, children: event.at }) : null
|
|
1781
|
+
] }, event.id)) }),
|
|
1782
|
+
events.length > 3 ? /* @__PURE__ */ jsx4("button", { type: "button", onClick: () => setExpanded((current) => !current), style: { minWidth: 44, minHeight: 44, marginTop: 14, padding: "6px 12px", border: "1px solid #cbd5e1", borderRadius: 6, background: "#fff", color: "#0f172a", font: "inherit", fontSize: 13, cursor: "pointer" }, children: expanded ? "Show recent events" : "Show all events" }) : null
|
|
1783
|
+
] });
|
|
1784
|
+
}
|
|
1785
|
+
function TrackingOrderItemImage({ src, title }) {
|
|
1786
|
+
const [failed, setFailed] = useState3(false);
|
|
1787
|
+
const imageUrl = safeTrackingPageUrl(src);
|
|
1788
|
+
if (!imageUrl || failed) return /* @__PURE__ */ jsx4("span", { "aria-label": title + " image unavailable", style: { display: "grid", width: 56, height: 56, placeItems: "center", borderRadius: 6, background: "#e2e8f0", color: "#64748b", fontSize: 13 }, children: title.slice(0, 1).toUpperCase() });
|
|
1789
|
+
return /* @__PURE__ */ jsx4("img", { src: imageUrl, alt: "", onError: () => setFailed(true), style: { width: 56, height: 56, borderRadius: 6, objectFit: "cover", background: "#f1f5f9" } });
|
|
1790
|
+
}
|
|
1791
|
+
function TrackingOrderItems({ items }) {
|
|
1792
|
+
if (!items.length) return null;
|
|
1793
|
+
return /* @__PURE__ */ jsxs4("section", { "aria-label": "Order items", style: { marginTop: 24, borderTop: "1px solid #e2e8f0", paddingTop: 18 }, children: [
|
|
1794
|
+
/* @__PURE__ */ jsx4("h2", { style: { margin: 0, fontSize: 16 }, children: "Items in your order" }),
|
|
1795
|
+
/* @__PURE__ */ jsx4("div", { style: { display: "grid", gap: 12, marginTop: 12 }, children: items.map((item) => {
|
|
1796
|
+
const price = item.price ? formatTrackingPageMoney(item.price) : void 0;
|
|
1797
|
+
const href = safeTrackingPageUrl(item.href);
|
|
1798
|
+
return /* @__PURE__ */ jsxs4("article", { style: { display: "grid", gridTemplateColumns: "56px minmax(0, 1fr)", gap: 12, alignItems: "center" }, children: [
|
|
1799
|
+
/* @__PURE__ */ jsx4(TrackingOrderItemImage, { src: item.imageUrl, title: item.title }),
|
|
1800
|
+
/* @__PURE__ */ jsxs4("div", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1801
|
+
href ? /* @__PURE__ */ jsx4("a", { href, style: { color: "inherit", fontWeight: 700, overflowWrap: "anywhere" }, children: item.title }) : /* @__PURE__ */ jsx4("strong", { style: { overflowWrap: "anywhere" }, children: item.title }),
|
|
1802
|
+
item.description ? /* @__PURE__ */ jsx4("p", { style: { margin: "3px 0 0", color: "#64748b", fontSize: 13 }, children: item.description }) : null,
|
|
1803
|
+
/* @__PURE__ */ jsxs4("p", { style: { display: "flex", flexWrap: "wrap", gap: 8, margin: "4px 0 0", color: "#475569", fontSize: 13 }, children: [
|
|
1804
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1805
|
+
"Qty ",
|
|
1806
|
+
item.quantity
|
|
1807
|
+
] }),
|
|
1808
|
+
price?.amount ? /* @__PURE__ */ jsxs4("span", { children: [
|
|
1809
|
+
price.amount,
|
|
1810
|
+
price.startsAt ? " and up" : ""
|
|
1811
|
+
] }) : null,
|
|
1812
|
+
price?.compareAt ? /* @__PURE__ */ jsx4("s", { style: { color: "#94a3b8" }, children: price.compareAt }) : null
|
|
1813
|
+
] })
|
|
1814
|
+
] })
|
|
1815
|
+
] }, item.id);
|
|
1816
|
+
}) })
|
|
1817
|
+
] });
|
|
1818
|
+
}
|
|
1819
|
+
function TrackingQueryResultDetails({ result, onTrackAnother, trackAnotherLabel = "Track another" }) {
|
|
1820
|
+
const [copied, setCopied] = useState3(false);
|
|
1821
|
+
const progress = result.progress?.length === 5 ? result.progress : defaultProgress2(result.status);
|
|
1822
|
+
const copyTrackingNumber = () => {
|
|
1823
|
+
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
|
|
1824
|
+
void navigator.clipboard.writeText(result.trackingNumber).then(() => setCopied(true)).catch(() => void 0);
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
return /* @__PURE__ */ jsxs4("section", { "aria-label": "Tracking result details", style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1828
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexWrap: "wrap", alignItems: "start", justifyContent: "space-between", gap: 12 }, children: [
|
|
1829
|
+
/* @__PURE__ */ jsxs4("div", { style: { minWidth: 0, flex: "1 1 180px" }, children: [
|
|
1830
|
+
/* @__PURE__ */ jsxs4("strong", { style: { fontSize: 17 }, children: [
|
|
1831
|
+
"Your order is ",
|
|
1832
|
+
result.status || "being updated"
|
|
1833
|
+
] }),
|
|
1834
|
+
result.estimatedDelivery ? /* @__PURE__ */ jsxs4("p", { style: { margin: "5px 0 0", color: "#475569", fontSize: 14 }, children: [
|
|
1835
|
+
"Estimated delivery: ",
|
|
1836
|
+
result.estimatedDelivery
|
|
1837
|
+
] }) : null
|
|
1838
|
+
] }),
|
|
1839
|
+
onTrackAnother ? /* @__PURE__ */ jsx4("button", { type: "button", onClick: onTrackAnother, style: { minWidth: 44, minHeight: 44, flex: "0 0 auto", padding: "6px 10px", border: "1px solid #cbd5e1", borderRadius: 6, background: "#fff", color: "#0f172a", font: "inherit", fontSize: 12, cursor: "pointer" }, children: trackAnotherLabel }) : null
|
|
1840
|
+
] }),
|
|
1841
|
+
/* @__PURE__ */ jsx4(TrackingProgressDetails, { steps: progress }),
|
|
1842
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 140px), 1fr))", gap: 10, marginTop: 22, padding: 12, borderRadius: 8, background: "#f8fafc", color: "#334155", fontSize: 13 }, children: [
|
|
1843
|
+
/* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1844
|
+
/* @__PURE__ */ jsx4("strong", { children: "Carrier" }),
|
|
1845
|
+
/* @__PURE__ */ jsx4("br", {}),
|
|
1846
|
+
result.carrier || "\u2014"
|
|
1847
|
+
] }),
|
|
1848
|
+
/* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1849
|
+
/* @__PURE__ */ jsx4("strong", { children: "Tracking number" }),
|
|
1850
|
+
/* @__PURE__ */ jsx4("br", {}),
|
|
1851
|
+
/* @__PURE__ */ jsx4("span", { children: result.trackingNumber }),
|
|
1852
|
+
" ",
|
|
1853
|
+
/* @__PURE__ */ jsx4("button", { type: "button", onClick: copyTrackingNumber, style: { minWidth: 44, minHeight: 44, border: 0, background: "transparent", color: "#0f172a", font: "inherit", fontSize: 12, fontWeight: 700, cursor: "pointer" }, children: copied ? "Copied" : "Copy" })
|
|
1854
|
+
] }),
|
|
1855
|
+
/* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1856
|
+
/* @__PURE__ */ jsx4("strong", { children: "Destination" }),
|
|
1857
|
+
/* @__PURE__ */ jsx4("br", {}),
|
|
1858
|
+
result.destination || "\u2014"
|
|
1859
|
+
] }),
|
|
1860
|
+
/* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1861
|
+
/* @__PURE__ */ jsx4("strong", { children: "Transit time" }),
|
|
1862
|
+
/* @__PURE__ */ jsx4("br", {}),
|
|
1863
|
+
result.transitDuration || "\u2014"
|
|
1864
|
+
] }),
|
|
1865
|
+
result.orderNumber ? /* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1866
|
+
/* @__PURE__ */ jsx4("strong", { children: "Order number" }),
|
|
1867
|
+
/* @__PURE__ */ jsx4("br", {}),
|
|
1868
|
+
result.orderNumber
|
|
1869
|
+
] }) : null
|
|
1870
|
+
] }),
|
|
1871
|
+
/* @__PURE__ */ jsxs4("section", { "aria-label": "Tracking timeline", style: { marginTop: 24, borderTop: "1px solid #e2e8f0", paddingTop: 18 }, children: [
|
|
1872
|
+
/* @__PURE__ */ jsx4("h2", { style: { margin: 0, fontSize: 16 }, children: "Tracking timeline" }),
|
|
1873
|
+
/* @__PURE__ */ jsx4(TrackingEvents, { result })
|
|
1874
|
+
] }),
|
|
1875
|
+
/* @__PURE__ */ jsx4(TrackingOrderItems, { items: result.orderItems ?? [] })
|
|
1876
|
+
] });
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
// src/branded.tsx
|
|
1880
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
582
1881
|
var initialRuntime2 = {
|
|
583
1882
|
phase: "idle",
|
|
584
1883
|
selectedShipmentId: null,
|
|
@@ -595,20 +1894,26 @@ var initialRuntime2 = {
|
|
|
595
1894
|
var BrandedRuntimeContext = createContext2(initialRuntime2);
|
|
596
1895
|
var contentWidth2 = { width: "min(1200px, 100%)", margin: "0 auto", padding: "0 clamp(16px, 4vw, 48px)", boxSizing: "border-box" };
|
|
597
1896
|
var cardStyle = { background: "#fff", color: "#0a0a0a", border: "1px solid #e7e7e7", borderRadius: 10, fontFamily: "var(--pb-font-family)" };
|
|
598
|
-
function BrandedRuntimeProvider({ children,
|
|
599
|
-
const [state, setState] =
|
|
600
|
-
const [selectedShipmentId, setSelectedShipmentId] =
|
|
601
|
-
const
|
|
1897
|
+
function BrandedRuntimeProvider({ children, query: injectedQuery, watermark }) {
|
|
1898
|
+
const [state, setState] = useState4({ phase: "idle" });
|
|
1899
|
+
const [selectedShipmentId, setSelectedShipmentId] = useState4(null);
|
|
1900
|
+
const requestId = useRef3(0);
|
|
1901
|
+
const query = useCallback2(async (request) => {
|
|
1902
|
+
const currentRequestId = ++requestId.current;
|
|
602
1903
|
setState({ phase: "loading" });
|
|
603
1904
|
try {
|
|
604
|
-
|
|
1905
|
+
if (!injectedQuery) throw new Error("tracking-query-not-configured");
|
|
1906
|
+
const result = await injectedQuery(request);
|
|
1907
|
+
if (currentRequestId !== requestId.current) return;
|
|
605
1908
|
setSelectedShipmentId(result.shipments?.[0]?.id ?? null);
|
|
606
|
-
setState({ phase: "success", result });
|
|
607
|
-
} catch
|
|
608
|
-
|
|
1909
|
+
setState({ phase: isEmptyTrackingPageResult(result) ? "empty" : "success", result });
|
|
1910
|
+
} catch {
|
|
1911
|
+
if (currentRequestId !== requestId.current) return;
|
|
1912
|
+
setState({ phase: "error", error: "tracking-query-failed" });
|
|
609
1913
|
}
|
|
610
|
-
}, [
|
|
1914
|
+
}, [injectedQuery]);
|
|
611
1915
|
const reset = useCallback2(() => {
|
|
1916
|
+
requestId.current += 1;
|
|
612
1917
|
setSelectedShipmentId(null);
|
|
613
1918
|
setState({ phase: "idle" });
|
|
614
1919
|
}, []);
|
|
@@ -617,163 +1922,108 @@ function BrandedRuntimeProvider({ children, queryTracking }) {
|
|
|
617
1922
|
const shipment = state.result.shipments?.find((item) => item.id === selectedShipmentId);
|
|
618
1923
|
return shipment ? { ...state.result, ...shipment } : state.result;
|
|
619
1924
|
}, [selectedShipmentId, state.result]);
|
|
620
|
-
const selectShipment = useCallback2((id) =>
|
|
1925
|
+
const selectShipment = useCallback2((id) => {
|
|
1926
|
+
if (state.result?.shipments?.some((shipment) => shipment.id === id)) setSelectedShipmentId(id);
|
|
1927
|
+
}, [state.result]);
|
|
621
1928
|
const value = useMemo2(
|
|
622
|
-
() => ({ ...state, displayedResult, selectedShipmentId, query, reset, selectShipment }),
|
|
623
|
-
[displayedResult, query, reset, selectedShipmentId, selectShipment, state]
|
|
1929
|
+
() => ({ ...state, displayedResult, selectedShipmentId, query, reset, selectShipment, watermark }),
|
|
1930
|
+
[displayedResult, query, reset, selectedShipmentId, selectShipment, state, watermark]
|
|
624
1931
|
);
|
|
625
|
-
return /* @__PURE__ */
|
|
1932
|
+
return /* @__PURE__ */ jsx5(BrandedRuntimeContext.Provider, { value, children });
|
|
626
1933
|
}
|
|
627
1934
|
function useBrandedRuntime() {
|
|
628
1935
|
return useContext2(BrandedRuntimeContext);
|
|
629
1936
|
}
|
|
1937
|
+
function RuntimeWatermark2({ watermark }) {
|
|
1938
|
+
return watermark?.visible ? /* @__PURE__ */ jsx5("small", { style: { display: "block", marginTop: 10, color: "#8a8a8a", fontSize: 8, textAlign: "right" }, children: watermark.label || "Powered by BestTrack" }) : null;
|
|
1939
|
+
}
|
|
630
1940
|
function text3(props, key, fallback) {
|
|
631
1941
|
return typeof props[key] === "string" ? props[key] : fallback;
|
|
632
1942
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
if (value.startsWith("/")) return value;
|
|
636
|
-
try {
|
|
637
|
-
const url = new URL(value);
|
|
638
|
-
return url.protocol === "https:" || url.protocol === "http:" ? url.toString() : "#";
|
|
639
|
-
} catch {
|
|
640
|
-
return "#";
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
function safeImageUrl2(value) {
|
|
644
|
-
if (typeof value !== "string") return "";
|
|
645
|
-
try {
|
|
646
|
-
const url = new URL(value);
|
|
647
|
-
return url.protocol === "https:" || url.protocol === "http:" ? url.toString() : "";
|
|
648
|
-
} catch {
|
|
649
|
-
return "";
|
|
650
|
-
}
|
|
651
|
-
}
|
|
1943
|
+
var safeHref2 = safeTrackingPageUrl;
|
|
1944
|
+
var safeImageUrl2 = safeTrackingPageUrl;
|
|
652
1945
|
function shipmentLabels(value) {
|
|
653
1946
|
return typeof value === "string" ? value.split("|").map((label, index) => ({ id: "configured-" + index, label: label.trim() })).filter((item) => item.label) : [];
|
|
654
1947
|
}
|
|
655
1948
|
function ProductImage2({ src, alt }) {
|
|
656
|
-
const [failed, setFailed] =
|
|
1949
|
+
const [failed, setFailed] = useState4(false);
|
|
657
1950
|
const safeSrc = safeImageUrl2(src);
|
|
658
1951
|
if (!safeSrc || failed) {
|
|
659
|
-
return /* @__PURE__ */
|
|
1952
|
+
return /* @__PURE__ */ jsx5("span", { "aria-label": alt + " image unavailable", style: { display: "grid", placeItems: "center", width: 72, height: 72, flex: "0 0 auto", borderRadius: 6, background: "#f2f2f2", color: "#6b6b6b", fontSize: 14 }, children: alt.slice(0, 1).toUpperCase() });
|
|
660
1953
|
}
|
|
661
|
-
return /* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ jsx5("img", { src: safeSrc, alt, onError: () => setFailed(true), style: { width: 72, height: 72, flex: "0 0 auto", borderRadius: 6, objectFit: "cover", background: "#f2f2f2" } });
|
|
662
1955
|
}
|
|
663
1956
|
function ShipmentSwitcher({ shipmentLabels: configuredLabels }) {
|
|
664
1957
|
const runtime = useBrandedRuntime();
|
|
665
1958
|
const configuredShipments = shipmentLabels(configuredLabels);
|
|
666
|
-
const shipments = runtime.
|
|
1959
|
+
const shipments = runtime.phase === "idle" || runtime.phase === "loading" ? configuredShipments : runtime.result?.shipments ?? [];
|
|
667
1960
|
if (!shipments.length) return null;
|
|
668
|
-
return /* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsx5("div", { "aria-label": "Shipment switcher", style: { ...contentWidth2, minWidth: 0, minHeight: 56, display: "flex", alignItems: "center", gap: 8, overflowX: "auto", whiteSpace: "nowrap" }, children: shipments.map((shipment, index) => {
|
|
669
1962
|
const selected = (runtime.selectedShipmentId ?? shipments[0]?.id) === shipment.id;
|
|
670
|
-
return /* @__PURE__ */
|
|
1963
|
+
return /* @__PURE__ */ jsx5("button", { type: "button", onClick: () => runtime.selectShipment(shipment.id), "aria-pressed": selected, style: { minWidth: 92, minHeight: 44, padding: "0 12px", border: selected ? "1px solid #1a1a1a" : "1px solid #e7e7e7", borderRadius: 4, background: "#fff", color: "#0a0a0a", fontSize: 11, fontWeight: selected ? 700 : 400, cursor: "pointer" }, children: shipment.label || "Shipment #" + (index + 1) }, shipment.id);
|
|
671
1964
|
}) });
|
|
672
1965
|
}
|
|
673
1966
|
function QueryHero(props) {
|
|
674
1967
|
const runtime = useBrandedRuntime();
|
|
675
|
-
const [
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
1968
|
+
const [heroImageFailed, setHeroImageFailed] = useState4(false);
|
|
1969
|
+
const result = runtime.displayedResult;
|
|
1970
|
+
return /* @__PURE__ */ jsxs5("div", { style: { position: "relative", minWidth: 0, minHeight: "clamp(520px, 44vw, 560px)", display: "grid", overflow: "hidden", background: "linear-gradient(135deg, #dedbd4, #b9b3aa)" }, children: [
|
|
1971
|
+
!heroImageFailed && safeImageUrl2(props.heroImageUrl) ? /* @__PURE__ */ jsx5("img", { src: safeImageUrl2(props.heroImageUrl), alt: "", onError: () => setHeroImageFailed(true), style: { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover" } }) : null,
|
|
1972
|
+
/* @__PURE__ */ jsx5("div", { "aria-hidden": "true", style: { position: "absolute", inset: 0, background: "rgba(255,255,255,0.12)" } }),
|
|
1973
|
+
/* @__PURE__ */ jsx5("div", { style: { ...contentWidth2, position: "relative", zIndex: 1, display: "grid", alignItems: "center", width: "100%", minWidth: 0, paddingTop: "clamp(24px, 5vw, 48px)", paddingBottom: "clamp(24px, 5vw, 48px)" }, children: /* @__PURE__ */ jsx5(
|
|
1974
|
+
TrackingQueryCard,
|
|
1975
|
+
{
|
|
1976
|
+
phase: runtime.phase,
|
|
1977
|
+
onQuery: runtime.query,
|
|
1978
|
+
heading: text3(props, "heading", "Track your order"),
|
|
1979
|
+
submitLabel: text3(props, "submitLabel", "Track"),
|
|
1980
|
+
initialTrackingNumber: text3(props, "defaultTrackingNumber", "DEMO-YQTRACK9999"),
|
|
1981
|
+
initialOrderNumber: text3(props, "defaultOrderNumber", ""),
|
|
1982
|
+
initialMode: text3(props, "defaultQueryMode", "tracking") === "order" ? "order" : "tracking",
|
|
1983
|
+
trackingTabLabel: text3(props, "trackingTabLabel", "Tracking Number"),
|
|
1984
|
+
orderTabLabel: text3(props, "orderTabLabel", "Order Number"),
|
|
1985
|
+
loadingLabel: "Tracking...",
|
|
1986
|
+
loadingMessage: "Checking your order\u2026",
|
|
1987
|
+
emptyMessage: "We couldn\u2019t find an order for that number.",
|
|
1988
|
+
errorMessage: "We couldn\u2019t retrieve this order right now. Please try again later.",
|
|
1989
|
+
cardDataAttribute: "data-branded-query-card",
|
|
1990
|
+
resultDataAttribute: "data-branded-query-result",
|
|
1991
|
+
resultTestId: "branded-result",
|
|
1992
|
+
cardStyle: { ...cardStyle, width: "min(560px, 100%)", maxHeight: "min(560px, calc(100dvh - 32px))", marginLeft: "auto", padding: "clamp(24px, 5vw, 48px)", boxSizing: "border-box", boxShadow: "0 16px 40px rgb(0 0 0 / 8%)" },
|
|
1993
|
+
headingStyle: { marginBottom: 36, fontSize: "clamp(28px, 3vw, 32px)", lineHeight: 1.15 },
|
|
1994
|
+
tabListStyle: { borderBottomColor: "#e7e7e7", marginBottom: 24 },
|
|
1995
|
+
tabStyle: (active) => ({ minHeight: 44, border: 0, borderBottom: active ? "2px solid #0a0a0a" : "2px solid transparent", background: "transparent", font: "inherit", fontWeight: active ? 700 : 400, cursor: "pointer" }),
|
|
1996
|
+
formStyle: { gap: 12 },
|
|
1997
|
+
inputStyle: { width: "100%", height: 48, padding: "0 16px", boxSizing: "border-box", border: "1px solid #e2e2e2", borderRadius: 10, font: "inherit" },
|
|
1998
|
+
submitStyle: (loading) => ({ width: "100%", minHeight: 48, marginTop: 12, border: 0, borderRadius: 10, background: loading ? "#6b6b6b" : "#000", color: "#fff", font: "inherit", cursor: loading ? "wait" : "pointer" }),
|
|
1999
|
+
result: result ? /* @__PURE__ */ jsx5(TrackingQueryResultDetails, { result, onTrackAnother: runtime.reset, trackAnotherLabel: text3(props, "trackAnotherLabel", "Track another order") }) : null,
|
|
2000
|
+
resultStyle: { padding: 16, border: "1px solid #e7e7e7", borderRadius: 8, background: "#fffdf0" },
|
|
2001
|
+
watermark: /* @__PURE__ */ jsx5(RuntimeWatermark2, { watermark: runtime.watermark })
|
|
2002
|
+
}
|
|
2003
|
+
) })
|
|
699
2004
|
] });
|
|
700
2005
|
}
|
|
701
|
-
function defaultProgress2(status) {
|
|
702
|
-
const steps = ["Ordered", "Order Ready", "In Transit", "Out for Delivery", "Delivered"];
|
|
703
|
-
const normalized = status.toLowerCase();
|
|
704
|
-
const current = normalized.includes("deliver") ? normalized.includes("out for") ? 3 : 4 : normalized.includes("transit") ? 2 : normalized.includes("ready") ? 1 : 0;
|
|
705
|
-
return steps.map((label, index) => ({ id: label.toLowerCase().replaceAll(" ", "-"), label, state: index < current ? "complete" : index === current ? "current" : "upcoming" }));
|
|
706
|
-
}
|
|
707
|
-
function TrackingProgress2({ steps }) {
|
|
708
|
-
return /* @__PURE__ */ jsx3("div", { "aria-label": "Delivery progress", style: { overflowX: "auto", padding: "28px 0 8px" }, children: /* @__PURE__ */ jsx3("ol", { style: { display: "grid", gridTemplateColumns: "repeat(" + steps.length + ", minmax(112px, 1fr))", minWidth: Math.max(560, steps.length * 138), padding: 0, margin: 0, listStyle: "none" }, children: steps.map((step, index) => /* @__PURE__ */ jsxs3("li", { style: { position: "relative", display: "grid", justifyItems: "center", gap: 12, color: step.state === "upcoming" ? "#718096" : "#0f1d3a", textAlign: "center" }, children: [
|
|
709
|
-
index > 0 ? /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", style: { position: "absolute", top: 19, right: "50%", width: "100%", height: 8, transform: "translateX(-50%)", background: step.state === "upcoming" ? "#d1d5db" : "#0f1d3a" } }) : null,
|
|
710
|
-
/* @__PURE__ */ jsx3("span", { "aria-label": step.label + " " + step.state, style: { position: "relative", zIndex: 1, display: "grid", placeItems: "center", width: 40, height: 40, border: step.state === "current" ? "1px solid #0f1d3a" : "1px solid #8190a4", borderRadius: "50%", background: step.state === "complete" ? "#0f1d3a" : "#fff", color: step.state === "complete" ? "#fff" : "#0f1d3a", fontWeight: 700 }, children: step.state === "complete" ? "\u2713" : index + 1 }),
|
|
711
|
-
/* @__PURE__ */ jsx3("strong", { style: { fontSize: 14 }, children: step.label })
|
|
712
|
-
] }, step.id)) }) });
|
|
713
|
-
}
|
|
714
|
-
function ShippingTimeline2({ events }) {
|
|
715
|
-
if (!events.length) return /* @__PURE__ */ jsx3("p", { style: { margin: 0, color: "#6b6b6b" }, children: "Shipping events will appear when the carrier publishes them." });
|
|
716
|
-
return /* @__PURE__ */ jsx3("ol", { "aria-label": "Shipping events", style: { display: "grid", gap: 22, margin: 0, padding: 0, listStyle: "none" }, children: events.map((event, index) => /* @__PURE__ */ jsxs3("li", { style: { display: "grid", gridTemplateColumns: "22px 1fr", columnGap: 14, position: "relative" }, children: [
|
|
717
|
-
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", style: { position: "relative", zIndex: 1, width: 14, height: 14, marginTop: 4, borderRadius: "50%", background: event.state === "current" || index === 0 ? "#42b765" : "#d5dfed" } }),
|
|
718
|
-
index < events.length - 1 ? /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", style: { position: "absolute", left: 6, top: 18, bottom: -26, width: 2, background: "#e0e7f0" } }) : null,
|
|
719
|
-
/* @__PURE__ */ jsxs3("div", { children: [
|
|
720
|
-
/* @__PURE__ */ jsx3("strong", { style: { color: index === 0 ? "#cb4d34" : "#51657f" }, children: event.title }),
|
|
721
|
-
event.detail ? /* @__PURE__ */ jsx3("p", { style: { margin: "4px 0", color: "#6b6b6b" }, children: event.detail }) : null,
|
|
722
|
-
event.at ? /* @__PURE__ */ jsx3("small", { style: { color: "#8a9ab0" }, children: event.at }) : null
|
|
723
|
-
] })
|
|
724
|
-
] }, event.id)) });
|
|
725
|
-
}
|
|
726
2006
|
function PackageContents2({ items }) {
|
|
727
|
-
if (!items?.length) return /* @__PURE__ */
|
|
728
|
-
return /* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
/* @__PURE__ */
|
|
731
|
-
/* @__PURE__ */
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
2007
|
+
if (!items?.length) return /* @__PURE__ */ jsx5("p", { style: { margin: 0, color: "#6b6b6b" }, children: "Package contents are not available for this shipment." });
|
|
2008
|
+
return /* @__PURE__ */ jsx5("div", { style: { display: "grid", gap: 16 }, children: items.map((item) => /* @__PURE__ */ jsxs5("article", { style: { display: "flex", alignItems: "flex-start", gap: 14, minWidth: 0 }, children: [
|
|
2009
|
+
/* @__PURE__ */ jsx5(ProductImage2, { src: item.imageUrl, alt: item.title }),
|
|
2010
|
+
/* @__PURE__ */ jsxs5("div", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
2011
|
+
/* @__PURE__ */ jsx5("strong", { children: item.title }),
|
|
2012
|
+
/* @__PURE__ */ jsx5("p", { style: { margin: "5px 0", color: "#6b6b6b", fontSize: 14 }, children: item.description ?? "Product details are available in your order." }),
|
|
2013
|
+
/* @__PURE__ */ jsxs5("small", { style: { color: "#6b6b6b" }, children: [
|
|
734
2014
|
"Qty ",
|
|
735
2015
|
item.quantity
|
|
736
2016
|
] })
|
|
737
2017
|
] })
|
|
738
2018
|
] }, item.id)) });
|
|
739
2019
|
}
|
|
740
|
-
function TrackingResult({ props }) {
|
|
741
|
-
const runtime = useBrandedRuntime();
|
|
742
|
-
const result = runtime.displayedResult;
|
|
743
|
-
if (!result) return null;
|
|
744
|
-
const progress = result.progress?.length ? result.progress : defaultProgress2(result.status);
|
|
745
|
-
const events = result.events?.length ? result.events : result.latestEvent ? [{ id: "latest", title: result.latestEvent, at: result.updatedAt, state: "current" }] : [];
|
|
746
|
-
return /* @__PURE__ */ jsxs3("section", { "aria-label": "Tracking result", style: { background: "#fff", borderTop: "1px solid #edf0f4", color: "#101828", fontFamily: "var(--pb-font-family)", padding: "clamp(36px, 6vw, 64px) 0" }, children: [
|
|
747
|
-
/* @__PURE__ */ jsxs3("div", { style: contentWidth2, children: [
|
|
748
|
-
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: 16, flexWrap: "wrap", textAlign: "center" }, children: [
|
|
749
|
-
/* @__PURE__ */ jsxs3("p", { style: { flex: "1 1 360px", margin: 0, fontSize: "clamp(18px, 2vw, 28px)" }, children: [
|
|
750
|
-
"Tracking: ",
|
|
751
|
-
result.trackingNumber
|
|
752
|
-
] }),
|
|
753
|
-
/* @__PURE__ */ jsx3("button", { type: "button", onClick: runtime.reset, style: { padding: "8px 12px", border: "1px solid #cbd5e1", borderRadius: 6, background: "#fff", color: "#101828", font: "inherit", cursor: "pointer" }, children: text3(props, "trackAnotherLabel", "Track another order") })
|
|
754
|
-
] }),
|
|
755
|
-
/* @__PURE__ */ jsx3("h1", { style: { margin: "54px 0 0", fontSize: "clamp(36px, 5vw, 56px)", lineHeight: 1.1, textAlign: "center" }, children: result.status }),
|
|
756
|
-
/* @__PURE__ */ jsx3(TrackingProgress2, { steps: progress })
|
|
757
|
-
] }),
|
|
758
|
-
/* @__PURE__ */ jsx3("div", { style: { borderTop: "1px solid #edf0f4", marginTop: "clamp(28px, 5vw, 54px)", paddingTop: "clamp(36px, 5vw, 60px)" }, children: /* @__PURE__ */ jsxs3("div", { style: { ...contentWidth2, display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 340px), 1fr))", gap: "clamp(36px, 8vw, 120px)" }, children: [
|
|
759
|
-
/* @__PURE__ */ jsxs3("section", { "aria-label": "Shipping details", children: [
|
|
760
|
-
/* @__PURE__ */ jsx3("h2", { style: { margin: "0 0 28px", fontSize: 28 }, children: "Shipping Details" }),
|
|
761
|
-
/* @__PURE__ */ jsx3(ShippingTimeline2, { events })
|
|
762
|
-
] }),
|
|
763
|
-
/* @__PURE__ */ jsxs3("section", { "aria-label": "Package contents", children: [
|
|
764
|
-
/* @__PURE__ */ jsx3("h2", { style: { margin: "0 0 28px", fontSize: 28 }, children: "Package Contents" }),
|
|
765
|
-
/* @__PURE__ */ jsx3(PackageContents2, { items: result.orderItems })
|
|
766
|
-
] })
|
|
767
|
-
] }) })
|
|
768
|
-
] });
|
|
769
|
-
}
|
|
770
2020
|
function BrandedTextField({ value, onChange }) {
|
|
771
|
-
return /* @__PURE__ */
|
|
2021
|
+
return /* @__PURE__ */ jsx5("input", { "aria-label": "Branded text", value: typeof value === "string" ? value : "", onChange: (event) => onChange(event.target.value) });
|
|
772
2022
|
}
|
|
773
2023
|
function InlineText2({ block, name, fallback }) {
|
|
774
2024
|
const value = text3(block, name, fallback);
|
|
775
|
-
if (!block.selected) return /* @__PURE__ */
|
|
776
|
-
return /* @__PURE__ */
|
|
2025
|
+
if (!block.selected) return /* @__PURE__ */ jsx5("span", { "data-branded-editor-field": name, children: value });
|
|
2026
|
+
return /* @__PURE__ */ jsx5(
|
|
777
2027
|
"input",
|
|
778
2028
|
{
|
|
779
2029
|
"aria-label": "Canvas " + name,
|
|
@@ -782,104 +2032,132 @@ function InlineText2({ block, name, fallback }) {
|
|
|
782
2032
|
onMouseDown: (event) => event.stopPropagation(),
|
|
783
2033
|
onClick: (event) => event.stopPropagation(),
|
|
784
2034
|
onChange: (event) => block.onPropsChange({ [name]: event.currentTarget.value }),
|
|
785
|
-
style: {
|
|
2035
|
+
style: {
|
|
2036
|
+
display: "inline-block",
|
|
2037
|
+
width: "100%",
|
|
2038
|
+
minWidth: "5ch",
|
|
2039
|
+
boxSizing: "border-box",
|
|
2040
|
+
/* border: "1px dashed currentColor", */
|
|
2041
|
+
border: "none",
|
|
2042
|
+
borderRadius: 3,
|
|
2043
|
+
padding: "2px 5px",
|
|
2044
|
+
background: "transparent",
|
|
2045
|
+
color: "inherit",
|
|
2046
|
+
font: "inherit",
|
|
2047
|
+
fontWeight: "inherit",
|
|
2048
|
+
lineHeight: "inherit",
|
|
2049
|
+
letterSpacing: "inherit",
|
|
2050
|
+
textAlign: "inherit"
|
|
2051
|
+
}
|
|
786
2052
|
}
|
|
787
2053
|
);
|
|
788
2054
|
}
|
|
789
2055
|
function EditorSurface({ block, children }) {
|
|
790
|
-
return /* @__PURE__ */
|
|
2056
|
+
return /* @__PURE__ */ jsx5("section", { "aria-label": "Branded editor preview", style: { ...cardStyle, outline: block.selected ? "2px solid #2563eb" : "1px dashed #cbd5e1", outlineOffset: -2, padding: 24 }, children });
|
|
791
2057
|
}
|
|
792
2058
|
function BrandedAnnouncementEditor(block) {
|
|
793
|
-
return /* @__PURE__ */
|
|
2059
|
+
return /* @__PURE__ */ jsx5("section", { "aria-label": "Branded announcement editor", style: { minHeight: 36, display: "grid", placeItems: "center", padding: "0 16px", background: "#252525", color: "#fff", fontFamily: "var(--pb-font-family)", fontSize: 12, textAlign: "center" }, children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "message", fallback: "Check out our summer sale" }) });
|
|
794
2060
|
}
|
|
795
2061
|
function BrandedTrackingExperienceEditor(block) {
|
|
796
2062
|
const labels = shipmentLabels(block.shipmentLabels);
|
|
797
|
-
return /* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
803
|
-
/* @__PURE__ */
|
|
2063
|
+
return /* @__PURE__ */ jsxs5("section", { "aria-label": "Branded tracking experience editor", style: { background: "#fffdf0", fontFamily: "var(--pb-font-family)" }, children: [
|
|
2064
|
+
/* @__PURE__ */ jsx5("div", { style: { ...contentWidth2, minHeight: 56, display: "flex", alignItems: "center", gap: 8, overflowX: "auto" }, children: labels.map((shipment, index) => /* @__PURE__ */ jsx5("span", { style: { minWidth: 92, padding: "9px 12px", border: index === 0 ? "1px solid #1a1a1a" : "1px solid #e7e7e7", borderRadius: 4, background: "#fff", fontSize: 11, fontWeight: index === 0 ? 700 : 400 }, children: shipment.label }, shipment.id)) }),
|
|
2065
|
+
/* @__PURE__ */ jsx5("div", { style: { minHeight: 360, display: "grid", placeItems: "center", padding: 16, background: "linear-gradient(135deg, #dedbd4, #b9b3aa)" }, children: /* @__PURE__ */ jsxs5(EditorSurface, { block, children: [
|
|
2066
|
+
/* @__PURE__ */ jsx5("h1", { style: { margin: "0 0 28px", textAlign: "center", fontSize: 32 }, children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "heading", fallback: "Track your order" }) }),
|
|
2067
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", borderBottom: "1px solid #e7e7e7", marginBottom: 20, textAlign: "center" }, children: [
|
|
2068
|
+
/* @__PURE__ */ jsx5("span", { style: { padding: 10 }, children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "orderTabLabel", fallback: "Order Number" }) }),
|
|
2069
|
+
/* @__PURE__ */ jsx5("strong", { style: { padding: 10, borderBottom: "2px solid #0a0a0a" }, children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "trackingTabLabel", fallback: "Tracking Number" }) })
|
|
804
2070
|
] }),
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
|
|
807
|
-
|
|
2071
|
+
/* @__PURE__ */ jsx5("input", { "aria-label": "Canvas default tracking number", readOnly: !block.selected, value: text3(block, "defaultTrackingNumber", "DEMO-YQTRACK9999"), onMouseDown: (event) => block.selected && event.stopPropagation(), onClick: (event) => block.selected && event.stopPropagation(), onChange: (event) => block.onPropsChange({ defaultTrackingNumber: event.currentTarget.value }), style: {
|
|
2072
|
+
width: "100%",
|
|
2073
|
+
height: 44,
|
|
2074
|
+
boxSizing: "border-box",
|
|
2075
|
+
padding: "0 12px",
|
|
2076
|
+
/* border: block.selected ? "1px dashed #0a0a0a" : "1px solid #e2e2e2", */
|
|
2077
|
+
border: "1px solid #e2e2e2",
|
|
2078
|
+
borderRadius: 10,
|
|
2079
|
+
background: "#fff",
|
|
2080
|
+
font: "inherit"
|
|
2081
|
+
} }),
|
|
2082
|
+
/* @__PURE__ */ jsx5("div", { style: { display: "grid", placeItems: "center", minHeight: 46, marginTop: 16, borderRadius: 10, background: "#000", color: "#fff", fontWeight: 700 }, children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "submitLabel", fallback: "Track" }) }),
|
|
2083
|
+
/* @__PURE__ */ jsx5("small", { style: { display: "block", marginTop: 10, color: "#8a8a8a", fontSize: 9, textAlign: "right" }, children: "Powered by BestTrack" })
|
|
808
2084
|
] }) })
|
|
809
2085
|
] });
|
|
810
2086
|
}
|
|
811
2087
|
function BrandedQueryEditor(block) {
|
|
812
|
-
return /* @__PURE__ */
|
|
2088
|
+
return /* @__PURE__ */ jsx5(BrandedTrackingExperienceEditor, { ...block });
|
|
813
2089
|
}
|
|
814
2090
|
function BrandedOrderItemsEditor(block) {
|
|
815
|
-
return /* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
/* @__PURE__ */
|
|
2091
|
+
return /* @__PURE__ */ jsxs5(EditorSurface, { block, children: [
|
|
2092
|
+
/* @__PURE__ */ jsx5("h2", { style: { margin: 0 }, children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "heading", fallback: "What's Inside" }) }),
|
|
2093
|
+
/* @__PURE__ */ jsx5("p", { style: { color: "#6b6b6b" }, children: "Package contents appear after a consumer tracking query." })
|
|
818
2094
|
] });
|
|
819
2095
|
}
|
|
820
2096
|
function BrandedRecommendationsEditor(block) {
|
|
821
|
-
return /* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
823
|
-
/* @__PURE__ */
|
|
2097
|
+
return /* @__PURE__ */ jsxs5(EditorSurface, { block, children: [
|
|
2098
|
+
/* @__PURE__ */ jsx5("h2", { style: { margin: 0, textAlign: "center" }, children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "heading", fallback: "You might also like" }) }),
|
|
2099
|
+
/* @__PURE__ */ jsx5("p", { style: { color: "#6b6b6b", textAlign: "center" }, children: "Recommendations appear with the active shipment." })
|
|
824
2100
|
] });
|
|
825
2101
|
}
|
|
826
2102
|
function BrandedQuickLinksEditor(block) {
|
|
827
|
-
return /* @__PURE__ */
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
2103
|
+
return /* @__PURE__ */ jsxs5(EditorSurface, { block, children: [
|
|
2104
|
+
/* @__PURE__ */ jsx5("h2", { children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "heading", fallback: "Need help?" }) }),
|
|
2105
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", gap: 20 }, children: [
|
|
2106
|
+
/* @__PURE__ */ jsx5(InlineText2, { block, name: "primaryLabel", fallback: "Shipping help" }),
|
|
2107
|
+
/* @__PURE__ */ jsx5(InlineText2, { block, name: "secondaryLabel", fallback: "Contact us" })
|
|
832
2108
|
] })
|
|
833
2109
|
] });
|
|
834
2110
|
}
|
|
835
2111
|
function BrandedBlogEditor(block) {
|
|
836
|
-
return /* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
/* @__PURE__ */
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
2112
|
+
return /* @__PURE__ */ jsxs5(EditorSurface, { block, children: [
|
|
2113
|
+
/* @__PURE__ */ jsx5("h2", { children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "heading", fallback: "From our journal" }) }),
|
|
2114
|
+
/* @__PURE__ */ jsxs5("article", { children: [
|
|
2115
|
+
/* @__PURE__ */ jsx5("strong", { children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "articleTitle", fallback: "Delivery tips for every season" }) }),
|
|
2116
|
+
/* @__PURE__ */ jsx5("p", { children: /* @__PURE__ */ jsx5(InlineText2, { block, name: "excerpt", fallback: "Simple ways to make every delivery feel considered." }) }),
|
|
2117
|
+
/* @__PURE__ */ jsx5(InlineText2, { block, name: "linkLabel", fallback: "Read the story" })
|
|
842
2118
|
] })
|
|
843
2119
|
] });
|
|
844
2120
|
}
|
|
845
2121
|
function BrandedAnnouncementBlock(props) {
|
|
846
2122
|
const message = text3(props, "message", "");
|
|
2123
|
+
const href = safeHref2(props.href);
|
|
847
2124
|
if (!message) return null;
|
|
848
|
-
return /* @__PURE__ */
|
|
2125
|
+
return /* @__PURE__ */ jsx5("section", { "aria-label": "Branded announcement", style: { minHeight: 36, display: "grid", placeItems: "center", padding: "0 16px", background: "#252525", color: "#fff", fontFamily: "var(--pb-font-family)", fontSize: 12, textAlign: "center" }, children: href ? /* @__PURE__ */ jsx5("a", { href, style: { color: "inherit", textDecoration: "none" }, children: message }) : message });
|
|
849
2126
|
}
|
|
850
2127
|
function BrandedTrackingExperienceBlock(props) {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
runtime.phase === "success" ? /* @__PURE__ */ jsx3(TrackingResult, { props }) : /* @__PURE__ */ jsx3(QueryHero, { ...props })
|
|
2128
|
+
return /* @__PURE__ */ jsxs5("section", { "aria-label": "Branded tracking experience", style: { background: "#fffdf0", fontFamily: "var(--pb-font-family)" }, children: [
|
|
2129
|
+
/* @__PURE__ */ jsx5(ShipmentSwitcher, { shipmentLabels: props.shipmentLabels }),
|
|
2130
|
+
/* @__PURE__ */ jsx5(QueryHero, { ...props })
|
|
855
2131
|
] });
|
|
856
2132
|
}
|
|
857
2133
|
function BrandedQueryBlock(props) {
|
|
858
|
-
return /* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
2134
|
+
return /* @__PURE__ */ jsxs5("section", { "aria-label": "Branded tracking query", style: { background: "#fffdf0", fontFamily: "var(--pb-font-family)" }, children: [
|
|
2135
|
+
/* @__PURE__ */ jsx5(ShipmentSwitcher, { shipmentLabels: props.shipmentLabels }),
|
|
2136
|
+
/* @__PURE__ */ jsx5(QueryHero, { ...props })
|
|
861
2137
|
] });
|
|
862
2138
|
}
|
|
863
2139
|
function BrandedOrderItemsBlock(props) {
|
|
864
2140
|
const runtime = useBrandedRuntime();
|
|
865
2141
|
const items = runtime.displayedResult?.orderItems ?? [];
|
|
866
2142
|
const title = text3(props, "heading", "What's Inside");
|
|
867
|
-
return /* @__PURE__ */
|
|
868
|
-
/* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsx5("section", { "aria-label": title, style: { background: "#fffdf0", color: "#0a0a0a", fontFamily: "var(--pb-font-family)", padding: "clamp(28px, 4vw, 48px) 0" }, children: /* @__PURE__ */ jsxs5("div", { style: contentWidth2, children: [
|
|
2144
|
+
/* @__PURE__ */ jsxs5("h2", { style: { margin: "0 0 20px", fontSize: 20 }, children: [
|
|
869
2145
|
title,
|
|
870
2146
|
runtime.phase === "success" ? " (" + items.length + ")" : ""
|
|
871
2147
|
] }),
|
|
872
|
-
runtime.phase === "success" ? /* @__PURE__ */
|
|
2148
|
+
runtime.phase === "success" ? /* @__PURE__ */ jsx5(PackageContents2, { items }) : /* @__PURE__ */ jsx5("p", { style: { margin: 0, color: runtime.phase === "error" ? "#b42318" : "#6b6b6b" }, children: runtime.phase === "error" ? "Order items are temporarily unavailable." : "Track an order to see what is inside." })
|
|
873
2149
|
] }) });
|
|
874
2150
|
}
|
|
875
2151
|
function RecommendationCard({ item }) {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
2152
|
+
const href = safeHref2(item.href);
|
|
2153
|
+
const price = item.price ? formatTrackingPageMoney(item.price) : void 0;
|
|
2154
|
+
return /* @__PURE__ */ jsxs5("article", { style: { overflow: "hidden", borderRadius: 6, background: "#fff", boxShadow: "0 1px 2px rgb(0 0 0 / 8%)" }, children: [
|
|
2155
|
+
/* @__PURE__ */ jsx5(ProductImage2, { src: item.imageUrl, alt: item.title }),
|
|
2156
|
+
/* @__PURE__ */ jsxs5("div", { style: { padding: 14 }, children: [
|
|
2157
|
+
/* @__PURE__ */ jsx5("strong", { children: item.title }),
|
|
2158
|
+
price?.amount ? /* @__PURE__ */ jsx5("p", { style: { margin: "6px 0", fontWeight: 700 }, children: price.amount }) : null,
|
|
2159
|
+
/* @__PURE__ */ jsx5("p", { style: { margin: "6px 0", color: "#6b6b6b", fontSize: 13 }, children: item.description }),
|
|
2160
|
+
!href ? /* @__PURE__ */ jsx5("span", { style: { color: "#6b6b6b", fontSize: 13, fontWeight: 700 }, children: "View product" }) : /* @__PURE__ */ jsx5("a", { href, style: { color: "#0a0a0a", fontSize: 13, fontWeight: 700 }, children: "View product" })
|
|
883
2161
|
] })
|
|
884
2162
|
] });
|
|
885
2163
|
}
|
|
@@ -887,199 +2165,573 @@ function BrandedRecommendationsBlock(props) {
|
|
|
887
2165
|
const runtime = useBrandedRuntime();
|
|
888
2166
|
const recommendations = runtime.displayedResult?.recommendations ?? [];
|
|
889
2167
|
const title = text3(props, "heading", "You might also like");
|
|
890
|
-
if (runtime.phase === "success" && !recommendations.length && text3(props, "hideWhenEmpty", "false") === "true") return null;
|
|
891
|
-
return /* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
runtime.phase === "loading" ? /* @__PURE__ */
|
|
2168
|
+
if ((runtime.phase === "success" || runtime.phase === "empty") && !recommendations.length && text3(props, "hideWhenEmpty", "false") === "true") return null;
|
|
2169
|
+
return /* @__PURE__ */ jsx5("section", { "aria-label": title, style: { background: "#fffdf0", color: "#0a0a0a", fontFamily: "var(--pb-font-family)", padding: "clamp(28px, 4vw, 48px) 0" }, children: /* @__PURE__ */ jsxs5("div", { style: contentWidth2, children: [
|
|
2170
|
+
/* @__PURE__ */ jsx5("h2", { style: { margin: "0 0 24px", textAlign: "center", fontSize: 20 }, children: title }),
|
|
2171
|
+
runtime.phase === "loading" ? /* @__PURE__ */ jsx5("div", { "aria-label": "Loading recommendations", style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))", gap: 16 }, children: [0, 1, 2].map((item) => /* @__PURE__ */ jsx5("span", { style: { display: "block", height: 220, borderRadius: 6, background: "#e7e7e7" } }, item)) }) : runtime.phase === "success" && recommendations.length ? /* @__PURE__ */ jsx5("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))", gap: 16 }, children: recommendations.map((item) => /* @__PURE__ */ jsx5(RecommendationCard, { item }, item.id)) }) : /* @__PURE__ */ jsx5("p", { style: { margin: 0, textAlign: "center", color: runtime.phase === "error" ? "#b42318" : "#6b6b6b" }, children: runtime.phase === "error" ? "Recommendations are temporarily unavailable." : runtime.phase === "empty" ? "No recommendations are available for that number." : "Recommendations will appear with your order." })
|
|
894
2172
|
] }) });
|
|
895
2173
|
}
|
|
896
2174
|
function BrandedQuickLinksBlock(props) {
|
|
897
2175
|
const title = text3(props, "heading", "Need help?");
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
2176
|
+
const primaryHref = safeHref2(props.primaryHref);
|
|
2177
|
+
const secondaryHref = safeHref2(props.secondaryHref);
|
|
2178
|
+
return /* @__PURE__ */ jsxs5("section", { "aria-label": title, style: { ...cardStyle, margin: "24px auto", maxWidth: 1200, padding: 24 }, children: [
|
|
2179
|
+
/* @__PURE__ */ jsx5("h2", { children: title }),
|
|
2180
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))", gap: 16 }, children: [
|
|
2181
|
+
primaryHref ? /* @__PURE__ */ jsx5("a", { href: primaryHref, style: { color: "#0a0a0a" }, children: text3(props, "primaryLabel", "Shipping help") }) : /* @__PURE__ */ jsx5("span", { children: text3(props, "primaryLabel", "Shipping help") }),
|
|
2182
|
+
secondaryHref ? /* @__PURE__ */ jsx5("a", { href: secondaryHref, style: { color: "#0a0a0a" }, children: text3(props, "secondaryLabel", "Contact us") }) : /* @__PURE__ */ jsx5("span", { children: text3(props, "secondaryLabel", "Contact us") })
|
|
903
2183
|
] })
|
|
904
2184
|
] });
|
|
905
2185
|
}
|
|
906
2186
|
function BrandedBlogBlock(props) {
|
|
907
2187
|
const title = text3(props, "heading", "From our journal");
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
2188
|
+
const href = safeHref2(props.articleHref);
|
|
2189
|
+
return /* @__PURE__ */ jsxs5("section", { "aria-label": title, style: { ...cardStyle, margin: "24px auto", maxWidth: 1200, padding: 24 }, children: [
|
|
2190
|
+
/* @__PURE__ */ jsx5("h2", { children: title }),
|
|
2191
|
+
/* @__PURE__ */ jsxs5("article", { children: [
|
|
2192
|
+
/* @__PURE__ */ jsx5("strong", { children: text3(props, "articleTitle", "Delivery tips for every season") }),
|
|
2193
|
+
/* @__PURE__ */ jsx5("p", { children: text3(props, "excerpt", "Simple ways to make every delivery feel considered.") }),
|
|
2194
|
+
href ? /* @__PURE__ */ jsx5("a", { href, style: { color: "#0a0a0a" }, children: text3(props, "linkLabel", "Read the story") }) : /* @__PURE__ */ jsx5("span", { children: text3(props, "linkLabel", "Read the story") })
|
|
914
2195
|
] })
|
|
915
2196
|
] });
|
|
916
2197
|
}
|
|
917
2198
|
|
|
918
2199
|
// src/branded-definition.ts
|
|
919
2200
|
var text4 = (label, options = {}) => ({ field: "besttrack.branded.text", label, control: "text", ...options });
|
|
920
|
-
var
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
2201
|
+
var httpsUrl = (label) => text4(label, { control: "url", validation: { allowRelativeUrl: false, allowedUrlProtocols: ["https:"], allowLocalhost: true } });
|
|
2202
|
+
function withTemplatePolicy2(blocks, protectedBlocks) {
|
|
2203
|
+
return blocks.map((block) => ({ ...block, policy: { singleton: true, ...protectedBlocks.includes(block.type) ? { required: true, allowDelete: false } : {} } }));
|
|
2204
|
+
}
|
|
2205
|
+
var brandedBlocks = withTemplatePolicy2([
|
|
2206
|
+
{ type: "besttrack.branded.announcement", version: 1, label: "Announcement", category: "BestTrack Branded", targets: ["web"], defaultProps: { message: "Check out our summer sale", href: "https://example.com/collections/sale" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }, { id: "minimal", label: "Minimal", theme: { "color.primary": "#202223" } }], fields: { message: text4("Announcement", { control: "textarea" }), href: httpsUrl("Announcement URL") }, render: { web: BrandedAnnouncementBlock, editor: BrandedAnnouncementEditor } },
|
|
2207
|
+
{ type: "besttrack.branded.tracking-experience", version: 1, label: "Tracking experience", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "Track your order", submitLabel: "Track", trackAnotherLabel: "Track another order", defaultTrackingNumber: "DEMO-YQTRACK9999", defaultOrderNumber: "", defaultQueryMode: "tracking", trackingTabLabel: "Tracking Number", orderTabLabel: "Order Number", shipmentLabels: "Shipment #1|Shipment #2|Shipment #3", heroImageUrl: "https://images.unsplash.com/photo-1596462502278-27bfdc403348?auto=format&fit=crop&w=1600&q=85" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }, { id: "compact", label: "Compact", theme: { spacing: "12px" } }], fields: { heading: text4("Heading"), submitLabel: text4("Button label"), trackAnotherLabel: text4("Track another label"), defaultTrackingNumber: text4("Default tracking number"), defaultOrderNumber: text4("Default order number"), defaultQueryMode: text4("Default query mode"), trackingTabLabel: text4("Tracking tab label"), orderTabLabel: text4("Order tab label"), shipmentLabels: text4("Shipment labels (separate with |)"), heroImageUrl: httpsUrl("Hero image URL") }, render: { web: BrandedTrackingExperienceBlock, editor: BrandedTrackingExperienceEditor } },
|
|
2208
|
+
{ type: "besttrack.branded.query", version: 1, label: "Order query", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "Track your order", submitLabel: "Track", defaultTrackingNumber: "DEMO-YQTRACK9999", defaultOrderNumber: "", defaultQueryMode: "tracking", trackingTabLabel: "Tracking Number", orderTabLabel: "Order Number", shipmentLabels: "Shipment #1|Shipment #2|Shipment #3", heroImageUrl: "https://images.unsplash.com/photo-1596462502278-27bfdc403348?auto=format&fit=crop&w=1600&q=85" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }, { id: "compact", label: "Compact", theme: { spacing: "12px" } }], fields: { heading: text4("Heading"), submitLabel: text4("Button label"), defaultTrackingNumber: text4("Default tracking number"), defaultOrderNumber: text4("Default order number"), defaultQueryMode: text4("Default query mode"), trackingTabLabel: text4("Tracking tab label"), orderTabLabel: text4("Order tab label"), shipmentLabels: text4("Shipment labels (separate with |)"), heroImageUrl: httpsUrl("Hero image URL") }, render: { web: BrandedQueryBlock, editor: BrandedQueryEditor } },
|
|
924
2209
|
{ type: "besttrack.branded.order-items", version: 1, label: "Order items", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "What's Inside" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }, { id: "minimal", label: "Minimal" }], fields: { heading: text4("Heading") }, render: { web: BrandedOrderItemsBlock, editor: BrandedOrderItemsEditor } },
|
|
925
2210
|
{ type: "besttrack.branded.recommendations", version: 1, label: "Recommended products", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "You might also like", hideWhenEmpty: "false" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }, { id: "editorial", label: "Editorial", theme: { "color.surface": "#fffdf0" } }], fields: { heading: text4("Heading"), hideWhenEmpty: text4("Hide when empty (true/false)") }, render: { web: BrandedRecommendationsBlock, editor: BrandedRecommendationsEditor } },
|
|
926
|
-
{ type: "besttrack.branded.quick-links", version: 1, label: "Quick links", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "Need help?", primaryLabel: "Shipping help", primaryHref: "/pages/shipping", secondaryLabel: "Contact us", secondaryHref: "/pages/contact" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }], fields: { heading: text4("Heading"), primaryLabel: text4("Primary link label"), primaryHref:
|
|
927
|
-
{ type: "besttrack.branded.blog", version: 1, label: "Blog", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "From our journal", articleTitle: "Delivery tips for every season", excerpt: "Simple ways to make every delivery feel considered.", articleHref: "/blogs/news", linkLabel: "Read the story" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }], fields: { heading: text4("Heading"), articleTitle: text4("Article title"), excerpt: text4("Excerpt", { control: "textarea" }), articleHref:
|
|
928
|
-
];
|
|
2211
|
+
{ type: "besttrack.branded.quick-links", version: 1, label: "Quick links", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "Need help?", primaryLabel: "Shipping help", primaryHref: "https://example.com/pages/shipping", secondaryLabel: "Contact us", secondaryHref: "https://example.com/pages/contact" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }], fields: { heading: text4("Heading"), primaryLabel: text4("Primary link label"), primaryHref: httpsUrl("Primary link URL"), secondaryLabel: text4("Secondary link label"), secondaryHref: httpsUrl("Secondary link URL") }, render: { web: BrandedQuickLinksBlock, editor: BrandedQuickLinksEditor } },
|
|
2212
|
+
{ type: "besttrack.branded.blog", version: 1, label: "Blog", category: "BestTrack Branded", targets: ["web"], defaultProps: { heading: "From our journal", articleTitle: "Delivery tips for every season", excerpt: "Simple ways to make every delivery feel considered.", articleHref: "https://example.com/blogs/news", linkLabel: "Read the story" }, defaultVariant: "brand", variants: [{ id: "brand", label: "Brand" }], fields: { heading: text4("Heading"), articleTitle: text4("Article title"), excerpt: text4("Excerpt", { control: "textarea" }), articleHref: httpsUrl("Article URL"), linkLabel: text4("Link label") }, render: { web: BrandedBlogBlock, editor: BrandedBlogEditor } }
|
|
2213
|
+
], ["besttrack.branded.announcement", "besttrack.branded.tracking-experience"]);
|
|
2214
|
+
var brandedDefaultBlockTypes = brandedBlocks.filter((block) => !["besttrack.branded.query", "besttrack.branded.order-items"].includes(block.type)).map((block) => block.type);
|
|
2215
|
+
var brandedTemplatePolicy = defineTemplatePolicy(
|
|
2216
|
+
"besttrack.branded",
|
|
2217
|
+
"Branded",
|
|
2218
|
+
brandedDefaultBlockTypes,
|
|
2219
|
+
["besttrack.branded.announcement", "besttrack.branded.tracking-experience"]
|
|
2220
|
+
);
|
|
929
2221
|
function createBrandedTemplate() {
|
|
930
|
-
const templateBlocks = brandedBlocks.filter((block) =>
|
|
2222
|
+
const templateBlocks = brandedBlocks.filter((block) => brandedDefaultBlockTypes.includes(block.type));
|
|
931
2223
|
return { id: "besttrack.branded", version: 1, name: "Branded", target: "web", source: "built-in", requiredBlocks: templateBlocks.map((block) => block.type), theme: { "color.primary": "#000000", "color.background": "#fffdf0", "color.surface": "#ffffff", "color.text": "#0a0a0a", "color.muted": "#6b6b6b", "color.border": "#e7e7e7", "font.family": "Arial, Helvetica, sans-serif", radius: "10px", spacing: "24px" }, create: () => createPageDocument2({ pageId: "besttrack-branded", target: "web", templateId: "besttrack.branded", templateVersion: 1, settings: { locale: "en", seoTitle: "Track your order" }, blocks: templateBlocks.map((block, index) => ({ id: "branded-" + (index + 1), type: block.type, version: block.version, props: block.defaultProps, variant: block.defaultVariant, style: {} })) }) };
|
|
932
2224
|
}
|
|
933
|
-
var bestTrackBrandedExtension = Object.freeze({ name: "besttrack.branded", version: "0.
|
|
2225
|
+
var bestTrackBrandedExtension = Object.freeze({ name: "besttrack.branded", version: "0.8.0", fields: [{ type: "besttrack.branded.text", component: BrandedTextField }], blocks: brandedBlocks, templates: [createBrandedTemplate()] });
|
|
934
2226
|
|
|
935
2227
|
// src/sales-definition.ts
|
|
936
2228
|
import { createPageDocument as createPageDocument3 } from "@standhigher/puck-page-builder/runtime";
|
|
937
2229
|
|
|
938
2230
|
// src/sales.tsx
|
|
939
|
-
import { createContext as createContext3, useCallback as useCallback3, useContext as useContext3, useMemo as useMemo3, useState as
|
|
940
|
-
import { jsx as
|
|
2231
|
+
import { createContext as createContext3, useCallback as useCallback3, useContext as useContext3, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
2232
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
941
2233
|
var initialRuntime3 = { phase: "idle", async query() {
|
|
942
2234
|
return void 0;
|
|
943
2235
|
} };
|
|
944
2236
|
var SalesRuntimeContext = createContext3(initialRuntime3);
|
|
945
|
-
var
|
|
946
|
-
var
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
2237
|
+
var contentWidth3 = { boxSizing: "border-box", width: "min(1120px, calc(100% - 32px))", margin: "0 auto" };
|
|
2238
|
+
var sectionStyle = { ...contentWidth3, marginTop: "clamp(32px, 6vw, 72px)", color: "var(--pb-color-text)", fontFamily: "var(--pb-font-family)" };
|
|
2239
|
+
var panelStyle = { boxSizing: "border-box", border: "1px solid var(--pb-color-border)", borderRadius: "var(--pb-radius)", padding: "clamp(20px, 3vw, 32px)", background: "var(--pb-color-surface)", color: "var(--pb-color-text)", overflowWrap: "anywhere" };
|
|
2240
|
+
var gridStyle = { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 220px), 1fr))", gap: "clamp(16px, 2vw, 24px)" };
|
|
2241
|
+
function SalesRuntimeProvider({ children, query: injectedQuery, watermark, resourceResolution }) {
|
|
2242
|
+
const [state, setState] = useState5({ phase: "idle" });
|
|
2243
|
+
const requestId = useRef4(0);
|
|
2244
|
+
const query = useCallback3(async (request) => {
|
|
2245
|
+
const currentRequestId = ++requestId.current;
|
|
950
2246
|
setState({ phase: "loading" });
|
|
951
2247
|
try {
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
2248
|
+
if (!injectedQuery) throw new Error("tracking-query-not-configured");
|
|
2249
|
+
const result = await injectedQuery(request);
|
|
2250
|
+
if (currentRequestId !== requestId.current) return;
|
|
2251
|
+
setState({ phase: isEmptyTrackingPageResult(result) ? "empty" : "success", result });
|
|
2252
|
+
} catch {
|
|
2253
|
+
if (currentRequestId !== requestId.current) return;
|
|
2254
|
+
setState({ phase: "error" });
|
|
955
2255
|
}
|
|
956
|
-
}, [
|
|
957
|
-
const value = useMemo3(() => ({ ...state, query }), [query, state]);
|
|
958
|
-
return /* @__PURE__ */
|
|
2256
|
+
}, [injectedQuery]);
|
|
2257
|
+
const value = useMemo3(() => ({ ...state, query, watermark, resourceResolution }), [query, resourceResolution, state, watermark]);
|
|
2258
|
+
return /* @__PURE__ */ jsx6(SalesRuntimeContext.Provider, { value, children });
|
|
959
2259
|
}
|
|
960
2260
|
function useSalesRuntime() {
|
|
961
2261
|
return useContext3(SalesRuntimeContext);
|
|
962
2262
|
}
|
|
2263
|
+
function RuntimeWatermark3({ watermark }) {
|
|
2264
|
+
return watermark?.visible ? /* @__PURE__ */ jsx6("small", { style: { display: "block", marginTop: 14, color: "var(--pb-color-muted)", fontSize: 11, textAlign: "right" }, children: watermark.label || "Powered by BestTrack" }) : null;
|
|
2265
|
+
}
|
|
963
2266
|
function text5(props, key, fallback) {
|
|
964
|
-
|
|
2267
|
+
const value = props[key];
|
|
2268
|
+
return typeof value === "string" && value.trim() ? value.trim() : fallback;
|
|
965
2269
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
const url = new URL(value);
|
|
971
|
-
return url.protocol === "https:" || url.protocol === "http:" ? url.toString() : "#";
|
|
972
|
-
} catch {
|
|
973
|
-
return "#";
|
|
974
|
-
}
|
|
2270
|
+
var safeHref3 = safeTrackingPageUrl;
|
|
2271
|
+
var safeImageUrl3 = safeTrackingPageUrl;
|
|
2272
|
+
function Status({ children, alert = false }) {
|
|
2273
|
+
return /* @__PURE__ */ jsx6("p", { role: alert ? "alert" : "status", "aria-live": alert ? "assertive" : "polite", style: { margin: "16px 0 0", color: alert ? "#a61b1b" : "var(--pb-color-muted)" }, children });
|
|
975
2274
|
}
|
|
976
|
-
function Section({ title, children }) {
|
|
977
|
-
return /* @__PURE__ */
|
|
978
|
-
/* @__PURE__ */
|
|
2275
|
+
function Section({ title, children, busy = false }) {
|
|
2276
|
+
return /* @__PURE__ */ jsx6("section", { "aria-label": title, "aria-busy": busy || void 0, style: sectionStyle, children: /* @__PURE__ */ jsxs6("div", { style: panelStyle, children: [
|
|
2277
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: "0 0 20px", fontSize: "clamp(24px, 3vw, 34px)", lineHeight: 1.15 }, children: title }),
|
|
979
2278
|
children
|
|
980
|
-
] });
|
|
2279
|
+
] }) });
|
|
2280
|
+
}
|
|
2281
|
+
function ProductImage3({ src, alt }) {
|
|
2282
|
+
const [failed, setFailed] = useState5(false);
|
|
2283
|
+
const safeSrc = safeImageUrl3(src);
|
|
2284
|
+
if (!safeSrc || failed) return /* @__PURE__ */ jsx6("span", { "aria-label": `${alt} image unavailable`, role: "img", style: { display: "grid", placeItems: "center", width: 76, height: 76, flex: "0 0 auto", border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)", color: "var(--pb-color-muted)", fontWeight: 700 }, children: alt.slice(0, 1).toUpperCase() });
|
|
2285
|
+
return /* @__PURE__ */ jsx6("img", { src: safeSrc, alt, onError: () => setFailed(true), style: { width: 76, height: 76, flex: "0 0 auto", borderRadius: "calc(var(--pb-radius) / 1.5)", objectFit: "cover", background: "var(--pb-color-background)" } });
|
|
981
2286
|
}
|
|
982
|
-
function
|
|
983
|
-
|
|
2287
|
+
function HeroAsset({ src }) {
|
|
2288
|
+
const [failed, setFailed] = useState5(false);
|
|
2289
|
+
const safeSrc = safeImageUrl3(src);
|
|
2290
|
+
if (!safeSrc || failed) return null;
|
|
2291
|
+
return /* @__PURE__ */ jsx6("img", { "data-sales-hero-image": true, src: safeSrc, alt: "", "aria-hidden": "true", onError: () => setFailed(true), style: { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", opacity: 0.62 } });
|
|
984
2292
|
}
|
|
985
2293
|
function SalesTextField({ value, onChange }) {
|
|
986
|
-
return /* @__PURE__ */
|
|
2294
|
+
return /* @__PURE__ */ jsx6("input", { "aria-label": "Sales text", value: typeof value === "string" ? value : "", onChange: (event) => onChange(event.target.value) });
|
|
2295
|
+
}
|
|
2296
|
+
var editorSurfaceStyle = { boxSizing: "border-box", border: "1px solid #dfddd7", borderRadius: 10, padding: 24, background: "#ffffff", color: "#0a0a0a", fontFamily: "Arial, Helvetica, sans-serif" };
|
|
2297
|
+
var editorCardStyle = { boxSizing: "border-box", padding: 18, border: "1px solid #dfddd7", borderRadius: 7, background: "#f7f5f0" };
|
|
2298
|
+
function editorText(block, name, fallback) {
|
|
2299
|
+
return text5(block, name, fallback);
|
|
2300
|
+
}
|
|
2301
|
+
function SalesInlineText({ block, name, fallback, style }) {
|
|
2302
|
+
const value = editorText(block, name, fallback);
|
|
2303
|
+
if (!block.selected) return /* @__PURE__ */ jsx6("span", { "data-sales-editor-field": name, style, children: value });
|
|
2304
|
+
return /* @__PURE__ */ jsx6("input", { "aria-label": `Canvas ${name}`, "data-sales-editor-field": name, value, onMouseDown: (event) => event.stopPropagation(), onClick: (event) => event.stopPropagation(), onChange: (event) => block.onPropsChange({ [name]: event.currentTarget.value }), style: {
|
|
2305
|
+
boxSizing: "border-box",
|
|
2306
|
+
width: "100%",
|
|
2307
|
+
/* border: "1px dashed currentColor", */
|
|
2308
|
+
border: "none",
|
|
2309
|
+
borderRadius: 3,
|
|
2310
|
+
padding: "2px 5px",
|
|
2311
|
+
background: "transparent",
|
|
2312
|
+
color: "inherit",
|
|
2313
|
+
font: "inherit",
|
|
2314
|
+
fontWeight: "inherit",
|
|
2315
|
+
lineHeight: "inherit",
|
|
2316
|
+
textAlign: "inherit",
|
|
2317
|
+
...style
|
|
2318
|
+
} });
|
|
2319
|
+
}
|
|
2320
|
+
function SalesEditorSurface({ block, children }) {
|
|
2321
|
+
return /* @__PURE__ */ jsx6("section", { "aria-label": "Sales editor preview", style: { ...editorSurfaceStyle, outline: block.selected ? "2px solid #2563eb" : void 0, outlineOffset: -2 }, children });
|
|
2322
|
+
}
|
|
2323
|
+
function SalesAnnouncementEditor(block) {
|
|
2324
|
+
return /* @__PURE__ */ jsx6("section", { "aria-label": "Sales announcement editor", style: { display: "grid", minHeight: 38, placeItems: "center", boxSizing: "border-box", padding: "10px 16px", borderBottom: "1px solid #dfddd7", background: "#f7f5f0", color: "#0a0a0a", fontFamily: "Arial, Helvetica, sans-serif", fontSize: 13, fontWeight: 700, textAlign: "center" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "message", fallback: "Free delivery on orders over $50" }) });
|
|
2325
|
+
}
|
|
2326
|
+
function SalesQueryEditor(block) {
|
|
2327
|
+
const imageUrl = safeImageUrl3(block.heroImageUrl);
|
|
2328
|
+
const trackingNumber = editorText(block, "defaultTrackingNumber", "BT-2048-DEMO");
|
|
2329
|
+
return /* @__PURE__ */ jsxs6("section", { "aria-label": "Sales Hero query editor", style: { position: "relative", display: "grid", minHeight: "clamp(460px, 52vw, 620px)", placeItems: "center", boxSizing: "border-box", overflow: "hidden", padding: "clamp(28px, 6vw, 72px) 16px", background: "#0a0a0a", fontFamily: "Arial, Helvetica, sans-serif" }, children: [
|
|
2330
|
+
imageUrl ? /* @__PURE__ */ jsx6("img", { src: imageUrl, alt: "", "aria-hidden": "true", style: { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", opacity: 0.62 } }) : null,
|
|
2331
|
+
/* @__PURE__ */ jsx6("div", { "aria-hidden": "true", style: { position: "absolute", inset: 0, background: "rgb(0 0 0 / 42%)" } }),
|
|
2332
|
+
/* @__PURE__ */ jsxs6("div", { style: { position: "relative", zIndex: 1, boxSizing: "border-box", width: "min(560px, 100%)", padding: "clamp(28px, 5vw, 48px)", borderRadius: 10, background: "#ffffff", color: "#0a0a0a", boxShadow: "0 20px 56px rgb(0 0 0 / 28%)" }, children: [
|
|
2333
|
+
/* @__PURE__ */ jsx6("h1", { style: { margin: "0 0 28px", fontSize: "clamp(32px, 5vw, 48px)", fontWeight: 800, letterSpacing: "-0.035em", lineHeight: 1.02, textAlign: "center" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "heading", fallback: "Track your order" }) }),
|
|
2334
|
+
/* @__PURE__ */ jsx6("input", { "aria-label": "Canvas default tracking number", readOnly: !block.selected, value: trackingNumber, onMouseDown: (event) => block.selected && event.stopPropagation(), onClick: (event) => block.selected && event.stopPropagation(), onChange: (event) => block.onPropsChange({ defaultTrackingNumber: event.currentTarget.value }), style: { boxSizing: "border-box", width: "100%", minHeight: 58, padding: "12px 16px", border: "1px solid #dfddd7", borderRadius: 8, background: "#ffffff", color: "#0a0a0a", font: "inherit", fontSize: 17 } }),
|
|
2335
|
+
/* @__PURE__ */ jsx6("div", { style: { display: "grid", minHeight: 58, placeItems: "center", marginTop: 14, padding: "12px 18px", borderRadius: 8, background: "#0a0a0a", color: "#ffffff", fontSize: 16, fontWeight: 700 }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "submitLabel", fallback: "Track order" }) }),
|
|
2336
|
+
/* @__PURE__ */ jsx6("small", { style: { display: "block", marginTop: 14, color: "#6b6b6b", fontSize: 11, textAlign: "right" }, children: "Powered by BestTrack" })
|
|
2337
|
+
] })
|
|
2338
|
+
] });
|
|
2339
|
+
}
|
|
2340
|
+
function SalesOrderItemsEditor(block) {
|
|
2341
|
+
return /* @__PURE__ */ jsxs6(SalesEditorSurface, { block, children: [
|
|
2342
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: "0 0 20px" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "heading", fallback: "Items in your order" }) }),
|
|
2343
|
+
/* @__PURE__ */ jsxs6("article", { style: { ...editorCardStyle, display: "flex", alignItems: "center", gap: 14 }, children: [
|
|
2344
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", style: { width: 68, height: 68, borderRadius: 7, background: "#dfddd7" } }),
|
|
2345
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2346
|
+
/* @__PURE__ */ jsx6("strong", { children: "Order item" }),
|
|
2347
|
+
/* @__PURE__ */ jsx6("br", {}),
|
|
2348
|
+
/* @__PURE__ */ jsx6("small", { style: { color: "#6b6b6b" }, children: "Items appear after a successful tracking query." })
|
|
2349
|
+
] })
|
|
2350
|
+
] })
|
|
2351
|
+
] });
|
|
2352
|
+
}
|
|
2353
|
+
function SalesOtherTrackingEditor(block) {
|
|
2354
|
+
return /* @__PURE__ */ jsxs6(SalesEditorSurface, { block, children: [
|
|
2355
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: "0 0 20px" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "heading", fallback: "Other shipments" }) }),
|
|
2356
|
+
/* @__PURE__ */ jsx6("p", { style: { margin: 0, color: "#6b6b6b" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "emptyMessage", fallback: "No other shipments are linked to this order." }) })
|
|
2357
|
+
] });
|
|
2358
|
+
}
|
|
2359
|
+
function SalesServiceCardsEditor(block) {
|
|
2360
|
+
return /* @__PURE__ */ jsxs6(SalesEditorSurface, { block, children: [
|
|
2361
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: "0 0 20px" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "heading", fallback: "Shop with confidence" }) }),
|
|
2362
|
+
/* @__PURE__ */ jsxs6("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 180px), 1fr))", gap: 14 }, children: [
|
|
2363
|
+
/* @__PURE__ */ jsxs6("article", { style: editorCardStyle, children: [
|
|
2364
|
+
/* @__PURE__ */ jsx6("strong", { children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "firstTitle", fallback: "Easy returns" }) }),
|
|
2365
|
+
/* @__PURE__ */ jsx6("p", { style: { marginBottom: 0, color: "#6b6b6b" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "firstDescription", fallback: "Simple support when plans change." }) })
|
|
2366
|
+
] }),
|
|
2367
|
+
/* @__PURE__ */ jsxs6("article", { style: editorCardStyle, children: [
|
|
2368
|
+
/* @__PURE__ */ jsx6("strong", { children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "secondTitle", fallback: "Secure delivery" }) }),
|
|
2369
|
+
/* @__PURE__ */ jsx6("p", { style: { marginBottom: 0, color: "#6b6b6b" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "secondDescription", fallback: "Follow every milestone in one place." }) })
|
|
2370
|
+
] })
|
|
2371
|
+
] })
|
|
2372
|
+
] });
|
|
2373
|
+
}
|
|
2374
|
+
function SalesProductCategoriesEditor(block) {
|
|
2375
|
+
const collection = isShopifyResourceReference(block.collection, "collection") ? block.collection : void 0;
|
|
2376
|
+
return /* @__PURE__ */ jsxs6(SalesEditorSurface, { block, children: [
|
|
2377
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: "0 0 20px" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "heading", fallback: "Shop by category" }) }),
|
|
2378
|
+
/* @__PURE__ */ jsxs6("div", { style: { ...editorCardStyle, display: "flex", justifyContent: "space-between", fontWeight: 700 }, children: [
|
|
2379
|
+
/* @__PURE__ */ jsx6("span", { children: collection?.title ?? "Choose a collection in the inspector" }),
|
|
2380
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: "\u2192" })
|
|
2381
|
+
] })
|
|
2382
|
+
] });
|
|
2383
|
+
}
|
|
2384
|
+
function SalesFeaturedProductEditor(block) {
|
|
2385
|
+
const product = isShopifyResourceReference(block.product, "product") ? block.product : void 0;
|
|
2386
|
+
return /* @__PURE__ */ jsxs6(SalesEditorSurface, { block, children: [
|
|
2387
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: "0 0 20px" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "heading", fallback: "Featured product" }) }),
|
|
2388
|
+
/* @__PURE__ */ jsxs6("div", { style: { ...editorCardStyle, display: "flex", justifyContent: "space-between", fontWeight: 700 }, children: [
|
|
2389
|
+
/* @__PURE__ */ jsx6("span", { children: product?.title ?? "Choose a product in the inspector" }),
|
|
2390
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: "\u2192" })
|
|
2391
|
+
] }),
|
|
2392
|
+
/* @__PURE__ */ jsx6("small", { style: { display: "block", marginTop: 10, color: "#6b6b6b" }, children: "Availability is supplied by the authorized runtime." })
|
|
2393
|
+
] });
|
|
2394
|
+
}
|
|
2395
|
+
function SalesRecommendationsEditor(block) {
|
|
2396
|
+
return /* @__PURE__ */ jsxs6(SalesEditorSurface, { block, children: [
|
|
2397
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: "0 0 20px" }, children: /* @__PURE__ */ jsx6(SalesInlineText, { block, name: "heading", fallback: "Complete your order" }) }),
|
|
2398
|
+
/* @__PURE__ */ jsx6("div", { style: { ...editorCardStyle, color: "#6b6b6b" }, children: "Recommended products appear after a successful tracking query." })
|
|
2399
|
+
] });
|
|
987
2400
|
}
|
|
988
2401
|
function SalesAnnouncementBlock(props) {
|
|
989
|
-
return /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ jsx6("section", { "aria-label": "Sales announcement", "data-sales-announcement": true, style: { display: "grid", minHeight: 38, placeItems: "center", boxSizing: "border-box", padding: "10px 16px", borderBottom: "1px solid var(--pb-color-border)", background: "var(--pb-color-background)", color: "var(--pb-color-text)", fontFamily: "var(--pb-font-family)", fontSize: 13, textAlign: "center" }, children: /* @__PURE__ */ jsx6("strong", { children: text5(props, "message", "Free delivery on orders over $50") }) });
|
|
990
2403
|
}
|
|
991
2404
|
function SalesQueryBlock(props) {
|
|
992
2405
|
const runtime = useSalesRuntime();
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
2406
|
+
return /* @__PURE__ */ jsxs6("section", { "aria-label": "Sales tracking query", "aria-busy": runtime.phase === "loading" || void 0, "data-sales-hero": true, style: { position: "relative", display: "grid", minHeight: "clamp(460px, 52vw, 620px)", boxSizing: "border-box", overflow: "hidden", padding: "clamp(28px, 6vw, 72px) 16px", background: "var(--pb-color-text)", color: "var(--pb-color-surface)", fontFamily: "var(--pb-font-family)" }, children: [
|
|
2407
|
+
/* @__PURE__ */ jsx6(HeroAsset, { src: props.heroImageUrl }),
|
|
2408
|
+
/* @__PURE__ */ jsx6("div", { "aria-hidden": "true", style: { position: "absolute", inset: 0, background: "rgb(0 0 0 / 42%)" } }),
|
|
2409
|
+
/* @__PURE__ */ jsx6("div", { style: { ...contentWidth3, position: "relative", zIndex: 1, display: "grid", alignItems: "center", width: "100%", minWidth: 0 }, children: /* @__PURE__ */ jsx6(
|
|
2410
|
+
TrackingQueryCard,
|
|
2411
|
+
{
|
|
2412
|
+
phase: runtime.phase,
|
|
2413
|
+
onQuery: runtime.query,
|
|
2414
|
+
heading: text5(props, "heading", "Track an order"),
|
|
2415
|
+
submitLabel: text5(props, "submitLabel", "Track order"),
|
|
2416
|
+
initialTrackingNumber: text5(props, "defaultTrackingNumber", "BT-2048-DEMO"),
|
|
2417
|
+
initialOrderNumber: text5(props, "defaultOrderNumber", ""),
|
|
2418
|
+
loadingLabel: "Checking...",
|
|
2419
|
+
loadingMessage: "Checking your order\u2026",
|
|
2420
|
+
emptyMessage: "We couldn\u2019t find an order for that number.",
|
|
2421
|
+
errorMessage: "We couldn\u2019t retrieve this order right now. Please try again later.",
|
|
2422
|
+
trackingInputLabel: "Sales tracking number",
|
|
2423
|
+
orderInputLabel: "Sales order number",
|
|
2424
|
+
emailInputLabel: "Sales order email",
|
|
2425
|
+
cardDataAttribute: "data-sales-query-card",
|
|
2426
|
+
resultDataAttribute: "data-sales-query-result",
|
|
2427
|
+
resultTestId: "sales-result",
|
|
2428
|
+
cardStyle: { boxSizing: "border-box", width: "min(560px, 100%)", maxHeight: "min(560px, calc(100dvh - 32px))", marginLeft: "auto", padding: "clamp(28px, 5vw, 48px)", borderRadius: "var(--pb-radius)", background: "var(--pb-color-surface)", color: "var(--pb-color-text)", boxShadow: "0 20px 56px rgb(0 0 0 / 28%)" },
|
|
2429
|
+
headingStyle: { color: "var(--pb-color-text)", fontSize: "clamp(32px, 5vw, 48px)", fontWeight: 800, letterSpacing: "-0.035em", lineHeight: 1.02 },
|
|
2430
|
+
tabListStyle: { borderBottomColor: "var(--pb-color-border)" },
|
|
2431
|
+
formStyle: { gap: 14 },
|
|
2432
|
+
inputStyle: { boxSizing: "border-box", width: "100%", minHeight: 58, padding: "12px 16px", border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.25)", background: "var(--pb-color-surface)", color: "var(--pb-color-text)", font: "inherit", fontSize: 17 },
|
|
2433
|
+
submitStyle: (loading) => ({ width: "100%", minHeight: 58, padding: "12px 18px", border: 0, borderRadius: "calc(var(--pb-radius) / 1.25)", background: loading ? "#64748b" : "var(--pb-color-text)", color: "var(--pb-color-surface)", font: "inherit", fontSize: 16, fontWeight: 700, cursor: loading ? "wait" : "pointer" }),
|
|
2434
|
+
result: runtime.result ? /* @__PURE__ */ jsx6(TrackingQueryResultDetails, { result: runtime.result }) : null,
|
|
2435
|
+
resultStyle: { padding: 16, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.25)", background: "var(--pb-color-background)" },
|
|
2436
|
+
watermark: /* @__PURE__ */ jsx6(RuntimeWatermark3, { watermark: runtime.watermark })
|
|
2437
|
+
}
|
|
2438
|
+
) })
|
|
1008
2439
|
] });
|
|
1009
2440
|
}
|
|
1010
2441
|
function SalesOrderItemsBlock(props) {
|
|
1011
2442
|
const runtime = useSalesRuntime();
|
|
1012
2443
|
const title = text5(props, "heading", "Items in your order");
|
|
1013
2444
|
const items = runtime.result?.orderItems ?? [];
|
|
1014
|
-
return /* @__PURE__ */
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
2445
|
+
return /* @__PURE__ */ jsx6(Section, { title, busy: runtime.phase === "loading", children: runtime.phase === "error" ? /* @__PURE__ */ jsx6(Status, { alert: true, children: "Order items are temporarily unavailable." }) : runtime.phase === "empty" ? /* @__PURE__ */ jsx6(Status, { children: "No order items are available for that number." }) : runtime.phase === "success" && items.length ? /* @__PURE__ */ jsx6("ul", { style: { display: "grid", gap: 12, margin: 0, padding: 0, listStyle: "none" }, children: items.map((item) => {
|
|
2446
|
+
const href = safeHref3(item.href);
|
|
2447
|
+
const itemTitle = text5(item, "title", "Order item");
|
|
2448
|
+
const itemContent = href ? /* @__PURE__ */ jsx6("a", { href, style: { color: "inherit" }, children: itemTitle }) : itemTitle;
|
|
2449
|
+
return /* @__PURE__ */ jsxs6("li", { style: { display: "flex", alignItems: "center", gap: 16, minWidth: 0, padding: 14, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)" }, children: [
|
|
2450
|
+
/* @__PURE__ */ jsx6(ProductImage3, { src: item.imageUrl, alt: itemTitle }),
|
|
2451
|
+
/* @__PURE__ */ jsxs6("span", { style: { minWidth: 0 }, children: [
|
|
2452
|
+
/* @__PURE__ */ jsx6("strong", { children: itemContent }),
|
|
2453
|
+
/* @__PURE__ */ jsx6("br", {}),
|
|
2454
|
+
/* @__PURE__ */ jsxs6("small", { style: { color: "var(--pb-color-muted)" }, children: [
|
|
2455
|
+
"Qty ",
|
|
2456
|
+
Number.isFinite(item.quantity) && item.quantity > 0 ? item.quantity : 1
|
|
2457
|
+
] }),
|
|
2458
|
+
item.description ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2459
|
+
/* @__PURE__ */ jsx6("br", {}),
|
|
2460
|
+
/* @__PURE__ */ jsx6("small", { style: { color: "var(--pb-color-muted)" }, children: item.description })
|
|
2461
|
+
] }) : null
|
|
2462
|
+
] })
|
|
2463
|
+
] }, item.id);
|
|
2464
|
+
}) }) : /* @__PURE__ */ jsx6(Status, { children: runtime.phase === "loading" ? "Loading order items\u2026" : "Order items appear after a successful query." }) });
|
|
1019
2465
|
}
|
|
1020
2466
|
function SalesOtherTrackingBlock(props) {
|
|
1021
2467
|
const runtime = useSalesRuntime();
|
|
1022
2468
|
const title = text5(props, "heading", "Other shipments");
|
|
1023
|
-
|
|
2469
|
+
const shipments = (runtime.result?.shipments ?? []).filter((shipment) => shipment.trackingNumber !== runtime.result?.trackingNumber);
|
|
2470
|
+
return /* @__PURE__ */ jsx6(Section, { title, busy: runtime.phase === "loading", children: runtime.phase === "error" ? /* @__PURE__ */ jsx6(Status, { alert: true, children: "Additional shipments are unavailable." }) : runtime.phase === "empty" ? /* @__PURE__ */ jsx6(Status, { children: "No additional shipments are available for that number." }) : runtime.phase === "success" && shipments.length ? /* @__PURE__ */ jsx6("ul", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 220px), 1fr))", gap: 12, margin: 0, padding: 0, listStyle: "none" }, children: shipments.map((shipment) => /* @__PURE__ */ jsxs6("li", { style: { padding: 16, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)" }, children: [
|
|
2471
|
+
/* @__PURE__ */ jsx6("strong", { children: text5(shipment, "label", "Shipment") }),
|
|
2472
|
+
shipment.status ? /* @__PURE__ */ jsx6("p", { style: { margin: "8px 0 0", color: "var(--pb-color-muted)" }, children: shipment.status }) : null,
|
|
2473
|
+
shipment.trackingNumber ? /* @__PURE__ */ jsx6("small", { style: { display: "block", marginTop: 8, color: "var(--pb-color-muted)" }, children: shipment.trackingNumber }) : null
|
|
2474
|
+
] }, shipment.id)) }) : runtime.phase === "success" ? /* @__PURE__ */ jsx6(Status, { children: text5(props, "emptyMessage", "No other shipments are linked to this order.") }) : /* @__PURE__ */ jsx6(Status, { children: runtime.phase === "loading" ? "Loading other shipments\u2026" : "Other tracking numbers appear with your order result." }) });
|
|
1024
2475
|
}
|
|
1025
2476
|
function SalesServiceCardsBlock(props) {
|
|
1026
2477
|
const title = text5(props, "heading", "Shop with confidence");
|
|
1027
|
-
return /* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
2478
|
+
return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsxs6("div", { style: gridStyle, children: [
|
|
2479
|
+
/* @__PURE__ */ jsxs6("article", { style: { padding: 20, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)" }, children: [
|
|
2480
|
+
/* @__PURE__ */ jsx6("strong", { children: text5(props, "firstTitle", "Easy returns") }),
|
|
2481
|
+
/* @__PURE__ */ jsx6("p", { style: { marginBottom: 0, color: "var(--pb-color-muted)" }, children: text5(props, "firstDescription", "Simple support when plans change.") })
|
|
1031
2482
|
] }),
|
|
1032
|
-
/* @__PURE__ */
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
2483
|
+
/* @__PURE__ */ jsxs6("article", { style: { padding: 20, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)" }, children: [
|
|
2484
|
+
/* @__PURE__ */ jsx6("strong", { children: text5(props, "secondTitle", "Secure delivery") }),
|
|
2485
|
+
/* @__PURE__ */ jsx6("p", { style: { marginBottom: 0, color: "var(--pb-color-muted)" }, children: text5(props, "secondDescription", "Follow every milestone in one place.") })
|
|
1035
2486
|
] })
|
|
1036
2487
|
] }) });
|
|
1037
2488
|
}
|
|
1038
2489
|
function SalesProductCategoriesBlock(props) {
|
|
1039
2490
|
const title = text5(props, "heading", "Shop by category");
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
2491
|
+
const runtime = useSalesRuntime();
|
|
2492
|
+
if (props.collection !== void 0 && props.collection !== null && !isShopifyResourceReference(props.collection, "collection")) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { alert: true, children: "Collection reference is invalid." }) });
|
|
2493
|
+
const collection = isShopifyResourceReference(props.collection, "collection") ? props.collection : void 0;
|
|
2494
|
+
if (!collection) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { children: "No collection selected. Choose a collection through an authorized resource integration." }) });
|
|
2495
|
+
const resolved = getResolvedShopifyResource(collection, runtime.resourceResolution);
|
|
2496
|
+
const error = getShopifyResourceResolutionError(collection, runtime.resourceResolution);
|
|
2497
|
+
if (error) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { alert: true, children: error.code === "missing" ? "This collection is no longer available." : "Collection details are temporarily unavailable." }) });
|
|
2498
|
+
if (!resolved) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { children: "Collection details are resolved by the authorized runtime." }) });
|
|
2499
|
+
const content = /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2500
|
+
/* @__PURE__ */ jsx6("span", { children: resolved.title }),
|
|
2501
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: "\u2192" })
|
|
2502
|
+
] });
|
|
2503
|
+
const style = { display: "flex", minHeight: 72, alignItems: "center", justifyContent: "space-between", gap: 16, padding: 18, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)", color: "inherit", fontWeight: 700, textDecoration: "none" };
|
|
2504
|
+
return /* @__PURE__ */ jsx6(Section, { title, children: resolved.href ? /* @__PURE__ */ jsx6("a", { href: resolved.href, style, children: content }) : /* @__PURE__ */ jsx6("div", { style, children: content }) });
|
|
2505
|
+
}
|
|
2506
|
+
function SalesFeaturedProductBlock(props) {
|
|
2507
|
+
const runtime = useSalesRuntime();
|
|
2508
|
+
const title = text5(props, "heading", "Featured product");
|
|
2509
|
+
if (props.product !== void 0 && props.product !== null && !isShopifyResourceReference(props.product, "product")) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { alert: true, children: "Product reference is invalid." }) });
|
|
2510
|
+
const product = isShopifyResourceReference(props.product, "product") ? props.product : void 0;
|
|
2511
|
+
if (!product) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { children: "No product selected. Choose a product through an authorized resource integration." }) });
|
|
2512
|
+
const resolved = getResolvedShopifyResource(product, runtime.resourceResolution);
|
|
2513
|
+
const error = getShopifyResourceResolutionError(product, runtime.resourceResolution);
|
|
2514
|
+
if (error) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { alert: true, children: error.code === "missing" ? "This product is no longer available." : "Product details are temporarily unavailable." }) });
|
|
2515
|
+
if (!resolved) return /* @__PURE__ */ jsx6(Section, { title, children: /* @__PURE__ */ jsx6(Status, { children: "Product details and availability are resolved by the authorized runtime." }) });
|
|
2516
|
+
const available = resolved.availability === "available";
|
|
2517
|
+
const body = /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2518
|
+
/* @__PURE__ */ jsx6(ProductImage3, { src: resolved.imageUrl, alt: resolved.title }),
|
|
2519
|
+
/* @__PURE__ */ jsxs6("span", { style: { minWidth: 0, flex: 1 }, children: [
|
|
2520
|
+
/* @__PURE__ */ jsx6("strong", { children: resolved.title }),
|
|
2521
|
+
/* @__PURE__ */ jsx6("br", {}),
|
|
2522
|
+
/* @__PURE__ */ jsx6("small", { style: { color: "var(--pb-color-muted)" }, children: available ? "Available" : resolved.availability === "sold-out" ? "Sold out" : "Unavailable" })
|
|
1047
2523
|
] })
|
|
1048
|
-
] })
|
|
2524
|
+
] });
|
|
2525
|
+
const style = { display: "flex", alignItems: "center", gap: 16, padding: 14, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)", color: "inherit", textDecoration: "none" };
|
|
2526
|
+
return /* @__PURE__ */ jsx6(Section, { title, children: available && resolved.href ? /* @__PURE__ */ jsx6("a", { href: resolved.href, style, children: body }) : /* @__PURE__ */ jsx6("div", { style, children: body }) });
|
|
1049
2527
|
}
|
|
1050
2528
|
function SalesRecommendationsBlock(props) {
|
|
1051
2529
|
const runtime = useSalesRuntime();
|
|
1052
2530
|
const title = text5(props, "heading", "Complete your order");
|
|
1053
2531
|
const recommendations = runtime.result?.recommendations ?? [];
|
|
1054
|
-
return /* @__PURE__ */
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
2532
|
+
return /* @__PURE__ */ jsx6(Section, { title, busy: runtime.phase === "loading", children: runtime.phase === "error" ? /* @__PURE__ */ jsx6(Status, { alert: true, children: "Recommendations are temporarily unavailable." }) : runtime.phase === "empty" ? /* @__PURE__ */ jsx6(Status, { children: "No recommendations are available for that number." }) : runtime.phase === "success" && recommendations.length ? /* @__PURE__ */ jsx6("div", { style: gridStyle, children: recommendations.map((item) => {
|
|
2533
|
+
const href = safeHref3(item.href);
|
|
2534
|
+
const itemTitle = text5(item, "title", "Recommended product");
|
|
2535
|
+
const price = item.price ? formatTrackingPageMoney(item.price) : void 0;
|
|
2536
|
+
return /* @__PURE__ */ jsxs6("article", { style: { display: "grid", gap: 14, minWidth: 0, padding: 18, border: "1px solid var(--pb-color-border)", borderRadius: "calc(var(--pb-radius) / 1.5)", background: "var(--pb-color-background)" }, children: [
|
|
2537
|
+
/* @__PURE__ */ jsx6(ProductImage3, { src: item.imageUrl, alt: itemTitle }),
|
|
2538
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2539
|
+
/* @__PURE__ */ jsx6("strong", { children: href ? /* @__PURE__ */ jsx6("a", { href, style: { color: "inherit" }, children: itemTitle }) : itemTitle }),
|
|
2540
|
+
price?.amount ? /* @__PURE__ */ jsx6("small", { style: { display: "block", marginTop: 5, color: "var(--pb-color-muted)" }, children: price.amount }) : null,
|
|
2541
|
+
item.description ? /* @__PURE__ */ jsx6("p", { style: { marginBottom: 0, color: "var(--pb-color-muted)" }, children: item.description }) : null
|
|
2542
|
+
] })
|
|
2543
|
+
] }, item.id);
|
|
2544
|
+
}) }) : /* @__PURE__ */ jsx6(Status, { children: runtime.phase === "success" ? "No recommendations are available for this order." : runtime.phase === "loading" ? "Loading recommendations\u2026" : "Recommended products appear with your order result." }) });
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
// src/shopify-resources.tsx
|
|
2548
|
+
import { createContext as createContext4, useCallback as useCallback4, useContext as useContext4, useState as useState6 } from "react";
|
|
2549
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2550
|
+
var ShopifyResourceBrowserContext = createContext4(void 0);
|
|
2551
|
+
function ShopifyResourcePickerProvider({ browser, children }) {
|
|
2552
|
+
return /* @__PURE__ */ jsx7(ShopifyResourceBrowserContext.Provider, { value: browser, children });
|
|
2553
|
+
}
|
|
2554
|
+
var pickerSurface = { marginTop: 8, padding: 12, border: "1px solid #c9cccf", borderRadius: 8, background: "#fff", color: "#202223" };
|
|
2555
|
+
var pickerButton = { minHeight: 32, padding: "6px 10px", border: "1px solid #8c9196", borderRadius: 6, background: "#fff", color: "#202223", font: "inherit", cursor: "pointer" };
|
|
2556
|
+
function ResourceField({ value, onChange, kind }) {
|
|
2557
|
+
const browser = useContext4(ShopifyResourceBrowserContext);
|
|
2558
|
+
const selected = isShopifyResourceReference(value, kind) ? value : void 0;
|
|
2559
|
+
const [open, setOpen] = useState6(false);
|
|
2560
|
+
const [query, setQuery] = useState6("");
|
|
2561
|
+
const [items, setItems] = useState6([]);
|
|
2562
|
+
const [cursor, setCursor] = useState6();
|
|
2563
|
+
const [state, setState] = useState6("idle");
|
|
2564
|
+
const search = useCallback4(async (nextQuery, nextCursor, append = false) => {
|
|
2565
|
+
if (!browser) return;
|
|
2566
|
+
setState("loading");
|
|
2567
|
+
try {
|
|
2568
|
+
const page = await browser.search({ kinds: [kind], query: nextQuery.trim(), ...nextCursor ? { cursor: nextCursor } : {}, limit: 20 });
|
|
2569
|
+
const validItems = page.items.filter((item) => isShopifyResourceReference(item, kind));
|
|
2570
|
+
setItems((current) => append ? [...current, ...validItems.filter((item) => !current.some((existing) => existing.id === item.id))] : validItems);
|
|
2571
|
+
setCursor(page.nextCursor);
|
|
2572
|
+
setState("idle");
|
|
2573
|
+
} catch {
|
|
2574
|
+
setState("error");
|
|
2575
|
+
}
|
|
2576
|
+
}, [browser, kind]);
|
|
2577
|
+
const name = kind === "product" ? "product" : "collection";
|
|
2578
|
+
return /* @__PURE__ */ jsxs7("div", { "data-shopify-resource-field": kind, children: [
|
|
2579
|
+
selected ? /* @__PURE__ */ jsxs7("p", { style: { margin: "0 0 8px" }, children: [
|
|
2580
|
+
/* @__PURE__ */ jsx7("strong", { children: selected.title }),
|
|
2581
|
+
/* @__PURE__ */ jsx7("br", {}),
|
|
2582
|
+
/* @__PURE__ */ jsx7("small", { children: selected.id })
|
|
2583
|
+
] }) : /* @__PURE__ */ jsxs7("p", { style: { margin: "0 0 8px" }, children: [
|
|
2584
|
+
"No ",
|
|
2585
|
+
name,
|
|
2586
|
+
" selected."
|
|
2587
|
+
] }),
|
|
2588
|
+
/* @__PURE__ */ jsx7("button", { type: "button", style: pickerButton, onClick: () => {
|
|
2589
|
+
if (open) {
|
|
2590
|
+
setOpen(false);
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
setOpen(true);
|
|
2594
|
+
if (browser) void search("");
|
|
2595
|
+
else setState("error");
|
|
2596
|
+
}, children: open ? "Close selector" : `Select ${name}` }),
|
|
2597
|
+
open ? /* @__PURE__ */ jsxs7("div", { role: "dialog", "aria-label": `Select Shopify ${name}`, style: pickerSurface, children: [
|
|
2598
|
+
/* @__PURE__ */ jsxs7("form", { onSubmit: (event) => {
|
|
2599
|
+
event.preventDefault();
|
|
2600
|
+
void search(query);
|
|
2601
|
+
}, children: [
|
|
2602
|
+
/* @__PURE__ */ jsxs7("label", { style: { display: "block" }, children: [
|
|
2603
|
+
"Search ",
|
|
2604
|
+
name,
|
|
2605
|
+
"s",
|
|
2606
|
+
/* @__PURE__ */ jsx7("input", { "aria-label": `Search ${name}s`, value: query, onChange: (event) => setQuery(event.currentTarget.value), style: { boxSizing: "border-box", display: "block", width: "100%", minHeight: 32, marginTop: 4, padding: "6px 8px" } })
|
|
2607
|
+
] }),
|
|
2608
|
+
/* @__PURE__ */ jsx7("button", { type: "submit", disabled: state === "loading", style: { ...pickerButton, marginTop: 8 }, children: state === "loading" ? "Searching\u2026" : "Search" })
|
|
2609
|
+
] }),
|
|
2610
|
+
state === "error" ? /* @__PURE__ */ jsx7("p", { role: "alert", children: "The authorized resource service is unavailable. Try again later." }) : null,
|
|
2611
|
+
state === "idle" && !items.length ? /* @__PURE__ */ jsxs7("p", { role: "status", children: [
|
|
2612
|
+
"No ",
|
|
2613
|
+
name,
|
|
2614
|
+
"s found."
|
|
2615
|
+
] }) : null,
|
|
2616
|
+
items.length ? /* @__PURE__ */ jsx7("ul", { style: { display: "grid", gap: 6, margin: "12px 0", padding: 0, listStyle: "none" }, children: items.map((item) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsxs7("button", { type: "button", style: { ...pickerButton, width: "100%", textAlign: "left" }, onClick: () => {
|
|
2617
|
+
onChange(item);
|
|
2618
|
+
setOpen(false);
|
|
2619
|
+
}, children: [
|
|
2620
|
+
/* @__PURE__ */ jsx7("strong", { children: item.title }),
|
|
2621
|
+
item.handle ? /* @__PURE__ */ jsx7("small", { style: { display: "block" }, children: item.handle }) : null
|
|
2622
|
+
] }) }, item.id)) }) : null,
|
|
2623
|
+
cursor ? /* @__PURE__ */ jsx7("button", { type: "button", disabled: state === "loading", style: pickerButton, onClick: () => void search(query, cursor, true), children: "Load more" }) : null
|
|
2624
|
+
] }) : null
|
|
2625
|
+
] });
|
|
2626
|
+
}
|
|
2627
|
+
function ShopifyProductResourceField(props) {
|
|
2628
|
+
return /* @__PURE__ */ jsx7(ResourceField, { ...props, kind: "product" });
|
|
2629
|
+
}
|
|
2630
|
+
function ShopifyCollectionResourceField(props) {
|
|
2631
|
+
return /* @__PURE__ */ jsx7(ResourceField, { ...props, kind: "collection" });
|
|
1058
2632
|
}
|
|
1059
2633
|
|
|
1060
2634
|
// src/sales-definition.ts
|
|
1061
|
-
var text6 = (label, options = {}) => ({ field: "besttrack.sales.text", label, control: "text", ...options });
|
|
1062
|
-
var
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
2635
|
+
var text6 = (label, options = {}) => ({ field: "besttrack.sales.text", label, control: "text", required: true, ...options });
|
|
2636
|
+
var shortText = (label, description) => text6(label, { description, group: "Content" });
|
|
2637
|
+
var longText = (label, description) => text6(label, { control: "textarea", description, group: "Content" });
|
|
2638
|
+
function requiredString(props, key, issues, maxLength = 160) {
|
|
2639
|
+
const value = props[key];
|
|
2640
|
+
if (typeof value !== "string" || !value.trim()) issues.push({ path: `props.${key}`, message: "A non-empty value is required." });
|
|
2641
|
+
else if (value.length > maxLength) issues.push({ path: `props.${key}`, message: `Must be at most ${maxLength} characters.` });
|
|
2642
|
+
}
|
|
2643
|
+
function textProps(keys) {
|
|
2644
|
+
return (props) => {
|
|
2645
|
+
const issues = [];
|
|
2646
|
+
keys.forEach(([key, maxLength]) => requiredString(props, key, issues, maxLength));
|
|
2647
|
+
return issues;
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
function validateQuery(props) {
|
|
2651
|
+
const issues = textProps([["heading", 120], ["submitLabel", 80]])(props);
|
|
2652
|
+
const trackingNumber = props.defaultTrackingNumber;
|
|
2653
|
+
if (typeof trackingNumber !== "string" || !isValidTrackingNumber(trackingNumber)) issues.push({ path: "props.defaultTrackingNumber", message: "Use 6\u201364 letters, numbers, hyphens, or underscores. Use a non-sensitive preview placeholder only." });
|
|
2654
|
+
if (props.heroImageUrl !== void 0 && !safeImage(props.heroImageUrl)) issues.push({ path: "props.heroImageUrl", message: "Use an HTTPS URL for the merchant-configured hero image." });
|
|
2655
|
+
return issues;
|
|
2656
|
+
}
|
|
2657
|
+
function safeImage(value) {
|
|
2658
|
+
return isSafeTrackingPageUrl(value);
|
|
2659
|
+
}
|
|
2660
|
+
function validateCategories(props) {
|
|
2661
|
+
const issues = textProps([["heading", 120]])(props);
|
|
2662
|
+
if (!isShopifyResourceReference(props.collection, "collection")) issues.push({ path: "props.collection", message: "Select a Shopify collection through an authorized resource integration." });
|
|
2663
|
+
return issues;
|
|
2664
|
+
}
|
|
2665
|
+
function validateFeaturedProduct(props) {
|
|
2666
|
+
const issues = textProps([["heading", 120]])(props);
|
|
2667
|
+
if (!isShopifyResourceReference(props.product, "product")) issues.push({ path: "props.product", message: "Select a Shopify product through an authorized resource integration." });
|
|
2668
|
+
return issues;
|
|
2669
|
+
}
|
|
2670
|
+
function withTemplatePolicy3(blocks, protectedBlocks) {
|
|
2671
|
+
return blocks.map((block) => ({ ...block, policy: { singleton: true, ...protectedBlocks.includes(block.type) ? { required: true, allowDelete: false } : {} } }));
|
|
2672
|
+
}
|
|
2673
|
+
var salesBlocks = withTemplatePolicy3([
|
|
2674
|
+
{ type: "besttrack.sales.announcement", version: 1, label: "Announcement", category: "BestTrack Sales", targets: ["web"], defaultProps: { message: "Free delivery on orders over $50" }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }, { id: "minimal", label: "Minimal", theme: { "color.primary": "#202223" } }], fields: { message: longText("Announcement", "Short, customer-facing promotion copy.") }, validate: textProps([["message", 280]]), render: { web: SalesAnnouncementBlock, editor: SalesAnnouncementEditor } },
|
|
2675
|
+
{ type: "besttrack.sales.query", version: 1, label: "Order query", category: "BestTrack Sales", targets: ["web"], defaultProps: { heading: "Track your order", submitLabel: "Track order", defaultTrackingNumber: "BT-2048-DEMO", defaultOrderNumber: "", heroImageUrl: "https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?auto=format&fit=crop&w=1800&q=85" }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }, { id: "compact", label: "Compact", theme: { spacing: "12px" } }], fields: { heading: shortText("Heading"), submitLabel: shortText("Button label"), defaultTrackingNumber: text6("Default tracking number", { group: "Tracking settings", description: "Preview-only placeholder; never save a customer's tracking number." }), defaultOrderNumber: text6("Default order number", { group: "Tracking settings", description: "Preview-only placeholder; never save a customer's order number." }), heroImageUrl: text6("Hero image URL", { control: "url", group: "Hero asset", description: "Merchant-configured HTTPS image. It is rendered as an image element, never as CSS.", validation: { allowRelativeUrl: false, allowedUrlProtocols: ["https:"], allowLocalhost: true } }) }, validate: validateQuery, render: { web: SalesQueryBlock, editor: SalesQueryEditor } },
|
|
2676
|
+
{ type: "besttrack.sales.order-items", version: 1, label: "Order items", category: "BestTrack Sales", targets: ["web"], defaultProps: { heading: "Items in your order" }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }], fields: { heading: shortText("Heading") }, validate: textProps([["heading", 120]]), render: { web: SalesOrderItemsBlock, editor: SalesOrderItemsEditor } },
|
|
2677
|
+
{ type: "besttrack.sales.other-tracking", version: 1, label: "Other tracking", category: "BestTrack Sales", targets: ["web"], defaultProps: { heading: "Other shipments", emptyMessage: "No other shipments are linked to this order." }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }], fields: { heading: shortText("Heading"), emptyMessage: longText("Empty message") }, validate: textProps([["heading", 120], ["emptyMessage", 280]]), render: { web: SalesOtherTrackingBlock, editor: SalesOtherTrackingEditor } },
|
|
2678
|
+
{ type: "besttrack.sales.service-cards", version: 1, label: "Service cards", category: "BestTrack Sales", targets: ["web"], defaultProps: { heading: "Shop with confidence", firstTitle: "Easy returns", firstDescription: "Simple support when plans change.", secondTitle: "Secure delivery", secondDescription: "Follow every milestone in one place." }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }], fields: { heading: shortText("Heading"), firstTitle: shortText("First card title"), firstDescription: longText("First card description"), secondTitle: shortText("Second card title"), secondDescription: longText("Second card description") }, validate: textProps([["heading", 120], ["firstTitle", 120], ["firstDescription", 280], ["secondTitle", 120], ["secondDescription", 280]]), render: { web: SalesServiceCardsBlock, editor: SalesServiceCardsEditor } },
|
|
2679
|
+
{ type: "besttrack.sales.product-categories", version: 3, label: "Product categories", category: "BestTrack Sales", targets: ["web"], defaultProps: { heading: "Shop by category", collection: { id: "gid://shopify/Collection/1", kind: "collection", title: "Featured collection", handle: "featured" } }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }, { id: "grid", label: "Grid", theme: { "color.surface": "#f8fafc" } }], fields: { heading: shortText("Heading"), collection: { field: "besttrack.shopify.collection", label: "Collection", group: "Resource", description: "Browse through an authorized host integration. Only a stable ID and minimal display copy are saved." } }, validate: validateCategories, render: { web: SalesProductCategoriesBlock, editor: SalesProductCategoriesEditor } },
|
|
2680
|
+
{ type: "besttrack.sales.featured-product", version: 1, label: "Featured product", category: "BestTrack Sales", targets: ["web"], defaultProps: { heading: "Featured product", product: { id: "gid://shopify/Product/1", kind: "product", title: "Featured product", handle: "featured-product" } }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }], fields: { heading: shortText("Heading"), product: { field: "besttrack.shopify.product", label: "Product", group: "Resource", description: "Browse through an authorized host integration. Current availability is resolved only at runtime." } }, validate: validateFeaturedProduct, render: { web: SalesFeaturedProductBlock, editor: SalesFeaturedProductEditor } },
|
|
2681
|
+
{ type: "besttrack.sales.recommendations", version: 1, label: "Recommended products", category: "BestTrack Sales", targets: ["web"], defaultProps: { heading: "Complete your order" }, defaultVariant: "hero", variants: [{ id: "hero", label: "Sales Hero" }, { id: "commerce", label: "Commerce" }, { id: "grid", label: "Product grid", theme: { "color.surface": "#f8fafc" } }], fields: { heading: shortText("Heading") }, validate: textProps([["heading", 120]]), render: { web: SalesRecommendationsBlock, editor: SalesRecommendationsEditor } }
|
|
2682
|
+
], ["besttrack.sales.announcement", "besttrack.sales.query"]);
|
|
2683
|
+
var salesTemplatePolicy = defineTemplatePolicy(
|
|
2684
|
+
"besttrack.sales",
|
|
2685
|
+
"Sales",
|
|
2686
|
+
salesBlocks.map((block) => block.type),
|
|
2687
|
+
["besttrack.sales.announcement", "besttrack.sales.query"]
|
|
2688
|
+
);
|
|
1071
2689
|
function createSalesTemplate() {
|
|
1072
|
-
return { id: "besttrack.sales", version:
|
|
2690
|
+
return { id: "besttrack.sales", version: 3, name: "Sales", target: "web", source: "built-in", requiredBlocks: salesBlocks.map((block) => block.type), theme: { "color.primary": "#000000", "color.background": "#f7f5f0", "color.surface": "#ffffff", "color.text": "#0a0a0a", "color.muted": "#6b6b6b", "color.border": "#dfddd7", "font.family": "Arial, Helvetica, sans-serif", radius: "10px", spacing: "24px" }, create: () => createPageDocument3({ pageId: "besttrack-sales", target: "web", templateId: "besttrack.sales", templateVersion: 3, settings: { locale: "en", seoTitle: "Shop and track your order" }, blocks: salesBlocks.map((block, index) => ({ id: "sales-" + (index + 1), type: block.type, version: block.version, props: block.defaultProps, variant: block.defaultVariant, style: {} })) }) };
|
|
1073
2691
|
}
|
|
1074
|
-
var bestTrackSalesExtension = Object.freeze({ name: "besttrack.sales", version: "0.
|
|
2692
|
+
var bestTrackSalesExtension = Object.freeze({ name: "besttrack.sales", version: "0.8.0", fields: [{ type: "besttrack.sales.text", component: SalesTextField }, { type: "besttrack.shopify.collection", component: ShopifyCollectionResourceField }, { type: "besttrack.shopify.product", component: ShopifyProductResourceField }], blocks: salesBlocks, templates: [createSalesTemplate()] });
|
|
1075
2693
|
export {
|
|
1076
2694
|
BrandedRuntimeProvider,
|
|
1077
2695
|
ReadyToGoRuntimeProvider,
|
|
2696
|
+
SHOPIFY_RECOMMEND_PATH,
|
|
2697
|
+
SHOPIFY_TRACK_QUERY_PATH,
|
|
1078
2698
|
SalesRuntimeProvider,
|
|
2699
|
+
ShopifyCollectionResourceField,
|
|
2700
|
+
ShopifyProductResourceField,
|
|
2701
|
+
ShopifyResourcePickerProvider,
|
|
1079
2702
|
bestTrackBrandedExtension,
|
|
1080
2703
|
bestTrackPageExtension,
|
|
1081
2704
|
bestTrackSalesExtension,
|
|
2705
|
+
brandedTemplatePolicy,
|
|
2706
|
+
buildShopifyRecommendPayload,
|
|
2707
|
+
buildShopifyTrackQueryPayload,
|
|
1082
2708
|
createBrandedTemplate,
|
|
1083
2709
|
createReadyToGoTemplate,
|
|
1084
|
-
createSalesTemplate
|
|
2710
|
+
createSalesTemplate,
|
|
2711
|
+
createShopifyRecommendationsQuery,
|
|
2712
|
+
createShopifyTrackQuery,
|
|
2713
|
+
formatTrackingPageMoney,
|
|
2714
|
+
getResolvedShopifyResource,
|
|
2715
|
+
getShopifyResourceResolutionError,
|
|
2716
|
+
isEmptyTrackingPageResult,
|
|
2717
|
+
isSafeTrackingPageUrl,
|
|
2718
|
+
isShopifyResourceReference,
|
|
2719
|
+
isTrackingPageResourceReference,
|
|
2720
|
+
isValidOrderEmail,
|
|
2721
|
+
isValidOrderNumber,
|
|
2722
|
+
isValidTrackingNumber,
|
|
2723
|
+
mapShopifyRecommendationsResponse,
|
|
2724
|
+
mapShopifyTrackQueryResponse,
|
|
2725
|
+
readTrackingQueryFromLocation,
|
|
2726
|
+
readTrackingQueryLocationState,
|
|
2727
|
+
readyToGoTemplatePolicy,
|
|
2728
|
+
resolveInitialLocale,
|
|
2729
|
+
resolveShopifyResources,
|
|
2730
|
+
resolveShopifyTrackQueryLocale,
|
|
2731
|
+
safeTrackingPageUrl,
|
|
2732
|
+
salesTemplatePolicy,
|
|
2733
|
+
shouldHidePoweredBy,
|
|
2734
|
+
syncTrackingQueryToUrl,
|
|
2735
|
+
withShopifyAppProxyPrefix,
|
|
2736
|
+
withShopifyTrackCacheBust
|
|
1085
2737
|
};
|