@taskon/widget-react 0.0.1-beta.3 → 0.0.1-beta.5
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 +1 -1
- package/dist/CommunityTaskList.css +1340 -1292
- package/dist/EligibilityInfo.css +512 -332
- package/dist/LeaderboardWidget.css +355 -152
- package/dist/Quest.css +911 -629
- package/dist/TaskOnProvider.css +35 -16
- package/dist/UserCenterWidget.css +116 -71
- package/dist/UserCenterWidget2.css +1285 -748
- package/dist/chunks/{CommunityTaskList-C9mPl_31.js → CommunityTaskList-CrMvOB8w.js} +784 -452
- package/dist/chunks/{EligibilityInfo-DGBffKN8.js → EligibilityInfo-Beww12QX.js} +1569 -597
- package/dist/chunks/{LeaderboardWidget-DPOQVXkT.js → LeaderboardWidget-DwuSpVl0.js} +2 -2
- package/dist/chunks/{PageBuilder-WCZvxL2j.js → PageBuilder-DsX6Tv0N.js} +5 -5
- package/dist/chunks/{Quest-DjGH_8bx.js → Quest-CuD2LElS.js} +713 -484
- package/dist/chunks/{TaskOnProvider-iannERG1.js → TaskOnProvider-xUeP2Nro.js} +78 -65
- package/dist/chunks/{ThemeProvider-DNJqI2lD.js → ThemeProvider-Bt4UZ33y.js} +33 -9
- package/dist/chunks/{UserCenterWidget-CAhgp46j.js → UserCenterWidget-CB0hnj-L.js} +69 -31
- package/dist/chunks/{UserCenterWidget-B0O-f_xl.js → UserCenterWidget-CvU6K4AC.js} +21 -7
- package/dist/chunks/communitytask-es-1zawvXEX.js +311 -0
- package/dist/chunks/communitytask-ja-CmW6nP-L.js +311 -0
- package/dist/chunks/communitytask-ko-BD0hzQSi.js +311 -0
- package/dist/chunks/communitytask-ru-DhySaZL8.js +311 -0
- package/dist/chunks/createLocaleLoader-BameiEhU.js +65 -0
- package/dist/chunks/{dynamic-import-helper-B2j_dZ4V.js → dynamic-import-helper-WmIF58Sb.js} +1 -1
- package/dist/chunks/quest-es-D-b5xcme.js +948 -0
- package/dist/chunks/quest-ja-Dxd2vqBF.js +948 -0
- package/dist/chunks/quest-ko-CSmRWgK_.js +948 -0
- package/dist/chunks/quest-ru-CkEKv1_F.js +948 -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/community-task.js +1 -1
- package/dist/core.d.ts +17 -5
- package/dist/core.js +8 -7
- package/dist/dynamic-import-helper.css +424 -303
- package/dist/index.d.ts +56 -5
- package/dist/index.js +18 -16
- package/dist/leaderboard.js +2 -2
- package/dist/page-builder.js +1 -1
- package/dist/quest.d.ts +682 -0
- package/dist/quest.js +3 -1
- package/dist/user-center.d.ts +3 -1
- package/dist/user-center.js +5 -5
- package/package.json +7 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { p as preloadWidgetLocale, b as useWidgetLocale, e as createContextScope, f as useComposedRefs, g as createSlot, P as Primitive, B as Branch, h as useControllableState, j as Presence, k as composeEventHandlers, l as useCallbackRef, R as Root, m as Portal, n as dispatchDiscreteCustomEvent, o as useLayoutEffect2, q as TaskOnContext } from "./ThemeProvider-Bt4UZ33y.js";
|
|
2
|
+
import { c as createLocaleLoader } from "./createLocaleLoader-BameiEhU.js";
|
|
3
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
1
4
|
import * as React from "react";
|
|
2
5
|
import React__default, { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
3
|
-
import { b as useWidgetLocale, e as createContextScope, f as useComposedRefs, g as createSlot, P as Primitive, B as Branch, h as useControllableState, j as Presence, k as composeEventHandlers, l as useCallbackRef, R as Root, m as Portal, n as dispatchDiscreteCustomEvent, o as useLayoutEffect2, p as TaskOnContext } from "./ThemeProvider-DNJqI2lD.js";
|
|
4
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
6
|
import { createTaskOnClient, createUserApi, createChainApi, createCommunityTaskApi } from "@taskon/core";
|
|
6
7
|
import { c as createEthereumAdapter, W as WalletContext, b as useToastState, T as ToastContext } from "./useToast-CaRkylKe.js";
|
|
7
8
|
import * as ReactDOM from "react-dom";
|
|
@@ -97,71 +98,87 @@ function useClientInit({
|
|
|
97
98
|
isInitializing
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const registry = /* @__PURE__ */ new Map();
|
|
102
|
+
const builtInLocaleImports = {
|
|
103
|
+
CommunityTask: {
|
|
104
|
+
ko: () => import("./communitytask-ko-BD0hzQSi.js").then((module) => ({
|
|
105
|
+
default: module.default
|
|
106
|
+
})),
|
|
107
|
+
ja: () => import("./communitytask-ja-CmW6nP-L.js").then((module) => ({
|
|
108
|
+
default: module.default
|
|
109
|
+
})),
|
|
110
|
+
ru: () => import("./communitytask-ru-DhySaZL8.js").then((module) => ({
|
|
111
|
+
default: module.default
|
|
112
|
+
})),
|
|
113
|
+
es: () => import("./communitytask-es-1zawvXEX.js").then((module) => ({
|
|
114
|
+
default: module.default
|
|
115
|
+
}))
|
|
116
|
+
},
|
|
117
|
+
Quest: {
|
|
118
|
+
ko: () => import("./quest-ko-CSmRWgK_.js").then((module) => ({
|
|
119
|
+
default: module.default
|
|
120
|
+
})),
|
|
121
|
+
ja: () => import("./quest-ja-Dxd2vqBF.js").then((module) => ({
|
|
122
|
+
default: module.default
|
|
123
|
+
})),
|
|
124
|
+
ru: () => import("./quest-ru-CkEKv1_F.js").then((module) => ({
|
|
125
|
+
default: module.default
|
|
126
|
+
})),
|
|
127
|
+
es: () => import("./quest-es-D-b5xcme.js").then((module) => ({
|
|
128
|
+
default: module.default
|
|
129
|
+
}))
|
|
130
|
+
},
|
|
131
|
+
TaskWidget: {
|
|
132
|
+
ko: () => import("./taskwidget-ko-EHgXFV4B.js").then((module) => ({
|
|
133
|
+
default: module.default
|
|
134
|
+
})),
|
|
135
|
+
ja: () => import("./taskwidget-ja-CqSu-yWA.js").then((module) => ({
|
|
136
|
+
default: module.default
|
|
137
|
+
})),
|
|
138
|
+
ru: () => import("./taskwidget-ru-CMbLQDK4.js").then((module) => ({
|
|
139
|
+
default: module.default
|
|
140
|
+
})),
|
|
141
|
+
es: () => import("./taskwidget-es-Do9b3Mqw.js").then((module) => ({
|
|
142
|
+
default: module.default
|
|
143
|
+
}))
|
|
144
|
+
},
|
|
145
|
+
LeaderboardWidget: {
|
|
146
|
+
ko: () => import("./leaderboardwidget-ko-f1cLO9ic.js").then((module) => ({
|
|
147
|
+
default: module.default
|
|
148
|
+
})),
|
|
149
|
+
ja: () => import("./leaderboardwidget-ja-Bj6gz6y1.js").then((module) => ({
|
|
150
|
+
default: module.default
|
|
151
|
+
}))
|
|
152
|
+
},
|
|
153
|
+
UserCenterWidget: {
|
|
154
|
+
ko: () => import("./usercenter-ko-xAEYxqLg.js").then((module) => ({
|
|
155
|
+
default: module.default
|
|
156
|
+
})),
|
|
157
|
+
ja: () => import("./usercenter-ja-B2465c1O.js").then((module) => ({
|
|
158
|
+
default: module.default
|
|
159
|
+
}))
|
|
103
160
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function createT(messages) {
|
|
113
|
-
return (key, params) => {
|
|
114
|
-
const template = messages[key];
|
|
115
|
-
if (typeof template !== "string") {
|
|
116
|
-
if (process.env.NODE_ENV !== "production") {
|
|
117
|
-
console.warn(`[widget-react] Missing translation key: ${String(key)}`);
|
|
118
|
-
}
|
|
119
|
-
return String(key);
|
|
120
|
-
}
|
|
121
|
-
return interpolate(template, params);
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function createTFunction(messages) {
|
|
125
|
-
return (key, params) => {
|
|
126
|
-
const template = messages[key];
|
|
127
|
-
if (typeof template !== "string") {
|
|
128
|
-
if (process.env.NODE_ENV !== "production") {
|
|
129
|
-
console.warn(`[widget-react] Missing translation key: ${String(key)}`);
|
|
130
|
-
}
|
|
131
|
-
return String(key);
|
|
132
|
-
}
|
|
133
|
-
return interpolate(template, params);
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
function useTranslation(options) {
|
|
137
|
-
const { messages, isLoading } = useWidgetLocale(options);
|
|
138
|
-
const t = useMemo(() => createTFunction(messages), [messages]);
|
|
139
|
-
return {
|
|
140
|
-
t,
|
|
141
|
-
messages,
|
|
142
|
-
isLoading
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
function createLocaleLoader(defaultMessages, imports) {
|
|
146
|
-
return (locale) => {
|
|
147
|
-
if (locale === "en") {
|
|
148
|
-
return Promise.resolve({ default: defaultMessages });
|
|
149
|
-
}
|
|
150
|
-
const importFn = imports[locale];
|
|
151
|
-
if (importFn) {
|
|
152
|
-
return importFn();
|
|
153
|
-
}
|
|
154
|
-
return Promise.resolve({ default: defaultMessages });
|
|
155
|
-
};
|
|
161
|
+
};
|
|
162
|
+
async function preloadBuiltInWidgetLocale(widget, locale) {
|
|
163
|
+
if (locale === "en") return;
|
|
164
|
+
const localeLoader = builtInLocaleImports[widget][locale];
|
|
165
|
+
if (!localeLoader) return;
|
|
166
|
+
await preloadWidgetLocale(widget, locale, () => localeLoader());
|
|
156
167
|
}
|
|
157
|
-
const
|
|
168
|
+
const builtInPreloaders = {
|
|
169
|
+
CommunityTask: (locale) => preloadBuiltInWidgetLocale("CommunityTask", locale),
|
|
170
|
+
Quest: (locale) => preloadBuiltInWidgetLocale("Quest", locale),
|
|
171
|
+
TaskWidget: (locale) => preloadBuiltInWidgetLocale("TaskWidget", locale),
|
|
172
|
+
LeaderboardWidget: (locale) => preloadBuiltInWidgetLocale("LeaderboardWidget", locale),
|
|
173
|
+
UserCenterWidget: (locale) => preloadBuiltInWidgetLocale("UserCenterWidget", locale)
|
|
174
|
+
};
|
|
158
175
|
async function preloadWidgets(widgets, locale) {
|
|
159
176
|
const preloadPromises = widgets.map((name) => {
|
|
160
|
-
const preloadFn = registry.get(name);
|
|
177
|
+
const preloadFn = registry.get(name) ?? builtInPreloaders[name];
|
|
161
178
|
if (!preloadFn) {
|
|
162
179
|
if (process.env.NODE_ENV !== "production") {
|
|
163
180
|
console.warn(
|
|
164
|
-
`[widget-react] Widget "${name}" not found in registry. Make sure
|
|
181
|
+
`[widget-react] Widget "${name}" not found in registry. Make sure this widget has a preload loader configured.`
|
|
165
182
|
);
|
|
166
183
|
}
|
|
167
184
|
return null;
|
|
@@ -1222,9 +1239,5 @@ function TaskOnProvider({
|
|
|
1222
1239
|
}
|
|
1223
1240
|
export {
|
|
1224
1241
|
TaskOnProvider as T,
|
|
1225
|
-
useCommonLocale as
|
|
1226
|
-
createT as b,
|
|
1227
|
-
createLocaleLoader as c,
|
|
1228
|
-
interpolate as i,
|
|
1229
|
-
useTranslation as u
|
|
1242
|
+
useCommonLocale as u
|
|
1230
1243
|
};
|
|
@@ -56,12 +56,12 @@ function useTaskOnAuth() {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
function isSupportedLocale(locale) {
|
|
59
|
-
return locale === "en" || locale === "ko" || locale === "ja";
|
|
59
|
+
return locale === "en" || locale === "ko" || locale === "ja" || locale === "ru" || locale === "es";
|
|
60
60
|
}
|
|
61
61
|
function warnUnsupportedLocale(locale, widgetId) {
|
|
62
62
|
if (process.env.NODE_ENV !== "production" && !isSupportedLocale(locale)) {
|
|
63
63
|
console.warn(
|
|
64
|
-
`[widget-react] Locale "${locale}" is not fully supported in ${widgetId}. Falling back to English. Supported locales: en, ko, ja`
|
|
64
|
+
`[widget-react] Locale "${locale}" is not fully supported in ${widgetId}. Falling back to English. Supported locales: en, ko, ja, ru, es`
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -122,6 +122,20 @@ function useWidgetLocale(options) {
|
|
|
122
122
|
function clearLocaleCache() {
|
|
123
123
|
localeCache.clear();
|
|
124
124
|
}
|
|
125
|
+
async function preloadWidgetLocale(widgetId, locale, loadMessages) {
|
|
126
|
+
if (locale === DEFAULT_LOCALE) return;
|
|
127
|
+
const cacheKey = `${widgetId}-${locale}`;
|
|
128
|
+
if (localeCache.has(cacheKey)) return;
|
|
129
|
+
try {
|
|
130
|
+
const module = await loadMessages(locale);
|
|
131
|
+
localeCache.set(cacheKey, module.default);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.warn(
|
|
134
|
+
`[widget-react] Failed to preload locale "${locale}" for ${widgetId}:`,
|
|
135
|
+
error
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
125
139
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
126
140
|
return function handleEvent(event) {
|
|
127
141
|
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
@@ -825,6 +839,9 @@ const lightDefaultTokens = {
|
|
|
825
839
|
fontSize: 14,
|
|
826
840
|
fontSizeSm: 12,
|
|
827
841
|
fontSizeLg: 16,
|
|
842
|
+
fontSizeXl: 18,
|
|
843
|
+
fontSizeXxl: 22,
|
|
844
|
+
fontSizeXxxl: 24,
|
|
828
845
|
// Spacing
|
|
829
846
|
spacing: 8,
|
|
830
847
|
spacingXs: 4,
|
|
@@ -875,6 +892,9 @@ const darkDefaultTokens = {
|
|
|
875
892
|
fontSize: 14,
|
|
876
893
|
fontSizeSm: 12,
|
|
877
894
|
fontSizeLg: 16,
|
|
895
|
+
fontSizeXl: 18,
|
|
896
|
+
fontSizeXxl: 22,
|
|
897
|
+
fontSizeXxxl: 24,
|
|
878
898
|
// Spacing
|
|
879
899
|
spacing: 8,
|
|
880
900
|
spacingXs: 4,
|
|
@@ -1145,6 +1165,9 @@ function deriveTokens(seed, mode) {
|
|
|
1145
1165
|
derived.fontSize = seed.fontSize;
|
|
1146
1166
|
derived.fontSizeSm = seed.fontSize - 2;
|
|
1147
1167
|
derived.fontSizeLg = seed.fontSize + 2;
|
|
1168
|
+
derived.fontSizeXl = seed.fontSize + 4;
|
|
1169
|
+
derived.fontSizeXxl = seed.fontSize + 8;
|
|
1170
|
+
derived.fontSizeXxxl = seed.fontSize + 10;
|
|
1148
1171
|
}
|
|
1149
1172
|
if (seed.spacingBaseStep !== void 0 || seed.spacingChangeUnit !== void 0) {
|
|
1150
1173
|
const base = Math.max(1, Number(seed.spacingBaseStep) || 1);
|
|
@@ -1177,9 +1200,9 @@ function getSystemThemeMode() {
|
|
|
1177
1200
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1178
1201
|
}
|
|
1179
1202
|
const defaultTheme = {
|
|
1180
|
-
mode: "
|
|
1203
|
+
mode: "dark",
|
|
1181
1204
|
compact: false,
|
|
1182
|
-
tokens:
|
|
1205
|
+
tokens: darkDefaultTokens
|
|
1183
1206
|
};
|
|
1184
1207
|
function toKebabCase(str) {
|
|
1185
1208
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -1206,7 +1229,7 @@ function resolveTheme(config, systemMode) {
|
|
|
1206
1229
|
} else if (config.mode) {
|
|
1207
1230
|
resolvedMode = config.mode;
|
|
1208
1231
|
} else {
|
|
1209
|
-
resolvedMode = "
|
|
1232
|
+
resolvedMode = "dark";
|
|
1210
1233
|
}
|
|
1211
1234
|
const defaultTokens = resolvedMode === "light" ? lightDefaultTokens : darkDefaultTokens;
|
|
1212
1235
|
const modeConfig = resolvedMode === "light" ? config.light : config.dark;
|
|
@@ -1302,9 +1325,10 @@ export {
|
|
|
1302
1325
|
Portal as m,
|
|
1303
1326
|
dispatchDiscreteCustomEvent as n,
|
|
1304
1327
|
useLayoutEffect2 as o,
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1328
|
+
preloadWidgetLocale as p,
|
|
1329
|
+
TaskOnContext as q,
|
|
1330
|
+
composeRefs as r,
|
|
1331
|
+
createContext2 as s,
|
|
1332
|
+
useTaskOnPortalContainer as t,
|
|
1309
1333
|
useTaskOnAuth as u
|
|
1310
1334
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as Table, u as usePagination, D as Dialog, B as Button, a as useResolvedWidgetConfig, W as WidgetShell, _ as __variableDynamicImportRuntimeHelper } from "./dynamic-import-helper-
|
|
1
|
+
import { T as Table, u as usePagination, D as Dialog, B as Button, a as useResolvedWidgetConfig, W as WidgetShell, _ as __variableDynamicImportRuntimeHelper } from "./dynamic-import-helper-WmIF58Sb.js";
|
|
2
2
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useRef, useCallback, useLayoutEffect, useMemo, useEffect } from "react";
|
|
4
4
|
import { UserCenterRewardCardType, USER_CENTER_PAGE_SIZE, createUserCenterApi, SnsType, createUserApi, VerifyCodeType, getChainName, truncateAddress, filterEnabledAccounts, filterEnabledWallets, USER_CENTER_REWARD_CARD_TYPES, RewardType, toWei, LockedType, filterEnabledTabs, UserCenterTabType } from "@taskon/core";
|
|
5
|
-
import { d as useTaskOnContext, b as useWidgetLocale } from "./ThemeProvider-
|
|
6
|
-
import { L as LoadingState, E as EmptyState, P as Pagination, e as formatDateTime, A as AssetImage, d as buildRewardCards, g as useBindSocialAccount, I as Input, a as useTokenAssets, u as useRewardDetails, c as usePointsHistory, W as WithdrawForm, h as PointsList, N as NftRewardContent, i as TokenRewardContent, j as enMessages } from "./UserCenterWidget-
|
|
5
|
+
import { d as useTaskOnContext, b as useWidgetLocale } from "./ThemeProvider-Bt4UZ33y.js";
|
|
6
|
+
import { L as LoadingState, E as EmptyState, P as Pagination, e as formatDateTime, A as AssetImage, d as buildRewardCards, g as useBindSocialAccount, I as Input, a as useTokenAssets, u as useRewardDetails, c as usePointsHistory, W as WithdrawForm, h as PointsList, N as NftRewardContent, i as TokenRewardContent, j as enMessages } from "./UserCenterWidget-CvU6K4AC.js";
|
|
7
7
|
import { u as useWallet, d as useToast } from "./useToast-CaRkylKe.js";
|
|
8
8
|
import '../UserCenterWidget.css';function Tabs({
|
|
9
9
|
items,
|
|
@@ -180,7 +180,8 @@ function ActivityHistoryList({
|
|
|
180
180
|
) })
|
|
181
181
|
] });
|
|
182
182
|
}
|
|
183
|
-
function getCardTitle(type, messages, pointsData) {
|
|
183
|
+
function getCardTitle(type, messages, pointsData, xpLevelData) {
|
|
184
|
+
var _a;
|
|
184
185
|
switch (type) {
|
|
185
186
|
case UserCenterRewardCardType.Token:
|
|
186
187
|
return messages.rewardToken;
|
|
@@ -192,8 +193,13 @@ function getCardTitle(type, messages, pointsData) {
|
|
|
192
193
|
return messages.rewardDiscordRole;
|
|
193
194
|
case UserCenterRewardCardType.Points:
|
|
194
195
|
return (pointsData == null ? void 0 : pointsData.points_name) ?? messages.rewardPoints;
|
|
195
|
-
case UserCenterRewardCardType.XpLevel:
|
|
196
|
+
case UserCenterRewardCardType.XpLevel: {
|
|
197
|
+
const xpPointsName = (_a = xpLevelData == null ? void 0 : xpLevelData.xpPointsName) == null ? void 0 : _a.trim();
|
|
198
|
+
if (xpPointsName) {
|
|
199
|
+
return `${xpPointsName} & ${messages.level}`;
|
|
200
|
+
}
|
|
196
201
|
return messages.rewardXpLevel;
|
|
202
|
+
}
|
|
197
203
|
default:
|
|
198
204
|
return type;
|
|
199
205
|
}
|
|
@@ -307,9 +313,10 @@ function AssetCard({
|
|
|
307
313
|
selected = false,
|
|
308
314
|
onClick,
|
|
309
315
|
messages,
|
|
310
|
-
pointsData
|
|
316
|
+
pointsData,
|
|
317
|
+
xpLevelData
|
|
311
318
|
}) {
|
|
312
|
-
const title = getCardTitle(type, messages, pointsData);
|
|
319
|
+
const title = getCardTitle(type, messages, pointsData, xpLevelData);
|
|
313
320
|
const iconUrl = getCardIconUrl(type, pointsData);
|
|
314
321
|
const iconClassName = `taskon-asset-card__icon${needsLightBackground(type) ? " taskon-asset-card__icon--light" : ""}`;
|
|
315
322
|
return /* @__PURE__ */ jsxs(
|
|
@@ -399,7 +406,8 @@ function AssetCarousel({
|
|
|
399
406
|
return onSelectCard(card.type, (_a2 = card.pointsData) == null ? void 0 : _a2.points_id);
|
|
400
407
|
},
|
|
401
408
|
messages,
|
|
402
|
-
pointsData: card.pointsData
|
|
409
|
+
pointsData: card.pointsData,
|
|
410
|
+
xpLevelData: card.xpLevelData
|
|
403
411
|
},
|
|
404
412
|
`${card.type}-${((_a = card.pointsData) == null ? void 0 : _a.points_id) ?? index}`
|
|
405
413
|
);
|
|
@@ -467,7 +475,9 @@ function XpLevelCard({
|
|
|
467
475
|
messages,
|
|
468
476
|
className = ""
|
|
469
477
|
}) {
|
|
478
|
+
var _a;
|
|
470
479
|
const { level, currentXp, nextLevelXp, totalXp } = xpData;
|
|
480
|
+
const pointsName = ((_a = xpData.pointsName) == null ? void 0 : _a.trim()) || "XP";
|
|
471
481
|
const xpToNext = Math.max(0, nextLevelXp - currentXp);
|
|
472
482
|
const columns = [
|
|
473
483
|
{
|
|
@@ -483,7 +493,7 @@ function XpLevelCard({
|
|
|
483
493
|
},
|
|
484
494
|
{
|
|
485
495
|
key: "amount",
|
|
486
|
-
title: `${messages.columnAmount} (
|
|
496
|
+
title: `${messages.columnAmount} (${pointsName})`,
|
|
487
497
|
width: 160,
|
|
488
498
|
align: "right",
|
|
489
499
|
render: (_, row) => {
|
|
@@ -528,7 +538,8 @@ function XpLevelCard({
|
|
|
528
538
|
/* @__PURE__ */ jsx("span", { className: "taskon-xp-level-card__xp-label", children: messages.totalXp }),
|
|
529
539
|
/* @__PURE__ */ jsxs("span", { className: "taskon-xp-level-card__xp-value", children: [
|
|
530
540
|
formatNumber(totalXp),
|
|
531
|
-
"
|
|
541
|
+
" ",
|
|
542
|
+
pointsName
|
|
532
543
|
] })
|
|
533
544
|
] })
|
|
534
545
|
] }),
|
|
@@ -538,12 +549,15 @@ function XpLevelCard({
|
|
|
538
549
|
formatNumber(currentXp),
|
|
539
550
|
" / ",
|
|
540
551
|
formatNumber(nextLevelXp),
|
|
541
|
-
"
|
|
552
|
+
" ",
|
|
553
|
+
pointsName
|
|
542
554
|
] }),
|
|
543
555
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
544
556
|
messages.xpToNextLevel,
|
|
545
557
|
": ",
|
|
546
|
-
formatNumber(xpToNext)
|
|
558
|
+
formatNumber(xpToNext),
|
|
559
|
+
" ",
|
|
560
|
+
pointsName
|
|
547
561
|
] })
|
|
548
562
|
] }),
|
|
549
563
|
/* @__PURE__ */ jsx(ProgressBar, { value: currentXp, max: nextLevelXp, height: 10 })
|
|
@@ -990,8 +1004,7 @@ const SNS_TYPE_MAP = {
|
|
|
990
1004
|
Discord: "Discord",
|
|
991
1005
|
Telegram: "Telegram",
|
|
992
1006
|
Email: "Email",
|
|
993
|
-
Reddit: "Reddit"
|
|
994
|
-
FSLID: "FSLID"
|
|
1007
|
+
Reddit: "Reddit"
|
|
995
1008
|
};
|
|
996
1009
|
const CHAIN_TYPE_MAP = {
|
|
997
1010
|
evm: "evm",
|
|
@@ -1010,8 +1023,7 @@ const ALL_SOCIAL_TYPES = [
|
|
|
1010
1023
|
SnsType.Discord,
|
|
1011
1024
|
SnsType.Telegram,
|
|
1012
1025
|
SnsType.Email,
|
|
1013
|
-
SnsType.Reddit
|
|
1014
|
-
SnsType.FSLID
|
|
1026
|
+
SnsType.Reddit
|
|
1015
1027
|
];
|
|
1016
1028
|
const ALL_CHAIN_TYPES = [
|
|
1017
1029
|
"evm",
|
|
@@ -1037,8 +1049,6 @@ function getSocialProfileUrl(snsType, username) {
|
|
|
1037
1049
|
return `https://reddit.com/user/${username}`;
|
|
1038
1050
|
case SnsType.Email:
|
|
1039
1051
|
return null;
|
|
1040
|
-
case SnsType.FSLID:
|
|
1041
|
-
return null;
|
|
1042
1052
|
default:
|
|
1043
1053
|
return null;
|
|
1044
1054
|
}
|
|
@@ -1724,11 +1734,12 @@ function SocialIcon({
|
|
|
1724
1734
|
fill: "none",
|
|
1725
1735
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1726
1736
|
className,
|
|
1737
|
+
style: { color: "var(--taskon-color-text-secondary)" },
|
|
1727
1738
|
children: /* @__PURE__ */ jsx(
|
|
1728
1739
|
"path",
|
|
1729
1740
|
{
|
|
1730
1741
|
d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1ZM8 13h8v-2H8v2Zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5Z",
|
|
1731
|
-
fill: "
|
|
1742
|
+
fill: "currentColor"
|
|
1732
1743
|
}
|
|
1733
1744
|
)
|
|
1734
1745
|
}
|
|
@@ -2524,13 +2535,23 @@ function EmailSection({
|
|
|
2524
2535
|
)
|
|
2525
2536
|
] });
|
|
2526
2537
|
}
|
|
2538
|
+
const USER_CENTER_WALLET_ACCOUNT_TYPE = String(SnsType.All).toLowerCase();
|
|
2539
|
+
const isWalletAccountType = (accountType) => accountType.toLowerCase() === USER_CENTER_WALLET_ACCOUNT_TYPE;
|
|
2527
2540
|
function IdentityContent({
|
|
2528
2541
|
config,
|
|
2529
2542
|
messages
|
|
2530
2543
|
}) {
|
|
2544
|
+
var _a, _b, _c, _d;
|
|
2531
2545
|
const identityTab = config.find((t) => t.tab === "Identity");
|
|
2532
2546
|
const enabledAccounts = identityTab ? filterEnabledAccounts(identityTab) : [];
|
|
2533
2547
|
const enabledWallets = identityTab ? filterEnabledWallets(identityTab) : [];
|
|
2548
|
+
const identityParams = identityTab && !Array.isArray(identityTab.params) ? identityTab.params : void 0;
|
|
2549
|
+
const walletAccountOption = (_a = identityParams == null ? void 0 : identityParams.accountOptions) == null ? void 0 : _a.find(
|
|
2550
|
+
(account) => isWalletAccountType(String(account.account))
|
|
2551
|
+
);
|
|
2552
|
+
const isWalletAccountEnabled = walletAccountOption ? walletAccountOption.enabled !== false : true;
|
|
2553
|
+
const hasExplicitAccountConfig = (((_b = identityParams == null ? void 0 : identityParams.accountOptions) == null ? void 0 : _b.length) ?? 0) > 0;
|
|
2554
|
+
const hasExplicitWalletConfig = (((_c = walletAccountOption == null ? void 0 : walletAccountOption.walletOptions) == null ? void 0 : _c.length) ?? 0) > 0 || (((_d = identityParams == null ? void 0 : identityParams.walletOptions) == null ? void 0 : _d.length) ?? 0) > 0;
|
|
2534
2555
|
const { socialAccounts, walletAddresses, rawAddresses, isLoaded } = useIdentityData();
|
|
2535
2556
|
const { checkSocialUnlink, checkWalletUnlink } = useDisableUnlink();
|
|
2536
2557
|
const { toast } = useToast();
|
|
@@ -2574,22 +2595,38 @@ function IdentityContent({
|
|
|
2574
2595
|
toast.error(messages.unbindFailed);
|
|
2575
2596
|
}
|
|
2576
2597
|
});
|
|
2598
|
+
const enabledSocialAccountTypes = useMemo(() => {
|
|
2599
|
+
return new Set(
|
|
2600
|
+
enabledAccounts.filter((account) => !isWalletAccountType(String(account.account))).map((account) => String(account.account).toLowerCase())
|
|
2601
|
+
);
|
|
2602
|
+
}, [enabledAccounts]);
|
|
2603
|
+
const enabledWalletChainTypes = useMemo(() => {
|
|
2604
|
+
return new Set(
|
|
2605
|
+
enabledWallets.map((wallet) => String(wallet.chain).toLowerCase())
|
|
2606
|
+
);
|
|
2607
|
+
}, [enabledWallets]);
|
|
2577
2608
|
const filteredSocialAccounts = useMemo(() => {
|
|
2578
2609
|
return socialAccounts.filter((account) => {
|
|
2579
|
-
if (
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
)
|
|
2610
|
+
if (isWalletAccountType(String(account.snsType))) {
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
if (!hasExplicitAccountConfig) {
|
|
2614
|
+
return true;
|
|
2615
|
+
}
|
|
2616
|
+
return enabledSocialAccountTypes.has(account.snsType.toLowerCase());
|
|
2583
2617
|
});
|
|
2584
|
-
}, [socialAccounts,
|
|
2618
|
+
}, [socialAccounts, hasExplicitAccountConfig, enabledSocialAccountTypes]);
|
|
2585
2619
|
const filteredWalletAddresses = useMemo(() => {
|
|
2620
|
+
if (!isWalletAccountEnabled) {
|
|
2621
|
+
return [];
|
|
2622
|
+
}
|
|
2623
|
+
if (!hasExplicitWalletConfig) {
|
|
2624
|
+
return walletAddresses;
|
|
2625
|
+
}
|
|
2586
2626
|
return walletAddresses.filter((wallet) => {
|
|
2587
|
-
|
|
2588
|
-
return enabledWallets.some(
|
|
2589
|
-
(cfg) => cfg.chain.toLowerCase() === wallet.coreChainType.toLowerCase()
|
|
2590
|
-
);
|
|
2627
|
+
return enabledWalletChainTypes.has(wallet.coreChainType.toLowerCase());
|
|
2591
2628
|
});
|
|
2592
|
-
}, [walletAddresses,
|
|
2629
|
+
}, [walletAddresses, hasExplicitWalletConfig, enabledWalletChainTypes, isWalletAccountEnabled]);
|
|
2593
2630
|
const emailAccount = useMemo(() => {
|
|
2594
2631
|
return filteredSocialAccounts.find((a) => a.snsType === SnsType.Email);
|
|
2595
2632
|
}, [filteredSocialAccounts]);
|
|
@@ -2936,7 +2973,8 @@ function MyRewardsContent({
|
|
|
2936
2973
|
level: selectedXpLevelData.level,
|
|
2937
2974
|
currentXp: selectedXpLevelData.currentXp,
|
|
2938
2975
|
nextLevelXp: selectedXpLevelData.nextLevelXp,
|
|
2939
|
-
totalXp: selectedXpLevelData.currentXp
|
|
2976
|
+
totalXp: selectedXpLevelData.currentXp,
|
|
2977
|
+
pointsName: selectedXpLevelData.xpPointsName
|
|
2940
2978
|
},
|
|
2941
2979
|
historyData: xpLevelHistory,
|
|
2942
2980
|
historyLoading: xpLevelHistoryLoading,
|
|
@@ -3134,7 +3172,7 @@ function UserCenterWidgetInner({
|
|
|
3134
3172
|
const { messages, isLoading: isLocaleLoading } = useWidgetLocale({
|
|
3135
3173
|
widgetId: "UserCenterWidget",
|
|
3136
3174
|
defaultMessages: enMessages,
|
|
3137
|
-
loadMessages: (locale) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./locales/en.json": () => import("./UserCenterWidget-
|
|
3175
|
+
loadMessages: (locale) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./locales/en.json": () => import("./UserCenterWidget-CvU6K4AC.js").then((n) => n.w), "./locales/ja.json": () => import("./usercenter-ja-B2465c1O.js"), "./locales/ko.json": () => import("./usercenter-ko-xAEYxqLg.js") }), `./locales/${locale}.json`, 3)
|
|
3138
3176
|
});
|
|
3139
3177
|
const enabledTabs = useMemo(() => filterEnabledTabs(config), [config]);
|
|
3140
3178
|
const tabItems = useMemo(() => {
|
|
@@ -4,10 +4,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import React__default, { forwardRef, useRef, useCallback, useImperativeHandle, useEffect, useContext, useState, useMemo, useLayoutEffect, createContext } from "react";
|
|
6
6
|
import { createUserApi, createNftClaimApi, NftClaimError, NftClaimErrorType, getNftChainName, generatePendingKey, getPendingHash, NftClaimType, WithdrawNft, ClaimMintedNft, ClaimCapNft, setPendingHash, clearPendingHash, RewardType, isNftClaimed, isNftClaimable, getNftClaimType, ChainType, DEFAULT_ERROR_MESSAGES, openInNewTab, toWei, formatTokenAmount as formatTokenAmount$1, USER_CENTER_REWARD_CARD_TYPES, RouletteRewardType, USER_CENTER_PAGE_SIZE, createUserCenterApi, getTxExplorerUrl } from "@taskon/core";
|
|
7
|
-
import {
|
|
7
|
+
import { q as TaskOnContext, d as useTaskOnContext, P as Primitive, o as useLayoutEffect2, e as createContextScope, f as useComposedRefs, l as useCallbackRef, h as useControllableState, k as composeEventHandlers, j as Presence, m as Portal$1, g as createSlot, D as DismissableLayer, t as useTaskOnPortalContainer } from "./ThemeProvider-Bt4UZ33y.js";
|
|
8
8
|
import { d as useToast, u as useWallet, e as createEthereumAdapterFromProvider } from "./useToast-CaRkylKe.js";
|
|
9
9
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
10
|
-
import { D as Dialog, b as useId, h as hideOthers, R as ReactRemoveScroll, d as useFocusGuards, F as FocusScope, P as Pagination$1, B as Button, T as Table, u as usePagination } from "./dynamic-import-helper-
|
|
10
|
+
import { D as Dialog, b as useId, h as hideOthers, R as ReactRemoveScroll, d as useFocusGuards, F as FocusScope, P as Pagination$1, B as Button, T as Table, u as usePagination } from "./dynamic-import-helper-WmIF58Sb.js";
|
|
11
11
|
import * as ReactDOM from "react-dom";
|
|
12
12
|
import { createPortal } from "react-dom";
|
|
13
13
|
const Input = forwardRef(
|
|
@@ -360,14 +360,20 @@ function useBindSocialAccount({
|
|
|
360
360
|
isBound
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
const
|
|
363
|
+
const VIEWPORT_BREAKPOINTS = {
|
|
364
|
+
mobileMax: 750
|
|
365
|
+
};
|
|
366
|
+
const MOBILE_MAX_WIDTH = VIEWPORT_BREAKPOINTS.mobileMax;
|
|
367
|
+
function isMobileViewport(width) {
|
|
368
|
+
return width <= MOBILE_MAX_WIDTH;
|
|
369
|
+
}
|
|
364
370
|
function useIsMobile() {
|
|
365
371
|
const [isMobile, setIsMobile] = useState(() => {
|
|
366
372
|
if (typeof window === "undefined") return false;
|
|
367
|
-
return window.innerWidth
|
|
373
|
+
return isMobileViewport(window.innerWidth);
|
|
368
374
|
});
|
|
369
375
|
const handleResize = useCallback(() => {
|
|
370
|
-
setIsMobile(window.innerWidth
|
|
376
|
+
setIsMobile(isMobileViewport(window.innerWidth));
|
|
371
377
|
}, []);
|
|
372
378
|
useEffect(() => {
|
|
373
379
|
if (typeof window === "undefined") return;
|
|
@@ -4067,7 +4073,15 @@ function TipPopover({
|
|
|
4067
4073
|
className || ""
|
|
4068
4074
|
].filter(Boolean).join(" ");
|
|
4069
4075
|
return /* @__PURE__ */ jsxs(Root2, { open, onOpenChange: setOpen, children: [
|
|
4070
|
-
/* @__PURE__ */ jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4076
|
+
/* @__PURE__ */ jsx(Trigger, { asChild: true, children: children ? /* @__PURE__ */ jsx(
|
|
4077
|
+
"span",
|
|
4078
|
+
{
|
|
4079
|
+
className: triggerClassName,
|
|
4080
|
+
onMouseEnter: handleMouseEnter,
|
|
4081
|
+
onMouseLeave: handleMouseLeave,
|
|
4082
|
+
children
|
|
4083
|
+
}
|
|
4084
|
+
) : /* @__PURE__ */ jsx(
|
|
4071
4085
|
"button",
|
|
4072
4086
|
{
|
|
4073
4087
|
type: "button",
|
|
@@ -4075,7 +4089,7 @@ function TipPopover({
|
|
|
4075
4089
|
"aria-label": "More information",
|
|
4076
4090
|
onMouseEnter: handleMouseEnter,
|
|
4077
4091
|
onMouseLeave: handleMouseLeave,
|
|
4078
|
-
children:
|
|
4092
|
+
children: /* @__PURE__ */ jsx(InfoIcon, { size: iconSize })
|
|
4079
4093
|
}
|
|
4080
4094
|
) }),
|
|
4081
4095
|
/* @__PURE__ */ jsx(Portal, { container: portalContainer ?? void 0, children: /* @__PURE__ */ jsxs(
|