tek-wallet 0.0.108 → 0.0.111

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,27 +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];
71
- var _b = (0, react_2.useState)(undefined), seedPhrase = _b[0], setSeedPhrase = _b[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];
72
76
  var swiperControlledRef = (0, react_2.useRef)(null);
73
77
  var childPageLayoutRef = (0, react_2.useRef)(null);
74
- var _c = (0, react_2.useState)(GetSeedPhraseWalletViewStep.ENTER_PASSCODE), currentStep = _c[0], setCurrentStep = _c[1];
78
+ var _d = (0, react_2.useState)(GetSeedPhraseWalletViewStep.ENTER_PASSCODE), currentStep = _d[0], setCurrentStep = _d[1];
75
79
  var getSeedPhrase = (0, useWalletData_1.default)().getSeedPhrase;
76
80
  var gotoStep = function (step) {
77
81
  var _a;
78
82
  setCurrentStep(step);
79
83
  (_a = swiperControlledRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(step);
80
84
  };
81
- var clearInputsValue = function () {
85
+ var clearValues = function () {
82
86
  setOtp("");
87
+ setSeedPhrase(undefined);
88
+ };
89
+ var toggleShowSeedPhrase = function () {
90
+ setIsShowSeedPhrase(!isShowSeedPhrase);
91
+ };
92
+ var handleDone = function () {
93
+ props.onBack();
94
+ clearValues();
83
95
  };
84
96
  var handleBack = function () {
85
97
  switch (currentStep) {
86
98
  case GetSeedPhraseWalletViewStep.SHOW_SEED_PHRASE:
87
- gotoStep(GetSeedPhraseWalletViewStep.ENTER_PASSCODE);
99
+ // gotoStep(GetSeedPhraseWalletViewStep.ENTER_PASSCODE);
100
+ props.onBack();
101
+ clearValues();
88
102
  break;
89
103
  case GetSeedPhraseWalletViewStep.ENTER_PASSCODE:
90
104
  props.onBack();
91
- clearInputsValue();
105
+ clearValues();
92
106
  break;
93
107
  default:
94
108
  break;
@@ -112,6 +126,7 @@ var GetSeedPhraseWalletView = function (props) {
112
126
  passcode: value,
113
127
  }, function () {
114
128
  var _a;
129
+ console.warn("🚀 ~ handleOtpChange ~ start");
115
130
  (_a = childPageLayoutRef.current) === null || _a === void 0 ? void 0 : _a.showLoading();
116
131
  }, function (data) {
117
132
  var _a, _b;
@@ -126,36 +141,50 @@ var GetSeedPhraseWalletView = function (props) {
126
141
  console.warn("🚀 ~ handleOtpChange ~ response:", response);
127
142
  }
128
143
  };
129
- 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: {
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.jsx)(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.jsx)(react_1.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
161
+ minHeight: "100%",
130
162
  display: "flex",
131
163
  flexDirection: "column",
132
- justifyContent: "center",
133
- alignItems: "center",
134
- height: "100%",
135
- gap: "1rem",
136
- }, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
137
- color: "text.white",
138
- fontWeight: "600",
139
- fontSize: "16px",
140
- }, 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: {
141
- color: "text.white",
142
- fontWeight: "400",
143
- fontSize: "14px",
144
- textAlign: "center",
145
- }, 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: {
146
- display: "grid",
147
- gridTemplateColumns: "1fr 1fr",
148
- gap: "1rem",
149
- }, children: seedPhrase === null || seedPhrase === void 0 ? void 0 : seedPhrase.split(" ").map(function (word, index) { return ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
150
- color: "text.white",
151
- padding: "0.5rem 0.75rem",
152
- backgroundColor: "rgba(255, 255, 255, 0.1)",
153
- borderRadius: "0.5rem",
154
- fontSize: "14px",
155
- fontWeight: "400",
156
- textAlign: "center",
157
- width: "100%",
158
- border: "1px solid rgba(255, 255, 255, 0.2)",
159
- }, children: word }, index)); }) }) })] }) }) }));
164
+ gap: "1.5rem",
165
+ }, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
166
+ display: "grid",
167
+ gridTemplateColumns: "1fr 1fr",
168
+ gap: "1rem",
169
+ height: "fit-content",
170
+ }, children: [seedPhrase === null || seedPhrase === void 0 ? void 0 : seedPhrase.split(" ").map(function (word, index) { return ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: {
171
+ color: "text.white",
172
+ padding: "0.5rem 0.75rem",
173
+ backgroundColor: "rgba(255, 255, 255, 0.1)",
174
+ borderRadius: "0.5rem",
175
+ fontSize: "14px",
176
+ fontWeight: "400",
177
+ textAlign: "center",
178
+ width: "100%",
179
+ border: "1px solid rgba(255, 255, 255, 0.2)",
180
+ }, children: [index + 1, ". ", isShowSeedPhrase ? word : "********"] }, index)); }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
181
+ display: "flex",
182
+ alignItems: "center",
183
+ gap: "1rem",
184
+ height: "fit-content",
185
+ marginTop: "auto",
186
+ }, children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)(isShowSeedPhrase
187
+ ? "show_seed_phrase"
188
+ : "hide_seed_phrase", "svg"), onClick: toggleShowSeedPhrase }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { onClick: handleDone, children: "Done" })] })] }) }) })] }) }) }));
160
189
  };
161
190
  exports.default = GetSeedPhraseWalletView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.108",
3
+ "version": "0.0.111",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",