@taskon/widget-react 0.0.1-beta.1 → 0.0.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Quest.css CHANGED
@@ -3593,7 +3593,6 @@ a.taskon-quest-footer-action-btn {
3593
3593
  font-size: 16px;
3594
3594
  line-height: 1.5;
3595
3595
  color: var(--taskon-quest-text-lightest);
3596
- background-color: var(--taskon-quest-bg-body);
3597
3596
  }
3598
3597
 
3599
3598
  /* ============================================================================
@@ -3966,7 +3965,8 @@ a.taskon-quest-footer-action-btn {
3966
3965
  align-items: center;
3967
3966
  padding: var(--taskon-quest-spacing-m);
3968
3967
  height: 66px;
3969
- background: linear-gradient(
3968
+ background:
3969
+ linear-gradient(
3970
3970
  90deg,
3971
3971
  rgba(255, 255, 255, 0.1) 0%,
3972
3972
  rgba(255, 255, 255, 0.1) 100%
@@ -4211,4 +4211,3 @@ a.taskon-quest-footer-action-btn {
4211
4211
  .taskon-quest-blindbox-reward-wrapper .taskon-dialog-body {
4212
4212
  padding: 0;
4213
4213
  }
4214
-
@@ -819,6 +819,178 @@
819
819
  margin-left: 14px;
820
820
  }
821
821
  }
822
+ /**
823
+ * Points 表格样式
824
+ *
825
+ * 从 UserCenterWidget.css 拆分,便于独立使用
826
+ */
827
+
828
+ /* ========== Points List ========== */
829
+ .taskon-points-list {
830
+ width: 100%;
831
+ }
832
+
833
+ .taskon-points-list__header {
834
+ display: flex;
835
+ align-items: center;
836
+ gap: var(--taskon-spacing-sm, 8px);
837
+ margin-bottom: var(--taskon-spacing-md, 16px);
838
+ }
839
+
840
+ .taskon-points-list__icon {
841
+ width: 32px;
842
+ height: 32px;
843
+ border-radius: 50%;
844
+ object-fit: cover;
845
+ }
846
+
847
+ .taskon-points-list__title {
848
+ font-size: 16px;
849
+ font-weight: 600;
850
+ color: var(--taskon-color-text, #1f2937);
851
+ margin: 0;
852
+ }
853
+
854
+ .taskon-points-list__total {
855
+ display: flex;
856
+ align-items: baseline;
857
+ gap: var(--taskon-spacing-xs, 4px);
858
+ margin-left: auto;
859
+ }
860
+
861
+ .taskon-points-list__total-value {
862
+ font-size: 20px;
863
+ font-weight: 700;
864
+ color: var(--taskon-color-text, #1f2937);
865
+ }
866
+
867
+ .taskon-points-list__total-label {
868
+ font-size: 12px;
869
+ color: var(--taskon-color-text-secondary, #6b7280);
870
+ }
871
+
872
+ .taskon-points-list__table {
873
+ width: 100%;
874
+ border: 1px solid var(--taskon-color-border, #e5e7eb);
875
+ border-radius: var(--taskon-border-radius-sm, 6px);
876
+ overflow: hidden;
877
+ }
878
+
879
+ .taskon-points-list__row {
880
+ display: flex;
881
+ align-items: center;
882
+ padding: var(--taskon-spacing-sm, 8px) var(--taskon-spacing-md, 16px);
883
+ border-bottom: 1px solid var(--taskon-color-border, #e5e7eb);
884
+ transition: background-color 0.2s ease;
885
+ }
886
+
887
+ .taskon-points-list__row:last-child {
888
+ border-bottom: none;
889
+ }
890
+
891
+ .taskon-points-list__row:hover {
892
+ background-color: var(--taskon-color-bg-hover, #f3f4f6);
893
+ }
894
+
895
+ .taskon-points-list__cell {
896
+ display: flex;
897
+ align-items: center;
898
+ }
899
+
900
+ .taskon-points-list__cell--main {
901
+ flex: 1;
902
+ display: flex;
903
+ flex-direction: column;
904
+ gap: 2px;
905
+ overflow: hidden;
906
+ }
907
+
908
+ .taskon-points-list__cell--amount {
909
+ font-size: 14px;
910
+ font-weight: 600;
911
+ white-space: nowrap;
912
+ }
913
+
914
+ .taskon-points-list__cell--amount.positive {
915
+ color: var(--taskon-color-success, #10b981);
916
+ }
917
+
918
+ .taskon-points-list__cell--amount.negative {
919
+ color: var(--taskon-color-error, #ef4444);
920
+ }
921
+
922
+ .taskon-points-list__cell--time {
923
+ font-size: 13px;
924
+ color: var(--taskon-color-text-secondary, #6b7280);
925
+ white-space: nowrap;
926
+ }
927
+
928
+ .taskon-points-list__primary {
929
+ font-size: 14px;
930
+ font-weight: 500;
931
+ color: var(--taskon-color-text, #1f2937);
932
+ white-space: nowrap;
933
+ overflow: hidden;
934
+ text-overflow: ellipsis;
935
+ }
936
+
937
+ .taskon-points-list__secondary {
938
+ font-size: 12px;
939
+ color: var(--taskon-color-text-secondary, #6b7280);
940
+ white-space: nowrap;
941
+ overflow: hidden;
942
+ text-overflow: ellipsis;
943
+ }
944
+
945
+ .taskon-points-list__loading-more {
946
+ display: flex;
947
+ justify-content: center;
948
+ padding: var(--taskon-spacing-md, 16px);
949
+ }
950
+
951
+ .taskon-points-list__table-wrap {
952
+ margin-top: var(--taskon-spacing-md, 16px);
953
+ }
954
+
955
+ .taskon-points-list__name {
956
+ font-size: 14px;
957
+ font-weight: 500;
958
+ color: var(--taskon-color-text, #1f2937);
959
+ }
960
+
961
+ .taskon-points-list__time {
962
+ font-size: 13px;
963
+ color: var(--taskon-color-text-secondary, #6b7280);
964
+ white-space: nowrap;
965
+ }
966
+
967
+ .taskon-points-list__amount-cell {
968
+ display: flex;
969
+ align-items: center;
970
+ justify-content: flex-end;
971
+ gap: 6px;
972
+ }
973
+
974
+ .taskon-points-list__amount-icon {
975
+ width: 20px;
976
+ height: 20px;
977
+ border-radius: 50%;
978
+ flex-shrink: 0;
979
+ }
980
+
981
+ .taskon-points-list__amount-value {
982
+ font-size: 14px;
983
+ font-weight: 600;
984
+ white-space: nowrap;
985
+ }
986
+
987
+ .taskon-points-list__amount-value--positive {
988
+ color: var(--taskon-color-success, #10b981);
989
+ }
990
+
991
+ .taskon-points-list__amount-value--negative {
992
+ color: var(--taskon-color-error, #ef4444);
993
+ }
822
994
  /**
823
995
  * RewardTables 通用样式
824
996
  */
@@ -919,6 +1091,11 @@
919
1091
  .taskon-reward-table__points-amount--negative {
920
1092
  color: var(--taskon-error, #ef4444);
921
1093
  }
1094
+ /**
1095
+ * TokenHistoryTable 表格样式
1096
+ *
1097
+ * 从 RewardTables.css 拆分,便于独立使用
1098
+ */
922
1099
 
923
1100
  /* ========== Token History 表格样式 ========== */
924
1101
 
@@ -2465,173 +2642,6 @@
2465
2642
  margin-bottom: var(--taskon-spacing-md, 16px);
2466
2643
  }
2467
2644
 
2468
- /* ========== Points List ========== */
2469
- .taskon-points-list {
2470
- width: 100%;
2471
- }
2472
-
2473
- .taskon-points-list__header {
2474
- display: flex;
2475
- align-items: center;
2476
- gap: var(--taskon-spacing-sm, 8px);
2477
- margin-bottom: var(--taskon-spacing-md, 16px);
2478
- }
2479
-
2480
- .taskon-points-list__icon {
2481
- width: 32px;
2482
- height: 32px;
2483
- border-radius: 50%;
2484
- object-fit: cover;
2485
- }
2486
-
2487
- .taskon-points-list__title {
2488
- font-size: 16px;
2489
- font-weight: 600;
2490
- color: var(--taskon-color-text, #1f2937);
2491
- margin: 0;
2492
- }
2493
-
2494
- .taskon-points-list__total {
2495
- display: flex;
2496
- align-items: baseline;
2497
- gap: var(--taskon-spacing-xs, 4px);
2498
- margin-left: auto;
2499
- }
2500
-
2501
- .taskon-points-list__total-value {
2502
- font-size: 20px;
2503
- font-weight: 700;
2504
- color: var(--taskon-color-text, #1f2937);
2505
- }
2506
-
2507
- .taskon-points-list__total-label {
2508
- font-size: 12px;
2509
- color: var(--taskon-color-text-secondary, #6b7280);
2510
- }
2511
-
2512
- .taskon-points-list__table {
2513
- width: 100%;
2514
- border: 1px solid var(--taskon-color-border, #e5e7eb);
2515
- border-radius: var(--taskon-border-radius-sm, 6px);
2516
- overflow: hidden;
2517
- }
2518
-
2519
- .taskon-points-list__row {
2520
- display: flex;
2521
- align-items: center;
2522
- padding: var(--taskon-spacing-sm, 8px) var(--taskon-spacing-md, 16px);
2523
- border-bottom: 1px solid var(--taskon-color-border, #e5e7eb);
2524
- transition: background-color 0.2s ease;
2525
- }
2526
-
2527
- .taskon-points-list__row:last-child {
2528
- border-bottom: none;
2529
- }
2530
-
2531
- .taskon-points-list__row:hover {
2532
- background-color: var(--taskon-color-bg-hover, #f3f4f6);
2533
- }
2534
-
2535
- .taskon-points-list__cell {
2536
- display: flex;
2537
- align-items: center;
2538
- }
2539
-
2540
- .taskon-points-list__cell--main {
2541
- flex: 1;
2542
- display: flex;
2543
- flex-direction: column;
2544
- gap: 2px;
2545
- overflow: hidden;
2546
- }
2547
-
2548
- .taskon-points-list__cell--amount {
2549
- font-size: 14px;
2550
- font-weight: 600;
2551
- white-space: nowrap;
2552
- }
2553
-
2554
- .taskon-points-list__cell--amount.positive {
2555
- color: var(--taskon-color-success, #10b981);
2556
- }
2557
-
2558
- .taskon-points-list__cell--amount.negative {
2559
- color: var(--taskon-color-error, #ef4444);
2560
- }
2561
-
2562
- .taskon-points-list__cell--time {
2563
- font-size: 13px;
2564
- color: var(--taskon-color-text-secondary, #6b7280);
2565
- white-space: nowrap;
2566
- }
2567
-
2568
- .taskon-points-list__primary {
2569
- font-size: 14px;
2570
- font-weight: 500;
2571
- color: var(--taskon-color-text, #1f2937);
2572
- white-space: nowrap;
2573
- overflow: hidden;
2574
- text-overflow: ellipsis;
2575
- }
2576
-
2577
- .taskon-points-list__secondary {
2578
- font-size: 12px;
2579
- color: var(--taskon-color-text-secondary, #6b7280);
2580
- white-space: nowrap;
2581
- overflow: hidden;
2582
- text-overflow: ellipsis;
2583
- }
2584
-
2585
- .taskon-points-list__loading-more {
2586
- display: flex;
2587
- justify-content: center;
2588
- padding: var(--taskon-spacing-md, 16px);
2589
- }
2590
-
2591
- .taskon-points-list__table-wrap {
2592
- margin-top: var(--taskon-spacing-md, 16px);
2593
- }
2594
-
2595
- .taskon-points-list__name {
2596
- font-size: 14px;
2597
- font-weight: 500;
2598
- color: var(--taskon-color-text, #1f2937);
2599
- }
2600
-
2601
- .taskon-points-list__time {
2602
- font-size: 13px;
2603
- color: var(--taskon-color-text-secondary, #6b7280);
2604
- white-space: nowrap;
2605
- }
2606
-
2607
- .taskon-points-list__amount-cell {
2608
- display: flex;
2609
- align-items: center;
2610
- justify-content: flex-end;
2611
- gap: 6px;
2612
- }
2613
-
2614
- .taskon-points-list__amount-icon {
2615
- width: 20px;
2616
- height: 20px;
2617
- border-radius: 50%;
2618
- flex-shrink: 0;
2619
- }
2620
-
2621
- .taskon-points-list__amount-value {
2622
- font-size: 14px;
2623
- font-weight: 600;
2624
- white-space: nowrap;
2625
- }
2626
-
2627
- .taskon-points-list__amount-value--positive {
2628
- color: var(--taskon-color-success, #10b981);
2629
- }
2630
-
2631
- .taskon-points-list__amount-value--negative {
2632
- color: var(--taskon-color-error, #ef4444);
2633
- }
2634
-
2635
2645
  /* ============================================================================
2636
2646
  Identity 组件样式
2637
2647
  ============================================================================ */
@@ -1788,6 +1788,11 @@ function useSubmitTask(taskId, onSuccess, platform, options) {
1788
1788
  }, [userInfo]);
1789
1789
  const submitTask = useCallback(
1790
1790
  async (taskValue) => {
1791
+ const refreshOnFailure = () => {
1792
+ if (refreshOnFail) {
1793
+ onSuccess == null ? void 0 : onSuccess();
1794
+ }
1795
+ };
1791
1796
  if (!userToken) {
1792
1797
  const errorMsg = "Please login first";
1793
1798
  setError(errorMsg);
@@ -1812,6 +1817,7 @@ function useSubmitTask(taskId, onSuccess, platform, options) {
1812
1817
  onSuccess == null ? void 0 : onSuccess();
1813
1818
  return { successful: true };
1814
1819
  } else if (result.cool_down) {
1820
+ refreshOnFailure();
1815
1821
  return {
1816
1822
  successful: false,
1817
1823
  cool_down: result.cool_down
@@ -1829,9 +1835,7 @@ function useSubmitTask(taskId, onSuccess, platform, options) {
1829
1835
  } else {
1830
1836
  toast.error("Oops! You did not pass this task.");
1831
1837
  }
1832
- if (refreshOnFail) {
1833
- onSuccess == null ? void 0 : onSuccess();
1834
- }
1838
+ refreshOnFailure();
1835
1839
  return { successful: false };
1836
1840
  }
1837
1841
  } catch (err) {
@@ -1841,6 +1845,7 @@ function useSubmitTask(taskId, onSuccess, platform, options) {
1841
1845
  setError(errorMsg);
1842
1846
  console.error("Submit task failed:", err);
1843
1847
  if (errorCode === ErrorCode.TASK_PARTIAL_PASS) {
1848
+ refreshOnFailure();
1844
1849
  return {
1845
1850
  successful: false,
1846
1851
  error: errorMsg,
@@ -1850,6 +1855,7 @@ function useSubmitTask(taskId, onSuccess, platform, options) {
1850
1855
  if (errorCode === ErrorCode.INVITE_JOIN_IS_NOT_REACH && errorData) {
1851
1856
  const { invited = 0, min_required = 0 } = errorData;
1852
1857
  toast.error(`You have invited ${invited} users, but need ${min_required - invited} more to complete this task.`);
1858
+ refreshOnFailure();
1853
1859
  return {
1854
1860
  successful: false,
1855
1861
  error: errorMsg,
@@ -1857,6 +1863,7 @@ function useSubmitTask(taskId, onSuccess, platform, options) {
1857
1863
  };
1858
1864
  }
1859
1865
  toast.error(errorMsg);
1866
+ refreshOnFailure();
1860
1867
  return {
1861
1868
  successful: false,
1862
1869
  error: errorMsg,
@@ -2,9 +2,9 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useMemo, useRef } from "react";
3
3
  import { DEFAULT_PAGE_BUILDER_CONFIG, createPageBuilderApi, parsePageBuilderConfig, SectionLayoutType, WidgetTypeEnum, SECTION_LAYOUT_RATIOS } from "@taskon/core";
4
4
  import { Q as QuestWidget } from "./Quest-DKFZ-pPU.js";
5
- import { a as CommunityTaskList } from "./CommunityTaskList-DoPGZsw1.js";
5
+ import { a as CommunityTaskList } from "./CommunityTaskList-BlH1Wdd5.js";
6
6
  import { L as LeaderboardWidget } from "./LeaderboardWidget-CmYfDeHV.js";
7
- import { U as UserCenterWidget } from "./UserCenterWidget-BVw_IEEd.js";
7
+ import { U as UserCenterWidget } from "./UserCenterWidget-Cw6h_5hT.js";
8
8
  import { b as useTaskOnContext } from "./ThemeProvider-wnSXrNQb.js";
9
9
  import '../PageBuilder.css';function usePageBuilderConfig(pageId, localConfig) {
10
10
  const { client } = useTaskOnContext();
@@ -1,4 +1,4 @@
1
- import { B, B as B2, a, c, u, b } from "./chunks/CommunityTaskList-DoPGZsw1.js";
1
+ import { B, B as B2, a, c, u, b } from "./chunks/CommunityTaskList-BlH1Wdd5.js";
2
2
  export {
3
3
  B as BaseTask,
4
4
  B2 as CommunityTask,
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { T, u, a } from "./chunks/ThemeProvider-wnSXrNQb.js";
2
- import { C, B, a as a2, T as T2 } from "./chunks/CommunityTaskList-DoPGZsw1.js";
2
+ import { C, B, a as a2, T as T2 } from "./chunks/CommunityTaskList-BlH1Wdd5.js";
3
3
  import { RewardType } from "@taskon/core";
4
4
  import { T as T3, c, b, i, a as a3, u as u2 } from "./chunks/TaskOnProvider-BD6Vp2x8.js";
5
5
  import { a as a4, u as u3 } from "./chunks/useToast-B-wyO5zL.js";
@@ -7,8 +7,8 @@ import { c as c2, i as i2, u as u4 } from "./chunks/useWidgetLocale-JDelxtt8.js"
7
7
  import { B as B2 } from "./chunks/dynamic-import-helper-DxEFwm31.js";
8
8
  import { L } from "./chunks/LeaderboardWidget-CmYfDeHV.js";
9
9
  import { Q, Q as Q2, u as u5, b as b2, a as a5 } from "./chunks/Quest-DKFZ-pPU.js";
10
- import { U } from "./chunks/UserCenterWidget-BVw_IEEd.js";
11
- import { P } from "./chunks/PageBuilder-Tmhf2GTS.js";
10
+ import { U } from "./chunks/UserCenterWidget-Cw6h_5hT.js";
11
+ import { P } from "./chunks/PageBuilder-Bw0zSkFh.js";
12
12
  export {
13
13
  B2 as Button,
14
14
  C as CardSelector,
@@ -1,4 +1,4 @@
1
- import { P } from "./chunks/PageBuilder-Tmhf2GTS.js";
1
+ import { P } from "./chunks/PageBuilder-Bw0zSkFh.js";
2
2
  export {
3
3
  P as PageBuilder
4
4
  };
@@ -1,4 +1,4 @@
1
- import { A, a, b, U, u, g, h, d, e, f, c } from "./chunks/UserCenterWidget-BVw_IEEd.js";
1
+ import { A, a, b, U, u, g, h, d, e, f, c } from "./chunks/UserCenterWidget-Cw6h_5hT.js";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { L as LoadingState, E as EmptyState, P as Pagination } from "./chunks/UserCenterWidget-BE329iS7.js";
4
4
  import { T, e as e2, f as f2, d as d2, t, c as c2, u as u2, a as a2, b as b2 } from "./chunks/UserCenterWidget-BE329iS7.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskon/widget-react",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.2",
4
4
  "description": "TaskOn React Widget Library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -3685,16 +3685,6 @@ function MyRewardsContent({
3685
3685
  setSelectedTokenForWithdraw(null);
3686
3686
  setShowWithdrawForm(true);
3687
3687
  };
3688
- if (rewardsLoading && cards.length === 0) {
3689
- return /* @__PURE__ */ jsx(LoadingState, { message: messages.loading });
3690
- }
3691
- if (rewardsError && cards.length === 0) {
3692
- return /* @__PURE__ */ jsx("div", { className: "taskon-user-center-error", children: /* @__PURE__ */ jsx("p", { className: "taskon-user-center-error__message", children: rewardsError.message }) });
3693
- }
3694
- const hasVisibleCards = cards.some((c) => c.visible);
3695
- if (!rewardsLoading && !hasVisibleCards) {
3696
- return /* @__PURE__ */ jsx(EmptyState, { message: messages.emptyRewards });
3697
- }
3698
3688
  const handleSelectCard = (type, pointsId) => {
3699
3689
  hasUserSelectedRef.current = true;
3700
3690
  selectCard(type);
@@ -3732,6 +3722,16 @@ function MyRewardsContent({
3732
3722
  }
3733
3723
  appliedDefaultKeyRef.current = applyKey;
3734
3724
  }, [cards, defaultPointId, defaultRewardCard, selectCard]);
3725
+ if (rewardsLoading && cards.length === 0) {
3726
+ return /* @__PURE__ */ jsx(LoadingState, { message: messages.loading });
3727
+ }
3728
+ if (rewardsError && cards.length === 0) {
3729
+ return /* @__PURE__ */ jsx("div", { className: "taskon-user-center-error", children: /* @__PURE__ */ jsx("p", { className: "taskon-user-center-error__message", children: rewardsError.message }) });
3730
+ }
3731
+ const hasVisibleCards = cards.some((c) => c.visible);
3732
+ if (!rewardsLoading && !hasVisibleCards) {
3733
+ return /* @__PURE__ */ jsx(EmptyState, { message: messages.emptyRewards });
3734
+ }
3735
3735
  const renderSelectedContent = () => {
3736
3736
  switch (selectedCard) {
3737
3737
  case USER_CENTER_REWARD_CARD_TYPES.Token: