@sikka/hawa 0.0.11 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -3
- package/src/blocks/Account/{UserProfile.js → UserProfileForm.js} +16 -7
- package/src/blocks/Account/UserSettingsForm.js +13 -0
- package/src/blocks/Account/index.js +2 -2
- package/src/blocks/AuthForms/NewPasswordForm.js +1 -1
- package/src/blocks/AuthForms/ResetPasswordForm.js +1 -1
- package/src/blocks/AuthForms/SignInForm.js +10 -11
- package/src/blocks/AuthForms/SignUpForm.js +2 -1
- package/src/blocks/Payment/ChargeWalletForm.js +40 -37
- package/src/blocks/Payment/CreditCardForm.js +50 -45
- package/src/blocks/Payment/PayWithWallet.js +17 -7
- package/src/blocks/Payment/SelectPayment.js +8 -9
- package/src/blocks/Pricing/PricingPlans.js +47 -0
- package/src/{ui → elements}/ActionButton.js +0 -0
- package/src/elements/AdaptiveButton.js +32 -0
- package/src/{ui → elements}/AutoCompleteField.js +0 -0
- package/src/{ui → elements}/DragDropImages.js +0 -0
- package/src/{ui → elements}/Hawa.js +0 -0
- package/src/{ui → elements}/HawaAlert.js +0 -0
- package/src/{ui → elements}/HawaButton.js +0 -0
- package/src/{ui → elements}/HawaCheckbox.js +0 -0
- package/src/{ui → elements}/HawaInputLabel.js +0 -0
- package/src/{ui → elements}/HawaLogoButton.js +0 -0
- package/src/elements/HawaPricingCard.js +115 -0
- package/src/elements/HawaRadio.js +30 -0
- package/src/elements/HawaSettingsRow.js +27 -0
- package/src/elements/HawaSwitch.js +6 -0
- package/src/{ui → elements}/HawaTextArea.js +0 -0
- package/src/{ui → elements}/HawaTextField.js +0 -0
- package/src/{ui → elements}/HawaTypography.js +0 -0
- package/src/{ui → elements}/RadioBox.js +0 -0
- package/src/{ui → elements}/Row.js +0 -0
- package/src/{ui → elements}/SelectedField.js +0 -0
- package/src/{ui → elements}/StyledTooltip.js +0 -0
- package/src/{ui → elements}/TabPanel.js +0 -0
- package/src/{ui → elements}/index.js +1 -1
- package/src/stories/BlocksStories/Account/UserProfile.stories.js +21 -0
- package/src/stories/BlocksStories/Account/UserSettings.stories.js +55 -0
- package/src/stories/BlocksStories/Auth/NewPassword.stories.js +60 -0
- package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +59 -0
- package/src/stories/BlocksStories/Auth/SignIn.stories.js +89 -0
- package/src/stories/BlocksStories/Auth/SignUp.stories.js +90 -0
- package/src/stories/BlocksStories/Payment/ChargeWallet.stories.js +30 -0
- package/src/stories/BlocksStories/Payment/PayWithCreditCard.stories.js +37 -0
- package/src/stories/BlocksStories/Payment/PayWithWallet.stories.js +17 -0
- package/src/stories/BlocksStories/{PaymentForm.stories.js → Payment/PaymentSelection.stories.js} +12 -23
- package/src/stories/BlocksStories/Pricing/BillingPlans.stories.js +46 -0
- package/src/stories/BlocksStories/Pricing/LandingPlans.stories.js +45 -0
- package/src/stories/ElementsStories/AdaptiveButton.stories.js +51 -0
- package/src/stories/{UIStories → ElementsStories}/Alert.stories.js +1 -1
- package/src/stories/{UIStories → ElementsStories}/InputLabel.stories.js +1 -1
- package/src/stories/ElementsStories/ItemCard.stories.js +18 -0
- package/src/stories/ElementsStories/LogoButtons.stories.js +73 -0
- package/src/stories/ElementsStories/PricingCard.stories.js +91 -0
- package/src/stories/ElementsStories/RadioSelector.stories.js +36 -0
- package/src/stories/ElementsStories/SettingsRow.stories.js +63 -0
- package/src/stories/{UIStories → ElementsStories}/TextField.stories.js +1 -1
- package/src/stories/LayoutStories/Box.stories.js +10 -24
- package/src/styles.css +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/main.e382d866.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.f8d30727.iframe.bundle.js.LICENSE.txt → vendors~main.5eab66d3.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js.map +1 -0
- package/src/blocks/Account/UserSettings.js +0 -14
- package/src/stories/BlocksStories/AuthForm.stories.js +0 -171
- package/src/stories/BlocksStories/UserForm.stories.js +0 -27
- package/src/stories/UIStories/ActionButton.stories.js +0 -41
- package/src/stories/UIStories/AdaptiveButton.stories.js +0 -76
- package/src/stories/UIStories/CheckBox.stories.js +0 -34
- package/src/stories/UIStories/LogoButtons.stories.js +0 -86
- package/src/stories/UIStories/RadioSelector.stories.js +0 -50
- package/src/stories/UIStories/SettingsRow.stories.js +0 -51
- package/src/themes/HawaProvider.js +0 -192
- package/src/themes/QawaimTheme.js +0 -199
- package/src/ui/AdaptiveButton.js +0 -131
- package/src/ui/HawaRadio.js +0 -64
- package/src/ui/HawaSettingsRow.js +0 -45
- package/storybook-static/main.b00949db.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.f8d30727.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.f8d30727.iframe.bundle.js.map +0 -1
package/es/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as e}from"react";import t from"@mui/material/Button";import"@mui/material/Tooltip";import r from"prop-types";import{jsx as a,jsxs as l,Fragment as i}from"react/jsx-runtime";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import{Typography as n,Button as o,Container as s}from"@mui/material";import"@mui/material/TextField";import d from"@mui/material/Typography";import u from"@mui/icons-material/GitHub";import m from"@mui/icons-material/Twitter";import p from"@mui/icons-material/AccountBalanceWallet";import c from"@mui/material/Input";import h from"@mui/material/InputLabel";import g from"@mui/material/Alert";import b from"@mui/material/AlertTitle";import{useForm as f,FormProvider as x}from"react-hook-form";import y from"@mui/material/Container";import v from"@mui/material/InputAdornment";import w from"@mui/icons-material/HttpsOutlined";import T from"@mui/icons-material/MailOutline";import P from"@mui/icons-material/PermIdentityOutlined";function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,l,i=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){o=!0,l=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw l}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return L(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 L(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 L(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}r.string,r.bool,r.bool,r.bool;var W=function(e){return a(t,k(k({},e),{},{children:e.text}))},q=function(e){return a("div",{children:e.children})},O=function(e){return a(d,k(k({},e),{},{children:e.children}))};r.oneOf(["text","number","password"]),r.string;var I=function(e){var r,i="";switch(null===(r=e.logo)||void 0===r?void 0:r.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(u,{});break;case"twitter":i=a(m,{});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(p,{})}return l(t,k(k({},e),{},{variant:"withLogo",children:[i,a("div",{style:{width:10}}),a(n,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},j=function(e){return l(i,{children:[a(h,{children:e.label}),a(c,k({disableUnderline:!0},e))]})},E=function(e){return l(g,{children:[e.title&&a(b,{children:e.title}),e.text]})},z=function(e){var t,r,i,n,s=f(),d=s.formState.errors;return s.handleSubmit,a(y,{maxWidth:"xs",children:a(x,k(k({},s),{},{children:l("form",{children:[a(j,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(t=d.fullName)||void 0===t?void 0:t.message}),a(j,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(r=d.email)||void 0===r?void 0:r.message}),a(j,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(i=d.password)||void 0===i?void 0:i.message}),a(j,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(n=d.confirmPassword)||void 0===n?void 0:n.message}),a(o,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},G=function(e){return l(q,{maxWidth:400,children:[a(j,{type:"text",inputLabel:"First Name"}),a(j,{type:"text",inputLabel:"Last Name"}),a(j,{type:"email",inputLabel:"Email"}),a(j,{type:"password",inputLabel:"Password"}),a(W,{last:!0,text:"Update Account"})]})},N=function(r){var i,n,o=A(e(""),2),s=o[0],d=o[1],u=f(),m=u.formState.errors,p=u.handleSubmit;return l(y,{maxWidth:"xs",variant:"auth",children:[r.error&&a(E,{text:"This is a new password alert",severity:"error"}),r.passwordChanged?a(O,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a(x,k(k({},u),{},{children:l("form",{onSubmit:p(r.handleNewPassword),children:[a(j,{fullWidth:!0,name:"password",type:"password",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,onChange:function(e){return d(e.target.value)},value:s,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:r.texts.passwordRequiredText},helperText:null===(i=m.password)||void 0===i?void 0:i.message}),a(j,{fullWidth:!0,name:"confirmPassword",type:"password",placeholder:r.texts.confirmPasswordPlaceholder,label:r.texts.confirmPasswordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:"Password is rquired"},helperText:null===(n=m.confirmPassword)||void 0===n?void 0:n.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},M=function(e){var r,i=f(),n=i.formState.errors,o=i.handleSubmit;return i.getValues,i.register,i.watch,i.reset,i.setValue,l(y,{maxWidth:"xs",variant:"auth",children:[e.error&&l(Alert,{severity:"error",children:[e.errorTitle&&a(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a(O,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a(x,k(k({},i),{},{children:l("form",{onSubmit:o(e.handleResetPassword),children:[a(j,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a(v,{position:"start",children:a(T,{})}),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}},helperText:null===(r=n.email)||void 0===r?void 0:r.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})}))]})},U=function(e){var r,i,n,o=f(),s=o.formState.errors,u=o.handleSubmit;return l(y,{maxWidth:"xs",variant:"auth",children:[e.error&&l(g,{severity:"error",children:[e.errorTitle&&a(AlertTitle,{children:e.errorTitle}),e.errorText]}),a(x,k(k({},o),{},{children:l("form",{onSubmit:u(e.handleSignUp),children:[a(j,{fullWidth:!0,type:"text",label:e.texts.fullNameLabel,name:"fullName",placeholder:e.texts.fullNamePlaceholder,inputLabel:e.texts.fullNameLabel,startAdornment:a(v,{position:"start",children:a(P,{})}),helperText:null===(r=s.fullName)||void 0===r?void 0:r.message}),a(j,{fullWidth:!0,type:"text",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,name:"email",startAdornment:a(v,{position:"start",children:a(T,{})}),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}},helperText:null===(i=s.email)||void 0===i?void 0:i.message}),a(j,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:e.texts.passwordRequiredText,minLength:{value:8,message:e.texts.passwordTooShortText}},helperText:null===(n=s.password)||void 0===n?void 0:n.message}),a(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),l(d,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(I,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a(I,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a(I,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};U.propTypes={theme:r.oneOf(["secondary","primary"])};var B=function(e){var r,i,n=f(),o=n.formState.errors,s=n.handleSubmit;return l(y,{maxWidth:"xs",variant:"auth",children:[e.error&&l(g,{severity:"error",children:[e.errorTitle&&a(AlertTitle,{children:e.errorTitle}),e.errorText]}),a(x,k(k({},n),{},{children:l("form",{onSubmit:s(e.handleSignIn),children:[a(j,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a(v,{position:"start",children:a(T,{})}),rules:{required:e.texts.emailRequired,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}},helperText:null===(r=o.email)||void 0===r?void 0:r.message}),a(j,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:e.texts.passwordRequired},helperText:null===(i=o.password)||void 0===i?void 0:i.message}),a(O,{style:{cursor:"pointer",marginTop:5,width:"max-content",padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]})})),l(O,{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})]}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(I,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a(I,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a(I,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},R=function(e){return l(s,{maxWidth:"xs",children:[a(O,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a(I,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a(I,{logo:"visa/master",buttonText:e.visaMasterLabel,handleClick:e.handleCreditCard}),e.viaMada&&a(I,{logo:"mada",buttonText:e.madaLabel,handleClick:e.handleMada}),e.viaSTCPay&&a(I,{logo:"stcpay",buttonText:e.stcPayLabel,handleClick:e.handleSTCPay}),e.viaPayPal&&a(I,{logo:"paypal",buttonText:e.paypalLabel,handleClick:e.handlePayPal}),e.viaGooglePay&&a(I,{logo:"googlepay",buttonText:e.googlePayLabel,handleClick:e.handleGooglePay}),e.viaApplePay&&a(I,{logo:"applepay",buttonText:e.applePayLabel,handleClick: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 F=function(e){var t,r,i=f(),n=i.formState.errors,o=i.handleSubmit;return a(q,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a(q,{noMargin:!0,children:a(x,k(k({},i),{},{children:l("form",{onSubmit:o(e.handle),children:[a(j,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a(j,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a(W,{last:!0,fullWidth:!0,text:"Sign In",onClick:e.handleSignIn})]})}))})})},D=function(t){var r,i=A(e(0),2),n=i[0],o=i[1],s=f(),d=s.formState.errors,u=s.handleSubmit;return a(q,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:l(q,{noMargin:!0,children:[l(O,{variant:"h2",align:"center",children:[Number(n).toLocaleString("en")," ",a("span",{style:{fontSize:20,letterSpacing:1},children:t.currency})]}),a(x,k(k({},s),{},{children:l("form",{onChange:function(e){e.preventDefault(),o(s.getValues().amount)},style:{marginTop:10},onSubmit:u(t.handleChargeWallet),children:[a(j,{name:"amount",placeholder:"Enter amount",type:"number",value:n,rules:{required:"Password is rquired"},helperText:null===(r=d.amount)||void 0===r?void 0:r.message}),a(W,{last:!0,fullWidth:!0,text:"Charge Wallet",onClick:t.handleSignIn})]})}))]})})},Z=function(e){return a(q,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:l(q,{noMargin:!0,children:[a("div",{children:"Wallet Balance"}),a(W,{text:"Pay now"})]})})};export{D as ChargeWalletForm,F as CreditCardForm,N as NewPasswordForm,Z as PayWithWallet,M as ResetPasswordForm,R as SelectPayment,B as SignInForm,U as SignUpForm,z as UserProfile,G as UserSettings};
|
|
1
|
+
import{useState as e}from"react";import t from"@mui/material/Button";import"@mui/material/Tooltip";import r from"prop-types";import{jsx as a,jsxs as l,Fragment as i}from"react/jsx-runtime";import"@mui/material/FormControlLabel";import"@mui/material/Checkbox";import n from"@mui/material/Container";import{Typography as o,Container as s,Button as d}from"@mui/material";import"@mui/icons-material/CheckCircleOutlined";import u from"@mui/material/Typography";import m from"@mui/material/Input";import p from"@mui/material/InputLabel";import c from"@mui/icons-material/GitHub";import h from"@mui/icons-material/Twitter";import g from"@mui/icons-material/AccountBalanceWallet";import b from"@mui/material/Alert";import f from"@mui/material/AlertTitle";import{useForm as x,FormProvider as y}from"react-hook-form";import v from"@mui/material/InputAdornment";import w from"@mui/icons-material/HttpsOutlined";import T from"@mui/icons-material/MailOutline";import P from"@mui/icons-material/PermIdentityOutlined";function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,l,i=[],n=!0,o=!1;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){o=!0,l=e}finally{try{n||null==r.return||r.return()}finally{if(o)throw l}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return A(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 A(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 A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}r.string,r.bool;var q=function(e){return a(u,S(S({},e),{},{children:e.children}))},L=function(e){return l(i,{children:[a(p,{children:e.label}),a(m,S({disableUnderline:!0},e))]})};r.oneOf(["text","number","password"]),r.string;var O=function(e){var r,i="";switch(null===(r=e.logo)||void 0===r?void 0:r.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(c,{});break;case"twitter":i=a(h,{});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(g,{})}return l(t,S(S({},e),{},{variant:"withLogo",children:[i,a("div",{style:{width:10}}),a(o,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},I=function(e){return l(b,{children:[e.title&&a(f,{children:e.title}),e.text]})},N=function(e){var r,i,o,s,d=x(),u=d.formState.errors;return a(n,{maxWidth:"sm",children:a(y,S(S({},d),{},{children:l("form",{children:[a(L,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(r=u.fullName)||void 0===r?void 0:r.message}),a(L,{fullWidth:!0,type:"text",name:"fullName",label:"Phone Number",placeholder:"+966",rules:{required:"Email is required"}}),a(L,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(i=u.email)||void 0===i?void 0:i.message}),a(L,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(o=u.password)||void 0===o?void 0:o.message}),a(L,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(s=u.confirmPassword)||void 0===s?void 0:s.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},j=function(e){return l(s,{maxWidth:"sm",children:[e.children,a(d,{type:"submit",fullWidth:!0,variant:"last",children:"Save Settings"})]})},E=function(r){var i,o,s=W(e(""),2),d=s[0],u=s[1],m=x(),p=m.formState.errors,c=m.handleSubmit;return l(n,{maxWidth:"xs",variant:"auth",children:[r.error&&a(I,{text:"This is a new password alert",severity:"error"}),r.passwordChanged?a(q,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a(y,S(S({},m),{},{children:l("form",{onSubmit:c(r.handleNewPassword),children:[a(L,{fullWidth:!0,name:"password",type:"password",label:r.texts.passwordLabel,placeholder:r.texts.passwordPlaceholder,onChange:function(e){return u(e.target.value)},value:d,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:r.texts.passwordRequiredText},helperText:null===(i=p.password)||void 0===i?void 0:i.message}),a(L,{fullWidth:!0,name:"confirmPassword",type:"password",placeholder:r.texts.confirmPasswordPlaceholder,label:r.texts.confirmPasswordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:"Password is rquired"},helperText:null===(o=p.confirmPassword)||void 0===o?void 0:o.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:r.texts.updatePassword})]})}))]})},z=function(e){var r,i=x(),o=i.formState.errors,s=i.handleSubmit;return i.getValues,i.register,i.watch,i.reset,i.setValue,l(n,{maxWidth:"xs",variant:"auth",children:[e.error&&l(Alert,{severity:"error",children:[e.errorTitle&&a(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a(q,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a(y,S(S({},i),{},{children:l("form",{onSubmit:s(e.handleResetPassword),children:[a(L,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a(v,{position:"start",children:a(T,{})}),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}},helperText:null===(r=o.email)||void 0===r?void 0:r.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})}))]})},G=function(e){var r,i,o,s=x(),d=s.formState.errors,m=s.handleSubmit;return l(n,{maxWidth:"xs",variant:"auth",children:[e.error&&l(b,{severity:"error",children:[e.errorTitle&&a(f,{children:e.errorTitle}),e.errorText]}),a(y,S(S({},s),{},{children:l("form",{onSubmit:m(e.handleSignUp),children:[a(L,{fullWidth:!0,type:"text",label:e.texts.fullNameLabel,name:"fullName",placeholder:e.texts.fullNamePlaceholder,inputLabel:e.texts.fullNameLabel,startAdornment:a(v,{position:"start",children:a(P,{})}),helperText:null===(r=d.fullName)||void 0===r?void 0:r.message}),a(L,{fullWidth:!0,type:"text",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,name:"email",startAdornment:a(v,{position:"start",children:a(T,{})}),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}},helperText:null===(i=d.email)||void 0===i?void 0:i.message}),a(L,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:e.texts.passwordRequiredText,minLength:{value:8,message:e.texts.passwordTooShortText}},helperText:null===(o=d.password)||void 0===o?void 0:o.message}),a(t,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),l(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(O,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a(O,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a(O,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};G.propTypes={theme:r.oneOf(["secondary","primary"])};var R=function(e){var r,i,o=x(),s=o.formState.errors,d=o.handleSubmit;return l(n,{maxWidth:"xs",variant:"auth",children:[e.error&&l(b,{severity:"error",children:[e.errorTitle&&a(f,{children:e.errorTitle}),e.errorText]}),a(y,S(S({},o),{},{children:l("form",{onSubmit:d(e.handleSignIn),children:[a(L,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a(v,{position:"start",children:a(T,{})}),rules:{required:e.texts.emailRequired,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}},helperText:null===(r=s.email)||void 0===r?void 0:r.message}),a(L,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a(v,{position:"start",children:a(w,{})}),rules:{required:e.texts.passwordRequired},helperText:null===(i=s.password)||void 0===i?void 0:i.message}),a(u,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a(t,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]})})),l(u,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),l("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a(O,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a(O,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a(O,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},B=function(e){return l(s,{maxWidth:"xs",children:[a(q,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a(O,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a(O,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a(O,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a(O,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a(O,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a(O,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a(O,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})};L.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 U=function(e){var t,r,i=x(),n=i.formState.errors,o=i.handleSubmit;return a(s,{maxWidth:"xs",children:a(y,S(S({},i),{},{children:l("form",{onSubmit:o(e.handle),children:[a(L,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=n.password)||void 0===t?void 0:t.message}),a(L,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"password",label:"Name On Card",rules:{required:"Password is rquired"},helperText:null===(r=n.password)||void 0===r?void 0:r.message}),a(d,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},D=function(r){var i,o=W(e(0),2),s=o[0],d=o[1],m=x(),p=m.formState.errors,c=m.handleSubmit;return l(n,{maxWidth:"xs",children:[l(u,{align:"center",variant:"h1",children:[Number(s).toLocaleString("en")||"0",a(u,{children:r.currency||"SAR"})]}),a(y,S(S({},m),{},{children:l("form",{onChange:function(e){e.preventDefault(),d(m.getValues().amount)},style:{marginTop:10},onSubmit:c(r.handleChargeWallet),children:[a(L,{fullWidth:!0,name:"amount",placeholder:"Enter amount",type:"number",value:s,rules:{required:"Password is rquired"},helperText:null===(i=p.amount)||void 0===i?void 0:i.message}),a(t,{type:"submit",fullWidth:!0,variant:"last",onClick:r.handleSignIn,children:"Charge Wallet"})]})}))]})},F=function(e){return l(s,{maxWidth:"xs",children:[a(o,{align:"center",children:"Wallet Balance"}),l(o,{align:"center",variant:"h1",children:[e.walletBalance||"0",a(o,{children:e.currency||"SAR"})]}),a(d,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})};export{D as ChargeWalletForm,U as CreditCardForm,E as NewPasswordForm,F as PayWithWallet,z as ResetPasswordForm,B as SelectPayment,R as SignInForm,G as SignUpForm,N as UserProfileForm,j as UserSettingsForm};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),a=require("react/jsx-runtime");require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox");var l=require("@mui/material");require("@mui/material/TextField");var s=require("@mui/material/Typography"),i=require("@mui/icons-material/GitHub"),n=require("@mui/icons-material/Twitter"),o=require("@mui/icons-material/AccountBalanceWallet"),d=require("@mui/material/Input"),u=require("@mui/material/InputLabel"),m=require("@mui/material/Alert"),x=require("@mui/material/AlertTitle"),p=require("react-hook-form"),c=require("@mui/material/Container"),h=require("@mui/material/InputAdornment"),g=require("@mui/icons-material/HttpsOutlined"),f=require("@mui/icons-material/MailOutline"),b=require("@mui/icons-material/PermIdentityOutlined");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=j(t),v=j(r),w=j(s),T=j(i),P=j(n),S=j(o),q=j(d),C=j(u),k=j(m),A=j(x),W=j(c),L=j(h),F=j(g),O=j(f),I=j(b);function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach((function(t){z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,l,s=[],i=!0,n=!1;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(s.push(a.value),!t||s.length!==t);i=!0);}catch(e){n=!0,l=e}finally{try{i||null==r.return||r.return()}finally{if(n)throw l}}return s}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return U(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 U(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 U(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}v.default.string,v.default.bool,v.default.bool,v.default.bool;var M=function(e){return a.jsx(y.default,N(N({},e),{},{children:e.text}))},R=function(e){return a.jsx("div",{children:e.children})},B=function(e){return a.jsx(w.default,N(N({},e),{},{children:e.children}))};v.default.oneOf(["text","number","password"]),v.default.string;var D=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(T.default,{});break;case"twitter":r=a.jsx(P.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(S.default,{})}return a.jsxs(y.default,N(N({},e),{},{variant:"withLogo",children:[r,a.jsx("div",{style:{width:10}}),a.jsx(l.Typography,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},Z=function(e){return a.jsxs(a.Fragment,{children:[a.jsx(C.default,{children:e.label}),a.jsx(q.default,N({disableUnderline:!0},e))]})},$=function(e){return a.jsxs(k.default,{children:[e.title&&a.jsx(A.default,{children:e.title}),e.text]})},_=function(e){var t,r,l,s=p.useForm(),i=s.formState.errors,n=s.handleSubmit;return a.jsxs(W.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(k.default,{severity:"error",children:[e.errorTitle&&a.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),a.jsx(p.FormProvider,N(N({},s),{},{children:a.jsxs("form",{onSubmit:n(e.handleSignUp),children:[a.jsx(Z,{fullWidth:!0,type:"text",label:e.texts.fullNameLabel,name:"fullName",placeholder:e.texts.fullNamePlaceholder,inputLabel:e.texts.fullNameLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(I.default,{})}),helperText:null===(t=i.fullName)||void 0===t?void 0:t.message}),a.jsx(Z,{fullWidth:!0,type:"text",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,name:"email",startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.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}},helperText:null===(r=i.email)||void 0===r?void 0:r.message}),a.jsx(Z,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:e.texts.passwordRequiredText,minLength:{value:8,message:e.texts.passwordTooShortText}},helperText:null===(l=i.password)||void 0===l?void 0:l.message}),a.jsx(y.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),a.jsxs(w.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(D,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a.jsx(D,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a.jsx(D,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};_.propTypes={theme:v.default.oneOf(["secondary","primary"])};Z.propTypes={theme:v.default.oneOf(["secondary","primary"]),viaApplePay:v.default.bool,viaGooglePay:v.default.bool,viaSTCPay:v.default.bool,viaCreditCard:v.default.bool,viaPayPal:v.default.bool,handleApplePay:v.default.func};exports.ChargeWalletForm=function(t){var r,l=G(e.useState(0),2),s=l[0],i=l[1],n=p.useForm(),o=n.formState.errors,d=n.handleSubmit;return a.jsx(R,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsxs(R,{noMargin:!0,children:[a.jsxs(B,{variant:"h2",align:"center",children:[Number(s).toLocaleString("en")," ",a.jsx("span",{style:{fontSize:20,letterSpacing:1},children:t.currency})]}),a.jsx(p.FormProvider,N(N({},n),{},{children:a.jsxs("form",{onChange:function(e){e.preventDefault(),i(n.getValues().amount)},style:{marginTop:10},onSubmit:d(t.handleChargeWallet),children:[a.jsx(Z,{name:"amount",placeholder:"Enter amount",type:"number",value:s,rules:{required:"Password is rquired"},helperText:null===(r=o.amount)||void 0===r?void 0:r.message}),a.jsx(M,{last:!0,fullWidth:!0,text:"Charge Wallet",onClick:t.handleSignIn})]})}))]})})},exports.CreditCardForm=function(e){var t,r,l=p.useForm(),s=l.formState.errors,i=l.handleSubmit;return a.jsx(R,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsx(R,{noMargin:!0,children:a.jsx(p.FormProvider,N(N({},l),{},{children:a.jsxs("form",{onSubmit:i(e.handle),children:[a.jsx(Z,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(t=s.password)||void 0===t?void 0:t.message}),a.jsx(Z,{name:"password",placeholder:"Enter password",type:"password",inputLabel:"Password",rules:{required:"Password is rquired"},helperText:null===(r=s.password)||void 0===r?void 0:r.message}),a.jsx(M,{last:!0,fullWidth:!0,text:"Sign In",onClick:e.handleSignIn})]})}))})})},exports.NewPasswordForm=function(t){var r,l,s=G(e.useState(""),2),i=s[0],n=s[1],o=p.useForm(),d=o.formState.errors,u=o.handleSubmit;return a.jsxs(W.default,{maxWidth:"xs",variant:"auth",children:[t.error&&a.jsx($,{text:"This is a new password alert",severity:"error"}),t.passwordChanged?a.jsx(B,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a.jsx(p.FormProvider,N(N({},o),{},{children:a.jsxs("form",{onSubmit:u(t.handleNewPassword),children:[a.jsx(Z,{fullWidth:!0,name:"password",type:"password",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,onChange:function(e){return n(e.target.value)},value:i,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:t.texts.passwordRequiredText},helperText:null===(r=d.password)||void 0===r?void 0:r.message}),a.jsx(Z,{fullWidth:!0,name:"confirmPassword",type:"password",placeholder:t.texts.confirmPasswordPlaceholder,label:t.texts.confirmPasswordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:"Password is rquired"},helperText:null===(l=d.confirmPassword)||void 0===l?void 0:l.message}),a.jsx(y.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.PayWithWallet=function(e){return a.jsx(R,{maxWidth:400,noColor:!0,noMargin:!0,noPadding:!0,children:a.jsxs(R,{noMargin:!0,children:[a.jsx("div",{children:"Wallet Balance"}),a.jsx(M,{text:"Pay now"})]})})},exports.ResetPasswordForm=function(e){var t,r=p.useForm(),l=r.formState.errors,s=r.handleSubmit;return r.getValues,r.register,r.watch,r.reset,r.setValue,a.jsxs(W.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(Alert,{severity:"error",children:[e.errorTitle&&a.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a.jsx(B,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a.jsx(p.FormProvider,N(N({},r),{},{children:a.jsxs("form",{onSubmit:s(e.handleResetPassword),children:[a.jsx(Z,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.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}},helperText:null===(t=l.email)||void 0===t?void 0:t.message}),a.jsx(y.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})}))]})},exports.SelectPayment=function(e){return a.jsxs(l.Container,{maxWidth:"xs",children:[a.jsx(B,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(D,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(D,{logo:"visa/master",buttonText:e.visaMasterLabel,handleClick:e.handleCreditCard}),e.viaMada&&a.jsx(D,{logo:"mada",buttonText:e.madaLabel,handleClick:e.handleMada}),e.viaSTCPay&&a.jsx(D,{logo:"stcpay",buttonText:e.stcPayLabel,handleClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(D,{logo:"paypal",buttonText:e.paypalLabel,handleClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(D,{logo:"googlepay",buttonText:e.googlePayLabel,handleClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(D,{logo:"applepay",buttonText:e.applePayLabel,handleClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t,r,l=p.useForm(),s=l.formState.errors,i=l.handleSubmit;return a.jsxs(W.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(k.default,{severity:"error",children:[e.errorTitle&&a.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),a.jsx(p.FormProvider,N(N({},l),{},{children:a.jsxs("form",{onSubmit:i(e.handleSignIn),children:[a.jsx(Z,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.default,{})}),rules:{required:e.texts.emailRequired,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}},helperText:null===(t=s.email)||void 0===t?void 0:t.message}),a.jsx(Z,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:e.texts.passwordRequired},helperText:null===(r=s.password)||void 0===r?void 0:r.message}),a.jsx(B,{style:{cursor:"pointer",marginTop:5,width:"max-content",padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a.jsx(y.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]})})),a.jsxs(B,{style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(D,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(D,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(D,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=_,exports.UserProfile=function(e){var t,r,s,i,n=p.useForm(),o=n.formState.errors;return n.handleSubmit,a.jsx(W.default,{maxWidth:"xs",children:a.jsx(p.FormProvider,N(N({},n),{},{children:a.jsxs("form",{children:[a.jsx(Z,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(t=o.fullName)||void 0===t?void 0:t.message}),a.jsx(Z,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(r=o.email)||void 0===r?void 0:r.message}),a.jsx(Z,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(s=o.password)||void 0===s?void 0:s.message}),a.jsx(Z,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(i=o.confirmPassword)||void 0===i?void 0:i.message}),a.jsx(l.Button,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettings=function(e){return a.jsxs(R,{maxWidth:400,children:[a.jsx(Z,{type:"text",inputLabel:"First Name"}),a.jsx(Z,{type:"text",inputLabel:"Last Name"}),a.jsx(Z,{type:"email",inputLabel:"Email"}),a.jsx(Z,{type:"password",inputLabel:"Password"}),a.jsx(M,{last:!0,text:"Update Account"})]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@mui/material/Button");require("@mui/material/Tooltip");var r=require("prop-types"),a=require("react/jsx-runtime");require("@mui/material/FormControlLabel"),require("@mui/material/Checkbox");var l=require("@mui/material/Container"),s=require("@mui/material");require("@mui/icons-material/CheckCircleOutlined");var i=require("@mui/material/Typography"),n=require("@mui/material/Input"),o=require("@mui/material/InputLabel"),d=require("@mui/icons-material/GitHub"),u=require("@mui/icons-material/Twitter"),m=require("@mui/icons-material/AccountBalanceWallet"),c=require("@mui/material/Alert"),h=require("@mui/material/AlertTitle"),x=require("react-hook-form"),p=require("@mui/material/InputAdornment"),f=require("@mui/icons-material/HttpsOutlined"),g=require("@mui/icons-material/MailOutline"),b=require("@mui/icons-material/PermIdentityOutlined");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=y(t),v=y(r),w=y(l),T=y(i),P=y(n),C=y(o),S=y(d),q=y(u),k=y(m),W=y(c),A=y(h),L=y(p),F=y(f),O=y(g),I=y(b);function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,l,s=[],i=!0,n=!1;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(s.push(a.value),!t||s.length!==t);i=!0);}catch(e){n=!0,l=e}finally{try{i||null==r.return||r.return()}finally{if(n)throw l}}return s}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(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 B(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 B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}v.default.string,v.default.bool;var R=function(e){return a.jsx(T.default,E(E({},e),{},{children:e.children}))},U=function(e){return a.jsxs(a.Fragment,{children:[a.jsx(C.default,{children:e.label}),a.jsx(P.default,E({disableUnderline:!0},e))]})};v.default.oneOf(["text","number","password"]),v.default.string;var D=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(S.default,{});break;case"twitter":r=a.jsx(q.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(k.default,{})}return a.jsxs(j.default,E(E({},e),{},{variant:"withLogo",children:[r,a.jsx("div",{style:{width:10}}),a.jsx(s.Typography,{style:{color:"black",fontSize:14,textAlign:"center",letterSpacing:.4,fontFamily:"Roboto",fontWeight:500},children:e.buttonText})]}))},M=function(e){return a.jsxs(W.default,{children:[e.title&&a.jsx(A.default,{children:e.title}),e.text]})},Z=function(e){var t,r,l,s=x.useForm(),i=s.formState.errors,n=s.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(W.default,{severity:"error",children:[e.errorTitle&&a.jsx(A.default,{children:e.errorTitle}),e.errorText]}),a.jsx(x.FormProvider,E(E({},s),{},{children:a.jsxs("form",{onSubmit:n(e.handleSignUp),children:[a.jsx(U,{fullWidth:!0,type:"text",label:e.texts.fullNameLabel,name:"fullName",placeholder:e.texts.fullNamePlaceholder,inputLabel:e.texts.fullNameLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(I.default,{})}),helperText:null===(t=i.fullName)||void 0===t?void 0:t.message}),a.jsx(U,{fullWidth:!0,type:"text",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,name:"email",startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.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}},helperText:null===(r=i.email)||void 0===r?void 0:r.message}),a.jsx(U,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:e.texts.passwordRequiredText,minLength:{value:8,message:e.texts.passwordTooShortText}},helperText:null===(l=i.password)||void 0===l?void 0:l.message}),a.jsx(j.default,{fullWidth:!0,variant:"last",type:"submit",children:e.texts.signUpText})]})})),a.jsxs(T.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:["Existing user?"," ",a.jsx("span",{onClick:e.handleRouteToSignIn,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signInText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(D,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignUp}),e.viaGithub&&a.jsx(D,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignUp}),e.viaTwitter&&a.jsx(D,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignUp})]})]})};Z.propTypes={theme:v.default.oneOf(["secondary","primary"])};U.propTypes={theme:v.default.oneOf(["secondary","primary"]),viaApplePay:v.default.bool,viaGooglePay:v.default.bool,viaSTCPay:v.default.bool,viaCreditCard:v.default.bool,viaPayPal:v.default.bool,handleApplePay:v.default.func};exports.ChargeWalletForm=function(t){var r,l=G(e.useState(0),2),s=l[0],i=l[1],n=x.useForm(),o=n.formState.errors,d=n.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",children:[a.jsxs(T.default,{align:"center",variant:"h1",children:[Number(s).toLocaleString("en")||"0",a.jsx(T.default,{children:t.currency||"SAR"})]}),a.jsx(x.FormProvider,E(E({},n),{},{children:a.jsxs("form",{onChange:function(e){e.preventDefault(),i(n.getValues().amount)},style:{marginTop:10},onSubmit:d(t.handleChargeWallet),children:[a.jsx(U,{fullWidth:!0,name:"amount",placeholder:"Enter amount",type:"number",value:s,rules:{required:"Password is rquired"},helperText:null===(r=o.amount)||void 0===r?void 0:r.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",onClick:t.handleSignIn,children:"Charge Wallet"})]})}))]})},exports.CreditCardForm=function(e){var t,r,l=x.useForm(),i=l.formState.errors,n=l.handleSubmit;return a.jsx(s.Container,{maxWidth:"xs",children:a.jsx(x.FormProvider,E(E({},l),{},{children:a.jsxs("form",{onSubmit:n(e.handle),children:[a.jsx(U,{fullWidth:!0,name:"password",placeholder:"Enter password",type:"number",label:"Card Number",rules:{required:"Password is rquired"},helperText:null===(t=i.password)||void 0===t?void 0:t.message}),a.jsx(U,{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}),a.jsx(s.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithCreditCard,children:"Pay with Credit Card"})]})}))})},exports.NewPasswordForm=function(t){var r,l,s=G(e.useState(""),2),i=s[0],n=s[1],o=x.useForm(),d=o.formState.errors,u=o.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[t.error&&a.jsx(M,{text:"This is a new password alert",severity:"error"}),t.passwordChanged?a.jsx(R,{style:{textAlign:"center",margin:5},children:"Your password has been changed, you'll be redirected to sign in page"}):a.jsx(x.FormProvider,E(E({},o),{},{children:a.jsxs("form",{onSubmit:u(t.handleNewPassword),children:[a.jsx(U,{fullWidth:!0,name:"password",type:"password",label:t.texts.passwordLabel,placeholder:t.texts.passwordPlaceholder,onChange:function(e){return n(e.target.value)},value:i,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:t.texts.passwordRequiredText},helperText:null===(r=d.password)||void 0===r?void 0:r.message}),a.jsx(U,{fullWidth:!0,name:"confirmPassword",type:"password",placeholder:t.texts.confirmPasswordPlaceholder,label:t.texts.confirmPasswordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:"Password is rquired"},helperText:null===(l=d.confirmPassword)||void 0===l?void 0:l.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:t.texts.updatePassword})]})}))]})},exports.PayWithWallet=function(e){return a.jsxs(s.Container,{maxWidth:"xs",children:[a.jsx(s.Typography,{align:"center",children:"Wallet Balance"}),a.jsxs(s.Typography,{align:"center",variant:"h1",children:[e.walletBalance||"0",a.jsx(s.Typography,{children:e.currency||"SAR"})]}),a.jsx(s.Button,{type:"submit",fullWidth:!0,variant:"last",onClick:e.handlePayWithWallet,children:"Pay Now"})]})},exports.ResetPasswordForm=function(e){var t,r=x.useForm(),l=r.formState.errors,s=r.handleSubmit;return r.getValues,r.register,r.watch,r.reset,r.setValue,a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(Alert,{severity:"error",children:[e.errorTitle&&a.jsx(AlertTitle,{children:e.errorTitle}),e.errorText]}),e.sent?a.jsx(R,{style:{textAlign:"center",margin:5},children:"An link was sent to your email to reset the password."}):a.jsx(x.FormProvider,E(E({},r),{},{children:a.jsxs("form",{onSubmit:s(e.handleResetPassword),children:[a.jsx(U,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.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}},helperText:null===(t=l.email)||void 0===t?void 0:t.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.resetPassword})]})}))]})},exports.SelectPayment=function(e){return a.jsxs(s.Container,{maxWidth:"xs",children:[a.jsx(R,{align:"center",children:"Choose Payment Method"}),e.viaWallet&&a.jsx(D,{logo:"wallet",buttonText:e.walletLabel,onClick:e.handleWallet}),e.viaCreditCard&&a.jsx(D,{logo:"visa/master",buttonText:e.visaMasterLabel,onClick:e.handleCreditCard}),e.viaMada&&a.jsx(D,{logo:"mada",buttonText:e.madaLabel,onClick:e.handleMada}),e.viaSTCPay&&a.jsx(D,{logo:"stcpay",buttonText:e.stcPayLabel,onClick:e.handleSTCPay}),e.viaPayPal&&a.jsx(D,{logo:"paypal",buttonText:e.paypalLabel,onClick:e.handlePayPal}),e.viaGooglePay&&a.jsx(D,{logo:"googlepay",buttonText:e.googlePayLabel,onClick:e.handleGooglePay}),e.viaApplePay&&a.jsx(D,{logo:"applepay",buttonText:e.applePayLabel,onClick:e.handleApplePay})]})},exports.SignInForm=function(e){var t,r,l=x.useForm(),s=l.formState.errors,i=l.handleSubmit;return a.jsxs(w.default,{maxWidth:"xs",variant:"auth",children:[e.error&&a.jsxs(W.default,{severity:"error",children:[e.errorTitle&&a.jsx(A.default,{children:e.errorTitle}),e.errorText]}),a.jsx(x.FormProvider,E(E({},l),{},{children:a.jsxs("form",{onSubmit:i(e.handleSignIn),children:[a.jsx(U,{fullWidth:!0,type:"text",name:"email",label:e.texts.emailLabel,placeholder:e.texts.emailPlaceholder,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(O.default,{})}),rules:{required:e.texts.emailRequired,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}},helperText:null===(t=s.email)||void 0===t?void 0:t.message}),a.jsx(U,{fullWidth:!0,name:"password",placeholder:e.texts.passwordPlaceholder,type:"password",label:e.texts.passwordLabel,startAdornment:a.jsx(L.default,{position:"start",children:a.jsx(F.default,{})}),rules:{required:e.texts.passwordRequired},helperText:null===(r=s.password)||void 0===r?void 0:r.message}),a.jsx(T.default,{style:{cursor:"pointer",marginTop:5,width:"max-content",fontSize:15,padding:5},onClick:e.handleForgotPassword,children:e.texts.forgotPasswordText}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:e.texts.signInText})]})})),a.jsxs(T.default,{variant:"subtitle2",style:{marginTop:5,textAlign:"center",padding:5},children:[e.texts.newUserText," ",a.jsx("span",{onClick:e.handleRouteToSignUp,style:{cursor:"pointer",color:"blue",textAlign:"center"},children:e.texts.signUpText})]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.viaGoogle&&a.jsx(D,{logo:"google",buttonText:e.texts.googleButtonLabel,onClick:e.handleGoogleSignIn}),e.viaGithub&&a.jsx(D,{logo:"github",buttonText:e.texts.githubButtonLabel,onClick:e.handleGithubSignIn}),e.viaTwitter&&a.jsx(D,{logo:"twitter",buttonText:e.texts.twitterButtonLabel,onClick:e.handleTwitterSignIn})]})]})},exports.SignUpForm=Z,exports.UserProfileForm=function(e){var t,r,l,s,i=x.useForm(),n=i.formState.errors;return a.jsx(w.default,{maxWidth:"sm",children:a.jsx(x.FormProvider,E(E({},i),{},{children:a.jsxs("form",{children:[a.jsx(U,{fullWidth:!0,type:"text",name:"fullName",label:"Full Name",placeholder:"Fulan AlFulani",rules:{required:"Email is required"},helperText:null===(t=n.fullName)||void 0===t?void 0:t.message}),a.jsx(U,{fullWidth:!0,type:"text",name:"fullName",label:"Phone Number",placeholder:"+966",rules:{required:"Email is required"}}),a.jsx(U,{fullWidth:!0,type:"text",name:"email",label:"New Email",placeholder:"Enter your new email",rules:{required:"Email is required"},helperText:null===(r=n.email)||void 0===r?void 0:r.message}),a.jsx(U,{fullWidth:!0,type:"password",name:"password",label:"New password",placeholder:"Enter your new password",rules:{required:"Email is required"},helperText:null===(l=n.password)||void 0===l?void 0:l.message}),a.jsx(U,{fullWidth:!0,type:"password",name:"confirmPassword",label:"Confirm new password",placeholder:"Confirm new password",rules:{required:"Email is required"},helperText:null===(s=n.confirmPassword)||void 0===s?void 0:s.message}),a.jsx(j.default,{type:"submit",fullWidth:!0,variant:"last",children:"update profile"})," "]})}))})},exports.UserSettingsForm=function(e){return a.jsxs(s.Container,{maxWidth:"sm",children:[e.children,a.jsx(s.Button,{type:"submit",fullWidth:!0,variant:"last",children:"Save Settings"})]})};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "UI Kit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.es.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"start": "start-storybook -p 6006",
|
|
10
|
-
"storybook": "start-storybook -p 6006",
|
|
9
|
+
"start": "start-storybook -p 6006 -s public",
|
|
10
|
+
"storybook": "start-storybook -p 6006 -s public",
|
|
11
11
|
"build-storybook": "build-storybook",
|
|
12
12
|
"build-lib": "rollup -c",
|
|
13
13
|
"build:styles": " node tools/build-styles"
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { Box } from "../../layout";
|
|
2
|
+
import { HawaTextField } from "../../elements";
|
|
4
3
|
import { FormProvider, useForm } from "react-hook-form";
|
|
5
4
|
import Container from "@mui/material/Container";
|
|
6
|
-
import
|
|
5
|
+
import Button from "@mui/material/Button";
|
|
7
6
|
|
|
8
|
-
export const
|
|
7
|
+
export const UserProfileForm = (props) => {
|
|
9
8
|
const methods = useForm();
|
|
10
9
|
const {
|
|
11
|
-
formState: { errors }
|
|
12
|
-
handleSubmit
|
|
10
|
+
formState: { errors }
|
|
13
11
|
} = methods;
|
|
14
12
|
|
|
15
13
|
return (
|
|
16
|
-
<Container maxWidth="
|
|
14
|
+
<Container maxWidth="sm">
|
|
17
15
|
<FormProvider {...methods}>
|
|
18
16
|
<form>
|
|
19
17
|
<HawaTextField
|
|
@@ -27,6 +25,17 @@ export const UserProfile = (props) => {
|
|
|
27
25
|
}}
|
|
28
26
|
helperText={errors.fullName?.message}
|
|
29
27
|
/>
|
|
28
|
+
<HawaTextField
|
|
29
|
+
fullWidth
|
|
30
|
+
type="text"
|
|
31
|
+
name="fullName"
|
|
32
|
+
label="Phone Number"
|
|
33
|
+
placeholder="+966"
|
|
34
|
+
rules={{
|
|
35
|
+
required: "Email is required"
|
|
36
|
+
}}
|
|
37
|
+
// helperText={errors.fullName?.message}
|
|
38
|
+
/>
|
|
30
39
|
<HawaTextField
|
|
31
40
|
fullWidth
|
|
32
41
|
type="text"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HawaSettingsRow } from "../../elements";
|
|
2
|
+
import { Button, Container } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
export const UserSettingsForm = (props) => {
|
|
5
|
+
return (
|
|
6
|
+
<Container maxWidth="sm">
|
|
7
|
+
{props.children}
|
|
8
|
+
<Button type="submit" fullWidth variant="last">
|
|
9
|
+
Save Settings
|
|
10
|
+
</Button>
|
|
11
|
+
</Container>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
1
|
+
export * from "./UserProfileForm.js";
|
|
2
|
+
export * from "./UserSettingsForm.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
HawaTextField,
|
|
6
6
|
HawaAlert,
|
|
7
7
|
HawaTypography
|
|
8
|
-
} from "../../
|
|
8
|
+
} from "../../elements";
|
|
9
9
|
import { FormProvider, useForm } from "react-hook-form";
|
|
10
10
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
11
11
|
import PasswordIcon from "@mui/icons-material/HttpsOutlined";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
ActionButton,
|
|
7
7
|
HawaAlert,
|
|
8
8
|
HawaTypography
|
|
9
|
-
} from "../../
|
|
9
|
+
} from "../../elements";
|
|
10
10
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
11
11
|
import EmailIcon from "@mui/icons-material/MailOutline";
|
|
12
12
|
import Container from "@mui/material/Container";
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { HawaTextField,
|
|
2
|
+
import { HawaTextField, HawaLogoButton } from "../../elements";
|
|
3
3
|
import { FormProvider, 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";
|
|
7
7
|
import Container from "@mui/material/Container";
|
|
8
|
+
import Typography from "@mui/material/Typography";
|
|
8
9
|
import Button from "@mui/material/Button";
|
|
9
10
|
import Alert from "@mui/material/Alert";
|
|
11
|
+
import AlertTitle from "@mui/material/AlertTitle";
|
|
10
12
|
|
|
11
13
|
export const SignInForm = (props) => {
|
|
12
14
|
const methods = useForm();
|
|
@@ -63,29 +65,26 @@ export const SignInForm = (props) => {
|
|
|
63
65
|
}}
|
|
64
66
|
helperText={errors.password?.message}
|
|
65
67
|
/>
|
|
66
|
-
<
|
|
68
|
+
<Typography
|
|
67
69
|
style={{
|
|
68
70
|
cursor: "pointer",
|
|
69
71
|
marginTop: 5,
|
|
70
72
|
width: "max-content",
|
|
73
|
+
fontSize: 15,
|
|
71
74
|
padding: 5
|
|
72
75
|
}}
|
|
73
76
|
onClick={props.handleForgotPassword}
|
|
74
77
|
>
|
|
75
78
|
{props.texts.forgotPasswordText}
|
|
76
|
-
</
|
|
79
|
+
</Typography>
|
|
77
80
|
<Button type="submit" fullWidth variant="last">
|
|
78
81
|
{props.texts.signInText}
|
|
79
82
|
</Button>
|
|
80
83
|
</form>
|
|
81
84
|
</FormProvider>
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// width: "max-content",
|
|
86
|
-
textAlign: "center",
|
|
87
|
-
padding: 5
|
|
88
|
-
}}
|
|
85
|
+
<Typography
|
|
86
|
+
variant="subtitle2"
|
|
87
|
+
style={{ marginTop: 5, textAlign: "center", padding: 5 }}
|
|
89
88
|
>
|
|
90
89
|
{props.texts.newUserText}{" "}
|
|
91
90
|
<span
|
|
@@ -98,7 +97,7 @@ export const SignInForm = (props) => {
|
|
|
98
97
|
>
|
|
99
98
|
{props.texts.signUpText}
|
|
100
99
|
</span>
|
|
101
|
-
</
|
|
100
|
+
</Typography>
|
|
102
101
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
103
102
|
{props.viaGoogle && (
|
|
104
103
|
<HawaLogoButton
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { HawaTextField, HawaLogoButton } from "../../
|
|
2
|
+
import { HawaTextField, HawaLogoButton } from "../../elements";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { FormProvider, useForm } from "react-hook-form";
|
|
5
5
|
import PersonIcon from "@mui/icons-material/PermIdentityOutlined";
|
|
@@ -10,6 +10,7 @@ import Container from "@mui/material/Container";
|
|
|
10
10
|
import Typography from "@mui/material/Typography";
|
|
11
11
|
import Button from "@mui/material/Button";
|
|
12
12
|
import Alert from "@mui/material/Alert";
|
|
13
|
+
import AlertTitle from "@mui/material/AlertTitle";
|
|
13
14
|
|
|
14
15
|
export const SignUpForm = (props) => {
|
|
15
16
|
const methods = useForm();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { HawaTextField
|
|
3
|
-
import { Box } from "../../layout";
|
|
2
|
+
import { HawaTextField } from "../../elements";
|
|
4
3
|
import { FormProvider, useForm } from "react-hook-form";
|
|
4
|
+
import Container from "@mui/material/Container";
|
|
5
|
+
import Button from "@mui/material/Button";
|
|
6
|
+
import Typography from "@mui/material/Typography";
|
|
5
7
|
|
|
6
8
|
export const ChargeWalletForm = (props) => {
|
|
7
9
|
const [walletAmount, setWalletAmount] = useState(0);
|
|
@@ -12,42 +14,43 @@ export const ChargeWalletForm = (props) => {
|
|
|
12
14
|
} = methods;
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
<Container maxWidth="xs">
|
|
18
|
+
<Typography align="center" variant="h1">
|
|
19
|
+
{Number(walletAmount).toLocaleString("en") || "0"}
|
|
20
|
+
<Typography>{props.currency || "SAR"}</Typography>
|
|
21
|
+
</Typography>
|
|
22
|
+
<FormProvider {...methods}>
|
|
23
|
+
<form
|
|
24
|
+
onChange={(e) => {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
setWalletAmount(methods.getValues().amount);
|
|
27
|
+
}}
|
|
28
|
+
style={{ marginTop: 10 }}
|
|
29
|
+
onSubmit={handleSubmit(props.handleChargeWallet)}
|
|
30
|
+
>
|
|
31
|
+
<HawaTextField
|
|
32
|
+
fullWidth
|
|
33
|
+
name="amount"
|
|
34
|
+
placeholder="Enter amount"
|
|
35
|
+
type="number"
|
|
36
|
+
value={walletAmount}
|
|
37
|
+
rules={{
|
|
38
|
+
required: "Password is rquired"
|
|
28
39
|
}}
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
helperText={errors.amount?.message}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<Button
|
|
44
|
+
type="submit"
|
|
45
|
+
fullWidth
|
|
46
|
+
variant="last"
|
|
47
|
+
onClick={props.handleSignIn}
|
|
31
48
|
>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
required: "Password is rquired"
|
|
39
|
-
}}
|
|
40
|
-
helperText={errors.amount?.message}
|
|
41
|
-
/>
|
|
42
|
-
<ActionButton
|
|
43
|
-
last
|
|
44
|
-
fullWidth
|
|
45
|
-
text={"Charge Wallet"} //move this to props
|
|
46
|
-
onClick={props.handleSignIn}
|
|
47
|
-
/>
|
|
48
|
-
</form>
|
|
49
|
-
</FormProvider>
|
|
50
|
-
</Box>
|
|
51
|
-
</Box>
|
|
49
|
+
{/* {props.texts.signInText} */}
|
|
50
|
+
{"Charge Wallet"}
|
|
51
|
+
</Button>
|
|
52
|
+
</form>
|
|
53
|
+
</FormProvider>
|
|
54
|
+
</Container>
|
|
52
55
|
);
|
|
53
56
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { HawaTextField, ActionButton } from "../../
|
|
2
|
+
import { HawaTextField, ActionButton } from "../../elements";
|
|
3
3
|
import { Box } from "../../layout";
|
|
4
4
|
import { FormProvider, useForm } from "react-hook-form";
|
|
5
|
+
import { Button, Container } from "@mui/material";
|
|
5
6
|
|
|
6
7
|
export const CreditCardForm = (props) => {
|
|
7
8
|
const methods = useForm();
|
|
@@ -11,50 +12,54 @@ export const CreditCardForm = (props) => {
|
|
|
11
12
|
} = methods;
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
<Container maxWidth="xs">
|
|
16
|
+
<FormProvider {...methods}>
|
|
17
|
+
<form onSubmit={handleSubmit(props.handle)}>
|
|
18
|
+
<HawaTextField
|
|
19
|
+
fullWidth
|
|
20
|
+
name="password"
|
|
21
|
+
placeholder="Enter password"
|
|
22
|
+
type="number"
|
|
23
|
+
label="Card Number"
|
|
24
|
+
// startAdornment={
|
|
25
|
+
// <InputAdornment position="start">
|
|
26
|
+
// <PasswordIcon />
|
|
27
|
+
// </InputAdornment>
|
|
28
|
+
// }
|
|
29
|
+
rules={{
|
|
30
|
+
required: "Password is rquired"
|
|
31
|
+
}}
|
|
32
|
+
helperText={errors.password?.message}
|
|
33
|
+
/>
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
<HawaTextField
|
|
36
|
+
fullWidth
|
|
37
|
+
name="password"
|
|
38
|
+
placeholder="Enter password"
|
|
39
|
+
type="password"
|
|
40
|
+
label="Name On Card"
|
|
41
|
+
// startAdornment={
|
|
42
|
+
// <InputAdornment position="start">
|
|
43
|
+
// <PasswordIcon />
|
|
44
|
+
// </InputAdornment>
|
|
45
|
+
// }
|
|
46
|
+
rules={{
|
|
47
|
+
required: "Password is rquired"
|
|
48
|
+
}}
|
|
49
|
+
helperText={errors.password?.message}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<Button
|
|
53
|
+
type="submit"
|
|
54
|
+
fullWidth
|
|
55
|
+
variant="last"
|
|
56
|
+
onClick={props.handlePayWithCreditCard}
|
|
57
|
+
>
|
|
58
|
+
{/* {props.texts.signInText} */}
|
|
59
|
+
{"Pay with Credit Card"}
|
|
60
|
+
</Button>
|
|
61
|
+
</form>
|
|
62
|
+
</FormProvider>
|
|
63
|
+
</Container>
|
|
59
64
|
);
|
|
60
65
|
};
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ActionButton } from "../../
|
|
2
|
+
import { ActionButton } from "../../elements";
|
|
3
3
|
import { Box } from "../../layout";
|
|
4
|
+
import { Button, Container, Typography } from "@mui/material";
|
|
4
5
|
|
|
5
6
|
export const PayWithWallet = (props) => {
|
|
6
7
|
return (
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
<Container maxWidth="xs">
|
|
9
|
+
<Typography align="center">Wallet Balance</Typography>
|
|
10
|
+
<Typography align="center" variant="h1">
|
|
11
|
+
{props.walletBalance || "0"}
|
|
12
|
+
<Typography>{props.currency || "SAR"}</Typography>
|
|
13
|
+
</Typography>
|
|
14
|
+
<Button
|
|
15
|
+
type="submit"
|
|
16
|
+
fullWidth
|
|
17
|
+
variant="last"
|
|
18
|
+
onClick={props.handlePayWithWallet}
|
|
19
|
+
>
|
|
20
|
+
{"Pay Now"}
|
|
21
|
+
</Button>
|
|
22
|
+
</Container>
|
|
13
23
|
);
|
|
14
24
|
};
|