@lokalise/harmony 1.6.0-exp-jwtutils.14 → 1.6.0-exp-jwtutils.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/harmony.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var wt=Object.defineProperty;var It=(e,t,n)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xe=(e,t,n)=>It(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),g=require("react"),m=require("@lokalise/louis"),o=require("zod"),U=require("@lokalise/frontend-http-client"),xt=require("@lokalise/universal-ts-utils/api-contracts/apiContracts"),me=require("@tanstack/react-query"),Ve=require("@lokalise/universal-ts-utils/node"),Ye=require("date-fns"),St=require("date-fns-tz");function Pt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const O=Pt(g);var F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var V,Se;function he(){if(Se)return V;Se=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return V=e,V}var Y,Pe;function Nt(){if(Pe)return Y;Pe=1;var e=typeof F=="object"&&F&&F.Object===Object&&F;return Y=e,Y}var Z,Ne;function Xe(){if(Ne)return Z;Ne=1;var e=Nt(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Z=n,Z}var X,ke;function kt(){if(ke)return X;ke=1;var e=Xe(),t=function(){return e.Date.now()};return X=t,X}var ee,Ee;function Et(){if(Ee)return ee;Ee=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return ee=t,ee}var te,Ce;function Ct(){if(Ce)return te;Ce=1;var e=Et(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return te=n,te}var ne,Re;function et(){if(Re)return ne;Re=1;var e=Xe(),t=e.Symbol;return ne=t,ne}var re,Ae;function Rt(){if(Ae)return re;Ae=1;var e=et(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function i(c){var u=n.call(c,s),d=c[s];try{c[s]=void 0;var l=!0}catch{}var f=r.call(c);return l&&(u?c[s]=d:delete c[s]),f}return re=i,re}var se,ze;function At(){if(ze)return se;ze=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return se=n,se}var ae,Le;function zt(){if(Le)return ae;Le=1;var e=et(),t=Rt(),n=At(),r="[object Null]",s="[object Undefined]",i=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?s:r:i&&i in Object(u)?t(u):n(u)}return ae=c,ae}var ie,Oe;function Lt(){if(Oe)return ie;Oe=1;function e(t){return t!=null&&typeof t=="object"}return ie=e,ie}var oe,qe;function Ot(){if(qe)return oe;qe=1;var e=zt(),t=Lt(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return oe=r,oe}var ce,Ue;function qt(){if(Ue)return ce;Ue=1;var e=Ct(),t=he(),n=Ot(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function d(l){if(typeof l=="number")return l;if(n(l))return r;if(t(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=t(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=e(l);var p=i.test(l);return p||c.test(l)?u(l.slice(2),p?2:8):s.test(l)?r:+l}return ce=d,ce}var le,Me;function tt(){if(Me)return le;Me=1;var e=he(),t=kt(),n=qt(),r="Expected a function",s=Math.max,i=Math.min;function c(u,d,l){var f,p,y,j,_,w,x=0,P=!1,b=!1,S=!0;if(typeof u!="function")throw new TypeError(r);d=n(d)||0,e(l)&&(P=!!l.leading,b="maxWait"in l,y=b?s(n(l.maxWait)||0,d):y,S="trailing"in l?!!l.trailing:S);function T(h){var N=f,L=p;return f=p=void 0,x=h,j=u.apply(L,N),j}function v(h){return x=h,_=setTimeout($,d),P?T(h):j}function D(h){var N=h-w,L=h-x,Ie=d-N;return b?i(Ie,y-L):Ie}function je(h){var N=h-w,L=h-x;return w===void 0||N>=d||N<0||b&&L>=y}function $(){var h=t();if(je(h))return we(h);_=setTimeout($,D(h))}function we(h){return _=void 0,S&&f?T(h):(f=p=void 0,j)}function yt(){_!==void 0&&clearTimeout(_),x=0,f=w=p=_=void 0}function jt(){return _===void 0?j:we(t())}function Q(){var h=t(),N=je(h);if(f=arguments,p=this,w=h,N){if(_===void 0)return v(w);if(b)return clearTimeout(_),_=setTimeout($,d),T(w)}return _===void 0&&(_=setTimeout($,d)),j}return Q.cancel=yt,Q.flush=jt,Q}return le=c,le}var Ut=tt();const Mt=Ze(Ut);var ue,Be;function Bt(){if(Be)return ue;Be=1;var e=tt(),t=he(),n="Expected a function";function r(s,i,c){var u=!0,d=!0;if(typeof s!="function")throw new TypeError(n);return t(c)&&(u="leading"in c?!!c.leading:u,d="trailing"in c?!!c.trailing:d),e(s,i,{leading:u,maxWait:i,trailing:d})}return ue=r,ue}var Dt=Bt();const $t=Ze(Dt),Ft=(e,t,n,r)=>{switch(t){case"debounce":return Mt(e,n,r);case"throttle":return $t(e,n,r);default:return e}},Gt=e=>{const t=O.useRef(e);return O.useEffect(()=>{t.current=e}),O.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])},Ht=e=>{const[t,n]=O.useState((e==null?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:O.useMemo(()=>new Proxy(s=>{s!==t&&n(s)},{get(s,i){return i==="current"?t:s[i]},set(s,i,c){return i==="current"?n(c):s[i]=c,!0}}),[t]),refElement:t,setRefElement:n}},Kt=(e,t)=>t==="border-box"?{width:e.borderBoxSize[0].inlineSize,height:e.borderBoxSize[0].blockSize}:t==="content-box"?{width:e.contentBoxSize[0].inlineSize,height:e.contentBoxSize[0].blockSize}:{width:e.contentRect.width,height:e.contentRect.height};function Wt({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:r,handleWidth:s=!0,handleHeight:i=!0,targetRef:c,observerOptions:u,onResize:d}={}){const l=g.useRef(e),f=Gt(d),[p,y]=g.useState({width:void 0,height:void 0}),{refProxy:j,refElement:_}=Ht(c),{box:w}=u||{},x=g.useCallback(b=>{if(!s&&!i)return;if(l.current){l.current=!1;return}const S=(T,v)=>s&&T.width!==v.width||i&&T.height!==v.height;b.forEach(T=>{const v=Kt(T,w);y(D=>S(D,v)?(f==null||f({width:v.width,height:v.height,entry:T}),v):D)})},[s,i,l,w]),P=g.useCallback(Ft(x,t,n,r),[x,t,n,r]);return g.useEffect(()=>{let b;return _?(b=new window.ResizeObserver(P),b.observe(_,u)):(p.width||p.height)&&(f==null||f({width:null,height:null,entry:null}),y({width:void 0,height:void 0})),()=>{var S,T,v;(S=b==null?void 0:b.disconnect)===null||S===void 0||S.call(b),(v=(T=P).cancel)===null||v===void 0||v.call(T)}},[P,_]),Object.assign({ref:j},p)}function nt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=nt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function C(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=nt(e))&&(r&&(r+=" "),r+=t);return r}const Jt="_headerContainer_1cubo_1",Qt="_navigationTabList_1cubo_8",Vt="_navigationTab_1cubo_8",Yt="_headerContent_1cubo_34",Zt="_staticEnabled_1cubo_50",A={headerContainer:Jt,navigationTabList:Qt,navigationTab:Vt,headerContent:Yt,staticEnabled:Zt},Xt=77,q=({sticky:e,children:t})=>{const{ref:n,height:r}=Wt({refreshMode:"debounce",refreshRate:0}),[s,i]=g.useState(!1),c=()=>s?!e:!0;g.useEffect(()=>{const d=()=>{i(window.scrollY>0)};return window.addEventListener("scroll",d),()=>window.removeEventListener("scroll",d)},[]);const u=`${r||Xt}px`;return a.jsx("div",{style:{minHeight:u},children:a.jsx("div",{children:a.jsxs("div",{ref:n,className:C(A.headerContent,{[A.staticEnabled]:c()}),children:[a.jsx(q.Header,{}),a.jsx(q.Tabs,{}),t]})})})};q.Header=({children:e})=>a.jsx("div",{className:A.headerContainer,children:e});q.Tabs=({children:e})=>a.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const en="_sidebarContainer_bmdti_1",tn={sidebarContainer:en},nn="_logoLink_1baxb_1",rn={logoLink:nn},sn=({src:e,href:t="/",ariaLabel:n="Home",alt:r="Lokalise"})=>a.jsx("a",{className:rn.logoLink,href:t,"aria-label":n,children:a.jsx("img",{src:e,alt:r})}),an="_link_1weq1_1",on="_active_1weq1_18",De={link:an,active:on},cn=({label:e,to:t,icon:n})=>a.jsx(m.Tooltip,{placement:"right",tooltip:e,children:a.jsx(m.Link,{className:C(De.link,{[De.active]:window.location.pathname.startsWith(t)}),href:t,children:a.jsx(n,{size:"25px"})})}),ln="_dropdownButton_hwh0c_1",un="_dropdownButtonActive_hwh0c_18",$e={dropdownButton:ln,dropdownButtonActive:un},dn=({children:e,icon:t})=>a.jsx(m.Menu,{menuButton:({opened:n})=>a.jsx(m.Tooltip,{placement:"right",tooltip:"Help",children:a.jsx("button",{type:"button",className:C($e.dropdownButton,{[$e.dropdownButtonActive]:n}),children:a.jsx(t,{size:"25px"})})}),children:a.jsx(m.MenuList,{placement:"right-start",children:e})}),fn="_iconContainer_nz34m_1",mn={iconContainer:fn},rt=({className:e=""})=>a.jsx("div",{"aria-label":"Upgrade Icon",className:C(mn.iconContainer,"flex-row","items-center","justify-center",e),children:a.jsx(m.CaretUpIcon,{})}),hn="_menuContainer_wbu3u_5",gn="_profileButton_wbu3u_16",bn="_profileImage_wbu3u_29",_n="_profileImageHighlight_wbu3u_37",pn="_profileImageUpgradeIcon_wbu3u_41",vn="_userIconWrapper_wbu3u_47",k={menuContainer:hn,profileButton:gn,profileImage:bn,profileImageHighlight:_n,profileImageUpgradeIcon:pn,userIconWrapper:vn},st=g.createContext({}),M=()=>g.useContext(st),Tn=({children:e})=>{const{currentTeam:t,otherTeams:n,showUpgradeCta:r,showBillingButton:s,allowTeamCreation:i,isLimitedView:c,isProviderAlpha:u,canAccessTeamSettings:d,isEndOfTrialActive:l,isTeamSuspended:f}=M();return a.jsx(m.Menu,{menuButton:()=>a.jsxs("button",{className:k.profileButton,"aria-label":"Profile menu",type:"button",children:[t!=null&&t.logoUrl?a.jsx("img",{src:t.logoUrl,className:C(k.profileImage,{[k.profileImageHighlight]:r}),alt:"Team Logo"}):a.jsx("div",{className:C(k.userIconWrapper,"flex-row","align-center","items-center",{[k.profileImageHighlight]:r}),children:a.jsx(m.UserIcon,{size:"25px"})}),r&&a.jsx(rt,{className:k.profileImageUpgradeIcon})]}),children:a.jsx(m.MenuList,{placement:"right-end",className:k.menuContainer,children:e({allowTeamCreation:i,otherTeams:n,isLimitedView:c,canAccessTeamSettings:d,isEndOfTrialActive:l,isTeamSuspended:f,showBillingButton:s,isProviderAlpha:u})})})},ge=0,at=9999,it=[150,151,250,251],ot=[152,153,252,253],ct=[154,155,157,158,254,255,258,354,355,358],lt=[156,159,160,256,259,260],be=9998,W=e=>e===ge,_e=e=>e===at,yn=e=>it.includes(e),jn=e=>ot.includes(e),wn=e=>ct.includes(e),In=e=>lt.includes(e),xn=e=>e>ge&&e<be,Sn=e=>e===be,Pn=/\n/,Fe=(e,t,n)=>e.split(t).flatMap((r,s)=>s!==0?[g.cloneElement(n,{key:Math.random().toString(32).slice(0,10)}),r]:r),Nn=(e,t,n)=>typeof e=="string"?Fe(e,t,n):e.flatMap(r=>typeof r=="string"?Fe(r,t,n):r),kn=e=>Nn(e,Pn,a.jsx("br",{})),En=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,Cn=e=>e.match(En)??[],Ge=(e,t,n)=>{const r=e.split(t);if(r.length===1)return e;const s=[];return r[0]!==""&&s.push(r[0]),r.shift(),r[r.length-1]===""&&r.pop(),s.push(a.jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",children:t},t+n)),s.push(r.join(t)),s.filter(i=>i!=="")},He=e=>{const t=Cn(e);return t!=null&&t.length?t.reduce((n,r,s)=>typeof n=="string"?Ge(n,r,s):n.flatMap(i=>typeof i=="string"?Ge(i,r,s):i),e):e},Rn=e=>typeof e=="string"?He(e):e.flatMap(t=>typeof t=="string"?He(t):t,e),An=(e,t="PP")=>Ye.format(e,t),zn=(e,t,n="PP")=>Ye.format(St.toZonedTime(e,t),n),Ln=e=>{g.useEffect(e,[])},On=({children:e,config:t})=>{const{teams:n,currentTeamId:r,planId:s,isLimitedView:i,isTeamSuspended:c,canAccessTeamSettings:u,isEndOfTrialActive:d}=t,l=n.find(b=>b.id===r),f=n.filter(b=>b.id!==r),p=(l==null?void 0:l.role)??"",y=["biller","owner"].includes(p),j=W(s)||_e(s),P={...t,currentTeam:l,otherTeams:f,canChangeBilling:y,isOnFreeOrTrialPlan:j,showUpgradeCta:!i&&j&&y&&!c,showBillingButton:!i&&u&&y,allowTeamCreation:!i&&!d};return a.jsx(st.Provider,{value:P,children:e})},qn=({config:e,children:t})=>a.jsx(On,{config:e,children:a.jsx(Tn,{children:t})}),Un="_container_q5pot_1",Mn="_profileEmail_q5pot_5",Ke={container:Un,profileEmail:Mn},Bn=({href:e,onClick:t,userEmail:n,hideBottomDivider:r})=>{const{isEndOfTrialActive:s,isTeamSuspended:i}=M();return s||i?null:a.jsxs(a.Fragment,{children:[a.jsx(m.MenuItem,{href:e,onClick:()=>{t==null||t()},children:a.jsxs("div",{className:`flex-col ${Ke.container}`,children:[a.jsx("span",{children:"Profile Settings"}),a.jsx("span",{className:Ke.profileEmail,children:n})]})}),!r&&a.jsx(m.MenuDivider,{})]})},Dn="_wrapper_15d85_1",$n="_profileImage_15d85_14",Fn="_teamName_15d85_22",Gn="_planLabel_15d85_29",Hn="_membership_15d85_38",Kn="_defaultProfileImage_15d85_44",R={wrapper:Dn,profileImage:$n,teamName:Fn,planLabel:Gn,membership:Hn,defaultProfileImage:Kn},ut=({team:e,onClick:t,hidePlanLabel:n})=>{const{currentTeam:r,planId:s}=M(),i=e||r;if(!i)return null;const c=W(s)?"Free":_e(s)?"Trial":void 0,u=t?m.MenuItem:"div";return a.jsxs(u,{className:`flex-row gap-2 flex-nowrap items-center ${R.wrapper}`,...t&&{onClick:()=>t(i)},children:[i.logoUrl?a.jsx("img",{className:R.profileImage,src:i.logoUrl,alt:"Team Logo"}):a.jsx("span",{className:`flex-row justify-center items-center ${R.defaultProfileImage}`,children:a.jsx(m.UserIcon,{size:"25px"})}),a.jsxs("div",{className:"flex-col items-start",children:[a.jsxs("div",{className:"flex-row items-center flex-nowrap gap-2",children:[a.jsx("span",{title:i.name,className:R.teamName,children:i.name}),c&&!n&&a.jsx("span",{className:`flex-row justify-center items-center ${R.planLabel}`,children:c})]}),a.jsx("span",{className:R.membership,children:i.role})]})]})},Wn="_teamsContainer_1t68g_1",Jn={teamsContainer:Wn},Qn=({onSwitchTeam:e})=>{const{otherTeams:t}=M();return t.length===0?null:a.jsx("div",{className:`flex-col items-stretch ${Jn.teamsContainer}`,children:t.map(n=>a.jsx(ut,{team:n,onClick:e,hidePlanLabel:!0},n.id))})},Vn="_container_1u995_1",Yn="_planCta_1u995_15",Zn="_upgradeIconWrapper_1u995_19",de={container:Vn,planCta:Yn,upgradeIconWrapper:Zn},Xn=({upgradeOptionHref:e})=>{const{planId:t,trialDaysLeft:n,showUpgradeCta:r}=M();if(!r)return null;const c=W(t)?"Your team is currently on the Free plan":`Free trial ends in ${n} ${n===1?"day":"days"}`;return a.jsxs(m.MenuItem,{href:e,className:`flex-col gap-1 items-start ${de.container}`,children:[a.jsx("span",{className:de.planCta,children:c}),a.jsxs("div",{className:`flex-row items-center gap-1 ${de.upgradeIconWrapper}`,children:[a.jsx(rt,{}),a.jsx("span",{children:"See upgrade options"})]})]})},I=({children:e,...t})=>a.jsx("nav",{...t,className:tn.sidebarContainer,children:e});I.Top=({children:e})=>a.jsx("div",{children:e});I.Bottom=({children:e})=>a.jsx("div",{children:e});I.Avatar=sn;I.IconLink=cn;I.Menu=dn;I.ProfileMenu=qn;I.TeamSwitch=Qn;I.TeamMenuItem=ut;I.UpgradeMenuItem=Xn;I.ProfileSettingsMenuItem=Bn;const er="_breadcrumbsItem_1hm6a_1",tr="_breadcrumbs_1hm6a_1",We={breadcrumbsItem:er,breadcrumbs:tr},nr=({items:e})=>a.jsx("nav",{"aria-label":"breadcrumb",className:We.breadcrumbs,children:e.map((t,n)=>a.jsxs(g.Fragment,{children:[a.jsx(m.Link,{className:We.breadcrumbsItem,href:t.link,rel:"noreferrer",children:t.name}),n<e.length-1&&a.jsx("span",{children:" — "})]},`${t.link}-${t.name}`))}),rr=({items:e})=>a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(g.Fragment,{children:[!!n&&t.some(r=>r.visible)&&a.jsx(m.MenuDivider,{}),t.filter(({visible:r})=>r).map(({link:r,label:s,onClick:i})=>a.jsx(m.MenuItem,{href:r||"#","aria-label":s,onClick:i,children:s},s))]},t[0].label))}),sr="_badge_1pc1v_1",ar="_tag_1pc1v_15",ir="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",or="_disabled_1pc1v_57",cr="_projectNavigationItem_1pc1v_61",lr="_projectNavigationItemDisabled_1pc1v_67",E={badge:sr,tag:ar,withNavLinkStyle:ir,disabled:or,projectNavigationItem:cr,projectNavigationItemDisabled:lr},Je=({label:e,badge:t,novel:n})=>a.jsxs("div",{className:"flex gap-1",children:[a.jsxs("div",{children:[a.jsx("span",{children:e}),!!t&&a.jsx("div",{className:E.badge,"aria-label":`${t} items requiring attention`,children:t>9?"9+":t})]}),!!n&&a.jsx(m.Tag,{className:E.tag,children:n})]}),fe=g.forwardRef(({label:e,href:t="",disabled:n=!1,badge:r,onClick:s,novel:i},c)=>a.jsx(m.Tooltip,{tooltip:"You do not have access to this function",show:n,children:a.jsx("div",{className:n?E.projectNavigationItemDisabled:E.projectNavigationItem,children:s||n||!t?a.jsx("button",{type:"button",ref:c,className:C(E.withNavLinkStyle,{[E.disabled]:n}),disabled:n,onClick:s,children:a.jsx(Je,{label:e,badge:r,novel:i})}):a.jsx("a",{href:t,className:E.withNavLinkStyle,children:a.jsx(Je,{label:e,badge:r,novel:i})})})}));fe.displayName="NavigationTabsItem";const ur=e=>(e==null?void 0:e.some(t=>t.some(n=>n.visible)))??!1,dr=e=>e.visible&&(!e.dropdown||ur(e.dropdown)),fr=({navigation:e,activeItem:t})=>a.jsx("nav",{"aria-label":"Project",children:a.jsx("ul",{className:A.navigationTabList,"aria-orientation":"horizontal",children:e.filter(dr).map(n=>{var r,s,i;return n.dropdown?a.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(r=n.isActive)==null?void 0:r.call(n,t),children:a.jsx(m.Menu,{menuButton:({opened:c})=>a.jsx(fe,{label:n.label,disabled:n.disabled,active:c}),children:a.jsx(m.MenuList,{children:a.jsx(rr,{items:n.dropdown})})})},n.key):a.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(s=n.isActive)==null?void 0:s.call(n,t),children:a.jsx(fe,{label:n.label,href:n.link,onClick:n.onClick,disabled:n.disabled,badge:n.badge,novel:n.novel,active:(i=n.isActive)==null?void 0:i.call(n,t)})},n.key)})})}),dt=o.z.object({accessToken:o.z.string(),refreshToken:o.z.string()}),J=xt.buildPayloadRoute({description:"Takes a teamId and returns a JWT token access and refresh token for the user",method:"post",requestPathParamsSchema:o.z.object({teamId:o.z.number()}),pathResolver:e=>`/team/${e.teamId}/actions/get-user-token`,requestHeaderSchema:o.z.object({Authorization:o.z.string().optional(),"x-csrf-token":o.z.string().optional()}),requestBodySchema:o.z.undefined(),successResponseBodySchema:dt}),pe={teamKey:e=>["getUserToken",e]},ft=(e,t,n)=>me.useQuery({...n,queryFn:({queryKey:[r,s]})=>U.sendByPayloadRoute(e,J,{pathParams:{teamId:s},headers:{}}),queryKey:pe.teamKey(t)}),mt=o.z.union([o.z.literal("owner"),o.z.literal("admin"),o.z.literal("biller"),o.z.literal("member")]),mr=o.z.object({userId:o.z.number(),userUuid:o.z.string(),teamId:o.z.number(),userTeamRole:mt,userEmail:o.z.string().email(),userName:o.z.string(),userCurrentTeamId:o.z.number(),planId:o.z.number(),planName:o.z.string(),isProviderAlpha:o.z.boolean(),isFullyAuthenticated:o.z.boolean(),exp:o.z.number()});function B(e){try{const t=e.split(".")[1],n=atob(t);return mr.parse(JSON.parse(n))}catch{return}}const K=class K extends CustomEvent{constructor(t){super(K.eventName,{detail:{token:t,payload:B(t.accessToken)}})}};xe(K,"eventName","new-jwt-issued");let z=K;const hr=pe;function gr(e,t){const n=ft(e,t),r=g.useRef();return g.useEffect(()=>{n.data&&n.data.accessToken!==r.current&&(window.dispatchEvent(new z(n.data)),r.current=n.data.accessToken)},[n.data]),n}function ht(){const e=H(document.cookie,"accessToken"),t=H(document.cookie,"refreshToken");return!e||!t?Promise.resolve(void 0):Promise.resolve({accessToken:e,refreshToken:t})}function br(){return Promise.resolve(H(document.cookie,"csrf_token"))}function H(e,t){var n,r;return(r=(n=e.split(";").find(s=>s.trim().startsWith(`${t}=`)))==null?void 0:n.trim())==null?void 0:r.substring(t.length+1)}function ve(){const[e,t]=g.useState();return g.useEffect(()=>{let n=!1;const r=s=>{t(s.detail.payload),n=!0};return ht().then(s=>s&&B(s.accessToken)).then(s=>{n||t(s)}),window.addEventListener(z.eventName,r),()=>{window.removeEventListener(z.eventName,r)}},[]),e}const gt=o.z.object({user_id:o.z.number(),email:o.z.string().email(),fullname:o.z.string(),created_at:o.z.string(),created_at_timestamp:o.z.number(),role:mt}),_r=o.z.object({team_id:o.z.number(),team_user:gt}),bt=Ve.buildGetRoute({description:"Get the details of a team user",requestPathParamsSchema:o.z.object({teamId:o.z.number(),userId:o.z.number()}),pathResolver:({teamId:e,userId:t})=>`/teams/${e}/users/${t}`,successResponseBodySchema:_r}),Te={teamUserKey:(e,t)=>["GetTeamUsers",e,t]},_t=(e,t,n,r)=>me.useQuery({...r,queryKey:Te.teamUserKey(t,n),queryFn:({queryKey:[s,i,c]})=>U.sendByGetRoute(e,bt,{pathParams:{teamId:i,userId:c}})}),pr=Te;function vr(e){const t=ve();return _t(e,(t==null?void 0:t.teamId)??0,(t==null?void 0:t.userId)??0,{enabled:t!==void 0})}const Tr=o.z.object({lang_id:o.z.number(),lang_iso:o.z.string(),lang_name:o.z.string(),is_writable:o.z.union([o.z.literal(0),o.z.literal(1)])}),yr=o.z.object({user_id:o.z.number(),email:o.z.string().email(),fullname:o.z.string(),created_at:o.z.string(),created_at_timestamp:o.z.number(),admin_rights:o.z.array(o.z.string()),languages:o.z.array(Tr),is_admin:o.z.boolean(),is_reviewer:o.z.boolean()}),jr=o.z.object({project_id:o.z.string(),contributors:o.z.array(yr)}),pt=Ve.buildGetRoute({description:"Get the details of a project contributor",requestPathParamsSchema:o.z.object({projectId:o.z.string(),contributorId:o.z.number()}),pathResolver:({projectId:e,contributorId:t})=>`/projects/${e}/contributors/${t}`,successResponseBodySchema:jr}),ye={projectUserKey:(e,t)=>["RetrieveContributor",e,t]},vt=(e,t,n,r)=>me.useQuery({...r,queryKey:ye.projectUserKey(n,t),queryFn:({queryKey:[s,i,c]})=>U.sendByGetRoute(e,pt,{pathParams:{projectId:i,contributorId:c}})}),wr=ye;function Ir(e,t){const n=ve();return vt(e,(n==null?void 0:n.userId)??0,t,{enabled:n!==void 0})}function xr(e){const t=e.headers.get("Cookie");if(!t)return Promise.resolve(void 0);const n=H(t,"accessToken");if(!n)return Promise.resolve(void 0);const r=B(n);return r?{token:n,payload:r}:Promise.resolve(void 0)}function G(e){return{Authorization:`Bearer ${e}`}}function Sr(e,t){return n=>async(r,s)=>{var u;const i=await t.getCachedJwtToken();if(i===void 0)return n(r,s);const c=await n(r,{...s,headers:{...s.headers,...G(i.accessToken)}});if(i&&(c.status===401||c.status===403)){const d=B(i.accessToken);if(!d)return c;const l=await U.sendByPayloadRoute(e,J,{pathParams:{teamId:d.teamId},headers:G(i.refreshToken)});return await((u=t.onNewJwtTokenIssued)==null?void 0:u.call(t,l)),n(r,{...s,headers:{...s.headers,...G(l.accessToken)}})}return c}}const Tt={wretch:{lokaliseAuth(e){return this.middlewares([Sr(this,e)])}}};function Pr(e,t){return n=>async(r,s)=>{var d;if(await t.getCachedJwtToken()!==void 0)return n(r,s);const c=await t.getCsrfToken();if(c===void 0)return n(r,s);const u=await U.sendByPayloadRoute(e,J,{pathParams:{teamId:await t.getTeamId()},headers:{"x-csrf-token":c}});return await((d=t.onNewJwtTokenIssued)==null?void 0:d.call(t,u)),n(r,{...s,headers:{...s.headers,...G(u.accessToken)}})}}const Nr={wretch:{lokaliseAuth(e={}){return this.addon(Tt).lokaliseAuth(Qe(e))},promoteClassicSession(e){const t=Qe(e);return this.middlewares([Pr(this,t)])}}};function Qe(e){return{...e,getCachedJwtToken:e.getCachedJwtToken??ht,getCsrfToken:"getCsrfToken"in e?e.getCsrfToken:br,onNewJwtTokenIssued:t=>{var n;return window.dispatchEvent(new z(t)),((n=e.onNewJwtTokenIssued)==null?void 0:n.call(e,t))??Promise.resolve()}}}exports.Breadcrumbs=nr;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=be;exports.ENTERPRISE_PLAN_IDS=lt;exports.ESSENTIAL_PLAN_IDS=ot;exports.FREE_PLAN_ID=ge;exports.JWT_TOKEN_SCHEMA=dt;exports.LokaliseAuthAddon=Tt;exports.LokaliseAuthBrowserAddon=Nr;exports.NavigationPanel=q;exports.NavigationTabs=fr;exports.PRO_PLAN_IDS=ct;exports.START_PLAN_IDS=it;exports.Sidebar=I;exports.TEAM_USER_SCHEMA=gt;exports.TRIAL_PLAN_ID=at;exports.authenticatedContributorKeys=wr;exports.authenticatedUserKeys=pr;exports.convertNewLineToBreakTag=kn;exports.formatDate=An;exports.formatDateTz=zn;exports.getAuthenticatedSessionDetailFromRequest=xr;exports.getPromotedClassicSessionJwtKey=hr;exports.getTeamUser=bt;exports.getTeamUsersQueryKey=Te;exports.getUserToken=J;exports.getUserTokenKey=pe;exports.isEnterpriseOpenSourcePlan=Sn;exports.isEnterprisePlan=In;exports.isEssentialPlan=jn;exports.isFreePlan=W;exports.isPaidPlan=xn;exports.isProPlan=wn;exports.isStartPlan=yn;exports.isTrialPlan=_e;exports.makeUrlClickable=Rn;exports.parseJwtTokenPayload=B;exports.retrieveContributor=pt;exports.retrieveContributorKeys=ye;exports.useAuthenticatedProjectContributor=Ir;exports.useAuthenticatedSessionPayload=ve;exports.useAuthenticatedUser=vr;exports.useEffectOnce=Ln;exports.useGetPromotedClassicSessionJwtQuery=gr;exports.useGetUserTokenQuery=ft;exports.useRetrieveContributorQuery=vt;exports.userGetTeamUsersQuery=_t;
|
1
|
+
"use strict";var wt=Object.defineProperty;var It=(e,t,n)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Se=(e,t,n)=>It(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),g=require("react"),m=require("@lokalise/louis"),o=require("zod"),U=require("@lokalise/frontend-http-client"),xt=require("@lokalise/universal-ts-utils/api-contracts/apiContracts"),me=require("@tanstack/react-query"),Ye=require("@lokalise/universal-ts-utils/node"),Ze=require("date-fns"),St=require("date-fns-tz");function Nt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const O=Nt(g);var F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Q,Ne;function he(){if(Ne)return Q;Ne=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Q=e,Q}var V,Pe;function Pt(){if(Pe)return V;Pe=1;var e=typeof F=="object"&&F&&F.Object===Object&&F;return V=e,V}var Y,ke;function et(){if(ke)return Y;ke=1;var e=Pt(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Y=n,Y}var Z,Ee;function kt(){if(Ee)return Z;Ee=1;var e=et(),t=function(){return e.Date.now()};return Z=t,Z}var X,Ce;function Et(){if(Ce)return X;Ce=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return X=t,X}var ee,Re;function Ct(){if(Re)return ee;Re=1;var e=Et(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return ee=n,ee}var te,Ae;function tt(){if(Ae)return te;Ae=1;var e=et(),t=e.Symbol;return te=t,te}var ne,ze;function Rt(){if(ze)return ne;ze=1;var e=tt(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function i(c){var u=n.call(c,s),d=c[s];try{c[s]=void 0;var l=!0}catch{}var f=r.call(c);return l&&(u?c[s]=d:delete c[s]),f}return ne=i,ne}var re,Le;function At(){if(Le)return re;Le=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return re=n,re}var se,Oe;function zt(){if(Oe)return se;Oe=1;var e=tt(),t=Rt(),n=At(),r="[object Null]",s="[object Undefined]",i=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?s:r:i&&i in Object(u)?t(u):n(u)}return se=c,se}var ae,qe;function Lt(){if(qe)return ae;qe=1;function e(t){return t!=null&&typeof t=="object"}return ae=e,ae}var ie,Ue;function Ot(){if(Ue)return ie;Ue=1;var e=zt(),t=Lt(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return ie=r,ie}var oe,Me;function qt(){if(Me)return oe;Me=1;var e=Ct(),t=he(),n=Ot(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function d(l){if(typeof l=="number")return l;if(n(l))return r;if(t(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=t(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=e(l);var p=i.test(l);return p||c.test(l)?u(l.slice(2),p?2:8):s.test(l)?r:+l}return oe=d,oe}var ce,Be;function nt(){if(Be)return ce;Be=1;var e=he(),t=kt(),n=qt(),r="Expected a function",s=Math.max,i=Math.min;function c(u,d,l){var f,p,y,j,_,w,x=0,N=!1,b=!1,S=!0;if(typeof u!="function")throw new TypeError(r);d=n(d)||0,e(l)&&(N=!!l.leading,b="maxWait"in l,y=b?s(n(l.maxWait)||0,d):y,S="trailing"in l?!!l.trailing:S);function T(h){var P=f,L=p;return f=p=void 0,x=h,j=u.apply(L,P),j}function v(h){return x=h,_=setTimeout($,d),N?T(h):j}function D(h){var P=h-w,L=h-x,xe=d-P;return b?i(xe,y-L):xe}function we(h){var P=h-w,L=h-x;return w===void 0||P>=d||P<0||b&&L>=y}function $(){var h=t();if(we(h))return Ie(h);_=setTimeout($,D(h))}function Ie(h){return _=void 0,S&&f?T(h):(f=p=void 0,j)}function yt(){_!==void 0&&clearTimeout(_),x=0,f=w=p=_=void 0}function jt(){return _===void 0?j:Ie(t())}function J(){var h=t(),P=we(h);if(f=arguments,p=this,w=h,P){if(_===void 0)return v(w);if(b)return clearTimeout(_),_=setTimeout($,d),T(w)}return _===void 0&&(_=setTimeout($,d)),j}return J.cancel=yt,J.flush=jt,J}return ce=c,ce}var Ut=nt();const Mt=Xe(Ut);var le,De;function Bt(){if(De)return le;De=1;var e=nt(),t=he(),n="Expected a function";function r(s,i,c){var u=!0,d=!0;if(typeof s!="function")throw new TypeError(n);return t(c)&&(u="leading"in c?!!c.leading:u,d="trailing"in c?!!c.trailing:d),e(s,i,{leading:u,maxWait:i,trailing:d})}return le=r,le}var Dt=Bt();const $t=Xe(Dt),Ft=(e,t,n,r)=>{switch(t){case"debounce":return Mt(e,n,r);case"throttle":return $t(e,n,r);default:return e}},Gt=e=>{const t=O.useRef(e);return O.useEffect(()=>{t.current=e}),O.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])},Ht=e=>{const[t,n]=O.useState((e==null?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:O.useMemo(()=>new Proxy(s=>{s!==t&&n(s)},{get(s,i){return i==="current"?t:s[i]},set(s,i,c){return i==="current"?n(c):s[i]=c,!0}}),[t]),refElement:t,setRefElement:n}},Kt=(e,t)=>t==="border-box"?{width:e.borderBoxSize[0].inlineSize,height:e.borderBoxSize[0].blockSize}:t==="content-box"?{width:e.contentBoxSize[0].inlineSize,height:e.contentBoxSize[0].blockSize}:{width:e.contentRect.width,height:e.contentRect.height};function Wt({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:r,handleWidth:s=!0,handleHeight:i=!0,targetRef:c,observerOptions:u,onResize:d}={}){const l=g.useRef(e),f=Gt(d),[p,y]=g.useState({width:void 0,height:void 0}),{refProxy:j,refElement:_}=Ht(c),{box:w}=u||{},x=g.useCallback(b=>{if(!s&&!i)return;if(l.current){l.current=!1;return}const S=(T,v)=>s&&T.width!==v.width||i&&T.height!==v.height;b.forEach(T=>{const v=Kt(T,w);y(D=>S(D,v)?(f==null||f({width:v.width,height:v.height,entry:T}),v):D)})},[s,i,l,w]),N=g.useCallback(Ft(x,t,n,r),[x,t,n,r]);return g.useEffect(()=>{let b;return _?(b=new window.ResizeObserver(N),b.observe(_,u)):(p.width||p.height)&&(f==null||f({width:null,height:null,entry:null}),y({width:void 0,height:void 0})),()=>{var S,T,v;(S=b==null?void 0:b.disconnect)===null||S===void 0||S.call(b),(v=(T=N).cancel)===null||v===void 0||v.call(T)}},[N,_]),Object.assign({ref:j},p)}function rt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=rt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function C(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=rt(e))&&(r&&(r+=" "),r+=t);return r}const Jt="_headerContainer_1cubo_1",Qt="_navigationTabList_1cubo_8",Vt="_navigationTab_1cubo_8",Yt="_headerContent_1cubo_34",Zt="_staticEnabled_1cubo_50",A={headerContainer:Jt,navigationTabList:Qt,navigationTab:Vt,headerContent:Yt,staticEnabled:Zt},Xt=77,q=({sticky:e,children:t})=>{const{ref:n,height:r}=Wt({refreshMode:"debounce",refreshRate:0}),[s,i]=g.useState(!1),c=()=>s?!e:!0;g.useEffect(()=>{const d=()=>{i(window.scrollY>0)};return window.addEventListener("scroll",d),()=>window.removeEventListener("scroll",d)},[]);const u=`${r||Xt}px`;return a.jsx("div",{style:{minHeight:u},children:a.jsx("div",{children:a.jsxs("div",{ref:n,className:C(A.headerContent,{[A.staticEnabled]:c()}),children:[a.jsx(q.Header,{}),a.jsx(q.Tabs,{}),t]})})})};q.Header=({children:e})=>a.jsx("div",{className:A.headerContainer,children:e});q.Tabs=({children:e})=>a.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const en="_sidebarContainer_bmdti_1",tn={sidebarContainer:en},nn="_logoLink_1baxb_1",rn={logoLink:nn},sn=({src:e,href:t="/",ariaLabel:n="Home",alt:r="Lokalise"})=>a.jsx("a",{className:rn.logoLink,href:t,"aria-label":n,children:a.jsx("img",{src:e,alt:r})}),an="_link_1weq1_1",on="_active_1weq1_18",$e={link:an,active:on},cn=({label:e,to:t,icon:n})=>a.jsx(m.Tooltip,{placement:"right",tooltip:e,children:a.jsx(m.Link,{className:C($e.link,{[$e.active]:window.location.pathname.startsWith(t)}),href:t,children:a.jsx(n,{size:"25px"})})}),ln="_dropdownButton_hwh0c_1",un="_dropdownButtonActive_hwh0c_18",Fe={dropdownButton:ln,dropdownButtonActive:un},dn=({children:e,icon:t})=>a.jsx(m.Menu,{menuButton:({opened:n})=>a.jsx(m.Tooltip,{placement:"right",tooltip:"Help",children:a.jsx("button",{type:"button",className:C(Fe.dropdownButton,{[Fe.dropdownButtonActive]:n}),children:a.jsx(t,{size:"25px"})})}),children:a.jsx(m.MenuList,{placement:"right-start",children:e})}),fn="_iconContainer_nz34m_1",mn={iconContainer:fn},st=({className:e=""})=>a.jsx("div",{"aria-label":"Upgrade Icon",className:C(mn.iconContainer,"flex-row","items-center","justify-center",e),children:a.jsx(m.CaretUpIcon,{})}),hn="_menuContainer_wbu3u_5",gn="_profileButton_wbu3u_16",bn="_profileImage_wbu3u_29",_n="_profileImageHighlight_wbu3u_37",pn="_profileImageUpgradeIcon_wbu3u_41",vn="_userIconWrapper_wbu3u_47",k={menuContainer:hn,profileButton:gn,profileImage:bn,profileImageHighlight:_n,profileImageUpgradeIcon:pn,userIconWrapper:vn},at=g.createContext({}),M=()=>g.useContext(at),Tn=({children:e})=>{const{currentTeam:t,otherTeams:n,showUpgradeCta:r,showBillingButton:s,allowTeamCreation:i,isLimitedView:c,isProviderAlpha:u,canAccessTeamSettings:d,isEndOfTrialActive:l,isTeamSuspended:f}=M();return a.jsx(m.Menu,{menuButton:()=>a.jsxs("button",{className:k.profileButton,"aria-label":"Profile menu",type:"button",children:[t!=null&&t.logoUrl?a.jsx("img",{src:t.logoUrl,className:C(k.profileImage,{[k.profileImageHighlight]:r}),alt:"Team Logo"}):a.jsx("div",{className:C(k.userIconWrapper,"flex-row","align-center","items-center",{[k.profileImageHighlight]:r}),children:a.jsx(m.UserIcon,{size:"25px"})}),r&&a.jsx(st,{className:k.profileImageUpgradeIcon})]}),children:a.jsx(m.MenuList,{placement:"right-end",className:k.menuContainer,children:e({allowTeamCreation:i,otherTeams:n,isLimitedView:c,canAccessTeamSettings:d,isEndOfTrialActive:l,isTeamSuspended:f,showBillingButton:s,isProviderAlpha:u})})})},ge=0,it=9999,ot=[150,151,250,251],ct=[152,153,252,253],lt=[154,155,157,158,254,255,258,354,355,358],ut=[156,159,160,256,259,260],be=9998,K=e=>e===ge,_e=e=>e===it,yn=e=>ot.includes(e),jn=e=>ct.includes(e),wn=e=>lt.includes(e),In=e=>ut.includes(e),xn=e=>e>ge&&e<be,Sn=e=>e===be,Nn=/\n/,Ge=(e,t,n)=>e.split(t).flatMap((r,s)=>s!==0?[g.cloneElement(n,{key:Math.random().toString(32).slice(0,10)}),r]:r),Pn=(e,t,n)=>typeof e=="string"?Ge(e,t,n):e.flatMap(r=>typeof r=="string"?Ge(r,t,n):r),kn=e=>Pn(e,Nn,a.jsx("br",{})),En=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,Cn=e=>e.match(En)??[],He=(e,t,n)=>{const r=e.split(t);if(r.length===1)return e;const s=[];return r[0]!==""&&s.push(r[0]),r.shift(),r[r.length-1]===""&&r.pop(),s.push(a.jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",children:t},t+n)),s.push(r.join(t)),s.filter(i=>i!=="")},Ke=e=>{const t=Cn(e);return t!=null&&t.length?t.reduce((n,r,s)=>typeof n=="string"?He(n,r,s):n.flatMap(i=>typeof i=="string"?He(i,r,s):i),e):e},Rn=e=>typeof e=="string"?Ke(e):e.flatMap(t=>typeof t=="string"?Ke(t):t,e),An=(e,t="PP")=>Ze.format(e,t),zn=(e,t,n="PP")=>Ze.format(St.toZonedTime(e,t),n),Ln=e=>{g.useEffect(e,[])},On=({children:e,config:t})=>{const{teams:n,currentTeamId:r,planId:s,isLimitedView:i,isTeamSuspended:c,canAccessTeamSettings:u,isEndOfTrialActive:d}=t,l=n.find(b=>b.id===r),f=n.filter(b=>b.id!==r),p=(l==null?void 0:l.role)??"",y=["biller","owner"].includes(p),j=K(s)||_e(s),N={...t,currentTeam:l,otherTeams:f,canChangeBilling:y,isOnFreeOrTrialPlan:j,showUpgradeCta:!i&&j&&y&&!c,showBillingButton:!i&&u&&y,allowTeamCreation:!i&&!d};return a.jsx(at.Provider,{value:N,children:e})},qn=({config:e,children:t})=>a.jsx(On,{config:e,children:a.jsx(Tn,{children:t})}),Un="_container_q5pot_1",Mn="_profileEmail_q5pot_5",We={container:Un,profileEmail:Mn},Bn=({href:e,onClick:t,userEmail:n,hideBottomDivider:r})=>{const{isEndOfTrialActive:s,isTeamSuspended:i}=M();return s||i?null:a.jsxs(a.Fragment,{children:[a.jsx(m.MenuItem,{href:e,onClick:()=>{t==null||t()},children:a.jsxs("div",{className:`flex-col ${We.container}`,children:[a.jsx("span",{children:"Profile Settings"}),a.jsx("span",{className:We.profileEmail,children:n})]})}),!r&&a.jsx(m.MenuDivider,{})]})},Dn="_wrapper_15d85_1",$n="_profileImage_15d85_14",Fn="_teamName_15d85_22",Gn="_planLabel_15d85_29",Hn="_membership_15d85_38",Kn="_defaultProfileImage_15d85_44",R={wrapper:Dn,profileImage:$n,teamName:Fn,planLabel:Gn,membership:Hn,defaultProfileImage:Kn},dt=({team:e,onClick:t,hidePlanLabel:n})=>{const{currentTeam:r,planId:s}=M(),i=e||r;if(!i)return null;const c=K(s)?"Free":_e(s)?"Trial":void 0,u=t?m.MenuItem:"div";return a.jsxs(u,{className:`flex-row gap-2 flex-nowrap items-center ${R.wrapper}`,...t&&{onClick:()=>t(i)},children:[i.logoUrl?a.jsx("img",{className:R.profileImage,src:i.logoUrl,alt:"Team Logo"}):a.jsx("span",{className:`flex-row justify-center items-center ${R.defaultProfileImage}`,children:a.jsx(m.UserIcon,{size:"25px"})}),a.jsxs("div",{className:"flex-col items-start",children:[a.jsxs("div",{className:"flex-row items-center flex-nowrap gap-2",children:[a.jsx("span",{title:i.name,className:R.teamName,children:i.name}),c&&!n&&a.jsx("span",{className:`flex-row justify-center items-center ${R.planLabel}`,children:c})]}),a.jsx("span",{className:R.membership,children:i.role})]})]})},Wn="_teamsContainer_1t68g_1",Jn={teamsContainer:Wn},Qn=({onSwitchTeam:e})=>{const{otherTeams:t}=M();return t.length===0?null:a.jsx("div",{className:`flex-col items-stretch ${Jn.teamsContainer}`,children:t.map(n=>a.jsx(dt,{team:n,onClick:e,hidePlanLabel:!0},n.id))})},Vn="_container_1u995_1",Yn="_planCta_1u995_15",Zn="_upgradeIconWrapper_1u995_19",ue={container:Vn,planCta:Yn,upgradeIconWrapper:Zn},Xn=({upgradeOptionHref:e})=>{const{planId:t,trialDaysLeft:n,showUpgradeCta:r}=M();if(!r)return null;const c=K(t)?"Your team is currently on the Free plan":`Free trial ends in ${n} ${n===1?"day":"days"}`;return a.jsxs(m.MenuItem,{href:e,className:`flex-col gap-1 items-start ${ue.container}`,children:[a.jsx("span",{className:ue.planCta,children:c}),a.jsxs("div",{className:`flex-row items-center gap-1 ${ue.upgradeIconWrapper}`,children:[a.jsx(st,{}),a.jsx("span",{children:"See upgrade options"})]})]})},I=({children:e,...t})=>a.jsx("nav",{...t,className:tn.sidebarContainer,children:e});I.Top=({children:e})=>a.jsx("div",{children:e});I.Bottom=({children:e})=>a.jsx("div",{children:e});I.Avatar=sn;I.IconLink=cn;I.Menu=dn;I.ProfileMenu=qn;I.TeamSwitch=Qn;I.TeamMenuItem=dt;I.UpgradeMenuItem=Xn;I.ProfileSettingsMenuItem=Bn;const er="_breadcrumbsItem_1hm6a_1",tr="_breadcrumbs_1hm6a_1",Je={breadcrumbsItem:er,breadcrumbs:tr},nr=({items:e})=>a.jsx("nav",{"aria-label":"breadcrumb",className:Je.breadcrumbs,children:e.map((t,n)=>a.jsxs(g.Fragment,{children:[a.jsx(m.Link,{className:Je.breadcrumbsItem,href:t.link,rel:"noreferrer",children:t.name}),n<e.length-1&&a.jsx("span",{children:" — "})]},`${t.link}-${t.name}`))}),rr=({items:e})=>a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs(g.Fragment,{children:[!!n&&t.some(r=>r.visible)&&a.jsx(m.MenuDivider,{}),t.filter(({visible:r})=>r).map(({link:r,label:s,onClick:i})=>a.jsx(m.MenuItem,{href:r||"#","aria-label":s,onClick:i,children:s},s))]},t[0].label))}),sr="_badge_1pc1v_1",ar="_tag_1pc1v_15",ir="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",or="_disabled_1pc1v_57",cr="_projectNavigationItem_1pc1v_61",lr="_projectNavigationItemDisabled_1pc1v_67",E={badge:sr,tag:ar,withNavLinkStyle:ir,disabled:or,projectNavigationItem:cr,projectNavigationItemDisabled:lr},Qe=({label:e,badge:t,novel:n})=>a.jsxs("div",{className:"flex gap-1",children:[a.jsxs("div",{children:[a.jsx("span",{children:e}),!!t&&a.jsx("div",{className:E.badge,"aria-label":`${t} items requiring attention`,children:t>9?"9+":t})]}),!!n&&a.jsx(m.Tag,{className:E.tag,children:n})]}),de=g.forwardRef(({label:e,href:t="",disabled:n=!1,badge:r,onClick:s,novel:i},c)=>a.jsx(m.Tooltip,{tooltip:"You do not have access to this function",show:n,children:a.jsx("div",{className:n?E.projectNavigationItemDisabled:E.projectNavigationItem,children:s||n||!t?a.jsx("button",{type:"button",ref:c,className:C(E.withNavLinkStyle,{[E.disabled]:n}),disabled:n,onClick:s,children:a.jsx(Qe,{label:e,badge:r,novel:i})}):a.jsx("a",{href:t,className:E.withNavLinkStyle,children:a.jsx(Qe,{label:e,badge:r,novel:i})})})}));de.displayName="NavigationTabsItem";const ur=e=>(e==null?void 0:e.some(t=>t.some(n=>n.visible)))??!1,dr=e=>e.visible&&(!e.dropdown||ur(e.dropdown)),fr=({navigation:e,activeItem:t})=>a.jsx("nav",{"aria-label":"Project",children:a.jsx("ul",{className:A.navigationTabList,"aria-orientation":"horizontal",children:e.filter(dr).map(n=>{var r,s,i;return n.dropdown?a.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(r=n.isActive)==null?void 0:r.call(n,t),children:a.jsx(m.Menu,{menuButton:({opened:c})=>a.jsx(de,{label:n.label,disabled:n.disabled,active:c}),children:a.jsx(m.MenuList,{children:a.jsx(rr,{items:n.dropdown})})})},n.key):a.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(s=n.isActive)==null?void 0:s.call(n,t),children:a.jsx(de,{label:n.label,href:n.link,onClick:n.onClick,disabled:n.disabled,badge:n.badge,novel:n.novel,active:(i=n.isActive)==null?void 0:i.call(n,t)})},n.key)})})}),ft=o.z.object({accessToken:o.z.string(),refreshToken:o.z.string()}),W=xt.buildPayloadRoute({description:"Takes a teamId and returns a JWT token access and refresh token for the user",method:"post",requestPathParamsSchema:o.z.object({teamId:o.z.number()}),pathResolver:e=>`/team/${e.teamId}/actions/get-user-token`,requestHeaderSchema:o.z.object({Authorization:o.z.string().optional(),"x-csrf-token":o.z.string().optional()}),requestBodySchema:o.z.undefined(),successResponseBodySchema:ft}),pe={teamKey:e=>["getUserToken",e]},mt=(e,t,n)=>me.useQuery({...n,queryFn:({queryKey:[r,s]})=>U.sendByPayloadRoute(e,W,{pathParams:{teamId:s},headers:{}}),queryKey:pe.teamKey(t)}),ht=o.z.union([o.z.literal("owner"),o.z.literal("admin"),o.z.literal("biller"),o.z.literal("member")]),mr=o.z.object({userId:o.z.number(),userUuid:o.z.string(),teamId:o.z.number(),userTeamRole:ht,userEmail:o.z.string().email(),userName:o.z.string(),userCurrentTeamId:o.z.number(),planId:o.z.number(),planName:o.z.string(),isProviderAlpha:o.z.boolean(),isFullyAuthenticated:o.z.boolean(),exp:o.z.number()});function B(e){try{const t=e.split(".")[1],n=atob(t);return mr.parse(JSON.parse(n))}catch{return}}const H=class H extends CustomEvent{constructor(t){super(H.eventName,{detail:{token:t,payload:B(t.accessToken)}})}};Se(H,"eventName","new-jwt-issued");let z=H;const hr=pe;function gr(e,t){const n=mt(e,t),r=g.useRef();return g.useEffect(()=>{n.data&&n.data.accessToken!==r.current&&(window.dispatchEvent(new z(n.data)),r.current=n.data.accessToken)},[n.data]),n}function ve(){const e=fe(document.cookie,"accessToken"),t=fe(document.cookie,"refreshToken");return!e||!t?Promise.resolve(void 0):Promise.resolve({accessToken:e,refreshToken:t})}function br(){return Promise.resolve(fe(document.cookie,"csrf_token"))}function fe(e,t){var n,r;return(r=(n=e.split(";").find(s=>s.trim().startsWith(`${t}=`)))==null?void 0:n.trim())==null?void 0:r.substring(t.length+1)}function Te(){const[e,t]=g.useState();return g.useEffect(()=>{let n=!1;const r=s=>{t(s.detail.payload),n=!0};return ve().then(s=>s&&B(s.accessToken)).then(s=>{n||t(s)}),window.addEventListener(z.eventName,r),()=>{window.removeEventListener(z.eventName,r)}},[]),e}const gt=o.z.object({user_id:o.z.number(),email:o.z.string().email(),fullname:o.z.string(),created_at:o.z.string(),created_at_timestamp:o.z.number(),role:ht}),_r=o.z.object({team_id:o.z.number(),team_user:gt}),bt=Ye.buildGetRoute({description:"Get the details of a team user",requestPathParamsSchema:o.z.object({teamId:o.z.number(),userId:o.z.number()}),pathResolver:({teamId:e,userId:t})=>`/teams/${e}/users/${t}`,successResponseBodySchema:_r}),ye={teamUserKey:(e,t)=>["GetTeamUsers",e,t]},_t=(e,t,n,r)=>me.useQuery({...r,queryKey:ye.teamUserKey(t,n),queryFn:({queryKey:[s,i,c]})=>U.sendByGetRoute(e,bt,{pathParams:{teamId:i,userId:c}})}),pr=ye;function vr(e){const t=Te();return _t(e,(t==null?void 0:t.teamId)??0,(t==null?void 0:t.userId)??0,{enabled:t!==void 0})}const Tr=o.z.object({lang_id:o.z.number(),lang_iso:o.z.string(),lang_name:o.z.string(),is_writable:o.z.union([o.z.literal(0),o.z.literal(1)])}),yr=o.z.object({user_id:o.z.number(),email:o.z.string().email(),fullname:o.z.string(),created_at:o.z.string(),created_at_timestamp:o.z.number(),admin_rights:o.z.array(o.z.string()),languages:o.z.array(Tr),is_admin:o.z.boolean(),is_reviewer:o.z.boolean()}),jr=o.z.object({project_id:o.z.string(),contributors:o.z.array(yr)}),pt=Ye.buildGetRoute({description:"Get the details of a project contributor",requestPathParamsSchema:o.z.object({projectId:o.z.string(),contributorId:o.z.number()}),pathResolver:({projectId:e,contributorId:t})=>`/projects/${e}/contributors/${t}`,successResponseBodySchema:jr}),je={projectUserKey:(e,t)=>["RetrieveContributor",e,t]},vt=(e,t,n,r)=>me.useQuery({...r,queryKey:je.projectUserKey(n,t),queryFn:({queryKey:[s,i,c]})=>U.sendByGetRoute(e,pt,{pathParams:{projectId:i,contributorId:c}})}),wr=je;function Ir(e,t){const n=Te();return vt(e,(n==null?void 0:n.userId)??0,t,{enabled:n!==void 0})}async function xr(){const e=await ve();if(!e)return Promise.resolve(void 0);const t=B(e.accessToken);return t?{...e,payload:t}:Promise.resolve(void 0)}function G(e){return{Authorization:`Bearer ${e}`}}function Sr(e,t){return n=>async(r,s)=>{var u;const i=await t.getCachedJwtToken();if(i===void 0)return n(r,s);const c=await n(r,{...s,headers:{...s.headers,...G(i.accessToken)}});if(i&&(c.status===401||c.status===403)){const d=B(i.accessToken);if(!d)return c;const l=await U.sendByPayloadRoute(e,W,{pathParams:{teamId:d.teamId},headers:G(i.refreshToken)});return await((u=t.onNewJwtTokenIssued)==null?void 0:u.call(t,l)),n(r,{...s,headers:{...s.headers,...G(l.accessToken)}})}return c}}const Tt={wretch:{lokaliseAuth(e){return this.middlewares([Sr(this,e)])}}};function Nr(e,t){return n=>async(r,s)=>{var d;if(await t.getCachedJwtToken()!==void 0)return n(r,s);const c=await t.getCsrfToken();if(c===void 0)return n(r,s);const u=await U.sendByPayloadRoute(e,W,{pathParams:{teamId:await t.getTeamId()},headers:{"x-csrf-token":c}});return await((d=t.onNewJwtTokenIssued)==null?void 0:d.call(t,u)),n(r,{...s,headers:{...s.headers,...G(u.accessToken)}})}}const Pr={wretch:{lokaliseAuth(e={}){return this.addon(Tt).lokaliseAuth(Ve(e))},promoteClassicSession(e){const t=Ve(e);return this.middlewares([Nr(this,t)])}}};function Ve(e){return{...e,getCachedJwtToken:e.getCachedJwtToken??ve,getCsrfToken:"getCsrfToken"in e?e.getCsrfToken:br,onNewJwtTokenIssued:t=>{var n;return window.dispatchEvent(new z(t)),((n=e.onNewJwtTokenIssued)==null?void 0:n.call(e,t))??Promise.resolve()}}}exports.Breadcrumbs=nr;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=be;exports.ENTERPRISE_PLAN_IDS=ut;exports.ESSENTIAL_PLAN_IDS=ct;exports.FREE_PLAN_ID=ge;exports.JWT_TOKEN_SCHEMA=ft;exports.LokaliseAuthAddon=Tt;exports.LokaliseAuthBrowserAddon=Pr;exports.NavigationPanel=q;exports.NavigationTabs=fr;exports.PRO_PLAN_IDS=lt;exports.START_PLAN_IDS=ot;exports.Sidebar=I;exports.TEAM_USER_SCHEMA=gt;exports.TRIAL_PLAN_ID=it;exports.authenticatedContributorKeys=wr;exports.authenticatedUserKeys=pr;exports.convertNewLineToBreakTag=kn;exports.formatDate=An;exports.formatDateTz=zn;exports.getAuthenticatedSessionDetailFromRequest=xr;exports.getPromotedClassicSessionJwtKey=hr;exports.getTeamUser=bt;exports.getTeamUsersQueryKey=ye;exports.getUserToken=W;exports.getUserTokenKey=pe;exports.isEnterpriseOpenSourcePlan=Sn;exports.isEnterprisePlan=In;exports.isEssentialPlan=jn;exports.isFreePlan=K;exports.isPaidPlan=xn;exports.isProPlan=wn;exports.isStartPlan=yn;exports.isTrialPlan=_e;exports.makeUrlClickable=Rn;exports.parseJwtTokenPayload=B;exports.retrieveContributor=pt;exports.retrieveContributorKeys=je;exports.useAuthenticatedProjectContributor=Ir;exports.useAuthenticatedSessionPayload=Te;exports.useAuthenticatedUser=vr;exports.useEffectOnce=Ln;exports.useGetPromotedClassicSessionJwtQuery=gr;exports.useGetUserTokenQuery=mt;exports.useRetrieveContributorQuery=vt;exports.userGetTeamUsersQuery=_t;
|
package/dist/harmony.mjs
CHANGED
@@ -1,89 +1,89 @@
|
|
1
1
|
var It = Object.defineProperty;
|
2
2
|
var Nt = (e, t, n) => t in e ? It(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
3
|
-
var
|
4
|
-
import { jsx as
|
3
|
+
var Ne = (e, t, n) => Nt(e, typeof t != "symbol" ? t + "" : t, n);
|
4
|
+
import { jsx as i, jsxs as _, Fragment as Ve } from "react/jsx-runtime";
|
5
5
|
import * as x from "react";
|
6
|
-
import { useRef as
|
7
|
-
import { Tooltip as me, Link as
|
6
|
+
import { useRef as Ye, useState as de, useCallback as ke, useEffect as q, useContext as kt, createContext as St, cloneElement as Et, Fragment as Ze, forwardRef as Pt } from "react";
|
7
|
+
import { Tooltip as me, Link as Xe, Menu as fe, MenuList as he, CaretUpIcon as Ct, UserIcon as et, MenuItem as H, MenuDivider as tt, Tag as Rt } from "@lokalise/louis";
|
8
8
|
import { z as s } from "zod";
|
9
|
-
import { sendByPayloadRoute as ge, sendByGetRoute as
|
9
|
+
import { sendByPayloadRoute as ge, sendByGetRoute as nt } from "@lokalise/frontend-http-client";
|
10
10
|
import { buildPayloadRoute as jt } from "@lokalise/universal-ts-utils/api-contracts/apiContracts";
|
11
11
|
import { useQuery as be } from "@tanstack/react-query";
|
12
|
-
import { buildGetRoute as
|
13
|
-
import { format as
|
12
|
+
import { buildGetRoute as rt } from "@lokalise/universal-ts-utils/node";
|
13
|
+
import { format as at } from "date-fns";
|
14
14
|
import { toZonedTime as At } from "date-fns-tz";
|
15
15
|
var $ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
16
|
-
function
|
16
|
+
function it(e) {
|
17
17
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
18
18
|
}
|
19
|
-
var
|
19
|
+
var K, Se;
|
20
20
|
function pe() {
|
21
|
-
if (
|
22
|
-
|
21
|
+
if (Se) return K;
|
22
|
+
Se = 1;
|
23
23
|
function e(t) {
|
24
24
|
var n = typeof t;
|
25
25
|
return t != null && (n == "object" || n == "function");
|
26
26
|
}
|
27
|
-
return
|
27
|
+
return K = e, K;
|
28
28
|
}
|
29
|
-
var
|
29
|
+
var J, Ee;
|
30
30
|
function Lt() {
|
31
|
-
if (
|
32
|
-
|
31
|
+
if (Ee) return J;
|
32
|
+
Ee = 1;
|
33
33
|
var e = typeof $ == "object" && $ && $.Object === Object && $;
|
34
|
-
return
|
34
|
+
return J = e, J;
|
35
35
|
}
|
36
|
-
var
|
36
|
+
var Q, Pe;
|
37
37
|
function ot() {
|
38
|
-
if (Pe) return
|
38
|
+
if (Pe) return Q;
|
39
39
|
Pe = 1;
|
40
40
|
var e = Lt(), t = typeof self == "object" && self && self.Object === Object && self, n = e || t || Function("return this")();
|
41
|
-
return
|
41
|
+
return Q = n, Q;
|
42
42
|
}
|
43
|
-
var
|
43
|
+
var V, Ce;
|
44
44
|
function Ot() {
|
45
|
-
if (
|
46
|
-
|
45
|
+
if (Ce) return V;
|
46
|
+
Ce = 1;
|
47
47
|
var e = ot(), t = function() {
|
48
48
|
return e.Date.now();
|
49
49
|
};
|
50
|
-
return
|
50
|
+
return V = t, V;
|
51
51
|
}
|
52
|
-
var
|
52
|
+
var Y, Re;
|
53
53
|
function xt() {
|
54
|
-
if (
|
55
|
-
|
54
|
+
if (Re) return Y;
|
55
|
+
Re = 1;
|
56
56
|
var e = /\s/;
|
57
57
|
function t(n) {
|
58
58
|
for (var r = n.length; r-- && e.test(n.charAt(r)); )
|
59
59
|
;
|
60
60
|
return r;
|
61
61
|
}
|
62
|
-
return
|
62
|
+
return Y = t, Y;
|
63
63
|
}
|
64
|
-
var
|
64
|
+
var Z, je;
|
65
65
|
function qt() {
|
66
|
-
if (
|
67
|
-
|
66
|
+
if (je) return Z;
|
67
|
+
je = 1;
|
68
68
|
var e = xt(), t = /^\s+/;
|
69
69
|
function n(r) {
|
70
70
|
return r && r.slice(0, e(r) + 1).replace(t, "");
|
71
71
|
}
|
72
|
-
return
|
72
|
+
return Z = n, Z;
|
73
73
|
}
|
74
|
-
var
|
75
|
-
function
|
76
|
-
if (
|
77
|
-
|
74
|
+
var X, Ae;
|
75
|
+
function st() {
|
76
|
+
if (Ae) return X;
|
77
|
+
Ae = 1;
|
78
78
|
var e = ot(), t = e.Symbol;
|
79
|
-
return
|
79
|
+
return X = t, X;
|
80
80
|
}
|
81
|
-
var
|
81
|
+
var ee, Le;
|
82
82
|
function Ut() {
|
83
|
-
if (
|
84
|
-
|
85
|
-
var e =
|
86
|
-
function
|
83
|
+
if (Le) return ee;
|
84
|
+
Le = 1;
|
85
|
+
var e = st(), t = Object.prototype, n = t.hasOwnProperty, r = t.toString, a = e ? e.toStringTag : void 0;
|
86
|
+
function o(c) {
|
87
87
|
var u = n.call(c, a), d = c[a];
|
88
88
|
try {
|
89
89
|
c[a] = void 0;
|
@@ -93,52 +93,52 @@ function Ut() {
|
|
93
93
|
var m = r.call(c);
|
94
94
|
return l && (u ? c[a] = d : delete c[a]), m;
|
95
95
|
}
|
96
|
-
return
|
96
|
+
return ee = o, ee;
|
97
97
|
}
|
98
|
-
var
|
98
|
+
var te, Oe;
|
99
99
|
function Mt() {
|
100
|
-
if (
|
101
|
-
|
100
|
+
if (Oe) return te;
|
101
|
+
Oe = 1;
|
102
102
|
var e = Object.prototype, t = e.toString;
|
103
103
|
function n(r) {
|
104
104
|
return t.call(r);
|
105
105
|
}
|
106
|
-
return
|
106
|
+
return te = n, te;
|
107
107
|
}
|
108
|
-
var
|
108
|
+
var ne, xe;
|
109
109
|
function Bt() {
|
110
|
-
if (
|
111
|
-
|
112
|
-
var e =
|
110
|
+
if (xe) return ne;
|
111
|
+
xe = 1;
|
112
|
+
var e = st(), t = Ut(), n = Mt(), r = "[object Null]", a = "[object Undefined]", o = e ? e.toStringTag : void 0;
|
113
113
|
function c(u) {
|
114
|
-
return u == null ? u === void 0 ? a : r :
|
114
|
+
return u == null ? u === void 0 ? a : r : o && o in Object(u) ? t(u) : n(u);
|
115
115
|
}
|
116
|
-
return
|
116
|
+
return ne = c, ne;
|
117
117
|
}
|
118
|
-
var
|
118
|
+
var re, qe;
|
119
119
|
function $t() {
|
120
|
-
if (
|
121
|
-
|
120
|
+
if (qe) return re;
|
121
|
+
qe = 1;
|
122
122
|
function e(t) {
|
123
123
|
return t != null && typeof t == "object";
|
124
124
|
}
|
125
|
-
return
|
125
|
+
return re = e, re;
|
126
126
|
}
|
127
|
-
var
|
127
|
+
var ae, Ue;
|
128
128
|
function zt() {
|
129
|
-
if (
|
130
|
-
|
129
|
+
if (Ue) return ae;
|
130
|
+
Ue = 1;
|
131
131
|
var e = Bt(), t = $t(), n = "[object Symbol]";
|
132
132
|
function r(a) {
|
133
133
|
return typeof a == "symbol" || t(a) && e(a) == n;
|
134
134
|
}
|
135
|
-
return
|
135
|
+
return ae = r, ae;
|
136
136
|
}
|
137
|
-
var ie,
|
137
|
+
var ie, Me;
|
138
138
|
function Dt() {
|
139
|
-
if (
|
140
|
-
|
141
|
-
var e = qt(), t = pe(), n = zt(), r = NaN, a = /^[-+]0x[0-9a-f]+$/i,
|
139
|
+
if (Me) return ie;
|
140
|
+
Me = 1;
|
141
|
+
var e = qt(), t = pe(), n = zt(), r = NaN, a = /^[-+]0x[0-9a-f]+$/i, o = /^0b[01]+$/i, c = /^0o[0-7]+$/i, u = parseInt;
|
142
142
|
function d(l) {
|
143
143
|
if (typeof l == "number")
|
144
144
|
return l;
|
@@ -151,54 +151,54 @@ function Dt() {
|
|
151
151
|
if (typeof l != "string")
|
152
152
|
return l === 0 ? l : +l;
|
153
153
|
l = e(l);
|
154
|
-
var b =
|
154
|
+
var b = o.test(l);
|
155
155
|
return b || c.test(l) ? u(l.slice(2), b ? 2 : 8) : a.test(l) ? r : +l;
|
156
156
|
}
|
157
157
|
return ie = d, ie;
|
158
158
|
}
|
159
|
-
var
|
160
|
-
function
|
161
|
-
if (
|
162
|
-
|
163
|
-
var e = pe(), t = Ot(), n = Dt(), r = "Expected a function", a = Math.max,
|
159
|
+
var oe, Be;
|
160
|
+
function ct() {
|
161
|
+
if (Be) return oe;
|
162
|
+
Be = 1;
|
163
|
+
var e = pe(), t = Ot(), n = Dt(), r = "Expected a function", a = Math.max, o = Math.min;
|
164
164
|
function c(u, d, l) {
|
165
165
|
var m, b, T, w, g, y, N = 0, S = !1, h = !1, k = !0;
|
166
166
|
if (typeof u != "function")
|
167
167
|
throw new TypeError(r);
|
168
168
|
d = n(d) || 0, e(l) && (S = !!l.leading, h = "maxWait" in l, T = h ? a(n(l.maxWait) || 0, d) : T, k = "trailing" in l ? !!l.trailing : k);
|
169
169
|
function v(f) {
|
170
|
-
var
|
171
|
-
return m = b = void 0, N = f, w = u.apply(O,
|
170
|
+
var E = m, O = b;
|
171
|
+
return m = b = void 0, N = f, w = u.apply(O, E), w;
|
172
172
|
}
|
173
173
|
function p(f) {
|
174
174
|
return N = f, g = setTimeout(B, d), S ? v(f) : w;
|
175
175
|
}
|
176
176
|
function M(f) {
|
177
|
-
var
|
178
|
-
return h ?
|
177
|
+
var E = f - y, O = f - N, Ie = d - E;
|
178
|
+
return h ? o(Ie, T - O) : Ie;
|
179
179
|
}
|
180
|
-
function
|
181
|
-
var
|
182
|
-
return y === void 0 ||
|
180
|
+
function we(f) {
|
181
|
+
var E = f - y, O = f - N;
|
182
|
+
return y === void 0 || E >= d || E < 0 || h && O >= T;
|
183
183
|
}
|
184
184
|
function B() {
|
185
185
|
var f = t();
|
186
|
-
if (
|
187
|
-
return
|
186
|
+
if (we(f))
|
187
|
+
return ye(f);
|
188
188
|
g = setTimeout(B, M(f));
|
189
189
|
}
|
190
|
-
function
|
190
|
+
function ye(f) {
|
191
191
|
return g = void 0, k && m ? v(f) : (m = b = void 0, w);
|
192
192
|
}
|
193
193
|
function wt() {
|
194
194
|
g !== void 0 && clearTimeout(g), N = 0, m = y = b = g = void 0;
|
195
195
|
}
|
196
196
|
function yt() {
|
197
|
-
return g === void 0 ? w :
|
197
|
+
return g === void 0 ? w : ye(t());
|
198
198
|
}
|
199
|
-
function
|
200
|
-
var f = t(),
|
201
|
-
if (m = arguments, b = this, y = f,
|
199
|
+
function W() {
|
200
|
+
var f = t(), E = we(f);
|
201
|
+
if (m = arguments, b = this, y = f, E) {
|
202
202
|
if (g === void 0)
|
203
203
|
return p(y);
|
204
204
|
if (h)
|
@@ -206,31 +206,31 @@ function st() {
|
|
206
206
|
}
|
207
207
|
return g === void 0 && (g = setTimeout(B, d)), w;
|
208
208
|
}
|
209
|
-
return
|
209
|
+
return W.cancel = wt, W.flush = yt, W;
|
210
210
|
}
|
211
|
-
return
|
211
|
+
return oe = c, oe;
|
212
212
|
}
|
213
|
-
var Ft =
|
214
|
-
const Ht = /* @__PURE__ */
|
215
|
-
var
|
213
|
+
var Ft = ct();
|
214
|
+
const Ht = /* @__PURE__ */ it(Ft);
|
215
|
+
var se, $e;
|
216
216
|
function Gt() {
|
217
|
-
if (
|
218
|
-
|
219
|
-
var e =
|
220
|
-
function r(a,
|
217
|
+
if ($e) return se;
|
218
|
+
$e = 1;
|
219
|
+
var e = ct(), t = pe(), n = "Expected a function";
|
220
|
+
function r(a, o, c) {
|
221
221
|
var u = !0, d = !0;
|
222
222
|
if (typeof a != "function")
|
223
223
|
throw new TypeError(n);
|
224
|
-
return t(c) && (u = "leading" in c ? !!c.leading : u, d = "trailing" in c ? !!c.trailing : d), e(a,
|
224
|
+
return t(c) && (u = "leading" in c ? !!c.leading : u, d = "trailing" in c ? !!c.trailing : d), e(a, o, {
|
225
225
|
leading: u,
|
226
|
-
maxWait:
|
226
|
+
maxWait: o,
|
227
227
|
trailing: d
|
228
228
|
});
|
229
229
|
}
|
230
|
-
return
|
230
|
+
return se = r, se;
|
231
231
|
}
|
232
232
|
var Wt = Gt();
|
233
|
-
const Kt = /* @__PURE__ */
|
233
|
+
const Kt = /* @__PURE__ */ it(Wt), Jt = (e, t, n, r) => {
|
234
234
|
switch (t) {
|
235
235
|
case "debounce":
|
236
236
|
return Ht(e, n, r);
|
@@ -259,11 +259,11 @@ const Kt = /* @__PURE__ */ at(Wt), Jt = (e, t, n, r) => {
|
|
259
259
|
}, 0), { refProxy: x.useMemo(() => new Proxy((a) => {
|
260
260
|
a !== t && n(a);
|
261
261
|
}, {
|
262
|
-
get(a,
|
263
|
-
return
|
262
|
+
get(a, o) {
|
263
|
+
return o === "current" ? t : a[o];
|
264
264
|
},
|
265
|
-
set(a,
|
266
|
-
return
|
265
|
+
set(a, o, c) {
|
266
|
+
return o === "current" ? n(c) : a[o] = c, !0;
|
267
267
|
}
|
268
268
|
}), [t]), refElement: t, setRefElement: n };
|
269
269
|
}
|
@@ -277,18 +277,18 @@ const Kt = /* @__PURE__ */ at(Wt), Jt = (e, t, n, r) => {
|
|
277
277
|
width: e.contentRect.width,
|
278
278
|
height: e.contentRect.height
|
279
279
|
};
|
280
|
-
function Zt({ skipOnMount: e = !1, refreshMode: t, refreshRate: n = 1e3, refreshOptions: r, handleWidth: a = !0, handleHeight:
|
281
|
-
const l =
|
280
|
+
function Zt({ skipOnMount: e = !1, refreshMode: t, refreshRate: n = 1e3, refreshOptions: r, handleWidth: a = !0, handleHeight: o = !0, targetRef: c, observerOptions: u, onResize: d } = {}) {
|
281
|
+
const l = Ye(e), m = Qt(d), [b, T] = de({
|
282
282
|
width: void 0,
|
283
283
|
height: void 0
|
284
|
-
}), { refProxy: w, refElement: g } = Vt(c), { box: y } = u || {}, N =
|
285
|
-
if (!a && !
|
284
|
+
}), { refProxy: w, refElement: g } = Vt(c), { box: y } = u || {}, N = ke((h) => {
|
285
|
+
if (!a && !o)
|
286
286
|
return;
|
287
287
|
if (l.current) {
|
288
288
|
l.current = !1;
|
289
289
|
return;
|
290
290
|
}
|
291
|
-
const k = (v, p) => a && v.width !== p.width ||
|
291
|
+
const k = (v, p) => a && v.width !== p.width || o && v.height !== p.height;
|
292
292
|
h.forEach((v) => {
|
293
293
|
const p = Yt(v, y);
|
294
294
|
T((M) => k(M, p) ? (m == null || m({
|
@@ -297,7 +297,7 @@ function Zt({ skipOnMount: e = !1, refreshMode: t, refreshRate: n = 1e3, refresh
|
|
297
297
|
entry: v
|
298
298
|
}), p) : M);
|
299
299
|
});
|
300
|
-
}, [a,
|
300
|
+
}, [a, o, l, y]), S = ke(Jt(N, t, n, r), [
|
301
301
|
N,
|
302
302
|
t,
|
303
303
|
n,
|
@@ -315,17 +315,17 @@ function Zt({ skipOnMount: e = !1, refreshMode: t, refreshRate: n = 1e3, refresh
|
|
315
315
|
};
|
316
316
|
}, [S, g]), Object.assign({ ref: w }, b);
|
317
317
|
}
|
318
|
-
function
|
318
|
+
function lt(e) {
|
319
319
|
var t, n, r = "";
|
320
320
|
if (typeof e == "string" || typeof e == "number") r += e;
|
321
321
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
322
322
|
var a = e.length;
|
323
|
-
for (t = 0; t < a; t++) e[t] && (n =
|
323
|
+
for (t = 0; t < a; t++) e[t] && (n = lt(e[t])) && (r && (r += " "), r += n);
|
324
324
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
325
325
|
return r;
|
326
326
|
}
|
327
327
|
function R() {
|
328
|
-
for (var e, t, n = 0, r = "", a = arguments.length; n < a; n++) (e = arguments[n]) && (t =
|
328
|
+
for (var e, t, n = 0, r = "", a = arguments.length; n < a; n++) (e = arguments[n]) && (t = lt(e)) && (r && (r += " "), r += t);
|
329
329
|
return r;
|
330
330
|
}
|
331
331
|
const Xt = "_headerContainer_1cubo_1", en = "_navigationTabList_1cubo_8", tn = "_navigationTab_1cubo_8", nn = "_headerContent_1cubo_34", rn = "_staticEnabled_1cubo_50", A = {
|
@@ -338,15 +338,15 @@ const Xt = "_headerContainer_1cubo_1", en = "_navigationTabList_1cubo_8", tn = "
|
|
338
338
|
const { ref: n, height: r } = Zt({
|
339
339
|
refreshMode: "debounce",
|
340
340
|
refreshRate: 0
|
341
|
-
}), [a,
|
341
|
+
}), [a, o] = de(!1), c = () => a ? !e : !0;
|
342
342
|
q(() => {
|
343
343
|
const d = () => {
|
344
|
-
|
344
|
+
o(window.scrollY > 0);
|
345
345
|
};
|
346
346
|
return window.addEventListener("scroll", d), () => window.removeEventListener("scroll", d);
|
347
347
|
}, []);
|
348
348
|
const u = `${r || an}px`;
|
349
|
-
return /* @__PURE__ */
|
349
|
+
return /* @__PURE__ */ i("div", { style: { minHeight: u }, children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ _(
|
350
350
|
"div",
|
351
351
|
{
|
352
352
|
ref: n,
|
@@ -354,52 +354,52 @@ const Xt = "_headerContainer_1cubo_1", en = "_navigationTabList_1cubo_8", tn = "
|
|
354
354
|
[A.staticEnabled]: c()
|
355
355
|
}),
|
356
356
|
children: [
|
357
|
-
/* @__PURE__ */
|
358
|
-
/* @__PURE__ */
|
357
|
+
/* @__PURE__ */ i(D.Header, {}),
|
358
|
+
/* @__PURE__ */ i(D.Tabs, {}),
|
359
359
|
t
|
360
360
|
]
|
361
361
|
}
|
362
362
|
) }) });
|
363
363
|
};
|
364
|
-
D.Header = ({ children: e }) => /* @__PURE__ */
|
365
|
-
D.Tabs = ({ children: e }) => /* @__PURE__ */
|
364
|
+
D.Header = ({ children: e }) => /* @__PURE__ */ i("div", { className: A.headerContainer, children: e });
|
365
|
+
D.Tabs = ({ children: e }) => /* @__PURE__ */ i("div", { className: "flex justify-between gap-2 nowrap", children: e });
|
366
366
|
const on = "_sidebarContainer_bmdti_1", sn = {
|
367
367
|
sidebarContainer: on
|
368
368
|
}, cn = "_logoLink_1baxb_1", ln = {
|
369
369
|
logoLink: cn
|
370
|
-
}, un = ({ src: e, href: t = "/", ariaLabel: n = "Home", alt: r = "Lokalise" }) => /* @__PURE__ */
|
370
|
+
}, un = ({ src: e, href: t = "/", ariaLabel: n = "Home", alt: r = "Lokalise" }) => /* @__PURE__ */ i("a", { className: ln.logoLink, href: t, "aria-label": n, children: /* @__PURE__ */ i("img", { src: e, alt: r }) }), dn = "_link_1weq1_1", mn = "_active_1weq1_18", ze = {
|
371
371
|
link: dn,
|
372
372
|
active: mn
|
373
|
-
}, fn = ({ label: e, to: t, icon: n }) => /* @__PURE__ */
|
374
|
-
|
373
|
+
}, fn = ({ label: e, to: t, icon: n }) => /* @__PURE__ */ i(me, { placement: "right", tooltip: e, children: /* @__PURE__ */ i(
|
374
|
+
Xe,
|
375
375
|
{
|
376
|
-
className: R(
|
377
|
-
[
|
376
|
+
className: R(ze.link, {
|
377
|
+
[ze.active]: window.location.pathname.startsWith(t)
|
378
378
|
}),
|
379
379
|
href: t,
|
380
|
-
children: /* @__PURE__ */
|
380
|
+
children: /* @__PURE__ */ i(n, { size: "25px" })
|
381
381
|
}
|
382
|
-
) }), hn = "_dropdownButton_hwh0c_1", gn = "_dropdownButtonActive_hwh0c_18",
|
382
|
+
) }), hn = "_dropdownButton_hwh0c_1", gn = "_dropdownButtonActive_hwh0c_18", De = {
|
383
383
|
dropdownButton: hn,
|
384
384
|
dropdownButtonActive: gn
|
385
|
-
}, bn = ({ children: e, icon: t }) => /* @__PURE__ */
|
385
|
+
}, bn = ({ children: e, icon: t }) => /* @__PURE__ */ i(
|
386
386
|
fe,
|
387
387
|
{
|
388
|
-
menuButton: ({ opened: n }) => /* @__PURE__ */
|
388
|
+
menuButton: ({ opened: n }) => /* @__PURE__ */ i(me, { placement: "right", tooltip: "Help", children: /* @__PURE__ */ i(
|
389
389
|
"button",
|
390
390
|
{
|
391
391
|
type: "button",
|
392
|
-
className: R(
|
393
|
-
[
|
392
|
+
className: R(De.dropdownButton, {
|
393
|
+
[De.dropdownButtonActive]: n
|
394
394
|
}),
|
395
|
-
children: /* @__PURE__ */
|
395
|
+
children: /* @__PURE__ */ i(t, { size: "25px" })
|
396
396
|
}
|
397
397
|
) }),
|
398
|
-
children: /* @__PURE__ */
|
398
|
+
children: /* @__PURE__ */ i(he, { placement: "right-start", children: e })
|
399
399
|
}
|
400
400
|
), pn = "_iconContainer_nz34m_1", _n = {
|
401
401
|
iconContainer: pn
|
402
|
-
},
|
402
|
+
}, ut = ({ className: e = "" }) => /* @__PURE__ */ i(
|
403
403
|
"div",
|
404
404
|
{
|
405
405
|
"aria-label": "Upgrade Icon",
|
@@ -410,54 +410,54 @@ const on = "_sidebarContainer_bmdti_1", sn = {
|
|
410
410
|
"justify-center",
|
411
411
|
e
|
412
412
|
),
|
413
|
-
children: /* @__PURE__ */
|
413
|
+
children: /* @__PURE__ */ i(Ct, {})
|
414
414
|
}
|
415
|
-
), vn = "_menuContainer_wbu3u_5", Tn = "_profileButton_wbu3u_16", wn = "_profileImage_wbu3u_29", yn = "_profileImageHighlight_wbu3u_37", In = "_profileImageUpgradeIcon_wbu3u_41", Nn = "_userIconWrapper_wbu3u_47",
|
415
|
+
), vn = "_menuContainer_wbu3u_5", Tn = "_profileButton_wbu3u_16", wn = "_profileImage_wbu3u_29", yn = "_profileImageHighlight_wbu3u_37", In = "_profileImageUpgradeIcon_wbu3u_41", Nn = "_userIconWrapper_wbu3u_47", P = {
|
416
416
|
menuContainer: vn,
|
417
417
|
profileButton: Tn,
|
418
418
|
profileImage: wn,
|
419
419
|
profileImageHighlight: yn,
|
420
420
|
profileImageUpgradeIcon: In,
|
421
421
|
userIconWrapper: Nn
|
422
|
-
},
|
422
|
+
}, dt = St({}), U = () => kt(dt), kn = ({ children: e }) => {
|
423
423
|
const {
|
424
424
|
currentTeam: t,
|
425
425
|
otherTeams: n,
|
426
426
|
showUpgradeCta: r,
|
427
427
|
showBillingButton: a,
|
428
|
-
allowTeamCreation:
|
428
|
+
allowTeamCreation: o,
|
429
429
|
isLimitedView: c,
|
430
430
|
isProviderAlpha: u,
|
431
431
|
canAccessTeamSettings: d,
|
432
432
|
isEndOfTrialActive: l,
|
433
433
|
isTeamSuspended: m
|
434
434
|
} = U();
|
435
|
-
return /* @__PURE__ */
|
435
|
+
return /* @__PURE__ */ i(
|
436
436
|
fe,
|
437
437
|
{
|
438
|
-
menuButton: () => /* @__PURE__ */ _("button", { className:
|
439
|
-
t != null && t.logoUrl ? /* @__PURE__ */
|
438
|
+
menuButton: () => /* @__PURE__ */ _("button", { className: P.profileButton, "aria-label": "Profile menu", type: "button", children: [
|
439
|
+
t != null && t.logoUrl ? /* @__PURE__ */ i(
|
440
440
|
"img",
|
441
441
|
{
|
442
442
|
src: t.logoUrl,
|
443
|
-
className: R(
|
444
|
-
[
|
443
|
+
className: R(P.profileImage, {
|
444
|
+
[P.profileImageHighlight]: r
|
445
445
|
}),
|
446
446
|
alt: "Team Logo"
|
447
447
|
}
|
448
|
-
) : /* @__PURE__ */
|
448
|
+
) : /* @__PURE__ */ i(
|
449
449
|
"div",
|
450
450
|
{
|
451
|
-
className: R(
|
452
|
-
[
|
451
|
+
className: R(P.userIconWrapper, "flex-row", "align-center", "items-center", {
|
452
|
+
[P.profileImageHighlight]: r
|
453
453
|
}),
|
454
|
-
children: /* @__PURE__ */
|
454
|
+
children: /* @__PURE__ */ i(et, { size: "25px" })
|
455
455
|
}
|
456
456
|
),
|
457
|
-
r && /* @__PURE__ */
|
457
|
+
r && /* @__PURE__ */ i(ut, { className: P.profileImageUpgradeIcon })
|
458
458
|
] }),
|
459
|
-
children: /* @__PURE__ */
|
460
|
-
allowTeamCreation:
|
459
|
+
children: /* @__PURE__ */ i(he, { placement: "right-end", className: P.menuContainer, children: e({
|
460
|
+
allowTeamCreation: o,
|
461
461
|
otherTeams: n,
|
462
462
|
isLimitedView: c,
|
463
463
|
canAccessTeamSettings: d,
|
@@ -468,40 +468,40 @@ const on = "_sidebarContainer_bmdti_1", sn = {
|
|
468
468
|
}) })
|
469
469
|
}
|
470
470
|
);
|
471
|
-
},
|
471
|
+
}, mt = 0, Sn = 9999, En = [150, 151, 250, 251], Pn = [152, 153, 252, 253], Cn = [154, 155, 157, 158, 254, 255, 258, 354, 355, 358], Rn = [156, 159, 160, 256, 259, 260], ft = 9998, _e = (e) => e === mt, ht = (e) => e === Sn, Ur = (e) => En.includes(e), Mr = (e) => Pn.includes(e), Br = (e) => Cn.includes(e), $r = (e) => Rn.includes(e), zr = (e) => e > mt && e < ft, Dr = (e) => e === ft, jn = /\n/, Fe = (e, t, n) => e.split(t).flatMap((r, a) => a !== 0 ? [Et(n, { key: Math.random().toString(32).slice(0, 10) }), r] : r), An = (e, t, n) => typeof e == "string" ? Fe(e, t, n) : e.flatMap((r) => typeof r == "string" ? Fe(r, t, n) : r), Fr = (e) => An(e, jn, /* @__PURE__ */ i("br", {})), Ln = /(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi, On = (e) => e.match(Ln) ?? [], He = (e, t, n) => {
|
472
472
|
const r = e.split(t);
|
473
473
|
if (r.length === 1)
|
474
474
|
return e;
|
475
475
|
const a = [];
|
476
476
|
return r[0] !== "" && a.push(r[0]), r.shift(), r[r.length - 1] === "" && r.pop(), a.push(
|
477
|
-
/* @__PURE__ */
|
478
|
-
), a.push(r.join(t)), a.filter((
|
479
|
-
},
|
477
|
+
/* @__PURE__ */ i("a", { href: t, target: "_blank", rel: "noreferrer noopener", children: t }, t + n)
|
478
|
+
), a.push(r.join(t)), a.filter((o) => o !== "");
|
479
|
+
}, Ge = (e) => {
|
480
480
|
const t = On(e);
|
481
|
-
return t != null && t.length ? t.reduce((n, r, a) => typeof n == "string" ?
|
482
|
-
}, Hr = (e) => typeof e == "string" ?
|
481
|
+
return t != null && t.length ? t.reduce((n, r, a) => typeof n == "string" ? He(n, r, a) : n.flatMap((o) => typeof o == "string" ? He(o, r, a) : o), e) : e;
|
482
|
+
}, Hr = (e) => typeof e == "string" ? Ge(e) : e.flatMap((t) => typeof t == "string" ? Ge(t) : t, e), Gr = (e, t = "PP") => at(e, t), Wr = (e, t, n = "PP") => at(At(e, t), n), Kr = (e) => {
|
483
483
|
q(e, []);
|
484
484
|
}, xn = ({ children: e, config: t }) => {
|
485
485
|
const {
|
486
486
|
teams: n,
|
487
487
|
currentTeamId: r,
|
488
488
|
planId: a,
|
489
|
-
isLimitedView:
|
489
|
+
isLimitedView: o,
|
490
490
|
isTeamSuspended: c,
|
491
491
|
canAccessTeamSettings: u,
|
492
492
|
isEndOfTrialActive: d
|
493
|
-
} = t, l = n.find((h) => h.id === r), m = n.filter((h) => h.id !== r), b = (l == null ? void 0 : l.role) ?? "", T = ["biller", "owner"].includes(b), w = _e(a) ||
|
493
|
+
} = t, l = n.find((h) => h.id === r), m = n.filter((h) => h.id !== r), b = (l == null ? void 0 : l.role) ?? "", T = ["biller", "owner"].includes(b), w = _e(a) || ht(a), S = {
|
494
494
|
...t,
|
495
495
|
currentTeam: l,
|
496
496
|
otherTeams: m,
|
497
497
|
canChangeBilling: T,
|
498
498
|
isOnFreeOrTrialPlan: w,
|
499
|
-
showUpgradeCta: !
|
500
|
-
showBillingButton: !
|
501
|
-
allowTeamCreation: !
|
499
|
+
showUpgradeCta: !o && w && T && !c,
|
500
|
+
showBillingButton: !o && u && T,
|
501
|
+
allowTeamCreation: !o && !d
|
502
502
|
};
|
503
|
-
return /* @__PURE__ */
|
504
|
-
}, qn = ({ config: e, children: t }) => /* @__PURE__ */
|
503
|
+
return /* @__PURE__ */ i(dt.Provider, { value: S, children: e });
|
504
|
+
}, qn = ({ config: e, children: t }) => /* @__PURE__ */ i(xn, { config: e, children: /* @__PURE__ */ i(kn, { children: t }) }), Un = "_container_q5pot_1", Mn = "_profileEmail_q5pot_5", We = {
|
505
505
|
container: Un,
|
506
506
|
profileEmail: Mn
|
507
507
|
}, Bn = ({
|
@@ -510,22 +510,22 @@ const on = "_sidebarContainer_bmdti_1", sn = {
|
|
510
510
|
userEmail: n,
|
511
511
|
hideBottomDivider: r
|
512
512
|
}) => {
|
513
|
-
const { isEndOfTrialActive: a, isTeamSuspended:
|
514
|
-
return a ||
|
515
|
-
/* @__PURE__ */
|
516
|
-
|
513
|
+
const { isEndOfTrialActive: a, isTeamSuspended: o } = U();
|
514
|
+
return a || o ? null : /* @__PURE__ */ _(Ve, { children: [
|
515
|
+
/* @__PURE__ */ i(
|
516
|
+
H,
|
517
517
|
{
|
518
518
|
href: e,
|
519
519
|
onClick: () => {
|
520
520
|
t == null || t();
|
521
521
|
},
|
522
|
-
children: /* @__PURE__ */ _("div", { className: `flex-col ${
|
523
|
-
/* @__PURE__ */
|
524
|
-
/* @__PURE__ */
|
522
|
+
children: /* @__PURE__ */ _("div", { className: `flex-col ${We.container}`, children: [
|
523
|
+
/* @__PURE__ */ i("span", { children: "Profile Settings" }),
|
524
|
+
/* @__PURE__ */ i("span", { className: We.profileEmail, children: n })
|
525
525
|
] })
|
526
526
|
}
|
527
527
|
),
|
528
|
-
!r && /* @__PURE__ */
|
528
|
+
!r && /* @__PURE__ */ i(tt, {})
|
529
529
|
] });
|
530
530
|
}, $n = "_wrapper_15d85_1", zn = "_profileImage_15d85_14", Dn = "_teamName_15d85_22", Fn = "_planLabel_15d85_29", Hn = "_membership_15d85_38", Gn = "_defaultProfileImage_15d85_44", j = {
|
531
531
|
wrapper: $n,
|
@@ -534,24 +534,24 @@ const on = "_sidebarContainer_bmdti_1", sn = {
|
|
534
534
|
planLabel: Fn,
|
535
535
|
membership: Hn,
|
536
536
|
defaultProfileImage: Gn
|
537
|
-
},
|
538
|
-
const { currentTeam: r, planId: a } = U(),
|
539
|
-
if (!
|
537
|
+
}, gt = ({ team: e, onClick: t, hidePlanLabel: n }) => {
|
538
|
+
const { currentTeam: r, planId: a } = U(), o = e || r;
|
539
|
+
if (!o)
|
540
540
|
return null;
|
541
|
-
const c = _e(a) ? "Free" :
|
541
|
+
const c = _e(a) ? "Free" : ht(a) ? "Trial" : void 0;
|
542
542
|
return /* @__PURE__ */ _(
|
543
|
-
t ?
|
543
|
+
t ? H : "div",
|
544
544
|
{
|
545
545
|
className: `flex-row gap-2 flex-nowrap items-center ${j.wrapper}`,
|
546
|
-
...t && { onClick: () => t(
|
546
|
+
...t && { onClick: () => t(o) },
|
547
547
|
children: [
|
548
|
-
|
548
|
+
o.logoUrl ? /* @__PURE__ */ i("img", { className: j.profileImage, src: o.logoUrl, alt: "Team Logo" }) : /* @__PURE__ */ i("span", { className: `flex-row justify-center items-center ${j.defaultProfileImage}`, children: /* @__PURE__ */ i(et, { size: "25px" }) }),
|
549
549
|
/* @__PURE__ */ _("div", { className: "flex-col items-start", children: [
|
550
550
|
/* @__PURE__ */ _("div", { className: "flex-row items-center flex-nowrap gap-2", children: [
|
551
|
-
/* @__PURE__ */
|
552
|
-
c && !n && /* @__PURE__ */
|
551
|
+
/* @__PURE__ */ i("span", { title: o.name, className: j.teamName, children: o.name }),
|
552
|
+
c && !n && /* @__PURE__ */ i("span", { className: `flex-row justify-center items-center ${j.planLabel}`, children: c })
|
553
553
|
] }),
|
554
|
-
/* @__PURE__ */
|
554
|
+
/* @__PURE__ */ i("span", { className: j.membership, children: o.role })
|
555
555
|
] })
|
556
556
|
]
|
557
557
|
}
|
@@ -560,8 +560,8 @@ const on = "_sidebarContainer_bmdti_1", sn = {
|
|
560
560
|
teamsContainer: Wn
|
561
561
|
}, Jn = ({ onSwitchTeam: e }) => {
|
562
562
|
const { otherTeams: t } = U();
|
563
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
564
|
-
}, Qn = "_container_1u995_1", Vn = "_planCta_1u995_15", Yn = "_upgradeIconWrapper_1u995_19",
|
563
|
+
return t.length === 0 ? null : /* @__PURE__ */ i("div", { className: `flex-col items-stretch ${Kn.teamsContainer}`, children: t.map((n) => /* @__PURE__ */ i(gt, { team: n, onClick: e, hidePlanLabel: !0 }, n.id)) });
|
564
|
+
}, Qn = "_container_1u995_1", Vn = "_planCta_1u995_15", Yn = "_upgradeIconWrapper_1u995_19", ce = {
|
565
565
|
container: Qn,
|
566
566
|
planCta: Vn,
|
567
567
|
upgradeIconWrapper: Yn
|
@@ -570,52 +570,52 @@ const on = "_sidebarContainer_bmdti_1", sn = {
|
|
570
570
|
if (!r)
|
571
571
|
return null;
|
572
572
|
const c = _e(t) ? "Your team is currently on the Free plan" : `Free trial ends in ${n} ${n === 1 ? "day" : "days"}`;
|
573
|
-
return /* @__PURE__ */ _(
|
574
|
-
/* @__PURE__ */
|
575
|
-
/* @__PURE__ */ _("div", { className: `flex-row items-center gap-1 ${
|
576
|
-
/* @__PURE__ */
|
577
|
-
/* @__PURE__ */
|
573
|
+
return /* @__PURE__ */ _(H, { href: e, className: `flex-col gap-1 items-start ${ce.container}`, children: [
|
574
|
+
/* @__PURE__ */ i("span", { className: ce.planCta, children: c }),
|
575
|
+
/* @__PURE__ */ _("div", { className: `flex-row items-center gap-1 ${ce.upgradeIconWrapper}`, children: [
|
576
|
+
/* @__PURE__ */ i(ut, {}),
|
577
|
+
/* @__PURE__ */ i("span", { children: "See upgrade options" })
|
578
578
|
] })
|
579
579
|
] });
|
580
|
-
}, I = ({ children: e, ...t }) => /* @__PURE__ */
|
581
|
-
I.Top = ({ children: e }) => /* @__PURE__ */
|
582
|
-
I.Bottom = ({ children: e }) => /* @__PURE__ */
|
580
|
+
}, I = ({ children: e, ...t }) => /* @__PURE__ */ i("nav", { ...t, className: sn.sidebarContainer, children: e });
|
581
|
+
I.Top = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
|
582
|
+
I.Bottom = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
|
583
583
|
I.Avatar = un;
|
584
584
|
I.IconLink = fn;
|
585
585
|
I.Menu = bn;
|
586
586
|
I.ProfileMenu = qn;
|
587
587
|
I.TeamSwitch = Jn;
|
588
|
-
I.TeamMenuItem =
|
588
|
+
I.TeamMenuItem = gt;
|
589
589
|
I.UpgradeMenuItem = Zn;
|
590
590
|
I.ProfileSettingsMenuItem = Bn;
|
591
|
-
const Xn = "_breadcrumbsItem_1hm6a_1", er = "_breadcrumbs_1hm6a_1",
|
591
|
+
const Xn = "_breadcrumbsItem_1hm6a_1", er = "_breadcrumbs_1hm6a_1", Ke = {
|
592
592
|
breadcrumbsItem: Xn,
|
593
593
|
breadcrumbs: er
|
594
|
-
}, Jr = ({ items: e }) => /* @__PURE__ */
|
595
|
-
/* @__PURE__ */
|
596
|
-
n < e.length - 1 && /* @__PURE__ */
|
597
|
-
] }, `${t.link}-${t.name}`)) }), tr = ({ items: e }) => /* @__PURE__ */
|
598
|
-
!!n && t.some((r) => r.visible) && /* @__PURE__ */
|
599
|
-
t.filter(({ visible: r }) => r).map(({ link: r, label: a, onClick:
|
600
|
-
] }, t[0].label)) }), nr = "_badge_1pc1v_1", rr = "_tag_1pc1v_15", ar = "_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",
|
594
|
+
}, Jr = ({ items: e }) => /* @__PURE__ */ i("nav", { "aria-label": "breadcrumb", className: Ke.breadcrumbs, children: e.map((t, n) => /* @__PURE__ */ _(Ze, { children: [
|
595
|
+
/* @__PURE__ */ i(Xe, { className: Ke.breadcrumbsItem, href: t.link, rel: "noreferrer", children: t.name }),
|
596
|
+
n < e.length - 1 && /* @__PURE__ */ i("span", { children: " — " })
|
597
|
+
] }, `${t.link}-${t.name}`)) }), tr = ({ items: e }) => /* @__PURE__ */ i(Ve, { children: e.map((t, n) => /* @__PURE__ */ _(Ze, { children: [
|
598
|
+
!!n && t.some((r) => r.visible) && /* @__PURE__ */ i(tt, {}),
|
599
|
+
t.filter(({ visible: r }) => r).map(({ link: r, label: a, onClick: o }) => /* @__PURE__ */ i(H, { href: r || "#", "aria-label": a, onClick: o, children: a }, a))
|
600
|
+
] }, t[0].label)) }), nr = "_badge_1pc1v_1", rr = "_tag_1pc1v_15", ar = "_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21", ir = "_disabled_1pc1v_57", or = "_projectNavigationItem_1pc1v_61", sr = "_projectNavigationItemDisabled_1pc1v_67", C = {
|
601
601
|
badge: nr,
|
602
602
|
tag: rr,
|
603
603
|
withNavLinkStyle: ar,
|
604
|
-
disabled:
|
605
|
-
projectNavigationItem:
|
604
|
+
disabled: ir,
|
605
|
+
projectNavigationItem: or,
|
606
606
|
projectNavigationItemDisabled: sr
|
607
|
-
},
|
607
|
+
}, Je = ({ label: e, badge: t, novel: n }) => /* @__PURE__ */ _("div", { className: "flex gap-1", children: [
|
608
608
|
/* @__PURE__ */ _("div", { children: [
|
609
|
-
/* @__PURE__ */
|
610
|
-
!!t && /* @__PURE__ */
|
609
|
+
/* @__PURE__ */ i("span", { children: e }),
|
610
|
+
!!t && /* @__PURE__ */ i("div", { className: C.badge, "aria-label": `${t} items requiring attention`, children: t > 9 ? "9+" : t })
|
611
611
|
] }),
|
612
|
-
!!n && /* @__PURE__ */
|
613
|
-
] }),
|
614
|
-
({ label: e, href: t = "", disabled: n = !1, badge: r, onClick: a, novel:
|
612
|
+
!!n && /* @__PURE__ */ i(Rt, { className: C.tag, children: n })
|
613
|
+
] }), le = Pt(
|
614
|
+
({ label: e, href: t = "", disabled: n = !1, badge: r, onClick: a, novel: o }, c) => /* @__PURE__ */ i(me, { tooltip: "You do not have access to this function", show: n, children: /* @__PURE__ */ i(
|
615
615
|
"div",
|
616
616
|
{
|
617
617
|
className: n ? C.projectNavigationItemDisabled : C.projectNavigationItem,
|
618
|
-
children: a || n || !t ? /* @__PURE__ */
|
618
|
+
children: a || n || !t ? /* @__PURE__ */ i(
|
619
619
|
"button",
|
620
620
|
{
|
621
621
|
type: "button",
|
@@ -625,38 +625,38 @@ const Xn = "_breadcrumbsItem_1hm6a_1", er = "_breadcrumbs_1hm6a_1", We = {
|
|
625
625
|
}),
|
626
626
|
disabled: n,
|
627
627
|
onClick: a,
|
628
|
-
children: /* @__PURE__ */
|
628
|
+
children: /* @__PURE__ */ i(Je, { label: e, badge: r, novel: o })
|
629
629
|
}
|
630
|
-
) : /* @__PURE__ */
|
630
|
+
) : /* @__PURE__ */ i("a", { href: t, className: C.withNavLinkStyle, children: /* @__PURE__ */ i(Je, { label: e, badge: r, novel: o }) })
|
631
631
|
}
|
632
632
|
) })
|
633
633
|
);
|
634
|
-
|
635
|
-
const cr = (e) => (e == null ? void 0 : e.some((t) => t.some((n) => n.visible))) ?? !1, lr = (e) => e.visible && (!e.dropdown || cr(e.dropdown)), Qr = ({ navigation: e, activeItem: t }) => /* @__PURE__ */
|
636
|
-
var r, a,
|
637
|
-
return n.dropdown ? /* @__PURE__ */
|
634
|
+
le.displayName = "NavigationTabsItem";
|
635
|
+
const cr = (e) => (e == null ? void 0 : e.some((t) => t.some((n) => n.visible))) ?? !1, lr = (e) => e.visible && (!e.dropdown || cr(e.dropdown)), Qr = ({ navigation: e, activeItem: t }) => /* @__PURE__ */ i("nav", { "aria-label": "Project", children: /* @__PURE__ */ i("ul", { className: A.navigationTabList, "aria-orientation": "horizontal", children: e.filter(lr).map((n) => {
|
636
|
+
var r, a, o;
|
637
|
+
return n.dropdown ? /* @__PURE__ */ i(
|
638
638
|
"li",
|
639
639
|
{
|
640
640
|
className: A.navigationTab,
|
641
641
|
"data-testid": n.key,
|
642
642
|
"aria-selected": (r = n.isActive) == null ? void 0 : r.call(n, t),
|
643
|
-
children: /* @__PURE__ */
|
643
|
+
children: /* @__PURE__ */ i(
|
644
644
|
fe,
|
645
645
|
{
|
646
|
-
menuButton: ({ opened: c }) => /* @__PURE__ */
|
647
|
-
children: /* @__PURE__ */
|
646
|
+
menuButton: ({ opened: c }) => /* @__PURE__ */ i(le, { label: n.label, disabled: n.disabled, active: c }),
|
647
|
+
children: /* @__PURE__ */ i(he, { children: /* @__PURE__ */ i(tr, { items: n.dropdown }) })
|
648
648
|
}
|
649
649
|
)
|
650
650
|
},
|
651
651
|
n.key
|
652
|
-
) : /* @__PURE__ */
|
652
|
+
) : /* @__PURE__ */ i(
|
653
653
|
"li",
|
654
654
|
{
|
655
655
|
className: A.navigationTab,
|
656
656
|
"data-testid": n.key,
|
657
657
|
"aria-selected": (a = n.isActive) == null ? void 0 : a.call(n, t),
|
658
|
-
children: /* @__PURE__ */
|
659
|
-
|
658
|
+
children: /* @__PURE__ */ i(
|
659
|
+
le,
|
660
660
|
{
|
661
661
|
label: n.label,
|
662
662
|
href: n.link,
|
@@ -664,7 +664,7 @@ const cr = (e) => (e == null ? void 0 : e.some((t) => t.some((n) => n.visible)))
|
|
664
664
|
disabled: n.disabled,
|
665
665
|
badge: n.badge,
|
666
666
|
novel: n.novel,
|
667
|
-
active: (
|
667
|
+
active: (o = n.isActive) == null ? void 0 : o.call(n, t)
|
668
668
|
}
|
669
669
|
)
|
670
670
|
},
|
@@ -684,7 +684,7 @@ const cr = (e) => (e == null ? void 0 : e.some((t) => t.some((n) => n.visible)))
|
|
684
684
|
}),
|
685
685
|
requestBodySchema: s.undefined(),
|
686
686
|
successResponseBodySchema: ur
|
687
|
-
}),
|
687
|
+
}), bt = {
|
688
688
|
teamKey: (e) => ["getUserToken", e]
|
689
689
|
}, dr = (e, t, n) => be({
|
690
690
|
...n,
|
@@ -692,8 +692,8 @@ const cr = (e) => (e == null ? void 0 : e.some((t) => t.some((n) => n.visible)))
|
|
692
692
|
pathParams: { teamId: a },
|
693
693
|
headers: {}
|
694
694
|
}),
|
695
|
-
queryKey:
|
696
|
-
}),
|
695
|
+
queryKey: bt.teamKey(t)
|
696
|
+
}), pt = s.union([
|
697
697
|
s.literal("owner"),
|
698
698
|
s.literal("admin"),
|
699
699
|
s.literal("biller"),
|
@@ -702,7 +702,7 @@ const cr = (e) => (e == null ? void 0 : e.some((t) => t.some((n) => n.visible)))
|
|
702
702
|
userId: s.number(),
|
703
703
|
userUuid: s.string(),
|
704
704
|
teamId: s.number(),
|
705
|
-
userTeamRole:
|
705
|
+
userTeamRole: pt,
|
706
706
|
userEmail: s.string().email(),
|
707
707
|
userName: s.string(),
|
708
708
|
userCurrentTeamId: s.number(),
|
@@ -712,7 +712,7 @@ const cr = (e) => (e == null ? void 0 : e.some((t) => t.some((n) => n.visible)))
|
|
712
712
|
isFullyAuthenticated: s.boolean(),
|
713
713
|
exp: s.number()
|
714
714
|
});
|
715
|
-
function
|
715
|
+
function G(e) {
|
716
716
|
try {
|
717
717
|
const t = e.split(".")[1], n = atob(t);
|
718
718
|
return mr.parse(JSON.parse(n));
|
@@ -720,30 +720,30 @@ function W(e) {
|
|
720
720
|
return;
|
721
721
|
}
|
722
722
|
}
|
723
|
-
const
|
723
|
+
const F = class F extends CustomEvent {
|
724
724
|
constructor(t) {
|
725
|
-
super(
|
726
|
-
detail: { token: t, payload:
|
725
|
+
super(F.eventName, {
|
726
|
+
detail: { token: t, payload: G(t.accessToken) }
|
727
727
|
});
|
728
728
|
}
|
729
729
|
};
|
730
|
-
|
731
|
-
let L =
|
732
|
-
const Vr =
|
730
|
+
Ne(F, "eventName", "new-jwt-issued");
|
731
|
+
let L = F;
|
732
|
+
const Vr = bt;
|
733
733
|
function Yr(e, t) {
|
734
|
-
const n = dr(e, t), r =
|
734
|
+
const n = dr(e, t), r = Ye();
|
735
735
|
return q(() => {
|
736
736
|
n.data && n.data.accessToken !== r.current && (window.dispatchEvent(new L(n.data)), r.current = n.data.accessToken);
|
737
737
|
}, [n.data]), n;
|
738
738
|
}
|
739
|
-
function
|
740
|
-
const e =
|
739
|
+
function Te() {
|
740
|
+
const e = ue(document.cookie, "accessToken"), t = ue(document.cookie, "refreshToken");
|
741
741
|
return !e || !t ? Promise.resolve(void 0) : Promise.resolve({ accessToken: e, refreshToken: t });
|
742
742
|
}
|
743
743
|
function fr() {
|
744
|
-
return Promise.resolve(
|
744
|
+
return Promise.resolve(ue(document.cookie, "csrf_token"));
|
745
745
|
}
|
746
|
-
function
|
746
|
+
function ue(e, t) {
|
747
747
|
var n, r;
|
748
748
|
return (r = (n = e.split(";").find((a) => a.trim().startsWith(`${t}=`))) == null ? void 0 : n.trim()) == null ? void 0 : r.substring(t.length + 1);
|
749
749
|
}
|
@@ -754,7 +754,7 @@ function _t() {
|
|
754
754
|
const r = (a) => {
|
755
755
|
t(a.detail.payload), n = !0;
|
756
756
|
};
|
757
|
-
return
|
757
|
+
return Te().then((a) => a && G(a.accessToken)).then((a) => {
|
758
758
|
n || t(a);
|
759
759
|
}), window.addEventListener(L.eventName, r), () => {
|
760
760
|
window.removeEventListener(L.eventName, r);
|
@@ -767,11 +767,11 @@ const hr = s.object({
|
|
767
767
|
fullname: s.string(),
|
768
768
|
created_at: s.string(),
|
769
769
|
created_at_timestamp: s.number(),
|
770
|
-
role:
|
770
|
+
role: pt
|
771
771
|
}), gr = s.object({
|
772
772
|
team_id: s.number(),
|
773
773
|
team_user: hr
|
774
|
-
}), br =
|
774
|
+
}), br = rt({
|
775
775
|
description: "Get the details of a team user",
|
776
776
|
requestPathParamsSchema: s.object({ teamId: s.number(), userId: s.number() }),
|
777
777
|
pathResolver: ({ teamId: e, userId: t }) => `/teams/${e}/users/${t}`,
|
@@ -781,7 +781,7 @@ const hr = s.object({
|
|
781
781
|
}, pr = (e, t, n, r) => be({
|
782
782
|
...r,
|
783
783
|
queryKey: vt.teamUserKey(t, n),
|
784
|
-
queryFn: ({ queryKey: [a,
|
784
|
+
queryFn: ({ queryKey: [a, o, c] }) => nt(e, br, { pathParams: { teamId: o, userId: c } })
|
785
785
|
}), Zr = vt;
|
786
786
|
function Xr(e) {
|
787
787
|
const t = _t();
|
@@ -808,7 +808,7 @@ const _r = s.object({
|
|
808
808
|
}), Tr = s.object({
|
809
809
|
project_id: s.string(),
|
810
810
|
contributors: s.array(vr)
|
811
|
-
}), wr =
|
811
|
+
}), wr = rt({
|
812
812
|
description: "Get the details of a project contributor",
|
813
813
|
requestPathParamsSchema: s.object({ projectId: s.string(), contributorId: s.number() }),
|
814
814
|
pathResolver: ({ projectId: e, contributorId: t }) => `/projects/${e}/contributors/${t}`,
|
@@ -818,8 +818,8 @@ const _r = s.object({
|
|
818
818
|
}, yr = (e, t, n, r) => be({
|
819
819
|
...r,
|
820
820
|
queryKey: Tt.projectUserKey(n, t),
|
821
|
-
queryFn: ({ queryKey: [a,
|
822
|
-
pathParams: { projectId:
|
821
|
+
queryFn: ({ queryKey: [a, o, c] }) => nt(e, wr, {
|
822
|
+
pathParams: { projectId: o, contributorId: c }
|
823
823
|
})
|
824
824
|
}), ea = Tt;
|
825
825
|
function ta(e, t) {
|
@@ -828,15 +828,12 @@ function ta(e, t) {
|
|
828
828
|
enabled: n !== void 0
|
829
829
|
});
|
830
830
|
}
|
831
|
-
function na(
|
832
|
-
const
|
833
|
-
if (!
|
834
|
-
return Promise.resolve(void 0);
|
835
|
-
const n = F(t, "accessToken");
|
836
|
-
if (!n)
|
831
|
+
async function na() {
|
832
|
+
const e = await Te();
|
833
|
+
if (!e)
|
837
834
|
return Promise.resolve(void 0);
|
838
|
-
const
|
839
|
-
return
|
835
|
+
const t = G(e.accessToken);
|
836
|
+
return t ? { ...e, payload: t } : Promise.resolve(void 0);
|
840
837
|
}
|
841
838
|
function z(e) {
|
842
839
|
return { Authorization: `Bearer ${e}` };
|
@@ -844,20 +841,20 @@ function z(e) {
|
|
844
841
|
function Ir(e, t) {
|
845
842
|
return (n) => async (r, a) => {
|
846
843
|
var u;
|
847
|
-
const
|
848
|
-
if (
|
844
|
+
const o = await t.getCachedJwtToken();
|
845
|
+
if (o === void 0)
|
849
846
|
return n(r, a);
|
850
847
|
const c = await n(r, {
|
851
848
|
...a,
|
852
|
-
headers: { ...a.headers, ...z(
|
849
|
+
headers: { ...a.headers, ...z(o.accessToken) }
|
853
850
|
});
|
854
|
-
if (
|
855
|
-
const d =
|
851
|
+
if (o && (c.status === 401 || c.status === 403)) {
|
852
|
+
const d = G(o.accessToken);
|
856
853
|
if (!d)
|
857
854
|
return c;
|
858
855
|
const l = await ge(e, ve, {
|
859
856
|
pathParams: { teamId: d.teamId },
|
860
|
-
headers: z(
|
857
|
+
headers: z(o.refreshToken)
|
861
858
|
});
|
862
859
|
return await ((u = t.onNewJwtTokenIssued) == null ? void 0 : u.call(t, l)), n(r, {
|
863
860
|
...a,
|
@@ -895,18 +892,18 @@ function kr(e, t) {
|
|
895
892
|
const ra = {
|
896
893
|
wretch: {
|
897
894
|
lokaliseAuth(e = {}) {
|
898
|
-
return this.addon(Nr).lokaliseAuth(
|
895
|
+
return this.addon(Nr).lokaliseAuth(Qe(e));
|
899
896
|
},
|
900
897
|
promoteClassicSession(e) {
|
901
|
-
const t =
|
898
|
+
const t = Qe(e);
|
902
899
|
return this.middlewares([kr(this, t)]);
|
903
900
|
}
|
904
901
|
}
|
905
902
|
};
|
906
|
-
function
|
903
|
+
function Qe(e) {
|
907
904
|
return {
|
908
905
|
...e,
|
909
|
-
getCachedJwtToken: e.getCachedJwtToken ??
|
906
|
+
getCachedJwtToken: e.getCachedJwtToken ?? Te,
|
910
907
|
getCsrfToken: "getCsrfToken" in e ? e.getCsrfToken : fr,
|
911
908
|
onNewJwtTokenIssued: (t) => {
|
912
909
|
var n;
|
@@ -916,17 +913,17 @@ function Je(e) {
|
|
916
913
|
}
|
917
914
|
export {
|
918
915
|
Jr as Breadcrumbs,
|
919
|
-
|
916
|
+
ft as ENTERPRISE_OPENSOURCE_PLAN_ID,
|
920
917
|
Rn as ENTERPRISE_PLAN_IDS,
|
921
|
-
|
922
|
-
|
918
|
+
Pn as ESSENTIAL_PLAN_IDS,
|
919
|
+
mt as FREE_PLAN_ID,
|
923
920
|
ur as JWT_TOKEN_SCHEMA,
|
924
921
|
Nr as LokaliseAuthAddon,
|
925
922
|
ra as LokaliseAuthBrowserAddon,
|
926
923
|
D as NavigationPanel,
|
927
924
|
Qr as NavigationTabs,
|
928
925
|
Cn as PRO_PLAN_IDS,
|
929
|
-
|
926
|
+
En as START_PLAN_IDS,
|
930
927
|
I as Sidebar,
|
931
928
|
hr as TEAM_USER_SCHEMA,
|
932
929
|
Sn as TRIAL_PLAN_ID,
|
@@ -940,7 +937,7 @@ export {
|
|
940
937
|
br as getTeamUser,
|
941
938
|
vt as getTeamUsersQueryKey,
|
942
939
|
ve as getUserToken,
|
943
|
-
|
940
|
+
bt as getUserTokenKey,
|
944
941
|
Dr as isEnterpriseOpenSourcePlan,
|
945
942
|
$r as isEnterprisePlan,
|
946
943
|
Mr as isEssentialPlan,
|
@@ -948,9 +945,9 @@ export {
|
|
948
945
|
zr as isPaidPlan,
|
949
946
|
Br as isProPlan,
|
950
947
|
Ur as isStartPlan,
|
951
|
-
|
948
|
+
ht as isTrialPlan,
|
952
949
|
Hr as makeUrlClickable,
|
953
|
-
|
950
|
+
G as parseJwtTokenPayload,
|
954
951
|
wr as retrieveContributor,
|
955
952
|
Tt as retrieveContributorKeys,
|
956
953
|
ta as useAuthenticatedProjectContributor,
|
package/dist/types/src/features/auth/bff/services/getAuthenticatedSessionDetailFromRequest.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
export declare function getAuthenticatedSessionDetailFromRequest(
|
2
|
-
readonly token: string;
|
1
|
+
export declare function getAuthenticatedSessionDetailFromRequest(): Promise<{
|
3
2
|
readonly payload: {
|
4
3
|
isProviderAlpha: boolean;
|
5
4
|
planId: number;
|
@@ -14,4 +13,6 @@ export declare function getAuthenticatedSessionDetailFromRequest(request: Reques
|
|
14
13
|
isFullyAuthenticated: boolean;
|
15
14
|
exp: number;
|
16
15
|
};
|
17
|
-
|
16
|
+
readonly accessToken: string;
|
17
|
+
readonly refreshToken: string;
|
18
|
+
} | undefined>;
|