@tbox.cn/app-module-shopping-guide 0.9.12 → 1.0.0-alpha.10
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/AGENTS.md +3 -3
- package/dist/chunk-MBJPTP72.js +1692 -0
- package/dist/client/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +696 -696
- package/package.json +12 -9
- package/src/client/cards/category-list/index.tsx +17 -17
- package/src/client/cards/human-guide-list/index.tsx +17 -14
- package/src/client/cards/location-handoff/index.tsx +10 -10
- package/src/client/cards/mall-directory/index.tsx +14 -14
- package/src/client/cards/nearby-mall-list/index.tsx +29 -11
- package/src/client/cards/product-comparison/index.tsx +29 -18
- package/src/client/cards/product-detail/index.tsx +41 -25
- package/src/client/cards/product-list/index.tsx +74 -54
- package/src/client/cards/recommend-merchants/index.tsx +19 -9
- package/src/client/cards/shop-detail/index.tsx +13 -9
- package/src/client/cards/shop-list/index.tsx +19 -9
- package/src/client/components/ImageWithFallback.tsx +1 -1
- package/src/client/components/MerchantRow.tsx +23 -13
- package/src/client/components/ShopDetailSheet.tsx +94 -131
- package/src/client/components/ShopGuideHeader.tsx +6 -6
- package/src/client/components/ShopGuideSectionLabel.tsx +1 -1
- package/src/client/components/ShopListSheet.tsx +58 -96
- package/src/client/index.ts +0 -2
- package/tbox.module.json +0 -1
- package/tests/cards-render.test.tsx +40 -7
- package/tsup.config.ts +0 -5
- package/dist/chunk-PAYDOSCV.js +0 -1676
- package/dist/shopping-guide-62BDCPW5.css +0 -2600
- package/src/client/styles/shopping-guide.css +0 -2600
- package/src/client/types/css.d.ts +0 -2
|
@@ -0,0 +1,1692 @@
|
|
|
1
|
+
// src/client/cards/product-list/index.tsx
|
|
2
|
+
import { useState as useState2 } from "react";
|
|
3
|
+
import { Overlay } from "@tbox.cn/app-agent-ui-kit/overlay";
|
|
4
|
+
import { X } from "@phosphor-icons/react";
|
|
5
|
+
import { ItemActionsRow, sendCardAction } from "@tbox.cn/app-agent-sdk-client";
|
|
6
|
+
|
|
7
|
+
// src/client/components/ImageWithFallback.tsx
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { ImageSquare } from "@phosphor-icons/react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
function ImageWithFallback(props) {
|
|
12
|
+
const { src, alt, className, size = 40 } = props;
|
|
13
|
+
const [failed, setFailed] = useState(false);
|
|
14
|
+
if (!src || failed) {
|
|
15
|
+
return /* @__PURE__ */ jsx("div", { className: `img-fallback grid place-items-center text-[#c4c8ce] ${className ?? ""}`.trim(), "aria-label": alt, role: "img", children: /* @__PURE__ */ jsx(ImageSquare, { weight: "duotone", size: Math.round(size * 0.45) }) });
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"img",
|
|
19
|
+
{
|
|
20
|
+
className,
|
|
21
|
+
src,
|
|
22
|
+
alt,
|
|
23
|
+
loading: "lazy",
|
|
24
|
+
referrerPolicy: "no-referrer",
|
|
25
|
+
onError: () => setFailed(true)
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/client/cards/product-list/index.tsx
|
|
31
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
32
|
+
var AVAILABILITY_BASE_CLASS = "sg-availability mt-1 inline-block text-xs text-secondary-foreground";
|
|
33
|
+
var AVAILABILITY_TONE_CLASS = {
|
|
34
|
+
in_stock: "sg-availability-in_stock text-success",
|
|
35
|
+
available: "sg-availability-available text-success",
|
|
36
|
+
out_of_stock: "sg-availability-out_of_stock text-warning",
|
|
37
|
+
limited: "sg-availability-limited",
|
|
38
|
+
unknown: "sg-availability-unknown"
|
|
39
|
+
};
|
|
40
|
+
function ProductDetailSheet({
|
|
41
|
+
item,
|
|
42
|
+
cardId,
|
|
43
|
+
isHistory,
|
|
44
|
+
onClose
|
|
45
|
+
}) {
|
|
46
|
+
const [closing, setClosing] = useState2(false);
|
|
47
|
+
const requestClose = () => setClosing(true);
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
Overlay,
|
|
50
|
+
{
|
|
51
|
+
open: !closing,
|
|
52
|
+
onDismiss: requestClose,
|
|
53
|
+
onExited: onClose,
|
|
54
|
+
placement: "bottom",
|
|
55
|
+
label: item.name,
|
|
56
|
+
exitMs: 200,
|
|
57
|
+
rootClassName: "sg-product-sheet group pb-[var(--tbox-chat-bottom-height,0px)]",
|
|
58
|
+
maskClassName: "bg-[rgba(11,15,23,0.5)]",
|
|
59
|
+
panelClassName: "sg-product-sheet__panel flex max-h-[calc(82vh-var(--tbox-chat-bottom-height,0px))] w-full flex-col overflow-hidden rounded-t-[18px] bg-card shadow-[0_-6px_20px_rgba(11,15,23,0.12)] animate-[tbox-sheet-in_200ms_ease-out] group-data-[state=closed]:animate-[tbox-sheet-out_200ms_ease-in_both] motion-reduce:animate-none",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-product-sheet__header flex shrink-0 items-center px-4 pt-4 pb-2.5", children: [
|
|
62
|
+
/* @__PURE__ */ jsx2("span", { className: "sg-product-sheet__title min-w-0 flex-1 text-base font-semibold text-foreground", children: "\u5546\u54C1\u8BE6\u60C5" }),
|
|
63
|
+
/* @__PURE__ */ jsx2("button", { type: "button", className: "sg-product-sheet__close flex size-7 shrink-0 items-center justify-center rounded-full border-0 bg-muted text-secondary-foreground", onClick: requestClose, "aria-label": "\u5173\u95ED", children: /* @__PURE__ */ jsx2(X, { size: 18 }) })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-product-sheet__body overflow-y-auto px-4 pb-6", children: [
|
|
66
|
+
item.imageUrl && /* @__PURE__ */ jsx2(
|
|
67
|
+
ImageWithFallback,
|
|
68
|
+
{
|
|
69
|
+
src: item.imageUrl,
|
|
70
|
+
alt: item.name,
|
|
71
|
+
className: "sg-product-sheet__cover mb-3.5 block h-[180px] w-full max-w-full rounded-[12px] object-cover",
|
|
72
|
+
size: 240
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-product-sheet__main pb-2", children: [
|
|
76
|
+
item.badges.length > 0 && /* @__PURE__ */ jsx2("div", { className: "sg-badges mb-1.5 flex flex-wrap gap-1.5", children: item.badges.map((b) => /* @__PURE__ */ jsx2("span", { className: "sg-badge rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs leading-4 text-secondary-foreground", children: b }, b)) }),
|
|
77
|
+
/* @__PURE__ */ jsx2("div", { className: "sg-product-sheet__name mt-1 text-lg leading-[26px] font-bold text-foreground", children: item.name }),
|
|
78
|
+
item.brand && /* @__PURE__ */ jsx2("div", { className: "sg-product-sheet__brand mt-[3px] text-sm text-muted-foreground", children: item.brand }),
|
|
79
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-product-sheet__price-row mt-2 flex items-baseline gap-1.5", children: [
|
|
80
|
+
item.price.sale && /* @__PURE__ */ jsx2("span", { className: "sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]", children: item.price.sale.display }),
|
|
81
|
+
item.price.original && item.price.sale && /* @__PURE__ */ jsx2("span", { className: "sg-price-original text-xs line-through text-muted-foreground", children: item.price.original.display }),
|
|
82
|
+
item.price.promotion && /* @__PURE__ */ jsx2("span", { className: "sg-price-promotion rounded-[8px] bg-[#fff1f3] px-1.5 py-[0.5px] text-xs leading-4 text-[#ef4f43]", children: item.price.promotion.display }),
|
|
83
|
+
!item.price.sale && !item.price.original && !item.price.promotion && /* @__PURE__ */ jsx2("span", { className: "sg-price-unavailable text-xs text-muted-foreground", children: "\u4EF7\u683C\u6682\u65E0" })
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ jsx2("div", { className: `${AVAILABILITY_BASE_CLASS} ${AVAILABILITY_TONE_CLASS[item.availability.status] ?? ""}`, children: item.availability.label }),
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-product-sheet__merchant mt-1.5 text-sm text-secondary-foreground", children: [
|
|
87
|
+
/* @__PURE__ */ jsx2("span", { children: item.merchant.name }),
|
|
88
|
+
item.merchant.location?.displayText && /* @__PURE__ */ jsxs("span", { className: "sg-merchant-location mt-1 flex flex-wrap items-center gap-[3px] text-xs text-secondary-foreground", children: [
|
|
89
|
+
" \xB7 ",
|
|
90
|
+
item.merchant.location.displayText
|
|
91
|
+
] })
|
|
92
|
+
] }),
|
|
93
|
+
item.reasons && item.reasons.length > 0 && /* @__PURE__ */ jsx2("div", { className: "sg-reasons mt-1.5 flex flex-wrap gap-1.5", children: item.reasons.map((r) => /* @__PURE__ */ jsx2("span", { className: "sg-reason-tag rounded-full bg-[#fff1f3] px-2 py-0.5 text-xs leading-4 text-[#ef4f43]", children: r.label }, r.code)) }),
|
|
94
|
+
item.caveats.length > 0 && /* @__PURE__ */ jsx2("div", { className: "sg-item-caveats mt-1.5", children: item.caveats.map((c, i) => /* @__PURE__ */ jsxs("div", { className: "sg-caveat-item text-xs leading-4 text-muted-foreground", children: [
|
|
95
|
+
"\u26A0\uFE0F ",
|
|
96
|
+
c
|
|
97
|
+
] }, i)) })
|
|
98
|
+
] }),
|
|
99
|
+
item.availability.marketable && /* @__PURE__ */ jsx2("div", { className: "sg-product-sheet__actions mt-3 border-t-[0.5px] border-border pt-3", children: /* @__PURE__ */ jsx2(
|
|
100
|
+
ItemActionsRow,
|
|
101
|
+
{
|
|
102
|
+
actions: item.itemActions,
|
|
103
|
+
cardId,
|
|
104
|
+
isHistory,
|
|
105
|
+
className: "sg-product-sheet__action-row flex gap-2",
|
|
106
|
+
chipClassName: "sg-product-sheet__chip flex-1 rounded-[9px] border-0 bg-[#e54650] py-2.5 text-center text-sm font-medium text-white"
|
|
107
|
+
}
|
|
108
|
+
) })
|
|
109
|
+
] })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function ProductListCard(props) {
|
|
115
|
+
const { data, cardId, isHistory } = props;
|
|
116
|
+
const [activeItem, setActiveItem] = useState2(null);
|
|
117
|
+
return /* @__PURE__ */ jsxs("section", { className: "sg-card sg-product-list p-5 text-foreground", children: [
|
|
118
|
+
data.summary && /* @__PURE__ */ jsx2("div", { className: "sg-card-summary mb-3 text-sm text-secondary-foreground", children: data.summary }),
|
|
119
|
+
data.items.length === 0 ? /* @__PURE__ */ jsx2("div", { className: "sg-empty py-6 text-center text-sm text-muted-foreground", children: data.noResultsReason ?? "\u6682\u65E0\u76F8\u5173\u5546\u54C1" }) : /* @__PURE__ */ jsx2("ul", { className: "sg-product-list-items m-0 list-none p-0", children: data.items.map((item) => /* @__PURE__ */ jsxs(
|
|
120
|
+
"li",
|
|
121
|
+
{
|
|
122
|
+
className: "sg-product-item sg-product-item--clickable flex cursor-pointer gap-3 border-b-[0.5px] border-border py-3 transition-colors duration-150 last:border-b-0 active:bg-muted",
|
|
123
|
+
onClick: () => setActiveItem(item),
|
|
124
|
+
role: "button",
|
|
125
|
+
tabIndex: 0,
|
|
126
|
+
onKeyDown: (e) => e.key === "Enter" && setActiveItem(item),
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx2(
|
|
129
|
+
ImageWithFallback,
|
|
130
|
+
{
|
|
131
|
+
src: item.imageUrl,
|
|
132
|
+
alt: item.name,
|
|
133
|
+
className: "sg-product-image size-20 shrink-0 max-w-full rounded-[8px] object-cover",
|
|
134
|
+
size: 44
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-product-info min-w-0 flex-1", children: [
|
|
138
|
+
item.badges.length > 0 && /* @__PURE__ */ jsx2("div", { className: "sg-badges mb-1.5 flex flex-wrap gap-1.5", children: item.badges.map((b) => /* @__PURE__ */ jsx2("span", { className: "sg-badge rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs leading-4 text-secondary-foreground", children: b }, b)) }),
|
|
139
|
+
/* @__PURE__ */ jsx2("div", { className: "sg-product-name text-base leading-[21px] font-semibold text-foreground", children: item.name }),
|
|
140
|
+
item.brand && /* @__PURE__ */ jsx2("div", { className: "sg-product-brand", children: item.brand }),
|
|
141
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-price-block mt-1 flex flex-wrap items-baseline gap-2", children: [
|
|
142
|
+
item.price.sale && /* @__PURE__ */ jsx2("span", { className: "sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]", children: item.price.sale.display }),
|
|
143
|
+
item.price.original && item.price.sale && /* @__PURE__ */ jsx2("span", { className: "sg-price-original text-xs line-through text-muted-foreground", children: item.price.original.display }),
|
|
144
|
+
item.price.promotion && /* @__PURE__ */ jsx2("span", { className: "sg-price-promotion rounded-[8px] bg-[#fff1f3] px-1.5 py-[0.5px] text-xs leading-4 text-[#ef4f43]", children: item.price.promotion.display }),
|
|
145
|
+
!item.price.sale && !item.price.original && !item.price.promotion && /* @__PURE__ */ jsx2("span", { className: "sg-price-unavailable text-xs text-muted-foreground", children: "\u4EF7\u683C\u6682\u65E0" })
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-product-sheet__merchant mt-1.5 text-sm text-secondary-foreground", children: [
|
|
148
|
+
/* @__PURE__ */ jsx2("span", { children: item.merchant.name }),
|
|
149
|
+
item.merchant.location?.displayText && /* @__PURE__ */ jsxs("span", { className: "sg-merchant-location mt-1 flex flex-wrap items-center gap-[3px] text-xs text-secondary-foreground", children: [
|
|
150
|
+
" \xB7 ",
|
|
151
|
+
item.merchant.location.displayText
|
|
152
|
+
] })
|
|
153
|
+
] })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ jsx2("div", { className: "sg-product-item__arrow ml-1 shrink-0 self-center text-base text-muted-foreground", "aria-hidden": "true", children: "\u203A" })
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
item.productId
|
|
159
|
+
)) }),
|
|
160
|
+
data.pageInfo?.hasMore && /* @__PURE__ */ jsxs("div", { className: "sg-page-info mt-2.5 text-center text-xs text-muted-foreground", children: [
|
|
161
|
+
"\u5DF2\u5C55\u793A ",
|
|
162
|
+
data.items.length,
|
|
163
|
+
" / ",
|
|
164
|
+
data.pageInfo.total,
|
|
165
|
+
" \u4EF6\u5546\u54C1"
|
|
166
|
+
] }),
|
|
167
|
+
data.refinements.length > 0 && /* @__PURE__ */ jsx2("div", { className: "sg-refinements mt-3 flex flex-wrap gap-2 border-t-[0.5px] border-dashed border-border pt-2.5", children: data.refinements.map((r, i) => /* @__PURE__ */ jsx2(
|
|
168
|
+
"button",
|
|
169
|
+
{
|
|
170
|
+
type: "button",
|
|
171
|
+
className: "sg-refinement-chip cursor-pointer rounded-full border-[0.5px] border-border bg-card px-3 py-1 text-xs text-secondary-foreground disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal",
|
|
172
|
+
disabled: isHistory,
|
|
173
|
+
onClick: () => {
|
|
174
|
+
if (isHistory) return;
|
|
175
|
+
sendCardAction(cardId, { type: "sendMessage", value: r.queryText || r.label, visible: true });
|
|
176
|
+
},
|
|
177
|
+
children: r.label
|
|
178
|
+
},
|
|
179
|
+
i
|
|
180
|
+
)) }),
|
|
181
|
+
activeItem && /* @__PURE__ */ jsx2(
|
|
182
|
+
ProductDetailSheet,
|
|
183
|
+
{
|
|
184
|
+
item: activeItem,
|
|
185
|
+
cardId,
|
|
186
|
+
isHistory,
|
|
187
|
+
onClose: () => setActiveItem(null)
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] });
|
|
191
|
+
}
|
|
192
|
+
var product_list_default = ProductListCard;
|
|
193
|
+
|
|
194
|
+
// src/client/cards/product-detail/index.tsx
|
|
195
|
+
import { useState as useState3 } from "react";
|
|
196
|
+
import { ItemActionsRow as ItemActionsRow2 } from "@tbox.cn/app-agent-sdk-client";
|
|
197
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
198
|
+
var AVAILABILITY_BASE_CLASS2 = "sg-availability mt-1 inline-block text-xs text-secondary-foreground";
|
|
199
|
+
var AVAILABILITY_TONE_CLASS2 = {
|
|
200
|
+
in_stock: "sg-availability-in_stock text-success",
|
|
201
|
+
available: "sg-availability-available text-success",
|
|
202
|
+
out_of_stock: "sg-availability-out_of_stock text-warning",
|
|
203
|
+
limited: "sg-availability-limited",
|
|
204
|
+
unknown: "sg-availability-unknown"
|
|
205
|
+
};
|
|
206
|
+
function ProductDetailCard(props) {
|
|
207
|
+
const { data, cardId, isHistory } = props;
|
|
208
|
+
const [active, setActive] = useState3(0);
|
|
209
|
+
const images = data.imageUrls;
|
|
210
|
+
const current = Math.min(active, Math.max(images.length - 1, 0));
|
|
211
|
+
return /* @__PURE__ */ jsxs2("section", { className: "sg-card sg-product-detail p-5 text-foreground", children: [
|
|
212
|
+
/* @__PURE__ */ jsx3("div", { className: "sg-card-title -mx-5 -mt-5 mb-3 flex items-center gap-2 bg-[linear-gradient(135deg,#0e2f80_0%,#1e5ed7_100%)] p-3.5 text-base leading-6 font-bold text-white", children: data.name }),
|
|
213
|
+
data.brand && /* @__PURE__ */ jsx3("div", { className: "sg-card-subtitle mb-3 text-sm text-secondary-foreground", children: data.brand }),
|
|
214
|
+
images.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "sg-carousel relative", children: [
|
|
215
|
+
/* @__PURE__ */ jsx3(ImageWithFallback, { src: images[current], alt: data.name, className: "sg-carousel__stage h-60 w-full max-w-full rounded-[12px] object-cover", size: 72 }),
|
|
216
|
+
images.length > 1 && /* @__PURE__ */ jsxs2("span", { className: "sg-carousel__count absolute right-2.5 bottom-2.5 rounded-full bg-[rgba(0,0,0,0.5)] px-2 py-0.5 text-xs leading-4 text-white", children: [
|
|
217
|
+
current + 1,
|
|
218
|
+
"/",
|
|
219
|
+
images.length
|
|
220
|
+
] }),
|
|
221
|
+
images.length > 1 && /* @__PURE__ */ jsx3("div", { className: "sg-carousel__thumbs mt-2 flex gap-2 overflow-x-auto", children: images.map((src, i) => /* @__PURE__ */ jsx3(
|
|
222
|
+
"button",
|
|
223
|
+
{
|
|
224
|
+
type: "button",
|
|
225
|
+
className: "sg-carousel__thumb size-12 shrink-0 cursor-pointer overflow-hidden rounded-[8px] border-2 border-transparent p-0 aria-[current=true]:border-[var(--tbox-domain-sg-accent,#096bfa)] [font-family:inherit]",
|
|
226
|
+
"aria-current": i === current,
|
|
227
|
+
"aria-label": `\u67E5\u770B\u7B2C ${i + 1} \u5F20\u56FE`,
|
|
228
|
+
onClick: () => setActive(i),
|
|
229
|
+
children: /* @__PURE__ */ jsx3("img", { className: "h-full w-full max-w-full object-cover", src, alt: "", loading: "lazy", referrerPolicy: "no-referrer" })
|
|
230
|
+
},
|
|
231
|
+
i
|
|
232
|
+
)) })
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ jsxs2("div", { className: "sg-price-block sg-price-block--detail mt-1 flex flex-wrap items-baseline gap-2", children: [
|
|
235
|
+
data.price.sale && /* @__PURE__ */ jsx3("span", { className: "sg-price-sale sg-price-sale--lg text-2xl leading-7 font-bold tabular-nums text-[#ef4f43]", children: data.price.sale.display }),
|
|
236
|
+
data.price.original && data.price.sale && /* @__PURE__ */ jsx3("span", { className: "sg-price-original text-xs line-through text-muted-foreground", children: data.price.original.display }),
|
|
237
|
+
data.price.promotion && /* @__PURE__ */ jsx3("span", { className: "sg-price-promotion rounded-[8px] bg-[#fff1f3] px-1.5 py-[0.5px] text-xs leading-4 text-[#ef4f43]", children: data.price.promotion.display })
|
|
238
|
+
] }),
|
|
239
|
+
/* @__PURE__ */ jsxs2("div", { className: `${AVAILABILITY_BASE_CLASS2} ${AVAILABILITY_TONE_CLASS2[data.availability.status] ?? ""}`, children: [
|
|
240
|
+
data.availability.label,
|
|
241
|
+
data.humanGuideAvailable && /* @__PURE__ */ jsx3("span", { className: "sg-availability__guide ml-2 rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs", children: "\u652F\u6301\u4EBA\u5DE5\u5BFC\u8D2D" })
|
|
242
|
+
] }),
|
|
243
|
+
data.description && /* @__PURE__ */ jsx3("div", { className: "sg-product-desc mt-2.5 text-sm leading-5 text-foreground", children: data.description }),
|
|
244
|
+
/* @__PURE__ */ jsx3("dl", { className: "sg-attr-table m-0 mt-2.5 overflow-hidden rounded-[8px] border-[0.5px] border-border p-0", children: data.attributes.map((a) => /* @__PURE__ */ jsxs2("div", { className: "sg-attr-row flex gap-3 border-b-[0.5px] border-border px-3 py-2 text-sm last:border-b-0", children: [
|
|
245
|
+
/* @__PURE__ */ jsx3("dt", { className: "flex-none text-secondary-foreground", children: a.name }),
|
|
246
|
+
/* @__PURE__ */ jsx3("dd", { className: "m-0 flex-1 text-right text-foreground", children: a.value })
|
|
247
|
+
] }, a.name)) }),
|
|
248
|
+
/* @__PURE__ */ jsxs2("div", { className: "sg-product-merchant mt-1.5 text-xs text-secondary-foreground", children: [
|
|
249
|
+
data.merchant.name,
|
|
250
|
+
data.merchant.location?.displayText && /* @__PURE__ */ jsxs2("span", { className: "sg-merchant-location mt-1 flex flex-wrap items-center gap-[3px] text-xs text-secondary-foreground", children: [
|
|
251
|
+
" \xB7 ",
|
|
252
|
+
data.merchant.location.displayText
|
|
253
|
+
] })
|
|
254
|
+
] }),
|
|
255
|
+
data.promotionFacts.map((p) => /* @__PURE__ */ jsx3("div", { className: "sg-promo-fact mt-1 text-xs leading-4.5 text-[#ef4f43]", children: p }, p)),
|
|
256
|
+
data.categoryPath.length > 0 && /* @__PURE__ */ jsx3("div", { className: "sg-category-path mt-2 text-xs text-muted-foreground", children: data.categoryPath.join(" / ") }),
|
|
257
|
+
/* @__PURE__ */ jsx3(
|
|
258
|
+
ItemActionsRow2,
|
|
259
|
+
{
|
|
260
|
+
actions: data.itemActions,
|
|
261
|
+
cardId,
|
|
262
|
+
isHistory,
|
|
263
|
+
className: "sg-item-actions mt-2 flex flex-wrap gap-1.5",
|
|
264
|
+
chipClassName: "sg-chip inline-flex min-h-[30px] cursor-pointer items-center justify-center rounded-[9px] border border-border bg-[var(--tbox-domain-sg-surface,#f7faff)] px-3 text-xs font-medium whitespace-nowrap text-[var(--tbox-domain-sg-accent,#096bfa)] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal"
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] });
|
|
268
|
+
}
|
|
269
|
+
var product_detail_default = ProductDetailCard;
|
|
270
|
+
|
|
271
|
+
// src/client/cards/shop-list/index.tsx
|
|
272
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useRef as useRef3, useState as useState6 } from "react";
|
|
273
|
+
import { CaretRight } from "@phosphor-icons/react";
|
|
274
|
+
import { markSelfRendering } from "@tbox.cn/app-agent-sdk-client";
|
|
275
|
+
|
|
276
|
+
// src/client/components/ShopDetailSheet.tsx
|
|
277
|
+
import { useCallback, useEffect, useId, useRef, useState as useState4 } from "react";
|
|
278
|
+
import { Overlay as Overlay2 } from "@tbox.cn/app-agent-ui-kit/overlay";
|
|
279
|
+
import { Clock, MapPin, Phone, Star, Tag, X as X2 } from "@phosphor-icons/react";
|
|
280
|
+
import { ItemActionsRow as ItemActionsRow3, navigateToAlipayPage, sendCardAction as sendCardAction2 } from "@tbox.cn/app-agent-sdk-client";
|
|
281
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
282
|
+
var HIDDEN_DETAIL_ACTION_LABELS = /* @__PURE__ */ new Set(["\u67E5\u770B\u8BE6\u60C5", "\u5BFC\u822A", "\u95EE\u95EE\u5BFC\u8D2D"]);
|
|
283
|
+
var STATUS_BASE_CLASS = "sg-status inline-block rounded-full px-2 py-0.5 text-xs leading-4 whitespace-nowrap";
|
|
284
|
+
var STATUS_TONE_CLASS = {
|
|
285
|
+
enabled: "sg-status-enabled text-success bg-success-soft",
|
|
286
|
+
available: "sg-status-available text-success bg-success-soft",
|
|
287
|
+
open: "sg-status-open bg-[#e9f8ef] text-[#237a48]",
|
|
288
|
+
offline: "sg-status-offline bg-[#fff4df] text-[#986415]",
|
|
289
|
+
closed: "sg-status-closed bg-[#fff4df] text-[#986415]",
|
|
290
|
+
unknown: "sg-status-unknown bg-[#fff4df] text-[#986415]",
|
|
291
|
+
disabled: "sg-status-disabled bg-[#fff4df] text-[#986415]"
|
|
292
|
+
};
|
|
293
|
+
function ShopDetailSheet(props) {
|
|
294
|
+
const { open, data: dataProp, loading = false, cardId, isHistory, onClose, actionTokens, claimActionId } = props;
|
|
295
|
+
const [closing, setClosing] = useState4(false);
|
|
296
|
+
const [claimingRef, setClaimingRef] = useState4(null);
|
|
297
|
+
const [claimedRefs, setClaimedRefs] = useState4(() => /* @__PURE__ */ new Set());
|
|
298
|
+
const closeButtonRef = useRef(null);
|
|
299
|
+
const titleId = useId();
|
|
300
|
+
const wasOpenRef = useRef(open);
|
|
301
|
+
const lastDataRef = useRef(dataProp);
|
|
302
|
+
if (dataProp) lastDataRef.current = dataProp;
|
|
303
|
+
const data = dataProp ?? (closing ? lastDataRef.current : null);
|
|
304
|
+
const requestClose = useCallback(() => {
|
|
305
|
+
setClosing(true);
|
|
306
|
+
onClose();
|
|
307
|
+
}, [onClose]);
|
|
308
|
+
useEffect(() => {
|
|
309
|
+
if (open === wasOpenRef.current) return;
|
|
310
|
+
wasOpenRef.current = open;
|
|
311
|
+
if (open) setClosing(false);
|
|
312
|
+
}, [open]);
|
|
313
|
+
useEffect(() => {
|
|
314
|
+
if (!cardId || typeof window === "undefined") return void 0;
|
|
315
|
+
const onNotice = (event) => {
|
|
316
|
+
const detail = event.detail;
|
|
317
|
+
if (!detail?.text || detail.surfaceId && detail.surfaceId !== cardId) return;
|
|
318
|
+
const ref = claimingRef;
|
|
319
|
+
if (!ref) return;
|
|
320
|
+
setClaimingRef(null);
|
|
321
|
+
if (detail.level === "success" || /领取成功|已存入卡包|已领取/.test(detail.text)) {
|
|
322
|
+
setClaimedRefs((current) => new Set(current).add(ref));
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
window.addEventListener("tbox:notice", onNotice);
|
|
326
|
+
return () => window.removeEventListener("tbox:notice", onNotice);
|
|
327
|
+
}, [cardId, claimingRef]);
|
|
328
|
+
const claimCoupon = useCallback(
|
|
329
|
+
(offerRef) => {
|
|
330
|
+
if (!claimActionId) return;
|
|
331
|
+
const token = actionTokens?.[claimActionId];
|
|
332
|
+
if (!token) return;
|
|
333
|
+
setClaimingRef(offerRef);
|
|
334
|
+
sendCardAction2(cardId, { type: "moduleAction", actionId: claimActionId, contextToken: token }, { offerRef });
|
|
335
|
+
},
|
|
336
|
+
[actionTokens, cardId, claimActionId]
|
|
337
|
+
);
|
|
338
|
+
if (!data) return null;
|
|
339
|
+
const phone = data.contactInfo?.find((item) => /phone|电话/i.test(item.channel));
|
|
340
|
+
const hoursText = data.contactInfo?.find((item) => /hours|营业时间/i.test(item.channel))?.value ?? "\u5468\u4E00-\u5468\u65E5 10:00-22:00";
|
|
341
|
+
const detailActions = data.itemActions?.filter(
|
|
342
|
+
(action) => !HIDDEN_DETAIL_ACTION_LABELS.has(action.label.trim())
|
|
343
|
+
) ?? [];
|
|
344
|
+
return /* @__PURE__ */ jsxs3(
|
|
345
|
+
Overlay2,
|
|
346
|
+
{
|
|
347
|
+
open: open && !closing,
|
|
348
|
+
onDismiss: requestClose,
|
|
349
|
+
onExited: () => setClosing(false),
|
|
350
|
+
placement: "bottom",
|
|
351
|
+
labelledBy: titleId,
|
|
352
|
+
initialFocus: closeButtonRef,
|
|
353
|
+
panelProps: { "aria-busy": loading || void 0 },
|
|
354
|
+
exitMs: 220,
|
|
355
|
+
rootClassName: "sg-shop-sheet group text-foreground group-data-[state=closed]:animate-[sg-shop-sheet-out_180ms_ease-in_both] motion-reduce:animate-none",
|
|
356
|
+
maskClassName: "bg-[rgba(18,21,19,0.52)] backdrop-blur-[2px]",
|
|
357
|
+
panelClassName: "sg-shop-sheet__panel flex h-[86vh] max-h-[86vh] w-[min(100%,375px)] flex-col overflow-hidden rounded-t-[18px] bg-white shadow-[0_-8px_24px_rgba(24,31,27,0.18)] animate-[sg-shop-sheet-in_240ms_cubic-bezier(0.22,0.72,0.24,1)_both] group-data-[state=closed]:animate-[sg-shop-sheet-down_180ms_ease-in_both] motion-reduce:animate-none",
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ jsxs3("header", { className: "sg-shop-sheet__header flex shrink-0 items-center border-b-[0.5px] border-border pt-[13px] pr-3.5 pb-[9px] pl-4", children: [
|
|
360
|
+
/* @__PURE__ */ jsx4("h2", { id: titleId, className: "min-w-0 flex-1 text-base leading-[22px] font-bold text-[#262c28]", children: "\u95E8\u5E97\u8BE6\u60C5" }),
|
|
361
|
+
/* @__PURE__ */ jsx4(
|
|
362
|
+
"button",
|
|
363
|
+
{
|
|
364
|
+
ref: closeButtonRef,
|
|
365
|
+
type: "button",
|
|
366
|
+
className: "sg-shop-sheet__close flex size-7 shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 text-[#343936] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)]",
|
|
367
|
+
"aria-label": "\u5173\u95ED\u95E8\u5E97\u8BE6\u60C5",
|
|
368
|
+
onClick: requestClose,
|
|
369
|
+
children: /* @__PURE__ */ jsx4(X2, { size: 20, weight: "bold" })
|
|
370
|
+
}
|
|
371
|
+
)
|
|
372
|
+
] }),
|
|
373
|
+
/* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__body min-h-0 flex-1 overflow-y-auto px-4 pb-[calc(19px_+_env(safe-area-inset-bottom))] [&::-webkit-scrollbar]:hidden", children: [
|
|
374
|
+
(data.coverUrl || data.logoUrl) && /* @__PURE__ */ jsx4(
|
|
375
|
+
ImageWithFallback,
|
|
376
|
+
{
|
|
377
|
+
src: data.coverUrl ?? data.logoUrl,
|
|
378
|
+
alt: "",
|
|
379
|
+
className: "sg-shop-sheet__cover mt-[5px] block h-[150px] w-full max-w-full rounded-[10px] object-cover",
|
|
380
|
+
size: 176
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
/* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__identity mt-3.5 flex items-start gap-[9px]", children: [
|
|
384
|
+
/* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__identity-copy min-w-0 flex-1", children: [
|
|
385
|
+
/* @__PURE__ */ jsx4("div", { className: "sg-shop-sheet__name-row flex items-center gap-1.5", children: /* @__PURE__ */ jsx4("h3", { className: "min-w-0 flex-1 truncate text-lg leading-[23px] font-bold text-[#262c28]", children: data.name }) }),
|
|
386
|
+
(data.rating || data.avgSpend || data.status.code !== "unknown" && data.status.label || loading) && /* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__stats mt-[5px] flex flex-wrap items-center gap-x-[9px] gap-y-[5px] text-xs text-secondary-foreground", children: [
|
|
387
|
+
data.rating && /* @__PURE__ */ jsxs3("span", { className: "sg-shop-sheet__rating inline-flex items-center gap-[2.5px] font-bold text-[#ef8e24]", children: [
|
|
388
|
+
/* @__PURE__ */ jsx4(Star, { size: 15, weight: "fill" }),
|
|
389
|
+
data.rating
|
|
390
|
+
] }),
|
|
391
|
+
data.avgSpend && /* @__PURE__ */ jsxs3("span", { children: [
|
|
392
|
+
"\u4EBA\u5747 ",
|
|
393
|
+
data.avgSpend
|
|
394
|
+
] }),
|
|
395
|
+
loading ? /* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__skeleton sg-shop-sheet__skeleton--status block h-[18px] w-[46px] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none", "aria-hidden": "true" }) : data.status.code !== "unknown" && /* @__PURE__ */ jsx4("span", { className: `${STATUS_BASE_CLASS} ${STATUS_TONE_CLASS[data.status.code] ?? STATUS_TONE_CLASS.unknown}`, children: data.status.label })
|
|
396
|
+
] })
|
|
397
|
+
] }),
|
|
398
|
+
loading ? /* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__phone-skeleton block size-[39px] shrink-0 rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none", "aria-hidden": "true" }) : phone && /* @__PURE__ */ jsxs3(
|
|
399
|
+
"a",
|
|
400
|
+
{
|
|
401
|
+
className: "sg-shop-sheet__phone flex size-[39px] no-underline shrink-0 flex-col items-center justify-center gap-[2px] rounded-full bg-[#f6f8fb] text-xs text-[#2f3539]",
|
|
402
|
+
href: phone.value.startsWith("tel:") ? phone.value : `tel:${phone.value}`,
|
|
403
|
+
"aria-label": `\u62E8\u6253${data.name}\u7535\u8BDD`,
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ jsx4(Phone, { size: 20, weight: "fill" }),
|
|
406
|
+
/* @__PURE__ */ jsx4("span", { children: "\u7535\u8BDD" })
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
] }),
|
|
411
|
+
/* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__facts mt-2.5 flex flex-col gap-[5px]", children: [
|
|
412
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-1 text-xs leading-4 text-[#858b87]", children: [
|
|
413
|
+
data.businessCategories.length > 0 && /* @__PURE__ */ jsx4("span", { children: data.businessCategories.join(" \xB7 ") }),
|
|
414
|
+
/* @__PURE__ */ jsx4(MapPin, { size: 17, weight: "fill", className: "shrink-0 text-[#2979ff]" }),
|
|
415
|
+
/* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__location text-[#2979ff]", children: data.location.displayText })
|
|
416
|
+
] }),
|
|
417
|
+
!loading && data.operatingStatus && /* @__PURE__ */ jsx4("div", { className: "flex items-center gap-1 text-xs leading-4 text-[#858b87]", children: data.operatingStatus }),
|
|
418
|
+
!loading && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 text-xs leading-4 text-[#858b87]", children: [
|
|
419
|
+
/* @__PURE__ */ jsx4(Clock, { size: 18, className: "shrink-0 text-[#2979ff]" }),
|
|
420
|
+
/* @__PURE__ */ jsx4("span", { children: hoursText })
|
|
421
|
+
] }),
|
|
422
|
+
!loading && data.services && data.services.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 text-xs leading-4 text-[#858b87]", children: [
|
|
423
|
+
"\u652F\u6301",
|
|
424
|
+
data.services.join("\u3001")
|
|
425
|
+
] }),
|
|
426
|
+
loading && /* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__facts-skeleton flex w-full flex-col items-stretch gap-1.5", role: "status", "aria-label": "\u95E8\u5E97\u8BE6\u60C5\u52A0\u8F7D\u4E2D", children: [
|
|
427
|
+
/* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact block h-3 w-[72%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none", "aria-hidden": "true" }),
|
|
428
|
+
/* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact-short block h-3 w-[48%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none", "aria-hidden": "true" })
|
|
429
|
+
] })
|
|
430
|
+
] }),
|
|
431
|
+
loading && /* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__details-skeleton mt-3 flex flex-col gap-[7px]", "aria-hidden": "true", children: [
|
|
432
|
+
/* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line block h-3 w-[88%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" }),
|
|
433
|
+
/* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line-short block h-3 w-[62%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" }),
|
|
434
|
+
/* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-block block h-13 w-full rounded-[9px] bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" })
|
|
435
|
+
] }),
|
|
436
|
+
!loading && data.description && /* @__PURE__ */ jsx4("p", { className: "sg-shop-sheet__description mt-3 text-xs leading-4.5 text-[#666d68]", children: data.description }),
|
|
437
|
+
!loading && data.coupons && data.coupons.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__coupons", "aria-label": "\u95E8\u5E97\u4F18\u60E0", children: [
|
|
438
|
+
/* @__PURE__ */ jsxs3("h3", { className: "sg-shop-sheet__section-title", children: [
|
|
439
|
+
/* @__PURE__ */ jsx4(Tag, { size: 16, weight: "fill", "aria-hidden": "true" }),
|
|
440
|
+
"\u4F18\u60E0\u6D3B\u52A8"
|
|
441
|
+
] }),
|
|
442
|
+
/* @__PURE__ */ jsx4("div", { className: "sg-shop-sheet__coupon-list bg-transparent p-0", children: data.coupons.map((coupon, index) => {
|
|
443
|
+
const purchaseOnly = coupon.salePrice !== void 0 && coupon.salePrice > 0;
|
|
444
|
+
const redirectOnly = purchaseOnly || coupon.freeCouponClaimMode === "REDIRECT";
|
|
445
|
+
const claimToken = coupon.offerRef && claimActionId ? actionTokens?.[claimActionId] : void 0;
|
|
446
|
+
const claimable = Boolean(!redirectOnly && coupon.offerRef && claimToken && !isHistory);
|
|
447
|
+
const redirectAction = redirectOnly && Boolean(coupon.offerRef || coupon.purchaseUrl);
|
|
448
|
+
const claimed = coupon.offerRef !== void 0 && claimedRefs.has(coupon.offerRef);
|
|
449
|
+
return /* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__coupon-row relative grid min-h-[77px] grid-cols-[56px_minmax(0,1fr)_auto] items-center gap-x-2 overflow-hidden border-t-[0.5px] border-[#f0f1f4] bg-transparent py-[9px] first:border-t-0", children: [
|
|
450
|
+
coupon.applicableCategories && coupon.applicableCategories.length > 0 && /* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__coupon-tag absolute top-[9px] right-0 max-w-[40%] truncate rounded-[0_6px_0_6px] bg-[linear-gradient(160deg,#f9e2ac_0%,#dabd88_100%)] px-[5px] py-[1.5px] text-xs leading-3 font-[650] text-[#746447]", children: coupon.applicableCategories.join("\u3001") }),
|
|
451
|
+
coupon.imageUrl && /* @__PURE__ */ jsx4(
|
|
452
|
+
ImageWithFallback,
|
|
453
|
+
{
|
|
454
|
+
src: coupon.imageUrl,
|
|
455
|
+
alt: coupon.name,
|
|
456
|
+
className: "sg-shop-sheet__coupon-img size-14 shrink-0 max-w-full rounded-[6px] object-cover shadow-[inset_0_0_0_0.5px_rgba(11,15,23,0.04)]",
|
|
457
|
+
size: 112
|
|
458
|
+
}
|
|
459
|
+
),
|
|
460
|
+
/* @__PURE__ */ jsxs3("div", { className: "sg-shop-sheet__coupon-body flex min-w-0 flex-1 flex-col justify-center gap-[2.5px]", children: [
|
|
461
|
+
/* @__PURE__ */ jsx4("strong", { className: "sg-shop-sheet__coupon-name line-clamp-2 text-xs leading-[15px] font-[750] text-[rgba(11,15,23,0.9)]", children: coupon.name }),
|
|
462
|
+
coupon.faceValue !== void 0 && /* @__PURE__ */ jsx4("p", { className: "sg-shop-sheet__coupon-price mt-px flex items-baseline gap-1", children: coupon.salePrice === 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
463
|
+
/* @__PURE__ */ jsx4("span", { className: "sg-shop-sheet__coupon-free text-sm leading-4 font-extrabold text-[#e8471c]", children: "\u514D\u8D39" }),
|
|
464
|
+
/* @__PURE__ */ jsxs3("s", { className: "sg-shop-sheet__coupon-face--strike overflow-hidden text-xs line-through text-[rgba(11,15,23,0.38)]", children: [
|
|
465
|
+
"\xA5",
|
|
466
|
+
coupon.faceValue
|
|
467
|
+
] })
|
|
468
|
+
] }) : coupon.salePrice !== void 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
469
|
+
/* @__PURE__ */ jsxs3("span", { className: "sg-shop-sheet__coupon-face text-sm leading-4 font-extrabold text-[#e8471c]", children: [
|
|
470
|
+
"\xA5",
|
|
471
|
+
coupon.salePrice
|
|
472
|
+
] }),
|
|
473
|
+
/* @__PURE__ */ jsxs3("s", { className: "sg-shop-sheet__coupon-face--strike overflow-hidden text-xs line-through text-[rgba(11,15,23,0.38)]", children: [
|
|
474
|
+
"\xA5",
|
|
475
|
+
coupon.faceValue
|
|
476
|
+
] })
|
|
477
|
+
] }) : /* @__PURE__ */ jsxs3("span", { className: "sg-shop-sheet__coupon-face text-sm leading-4 font-extrabold text-[#e8471c]", children: [
|
|
478
|
+
"\xA5",
|
|
479
|
+
coupon.faceValue
|
|
480
|
+
] }) }),
|
|
481
|
+
coupon.usageTimeText && /* @__PURE__ */ jsx4("p", { className: "sg-shop-sheet__coupon-sub line-clamp-2 text-xs leading-[11.5px] text-[rgba(11,15,23,0.55)]", children: coupon.usageTimeText })
|
|
482
|
+
] }),
|
|
483
|
+
redirectAction ? /* @__PURE__ */ jsx4(
|
|
484
|
+
"button",
|
|
485
|
+
{
|
|
486
|
+
type: "button",
|
|
487
|
+
className: "sg-shop-sheet__coupon-claim h-8 min-w-12 shrink-0 cursor-pointer rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-xs font-bold tracking-[0.5px] text-white enabled:hover:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] disabled:cursor-not-allowed disabled:opacity-45",
|
|
488
|
+
disabled: !coupon.purchaseUrl,
|
|
489
|
+
onClick: () => {
|
|
490
|
+
if (!coupon.purchaseUrl) return;
|
|
491
|
+
void navigateToAlipayPage(coupon.purchaseUrl).catch((err) => {
|
|
492
|
+
console.warn("[ShopDetailSheet] navigateTo failed", err);
|
|
493
|
+
});
|
|
494
|
+
},
|
|
495
|
+
children: coupon.purchaseUrl ? `\u53BB\u5C0F\u7A0B\u5E8F${purchaseOnly ? "\u62A2\u8D2D" : "\u9886\u53D6"}` : `${purchaseOnly ? "\u62A2\u8D2D" : "\u9886\u53D6"}\u94FE\u63A5\u6682\u4E0D\u53EF\u7528`
|
|
496
|
+
}
|
|
497
|
+
) : claimable && coupon.offerRef ? /* @__PURE__ */ jsx4(
|
|
498
|
+
"button",
|
|
499
|
+
{
|
|
500
|
+
type: "button",
|
|
501
|
+
className: "sg-shop-sheet__coupon-claim h-8 min-w-12 shrink-0 cursor-pointer rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-xs font-bold tracking-[0.5px] text-white enabled:hover:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] disabled:cursor-not-allowed disabled:opacity-45",
|
|
502
|
+
onClick: () => claimCoupon(coupon.offerRef),
|
|
503
|
+
disabled: claimingRef === coupon.offerRef || claimed,
|
|
504
|
+
children: claimed ? "\u5DF2\u9886\u53D6" : claimingRef === coupon.offerRef ? "\u9886\u53D6\u4E2D\uFF0C\u8BF7\u7A0D\u5019\u2026" : "\u9886\u53D6"
|
|
505
|
+
}
|
|
506
|
+
) : null
|
|
507
|
+
] }, index);
|
|
508
|
+
}) })
|
|
509
|
+
] }),
|
|
510
|
+
!loading && detailActions.length > 0 && /* @__PURE__ */ jsx4(
|
|
511
|
+
ItemActionsRow3,
|
|
512
|
+
{
|
|
513
|
+
actions: detailActions,
|
|
514
|
+
cardId,
|
|
515
|
+
isHistory,
|
|
516
|
+
className: "sg-shop-sheet__actions mt-[15px] flex gap-1.5",
|
|
517
|
+
chipClassName: "sg-shop-sheet__action inline-flex min-h-9 flex-1 items-center justify-center rounded-[9px] border-0 bg-[#313833] px-3 text-xs font-semibold text-white disabled:opacity-48"
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
] })
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// src/client/components/MerchantRow.tsx
|
|
527
|
+
import { MapPin as MapPin2, Star as Star2 } from "@phosphor-icons/react";
|
|
528
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
529
|
+
function MerchantRow(props) {
|
|
530
|
+
const { merchant, disabled = false, className, onSelect } = props;
|
|
531
|
+
return /* @__PURE__ */ jsxs4(
|
|
532
|
+
"button",
|
|
533
|
+
{
|
|
534
|
+
type: "button",
|
|
535
|
+
className: [
|
|
536
|
+
"sg-rm-item-head",
|
|
537
|
+
"sg-merchant-row",
|
|
538
|
+
"flex w-full cursor-pointer gap-[9px] border-0 text-left text-inherit [font-family:inherit] tracking-normal focus-visible:outline-[1.5px] focus-visible:outline-[rgba(9,107,250,0.28)]",
|
|
539
|
+
className
|
|
540
|
+
].filter(Boolean).join(" "),
|
|
541
|
+
"aria-label": `\u67E5\u770B${merchant.name}\u8BE6\u60C5`,
|
|
542
|
+
disabled,
|
|
543
|
+
onClick: onSelect,
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ jsx5(
|
|
546
|
+
ImageWithFallback,
|
|
547
|
+
{
|
|
548
|
+
src: merchant.logoUrl,
|
|
549
|
+
alt: "",
|
|
550
|
+
className: "sg-rm-item-image size-[68px] shrink-0 rounded-[9px] bg-card object-contain max-w-full max-[700px]:size-[70px] [&>svg]:size-[30px]",
|
|
551
|
+
size: 96
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ jsxs4("div", { className: "sg-rm-item-meta flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
555
|
+
/* @__PURE__ */ jsx5("div", { className: "sg-rm-item-name-row flex items-center justify-between gap-1", children: /* @__PURE__ */ jsx5("span", { className: "sg-rm-item-name truncate text-sm leading-[19px] font-semibold text-foreground", children: merchant.name }) }),
|
|
556
|
+
(merchant.rating || merchant.avgSpend) && /* @__PURE__ */ jsxs4("div", { className: "sg-rm-item-stats flex flex-wrap items-center gap-1", children: [
|
|
557
|
+
merchant.rating && /* @__PURE__ */ jsxs4("span", { className: "sg-rm-item-rating inline-flex items-center gap-[2px] text-xs font-semibold text-[#f5a623]", children: [
|
|
558
|
+
/* @__PURE__ */ jsx5(Star2, { size: 14, weight: "fill" }),
|
|
559
|
+
merchant.rating
|
|
560
|
+
] }),
|
|
561
|
+
merchant.avgSpend && /* @__PURE__ */ jsxs4("span", { className: "sg-rm-item-avg-spend text-xs text-secondary-foreground", children: [
|
|
562
|
+
"\u4EBA\u5747 ",
|
|
563
|
+
merchant.avgSpend
|
|
564
|
+
] })
|
|
565
|
+
] }),
|
|
566
|
+
merchant.businessCategories.length > 0 && /* @__PURE__ */ jsx5("div", { className: "sg-rm-item-tags flex gap-1 overflow-hidden", "aria-label": "\u95E8\u5E97\u4E1A\u6001", children: merchant.businessCategories.map((category) => /* @__PURE__ */ jsx5("span", { className: "sg-rm-item-tag max-w-20 shrink-0 truncate rounded-[3.5px] bg-[#fff4df] px-[5px] py-px text-xs leading-3.5 text-[#986415]", children: category }, category)) }),
|
|
567
|
+
/* @__PURE__ */ jsxs4("div", { className: "sg-rm-item-location flex items-center gap-1 overflow-hidden whitespace-nowrap text-xs leading-[15px] text-secondary-foreground", children: [
|
|
568
|
+
/* @__PURE__ */ jsx5(MapPin2, { size: 13, weight: "fill", className: "shrink-0 text-muted-foreground" }),
|
|
569
|
+
/* @__PURE__ */ jsx5("span", { className: "overflow-hidden text-ellipsis", children: merchant.location.displayText })
|
|
570
|
+
] })
|
|
571
|
+
] })
|
|
572
|
+
]
|
|
573
|
+
}
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// src/client/categories.ts
|
|
578
|
+
function resolveCategoryTabs(categoryTabs, items) {
|
|
579
|
+
const result = [];
|
|
580
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
581
|
+
for (const tab of categoryTabs ?? []) {
|
|
582
|
+
const name = tab.name.trim();
|
|
583
|
+
if (!name || seenNames.has(name)) continue;
|
|
584
|
+
seenNames.add(name);
|
|
585
|
+
result.push({ code: tab.code, name });
|
|
586
|
+
}
|
|
587
|
+
for (const item of items) {
|
|
588
|
+
for (const category of item.businessCategories) {
|
|
589
|
+
const name = category.trim();
|
|
590
|
+
if (!name || seenNames.has(name)) continue;
|
|
591
|
+
seenNames.add(name);
|
|
592
|
+
result.push({ code: `derived-${name}`, name });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return result;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// src/client/components/ShopGuideHeader.tsx
|
|
599
|
+
import { Storefront } from "@phosphor-icons/react";
|
|
600
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
601
|
+
function ShopGuideHeader(props) {
|
|
602
|
+
return /* @__PURE__ */ jsxs5("header", { className: "sg-rm-header relative -mx-3 flex min-h-[77px] items-start justify-between gap-2 overflow-hidden bg-[#f9f0df] px-3.5 py-[15px] after:pointer-events-none after:absolute after:inset-y-0 after:right-0 after:w-[62%] after:bg-[image:var(--tbox-asset-sg-header,linear-gradient(135deg,#f9f0df,#f3e5cd))] after:bg-cover after:bg-right after:opacity-90", children: [
|
|
603
|
+
/* @__PURE__ */ jsxs5("div", { className: "sg-rm-header-copy relative z-[1] flex max-w-[66%] flex-col gap-[5px]", children: [
|
|
604
|
+
/* @__PURE__ */ jsxs5("div", { className: "sg-rm-header-title-row flex items-center gap-[5px] text-[#2f3a22]", children: [
|
|
605
|
+
/* @__PURE__ */ jsx6(Storefront, { size: 22, weight: "fill" }),
|
|
606
|
+
/* @__PURE__ */ jsx6("h3", { className: "sg-rm-header-title text-base leading-[21px] font-bold text-[#2f3a22]", children: "\u95E8\u5E97\u5BFC\u89C8" })
|
|
607
|
+
] }),
|
|
608
|
+
/* @__PURE__ */ jsx6("p", { className: "sg-rm-header-subtitle truncate text-xs leading-4 text-[#626b5c]", children: props.subtitle })
|
|
609
|
+
] }),
|
|
610
|
+
/* @__PURE__ */ jsx6("span", { className: "sg-rm-header-badge absolute top-3 right-[11px] z-[2] rounded-full border-[0.5px] border-[rgba(57,76,43,0.14)] bg-[rgba(255,255,255,0.72)] px-[7px] py-[3.5px] text-xs leading-[13px] text-[#526a35]", children: "\u5546\u573A\u5BFC\u89C8" })
|
|
611
|
+
] });
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// src/client/components/ShopGuideSectionLabel.tsx
|
|
615
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
616
|
+
function ShopGuideSectionLabel() {
|
|
617
|
+
return /* @__PURE__ */ jsx7("div", { className: "sg-rm-section-label mt-3.5 flex items-center justify-start gap-[7px] text-sm font-bold text-foreground", children: "\u95E8\u5E97" });
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// src/client/components/ShopListSheet.tsx
|
|
621
|
+
import { useEffect as useEffect2, useId as useId2, useMemo, useRef as useRef2, useState as useState5 } from "react";
|
|
622
|
+
import { MagnifyingGlass, X as X3 } from "@phosphor-icons/react";
|
|
623
|
+
import { Overlay as Overlay3 } from "@tbox.cn/app-agent-ui-kit/overlay";
|
|
624
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
625
|
+
function normalizeSearchText(value) {
|
|
626
|
+
return value.trim().toLocaleLowerCase();
|
|
627
|
+
}
|
|
628
|
+
function floorOrder(a, b) {
|
|
629
|
+
const parse = (value) => {
|
|
630
|
+
const normalized = value.trim().toUpperCase();
|
|
631
|
+
const basement = normalized.match(/^B(\d+)$/);
|
|
632
|
+
if (basement) return -Number(basement[1]);
|
|
633
|
+
const aboveGround = normalized.match(/^(?:L|F)?(\d+)F?$/);
|
|
634
|
+
if (aboveGround) return Number(aboveGround[1]);
|
|
635
|
+
return Number.POSITIVE_INFINITY;
|
|
636
|
+
};
|
|
637
|
+
const numeric = parse(a) - parse(b);
|
|
638
|
+
return Number.isNaN(numeric) || numeric === 0 ? a.localeCompare(b, "zh-CN", { numeric: true }) : numeric;
|
|
639
|
+
}
|
|
640
|
+
var SHEET_ROOT_CLASS = "sg-store-list-sheet group text-foreground group-data-[state=closed]:animate-[sg-shop-sheet-out_180ms_ease-in_both] motion-reduce:animate-none";
|
|
641
|
+
var SHEET_PANEL_CLASS = "sg-store-list-sheet__panel flex h-[86vh] max-h-[86vh] w-[min(100%,375px)] flex-col overflow-hidden rounded-t-[18px] bg-white shadow-[0_-8px_24px_rgba(24,31,27,0.18)] animate-[sg-shop-sheet-in_240ms_cubic-bezier(0.22,0.72,0.24,1)_both] group-data-[state=closed]:animate-[sg-shop-sheet-down_180ms_ease-in_both] motion-reduce:animate-none";
|
|
642
|
+
var CATEGORY_BUTTON_CLASS = "relative min-h-[46px] shrink-0 border-0 bg-transparent px-[9px] py-[7px] text-center text-sm leading-4.5 text-[#4f5551] [font-family:inherit] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)] max-[700px]:px-[5px] max-[700px]:text-xs";
|
|
643
|
+
var CATEGORY_BUTTON_ACTIVE_CLASS = "is-active relative min-h-[46px] shrink-0 border-0 bg-white px-[9px] py-[7px] text-center text-sm leading-4.5 font-bold text-[#273c2d] [font-family:inherit] before:absolute before:top-[13px] before:bottom-[13px] before:left-0 before:w-[3px] before:rounded-r-[3px] before:bg-[#6c8753] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)] max-[700px]:px-[5px] max-[700px]:text-xs";
|
|
644
|
+
var FLOOR_BUTTON_CLASS = "min-h-[23px] border-0 bg-transparent px-[3px] text-xs text-[#7c827e] [font-family:inherit] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)]";
|
|
645
|
+
var FLOOR_BUTTON_ACTIVE_CLASS = "is-active min-h-[23px] border-0 bg-[#30372f] px-[3px] text-xs text-white [font-family:inherit] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)]";
|
|
646
|
+
function ShopListSheet(props) {
|
|
647
|
+
const { open, items, categoryTabs, activeTabCode, onSelect, onClose } = props;
|
|
648
|
+
const [query, setQuery] = useState5("");
|
|
649
|
+
const [sheetTabCode, setSheetTabCode] = useState5("");
|
|
650
|
+
const [activeFloor, setActiveFloor] = useState5("");
|
|
651
|
+
const bodyRef = useRef2(null);
|
|
652
|
+
const closeButtonRef = useRef2(null);
|
|
653
|
+
const titleId = useId2();
|
|
654
|
+
const searchId = useId2();
|
|
655
|
+
const allCategories = useMemo(() => resolveCategoryTabs(categoryTabs, items), [categoryTabs, items]);
|
|
656
|
+
const activeCategory = allCategories.find((tab) => tab.code === sheetTabCode)?.name;
|
|
657
|
+
const matchedItems = useMemo(() => {
|
|
658
|
+
const normalizedQuery = normalizeSearchText(query);
|
|
659
|
+
return items.filter((item) => {
|
|
660
|
+
if (activeCategory && !item.businessCategories.includes(activeCategory)) return false;
|
|
661
|
+
if (!normalizedQuery) return true;
|
|
662
|
+
return normalizeSearchText([
|
|
663
|
+
item.name,
|
|
664
|
+
item.brand,
|
|
665
|
+
...item.businessCategories,
|
|
666
|
+
item.location.displayText
|
|
667
|
+
].filter(Boolean).join(" ")).includes(normalizedQuery);
|
|
668
|
+
});
|
|
669
|
+
}, [activeCategory, items, query]);
|
|
670
|
+
const floorNames = useMemo(() => [...new Set(
|
|
671
|
+
matchedItems.map((item) => item.location.floorName?.trim()).filter((floor) => Boolean(floor))
|
|
672
|
+
)].sort((a, b) => floorOrder(b, a)), [matchedItems]);
|
|
673
|
+
const showFloorRail = floorNames.length >= 2 && matchedItems.length >= 5;
|
|
674
|
+
const filteredItems = useMemo(
|
|
675
|
+
() => activeFloor ? matchedItems.filter((item) => item.location.floorName?.trim() === activeFloor) : matchedItems,
|
|
676
|
+
[activeFloor, matchedItems]
|
|
677
|
+
);
|
|
678
|
+
useEffect2(() => {
|
|
679
|
+
bodyRef.current?.scrollTo({ top: 0 });
|
|
680
|
+
}, [sheetTabCode, activeFloor, query]);
|
|
681
|
+
useEffect2(() => {
|
|
682
|
+
setActiveFloor((current) => current && floorNames.includes(current) ? current : "");
|
|
683
|
+
}, [floorNames]);
|
|
684
|
+
const wasOpenRef = useRef2(false);
|
|
685
|
+
useEffect2(() => {
|
|
686
|
+
if (!open) {
|
|
687
|
+
wasOpenRef.current = false;
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
if (wasOpenRef.current) return;
|
|
691
|
+
wasOpenRef.current = true;
|
|
692
|
+
setQuery("");
|
|
693
|
+
setSheetTabCode(allCategories.some((tab) => tab.code === activeTabCode) ? activeTabCode : "");
|
|
694
|
+
}, [activeTabCode, allCategories, open]);
|
|
695
|
+
return /* @__PURE__ */ jsxs6(
|
|
696
|
+
Overlay3,
|
|
697
|
+
{
|
|
698
|
+
open,
|
|
699
|
+
onDismiss: onClose,
|
|
700
|
+
placement: "bottom",
|
|
701
|
+
labelledBy: titleId,
|
|
702
|
+
initialFocus: closeButtonRef,
|
|
703
|
+
exitMs: 220,
|
|
704
|
+
rootClassName: SHEET_ROOT_CLASS,
|
|
705
|
+
maskClassName: "bg-[rgba(18,21,19,0.52)] backdrop-blur-[2px]",
|
|
706
|
+
panelClassName: SHEET_PANEL_CLASS,
|
|
707
|
+
children: [
|
|
708
|
+
/* @__PURE__ */ jsxs6("header", { className: "sg-store-list-sheet__header flex min-h-[52px] shrink-0 items-center pt-[9px] pr-3 pb-[5px] pl-[18px]", children: [
|
|
709
|
+
/* @__PURE__ */ jsx8("h2", { id: titleId, className: "flex min-w-0 flex-1 items-center justify-center gap-[5px] pl-7 text-lg leading-6", children: "\u95E8\u5E97\u5BFC\u89C8" }),
|
|
710
|
+
/* @__PURE__ */ jsx8("button", { ref: closeButtonRef, type: "button", className: "sg-store-list-sheet__close flex size-7 shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 text-[#343936] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)]", "aria-label": "\u5173\u95ED\u95E8\u5E97\u5217\u8868", onClick: onClose, children: /* @__PURE__ */ jsx8(X3, { size: 20, weight: "bold" }) })
|
|
711
|
+
] }),
|
|
712
|
+
/* @__PURE__ */ jsxs6("div", { className: "sg-store-list-sheet__search mx-[15px] mt-[2px] mb-[9px] flex min-h-[38px] shrink-0 items-center gap-[7px] rounded-[9px] bg-[#f2f3f2] px-[11px] text-[#777d79] focus-within:shadow-[0_0_0_1.5px_rgba(45,98,69,0.16)]", children: [
|
|
713
|
+
/* @__PURE__ */ jsx8("label", { className: "sg-visually-hidden sr-only", htmlFor: searchId, children: "\u641C\u7D22\u95E8\u5E97" }),
|
|
714
|
+
/* @__PURE__ */ jsx8(MagnifyingGlass, { size: 18, "aria-hidden": "true" }),
|
|
715
|
+
/* @__PURE__ */ jsx8(
|
|
716
|
+
"input",
|
|
717
|
+
{
|
|
718
|
+
id: searchId,
|
|
719
|
+
type: "search",
|
|
720
|
+
value: query,
|
|
721
|
+
placeholder: "\u8BF7\u8F93\u5165\u8981\u641C\u7D22\u7684\u5E97\u94FA\u540D",
|
|
722
|
+
onChange: (event) => setQuery(event.target.value),
|
|
723
|
+
className: "h-[34px] min-w-0 flex-1 appearance-none rounded-none border-0 bg-transparent p-0 text-sm text-[#242724] [font-family:inherit] outline-none placeholder:text-[#a7aba8] [&::-webkit-search-cancel-button]:hidden"
|
|
724
|
+
}
|
|
725
|
+
),
|
|
726
|
+
query && /* @__PURE__ */ jsx8("button", { type: "button", className: "flex size-6 shrink-0 items-center justify-center rounded-full border-0 bg-[#dadeda] p-0 text-[#5f6561]", "aria-label": "\u6E05\u7A7A\u95E8\u5E97\u641C\u7D22", onClick: () => setQuery(""), children: /* @__PURE__ */ jsx8(X3, { size: 14, weight: "bold" }) })
|
|
727
|
+
] }),
|
|
728
|
+
/* @__PURE__ */ jsxs6("div", { className: "sg-store-list-sheet__content relative grid min-h-0 flex-1 grid-cols-[82px_minmax(0,1fr)] overflow-hidden border-t-[0.5px] border-[#f0f1ef] max-[700px]:grid-cols-[74px_minmax(0,1fr)]", children: [
|
|
729
|
+
/* @__PURE__ */ jsxs6("nav", { className: "sg-store-list-sheet__categories flex min-h-0 flex-col overflow-y-auto bg-[#f5f6f7] pt-[7px] pb-[calc(22px_+_env(safe-area-inset-bottom))] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", "aria-label": "\u6309\u95E8\u5E97\u4E1A\u6001\u7B5B\u9009", children: [
|
|
730
|
+
/* @__PURE__ */ jsx8(
|
|
731
|
+
"button",
|
|
732
|
+
{
|
|
733
|
+
type: "button",
|
|
734
|
+
className: !sheetTabCode ? CATEGORY_BUTTON_ACTIVE_CLASS : CATEGORY_BUTTON_CLASS,
|
|
735
|
+
"aria-pressed": !sheetTabCode,
|
|
736
|
+
onClick: () => setSheetTabCode(""),
|
|
737
|
+
children: "\u5168\u90E8"
|
|
738
|
+
}
|
|
739
|
+
),
|
|
740
|
+
allCategories.map((tab) => {
|
|
741
|
+
const isActive = sheetTabCode === tab.code;
|
|
742
|
+
return /* @__PURE__ */ jsx8(
|
|
743
|
+
"button",
|
|
744
|
+
{
|
|
745
|
+
type: "button",
|
|
746
|
+
className: isActive ? CATEGORY_BUTTON_ACTIVE_CLASS : CATEGORY_BUTTON_CLASS,
|
|
747
|
+
"aria-pressed": isActive,
|
|
748
|
+
onClick: () => setSheetTabCode(tab.code),
|
|
749
|
+
children: tab.name
|
|
750
|
+
},
|
|
751
|
+
tab.code
|
|
752
|
+
);
|
|
753
|
+
})
|
|
754
|
+
] }),
|
|
755
|
+
/* @__PURE__ */ jsxs6("div", { ref: bodyRef, className: "sg-store-list-sheet__body min-h-0 min-w-0 flex-1 overflow-y-auto bg-[#f7f8f6] px-3 pb-[calc(27px_+_env(safe-area-inset-bottom))] [scroll-padding-top:30px] [&::-webkit-scrollbar]:hidden max-[700px]:px-[9px]", children: [
|
|
756
|
+
/* @__PURE__ */ jsxs6("p", { className: "sg-store-list-sheet__count sticky top-0 z-[2] -mx-px bg-[rgba(247,248,246,0.96)] px-px pt-[9px] pb-[5px] text-xs leading-[15px] text-[#939894]", "aria-live": "polite", children: [
|
|
757
|
+
"\u5F53\u524D\u663E\u793A ",
|
|
758
|
+
filteredItems.length,
|
|
759
|
+
" \u5BB6\u95E8\u5E97"
|
|
760
|
+
] }),
|
|
761
|
+
filteredItems.length === 0 ? /* @__PURE__ */ jsx8("div", { className: "sg-store-list-sheet__empty px-2.5 py-16 text-center text-sm text-secondary-foreground", children: "\u6682\u65F6\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u95E8\u5E97" }) : /* @__PURE__ */ jsx8("ul", { className: "sg-store-list-sheet__list m-0 flex list-none flex-col gap-2 p-0", children: filteredItems.map((item) => /* @__PURE__ */ jsx8("li", { className: "border-0 [scroll-margin-top:32px]", children: /* @__PURE__ */ jsx8(
|
|
762
|
+
MerchantRow,
|
|
763
|
+
{
|
|
764
|
+
merchant: item,
|
|
765
|
+
className: "sg-store-list-sheet__item min-h-[86px] items-center rounded-[9px] bg-white p-[9px] shadow-[0_2px_8px_rgba(34,42,37,0.05)] focus-visible:rounded-[8px] focus-visible:outline-offset-[1.5px] disabled:cursor-default disabled:opacity-72",
|
|
766
|
+
onSelect: () => onSelect(item)
|
|
767
|
+
}
|
|
768
|
+
) }, item.merchantId)) })
|
|
769
|
+
] }),
|
|
770
|
+
showFloorRail && /* @__PURE__ */ jsxs6("nav", { className: "sg-store-list-sheet__floors absolute right-1 bottom-[calc(30px_+_env(safe-area-inset-bottom))] z-[3] flex w-[35px] flex-col overflow-hidden rounded-[15px] border-[0.5px] border-[#eceeeb] bg-[rgba(255,255,255,0.95)] py-1 shadow-[0_3px_10px_rgba(29,36,31,0.12)]", "aria-label": "\u6309\u697C\u5C42\u7B5B\u9009", children: [
|
|
771
|
+
/* @__PURE__ */ jsx8(
|
|
772
|
+
"button",
|
|
773
|
+
{
|
|
774
|
+
type: "button",
|
|
775
|
+
className: !activeFloor ? FLOOR_BUTTON_ACTIVE_CLASS : FLOOR_BUTTON_CLASS,
|
|
776
|
+
"aria-pressed": !activeFloor,
|
|
777
|
+
onClick: () => setActiveFloor(""),
|
|
778
|
+
children: "\u5168"
|
|
779
|
+
}
|
|
780
|
+
),
|
|
781
|
+
floorNames.map((floor) => /* @__PURE__ */ jsx8(
|
|
782
|
+
"button",
|
|
783
|
+
{
|
|
784
|
+
type: "button",
|
|
785
|
+
className: activeFloor === floor ? FLOOR_BUTTON_ACTIVE_CLASS : FLOOR_BUTTON_CLASS,
|
|
786
|
+
"aria-pressed": activeFloor === floor,
|
|
787
|
+
onClick: () => setActiveFloor(floor),
|
|
788
|
+
children: floor
|
|
789
|
+
},
|
|
790
|
+
floor
|
|
791
|
+
))
|
|
792
|
+
] })
|
|
793
|
+
] })
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// src/client/cards/shop-list/index.tsx
|
|
800
|
+
import { httpGet } from "@tbox.cn/app-agent-sdk-client";
|
|
801
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
802
|
+
var PREVIEW_ITEM_COUNT = 3;
|
|
803
|
+
var TAB_CLASS = "sg-rm-tab relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-medium whitespace-nowrap text-[#6b706d] transition-colors duration-150 [font-family:inherit] tracking-normal";
|
|
804
|
+
var TAB_ACTIVE_CLASS = "sg-rm-tab sg-rm-tab--active relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-semibold whitespace-nowrap text-foreground transition-colors duration-150 [font-family:inherit] tracking-normal after:absolute after:bottom-0 after:left-1/2 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[1.5px] after:bg-[#30372f]";
|
|
805
|
+
function projectSheetDataFromItem(merchant) {
|
|
806
|
+
return {
|
|
807
|
+
name: merchant.name,
|
|
808
|
+
logoUrl: merchant.logoUrl,
|
|
809
|
+
coverUrl: merchant.coverUrl,
|
|
810
|
+
brand: merchant.brand,
|
|
811
|
+
businessCategories: merchant.businessCategories,
|
|
812
|
+
location: merchant.location,
|
|
813
|
+
status: merchant.status,
|
|
814
|
+
contactInfo: merchant.contactInfo,
|
|
815
|
+
services: merchant.services,
|
|
816
|
+
itemActions: merchant.itemActions,
|
|
817
|
+
coupons: merchant.coupons
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
function projectSheetDataFromDetail(detail) {
|
|
821
|
+
return {
|
|
822
|
+
name: detail.name,
|
|
823
|
+
logoUrl: detail.logoUrl,
|
|
824
|
+
coverUrl: detail.coverUrls[0],
|
|
825
|
+
brand: detail.brand,
|
|
826
|
+
businessCategories: detail.businessCategories,
|
|
827
|
+
location: detail.location,
|
|
828
|
+
status: detail.status,
|
|
829
|
+
description: detail.description,
|
|
830
|
+
contactInfo: detail.contactInfo,
|
|
831
|
+
services: detail.services,
|
|
832
|
+
itemActions: detail.itemActions,
|
|
833
|
+
coupons: detail.coupons
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
function ShopListCard(props) {
|
|
837
|
+
const { data, cardId, isHistory, actionTokens } = props;
|
|
838
|
+
const [activeTabCode, setActiveTabCode] = useState6("");
|
|
839
|
+
const [overlay, setOverlay] = useState6({ kind: "closed" });
|
|
840
|
+
const [sheetData, setSheetData] = useState6(null);
|
|
841
|
+
const [detailLoading, setDetailLoading] = useState6(false);
|
|
842
|
+
const openedMerchantIdRef = useRef3(null);
|
|
843
|
+
const fetchControllerRef = useRef3(null);
|
|
844
|
+
const allTabs = useMemo2(() => resolveCategoryTabs(data.categoryTabs, data.items), [data.categoryTabs, data.items]);
|
|
845
|
+
const activeTab = allTabs.find((tab) => tab.code === activeTabCode);
|
|
846
|
+
const filteredItems = activeTab ? data.items.filter((item) => item.businessCategories.includes(activeTab.name)) : data.items;
|
|
847
|
+
const previewItems = filteredItems.slice(0, PREVIEW_ITEM_COUNT);
|
|
848
|
+
const closeOverlay = useCallback2(() => {
|
|
849
|
+
fetchControllerRef.current?.abort();
|
|
850
|
+
fetchControllerRef.current = null;
|
|
851
|
+
openedMerchantIdRef.current = null;
|
|
852
|
+
setDetailLoading(false);
|
|
853
|
+
setOverlay({ kind: "closed" });
|
|
854
|
+
setSheetData(null);
|
|
855
|
+
}, []);
|
|
856
|
+
const openDetail = useCallback2((merchant) => {
|
|
857
|
+
fetchControllerRef.current?.abort();
|
|
858
|
+
const controller = new AbortController();
|
|
859
|
+
fetchControllerRef.current = controller;
|
|
860
|
+
openedMerchantIdRef.current = merchant.merchantId;
|
|
861
|
+
setSheetData(projectSheetDataFromItem(merchant));
|
|
862
|
+
setOverlay({ kind: "detail", merchant });
|
|
863
|
+
const { mallId, miniAppId } = data;
|
|
864
|
+
if (!mallId || !miniAppId) {
|
|
865
|
+
setDetailLoading(false);
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
setDetailLoading(true);
|
|
869
|
+
const url = `/api/m/shopping-guide/shop-detail?shopId=${encodeURIComponent(merchant.merchantId)}&mallId=${encodeURIComponent(mallId)}&miniAppId=${encodeURIComponent(miniAppId)}`;
|
|
870
|
+
httpGet(url, { signal: controller.signal }).then(({ data: payload }) => {
|
|
871
|
+
if (openedMerchantIdRef.current === merchant.merchantId && fetchControllerRef.current === controller) {
|
|
872
|
+
if (payload) setSheetData(projectSheetDataFromDetail(payload.data));
|
|
873
|
+
setDetailLoading(false);
|
|
874
|
+
}
|
|
875
|
+
}).catch(() => {
|
|
876
|
+
if (openedMerchantIdRef.current === merchant.merchantId && fetchControllerRef.current === controller) {
|
|
877
|
+
setDetailLoading(false);
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
}, [data]);
|
|
881
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
882
|
+
/* @__PURE__ */ jsxs7("section", { className: "sg-card sg-recommend-merchants sg-shop-list overflow-hidden rounded-[14px] px-3 pb-3 text-foreground", children: [
|
|
883
|
+
/* @__PURE__ */ jsx9(ShopGuideHeader, { subtitle: data.summary ?? "\u6309\u54C1\u7C7B\u5FEB\u901F\u627E\u5230\u60F3\u901B\u7684\u95E8\u5E97" }),
|
|
884
|
+
allTabs.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "sg-rm-tabs mt-[9px] flex gap-4 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", "aria-label": "\u6309\u95E8\u5E97\u54C1\u7C7B\u7B5B\u9009", children: [
|
|
885
|
+
/* @__PURE__ */ jsx9(
|
|
886
|
+
"button",
|
|
887
|
+
{
|
|
888
|
+
type: "button",
|
|
889
|
+
"aria-pressed": !activeTabCode,
|
|
890
|
+
className: !activeTabCode ? TAB_ACTIVE_CLASS : TAB_CLASS,
|
|
891
|
+
onClick: () => setActiveTabCode(""),
|
|
892
|
+
children: /* @__PURE__ */ jsx9("span", { children: "\u5168\u90E8" })
|
|
893
|
+
}
|
|
894
|
+
),
|
|
895
|
+
allTabs.map((tab) => {
|
|
896
|
+
const isActive = tab.code === activeTabCode;
|
|
897
|
+
return /* @__PURE__ */ jsx9(
|
|
898
|
+
"button",
|
|
899
|
+
{
|
|
900
|
+
type: "button",
|
|
901
|
+
"aria-pressed": isActive,
|
|
902
|
+
className: isActive ? TAB_ACTIVE_CLASS : TAB_CLASS,
|
|
903
|
+
onClick: () => setActiveTabCode(tab.code),
|
|
904
|
+
children: /* @__PURE__ */ jsx9("span", { children: tab.name })
|
|
905
|
+
},
|
|
906
|
+
tab.code
|
|
907
|
+
);
|
|
908
|
+
})
|
|
909
|
+
] }),
|
|
910
|
+
filteredItems.length === 0 ? /* @__PURE__ */ jsx9("div", { className: "sg-empty py-6 text-center text-sm text-muted-foreground", children: data.noResultsReason ?? "\u6682\u65F6\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u95E8\u5E97" }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
911
|
+
/* @__PURE__ */ jsx9(ShopGuideSectionLabel, {}),
|
|
912
|
+
/* @__PURE__ */ jsx9("ul", { className: "sg-rm-list mt-1 mr-0 mb-0 ml-0 flex list-none flex-col p-0", children: previewItems.map((item) => /* @__PURE__ */ jsx9("li", { className: "sg-rm-item py-2.5", children: /* @__PURE__ */ jsx9(
|
|
913
|
+
MerchantRow,
|
|
914
|
+
{
|
|
915
|
+
merchant: item,
|
|
916
|
+
className: "items-start bg-transparent p-0 focus-visible:rounded-[6px] focus-visible:outline-offset-[3px]",
|
|
917
|
+
onSelect: () => openDetail(item)
|
|
918
|
+
}
|
|
919
|
+
) }, item.merchantId)) }),
|
|
920
|
+
filteredItems.length > PREVIEW_ITEM_COUNT && /* @__PURE__ */ jsxs7(
|
|
921
|
+
"button",
|
|
922
|
+
{
|
|
923
|
+
type: "button",
|
|
924
|
+
className: "sg-rm-view-all mt-[2px] flex min-h-8 w-full cursor-pointer items-center justify-center gap-[2px] border-0 bg-transparent p-0 text-xs text-[#686d69] focus-visible:rounded-[5px] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)] [font-family:inherit] tracking-normal",
|
|
925
|
+
onClick: () => setOverlay({ kind: "list" }),
|
|
926
|
+
children: [
|
|
927
|
+
"\u67E5\u770B\u5168\u90E8\u95E8\u5E97",
|
|
928
|
+
/* @__PURE__ */ jsx9(CaretRight, { size: 17 })
|
|
929
|
+
]
|
|
930
|
+
}
|
|
931
|
+
)
|
|
932
|
+
] })
|
|
933
|
+
] }),
|
|
934
|
+
/* @__PURE__ */ jsx9(
|
|
935
|
+
ShopListSheet,
|
|
936
|
+
{
|
|
937
|
+
open: overlay.kind === "list",
|
|
938
|
+
items: data.items,
|
|
939
|
+
categoryTabs: allTabs,
|
|
940
|
+
activeTabCode,
|
|
941
|
+
isHistory,
|
|
942
|
+
onSelect: openDetail,
|
|
943
|
+
onClose: closeOverlay
|
|
944
|
+
}
|
|
945
|
+
),
|
|
946
|
+
/* @__PURE__ */ jsx9(
|
|
947
|
+
ShopDetailSheet,
|
|
948
|
+
{
|
|
949
|
+
open: overlay.kind === "detail",
|
|
950
|
+
data: sheetData,
|
|
951
|
+
loading: detailLoading,
|
|
952
|
+
cardId,
|
|
953
|
+
isHistory,
|
|
954
|
+
actionTokens,
|
|
955
|
+
claimActionId: "promotion.acquire-from-shop-list",
|
|
956
|
+
onClose: closeOverlay
|
|
957
|
+
}
|
|
958
|
+
)
|
|
959
|
+
] });
|
|
960
|
+
}
|
|
961
|
+
markSelfRendering(ShopListCard);
|
|
962
|
+
var shop_list_default = ShopListCard;
|
|
963
|
+
|
|
964
|
+
// src/client/cards/shop-detail/index.tsx
|
|
965
|
+
import { useCallback as useCallback3, useRef as useRef4, useState as useState7 } from "react";
|
|
966
|
+
import { Clock as Clock2, Phone as Phone2 } from "@phosphor-icons/react";
|
|
967
|
+
import { httpGet as httpGet2, markSelfRendering as markSelfRendering2 } from "@tbox.cn/app-agent-sdk-client";
|
|
968
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
969
|
+
function projectSheetDataFromCardData(data) {
|
|
970
|
+
return {
|
|
971
|
+
name: data.name,
|
|
972
|
+
logoUrl: data.logoUrl,
|
|
973
|
+
coverUrl: data.coverUrls[0],
|
|
974
|
+
brand: data.brand,
|
|
975
|
+
businessCategories: data.businessCategories,
|
|
976
|
+
location: data.location,
|
|
977
|
+
status: data.status,
|
|
978
|
+
description: data.description,
|
|
979
|
+
contactInfo: data.contactInfo,
|
|
980
|
+
services: data.services,
|
|
981
|
+
itemActions: data.itemActions,
|
|
982
|
+
coupons: data.coupons
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
function ShopDetailCard(props) {
|
|
986
|
+
const { data, cardId, isHistory, actionTokens } = props;
|
|
987
|
+
const [sheetOpen, setSheetOpen] = useState7(false);
|
|
988
|
+
const [sheetData, setSheetData] = useState7(null);
|
|
989
|
+
const [detailLoading, setDetailLoading] = useState7(false);
|
|
990
|
+
const fetchControllerRef = useRef4(null);
|
|
991
|
+
const openDetail = useCallback3(() => {
|
|
992
|
+
fetchControllerRef.current?.abort();
|
|
993
|
+
const controller = new AbortController();
|
|
994
|
+
fetchControllerRef.current = controller;
|
|
995
|
+
setSheetData(projectSheetDataFromCardData(data));
|
|
996
|
+
setSheetOpen(true);
|
|
997
|
+
const { merchantId, mallId, miniAppId } = data;
|
|
998
|
+
if (!mallId || !miniAppId) {
|
|
999
|
+
setDetailLoading(false);
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
setDetailLoading(true);
|
|
1003
|
+
const url = `/api/m/shopping-guide/shop-detail?shopId=${encodeURIComponent(merchantId)}&mallId=${encodeURIComponent(mallId)}&miniAppId=${encodeURIComponent(miniAppId)}`;
|
|
1004
|
+
httpGet2(url, { signal: controller.signal }).then(({ data: payload }) => {
|
|
1005
|
+
if (fetchControllerRef.current === controller) {
|
|
1006
|
+
if (payload) setSheetData(projectSheetDataFromCardData(payload.data));
|
|
1007
|
+
setDetailLoading(false);
|
|
1008
|
+
}
|
|
1009
|
+
}).catch((err) => {
|
|
1010
|
+
if (fetchControllerRef.current !== controller) return;
|
|
1011
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
1012
|
+
setDetailLoading(false);
|
|
1013
|
+
});
|
|
1014
|
+
}, [data]);
|
|
1015
|
+
const closeDetail = useCallback3(() => {
|
|
1016
|
+
fetchControllerRef.current?.abort();
|
|
1017
|
+
fetchControllerRef.current = null;
|
|
1018
|
+
setDetailLoading(false);
|
|
1019
|
+
setSheetOpen(false);
|
|
1020
|
+
setSheetData(null);
|
|
1021
|
+
}, []);
|
|
1022
|
+
const hoursText = data.contactInfo?.find((item) => /hours|营业时间/i.test(item.channel))?.value ?? "\u5468\u4E00-\u5468\u65E5 10:00-22:00";
|
|
1023
|
+
const phone = data.contactInfo?.find((item) => /phone|电话/i.test(item.channel));
|
|
1024
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1025
|
+
/* @__PURE__ */ jsxs8("section", { className: "sg-card sg-recommend-merchants sg-shop-detail overflow-hidden rounded-[14px] px-3 pb-3 text-foreground", children: [
|
|
1026
|
+
/* @__PURE__ */ jsx10(ShopGuideHeader, { subtitle: data.brand ?? data.businessCategories.join(" \xB7 ") ?? "\u95E8\u5E97\u8BE6\u60C5" }),
|
|
1027
|
+
/* @__PURE__ */ jsx10("ul", { className: "sg-rm-list mt-1 mr-0 mb-0 ml-0 flex list-none flex-col p-0", children: /* @__PURE__ */ jsx10("li", { className: "sg-rm-item py-2.5", children: /* @__PURE__ */ jsx10(
|
|
1028
|
+
MerchantRow,
|
|
1029
|
+
{
|
|
1030
|
+
merchant: data,
|
|
1031
|
+
className: "items-start bg-transparent p-0 focus-visible:rounded-[6px] focus-visible:outline-offset-[3px]",
|
|
1032
|
+
onSelect: openDetail
|
|
1033
|
+
}
|
|
1034
|
+
) }) }),
|
|
1035
|
+
(hoursText || phone) && /* @__PURE__ */ jsxs8("div", { className: "sg-shop-detail__facts flex flex-wrap gap-x-2.5 gap-y-1 px-3 pb-[9px]", children: [
|
|
1036
|
+
/* @__PURE__ */ jsxs8("span", { className: "sg-shop-detail__fact inline-flex items-center gap-[3px] text-xs leading-[13px] text-[rgba(11,15,23,0.72)]", children: [
|
|
1037
|
+
/* @__PURE__ */ jsx10(Clock2, { size: 15, weight: "duotone", "aria-hidden": "true", className: "shrink-0 text-[rgba(35,104,236,0.8)]" }),
|
|
1038
|
+
hoursText
|
|
1039
|
+
] }),
|
|
1040
|
+
phone && /* @__PURE__ */ jsxs8("span", { className: "sg-shop-detail__fact inline-flex items-center gap-[3px] text-xs leading-[13px] text-[rgba(11,15,23,0.72)]", children: [
|
|
1041
|
+
/* @__PURE__ */ jsx10(Phone2, { size: 15, weight: "duotone", "aria-hidden": "true", className: "shrink-0 text-[rgba(35,104,236,0.8)]" }),
|
|
1042
|
+
phone.value
|
|
1043
|
+
] })
|
|
1044
|
+
] })
|
|
1045
|
+
] }),
|
|
1046
|
+
/* @__PURE__ */ jsx10(
|
|
1047
|
+
ShopDetailSheet,
|
|
1048
|
+
{
|
|
1049
|
+
open: sheetOpen,
|
|
1050
|
+
data: sheetData,
|
|
1051
|
+
loading: detailLoading,
|
|
1052
|
+
cardId,
|
|
1053
|
+
isHistory,
|
|
1054
|
+
actionTokens,
|
|
1055
|
+
claimActionId: "promotion.acquire-from-shop-detail",
|
|
1056
|
+
onClose: closeDetail
|
|
1057
|
+
}
|
|
1058
|
+
)
|
|
1059
|
+
] });
|
|
1060
|
+
}
|
|
1061
|
+
markSelfRendering2(ShopDetailCard);
|
|
1062
|
+
var shop_detail_default = ShopDetailCard;
|
|
1063
|
+
|
|
1064
|
+
// src/client/cards/category-list/index.tsx
|
|
1065
|
+
import { useState as useState8 } from "react";
|
|
1066
|
+
import { CaretDown } from "@phosphor-icons/react";
|
|
1067
|
+
import { sendCardAction as sendCardAction3 } from "@tbox.cn/app-agent-sdk-client";
|
|
1068
|
+
|
|
1069
|
+
// src/client/cards/view.ts
|
|
1070
|
+
function formatDistance(distanceKm) {
|
|
1071
|
+
if (distanceKm === void 0 || distanceKm < 0) return "\u2014";
|
|
1072
|
+
if (distanceKm < 1) return `${Math.round(distanceKm * 1e3)}m`;
|
|
1073
|
+
return `${distanceKm.toFixed(1)} km`;
|
|
1074
|
+
}
|
|
1075
|
+
function deriveLocationLevel(data) {
|
|
1076
|
+
const { location, itemActions } = data;
|
|
1077
|
+
const hasRoute = itemActions.some((a) => a.kind === "link");
|
|
1078
|
+
if (hasRoute) return "route_available";
|
|
1079
|
+
const locationComplete = Boolean(location.displayText);
|
|
1080
|
+
return locationComplete ? "location_only" : "unavailable";
|
|
1081
|
+
}
|
|
1082
|
+
var CATEGORY_ICONS = {
|
|
1083
|
+
// 英文 key
|
|
1084
|
+
food: "\u{1F35C}",
|
|
1085
|
+
restaurant: "\u{1F35C}",
|
|
1086
|
+
dining: "\u{1F35C}",
|
|
1087
|
+
drinks: "\u{1F964}",
|
|
1088
|
+
beverage: "\u{1F964}",
|
|
1089
|
+
fashion: "\u{1F457}",
|
|
1090
|
+
clothing: "\u{1F457}",
|
|
1091
|
+
apparel: "\u{1F457}",
|
|
1092
|
+
beauty: "\u{1F484}",
|
|
1093
|
+
cosmetics: "\u{1F484}",
|
|
1094
|
+
supermarket: "\u{1F6D2}",
|
|
1095
|
+
groceries: "\u{1F6D2}",
|
|
1096
|
+
cinema: "\u{1F3AC}",
|
|
1097
|
+
entertainment: "\u{1F3AE}",
|
|
1098
|
+
kids: "\u{1F9F8}",
|
|
1099
|
+
children: "\u{1F9F8}",
|
|
1100
|
+
parent_child: "\u{1F9F8}",
|
|
1101
|
+
sports: "\u{1F3C3}",
|
|
1102
|
+
fitness: "\u{1F4AA}",
|
|
1103
|
+
electronics: "\u{1F4F1}",
|
|
1104
|
+
digital: "\u{1F4F1}",
|
|
1105
|
+
home: "\u{1F6CB}\uFE0F",
|
|
1106
|
+
furniture: "\u{1F6CB}\uFE0F",
|
|
1107
|
+
jewelry: "\u{1F48D}",
|
|
1108
|
+
gold: "\u{1F48D}",
|
|
1109
|
+
watch: "\u231A",
|
|
1110
|
+
eyewear: "\u{1F453}",
|
|
1111
|
+
books: "\u{1F4DA}",
|
|
1112
|
+
education: "\u{1F4D6}",
|
|
1113
|
+
hotel: "\u{1F3E8}",
|
|
1114
|
+
travel: "\u{1F9F3}",
|
|
1115
|
+
service: "\u{1F9FE}",
|
|
1116
|
+
lifestyle: "\u{1F9FE}",
|
|
1117
|
+
parking: "\u{1F17F}\uFE0F",
|
|
1118
|
+
car: "\u{1F697}",
|
|
1119
|
+
pharmacy: "\u{1F48A}",
|
|
1120
|
+
healthcare: "\u{1F48A}",
|
|
1121
|
+
flower: "\u{1F490}",
|
|
1122
|
+
pet: "\u{1F43E}",
|
|
1123
|
+
exhibition: "\u{1F5BC}\uFE0F",
|
|
1124
|
+
office: "\u{1F3E2}"
|
|
1125
|
+
};
|
|
1126
|
+
var CATEGORY_ICONS_ZH = [
|
|
1127
|
+
["\u9910\u996E", "\u{1F35C}"],
|
|
1128
|
+
["\u7F8E\u98DF", "\u{1F35C}"],
|
|
1129
|
+
["\u5496\u5561", "\u2615"],
|
|
1130
|
+
["\u8336\u996E", "\u{1F9CB}"],
|
|
1131
|
+
["\u5976\u8336", "\u{1F9CB}"],
|
|
1132
|
+
["\u996E\u54C1", "\u{1F964}"],
|
|
1133
|
+
["\u96F6\u552E", "\u{1F6CD}\uFE0F"],
|
|
1134
|
+
["\u65F6\u5C1A", "\u{1F457}"],
|
|
1135
|
+
["\u670D\u88C5", "\u{1F457}"],
|
|
1136
|
+
["\u5973\u88C5", "\u{1F457}"],
|
|
1137
|
+
["\u7537\u88C5", "\u{1F9E5}"],
|
|
1138
|
+
["\u8FD0\u52A8", "\u{1F3C3}"],
|
|
1139
|
+
["\u5065\u8EAB", "\u{1F4AA}"],
|
|
1140
|
+
["\u7F8E\u5986", "\u{1F484}"],
|
|
1141
|
+
["\u62A4\u80A4", "\u{1F9F4}"],
|
|
1142
|
+
["\u7F8E\u5BB9", "\u{1F486}"],
|
|
1143
|
+
["\u6BCD\u5A74", "\u{1F9F8}"],
|
|
1144
|
+
["\u513F\u7AE5", "\u{1F9F8}"],
|
|
1145
|
+
["\u4EB2\u5B50", "\u{1F9F8}"],
|
|
1146
|
+
["\u8D85\u5E02", "\u{1F6D2}"],
|
|
1147
|
+
["\u4FBF\u5229", "\u{1F6D2}"],
|
|
1148
|
+
["\u751F\u9C9C", "\u{1F966}"],
|
|
1149
|
+
["\u6570\u7801", "\u{1F4F1}"],
|
|
1150
|
+
["\u7535\u5B50", "\u{1F4F1}"],
|
|
1151
|
+
["\u5BB6\u5C45", "\u{1F6CB}\uFE0F"],
|
|
1152
|
+
["\u5BB6\u7535", "\u{1F50C}"],
|
|
1153
|
+
["\u73E0\u5B9D", "\u{1F48D}"],
|
|
1154
|
+
["\u9EC4\u91D1", "\u{1F3C5}"],
|
|
1155
|
+
["\u624B\u8868", "\u231A"],
|
|
1156
|
+
["\u773C\u955C", "\u{1F453}"],
|
|
1157
|
+
["\u4E66\u5E97", "\u{1F4DA}"],
|
|
1158
|
+
["\u6587\u5177", "\u270F\uFE0F"],
|
|
1159
|
+
["\u6559\u80B2", "\u{1F4D6}"],
|
|
1160
|
+
["\u57F9\u8BAD", "\u{1F4D6}"],
|
|
1161
|
+
["\u5F71\u9662", "\u{1F3AC}"],
|
|
1162
|
+
["\u7535\u5F71", "\u{1F3AC}"],
|
|
1163
|
+
["\u5A31\u4E50", "\u{1F3AE}"],
|
|
1164
|
+
["\u6E38\u620F", "\u{1F3AE}"],
|
|
1165
|
+
["\u6587\u4F53", "\u{1F3AD}"],
|
|
1166
|
+
["\u6587\u5316", "\u{1F3A8}"],
|
|
1167
|
+
["\u827A\u672F", "\u{1F3A8}"],
|
|
1168
|
+
["\u5BA0\u7269", "\u{1F43E}"],
|
|
1169
|
+
["\u9C9C\u82B1", "\u{1F490}"],
|
|
1170
|
+
["\u533B\u7597", "\u{1F48A}"],
|
|
1171
|
+
["\u836F\u5E97", "\u{1F48A}"],
|
|
1172
|
+
["\u5065\u5EB7", "\u{1F3E5}"],
|
|
1173
|
+
["\u9152\u5E97", "\u{1F3E8}"],
|
|
1174
|
+
["\u65C5\u884C", "\u{1F9F3}"],
|
|
1175
|
+
["\u505C\u8F66", "\u{1F17F}\uFE0F"],
|
|
1176
|
+
["\u6C7D\u8F66", "\u{1F697}"],
|
|
1177
|
+
["\u670D\u52A1", "\u{1F9FE}"],
|
|
1178
|
+
["\u751F\u6D3B", "\u{1F9FE}"],
|
|
1179
|
+
["\u94F6\u884C", "\u{1F3E6}"],
|
|
1180
|
+
["\u91D1\u878D", "\u{1F4B3}"],
|
|
1181
|
+
["\u672A\u5F52\u7C7B", "\u{1F3EA}"]
|
|
1182
|
+
];
|
|
1183
|
+
function categoryIcon(code) {
|
|
1184
|
+
const key = code.toLowerCase();
|
|
1185
|
+
if (CATEGORY_ICONS[key]) return CATEGORY_ICONS[key];
|
|
1186
|
+
for (const [k, icon] of Object.entries(CATEGORY_ICONS)) {
|
|
1187
|
+
if (key.startsWith(k)) return icon;
|
|
1188
|
+
}
|
|
1189
|
+
for (const [keyword, icon] of CATEGORY_ICONS_ZH) {
|
|
1190
|
+
if (code.includes(keyword)) return icon;
|
|
1191
|
+
}
|
|
1192
|
+
return "\u{1F3EA}";
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
// src/client/cards/category-list/index.tsx
|
|
1196
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1197
|
+
var PAGE = 9;
|
|
1198
|
+
function CategoryListCard(props) {
|
|
1199
|
+
const { data, cardId, isHistory } = props;
|
|
1200
|
+
const [expanded, setExpanded] = useState8(false);
|
|
1201
|
+
const collapsible = data.categories.length > PAGE;
|
|
1202
|
+
const visible = collapsible && !expanded ? data.categories.slice(0, PAGE) : data.categories;
|
|
1203
|
+
function handleCategoryClick(c) {
|
|
1204
|
+
if (isHistory) return;
|
|
1205
|
+
const sendAction = c.itemActions?.find((a) => a.kind === "send");
|
|
1206
|
+
sendCardAction3(cardId, {
|
|
1207
|
+
type: "sendMessage",
|
|
1208
|
+
value: sendAction?.value ?? sendAction?.label ?? `\u67E5\u770B${c.name}\u7684\u95E8\u5E97\u5217\u8868`,
|
|
1209
|
+
visible: true
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
return /* @__PURE__ */ jsxs9("section", { className: "sg-card sg-category-list p-5 text-foreground", children: [
|
|
1213
|
+
/* @__PURE__ */ jsx11("div", { className: "sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]", children: "\u4E1A\u6001\u5206\u7C7B" }),
|
|
1214
|
+
/* @__PURE__ */ jsx11("ul", { className: "sg-category-grid m-0 grid list-none grid-cols-3 gap-2 p-0", children: visible.map((c) => /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsxs9(
|
|
1215
|
+
"button",
|
|
1216
|
+
{
|
|
1217
|
+
type: "button",
|
|
1218
|
+
className: "sg-category-cell flex w-full cursor-pointer flex-col items-center gap-[5px] rounded-[12px] border-0 bg-[var(--tbox-domain-sg-surface,#f7faff)] px-1 pt-3.5 pb-2.5 text-center transition-[transform,background-color] duration-[120ms] active:scale-95 active:bg-[var(--tbox-domain-sg-border,#cfe0f7)] disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 disabled:active:bg-[var(--tbox-domain-sg-surface,#f7faff)] [font-family:inherit] tracking-normal",
|
|
1219
|
+
disabled: isHistory,
|
|
1220
|
+
onClick: () => handleCategoryClick(c),
|
|
1221
|
+
"aria-label": `\u67E5\u770B${c.name}\uFF08${c.merchantCount} \u5BB6\u95E8\u5E97\uFF09`,
|
|
1222
|
+
children: [
|
|
1223
|
+
/* @__PURE__ */ jsx11("span", { className: "sg-category-icon-wrap flex size-12 items-center justify-center rounded-full bg-[rgba(9,107,250,0.08)]", "aria-hidden": "true", children: /* @__PURE__ */ jsx11("span", { className: "sg-category-icon text-2xl leading-none select-none", children: categoryIcon(c.code) }) }),
|
|
1224
|
+
/* @__PURE__ */ jsx11("span", { className: "sg-category-name text-sm leading-4.5 font-semibold break-all text-foreground", children: c.name }),
|
|
1225
|
+
c.merchantCount > 0 && /* @__PURE__ */ jsxs9("span", { className: "sg-category-count text-xs leading-3.5 text-secondary-foreground", children: [
|
|
1226
|
+
c.merchantCount,
|
|
1227
|
+
" \u5BB6"
|
|
1228
|
+
] })
|
|
1229
|
+
]
|
|
1230
|
+
}
|
|
1231
|
+
) }, c.code)) }),
|
|
1232
|
+
collapsible && /* @__PURE__ */ jsxs9(
|
|
1233
|
+
"button",
|
|
1234
|
+
{
|
|
1235
|
+
type: "button",
|
|
1236
|
+
className: "sg-category-toggle mt-2.5 flex w-full cursor-pointer items-center justify-center gap-1 rounded-[8px] border-[0.5px] border-border bg-transparent py-2 text-xs text-secondary-foreground [font-family:inherit] tracking-normal",
|
|
1237
|
+
"aria-expanded": expanded,
|
|
1238
|
+
onClick: () => setExpanded((v) => !v),
|
|
1239
|
+
children: [
|
|
1240
|
+
/* @__PURE__ */ jsx11(
|
|
1241
|
+
CaretDown,
|
|
1242
|
+
{
|
|
1243
|
+
size: 14,
|
|
1244
|
+
className: "sg-category-toggle__icon transition-transform duration-150 data-[rotated]:rotate-180",
|
|
1245
|
+
"data-rotated": expanded || void 0
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
expanded ? "\u6536\u8D77" : `\u5C55\u5F00\u5168\u90E8 ${data.categories.length} \u7C7B`
|
|
1249
|
+
]
|
|
1250
|
+
}
|
|
1251
|
+
),
|
|
1252
|
+
data.buildings && data.buildings.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "sg-category-floors mt-3 border-t-[0.5px] border-border pt-2.5", children: [
|
|
1253
|
+
/* @__PURE__ */ jsx11("div", { className: "sg-category-floors__title mb-2 text-xs font-medium text-secondary-foreground", children: "\u697C\u5C42\u5BFC\u89C8" }),
|
|
1254
|
+
data.buildings.map((building) => /* @__PURE__ */ jsxs9("div", { className: "sg-category-floors__building mb-2", children: [
|
|
1255
|
+
data.buildings.length > 1 && /* @__PURE__ */ jsx11("div", { className: "sg-category-floors__building-name mb-[5px] text-xs text-muted-foreground", children: building.buildingName }),
|
|
1256
|
+
/* @__PURE__ */ jsx11("div", { className: "sg-category-floors__floor-list flex flex-wrap gap-1.5", children: building.floors.map((floor) => /* @__PURE__ */ jsxs9(
|
|
1257
|
+
"button",
|
|
1258
|
+
{
|
|
1259
|
+
type: "button",
|
|
1260
|
+
className: "sg-category-floor-chip inline-flex cursor-pointer items-center gap-[3px] rounded-[20px] border-[0.5px] border-border bg-card px-2.5 py-[5px] text-xs text-foreground transition-[background-color,border-color] duration-100 active:border-[var(--tbox-domain-sg-accent,#096bfa)] active:bg-[#e8f0fe] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal",
|
|
1261
|
+
disabled: isHistory,
|
|
1262
|
+
onClick: () => {
|
|
1263
|
+
if (isHistory) return;
|
|
1264
|
+
sendCardAction3(cardId, {
|
|
1265
|
+
type: "sendMessage",
|
|
1266
|
+
value: `\u5C55\u793A\u5546\u573A${building.buildingName}${floor.floorName}\u7684\u95E8\u5E97\u5217\u8868`,
|
|
1267
|
+
visible: true
|
|
1268
|
+
});
|
|
1269
|
+
},
|
|
1270
|
+
children: [
|
|
1271
|
+
/* @__PURE__ */ jsx11("span", { className: "sg-category-floor-chip__name", children: floor.floorName }),
|
|
1272
|
+
floor.merchantCount > 0 && /* @__PURE__ */ jsx11("span", { className: "sg-category-floor-chip__count text-xs text-muted-foreground", children: floor.merchantCount })
|
|
1273
|
+
]
|
|
1274
|
+
},
|
|
1275
|
+
floor.floorCode
|
|
1276
|
+
)) })
|
|
1277
|
+
] }, building.buildingCode))
|
|
1278
|
+
] })
|
|
1279
|
+
] });
|
|
1280
|
+
}
|
|
1281
|
+
var category_list_default = CategoryListCard;
|
|
1282
|
+
|
|
1283
|
+
// src/client/cards/product-comparison/index.tsx
|
|
1284
|
+
import { useEffect as useEffect3, useState as useState9 } from "react";
|
|
1285
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1286
|
+
var AVAILABILITY_BASE_CLASS3 = "sg-availability mt-1 inline-block text-xs text-secondary-foreground";
|
|
1287
|
+
var AVAILABILITY_TONE_CLASS3 = {
|
|
1288
|
+
in_stock: "sg-availability-in_stock text-success",
|
|
1289
|
+
available: "sg-availability-available text-success",
|
|
1290
|
+
out_of_stock: "sg-availability-out_of_stock text-warning",
|
|
1291
|
+
limited: "sg-availability-limited",
|
|
1292
|
+
unknown: "sg-availability-unknown"
|
|
1293
|
+
};
|
|
1294
|
+
var CELL_CLASS = "border-b-[0.5px] border-border p-2 text-left align-top";
|
|
1295
|
+
function ProductComparisonCard(props) {
|
|
1296
|
+
const { data } = props;
|
|
1297
|
+
const [stale, setStale] = useState9(false);
|
|
1298
|
+
useEffect3(() => {
|
|
1299
|
+
if (!data.refreshRequiredAt) return;
|
|
1300
|
+
const deadline = new Date(data.refreshRequiredAt).getTime();
|
|
1301
|
+
const delay = Math.max(0, deadline - Date.now());
|
|
1302
|
+
const timer = window.setTimeout(() => setStale(true), delay);
|
|
1303
|
+
return () => window.clearTimeout(timer);
|
|
1304
|
+
}, [data.refreshRequiredAt]);
|
|
1305
|
+
const attrNames = Array.from(new Set(data.products.flatMap((p) => p.attributes.map((a) => a.name))));
|
|
1306
|
+
return /* @__PURE__ */ jsxs10("section", { className: `sg-card sg-product-comparison p-5 text-foreground ${stale ? " sg-product-comparison--stale" : ""}`, children: [
|
|
1307
|
+
/* @__PURE__ */ jsx12("div", { className: "sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]", children: "\u5546\u54C1\u5BF9\u6BD4" }),
|
|
1308
|
+
stale && /* @__PURE__ */ jsx12("div", { className: "sg-stale-notice mb-2.5 rounded-[8px] bg-warning-soft px-2.5 py-2 text-xs leading-4.5 text-warning", children: /* @__PURE__ */ jsx12("span", { children: "\u5BF9\u6BD4\u6570\u636E\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77\u5BF9\u6BD4" }) }),
|
|
1309
|
+
/* @__PURE__ */ jsx12("div", { className: "sg-compare-wrap overflow-x-auto", children: /* @__PURE__ */ jsxs10("table", { className: `sg-compare w-full border-collapse text-xs ${stale ? " opacity-60" : ""}`, children: [
|
|
1310
|
+
/* @__PURE__ */ jsx12("thead", { children: /* @__PURE__ */ jsxs10("tr", { children: [
|
|
1311
|
+
/* @__PURE__ */ jsx12("th", { scope: "col", className: `sg-compare__label ${CELL_CLASS} font-medium whitespace-nowrap text-secondary-foreground` }),
|
|
1312
|
+
data.products.map((p) => /* @__PURE__ */ jsxs10("th", { scope: "col", className: CELL_CLASS, children: [
|
|
1313
|
+
/* @__PURE__ */ jsx12(ImageWithFallback, { src: p.imageUrl, alt: p.name, className: "sg-compare__img size-14 max-w-full rounded-[8px] object-cover", size: 40 }),
|
|
1314
|
+
/* @__PURE__ */ jsx12("div", { className: "sg-compare__name mt-1 leading-4.5 font-semibold text-foreground", children: p.name }),
|
|
1315
|
+
/* @__PURE__ */ jsx12("div", { className: "sg-price-sale text-base font-bold tabular-nums text-[#ef4f43]", children: p.price.sale?.display ?? "\u2014" })
|
|
1316
|
+
] }, p.productId))
|
|
1317
|
+
] }) }),
|
|
1318
|
+
/* @__PURE__ */ jsxs10("tbody", { children: [
|
|
1319
|
+
/* @__PURE__ */ jsxs10("tr", { children: [
|
|
1320
|
+
/* @__PURE__ */ jsx12("th", { scope: "row", className: `sg-compare__label ${CELL_CLASS} font-medium whitespace-nowrap text-secondary-foreground`, children: "\u5E93\u5B58" }),
|
|
1321
|
+
data.products.map((p) => /* @__PURE__ */ jsx12("td", { className: CELL_CLASS, children: /* @__PURE__ */ jsx12("span", { className: `${AVAILABILITY_BASE_CLASS3} ${AVAILABILITY_TONE_CLASS3[p.availability.status] ?? ""}`, children: p.availability.label }) }, p.productId))
|
|
1322
|
+
] }),
|
|
1323
|
+
attrNames.map((name) => /* @__PURE__ */ jsxs10("tr", { children: [
|
|
1324
|
+
/* @__PURE__ */ jsx12("th", { scope: "row", className: `sg-compare__label ${CELL_CLASS} font-medium whitespace-nowrap text-secondary-foreground`, children: name }),
|
|
1325
|
+
data.products.map((p) => {
|
|
1326
|
+
const attr = p.attributes.find((a) => a.name === name);
|
|
1327
|
+
return /* @__PURE__ */ jsx12("td", { className: `${CELL_CLASS}${attr ? "" : " sg-compare__cell-empty text-muted-foreground"}`, children: attr?.value ?? "\u2014" }, p.productId);
|
|
1328
|
+
})
|
|
1329
|
+
] }, name))
|
|
1330
|
+
] })
|
|
1331
|
+
] }) }),
|
|
1332
|
+
data.products.some((p) => p.caveats.length > 0) && /* @__PURE__ */ jsx12("div", { className: "sg-item-caveats mt-1.5", children: data.products.flatMap((p) => p.caveats.map((c, i) => ({ key: `${p.productId}-${i}`, text: c }))).map(({ key, text }) => /* @__PURE__ */ jsxs10("div", { className: "sg-caveat-item text-xs leading-4 text-muted-foreground", children: [
|
|
1333
|
+
"\u26A0\uFE0F ",
|
|
1334
|
+
text
|
|
1335
|
+
] }, key)) }),
|
|
1336
|
+
/* @__PURE__ */ jsx12("span", { className: "sg-compare__stale-marker mt-2 block text-xs text-warning", hidden: !stale, children: "\u5BF9\u6BD4\u6570\u636E\u53EF\u80FD\u5DF2\u8FC7\u671F" })
|
|
1337
|
+
] });
|
|
1338
|
+
}
|
|
1339
|
+
var product_comparison_default = ProductComparisonCard;
|
|
1340
|
+
|
|
1341
|
+
// src/client/cards/mall-directory/index.tsx
|
|
1342
|
+
import { useState as useState10 } from "react";
|
|
1343
|
+
import { CaretDown as CaretDown2, Storefront as Storefront2 } from "@phosphor-icons/react";
|
|
1344
|
+
import { sendCardAction as sendCardAction4 } from "@tbox.cn/app-agent-sdk-client";
|
|
1345
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1346
|
+
function MallDirectoryCard(props) {
|
|
1347
|
+
const { data, cardId, isHistory } = props;
|
|
1348
|
+
const [openBuilding, setOpenBuilding] = useState10(
|
|
1349
|
+
data.buildings.length > 0 ? data.buildings[0].buildingCode : null
|
|
1350
|
+
);
|
|
1351
|
+
return /* @__PURE__ */ jsxs11("section", { className: "sg-card sg-mall-directory p-5 text-foreground", children: [
|
|
1352
|
+
/* @__PURE__ */ jsxs11("div", { className: "sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]", children: [
|
|
1353
|
+
data.mallName,
|
|
1354
|
+
" \xB7 \u697C\u5C42\u76EE\u5F55"
|
|
1355
|
+
] }),
|
|
1356
|
+
data.buildings.map((b) => {
|
|
1357
|
+
const open = openBuilding === b.buildingCode;
|
|
1358
|
+
return /* @__PURE__ */ jsxs11("div", { className: "sg-dir-building mt-2 overflow-hidden rounded-[10px] border-[0.5px] border-border", children: [
|
|
1359
|
+
/* @__PURE__ */ jsxs11(
|
|
1360
|
+
"button",
|
|
1361
|
+
{
|
|
1362
|
+
type: "button",
|
|
1363
|
+
className: "sg-dir-building__head flex w-full cursor-pointer items-center gap-2 border-0 bg-card p-3 text-left text-foreground [font-family:inherit] tracking-normal",
|
|
1364
|
+
"aria-expanded": open,
|
|
1365
|
+
onClick: () => setOpenBuilding(open ? null : b.buildingCode),
|
|
1366
|
+
children: [
|
|
1367
|
+
/* @__PURE__ */ jsx13(Storefront2, { size: 18, className: "text-[var(--tbox-domain-sg-accent,#096bfa)]" }),
|
|
1368
|
+
/* @__PURE__ */ jsx13("span", { className: "sg-dir-building__name min-w-0 flex-1 text-sm font-semibold", children: b.buildingName }),
|
|
1369
|
+
/* @__PURE__ */ jsxs11("span", { className: "sg-dir-building__count text-xs text-muted-foreground", children: [
|
|
1370
|
+
b.floors.length,
|
|
1371
|
+
" \u5C42"
|
|
1372
|
+
] }),
|
|
1373
|
+
/* @__PURE__ */ jsx13(CaretDown2, { size: 16, className: "sg-dir-building__chevron text-[var(--tbox-domain-sg-accent,#096bfa)] data-[rotated]:rotate-180 data-[rotated]:transition-transform", "data-rotated": open || void 0 })
|
|
1374
|
+
]
|
|
1375
|
+
}
|
|
1376
|
+
),
|
|
1377
|
+
open && /* @__PURE__ */ jsx13("ul", { className: "sg-dir-floors m-0 list-none border-t-[0.5px] border-border bg-muted p-0", children: b.floors.map((f) => /* @__PURE__ */ jsxs11("li", { className: "sg-dir-floor flex items-center justify-between gap-2 border-b-[0.5px] border-border px-3 py-2 last:border-b-0", children: [
|
|
1378
|
+
/* @__PURE__ */ jsxs11("div", { className: "sg-dir-floor__info grid min-w-0 gap-1", children: [
|
|
1379
|
+
/* @__PURE__ */ jsx13("span", { className: "sg-dir-floor__name text-sm font-medium text-foreground", children: f.floorName }),
|
|
1380
|
+
/* @__PURE__ */ jsx13("span", { className: "sg-dir-floor__cats truncate text-xs text-muted-foreground", children: f.businessCategories.join(" / ") || `${f.merchantCount} \u5BB6\u5546\u6237` })
|
|
1381
|
+
] }),
|
|
1382
|
+
f.itemActions && f.itemActions.length > 0 && /* @__PURE__ */ jsx13(
|
|
1383
|
+
"button",
|
|
1384
|
+
{
|
|
1385
|
+
type: "button",
|
|
1386
|
+
className: "sg-chip sg-dir-floor__action inline-flex min-h-[28px] shrink-0 cursor-pointer items-center justify-center rounded-[9px] border border-border bg-[var(--tbox-domain-sg-surface,#f7faff)] px-2.5 text-xs font-medium whitespace-nowrap text-[var(--tbox-domain-sg-accent,#096bfa)] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal",
|
|
1387
|
+
disabled: isHistory,
|
|
1388
|
+
onClick: () => {
|
|
1389
|
+
if (isHistory) return;
|
|
1390
|
+
const a = f.itemActions[0];
|
|
1391
|
+
sendCardAction4(
|
|
1392
|
+
cardId,
|
|
1393
|
+
a.kind === "send" ? { type: "sendMessage", value: a.value ?? a.label, visible: true } : { type: "openLink", url: a.url }
|
|
1394
|
+
);
|
|
1395
|
+
},
|
|
1396
|
+
children: f.itemActions[0].label
|
|
1397
|
+
}
|
|
1398
|
+
)
|
|
1399
|
+
] }, f.floorCode)) })
|
|
1400
|
+
] }, b.buildingCode);
|
|
1401
|
+
})
|
|
1402
|
+
] });
|
|
1403
|
+
}
|
|
1404
|
+
var mall_directory_default = MallDirectoryCard;
|
|
1405
|
+
|
|
1406
|
+
// src/client/cards/nearby-mall-list/index.tsx
|
|
1407
|
+
import { ItemActionsRow as ItemActionsRow4 } from "@tbox.cn/app-agent-sdk-client";
|
|
1408
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1409
|
+
var STATUS_BASE_CLASS2 = "sg-status inline-block rounded-full px-2 py-0.5 text-xs leading-4 whitespace-nowrap";
|
|
1410
|
+
var STATUS_TONE_CLASS2 = {
|
|
1411
|
+
enabled: "sg-status-enabled text-success bg-success-soft",
|
|
1412
|
+
available: "sg-status-available text-success bg-success-soft",
|
|
1413
|
+
open: "sg-status-open bg-[#e9f8ef] text-[#237a48]",
|
|
1414
|
+
offline: "sg-status-offline bg-[#fff4df] text-[#986415]",
|
|
1415
|
+
closed: "sg-status-closed bg-[#fff4df] text-[#986415]",
|
|
1416
|
+
disabled: "sg-status-disabled bg-[#fff4df] text-[#986415]",
|
|
1417
|
+
unknown: "sg-status-unknown bg-[#fff4df] text-[#986415]"
|
|
1418
|
+
};
|
|
1419
|
+
function NearbyMallListCard(props) {
|
|
1420
|
+
const { data, cardId, isHistory } = props;
|
|
1421
|
+
if (data.malls.length === 0) {
|
|
1422
|
+
return /* @__PURE__ */ jsx14("section", { className: "sg-card p-5 text-foreground", children: /* @__PURE__ */ jsx14("div", { className: "sg-empty py-6 text-center text-sm text-muted-foreground", children: "\u6682\u65E0\u9644\u8FD1\u5546\u573A" }) });
|
|
1423
|
+
}
|
|
1424
|
+
return /* @__PURE__ */ jsxs12("section", { className: "sg-card sg-nearby-malls p-5 text-foreground", children: [
|
|
1425
|
+
/* @__PURE__ */ jsx14("div", { className: "sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]", children: "\u9644\u8FD1\u5546\u573A" }),
|
|
1426
|
+
data.query && /* @__PURE__ */ jsxs12("div", { className: "sg-card-summary mb-3 text-sm text-secondary-foreground", children: [
|
|
1427
|
+
"\u67E5\u8BE2\u300C",
|
|
1428
|
+
data.query,
|
|
1429
|
+
"\u300D"
|
|
1430
|
+
] }),
|
|
1431
|
+
/* @__PURE__ */ jsx14("ul", { className: "sg-nearby-list m-0 list-none p-0", children: data.malls.map((m) => /* @__PURE__ */ jsxs12("li", { className: "sg-nearby-item border-b-[0.5px] border-border py-3 last:border-b-0", children: [
|
|
1432
|
+
/* @__PURE__ */ jsxs12("div", { className: "sg-nearby-item__head", children: [
|
|
1433
|
+
/* @__PURE__ */ jsx14("span", { className: "sg-merchant-name min-w-0 flex-1 truncate text-base font-semibold text-foreground", children: m.name }),
|
|
1434
|
+
/* @__PURE__ */ jsx14("span", { className: `${STATUS_BASE_CLASS2} ${STATUS_TONE_CLASS2[m.status.code] ?? STATUS_TONE_CLASS2.unknown}`, children: m.status.label })
|
|
1435
|
+
] }),
|
|
1436
|
+
/* @__PURE__ */ jsxs12("div", { className: "sg-nearby-item__meta mt-1 flex justify-between gap-2 text-xs text-secondary-foreground", children: [
|
|
1437
|
+
/* @__PURE__ */ jsx14("span", { children: m.address }),
|
|
1438
|
+
/* @__PURE__ */ jsx14("span", { className: "sg-nearby-item__distance shrink-0 font-medium text-[var(--tbox-domain-sg-accent,#096bfa)]", children: formatDistance(m.distanceKm) })
|
|
1439
|
+
] }),
|
|
1440
|
+
/* @__PURE__ */ jsx14(
|
|
1441
|
+
ItemActionsRow4,
|
|
1442
|
+
{
|
|
1443
|
+
actions: m.itemActions,
|
|
1444
|
+
cardId,
|
|
1445
|
+
isHistory,
|
|
1446
|
+
className: "sg-item-actions mt-2 flex flex-wrap gap-1.5",
|
|
1447
|
+
chipClassName: "sg-chip inline-flex min-h-[30px] cursor-pointer items-center justify-center rounded-[9px] border border-border bg-[var(--tbox-domain-sg-surface,#f7faff)] px-3 text-xs font-medium whitespace-nowrap text-[var(--tbox-domain-sg-accent,#096bfa)] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal"
|
|
1448
|
+
}
|
|
1449
|
+
)
|
|
1450
|
+
] }, m.mallId)) })
|
|
1451
|
+
] });
|
|
1452
|
+
}
|
|
1453
|
+
var nearby_mall_list_default = NearbyMallListCard;
|
|
1454
|
+
|
|
1455
|
+
// src/client/cards/human-guide-list/index.tsx
|
|
1456
|
+
import { sendCardAction as sendCardAction5 } from "@tbox.cn/app-agent-sdk-client";
|
|
1457
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1458
|
+
function HumanGuideListCard(props) {
|
|
1459
|
+
const { data, cardId, isHistory } = props;
|
|
1460
|
+
return /* @__PURE__ */ jsxs13("section", { className: "sg-card sg-human-guide p-5 text-foreground", children: [
|
|
1461
|
+
/* @__PURE__ */ jsxs13("div", { className: "sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]", children: [
|
|
1462
|
+
data.merchantName,
|
|
1463
|
+
" \xB7 \u4EBA\u5DE5\u5BFC\u8D2D"
|
|
1464
|
+
] }),
|
|
1465
|
+
data.guides.length === 0 ? /* @__PURE__ */ jsx15("div", { className: "sg-empty py-6 text-center text-sm text-muted-foreground", children: "\u6682\u65E0\u5BFC\u8D2D\u5458\u4FE1\u606F" }) : /* @__PURE__ */ jsx15("ul", { className: "sg-guide-list m-0 list-none p-0", children: data.guides.map((g) => {
|
|
1466
|
+
const contact = g.itemActions[0];
|
|
1467
|
+
const contactDisabled = isHistory || !contact;
|
|
1468
|
+
return /* @__PURE__ */ jsxs13("li", { className: "sg-guide-item flex items-center gap-3 border-b-[0.5px] border-border py-3 last:border-b-0", children: [
|
|
1469
|
+
/* @__PURE__ */ jsx15(ImageWithFallback, { src: g.avatarUrl, alt: g.name, className: "sg-guide-avatar size-12 shrink-0 max-w-full rounded-full object-cover", size: 48 }),
|
|
1470
|
+
/* @__PURE__ */ jsxs13("div", { className: "sg-guide-info min-w-0 flex-1", children: [
|
|
1471
|
+
/* @__PURE__ */ jsxs13("div", { className: "sg-guide-head", children: [
|
|
1472
|
+
/* @__PURE__ */ jsx15("span", { className: "sg-merchant-name min-w-0 flex-1 truncate text-base font-semibold text-foreground", children: g.name }),
|
|
1473
|
+
/* @__PURE__ */ jsx15(
|
|
1474
|
+
"span",
|
|
1475
|
+
{
|
|
1476
|
+
className: g.available ? "sg-status sg-status-available inline-block rounded-full bg-success-soft px-2 py-0.5 text-xs leading-4 whitespace-nowrap text-success" : "sg-status sg-status-offline inline-block rounded-full bg-[#fff4df] px-2 py-0.5 text-xs leading-4 whitespace-nowrap text-[#986415]",
|
|
1477
|
+
children: g.available ? "\u5728\u7EBF" : "\u79BB\u7EBF"
|
|
1478
|
+
}
|
|
1479
|
+
)
|
|
1480
|
+
] }),
|
|
1481
|
+
g.title && /* @__PURE__ */ jsx15("div", { className: "sg-guide-title mt-[2px] text-xs text-secondary-foreground", children: g.title }),
|
|
1482
|
+
g.contactInfo && g.contactInfo.length > 0 && /* @__PURE__ */ jsx15("div", { className: "sg-guide-channels mt-1 flex flex-wrap gap-1.5", children: g.contactInfo.map((c, i) => /* @__PURE__ */ jsx15("span", { className: "sg-guide-channel rounded-[8px] bg-muted px-1.5 py-[0.5px] text-xs text-secondary-foreground", children: c.channel }, i)) })
|
|
1483
|
+
] }),
|
|
1484
|
+
/* @__PURE__ */ jsx15(
|
|
1485
|
+
"button",
|
|
1486
|
+
{
|
|
1487
|
+
type: "button",
|
|
1488
|
+
className: "sg-guide-contact min-h-8 shrink-0 cursor-pointer rounded-[9px] border border-border bg-[var(--tbox-domain-sg-surface,#f7faff)] px-3 text-xs text-[var(--tbox-domain-sg-accent,#096bfa)] disabled:cursor-not-allowed disabled:opacity-50 [font-family:inherit] tracking-normal",
|
|
1489
|
+
disabled: contactDisabled,
|
|
1490
|
+
title: contact ? contact.label : "\u6682\u65E0\u53EF\u7528\u7684\u8054\u7CFB\u65B9\u5F0F",
|
|
1491
|
+
onClick: () => {
|
|
1492
|
+
if (!contact || isHistory) return;
|
|
1493
|
+
sendCardAction5(
|
|
1494
|
+
cardId,
|
|
1495
|
+
contact.kind === "send" ? { type: "sendMessage", value: contact.value ?? contact.label, visible: true } : { type: "openLink", url: contact.url }
|
|
1496
|
+
);
|
|
1497
|
+
},
|
|
1498
|
+
children: contact?.label ?? "\u8054\u7CFB"
|
|
1499
|
+
}
|
|
1500
|
+
)
|
|
1501
|
+
] }, g.guideId);
|
|
1502
|
+
}) }),
|
|
1503
|
+
/* @__PURE__ */ jsx15("p", { className: "sg-guide-privacy mt-2.5 text-xs leading-4 text-muted-foreground", children: "\u5BFC\u8D2D\u4FE1\u606F\u7531\u95E8\u5E97\u63D0\u4F9B\uFF0C\u8054\u7CFB\u65B9\u5F0F\u4EC5\u7528\u4E8E\u672C\u6B21\u54A8\u8BE2" })
|
|
1504
|
+
] });
|
|
1505
|
+
}
|
|
1506
|
+
var human_guide_list_default = HumanGuideListCard;
|
|
1507
|
+
|
|
1508
|
+
// src/client/cards/location-handoff/index.tsx
|
|
1509
|
+
import { MapPin as MapPin3, NavigationArrow } from "@phosphor-icons/react";
|
|
1510
|
+
import { sendCardAction as sendCardAction6 } from "@tbox.cn/app-agent-sdk-client";
|
|
1511
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1512
|
+
function LocationHandoffCard(props) {
|
|
1513
|
+
const { data, cardId } = props;
|
|
1514
|
+
const level = deriveLocationLevel({ location: data.location, itemActions: data.itemActions });
|
|
1515
|
+
const navAction = data.itemActions.find((a) => a.kind === "link");
|
|
1516
|
+
return /* @__PURE__ */ jsxs14("section", { className: "sg-card sg-location-handoff p-5 text-foreground", children: [
|
|
1517
|
+
/* @__PURE__ */ jsxs14("div", { className: "sg-card-title mb-2 flex items-center gap-2 text-lg leading-6 font-bold text-foreground before:h-4 before:w-1 before:shrink-0 before:rounded-[2px] before:bg-[var(--tbox-domain-sg-accent,#096bfa)]", children: [
|
|
1518
|
+
data.merchantName,
|
|
1519
|
+
" \xB7 \u4F4D\u7F6E"
|
|
1520
|
+
] }),
|
|
1521
|
+
data.mapUrl && /* @__PURE__ */ jsx16(ImageWithFallback, { src: data.mapUrl, alt: `${data.merchantName} \u4F4D\u7F6E\u793A\u610F`, className: "sg-lh-map h-40 w-full max-w-full rounded-[12px] object-cover", size: 88 }),
|
|
1522
|
+
/* @__PURE__ */ jsxs14("div", { className: "sg-lh-address mt-2.5 flex items-center gap-1.5 text-sm font-medium text-foreground", children: [
|
|
1523
|
+
/* @__PURE__ */ jsx16(MapPin3, { size: 16, className: "shrink-0 text-[var(--tbox-domain-sg-accent,#096bfa)]" }),
|
|
1524
|
+
/* @__PURE__ */ jsx16("span", { children: data.location.displayText })
|
|
1525
|
+
] }),
|
|
1526
|
+
(data.location.buildingName || data.location.floorName || data.location.unitName) && /* @__PURE__ */ jsxs14("div", { className: "sg-lh-detail mt-2 flex flex-wrap gap-1.5", children: [
|
|
1527
|
+
data.location.buildingName && /* @__PURE__ */ jsx16("span", { className: "rounded-[8px] bg-muted px-2 py-0.5 text-xs text-secondary-foreground", children: data.location.buildingName }),
|
|
1528
|
+
data.location.floorName && /* @__PURE__ */ jsx16("span", { className: "rounded-[8px] bg-muted px-2 py-0.5 text-xs text-secondary-foreground", children: data.location.floorName }),
|
|
1529
|
+
data.location.unitName && /* @__PURE__ */ jsx16("span", { className: "rounded-[8px] bg-muted px-2 py-0.5 text-xs text-secondary-foreground", children: data.location.unitName })
|
|
1530
|
+
] }),
|
|
1531
|
+
level === "route_available" && navAction && /* @__PURE__ */ jsxs14(
|
|
1532
|
+
"button",
|
|
1533
|
+
{
|
|
1534
|
+
type: "button",
|
|
1535
|
+
className: "sg-lh-nav mt-3 flex h-10 w-full cursor-pointer items-center justify-center gap-1.5 rounded-[9px] border-0 bg-[linear-gradient(108deg,#2493ff_0%,#0b63ff_100%)] text-sm font-medium text-white shadow-[0_4px_11px_rgba(18,118,255,0.35)] [font-family:inherit] tracking-normal",
|
|
1536
|
+
onClick: () => {
|
|
1537
|
+
sendCardAction6(cardId, { type: "openLink", url: navAction.url });
|
|
1538
|
+
},
|
|
1539
|
+
children: [
|
|
1540
|
+
/* @__PURE__ */ jsx16(NavigationArrow, { size: 16 }),
|
|
1541
|
+
navAction.label
|
|
1542
|
+
]
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
] });
|
|
1546
|
+
}
|
|
1547
|
+
var location_handoff_default = LocationHandoffCard;
|
|
1548
|
+
|
|
1549
|
+
// src/client/cards/recommend-merchants/index.tsx
|
|
1550
|
+
import { useCallback as useCallback4, useMemo as useMemo3, useState as useState11 } from "react";
|
|
1551
|
+
import { CaretRight as CaretRight2 } from "@phosphor-icons/react";
|
|
1552
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1553
|
+
var PREVIEW_ITEM_COUNT2 = 3;
|
|
1554
|
+
var TAB_CLASS2 = "sg-rm-tab relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-medium whitespace-nowrap text-[#6b706d] transition-colors duration-150 [font-family:inherit] tracking-normal";
|
|
1555
|
+
var TAB_ACTIVE_CLASS2 = "sg-rm-tab sg-rm-tab--active relative flex min-h-7 shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent px-px pb-[7px] text-xs font-semibold whitespace-nowrap text-foreground transition-colors duration-150 [font-family:inherit] tracking-normal after:absolute after:bottom-0 after:left-1/2 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[1.5px] after:bg-[#30372f]";
|
|
1556
|
+
function RecommendMerchantsCard(props) {
|
|
1557
|
+
const { data, cardId, isHistory } = props;
|
|
1558
|
+
const [activeTabCode, setActiveTabCode] = useState11("");
|
|
1559
|
+
const [overlay, setOverlay] = useState11({ kind: "closed" });
|
|
1560
|
+
const visibleTabs = useMemo3(() => resolveCategoryTabs(data.categoryTabs, data.items), [data.categoryTabs, data.items]);
|
|
1561
|
+
function getFilteredItems() {
|
|
1562
|
+
if (!activeTabCode) return data.items;
|
|
1563
|
+
const activeTab = visibleTabs.find((tab) => tab.code === activeTabCode);
|
|
1564
|
+
if (!activeTab) return data.items;
|
|
1565
|
+
return data.items.filter((item) => item.businessCategories.includes(activeTab.name));
|
|
1566
|
+
}
|
|
1567
|
+
const filteredItems = getFilteredItems();
|
|
1568
|
+
const previewItems = filteredItems.slice(0, PREVIEW_ITEM_COUNT2);
|
|
1569
|
+
const selectedMerchant = overlay.kind === "detail" ? overlay.merchant : null;
|
|
1570
|
+
const detailData = useMemo3(() => selectedMerchant ? {
|
|
1571
|
+
name: selectedMerchant.name,
|
|
1572
|
+
logoUrl: selectedMerchant.logoUrl,
|
|
1573
|
+
coverUrl: selectedMerchant.coverUrl,
|
|
1574
|
+
brand: selectedMerchant.brand,
|
|
1575
|
+
businessCategories: selectedMerchant.businessCategories,
|
|
1576
|
+
location: selectedMerchant.location,
|
|
1577
|
+
status: selectedMerchant.status,
|
|
1578
|
+
rating: selectedMerchant.rating,
|
|
1579
|
+
avgSpend: selectedMerchant.avgSpend,
|
|
1580
|
+
operatingStatus: selectedMerchant.operatingStatus,
|
|
1581
|
+
description: selectedMerchant.description,
|
|
1582
|
+
contactInfo: selectedMerchant.contactInfo,
|
|
1583
|
+
services: selectedMerchant.services,
|
|
1584
|
+
itemActions: selectedMerchant.itemActions
|
|
1585
|
+
} : null, [selectedMerchant]);
|
|
1586
|
+
const closeOverlay = useCallback4(() => setOverlay({ kind: "closed" }), []);
|
|
1587
|
+
const openDetail = useCallback4((merchant) => {
|
|
1588
|
+
setOverlay({ kind: "detail", merchant });
|
|
1589
|
+
}, []);
|
|
1590
|
+
return /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
1591
|
+
/* @__PURE__ */ jsxs15("section", { className: "sg-card sg-recommend-merchants overflow-hidden rounded-[14px] px-3 pb-3 text-foreground", children: [
|
|
1592
|
+
/* @__PURE__ */ jsx17(ShopGuideHeader, { subtitle: data.summary ?? "\u6309\u54C1\u7C7B\u53D1\u73B0\u503C\u5F97\u901B\u7684\u95E8\u5E97" }),
|
|
1593
|
+
visibleTabs.length > 0 && /* @__PURE__ */ jsxs15("div", { className: "sg-rm-tabs mt-[9px] flex gap-4 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", "aria-label": "\u6309\u95E8\u5E97\u54C1\u7C7B\u7B5B\u9009", children: [
|
|
1594
|
+
/* @__PURE__ */ jsx17(
|
|
1595
|
+
"button",
|
|
1596
|
+
{
|
|
1597
|
+
type: "button",
|
|
1598
|
+
"aria-pressed": !activeTabCode,
|
|
1599
|
+
className: !activeTabCode ? TAB_ACTIVE_CLASS2 : TAB_CLASS2,
|
|
1600
|
+
onClick: () => setActiveTabCode(""),
|
|
1601
|
+
children: /* @__PURE__ */ jsx17("span", { children: "\u5168\u90E8" })
|
|
1602
|
+
}
|
|
1603
|
+
),
|
|
1604
|
+
visibleTabs.map((tab) => {
|
|
1605
|
+
const isActive = tab.code === activeTabCode;
|
|
1606
|
+
return /* @__PURE__ */ jsx17(
|
|
1607
|
+
"button",
|
|
1608
|
+
{
|
|
1609
|
+
type: "button",
|
|
1610
|
+
"aria-pressed": isActive,
|
|
1611
|
+
className: isActive ? TAB_ACTIVE_CLASS2 : TAB_CLASS2,
|
|
1612
|
+
onClick: () => setActiveTabCode(tab.code),
|
|
1613
|
+
children: /* @__PURE__ */ jsx17("span", { children: tab.name })
|
|
1614
|
+
},
|
|
1615
|
+
tab.code
|
|
1616
|
+
);
|
|
1617
|
+
})
|
|
1618
|
+
] }),
|
|
1619
|
+
filteredItems.length === 0 ? /* @__PURE__ */ jsx17("div", { className: "sg-empty py-6 text-center text-sm text-muted-foreground", children: data.noResultsReason ?? "\u6682\u65F6\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u95E8\u5E97" }) : /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
1620
|
+
/* @__PURE__ */ jsx17(ShopGuideSectionLabel, {}),
|
|
1621
|
+
/* @__PURE__ */ jsx17("ul", { className: "sg-rm-list mt-1 mr-0 mb-0 ml-0 flex list-none flex-col p-0", children: previewItems.map((item) => /* @__PURE__ */ jsx17("li", { className: "sg-rm-item py-2.5", children: /* @__PURE__ */ jsx17(
|
|
1622
|
+
MerchantRow,
|
|
1623
|
+
{
|
|
1624
|
+
merchant: item,
|
|
1625
|
+
className: "items-start bg-transparent p-0 focus-visible:rounded-[6px] focus-visible:outline-offset-[3px]",
|
|
1626
|
+
onSelect: () => openDetail(item)
|
|
1627
|
+
}
|
|
1628
|
+
) }, item.merchantId)) }),
|
|
1629
|
+
filteredItems.length > PREVIEW_ITEM_COUNT2 && /* @__PURE__ */ jsxs15(
|
|
1630
|
+
"button",
|
|
1631
|
+
{
|
|
1632
|
+
type: "button",
|
|
1633
|
+
className: "sg-rm-view-all mt-[2px] flex min-h-8 w-full cursor-pointer items-center justify-center gap-[2px] border-0 bg-transparent p-0 text-xs text-[#686d69] focus-visible:rounded-[5px] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)] [font-family:inherit] tracking-normal",
|
|
1634
|
+
onClick: () => setOverlay({ kind: "list" }),
|
|
1635
|
+
children: [
|
|
1636
|
+
"\u67E5\u770B\u5168\u90E8\u95E8\u5E97",
|
|
1637
|
+
/* @__PURE__ */ jsx17(CaretRight2, { size: 17 })
|
|
1638
|
+
]
|
|
1639
|
+
}
|
|
1640
|
+
)
|
|
1641
|
+
] })
|
|
1642
|
+
] }),
|
|
1643
|
+
/* @__PURE__ */ jsx17(
|
|
1644
|
+
ShopListSheet,
|
|
1645
|
+
{
|
|
1646
|
+
open: overlay.kind === "list",
|
|
1647
|
+
items: data.items,
|
|
1648
|
+
categoryTabs: data.categoryTabs ?? [],
|
|
1649
|
+
activeTabCode,
|
|
1650
|
+
isHistory,
|
|
1651
|
+
onSelect: openDetail,
|
|
1652
|
+
onClose: closeOverlay
|
|
1653
|
+
}
|
|
1654
|
+
),
|
|
1655
|
+
/* @__PURE__ */ jsx17(
|
|
1656
|
+
ShopDetailSheet,
|
|
1657
|
+
{
|
|
1658
|
+
open: overlay.kind === "detail",
|
|
1659
|
+
data: detailData,
|
|
1660
|
+
cardId,
|
|
1661
|
+
isHistory,
|
|
1662
|
+
onClose: closeOverlay
|
|
1663
|
+
}
|
|
1664
|
+
)
|
|
1665
|
+
] });
|
|
1666
|
+
}
|
|
1667
|
+
var recommend_merchants_default = RecommendMerchantsCard;
|
|
1668
|
+
|
|
1669
|
+
// src/client/index.ts
|
|
1670
|
+
var cards = {
|
|
1671
|
+
"product-list": product_list_default,
|
|
1672
|
+
"product-detail": product_detail_default,
|
|
1673
|
+
"shop-list": shop_list_default,
|
|
1674
|
+
"shop-detail": shop_detail_default,
|
|
1675
|
+
"category-list": category_list_default,
|
|
1676
|
+
"product-comparison": product_comparison_default,
|
|
1677
|
+
"mall-directory": mall_directory_default,
|
|
1678
|
+
"nearby-mall-list": nearby_mall_list_default,
|
|
1679
|
+
"human-guide-list": human_guide_list_default,
|
|
1680
|
+
"location-handoff": location_handoff_default,
|
|
1681
|
+
"recommend-merchants": recommend_merchants_default
|
|
1682
|
+
};
|
|
1683
|
+
var clientModule = {
|
|
1684
|
+
cards,
|
|
1685
|
+
register(ctx) {
|
|
1686
|
+
ctx.cards.registerMap(cards);
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1690
|
+
export {
|
|
1691
|
+
clientModule
|
|
1692
|
+
};
|