umwd-components 0.1.736 → 0.1.737

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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("next/image"),i=require("@mui/material/Dialog"),s=require("@mui/material/AppBar"),l=require("@mui/material/Box"),n=require("@mui/material/Toolbar"),a=require("@mui/material/Typography"),x=require("@mui/material/Container"),o=require("@mui/material/Button"),d=require("@mui/material/List"),h=require("@mui/material/ListItem"),c=require("@mui/material/Divider"),p=require("@mui/material/ListItemText"),m=require("@mui/material/Tabs"),u=require("@mui/material/Tab"),g=require("@mui/icons-material/Close"),j=require("@mui/icons-material/MoreVert"),y=require("@mui/material/styles"),f=require("../StyledLink.js");exports.default=function({data:b}){const{site_title:w,logo:v,navigation:q,maxWidth:T="lg",minHeight:k,sx:S={},home_url:L="/#home",slot1:F=null,slot2:I=null}=b,[D,_]=t.useState(!1),[C,W]=t.useState(0),G=()=>{_(!1)},H=y.useTheme();return t.useEffect(()=>{const e=()=>{const e=document.querySelectorAll("section"),t=window.scrollY+1;e.forEach((e,r)=>{t>=e.offsetTop&&t<e.offsetTop+e.offsetHeight&&W(r)})};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),e.jsx(s,{position:"sticky",sx:{backgroundColor:H.palette.primary.main,...S},children:e.jsx(x,{maxWidth:T,children:e.jsxs(n,{disableGutters:!0,sx:{py:1,"@media all":{minHeight:k}},children:[e.jsx(f.StyledLink,{href:L,sx:{color:H.palette.primary.contrastText,textDecoration:"none",lineHeight:.51},target:"_self",children:e.jsxs(l,{sx:{display:{xs:"none",md:"flex"},alignItems:"center"},children:[void 0!==v?.url&&e.jsx(r,{src:v.url,width:v.width||32,height:v.height||32,alt:v.alternativeText||"site logo",style:{maxHeight:"55px",marginRight:"20px",width:"auto",height:"auto",...v.style}}),null!=w&&e.jsx(e.Fragment,{children:"string"==typeof w?e.jsx(a,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none",p:0},children:w}):e.jsx(e.Fragment,{children:w})})]})}),e.jsx(l,{sx:{display:{xs:"none",md:"flex"},width:{xs:"0px",md:"30px"}}}),e.jsx(l,{sx:{flexGrow:1,display:{xs:"none",md:"flex",alignItems:"center"}},children:e.jsx(m,{value:C,"aria-label":"main website navigation",indicatorColor:"secondary",role:"navigation",children:q.length>0&&q.map(t=>e.jsx(u,{value:t.tab,label:e.jsxs(e.Fragment,{children:[e.jsx(f.StyledLink,{href:t.path,sx:{color:H.palette.primary.contrastText},target:"_self",children:t.title}),t.subItems&&t.subItems.length>0&&t.subItems.map((t,r)=>{const i=50+50*r;return e.jsx(l,{sx:{position:"fixed"},children:e.jsx(l,{sx:{position:"absolute",top:i},children:e.jsx(f.StyledLink,{href:t.path,target:"_self",children:e.jsx(a,{className:"nested",variant:"button",textAlign:"center",sx:{display:"block",position:"absolute",top:"-1000px",transform:"translateX(-50%)",color:H.palette.primary.contrastText,transitionDuration:"0.5s",transitionDelay:"0.5s",width:"max-content","&:hover":{borderBottom:"1px solid red"}},children:t.title})})})},t.id)})]}),sx:{color:H.palette.primary.contrastText,opacity:.9,position:"relative",overflow:"visible",display:"flex",flexDirection:"column","& .nested":{p:0},"&:hover":{".nested":{top:"0px"}}}},t.id))})}),e.jsx(f.StyledLink,{href:"/",sx:{color:H.palette.primary.contrastText,textDecoration:"none"},target:"_self",children:e.jsxs(l,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"},children:[void 0!==v?.url&&e.jsx(l,{sx:{display:"flex",mr:1},children:e.jsx("img",{src:v.url,width:v.width||32,height:v.height||32,alt:v.alternativeText||"site logo",style:{maxHeight:"55px",width:"auto",height:"auto",...v.style}})}),null!=w&&e.jsx(e.Fragment,{children:"string"==typeof w?e.jsx(a,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"},children:w}):e.jsx(e.Fragment,{children:w})})]})}),e.jsx(l,{sx:{display:{xs:"flex"},flexGrow:1}}),F&&e.jsx(l,{sx:{display:{xs:"none",md:"flex"},mr:2},children:F}),I&&e.jsx(l,{sx:{display:{xs:"none",md:"flex"},mr:2},children:I}),e.jsxs(l,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}},children:[e.jsx(o,{onClick:()=>{_(!0)},sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"},children:e.jsx(j,{sx:{color:"primary.contrastText"}})}),e.jsxs(i,{fullScreen:!0,open:D,onClose:G,children:[e.jsx(s,{position:"sticky",children:e.jsx(x,{maxWidth:"xl",children:e.jsxs(n,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"},children:[e.jsx(f.StyledLink,{href:"/",sx:{color:H.palette.primary.contrastText},target:"_self",children:e.jsxs(l,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[v?.url&&e.jsx(l,{sx:{display:"flex",mr:1},children:e.jsx("img",{src:v.url,alt:v.alternativeText||"logo",width:v.width||32,height:v.height||32,style:{maxHeight:"55px",width:"auto",height:"auto"}})}),null!=w&&e.jsx(e.Fragment,{children:"string"==typeof w?e.jsx(a,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"},children:w}):e.jsx(e.Fragment,{children:w})})]})}),e.jsx(o,{onClick:G,sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"},"aria-label":"close",children:e.jsx(g,{sx:{color:"primary.contrastText"}})})]})})}),e.jsxs(d,{children:[q.length>0&&e.jsx(e.Fragment,{children:q.map(r=>e.jsxs(t.Fragment,{children:[e.jsx(f.StyledLink,{href:r.path,target:"_self",children:e.jsx(h,{children:e.jsx(p,{primary:r.title})})}),e.jsx(c,{}),r.subItems&&r.subItems.length>0&&e.jsx(d,{children:r.subItems.map(r=>e.jsxs(t.Fragment,{children:[e.jsx(f.StyledLink,{href:r.path,target:"_self",children:e.jsx(h,{children:e.jsx(p,{primary:r.title})})}),e.jsx(c,{})]},r.id))})]},r.id))}),F&&e.jsxs(e.Fragment,{children:[e.jsx(h,{children:F}),e.jsx(c,{})]}),I&&e.jsxs(e.Fragment,{children:[e.jsx(h,{children:I}),e.jsx(c,{})]})]})]})]})]})})})};
7
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("next/image"),i=require("@mui/material/Dialog"),s=require("@mui/material/AppBar"),l=require("@mui/material/Box"),n=require("@mui/material/Toolbar"),a=require("@mui/material/Typography"),x=require("@mui/material/Container"),o=require("@mui/material/Button"),d=require("@mui/material/List"),h=require("@mui/material/ListItem"),c=require("@mui/material/Divider"),m=require("@mui/material/ListItemText"),p=require("@mui/material/Tabs"),u=require("@mui/material/Tab"),g=require("@mui/icons-material/Close"),j=require("@mui/icons-material/MoreVert"),y=require("@mui/material/styles"),f=require("../StyledLink.js");exports.default=function({data:b}){const{site_title:w,logo:v,navigation:q,maxWidth:T="lg",minHeight:I,sx:k={},home_url:S="/#home",slot1:L=null,slot2:F=null}=b,[D,_]=t.useState(!1),[C,W]=t.useState(0),G=()=>{_(!1)},H=y.useTheme();return t.useEffect(()=>{const e=()=>{const e=document.querySelectorAll("section"),t=window.scrollY+1;e.forEach((e,r)=>{t>=e.offsetTop&&t<e.offsetTop+e.offsetHeight&&W(r)})};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)},[]),e.jsx(s,{position:"sticky",sx:{backgroundColor:H.palette.primary.main,...k},children:e.jsx(x,{maxWidth:T,children:e.jsxs(n,{disableGutters:!0,sx:{py:1,"@media all":{minHeight:I}},children:[e.jsx(f.StyledLink,{href:S,sx:{color:H.palette.primary.contrastText,textDecoration:"none",lineHeight:.51},target:"_self",children:e.jsxs(l,{sx:{display:{xs:"none",md:"flex"},alignItems:"center"},children:[void 0!==v?.url&&e.jsx(r,{src:v.url,width:v.width||32,height:v.height||32,alt:v.alternativeText||"site logo",style:{maxHeight:"55px",marginRight:"20px",width:"auto",height:"auto",...v.style}}),null!=w&&e.jsx(e.Fragment,{children:"string"==typeof w?e.jsx(a,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none",p:0},children:w}):e.jsx(e.Fragment,{children:w})})]})}),e.jsx(l,{sx:{display:{xs:"none",md:"flex"},width:{xs:"0px",md:"30px"}}}),e.jsx(l,{sx:{flexGrow:1,display:{xs:"none",md:"flex",alignItems:"center"}},children:e.jsx(p,{value:C,"aria-label":"main website navigation",indicatorColor:"secondary",role:"navigation",children:q.length>0&&q.map((t,r)=>e.jsx(u,{value:t.tab,label:e.jsxs(e.Fragment,{children:[e.jsx(f.StyledLink,{href:t.path,sx:{color:H.palette.primary.contrastText},target:"_self",children:t.title}),t.subItems&&t.subItems.length>0&&t.subItems.map((t,r)=>{const i=50+50*r;return e.jsx(l,{sx:{position:"fixed"},children:e.jsx(l,{sx:{position:"absolute",top:i},children:e.jsx(f.StyledLink,{href:t.path,target:"_self",children:e.jsx(a,{className:"nested",variant:"button",textAlign:"center",sx:{display:"block",position:"absolute",top:"-1000px",transform:"translateX(-50%)",color:H.palette.primary.contrastText,transitionDuration:"0.5s",transitionDelay:"0.5s",width:"max-content","&:hover":{borderBottom:"1px solid red"}},children:t.title})})},`${t.documentId}-inner`)},t.documentId)})]}),sx:{color:H.palette.primary.contrastText,opacity:.9,position:"relative",overflow:"visible",display:"flex",flexDirection:"column","& .nested":{p:0},"&:hover":{".nested":{top:"0px"}}}},t.documentId))})}),e.jsx(f.StyledLink,{href:"/",sx:{color:H.palette.primary.contrastText,textDecoration:"none"},target:"_self",children:e.jsxs(l,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"},children:[void 0!==v?.url&&e.jsx(l,{sx:{display:"flex",mr:1},children:e.jsx("img",{src:v.url,width:v.width||32,height:v.height||32,alt:v.alternativeText||"site logo",style:{maxHeight:"55px",width:"auto",height:"auto",...v.style}})}),null!=w&&e.jsx(e.Fragment,{children:"string"==typeof w?e.jsx(a,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"},children:w}):e.jsx(e.Fragment,{children:w})})]})}),e.jsx(l,{sx:{display:{xs:"flex"},flexGrow:1}}),L&&e.jsx(l,{sx:{display:{xs:"none",md:"flex"},mr:2},children:L}),F&&e.jsx(l,{sx:{display:{xs:"none",md:"flex"},mr:2},children:F}),e.jsxs(l,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}},children:[e.jsx(o,{onClick:()=>{_(!0)},sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"},children:e.jsx(j,{sx:{color:"primary.contrastText"}})}),e.jsxs(i,{fullScreen:!0,open:D,onClose:G,children:[e.jsx(s,{position:"sticky",children:e.jsx(x,{maxWidth:"xl",children:e.jsxs(n,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"},children:[e.jsx(f.StyledLink,{href:"/",sx:{color:H.palette.primary.contrastText},target:"_self",children:e.jsxs(l,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[v?.url&&e.jsx(l,{sx:{display:"flex",mr:1},children:e.jsx("img",{src:v.url,alt:v.alternativeText||"logo",width:v.width||32,height:v.height||32,style:{maxHeight:"55px",width:"auto",height:"auto"}})}),null!=w&&e.jsx(e.Fragment,{children:"string"==typeof w?e.jsx(a,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"},children:w}):e.jsx(e.Fragment,{children:w})})]})}),e.jsx(o,{onClick:G,sx:{width:"40px",height:"40px",borderRadius:"50%",p:0,minWidth:"unset",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)"},"aria-label":"close",children:e.jsx(g,{sx:{color:"primary.contrastText"}})})]})})}),e.jsxs(d,{children:[q.length>0&&e.jsx(e.Fragment,{children:q.map(r=>e.jsxs(t.Fragment,{children:[e.jsx(f.StyledLink,{href:r.path,target:"_self",children:e.jsx(h,{children:e.jsx(m,{primary:r.title})})}),e.jsx(c,{}),r.subItems&&r.subItems.length>0&&e.jsx(d,{children:r.subItems.map(r=>e.jsxs(t.Fragment,{children:[e.jsx(f.StyledLink,{href:r.path,target:"_self",children:e.jsx(h,{children:e.jsx(m,{primary:r.title})})}),e.jsx(c,{})]},r.documentId))})]},r.documentId))}),L&&e.jsxs(e.Fragment,{children:[e.jsx(h,{children:L}),e.jsx(c,{})]}),F&&e.jsxs(e.Fragment,{children:[e.jsx(h,{children:F}),e.jsx(c,{})]})]})]})]})]})})})};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- "use strict";var r=require("./get-token.js"),e=require("../../../node_modules/qs/lib/index.js"),t=require("../../lib/utils.js"),o=require("next/cache");const a=t.getStrapiURL(),n=e.default.stringify({populate:{customer_profile:{populate:"*"}}}),s=e.default.stringify({populate:"role"});exports.getExtendedUserMeLoader=async function(){o.unstable_noStore();const e=new URL("/api/users/me",a);e.search=n;const t=await r.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const r=await fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(r){return console.error("getExtendedUserMeLoader Error:",r),{ok:!1,data:null,error:r}}},exports.getUserMeLoader=async function(r){const e=new URL("/api/users/me",a);e.search=n;try{const t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);if(t.ok)return t.json();throw new Error("Failed to fetch user details")}catch(r){return console.error("getUserMeLoader Error:",r),null}},exports.getUserRole=async function(){const e=new URL("/api/users/me",a);e.search=s;const t=await r.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const r=await fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(r){return console.error("getUserRole Error:",r),{ok:!1,data:null,error:r}}};
7
+ "use strict";var r=require("./get-token.js"),e=require("../../../node_modules/qs/lib/index.js"),t=require("../../lib/utils.js"),o=require("next/cache");const a=t.getStrapiURL(),n=e.default.stringify({populate:{customer_profile:{populate:["orders","returns"]}}}),s=e.default.stringify({populate:"role"});exports.getExtendedUserMeLoader=async function(){o.unstable_noStore();const e=new URL("/api/users/me",a);e.search=n;const t=await r.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const r=await fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(r){return console.error("getExtendedUserMeLoader Error:",r),{ok:!1,data:null,error:r}}},exports.getUserMeLoader=async function(r){const e=new URL("/api/users/me",a);e.search=n;try{const t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);if(t.ok)return t.json();throw new Error("Failed to fetch user details")}catch(r){return console.error("getUserMeLoader Error:",r),null}},exports.getUserRole=async function(){const e=new URL("/api/users/me",a);e.search=s;const t=await r.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const r=await fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(r){return console.error("getUserRole Error:",r),{ok:!1,data:null,error:r}}};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";exports.parseStrapiNavigation=function(t){let s=[],e=0;for(const u of Object.values(t.pages))if(null==u.parent){let t={id:u.slug,tab:e,title:u.title,path:`${u.path}`,slug:u.slug,subItems:[]};s.push(t),e++}for(const u of Object.values(t.pages))if(null!==u.parent){const t=s.find(t=>t.id===u.parent);if(t){t.subItems||(t.subItems=[]);let s={id:u.id.toString(),tab:e,title:u.title,path:`${u.path}`,slug:u.slug,subItems:[]};t.subItems.push(s),e++}}return s};
6
+ "use strict";exports.parseStrapiNavigation=function(t){let e=[],s=0;for(const u of Object.values(t.pages))if(null==u.parent){let t={documentId:u.documentId,tab:s,title:u.title,path:`${u.path}`,slug:u.slug,subItems:[]};e.push(t),s++}for(const u of Object.values(t.pages))if(null!==u.parent){const t=e.find(t=>t.documentId===u.parent);if(t){t.subItems||(t.subItems=[]);let e={documentId:u.documentId,tab:s,title:u.title,path:`${u.path}`,slug:u.slug,subItems:[]};t.subItems.push(e),s++}}return e};