@webority/web-core 0.148.0 → 0.150.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.
Files changed (79) hide show
  1. package/README.md +28 -6
  2. package/dist/api/blobErrorBody.js +1 -0
  3. package/dist/api/contractCaller.js +1 -0
  4. package/dist/api/crossTabRefreshLock.js +1 -1
  5. package/dist/api/designSample.js +1 -1
  6. package/dist/api/downloadFile.js +1 -0
  7. package/dist/api/index.js +1 -1
  8. package/dist/api/minAppVersion.js +1 -1
  9. package/dist/api/retry.js +1 -1
  10. package/dist/api/tokenRefresh.js +1 -1
  11. package/dist/api/userClient.js +1 -1
  12. package/dist/api/workspaceChanged.js +1 -1
  13. package/dist/api-contract/dist/call.js +1 -0
  14. package/dist/appInsights/appInsights.js +1 -0
  15. package/dist/appInsights/index.js +1 -0
  16. package/dist/auth/authStore.js +1 -1
  17. package/dist/auth/jwt.js +1 -1
  18. package/dist/errors/extractApiError.js +2 -2
  19. package/dist/errors/index.js +1 -1
  20. package/dist/errors/parseResponse.js +1 -0
  21. package/dist/errors/requestPlatform.js +1 -0
  22. package/dist/formatters/currency.js +1 -1
  23. package/dist/formatters/formatConfig.js +1 -1
  24. package/dist/formatters/house.js +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/india/gstStates.js +1 -0
  27. package/dist/india/index.js +1 -1
  28. package/dist/logger/logger.js +2 -2
  29. package/dist/logger/redact.js +1 -1
  30. package/dist/network/networkStatus.js +1 -1
  31. package/dist/query/apiBaseQuery.js +1 -1
  32. package/dist/query/createAppApi.js +1 -1
  33. package/dist/query/dataState.js +1 -0
  34. package/dist/query/index.js +1 -1
  35. package/dist/query/listQuery.js +1 -1
  36. package/dist/query/tags.js +1 -1
  37. package/dist/query/useListQuery.js +1 -1
  38. package/dist/redux/errorToastMiddleware.js +1 -1
  39. package/dist/redux/rootReducer.js +1 -1
  40. package/dist/router/chunkReload.js +1 -1
  41. package/dist/router/index.js +1 -1
  42. package/dist/router/returnTo.js +1 -1
  43. package/dist/router/routeTable.js +1 -0
  44. package/dist/storage/index.js +1 -1
  45. package/dist/types/api/blobErrorBody.d.ts +9 -0
  46. package/dist/types/api/contractCaller.d.ts +11 -0
  47. package/dist/types/api/downloadFile.d.ts +19 -0
  48. package/dist/types/api/index.d.ts +6 -0
  49. package/dist/types/api/tokenRefresh.d.ts +2 -1
  50. package/dist/types/appInsights/appInsights.d.ts +30 -0
  51. package/dist/types/appInsights/index.d.ts +3 -0
  52. package/dist/types/auth/authStore.d.ts +2 -1
  53. package/dist/types/auth/jwt.d.ts +11 -8
  54. package/dist/types/errors/extractApiError.d.ts +2 -15
  55. package/dist/types/errors/index.d.ts +2 -0
  56. package/dist/types/errors/parseResponse.d.ts +19 -0
  57. package/dist/types/errors/requestPlatform.d.ts +5 -0
  58. package/dist/types/formatters/formatConfig.d.ts +8 -6
  59. package/dist/types/formatters/house.d.ts +19 -20
  60. package/dist/types/formatters/intlCache.d.ts +1 -3
  61. package/dist/types/india/gstStates.d.ts +7 -0
  62. package/dist/types/india/gstStates.g.d.ts +1 -1
  63. package/dist/types/india/index.d.ts +1 -0
  64. package/dist/types/initUserAuth.d.ts +2 -1
  65. package/dist/types/logger/redact.d.ts +3 -1
  66. package/dist/types/query/apiBaseQuery.d.ts +1 -1
  67. package/dist/types/query/dataState.d.ts +38 -0
  68. package/dist/types/query/index.d.ts +2 -0
  69. package/dist/types/query/listQuery.d.ts +2 -2
  70. package/dist/types/query/useListQuery.d.ts +8 -6
  71. package/dist/types/redux/index.d.ts +1 -1
  72. package/dist/types/redux/rootReducer.d.ts +7 -2
  73. package/dist/types/router/chunkReload.d.ts +5 -2
  74. package/dist/types/router/index.d.ts +2 -0
  75. package/dist/types/router/routeTable.d.ts +66 -0
  76. package/dist/types/storage/index.d.ts +10 -8
  77. package/dist/versionCheck/deployedBuild.js +1 -1
  78. package/dist/vite/index.js +1 -1
  79. package/package.json +20 -5
@@ -1,12 +1,14 @@
1
+ import { type ApiError } from "../errors";
2
+ import type { DataState } from "./dataState";
1
3
  import { type Facet } from "./listQuery";
2
- import type { PagedDataObject, SortOrder } from "./paging";
4
+ import type { ListFilterValue, PagedDataObject, SortOrder } from "./paging";
3
5
  export interface ListQueryState {
4
6
  page: number;
5
7
  pageSize?: number;
6
8
  sortBy?: string;
7
9
  sortOrder: SortOrder;
8
10
  search: string;
9
- filters: Record<string, unknown>;
11
+ filters: Record<string, ListFilterValue>;
10
12
  }
11
13
  export interface UseListQueryOptions<TRow> {
12
14
  fetchPage: (query: ListQueryState, options: {
@@ -16,21 +18,21 @@ export interface UseListQueryOptions<TRow> {
16
18
  defaults?: Partial<ListQueryState>;
17
19
  /** Milliseconds a typed search or text filter waits before the list refetches. */
18
20
  debounceMs?: number;
21
+ /** Called when a refresh fails while rows are shown; the rows stay. */
22
+ onRefreshError?: (error: ApiError) => void;
19
23
  }
20
24
  export interface UseListQueryResult<TRow> {
21
25
  query: ListQueryState;
22
26
  rows: TRow[];
23
- loading: boolean;
24
- error: unknown;
27
+ state: DataState<PagedDataObject<TRow>>;
25
28
  totalCount: number;
26
29
  totalPages: number;
27
- setFilter(key: string, value: unknown): void;
30
+ setFilter(key: string, value: ListFilterValue): void;
28
31
  setSearch(text: string): void;
29
32
  setSort(sortBy: string, sortOrder?: SortOrder): void;
30
33
  setPage(page: number): void;
31
34
  setPageSize(pageSize: number): void;
32
35
  reset(): void;
33
- refetch(): void;
34
36
  tableProps: {
35
37
  rows: TRow[];
36
38
  sort?: {
@@ -1,5 +1,5 @@
1
1
  export type { ErrorToastOptions, OnRejected, RejectionDecision, ShowErrorToast } from "./errorToastMiddleware";
2
2
  export { errorToastMiddleware, isSilentRejection } from "./errorToastMiddleware";
3
- export type { RootReducerOptions } from "./rootReducer";
3
+ export type { ResetStateOptions, RootReducerOptions } from "./rootReducer";
4
4
  export { createRootReducer, resetState } from "./rootReducer";
5
5
  export { SERIALIZABLE_IGNORED_ACTION_PATHS } from "./serializableCheck";
@@ -1,10 +1,15 @@
1
1
  import { type ActionFromReducersMapObject, type Reducer, type ReducersMapObject, type StateFromReducersMapObject } from "@reduxjs/toolkit";
2
+ export interface ResetStateOptions {
3
+ /** Slices this reset keeps on top of the reducer's preserve list (a workspace switch keeps the session and the API cache). */
4
+ keep?: readonly string[] | undefined;
5
+ }
2
6
  /**
3
7
  * Clears every slice, the RTK Query cache included, in one dispatch. Dispatch it on logout
4
8
  * (decision 22). Not a tidy-up: a slice left behind paints the previous user's data on the
5
- * next sign-in before fresh fetches land, which on a shared device is a data leak.
9
+ * next sign-in before fresh fetches land, which on a shared device is a data leak. Pass `{ keep }`
10
+ * to keep named slices for this one reset, such as the session and the API cache on a workspace switch.
6
11
  */
7
- export declare const resetState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"app/resetState">;
12
+ export declare const resetState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[options?: ResetStateOptions | undefined], ResetStateOptions, "app/resetState", never, never>;
8
13
  export interface RootReducerOptions<K extends string> {
9
14
  /** Slices that survive a reset because they belong to the device, not the user (theme, onboarding seen). */
10
15
  preserve?: readonly K[];
@@ -1,6 +1,8 @@
1
- import { type ComponentType, type LazyExoticComponent } from "react";
1
+ import { type ComponentType, type LazyExoticComponent, lazy } from "react";
2
2
  /** Whether `error` is a lazy chunk that failed to load, the signature of a tab older than the deploy. */
3
3
  export declare const isChunkLoadError: (error: unknown) => boolean;
4
+ /** Any component `React.lazy` accepts, taken from React's own declaration. */
5
+ type LazyComponent = Awaited<ReturnType<Parameters<typeof lazy>[0]>>["default"];
4
6
  /**
5
7
  * Whether a recovery reload of the current page (path, query and hash) was claimed inside the
6
8
  * window (60 s). An app's own error boundary asks this before reloading for a chunk error, so the
@@ -37,6 +39,7 @@ export declare const importWithReload: <T extends object>(importFn: () => Promis
37
39
  * `React.lazy` with the same one reload: a lazy screen that recovers a tab opened before a deploy.
38
40
  * It renders after the navigation has committed, so the reload is of the page it is on.
39
41
  */
40
- export declare const lazyWithReload: <C extends ComponentType<any>>(importFn: () => Promise<{
42
+ export declare const lazyWithReload: <C extends LazyComponent>(importFn: () => Promise<{
41
43
  default: C;
42
44
  }>) => LazyExoticComponent<C>;
45
+ export {};
@@ -11,3 +11,5 @@ export type { ReturnToSource } from "./returnTo";
11
11
  export { buildLoginPath, getReturnTo, RETURN_TO_PARAM, toSafeReturnTo } from "./returnTo";
12
12
  export type { RouteErrorKind, RouteErrorReport } from "./routeError";
13
13
  export { classifyRouteError, useRouteErrorReport } from "./routeError";
14
+ export type { RouteTableEntry, RouteTablePages } from "./routeTable";
15
+ export { defineRouteTable } from "./routeTable";
@@ -0,0 +1,66 @@
1
+ import type { PathParam } from "react-router";
2
+ /** One route as a portal's table declares it: a literal path or an index route, and its children. Other RouteObject keys pass through untouched. */
3
+ export type RouteTableEntry = {
4
+ readonly path?: string;
5
+ readonly index?: boolean;
6
+ readonly children?: readonly RouteTableEntry[];
7
+ };
8
+ /**
9
+ * The full path of every entry, parent and child segments joined, as React Router's Register["pages"]: each path maps to its params.
10
+ * A child path that starts with "/" stands alone. A table whose paths lost their literal types (a plain `string`) resolves to a
11
+ * single `RouteTableNeedsLiteralPaths` key instead, so every `href` call against it fails rather than every path being accepted.
12
+ */
13
+ export type RouteTablePages<T extends readonly RouteTableEntry[]> = true extends HasWidePath<T> ? {
14
+ RouteTableNeedsLiteralPaths: never;
15
+ } : {
16
+ [P in FullPaths<T, "">]: {
17
+ params: PathParams<P>;
18
+ };
19
+ };
20
+ /** A `:name` segment is required, a `:name?` segment is optional and a trailing `*` is the splat key, as `href` takes them. */
21
+ type PathParams<P extends string> = Flatten<{
22
+ [K in PathParam<P> as K extends OptionalNames<P> ? never : K]: string;
23
+ } & {
24
+ [K in PathParam<P> as K extends OptionalNames<P> ? K : never]?: string;
25
+ }>;
26
+ type Flatten<T> = {
27
+ [K in keyof T]: T[K];
28
+ } & {};
29
+ type Segments<P extends string> = P extends `${infer Head}/${infer Rest}` ? Head | Segments<Rest> : P;
30
+ type OptionalName<S extends string> = S extends `:${infer Name}?${string}` ? Name : never;
31
+ type OptionalNames<P extends string> = OptionalName<Segments<P>>;
32
+ /** Parent joined with a child path: an absolute child stands alone, and a root parent adds no second slash. */
33
+ type Join<Parent extends string, Child extends string> = Child extends `/${string}` ? Child : Child extends "" ? Parent extends "" ? "/" : Parent : Parent extends "" | "/" ? `/${Child}` : Parent extends `${infer Base}/` ? `${Base}/${Child}` : `${Parent}/${Child}`;
34
+ /** The full path an entry itself answers on: its joined path, or the parent's path for an index route, or none for a layout. */
35
+ type OwnPath<E extends RouteTableEntry, Parent extends string> = E extends {
36
+ readonly path: infer P extends string;
37
+ } ? Join<Parent, P> : E extends {
38
+ readonly index: true;
39
+ } ? Parent extends "" ? "/" : Parent : never;
40
+ /** The path children of an entry resolve against: a layout route (no path, no index) passes its parent's path on. */
41
+ type ChildParent<E extends RouteTableEntry, Parent extends string> = E extends {
42
+ readonly path: infer P extends string;
43
+ } ? Join<Parent, P> : Parent;
44
+ type EntryPaths<E extends RouteTableEntry, Parent extends string> = E extends RouteTableEntry ? OwnPath<E, Parent> | ChildPaths<E, ChildParent<E, Parent>> : never;
45
+ type ChildPaths<E extends RouteTableEntry, Parent extends string> = E extends {
46
+ readonly children: infer C extends readonly RouteTableEntry[];
47
+ } ? FullPaths<C, Parent> : never;
48
+ type FullPaths<T extends readonly RouteTableEntry[], Parent extends string> = EntryPaths<T[number], Parent>;
49
+ /** Whether any entry, at any depth, has a path typed as plain `string` (or optional), which no literal list can come from. */
50
+ type HasWidePath<T extends readonly RouteTableEntry[]> = WidePath<T[number]>;
51
+ type WidePath<E extends RouteTableEntry> = E extends RouteTableEntry ? (string extends E["path" & keyof E] ? true : never) | WideChildren<E> : never;
52
+ type WideChildren<E extends RouteTableEntry> = E extends {
53
+ readonly children: infer C extends readonly RouteTableEntry[];
54
+ } ? WidePath<C[number]> : never;
55
+ /** The table with every list made mutable at each depth, so React Router's RouteObject[] takes it as it is; paths keep their literal types. */
56
+ type MutableRoutes<T extends readonly RouteTableEntry[]> = {
57
+ -readonly [I in keyof T]: MutableRoute<T[I]>;
58
+ };
59
+ type MutableRoute<E> = E extends {
60
+ readonly children: infer C extends readonly RouteTableEntry[];
61
+ } ? Omit<E, "children"> & {
62
+ children: MutableRoutes<C>;
63
+ } : E;
64
+ /** Returns the table unchanged, keeping each path's literal type for RouteTablePages and passing straight to createBrowserRouter. */
65
+ export declare function defineRouteTable<const T extends readonly RouteTableEntry[]>(routes: T): MutableRoutes<T>;
66
+ export {};
@@ -33,7 +33,7 @@ export interface StorageApi {
33
33
  getItem: (key: string) => Promise<string | null>;
34
34
  setItem: (key: string, value: string) => Promise<boolean>;
35
35
  removeItem: (key: string) => Promise<boolean>;
36
- getJson: <T>(key: string) => Promise<T | null>;
36
+ getJson: <T>(key: string, parse: (value: unknown) => T) => Promise<T | null>;
37
37
  setJson: <T>(key: string, value: T) => Promise<boolean>;
38
38
  multiGet: (keys: readonly string[]) => Promise<Record<string, string | null>>;
39
39
  multiSet: (entries: Record<string, string>) => Promise<boolean>;
@@ -53,20 +53,22 @@ export interface StorageApi {
53
53
  */
54
54
  export declare const Storage: StorageApi;
55
55
  /**
56
- * Synchronous localStorage for reads a first render cannot wait for: a theme, a collapsed
57
- * sidebar, a table's sort. Web only; mobile-core has no synchronous store (its backends are
58
- * asynchronous), so code shared with an app uses `Storage`. Like `Storage`, nothing here
59
- * throws: a blocked or full localStorage reads as empty and a write reports `false`. Not for
60
- * tokens.
56
+ * Synchronous browser storage for reads a first render cannot wait for: a theme, a collapsed
57
+ * sidebar, a table's sort (`syncStorage`, over localStorage), or state that ends with the tab
58
+ * (`syncSessionStorage`, over sessionStorage). Web only; mobile-core has no synchronous store
59
+ * (its backends are asynchronous), so code shared with an app uses `Storage`. Like `Storage`,
60
+ * nothing here throws: a blocked or full store reads as empty and a write reports `false`.
61
+ * Not for tokens.
61
62
  */
62
63
  export interface SyncStorageApi {
63
64
  getItem: (key: string) => string | null;
64
65
  setItem: (key: string, value: string) => boolean;
65
66
  removeItem: (key: string) => boolean;
66
- /** The parsed value, or null when nothing is stored or it is not JSON. */
67
- getJson: <T>(key: string) => T | null;
67
+ /** The value parse builds, or null when nothing is stored or it is not JSON. A throw from parse propagates. */
68
+ getJson: <T>(key: string, parse: (value: unknown) => T) => T | null;
68
69
  /** False when the value cannot be serialised or the write is refused. */
69
70
  setJson: <T>(key: string, value: T) => boolean;
70
71
  }
71
72
  export declare const syncStorage: SyncStorageApi;
73
+ export declare const syncSessionStorage: SyncStorageApi;
72
74
  export type { AsyncStorageLike };
@@ -1 +1 @@
1
- import{getConfigValue as e}from"../config/index.js";import{Logger as t}from"../logger/logger.js";var n=null,r=/* @__PURE__ */ new Set,i=null,a=()=>void 0,o=()=>n,s=e=>(r.add(e),()=>{r.delete(e)}),c=()=>{for(let e of[...r])try{e()}catch(e){t.error(`[VersionCheck] a deployed-build listener threw`,e)}},l=()=>{if(typeof window>`u`)return a;if(i!==null)return i;let r=e(`buildId`);if(!r)return t.warn(`[VersionCheck] buildId is not configured; call setConfig({ buildId }) with the marker the build stamps`),i=a,a;let o=e(`versionUrl`),s=e(`buildCheckIntervalMs`),l=!1,u=async()=>{if(!l){l=!0;try{let e=await fetch(o,{cache:`no-store`});if(!e.ok)return;let t=(await e.json())?.version,i=typeof t==`string`?t.trim():``;i!==``&&i!==r&&(n=i,c(),p())}catch(e){t.debug(`[VersionCheck] the deployed-build check failed`,e)}finally{l=!1}}},d=()=>{document.visibilityState===`visible`&&u()},f=setInterval(()=>void u(),s),p=()=>{clearInterval(f),document.removeEventListener(`visibilitychange`,d)};return document.addEventListener(`visibilitychange`,d),i=p,p};export{s as addDeployedBuildListener,o as getNewerDeployedBuild,l as startDeployedBuildCheck};
1
+ import{getConfigValue as e}from"../config/index.js";import{Logger as t}from"../logger/logger.js";var n=null,r=/* @__PURE__ */ new Set,i=null,a=()=>void 0,o=()=>n,s=e=>(r.add(e),()=>{r.delete(e)}),c=()=>{for(let e of[...r])try{e()}catch(e){t.error(`[VersionCheck] a deployed-build listener threw`,e)}},l=()=>{if(typeof window>`u`)return a;if(i!==null)return i;let r=e(`buildId`);if(!r)return t.warn(`[VersionCheck] buildId is not configured; call setConfig({ buildId }) with the marker the build stamps`),i=a,a;let o=e(`versionUrl`),s=e(`buildCheckIntervalMs`),l=!1,u=async()=>{if(!l){l=!0;try{let e=await fetch(o,{cache:`no-store`});if(!e.ok)return;let t=await e.json(),i=typeof t==`object`&&t&&`version`in t?t.version:void 0,a=typeof i==`string`?i.trim():``;a!==``&&a!==r&&(n=a,c(),p())}catch(e){t.debug(`[VersionCheck] the deployed-build check failed`,e)}finally{l=!1}}},d=()=>{document.visibilityState===`visible`&&u()},f=setInterval(()=>void u(),s),p=()=>{clearInterval(f),document.removeEventListener(`visibilitychange`,d)};return document.addEventListener(`visibilitychange`,d),i=p,p};export{s as addDeployedBuildListener,o as getNewerDeployedBuild,l as startDeployedBuildCheck};
@@ -1 +1 @@
1
- import{existsSync as e,readFileSync as t}from"node:fs";import{basename as n,dirname as r,join as i,resolve as a}from"node:path";var o=`virtual:webority-static-assets`,s=`\0${o}`,c=i(`.webority`,`infra`,`deployables.json`),l=/^https:\/\/[a-z0-9.-]+(:\d+)?$/,u=/^[0-9a-f]{64}$/,d=12,f=`export default null;`;function p(e,t){let n=t?.trim();if(!n)return null;if(n!==`/`&&!l.test(n))throw Error(`weborityStatic: ${e} must be "/" or an https origin with no path and no trailing slash, got "${n}".`);return n}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(t){let n=i(t,c);if(e(n))return n;let a=r(t);return a===t?null:h(a)}function g(e){let n;try{n=JSON.parse(t(e,`utf8`))}catch(t){throw Error(`weborityStatic: cannot read ${e}: ${t instanceof Error?t.message:String(t)}`)}let r=m(n)?n.deployables:void 0;if(!m(r))throw Error(`weborityStatic: ${e} has no "deployables" object.`);let i=Object.entries(r).filter(([,e])=>m(e)&&`staticAssets`in e);if(i.length===0)return null;if(i.length>1)throw Error(`weborityStatic: ${e} must have exactly one deployable with "staticAssets"; it has ${i.length}.`);let[a]=i;if(a===void 0)throw Error(`weborityStatic: ${e} lost its carrier deployable.`);let[o,s]=a,c=s.staticAssets,l=m(c)?c.assets:void 0;if(!m(l))throw Error(`weborityStatic: ${e}: deployable '${o}' has no "staticAssets.assets" object.`);let f={};for(let[t,n]of Object.entries(l)){let r=n?.sha256;if(typeof r!=`string`||!u.test(r))throw Error(`weborityStatic: ${e} asset "${t}" needs a sha256 of 64 lowercase hex characters.`);f[t]=r.slice(0,d)}return{carrier:o,versions:f}}function _(e={}){let t=p(`authoredOrigin`,e.authoredOrigin),r=p(`buildOrigin`,e.buildOrigin),i=``,o=f;return{name:`webority-static`,enforce:`pre`,config(e,t){if(r===null||t.command!==`build`)return;let n=r===`/`?``:r;return{experimental:{renderBuiltUrl:(e,t)=>t.type===`public`?void 0:`${n}/_static/${i}/${e.replace(/^\/+/,``)}`}}},configResolved(s){let c=a(s.root);if(i=n(c).toLowerCase().replaceAll(`.`,`-`),r!==null&&i===``)throw Error(`weborityStatic: cannot name the head from the Vite root "${c}".`);let l=e.manifest?a(c,e.manifest):h(c),u=l===null?null:g(l);if(u===null){if(t!==null)throw Error(`weborityStatic: authoredOrigin is set but ${l??`no .webority/infra/deployables.json above the Vite root`} has no deployable carrying "staticAssets".`);o=f}else{if(t===null)throw Error(`weborityStatic: ${l} has a deployable carrying staticAssets, so authoredOrigin is required ("/" or an https origin).`);o=`export default ${JSON.stringify({authoredOrigin:t,versions:u.versions})};`}},resolveId(e){return e===`virtual:webority-static-assets`?s:null},load(e){return e===s?o:null}}}export{o as STATIC_ASSETS_MODULE_ID,_ as weborityStatic};
1
+ import{existsSync as e,readFileSync as t}from"node:fs";import{basename as n,dirname as r,join as i,resolve as a}from"node:path";var o=`virtual:webority-static-assets`,s=`\0${o}`,c=i(`.webority`,`infra`,`deployables.json`),l=/^https:\/\/[a-z0-9.-]+(:\d+)?$/,u=/^[0-9a-f]{64}$/,d=12,f=`export default null;`;function p(e,t){let n=t?.trim();if(!n)return null;if(n!==`/`&&!l.test(n))throw Error(`weborityStatic: ${e} must be "/" or an https origin with no path and no trailing slash, got "${n}".`);return n}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(t){let n=i(t,c);if(e(n))return n;let a=r(t);return a===t?null:h(a)}function g(e){let n;try{n=JSON.parse(t(e,`utf8`))}catch(t){throw Error(`weborityStatic: cannot read ${e}: ${t instanceof Error?t.message:String(t)}`)}let r=m(n)?n.deployables:void 0;if(!m(r))throw Error(`weborityStatic: ${e} has no "deployables" object.`);let i=Object.entries(r).filter(e=>m(e[1])&&`staticAssets`in e[1]);if(i.length===0)return null;if(i.length>1)throw Error(`weborityStatic: ${e} must have exactly one deployable with "staticAssets"; it has ${i.length}.`);let[a]=i;if(a===void 0)throw Error(`weborityStatic: ${e} lost its carrier deployable.`);let[o,s]=a,c=s.staticAssets,l=m(c)?c.assets:void 0;if(!m(l))throw Error(`weborityStatic: ${e}: deployable '${o}' has no "staticAssets.assets" object.`);let f={};for(let[t,n]of Object.entries(l)){let r=m(n)?n.sha256:void 0;if(typeof r!=`string`||!u.test(r))throw Error(`weborityStatic: ${e} asset "${t}" needs a sha256 of 64 lowercase hex characters.`);f[t]=r.slice(0,d)}return{carrier:o,versions:f}}function _(e={}){let t=p(`authoredOrigin`,e.authoredOrigin),r=p(`buildOrigin`,e.buildOrigin),i=``,o=f;return{name:`webority-static`,enforce:`pre`,config(e,t){if(r===null||t.command!==`build`)return;let n=r===`/`?``:r;return{experimental:{renderBuiltUrl:(e,t)=>t.type===`public`?void 0:`${n}/_static/${i}/${e.replace(/^\/+/,``)}`}}},configResolved(s){let c=a(s.root);if(i=n(c).toLowerCase().replaceAll(`.`,`-`),r!==null&&i===``)throw Error(`weborityStatic: cannot name the head from the Vite root "${c}".`);let l=e.manifest?a(c,e.manifest):h(c),u=l===null?null:g(l);if(u===null){if(t!==null)throw Error(`weborityStatic: authoredOrigin is set but ${l??`no .webority/infra/deployables.json above the Vite root`} has no deployable carrying "staticAssets".`);o=f}else{if(t===null)throw Error(`weborityStatic: ${l} has a deployable carrying staticAssets, so authoredOrigin is required ("/" or an https origin).`);o=`export default ${JSON.stringify({authoredOrigin:t,versions:u.versions})};`}},resolveId(e){return e===`virtual:webority-static-assets`?s:null},load(e){return e===s?o:null}}}export{o as STATIC_ASSETS_MODULE_ID,_ as weborityStatic};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/web-core",
3
- "version": "0.148.0",
3
+ "version": "0.150.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",
@@ -26,6 +26,10 @@
26
26
  "types": "./dist/types/api/index.d.ts",
27
27
  "default": "./dist/api/index.js"
28
28
  },
29
+ "./appInsights": {
30
+ "types": "./dist/types/appInsights/index.d.ts",
31
+ "default": "./dist/appInsights/index.js"
32
+ },
29
33
  "./auth": {
30
34
  "types": "./dist/types/auth/index.d.ts",
31
35
  "default": "./dist/auth/index.js"
@@ -93,24 +97,35 @@
93
97
  "./package.json": "./package.json"
94
98
  },
95
99
  "sideEffects": false,
100
+ "dependencies": {
101
+ "@webority/api-contract": "0.150.0"
102
+ },
96
103
  "peerDependencies": {
104
+ "@microsoft/applicationinsights-web": "^3.4.5",
97
105
  "@reduxjs/toolkit": "^2.12.0",
98
106
  "axios": "^1.18.0",
99
- "react": "^19.0.0",
107
+ "react": "^19.2.7",
100
108
  "react-redux": "^9.3.0",
101
- "react-router": "^7.16.0"
109
+ "react-router": "^8.5.1"
110
+ },
111
+ "peerDependenciesMeta": {
112
+ "@microsoft/applicationinsights-web": {
113
+ "optional": true
114
+ }
102
115
  },
103
116
  "devDependencies": {
117
+ "@microsoft/applicationinsights-web": "^3.4.5",
104
118
  "@reduxjs/toolkit": "^2.14.0",
105
119
  "@testing-library/react": "^16.3.0",
106
- "@types/react": "^19.2.17",
120
+ "@types/node": "25.6.0",
121
+ "@types/react": "^19.3.0",
107
122
  "@vitest/coverage-v8": "5.1.0",
108
123
  "axios": "^1.18.0",
109
124
  "jsdom": "30.1.1",
110
125
  "react": "^19.3.1",
111
126
  "react-dom": "^19.3.1",
112
127
  "react-redux": "^9.3.0",
113
- "react-router": "^7.16.0",
128
+ "react-router": "^8.5.1",
114
129
  "typescript": "^7.0.2",
115
130
  "vite": "^8.3.6",
116
131
  "vitest": "5.1.0"