@sikka/hawa 0.0.1 → 0.0.4
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/.github/workflows/hawa-publish-push.yml +45 -0
- package/.github/workflows/hawa-publish.yml +45 -0
- package/.prettierrc +28 -28
- package/README.md +149 -119
- package/es/index.es.js +1 -0
- package/lib/index.js +1 -0
- package/package.json +59 -47
- package/rollup.config.js +30 -40
- package/src/Assets/images/card-background/1.jpeg +0 -0
- package/src/Assets/images/card-background/10.jpeg +0 -0
- package/src/Assets/images/card-background/11.jpeg +0 -0
- package/src/Assets/images/card-background/12.jpeg +0 -0
- package/src/Assets/images/card-background/13.jpeg +0 -0
- package/src/Assets/images/card-background/14.jpeg +0 -0
- package/src/Assets/images/card-background/15.jpeg +0 -0
- package/src/Assets/images/card-background/16.jpeg +0 -0
- package/src/Assets/images/card-background/17.jpeg +0 -0
- package/src/Assets/images/card-background/18.jpeg +0 -0
- package/src/Assets/images/card-background/19.jpeg +0 -0
- package/src/Assets/images/card-background/2.jpeg +0 -0
- package/src/Assets/images/card-background/20.jpeg +0 -0
- package/src/Assets/images/card-background/21.jpeg +0 -0
- package/src/Assets/images/card-background/22.jpeg +0 -0
- package/src/Assets/images/card-background/23.jpeg +0 -0
- package/src/Assets/images/card-background/24.jpeg +0 -0
- package/src/Assets/images/card-background/25.jpeg +0 -0
- package/src/Assets/images/card-background/3.jpeg +0 -0
- package/src/Assets/images/card-background/4.jpeg +0 -0
- package/src/Assets/images/card-background/5.jpeg +0 -0
- package/src/Assets/images/card-background/6.jpeg +0 -0
- package/src/Assets/images/card-background/7.jpeg +0 -0
- package/src/Assets/images/card-background/8.jpeg +0 -0
- package/src/Assets/images/card-background/9.jpeg +0 -0
- package/src/Assets/images/card-type/amex.png +0 -0
- package/src/Assets/images/card-type/diners.png +0 -0
- package/src/Assets/images/card-type/discover.png +0 -0
- package/src/Assets/images/card-type/mastercard.png +0 -0
- package/src/Assets/images/card-type/troy.png +0 -0
- package/src/Assets/images/card-type/unionpay.png +0 -0
- package/src/Assets/images/card-type/visa.png +0 -0
- package/src/blocks/Account/UserProfile.js +15 -0
- package/src/blocks/Account/UserSettings.js +15 -0
- package/src/blocks/Account/index.js +2 -0
- package/src/blocks/AuthForms/NewPasswordForm.js +17 -0
- package/src/blocks/AuthForms/ResetPasswordForm.js +14 -0
- package/src/blocks/AuthForms/SignInForm.js +19 -0
- package/src/blocks/AuthForms/SignUpForm.js +20 -0
- package/src/blocks/AuthForms/index.js +4 -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/Payment/Form/CForm.js +326 -0
- package/src/blocks/Payment/Form/Card.js +242 -0
- package/src/blocks/Payment/Gateway/GooglePay.js +251 -0
- package/src/blocks/Payment/Gateway/Payfort.js +90 -0
- package/src/blocks/Payment/Gateway/Paypal.js +138 -0
- package/src/blocks/Payment/Gateway/Wallet.js +149 -0
- package/src/blocks/Payment/PaymentMethod.js +132 -0
- package/src/blocks/index.js +13 -0
- package/src/index.js +2 -1
- package/src/layout/Box.js +25 -0
- package/src/layout/index.js +1 -0
- package/src/stories/ActionButton.stories.js +49 -0
- package/src/stories/AdaptiveButton.stories.js +80 -84
- package/src/stories/Alert.stories.js +41 -0
- package/src/stories/AuthForm.stories.js +79 -0
- package/src/stories/Box.stories.js +64 -0
- package/src/stories/CheckBox.stories.js +35 -33
- package/src/stories/GlobalVariables.stories.js +101 -108
- package/src/stories/HawaProvider.stories.js +23 -23
- package/src/stories/InputLabel.stories.js +92 -100
- package/src/stories/Introduction.stories.js +211 -0
- package/src/stories/RadioSelector.stories.js +69 -69
- package/src/stories/TextField.stories.js +50 -59
- package/src/stories/UserAccount.stories.js +46 -0
- package/src/styles.css +400 -403
- package/src/styles.scss +679 -0
- package/src/themes/HawaProvider.js +45 -0
- package/src/ui/ActionButton.js +15 -0
- package/src/{components/Hawa/AdaptiveButton/AdaptiveButton.jsx → ui/AdaptiveButton.js} +252 -261
- package/src/{components/Hawa/AutoCompleteField/AutoCompleteField.jsx → ui/AutoCompleteField.js} +33 -33
- package/src/{components/Hawa/Checkbox/Checkbox.jsx → ui/Checkbox.js} +21 -20
- package/src/{components/Hawa/DragDropImages/DragDropImages.jsx → ui/DragDropImages.js} +180 -180
- package/src/{components/Hawa/Hawa.jsx → ui/Hawa.js} +3 -3
- package/src/{components/Hawa/RadioBox/RadioBox.jsx → ui/RadioBox.js} +29 -29
- package/src/{components/Hawa/RadioSelector/RadioSelector.jsx → ui/RadioSelector.js} +51 -51
- package/src/ui/Row.js +21 -0
- package/src/{components/Hawa/SelectedField/SelectedField.jsx → ui/SelectedField.js} +46 -46
- package/src/ui/StyledAlert.js +30 -0
- package/src/ui/StyledInputLabel.js +19 -0
- package/src/ui/StyledTooltip.js +46 -0
- package/src/{components/Hawa/TabPanel/TabPanel.jsx → ui/TabPanel.js} +37 -38
- package/src/{components/Hawa/TextArea/TextArea.jsx → ui/TextArea.js} +38 -39
- package/src/ui/TextField.js +62 -0
- package/src/{components/Hawa → ui}/index.js +13 -11
- package/src/util.js +20 -0
- package/storybook-static/0.d3bc3395610cf5d3ee94.manager.bundle.js +1 -0
- package/storybook-static/0.dd3d47f5.iframe.bundle.js +1 -0
- package/storybook-static/1.4e43f671.iframe.bundle.js +3 -0
- package/storybook-static/{4.f6eb74f4.iframe.bundle.js.LICENSE.txt → 1.4e43f671.iframe.bundle.js.LICENSE.txt} +8 -8
- package/storybook-static/1.4e43f671.iframe.bundle.js.map +1 -0
- package/storybook-static/2.9a757207.iframe.bundle.js +1 -0
- package/storybook-static/3.c1dc7159.iframe.bundle.js +1 -0
- package/storybook-static/4.8c311a6b48cad9f29317.manager.bundle.js +2 -0
- package/storybook-static/{5.fa71488e730c5c7f885f.manager.bundle.js.LICENSE.txt → 4.8c311a6b48cad9f29317.manager.bundle.js.LICENSE.txt} +8 -8
- package/storybook-static/5.88fe62ee92ff5ca67829.manager.bundle.js +1 -0
- package/storybook-static/6.96d184f368dea006cb52.manager.bundle.js +2 -0
- package/storybook-static/{11.49c687eaa6261f8b7be2.manager.bundle.js.LICENSE.txt → 6.96d184f368dea006cb52.manager.bundle.js.LICENSE.txt} +12 -12
- package/storybook-static/{7.a806a38f.iframe.bundle.js → 7.5ec31f3702b08ab0b71c.manager.bundle.js} +1 -1
- package/storybook-static/7.69d2e532.iframe.bundle.js +1 -0
- package/storybook-static/8.5ce13be7612bd3a6b864.manager.bundle.js +1 -0
- package/storybook-static/8.68cd1217.iframe.bundle.js +3 -0
- package/storybook-static/{6.fbc7b90b.iframe.bundle.js.LICENSE.txt → 8.68cd1217.iframe.bundle.js.LICENSE.txt} +12 -12
- package/storybook-static/8.68cd1217.iframe.bundle.js.map +1 -0
- package/storybook-static/9.488e3969.iframe.bundle.js +1 -0
- package/storybook-static/iframe.html +348 -138
- package/storybook-static/index.html +59 -47
- package/storybook-static/main.65cb2769.iframe.bundle.js +1 -0
- package/storybook-static/main.7e391cf7bf72b0d18ea5.manager.bundle.js +1 -0
- package/storybook-static/runtime~main.6e2e1544.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.cc29f4c2175f187a3707.manager.bundle.js +1 -0
- package/storybook-static/vendors~main.d144d840.iframe.bundle.js +3 -0
- package/storybook-static/{vendors~main.73411ca9.iframe.bundle.js.LICENSE.txt → vendors~main.d144d840.iframe.bundle.js.LICENSE.txt} +148 -148
- package/storybook-static/vendors~main.d144d840.iframe.bundle.js.map +1 -0
- package/storybook-static/vendors~main.f228d62e92b69563cefb.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.d3455eed64b243c89325.manager.bundle.js.LICENSE.txt → vendors~main.f228d62e92b69563cefb.manager.bundle.js.LICENSE.txt} +104 -88
- package/tools/build-styles.js +17 -0
- package/yarn-error.log +10910 -0
- package/src/components/Hawa/AdaptiveButton/index.js +0 -1
- package/src/components/Hawa/AutoCompleteField/index.js +0 -1
- package/src/components/Hawa/Checkbox/index.js +0 -1
- package/src/components/Hawa/DragDropImages/index.js +0 -1
- package/src/components/Hawa/HawaProvider/HawaProvider.js +0 -19
- package/src/components/Hawa/HawaProvider/index.js +0 -1
- package/src/components/Hawa/InputLabel/StyledInputLabel.jsx +0 -36
- package/src/components/Hawa/InputLabel/index.js +0 -1
- package/src/components/Hawa/RadioBox/index.js +0 -1
- package/src/components/Hawa/RadioSelector/index.js +0 -1
- package/src/components/Hawa/Row/Row.jsx +0 -23
- package/src/components/Hawa/Row/index.js +0 -1
- package/src/components/Hawa/SelectedField/index.js +0 -1
- package/src/components/Hawa/TabPanel/index.js +0 -1
- package/src/components/Hawa/TextArea/index.js +0 -1
- package/src/components/Hawa/TextField/TextField.jsx +0 -41
- package/src/components/Hawa/TextField/index.js +0 -1
- package/storybook-static/0.86a7edfd.iframe.bundle.js +0 -1
- package/storybook-static/0.b73eaee9a88f178d62ed.manager.bundle.js +0 -1
- package/storybook-static/1.f296d183a17268696d73.manager.bundle.js +0 -1
- package/storybook-static/10.9998ba67d65d81d20896.manager.bundle.js +0 -1
- package/storybook-static/11.49c687eaa6261f8b7be2.manager.bundle.js +0 -2
- package/storybook-static/12.c9538ed3766c96f289e7.manager.bundle.js +0 -1
- package/storybook-static/4.f6eb74f4.iframe.bundle.js +0 -3
- package/storybook-static/4.f6eb74f4.iframe.bundle.js.map +0 -1
- package/storybook-static/5.ec6f37af.iframe.bundle.js +0 -1
- package/storybook-static/5.fa71488e730c5c7f885f.manager.bundle.js +0 -2
- package/storybook-static/6.8096ae4aadde0743697b.manager.bundle.js +0 -1
- package/storybook-static/6.fbc7b90b.iframe.bundle.js +0 -3
- package/storybook-static/6.fbc7b90b.iframe.bundle.js.map +0 -1
- package/storybook-static/7.b34baecbd082bc7b188d.manager.bundle.js +0 -1
- package/storybook-static/8.15577edffecf900a8de2.manager.bundle.js +0 -1
- package/storybook-static/9.d7d85aa0a49a98f17218.manager.bundle.js +0 -1
- package/storybook-static/main.355ffc59.iframe.bundle.js +0 -1
- package/storybook-static/main.ce406c7e93b98325390e.manager.bundle.js +0 -1
- package/storybook-static/runtime~main.3d81579b.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.909d038f912f063e8837.manager.bundle.js +0 -1
- package/storybook-static/vendors~main.73411ca9.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.73411ca9.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.d3455eed64b243c89325.manager.bundle.js +0 -2
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import qs from "qs";
|
|
4
|
+
import {
|
|
5
|
+
PayPalButtons,
|
|
6
|
+
usePayPalScriptReducer,
|
|
7
|
+
PayPalScriptProvider
|
|
8
|
+
} from "@paypal/react-paypal-js";
|
|
9
|
+
|
|
10
|
+
// This values are the props in the UI
|
|
11
|
+
const currency = "USD";
|
|
12
|
+
const style = {
|
|
13
|
+
layout: "vertical",
|
|
14
|
+
color: "blue",
|
|
15
|
+
shape: "rect",
|
|
16
|
+
label: "paypal"
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const Paypal = (props) => {
|
|
20
|
+
return (
|
|
21
|
+
<PayPalScriptProvider
|
|
22
|
+
deferLoading={true}
|
|
23
|
+
options={{
|
|
24
|
+
"client-id": `${process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID}`,
|
|
25
|
+
locale: lang === "ar" ? "ar_SA" : "en_US"
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<ButtonWrapper
|
|
29
|
+
currency={currency}
|
|
30
|
+
showSpinner={false}
|
|
31
|
+
amount={getFinalPricePaypal(
|
|
32
|
+
invoice.currency?.toLowerCase() == "sar"
|
|
33
|
+
? invoice.invoice_discount
|
|
34
|
+
: invoice.invoice_discount_usd
|
|
35
|
+
)}
|
|
36
|
+
lang={lang}
|
|
37
|
+
invoiceObject={invoiceObject}
|
|
38
|
+
router={router}
|
|
39
|
+
/>
|
|
40
|
+
</PayPalScriptProvider>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Custom component to wrap the PayPalButtons and handle currency changes
|
|
45
|
+
const ButtonWrapper = ({
|
|
46
|
+
amount,
|
|
47
|
+
currency,
|
|
48
|
+
showSpinner,
|
|
49
|
+
lang,
|
|
50
|
+
invoiceObject,
|
|
51
|
+
router
|
|
52
|
+
}) => {
|
|
53
|
+
// usePayPalScriptReducer can be use only inside children of PayPalScriptProviders
|
|
54
|
+
// This is the main reason to wrap the PayPalButtons in a new component
|
|
55
|
+
const [{ options, isPending }, dispatch] = usePayPalScriptReducer();
|
|
56
|
+
console.log("amount=", amount);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
dispatch({
|
|
59
|
+
type: "resetOptions",
|
|
60
|
+
value: {
|
|
61
|
+
...options,
|
|
62
|
+
currency: currency
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}, [currency, showSpinner]);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
style={{
|
|
70
|
+
padding: "10px",
|
|
71
|
+
marginTop: "10px",
|
|
72
|
+
fontSize: "17px",
|
|
73
|
+
width: "100%"
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{showSpinner && isPending && <div className="spinner" />}
|
|
77
|
+
<PayPalButtons
|
|
78
|
+
style={style}
|
|
79
|
+
disabled={false}
|
|
80
|
+
//forceReRender={[amount, currency, style]}
|
|
81
|
+
fundingSource={undefined}
|
|
82
|
+
createOrder={(data, actions) => {
|
|
83
|
+
console.log("lang=", amount);
|
|
84
|
+
return actions.order
|
|
85
|
+
.create({
|
|
86
|
+
purchase_units: [
|
|
87
|
+
{
|
|
88
|
+
amount: {
|
|
89
|
+
currency_code: currency,
|
|
90
|
+
value: amount
|
|
91
|
+
},
|
|
92
|
+
reference_id: invoiceObject._id
|
|
93
|
+
/*items: [
|
|
94
|
+
name: ,
|
|
95
|
+
unit_amount: ,
|
|
96
|
+
tax: ,
|
|
97
|
+
quantity: ,
|
|
98
|
+
description: ,
|
|
99
|
+
]*/
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
application_context: {
|
|
103
|
+
locale: lang === "ar" ? "ar-SA" : "en-US"
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
.then((orderId) => {
|
|
107
|
+
// Your code here after create the order
|
|
108
|
+
return orderId;
|
|
109
|
+
});
|
|
110
|
+
}}
|
|
111
|
+
onApprove={async function (data, actions) {
|
|
112
|
+
return actions.order.capture().then(async function (details) {
|
|
113
|
+
console.log("data=", details);
|
|
114
|
+
details["language"] = lang;
|
|
115
|
+
let checkoutInfo = await axios.post(
|
|
116
|
+
`${process.env.NEXT_PUBLIC_SIKKA_API_URL}/paypal/payment/finalize`,
|
|
117
|
+
qs.stringify(details)
|
|
118
|
+
);
|
|
119
|
+
if (checkoutInfo.data?.ok === true) {
|
|
120
|
+
router.push({
|
|
121
|
+
pathname: "/confirmation/" + checkoutInfo.data.transaction._id
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
router.push({
|
|
125
|
+
pathname: "/payment/error/" + props.data.merchant_reference,
|
|
126
|
+
query: {
|
|
127
|
+
code: 74
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default Paypal;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import useTranslation from "next-translate/useTranslation";
|
|
2
|
+
import Button from "@material-ui/core/Button";
|
|
3
|
+
import Grid from "@material-ui/core/Grid";
|
|
4
|
+
import Paper from "@material-ui/core/Paper";
|
|
5
|
+
import CircularProgress from "@material-ui/core/CircularProgress";
|
|
6
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
7
|
+
|
|
8
|
+
const useStyles = makeStyles((theme) => ({
|
|
9
|
+
root: {
|
|
10
|
+
flexGrow: 1
|
|
11
|
+
},
|
|
12
|
+
paper: {
|
|
13
|
+
padding: theme.spacing(2),
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
color: theme.palette.text.secondary
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
const Wallet = (props) => {
|
|
20
|
+
const { t } = useTranslation("common");
|
|
21
|
+
const classes = useStyles();
|
|
22
|
+
return (
|
|
23
|
+
<div className="block-pay-content" style={{ padding: 20 }}>
|
|
24
|
+
<div key="Payment">
|
|
25
|
+
<>
|
|
26
|
+
<Grid
|
|
27
|
+
container
|
|
28
|
+
spacing={3}
|
|
29
|
+
alignContent={"center"}
|
|
30
|
+
alignItems={"center"}
|
|
31
|
+
style={{ width: "100%", margin: 0 }}
|
|
32
|
+
>
|
|
33
|
+
<Grid item xs={4}>
|
|
34
|
+
<Paper
|
|
35
|
+
className={classes.paper}
|
|
36
|
+
style={{
|
|
37
|
+
boxShadow: "none",
|
|
38
|
+
fontWeight: "bold"
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{t("payment-made")} <br />
|
|
42
|
+
{props.amount} {t(props.SelectedCurrency)}
|
|
43
|
+
</Paper>
|
|
44
|
+
</Grid>
|
|
45
|
+
<Grid
|
|
46
|
+
item
|
|
47
|
+
style={{
|
|
48
|
+
padding: 0,
|
|
49
|
+
margin: "-5px"
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<Paper
|
|
53
|
+
className={classes.paper}
|
|
54
|
+
style={{
|
|
55
|
+
backgroundColor: "transparent",
|
|
56
|
+
boxShadow: "none",
|
|
57
|
+
fontSize: "18px",
|
|
58
|
+
fontWeight: "bold",
|
|
59
|
+
padding: 0
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
-
|
|
63
|
+
</Paper>
|
|
64
|
+
</Grid>
|
|
65
|
+
<Grid item xs={4}>
|
|
66
|
+
<Paper
|
|
67
|
+
className={classes.paper}
|
|
68
|
+
style={{
|
|
69
|
+
boxShadow: "none",
|
|
70
|
+
fontWeight: "bold"
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{t("amount-in-wallet")} <br />
|
|
74
|
+
{props.total_wallet.toFixed(2)} {t(props.SelectedCurrency)}
|
|
75
|
+
</Paper>
|
|
76
|
+
</Grid>
|
|
77
|
+
<Grid
|
|
78
|
+
item
|
|
79
|
+
style={{
|
|
80
|
+
padding: 0,
|
|
81
|
+
margin: "-5px"
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Paper
|
|
85
|
+
className={classes.paper}
|
|
86
|
+
style={{
|
|
87
|
+
backgroundColor: "transparent",
|
|
88
|
+
boxShadow: "none",
|
|
89
|
+
fontSize: "18px",
|
|
90
|
+
fontWeight: "bold",
|
|
91
|
+
padding: 0
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
=
|
|
95
|
+
</Paper>
|
|
96
|
+
</Grid>
|
|
97
|
+
<Grid item xs={4}>
|
|
98
|
+
<Paper
|
|
99
|
+
className={classes.paper}
|
|
100
|
+
style={{
|
|
101
|
+
boxShadow: "none",
|
|
102
|
+
fontWeight: "bold"
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
{t("left-amount-wallet")} <br />
|
|
106
|
+
{props.leftAmount.toFixed(2)} {t(props.SelectedCurrency)}
|
|
107
|
+
</Paper>
|
|
108
|
+
</Grid>
|
|
109
|
+
<Grid item xs={12}>
|
|
110
|
+
<Paper
|
|
111
|
+
className={classes.paper}
|
|
112
|
+
style={{
|
|
113
|
+
boxShadow: "none",
|
|
114
|
+
fontWeight: "bold"
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{t("remaining-amount")}: {props.remainingAmount.toFixed(2)}{" "}
|
|
118
|
+
{t(props.SelectedCurrency)}
|
|
119
|
+
</Paper>
|
|
120
|
+
</Grid>
|
|
121
|
+
{!props.leftAmount && (
|
|
122
|
+
<Grid item xs={12}>
|
|
123
|
+
<Button
|
|
124
|
+
variant="contained"
|
|
125
|
+
color="primary"
|
|
126
|
+
fullWidth
|
|
127
|
+
type="submit"
|
|
128
|
+
onClick={(e) => props.handleWalletPayNow(e)}
|
|
129
|
+
>
|
|
130
|
+
{props.loading ? (
|
|
131
|
+
<CircularProgress
|
|
132
|
+
variant="indeterminate"
|
|
133
|
+
style={{ color: "white" }}
|
|
134
|
+
size={25}
|
|
135
|
+
/>
|
|
136
|
+
) : (
|
|
137
|
+
t("pay-now")
|
|
138
|
+
)}
|
|
139
|
+
</Button>
|
|
140
|
+
</Grid>
|
|
141
|
+
)}
|
|
142
|
+
</Grid>
|
|
143
|
+
</>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export default Wallet;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import useTranslation from "next-translate/useTranslation";
|
|
2
|
+
import Button from "@material-ui/core/Button";
|
|
3
|
+
import Chip from "@material-ui/core/Chip";
|
|
4
|
+
|
|
5
|
+
const PaymentMethod = (props) => {
|
|
6
|
+
const { t } = useTranslation("common");
|
|
7
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
{props.wallet ? (
|
|
11
|
+
<PaymentMethodButton
|
|
12
|
+
imageURL={`/wallet.png`}
|
|
13
|
+
methodCode="wallet"
|
|
14
|
+
methodLabel={t("current-wallet")}
|
|
15
|
+
handlePaymentMethod={props.handlePaymentMethod}
|
|
16
|
+
/>
|
|
17
|
+
) : null}
|
|
18
|
+
{props.creditcard ? (
|
|
19
|
+
<PaymentMethodButton
|
|
20
|
+
imageURL={`/visa-master.png`}
|
|
21
|
+
methodCode="creditcard"
|
|
22
|
+
methodLabel={t("credit-card")}
|
|
23
|
+
handlePaymentMethod={props.handlePaymentMethod}
|
|
24
|
+
/>
|
|
25
|
+
) : null}
|
|
26
|
+
{props.mada ? (
|
|
27
|
+
<PaymentMethodButton
|
|
28
|
+
imageURL={`/mada.png`}
|
|
29
|
+
methodCode="mada"
|
|
30
|
+
methodLabel={t("mada")}
|
|
31
|
+
handlePaymentMethod={props.handlePaymentMethod}
|
|
32
|
+
/>
|
|
33
|
+
) : null}
|
|
34
|
+
{props.stcpay ? (
|
|
35
|
+
<PaymentMethodButton
|
|
36
|
+
methodCode="stcpay"
|
|
37
|
+
methodLabel={"STC Pay"}
|
|
38
|
+
chip={t("soon")}
|
|
39
|
+
handlePaymentMethod={props.handlePaymentMethod}
|
|
40
|
+
/>
|
|
41
|
+
) : null}
|
|
42
|
+
{props.paypal ? (
|
|
43
|
+
<PaymentMethodButton
|
|
44
|
+
methodCode="paypal"
|
|
45
|
+
methodLabel={t("paypal")}
|
|
46
|
+
handlePaymentMethod={props.handlePaymentMethod}
|
|
47
|
+
/>
|
|
48
|
+
) : null}
|
|
49
|
+
{isSafari && applepay && (
|
|
50
|
+
<PaymentMethodButton
|
|
51
|
+
methodCode="applepay"
|
|
52
|
+
methodLabel={t("applepay")}
|
|
53
|
+
handlePaymentMethod={props.handlePaymentMethod}
|
|
54
|
+
/>
|
|
55
|
+
)}
|
|
56
|
+
{props.googlepay ? (
|
|
57
|
+
<PaymentMethodButton
|
|
58
|
+
methodCode="googlepay"
|
|
59
|
+
chip={t("soon")}
|
|
60
|
+
methodLabel={t("googlepay")}
|
|
61
|
+
handlePaymentMethod={props.handlePaymentMethod}
|
|
62
|
+
/>
|
|
63
|
+
) : null}
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const PaymentMethodButton = (props) => {
|
|
69
|
+
return (
|
|
70
|
+
<Button
|
|
71
|
+
disabled={props?.chip ? true : false}
|
|
72
|
+
fullWidth
|
|
73
|
+
variant="contained"
|
|
74
|
+
color="secondary"
|
|
75
|
+
style={{
|
|
76
|
+
backgroundColor: "white",
|
|
77
|
+
opacity: props.chip ? 0.7 : 1,
|
|
78
|
+
padding: 20,
|
|
79
|
+
width: "90%",
|
|
80
|
+
margin: 10,
|
|
81
|
+
borderRadius: "var(--borderR)"
|
|
82
|
+
}}
|
|
83
|
+
onClick={(e) => props.handlePaymentMethod(e, props.methodCode)}
|
|
84
|
+
>
|
|
85
|
+
{props.imageURL ? (
|
|
86
|
+
<div
|
|
87
|
+
style={{
|
|
88
|
+
// backgroundColor: "red",
|
|
89
|
+
width: "50%",
|
|
90
|
+
textAlign: "right",
|
|
91
|
+
paddingRight: 20
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
<img
|
|
95
|
+
src={props.imageURL}
|
|
96
|
+
// src={`https://qawaim-images.s3-ap-southeast-1.amazonaws.com/payments/visa.png`}
|
|
97
|
+
// alt=""
|
|
98
|
+
// srcset=""
|
|
99
|
+
// height={"100%"}
|
|
100
|
+
// width={"30%"}
|
|
101
|
+
style={{
|
|
102
|
+
// height: "100%",
|
|
103
|
+
// aspectRatio: "6/4",
|
|
104
|
+
maxWidth: 70,
|
|
105
|
+
maxHeight: 70,
|
|
106
|
+
height: "auto"
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
) : null}
|
|
111
|
+
<div
|
|
112
|
+
style={{
|
|
113
|
+
// backgroundColor: "blue",
|
|
114
|
+
width: "50%",
|
|
115
|
+
textAlign: props.imageURL ? "left" : "center"
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{props.methodLabel}
|
|
119
|
+
{props.chip ? (
|
|
120
|
+
<Chip
|
|
121
|
+
size="small"
|
|
122
|
+
color="primary"
|
|
123
|
+
label={props.chip}
|
|
124
|
+
style={{ marginRight: 10, marginLeft: 10 }}
|
|
125
|
+
/>
|
|
126
|
+
) : null}
|
|
127
|
+
</div>
|
|
128
|
+
</Button>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default PaymentMethod;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _GooglePay = require('./Payment/Gateway/GooglePay');
|
|
4
|
+
var _Payfort = require('./Payment/Gateway/Payfort');
|
|
5
|
+
var _Paypal = require('./Payment/Gateway/Paypal');
|
|
6
|
+
var _Wallet = require('./Payment/Gateway/Wallet');
|
|
7
|
+
var _PaymentMethod = require('./Payment/PaymentMethod');
|
|
8
|
+
|
|
9
|
+
exports.GooglePay = _GooglePay.default;
|
|
10
|
+
exports.Payfort = _Payfort.default;
|
|
11
|
+
exports.Paypal = _Paypal.default;
|
|
12
|
+
exports.Wallet = _Wallet.default;
|
|
13
|
+
exports.PaymentMethod = _PaymentMethod.default;
|
package/src/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./blocks";
|
|
2
|
+
//export * from "./components/Hawa";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeProvider } from "../themes/HawaProvider";
|
|
3
|
+
|
|
4
|
+
export const Box = (props) => {
|
|
5
|
+
const theme = useContext(ThemeProvider);
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
style={{
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
// justifyContent: 'center',
|
|
12
|
+
// alignItems: 'center',
|
|
13
|
+
|
|
14
|
+
backgroundColor: theme.layoutColor,
|
|
15
|
+
color: theme.textColor,
|
|
16
|
+
padding: theme.paddings,
|
|
17
|
+
margin: theme.margins,
|
|
18
|
+
borderRadius: theme.borderRadius,
|
|
19
|
+
maxWidth: props.maxWidth
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
{props.children}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Box";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { defaultTheme, HawaProvider } from "../themes/HawaProvider";
|
|
4
|
+
import { ActionButton } from "../ui";
|
|
5
|
+
|
|
6
|
+
const Template = (args) => {
|
|
7
|
+
const theme = {
|
|
8
|
+
borderRadius: 10,
|
|
9
|
+
primaryColor: "green",
|
|
10
|
+
secondaryColor: "red",
|
|
11
|
+
// margins: "10px",
|
|
12
|
+
paperColors: "#c6c6c6",
|
|
13
|
+
paddings: 10,
|
|
14
|
+
margins: 10
|
|
15
|
+
};
|
|
16
|
+
return (
|
|
17
|
+
<HawaProvider theme={{ ...defaultTheme, ...args.theme }}>
|
|
18
|
+
<ActionButton secondary={args.secondary} text='here' />
|
|
19
|
+
</HawaProvider>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
//types:
|
|
23
|
+
//error (red)
|
|
24
|
+
//warning (red)
|
|
25
|
+
//notice (blue)
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
title: "UI/ActionButton",
|
|
29
|
+
component: ActionButton
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Primary = Template.bind({});
|
|
33
|
+
Primary.args = {
|
|
34
|
+
showText: true,
|
|
35
|
+
buttonLabel: "test",
|
|
36
|
+
borderRadius: 5,
|
|
37
|
+
textColor: "#000000",
|
|
38
|
+
buttonColor: "#f9f9f9"
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Secondary = Template.bind({});
|
|
42
|
+
Secondary.args = {
|
|
43
|
+
secondary: true,
|
|
44
|
+
showText: true,
|
|
45
|
+
buttonLabel: "test",
|
|
46
|
+
borderRadius: 5,
|
|
47
|
+
textColor: "#000000",
|
|
48
|
+
buttonColor: "#f9f9f9",
|
|
49
|
+
};
|
|
@@ -1,84 +1,80 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const Template = (args) => {
|
|
7
|
-
const theme = {
|
|
8
|
-
borderRadius:
|
|
9
|
-
primaryColor: "
|
|
10
|
-
secondaryColor: "red",
|
|
11
|
-
// margins: "10px",
|
|
12
|
-
paddings: 10
|
|
13
|
-
};
|
|
14
|
-
return (
|
|
15
|
-
<HawaProvider theme={theme}>
|
|
16
|
-
<AdaptiveButton {...args} />
|
|
17
|
-
</HawaProvider>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
export default {
|
|
21
|
-
title: "
|
|
22
|
-
component: AdaptiveButton,
|
|
23
|
-
argsTypes: {
|
|
24
|
-
buttonLabel: { control: "text" },
|
|
25
|
-
borderRadius: { control: "number" },
|
|
26
|
-
buttonColor: { control: "color" },
|
|
27
|
-
padding: { control: "number" },
|
|
28
|
-
hintTitle: { control: "text" },
|
|
29
|
-
hintContent: { control: "text" }
|
|
30
|
-
},
|
|
31
|
-
args: {
|
|
32
|
-
// type: "text",
|
|
33
|
-
// buttonLabel: "Test"
|
|
34
|
-
// borderRadius: 15,
|
|
35
|
-
hintTitle: "test",
|
|
36
|
-
hintContent: "more test",
|
|
37
|
-
buttonColor: "#f9f9f9"
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const Light = Template.bind({});
|
|
42
|
-
Light.args = {
|
|
43
|
-
showText: true,
|
|
44
|
-
buttonLabel: "test",
|
|
45
|
-
borderRadius: 5,
|
|
46
|
-
icon: <CastIcon />,
|
|
47
|
-
textColor: "#000000",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// defaultValue: "This is default value",
|
|
82
|
-
// inputLabel: "Text Field",
|
|
83
|
-
// padding: 10
|
|
84
|
-
};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import CastIcon from "@material-ui/icons/Cast";
|
|
3
|
+
import { HawaProvider } from "../themes/HawaProvider";
|
|
4
|
+
import { AdaptiveButton } from "../ui";
|
|
5
|
+
|
|
6
|
+
const Template = (args) => {
|
|
7
|
+
const theme = {
|
|
8
|
+
borderRadius: 10,
|
|
9
|
+
primaryColor: "#004fff",
|
|
10
|
+
secondaryColor: "red",
|
|
11
|
+
// margins: "10px",
|
|
12
|
+
paddings: 10
|
|
13
|
+
};
|
|
14
|
+
return (
|
|
15
|
+
<HawaProvider theme={theme}>
|
|
16
|
+
<AdaptiveButton {...args} />
|
|
17
|
+
</HawaProvider>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export default {
|
|
21
|
+
title: "UI/AdaptiveButton",
|
|
22
|
+
component: AdaptiveButton,
|
|
23
|
+
argsTypes: {
|
|
24
|
+
buttonLabel: { control: "text" },
|
|
25
|
+
borderRadius: { control: "number" },
|
|
26
|
+
buttonColor: { control: "color" },
|
|
27
|
+
padding: { control: "number" },
|
|
28
|
+
hintTitle: { control: "text" },
|
|
29
|
+
hintContent: { control: "text" }
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
// type: "text",
|
|
33
|
+
// buttonLabel: "Test"
|
|
34
|
+
// borderRadius: 15,
|
|
35
|
+
hintTitle: "test",
|
|
36
|
+
hintContent: "more test",
|
|
37
|
+
buttonColor: "#f9f9f9"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Light = Template.bind({});
|
|
42
|
+
Light.args = {
|
|
43
|
+
showText: true,
|
|
44
|
+
buttonLabel: "test",
|
|
45
|
+
borderRadius: 5,
|
|
46
|
+
icon: <CastIcon />,
|
|
47
|
+
textColor: "#000000",
|
|
48
|
+
buttonColor: "#f9f9f9"
|
|
49
|
+
// placeholder: "Example ...",
|
|
50
|
+
// defaultValue: "This is default value",
|
|
51
|
+
// inputLabel: "Text Field",
|
|
52
|
+
// padding: 10
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Dark = Template.bind({});
|
|
56
|
+
Dark.args = {
|
|
57
|
+
showText: true,
|
|
58
|
+
buttonLabel: "test",
|
|
59
|
+
borderRadius: 5,
|
|
60
|
+
buttonColor: "#878787",
|
|
61
|
+
textColor: "#ffffff",
|
|
62
|
+
icon: <CastIcon />
|
|
63
|
+
// placeholder: "Exemple ...",
|
|
64
|
+
// defaultValue: "This is default value",
|
|
65
|
+
// inputLabel: "Text Field",
|
|
66
|
+
// padding: 10
|
|
67
|
+
};
|
|
68
|
+
export const Danger = Template.bind({});
|
|
69
|
+
Danger.args = {
|
|
70
|
+
showText: true,
|
|
71
|
+
buttonLabel: "test",
|
|
72
|
+
borderRadius: 5,
|
|
73
|
+
buttonColor: "#c0c0c0",
|
|
74
|
+
danger: true,
|
|
75
|
+
icon: <CastIcon />
|
|
76
|
+
// placeholder: "Exemple ...",
|
|
77
|
+
// defaultValue: "This is default value",
|
|
78
|
+
// inputLabel: "Text Field",
|
|
79
|
+
// padding: 10
|
|
80
|
+
};
|