umwd-components 0.1.305 → 0.1.308

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{__assign as e,__read as t}from"../../../../node_modules/tslib/tslib.es6.js";import n from"next/dynamic";import{StyleSheet as l}from"@react-pdf/renderer";import r,{Fragment as o,useState as c}from"react";import i from"@mui/material/IconButton";import a from"@mui/material/Dialog";import m from"@mui/material/DialogContent";import u from"@mui/material/DialogActions";import d from"@mui/material/Button";import s from"@mui/icons-material/PictureAsPdf";var E=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function y(t){var l,c,i=t.props,a=function(){return r.createElement("p",null,"Loading...")},m=n((function(){return import("@react-pdf/renderer").then((function(e){return e.Page}))}),{ssr:!1,loading:a}),u=n((function(){return import("@react-pdf/renderer").then((function(e){return e.Text}))}),{ssr:!1,loading:a});n((function(){return import("@react-pdf/renderer").then((function(e){return e.Image}))}),{ssr:!1,loading:a}),n((function(){return import("@react-pdf/renderer").then((function(e){return e.Svg}))}),{ssr:!1,loading:a});var d=n((function(){return import("@react-pdf/renderer").then((function(e){return e.View}))}),{ssr:!1,loading:a}),s=n((function(){return import("@react-pdf/renderer").then((function(e){return e.Document}))}),{ssr:!1,loading:a}),y=i.invoice,p=y.seller_business_credentials,f=y.seller_company_address,v=y.buyer_company_address,S=y.buyer_business_credentials;return r.createElement(s,null,r.createElement(m,{size:"A4",style:E.page},r.createElement(d,{style:E.header},r.createElement(u,{style:E.h1},null==p?void 0:p.company_name)),r.createElement(d,{style:E.section},r.createElement(u,{style:E.h2},"INVOICE")),r.createElement(d,{style:E.section},r.createElement(d,{style:E.row},r.createElement(d,{style:E.rowSection},r.createElement(u,{style:E.h3},"BILLING DETAILS"),r.createElement(u,null,null==S?void 0:S.company_name),r.createElement(u,null,null==y?void 0:y.buyer_first_name," ",null==y?void 0:y.buyer_last_name),r.createElement(u,null,null==v?void 0:v.street," ",null==v?void 0:v.street_number," ",null==v?void 0:v.street_number_addition),r.createElement(u,null,null==v?void 0:v.postal_code," ",null==v?void 0:v.city)),r.createElement(d,{style:E.rowSection},r.createElement(u,{style:E.h3},"FROM"),r.createElement(u,null,null==p?void 0:p.company_name),r.createElement(u,null,null==f?void 0:f.street," ",null==f?void 0:f.street_number," ",null==f?void 0:f.street_number_addition),r.createElement(u,null,null==f?void 0:f.postal_code," ",null==f?void 0:f.city),r.createElement(u,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),r.createElement(u,null,null==p?void 0:p.coc_number),r.createElement(u,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),r.createElement(u,null,null==p?void 0:p.vat_number)))),r.createElement(d,{style:E.section},r.createElement(d,{style:E.row},r.createElement(d,{style:E.rowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Invoice number"),r.createElement(u,null,null==y?void 0:y.invoice_number)),r.createElement(d,{style:E.rowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Invoice date"),r.createElement(u,null,null==y?void 0:y.invoice_date)))),r.createElement(d,{style:E.section},r.createElement(u,{style:E.h3},"SUMMARY"),r.createElement(d,{style:E.row},r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Title")),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Amount")),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"VAT rate")),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"VAT")),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Excl. VAT")),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Incl. VAT"))),null===(l=null==y?void 0:y.items)||void 0===l?void 0:l.map((function(e,t){return r.createElement(o,{key:t},r.createElement(d,{style:E.row},r.createElement(d,{style:E.productRowSection},r.createElement(u,null,e.product_title)),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,e.quantity)),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,e.vat_rate," %")),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,"€ ",(e.price_incl_vat-e.price_excl_vat).toFixed(2))),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,"€ ",e.price_excl_vat)),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,"€ ",e.price_incl_vat))))}))),r.createElement(d,{style:E.section},r.createElement(u,{style:E.h3},"TOTALS"),r.createElement(d,{style:E.row},r.createElement(d,{style:E.productRowSection}),r.createElement(d,{style:E.productRowSection}),r.createElement(d,{style:E.productRowSection}),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"VAT")),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Excl. VAT")),r.createElement(d,{style:E.productRowSection},r.createElement(u,{style:{fontStyle:"bold"}},"Incl. VAT"))),r.createElement(d,{style:E.row},r.createElement(d,{style:E.productRowSection}),r.createElement(d,{style:E.productRowSection}),r.createElement(d,{style:E.productRowSection}),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,"€ ",null===(c=null==y?void 0:y.VAT_total)||void 0===c?void 0:c.toFixed(2))),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,"€ ",null==y?void 0:y.total_excl_vat)),r.createElement(d,{style:E.productRowSection},r.createElement(u,null,"€ ",null==y?void 0:y.total_incl_vat)))),r.createElement(d,{style:E.section},r.createElement(u,{style:e(e({},E.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null==y?void 0:y.total_incl_vat))))}function p(e){var t=e.invoice,l=n((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFDownloadLink}))}),{ssr:!1,loading:function(){return r.createElement("p",null,"Loading...")}});return r.createElement(l,{document:r.createElement(y,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},r.createElement(i,null,r.createElement(s,null)))}function f(e){var l=e.invoice,o=n((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFViewer}))}),{ssr:!1,loading:function(){return r.createElement("p",null,"Loading...")}}),E=t(c(!1),2),p=E[0],f=E[1];return r.createElement(r.Fragment,null,r.createElement(i,{onClick:function(){return f(!0)}},r.createElement(s,null)),r.createElement(a,{open:p,fullWidth:!0,maxWidth:"lg"},r.createElement(m,null,r.createElement(o,{style:{width:"100%",minHeight:"70vh"}},r.createElement(y,{props:{invoice:l}}))),r.createElement(u,null,r.createElement(d,{variant:"contained",onClick:function(){return f(!1)}},"Close"))))}export{p as InvoiceDownloadLink,f as InvoicePDFViewer,y as default};
7
+ import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import l from"next/dynamic";import{StyleSheet as n,Document as o,Page as r,View as c,Text as i}from"@react-pdf/renderer";import a,{useState as m,Fragment as u}from"react";import d from"@mui/material/IconButton";import s from"@mui/material/Dialog";import E from"@mui/material/DialogContent";import y from"@mui/material/DialogActions";import p from"@mui/material/Button";import v from"@mui/icons-material/PictureAsPdf";var f=n.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function S(e){var l,n,m=e.props.invoice,d=m.seller_business_credentials,s=m.seller_company_address,E=m.buyer_company_address,y=m.buyer_business_credentials;return a.createElement(o,null,a.createElement(r,{size:"A4",style:f.page},a.createElement(c,{style:f.header},a.createElement(i,{style:f.h1},null==d?void 0:d.company_name)),a.createElement(c,{style:f.section},a.createElement(i,{style:f.h2},"INVOICE")),a.createElement(c,{style:f.section},a.createElement(c,{style:f.row},a.createElement(c,{style:f.rowSection},a.createElement(i,{style:f.h3},"BILLING DETAILS"),a.createElement(i,null,null==y?void 0:y.company_name),a.createElement(i,null,null==m?void 0:m.buyer_first_name," ",null==m?void 0:m.buyer_last_name),a.createElement(i,null,null==E?void 0:E.street," ",null==E?void 0:E.street_number," ",null==E?void 0:E.street_number_addition),a.createElement(i,null,null==E?void 0:E.postal_code," ",null==E?void 0:E.city)),a.createElement(c,{style:f.rowSection},a.createElement(i,{style:f.h3},"FROM"),a.createElement(i,null,null==d?void 0:d.company_name),a.createElement(i,null,null==s?void 0:s.street," ",null==s?void 0:s.street_number," ",null==s?void 0:s.street_number_addition),a.createElement(i,null,null==s?void 0:s.postal_code," ",null==s?void 0:s.city),a.createElement(i,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),a.createElement(i,null,null==d?void 0:d.coc_number),a.createElement(i,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),a.createElement(i,null,null==d?void 0:d.vat_number)))),a.createElement(c,{style:f.section},a.createElement(c,{style:f.row},a.createElement(c,{style:f.rowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Invoice number"),a.createElement(i,null,null==m?void 0:m.invoice_number)),a.createElement(c,{style:f.rowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Invoice date"),a.createElement(i,null,null==m?void 0:m.invoice_date)))),a.createElement(c,{style:f.section},a.createElement(i,{style:f.h3},"SUMMARY"),a.createElement(c,{style:f.row},a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Title")),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Amount")),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT rate")),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT")),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Excl. VAT")),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Incl. VAT"))),null===(l=null==m?void 0:m.items)||void 0===l?void 0:l.map((function(e,t){return a.createElement(u,{key:t},a.createElement(c,{style:f.row},a.createElement(c,{style:f.productRowSection},a.createElement(i,null,e.product_title)),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,e.quantity)),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,e.vat_rate," %")),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,"€ ",(e.price_incl_vat-e.price_excl_vat).toFixed(2))),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,"€ ",e.price_excl_vat)),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,"€ ",e.price_incl_vat))))}))),a.createElement(c,{style:f.section},a.createElement(i,{style:f.h3},"TOTALS"),a.createElement(c,{style:f.row},a.createElement(c,{style:f.productRowSection}),a.createElement(c,{style:f.productRowSection}),a.createElement(c,{style:f.productRowSection}),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT")),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Excl. VAT")),a.createElement(c,{style:f.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Incl. VAT"))),a.createElement(c,{style:f.row},a.createElement(c,{style:f.productRowSection}),a.createElement(c,{style:f.productRowSection}),a.createElement(c,{style:f.productRowSection}),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,"€ ",null===(n=null==m?void 0:m.VAT_total)||void 0===n?void 0:n.toFixed(2))),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,"€ ",null==m?void 0:m.total_excl_vat)),a.createElement(c,{style:f.productRowSection},a.createElement(i,null,"€ ",null==m?void 0:m.total_incl_vat)))),a.createElement(c,{style:f.section},a.createElement(i,{style:t(t({},f.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null==m?void 0:m.total_incl_vat))))}function _(e){var t=e.invoice,n=l((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFDownloadLink}))}),{ssr:!1,loading:function(){return a.createElement("p",null,"Loading...")}});return a.createElement(n,{document:a.createElement(S,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},a.createElement(d,null,a.createElement(v,null)))}function w(t){var n=t.invoice,o=l((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFViewer}))}),{ssr:!1,loading:function(){return a.createElement("p",null,"Loading...")}}),r=e(m(!1),2),c=r[0],i=r[1];return a.createElement(a.Fragment,null,a.createElement(d,{onClick:function(){return i(!0)}},a.createElement(v,null)),a.createElement(s,{open:c,fullWidth:!0,maxWidth:"lg"},a.createElement(E,null,a.createElement(o,{style:{width:"100%",minHeight:"70vh"}},a.createElement(S,{props:{invoice:n}}))),a.createElement(y,null,a.createElement(p,{variant:"contained",onClick:function(){return i(!1)}},"Close"))))}export{_ as InvoiceDownloadLink,w as InvoicePDFViewer};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import r,{useState as l,useEffect as a,Fragment as n}from"react";import i from"next/image";import o from"@mui/material/Dialog";import m from"@mui/material/AppBar";import s from"@mui/material/Box";import p from"@mui/material/Toolbar";import c from"@mui/material/Typography";import x from"@mui/material/Container";import u from"@mui/material/Button";import d from"@mui/material/List";import f from"@mui/material/ListItem";import h from"@mui/material/Divider";import g from"@mui/material/ListItemText";import E from"@mui/material/Tabs";import y from"@mui/material/Tab";import b from"@mui/icons-material/Close";import v from"@mui/icons-material/MoreVert";import{useTheme as w}from"@mui/material/styles";import{StyledLink as T}from"../StyledLink.js";function I(I){var k=I.data,D=k.site_title,_=k.logo,C=k.navigation,W=k.maxWidth,F=k.minHeight,G=k.sx,H=void 0===G?{}:G,L=k.home_url,S=void 0===L?"/#home":L,B=k.slot1,j=void 0===B?null:B,A=k.slot2,R=void 0===A?null:A;console.log(C);var q=e(l(!1),2),M=q[0],N=q[1],V=e(l(0),2),X=V[0],Y=V[1],z=function(){N(!1)},J=w();return a((function(){var e=function(){var e=document.querySelectorAll("section"),t=window.scrollY+1;e.forEach((function(e,r){t>=e.offsetTop&&t<e.offsetTop+e.offsetHeight&&Y(r)}))};return window.addEventListener("scroll",e),function(){return window.removeEventListener("scroll",e)}}),[]),r.createElement(m,{position:"sticky",sx:t({backgroundColor:J.palette.primary.main},H)},r.createElement(x,{maxWidth:W},r.createElement(p,{disableGutters:!0,sx:{py:1,"@media all":{minHeight:F}}},r.createElement(T,{href:S,sx:{color:J.palette.primary.contrastText,textDecoration:"none",lineHeight:.51},target:"_self"},r.createElement(s,{sx:{display:{xs:"none",md:"flex"},alignItems:"center"}},void 0!==(null==_?void 0:_.url)&&r.createElement(i,{src:_.url,width:_.width,height:_.height,alt:_.alternativeText||"site logo",style:t({maxHeight:"55px",marginRight:"20px",width:"auto",height:"auto"},_.style)}),null!=D&&r.createElement(r.Fragment,null,"string"==typeof D?r.createElement(c,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none",p:0}},D):r.createElement(r.Fragment,null,D)))),r.createElement(s,{sx:{display:{xs:"none",md:"flex"},width:{xs:"0px",md:"30px"}}}),r.createElement(s,{sx:{flexGrow:1,display:{xs:"none",md:"flex",alignItems:"center"}}},r.createElement(E,{value:X,"aria-label":"main website navigation",indicatorColor:"secondary",role:"navigation"},C.length>0&&C.map((function(e){return r.createElement(y,{key:e.id,value:e.id,label:r.createElement(r.Fragment,null,r.createElement(T,{href:e.path,sx:{color:J.palette.primary.contrastText},target:"_self"},e.title),e.subItems&&e.subItems.length>0&&e.subItems.map((function(e,t){var l=50+50*t;return r.createElement(s,{key:e.id,sx:{position:"fixed"}},r.createElement(s,{sx:{position:"absolute",top:l}},r.createElement(T,{href:e.path,target:"_self"},r.createElement(c,{className:"nested",variant:"button",textAlign:"center",sx:{display:"block",position:"absolute",top:"-1000px",transform:"translateX(-50%)",color:J.palette.primary.contrastText,transitionDuration:"0.5s",transitionDelay:"0.5s",width:"max-content","&:hover":{borderBottom:"1px solid red"}}},e.title))))}))),sx:{color:J.palette.primary.contrastText,opacity:.9,position:"relative",overflow:"visible",display:"flex",flexDirection:"column","& .nested":{p:0},"&:hover":{".nested":{top:"0px"}}}})})))),r.createElement(T,{href:"/",sx:{color:J.palette.primary.contrastText,textDecoration:"none"},target:"_self"},r.createElement(s,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"}},void 0!==(null==_?void 0:_.url)&&r.createElement(s,{sx:{display:"flex",mr:1}},r.createElement("img",{src:_.url,width:_.width||32,height:_.height||32,alt:_.alternativeText||"site logo",style:t({maxHeight:"55px",width:"auto",height:"auto"},_.style)})),null!=D&&r.createElement(r.Fragment,null,"string"==typeof D?r.createElement(c,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"}},D):r.createElement(r.Fragment,null,D)))),r.createElement(s,{sx:{display:{xs:"flex"},flexGrow:1}}),j&&r.createElement(s,{sx:{display:{xs:"flex"},mr:2}},j),R&&r.createElement(s,{sx:{display:{xs:"flex"},mr:2}},R),r.createElement(s,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}}},r.createElement(u,{onClick:function(){N(!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)"}},r.createElement(v,{sx:{color:"primary.contrastText"}})),r.createElement(o,{fullScreen:!0,open:M,onClose:z},r.createElement(m,{position:"sticky"},r.createElement(x,{maxWidth:"xl"},r.createElement(p,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"}},r.createElement(T,{href:"/",sx:{color:J.palette.primary.contrastText},target:"_self"},r.createElement(s,{sx:{display:"flex",flexDirection:"row",alignItems:"center"}},(null==_?void 0:_.url)&&r.createElement(s,{sx:{display:"flex",mr:1}},r.createElement("img",{src:_.url,alt:_.alternativeText||"logo",width:_.width||32,height:_.height||32,style:{maxHeight:"55px",width:"auto",height:"auto"}})),null!=D&&r.createElement(r.Fragment,null,"string"==typeof D?r.createElement(c,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"}},D):r.createElement(r.Fragment,null,D)))),r.createElement(u,{onClick:z,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"},r.createElement(b,{sx:{color:"primary.contrastText"}}))))),C.length>0&&r.createElement(d,null,C.map((function(e){return r.createElement(n,{key:e.id},r.createElement(T,{href:e.path,target:"_self"},r.createElement(f,null,r.createElement(g,{primary:e.title}))),r.createElement(h,null),e.subItems&&e.subItems.length>0&&r.createElement(d,null,e.subItems.map((function(e){return r.createElement(n,{key:e.id},r.createElement(T,{href:e.path,target:"_self"},r.createElement(f,null,r.createElement(g,{primary:e.title}))),r.createElement(h,null))}))))}))))))))}export{I as default};
7
+ import{__read as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as l,Fragment as n}from"react";import i from"next/image";import o from"@mui/material/Dialog";import m from"@mui/material/AppBar";import s from"@mui/material/Box";import p from"@mui/material/Toolbar";import x from"@mui/material/Typography";import c from"@mui/material/Container";import u from"@mui/material/Button";import d from"@mui/material/List";import f from"@mui/material/ListItem";import h from"@mui/material/Divider";import g from"@mui/material/ListItemText";import E from"@mui/material/Tabs";import y from"@mui/material/Tab";import b from"@mui/icons-material/Close";import v from"@mui/icons-material/MoreVert";import{useTheme as w}from"@mui/material/styles";import{StyledLink as T}from"../StyledLink.js";function I(I){var k=I.data,D=k.site_title,_=k.logo,C=k.navigation,W=k.maxWidth,F=k.minHeight,G=k.sx,H=void 0===G?{}:G,L=k.home_url,S=void 0===L?"/#home":L,B=k.slot1,j=void 0===B?null:B,A=k.slot2,R=void 0===A?null:A,q=e(a(!1),2),M=q[0],N=q[1],V=e(a(0),2),X=V[0],Y=V[1],z=function(){N(!1)},J=w();return l((function(){var e=function(){var e=document.querySelectorAll("section"),t=window.scrollY+1;e.forEach((function(e,r){t>=e.offsetTop&&t<e.offsetTop+e.offsetHeight&&Y(r)}))};return window.addEventListener("scroll",e),function(){return window.removeEventListener("scroll",e)}}),[]),r.createElement(m,{position:"sticky",sx:t({backgroundColor:J.palette.primary.main},H)},r.createElement(c,{maxWidth:W},r.createElement(p,{disableGutters:!0,sx:{py:1,"@media all":{minHeight:F}}},r.createElement(T,{href:S,sx:{color:J.palette.primary.contrastText,textDecoration:"none",lineHeight:.51},target:"_self"},r.createElement(s,{sx:{display:{xs:"none",md:"flex"},alignItems:"center"}},void 0!==(null==_?void 0:_.url)&&r.createElement(i,{src:_.url,width:_.width,height:_.height,alt:_.alternativeText||"site logo",style:t({maxHeight:"55px",marginRight:"20px",width:"auto",height:"auto"},_.style)}),null!=D&&r.createElement(r.Fragment,null,"string"==typeof D?r.createElement(x,{variant:"h6",noWrap:!0,component:"h1",sx:{display:"flex",textDecoration:"none",p:0}},D):r.createElement(r.Fragment,null,D)))),r.createElement(s,{sx:{display:{xs:"none",md:"flex"},width:{xs:"0px",md:"30px"}}}),r.createElement(s,{sx:{flexGrow:1,display:{xs:"none",md:"flex",alignItems:"center"}}},r.createElement(E,{value:X,"aria-label":"main website navigation",indicatorColor:"secondary",role:"navigation"},C.length>0&&C.map((function(e){return r.createElement(y,{key:e.id,value:e.tab,label:r.createElement(r.Fragment,null,r.createElement(T,{href:e.path,sx:{color:J.palette.primary.contrastText},target:"_self"},e.title),e.subItems&&e.subItems.length>0&&e.subItems.map((function(e,t){var a=50+50*t;return r.createElement(s,{key:e.id,sx:{position:"fixed"}},r.createElement(s,{sx:{position:"absolute",top:a}},r.createElement(T,{href:e.path,target:"_self"},r.createElement(x,{className:"nested",variant:"button",textAlign:"center",sx:{display:"block",position:"absolute",top:"-1000px",transform:"translateX(-50%)",color:J.palette.primary.contrastText,transitionDuration:"0.5s",transitionDelay:"0.5s",width:"max-content","&:hover":{borderBottom:"1px solid red"}}},e.title))))}))),sx:{color:J.palette.primary.contrastText,opacity:.9,position:"relative",overflow:"visible",display:"flex",flexDirection:"column","& .nested":{p:0},"&:hover":{".nested":{top:"0px"}}}})})))),r.createElement(T,{href:"/",sx:{color:J.palette.primary.contrastText,textDecoration:"none"},target:"_self"},r.createElement(s,{sx:{display:{xs:"flex",md:"none"},alignItems:"center"}},void 0!==(null==_?void 0:_.url)&&r.createElement(s,{sx:{display:"flex",mr:1}},r.createElement("img",{src:_.url,width:_.width||32,height:_.height||32,alt:_.alternativeText||"site logo",style:t({maxHeight:"55px",width:"auto",height:"auto"},_.style)})),null!=D&&r.createElement(r.Fragment,null,"string"==typeof D?r.createElement(x,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"}},D):r.createElement(r.Fragment,null,D)))),r.createElement(s,{sx:{display:{xs:"flex"},flexGrow:1}}),j&&r.createElement(s,{sx:{display:{xs:"flex"},mr:2}},j),R&&r.createElement(s,{sx:{display:{xs:"flex"},mr:2}},R),r.createElement(s,{sx:{flexGrow:0,display:{xs:"flex",md:"none"}}},r.createElement(u,{onClick:function(){N(!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)"}},r.createElement(v,{sx:{color:"primary.contrastText"}})),r.createElement(o,{fullScreen:!0,open:M,onClose:z},r.createElement(m,{position:"sticky"},r.createElement(c,{maxWidth:"xl"},r.createElement(p,{disableGutters:!0,sx:{py:1,justifyContent:"space-between"}},r.createElement(T,{href:"/",sx:{color:J.palette.primary.contrastText},target:"_self"},r.createElement(s,{sx:{display:"flex",flexDirection:"row",alignItems:"center"}},(null==_?void 0:_.url)&&r.createElement(s,{sx:{display:"flex",mr:1}},r.createElement("img",{src:_.url,alt:_.alternativeText||"logo",width:_.width||32,height:_.height||32,style:{maxHeight:"55px",width:"auto",height:"auto"}})),null!=D&&r.createElement(r.Fragment,null,"string"==typeof D?r.createElement(x,{variant:"h5",noWrap:!0,component:"h1",sx:{display:"flex",flexGrow:1,textDecoration:"none"}},D):r.createElement(r.Fragment,null,D)))),r.createElement(u,{onClick:z,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"},r.createElement(b,{sx:{color:"primary.contrastText"}}))))),C.length>0&&r.createElement(d,null,C.map((function(e){return r.createElement(n,{key:e.id},r.createElement(T,{href:e.path,target:"_self"},r.createElement(f,null,r.createElement(g,{primary:e.title}))),r.createElement(h,null),e.subItems&&e.subItems.length>0&&r.createElement(d,null,e.subItems.map((function(e){return r.createElement(n,{key:e.id},r.createElement(T,{href:e.path,target:"_self"},r.createElement(f,null,r.createElement(g,{primary:e.title}))),r.createElement(h,null))}))))}))))))))}export{I as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as e,__generator as t}from"../../../node_modules/tslib/tslib.es6.js";import r from"../../../node_modules/qs/lib/index.js";import{fetchData as i}from"../loaders.js";import{getStrapiURL as n,flattenAttributes as s}from"../../lib/utils.js";import{unstable_noStore as o}from"next/cache";var a=n();function c(n){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return o(),(e=new URL("/api/slugify/slugs/product/".concat(n),a)).search=r.stringify({populate:{price:!0,image:!0,galery:!0,dimensions:!0,categories:!0,brand:!0}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function u(n,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return 4,(e=new URL("/api/products",a)).search=r.stringify({populate:{price:!0,image:!0,galery:!0,dimensions:!0,categories:!0,brand:!0},pagination:{pageSize:4,page:s}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function p(n){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(e=new URL("/api/slugify/slugs/product-category/".concat(n),a)).search=r.stringify({populate:{products:{populate:{image:!0,price:!0}}}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function l(n,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return 4,(e=new URL("/api/product-categories",a)).search=r.stringify({populate:{products:{populate:{image:!0,price:!0}}},pagination:{pageSize:4,page:s}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function f(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return console.log("getCustomerProfile"),o(),(e=new URL("/api/users/me",a)).search=r.stringify({populate:{customer_profile:!0}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function d(r){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return console.log("getSingleOrder",r),o(),e=new URL("/api/opos/".concat(r),a),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function h(n,c,u,p){return e(this,void 0,void 0,(function(){var e,l;return t(this,(function(t){switch(t.label){case 0:return o(),(e=new URL("/api/opos",a)).search=r.stringify({sort:"".concat(p,":").concat(u),populate:{opo_items:{populate:{product:{populate:{price:!0}}}},customer:!0,payments:!0},pagination:{pageSize:c,page:n+1}}),l=s,[4,i(e.href)];case 1:return[2,l.apply(void 0,[t.sent()])]}}))}))}function g(n,c,u,p){return e(this,void 0,void 0,(function(){var e,l;return t(this,(function(t){switch(t.label){case 0:return o(),(e=new URL("/api/invoices",a)).search=r.stringify({sort:"".concat(p,":").concat(u),populate:{items:!0,seller_business_credentials:!0,seller_company_address:!0,buyer_company_address:!0,buyer_business_credentials:!0},pagination:{pageSize:c,page:n+1}}),l=s,[4,i(e.href)];case 1:return[2,l.apply(void 0,[t.sent()])]}}))}))}export{l as getAllCategories,g as getAllInvoices,h as getAllOrders,u as getAllProducts,f as getCustomerProfile,p as getSingleCategory,d as getSingleOrder,c as getSingleProduct};
7
+ import{__awaiter as e,__generator as t}from"../../../node_modules/tslib/tslib.es6.js";import r from"../../../node_modules/qs/lib/index.js";import{fetchData as i}from"../loaders.js";import{getStrapiURL as n,flattenAttributes as s}from"../../lib/utils.js";import{unstable_noStore as o}from"next/cache";var a=n();function c(n){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return o(),(e=new URL("/api/slugify/slugs/product/".concat(n),a)).search=r.stringify({populate:{price:!0,image:!0,galery:!0,dimensions:!0,categories:!0,brand:!0}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function u(n,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return 4,(e=new URL("/api/products",a)).search=r.stringify({populate:{price:!0,image:!0,galery:!0,dimensions:!0,categories:!0,brand:!0},pagination:{pageSize:4,page:s}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function p(n){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(e=new URL("/api/slugify/slugs/product-category/".concat(n),a)).search=r.stringify({populate:{products:{populate:{image:!0,price:!0}}}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function l(n,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return 4,(e=new URL("/api/product-categories",a)).search=r.stringify({populate:{products:{populate:{image:!0,price:!0}}},pagination:{pageSize:4,page:s}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function f(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return console.log("getCustomerProfile"),o(),(e=new URL("/api/users/me",a)).search=r.stringify({populate:{customer_profile:!0}}),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function d(r){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return console.log("getSingleOrder",r),o(),e=new URL("/api/opos/".concat(r),a),[4,i(e.href)];case 1:return[2,t.sent()]}}))}))}function h(n,c,u,p){return e(this,void 0,void 0,(function(){var e,l;return t(this,(function(t){switch(t.label){case 0:return o(),(e=new URL("/api/opos",a)).search=r.stringify({sort:"".concat(p||"id",":").concat(u||"desc"),populate:{opo_items:{populate:{product:{populate:{price:!0}}}},customer:!0,payments:!0},pagination:{pageSize:c||10,page:n?n+1:1}}),l=s,[4,i(e.href)];case 1:return[2,l.apply(void 0,[t.sent()])]}}))}))}function g(n,c,u,p){return e(this,void 0,void 0,(function(){var e,l;return t(this,(function(t){switch(t.label){case 0:return o(),(e=new URL("/api/invoices",a)).search=r.stringify({sort:"".concat(p||"id",":").concat(u||"desc"),populate:{items:!0,seller_business_credentials:!0,seller_company_address:!0,buyer_company_address:!0,buyer_business_credentials:!0},pagination:{pageSize:c||10,page:n?n+1:1}}),l=s,[4,i(e.href)];case 1:return[2,l.apply(void 0,[t.sent()])]}}))}))}export{l as getAllCategories,g as getAllInvoices,h as getAllOrders,u as getAllProducts,f as getCustomerProfile,p as getSingleCategory,d as getSingleOrder,c as getSingleProduct};
package/dist/src/index.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- export{default as Address}from"./components/common/Address.js";export{default as Pagination}from"./components/common/Pagination.js";export{StyledLink}from"./components/StyledLink.js";export{default as ScrollLink}from"./components/ScrollLink.js";export{default as WhatsAppClickToChatButton}from"./components/WhatsAppClickToChatButton.js";export{default as Footer}from"./components/layout/Footer.js";export{default as Navbar}from"./components/layout/Navbar.js";export{default as NavbarV2}from"./components/layout/NavbarV2.js";export{default as SideNav}from"./components/layout/SideNav.js";export{default as WebsitePlaceholder}from"./components/WebsitePlaceholder.js";export{default as FluidBackground}from"./components/FluidBackground.js";export{default as AuthWidget}from"./components/auth/AuthWidget.js";export{default as RegisterForm}from"./components/auth/RegisterForm.js";export{default as SigninForm}from"./components/auth/SigninForm.js";export{default as DenseRegisterForm}from"./components/auth/DenseRegisterForm.js";export{default as DenseSigninForm}from"./components/auth/DenseSigninForm.js";export{default as LogoutButton}from"./components/LogoutButton.js";export{loginUserAction,logoutAction,registerUserAction}from"./data/actions/auth-actions.js";export{Page}from"./components/page-elements/Page.js";export{ContactForm}from"./components/ContactForm.js";export{getAllPages,getDisclaimerData,getHomePageData,getNavigation,getPageNames,getPagedata,getSiteData}from"./data/loaders.js";export{default as PageBuilder}from"./components/page-builder/PageBuilder.js";export{updatePageAction}from"./data/actions/pagebuilder-actions.js";export{default as EnhancedTable}from"./components/e-commerce/EnhancedTable/EnhancedTable.js";export{default as EnhancedTableRow}from"./components/e-commerce/EnhancedTable/EnhancedTableRow.js";export{default as EnhancedTableHead}from"./components/e-commerce/EnhancedTable/EnhancedTableHead.js";export{default as EnhancedTableToolbar}from"./components/e-commerce/EnhancedTable/EnhancedTableToolbar.js";export{default as ProductCard}from"./components/e-commerce/products/ProductCard.js";export{default as Price}from"./components/e-commerce/products/Price.js";export{default as ProductCategoryCard}from"./components/e-commerce/products/ProductCategoryCard.js";export{default as SingleProduct}from"./components/e-commerce/products/SingleProduct.js";export{default as CheckoutForm}from"./components/e-commerce/checkout/CheckoutForm.js";export{default as Step1}from"./components/e-commerce/checkout/Step1.js";export{default as Step2}from"./components/e-commerce/checkout/Step2.js";export{default as Step3}from"./components/e-commerce/checkout/Step3.js";export{default as Step4}from"./components/e-commerce/checkout/Step4.js";export{default as Step5}from"./components/e-commerce/checkout/Step5.js";export{default as BusinessCredentials}from"./components/e-commerce/customer/BusinessCredentials.js";export{default as CustomerProfileEditForm}from"./components/e-commerce/customer/CustomerProfileEditForm.js";export{default as DenseCustomerProfileDisplay}from"./components/e-commerce/customer/DenseCustomerProfileDisplay.js";export{default as CustomerProfileDisplay}from"./components/e-commerce/customer/CustomerProfileDisplay.js";export{SessionProvider,useSession}from"./context/auth/SessionContext.js";export{default as CartDisplay}from"./components/e-commerce/cart/CartDisplay.js";export{default as CartSummaryRow}from"./components/e-commerce/cart/CartSummaryRow.js";export{default as CartSummary}from"./components/e-commerce/cart/CartSummary.js";export{default as CartWidget}from"./components/e-commerce/cart/CartWidget.js";export{default as AddToCartButton}from"./components/e-commerce/cart/AddToCartButton.client.js";export{CartProvider,useCart}from"./context/e-commerce/cart/CartContext.js";export{default as OpoDisplay}from"./components/e-commerce/opo/OpoDisplay.js";export{OpoSummary}from"./components/e-commerce/opo/OpoSummary.js";export{OpoSummaryRow}from"./components/e-commerce/opo/OpoSummaryRow.js";export{PaymentStatusIndicator}from"./components/e-commerce/opo/PaymentStatusIndicator.js";export{InvoiceDownloadLink,default as InvoicePDF,InvoicePDFViewer}from"./components/e-commerce/invoice/InvoicePDF.js";export{getAllCategories,getAllInvoices,getAllOrders,getAllProducts,getCustomerProfile,getSingleCategory,getSingleOrder,getSingleProduct}from"./data/loaders/e-commerce-loaders.js";export{flattenAttributes,formDataToBlocks,getStrapiMedia,getStrapiURL}from"./lib/utils.js";export{areBusinessCredentailsComplete}from"./lib/areBusinessCredentialsComplete.js";export{isCustomerProfileComplete}from"./lib/isCustomerProfileComplete.js";export{parseFormData}from"./lib/parseFormData.js";export{parseStrapiNavigation as parseNavigation}from"./lib/parseNavigation.js";export{ExplanatoryFoldOut}from"./components/ExplanatoryFoldOut.js";export{getExtendedUserMeLoader}from"./data/services/get-user-me-loader.js";export{BlockRendererClient}from"./components/BlockRendererClient.js";
6
+ export{default as Address}from"./components/common/Address.js";export{default as Pagination}from"./components/common/Pagination.js";export{StyledLink}from"./components/StyledLink.js";export{default as ScrollLink}from"./components/ScrollLink.js";export{default as WhatsAppClickToChatButton}from"./components/WhatsAppClickToChatButton.js";export{default as Footer}from"./components/layout/Footer.js";export{default as Navbar}from"./components/layout/Navbar.js";export{default as NavbarV2}from"./components/layout/NavbarV2.js";export{default as SideNav}from"./components/layout/SideNav.js";export{default as WebsitePlaceholder}from"./components/WebsitePlaceholder.js";export{default as FluidBackground}from"./components/FluidBackground.js";export{default as AuthWidget}from"./components/auth/AuthWidget.js";export{default as RegisterForm}from"./components/auth/RegisterForm.js";export{default as SigninForm}from"./components/auth/SigninForm.js";export{default as DenseRegisterForm}from"./components/auth/DenseRegisterForm.js";export{default as DenseSigninForm}from"./components/auth/DenseSigninForm.js";export{default as LogoutButton}from"./components/LogoutButton.js";export{loginUserAction,logoutAction,registerUserAction}from"./data/actions/auth-actions.js";export{Page}from"./components/page-elements/Page.js";export{ContactForm}from"./components/ContactForm.js";export{getAllPages,getDisclaimerData,getHomePageData,getNavigation,getPageNames,getPagedata,getSiteData}from"./data/loaders.js";export{default as PageBuilder}from"./components/page-builder/PageBuilder.js";export{updatePageAction}from"./data/actions/pagebuilder-actions.js";export{default as EnhancedTable}from"./components/e-commerce/EnhancedTable/EnhancedTable.js";export{default as EnhancedTableRow}from"./components/e-commerce/EnhancedTable/EnhancedTableRow.js";export{default as EnhancedTableHead}from"./components/e-commerce/EnhancedTable/EnhancedTableHead.js";export{default as EnhancedTableToolbar}from"./components/e-commerce/EnhancedTable/EnhancedTableToolbar.js";export{default as ProductCard}from"./components/e-commerce/products/ProductCard.js";export{default as Price}from"./components/e-commerce/products/Price.js";export{default as ProductCategoryCard}from"./components/e-commerce/products/ProductCategoryCard.js";export{default as SingleProduct}from"./components/e-commerce/products/SingleProduct.js";export{default as CheckoutForm}from"./components/e-commerce/checkout/CheckoutForm.js";export{default as Step1}from"./components/e-commerce/checkout/Step1.js";export{default as Step2}from"./components/e-commerce/checkout/Step2.js";export{default as Step3}from"./components/e-commerce/checkout/Step3.js";export{default as Step4}from"./components/e-commerce/checkout/Step4.js";export{default as Step5}from"./components/e-commerce/checkout/Step5.js";export{default as BusinessCredentials}from"./components/e-commerce/customer/BusinessCredentials.js";export{default as CustomerProfileEditForm}from"./components/e-commerce/customer/CustomerProfileEditForm.js";export{default as DenseCustomerProfileDisplay}from"./components/e-commerce/customer/DenseCustomerProfileDisplay.js";export{default as CustomerProfileDisplay}from"./components/e-commerce/customer/CustomerProfileDisplay.js";export{SessionProvider,useSession}from"./context/auth/SessionContext.js";export{default as CartDisplay}from"./components/e-commerce/cart/CartDisplay.js";export{default as CartSummaryRow}from"./components/e-commerce/cart/CartSummaryRow.js";export{default as CartSummary}from"./components/e-commerce/cart/CartSummary.js";export{default as CartWidget}from"./components/e-commerce/cart/CartWidget.js";export{default as AddToCartButton}from"./components/e-commerce/cart/AddToCartButton.client.js";export{CartProvider,useCart}from"./context/e-commerce/cart/CartContext.js";export{default as OpoDisplay}from"./components/e-commerce/opo/OpoDisplay.js";export{OpoSummary}from"./components/e-commerce/opo/OpoSummary.js";export{OpoSummaryRow}from"./components/e-commerce/opo/OpoSummaryRow.js";export{PaymentStatusIndicator}from"./components/e-commerce/opo/PaymentStatusIndicator.js";export{InvoiceDownloadLink,InvoicePDFViewer}from"./components/e-commerce/invoice/InvoicePDF.js";export{getAllCategories,getAllInvoices,getAllOrders,getAllProducts,getCustomerProfile,getSingleCategory,getSingleOrder,getSingleProduct}from"./data/loaders/e-commerce-loaders.js";export{flattenAttributes,formDataToBlocks,getStrapiMedia,getStrapiURL}from"./lib/utils.js";export{areBusinessCredentailsComplete}from"./lib/areBusinessCredentialsComplete.js";export{isCustomerProfileComplete}from"./lib/isCustomerProfileComplete.js";export{parseFormData}from"./lib/parseFormData.js";export{parseStrapiNavigation as parseNavigation}from"./lib/parseNavigation.js";export{ExplanatoryFoldOut}from"./components/ExplanatoryFoldOut.js";export{getExtendedUserMeLoader}from"./data/services/get-user-me-loader.js";export{BlockRendererClient}from"./components/BlockRendererClient.js";
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__values as t}from"../../node_modules/tslib/tslib.es6.js";function r(r){var e,l,n,a,u=[];try{for(var i=t(Object.values(r.pages)),s=i.next();!s.done;s=i.next()){var o=s.value;if(null==o.parent){var f={id:o.id.toString(),title:o.title,path:"/".concat(o.slug),slug:o.slug,subItems:[]};u.push(f)}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(l=i.return)&&l.call(i)}finally{if(e)throw e.error}}var c=function(t){if(null!==t.parent){var r=u.find((function(r){return Number(r.id)===t.parent}));if(r){r.subItems||(r.subItems=[]);var e={id:t.id.toString(),title:t.title,path:"/".concat(t.slug),slug:t.slug,subItems:[]};r.subItems.push(e)}}};try{for(var d=t(Object.values(r.pages)),v=d.next();!v.done;v=d.next()){c(v.value)}}catch(t){n={error:t}}finally{try{v&&!v.done&&(a=d.return)&&a.call(d)}finally{if(n)throw n.error}}return u}export{r as parseStrapiNavigation};
6
+ import{__values as t}from"../../node_modules/tslib/tslib.es6.js";function r(r){var e,a,l,n,s=[],u=0;try{for(var i=t(Object.values(r.pages)),o=i.next();!o.done;o=i.next()){var f=o.value;if(null==f.parent){var c={id:f.slug,tab:u,title:f.title,path:"".concat(f.path),slug:f.slug,subItems:[]};s.push(c),u++}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(e)throw e.error}}var p=function(t){if(null!==t.parent){var r=s.find((function(r){return r.id===t.parent}));if(r){r.subItems||(r.subItems=[]);var e={id:t.id.toString(),tab:u,title:t.title,path:"".concat(t.path),slug:t.slug,subItems:[]};r.subItems.push(e),u++}}};try{for(var v=t(Object.values(r.pages)),b=v.next();!b.done;b=v.next()){p(b.value)}}catch(t){l={error:t}}finally{try{b&&!b.done&&(n=v.return)&&n.call(v)}finally{if(l)throw l.error}}return s}export{r as parseStrapiNavigation};