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