@lokalise/harmony 1.15.0-exp-removeaddon.1 → 1.15.1
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/README.md +2 -1
- package/dist/harmony.cjs +1 -1
- package/dist/harmony.mjs +37 -36
- package/dist/types/src/features/publicApi/node.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -24,7 +24,8 @@ const authHttpClient = wretch('path/to/auth/provider');
|
|
24
24
|
// This is the client that you would use to make requests to your app's API
|
25
25
|
// - It assumes that your API is compatible with the shared authentication strategy
|
26
26
|
export const appHttpClient = wretch('path/to/you/api')
|
27
|
-
|
27
|
+
// ... More config as you see fit ...
|
28
|
+
.errorType('json');
|
28
29
|
|
29
30
|
export const appAuthenticatedHttpClient = appHttpClient
|
30
31
|
.middlewares([
|
package/dist/harmony.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var Nt=Object.defineProperty;var At=(e,t,n)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ie=(e,t,n)=>At(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("react"),f=require("@lokalise/louis"),tt=require("date-fns"),kt=require("date-fns-tz"),E=require("@lokalise/frontend-http-client"),r=require("zod"),pe=require("@lokalise/universal-ts-utils/api-contracts/apiContracts"),C=require("@tanstack/react-query"),B=require("@lokalise/universal-ts-utils/node");function Lt(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=Lt(b);var F=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 ee,Re;function Te(){if(Re)return ee;Re=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return ee=e,ee}var te,Ce;function Ot(){if(Ce)return te;Ce=1;var e=typeof F=="object"&&F&&F.Object===Object&&F;return te=e,te}var ne,xe;function rt(){if(xe)return ne;xe=1;var e=Ot(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ne=n,ne}var re,Ne;function Mt(){if(Ne)return re;Ne=1;var e=rt(),t=function(){return e.Date.now()};return re=t,re}var se,Ae;function Ut(){if(Ae)return se;Ae=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return se=t,se}var ae,ke;function qt(){if(ke)return ae;ke=1;var e=Ut(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return ae=n,ae}var oe,Le;function st(){if(Le)return oe;Le=1;var e=rt(),t=e.Symbol;return oe=t,oe}var ie,Oe;function Bt(){if(Oe)return ie;Oe=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 ie=i,ie}var ce,Me;function Ht(){if(Me)return ce;Me=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return ce=n,ce}var ue,Ue;function Dt(){if(Ue)return ue;Ue=1;var e=st(),t=Bt(),n=Ht(),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 ue=c,ue}var le,qe;function Gt(){if(qe)return le;qe=1;function e(t){return t!=null&&typeof t=="object"}return le=e,le}var de,Be;function $t(){if(Be)return de;Be=1;var e=Dt(),t=Gt(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return de=s,de}var me,He;function Ft(){if(He)return me;He=1;var e=qt(),t=Te(),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 me=d,me}var fe,De;function at(){if(De)return fe;De=1;var e=Te(),t=Mt(),n=Ft(),s="Expected a function",a=Math.max,i=Math.min;function c(l,d,u){var m,h,z,w,g,y,S=0,P=!1,p=!1,I=!0;if(typeof l!="function")throw new TypeError(s);d=n(d)||0,e(u)&&(P=!!u.leading,p="maxWait"in u,z=p?a(n(u.maxWait)||0,d):z,I="trailing"in u?!!u.trailing:I);function j(_){var R=m,O=h;return m=h=void 0,S=_,w=l.apply(O,R),w}function T(_){return S=_,g=setTimeout($,d),P?j(_):w}function G(_){var R=_-y,O=_-S,we=d-R;return p?i(we,z-O):we}function Pe(_){var R=_-y,O=_-S;return y===void 0||R>=d||R<0||p&&O>=z}function $(){var _=t();if(Pe(_))return Ee(_);g=setTimeout($,G(_))}function Ee(_){return g=void 0,I&&m?j(_):(m=h=void 0,w)}function Ct(){g!==void 0&&clearTimeout(g),S=0,m=y=h=g=void 0}function xt(){return g===void 0?w:Ee(t())}function X(){var _=t(),R=Pe(_);if(m=arguments,h=this,y=_,R){if(g===void 0)return T(y);if(p)return clearTimeout(g),g=setTimeout($,d),j(y)}return g===void 0&&(g=setTimeout($,d)),w}return X.cancel=Ct,X.flush=xt,X}return fe=c,fe}var Jt=at();const Kt=nt(Jt);var _e,Ge;function Qt(){if(Ge)return _e;Ge=1;var e=at(),t=Te(),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 _e=s,_e}var Wt=Qt();const Yt=nt(Wt),Vt=(e,t,n,s)=>{switch(t){case"debounce":return Kt(e,n,s);case"throttle":return Yt(e,n,s);default:return e}},Zt=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)},[])},Xt=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}},en=(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 tn({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:s,handleWidth:a=!0,handleHeight:i=!0,targetRef:c,observerOptions:l,onResize:d}={}){const u=b.useRef(e),m=Zt(d),[h,z]=b.useState({width:void 0,height:void 0}),{refProxy:w,refElement:g}=Xt(c),{box:y}=l||{},S=b.useCallback(p=>{if(!a&&!i)return;if(u.current){u.current=!1;return}const I=(j,T)=>a&&j.width!==T.width||i&&j.height!==T.height;p.forEach(j=>{const T=en(j,y);z(G=>I(G,T)?(m==null||m({width:T.width,height:T.height,entry:j}),T):G)})},[a,i,u,y]),P=b.useCallback(Vt(S,t,n,s),[S,t,n,s]);return b.useEffect(()=>{let p;return g?(p=new window.ResizeObserver(P),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,j,T;(I=p==null?void 0:p.disconnect)===null||I===void 0||I.call(p),(T=(j=P).cancel)===null||T===void 0||T.call(j)}},[P,g]),Object.assign({ref:w},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 A(){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 nn="_headerContainer_1cubo_1",rn="_navigationTabList_1cubo_8",sn="_navigationTab_1cubo_8",an="_headerContent_1cubo_34",on="_staticEnabled_1cubo_50",L={headerContainer:nn,navigationTabList:rn,navigationTab:sn,headerContent:an,staticEnabled:on},cn=77,U=({sticky:e,children:t})=>{const{ref:n,height:s}=tn({refreshMode:"debounce",refreshRate:0}),[a,i]=b.useState(!1),c=()=>a?!e:!0;b.useEffect(()=>{const d=()=>{i(window.scrollY>0)};return window.addEventListener("scroll",d),()=>window.removeEventListener("scroll",d)},[]);const l=`${s||cn}px`;return o.jsx("div",{style:{minHeight:l},children:o.jsx("div",{children:o.jsxs("div",{ref:n,className:A(L.headerContent,{[L.staticEnabled]:c()}),children:[o.jsx(U.Header,{}),o.jsx(U.Tabs,{}),t]})})})};U.Header=({children:e})=>o.jsx("div",{className:L.headerContainer,children:e});U.Tabs=({children:e})=>o.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const un="_sidebarContainer_bmdti_1",ln={sidebarContainer:un},dn="_logoLink_1baxb_1",mn={logoLink:dn},fn=({src:e,href:t="/",ariaLabel:n="Home",alt:s="Lokalise"})=>o.jsx("a",{className:mn.logoLink,href:t,"aria-label":n,children:o.jsx("img",{src:e,alt:s})}),_n="_link_18vhx_1",bn="_active_18vhx_18",$e={link:_n,active:bn},gn=({label:e,to:t,icon:n})=>o.jsx(f.Tooltip,{placement:"right",tooltip:e,children:o.jsx(f.Link,{className:A($e.link,{[$e.active]:window.location.pathname.startsWith(t)}),href:t,children:o.jsx(n,{size:"25px"})})}),hn="_dropdownButton_13l5r_1",pn="_dropdownButtonActive_13l5r_18",Fe={dropdownButton:hn,dropdownButtonActive:pn},Tn=({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:A(Fe.dropdownButton,{[Fe.dropdownButtonActive]:n}),children:o.jsx(t,{size:"25px"})})}),children:o.jsx(f.MenuList,{placement:"right-start",children:e})}),jn="_iconContainer_nz34m_1",yn={iconContainer:jn},it=({className:e=""})=>o.jsx("div",{"aria-label":"Upgrade Icon",className:A(yn.iconContainer,"flex-row","items-center","justify-center",e),children:o.jsx(f.CaretUpIcon,{})}),vn="_menuContainer_wbu3u_5",zn="_profileButton_wbu3u_16",Sn="_profileImage_wbu3u_29",Pn="_profileImageHighlight_wbu3u_37",En="_profileImageUpgradeIcon_wbu3u_41",wn="_userIconWrapper_wbu3u_47",x={menuContainer:vn,profileButton:zn,profileImage:Sn,profileImageHighlight:Pn,profileImageUpgradeIcon:En,userIconWrapper:wn},ct=b.createContext({}),H=()=>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}=H();return o.jsx(f.Menu,{menuButton:()=>o.jsxs("button",{className:x.profileButton,"aria-label":"Profile menu",type:"button",children:[t!=null&&t.logoUrl?o.jsx("img",{src:t.logoUrl,className:A(x.profileImage,{[x.profileImageHighlight]:s}),alt:"Team Logo"}):o.jsx("div",{className:A(x.userIconWrapper,"flex-row","align-center","items-center",{[x.profileImageHighlight]:s}),children:o.jsx(f.UserIcon,{size:"25px"})}),s&&o.jsx(it,{className:x.profileImageUpgradeIcon})]}),children:o.jsx(f.MenuList,{placement:"right-end",className:x.menuContainer,children:e({allowTeamCreation:i,otherTeams:n,canAccessTeamSettings:l,isEndOfTrialActive:d,isTeamSuspended:u,showBillingButton:a,isProviderAlpha:c,isFullyAuthenticated:m})})})},je=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],ye=9998,Q=e=>e===je,ve=e=>e===ut,Rn=e=>lt.includes(e),Cn=e=>dt.includes(e),xn=e=>mt.includes(e),Nn=e=>ft.includes(e),An=e=>e>je&&e<ye,kn=e=>e===ye,Ln=/\n/,Je=(e,t,n)=>e.split(t).flatMap((s,a)=>a!==0?[b.cloneElement(n,{key:Math.random().toString(32).slice(0,10)}),s]:s),On=(e,t,n)=>typeof e=="string"?Je(e,t,n):e.flatMap(s=>typeof s=="string"?Je(s,t,n):s),Mn=e=>On(e,Ln,o.jsx("br",{})),Un=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,qn=e=>e.match(Un)??[],Ke=(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!=="")},Qe=e=>{const t=qn(e);return t!=null&&t.length?t.reduce((n,s,a)=>typeof n=="string"?Ke(n,s,a):n.flatMap(i=>typeof i=="string"?Ke(i,s,a):i),e):e},Bn=e=>typeof e=="string"?Qe(e):e.flatMap(t=>typeof t=="string"?Qe(t):t,e),Hn=(e,t="PP")=>tt.format(e,t),Dn=(e,t,n="PP")=>tt.format(kt.toZonedTime(e,t),n),Gn=e=>{b.useEffect(e,[])},We={biller:"biller",owner:"owner"},Ye=[We.biller,We.owner],$n=({children:e,config:t})=>{const{teams:n,currentTeamId:s,planId:a,isEndOfTrialActive:i,isFullyAuthenticated:c,userTeamRole:l}=t,d=n.find(P=>P.id===s),u=n.filter(P=>P.id!==s),m=Ye.includes(l),h=Ye.includes(l),z=Q(a)||ve(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})},Fn=({config:e,children:t})=>o.jsx($n,{config:e,children:o.jsx(In,{children:t})}),Jn="_container_q5pot_1",Kn="_profileEmail_q5pot_5",Ve={container:Jn,profileEmail:Kn},Qn=({href:e,onClick:t,userEmail:n,hideBottomDivider:s})=>{const{isEndOfTrialActive:a,isTeamSuspended:i}=H();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 ${Ve.container}`,children:[o.jsx("span",{children:"Profile Settings"}),o.jsx("span",{className:Ve.profileEmail,children:n})]})}),!s&&o.jsx(f.MenuDivider,{})]})},Wn="_wrapper_15d85_1",Yn="_profileImage_15d85_14",Vn="_teamName_15d85_22",Zn="_planLabel_15d85_29",Xn="_membership_15d85_38",er="_defaultProfileImage_15d85_44",k={wrapper:Wn,profileImage:Yn,teamName:Vn,planLabel:Zn,membership:Xn,defaultProfileImage:er},_t=({team:e,onClick:t,hidePlanLabel:n})=>{const{currentTeam:s,planId:a}=H(),i=e||s;if(!i)return null;const c=Q(a)?"Free":ve(a)?"Trial":void 0,l=t?f.MenuItem:"div";return o.jsxs(l,{className:`flex-row gap-2 flex-nowrap items-center ${k.wrapper}`,...t&&{onClick:()=>t(i)},children:[i.logoUrl?o.jsx("img",{className:k.profileImage,src:i.logoUrl,alt:"Team Logo"}):o.jsx("span",{className:`flex-row justify-center items-center ${k.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:k.teamName,children:i.name}),c&&!n&&o.jsx("span",{className:`flex-row justify-center items-center ${k.planLabel}`,children:c})]}),o.jsx("span",{className:k.membership,children:i.role})]})]})},tr="_teamsContainer_1t68g_1",nr={teamsContainer:tr},rr=({onSwitchTeam:e})=>{const{otherTeams:t}=H();return t.length===0?null:o.jsx("div",{className:`flex-col items-stretch ${nr.teamsContainer}`,children:t.map(n=>o.jsx(_t,{team:n,onClick:e,hidePlanLabel:!0},n.id))})},sr="_container_1u995_1",ar="_planCta_1u995_15",or="_upgradeIconWrapper_1u995_19",be={container:sr,planCta:ar,upgradeIconWrapper:or},ir=({upgradeOptionHref:e})=>{const{planId:t,trialDaysLeft:n,showUpgradeCta:s}=H();if(!s)return null;const c=Q(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 ${be.container}`,children:[o.jsx("span",{className:be.planCta,children:c}),o.jsxs("div",{className:`flex-row items-center gap-1 ${be.upgradeIconWrapper}`,children:[o.jsx(it,{}),o.jsx("span",{children:"See upgrade options"})]})]})},v=({children:e,...t})=>o.jsx("nav",{...t,className:ln.sidebarContainer,children:e}),cr=({children:e})=>o.jsx("div",{children:e});v.Top=cr;const ur=({children:e})=>o.jsx("div",{children:e});v.Bottom=ur;v.Avatar=fn;v.IconLink=gn;v.Menu=Tn;v.ProfileMenu=Fn;v.TeamSwitch=rr;v.TeamMenuItem=_t;v.UpgradeMenuItem=ir;v.ProfileSettingsMenuItem=Qn;const lr="_breadcrumbsItem_1hm6a_1",dr="_breadcrumbs_1hm6a_1",Ze={breadcrumbsItem:lr,breadcrumbs:dr},mr=({items:e})=>o.jsx("nav",{"aria-label":"breadcrumb",className:Ze.breadcrumbs,children:e.map((t,n)=>o.jsxs(b.Fragment,{children:[o.jsx(f.Link,{className:Ze.breadcrumbsItem,href:t.link,rel:"noreferrer",children:t.name}),n<e.length-1&&o.jsx("span",{children:" — "})]},`${t.link}-${t.name}`))}),fr=({items:e})=>o.jsx(o.Fragment,{children:e.map((t,n)=>o.jsxs(b.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))}),_r="_badge_1pc1v_1",br="_tag_1pc1v_15",gr="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",hr="_disabled_1pc1v_57",pr="_projectNavigationItem_1pc1v_61",Tr="_projectNavigationItemDisabled_1pc1v_67",N={badge:_r,tag:br,withNavLinkStyle:gr,disabled:hr,projectNavigationItem:pr,projectNavigationItemDisabled:Tr},Xe=({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:N.badge,"aria-label":`${t} items requiring attention`,children:t>9?"9+":t})]}),!!n&&o.jsx(f.Tag,{className:N.tag,children:n})]}),ge=b.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?N.projectNavigationItemDisabled:N.projectNavigationItem,children:a||n||!t?o.jsx("button",{type:"button",ref:c,className:A(N.withNavLinkStyle,{[N.disabled]:n}),disabled:n,onClick:a,children:o.jsx(Xe,{label:e,badge:s,novel:i})}):o.jsx("a",{href:t,className:N.withNavLinkStyle,children:o.jsx(Xe,{label:e,badge:s,novel:i})})})}));ge.displayName="NavigationTabsItem";const jr=e=>(e==null?void 0:e.some(t=>t.some(n=>n.visible)))??!1,yr=e=>e.visible&&(!e.dropdown||jr(e.dropdown)),vr=({navigation:e,activeItem:t})=>o.jsx("nav",{"aria-label":"Project",children:o.jsx("ul",{className:L.navigationTabList,"aria-orientation":"horizontal",children:e.filter(yr).map(n=>{var s,a,i;return n.dropdown?o.jsx("li",{className:L.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(ge,{label:n.label,disabled:n.disabled,active:c}),children:o.jsx(f.MenuList,{children:o.jsx(fr,{items:n.dropdown})})})},n.key):o.jsx("li",{className:L.navigationTab,"data-testid":n.key,"aria-selected":(a=n.isActive)==null?void 0:a.call(n,t),children:o.jsx(ge,{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)})})}),zr=r.z.object({accessToken:r.z.string(),refreshToken:r.z.string()}),Sr=r.z.union([r.z.object({Authorization:r.z.string().startsWith("Bearer ")}),r.z.object({"x-csrf-token":r.z.string()})]),W=pe.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:Sr,requestBodySchema:r.z.undefined(),successResponseBodySchema:zr}),bt=r.z.union([r.z.literal("owner"),r.z.literal("admin"),r.z.literal("biller"),r.z.literal("member")]),Pr=r.z.object({userId:r.z.number(),userUuid:r.z.string(),teamId:r.z.number(),userTeamRole:bt,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 Pr.parse(JSON.parse(n))}catch{return}}function J(e){return{Authorization:`Bearer ${e}`}}function gt(e){return t=>async(n,s)=>{var c;const a=await e.getCachedJwtToken();if(a===void 0)return t(n,s);const i=await t(n,{...s,headers:{...s.headers,...J(a.accessToken)}});if(a&&(i.status===401||i.status===403)){const l=D(a.accessToken);if(!l)return i;const d=await E.sendByPayloadRoute(e.authProviderWretchClient,W,{pathParams:{teamId:l.teamId},headers:J(a.refreshToken)});return await((c=e.onNewJwtTokenIssued)==null?void 0:c.call(e,d)),t(n,{...s,headers:{...s.headers,...J(d.accessToken)}})}return i}}function Er(){return e=>(t,n)=>e(t,{...n,headers:{...n.headers,"x-lokalise-plugin":"true"},credentials:"omit"})}function Y(){const e=he(document.cookie,"accessToken"),t=he(document.cookie,"refreshToken");if(!(!e||!t))return{accessToken:e,refreshToken:t}}function ht(){return he(document.cookie,"csrf_token")}function he(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){return gt({authProviderWretchClient:e.authProviderWretchClient,getCachedJwtToken:e.getCachedJwtToken??Ir,onNewJwtTokenIssued:e.onNewJwtTokenIssued})}function Ir(){return Promise.resolve(Y())}function Rr(e){const t={authProviderWretchClient:e.authProviderWretchClient,getCsrfToken:e.getCsrfToken??(async()=>ht()),getCachedJwtToken:e.getCachedJwtToken??(async()=>Y()),onNewJwtTokenIssued:e.onNewJwtTokenIssued,getTeamId:e.getTeamId};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 E.sendByPayloadRoute(t.authProviderWretchClient,W,{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,...J(l.accessToken)}})}}function Cr(){const e=Y();if(!e)return;const t=D(e.accessToken);if(t)return{...e,payload:t}}const pt={teamKeyCsrf:(e,t)=>["getUserToken","x-csrf-token",t,e],teamKeyJwt:(e,t)=>["getUserToken","Authorization",`Bearer ${t}`,e]},Tt=(e,t)=>C.useQuery({...t,queryFn:({queryKey:[n,s,a,i]})=>E.sendByPayloadRoute(e,W,{pathParams:{teamId:i},headers:s==="x-csrf-token"?{"x-csrf-token":a}:{Authorization:a}})}),K=class K extends CustomEvent{constructor(t){super(K.eventName,{detail:{token:t,payload:D(t.accessToken)}})}};Ie(K,"eventName","new-jwt-issued");let q=K;function xr(e,t){const n=ht(),s=Tt(e,{queryKey:pt.teamKeyCsrf(t,n??""),enabled:n!==void 0}),a=b.useRef();return b.useEffect(()=>{s.data&&s.data.accessToken!==a.current&&(window.dispatchEvent(new q(s.data)),a.current=s.data.accessToken)},[s.data]),s}function ze(){const[e,t]=b.useState();return b.useEffect(()=>{const n=a=>{t(a.detail.payload)},s=Y();return t(s&&D(s.accessToken)),window.addEventListener(q.eventName,n),()=>{window.removeEventListener(q.eventName,n)}},[]),e}const Nr=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:bt}),Ar=r.z.object({team_id:r.z.number(),team_user:Nr}),jt=B.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:Ar}),yt={teamUserKey:(e,t)=>["GetTeamUsers",e,t]},vt=(e,t)=>C.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>E.sendByGetRoute(e,jt,{pathParams:{teamId:s,userId:a}})});function kr(e){const t=ze();return vt(e,{queryKey:yt.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 Lr=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)])}),Or=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(Lr),is_admin:r.z.boolean(),is_reviewer:r.z.boolean()}),Mr=r.z.object({project_id:r.z.string(),contributors:r.z.array(Or)}),zt=B.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:Mr}),St={projectUserKey:(e,t)=>["RetrieveContributor",e,t]},Pt=(e,t)=>C.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>E.sendByGetRoute(e,zt,{pathParams:{projectId:s,contributorId:a}})});function Ur(e,t){const n=ze();return Pt(e,{queryKey:St.projectUserKey(t,(n==null?void 0:n.userId)??0),enabled:n!==void 0})}const qr=r.z.object({lang_iso:r.z.string(),custom_iso:r.z.string().optional()}),Br=r.z.object({language_id:r.z.number(),language_iso:r.z.string(),progress:r.z.number(),words_to_do:r.z.number()}),Hr=r.z.object({projectId:r.z.string()}),Dr=r.z.object({lang_id:r.z.number(),lang_iso:r.z.string(),lang_name:r.z.string(),is_rtl:r.z.boolean(),plural_forms:r.z.array(r.z.string().optional())}),Gr=r.z.object({project_id:r.z.string(),project_uuid:r.z.string().uuid(),languages:r.z.array(Dr)}),Se=r.z.union([r.z.literal("localization_files"),r.z.literal("paged_documents"),r.z.literal("marketing")]),$r=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()}),Fr=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()}),Jr=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:Fr,languages:r.z.array(Br)}),V=r.z.object({project_id:r.z.string(),uuid:r.z.string().uuid(),project_type:Se,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:$r.optional(),statistics:Jr.optional()}),Kr=r.z.object({name:r.z.string(),team_id:r.z.string(),base_lang_iso:r.z.string(),languages:r.z.array(qr),project_type:Se,is_segmentation_enabled:r.z.boolean()}),et=r.z.union([r.z.literal(0),r.z.literal(1)]),Qr=r.z.object({filter_type:Se.optional(),filter_team_id:r.z.number().optional(),filter_names:r.z.string().optional(),include_statistics:et.optional(),include_settings:et.optional(),limit:r.z.number().optional(),page:r.z.number().optional()}),Wr=r.z.object({projects:r.z.array(V)}),Yr=r.z.object({project_id:r.z.string()}),Vr=r.z.object({project_id:r.z.string()}),Zr=r.z.object({name:r.z.string().min(1),description:r.z.string().optional()}),Z=()=>"/projects",Et=pe.buildPayloadRoute({description:"Create a new project",method:"post",pathResolver:Z,requestBodySchema:Kr,successResponseBodySchema:V}),wt=B.buildGetRoute({description:"List all projects",pathResolver:Z,requestQuerySchema:Qr,successResponseBodySchema:Wr}),It=B.buildGetRoute({description:"Retrieve a project",requestPathParamsSchema:Yr,pathResolver:({project_id:e})=>`${Z()}/${e}`,successResponseBodySchema:V}),Rt=pe.buildPayloadRoute({description:"Update a project",method:"put",requestPathParamsSchema:Vr,pathResolver:({project_id:e})=>`${Z()}/${e}`,requestBodySchema:Zr,successResponseBodySchema:V});function Xr(e,t={}){return C.useMutation({...t,mutationFn:n=>E.sendByPayloadRoute(e,Et,{body:n})})}const es=B.buildGetRoute({description:"List of project languages",requestPathParamsSchema:Hr,pathResolver:({projectId:e})=>`/projects/${e}/languages`,successResponseBodySchema:Gr}),ts={projectIdKey:e=>["listProjectLanguages",e]};function ns(e,t){return C.useQuery({...t,queryFn:({queryKey:[n,s]})=>E.sendByGetRoute(e,es,{pathParams:{projectId:s}})})}const rs={paramsKey:e=>["listProjects",e]};function ss(e,t){return C.useQuery({...t,queryFn:({queryKey:[n,s]})=>E.sendByGetRoute(e,wt,{queryParams:s})})}const as={projectIdKey:e=>["retrieveProject",e]};function os(e,t){return C.useQuery({...t,queryFn:({queryKey:[n,s]})=>E.sendByGetRoute(e,It,{pathParams:{project_id:s}})})}function is(e,t,n={}){return C.useMutation({...n,mutationFn:s=>E.sendByPayloadRoute(e,Rt,{body:s,pathParams:t})})}exports.Breadcrumbs=mr;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=ye;exports.ENTERPRISE_PLAN_IDS=ft;exports.ESSENTIAL_PLAN_IDS=dt;exports.FREE_PLAN_ID=je;exports.NavigationPanel=U;exports.NavigationTabs=vr;exports.PRO_PLAN_IDS=mt;exports.START_PLAN_IDS=lt;exports.Sidebar=v;exports.TRIAL_PLAN_ID=ut;exports.clientSideJwtAuthMiddleware=wr;exports.convertNewLineToBreakTag=Mn;exports.createProject=Et;exports.formatDate=Hn;exports.formatDateTz=Dn;exports.getAuthenticatedSessionDetailFromRequest=Cr;exports.getTeamUser=jt;exports.getTeamUsersQueryKey=yt;exports.getUserToken=W;exports.getUserTokenKey=pt;exports.isEnterpriseOpenSourcePlan=kn;exports.isEnterprisePlan=Nn;exports.isEssentialPlan=Cn;exports.isFreePlan=Q;exports.isPaidPlan=An;exports.isProPlan=xn;exports.isStartPlan=Rn;exports.isTrialPlan=ve;exports.jwtAuthMiddleware=gt;exports.listProjectLanguagesKey=ts;exports.listProjects=wt;exports.listProjectsKey=rs;exports.makeUrlClickable=Bn;exports.parseJwtTokenPayload=D;exports.promoteClassicSessionToJwtMiddleware=Rr;exports.publicApiHeadersMiddleware=Er;exports.retrieveContributor=zt;exports.retrieveContributorKeys=St;exports.retrieveProject=It;exports.retrieveProjectQueryKey=as;exports.updateProject=Rt;exports.useAuthenticatedProjectContributor=Ur;exports.useAuthenticatedSessionPayload=ze;exports.useAuthenticatedUser=kr;exports.useCreateProjectMutation=Xr;exports.useEffectOnce=Gn;exports.useGetPromotedClassicSessionJwtQuery=xr;exports.useGetTeamUsersQuery=vt;exports.useGetUserTokenQuery=Tt;exports.useListProjectLanguagesQuery=ns;exports.useListProjectsQuery=ss;exports.useRetrieveContributorQuery=Pt;exports.useRetrieveProjectQuery=os;exports.useUpdateProjectMutation=is;
|
1
|
+
"use strict";var At=Object.defineProperty;var kt=(e,t,n)=>t in e?At(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ie=(e,t,n)=>kt(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("react"),f=require("@lokalise/louis"),tt=require("date-fns"),Lt=require("date-fns-tz"),E=require("@lokalise/frontend-http-client"),r=require("zod"),pe=require("@lokalise/universal-ts-utils/api-contracts/apiContracts"),C=require("@tanstack/react-query"),B=require("@lokalise/universal-ts-utils/node");function Ot(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=Ot(b);var F=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 ee,Re;function Te(){if(Re)return ee;Re=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return ee=e,ee}var te,Ce;function Mt(){if(Ce)return te;Ce=1;var e=typeof F=="object"&&F&&F.Object===Object&&F;return te=e,te}var ne,xe;function rt(){if(xe)return ne;xe=1;var e=Mt(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ne=n,ne}var re,Ne;function Ut(){if(Ne)return re;Ne=1;var e=rt(),t=function(){return e.Date.now()};return re=t,re}var se,Ae;function qt(){if(Ae)return se;Ae=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return se=t,se}var ae,ke;function Bt(){if(ke)return ae;ke=1;var e=qt(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return ae=n,ae}var oe,Le;function st(){if(Le)return oe;Le=1;var e=rt(),t=e.Symbol;return oe=t,oe}var ie,Oe;function Ht(){if(Oe)return ie;Oe=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 ie=i,ie}var ce,Me;function Dt(){if(Me)return ce;Me=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return ce=n,ce}var ue,Ue;function Gt(){if(Ue)return ue;Ue=1;var e=st(),t=Ht(),n=Dt(),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 ue=c,ue}var le,qe;function $t(){if(qe)return le;qe=1;function e(t){return t!=null&&typeof t=="object"}return le=e,le}var de,Be;function Ft(){if(Be)return de;Be=1;var e=Gt(),t=$t(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return de=s,de}var me,He;function Jt(){if(He)return me;He=1;var e=Bt(),t=Te(),n=Ft(),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 me=d,me}var fe,De;function at(){if(De)return fe;De=1;var e=Te(),t=Ut(),n=Jt(),s="Expected a function",a=Math.max,i=Math.min;function c(l,d,u){var m,h,z,w,g,y,S=0,P=!1,p=!1,I=!0;if(typeof l!="function")throw new TypeError(s);d=n(d)||0,e(u)&&(P=!!u.leading,p="maxWait"in u,z=p?a(n(u.maxWait)||0,d):z,I="trailing"in u?!!u.trailing:I);function j(_){var R=m,O=h;return m=h=void 0,S=_,w=l.apply(O,R),w}function T(_){return S=_,g=setTimeout($,d),P?j(_):w}function G(_){var R=_-y,O=_-S,we=d-R;return p?i(we,z-O):we}function Pe(_){var R=_-y,O=_-S;return y===void 0||R>=d||R<0||p&&O>=z}function $(){var _=t();if(Pe(_))return Ee(_);g=setTimeout($,G(_))}function Ee(_){return g=void 0,I&&m?j(_):(m=h=void 0,w)}function xt(){g!==void 0&&clearTimeout(g),S=0,m=y=h=g=void 0}function Nt(){return g===void 0?w:Ee(t())}function X(){var _=t(),R=Pe(_);if(m=arguments,h=this,y=_,R){if(g===void 0)return T(y);if(p)return clearTimeout(g),g=setTimeout($,d),j(y)}return g===void 0&&(g=setTimeout($,d)),w}return X.cancel=xt,X.flush=Nt,X}return fe=c,fe}var Kt=at();const Qt=nt(Kt);var _e,Ge;function Wt(){if(Ge)return _e;Ge=1;var e=at(),t=Te(),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 _e=s,_e}var Yt=Wt();const Vt=nt(Yt),Zt=(e,t,n,s)=>{switch(t){case"debounce":return Qt(e,n,s);case"throttle":return Vt(e,n,s);default:return e}},Xt=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)},[])},en=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}},tn=(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 nn({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:s,handleWidth:a=!0,handleHeight:i=!0,targetRef:c,observerOptions:l,onResize:d}={}){const u=b.useRef(e),m=Xt(d),[h,z]=b.useState({width:void 0,height:void 0}),{refProxy:w,refElement:g}=en(c),{box:y}=l||{},S=b.useCallback(p=>{if(!a&&!i)return;if(u.current){u.current=!1;return}const I=(j,T)=>a&&j.width!==T.width||i&&j.height!==T.height;p.forEach(j=>{const T=tn(j,y);z(G=>I(G,T)?(m==null||m({width:T.width,height:T.height,entry:j}),T):G)})},[a,i,u,y]),P=b.useCallback(Zt(S,t,n,s),[S,t,n,s]);return b.useEffect(()=>{let p;return g?(p=new window.ResizeObserver(P),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,j,T;(I=p==null?void 0:p.disconnect)===null||I===void 0||I.call(p),(T=(j=P).cancel)===null||T===void 0||T.call(j)}},[P,g]),Object.assign({ref:w},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 A(){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 rn="_headerContainer_1cubo_1",sn="_navigationTabList_1cubo_8",an="_navigationTab_1cubo_8",on="_headerContent_1cubo_34",cn="_staticEnabled_1cubo_50",L={headerContainer:rn,navigationTabList:sn,navigationTab:an,headerContent:on,staticEnabled:cn},un=77,U=({sticky:e,children:t})=>{const{ref:n,height:s}=nn({refreshMode:"debounce",refreshRate:0}),[a,i]=b.useState(!1),c=()=>a?!e:!0;b.useEffect(()=>{const d=()=>{i(window.scrollY>0)};return window.addEventListener("scroll",d),()=>window.removeEventListener("scroll",d)},[]);const l=`${s||un}px`;return o.jsx("div",{style:{minHeight:l},children:o.jsx("div",{children:o.jsxs("div",{ref:n,className:A(L.headerContent,{[L.staticEnabled]:c()}),children:[o.jsx(U.Header,{}),o.jsx(U.Tabs,{}),t]})})})};U.Header=({children:e})=>o.jsx("div",{className:L.headerContainer,children:e});U.Tabs=({children:e})=>o.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const ln="_sidebarContainer_bmdti_1",dn={sidebarContainer:ln},mn="_logoLink_1baxb_1",fn={logoLink:mn},_n=({src:e,href:t="/",ariaLabel:n="Home",alt:s="Lokalise"})=>o.jsx("a",{className:fn.logoLink,href:t,"aria-label":n,children:o.jsx("img",{src:e,alt:s})}),bn="_link_18vhx_1",gn="_active_18vhx_18",$e={link:bn,active:gn},hn=({label:e,to:t,icon:n})=>o.jsx(f.Tooltip,{placement:"right",tooltip:e,children:o.jsx(f.Link,{className:A($e.link,{[$e.active]:window.location.pathname.startsWith(t)}),href:t,children:o.jsx(n,{size:"25px"})})}),pn="_dropdownButton_13l5r_1",Tn="_dropdownButtonActive_13l5r_18",Fe={dropdownButton:pn,dropdownButtonActive:Tn},jn=({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:A(Fe.dropdownButton,{[Fe.dropdownButtonActive]:n}),children:o.jsx(t,{size:"25px"})})}),children:o.jsx(f.MenuList,{placement:"right-start",children:e})}),yn="_iconContainer_nz34m_1",vn={iconContainer:yn},it=({className:e=""})=>o.jsx("div",{"aria-label":"Upgrade Icon",className:A(vn.iconContainer,"flex-row","items-center","justify-center",e),children:o.jsx(f.CaretUpIcon,{})}),zn="_menuContainer_wbu3u_5",Sn="_profileButton_wbu3u_16",Pn="_profileImage_wbu3u_29",En="_profileImageHighlight_wbu3u_37",wn="_profileImageUpgradeIcon_wbu3u_41",In="_userIconWrapper_wbu3u_47",x={menuContainer:zn,profileButton:Sn,profileImage:Pn,profileImageHighlight:En,profileImageUpgradeIcon:wn,userIconWrapper:In},ct=b.createContext({}),H=()=>b.useContext(ct),Rn=({children:e})=>{const{currentTeam:t,otherTeams:n,showUpgradeCta:s,showBillingButton:a,allowTeamCreation:i,isProviderAlpha:c,canAccessTeamSettings:l,isEndOfTrialActive:d,isTeamSuspended:u,isFullyAuthenticated:m}=H();return o.jsx(f.Menu,{menuButton:()=>o.jsxs("button",{className:x.profileButton,"aria-label":"Profile menu",type:"button",children:[t!=null&&t.logoUrl?o.jsx("img",{src:t.logoUrl,className:A(x.profileImage,{[x.profileImageHighlight]:s}),alt:"Team Logo"}):o.jsx("div",{className:A(x.userIconWrapper,"flex-row","align-center","items-center",{[x.profileImageHighlight]:s}),children:o.jsx(f.UserIcon,{size:"25px"})}),s&&o.jsx(it,{className:x.profileImageUpgradeIcon})]}),children:o.jsx(f.MenuList,{placement:"right-end",className:x.menuContainer,children:e({allowTeamCreation:i,otherTeams:n,canAccessTeamSettings:l,isEndOfTrialActive:d,isTeamSuspended:u,showBillingButton:a,isProviderAlpha:c,isFullyAuthenticated:m})})})},je=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],ye=9998,Q=e=>e===je,ve=e=>e===ut,Cn=e=>lt.includes(e),xn=e=>dt.includes(e),Nn=e=>mt.includes(e),An=e=>ft.includes(e),kn=e=>e>je&&e<ye,Ln=e=>e===ye,On=/\n/,Je=(e,t,n)=>e.split(t).flatMap((s,a)=>a!==0?[b.cloneElement(n,{key:Math.random().toString(32).slice(0,10)}),s]:s),Mn=(e,t,n)=>typeof e=="string"?Je(e,t,n):e.flatMap(s=>typeof s=="string"?Je(s,t,n):s),Un=e=>Mn(e,On,o.jsx("br",{})),qn=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,Bn=e=>e.match(qn)??[],Ke=(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!=="")},Qe=e=>{const t=Bn(e);return t!=null&&t.length?t.reduce((n,s,a)=>typeof n=="string"?Ke(n,s,a):n.flatMap(i=>typeof i=="string"?Ke(i,s,a):i),e):e},Hn=e=>typeof e=="string"?Qe(e):e.flatMap(t=>typeof t=="string"?Qe(t):t,e),Dn=(e,t="PP")=>tt.format(e,t),Gn=(e,t,n="PP")=>tt.format(Lt.toZonedTime(e,t),n),$n=e=>{b.useEffect(e,[])},We={biller:"biller",owner:"owner"},Ye=[We.biller,We.owner],Fn=({children:e,config:t})=>{const{teams:n,currentTeamId:s,planId:a,isEndOfTrialActive:i,isFullyAuthenticated:c,userTeamRole:l}=t,d=n.find(P=>P.id===s),u=n.filter(P=>P.id!==s),m=Ye.includes(l),h=Ye.includes(l),z=Q(a)||ve(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})},Jn=({config:e,children:t})=>o.jsx(Fn,{config:e,children:o.jsx(Rn,{children:t})}),Kn="_container_q5pot_1",Qn="_profileEmail_q5pot_5",Ve={container:Kn,profileEmail:Qn},Wn=({href:e,onClick:t,userEmail:n,hideBottomDivider:s})=>{const{isEndOfTrialActive:a,isTeamSuspended:i}=H();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 ${Ve.container}`,children:[o.jsx("span",{children:"Profile Settings"}),o.jsx("span",{className:Ve.profileEmail,children:n})]})}),!s&&o.jsx(f.MenuDivider,{})]})},Yn="_wrapper_15d85_1",Vn="_profileImage_15d85_14",Zn="_teamName_15d85_22",Xn="_planLabel_15d85_29",er="_membership_15d85_38",tr="_defaultProfileImage_15d85_44",k={wrapper:Yn,profileImage:Vn,teamName:Zn,planLabel:Xn,membership:er,defaultProfileImage:tr},_t=({team:e,onClick:t,hidePlanLabel:n})=>{const{currentTeam:s,planId:a}=H(),i=e||s;if(!i)return null;const c=Q(a)?"Free":ve(a)?"Trial":void 0,l=t?f.MenuItem:"div";return o.jsxs(l,{className:`flex-row gap-2 flex-nowrap items-center ${k.wrapper}`,...t&&{onClick:()=>t(i)},children:[i.logoUrl?o.jsx("img",{className:k.profileImage,src:i.logoUrl,alt:"Team Logo"}):o.jsx("span",{className:`flex-row justify-center items-center ${k.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:k.teamName,children:i.name}),c&&!n&&o.jsx("span",{className:`flex-row justify-center items-center ${k.planLabel}`,children:c})]}),o.jsx("span",{className:k.membership,children:i.role})]})]})},nr="_teamsContainer_1t68g_1",rr={teamsContainer:nr},sr=({onSwitchTeam:e})=>{const{otherTeams:t}=H();return t.length===0?null:o.jsx("div",{className:`flex-col items-stretch ${rr.teamsContainer}`,children:t.map(n=>o.jsx(_t,{team:n,onClick:e,hidePlanLabel:!0},n.id))})},ar="_container_1u995_1",or="_planCta_1u995_15",ir="_upgradeIconWrapper_1u995_19",be={container:ar,planCta:or,upgradeIconWrapper:ir},cr=({upgradeOptionHref:e})=>{const{planId:t,trialDaysLeft:n,showUpgradeCta:s}=H();if(!s)return null;const c=Q(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 ${be.container}`,children:[o.jsx("span",{className:be.planCta,children:c}),o.jsxs("div",{className:`flex-row items-center gap-1 ${be.upgradeIconWrapper}`,children:[o.jsx(it,{}),o.jsx("span",{children:"See upgrade options"})]})]})},v=({children:e,...t})=>o.jsx("nav",{...t,className:dn.sidebarContainer,children:e}),ur=({children:e})=>o.jsx("div",{children:e});v.Top=ur;const lr=({children:e})=>o.jsx("div",{children:e});v.Bottom=lr;v.Avatar=_n;v.IconLink=hn;v.Menu=jn;v.ProfileMenu=Jn;v.TeamSwitch=sr;v.TeamMenuItem=_t;v.UpgradeMenuItem=cr;v.ProfileSettingsMenuItem=Wn;const dr="_breadcrumbsItem_1hm6a_1",mr="_breadcrumbs_1hm6a_1",Ze={breadcrumbsItem:dr,breadcrumbs:mr},fr=({items:e})=>o.jsx("nav",{"aria-label":"breadcrumb",className:Ze.breadcrumbs,children:e.map((t,n)=>o.jsxs(b.Fragment,{children:[o.jsx(f.Link,{className:Ze.breadcrumbsItem,href:t.link,rel:"noreferrer",children:t.name}),n<e.length-1&&o.jsx("span",{children:" — "})]},`${t.link}-${t.name}`))}),_r=({items:e})=>o.jsx(o.Fragment,{children:e.map((t,n)=>o.jsxs(b.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))}),br="_badge_1pc1v_1",gr="_tag_1pc1v_15",hr="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",pr="_disabled_1pc1v_57",Tr="_projectNavigationItem_1pc1v_61",jr="_projectNavigationItemDisabled_1pc1v_67",N={badge:br,tag:gr,withNavLinkStyle:hr,disabled:pr,projectNavigationItem:Tr,projectNavigationItemDisabled:jr},Xe=({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:N.badge,"aria-label":`${t} items requiring attention`,children:t>9?"9+":t})]}),!!n&&o.jsx(f.Tag,{className:N.tag,children:n})]}),ge=b.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?N.projectNavigationItemDisabled:N.projectNavigationItem,children:a||n||!t?o.jsx("button",{type:"button",ref:c,className:A(N.withNavLinkStyle,{[N.disabled]:n}),disabled:n,onClick:a,children:o.jsx(Xe,{label:e,badge:s,novel:i})}):o.jsx("a",{href:t,className:N.withNavLinkStyle,children:o.jsx(Xe,{label:e,badge:s,novel:i})})})}));ge.displayName="NavigationTabsItem";const yr=e=>(e==null?void 0:e.some(t=>t.some(n=>n.visible)))??!1,vr=e=>e.visible&&(!e.dropdown||yr(e.dropdown)),zr=({navigation:e,activeItem:t})=>o.jsx("nav",{"aria-label":"Project",children:o.jsx("ul",{className:L.navigationTabList,"aria-orientation":"horizontal",children:e.filter(vr).map(n=>{var s,a,i;return n.dropdown?o.jsx("li",{className:L.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(ge,{label:n.label,disabled:n.disabled,active:c}),children:o.jsx(f.MenuList,{children:o.jsx(_r,{items:n.dropdown})})})},n.key):o.jsx("li",{className:L.navigationTab,"data-testid":n.key,"aria-selected":(a=n.isActive)==null?void 0:a.call(n,t),children:o.jsx(ge,{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)})})}),Sr=r.z.object({accessToken:r.z.string(),refreshToken:r.z.string()}),Pr=r.z.union([r.z.object({Authorization:r.z.string().startsWith("Bearer ")}),r.z.object({"x-csrf-token":r.z.string()})]),W=pe.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:Pr,requestBodySchema:r.z.undefined(),successResponseBodySchema:Sr}),bt=r.z.union([r.z.literal("owner"),r.z.literal("admin"),r.z.literal("biller"),r.z.literal("member")]),Er=r.z.object({userId:r.z.number(),userUuid:r.z.string(),teamId:r.z.number(),userTeamRole:bt,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 Er.parse(JSON.parse(n))}catch{return}}function J(e){return{Authorization:`Bearer ${e}`}}function gt(e){return t=>async(n,s)=>{var c;const a=await e.getCachedJwtToken();if(a===void 0)return t(n,s);const i=await t(n,{...s,headers:{...s.headers,...J(a.accessToken)}});if(a&&(i.status===401||i.status===403)){const l=D(a.accessToken);if(!l)return i;const d=await E.sendByPayloadRoute(e.authProviderWretchClient,W,{pathParams:{teamId:l.teamId},headers:J(a.refreshToken)});return await((c=e.onNewJwtTokenIssued)==null?void 0:c.call(e,d)),t(n,{...s,headers:{...s.headers,...J(d.accessToken)}})}return i}}function wr(){return e=>(t,n)=>e(t,{...n,headers:{...n.headers,"x-lokalise-plugin":"true"},credentials:"omit"})}function Y(){const e=he(document.cookie,"accessToken"),t=he(document.cookie,"refreshToken");if(!(!e||!t))return{accessToken:e,refreshToken:t}}function ht(){return he(document.cookie,"csrf_token")}function he(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 Ir(e){return gt({authProviderWretchClient:e.authProviderWretchClient,getCachedJwtToken:e.getCachedJwtToken??Rr,onNewJwtTokenIssued:e.onNewJwtTokenIssued})}function Rr(){return Promise.resolve(Y())}function Cr(e){const t={authProviderWretchClient:e.authProviderWretchClient,getCsrfToken:e.getCsrfToken??(async()=>ht()),getCachedJwtToken:e.getCachedJwtToken??(async()=>Y()),onNewJwtTokenIssued:e.onNewJwtTokenIssued,getTeamId:e.getTeamId};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 E.sendByPayloadRoute(t.authProviderWretchClient,W,{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,...J(l.accessToken)}})}}function xr(){const e=Y();if(!e)return;const t=D(e.accessToken);if(t)return{...e,payload:t}}const pt={teamKeyCsrf:(e,t)=>["getUserToken","x-csrf-token",t,e],teamKeyJwt:(e,t)=>["getUserToken","Authorization",`Bearer ${t}`,e]},Tt=(e,t)=>C.useQuery({...t,queryFn:({queryKey:[n,s,a,i]})=>E.sendByPayloadRoute(e,W,{pathParams:{teamId:i},headers:s==="x-csrf-token"?{"x-csrf-token":a}:{Authorization:a}})}),K=class K extends CustomEvent{constructor(t){super(K.eventName,{detail:{token:t,payload:D(t.accessToken)}})}};Ie(K,"eventName","new-jwt-issued");let q=K;function Nr(e,t){const n=ht(),s=Tt(e,{queryKey:pt.teamKeyCsrf(t,n??""),enabled:n!==void 0}),a=b.useRef();return b.useEffect(()=>{s.data&&s.data.accessToken!==a.current&&(window.dispatchEvent(new q(s.data)),a.current=s.data.accessToken)},[s.data]),s}function ze(){const[e,t]=b.useState();return b.useEffect(()=>{const n=a=>{t(a.detail.payload)},s=Y();return t(s&&D(s.accessToken)),window.addEventListener(q.eventName,n),()=>{window.removeEventListener(q.eventName,n)}},[]),e}const Ar=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:bt}),kr=r.z.object({team_id:r.z.number(),team_user:Ar}),jt=B.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:kr}),yt={teamUserKey:(e,t)=>["GetTeamUsers",e,t]},vt=(e,t)=>C.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>E.sendByGetRoute(e,jt,{pathParams:{teamId:s,userId:a}})});function Lr(e){const t=ze();return vt(e,{queryKey:yt.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 Or=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)])}),Mr=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(Or),is_admin:r.z.boolean(),is_reviewer:r.z.boolean()}),Ur=r.z.object({project_id:r.z.string(),contributors:r.z.array(Mr)}),zt=B.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:Ur}),St={projectUserKey:(e,t)=>["RetrieveContributor",e,t]},Pt=(e,t)=>C.useQuery({...t,queryFn:({queryKey:[n,s,a]})=>E.sendByGetRoute(e,zt,{pathParams:{projectId:s,contributorId:a}})});function qr(e,t){const n=ze();return Pt(e,{queryKey:St.projectUserKey(t,(n==null?void 0:n.userId)??0),enabled:n!==void 0})}const Br=r.z.object({lang_iso:r.z.string(),custom_iso:r.z.string().optional()}),Hr=r.z.object({language_id:r.z.number(),language_iso:r.z.string(),progress:r.z.number(),words_to_do:r.z.number()}),Dr=r.z.object({projectId:r.z.string()}),Gr=r.z.object({lang_id:r.z.number(),lang_iso:r.z.string(),lang_name:r.z.string(),is_rtl:r.z.boolean(),plural_forms:r.z.array(r.z.string().optional())}),$r=r.z.object({project_id:r.z.string(),project_uuid:r.z.string().uuid(),languages:r.z.array(Gr)}),Et=B.buildGetRoute({description:"List of project languages",requestPathParamsSchema:Dr,pathResolver:({projectId:e})=>`/projects/${e}/languages`,successResponseBodySchema:$r}),Se=r.z.union([r.z.literal("localization_files"),r.z.literal("paged_documents"),r.z.literal("marketing")]),Fr=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()}),Jr=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()}),Kr=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:Jr,languages:r.z.array(Hr)}),V=r.z.object({project_id:r.z.string(),uuid:r.z.string().uuid(),project_type:Se,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:Fr.optional(),statistics:Kr.optional()}),Qr=r.z.object({name:r.z.string(),team_id:r.z.string(),base_lang_iso:r.z.string(),languages:r.z.array(Br),project_type:Se,is_segmentation_enabled:r.z.boolean()}),et=r.z.union([r.z.literal(0),r.z.literal(1)]),Wr=r.z.object({filter_type:Se.optional(),filter_team_id:r.z.number().optional(),filter_names:r.z.string().optional(),include_statistics:et.optional(),include_settings:et.optional(),limit:r.z.number().optional(),page:r.z.number().optional()}),Yr=r.z.object({projects:r.z.array(V)}),Vr=r.z.object({project_id:r.z.string()}),Zr=r.z.object({project_id:r.z.string()}),Xr=r.z.object({name:r.z.string().min(1),description:r.z.string().optional()}),Z=()=>"/projects",wt=pe.buildPayloadRoute({description:"Create a new project",method:"post",pathResolver:Z,requestBodySchema:Qr,successResponseBodySchema:V}),It=B.buildGetRoute({description:"List all projects",pathResolver:Z,requestQuerySchema:Wr,successResponseBodySchema:Yr}),Rt=B.buildGetRoute({description:"Retrieve a project",requestPathParamsSchema:Vr,pathResolver:({project_id:e})=>`${Z()}/${e}`,successResponseBodySchema:V}),Ct=pe.buildPayloadRoute({description:"Update a project",method:"put",requestPathParamsSchema:Zr,pathResolver:({project_id:e})=>`${Z()}/${e}`,requestBodySchema:Xr,successResponseBodySchema:V});function es(e,t={}){return C.useMutation({...t,mutationFn:n=>E.sendByPayloadRoute(e,wt,{body:n})})}const ts={projectIdKey:e=>["listProjectLanguages",e]};function ns(e,t){return C.useQuery({...t,queryFn:({queryKey:[n,s]})=>E.sendByGetRoute(e,Et,{pathParams:{projectId:s}})})}const rs={paramsKey:e=>["listProjects",e]};function ss(e,t){return C.useQuery({...t,queryFn:({queryKey:[n,s]})=>E.sendByGetRoute(e,It,{queryParams:s})})}const as={projectIdKey:e=>["retrieveProject",e]};function os(e,t){return C.useQuery({...t,queryFn:({queryKey:[n,s]})=>E.sendByGetRoute(e,Rt,{pathParams:{project_id:s}})})}function is(e,t,n={}){return C.useMutation({...n,mutationFn:s=>E.sendByPayloadRoute(e,Ct,{body:s,pathParams:t})})}exports.Breadcrumbs=fr;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=ye;exports.ENTERPRISE_PLAN_IDS=ft;exports.ESSENTIAL_PLAN_IDS=dt;exports.FREE_PLAN_ID=je;exports.NavigationPanel=U;exports.NavigationTabs=zr;exports.PRO_PLAN_IDS=mt;exports.START_PLAN_IDS=lt;exports.Sidebar=v;exports.TRIAL_PLAN_ID=ut;exports.clientSideJwtAuthMiddleware=Ir;exports.convertNewLineToBreakTag=Un;exports.createProject=wt;exports.formatDate=Dn;exports.formatDateTz=Gn;exports.getAuthenticatedSessionDetailFromRequest=xr;exports.getTeamUser=jt;exports.getTeamUsersQueryKey=yt;exports.getUserToken=W;exports.getUserTokenKey=pt;exports.isEnterpriseOpenSourcePlan=Ln;exports.isEnterprisePlan=An;exports.isEssentialPlan=xn;exports.isFreePlan=Q;exports.isPaidPlan=kn;exports.isProPlan=Nn;exports.isStartPlan=Cn;exports.isTrialPlan=ve;exports.jwtAuthMiddleware=gt;exports.listProjectLanguages=Et;exports.listProjectLanguagesKey=ts;exports.listProjects=It;exports.listProjectsKey=rs;exports.makeUrlClickable=Hn;exports.parseJwtTokenPayload=D;exports.promoteClassicSessionToJwtMiddleware=Cr;exports.publicApiHeadersMiddleware=wr;exports.retrieveContributor=zt;exports.retrieveContributorKeys=St;exports.retrieveProject=Rt;exports.retrieveProjectQueryKey=as;exports.updateProject=Ct;exports.useAuthenticatedProjectContributor=qr;exports.useAuthenticatedSessionPayload=ze;exports.useAuthenticatedUser=Lr;exports.useCreateProjectMutation=es;exports.useEffectOnce=$n;exports.useGetPromotedClassicSessionJwtQuery=Nr;exports.useGetTeamUsersQuery=vt;exports.useGetUserTokenQuery=Tt;exports.useListProjectLanguagesQuery=ns;exports.useListProjectsQuery=ss;exports.useRetrieveContributorQuery=Pt;exports.useRetrieveProjectQuery=os;exports.useUpdateProjectMutation=is;
|
package/dist/harmony.mjs
CHANGED
@@ -929,11 +929,16 @@ const Lr = r.object({
|
|
929
929
|
project_id: r.string(),
|
930
930
|
project_uuid: r.string().uuid(),
|
931
931
|
languages: r.array(qr)
|
932
|
+
}), xr = H({
|
933
|
+
description: "List of project languages",
|
934
|
+
requestPathParamsSchema: Ur,
|
935
|
+
pathResolver: ({ projectId: e }) => `/projects/${e}/languages`,
|
936
|
+
successResponseBodySchema: Br
|
932
937
|
}), Pe = r.union([
|
933
938
|
r.literal("localization_files"),
|
934
939
|
r.literal("paged_documents"),
|
935
940
|
r.literal("marketing")
|
936
|
-
]),
|
941
|
+
]), Hr = r.object({
|
937
942
|
per_platform_key_names: r.boolean(),
|
938
943
|
reviewing: r.boolean(),
|
939
944
|
auto_toggle_unverified: r.boolean(),
|
@@ -944,7 +949,7 @@ const Lr = r.object({
|
|
944
949
|
custom_translation_statuses_allow_multiple: r.boolean(),
|
945
950
|
segmentation: r.boolean(),
|
946
951
|
contributor_preview_download_enabled: r.boolean()
|
947
|
-
}),
|
952
|
+
}), $r = r.object({
|
948
953
|
not_reviewed: r.number(),
|
949
954
|
unverified: r.number(),
|
950
955
|
spelling_grammar: r.number(),
|
@@ -961,13 +966,13 @@ const Lr = r.object({
|
|
961
966
|
double_space: r.number(),
|
962
967
|
special_placeholder: r.number(),
|
963
968
|
unbalanced_brackets: r.number()
|
964
|
-
}),
|
969
|
+
}), Jr = r.object({
|
965
970
|
progress_total: r.number(),
|
966
971
|
keys_total: r.number(),
|
967
972
|
team: r.number(),
|
968
973
|
base_words: r.number(),
|
969
974
|
qa_issues_total: r.number(),
|
970
|
-
qa_issues:
|
975
|
+
qa_issues: $r,
|
971
976
|
languages: r.array(Mr)
|
972
977
|
}), V = r.object({
|
973
978
|
project_id: r.string(),
|
@@ -982,16 +987,16 @@ const Lr = r.object({
|
|
982
987
|
team_id: r.number(),
|
983
988
|
base_language_id: r.number(),
|
984
989
|
base_language_iso: r.string(),
|
985
|
-
settings:
|
986
|
-
statistics:
|
987
|
-
}),
|
990
|
+
settings: Hr.optional(),
|
991
|
+
statistics: Jr.optional()
|
992
|
+
}), Dr = r.object({
|
988
993
|
name: r.string(),
|
989
994
|
team_id: r.string(),
|
990
995
|
base_lang_iso: r.string(),
|
991
996
|
languages: r.array(Lr),
|
992
997
|
project_type: Pe,
|
993
998
|
is_segmentation_enabled: r.boolean()
|
994
|
-
}), rt = r.union([r.literal(0), r.literal(1)]),
|
999
|
+
}), rt = r.union([r.literal(0), r.literal(1)]), Gr = r.object({
|
995
1000
|
filter_type: Pe.optional(),
|
996
1001
|
filter_team_id: r.number().optional(),
|
997
1002
|
filter_names: r.string().optional(),
|
@@ -999,59 +1004,54 @@ const Lr = r.object({
|
|
999
1004
|
include_settings: rt.optional(),
|
1000
1005
|
limit: r.number().optional(),
|
1001
1006
|
page: r.number().optional()
|
1002
|
-
}), Gr = r.object({
|
1003
|
-
projects: r.array(V)
|
1004
1007
|
}), Fr = r.object({
|
1005
|
-
|
1008
|
+
projects: r.array(V)
|
1006
1009
|
}), zr = r.object({
|
1007
1010
|
project_id: r.string()
|
1008
1011
|
}), Wr = r.object({
|
1012
|
+
project_id: r.string()
|
1013
|
+
}), Kr = r.object({
|
1009
1014
|
name: r.string().min(1),
|
1010
1015
|
description: r.string().optional()
|
1011
|
-
}), Z = () => "/projects",
|
1016
|
+
}), Z = () => "/projects", Qr = Se({
|
1012
1017
|
description: "Create a new project",
|
1013
1018
|
method: "post",
|
1014
1019
|
pathResolver: Z,
|
1015
|
-
requestBodySchema:
|
1020
|
+
requestBodySchema: Dr,
|
1016
1021
|
successResponseBodySchema: V
|
1017
|
-
}),
|
1022
|
+
}), Yr = H({
|
1018
1023
|
description: "List all projects",
|
1019
1024
|
pathResolver: Z,
|
1020
|
-
requestQuerySchema:
|
1021
|
-
successResponseBodySchema:
|
1022
|
-
}),
|
1025
|
+
requestQuerySchema: Gr,
|
1026
|
+
successResponseBodySchema: Fr
|
1027
|
+
}), Vr = H({
|
1023
1028
|
description: "Retrieve a project",
|
1024
|
-
requestPathParamsSchema:
|
1029
|
+
requestPathParamsSchema: zr,
|
1025
1030
|
pathResolver: ({ project_id: e }) => `${Z()}/${e}`,
|
1026
1031
|
successResponseBodySchema: V
|
1027
|
-
}),
|
1032
|
+
}), Zr = Se({
|
1028
1033
|
description: "Update a project",
|
1029
1034
|
method: "put",
|
1030
|
-
requestPathParamsSchema:
|
1035
|
+
requestPathParamsSchema: Wr,
|
1031
1036
|
pathResolver: ({ project_id: e }) => `${Z()}/${e}`,
|
1032
|
-
requestBodySchema:
|
1037
|
+
requestBodySchema: Kr,
|
1033
1038
|
successResponseBodySchema: V
|
1034
1039
|
});
|
1035
1040
|
function ko(e, t = {}) {
|
1036
1041
|
return dt({
|
1037
1042
|
...t,
|
1038
|
-
mutationFn: (n) => B(e,
|
1043
|
+
mutationFn: (n) => B(e, Qr, {
|
1039
1044
|
body: n
|
1040
1045
|
})
|
1041
1046
|
});
|
1042
1047
|
}
|
1043
|
-
const
|
1044
|
-
description: "List of project languages",
|
1045
|
-
requestPathParamsSchema: Ur,
|
1046
|
-
pathResolver: ({ projectId: e }) => `/projects/${e}/languages`,
|
1047
|
-
successResponseBodySchema: Br
|
1048
|
-
}), Ao = {
|
1048
|
+
const Ao = {
|
1049
1049
|
projectIdKey: (e) => ["listProjectLanguages", e]
|
1050
1050
|
};
|
1051
1051
|
function Oo(e, t) {
|
1052
1052
|
return O({
|
1053
1053
|
...t,
|
1054
|
-
queryFn: ({ queryKey: [n, o] }) => x(e,
|
1054
|
+
queryFn: ({ queryKey: [n, o] }) => x(e, xr, {
|
1055
1055
|
pathParams: { projectId: o }
|
1056
1056
|
})
|
1057
1057
|
});
|
@@ -1062,7 +1062,7 @@ const Lo = {
|
|
1062
1062
|
function Mo(e, t) {
|
1063
1063
|
return O({
|
1064
1064
|
...t,
|
1065
|
-
queryFn: ({ queryKey: [n, o] }) => x(e,
|
1065
|
+
queryFn: ({ queryKey: [n, o] }) => x(e, Yr, {
|
1066
1066
|
queryParams: o
|
1067
1067
|
})
|
1068
1068
|
});
|
@@ -1073,7 +1073,7 @@ const Uo = {
|
|
1073
1073
|
function qo(e, t) {
|
1074
1074
|
return O({
|
1075
1075
|
...t,
|
1076
|
-
queryFn: ({ queryKey: [n, o] }) => x(e,
|
1076
|
+
queryFn: ({ queryKey: [n, o] }) => x(e, Vr, {
|
1077
1077
|
pathParams: { project_id: o }
|
1078
1078
|
})
|
1079
1079
|
});
|
@@ -1081,7 +1081,7 @@ function qo(e, t) {
|
|
1081
1081
|
function Bo(e, t, n = {}) {
|
1082
1082
|
return dt({
|
1083
1083
|
...n,
|
1084
|
-
mutationFn: (o) => B(e,
|
1084
|
+
mutationFn: (o) => B(e, Zr, {
|
1085
1085
|
body: o,
|
1086
1086
|
pathParams: t
|
1087
1087
|
})
|
@@ -1101,7 +1101,7 @@ export {
|
|
1101
1101
|
Nn as TRIAL_PLAN_ID,
|
1102
1102
|
Io as clientSideJwtAuthMiddleware,
|
1103
1103
|
ho as convertNewLineToBreakTag,
|
1104
|
-
|
1104
|
+
Qr as createProject,
|
1105
1105
|
To as formatDate,
|
1106
1106
|
vo as formatDateTz,
|
1107
1107
|
Co as getAuthenticatedSessionDetailFromRequest,
|
@@ -1118,8 +1118,9 @@ export {
|
|
1118
1118
|
uo as isStartPlan,
|
1119
1119
|
yt as isTrialPlan,
|
1120
1120
|
Tr as jwtAuthMiddleware,
|
1121
|
+
xr as listProjectLanguages,
|
1121
1122
|
Ao as listProjectLanguagesKey,
|
1122
|
-
|
1123
|
+
Yr as listProjects,
|
1123
1124
|
Lo as listProjectsKey,
|
1124
1125
|
po as makeUrlClickable,
|
1125
1126
|
Q as parseJwtTokenPayload,
|
@@ -1127,9 +1128,9 @@ export {
|
|
1127
1128
|
Eo as publicApiHeadersMiddleware,
|
1128
1129
|
kr as retrieveContributor,
|
1129
1130
|
Ar as retrieveContributorKeys,
|
1130
|
-
|
1131
|
+
Vr as retrieveProject,
|
1131
1132
|
Uo as retrieveProjectQueryKey,
|
1132
|
-
|
1133
|
+
Zr as updateProject,
|
1133
1134
|
No as useAuthenticatedProjectContributor,
|
1134
1135
|
It as useAuthenticatedSessionPayload,
|
1135
1136
|
Ro as useAuthenticatedUser,
|