umwd-components 0.1.354 → 0.1.355

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.
@@ -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 l from"@mui/material/Stack";import a from"@mui/material/Grid";import o from"@mui/material/Paper";import i from"@mui/material/Box";import m from"@mui/material/Button";import c from"@mui/material/Stepper";import s from"@mui/material/Step";import u from"@mui/material/StepLabel";import p from"@mui/material/MobileStepper";import d from"@mui/material/useMediaQuery";import{useTheme as x}from"@mui/material/styles";import E,{useState as b,useEffect as f}from"react";import g from"next/link";import{useSearchParams as v}from"next/navigation";import{useSession as k}from"../../../context/auth/SessionContext.js";import h from"@mui/icons-material/KeyboardArrowLeft";import C from"@mui/icons-material/KeyboardArrowRight";import y from"./Step1.js";import B from"./Step2.js";import S from"./Step3.js";import j from"./Step4.js";import A from"./Step5.js";import{useClientSideCart as w}from"../cart/hooks.js";import{useCheckout as z}from"../../../context/e-commerce/checkout/CheckoutContext.js";function P(P){var N=P.shopUrl,H=void 0===N?"/shop":N,I=x(),L=d(I.breakpoints.down("sm")),_=z(),F=_.state,K=_.runAllChecks;console.log(F,K);var M=t(b(0),2),T=M[0],D=M[1],G=function(){D((function(e){return e+1}))},O=function(){D((function(e){return e-1}))},Q=k(),R=Q.loading;Q.error;var U=Q.user,q=v();f((function(){null!==q&&(q.get("order")&&D(4))}),[q]),w();var J=!F.itemsInCart,V=!F.customerProfileComplete,W=[{label:"Login or register",children:E.createElement(y,null),backButton:E.createElement(m,{variant:L?"text":"outlined",disabled:0===T,onClick:O,sx:{mr:1}},"Back",L&&E.createElement(h,null)),nextButton:E.createElement(m,{variant:L?"text":"contained",onClick:G,sx:{ml:1},disabled:!U||J,size:L?"small":"large"},"Next",L&&E.createElement(C,null))},{label:"Provide us with your address",children:E.createElement(B,null),backButton:E.createElement(m,{size:L?"small":"large",onClick:O,disabled:0===T,variant:L?"text":"outlined"},"Back",L&&E.createElement(h,null)),nextButton:E.createElement(m,{size:L?"small":"large",variant:L?"text":"contained",onClick:function(){G()},disabled:!U||J||V},"Next",L&&E.createElement(C,null))},{label:"Set up mailing options",children:E.createElement(S,null),backButton:E.createElement(m,{size:L?"small":"large",variant:L?"text":"outlined",onClick:O,disabled:0===T},"Back",L&&E.createElement(h,null)),nextButton:E.createElement(m,{size:L?"small":"large",variant:L?"text":"contained",onClick:function(){G()},disabled:!U||J||V},"Next",L&&E.createElement(C,null))},{label:"Confirm and make a payment",children:E.createElement(j,null),nextButton:E.createElement(E.Fragment,null,E.createElement(m,{size:L?"small":"large",variant:L?"text":"contained",onClick:function(){G()},disabled:!0},"Next",L&&E.createElement(C,null))),backButton:E.createElement(m,{size:L?"small":"large",variant:L?"text":"outlined",onClick:O,disabled:0===T},"Back",L&&E.createElement(h,null))},{label:"Done!",children:E.createElement(A,null)}];return E.createElement(n,{sx:{py:2,minHeight:"100vh"}},E.createElement(a,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"}},E.createElement(a,{item:!0,xs:12,component:o},E.createElement(r,{variant:"body1",align:"center",sx:{color:"#000"}},"items in cart: ",F.itemsInCart.toString()),E.createElement(r,{variant:"body1",align:"center",sx:{color:"#000"}},"customerProfileComplete: ",F.customerProfileComplete.toString()),E.createElement(r,{variant:"body1",align:"center",sx:{color:"#000"}},"companyAddressComplete: ",F.companyAddressComplete.toString()),E.createElement(r,{variant:"body1",align:"center",sx:{color:"#000"}},"deliveryAddressComplete: ",F.deliveryAddressComplete.toString()),E.createElement(r,{variant:"body1",align:"center",sx:{color:"#000"}},"billingAddressComplete: ",F.billingAddressComplete.toString()),E.createElement(r,{variant:"body1",align:"center",sx:{color:"#000"}},"businessCredentailsComplete:"," ",F.businessCredentailsComplete.toString()),E.createElement(m,{onClick:function(){console.log("run all checks"),console.log("state",F),K()}},"run all checks")),E.createElement(a,{item:!0,xs:12},E.createElement(r,{variant:"h4",align:"center"},"Check Out")),J&&4!=T&&E.createElement(a,{item:!0,xs:12},E.createElement(i,{sx:{color:"red",border:"2px solid red",p:2}},E.createElement(r,{variant:"h5"},"No products in cart"),E.createElement(r,{variant:"body1"},"There are no products selected to order, please visit the shop befor continuing"))),E.createElement(a,{item:!0,xs:12},E.createElement(i,{width:"100%"},E.createElement(o,{sx:{p:2,mb:2,display:{xs:"block",sm:"none"}}},E.createElement(l,{direction:"row",spacing:2,alignItems:"center"},E.createElement(r,{variant:"body2"},"".concat(T+1," / ").concat(W.length)),E.createElement(r,null,"".concat(W[T].label)))),E.createElement(o,{sx:{px:2,pt:2,mb:2,display:{xs:"none",sm:"block"}}},E.createElement(c,{activeStep:T},W.map((function(t,r){var n={};return E.createElement(s,e({key:r},{},{sx:{pb:"20px"}}),E.createElement(u,n,t.label))})))),!R&&E.createElement(E.Fragment,null,W[T].children,E.createElement(o,{sx:{p:2,mt:2,display:{xs:"none",sm:"block"}}},E.createElement(l,{direction:"row",spacing:2},W[T].backButton,E.createElement(m,{variant:"outlined",sx:{ml:1}},E.createElement(g,{href:H},"continue shopping")),E.createElement(i,{sx:{flex:"1 1 auto"}}),W[T].nextButton))))),E.createElement(a,{item:!0,xs:12},E.createElement(p,{sx:{display:{xs:"flex",sm:"none"}},variant:"text",steps:W.length,position:"static",activeStep:T,nextButton:W[T].nextButton,backButton:W[T].backButton}))))}export{P as default};
7
+ import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import n from"@mui/material/Typography";import r 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 c from"@mui/material/Stepper";import s from"@mui/material/Step";import u from"@mui/material/StepLabel";import p from"@mui/material/MobileStepper";import d from"@mui/material/useMediaQuery";import{useTheme as E}from"@mui/material/styles";import x,{useState as b,useEffect as f}from"react";import g from"next/link";import{useSearchParams as v}from"next/navigation";import{useSession as k}from"../../../context/auth/SessionContext.js";import h from"@mui/icons-material/KeyboardArrowLeft";import C from"@mui/icons-material/KeyboardArrowRight";import y from"./Step1.js";import B from"./Step2.js";import S from"./Step3.js";import j from"./Step4.js";import A from"./Step5.js";import{useClientSideCart as w}from"../cart/hooks.js";import{useCheckout as z}from"../../../context/e-commerce/checkout/CheckoutContext.js";function P(P){var N=P.shopUrl,H=void 0===N?"/shop":N,I=E(),L=d(I.breakpoints.down("sm")),_=z(),F=_.state,K=_.runAllChecks;console.log(F,K);var M=t(b(0),2),T=M[0],D=M[1],G=function(){D((function(e){return e+1}))},O=function(){D((function(e){return e-1}))},Q=k(),R=Q.loading;Q.error;var U=Q.user,q=v();f((function(){null!==q&&(q.get("order")&&D(4))}),[q]),w();var J=!F.itemsInCart,V=!F.customerProfileComplete,W=[{label:"Login or register",children:x.createElement(y,null),backButton:x.createElement(m,{variant:L?"text":"outlined",disabled:0===T,onClick:O,sx:{mr:1}},"Back",L&&x.createElement(h,null)),nextButton:x.createElement(m,{variant:L?"text":"contained",onClick:G,sx:{ml:1},disabled:!U||J,size:L?"small":"large"},"Next",L&&x.createElement(C,null))},{label:"Provide us with your address",children:x.createElement(B,null),backButton:x.createElement(m,{size:L?"small":"large",onClick:O,disabled:0===T,variant:L?"text":"outlined"},"Back",L&&x.createElement(h,null)),nextButton:x.createElement(m,{size:L?"small":"large",variant:L?"text":"contained",onClick:function(){G()},disabled:!U||J||V},"Next",L&&x.createElement(C,null))},{label:"Set up mailing options",children:x.createElement(S,null),backButton:x.createElement(m,{size:L?"small":"large",variant:L?"text":"outlined",onClick:O,disabled:0===T},"Back",L&&x.createElement(h,null)),nextButton:x.createElement(m,{size:L?"small":"large",variant:L?"text":"contained",onClick:function(){G()},disabled:!U||J||V},"Next",L&&x.createElement(C,null))},{label:"Confirm and make a payment",children:x.createElement(j,null),nextButton:x.createElement(x.Fragment,null,x.createElement(m,{size:L?"small":"large",variant:L?"text":"contained",onClick:function(){G()},disabled:!0},"Next",L&&x.createElement(C,null))),backButton:x.createElement(m,{size:L?"small":"large",variant:L?"text":"outlined",onClick:O,disabled:0===T},"Back",L&&x.createElement(h,null))},{label:"Done!",children:x.createElement(A,null)}];return x.createElement(r,{sx:{py:2,minHeight:"100vh"}},x.createElement(a,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"}},x.createElement(a,{item:!0,xs:12,component:i},x.createElement(n,{variant:"body1",align:"center"},"items in cart: ",F.itemsInCart.toString()),x.createElement(n,{variant:"body1",align:"center"},"customerProfileComplete: ",F.customerProfileComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"companyAddressComplete: ",F.companyAddressComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"deliveryAddressComplete: ",F.deliveryAddressComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"billingAddressComplete: ",F.billingAddressComplete.toString()),x.createElement(n,{variant:"body1",align:"center"},"businessCredentailsComplete:"," ",F.businessCredentailsComplete.toString()),x.createElement(m,{onClick:function(){console.log("run all checks"),console.log("state",F),K()}},"run all checks")),x.createElement(a,{item:!0,xs:12},x.createElement(n,{variant:"h4",align:"center"},"Check Out")),J&&4!=T&&x.createElement(a,{item:!0,xs:12},x.createElement(o,{sx:{color:"red",border:"2px solid red",p:2}},x.createElement(n,{variant:"h5"},"No products in cart"),x.createElement(n,{variant:"body1"},"There are no products selected to order, please visit the shop befor continuing"))),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(n,{variant:"body2"},"".concat(T+1," / ").concat(W.length)),x.createElement(n,null,"".concat(W[T].label)))),x.createElement(i,{sx:{px:2,pt:2,mb:2,display:{xs:"none",sm:"block"}}},x.createElement(c,{activeStep:T},W.map((function(t,n){var r={};return x.createElement(s,e({key:n},{},{sx:{pb:"20px"}}),x.createElement(u,r,t.label))})))),!R&&x.createElement(x.Fragment,null,W[T].children,x.createElement(i,{sx:{p:2,mt:2,display:{xs:"none",sm:"block"}}},x.createElement(l,{direction:"row",spacing:2},W[T].backButton,x.createElement(m,{variant:"outlined",sx:{ml:1}},x.createElement(g,{href:H},"continue shopping")),x.createElement(o,{sx:{flex:"1 1 auto"}}),W[T].nextButton))))),x.createElement(a,{item:!0,xs:12},x.createElement(p,{sx:{display:{xs:"flex",sm:"none"}},variant:"text",steps:W.length,position:"static",activeStep:T,nextButton:W[T].nextButton,backButton:W[T].backButton}))))}export{P as default};