@wippy-fe/types-global-proxy 0.0.17 → 0.0.19

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 (2) hide show
  1. package/index.d.ts +122 -90
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4,21 +4,6 @@ import { ConfirmationOptions } from 'primevue/confirmationoptions';
4
4
  import { ToastMessageOptions } from 'primevue/toast';
5
5
  import * as tailwindcss_types_config from 'tailwindcss/types/config';
6
6
 
7
- var session = {
8
- type: "non-persistent"
9
- };
10
- var history = "browser";
11
- var env = {
12
- APP_API_URL: "",
13
- APP_AUTH_API_URL: "",
14
- APP_WEBSOCKET_URL: ""
15
- };
16
- var featureRS = {
17
- session: session,
18
- history: history,
19
- env: env
20
- };
21
-
22
7
  var chat = {
23
8
  emptyState: {
24
9
  title: "No chat session selected",
@@ -101,7 +86,6 @@ var textRS = {
101
86
  keeper: keeper
102
87
  };
103
88
 
104
- type I18NFeatureTypes = typeof featureRS;
105
89
  type I18NTextTypes = typeof textRS;
106
90
 
107
91
  /**
@@ -187,30 +171,50 @@ type ApiRoutesOverride = {
187
171
  };
188
172
  };
189
173
 
190
- interface AppFeatures extends I18NFeatureTypes {
191
- /**
192
- * If to remember auth details or not
193
- */
194
- session: {
195
- type: 'non-persistent' | 'cookie';
196
- };
197
- history: 'browser' | 'hash';
198
- env: {
199
- APP_API_URL: string;
200
- APP_AUTH_API_URL: string;
201
- APP_WEBSOCKET_URL: string;
202
- };
203
- axiosDefaults?: Partial<AxiosDefaults>;
204
- routePrefix?: string;
174
+ interface IconDef {
175
+ body: string;
176
+ width: number;
177
+ height: number;
178
+ }
179
+ interface CssVariablesMap {
180
+ [key: string]: string | Record<string, string> | undefined;
181
+ '@dark'?: Record<string, string>;
182
+ '@light'?: Record<string, string>;
183
+ }
184
+ interface AppAuthConfig {
185
+ token: string;
186
+ expiresAt: string;
187
+ }
188
+ interface ThemingScope {
189
+ cssVariables?: CssVariablesMap;
190
+ customCSS?: string;
191
+ /** @deprecated Use `iconSets` instead */
192
+ icons?: Record<string, IconDef>;
193
+ /** Named icon collections. Each key is an Iconify prefix. */
194
+ iconSets?: Record<string, Record<string, IconDef>>;
195
+ }
196
+ interface HostThemingScope extends ThemingScope {
197
+ i18n?: Partial<I18NTextTypes>;
198
+ }
199
+ interface ChildrenThemingScope {
200
+ cssVariables?: CssVariablesMap;
201
+ customCSS?: string;
202
+ }
203
+ interface AppCustomization {
204
+ customCSS?: string;
205
+ cssVariables?: CssVariablesMap;
206
+ i18n?: Partial<I18NTextTypes>;
207
+ /** @deprecated Use `iconSets` instead. Icons registered under the 'custom' prefix. */
208
+ icons?: Record<string, IconDef>;
209
+ /** Named icon collections. Each key is an Iconify prefix, value is a map of icon name → definition. */
210
+ iconSets?: Record<string, Record<string, IconDef>>;
211
+ }
212
+ interface HostConfig {
205
213
  showAdmin?: boolean;
206
214
  allowSelectModel?: boolean;
207
215
  startNavOpen?: boolean;
208
216
  hideNavBar?: boolean;
209
217
  disableRightPanel?: boolean;
210
- /**
211
- * Hide the session selector dropdown in chat views
212
- * @default false
213
- */
214
218
  hideSessionSelector?: boolean;
215
219
  additionalNavItems?: Array<PageApi.Page>;
216
220
  chat?: {
@@ -221,67 +225,61 @@ interface AppFeatures extends I18NFeatureTypes {
221
225
  };
222
226
  };
223
227
  apiRoutes?: ApiRoutesOverride;
224
- /**
225
- * Additional HTML tags to whitelist in the sanitizer.
226
- * Map of tag name to allowed attribute names.
227
- * 'class' is always implicitly allowed for every tag.
228
- */
229
- allowAdditionalTags?: Record<string, string[]>;
230
- /**
231
- * LRU cache configuration for child iframe state preservation.
232
- * @default { maxPages: 50, maxSizePerPage: 2097152 }
233
- */
234
228
  stateCache?: {
235
- /** Maximum number of page/artifact state buckets to keep. @default 50 */
236
229
  maxPages?: number;
237
- /** Maximum JSON-serialized size per page in bytes. @default 2097152 (2 MB) */
238
230
  maxSizePerPage?: number;
239
231
  };
232
+ allowAdditionalTags?: Record<string, string[]>;
233
+ session?: {
234
+ type: 'non-persistent' | 'cookie';
235
+ };
236
+ history?: 'browser' | 'hash';
240
237
  }
241
- interface AppAuthConfig {
242
- token: string;
243
- expiresAt: string;
244
- }
245
- interface CssVariablesMap {
246
- [key: string]: string | Record<string, string> | undefined;
247
- '@dark'?: Record<string, string>;
248
- '@light'?: Record<string, string>;
238
+ interface AppContext {
239
+ resourceId: string;
240
+ resourceType: 'page' | 'artifact';
241
+ route?: string;
242
+ parentResourceId?: string;
243
+ nestingDepth?: number;
244
+ layoutPanelId?: string;
245
+ layoutId?: string;
246
+ extensions?: Record<string, unknown>;
249
247
  }
250
- interface AppCustomization {
251
- customCSS?: string;
252
- cssVariables?: CssVariablesMap;
253
- i18n?: Partial<I18NTextTypes>;
254
- icons?: Record<string, {
255
- body: string;
256
- width: number;
257
- height: number;
258
- }>;
259
- }
260
- type DeepPartial<T> = T extends object ? {
261
- [P in keyof T]?: DeepPartial<T[P]>;
262
- } : T;
263
- interface AppConfigOverrides {
264
- customization?: Partial<AppCustomization>;
265
- feature?: DeepPartial<AppFeatures>;
248
+ interface AppEnv {
249
+ APP_API_URL: string;
250
+ APP_AUTH_API_URL: string;
251
+ APP_WEBSOCKET_URL: string;
266
252
  }
267
253
  interface AppConfig {
268
- artifactId?: string;
269
- /**
270
- * Starting app or artifact/page path
271
- */
272
- path?: string;
273
- /**
274
- * App features like history mode, session type, etc.
275
- */
276
- feature?: AppFeatures;
277
- /**
278
- * Auth configuration
279
- */
254
+ $schema: string;
280
255
  auth: AppAuthConfig;
281
- /**
282
- * App customization like i18n texts, css variables, custom css, etc.
283
- */
284
- customization?: AppCustomization;
256
+ env: AppEnv;
257
+ axiosDefaults?: Partial<AxiosDefaults>;
258
+ routePrefix?: string;
259
+ theming: {
260
+ global?: ThemingScope;
261
+ host?: HostThemingScope;
262
+ children?: ChildrenThemingScope;
263
+ };
264
+ hostConfig: HostConfig;
265
+ context: AppContext;
266
+ }
267
+ interface ChildAppConfig {
268
+ $schema: string;
269
+ auth: AppAuthConfig;
270
+ env: AppEnv;
271
+ axiosDefaults?: Partial<AxiosDefaults>;
272
+ routePrefix?: string;
273
+ apiRoutes?: ApiRoutesOverride;
274
+ customization: AppCustomization;
275
+ context: AppContext;
276
+ configOverrides?: AppConfigOverrides;
277
+ }
278
+ interface AppConfigOverrides {
279
+ customization?: Partial<AppCustomization>;
280
+ axiosDefaults?: Partial<AxiosDefaults>;
281
+ routePrefix?: string;
282
+ apiRoutes?: ApiRoutesOverride;
285
283
  }
286
284
 
287
285
  declare namespace PageApi {
@@ -752,6 +750,37 @@ type Events = {
752
750
  };
753
751
  declare function createEvents(): <T extends string>(topicPattern: T, callback: T extends KnownTopics ? Events[T] : Events["@message"]) => nanoevents.Unsubscribe;
754
752
 
753
+ declare const LogLevel: {
754
+ readonly Emergency: 0;
755
+ readonly Alert: 1;
756
+ readonly Critical: 2;
757
+ readonly Error: 3;
758
+ readonly Warning: 4;
759
+ readonly Notice: 5;
760
+ readonly Info: 6;
761
+ readonly Debug: 7;
762
+ };
763
+ type LogLevelValue = typeof LogLevel[keyof typeof LogLevel];
764
+ interface Breadcrumb {
765
+ category?: string;
766
+ message?: string;
767
+ data?: Record<string, unknown>;
768
+ level?: LogLevelValue;
769
+ type?: 'default' | 'http' | 'navigation' | 'user' | 'error';
770
+ timestamp?: number;
771
+ }
772
+ interface LoggerApi {
773
+ debug: (message: string, data?: Record<string, unknown>) => void;
774
+ info: (message: string, data?: Record<string, unknown>) => void;
775
+ warn: (message: string, data?: Record<string, unknown>) => void;
776
+ error: (message: string, data?: Record<string, unknown>) => void;
777
+ captureException: (error: unknown, extra?: Record<string, unknown>) => void;
778
+ captureMessage: (message: string, level?: LogLevelValue, extra?: Record<string, unknown>) => void;
779
+ addBreadcrumb: (breadcrumb: Breadcrumb) => void;
780
+ setContext: (name: string, data: Record<string, unknown> | null) => void;
781
+ setTag: (key: string, value: string | null) => void;
782
+ }
783
+
755
784
  interface StateApiOptions {
756
785
  /** Override the default page-level scope. Used by web components with persist-key or nested artifacts. */
757
786
  scope?: string;
@@ -796,7 +825,7 @@ interface FormResult {
796
825
  }
797
826
  type LimitedConfirmationOptions = Omit<ConfirmationOptions, 'target' | 'appendTo' | 'onShow' | 'onHide'>;
798
827
  interface ProxyApiInstance {
799
- config: AppConfig;
828
+ config: ChildAppConfig;
800
829
  /** @deprecated, use `host` instead */
801
830
  iframe: {
802
831
  toast: (message: ToastMessageOptions) => void;
@@ -843,6 +872,7 @@ interface ProxyApiInstance {
843
872
  submit: (data: FormData | Record<string, unknown>) => Promise<FormResult>;
844
873
  };
845
874
  on: ReturnType<typeof createEvents>;
875
+ logger: LoggerApi;
846
876
  state: StateApi;
847
877
  ws: ProxyWsApi;
848
878
  loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
@@ -866,6 +896,7 @@ interface ProxyConfig {
866
896
  iconifyIcons: boolean;
867
897
  refreshWhenVisible: boolean;
868
898
  historyPolyfill: boolean;
899
+ errorCapture: boolean;
869
900
  };
870
901
  }
871
902
 
@@ -876,7 +907,7 @@ declare const GLOBAL_API_PROVIDER: "__WIPPY_APP_API__";
876
907
  declare const GLOBAL_WEB_COMPONENT_CACHE: "__WIPPY_WEB_COMPONENT_CACHE__";
877
908
  declare global {
878
909
  interface Window {
879
- [GLOBAL_CONFIG_VAR]: AppConfig;
910
+ [GLOBAL_CONFIG_VAR]: AppConfig | ChildAppConfig;
880
911
  [GLOBAL_API_PROVIDER]: ProxyApiInstance;
881
912
  [GLOBAL_PROXY_CONFIG_VAR]?: ProxyConfig;
882
913
  [GLOBAL_CONFIG_OVERRIDES_VAR]?: AppConfigOverrides;
@@ -923,7 +954,7 @@ declare global {
923
954
  */
924
955
  initWippyApi: () => Promise<ProxyApiInstance>;
925
956
  $W: {
926
- config: () => Promise<AppConfig>;
957
+ config: () => Promise<ChildAppConfig>;
927
958
  instance: () => Promise<ProxyApiInstance>;
928
959
  api: () => Promise<ProxyApiInstance['api']>;
929
960
  /** @deprecated Use `$W.api` instead */
@@ -932,6 +963,7 @@ declare global {
932
963
  /** @deprecated Use `$W.host` instead */
933
964
  iframe: () => Promise<ProxyApiInstance['host']>;
934
965
  on: () => Promise<ProxyApiInstance['on']>;
966
+ logger: () => Promise<ProxyApiInstance['logger']>;
935
967
  state: () => Promise<ProxyApiInstance['state']>;
936
968
  ws: () => Promise<ProxyApiInstance['ws']>;
937
969
  loadWebComponent: () => Promise<ProxyApiInstance['loadWebComponent']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wippy-fe/types-global-proxy",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "Global type declarations for Wippy iframe proxy (window.getWippyApi, $W, etc.)",
5
5
  "license": "UNLICENSED",
6
6
  "types": "index.d.ts"