umwd-components 0.1.493 → 0.1.495
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/node_modules/uuid/dist/esm-browser/native.js +6 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +6 -0
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +6 -0
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +6 -0
- package/dist/src/components/e-commerce/checkout/CheckoutForm.js +1 -1
- package/dist/src/context/common/SnackbarContext.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/context/common/SnackbarContext.d.ts +4 -0
- package/dist/types/data/actions/auth-actions.d.ts +1 -1
- package/dist/types/types/common/snackbar/Snackbar.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/e-commerce/checkout/CheckoutForm.tsx +22 -1
- package/src/context/common/SnackbarContext.tsx +24 -19
- package/src/data/actions/auth-actions.ts +10 -9
- package/src/data/services/auth-service.ts +2 -1
- package/src/types/common/snackbar/Snackbar.ts +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
let t;const e=new Uint8Array(16);function o(){if(!t&&(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!t))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(e)}export{o as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
const t=[];for(let e=0;e<256;++e)t.push((e+256).toString(16).slice(1));function e(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e[n+0]]+t[e[n+1]]+t[e[n+2]]+t[e[n+3]]+"-"+t[e[n+4]]+t[e[n+5]]+"-"+t[e[n+6]]+t[e[n+7]]+"-"+t[e[n+8]]+t[e[n+9]]+"-"+t[e[n+10]]+t[e[n+11]]+t[e[n+12]]+t[e[n+13]]+t[e[n+14]]+t[e[n+15]]}export{e as unsafeStringify};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
import r from"./native.js";import n from"./rng.js";import{unsafeStringify as o}from"./stringify.js";function t(t,m,i){if(r.randomUUID&&!m&&!t)return r.randomUUID();const f=(t=t||{}).random||(t.rng||n)();return f[6]=15&f[6]|64,f[8]=63&f[8]|128,o(f)}export{t 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 a from"@mui/material/Stack";import l from"@mui/material/Grid";import i from"@mui/material/Paper";import o from"@mui/material/Box";import m from"@mui/material/Button";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 a from"@mui/material/Stack";import l 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 y from"next/link";import{useSearchParams as h}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 N from"./Step4.js";import j 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";function w(w){var z=w.shopUrl,I=void 0===z?"/shop":z,O=E(),T=f(O.breakpoints.down("sm")),H=D(),L=H.state,M=H.runAllChecks,R=H.togglePrefersBillingAddress,V=H.togglePrefersDeliveryAddress,F=H.setCustomerInternalReference,K=P().dispatch,G=k(),Q=G.loading;G.error;var U=G.user;G.login;var q=G.logout,J=t(g(0),2),W=J[0],X=J[1],Y=t(g(null),2),Z=Y[0],$=Y[1],ee=t(g(null),2),te=ee[0],re=ee[1],ne=function(){X((function(e){return e+1}))},ae=function(){X((function(e){return e-1}))},le=h();v((function(){if(null!==le){var e=le.get("order");e&&$(e);var t=le.get("message"),r=le.get("severity");t&&r&&re({message:t,severity:r})}}),[le]),v((function(){Z&&(X(4),localStorage.removeItem("cart"),K({type:"SET_ITEMS",payload:[]}))}),[Z]),v((function(){M()}),[U]);var ie=!L.confirmations.itemsInCart,oe=!L.confirmations.customerProfileComplete,me=b((function(){return[{label:"Login or register",children:x.createElement(S,{user:U,logout:q}),backButton:x.createElement(m,{variant:T?"text":"outlined",disabled:0===W,onClick:ae,sx:{mr:1}},"Back",T&&x.createElement(B,null)),nextButton:x.createElement(m,{variant:T?"text":"contained",onClick:ne,sx:{ml:1},disabled:(!U||ie)&&"production"===process.env.NODE_ENV,size:T?"small":"large"},"Next",T&&x.createElement(C,null))},{label:"Provide us with your address",children:x.createElement(_,null),backButton:x.createElement(m,{size:T?"small":"large",onClick:ae,disabled:0===W,variant:T?"text":"outlined"},"Back",T&&x.createElement(B,null)),nextButton:x.createElement(m,{size:T?"small":"large",variant:T?"text":"contained",onClick:function(){ne()},disabled:(!U||ie||oe)&&"production"===process.env.NODE_ENV},"Next",T&&x.createElement(C,null))},{label:"Set up mailing options",children:x.createElement(A,{user:U,prefersBillingAddress:L.prefersBillingAddress,prefersDeliveryAddress:L.prefersDeliveryAddress,delivery_options:L.delivery_options,payment_options:L.payment_options,togglePrefersBillingAddress:R,togglePrefersDeliveryAddress:V,setCustomerInternalReference:F}),backButton:x.createElement(m,{size:T?"small":"large",variant:T?"text":"outlined",onClick:ae,disabled:0===W},"Back",T&&x.createElement(B,null)),nextButton:x.createElement(m,{size:T?"small":"large",variant:T?"text":"contained",onClick:function(){ne()},disabled:(!U||ie||oe)&&"production"===process.env.NODE_ENV},"Next",T&&x.createElement(C,null))},{label:"Confirm and make a payment",children:x.createElement(N,{customer_internal_reference:L.customer_internal_reference}),nextButton:x.createElement(x.Fragment,null,x.createElement(m,{size:T?"small":"large",variant:T?"text":"contained",onClick:function(){ne()},disabled:!0},"Next",T&&x.createElement(C,null))),backButton:x.createElement(m,{size:T?"small":"large",variant:T?"text":"outlined",onClick:ae,disabled:0===W},"Back",T&&x.createElement(B,null))},{label:"Done!",children:x.createElement(j,null)}]}),[U,ie,oe,L,T,W]);return x.createElement(n,{sx:{py:2,minHeight:"100vh"}},x.createElement(l,{container:!0,spacing:2,sx:{py:3,minHeight:"60vh"}},x.createElement(l,{item:!0,xs:12},x.createElement(r,{variant:"h4",align:"center"},"Check Out")),ie&&4!=W&&x.createElement(l,{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!=te&&x.createElement(l,{item:!0,xs:12},x.createElement(d,{severity:te.severity},x.createElement(r,{variant:"body1"},te.message))),x.createElement(l,{item:!0,xs:12},x.createElement(o,{width:"100%"},x.createElement(i,{sx:{p:2,mb:2,display:{xs:"block",sm:"none"}}},x.createElement(a,{direction:"row",spacing:2,alignItems:"center"},x.createElement(r,{variant:"body2"},"".concat(W+1," / ").concat(me.length)),x.createElement(r,null,"".concat(me[W].label)))),x.createElement(i,{sx:{px:2,pt:2,mb:2,display:{xs:"none",sm:"block"}}},x.createElement(s,{activeStep:W},me.map((function(t,r){var n={};return x.createElement(c,e({key:r},{},{sx:{pb:"20px"}}),x.createElement(u,n,t.label))})))),!Q&&x.createElement(x.Fragment,null,me[W].children,x.createElement(i,{sx:{p:2,mt:2,display:{xs:"none",sm:"block"}}},x.createElement(a,{direction:"row",spacing:2},me[W].backButton,x.createElement(m,{variant:"outlined",sx:{ml:1}},x.createElement(y,{href:I},"continue shopping")),x.createElement(o,{sx:{flex:"1 1 auto"}}),me[W].nextButton))))),x.createElement(l,{item:!0,xs:12},x.createElement(p,{sx:{display:{xs:"flex",sm:"none"}},variant:"text",steps:me.length,position:"static",activeStep:W,nextButton:me[W].nextButton,backButton:me[W].backButton}))))}export{w as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__assign as t,__spreadArray as
|
|
7
|
+
import{__read as e,__assign as t,__spreadArray as s}from"../../../node_modules/tslib/tslib.es6.js";import a,{useReducer as r,useContext as o,createContext as n}from"react";import d from"../../../node_modules/uuid/dist/esm-browser/v4.js";var i={messages:[]},c=n({state:i,dispatch:function(){},handleAddMessage:function(){}}),u=function(a,r){switch(r.type){case"SET_STATE":return t({},r.payload);case"ADD_MESSAGE":return t(t({},a),{messages:s(s([],e(a.messages),!1),[r.payload],!1)});default:throw new Error("No case for type ".concat(r.type))}},l=function(s){var o=s.children,n=e(r(u,i),2),l=n[0],p=n[1],m=a.useCallback((function(e){var s=t(t({},e),{open:!0,id:d()});p({type:"ADD_MESSAGE",payload:s})}),[p]),f={state:l,dispatch:p,handleAddMessage:m};return a.createElement(c.Provider,{value:f},o)},p=function(){return o(c)};export{l as SnackbarProvider,p as useSnackbar};
|