@instincthub/react-ui 0.1.59 → 0.1.61

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.
@@ -1825,9 +1825,14 @@
1825
1825
  margin-top: 5px;
1826
1826
  }
1827
1827
 
1828
- /* Improve animation for floating label */
1828
+ /* Improve animation for floating label.
1829
+ `.ihub-has-placeholder` must be listed here as well as in the label rule
1830
+ above. That rule gives a placeholder'd input the floated *styling* (small,
1831
+ cyan, background punch-through); without the transform below the label is
1832
+ never actually lifted, so it renders on top of the placeholder text. */
1829
1833
  .ihub-wrapper .ihub-input:focus + .ihub-text-label,
1830
1834
  .ihub-wrapper.ihub-value .ihub-text-label,
1835
+ .ihub-wrapper.ihub-has-placeholder .ihub-text-label,
1831
1836
  .ihub-wrapper .ihub-input:focus + .ihub-chips-label,
1832
1837
  .ihub-wrapper .ihub-chips-label {
1833
1838
  transform: translateY(-22px) scale(0.85);
@@ -1,2 +1,2 @@
1
- import{slicedToArray as e,objectSpread2 as n,asyncToGenerator as t,toConsumableArray as r,regenerator as i}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{useState as a,useRef as l,useCallback as u}from"react";import{openToast as c}from"../../lib/modals/modals.js";var d=function(e){return e<1048576?"".concat((e/1024).toFixed(0)," KB"):"".concat((e/1048576).toFixed(1)," MB")},m=function(){return o("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s("polyline",{points:"16 16 12 12 8 16"}),s("line",{x1:"12",y1:"12",x2:"12",y2:"21"}),s("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"})]})},f=function(){return o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s("circle",{cx:"11",cy:"11",r:"8"}),s("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})},p=function(){return o("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"spin",children:[s("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),s("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),s("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),s("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),s("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),s("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),s("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),s("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]})},h=function(){return s("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s("polyline",{points:"20 6 9 17 4 12"})})},v=function(){return o("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s("circle",{cx:"12",cy:"12",r:"10"}),s("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),s("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})},g=function(e){var n=e.size,t=void 0===n?13:n;return o("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})};function y(e,n,t,r){return new Promise(function(i,o){var s=new XMLHttpRequest;s.upload.onprogress=function(e){e.lengthComputable&&r(Math.round(e.loaded/e.total*100))},s.onload=function(){s.status>=200&&s.status<300?i():o(new Error("Upload failed: HTTP ".concat(s.status)))},s.onerror=function(){return o(new Error("Network error during upload"))},s.ontimeout=function(){return o(new Error("Upload timed out"))},s.open("PUT",e),s.setRequestHeader("Content-Type",t),s.send(n)})}function x(x){var k=x.accepts,w=x.maxFileSizeBytes,N=void 0===w?524288e3:w,b=x.maxFiles,C=x.concurrency,L=void 0===C?1:C,j=x.getPresignedUrl,q=x.label,B=void 0===q?"Drop files here or click to browse":q,T=x.hint,U=x.onFileComplete,z=x.onQueueComplete,M=x.onError,D=x.disabled,F=void 0!==D&&D,A=x.className,W=void 0===A?"":A,E=a([]),P=e(E,2),H=P[0],R=P[1],_=a(!1),O=e(_,2),Q=O[0],S=O[1],G=a(""),I=e(G,2),K=I[0],X=I[1],J=l(null),V=l(0),Y=l([]);Y.current=H;var Z=Math.min(Math.max(L,1),4),$=u(function(e,t){R(function(r){return r.map(function(r){return r.id===e?n(n({},r),t):r})})},[]),ee=u(function(){var e=t(i().m(function e(n){var t,r,o,s,a,l,u,c;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return $(n.id,{status:"uploading",progress:0}),e.p=1,e.n=2,j(n.file);case 2:return t=e.v,r=t.url,o=t.key,s=t.cdnUrl,a=t.contentType,e.n=3,y(r,n.file,a,function(e){$(n.id,{progress:e})});case 3:l={title:n.file.name,key:o,content_type:a,size:n.file.size,location:s},$(n.id,{status:"complete",progress:100}),U(l),e.n=5;break;case 4:e.p=4,c=e.v,u=c instanceof Error?c.message:"Upload failed",$(n.id,{status:"error",error:u}),null==M||M(n.file.name,u);case 5:return e.a(2)}},e,null,[[1,4]])}));return function(n){return e.apply(this,arguments)}}(),[j,$,U,M]),ne=u(t(i().m(function e(){var n;return i().w(function(e){for(;;)switch(e.n){case 0:if(!(V.current>=Z)){e.n=1;break}return e.a(2);case 1:if(n=Y.current.find(function(e){return"queued"===e.status})){e.n=2;break}return 0===V.current&&Y.current.length>0&&Y.current.every(function(e){return"complete"===e.status||"error"===e.status})&&(null==z||z()),e.a(2);case 2:return V.current+=1,e.n=3,ee(n);case 3:V.current-=1,ne();case 4:return e.a(2)}},e)})),[Z,ee,z]),te=u(function(e){var n=e.filter(function(e){return e.size<=N});if(b&&b>0){var t=Y.current.length,i=b-t;if(i<=0)return void c("Maximum ".concat(b," file").concat(1!==b?"s":""," allowed"),400);n.length>i&&(c("Only ".concat(i," more file").concat(1!==i?"s":""," allowed (limit: ").concat(b,"). First ").concat(i," selected."),400),n=n.slice(0,i))}if(n.length){var o=n.map(function(e){return{id:crypto.randomUUID(),file:e,status:"queued",progress:0}});R(function(e){var n=[].concat(r(e),r(o));Y.current=n;for(var t=0;t<Z;t++)setTimeout(ne,0);return n})}},[N,b,Z,ne]),re=H.filter(function(e){return"complete"===e.status}).length,ie=H.some(function(e){return"uploading"===e.status||"queued"===e.status}),oe=K?H.filter(function(e){return e.file.name.toLowerCase().includes(K.toLowerCase())}):H;return o("div",{className:"s3mu-root".concat(F?" s3mu-disabled":""," ").concat(W).trim(),children:[o("div",{className:"s3mu-dropzone".concat(Q?" dragging":""),onDragOver:function(e){e.preventDefault(),F||S(!0)},onDragLeave:function(){return S(!1)},onDrop:function(e){e.preventDefault(),S(!1),F||te(Array.from(e.dataTransfer.files))},onClick:function(){var e;return!F&&(null===(e=J.current)||void 0===e?void 0:e.click())},children:[s("input",{ref:J,type:"file",accept:k,multiple:!0,disabled:F,style:{display:"none"},onChange:function(e){e.target.files&&te(Array.from(e.target.files)),e.target.value=""}}),s("div",{className:"s3mu-drop-icon",children:s(m,{})}),s("p",{className:"s3mu-drop-label",children:B}),T&&s("p",{className:"s3mu-drop-hint",children:T}),o("p",{className:"s3mu-drop-hint",children:["Max ",d(N)," per file"]}),b&&b>0&&o("span",{className:"s3mu-maxfiles-badge",children:["Up to ",b," file",1!==b?"s":""]})]}),H.length>0&&o("div",{className:"s3mu-queue",children:[o("div",{className:"s3mu-queue-header",children:[s("span",{children:K&&oe.length!==H.length?"".concat(oe.length," of ").concat(H.length," file").concat(1!==H.length?"s":""):"".concat(H.length," file").concat(1!==H.length?"s":"")}),re>0&&!ie&&s("button",{type:"button",className:"s3mu-clear-btn",onClick:function(){R(function(e){return e.filter(function(e){return"complete"!==e.status})})},children:"Clear completed"})]}),H.length>=5&&o("div",{className:"s3mu-filter",children:[s(f,{}),s("input",{type:"text",placeholder:"Filter files…",value:K,onChange:function(e){return X(e.target.value)}})]}),oe.map(function(e){return o("div",{className:"s3mu-item s3mu-item--".concat(e.status),children:[o("div",{className:"s3mu-item-icon",children:["complete"===e.status&&s(h,{}),"error"===e.status&&s(v,{}),"uploading"===e.status&&s(p,{}),"queued"===e.status&&s("div",{className:"s3mu-queued-dot"})]}),o("div",{className:"s3mu-item-body",children:[o("div",{className:"s3mu-item-name-row",children:[s("span",{className:"s3mu-item-name",title:e.file.name,children:e.file.name}),s("span",{className:"s3mu-item-size",children:d(e.file.size)})]}),("uploading"===e.status||"complete"===e.status)&&s("div",{className:"s3mu-bar-wrap",children:s("div",{className:"s3mu-bar-fill",style:{width:"".concat(e.progress,"%")}})}),"uploading"===e.status&&o("span",{className:"s3mu-item-pct",children:[e.progress,"%"]}),"error"===e.status&&s("span",{className:"s3mu-item-err",children:e.error}),"queued"===e.status&&s("span",{className:"s3mu-item-pct",style:{opacity:.5},children:"Queued"})]}),"uploading"!==e.status&&s("button",{type:"button",className:"s3mu-item-remove",onClick:function(){return n=e.id,void R(function(e){return e.filter(function(e){return e.id!==n})});var n},title:"Remove",children:s(g,{})})]},e.id)})]})]})}export{x as default};
1
+ import{slicedToArray as e,asyncToGenerator as n,toConsumableArray as t,objectSpread2 as r,regenerator as i}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{useState as a,useRef as u,useCallback as l}from"react";import{openToast as c}from"../../lib/modals/modals.js";var d=function(e){return e<1048576?"".concat((e/1024).toFixed(0)," KB"):"".concat((e/1048576).toFixed(1)," MB")},m=function(){return o("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s("polyline",{points:"16 16 12 12 8 16"}),s("line",{x1:"12",y1:"12",x2:"12",y2:"21"}),s("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"})]})},f=function(){return o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s("circle",{cx:"11",cy:"11",r:"8"}),s("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})},p=function(){return o("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"spin",children:[s("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),s("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),s("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),s("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),s("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),s("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),s("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),s("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]})},h=function(){return s("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s("polyline",{points:"20 6 9 17 4 12"})})},v=function(){return o("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s("circle",{cx:"12",cy:"12",r:"10"}),s("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),s("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})},g=function(e){var n=e.size,t=void 0===n?13:n;return o("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})};function y(n,t,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return new Promise(function(s,a){var u=new XMLHttpRequest;u.upload.onprogress=function(e){e.lengthComputable&&i(Math.round(e.loaded/e.total*100))},u.onload=function(){u.status>=200&&u.status<300?s():a(new Error("Upload failed: HTTP ".concat(u.status)))},u.onerror=function(){return a(new Error("Network error during upload"))},u.ontimeout=function(){return a(new Error("Upload timed out"))},u.open("PUT",n),u.setRequestHeader("Content-Type",r),Object.entries(o).filter(function(n){return"content-type"!==e(n,1)[0].toLowerCase()}).forEach(function(n){var t=e(n,2),r=t[0],i=t[1];return u.setRequestHeader(r,i)}),u.send(t)})}function x(x){var k=x.accepts,w=x.maxFileSizeBytes,N=void 0===w?524288e3:w,b=x.maxFiles,C=x.concurrency,L=void 0===C?1:C,j=x.getPresignedUrl,q=x.label,B=void 0===q?"Drop files here or click to browse":q,T=x.hint,U=x.onFileComplete,z=x.onQueueComplete,M=x.onError,D=x.disabled,F=void 0!==D&&D,A=x.className,E=void 0===A?"":A,W=a([]),H=e(W,2),P=H[0],R=H[1],O=a(!1),_=e(O,2),Q=_[0],S=_[1],G=a(""),I=e(G,2),K=I[0],X=I[1],J=u(null),V=u(0),Y=u([]);Y.current=P;var Z=Math.min(Math.max(L,1),4),$=l(function(e,n){var t=function(t){return t.map(function(t){return t.id===e?r(r({},t),n):t})};Y.current=t(Y.current),R(t)},[]),ee=l(function(){var e=n(i().m(function e(n){var t,r,o,s,a,u,l,c,d;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:return $(n.id,{status:"uploading",progress:0}),e.p=1,e.n=2,j(n.file);case 2:return t=e.v,r=t.url,o=t.key,s=t.cdnUrl,a=t.contentType,u=t.headers,e.n=3,y(r,n.file,a,function(e){$(n.id,{progress:e})},u);case 3:l={title:n.file.name,key:o,content_type:a,size:n.file.size,location:s},$(n.id,{status:"complete",progress:100}),U(l),e.n=5;break;case 4:e.p=4,d=e.v,c=d instanceof Error?d.message:"Upload failed",$(n.id,{status:"error",error:c}),null==M||M(n.file.name,c);case 5:return e.a(2)}},e,null,[[1,4]])}));return function(n){return e.apply(this,arguments)}}(),[j,$,U,M]),ne=l(n(i().m(function e(){var n;return i().w(function(e){for(;;)switch(e.n){case 0:if(!(V.current>=Z)){e.n=1;break}return e.a(2);case 1:if(n=Y.current.find(function(e){return"queued"===e.status})){e.n=2;break}return 0===V.current&&Y.current.length>0&&Y.current.every(function(e){return"complete"===e.status||"error"===e.status})&&(null==z||z()),e.a(2);case 2:return V.current+=1,e.n=3,ee(n);case 3:V.current-=1,ne();case 4:return e.a(2)}},e)})),[Z,ee,z]),te=l(function(e){var n=e.filter(function(e){return e.size<=N});if(b&&b>0){var r=Y.current.length,i=b-r;if(i<=0)return void c("Maximum ".concat(b," file").concat(1!==b?"s":""," allowed"),400);n.length>i&&(c("Only ".concat(i," more file").concat(1!==i?"s":""," allowed (limit: ").concat(b,"). First ").concat(i," selected."),400),n=n.slice(0,i))}if(n.length){var o=n.map(function(e){return{id:crypto.randomUUID(),file:e,status:"queued",progress:0}});R(function(e){var n=[].concat(t(e),t(o));Y.current=n;for(var r=0;r<Z;r++)setTimeout(ne,0);return n})}},[N,b,Z,ne]),re=P.filter(function(e){return"complete"===e.status}).length,ie=P.some(function(e){return"uploading"===e.status||"queued"===e.status}),oe=K?P.filter(function(e){return e.file.name.toLowerCase().includes(K.toLowerCase())}):P;return o("div",{className:"s3mu-root".concat(F?" s3mu-disabled":""," ").concat(E).trim(),children:[o("div",{className:"s3mu-dropzone".concat(Q?" dragging":""),onDragOver:function(e){e.preventDefault(),F||S(!0)},onDragLeave:function(){return S(!1)},onDrop:function(e){e.preventDefault(),S(!1),F||te(Array.from(e.dataTransfer.files))},onClick:function(){var e;return!F&&(null===(e=J.current)||void 0===e?void 0:e.click())},children:[s("input",{ref:J,type:"file",accept:k,multiple:!0,disabled:F,style:{display:"none"},onChange:function(e){e.target.files&&te(Array.from(e.target.files)),e.target.value=""}}),s("div",{className:"s3mu-drop-icon",children:s(m,{})}),s("p",{className:"s3mu-drop-label",children:B}),T&&s("p",{className:"s3mu-drop-hint",children:T}),o("p",{className:"s3mu-drop-hint",children:["Max ",d(N)," per file"]}),b&&b>0&&o("span",{className:"s3mu-maxfiles-badge",children:["Up to ",b," file",1!==b?"s":""]})]}),P.length>0&&o("div",{className:"s3mu-queue",children:[o("div",{className:"s3mu-queue-header",children:[s("span",{children:K&&oe.length!==P.length?"".concat(oe.length," of ").concat(P.length," file").concat(1!==P.length?"s":""):"".concat(P.length," file").concat(1!==P.length?"s":"")}),re>0&&!ie&&s("button",{type:"button",className:"s3mu-clear-btn",onClick:function(){R(function(e){return e.filter(function(e){return"complete"!==e.status})})},children:"Clear completed"})]}),P.length>=5&&o("div",{className:"s3mu-filter",children:[s(f,{}),s("input",{type:"text",placeholder:"Filter files…",value:K,onChange:function(e){return X(e.target.value)}})]}),oe.map(function(e){return o("div",{className:"s3mu-item s3mu-item--".concat(e.status),children:[o("div",{className:"s3mu-item-icon",children:["complete"===e.status&&s(h,{}),"error"===e.status&&s(v,{}),"uploading"===e.status&&s(p,{}),"queued"===e.status&&s("div",{className:"s3mu-queued-dot"})]}),o("div",{className:"s3mu-item-body",children:[o("div",{className:"s3mu-item-name-row",children:[s("span",{className:"s3mu-item-name",title:e.file.name,children:e.file.name}),s("span",{className:"s3mu-item-size",children:d(e.file.size)})]}),("uploading"===e.status||"complete"===e.status)&&s("div",{className:"s3mu-bar-wrap",children:s("div",{className:"s3mu-bar-fill",style:{width:"".concat(e.progress,"%")}})}),"uploading"===e.status&&o("span",{className:"s3mu-item-pct",children:[e.progress,"%"]}),"error"===e.status&&s("span",{className:"s3mu-item-err",children:e.error}),"queued"===e.status&&s("span",{className:"s3mu-item-pct",style:{opacity:.5},children:"Queued"})]}),"uploading"!==e.status&&s("button",{type:"button",className:"s3mu-item-remove",onClick:function(){return n=e.id,void R(function(e){return e.filter(function(e){return e.id!==n})});var n},title:"Remove",children:s(g,{})})]},e.id)})]})]})}export{x as default};
2
2
  //# sourceMappingURL=S3MultiUploader.js.map
@@ -1,2 +1,2 @@
1
- import{slicedToArray as n,asyncToGenerator as e,regenerator as i}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as a,Fragment as r}from"react/jsx-runtime";import{useState as s,useEffect as o}from"react";import{getData as l}from"../../lib/auth/dbRequestst.js";import t from"./SignOutSession.js";function u(u){var d,c=u.children,v=u.session,p=u.expiredMessage,f=void 0===p?"Your logged in session has expired!":p,m=u.disableValidation,h=void 0!==m&&m,g=u.onSessionInvalid,k=s("loading"),b=n(k,2),x=b[0],w=b[1],_=(null==v||null===(d=v.user)||void 0===d?void 0:d.name)||(null==v?void 0:v.user)||{},j=(null==_?void 0:_.token)||(null==_?void 0:_.accessToken);return o(function(){var n=!0;function a(){return(a=e(i().m(function e(){var a,r,s;return i().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!h){e.n=1;break}return n&&w("valid"),e.a(2);case 1:if(v){e.n=2;break}return n&&w("invalid"),e.a(2);case 2:if(e.p=2,!(new Date(null==v?void 0:v.expires)<new Date)&&j){e.n=3;break}return console.warn("Session expired or token is missing"),n&&(w("invalid"),g&&g()),e.a(2);case 3:return a={path:"auth/skills/validate-user-token/?access_token=".concat(j,"&user_uuid=").concat(null==_?void 0:_.uuid),token:j,auth_sk:!0},e.n=4,l(a);case 4:r=e.v,n&&"Unauthorized"!==(null==r?void 0:r.detail)&&"Not found."!==(null==r?void 0:r.detail)&&null!=r&&r.detail?n&&w("valid"):n&&(w("invalid"),g&&g()),e.n=6;break;case 5:e.p=5,s=e.v,console.error("Error during session validation:",s),n&&w("valid");case 6:return e.a(2)}},e,null,[[2,5]])}))).apply(this,arguments)}return function(){a.apply(this,arguments)}(),function(){n=!1}},[v,h,g]),"loading"===x?a("div",{className:"ihub-session-loading",children:a("div",{className:"ihub-session-loading-spinner"})}):"invalid"===x&&null!=v&&v.user?a(t,{message:f}):a(r,{children:c})}export{u as default};
1
+ import{slicedToArray as n,asyncToGenerator as i,regenerator as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as a,Fragment as r}from"react/jsx-runtime";import{useState as s,useEffect as o}from"react";import{getData as l}from"../../lib/auth/dbRequestst.js";import t from"./SignOutSession.js";function u(u){var d,c=u.children,v=u.session,p=u.expiredMessage,f=void 0===p?"Your logged in session has expired!":p,m=u.disableValidation,h=void 0!==m&&m,g=u.onSessionInvalid,k=s(function(){return h?"valid":v?"loading":"invalid"}),b=n(k,2),x=b[0],w=b[1],_=(null==v||null===(d=v.user)||void 0===d?void 0:d.name)||(null==v?void 0:v.user)||{},j=(null==_?void 0:_.token)||(null==_?void 0:_.accessToken);return o(function(){var n=!0;function a(){return(a=i(e().m(function i(){var a,r,s;return e().w(function(i){for(;;)switch(i.p=i.n){case 0:if(!h){i.n=1;break}return n&&w("valid"),i.a(2);case 1:if(v){i.n=2;break}return n&&w("invalid"),i.a(2);case 2:if(i.p=2,!(new Date(null==v?void 0:v.expires)<new Date)&&j){i.n=3;break}return console.warn("Session expired or token is missing"),n&&(w("invalid"),g&&g()),i.a(2);case 3:return a={path:"auth/skills/validate-user-token/?access_token=".concat(j,"&user_uuid=").concat(null==_?void 0:_.uuid),token:j,auth_sk:!0},i.n=4,l(a);case 4:r=i.v,n&&"Unauthorized"!==(null==r?void 0:r.detail)&&"Not found."!==(null==r?void 0:r.detail)&&null!=r&&r.detail?n&&w("valid"):n&&(w("invalid"),g&&g()),i.n=6;break;case 5:i.p=5,s=i.v,console.error("Error during session validation:",s),n&&w("valid");case 6:return i.a(2)}},i,null,[[2,5]])}))).apply(this,arguments)}return function(){a.apply(this,arguments)}(),function(){n=!1}},[v,h,g]),"loading"===x?a("div",{className:"ihub-session-loading",children:a("div",{className:"ihub-session-loading-spinner"})}):"invalid"===x&&null!=v&&v.user?a(t,{message:f}):a(r,{children:c})}export{u as default};
2
2
  //# sourceMappingURL=SessionExpiresLogout.js.map
@@ -128,6 +128,11 @@ export interface PresignedUploadResult {
128
128
  * browser File.type value here.
129
129
  */
130
130
  contentType: string;
131
+ /**
132
+ * Extra headers the presigned signature covers (e.g. `x-amz-acl`).
133
+ * Sent verbatim on the PUT; omit when the URL signs only Content-Type.
134
+ */
135
+ headers?: Record<string, string>;
131
136
  }
132
137
  /**
133
138
  * Response interface for S3 uploads