@openfin/cloud-api 0.0.1-alpha.f9b51d0 → 0.0.1-alpha.fa5459b

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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as OpenFin from '@openfin/core';
2
- import OpenFin__default from '@openfin/core';
3
- import * as NotificationsTypes from 'openfin-notifications';
2
+ import OpenFin__default, { OpenFin as OpenFin$1 } from '@openfin/core';
3
+ import * as NotificationsTypes from '@openfin/workspace/notifications';
4
4
 
5
5
  /**
6
6
  * NotificationsClient is a client for accessing and interacting with the Notifications your application has created.
@@ -152,11 +152,6 @@ type FlannelChannelProvider = {
152
152
  register: <T extends keyof FlannelProvider>(action: T, handler: (payload: Parameters<FlannelProvider[T]>[0], id: OpenFin__default.ProviderIdentity | OpenFin__default.ClientIdentity) => ReturnType<FlannelProvider[T]>) => boolean;
153
153
  } & Omit<OpenFin__default.ChannelProvider, 'dispatch' | 'register'>;
154
154
 
155
- declare global {
156
- interface Window {
157
- fin: typeof OpenFin.fin;
158
- }
159
- }
160
155
  /**
161
156
  * @returns A client for interacting with the OpenFin Notifications service
162
157
  *
@@ -253,5 +248,690 @@ declare function setAppUserSettings(settings: unknown): Promise<unknown>;
253
248
  * @throws {Error} If the function is called outside of an OpenFin View context
254
249
  */
255
250
  declare function getAppUserPermissions(): Promise<AppPermissions>;
251
+ type LaunchContentOptions = {
252
+ /** Object containing query param values to be appended to content's URL */
253
+ queryParams?: Record<string, string>;
254
+ /** Defines behavior when instance of content is already running.
255
+ * If 'multi', copy of the content will be created.
256
+ * If 'single', the existing instance of content will be focused. */
257
+ instanceMode?: 'single' | 'multi';
258
+ } & ({
259
+ targetType?: 'new-window';
260
+ /** Defines the bounds of the window in which content will open */
261
+ bounds?: Partial<OpenFin__default.Bounds>;
262
+ } | {
263
+ targetType: 'window' | 'view';
264
+ targetIdentity: OpenFin__default.Identity;
265
+ });
266
+ /**
267
+ * A function allowing the easy launching of content
268
+ * @param id The id of the content to launch
269
+ * @returns nothing
270
+ *
271
+ * @throws {Error} If the function is called outside of an OpenFin environment
272
+ * @throws {Error} If the function is called outside of an OpenFin View context
273
+ * @throws {Error} If the function has been unable to look up or launch the content
274
+ * @throws {Error} If the function is unable to find content with the provided id.
275
+ */
276
+ declare function launchContent(id: string, options: LaunchContentOptions): Promise<void>;
277
+ /**
278
+ * A function allowing the easy launching of Supertabs
279
+ * @param id The id of supertab
280
+ * @returns nothing
281
+ *
282
+ * @throws {Error} If the function is called outside of an OpenFin environment
283
+ * @throws {Error} If the function is called outside of an OpenFin View context
284
+ * @throws {Error} If the function has been unable to look up or launch the supertab
285
+ * @throws {Error} If the function is unable to find supertab with the provided id.
286
+ */
287
+ declare function launchSupertab(id: string): Promise<void>;
288
+ /**
289
+ * A function allowing the easy launching of Workspaces
290
+ * @param id The id of workspace
291
+ * @returns nothing
292
+ *
293
+ * @throws {Error} If the function is called outside of an OpenFin environment
294
+ * @throws {Error} If the function is called outside of an OpenFin View context
295
+ * @throws {Error} If the function has been unable to look up or launch the workspace
296
+ * @throws {Error} If the function is unable to find workspace with the provided id.
297
+ */
298
+ declare function launchWorkspace(id: string): Promise<void>;
299
+
300
+ /**
301
+ * Function that is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
302
+ *
303
+ * @param action The action that was triggered.
304
+ * @param result The search result that the action was triggered on.
305
+ *
306
+ * @returns Result that includes the URL that Here™ should navigate to, or `undefined` if no navigation is required.
307
+ */
308
+ type OnActionListener = (action: SearchAction$1, result: SearchResult$1) => SearchResultActionResponse$1 | Promise<SearchResultActionResponse$1>;
309
+ /**
310
+ * Function that is called when the Search Agent receives a query from Here™’s search UI
311
+ *
312
+ * @param request Search request data that includes the query.
313
+ *
314
+ * @returns Search response data that includes the search results.
315
+ */
316
+ type OnSearchListener = (request: SearchListenerRequest$1) => SearchResponse$1 | Promise<SearchResponse$1>;
317
+ /**
318
+ * An action that can be triggered by a user on a search result returned by a Search Agent.
319
+ *
320
+ * Actions are displayed as buttons alongside search results in Here™’s search UI. That is, except for the first action, which is hidden as it is triggered automatically when the user selects the search result.
321
+ */
322
+ type SearchAction$1 = {
323
+ /**
324
+ * URL or data URI of an icon that will be displayed within the action button when Here™ is in Light mode.
325
+ */
326
+ darkIcon?: string;
327
+ /**
328
+ * A fuller description of the action that will be displayed in Here™’s search UI when the user hovers over the action button.
329
+ */
330
+ description?: string;
331
+ /**
332
+ * URL or data URI of an icon that will be displayed within the action button when Here™ is in Dark mode.
333
+ */
334
+ lightIcon?: string;
335
+ /**
336
+ * Internal identifier for the action which is used to identify the action in the {@link OnActionListener}.
337
+ */
338
+ name: string;
339
+ /**
340
+ * Compact title of the action displayed within the action button.
341
+ */
342
+ title?: string;
343
+ };
344
+ /**
345
+ * A Search Agent returns search results to Here™’s search UI in response to user input, and acts on the user’s actions regarding those results.
346
+ *
347
+ * @deprecated Use {@link Agent} instead.
348
+ */
349
+ type SearchAgent = {
350
+ /**
351
+ * Sets whether or not the Search Agent is ready to provide search results.
352
+ *
353
+ * When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
354
+ *
355
+ * @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
356
+ *
357
+ * @deprecated Use {@link Agent.setIsReady} instead.
358
+ */
359
+ isReady: (ready?: boolean) => Promise<void>;
360
+ };
361
+ /**
362
+ * The Search Agent’s configuration data as configured in the Here™ Admin Console.
363
+ *
364
+ * @typeParam T Type definition for the `customData` property, containing any custom configuration data specific to the Search Agent.
365
+ */
366
+ type SearchAgentConfigurationData<T> = {
367
+ /**
368
+ * Custom configuration data specific to the Search Agent.
369
+ */
370
+ customData?: T;
371
+ /**
372
+ * Optional description of the Search Agent.
373
+ */
374
+ description?: string;
375
+ /**
376
+ * Unique identifier for the Search Agent.
377
+ */
378
+ id: string;
379
+ /**
380
+ * The display title of the Search Agent.
381
+ */
382
+ title: string;
383
+ /**
384
+ * The URL of the Search Agent.
385
+ */
386
+ url: string;
387
+ };
388
+ /**
389
+ * Configuration provided when registering a Search Agent.
390
+ */
391
+ type SearchAgentRegistrationConfig = {
392
+ /**
393
+ * This listener is called when the Search Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
394
+ *
395
+ * The listener returns a response back to Here™ that includes a URL to navigate to.
396
+ */
397
+ onAction: OnActionListener;
398
+ /**
399
+ * This listener is called when the Search Agent receives a query from Here™’s search UI and returns relevant search results.
400
+ *
401
+ * Note: When the Search Agent is not ready this listener will not be called.
402
+ */
403
+ onSearch: OnSearchListener;
404
+ };
405
+ /**
406
+ * Search request data provided to the {@link OnSearchListener}.
407
+ */
408
+ type SearchListenerRequest$1 = {
409
+ /**
410
+ * Provides additional context for the search request.
411
+ */
412
+ context: SearchRequestContext$1;
413
+ /**
414
+ * The query entered by the user in Here™’s search UI.
415
+ */
416
+ query: string;
417
+ /**
418
+ * Provide this signal to any `fetch` requests executed in the {@link OnSearchListener} function as a result of this search request, so that they will be automatically cancelled if a new search request is received before they complete.
419
+ */
420
+ signal: AbortSignal;
421
+ };
422
+ /**
423
+ * Context data included with a search request.
424
+ */
425
+ type SearchRequestContext$1 = {
426
+ /**
427
+ * The page number of the search results to return.
428
+ */
429
+ pageNumber: number;
430
+ /**
431
+ * The number of search results to return per page.
432
+ */
433
+ pageSize: number;
434
+ /**
435
+ * The unique ID of the query.
436
+ */
437
+ queryId: string;
438
+ };
439
+ /**
440
+ * Return type of the {@link OnSearchListener}.
441
+ */
442
+ type SearchResponse$1 = {
443
+ /**
444
+ * The search results to display in Here™’s search UI.
445
+ */
446
+ results: SearchResult$1[];
447
+ };
448
+ /**
449
+ * A search result returned by a Search Agent in response to a search request.
450
+ */
451
+ type SearchResult$1 = {
452
+ /**
453
+ * Actions that can be triggered by the user against the search result.
454
+ */
455
+ actions: SearchAction$1[];
456
+ /**
457
+ * Additional data that can be used by the {@link OnActionListener} when an action is triggered.
458
+ */
459
+ data?: Record<string, unknown>;
460
+ /**
461
+ * URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
462
+ */
463
+ icon?: string;
464
+ /**
465
+ * Unique identifier for the search result.
466
+ */
467
+ key: string;
468
+ /**
469
+ * Secondary text that will be displayed with the search result in Here™’s search UI.
470
+ */
471
+ label?: string;
472
+ /**
473
+ * Primary text that will be displayed with the search result in Here™’s search UI.
474
+ */
475
+ title: string;
476
+ };
477
+ /**
478
+ * Return type of the {@link OnActionListener}.
479
+ */
480
+ type SearchResultActionResponse$1 = {
481
+ /**
482
+ * URL that Here™ should navigate to.
483
+ */
484
+ url: string;
485
+ } | undefined;
486
+
487
+ /**
488
+ * Retrieves the Search Agent’s configuration data, as has been configured in the Here™ Admin Console.
489
+ *
490
+ * @returns A promise that resolves with an object containing properties that match the Search Agent’s configuration.
491
+ *
492
+ * @example Retrieving the Search Agent’s configuration data:
493
+ * ```ts
494
+ * import { Search } from "@openfin/cloud-api";
495
+ *
496
+ * // Get the configuration data
497
+ * const configData = await Search.getAgentConfiguration<{ customField1: string, customField2: string }>();
498
+ *
499
+ * // Pick out the standard configuration properties
500
+ * const { customData, description, id, title, url } = configData;
501
+ *
502
+ * // Pick out the custom configuration properties
503
+ * if (customData) {
504
+ * const { customField1, customField2 } = customData;
505
+ * }
506
+ * ```
507
+ */
508
+ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentConfigurationData<T>>;
509
+ /**
510
+ * Registers a Search Agent that will provide search results to Here™’s search UI in response to user input and act on the user’s actions regarding those results.
511
+ *
512
+ * @param config The configuration for the Search Agent.
513
+ *
514
+ * @returns A promise that resolves with the Search Agent.
515
+ *
516
+ * @example Registering a basic Search Agent:
517
+ * ```ts
518
+ * import { Search } from "@openfin/cloud-api";
519
+ *
520
+ * // Handle incoming action and return a response that includes the URL to navigate to
521
+ * const onAction: Search.OnActionListener = (action, result) => {
522
+ * const { name } = action;
523
+ * const { data, key } = result;
524
+ * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
525
+ * const { id: ownerId } = owner;
526
+ * console.log(`Action "${name}" triggered on search result with key "${key}"`);
527
+ * switch (name) {
528
+ * case "view-owner":
529
+ * return { url: `${searchResultHostUrl}/people/${ownerId}` };
530
+ * case "view-result":
531
+ * return { url: `${searchResultHostUrl}/record/${key}` };
532
+ * default:
533
+ * console.warn(`Unknown action: ${name}`);
534
+ * }
535
+ * };
536
+ *
537
+ * // Handle incoming search request and return relevant search results
538
+ * const onSearch: Search.OnSearchListener = ({ context, query, signal }) => {
539
+ * const { pageNumber, pageSize } = context;
540
+ * try {
541
+ * let results: Search.SearchResult[] = [];
542
+ * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
543
+ * const response = await fetch(url, { signal });
544
+ * if (!response.ok) {
545
+ * throw new Error(`Request failed: ${response.status}`);
546
+ * }
547
+ * const { searchResults } = await response.json();
548
+ * results = searchResults.map((result) => {
549
+ * const { iconUrl, id: key, owner, subTitle, title } = result;
550
+ * const { name: ownerName } = owner as { id: string, name: string };
551
+ * return {
552
+ * actions: [
553
+ * {
554
+ * name: "view-result",
555
+ * description: `Go to ${title} in My Web App`,
556
+ * },
557
+ * {
558
+ * name: "view-owner",
559
+ * description: `Go to ${ownerName} in My Web App`,
560
+ * title: "View Owner",
561
+ * },
562
+ * ],
563
+ * data: {
564
+ * owner,
565
+ * searchResultHostUrl: `https://my-web-app.com`,
566
+ * },
567
+ * icon: iconUrl,
568
+ * key,
569
+ * label: subTitle,
570
+ * title,
571
+ * };
572
+ * });
573
+ * console.log("Returning results", results);
574
+ * return { results };
575
+ * } catch (err) {
576
+ * if ((err as Error).name === "AbortError") {
577
+ * // Ignore errors for cancelled requests
578
+ * return { results: [] };
579
+ * }
580
+ * throw err;
581
+ * }
582
+ * };
583
+ *
584
+ * // Register the search agent
585
+ * const searchAgent = await Search.register({ onAction, onSearch });
586
+ *
587
+ * // Set the Search Agent as ready to receive search requests
588
+ * await searchAgent.isReady();
589
+ * ```
590
+ *
591
+ * @deprecated Use `Agent.register` instead.
592
+ */
593
+ declare function register$1(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
594
+
595
+ type index$1_OnActionListener = OnActionListener;
596
+ type index$1_OnSearchListener = OnSearchListener;
597
+ type index$1_SearchAgent = SearchAgent;
598
+ type index$1_SearchAgentConfigurationData<T> = SearchAgentConfigurationData<T>;
599
+ type index$1_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
600
+ declare const index$1_getAgentConfiguration: typeof getAgentConfiguration;
601
+ declare namespace index$1 {
602
+ export { type index$1_OnActionListener as OnActionListener, type index$1_OnSearchListener as OnSearchListener, type SearchAction$1 as SearchAction, type index$1_SearchAgent as SearchAgent, type index$1_SearchAgentConfigurationData as SearchAgentConfigurationData, type index$1_SearchAgentRegistrationConfig as SearchAgentRegistrationConfig, type SearchListenerRequest$1 as SearchListenerRequest, type SearchRequestContext$1 as SearchRequestContext, type SearchResponse$1 as SearchResponse, type SearchResult$1 as SearchResult, type SearchResultActionResponse$1 as SearchResultActionResponse, index$1_getAgentConfiguration as getAgentConfiguration, register$1 as register };
603
+ }
604
+
605
+ /**
606
+ * Function that is called when the Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
607
+ *
608
+ * @param action The action that was triggered.
609
+ * @param result The search result that the action was triggered on.
610
+ *
611
+ * @returns Result that includes the URL that Here™ should navigate to, or `undefined` if no navigation is required.
612
+ */
613
+ type OnSearchActionListener = (action: SearchAction, result: SearchResult) => SearchResultActionResponse | Promise<SearchResultActionResponse>;
614
+ /**
615
+ * Function that is called when the Agent receives a query from Here™’s search UI
616
+ *
617
+ * @param request Search request data that includes the query.
618
+ *
619
+ * @returns Search response data that includes the search results.
620
+ */
621
+ type OnSearchRequestListener = (request: SearchListenerRequest) => SearchResponse | Promise<SearchResponse>;
622
+ /**
623
+ * An action that can be triggered by a user on a search result returned by a Agent.
624
+ *
625
+ * Actions are displayed as buttons alongside search results in Here™’s search UI. That is, except for the first action, which is hidden as it is triggered automatically when the user selects the search result.
626
+ */
627
+ type SearchAction = {
628
+ /**
629
+ * URL or data URI of an icon that will be displayed within the action button when Here™ is in Light mode.
630
+ */
631
+ darkIcon?: string;
632
+ /**
633
+ * A fuller description of the action that will be displayed in Here™’s search UI when the user hovers over the action button.
634
+ */
635
+ description?: string;
636
+ /**
637
+ * URL or data URI of an icon that will be displayed within the action button when Here™ is in Dark mode.
638
+ */
639
+ lightIcon?: string;
640
+ /**
641
+ * Internal identifier for the action which is used to identify the action in the {@link OnSearchActionListener}.
642
+ */
643
+ name: string;
644
+ /**
645
+ * Compact title of the action displayed within the action button.
646
+ */
647
+ title?: string;
648
+ };
649
+ /**
650
+ * Search request data provided to the {@link OnSearchRequestListener}.
651
+ */
652
+ type SearchListenerRequest = {
653
+ /**
654
+ * Provides additional context for the search request.
655
+ */
656
+ context: SearchRequestContext;
657
+ /**
658
+ * The query entered by the user in Here™’s search UI.
659
+ */
660
+ query: string;
661
+ /**
662
+ * Provide this signal to any `fetch` requests executed in the {@link OnSearchRequestListener} function as a result of this search request, so that they will be automatically cancelled if a new search request is received before they complete.
663
+ */
664
+ signal: AbortSignal;
665
+ };
666
+ /**
667
+ * Context data included with a search request.
668
+ */
669
+ type SearchRequestContext = {
670
+ /**
671
+ * Filters to apply to the search results.
672
+ */
673
+ filters: string[];
674
+ /**
675
+ * The locale of the client.
676
+ */
677
+ locale: string;
678
+ /**
679
+ * The page number of the search results to return.
680
+ */
681
+ pageNumber: number;
682
+ /**
683
+ * The number of search results to return per page.
684
+ */
685
+ pageSize: number;
686
+ /**
687
+ * The unique ID of the query.
688
+ */
689
+ queryId: string;
690
+ /**
691
+ * The timezone of the client.
692
+ */
693
+ timeZone: string;
694
+ };
695
+ /**
696
+ * Return type of the {@link OnSearchRequestListener}.
697
+ */
698
+ type SearchResponse = {
699
+ /**
700
+ * The search results to display in Here™’s search UI.
701
+ */
702
+ results: SearchResult[];
703
+ };
704
+ /**
705
+ * A search result returned by a Agent in response to a search request.
706
+ */
707
+ type SearchResult = {
708
+ /**
709
+ * Actions that can be triggered by the user against the search result.
710
+ */
711
+ actions: SearchAction[];
712
+ /**
713
+ * Additional data that can be used by the {@link OnSearchActionListener} when an action is triggered.
714
+ */
715
+ data?: Record<string, unknown>;
716
+ /**
717
+ * URL or data URI of an icon that will be displayed with the search result in Here™’s search UI.
718
+ */
719
+ icon?: string;
720
+ /**
721
+ * Unique identifier for the search result.
722
+ */
723
+ key: string;
724
+ /**
725
+ * Secondary text that will be displayed with the search result in Here™’s search UI.
726
+ */
727
+ label?: string;
728
+ /**
729
+ * Primary text that will be displayed with the search result in Here™’s search UI.
730
+ */
731
+ title: string;
732
+ };
733
+ /**
734
+ * Return type of the {@link OnSearchActionListener}.
735
+ */
736
+ type SearchResultActionResponse = {
737
+ /**
738
+ * URL that Here™ should navigate to.
739
+ */
740
+ url: string;
741
+ } | undefined;
742
+
743
+ type Agent = {
744
+ /**
745
+ * The features supported by the Agent.
746
+ */
747
+ features: AgentFeatures;
748
+ /**
749
+ * Joins the agent to a specific interop channel.
750
+ *
751
+ * @throws {InteropFeatureNotSupportedError} if the interop feature is not supported by the agent.
752
+ */
753
+ joinInteropChannel: (channelName: InteropColorChannel) => Promise<void>;
754
+ /**
755
+ * Sets whether or not the Agent is ready.
756
+ *
757
+ * @param ready Whether the Agent is ready (defaults to `true`).
758
+ */
759
+ setIsReady: (ready?: boolean) => Promise<void>;
760
+ };
761
+ /**
762
+ * The features supported by the Agent.
763
+ */
764
+ type AgentFeatures = {
765
+ interop?: {
766
+ defaultChannel?: InteropColorChannel;
767
+ fdc3Version: OpenFin$1.FDC3.Version;
768
+ };
769
+ search?: {
770
+ filters?: AgentSearchFilter[];
771
+ supportsPaging: boolean;
772
+ };
773
+ };
774
+ /**
775
+ * Configuration provided when registering a Agent.
776
+ */
777
+ type AgentRegistrationConfig = {
778
+ /**
779
+ * Search configuration required if the Agent supports search functionality.
780
+ */
781
+ search?: {
782
+ /**
783
+ * This listener is called when the Agent receives an action from Here™’s search UI that has been triggered by the user on one of the Agent’s search results.
784
+ *
785
+ * The listener returns a response back to Here™ that includes a URL to navigate to.
786
+ */
787
+ onAction: OnSearchActionListener;
788
+ /**
789
+ * This listener is called when the Agent receives a query from Here™’s search UI and returns relevant search results.
790
+ *
791
+ * Note: When the Agent is not ready this listener will not be called.
792
+ */
793
+ onSearch: OnSearchRequestListener;
794
+ };
795
+ };
796
+ /**
797
+ * A filter that can be applied to the Agent’s search results.
798
+ */
799
+ type AgentSearchFilter = {
800
+ icon?: string | {
801
+ dark: string;
802
+ light: string;
803
+ };
804
+ id: string;
805
+ title: string;
806
+ };
807
+ type InteropColorChannel = 'blue' | 'indigo' | 'pink' | 'teal' | 'green' | 'orange' | 'red' | 'yellow' | 'gray' | 'none';
808
+
809
+ /**
810
+ * Retrieves the Agent’s configuration data, as has been configured in the Here™ Admin Console.
811
+ *
812
+ * @returns A promise that resolves with an object containing properties that match the Agent’s configuration.
813
+ *
814
+ * @example Retrieving the Agent’s configuration data:
815
+ * ```ts
816
+ * import { Agent } from "@openfin/cloud-api";
817
+ *
818
+ * // Get the configuration data
819
+ * const configData = await Agent.getConfiguration<{ customField1: string, customField2: string }>();
820
+ *
821
+ * // Pick out the standard configuration properties
822
+ * const { customData, description, id, title, url } = configData;
823
+ *
824
+ * // Pick out the custom configuration properties
825
+ * if (customData) {
826
+ * const { customField1, customField2 } = customData;
827
+ * }
828
+ * ```
829
+ */
830
+ declare const getConfiguration: <T extends Record<string, unknown>>() => Promise<T>;
831
+ /**
832
+ * Registers an Agent.
833
+ *
834
+ * @param config The configuration for the Agent.
835
+ *
836
+ * @returns A promise that resolves with the Agent.
837
+ *
838
+ * @example Registering an Agent that will provide search results:
839
+ * ```ts
840
+ * import { Agent } from "@openfin/cloud-api";
841
+ *
842
+ * // Handle incoming action and return a response that includes the URL to navigate to
843
+ * const onAction: Agent.OnSearchActionListener = (action, result) => {
844
+ * const { name } = action;
845
+ * const { data, key } = result;
846
+ * const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
847
+ * const { id: ownerId } = owner;
848
+ *
849
+ * console.log(`Action "${name}" triggered on search result with key "${key}"`);
850
+ *
851
+ * switch (name) {
852
+ * case "view-owner":
853
+ * return { url: `${searchResultHostUrl}/people/${ownerId}` };
854
+ * case "view-result":
855
+ * return { url: `${searchResultHostUrl}/record/${key}` };
856
+ * default:
857
+ * console.warn(`Unknown action: ${name}`);
858
+ * }
859
+ * };
860
+ *
861
+ * // Handle incoming search request and return relevant search results
862
+ * const onSearch: Agent.OnSearchRequestListener = ({ context, query, signal }) => {
863
+ * const { pageNumber, pageSize } = context;
864
+ * try {
865
+ * let results: Agent.SearchResult[] = [];
866
+ * const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
867
+ * const response = await fetch(url, { signal });
868
+ * if (!response.ok) {
869
+ * throw new Error(`Request failed: ${response.status}`);
870
+ * }
871
+ * const { searchResults } = await response.json();
872
+ * results = searchResults.map((result) => {
873
+ * const { iconUrl, id: key, owner, subTitle, title } = result;
874
+ * const { name: ownerName } = owner as { id: string, name: string };
875
+ * return {
876
+ * actions: [
877
+ * {
878
+ * name: "view-result",
879
+ * description: `Go to ${title} in My Web App`,
880
+ * },
881
+ * {
882
+ * name: "view-owner",
883
+ * description: `Go to ${ownerName} in My Web App`,
884
+ * title: "View Owner",
885
+ * },
886
+ * ],
887
+ * data: {
888
+ * owner,
889
+ * searchResultHostUrl: `https://my-web-app.com`,
890
+ * },
891
+ * icon: iconUrl,
892
+ * key,
893
+ * label: subTitle,
894
+ * title,
895
+ * };
896
+ * });
897
+ * console.log("Returning results", results);
898
+ * return { results };
899
+ * } catch (err) {
900
+ * if ((err as Error).name === "AbortError") {
901
+ * // Ignore errors for cancelled requests
902
+ * return { results: [] };
903
+ * }
904
+ * throw err;
905
+ * }
906
+ * };
907
+ *
908
+ * // Register the agent
909
+ * const agent = await Agent.register({ search: { onAction, onSearch } });
910
+ *
911
+ * // Set the Agent as ready to receive requests
912
+ * await agent.isReady();
913
+ * ```
914
+ */
915
+ declare function register(config: AgentRegistrationConfig): Promise<Agent>;
916
+
917
+ type index_Agent = Agent;
918
+ type index_AgentFeatures = AgentFeatures;
919
+ type index_AgentRegistrationConfig = AgentRegistrationConfig;
920
+ type index_AgentSearchFilter = AgentSearchFilter;
921
+ type index_InteropColorChannel = InteropColorChannel;
922
+ type index_OnSearchActionListener = OnSearchActionListener;
923
+ type index_OnSearchRequestListener = OnSearchRequestListener;
924
+ type index_SearchListenerRequest = SearchListenerRequest;
925
+ declare const index_getConfiguration: typeof getConfiguration;
926
+ declare const index_register: typeof register;
927
+ declare namespace index {
928
+ export { type index_Agent as Agent, type index_AgentFeatures as AgentFeatures, type index_AgentRegistrationConfig as AgentRegistrationConfig, type index_AgentSearchFilter as AgentSearchFilter, type index_InteropColorChannel as InteropColorChannel, type index_OnSearchActionListener as OnSearchActionListener, type index_OnSearchRequestListener as OnSearchRequestListener, type index_SearchListenerRequest as SearchListenerRequest, index_getConfiguration as getConfiguration, index_register as register };
929
+ }
930
+
931
+ declare global {
932
+ interface Window {
933
+ fin: typeof OpenFin.fin;
934
+ }
935
+ }
256
936
 
257
- export { type AppPermissions, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, setAppUserSettings };
937
+ export { index as Agent, type AppPermissions, type LaunchContentOptions, index$1 as Search, type FlannelChannelProvider as __INTERNAL_FlannelChannelProvider, type FlannelClearNotificationRequest as __INTERNAL_FlannelClearNotificationRequest, type FlannelClearNotificationResponse as __INTERNAL_FlannelClearNotificationResponse, type FlannelCreateNotificationRequest as __INTERNAL_FlannelCreateNotificationRequest, type FlannelCreateNotificationResponse as __INTERNAL_FlannelCreateNotificationResponse, type FlannelUpdateNotificationRequest as __INTERNAL_FlannelUpdateNotificationRequest, type FlannelUpdateNotificationResponse as __INTERNAL_FlannelUpdateNotificationResponse, getAppSettings, getAppUserPermissions, getAppUserSettings, getNotificationsClient, launchContent, launchSupertab, launchWorkspace, setAppUserSettings };