@sikka/hawa 0.0.19 → 0.0.20

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 (30) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +1 -1
  4. package/src/blocks/Account/UserSettingsForm.js +2 -2
  5. package/src/blocks/AuthForms/SignInForm.js +2 -0
  6. package/src/blocks/AuthForms/SignUpForm.js +2 -0
  7. package/src/blocks/Payment/ChargeWalletForm.js +6 -1
  8. package/src/blocks/Payment/CheckoutForm.js +208 -62
  9. package/src/blocks/Payment/CreditCardForm.js +3 -3
  10. package/src/blocks/Payment/PayWithWallet.js +3 -3
  11. package/src/blocks/Payment/SelectPayment.js +1 -1
  12. package/src/elements/AdaptiveButton.js +0 -2
  13. package/src/elements/HawaListItem.js +2 -1
  14. package/src/elements/HawaLogoButton.js +1 -2
  15. package/src/elements/HawaPricingCard.js +2 -1
  16. package/src/elements/HawaSelect.js +26 -0
  17. package/src/elements/HawaSwitch.js +1 -1
  18. package/src/elements/HawaTable.js +20 -5
  19. package/src/elements/HawaTextField.js +10 -4
  20. package/src/elements/HawaTypography.js +0 -1
  21. package/src/elements/index.js +1 -0
  22. package/src/layout/HawaDialog.js +5 -7
  23. package/storybook-static/iframe.html +1 -1
  24. package/storybook-static/main.13189777.iframe.bundle.js +1 -0
  25. package/storybook-static/vendors~main.4ff76500.iframe.bundle.js +76 -0
  26. package/storybook-static/{vendors~main.ae39b38c.iframe.bundle.js.LICENSE.txt → vendors~main.4ff76500.iframe.bundle.js.LICENSE.txt} +0 -0
  27. package/storybook-static/vendors~main.4ff76500.iframe.bundle.js.map +1 -0
  28. package/storybook-static/main.894e2873.iframe.bundle.js +0 -1
  29. package/storybook-static/vendors~main.ae39b38c.iframe.bundle.js +0 -76
  30. package/storybook-static/vendors~main.ae39b38c.iframe.bundle.js.map +0 -1
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 g from"@mui/icons-material/AccountBalanceWallet";import v from"@mui/material/Alert";import b from"@mui/material/AlertTitle";import x from"@mui/material/Table";import y from"@mui/material/TableBody";import w from"@mui/material/TableCell";import T from"@mui/material/TableContainer";import P from"@mui/material/TableHead";import S from"@mui/material/TableRow";import"@mui/material/Snackbar";import{useForm as C,FormProvider as W,Controller as k}from"react-hook-form";import A from"@mui/material/InputAdornment";import L from"@mui/icons-material/HttpsOutlined";import q from"@mui/icons-material/MailOutline";import I from"@mui/icons-material/PermIdentityOutlined";import{styled as O}from"@mui/material/styles";import R 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 z(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 j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?z(Object(r),!0).forEach((function(t){B(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N(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 M(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 M(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 M(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 D=function(e){return a(u,j(j({},e),{},{children:e.children}))},G=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,j({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var U=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(g,{})}return i(t,j(j({},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})]}))},E=function(e){return i(v,{severity:e.severity,children:[e.title&&a(b,{children:e.title}),e.text]})},Z=function(e){return a(T,{children:i(x,{"aria-label":"a dense table",children:[a(P,{children:a(S,{children:e.columns.map((function(e,t){return a(w,{style:{fontWeight:700},variant:0==t||"bordered",children:e})}))})}),a(y,{children:e.rows.map((function(e,t){return a(S,{children:e.map((function(e,t){return a(w,{component:"th",scope:"row",variant:0==t||"bordered",children:e},t)}))},t)}))}),e.end&&a(S,{children:e.end.map((function(e,t){return a(w,{style:{fontWeight:700},component:"th",scope:"row",variant:0==t||"bordered",children:e},t)}))})]})})},F=function(e){var r=C(),l=r.formState.errors,n=r.handleSubmit,o=r.control;return a(m,{maxWidth:"sm",children:a(W,j(j({},r),{},{children:i("form",{onSubmit:n(e.handleUpdateProfile),children:[a(k,{control:o,name:"fullName",render:function(t){var r,i,n=t.field;return a(G,j({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(k,{control:o,name:"phoneNumber",render:function(e){var t=e.field;return a(G,j({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),a(k,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(G,j({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(k,{control:o,name:"password",render:function(t){var r,i,n=t.field;return a(G,j({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(k,{control:o,name:"confirmPassword",render:function(t){var r,i,n=t.field;return a(G,j({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"})," "]})}))})},$=function(e){return i(o,{maxWidth:"sm",children:[e.children,a(s,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})},H=function(r){var l=N(e(""),2);l[0],l[1];var n=N(e(""),2);n[0],n[1];var o=N(e(!1),2),s=o[0],d=o[1],u=C(),c=u.formState.errors,p=u.handleSubmit,h=u.control;return i(m,{maxWidth:"xs",variant:"auth",children:[s&&a(E,{text:r.texts.passwordMatchError,severity:"error"}),r.passwordChanged?a(D,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a(W,j(j({},u),{},{children:i("form",{onSubmit:p((function(e){console.log("handling subb",e),e.password===e.confirmPassword?r.handleNewPassword():d(!0)})),children:[a(k,{control:h,name:"password",render:function(e){var t,i,l=e.field;return a(G,j({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(A,{position:"start",children:a(L,{})})},l))},rules:{required:r.texts.passwordRequiredText}}),a(k,{control:h,name:"confirmPassword",render:function(e){var t,i,l=e.field;return a(G,j({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(A,{position:"start",children:a(L,{})})},l))},rules:{required:r.texts.confirmPasswordRequiredText}}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},V=function(e){var r,l=C(),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(D,{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(k,{control:s,name:"email",render:function(t){var r,i,l=t.field;return a(G,j({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(A,{position:"start",children:a(q,{})})},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})]})]})},X=function(e){var r=C(),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(v,{severity:"error",children:[e.errorTitle&&a(b,{children:e.errorTitle}),e.errorText]}),a(W,j(j({},r),{},{children:i("form",{onSubmit:n(e.handleSignUp),children:[a(k,{control:o,name:"fullName",render:function(t){var r,i,n=t.field;return a(G,{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(A,{position:"start",children:a(I,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a(k,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(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(A,{position:"start",children:a(q,{})})})},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(k,{control:o,name:"password",render:function(t){var r,i,n,o=t.field;return a(G,j({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(A,{position:"start",children:a(L,{})})},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(U,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a(U,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a(U,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};X.propTypes={theme:r.oneOf(["secondary","primary"])};var _=function(e){var r=C(),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(v,{severity:"error",children:[e.errorTitle&&a(b,{children:e.errorTitle}),e.errorText]}),i("form",{onSubmit:n(e.handleSignIn),children:[a(k,{control:o,name:"email",render:function(t){var r,i,n=t.field;return a(G,j({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(A,{position:"start",children:a(q,{})})},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(k,{control:o,name:"password",render:function(t){var r,i,n,o=t.field;return a(G,j({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(A,{position:"start",children:a(L,{})})},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(U,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a(U,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a(U,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},Y=function(e){return i(o,{maxWidth:"xs",children:[a(D,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a(U,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a(U,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a(U,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a(U,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a(U,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a(U,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a(U,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};G.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 J=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},K=function(e){return B({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)")})};O("div")((function(e){var t=e.theme;return j({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),O(d,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return j({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})})})),O(R,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return j(j({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&j(j({},J(t)),{},{"& .MuiDrawer-paper":J(t)})),!r&&j(j({},K(t)),{},{"& .MuiDrawer-paper":K(t)}))}));var Q=function(e){var t,r,l=C(),n=l.formState.errors,d=l.handleSubmit;return a(o,{maxWidth:"xs",children:a(W,j(j({},l),{},{children:i("form",{onSubmit:d(e.handle),children:[a(G,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a(G,{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"})]})}))})},ee=function(r){var l=N(e(0),2),n=l[0],o=l[1],s=C();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(W,j(j({},s),{},{children:i("form",{onSubmit:d(r.handleChargeWallet),children:[a(k,{control:c,name:"amount",render:function(e){var t,r=e.field;return a(G,j(j({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"})]})}))]})},te=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"})]})},re=function(e){var t,r,l=C(),d=l.formState.errors,u=l.handleSubmit;return i(o,{maxWidth:"xs",children:[a(n,{align:"center",variant:"h4",fontWeight:400,style:{marginBottom:10},children:"Order Details"}),a(Z,{columns:["Product","Price"],rows:[["Logo Design","1,200 SAR"],["Website Design","1,500 SAR"],["Website Development","900 SAR"],["Hosting","200 SAR"],["Social Media Management","700 SAR"]],end:["Total","5,330 SAR"]}),a(n,{align:"center",variant:"h4",fontWeight:400,style:{marginTop:10},children:"Billing Address"}),a(W,j(j({},l),{},{children:i("form",{onSubmit:u(e.handle),children:[a(G,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=d.password)||void 0===t?void 0:t.message}),a(G,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=d.password)||void 0===r?void 0:r.message}),a(s,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))]})};export{ee as ChargeWalletForm,re as CheckoutForm,Q as CreditCardForm,H as NewPasswordForm,te as PayWithWallet,V as ResetPasswordForm,Y as SelectPayment,_ as SignInForm,X as SignUpForm,F as UserProfileForm,$ 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 p from"@mui/material/Alert";import h 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 S from"@mui/icons-material/HttpsOutlined";import C 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){O(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 O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I(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 N(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 N(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 N(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}))},z=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 j=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})]}))},B=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(p,{severity:e.severity,children:[e.title&&l(h,{children:e.title}),e.text]})},F=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)}))})]})})},U=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(z,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(z,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(z,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(z,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(z,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})]})},D=function(r){var a=I(e(""),2);a[0],a[1];var o=I(e(""),2);o[0],o[1];var d=I(e(!1),2),s=d[0],u=d[1],m=w(),c=m.formState.errors,p=m.handleSubmit,h=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:p((function(e){console.log("handling subb",e),e.password===e.confirmPassword?r.handleNewPassword():u(!0)})),children:[l(P,{control:h,name:"password",render:function(e){var t,i,a=e.field;return l(z,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(S,{})})},a))},rules:{required:r.texts.passwordRequiredText}}),l(P,{control:h,name:"confirmPassword",render:function(e){var t,i,a=e.field;return l(z,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(S,{})})},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(z,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(C,{})})},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(p,{severity:"error",children:[e.errorTitle&&l(h,{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(z,{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(z,{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(C,{})})})},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(z,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(S,{})})},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(j,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&l(j,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&l(j,{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(p,{severity:"error",children:[e.errorTitle&&l(h,{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(z,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(C,{})})},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(z,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(S,{})})},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(j,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&l(j,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&l(j,{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(j,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&l(j,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&l(j,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&l(j,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&l(j,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&l(j,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&l(j,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};z.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(z,{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(z,{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=I(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(z,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,p,h,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:"h4",fontWeight:400,style:{marginBottom:10},children:e.texts.orderDetails}),l(F,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l(A,{variant:"middle"}),l(a,{align:"center",variant:"h4",fontWeight:400,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(z,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(z,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(z,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(z,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(z,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(z,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===(p=e.texts)||void 0===p?void 0:p.required},render:function(t){var r,i,a,n=t.field;return l(z,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===(h=e.texts)||void 0===h?void 0:h.required},render:function(t){var r,i,a,n=t.field;return l(z,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(B,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})]})}))]})};export{_ as ChargeWalletForm,J as CheckoutForm,V as CreditCardForm,D as NewPasswordForm,Y as PayWithWallet,Z as ResetPasswordForm,H as SelectPayment,$ as SignInForm,E as SignUpForm,U 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"),h=require("@mui/material/Alert"),x=require("@mui/material/AlertTitle"),p=require("@mui/material/Table"),f=require("@mui/material/TableBody"),g=require("@mui/material/TableCell"),v=require("@mui/material/TableContainer"),b=require("@mui/material/TableHead"),j=require("@mui/material/TableRow");require("@mui/material/Snackbar");var y=require("react-hook-form"),w=require("@mui/material/InputAdornment"),T=require("@mui/icons-material/HttpsOutlined"),P=require("@mui/icons-material/MailOutline"),C=require("@mui/icons-material/PermIdentityOutlined"),q=require("@mui/material/styles"),S=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 k=W(t),A=W(r),L=W(i),I=W(n),O=W(o),F=W(s),R=W(u),B=W(d),z=W(c),N=W(m),M=W(h),D=W(x),U=W(p),G=W(f),E=W(g),Z=W(v),$=W(b),H=W(j),_=W(w),V=W(T),X=W(P),Y=W(C),J=W(S);function K(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 Q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?K(Object(r),!0).forEach((function(t){ee(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ee(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function te(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 re(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 re(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 re(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}A.default.string,A.default.bool;var ae=function(e){return a.jsx(I.default,Q(Q({},e),{},{children:e.children}))},le=function(e){return a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[a.jsx(R.default,{children:e.label}),e.helperText&&a.jsx(l.Typography,{variant:"validation",children:e.helperText})]}),a.jsx(F.default,Q({disableUnderline:!0},e))]})};A.default.oneOf(["text","number","password"]),A.default.string;var ie=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(B.default,{});break;case"twitter":r=a.jsx(z.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(N.default,{})}return a.jsxs(k.default,Q(Q({},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})]}))},ne=function(e){return a.jsxs(M.default,{severity:e.severity,children:[e.title&&a.jsx(D.default,{children:e.title}),e.text]})},oe=function(e){return a.jsx(Z.default,{children:a.jsxs(U.default,{"aria-label":"a dense table",children:[a.jsx($.default,{children:a.jsx(H.default,{children:e.columns.map((function(e,t){return a.jsx(E.default,{style:{fontWeight:700},variant:0==t||"bordered",children:e})}))})}),a.jsx(G.default,{children:e.rows.map((function(e,t){return a.jsx(H.default,{children:e.map((function(e,t){return a.jsx(E.default,{component:"th",scope:"row",variant:0==t||"bordered",children:e},t)}))},t)}))}),e.end&&a.jsx(H.default,{children:e.end.map((function(e,t){return a.jsx(E.default,{style:{fontWeight:700},component:"th",scope:"row",variant:0==t||"bordered",children:e},t)}))})]})})},se=function(e){var t=y.useForm(),r=t.formState.errors,l=t.handleSubmit,i=t.control;return a.jsxs(O.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&a.jsxs(M.default,{severity:"error",children:[e.errorTitle&&a.jsx(D.default,{children:e.errorTitle}),e.errorText]}),a.jsx(y.FormProvider,Q(Q({},t),{},{children:a.jsxs("form",{onSubmit:l(e.handleSignUp),children:[a.jsx(y.Controller,{control:i,name:"fullName",render:function(t){var l,i,n=t.field;return a.jsx(le,{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(_.default,{position:"start",children:a.jsx(Y.default,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a.jsx(y.Controller,{control:i,name:"email",render:function(t){var l,i,n=t.field;return a.jsx(le,{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(_.default,{position:"start",children:a.jsx(X.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(y.Controller,{control:i,name:"password",render:function(t){var l,i,n,o=t.field;return a.jsx(le,Q({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(_.default,{position:"start",children:a.jsx(V.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(k.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),a.jsxs(I.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(ie,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a.jsx(ie,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a.jsx(ie,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};se.propTypes={theme:A.default.oneOf(["secondary","primary"])};le.propTypes={theme:A.default.oneOf(["secondary","primary"]),viaApplePay:A.default.bool,viaGooglePay:A.default.bool,viaSTCPay:A.default.bool,viaCreditCard:A.default.bool,viaPayPal:A.default.bool,handleApplePay:A.default.func};var ue=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},de=function(e){return ee({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)")})};q.styled("div")((function(e){var t=e.theme;return Q({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),q.styled(L.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return Q({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})})})),q.styled(J.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return Q(Q({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&Q(Q({},ue(t)),{},{"& .MuiDrawer-paper":ue(t)})),!r&&Q(Q({},de(t)),{},{"& .MuiDrawer-paper":de(t)}))}));exports.ChargeWalletForm=function(t){var r=te(e.useState(0),2),l=r[0],i=r[1],n=y.useForm();n.formState.errors;var o=n.handleSubmit,s=n.control;return a.jsxs(O.default,{maxWidth:"xs",children:[a.jsxs(I.default,{align:"center",variant:"h2",fontWeight:500,children:[Number(l).toLocaleString("en")||"0",a.jsx(I.default,{children:t.currency||"SAR"})]}),a.jsx(y.FormProvider,Q(Q({},n),{},{children:a.jsxs("form",{onSubmit:o(t.handleChargeWallet),children:[a.jsx(y.Controller,{control:s,name:"amount",render:function(e){var t,r=e.field;return a.jsx(le,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),i(e.target.value)}}))}}),a.jsx(k.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CheckoutForm=function(e){var t,r,i=y.useForm(),n=i.formState.errors,o=i.handleSubmit;return a.jsxs(l.Container,{maxWidth:"xs",children:[a.jsx(l.Typography,{align:"center",variant:"h4",fontWeight:400,style:{marginBottom:10},children:"Order Details"}),a.jsx(oe,{columns:["Product","Price"],rows:[["Logo Design","1,200 SAR"],["Website Design","1,500 SAR"],["Website Development","900 SAR"],["Hosting","200 SAR"],["Social Media Management","700 SAR"]],end:["Total","5,330 SAR"]}),a.jsx(l.Typography,{align:"center",variant:"h4",fontWeight:400,style:{marginTop:10},children:"Billing Address"}),a.jsx(y.FormProvider,Q(Q({},i),{},{children:a.jsxs("form",{onSubmit:o(e.handle),children:[a.jsx(le,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a.jsx(le,{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.CreditCardForm=function(e){var t,r,i=y.useForm(),n=i.formState.errors,o=i.handleSubmit;return a.jsx(l.Container,{maxWidth:"xs",children:a.jsx(y.FormProvider,Q(Q({},i),{},{children:a.jsxs("form",{onSubmit:o(e.handle),children:[a.jsx(le,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a.jsx(le,{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=te(e.useState(""),2);r[0],r[1];var l=te(e.useState(""),2);l[0],l[1];var i=te(e.useState(!1),2),n=i[0],o=i[1],s=y.useForm(),u=s.formState.errors,d=s.handleSubmit,c=s.control;return a.jsxs(O.default,{maxWidth:"xs",variant:"auth",children:[n&&a.jsx(ne,{text:t.texts.passwordMatchError,severity:"error"}),t.passwordChanged?a.jsx(ae,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a.jsx(y.FormProvider,Q(Q({},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(y.Controller,{control:c,name:"password",render:function(e){var r,l,i=e.field;return a.jsx(le,Q({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(_.default,{position:"start",children:a.jsx(V.default,{})})},i))},rules:{required:t.texts.passwordRequiredText}}),a.jsx(y.Controller,{control:c,name:"confirmPassword",render:function(e){var r,l,i=e.field;return a.jsx(le,Q({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(_.default,{position:"start",children:a.jsx(V.default,{})})},i))},rules:{required:t.texts.confirmPasswordRequiredText}}),a.jsx(k.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=y.useForm(),l=r.formState.errors,i=r.handleSubmit;r.register;var n=r.control;return a.jsxs(O.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(ae,{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(y.Controller,{control:n,name:"email",render:function(t){var r,i,n=t.field;return a.jsx(le,Q({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(_.default,{position:"start",children:a.jsx(X.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(k.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(ae,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(ie,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(ie,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a.jsx(ie,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a.jsx(ie,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(ie,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(ie,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(ie,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t=y.useForm(),r=t.formState.errors,l=t.handleSubmit;t.register;var i=t.control;return a.jsxs(O.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&a.jsxs(M.default,{severity:"error",children:[e.errorTitle&&a.jsx(D.default,{children:e.errorTitle}),e.errorText]}),a.jsxs("form",{onSubmit:l(e.handleSignIn),children:[a.jsx(y.Controller,{control:i,name:"email",render:function(t){var l,i,n=t.field;return a.jsx(le,Q({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(_.default,{position:"start",children:a.jsx(X.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(y.Controller,{control:i,name:"password",render:function(t){var l,i,n,o=t.field;return a.jsx(le,Q({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(_.default,{position:"start",children:a.jsx(V.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(I.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a.jsx(k.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),a.jsxs(I.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(ie,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(ie,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(ie,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=se,exports.UserProfileForm=function(e){var t=y.useForm(),r=t.formState.errors,l=t.handleSubmit,i=t.control;return a.jsx(O.default,{maxWidth:"sm",children:a.jsx(y.FormProvider,Q(Q({},t),{},{children:a.jsxs("form",{onSubmit:l(e.handleUpdateProfile),children:[a.jsx(y.Controller,{control:i,name:"fullName",render:function(t){var l,i,n=t.field;return a.jsx(le,Q({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(y.Controller,{control:i,name:"phoneNumber",render:function(e){var t=e.field;return a.jsx(le,Q({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),a.jsx(y.Controller,{control:i,name:"email",render:function(t){var l,i,n=t.field;return a.jsx(le,Q({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(y.Controller,{control:i,name:"password",render:function(t){var l,i,n=t.field;return a.jsx(le,Q({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(y.Controller,{control:i,name:"confirmPassword",render:function(t){var l,i,n=t.field;return a.jsx(le,Q({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(k.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"),x=require("@mui/material/Select"),c=require("@mui/material/Alert"),m=require("@mui/material/AlertTitle"),h=require("@mui/material/Table"),v=require("@mui/material/TableBody"),f=require("@mui/material/TableCell"),p=require("@mui/material/TableContainer"),g=require("@mui/material/TableHead"),b=require("@mui/material/TableRow");require("@mui/material/Snackbar");var j=require("react-hook-form"),y=require("@mui/material/InputAdornment"),w=require("@mui/icons-material/HttpsOutlined"),T=require("@mui/icons-material/MailOutline"),q=require("@mui/icons-material/PermIdentityOutlined"),P=require("@mui/material/Divider");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=C(t),W=C(r),k=C(a),A=C(i),L=C(n),F=C(o),O=C(s),I=C(d),N=C(u),R=C(x),z=C(c),B=C(m),U=C(h),G=C(v),M=C(f),D=C(p),Z=C(g),E=C(b),$=C(y),_=C(w),H=C(T),V=C(q),Y=C(P);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}W.default.string,W.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))]})};W.default.oneOf(["text","number","password"]),W.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(O.default,{});break;case"twitter":r=l.jsx(I.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(N.default,{})}return l.jsxs(S.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(z.default,{severity:e.severity,children:[e.title&&l.jsx(B.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=j.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(z.default,{severity:"error",children:[e.errorTitle&&l.jsx(B.default,{children:e.errorTitle}),e.errorText]}),l.jsx(j.FormProvider,K(K({},t),{},{children:l.jsxs("form",{onSubmit:a(e.handleSignUp),children:[l.jsx(j.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(j.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(H.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(j.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(_.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),l.jsx(S.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:W.default.oneOf(["secondary","primary"])};re.propTypes={theme:W.default.oneOf(["secondary","primary"]),viaApplePay:W.default.bool,viaGooglePay:W.default.bool,viaSTCPay:W.default.bool,viaCreditCard:W.default.bool,viaPayPal:W.default.bool,handleApplePay:W.default.func};exports.ChargeWalletForm=function(t){var r=X(e.useState(0),2),a=r[0],i=r[1],n=j.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(j.FormProvider,K(K({},n),{},{children:l.jsxs("form",{onSubmit:o(t.handleChargeWallet),children:[l.jsx(j.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(S.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,x,c="ar"===e.lang,m=j.useForm(),h=m.formState.errors,v=m.handleSubmit;m.register;var f=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:c?"rtl":"ltr"},children:[l.jsx(k.default,{align:"center",variant:"h4",fontWeight:400,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:"h4",fontWeight:400,style:{marginBottom:10},children:e.texts.billingAddress}),l.jsx(j.FormProvider,K(K({},m),{},{children:l.jsxs("form",{onSubmit:v(e.handlePayNow),children:[l.jsxs(A.default,{sx:p,children:[l.jsx(j.Controller,{control:f,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(j.Controller,{control:f,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(j.Controller,{control:f,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(j.Controller,{control:f,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(j.Controller,{control:f,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(j.Controller,{control:f,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(j.Controller,{control:f,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(j.Controller,{control:f,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(j.Controller,{control:f,name:"country",rules:{required:null===(x=e.texts)||void 0===x?void 0:x.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(S.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.payNow})]})}))]})},exports.CreditCardForm=function(e){var t,r,a=j.useForm(),i=a.formState.errors,n=a.handleSubmit;return l.jsx(A.default,{maxWidth:"xs",children:l.jsx(j.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(S.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=j.useForm(),d=s.formState.errors,u=s.handleSubmit,x=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(j.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(j.Controller,{control:x,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(_.default,{})})},i))},rules:{required:t.texts.passwordRequiredText}}),l.jsx(j.Controller,{control:x,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(_.default,{})})},i))},rules:{required:t.texts.confirmPasswordRequiredText}}),l.jsx(S.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(S.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t,r=j.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(j.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(H.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(S.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=j.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(z.default,{severity:"error",children:[e.errorTitle&&l.jsx(B.default,{children:e.errorTitle}),e.errorText]}),l.jsxs("form",{onSubmit:a(e.handleSignIn),children:[l.jsx(j.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(H.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(j.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(_.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(S.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=j.useForm(),r=t.formState.errors,a=t.handleSubmit,i=t.control;return l.jsx(A.default,{maxWidth:"sm",children:l.jsx(j.FormProvider,K(K({},t),{},{children:l.jsxs("form",{onSubmit:a(e.handleUpdateProfile),children:[l.jsx(j.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(j.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(j.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(j.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(j.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(S.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(S.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.19",
3
+ "version": "0.0.20",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -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>
@@ -1,95 +1,241 @@
1
- import React from "react";
2
- import {
3
- HawaTextField,
4
- ActionButton,
5
- HawaTypography,
6
- HawaTable
7
- } from "../../elements";
8
- import { Box } from "../../layout";
9
- import { FormProvider, useForm } from "react-hook-form";
10
- import { Button, Container, Typography } from "@mui/material";
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";
11
8
 
12
9
  export const CheckoutForm = (props) => {
10
+ let isArabic = props.lang === "ar";
13
11
  const methods = useForm();
14
12
  const {
15
13
  formState: { errors },
16
- handleSubmit
14
+ handleSubmit,
15
+ register,
16
+ control
17
17
  } = methods;
18
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
+ };
19
32
  return (
20
- <Container maxWidth="xs">
33
+ <Container maxWidth="sm" style={{ direction: isArabic ? "rtl" : "ltr" }}>
21
34
  <Typography
22
35
  align="center"
23
36
  variant="h4"
24
37
  fontWeight={400}
25
38
  style={{ marginBottom: 10 }}
26
39
  >
27
- Order Details
40
+ {props.texts.orderDetails}
28
41
  </Typography>
29
42
  <HawaTable
43
+ lang={props.lang}
30
44
  columns={["Product", "Price"]}
31
- rows={[
32
- ["Logo Design", "1,200 SAR"],
33
- ["Website Design", "1,500 SAR"],
34
- ["Website Development", "900 SAR"],
35
- ["Hosting", "200 SAR"],
36
- ["Social Media Management", "700 SAR"]
37
- ]}
38
- end={["Total", "5,330 SAR"]}
45
+ rows={props.products}
46
+ end={["Total", props.total]}
39
47
  />
48
+ <Divider variant="middle" />
49
+
40
50
  <Typography
41
51
  align="center"
42
52
  variant="h4"
43
53
  fontWeight={400}
44
- style={{ marginTop: 10 }}
54
+ style={{ marginBottom: 10 }}
45
55
  >
46
- Billing Address
56
+ {props.texts.billingAddress}
47
57
  </Typography>
48
58
  <FormProvider {...methods}>
49
- <form onSubmit={handleSubmit(props.handle)}>
50
- <HawaTextField
51
- fullWidth
52
- name="password"
53
- placeholder="Enter password"
54
- type="tel"
55
- label="Card Number"
56
- // variant="unscrollable"
57
- // startAdornment={
58
- // <InputAdornment position="start">
59
- // <PasswordIcon />
60
- // </InputAdornment>
61
- // }
62
- rules={{
63
- required: "Password is rquired"
64
- }}
65
- helperText={errors.password?.message}
66
- />
59
+ <form onSubmit={handleSubmit(props.handlePayNow)}>
60
+ <Container sx={containerStyle}>
61
+ <Controller
62
+ control={control}
63
+ name="firstName"
64
+ rules={{ required: props.texts?.required }}
65
+ render={({ field }) => (
66
+ <HawaTextField
67
+ inForm
68
+ fullWidth
69
+ type="text"
70
+ value={field.value ?? ""}
71
+ label={props.texts?.firstNameLabel + " *"}
72
+ helperText={errors.firstName?.message}
73
+ {...field}
74
+ />
75
+ )}
76
+ />
77
+ <div style={{ width: 20 }} />
67
78
 
68
- <HawaTextField
69
- fullWidth
70
- name="password"
71
- placeholder="Enter password"
72
- type="password"
73
- label="Name On Card"
74
- // startAdornment={
75
- // <InputAdornment position="start">
76
- // <PasswordIcon />
77
- // </InputAdornment>
78
- // }
79
+ <Controller
80
+ control={control}
81
+ name="lastName"
82
+ rules={{ required: props.texts?.required }}
83
+ render={({ field }) => (
84
+ <HawaTextField
85
+ inForm
86
+ fullWidth
87
+ type="text"
88
+ value={field.value ?? ""}
89
+ label={props.texts?.lastNameLabel + " *"}
90
+ helperText={errors.lastName?.message}
91
+ {...field}
92
+ />
93
+ )}
94
+ />
95
+ </Container>
96
+ <Controller
97
+ control={control}
98
+ name="email"
99
+ render={({ field }) => (
100
+ <HawaTextField
101
+ inForm
102
+ fullWidth
103
+ type="text"
104
+ value={field.value ?? ""}
105
+ label={props.texts?.emailLabel + " *"}
106
+ helperText={errors.email?.message}
107
+ {...field}
108
+ />
109
+ )}
79
110
  rules={{
80
- required: "Password is rquired"
111
+ required: props.texts?.emailRequiredText,
112
+ pattern: {
113
+ value:
114
+ /^(([^<>()[\]\\.,;:\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,}))$/,
115
+ message: props.texts?.emailInvalidText
116
+ }
81
117
  }}
82
- helperText={errors.password?.message}
83
118
  />
84
119
 
85
- <Button
86
- type="submit"
87
- fullWidth
88
- variant="last"
89
- onClick={props.handlePayWithCreditCard}
90
- >
91
- {/* {props.texts.signInText} */}
92
- {"Pay with Credit Card"}
120
+ <Container sx={containerStyle}>
121
+ <Controller
122
+ control={control}
123
+ name="streetAddress"
124
+ rules={{ required: props.texts?.required }}
125
+ render={({ field }) => (
126
+ <HawaTextField
127
+ inForm
128
+ fullWidth
129
+ type="text"
130
+ value={field.value ?? ""}
131
+ label={props.texts?.streetAddressLabel + " *"}
132
+ helperText={errors.streetAddress?.message}
133
+ {...field}
134
+ />
135
+ )}
136
+ />
137
+ <div style={{ width: 20 }} />
138
+
139
+ <Controller
140
+ control={control}
141
+ name="buildingNumber"
142
+ rules={{ required: props.texts?.required }}
143
+ render={({ field }) => (
144
+ <HawaTextField
145
+ inForm
146
+ fullWidth
147
+ type="text"
148
+ value={field.value ?? ""}
149
+ label={props.texts?.buildingNumberLabel + " *"}
150
+ helperText={errors.buildingNumber?.message}
151
+ {...field}
152
+ />
153
+ )}
154
+ />
155
+ </Container>
156
+ <Container sx={containerStyle}>
157
+ <Controller
158
+ control={control}
159
+ name="province"
160
+ rules={{ required: props.texts?.required }}
161
+ render={({ field }) => (
162
+ <HawaTextField
163
+ inForm
164
+ fullWidth
165
+ type="text"
166
+ value={field.value ?? ""}
167
+ label={props.texts?.stateLabel + " *"}
168
+ helperText={errors.province?.message}
169
+ {...field}
170
+ />
171
+ )}
172
+ />
173
+ <div style={{ width: 20 }} />
174
+
175
+ <Controller
176
+ control={control}
177
+ name="city"
178
+ rules={{ required: props.texts?.required }}
179
+ render={({ field }) => (
180
+ <HawaTextField
181
+ inForm
182
+ fullWidth
183
+ type="text"
184
+ value={field.value ?? ""}
185
+ label={props.texts?.cityLabel + " *"}
186
+ helperText={errors.city?.message}
187
+ {...field}
188
+ />
189
+ )}
190
+ />
191
+ </Container>
192
+ <Container sx={containerStyle}>
193
+ <Controller
194
+ control={control}
195
+ name="zipCode"
196
+ rules={{ required: props.texts?.required }}
197
+ render={({ field }) => (
198
+ <HawaTextField
199
+ inForm
200
+ fullWidth
201
+ type="number"
202
+ variant="unscrollable"
203
+ value={field.value ?? ""}
204
+ label={props.texts?.zipCodeLabel + " *"}
205
+ helperText={errors.zipCode?.message}
206
+ {...field}
207
+ />
208
+ )}
209
+ />
210
+ <div style={{ width: 20 }} />
211
+
212
+ <Controller
213
+ control={control}
214
+ name="country"
215
+ rules={{ required: props.texts?.required }}
216
+ render={({ field }) => (
217
+ <HawaSelect
218
+ fullWidth
219
+ native
220
+ label={props.texts?.countryLabel + " *"}
221
+ variant="standard"
222
+ value={field.value ?? ""}
223
+ helperText={errors.country?.message}
224
+ displayEmpty
225
+ disableUnderline
226
+ validators={["required"]}
227
+ {...field}
228
+ >
229
+ <option></option>
230
+ {props.countriesList.map((country, i) => (
231
+ <option key={i}>{country}</option>
232
+ ))}
233
+ </HawaSelect>
234
+ )}
235
+ />
236
+ </Container>
237
+ <Button type="submit" fullWidth variant="last">
238
+ {props.texts.payNow}
93
239
  </Button>
94
240
  </form>
95
241
  </FormProvider>