@sikka/hawa 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 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};
1
+ import{useState as e}from"react";import t from"@mui/material/Button";import"@mui/material/Tooltip";import r from"prop-types";import{jsx as l,jsxs as i}from"react/jsx-runtime";import"@mui/material/ListItemButton";import"@mui/material/ListItemText";import"@mui/icons-material/MoveToInbox";import"@mui/material/AppBar";import"@mui/material/Box";import"@mui/material/Toolbar";import"@mui/material/IconButton";import a from"@mui/material/Typography";import"@mui/material/Menu";import"@mui/icons-material/Menu";import n from"@mui/material/Container";import"@mui/material/Avatar";import"@mui/material/MenuItem";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import"@mui/icons-material/CheckCircleOutlined";import o from"@mui/material/Input";import d from"@mui/material/InputLabel";import"@mui/material/Switch";import s from"@mui/icons-material/GitHub";import u from"@mui/icons-material/Twitter";import m from"@mui/icons-material/AccountBalanceWallet";import c from"@mui/material/Select";import h from"@mui/material/Alert";import p from"@mui/material/AlertTitle";import v from"@mui/material/Table";import f from"@mui/material/TableBody";import g from"@mui/material/TableCell";import x from"@mui/material/TableContainer";import b from"@mui/material/TableHead";import y from"@mui/material/TableRow";import"@mui/material/Snackbar";import{useForm as w,FormProvider as T,Controller as P}from"react-hook-form";import W from"@mui/material/InputAdornment";import C from"@mui/icons-material/HttpsOutlined";import S from"@mui/icons-material/MailOutline";import k from"@mui/icons-material/PermIdentityOutlined";import A from"@mui/material/Divider";function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,l)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var l,i,a=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(l=r.next()).done)&&(a.push(l.value),!t||a.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw i}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,l=new Array(t);r<t;r++)l[r]=e[r];return l}r.string,r.bool;var R=function(e){return l(a,q(q({},e),{},{children:e.children}))},B=function(e){return i("div",{style:e.inForm&&{width:"100%"},children:[i("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.label&&l(d,{children:e.label}),e.helperText&&l(a,{variant:"validation",children:e.helperText})]}),l(o,q({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var z=function(e){var r,n="";switch(null===(r=e.logo)||void 0===r?void 0:r.toLowerCase()){case"google":n=l("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":n=l(s,{});break;case"twitter":n=l(u,{});break;case"mada":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":n=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":n=l(m,{})}return i(t,q(q({},e),{},{variant:"withLogo",children:[n,l("div",{style:{width:10}}),l(a,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},j=function(e){return i("div",{style:{width:"100%"},children:[i("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[l(d,{children:e.label}),e.helperText&&l(a,{variant:"validation",children:e.helperText})]}),l(c,q(q({},e),{},{children:e.children}))]})},G=function(e){return i(h,{severity:e.severity,children:[e.title&&l(p,{children:e.title}),e.text]})},D=function(e){var t="ar"===e.lang;return l(x,{style:{direction:t?"rtl":"ltr"},children:i(v,{"aria-label":"a dense table",children:[l(b,{children:l(y,{children:e.columns.map((function(e,r){return l(g,{align:t?"right":"left",style:{fontWeight:700},variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})}),l(f,{children:e.rows.map((function(e,r){return l(y,{children:e.map((function(e,r){return l(g,{align:t?"right":"left",component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))},r)}))}),e.end&&l(y,{children:e.end.map((function(e,r){return l(g,{align:t?"right":"left",style:{fontWeight:700},component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})]})})},F=function(e){var r=w(),a=r.formState.errors,o=r.handleSubmit,d=r.control;return l(n,{maxWidth:"sm",children:l(T,q(q({},r),{},{children:i("form",{onSubmit:o(e.handleUpdateProfile),children:[l(P,{control:d,name:"fullName",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=a.fullName)||void 0===i?void 0:i.message},n))}}),l(P,{control:d,name:"phoneNumber",render:function(e){var t=e.field;return l(B,q({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),l(P,{control:d,name:"email",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=a.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l(P,{control:d,name:"password",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=a.password)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.passwordRequiredText}}),l(P,{control:d,name:"confirmPassword",render:function(t){var r,i,n=t.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(i=a.confirmPassword)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.confirmPasswordRequiredText}}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},M=function(e){return i(n,{maxWidth:"sm",children:[e.children,l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})},U=function(r){var a=O(e(""),2);a[0],a[1];var o=O(e(""),2);o[0],o[1];var d=O(e(!1),2),s=d[0],u=d[1],m=w(),c=m.formState.errors,h=m.handleSubmit,p=m.control;return i(n,{maxWidth:"xs",variant:"auth",children:[s&&l(G,{text:r.texts.passwordMatchError,severity:"error"}),r.passwordChanged?l(R,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):l(T,q(q({},m),{},{children:i("form",{onSubmit:h((function(e){console.log("handling subb",e),e.password===e.confirmPassword?r.handleNewPassword():u(!0)})),children:[l(P,{control:p,name:"password",render:function(e){var t,i,a=e.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(t=a.value)&&void 0!==t?t:"",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,helperText:null===(i=c.password)||void 0===i?void 0:i.message,startAdornment:l(W,{position:"start",children:l(C,{})})},a))},rules:{required:r.texts.passwordRequiredText}}),l(P,{control:p,name:"confirmPassword",render:function(e){var t,i,a=e.field;return l(B,q({fullWidth:!0,type:"password",value:null!==(t=a.value)&&void 0!==t?t:"",label:r.texts.confirmPasswordLabel,placeholder:r.texts.confirmPasswordPlaceholder,helperText:null===(i=c.confirmPassword)||void 0===i?void 0:i.message,startAdornment:l(W,{position:"start",children:l(C,{})})},a))},rules:{required:r.texts.confirmPasswordRequiredText}}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},Z=function(e){var r,a=w(),o=a.formState.errors,d=a.handleSubmit;a.register;var s=a.control;return i(n,{maxWidth:"xs",variant:"auth",children:[e.error&&i(Alert,{severity:"error",children:[e.errorTitle&&l(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?l(R,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):i("form",{onSubmit:d(e.handleResetPassword),children:[console.log("eror ",null===(r=o.email)||void 0===r?void 0:r.message),l(P,{control:s,name:"email",render:function(t){var r,i,a=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=o.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l(W,{position:"start",children:l(S,{})})},a))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},E=function(e){var r=w(),o=r.formState.errors,d=r.handleSubmit,s=r.control;return i(n,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&i(h,{severity:"error",children:[e.errorTitle&&l(p,{children:e.errorTitle}),e.errorText]}),l(T,q(q({},r),{},{children:i("form",{onSubmit:d(e.handleSignUp),children:[l(P,{control:s,name:"fullName",render:function(t){var r,i,a=t.field;return l(B,{fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=o.fullName)||void 0===i?void 0:i.message,startAdornment:l(W,{position:"start",children:l(k,{})})})},rules:{required:e.texts.fullNameRequiredText}}),l(P,{control:s,name:"email",render:function(t){var r,i,a=t.field;return l(B,{fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=o.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l(W,{position:"start",children:l(S,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l(P,{control:s,name:"password",render:function(t){var r,i,a,n=t.field;return l(B,q({fullWidth:!0,type:"password",defaultValue:null!==(r=n.value)&&void 0!==r?r:"",value:null!==(i=n.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(a=o.password)||void 0===a?void 0:a.message,startAdornment:l(W,{position:"start",children:l(C,{})})},n))},rules:{required:e.texts.passwordRequiredText}}),l(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),i(a,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",l("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),l(A,{}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l(z,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&l(z,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&l(z,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};E.propTypes={theme:r.oneOf(["secondary","primary"])};var $=function(e){var r=w(),o=r.formState.errors,d=r.handleSubmit;r.register;var s=r.control;return i(n,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&i(h,{severity:"error",children:[e.errorTitle&&l(p,{children:e.errorTitle}),e.errorText]}),i("form",{onSubmit:d(e.handleSignIn),children:[l(P,{control:s,name:"email",render:function(t){var r,i,a=t.field;return l(B,q({fullWidth:!0,type:"text",value:null!==(r=a.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=o.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l(W,{position:"start",children:l(S,{})})},a))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l(P,{control:s,name:"password",render:function(t){var r,i,a,n=t.field;return l(B,q({fullWidth:!0,type:"password",defaultValue:null!==(r=n.value)&&void 0!==r?r:"",value:null!==(i=n.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(a=o.password)||void 0===a?void 0:a.message,startAdornment:l(W,{position:"start",children:l(C,{})})},n))},rules:{required:e.texts.passwordRequiredText}}),l(a,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),i(a,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",l("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),l(A,{}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l(z,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&l(z,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&l(z,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},H=function(e){return i(n,{maxWidth:"xs",children:[l(R,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&l(z,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&l(z,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&l(z,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&l(z,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&l(z,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&l(z,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&l(z,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};B.propTypes={theme:r.oneOf(["secondary","primary"]),viaApplePay:r.bool,viaGooglePay:r.bool,viaSTCPay:r.bool,viaCreditCard:r.bool,viaPayPal:r.bool,handleApplePay:r.func};var V=function(e){var r,a,o=w(),d=o.formState.errors,s=o.handleSubmit;return l(n,{maxWidth:"xs",children:l(T,q(q({},o),{},{children:i("form",{onSubmit:s(e.handle),children:[l(B,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(r=d.password)||void 0===r?void 0:r.message}),l(B,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(a=d.password)||void 0===a?void 0:a.message}),l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},_=function(r){var o=O(e(0),2),d=o[0],s=o[1],u=w();u.formState.errors;var m=u.handleSubmit,c=u.control;return i(n,{maxWidth:"xs",children:[i(a,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(d).toLocaleString("en")||"0",l(a,{children:r.currency||"SAR"})]}),l(T,q(q({},u),{},{children:i("form",{onSubmit:m(r.handleChargeWallet),children:[l(P,{control:c,name:"amount",render:function(e){var t,r=e.field;return l(B,q(q({fullWidth:!0,placeholder:"Enter amount",type:"number",value:null!==(t=r.value)&&void 0!==t?t:""},r),{},{inputProps:{inputMode:"numeric",min:"0",max:"9999999",step:"0.01"},onChange:function(e){r.onChange(parseFloat(e.target.value)),console.log("e",e.target.value),s(e.target.value)}}))}}),l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:r.handleSignIn,children:"Charge Wallet"})]})}))]})},Y=function(e){return i(n,{maxWidth:"xs",children:[l(a,{align:"center",children:"Wallet Balance"}),i(a,{align:"center",variant:"h1",children:[e.walletBalance||"0",l(a,{children:e.currency||"SAR"})]}),l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},J=function(e){var r,o,d,s,u,m,c,h,p,v,f="ar"===e.lang,g=w(),x=g.formState.errors,b=g.handleSubmit;g.register;var y=g.control,W={display:"flex",padding:0,paddingRight:"0px !important",paddingLeft:"0px !important",flexDirection:{xs:"column",sm:"row",md:"row",lg:"row",xl:"row"}};return i(n,{maxWidth:"sm",style:{direction:f?"rtl":"ltr"},children:[l(a,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l(D,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l(A,{variant:"middle"}),l(a,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.billingAddress}),l(T,q(q({},g),{},{children:i("form",{onSubmit:b(e.handlePayNow),children:[i(n,{sx:W,children:[l(P,{control:y,name:"firstName",rules:{required:null===(r=e.texts)||void 0===r?void 0:r.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.firstNameLabel)+" *",helperText:null===(a=x.firstName)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"lastName",rules:{required:null===(o=e.texts)||void 0===o?void 0:o.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.lastNameLabel)+" *",helperText:null===(a=x.lastName)||void 0===a?void 0:a.message},n))}})]}),l(P,{control:y,name:"email",render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.emailLabel)+" *",helperText:null===(a=x.email)||void 0===a?void 0:a.message},n))},rules:{required:null===(d=e.texts)||void 0===d?void 0:d.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:null===(s=e.texts)||void 0===s?void 0:s.emailInvalidText}}}),i(n,{sx:W,children:[l(P,{control:y,name:"streetAddress",rules:{required:null===(u=e.texts)||void 0===u?void 0:u.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.streetAddressLabel)+" *",helperText:null===(a=x.streetAddress)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"buildingNumber",rules:{required:null===(m=e.texts)||void 0===m?void 0:m.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.buildingNumberLabel)+" *",helperText:null===(a=x.buildingNumber)||void 0===a?void 0:a.message},n))}})]}),i(n,{sx:W,children:[l(P,{control:y,name:"province",rules:{required:null===(c=e.texts)||void 0===c?void 0:c.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.stateLabel)+" *",helperText:null===(a=x.province)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"city",rules:{required:null===(h=e.texts)||void 0===h?void 0:h.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.cityLabel)+" *",helperText:null===(a=x.city)||void 0===a?void 0:a.message},n))}})]}),i(n,{sx:W,children:[l(P,{control:y,name:"zipCode",rules:{required:null===(p=e.texts)||void 0===p?void 0:p.required},render:function(t){var r,i,a,n=t.field;return l(B,q({inForm:!0,fullWidth:!0,type:"number",variant:"unscrollable",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.zipCodeLabel)+" *",helperText:null===(a=x.zipCode)||void 0===a?void 0:a.message},n))}}),l("div",{style:{width:20}}),l(P,{control:y,name:"country",rules:{required:null===(v=e.texts)||void 0===v?void 0:v.required},render:function(t){var r,a,n,o=t.field;return i(j,q(q({fullWidth:!0,native:!0,label:(null===(r=e.texts)||void 0===r?void 0:r.countryLabel)+" *",variant:"standard",value:null!==(a=o.value)&&void 0!==a?a:"",helperText:null===(n=x.country)||void 0===n?void 0:n.message,displayEmpty:!0,disableUnderline:!0,validators:["required"]},o),{},{children:[l("option",{}),e.countriesList.map((function(e,t){return l("option",{children:e},t)}))]}))}})]}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.payNow})]})}))]})},K=function(e){var r="ar"===e.lang,o=w();return o.formState.errors,o.handleSubmit,o.register,o.control,i("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[i(n,{maxWidth:"sm",style:{direction:r?"rtl":"ltr"},children:[l(a,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),l(A,{variant:"middle"}),i(a,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",l("strong",{children:e.userEmail})]}),l(a,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),l(a,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),l(A,{variant:"middle"}),l(a,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l(D,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l(A,{variant:"middle"}),l(t,{onClick:e.handlePrint,variant:"contained",children:e.texts.print}),l(t,{onClick:e.handleHistory,variant:"last",children:e.texts.history}),l(t,{onClick:e.handleHome,variant:"last",children:e.texts.homePage}),l(a,{align:"center",variant:"body2",style:{marginTop:10},children:e.texts.fasterPaymentNote})]}),l("a",{style:{marginTop:10,paddingTop:10,padding:5,cursor:"pointer"},onClick:e.handleRefundPolicyLink,children:l(a,{align:"center",variant:"caption",fontWeight:500,children:e.texts.refundPolicy})})]})};export{_ as ChargeWalletForm,J as CheckoutForm,K as ConfirmationPage,V as CreditCardForm,U as NewPasswordForm,Y as PayWithWallet,Z as ResetPasswordForm,H as SelectPayment,$ as SignInForm,E as SignUpForm,F as UserProfileForm,M as UserSettingsForm};
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),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})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),l=require("react/jsx-runtime");require("@mui/material/ListItemButton"),require("@mui/material/ListItemText"),require("@mui/icons-material/MoveToInbox"),require("@mui/material/AppBar"),require("@mui/material/Box"),require("@mui/material/Toolbar"),require("@mui/material/IconButton");var a=require("@mui/material/Typography");require("@mui/material/Menu"),require("@mui/icons-material/Menu");var i=require("@mui/material/Container");require("@mui/material/Avatar"),require("@mui/material/MenuItem"),require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox"),require("@mui/icons-material/CheckCircleOutlined");var n=require("@mui/material/Input"),o=require("@mui/material/InputLabel");require("@mui/material/Switch");var s=require("@mui/icons-material/GitHub"),d=require("@mui/icons-material/Twitter"),u=require("@mui/icons-material/AccountBalanceWallet"),c=require("@mui/material/Select"),x=require("@mui/material/Alert"),m=require("@mui/material/AlertTitle"),h=require("@mui/material/Table"),f=require("@mui/material/TableBody"),v=require("@mui/material/TableCell"),p=require("@mui/material/TableContainer"),g=require("@mui/material/TableHead"),j=require("@mui/material/TableRow");require("@mui/material/Snackbar");var b=require("react-hook-form"),y=require("@mui/material/InputAdornment"),w=require("@mui/icons-material/HttpsOutlined"),T=require("@mui/icons-material/MailOutline"),P=require("@mui/icons-material/PermIdentityOutlined"),q=require("@mui/material/Divider");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var W=C(t),S=C(r),k=C(a),A=C(i),L=C(n),F=C(o),N=C(s),O=C(d),I=C(u),R=C(c),B=C(x),z=C(m),U=C(h),G=C(f),M=C(v),D=C(p),Z=C(g),E=C(j),$=C(y),H=C(w),_=C(T),V=C(P),Y=C(q);function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,l)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?J(Object(r),!0).forEach((function(t){Q(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var l,a,i=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(l=r.next()).done)&&(i.push(l.value),!t||i.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw a}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ee(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,l=new Array(t);r<t;r++)l[r]=e[r];return l}S.default.string,S.default.bool;var te=function(e){return l.jsx(k.default,K(K({},e),{},{children:e.children}))},re=function(e){return l.jsxs("div",{style:e.inForm&&{width:"100%"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.label&&l.jsx(F.default,{children:e.label}),e.helperText&&l.jsx(k.default,{variant:"validation",children:e.helperText})]}),l.jsx(L.default,K({disableUnderline:!0},e))]})};S.default.oneOf(["text","number","password"]),S.default.string;var le=function(e){var t,r="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":r=l.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":r=l.jsx(N.default,{});break;case"twitter":r=l.jsx(O.default,{});break;case"mada":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":r=l.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":r=l.jsx(I.default,{})}return l.jsxs(W.default,K(K({},e),{},{variant:"withLogo",children:[r,l.jsx("div",{style:{width:10}}),l.jsx(k.default,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},ae=function(e){return l.jsxs("div",{style:{width:"100%"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[l.jsx(F.default,{children:e.label}),e.helperText&&l.jsx(k.default,{variant:"validation",children:e.helperText})]}),l.jsx(R.default,K(K({},e),{},{children:e.children}))]})},ie=function(e){return l.jsxs(B.default,{severity:e.severity,children:[e.title&&l.jsx(z.default,{children:e.title}),e.text]})},ne=function(e){var t="ar"===e.lang;return l.jsx(D.default,{style:{direction:t?"rtl":"ltr"},children:l.jsxs(U.default,{"aria-label":"a dense table",children:[l.jsx(Z.default,{children:l.jsx(E.default,{children:e.columns.map((function(e,r){return l.jsx(M.default,{align:t?"right":"left",style:{fontWeight:700},variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})}),l.jsx(G.default,{children:e.rows.map((function(e,r){return l.jsx(E.default,{children:e.map((function(e,r){return l.jsx(M.default,{align:t?"right":"left",component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))},r)}))}),e.end&&l.jsx(E.default,{children:e.end.map((function(e,r){return l.jsx(M.default,{align:t?"right":"left",style:{fontWeight:700},component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})]})})},oe=function(e){var t=b.useForm(),r=t.formState.errors,a=t.handleSubmit,i=t.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&l.jsxs(B.default,{severity:"error",children:[e.errorTitle&&l.jsx(z.default,{children:e.errorTitle}),e.errorText]}),l.jsx(b.FormProvider,K(K({},t),{},{children:l.jsxs("form",{onSubmit:a(e.handleSignUp),children:[l.jsx(b.Controller,{control:i,name:"fullName",render:function(t){var a,i,n=t.field;return l.jsx(re,{fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=r.fullName)||void 0===i?void 0:i.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(V.default,{})})})},rules:{required:e.texts.fullNameRequiredText}}),l.jsx(b.Controller,{control:i,name:"email",render:function(t){var a,i,n=t.field;return l.jsx(re,{fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(_.default,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(b.Controller,{control:i,name:"password",render:function(t){var a,i,n,o=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",defaultValue:null!==(a=o.value)&&void 0!==a?a:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),l.jsx(W.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),l.jsxs(k.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",l.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),l.jsx(Y.default,{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l.jsx(le,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&l.jsx(le,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&l.jsx(le,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};oe.propTypes={theme:S.default.oneOf(["secondary","primary"])};re.propTypes={theme:S.default.oneOf(["secondary","primary"]),viaApplePay:S.default.bool,viaGooglePay:S.default.bool,viaSTCPay:S.default.bool,viaCreditCard:S.default.bool,viaPayPal:S.default.bool,handleApplePay:S.default.func};exports.ChargeWalletForm=function(t){var r=X(e.useState(0),2),a=r[0],i=r[1],n=b.useForm();n.formState.errors;var o=n.handleSubmit,s=n.control;return l.jsxs(A.default,{maxWidth:"xs",children:[l.jsxs(k.default,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(a).toLocaleString("en")||"0",l.jsx(k.default,{children:t.currency||"SAR"})]}),l.jsx(b.FormProvider,K(K({},n),{},{children:l.jsxs("form",{onSubmit:o(t.handleChargeWallet),children:[l.jsx(b.Controller,{control:s,name:"amount",render:function(e){var t,r=e.field;return l.jsx(re,K(K({fullWidth:!0,placeholder:"Enter amount",type:"number",value:null!==(t=r.value)&&void 0!==t?t:""},r),{},{inputProps:{inputMode:"numeric",min:"0",max:"9999999",step:"0.01"},onChange:function(e){r.onChange(parseFloat(e.target.value)),console.log("e",e.target.value),i(e.target.value)}}))}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CheckoutForm=function(e){var t,r,a,i,n,o,s,d,u,c,x="ar"===e.lang,m=b.useForm(),h=m.formState.errors,f=m.handleSubmit;m.register;var v=m.control,p={display:"flex",padding:0,paddingRight:"0px !important",paddingLeft:"0px !important",flexDirection:{xs:"column",sm:"row",md:"row",lg:"row",xl:"row"}};return l.jsxs(A.default,{maxWidth:"sm",style:{direction:x?"rtl":"ltr"},children:[l.jsx(k.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l.jsx(ne,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l.jsx(Y.default,{variant:"middle"}),l.jsx(k.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.billingAddress}),l.jsx(b.FormProvider,K(K({},m),{},{children:l.jsxs("form",{onSubmit:f(e.handlePayNow),children:[l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"firstName",rules:{required:null===(t=e.texts)||void 0===t?void 0:t.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.firstNameLabel)+" *",helperText:null===(i=h.firstName)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"lastName",rules:{required:null===(r=e.texts)||void 0===r?void 0:r.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.lastNameLabel)+" *",helperText:null===(i=h.lastName)||void 0===i?void 0:i.message},n))}})]}),l.jsx(b.Controller,{control:v,name:"email",render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.emailLabel)+" *",helperText:null===(i=h.email)||void 0===i?void 0:i.message},n))},rules:{required:null===(a=e.texts)||void 0===a?void 0:a.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:null===(i=e.texts)||void 0===i?void 0:i.emailInvalidText}}}),l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"streetAddress",rules:{required:null===(n=e.texts)||void 0===n?void 0:n.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.streetAddressLabel)+" *",helperText:null===(i=h.streetAddress)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"buildingNumber",rules:{required:null===(o=e.texts)||void 0===o?void 0:o.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.buildingNumberLabel)+" *",helperText:null===(i=h.buildingNumber)||void 0===i?void 0:i.message},n))}})]}),l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"province",rules:{required:null===(s=e.texts)||void 0===s?void 0:s.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.stateLabel)+" *",helperText:null===(i=h.province)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"city",rules:{required:null===(d=e.texts)||void 0===d?void 0:d.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.cityLabel)+" *",helperText:null===(i=h.city)||void 0===i?void 0:i.message},n))}})]}),l.jsxs(A.default,{sx:p,children:[l.jsx(b.Controller,{control:v,name:"zipCode",rules:{required:null===(u=e.texts)||void 0===u?void 0:u.required},render:function(t){var r,a,i,n=t.field;return l.jsx(re,K({inForm:!0,fullWidth:!0,type:"number",variant:"unscrollable",value:null!==(r=n.value)&&void 0!==r?r:"",label:(null===(a=e.texts)||void 0===a?void 0:a.zipCodeLabel)+" *",helperText:null===(i=h.zipCode)||void 0===i?void 0:i.message},n))}}),l.jsx("div",{style:{width:20}}),l.jsx(b.Controller,{control:v,name:"country",rules:{required:null===(c=e.texts)||void 0===c?void 0:c.required},render:function(t){var r,a,i,n=t.field;return l.jsxs(ae,K(K({fullWidth:!0,native:!0,label:(null===(r=e.texts)||void 0===r?void 0:r.countryLabel)+" *",variant:"standard",value:null!==(a=n.value)&&void 0!==a?a:"",helperText:null===(i=h.country)||void 0===i?void 0:i.message,displayEmpty:!0,disableUnderline:!0,validators:["required"]},n),{},{children:[l.jsx("option",{}),e.countriesList.map((function(e,t){return l.jsx("option",{children:e},t)}))]}))}})]}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.payNow})]})}))]})},exports.ConfirmationPage=function(e){var t="ar"===e.lang,r=b.useForm();return r.formState.errors,r.handleSubmit,r.register,r.control,l.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[l.jsxs(A.default,{maxWidth:"sm",style:{direction:t?"rtl":"ltr"},children:[l.jsx(k.default,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),l.jsx(Y.default,{variant:"middle"}),l.jsxs(k.default,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",l.jsx("strong",{children:e.userEmail})]}),l.jsx(k.default,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),l.jsx(k.default,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),l.jsx(Y.default,{variant:"middle"}),l.jsx(k.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l.jsx(ne,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l.jsx(Y.default,{variant:"middle"}),l.jsx(W.default,{onClick:e.handlePrint,variant:"contained",children:e.texts.print}),l.jsx(W.default,{onClick:e.handleHistory,variant:"last",children:e.texts.history}),l.jsx(W.default,{onClick:e.handleHome,variant:"last",children:e.texts.homePage}),l.jsx(k.default,{align:"center",variant:"body2",style:{marginTop:10},children:e.texts.fasterPaymentNote})]}),l.jsx("a",{style:{marginTop:10,paddingTop:10,padding:5,cursor:"pointer"},onClick:e.handleRefundPolicyLink,children:l.jsx(k.default,{align:"center",variant:"caption",fontWeight:500,children:e.texts.refundPolicy})})]})},exports.CreditCardForm=function(e){var t,r,a=b.useForm(),i=a.formState.errors,n=a.handleSubmit;return l.jsx(A.default,{maxWidth:"xs",children:l.jsx(b.FormProvider,K(K({},a),{},{children:l.jsxs("form",{onSubmit:n(e.handle),children:[l.jsx(re,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=i.password)||void 0===t?void 0:t.message}),l.jsx(re,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=i.password)||void 0===r?void 0:r.message}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},exports.NewPasswordForm=function(t){var r=X(e.useState(""),2);r[0],r[1];var a=X(e.useState(""),2);a[0],a[1];var i=X(e.useState(!1),2),n=i[0],o=i[1],s=b.useForm(),d=s.formState.errors,u=s.handleSubmit,c=s.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",children:[n&&l.jsx(ie,{text:t.texts.passwordMatchError,severity:"error"}),t.passwordChanged?l.jsx(te,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):l.jsx(b.FormProvider,K(K({},s),{},{children:l.jsxs("form",{onSubmit:u((function(e){console.log("handling subb",e),e.password===e.confirmPassword?t.handleNewPassword():o(!0)})),children:[l.jsx(b.Controller,{control:c,name:"password",render:function(e){var r,a,i=e.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(r=i.value)&&void 0!==r?r:"",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,helperText:null===(a=d.password)||void 0===a?void 0:a.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},i))},rules:{required:t.texts.passwordRequiredText}}),l.jsx(b.Controller,{control:c,name:"confirmPassword",render:function(e){var r,a,i=e.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(r=i.value)&&void 0!==r?r:"",label:t.texts.confirmPasswordLabel,placeholder:t.texts.confirmPasswordPlaceholder,helperText:null===(a=d.confirmPassword)||void 0===a?void 0:a.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},i))},rules:{required:t.texts.confirmPasswordRequiredText}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.PayWithWallet=function(e){return l.jsxs(A.default,{maxWidth:"xs",children:[l.jsx(k.default,{align:"center",children:"Wallet Balance"}),l.jsxs(k.default,{align:"center",variant:"h1",children:[e.walletBalance||"0",l.jsx(k.default,{children:e.currency||"SAR"})]}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t,r=b.useForm(),a=r.formState.errors,i=r.handleSubmit;r.register;var n=r.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",children:[e.error&&l.jsxs(Alert,{severity:"error",children:[e.errorTitle&&l.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?l.jsx(te,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):l.jsxs("form",{onSubmit:i(e.handleResetPassword),children:[console.log("eror ",null===(t=a.email)||void 0===t?void 0:t.message),l.jsx(b.Controller,{control:n,name:"email",render:function(t){var r,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(i=a.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(_.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})]})},exports.SelectPayment=function(e){return l.jsxs(A.default,{maxWidth:"xs",children:[l.jsx(te,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&l.jsx(le,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&l.jsx(le,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&l.jsx(le,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&l.jsx(le,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&l.jsx(le,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&l.jsx(le,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&l.jsx(le,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t=b.useForm(),r=t.formState.errors,a=t.handleSubmit;t.register;var i=t.control;return l.jsxs(A.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&l.jsxs(B.default,{severity:"error",children:[e.errorTitle&&l.jsx(z.default,{children:e.errorTitle}),e.errorText]}),l.jsxs("form",{onSubmit:a(e.handleSignIn),children:[l.jsx(b.Controller,{control:i,name:"email",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(_.default,{})})},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(b.Controller,{control:i,name:"password",render:function(t){var a,i,n,o=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",defaultValue:null!==(a=o.value)&&void 0!==a?a:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message,startAdornment:l.jsx($.default,{position:"start",children:l.jsx(H.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),l.jsx(k.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),l.jsxs(k.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",l.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),l.jsx(Y.default,{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l.jsx(le,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&l.jsx(le,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&l.jsx(le,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=oe,exports.UserProfileForm=function(e){var t=b.useForm(),r=t.formState.errors,a=t.handleSubmit,i=t.control;return l.jsx(A.default,{maxWidth:"sm",children:l.jsx(b.FormProvider,K(K({},t),{},{children:l.jsxs("form",{onSubmit:a(e.handleUpdateProfile),children:[l.jsx(b.Controller,{control:i,name:"fullName",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=r.fullName)||void 0===i?void 0:i.message},n))}}),l.jsx(b.Controller,{control:i,name:"phoneNumber",render:function(e){var t=e.field;return l.jsx(re,K({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),l.jsx(b.Controller,{control:i,name:"email",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"text",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.emailLabel,helperText:null===(i=r.email)||void 0===i?void 0:i.message,placeholder:e.texts.emailPlaceholder},n))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),l.jsx(b.Controller,{control:i,name:"password",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=r.password)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.passwordRequiredText}}),l.jsx(b.Controller,{control:i,name:"confirmPassword",render:function(t){var a,i,n=t.field;return l.jsx(re,K({fullWidth:!0,type:"password",value:null!==(a=n.value)&&void 0!==a?a:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(i=r.confirmPassword)||void 0===i?void 0:i.message},n))},rules:{required:e.texts.confirmPasswordRequiredText}}),l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettingsForm=function(e){return l.jsxs(A.default,{maxWidth:"sm",children:[e.children,l.jsx(W.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -33,8 +33,8 @@ export const CheckoutForm = (props) => {
33
33
  <Container maxWidth="sm" style={{ direction: isArabic ? "rtl" : "ltr" }}>
34
34
  <Typography
35
35
  align="center"
36
- variant="h4"
37
- fontWeight={400}
36
+ variant="h5"
37
+ fontWeight={500}
38
38
  style={{ marginBottom: 10 }}
39
39
  >
40
40
  {props.texts.orderDetails}
@@ -49,12 +49,13 @@ export const CheckoutForm = (props) => {
49
49
 
50
50
  <Typography
51
51
  align="center"
52
- variant="h4"
53
- fontWeight={400}
52
+ variant="h5"
53
+ fontWeight={500}
54
54
  style={{ marginBottom: 10 }}
55
55
  >
56
56
  {props.texts.billingAddress}
57
57
  </Typography>
58
+
58
59
  <FormProvider {...methods}>
59
60
  <form onSubmit={handleSubmit(props.handlePayNow)}>
60
61
  <Container sx={containerStyle}>
@@ -0,0 +1,117 @@
1
+ import React, { useState } from "react";
2
+ import { HawaTextField, HawaTable, HawaSelect } from "../../elements";
3
+ import { Controller, FormProvider, useForm } from "react-hook-form";
4
+ import Button from "@mui/material/Button";
5
+ import Container from "@mui/material/Container";
6
+ import Typography from "@mui/material/Typography";
7
+ import Divider from "@mui/material/Divider";
8
+
9
+ export const ConfirmationPage = (props) => {
10
+ let isArabic = props.lang === "ar";
11
+ const methods = useForm();
12
+ const {
13
+ formState: { errors },
14
+ handleSubmit,
15
+ register,
16
+ control
17
+ } = methods;
18
+
19
+ let containerStyle = {
20
+ display: "flex",
21
+ padding: 0,
22
+ paddingRight: "0px !important",
23
+ paddingLeft: "0px !important",
24
+ flexDirection: {
25
+ xs: "column",
26
+ sm: "row",
27
+ md: "row",
28
+ lg: "row",
29
+ xl: "row"
30
+ }
31
+ };
32
+ return (
33
+ <div
34
+ style={{
35
+ display: "flex",
36
+ flexDirection: "column",
37
+ justifyContent: "center",
38
+ alignItems: "center"
39
+ }}
40
+ >
41
+ <Container maxWidth="sm" style={{ direction: isArabic ? "rtl" : "ltr" }}>
42
+ <Typography
43
+ align="center"
44
+ variant="h3"
45
+ fontWeight={400}
46
+ style={{ marginBottom: 10 }}
47
+ >
48
+ {props.confirmationTitle}
49
+ </Typography>
50
+ <Divider variant="middle" />
51
+
52
+ <Typography
53
+ align="center"
54
+ variant="body1"
55
+ // fontWeight={500}
56
+ style={{ marginBottom: 10 }}
57
+ >
58
+ {props.texts.successMessage} <strong>{props.userEmail}</strong>
59
+ </Typography>
60
+ <Typography align="center" variant="body1">
61
+ {props.texts.yourOrderNumber}
62
+ </Typography>
63
+ <Typography
64
+ align="center"
65
+ variant="body1"
66
+ fontWeight={700}
67
+ style={{ marginBottom: 10 }}
68
+ >
69
+ {props.orderNumber}
70
+ </Typography>
71
+ <Divider variant="middle" />
72
+
73
+ <Typography
74
+ align="center"
75
+ variant="h5"
76
+ fontWeight={500}
77
+ style={{ marginBottom: 10 }}
78
+ >
79
+ {props.texts.orderDetails}
80
+ </Typography>
81
+
82
+ <HawaTable
83
+ lang={props.lang}
84
+ columns={["Product", "Price"]}
85
+ rows={props.products}
86
+ end={["Total", props.total]}
87
+ />
88
+ <Divider variant="middle" />
89
+ <Button onClick={props.handlePrint} variant="contained">
90
+ {props.texts.print}
91
+ </Button>
92
+ <Button onClick={props.handleHistory} variant="last">
93
+ {props.texts.history}
94
+ </Button>
95
+ <Button onClick={props.handleHome} variant="last">
96
+ {props.texts.homePage}
97
+ </Button>
98
+ <Typography align="center" variant="body2" style={{ marginTop: 10 }}>
99
+ {props.texts.fasterPaymentNote}
100
+ </Typography>
101
+ </Container>
102
+ <a
103
+ style={{
104
+ marginTop: 10,
105
+ paddingTop: 10,
106
+ padding: 5,
107
+ cursor: "pointer"
108
+ }}
109
+ onClick={props.handleRefundPolicyLink}
110
+ >
111
+ <Typography align="center" variant="caption" fontWeight={500}>
112
+ {props.texts.refundPolicy}
113
+ </Typography>
114
+ </a>
115
+ </div>
116
+ );
117
+ };
@@ -17,3 +17,4 @@ export * from "./CreditCardForm";
17
17
  export * from "./ChargeWalletForm";
18
18
  export * from "./PayWithWallet";
19
19
  export * from "./CheckoutForm";
20
+ export * from "./Confirmation";
@@ -345,4 +345,4 @@
345
345
 
346
346
 
347
347
 
348
- window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.4ff76500.iframe.bundle.js"></script><script src="main.13189777.iframe.bundle.js"></script></body></html>
348
+ window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.4ff76500.iframe.bundle.js"></script><script src="main.e1b79522.iframe.bundle.js"></script></body></html>