@wippy-fe/types-global-proxy 0.0.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.
Files changed (2) hide show
  1. package/index.d.ts +826 -0
  2. package/package.json +6 -0
package/index.d.ts ADDED
@@ -0,0 +1,826 @@
1
+ import * as nanoevents from 'nanoevents';
2
+ import { AxiosDefaults, AxiosInstance } from 'axios';
3
+ import { ConfirmationOptions } from 'primevue/confirmationoptions';
4
+ import { ToastMessageOptions } from 'primevue/toast';
5
+
6
+ declare namespace PageApi {
7
+ interface Page {
8
+ icon: string;
9
+ id: string;
10
+ name: string;
11
+ title: string;
12
+ internal?: string;
13
+ order: number;
14
+ placement?: 'default' | 'bottom';
15
+ hidden?: boolean;
16
+ badge?: string | number;
17
+ badge_icon?: string;
18
+ group?: string;
19
+ group_order?: number;
20
+ group_icon?: string;
21
+ group_placement?: 'default' | 'bottom';
22
+ content_version?: string;
23
+ /** The content of the page artifact, which can be HTML, Markdown, or JSON with wippy specific package.json info */
24
+ content_type?: 'text/html' | 'text/markdown' | 'application/json';
25
+ }
26
+ interface PagesResponse {
27
+ count: number;
28
+ pages: Page[];
29
+ success: boolean;
30
+ }
31
+ interface PageContentResponse {
32
+ content: string;
33
+ success: boolean;
34
+ }
35
+ }
36
+
37
+ declare namespace UploadApi {
38
+ interface Meta {
39
+ filename: string;
40
+ content_sample?: string;
41
+ }
42
+ interface Upload {
43
+ uuid: string;
44
+ created_at: string;
45
+ updated_at: string;
46
+ mime_type: string;
47
+ size: number;
48
+ /**
49
+ * Note `@@local` is not part of the API response, it's a local state when file is still only on user PC
50
+ */
51
+ status: '@@local' | 'uploaded' | 'completed' | 'error' | 'processing';
52
+ meta: Meta;
53
+ error?: string;
54
+ }
55
+ interface ListResponse {
56
+ success: boolean;
57
+ meta: {
58
+ limit: number;
59
+ offset: number;
60
+ total: number;
61
+ };
62
+ uploads: Upload[];
63
+ }
64
+ interface GetResponse {
65
+ success: boolean;
66
+ upload: Upload;
67
+ }
68
+ interface UploadResponse {
69
+ success: boolean;
70
+ uuid: string;
71
+ }
72
+ }
73
+
74
+ declare enum ArtifactStatus {
75
+ /**
76
+ * The artifact is still being generated or processed.
77
+ * UI should display a loading indicator or show partial code/content.
78
+ * User interactions with the artifact may be limited during this state.
79
+ */
80
+ PROCESSING = "processing",
81
+ /**
82
+ * The artifact rendering is complete and it's in an active state.
83
+ * For interactive artifacts (forms, calculators, etc.), this indicates
84
+ * the artifact is ready and waiting for user input or interaction.
85
+ * UI should show the artifact as fully interactive.
86
+ */
87
+ RUNNING = "running",
88
+ /**
89
+ * The artifact rendering is complete but it's in an inactive state.
90
+ * For interactive artifacts, this indicates the artifact is not expecting
91
+ * any further input from the user.
92
+ * UI should show the artifact as read-only or with limited interactivity.
93
+ */
94
+ IDLE = "idle",
95
+ /**
96
+ * The artifact is being built by the system.
97
+ */
98
+ BUILDING = "building",
99
+ /**
100
+ * The artifact is being unit tested by the system.
101
+ */
102
+ TESTING = "testing",
103
+ /**
104
+ * The artifact failed to generate
105
+ */
106
+ ERROR = "error"
107
+ }
108
+ declare enum ArtifactType {
109
+ /**
110
+ * The artifact is embedded within chat message, html is sanitized to very basic tags.
111
+ * Applies only to text/html and text/markdown content types.
112
+ */
113
+ INLINE = "inline",
114
+ /**
115
+ * The artifact is embedded within chat message, in an iframe with support of iframe-proxy API
116
+ */
117
+ INLINE_INTERACTIVE = "inline-interactive",
118
+ /**
119
+ * The artifact is rendered as a button that opens artifact in an iframe with support of iframe-proxy API
120
+ * @see iframe-proxy.md
121
+ */
122
+ STANDALONE = "standalone"
123
+ }
124
+ interface Artifact {
125
+ uuid: string;
126
+ title: string;
127
+ description?: string;
128
+ icon?: string;
129
+ type: ArtifactType;
130
+ /** The content of the artifact, which can be HTML, Markdown, or JSON with wippy specific package.json info */
131
+ content_type: 'text/html' | 'text/markdown' | 'application/json';
132
+ content_version?: string;
133
+ status: ArtifactStatus;
134
+ }
135
+
136
+ type ArtifactUUID = string;
137
+ type PageUUID = string;
138
+ type SessionUUID = string;
139
+ type EntryUUID = string;
140
+ type MessageUUID = string;
141
+ type ActionCommand = 'navigate' | 'sidebar';
142
+ declare const WsTopicPrefixes: {
143
+ readonly Pages: "pages";
144
+ readonly Page: "page";
145
+ readonly Artifact: "artifact";
146
+ readonly Welcome: "welcome";
147
+ readonly Update: "update";
148
+ readonly Session: "session";
149
+ readonly SessionOpen: "session.opened";
150
+ readonly SessionClosed: "session.closed";
151
+ readonly Error: "error";
152
+ readonly Upload: "upload";
153
+ readonly Action: "action";
154
+ readonly Registry: "registry";
155
+ readonly RegistryEntry: "entry";
156
+ };
157
+ interface WsTopicTypes {
158
+ /**
159
+ * Welcome info with active sessions
160
+ */
161
+ Welcome: typeof WsTopicPrefixes.Welcome;
162
+ /**
163
+ * Artifact are updated
164
+ */
165
+ Artifact: `${typeof WsTopicPrefixes.Artifact}:${ArtifactUUID}`;
166
+ /**
167
+ * Dynamic page list is updated
168
+ */
169
+ Pages: typeof WsTopicPrefixes.Pages;
170
+ /**
171
+ * Single page is updated and needs reload
172
+ */
173
+ Page: `${typeof WsTopicPrefixes.Page}:${PageUUID}`;
174
+ /**
175
+ * Session was opened event
176
+ */
177
+ SessionOpened: typeof WsTopicPrefixes.SessionOpen;
178
+ /**
179
+ * Session was closed event
180
+ */
181
+ SessionClosed: typeof WsTopicPrefixes.SessionClosed;
182
+ /**
183
+ * Session operation
184
+ */
185
+ Session: `${typeof WsTopicPrefixes.Session}:${SessionUUID}`;
186
+ /**
187
+ * Registry operation
188
+ */
189
+ Registry: `${typeof WsTopicPrefixes.Registry}:${string}`;
190
+ /**
191
+ * Registry entry updates
192
+ */
193
+ RegistryEntry: `${typeof WsTopicPrefixes.RegistryEntry}:${EntryUUID}`;
194
+ /**
195
+ * Registry entry updates
196
+ */
197
+ Action: `${typeof WsTopicPrefixes.Action}:${ActionCommand}`;
198
+ /**
199
+ * Session message
200
+ */
201
+ SessionMessage: `${typeof WsTopicPrefixes.Session}:${SessionUUID}:message:${MessageUUID}`;
202
+ /**
203
+ * Error message
204
+ */
205
+ Error: typeof WsTopicPrefixes.Error;
206
+ /**
207
+ * Upload was created or updated
208
+ */
209
+ Upload: `${typeof WsTopicPrefixes.Upload}:${string}`;
210
+ }
211
+ type WsTopic = WsTopicTypes[keyof WsTopicTypes];
212
+ declare enum WsMessageType {
213
+ /** Contains the actual content of the message */
214
+ CONTENT = "content",
215
+ /** Contains content of the message to append to current one */
216
+ CHUNK = "chunk",
217
+ /** User message with contents */
218
+ USER = "received",
219
+ /** Response started, can create a message placeholder */
220
+ RESPONSE_STARTED = "response_started",
221
+ /** Kill the message */
222
+ INVALIDATE = "invalidate",
223
+ /** from to agent, get agent names */
224
+ DELEGATION = "delegation",
225
+ /** Tool/fn was called */
226
+ TOOL_CALL = "tool_call",
227
+ FUNCTION_CALL = "function_call",
228
+ /** Tool/fn was succesfull */
229
+ TOOL_SUCCESS = "tool_success",
230
+ FUNCTION_SUCCESS = "function_success",
231
+ /** Tool/fn failed */
232
+ TOOL_ERROR = "tool_error",
233
+ FUNCTION_ERROR = "function_error",
234
+ /** Error */
235
+ ERROR = "error",
236
+ /** Error */
237
+ ARTIFACT = "artifact"
238
+ }
239
+ interface WsMessageBase {
240
+ topic: WsTopic;
241
+ data?: {
242
+ request_id?: string;
243
+ };
244
+ }
245
+ interface WsMessage_Welcome extends WsMessageBase {
246
+ topic: WsTopicTypes['Welcome'];
247
+ data: {
248
+ request_id?: string;
249
+ active_session_ids: Array<string>;
250
+ active_sessions: number;
251
+ client_count: number;
252
+ user_id: string;
253
+ };
254
+ }
255
+ interface WsMessage_Action extends WsMessageBase {
256
+ topic: WsTopicTypes['Action'];
257
+ data: {
258
+ request_id?: string;
259
+ artifact_uuid?: string;
260
+ artifact_content_type?: string;
261
+ session_uuid?: string;
262
+ path?: string;
263
+ };
264
+ }
265
+ interface WsMessage_Registry extends WsMessageBase {
266
+ topic: WsTopicTypes['Registry'];
267
+ data: {
268
+ request_id?: string;
269
+ };
270
+ }
271
+ interface WsMessage_RegistryEntry extends WsMessageBase {
272
+ topic: WsTopicTypes['RegistryEntry'];
273
+ data: {
274
+ request_id?: string;
275
+ content_version?: string;
276
+ };
277
+ }
278
+ interface WsMessage_Pages extends WsMessageBase {
279
+ topic: WsTopicTypes['Pages'];
280
+ }
281
+ interface WsMessage_Page extends WsMessageBase {
282
+ topic: WsTopicTypes['Page'];
283
+ data: PageApi.Page & {
284
+ request_id?: string;
285
+ };
286
+ }
287
+ interface WsMessage_SessionOpen extends WsMessageBase {
288
+ topic: WsTopicTypes['SessionOpened'];
289
+ data: {
290
+ request_id?: string;
291
+ active_session_ids: Array<string>;
292
+ session_id: string;
293
+ };
294
+ }
295
+ interface WsMessage_Error extends WsMessageBase {
296
+ topic: WsTopicTypes['Error'];
297
+ data: {
298
+ request_id?: string;
299
+ error: string;
300
+ message: string;
301
+ };
302
+ }
303
+ interface WsMessage_SessionClosed extends WsMessageBase {
304
+ topic: WsTopicTypes['SessionClosed'];
305
+ data: {
306
+ request_id?: string;
307
+ active_session_ids: Array<string>;
308
+ session_id: string;
309
+ };
310
+ }
311
+ interface WsMessageDataBase {
312
+ type: WsMessageType;
313
+ }
314
+ interface WsMessageDataChunk extends WsMessageDataBase {
315
+ type: WsMessageType.CHUNK;
316
+ content: string;
317
+ }
318
+ interface WsMessageDataContent extends WsMessageDataBase {
319
+ type: WsMessageType.CONTENT;
320
+ content: string;
321
+ message_id: MessageUUID;
322
+ file_uuids?: string[];
323
+ }
324
+ interface WsMessageDataUser extends WsMessageDataBase {
325
+ type: WsMessageType.USER;
326
+ text: string;
327
+ message_id: MessageUUID;
328
+ file_uuids?: string[];
329
+ }
330
+ interface WsMessageDataDelegation extends WsMessageDataBase {
331
+ type: WsMessageType.DELEGATION;
332
+ from: string;
333
+ to: string;
334
+ }
335
+ interface WsMessageDataInvalidate extends WsMessageDataBase {
336
+ type: WsMessageType.INVALIDATE;
337
+ }
338
+ interface WsMessageDataStarted extends WsMessageDataBase {
339
+ type: WsMessageType.RESPONSE_STARTED;
340
+ message_id: MessageUUID;
341
+ }
342
+ interface WsMessageDataToolCall extends WsMessageDataBase {
343
+ type: WsMessageType.TOOL_CALL | WsMessageType.FUNCTION_CALL;
344
+ function_name: string;
345
+ artifact_id?: string;
346
+ }
347
+ interface WsMessageDataArtifact extends WsMessageDataBase {
348
+ type: WsMessageType.ARTIFACT;
349
+ artifact_id?: string;
350
+ }
351
+ interface WsMessageDataToolSuccess extends WsMessageDataBase {
352
+ type: WsMessageType.TOOL_SUCCESS | WsMessageType.FUNCTION_SUCCESS;
353
+ function_name: string;
354
+ artifact_id?: string;
355
+ }
356
+ interface WsMessageDataToolError extends WsMessageDataBase {
357
+ type: WsMessageType.TOOL_ERROR | WsMessageType.FUNCTION_ERROR;
358
+ function_name: string;
359
+ artifact_id?: string;
360
+ }
361
+ interface WsMessageDataError extends WsMessageDataBase {
362
+ type: WsMessageType.ERROR;
363
+ message: string;
364
+ code: string;
365
+ }
366
+ interface WsMessage_SessionMessage extends WsMessageBase {
367
+ topic: WsTopicTypes['SessionMessage'];
368
+ data: (WsMessageDataUser | WsMessageDataContent | WsMessageDataChunk | WsMessageDataDelegation | WsMessageDataToolCall | WsMessageDataError | WsMessageDataInvalidate | WsMessageDataStarted | WsMessageDataToolSuccess | WsMessageDataArtifact | WsMessageDataToolError) & {
369
+ request_id?: string;
370
+ };
371
+ }
372
+ interface WsMessage_Session extends WsMessageBase {
373
+ topic: WsTopicTypes['Session'];
374
+ data: {
375
+ request_id?: string;
376
+ agent?: string;
377
+ last_message_date?: number;
378
+ model?: string;
379
+ status?: string;
380
+ title?: string;
381
+ type: 'update';
382
+ public_meta?: Array<{
383
+ icon?: string;
384
+ id: string;
385
+ title: string;
386
+ url?: string;
387
+ }>;
388
+ };
389
+ }
390
+ interface WsMessage_Artifact extends WsMessageBase {
391
+ topic: WsTopicTypes['Artifact'];
392
+ data: Partial<Artifact> & {
393
+ request_id?: string;
394
+ };
395
+ }
396
+ interface WsMessage_Upload extends WsMessageBase {
397
+ topic: WsTopicTypes['Upload'];
398
+ data: UploadApi.Upload & {
399
+ request_id?: string;
400
+ };
401
+ }
402
+ type WsMessage = WsMessage_Welcome | WsMessage_Pages | WsMessage_Page | WsMessage_SessionMessage | WsMessage_Session | WsMessage_SessionClosed | WsMessage_Error | WsMessage_Artifact | WsMessage_SessionOpen | WsMessage_Action | WsMessage_Registry | WsMessage_RegistryEntry | WsMessage_Upload;
403
+
404
+ type KnownTopics = '@history' | '@visibility' | '@message';
405
+ type Events = {
406
+ /** Emitted when pages are updated */
407
+ '@history': (data: {
408
+ path: string;
409
+ }) => void;
410
+ '@visibility': (visible: boolean) => void;
411
+ '@message': (data: WsMessage) => void;
412
+ } & {
413
+ [K in string as K extends KnownTopics ? never : K]: (data: WsMessage) => void;
414
+ };
415
+ declare function createEvents(): <T extends string>(topicPattern: T, callback: T extends KnownTopics ? Events[T] : Events["@message"]) => nanoevents.Unsubscribe;
416
+
417
+ var cssRS = {
418
+
419
+ };
420
+
421
+ var session = {
422
+ type: "non-persistent"
423
+ };
424
+ var history = "browser";
425
+ var env = {
426
+ APP_API_URL: "",
427
+ APP_AUTH_API_URL: "",
428
+ APP_WEBSOCKET_URL: ""
429
+ };
430
+ var featureRS = {
431
+ session: session,
432
+ history: history,
433
+ env: env
434
+ };
435
+
436
+ var chat = {
437
+ emptyState: {
438
+ title: "No chat session selected",
439
+ description: "Please select a session from the dropdown above or start a new conversation.",
440
+ goToHome: "Go to Home Page",
441
+ loadingAgents: "Loading agents...",
442
+ selectAgent: "Select Agent",
443
+ startChat: "Start Chat",
444
+ startChatError: "Failed to start chat",
445
+ noAgents: "No agents available. Please contact your administrator.",
446
+ dropFiles: "Drop files here to upload"
447
+ }
448
+ };
449
+ var customPage = {
450
+ loading: {
451
+ title: "Loading page content..."
452
+ },
453
+ error: {
454
+ title: "Failed to load page content"
455
+ }
456
+ };
457
+ var home = {
458
+ loading: "Application is Loading",
459
+ error: {
460
+ title: "Error Loading Application"
461
+ },
462
+ noHomePage: {
463
+ title: "No Home Page Detected",
464
+ message: "Probably backend configuration is malformed"
465
+ }
466
+ };
467
+ var app = {
468
+ title: "Wippy App",
469
+ appName: "Wippy",
470
+ icon: "wippy:logo"
471
+ };
472
+ var login = {
473
+ error: {
474
+ title: "Session Token Expired",
475
+ description: "Your session has expired or is no longer valid. Please close this window and log in again to continue."
476
+ }
477
+ };
478
+ var logout = {
479
+ title: "Logout",
480
+ description: "Logging out..."
481
+ };
482
+ var keeper = {
483
+ controls: {
484
+ newChat: "New Chat",
485
+ searchAgents: "Search agents...",
486
+ undo: "Undo",
487
+ redo: "Redo",
488
+ download: "Registry To File System",
489
+ upload: "File System To Registry",
490
+ codeAssistant: "Wippy Code Assistant",
491
+ syncControls: "Sync Controls",
492
+ confirmUpload: {
493
+ title: "Confirm Upload",
494
+ message: "Do you wish to upload file system changes to registry? This will overwrite current state",
495
+ cancel: "Cancel",
496
+ upload: "Upload",
497
+ cancelled: {
498
+ title: "Upload cancelled",
499
+ message: "The upload operation was cancelled"
500
+ }
501
+ }
502
+ },
503
+ version: {
504
+ label: "Version:",
505
+ tooltip: "Version {{version}}"
506
+ }
507
+ };
508
+ var textRS = {
509
+ chat: chat,
510
+ customPage: customPage,
511
+ home: home,
512
+ app: app,
513
+ login: login,
514
+ logout: logout,
515
+ keeper: keeper
516
+ };
517
+
518
+ type I18NFeatureTypes = typeof featureRS;
519
+ type I18NTextTypes = typeof textRS;
520
+ type I18NCssTypes = typeof cssRS;
521
+
522
+ /**
523
+ * All API route templates, grouped by domain.
524
+ * Dynamic path segments use `{paramName}` placeholders (OpenAPI-style).
525
+ * Each leaf value is a flat, fully-formed route — no concatenation needed at call site.
526
+ *
527
+ * Internally, routes use `@/…` shorthand that resolves against the group's `@prefix`.
528
+ * Resolution happens once inside `getApiRoutes()`, so consumers always receive clean strings.
529
+ *
530
+ * Base URL resolution:
531
+ * - HTTP routes: `getEnv().APP_API_URL` + route (handled by axios baseURL)
532
+ * - WebSocket: `getEnv().APP_WEBSOCKET_URL` + `getApiRoutes().ws.join` (composed in ws/client.ts)
533
+ */
534
+ interface ApiRoutes {
535
+ agents: {
536
+ list: string;
537
+ details: string;
538
+ byName: string;
539
+ };
540
+ sessions: {
541
+ list: string;
542
+ get: string;
543
+ messages: string;
544
+ };
545
+ models: {
546
+ list: string;
547
+ byName: string;
548
+ };
549
+ uploads: {
550
+ list: string;
551
+ get: string;
552
+ create: string;
553
+ };
554
+ artifacts: {
555
+ get: string;
556
+ content: string;
557
+ state: string;
558
+ baseUrl: string;
559
+ };
560
+ pages: {
561
+ list: string;
562
+ get: string;
563
+ content: string;
564
+ baseUrl: string;
565
+ };
566
+ registry: {
567
+ namespaces: string;
568
+ entries: string;
569
+ entry: string;
570
+ entryCreate: string;
571
+ entryEditors: string;
572
+ versions: string;
573
+ versionApply: string;
574
+ };
575
+ keeperSync: {
576
+ state: string;
577
+ download: string;
578
+ upload: string;
579
+ undo: string;
580
+ redo: string;
581
+ };
582
+ npm: {
583
+ globalAutoload: string;
584
+ };
585
+ tools: {
586
+ byName: string;
587
+ };
588
+ ws: {
589
+ join: string;
590
+ };
591
+ }
592
+ /**
593
+ * Override type for `AppConfig.feature.apiRoutes`.
594
+ *
595
+ * Each group is optional and partially overridable.
596
+ * Set `@prefix` to rebase all `@/…` routes in that group at once,
597
+ * or override individual routes with absolute paths.
598
+ */
599
+ type ApiRoutesOverride = {
600
+ [K in keyof ApiRoutes]?: Partial<ApiRoutes[K]> & {
601
+ '@prefix'?: string;
602
+ };
603
+ };
604
+
605
+ interface AppFeatures extends I18NFeatureTypes {
606
+ /**
607
+ * If to remember auth details or not
608
+ */
609
+ session: {
610
+ type: 'non-persistent' | 'cookie';
611
+ };
612
+ history: 'browser' | 'hash';
613
+ env: {
614
+ APP_API_URL: string;
615
+ APP_AUTH_API_URL: string;
616
+ APP_WEBSOCKET_URL: string;
617
+ };
618
+ axiosDefaults?: Partial<AxiosDefaults>;
619
+ routePrefix?: string;
620
+ showAdmin?: boolean;
621
+ allowSelectModel?: boolean;
622
+ startNavOpen?: boolean;
623
+ hideNavBar?: boolean;
624
+ disableRightPanel?: boolean;
625
+ /**
626
+ * Hide the session selector dropdown in chat views
627
+ * @default false
628
+ */
629
+ hideSessionSelector?: boolean;
630
+ additionalNavItems?: Array<PageApi.Page>;
631
+ chat?: {
632
+ convertPasteToFile?: {
633
+ enabled: boolean;
634
+ minFileSize: number;
635
+ allowHtml: boolean;
636
+ };
637
+ };
638
+ apiRoutes?: ApiRoutesOverride;
639
+ }
640
+ interface AppAuthConfig {
641
+ token: string;
642
+ expiresAt: string;
643
+ }
644
+ interface AppCustomization {
645
+ customCSS?: string;
646
+ cssVariables?: I18NCssTypes;
647
+ i18n?: Partial<I18NTextTypes>;
648
+ icons?: Record<string, {
649
+ body: string;
650
+ width: number;
651
+ height: number;
652
+ }>;
653
+ }
654
+ interface AppConfig {
655
+ artifactId?: string;
656
+ /**
657
+ * Starting app or artifact/page path
658
+ */
659
+ path?: string;
660
+ /**
661
+ * App features like history mode, session type, etc.
662
+ */
663
+ feature?: AppFeatures;
664
+ /**
665
+ * Auth configuration
666
+ */
667
+ auth: AppAuthConfig;
668
+ /**
669
+ * App customization like i18n texts, css variables, custom css, etc.
670
+ */
671
+ customization?: AppCustomization;
672
+ externalEvents?: {
673
+ enabled: boolean;
674
+ wsType: string;
675
+ allowedOrigins: string[];
676
+ allowedTypes: string[];
677
+ };
678
+ }
679
+
680
+ interface FormState {
681
+ data?: Record<string, unknown>;
682
+ status: 'active' | 'inactive';
683
+ }
684
+ interface FormResult {
685
+ success: boolean;
686
+ message?: string;
687
+ errors?: Record<string, string>;
688
+ }
689
+ type LimitedConfirmationOptions = Omit<ConfirmationOptions, 'target' | 'appendTo' | 'onShow' | 'onHide'>;
690
+ interface ProxyApiInstance {
691
+ config: AppConfig;
692
+ /** @deprecated, use `host` instead */
693
+ iframe: {
694
+ toast: (message: ToastMessageOptions) => void;
695
+ confirm: (options: LimitedConfirmationOptions) => Promise<boolean>;
696
+ startChat: (start_token: string, sidebar?: boolean) => void;
697
+ openSession: (sessionUUID: string, sidebar?: boolean) => void;
698
+ openArtifact: (artifactUUID: string, target: 'modal' | 'sidebar') => void;
699
+ navigate: (url: string) => void;
700
+ handleError: (code: ('auth-expired' | 'other'), error: Record<string, unknown>) => void;
701
+ setContext: (context: Record<string, unknown>, source?: {
702
+ type: 'page' | 'artifact';
703
+ uuid: string;
704
+ }) => void;
705
+ formatUrl: (relativeUrl: string) => string;
706
+ logout: () => void;
707
+ };
708
+ host: {
709
+ toast: (message: ToastMessageOptions) => void;
710
+ confirm: (options: LimitedConfirmationOptions) => Promise<boolean>;
711
+ startChat: (start_token: string, options?: {
712
+ sidebar?: boolean;
713
+ }) => void;
714
+ openSession: (sessionUUID: string, options?: {
715
+ sidebar?: boolean;
716
+ }) => void;
717
+ openArtifact: (artifactUUID: string, options?: {
718
+ target: 'modal' | 'sidebar';
719
+ }) => void;
720
+ navigate: (url: string) => void;
721
+ onRouteChanged: (internalRoute: string) => void;
722
+ handleError: (code: ('auth-expired' | 'other'), error: Record<string, unknown>) => void;
723
+ setContext: (context: Record<string, unknown>, sessionUUID?: string, source?: {
724
+ type: 'page' | 'artifact';
725
+ uuid: string;
726
+ instanceUUID?: string;
727
+ }) => void;
728
+ formatUrl: (relativeUrl: string) => string;
729
+ logout: () => void;
730
+ };
731
+ api: AxiosInstance;
732
+ /** @deprecated, use api calls instead */
733
+ form: {
734
+ get: () => Promise<FormState>;
735
+ submit: (data: FormData | Record<string, unknown>) => Promise<FormResult>;
736
+ };
737
+ on: ReturnType<typeof createEvents>;
738
+ loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
739
+ }
740
+
741
+ interface ProxyConfig {
742
+ enabled: boolean;
743
+ injections: {
744
+ css: {
745
+ fonts: boolean;
746
+ themeConfig: boolean;
747
+ iframe: boolean;
748
+ primevue: boolean;
749
+ markdown: boolean;
750
+ customCss: boolean;
751
+ customVariabled: boolean;
752
+ };
753
+ tailwindConfig: boolean;
754
+ resizeObserver: boolean;
755
+ preventLinkClicks: boolean;
756
+ iconifyIcons: boolean;
757
+ refreshWhenVisible: boolean;
758
+ historyPolyfill: boolean;
759
+ };
760
+ }
761
+
762
+ declare const GLOBAL_CONFIG_VAR: "__WIPPY_APP_CONFIG__";
763
+ declare const GLOBAL_PROXY_CONFIG_VAR: "__WIPPY_PROXY_CONFIG__";
764
+ declare const GLOBAL_API_PROVIDER: "__WIPPY_APP_API__";
765
+ declare const GLOBAL_WEB_COMPONENT_CACHE: "__WIPPY_WEB_COMPONENT_CACHE__";
766
+ declare global {
767
+ interface Window {
768
+ [GLOBAL_CONFIG_VAR]: AppConfig;
769
+ [GLOBAL_API_PROVIDER]: ProxyApiInstance;
770
+ [GLOBAL_PROXY_CONFIG_VAR]?: ProxyConfig;
771
+ [GLOBAL_WEB_COMPONENT_CACHE]: Record<string, {
772
+ usedAt: number;
773
+ data: string;
774
+ clearable: boolean;
775
+ }>;
776
+ }
777
+ }
778
+
779
+ /** @type {import('tailwindcss').Config} */
780
+ declare const _default: {
781
+ content: string[];
782
+ theme: {
783
+ extend: {
784
+ colors: {
785
+ secondary: {
786
+ 50: string;
787
+ 100: string;
788
+ 200: string;
789
+ 300: string;
790
+ 400: string;
791
+ 500: string;
792
+ 600: string;
793
+ 700: string;
794
+ 800: string;
795
+ 900: string;
796
+ 950: string;
797
+ };
798
+ };
799
+ };
800
+ };
801
+ plugins: any[];
802
+ };
803
+
804
+ declare global {
805
+ interface Window {
806
+ getWippyApi: () => Promise<ProxyApiInstance>;
807
+ /**
808
+ * @deprecated
809
+ */
810
+ initWippyApi: () => Promise<ProxyApiInstance>;
811
+ $W: {
812
+ config: () => Promise<AppConfig>;
813
+ instance: () => Promise<ProxyApiInstance>;
814
+ api: () => Promise<ProxyApiInstance['api']>;
815
+ form: () => Promise<ProxyApiInstance['form']>;
816
+ host: () => Promise<ProxyApiInstance['host']>;
817
+ iframe: () => Promise<ProxyApiInstance['iframe']>;
818
+ on: () => Promise<ProxyApiInstance['on']>;
819
+ loadWebComponent: () => Promise<ProxyApiInstance['loadWebComponent']>;
820
+ };
821
+ tailwind?: {
822
+ config: Partial<typeof _default>;
823
+ };
824
+ [GLOBAL_PROXY_CONFIG_VAR]?: ProxyConfig;
825
+ }
826
+ }
package/package.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@wippy-fe/types-global-proxy",
3
+ "version": "0.0.1",
4
+ "description": "Global type declarations for Wippy iframe proxy (window.getWippyApi, $W, etc.)",
5
+ "types": "index.d.ts"
6
+ }