@tbox.cn/app-module-member 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-JGZGLFO6.js +111 -0
- package/dist/chunk-ZV6B36AO.js +613 -0
- package/dist/client/index.d.ts +11 -2
- package/dist/client/index.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -4
- package/dist/server/index.d.ts +539 -23
- package/dist/server/index.js +3 -3
- package/package.json +3 -3
- package/src/client/cards/index.tsx +135 -0
- package/src/client/index.ts +19 -4
- package/src/server/cards/index.ts +31 -0
- package/src/server/cards/member-card-summary/meta.ts +21 -0
- package/src/server/cards/member-coupon-detail/meta.ts +19 -0
- package/src/server/cards/member-coupon-list/meta.ts +18 -0
- package/src/server/cards/member-enrollment-form/meta.ts +22 -0
- package/src/server/cards/member-enrollment-status/meta.ts +19 -0
- package/src/server/cards/member-info/meta.ts +19 -0
- package/src/server/cards/member-point-usage-list/meta.ts +20 -0
- package/src/server/handler.ts +125 -11
- package/src/server/index.ts +62 -9
- package/src/server/service.ts +143 -5
- package/src/server/tool.ts +140 -15
- package/src/server/util.ts +4 -0
- package/tbox.component.json +11 -3
- package/tests/service.test.ts +4 -1
- package/dist/chunk-F6FHBH3N.js +0 -160
- package/dist/chunk-OXXT6F5B.js +0 -33
- package/src/client/cards/points/index.tsx +0 -19
- package/src/server/cards/points/meta.ts +0 -22
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// src/client/cards/index.tsx
|
|
2
|
+
import { CardFrame, ValueText, StatusPill } from "@tbox.cn/app-sdk/client";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var itemStyle = {
|
|
5
|
+
padding: "8px 0",
|
|
6
|
+
borderBottom: "1px solid var(--tbox-divider, #f0f0f0)"
|
|
7
|
+
};
|
|
8
|
+
function MemberInfoCard(props) {
|
|
9
|
+
const { data } = props;
|
|
10
|
+
return /* @__PURE__ */ jsxs(CardFrame, { title: "\u4F1A\u5458\u4FE1\u606F", children: [
|
|
11
|
+
/* @__PURE__ */ jsx(StatusPill, { tone: data.state === "active" ? "success" : "neutral", text: data.state === "active" ? "\u5DF2\u5165\u4F1A" : "\u672A\u5165\u4F1A" }),
|
|
12
|
+
data.displayName && /* @__PURE__ */ jsx(ValueText, { label: "\u6635\u79F0", value: data.displayName }),
|
|
13
|
+
data.contactDisplay && /* @__PURE__ */ jsx(ValueText, { label: "\u8054\u7CFB\u65B9\u5F0F", value: data.contactDisplay }),
|
|
14
|
+
data.memberRef && /* @__PURE__ */ jsx(ValueText, { label: "\u4F1A\u5458\u7F16\u53F7", value: data.memberRef }),
|
|
15
|
+
data.labels.length > 0 && /* @__PURE__ */ jsx(ValueText, { label: "\u6807\u7B7E", value: data.labels.map((l) => l.name).join(" / ") })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
function MemberCardSummaryCard(props) {
|
|
19
|
+
const { data } = props;
|
|
20
|
+
return /* @__PURE__ */ jsxs(CardFrame, { title: data.cardDisplay, children: [
|
|
21
|
+
/* @__PURE__ */ jsx(StatusPill, { tone: data.status === "active" ? "success" : "warning", text: data.status === "active" ? "\u6B63\u5E38" : data.status }),
|
|
22
|
+
data.levelName && /* @__PURE__ */ jsx(ValueText, { label: "\u7B49\u7EA7", value: data.levelName }),
|
|
23
|
+
/* @__PURE__ */ jsx(ValueText, { label: "\u53EF\u7528\u79EF\u5206", value: String(data.availablePoints) })
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
function MemberCouponListCard(props) {
|
|
27
|
+
const { data } = props;
|
|
28
|
+
if (data.items.length === 0) return /* @__PURE__ */ jsx(CardFrame, { title: "\u4F18\u60E0\u5238", children: "\u6682\u65E0\u4F18\u60E0\u5238" });
|
|
29
|
+
return /* @__PURE__ */ jsx(CardFrame, { title: "\u4F18\u60E0\u5238", subtitle: `\u5171 ${data.total} \u5F20`, children: data.items.map((c) => /* @__PURE__ */ jsxs("div", { style: itemStyle, children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: c.title }),
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
StatusPill,
|
|
34
|
+
{
|
|
35
|
+
tone: c.status === "effective" ? "success" : "neutral",
|
|
36
|
+
text: c.status === "effective" ? "\u53EF\u4F7F\u7528" : c.status
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }),
|
|
40
|
+
c.benefitText && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--tbox-primary, #e93b3d)" }, children: c.benefitText }),
|
|
41
|
+
c.thresholdText && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--tbox-text-secondary, #888)" }, children: c.thresholdText })
|
|
42
|
+
] }, c.couponRef)) });
|
|
43
|
+
}
|
|
44
|
+
function MemberCouponDetailCard(props) {
|
|
45
|
+
const { data } = props;
|
|
46
|
+
return /* @__PURE__ */ jsxs(CardFrame, { title: data.title, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(StatusPill, { tone: data.status === "effective" ? "success" : "neutral", text: data.status }),
|
|
48
|
+
data.benefitText && /* @__PURE__ */ jsx(ValueText, { label: "\u4F18\u60E0", value: data.benefitText }),
|
|
49
|
+
data.thresholdText && /* @__PURE__ */ jsx(ValueText, { label: "\u95E8\u69DB", value: data.thresholdText }),
|
|
50
|
+
data.description && /* @__PURE__ */ jsx("div", { style: { fontSize: 13, marginTop: 4 }, children: data.description })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
function MemberPointUsageListCard(props) {
|
|
54
|
+
const { data } = props;
|
|
55
|
+
return /* @__PURE__ */ jsxs(CardFrame, { title: "\u79EF\u5206\u4F59\u989D\u4E0E\u6D41\u6C34", subtitle: `\u7B49\u7EA7 ${data.level}`, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(ValueText, { label: "\u5F53\u524D\u79EF\u5206", value: String(data.balance) }),
|
|
57
|
+
data.items.length > 0 && /* @__PURE__ */ jsx("div", { style: { marginTop: 8 }, children: data.items.map((u) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", padding: "4px 0" }, children: [
|
|
58
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 13 }, children: u.title }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"span",
|
|
61
|
+
{
|
|
62
|
+
style: {
|
|
63
|
+
fontSize: 13,
|
|
64
|
+
color: u.amount.startsWith("-") ? "var(--tbox-primary, #e93b3d)" : "var(--tbox-success, #0f8a5f)"
|
|
65
|
+
},
|
|
66
|
+
children: u.amount
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] }, u.usageRecordRef)) })
|
|
70
|
+
] });
|
|
71
|
+
}
|
|
72
|
+
function MemberEnrollmentFormCard(props) {
|
|
73
|
+
const { data } = props;
|
|
74
|
+
if (data.state === "active") {
|
|
75
|
+
return /* @__PURE__ */ jsx(CardFrame, { title: "\u5165\u4F1A", children: /* @__PURE__ */ jsx(StatusPill, { tone: "success", text: "\u5DF2\u5165\u4F1A" }) });
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx(CardFrame, { title: "\u4F1A\u5458\u5165\u4F1A", subtitle: "\u586B\u5199\u4FE1\u606F\u6210\u4E3A\u4F1A\u5458", children: /* @__PURE__ */ jsxs("div", { style: { fontSize: 13, color: "var(--tbox-text-secondary, #888)", marginBottom: 8 }, children: [
|
|
78
|
+
"\u5165\u4F1A\u9700\u8981",
|
|
79
|
+
data.fields.filter((f) => f.required).map((f) => f.label).join("\u3001"),
|
|
80
|
+
"\uFF0C\u5F53\u524D\u4EE5\u4F1A\u8BDD\u8EAB\u4EFD\u4E00\u952E\u5165\u4F1A\uFF08\u8868\u5355\u586B\u5199\u4E8C\u671F\u5F00\u653E\uFF09\u3002"
|
|
81
|
+
] }) });
|
|
82
|
+
}
|
|
83
|
+
function MemberEnrollmentStatusCard(props) {
|
|
84
|
+
const { data } = props;
|
|
85
|
+
return /* @__PURE__ */ jsxs(CardFrame, { title: "\u5165\u4F1A\u7ED3\u679C", children: [
|
|
86
|
+
/* @__PURE__ */ jsx(StatusPill, { tone: data.success ? "success" : "warning", text: data.success ? "\u5165\u4F1A\u6210\u529F" : "\u5165\u4F1A\u5931\u8D25" }),
|
|
87
|
+
data.memberRef && /* @__PURE__ */ jsx(ValueText, { label: "\u4F1A\u5458\u7F16\u53F7", value: data.memberRef }),
|
|
88
|
+
data.message && /* @__PURE__ */ jsx("div", { style: { fontSize: 13, marginTop: 4 }, children: data.message })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/client/index.ts
|
|
93
|
+
var cards = {
|
|
94
|
+
"member-info": MemberInfoCard,
|
|
95
|
+
"member-card-summary": MemberCardSummaryCard,
|
|
96
|
+
"member-coupon-list": MemberCouponListCard,
|
|
97
|
+
"member-coupon-detail": MemberCouponDetailCard,
|
|
98
|
+
"member-point-usage-list": MemberPointUsageListCard,
|
|
99
|
+
"member-enrollment-form": MemberEnrollmentFormCard,
|
|
100
|
+
"member-enrollment-status": MemberEnrollmentStatusCard
|
|
101
|
+
};
|
|
102
|
+
var clientModule = {
|
|
103
|
+
cards,
|
|
104
|
+
register(ctx) {
|
|
105
|
+
ctx.cards.registerMap(cards);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
clientModule
|
|
111
|
+
};
|