@sikka/hawa 0.0.23 → 0.0.26

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/README.md CHANGED
@@ -7,34 +7,25 @@
7
7
  [![NPM](https://img.shields.io/npm/v/@sikka/hawa.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/@sikka/hawa)
8
8
  [![NPM](https://img.shields.io/npm/dt/@sikka/hawa.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/@sikka/hawa)
9
9
 
10
+ > Opinionated UI Kit for web apps and websites.
10
11
 
12
+ ## Install
11
13
 
12
- > Opinionated UI Kit for web apps and websites.
14
+ ```bash
13
15
 
14
- # Concept
16
+ npm install --save @sikka/hawa
15
17
 
16
- ### Components
18
+ ```
17
19
 
18
- The smallest elements of this UI kit are the typical low-level components. Examples of components:
20
+ # Concept
19
21
 
20
- - InputField
21
- - Checkboxes
22
- - Modal
23
- - Drag-Drop Image(s)
24
- - Button
25
- - etc ...
22
+ ### Elements
26
23
 
27
- ### Blocks
24
+ The smallest components of this UI kit are the typical low-level components.
28
25
 
29
- Blocks are commonly used collection of components. Examples of blocks:
26
+ ### Blocks
30
27
 
31
- - Sign-In
32
- - Sign-Up
33
- - Reset Password
34
- - SaaS Pricing Plans
35
- - Payment Methods Block (to list saved methods)
36
- - Account Block (to edit account info)
37
- - etc ...
28
+ Blocks are commonly used collection of components.
38
29
 
39
30
  ### Boxes
40
31
 
@@ -52,17 +43,6 @@ Points
52
43
  - some boxes can float (animation of open and close modal)
53
44
  - some boxes can go full screen (animation to transition)
54
45
 
55
- ### Utilities
56
-
57
- - [x] **getTextColor(bgColor)**
58
- determine if text should be black or white based on the contrast of `bgColor`
59
-
60
- - [ ] **darkenColor(color,percent)**
61
- darken a given `color` by a given `percent`
62
-
63
- - [ ] **lightenColor(color,percent)**
64
- lighten a given `color` by a given `percent`
65
-
66
46
  # Features
67
47
 
68
48
  - [ ] Change borders and margin, padding in one place
@@ -75,14 +55,6 @@ lighten a given `color` by a given `percent`
75
55
  - [ ] Autocomplete
76
56
  - [ ] Badges
77
57
 
78
- ## Install
79
-
80
- ```bash
81
-
82
- npm install --save @sikka/hawa
83
-
84
- ```
85
-
86
58
  ## Usage
87
59
 
88
60
  ```jsx
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,Fragment as a}from"react/jsx-runtime";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import n from"@mui/material/Container";import o from"@mui/material/Typography";import"@mui/icons-material/CheckCircleOutlined";import d from"@mui/material/Input";import s from"@mui/material/InputLabel";import"@mui/material/Switch";import u from"@mui/icons-material/GitHub";import c from"@mui/icons-material/Twitter";import m from"@mui/icons-material/AccountBalanceWallet";import h from"@mui/material/Select";import p from"@mui/material/Alert";import v from"@mui/material/AlertTitle";import f from"@mui/material/Table";import g from"@mui/material/TableBody";import x from"@mui/material/TableCell";import b from"@mui/material/TableContainer";import y from"@mui/material/TableHead";import w from"@mui/material/TableRow";import"@mui/material/Snackbar";import{useForm as T,FormProvider as P,Controller as W}from"react-hook-form";import C from"@mui/material/InputAdornment";import S from"@mui/icons-material/HttpsOutlined";import k from"@mui/icons-material/MailOutline";import A from"@mui/icons-material/PermIdentityOutlined";import L from"@mui/material/Divider";function q(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 N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(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 R(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 z=function(e){return l(o,N(N({},e),{},{children:e.children}))},j=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(s,{children:e.label}),e.helperText&&l(o,{variant:"validation",children:e.helperText})]}),l(d,N({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var B=function(e){var r,a="";switch(null===(r=e.logo)||void 0===r?void 0:r.toLowerCase()){case"google":a=l("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":a=l(u,{});break;case"twitter":a=l(c,{});break;case"mada":a=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":a=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":a=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":a=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":a=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":a=l("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":a=l(m,{})}return i(t,N(N({},e),{},{variant:"withLogo",children:[a,l("div",{style:{width:10}}),l(o,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},G=function(e){return i("div",{style:{width:"100%"},children:[i("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[l(s,{children:e.label}),e.helperText&&l(o,{variant:"validation",children:e.helperText})]}),l(h,N(N({},e),{},{children:e.children}))]})},D=function(e){return i(p,{severity:e.severity,children:[e.title&&l(v,{children:e.title}),e.text]})},F=function(e){var t="ar"===e.lang;return l(b,{style:{direction:t?"rtl":"ltr"},children:i(f,{"aria-label":"a dense table",children:[l(y,{children:l(w,{children:e.columns.map((function(e,r){return l(x,{align:t?"right":"left",style:{fontWeight:700},variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})}),l(g,{children:e.rows.map((function(e,r){return l(w,{children:e.map((function(e,r){return l(x,{align:t?"right":"left",component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))},r)}))}),e.end&&l(w,{children:e.end.map((function(e,r){return l(x,{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=T(),a=r.formState.errors,o=r.handleSubmit,d=r.control;return l(n,{maxWidth:"sm",children:l(P,N(N({},r),{},{children:i("form",{onSubmit:o(e.handleUpdateProfile),children:[l(W,{control:d,name:"fullName",render:function(t){var r,i,n=t.field;return l(j,N({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(W,{control:d,name:"phoneNumber",render:function(e){var t=e.field;return l(j,N({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),l(W,{control:d,name:"email",render:function(t){var r,i,n=t.field;return l(j,N({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(W,{control:d,name:"password",render:function(t){var r,i,n=t.field;return l(j,N({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(W,{control:d,name:"confirmPassword",render:function(t){var r,i,n=t.field;return l(j,N({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"})," "]})}))})},Z=function(e){return i(n,{maxWidth:"sm",children:[e.children,l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})},E=function(r){var a=R(e(""),2);a[0],a[1];var o=R(e(""),2);o[0],o[1];var d=R(e(!1),2),s=d[0],u=d[1],c=T(),m=c.formState.errors,h=c.handleSubmit,p=c.control;return i(n,{maxWidth:"xs",variant:"auth",children:[s&&l(D,{text:r.texts.passwordMatchError,severity:"error"}),r.passwordChanged?l(z,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):l(P,N(N({},c),{},{children:i("form",{onSubmit:h((function(e){console.log("handling subb",e),e.password===e.confirmPassword?r.handleNewPassword():u(!0)})),children:[l(W,{control:p,name:"password",render:function(e){var t,i,a=e.field;return l(j,N({fullWidth:!0,type:"password",value:null!==(t=a.value)&&void 0!==t?t:"",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,helperText:null===(i=m.password)||void 0===i?void 0:i.message,startAdornment:l(C,{position:"start",children:l(S,{})})},a))},rules:{required:r.texts.passwordRequiredText}}),l(W,{control:p,name:"confirmPassword",render:function(e){var t,i,a=e.field;return l(j,N({fullWidth:!0,type:"password",value:null!==(t=a.value)&&void 0!==t?t:"",label:r.texts.confirmPasswordLabel,placeholder:r.texts.confirmPasswordPlaceholder,helperText:null===(i=m.confirmPassword)||void 0===i?void 0:i.message,startAdornment:l(C,{position:"start",children:l(S,{})})},a))},rules:{required:r.texts.confirmPasswordRequiredText}}),l(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},M=function(e){var r,a=T(),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(z,{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(W,{control:s,name:"email",render:function(t){var r,i,a=t.field;return l(j,N({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(C,{position:"start",children:l(k,{})})},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})]})]})},$=function(e){var r=T(),a=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(v,{children:e.errorTitle}),e.errorText]}),l(P,N(N({},r),{},{children:i("form",{onSubmit:d(e.handleSignUp),children:[l(W,{control:s,name:"fullName",render:function(t){var r,i,n=t.field;return l(j,{fullWidth:!0,type:"text",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(i=a.fullName)||void 0===i?void 0:i.message,startAdornment:l(C,{position:"start",children:l(A,{})})})},rules:{required:e.texts.fullNameRequiredText}}),l(W,{control:s,name:"email",render:function(t){var r,i,n=t.field;return l(j,{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(C,{position:"start",children:l(k,{})})})},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(W,{control:s,name:"password",render:function(t){var r,i,n,o=t.field;return l(j,N({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=a.password)||void 0===n?void 0:n.message,startAdornment:l(C,{position:"start",children:l(S,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),l(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),i(o,{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(L,{}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l(B,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&l(B,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&l(B,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};$.propTypes={theme:r.oneOf(["secondary","primary"])};var H=function(e){var r=T(),a=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(v,{children:e.errorTitle}),e.errorText]}),i("form",{onSubmit:d(e.handleSignIn),children:[l(W,{control:s,name:"email",render:function(t){var r,i,n=t.field;return l(j,N({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(C,{position:"start",children:l(k,{})})},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(W,{control:s,name:"password",render:function(t){var r,i,n,o=t.field;return l(j,N({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(i=o.value)&&void 0!==i?i:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=a.password)||void 0===n?void 0:n.message,startAdornment:l(C,{position:"start",children:l(S,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),l(o,{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(o,{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(L,{}),i("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&l(B,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&l(B,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&l(B,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},V=function(e){return i(n,{maxWidth:"xs",children:[l(z,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&l(B,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&l(B,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&l(B,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&l(B,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&l(B,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&l(B,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&l(B,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};j.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 _=function(e){var r,a,o=T(),d=o.formState.errors,s=o.handleSubmit;return l(n,{maxWidth:"xs",children:l(P,N(N({},o),{},{children:i("form",{onSubmit:s(e.handle),children:[l(j,{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(j,{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"})]})}))})},Y=function(r){var a=R(e(0),2),d=a[0],s=a[1],u=T();u.formState.errors;var c=u.handleSubmit,m=u.control;return i(n,{maxWidth:"xs",children:[i(o,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(d).toLocaleString("en")||"0",l(o,{children:r.currency||"SAR"})]}),l(P,N(N({},u),{},{children:i("form",{onSubmit:c(r.handleChargeWallet),children:[l(W,{control:m,name:"amount",render:function(e){var t,r=e.field;return l(j,N(N({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"})]})}))]})},J=function(e){return i(n,{maxWidth:"xs",children:[l(o,{align:"center",children:"Wallet Balance"}),i(o,{align:"center",variant:"h1",children:[e.walletBalance||"0",l(o,{children:e.currency||"SAR"})]}),l(t,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},K=function(e){var r,a,d,s,u,c,m,h,p,v,f="ar"===e.lang,g=T(),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(o,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l(F,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l(L,{variant:"middle"}),l(o,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.billingAddress}),l(P,N(N({},g),{},{children:i("form",{onSubmit:b(e.handlePayNow),children:[i(n,{sx:w,children:[l(W,{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(j,N({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(W,{control:y,name:"lastName",rules:{required:null===(a=e.texts)||void 0===a?void 0:a.required},render:function(t){var r,i,a,n=t.field;return l(j,N({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(W,{control:y,name:"email",render:function(t){var r,i,a,n=t.field;return l(j,N({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(W,{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(j,N({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(W,{control:y,name:"buildingNumber",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(j,N({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(W,{control:y,name:"province",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(j,N({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(W,{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(j,N({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(W,{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(j,N({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(W,{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(G,N(N({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})]})}))]})},Q=function(e){var r="ar"===e.lang,d=T();return d.formState.errors,d.handleSubmit,d.register,d.control,i("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[i(n,{maxWidth:"sm",style:{direction:r?"rtl":"ltr"},children:[l(o,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),l(L,{variant:"middle"}),i(o,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",l("strong",{children:e.userEmail})]}),l(o,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),l(o,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),l(L,{variant:"middle"}),e.products&&i(a,{children:[l(o,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),l(F,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),l(L,{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(o,{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(o,{align:"center",variant:"caption",fontWeight:500,children:e.texts.refundPolicy})})]})};export{Y as ChargeWalletForm,K as CheckoutForm,Q as ConfirmationPage,_ as CreditCardForm,E as NewPasswordForm,J as PayWithWallet,M as ResetPasswordForm,V as SelectPayment,H as SignInForm,$ as SignUpForm,U as UserProfileForm,Z as UserSettingsForm};
1
+ import e,{useState as t}from"react";import r from"@mui/material/Button";import i from"@mui/material/Tooltip";import n from"prop-types";import{jsxs as l,jsx as a,Fragment as o}from"react/jsx-runtime";import d from"@mui/material/Snackbar";import s from"@mui/material/AlertTitle";import c from"@mui/material/Alert";import u from"@mui/material/FormControlLabel";import m from"@mui/material/Checkbox";import h from"@mui/material/Container";import p from"@mui/material/Typography";import v from"@mui/icons-material/CheckCircleOutlined";import f from"@mui/material/Input";import g from"@mui/material/InputLabel";import x from"@mui/material/Switch";import y from"@mui/icons-material/GitHub";import b from"@mui/icons-material/Twitter";import w from"@mui/icons-material/AccountBalanceWallet";import T from"@mui/material/Select";import C from"@mui/material/Table";import P from"@mui/material/TableBody";import k from"@mui/material/TableCell";import S from"@mui/material/TableContainer";import W from"@mui/material/TableHead";import L from"@mui/material/TableRow";import{useForm as A,FormProvider as O,Controller as q}from"react-hook-form";import I from"@mui/material/InputAdornment";import z from"@mui/icons-material/HttpsOutlined";import R from"@mui/icons-material/MailOutline";import N from"@mui/icons-material/PermIdentityOutlined";import j from"@mui/material/Divider";import{styled as B,useTheme as D}from"@mui/material/styles";import M from"@mui/material/Box";import G from"@mui/material/Drawer";import E from"@mui/material/AppBar";import F from"@mui/material/Toolbar";import U from"@mui/material/List";import Z from"@mui/material/IconButton";import $ from"@mui/icons-material/Menu";import H from"@mui/icons-material/ChevronLeft";import V from"@mui/icons-material/ChevronRight";import _ from"@mui/material/ListItemButton";import X from"@mui/material/ListItemText";import J from"@mui/material/Menu";import K from"@mui/material/Avatar";import Q from"@mui/material/MenuItem";import Y from"@mui/icons-material/Close";import ee from"@mui/material/Dialog";import te from"@mui/material/DialogActions";import re from"@mui/material/DialogContent";import ie from"@mui/material/DialogTitle";import{useTheme as ne,Menu as le,MenuItem as ae,Typography as oe}from"@mui/material";function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach((function(t){ce(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ce(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ue(e,t){if(null==e)return{};var r,i,n=function(e,t){if(null==e)return{};var r,i,n={},l=Object.keys(e);for(i=0;i<l.length;i++)r=l[i],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i<l.length;i++)r=l[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function me(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 i,n,l=[],a=!0,o=!1;try{for(r=r.call(e);!(a=(i=r.next()).done)&&(l.push(i.value),!t||l.length!==t);a=!0);}catch(e){o=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(o)throw n}}return l}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return he(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 he(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 he(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var pe=function(e){return e.showText?l(r,{variant:"adaptive-dark",onClick:e.onClick,children:[e.icon,a("div",{style:{width:10}}),e.buttonText]}):a(i,{title:e.buttonText,placement:"top",children:a(r,{variant:"adaptive-dark",onClick:e.onClick,children:e.icon})})};pe.propTypes={buttonText:n.string,showText:n.bool};var ve=function(e){return a(r,se(se({},e),{},{children:e.text}))},fe=function(e){return a(d,{variant:"danger",open:e.open,onClose:e.handleClose,children:l(c,{icon:!1,severity:"error",variant:"offline",children:[e.title&&a(s,{children:e.title}),e.text]})})},ge=function(t){return console.log("props : ",t),a(e.Fragment,{children:a(u,{label:t.label,control:a(m,{style:{color:t.color||null},defaultChecked:t.defaultValue})})})},xe=function(e){var i=me(t(e.defaultValue),2),n=i[0],l=i[1];return a(h,{variant:e.location||"panelTabs",children:e.options.map((function(t,i){var o;return a(r,{onClick:function(){e.handleChange(t.value),l(t.value)},fullWidth:!0,variant:(null==n?void 0:n.toLowerCase())===(null===(o=t.value)||void 0===o?void 0:o.toLowerCase())?"selected":"unselected",children:t.label},i)}))})},ye=function(e){var t="ar"===e.lang;return l(h,{onClick:function(t){t.stopPropagation(),e.onCardClick()},maxWidth:"xs",variant:"card-container",dataValue:"parent",style:{direction:t?"rtl":"ltr"},children:[e.header&&l(h,{style:{zIndex:20},variant:"card-header",children:[e.headerActions&&a("div",{style:{margin:0,marginRight:-20,marginLeft:-20,marginBottom:-20,display:"flex",paddingTop:5,paddingLeft:5,paddingRight:5,justifyContent:"flex-end"},children:e.headerActions}),e.header]}),e.content&&a(h,{style:{zIndex:20},variant:"card-content",children:e.content}),e.actions&&a(h,{style:{zIndex:20},variant:"card-actions",children:e.actions})]})},be=function(e){var t,i,n="ar"===e.lang,o={monthly:"شهرياً","3-months":"كل 3 أشهر","6-months":"كل 6 أشهر",annually:"سنوياً"},d={monthly:"Monthly","3-months":"3 Months","6-months":"6 Months",annually:"Annually"},s={usd:n?"دولار":"$",sar:n?"ريال":"SAR"},c=n?e.features_ar:e.features;return l(h,{maxWidth:"xs",variant:e.selectedPlan?"selected-plan-card":"plan-card",style:{direction:n?"rtl":"ltr"},children:[l(h,{variant:"plan-header",children:[a(p,{variant:"h3",fontWeight:500,children:n?e.title_ar:e.title}),a(p,{variant:"caption",children:n?e.subtitle_ar:e.subtitle}),a("br",{}),a(p,{variant:"h4",fontWeight:500,style:{display:"flex",alignItems:"center"},children:"ar"===e.lang?l("div",{style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center"},children:[l("div",{style:{display:"flex",flexDirection:"row"},children:[e.price,a("div",{style:{width:5}}),a(p,{children:s[null===(t=e.currency)||void 0===t?void 0:t.toLowerCase()]})]}),a(p,{style:{fontSize:14,margin:5},children:n?o[e.cycleText]:d[e.cycleText]})]}):l("div",{style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center"},children:[l("div",{style:{display:"flex",flexDirection:"row"},children:[a(p,{children:s[null===(i=e.currency)||void 0===i?void 0:i.toLowerCase()]}),a("div",{style:{width:5}}),e.price]}),a(p,{style:{fontSize:14,margin:5},children:"ar"===e.lang?o[e.cycleText]:d[e.cycleText]})]})})]}),a("div",{style:{padding:20,color:e.selectedPlan?"white":"black"},children:null==c?void 0:c.map((function(e){return l("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",marginTop:10,width:"100%"},children:[a("div",{style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",width:"10%"},children:a(v,{fontSize:"small"})}),a("div",{style:{width:10}}),a(p,{variant:"subtitle2",children:e})]})}))}),a(r,{onClick:e.selectPlan,variant:e.selectedPlan?"outlined":"contained",style:{margin:20},children:e.buttonText})]})},we=function(e){return a(p,se(se({},e),{},{children:e.children}))},Te=function(e){return l("div",{style:e.inForm&&{width:"100%"},children:[l("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.label&&a(g,{children:e.label}),e.helperText&&a(p,{variant:"validation",children:e.helperText})]}),a(f,se({disableUnderline:!0},e))]})},Ce=function(e){return a(x,se({},e))},Pe=function(e){return l(h,{variant:"settingsRow",children:[a(we,{children:e.settingsLabel}),"checkbox"===e.settingsType&&a(m,se({},e)),"text"===e.settingsType&&a(Te,se({},e)),"radio"===e.settingsType&&a(xe,se({location:"inSettings"},e)),"boolean"===e.settingsType&&a(Ce,se({},e))]})};Pe.propTypes={type:n.oneOf(["text","number","password"]),helperText:n.string};var ke=function(e){var t,i="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":i=a("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":i=a(y,{});break;case"twitter":i=a(b,{});break;case"mada":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":i=a("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":i=a(w,{})}return l(r,se(se({},e),{},{variant:"withLogo",children:[i,a("div",{style:{width:10}}),a(p,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},Se=function(e){return a(r,se(se({},e),{},{children:e.children}))},We=function(e){return l("div",{style:{width:"100%"},children:[l("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[a(g,{children:e.label}),e.helperText&&a(p,{variant:"validation",children:e.helperText})]}),a(T,se(se({},e),{},{children:e.children}))]})},Le=function(e){return a(g,{children:a("div",{style:{fontSize:15},children:e.label})})},Ae=function(e){return l(c,{severity:e.severity,icon:e.hideIcon,children:[e.title&&a(s,{children:e.title}),e.text]})},Oe=function(e){var t="ar"===e.lang;return a(S,{style:{direction:t?"rtl":"ltr"},children:l(C,{"aria-label":"a dense table",children:[a(W,{children:a(L,{children:e.columns.map((function(e,r){return a(k,{align:t?"right":"left",style:{fontWeight:700},variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})}),a(P,{children:e.rows.map((function(e,r){return a(L,{children:e.map((function(e,r){return a(k,{align:t?"right":"left",component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))},r)}))}),e.end&&a(L,{children:e.end.map((function(e,r){return a(k,{align:t?"right":"left",style:{fontWeight:700},component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})]})})},qe=function(e){var t=A(),i=t.formState.errors,n=t.handleSubmit,o=t.control;return a(h,{maxWidth:"sm",children:a(O,se(se({},t),{},{children:l("form",{onSubmit:n(e.handleUpdateProfile),children:[a(q,{control:o,name:"fullName",render:function(t){var r,n,l=t.field;return a(Te,se({fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(n=i.fullName)||void 0===n?void 0:n.message},l))}}),a(q,{control:o,name:"phoneNumber",render:function(e){var t=e.field;return a(Te,se({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),a(q,{control:o,name:"email",render:function(t){var r,n,l=t.field;return a(Te,se({fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(n=i.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder},l))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a(q,{control:o,name:"password",render:function(t){var r,n,l=t.field;return a(Te,se({fullWidth:!0,type:"password",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=i.password)||void 0===n?void 0:n.message},l))},rules:{required:e.texts.passwordRequiredText}}),a(q,{control:o,name:"confirmPassword",render:function(t){var r,n,l=t.field;return a(Te,se({fullWidth:!0,type:"password",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(n=i.confirmPassword)||void 0===n?void 0:n.message},l))},rules:{required:e.texts.confirmPasswordRequiredText}}),a(r,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},Ie=function(e){return l(h,{maxWidth:"sm",children:[e.children,a(r,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSaveSettings,children:e.saveSettingsText})]})},ze=function(e){var i=me(t(""),2);i[0],i[1];var n=me(t(""),2);n[0],n[1];var o=me(t(!1),2),d=o[0],s=o[1],c=A(),u=c.formState.errors,m=c.handleSubmit,p=c.control;return l(h,{maxWidth:"xs",variant:"auth",children:[d&&a(Ae,{text:e.texts.passwordMatchError,severity:"error"}),e.passwordChanged?a(we,{style:{textAlign:"center",margin:5},children:e.texts.passwordChanged}):a(O,se(se({},c),{},{children:l("form",{onSubmit:m((function(t){console.log("handling subb",t),t.password===t.confirmPassword?e.handleNewPassword():s(!0)})),children:[a(q,{control:p,name:"password",render:function(t){var r,i,n=t.field;return a(Te,se({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=u.password)||void 0===i?void 0:i.message,startAdornment:a(I,{position:"start",children:a(z,{})})},n))},rules:{required:e.texts.passwordRequiredText}}),a(q,{control:p,name:"confirmPassword",render:function(t){var r,i,n=t.field;return a(Te,se({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(i=u.confirmPassword)||void 0===i?void 0:i.message,startAdornment:a(I,{position:"start",children:a(z,{})})},n))},rules:{required:e.texts.confirmPasswordRequiredText}}),a(r,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.updatePassword})]})}))]})},Re=function(e){var t=A(),i=t.formState.errors,n=t.handleSubmit;t.register;var o=t.control;return a(h,{maxWidth:"xs",variant:"auth",children:e.sent?a(we,{style:{textAlign:"center",margin:5},children:e.emailSentText}):l("form",{onSubmit:n(e.handleResetPassword),children:[a(q,{control:o,name:"email",render:function(t){var r,n,l=t.field;return a(Te,se({fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(n=i.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(I,{position:"start",children:a(R,{})})},l))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a(r,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})})},Ne=function(e){var t=A(),i=t.formState.errors,n=t.handleSubmit,o=t.control;return l(h,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&l(c,{severity:"error",variant:"inContainer",children:[e.errorTitle&&a(s,{children:e.errorTitle}),e.errorText]}),a(O,se(se({},t),{},{children:l("form",{onSubmit:n(e.handleSignUp),children:[a(q,{control:o,name:"fullName",render:function(t){var r,n,l=t.field;return a(Te,{fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(n=i.fullName)||void 0===n?void 0:n.message,startAdornment:a(I,{position:"start",children:a(N,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a(q,{control:o,name:"email",render:function(t){var r,n,l=t.field;return a(Te,{fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(n=i.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(I,{position:"start",children:a(R,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a(q,{control:o,name:"password",render:function(t){var r,n,l,o=t.field;return a(Te,se({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(n=o.value)&&void 0!==n?n:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(l=i.password)||void 0===l?void 0:l.message,startAdornment:a(I,{position:"start",children:a(z,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a(r,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),l(p,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",a("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),a(j,{}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(ke,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a(ke,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a(ke,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};Ne.propTypes={theme:n.oneOf(["secondary","primary"])};var je=function(e){var t=A(),i=t.formState.errors,n=t.handleSubmit,o=t.control;return l(h,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.showError&&a(Ae,{title:e.errorTitle,text:e.errorText,severity:"error"}),l("form",{onSubmit:n(e.handleSignIn),children:[a(q,{control:o,name:"email",render:function(t){var r,n,l=t.field;return a(Te,se({fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:e.texts.emailLabel,helperText:null===(n=i.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder,startAdornment:a(I,{position:"start",children:a(R,{})})},l))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a(q,{control:o,name:"password",render:function(t){var r,n,l,o=t.field;return a(Te,se({fullWidth:!0,type:"password",defaultValue:null!==(r=o.value)&&void 0!==r?r:"",value:null!==(n=o.value)&&void 0!==n?n:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(l=i.password)||void 0===l?void 0:l.message,startAdornment:a(I,{position:"start",children:a(z,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a(p,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a(r,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),l(p,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),a(j,{}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(ke,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a(ke,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a(ke,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},Be=function(e){return l(h,{maxWidth:"xs",children:[a(we,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a(ke,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a(ke,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a(ke,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a(ke,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a(ke,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a(ke,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a(ke,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};Te.propTypes={theme:n.oneOf(["secondary","primary"]),viaApplePay:n.bool,viaGooglePay:n.bool,viaSTCPay:n.bool,viaCreditCard:n.bool,viaPayPal:n.bool,handleApplePay:n.func};var De=function(e){var t,i=A(),n=i.formState.errors,o=i.handleSubmit,d=i.control;return a(h,{maxWidth:"xs",children:l("form",{onSubmit:o(e.handle),children:[a(Te,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a(q,{control:d,name:"cardName",render:function(e){var t;return e.field,a(Te,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message})}}),a(q,{control:d,name:"cardName",render:function(e){var t;return e.field,a(Te,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Expiry Date",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message})}}),a(q,{control:d,name:"cardName",render:function(e){var t;return e.field,a(Te,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"CCV",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message})}}),a(r,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})})},Me=function(e){var i=me(t(0),2),n=i[0],o=i[1],d=A();d.formState.errors;var s=d.handleSubmit,c=d.control;return l(h,{maxWidth:"xs",children:[l(p,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(n).toLocaleString("en")||"0",a(p,{children:e.currency||"SAR"})]}),a(O,se(se({},d),{},{children:l("form",{onSubmit:s(e.handleChargeWallet),children:[a(q,{control:c,name:"amount",render:function(e){var t,r=e.field;return a(Te,se(se({fullWidth:!0,placeholder:"Enter amount",type:"number",value:null!==(t=r.value)&&void 0!==t?t:""},r),{},{inputProps:{inputMode:"numeric",min:"0",max:"9999999",step:"0.01"},onChange:function(e){r.onChange(parseFloat(e.target.value)),console.log("e",e.target.value),o(e.target.value)}}))}}),a(r,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handleSignIn,children:"Charge Wallet"})]})}))]})},Ge=function(e){return l(h,{maxWidth:"xs",children:[a(p,{align:"center",children:"Wallet Balance"}),l(p,{align:"center",variant:"h1",children:[e.walletBalance||"0",a(p,{children:e.currency||"SAR"})]}),a(r,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},Ee=function(e){var t,i,n,o,d,s,c,u,m,v,f="ar"===e.lang,g=A(),x=g.formState.errors,y=g.handleSubmit;g.register;var b=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 l(h,{maxWidth:"sm",style:{direction:f?"rtl":"ltr"},children:[a(p,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),a(Oe,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),a(j,{variant:"middle"}),a(p,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.billingAddress}),a(O,se(se({},g),{},{children:l("form",{onSubmit:y(e.handlePayNow),children:[l(h,{sx:w,children:[a(q,{control:b,name:"firstName",rules:{required:null===(t=e.texts)||void 0===t?void 0:t.required},render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.firstNameLabel)+" *",helperText:null===(n=x.firstName)||void 0===n?void 0:n.message},l))}}),a("div",{style:{width:20}}),a(q,{control:b,name:"lastName",rules:{required:null===(i=e.texts)||void 0===i?void 0:i.required},render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.lastNameLabel)+" *",helperText:null===(n=x.lastName)||void 0===n?void 0:n.message},l))}})]}),a(q,{control:b,name:"email",render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.emailLabel)+" *",helperText:null===(n=x.email)||void 0===n?void 0:n.message},l))},rules:{required:null===(n=e.texts)||void 0===n?void 0:n.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===(o=e.texts)||void 0===o?void 0:o.emailInvalidText}}}),l(h,{sx:w,children:[a(q,{control:b,name:"streetAddress",rules:{required:null===(d=e.texts)||void 0===d?void 0:d.required},render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.streetAddressLabel)+" *",helperText:null===(n=x.streetAddress)||void 0===n?void 0:n.message},l))}}),a("div",{style:{width:20}}),a(q,{control:b,name:"buildingNumber",rules:{required:null===(s=e.texts)||void 0===s?void 0:s.required},render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.buildingNumberLabel)+" *",helperText:null===(n=x.buildingNumber)||void 0===n?void 0:n.message},l))}})]}),l(h,{sx:w,children:[a(q,{control:b,name:"province",rules:{required:null===(c=e.texts)||void 0===c?void 0:c.required},render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.stateLabel)+" *",helperText:null===(n=x.province)||void 0===n?void 0:n.message},l))}}),a("div",{style:{width:20}}),a(q,{control:b,name:"city",rules:{required:null===(u=e.texts)||void 0===u?void 0:u.required},render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.cityLabel)+" *",helperText:null===(n=x.city)||void 0===n?void 0:n.message},l))}})]}),l(h,{sx:w,children:[a(q,{control:b,name:"zipCode",rules:{required:null===(m=e.texts)||void 0===m?void 0:m.required},render:function(t){var r,i,n,l=t.field;return a(Te,se({inForm:!0,fullWidth:!0,type:"number",variant:"unscrollable",value:null!==(r=l.value)&&void 0!==r?r:"",label:(null===(i=e.texts)||void 0===i?void 0:i.zipCodeLabel)+" *",helperText:null===(n=x.zipCode)||void 0===n?void 0:n.message},l))}}),a("div",{style:{width:20}}),a(q,{control:b,name:"country",rules:{required:null===(v=e.texts)||void 0===v?void 0:v.required},render:function(t){var r,i,n,o=t.field;return l(We,se(se({fullWidth:!0,native:!0,label:(null===(r=e.texts)||void 0===r?void 0:r.countryLabel)+" *",variant:"standard",value:null!==(i=o.value)&&void 0!==i?i:"",helperText:null===(n=x.country)||void 0===n?void 0:n.message,displayEmpty:!0,disableUnderline:!0,validators:["required"]},o),{},{children:[a("option",{}),e.countriesList.map((function(e,t){return a("option",{children:e},t)}))]}))}})]}),a(r,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.payNow})]})}))]})},Fe=function(e){var t="ar"===e.lang,i=A();return i.formState.errors,i.handleSubmit,i.register,i.control,l("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[l(h,{maxWidth:"sm",style:{direction:t?"rtl":"ltr"},children:[a(p,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),a(j,{variant:"middle"}),l(p,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",a("strong",{children:e.userEmail})]}),a(p,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),a(p,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),a(j,{variant:"middle"}),e.products&&l(o,{children:[a(p,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),a(Oe,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),a(j,{variant:"middle"})]}),a(r,{onClick:e.handlePrint,variant:"contained",children:e.texts.print}),a(r,{onClick:e.handleHistory,variant:"last",children:e.texts.history}),a(r,{onClick:e.handleHome,variant:"last",children:e.texts.homePage}),a(p,{align:"center",variant:"body2",style:{marginTop:10},children:e.texts.fasterPaymentNote})]}),a("a",{style:{marginTop:10,paddingTop:10,padding:5,cursor:"pointer"},onClick:e.handleRefundPolicyLink,children:a(p,{align:"center",variant:"caption",fontWeight:500,children:e.texts.refundPolicy})})]})},Ue=function(e){return a("div",{children:e.children})},Ze=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},$e=function(e){return ce({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"calc(".concat(e.spacing(7)," + 1px)")},e.breakpoints.up("sm"),{width:"calc(".concat(e.spacing(8)," + 1px)")})},He=B("div")((function(e){var t=e.theme;return se({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),Ve=B(E,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return se({zIndex:t.zIndex.drawer+1,transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen})},r&&{marginLeft:240,width:"calc(100% - ".concat(240,"px)"),transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.enteringScreen})})})),_e=B(G,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return se(se({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&se(se({},Ze(t)),{},{"& .MuiDrawer-paper":Ze(t)})),!r&&se(se({},$e(t)),{},{"& .MuiDrawer-paper":$e(t)}))}));function Xe(t){var r=D(),n=me(e.useState(!0),2),o=n[0],d=n[1],s=me(e.useState(null),2);s[0],s[1];var c=me(e.useState(null),2),u=c[0],m=c[1];return l(M,{sx:{display:"flex"},children:[a(Ve,{variant:"appbar",position:"fixed",open:o,children:l(F,{variant:"appbar",children:[a(Z,{color:"inherit","aria-label":"open drawer",onClick:function(){d(!0)},edge:"start",sx:se({marginRight:5},o&&{display:"none"}),children:a($,{})}),l("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",margin:0},children:[a(p,{variant:"h6",noWrap:!0,component:"div",children:t.pageTitle}),l(M,{children:[a(i,{title:"Open settings",children:a(Z,{onClick:function(e){m(e.currentTarget)},sx:{p:0},children:a(K,{alt:"Remy Sharp",src:"/static/images/avatar/2.jpg"})})}),a(J,{sx:{mt:"45px"},id:"menu-appbar",anchorEl:u,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:Boolean(u),onClose:function(){m(null)},variant:"themed",PaperProps:{style:{boxShadow:"none",borderRadius:r.allBorderRadius,border:"1px solid ".concat(r.primaryActionColor)}},children:t.accountMenu.map((function(e){return l(Q,{onClick:e.action,children:[e.icon&&a(e.icon,{}),a(p,{textAlign:"center",children:e.label})]},e.label)}))})]})]})]})}),l(_e,{variant:"permanent",open:o,children:[l(He,{children:[t.logo,a(Z,{onClick:function(){d(!1)},children:"rtl"===r.direction?a(V,{}):a(H,{})})]}),a(j,{}),a(U,{children:t.pages.map((function(e,r){var n,d;return a(i,{title:e.text,placement:"right",arrow:!0,PopperProps:{style:{opacity:o?0:1}},children:l(_,{variant:(null===(n=t.pageName)||void 0===n?void 0:n.toLowerCase())===(null===(d=e.slug)||void 0===d?void 0:d.toLowerCase())&&"clicked",onClick:e.action,sx:{minHeight:48,justifyContent:o?"initial":"center",px:2.5},children:[a(e.icon,{}),a("div",{style:{width:20}}),a(X,{primary:e.text,sx:{opacity:o?1:0}})]},e.text)},r)}))})]}),l(M,{sx:{flexGrow:1,p:3},children:[a(He,{}),t.children]})]})}var Je=["children","onClose","hideClose"],Ke=function(e){var t=e.children,r=e.onClose,i=e.hideClose,n=ue(e,Je);return l(ie,se(se({sx:{m:0,p:2}},n),{},{children:[t,i?null:a(Z,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:8,color:function(e){return e.palette.grey[500]}},children:a(Y,{})})]}))};function Qe(e){var r=me(t(!1),2);return r[0],r[1],l(ee,se(se({},e),{},{variant:"main",children:[a(Ke,{onClose:e.onClose,hideClose:e.hideClose,children:e.title}),a(re,{children:e.children}),a(te,{children:e.actions})]}))}var Ye=function(e){var t=ne();return a(le,{sx:{mt:"45px"},id:"menu-appbar",anchorEl:e.anchor,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:Boolean(e.anchor),onClose:e.handleClose,variant:"themed",PaperProps:{style:{boxShadow:"none",borderRadius:t.allBorderRadius,border:"1px solid ".concat(t.primaryActionColor)}},children:e.menuItems.map((function(e){return l(ae,{onClick:e.action,children:[e.icon&&a(e.icon,{}),a("div",{style:{width:10}}),a(oe,{textAlign:"center",children:e.label})]},e.label)}))})},et=["Products","Pricing","Blog"],tt=function(t){var n=ne(),o=me(e.useState(null),2),d=o[0],s=o[1],c=me(e.useState(null),2),u=c[0],m=c[1],v=function(){s(null)};return console.log("theme is ",n),a(E,{position:"static",variant:"appbar",children:a(h,{maxWidth:"xl",variant:"appbar",children:l(F,{disableGutters:!0,children:[a(p,{variant:"h6",noWrap:!0,component:"div",sx:{mr:2,display:{xs:"none",md:"flex"}},children:"LOGO"}),l(M,{sx:{flexGrow:1,display:{xs:"flex",md:"none"}},children:[a(Z,{size:"large","aria-label":"account of current user","aria-controls":"menu-appbar","aria-haspopup":"true",onClick:t.handleOpenSideMenu,color:"inherit",children:a($,{})}),a(J,{id:"menu-appbar",anchorEl:d,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"left"},open:Boolean(d),onClose:v,sx:{display:{xs:"block",md:"none"}},children:et.map((function(e){return a(Q,{onClick:v,children:a(p,{textAlign:"center",children:e})},e)}))})]}),a(p,{variant:"h6",noWrap:!0,component:"div",sx:{flexGrow:1,display:{xs:"flex",md:"none"}},children:"LOGO"}),a(M,{sx:{flexGrow:1,display:{xs:"none",md:"flex"}},children:et.map((function(e){return a(r,{onClick:v,sx:{my:2,display:"block"},children:e},e)}))}),l(M,{sx:{flexGrow:0},children:[a(i,{title:"Open settings",children:a(Z,{onClick:function(e){m(e.currentTarget)},sx:{p:0},children:a(K,{alt:"Remy Sharp",src:"/static/images/avatar/2.jpg"})})}),a(Ye,{anchor:u,handleClose:function(e){return m(null)},menuItems:t.accountMenu})]})]})})})};export{ve as ActionButton,pe as AdaptiveButton,Ue as Box,Me as ChargeWalletForm,Ee as CheckoutForm,Fe as ConfirmationPage,De as CreditCardForm,Ae as HawaAlert,tt as HawaAppBar,Xe as HawaAppLayout,Se as HawaButton,ge as HawaCheckbox,Qe as HawaDialog,Le as HawaInputLabel,ye as HawaItemCard,ke as HawaLogoButton,be as HawaPricingCard,xe as HawaRadio,We as HawaSelect,Pe as HawaSettingsRow,Oe as HawaTable,Te as HawaTextField,we as HawaTypography,ze as NewPasswordForm,fe as OfflineBanner,Ge as PayWithWallet,Re as ResetPasswordForm,Be as SelectPayment,je as SignInForm,Ne as SignUpForm,qe as UserProfileForm,Ie 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/FormControlLabel"),require("@mui/material/Checkbox");var a=require("@mui/material/Container"),i=require("@mui/material/Typography");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"),C=require("@mui/material/Divider");function q(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var W=q(t),S=q(r),k=q(a),A=q(i),L=q(n),F=q(o),N=q(s),O=q(d),R=q(u),I=q(c),z=q(x),B=q(m),U=q(h),G=q(f),D=q(v),M=q(p),Z=q(g),E=q(j),$=q(y),H=q(w),_=q(T),V=q(P),Y=q(C);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(A.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(A.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(R.default,{})}return l.jsxs(W.default,K(K({},e),{},{variant:"withLogo",children:[r,l.jsx("div",{style:{width:10}}),l.jsx(A.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(A.default,{variant:"validation",children:e.helperText})]}),l.jsx(I.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(M.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(D.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(D.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(D.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(k.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(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(A.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(k.default,{maxWidth:"xs",children:[l.jsxs(A.default,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(a).toLocaleString("en")||"0",l.jsx(A.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(k.default,{maxWidth:"sm",style:{direction:x?"rtl":"ltr"},children:[l.jsx(A.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(A.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(k.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(k.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(k.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(k.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(k.default,{maxWidth:"sm",style:{direction:t?"rtl":"ltr"},children:[l.jsx(A.default,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),l.jsx(Y.default,{variant:"middle"}),l.jsxs(A.default,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",l.jsx("strong",{children:e.userEmail})]}),l.jsx(A.default,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),l.jsx(A.default,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),l.jsx(Y.default,{variant:"middle"}),e.products&&l.jsxs(l.Fragment,{children:[l.jsx(A.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(A.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(A.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(k.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(k.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(k.default,{maxWidth:"xs",children:[l.jsx(A.default,{align:"center",children:"Wallet Balance"}),l.jsxs(A.default,{align:"center",variant:"h1",children:[e.walletBalance||"0",l.jsx(A.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(k.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(k.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(k.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(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(A.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(A.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(k.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(k.default,{maxWidth:"sm",children:[e.children,l.jsx(W.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"),r=require("@mui/material/Tooltip"),l=require("prop-types"),a=require("react/jsx-runtime"),n=require("@mui/material/Snackbar"),i=require("@mui/material/AlertTitle"),o=require("@mui/material/Alert"),s=require("@mui/material/FormControlLabel"),d=require("@mui/material/Checkbox"),u=require("@mui/material/Container"),c=require("@mui/material/Typography"),x=require("@mui/icons-material/CheckCircleOutlined"),h=require("@mui/material/Input"),f=require("@mui/material/InputLabel"),m=require("@mui/material/Switch"),p=require("@mui/icons-material/GitHub"),v=require("@mui/icons-material/Twitter"),g=require("@mui/icons-material/AccountBalanceWallet"),j=require("@mui/material/Select"),y=require("@mui/material/Table"),b=require("@mui/material/TableBody"),w=require("@mui/material/TableCell"),C=require("@mui/material/TableContainer"),T=require("@mui/material/TableHead"),P=require("@mui/material/TableRow"),q=require("react-hook-form"),S=require("@mui/material/InputAdornment"),k=require("@mui/icons-material/HttpsOutlined"),W=require("@mui/icons-material/MailOutline"),L=require("@mui/icons-material/PermIdentityOutlined"),A=require("@mui/material/Divider"),O=require("@mui/material/styles"),I=require("@mui/material/Box"),F=require("@mui/material/Drawer"),R=require("@mui/material/AppBar"),z=require("@mui/material/Toolbar"),B=require("@mui/material/List"),N=require("@mui/material/IconButton"),D=require("@mui/icons-material/Menu"),M=require("@mui/icons-material/ChevronLeft"),G=require("@mui/icons-material/ChevronRight"),H=require("@mui/material/ListItemButton"),E=require("@mui/material/ListItemText"),U=require("@mui/material/Menu"),Z=require("@mui/material/Avatar"),$=require("@mui/material/MenuItem"),_=require("@mui/icons-material/Close"),V=require("@mui/material/Dialog"),X=require("@mui/material/DialogActions"),J=require("@mui/material/DialogContent"),K=require("@mui/material/DialogTitle"),Q=require("@mui/material");function Y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var ee=Y(e),te=Y(t),re=Y(r),le=Y(l),ae=Y(n),ne=Y(i),ie=Y(o),oe=Y(s),se=Y(d),de=Y(u),ue=Y(c),ce=Y(x),xe=Y(h),he=Y(f),fe=Y(m),me=Y(p),pe=Y(v),ve=Y(g),ge=Y(j),je=Y(y),ye=Y(b),be=Y(w),we=Y(C),Ce=Y(T),Te=Y(P),Pe=Y(S),qe=Y(k),Se=Y(W),ke=Y(L),We=Y(A),Le=Y(I),Ae=Y(F),Oe=Y(R),Ie=Y(z),Fe=Y(B),Re=Y(N),ze=Y(D),Be=Y(M),Ne=Y(G),De=Y(H),Me=Y(E),Ge=Y(U),He=Y(Z),Ee=Y($),Ue=Y(_),Ze=Y(V),$e=Y(X),_e=Y(J),Ve=Y(K);function Xe(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 Je(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(r),!0).forEach((function(t){Ke(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ke(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qe(e,t){if(null==e)return{};var r,l,a=function(e,t){if(null==e)return{};var r,l,a={},n=Object.keys(e);for(l=0;l<n.length;l++)r=n[l],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(l=0;l<n.length;l++)r=n[l],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Ye(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,n=[],i=!0,o=!1;try{for(r=r.call(e);!(i=(l=r.next()).done)&&(n.push(l.value),!t||n.length!==t);i=!0);}catch(e){o=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(o)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return et(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 et(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 et(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}var tt=function(e){return e.showText?a.jsxs(te.default,{variant:"adaptive-dark",onClick:e.onClick,children:[e.icon,a.jsx("div",{style:{width:10}}),e.buttonText]}):a.jsx(re.default,{title:e.buttonText,placement:"top",children:a.jsx(te.default,{variant:"adaptive-dark",onClick:e.onClick,children:e.icon})})};tt.propTypes={buttonText:le.default.string,showText:le.default.bool};var rt=function(t){var r=Ye(e.useState(t.defaultValue),2),l=r[0],n=r[1];return a.jsx(de.default,{variant:t.location||"panelTabs",children:t.options.map((function(e,r){var i;return a.jsx(te.default,{onClick:function(){t.handleChange(e.value),n(e.value)},fullWidth:!0,variant:(null==l?void 0:l.toLowerCase())===(null===(i=e.value)||void 0===i?void 0:i.toLowerCase())?"selected":"unselected",children:e.label},r)}))})},lt=function(e){return a.jsx(ue.default,Je(Je({},e),{},{children:e.children}))},at=function(e){return a.jsxs("div",{style:e.inForm&&{width:"100%"},children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.label&&a.jsx(he.default,{children:e.label}),e.helperText&&a.jsx(ue.default,{variant:"validation",children:e.helperText})]}),a.jsx(xe.default,Je({disableUnderline:!0},e))]})},nt=function(e){return a.jsx(fe.default,Je({},e))},it=function(e){return a.jsxs(de.default,{variant:"settingsRow",children:[a.jsx(lt,{children:e.settingsLabel}),"checkbox"===e.settingsType&&a.jsx(se.default,Je({},e)),"text"===e.settingsType&&a.jsx(at,Je({},e)),"radio"===e.settingsType&&a.jsx(rt,Je({location:"inSettings"},e)),"boolean"===e.settingsType&&a.jsx(nt,Je({},e))]})};it.propTypes={type:le.default.oneOf(["text","number","password"]),helperText:le.default.string};var ot=function(e){var t,r="";switch(null===(t=e.logo)||void 0===t?void 0:t.toLowerCase()){case"google":r=a.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"});break;case"github":r=a.jsx(me.default,{});break;case"twitter":r=a.jsx(pe.default,{});break;case"mada":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/mada.png",height:20});break;case"stcpay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/stc-pay.png",height:20});break;case"visa/master":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/visa-master.png",height:30});break;case"paypal":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/paypal.png",height:25});break;case"googlepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/google-pay.png",height:20});break;case"applepay":r=a.jsx("img",{src:"https://sikka-images.s3.ap-southeast-1.amazonaws.com/payments/apple-pay.png",height:40});break;case"wallet":r=a.jsx(ve.default,{})}return a.jsxs(te.default,Je(Je({},e),{},{variant:"withLogo",children:[r,a.jsx("div",{style:{width:10}}),a.jsx(ue.default,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},st=function(e){return a.jsxs("div",{style:{width:"100%"},children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[a.jsx(he.default,{children:e.label}),e.helperText&&a.jsx(ue.default,{variant:"validation",children:e.helperText})]}),a.jsx(ge.default,Je(Je({},e),{},{children:e.children}))]})},dt=function(e){return a.jsxs(ie.default,{severity:e.severity,icon:e.hideIcon,children:[e.title&&a.jsx(ne.default,{children:e.title}),e.text]})},ut=function(e){var t="ar"===e.lang;return a.jsx(we.default,{style:{direction:t?"rtl":"ltr"},children:a.jsxs(je.default,{"aria-label":"a dense table",children:[a.jsx(Ce.default,{children:a.jsx(Te.default,{children:e.columns.map((function(e,r){return a.jsx(be.default,{align:t?"right":"left",style:{fontWeight:700},variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})}),a.jsx(ye.default,{children:e.rows.map((function(e,r){return a.jsx(Te.default,{children:e.map((function(e,r){return a.jsx(be.default,{align:t?"right":"left",component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))},r)}))}),e.end&&a.jsx(Te.default,{children:e.end.map((function(e,r){return a.jsx(be.default,{align:t?"right":"left",style:{fontWeight:700},component:"th",scope:"row",variant:r>0?t?"borderedRight":"borderedLeft":"body",children:e},r)}))})]})})},ct=function(e){var t=q.useForm(),r=t.formState.errors,l=t.handleSubmit,n=t.control;return a.jsxs(de.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.error&&a.jsxs(ie.default,{severity:"error",variant:"inContainer",children:[e.errorTitle&&a.jsx(ne.default,{children:e.errorTitle}),e.errorText]}),a.jsx(q.FormProvider,Je(Je({},t),{},{children:a.jsxs("form",{onSubmit:l(e.handleSignUp),children:[a.jsx(q.Controller,{control:n,name:"fullName",render:function(t){var l,n,i=t.field;return a.jsx(at,{fullWidth:!0,type:"text",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(n=r.fullName)||void 0===n?void 0:n.message,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(ke.default,{})})})},rules:{required:e.texts.fullNameRequiredText}}),a.jsx(q.Controller,{control:n,name:"email",render:function(t){var l,n,i=t.field;return a.jsx(at,{fullWidth:!0,type:"text",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.emailLabel,helperText:null===(n=r.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(Se.default,{})})})},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(q.Controller,{control:n,name:"password",render:function(t){var l,n,i,o=t.field;return a.jsx(at,Je({fullWidth:!0,type:"password",defaultValue:null!==(l=o.value)&&void 0!==l?l:"",value:null!==(n=o.value)&&void 0!==n?n:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=r.password)||void 0===i?void 0:i.message,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(qe.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(te.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),a.jsxs(ue.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.existingUserText," ",a.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),a.jsx(We.default,{}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(ot,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a.jsx(ot,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a.jsx(ot,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};ct.propTypes={theme:le.default.oneOf(["secondary","primary"])};at.propTypes={theme:le.default.oneOf(["secondary","primary"]),viaApplePay:le.default.bool,viaGooglePay:le.default.bool,viaSTCPay:le.default.bool,viaCreditCard:le.default.bool,viaPayPal:le.default.bool,handleApplePay:le.default.func};var xt=function(e){return{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}},ht=function(e){return Ke({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"calc(".concat(e.spacing(7)," + 1px)")},e.breakpoints.up("sm"),{width:"calc(".concat(e.spacing(8)," + 1px)")})},ft=O.styled("div")((function(e){var t=e.theme;return Je({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:t.spacing(0,1)},t.mixins.toolbar)})),mt=O.styled(Oe.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return Je({zIndex:t.zIndex.drawer+1,transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen})},r&&{marginLeft:240,width:"calc(100% - ".concat(240,"px)"),transition:t.transitions.create(["width","margin"],{easing:t.transitions.easing.sharp,duration:t.transitions.duration.enteringScreen})})})),pt=O.styled(Ae.default,{shouldForwardProp:function(e){return"open"!==e}})((function(e){var t=e.theme,r=e.open;return Je(Je({width:240,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box"},r&&Je(Je({},xt(t)),{},{"& .MuiDrawer-paper":xt(t)})),!r&&Je(Je({},ht(t)),{},{"& .MuiDrawer-paper":ht(t)}))}));var vt=["children","onClose","hideClose"],gt=function(e){var t=e.children,r=e.onClose,l=e.hideClose,n=Qe(e,vt);return a.jsxs(Ve.default,Je(Je({sx:{m:0,p:2}},n),{},{children:[t,l?null:a.jsx(Re.default,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:8,color:function(e){return e.palette.grey[500]}},children:a.jsx(Ue.default,{})})]}))};var jt=function(e){var t=Q.useTheme();return a.jsx(Q.Menu,{sx:{mt:"45px"},id:"menu-appbar",anchorEl:e.anchor,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:Boolean(e.anchor),onClose:e.handleClose,variant:"themed",PaperProps:{style:{boxShadow:"none",borderRadius:t.allBorderRadius,border:"1px solid ".concat(t.primaryActionColor)}},children:e.menuItems.map((function(e){return a.jsxs(Q.MenuItem,{onClick:e.action,children:[e.icon&&a.jsx(e.icon,{}),a.jsx("div",{style:{width:10}}),a.jsx(Q.Typography,{textAlign:"center",children:e.label})]},e.label)}))})},yt=["Products","Pricing","Blog"];exports.ActionButton=function(e){return a.jsx(te.default,Je(Je({},e),{},{children:e.text}))},exports.AdaptiveButton=tt,exports.Box=function(e){return a.jsx("div",{children:e.children})},exports.ChargeWalletForm=function(t){var r=Ye(e.useState(0),2),l=r[0],n=r[1],i=q.useForm();i.formState.errors;var o=i.handleSubmit,s=i.control;return a.jsxs(de.default,{maxWidth:"xs",children:[a.jsxs(ue.default,{align:"center",variant:"h2",fontWeight:500,style:{marginBottom:20},children:[Number(l).toLocaleString("en")||"0",a.jsx(ue.default,{children:t.currency||"SAR"})]}),a.jsx(q.FormProvider,Je(Je({},i),{},{children:a.jsxs("form",{onSubmit:o(t.handleChargeWallet),children:[a.jsx(q.Controller,{control:s,name:"amount",render:function(e){var t,r=e.field;return a.jsx(at,Je(Je({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),n(e.target.value)}}))}}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CheckoutForm=function(e){var t,r,l,n,i,o,s,d,u,c,x="ar"===e.lang,h=q.useForm(),f=h.formState.errors,m=h.handleSubmit;h.register;var p=h.control,v={display:"flex",padding:0,paddingRight:"0px !important",paddingLeft:"0px !important",flexDirection:{xs:"column",sm:"row",md:"row",lg:"row",xl:"row"}};return a.jsxs(de.default,{maxWidth:"sm",style:{direction:x?"rtl":"ltr"},children:[a.jsx(ue.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),a.jsx(ut,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),a.jsx(We.default,{variant:"middle"}),a.jsx(ue.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.billingAddress}),a.jsx(q.FormProvider,Je(Je({},h),{},{children:a.jsxs("form",{onSubmit:m(e.handlePayNow),children:[a.jsxs(de.default,{sx:v,children:[a.jsx(q.Controller,{control:p,name:"firstName",rules:{required:null===(t=e.texts)||void 0===t?void 0:t.required},render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.firstNameLabel)+" *",helperText:null===(n=f.firstName)||void 0===n?void 0:n.message},i))}}),a.jsx("div",{style:{width:20}}),a.jsx(q.Controller,{control:p,name:"lastName",rules:{required:null===(r=e.texts)||void 0===r?void 0:r.required},render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.lastNameLabel)+" *",helperText:null===(n=f.lastName)||void 0===n?void 0:n.message},i))}})]}),a.jsx(q.Controller,{control:p,name:"email",render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.emailLabel)+" *",helperText:null===(n=f.email)||void 0===n?void 0:n.message},i))},rules:{required:null===(l=e.texts)||void 0===l?void 0:l.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===(n=e.texts)||void 0===n?void 0:n.emailInvalidText}}}),a.jsxs(de.default,{sx:v,children:[a.jsx(q.Controller,{control:p,name:"streetAddress",rules:{required:null===(i=e.texts)||void 0===i?void 0:i.required},render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.streetAddressLabel)+" *",helperText:null===(n=f.streetAddress)||void 0===n?void 0:n.message},i))}}),a.jsx("div",{style:{width:20}}),a.jsx(q.Controller,{control:p,name:"buildingNumber",rules:{required:null===(o=e.texts)||void 0===o?void 0:o.required},render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.buildingNumberLabel)+" *",helperText:null===(n=f.buildingNumber)||void 0===n?void 0:n.message},i))}})]}),a.jsxs(de.default,{sx:v,children:[a.jsx(q.Controller,{control:p,name:"province",rules:{required:null===(s=e.texts)||void 0===s?void 0:s.required},render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.stateLabel)+" *",helperText:null===(n=f.province)||void 0===n?void 0:n.message},i))}}),a.jsx("div",{style:{width:20}}),a.jsx(q.Controller,{control:p,name:"city",rules:{required:null===(d=e.texts)||void 0===d?void 0:d.required},render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"text",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.cityLabel)+" *",helperText:null===(n=f.city)||void 0===n?void 0:n.message},i))}})]}),a.jsxs(de.default,{sx:v,children:[a.jsx(q.Controller,{control:p,name:"zipCode",rules:{required:null===(u=e.texts)||void 0===u?void 0:u.required},render:function(t){var r,l,n,i=t.field;return a.jsx(at,Je({inForm:!0,fullWidth:!0,type:"number",variant:"unscrollable",value:null!==(r=i.value)&&void 0!==r?r:"",label:(null===(l=e.texts)||void 0===l?void 0:l.zipCodeLabel)+" *",helperText:null===(n=f.zipCode)||void 0===n?void 0:n.message},i))}}),a.jsx("div",{style:{width:20}}),a.jsx(q.Controller,{control:p,name:"country",rules:{required:null===(c=e.texts)||void 0===c?void 0:c.required},render:function(t){var r,l,n,i=t.field;return a.jsxs(st,Je(Je({fullWidth:!0,native:!0,label:(null===(r=e.texts)||void 0===r?void 0:r.countryLabel)+" *",variant:"standard",value:null!==(l=i.value)&&void 0!==l?l:"",helperText:null===(n=f.country)||void 0===n?void 0:n.message,displayEmpty:!0,disableUnderline:!0,validators:["required"]},i),{},{children:[a.jsx("option",{}),e.countriesList.map((function(e,t){return a.jsx("option",{children:e},t)}))]}))}})]}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.payNow})]})}))]})},exports.ConfirmationPage=function(e){var t="ar"===e.lang,r=q.useForm();return r.formState.errors,r.handleSubmit,r.register,r.control,a.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[a.jsxs(de.default,{maxWidth:"sm",style:{direction:t?"rtl":"ltr"},children:[a.jsx(ue.default,{align:"center",variant:"h3",fontWeight:400,style:{marginBottom:10},children:e.confirmationTitle}),a.jsx(We.default,{variant:"middle"}),a.jsxs(ue.default,{align:"center",variant:"body1",style:{marginBottom:10},children:[e.texts.successMessage," ",a.jsx("strong",{children:e.userEmail})]}),a.jsx(ue.default,{align:"center",variant:"body1",children:e.texts.yourOrderNumber}),a.jsx(ue.default,{align:"center",variant:"body1",fontWeight:700,style:{marginBottom:10},children:e.orderNumber}),a.jsx(We.default,{variant:"middle"}),e.products&&a.jsxs(a.Fragment,{children:[a.jsx(ue.default,{align:"center",variant:"h5",fontWeight:500,style:{marginBottom:10},children:e.texts.orderDetails}),a.jsx(ut,{lang:e.lang,columns:["Product","Price"],rows:e.products,end:["Total",e.total]}),a.jsx(We.default,{variant:"middle"})]}),a.jsx(te.default,{onClick:e.handlePrint,variant:"contained",children:e.texts.print}),a.jsx(te.default,{onClick:e.handleHistory,variant:"last",children:e.texts.history}),a.jsx(te.default,{onClick:e.handleHome,variant:"last",children:e.texts.homePage}),a.jsx(ue.default,{align:"center",variant:"body2",style:{marginTop:10},children:e.texts.fasterPaymentNote})]}),a.jsx("a",{style:{marginTop:10,paddingTop:10,padding:5,cursor:"pointer"},onClick:e.handleRefundPolicyLink,children:a.jsx(ue.default,{align:"center",variant:"caption",fontWeight:500,children:e.texts.refundPolicy})})]})},exports.CreditCardForm=function(e){var t,r=q.useForm(),l=r.formState.errors,n=r.handleSubmit,i=r.control;return a.jsx(de.default,{maxWidth:"xs",children:a.jsxs("form",{onSubmit:n(e.handle),children:[a.jsx(at,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"tel",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=l.password)||void 0===t?void 0:t.message}),a.jsx(q.Controller,{control:i,name:"cardName",render:function(e){var t;return e.field,a.jsx(at,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(t=l.password)||void 0===t?void 0:t.message})}}),a.jsx(q.Controller,{control:i,name:"cardName",render:function(e){var t;return e.field,a.jsx(at,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Expiry Date",rules:{required:"Password is rquired"},helperText:null===(t=l.password)||void 0===t?void 0:t.message})}}),a.jsx(q.Controller,{control:i,name:"cardName",render:function(e){var t;return e.field,a.jsx(at,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"CCV",rules:{required:"Password is rquired"},helperText:null===(t=l.password)||void 0===t?void 0:t.message})}}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})})},exports.HawaAlert=dt,exports.HawaAppBar=function(e){var t=Q.useTheme(),r=Ye(ee.default.useState(null),2),l=r[0],n=r[1],i=Ye(ee.default.useState(null),2),o=i[0],s=i[1],d=function(){n(null)};return console.log("theme is ",t),a.jsx(Oe.default,{position:"static",variant:"appbar",children:a.jsx(de.default,{maxWidth:"xl",variant:"appbar",children:a.jsxs(Ie.default,{disableGutters:!0,children:[a.jsx(ue.default,{variant:"h6",noWrap:!0,component:"div",sx:{mr:2,display:{xs:"none",md:"flex"}},children:"LOGO"}),a.jsxs(Le.default,{sx:{flexGrow:1,display:{xs:"flex",md:"none"}},children:[a.jsx(Re.default,{size:"large","aria-label":"account of current user","aria-controls":"menu-appbar","aria-haspopup":"true",onClick:e.handleOpenSideMenu,color:"inherit",children:a.jsx(ze.default,{})}),a.jsx(Ge.default,{id:"menu-appbar",anchorEl:l,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"left"},open:Boolean(l),onClose:d,sx:{display:{xs:"block",md:"none"}},children:yt.map((function(e){return a.jsx(Ee.default,{onClick:d,children:a.jsx(ue.default,{textAlign:"center",children:e})},e)}))})]}),a.jsx(ue.default,{variant:"h6",noWrap:!0,component:"div",sx:{flexGrow:1,display:{xs:"flex",md:"none"}},children:"LOGO"}),a.jsx(Le.default,{sx:{flexGrow:1,display:{xs:"none",md:"flex"}},children:yt.map((function(e){return a.jsx(te.default,{onClick:d,sx:{my:2,display:"block"},children:e},e)}))}),a.jsxs(Le.default,{sx:{flexGrow:0},children:[a.jsx(re.default,{title:"Open settings",children:a.jsx(Re.default,{onClick:function(e){s(e.currentTarget)},sx:{p:0},children:a.jsx(He.default,{alt:"Remy Sharp",src:"/static/images/avatar/2.jpg"})})}),a.jsx(jt,{anchor:o,handleClose:function(e){return s(null)},menuItems:e.accountMenu})]})]})})})},exports.HawaAppLayout=function(e){var t=O.useTheme(),r=Ye(ee.default.useState(!0),2),l=r[0],n=r[1],i=Ye(ee.default.useState(null),2);i[0],i[1];var o=Ye(ee.default.useState(null),2),s=o[0],d=o[1];return a.jsxs(Le.default,{sx:{display:"flex"},children:[a.jsx(mt,{variant:"appbar",position:"fixed",open:l,children:a.jsxs(Ie.default,{variant:"appbar",children:[a.jsx(Re.default,{color:"inherit","aria-label":"open drawer",onClick:function(){n(!0)},edge:"start",sx:Je({marginRight:5},l&&{display:"none"}),children:a.jsx(ze.default,{})}),a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",margin:0},children:[a.jsx(ue.default,{variant:"h6",noWrap:!0,component:"div",children:e.pageTitle}),a.jsxs(Le.default,{children:[a.jsx(re.default,{title:"Open settings",children:a.jsx(Re.default,{onClick:function(e){d(e.currentTarget)},sx:{p:0},children:a.jsx(He.default,{alt:"Remy Sharp",src:"/static/images/avatar/2.jpg"})})}),a.jsx(Ge.default,{sx:{mt:"45px"},id:"menu-appbar",anchorEl:s,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:Boolean(s),onClose:function(){d(null)},variant:"themed",PaperProps:{style:{boxShadow:"none",borderRadius:t.allBorderRadius,border:"1px solid ".concat(t.primaryActionColor)}},children:e.accountMenu.map((function(e){return a.jsxs(Ee.default,{onClick:e.action,children:[e.icon&&a.jsx(e.icon,{}),a.jsx(ue.default,{textAlign:"center",children:e.label})]},e.label)}))})]})]})]})}),a.jsxs(pt,{variant:"permanent",open:l,children:[a.jsxs(ft,{children:[e.logo,a.jsx(Re.default,{onClick:function(){n(!1)},children:"rtl"===t.direction?a.jsx(Ne.default,{}):a.jsx(Be.default,{})})]}),a.jsx(We.default,{}),a.jsx(Fe.default,{children:e.pages.map((function(t,r){var n,i;return a.jsx(re.default,{title:t.text,placement:"right",arrow:!0,PopperProps:{style:{opacity:l?0:1}},children:a.jsxs(De.default,{variant:(null===(n=e.pageName)||void 0===n?void 0:n.toLowerCase())===(null===(i=t.slug)||void 0===i?void 0:i.toLowerCase())&&"clicked",onClick:t.action,sx:{minHeight:48,justifyContent:l?"initial":"center",px:2.5},children:[a.jsx(t.icon,{}),a.jsx("div",{style:{width:20}}),a.jsx(Me.default,{primary:t.text,sx:{opacity:l?1:0}})]},t.text)},r)}))})]}),a.jsxs(Le.default,{sx:{flexGrow:1,p:3},children:[a.jsx(ft,{}),e.children]})]})},exports.HawaButton=function(e){return a.jsx(te.default,Je(Je({},e),{},{children:e.children}))},exports.HawaCheckbox=function(e){return console.log("props : ",e),a.jsx(ee.default.Fragment,{children:a.jsx(oe.default,{label:e.label,control:a.jsx(se.default,{style:{color:e.color||null},defaultChecked:e.defaultValue})})})},exports.HawaDialog=function(t){var r=Ye(e.useState(!1),2);return r[0],r[1],a.jsxs(Ze.default,Je(Je({},t),{},{variant:"main",children:[a.jsx(gt,{onClose:t.onClose,hideClose:t.hideClose,children:t.title}),a.jsx(_e.default,{children:t.children}),a.jsx($e.default,{children:t.actions})]}))},exports.HawaInputLabel=function(e){return a.jsx(he.default,{children:a.jsx("div",{style:{fontSize:15},children:e.label})})},exports.HawaItemCard=function(e){var t="ar"===e.lang;return a.jsxs(de.default,{onClick:function(t){t.stopPropagation(),e.onCardClick()},maxWidth:"xs",variant:"card-container",dataValue:"parent",style:{direction:t?"rtl":"ltr"},children:[e.header&&a.jsxs(de.default,{style:{zIndex:20},variant:"card-header",children:[e.headerActions&&a.jsx("div",{style:{margin:0,marginRight:-20,marginLeft:-20,marginBottom:-20,display:"flex",paddingTop:5,paddingLeft:5,paddingRight:5,justifyContent:"flex-end"},children:e.headerActions}),e.header]}),e.content&&a.jsx(de.default,{style:{zIndex:20},variant:"card-content",children:e.content}),e.actions&&a.jsx(de.default,{style:{zIndex:20},variant:"card-actions",children:e.actions})]})},exports.HawaLogoButton=ot,exports.HawaPricingCard=function(e){var t,r,l="ar"===e.lang,n={monthly:"شهرياً","3-months":"كل 3 أشهر","6-months":"كل 6 أشهر",annually:"سنوياً"},i={monthly:"Monthly","3-months":"3 Months","6-months":"6 Months",annually:"Annually"},o={usd:l?"دولار":"$",sar:l?"ريال":"SAR"},s=l?e.features_ar:e.features;return a.jsxs(de.default,{maxWidth:"xs",variant:e.selectedPlan?"selected-plan-card":"plan-card",style:{direction:l?"rtl":"ltr"},children:[a.jsxs(de.default,{variant:"plan-header",children:[a.jsx(ue.default,{variant:"h3",fontWeight:500,children:l?e.title_ar:e.title}),a.jsx(ue.default,{variant:"caption",children:l?e.subtitle_ar:e.subtitle}),a.jsx("br",{}),a.jsx(ue.default,{variant:"h4",fontWeight:500,style:{display:"flex",alignItems:"center"},children:"ar"===e.lang?a.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center"},children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[e.price,a.jsx("div",{style:{width:5}}),a.jsx(ue.default,{children:o[null===(t=e.currency)||void 0===t?void 0:t.toLowerCase()]})]}),a.jsx(ue.default,{style:{fontSize:14,margin:5},children:l?n[e.cycleText]:i[e.cycleText]})]}):a.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center"},children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[a.jsx(ue.default,{children:o[null===(r=e.currency)||void 0===r?void 0:r.toLowerCase()]}),a.jsx("div",{style:{width:5}}),e.price]}),a.jsx(ue.default,{style:{fontSize:14,margin:5},children:"ar"===e.lang?n[e.cycleText]:i[e.cycleText]})]})})]}),a.jsx("div",{style:{padding:20,color:e.selectedPlan?"white":"black"},children:null==s?void 0:s.map((function(e){return a.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",marginTop:10,width:"100%"},children:[a.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",width:"10%"},children:a.jsx(ce.default,{fontSize:"small"})}),a.jsx("div",{style:{width:10}}),a.jsx(ue.default,{variant:"subtitle2",children:e})]})}))}),a.jsx(te.default,{onClick:e.selectPlan,variant:e.selectedPlan?"outlined":"contained",style:{margin:20},children:e.buttonText})]})},exports.HawaRadio=rt,exports.HawaSelect=st,exports.HawaSettingsRow=it,exports.HawaTable=ut,exports.HawaTextField=at,exports.HawaTypography=lt,exports.NewPasswordForm=function(t){var r=Ye(e.useState(""),2);r[0],r[1];var l=Ye(e.useState(""),2);l[0],l[1];var n=Ye(e.useState(!1),2),i=n[0],o=n[1],s=q.useForm(),d=s.formState.errors,u=s.handleSubmit,c=s.control;return a.jsxs(de.default,{maxWidth:"xs",variant:"auth",children:[i&&a.jsx(dt,{text:t.texts.passwordMatchError,severity:"error"}),t.passwordChanged?a.jsx(lt,{style:{textAlign:"center",margin:5},children:t.texts.passwordChanged}):a.jsx(q.FormProvider,Je(Je({},s),{},{children:a.jsxs("form",{onSubmit:u((function(e){console.log("handling subb",e),e.password===e.confirmPassword?t.handleNewPassword():o(!0)})),children:[a.jsx(q.Controller,{control:c,name:"password",render:function(e){var r,l,n=e.field;return a.jsx(at,Je({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,helperText:null===(l=d.password)||void 0===l?void 0:l.message,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(qe.default,{})})},n))},rules:{required:t.texts.passwordRequiredText}}),a.jsx(q.Controller,{control:c,name:"confirmPassword",render:function(e){var r,l,n=e.field;return a.jsx(at,Je({fullWidth:!0,type:"password",value:null!==(r=n.value)&&void 0!==r?r:"",label:t.texts.confirmPasswordLabel,placeholder:t.texts.confirmPasswordPlaceholder,helperText:null===(l=d.confirmPassword)||void 0===l?void 0:l.message,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(qe.default,{})})},n))},rules:{required:t.texts.confirmPasswordRequiredText}}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.OfflineBanner=function(e){return a.jsx(ae.default,{variant:"danger",open:e.open,onClose:e.handleClose,children:a.jsxs(ie.default,{icon:!1,severity:"error",variant:"offline",children:[e.title&&a.jsx(ne.default,{children:e.title}),e.text]})})},exports.PayWithWallet=function(e){return a.jsxs(de.default,{maxWidth:"xs",children:[a.jsx(ue.default,{align:"center",children:"Wallet Balance"}),a.jsxs(ue.default,{align:"center",variant:"h1",children:[e.walletBalance||"0",a.jsx(ue.default,{children:e.currency||"SAR"})]}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t=q.useForm(),r=t.formState.errors,l=t.handleSubmit;t.register;var n=t.control;return a.jsx(de.default,{maxWidth:"xs",variant:"auth",children:e.sent?a.jsx(lt,{style:{textAlign:"center",margin:5},children:e.emailSentText}):a.jsxs("form",{onSubmit:l(e.handleResetPassword),children:[a.jsx(q.Controller,{control:n,name:"email",render:function(t){var l,n,i=t.field;return a.jsx(at,Je({fullWidth:!0,type:"text",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.emailLabel,helperText:null===(n=r.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(Se.default,{})})},i))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})})},exports.SelectPayment=function(e){return a.jsxs(de.default,{maxWidth:"xs",children:[a.jsx(lt,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(ot,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(ot,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a.jsx(ot,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a.jsx(ot,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(ot,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(ot,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(ot,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t=q.useForm(),r=t.formState.errors,l=t.handleSubmit,n=t.control;return a.jsxs(de.default,{maxWidth:"xs",variant:"auth",style:{direction:"ar"===e.lang?"rtl":"ltr"},children:[e.showError&&a.jsx(dt,{title:e.errorTitle,text:e.errorText,severity:"error"}),a.jsxs("form",{onSubmit:l(e.handleSignIn),children:[a.jsx(q.Controller,{control:n,name:"email",render:function(t){var l,n,i=t.field;return a.jsx(at,Je({fullWidth:!0,type:"text",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.emailLabel,helperText:null===(n=r.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(Se.default,{})})},i))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(q.Controller,{control:n,name:"password",render:function(t){var l,n,i,o=t.field;return a.jsx(at,Je({fullWidth:!0,type:"password",defaultValue:null!==(l=o.value)&&void 0!==l?l:"",value:null!==(n=o.value)&&void 0!==n?n:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(i=r.password)||void 0===i?void 0:i.message,startAdornment:a.jsx(Pe.default,{position:"start",children:a.jsx(qe.default,{})})},o))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(ue.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]}),a.jsxs(ue.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),a.jsx(We.default,{}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(ot,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(ot,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(ot,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=ct,exports.UserProfileForm=function(e){var t=q.useForm(),r=t.formState.errors,l=t.handleSubmit,n=t.control;return a.jsx(de.default,{maxWidth:"sm",children:a.jsx(q.FormProvider,Je(Je({},t),{},{children:a.jsxs("form",{onSubmit:l(e.handleUpdateProfile),children:[a.jsx(q.Controller,{control:n,name:"fullName",render:function(t){var l,n,i=t.field;return a.jsx(at,Je({fullWidth:!0,type:"text",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.fullNameLabel,placeholder:e.texts.fullNamePlaceholder,helperText:null===(n=r.fullName)||void 0===n?void 0:n.message},i))}}),a.jsx(q.Controller,{control:n,name:"phoneNumber",render:function(e){var t=e.field;return a.jsx(at,Je({fullWidth:!0,type:"tel",label:"Phone Number",placeholder:"+966"},t))}}),a.jsx(q.Controller,{control:n,name:"email",render:function(t){var l,n,i=t.field;return a.jsx(at,Je({fullWidth:!0,type:"text",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.emailLabel,helperText:null===(n=r.email)||void 0===n?void 0:n.message,placeholder:e.texts.emailPlaceholder},i))},rules:{required:e.texts.emailRequiredText,pattern:{value:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,message:e.texts.emailInvalidText}}}),a.jsx(q.Controller,{control:n,name:"password",render:function(t){var l,n,i=t.field;return a.jsx(at,Je({fullWidth:!0,type:"password",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.passwordLabel,placeholder:e.texts.passwordPlaceholder,helperText:null===(n=r.password)||void 0===n?void 0:n.message},i))},rules:{required:e.texts.passwordRequiredText}}),a.jsx(q.Controller,{control:n,name:"confirmPassword",render:function(t){var l,n,i=t.field;return a.jsx(at,Je({fullWidth:!0,type:"password",value:null!==(l=i.value)&&void 0!==l?l:"",label:e.texts.confirmPasswordLabel,placeholder:e.texts.confirmPasswordPlaceholder,helperText:null===(n=r.confirmPassword)||void 0===n?void 0:n.message},i))},rules:{required:e.texts.confirmPasswordRequiredText}}),a.jsx(te.default,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettingsForm=function(e){return a.jsxs(de.default,{maxWidth:"sm",children:[e.children,a.jsx(te.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.23",
3
+ "version": "0.0.26",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -33,7 +33,7 @@ export const NewPasswordForm = (props) => {
33
33
  )}
34
34
  {props.passwordChanged ? (
35
35
  <HawaTypography style={{ textAlign: "center", margin: 5 }}>
36
- Your password has been changed, you'll be redirected to sign in page
36
+ {props.texts.passwordChanged}
37
37
  </HawaTypography>
38
38
  ) : (
39
39
  <FormProvider {...methods}>
@@ -16,15 +16,8 @@ export const ResetPasswordForm = (props) => {
16
16
  } = methods;
17
17
  return (
18
18
  <Container maxWidth="xs" variant="auth">
19
- {props.error && (
20
- <Alert severity="error">
21
- {props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
22
- {props.errorText}
23
- </Alert>
24
- )}
25
19
  {!props.sent ? (
26
20
  <form onSubmit={handleSubmit(props.handleResetPassword)}>
27
- {console.log("eror ", errors.email?.message)}
28
21
  <Controller
29
22
  control={control}
30
23
  name="email"
@@ -59,7 +52,7 @@ export const ResetPasswordForm = (props) => {
59
52
  </form>
60
53
  ) : (
61
54
  <HawaTypography style={{ textAlign: "center", margin: 5 }}>
62
- An link was sent to your email to reset the password.
55
+ {props.emailSentText}
63
56
  </HawaTypography>
64
57
  )}
65
58
  </Container>
@@ -1,6 +1,6 @@
1
- import React, { useState } from "react";
2
- import { HawaTextField, HawaLogoButton } from "../../elements";
3
- import { Controller, FormProvider, useForm } from "react-hook-form";
1
+ import React from "react";
2
+ import { HawaTextField, HawaLogoButton, HawaAlert } from "../../elements";
3
+ import { Controller, useForm } from "react-hook-form";
4
4
  import InputAdornment from "@mui/material/InputAdornment";
5
5
  import EmailIcon from "@mui/icons-material/MailOutline";
6
6
  import PasswordIcon from "@mui/icons-material/HttpsOutlined";
@@ -16,7 +16,6 @@ export const SignInForm = (props) => {
16
16
  const {
17
17
  formState: { errors },
18
18
  handleSubmit,
19
- register,
20
19
  control
21
20
  } = methods;
22
21
 
@@ -26,11 +25,12 @@ export const SignInForm = (props) => {
26
25
  variant="auth"
27
26
  style={{ direction: props.lang === "ar" ? "rtl" : "ltr" }}
28
27
  >
29
- {props.error && (
30
- <Alert severity="error">
31
- {props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
32
- {props.errorText}
33
- </Alert>
28
+ {props.showError && (
29
+ <HawaAlert
30
+ title={props.errorTitle}
31
+ text={props.errorText}
32
+ severity="error"
33
+ />
34
34
  )}
35
35
  <form onSubmit={handleSubmit(props.handleSignIn)}>
36
36
  <Controller
@@ -28,7 +28,7 @@ export const SignUpForm = (props) => {
28
28
  style={{ direction: props.lang === "ar" ? "rtl" : "ltr" }}
29
29
  >
30
30
  {props.error && (
31
- <Alert severity="error">
31
+ <Alert severity="error" variant="inContainer">
32
32
  {props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
33
33
  {props.errorText}
34
34
  </Alert>