@taskon/widget-react 0.0.1-beta.5 → 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.
- package/README.md +61 -47
- package/dist/CommunityTaskList.css +9 -1
- package/dist/EligibilityInfo.css +48 -75
- package/dist/LeaderboardWidget.css +73 -71
- package/dist/PageBuilder.css +5 -0
- package/dist/Quest.css +18 -14
- package/dist/TaskOnProvider.css +289 -0
- package/dist/ThemeProvider.css +227 -0
- package/dist/UserCenterWidget.css +6 -6
- package/dist/UserCenterWidget2.css +1388 -1621
- package/dist/{dynamic-import-helper.css → WidgetShell.css} +0 -227
- package/dist/chunks/{CommunityTaskList-CrMvOB8w.js → CommunityTaskList-D0uVD8wD.js} +393 -208
- package/dist/chunks/{EligibilityInfo-Beww12QX.js → EligibilityInfo-Cf6hx9-a.js} +459 -679
- package/dist/chunks/{LeaderboardWidget-DwuSpVl0.js → LeaderboardWidget-DyoiiNS6.js} +274 -252
- package/dist/chunks/{PageBuilder-DsX6Tv0N.js → PageBuilder-DoAFPm6-.js} +5 -5
- package/dist/chunks/{Quest-CuD2LElS.js → Quest-ySZlYd4u.js} +74 -57
- package/dist/chunks/TaskOnProvider-CxtFIs3n.js +2072 -0
- package/dist/chunks/{dynamic-import-helper-WmIF58Sb.js → ThemeProvider-CulHkqqY.js} +1282 -555
- package/dist/chunks/UserCenterWidget-BJsc_GSZ.js +3246 -0
- package/dist/chunks/{UserCenterWidget-CvU6K4AC.js → UserCenterWidget-STq8kpV4.js} +1174 -1386
- package/dist/chunks/WidgetShell-8xn-Jivw.js +659 -0
- 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-DhySaZL8.js → communitytask-ru-CZm2CPoV.js} +211 -1
- 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-D-b5xcme.js → quest-es-Dyyy0zaw.js} +8 -93
- package/dist/chunks/{quest-ja-Dxd2vqBF.js → quest-ja-Depog33y.js} +8 -93
- package/dist/chunks/{quest-ko-CSmRWgK_.js → quest-ko-BMu3uRQJ.js} +8 -93
- package/dist/chunks/{quest-ru-CkEKv1_F.js → quest-ru-xne814Rw.js} +8 -93
- package/dist/chunks/useIsMobile-D6Ybur-6.js +30 -0
- package/dist/chunks/useToast-BGJhd3BX.js +93 -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 +0 -390
- package/dist/community-task.js +2 -7
- package/dist/core.d.ts +38 -20
- package/dist/core.js +9 -10
- package/dist/index.d.ts +86 -709
- package/dist/index.js +22 -28
- package/dist/leaderboard.d.ts +0 -498
- package/dist/leaderboard.js +2 -16
- package/dist/page-builder.js +1 -1
- package/dist/quest.d.ts +0 -971
- package/dist/quest.js +2 -7
- package/dist/user-center.d.ts +0 -1610
- package/dist/user-center.js +2 -494
- package/package.json +2 -2
- package/dist/chunks/TaskOnProvider-xUeP2Nro.js +0 -1243
- package/dist/chunks/ThemeProvider-Bt4UZ33y.js +0 -1334
- package/dist/chunks/UserCenterWidget-CB0hnj-L.js +0 -3230
- package/dist/chunks/communitytask-es-1zawvXEX.js +0 -311
- package/dist/chunks/communitytask-ja-CmW6nP-L.js +0 -311
- package/dist/chunks/communitytask-ko-BD0hzQSi.js +0 -311
- package/dist/chunks/createLocaleLoader-BameiEhU.js +0 -65
- package/dist/chunks/leaderboardwidget-ja-Bj6gz6y1.js +0 -119
- package/dist/chunks/leaderboardwidget-ko-f1cLO9ic.js +0 -119
- package/dist/chunks/useToast-CaRkylKe.js +0 -304
- package/dist/chunks/usercenter-ja-B2465c1O.js +0 -326
- package/dist/chunks/usercenter-ko-xAEYxqLg.js +0 -326
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { isValidElement, cloneElement, Fragment as Fragment$1,
|
|
3
|
-
import { createUserApi, ChainType, getTxExplorerUrl, RewardType,
|
|
4
|
-
import { u as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { u as useTranslation, c as createLocaleLoader } from "./createLocaleLoader-BameiEhU.js";
|
|
8
|
-
import { D as Dialog, _ as __variableDynamicImportRuntimeHelper } from "./dynamic-import-helper-WmIF58Sb.js";
|
|
2
|
+
import React__default, { isValidElement, cloneElement, Fragment as Fragment$1, useContext, useState, useRef, useMemo, useCallback, forwardRef, useEffect, useImperativeHandle } from "react";
|
|
3
|
+
import { createUserApi, ChainType, parseTitleExpress, getTxExplorerUrl, RewardType, UserIdentityType, SnsType, createQuestApi, isUnauthorizedError, ErrorCode, ApiError, createCommonApi, powIcon, contractInteractiveIcon, getSwapDexTitleExpress, EligibilityTemplateId, UserEligibleStatus } from "@taskon/core";
|
|
4
|
+
import { R as Root2, h as Trigger, i as Portal, C as Content2, j as Arrow2, k as useChainMap, l as useNftClaim, m as ClaimNftDialog, n as enMessages$2, o as PendingTxDialog, p as TipPopover, a as useBindSocialAccount, u as useUserCenterLocale, c as useTokenAssets, d as useRewardDetails, e as usePointsHistory, L as LoadingState, T as TokenRewardContent, g as PointsList, E as EmptyState, N as NftRewardContent, W as WithdrawForm } from "./UserCenterWidget-STq8kpV4.js";
|
|
5
|
+
import { w as TaskOnContext, D as Dialog, E as useTaskOnPortalContainer, c as useTranslation, e as createLocaleLoader, u as useTaskOnAuth } from "./ThemeProvider-CulHkqqY.js";
|
|
6
|
+
import { u as useWallet, c as useToast } from "./useToast-BGJhd3BX.js";
|
|
9
7
|
import '../EligibilityInfo.css';const SLOT_TOKEN_PREFIX = "__TASKON_I18NT_SLOT_";
|
|
10
8
|
const SLOT_TOKEN_SUFFIX = "__";
|
|
11
9
|
const SLOT_TOKEN_REGEXP = /__TASKON_I18NT_SLOT_([A-Za-z0-9_]+)__/g;
|
|
@@ -84,6 +82,162 @@ function I18nT({
|
|
|
84
82
|
}
|
|
85
83
|
return /* @__PURE__ */ jsx(WrapperElement, { children: content2 });
|
|
86
84
|
}
|
|
85
|
+
const BIND_TEXT = "Confirm to BIND this wallet address.";
|
|
86
|
+
const BIND_NOTE = "This signature is for confirmation only.";
|
|
87
|
+
function getBindSignText(address, nonce) {
|
|
88
|
+
return `${BIND_TEXT}
|
|
89
|
+
Address:${address}
|
|
90
|
+
Nonce:${nonce}
|
|
91
|
+
Note:${BIND_NOTE}`;
|
|
92
|
+
}
|
|
93
|
+
function useBindWallet({
|
|
94
|
+
chainType,
|
|
95
|
+
onSuccess,
|
|
96
|
+
onFailed
|
|
97
|
+
}) {
|
|
98
|
+
const context = useContext(TaskOnContext);
|
|
99
|
+
const client = (context == null ? void 0 : context.client) ?? null;
|
|
100
|
+
const userInfo = (context == null ? void 0 : context.userInfo) ?? null;
|
|
101
|
+
const refreshUserInfo = context == null ? void 0 : context.refreshUserInfo;
|
|
102
|
+
const wallet = useWallet();
|
|
103
|
+
const { evmAdapter, connectEvm, signEvmMessage } = wallet;
|
|
104
|
+
const [isBinding, setIsBinding] = useState(false);
|
|
105
|
+
const bindWaitResolveRef = useRef(null);
|
|
106
|
+
const userApi = useMemo(() => {
|
|
107
|
+
if (!client) return null;
|
|
108
|
+
return createUserApi(client);
|
|
109
|
+
}, [client]);
|
|
110
|
+
const hasAdapter = useMemo(() => {
|
|
111
|
+
return evmAdapter !== null;
|
|
112
|
+
}, [evmAdapter]);
|
|
113
|
+
const isBound = useMemo(() => {
|
|
114
|
+
if (!chainType || !(userInfo == null ? void 0 : userInfo.address)) return false;
|
|
115
|
+
return userInfo.address.some((item) => item.chain_type === chainType);
|
|
116
|
+
}, [chainType, userInfo]);
|
|
117
|
+
const handleSuccess = useCallback(async () => {
|
|
118
|
+
var _a;
|
|
119
|
+
await (onSuccess == null ? void 0 : onSuccess());
|
|
120
|
+
(_a = bindWaitResolveRef.current) == null ? void 0 : _a.call(bindWaitResolveRef, true);
|
|
121
|
+
bindWaitResolveRef.current = null;
|
|
122
|
+
}, [onSuccess]);
|
|
123
|
+
const handleFailed = useCallback((error) => {
|
|
124
|
+
var _a;
|
|
125
|
+
onFailed == null ? void 0 : onFailed(error);
|
|
126
|
+
(_a = bindWaitResolveRef.current) == null ? void 0 : _a.call(bindWaitResolveRef, false);
|
|
127
|
+
bindWaitResolveRef.current = null;
|
|
128
|
+
}, [onFailed]);
|
|
129
|
+
const bindWithAdapter = useCallback(async () => {
|
|
130
|
+
var _a, _b;
|
|
131
|
+
if (!userApi) {
|
|
132
|
+
handleFailed("User API not initialized");
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setIsBinding(true);
|
|
136
|
+
try {
|
|
137
|
+
const address = await connectEvm();
|
|
138
|
+
if (!address) {
|
|
139
|
+
handleFailed("Failed to connect wallet");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const nonce = await userApi.requestChallenge("AddressBind");
|
|
143
|
+
const message = getBindSignText(address, nonce);
|
|
144
|
+
const signature = await signEvmMessage(message);
|
|
145
|
+
if (!signature) {
|
|
146
|
+
handleFailed("Signature cancelled");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const bindResult = await userApi.bindAddress({
|
|
150
|
+
address,
|
|
151
|
+
nonce,
|
|
152
|
+
sig: signature,
|
|
153
|
+
chain_type: ChainType.evm
|
|
154
|
+
});
|
|
155
|
+
if (bindResult.result) {
|
|
156
|
+
await (refreshUserInfo == null ? void 0 : refreshUserInfo());
|
|
157
|
+
await handleSuccess();
|
|
158
|
+
} else {
|
|
159
|
+
handleFailed("This wallet address is already bound to another account");
|
|
160
|
+
}
|
|
161
|
+
} catch (e) {
|
|
162
|
+
const error = e;
|
|
163
|
+
if (((_a = error.message) == null ? void 0 : _a.includes("rejected")) || ((_b = error.message) == null ? void 0 : _b.includes("denied"))) {
|
|
164
|
+
handleFailed("User rejected the request");
|
|
165
|
+
} else {
|
|
166
|
+
handleFailed(error.message || "Failed to bind wallet");
|
|
167
|
+
}
|
|
168
|
+
} finally {
|
|
169
|
+
setIsBinding(false);
|
|
170
|
+
}
|
|
171
|
+
}, [userApi, connectEvm, signEvmMessage, refreshUserInfo, handleSuccess, handleFailed]);
|
|
172
|
+
const bindIfNeed = useCallback(async (targetChainType) => {
|
|
173
|
+
const effectiveChainType = targetChainType || chainType;
|
|
174
|
+
if (effectiveChainType && (userInfo == null ? void 0 : userInfo.address)) {
|
|
175
|
+
const alreadyBound = userInfo.address.some((item) => item.chain_type === effectiveChainType);
|
|
176
|
+
if (alreadyBound) {
|
|
177
|
+
await handleSuccess();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (!effectiveChainType) {
|
|
182
|
+
await handleSuccess();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (effectiveChainType !== ChainType.evm) {
|
|
186
|
+
handleFailed(`Chain type "${effectiveChainType}" is not supported yet`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (!context || !userApi) {
|
|
190
|
+
await handleSuccess();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (!hasAdapter) {
|
|
194
|
+
handleFailed("No wallet adapter available");
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
await bindWithAdapter();
|
|
198
|
+
}, [
|
|
199
|
+
chainType,
|
|
200
|
+
userInfo,
|
|
201
|
+
hasAdapter,
|
|
202
|
+
context,
|
|
203
|
+
userApi,
|
|
204
|
+
bindWithAdapter,
|
|
205
|
+
handleSuccess,
|
|
206
|
+
handleFailed
|
|
207
|
+
]);
|
|
208
|
+
const bindAndWait = useCallback(async (targetChainType) => {
|
|
209
|
+
const effectiveChainType = targetChainType || chainType;
|
|
210
|
+
if (effectiveChainType && (userInfo == null ? void 0 : userInfo.address)) {
|
|
211
|
+
const alreadyBound = userInfo.address.some((item) => item.chain_type === effectiveChainType);
|
|
212
|
+
if (alreadyBound) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (!effectiveChainType) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
if (effectiveChainType !== ChainType.evm) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
if (!context || !userApi) {
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
if (!hasAdapter) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return new Promise((resolve) => {
|
|
229
|
+
bindWaitResolveRef.current = resolve;
|
|
230
|
+
bindIfNeed();
|
|
231
|
+
});
|
|
232
|
+
}, [chainType, userInfo, context, userApi, hasAdapter, bindIfNeed]);
|
|
233
|
+
return {
|
|
234
|
+
bindIfNeed,
|
|
235
|
+
bindAndWait,
|
|
236
|
+
isBinding,
|
|
237
|
+
isBound,
|
|
238
|
+
hasAdapter
|
|
239
|
+
};
|
|
240
|
+
}
|
|
87
241
|
const successIconUrl = new URL("data:image/svg+xml,%3csvg%20width='46'%20height='46'%20viewBox='0%200%2046%2046'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='23'%20cy='23'%20r='23'%20fill='%2331FF90'/%3e%3cpath%20d='M16.4281%2022.8899L20.6446%2027.1063L29.6798%2018.0711'%20stroke='black'%20stroke-width='5'%20stroke-linecap='square'%20stroke-linejoin='round'/%3e%3c/svg%3e", import.meta.url).href;
|
|
88
242
|
const warnIconUrl = new URL("data:image/svg+xml,%3csvg%20width='46'%20height='46'%20viewBox='0%200%2046%2046'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M22.9783%200.0225143C10.2876%200.0225143%200%2010.3101%200%2023.0006C0%2035.6903%2010.2876%2045.9776%2022.9783%2045.9776C35.6682%2045.9776%2045.9556%2035.6903%2045.9556%2023.0006C45.9558%2010.3101%2035.6682%200.0225143%2022.9783%200.0225143ZM21.797%209.85031C21.797%209.01328%2022.4783%208.33197%2023.3154%208.33197C24.1524%208.33197%2024.8337%209.01328%2024.8337%209.85031V11.729C24.8337%2012.5662%2024.1524%2013.2475%2023.3154%2013.2475C22.4783%2013.2475%2021.797%2012.5662%2021.797%2011.7292V9.85031ZM12.0443%2023.1095H10.1657C9.32842%2023.1095%208.64717%2022.4282%208.64717%2021.5912C8.64717%2020.7541%209.32842%2020.0729%2010.1657%2020.0729H12.0443C12.8814%2020.0729%2013.5627%2020.7541%2013.5627%2021.5912C13.5627%2022.4282%2012.8819%2023.1095%2012.0443%2023.1095ZM12.6546%2014.9563C12.368%2014.6697%2012.2098%2014.2882%2012.2098%2013.8823C12.2098%2013.477%2012.3678%2013.0957%2012.6546%2012.8086C12.9411%2012.522%2013.3223%2012.3638%2013.7282%2012.3638C14.134%2012.3638%2014.515%2012.5216%2014.8021%2012.8086L16.1305%2014.137C16.4173%2014.4241%2016.5753%2014.8054%2016.5753%2015.2107C16.5753%2015.6165%2016.4171%2015.9976%2016.1305%2016.2847C15.843%2016.5715%2015.4617%2016.7295%2015.0565%2016.7295C14.6511%2016.7295%2014.2698%2016.5715%2013.9828%2016.2847L12.6546%2014.9563ZM24.2545%2039.3233H22.3764C21.5389%2039.3233%2020.8574%2038.642%2020.8574%2037.8045C20.8574%2036.9674%2021.5389%2036.2861%2022.3764%2036.2861H24.2545C25.0916%2036.2861%2025.7731%2036.9674%2025.7731%2037.8045C25.7732%2038.6421%2025.0916%2039.3233%2024.2545%2039.3233ZM26.1334%2035.8432H20.4976C19.6603%2035.8432%2018.9792%2035.1622%2018.9792%2034.3253C18.9792%2033.4875%2019.6603%2032.8063%2020.4976%2032.8063H26.133C26.9701%2032.8063%2027.6513%2033.4878%2027.6513%2034.3253C27.6518%2035.1624%2026.9705%2035.8432%2026.1334%2035.8432ZM23.3154%2032.033C18.335%2032.033%2014.2826%2027.9809%2014.2826%2023C14.2826%2018.0196%2018.3345%2013.9671%2023.3154%2013.9671C28.2958%2013.9671%2032.3478%2018.0191%2032.3478%2023C32.3478%2027.9809%2028.2958%2032.033%2023.3154%2032.033ZM31.574%2016.7295C31.1682%2016.7295%2030.7867%2016.5713%2030.5%2016.2843C29.9086%2015.6924%2029.9086%2014.7293%2030.5%2014.1374L31.8288%2012.8086C32.1155%2012.522%2032.4972%2012.364%2032.9026%2012.364C33.3082%2012.364%2033.6895%2012.522%2033.9762%2012.8084C34.568%2013.4009%2034.5676%2014.364%2033.9762%2014.9559L32.6478%2016.2843C32.3613%2016.5715%2031.98%2016.7295%2031.574%2016.7295ZM36.4652%2023.1095H34.5862C33.7491%2023.1095%2033.0678%2022.4282%2033.0678%2021.5912C33.0678%2020.7541%2033.7491%2020.0729%2034.5862%2020.0729H36.4652C37.3025%2020.0729%2037.9835%2020.7541%2037.9835%2021.5912C37.9836%2022.4282%2037.3025%2023.1095%2036.4652%2023.1095Z'%20fill='%23F89D35'/%3e%3c/svg%3e", import.meta.url).href;
|
|
89
243
|
function getNoticeIcon(type) {
|
|
@@ -162,7 +316,7 @@ function ConfirmNoticeDialog({
|
|
|
162
316
|
closeOnOverlayClick,
|
|
163
317
|
closeOnEscapeKey,
|
|
164
318
|
maxWidth,
|
|
165
|
-
contentClassName
|
|
319
|
+
contentClassName,
|
|
166
320
|
children: /* @__PURE__ */ jsxs(
|
|
167
321
|
"div",
|
|
168
322
|
{
|
|
@@ -272,571 +426,33 @@ const Textarea = forwardRef(
|
|
|
272
426
|
(e) => {
|
|
273
427
|
onChange(e.target.value);
|
|
274
428
|
},
|
|
275
|
-
[onChange]
|
|
276
|
-
);
|
|
277
|
-
const shouldShowCount = showCount && maxLength !== void 0;
|
|
278
|
-
return /* @__PURE__ */ jsxs("div", { className: "taskon-textarea-wrap", children: [
|
|
279
|
-
/* @__PURE__ */ jsx(
|
|
280
|
-
"textarea",
|
|
281
|
-
{
|
|
282
|
-
ref: textareaRef,
|
|
283
|
-
className: `taskon-textarea ${hasError ? "taskon-textarea--error" : ""} ${className || ""}`,
|
|
284
|
-
value: value2,
|
|
285
|
-
onChange: handleChange,
|
|
286
|
-
maxLength,
|
|
287
|
-
disabled,
|
|
288
|
-
placeholder,
|
|
289
|
-
rows
|
|
290
|
-
}
|
|
291
|
-
),
|
|
292
|
-
shouldShowCount && /* @__PURE__ */ jsxs("div", { className: "taskon-textarea-count", children: [
|
|
293
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-textarea-count-current", children: value2.length }),
|
|
294
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
295
|
-
"/",
|
|
296
|
-
maxLength
|
|
297
|
-
] })
|
|
298
|
-
] })
|
|
299
|
-
] });
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
function detectEthereumProvider() {
|
|
303
|
-
if (typeof window === "undefined") return false;
|
|
304
|
-
return Boolean(window.ethereum);
|
|
305
|
-
}
|
|
306
|
-
function getProvider() {
|
|
307
|
-
if (typeof window === "undefined") return null;
|
|
308
|
-
return window.ethereum || null;
|
|
309
|
-
}
|
|
310
|
-
function useInjectedProvider() {
|
|
311
|
-
const isMobile = useIsMobile();
|
|
312
|
-
const hasEthereumProvider = detectEthereumProvider();
|
|
313
|
-
const isDapp = useMemo(() => {
|
|
314
|
-
return isMobile && hasEthereumProvider;
|
|
315
|
-
}, [isMobile, hasEthereumProvider]);
|
|
316
|
-
return {
|
|
317
|
-
hasEthereumProvider,
|
|
318
|
-
isDapp,
|
|
319
|
-
getEthereumProvider: getProvider
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
const BIND_TEXT = "Confirm to BIND this wallet address.";
|
|
323
|
-
const BIND_NOTE = "This signature is for confirmation only.";
|
|
324
|
-
function getBindSignText(address, nonce) {
|
|
325
|
-
return `${BIND_TEXT}
|
|
326
|
-
Address:${address}
|
|
327
|
-
Nonce:${nonce}
|
|
328
|
-
Note:${BIND_NOTE}`;
|
|
329
|
-
}
|
|
330
|
-
function useBindWallet({
|
|
331
|
-
chainType,
|
|
332
|
-
onSuccess,
|
|
333
|
-
onFailed,
|
|
334
|
-
onNeedWalletDialog
|
|
335
|
-
}) {
|
|
336
|
-
const context = useContext(TaskOnContext);
|
|
337
|
-
const client = (context == null ? void 0 : context.client) ?? null;
|
|
338
|
-
const userInfo = (context == null ? void 0 : context.userInfo) ?? null;
|
|
339
|
-
const refreshUserInfo = context == null ? void 0 : context.refreshUserInfo;
|
|
340
|
-
const wallet = useWallet();
|
|
341
|
-
const { evmAdapter, connectEvm, signEvmMessage } = wallet;
|
|
342
|
-
const { isDapp, getEthereumProvider } = useInjectedProvider();
|
|
343
|
-
const isMobile = useIsMobile();
|
|
344
|
-
const [isBinding, setIsBinding] = useState(false);
|
|
345
|
-
const bindWaitResolveRef = useRef(null);
|
|
346
|
-
const userApi = useMemo(() => {
|
|
347
|
-
if (!client) return null;
|
|
348
|
-
return createUserApi(client);
|
|
349
|
-
}, [client]);
|
|
350
|
-
const hasAdapter = useMemo(() => {
|
|
351
|
-
if (chainType !== ChainType.evm) return false;
|
|
352
|
-
return evmAdapter !== null;
|
|
353
|
-
}, [chainType, evmAdapter]);
|
|
354
|
-
const isBound = useMemo(() => {
|
|
355
|
-
if (!chainType || !(userInfo == null ? void 0 : userInfo.address)) return false;
|
|
356
|
-
return userInfo.address.some((item) => item.chain_type === chainType);
|
|
357
|
-
}, [chainType, userInfo]);
|
|
358
|
-
const handleSuccess = useCallback(async () => {
|
|
359
|
-
var _a;
|
|
360
|
-
await (onSuccess == null ? void 0 : onSuccess());
|
|
361
|
-
(_a = bindWaitResolveRef.current) == null ? void 0 : _a.call(bindWaitResolveRef, true);
|
|
362
|
-
bindWaitResolveRef.current = null;
|
|
363
|
-
}, [onSuccess]);
|
|
364
|
-
const handleFailed = useCallback((error) => {
|
|
365
|
-
var _a;
|
|
366
|
-
onFailed == null ? void 0 : onFailed(error);
|
|
367
|
-
(_a = bindWaitResolveRef.current) == null ? void 0 : _a.call(bindWaitResolveRef, false);
|
|
368
|
-
bindWaitResolveRef.current = null;
|
|
369
|
-
}, [onFailed]);
|
|
370
|
-
const connectAndSignWithInjected = useCallback(
|
|
371
|
-
async (nonce) => {
|
|
372
|
-
const provider = getEthereumProvider();
|
|
373
|
-
if (!provider) return null;
|
|
374
|
-
try {
|
|
375
|
-
const accounts = await provider.request({
|
|
376
|
-
method: "eth_requestAccounts"
|
|
377
|
-
});
|
|
378
|
-
const address = accounts[0];
|
|
379
|
-
if (!address) return null;
|
|
380
|
-
const message = getBindSignText(address, nonce);
|
|
381
|
-
const signature = await provider.request({
|
|
382
|
-
method: "personal_sign",
|
|
383
|
-
params: [message, address]
|
|
384
|
-
});
|
|
385
|
-
return { address, signature };
|
|
386
|
-
} catch {
|
|
387
|
-
return null;
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
[getEthereumProvider]
|
|
391
|
-
);
|
|
392
|
-
const bindWithAdapter = useCallback(async () => {
|
|
393
|
-
var _a, _b;
|
|
394
|
-
if (!userApi) {
|
|
395
|
-
handleFailed("User API not initialized");
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
setIsBinding(true);
|
|
399
|
-
try {
|
|
400
|
-
const address = await connectEvm();
|
|
401
|
-
if (!address) {
|
|
402
|
-
handleFailed("Failed to connect wallet");
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
const nonce = await userApi.requestChallenge("AddressBind");
|
|
406
|
-
const message = getBindSignText(address, nonce);
|
|
407
|
-
const signature = await signEvmMessage(message);
|
|
408
|
-
if (!signature) {
|
|
409
|
-
handleFailed("Signature cancelled");
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
const bindResult = await userApi.bindAddress({
|
|
413
|
-
address,
|
|
414
|
-
nonce,
|
|
415
|
-
sig: signature,
|
|
416
|
-
chain_type: ChainType.evm
|
|
417
|
-
});
|
|
418
|
-
if (bindResult.result) {
|
|
419
|
-
await (refreshUserInfo == null ? void 0 : refreshUserInfo());
|
|
420
|
-
await handleSuccess();
|
|
421
|
-
} else {
|
|
422
|
-
handleFailed("This wallet address is already bound to another account");
|
|
423
|
-
}
|
|
424
|
-
} catch (e) {
|
|
425
|
-
const error = e;
|
|
426
|
-
if (((_a = error.message) == null ? void 0 : _a.includes("rejected")) || ((_b = error.message) == null ? void 0 : _b.includes("denied"))) {
|
|
427
|
-
handleFailed("User rejected the request");
|
|
428
|
-
} else {
|
|
429
|
-
handleFailed(error.message || "Failed to bind wallet");
|
|
430
|
-
}
|
|
431
|
-
} finally {
|
|
432
|
-
setIsBinding(false);
|
|
433
|
-
}
|
|
434
|
-
}, [userApi, connectEvm, signEvmMessage, refreshUserInfo, handleSuccess, handleFailed]);
|
|
435
|
-
const bindIfNeed = useCallback(async (targetChainType) => {
|
|
436
|
-
var _a, _b;
|
|
437
|
-
const effectiveChainType = targetChainType || chainType;
|
|
438
|
-
if (effectiveChainType && (userInfo == null ? void 0 : userInfo.address)) {
|
|
439
|
-
const alreadyBound = userInfo.address.some((item) => item.chain_type === effectiveChainType);
|
|
440
|
-
if (alreadyBound) {
|
|
441
|
-
await handleSuccess();
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (!effectiveChainType) {
|
|
446
|
-
await handleSuccess();
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
if (effectiveChainType !== ChainType.evm) {
|
|
450
|
-
handleFailed(`Chain type "${effectiveChainType}" is not supported yet`);
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
if (!context || !userApi) {
|
|
454
|
-
await handleSuccess();
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
const effectiveHasAdapter = effectiveChainType === ChainType.evm && evmAdapter !== null;
|
|
458
|
-
if (!isMobile) {
|
|
459
|
-
if (effectiveHasAdapter) {
|
|
460
|
-
await bindWithAdapter();
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
onNeedWalletDialog == null ? void 0 : onNeedWalletDialog();
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
if (!isDapp) {
|
|
467
|
-
onNeedWalletDialog == null ? void 0 : onNeedWalletDialog();
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
setIsBinding(true);
|
|
471
|
-
try {
|
|
472
|
-
const nonce = await userApi.requestChallenge("AddressBind");
|
|
473
|
-
const result = await connectAndSignWithInjected(nonce);
|
|
474
|
-
if (!result) {
|
|
475
|
-
handleFailed("Failed to connect wallet");
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
const { address, signature } = result;
|
|
479
|
-
const bindResult = await userApi.bindAddress({
|
|
480
|
-
address,
|
|
481
|
-
nonce,
|
|
482
|
-
sig: signature,
|
|
483
|
-
chain_type: ChainType.evm
|
|
484
|
-
});
|
|
485
|
-
if (bindResult.result) {
|
|
486
|
-
await (refreshUserInfo == null ? void 0 : refreshUserInfo());
|
|
487
|
-
await handleSuccess();
|
|
488
|
-
} else {
|
|
489
|
-
handleFailed("This wallet address is already bound to another account");
|
|
490
|
-
}
|
|
491
|
-
} catch (e) {
|
|
492
|
-
const error = e;
|
|
493
|
-
if (((_a = error.message) == null ? void 0 : _a.includes("rejected")) || ((_b = error.message) == null ? void 0 : _b.includes("denied"))) {
|
|
494
|
-
handleFailed("User rejected the request");
|
|
495
|
-
} else {
|
|
496
|
-
handleFailed(error.message || "Failed to bind wallet");
|
|
497
|
-
}
|
|
498
|
-
} finally {
|
|
499
|
-
setIsBinding(false);
|
|
500
|
-
}
|
|
501
|
-
}, [
|
|
502
|
-
chainType,
|
|
503
|
-
userInfo,
|
|
504
|
-
evmAdapter,
|
|
505
|
-
isMobile,
|
|
506
|
-
isDapp,
|
|
507
|
-
context,
|
|
508
|
-
userApi,
|
|
509
|
-
bindWithAdapter,
|
|
510
|
-
connectAndSignWithInjected,
|
|
511
|
-
refreshUserInfo,
|
|
512
|
-
handleSuccess,
|
|
513
|
-
handleFailed,
|
|
514
|
-
onNeedWalletDialog
|
|
515
|
-
]);
|
|
516
|
-
const bindWithProvider = useCallback(async (address, provider) => {
|
|
517
|
-
var _a, _b;
|
|
518
|
-
if (!userApi) {
|
|
519
|
-
handleFailed("User API not initialized");
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
setIsBinding(true);
|
|
523
|
-
try {
|
|
524
|
-
const nonce = await userApi.requestChallenge("AddressBind");
|
|
525
|
-
const message = getBindSignText(address, nonce);
|
|
526
|
-
const signature = await provider.request({
|
|
527
|
-
method: "personal_sign",
|
|
528
|
-
params: [message, address]
|
|
529
|
-
});
|
|
530
|
-
if (!signature) {
|
|
531
|
-
handleFailed("Signature cancelled");
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
const bindResult = await userApi.bindAddress({
|
|
535
|
-
address,
|
|
536
|
-
nonce,
|
|
537
|
-
sig: signature,
|
|
538
|
-
chain_type: ChainType.evm
|
|
539
|
-
});
|
|
540
|
-
if (bindResult.result) {
|
|
541
|
-
await (refreshUserInfo == null ? void 0 : refreshUserInfo());
|
|
542
|
-
await handleSuccess();
|
|
543
|
-
} else {
|
|
544
|
-
handleFailed("This wallet address is already bound to another account");
|
|
545
|
-
}
|
|
546
|
-
} catch (e) {
|
|
547
|
-
const error = e;
|
|
548
|
-
if (((_a = error.message) == null ? void 0 : _a.includes("rejected")) || ((_b = error.message) == null ? void 0 : _b.includes("denied"))) {
|
|
549
|
-
handleFailed("User rejected the request");
|
|
550
|
-
} else {
|
|
551
|
-
handleFailed(error.message || "Failed to bind wallet");
|
|
552
|
-
}
|
|
553
|
-
} finally {
|
|
554
|
-
setIsBinding(false);
|
|
555
|
-
}
|
|
556
|
-
}, [userApi, refreshUserInfo, handleSuccess, handleFailed]);
|
|
557
|
-
const bindAndWait = useCallback(async (targetChainType) => {
|
|
558
|
-
const effectiveChainType = targetChainType || chainType;
|
|
559
|
-
if (effectiveChainType && (userInfo == null ? void 0 : userInfo.address)) {
|
|
560
|
-
const alreadyBound = userInfo.address.some((item) => item.chain_type === effectiveChainType);
|
|
561
|
-
if (alreadyBound) {
|
|
562
|
-
return true;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
if (!effectiveChainType) {
|
|
566
|
-
return true;
|
|
567
|
-
}
|
|
568
|
-
if (effectiveChainType !== ChainType.evm) {
|
|
569
|
-
return false;
|
|
570
|
-
}
|
|
571
|
-
if (!context || !userApi) {
|
|
572
|
-
return true;
|
|
573
|
-
}
|
|
574
|
-
const canHandleInternally = !isMobile && hasAdapter || isMobile && isDapp;
|
|
575
|
-
if (!canHandleInternally) {
|
|
576
|
-
onNeedWalletDialog == null ? void 0 : onNeedWalletDialog();
|
|
577
|
-
return false;
|
|
578
|
-
}
|
|
579
|
-
return new Promise((resolve) => {
|
|
580
|
-
bindWaitResolveRef.current = resolve;
|
|
581
|
-
bindIfNeed();
|
|
582
|
-
});
|
|
583
|
-
}, [chainType, userInfo, context, userApi, isMobile, hasAdapter, isDapp, onNeedWalletDialog, bindIfNeed]);
|
|
584
|
-
return {
|
|
585
|
-
bindIfNeed,
|
|
586
|
-
bindAndWait,
|
|
587
|
-
bindWithProvider,
|
|
588
|
-
isBinding,
|
|
589
|
-
isBound,
|
|
590
|
-
hasAdapter
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
function isNftRewardType(type) {
|
|
594
|
-
return type === RewardType.Nft || type === RewardType.BMintedNft || type === RewardType.Cap;
|
|
595
|
-
}
|
|
596
|
-
function buildFallbackLayer(reward2) {
|
|
597
|
-
return {
|
|
598
|
-
winner_index: 0,
|
|
599
|
-
layer_no: 0,
|
|
600
|
-
reward: [reward2]
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
function useNftClaimFlow(options) {
|
|
604
|
-
const {
|
|
605
|
-
campaignId,
|
|
606
|
-
targetType,
|
|
607
|
-
onClaimSuccess,
|
|
608
|
-
onClaimError,
|
|
609
|
-
onWalletError,
|
|
610
|
-
messages
|
|
611
|
-
} = options;
|
|
612
|
-
const { toast } = useToast();
|
|
613
|
-
const { chainMap } = useChainMap();
|
|
614
|
-
const [isClaimDialogOpen, setIsClaimDialogOpen] = useState(false);
|
|
615
|
-
const [isWalletDialogOpen, setIsWalletDialogOpen] = useState(false);
|
|
616
|
-
const [isPendingDialogOpen, setIsPendingDialogOpen] = useState(false);
|
|
617
|
-
const [pendingTxDialogState, setPendingTxDialogState] = useState(null);
|
|
618
|
-
const [pendingWalletClaimTarget, setPendingWalletClaimTarget] = useState(null);
|
|
619
|
-
const pendingDecisionResolverRef = useRef(null);
|
|
620
|
-
const resolvePendingDecision = useCallback((claimAgain) => {
|
|
621
|
-
const resolver = pendingDecisionResolverRef.current;
|
|
622
|
-
if (resolver) {
|
|
623
|
-
pendingDecisionResolverRef.current = null;
|
|
624
|
-
resolver(claimAgain);
|
|
625
|
-
}
|
|
626
|
-
}, []);
|
|
627
|
-
useEffect(() => {
|
|
628
|
-
return () => {
|
|
629
|
-
resolvePendingDecision(false);
|
|
630
|
-
};
|
|
631
|
-
}, [resolvePendingDecision]);
|
|
632
|
-
const {
|
|
633
|
-
status: claimStatus,
|
|
634
|
-
error: claimError,
|
|
635
|
-
txHash: claimTxHash,
|
|
636
|
-
claimingNft,
|
|
637
|
-
claimNft,
|
|
638
|
-
reset: resetClaim
|
|
639
|
-
} = useNftClaim({
|
|
640
|
-
onSuccess: (txHash, item) => {
|
|
641
|
-
void (onClaimSuccess == null ? void 0 : onClaimSuccess(txHash, item.sourceReward, item.sourceLayer));
|
|
642
|
-
},
|
|
643
|
-
onError: (error, item) => {
|
|
644
|
-
void (onClaimError == null ? void 0 : onClaimError(error, item.sourceReward, item.sourceLayer));
|
|
645
|
-
},
|
|
646
|
-
onPendingFound: async (pendingKey, txHash, chainName, item) => {
|
|
647
|
-
const rewardValue = item.reward_value;
|
|
648
|
-
const receiveAddress = typeof rewardValue.receiver_address === "string" ? rewardValue.receiver_address : void 0;
|
|
649
|
-
resolvePendingDecision(false);
|
|
650
|
-
setIsClaimDialogOpen(false);
|
|
651
|
-
setPendingTxDialogState({
|
|
652
|
-
pendingKey,
|
|
653
|
-
txHash,
|
|
654
|
-
chainName,
|
|
655
|
-
receiveAddress
|
|
656
|
-
});
|
|
657
|
-
setIsPendingDialogOpen(true);
|
|
658
|
-
return new Promise((resolve) => {
|
|
659
|
-
pendingDecisionResolverRef.current = resolve;
|
|
660
|
-
});
|
|
661
|
-
},
|
|
662
|
-
onNeedWalletDialog: () => {
|
|
663
|
-
setIsClaimDialogOpen(false);
|
|
664
|
-
setIsWalletDialogOpen(true);
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
const claimExplorerUrl = useMemo(() => {
|
|
668
|
-
if (!claimTxHash || !claimingNft) {
|
|
669
|
-
return void 0;
|
|
670
|
-
}
|
|
671
|
-
const chainInfo = chainMap[claimingNft.chainName.toLowerCase()];
|
|
672
|
-
if (!chainInfo) {
|
|
673
|
-
return void 0;
|
|
674
|
-
}
|
|
675
|
-
return getTxExplorerUrl(chainInfo, claimTxHash);
|
|
676
|
-
}, [claimTxHash, claimingNft, chainMap]);
|
|
677
|
-
const pendingExplorerUrl = useMemo(() => {
|
|
678
|
-
if (!(pendingTxDialogState == null ? void 0 : pendingTxDialogState.txHash)) {
|
|
679
|
-
return void 0;
|
|
680
|
-
}
|
|
681
|
-
const chainInfo = chainMap[pendingTxDialogState.chainName.toLowerCase()];
|
|
682
|
-
if (!chainInfo) {
|
|
683
|
-
return void 0;
|
|
684
|
-
}
|
|
685
|
-
return getTxExplorerUrl(chainInfo, pendingTxDialogState.txHash);
|
|
686
|
-
}, [pendingTxDialogState, chainMap]);
|
|
687
|
-
const claimNftReward = useCallback(
|
|
688
|
-
async (reward2, layer) => {
|
|
689
|
-
if (!isNftRewardType(reward2.reward_type)) {
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
const targetLayer = layer ?? buildFallbackLayer(reward2);
|
|
693
|
-
const target = {
|
|
694
|
-
campaign_id: campaignId,
|
|
695
|
-
target_type: targetType,
|
|
696
|
-
reward_type: reward2.reward_type,
|
|
697
|
-
reward_value: reward2.reward_value,
|
|
698
|
-
reward_id: reward2.reward_id,
|
|
699
|
-
sourceReward: reward2,
|
|
700
|
-
sourceLayer: targetLayer
|
|
701
|
-
};
|
|
702
|
-
setPendingWalletClaimTarget(target);
|
|
703
|
-
setIsClaimDialogOpen(true);
|
|
704
|
-
await claimNft(target);
|
|
705
|
-
},
|
|
706
|
-
[campaignId, targetType, claimNft]
|
|
707
|
-
);
|
|
708
|
-
const isSupportedNftRewardType = useCallback((rewardType) => {
|
|
709
|
-
return isNftRewardType(rewardType);
|
|
710
|
-
}, []);
|
|
711
|
-
const handleWalletConnect = useCallback(
|
|
712
|
-
async (address, provider) => {
|
|
713
|
-
const target = pendingWalletClaimTarget ?? (claimingNft == null ? void 0 : claimingNft.item);
|
|
714
|
-
if (!target) {
|
|
715
|
-
throw new Error("No pending NFT claim target found");
|
|
716
|
-
}
|
|
717
|
-
if (!provider || typeof provider.request !== "function") {
|
|
718
|
-
throw new Error("Invalid wallet provider");
|
|
719
|
-
}
|
|
720
|
-
const popupAdapter = createEthereumAdapterFromProvider(
|
|
721
|
-
provider,
|
|
722
|
-
{
|
|
723
|
-
address
|
|
724
|
-
}
|
|
725
|
-
);
|
|
726
|
-
setIsWalletDialogOpen(false);
|
|
727
|
-
setIsClaimDialogOpen(true);
|
|
728
|
-
await claimNft(target, popupAdapter);
|
|
729
|
-
},
|
|
730
|
-
[pendingWalletClaimTarget, claimingNft, claimNft]
|
|
731
|
-
);
|
|
732
|
-
const handleWalletError = useCallback(
|
|
733
|
-
(errorMessage) => {
|
|
734
|
-
onWalletError == null ? void 0 : onWalletError(errorMessage);
|
|
735
|
-
if (!onWalletError) {
|
|
736
|
-
toast.error(errorMessage);
|
|
737
|
-
}
|
|
738
|
-
},
|
|
739
|
-
[onWalletError, toast]
|
|
740
|
-
);
|
|
741
|
-
const handlePendingContinueWaiting = useCallback(() => {
|
|
742
|
-
setIsPendingDialogOpen(false);
|
|
743
|
-
setPendingTxDialogState(null);
|
|
744
|
-
setPendingWalletClaimTarget(null);
|
|
745
|
-
resetClaim();
|
|
746
|
-
resolvePendingDecision(false);
|
|
747
|
-
}, [resetClaim, resolvePendingDecision]);
|
|
748
|
-
const handlePendingClaimAgain = useCallback(() => {
|
|
749
|
-
setIsPendingDialogOpen(false);
|
|
750
|
-
setPendingTxDialogState(null);
|
|
751
|
-
setIsClaimDialogOpen(true);
|
|
752
|
-
resolvePendingDecision(true);
|
|
753
|
-
}, [resolvePendingDecision]);
|
|
754
|
-
const handleCloseClaimDialog = useCallback(() => {
|
|
755
|
-
setIsClaimDialogOpen(false);
|
|
756
|
-
setTimeout(() => {
|
|
757
|
-
resetClaim();
|
|
758
|
-
setPendingWalletClaimTarget(null);
|
|
759
|
-
}, 200);
|
|
760
|
-
}, [resetClaim]);
|
|
761
|
-
const handleRetryClaim = useCallback(() => {
|
|
762
|
-
if (!claimingNft) {
|
|
763
|
-
return;
|
|
764
|
-
}
|
|
765
|
-
resetClaim();
|
|
766
|
-
setPendingWalletClaimTarget(claimingNft.item);
|
|
767
|
-
void claimNft(claimingNft.item);
|
|
768
|
-
}, [claimingNft, resetClaim, claimNft]);
|
|
769
|
-
const isClaiming = useMemo(() => {
|
|
770
|
-
return ["checking", "connecting", "switching", "signing", "confirming", "pending"].includes(
|
|
771
|
-
claimStatus
|
|
772
|
-
);
|
|
773
|
-
}, [claimStatus]);
|
|
774
|
-
const dialogs = useMemo(() => {
|
|
775
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
776
|
-
/* @__PURE__ */ jsx(
|
|
777
|
-
ClaimNftDialog,
|
|
778
|
-
{
|
|
779
|
-
open: isClaimDialogOpen,
|
|
780
|
-
onClose: handleCloseClaimDialog,
|
|
781
|
-
status: claimStatus,
|
|
782
|
-
error: claimError,
|
|
783
|
-
txHash: claimTxHash,
|
|
784
|
-
claimingNft,
|
|
785
|
-
explorerUrl: claimExplorerUrl,
|
|
786
|
-
messages: messages == null ? void 0 : messages.claimDialog,
|
|
787
|
-
onRetry: handleRetryClaim
|
|
788
|
-
}
|
|
789
|
-
),
|
|
429
|
+
[onChange]
|
|
430
|
+
);
|
|
431
|
+
const shouldShowCount = showCount && maxLength !== void 0;
|
|
432
|
+
return /* @__PURE__ */ jsxs("div", { className: "taskon-textarea-wrap", children: [
|
|
790
433
|
/* @__PURE__ */ jsx(
|
|
791
|
-
|
|
434
|
+
"textarea",
|
|
792
435
|
{
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
436
|
+
ref: textareaRef,
|
|
437
|
+
className: `taskon-textarea ${hasError ? "taskon-textarea--error" : ""} ${className || ""}`,
|
|
438
|
+
value: value2,
|
|
439
|
+
onChange: handleChange,
|
|
440
|
+
maxLength,
|
|
441
|
+
disabled,
|
|
442
|
+
placeholder,
|
|
443
|
+
rows
|
|
801
444
|
}
|
|
802
445
|
),
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
|
|
805
|
-
{
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}
|
|
811
|
-
)
|
|
446
|
+
shouldShowCount && /* @__PURE__ */ jsxs("div", { className: "taskon-textarea-count", children: [
|
|
447
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-textarea-count-current", children: value2.length }),
|
|
448
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
449
|
+
"/",
|
|
450
|
+
maxLength
|
|
451
|
+
] })
|
|
452
|
+
] })
|
|
812
453
|
] });
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
handleCloseClaimDialog,
|
|
816
|
-
claimStatus,
|
|
817
|
-
claimError,
|
|
818
|
-
claimTxHash,
|
|
819
|
-
claimingNft,
|
|
820
|
-
claimExplorerUrl,
|
|
821
|
-
messages,
|
|
822
|
-
handleRetryClaim,
|
|
823
|
-
isPendingDialogOpen,
|
|
824
|
-
handlePendingContinueWaiting,
|
|
825
|
-
handlePendingClaimAgain,
|
|
826
|
-
pendingTxDialogState,
|
|
827
|
-
pendingExplorerUrl,
|
|
828
|
-
isWalletDialogOpen,
|
|
829
|
-
handleWalletConnect,
|
|
830
|
-
handleWalletError
|
|
831
|
-
]);
|
|
832
|
-
return {
|
|
833
|
-
claimNftReward,
|
|
834
|
-
isSupportedNftRewardType,
|
|
835
|
-
dialogs,
|
|
836
|
-
claimingNft,
|
|
837
|
-
isClaiming
|
|
838
|
-
};
|
|
839
|
-
}
|
|
454
|
+
}
|
|
455
|
+
);
|
|
840
456
|
async function copyToClipboard(text2) {
|
|
841
457
|
try {
|
|
842
458
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
@@ -2146,6 +1762,232 @@ function CardDescExpress({
|
|
|
2146
1762
|
}
|
|
2147
1763
|
);
|
|
2148
1764
|
}
|
|
1765
|
+
const DEFAULT_CLAIM_DIALOG_MESSAGES = {
|
|
1766
|
+
claimNft: enMessages$2.claim_nft,
|
|
1767
|
+
claimingNft: enMessages$2.claiming_nft,
|
|
1768
|
+
claimConnectingWallet: enMessages$2.claim_connecting_wallet,
|
|
1769
|
+
claimSwitchingNetwork: enMessages$2.claim_switching_network,
|
|
1770
|
+
claimGettingSignature: enMessages$2.claim_getting_signature,
|
|
1771
|
+
claimConfirmInWallet: enMessages$2.claim_confirm_in_wallet,
|
|
1772
|
+
claimTransactionPending: enMessages$2.claim_transaction_pending,
|
|
1773
|
+
claimSuccess: enMessages$2.claim_success,
|
|
1774
|
+
claimFailed: enMessages$2.claim_failed,
|
|
1775
|
+
claimCanceled: enMessages$2.claim_canceled,
|
|
1776
|
+
viewOnExplorer: enMessages$2.view_on_explorer,
|
|
1777
|
+
retry: enMessages$2.retry,
|
|
1778
|
+
close: enMessages$2.close
|
|
1779
|
+
};
|
|
1780
|
+
const DEFAULT_PENDING_DIALOG_MESSAGES = {
|
|
1781
|
+
pendingTransaction: enMessages$2.pending_transaction,
|
|
1782
|
+
claimPendingTitle: enMessages$2.claim_pending_title,
|
|
1783
|
+
claimPendingCheckExplorer: enMessages$2.claim_pending_check_explorer,
|
|
1784
|
+
claimPendingHashLabel: enMessages$2.claim_pending_hash_label,
|
|
1785
|
+
claimPendingClaimAgainWarn: enMessages$2.claim_pending_claim_again_warn,
|
|
1786
|
+
claimPendingReceiveAddressNoChange: enMessages$2.claim_pending_receive_address_no_change,
|
|
1787
|
+
claimAgain: enMessages$2.claim_again,
|
|
1788
|
+
continueWaiting: enMessages$2.continue_waiting
|
|
1789
|
+
};
|
|
1790
|
+
function isNftRewardType(type) {
|
|
1791
|
+
return type === RewardType.Nft || type === RewardType.BMintedNft || type === RewardType.Cap;
|
|
1792
|
+
}
|
|
1793
|
+
function buildFallbackLayer(reward2) {
|
|
1794
|
+
return {
|
|
1795
|
+
winner_index: 0,
|
|
1796
|
+
layer_no: 0,
|
|
1797
|
+
reward: [reward2]
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
function useNftClaimFlow(options) {
|
|
1801
|
+
const {
|
|
1802
|
+
campaignId,
|
|
1803
|
+
targetType,
|
|
1804
|
+
onClaimSuccess,
|
|
1805
|
+
onClaimError,
|
|
1806
|
+
messages
|
|
1807
|
+
} = options;
|
|
1808
|
+
const { chainMap } = useChainMap();
|
|
1809
|
+
const [isClaimDialogOpen, setIsClaimDialogOpen] = useState(false);
|
|
1810
|
+
const [isPendingDialogOpen, setIsPendingDialogOpen] = useState(false);
|
|
1811
|
+
const [pendingTxDialogState, setPendingTxDialogState] = useState(null);
|
|
1812
|
+
const pendingDecisionResolverRef = useRef(null);
|
|
1813
|
+
const resolvePendingDecision = useCallback((claimAgain) => {
|
|
1814
|
+
const resolver = pendingDecisionResolverRef.current;
|
|
1815
|
+
if (resolver) {
|
|
1816
|
+
pendingDecisionResolverRef.current = null;
|
|
1817
|
+
resolver(claimAgain);
|
|
1818
|
+
}
|
|
1819
|
+
}, []);
|
|
1820
|
+
useEffect(() => {
|
|
1821
|
+
return () => {
|
|
1822
|
+
resolvePendingDecision(false);
|
|
1823
|
+
};
|
|
1824
|
+
}, [resolvePendingDecision]);
|
|
1825
|
+
const {
|
|
1826
|
+
status: claimStatus,
|
|
1827
|
+
error: claimError,
|
|
1828
|
+
txHash: claimTxHash,
|
|
1829
|
+
claimingNft,
|
|
1830
|
+
claimNft,
|
|
1831
|
+
reset: resetClaim
|
|
1832
|
+
} = useNftClaim({
|
|
1833
|
+
onSuccess: (txHash, item) => {
|
|
1834
|
+
void (onClaimSuccess == null ? void 0 : onClaimSuccess(txHash, item.sourceReward, item.sourceLayer));
|
|
1835
|
+
},
|
|
1836
|
+
onError: (error, item) => {
|
|
1837
|
+
void (onClaimError == null ? void 0 : onClaimError(error, item.sourceReward, item.sourceLayer));
|
|
1838
|
+
},
|
|
1839
|
+
onPendingFound: async (pendingKey, txHash, chainName, item) => {
|
|
1840
|
+
const rewardValue = item.reward_value;
|
|
1841
|
+
const receiveAddress = typeof rewardValue.receiver_address === "string" ? rewardValue.receiver_address : void 0;
|
|
1842
|
+
resolvePendingDecision(false);
|
|
1843
|
+
setIsClaimDialogOpen(false);
|
|
1844
|
+
setPendingTxDialogState({
|
|
1845
|
+
pendingKey,
|
|
1846
|
+
txHash,
|
|
1847
|
+
chainName,
|
|
1848
|
+
receiveAddress
|
|
1849
|
+
});
|
|
1850
|
+
setIsPendingDialogOpen(true);
|
|
1851
|
+
return new Promise((resolve) => {
|
|
1852
|
+
pendingDecisionResolverRef.current = resolve;
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
const claimExplorerUrl = useMemo(() => {
|
|
1857
|
+
if (!claimTxHash || !claimingNft) {
|
|
1858
|
+
return void 0;
|
|
1859
|
+
}
|
|
1860
|
+
const chainInfo = chainMap[claimingNft.chainName.toLowerCase()];
|
|
1861
|
+
if (!chainInfo) {
|
|
1862
|
+
return void 0;
|
|
1863
|
+
}
|
|
1864
|
+
return getTxExplorerUrl(chainInfo, claimTxHash);
|
|
1865
|
+
}, [claimTxHash, claimingNft, chainMap]);
|
|
1866
|
+
const pendingExplorerUrl = useMemo(() => {
|
|
1867
|
+
if (!(pendingTxDialogState == null ? void 0 : pendingTxDialogState.txHash)) {
|
|
1868
|
+
return void 0;
|
|
1869
|
+
}
|
|
1870
|
+
const chainInfo = chainMap[pendingTxDialogState.chainName.toLowerCase()];
|
|
1871
|
+
if (!chainInfo) {
|
|
1872
|
+
return void 0;
|
|
1873
|
+
}
|
|
1874
|
+
return getTxExplorerUrl(chainInfo, pendingTxDialogState.txHash);
|
|
1875
|
+
}, [pendingTxDialogState, chainMap]);
|
|
1876
|
+
const claimNftReward = useCallback(
|
|
1877
|
+
async (reward2, layer) => {
|
|
1878
|
+
if (!isNftRewardType(reward2.reward_type)) {
|
|
1879
|
+
return;
|
|
1880
|
+
}
|
|
1881
|
+
const targetLayer = layer ?? buildFallbackLayer(reward2);
|
|
1882
|
+
const target = {
|
|
1883
|
+
campaign_id: campaignId,
|
|
1884
|
+
target_type: targetType,
|
|
1885
|
+
reward_type: reward2.reward_type,
|
|
1886
|
+
reward_value: reward2.reward_value,
|
|
1887
|
+
reward_id: reward2.reward_id,
|
|
1888
|
+
sourceReward: reward2,
|
|
1889
|
+
sourceLayer: targetLayer
|
|
1890
|
+
};
|
|
1891
|
+
setIsClaimDialogOpen(true);
|
|
1892
|
+
await claimNft(target);
|
|
1893
|
+
},
|
|
1894
|
+
[campaignId, targetType, claimNft]
|
|
1895
|
+
);
|
|
1896
|
+
const isSupportedNftRewardType = useCallback(
|
|
1897
|
+
(rewardType) => {
|
|
1898
|
+
return isNftRewardType(rewardType);
|
|
1899
|
+
},
|
|
1900
|
+
[]
|
|
1901
|
+
);
|
|
1902
|
+
const handlePendingContinueWaiting = useCallback(() => {
|
|
1903
|
+
setIsPendingDialogOpen(false);
|
|
1904
|
+
setPendingTxDialogState(null);
|
|
1905
|
+
resetClaim();
|
|
1906
|
+
resolvePendingDecision(false);
|
|
1907
|
+
}, [resetClaim, resolvePendingDecision]);
|
|
1908
|
+
const handlePendingClaimAgain = useCallback(() => {
|
|
1909
|
+
setIsPendingDialogOpen(false);
|
|
1910
|
+
setPendingTxDialogState(null);
|
|
1911
|
+
setIsClaimDialogOpen(true);
|
|
1912
|
+
resolvePendingDecision(true);
|
|
1913
|
+
}, [resolvePendingDecision]);
|
|
1914
|
+
const handleCloseClaimDialog = useCallback(() => {
|
|
1915
|
+
setIsClaimDialogOpen(false);
|
|
1916
|
+
setTimeout(() => {
|
|
1917
|
+
resetClaim();
|
|
1918
|
+
}, 200);
|
|
1919
|
+
}, [resetClaim]);
|
|
1920
|
+
const handleRetryClaim = useCallback(() => {
|
|
1921
|
+
if (!claimingNft) {
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
resetClaim();
|
|
1925
|
+
void claimNft(claimingNft.item);
|
|
1926
|
+
}, [claimingNft, resetClaim, claimNft]);
|
|
1927
|
+
const isClaiming = useMemo(() => {
|
|
1928
|
+
return [
|
|
1929
|
+
"checking",
|
|
1930
|
+
"connecting",
|
|
1931
|
+
"switching",
|
|
1932
|
+
"signing",
|
|
1933
|
+
"confirming",
|
|
1934
|
+
"pending"
|
|
1935
|
+
].includes(claimStatus);
|
|
1936
|
+
}, [claimStatus]);
|
|
1937
|
+
const dialogs = useMemo(() => {
|
|
1938
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1939
|
+
/* @__PURE__ */ jsx(
|
|
1940
|
+
ClaimNftDialog,
|
|
1941
|
+
{
|
|
1942
|
+
open: isClaimDialogOpen,
|
|
1943
|
+
onClose: handleCloseClaimDialog,
|
|
1944
|
+
status: claimStatus,
|
|
1945
|
+
error: claimError,
|
|
1946
|
+
txHash: claimTxHash,
|
|
1947
|
+
claimingNft,
|
|
1948
|
+
explorerUrl: claimExplorerUrl,
|
|
1949
|
+
messages: (messages == null ? void 0 : messages.claimDialog) ?? DEFAULT_CLAIM_DIALOG_MESSAGES,
|
|
1950
|
+
onRetry: handleRetryClaim
|
|
1951
|
+
}
|
|
1952
|
+
),
|
|
1953
|
+
/* @__PURE__ */ jsx(
|
|
1954
|
+
PendingTxDialog,
|
|
1955
|
+
{
|
|
1956
|
+
open: isPendingDialogOpen,
|
|
1957
|
+
onClose: handlePendingContinueWaiting,
|
|
1958
|
+
onClaimAgain: handlePendingClaimAgain,
|
|
1959
|
+
onContinueWaiting: handlePendingContinueWaiting,
|
|
1960
|
+
txHash: pendingTxDialogState == null ? void 0 : pendingTxDialogState.txHash,
|
|
1961
|
+
explorerUrl: pendingExplorerUrl,
|
|
1962
|
+
receiveAddress: pendingTxDialogState == null ? void 0 : pendingTxDialogState.receiveAddress,
|
|
1963
|
+
messages: (messages == null ? void 0 : messages.pendingDialog) ?? DEFAULT_PENDING_DIALOG_MESSAGES
|
|
1964
|
+
}
|
|
1965
|
+
)
|
|
1966
|
+
] });
|
|
1967
|
+
}, [
|
|
1968
|
+
isClaimDialogOpen,
|
|
1969
|
+
handleCloseClaimDialog,
|
|
1970
|
+
claimStatus,
|
|
1971
|
+
claimError,
|
|
1972
|
+
claimTxHash,
|
|
1973
|
+
claimingNft,
|
|
1974
|
+
claimExplorerUrl,
|
|
1975
|
+
messages,
|
|
1976
|
+
handleRetryClaim,
|
|
1977
|
+
isPendingDialogOpen,
|
|
1978
|
+
handlePendingContinueWaiting,
|
|
1979
|
+
handlePendingClaimAgain,
|
|
1980
|
+
pendingTxDialogState,
|
|
1981
|
+
pendingExplorerUrl
|
|
1982
|
+
]);
|
|
1983
|
+
return {
|
|
1984
|
+
claimNftReward,
|
|
1985
|
+
isSupportedNftRewardType,
|
|
1986
|
+
dialogs,
|
|
1987
|
+
claimingNft,
|
|
1988
|
+
isClaiming
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
2149
1991
|
const twitterIconUrl = new URL("data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='25'%20cy='25'%20r='25'%20fill='%2358AFFF'/%3e%3cpath%20d='M36%2018.9643C35.5742%2019.75%2034.8645%2020.5357%2033.871%2021.0595V21.5833C33.871%2028.131%2028.0516%2033.5%2020.9548%2033.5C18.5419%2033.5%2016.129%2032.8452%2014%2031.6667C14.4258%2031.6667%2014.7097%2031.7976%2015.1355%2031.6667C17.2645%2031.6667%2019.2516%2031.0119%2020.8129%2029.8333C18.8258%2029.8333%2017.1226%2028.6548%2016.5548%2026.9524C16.8387%2026.9524%2017.1226%2027.0833%2017.4065%2027.0833C17.8323%2027.0833%2018.2581%2027.0833%2018.5419%2026.9524C16.4129%2026.5595%2014.8516%2024.8571%2014.8516%2022.8929C15.4194%2023.1548%2016.129%2023.4167%2016.8387%2023.4167C15.7032%2022.631%2014.9935%2021.3214%2014.9935%2019.881C14.9935%2019.0952%2015.2774%2018.4405%2015.5613%2017.7857C17.8323%2020.4048%2021.2387%2021.9762%2024.929%2022.1071C24.7871%2021.8452%2024.7871%2021.4524%2024.7871%2021.1905C24.7871%2018.8333%2026.7742%2017%2029.329%2017C30.6065%2017%2031.7419%2017.5238%2032.5935%2018.3095C33.5871%2018.1786%2034.5806%2017.7857%2035.4323%2017.2619C35.1484%2018.1786%2034.4387%2019.0952%2033.4452%2019.619C34.2968%2019.4881%2035.2903%2019.2262%2036%2018.9643Z'%20fill='black'/%3e%3c/svg%3e", import.meta.url).href;
|
|
2150
1992
|
const retweetIconUrl = new URL("data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='25'%20cy='25'%20r='25'%20fill='%2358AFFF'/%3e%3cpath%20d='M27.6047%2016C27.1048%2016%2026.605%2016.3999%2026.605%2017.2296V20.3986L26.0401%2020.4286C23.5018%2020.5001%2021.0516%2021.3751%2019.0423%2022.9279C16.5081%2024.9972%2014.4787%2028.4562%2014.0088%2032.9098C13.9745%2033.1614%2014.0408%2033.4165%2014.1934%2033.6195C14.3459%2033.8226%2014.5724%2033.9573%2014.8236%2033.9945C14.8666%2034.0015%2014.9105%2034.0015%2014.9536%2033.9945C15.1097%2033.9982%2015.2638%2033.9587%2015.3988%2033.8801C15.5338%2033.8016%2015.6444%2033.6872%2015.7183%2033.5496C18.1526%2030.0507%2023.356%2029.4958%2025.9102%2029.4958H26.61V32.8898C26.6025%2033.0314%2026.6239%2033.173%2026.6726%2033.3061C26.7214%2033.4392%2026.7967%2033.561%2026.8938%2033.6642C26.991%2033.7674%2027.108%2033.8499%2027.2379%2033.9067C27.3678%2033.9634%2027.5079%2033.9933%2027.6496%2033.9945C27.803%2033.9913%2027.9541%2033.9574%2028.0941%2033.8947C28.234%2033.832%2028.36%2033.7419%2028.4644%2033.6296L35.3173%2026.3868C36.197%2025.4721%2036.242%2024.5224%2035.3623%2023.6077L28.3294%2016.3149C28.2364%2016.2159%2028.1241%2016.1369%2027.9995%2016.0828C27.8749%2016.0287%2027.7405%2016.0005%2027.6047%2016Z'%20fill='black'/%3e%3c/svg%3e", import.meta.url).href;
|
|
2151
1993
|
const discordIconUrl = new URL("data:image/svg+xml,%3csvg%20width='50'%20height='50'%20viewBox='0%200%2050%2050'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='25'%20cy='25'%20r='25'%20fill='%236671FF'/%3e%3cpath%20d='M33.2655%2018.9902C30.7797%2017.2501%2028.4181%2017.1258%2028.0452%2017.1258L27.7966%2017.3744C30.6554%2018.1202%2032.2712%2019.4874%2032.3955%2019.6117C27.9209%2017.3744%2022.9492%2017.2501%2018.4746%2018.9902C17.8531%2019.2388%2017.4802%2019.4874%2017.3559%2019.4874C17.6045%2019.3631%2019.096%2017.9959%2022.2034%2017.2501L21.9548%2017.0015C21.9548%2017.0015%2019.4689%2016.8772%2016.7345%2018.8659C16.7345%2018.8659%2014%2023.4648%2014%2029.3066C14%2029.3066%2015.6158%2031.9168%2019.7175%2032.0411C19.7175%2032.0411%2020.339%2031.2953%2020.9605%2030.5496C18.8475%2029.9281%2017.8531%2028.5609%2017.7288%2028.4366L18.4746%2028.8095C20.7119%2029.6795%2023.0734%2030.9225%2027.4237%2030.1767C28.2938%2030.0524%2029.2881%2029.8038%2030.1582%2029.4309C30.7797%2029.058%2031.5254%2028.8095%2032.2712%2028.3123C32.1469%2028.4366%2031.1525%2029.8038%2028.9153%2030.4253C29.4124%2031.171%2030.1582%2031.9168%2030.1582%2031.9168C34.3842%2031.7925%2036%2029.1823%2036%2029.4309C36%2023.7134%2033.2655%2018.9902%2033.2655%2018.9902ZM21.5819%2027.4422C20.5876%2027.4422%2019.7175%2026.5722%2019.7175%2025.4535C19.7175%2024.3349%2020.5876%2023.4648%2021.5819%2023.4648C22.5763%2023.4648%2023.4463%2024.4592%2023.4463%2025.4535C23.4463%2026.5722%2022.5763%2027.4422%2021.5819%2027.4422ZM28.4181%2027.4422C27.4237%2027.4422%2026.5537%2026.5722%2026.5537%2025.4535C26.5537%2024.3349%2027.4237%2023.4648%2028.4181%2023.4648C29.5367%2023.4648%2030.4068%2024.4592%2030.4068%2025.4535C30.4068%2026.5722%2029.5367%2027.4422%2028.4181%2027.4422Z'%20fill='black'/%3e%3c/svg%3e", import.meta.url).href;
|
|
@@ -2263,8 +2105,8 @@ function formatTime$1(ms) {
|
|
|
2263
2105
|
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
2264
2106
|
const totalHours = Math.floor(totalMinutes / 60);
|
|
2265
2107
|
if (totalHours > 24) {
|
|
2266
|
-
const
|
|
2267
|
-
return `${
|
|
2108
|
+
const days = Math.ceil(ms / (1e3 * 60 * 60 * 24));
|
|
2109
|
+
return `${days} days`;
|
|
2268
2110
|
}
|
|
2269
2111
|
const hours = totalHours;
|
|
2270
2112
|
const minutes = totalMinutes % 60;
|
|
@@ -2346,7 +2188,7 @@ const submit_param_enter_label = "Enter {paramName}";
|
|
|
2346
2188
|
const submit_param_enter_placeholder = "Enter your {paramName}";
|
|
2347
2189
|
const cancel = "Cancel";
|
|
2348
2190
|
const confirm$1 = "Confirm";
|
|
2349
|
-
const completed = "Completed";
|
|
2191
|
+
const completed$1 = "Completed";
|
|
2350
2192
|
const interact_with_contract = "Interact With Contract";
|
|
2351
2193
|
const points$1 = "Points";
|
|
2352
2194
|
const proof_of_work = "Proof of Work";
|
|
@@ -2427,7 +2269,7 @@ const enMessages$1 = {
|
|
|
2427
2269
|
submit_param_enter_placeholder,
|
|
2428
2270
|
cancel,
|
|
2429
2271
|
confirm: confirm$1,
|
|
2430
|
-
completed,
|
|
2272
|
+
completed: completed$1,
|
|
2431
2273
|
interact_with_contract,
|
|
2432
2274
|
points: points$1,
|
|
2433
2275
|
proof_of_work,
|
|
@@ -2750,8 +2592,7 @@ function useTaskSubmit({
|
|
|
2750
2592
|
onSuccess,
|
|
2751
2593
|
onError,
|
|
2752
2594
|
onCampaignIneligibility,
|
|
2753
|
-
onVerifyFailedNotice
|
|
2754
|
-
onNeedWalletDialog
|
|
2595
|
+
onVerifyFailedNotice
|
|
2755
2596
|
}) {
|
|
2756
2597
|
const context = useContext(TaskOnContext);
|
|
2757
2598
|
const client = (context == null ? void 0 : context.client) ?? null;
|
|
@@ -2858,8 +2699,7 @@ ${notice.message}`, 1e4);
|
|
|
2858
2699
|
onFailed: (err) => {
|
|
2859
2700
|
setError(err);
|
|
2860
2701
|
onError == null ? void 0 : onError(err);
|
|
2861
|
-
}
|
|
2862
|
-
onNeedWalletDialog
|
|
2702
|
+
}
|
|
2863
2703
|
});
|
|
2864
2704
|
const isSnsBindingRequired = needsSnsBinding && !isSnsBound;
|
|
2865
2705
|
const isWalletBindingRequired = needsWalletBinding && !isWalletBound;
|
|
@@ -3172,7 +3012,6 @@ const VerifyButton = forwardRef(
|
|
|
3172
3012
|
onError,
|
|
3173
3013
|
className
|
|
3174
3014
|
}, ref) {
|
|
3175
|
-
const { toast } = useToast();
|
|
3176
3015
|
const { t } = useTaskWidgetLocale();
|
|
3177
3016
|
const [verifyFailedNotice, setVerifyFailedNotice] = useState(null);
|
|
3178
3017
|
const {
|
|
@@ -3235,7 +3074,12 @@ const VerifyButton = forwardRef(
|
|
|
3235
3074
|
);
|
|
3236
3075
|
const handleClick = async () => {
|
|
3237
3076
|
if (needLink && !isLinkClicked2) {
|
|
3238
|
-
|
|
3077
|
+
setVerifyFailedNotice({
|
|
3078
|
+
title: t("verify_failed_title"),
|
|
3079
|
+
message: t("please_view_link_before_verifying"),
|
|
3080
|
+
source: "verify_failed",
|
|
3081
|
+
platform
|
|
3082
|
+
});
|
|
3239
3083
|
return;
|
|
3240
3084
|
}
|
|
3241
3085
|
if (onBeforeVerify) {
|
|
@@ -5132,7 +4976,6 @@ const tasks_quest_verified_valid_some_tasks_may_verified_quest = "All the tasks
|
|
|
5132
4976
|
const available = "Available";
|
|
5133
4977
|
const awesome_already_meet_requirements = "Awesome! You already meet the requirements.";
|
|
5134
4978
|
const babt_holder = "BABT holder";
|
|
5135
|
-
const before_join_please_meet = "Before you join please meet";
|
|
5136
4979
|
const binance_account_bound_token_bab = "Binance Account Bound Token (BAB)";
|
|
5137
4980
|
const bind = "Bind";
|
|
5138
4981
|
const bind_required_accounts = "Bind Required Accounts";
|
|
@@ -5156,13 +4999,12 @@ const claiming_nft = "Claiming NFT...";
|
|
|
5156
4999
|
const close = "Close";
|
|
5157
5000
|
const complete_campaign = "Complete Campaign";
|
|
5158
5001
|
const complete_action_first = "Complete action first";
|
|
5159
|
-
const complete = "Complete all";
|
|
5160
5002
|
const complete_campaign_2 = "Complete the Campaign";
|
|
5161
5003
|
const complete_qualify_rewards = "Complete to qualify for rewards!";
|
|
5162
5004
|
const complete_milestone_name_first = "Complete {milestone_name} first";
|
|
5163
5005
|
const completing = "Completing...";
|
|
5164
5006
|
const congratulations = "Congratulations!";
|
|
5165
|
-
const
|
|
5007
|
+
const start_to_earn = "Start Earning";
|
|
5166
5008
|
const connecting_wallet = "Connecting wallet...";
|
|
5167
5009
|
const continue_waiting = "Continue Waiting";
|
|
5168
5010
|
const contract_address = "Contract Address";
|
|
@@ -5172,7 +5014,6 @@ const holder_own_least_one_token = "DID Holder(own at least one DID token)";
|
|
|
5172
5014
|
const discord = "Discord";
|
|
5173
5015
|
const discord_account_linked = "Discord Account Not Linked";
|
|
5174
5016
|
const discord_role = "Discord Role";
|
|
5175
|
-
const discord_role_2 = "Discord Role:";
|
|
5176
5017
|
const ens_domains_eth = "ENS Domains (.eth)";
|
|
5177
5018
|
const evm_chain = "EVM Chain";
|
|
5178
5019
|
const exp_winner = "EXP/Winner";
|
|
@@ -5201,7 +5042,6 @@ const leaderboard = "Leaderboard";
|
|
|
5201
5042
|
const limited_spots_gas_free_claiming = "Limited spots for gas free claiming!";
|
|
5202
5043
|
const link_wallet_address = "Link Wallet Address";
|
|
5203
5044
|
const link_copied = "Link copied!";
|
|
5204
|
-
const loading_quest = "Loading quest...";
|
|
5205
5045
|
const loading = "Loading...";
|
|
5206
5046
|
const lucky_draw = "Lucky Draw";
|
|
5207
5047
|
const manually_upload = "Manually Upload";
|
|
@@ -5218,7 +5058,6 @@ const no_participants = "No participants yet";
|
|
|
5218
5058
|
const no_winners = "No winners yet";
|
|
5219
5059
|
const qualified = "Not Qualified";
|
|
5220
5060
|
const tasks_successfully_verified_better_luck_next_time = "Not all tasks are successfully verified, better luck next time!";
|
|
5221
|
-
const sybil_database = "Not in Sybil database";
|
|
5222
5061
|
const included_public_sybil_address_database = "Not included in a public sybil address database.";
|
|
5223
5062
|
const ok = "OK";
|
|
5224
5063
|
const only = "ONLY";
|
|
@@ -5233,11 +5072,8 @@ const oops_seems_like_already_finished_quest_2 = "Oops! Seems like you already f
|
|
|
5233
5072
|
const oops_better_luck_next_time_2 = "Oops, Better Luck Next Time!";
|
|
5234
5073
|
const open_blind_box = "Open Blind Box";
|
|
5235
5074
|
const open = "Open to All";
|
|
5236
|
-
const own = "Own";
|
|
5237
|
-
const own_least = "Own at least";
|
|
5238
5075
|
const own_least_amount_token_name_chain_label = "Own at least {amount} {token_name} on {chain_label}";
|
|
5239
5076
|
const own_amount_name_nft_chain = "Own {amount} {name} NFT On {chain}";
|
|
5240
|
-
const participants = "Participants";
|
|
5241
5077
|
const participants_info = "Participants Info";
|
|
5242
5078
|
const participants_any_user_who_complete_least_1_task_quest = "Participants: any user who complete at least 1 task of this quest.";
|
|
5243
5079
|
const pending_transaction = "Pending Transaction";
|
|
@@ -5271,7 +5107,6 @@ const reward = "Reward";
|
|
|
5271
5107
|
const reward_amount_revealed_once_quest_ends = "Reward amount will be revealed once quest ends.";
|
|
5272
5108
|
const rewards = "Rewards";
|
|
5273
5109
|
const rewards_missed = "Rewards Missed";
|
|
5274
|
-
const role = "Role";
|
|
5275
5110
|
const save = "Save";
|
|
5276
5111
|
const share = "Share";
|
|
5277
5112
|
const share_qr_code = "Share QR Code";
|
|
@@ -5289,6 +5124,7 @@ const switching_network = "Switching network...";
|
|
|
5289
5124
|
const system_drawing_winners = "System is Drawing Winners...";
|
|
5290
5125
|
const system_automatically_select_winners = "System will automatically select winners in";
|
|
5291
5126
|
const task = "Task";
|
|
5127
|
+
const completed = "Completed";
|
|
5292
5128
|
const taskon_lv_level_higher = "TaskOn LV {level} or Higher";
|
|
5293
5129
|
const taskon_lv_val = "TaskOn LV {val}";
|
|
5294
5130
|
const taskon_poh_level_score_label = "Taskon POH Level {score_label}";
|
|
@@ -5353,19 +5189,14 @@ const estimated_rewards = "Your Estimated Rewards";
|
|
|
5353
5189
|
const final_rewards = "Your Final Rewards";
|
|
5354
5190
|
const ranking = "Your Ranking";
|
|
5355
5191
|
const complete_task = "Your did not complete task:";
|
|
5356
|
-
const own_discord_role = "Your do not own a Discord Role";
|
|
5357
5192
|
const own_discord_role_community = "Your do not own a Discord Role {role} in {community}";
|
|
5358
5193
|
const completed_task = "Your have completed task:";
|
|
5359
|
-
const own_discord_role_2 = "Your own a Discord Role";
|
|
5360
5194
|
const own_discord_role_community_2 = "Your own a Discord Role {role} in {community}";
|
|
5361
5195
|
const name_lv_lt_count = "Your {name} Lv is ≥/< {count}";
|
|
5362
5196
|
const val_wallet_address_allowlist = "Your {val} wallet address is in the allowlist";
|
|
5363
5197
|
const zkme_citizenship_nft_holder = "ZKMe Citizenship NFT holder";
|
|
5364
|
-
const after = "after";
|
|
5365
|
-
const tasks_reviewed = "all tasks have been reviewed.";
|
|
5366
5198
|
const better_luck = "better luck";
|
|
5367
5199
|
const recaptcha_verification_required = "reCAPTCHA verification required";
|
|
5368
|
-
const following_eligibilities = "the following Eligibilities";
|
|
5369
5200
|
const val_higher = "{val} or Higher";
|
|
5370
5201
|
const official = "⚠️ Not Official";
|
|
5371
5202
|
const winners_2 = "👑 Winners";
|
|
@@ -5375,21 +5206,16 @@ const any = "ANY";
|
|
|
5375
5206
|
const winners_announced = "All winners are to be announced by";
|
|
5376
5207
|
const least_count_transaction_s_chain = "At least {count} transaction(s) on {chain}";
|
|
5377
5208
|
const click_copy_address = "Click to copy: {address}";
|
|
5378
|
-
const
|
|
5209
|
+
const complete = "Complete";
|
|
5379
5210
|
const complete_onchain_action_number_actionid = "Complete Onchain Action #{actionId}";
|
|
5380
5211
|
const completed_current_required_optional_tasks = "Completed: {current} / {required} optional tasks";
|
|
5381
5212
|
const confirm = "Confirm";
|
|
5382
5213
|
const did = "DID";
|
|
5383
|
-
const holder_own_least_one = "DID Holder(own at least one";
|
|
5384
5214
|
const earned_current_required_points = "Earned: {current} / {required} points";
|
|
5385
5215
|
const equivalent_amounts_token_name = "Equivalent amounts of {token_name}";
|
|
5386
5216
|
const link_discord_account = "Link Discord Account";
|
|
5387
|
-
const lv = "Lv is";
|
|
5388
5217
|
const meet_eligibilities_below = "Meet Eligibilities Below";
|
|
5389
|
-
const member_discord_server = "Member of Discord server:";
|
|
5390
5218
|
const multiple_rewards_detail = "Multiple Rewards Detail";
|
|
5391
|
-
const included_public_sybil_address = "Not included in a public sybil address";
|
|
5392
|
-
const chain_label = "On {chain_label}";
|
|
5393
5219
|
const poh_verification = "POH Verification";
|
|
5394
5220
|
const please_earn_least_count_points_optional_tasks = "Please earn at least {count} points from optional tasks";
|
|
5395
5221
|
const please_move_key_blind_box_open_blind_box = "Please move the key to the blind box to open the blind box";
|
|
@@ -5397,11 +5223,9 @@ const points = "Points";
|
|
|
5397
5223
|
const qualifier = "Qualifier";
|
|
5398
5224
|
const quest = "Quest";
|
|
5399
5225
|
const required = "REQUIRED";
|
|
5400
|
-
const reviewed_tasks = "Reviewed All Tasks";
|
|
5401
5226
|
const rewards_per_winner = "Rewards Per Winner";
|
|
5402
5227
|
const taskon_poh_level = "Taskon POH Level";
|
|
5403
5228
|
const rankings_based_total_pointsname_earned_tasks_within_quest_instances = "The rankings are based on the total {pointsName} earned from all tasks within this quest. In instances of tied {pointsName}, submitters are ranked according to chronological order.";
|
|
5404
|
-
const quest_includes_proof_work_pow_tasks_which = "This quest includes Proof of Work (POW) tasks, which";
|
|
5405
5229
|
const tier_index = "Tier {index}";
|
|
5406
5230
|
const top_percent = "Top {from}%-{to}%";
|
|
5407
5231
|
const top = "Top {from}-{to}";
|
|
@@ -5409,19 +5233,11 @@ const top_2 = "Top {to}";
|
|
|
5409
5233
|
const top_percent_2 = "Top {to}%";
|
|
5410
5234
|
const total_pointname = "Total {pointName}";
|
|
5411
5235
|
const usd_token_name = "USD in {token_name}";
|
|
5412
|
-
const waiting = "Waiting for";
|
|
5413
5236
|
const x_account_created_months_ago = "X account created more than {months} months ago";
|
|
5414
5237
|
const x_account_count_followers = "X account with more than {count} followers";
|
|
5415
|
-
const your = "Your";
|
|
5416
5238
|
const database = "database";
|
|
5417
|
-
const days = "days";
|
|
5418
|
-
const first = "first";
|
|
5419
|
-
const least = "for at least";
|
|
5420
|
-
const is = "is";
|
|
5421
5239
|
const participants_2 = "participants";
|
|
5422
|
-
const tasks_secure_valid_ranking = "tasks to secure a valid ranking.";
|
|
5423
5240
|
const token = "token)";
|
|
5424
|
-
const review_winners_selected = "will review. Winners will be selected";
|
|
5425
5241
|
const pointsname_collected_tasks_completed_during_quest = "{pointsName} collected from all tasks completed during the quest.";
|
|
5426
5242
|
const claim_again_send_new_transaction_recommended_when_sure_there = '"Claim Again" will send a new transaction it is only recommended when you are sure there is something wrong with the current transaction.';
|
|
5427
5243
|
const fcfs = "FCFS";
|
|
@@ -5447,7 +5263,6 @@ const enMessages = {
|
|
|
5447
5263
|
available,
|
|
5448
5264
|
awesome_already_meet_requirements,
|
|
5449
5265
|
babt_holder,
|
|
5450
|
-
before_join_please_meet,
|
|
5451
5266
|
binance_account_bound_token_bab,
|
|
5452
5267
|
bind,
|
|
5453
5268
|
bind_required_accounts,
|
|
@@ -5471,13 +5286,12 @@ const enMessages = {
|
|
|
5471
5286
|
close,
|
|
5472
5287
|
complete_campaign,
|
|
5473
5288
|
complete_action_first,
|
|
5474
|
-
complete,
|
|
5475
5289
|
complete_campaign_2,
|
|
5476
5290
|
complete_qualify_rewards,
|
|
5477
5291
|
complete_milestone_name_first,
|
|
5478
5292
|
completing,
|
|
5479
5293
|
congratulations,
|
|
5480
|
-
|
|
5294
|
+
start_to_earn,
|
|
5481
5295
|
connecting_wallet,
|
|
5482
5296
|
continue_waiting,
|
|
5483
5297
|
contract_address,
|
|
@@ -5487,7 +5301,6 @@ const enMessages = {
|
|
|
5487
5301
|
discord,
|
|
5488
5302
|
discord_account_linked,
|
|
5489
5303
|
discord_role,
|
|
5490
|
-
discord_role_2,
|
|
5491
5304
|
ens_domains_eth,
|
|
5492
5305
|
evm_chain,
|
|
5493
5306
|
exp_winner,
|
|
@@ -5516,7 +5329,6 @@ const enMessages = {
|
|
|
5516
5329
|
limited_spots_gas_free_claiming,
|
|
5517
5330
|
link_wallet_address,
|
|
5518
5331
|
link_copied,
|
|
5519
|
-
loading_quest,
|
|
5520
5332
|
loading,
|
|
5521
5333
|
lucky_draw,
|
|
5522
5334
|
manually_upload,
|
|
@@ -5533,7 +5345,6 @@ const enMessages = {
|
|
|
5533
5345
|
no_winners,
|
|
5534
5346
|
qualified,
|
|
5535
5347
|
tasks_successfully_verified_better_luck_next_time,
|
|
5536
|
-
sybil_database,
|
|
5537
5348
|
included_public_sybil_address_database,
|
|
5538
5349
|
ok,
|
|
5539
5350
|
only,
|
|
@@ -5548,11 +5359,8 @@ const enMessages = {
|
|
|
5548
5359
|
oops_better_luck_next_time_2,
|
|
5549
5360
|
open_blind_box,
|
|
5550
5361
|
open,
|
|
5551
|
-
own,
|
|
5552
|
-
own_least,
|
|
5553
5362
|
own_least_amount_token_name_chain_label,
|
|
5554
5363
|
own_amount_name_nft_chain,
|
|
5555
|
-
participants,
|
|
5556
5364
|
participants_info,
|
|
5557
5365
|
participants_any_user_who_complete_least_1_task_quest,
|
|
5558
5366
|
pending_transaction,
|
|
@@ -5586,7 +5394,6 @@ const enMessages = {
|
|
|
5586
5394
|
reward_amount_revealed_once_quest_ends,
|
|
5587
5395
|
rewards,
|
|
5588
5396
|
rewards_missed,
|
|
5589
|
-
role,
|
|
5590
5397
|
save,
|
|
5591
5398
|
share,
|
|
5592
5399
|
share_qr_code,
|
|
@@ -5604,6 +5411,7 @@ const enMessages = {
|
|
|
5604
5411
|
system_drawing_winners,
|
|
5605
5412
|
system_automatically_select_winners,
|
|
5606
5413
|
task,
|
|
5414
|
+
completed,
|
|
5607
5415
|
taskon_lv_level_higher,
|
|
5608
5416
|
taskon_lv_val,
|
|
5609
5417
|
taskon_poh_level_score_label,
|
|
@@ -5668,19 +5476,14 @@ const enMessages = {
|
|
|
5668
5476
|
final_rewards,
|
|
5669
5477
|
ranking,
|
|
5670
5478
|
complete_task,
|
|
5671
|
-
own_discord_role,
|
|
5672
5479
|
own_discord_role_community,
|
|
5673
5480
|
completed_task,
|
|
5674
|
-
own_discord_role_2,
|
|
5675
5481
|
own_discord_role_community_2,
|
|
5676
5482
|
name_lv_lt_count,
|
|
5677
5483
|
val_wallet_address_allowlist,
|
|
5678
5484
|
zkme_citizenship_nft_holder,
|
|
5679
|
-
after,
|
|
5680
|
-
tasks_reviewed,
|
|
5681
5485
|
better_luck,
|
|
5682
5486
|
recaptcha_verification_required,
|
|
5683
|
-
following_eligibilities,
|
|
5684
5487
|
val_higher,
|
|
5685
5488
|
official,
|
|
5686
5489
|
winners_2,
|
|
@@ -5690,21 +5493,16 @@ const enMessages = {
|
|
|
5690
5493
|
winners_announced,
|
|
5691
5494
|
least_count_transaction_s_chain,
|
|
5692
5495
|
click_copy_address,
|
|
5693
|
-
|
|
5496
|
+
complete,
|
|
5694
5497
|
complete_onchain_action_number_actionid,
|
|
5695
5498
|
completed_current_required_optional_tasks,
|
|
5696
5499
|
confirm,
|
|
5697
5500
|
did,
|
|
5698
|
-
holder_own_least_one,
|
|
5699
5501
|
earned_current_required_points,
|
|
5700
5502
|
equivalent_amounts_token_name,
|
|
5701
5503
|
link_discord_account,
|
|
5702
|
-
lv,
|
|
5703
5504
|
meet_eligibilities_below,
|
|
5704
|
-
member_discord_server,
|
|
5705
5505
|
multiple_rewards_detail,
|
|
5706
|
-
included_public_sybil_address,
|
|
5707
|
-
chain_label,
|
|
5708
5506
|
poh_verification,
|
|
5709
5507
|
please_earn_least_count_points_optional_tasks,
|
|
5710
5508
|
please_move_key_blind_box_open_blind_box,
|
|
@@ -5712,11 +5510,9 @@ const enMessages = {
|
|
|
5712
5510
|
qualifier,
|
|
5713
5511
|
quest,
|
|
5714
5512
|
required,
|
|
5715
|
-
reviewed_tasks,
|
|
5716
5513
|
rewards_per_winner,
|
|
5717
5514
|
taskon_poh_level,
|
|
5718
5515
|
rankings_based_total_pointsname_earned_tasks_within_quest_instances,
|
|
5719
|
-
quest_includes_proof_work_pow_tasks_which,
|
|
5720
5516
|
tier_index,
|
|
5721
5517
|
top_percent,
|
|
5722
5518
|
top,
|
|
@@ -5724,20 +5520,11 @@ const enMessages = {
|
|
|
5724
5520
|
top_percent_2,
|
|
5725
5521
|
total_pointname,
|
|
5726
5522
|
usd_token_name,
|
|
5727
|
-
waiting,
|
|
5728
5523
|
x_account_created_months_ago,
|
|
5729
5524
|
x_account_count_followers,
|
|
5730
|
-
your,
|
|
5731
5525
|
database,
|
|
5732
|
-
days,
|
|
5733
|
-
first,
|
|
5734
|
-
least,
|
|
5735
|
-
"in": "in",
|
|
5736
|
-
is,
|
|
5737
5526
|
participants_2,
|
|
5738
|
-
tasks_secure_valid_ranking,
|
|
5739
5527
|
token,
|
|
5740
|
-
review_winners_selected,
|
|
5741
5528
|
pointsname_collected_tasks_completed_during_quest,
|
|
5742
5529
|
claim_again_send_new_transaction_recommended_when_sure_there,
|
|
5743
5530
|
fcfs,
|
|
@@ -5759,16 +5546,16 @@ const enMessages = {
|
|
|
5759
5546
|
const loadMessages = createLocaleLoader(
|
|
5760
5547
|
enMessages,
|
|
5761
5548
|
{
|
|
5762
|
-
ko: () => import("./quest-ko-
|
|
5549
|
+
ko: () => import("./quest-ko-BMu3uRQJ.js").then((module2) => ({
|
|
5763
5550
|
default: module2.default
|
|
5764
5551
|
})),
|
|
5765
|
-
ja: () => import("./quest-ja-
|
|
5552
|
+
ja: () => import("./quest-ja-Depog33y.js").then((module2) => ({
|
|
5766
5553
|
default: module2.default
|
|
5767
5554
|
})),
|
|
5768
|
-
ru: () => import("./quest-ru-
|
|
5555
|
+
ru: () => import("./quest-ru-xne814Rw.js").then((module2) => ({
|
|
5769
5556
|
default: module2.default
|
|
5770
5557
|
})),
|
|
5771
|
-
es: () => import("./quest-es-
|
|
5558
|
+
es: () => import("./quest-es-Dyyy0zaw.js").then((module2) => ({
|
|
5772
5559
|
default: module2.default
|
|
5773
5560
|
}))
|
|
5774
5561
|
}
|
|
@@ -5790,11 +5577,7 @@ function RewardModuleDialog({
|
|
|
5790
5577
|
const isToken = type === "token";
|
|
5791
5578
|
const isPoints = type === "points";
|
|
5792
5579
|
const isNft = type === "nft";
|
|
5793
|
-
const { messages, isLoading } =
|
|
5794
|
-
widgetId: "UserCenterWidget",
|
|
5795
|
-
defaultMessages: enMessages$2,
|
|
5796
|
-
loadMessages: (locale) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../../UserCenter/locales/en.json": () => import("./UserCenterWidget-CvU6K4AC.js").then((n) => n.w), "../../../../UserCenter/locales/ja.json": () => import("./usercenter-ja-B2465c1O.js"), "../../../../UserCenter/locales/ko.json": () => import("./usercenter-ko-xAEYxqLg.js") }), `../../../../UserCenter/locales/${locale}.json`, 7)
|
|
5797
|
-
});
|
|
5580
|
+
const { messages, isLoading } = useUserCenterLocale();
|
|
5798
5581
|
const tokenAssets = useTokenAssets({
|
|
5799
5582
|
autoLoad: open2 && isToken
|
|
5800
5583
|
});
|
|
@@ -5821,16 +5604,16 @@ function RewardModuleDialog({
|
|
|
5821
5604
|
autoLoad: open2 && isPoints && Boolean(pointsInfo == null ? void 0 : pointsInfo.points_id)
|
|
5822
5605
|
});
|
|
5823
5606
|
const dialogTitle = useMemo(() => {
|
|
5824
|
-
if (isToken) return messages.
|
|
5825
|
-
if (isPoints) return messages.
|
|
5607
|
+
if (isToken) return messages.reward_token ?? t("token_name");
|
|
5608
|
+
if (isPoints) return messages.points_history ?? t("points_history");
|
|
5826
5609
|
if (isNft) return "NFT";
|
|
5827
5610
|
return "";
|
|
5828
5611
|
}, [
|
|
5829
5612
|
isToken,
|
|
5830
5613
|
isPoints,
|
|
5831
5614
|
isNft,
|
|
5832
|
-
messages.
|
|
5833
|
-
messages.
|
|
5615
|
+
messages.reward_token,
|
|
5616
|
+
messages.points_history,
|
|
5834
5617
|
t
|
|
5835
5618
|
]);
|
|
5836
5619
|
const handleOpenChange = useCallback(
|
|
@@ -5865,7 +5648,6 @@ function RewardModuleDialog({
|
|
|
5865
5648
|
tokenHistoryLoading: tokenHistory.loading,
|
|
5866
5649
|
tokenHistoryError: tokenHistory.error,
|
|
5867
5650
|
tokenHistoryPagination: tokenHistory.pagination,
|
|
5868
|
-
messages,
|
|
5869
5651
|
onWithdraw: handleWithdraw,
|
|
5870
5652
|
onBatchWithdraw: handleBatchWithdraw
|
|
5871
5653
|
}
|
|
@@ -5877,18 +5659,16 @@ function RewardModuleDialog({
|
|
|
5877
5659
|
data: pointsHistory.data,
|
|
5878
5660
|
loading: pointsHistory.loading,
|
|
5879
5661
|
error: pointsHistory.error,
|
|
5880
|
-
pagination: pointsHistory.pagination
|
|
5881
|
-
messages
|
|
5662
|
+
pagination: pointsHistory.pagination
|
|
5882
5663
|
}
|
|
5883
|
-
) : /* @__PURE__ */ jsx(EmptyState, { message: messages.
|
|
5664
|
+
) : /* @__PURE__ */ jsx(EmptyState, { message: messages.empty_points })),
|
|
5884
5665
|
isNft && /* @__PURE__ */ jsx(
|
|
5885
5666
|
NftRewardContent,
|
|
5886
5667
|
{
|
|
5887
5668
|
nftList: nftHistory.data,
|
|
5888
5669
|
loading: nftHistory.loading,
|
|
5889
5670
|
error: nftHistory.error,
|
|
5890
|
-
pagination: nftHistory.pagination
|
|
5891
|
-
messages
|
|
5671
|
+
pagination: nftHistory.pagination
|
|
5892
5672
|
}
|
|
5893
5673
|
)
|
|
5894
5674
|
] })
|
|
@@ -5898,7 +5678,6 @@ function RewardModuleDialog({
|
|
|
5898
5678
|
WithdrawForm,
|
|
5899
5679
|
{
|
|
5900
5680
|
open: showWithdrawForm,
|
|
5901
|
-
messages,
|
|
5902
5681
|
tokenAssets: tokenAssets.data,
|
|
5903
5682
|
tokenAssetsLoading: tokenAssets.loading,
|
|
5904
5683
|
initialTokenId: selectedTokenForWithdraw == null ? void 0 : selectedTokenForWithdraw.token_id,
|
|
@@ -8081,7 +7860,7 @@ function requireLottie() {
|
|
|
8081
7860
|
_stopped = true;
|
|
8082
7861
|
}
|
|
8083
7862
|
}
|
|
8084
|
-
function
|
|
7863
|
+
function first(nowTime) {
|
|
8085
7864
|
initTime = nowTime;
|
|
8086
7865
|
window.requestAnimationFrame(resume);
|
|
8087
7866
|
}
|
|
@@ -8148,7 +7927,7 @@ function requireLottie() {
|
|
|
8148
7927
|
function activate() {
|
|
8149
7928
|
if (!_isFrozen && playingAnimationsNum) {
|
|
8150
7929
|
if (_stopped) {
|
|
8151
|
-
window.requestAnimationFrame(
|
|
7930
|
+
window.requestAnimationFrame(first);
|
|
8152
7931
|
_stopped = false;
|
|
8153
7932
|
}
|
|
8154
7933
|
}
|
|
@@ -12050,11 +11829,11 @@ function requireLottie() {
|
|
|
12050
11829
|
}
|
|
12051
11830
|
function getCodePoint(string) {
|
|
12052
11831
|
var codePoint = 0;
|
|
12053
|
-
var
|
|
12054
|
-
if (
|
|
11832
|
+
var first = string.charCodeAt(0);
|
|
11833
|
+
if (first >= 55296 && first <= 56319) {
|
|
12055
11834
|
var second = string.charCodeAt(1);
|
|
12056
11835
|
if (second >= 56320 && second <= 57343) {
|
|
12057
|
-
codePoint = (
|
|
11836
|
+
codePoint = (first - 55296) * 1024 + second - 56320 + 65536;
|
|
12058
11837
|
}
|
|
12059
11838
|
}
|
|
12060
11839
|
return codePoint;
|
|
@@ -23036,7 +22815,8 @@ const BlindBoxDialog = forwardRef(
|
|
|
23036
22815
|
hasOpened && "taskon-quest-blindbox-chest--open"
|
|
23037
22816
|
].filter(Boolean).join(" ");
|
|
23038
22817
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-quest-blindbox-dialog", children: [
|
|
23039
|
-
/* @__PURE__ */ jsx("h2", { className: "taskon-quest-blindbox-dialog-title", children: t("
|
|
22818
|
+
/* @__PURE__ */ jsx("h2", { className: "taskon-quest-blindbox-dialog-title", children: t("open_blind_box") }),
|
|
22819
|
+
/* @__PURE__ */ jsx("p", { className: "taskon-quest-blindbox-dialog-subtitle", children: t("please_move_key_blind_box_open_blind_box") }),
|
|
23040
22820
|
/* @__PURE__ */ jsxs("div", { ref: stageRef, className: "taskon-quest-blindbox-stage", children: [
|
|
23041
22821
|
showBackground && /* @__PURE__ */ jsx("div", { className: "taskon-quest-blindbox-bg", children: /* @__PURE__ */ jsx("img", { src: bgImageUrl, alt: "", draggable: false }) }),
|
|
23042
22822
|
/* @__PURE__ */ jsx("div", { ref: dropZoneRef, className: "taskon-quest-blindbox-dropzone" }),
|
|
@@ -23426,8 +23206,8 @@ function OnChainVerify({
|
|
|
23426
23206
|
] });
|
|
23427
23207
|
}
|
|
23428
23208
|
function getMonthFromMillSec(ms) {
|
|
23429
|
-
const
|
|
23430
|
-
return Math.floor(
|
|
23209
|
+
const days = Math.floor(ms / (1e3 * 60 * 60 * 24));
|
|
23210
|
+
return Math.floor(days / 30);
|
|
23431
23211
|
}
|
|
23432
23212
|
function XAccountVerify({
|
|
23433
23213
|
params
|
|
@@ -23870,19 +23650,19 @@ function EligibilityInfo({
|
|
|
23870
23650
|
}
|
|
23871
23651
|
export {
|
|
23872
23652
|
BlindBoxDialog as B,
|
|
23873
|
-
|
|
23653
|
+
CardDescExpress as C,
|
|
23874
23654
|
EligibilityInfo as E,
|
|
23875
23655
|
I18nT as I,
|
|
23876
23656
|
RewardModuleDialog as R,
|
|
23877
23657
|
TitleExpress as T,
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23658
|
+
useNftClaimFlow as a,
|
|
23659
|
+
TaskItem as b,
|
|
23660
|
+
Textarea as c,
|
|
23661
|
+
useTaskWidgetLocale as d,
|
|
23662
|
+
useQuestLocale as e,
|
|
23663
|
+
EligibilityList as f,
|
|
23664
|
+
getDefaultExportFromCjs as g,
|
|
23665
|
+
ConfirmNoticeDialog as h,
|
|
23886
23666
|
sanitizeHtml as s,
|
|
23887
|
-
|
|
23667
|
+
useBindWallet as u
|
|
23888
23668
|
};
|