@lokalise/harmony 1.11.0 → 1.11.2

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 kt=Object.defineProperty;var Nt=(e,t,n)=>t in e?kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ie=(e,t,n)=>Nt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),_=require("react"),f=require("@lokalise/louis"),et=require("date-fns"),Ct=require("date-fns-tz"),r=require("zod"),x=require("@lokalise/frontend-http-client"),tt=require("@lokalise/universal-ts-utils/api-contracts/apiContracts"),O=require("@tanstack/react-query"),J=require("@lokalise/universal-ts-utils/node");function At(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const M=At(_);var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z,Pe;function ge(){if(Pe)return Z;Pe=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Z=e,Z}var X,xe;function Lt(){if(xe)return X;xe=1;var e=typeof G=="object"&&G&&G.Object===Object&&G;return X=e,X}var ee,Re;function rt(){if(Re)return ee;Re=1;var e=Lt(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ee=n,ee}var te,ke;function Ot(){if(ke)return te;ke=1;var e=rt(),t=function(){return e.Date.now()};return te=t,te}var ne,Ne;function qt(){if(Ne)return ne;Ne=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return ne=t,ne}var re,Ce;function Mt(){if(Ce)return re;Ce=1;var e=qt(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return re=n,re}var se,Ae;function st(){if(Ae)return se;Ae=1;var e=rt(),t=e.Symbol;return se=t,se}var ae,Le;function Ut(){if(Le)return ae;Le=1;var e=st(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(c){var l=n.call(c,a),d=c[a];try{c[a]=void 0;var u=!0}catch{}var m=s.call(c);return u&&(l?c[a]=d:delete c[a]),m}return ae=i,ae}var oe,Oe;function Bt(){if(Oe)return oe;Oe=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return oe=n,oe}var ie,qe;function Dt(){if(qe)return ie;qe=1;var e=st(),t=Ut(),n=Bt(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function c(l){return l==null?l===void 0?a:s:i&&i in Object(l)?t(l):n(l)}return ie=c,ie}var ce,Me;function Ht(){if(Me)return ce;Me=1;function e(t){return t!=null&&typeof t=="object"}return ce=e,ce}var ue,Ue;function $t(){if(Ue)return ue;Ue=1;var e=Dt(),t=Ht(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return ue=s,ue}var le,Be;function Gt(){if(Be)return le;Be=1;var e=Mt(),t=ge(),n=$t(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function d(u){if(typeof u=="number")return u;if(n(u))return s;if(t(u)){var m=typeof u.valueOf=="function"?u.valueOf():u;u=t(m)?m+"":m}if(typeof u!="string")return u===0?u:+u;u=e(u);var h=i.test(u);return h||c.test(u)?l(u.slice(2),h?2:8):a.test(u)?s:+u}return le=d,le}var de,De;function at(){if(De)return de;De=1;var e=ge(),t=Ot(),n=Gt(),s="Expected a function",a=Math.max,i=Math.min;function c(l,d,u){var m,h,z,E,g,y,S=0,w=!1,p=!1,I=!0;if(typeof l!="function")throw new TypeError(s);d=n(d)||0,e(u)&&(w=!!u.leading,p="maxWait"in u,z=p?a(n(u.maxWait)||0,d):z,I="trailing"in u?!!u.trailing:I);function v(b){var P=m,q=h;return m=h=void 0,S=b,E=l.apply(q,P),E}function T(b){return S=b,g=setTimeout($,d),w?v(b):E}function H(b){var P=b-y,q=b-S,Ee=d-P;return p?i(Ee,z-q):Ee}function Se(b){var P=b-y,q=b-S;return y===void 0||P>=d||P<0||p&&q>=z}function $(){var b=t();if(Se(b))return we(b);g=setTimeout($,H(b))}function we(b){return g=void 0,I&&m?v(b):(m=h=void 0,E)}function xt(){g!==void 0&&clearTimeout(g),S=0,m=y=h=g=void 0}function Rt(){return g===void 0?E:we(t())}function V(){var b=t(),P=Se(b);if(m=arguments,h=this,y=b,P){if(g===void 0)return T(y);if(p)return clearTimeout(g),g=setTimeout($,d),v(y)}return g===void 0&&(g=setTimeout($,d)),E}return V.cancel=xt,V.flush=Rt,V}return de=c,de}var Ft=at();const Qt=nt(Ft);var me,He;function Kt(){if(He)return me;He=1;var e=at(),t=ge(),n="Expected a function";function s(a,i,c){var l=!0,d=!0;if(typeof a!="function")throw new TypeError(n);return t(c)&&(l="leading"in c?!!c.leading:l,d="trailing"in c?!!c.trailing:d),e(a,i,{leading:l,maxWait:i,trailing:d})}return me=s,me}var Jt=Kt();const Wt=nt(Jt),Yt=(e,t,n,s)=>{switch(t){case"debounce":return Qt(e,n,s);case"throttle":return Wt(e,n,s);default:return e}},Vt=e=>{const t=M.useRef(e);return M.useEffect(()=>{t.current=e}),M.useMemo(()=>(...n)=>{var s;return(s=t.current)===null||s===void 0?void 0:s.call(t,...n)},[])},Zt=e=>{const[t,n]=M.useState((e==null?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:M.useMemo(()=>new Proxy(a=>{a!==t&&n(a)},{get(a,i){return i==="current"?t:a[i]},set(a,i,c){return i==="current"?n(c):a[i]=c,!0}}),[t]),refElement:t,setRefElement:n}},Xt=(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 en({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:s,handleWidth:a=!0,handleHeight:i=!0,targetRef:c,observerOptions:l,onResize:d}={}){const u=_.useRef(e),m=Vt(d),[h,z]=_.useState({width:void 0,height:void 0}),{refProxy:E,refElement:g}=Zt(c),{box:y}=l||{},S=_.useCallback(p=>{if(!a&&!i)return;if(u.current){u.current=!1;return}const I=(v,T)=>a&&v.width!==T.width||i&&v.height!==T.height;p.forEach(v=>{const T=Xt(v,y);z(H=>I(H,T)?(m==null||m({width:T.width,height:T.height,entry:v}),T):H)})},[a,i,u,y]),w=_.useCallback(Yt(S,t,n,s),[S,t,n,s]);return _.useEffect(()=>{let p;return g?(p=new window.ResizeObserver(w),p.observe(g,l)):(h.width||h.height)&&(m==null||m({width:null,height:null,entry:null}),z({width:void 0,height:void 0})),()=>{var I,v,T;(I=p==null?void 0:p.disconnect)===null||I===void 0||I.call(p),(T=(v=w).cancel)===null||T===void 0||T.call(v)}},[w,g]),Object.assign({ref:E},h)}function ot(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=ot(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function N(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=ot(e))&&(s&&(s+=" "),s+=t);return s}const tn="_headerContainer_1cubo_1",nn="_navigationTabList_1cubo_8",rn="_navigationTab_1cubo_8",sn="_headerContent_1cubo_34",an="_staticEnabled_1cubo_50",A={headerContainer:tn,navigationTabList:nn,navigationTab:rn,headerContent:sn,staticEnabled:an},on=77,U=({sticky:e,children:t})=>{const{ref:n,height:s}=en({refreshMode:"debounce",refreshRate:0}),[a,i]=_.useState(!1),c=()=>a?!e:!0;_.useEffect(()=>{const d=()=>{i(window.scrollY>0)};return window.addEventListener("scroll",d),()=>window.removeEventListener("scroll",d)},[]);const l=`${s||on}px`;return o.jsx("div",{style:{minHeight:l},children:o.jsx("div",{children:o.jsxs("div",{ref:n,className:N(A.headerContent,{[A.staticEnabled]:c()}),children:[o.jsx(U.Header,{}),o.jsx(U.Tabs,{}),t]})})})};U.Header=({children:e})=>o.jsx("div",{className:A.headerContainer,children:e});U.Tabs=({children:e})=>o.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const cn="_sidebarContainer_bmdti_1",un={sidebarContainer:cn},ln="_logoLink_1baxb_1",dn={logoLink:ln},mn=({src:e,href:t="/",ariaLabel:n="Home",alt:s="Lokalise"})=>o.jsx("a",{className:dn.logoLink,href:t,"aria-label":n,children:o.jsx("img",{src:e,alt:s})}),fn="_link_1weq1_1",bn="_active_1weq1_18",$e={link:fn,active:bn},_n=({label:e,to:t,icon:n})=>o.jsx(f.Tooltip,{placement:"right",tooltip:e,children:o.jsx(f.Link,{className:N($e.link,{[$e.active]:window.location.pathname.startsWith(t)}),href:t,children:o.jsx(n,{size:"25px"})})}),gn="_dropdownButton_hwh0c_1",hn="_dropdownButtonActive_hwh0c_18",Ge={dropdownButton:gn,dropdownButtonActive:hn},pn=({children:e,icon:t})=>o.jsx(f.Menu,{menuButton:({opened:n})=>o.jsx(f.Tooltip,{placement:"right",tooltip:"Help",children:o.jsx("button",{type:"button",className:N(Ge.dropdownButton,{[Ge.dropdownButtonActive]:n}),children:o.jsx(t,{size:"25px"})})}),children:o.jsx(f.MenuList,{placement:"right-start",children:e})}),Tn="_iconContainer_nz34m_1",vn={iconContainer:Tn},it=({className:e=""})=>o.jsx("div",{"aria-label":"Upgrade Icon",className:N(vn.iconContainer,"flex-row","items-center","justify-center",e),children:o.jsx(f.CaretUpIcon,{})}),yn="_menuContainer_wbu3u_5",jn="_profileButton_wbu3u_16",zn="_profileImage_wbu3u_29",Sn="_profileImageHighlight_wbu3u_37",wn="_profileImageUpgradeIcon_wbu3u_41",En="_userIconWrapper_wbu3u_47",R={menuContainer:yn,profileButton:jn,profileImage:zn,profileImageHighlight:Sn,profileImageUpgradeIcon:wn,userIconWrapper:En},ct=_.createContext({}),B=()=>_.useContext(ct),In=({children:e})=>{const{currentTeam:t,otherTeams:n,showUpgradeCta:s,showBillingButton:a,allowTeamCreation:i,isProviderAlpha:c,canAccessTeamSettings:l,isEndOfTrialActive:d,isTeamSuspended:u,isFullyAuthenticated:m}=B();return o.jsx(f.Menu,{menuButton:()=>o.jsxs("button",{className:R.profileButton,"aria-label":"Profile menu",type:"button",children:[t!=null&&t.logoUrl?o.jsx("img",{src:t.logoUrl,className:N(R.profileImage,{[R.profileImageHighlight]:s}),alt:"Team Logo"}):o.jsx("div",{className:N(R.userIconWrapper,"flex-row","align-center","items-center",{[R.profileImageHighlight]:s}),children:o.jsx(f.UserIcon,{size:"25px"})}),s&&o.jsx(it,{className:R.profileImageUpgradeIcon})]}),children:o.jsx(f.MenuList,{placement:"right-end",className:R.menuContainer,children:e({allowTeamCreation:i,otherTeams:n,canAccessTeamSettings:l,isEndOfTrialActive:d,isTeamSuspended:u,showBillingButton:a,isProviderAlpha:c,isFullyAuthenticated:m})})})},he=0,ut=9999,lt=[150,151,250,251],dt=[152,153,252,253],mt=[154,155,157,158,254,255,258,354,355,358],ft=[156,159,160,256,259,260],pe=9998,W=e=>e===he,Te=e=>e===ut,Pn=e=>lt.includes(e),xn=e=>dt.includes(e),Rn=e=>mt.includes(e),kn=e=>ft.includes(e),Nn=e=>e>he&&e<pe,Cn=e=>e===pe,An=/\n/,Fe=(e,t,n)=>e.split(t).flatMap((s,a)=>a!==0?[_.cloneElement(n,{key:Math.random().toString(32).slice(0,10)}),s]:s),Ln=(e,t,n)=>typeof e=="string"?Fe(e,t,n):e.flatMap(s=>typeof s=="string"?Fe(s,t,n):s),On=e=>Ln(e,An,o.jsx("br",{})),qn=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,Mn=e=>e.match(qn)??[],Qe=(e,t,n)=>{const s=e.split(t);if(s.length===1)return e;const a=[];return s[0]!==""&&a.push(s[0]),s.shift(),s[s.length-1]===""&&s.pop(),a.push(o.jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",children:t},t+n)),a.push(s.join(t)),a.filter(i=>i!=="")},Ke=e=>{const t=Mn(e);return t!=null&&t.length?t.reduce((n,s,a)=>typeof n=="string"?Qe(n,s,a):n.flatMap(i=>typeof i=="string"?Qe(i,s,a):i),e):e},Un=e=>typeof e=="string"?Ke(e):e.flatMap(t=>typeof t=="string"?Ke(t):t,e),Bn=(e,t="PP")=>et.format(e,t),Dn=(e,t,n="PP")=>et.format(Ct.toZonedTime(e,t),n),Hn=e=>{_.useEffect(e,[])},Je={biller:"biller",owner:"owner"},We=[Je.biller,Je.owner],$n=({children:e,config:t})=>{const{teams:n,currentTeamId:s,planId:a,isEndOfTrialActive:i,isFullyAuthenticated:c,userTeamRole:l}=t,d=n.find(w=>w.id===s),u=n.filter(w=>w.id!==s),m=We.includes(l),h=We.includes(l),z=W(a)||Te(a),S={...t,currentTeam:d,otherTeams:u,canChangeBilling:m,canAccessTeamSettings:h,isOnFreeOrTrialPlan:z,showUpgradeCta:c&&z&&m,showBillingButton:c&&h&&m,allowTeamCreation:c&&!i};return o.jsx(ct.Provider,{value:S,children:e})},Gn=({config:e,children:t})=>o.jsx($n,{config:e,children:o.jsx(In,{children:t})}),Fn="_container_q5pot_1",Qn="_profileEmail_q5pot_5",Ye={container:Fn,profileEmail:Qn},Kn=({href:e,onClick:t,userEmail:n,hideBottomDivider:s})=>{const{isEndOfTrialActive:a,isTeamSuspended:i}=B();return a||i?null:o.jsxs(o.Fragment,{children:[o.jsx(f.MenuItem,{href:e,onClick:()=>{t==null||t()},children:o.jsxs("div",{className:`flex-col ${Ye.container}`,children:[o.jsx("span",{children:"Profile Settings"}),o.jsx("span",{className:Ye.profileEmail,children:n})]})}),!s&&o.jsx(f.MenuDivider,{})]})},Jn="_wrapper_15d85_1",Wn="_profileImage_15d85_14",Yn="_teamName_15d85_22",Vn="_planLabel_15d85_29",Zn="_membership_15d85_38",Xn="_defaultProfileImage_15d85_44",C={wrapper:Jn,profileImage:Wn,teamName:Yn,planLabel:Vn,membership:Zn,defaultProfileImage:Xn},bt=({team:e,onClick:t,hidePlanLabel:n})=>{const{currentTeam:s,planId:a}=B(),i=e||s;if(!i)return null;const c=W(a)?"Free":Te(a)?"Trial":void 0,l=t?f.MenuItem:"div";return o.jsxs(l,{className:`flex-row gap-2 flex-nowrap items-center ${C.wrapper}`,...t&&{onClick:()=>t(i)},children:[i.logoUrl?o.jsx("img",{className:C.profileImage,src:i.logoUrl,alt:"Team Logo"}):o.jsx("span",{className:`flex-row justify-center items-center ${C.defaultProfileImage}`,children:o.jsx(f.UserIcon,{size:"25px"})}),o.jsxs("div",{className:"flex-col items-start",children:[o.jsxs("div",{className:"flex-row items-center flex-nowrap gap-2",children:[o.jsx("span",{title:i.name,className:C.teamName,children:i.name}),c&&!n&&o.jsx("span",{className:`flex-row justify-center items-center ${C.planLabel}`,children:c})]}),o.jsx("span",{className:C.membership,children:i.role})]})]})},er="_teamsContainer_1t68g_1",tr={teamsContainer:er},nr=({onSwitchTeam:e})=>{const{otherTeams:t}=B();return t.length===0?null:o.jsx("div",{className:`flex-col items-stretch ${tr.teamsContainer}`,children:t.map(n=>o.jsx(bt,{team:n,onClick:e,hidePlanLabel:!0},n.id))})},rr="_container_1u995_1",sr="_planCta_1u995_15",ar="_upgradeIconWrapper_1u995_19",fe={container:rr,planCta:sr,upgradeIconWrapper:ar},or=({upgradeOptionHref:e})=>{const{planId:t,trialDaysLeft:n,showUpgradeCta:s}=B();if(!s)return null;const c=W(t)?"Your team is currently on the Free plan":`Free trial ends in ${n} ${n===1?"day":"days"}`;return o.jsxs(f.MenuItem,{href:e,className:`flex-col gap-1 items-start ${fe.container}`,children:[o.jsx("span",{className:fe.planCta,children:c}),o.jsxs("div",{className:`flex-row items-center gap-1 ${fe.upgradeIconWrapper}`,children:[o.jsx(it,{}),o.jsx("span",{children:"See upgrade options"})]})]})},j=({children:e,...t})=>o.jsx("nav",{...t,className:un.sidebarContainer,children:e}),ir=({children:e})=>o.jsx("div",{children:e});j.Top=ir;const cr=({children:e})=>o.jsx("div",{children:e});j.Bottom=cr;j.Avatar=mn;j.IconLink=_n;j.Menu=pn;j.ProfileMenu=Gn;j.TeamSwitch=nr;j.TeamMenuItem=bt;j.UpgradeMenuItem=or;j.ProfileSettingsMenuItem=Kn;const ur="_breadcrumbsItem_1hm6a_1",lr="_breadcrumbs_1hm6a_1",Ve={breadcrumbsItem:ur,breadcrumbs:lr},dr=({items:e})=>o.jsx("nav",{"aria-label":"breadcrumb",className:Ve.breadcrumbs,children:e.map((t,n)=>o.jsxs(_.Fragment,{children:[o.jsx(f.Link,{className:Ve.breadcrumbsItem,href:t.link,rel:"noreferrer",children:t.name}),n<e.length-1&&o.jsx("span",{children:" — "})]},`${t.link}-${t.name}`))}),mr=({items:e})=>o.jsx(o.Fragment,{children:e.map((t,n)=>o.jsxs(_.Fragment,{children:[!!n&&t.some(s=>s.visible)&&o.jsx(f.MenuDivider,{}),t.filter(({visible:s})=>s).map(({link:s,label:a,onClick:i})=>o.jsx(f.MenuItem,{href:s||"#","aria-label":a,onClick:i,children:a},a))]},t[0].label))}),fr="_badge_1pc1v_1",br="_tag_1pc1v_15",_r="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",gr="_disabled_1pc1v_57",hr="_projectNavigationItem_1pc1v_61",pr="_projectNavigationItemDisabled_1pc1v_67",k={badge:fr,tag:br,withNavLinkStyle:_r,disabled:gr,projectNavigationItem:hr,projectNavigationItemDisabled:pr},Ze=({label:e,badge:t,novel:n})=>o.jsxs("div",{className:"flex gap-1",children:[o.jsxs("div",{children:[o.jsx("span",{children:e}),!!t&&o.jsx("div",{className:k.badge,"aria-label":`${t} items requiring attention`,children:t>9?"9+":t})]}),!!n&&o.jsx(f.Tag,{className:k.tag,children:n})]}),be=_.forwardRef(({label:e,href:t="",disabled:n=!1,badge:s,onClick:a,novel:i},c)=>o.jsx(f.Tooltip,{tooltip:"You do not have access to this function",show:n,children:o.jsx("div",{className:n?k.projectNavigationItemDisabled:k.projectNavigationItem,children:a||n||!t?o.jsx("button",{type:"button",ref:c,className:N(k.withNavLinkStyle,{[k.disabled]:n}),disabled:n,onClick:a,children:o.jsx(Ze,{label:e,badge:s,novel:i})}):o.jsx("a",{href:t,className:k.withNavLinkStyle,children:o.jsx(Ze,{label:e,badge:s,novel:i})})})}));be.displayName="NavigationTabsItem";const Tr=e=>(e==null?void 0:e.some(t=>t.some(n=>n.visible)))??!1,vr=e=>e.visible&&(!e.dropdown||Tr(e.dropdown)),yr=({navigation:e,activeItem:t})=>o.jsx("nav",{"aria-label":"Project",children:o.jsx("ul",{className:A.navigationTabList,"aria-orientation":"horizontal",children:e.filter(vr).map(n=>{var s,a,i;return n.dropdown?o.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(s=n.isActive)==null?void 0:s.call(n,t),children:o.jsx(f.Menu,{menuButton:({opened:c})=>o.jsx(be,{label:n.label,disabled:n.disabled,active:c}),children:o.jsx(f.MenuList,{children:o.jsx(mr,{items:n.dropdown})})})},n.key):o.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(a=n.isActive)==null?void 0:a.call(n,t),children:o.jsx(be,{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)})})}),jr=r.z.object({accessToken:r.z.string(),refreshToken:r.z.string()}),zr=r.z.union([r.z.object({Authorization:r.z.string().startsWith("Bearer ")}),r.z.object({"x-csrf-token":r.z.string()})]),Y=tt.buildPayloadRoute({description:"Takes a teamId and returns a JWT token access and refresh token for the user",method:"post",requestPathParamsSchema:r.z.object({teamId:r.z.number()}),pathResolver:e=>`/team/${e.teamId}/actions/get-user-token`,requestHeaderSchema:zr,requestBodySchema:r.z.undefined(),successResponseBodySchema:jr}),_t={teamKeyCsrf:(e,t)=>["getUserToken","x-csrf-token",t,e],teamKeyJwt:(e,t)=>["getUserToken","Authorization",`Bearer ${t}`,e]},gt=(e,t)=>O.useQuery({...t,queryFn:({queryKey:[n,s,a,i]})=>x.sendByPayloadRoute(e,Y,{pathParams:{teamId:i},headers:s==="x-csrf-token"?{"x-csrf-token":a}:{Authorization:a}})}),ht=r.z.union([r.z.literal("owner"),r.z.literal("admin"),r.z.literal("biller"),r.z.literal("member")]),Sr=r.z.object({userId:r.z.number(),userUuid:r.z.string(),teamId:r.z.number(),userTeamRole:ht,userEmail:r.z.string().email(),userName:r.z.string(),userCurrentTeamId:r.z.number(),planId:r.z.number(),planName:r.z.string(),isProviderAlpha:r.z.boolean(),isFullyAuthenticated:r.z.boolean(),exp:r.z.number()});function D(e){try{const t=e.split(".")[1],n=atob(t);return Sr.parse(JSON.parse(n))}catch{return}}const K=class K extends CustomEvent{constructor(t){super(K.eventName,{detail:{token:t,payload:D(t.accessToken)}})}};Ie(K,"eventName","new-jwt-issued");let L=K;function ve(){const e=_e(document.cookie,"accessToken"),t=_e(document.cookie,"refreshToken");if(!(!e||!t))return{accessToken:e,refreshToken:t}}function pt(){return _e(document.cookie,"csrf_token")}function _e(e,t){var n,s;return(s=(n=e.split(";").find(a=>a.trim().startsWith(`${t}=`)))==null?void 0:n.trim())==null?void 0:s.substring(t.length+1)}function wr(e,t){const n=pt(),s=gt(e,{queryKey:_t.teamKeyCsrf(t,n??""),enabled:n!==void 0}),a=_.useRef();return _.useEffect(()=>{s.data&&s.data.accessToken!==a.current&&(window.dispatchEvent(new L(s.data)),a.current=s.data.accessToken)},[s.data]),s}function ye(){const[e,t]=_.useState();return _.useEffect(()=>{const n=a=>{t(a.detail.payload)},s=ve();return t(s&&D(s.accessToken)),window.addEventListener(L.eventName,n),()=>{window.removeEventListener(L.eventName,n)}},[]),e}const Er=r.z.object({user_id:r.z.number(),email:r.z.string().email(),fullname:r.z.string(),created_at:r.z.string(),created_at_timestamp:r.z.number(),role:ht}),Ir=r.z.object({team_id:r.z.number(),team_user:Er}),Tt=J.buildGetRoute({description:"Get the details of a team user",requestPathParamsSchema:r.z.object({teamId:r.z.number(),userId:r.z.number()}),pathResolver:({teamId:e,userId:t})=>`/teams/${e}/users/${t}`,successResponseBodySchema:Ir}),vt={teamUserKey:(e,t)=>["GetTeamUsers",e,t]},yt=(e,t)=>O.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>x.sendByGetRoute(e,Tt,{pathParams:{teamId:s,userId:a}})});function Pr(e){const t=ye();return yt(e,{queryKey:vt.teamUserKey((t==null?void 0:t.teamId)??0,(t==null?void 0:t.userId)??0),enabled:(t==null?void 0:t.userId)!==void 0&&t.teamId!==void 0})}const xr=r.z.object({lang_id:r.z.number(),lang_iso:r.z.string(),lang_name:r.z.string(),is_writable:r.z.union([r.z.literal(0),r.z.literal(1)])}),Rr=r.z.object({user_id:r.z.number(),email:r.z.string().email(),fullname:r.z.string(),created_at:r.z.string(),created_at_timestamp:r.z.number(),admin_rights:r.z.array(r.z.string()),languages:r.z.array(xr),is_admin:r.z.boolean(),is_reviewer:r.z.boolean()}),kr=r.z.object({project_id:r.z.string(),contributors:r.z.array(Rr)}),jt=J.buildGetRoute({description:"Get the details of a project contributor",requestPathParamsSchema:r.z.object({projectId:r.z.string(),contributorId:r.z.number()}),pathResolver:({projectId:e,contributorId:t})=>`/projects/${e}/contributors/${t}`,successResponseBodySchema:kr}),zt={projectUserKey:(e,t)=>["RetrieveContributor",e,t]},St=(e,t)=>O.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>x.sendByGetRoute(e,jt,{pathParams:{projectId:s,contributorId:a}})});function Nr(e,t){const n=ye();return St(e,{queryKey:zt.projectUserKey(t,(n==null?void 0:n.userId)??0),enabled:n!==void 0})}function Cr(){const e=ve();if(!e)return;const t=D(e.accessToken);if(t)return{...e,payload:t}}function Ar(){return e=>(t,n)=>e(t,{...n,headers:{...n.headers,"x-lokalise-plugin":"true"},credentials:"omit"})}function F(e){return{Authorization:`Bearer ${e}`}}function Lr(e,t){return n=>async(s,a)=>{var l;const i=await t.getCachedJwtToken();if(i===void 0)return n(s,a);const c=await n(s,{...a,headers:{...a.headers,...F(i.accessToken)}});if(i&&(c.status===401||c.status===403)){const d=D(i.accessToken);if(!d)return c;const u=await x.sendByPayloadRoute(e,Y,{pathParams:{teamId:d.teamId},headers:F(i.refreshToken)});return await((l=t.onNewJwtTokenIssued)==null?void 0:l.call(t,u)),n(s,{...a,headers:{...a.headers,...F(u.accessToken)}})}return c}}const wt={wretch:{lokaliseAuth(e){return this.middlewares([Lr(this,e)])}}};function Or(e,t){return n=>async(s,a)=>{var d;if(await t.getCachedJwtToken()!==void 0)return n(s,a);const c=await t.getCsrfToken();if(c===void 0)return n(s,a);const l=await x.sendByPayloadRoute(e,Y,{pathParams:{teamId:await t.getTeamId()},headers:{"x-csrf-token":c}});return await((d=t.onNewJwtTokenIssued)==null?void 0:d.call(t,l)),n(s,{...a,headers:{...a.headers,...F(l.accessToken)}})}}const qr={wretch:{lokaliseAuth(e={}){return this.addon(wt).lokaliseAuth(Xe(e))},promoteClassicSession(e){const t=Xe(e);return this.middlewares([Or(this,t)])}}};function Xe(e){return{...e,getCachedJwtToken:e.getCachedJwtToken??(async()=>ve()),getCsrfToken:"getCsrfToken"in e?e.getCsrfToken:async()=>pt(),onNewJwtTokenIssued:t=>{var n;return window.dispatchEvent(new L(t)),((n=e.onNewJwtTokenIssued)==null?void 0:n.call(e,t))??Promise.resolve()}}}const Mr=r.z.object({lang_iso:r.z.string(),custom_iso:r.z.string().optional()}),Ur=r.z.object({language_id:r.z.number(),language_iso:r.z.string(),progress:r.z.number(),words_to_do:r.z.number()}),je=r.z.union([r.z.literal("localization_files"),r.z.literal("paged_documents"),r.z.literal("marketing")]),Br=r.z.object({per_platform_key_names:r.z.boolean(),reviewing:r.z.boolean(),auto_toggle_unverified:r.z.boolean(),offline_translation:r.z.boolean(),key_editing:r.z.boolean(),inline_machine_translations:r.z.boolean(),custom_translation_statuses:r.z.boolean(),custom_translation_statuses_allow_multiple:r.z.boolean(),segmentation:r.z.boolean(),contributor_preview_download_enabled:r.z.boolean()}),Dr=r.z.object({not_reviewed:r.z.number(),unverified:r.z.number(),spelling_grammar:r.z.number(),inconsistent_placeholders:r.z.number(),inconsistent_html:r.z.number(),different_number_of_urls:r.z.number(),different_urls:r.z.number(),leading_whitespace:r.z.number(),trailing_whitespace:r.z.number(),different_number_of_email_address:r.z.number(),different_email_address:r.z.number(),different_brackets:r.z.number(),different_numbers:r.z.number(),double_space:r.z.number(),special_placeholder:r.z.number(),unbalanced_brackets:r.z.number()}),Hr=r.z.object({progress_total:r.z.number(),keys_total:r.z.number(),team:r.z.number(),base_words:r.z.number(),qa_issues_total:r.z.number(),qa_issues:Dr,languages:r.z.array(Ur)}),Q=r.z.object({project_id:r.z.string(),uuid:r.z.string().uuid(),project_type:je,name:r.z.string(),description:r.z.string(),created_at:r.z.string(),created_at_timestamp:r.z.number(),created_by:r.z.number(),created_by_email:r.z.string(),team_id:r.z.number(),base_language_id:r.z.number(),base_language_iso:r.z.string(),settings:Br,statistics:Hr}),$r=r.z.object({name:r.z.string(),team_id:r.z.string(),base_lang_iso:r.z.string(),languages:r.z.array(Mr),project_type:je,is_segmentation_enabled:r.z.boolean()}),Gr=r.z.object({project_type:je.optional(),filter_team_id:r.z.number().optional(),filter_names:r.z.string().optional(),include_statistics:r.z.boolean().optional(),include_settings:r.z.boolean().optional(),limit:r.z.number().optional(),page:r.z.number().optional()}),Fr=r.z.array(r.z.union([Q.omit({statistics:!0,settings:!0}),Q.pick({settings:!0,statistics:!0}).partial()])),Qr=r.z.object({project_id:r.z.string()}),ze=()=>"/projects",Et=tt.buildPayloadRoute({description:"Create a new project",method:"post",pathResolver:ze,requestBodySchema:$r,successResponseBodySchema:Q}),It=J.buildGetRoute({description:"List all projects",pathResolver:ze,requestQuerySchema:Gr,successResponseBodySchema:Fr}),Pt=J.buildGetRoute({description:"Retrieve a project",pathResolver:ze,requestQuerySchema:Qr,successResponseBodySchema:Q});function Kr(e,t={}){return O.useMutation({...t,mutationFn:n=>x.sendByPayloadRoute(e,Et,{body:n})})}const Jr={paramsKey:e=>["listProjects",e]};function Wr(e,t){return O.useQuery({...t,queryFn:({queryKey:[n,s]})=>x.sendByGetRoute(e,It,{queryParams:s})})}const Yr={projectIdKey:e=>["retrieveProject",e]};function Vr(e,t){return O.useQuery({...t,queryFn:({queryKey:[n,s]})=>x.sendByGetRoute(e,Pt,{queryParams:{project_id:s}})})}exports.Breadcrumbs=dr;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=pe;exports.ENTERPRISE_PLAN_IDS=ft;exports.ESSENTIAL_PLAN_IDS=dt;exports.FREE_PLAN_ID=he;exports.LokaliseAuthAddon=wt;exports.LokaliseAuthBrowserAddon=qr;exports.NavigationPanel=U;exports.NavigationTabs=yr;exports.PRO_PLAN_IDS=mt;exports.START_PLAN_IDS=lt;exports.Sidebar=j;exports.TRIAL_PLAN_ID=ut;exports.convertNewLineToBreakTag=On;exports.createProject=Et;exports.formatDate=Bn;exports.formatDateTz=Dn;exports.getAuthenticatedSessionDetailFromRequest=Cr;exports.getTeamUser=Tt;exports.getTeamUsersQueryKey=vt;exports.getUserToken=Y;exports.getUserTokenKey=_t;exports.isEnterpriseOpenSourcePlan=Cn;exports.isEnterprisePlan=kn;exports.isEssentialPlan=xn;exports.isFreePlan=W;exports.isPaidPlan=Nn;exports.isProPlan=Rn;exports.isStartPlan=Pn;exports.isTrialPlan=Te;exports.listProjects=It;exports.listProjectsKey=Jr;exports.makeUrlClickable=Un;exports.parseJwtTokenPayload=D;exports.publicApiHeadersMiddleware=Ar;exports.retrieveContributor=jt;exports.retrieveContributorKeys=zt;exports.retrieveProject=Pt;exports.retrieveProjectQueryKey=Yr;exports.useAuthenticatedProjectContributor=Nr;exports.useAuthenticatedSessionPayload=ye;exports.useAuthenticatedUser=Pr;exports.useCreateProjectMutation=Kr;exports.useEffectOnce=Hn;exports.useGetPromotedClassicSessionJwtQuery=wr;exports.useGetTeamUsersQuery=yt;exports.useGetUserTokenQuery=gt;exports.useListProjectsQuery=Wr;exports.useRetrieveContributorQuery=St;exports.useRetrieveProjectQuery=Vr;
1
+ "use strict";var kt=Object.defineProperty;var Nt=(e,t,n)=>t in e?kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ie=(e,t,n)=>Nt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),_=require("react"),f=require("@lokalise/louis"),et=require("date-fns"),Ct=require("date-fns-tz"),r=require("zod"),x=require("@lokalise/frontend-http-client"),tt=require("@lokalise/universal-ts-utils/api-contracts/apiContracts"),O=require("@tanstack/react-query"),J=require("@lokalise/universal-ts-utils/node");function At(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const M=At(_);var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z,Pe;function ge(){if(Pe)return Z;Pe=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Z=e,Z}var X,xe;function Lt(){if(xe)return X;xe=1;var e=typeof G=="object"&&G&&G.Object===Object&&G;return X=e,X}var ee,Re;function rt(){if(Re)return ee;Re=1;var e=Lt(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ee=n,ee}var te,ke;function Ot(){if(ke)return te;ke=1;var e=rt(),t=function(){return e.Date.now()};return te=t,te}var ne,Ne;function qt(){if(Ne)return ne;Ne=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return ne=t,ne}var re,Ce;function Mt(){if(Ce)return re;Ce=1;var e=qt(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return re=n,re}var se,Ae;function st(){if(Ae)return se;Ae=1;var e=rt(),t=e.Symbol;return se=t,se}var ae,Le;function Ut(){if(Le)return ae;Le=1;var e=st(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(c){var l=n.call(c,a),d=c[a];try{c[a]=void 0;var u=!0}catch{}var m=s.call(c);return u&&(l?c[a]=d:delete c[a]),m}return ae=i,ae}var oe,Oe;function Bt(){if(Oe)return oe;Oe=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return oe=n,oe}var ie,qe;function Dt(){if(qe)return ie;qe=1;var e=st(),t=Ut(),n=Bt(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function c(l){return l==null?l===void 0?a:s:i&&i in Object(l)?t(l):n(l)}return ie=c,ie}var ce,Me;function Ht(){if(Me)return ce;Me=1;function e(t){return t!=null&&typeof t=="object"}return ce=e,ce}var ue,Ue;function $t(){if(Ue)return ue;Ue=1;var e=Dt(),t=Ht(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return ue=s,ue}var le,Be;function Gt(){if(Be)return le;Be=1;var e=Mt(),t=ge(),n=$t(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function d(u){if(typeof u=="number")return u;if(n(u))return s;if(t(u)){var m=typeof u.valueOf=="function"?u.valueOf():u;u=t(m)?m+"":m}if(typeof u!="string")return u===0?u:+u;u=e(u);var h=i.test(u);return h||c.test(u)?l(u.slice(2),h?2:8):a.test(u)?s:+u}return le=d,le}var de,De;function at(){if(De)return de;De=1;var e=ge(),t=Ot(),n=Gt(),s="Expected a function",a=Math.max,i=Math.min;function c(l,d,u){var m,h,z,E,g,y,S=0,w=!1,p=!1,I=!0;if(typeof l!="function")throw new TypeError(s);d=n(d)||0,e(u)&&(w=!!u.leading,p="maxWait"in u,z=p?a(n(u.maxWait)||0,d):z,I="trailing"in u?!!u.trailing:I);function v(b){var P=m,q=h;return m=h=void 0,S=b,E=l.apply(q,P),E}function T(b){return S=b,g=setTimeout($,d),w?v(b):E}function H(b){var P=b-y,q=b-S,Ee=d-P;return p?i(Ee,z-q):Ee}function Se(b){var P=b-y,q=b-S;return y===void 0||P>=d||P<0||p&&q>=z}function $(){var b=t();if(Se(b))return we(b);g=setTimeout($,H(b))}function we(b){return g=void 0,I&&m?v(b):(m=h=void 0,E)}function xt(){g!==void 0&&clearTimeout(g),S=0,m=y=h=g=void 0}function Rt(){return g===void 0?E:we(t())}function V(){var b=t(),P=Se(b);if(m=arguments,h=this,y=b,P){if(g===void 0)return T(y);if(p)return clearTimeout(g),g=setTimeout($,d),v(y)}return g===void 0&&(g=setTimeout($,d)),E}return V.cancel=xt,V.flush=Rt,V}return de=c,de}var Ft=at();const Qt=nt(Ft);var me,He;function Kt(){if(He)return me;He=1;var e=at(),t=ge(),n="Expected a function";function s(a,i,c){var l=!0,d=!0;if(typeof a!="function")throw new TypeError(n);return t(c)&&(l="leading"in c?!!c.leading:l,d="trailing"in c?!!c.trailing:d),e(a,i,{leading:l,maxWait:i,trailing:d})}return me=s,me}var Jt=Kt();const Wt=nt(Jt),Yt=(e,t,n,s)=>{switch(t){case"debounce":return Qt(e,n,s);case"throttle":return Wt(e,n,s);default:return e}},Vt=e=>{const t=M.useRef(e);return M.useEffect(()=>{t.current=e}),M.useMemo(()=>(...n)=>{var s;return(s=t.current)===null||s===void 0?void 0:s.call(t,...n)},[])},Zt=e=>{const[t,n]=M.useState((e==null?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:M.useMemo(()=>new Proxy(a=>{a!==t&&n(a)},{get(a,i){return i==="current"?t:a[i]},set(a,i,c){return i==="current"?n(c):a[i]=c,!0}}),[t]),refElement:t,setRefElement:n}},Xt=(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 en({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:s,handleWidth:a=!0,handleHeight:i=!0,targetRef:c,observerOptions:l,onResize:d}={}){const u=_.useRef(e),m=Vt(d),[h,z]=_.useState({width:void 0,height:void 0}),{refProxy:E,refElement:g}=Zt(c),{box:y}=l||{},S=_.useCallback(p=>{if(!a&&!i)return;if(u.current){u.current=!1;return}const I=(v,T)=>a&&v.width!==T.width||i&&v.height!==T.height;p.forEach(v=>{const T=Xt(v,y);z(H=>I(H,T)?(m==null||m({width:T.width,height:T.height,entry:v}),T):H)})},[a,i,u,y]),w=_.useCallback(Yt(S,t,n,s),[S,t,n,s]);return _.useEffect(()=>{let p;return g?(p=new window.ResizeObserver(w),p.observe(g,l)):(h.width||h.height)&&(m==null||m({width:null,height:null,entry:null}),z({width:void 0,height:void 0})),()=>{var I,v,T;(I=p==null?void 0:p.disconnect)===null||I===void 0||I.call(p),(T=(v=w).cancel)===null||T===void 0||T.call(v)}},[w,g]),Object.assign({ref:E},h)}function ot(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=ot(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function N(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=ot(e))&&(s&&(s+=" "),s+=t);return s}const tn="_headerContainer_1cubo_1",nn="_navigationTabList_1cubo_8",rn="_navigationTab_1cubo_8",sn="_headerContent_1cubo_34",an="_staticEnabled_1cubo_50",A={headerContainer:tn,navigationTabList:nn,navigationTab:rn,headerContent:sn,staticEnabled:an},on=77,U=({sticky:e,children:t})=>{const{ref:n,height:s}=en({refreshMode:"debounce",refreshRate:0}),[a,i]=_.useState(!1),c=()=>a?!e:!0;_.useEffect(()=>{const d=()=>{i(window.scrollY>0)};return window.addEventListener("scroll",d),()=>window.removeEventListener("scroll",d)},[]);const l=`${s||on}px`;return o.jsx("div",{style:{minHeight:l},children:o.jsx("div",{children:o.jsxs("div",{ref:n,className:N(A.headerContent,{[A.staticEnabled]:c()}),children:[o.jsx(U.Header,{}),o.jsx(U.Tabs,{}),t]})})})};U.Header=({children:e})=>o.jsx("div",{className:A.headerContainer,children:e});U.Tabs=({children:e})=>o.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const cn="_sidebarContainer_bmdti_1",un={sidebarContainer:cn},ln="_logoLink_1baxb_1",dn={logoLink:ln},mn=({src:e,href:t="/",ariaLabel:n="Home",alt:s="Lokalise"})=>o.jsx("a",{className:dn.logoLink,href:t,"aria-label":n,children:o.jsx("img",{src:e,alt:s})}),fn="_link_1weq1_1",bn="_active_1weq1_18",$e={link:fn,active:bn},_n=({label:e,to:t,icon:n})=>o.jsx(f.Tooltip,{placement:"right",tooltip:e,children:o.jsx(f.Link,{className:N($e.link,{[$e.active]:window.location.pathname.startsWith(t)}),href:t,children:o.jsx(n,{size:"25px"})})}),gn="_dropdownButton_hwh0c_1",hn="_dropdownButtonActive_hwh0c_18",Ge={dropdownButton:gn,dropdownButtonActive:hn},pn=({children:e,icon:t})=>o.jsx(f.Menu,{menuButton:({opened:n})=>o.jsx(f.Tooltip,{placement:"right",tooltip:"Help",children:o.jsx("button",{type:"button",className:N(Ge.dropdownButton,{[Ge.dropdownButtonActive]:n}),children:o.jsx(t,{size:"25px"})})}),children:o.jsx(f.MenuList,{placement:"right-start",children:e})}),Tn="_iconContainer_nz34m_1",vn={iconContainer:Tn},it=({className:e=""})=>o.jsx("div",{"aria-label":"Upgrade Icon",className:N(vn.iconContainer,"flex-row","items-center","justify-center",e),children:o.jsx(f.CaretUpIcon,{})}),yn="_menuContainer_wbu3u_5",jn="_profileButton_wbu3u_16",zn="_profileImage_wbu3u_29",Sn="_profileImageHighlight_wbu3u_37",wn="_profileImageUpgradeIcon_wbu3u_41",En="_userIconWrapper_wbu3u_47",R={menuContainer:yn,profileButton:jn,profileImage:zn,profileImageHighlight:Sn,profileImageUpgradeIcon:wn,userIconWrapper:En},ct=_.createContext({}),B=()=>_.useContext(ct),In=({children:e})=>{const{currentTeam:t,otherTeams:n,showUpgradeCta:s,showBillingButton:a,allowTeamCreation:i,isProviderAlpha:c,canAccessTeamSettings:l,isEndOfTrialActive:d,isTeamSuspended:u,isFullyAuthenticated:m}=B();return o.jsx(f.Menu,{menuButton:()=>o.jsxs("button",{className:R.profileButton,"aria-label":"Profile menu",type:"button",children:[t!=null&&t.logoUrl?o.jsx("img",{src:t.logoUrl,className:N(R.profileImage,{[R.profileImageHighlight]:s}),alt:"Team Logo"}):o.jsx("div",{className:N(R.userIconWrapper,"flex-row","align-center","items-center",{[R.profileImageHighlight]:s}),children:o.jsx(f.UserIcon,{size:"25px"})}),s&&o.jsx(it,{className:R.profileImageUpgradeIcon})]}),children:o.jsx(f.MenuList,{placement:"right-end",className:R.menuContainer,children:e({allowTeamCreation:i,otherTeams:n,canAccessTeamSettings:l,isEndOfTrialActive:d,isTeamSuspended:u,showBillingButton:a,isProviderAlpha:c,isFullyAuthenticated:m})})})},he=0,ut=9999,lt=[150,151,250,251],dt=[152,153,252,253],mt=[154,155,157,158,254,255,258,354,355,358],ft=[156,159,160,256,259,260],pe=9998,W=e=>e===he,Te=e=>e===ut,Pn=e=>lt.includes(e),xn=e=>dt.includes(e),Rn=e=>mt.includes(e),kn=e=>ft.includes(e),Nn=e=>e>he&&e<pe,Cn=e=>e===pe,An=/\n/,Fe=(e,t,n)=>e.split(t).flatMap((s,a)=>a!==0?[_.cloneElement(n,{key:Math.random().toString(32).slice(0,10)}),s]:s),Ln=(e,t,n)=>typeof e=="string"?Fe(e,t,n):e.flatMap(s=>typeof s=="string"?Fe(s,t,n):s),On=e=>Ln(e,An,o.jsx("br",{})),qn=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,Mn=e=>e.match(qn)??[],Qe=(e,t,n)=>{const s=e.split(t);if(s.length===1)return e;const a=[];return s[0]!==""&&a.push(s[0]),s.shift(),s[s.length-1]===""&&s.pop(),a.push(o.jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",children:t},t+n)),a.push(s.join(t)),a.filter(i=>i!=="")},Ke=e=>{const t=Mn(e);return t!=null&&t.length?t.reduce((n,s,a)=>typeof n=="string"?Qe(n,s,a):n.flatMap(i=>typeof i=="string"?Qe(i,s,a):i),e):e},Un=e=>typeof e=="string"?Ke(e):e.flatMap(t=>typeof t=="string"?Ke(t):t,e),Bn=(e,t="PP")=>et.format(e,t),Dn=(e,t,n="PP")=>et.format(Ct.toZonedTime(e,t),n),Hn=e=>{_.useEffect(e,[])},Je={biller:"biller",owner:"owner"},We=[Je.biller,Je.owner],$n=({children:e,config:t})=>{const{teams:n,currentTeamId:s,planId:a,isEndOfTrialActive:i,isFullyAuthenticated:c,userTeamRole:l}=t,d=n.find(w=>w.id===s),u=n.filter(w=>w.id!==s),m=We.includes(l),h=We.includes(l),z=W(a)||Te(a),S={...t,currentTeam:d,otherTeams:u,canChangeBilling:m,canAccessTeamSettings:h,isOnFreeOrTrialPlan:z,showUpgradeCta:c&&z&&m,showBillingButton:c&&h&&m,allowTeamCreation:c&&!i};return o.jsx(ct.Provider,{value:S,children:e})},Gn=({config:e,children:t})=>o.jsx($n,{config:e,children:o.jsx(In,{children:t})}),Fn="_container_q5pot_1",Qn="_profileEmail_q5pot_5",Ye={container:Fn,profileEmail:Qn},Kn=({href:e,onClick:t,userEmail:n,hideBottomDivider:s})=>{const{isEndOfTrialActive:a,isTeamSuspended:i}=B();return a||i?null:o.jsxs(o.Fragment,{children:[o.jsx(f.MenuItem,{href:e,onClick:()=>{t==null||t()},children:o.jsxs("div",{className:`flex-col ${Ye.container}`,children:[o.jsx("span",{children:"Profile Settings"}),o.jsx("span",{className:Ye.profileEmail,children:n})]})}),!s&&o.jsx(f.MenuDivider,{})]})},Jn="_wrapper_15d85_1",Wn="_profileImage_15d85_14",Yn="_teamName_15d85_22",Vn="_planLabel_15d85_29",Zn="_membership_15d85_38",Xn="_defaultProfileImage_15d85_44",C={wrapper:Jn,profileImage:Wn,teamName:Yn,planLabel:Vn,membership:Zn,defaultProfileImage:Xn},bt=({team:e,onClick:t,hidePlanLabel:n})=>{const{currentTeam:s,planId:a}=B(),i=e||s;if(!i)return null;const c=W(a)?"Free":Te(a)?"Trial":void 0,l=t?f.MenuItem:"div";return o.jsxs(l,{className:`flex-row gap-2 flex-nowrap items-center ${C.wrapper}`,...t&&{onClick:()=>t(i)},children:[i.logoUrl?o.jsx("img",{className:C.profileImage,src:i.logoUrl,alt:"Team Logo"}):o.jsx("span",{className:`flex-row justify-center items-center ${C.defaultProfileImage}`,children:o.jsx(f.UserIcon,{size:"25px"})}),o.jsxs("div",{className:"flex-col items-start",children:[o.jsxs("div",{className:"flex-row items-center flex-nowrap gap-2",children:[o.jsx("span",{title:i.name,className:C.teamName,children:i.name}),c&&!n&&o.jsx("span",{className:`flex-row justify-center items-center ${C.planLabel}`,children:c})]}),o.jsx("span",{className:C.membership,children:i.role})]})]})},er="_teamsContainer_1t68g_1",tr={teamsContainer:er},nr=({onSwitchTeam:e})=>{const{otherTeams:t}=B();return t.length===0?null:o.jsx("div",{className:`flex-col items-stretch ${tr.teamsContainer}`,children:t.map(n=>o.jsx(bt,{team:n,onClick:e,hidePlanLabel:!0},n.id))})},rr="_container_1u995_1",sr="_planCta_1u995_15",ar="_upgradeIconWrapper_1u995_19",fe={container:rr,planCta:sr,upgradeIconWrapper:ar},or=({upgradeOptionHref:e})=>{const{planId:t,trialDaysLeft:n,showUpgradeCta:s}=B();if(!s)return null;const c=W(t)?"Your team is currently on the Free plan":`Free trial ends in ${n} ${n===1?"day":"days"}`;return o.jsxs(f.MenuItem,{href:e,className:`flex-col gap-1 items-start ${fe.container}`,children:[o.jsx("span",{className:fe.planCta,children:c}),o.jsxs("div",{className:`flex-row items-center gap-1 ${fe.upgradeIconWrapper}`,children:[o.jsx(it,{}),o.jsx("span",{children:"See upgrade options"})]})]})},j=({children:e,...t})=>o.jsx("nav",{...t,className:un.sidebarContainer,children:e}),ir=({children:e})=>o.jsx("div",{children:e});j.Top=ir;const cr=({children:e})=>o.jsx("div",{children:e});j.Bottom=cr;j.Avatar=mn;j.IconLink=_n;j.Menu=pn;j.ProfileMenu=Gn;j.TeamSwitch=nr;j.TeamMenuItem=bt;j.UpgradeMenuItem=or;j.ProfileSettingsMenuItem=Kn;const ur="_breadcrumbsItem_1hm6a_1",lr="_breadcrumbs_1hm6a_1",Ve={breadcrumbsItem:ur,breadcrumbs:lr},dr=({items:e})=>o.jsx("nav",{"aria-label":"breadcrumb",className:Ve.breadcrumbs,children:e.map((t,n)=>o.jsxs(_.Fragment,{children:[o.jsx(f.Link,{className:Ve.breadcrumbsItem,href:t.link,rel:"noreferrer",children:t.name}),n<e.length-1&&o.jsx("span",{children:" — "})]},`${t.link}-${t.name}`))}),mr=({items:e})=>o.jsx(o.Fragment,{children:e.map((t,n)=>o.jsxs(_.Fragment,{children:[!!n&&t.some(s=>s.visible)&&o.jsx(f.MenuDivider,{}),t.filter(({visible:s})=>s).map(({link:s,label:a,onClick:i})=>o.jsx(f.MenuItem,{href:s||"#","aria-label":a,onClick:i,children:a},a))]},t[0].label))}),fr="_badge_1pc1v_1",br="_tag_1pc1v_15",_r="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",gr="_disabled_1pc1v_57",hr="_projectNavigationItem_1pc1v_61",pr="_projectNavigationItemDisabled_1pc1v_67",k={badge:fr,tag:br,withNavLinkStyle:_r,disabled:gr,projectNavigationItem:hr,projectNavigationItemDisabled:pr},Ze=({label:e,badge:t,novel:n})=>o.jsxs("div",{className:"flex gap-1",children:[o.jsxs("div",{children:[o.jsx("span",{children:e}),!!t&&o.jsx("div",{className:k.badge,"aria-label":`${t} items requiring attention`,children:t>9?"9+":t})]}),!!n&&o.jsx(f.Tag,{className:k.tag,children:n})]}),be=_.forwardRef(({label:e,href:t="",disabled:n=!1,badge:s,onClick:a,novel:i},c)=>o.jsx(f.Tooltip,{tooltip:"You do not have access to this function",show:n,children:o.jsx("div",{className:n?k.projectNavigationItemDisabled:k.projectNavigationItem,children:a||n||!t?o.jsx("button",{type:"button",ref:c,className:N(k.withNavLinkStyle,{[k.disabled]:n}),disabled:n,onClick:a,children:o.jsx(Ze,{label:e,badge:s,novel:i})}):o.jsx("a",{href:t,className:k.withNavLinkStyle,children:o.jsx(Ze,{label:e,badge:s,novel:i})})})}));be.displayName="NavigationTabsItem";const Tr=e=>(e==null?void 0:e.some(t=>t.some(n=>n.visible)))??!1,vr=e=>e.visible&&(!e.dropdown||Tr(e.dropdown)),yr=({navigation:e,activeItem:t})=>o.jsx("nav",{"aria-label":"Project",children:o.jsx("ul",{className:A.navigationTabList,"aria-orientation":"horizontal",children:e.filter(vr).map(n=>{var s,a,i;return n.dropdown?o.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(s=n.isActive)==null?void 0:s.call(n,t),children:o.jsx(f.Menu,{menuButton:({opened:c})=>o.jsx(be,{label:n.label,disabled:n.disabled,active:c}),children:o.jsx(f.MenuList,{children:o.jsx(mr,{items:n.dropdown})})})},n.key):o.jsx("li",{className:A.navigationTab,"data-testid":n.key,"aria-selected":(a=n.isActive)==null?void 0:a.call(n,t),children:o.jsx(be,{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)})})}),jr=r.z.object({accessToken:r.z.string(),refreshToken:r.z.string()}),zr=r.z.union([r.z.object({Authorization:r.z.string().startsWith("Bearer ")}),r.z.object({"x-csrf-token":r.z.string()})]),Y=tt.buildPayloadRoute({description:"Takes a teamId and returns a JWT token access and refresh token for the user",method:"post",requestPathParamsSchema:r.z.object({teamId:r.z.number()}),pathResolver:e=>`/team/${e.teamId}/actions/get-user-token`,requestHeaderSchema:zr,requestBodySchema:r.z.undefined(),successResponseBodySchema:jr}),_t={teamKeyCsrf:(e,t)=>["getUserToken","x-csrf-token",t,e],teamKeyJwt:(e,t)=>["getUserToken","Authorization",`Bearer ${t}`,e]},gt=(e,t)=>O.useQuery({...t,queryFn:({queryKey:[n,s,a,i]})=>x.sendByPayloadRoute(e,Y,{pathParams:{teamId:i},headers:s==="x-csrf-token"?{"x-csrf-token":a}:{Authorization:a}})}),ht=r.z.union([r.z.literal("owner"),r.z.literal("admin"),r.z.literal("biller"),r.z.literal("member")]),Sr=r.z.object({userId:r.z.number(),userUuid:r.z.string(),teamId:r.z.number(),userTeamRole:ht,userEmail:r.z.string().email(),userName:r.z.string(),userCurrentTeamId:r.z.number(),planId:r.z.number(),planName:r.z.string(),isProviderAlpha:r.z.boolean(),isFullyAuthenticated:r.z.boolean(),exp:r.z.number()});function D(e){try{const t=e.split(".")[1],n=atob(t);return Sr.parse(JSON.parse(n))}catch{return}}const K=class K extends CustomEvent{constructor(t){super(K.eventName,{detail:{token:t,payload:D(t.accessToken)}})}};Ie(K,"eventName","new-jwt-issued");let L=K;function ve(){const e=_e(document.cookie,"accessToken"),t=_e(document.cookie,"refreshToken");if(!(!e||!t))return{accessToken:e,refreshToken:t}}function pt(){return _e(document.cookie,"csrf_token")}function _e(e,t){var n,s;return(s=(n=e.split(";").find(a=>a.trim().startsWith(`${t}=`)))==null?void 0:n.trim())==null?void 0:s.substring(t.length+1)}function wr(e,t){const n=pt(),s=gt(e,{queryKey:_t.teamKeyCsrf(t,n??""),enabled:n!==void 0}),a=_.useRef();return _.useEffect(()=>{s.data&&s.data.accessToken!==a.current&&(window.dispatchEvent(new L(s.data)),a.current=s.data.accessToken)},[s.data]),s}function ye(){const[e,t]=_.useState();return _.useEffect(()=>{const n=a=>{t(a.detail.payload)},s=ve();return t(s&&D(s.accessToken)),window.addEventListener(L.eventName,n),()=>{window.removeEventListener(L.eventName,n)}},[]),e}const Er=r.z.object({user_id:r.z.number(),email:r.z.string().email(),fullname:r.z.string(),created_at:r.z.string(),created_at_timestamp:r.z.number(),role:ht}),Ir=r.z.object({team_id:r.z.number(),team_user:Er}),Tt=J.buildGetRoute({description:"Get the details of a team user",requestPathParamsSchema:r.z.object({teamId:r.z.number(),userId:r.z.number()}),pathResolver:({teamId:e,userId:t})=>`/teams/${e}/users/${t}`,successResponseBodySchema:Ir}),vt={teamUserKey:(e,t)=>["GetTeamUsers",e,t]},yt=(e,t)=>O.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>x.sendByGetRoute(e,Tt,{pathParams:{teamId:s,userId:a}})});function Pr(e){const t=ye();return yt(e,{queryKey:vt.teamUserKey((t==null?void 0:t.teamId)??0,(t==null?void 0:t.userId)??0),enabled:(t==null?void 0:t.userId)!==void 0&&t.teamId!==void 0})}const xr=r.z.object({lang_id:r.z.number(),lang_iso:r.z.string(),lang_name:r.z.string(),is_writable:r.z.union([r.z.literal(0),r.z.literal(1)])}),Rr=r.z.object({user_id:r.z.number(),email:r.z.string().email(),fullname:r.z.string(),created_at:r.z.string(),created_at_timestamp:r.z.number(),admin_rights:r.z.array(r.z.string()),languages:r.z.array(xr),is_admin:r.z.boolean(),is_reviewer:r.z.boolean()}),kr=r.z.object({project_id:r.z.string(),contributors:r.z.array(Rr)}),jt=J.buildGetRoute({description:"Get the details of a project contributor",requestPathParamsSchema:r.z.object({projectId:r.z.string(),contributorId:r.z.number()}),pathResolver:({projectId:e,contributorId:t})=>`/projects/${e}/contributors/${t}`,successResponseBodySchema:kr}),zt={projectUserKey:(e,t)=>["RetrieveContributor",e,t]},St=(e,t)=>O.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>x.sendByGetRoute(e,jt,{pathParams:{projectId:s,contributorId:a}})});function Nr(e,t){const n=ye();return St(e,{queryKey:zt.projectUserKey(t,(n==null?void 0:n.userId)??0),enabled:n!==void 0})}function Cr(){const e=ve();if(!e)return;const t=D(e.accessToken);if(t)return{...e,payload:t}}function Ar(){return e=>(t,n)=>e(t,{...n,headers:{...n.headers,"x-lokalise-plugin":"true"},credentials:"omit"})}function F(e){return{Authorization:`Bearer ${e}`}}function Lr(e,t){return n=>async(s,a)=>{var l;const i=await t.getCachedJwtToken();if(i===void 0)return n(s,a);const c=await n(s,{...a,headers:{...a.headers,...F(i.accessToken)}});if(i&&(c.status===401||c.status===403)){const d=D(i.accessToken);if(!d)return c;const u=await x.sendByPayloadRoute(e,Y,{pathParams:{teamId:d.teamId},headers:F(i.refreshToken)});return await((l=t.onNewJwtTokenIssued)==null?void 0:l.call(t,u)),n(s,{...a,headers:{...a.headers,...F(u.accessToken)}})}return c}}const wt={wretch:{lokaliseAuth(e){return this.middlewares([Lr(this,e)])}}};function Or(e,t){return n=>async(s,a)=>{var d;if(await t.getCachedJwtToken()!==void 0)return n(s,a);const c=await t.getCsrfToken();if(c===void 0)return n(s,a);const l=await x.sendByPayloadRoute(e,Y,{pathParams:{teamId:await t.getTeamId()},headers:{"x-csrf-token":c}});return await((d=t.onNewJwtTokenIssued)==null?void 0:d.call(t,l)),n(s,{...a,headers:{...a.headers,...F(l.accessToken)}})}}const qr={wretch:{lokaliseAuth(e={}){return this.addon(wt).lokaliseAuth(Xe(e))},promoteClassicSession(e){const t=Xe(e);return this.middlewares([Or(this,t)])}}};function Xe(e){return{...e,getCachedJwtToken:e.getCachedJwtToken??(async()=>ve()),getCsrfToken:"getCsrfToken"in e?e.getCsrfToken:async()=>pt(),onNewJwtTokenIssued:t=>{var n;return window.dispatchEvent(new L(t)),((n=e.onNewJwtTokenIssued)==null?void 0:n.call(e,t))??Promise.resolve()}}}const Mr=r.z.object({lang_iso:r.z.string(),custom_iso:r.z.string().optional()}),Ur=r.z.object({language_id:r.z.number(),language_iso:r.z.string(),progress:r.z.number(),words_to_do:r.z.number()}),je=r.z.union([r.z.literal("localization_files"),r.z.literal("paged_documents"),r.z.literal("marketing")]),Br=r.z.object({per_platform_key_names:r.z.boolean(),reviewing:r.z.boolean(),auto_toggle_unverified:r.z.boolean(),offline_translation:r.z.boolean(),key_editing:r.z.boolean(),inline_machine_translations:r.z.boolean(),custom_translation_statuses:r.z.boolean(),custom_translation_statuses_allow_multiple:r.z.boolean(),segmentation:r.z.boolean(),contributor_preview_download_enabled:r.z.boolean()}),Dr=r.z.object({not_reviewed:r.z.number(),unverified:r.z.number(),spelling_grammar:r.z.number(),inconsistent_placeholders:r.z.number(),inconsistent_html:r.z.number(),different_number_of_urls:r.z.number(),different_urls:r.z.number(),leading_whitespace:r.z.number(),trailing_whitespace:r.z.number(),different_number_of_email_address:r.z.number(),different_email_address:r.z.number(),different_brackets:r.z.number(),different_numbers:r.z.number(),double_space:r.z.number(),special_placeholder:r.z.number(),unbalanced_brackets:r.z.number()}),Hr=r.z.object({progress_total:r.z.number(),keys_total:r.z.number(),team:r.z.number(),base_words:r.z.number(),qa_issues_total:r.z.number(),qa_issues:Dr,languages:r.z.array(Ur)}),Q=r.z.object({project_id:r.z.string(),uuid:r.z.string().uuid(),project_type:je,name:r.z.string(),description:r.z.string(),created_at:r.z.string(),created_at_timestamp:r.z.number(),created_by:r.z.number(),created_by_email:r.z.string(),team_id:r.z.number(),base_language_id:r.z.number(),base_language_iso:r.z.string(),settings:Br,statistics:Hr}),$r=r.z.object({name:r.z.string(),team_id:r.z.string(),base_lang_iso:r.z.string(),languages:r.z.array(Mr),project_type:je,is_segmentation_enabled:r.z.boolean()}),Gr=r.z.object({project_type:je.optional(),filter_team_id:r.z.number().optional(),filter_names:r.z.string().optional(),include_statistics:r.z.boolean().optional(),include_settings:r.z.boolean().optional(),limit:r.z.number().optional(),page:r.z.number().optional()}),Fr=r.z.array(Q.omit({statistics:!0,settings:!0}).and(Q.pick({settings:!0,statistics:!0}).partial())),Qr=r.z.object({project_id:r.z.string()}),ze=()=>"/projects",Et=tt.buildPayloadRoute({description:"Create a new project",method:"post",pathResolver:ze,requestBodySchema:$r,successResponseBodySchema:Q}),It=J.buildGetRoute({description:"List all projects",pathResolver:ze,requestQuerySchema:Gr,successResponseBodySchema:Fr}),Pt=J.buildGetRoute({description:"Retrieve a project",pathResolver:ze,requestQuerySchema:Qr,successResponseBodySchema:Q});function Kr(e,t={}){return O.useMutation({...t,mutationFn:n=>x.sendByPayloadRoute(e,Et,{body:n})})}const Jr={paramsKey:e=>["listProjects",e]};function Wr(e,t){return O.useQuery({...t,queryFn:({queryKey:[n,s]})=>x.sendByGetRoute(e,It,{queryParams:s})})}const Yr={projectIdKey:e=>["retrieveProject",e]};function Vr(e,t){return O.useQuery({...t,queryFn:({queryKey:[n,s]})=>x.sendByGetRoute(e,Pt,{queryParams:{project_id:s}})})}exports.Breadcrumbs=dr;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=pe;exports.ENTERPRISE_PLAN_IDS=ft;exports.ESSENTIAL_PLAN_IDS=dt;exports.FREE_PLAN_ID=he;exports.LokaliseAuthAddon=wt;exports.LokaliseAuthBrowserAddon=qr;exports.NavigationPanel=U;exports.NavigationTabs=yr;exports.PRO_PLAN_IDS=mt;exports.START_PLAN_IDS=lt;exports.Sidebar=j;exports.TRIAL_PLAN_ID=ut;exports.convertNewLineToBreakTag=On;exports.createProject=Et;exports.formatDate=Bn;exports.formatDateTz=Dn;exports.getAuthenticatedSessionDetailFromRequest=Cr;exports.getTeamUser=Tt;exports.getTeamUsersQueryKey=vt;exports.getUserToken=Y;exports.getUserTokenKey=_t;exports.isEnterpriseOpenSourcePlan=Cn;exports.isEnterprisePlan=kn;exports.isEssentialPlan=xn;exports.isFreePlan=W;exports.isPaidPlan=Nn;exports.isProPlan=Rn;exports.isStartPlan=Pn;exports.isTrialPlan=Te;exports.listProjects=It;exports.listProjectsKey=Jr;exports.makeUrlClickable=Un;exports.parseJwtTokenPayload=D;exports.publicApiHeadersMiddleware=Ar;exports.retrieveContributor=jt;exports.retrieveContributorKeys=zt;exports.retrieveProject=Pt;exports.retrieveProjectQueryKey=Yr;exports.useAuthenticatedProjectContributor=Nr;exports.useAuthenticatedSessionPayload=ye;exports.useAuthenticatedUser=Pr;exports.useCreateProjectMutation=Kr;exports.useEffectOnce=Hn;exports.useGetPromotedClassicSessionJwtQuery=wr;exports.useGetTeamUsersQuery=yt;exports.useGetUserTokenQuery=gt;exports.useListProjectsQuery=Wr;exports.useRetrieveContributorQuery=St;exports.useRetrieveProjectQuery=Vr;
package/dist/harmony.mjs CHANGED
@@ -1000,10 +1000,9 @@ const qr = r.object({
1000
1000
  limit: r.number().optional(),
1001
1001
  page: r.number().optional()
1002
1002
  }), Dr = r.array(
1003
- r.union([
1004
- F.omit({ statistics: !0, settings: !0 }),
1003
+ F.omit({ statistics: !0, settings: !0 }).and(
1005
1004
  F.pick({ settings: !0, statistics: !0 }).partial()
1006
- ])
1005
+ )
1007
1006
  ), zr = r.object({
1008
1007
  project_id: r.string()
1009
1008
  }), Ee = () => "/projects", Fr = ut({
@@ -1,89 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { Sidebar } from './Sidebar';
3
- /**
4
- * ## Overview
5
- * Sidebar is a self-contained component using widgets.
6
- *
7
- * ## Available Widgets
8
- *
9
- * ### `Sidebar.Top`
10
- * Use to wrap up a top section of the Sidebar
11
- *
12
- * ### `Sidebar.Bottom`
13
- * Use to wrap up a bottom section of the Sidebar
14
- *
15
- * ### `Sidebar.Avatar`
16
- * Display company main avatar / logo in the top section
17
- * ```
18
- * src: string;
19
- * href?: string; ('/')
20
- * ariaLabel?: string; ('Home')
21
- * alt?: string; ('Lokalise')
22
- * ```
23
- *
24
- * ### `Sidebar.IconLink`
25
- * Display link with an icon. Mainly used in the top section
26
- * ```
27
- * to: string;
28
- * label: string;
29
- * icon: FC<SvgIconProps>
30
- * ```
31
- *
32
- * ### `Sidebar.Menu`
33
- * Use this widget for simple side menu. Currently utilised for `Help` section
34
- * ```
35
- * icon: FC<SvgIconProps>
36
- * children: ReactNode; (representing menu list)
37
- * ```
38
- *
39
- * ### `Sidebar.ProfileMenu`
40
- * Contextual component, requires initial configuration
41
- * ```
42
- * teams: SidebarTeam[];
43
- * currentTeamId: number;
44
- * planId: number;
45
- * isLimitedView: boolean;
46
- * isTeamSuspended: boolean;
47
- * canAccessTeamSettings: boolean;
48
- * isEndOfTrialActive: boolean;
49
- * trialDaysLeft: number;
50
- * isProviderAlpha: boolean;
51
- * ```
52
- * and works with internal widgets
53
- *
54
- * #### `Sidebar.TeamSwitch`
55
- * Uses available teams (other than current) and allows user to switch between them
56
- * ```
57
- * onSwitchTeam: (team: SidebarTeam) => void;
58
- * ```
59
- *
60
- * #### `Sidebar.TeamMenuItem`
61
- * Uses context of current team, and depending on ability to switch team or not,
62
- * it renders as a div or clickable MenuItem. If used with TeamSwitch, it triggers `onSwitchTeams`
63
- * callback, passing relevant team as an argument
64
- * ```
65
- * team?: SidebarTeam; (fallbacks to currentTeam from context if not passed)
66
- * onClick?: (team: SidebarTeam) => void;
67
- * hidePlanLabel?: boolean;
68
- * ```
69
- *
70
- * #### `Sidebar.ProfileSettingsMenuItem`
71
- * Menu item that comes with a small user's email and renders conditionally, only if team
72
- * is not suspended or is not at the end of a trial
73
- * ```
74
- * href: string;
75
- * userEmail: string;
76
- * onClick?: () => void; (additional onClick for any tracking events)
77
- * hideBottomDivider?: boolean;
78
- * ```
79
- *
80
- * #### `Sidebar.UpgradeMenuItem`
81
- * Menu item conditionally rendering only if `showUpgradeButton` is `true`. It renders correct
82
- * upgrade note depending on the current team plan and red arrow up to indicate an update option
83
- * ```
84
- * upgradeOptionHref: string;
85
- * ```
86
- */
87
3
  declare const meta: Meta<typeof Sidebar>;
88
4
  type Story = StoryObj<typeof Sidebar>;
89
5
  export declare const FullSidebar: Story;
@@ -1,11 +1,16 @@
1
1
  type AvatarProps = {
2
+ /** URL of the avatar/logo image */
2
3
  src: string;
4
+ /** Link destination when avatar is clicked. Defaults to '/' */
3
5
  href?: string;
6
+ /** Accessibility label for the avatar link. Defaults to 'Home' */
4
7
  ariaLabel?: string;
8
+ /** Alt text for the avatar image. Defaults to 'Lokalise' */
5
9
  alt?: string;
6
10
  };
7
11
  /**
8
- * Display company main avatar / logo in the top section
12
+ * Display company main avatar / logo in the top section of the Sidebar.
13
+ * Used as the main branding element and home navigation link.
9
14
  */
10
15
  export declare const Avatar: ({ src, href, ariaLabel, alt }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
11
16
  export {};
@@ -1,12 +1,22 @@
1
1
  import { SvgIconProps } from '@lokalise/louis';
2
2
  import { FC } from 'react';
3
3
  type IconLinkProps = {
4
+ /** URL destination for the link */
4
5
  to: string;
6
+ /** Text to display in the tooltip when hovering over the icon */
5
7
  label: string;
8
+ /** Icon component from @lokalise/louis to display */
6
9
  icon: FC<SvgIconProps>;
7
10
  };
8
11
  /**
9
- * Display link with an icon. Mainly used in the top section
12
+ * A navigation link component that displays an icon with a tooltip.
13
+ * When hovered, shows a tooltip with the label text.
14
+ * The link is highlighted when the current URL matches its destination.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <IconLink to="/projects" label="Projects" icon={FolderOpenIcon} />
19
+ * ```
10
20
  */
11
21
  export declare const IconLink: ({ label, to, icon: Icon }: IconLinkProps) => import("react/jsx-runtime").JSX.Element;
12
22
  export {};
@@ -1,10 +1,24 @@
1
1
  import { SvgIconProps } from '@lokalise/louis';
2
2
  import { FC, PropsWithChildren } from 'react';
3
3
  type MenuProps = PropsWithChildren<{
4
+ /** Icon component from @lokalise/louis to display in the menu button */
4
5
  icon: FC<SvgIconProps>;
5
6
  }>;
6
7
  /**
7
- * Use this widget for simple side menu. Currently utilised for `Help` section
8
+ * A dropdown menu component that displays an icon button which reveals a menu list when clicked.
9
+ * The menu is positioned to the right of the button and includes a tooltip.
10
+ *
11
+ * Used primarily for dropdown menus in the Sidebar, such as the Help menu.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <Menu icon={HelpCenterIcon}>
16
+ * <MenuItem href="/docs">Documentation</MenuItem>
17
+ * <MenuItem href="/tutorial">Tutorials</MenuItem>
18
+ * <MenuDivider />
19
+ * <MenuItem href="/blog">Blog</MenuItem>
20
+ * </Menu>
21
+ * ```
8
22
  */
9
23
  export declare const Menu: ({ children, icon: Icon }: MenuProps) => import("react/jsx-runtime").JSX.Element;
10
24
  export {};
@@ -1,12 +1,30 @@
1
1
  import { ProfileMenuContentProps } from './ProfileMenuContent';
2
2
  import { SidebarProfileMenuConfig } from './types';
3
3
  type ProfileMenuProps = {
4
+ /** Configuration object containing team and user settings */
4
5
  config: SidebarProfileMenuConfig;
6
+ /** Render function for the menu content */
5
7
  children: ProfileMenuContentProps['children'];
6
8
  };
7
9
  /**
8
- * Contextual component, requires initial configuration
9
- * and works with internal widgets
10
+ * A contextual menu component that provides team management functionality.
11
+ * It manages team switching, profile settings, billing options, and upgrade prompts.
12
+ *
13
+ * The component uses a render prop pattern to provide context values to its children,
14
+ * allowing flexible composition of menu items based on user permissions and team status.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <ProfileMenu config={profileMenuConfig}>
19
+ * {({ allowTeamCreation, showBillingButton }) => (
20
+ * <>
21
+ * <TeamSwitch onSwitchTeam={handleTeamSwitch} />
22
+ * {allowTeamCreation && <MenuItem>Create new team</MenuItem>}
23
+ * {showBillingButton && <MenuItem href="/billing">Billing</MenuItem>}
24
+ * </>
25
+ * )}
26
+ * </ProfileMenu>
27
+ * ```
10
28
  */
11
29
  export declare const ProfileMenu: ({ config, children }: ProfileMenuProps) => import("react/jsx-runtime").JSX.Element;
12
30
  export {};
@@ -1,12 +1,42 @@
1
1
  type ProfileSettingsMenuItemProps = {
2
+ /** URL to the profile settings page */
2
3
  href: string;
4
+ /** User's email address to display below "Profile Settings" */
3
5
  userEmail: string;
6
+ /** Optional callback function for tracking or additional actions */
4
7
  onClick?: () => void;
8
+ /** Whether to hide the divider that appears below this menu item */
5
9
  hideBottomDivider?: boolean;
6
10
  };
7
11
  /**
8
- * Menu item that comes with a small user's email and renders conditionally,
9
- * only if team is not suspended or is not at the end of a trial
12
+ * A menu item component that provides access to profile settings.
13
+ *
14
+ * Features:
15
+ * - Displays "Profile Settings" with the user's email address below
16
+ * - Conditionally renders based on team status
17
+ * - Includes an optional divider below the item
18
+ * - Will not render if:
19
+ * - Team is suspended
20
+ * - Team's trial period has ended
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <ProfileSettingsMenuItem
25
+ * href="/settings/profile"
26
+ * userEmail="user@example.com"
27
+ * onClick={() => trackSettingsClick()}
28
+ * />
29
+ *
30
+ * // Without bottom divider
31
+ * <ProfileSettingsMenuItem
32
+ * href="/settings/profile"
33
+ * userEmail="user@example.com"
34
+ * hideBottomDivider
35
+ * />
36
+ * ```
37
+ *
38
+ * @note This component must be used within a ProfileMenu component
39
+ * as it requires access to the ProfileMenu context for team status information.
10
40
  */
11
41
  export declare const ProfileSettingsMenuItem: ({ href, onClick, userEmail, hideBottomDivider, }: ProfileSettingsMenuItemProps) => import("react/jsx-runtime").JSX.Element | null;
12
42
  export {};
@@ -1,13 +1,36 @@
1
1
  import { SidebarTeam } from '../../../types';
2
2
  type TeamMenuItemProps = {
3
+ /** Team to display. If not provided, uses the current team from context */
3
4
  team?: SidebarTeam;
5
+ /** Callback for when the team item is clicked. If provided, renders as a clickable MenuItem */
4
6
  onClick?: (team: SidebarTeam) => void;
7
+ /** Whether to hide the plan label (Free/Trial). Useful when displaying multiple teams */
5
8
  hidePlanLabel?: boolean;
6
9
  };
7
10
  /**
8
- * Uses context of current team, and depending on ability to switch team or not,
9
- * it renders as a div or clickable MenuItem. If used with TeamSwitch, it triggers `onSwitchTeams`
10
- * callback, passing relevant team as an argument
11
+ * A component that displays team information in a menu item format.
12
+ * Renders team logo (or default user icon), team name, role, and plan label.
13
+ *
14
+ * The component can be used in two modes:
15
+ * 1. As a static display of the current team (when no onClick handler is provided)
16
+ * 2. As a clickable menu item for team switching (when onClick handler is provided)
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * // Static current team display
21
+ * <TeamMenuItem />
22
+ *
23
+ * // Clickable team item for switching
24
+ * <TeamMenuItem
25
+ * team={someTeam}
26
+ * onClick={(team) => handleTeamSwitch(team)}
27
+ * hidePlanLabel
28
+ * />
29
+ * ```
30
+ *
31
+ * @note This component must be used within a ProfileMenu component
32
+ * as it requires access to the ProfileMenu context for current team
33
+ * and plan information.
11
34
  */
12
35
  export declare const TeamMenuItem: ({ team, onClick, hidePlanLabel }: TeamMenuItemProps) => import("react/jsx-runtime").JSX.Element | null;
13
36
  export {};
@@ -1,9 +1,28 @@
1
1
  import { SidebarTeam } from '../../../types';
2
2
  type TeamSwitchProps = {
3
+ /** Callback function triggered when a user selects a different team */
3
4
  onSwitchTeam: (team: SidebarTeam) => void;
4
5
  };
5
6
  /**
6
- * Uses available teams (other than current) and allows user to switch between them
7
+ * A component that displays a list of available teams for switching.
8
+ * It automatically excludes the current team from the list and renders
9
+ * nothing if there are no other teams available.
10
+ *
11
+ * Uses the ProfileMenu context to access the list of other teams and
12
+ * renders each team as a TeamMenuItem with click functionality.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <TeamSwitch
17
+ * onSwitchTeam={(team) => {
18
+ * console.log(`Switching to team: ${team.name}`);
19
+ * // Handle team switch logic
20
+ * }}
21
+ * />
22
+ * ```
23
+ *
24
+ * @note This component must be used within a ProfileMenu component
25
+ * as it requires access to the ProfileMenu context.
7
26
  */
8
27
  export declare const TeamSwitch: ({ onSwitchTeam }: TeamSwitchProps) => import("react/jsx-runtime").JSX.Element | null;
9
28
  export {};
@@ -1,10 +1,26 @@
1
1
  type UpgradeMenuItemProps = {
2
+ /** URL to the upgrade page or pricing options */
2
3
  upgradeOptionHref: string;
3
4
  };
4
5
  /**
5
- * Menu item conditionally rendering only if `showUpgradeButton` is `true`.
6
- * It renders correct upgrade note depending on the current team plan
7
- * and red arrow up to indicate an update option.
6
+ * A menu item component that displays upgrade call-to-action information.
7
+ * Only renders when upgrade options should be shown (determined by context).
8
+ *
9
+ * The component displays different messages based on the team's current plan:
10
+ * - For free plans: "Your team is currently on the Free plan"
11
+ * - For trial plans: "Free trial ends in X days"
12
+ *
13
+ * Includes an upgrade icon and "See upgrade options" text, styled to draw attention
14
+ * to the upgrade opportunity.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <UpgradeMenuItem upgradeOptionHref="/pricing" />
19
+ * ```
20
+ *
21
+ * @note This component must be used within a ProfileMenu component
22
+ * as it requires access to the ProfileMenu context for plan information
23
+ * and visibility control.
8
24
  */
9
25
  export declare const UpgradeMenuItem: ({ upgradeOptionHref }: UpgradeMenuItemProps) => import("react/jsx-runtime").JSX.Element | null;
10
26
  export {};
@@ -1,5 +1,9 @@
1
1
  import { SidebarTeam, SidebarTeamRole } from '../../types';
2
2
  export type { SidebarTeam, SidebarTeamRole } from '../../types';
3
+ /**
4
+ * Configuration object for the Sidebar's ProfileMenu component.
5
+ * Contains data from various API endpoints and JWT token.
6
+ */
3
7
  export type SidebarProfileMenuConfig = {
4
8
  teams: SidebarTeam[];
5
9
  isTeamSuspended: boolean;
@@ -12,6 +16,9 @@ export type SidebarProfileMenuConfig = {
12
16
  userTeamRole: SidebarTeamRole;
13
17
  userEmail: string;
14
18
  };
19
+ /**
20
+ * Extended configuration including computed properties used within the ProfileMenu context.
21
+ */
15
22
  export type SidebarProfileMenuContextProps = SidebarProfileMenuConfig & {
16
23
  currentTeam?: SidebarTeam;
17
24
  otherTeams: SidebarTeam[];
@@ -34,7 +34,7 @@ export declare function useListProjectsQuery<T>(wretchClient: Wretch<T>, overrid
34
34
  created_by_email: string;
35
35
  base_language_id: number;
36
36
  base_language_iso: string;
37
- } | {
37
+ } & {
38
38
  settings?: {
39
39
  per_platform_key_names: boolean;
40
40
  reviewing: boolean;
@@ -335,7 +335,7 @@ export declare const createProject: import('@lokalise/universal-ts-utils/node').
335
335
  /**
336
336
  * Public API router definition for listing all projects
337
337
  */
338
- export declare const listProjects: import('@lokalise/universal-ts-utils/node').GetRouteDefinition<never, import('zod').ZodArray<import('zod').ZodUnion<[import('zod').ZodObject<Omit<{
338
+ export declare const listProjects: import('@lokalise/universal-ts-utils/node').GetRouteDefinition<never, import('zod').ZodArray<import('zod').ZodIntersection<import('zod').ZodObject<Omit<{
339
339
  project_id: import('zod').ZodString;
340
340
  uuid: import('zod').ZodString;
341
341
  project_type: import('zod').ZodUnion<[import('zod').ZodLiteral<"localization_files">, import('zod').ZodLiteral<"paged_documents">, import('zod').ZodLiteral<"marketing">]>;
@@ -801,7 +801,7 @@ export declare const listProjects: import('@lokalise/universal-ts-utils/node').G
801
801
  unbalanced_brackets: number;
802
802
  };
803
803
  } | undefined;
804
- }>]>, "many">, undefined, import('zod').ZodObject<{
804
+ }>>, "many">, undefined, import('zod').ZodObject<{
805
805
  project_type: import('zod').ZodOptional<import('zod').ZodUnion<[import('zod').ZodLiteral<"localization_files">, import('zod').ZodLiteral<"paged_documents">, import('zod').ZodLiteral<"marketing">]>>;
806
806
  filter_team_id: import('zod').ZodOptional<import('zod').ZodNumber>;
807
807
  filter_names: import('zod').ZodOptional<import('zod').ZodString>;
@@ -584,7 +584,7 @@ export declare const LIST_PROJECTS_REQUEST_QUERY_SCHEMA: z.ZodObject<{
584
584
  limit?: number | undefined;
585
585
  }>;
586
586
  export type ListProjectsRequestQuery = z.infer<typeof LIST_PROJECTS_REQUEST_QUERY_SCHEMA>;
587
- export declare const LIST_PROJECTS_SUCCESS_RESPONSE_BODY: z.ZodArray<z.ZodUnion<[z.ZodObject<Omit<{
587
+ export declare const LIST_PROJECTS_SUCCESS_RESPONSE_BODY: z.ZodArray<z.ZodIntersection<z.ZodObject<Omit<{
588
588
  project_id: z.ZodString;
589
589
  uuid: z.ZodString;
590
590
  project_type: z.ZodUnion<[z.ZodLiteral<"localization_files">, z.ZodLiteral<"paged_documents">, z.ZodLiteral<"marketing">]>;
@@ -1050,7 +1050,7 @@ export declare const LIST_PROJECTS_SUCCESS_RESPONSE_BODY: z.ZodArray<z.ZodUnion<
1050
1050
  unbalanced_brackets: number;
1051
1051
  };
1052
1052
  } | undefined;
1053
- }>]>, "many">;
1053
+ }>>, "many">;
1054
1054
  export type ListProjectsSuccessResponseBody = z.infer<typeof LIST_PROJECTS_SUCCESS_RESPONSE_BODY>;
1055
1055
  export declare const RETRIEVE_PROJECT_REQUEST_QUERY_SCHEMA: z.ZodObject<{
1056
1056
  project_id: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/harmony",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"