tek-wallet 0.0.501 → 0.0.503

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.
@@ -3,9 +3,10 @@ interface ActivitiesProps extends GeneralProps {
3
3
  onClose?: UnknownFunction;
4
4
  onOpen?: UnknownFunction;
5
5
  }
6
- type ActivitiesRef = {
6
+ export type ActivitiesRef = {
7
7
  open: () => void;
8
8
  close: () => void;
9
+ openTab: (index: number) => void;
9
10
  };
10
11
  declare const Activities: import("react").ForwardRefExoticComponent<ActivitiesProps & import("react").RefAttributes<ActivitiesRef>>;
11
12
  export default Activities;
@@ -52,6 +52,7 @@ var ActivitiesTypeSlice_1 = __importDefault(require("../ActivitiesTypeSlice"));
52
52
  var Activities = (0, react_1.forwardRef)(function (props, ref) {
53
53
  var drawerRef = (0, react_1.useRef)(null);
54
54
  var theme = (0, material_1.useTheme)();
55
+ var swiperRef = (0, react_1.useRef)(null);
55
56
  var activityTypes = (0, useActivities_1.default)().activityTypes;
56
57
  var open = function () {
57
58
  var _a;
@@ -61,9 +62,17 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
61
62
  var _a;
62
63
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
63
64
  };
65
+ var openTab = function (index) {
66
+ var _a;
67
+ open();
68
+ if (!swiperRef.current)
69
+ return;
70
+ (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(index);
71
+ };
64
72
  (0, react_1.useImperativeHandle)(ref, function () { return ({
65
73
  open: open,
66
74
  close: close,
75
+ openTab: openTab,
67
76
  }); });
68
77
  var handleOnClose = function () {
69
78
  var _a;
@@ -73,7 +82,7 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
73
82
  close();
74
83
  handleOnClose();
75
84
  };
76
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { disableSwipe: true, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities", overrideBack: handleBack }), children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: { height: "100%", paddingTop: 0 }, children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { swiperProps: {
85
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { disableSwipe: true, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities", overrideBack: handleBack }), children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: { height: "100%", paddingTop: 0 }, children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: {
77
86
  slidesPerView: 1,
78
87
  spaceBetween: 40,
79
88
  }, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
@@ -102,6 +102,7 @@ var Icon_1 = __importDefault(require("../Icon"));
102
102
  var Fees_1 = __importDefault(require("../Fees"));
103
103
  var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
104
104
  var type_1 = require("../../../services/axios/get-activities-service/type");
105
+ var Activities_1 = __importDefault(require("../Activities"));
105
106
  var SendExternalTokenError;
106
107
  (function (SendExternalTokenError) {
107
108
  SendExternalTokenError["TOKEN_NOT_FOUND"] = "Token not found";
@@ -123,6 +124,7 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
123
124
  var _e = (0, react_1.useState)(Button_1.BUTTON_STATUS.ENABLED), buttonStatus = _e[0], setButtonStatus = _e[1];
124
125
  var _f = (0, react_1.useState)(props.initFeeData), estimateFee = _f[0], setEstimateFee = _f[1];
125
126
  var _g = (0, react_1.useState)(false), isLoadingEstimateFee = _g[0], setIsLoadingEstimateFee = _g[1];
127
+ var activitiesRef = (0, react_1.useRef)(null);
126
128
  var amount = props.sendExternalData.amount;
127
129
  var network = props.sendExternalData.network;
128
130
  var memo = props.sendExternalData.memo;
@@ -189,6 +191,10 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
189
191
  (_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
190
192
  setButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
191
193
  (_b = props.onSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
194
+ setTimeout(function () {
195
+ var _a;
196
+ (_a = activitiesRef.current) === null || _a === void 0 ? void 0 : _a.openTab(0);
197
+ }, 200);
192
198
  }
193
199
  else {
194
200
  throw new Error("Send external failed");
@@ -233,12 +239,12 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
233
239
  (0, react_1.useEffect)(function () {
234
240
  validateAmount(props.sendExternalData);
235
241
  }, [validateAmount, props.sendExternalData]);
236
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
237
- wordBreak: "break-all",
238
- }, children: toAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Network", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6, ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, src: network === null || network === void 0 ? void 0 : network.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: network === null || network === void 0 ? void 0 : network.name })] }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), !!memo && (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee), amount: +amount })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
239
- fontWeight: theme.typography.fontWeight600,
240
- fontSize: theme.typography.fontSize16,
241
- }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.gaps.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendExternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
242
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
243
+ wordBreak: "break-all",
244
+ }, children: toAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Network", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6, ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, src: network === null || network === void 0 ? void 0 : network.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: network === null || network === void 0 ? void 0 : network.name })] }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), !!memo && (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee), amount: +amount })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
245
+ fontWeight: theme.typography.fontWeight600,
246
+ fontSize: theme.typography.fontSize16,
247
+ }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.gaps.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendExternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }), (0, jsx_runtime_1.jsx)(Activities_1.default, { ref: activitiesRef })] }) }));
242
248
  });
243
249
  SendExternalToken.displayName = "SendExternalToken";
244
250
  exports.default = SendExternalToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.501",
3
+ "version": "0.0.503",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",