@taskon/widget-react 0.0.1 → 0.0.2
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/README.md +118 -64
- package/dist/CommunityTaskList.css +2694 -2951
- package/dist/EligibilityInfo.css +2221 -1332
- package/dist/LeaderboardWidget.css +403 -198
- package/dist/PageBuilder.css +57 -0
- package/dist/Quest.css +1347 -1477
- package/dist/TaskOnProvider.css +337 -29
- package/dist/ThemeProvider.css +228 -0
- package/dist/UserCenterWidget.css +168 -0
- package/dist/UserCenterWidget2.css +4917 -0
- package/dist/WidgetShell.css +417 -130
- package/dist/chunks/{CommunityTaskList-CrH6r4Av.js → CommunityTaskList-2nFy6l6m.js} +2612 -2074
- package/dist/chunks/{EligibilityInfo-DesW9-k9.js → EligibilityInfo-CKTl_cdU.js} +2714 -4077
- package/dist/chunks/{LeaderboardWidget-BSGpHKTk.js → LeaderboardWidget-DyoiiNS6.js} +288 -349
- package/dist/chunks/PageBuilder-DHM3Il6f.js +150 -0
- package/dist/chunks/{Quest-uSIVq78I.js → Quest-Dqx4OCat.js} +1380 -726
- package/dist/chunks/TaskOnProvider-CxtFIs3n.js +2072 -0
- package/dist/chunks/{WidgetShell-NlOgn1x5.js → ThemeProvider-CulHkqqY.js} +1397 -103
- package/dist/chunks/UserCenterWidget-SE5hqpnZ.js +8335 -0
- package/dist/chunks/UserCenterWidget-XL6LZRZM.js +3259 -0
- package/dist/chunks/{Table-CWGf2FKV.js → WidgetShell-8xn-Jivw.js} +237 -27
- package/dist/chunks/communitytask-es-CBNnS4o2.js +521 -0
- package/dist/chunks/communitytask-ja-GRf9cbdx.js +521 -0
- package/dist/chunks/communitytask-ko-Bf24PQKI.js +521 -0
- package/dist/chunks/communitytask-ru-CZm2CPoV.js +521 -0
- package/dist/chunks/leaderboardwidget-es-vKjrjQaz.js +146 -0
- package/dist/chunks/leaderboardwidget-ja-Q6u0HxKG.js +146 -0
- package/dist/chunks/leaderboardwidget-ko-CG6SWgxf.js +146 -0
- package/dist/chunks/leaderboardwidget-ru-DCcHcJGz.js +146 -0
- package/dist/chunks/quest-es-Dyyy0zaw.js +863 -0
- package/dist/chunks/quest-ja-Depog33y.js +863 -0
- package/dist/chunks/quest-ko-BMu3uRQJ.js +863 -0
- package/dist/chunks/quest-ru-xne814Rw.js +863 -0
- package/dist/chunks/taskwidget-es-Do9b3Mqw.js +245 -0
- package/dist/chunks/taskwidget-ja-CqSu-yWA.js +245 -0
- package/dist/chunks/taskwidget-ko-EHgXFV4B.js +245 -0
- package/dist/chunks/taskwidget-ru-CMbLQDK4.js +245 -0
- package/dist/chunks/useIsMobile-D6Ybur-6.js +30 -0
- package/dist/chunks/usercenter-es-Dz3Wp2vV.js +512 -0
- package/dist/chunks/usercenter-ja-CKE4DJC6.js +512 -0
- package/dist/chunks/usercenter-ko-Dtpkn2qb.js +512 -0
- package/dist/chunks/usercenter-ru-DnBGee45.js +512 -0
- package/dist/community-task.d.ts +29 -388
- package/dist/community-task.js +2 -7
- package/dist/core.d.ts +95 -28
- package/dist/core.js +11 -12
- package/dist/index.d.ts +260 -602
- package/dist/index.js +28 -7361
- package/dist/leaderboard.d.ts +5 -496
- package/dist/leaderboard.js +2 -15
- package/dist/page-builder.d.ts +20 -0
- package/dist/page-builder.js +4 -0
- package/dist/quest.d.ts +20 -292
- package/dist/quest.js +2 -5
- package/dist/user-center.d.ts +56 -0
- package/dist/user-center.js +4 -0
- package/package.json +22 -3
- package/dist/Table.css +0 -389
- package/dist/chunks/TaskOnProvider-QMwxGL44.js +0 -1435
- package/dist/chunks/ThemeProvider-Cs8IUVQj.js +0 -1118
- package/dist/chunks/leaderboardwidget-ja-Bj6gz6y1.js +0 -119
- package/dist/chunks/leaderboardwidget-ko-f1cLO9ic.js +0 -119
- package/dist/chunks/useWidgetLocale-BVcopbZS.js +0 -74
- package/dist/chunks/usercenter-ja-DBj_dtuz.js +0 -329
- package/dist/chunks/usercenter-ko-DYTkHAld.js +0 -329
- package/dist/index.css +0 -3662
package/dist/index.d.ts
CHANGED
|
@@ -1,180 +1,62 @@
|
|
|
1
|
-
import { CampaignStatusInfo } from '@taskon/core';
|
|
2
1
|
import { CampaignWinnerReward } from '@taskon/core';
|
|
3
2
|
import { ChainInfo } from '@taskon/core';
|
|
4
3
|
import { ChainType } from '@taskon/core';
|
|
4
|
+
import { CloudThemeConfig } from '@taskon/core';
|
|
5
5
|
import { CommunityInfo } from '@taskon/core';
|
|
6
|
-
import { CommunityTaskInfo } from '@taskon/core';
|
|
7
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
8
6
|
import { default as default_2 } from 'react';
|
|
9
|
-
import { ForwardRefExoticComponent } from 'react';
|
|
10
|
-
import { GtcUserTaskStatus } from '@taskon/core';
|
|
11
7
|
import { LeaderboardContentConfig } from '@taskon/core';
|
|
12
8
|
import { LoginResult } from '@taskon/core';
|
|
13
|
-
import {
|
|
14
|
-
import { QuestApi } from '@taskon/core';
|
|
9
|
+
import { PageBuilderConfig } from '@taskon/core';
|
|
15
10
|
import { QuestCampaignInfo } from '@taskon/core';
|
|
16
11
|
import { ReactNode } from 'react';
|
|
17
|
-
import {
|
|
18
|
-
import { RefAttributes } from 'react';
|
|
12
|
+
import { RewardDisplayMode } from '@taskon/core';
|
|
19
13
|
import { RewardType } from '@taskon/core';
|
|
20
14
|
import { RewardValueInfo } from '@taskon/core';
|
|
21
15
|
import { SnsType } from '@taskon/core';
|
|
22
16
|
import { TaskOnClient } from '@taskon/core';
|
|
23
|
-
import { TaskReviewResult } from '@taskon/core';
|
|
24
|
-
import { UserCampaignStatusInfo } from '@taskon/core';
|
|
25
17
|
import { UserCenterConfig } from '@taskon/core';
|
|
18
|
+
import { UserCenterRewardCardType } from '@taskon/core';
|
|
26
19
|
import { UserCenterTabType } from '@taskon/core';
|
|
27
20
|
import { UserInfo } from '@taskon/core';
|
|
28
21
|
|
|
29
22
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* 基于 Radix UI Slot 实现,支持 asChild 模式
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```tsx
|
|
36
|
-
* // 基础用法
|
|
37
|
-
* <Button>点击我</Button>
|
|
38
|
-
*
|
|
39
|
-
* // 不同变体
|
|
40
|
-
* <Button variant="primary">主要按钮</Button>
|
|
41
|
-
* <Button variant="secondary">次要按钮</Button>
|
|
42
|
-
* <Button variant="outline">描边按钮</Button>
|
|
43
|
-
* <Button variant="ghost">幽灵按钮</Button>
|
|
44
|
-
* <Button variant="danger">危险按钮</Button>
|
|
45
|
-
*
|
|
46
|
-
* // 不同尺寸
|
|
47
|
-
* <Button size="small">小按钮</Button>
|
|
48
|
-
* <Button size="medium">中等按钮</Button>
|
|
49
|
-
* <Button size="large">大按钮</Button>
|
|
50
|
-
*
|
|
51
|
-
* // 加载状态
|
|
52
|
-
* <Button loading>加载中</Button>
|
|
53
|
-
*
|
|
54
|
-
* // 带图标
|
|
55
|
-
* <Button leftIcon={<Icon />}>左侧图标</Button>
|
|
56
|
-
* <Button rightIcon={<Icon />}>右侧图标</Button>
|
|
57
|
-
*
|
|
58
|
-
* // 禁用状态
|
|
59
|
-
* <Button disabled>禁用按钮</Button>
|
|
60
|
-
*
|
|
61
|
-
* // asChild 模式(将 Button 样式应用到子元素)
|
|
62
|
-
* <Button asChild>
|
|
63
|
-
* <a href="/about">链接按钮</a>
|
|
64
|
-
* </Button>
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Button 组件属性
|
|
71
|
-
*/
|
|
72
|
-
export declare interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
|
|
73
|
-
/**
|
|
74
|
-
* 按钮尺寸
|
|
75
|
-
* @default "medium"
|
|
76
|
-
*/
|
|
77
|
-
size?: ButtonSize;
|
|
78
|
-
/**
|
|
79
|
-
* 按钮变体
|
|
80
|
-
* @default "primary"
|
|
81
|
-
*/
|
|
82
|
-
variant?: ButtonVariant;
|
|
83
|
-
/**
|
|
84
|
-
* 是否为加载状态
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
loading?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* 图标位置
|
|
90
|
-
*/
|
|
91
|
-
iconPosition?: "left" | "right" | "only";
|
|
92
|
-
/**
|
|
93
|
-
* 左侧图标
|
|
94
|
-
*/
|
|
95
|
-
leftIcon?: ReactNode;
|
|
96
|
-
/**
|
|
97
|
-
* 右侧图标
|
|
98
|
-
*/
|
|
99
|
-
rightIcon?: ReactNode;
|
|
100
|
-
/**
|
|
101
|
-
* 是否作为子元素渲染(使用 Radix Slot)
|
|
102
|
-
* 当为 true 时,Button 会将所有属性传递给第一个子元素
|
|
103
|
-
* @default false
|
|
104
|
-
*/
|
|
105
|
-
asChild?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* 按钮内容
|
|
108
|
-
*/
|
|
109
|
-
children?: ReactNode;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Button 尺寸类型
|
|
114
|
-
*/
|
|
115
|
-
export declare type ButtonSize = "small" | "medium" | "large";
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Button 变体类型
|
|
23
|
+
* Clear the locale cache
|
|
24
|
+
* Useful for testing or when you need to force reload locales
|
|
119
25
|
*/
|
|
120
|
-
export declare
|
|
26
|
+
export declare function clearLocaleCache(): void;
|
|
121
27
|
|
|
122
28
|
/**
|
|
123
|
-
*
|
|
29
|
+
* Convert cloud theme config (B-end format) to React TaskOnThemeConfig.
|
|
30
|
+
*
|
|
31
|
+
* Mapping:
|
|
32
|
+
* CloudThemeConfig.colorMode → TaskOnThemeConfig.mode + modeStrategy
|
|
33
|
+
* CloudThemeConfig.light.*Color → light.seed.*
|
|
34
|
+
* CloudThemeConfig.dark.*Color → dark.seed.*
|
|
35
|
+
* CloudThemeConfig.shape → seed.borderRadius / seed.fontSize
|
|
36
|
+
* CloudThemeConfig.spacing → seed.spacingBaseStep / seed.spacingChangeUnit
|
|
37
|
+
*
|
|
38
|
+
* Design rule:
|
|
39
|
+
* - B-end configurable theme fields are treated as SeedToken inputs.
|
|
40
|
+
* - Map tokens are derived by the theme algorithm from seed values.
|
|
41
|
+
*
|
|
42
|
+
* @param cloud - Cloud theme configuration from B-end
|
|
43
|
+
* @returns React-compatible TaskOnThemeConfig
|
|
124
44
|
*
|
|
125
45
|
* @example
|
|
126
|
-
* ```
|
|
127
|
-
* const
|
|
128
|
-
* {
|
|
129
|
-
* {
|
|
130
|
-
* {
|
|
131
|
-
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* const cloudTheme: CloudThemeConfig = {
|
|
48
|
+
* colorMode: { type: "dual", dualVariant: "auto" },
|
|
49
|
+
* light: { primaryColor: "#6366f1", ... },
|
|
50
|
+
* dark: { primaryColor: "#818cf8", ... },
|
|
51
|
+
* spacing: { sizeBaseStep: 4, sizeChangeUnit: 2 },
|
|
52
|
+
* shape: { fontSize: 14, borderRadius: 8 },
|
|
53
|
+
* };
|
|
132
54
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* value={selectedValue}
|
|
136
|
-
* onChange={setSelectedValue}
|
|
137
|
-
* allowDeselect
|
|
138
|
-
* />
|
|
55
|
+
* const reactTheme = cloudThemeToReactTheme(cloudTheme);
|
|
56
|
+
* // { mode: "auto", seed: { borderRadius: 8, fontSize: 14 }, light: {...}, dark: {...} }
|
|
139
57
|
* ```
|
|
140
58
|
*/
|
|
141
|
-
export declare function
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* 选项配置
|
|
145
|
-
*/
|
|
146
|
-
export declare interface CardSelectorOption<T = string | number> {
|
|
147
|
-
/** 选项的值 */
|
|
148
|
-
value: T;
|
|
149
|
-
/** 选项的显示文本 */
|
|
150
|
-
label: string;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* CardSelector 组件属性
|
|
155
|
-
*/
|
|
156
|
-
export declare interface CardSelectorProps<T = string | number> {
|
|
157
|
-
/** 选项列表 */
|
|
158
|
-
options: CardSelectorOption<T>[];
|
|
159
|
-
/** 当前选中的值 */
|
|
160
|
-
value?: T;
|
|
161
|
-
/** 值变化回调 */
|
|
162
|
-
onChange?: (value: T | undefined) => void;
|
|
163
|
-
/** 是否允许取消选择(点击已选中项取消选择)
|
|
164
|
-
* @default true
|
|
165
|
-
*/
|
|
166
|
-
allowDeselect?: boolean;
|
|
167
|
-
/** 自定义根容器类名 */
|
|
168
|
-
className?: string;
|
|
169
|
-
/** 自定义选项类名 */
|
|
170
|
-
itemClassName?: string;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Clear the locale cache
|
|
175
|
-
* Useful for testing or when you need to force reload locales
|
|
176
|
-
*/
|
|
177
|
-
export declare function clearLocaleCache(): void;
|
|
59
|
+
export declare function cloudThemeToReactTheme(cloud: CloudThemeConfig): TaskOnThemeConfig;
|
|
178
60
|
|
|
179
61
|
/**
|
|
180
62
|
* Common messages type definition
|
|
@@ -197,37 +79,6 @@ export declare interface CommonMessages {
|
|
|
197
79
|
confirm: string;
|
|
198
80
|
}
|
|
199
81
|
|
|
200
|
-
/**
|
|
201
|
-
* BaseTask 组件
|
|
202
|
-
* @description 基础任务卡片,职责:
|
|
203
|
-
* - 卡片布局(flex 容器)
|
|
204
|
-
* - 周期标签显示
|
|
205
|
-
* - 任务标题显示
|
|
206
|
-
* - 有效时间显示
|
|
207
|
-
* - 按钮区域管理
|
|
208
|
-
* - 完成状态样式
|
|
209
|
-
*
|
|
210
|
-
* @example
|
|
211
|
-
* ```tsx
|
|
212
|
-
* <BaseTask
|
|
213
|
-
* title="Follow @TaskOn_xyz"
|
|
214
|
-
* isWon={false}
|
|
215
|
-
* isCompleted={false}
|
|
216
|
-
* isPeriodic={true}
|
|
217
|
-
* recurrenceLabel="Daily"
|
|
218
|
-
* taskId={123}
|
|
219
|
-
* actionLabel="Follow"
|
|
220
|
-
* actionLink="https://twitter.com/TaskOn_xyz"
|
|
221
|
-
* reward={{ type: 'points', amount: 100, name: 'Points', icon: '/icon.png' }}
|
|
222
|
-
* onClick={() => console.log('卡片被点击')}
|
|
223
|
-
* onClaim={() => console.log('Claim 按钮被点击')}
|
|
224
|
-
* >
|
|
225
|
-
* <div>额外的任务描述内容</div>
|
|
226
|
-
* </BaseTask>
|
|
227
|
-
* ```
|
|
228
|
-
*/
|
|
229
|
-
export declare function CommunityTask(props: CommunityTaskProps): default_2.ReactElement;
|
|
230
|
-
|
|
231
82
|
/**
|
|
232
83
|
* CommunityTaskList outer wrapper
|
|
233
84
|
*
|
|
@@ -245,6 +96,11 @@ export declare interface CommunityTaskListProps {
|
|
|
245
96
|
* Cloud config includes display options, sector filtering, etc.
|
|
246
97
|
*/
|
|
247
98
|
widgetId?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Manual theme mode override (highest priority when provided).
|
|
101
|
+
* Recommended with dual + toggle cloud strategy.
|
|
102
|
+
*/
|
|
103
|
+
themeMode?: "light" | "dark" | "auto";
|
|
248
104
|
/** Whether in preview mode */
|
|
249
105
|
isPreview?: boolean;
|
|
250
106
|
/** 社区信息(用于前置任务链接跳转) */
|
|
@@ -263,8 +119,9 @@ export declare interface CommunityTaskListProps {
|
|
|
263
119
|
*/
|
|
264
120
|
initialTaskId?: number;
|
|
265
121
|
/**
|
|
266
|
-
* Callback when dialog opens (host can use to update URL params)
|
|
267
|
-
*
|
|
122
|
+
* Callback when dialog opens or switches task (host can use to update URL params).
|
|
123
|
+
* Fires whenever active task changes, including eligibility-driven task switches.
|
|
124
|
+
* @param taskId Currently active task ID
|
|
268
125
|
* @example
|
|
269
126
|
* ```tsx
|
|
270
127
|
* onTaskOpen={(taskId) => router.replace(`?task=${taskId}`)}
|
|
@@ -272,13 +129,28 @@ export declare interface CommunityTaskListProps {
|
|
|
272
129
|
*/
|
|
273
130
|
onTaskOpen?: (taskId: number) => void;
|
|
274
131
|
/**
|
|
275
|
-
* Callback when dialog closes (host can use to clear URL params)
|
|
132
|
+
* Callback when dialog closes (host can use to clear URL params).
|
|
133
|
+
* Fires only when dialog is actually closed; in-place task switches do not emit close first.
|
|
276
134
|
* @example
|
|
277
135
|
* ```tsx
|
|
278
136
|
* onTaskClose={() => router.replace(pathname)}
|
|
279
137
|
* ```
|
|
280
138
|
*/
|
|
281
139
|
onTaskClose?: () => void;
|
|
140
|
+
/**
|
|
141
|
+
* Initial TaskChain campaign ID from URL (passed by host after parsing URL)
|
|
142
|
+
* Used to auto-open TaskChain dialog on page refresh or shared links
|
|
143
|
+
*/
|
|
144
|
+
initialTaskChainId?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Callback when TaskChain dialog opens (host can use to update URL params)
|
|
147
|
+
* @param taskChainId Currently opened TaskChain campaign ID
|
|
148
|
+
*/
|
|
149
|
+
onTaskChainOpen?: (taskChainId: number) => void;
|
|
150
|
+
/**
|
|
151
|
+
* Callback when TaskChain dialog closes (host can use to clear URL params)
|
|
152
|
+
*/
|
|
153
|
+
onTaskChainClose?: () => void;
|
|
282
154
|
/** Sector IDs to display; undefined means show all */
|
|
283
155
|
sectorIds?: number[];
|
|
284
156
|
/** Whether to show sector tab selector (default: true) */
|
|
@@ -289,209 +161,10 @@ export declare interface CommunityTaskListProps {
|
|
|
289
161
|
showSectorDescription?: boolean;
|
|
290
162
|
/** Whether to show sector reward (default: true) */
|
|
291
163
|
showSectorReward?: boolean;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
|
|
296
|
-
* BaseTask 只需要知道这些信息
|
|
297
|
-
*/
|
|
298
|
-
export declare interface CommunityTaskProps {
|
|
299
|
-
/** 任务名称/标题(字符串或自定义渲染节点) */
|
|
300
|
-
title: string | React.ReactNode;
|
|
301
|
-
/** 是否已中奖/完成 */
|
|
302
|
-
isWon: boolean;
|
|
303
|
-
/** 是否已提交(可能未中奖) */
|
|
304
|
-
isCompleted: boolean;
|
|
305
|
-
/** 是否是周期任务 */
|
|
306
|
-
isPeriodic: boolean;
|
|
307
|
-
/** 操作按钮文案(如 "Follow"、"Join") */
|
|
308
|
-
actionLabel?: string;
|
|
309
|
-
/** 操作按钮链接(默认在新标签页打开) */
|
|
310
|
-
actionLink?: string;
|
|
311
|
-
/** 点击操作按钮后是否自动验证 */
|
|
312
|
-
actionAutoVerify?: boolean;
|
|
313
|
-
/**
|
|
314
|
-
* 点击 Action 按钮时自动打开弹窗
|
|
315
|
-
* 用于 PowTask、InviteFriends 等需要在弹窗中填写内容的任务
|
|
316
|
-
*/
|
|
317
|
-
actionAutoDialog?: boolean;
|
|
318
|
-
/** 是否总是显示操作按钮(即使已完成) */
|
|
319
|
-
alwaysShowAction?: boolean;
|
|
320
|
-
/**
|
|
321
|
-
* 标题跳转链接
|
|
322
|
-
* 如果提供,标题将变成可点击的链接,在新标签页打开
|
|
323
|
-
*/
|
|
324
|
-
targetLink?: string;
|
|
325
|
-
/** 是否隐藏 Claim 按钮 */
|
|
326
|
-
noClaim?: boolean;
|
|
327
|
-
/**
|
|
328
|
-
* 是否需要验证后才能 Claim
|
|
329
|
-
* - true: 显示 "Verify & Claim"
|
|
330
|
-
* - false: 显示 "Claim"
|
|
331
|
-
*/
|
|
332
|
-
verifyClaim?: boolean;
|
|
333
|
-
/**
|
|
334
|
-
* 点击 Claim 仅打开弹窗(不提交)
|
|
335
|
-
* 用于 QuizTask、SurveyTask 等需要在弹窗中选择答案的任务
|
|
336
|
-
*/
|
|
337
|
-
claimDialog?: boolean;
|
|
338
|
-
/**
|
|
339
|
-
* 社交账号类型(用于 OAuth 绑定)
|
|
340
|
-
* 决定 Claim 时需要绑定哪种社交账号
|
|
341
|
-
*/
|
|
342
|
-
snsType?: SnsType;
|
|
343
|
-
/**
|
|
344
|
-
* 链类型(用于钱包绑定)
|
|
345
|
-
* 决定 Claim 时需要绑定哪种链的钱包
|
|
346
|
-
*/
|
|
347
|
-
chainType?: ChainType;
|
|
348
|
-
/** 周期标签文本(如 "Daily"、"Weekly") */
|
|
349
|
-
recurrenceLabel?: string;
|
|
350
|
-
/** 任务重复类型(用于 Claim 按钮文案逻辑) */
|
|
351
|
-
recurrence?: RecurrenceType;
|
|
352
|
-
/** 是否隐藏周期标签 */
|
|
353
|
-
noRecurrence?: boolean;
|
|
354
|
-
/**
|
|
355
|
-
* Unlimited 任务是否显示大的 Claim 按钮
|
|
356
|
-
* - true: 显示正常大小的 Claim 按钮
|
|
357
|
-
* - false: 显示小的 Update 按钮(已有积分)
|
|
358
|
-
* @default true
|
|
359
|
-
*/
|
|
360
|
-
showUnlimitedClaim?: boolean;
|
|
361
|
-
/** 任务 ID */
|
|
362
|
-
taskId: number;
|
|
363
|
-
/** 有效时间相关 */
|
|
364
|
-
validTime?: {
|
|
365
|
-
/** 开始时间(格式化字符串) */
|
|
366
|
-
startTime?: string;
|
|
367
|
-
/** 结束时间(格式化字符串) */
|
|
368
|
-
endTime?: string;
|
|
369
|
-
/** 是否已过期 */
|
|
370
|
-
isExpired?: boolean;
|
|
371
|
-
};
|
|
372
|
-
/**
|
|
373
|
-
* 验证时间范围(OnChain 任务专用)
|
|
374
|
-
* 显示 "This task only verify action during {start} - {end}(UTC)"
|
|
375
|
-
*/
|
|
376
|
-
validationTimeFrame?: {
|
|
377
|
-
/** 开始时间(毫秒或秒时间戳) */
|
|
378
|
-
start_time: number;
|
|
379
|
-
/** 结束时间(毫秒或秒时间戳) */
|
|
380
|
-
end_time: number;
|
|
381
|
-
};
|
|
382
|
-
/** 奖励信息 */
|
|
383
|
-
reward?: {
|
|
384
|
-
/** 奖励类型 */
|
|
385
|
-
type: "points" | "token" | "none";
|
|
386
|
-
/** 积分数量(points 类型,单次奖励) */
|
|
387
|
-
amount?: number;
|
|
388
|
-
/** 积分名称(points 类型) */
|
|
389
|
-
name?: string;
|
|
390
|
-
/** 积分图标(points 类型) */
|
|
391
|
-
icon?: string;
|
|
392
|
-
/** 累计积分(周期任务完成时显示) */
|
|
393
|
-
totalAmount?: number;
|
|
394
|
-
/** Token 信息(token 类型) */
|
|
395
|
-
token?: {
|
|
396
|
-
/** Token 名称 */
|
|
397
|
-
name: string;
|
|
398
|
-
/** 每次奖励数量 */
|
|
399
|
-
amount: string;
|
|
400
|
-
/** Token 图标 */
|
|
401
|
-
icon?: string;
|
|
402
|
-
/** 链名称 */
|
|
403
|
-
chain?: string;
|
|
404
|
-
/** 链图标 */
|
|
405
|
-
chainIcon?: string;
|
|
406
|
-
/** 总奖励单位数 */
|
|
407
|
-
totalUnit?: number;
|
|
408
|
-
/** 可用单位数 */
|
|
409
|
-
availableUnit?: number;
|
|
410
|
-
};
|
|
411
|
-
};
|
|
412
|
-
/** 卡片内容(由具体任务组件提供,用于展示任务特定内容) */
|
|
413
|
-
children?: React.ReactNode;
|
|
414
|
-
/**
|
|
415
|
-
* 自定义 Action 按钮区域
|
|
416
|
-
* 如果提供,将替换默认的 Action 按钮
|
|
417
|
-
* @example
|
|
418
|
-
* ```tsx
|
|
419
|
-
* <BaseTask
|
|
420
|
-
* actionSlot={<CustomActionButton onClick={handleAction} />}
|
|
421
|
-
* />
|
|
422
|
-
* ```
|
|
423
|
-
*/
|
|
424
|
-
actionSlot?: React.ReactNode;
|
|
425
|
-
/**
|
|
426
|
-
* 自定义奖励展示(已完成状态)
|
|
427
|
-
* 如果提供,将替换默认的 Won 奖励显示
|
|
428
|
-
* @example
|
|
429
|
-
* ```tsx
|
|
430
|
-
* <BaseTask
|
|
431
|
-
* rewardSlot={<CustomRewardDisplay amount={100} />}
|
|
432
|
-
* />
|
|
433
|
-
* ```
|
|
434
|
-
*/
|
|
435
|
-
rewardSlot?: React.ReactNode;
|
|
436
|
-
/**
|
|
437
|
-
* 是否已登录
|
|
438
|
-
* - true: 正常显示卡片
|
|
439
|
-
* - false/undefined: 显示登录遮层,点击触发 onLogin
|
|
440
|
-
* @default true
|
|
441
|
-
*/
|
|
442
|
-
isLoggedIn?: boolean;
|
|
443
|
-
/** 点击卡片回调(用于打开弹窗) */
|
|
444
|
-
onClick?: () => void;
|
|
445
|
-
/**
|
|
446
|
-
* 点击 Claim 按钮回调
|
|
447
|
-
* @param token - 可选的 OAuth token(reAuth 成功后传入)
|
|
448
|
-
* @returns 可选返回 Promise,包含结果信息用于 reAuth 判断和 coolDown 更新
|
|
449
|
-
*/
|
|
450
|
-
onClaim?: (token?: string) => void | Promise<{
|
|
451
|
-
successful: boolean;
|
|
452
|
-
errorCode?: string;
|
|
453
|
-
cool_down?: number;
|
|
454
|
-
}>;
|
|
455
|
-
/**
|
|
456
|
-
* 点击登录遮层回调
|
|
457
|
-
* 未登录时(isLoggedIn=false)点击卡片会触发此回调
|
|
458
|
-
*/
|
|
459
|
-
onLogin?: () => void;
|
|
460
|
-
/** 是否正在提交 */
|
|
461
|
-
isSubmitting?: boolean;
|
|
462
|
-
/** 冷却时间(毫秒) */
|
|
463
|
-
coolDown?: number;
|
|
464
|
-
/** 冷却结束回调(用于重置 coolDown 状态) */
|
|
465
|
-
onCoolDownComplete?: () => void;
|
|
466
|
-
/** 是否禁用交互 */
|
|
467
|
-
disabled?: boolean;
|
|
468
|
-
/**
|
|
469
|
-
* 审核结果状态
|
|
470
|
-
* - Passed: 审核通过
|
|
471
|
-
* - Failed: 审核失败(显示 "Oops! Failed")
|
|
472
|
-
* - UnReviewed: 审核中(显示 "Under Review")
|
|
473
|
-
*/
|
|
474
|
-
reviewResult?: TaskReviewResult;
|
|
475
|
-
/**
|
|
476
|
-
* CheckProgressTip 需要的社区信息
|
|
477
|
-
* 用于显示 "Contact {name} to check your progress"
|
|
478
|
-
*/
|
|
479
|
-
communityInfo?: {
|
|
480
|
-
/** 社区名称 */
|
|
481
|
-
name?: string;
|
|
482
|
-
/** 社区联系链接(Discord/Telegram/Twitter) */
|
|
483
|
-
contactLink?: string;
|
|
484
|
-
};
|
|
485
|
-
/**
|
|
486
|
-
* 周期任务:当前周期是否已完成
|
|
487
|
-
* 配合 nextTime 用于显示 DoneCountdown
|
|
488
|
-
*/
|
|
489
|
-
currentCompleted?: boolean;
|
|
490
|
-
/**
|
|
491
|
-
* 周期任务:下次可完成的时间戳(毫秒)
|
|
492
|
-
* 用于显示 DoneCountdown 倒计时
|
|
493
|
-
*/
|
|
494
|
-
nextTime?: number;
|
|
164
|
+
/** How reward details are displayed in TaskChain claimed NFT cards */
|
|
165
|
+
rewardDisplayMode?: RewardDisplayMode;
|
|
166
|
+
/** Redirect URL for reward details when mode is redirect */
|
|
167
|
+
rewardRedirectUrl?: string;
|
|
495
168
|
}
|
|
496
169
|
|
|
497
170
|
/**
|
|
@@ -509,6 +182,8 @@ export declare interface CommunityTaskProps {
|
|
|
509
182
|
* const loadMessages = createLocaleLoader(enMessages, {
|
|
510
183
|
* ko: () => import('./locales/ko'),
|
|
511
184
|
* ja: () => import('./locales/ja'),
|
|
185
|
+
* ru: () => import('./locales/ru'),
|
|
186
|
+
* es: () => import('./locales/es'),
|
|
512
187
|
* });
|
|
513
188
|
* ```
|
|
514
189
|
*/
|
|
@@ -538,6 +213,30 @@ export declare function createLocaleLoader<T>(defaultMessages: T, imports: Local
|
|
|
538
213
|
*/
|
|
539
214
|
export declare function createT<T extends Record<string, string>>(messages: T): <K extends keyof T>(key: K, params?: InterpolationParams) => string;
|
|
540
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Ethereum Provider Interface (EIP-1193)
|
|
218
|
+
*
|
|
219
|
+
* Exported for scenarios where caller already owns a specific provider
|
|
220
|
+
* instance (e.g. wallet selection dialog) and needs to build an adapter
|
|
221
|
+
* around it.
|
|
222
|
+
*/
|
|
223
|
+
declare interface EthereumProvider {
|
|
224
|
+
request: (args: {
|
|
225
|
+
method: string;
|
|
226
|
+
params?: unknown[];
|
|
227
|
+
}) => Promise<unknown>;
|
|
228
|
+
on?: (event: string, callback: (...args: unknown[]) => void) => void;
|
|
229
|
+
removeListener?: (event: string, callback: (...args: unknown[]) => void) => void;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export declare class EvmWalletSelectionCanceledError extends Error {
|
|
233
|
+
constructor(message?: string);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export declare class EvmWalletSelectionInProgressError extends Error {
|
|
237
|
+
constructor(message?: string);
|
|
238
|
+
}
|
|
239
|
+
|
|
541
240
|
/**
|
|
542
241
|
* Interpolate a string with parameters
|
|
543
242
|
*
|
|
@@ -623,6 +322,11 @@ export declare interface LeaderboardWidgetProps {
|
|
|
623
322
|
* Cloud config provides leaderboard tabs, display options, etc.
|
|
624
323
|
*/
|
|
625
324
|
widgetId?: number;
|
|
325
|
+
/**
|
|
326
|
+
* Manual theme mode override (highest priority when provided).
|
|
327
|
+
* Recommended with dual + toggle cloud strategy.
|
|
328
|
+
*/
|
|
329
|
+
themeMode?: "light" | "dark" | "auto";
|
|
626
330
|
/**
|
|
627
331
|
* 排行榜配置
|
|
628
332
|
* 包含所有 Tab 的配置和显示选项
|
|
@@ -645,7 +349,11 @@ export declare type Locale = "en" | "ko" | "ja" | "ru" | "es";
|
|
|
645
349
|
|
|
646
350
|
/**
|
|
647
351
|
* Locale import map type
|
|
648
|
-
* Maps supported locales to their dynamic import functions
|
|
352
|
+
* Maps supported non-English locales to their dynamic import functions.
|
|
353
|
+
*
|
|
354
|
+
* Notes:
|
|
355
|
+
* - Keys are optional so widgets can incrementally adopt locales.
|
|
356
|
+
* - Missing locale imports safely fall back to inlined English messages.
|
|
649
357
|
*/
|
|
650
358
|
export declare type LocaleImportMap<T> = {
|
|
651
359
|
[K in Exclude<SupportedLocale, "en">]?: () => Promise<{
|
|
@@ -686,13 +394,32 @@ export declare interface MapToken {
|
|
|
686
394
|
colorSuccess?: string;
|
|
687
395
|
colorWarning?: string;
|
|
688
396
|
colorError?: string;
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
397
|
+
/** Page/canvas base background */
|
|
398
|
+
colorBgCanvas?: string;
|
|
399
|
+
/** Main surface background (cards, panels) */
|
|
400
|
+
colorBgSurface?: string;
|
|
401
|
+
/** Subtle surface background (low-contrast cards) */
|
|
402
|
+
colorBgSurfaceSubtle?: string;
|
|
403
|
+
/** Strong surface background (section headers, tracks) */
|
|
404
|
+
colorBgSurfaceStrong?: string;
|
|
405
|
+
/** Floating layer background (tooltip, dropdown, popover) */
|
|
406
|
+
colorBgFloating?: string;
|
|
407
|
+
/** Overlay mask background */
|
|
408
|
+
colorBgMask?: string;
|
|
409
|
+
/** Inset background (inner slots/containers) */
|
|
410
|
+
colorBgInset?: string;
|
|
411
|
+
colorSuccessBg?: string;
|
|
412
|
+
colorWarningBg?: string;
|
|
413
|
+
colorErrorBg?: string;
|
|
414
|
+
colorSecondaryBg?: string;
|
|
692
415
|
colorText?: string;
|
|
693
416
|
colorTextSecondary?: string;
|
|
694
417
|
colorTextTertiary?: string;
|
|
695
418
|
colorTextDisabled?: string;
|
|
419
|
+
/** Link color */
|
|
420
|
+
colorLink?: string;
|
|
421
|
+
/** Text color on primary background elements (e.g. primary button text) */
|
|
422
|
+
colorTextOnPrimary?: string;
|
|
696
423
|
colorBorder?: string;
|
|
697
424
|
colorBorderSecondary?: string;
|
|
698
425
|
borderRadius?: number;
|
|
@@ -701,6 +428,9 @@ export declare interface MapToken {
|
|
|
701
428
|
fontSize?: number;
|
|
702
429
|
fontSizeSm?: number;
|
|
703
430
|
fontSizeLg?: number;
|
|
431
|
+
fontSizeXl?: number;
|
|
432
|
+
fontSizeXxl?: number;
|
|
433
|
+
fontSizeXxxl?: number;
|
|
704
434
|
spacing?: number;
|
|
705
435
|
spacingXs?: number;
|
|
706
436
|
spacingSm?: number;
|
|
@@ -717,6 +447,22 @@ declare interface ModeThemeConfig {
|
|
|
717
447
|
map?: MapToken;
|
|
718
448
|
}
|
|
719
449
|
|
|
450
|
+
/**
|
|
451
|
+
* PageBuilder - Render a composed page from PageBuilder config
|
|
452
|
+
*/
|
|
453
|
+
export declare function PageBuilder(props: PageBuilderProps): default_2.ReactElement;
|
|
454
|
+
|
|
455
|
+
export declare interface PageBuilderProps {
|
|
456
|
+
/** PageBuilder ID (load config from API) */
|
|
457
|
+
pageId?: number;
|
|
458
|
+
/** Local config (skip API request) */
|
|
459
|
+
config?: PageBuilderConfig;
|
|
460
|
+
/** Custom className for root */
|
|
461
|
+
className?: string;
|
|
462
|
+
/** Custom style for root */
|
|
463
|
+
style?: default_2.CSSProperties;
|
|
464
|
+
}
|
|
465
|
+
|
|
720
466
|
/**
|
|
721
467
|
* Quest Widget 主组件
|
|
722
468
|
*
|
|
@@ -757,6 +503,14 @@ export declare interface QuestWidgetProps {
|
|
|
757
503
|
* 云端配置包含 campaignId、显示选项、自定义分享文案等
|
|
758
504
|
*/
|
|
759
505
|
widgetId?: number;
|
|
506
|
+
/**
|
|
507
|
+
* 手动主题模式(传入后拥有最高优先级)
|
|
508
|
+
* 建议在云端配置为 dual + toggle 时使用,避免与固定模式配置语义冲突。
|
|
509
|
+
* - light: 强制浅色主题
|
|
510
|
+
* - dark: 强制深色主题
|
|
511
|
+
* - auto: 跟随系统主题
|
|
512
|
+
*/
|
|
513
|
+
themeMode?: "light" | "dark" | "auto";
|
|
760
514
|
/**
|
|
761
515
|
* Campaign ID
|
|
762
516
|
* - 如果传入 widgetId,campaignId 可从云端配置获取
|
|
@@ -779,6 +533,8 @@ export declare interface QuestWidgetProps {
|
|
|
779
533
|
showTitle?: boolean;
|
|
780
534
|
/** 是否显示描述 */
|
|
781
535
|
showDescription?: boolean;
|
|
536
|
+
/** 是否显示参与人数 */
|
|
537
|
+
showParticipants?: boolean;
|
|
782
538
|
/** 加载完成回调 */
|
|
783
539
|
onLoaded?: (campaign: QuestCampaignInfo) => void;
|
|
784
540
|
/** 任务完成回调 */
|
|
@@ -789,8 +545,6 @@ export declare interface QuestWidgetProps {
|
|
|
789
545
|
onError?: (error: Error) => void;
|
|
790
546
|
/** 连接钱包回调(未登录时触发) */
|
|
791
547
|
onConnectWallet?: () => void;
|
|
792
|
-
/** 领取 NFT 回调 (NFT/MintedNft/Cap) */
|
|
793
|
-
onClaimNft?: (reward: RewardValueInfo, layer: CampaignWinnerReward) => Promise<void>;
|
|
794
548
|
/** 领取 Discord 角色回调 */
|
|
795
549
|
onClaimDiscordRole?: (reward: RewardValueInfo, layer: CampaignWinnerReward) => Promise<void>;
|
|
796
550
|
/**
|
|
@@ -803,10 +557,18 @@ export declare interface QuestWidgetProps {
|
|
|
803
557
|
* 需要绑定 SNS 时的回调
|
|
804
558
|
*/
|
|
805
559
|
onBindSnsRequired?: (snsTypes: SnsType[]) => void;
|
|
806
|
-
/**
|
|
560
|
+
/** 是否显示分享按钮(默认 true) */
|
|
561
|
+
showShare?: boolean;
|
|
562
|
+
/** 分享链接(未配置时回退到当前页面 URL) */
|
|
807
563
|
shareUrl?: string;
|
|
808
564
|
/** Twitter 分享文案(可选,有默认文案) */
|
|
809
565
|
shareText?: string;
|
|
566
|
+
/** 是否在 Twitter 分享文案末尾自动追加带 utm_source=x 的链接(默认 true) */
|
|
567
|
+
shareAutoAppendLink?: boolean;
|
|
568
|
+
/** 奖励详情展示模式:popup 弹窗 / redirect 跳转(默认 popup) */
|
|
569
|
+
rewardDisplayMode?: RewardDisplayMode;
|
|
570
|
+
/** 跳转 URL(当 rewardDisplayMode 为 'redirect' 时使用) */
|
|
571
|
+
rewardRedirectUrl?: string;
|
|
810
572
|
}
|
|
811
573
|
|
|
812
574
|
export { RewardType }
|
|
@@ -825,17 +587,45 @@ export declare interface SeedToken {
|
|
|
825
587
|
colorWarning?: string;
|
|
826
588
|
/** Error color */
|
|
827
589
|
colorError?: string;
|
|
590
|
+
/** Link color */
|
|
591
|
+
colorLink?: string;
|
|
592
|
+
/** Base text color */
|
|
593
|
+
colorText?: string;
|
|
594
|
+
/** Text color on primary buttons */
|
|
595
|
+
colorTextOnPrimary?: string;
|
|
596
|
+
/** Base page background color (used to derive background layers) */
|
|
597
|
+
colorBgBase?: string;
|
|
828
598
|
/** Base border radius */
|
|
829
599
|
borderRadius?: number;
|
|
830
600
|
/** Base font size */
|
|
831
601
|
fontSize?: number;
|
|
602
|
+
/** Spacing base step from cloud config */
|
|
603
|
+
spacingBaseStep?: number;
|
|
604
|
+
/** Spacing change unit from cloud config */
|
|
605
|
+
spacingChangeUnit?: number;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export declare function selectEvmWallet(options?: SelectEvmWalletOptions): Promise<SelectEvmWalletResult>;
|
|
609
|
+
|
|
610
|
+
export declare interface SelectEvmWalletOptions {
|
|
611
|
+
signal?: AbortSignal;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export declare interface SelectEvmWalletResult {
|
|
615
|
+
walletId: string;
|
|
616
|
+
walletName: string;
|
|
617
|
+
address: string;
|
|
618
|
+
provider: EthereumProvider;
|
|
832
619
|
}
|
|
833
620
|
|
|
834
621
|
/**
|
|
835
|
-
* Locales
|
|
836
|
-
*
|
|
622
|
+
* Locales recognized by the widget i18n runtime.
|
|
623
|
+
*
|
|
624
|
+
* Notes:
|
|
625
|
+
* - A widget can choose to provide only part of these locale files.
|
|
626
|
+
* - Missing locale modules still fall back to inlined English messages.
|
|
837
627
|
*/
|
|
838
|
-
export declare type SupportedLocale = "en" | "ko" | "ja";
|
|
628
|
+
export declare type SupportedLocale = "en" | "ko" | "ja" | "ru" | "es";
|
|
839
629
|
|
|
840
630
|
/**
|
|
841
631
|
* TaskOn Context value
|
|
@@ -850,9 +640,21 @@ export declare interface TaskOnContextValue {
|
|
|
850
640
|
*/
|
|
851
641
|
client: TaskOnClient | null;
|
|
852
642
|
/**
|
|
853
|
-
* Whether the provider is
|
|
643
|
+
* Whether the provider is in full initialization flow.
|
|
644
|
+
*
|
|
645
|
+
* Notes:
|
|
646
|
+
* - Includes session restore and token validation.
|
|
647
|
+
* - When a stored token exists, this stays true until user info validation completes.
|
|
854
648
|
*/
|
|
855
649
|
isInitializing: boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Whether session prerequisites are ready for data requests.
|
|
652
|
+
* True means client is created and auth token has been loaded
|
|
653
|
+
* (or no token exists, anonymous mode).
|
|
654
|
+
*
|
|
655
|
+
* This can become true earlier than `isInitializing === false`.
|
|
656
|
+
*/
|
|
657
|
+
isSessionReady: boolean;
|
|
856
658
|
/**
|
|
857
659
|
* Resolved locale
|
|
858
660
|
*/
|
|
@@ -897,7 +699,7 @@ export declare interface TaskOnContextValue {
|
|
|
897
699
|
*/
|
|
898
700
|
chains: ChainInfo[];
|
|
899
701
|
/**
|
|
900
|
-
* Community info (auto-loaded on init based on
|
|
702
|
+
* Community info (auto-loaded on init based on clientId)
|
|
901
703
|
* Used for displaying community logo and name in reward cards
|
|
902
704
|
*/
|
|
903
705
|
communityInfo: CommunityInfo | null;
|
|
@@ -910,7 +712,7 @@ export declare interface TaskOnContextValue {
|
|
|
910
712
|
* - TaskOn client management (based on @taskon/core)
|
|
911
713
|
* - User authentication (login/logout)
|
|
912
714
|
* - Locale configuration
|
|
913
|
-
* - Wallet management (
|
|
715
|
+
* - Wallet management (host adapter or built-in wallet picker)
|
|
914
716
|
* - Widget locale preloading (optional)
|
|
915
717
|
* - Toast notifications (internal, user-transparent)
|
|
916
718
|
*/
|
|
@@ -921,10 +723,10 @@ export declare function TaskOnProvider({ config, children, preloadLocales, }: Ta
|
|
|
921
723
|
*/
|
|
922
724
|
export declare interface TaskOnProviderConfig {
|
|
923
725
|
/**
|
|
924
|
-
*
|
|
925
|
-
* Note:
|
|
726
|
+
* Client ID for authentication (X-API-Key header)
|
|
727
|
+
* Note: clientId already contains community info, no need to configure communityId/communityKey separately
|
|
926
728
|
*/
|
|
927
|
-
|
|
729
|
+
clientId: string;
|
|
928
730
|
/**
|
|
929
731
|
* API base URL (optional)
|
|
930
732
|
* @default https://white-label-api.taskon.xyz
|
|
@@ -938,8 +740,8 @@ export declare interface TaskOnProviderConfig {
|
|
|
938
740
|
/**
|
|
939
741
|
* Wallet configuration for blockchain interactions
|
|
940
742
|
*
|
|
941
|
-
* When not provided, TaskOn will use built-in
|
|
942
|
-
* for EVM wallet connections
|
|
743
|
+
* When not provided, TaskOn will use SDK built-in wallet picker adapter
|
|
744
|
+
* for EVM wallet connections.
|
|
943
745
|
*/
|
|
944
746
|
walletConfig?: WalletConfig;
|
|
945
747
|
/**
|
|
@@ -952,7 +754,7 @@ export declare interface TaskOnProviderConfig {
|
|
|
952
754
|
* ```tsx
|
|
953
755
|
* <TaskOnProvider
|
|
954
756
|
* config={{
|
|
955
|
-
*
|
|
757
|
+
* clientId: 'your-client-id',
|
|
956
758
|
* onRequestLogin: () => {
|
|
957
759
|
* setShowLoginModal(true);
|
|
958
760
|
* },
|
|
@@ -975,10 +777,13 @@ export declare interface TaskOnProviderConfig {
|
|
|
975
777
|
/**
|
|
976
778
|
* WalletConnect Project ID
|
|
977
779
|
*
|
|
978
|
-
*
|
|
979
|
-
*
|
|
780
|
+
* Only needed when you design Web3 wallet login or wallet-based reward flows.
|
|
781
|
+
* (e.g. wallet binding, on-chain verification, NFT/token claiming)
|
|
980
782
|
*
|
|
981
|
-
* If not provided,
|
|
783
|
+
* Optional. If not provided, SDK built-in default project ID will be used.
|
|
784
|
+
* For production, it is strongly recommended to set your own project ID.
|
|
785
|
+
*
|
|
786
|
+
* Get your project ID at https://cloud.walletconnect.com
|
|
982
787
|
*/
|
|
983
788
|
walletConnectProjectId?: string;
|
|
984
789
|
}
|
|
@@ -1016,6 +821,12 @@ export declare interface TaskOnTheme {
|
|
|
1016
821
|
export declare interface TaskOnThemeConfig {
|
|
1017
822
|
/** Theme mode */
|
|
1018
823
|
mode?: ThemeMode;
|
|
824
|
+
/**
|
|
825
|
+
* Theme mode strategy.
|
|
826
|
+
* - auto: mode selection follows standard mode behavior
|
|
827
|
+
* - toggle: SDK/host controls mode manually (typically used with dual+toggle from cloud config)
|
|
828
|
+
*/
|
|
829
|
+
modeStrategy?: "auto" | "toggle";
|
|
1019
830
|
/** Compact mode */
|
|
1020
831
|
compact?: boolean;
|
|
1021
832
|
/** Seed tokens */
|
|
@@ -1028,65 +839,6 @@ export declare interface TaskOnThemeConfig {
|
|
|
1028
839
|
dark?: ModeThemeConfig;
|
|
1029
840
|
}
|
|
1030
841
|
|
|
1031
|
-
/**
|
|
1032
|
-
* TemplateTask 组件
|
|
1033
|
-
*
|
|
1034
|
-
* @description 通用模版任务组件,负责:
|
|
1035
|
-
* - 解析 task.template.params 获取任务参数
|
|
1036
|
-
* - 使用 BaseTask 展示任务卡片
|
|
1037
|
-
* - 渲染描述字段(desc、desc_fields)
|
|
1038
|
-
* - 处理 Action 按钮(action_label、action_link)
|
|
1039
|
-
*
|
|
1040
|
-
* @example
|
|
1041
|
-
* ```tsx
|
|
1042
|
-
* <TemplateTask
|
|
1043
|
-
* task={taskInfo}
|
|
1044
|
-
* userStatus={userStatus}
|
|
1045
|
-
* onClick={() => console.log('卡片点击')}
|
|
1046
|
-
* onClaim={() => console.log('Claim 点击')}
|
|
1047
|
-
* />
|
|
1048
|
-
* ```
|
|
1049
|
-
*/
|
|
1050
|
-
export declare function TemplateTask({ task, userStatus, meetConditions, communityInfo, disabled, onClick, onClaim, onUpdate, onEligTaskClick, coolDown: sharedCoolDown, onCoolDownComplete: sharedOnCoolDownComplete, }: TemplateTaskProps): default_2.ReactElement;
|
|
1051
|
-
|
|
1052
|
-
/**
|
|
1053
|
-
* TemplateTask 组件属性
|
|
1054
|
-
*/
|
|
1055
|
-
export declare interface TemplateTaskProps {
|
|
1056
|
-
/** 任务信息 */
|
|
1057
|
-
task: CommunityTaskInfo;
|
|
1058
|
-
/** 用户状态 */
|
|
1059
|
-
userStatus?: GtcUserTaskStatus;
|
|
1060
|
-
/** 资格条件列表(有值时显示遮罩) */
|
|
1061
|
-
meetConditions?: MeetCondition[];
|
|
1062
|
-
/** 社区信息(用于前置任务链接跳转) */
|
|
1063
|
-
communityInfo?: {
|
|
1064
|
-
community_key?: string;
|
|
1065
|
-
dapp_domain?: string;
|
|
1066
|
-
};
|
|
1067
|
-
/** 是否禁用交互 */
|
|
1068
|
-
disabled?: boolean;
|
|
1069
|
-
/** 点击卡片回调 */
|
|
1070
|
-
onClick?: () => void;
|
|
1071
|
-
/**
|
|
1072
|
-
* 点击 Claim 回调
|
|
1073
|
-
* @param token 可选的 OAuth token(reAuth 成功后传入)
|
|
1074
|
-
*/
|
|
1075
|
-
onClaim?: (token?: string) => void | Promise<{
|
|
1076
|
-
successful: boolean;
|
|
1077
|
-
errorCode?: string;
|
|
1078
|
-
cool_down?: number;
|
|
1079
|
-
}>;
|
|
1080
|
-
/** 任务更新回调(完成/验证成功后) */
|
|
1081
|
-
onUpdate?: () => void;
|
|
1082
|
-
/** 点击资格条件中的前置任务回调(用于打开任务弹窗) */
|
|
1083
|
-
onEligTaskClick?: (taskId: number) => void;
|
|
1084
|
-
/** 共享的 coolDown 值(来自父组件) */
|
|
1085
|
-
coolDown?: number;
|
|
1086
|
-
/** coolDown 倒计时结束回调 */
|
|
1087
|
-
onCoolDownComplete?: () => void;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
842
|
/**
|
|
1091
843
|
* Translation function type
|
|
1092
844
|
*/
|
|
@@ -1158,130 +910,6 @@ export declare function useEvmWallet(): {
|
|
|
1158
910
|
signMessage: (message: string) => Promise<string | null>;
|
|
1159
911
|
};
|
|
1160
912
|
|
|
1161
|
-
/**
|
|
1162
|
-
* 获取 Quest 详情 Hook
|
|
1163
|
-
*
|
|
1164
|
-
* @param options Hook 配置(包含从根组件传入的 api 实例)
|
|
1165
|
-
* @returns Quest 详情、加载状态、错误信息、重新加载方法
|
|
1166
|
-
*/
|
|
1167
|
-
export declare function useQuestDetail(options: UseQuestDetailOptions): UseQuestDetailReturn;
|
|
1168
|
-
|
|
1169
|
-
/**
|
|
1170
|
-
* useQuestDetail Hook 参数
|
|
1171
|
-
*/
|
|
1172
|
-
declare interface UseQuestDetailOptions {
|
|
1173
|
-
/** Quest API 实例(从根组件传入) */
|
|
1174
|
-
api: QuestApi | null;
|
|
1175
|
-
/** Campaign ID */
|
|
1176
|
-
campaignId: number;
|
|
1177
|
-
/** 渠道标识(可选) */
|
|
1178
|
-
channel?: string;
|
|
1179
|
-
/** KOL 标识(可选) */
|
|
1180
|
-
kolHandle?: string;
|
|
1181
|
-
/** 邀请码(可选) */
|
|
1182
|
-
inviteCode?: string;
|
|
1183
|
-
/** Boost ID(可选) */
|
|
1184
|
-
boostId?: number;
|
|
1185
|
-
/** 是否启用(默认 true) */
|
|
1186
|
-
enabled?: boolean;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
/**
|
|
1190
|
-
* useQuestDetail Hook 返回值
|
|
1191
|
-
*/
|
|
1192
|
-
declare interface UseQuestDetailReturn {
|
|
1193
|
-
/** Campaign 详情数据 */
|
|
1194
|
-
data: QuestCampaignInfo | null;
|
|
1195
|
-
/** 是否加载中 */
|
|
1196
|
-
isLoading: boolean;
|
|
1197
|
-
/** 错误信息 */
|
|
1198
|
-
error: string | null;
|
|
1199
|
-
/** 重新加载 */
|
|
1200
|
-
refetch: () => void;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
/**
|
|
1204
|
-
* 获取 Quest 状态信息 Hook
|
|
1205
|
-
*
|
|
1206
|
-
* @param options Hook 配置(包含从根组件传入的 api 实例)
|
|
1207
|
-
* @returns Quest 状态、加载状态、错误信息、重新加载方法
|
|
1208
|
-
*/
|
|
1209
|
-
export declare function useQuestStatus(options: UseQuestStatusOptions): UseQuestStatusReturn;
|
|
1210
|
-
|
|
1211
|
-
/**
|
|
1212
|
-
* useQuestStatus Hook 参数
|
|
1213
|
-
*/
|
|
1214
|
-
declare interface UseQuestStatusOptions {
|
|
1215
|
-
/** Quest API 实例(从根组件传入) */
|
|
1216
|
-
api: QuestApi | null;
|
|
1217
|
-
/** Campaign ID */
|
|
1218
|
-
campaignId: number;
|
|
1219
|
-
/** 渠道标识 */
|
|
1220
|
-
channel?: string;
|
|
1221
|
-
/** KOL 句柄 */
|
|
1222
|
-
kolHandle?: string;
|
|
1223
|
-
/** 是否启用(默认 true) */
|
|
1224
|
-
enabled?: boolean;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* useQuestStatus Hook 返回值
|
|
1229
|
-
*/
|
|
1230
|
-
declare interface UseQuestStatusReturn {
|
|
1231
|
-
/** Campaign 状态数据 */
|
|
1232
|
-
data: CampaignStatusInfo | null;
|
|
1233
|
-
/** 是否加载中 */
|
|
1234
|
-
isLoading: boolean;
|
|
1235
|
-
/** 错误信息 */
|
|
1236
|
-
error: string | null;
|
|
1237
|
-
/** 重新加载 */
|
|
1238
|
-
refetch: () => void;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
/**
|
|
1242
|
-
* 获取用户 Quest 状态 Hook
|
|
1243
|
-
*
|
|
1244
|
-
* @param options Hook 配置(包含从根组件传入的 api 实例)
|
|
1245
|
-
* @returns 用户状态、加载状态、错误信息、重新加载方法
|
|
1246
|
-
*/
|
|
1247
|
-
export declare function useQuestUserStatus(options: UseQuestUserStatusOptions): UseQuestUserStatusReturn;
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* useQuestUserStatus Hook 参数
|
|
1251
|
-
*/
|
|
1252
|
-
declare interface UseQuestUserStatusOptions {
|
|
1253
|
-
/** Quest API 实例(从根组件传入) */
|
|
1254
|
-
api: QuestApi | null;
|
|
1255
|
-
/** Campaign ID */
|
|
1256
|
-
campaignId: number;
|
|
1257
|
-
/** 渠道标识(可选) */
|
|
1258
|
-
channel?: string;
|
|
1259
|
-
/** KOL 标识(可选) */
|
|
1260
|
-
kolHandle?: string;
|
|
1261
|
-
/** 是否启用(默认 true) */
|
|
1262
|
-
enabled?: boolean;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* useQuestUserStatus Hook 返回值
|
|
1267
|
-
*/
|
|
1268
|
-
declare interface UseQuestUserStatusReturn {
|
|
1269
|
-
/** 用户状态数据 */
|
|
1270
|
-
data: UserCampaignStatusInfo | null;
|
|
1271
|
-
/** 是否加载中 */
|
|
1272
|
-
isLoading: boolean;
|
|
1273
|
-
/** 错误信息 */
|
|
1274
|
-
error: string | null;
|
|
1275
|
-
/** 重新加载 */
|
|
1276
|
-
refetch: () => void;
|
|
1277
|
-
/**
|
|
1278
|
-
* 立即更新指定任务的本地状态(乐观更新)
|
|
1279
|
-
* @param taskId 任务 ID
|
|
1280
|
-
* @param isAsync 是否为异步任务(异步任务只更新 is_submitter)
|
|
1281
|
-
*/
|
|
1282
|
-
updateTaskStatus: (taskId: number, isAsync?: boolean) => void;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
913
|
/**
|
|
1286
914
|
* UserCenterWidget 外层组件
|
|
1287
915
|
*
|
|
@@ -1311,10 +939,19 @@ export declare interface UserCenterWidgetProps {
|
|
|
1311
939
|
* Cloud config provides tab options, display settings, etc.
|
|
1312
940
|
*/
|
|
1313
941
|
widgetId?: number;
|
|
942
|
+
/**
|
|
943
|
+
* Manual theme mode override (highest priority when provided).
|
|
944
|
+
* Recommended with dual + toggle cloud strategy.
|
|
945
|
+
*/
|
|
946
|
+
themeMode?: "light" | "dark" | "auto";
|
|
1314
947
|
/** Widget 配置 */
|
|
1315
948
|
config?: UserCenterConfig;
|
|
1316
949
|
/** 默认选中的 Tab */
|
|
1317
950
|
defaultTab?: UserCenterTabType;
|
|
951
|
+
/** 默认选中的奖励卡片(MyRewards 内部) */
|
|
952
|
+
defaultRewardCard?: UserCenterRewardCardType;
|
|
953
|
+
/** 默认 Points ID(仅当 defaultRewardCard=Points 时使用) */
|
|
954
|
+
defaultPointId?: number;
|
|
1318
955
|
/** Tab 切换回调 */
|
|
1319
956
|
onTabChange?: (tab: UserCenterTabType) => void;
|
|
1320
957
|
/** 自定义类名 */
|
|
@@ -1330,7 +967,15 @@ export { UserInfo }
|
|
|
1330
967
|
*
|
|
1331
968
|
* @example
|
|
1332
969
|
* ```tsx
|
|
1333
|
-
* const {
|
|
970
|
+
* const {
|
|
971
|
+
* login,
|
|
972
|
+
* logout,
|
|
973
|
+
* userId,
|
|
974
|
+
* isLoggedIn,
|
|
975
|
+
* isInitializing,
|
|
976
|
+
* isSessionReady,
|
|
977
|
+
* requestLogin,
|
|
978
|
+
* } = useTaskOnAuth();
|
|
1334
979
|
*
|
|
1335
980
|
* // EVM wallet login
|
|
1336
981
|
* await login({ method: 'evm_wallet', value: '0x...', sign, timestamp });
|
|
@@ -1349,6 +994,7 @@ export declare function useTaskOnAuth(): {
|
|
|
1349
994
|
userId: number | null;
|
|
1350
995
|
isLoggedIn: boolean;
|
|
1351
996
|
isInitializing: boolean;
|
|
997
|
+
isSessionReady: boolean;
|
|
1352
998
|
login: (params: LoginParams) => Promise<void>;
|
|
1353
999
|
logout: () => void;
|
|
1354
1000
|
requestLogin: () => void;
|
|
@@ -1588,15 +1234,9 @@ export declare interface WalletAdapter {
|
|
|
1588
1234
|
export declare interface WalletConfig {
|
|
1589
1235
|
/**
|
|
1590
1236
|
* Custom EVM wallet adapter
|
|
1591
|
-
* If not provided, uses built-in
|
|
1237
|
+
* If not provided, uses SDK built-in wallet picker adapter
|
|
1592
1238
|
*/
|
|
1593
1239
|
evmAdapter?: WalletAdapter;
|
|
1594
|
-
/**
|
|
1595
|
-
* Disable auto-detection of wallet providers
|
|
1596
|
-
* When true, only uses adapter explicitly provided above
|
|
1597
|
-
* @default false
|
|
1598
|
-
*/
|
|
1599
|
-
disableAutoDetect?: boolean;
|
|
1600
1240
|
}
|
|
1601
1241
|
|
|
1602
1242
|
/**
|
|
@@ -1608,6 +1248,24 @@ declare interface WalletContextValue extends WalletState {
|
|
|
1608
1248
|
signEvmMessage: (message: string) => Promise<string | null>;
|
|
1609
1249
|
}
|
|
1610
1250
|
|
|
1251
|
+
export declare function WalletPickerDialog({ open, onOpenChange, onSelect, onError, }: WalletPickerDialogProps): default_2.ReactElement;
|
|
1252
|
+
|
|
1253
|
+
export declare function WalletPickerDialogHost(): default_2.ReactElement;
|
|
1254
|
+
|
|
1255
|
+
export declare interface WalletPickerDialogProps {
|
|
1256
|
+
open: boolean;
|
|
1257
|
+
onOpenChange: (open: boolean) => void;
|
|
1258
|
+
onSelect?: (selection: WalletPickerSelection) => Promise<void>;
|
|
1259
|
+
onError?: (error: string) => void;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
export declare interface WalletPickerSelection {
|
|
1263
|
+
walletId: string;
|
|
1264
|
+
walletName: string;
|
|
1265
|
+
address: string;
|
|
1266
|
+
provider: any;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1611
1269
|
/**
|
|
1612
1270
|
* Wallet state exposed through context
|
|
1613
1271
|
*/
|
|
@@ -1622,6 +1280,6 @@ export declare interface WalletState {
|
|
|
1622
1280
|
/**
|
|
1623
1281
|
* Supported widget names for preloading
|
|
1624
1282
|
*/
|
|
1625
|
-
export declare type WidgetName = "CommunityTask";
|
|
1283
|
+
export declare type WidgetName = "CommunityTask" | "Quest" | "TaskWidget" | "LeaderboardWidget" | "UserCenterWidget";
|
|
1626
1284
|
|
|
1627
1285
|
export { }
|