@taskon/widget-react 0.0.1-beta.6 → 0.0.1-beta.7

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.
Files changed (32) hide show
  1. package/README.md +48 -43
  2. package/dist/EligibilityInfo.css +2 -33
  3. package/dist/TaskOnProvider.css +287 -0
  4. package/dist/ThemeProvider.css +227 -0
  5. package/dist/UserCenterWidget2.css +32 -290
  6. package/dist/WidgetShell.css +0 -227
  7. package/dist/chunks/{CommunityTaskList-Hde2OKHH.js → CommunityTaskList-D0uVD8wD.js} +37 -58
  8. package/dist/chunks/{EligibilityInfo-BV0Z2TgY.js → EligibilityInfo-Cf6hx9-a.js} +17 -209
  9. package/dist/chunks/{LeaderboardWidget-BNGRD5Bu.js → LeaderboardWidget-DyoiiNS6.js} +10 -9
  10. package/dist/chunks/{PageBuilder-C5DSHiW9.js → PageBuilder-DoAFPm6-.js} +5 -5
  11. package/dist/chunks/{Quest-DG9zfXJo.js → Quest-ySZlYd4u.js} +6 -11
  12. package/dist/chunks/TaskOnProvider-CxtFIs3n.js +2072 -0
  13. package/dist/chunks/{WidgetShell-D7yC894Y.js → ThemeProvider-CulHkqqY.js} +1354 -617
  14. package/dist/chunks/UserCenterWidget-BJsc_GSZ.js +3246 -0
  15. package/dist/chunks/{UserCenterWidget-D5ttw4hO.js → UserCenterWidget-STq8kpV4.js} +162 -365
  16. package/dist/chunks/WidgetShell-8xn-Jivw.js +659 -0
  17. package/dist/chunks/useIsMobile-D6Ybur-6.js +30 -0
  18. package/dist/chunks/useToast-BGJhd3BX.js +93 -0
  19. package/dist/community-task.js +1 -1
  20. package/dist/core.d.ts +9 -15
  21. package/dist/core.js +3 -3
  22. package/dist/index.d.ts +64 -15
  23. package/dist/index.js +15 -10
  24. package/dist/leaderboard.js +1 -1
  25. package/dist/page-builder.js +1 -1
  26. package/dist/quest.js +1 -1
  27. package/dist/user-center.js +1 -1
  28. package/package.json +1 -1
  29. package/dist/chunks/TaskOnProvider-BhamHIyY.js +0 -1260
  30. package/dist/chunks/ThemeProvider-mXLdLSkq.js +0 -1397
  31. package/dist/chunks/UserCenterWidget-jDO5zTN1.js +0 -3297
  32. package/dist/chunks/useToast-CaRkylKe.js +0 -304
@@ -1,230 +1,3 @@
1
- /**
2
- * Dialog 组件样式
3
- * 基于 Radix UI Dialog 封装
4
- * 使用 taskon-dialog-* 命名空间
5
- */
6
-
7
- /*
8
- * Responsive base styles
9
- *
10
- * Keep mobile breakpoints and fallback patterns centralized here.
11
- * Components should reuse these mixins instead of duplicating query logic.
12
- */
13
-
14
- /*
15
- * Desktop-up mixin:
16
- * 1) Enable desktop enhancement in wider containers
17
- * 2) Keep viewport media query as fallback
18
- */
19
-
20
- /* ==================== 遮罩层 ==================== */
21
-
22
- .taskon-dialog-overlay {
23
- position: fixed;
24
- inset: 0;
25
- z-index: 9998;
26
- /* 遮罩层统一使用通用 mask token */
27
- background-color: var(--taskon-color-bg-mask);
28
- backdrop-filter: blur(24px);
29
-
30
- /* 动画 */
31
- animation: taskon-dialog-overlay-fade-in 150ms ease-out;
32
- }
33
-
34
- .taskon-dialog-overlay[data-state="closed"] {
35
- animation: taskon-dialog-overlay-fade-out 150ms ease-in;
36
- }
37
-
38
- @keyframes taskon-dialog-overlay-fade-in {
39
- from {
40
- opacity: 0;
41
- }
42
- to {
43
- opacity: 1;
44
- }
45
- }
46
-
47
- @keyframes taskon-dialog-overlay-fade-out {
48
- from {
49
- opacity: 1;
50
- }
51
- to {
52
- opacity: 0;
53
- }
54
- }
55
-
56
- /* ==================== 弹窗内容 ==================== */
57
-
58
- .taskon-dialog-content {
59
- position: fixed;
60
- top: 50%;
61
- left: 50%;
62
- transform: translate(-50%, -50%);
63
- z-index: 9999;
64
-
65
- /* 尺寸 */
66
- width: 95vw;
67
- max-width: 500px;
68
- max-height: 90vh;
69
-
70
- /* 弹层统一使用更深的背景 token(dark 下最接近最深层) */
71
- background-color: var(--taskon-color-bg-canvas);
72
- color: var(--taskon-color-text);
73
- border-radius: var(--taskon-border-radius);
74
- box-shadow: 0 25px 50px -12px var(--taskon-color-bg-mask);
75
-
76
- /* 布局 */
77
- display: flex;
78
- flex-direction: column;
79
- overflow: hidden;
80
-
81
- /* 移除默认的 focus outline */
82
- outline: none;
83
-
84
- /* 动画 */
85
- animation: taskon-dialog-content-fade-in 200ms ease-out;
86
- }
87
-
88
- .taskon-dialog-content[data-state="closed"] {
89
- animation: taskon-dialog-content-fade-out 150ms ease-in;
90
- }
91
-
92
- @keyframes taskon-dialog-content-fade-in {
93
- from {
94
- opacity: 0;
95
- transform: translate(-50%, -48%) scale(0.96);
96
- }
97
- to {
98
- opacity: 1;
99
- transform: translate(-50%, -50%) scale(1);
100
- }
101
- }
102
-
103
- @keyframes taskon-dialog-content-fade-out {
104
- from {
105
- opacity: 1;
106
- transform: translate(-50%, -50%) scale(1);
107
- }
108
- to {
109
- opacity: 0;
110
- transform: translate(-50%, -48%) scale(0.96);
111
- }
112
- }
113
-
114
- /* ==================== 无障碍标题/描述(屏幕阅读器可见) ==================== */
115
-
116
- .taskon-dialog-title--sr-only,
117
- .taskon-dialog-description--sr-only {
118
- position: absolute;
119
- width: 1px;
120
- height: 1px;
121
- padding: 0;
122
- margin: -1px;
123
- overflow: hidden;
124
- clip: rect(0, 0, 0, 0);
125
- white-space: nowrap;
126
- border: 0;
127
- }
128
-
129
- /* ==================== 头部操作区 ==================== */
130
-
131
- .taskon-dialog-header {
132
- position: absolute;
133
- top: 12px;
134
- right: 12px;
135
- z-index: 1;
136
-
137
- display: flex;
138
- align-items: center;
139
- gap: 8px;
140
- }
141
-
142
- .taskon-dialog-header-slot {
143
- display: flex;
144
- align-items: center;
145
- }
146
-
147
- /* ==================== 关闭按钮 ==================== */
148
-
149
- .taskon-dialog-close {
150
- display: flex;
151
- align-items: center;
152
- justify-content: center;
153
-
154
- width: 32px;
155
- height: 32px;
156
- padding: 0;
157
-
158
- background: var(--taskon-color-bg-surface-subtle);
159
- border: none;
160
- border-radius: var(--taskon-border-radius-sm);
161
- cursor: pointer;
162
-
163
- color: var(--taskon-color-text-secondary);
164
- transition: all 0.2s ease;
165
- }
166
-
167
- .taskon-dialog-close:hover {
168
- background-color: var(--taskon-color-bg-surface);
169
- color: var(--taskon-color-text);
170
- }
171
-
172
- .taskon-dialog-close:focus-visible {
173
- outline: 2px solid var(--taskon-color-primary);
174
- outline-offset: 2px;
175
- }
176
-
177
- /* ==================== 主体内容 ==================== */
178
-
179
- .taskon-dialog-body {
180
- flex: 1;
181
- overflow-y: auto;
182
- padding: 20px;
183
- }
184
-
185
- .taskon-dialog-body--no-padding {
186
- padding: 0;
187
- }
188
-
189
- /* ==================== Desktop 增强 ==================== */
190
-
191
- @supports (container-type: inline-size) {
192
- @container (min-width: 751px) {
193
- .taskon-dialog-content {
194
- width: 90vw;
195
- max-height: 85vh;
196
- border-radius: var(--taskon-border-radius-lg);
197
- }
198
-
199
- .taskon-dialog-body {
200
- padding: 24px;
201
- }
202
-
203
- .taskon-dialog-header {
204
- top: 16px;
205
- right: 16px;
206
- }
207
- }
208
- }
209
-
210
- @supports not (container-type: inline-size) {
211
- @media (min-width: 751px) {
212
- .taskon-dialog-content {
213
- width: 90vw;
214
- max-height: 85vh;
215
- border-radius: var(--taskon-border-radius-lg);
216
- }
217
-
218
- .taskon-dialog-body {
219
- padding: 24px;
220
- }
221
-
222
- .taskon-dialog-header {
223
- top: 16px;
224
- right: 16px;
225
- }
226
- }
227
- }
228
1
  /**
229
2
  * Pagination 通用分页组件样式
230
3
  * @description 使用 taskon-pagination 命名空间
@@ -1,11 +1,12 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React__default, { useState, useRef, useCallback, useEffect, useContext, useMemo } from "react";
3
3
  import { isUnauthorizedError, TaskReviewResult, formatLongNumber, EligibilityType, Operator, MeetConditionStatus, RewardType, formatUtcTime, ErrorCode, SnsType, createCommunityTaskApi, TaskCardType, ChainType, getSwapDexTitleExpress, UserEligibleStatus, CampaignStatus, MediaType, createQuestApi, CampaignType, formatTokenAmount, TaskTemplateId, EligibilityTemplateId, RecurrenceType, createCommonApi, normalizeTask, formatSwapTokensForDisplay, formatAddress } from "@taskon/core";
4
- import { c as useTranslation, e as createLocaleLoader, v as TaskOnContext, h as useTaskOnContext, x as useTaskOnPortalContainer } from "./ThemeProvider-mXLdLSkq.js";
5
- import { D as Dialog, u as useResolvedWidgetConfig, W as WidgetShell } from "./WidgetShell-D7yC894Y.js";
6
- import { d as useToast } from "./useToast-CaRkylKe.js";
7
- import { u as useBindWallet, T as TitleExpress, C as CardDescExpress, a as useNftClaimFlow, R as RewardModuleDialog, B as BlindBoxDialog, b as TaskItem, E as EligibilityInfo, c as Textarea } from "./EligibilityInfo-BV0Z2TgY.js";
8
- import { a as useBindSocialAccount, B as BindWalletDialog, l as useChainMap, q as TipPopover, h as useIsMobile, I as Input } from "./UserCenterWidget-D5ttw4hO.js";
4
+ import { c as useTranslation, e as createLocaleLoader, w as TaskOnContext, h as useTaskOnContext, E as useTaskOnPortalContainer, D as Dialog } from "./ThemeProvider-CulHkqqY.js";
5
+ import { u as useResolvedWidgetConfig, W as WidgetShell } from "./WidgetShell-8xn-Jivw.js";
6
+ import { c as useToast } from "./useToast-BGJhd3BX.js";
7
+ import { u as useBindWallet, T as TitleExpress, C as CardDescExpress, a as useNftClaimFlow, R as RewardModuleDialog, B as BlindBoxDialog, b as TaskItem, E as EligibilityInfo, c as Textarea } from "./EligibilityInfo-Cf6hx9-a.js";
8
+ import { a as useBindSocialAccount, k as useChainMap, p as TipPopover, I as Input } from "./UserCenterWidget-STq8kpV4.js";
9
+ import { u as useIsMobile } from "./useIsMobile-D6Ybur-6.js";
9
10
  import { createPortal } from "react-dom";
10
11
  import '../CommunityTaskList.css';function CardSelector({
11
12
  options,
@@ -442,7 +443,6 @@ function ClaimButton({
442
443
  }) {
443
444
  const { t } = useCommunityTaskLocale();
444
445
  const [internalLoading, setInternalLoading] = useState(false);
445
- const [showWalletDialog, setShowWalletDialog] = useState(false);
446
446
  const needBindCheck = !claimDialog;
447
447
  const reAuthRef = useRef(null);
448
448
  const executeClaimAction = useCallback(async (token) => {
@@ -474,20 +474,13 @@ function ClaimButton({
474
474
  onAuthSuccess: handleAuthSuccess
475
475
  });
476
476
  reAuthRef.current = reAuth;
477
- const { bindIfNeed: bindWalletIfNeed, bindWithProvider, isBinding: isBindingWallet } = useBindWallet({
477
+ const { bindIfNeed: bindWalletIfNeed, isBinding: isBindingWallet } = useBindWallet({
478
478
  chainType: needBindCheck ? chainType : void 0,
479
479
  onSuccess: async () => {
480
- setShowWalletDialog(false);
481
480
  await executeClaimAction();
482
481
  },
483
- onFailed: onBindFailed,
484
- onNeedWalletDialog: () => {
485
- setShowWalletDialog(true);
486
- }
482
+ onFailed: onBindFailed
487
483
  });
488
- const handleWalletConnect = useCallback(async (address, provider) => {
489
- await bindWithProvider(address, provider);
490
- }, [bindWithProvider]);
491
484
  const buttonLabel = (() => {
492
485
  if (customLabel) return customLabel;
493
486
  if (mini) return t("update");
@@ -530,46 +523,35 @@ function ClaimButton({
530
523
  },
531
524
  [isDisabled, claimDialog, onShowDialog, snsType, chainType, bindSocialIfNeed, bindWalletIfNeed, executeClaimAction]
532
525
  );
533
- return /* @__PURE__ */ jsxs(Fragment, { children: [
534
- /* @__PURE__ */ jsx(
535
- "button",
536
- {
537
- type: "button",
538
- className: buttonClass,
539
- disabled: isDisabled,
540
- onClick: handleClick,
541
- children: isSubmitting || internalLoading || isWaitingAuth || isBindingWallet ? /* @__PURE__ */ jsx("span", { className: mini ? "taskon-community-task-claim-mini-loading" : "taskon-community-task-claim-loading", children: /* @__PURE__ */ jsx(
542
- "svg",
543
- {
544
- className: mini ? "taskon-community-task-claim-mini-spinner" : "taskon-community-task-claim-spinner",
545
- viewBox: "0 0 24 24",
546
- fill: "none",
547
- children: /* @__PURE__ */ jsx(
548
- "circle",
549
- {
550
- cx: "12",
551
- cy: "12",
552
- r: "10",
553
- stroke: "currentColor",
554
- strokeWidth: "3",
555
- strokeLinecap: "round",
556
- strokeDasharray: "31.4 31.4"
557
- }
558
- )
559
- }
560
- ) }) : buttonLabel
561
- }
562
- ),
563
- /* @__PURE__ */ jsx(
564
- BindWalletDialog,
565
- {
566
- open: showWalletDialog,
567
- onOpenChange: setShowWalletDialog,
568
- onConnect: handleWalletConnect,
569
- onError: onBindFailed
570
- }
571
- )
572
- ] });
526
+ return /* @__PURE__ */ jsx(
527
+ "button",
528
+ {
529
+ type: "button",
530
+ className: buttonClass,
531
+ disabled: isDisabled,
532
+ onClick: handleClick,
533
+ children: isSubmitting || internalLoading || isWaitingAuth || isBindingWallet ? /* @__PURE__ */ jsx("span", { className: mini ? "taskon-community-task-claim-mini-loading" : "taskon-community-task-claim-loading", children: /* @__PURE__ */ jsx(
534
+ "svg",
535
+ {
536
+ className: mini ? "taskon-community-task-claim-mini-spinner" : "taskon-community-task-claim-spinner",
537
+ viewBox: "0 0 24 24",
538
+ fill: "none",
539
+ children: /* @__PURE__ */ jsx(
540
+ "circle",
541
+ {
542
+ cx: "12",
543
+ cy: "12",
544
+ r: "10",
545
+ stroke: "currentColor",
546
+ strokeWidth: "3",
547
+ strokeLinecap: "round",
548
+ strokeDasharray: "31.4 31.4"
549
+ }
550
+ )
551
+ }
552
+ ) }) : buttonLabel
553
+ }
554
+ );
573
555
  }
574
556
  function formatCountdown$1(valueMillSec) {
575
557
  if (valueMillSec <= 0) {
@@ -3580,9 +3562,6 @@ function TaskChainClaimedRewards({
3580
3562
  },
3581
3563
  onClaimError: (error2) => {
3582
3564
  toast.error(error2.message || t("taskchain_nft_claim_failed"));
3583
- },
3584
- onWalletError: (errorMessage) => {
3585
- toast.error(errorMessage);
3586
3565
  }
3587
3566
  });
3588
3567
  const nftClaimedRewards = useMemo(() => {