@openfin/cloud-api 0.0.1-alpha.db9fd81 → 0.0.1-alpha.dbc6bfa
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +371 -46
- package/dist/index.d.ts +371 -46
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +14 -11
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as OpenFin from '@openfin/core';
|
|
2
|
-
import OpenFin__default from '@openfin/core';
|
|
2
|
+
import OpenFin__default, { OpenFin as OpenFin$1 } from '@openfin/core';
|
|
3
3
|
import * as NotificationsTypes from '@openfin/workspace/notifications';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -298,38 +298,38 @@ declare function launchSupertab(id: string): Promise<void>;
|
|
|
298
298
|
declare function launchWorkspace(id: string): Promise<void>;
|
|
299
299
|
|
|
300
300
|
/**
|
|
301
|
-
* Function that is called when the Search Agent receives an action from
|
|
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
302
|
*
|
|
303
303
|
* @param action The action that was triggered.
|
|
304
304
|
* @param result The search result that the action was triggered on.
|
|
305
305
|
*
|
|
306
|
-
* @returns Result that includes the URL that
|
|
306
|
+
* @returns Result that includes the URL that HERE should navigate to, or `undefined` if no navigation is required.
|
|
307
307
|
*/
|
|
308
|
-
type OnActionListener = (action: SearchAction, result: SearchResult) => SearchResultActionResponse | Promise<SearchResultActionResponse>;
|
|
308
|
+
type OnActionListener = (action: SearchAction$1, result: SearchResult$1) => SearchResultActionResponse$1 | Promise<SearchResultActionResponse$1>;
|
|
309
309
|
/**
|
|
310
|
-
* Function that is called when the Search Agent receives a query from
|
|
310
|
+
* Function that is called when the Search Agent receives a query from HERE's search UI
|
|
311
311
|
*
|
|
312
312
|
* @param request Search request data that includes the query.
|
|
313
313
|
*
|
|
314
314
|
* @returns Search response data that includes the search results.
|
|
315
315
|
*/
|
|
316
|
-
type OnSearchListener = (request: SearchListenerRequest) => SearchResponse | Promise<SearchResponse>;
|
|
316
|
+
type OnSearchListener = (request: SearchListenerRequest$1) => SearchResponse$1 | Promise<SearchResponse$1>;
|
|
317
317
|
/**
|
|
318
318
|
* An action that can be triggered by a user on a search result returned by a Search Agent.
|
|
319
319
|
*
|
|
320
|
-
* Actions are displayed as buttons alongside search results in
|
|
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
321
|
*/
|
|
322
|
-
type SearchAction = {
|
|
322
|
+
type SearchAction$1 = {
|
|
323
323
|
/**
|
|
324
|
-
* URL or data URI of an icon that will be displayed within the action button when
|
|
324
|
+
* URL or data URI of an icon that will be displayed within the action button when HERE is in Light mode.
|
|
325
325
|
*/
|
|
326
326
|
darkIcon?: string;
|
|
327
327
|
/**
|
|
328
|
-
* A fuller description of the action that will be displayed in
|
|
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
329
|
*/
|
|
330
330
|
description?: string;
|
|
331
331
|
/**
|
|
332
|
-
* URL or data URI of an icon that will be displayed within the action button when
|
|
332
|
+
* URL or data URI of an icon that will be displayed within the action button when HERE is in Dark mode.
|
|
333
333
|
*/
|
|
334
334
|
lightIcon?: string;
|
|
335
335
|
/**
|
|
@@ -342,7 +342,9 @@ type SearchAction = {
|
|
|
342
342
|
title?: string;
|
|
343
343
|
};
|
|
344
344
|
/**
|
|
345
|
-
* A Search Agent returns search results to
|
|
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.
|
|
346
348
|
*/
|
|
347
349
|
type SearchAgent = {
|
|
348
350
|
/**
|
|
@@ -351,11 +353,13 @@ type SearchAgent = {
|
|
|
351
353
|
* When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
|
|
352
354
|
*
|
|
353
355
|
* @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
|
|
356
|
+
*
|
|
357
|
+
* @deprecated Use {@link Agent.setIsReady} instead.
|
|
354
358
|
*/
|
|
355
359
|
isReady: (ready?: boolean) => Promise<void>;
|
|
356
360
|
};
|
|
357
361
|
/**
|
|
358
|
-
* The Search Agent
|
|
362
|
+
* The Search Agent's configuration data as configured in the HERE Admin Console.
|
|
359
363
|
*
|
|
360
364
|
* @typeParam T Type definition for the `customData` property, containing any custom configuration data specific to the Search Agent.
|
|
361
365
|
*/
|
|
@@ -386,13 +390,13 @@ type SearchAgentConfigurationData<T> = {
|
|
|
386
390
|
*/
|
|
387
391
|
type SearchAgentRegistrationConfig = {
|
|
388
392
|
/**
|
|
389
|
-
* This listener is called when the Search Agent receives an action from
|
|
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.
|
|
390
394
|
*
|
|
391
|
-
* The listener returns a response back to
|
|
395
|
+
* The listener returns a response back to HERE that includes a URL to navigate to.
|
|
392
396
|
*/
|
|
393
397
|
onAction: OnActionListener;
|
|
394
398
|
/**
|
|
395
|
-
* This listener is called when the Search Agent receives a query from
|
|
399
|
+
* This listener is called when the Search Agent receives a query from HERE's search UI and returns relevant search results.
|
|
396
400
|
*
|
|
397
401
|
* Note: When the Search Agent is not ready this listener will not be called.
|
|
398
402
|
*/
|
|
@@ -401,13 +405,13 @@ type SearchAgentRegistrationConfig = {
|
|
|
401
405
|
/**
|
|
402
406
|
* Search request data provided to the {@link OnSearchListener}.
|
|
403
407
|
*/
|
|
404
|
-
type SearchListenerRequest = {
|
|
408
|
+
type SearchListenerRequest$1 = {
|
|
405
409
|
/**
|
|
406
410
|
* Provides additional context for the search request.
|
|
407
411
|
*/
|
|
408
|
-
context: SearchRequestContext;
|
|
412
|
+
context: SearchRequestContext$1;
|
|
409
413
|
/**
|
|
410
|
-
* The query entered by the user in
|
|
414
|
+
* The query entered by the user in HERE's search UI.
|
|
411
415
|
*/
|
|
412
416
|
query: string;
|
|
413
417
|
/**
|
|
@@ -418,7 +422,7 @@ type SearchListenerRequest = {
|
|
|
418
422
|
/**
|
|
419
423
|
* Context data included with a search request.
|
|
420
424
|
*/
|
|
421
|
-
type SearchRequestContext = {
|
|
425
|
+
type SearchRequestContext$1 = {
|
|
422
426
|
/**
|
|
423
427
|
* The page number of the search results to return.
|
|
424
428
|
*/
|
|
@@ -435,26 +439,26 @@ type SearchRequestContext = {
|
|
|
435
439
|
/**
|
|
436
440
|
* Return type of the {@link OnSearchListener}.
|
|
437
441
|
*/
|
|
438
|
-
type SearchResponse = {
|
|
442
|
+
type SearchResponse$1 = {
|
|
439
443
|
/**
|
|
440
|
-
* The search results to display in
|
|
444
|
+
* The search results to display in HERE's search UI.
|
|
441
445
|
*/
|
|
442
|
-
results: SearchResult[];
|
|
446
|
+
results: SearchResult$1[];
|
|
443
447
|
};
|
|
444
448
|
/**
|
|
445
449
|
* A search result returned by a Search Agent in response to a search request.
|
|
446
450
|
*/
|
|
447
|
-
type SearchResult = {
|
|
451
|
+
type SearchResult$1 = {
|
|
448
452
|
/**
|
|
449
453
|
* Actions that can be triggered by the user against the search result.
|
|
450
454
|
*/
|
|
451
|
-
actions: SearchAction[];
|
|
455
|
+
actions: SearchAction$1[];
|
|
452
456
|
/**
|
|
453
457
|
* Additional data that can be used by the {@link OnActionListener} when an action is triggered.
|
|
454
458
|
*/
|
|
455
459
|
data?: Record<string, unknown>;
|
|
456
460
|
/**
|
|
457
|
-
* URL or data URI of an icon that will be displayed with the search result in
|
|
461
|
+
* URL or data URI of an icon that will be displayed with the search result in HERE's search UI.
|
|
458
462
|
*/
|
|
459
463
|
icon?: string;
|
|
460
464
|
/**
|
|
@@ -462,26 +466,26 @@ type SearchResult = {
|
|
|
462
466
|
*/
|
|
463
467
|
key: string;
|
|
464
468
|
/**
|
|
465
|
-
* Secondary text that will be displayed with the search result in
|
|
469
|
+
* Secondary text that will be displayed with the search result in HERE's search UI.
|
|
466
470
|
*/
|
|
467
471
|
label?: string;
|
|
468
472
|
/**
|
|
469
|
-
* Primary text that will be displayed with the search result in
|
|
473
|
+
* Primary text that will be displayed with the search result in HERE's search UI.
|
|
470
474
|
*/
|
|
471
475
|
title: string;
|
|
472
476
|
};
|
|
473
477
|
/**
|
|
474
478
|
* Return type of the {@link OnActionListener}.
|
|
475
479
|
*/
|
|
476
|
-
type SearchResultActionResponse = {
|
|
480
|
+
type SearchResultActionResponse$1 = {
|
|
477
481
|
/**
|
|
478
|
-
* URL that
|
|
482
|
+
* URL that HERE should navigate to.
|
|
479
483
|
*/
|
|
480
484
|
url: string;
|
|
481
485
|
} | undefined;
|
|
482
486
|
|
|
483
487
|
/**
|
|
484
|
-
* Retrieves the Search Agent
|
|
488
|
+
* Retrieves the Search Agent's configuration data, as has been configured in the HERE Admin Console.
|
|
485
489
|
*
|
|
486
490
|
* @returns A promise that resolves with an object containing properties that match the Search Agent’s configuration.
|
|
487
491
|
*
|
|
@@ -503,7 +507,7 @@ type SearchResultActionResponse = {
|
|
|
503
507
|
*/
|
|
504
508
|
declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentConfigurationData<T>>;
|
|
505
509
|
/**
|
|
506
|
-
* Registers a Search Agent that will provide search results to
|
|
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.
|
|
507
511
|
*
|
|
508
512
|
* @param config The configuration for the Search Agent.
|
|
509
513
|
*
|
|
@@ -583,24 +587,345 @@ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentC
|
|
|
583
587
|
* // Set the Search Agent as ready to receive search requests
|
|
584
588
|
* await searchAgent.isReady();
|
|
585
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
|
+
* ```
|
|
586
914
|
*/
|
|
587
|
-
declare function register(config:
|
|
915
|
+
declare function register(config: AgentRegistrationConfig): Promise<Agent>;
|
|
588
916
|
|
|
589
|
-
type
|
|
590
|
-
type
|
|
591
|
-
type
|
|
592
|
-
type
|
|
593
|
-
type
|
|
594
|
-
type
|
|
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;
|
|
595
924
|
type index_SearchListenerRequest = SearchListenerRequest;
|
|
596
|
-
|
|
597
|
-
type index_SearchResponse = SearchResponse;
|
|
598
|
-
type index_SearchResult = SearchResult;
|
|
599
|
-
type index_SearchResultActionResponse = SearchResultActionResponse;
|
|
600
|
-
declare const index_getAgentConfiguration: typeof getAgentConfiguration;
|
|
925
|
+
declare const index_getConfiguration: typeof getConfiguration;
|
|
601
926
|
declare const index_register: typeof register;
|
|
602
927
|
declare namespace index {
|
|
603
|
-
export { type
|
|
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 };
|
|
604
929
|
}
|
|
605
930
|
|
|
606
931
|
declare global {
|
|
@@ -609,4 +934,4 @@ declare global {
|
|
|
609
934
|
}
|
|
610
935
|
}
|
|
611
936
|
|
|
612
|
-
export { type AppPermissions, type LaunchContentOptions, index 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 };
|
|
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 };
|