tek-wallet 0.0.415 → 0.0.417

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.
@@ -121,6 +121,7 @@ var type_1 = require("../ConfirmLayout/type");
121
121
  var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
122
122
  var LineValue_1 = __importDefault(require("../LineValue"));
123
123
  var send_external_service_1 = __importDefault(require("../../../services/axios/send-external-service"));
124
+ var useRealtime_1 = __importDefault(require("../../../hooks/useRealtime"));
124
125
  var SendMethods;
125
126
  (function (SendMethods) {
126
127
  SendMethods["SCAN_QR_CODE"] = "scan qr code";
@@ -150,6 +151,7 @@ var AmountError;
150
151
  })(AmountError || (exports.AmountError = AmountError = {}));
151
152
  var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
152
153
  var _a, _b;
154
+ var pushNotification = (0, useRealtime_1.default)().pushNotification;
153
155
  var drawerRef = (0, react_1.useRef)(null);
154
156
  var swiperRef = (0, react_1.useRef)(null);
155
157
  var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
@@ -201,6 +203,13 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
201
203
  return undefined;
202
204
  return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
203
205
  }, [estimateFee, amount]);
206
+ var testPushNotification = function () {
207
+ pushNotification({
208
+ message: "Test notification",
209
+ type: "success",
210
+ id: "test-notification",
211
+ });
212
+ };
204
213
  (0, react_1.useEffect)(function () {
205
214
  setTimeout(function () {
206
215
  var _a;
@@ -550,11 +559,12 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
550
559
  });
551
560
  }); };
552
561
  var handleSendExternal = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
553
- var response;
562
+ var response, err_1;
554
563
  var _a, _b;
555
564
  return __generator(this, function (_c) {
556
565
  switch (_c.label) {
557
566
  case 0:
567
+ _c.trys.push([0, 2, , 3]);
558
568
  console.warn("withdraw external");
559
569
  setSendButtonStatus(Button_1.BUTTON_STATUS.LOADING);
560
570
  return [4 /*yield*/, (0, send_external_service_1.default)({
@@ -574,12 +584,18 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
574
584
  (_b = props.onSendSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
575
585
  }
576
586
  else {
577
- setSendButtonStatus(Button_1.BUTTON_STATUS.ERROR);
578
- setTimeout(function () {
579
- setSendButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
580
- }, 1200);
587
+ throw new Error("Send external failed");
581
588
  }
582
- return [2 /*return*/];
589
+ return [3 /*break*/, 3];
590
+ case 2:
591
+ err_1 = _c.sent();
592
+ console.error(err_1);
593
+ setSendButtonStatus(Button_1.BUTTON_STATUS.ERROR);
594
+ setTimeout(function () {
595
+ setSendButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
596
+ }, 1200);
597
+ return [3 /*break*/, 3];
598
+ case 3: return [2 /*return*/];
583
599
  }
584
600
  });
585
601
  }); };
@@ -620,13 +636,13 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
620
636
  : WITHDRAW_STEP_NAME[currentStep], children: (0, jsx_runtime_1.jsx)(CloseModal_1.default, { sx: { marginLeft: "auto" }, onClick: close }) }), children: [(0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: {
621
637
  autoHeight: true,
622
638
  spaceBetween: 32,
623
- }, disableSwipe: true, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { height: "fit-content" }), children: Object.values(SendMethods).map(function (item, index) {
624
- return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index !== 0 && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: item, description: item, icon: (0, getIcon_1.default)(item + "_icon"), onClick: function () {
625
- return handleSelectMethod(item);
626
- }, sx: {
627
- my: theme.mixins.customMargin.m12,
628
- } })] }, item));
629
- }) }) }, WithdrawStep.SELECT_METHOD), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: withdrawToken === null || withdrawToken === void 0 ? void 0 : withdrawToken.map(function (item) {
639
+ }, disableSwipe: true, children: [(0, jsx_runtime_1.jsxs)(react_2.SwiperSlide, { children: [(0, jsx_runtime_1.jsxs)(Button_1.default.Primary, { onClick: testPushNotification, children: [" ", "Push"] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { height: "fit-content" }), children: Object.values(SendMethods).map(function (item, index) {
640
+ return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index !== 0 && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: item, description: item, icon: (0, getIcon_1.default)(item + "_icon"), onClick: function () {
641
+ return handleSelectMethod(item);
642
+ }, sx: {
643
+ my: theme.mixins.customMargin.m12,
644
+ } })] }, item));
645
+ }) })] }, WithdrawStep.SELECT_METHOD), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: withdrawToken === null || withdrawToken === void 0 ? void 0 : withdrawToken.map(function (item) {
630
646
  var stringifiedTokenData = JSON.stringify(item);
631
647
  if (!item)
632
648
  return null;
@@ -0,0 +1,3 @@
1
+ import { RealtimeProviderDataType } from "../providers/RealtimeProvider/type";
2
+ declare function useRealtime(): RealtimeProviderDataType;
3
+ export default useRealtime;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var react_1 = require("react");
4
+ var RealtimeProvider_1 = require("../providers/RealtimeProvider");
5
+ function useRealtime() {
6
+ try {
7
+ var data = (0, react_1.useContext)(RealtimeProvider_1.RealtimeContext);
8
+ return data;
9
+ }
10
+ catch (error) {
11
+ console.error("🚀 ~ useRealtime ~ error:", error);
12
+ return RealtimeProvider_1.initialRealtime;
13
+ }
14
+ }
15
+ exports.default = useRealtime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.415",
3
+ "version": "0.0.417",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",