@sikka/hawa 0.0.3 → 0.0.6

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.
Files changed (158) hide show
  1. package/.github/workflows/hawa-publish-push.yml +45 -0
  2. package/.github/workflows/hawa-publish.yml +2 -0
  3. package/es/index.es.js +1 -0
  4. package/lib/index.js +1 -0
  5. package/package.json +24 -13
  6. package/rollup.config.js +2 -2
  7. package/src/Assets/images/card-background/1.jpeg +0 -0
  8. package/src/Assets/images/card-background/10.jpeg +0 -0
  9. package/src/Assets/images/card-background/11.jpeg +0 -0
  10. package/src/Assets/images/card-background/12.jpeg +0 -0
  11. package/src/Assets/images/card-background/13.jpeg +0 -0
  12. package/src/Assets/images/card-background/14.jpeg +0 -0
  13. package/src/Assets/images/card-background/15.jpeg +0 -0
  14. package/src/Assets/images/card-background/16.jpeg +0 -0
  15. package/src/Assets/images/card-background/17.jpeg +0 -0
  16. package/src/Assets/images/card-background/18.jpeg +0 -0
  17. package/src/Assets/images/card-background/19.jpeg +0 -0
  18. package/src/Assets/images/card-background/2.jpeg +0 -0
  19. package/src/Assets/images/card-background/20.jpeg +0 -0
  20. package/src/Assets/images/card-background/21.jpeg +0 -0
  21. package/src/Assets/images/card-background/22.jpeg +0 -0
  22. package/src/Assets/images/card-background/23.jpeg +0 -0
  23. package/src/Assets/images/card-background/24.jpeg +0 -0
  24. package/src/Assets/images/card-background/25.jpeg +0 -0
  25. package/src/Assets/images/card-background/3.jpeg +0 -0
  26. package/src/Assets/images/card-background/4.jpeg +0 -0
  27. package/src/Assets/images/card-background/5.jpeg +0 -0
  28. package/src/Assets/images/card-background/6.jpeg +0 -0
  29. package/src/Assets/images/card-background/7.jpeg +0 -0
  30. package/src/Assets/images/card-background/8.jpeg +0 -0
  31. package/src/Assets/images/card-background/9.jpeg +0 -0
  32. package/src/Assets/images/card-type/amex.png +0 -0
  33. package/src/Assets/images/card-type/diners.png +0 -0
  34. package/src/Assets/images/card-type/discover.png +0 -0
  35. package/src/Assets/images/card-type/mastercard.png +0 -0
  36. package/src/Assets/images/card-type/troy.png +0 -0
  37. package/src/Assets/images/card-type/unionpay.png +0 -0
  38. package/src/Assets/images/card-type/visa.png +0 -0
  39. package/src/blocks/Account/UserProfile.js +11 -11
  40. package/src/blocks/Account/UserSettings.js +11 -11
  41. package/src/blocks/AuthForms/NewPasswordForm.js +83 -10
  42. package/src/blocks/AuthForms/ResetPasswordForm.js +50 -8
  43. package/src/blocks/AuthForms/SignInForm.js +96 -13
  44. package/src/blocks/AuthForms/SignUpForm.js +113 -13
  45. package/src/blocks/Payment/ChargeWalletForm.js +32 -0
  46. package/src/blocks/Payment/CreditCardForm.js +31 -0
  47. package/src/blocks/Payment/Form/CForm.js +328 -0
  48. package/src/blocks/Payment/Form/Card.js +242 -0
  49. package/src/blocks/Payment/Gateway/GooglePay.js +251 -0
  50. package/src/blocks/Payment/Gateway/Payfort.js +90 -0
  51. package/src/blocks/Payment/Gateway/Paypal.js +138 -0
  52. package/src/blocks/Payment/Gateway/Wallet.js +149 -0
  53. package/src/blocks/Payment/PayWithWallet.js +35 -0
  54. package/src/blocks/Payment/PaymentMethod.js +132 -0
  55. package/src/blocks/Payment/SelectPayment.js +94 -0
  56. package/src/blocks/Payment/index.js +18 -0
  57. package/src/index.js +4 -1
  58. package/src/layout/Box.js +30 -17
  59. package/src/stories/BlocksStories/AuthForm.stories.js +105 -0
  60. package/src/stories/BlocksStories/PaymentForm.stories.js +82 -0
  61. package/src/stories/{UserAccount.stories.js → BlocksStories/UserAccount.stories.js} +2 -2
  62. package/src/stories/GlobalVariables.stories.js +33 -90
  63. package/src/stories/HawaProvider.stories.js +0 -1
  64. package/src/stories/Introduction.stories.js +132 -110
  65. package/src/stories/LayoutStories/Box.stories.js +56 -0
  66. package/src/stories/UIStories/ActionButton.stories.js +53 -0
  67. package/src/stories/{AdaptiveButton.stories.js → UIStories/AdaptiveButton.stories.js} +3 -3
  68. package/src/stories/UIStories/Alert.stories.js +55 -0
  69. package/src/stories/{CheckBox.stories.js → UIStories/CheckBox.stories.js} +3 -4
  70. package/src/stories/UIStories/InputLabel.stories.js +13 -0
  71. package/src/stories/{RadioSelector.stories.js → UIStories/RadioSelector.stories.js} +5 -6
  72. package/src/stories/{TextField.stories.js → UIStories/TextField.stories.js} +4 -5
  73. package/src/styles.scss +679 -0
  74. package/src/themes/HawaProvider.js +110 -16
  75. package/src/ui/ActionButton.js +35 -10
  76. package/src/ui/AdaptiveButton.js +29 -29
  77. package/src/ui/ApplePayButton.js +93 -0
  78. package/src/ui/AutoCompleteField.js +0 -1
  79. package/src/ui/DragDropImages.js +2 -2
  80. package/src/ui/GithubButton.js +90 -0
  81. package/src/ui/GoogleButton.js +82 -0
  82. package/src/ui/GooglePayButton.js +93 -0
  83. package/src/ui/HawaAlert.js +37 -0
  84. package/src/ui/HawaButton.js +48 -0
  85. package/src/ui/{Checkbox.js → HawaCheckbox.js} +3 -3
  86. package/src/ui/HawaInputLabel.js +32 -0
  87. package/src/ui/HawaLogoButton.js +48 -0
  88. package/src/ui/{RadioSelector.js → HawaRadio.js} +1 -1
  89. package/src/ui/{TextArea.js → HawaTextArea.js} +2 -2
  90. package/src/ui/HawaTextField.js +113 -0
  91. package/src/ui/HawaTypography.js +29 -0
  92. package/src/ui/MadaButton.js +93 -0
  93. package/src/ui/PayPalButton.js +93 -0
  94. package/src/ui/RadioBox.js +2 -2
  95. package/src/ui/STCPayButton.js +93 -0
  96. package/src/ui/SelectedField.js +4 -4
  97. package/src/ui/StyledTooltip.js +1 -1
  98. package/src/ui/TabPanel.js +1 -1
  99. package/src/ui/TwitterButton.js +83 -0
  100. package/src/ui/VisaMasterButton.js +93 -0
  101. package/src/ui/WalletButton.js +24 -0
  102. package/src/ui/index.js +23 -11
  103. package/storybook-static/0.0d994c92.iframe.bundle.js +3 -0
  104. package/storybook-static/{1.4e43f671.iframe.bundle.js.LICENSE.txt → 0.0d994c92.iframe.bundle.js.LICENSE.txt} +0 -0
  105. package/storybook-static/0.0d994c92.iframe.bundle.js.map +1 -0
  106. package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +1 -0
  107. package/storybook-static/1.aabc3f3a.iframe.bundle.js +1 -0
  108. package/storybook-static/{3.c1dc7159.iframe.bundle.js → 2.430bf1e3.iframe.bundle.js} +1 -1
  109. package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +2 -0
  110. package/storybook-static/{4.8c311a6b48cad9f29317.manager.bundle.js.LICENSE.txt → 4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt} +0 -0
  111. package/storybook-static/{5.88fe62ee92ff5ca67829.manager.bundle.js → 5.63ab4f94d50a3acf080d.manager.bundle.js} +1 -1
  112. package/storybook-static/{7.69d2e532.iframe.bundle.js → 6.704d1e8d.iframe.bundle.js} +1 -1
  113. package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js → 6.a6d45262f7e98f3f18d3.manager.bundle.js} +2 -2
  114. package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js.LICENSE.txt → 6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt} +0 -0
  115. package/storybook-static/{7.5ec31f3702b08ab0b71c.manager.bundle.js → 7.097710753af9a1c41b80.manager.bundle.js} +1 -1
  116. package/storybook-static/{8.68cd1217.iframe.bundle.js → 7.9ce807e3.iframe.bundle.js} +3 -3
  117. package/storybook-static/{8.68cd1217.iframe.bundle.js.LICENSE.txt → 7.9ce807e3.iframe.bundle.js.LICENSE.txt} +0 -0
  118. package/storybook-static/7.9ce807e3.iframe.bundle.js.map +1 -0
  119. package/storybook-static/{8.5ce13be7612bd3a6b864.manager.bundle.js → 8.76c3cbf398692028e834.manager.bundle.js} +1 -1
  120. package/storybook-static/{9.488e3969.iframe.bundle.js → 8.c4cb6081.iframe.bundle.js} +1 -1
  121. package/storybook-static/iframe.html +1 -1
  122. package/storybook-static/index.html +1 -1
  123. package/storybook-static/main.ac6e4b72b033097dad76.manager.bundle.js +1 -0
  124. package/storybook-static/main.e55ce615.iframe.bundle.js +1 -0
  125. package/storybook-static/{runtime~main.cc29f4c2175f187a3707.manager.bundle.js → runtime~main.c8dac23bc753439736f0.manager.bundle.js} +1 -1
  126. package/storybook-static/runtime~main.cfefe972.iframe.bundle.js +1 -0
  127. package/storybook-static/vendors~main.30a2c5d7.iframe.bundle.js +76 -0
  128. package/storybook-static/{vendors~main.d144d840.iframe.bundle.js.LICENSE.txt → vendors~main.30a2c5d7.iframe.bundle.js.LICENSE.txt} +3 -30
  129. package/storybook-static/vendors~main.30a2c5d7.iframe.bundle.js.map +1 -0
  130. package/storybook-static/vendors~main.a697e07137d366f95f76.manager.bundle.js +2 -0
  131. package/storybook-static/{vendors~main.f228d62e92b69563cefb.manager.bundle.js.LICENSE.txt → vendors~main.a697e07137d366f95f76.manager.bundle.js.LICENSE.txt} +0 -0
  132. package/tools/build-styles.js +17 -0
  133. package/src/blocks/AuthForms/viaFacebook.js +0 -0
  134. package/src/blocks/AuthForms/viaGithub.js +0 -0
  135. package/src/blocks/AuthForms/viaGoogle.js +0 -0
  136. package/src/blocks/AuthForms/viaTwitter.js +0 -0
  137. package/src/stories/ActionButton.stories.js +0 -49
  138. package/src/stories/Alert.stories.js +0 -41
  139. package/src/stories/AuthForm.stories.js +0 -79
  140. package/src/stories/Box.stories.js +0 -64
  141. package/src/stories/InputLabel.stories.js +0 -92
  142. package/src/ui/StyledAlert.js +0 -30
  143. package/src/ui/StyledInputLabel.js +0 -19
  144. package/src/ui/TextField.js +0 -62
  145. package/storybook-static/0.d3bc3395610cf5d3ee94.manager.bundle.js +0 -1
  146. package/storybook-static/0.dd3d47f5.iframe.bundle.js +0 -1
  147. package/storybook-static/1.4e43f671.iframe.bundle.js +0 -3
  148. package/storybook-static/1.4e43f671.iframe.bundle.js.map +0 -1
  149. package/storybook-static/2.9a757207.iframe.bundle.js +0 -1
  150. package/storybook-static/4.8c311a6b48cad9f29317.manager.bundle.js +0 -2
  151. package/storybook-static/8.68cd1217.iframe.bundle.js.map +0 -1
  152. package/storybook-static/main.65cb2769.iframe.bundle.js +0 -1
  153. package/storybook-static/main.7e391cf7bf72b0d18ea5.manager.bundle.js +0 -1
  154. package/storybook-static/runtime~main.6e2e1544.iframe.bundle.js +0 -1
  155. package/storybook-static/vendors~main.d144d840.iframe.bundle.js +0 -3
  156. package/storybook-static/vendors~main.d144d840.iframe.bundle.js.map +0 -1
  157. package/storybook-static/vendors~main.f228d62e92b69563cefb.manager.bundle.js +0 -2
  158. package/yarn-error.log +0 -10910
@@ -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 "@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
+
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,35 @@
1
+ import React from "react";
2
+ import {
3
+ HawaTextField,
4
+ ActionButton,
5
+ GoogleButton,
6
+ TwitterButton,
7
+ GithubButton,
8
+ VisaMasterButton,
9
+ MadaButton,
10
+ STCPayButton,
11
+ PayPalButton,
12
+ GooglePayButton,
13
+ ApplePayButton,
14
+ WalletButton
15
+ } from "../../ui";
16
+ import { Box } from "../../layout";
17
+ import PropTypes from "prop-types";
18
+
19
+ export const PayWithWallet = (props) => {
20
+ return (
21
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
22
+ <Box themeType={props.theme} noMargin>
23
+ <div>Wallet Balance</div>
24
+ {props.viaWallet && (
25
+ <WalletButton
26
+ themeType={props.theme}
27
+ outlined
28
+ buttonText={props.walletLabel}
29
+ handleClick={props.handleWallet}
30
+ />
31
+ )}
32
+ </Box>
33
+ </Box>
34
+ );
35
+ };
@@ -0,0 +1,132 @@
1
+ import useTranslation from "next-translate/useTranslation";
2
+ import Button from "@mui/material/Button";
3
+ import Chip from "@mui/material/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,94 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { Box } from "../../layout";
4
+ import {
5
+ HawaTextField,
6
+ VisaMasterButton,
7
+ MadaButton,
8
+ STCPayButton,
9
+ PayPalButton,
10
+ GooglePayButton,
11
+ ApplePayButton,
12
+ WalletButton,
13
+ HawaTypography
14
+ } from "../../ui";
15
+
16
+ export const SelectPayment = (props) => {
17
+ return (
18
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
19
+ <Box themeType={props.theme} noMargin>
20
+ <HawaTypography themeType={props.theme} align="center">
21
+ Choose Payment
22
+ </HawaTypography>
23
+ {props.viaWallet && (
24
+ <WalletButton
25
+ outlined
26
+ themeType={props.theme}
27
+ buttonText={props.walletLabel}
28
+ onClick={props.handleWallet}
29
+ />
30
+ )}
31
+ {props.viaCreditCard && (
32
+ <VisaMasterButton
33
+ outlined
34
+ themeType={props.theme}
35
+ buttonText={props.visaMasterLabel}
36
+ handleClick={props.handleCreditCard}
37
+ />
38
+ )}
39
+ {props.viaMada && (
40
+ <MadaButton
41
+ outlined
42
+ themeType={props.theme}
43
+ buttonText={props.madaLabel}
44
+ handleClick={props.handleMada}
45
+ />
46
+ )}
47
+
48
+ {props.viaSTCPay && (
49
+ <STCPayButton
50
+ outlined
51
+ themeType={props.theme}
52
+ buttonText={props.stcPayLabel}
53
+ handleClick={props.handleSTCPay}
54
+ />
55
+ )}
56
+ {props.viaPayPal && (
57
+ <PayPalButton
58
+ outlined
59
+ themeType={props.theme}
60
+ buttonText={props.paypalLabel}
61
+ handleClick={props.handlePayPal}
62
+ />
63
+ )}
64
+ {props.viaGooglePay && (
65
+ <GooglePayButton
66
+ outlined
67
+ themeType={props.theme}
68
+ buttonText={props.googlePayLabel}
69
+ handleClick={props.handleGooglePay}
70
+ />
71
+ )}
72
+
73
+ {props.viaApplePay && (
74
+ <ApplePayButton
75
+ outlined
76
+ themeType={props.theme}
77
+ buttonText={props.applePayLabel}
78
+ handleClick={props.handleApplePay}
79
+ />
80
+ )}
81
+ </Box>
82
+ </Box>
83
+ );
84
+ };
85
+
86
+ HawaTextField.propTypes = {
87
+ theme: PropTypes.oneOf(["secondary", "primary"]),
88
+ viaApplePay: PropTypes.bool,
89
+ viaGooglePay: PropTypes.bool,
90
+ viaSTCPay: PropTypes.bool,
91
+ viaCreditCard: PropTypes.bool,
92
+ viaPayPal: PropTypes.bool,
93
+ handleApplePay: PropTypes.func
94
+ };
@@ -0,0 +1,18 @@
1
+ // "use strict";
2
+
3
+ // var _GooglePay = require("./Gateway/GooglePay");
4
+ // var _Payfort = require("./Gateway/Payfort");
5
+ // var _Paypal = require("./Gateway/Paypal");
6
+ // var _Wallet = require("./Gateway/Wallet");
7
+ // var _PaymentMethod = require("./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;
14
+
15
+ export * from "./SelectPayment";
16
+ export * from "./CreditCardForm";
17
+ export * from "./ChargeWalletForm";
18
+ export * from "./PayWithWallet";
package/src/index.js CHANGED
@@ -1 +1,4 @@
1
- export * from "./components/Hawa";
1
+ export * from "./blocks/Account";
2
+ export * from "./blocks/AuthForms";
3
+ export * from "./blocks/Payment";
4
+ //export * from "./components/Hawa";
package/src/layout/Box.js CHANGED
@@ -3,23 +3,36 @@ import { ThemeProvider } from "../themes/HawaProvider";
3
3
 
4
4
  export const Box = (props) => {
5
5
  const theme = useContext(ThemeProvider);
6
- return (
7
- <div
8
- style={{
9
- display: 'flex',
10
- flexDirection: 'column',
11
- // justifyContent: 'center',
12
- // alignItems: 'center',
6
+ let boxStyle = {};
13
7
 
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>
8
+ let currentTheme = Object.keys(theme.actionButton).find(
9
+ (themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
24
10
  );
11
+ if (currentTheme) {
12
+ boxStyle = {
13
+ display: "flex",
14
+ flexDirection: "column",
15
+ ...theme.layout[currentTheme],
16
+ backgroundColor: props.noColor
17
+ ? "none"
18
+ : theme.layout[currentTheme].backgroundColor,
19
+ padding: props.noPadding ? 0 : theme.layout[currentTheme].padding,
20
+ margin: props.noMargin ? 0 : theme.layout[currentTheme].margin,
21
+ maxWidth: props.maxWidth
22
+ };
23
+ } else {
24
+ boxStyle = {
25
+ display: "flex",
26
+ flexDirection: "column",
27
+ color: "white",
28
+ marginTop: props.last ? 10 * 2 : 0,
29
+ backgroundColor: props.noColor ? "none" : "lightGrey",
30
+ padding: props.noPadding ? 0 : 10,
31
+ margin: props.noMargin ? 0 : 10,
32
+ maxWidth: props.maxWidth,
33
+ borderRadius: 0
34
+ };
35
+ }
36
+
37
+ return <div style={boxStyle}>{props.children}</div>;
25
38
  };