umwd-components 0.1.588 → 0.1.590
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/dist/src/components/auth/AuthWidget.js +1 -1
- package/dist/src/components/e-commerce/cart/CartWidget.js +1 -1
- package/dist/src/components/e-commerce/checkout/CheckoutForm.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/auth/AuthWidget.tsx +15 -19
- package/src/components/e-commerce/cart/CartWidget.tsx +2 -2
- package/src/components/e-commerce/checkout/CheckoutForm.tsx +22 -5
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import e from"react";import t from"@mui/material/SpeedDial";import i from"@mui/material/SpeedDialAction";import r from"@mui/material/Box";import o from"@mui/material/Stack";import n from"@mui/material/CircularProgress";import m from"@mui/icons-material/AccountCircle";import a from"@mui/icons-material/Person";import l from"@mui/icons-material/Folder";import
|
|
7
|
+
import e from"react";import t from"@mui/material/SpeedDial";import i from"@mui/material/SpeedDialAction";import r from"@mui/material/Box";import o from"@mui/material/Stack";import n from"@mui/material/CircularProgress";import m from"@mui/icons-material/AccountCircle";import a from"@mui/icons-material/Person";import l from"@mui/icons-material/Folder";import u from"@mui/icons-material/ListAlt";import c from"@mui/icons-material/Login";import s from"@mui/icons-material/Logout";import p from"@mui/icons-material/HowToReg";import{useRouter as g}from"next/navigation";import{useSession as d}from"../../context/auth/SessionContext.js";import f from"@mui/material/Button";import{Typography as x}from"@mui/material";var h={loggedIn:[{icon:e.createElement(a,null),name:"Profile",route:"/user/profile"},{icon:e.createElement(u,null),name:"Orders",route:"/user/orders"},{icon:e.createElement(l,null),name:"Documents",route:"/user/documents"}],loggedOut:[{icon:e.createElement(c,null),name:"Sign-In",route:"/auth/signin"},{icon:e.createElement(p,null),name:"Register",route:"/auth/register"}]};function E(a){var l=a.actions,u=void 0===l?h:l,c=g(),p=d(),E=p.user,v=p.loading,w=p.error,k=p.logout;return v?e.createElement(r,{sx:{position:"relative",width:"40px",height:"40px"}},e.createElement(n,null)):w?e.createElement("p",null,"Error: ",w):e.createElement(e.Fragment,null,e.createElement(o,{direction:"column",sx:{display:{xs:"flex",md:"none"},width:"100%"},spacing:2},e.createElement(x,{variant:"h6",sx:{textAlign:"center"}},"Profile"),(E?u.loggedIn:u.loggedOut).map((function(t){return e.createElement(f,{key:t.name,size:"small",variant:"contained",startIcon:t.icon,onClick:function(){return c.push(t.route)},sx:{width:"100%"}},t.name)}))),e.createElement(r,{sx:{display:{xs:"none",md:"block"},position:"relative",width:"40px",height:"40px"}},e.createElement(t,{ariaLabel:"SpeedDial basic example",icon:e.createElement(m,null),direction:"down",sx:{position:"absolute",top:0,right:0,width:40,"& .MuiFab-root":{width:40,height:40}}},(E?u.loggedIn:u.loggedOut).map((function(t){return e.createElement(i,{key:t.name,icon:t.icon,tooltipTitle:t.name,onClick:function(){return c.push(t.route)}})})),E&&e.createElement(i,{icon:e.createElement(s,null),tooltipTitle:"Log-Out",onClick:function(){return k()}}))))}export{E as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import o from"@mui/material/Box";import i from"@mui/material/Stack";import n from"@mui/material/Button";import l from"@mui/material/Badge";import m from"@mui/material/IconButton";import c from"@mui/material/CircularProgress";import p from"@mui/material/useMediaQuery";import{useTheme as s}from"@mui/material/styles";import u from"next/link";import x from"@mui/icons-material/ShoppingCart";import d from"./CartSummary.js";import f from"@mui/material/Typography";import{useClientSideCart as g}from"./hooks.js";import{Grow as h}from"@mui/material";function E(E){var v=E.data,k=v.cartUrl,
|
|
7
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import o from"@mui/material/Box";import i from"@mui/material/Stack";import n from"@mui/material/Button";import l from"@mui/material/Badge";import m from"@mui/material/IconButton";import c from"@mui/material/CircularProgress";import p from"@mui/material/useMediaQuery";import{useTheme as s}from"@mui/material/styles";import u from"next/link";import x from"@mui/icons-material/ShoppingCart";import d from"./CartSummary.js";import f from"@mui/material/Typography";import{useClientSideCart as g}from"./hooks.js";import{Grow as h}from"@mui/material";function E(E){var v=E.data,k=v.cartUrl,b=void 0===k?"/shop/cart":k,y=v.checkoutUrl,C=void 0===y?"/shop/check-out":y,B=g(),w=B.state,j=B.isClient,S=t(a(null),2),z=S[0],T=S[1],M=function(e){T(e.currentTarget)},_=function(){T(null)},A=Boolean(z),O=A?"cart-widget-popover":void 0,P=s(),U=p(P.breakpoints.down("sm"));return j?r.createElement(r.Fragment,null,r.createElement(i,{direction:"column",spacing:2,sx:{display:{xs:"flex",md:"none"},width:"100%"}},r.createElement(f,{variant:"h6",sx:{textAlign:"center"}},"Cart"),r.createElement(d,null),r.createElement(i,{direction:"row",spacing:1,sx:{width:"100%"},justifyContent:"flex-end"},r.createElement(u,{href:b,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"outlined",onClick:function(){_()}},r.createElement(x,null))),r.createElement(u,{href:C,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"contained",onClick:function(){_()}},"Check Out")))),r.createElement(o,{component:"div",sx:{display:{xs:"none",md:"block"},position:"relative",width:"40px",height:"40px",mr:"10px"},onMouseEnter:M,onMouseLeave:_},r.createElement(l,{badgeContent:w.totalAmount,color:"primary"},r.createElement(m,{"aria-describedby":O,onClick:function(e){z?_():M(e)},sx:{color:"primary.contrastText",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)","&:hover":{backgroundColor:"primary.dark"}}},r.createElement(x,{sx:{color:"primary.contrastText"}}))),r.createElement(h,e({in:A},A?{}:{timeout:1e3}),r.createElement(o,{id:O,sx:[{position:"absolute",top:"65px",right:0,backgroundColor:"background.paper",boxShadow:2,width:"max-content"}]},r.createElement(d,null),r.createElement(i,{spacing:{xs:1,sm:2},sx:{p:{xs:1,sm:2}}},r.createElement(u,{href:b,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"outlined",onClick:function(){_()}},r.createElement(x,null))),r.createElement(u,{href:C,legacyBehavior:!0},r.createElement(n,{size:U?"small":"large",variant:"contained",onClick:function(){_()}},"Check Out"))))))):r.createElement(c,null)}export{E as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"@mui/material/Typography";import n from"@mui/material/Container";import
|
|
7
|
+
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"@mui/material/Typography";import n from"@mui/material/Container";import l from"@mui/material/Stack";import a from"@mui/material/Grid";import i from"@mui/material/Paper";import o from"@mui/material/Box";import m from"@mui/material/Button";import s from"@mui/material/Stepper";import c from"@mui/material/Step";import u from"@mui/material/StepLabel";import p from"@mui/material/MobileStepper";import d from"@mui/material/Alert";import f from"@mui/material/useMediaQuery";import{useTheme as E}from"@mui/material/styles";import x,{useState as g,useEffect as v,useMemo as b}from"react";import h from"next/link";import{useSearchParams as y}from"next/navigation";import{useSession as k}from"../../../context/auth/SessionContext.js";import B from"@mui/icons-material/KeyboardArrowLeft";import C from"@mui/icons-material/KeyboardArrowRight";import S from"./Step1.js";import _ from"./Step2.js";import A from"./Step3.js";import j from"./Step4.js";import N from"./Step5.js";import{useCheckout as D}from"../../../context/e-commerce/checkout/CheckoutContext.js";import{useCart as P}from"../../../context/e-commerce/cart/CartContext.js";import w from"../../../lib/isCustomerProfileCompleteEnough.js";function z(z){var I=z.shopUrl,O=void 0===I?"/shop":I,T=E(),H=f(T.breakpoints.down("sm")),L=D(),M=L.state,R=L.runAllChecks,V=L.togglePrefersBillingAddress,F=L.togglePrefersDeliveryAddress,K=L.setCustomerInternalReference,G=P().dispatch,Q=k(),U=Q.loading;Q.error;var q=Q.user;Q.login;var J=Q.logout,W=t(g(0),2),X=W[0],Y=W[1],Z=t(g(null),2),$=Z[0],ee=Z[1],te=t(g(null),2),re=te[0],ne=te[1],le=function(){Y((function(e){return e+1}))},ae=function(){Y((function(e){return e-1}))},ie=y();v((function(){if(null!==ie){var e=ie.get("order");e&&ee(e);var t=ie.get("message"),r=ie.get("severity");t&&r&&ne({message:t,severity:r})}}),[ie]),v((function(){$&&(Y(4),localStorage.removeItem("cart"),G({type:"SET_ITEMS",payload:[]}))}),[$]),v((function(){q&&(console.log("checkout change in user"),R())}),[q]);var oe=!M.confirmations.itemsInCart,me=null!==(null==q?void 0:q.customer_profile)&&w(null==q?void 0:q.customer_profile),se=b((function(){return[{label:"Login or register",children:x.createElement(S,{user:q,logout:J}),backButton:x.createElement(m,{variant:H?"text":"outlined",disabled:0===X,onClick:ae,sx:{mr:1}},"Back",H&&x.createElement(B,null)),nextButton:x.createElement(m,{variant:H?"text":"contained",onClick:le,sx:{ml:1},disabled:(!q||oe)&&"production"===process.env.NODE_ENV,size:H?"small":"large"},"Next",H&&x.createElement(C,null))},{label:"Provide us with your address",children:x.createElement(_,null),backButton:x.createElement(m,{size:H?"small":"large",onClick:ae,disabled:0===X,variant:H?"text":"outlined"},"Back",H&&x.createElement(B,null)),nextButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"contained",onClick:function(){le()},disabled:(!q||oe||me)&&"production"===process.env.NODE_ENV},"Next",H&&x.createElement(C,null))},{label:"Set up mailing options",children:x.createElement(A,{user:q,prefersBillingAddress:M.prefersBillingAddress,prefersDeliveryAddress:M.prefersDeliveryAddress,delivery_options:M.delivery_options,payment_options:M.payment_options,togglePrefersBillingAddress:V,togglePrefersDeliveryAddress:F,setCustomerInternalReference:K}),backButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"outlined",onClick:ae,disabled:0===X},"Back",H&&x.createElement(B,null)),nextButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"contained",onClick:function(){le()},disabled:(!q||oe||me)&&"production"===process.env.NODE_ENV},"Next",H&&x.createElement(C,null))},{label:"Confirm and make a payment",children:x.createElement(j,{customer_internal_reference:M.customer_internal_reference}),nextButton:x.createElement(x.Fragment,null,x.createElement(m,{size:H?"small":"large",variant:H?"text":"contained",onClick:function(){le()},disabled:!0},"Next",H&&x.createElement(C,null))),backButton:x.createElement(m,{size:H?"small":"large",variant:H?"text":"outlined",onClick:ae,disabled:0===X},"Back",H&&x.createElement(B,null))},{label:"Done!",children:x.createElement(N,null)}]}),[q,oe,me,M,H,X]);return x.createElement(n,{sx:{py:2,minHeight:"100vh"}},x.createElement(a,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"}},x.createElement(a,{item:!0,xs:12},x.createElement(r,{variant:"h4",align:"center"},"Check Out")),oe&&4!=X&&x.createElement(a,{item:!0,xs:12},x.createElement(d,{severity:"error"},x.createElement(r,{variant:"h5"},"No products in cart"),x.createElement(r,{variant:"body1"},"There are no products selected to order, please visit the shop befor continuing"))),null!=re&&x.createElement(a,{item:!0,xs:12},x.createElement(d,{severity:re.severity},x.createElement(r,{variant:"body1"},re.message))),x.createElement(a,{item:!0,xs:12},x.createElement(o,{width:"100%"},x.createElement(i,{sx:{p:2,mb:2,display:{xs:"block",sm:"none"}}},x.createElement(l,{direction:"row",spacing:2,alignItems:"center"},x.createElement(r,{variant:"body2"},"".concat(X+1," / ").concat(se.length)),x.createElement(r,null,"".concat(se[X].label)))),x.createElement(i,{sx:{px:2,pt:2,mb:2,display:{xs:"none",sm:"block"}}},x.createElement(s,{activeStep:X},se.map((function(t,r){var n={};return x.createElement(c,e({key:r},{},{sx:{pb:"20px"}}),x.createElement(u,n,t.label))})))),!U&&x.createElement(x.Fragment,null,se[X].children,x.createElement(i,{sx:{p:2,mt:2,display:{xs:"none",sm:"block"}}},x.createElement(l,{direction:"row",spacing:2},se[X].backButton,x.createElement(m,{variant:"outlined",sx:{ml:1}},x.createElement(h,{href:O},"continue shopping")),x.createElement(o,{sx:{flex:"1 1 auto"}}),se[X].nextButton))))),x.createElement(a,{item:!0,xs:12},x.createElement(p,{sx:{display:{xs:"flex",sm:"none"}},variant:"text",steps:se.length,position:"static",activeStep:X,nextButton:se[X].nextButton,backButton:se[X].backButton}))))}export{z as default};
|