@webority/web-core 0.106.0 → 0.108.0

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 CHANGED
@@ -313,8 +313,9 @@ navigation commits and reloads from there. A form posted to that route reaches t
313
313
  element with the load error, and `useRouteErrorReport` reloads it once. `lazyWithReload` and
314
314
  `useRouteErrorReport` reload the same way. The reload is claimed in sessionStorage for that page with a time stamp; if the page's
315
315
  chunk still fails after its reload, inside 60 seconds, the route's error element shows it and
316
- `useRouteErrorReport` warns once, with no further reload. An app's own error boundary shares the
317
- claim: reload only when `!hasRecentlyReloaded() && markReloaded()`.
316
+ `useRouteErrorReport` warns once, with no further reload. The app's root `ErrorBoundary` shares the
317
+ claim: it reloads a stale build through the same `reloadForChunkError` and renders its `fallback` with the
318
+ error's `kind`, so the page reloads at most once between them.
318
319
 
319
320
  ## Logger
320
321
 
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{configuredLocale as t,getFormatterConfig as n,groupingForLocale as r,numberSeparators as i,styledNumber as a}from"./formatConfig.js";import{dateTimeFormat as o,numberFormat as s,relativeTimeFormat as c}from"./intlCache.js";var l=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],u=330,d=[`IST`,`Asia/Kolkata`,`Asia/Calcutta`],f=/^\d{4}-\d{2}-\d{2}$/,p=e=>e<10?`0${e}`:`${e}`,m=e=>e??n().empty,h=e=>{if(e==null||e===``)return null;let t=e instanceof Date?e:new Date(typeof e==`string`?e.trim():e);return Number.isNaN(t.getTime())?null:t},g=e=>typeof e==`string`&&f.test(e.trim()),_=e=>{if(e===0)return`GMT`;let t=e>0?`+`:`-`,n=Math.abs(e),r=n%60;return`GMT${t}${Math.floor(n/60)}${r===0?``:`:${p(r)}`}`},v=(e,t,n)=>{let r=new Date(e.getTime()+t*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth(),day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),label:n}},ee=(e,t)=>{let n=o(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,hour12:!1}).formatToParts(e),r=e=>Number.parseInt(n.find(t=>t.type===e)?.value??``,10),i=r(`year`),a=r(`month`)-1,s=r(`day`),c=r(`hour`)%24,l=r(`minute`);return{year:i,month:a,day:s,hour:c,minute:l,label:_(Math.round((Date.UTC(i,a,s,c,l)-Math.floor(e.getTime()/6e4)*6e4)/6e4))}},y=(e,t)=>d.includes(t)?v(e,u,`IST`):t===`UTC`?v(e,0,`UTC`):t===`viewer`?{year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),label:_(-e.getTimezoneOffset())}:ee(e,t),b=e=>e.hourCycle??12,te=e=>`${p(e.day)}-${l[e.month]}-${e.year}`,x=(e,t)=>{let n=p(e.day),r=p(e.month+1),i=String(e.year).padStart(4,`0`);return t===`DayMonthYear`?`${n}/${r}/${i}`:t===`MonthDayYear`?`${r}/${n}/${i}`:`${i}-${r}-${n}`},S=(e,t)=>t===24?`${p(e.hour)}:${p(e.minute)}`:`${e.hour%12||12}:${p(e.minute)} ${e.hour<12?`AM`:`PM`}`,C=(e,t)=>t??!d.includes(e),w=(e,t,n,r)=>C(n,r)?`${e} ${t.label}`:e,T=e=>{if(e!==`viewer`)return d.includes(e)?`Asia/Kolkata`:e},ne=(e,t,n)=>{let r=o(t,{day:`2-digit`,month:`short`,year:`numeric`,timeZone:n}).formatToParts(e),i=e=>r.find(t=>t.type===e)?.value??``;return`${i(`day`)}-${i(`month`).replace(`.`,``)}-${i(`year`)}`},E=(e,r)=>{let i=n().dateOrder??`DayMonthNameYear`;if(i!==`DayMonthNameYear`)return x(y(e,r),i);let a=t();return a?ne(e,a,T(r)):te(y(e,r))},D=(e,t,n,r)=>o(t,{hour:`2-digit`,minute:`2-digit`,timeZone:T(n),timeZoneName:C(n,r.zoneLabel)?`short`:void 0,hourCycle:r.hourCycle===void 0?void 0:r.hourCycle===24?`h23`:`h12`}).format(e),O=(e,t={})=>{let r=h(e);return r?E(r,g(e)?`UTC`:t.zone??n().zone):m(t.empty)},k=(e,r={})=>{let i=h(e);if(!i)return m(r.empty);let a=r.zone??n().zone,o=t();if(o)return D(i,o,a,r);let s=y(i,a);return w(S(s,b(r)),s,a,r.zoneLabel)},A=(e,r={})=>{let i=h(e);if(!i)return m(r.empty);let a=r.zone??n().zone,o=t();if(o)return`${E(i,a)}, ${D(i,o,a,r)}`;let s=y(i,a);return w(`${E(i,a)}, ${S(s,b(r))}`,s,a,r.zoneLabel)},j=1e3,M=60*j,N=60*M,P=24*N,F=7*P,I=30*P,L=365*P,R=[[`year`,L],[`month`,I],[`day`,P],[`hour`,N],[`minute`,M]],z=(e,r={})=>{let i=h(e),a=h(r.now??Date.now());if(!i||!a)return m(r.empty);let o=i.getTime()-a.getTime(),s=Math.abs(o),l=Intl.RelativeTimeFormat,u=t();if((u!==null||r.intl===!0)&&typeof l==`function`){let e=c(l,u??n().locale),[t,r]=R.find(([,e])=>s>=e)??[`second`,j];return e.format(Math.round(o/r),t)}if(s<M)return`just now`;let[d,f]=s<N?[`minute`,M]:s<P?[`hour`,N]:s<F?[`day`,P]:s<I?[`week`,F]:s<L?[`month`,I]:[`year`,L],p=Math.floor(s/f),g=`${p} ${d}${p===1?``:`s`}`;return o<0?`${g} ago`:`in ${g}`},B=e=>{if(e==null||typeof e==`string`&&e.trim()===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null},V=e=>Math.min(20,Math.max(0,Math.trunc(e))),H=(e,t)=>/e/i.test(String(e))?e*10**t:Number(`${e}e${t}`),U=()=>i()??{decimal:`.`,group:`,`},W=(e,t,n)=>t===`none`||e.length<=3?e:t===`international`?e.replace(/\B(?=(\d{3})+(?!\d))/g,n):`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,n)}${n}${e.slice(-3)}`,G=()=>typeof Intl<`u`&&typeof Intl.NumberFormat==`function`,K=(e,t)=>{if(G())return s(`en-US`,{useGrouping:!1,minimumFractionDigits:0,maximumFractionDigits:t}).format(e);let n=Math.min(t,15);return H(Math.round(H(e,n)),-n).toFixed(n)},q=(e,t,n,r)=>{let i=Math.max(V(n),V(t)),a=V(t),o=K(Math.abs(e),i),[s=`0`,c=``]=o.split(`.`),l=c.padEnd(a,`0`);for(;l.length>a&&l.endsWith(`0`);)l=l.slice(0,-1);let u=U(),d=W(s,r,u.group)+(l?`${u.decimal}${l}`:``);return e<0&&/[1-9]/.test(o)?`-${d}`:d},J=new Set([`grouping`,`minimumFractionDigits`,`maximumFractionDigits`,`locale`,`empty`,`scale`]),Y=e=>{if(!Object.entries(e).some(([e,t])=>t!==void 0&&!J.has(e)))return null;let{grouping:t,locale:n,empty:r,scale:i,...a}=e;return t===`none`&&a.useGrouping===void 0?{...a,useGrouping:!1}:a},X=e=>e.locale??n().locale,Z=e=>{let n=t();return n===null||e.grouping===`indian`||e.grouping===`international`?null:e.locale??n},Q=(e,t)=>{let n=V(e);return{minimumFractionDigits:n,maximumFractionDigits:Math.max(n,V(t))}},$=e=>e===`none`?{useGrouping:!1}:{},re=(e,t={})=>{let n=B(e);if(n===null)return m(t.empty);let i=Y(t);if(i)return a(s(X(t),i),n);let o=Z(t);return o?a(s(o,{...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??3),...$(t.grouping)}),n):q(n,t.minimumFractionDigits??0,t.maximumFractionDigits??3,t.grouping??r(X(t)))},ie=(e,t={})=>{let n=B(e);if(n===null)return m(t.empty);let i=Y(t);if(i){let e=t.scale===`percent`?H(n,-2):n;return a(s(X(t),{style:`percent`,...i}),e)}let o=Z(t);if(o){let e=t.scale===`percent`?H(n,-2):n;return a(s(o,{style:`percent`,...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0),...$(t.grouping)}),e)}return`${q(t.scale===`percent`?n:H(n,2),t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0,t.grouping??r(X(t)))}%`},ae={INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`},oe={JPY:0,KRW:0,VND:0,BHD:3,JOD:3,KWD:3,OMR:3,TND:3},se=(t,n={})=>{n.currency||e(`[@webority/web-core] formatMinor called without options.currency: it prints INR for now and throws from 0.78.0. Pass an ISO 4217 code.`);let r=B(t);if(r===null)return m(n.empty);let i=(n.currency||`INR`).toUpperCase(),o=oe[i]??2,c=Math.round(Math.abs(r)),l=String(c).padStart(o+1,`0`),u=l.slice(0,l.length-o),d=l.slice(l.length-o);n.dropZeroDecimals&&/^0*$/.test(d)&&(d=``);let f=Z({grouping:n.grouping});if(f)try{let e=Number(`${r<0&&c!==0?`-`:``}${u}.${l.slice(l.length-o)||`0`}`);return a(s(f,{...n.symbol===!1?{}:{style:`currency`,currency:i},...Q(d?o:0,o),...$(n.grouping)}),e)}catch{}let p=n.grouping??(i===`INR`?`indian`:`international`),h=U(),g=W(u,p,h.group)+(d?`${h.decimal}${d}`:``),_=r<0&&c!==0?`-`:``;if(n.symbol===!1)return`${_}${g}`;let v=ae[i];return v?`${_}${v}${g}`:`${_}${i} ${g}`};export{O as formatDate,A as formatDateTime,se as formatMinor,re as formatNumber,ie as formatPercent,z as formatRelative,k as formatTime};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{configuredLocale as t,getFormatterConfig as n,groupingForLocale as r,numberSeparators as i,styledNumber as a}from"./formatConfig.js";import{dateTimeFormat as o,numberFormat as s,relativeTimeFormat as c}from"./intlCache.js";import{formatDateTime as l}from"@webority/ui-elements/helpers";var u=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],d=330,f=[`IST`,`Asia/Kolkata`,`Asia/Calcutta`],p=/^\d{4}-\d{2}-\d{2}$/,m=e=>e<10?`0${e}`:`${e}`,h=e=>e??n().empty,g=e=>{if(e==null||e===``)return null;let t=e instanceof Date?e:new Date(typeof e==`string`?e.trim():e);return Number.isNaN(t.getTime())?null:t},_=e=>typeof e==`string`&&p.test(e.trim()),v=e=>{if(e===0)return`GMT`;let t=e>0?`+`:`-`,n=Math.abs(e),r=n%60;return`GMT${t}${Math.floor(n/60)}${r===0?``:`:${m(r)}`}`},y=(e,t,n)=>{let r=new Date(e.getTime()+t*6e4);return{year:r.getUTCFullYear(),month:r.getUTCMonth(),day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),label:n}},b=(e,t)=>{let n=o(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,hour12:!1}).formatToParts(e),r=e=>Number.parseInt(n.find(t=>t.type===e)?.value??``,10),i=r(`year`),a=r(`month`)-1,s=r(`day`),c=r(`hour`)%24,l=r(`minute`);return{year:i,month:a,day:s,hour:c,minute:l,label:v(Math.round((Date.UTC(i,a,s,c,l)-Math.floor(e.getTime()/6e4)*6e4)/6e4))}},x=(e,t)=>f.includes(t)?y(e,d,`IST`):t===`UTC`?y(e,0,`UTC`):t===`viewer`?{year:e.getFullYear(),month:e.getMonth(),day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),label:v(-e.getTimezoneOffset())}:b(e,t),S=e=>e.hourCycle??12,C=e=>`${m(e.day)}-${u[e.month]}-${e.year}`,w=(e,t)=>{let n=m(e.day),r=m(e.month+1),i=String(e.year).padStart(4,`0`);return t===`DayMonthYear`?`${n}/${r}/${i}`:t===`MonthDayYear`?`${r}/${n}/${i}`:`${i}-${r}-${n}`},T=(e,t)=>t===24?`${m(e.hour)}:${m(e.minute)}`:`${e.hour%12||12}:${m(e.minute)} ${e.hour<12?`AM`:`PM`}`,E=(e,t)=>t??!f.includes(e),D=(e,t,n,r)=>E(n,r)?`${e} ${t.label}`:e,O=e=>{if(e!==`viewer`)return f.includes(e)?`Asia/Kolkata`:e},k=(e,t,n)=>{let r=o(t,{day:`2-digit`,month:`short`,year:`numeric`,timeZone:n}).formatToParts(e),i=e=>r.find(t=>t.type===e)?.value??``;return`${i(`day`)}-${i(`month`).replace(`.`,``)}-${i(`year`)}`},A=(e,r)=>{let i=n().dateOrder??`DayMonthNameYear`;if(i!==`DayMonthNameYear`)return w(x(e,r),i);let a=t();return a?k(e,a,O(r)):C(x(e,r))},j=(e,t,n,r)=>o(t,{hour:`2-digit`,minute:`2-digit`,timeZone:O(n),timeZoneName:E(n,r.zoneLabel)?`short`:void 0,hourCycle:r.hourCycle===void 0?void 0:r.hourCycle===24?`h23`:`h12`}).format(e),M=(e,t={})=>{let r=g(e);return r?A(r,_(e)?`UTC`:t.zone??n().zone):h(t.empty)},N=(e,r={})=>{let i=g(e);if(!i)return h(r.empty);let a=r.zone??n().zone,o=t();if(o)return j(i,o,a,r);let s=x(i,a);return D(T(s,S(r)),s,a,r.zoneLabel)},ee=(e,r={})=>{let i=g(e);if(!i)return h(r.empty);let a=r.zone??n().zone,o=t();if(o)return`${A(i,a)}, ${j(i,o,a,r)}`;let s=x(i,a);return(n().dateOrder??`DayMonthNameYear`)===`DayMonthNameYear`&&S(r)===12&&a!==`viewer`?D(l(i,{timeZone:O(a)}),s,a,r.zoneLabel):D(`${A(i,a)}, ${T(s,S(r))}`,s,a,r.zoneLabel)},P=1e3,F=60*P,I=60*F,L=24*I,R=7*L,z=30*L,B=365*L,V=[[`year`,B],[`month`,z],[`day`,L],[`hour`,I],[`minute`,F]],H=(e,r={})=>{let i=g(e),a=g(r.now??Date.now());if(!i||!a)return h(r.empty);let o=i.getTime()-a.getTime(),s=Math.abs(o),l=Intl.RelativeTimeFormat,u=t();if((u!==null||r.intl===!0)&&typeof l==`function`){let e=c(l,u??n().locale),[t,r]=V.find(([,e])=>s>=e)??[`second`,P];return e.format(Math.round(o/r),t)}if(s<F)return`just now`;let[d,f]=s<I?[`minute`,F]:s<L?[`hour`,I]:s<R?[`day`,L]:s<z?[`week`,R]:s<B?[`month`,z]:[`year`,B],p=Math.floor(s/f),m=`${p} ${d}${p===1?``:`s`}`;return o<0?`${m} ago`:`in ${m}`},U=e=>{if(e==null||typeof e==`string`&&e.trim()===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null},W=e=>Math.min(20,Math.max(0,Math.trunc(e))),G=(e,t)=>/e/i.test(String(e))?e*10**t:Number(`${e}e${t}`),K=()=>i()??{decimal:`.`,group:`,`},q=(e,t,n)=>t===`none`||e.length<=3?e:t===`international`?e.replace(/\B(?=(\d{3})+(?!\d))/g,n):`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,n)}${n}${e.slice(-3)}`,te=()=>typeof Intl<`u`&&typeof Intl.NumberFormat==`function`,ne=(e,t)=>{if(te())return s(`en-US`,{useGrouping:!1,minimumFractionDigits:0,maximumFractionDigits:t}).format(e);let n=Math.min(t,15);return G(Math.round(G(e,n)),-n).toFixed(n)},J=(e,t,n,r)=>{let i=Math.max(W(n),W(t)),a=W(t),o=ne(Math.abs(e),i),[s=`0`,c=``]=o.split(`.`),l=c.padEnd(a,`0`);for(;l.length>a&&l.endsWith(`0`);)l=l.slice(0,-1);let u=K(),d=q(s,r,u.group)+(l?`${u.decimal}${l}`:``);return e<0&&/[1-9]/.test(o)?`-${d}`:d},re=new Set([`grouping`,`minimumFractionDigits`,`maximumFractionDigits`,`locale`,`empty`,`scale`]),Y=e=>{if(!Object.entries(e).some(([e,t])=>t!==void 0&&!re.has(e)))return null;let{grouping:t,locale:n,empty:r,scale:i,...a}=e;return t===`none`&&a.useGrouping===void 0?{...a,useGrouping:!1}:a},X=e=>e.locale??n().locale,Z=e=>{let n=t();return n===null||e.grouping===`indian`||e.grouping===`international`?null:e.locale??n},Q=(e,t)=>{let n=W(e);return{minimumFractionDigits:n,maximumFractionDigits:Math.max(n,W(t))}},$=e=>e===`none`?{useGrouping:!1}:{},ie=(e,t={})=>{let n=U(e);if(n===null)return h(t.empty);let i=Y(t);if(i)return a(s(X(t),i),n);let o=Z(t);return o?a(s(o,{...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??3),...$(t.grouping)}),n):J(n,t.minimumFractionDigits??0,t.maximumFractionDigits??3,t.grouping??r(X(t)))},ae=(e,t={})=>{let n=U(e);if(n===null)return h(t.empty);let i=Y(t);if(i){let e=t.scale===`percent`?G(n,-2):n;return a(s(X(t),{style:`percent`,...i}),e)}let o=Z(t);if(o){let e=t.scale===`percent`?G(n,-2):n;return a(s(o,{style:`percent`,...Q(t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0),...$(t.grouping)}),e)}return`${J(t.scale===`percent`?n:G(n,2),t.minimumFractionDigits??0,t.maximumFractionDigits??t.minimumFractionDigits??0,t.grouping??r(X(t)))}%`},oe={INR:`₹`,USD:`$`,EUR:`€`,GBP:`£`},se={JPY:0,KRW:0,VND:0,BHD:3,JOD:3,KWD:3,OMR:3,TND:3},ce=(t,n={})=>{n.currency||e(`[@webority/web-core] formatMinor called without options.currency: it prints INR for now and throws from 0.78.0. Pass an ISO 4217 code.`);let r=U(t);if(r===null)return h(n.empty);let i=(n.currency||`INR`).toUpperCase(),o=se[i]??2,c=Math.round(Math.abs(r)),l=String(c).padStart(o+1,`0`),u=l.slice(0,l.length-o),d=l.slice(l.length-o);n.dropZeroDecimals&&/^0*$/.test(d)&&(d=``);let f=Z({grouping:n.grouping});if(f)try{let e=Number(`${r<0&&c!==0?`-`:``}${u}.${l.slice(l.length-o)||`0`}`);return a(s(f,{...n.symbol===!1?{}:{style:`currency`,currency:i},...Q(d?o:0,o),...$(n.grouping)}),e)}catch{}let p=n.grouping??(i===`INR`?`indian`:`international`),m=K(),g=q(u,p,m.group)+(d?`${m.decimal}${d}`:``),_=r<0&&c!==0?`-`:``;if(n.symbol===!1)return`${_}${g}`;let v=oe[i];return v?`${_}${v}${g}`:`${_}${i} ${g}`};export{M as formatDate,ee as formatDateTime,ce as formatMinor,ie as formatNumber,ae as formatPercent,H as formatRelative,N as formatTime};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{DEFAULT_BUILD_CHECK_INTERVAL_MS as e,DEFAULT_LOG_LEVEL as t,DEFAULT_RETRIES as n,DEFAULT_TIMEOUT_MS as r,DEFAULT_VERSION_URL as i,getConfig as a,getConfigValue as o,resetConfig as s,setConfig as c}from"./config/index.js";import{TRACEPARENT_HEADER as l,applyRequestDefaults as u,newTraceparent as d}from"./api/requestDefaults.js";import{Logger as f,configureLogger as p,getDeviceContext as m,setDeviceContext as h,setRemoteLogger as g}from"./logger/logger.js";import{decodeJWT as _,getJWTExpiry as v,isJWTExpired as y}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as b,LEGACY_REFRESH_TOKEN_LIFETIME_MS as x,REFRESH_TOKEN_KEY as S,SESSION_USER_KEY as C,addSessionEndedListener as w,clearSession as T,getKeepSignedIn as E,getSessionUser as D,getToken as O,hasSession as k,hasSessionEndedInTab as A,removeSessionUser as j,removeToken as M,setKeepSignedIn as N,setLegacyTokenKeys as P,storeSessionUser as F,storeToken as I}from"./auth/authStore.js";import{addNetworkStatusListener as L,getNetworkStatus as R,setNetworkStatusImplementation as z,useNetworkStatus as B}from"./network/networkStatus.js";import{ACCOUNT_ID_HEADER as V,CLIENT_BUILD_HEADER as H,CLIENT_KIND as U,CLIENT_KIND_HEADER as W,getClientBuild as G}from"./api/clientHeaders.js";import{DESIGN_SAMPLE_HEADER as K,DESIGN_SAMPLE_QUERY_KEY as q,DESIGN_SAMPLE_STORAGE_KEY as J,applyDesignSample as Y,readDesignSampleTicket as X}from"./api/designSample.js";import{MIN_APP_VERSION_HEADER as Z,addMinAppVersionListener as Q,getMinAppVersion as $}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as ee,WorkspaceChangedError as te,isWorkspaceChangedError as ne}from"./api/workspaceChanged.js";import{IDEMPOTENCY_KEY_HEADER as re,attachRetry as ie,isNeverSentError as ae,isRetryableFailure as oe,isRetryableStatus as se,retryAfterMs as ce}from"./api/retry.js";import{REFRESH_LOCK_NAME as le,withCrossTabRefreshLock as ue}from"./api/crossTabRefreshLock.js";import de from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as fe,SESSION_REVOKED_CODE as pe,injectStore as me,injectUserAuth as he,refreshAccessToken as ge,resetRefreshState as _e}from"./api/tokenRefresh.js";import ve,{RequestOfflineError as ye}from"./api/userClient.js";import{initUserAuth as be}from"./initUserAuth.js";import{CONTRACT_ERROR_CODE as xe,NETWORK_CODE as Se,OFFLINE_CODE as Ce,OFFLINE_MESSAGE as we,REQUEST_CANCELED_CODE as Te,SERVER_FAILURE_MESSAGE as Ee,TIMEOUT_CODE as De,TIMEOUT_MESSAGE as Oe,UNEXPECTED_MESSAGE as ke,UNREACHABLE_MESSAGE as Ae,apiErrorMessage as je,extractApiError as Me,isApiError as Ne,isNoResponse as Pe,toFieldPath as Fe}from"./errors/extractApiError.js";import{configureFormatters as Ie,getFormatterConfig as Le}from"./formatters/formatConfig.js";import{formatCurrency as Re}from"./formatters/currency.js";import{addDays as ze}from"./formatters/dateMath.js";import{formatDate as Be,formatDateTime as Ve,formatMinor as He,formatNumber as Ue,formatPercent as We,formatRelative as Ge,formatTime as Ke}from"./formatters/house.js";import{initWebority as qe}from"./initSDK.js";import{createApiBaseQuery as Je}from"./query/apiBaseQuery.js";import{APP_API_DEFAULTS as Ye,createAppApi as Xe}from"./query/createAppApi.js";import{setupApiListeners as Ze}from"./query/listeners.js";import{buildListQuery as Qe,getNextPageParam as $e,getPreviousPageParam as et,hasNextPage as tt,hasPreviousPage as nt}from"./query/paging.js";import{LIST_TAG_ID as rt,itemTag as it,listTag as at,providesList as ot,providesPagedList as st}from"./query/tags.js";import{errorToastMiddleware as ct,isSilentRejection as lt}from"./redux/errorToastMiddleware.js";import{createRootReducer as ut,resetState as dt}from"./redux/rootReducer.js";import{SERIALIZABLE_IGNORED_ACTION_PATHS as ft}from"./redux/serializableCheck.js";import{hasRecentlyReloaded as pt,importWithReload as mt,isChunkLoadError as ht,lazyWithReload as gt,markReloaded as _t}from"./router/chunkReload.js";import{hasPermission as vt}from"./router/permissions.js";import{RETURN_TO_PARAM as yt,buildLoginPath as bt,getReturnTo as xt,toSafeReturnTo as St}from"./router/returnTo.js";import{PublicOnly as Ct,RequireAuth as wt,RequirePermission as Tt}from"./router/guards.js";import{publicOnly as Et,requireAuth as Dt,requirePermission as Ot,withGuards as kt}from"./router/loaders.js";import{classifyRouteError as At,useRouteErrorReport as jt}from"./router/routeError.js";import{staticUrl as Mt}from"./static/index.js";import{Storage as Nt,isStorageAvailable as Pt,setStorageImplementation as Ft,syncStorage as It}from"./storage/index.js";import{isBuildBelowMinimum as Lt,parseBuildNumber as Rt}from"./versionCheck/buildNumber.js";import{addDeployedBuildListener as zt,getNewerDeployedBuild as Bt,startDeployedBuildCheck as Vt}from"./versionCheck/deployedBuild.js";import{installReloadOnNavigate as Ht,isUpdateAvailable as Ut,useVersionCheck as Wt}from"./versionCheck/index.js";export{b as ACCESS_TOKEN_KEY,V as ACCOUNT_ID_HEADER,Ye as APP_API_DEFAULTS,H as CLIENT_BUILD_HEADER,U as CLIENT_KIND,W as CLIENT_KIND_HEADER,xe as CONTRACT_ERROR_CODE,e as DEFAULT_BUILD_CHECK_INTERVAL_MS,t as DEFAULT_LOG_LEVEL,n as DEFAULT_RETRIES,r as DEFAULT_TIMEOUT_MS,i as DEFAULT_VERSION_URL,K as DESIGN_SAMPLE_HEADER,q as DESIGN_SAMPLE_QUERY_KEY,J as DESIGN_SAMPLE_STORAGE_KEY,re as IDEMPOTENCY_KEY_HEADER,x as LEGACY_REFRESH_TOKEN_LIFETIME_MS,rt as LIST_TAG_ID,f as Logger,Z as MIN_APP_VERSION_HEADER,Se as NETWORK_CODE,Ce as OFFLINE_CODE,we as OFFLINE_MESSAGE,Ct as PublicOnly,le as REFRESH_LOCK_NAME,S as REFRESH_TOKEN_KEY,Te as REQUEST_CANCELED_CODE,yt as RETURN_TO_PARAM,ye as RequestOfflineError,wt as RequireAuth,Tt as RequirePermission,ft as SERIALIZABLE_IGNORED_ACTION_PATHS,Ee as SERVER_FAILURE_MESSAGE,fe as SESSION_EXPIRED_CODE,pe as SESSION_REVOKED_CODE,C as SESSION_USER_KEY,Nt as Storage,De as TIMEOUT_CODE,Oe as TIMEOUT_MESSAGE,l as TRACEPARENT_HEADER,ke as UNEXPECTED_MESSAGE,Ae as UNREACHABLE_MESSAGE,ee as WORKSPACE_CHANGED_CODE,te as WorkspaceChangedError,ze as addDays,zt as addDeployedBuildListener,Q as addMinAppVersionListener,L as addNetworkStatusListener,w as addSessionEndedListener,je as apiErrorMessage,Y as applyDesignSample,u as applyRequestDefaults,ie as attachRetry,Qe as buildListQuery,bt as buildLoginPath,At as classifyRouteError,T as clearSession,Ie as configureFormatters,p as configureLogger,Je as createApiBaseQuery,Xe as createAppApi,ut as createRootReducer,_ as decodeJWT,ct as errorToastMiddleware,Me as extractApiError,Re as formatCurrency,Be as formatDate,Ve as formatDateTime,He as formatMinor,Ue as formatNumber,We as formatPercent,Ge as formatRelative,Ke as formatTime,G as getClientBuild,a as getConfig,o as getConfigValue,m as getDeviceContext,Le as getFormatterConfig,v as getJWTExpiry,E as getKeepSignedIn,$ as getMinAppVersion,R as getNetworkStatus,Bt as getNewerDeployedBuild,$e as getNextPageParam,et as getPreviousPageParam,xt as getReturnTo,D as getSessionUser,O as getToken,tt as hasNextPage,vt as hasPermission,nt as hasPreviousPage,pt as hasRecentlyReloaded,k as hasSession,A as hasSessionEndedInTab,mt as importWithReload,be as initUserAuth,qe as initWebority,me as injectStore,he as injectUserAuth,Ht as installReloadOnNavigate,Ne as isApiError,Lt as isBuildBelowMinimum,ht as isChunkLoadError,y as isJWTExpired,ae as isNeverSentError,Pe as isNoResponse,oe as isRetryableFailure,se as isRetryableStatus,lt as isSilentRejection,Pt as isStorageAvailable,Ut as isUpdateAvailable,ne as isWorkspaceChangedError,it as itemTag,gt as lazyWithReload,at as listTag,_t as markReloaded,d as newTraceparent,Rt as parseBuildNumber,ot as providesList,st as providesPagedList,de as publicClient,Et as publicOnly,X as readDesignSampleTicket,ge as refreshAccessToken,j as removeSessionUser,M as removeToken,Dt as requireAuth,Ot as requirePermission,s as resetConfig,_e as resetRefreshState,dt as resetState,ce as retryAfterMs,c as setConfig,h as setDeviceContext,N as setKeepSignedIn,P as setLegacyTokenKeys,z as setNetworkStatusImplementation,g as setRemoteLogger,Ft as setStorageImplementation,Ze as setupApiListeners,Vt as startDeployedBuildCheck,Mt as staticUrl,F as storeSessionUser,I as storeToken,It as syncStorage,Fe as toFieldPath,St as toSafeReturnTo,B as useNetworkStatus,jt as useRouteErrorReport,Wt as useVersionCheck,ve as userClient,ue as withCrossTabRefreshLock,kt as withGuards};
1
+ import{DEFAULT_BUILD_CHECK_INTERVAL_MS as e,DEFAULT_LOG_LEVEL as t,DEFAULT_RETRIES as n,DEFAULT_TIMEOUT_MS as r,DEFAULT_VERSION_URL as i,getConfig as a,getConfigValue as o,resetConfig as s,setConfig as c}from"./config/index.js";import{TRACEPARENT_HEADER as l,applyRequestDefaults as u,newTraceparent as d}from"./api/requestDefaults.js";import{Logger as f,configureLogger as p,getDeviceContext as m,setDeviceContext as h,setRemoteLogger as g}from"./logger/logger.js";import{decodeJWT as _,getJWTExpiry as v,isJWTExpired as y}from"./auth/jwt.js";import{ACCESS_TOKEN_KEY as b,LEGACY_REFRESH_TOKEN_LIFETIME_MS as x,REFRESH_TOKEN_KEY as S,SESSION_USER_KEY as C,addSessionEndedListener as w,clearSession as T,getKeepSignedIn as E,getSessionUser as D,getToken as O,hasSession as k,hasSessionEndedInTab as A,removeSessionUser as j,removeToken as M,setKeepSignedIn as N,setLegacyTokenKeys as P,storeSessionUser as F,storeToken as I}from"./auth/authStore.js";import{addNetworkStatusListener as L,getNetworkStatus as R,setNetworkStatusImplementation as z,useNetworkStatus as B}from"./network/networkStatus.js";import{ACCOUNT_ID_HEADER as V,CLIENT_BUILD_HEADER as H,CLIENT_KIND as U,CLIENT_KIND_HEADER as W,getClientBuild as G}from"./api/clientHeaders.js";import{DESIGN_SAMPLE_HEADER as K,DESIGN_SAMPLE_QUERY_KEY as q,DESIGN_SAMPLE_STORAGE_KEY as J,applyDesignSample as Y,readDesignSampleTicket as X}from"./api/designSample.js";import{MIN_APP_VERSION_HEADER as Z,addMinAppVersionListener as Q,getMinAppVersion as $}from"./api/minAppVersion.js";import{WORKSPACE_CHANGED_CODE as ee,WorkspaceChangedError as te,isWorkspaceChangedError as ne}from"./api/workspaceChanged.js";import{IDEMPOTENCY_KEY_HEADER as re,attachRetry as ie,isNeverSentError as ae,isRetryableFailure as oe,isRetryableStatus as se,retryAfterMs as ce}from"./api/retry.js";import{REFRESH_LOCK_NAME as le,withCrossTabRefreshLock as ue}from"./api/crossTabRefreshLock.js";import de from"./api/publicClient.js";import{SESSION_EXPIRED_CODE as fe,SESSION_REVOKED_CODE as pe,injectStore as me,injectUserAuth as he,refreshAccessToken as ge,resetRefreshState as _e}from"./api/tokenRefresh.js";import ve,{RequestOfflineError as ye}from"./api/userClient.js";import{initUserAuth as be}from"./initUserAuth.js";import{CONTRACT_ERROR_CODE as xe,NETWORK_CODE as Se,OFFLINE_CODE as Ce,OFFLINE_MESSAGE as we,REQUEST_CANCELED_CODE as Te,SERVER_FAILURE_MESSAGE as Ee,TIMEOUT_CODE as De,TIMEOUT_MESSAGE as Oe,UNEXPECTED_MESSAGE as ke,UNREACHABLE_MESSAGE as Ae,apiErrorMessage as je,extractApiError as Me,isApiError as Ne,isNoResponse as Pe,toFieldPath as Fe}from"./errors/extractApiError.js";import{configureFormatters as Ie,getFormatterConfig as Le}from"./formatters/formatConfig.js";import{formatCurrency as Re}from"./formatters/currency.js";import{addDays as ze}from"./formatters/dateMath.js";import{formatDate as Be,formatDateTime as Ve,formatMinor as He,formatNumber as Ue,formatPercent as We,formatRelative as Ge,formatTime as Ke}from"./formatters/house.js";import{initWebority as qe}from"./initSDK.js";import{createApiBaseQuery as Je}from"./query/apiBaseQuery.js";import{APP_API_DEFAULTS as Ye,createAppApi as Xe}from"./query/createAppApi.js";import{setupApiListeners as Ze}from"./query/listeners.js";import{buildListQuery as Qe,getNextPageParam as $e,getPreviousPageParam as et,hasNextPage as tt,hasPreviousPage as nt}from"./query/paging.js";import{LIST_TAG_ID as rt,itemTag as it,listTag as at,providesList as ot,providesPagedList as st}from"./query/tags.js";import{errorToastMiddleware as ct,isSilentRejection as lt}from"./redux/errorToastMiddleware.js";import{createRootReducer as ut,resetState as dt}from"./redux/rootReducer.js";import{SERIALIZABLE_IGNORED_ACTION_PATHS as ft}from"./redux/serializableCheck.js";import{hasRecentlyReloaded as pt,importWithReload as mt,isChunkLoadError as ht,lazyWithReload as gt,markReloaded as _t}from"./router/chunkReload.js";import{classifyRouteError as vt,useRouteErrorReport as yt}from"./router/routeError.js";import{ErrorBoundary as bt}from"./router/ErrorBoundary.js";import{hasPermission as xt}from"./router/permissions.js";import{RETURN_TO_PARAM as St,buildLoginPath as Ct,getReturnTo as wt,toSafeReturnTo as Tt}from"./router/returnTo.js";import{PublicOnly as Et,RequireAuth as Dt,RequirePermission as Ot}from"./router/guards.js";import{publicOnly as kt,requireAuth as At,requirePermission as jt,withGuards as Mt}from"./router/loaders.js";import{staticUrl as Nt}from"./static/index.js";import{Storage as Pt,isStorageAvailable as Ft,setStorageImplementation as It,syncStorage as Lt}from"./storage/index.js";import{isBuildBelowMinimum as Rt,parseBuildNumber as zt}from"./versionCheck/buildNumber.js";import{addDeployedBuildListener as Bt,getNewerDeployedBuild as Vt,startDeployedBuildCheck as Ht}from"./versionCheck/deployedBuild.js";import{installReloadOnNavigate as Ut,isUpdateAvailable as Wt,useVersionCheck as Gt}from"./versionCheck/index.js";export{b as ACCESS_TOKEN_KEY,V as ACCOUNT_ID_HEADER,Ye as APP_API_DEFAULTS,H as CLIENT_BUILD_HEADER,U as CLIENT_KIND,W as CLIENT_KIND_HEADER,xe as CONTRACT_ERROR_CODE,e as DEFAULT_BUILD_CHECK_INTERVAL_MS,t as DEFAULT_LOG_LEVEL,n as DEFAULT_RETRIES,r as DEFAULT_TIMEOUT_MS,i as DEFAULT_VERSION_URL,K as DESIGN_SAMPLE_HEADER,q as DESIGN_SAMPLE_QUERY_KEY,J as DESIGN_SAMPLE_STORAGE_KEY,bt as ErrorBoundary,re as IDEMPOTENCY_KEY_HEADER,x as LEGACY_REFRESH_TOKEN_LIFETIME_MS,rt as LIST_TAG_ID,f as Logger,Z as MIN_APP_VERSION_HEADER,Se as NETWORK_CODE,Ce as OFFLINE_CODE,we as OFFLINE_MESSAGE,Et as PublicOnly,le as REFRESH_LOCK_NAME,S as REFRESH_TOKEN_KEY,Te as REQUEST_CANCELED_CODE,St as RETURN_TO_PARAM,ye as RequestOfflineError,Dt as RequireAuth,Ot as RequirePermission,ft as SERIALIZABLE_IGNORED_ACTION_PATHS,Ee as SERVER_FAILURE_MESSAGE,fe as SESSION_EXPIRED_CODE,pe as SESSION_REVOKED_CODE,C as SESSION_USER_KEY,Pt as Storage,De as TIMEOUT_CODE,Oe as TIMEOUT_MESSAGE,l as TRACEPARENT_HEADER,ke as UNEXPECTED_MESSAGE,Ae as UNREACHABLE_MESSAGE,ee as WORKSPACE_CHANGED_CODE,te as WorkspaceChangedError,ze as addDays,Bt as addDeployedBuildListener,Q as addMinAppVersionListener,L as addNetworkStatusListener,w as addSessionEndedListener,je as apiErrorMessage,Y as applyDesignSample,u as applyRequestDefaults,ie as attachRetry,Qe as buildListQuery,Ct as buildLoginPath,vt as classifyRouteError,T as clearSession,Ie as configureFormatters,p as configureLogger,Je as createApiBaseQuery,Xe as createAppApi,ut as createRootReducer,_ as decodeJWT,ct as errorToastMiddleware,Me as extractApiError,Re as formatCurrency,Be as formatDate,Ve as formatDateTime,He as formatMinor,Ue as formatNumber,We as formatPercent,Ge as formatRelative,Ke as formatTime,G as getClientBuild,a as getConfig,o as getConfigValue,m as getDeviceContext,Le as getFormatterConfig,v as getJWTExpiry,E as getKeepSignedIn,$ as getMinAppVersion,R as getNetworkStatus,Vt as getNewerDeployedBuild,$e as getNextPageParam,et as getPreviousPageParam,wt as getReturnTo,D as getSessionUser,O as getToken,tt as hasNextPage,xt as hasPermission,nt as hasPreviousPage,pt as hasRecentlyReloaded,k as hasSession,A as hasSessionEndedInTab,mt as importWithReload,be as initUserAuth,qe as initWebority,me as injectStore,he as injectUserAuth,Ut as installReloadOnNavigate,Ne as isApiError,Rt as isBuildBelowMinimum,ht as isChunkLoadError,y as isJWTExpired,ae as isNeverSentError,Pe as isNoResponse,oe as isRetryableFailure,se as isRetryableStatus,lt as isSilentRejection,Ft as isStorageAvailable,Wt as isUpdateAvailable,ne as isWorkspaceChangedError,it as itemTag,gt as lazyWithReload,at as listTag,_t as markReloaded,d as newTraceparent,zt as parseBuildNumber,ot as providesList,st as providesPagedList,de as publicClient,kt as publicOnly,X as readDesignSampleTicket,ge as refreshAccessToken,j as removeSessionUser,M as removeToken,At as requireAuth,jt as requirePermission,s as resetConfig,_e as resetRefreshState,dt as resetState,ce as retryAfterMs,c as setConfig,h as setDeviceContext,N as setKeepSignedIn,P as setLegacyTokenKeys,z as setNetworkStatusImplementation,g as setRemoteLogger,It as setStorageImplementation,Ze as setupApiListeners,Ht as startDeployedBuildCheck,Nt as staticUrl,F as storeSessionUser,I as storeToken,Lt as syncStorage,Fe as toFieldPath,Tt as toSafeReturnTo,B as useNetworkStatus,yt as useRouteErrorReport,Gt as useVersionCheck,ve as userClient,ue as withCrossTabRefreshLock,Mt as withGuards};
@@ -0,0 +1 @@
1
+ import{Logger as e}from"../logger/logger.js";import{reloadForChunkError as t}from"./chunkReload.js";import{classifyRouteError as n}from"./routeError.js";import{Component as r}from"react";var i=class extends r{state={kind:null};static getDerivedStateFromError(e){return{kind:n(e)}}componentDidCatch(r){n(r)===`stale-build`&&t(r)===`reloading`||e.error(`[router] the app's root boundary caught an error`,r)}render(){let{kind:e}=this.state;return e===null?this.props.children:this.props.fallback({kind:e})}};export{i as ErrorBoundary};
@@ -1 +1 @@
1
- import{hasRecentlyReloaded as e,importWithReload as t,isChunkLoadError as n,lazyWithReload as r,markReloaded as i}from"./chunkReload.js";import{hasPermission as a}from"./permissions.js";import{RETURN_TO_PARAM as o,buildLoginPath as s,getReturnTo as c,toSafeReturnTo as l}from"./returnTo.js";import{PublicOnly as u,RequireAuth as d,RequirePermission as f}from"./guards.js";import{publicOnly as p,requireAuth as m,requirePermission as h,withGuards as g}from"./loaders.js";import{classifyRouteError as _,useRouteErrorReport as v}from"./routeError.js";export{u as PublicOnly,o as RETURN_TO_PARAM,d as RequireAuth,f as RequirePermission,s as buildLoginPath,_ as classifyRouteError,c as getReturnTo,a as hasPermission,e as hasRecentlyReloaded,t as importWithReload,n as isChunkLoadError,r as lazyWithReload,i as markReloaded,p as publicOnly,m as requireAuth,h as requirePermission,l as toSafeReturnTo,v as useRouteErrorReport,g as withGuards};
1
+ import{hasRecentlyReloaded as e,importWithReload as t,isChunkLoadError as n,lazyWithReload as r,markReloaded as i}from"./chunkReload.js";import{classifyRouteError as a,useRouteErrorReport as o}from"./routeError.js";import{ErrorBoundary as s}from"./ErrorBoundary.js";import{hasPermission as c}from"./permissions.js";import{RETURN_TO_PARAM as l,buildLoginPath as u,getReturnTo as d,toSafeReturnTo as f}from"./returnTo.js";import{PublicOnly as p,RequireAuth as m,RequirePermission as h}from"./guards.js";import{publicOnly as g,requireAuth as _,requirePermission as v,withGuards as y}from"./loaders.js";export{s as ErrorBoundary,p as PublicOnly,l as RETURN_TO_PARAM,m as RequireAuth,h as RequirePermission,u as buildLoginPath,a as classifyRouteError,d as getReturnTo,c as hasPermission,e as hasRecentlyReloaded,t as importWithReload,n as isChunkLoadError,r as lazyWithReload,i as markReloaded,g as publicOnly,_ as requireAuth,v as requirePermission,f as toSafeReturnTo,o as useRouteErrorReport,y as withGuards};
@@ -0,0 +1,21 @@
1
+ import { Component, type ReactNode } from "react";
2
+ import { type RouteErrorKind } from "./routeError";
3
+ export interface ErrorBoundaryProps {
4
+ children: ReactNode;
5
+ fallback: (report: {
6
+ kind: RouteErrorKind;
7
+ }) => ReactNode;
8
+ }
9
+ /** The app's root boundary: classifies the error with classifyRouteError, logs it through Logger.error, reloads once through reloadForChunkError on a stale build, and renders fallback (AppRouteError in a portal). */
10
+ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
11
+ kind: RouteErrorKind | null;
12
+ }> {
13
+ state: {
14
+ kind: RouteErrorKind | null;
15
+ };
16
+ static getDerivedStateFromError(error: unknown): {
17
+ kind: RouteErrorKind;
18
+ };
19
+ componentDidCatch(error: unknown): void;
20
+ render(): ReactNode;
21
+ }
@@ -1,4 +1,6 @@
1
1
  export { hasRecentlyReloaded, importWithReload, isChunkLoadError, lazyWithReload, markReloaded } from "./chunkReload";
2
+ export type { ErrorBoundaryProps } from "./ErrorBoundary";
3
+ export { ErrorBoundary } from "./ErrorBoundary";
2
4
  export type { PublicOnlyProps, RequireAuthProps, RequirePermissionProps } from "./guards";
3
5
  export { PublicOnly, RequireAuth, RequirePermission } from "./guards";
4
6
  export type { GuardLoader, PublicOnlyLoaderOptions, RequireAuthLoaderOptions, RequirePermissionLoaderOptions, SignedInCheck, } from "./loaders";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/web-core",
3
- "version": "0.106.0",
3
+ "version": "0.108.0",
4
4
  "description": "Platform layer for Webority React web portals: HTTP clients with single-flight token refresh, auth store, API error extraction, RTK Query base query, logger, formatters, storage, version check and route guards. No UI.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -81,6 +81,9 @@
81
81
  "./package.json": "./package.json"
82
82
  },
83
83
  "sideEffects": false,
84
+ "dependencies": {
85
+ "@webority/ui-elements": "0.108.0"
86
+ },
84
87
  "peerDependencies": {
85
88
  "@reduxjs/toolkit": "^2.12.0",
86
89
  "axios": "^1.18.0",