@sikka/hawa 0.0.18 → 0.0.21

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 (52) hide show
  1. package/.github/workflows/hawa-publish-push.yml +0 -1
  2. package/README.md +0 -8
  3. package/es/index.es.js +1 -1
  4. package/lib/index.js +1 -1
  5. package/package.json +1 -1
  6. package/src/blocks/Account/UserProfileForm.js +1 -1
  7. package/src/blocks/Account/UserSettingsForm.js +2 -2
  8. package/src/blocks/AuthForms/SignInForm.js +2 -0
  9. package/src/blocks/AuthForms/SignUpForm.js +2 -0
  10. package/src/blocks/Payment/ChargeWalletForm.js +6 -1
  11. package/src/blocks/Payment/CheckoutForm.js +245 -0
  12. package/src/blocks/Payment/Confirmation.js +117 -0
  13. package/src/blocks/Payment/CreditCardForm.js +5 -4
  14. package/src/blocks/Payment/PayWithWallet.js +3 -3
  15. package/src/blocks/Payment/SelectPayment.js +1 -1
  16. package/src/blocks/Payment/index.js +2 -0
  17. package/src/elements/AdaptiveButton.js +0 -2
  18. package/src/elements/HawaListItem.js +2 -1
  19. package/src/elements/HawaLogoButton.js +1 -2
  20. package/src/elements/HawaPricingCard.js +2 -1
  21. package/src/elements/HawaSelect.js +26 -0
  22. package/src/elements/HawaSwitch.js +1 -1
  23. package/src/elements/HawaTable.js +39 -3
  24. package/src/elements/HawaTextField.js +10 -4
  25. package/src/elements/HawaTypography.js +0 -1
  26. package/src/elements/index.js +1 -0
  27. package/src/layout/HawaDialog.js +5 -7
  28. package/storybook-static/{0.42b12e88e2d7c13fc83c.manager.bundle.js → 0.f47eb24a4893a96ec307.manager.bundle.js} +1 -1
  29. package/storybook-static/{4.6efb4495a449edfbd0b0.manager.bundle.js → 4.0fcda1281dc1961dbe94.manager.bundle.js} +2 -2
  30. package/storybook-static/{4.6efb4495a449edfbd0b0.manager.bundle.js.LICENSE.txt → 4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt} +0 -0
  31. package/storybook-static/{5.fdf5c7287259585b43a3.manager.bundle.js → 5.63ab4f94d50a3acf080d.manager.bundle.js} +1 -1
  32. package/storybook-static/{6.19c48a8c.iframe.bundle.js → 6.13a534cb.iframe.bundle.js} +0 -0
  33. package/storybook-static/{6.8f7b9049856bdace5643.manager.bundle.js → 6.a6d45262f7e98f3f18d3.manager.bundle.js} +2 -2
  34. package/storybook-static/{6.8f7b9049856bdace5643.manager.bundle.js.LICENSE.txt → 6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt} +0 -0
  35. package/storybook-static/{7.dfc01154563c92ef9ccf.manager.bundle.js → 7.097710753af9a1c41b80.manager.bundle.js} +1 -1
  36. package/storybook-static/{8.c1928a9f13347c159613.manager.bundle.js → 8.76c3cbf398692028e834.manager.bundle.js} +1 -1
  37. package/storybook-static/iframe.html +1 -1
  38. package/storybook-static/index.html +1 -1
  39. package/storybook-static/main.ac6e4b72b033097dad76.manager.bundle.js +1 -0
  40. package/storybook-static/main.e1b79522.iframe.bundle.js +1 -0
  41. package/storybook-static/{runtime~main.2c77505f.iframe.bundle.js → runtime~main.708d7ac1.iframe.bundle.js} +1 -1
  42. package/storybook-static/{runtime~main.1373976137528887a7ad.manager.bundle.js → runtime~main.c8dac23bc753439736f0.manager.bundle.js} +1 -1
  43. package/storybook-static/vendors~main.4ff76500.iframe.bundle.js +76 -0
  44. package/storybook-static/{vendors~main.78f2cf4f.iframe.bundle.js.LICENSE.txt → vendors~main.4ff76500.iframe.bundle.js.LICENSE.txt} +0 -0
  45. package/storybook-static/vendors~main.4ff76500.iframe.bundle.js.map +1 -0
  46. package/storybook-static/vendors~main.a697e07137d366f95f76.manager.bundle.js +2 -0
  47. package/storybook-static/{vendors~main.41b22d5a0c6132a028f1.manager.bundle.js.LICENSE.txt → vendors~main.a697e07137d366f95f76.manager.bundle.js.LICENSE.txt} +0 -0
  48. package/storybook-static/main.c1b22dad.iframe.bundle.js +0 -1
  49. package/storybook-static/main.d9e1c87c8c22202eed3c.manager.bundle.js +0 -1
  50. package/storybook-static/vendors~main.41b22d5a0c6132a028f1.manager.bundle.js +0 -2
  51. package/storybook-static/vendors~main.78f2cf4f.iframe.bundle.js +0 -76
  52. package/storybook-static/vendors~main.78f2cf4f.iframe.bundle.js.map +0 -1
@@ -38,7 +38,6 @@ jobs:
38
38
  else
39
39
  npm install
40
40
  fi
41
- - run: npm run build-storybook
42
41
  - run: npm run build-lib
43
42
  - run: npm run build:styles
44
43
  - run: npm publish
package/README.md CHANGED
@@ -71,14 +71,8 @@ lighten a given `color` by a given `percent`
71
71
  ## Components
72
72
 
73
73
  - [ ] Layout
74
- - [ ] Box
75
- - [ ] TextField
76
74
  - [ ] TextArea
77
- - [ ] Radio Selector
78
- - [ ] PasswordField
79
75
  - [ ] Autocomplete
80
- - [ ] Tabs
81
- - [ ] Alerts
82
76
  - [ ] Badges
83
77
 
84
78
  ## Install
@@ -144,6 +138,4 @@ npm publish --access public
144
138
 
145
139
  ## License
146
140
 
147
- <!-- https://github.com/react-component/drawer -->
148
-
149
141
  MIT © [SIKKA SOFTWARE](https://sikka.sa)
package/es/index.es.js CHANGED
@@ -1 +1 @@
1
- import{useState as e}from"react";import t from"@mui/material/Button";import"@mui/material/Tooltip";import r from"prop-types";import{jsx as a,jsxs as i,Fragment as l}from"react/jsx-runtime";import{Typography as n,Container as o,Button as s}from"@mui/material";import"@mui/icons-material/MoveToInbox";import d from"@mui/material/AppBar";import"@mui/material/Box";import"@mui/material/Toolbar";import"@mui/material/IconButton";import u from"@mui/material/Typography";import"@mui/material/Menu";import"@mui/icons-material/Menu";import m from"@mui/material/Container";import"@mui/material/Avatar";import"@mui/material/MenuItem";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import"@mui/icons-material/CheckCircleOutlined";import c from"@mui/material/Input";import p from"@mui/material/InputLabel";import h from"@mui/icons-material/GitHub";import f from"@mui/icons-material/Twitter";import v from"@mui/icons-material/AccountBalanceWallet";import g from"@mui/material/Alert";import x from"@mui/material/AlertTitle";import"@mui/material/Table";import"@mui/material/TableBody";import"@mui/material/TableCell";import"@mui/material/TableContainer";import"@mui/material/TableHead";import"@mui/material/TableRow";import"@mui/material/Snackbar";import{useForm as b,FormProvider as y,Controller as w}from"react-hook-form";import T from"@mui/material/InputAdornment";import P from"@mui/icons-material/HttpsOutlined";import S from"@mui/icons-material/MailOutline";import C from"@mui/icons-material/PermIdentityOutlined";import{styled as k}from"@mui/material/styles";import W from"@mui/material/Drawer";import"@mui/material/List";import"@mui/material/Divider";import"@mui/icons-material/ChevronLeft";import"@mui/icons-material/ChevronRight";import"@mui/material/ListItemButton";import"@mui/material/ListItemIcon";import"@mui/material/ListItemText";import"@mui/icons-material/Mail";import"@mui/icons-material/Close";function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){I(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,i,l=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(l.push(a.value),!t||l.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw i}}return l}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}r.string,r.bool;var z=function(e){return a(u,L(L({},e),{},{children:e.children}))},R=function(e){return i(l,{children:[i("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[a(p,{children:e.label}),e.helperText&&a(n,{variant:"validation",children:e.helperText})]}),a(c,L({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var j=function(e){var r,l="";switch(null===(r=e.logo)||void 0===r?void 0:r.toLowerCase()){case"google":l=a("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":l=a(h,{});break;case"twitter":l=a(f,{});break;case"mada":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":l=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":l=a(v,{})}return i(t,L(L({},e),{},{variant:"withLogo",children:[l,a("div",{style:{width:10}}),a(n,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},B=function(e){return i(g,{severity:e.severity,children:[e.title&&a(x,{children:e.title}),e.text]})},N=function(e){var r=b(),l=r.formState.errors,n=r.handleSubmit,o=r.control;return a(m,{maxWidth:"sm",children:a(y,L(L({},r),{},{children:i("form",{onSubmit:n(e.handleUpdateProfile),children:[a(w,{control:o,name:"fullName",render:function(t){var r,i,n=t.field;return a(R,L({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=l.fullName)||void 0===i?void 0:i.message},n))}}),a(w,{control:o,name:"phoneNumber",render:function(e){var t=e.field;return a(R,L({fullWidth:!0,type:"number",label:"Phone Number",placeholder:"+966"},t))}}),a(w,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(R,L({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=l.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a(w,{control:o,name:"password",render:function(t){var r,i,n=t.field;return a(R,L({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=l.password)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.passwordRequiredText}}),a(w,{control:o,name:"confirmPassword",render:function(t){var r,i,n=t.field;return a(R,L({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(i=l.confirmPassword)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.confirmPasswordRequiredText}}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},M=function(e){return i(o,{maxWidth:"sm",children:[e.children,a(s,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})},G=function(r){var l=O(e(""),2);l[0],l[1];var n=O(e(""),2);n[0],n[1];var o=O(e(!1),2),s=o[0],d=o[1],u=b(),c=u.formState.errors,p=u.handleSubmit,h=u.control;return i(m,{maxWidth:"xs",variant:"auth",children:[s&&a(B,{text:r.texts.passwordMatchError,severity:"error"}),r.passwordChanged?a(z,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a(y,L(L({},u),{},{children:i("form",{onSubmit:p((function(e){console.log("handling subb",e),e.password===e.confirmPassword?r.handleNewPassword():d(!0)})),children:[a(w,{control:h,name:"password",render:function(e){var t,i,l=e.field;return a(R,L({fullWidth:!0,type:"password",value:null!==(t=l.value)&&void 0!==t?t:"",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,helperText:null===(i=c.password)||void 0===i?void 0:i.message,startAdornment:a(T,{position:"start",children:a(P,{})})},l))},rules:{required:r.texts.passwordRequiredText}}),a(w,{control:h,name:"confirmPassword",render:function(e){var t,i,l=e.field;return a(R,L({fullWidth:!0,type:"password",value:null!==(t=l.value)&&void 0!==t?t:"",label:r.texts.confirmPasswordLabel,placeholder:r.texts.confirmPasswordPlaceholder,helperText:null===(i=c.confirmPassword)||void 0===i?void 0:i.message,startAdornment:a(T,{position:"start",children:a(P,{})})},l))},rules:{required:r.texts.confirmPasswordRequiredText}}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},U=function(e){var r,l=b(),n=l.formState.errors,o=l.handleSubmit;l.register;var s=l.control;return i(m,{maxWidth:"xs",variant:"auth",children:[e.error&&i(Alert,{severity:"error",children:[e.errorTitle&&a(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a(z,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):i("form",{onSubmit:o(e.handleResetPassword),children:[console.log("eror ",null===(r=n.email)||void 0===r?void 0:r.message),a(w,{control:s,name:"email",render:function(t){var r,i,l=t.field;return a(R,L({fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=n.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(T,{position:"start",children:a(S,{})})},l))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},D=function(e){var r=b(),l=r.formState.errors,n=r.handleSubmit,o=r.control;return i(m,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&i(g,{severity:"error",children:[e.errorTitle&&a(x,{children:e.errorTitle}),e.errorText]}),a(y,L(L({},r),{},{children:i("form",{onSubmit:n(e.handleSignUp),children:[a(w,{control:o,name:"fullName",render:function(t){var r,i,n=t.field;return a(R,{fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=l.fullName)||void 0===i?void 0:i.message,startAdornment:a(T,{position:"start",children:a(C,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a(w,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(R,{fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=l.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(T,{position:"start",children:a(S,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a(w,{control:o,name:"password",render:function(t){var r,i,n,o=t.field;return a(R,L({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=l.password)||void 0===n?void 0:n.message,startAdornment:a(T,{position:"start",children:a(P,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),i(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",a("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(j,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a(j,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a(j,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};D.propTypes={theme:r.oneOf(["secondary","primary"])};var Z=function(e){var r=b(),l=r.formState.errors,n=r.handleSubmit;r.register;var o=r.control;return i(m,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&i(g,{severity:"error",children:[e.errorTitle&&a(x,{children:e.errorTitle}),e.errorText]}),i("form",{onSubmit:n(e.handleSignIn),children:[a(w,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(R,L({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=l.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(T,{position:"start",children:a(S,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a(w,{control:o,name:"password",render:function(t){var r,i,n,o=t.field;return a(R,L({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=l.password)||void 0===n?void 0:n.message,startAdornment:a(T,{position:"start",children:a(P,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a(u,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),i(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(j,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a(j,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a(j,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},E=function(e){return i(o,{maxWidth:"xs",children:[a(z,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a(j,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a(j,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a(j,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a(j,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a(j,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a(j,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a(j,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};R.propTypes={theme:r.oneOf(["secondary","primary"]),viaApplePay:r.bool,viaGooglePay:r.bool,viaSTCPay:r.bool,viaCreditCard:r.bool,viaPayPal:r.bool,handleApplePay:r.func};var F=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},$=function(e){return I({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"calc(".concat(e.spacing(7)," + 1px)")},e.breakpoints.up("sm"),{width:"calc(".concat(e.spacing(8)," + 1px)")})};k("div")((function(e){var t=e.theme;return L({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),k(d,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return L({zIndex:t.zIndex.drawer+1,transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen})},r&&{marginLeft:240,width:"calc(100% - ".concat(240,"px)"),transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.enteringScreen})})})),k(W,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return L(L({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&L(L({},F(t)),{},{"& .MuiDrawer-paper":F(t)})),!r&&L(L({},$(t)),{},{"& .MuiDrawer-paper":$(t)}))}));var H=function(e){var t,r,l=b(),n=l.formState.errors,d=l.handleSubmit;return a(o,{maxWidth:"xs",children:a(y,L(L({},l),{},{children:i("form",{onSubmit:d(e.handle),children:[a(R,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a(R,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a(s,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},V=function(r){var l=O(e(0),2),n=l[0],o=l[1],s=b();s.formState.errors;var d=s.handleSubmit,c=s.control;return i(m,{maxWidth:"xs",children:[i(u,{align:"center",variant:"h2",fontWeight:500,children:[Number(n).toLocaleString("en")||"0",a(u,{children:r.currency||"SAR"})]}),a(y,L(L({},s),{},{children:i("form",{onSubmit:d(r.handleChargeWallet),children:[a(w,{control:c,name:"amount",render:function(e){var t,r=e.field;return a(R,L(L({fullWidth:!0,placeholder:"Enter amount",type:"number",value:null!==(t=r.value)&&void 0!==t?t:""},r),{},{inputProps:{inputMode:"numeric",min:"0",max:"9999999",step:"0.01"},onChange:function(e){r.onChange(parseFloat(e.target.value)),console.log("e",e.target.value),o(e.target.value)}}))}}),a(t,{type:"submit",fullWidth:!0,variant:"last",onClick:r.handleSignIn,children:"Charge Wallet"})]})}))]})},X=function(e){return i(o,{maxWidth:"xs",children:[a(n,{align:"center",children:"Wallet Balance"}),i(n,{align:"center",variant:"h1",children:[e.walletBalance||"0",a(n,{children:e.currency||"SAR"})]}),a(s,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})};export{V as ChargeWalletForm,H as CreditCardForm,G as NewPasswordForm,X as PayWithWallet,U as ResetPasswordForm,E as SelectPayment,Z as SignInForm,D as SignUpForm,N as UserProfileForm,M as UserSettingsForm};
1
+ import{useState as e}from"react";import t from"@mui/material/Button";import"@mui/material/Tooltip";import r from"prop-types";import{jsx as l,jsxs as i}from"react/jsx-runtime";import"@mui/material/ListItemButton";import"@mui/material/ListItemText";import"@mui/icons-material/MoveToInbox";import"@mui/material/AppBar";import"@mui/material/Box";import"@mui/material/Toolbar";import"@mui/material/IconButton";import a from"@mui/material/Typography";import"@mui/material/Menu";import"@mui/icons-material/Menu";import n from"@mui/material/Container";import"@mui/material/Avatar";import"@mui/material/MenuItem";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import"@mui/icons-material/CheckCircleOutlined";import o from"@mui/material/Input";import d from"@mui/material/InputLabel";import"@mui/material/Switch";import s from"@mui/icons-material/GitHub";import u from"@mui/icons-material/Twitter";import m from"@mui/icons-material/AccountBalanceWallet";import c from"@mui/material/Select";import h from"@mui/material/Alert";import p from"@mui/material/AlertTitle";import v from"@mui/material/Table";import f from"@mui/material/TableBody";import g from"@mui/material/TableCell";import x from"@mui/material/TableContainer";import b from"@mui/material/TableHead";import y from"@mui/material/TableRow";import"@mui/material/Snackbar";import{useForm as w,FormProvider as T,Controller as P}from"react-hook-form";import W from"@mui/material/InputAdornment";import C from"@mui/icons-material/HttpsOutlined";import S from"@mui/icons-material/MailOutline";import k from"@mui/icons-material/PermIdentityOutlined";import A from"@mui/material/Divider";function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,l)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var l,i,a=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(l=r.next()).done)&&(a.push(l.value),!t||a.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw i}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,l=new Array(t);r<t;r++)l[r]=e[r];return l}r.string,r.bool;var R=function(e){return l(a,q(q({},e),{},{children:e.children}))},B=function(e){return i("div",{style:e.inForm&&{width:"100%"},children:[i("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.label&&l(d,{children:e.label}),e.helperText&&l(a,{variant:"validation",children:e.helperText})]}),l(o,q({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var z=function(e){var r,n="";switch(null===(r=e.logo)||void 0===r?void 0:r.toLowerCase()){case"google":n=l("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":n=l(s,{});break;case"twitter":n=l(u,{});break;case"mada":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":n=l(m,{})}return i(t,q(q({},e),{},{variant:"withLogo",children:[n,l("div",{style:{width:10}}),l(a,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},j=function(e){return i("div",{style:{width:"100%"},children:[i("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[l(d,{children:e.label}),e.helperText&&l(a,{variant:"validation",children:e.helperText})]}),l(c,q(q({},e),{},{children:e.children}))]})},G=function(e){return i(h,{severity:e.severity,children:[e.title&&l(p,{children:e.title}),e.text]})},D=function(e){var t="ar"===e.lang;return l(x,{style:{direction:t?"rtl":"ltr"},children:i(v,{"aria-label":"a dense table",children:[l(b,{children:l(y,{children:e.columns.map((function(e,r){return l(g,{align:t?"right":"left",style:{fontWeight:700},variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})}),l(f,{children:e.rows.map((function(e,r){return l(y,{children:e.map((function(e,r){return l(g,{align:t?"right":"left",component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))},r)}))}),e.end&&l(y,{children:e.end.map((function(e,r){return l(g,{align:t?"right":"left",style:{fontWeight:700},component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})]})})},F=function(e){var r=w(),a=r.formState.errors,o=r.handleSubmit,d=r.control;return l(n,{maxWidth:"sm",children:l(T,q(q({},r),{},{children:i("form",{onSubmit:o(e.handleUpdateProfile),children:[l(P,{control:d,name:"fullName",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=a.fullName)||void 0===i?void 0:i.message},n))}}),l(P,{control:d,name:"phoneNumber",render:function(e){var t=e.field;return l(B,q({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),l(P,{control:d,name:"email",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=a.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l(P,{control:d,name:"password",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=a.password)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.passwordRequiredText}}),l(P,{control:d,name:"confirmPassword",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(i=a.confirmPassword)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.confirmPasswordRequiredText}}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},M=function(e){return i(n,{maxWidth:"sm",children:[e.children,l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})},U=function(r){var a=O(e(""),2);a[0],a[1];var o=O(e(""),2);o[0],o[1];var d=O(e(!1),2),s=d[0],u=d[1],m=w(),c=m.formState.errors,h=m.handleSubmit,p=m.control;return i(n,{maxWidth:"xs",variant:"auth",children:[s&&l(G,{text:r.texts.passwordMatchError,severity:"error"}),r.passwordChanged?l(R,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):l(T,q(q({},m),{},{children:i("form",{onSubmit:h((function(e){console.log("handling subb",e),e.password===e.confirmPassword?r.handleNewPassword():u(!0)})),children:[l(P,{control:p,name:"password",render:function(e){var t,i,a=e.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(t=a.value)&&void 0!==t?t:"",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,helperText:null===(i=c.password)||void 0===i?void 0:i.message,startAdornment:l(W,{position:"start",children:l(C,{})})},a))},rules:{required:r.texts.passwordRequiredText}}),l(P,{control:p,name:"confirmPassword",render:function(e){var t,i,a=e.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(t=a.value)&&void 0!==t?t:"",label:r.texts.confirmPasswordLabel,placeholder:r.texts.confirmPasswordPlaceholder,helperText:null===(i=c.confirmPassword)||void 0===i?void 0:i.message,startAdornment:l(W,{position:"start",children:l(C,{})})},a))},rules:{required:r.texts.confirmPasswordRequiredText}}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},Z=function(e){var r,a=w(),o=a.formState.errors,d=a.handleSubmit;a.register;var s=a.control;return i(n,{maxWidth:"xs",variant:"auth",children:[e.error&&i(Alert,{severity:"error",children:[e.errorTitle&&l(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?l(R,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):i("form",{onSubmit:d(e.handleResetPassword),children:[console.log("eror ",null===(r=o.email)||void 0===r?void 0:r.message),l(P,{control:s,name:"email",render:function(t){var r,i,a=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=o.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l(W,{position:"start",children:l(S,{})})},a))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},E=function(e){var r=w(),o=r.formState.errors,d=r.handleSubmit,s=r.control;return i(n,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&i(h,{severity:"error",children:[e.errorTitle&&l(p,{children:e.errorTitle}),e.errorText]}),l(T,q(q({},r),{},{children:i("form",{onSubmit:d(e.handleSignUp),children:[l(P,{control:s,name:"fullName",render:function(t){var r,i,a=t.field;return l(B,{fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=o.fullName)||void 0===i?void 0:i.message,startAdornment:l(W,{position:"start",children:l(k,{})})})},rules:{required:e.texts.fullNameRequiredText}}),l(P,{control:s,name:"email",render:function(t){var r,i,a=t.field;return l(B,{fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=o.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l(W,{position:"start",children:l(S,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l(P,{control:s,name:"password",render:function(t){var r,i,a,n=t.field;return l(B,q({fullWidth:!0,type:"password",defaultValue:null!==(r=n.value)&&void 0!==r?r:"",value:null!==(i=n.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(a=o.password)||void 0===a?void 0:a.message,startAdornment:l(W,{position:"start",children:l(C,{})})},n))},rules:{required:e.texts.passwordRequiredText}}),l(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),i(a,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",l("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),l(A,{}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l(z,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&l(z,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&l(z,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};E.propTypes={theme:r.oneOf(["secondary","primary"])};var $=function(e){var r=w(),o=r.formState.errors,d=r.handleSubmit;r.register;var s=r.control;return i(n,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&i(h,{severity:"error",children:[e.errorTitle&&l(p,{children:e.errorTitle}),e.errorText]}),i("form",{onSubmit:d(e.handleSignIn),children:[l(P,{control:s,name:"email",render:function(t){var r,i,a=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=o.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l(W,{position:"start",children:l(S,{})})},a))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l(P,{control:s,name:"password",render:function(t){var r,i,a,n=t.field;return l(B,q({fullWidth:!0,type:"password",defaultValue:null!==(r=n.value)&&void 0!==r?r:"",value:null!==(i=n.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(a=o.password)||void 0===a?void 0:a.message,startAdornment:l(W,{position:"start",children:l(C,{})})},n))},rules:{required:e.texts.passwordRequiredText}}),l(a,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),i(a,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",l("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),l(A,{}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l(z,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&l(z,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&l(z,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},H=function(e){return i(n,{maxWidth:"xs",children:[l(R,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&l(z,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&l(z,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&l(z,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&l(z,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&l(z,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&l(z,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&l(z,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};B.propTypes={theme:r.oneOf(["secondary","primary"]),viaApplePay:r.bool,viaGooglePay:r.bool,viaSTCPay:r.bool,viaCreditCard:r.bool,viaPayPal:r.bool,handleApplePay:r.func};var V=function(e){var r,a,o=w(),d=o.formState.errors,s=o.handleSubmit;return l(n,{maxWidth:"xs",children:l(T,q(q({},o),{},{children:i("form",{onSubmit:s(e.handle),children:[l(B,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(r=d.password)||void 0===r?void 0:r.message}),l(B,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(a=d.password)||void 0===a?void 0:a.message}),l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},_=function(r){var o=O(e(0),2),d=o[0],s=o[1],u=w();u.formState.errors;var m=u.handleSubmit,c=u.control;return i(n,{maxWidth:"xs",children:[i(a,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(d).toLocaleString("en")||"0",l(a,{children:r.currency||"SAR"})]}),l(T,q(q({},u),{},{children:i("form",{onSubmit:m(r.handleChargeWallet),children:[l(P,{control:c,name:"amount",render:function(e){var t,r=e.field;return l(B,q(q({fullWidth:!0,placeholder:"Enter amount",type:"number",value:null!==(t=r.value)&&void 0!==t?t:""},r),{},{inputProps:{inputMode:"numeric",min:"0",max:"9999999",step:"0.01"},onChange:function(e){r.onChange(parseFloat(e.target.value)),console.log("e",e.target.value),s(e.target.value)}}))}}),l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:r.handleSignIn,children:"Charge Wallet"})]})}))]})},Y=function(e){return i(n,{maxWidth:"xs",children:[l(a,{align:"center",children:"Wallet Balance"}),i(a,{align:"center",variant:"h1",children:[e.walletBalance||"0",l(a,{children:e.currency||"SAR"})]}),l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},J=function(e){var r,o,d,s,u,m,c,h,p,v,f="ar"===e.lang,g=w(),x=g.formState.errors,b=g.handleSubmit;g.register;var y=g.control,W={display:"flex",padding:0,paddingRight:"0px !important",paddingLeft:"0px !important",flexDirection:{xs:"column",sm:"row",md:"row",lg:"row",xl:"row"}};return i(n,{maxWidth:"sm",style:{direction:f?"rtl":"ltr"},children:[l(a,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l(D,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l(A,{variant:"middle"}),l(a,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.billingAddress}),l(T,q(q({},g),{},{children:i("form",{onSubmit:b(e.handlePayNow),children:[i(n,{sx:W,children:[l(P,{control:y,name:"firstName",rules:{required:null===(r=e.texts)||void 0===r?void 0:r.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.firstNameLabel)+" *",helperText:null===(a=x.firstName)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"lastName",rules:{required:null===(o=e.texts)||void 0===o?void 0:o.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.lastNameLabel)+" *",helperText:null===(a=x.lastName)||void 0===a?void 0:a.message},n))}})]}),l(P,{control:y,name:"email",render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.emailLabel)+" *",helperText:null===(a=x.email)||void 0===a?void 0:a.message},n))},rules:{required:null===(d=e.texts)||void 0===d?void 0:d.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:null===(s=e.texts)||void 0===s?void 0:s.emailInvalidText}}}),i(n,{sx:W,children:[l(P,{control:y,name:"streetAddress",rules:{required:null===(u=e.texts)||void 0===u?void 0:u.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.streetAddressLabel)+" *",helperText:null===(a=x.streetAddress)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"buildingNumber",rules:{required:null===(m=e.texts)||void 0===m?void 0:m.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.buildingNumberLabel)+" *",helperText:null===(a=x.buildingNumber)||void 0===a?void 0:a.message},n))}})]}),i(n,{sx:W,children:[l(P,{control:y,name:"province",rules:{required:null===(c=e.texts)||void 0===c?void 0:c.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.stateLabel)+" *",helperText:null===(a=x.province)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"city",rules:{required:null===(h=e.texts)||void 0===h?void 0:h.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.cityLabel)+" *",helperText:null===(a=x.city)||void 0===a?void 0:a.message},n))}})]}),i(n,{sx:W,children:[l(P,{control:y,name:"zipCode",rules:{required:null===(p=e.texts)||void 0===p?void 0:p.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"number",variant:"unscrollable",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.zipCodeLabel)+" *",helperText:null===(a=x.zipCode)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"country",rules:{required:null===(v=e.texts)||void 0===v?void 0:v.required},render:function(t){var r,a,n,o=t.field;return i(j,q(q({fullWidth:!0,native:!0,label:(null===(r=e.texts)||void 0===r?void 0:r.countryLabel)+" *",variant:"standard",value:null!==(a=o.value)&&void 0!==a?a:"",helperText:null===(n=x.country)||void 0===n?void 0:n.message,displayEmpty:!0,disableUnderline:!0,validators:["required"]},o),{},{children:[l("option",{}),e.countriesList.map((function(e,t){return l("option",{children:e},t)}))]}))}})]}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.payNow})]})}))]})},K=function(e){var r="ar"===e.lang,o=w();return o.formState.errors,o.handleSubmit,o.register,o.control,i("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[i(n,{maxWidth:"sm",style:{direction:r?"rtl":"ltr"},children:[l(a,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),l(A,{variant:"middle"}),i(a,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",l("strong",{children:e.userEmail})]}),l(a,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),l(a,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),l(A,{variant:"middle"}),l(a,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l(D,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l(A,{variant:"middle"}),l(t,{onClick:e.handlePrint,variant:"contained",children:e.texts.print}),l(t,{onClick:e.handleHistory,variant:"last",children:e.texts.history}),l(t,{onClick:e.handleHome,variant:"last",children:e.texts.homePage}),l(a,{align:"center",variant:"body2",style:{marginTop:10},children:e.texts.fasterPaymentNote})]}),l("a",{style:{marginTop:10,paddingTop:10,padding:5,cursor:"pointer"},onClick:e.handleRefundPolicyLink,children:l(a,{align:"center",variant:"caption",fontWeight:500,children:e.texts.refundPolicy})})]})};export{_ as ChargeWalletForm,J as CheckoutForm,K as ConfirmationPage,V as CreditCardForm,U as NewPasswordForm,Y as PayWithWallet,Z as ResetPasswordForm,H as SelectPayment,$ as SignInForm,E as SignUpForm,F as UserProfileForm,M as UserSettingsForm};
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),a=require("react/jsx-runtime"),l=require("@mui/material");require("@mui/icons-material/MoveToInbox");var i=require("@mui/material/AppBar");require("@mui/material/Box"),require("@mui/material/Toolbar"),require("@mui/material/IconButton");var n=require("@mui/material/Typography");require("@mui/material/Menu"),require("@mui/icons-material/Menu");var o=require("@mui/material/Container");require("@mui/material/Avatar"),require("@mui/material/MenuItem"),require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox"),require("@mui/icons-material/CheckCircleOutlined");var s=require("@mui/material/Input"),u=require("@mui/material/InputLabel"),d=require("@mui/icons-material/GitHub"),c=require("@mui/icons-material/Twitter"),m=require("@mui/icons-material/AccountBalanceWallet"),x=require("@mui/material/Alert"),h=require("@mui/material/AlertTitle");require("@mui/material/Table"),require("@mui/material/TableBody"),require("@mui/material/TableCell"),require("@mui/material/TableContainer"),require("@mui/material/TableHead"),require("@mui/material/TableRow"),require("@mui/material/Snackbar");var p=require("react-hook-form"),f=require("@mui/material/InputAdornment"),v=require("@mui/icons-material/HttpsOutlined"),g=require("@mui/icons-material/MailOutline"),b=require("@mui/icons-material/PermIdentityOutlined"),y=require("@mui/material/styles"),j=require("@mui/material/Drawer");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@mui/material/List"),require("@mui/material/Divider"),require("@mui/icons-material/ChevronLeft"),require("@mui/icons-material/ChevronRight"),require("@mui/material/ListItemButton"),require("@mui/material/ListItemIcon"),require("@mui/material/ListItemText"),require("@mui/icons-material/Mail"),require("@mui/icons-material/Close");var T=w(t),P=w(r),q=w(i),C=w(n),S=w(o),k=w(s),W=w(u),A=w(d),L=w(c),I=w(m),O=w(x),F=w(h),R=w(f),z=w(v),B=w(g),N=w(b),M=w(j);function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){D(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,l,i=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){o=!0,l=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw l}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}P.default.string,P.default.bool;var $=function(e){return a.jsx(C.default,G(G({},e),{},{children:e.children}))},_=function(e){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[a.jsx(W.default,{children:e.label}),e.helperText&&a.jsx(l.Typography,{variant:"validation",children:e.helperText})]}),a.jsx(k.default,G({disableUnderline:!0},e))]})};P.default.oneOf(["text","number","password"]),P.default.string;var H=function(e){var t,r="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":r=a.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":r=a.jsx(A.default,{});break;case"twitter":r=a.jsx(L.default,{});break;case"mada":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":r=a.jsx(I.default,{})}return a.jsxs(T.default,G(G({},e),{},{variant:"withLogo",children:[r,a.jsx("div",{style:{width:10}}),a.jsx(l.Typography,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},V=function(e){return a.jsxs(O.default,{severity:e.severity,children:[e.title&&a.jsx(F.default,{children:e.title}),e.text]})},X=function(e){var t=p.useForm(),r=t.formState.errors,l=t.handleSubmit,i=t.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&a.jsxs(O.default,{severity:"error",children:[e.errorTitle&&a.jsx(F.default,{children:e.errorTitle}),e.errorText]}),a.jsx(p.FormProvider,G(G({},t),{},{children:a.jsxs("form",{onSubmit:l(e.handleSignUp),children:[a.jsx(p.Controller,{control:i,name:"fullName",render:function(t){var l,i,n=t.field;return a.jsx(_,{fullWidth:!0,type:"text",value:null!==(l=n.value)&&void 0!==l?l:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=r.fullName)||void 0===i?void 0:i.message,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(N.default,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a.jsx(p.Controller,{control:i,name:"email",render:function(t){var l,i,n=t.field;return a.jsx(_,{fullWidth:!0,type:"text",value:null!==(l=n.value)&&void 0!==l?l:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(B.default,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(p.Controller,{control:i,name:"password",render:function(t){var l,i,n,o=t.field;return a.jsx(_,G({fullWidth:!0,type:"password",defaultValue:null!==(l=o.value)&&void 0!==l?l:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(z.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(T.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),a.jsxs(C.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",a.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(H,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a.jsx(H,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a.jsx(H,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};X.propTypes={theme:P.default.oneOf(["secondary","primary"])};_.propTypes={theme:P.default.oneOf(["secondary","primary"]),viaApplePay:P.default.bool,viaGooglePay:P.default.bool,viaSTCPay:P.default.bool,viaCreditCard:P.default.bool,viaPayPal:P.default.bool,handleApplePay:P.default.func};var Y=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},J=function(e){return D({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"calc(".concat(e.spacing(7)," + 1px)")},e.breakpoints.up("sm"),{width:"calc(".concat(e.spacing(8)," + 1px)")})};y.styled("div")((function(e){var t=e.theme;return G({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),y.styled(q.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return G({zIndex:t.zIndex.drawer+1,transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen})},r&&{marginLeft:240,width:"calc(100% - ".concat(240,"px)"),transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.enteringScreen})})})),y.styled(M.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return G(G({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&G(G({},Y(t)),{},{"& .MuiDrawer-paper":Y(t)})),!r&&G(G({},J(t)),{},{"& .MuiDrawer-paper":J(t)}))}));exports.ChargeWalletForm=function(t){var r=Z(e.useState(0),2),l=r[0],i=r[1],n=p.useForm();n.formState.errors;var o=n.handleSubmit,s=n.control;return a.jsxs(S.default,{maxWidth:"xs",children:[a.jsxs(C.default,{align:"center",variant:"h2",fontWeight:500,children:[Number(l).toLocaleString("en")||"0",a.jsx(C.default,{children:t.currency||"SAR"})]}),a.jsx(p.FormProvider,G(G({},n),{},{children:a.jsxs("form",{onSubmit:o(t.handleChargeWallet),children:[a.jsx(p.Controller,{control:s,name:"amount",render:function(e){var t,r=e.field;return a.jsx(_,G(G({fullWidth:!0,placeholder:"Enter amount",type:"number",value:null!==(t=r.value)&&void 0!==t?t:""},r),{},{inputProps:{inputMode:"numeric",min:"0",max:"9999999",step:"0.01"},onChange:function(e){r.onChange(parseFloat(e.target.value)),console.log("e",e.target.value),i(e.target.value)}}))}}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CreditCardForm=function(e){var t,r,i=p.useForm(),n=i.formState.errors,o=i.handleSubmit;return a.jsx(l.Container,{maxWidth:"xs",children:a.jsx(p.FormProvider,G(G({},i),{},{children:a.jsxs("form",{onSubmit:o(e.handle),children:[a.jsx(_,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a.jsx(_,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a.jsx(l.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},exports.NewPasswordForm=function(t){var r=Z(e.useState(""),2);r[0],r[1];var l=Z(e.useState(""),2);l[0],l[1];var i=Z(e.useState(!1),2),n=i[0],o=i[1],s=p.useForm(),u=s.formState.errors,d=s.handleSubmit,c=s.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",children:[n&&a.jsx(V,{text:t.texts.passwordMatchError,severity:"error"}),t.passwordChanged?a.jsx($,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a.jsx(p.FormProvider,G(G({},s),{},{children:a.jsxs("form",{onSubmit:d((function(e){console.log("handling subb",e),e.password===e.confirmPassword?t.handleNewPassword():o(!0)})),children:[a.jsx(p.Controller,{control:c,name:"password",render:function(e){var r,l,i=e.field;return a.jsx(_,G({fullWidth:!0,type:"password",value:null!==(r=i.value)&&void 0!==r?r:"",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,helperText:null===(l=u.password)||void 0===l?void 0:l.message,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(z.default,{})})},i))},rules:{required:t.texts.passwordRequiredText}}),a.jsx(p.Controller,{control:c,name:"confirmPassword",render:function(e){var r,l,i=e.field;return a.jsx(_,G({fullWidth:!0,type:"password",value:null!==(r=i.value)&&void 0!==r?r:"",label:t.texts.confirmPasswordLabel,placeholder:t.texts.confirmPasswordPlaceholder,helperText:null===(l=u.confirmPassword)||void 0===l?void 0:l.message,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(z.default,{})})},i))},rules:{required:t.texts.confirmPasswordRequiredText}}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.PayWithWallet=function(e){return a.jsxs(l.Container,{maxWidth:"xs",children:[a.jsx(l.Typography,{align:"center",children:"Wallet Balance"}),a.jsxs(l.Typography,{align:"center",variant:"h1",children:[e.walletBalance||"0",a.jsx(l.Typography,{children:e.currency||"SAR"})]}),a.jsx(l.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t,r=p.useForm(),l=r.formState.errors,i=r.handleSubmit;r.register;var n=r.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(Alert,{severity:"error",children:[e.errorTitle&&a.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a.jsx($,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a.jsxs("form",{onSubmit:i(e.handleResetPassword),children:[console.log("eror ",null===(t=l.email)||void 0===t?void 0:t.message),a.jsx(p.Controller,{control:n,name:"email",render:function(t){var r,i,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=l.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(B.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},exports.SelectPayment=function(e){return a.jsxs(l.Container,{maxWidth:"xs",children:[a.jsx($,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(H,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(H,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a.jsx(H,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a.jsx(H,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(H,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(H,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(H,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t=p.useForm(),r=t.formState.errors,l=t.handleSubmit;t.register;var i=t.control;return a.jsxs(S.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&a.jsxs(O.default,{severity:"error",children:[e.errorTitle&&a.jsx(F.default,{children:e.errorTitle}),e.errorText]}),a.jsxs("form",{onSubmit:l(e.handleSignIn),children:[a.jsx(p.Controller,{control:i,name:"email",render:function(t){var l,i,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"text",value:null!==(l=n.value)&&void 0!==l?l:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(B.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(p.Controller,{control:i,name:"password",render:function(t){var l,i,n,o=t.field;return a.jsx(_,G({fullWidth:!0,type:"password",defaultValue:null!==(l=o.value)&&void 0!==l?l:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:a.jsx(R.default,{position:"start",children:a.jsx(z.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(C.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),a.jsxs(C.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(H,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(H,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(H,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=X,exports.UserProfileForm=function(e){var t=p.useForm(),r=t.formState.errors,l=t.handleSubmit,i=t.control;return a.jsx(S.default,{maxWidth:"sm",children:a.jsx(p.FormProvider,G(G({},t),{},{children:a.jsxs("form",{onSubmit:l(e.handleUpdateProfile),children:[a.jsx(p.Controller,{control:i,name:"fullName",render:function(t){var l,i,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"text",value:null!==(l=n.value)&&void 0!==l?l:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=r.fullName)||void 0===i?void 0:i.message},n))}}),a.jsx(p.Controller,{control:i,name:"phoneNumber",render:function(e){var t=e.field;return a.jsx(_,G({fullWidth:!0,type:"number",label:"Phone Number",placeholder:"+966"},t))}}),a.jsx(p.Controller,{control:i,name:"email",render:function(t){var l,i,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"text",value:null!==(l=n.value)&&void 0!==l?l:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(p.Controller,{control:i,name:"password",render:function(t){var l,i,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"password",value:null!==(l=n.value)&&void 0!==l?l:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=r.password)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(p.Controller,{control:i,name:"confirmPassword",render:function(t){var l,i,n=t.field;return a.jsx(_,G({fullWidth:!0,type:"password",value:null!==(l=n.value)&&void 0!==l?l:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(i=r.confirmPassword)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.confirmPasswordRequiredText}}),a.jsx(T.default,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettingsForm=function(e){return a.jsxs(l.Container,{maxWidth:"sm",children:[e.children,a.jsx(l.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),l=require("react/jsx-runtime");require("@mui/material/ListItemButton"),require("@mui/material/ListItemText"),require("@mui/icons-material/MoveToInbox"),require("@mui/material/AppBar"),require("@mui/material/Box"),require("@mui/material/Toolbar"),require("@mui/material/IconButton");var a=require("@mui/material/Typography");require("@mui/material/Menu"),require("@mui/icons-material/Menu");var i=require("@mui/material/Container");require("@mui/material/Avatar"),require("@mui/material/MenuItem"),require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox"),require("@mui/icons-material/CheckCircleOutlined");var n=require("@mui/material/Input"),o=require("@mui/material/InputLabel");require("@mui/material/Switch");var s=require("@mui/icons-material/GitHub"),d=require("@mui/icons-material/Twitter"),u=require("@mui/icons-material/AccountBalanceWallet"),c=require("@mui/material/Select"),x=require("@mui/material/Alert"),m=require("@mui/material/AlertTitle"),h=require("@mui/material/Table"),f=require("@mui/material/TableBody"),v=require("@mui/material/TableCell"),p=require("@mui/material/TableContainer"),g=require("@mui/material/TableHead"),j=require("@mui/material/TableRow");require("@mui/material/Snackbar");var b=require("react-hook-form"),y=require("@mui/material/InputAdornment"),w=require("@mui/icons-material/HttpsOutlined"),T=require("@mui/icons-material/MailOutline"),P=require("@mui/icons-material/PermIdentityOutlined"),q=require("@mui/material/Divider");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var W=C(t),S=C(r),k=C(a),A=C(i),L=C(n),F=C(o),N=C(s),O=C(d),I=C(u),R=C(c),B=C(x),z=C(m),U=C(h),G=C(f),M=C(v),D=C(p),Z=C(g),E=C(j),$=C(y),H=C(w),_=C(T),V=C(P),Y=C(q);function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,l)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?J(Object(r),!0).forEach((function(t){Q(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var l,a,i=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(l=r.next()).done)&&(i.push(l.value),!t||i.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw a}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ee(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,l=new Array(t);r<t;r++)l[r]=e[r];return l}S.default.string,S.default.bool;var te=function(e){return l.jsx(k.default,K(K({},e),{},{children:e.children}))},re=function(e){return l.jsxs("div",{style:e.inForm&&{width:"100%"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.label&&l.jsx(F.default,{children:e.label}),e.helperText&&l.jsx(k.default,{variant:"validation",children:e.helperText})]}),l.jsx(L.default,K({disableUnderline:!0},e))]})};S.default.oneOf(["text","number","password"]),S.default.string;var le=function(e){var t,r="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":r=l.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":r=l.jsx(N.default,{});break;case"twitter":r=l.jsx(O.default,{});break;case"mada":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":r=l.jsx(I.default,{})}return l.jsxs(W.default,K(K({},e),{},{variant:"withLogo",children:[r,l.jsx("div",{style:{width:10}}),l.jsx(k.default,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},ae=function(e){return l.jsxs("div",{style:{width:"100%"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[l.jsx(F.default,{children:e.label}),e.helperText&&l.jsx(k.default,{variant:"validation",children:e.helperText})]}),l.jsx(R.default,K(K({},e),{},{children:e.children}))]})},ie=function(e){return l.jsxs(B.default,{severity:e.severity,children:[e.title&&l.jsx(z.default,{children:e.title}),e.text]})},ne=function(e){var t="ar"===e.lang;return l.jsx(D.default,{style:{direction:t?"rtl":"ltr"},children:l.jsxs(U.default,{"aria-label":"a dense table",children:[l.jsx(Z.default,{children:l.jsx(E.default,{children:e.columns.map((function(e,r){return l.jsx(M.default,{align:t?"right":"left",style:{fontWeight:700},variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})}),l.jsx(G.default,{children:e.rows.map((function(e,r){return l.jsx(E.default,{children:e.map((function(e,r){return l.jsx(M.default,{align:t?"right":"left",component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))},r)}))}),e.end&&l.jsx(E.default,{children:e.end.map((function(e,r){return l.jsx(M.default,{align:t?"right":"left",style:{fontWeight:700},component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})]})})},oe=function(e){var t=b.useForm(),r=t.formState.errors,a=t.handleSubmit,i=t.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&l.jsxs(B.default,{severity:"error",children:[e.errorTitle&&l.jsx(z.default,{children:e.errorTitle}),e.errorText]}),l.jsx(b.FormProvider,K(K({},t),{},{children:l.jsxs("form",{onSubmit:a(e.handleSignUp),children:[l.jsx(b.Controller,{control:i,name:"fullName",render:function(t){var a,i,n=t.field;return l.jsx(re,{fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=r.fullName)||void 0===i?void 0:i.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(V.default,{})})})},rules:{required:e.texts.fullNameRequiredText}}),l.jsx(b.Controller,{control:i,name:"email",render:function(t){var a,i,n=t.field;return l.jsx(re,{fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(_.default,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(b.Controller,{control:i,name:"password",render:function(t){var a,i,n,o=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",defaultValue:null!==(a=o.value)&&void 0!==a?a:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),l.jsx(W.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),l.jsxs(k.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",l.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),l.jsx(Y.default,{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l.jsx(le,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&l.jsx(le,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&l.jsx(le,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};oe.propTypes={theme:S.default.oneOf(["secondary","primary"])};re.propTypes={theme:S.default.oneOf(["secondary","primary"]),viaApplePay:S.default.bool,viaGooglePay:S.default.bool,viaSTCPay:S.default.bool,viaCreditCard:S.default.bool,viaPayPal:S.default.bool,handleApplePay:S.default.func};exports.ChargeWalletForm=function(t){var r=X(e.useState(0),2),a=r[0],i=r[1],n=b.useForm();n.formState.errors;var o=n.handleSubmit,s=n.control;return l.jsxs(A.default,{maxWidth:"xs",children:[l.jsxs(k.default,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(a).toLocaleString("en")||"0",l.jsx(k.default,{children:t.currency||"SAR"})]}),l.jsx(b.FormProvider,K(K({},n),{},{children:l.jsxs("form",{onSubmit:o(t.handleChargeWallet),children:[l.jsx(b.Controller,{control:s,name:"amount",render:function(e){var t,r=e.field;return l.jsx(re,K(K({fullWidth:!0,placeholder:"Enter amount",type:"number",value:null!==(t=r.value)&&void 0!==t?t:""},r),{},{inputProps:{inputMode:"numeric",min:"0",max:"9999999",step:"0.01"},onChange:function(e){r.onChange(parseFloat(e.target.value)),console.log("e",e.target.value),i(e.target.value)}}))}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CheckoutForm=function(e){var t,r,a,i,n,o,s,d,u,c,x="ar"===e.lang,m=b.useForm(),h=m.formState.errors,f=m.handleSubmit;m.register;var v=m.control,p={display:"flex",padding:0,paddingRight:"0px !important",paddingLeft:"0px !important",flexDirection:{xs:"column",sm:"row",md:"row",lg:"row",xl:"row"}};return l.jsxs(A.default,{maxWidth:"sm",style:{direction:x?"rtl":"ltr"},children:[l.jsx(k.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l.jsx(ne,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l.jsx(Y.default,{variant:"middle"}),l.jsx(k.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.billingAddress}),l.jsx(b.FormProvider,K(K({},m),{},{children:l.jsxs("form",{onSubmit:f(e.handlePayNow),children:[l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"firstName",rules:{required:null===(t=e.texts)||void 0===t?void 0:t.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.firstNameLabel)+" *",helperText:null===(i=h.firstName)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"lastName",rules:{required:null===(r=e.texts)||void 0===r?void 0:r.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.lastNameLabel)+" *",helperText:null===(i=h.lastName)||void 0===i?void 0:i.message},n))}})]}),l.jsx(b.Controller,{control:v,name:"email",render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.emailLabel)+" *",helperText:null===(i=h.email)||void 0===i?void 0:i.message},n))},rules:{required:null===(a=e.texts)||void 0===a?void 0:a.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:null===(i=e.texts)||void 0===i?void 0:i.emailInvalidText}}}),l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"streetAddress",rules:{required:null===(n=e.texts)||void 0===n?void 0:n.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.streetAddressLabel)+" *",helperText:null===(i=h.streetAddress)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"buildingNumber",rules:{required:null===(o=e.texts)||void 0===o?void 0:o.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.buildingNumberLabel)+" *",helperText:null===(i=h.buildingNumber)||void 0===i?void 0:i.message},n))}})]}),l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"province",rules:{required:null===(s=e.texts)||void 0===s?void 0:s.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.stateLabel)+" *",helperText:null===(i=h.province)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"city",rules:{required:null===(d=e.texts)||void 0===d?void 0:d.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.cityLabel)+" *",helperText:null===(i=h.city)||void 0===i?void 0:i.message},n))}})]}),l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"zipCode",rules:{required:null===(u=e.texts)||void 0===u?void 0:u.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"number",variant:"unscrollable",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.zipCodeLabel)+" *",helperText:null===(i=h.zipCode)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"country",rules:{required:null===(c=e.texts)||void 0===c?void 0:c.required},render:function(t){var r,a,i,n=t.field;return l.jsxs(ae,K(K({fullWidth:!0,native:!0,label:(null===(r=e.texts)||void 0===r?void 0:r.countryLabel)+" *",variant:"standard",value:null!==(a=n.value)&&void 0!==a?a:"",helperText:null===(i=h.country)||void 0===i?void 0:i.message,displayEmpty:!0,disableUnderline:!0,validators:["required"]},n),{},{children:[l.jsx("option",{}),e.countriesList.map((function(e,t){return l.jsx("option",{children:e},t)}))]}))}})]}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.payNow})]})}))]})},exports.ConfirmationPage=function(e){var t="ar"===e.lang,r=b.useForm();return r.formState.errors,r.handleSubmit,r.register,r.control,l.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[l.jsxs(A.default,{maxWidth:"sm",style:{direction:t?"rtl":"ltr"},children:[l.jsx(k.default,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),l.jsx(Y.default,{variant:"middle"}),l.jsxs(k.default,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",l.jsx("strong",{children:e.userEmail})]}),l.jsx(k.default,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),l.jsx(k.default,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),l.jsx(Y.default,{variant:"middle"}),l.jsx(k.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l.jsx(ne,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l.jsx(Y.default,{variant:"middle"}),l.jsx(W.default,{onClick:e.handlePrint,variant:"contained",children:e.texts.print}),l.jsx(W.default,{onClick:e.handleHistory,variant:"last",children:e.texts.history}),l.jsx(W.default,{onClick:e.handleHome,variant:"last",children:e.texts.homePage}),l.jsx(k.default,{align:"center",variant:"body2",style:{marginTop:10},children:e.texts.fasterPaymentNote})]}),l.jsx("a",{style:{marginTop:10,paddingTop:10,padding:5,cursor:"pointer"},onClick:e.handleRefundPolicyLink,children:l.jsx(k.default,{align:"center",variant:"caption",fontWeight:500,children:e.texts.refundPolicy})})]})},exports.CreditCardForm=function(e){var t,r,a=b.useForm(),i=a.formState.errors,n=a.handleSubmit;return l.jsx(A.default,{maxWidth:"xs",children:l.jsx(b.FormProvider,K(K({},a),{},{children:l.jsxs("form",{onSubmit:n(e.handle),children:[l.jsx(re,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=i.password)||void 0===t?void 0:t.message}),l.jsx(re,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=i.password)||void 0===r?void 0:r.message}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},exports.NewPasswordForm=function(t){var r=X(e.useState(""),2);r[0],r[1];var a=X(e.useState(""),2);a[0],a[1];var i=X(e.useState(!1),2),n=i[0],o=i[1],s=b.useForm(),d=s.formState.errors,u=s.handleSubmit,c=s.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",children:[n&&l.jsx(ie,{text:t.texts.passwordMatchError,severity:"error"}),t.passwordChanged?l.jsx(te,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):l.jsx(b.FormProvider,K(K({},s),{},{children:l.jsxs("form",{onSubmit:u((function(e){console.log("handling subb",e),e.password===e.confirmPassword?t.handleNewPassword():o(!0)})),children:[l.jsx(b.Controller,{control:c,name:"password",render:function(e){var r,a,i=e.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(r=i.value)&&void 0!==r?r:"",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,helperText:null===(a=d.password)||void 0===a?void 0:a.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},i))},rules:{required:t.texts.passwordRequiredText}}),l.jsx(b.Controller,{control:c,name:"confirmPassword",render:function(e){var r,a,i=e.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(r=i.value)&&void 0!==r?r:"",label:t.texts.confirmPasswordLabel,placeholder:t.texts.confirmPasswordPlaceholder,helperText:null===(a=d.confirmPassword)||void 0===a?void 0:a.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},i))},rules:{required:t.texts.confirmPasswordRequiredText}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.PayWithWallet=function(e){return l.jsxs(A.default,{maxWidth:"xs",children:[l.jsx(k.default,{align:"center",children:"Wallet Balance"}),l.jsxs(k.default,{align:"center",variant:"h1",children:[e.walletBalance||"0",l.jsx(k.default,{children:e.currency||"SAR"})]}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t,r=b.useForm(),a=r.formState.errors,i=r.handleSubmit;r.register;var n=r.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",children:[e.error&&l.jsxs(Alert,{severity:"error",children:[e.errorTitle&&l.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?l.jsx(te,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):l.jsxs("form",{onSubmit:i(e.handleResetPassword),children:[console.log("eror ",null===(t=a.email)||void 0===t?void 0:t.message),l.jsx(b.Controller,{control:n,name:"email",render:function(t){var r,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=a.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(_.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},exports.SelectPayment=function(e){return l.jsxs(A.default,{maxWidth:"xs",children:[l.jsx(te,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&l.jsx(le,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&l.jsx(le,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&l.jsx(le,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&l.jsx(le,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&l.jsx(le,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&l.jsx(le,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&l.jsx(le,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t=b.useForm(),r=t.formState.errors,a=t.handleSubmit;t.register;var i=t.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&l.jsxs(B.default,{severity:"error",children:[e.errorTitle&&l.jsx(z.default,{children:e.errorTitle}),e.errorText]}),l.jsxs("form",{onSubmit:a(e.handleSignIn),children:[l.jsx(b.Controller,{control:i,name:"email",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(_.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(b.Controller,{control:i,name:"password",render:function(t){var a,i,n,o=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",defaultValue:null!==(a=o.value)&&void 0!==a?a:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),l.jsx(k.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),l.jsxs(k.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",l.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),l.jsx(Y.default,{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l.jsx(le,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&l.jsx(le,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&l.jsx(le,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=oe,exports.UserProfileForm=function(e){var t=b.useForm(),r=t.formState.errors,a=t.handleSubmit,i=t.control;return l.jsx(A.default,{maxWidth:"sm",children:l.jsx(b.FormProvider,K(K({},t),{},{children:l.jsxs("form",{onSubmit:a(e.handleUpdateProfile),children:[l.jsx(b.Controller,{control:i,name:"fullName",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=r.fullName)||void 0===i?void 0:i.message},n))}}),l.jsx(b.Controller,{control:i,name:"phoneNumber",render:function(e){var t=e.field;return l.jsx(re,K({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),l.jsx(b.Controller,{control:i,name:"email",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\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,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(b.Controller,{control:i,name:"password",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=r.password)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.passwordRequiredText}}),l.jsx(b.Controller,{control:i,name:"confirmPassword",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(i=r.confirmPassword)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.confirmPasswordRequiredText}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettingsForm=function(e){return l.jsxs(A.default,{maxWidth:"sm",children:[e.children,l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.18",
3
+ "version": "0.0.21",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -37,7 +37,7 @@ export const UserProfileForm = (props) => {
37
37
  render={({ field }) => (
38
38
  <HawaTextField
39
39
  fullWidth
40
- type="number"
40
+ type="tel"
41
41
  label="Phone Number"
42
42
  placeholder="+966"
43
43
  {...field}
@@ -1,5 +1,5 @@
1
- import { HawaSettingsRow } from "../../elements";
2
- import { Button, Container } from "@mui/material";
1
+ import Button from "@mui/material/Button";
2
+ import Container from "@mui/material/Container";
3
3
 
4
4
  export const UserSettingsForm = (props) => {
5
5
  return (
@@ -9,6 +9,7 @@ import Typography from "@mui/material/Typography";
9
9
  import Button from "@mui/material/Button";
10
10
  import Alert from "@mui/material/Alert";
11
11
  import AlertTitle from "@mui/material/AlertTitle";
12
+ import Divider from "@mui/material/Divider";
12
13
 
13
14
  export const SignInForm = (props) => {
14
15
  const methods = useForm();
@@ -115,6 +116,7 @@ export const SignInForm = (props) => {
115
116
  {props.texts.signUpText}
116
117
  </span>
117
118
  </Typography>
119
+ <Divider />
118
120
  <div style={{ display: "flex", flexDirection: "column" }}>
119
121
  {props.viaGoogle && (
120
122
  <HawaLogoButton
@@ -7,6 +7,7 @@ import InputAdornment from "@mui/material/InputAdornment";
7
7
  import EmailIcon from "@mui/icons-material/MailOutline";
8
8
  import PasswordIcon from "@mui/icons-material/HttpsOutlined";
9
9
  import Container from "@mui/material/Container";
10
+ import Divider from "@mui/material/Divider";
10
11
  import Typography from "@mui/material/Typography";
11
12
  import Button from "@mui/material/Button";
12
13
  import Alert from "@mui/material/Alert";
@@ -136,6 +137,7 @@ export const SignUpForm = (props) => {
136
137
  {props.texts.signInText}
137
138
  </span>
138
139
  </Typography>
140
+ <Divider />
139
141
  <div style={{ display: "flex", flexDirection: "column" }}>
140
142
  {props.viaGoogle && (
141
143
  <HawaLogoButton
@@ -16,7 +16,12 @@ export const ChargeWalletForm = (props) => {
16
16
 
17
17
  return (
18
18
  <Container maxWidth="xs">
19
- <Typography align="center" variant="h2" fontWeight={500}>
19
+ <Typography
20
+ align="center"
21
+ variant="h2"
22
+ fontWeight={500}
23
+ style={{ marginBottom: 20 }}
24
+ >
20
25
  {Number(walletAmount).toLocaleString("en") || "0"}
21
26
  <Typography>{props.currency || "SAR"}</Typography>
22
27
  </Typography>
@@ -0,0 +1,245 @@
1
+ import React, { useState } from "react";
2
+ import { HawaTextField, HawaTable, HawaSelect } from "../../elements";
3
+ import { Controller, FormProvider, useForm } from "react-hook-form";
4
+ import Button from "@mui/material/Button";
5
+ import Container from "@mui/material/Container";
6
+ import Typography from "@mui/material/Typography";
7
+ import Divider from "@mui/material/Divider";
8
+
9
+ export const CheckoutForm = (props) => {
10
+ let isArabic = props.lang === "ar";
11
+ const methods = useForm();
12
+ const {
13
+ formState: { errors },
14
+ handleSubmit,
15
+ register,
16
+ control
17
+ } = methods;
18
+
19
+ let containerStyle = {
20
+ display: "flex",
21
+ padding: 0,
22
+ paddingRight: "0px !important",
23
+ paddingLeft: "0px !important",
24
+ flexDirection: {
25
+ xs: "column",
26
+ sm: "row",
27
+ md: "row",
28
+ lg: "row",
29
+ xl: "row"
30
+ }
31
+ };
32
+ return (
33
+ <Container maxWidth="sm" style={{ direction: isArabic ? "rtl" : "ltr" }}>
34
+ <Typography
35
+ align="center"
36
+ variant="h5"
37
+ fontWeight={500}
38
+ style={{ marginBottom: 10 }}
39
+ >
40
+ {props.texts.orderDetails}
41
+ </Typography>
42
+ <HawaTable
43
+ lang={props.lang}
44
+ columns={["Product", "Price"]}
45
+ rows={props.products}
46
+ end={["Total", props.total]}
47
+ />
48
+ <Divider variant="middle" />
49
+
50
+ <Typography
51
+ align="center"
52
+ variant="h5"
53
+ fontWeight={500}
54
+ style={{ marginBottom: 10 }}
55
+ >
56
+ {props.texts.billingAddress}
57
+ </Typography>
58
+
59
+ <FormProvider {...methods}>
60
+ <form onSubmit={handleSubmit(props.handlePayNow)}>
61
+ <Container sx={containerStyle}>
62
+ <Controller
63
+ control={control}
64
+ name="firstName"
65
+ rules={{ required: props.texts?.required }}
66
+ render={({ field }) => (
67
+ <HawaTextField
68
+ inForm
69
+ fullWidth
70
+ type="text"
71
+ value={field.value ?? ""}
72
+ label={props.texts?.firstNameLabel + " *"}
73
+ helperText={errors.firstName?.message}
74
+ {...field}
75
+ />
76
+ )}
77
+ />
78
+ <div style={{ width: 20 }} />
79
+
80
+ <Controller
81
+ control={control}
82
+ name="lastName"
83
+ rules={{ required: props.texts?.required }}
84
+ render={({ field }) => (
85
+ <HawaTextField
86
+ inForm
87
+ fullWidth
88
+ type="text"
89
+ value={field.value ?? ""}
90
+ label={props.texts?.lastNameLabel + " *"}
91
+ helperText={errors.lastName?.message}
92
+ {...field}
93
+ />
94
+ )}
95
+ />
96
+ </Container>
97
+ <Controller
98
+ control={control}
99
+ name="email"
100
+ render={({ field }) => (
101
+ <HawaTextField
102
+ inForm
103
+ fullWidth
104
+ type="text"
105
+ value={field.value ?? ""}
106
+ label={props.texts?.emailLabel + " *"}
107
+ helperText={errors.email?.message}
108
+ {...field}
109
+ />
110
+ )}
111
+ rules={{
112
+ required: props.texts?.emailRequiredText,
113
+ pattern: {
114
+ value:
115
+ /^(([^<>()[\]\\.,;:\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,}))$/,
116
+ message: props.texts?.emailInvalidText
117
+ }
118
+ }}
119
+ />
120
+
121
+ <Container sx={containerStyle}>
122
+ <Controller
123
+ control={control}
124
+ name="streetAddress"
125
+ rules={{ required: props.texts?.required }}
126
+ render={({ field }) => (
127
+ <HawaTextField
128
+ inForm
129
+ fullWidth
130
+ type="text"
131
+ value={field.value ?? ""}
132
+ label={props.texts?.streetAddressLabel + " *"}
133
+ helperText={errors.streetAddress?.message}
134
+ {...field}
135
+ />
136
+ )}
137
+ />
138
+ <div style={{ width: 20 }} />
139
+
140
+ <Controller
141
+ control={control}
142
+ name="buildingNumber"
143
+ rules={{ required: props.texts?.required }}
144
+ render={({ field }) => (
145
+ <HawaTextField
146
+ inForm
147
+ fullWidth
148
+ type="text"
149
+ value={field.value ?? ""}
150
+ label={props.texts?.buildingNumberLabel + " *"}
151
+ helperText={errors.buildingNumber?.message}
152
+ {...field}
153
+ />
154
+ )}
155
+ />
156
+ </Container>
157
+ <Container sx={containerStyle}>
158
+ <Controller
159
+ control={control}
160
+ name="province"
161
+ rules={{ required: props.texts?.required }}
162
+ render={({ field }) => (
163
+ <HawaTextField
164
+ inForm
165
+ fullWidth
166
+ type="text"
167
+ value={field.value ?? ""}
168
+ label={props.texts?.stateLabel + " *"}
169
+ helperText={errors.province?.message}
170
+ {...field}
171
+ />
172
+ )}
173
+ />
174
+ <div style={{ width: 20 }} />
175
+
176
+ <Controller
177
+ control={control}
178
+ name="city"
179
+ rules={{ required: props.texts?.required }}
180
+ render={({ field }) => (
181
+ <HawaTextField
182
+ inForm
183
+ fullWidth
184
+ type="text"
185
+ value={field.value ?? ""}
186
+ label={props.texts?.cityLabel + " *"}
187
+ helperText={errors.city?.message}
188
+ {...field}
189
+ />
190
+ )}
191
+ />
192
+ </Container>
193
+ <Container sx={containerStyle}>
194
+ <Controller
195
+ control={control}
196
+ name="zipCode"
197
+ rules={{ required: props.texts?.required }}
198
+ render={({ field }) => (
199
+ <HawaTextField
200
+ inForm
201
+ fullWidth
202
+ type="number"
203
+ variant="unscrollable"
204
+ value={field.value ?? ""}
205
+ label={props.texts?.zipCodeLabel + " *"}
206
+ helperText={errors.zipCode?.message}
207
+ {...field}
208
+ />
209
+ )}
210
+ />
211
+ <div style={{ width: 20 }} />
212
+
213
+ <Controller
214
+ control={control}
215
+ name="country"
216
+ rules={{ required: props.texts?.required }}
217
+ render={({ field }) => (
218
+ <HawaSelect
219
+ fullWidth
220
+ native
221
+ label={props.texts?.countryLabel + " *"}
222
+ variant="standard"
223
+ value={field.value ?? ""}
224
+ helperText={errors.country?.message}
225
+ displayEmpty
226
+ disableUnderline
227
+ validators={["required"]}
228
+ {...field}
229
+ >
230
+ <option></option>
231
+ {props.countriesList.map((country, i) => (
232
+ <option key={i}>{country}</option>
233
+ ))}
234
+ </HawaSelect>
235
+ )}
236
+ />
237
+ </Container>
238
+ <Button type="submit" fullWidth variant="last">
239
+ {props.texts.payNow}
240
+ </Button>
241
+ </form>
242
+ </FormProvider>
243
+ </Container>
244
+ );
245
+ };