@sikka/hawa 0.0.4 → 0.0.7
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.
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +9 -8
- package/src/blocks/Account/UserProfile.js +61 -11
- package/src/blocks/Account/UserSettings.js +11 -11
- package/src/blocks/AuthForms/NewPasswordForm.js +85 -11
- package/src/blocks/AuthForms/ResetPasswordForm.js +47 -8
- package/src/blocks/AuthForms/SignInForm.js +91 -13
- package/src/blocks/AuthForms/SignUpForm.js +119 -12
- package/src/blocks/Payment/ChargeWalletForm.js +53 -0
- package/src/blocks/Payment/CreditCardForm.js +60 -0
- package/src/blocks/Payment/Form/CForm.js +10 -8
- package/src/blocks/Payment/Gateway/Wallet.js +5 -5
- package/src/blocks/Payment/PayWithWallet.js +14 -0
- package/src/blocks/Payment/PaymentMethod.js +2 -2
- package/src/blocks/Payment/SelectPayment.js +76 -0
- package/src/blocks/Payment/index.js +18 -0
- package/src/index.js +3 -1
- package/src/layout/Box.js +31 -18
- package/src/stories/BlocksStories/AuthForm.stories.js +103 -0
- package/src/stories/BlocksStories/PaymentForm.stories.js +86 -0
- package/src/stories/BlocksStories/UserForm.stories.js +41 -0
- package/src/stories/GlobalVariables.stories.js +33 -90
- package/src/stories/HawaProvider.stories.js +0 -1
- package/src/stories/Introduction.stories.js +132 -110
- package/src/stories/LayoutStories/Box.stories.js +56 -0
- package/src/stories/UIStories/ActionButton.stories.js +53 -0
- package/src/stories/{AdaptiveButton.stories.js → UIStories/AdaptiveButton.stories.js} +3 -3
- package/src/stories/UIStories/Alert.stories.js +42 -0
- package/src/stories/{CheckBox.stories.js → UIStories/CheckBox.stories.js} +3 -4
- package/src/stories/UIStories/InputLabel.stories.js +13 -0
- package/src/stories/UIStories/RadioSelector.stories.js +53 -0
- package/src/stories/UIStories/SettingsRow.stories.js +64 -0
- package/src/stories/{TextField.stories.js → UIStories/TextField.stories.js} +4 -5
- package/src/themes/HawaProvider.js +151 -18
- package/src/ui/ActionButton.js +38 -10
- package/src/ui/AdaptiveButton.js +29 -29
- package/src/ui/ApplePayButton.js +26 -0
- package/src/ui/AutoCompleteField.js +0 -1
- package/src/ui/DragDropImages.js +2 -2
- package/src/ui/GithubButton.js +24 -0
- package/src/ui/GoogleButton.js +23 -0
- package/src/ui/GooglePayButton.js +26 -0
- package/src/ui/HawaAlert.js +37 -0
- package/src/ui/HawaButton.js +48 -0
- package/src/ui/{Checkbox.js → HawaCheckbox.js} +3 -3
- package/src/ui/HawaInputLabel.js +32 -0
- package/src/ui/HawaLogoButton.js +43 -0
- package/src/ui/HawaRadio.js +73 -0
- package/src/ui/HawaSettingsRow.js +71 -0
- package/src/ui/{TextArea.js → HawaTextArea.js} +2 -2
- package/src/ui/HawaTextField.js +110 -0
- package/src/ui/HawaTypography.js +29 -0
- package/src/ui/MadaButton.js +26 -0
- package/src/ui/PayPalButton.js +26 -0
- package/src/ui/RadioBox.js +2 -2
- package/src/ui/STCPayButton.js +26 -0
- package/src/ui/SelectedField.js +4 -4
- package/src/ui/StyledTooltip.js +1 -1
- package/src/ui/TabPanel.js +1 -1
- package/src/ui/TwitterButton.js +27 -0
- package/src/ui/VisaMasterButton.js +26 -0
- package/src/ui/WalletButton.js +24 -0
- package/src/ui/index.js +23 -11
- package/storybook-static/0.0d994c92.iframe.bundle.js +3 -0
- package/storybook-static/{1.4e43f671.iframe.bundle.js.LICENSE.txt → 0.0d994c92.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/0.0d994c92.iframe.bundle.js.map +1 -0
- package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +1 -0
- package/storybook-static/1.aabc3f3a.iframe.bundle.js +1 -0
- package/storybook-static/{3.c1dc7159.iframe.bundle.js → 2.430bf1e3.iframe.bundle.js} +1 -1
- package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +2 -0
- package/storybook-static/{4.8c311a6b48cad9f29317.manager.bundle.js.LICENSE.txt → 4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/{5.88fe62ee92ff5ca67829.manager.bundle.js → 5.63ab4f94d50a3acf080d.manager.bundle.js} +1 -1
- package/storybook-static/{7.69d2e532.iframe.bundle.js → 6.704d1e8d.iframe.bundle.js} +1 -1
- package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js → 6.a6d45262f7e98f3f18d3.manager.bundle.js} +2 -2
- package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js.LICENSE.txt → 6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/{7.5ec31f3702b08ab0b71c.manager.bundle.js → 7.097710753af9a1c41b80.manager.bundle.js} +1 -1
- package/storybook-static/{8.68cd1217.iframe.bundle.js → 7.9ce807e3.iframe.bundle.js} +3 -3
- package/storybook-static/{8.68cd1217.iframe.bundle.js.LICENSE.txt → 7.9ce807e3.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/7.9ce807e3.iframe.bundle.js.map +1 -0
- package/storybook-static/{8.5ce13be7612bd3a6b864.manager.bundle.js → 8.76c3cbf398692028e834.manager.bundle.js} +1 -1
- package/storybook-static/{9.488e3969.iframe.bundle.js → 8.c4cb6081.iframe.bundle.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/main.ac6e4b72b033097dad76.manager.bundle.js +1 -0
- package/storybook-static/main.b7ffaed0.iframe.bundle.js +1 -0
- package/storybook-static/{runtime~main.cc29f4c2175f187a3707.manager.bundle.js → runtime~main.c8dac23bc753439736f0.manager.bundle.js} +1 -1
- package/storybook-static/runtime~main.cfefe972.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.8ebae370.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.d144d840.iframe.bundle.js.LICENSE.txt → vendors~main.8ebae370.iframe.bundle.js.LICENSE.txt} +3 -30
- package/storybook-static/vendors~main.8ebae370.iframe.bundle.js.map +1 -0
- package/storybook-static/vendors~main.a697e07137d366f95f76.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.f228d62e92b69563cefb.manager.bundle.js.LICENSE.txt → vendors~main.a697e07137d366f95f76.manager.bundle.js.LICENSE.txt} +0 -0
- package/src/blocks/AuthForms/viaFacebook.js +0 -0
- package/src/blocks/AuthForms/viaGithub.js +0 -0
- package/src/blocks/AuthForms/viaGoogle.js +0 -0
- package/src/blocks/AuthForms/viaTwitter.js +0 -0
- package/src/blocks/index.js +0 -13
- package/src/stories/ActionButton.stories.js +0 -49
- package/src/stories/Alert.stories.js +0 -41
- package/src/stories/AuthForm.stories.js +0 -79
- package/src/stories/Box.stories.js +0 -64
- package/src/stories/InputLabel.stories.js +0 -92
- package/src/stories/RadioSelector.stories.js +0 -69
- package/src/stories/UserAccount.stories.js +0 -46
- package/src/ui/RadioSelector.js +0 -51
- package/src/ui/StyledAlert.js +0 -30
- package/src/ui/StyledInputLabel.js +0 -19
- package/src/ui/TextField.js +0 -62
- package/storybook-static/0.d3bc3395610cf5d3ee94.manager.bundle.js +0 -1
- package/storybook-static/0.dd3d47f5.iframe.bundle.js +0 -1
- package/storybook-static/1.4e43f671.iframe.bundle.js +0 -3
- package/storybook-static/1.4e43f671.iframe.bundle.js.map +0 -1
- package/storybook-static/2.9a757207.iframe.bundle.js +0 -1
- package/storybook-static/4.8c311a6b48cad9f29317.manager.bundle.js +0 -2
- package/storybook-static/8.68cd1217.iframe.bundle.js.map +0 -1
- package/storybook-static/main.65cb2769.iframe.bundle.js +0 -1
- package/storybook-static/main.7e391cf7bf72b0d18ea5.manager.bundle.js +0 -1
- package/storybook-static/runtime~main.6e2e1544.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.d144d840.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.d144d840.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.f228d62e92b69563cefb.manager.bundle.js +0 -2
- package/yarn-error.log +0 -10910
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { Box } from
|
|
2
|
+
import { HawaTextField, ActionButton } from "../../ui";
|
|
3
|
+
import { Box } from "../../layout";
|
|
4
4
|
|
|
5
5
|
export const UserSettings = (props) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
return (
|
|
7
|
+
<Box maxWidth={400}>
|
|
8
|
+
<HawaTextField type="text" inputLabel="First Name" />
|
|
9
|
+
<HawaTextField type="text" inputLabel="Last Name" />
|
|
10
|
+
<HawaTextField type="email" inputLabel="Email" />
|
|
11
|
+
<HawaTextField type="password" inputLabel="Password" />
|
|
12
|
+
<ActionButton last text="Update Account" />
|
|
13
|
+
</Box>
|
|
14
|
+
);
|
|
15
15
|
};
|
|
@@ -1,17 +1,91 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { Box } from "../../layout";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ActionButton, HawaTextField, HawaAlert } from "../../ui";
|
|
4
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
5
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
6
|
+
import PasswordIcon from "@mui/icons-material/HttpsOutlined";
|
|
7
|
+
|
|
5
8
|
export const NewPasswordForm = (props) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
const [newPassword, setNewPassword] = useState("");
|
|
10
|
+
const [confirmNewPassword, setConfirmNewPassword] = useState("");
|
|
11
|
+
const [error, setError] = useState(false);
|
|
12
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
13
|
+
const [loading, setLoading] = useState(true);
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
const methods = useForm();
|
|
16
|
+
const {
|
|
17
|
+
formState: { errors },
|
|
18
|
+
handleSubmit,
|
|
19
|
+
getValues,
|
|
20
|
+
register,
|
|
21
|
+
watch,
|
|
22
|
+
reset,
|
|
23
|
+
setValue
|
|
24
|
+
} = methods;
|
|
25
|
+
|
|
26
|
+
const handleNewPassword = (e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
console.log("submitting fom", e.target);
|
|
29
|
+
// setLoading(true);
|
|
30
|
+
// e.preventDefault();
|
|
31
|
+
// if (newPassword == "" || confirmNewPassword == "") {
|
|
32
|
+
// setLoading(false);
|
|
33
|
+
// return;
|
|
34
|
+
// }
|
|
35
|
+
// if (newPassword != confirmNewPassword) {
|
|
36
|
+
// setError(true);
|
|
37
|
+
// setLoading(false);
|
|
38
|
+
// // setErrorMessage(t("password-no-match"));
|
|
39
|
+
// return;
|
|
40
|
+
// }
|
|
41
|
+
// if (newPassword == confirmNewPassword) {
|
|
42
|
+
// //mutation to reset password here
|
|
43
|
+
// }
|
|
44
|
+
};
|
|
45
|
+
return (
|
|
46
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
47
|
+
<Box noMargin>
|
|
48
|
+
{props.error && (
|
|
49
|
+
<HawaAlert text="This is a new password alert" severity="error" />
|
|
50
|
+
)}
|
|
51
|
+
<FormProvider {...methods}>
|
|
52
|
+
<form onSubmit={handleSubmit(props.handleNewPassword)}>
|
|
53
|
+
<HawaTextField
|
|
54
|
+
name="password"
|
|
55
|
+
type="password"
|
|
56
|
+
inputLabel="Choose new password"
|
|
57
|
+
placeholder="Enter password"
|
|
58
|
+
onChange={(e) => setNewPassword(e.target.value)}
|
|
59
|
+
value={newPassword}
|
|
60
|
+
startAdornment={
|
|
61
|
+
<InputAdornment position="start">
|
|
62
|
+
<PasswordIcon />
|
|
63
|
+
</InputAdornment>
|
|
64
|
+
}
|
|
65
|
+
rules={{
|
|
66
|
+
required: "Password is rquired"
|
|
67
|
+
}}
|
|
68
|
+
helperText={errors.password?.message}
|
|
69
|
+
/>
|
|
70
|
+
<HawaTextField
|
|
71
|
+
name="confirmPassword"
|
|
72
|
+
type="password"
|
|
73
|
+
placeholder="Confirm Password"
|
|
74
|
+
inputLabel="Confirm"
|
|
75
|
+
startAdornment={
|
|
76
|
+
<InputAdornment position="start">
|
|
77
|
+
<PasswordIcon />
|
|
78
|
+
</InputAdornment>
|
|
79
|
+
}
|
|
80
|
+
rules={{
|
|
81
|
+
required: "Password is rquired"
|
|
82
|
+
}}
|
|
83
|
+
helperText={errors.confirmPassword?.message}
|
|
84
|
+
/>
|
|
85
|
+
<ActionButton fullWidth type="submit" last text="Reset Password" />
|
|
86
|
+
</form>
|
|
87
|
+
</FormProvider>
|
|
88
|
+
</Box>
|
|
15
89
|
</Box>
|
|
16
90
|
);
|
|
17
91
|
};
|
|
@@ -1,14 +1,53 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
2
3
|
import { Box } from "../../layout";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
4
|
+
import { HawaTextField, ActionButton, HawaAlert } from "../../ui";
|
|
5
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
6
|
+
import EmailIcon from "@mui/icons-material/MailOutline";
|
|
7
|
+
|
|
5
8
|
export const ResetPasswordForm = (props) => {
|
|
6
|
-
const
|
|
9
|
+
const methods = useForm();
|
|
10
|
+
const {
|
|
11
|
+
formState: { errors },
|
|
12
|
+
handleSubmit,
|
|
13
|
+
getValues,
|
|
14
|
+
register,
|
|
15
|
+
watch,
|
|
16
|
+
reset,
|
|
17
|
+
setValue
|
|
18
|
+
} = methods;
|
|
7
19
|
return (
|
|
8
|
-
<Box maxWidth={400} >
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
21
|
+
<Box noMargin>
|
|
22
|
+
{props.error && (
|
|
23
|
+
<HawaAlert text="This is a reset password alert" severity="error" />
|
|
24
|
+
)}
|
|
25
|
+
<FormProvider {...methods}>
|
|
26
|
+
<form onSubmit={handleSubmit(props.handleResetPassword)}>
|
|
27
|
+
<HawaTextField
|
|
28
|
+
type="text"
|
|
29
|
+
name="email"
|
|
30
|
+
inputLabel="Email"
|
|
31
|
+
placeholder="Enter your email"
|
|
32
|
+
startAdornment={
|
|
33
|
+
<InputAdornment position="start">
|
|
34
|
+
<EmailIcon />
|
|
35
|
+
</InputAdornment>
|
|
36
|
+
}
|
|
37
|
+
rules={{
|
|
38
|
+
required: "Email is required",
|
|
39
|
+
pattern: {
|
|
40
|
+
value:
|
|
41
|
+
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
42
|
+
message: "Invalid email address"
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
helperText={errors.email?.message}
|
|
46
|
+
/>
|
|
47
|
+
<ActionButton fullWidth last type="submit" text="Reset Password" />
|
|
48
|
+
</form>
|
|
49
|
+
</FormProvider>{" "}
|
|
50
|
+
</Box>
|
|
12
51
|
</Box>
|
|
13
52
|
);
|
|
14
53
|
};
|
|
@@ -1,19 +1,97 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
HawaTextField,
|
|
4
|
+
ActionButton,
|
|
5
|
+
GoogleButton,
|
|
6
|
+
TwitterButton,
|
|
7
|
+
GithubButton,
|
|
8
|
+
HawaAlert
|
|
9
|
+
} from "../../ui";
|
|
10
|
+
import { Box } from "../../layout";
|
|
11
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<StyledTextField type="text" />
|
|
13
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
14
|
+
import EmailIcon from "@mui/icons-material/MailOutline";
|
|
15
|
+
import PasswordIcon from "@mui/icons-material/HttpsOutlined";
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
export const SignInForm = (props) => {
|
|
18
|
+
const methods = useForm();
|
|
19
|
+
const {
|
|
20
|
+
formState: { errors },
|
|
21
|
+
handleSubmit
|
|
22
|
+
} = methods;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
26
|
+
<Box noMargin>
|
|
27
|
+
{props.error && (
|
|
28
|
+
<HawaAlert text="This is a sign in alert" severity="error" />
|
|
29
|
+
)}
|
|
30
|
+
<FormProvider {...methods}>
|
|
31
|
+
<form onSubmit={handleSubmit(props.handleSignIn)}>
|
|
32
|
+
<HawaTextField
|
|
33
|
+
type="text"
|
|
34
|
+
name="email"
|
|
35
|
+
inputLabel="Email"
|
|
36
|
+
placeholder="Enter your email"
|
|
37
|
+
startAdornment={
|
|
38
|
+
<InputAdornment position="start">
|
|
39
|
+
<EmailIcon />
|
|
40
|
+
</InputAdornment>
|
|
41
|
+
}
|
|
42
|
+
rules={{
|
|
43
|
+
required: "Email is required",
|
|
44
|
+
pattern: {
|
|
45
|
+
value:
|
|
46
|
+
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
47
|
+
message: "Invalid email address"
|
|
48
|
+
}
|
|
49
|
+
}}
|
|
50
|
+
helperText={errors.email?.message}
|
|
51
|
+
/>
|
|
16
52
|
|
|
53
|
+
<HawaTextField
|
|
54
|
+
name="password"
|
|
55
|
+
placeholder="Enter password"
|
|
56
|
+
type="password"
|
|
57
|
+
inputLabel="Password"
|
|
58
|
+
startAdornment={
|
|
59
|
+
<InputAdornment position="start">
|
|
60
|
+
<PasswordIcon />
|
|
61
|
+
</InputAdornment>
|
|
62
|
+
}
|
|
63
|
+
rules={{
|
|
64
|
+
required: "Password is rquired"
|
|
65
|
+
}}
|
|
66
|
+
helperText={errors.password?.message}
|
|
67
|
+
/>
|
|
68
|
+
<ActionButton
|
|
69
|
+
type="submit"
|
|
70
|
+
fullWidth
|
|
71
|
+
last={"true"}
|
|
72
|
+
text={"Sign In"}
|
|
73
|
+
/>
|
|
74
|
+
</form>
|
|
75
|
+
</FormProvider>
|
|
76
|
+
</Box>
|
|
77
|
+
{props.viaGoogle && (
|
|
78
|
+
<GoogleButton
|
|
79
|
+
buttonText={props.googleButtonLabel}
|
|
80
|
+
handleClick={props.handleGoogleSignIn}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
{props.viaGithub && (
|
|
84
|
+
<GithubButton
|
|
85
|
+
buttonText={props.githubButtonLabel}
|
|
86
|
+
handleClick={props.handleGithubSignIn}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
{props.viaTwitter && (
|
|
90
|
+
<TwitterButton
|
|
91
|
+
buttonText={props.twitterButtonLabel}
|
|
92
|
+
handleClick={props.handleTwitterSignIn}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
17
95
|
</Box>
|
|
18
96
|
);
|
|
19
97
|
};
|
|
@@ -1,20 +1,127 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Box } from "../../layout";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
HawaTextField,
|
|
5
|
+
ActionButton,
|
|
6
|
+
GoogleButton,
|
|
7
|
+
GithubButton,
|
|
8
|
+
TwitterButton,
|
|
9
|
+
HawaAlert
|
|
10
|
+
} from "../../ui";
|
|
11
|
+
import PropTypes from "prop-types";
|
|
12
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
13
|
+
|
|
14
|
+
import PersonIcon from "@mui/icons-material/PermIdentityOutlined";
|
|
15
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
16
|
+
import EmailIcon from "@mui/icons-material/MailOutline";
|
|
17
|
+
import PasswordIcon from "@mui/icons-material/HttpsOutlined";
|
|
5
18
|
|
|
6
19
|
export const SignUpForm = (props) => {
|
|
7
|
-
const
|
|
20
|
+
const methods = useForm();
|
|
21
|
+
const {
|
|
22
|
+
formState: { errors },
|
|
23
|
+
handleSubmit,
|
|
24
|
+
getValues,
|
|
25
|
+
register,
|
|
26
|
+
watch,
|
|
27
|
+
reset,
|
|
28
|
+
setValue
|
|
29
|
+
} = methods;
|
|
30
|
+
|
|
8
31
|
return (
|
|
9
|
-
<Box maxWidth={400}>
|
|
32
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
33
|
+
<Box noMargin>
|
|
34
|
+
{props.error && (
|
|
35
|
+
<HawaAlert text="This is a sign in alert" severity="error" />
|
|
36
|
+
)}
|
|
37
|
+
<FormProvider {...methods}>
|
|
38
|
+
<form onSubmit={handleSubmit(props.handleSignUp)}>
|
|
39
|
+
<HawaTextField
|
|
40
|
+
name="fullName"
|
|
41
|
+
placeholder="Fulan AlFulani"
|
|
42
|
+
type="text"
|
|
43
|
+
inputLabel="Full Name"
|
|
44
|
+
startAdornment={
|
|
45
|
+
<InputAdornment position="start">
|
|
46
|
+
<PersonIcon />
|
|
47
|
+
</InputAdornment>
|
|
48
|
+
}
|
|
49
|
+
rules={{
|
|
50
|
+
required: "Full name rquired"
|
|
51
|
+
}}
|
|
52
|
+
helperText={errors.fullName?.message}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<HawaTextField
|
|
56
|
+
type="text"
|
|
57
|
+
inputLabel="Email"
|
|
58
|
+
placeholder="Enter your email"
|
|
59
|
+
name="email"
|
|
60
|
+
startAdornment={
|
|
61
|
+
<InputAdornment position="start">
|
|
62
|
+
<EmailIcon />
|
|
63
|
+
</InputAdornment>
|
|
64
|
+
}
|
|
65
|
+
rules={{
|
|
66
|
+
required: "Email required",
|
|
67
|
+
pattern: {
|
|
68
|
+
value:
|
|
69
|
+
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
70
|
+
message: "Invalid email address"
|
|
71
|
+
}
|
|
72
|
+
}}
|
|
73
|
+
helperText={errors.email?.message}
|
|
74
|
+
/>
|
|
75
|
+
<HawaTextField
|
|
76
|
+
name="password"
|
|
77
|
+
placeholder="Minimum 8 characters"
|
|
78
|
+
type="password"
|
|
79
|
+
inputLabel="Password"
|
|
80
|
+
startAdornment={
|
|
81
|
+
<InputAdornment position="start">
|
|
82
|
+
<PasswordIcon />
|
|
83
|
+
</InputAdornment>
|
|
84
|
+
}
|
|
85
|
+
rules={{
|
|
86
|
+
required: "Password rquired",
|
|
87
|
+
minLength: {
|
|
88
|
+
value: 8,
|
|
89
|
+
message: "Password too short"
|
|
90
|
+
}
|
|
91
|
+
}}
|
|
92
|
+
helperText={errors.password?.message}
|
|
93
|
+
/>
|
|
10
94
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
95
|
+
<ActionButton fullWidth type="submit" text="Sign Up" last />
|
|
96
|
+
</form>
|
|
97
|
+
</FormProvider>
|
|
98
|
+
</Box>
|
|
99
|
+
{props.viaGoogle && (
|
|
100
|
+
<GoogleButton
|
|
101
|
+
buttonText={props.googleButtonLabel}
|
|
102
|
+
handleClick={props.handleGoogleSignIn}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
{props.viaGithub && (
|
|
106
|
+
<GithubButton
|
|
107
|
+
buttonText={props.githubButtonLabel}
|
|
108
|
+
handleClick={props.handleGithubSignUp}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
{props.viaTwitter && (
|
|
112
|
+
<TwitterButton
|
|
113
|
+
buttonText={props.twitterButtonLabel}
|
|
114
|
+
handleClick={props.handleTwitterSignIn}
|
|
115
|
+
/>
|
|
116
|
+
)}
|
|
18
117
|
</Box>
|
|
19
118
|
);
|
|
20
119
|
};
|
|
120
|
+
|
|
121
|
+
SignUpForm.propTypes = {
|
|
122
|
+
theme: PropTypes.oneOf(["secondary", "primary"])
|
|
123
|
+
// buttonLabel: PropTypes.string,
|
|
124
|
+
// danger: PropTypes.bool,
|
|
125
|
+
// disabled: PropTypes.bool,
|
|
126
|
+
// showText: PropTypes.bool
|
|
127
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { HawaTextField, ActionButton, HawaTypography } from "../../ui";
|
|
3
|
+
import { Box } from "../../layout";
|
|
4
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
5
|
+
|
|
6
|
+
export const ChargeWalletForm = (props) => {
|
|
7
|
+
const [walletAmount, setWalletAmount] = useState(0);
|
|
8
|
+
const methods = useForm();
|
|
9
|
+
const {
|
|
10
|
+
formState: { errors },
|
|
11
|
+
handleSubmit
|
|
12
|
+
} = methods;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
16
|
+
<Box noMargin>
|
|
17
|
+
<HawaTypography variant="h2" align="center">
|
|
18
|
+
{Number(walletAmount).toLocaleString("en")}{" "}
|
|
19
|
+
<span style={{ fontSize: 20, letterSpacing: 1 }}>
|
|
20
|
+
{props.currency}
|
|
21
|
+
</span>
|
|
22
|
+
</HawaTypography>
|
|
23
|
+
<FormProvider {...methods}>
|
|
24
|
+
<form
|
|
25
|
+
onChange={(e) => {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
setWalletAmount(methods.getValues().amount);
|
|
28
|
+
}}
|
|
29
|
+
style={{ marginTop: 10 }}
|
|
30
|
+
onSubmit={handleSubmit(props.handleChargeWallet)}
|
|
31
|
+
>
|
|
32
|
+
<HawaTextField
|
|
33
|
+
name="amount"
|
|
34
|
+
placeholder="Enter amount"
|
|
35
|
+
type="number"
|
|
36
|
+
value={walletAmount}
|
|
37
|
+
rules={{
|
|
38
|
+
required: "Password is rquired"
|
|
39
|
+
}}
|
|
40
|
+
helperText={errors.amount?.message}
|
|
41
|
+
/>
|
|
42
|
+
<ActionButton
|
|
43
|
+
last
|
|
44
|
+
fullWidth
|
|
45
|
+
text={"Charge Wallet"} //move this to props
|
|
46
|
+
onClick={props.handleSignIn}
|
|
47
|
+
/>
|
|
48
|
+
</form>
|
|
49
|
+
</FormProvider>
|
|
50
|
+
</Box>
|
|
51
|
+
</Box>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HawaTextField, ActionButton } from "../../ui";
|
|
3
|
+
import { Box } from "../../layout";
|
|
4
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
5
|
+
|
|
6
|
+
export const CreditCardForm = (props) => {
|
|
7
|
+
const methods = useForm();
|
|
8
|
+
const {
|
|
9
|
+
formState: { errors },
|
|
10
|
+
handleSubmit
|
|
11
|
+
} = methods;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
15
|
+
<Box noMargin>
|
|
16
|
+
<FormProvider {...methods}>
|
|
17
|
+
<form onSubmit={handleSubmit(props.handle)}>
|
|
18
|
+
<HawaTextField
|
|
19
|
+
name="password"
|
|
20
|
+
placeholder="Enter password"
|
|
21
|
+
type="password"
|
|
22
|
+
inputLabel="Password"
|
|
23
|
+
// startAdornment={
|
|
24
|
+
// <InputAdornment position="start">
|
|
25
|
+
// <PasswordIcon />
|
|
26
|
+
// </InputAdornment>
|
|
27
|
+
// }
|
|
28
|
+
rules={{
|
|
29
|
+
required: "Password is rquired"
|
|
30
|
+
}}
|
|
31
|
+
helperText={errors.password?.message}
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<HawaTextField
|
|
35
|
+
name="password"
|
|
36
|
+
placeholder="Enter password"
|
|
37
|
+
type="password"
|
|
38
|
+
inputLabel="Password"
|
|
39
|
+
// startAdornment={
|
|
40
|
+
// <InputAdornment position="start">
|
|
41
|
+
// <PasswordIcon />
|
|
42
|
+
// </InputAdornment>
|
|
43
|
+
// }
|
|
44
|
+
rules={{
|
|
45
|
+
required: "Password is rquired"
|
|
46
|
+
}}
|
|
47
|
+
helperText={errors.password?.message}
|
|
48
|
+
/>
|
|
49
|
+
<ActionButton
|
|
50
|
+
last
|
|
51
|
+
fullWidth
|
|
52
|
+
text={"Sign In"}
|
|
53
|
+
onClick={props.handleSignIn}
|
|
54
|
+
/>
|
|
55
|
+
</form>
|
|
56
|
+
</FormProvider>
|
|
57
|
+
</Box>
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from "react";
|
|
2
2
|
import sha256 from "crypto-js/sha256";
|
|
3
|
-
import Button from "@material
|
|
4
|
-
import CircularProgress from "@material
|
|
3
|
+
import Button from "@mui/material/Button";
|
|
4
|
+
import CircularProgress from "@mui/material/CircularProgress";
|
|
5
5
|
import useTranslation from "next-translate/useTranslation";
|
|
6
6
|
import axios from "axios";
|
|
7
7
|
|
|
@@ -137,10 +137,8 @@ export default function CForm({
|
|
|
137
137
|
onUpdateState("isCardFlipped", false);
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
const handlePayfortForm = (e) => {
|
|
141
|
-
|
|
142
|
-
};
|
|
143
|
-
|
|
140
|
+
const handlePayfortForm = (e) => {};
|
|
141
|
+
|
|
144
142
|
// NOTE: Currently the cursor on the card number field gets reset if we remove a number, the code bellow was used
|
|
145
143
|
// in class components, need to transform this to work with functional components.
|
|
146
144
|
// getSnapshotBeforeUpdate() {
|
|
@@ -307,7 +305,12 @@ export default function CForm({
|
|
|
307
305
|
/>
|
|
308
306
|
)}
|
|
309
307
|
</form>
|
|
310
|
-
<Button
|
|
308
|
+
<Button
|
|
309
|
+
variant="contained"
|
|
310
|
+
color="primary"
|
|
311
|
+
fullWidth
|
|
312
|
+
onClick={handlePayfortForm}
|
|
313
|
+
>
|
|
311
314
|
{loading ? (
|
|
312
315
|
<CircularProgress
|
|
313
316
|
variant="indeterminate"
|
|
@@ -323,4 +326,3 @@ export default function CForm({
|
|
|
323
326
|
</div>
|
|
324
327
|
);
|
|
325
328
|
}
|
|
326
|
-
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import useTranslation from "next-translate/useTranslation";
|
|
2
|
-
import Button from "@material
|
|
3
|
-
import Grid from "@material
|
|
4
|
-
import Paper from "@material
|
|
5
|
-
import CircularProgress from "@material
|
|
6
|
-
import { makeStyles } from "@material
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import Grid from "@mui/material/Grid";
|
|
4
|
+
import Paper from "@mui/material/Paper";
|
|
5
|
+
import CircularProgress from "@mui/material/CircularProgress";
|
|
6
|
+
import { makeStyles } from "@mui/material/styles";
|
|
7
7
|
|
|
8
8
|
const useStyles = makeStyles((theme) => ({
|
|
9
9
|
root: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ActionButton, WalletButton } from "../../ui";
|
|
3
|
+
import { Box } from "../../layout";
|
|
4
|
+
|
|
5
|
+
export const PayWithWallet = (props) => {
|
|
6
|
+
return (
|
|
7
|
+
<Box maxWidth={400} noColor noMargin noPadding>
|
|
8
|
+
<Box noMargin>
|
|
9
|
+
<div>Wallet Balance</div>
|
|
10
|
+
<ActionButton text="Pay now" />
|
|
11
|
+
</Box>
|
|
12
|
+
</Box>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import useTranslation from "next-translate/useTranslation";
|
|
2
|
-
import Button from "@material
|
|
3
|
-
import Chip from "@material
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import Chip from "@mui/material/Chip";
|
|
4
4
|
|
|
5
5
|
const PaymentMethod = (props) => {
|
|
6
6
|
const { t } = useTranslation("common");
|