umwd-components 0.1.624 → 0.1.625

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.
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__module as r}from"../../../../_virtual/index4.js";import{__require as e}from"./cjs/react-is.production.min.js";import{__require as o}from"./cjs/react-is.development.js";var s;function t(){return s||(s=1,"production"===process.env.NODE_ENV?r.exports=e():r.exports=o()),r.exports}export{t as __require};
6
+ import{__module as r}from"../../../../_virtual/index5.js";import{__require as e}from"./cjs/react-is.production.min.js";import{__require as o}from"./cjs/react-is.development.js";var s;function t(){return s||(s=1,"production"===process.env.NODE_ENV?r.exports=e():r.exports=o()),r.exports}export{t as __require};
@@ -3,5 +3,5 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__module as r}from"../../_virtual/index5.js";import{__require as e}from"../buffer/index.js";
6
+ import{__module as r}from"../../_virtual/index4.js";import{__require as e}from"../buffer/index.js";
7
7
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var o;function n(){return o||(o=1,function(r,o){var n=e(),t=n.Buffer;function u(r,e){for(var o in r)e[o]=r[o]}function f(r,e,o){return t(r,e,o)}t.from&&t.alloc&&t.allocUnsafe&&t.allocUnsafeSlow?r.exports=n:(u(n,o),o.Buffer=f),f.prototype=Object.create(t.prototype),u(t,f),f.from=function(r,e,o){if("number"==typeof r)throw new TypeError("Argument must not be a number");return t(r,e,o)},f.alloc=function(r,e,o){if("number"!=typeof r)throw new TypeError("Argument must be a number");var n=t(r);return void 0!==e?"string"==typeof o?n.fill(e,o):n.fill(e):n.fill(0),n},f.allocUnsafe=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return t(r)},f.allocUnsafeSlow=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return n.SlowBuffer(r)}}(r,r.exports)),r.exports}export{n as __require};
@@ -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 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};
7
+ import e from"react";import t from"@mui/material/SpeedDial";import r from"@mui/material/SpeedDialAction";import i 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 d}from"next/navigation";import{useSession as g}from"../../context/auth/SessionContext.js";import f from"@mui/material/Button";import{Typography as x}from"@mui/material";import E from"@mui/icons-material/KeyboardReturn";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(E,null),name:"Returns",route:"/user/returns"},{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 v(a){var l=a.actions,u=void 0===l?h:l,c=d(),p=g(),E=p.user,v=p.loading,w=p.error,k=p.logout;return v?e.createElement(i,{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(i,{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(r,{key:t.name,icon:t.icon,tooltipTitle:t.name,onClick:function(){return c.push(t.route)}})})),E&&e.createElement(r,{icon:e.createElement(s,null),tooltipTitle:"Log-Out",onClick:function(){return k()}}))))}export{v as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as o}from"react";import{useFormState as n}from"react-dom";import{createIroAction as i}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{StrapiErrors as l}from"../../StrapiErrors.js";import{SubmitButton as m}from"../../SubmitButton.js";import u from"@mui/material/Typography";import c from"@mui/material/Grid";import d from"@mui/material/Box";import s from"@mui/material/TextField";import p from"@mui/material/Button";import v from"@mui/material/Alert";import E from"@mui/material/Stack";import{Divider as f}from"@mui/material";import{TextualAmountUpdater as g}from"../../common/TextualAmountUpdater.js";var h={zodErrors:null,strapiErrors:null,data:null,message:null},y=function(t){var o,n=t.item;t.addToRma;var i=e(a(!1),2),l=i[0],m=i[1],c=e(a(0),2);c[0];var d=c[1],p=e(a(),2);p[0];var v=p[1],h=e(a(),2);h[0];var y=h[1];return r.createElement(E,{spacing:1},r.createElement(u,{variant:"body1"},"Line Item Number: ",n.line_item_number),r.createElement(u,{variant:"body1"},"Part Number: ",null===(o=n.product)||void 0===o?void 0:o.product_number),r.createElement(u,{variant:"body1"},"Quantity Ordered: ",n.ordered_quantity),r.createElement(g,{label:"Quantity to return",currentValue:0,totalValue:n.ordered_quantity,minNewValue:0,maxNewValue:n.ordered_quantity,handleChange:function(e){console.log(e),d(e)},color:"info"}),r.createElement(u,{variant:"body1"},"Reason for return:"),r.createElement(s,{select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;m("other"===t),v(t)}},r.createElement("option",{value:"damaged"},"Damaged"),r.createElement("option",{value:"not_as_described"},"Not as described"),r.createElement("option",{value:"wrong_item"},"Wrong item"),r.createElement("option",{value:"other"},"Other")),l&&r.createElement(s,{label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;console.log(t),y(t)}}),r.createElement(f,null))},b=function(e){return e.data,r.createElement(E,{spacing:2},r.createElement(u,{variant:"h6"},"Confirm RMA"),r.createElement(u,{variant:"body1"},"Are you sure you want to request a return merchandise authorization for the selected items?"),r.createElement(E,{direction:"row",spacing:2},r.createElement(m,{text:"Yes",loadingText:"Loading..."}),r.createElement(p,null,"No")))};function x(s){var p,f,g=s.opo,x=s.sx,_=s.revalidateCallback;s.handleClose;var A=e(n(i,h),2),C=A[0],N=A[1],R=e(a([]),2),T=R[0],q=R[1],w=function(r){q(t(t([],e(T),!1),[r],!1))};return o((function(){(null==C?void 0:C.data)&&_&&_()}),[C.data]),console.log(g),r.createElement(d,{sx:t([],e(Array.isArray(x)?x:[x]),!1)},r.createElement("form",{action:N},r.createElement(c,{container:!0,spacing:2},r.createElement(c,{item:!0,xs:12},r.createElement(u,{variant:"h6"},"RMA Form")),r.createElement(c,{item:!0,xs:12},r.createElement(E,{spacing:2},r.createElement(u,{variant:"body1"},"Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned."))),r.createElement(c,{item:!0,xs:12},(null===(p=g.opo_items)||void 0===p?void 0:p.data)?r.createElement(E,{spacing:2},r.createElement(u,{variant:"h6"},"Items"),r.createElement(u,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),r.createElement(E,{spacing:1},null===(f=g.opo_items)||void 0===f?void 0:f.data.map((function(e,t){return r.createElement(y,{key:t,item:e,addToRma:w})})))):r.createElement(u,{variant:"body1"},"No items")),r.createElement(b,{data:C}),r.createElement(c,{item:!0,xs:12},r.createElement(m,{text:"Request RMA",loadingText:"Loading..."}),null!==(null==C?void 0:C.strapiErrors)&&r.createElement(l,{error:null==C?void 0:C.strapiErrors}),(null==C?void 0:C.message)&&r.createElement(v,{severity:"error"},null==C?void 0:C.message)))))}export{x as default};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as o}from"react";import{useFormState as n}from"react-dom";import{requestRmaAction as i}from"../../../data/actions/e-commerce/iro/requestRmaAction.js";import{StrapiErrors as l}from"../../StrapiErrors.js";import{SubmitButton as m}from"../../SubmitButton.js";import u from"@mui/material/Typography";import c from"@mui/material/Grid";import d from"@mui/material/Box";import s from"@mui/material/TextField";import p from"@mui/material/Button";import v from"@mui/material/Alert";import E from"@mui/material/Stack";import{Divider as f}from"@mui/material";import{TextualAmountUpdater as g}from"../../common/TextualAmountUpdater.js";var h={zodErrors:null,strapiErrors:null,data:null,message:null},y=function(t){var o,n=t.item;t.addToRma;var i=e(a(!1),2),l=i[0],m=i[1],c=e(a(0),2);c[0];var d=c[1],p=e(a(),2);p[0];var v=p[1],h=e(a(),2);h[0];var y=h[1];return r.createElement(E,{spacing:1},r.createElement(u,{variant:"body1"},"Line Item Number: ",n.line_item_number),r.createElement(u,{variant:"body1"},"Part Number: ",null===(o=n.product)||void 0===o?void 0:o.product_number),r.createElement(u,{variant:"body1"},"Quantity Ordered: ",n.ordered_quantity),r.createElement(g,{label:"Quantity to return",currentValue:0,totalValue:n.ordered_quantity,minNewValue:0,maxNewValue:n.ordered_quantity,handleChange:function(e){console.log(e),d(e)},color:"info"}),r.createElement(u,{variant:"body1"},"Reason for return:"),r.createElement(s,{select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;m("other"===t),v(t)}},r.createElement("option",{value:"damaged"},"Damaged"),r.createElement("option",{value:"not_as_described"},"Not as described"),r.createElement("option",{value:"wrong_item"},"Wrong item"),r.createElement("option",{value:"other"},"Other")),l&&r.createElement(s,{label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;console.log(t),y(t)}}),r.createElement(f,null))},b=function(e){return e.data,r.createElement(E,{spacing:2},r.createElement(u,{variant:"h6"},"Confirm RMA"),r.createElement(u,{variant:"body1"},"Are you sure you want to request a return merchandise authorization for the selected items?"),r.createElement(E,{direction:"row",spacing:2},r.createElement(m,{text:"Yes",loadingText:"Loading..."}),r.createElement(p,null,"No")))};function x(s){var p,f,g=s.opo,x=s.sx,_=s.revalidateCallback;s.handleClose;var A=e(n(i,h),2),R=A[0],q=A[1],C=e(a([]),2),N=C[0],T=C[1],w=function(r){T(t(t([],e(N),!1),[r],!1))};return o((function(){(null==R?void 0:R.data)&&_&&_()}),[R.data]),console.log(g),r.createElement(d,{sx:t([],e(Array.isArray(x)?x:[x]),!1)},r.createElement("form",{action:q},r.createElement(c,{container:!0,spacing:2},r.createElement(c,{item:!0,xs:12},r.createElement(u,{variant:"h6"},"RMA Form")),r.createElement(c,{item:!0,xs:12},r.createElement(E,{spacing:2},r.createElement(u,{variant:"body1"},"Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned."))),r.createElement(c,{item:!0,xs:12},(null===(p=g.opo_items)||void 0===p?void 0:p.data)?r.createElement(E,{spacing:2},r.createElement(u,{variant:"h6"},"Items"),r.createElement(u,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),r.createElement(E,{spacing:1},null===(f=g.opo_items)||void 0===f?void 0:f.data.map((function(e,t){return r.createElement(y,{key:t,item:e,addToRma:w})})))):r.createElement(u,{variant:"body1"},"No items")),r.createElement(b,{data:R}),r.createElement(c,{item:!0,xs:12},r.createElement(m,{text:"Request RMA",loadingText:"Loading..."}),null!==(null==R?void 0:R.strapiErrors)&&r.createElement(l,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&r.createElement(v,{severity:"error"},null==R?void 0:R.message)))))}export{x as default};
@@ -0,0 +1,7 @@
1
+ "use server";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__awaiter as r,__generator as e,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as i}from"../../../../lib/parseFormData.js";function a(a,n){return r(this,void 0,void 0,(function(){var r,l,m;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),r=i(n),[4,t("POST","/api/iros",r)];case 1:return(l=e.sent())?l.error?[2,s(s({},a),{strapiErrors:l.error,message:"Failed to Create Iro."})]:(m=o(l),[2,s(s({},a),{message:"Iro Created Successfully",data:m,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as requestRmaAction};