apps-key-guard 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +167 -5
- package/dist/index.mjs +167 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,14 @@ declare enum Level {
|
|
|
6
6
|
VIP = "vip",
|
|
7
7
|
SuperVIP = "super_vip"
|
|
8
8
|
}
|
|
9
|
+
interface LevelBenefit {
|
|
10
|
+
name: string;
|
|
11
|
+
values: Record<Level.Guest | Level.VIP | Level.SuperVIP, string | boolean>;
|
|
12
|
+
}
|
|
13
|
+
interface LevelBenefitsConfig {
|
|
14
|
+
benefits: LevelBenefit[];
|
|
15
|
+
dialogTitle?: string;
|
|
16
|
+
}
|
|
9
17
|
interface KeyGuardProps {
|
|
10
18
|
appName: string;
|
|
11
19
|
apiBaseUrl?: string;
|
|
@@ -19,7 +27,8 @@ interface KeyGuardProps {
|
|
|
19
27
|
authorWechat?: string;
|
|
20
28
|
authorQrCode?: string;
|
|
21
29
|
allowGuestAccess?: boolean;
|
|
30
|
+
levelBenefits?: LevelBenefitsConfig;
|
|
22
31
|
}
|
|
23
32
|
declare const KeyGuard: React.FC<KeyGuardProps>;
|
|
24
33
|
|
|
25
|
-
export { KeyGuard, type KeyGuardProps, Level, KeyGuard as default };
|
|
34
|
+
export { KeyGuard, type KeyGuardProps, Level, type LevelBenefit, type LevelBenefitsConfig, KeyGuard as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,14 @@ declare enum Level {
|
|
|
6
6
|
VIP = "vip",
|
|
7
7
|
SuperVIP = "super_vip"
|
|
8
8
|
}
|
|
9
|
+
interface LevelBenefit {
|
|
10
|
+
name: string;
|
|
11
|
+
values: Record<Level.Guest | Level.VIP | Level.SuperVIP, string | boolean>;
|
|
12
|
+
}
|
|
13
|
+
interface LevelBenefitsConfig {
|
|
14
|
+
benefits: LevelBenefit[];
|
|
15
|
+
dialogTitle?: string;
|
|
16
|
+
}
|
|
9
17
|
interface KeyGuardProps {
|
|
10
18
|
appName: string;
|
|
11
19
|
apiBaseUrl?: string;
|
|
@@ -19,7 +27,8 @@ interface KeyGuardProps {
|
|
|
19
27
|
authorWechat?: string;
|
|
20
28
|
authorQrCode?: string;
|
|
21
29
|
allowGuestAccess?: boolean;
|
|
30
|
+
levelBenefits?: LevelBenefitsConfig;
|
|
22
31
|
}
|
|
23
32
|
declare const KeyGuard: React.FC<KeyGuardProps>;
|
|
24
33
|
|
|
25
|
-
export { KeyGuard, type KeyGuardProps, Level, KeyGuard as default };
|
|
34
|
+
export { KeyGuard, type KeyGuardProps, Level, type LevelBenefit, type LevelBenefitsConfig, KeyGuard as default };
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,8 @@ var KeyGuard = ({
|
|
|
58
58
|
showFloatingButton = true,
|
|
59
59
|
authorWechat = "zhoulixiang0305",
|
|
60
60
|
authorQrCode = "https://i.postimg.cc/bJz33sy2/saler.jpg",
|
|
61
|
-
allowGuestAccess = false
|
|
61
|
+
allowGuestAccess = false,
|
|
62
|
+
levelBenefits
|
|
62
63
|
}) => {
|
|
63
64
|
const [isValidated, setIsValidated] = (0, import_react.useState)(false);
|
|
64
65
|
const [keyValue, setKeyValue] = (0, import_react.useState)("");
|
|
@@ -70,8 +71,39 @@ var KeyGuard = ({
|
|
|
70
71
|
const [showKey, setShowKey] = (0, import_react.useState)(false);
|
|
71
72
|
const [showContactDialog, setShowContactDialog] = (0, import_react.useState)(false);
|
|
72
73
|
const [guestButtonHover, setGuestButtonHover] = (0, import_react.useState)(false);
|
|
74
|
+
const [showBenefitsDialog, setShowBenefitsDialog] = (0, import_react.useState)(false);
|
|
73
75
|
const storageKey = `${STORAGE_KEY_PREFIX}${appName}`;
|
|
74
76
|
const storageInfoKey = `${STORAGE_KEY_PREFIX}${appName}_info`;
|
|
77
|
+
const defaultLevelBenefits = {
|
|
78
|
+
dialogTitle: "\u7B49\u7EA7\u6743\u76CA\u5BF9\u6BD4",
|
|
79
|
+
benefits: [
|
|
80
|
+
{
|
|
81
|
+
name: "\u57FA\u7840\u8BBF\u95EE",
|
|
82
|
+
values: {
|
|
83
|
+
["guest" /* Guest */]: "\u2713",
|
|
84
|
+
["vip" /* VIP */]: "\u2713",
|
|
85
|
+
["super_vip" /* SuperVIP */]: "\u2713"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "\u9AD8\u7EA7\u529F\u80FD",
|
|
90
|
+
values: {
|
|
91
|
+
["guest" /* Guest */]: "\u2717",
|
|
92
|
+
["vip" /* VIP */]: "\u2713",
|
|
93
|
+
["super_vip" /* SuperVIP */]: "\u2713"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "\u4E13\u5C5E\u652F\u6301",
|
|
98
|
+
values: {
|
|
99
|
+
["guest" /* Guest */]: "\u2717",
|
|
100
|
+
["vip" /* VIP */]: "\u2717",
|
|
101
|
+
["super_vip" /* SuperVIP */]: "\u2713"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
};
|
|
106
|
+
const finalLevelBenefits = levelBenefits || defaultLevelBenefits;
|
|
75
107
|
const verifyKey = async (key) => {
|
|
76
108
|
try {
|
|
77
109
|
const response = await import_axios.default.post(
|
|
@@ -171,6 +203,7 @@ var KeyGuard = ({
|
|
|
171
203
|
setShowPanel(false);
|
|
172
204
|
setShowKey(false);
|
|
173
205
|
setShowContactDialog(false);
|
|
206
|
+
setShowBenefitsDialog(false);
|
|
174
207
|
};
|
|
175
208
|
const formatLevel = (level) => {
|
|
176
209
|
const levelMap = {
|
|
@@ -295,7 +328,18 @@ var KeyGuard = ({
|
|
|
295
328
|
] }),
|
|
296
329
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: infoItemStyle, children: [
|
|
297
330
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: infoLabelStyle, children: "\u7B49\u7EA7" }),
|
|
298
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: levelDisplayContainerStyle, children: [
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: levelBadgeStyle(userInfo.level), children: formatLevel(userInfo.level) }),
|
|
333
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
334
|
+
"button",
|
|
335
|
+
{
|
|
336
|
+
onClick: () => setShowBenefitsDialog(true),
|
|
337
|
+
style: viewBenefitsButtonStyle,
|
|
338
|
+
"aria-label": "\u67E5\u770B\u7B49\u7EA7\u6743\u76CA",
|
|
339
|
+
children: "\u67E5\u770B\u6743\u76CA"
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
] })
|
|
299
343
|
] }),
|
|
300
344
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: infoItemStyle, children: [
|
|
301
345
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: infoLabelStyle, children: "\u8FC7\u671F\u65F6\u95F4" }),
|
|
@@ -308,7 +352,7 @@ var KeyGuard = ({
|
|
|
308
352
|
{
|
|
309
353
|
onClick: () => setShowContactDialog(true),
|
|
310
354
|
style: contactButtonStyle,
|
|
311
|
-
children: "\u8054\u7CFB\u4F5C\u8005"
|
|
355
|
+
children: "\u8054\u7CFB\u4F5C\u8005\u5347\u7EA7"
|
|
312
356
|
}
|
|
313
357
|
),
|
|
314
358
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: handleLogout, style: logoutButtonStyle, children: "\u9000\u51FA\u767B\u5F55" })
|
|
@@ -373,6 +417,70 @@ var KeyGuard = ({
|
|
|
373
417
|
] })
|
|
374
418
|
] }) })
|
|
375
419
|
] })
|
|
420
|
+
] }),
|
|
421
|
+
showBenefitsDialog && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
423
|
+
"div",
|
|
424
|
+
{
|
|
425
|
+
style: overlayStyle,
|
|
426
|
+
onClick: () => setShowBenefitsDialog(false)
|
|
427
|
+
}
|
|
428
|
+
),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: benefitsDialogStyle, children: [
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: panelHeaderStyle, children: [
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { style: panelTitleStyle, children: finalLevelBenefits.dialogTitle || "\u7B49\u7EA7\u6743\u76CA\u5BF9\u6BD4" }),
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
433
|
+
"button",
|
|
434
|
+
{
|
|
435
|
+
onClick: () => setShowBenefitsDialog(false),
|
|
436
|
+
style: closeButtonStyle,
|
|
437
|
+
"aria-label": "\u5173\u95ED",
|
|
438
|
+
children: "\u2715"
|
|
439
|
+
}
|
|
440
|
+
)
|
|
441
|
+
] }),
|
|
442
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: benefitsDialogBodyStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: benefitsTableContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { style: benefitsTableStyle, children: [
|
|
443
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
444
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: benefitsTableHeaderStyle, children: "\u6743\u76CA" }),
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: { ...benefitsTableCellStyle, textAlign: "center" }, children: formatLevel("guest" /* Guest */) }),
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: { ...benefitsTableCellStyle, textAlign: "center" }, children: formatLevel("vip" /* VIP */) }),
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: { ...benefitsTableCellStyle, textAlign: "center" }, children: formatLevel("super_vip" /* SuperVIP */) })
|
|
448
|
+
] }) }),
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: finalLevelBenefits.benefits.map((benefit, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { style: benefitsTableCellStyle, children: benefit.name }),
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
452
|
+
"td",
|
|
453
|
+
{
|
|
454
|
+
style: {
|
|
455
|
+
...benefitsTableCellStyle,
|
|
456
|
+
textAlign: "center"
|
|
457
|
+
},
|
|
458
|
+
children: typeof benefit.values["guest" /* Guest */] === "boolean" ? benefit.values["guest" /* Guest */] ? "\u2713" : "\u2717" : benefit.values["guest" /* Guest */]
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
462
|
+
"td",
|
|
463
|
+
{
|
|
464
|
+
style: {
|
|
465
|
+
...benefitsTableCellStyle,
|
|
466
|
+
textAlign: "center"
|
|
467
|
+
},
|
|
468
|
+
children: typeof benefit.values["vip" /* VIP */] === "boolean" ? benefit.values["vip" /* VIP */] ? "\u2713" : "\u2717" : benefit.values["vip" /* VIP */]
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
472
|
+
"td",
|
|
473
|
+
{
|
|
474
|
+
style: {
|
|
475
|
+
...benefitsTableCellStyle,
|
|
476
|
+
textAlign: "center"
|
|
477
|
+
},
|
|
478
|
+
children: typeof benefit.values["super_vip" /* SuperVIP */] === "boolean" ? benefit.values["super_vip" /* SuperVIP */] ? "\u2713" : "\u2717" : benefit.values["super_vip" /* SuperVIP */]
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
] }, index)) })
|
|
482
|
+
] }) }) })
|
|
483
|
+
] })
|
|
376
484
|
] })
|
|
377
485
|
] })
|
|
378
486
|
] });
|
|
@@ -512,8 +620,7 @@ var panelHeaderStyle = {
|
|
|
512
620
|
display: "flex",
|
|
513
621
|
justifyContent: "space-between",
|
|
514
622
|
alignItems: "center",
|
|
515
|
-
padding: "1.5rem"
|
|
516
|
-
borderBottom: "1px solid #e9ecef"
|
|
623
|
+
padding: "1.5rem"
|
|
517
624
|
};
|
|
518
625
|
var panelTitleStyle = {
|
|
519
626
|
margin: 0,
|
|
@@ -721,6 +828,61 @@ var guestAccessButtonStyle = {
|
|
|
721
828
|
padding: "0.25rem 0.5rem",
|
|
722
829
|
transition: "color 0.2s"
|
|
723
830
|
};
|
|
831
|
+
var levelDisplayContainerStyle = {
|
|
832
|
+
display: "flex",
|
|
833
|
+
alignItems: "center",
|
|
834
|
+
gap: "0.5rem"
|
|
835
|
+
};
|
|
836
|
+
var viewBenefitsButtonStyle = {
|
|
837
|
+
padding: "0.25rem 0.75rem",
|
|
838
|
+
fontSize: "0.75rem",
|
|
839
|
+
fontWeight: "500",
|
|
840
|
+
color: "#007bff",
|
|
841
|
+
backgroundColor: "transparent",
|
|
842
|
+
border: "1px solid #007bff",
|
|
843
|
+
borderRadius: "4px",
|
|
844
|
+
cursor: "pointer",
|
|
845
|
+
transition: "all 0.2s"
|
|
846
|
+
};
|
|
847
|
+
var benefitsDialogStyle = {
|
|
848
|
+
position: "fixed",
|
|
849
|
+
top: "50%",
|
|
850
|
+
left: "50%",
|
|
851
|
+
transform: "translate(-50%, -50%)",
|
|
852
|
+
backgroundColor: "white",
|
|
853
|
+
borderRadius: "12px",
|
|
854
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
855
|
+
width: "90%",
|
|
856
|
+
maxWidth: "600px",
|
|
857
|
+
maxHeight: "80vh",
|
|
858
|
+
overflow: "auto",
|
|
859
|
+
zIndex: 1003,
|
|
860
|
+
animation: "slideIn 0.3s ease"
|
|
861
|
+
};
|
|
862
|
+
var benefitsDialogBodyStyle = {
|
|
863
|
+
padding: "1.5rem"
|
|
864
|
+
};
|
|
865
|
+
var benefitsTableContainerStyle = {
|
|
866
|
+
overflowX: "auto"
|
|
867
|
+
};
|
|
868
|
+
var benefitsTableStyle = {
|
|
869
|
+
width: "100%",
|
|
870
|
+
borderCollapse: "collapse",
|
|
871
|
+
fontSize: "0.875rem"
|
|
872
|
+
};
|
|
873
|
+
var benefitsTableHeaderStyle = {
|
|
874
|
+
padding: "0.75rem",
|
|
875
|
+
backgroundColor: "#f8f9fa",
|
|
876
|
+
borderBottom: "2px solid #dee2e6",
|
|
877
|
+
textAlign: "left",
|
|
878
|
+
fontWeight: "600",
|
|
879
|
+
color: "#333"
|
|
880
|
+
};
|
|
881
|
+
var benefitsTableCellStyle = {
|
|
882
|
+
padding: "0.75rem",
|
|
883
|
+
borderBottom: "1px solid #dee2e6",
|
|
884
|
+
color: "#666"
|
|
885
|
+
};
|
|
724
886
|
var index_default = KeyGuard;
|
|
725
887
|
// Annotate the CommonJS export names for ESM import in node:
|
|
726
888
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,8 @@ var KeyGuard = ({
|
|
|
22
22
|
showFloatingButton = true,
|
|
23
23
|
authorWechat = "zhoulixiang0305",
|
|
24
24
|
authorQrCode = "https://i.postimg.cc/bJz33sy2/saler.jpg",
|
|
25
|
-
allowGuestAccess = false
|
|
25
|
+
allowGuestAccess = false,
|
|
26
|
+
levelBenefits
|
|
26
27
|
}) => {
|
|
27
28
|
const [isValidated, setIsValidated] = useState(false);
|
|
28
29
|
const [keyValue, setKeyValue] = useState("");
|
|
@@ -34,8 +35,39 @@ var KeyGuard = ({
|
|
|
34
35
|
const [showKey, setShowKey] = useState(false);
|
|
35
36
|
const [showContactDialog, setShowContactDialog] = useState(false);
|
|
36
37
|
const [guestButtonHover, setGuestButtonHover] = useState(false);
|
|
38
|
+
const [showBenefitsDialog, setShowBenefitsDialog] = useState(false);
|
|
37
39
|
const storageKey = `${STORAGE_KEY_PREFIX}${appName}`;
|
|
38
40
|
const storageInfoKey = `${STORAGE_KEY_PREFIX}${appName}_info`;
|
|
41
|
+
const defaultLevelBenefits = {
|
|
42
|
+
dialogTitle: "\u7B49\u7EA7\u6743\u76CA\u5BF9\u6BD4",
|
|
43
|
+
benefits: [
|
|
44
|
+
{
|
|
45
|
+
name: "\u57FA\u7840\u8BBF\u95EE",
|
|
46
|
+
values: {
|
|
47
|
+
["guest" /* Guest */]: "\u2713",
|
|
48
|
+
["vip" /* VIP */]: "\u2713",
|
|
49
|
+
["super_vip" /* SuperVIP */]: "\u2713"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "\u9AD8\u7EA7\u529F\u80FD",
|
|
54
|
+
values: {
|
|
55
|
+
["guest" /* Guest */]: "\u2717",
|
|
56
|
+
["vip" /* VIP */]: "\u2713",
|
|
57
|
+
["super_vip" /* SuperVIP */]: "\u2713"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "\u4E13\u5C5E\u652F\u6301",
|
|
62
|
+
values: {
|
|
63
|
+
["guest" /* Guest */]: "\u2717",
|
|
64
|
+
["vip" /* VIP */]: "\u2717",
|
|
65
|
+
["super_vip" /* SuperVIP */]: "\u2713"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
const finalLevelBenefits = levelBenefits || defaultLevelBenefits;
|
|
39
71
|
const verifyKey = async (key) => {
|
|
40
72
|
try {
|
|
41
73
|
const response = await axios.post(
|
|
@@ -135,6 +167,7 @@ var KeyGuard = ({
|
|
|
135
167
|
setShowPanel(false);
|
|
136
168
|
setShowKey(false);
|
|
137
169
|
setShowContactDialog(false);
|
|
170
|
+
setShowBenefitsDialog(false);
|
|
138
171
|
};
|
|
139
172
|
const formatLevel = (level) => {
|
|
140
173
|
const levelMap = {
|
|
@@ -259,7 +292,18 @@ var KeyGuard = ({
|
|
|
259
292
|
] }),
|
|
260
293
|
/* @__PURE__ */ jsxs("div", { style: infoItemStyle, children: [
|
|
261
294
|
/* @__PURE__ */ jsx("span", { style: infoLabelStyle, children: "\u7B49\u7EA7" }),
|
|
262
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ jsxs("div", { style: levelDisplayContainerStyle, children: [
|
|
296
|
+
/* @__PURE__ */ jsx("span", { style: levelBadgeStyle(userInfo.level), children: formatLevel(userInfo.level) }),
|
|
297
|
+
/* @__PURE__ */ jsx(
|
|
298
|
+
"button",
|
|
299
|
+
{
|
|
300
|
+
onClick: () => setShowBenefitsDialog(true),
|
|
301
|
+
style: viewBenefitsButtonStyle,
|
|
302
|
+
"aria-label": "\u67E5\u770B\u7B49\u7EA7\u6743\u76CA",
|
|
303
|
+
children: "\u67E5\u770B\u6743\u76CA"
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
] })
|
|
263
307
|
] }),
|
|
264
308
|
/* @__PURE__ */ jsxs("div", { style: infoItemStyle, children: [
|
|
265
309
|
/* @__PURE__ */ jsx("span", { style: infoLabelStyle, children: "\u8FC7\u671F\u65F6\u95F4" }),
|
|
@@ -272,7 +316,7 @@ var KeyGuard = ({
|
|
|
272
316
|
{
|
|
273
317
|
onClick: () => setShowContactDialog(true),
|
|
274
318
|
style: contactButtonStyle,
|
|
275
|
-
children: "\u8054\u7CFB\u4F5C\u8005"
|
|
319
|
+
children: "\u8054\u7CFB\u4F5C\u8005\u5347\u7EA7"
|
|
276
320
|
}
|
|
277
321
|
),
|
|
278
322
|
/* @__PURE__ */ jsx("button", { onClick: handleLogout, style: logoutButtonStyle, children: "\u9000\u51FA\u767B\u5F55" })
|
|
@@ -337,6 +381,70 @@ var KeyGuard = ({
|
|
|
337
381
|
] })
|
|
338
382
|
] }) })
|
|
339
383
|
] })
|
|
384
|
+
] }),
|
|
385
|
+
showBenefitsDialog && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
386
|
+
/* @__PURE__ */ jsx(
|
|
387
|
+
"div",
|
|
388
|
+
{
|
|
389
|
+
style: overlayStyle,
|
|
390
|
+
onClick: () => setShowBenefitsDialog(false)
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
/* @__PURE__ */ jsxs("div", { style: benefitsDialogStyle, children: [
|
|
394
|
+
/* @__PURE__ */ jsxs("div", { style: panelHeaderStyle, children: [
|
|
395
|
+
/* @__PURE__ */ jsx("h3", { style: panelTitleStyle, children: finalLevelBenefits.dialogTitle || "\u7B49\u7EA7\u6743\u76CA\u5BF9\u6BD4" }),
|
|
396
|
+
/* @__PURE__ */ jsx(
|
|
397
|
+
"button",
|
|
398
|
+
{
|
|
399
|
+
onClick: () => setShowBenefitsDialog(false),
|
|
400
|
+
style: closeButtonStyle,
|
|
401
|
+
"aria-label": "\u5173\u95ED",
|
|
402
|
+
children: "\u2715"
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
] }),
|
|
406
|
+
/* @__PURE__ */ jsx("div", { style: benefitsDialogBodyStyle, children: /* @__PURE__ */ jsx("div", { style: benefitsTableContainerStyle, children: /* @__PURE__ */ jsxs("table", { style: benefitsTableStyle, children: [
|
|
407
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
408
|
+
/* @__PURE__ */ jsx("th", { style: benefitsTableHeaderStyle, children: "\u6743\u76CA" }),
|
|
409
|
+
/* @__PURE__ */ jsx("th", { style: { ...benefitsTableCellStyle, textAlign: "center" }, children: formatLevel("guest" /* Guest */) }),
|
|
410
|
+
/* @__PURE__ */ jsx("th", { style: { ...benefitsTableCellStyle, textAlign: "center" }, children: formatLevel("vip" /* VIP */) }),
|
|
411
|
+
/* @__PURE__ */ jsx("th", { style: { ...benefitsTableCellStyle, textAlign: "center" }, children: formatLevel("super_vip" /* SuperVIP */) })
|
|
412
|
+
] }) }),
|
|
413
|
+
/* @__PURE__ */ jsx("tbody", { children: finalLevelBenefits.benefits.map((benefit, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
414
|
+
/* @__PURE__ */ jsx("td", { style: benefitsTableCellStyle, children: benefit.name }),
|
|
415
|
+
/* @__PURE__ */ jsx(
|
|
416
|
+
"td",
|
|
417
|
+
{
|
|
418
|
+
style: {
|
|
419
|
+
...benefitsTableCellStyle,
|
|
420
|
+
textAlign: "center"
|
|
421
|
+
},
|
|
422
|
+
children: typeof benefit.values["guest" /* Guest */] === "boolean" ? benefit.values["guest" /* Guest */] ? "\u2713" : "\u2717" : benefit.values["guest" /* Guest */]
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
/* @__PURE__ */ jsx(
|
|
426
|
+
"td",
|
|
427
|
+
{
|
|
428
|
+
style: {
|
|
429
|
+
...benefitsTableCellStyle,
|
|
430
|
+
textAlign: "center"
|
|
431
|
+
},
|
|
432
|
+
children: typeof benefit.values["vip" /* VIP */] === "boolean" ? benefit.values["vip" /* VIP */] ? "\u2713" : "\u2717" : benefit.values["vip" /* VIP */]
|
|
433
|
+
}
|
|
434
|
+
),
|
|
435
|
+
/* @__PURE__ */ jsx(
|
|
436
|
+
"td",
|
|
437
|
+
{
|
|
438
|
+
style: {
|
|
439
|
+
...benefitsTableCellStyle,
|
|
440
|
+
textAlign: "center"
|
|
441
|
+
},
|
|
442
|
+
children: typeof benefit.values["super_vip" /* SuperVIP */] === "boolean" ? benefit.values["super_vip" /* SuperVIP */] ? "\u2713" : "\u2717" : benefit.values["super_vip" /* SuperVIP */]
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
] }, index)) })
|
|
446
|
+
] }) }) })
|
|
447
|
+
] })
|
|
340
448
|
] })
|
|
341
449
|
] })
|
|
342
450
|
] });
|
|
@@ -476,8 +584,7 @@ var panelHeaderStyle = {
|
|
|
476
584
|
display: "flex",
|
|
477
585
|
justifyContent: "space-between",
|
|
478
586
|
alignItems: "center",
|
|
479
|
-
padding: "1.5rem"
|
|
480
|
-
borderBottom: "1px solid #e9ecef"
|
|
587
|
+
padding: "1.5rem"
|
|
481
588
|
};
|
|
482
589
|
var panelTitleStyle = {
|
|
483
590
|
margin: 0,
|
|
@@ -685,6 +792,61 @@ var guestAccessButtonStyle = {
|
|
|
685
792
|
padding: "0.25rem 0.5rem",
|
|
686
793
|
transition: "color 0.2s"
|
|
687
794
|
};
|
|
795
|
+
var levelDisplayContainerStyle = {
|
|
796
|
+
display: "flex",
|
|
797
|
+
alignItems: "center",
|
|
798
|
+
gap: "0.5rem"
|
|
799
|
+
};
|
|
800
|
+
var viewBenefitsButtonStyle = {
|
|
801
|
+
padding: "0.25rem 0.75rem",
|
|
802
|
+
fontSize: "0.75rem",
|
|
803
|
+
fontWeight: "500",
|
|
804
|
+
color: "#007bff",
|
|
805
|
+
backgroundColor: "transparent",
|
|
806
|
+
border: "1px solid #007bff",
|
|
807
|
+
borderRadius: "4px",
|
|
808
|
+
cursor: "pointer",
|
|
809
|
+
transition: "all 0.2s"
|
|
810
|
+
};
|
|
811
|
+
var benefitsDialogStyle = {
|
|
812
|
+
position: "fixed",
|
|
813
|
+
top: "50%",
|
|
814
|
+
left: "50%",
|
|
815
|
+
transform: "translate(-50%, -50%)",
|
|
816
|
+
backgroundColor: "white",
|
|
817
|
+
borderRadius: "12px",
|
|
818
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
819
|
+
width: "90%",
|
|
820
|
+
maxWidth: "600px",
|
|
821
|
+
maxHeight: "80vh",
|
|
822
|
+
overflow: "auto",
|
|
823
|
+
zIndex: 1003,
|
|
824
|
+
animation: "slideIn 0.3s ease"
|
|
825
|
+
};
|
|
826
|
+
var benefitsDialogBodyStyle = {
|
|
827
|
+
padding: "1.5rem"
|
|
828
|
+
};
|
|
829
|
+
var benefitsTableContainerStyle = {
|
|
830
|
+
overflowX: "auto"
|
|
831
|
+
};
|
|
832
|
+
var benefitsTableStyle = {
|
|
833
|
+
width: "100%",
|
|
834
|
+
borderCollapse: "collapse",
|
|
835
|
+
fontSize: "0.875rem"
|
|
836
|
+
};
|
|
837
|
+
var benefitsTableHeaderStyle = {
|
|
838
|
+
padding: "0.75rem",
|
|
839
|
+
backgroundColor: "#f8f9fa",
|
|
840
|
+
borderBottom: "2px solid #dee2e6",
|
|
841
|
+
textAlign: "left",
|
|
842
|
+
fontWeight: "600",
|
|
843
|
+
color: "#333"
|
|
844
|
+
};
|
|
845
|
+
var benefitsTableCellStyle = {
|
|
846
|
+
padding: "0.75rem",
|
|
847
|
+
borderBottom: "1px solid #dee2e6",
|
|
848
|
+
color: "#666"
|
|
849
|
+
};
|
|
688
850
|
var index_default = KeyGuard;
|
|
689
851
|
export {
|
|
690
852
|
KeyGuard,
|