tek-wallet 0.0.107 → 0.0.110

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.
@@ -60,6 +60,9 @@ var react_2 = require("react");
60
60
  var Text_1 = __importDefault(require("../../../components/ui/Text"));
61
61
  var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
62
62
  var material_1 = require("@mui/material");
63
+ var Button_1 = __importDefault(require("../../ui/Button"));
64
+ var Icon_1 = __importDefault(require("../../ui/Icon"));
65
+ var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
63
66
  var GetSeedPhraseWalletViewStep;
64
67
  (function (GetSeedPhraseWalletViewStep) {
65
68
  GetSeedPhraseWalletViewStep[GetSeedPhraseWalletViewStep["ENTER_PASSCODE"] = 0] = "ENTER_PASSCODE";
@@ -68,26 +71,38 @@ var GetSeedPhraseWalletViewStep;
68
71
  var passcodeLength = 6;
69
72
  var GetSeedPhraseWalletView = function (props) {
70
73
  var _a = (0, react_2.useState)(""), otp = _a[0], setOtp = _a[1];
74
+ var _b = (0, react_2.useState)(false), isShowSeedPhrase = _b[0], setIsShowSeedPhrase = _b[1];
75
+ var _c = (0, react_2.useState)(undefined), seedPhrase = _c[0], setSeedPhrase = _c[1];
71
76
  var swiperControlledRef = (0, react_2.useRef)(null);
72
77
  var childPageLayoutRef = (0, react_2.useRef)(null);
73
- var _b = (0, react_2.useState)(GetSeedPhraseWalletViewStep.ENTER_PASSCODE), currentStep = _b[0], setCurrentStep = _b[1];
78
+ var _d = (0, react_2.useState)(GetSeedPhraseWalletViewStep.ENTER_PASSCODE), currentStep = _d[0], setCurrentStep = _d[1];
74
79
  var getSeedPhrase = (0, useWalletData_1.default)().getSeedPhrase;
75
80
  var gotoStep = function (step) {
76
81
  var _a;
77
82
  setCurrentStep(step);
78
83
  (_a = swiperControlledRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(step);
79
84
  };
80
- var clearInputsValue = function () {
85
+ var clearValues = function () {
81
86
  setOtp("");
87
+ setSeedPhrase(undefined);
88
+ };
89
+ var toggleShowSeedPhrase = function () {
90
+ setIsShowSeedPhrase(!isShowSeedPhrase);
91
+ };
92
+ var handleDone = function () {
93
+ props.onBack();
94
+ clearValues();
82
95
  };
83
96
  var handleBack = function () {
84
97
  switch (currentStep) {
85
98
  case GetSeedPhraseWalletViewStep.SHOW_SEED_PHRASE:
86
- gotoStep(GetSeedPhraseWalletViewStep.ENTER_PASSCODE);
99
+ // gotoStep(GetSeedPhraseWalletViewStep.ENTER_PASSCODE);
100
+ props.onBack();
101
+ clearValues();
87
102
  break;
88
103
  case GetSeedPhraseWalletViewStep.ENTER_PASSCODE:
89
104
  props.onBack();
90
- clearInputsValue();
105
+ clearValues();
91
106
  break;
92
107
  default:
93
108
  break;
@@ -111,37 +126,56 @@ var GetSeedPhraseWalletView = function (props) {
111
126
  passcode: value,
112
127
  }, function () {
113
128
  var _a;
129
+ console.warn("🚀 ~ handleOtpChange ~ start");
114
130
  (_a = childPageLayoutRef.current) === null || _a === void 0 ? void 0 : _a.showLoading();
115
- }, function () {
116
- var _a;
117
- (_a = childPageLayoutRef.current) === null || _a === void 0 ? void 0 : _a.showSuccess();
131
+ }, function (data) {
132
+ var _a, _b;
133
+ setSeedPhrase((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.seed_pharse);
134
+ (_b = childPageLayoutRef.current) === null || _b === void 0 ? void 0 : _b.showSuccess();
135
+ setTimeout(function () {
136
+ var _a;
137
+ (_a = childPageLayoutRef.current) === null || _a === void 0 ? void 0 : _a.showNormal();
138
+ gotoStep(GetSeedPhraseWalletViewStep.SHOW_SEED_PHRASE);
139
+ }, 1000);
118
140
  }, handleCreateWalletError);
119
141
  console.warn("🚀 ~ handleOtpChange ~ response:", response);
120
142
  }
121
143
  };
122
- return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { ref: childPageLayoutRef, header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { overrideBack: handleBack, title: "Passcode" }), children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: __assign({ display: "flex", flexDirection: "column", gap: "1rem", height: "100%" }, props.sx), children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperControlledRef, disableSwipe: true, sx: { height: "100%" }, children: [(0, jsx_runtime_1.jsx)(react_1.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
123
- display: "flex",
124
- flexDirection: "column",
125
- justifyContent: "center",
126
- alignItems: "center",
127
- height: "100%",
144
+ return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { ref: childPageLayoutRef, header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { overrideBack: handleBack, title: "Passcode" }), children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: __assign({ display: "flex", flexDirection: "column", gap: "1rem", height: "100%" }, props.sx), children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperControlledRef, disableSwipe: true, sx: { height: "100%" }, children: [(0, jsx_runtime_1.jsx)(react_1.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { height: "100%" }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
145
+ display: "flex",
146
+ flexDirection: "column",
147
+ justifyContent: "center",
148
+ alignItems: "center",
149
+ height: "fit-content",
150
+ gap: "1rem",
151
+ }, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
152
+ color: "text.white",
153
+ fontWeight: "600",
154
+ fontSize: "16px",
155
+ }, children: "Enter Passcode" }), (0, jsx_runtime_1.jsx)(OTP_1.default, { value: otp, onChange: handleOtpChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.PASSWORD }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
156
+ color: "text.white",
157
+ fontWeight: "400",
158
+ fontSize: "14px",
159
+ textAlign: "center",
160
+ }, children: "Enter your passcode to get your wallet seed phrase" })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
161
+ display: "flex",
162
+ alignItems: "center",
163
+ gap: "1rem",
164
+ }, children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)(isShowSeedPhrase ? "show_seed_phrase" : "hide_seed_phrase", "svg"), onClick: toggleShowSeedPhrase }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { onClick: handleDone, children: "Done" })] })] }) }), (0, jsx_runtime_1.jsx)(react_1.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
165
+ display: "grid",
166
+ gridTemplateColumns: "1fr 1fr",
128
167
  gap: "1rem",
129
- }, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
130
- color: "text.white",
131
- fontWeight: "600",
132
- fontSize: "16px",
133
- }, children: "Enter Passcode" }), (0, jsx_runtime_1.jsx)(OTP_1.default, { value: otp, onChange: handleOtpChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.PASSWORD }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
134
- color: "text.white",
135
- fontWeight: "400",
136
- fontSize: "14px",
137
- textAlign: "center",
138
- }, children: "Enter your passcode to get your wallet seed phrase" })] }) }), (0, jsx_runtime_1.jsx)(react_1.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
139
- display: "flex",
140
- flexDirection: "column",
141
- alignItems: "center",
142
- justifyContent: "center",
143
168
  height: "100%",
144
- gap: "1rem",
145
- } }) })] }) }) }));
169
+ }, children: seedPhrase === null || seedPhrase === void 0 ? void 0 : seedPhrase.split(" ").map(function (word, index) { return ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: {
170
+ color: "text.white",
171
+ padding: "0.5rem 0.75rem",
172
+ backgroundColor: "rgba(255, 255, 255, 0.1)",
173
+ borderRadius: "0.5rem",
174
+ fontSize: "14px",
175
+ fontWeight: "400",
176
+ textAlign: "center",
177
+ width: "100%",
178
+ border: "1px solid rgba(255, 255, 255, 0.2)",
179
+ }, children: [index + 1, ". ", isShowSeedPhrase ? word : "********"] }, index)); }) }) })] }) }) }));
146
180
  };
147
181
  exports.default = GetSeedPhraseWalletView;
@@ -143,9 +143,12 @@ export interface GetSeedPhraseServiceBody {
143
143
  export interface GetSeedPhraseServiceResponse {
144
144
  success: boolean;
145
145
  message: string;
146
- data: string;
146
+ data: GetSeedPhraseServiceData;
147
147
  timestamp: string;
148
148
  }
149
+ export interface GetSeedPhraseServiceData {
150
+ seed_pharse: string;
151
+ }
149
152
  export interface ImportWalletServiceBody {
150
153
  seed_pharse: string;
151
154
  app_slugs: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.107",
3
+ "version": "0.0.110",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",