@verified-network/verified-custody 0.1.9 → 0.2.0

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.
@@ -0,0 +1,142 @@
1
+ import React from "react";
2
+ import { errorToast } from "../utils/helpers";
3
+ import { defaultVerifiedUrl, imageAssets } from "../utils/constants";
4
+
5
+ const Success = (props: {
6
+ setStep?: (step: string) => void;
7
+ stepToSet?: string;
8
+ messageTosend?: { type: string; key?: string; value?: any };
9
+ customTextHeader: string;
10
+ customTextFooter: string;
11
+ showButton?: boolean;
12
+ buttonText?: string;
13
+ buttonNeutText?: string;
14
+ buttonFunc?: any;
15
+ buttonNeutFunc?: any;
16
+ action?: string;
17
+ actionHeaderText?: string;
18
+ actionFooterText?: string;
19
+ timeoutTime?: number;
20
+ }) => {
21
+ const timeoutId = !props.showButton
22
+ ? setTimeout(
23
+ () => {
24
+ if (props.messageTosend) {
25
+ try {
26
+ if (chrome?.runtime?.sendMessage) {
27
+ chrome.runtime.sendMessage(props.messageTosend, (res) => {
28
+ if (res && props.action !== "signRecovery") {
29
+ window.close();
30
+ }
31
+ });
32
+ } else {
33
+ window.location.href = defaultVerifiedUrl;
34
+ }
35
+ } catch (err) {
36
+ if (process.env.REACT_APP_NODE_ENV !== "production") {
37
+ console.error("error sending message: ", err);
38
+ }
39
+
40
+ errorToast(
41
+ "Oops something went wrong",
42
+ "Unexpected error. Try again later"
43
+ );
44
+ }
45
+ }
46
+
47
+ if (props.setStep && props.stepToSet) {
48
+ props.setStep(props.stepToSet);
49
+ }
50
+ },
51
+ props.timeoutTime ? props.timeoutTime : 3000
52
+ )
53
+ : null;
54
+
55
+ const handleContinue = () => {
56
+ props.setStep("6");
57
+ };
58
+
59
+ const handleClosePopup = () => {
60
+ // if (chrome.runtime) {
61
+ // chrome.runtime.sendMessage({
62
+ // type: "VW_REQ",
63
+ // params: { method: "closePopup" },
64
+ // });
65
+ // }
66
+ if (chrome.tabs) {
67
+ chrome.tabs.update({
68
+ url: "https://wallet.verified.network",
69
+ });
70
+ } else {
71
+ window.location.href = "https://wallet.verified.network";
72
+ }
73
+ };
74
+
75
+ return (
76
+ <div
77
+ style={{
78
+ alignContent: "center",
79
+ justifyContent: "center",
80
+ position: "relative",
81
+ height: "100%",
82
+ width: "90%",
83
+ }}
84
+ className="verified-custd-mdl-success-popup-content-container"
85
+ >
86
+ <div className="verified-custd-mdl-success-popup-content">
87
+ <img
88
+ style={{ width: "90%" }}
89
+ src={imageAssets.successIcon}
90
+ alt="Success Icon"
91
+ />
92
+ <div className="verified-custd-mdl-success-popup-content-text">
93
+ <p className="verified-custd-mdl-success-popup-content-text-header">
94
+ {!props?.showButton
95
+ ? props.customTextHeader
96
+ : props.actionHeaderText}
97
+ </p>
98
+ <p className="verified-custd-mdl-success-popup-content-text-footer">
99
+ {!props?.showButton
100
+ ? props.customTextFooter
101
+ : props.actionFooterText}
102
+ </p>
103
+ </div>
104
+ </div>
105
+
106
+ {props.showButton && props.buttonText?.length > 0 && (
107
+ <button
108
+ style={{ marginTop: "10px", fontSize: "14px" }}
109
+ onClick={() => {
110
+ if (timeoutId) {
111
+ clearTimeout(timeoutId);
112
+ }
113
+ if (props.action === "invitation") {
114
+ handleContinue();
115
+ }
116
+ }}
117
+ className="verified-custd-mdl-startup-button-active"
118
+ >
119
+ {props.buttonText}
120
+ </button>
121
+ )}
122
+ {props.showButton && props.buttonNeutText?.length > 0 && (
123
+ <button
124
+ style={{ marginTop: "10px", fontSize: "14px" }}
125
+ onClick={() => {
126
+ if (timeoutId) {
127
+ clearTimeout(timeoutId);
128
+ }
129
+ if (props.action === "invitation") {
130
+ handleClosePopup();
131
+ }
132
+ }}
133
+ className="verified-custd-mdl-startup-button-click"
134
+ >
135
+ {props.buttonNeutText}
136
+ </button>
137
+ )}
138
+ </div>
139
+ );
140
+ };
141
+
142
+ export default Success;
@@ -0,0 +1,37 @@
1
+ declare module "react-dom/client" {
2
+ import { ReactElement } from "react";
3
+
4
+ interface Root {
5
+ render(children: ReactElement): void;
6
+ unmount(): void;
7
+ }
8
+
9
+ function createRoot(container: Element | DocumentFragment): Root;
10
+
11
+ export { createRoot };
12
+ }
13
+
14
+ declare module "*.png" {
15
+ const value: string;
16
+ export default value;
17
+ }
18
+
19
+ declare module "*.jpg" {
20
+ const value: string;
21
+ export default value;
22
+ }
23
+
24
+ declare module "*.jpeg" {
25
+ const value: string;
26
+ export default value;
27
+ }
28
+
29
+ declare module "*.gif" {
30
+ const value: string;
31
+ export default value;
32
+ }
33
+
34
+ declare module "*.svg" {
35
+ const value: string;
36
+ export default value;
37
+ }
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ import "./style.css";
2
+
3
+ export { default as VerifiedCustody } from "./pages";
4
+
5
+ export { default as FTUPage } from "./pages/ftu";
6
+
7
+ export { default as EnterPinPage } from "./pages/enterPin";
8
+
9
+ export { default as CreatePinPage } from "./pages/createPin";
10
+
11
+ export { default as ContactPage } from "./pages/contact";
12
+
13
+ export { default as OTPPage } from "./pages/otp";
14
+
15
+ export { default as AddCoSignersPage } from "./pages/addCosigners";
16
+
17
+ export { hashTheString, encryptString, decryptString } from "./utils/helpers";