@lifi/widget 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/cjs/components/Header/NavigationHeader.js +2 -2
  2. package/cjs/components/Header/index.d.ts +0 -1
  3. package/cjs/components/Header/index.js +0 -1
  4. package/cjs/config/version.d.ts +1 -1
  5. package/cjs/config/version.js +1 -1
  6. package/cjs/i18n/de.json +89 -63
  7. package/cjs/i18n/en.json +2 -2
  8. package/cjs/i18n/pt.json +2 -2
  9. package/cjs/i18n/th.json +62 -61
  10. package/cjs/i18n/uk.json +2 -2
  11. package/cjs/i18n/vi.json +64 -63
  12. package/cjs/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +3 -3
  13. package/cjs/pages/RoutesPage/RoutesPage.js +3 -3
  14. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +3 -3
  15. package/cjs/pages/TransactionDetailsPage/ContactSupportButton.d.ts +5 -0
  16. package/cjs/pages/TransactionDetailsPage/ContactSupportButton.js +25 -0
  17. package/cjs/pages/TransactionDetailsPage/TransactionDetailsPage.js +5 -4
  18. package/cjs/pages/TransactionHistoryPage/TransactionHistoryPage.js +3 -3
  19. package/cjs/pages/TransactionPage/TransactionPage.js +3 -3
  20. package/cjs/stores/StoreProvider.js +2 -1
  21. package/cjs/stores/header/index.d.ts +1 -0
  22. package/cjs/stores/header/index.js +17 -0
  23. package/cjs/{components/Header → stores/header}/types.d.ts +4 -2
  24. package/cjs/stores/header/useHeaderStore.d.ts +8 -0
  25. package/cjs/stores/header/useHeaderStore.js +56 -0
  26. package/cjs/stores/index.d.ts +2 -1
  27. package/cjs/stores/index.js +2 -1
  28. package/cjs/types/events.d.ts +6 -1
  29. package/cjs/types/events.js +1 -0
  30. package/components/Header/NavigationHeader.js +2 -2
  31. package/components/Header/index.d.ts +0 -1
  32. package/components/Header/index.js +0 -1
  33. package/config/version.d.ts +1 -1
  34. package/config/version.js +1 -1
  35. package/i18n/de.json +89 -63
  36. package/i18n/en.json +2 -2
  37. package/i18n/pt.json +2 -2
  38. package/i18n/th.json +62 -61
  39. package/i18n/uk.json +2 -2
  40. package/i18n/vi.json +64 -63
  41. package/package.json +11 -11
  42. package/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +4 -4
  43. package/pages/RoutesPage/RoutesPage.js +4 -4
  44. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +4 -4
  45. package/pages/TransactionDetailsPage/ContactSupportButton.d.ts +5 -0
  46. package/pages/TransactionDetailsPage/ContactSupportButton.js +21 -0
  47. package/pages/TransactionDetailsPage/TransactionDetailsPage.js +6 -5
  48. package/pages/TransactionHistoryPage/TransactionHistoryPage.js +4 -4
  49. package/pages/TransactionPage/TransactionPage.js +4 -4
  50. package/stores/StoreProvider.js +2 -1
  51. package/stores/header/index.d.ts +1 -0
  52. package/stores/header/index.js +1 -0
  53. package/{components/Header → stores/header}/types.d.ts +4 -2
  54. package/stores/header/useHeaderStore.d.ts +8 -0
  55. package/stores/header/useHeaderStore.js +49 -0
  56. package/stores/index.d.ts +2 -1
  57. package/stores/index.js +2 -1
  58. package/tsconfig.cjs.tsbuildinfo +1 -1
  59. package/types/events.d.ts +6 -1
  60. package/types/events.js +1 -0
  61. package/cjs/components/Header/useHeaderStore.d.ts +0 -2
  62. package/cjs/components/Header/useHeaderStore.js +0 -28
  63. package/components/Header/useHeaderStore.d.ts +0 -2
  64. package/components/Header/useHeaderStore.js +0 -25
  65. /package/cjs/{components/Header → stores/header}/types.js +0 -0
  66. /package/{components/Header → stores/header}/types.js +0 -0
package/cjs/i18n/vi.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
+ "language": {
3
+ "name": "Tiếng Việt",
4
+ "title": "Ngôn ngữ"
5
+ },
6
+ "format": {
7
+ "currency": "{{value, currency(currency: USD)}}",
8
+ "number": "{{value, number(maximumFractionDigits: 9)}}"
9
+ },
2
10
  "button": {
3
11
  "auto": "Tự động",
12
+ "bridge": "Cầu",
4
13
  "buy": "Mua",
5
14
  "buyNow": "Mua ngay bây giờ",
6
15
  "cancel": "Huỷ bỏ",
@@ -12,94 +21,74 @@
12
21
  "delete": "Xóa",
13
22
  "disconnect": "Ngắt kết nối",
14
23
  "done": "Hoàn thành",
24
+ "exchange": "Hoán đổi",
15
25
  "getGas": "Thiết lập gas",
16
26
  "hide": "Ẩn",
17
27
  "learnMore": "Xem thêm",
18
- "lifiSwap": "LI.FI Swap",
28
+ "lifiCheckout": "LI.FI Checkout",
29
+ "lifiExchange": "LI.FI Exchange",
19
30
  "light": "Sáng",
20
31
  "max": "Tối đa",
21
32
  "ok": "Ok",
22
- "okay": "Okay",
23
- "removeSwap": "Xoá",
33
+ "removeTransaction": "Xoá giao dịch",
24
34
  "reset": "Đặt lại",
25
35
  "resetSettings": "Đặt lại cài đặt",
26
- "restartSwap": "Thiết lập lại",
27
- "reviewGasSwap": "Xem lại gas swap",
36
+ "reviewBridge": "Xem xét cầu",
28
37
  "reviewPurchase": "Đánh giá thanh toán",
29
38
  "reviewSwap": "Xem lại Swap",
30
39
  "seeDetails": "Xem chi tiết",
31
40
  "showAll": "Hiển thị tất cả",
32
- "startGasSwap": "Start gas swap",
33
- "startSwap": "Bắt đầu Swap",
41
+ "startBridging": "Bắt đầu đi cầu",
42
+ "startSwapping": "Bắt đầu Swap",
34
43
  "swap": "Swap",
35
44
  "tryAgain": "Thử lại",
36
45
  "viewCoverage": "Xem phạm vi bảo hiểm",
37
46
  "viewOnExplorer": "Xem tại Explorer"
38
47
  },
39
- "format": {
40
- "currency": "{{value, currency(currency: USD)}}",
41
- "number": "{{value, number(maximumFractionDigits: 9)}}"
42
- },
43
48
  "header": {
44
- "activeSwaps": "Active swaps",
45
- "bridge": "Bridge",
49
+ "activeTransactions": "Các giao dịch hiện tại",
50
+ "bridge": "Cầu",
46
51
  "checkout": "Thanh toán",
52
+ "exchange": "Hoán đổi",
47
53
  "from": "Swap từ",
48
54
  "gas": "Gas",
49
- "gasSwap": "Gas swap",
50
55
  "payWith": "Thanh toán bằng",
51
56
  "purchase": "Thanh toán",
52
57
  "purchaseDetails": "Thông tin chi tiết",
53
- "routes": "Kết quả",
54
58
  "selectChain": "Chọn chain",
55
59
  "selectWallet": "Chọn ví",
56
60
  "settings": "Cài đặt",
57
61
  "swap": "Swap",
58
- "swapDetails": "Thông tin swap",
59
- "swapHistory": "Lịch sử Swap",
60
62
  "to": "Swap từ",
61
- "walletConnected": "Wallet connected"
62
- },
63
- "language": {
64
- "name": "Tiếng Việt",
65
- "title": "Ngôn ngữ"
66
- },
67
- "settings": {
68
- "enabledBridges": "Số lượng cầu khả dụng",
69
- "enabledExchanges": "Số lượng sàn giao dịch khả dụng",
70
- "gasPrice": {
71
- "fast": "Nhanh",
72
- "normal": "Bình thường",
73
- "slow": "Chậm",
74
- "title": "Giá gas"
75
- },
76
- "routePriority": "Tuyền đường ưu tiên",
77
- "showDestinationWallet": "Hiển thị địa chỉ ví nhận",
78
- "slippage": "Trượt giá"
63
+ "transactionDetails": "Chi tiết giao dịch",
64
+ "transactionHistory": "Lịch sử giao dịch",
65
+ "walletConnected": "Wallet connected",
66
+ "youGet": "Bạn nhận"
79
67
  },
80
68
  "info": {
81
69
  "message": {
82
70
  "autoRefuel": "Gas trên {{chainName}} chain của bạn đang thấp. Để tiếp tục, bạn nên có thêm gas để hoàn thành việc swap.",
83
- "emptyActiveSwaps": "Các lệnh swap đang xử lý sẽ được hiện ở đây. Khi nào lệnh hoàn tất, bạn có thể kiểm tra lại tại mục lịch sử swap.",
84
- "emptySwapHistory": "Lịch sử Swap chỉ được lưu trữ cục bộ và sẽ bị xóa nếu bạn xóa dữ liệu trình duyệt của mình.",
71
+ "emptyActiveTransactions": "Các lệnh swap đang xử lý sẽ được hiện ở đây. Khi nào lệnh hoàn tất, bạn có thể kiểm tra lại tại mục lịch sử swap.",
85
72
  "emptyTokenList": "Chúng tôi không thể tìm được Token ở {{chainName}} chain hoặc số dư của bạn không có. Vui lòng thử tìm kiếm lại hoặc chọn một chain khác.",
73
+ "emptyTransactionHistory": "Lịch sử Swap chỉ được lưu trữ cục bộ và sẽ bị xóa nếu bạn xóa dữ liệu trình duyệt của mình.",
86
74
  "routeNotFound": "Vui lòng chọn lại cặp token khác."
87
75
  },
88
76
  "title": {
89
77
  "autoRefuel": "Thiết lập Gas",
90
- "emptyActiveSwaps": "Swap hiện không hoạt động",
91
- "emptySwapHistory": "Khônglệnh Swap gần đây",
78
+ "emptyActiveTransactions": "Không thông tin giao dịch hiện tại",
79
+ "emptyTransactionHistory": "Chưagiao dịch",
92
80
  "routeNotFound": "Không có đường đi"
93
81
  }
94
82
  },
95
83
  "success": {
96
84
  "message": {
97
- "swapPartiallySuccessful": "Chúng tôi đã cố gắng hoàn thành việc hoán đổi, nhưng {{tool}} đã cạn thanh khoản cho token {{tokenSymbol}}.",
98
- "purchaseSuccessful": "Hiện tại bạn đang nắm giữ {{assetName}} tại ví {{walletAddress}} trên chain {{chainName}}.",
99
- "swapSuccessful": "Hiện tại {{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}} trong ví {{walletAddress}} tại {{chainName}} chain."
85
+ "exchangePartiallySuccessful": "Chúng tôi đã cố gắng hoàn thành việc hoán đổi, nhưng {{tool}} đã cạn thanh khoản cho token {{tokenSymbol}}.",
86
+ "exchangeSuccessful": "Hiện tại {{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}} trong ví {{walletAddress}} tại {{chainName}} chain.",
87
+ "purchaseSuccessful": "Hiện tại bạn đang nắm giữ {{assetName}} tại ví {{walletAddress}} trên chain {{chainName}}."
100
88
  },
101
89
  "title": {
102
- "gasSwapSuccessful": "Gas Swap thành công",
90
+ "bridgePartiallySuccessful": "Swap thành công một phần",
91
+ "bridgeSuccessful": "Bridge thành công",
103
92
  "purchaseSuccessful": "Mua thành công",
104
93
  "refundIssued": "Đã Refund",
105
94
  "swapPartiallySuccessful": "Swap thành công một phần",
@@ -108,8 +97,8 @@
108
97
  },
109
98
  "warning": {
110
99
  "message": {
111
- "deleteActiveSwaps": "Các giao dịch đang hoạt động chỉ được lưu trữ cục bộ và không thể phục hồi nếu bạn xóa chúng.",
112
- "deleteSwapHistory": "Lịch sử Swap chỉ lưu trữ cục bộ và không thể phục hồi khi bạn xoá chúng.",
100
+ "deleteActiveTransactions": "Các giao dịch đang hoạt động chỉ được lưu trữ cục bộ và không thể phục hồi nếu bạn xóa chúng.",
101
+ "deleteTransactionHistory": "Lịch sử Swap chỉ lưu trữ cục bộ và không thể phục hồi khi bạn xoá chúng.",
113
102
  "highValueLoss": "Giá trị của token nhận được đang thấp hơn rất nhiều so với token được swap và chi phí giao dịch.",
114
103
  "insufficientFunds": "Bạn không có đủ tiền để thực hiện tác vụ này.",
115
104
  "insufficientGas": "Bạn không đủ gas để thực hiện swap. Bạn cần thêm ít nhất:",
@@ -117,9 +106,9 @@
117
106
  "resetSettings": "Thao tác này sẽ đặt lại mức độ ưu tiên của tuyến đường, độ trượt giá, giá gas, bridge và sàn giao dịch."
118
107
  },
119
108
  "title": {
120
- "deleteActiveSwaps": "Xoá tất cả các lệnh swap đang hoạt động?",
121
- "deleteSwap": "Xoá lệnh swap?",
122
- "deleteSwapHistory": "Xoá lịch sử Swap?",
109
+ "deleteActiveTransactions": "Xóa tất cả giao dịch đang thực hiện?",
110
+ "deleteTransaction": "Xóa giao dịch này?",
111
+ "deleteTransactionHistory": "Xoá lịch sử giao dịch?",
123
112
  "highValueLoss": "Tổn thất lớn",
124
113
  "insufficientGas": "Không đủ gas",
125
114
  "rateChanged": "Tỉ giá đã thay đổi",
@@ -140,7 +129,6 @@
140
129
  "allowanceRequired": "Sự cho phép không đủ",
141
130
  "balanceIsTooLow": "Số dư quá thấp",
142
131
  "chainSwitch": "Yêu cầu đổi chain",
143
- "failed": "Việc Swap thất bại",
144
132
  "gasLimitIsTooLow": "Giới hạn gas quá thấp",
145
133
  "insufficientFunds": "Không đủ tài sản",
146
134
  "slippageNotMet": "Điều kiện trượt giá không được đáp ứng",
@@ -155,6 +143,19 @@
155
143
  "walletEnsAddressInvalid": "Địa chỉ ví không hợp lệ hoặc mạng lưới không hỗ trợ ENS."
156
144
  }
157
145
  },
146
+ "tooltip": {
147
+ "additionalProviderFee": "Cầu bổ sung, DEX và phí dịch vụ.",
148
+ "estimatedNetworkFee": "Phí mạng ước tính.",
149
+ "estimatedTime": "Thời gian thực hiện lệnh swap (phút).",
150
+ "notFound": {
151
+ "text": "Chúng tôi không thể tìm thấy trang này.",
152
+ "title": "404"
153
+ },
154
+ "numberOfSteps": "Một số bước swap. Mỗi bước có thể chứa 1-2 giao dịch yêu cầu chữ ký.",
155
+ "progressToNextUpdate": "Thông tin hiển thị sẽ tự động làm mới sau {{value}} giây. Bấm vào đây để cập nhật thủ công.",
156
+ "recommended": "Một tuyến đường giá rẻ cân bằng giữa sự phức tạp và dễ sử dụng.",
157
+ "settingsModified": "Thiết lập (Đã điều chỉnh)"
158
+ },
158
159
  "main": {
159
160
  "crossStepDetails": "Chuyển từ {{from}} đến {{to}} thông qua {{tool}}",
160
161
  "currentAmount": "Số lượng hiện tại",
@@ -211,16 +212,16 @@
211
212
  "selectToken": "Chọn Token",
212
213
  "sendToAddress": "Gửi đến {{address}}",
213
214
  "sendToWallet": "Gửi đến địa chỉ khác",
215
+ "sending": "Đang gửi",
214
216
  "sentToAddress": "Gửi đến {{address}}",
215
- "stepBridge": "Bridge",
217
+ "stepBridge": "Cầu",
216
218
  "stepBridgeAndBuy": "Chuyển và mua",
217
219
  "stepDetails": "{{tool}} thông qua LI.FI",
218
220
  "stepSwap": "Swap",
219
221
  "stepSwapAndBridge": "Swap và Bridge",
220
222
  "stepSwapAndBuy": "Hoán đổi và mua",
221
- "supportId": "Support ID",
223
+ "supportId": " ID yêu cầu hỗ trợ",
222
224
  "swapStepDetails": "Swap tại {{chain}} thông qua {{tool}}",
223
- "swapping": "Đang Swap",
224
225
  "tags": {
225
226
  "cheapest": "Rẻ",
226
227
  "fastest": "Nhanh",
@@ -243,18 +244,18 @@
243
244
  "insured": "Bạn đã bảo hiểm <0>{{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}}</0> trong quá trình vận chuyển:",
244
245
  "slippageError": "Lỗi trượt giá đối với token nhận được"
245
246
  },
246
- "tooltip": {
247
- "additionalProviderFee": "Cầu bổ sung, DEX và phí dịch vụ.",
248
- "estimatedNetworkFee": "Phí mạng ước tính.",
249
- "estimatedTime": "Thời gian thực hiện lệnh swap (phút).",
250
- "notFound": {
251
- "text": "Chúng tôi không thể tìm thấy trang này.",
252
- "title": "404"
247
+ "settings": {
248
+ "enabledBridges": "Số lượng cầu khả dụng",
249
+ "enabledExchanges": "Số lượng sàn giao dịch khả dụng",
250
+ "gasPrice": {
251
+ "fast": "Nhanh",
252
+ "normal": "Bình thường",
253
+ "slow": "Chậm",
254
+ "title": "Giá gas"
253
255
  },
254
- "numberOfSteps": "Một số bước swap. Mỗi bước có thể chứa 1-2 giao dịch yêu cầu chữ ký.",
255
- "progressToNextUpdate": "Thông tin hiển thị sẽ tự động làm mới sau {{value}} giây. Bấm vào đây để cập nhật thủ công.",
256
- "recommended": "Một tuyến đường giá rẻ cân bằng giữa sự phức tạp và dễ sử dụng.",
257
- "settingsModified": "Thiết lập (Đã điều chỉnh)"
256
+ "routePriority": "Tuyền đường ưu tiên",
257
+ "showDestinationWallet": "Hiển thị địa chỉ nhận",
258
+ "slippage": "Trượt giá"
258
259
  },
259
260
  "wallet": {
260
261
  "extensionNotFound": "Chắc chắn rằng tiện ích trên trình duyệt {{name}} đã được kích hoạt tước khi chọn ví này."
@@ -8,7 +8,6 @@ const react_1 = require("react");
8
8
  const react_i18next_1 = require("react-i18next");
9
9
  const ActiveTransactions_1 = require("../../components/ActiveTransactions");
10
10
  const Dialog_1 = require("../../components/Dialog");
11
- const Header_1 = require("../../components/Header");
12
11
  const providers_1 = require("../../providers");
13
12
  const stores_1 = require("../../stores");
14
13
  const ActiveTransactionsEmpty_1 = require("./ActiveTransactionsEmpty");
@@ -17,15 +16,16 @@ const ActiveTransactionsPage = () => {
17
16
  const { account } = (0, providers_1.useWallet)();
18
17
  const executingRoutes = (0, stores_1.useExecutingRoutesIds)(account.address);
19
18
  const deleteRoutes = (0, stores_1.useRouteExecutionStore)((store) => store.deleteRoutes);
19
+ const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
20
20
  const [open, setOpen] = (0, react_1.useState)(false);
21
21
  const toggleDialog = (0, react_1.useCallback)(() => {
22
22
  setOpen((open) => !open);
23
23
  }, []);
24
24
  (0, react_1.useEffect)(() => {
25
25
  if (executingRoutes.length) {
26
- return Header_1.useHeaderStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
26
+ return headerStoreContext.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
27
27
  }
28
- }, [executingRoutes.length, toggleDialog]);
28
+ }, [executingRoutes.length, headerStoreContext, toggleDialog]);
29
29
  if (!executingRoutes.length) {
30
30
  return (0, jsx_runtime_1.jsx)(ActiveTransactionsEmpty_1.ActiveTransactionsEmpty, {});
31
31
  }
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RoutesPage = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const Header_1 = require("../../components/Header");
7
6
  const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
8
7
  const RouteCard_1 = require("../../components/RouteCard");
9
8
  const hooks_1 = require("../../hooks");
@@ -14,6 +13,7 @@ const RoutesPage = () => {
14
13
  const { navigateBack, navigate } = (0, hooks_1.useNavigateBack)();
15
14
  const { routes, isLoading, isFetching, dataUpdatedAt, refetchTime, refetch } = (0, hooks_1.useRoutes)();
16
15
  const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
16
+ const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
17
17
  const handleRouteClick = (route) => {
18
18
  setExecutableRoute(route);
19
19
  navigate(utils_1.navigationRoutes.transactionExecution, {
@@ -28,10 +28,10 @@ const RoutesPage = () => {
28
28
  // eslint-disable-next-line react-hooks/exhaustive-deps
29
29
  }, []);
30
30
  (0, react_1.useEffect)(() => {
31
- return Header_1.useHeaderStore
31
+ return headerStoreContext
32
32
  .getState()
33
33
  .setAction((0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
34
- }, [dataUpdatedAt, isFetching, refetch, refetchTime]);
34
+ }, [dataUpdatedAt, headerStoreContext, isFetching, refetch, refetchTime]);
35
35
  const routeNotFound = !routes?.length && !isLoading && !isFetching;
36
36
  return ((0, jsx_runtime_1.jsx)(RoutesPage_style_1.Stack, { direction: "column", spacing: 2, flex: 1, children: routeNotFound ? ((0, jsx_runtime_1.jsx)(RouteCard_1.RouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(RouteCard_1.RouteCardSkeleton, {}, index)))) : (routes?.map((route, index) => ((0, jsx_runtime_1.jsx)(RouteCard_1.RouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, expanded: routes?.length <= 2 }, route.id)))) }));
37
37
  };
@@ -7,7 +7,6 @@ const CheckBoxOutlineBlankOutlined_1 = require("@mui/icons-material/CheckBoxOutl
7
7
  const CheckBoxOutlined_1 = require("@mui/icons-material/CheckBoxOutlined");
8
8
  const IndeterminateCheckBoxOutlined_1 = require("@mui/icons-material/IndeterminateCheckBoxOutlined");
9
9
  const material_1 = require("@mui/material");
10
- const Header_1 = require("../../components/Header");
11
10
  const react_1 = require("react");
12
11
  const shallow_1 = require("zustand/shallow");
13
12
  const ListItemText_1 = require("../../components/ListItemText");
@@ -18,6 +17,7 @@ const SelectEnabledToolsPage = ({ type }) => {
18
17
  const typeKey = type.toLowerCase();
19
18
  const { tools } = (0, hooks_1.useTools)();
20
19
  const [enabledTools, setTools] = (0, stores_1.useSettingsStore)((state) => [state[`enabled${type}`], state.setTools], shallow_1.shallow);
20
+ const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
21
21
  const handleClick = (key) => {
22
22
  if (!tools) {
23
23
  return;
@@ -44,8 +44,8 @@ const SelectEnabledToolsPage = ({ type }) => {
44
44
  setTools(type, toolKeys, toolKeys);
45
45
  }
46
46
  };
47
- return Header_1.useHeaderStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleCheckboxes, children: allToolsSelected ? ((0, jsx_runtime_1.jsx)(CheckBoxOutlined_1.default, {})) : enabledTools.length ? ((0, jsx_runtime_1.jsx)(IndeterminateCheckBoxOutlined_1.default, {})) : ((0, jsx_runtime_1.jsx)(CheckBoxOutlineBlankOutlined_1.default, {})) }));
48
- }, [enabledTools.length, setTools, tools, type, typeKey]);
47
+ return headerStoreContext.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleCheckboxes, children: allToolsSelected ? ((0, jsx_runtime_1.jsx)(CheckBoxOutlined_1.default, {})) : enabledTools.length ? ((0, jsx_runtime_1.jsx)(IndeterminateCheckBoxOutlined_1.default, {})) : ((0, jsx_runtime_1.jsx)(CheckBoxOutlineBlankOutlined_1.default, {})) }));
48
+ }, [enabledTools.length, headerStoreContext, setTools, tools, type, typeKey]);
49
49
  return ((0, jsx_runtime_1.jsx)(material_1.Container, { disableGutters: true, children: (0, jsx_runtime_1.jsx)(material_1.List, { sx: {
50
50
  paddingLeft: 1.5,
51
51
  paddingRight: 1.5,
@@ -0,0 +1,5 @@
1
+ interface ContactSupportButtonProps {
2
+ supportId?: string;
3
+ }
4
+ export declare const ContactSupportButton: ({ supportId, }: ContactSupportButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContactSupportButton = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const react_i18next_1 = require("react-i18next");
7
+ const hooks_1 = require("../../hooks/");
8
+ const events_1 = require("../../types/events");
9
+ const ContactSupportButton = ({ supportId, }) => {
10
+ const { t } = (0, react_i18next_1.useTranslation)();
11
+ const widgetEvents = (0, hooks_1.useWidgetEvents)();
12
+ const handleClick = () => {
13
+ if (!widgetEvents.all.has(events_1.WidgetEvent.RouteContactSupport)) {
14
+ const url = 'https://discord.gg/lifi';
15
+ const target = '_blank';
16
+ const rel = 'nofollow noreferrer';
17
+ window.open(url, target, rel);
18
+ }
19
+ else {
20
+ widgetEvents.emit(events_1.WidgetEvent.RouteContactSupport, { supportId });
21
+ }
22
+ };
23
+ return ((0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleClick, fullWidth: true, children: t('button.contactSupport') }));
24
+ };
25
+ exports.ContactSupportButton = ContactSupportButton;
@@ -12,13 +12,13 @@ const shallow_1 = require("zustand/shallow");
12
12
  const Card_1 = require("../../components/Card");
13
13
  const ContractComponent_1 = require("../../components/ContractComponent");
14
14
  const Dialog_1 = require("../../components/Dialog");
15
- const Header_1 = require("../../components/Header");
16
15
  const Insurance_1 = require("../../components/Insurance");
17
16
  const Step_1 = require("../../components/Step");
18
17
  const hooks_1 = require("../../hooks");
19
18
  const providers_1 = require("../../providers");
20
19
  const stores_1 = require("../../stores");
21
20
  const utils_1 = require("../../utils");
21
+ const ContactSupportButton_1 = require("./ContactSupportButton");
22
22
  const TransactionDetailsPage_style_1 = require("./TransactionDetailsPage.style");
23
23
  const TransactionDetailsPage = () => {
24
24
  const { t, i18n } = (0, react_i18next_1.useTranslation)();
@@ -26,6 +26,7 @@ const TransactionDetailsPage = () => {
26
26
  const { subvariant, contractComponent, contractSecondaryComponent } = (0, providers_1.useWidgetConfig)();
27
27
  const { state } = (0, react_router_dom_1.useLocation)();
28
28
  const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state?.routeId], store.deleteRoute], shallow_1.shallow);
29
+ const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
29
30
  const [open, setOpen] = (0, react_1.useState)(false);
30
31
  const toggleDialog = (0, react_1.useCallback)(() => {
31
32
  setOpen((open) => !open);
@@ -48,8 +49,8 @@ const TransactionDetailsPage = () => {
48
49
  await navigator.clipboard.writeText(supportId);
49
50
  };
50
51
  (0, react_1.useEffect)(() => {
51
- return Header_1.useHeaderStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
52
- }, [toggleDialog]);
52
+ return headerStoreContext.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
53
+ }, [headerStoreContext, toggleDialog]);
53
54
  const startedAt = new Date(routeExecution?.route.steps[0].execution?.process[0].startedAt ?? 0);
54
55
  return ((0, jsx_runtime_1.jsxs)(TransactionDetailsPage_style_1.Container, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
55
56
  display: 'flex',
@@ -60,6 +61,6 @@ const TransactionDetailsPage = () => {
60
61
  }).format(startedAt) })] }), (0, Step_1.getStepList)(routeExecution?.route, subvariant), subvariant === 'nft' ? ((0, jsx_runtime_1.jsx)(ContractComponent_1.ContractComponent, { mt: 2, children: contractSecondaryComponent || contractComponent })) : null, routeExecution?.route?.insurance?.state === 'INSURED' ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: routeExecution.status, feeAmountUsd: routeExecution.route.insurance.feeAmountUsd, insuredAmount: (0, utils_1.formatTokenAmount)(routeExecution.route.toAmountMin, routeExecution.route.toToken.decimals), insuredTokenSymbol: routeExecution.route.toToken.symbol, insurableRouteId: routeExecution.route.id, insuranceCoverageId: insuranceCoverageId })) : null, (0, jsx_runtime_1.jsxs)(Card_1.Card, { mt: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
61
62
  display: 'flex',
62
63
  flex: 1,
63
- }, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { flex: 1, children: t('main.supportId') }), (0, jsx_runtime_1.jsx)(material_1.Box, { mr: 1, mt: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: copySupportId, children: (0, jsx_runtime_1.jsx)(ContentCopyRounded_1.default, { fontSize: "small" }) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' }, children: supportId })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(material_1.Button, { href: "https://discord.gg/lifi", target: "_blank", rel: "nofollow noreferrer", fullWidth: true, children: t('button.contactSupport') }) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: open, onClose: toggleDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('warning.title.deleteTransaction') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('warning.message.deleteTransactionHistory') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: toggleDialog, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: handleDeleteRoute, autoFocus: true, children: t('button.delete') })] })] })] }));
64
+ }, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { flex: 1, children: t('main.supportId') }), (0, jsx_runtime_1.jsx)(material_1.Box, { mr: 1, mt: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: copySupportId, children: (0, jsx_runtime_1.jsx)(ContentCopyRounded_1.default, { fontSize: "small" }) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' }, children: supportId })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(ContactSupportButton_1.ContactSupportButton, { supportId: supportId }) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: open, onClose: toggleDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('warning.title.deleteTransaction') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('warning.message.deleteTransactionHistory') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: toggleDialog, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: handleDeleteRoute, autoFocus: true, children: t('button.delete') })] })] })] }));
64
65
  };
65
66
  exports.TransactionDetailsPage = TransactionDetailsPage;
@@ -7,7 +7,6 @@ const material_1 = require("@mui/material");
7
7
  const react_1 = require("react");
8
8
  const react_i18next_1 = require("react-i18next");
9
9
  const Dialog_1 = require("../../components/Dialog");
10
- const Header_1 = require("../../components/Header");
11
10
  const providers_1 = require("../../providers");
12
11
  const stores_1 = require("../../stores");
13
12
  const routes_1 = require("../../stores/routes");
@@ -17,6 +16,7 @@ const TransactionHistoryPage = () => {
17
16
  const { t } = (0, react_i18next_1.useTranslation)();
18
17
  const { account } = (0, providers_1.useWallet)();
19
18
  const transactions = (0, routes_1.useTransactionHistory)(account.address);
19
+ const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
20
20
  const deleteRoutes = (0, stores_1.useRouteExecutionStore)((store) => store.deleteRoutes);
21
21
  const [open, setOpen] = (0, react_1.useState)(false);
22
22
  const toggleDialog = (0, react_1.useCallback)(() => {
@@ -24,9 +24,9 @@ const TransactionHistoryPage = () => {
24
24
  }, []);
25
25
  (0, react_1.useEffect)(() => {
26
26
  if (transactions.length) {
27
- return Header_1.useHeaderStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
27
+ return headerStoreContext.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
28
28
  }
29
- }, [transactions.length, toggleDialog]);
29
+ }, [transactions.length, toggleDialog, headerStoreContext]);
30
30
  if (!transactions.length) {
31
31
  return (0, jsx_runtime_1.jsx)(TransactionHistoryEmpty_1.TransactionHistoryEmpty, {});
32
32
  }
@@ -10,7 +10,6 @@ const react_i18next_1 = require("react-i18next");
10
10
  const react_router_dom_1 = require("react-router-dom");
11
11
  const ContractComponent_1 = require("../../components/ContractComponent");
12
12
  const GasMessage_1 = require("../../components/GasMessage");
13
- const Header_1 = require("../../components/Header");
14
13
  const Insurance_1 = require("../../components/Insurance");
15
14
  const Step_1 = require("../../components/Step");
16
15
  const hooks_1 = require("../../hooks");
@@ -31,6 +30,7 @@ const TransactionPage = () => {
31
30
  const { navigateBack } = (0, hooks_1.useNavigateBack)();
32
31
  const { subvariant, insurance, contractComponent, contractSecondaryComponent, } = (0, providers_1.useWidgetConfig)();
33
32
  const { state } = (0, react_router_dom_1.useLocation)();
33
+ const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
34
34
  const stateRouteId = state?.routeId;
35
35
  const [routeId, setRouteId] = (0, react_1.useState)(stateRouteId);
36
36
  const tokenValueBottomSheetRef = (0, react_1.useRef)(null);
@@ -45,13 +45,13 @@ const TransactionPage = () => {
45
45
  (0, react_1.useEffect)(() => {
46
46
  if (route && subvariant !== 'nft') {
47
47
  const transactionType = route.fromChainId === route.toChainId ? 'Swap' : 'Bridge';
48
- return Header_1.useHeaderStore
48
+ return headerStoreContext
49
49
  .getState()
50
50
  .setTitle(status === stores_1.RouteExecutionStatus.Idle
51
51
  ? t(`button.review${transactionType}`)
52
52
  : t(`header.${transactionType.toLowerCase()}`));
53
53
  }
54
- }, [route, status, subvariant, t]);
54
+ }, [headerStoreContext, route, status, subvariant, t]);
55
55
  if (!route) {
56
56
  return null;
57
57
  }
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StoreProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const header_1 = require("./header");
5
6
  const routes_1 = require("./routes");
6
7
  const settings_1 = require("./settings");
7
8
  const StoreProvider = ({ children, config, }) => {
8
- return ((0, jsx_runtime_1.jsx)(settings_1.SplitSubvariantStoreProvider, { state: config.subvariant === 'split' ? 'swap' : undefined, children: (0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: children }) }));
9
+ return ((0, jsx_runtime_1.jsx)(settings_1.SplitSubvariantStoreProvider, { state: config.subvariant === 'split' ? 'swap' : undefined, children: (0, jsx_runtime_1.jsx)(header_1.HeaderStoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: (0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: children }) }) }));
9
10
  };
10
11
  exports.StoreProvider = StoreProvider;
@@ -0,0 +1 @@
1
+ export * from './useHeaderStore';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./useHeaderStore"), exports);
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
- export interface HeaderState {
2
+ import type { StoreApi, UseBoundStore } from 'zustand';
3
+ export type HeaderStore = UseBoundStore<StoreApi<HeaderState>>;
4
+ export interface HeaderStateBase {
3
5
  element?: React.ReactNode | null;
4
6
  title?: string;
5
7
  }
6
- export interface HeaderStore extends HeaderState {
8
+ export interface HeaderState extends HeaderStateBase {
7
9
  setAction(element?: React.ReactNode | null): () => void;
8
10
  setTitle(title?: string): () => void;
9
11
  removeAction(): void;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { PersistStoreProps, PersistStoreProviderProps } from '../types';
3
+ import type { HeaderState, HeaderStore } from './types';
4
+ export declare const HeaderStoreContext: import("react").Context<HeaderStore | null>;
5
+ export declare function HeaderStoreProvider({ children, ...props }: PersistStoreProviderProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function useHeaderStore<T>(selector: (state: HeaderState) => T, equalityFn?: (left: T, right: T) => boolean): T;
7
+ export declare function useHeaderStoreContext(): HeaderStore;
8
+ export declare const createHeaderStore: ({ namePrefix }: PersistStoreProps) => import("zustand").UseBoundStore<import("zustand").StoreApi<HeaderState>>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHeaderStore = exports.useHeaderStoreContext = exports.useHeaderStore = exports.HeaderStoreProvider = exports.HeaderStoreContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const zustand_1 = require("zustand");
7
+ exports.HeaderStoreContext = (0, react_1.createContext)(null);
8
+ function HeaderStoreProvider({ children, ...props }) {
9
+ const storeRef = (0, react_1.useRef)();
10
+ if (!storeRef.current) {
11
+ storeRef.current = (0, exports.createHeaderStore)(props);
12
+ }
13
+ return ((0, jsx_runtime_1.jsx)(exports.HeaderStoreContext.Provider, { value: storeRef.current, children: children }));
14
+ }
15
+ exports.HeaderStoreProvider = HeaderStoreProvider;
16
+ function useHeaderStore(selector, equalityFn) {
17
+ const useStore = (0, react_1.useContext)(exports.HeaderStoreContext);
18
+ if (!useStore) {
19
+ throw new Error(`You forgot to wrap your component in <${HeaderStoreProvider.name}>.`);
20
+ }
21
+ return useStore(selector, equalityFn);
22
+ }
23
+ exports.useHeaderStore = useHeaderStore;
24
+ function useHeaderStoreContext() {
25
+ const useStore = (0, react_1.useContext)(exports.HeaderStoreContext);
26
+ if (!useStore) {
27
+ throw new Error(`You forgot to wrap your component in <${HeaderStoreProvider.name}>.`);
28
+ }
29
+ return useStore;
30
+ }
31
+ exports.useHeaderStoreContext = useHeaderStoreContext;
32
+ const createHeaderStore = ({ namePrefix }) => (0, zustand_1.create)((set, get) => ({
33
+ setAction: (element) => {
34
+ set(() => ({
35
+ element,
36
+ }));
37
+ return get().removeAction;
38
+ },
39
+ setTitle: (title) => {
40
+ set(() => ({
41
+ title,
42
+ }));
43
+ return get().removeTitle;
44
+ },
45
+ removeAction: () => {
46
+ set(() => ({
47
+ element: null,
48
+ }));
49
+ },
50
+ removeTitle: () => {
51
+ set(() => ({
52
+ title: undefined,
53
+ }));
54
+ },
55
+ }));
56
+ exports.createHeaderStore = createHeaderStore;
@@ -1,4 +1,5 @@
1
+ export * from './StoreProvider';
1
2
  export * from './chains';
3
+ export * from './header';
2
4
  export * from './routes';
3
5
  export * from './settings';
4
- export * from './StoreProvider';
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./StoreProvider"), exports);
17
18
  __exportStar(require("./chains"), exports);
19
+ __exportStar(require("./header"), exports);
18
20
  __exportStar(require("./routes"), exports);
19
21
  __exportStar(require("./settings"), exports);
20
- __exportStar(require("./StoreProvider"), exports);
@@ -4,7 +4,8 @@ export declare enum WidgetEvent {
4
4
  RouteExecutionUpdated = "routeExecutionUpdated",
5
5
  RouteExecutionCompleted = "routeExecutionCompleted",
6
6
  RouteExecutionFailed = "routeExecutionFailed",
7
- RouteHighValueLoss = "routeHighValueLoss"
7
+ RouteHighValueLoss = "routeHighValueLoss",
8
+ RouteContactSupport = "routeContactSupport"
8
9
  }
9
10
  export type WidgetEvents = {
10
11
  routeExecutionStarted: Route;
@@ -12,7 +13,11 @@ export type WidgetEvents = {
12
13
  routeExecutionCompleted: Route;
13
14
  routeExecutionFailed: RouteExecutionUpdate;
14
15
  routeHighValueLoss: RouteHighValueLossUpdate;
16
+ routeContactSupport: RouteContactSupport;
15
17
  };
18
+ export interface RouteContactSupport {
19
+ supportId?: string;
20
+ }
16
21
  export interface RouteHighValueLossUpdate {
17
22
  fromAmountUsd: string;
18
23
  gasCostUSD?: string;
@@ -8,4 +8,5 @@ var WidgetEvent;
8
8
  WidgetEvent["RouteExecutionCompleted"] = "routeExecutionCompleted";
9
9
  WidgetEvent["RouteExecutionFailed"] = "routeExecutionFailed";
10
10
  WidgetEvent["RouteHighValueLoss"] = "routeHighValueLoss";
11
+ WidgetEvent["RouteContactSupport"] = "routeContactSupport";
11
12
  })(WidgetEvent || (exports.WidgetEvent = WidgetEvent = {}));