@sikka/hawa 0.1.1 → 0.1.3

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 (36) hide show
  1. package/dist/styles.css +24 -3
  2. package/es/blocks/AuthForms/AppLanding.d.ts +1 -0
  3. package/es/blocks/Misc/index.d.ts +0 -1
  4. package/es/index.es.js +3 -3
  5. package/lib/blocks/AuthForms/AppLanding.d.ts +1 -0
  6. package/lib/blocks/Misc/index.d.ts +0 -1
  7. package/lib/index.js +3 -3
  8. package/package.json +1 -1
  9. package/src/blocks/Account/UserProfileForm.tsx +94 -90
  10. package/src/blocks/Account/UserSettingsForm.tsx +7 -14
  11. package/src/blocks/AuthForms/AppLanding.tsx +71 -17
  12. package/src/blocks/AuthForms/CodeConfirmation.tsx +44 -43
  13. package/src/blocks/AuthForms/NewPasswordForm.tsx +66 -51
  14. package/src/blocks/AuthForms/ResetPasswordForm.tsx +53 -45
  15. package/src/blocks/AuthForms/SignInForm.tsx +0 -2
  16. package/src/blocks/AuthForms/SignInPhone.tsx +30 -29
  17. package/src/blocks/AuthForms/SignUpForm.tsx +0 -1
  18. package/src/blocks/Misc/EmptyState.tsx +27 -23
  19. package/src/blocks/Misc/LeadGenerator.tsx +27 -24
  20. package/src/blocks/Misc/NoPermission.tsx +25 -22
  21. package/src/blocks/Misc/NotFound.tsx +15 -15
  22. package/src/blocks/Misc/index.ts +0 -1
  23. package/src/blocks/Payment/ChargeWalletForm.tsx +25 -24
  24. package/src/blocks/Payment/CheckoutForm.tsx +194 -189
  25. package/src/blocks/Payment/Confirmation.tsx +36 -34
  26. package/src/blocks/Payment/CreditCardForm.tsx +71 -73
  27. package/src/blocks/Payment/PayWithWallet.tsx +13 -15
  28. package/src/blocks/Payment/SelectPayment.tsx +58 -54
  29. package/src/blocks/Referral/ReferralAccount.tsx +52 -49
  30. package/src/blocks/Referral/ReferralSettlement.tsx +64 -62
  31. package/src/blocks/Referral/ReferralStats.tsx +53 -51
  32. package/src/elements/HawaRadio.tsx +1 -1
  33. package/src/styles.css +24 -3
  34. package/es/blocks/Misc/Newsletter.d.ts +0 -12
  35. package/lib/blocks/Misc/Newsletter.d.ts +0 -12
  36. package/src/blocks/Misc/Newsletter.tsx +0 -50
@@ -1,7 +1,8 @@
1
1
  import React, { FC } from "react"
2
- import { HawaButton, HawaTextField } from "../../elements"
2
+ import { HawaTextField } from "../../elements"
3
3
  import { Controller, useForm } from "react-hook-form"
4
- import { HawaContainer } from "../../layout"
4
+ import { Card, CardContent, CardFooter } from "../../elements/Card"
5
+ import { Button } from "../../elements/Button"
5
6
 
6
7
  type CreditCardFormTypes = {
7
8
  handle: any
@@ -17,28 +18,10 @@ export const CreditCardForm: FC<CreditCardFormTypes> = (props) => {
17
18
  } = methods
18
19
 
19
20
  return (
20
- <HawaContainer>
21
- {" "}
21
+ <Card>
22
22
  <form onSubmit={handleSubmit(props.handle)}>
23
- <div className="flex flex-row gap-4">
24
- <Controller
25
- control={control}
26
- name="cardName"
27
- render={({ field }) => (
28
- <HawaTextField
29
- width="full"
30
- name="password"
31
- placeholder="Enter password"
32
- type="tel"
33
- label="Card Number"
34
- helpertext={errors.password?.message}
35
- />
36
- )}
37
- rules={{
38
- required: "Password is rquired",
39
- }}
40
- />
41
- <div className="w-1/4">
23
+ <CardContent headless>
24
+ <div className="flex flex-row gap-4">
42
25
  <Controller
43
26
  control={control}
44
27
  name="cardName"
@@ -46,11 +29,9 @@ export const CreditCardForm: FC<CreditCardFormTypes> = (props) => {
46
29
  <HawaTextField
47
30
  width="full"
48
31
  name="password"
49
- maxLength="3"
50
- autoComplete="cc-number"
51
- placeholder=""
52
- type="password"
53
- label="CCV"
32
+ placeholder="Enter password"
33
+ type="tel"
34
+ label="Card Number"
54
35
  helpertext={errors.password?.message}
55
36
  />
56
37
  )}
@@ -58,52 +39,69 @@ export const CreditCardForm: FC<CreditCardFormTypes> = (props) => {
58
39
  required: "Password is rquired",
59
40
  }}
60
41
  />
42
+ <div className="w-1/4">
43
+ <Controller
44
+ control={control}
45
+ name="cardName"
46
+ render={({ field }) => (
47
+ <HawaTextField
48
+ width="full"
49
+ name="password"
50
+ maxLength="3"
51
+ autoComplete="cc-number"
52
+ placeholder=""
53
+ type="password"
54
+ label="CCV"
55
+ helpertext={errors.password?.message}
56
+ />
57
+ )}
58
+ rules={{
59
+ required: "Password is rquired",
60
+ }}
61
+ />
62
+ </div>
61
63
  </div>
62
- </div>
63
- <Controller
64
- control={control}
65
- name="cardName"
66
- render={({ field }) => (
67
- <HawaTextField
68
- width="full"
69
- name="password"
70
- placeholder="Enter password"
71
- type="text"
72
- label="Name On Card"
73
- helpertext={errors.password?.message}
74
- />
75
- )}
76
- rules={{
77
- required: "Password is rquired",
78
- }}
79
- />
80
- <Controller
81
- control={control}
82
- name="cardName"
83
- render={({ field }) => (
84
- <HawaTextField
85
- width="full"
86
- name="password"
87
- placeholder="Enter password"
88
- type="password"
89
- label="Expiry Date"
90
- helpertext={errors.password?.message}
91
- />
92
- )}
93
- rules={{
94
- required: "Password is rquired",
95
- }}
96
- />
97
-
98
- <HawaButton
99
- // type="submit"
100
- width="full"
101
- color="primary"
102
- onClick={props.handlePayWithCreditCard}
103
- >
104
- Pay with Credit Card
105
- </HawaButton>
64
+ <Controller
65
+ control={control}
66
+ name="cardName"
67
+ render={({ field }) => (
68
+ <HawaTextField
69
+ width="full"
70
+ name="password"
71
+ placeholder="Enter password"
72
+ type="text"
73
+ label="Name On Card"
74
+ helpertext={errors.password?.message}
75
+ />
76
+ )}
77
+ rules={{
78
+ required: "Password is rquired",
79
+ }}
80
+ />
81
+ <Controller
82
+ control={control}
83
+ name="cardName"
84
+ render={({ field }) => (
85
+ <HawaTextField
86
+ width="full"
87
+ name="password"
88
+ placeholder="Enter password"
89
+ type="password"
90
+ label="Expiry Date"
91
+ helpertext={errors.password?.message}
92
+ />
93
+ )}
94
+ rules={{
95
+ required: "Password is rquired",
96
+ }}
97
+ />
98
+ </CardContent>
99
+ <CardFooter>
100
+ <Button className="w-full" onClick={props.handlePayWithCreditCard}>
101
+ Pay with Credit Card
102
+ </Button>
103
+ </CardFooter>
106
104
  </form>
107
- </HawaContainer>
105
+ </Card>
108
106
  )
109
107
  }
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from "react"
2
- import { HawaButton } from "../../elements"
3
- import { HawaContainer } from "../../layout"
2
+ import { Card, CardContent } from "../../elements/Card"
3
+ import { Button } from "../../elements/Button"
4
4
 
5
5
  type PayWithWalletTypes = {
6
6
  walletBalance: any
@@ -9,18 +9,16 @@ type PayWithWalletTypes = {
9
9
  }
10
10
  export const PayWithWallet: FC<PayWithWalletTypes> = (props) => {
11
11
  return (
12
- <HawaContainer>
13
- <div className="text-center text-5xl font-extrabold">
14
- {props.walletBalance || "0"}
15
- <div className="text-sm font-normal">{props.currency || "SAR"}</div>
16
- </div>
17
- <HawaButton
18
- width="full"
19
- color="primary"
20
- onClick={props.handlePayWithWallet}
21
- >
22
- Pay Now
23
- </HawaButton>
24
- </HawaContainer>
12
+ <Card>
13
+ <CardContent headless>
14
+ <div className="text-center text-5xl font-extrabold">
15
+ {props.walletBalance || "0"}
16
+ <div className="text-sm font-normal">{props.currency || "SAR"}</div>
17
+ </div>
18
+ <Button className="mt-6 w-full" onClick={props.handlePayWithWallet}>
19
+ Pay Now
20
+ </Button>
21
+ </CardContent>
22
+ </Card>
25
23
  )
26
24
  }
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from "react"
2
- import { HawaTypography, HawaLogoButton } from "../../elements"
3
- import { HawaContainer } from "../../layout"
2
+ import { HawaLogoButton } from "../../elements"
3
+ import { Card, CardContent, CardHeader, CardTitle } from "../../elements/Card"
4
4
 
5
5
  type SelectPaymentTypes = {
6
6
  viaMada: boolean
@@ -28,57 +28,61 @@ type SelectPaymentTypes = {
28
28
 
29
29
  export const SelectPayment: FC<SelectPaymentTypes> = (props) => {
30
30
  return (
31
- <HawaContainer>
32
- <HawaTypography>Choose Payment Method</HawaTypography>
33
- {props.viaWallet && (
34
- <HawaLogoButton
35
- logo="wallet"
36
- buttonText={props.walletLabel}
37
- onClick={props.handleWallet}
38
- />
39
- )}
40
- {props.viaCreditCard && (
41
- <HawaLogoButton
42
- logo="visa/master"
43
- buttonText={props.visaMasterLabel}
44
- onClick={props.handleCreditCard}
45
- />
46
- )}
47
- {props.viaMada && (
48
- <HawaLogoButton
49
- logo="mada"
50
- buttonText={props.madaLabel}
51
- onClick={props.handleMada}
52
- />
53
- )}
54
- {props.viaSTCPay && (
55
- <HawaLogoButton
56
- logo="stcpay"
57
- buttonText={props.stcPayLabel}
58
- onClick={props.handleSTCPay}
59
- />
60
- )}
61
- {props.viaPayPal && (
62
- <HawaLogoButton
63
- logo="paypal"
64
- buttonText={props.paypalLabel}
65
- onClick={props.handlePayPal}
66
- />
67
- )}
68
- {props.viaGooglePay && (
69
- <HawaLogoButton
70
- logo="googlepay"
71
- buttonText={props.googlePayLabel}
72
- onClick={props.handleGooglePay}
73
- />
74
- )}
75
- {props.viaApplePay && (
76
- <HawaLogoButton
77
- logo="applepay"
78
- buttonText={props.applePayLabel}
79
- onClick={props.handleApplePay}
80
- />
81
- )}
82
- </HawaContainer>
31
+ <Card>
32
+ <CardHeader>
33
+ <CardTitle>Choose Payment Method</CardTitle>
34
+ </CardHeader>
35
+ <CardContent>
36
+ {props.viaWallet && (
37
+ <HawaLogoButton
38
+ logo="wallet"
39
+ buttonText={props.walletLabel}
40
+ onClick={props.handleWallet}
41
+ />
42
+ )}
43
+ {props.viaCreditCard && (
44
+ <HawaLogoButton
45
+ logo="visa/master"
46
+ buttonText={props.visaMasterLabel}
47
+ onClick={props.handleCreditCard}
48
+ />
49
+ )}
50
+ {props.viaMada && (
51
+ <HawaLogoButton
52
+ logo="mada"
53
+ buttonText={props.madaLabel}
54
+ onClick={props.handleMada}
55
+ />
56
+ )}
57
+ {props.viaSTCPay && (
58
+ <HawaLogoButton
59
+ logo="stcpay"
60
+ buttonText={props.stcPayLabel}
61
+ onClick={props.handleSTCPay}
62
+ />
63
+ )}
64
+ {props.viaPayPal && (
65
+ <HawaLogoButton
66
+ logo="paypal"
67
+ buttonText={props.paypalLabel}
68
+ onClick={props.handlePayPal}
69
+ />
70
+ )}
71
+ {props.viaGooglePay && (
72
+ <HawaLogoButton
73
+ logo="googlepay"
74
+ buttonText={props.googlePayLabel}
75
+ onClick={props.handleGooglePay}
76
+ />
77
+ )}
78
+ {props.viaApplePay && (
79
+ <HawaLogoButton
80
+ logo="applepay"
81
+ buttonText={props.applePayLabel}
82
+ onClick={props.handleApplePay}
83
+ />
84
+ )}
85
+ </CardContent>
86
+ </Card>
83
87
  )
84
88
  }
@@ -1,6 +1,7 @@
1
1
  import React, { FC } from "react"
2
- import { HawaButton } from "../../elements"
3
- import { HawaContainer } from "../../layout"
2
+
3
+ import { Card, CardContent } from "../../elements/Card"
4
+ import { Button } from "../../elements/Button"
4
5
 
5
6
  type ReferralAccount = {
6
7
  referralLink: string
@@ -12,54 +13,56 @@ export const ReferralAccount: FC<ReferralAccount> = ({
12
13
  referralCode,
13
14
  }) => {
14
15
  return (
15
- <HawaContainer>
16
- <div className="my-2 mt-0">
17
- <div className="mb-1">Referral Code</div>
18
- <div className="flex flex-row items-center justify-between rounded border bg-background">
19
- <span className="ml-3 font-bold">{referralCode}</span>
20
- <HawaButton
21
- tooltip="Copy"
22
- className="mr-1.5"
23
- onClick={() => navigator.clipboard.writeText(referralCode)}
24
- >
25
- <span className="bg-red flex items-center justify-center">
26
- <svg
27
- stroke="currentColor"
28
- fill="currentColor"
29
- stroke-width="0"
30
- viewBox="0 0 512 512"
31
- height="1em"
32
- width="1em"
33
- >
34
- <path d="M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z"></path>
35
- </svg>{" "}
36
- </span>
37
- </HawaButton>
16
+ <Card>
17
+ <CardContent headless>
18
+ <div className="my-2 mt-0">
19
+ <div className="mb-1">Referral Code</div>
20
+ <div className="flex flex-row items-center justify-between rounded border bg-background">
21
+ <span className="ml-3 font-bold">{referralCode}</span>
22
+ <Button
23
+ // tooltip="Copy"
24
+ // className="mr-1.5"
25
+ onClick={() => navigator.clipboard.writeText(referralCode)}
26
+ >
27
+ <span className="bg-red flex items-center justify-center">
28
+ <svg
29
+ stroke="currentColor"
30
+ fill="currentColor"
31
+ stroke-width="0"
32
+ viewBox="0 0 512 512"
33
+ height="1em"
34
+ width="1em"
35
+ >
36
+ <path d="M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z"></path>
37
+ </svg>{" "}
38
+ </span>
39
+ </Button>
40
+ </div>
38
41
  </div>
39
- </div>
40
- <div className="my-2 mt-0">
41
- <div className="mb-1">Referral Link</div>
42
- <div className="flex flex-row items-center justify-between rounded border bg-background">
43
- <span className="ml-3 font-bold">{referralLink}</span>
44
- <HawaButton
45
- className="mr-1.5"
46
- onClick={() => navigator.clipboard.writeText(referralLink)}
47
- >
48
- <span className="bg-red flex items-center justify-center">
49
- <svg
50
- stroke="currentColor"
51
- fill="currentColor"
52
- stroke-width="0"
53
- viewBox="0 0 512 512"
54
- height="1em"
55
- width="1em"
56
- >
57
- <path d="M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z"></path>
58
- </svg>{" "}
59
- </span>
60
- </HawaButton>
42
+ <div className="my-2 mt-0">
43
+ <div className="mb-1">Referral Link</div>
44
+ <div className="flex flex-row items-center justify-between rounded border bg-background">
45
+ <span className="ml-3 font-bold">{referralLink}</span>
46
+ <Button
47
+ // className="mr-1.5"
48
+ onClick={() => navigator.clipboard.writeText(referralLink)}
49
+ >
50
+ <span className="bg-red flex items-center justify-center">
51
+ <svg
52
+ stroke="currentColor"
53
+ fill="currentColor"
54
+ stroke-width="0"
55
+ viewBox="0 0 512 512"
56
+ height="1em"
57
+ width="1em"
58
+ >
59
+ <path d="M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z"></path>
60
+ </svg>{" "}
61
+ </span>
62
+ </Button>
63
+ </div>
61
64
  </div>
62
- </div>
63
- </HawaContainer>
65
+ </CardContent>
66
+ </Card>
64
67
  )
65
68
  }
@@ -7,8 +7,8 @@ import {
7
7
  HawaSelect,
8
8
  HawaTextField,
9
9
  } from "../../elements"
10
- import { HawaContainer } from "../../layout"
11
10
  import { Controller, FormProvider, useForm } from "react-hook-form"
11
+ import { Card, CardContent } from "../../elements/Card"
12
12
 
13
13
  type TReferralSettlement = {
14
14
  referralLink: string
@@ -28,69 +28,71 @@ export const ReferralSettlement: FC<TReferralSettlement> = ({
28
28
  control,
29
29
  } = methods
30
30
  return (
31
- <HawaContainer>
32
- <div>
33
- <FormProvider {...methods}>
34
- <HawaTextField label={"IBAN"} />
35
- <HawaTextField label={"Holder Name"} />
36
- <Controller
37
- control={control}
38
- name="bank"
39
- render={({ field }) => (
40
- <HawaSelect
41
- label="Bank"
42
- isCreatable={false}
43
- isMulti={false ?? false}
44
- isSearchable={false}
45
- isClearable={false ?? false}
46
- options={[
47
- { value: "snb", label: "Saudi National Bank" },
48
- { value: "bilad", label: "Al Bilad Bank" },
49
- { value: "rajihi", label: "Al Rajihi Bank" },
50
- ]}
51
- onInputChange={(e: any, o: any) => console.log("changing", e)}
52
- {...field}
53
- onChange={(e: any, o: any) => console.log("chooo", e)}
54
- />
55
- )}
56
- />
57
- </FormProvider>
58
- </div>
59
- <div>
60
- <HawaButton width="full">Add Bank Account</HawaButton>
61
- </div>
62
- {withdrawError && (
31
+ <Card>
32
+ <CardContent headless>
33
+ <div>
34
+ <FormProvider {...methods}>
35
+ <HawaTextField label={"IBAN"} />
36
+ <HawaTextField label={"Holder Name"} />
37
+ <Controller
38
+ control={control}
39
+ name="bank"
40
+ render={({ field }) => (
41
+ <HawaSelect
42
+ label="Bank"
43
+ isCreatable={false}
44
+ isMulti={false ?? false}
45
+ isSearchable={false}
46
+ isClearable={false ?? false}
47
+ options={[
48
+ { value: "snb", label: "Saudi National Bank" },
49
+ { value: "bilad", label: "Al Bilad Bank" },
50
+ { value: "rajihi", label: "Al Rajihi Bank" },
51
+ ]}
52
+ onInputChange={(e: any, o: any) => console.log("changing", e)}
53
+ {...field}
54
+ onChange={(e: any, o: any) => console.log("chooo", e)}
55
+ />
56
+ )}
57
+ />
58
+ </FormProvider>
59
+ </div>
63
60
  <div>
64
- <HawaAlert
65
- text={
66
- "Sorry can't withdraw the money at the moment. Please try again in 2022/11/20"
67
- }
68
- severity="warning"
69
- />
61
+ <HawaButton width="full">Add Bank Account</HawaButton>
70
62
  </div>
71
- )}
72
- <div className="mt-3">
73
- <div className="mb-1">Settlement Accounts</div>
74
- <div className="rounded">
75
- <SettlementAccountCard
76
- bank="Al Inma Bank"
77
- iban="SA10228094028098329119"
78
- accountHolder="Zakher Masri"
79
- default
80
- />
81
- <SettlementAccountCard
82
- bank="Al Rajihi Bank"
83
- iban="SA10228094028098329119"
84
- accountHolder="Zakher Masri"
85
- />
86
- <SettlementAccountCard
87
- bank="Al Inma Bank"
88
- iban="SA10228094028098329119"
89
- accountHolder="Zakher Masri"
90
- />
63
+ {withdrawError && (
64
+ <div>
65
+ <HawaAlert
66
+ text={
67
+ "Sorry can't withdraw the money at the moment. Please try again in 2022/11/20"
68
+ }
69
+ severity="warning"
70
+ />
71
+ </div>
72
+ )}
73
+ <div className="mt-3">
74
+ <div className="mb-1">Settlement Accounts</div>
75
+ <div className="rounded">
76
+ <SettlementAccountCard
77
+ bank="Al Inma Bank"
78
+ iban="SA10228094028098329119"
79
+ accountHolder="Zakher Masri"
80
+ default
81
+ />
82
+ <SettlementAccountCard
83
+ bank="Al Rajihi Bank"
84
+ iban="SA10228094028098329119"
85
+ accountHolder="Zakher Masri"
86
+ />
87
+ <SettlementAccountCard
88
+ bank="Al Inma Bank"
89
+ iban="SA10228094028098329119"
90
+ accountHolder="Zakher Masri"
91
+ />
92
+ </div>
91
93
  </div>
92
- </div>
93
- </HawaContainer>
94
+ </CardContent>
95
+ </Card>
94
96
  )
95
97
  }
96
98
 
@@ -121,7 +123,7 @@ const SettlementAccountCard = (props) => {
121
123
  // position={direction === "rtl" ? "right-bottom" : "left-bottom"}
122
124
  // direction={direction}
123
125
  >
124
- <HawaButton variant="outlined" >
126
+ <HawaButton variant="outlined">
125
127
  <svg
126
128
  aria-label="Vertical Three Dots Menu Icon"
127
129
  className="rotate-90"