@openfin/cloud-api 0.0.1-alpha.debe142 → 0.0.1-alpha.dee71da
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 -2
- package/dist/index.d.cts +387 -49
- package/dist/index.d.ts +387 -49
- package/dist/index.js +1 -2
- package/package.json +17 -12
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
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,40 +298,42 @@ 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 = {
|
|
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;
|
|
322
|
+
type SearchAction$1 = {
|
|
327
323
|
/**
|
|
328
|
-
* A fuller description of the action that will be displayed in
|
|
324
|
+
* A fuller description of the action that will be displayed in HERE's search UI when the user hovers over the action button.
|
|
329
325
|
*/
|
|
330
326
|
description?: string;
|
|
331
327
|
/**
|
|
332
|
-
*
|
|
328
|
+
* Icon that will be displayed within the action button in HERE's search UI.
|
|
329
|
+
*
|
|
330
|
+
* This can be a URL/data URI string (used for both Light and Dark modes),
|
|
331
|
+
* or an object containing separate icons for Light and Dark modes.
|
|
333
332
|
*/
|
|
334
|
-
|
|
333
|
+
icon?: string | {
|
|
334
|
+
dark: string;
|
|
335
|
+
light: string;
|
|
336
|
+
};
|
|
335
337
|
/**
|
|
336
338
|
* Internal identifier for the action which is used to identify the action in the {@link OnActionListener}.
|
|
337
339
|
*/
|
|
@@ -342,7 +344,9 @@ type SearchAction = {
|
|
|
342
344
|
title?: string;
|
|
343
345
|
};
|
|
344
346
|
/**
|
|
345
|
-
* A Search Agent returns search results to
|
|
347
|
+
* 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.
|
|
348
|
+
*
|
|
349
|
+
* @deprecated Use {@link Agent} instead.
|
|
346
350
|
*/
|
|
347
351
|
type SearchAgent = {
|
|
348
352
|
/**
|
|
@@ -351,11 +355,13 @@ type SearchAgent = {
|
|
|
351
355
|
* When a Search Agent is first registered, it will not receive search queries until it is set as ready by calling this function.
|
|
352
356
|
*
|
|
353
357
|
* @param ready Whether the Search Agent is ready to provide search results (defaults to `true`).
|
|
358
|
+
*
|
|
359
|
+
* @deprecated Use {@link Agent.setIsReady} instead.
|
|
354
360
|
*/
|
|
355
361
|
isReady: (ready?: boolean) => Promise<void>;
|
|
356
362
|
};
|
|
357
363
|
/**
|
|
358
|
-
* The Search Agent
|
|
364
|
+
* The Search Agent's configuration data as configured in the HERE Admin Console.
|
|
359
365
|
*
|
|
360
366
|
* @typeParam T Type definition for the `customData` property, containing any custom configuration data specific to the Search Agent.
|
|
361
367
|
*/
|
|
@@ -386,13 +392,13 @@ type SearchAgentConfigurationData<T> = {
|
|
|
386
392
|
*/
|
|
387
393
|
type SearchAgentRegistrationConfig = {
|
|
388
394
|
/**
|
|
389
|
-
* This listener is called when the Search Agent receives an action from
|
|
395
|
+
* 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
396
|
*
|
|
391
|
-
* The listener returns a response back to
|
|
397
|
+
* The listener returns a response back to HERE that includes a URL to navigate to.
|
|
392
398
|
*/
|
|
393
399
|
onAction: OnActionListener;
|
|
394
400
|
/**
|
|
395
|
-
* This listener is called when the Search Agent receives a query from
|
|
401
|
+
* This listener is called when the Search Agent receives a query from HERE's search UI and returns relevant search results.
|
|
396
402
|
*
|
|
397
403
|
* Note: When the Search Agent is not ready this listener will not be called.
|
|
398
404
|
*/
|
|
@@ -401,13 +407,13 @@ type SearchAgentRegistrationConfig = {
|
|
|
401
407
|
/**
|
|
402
408
|
* Search request data provided to the {@link OnSearchListener}.
|
|
403
409
|
*/
|
|
404
|
-
type SearchListenerRequest = {
|
|
410
|
+
type SearchListenerRequest$1 = {
|
|
405
411
|
/**
|
|
406
412
|
* Provides additional context for the search request.
|
|
407
413
|
*/
|
|
408
|
-
context: SearchRequestContext;
|
|
414
|
+
context: SearchRequestContext$1;
|
|
409
415
|
/**
|
|
410
|
-
* The query entered by the user in
|
|
416
|
+
* The query entered by the user in HERE's search UI.
|
|
411
417
|
*/
|
|
412
418
|
query: string;
|
|
413
419
|
/**
|
|
@@ -418,7 +424,7 @@ type SearchListenerRequest = {
|
|
|
418
424
|
/**
|
|
419
425
|
* Context data included with a search request.
|
|
420
426
|
*/
|
|
421
|
-
type SearchRequestContext = {
|
|
427
|
+
type SearchRequestContext$1 = {
|
|
422
428
|
/**
|
|
423
429
|
* The page number of the search results to return.
|
|
424
430
|
*/
|
|
@@ -435,26 +441,26 @@ type SearchRequestContext = {
|
|
|
435
441
|
/**
|
|
436
442
|
* Return type of the {@link OnSearchListener}.
|
|
437
443
|
*/
|
|
438
|
-
type SearchResponse = {
|
|
444
|
+
type SearchResponse$1 = {
|
|
439
445
|
/**
|
|
440
|
-
* The search results to display in
|
|
446
|
+
* The search results to display in HERE's search UI.
|
|
441
447
|
*/
|
|
442
|
-
results: SearchResult[];
|
|
448
|
+
results: SearchResult$1[];
|
|
443
449
|
};
|
|
444
450
|
/**
|
|
445
451
|
* A search result returned by a Search Agent in response to a search request.
|
|
446
452
|
*/
|
|
447
|
-
type SearchResult = {
|
|
453
|
+
type SearchResult$1 = {
|
|
448
454
|
/**
|
|
449
455
|
* Actions that can be triggered by the user against the search result.
|
|
450
456
|
*/
|
|
451
|
-
actions: SearchAction[];
|
|
457
|
+
actions: SearchAction$1[];
|
|
452
458
|
/**
|
|
453
459
|
* Additional data that can be used by the {@link OnActionListener} when an action is triggered.
|
|
454
460
|
*/
|
|
455
461
|
data?: Record<string, unknown>;
|
|
456
462
|
/**
|
|
457
|
-
* URL or data URI of an icon that will be displayed with the search result in
|
|
463
|
+
* URL or data URI of an icon that will be displayed with the search result in HERE's search UI.
|
|
458
464
|
*/
|
|
459
465
|
icon?: string;
|
|
460
466
|
/**
|
|
@@ -462,26 +468,26 @@ type SearchResult = {
|
|
|
462
468
|
*/
|
|
463
469
|
key: string;
|
|
464
470
|
/**
|
|
465
|
-
* Secondary text that will be displayed with the search result in
|
|
471
|
+
* Secondary text that will be displayed with the search result in HERE's search UI.
|
|
466
472
|
*/
|
|
467
473
|
label?: string;
|
|
468
474
|
/**
|
|
469
|
-
* Primary text that will be displayed with the search result in
|
|
475
|
+
* Primary text that will be displayed with the search result in HERE's search UI.
|
|
470
476
|
*/
|
|
471
477
|
title: string;
|
|
472
478
|
};
|
|
473
479
|
/**
|
|
474
480
|
* Return type of the {@link OnActionListener}.
|
|
475
481
|
*/
|
|
476
|
-
type SearchResultActionResponse = {
|
|
482
|
+
type SearchResultActionResponse$1 = {
|
|
477
483
|
/**
|
|
478
|
-
* URL that
|
|
484
|
+
* URL that HERE should navigate to.
|
|
479
485
|
*/
|
|
480
486
|
url: string;
|
|
481
487
|
} | undefined;
|
|
482
488
|
|
|
483
489
|
/**
|
|
484
|
-
* Retrieves the Search Agent
|
|
490
|
+
* Retrieves the Search Agent's configuration data, as has been configured in the HERE Admin Console.
|
|
485
491
|
*
|
|
486
492
|
* @returns A promise that resolves with an object containing properties that match the Search Agent’s configuration.
|
|
487
493
|
*
|
|
@@ -503,7 +509,7 @@ type SearchResultActionResponse = {
|
|
|
503
509
|
*/
|
|
504
510
|
declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentConfigurationData<T>>;
|
|
505
511
|
/**
|
|
506
|
-
* Registers a Search Agent that will provide search results to
|
|
512
|
+
* 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
513
|
*
|
|
508
514
|
* @param config The configuration for the Search Agent.
|
|
509
515
|
*
|
|
@@ -554,6 +560,10 @@ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentC
|
|
|
554
560
|
* name: "view-owner",
|
|
555
561
|
* description: `Go to ${ownerName} in My Web App`,
|
|
556
562
|
* title: "View Owner",
|
|
563
|
+
* icon: {
|
|
564
|
+
* dark: "data:image/svg+xml,...",
|
|
565
|
+
* light: "data:image/svg+xml,...",
|
|
566
|
+
* },
|
|
557
567
|
* },
|
|
558
568
|
* ],
|
|
559
569
|
* data: {
|
|
@@ -583,24 +593,352 @@ declare function getAgentConfiguration<T extends object>(): Promise<SearchAgentC
|
|
|
583
593
|
* // Set the Search Agent as ready to receive search requests
|
|
584
594
|
* await searchAgent.isReady();
|
|
585
595
|
* ```
|
|
596
|
+
*
|
|
597
|
+
* @deprecated Use `Agent.register` instead.
|
|
598
|
+
*/
|
|
599
|
+
declare function register$1(config: SearchAgentRegistrationConfig): Promise<SearchAgent>;
|
|
600
|
+
|
|
601
|
+
type index$1_OnActionListener = OnActionListener;
|
|
602
|
+
type index$1_OnSearchListener = OnSearchListener;
|
|
603
|
+
type index$1_SearchAgent = SearchAgent;
|
|
604
|
+
type index$1_SearchAgentConfigurationData<T> = SearchAgentConfigurationData<T>;
|
|
605
|
+
type index$1_SearchAgentRegistrationConfig = SearchAgentRegistrationConfig;
|
|
606
|
+
declare const index$1_getAgentConfiguration: typeof getAgentConfiguration;
|
|
607
|
+
declare namespace index$1 {
|
|
608
|
+
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 };
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* 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.
|
|
613
|
+
*
|
|
614
|
+
* @param action The action that was triggered.
|
|
615
|
+
* @param result The search result that the action was triggered on.
|
|
616
|
+
*
|
|
617
|
+
* @returns Result that includes the URL that HERE should navigate to, or `undefined` if no navigation is required.
|
|
618
|
+
*/
|
|
619
|
+
type OnSearchActionListener = (action: SearchAction, result: SearchResult) => SearchResultActionResponse | Promise<SearchResultActionResponse>;
|
|
620
|
+
/**
|
|
621
|
+
* Function that is called when the Agent receives a query from HERE's search UI
|
|
622
|
+
*
|
|
623
|
+
* @param request Search request data that includes the query.
|
|
624
|
+
*
|
|
625
|
+
* @returns Search response data that includes the search results.
|
|
626
|
+
*/
|
|
627
|
+
type OnSearchRequestListener = (request: SearchListenerRequest) => SearchResponse | Promise<SearchResponse>;
|
|
628
|
+
/**
|
|
629
|
+
* An action that can be triggered by a user on a search result returned by a Agent.
|
|
630
|
+
*
|
|
631
|
+
* 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.
|
|
632
|
+
*/
|
|
633
|
+
type SearchAction = {
|
|
634
|
+
/**
|
|
635
|
+
* A fuller description of the action that will be displayed in HERE's search UI when the user hovers over the action button.
|
|
636
|
+
*/
|
|
637
|
+
description?: string;
|
|
638
|
+
/**
|
|
639
|
+
* Icon that will be displayed within the action button in HERE's search UI.
|
|
640
|
+
*
|
|
641
|
+
* This can be a URL/data URI string (used for both Light and Dark modes),
|
|
642
|
+
* or an object containing separate icons for Light and Dark modes.
|
|
643
|
+
*/
|
|
644
|
+
icon?: string | {
|
|
645
|
+
dark: string;
|
|
646
|
+
light: string;
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* Internal identifier for the action which is used to identify the action in the {@link OnSearchActionListener}.
|
|
650
|
+
*/
|
|
651
|
+
name: string;
|
|
652
|
+
/**
|
|
653
|
+
* Compact title of the action displayed within the action button.
|
|
654
|
+
*/
|
|
655
|
+
title?: string;
|
|
656
|
+
};
|
|
657
|
+
/**
|
|
658
|
+
* Search request data provided to the {@link OnSearchRequestListener}.
|
|
659
|
+
*/
|
|
660
|
+
type SearchListenerRequest = {
|
|
661
|
+
/**
|
|
662
|
+
* Provides additional context for the search request.
|
|
663
|
+
*/
|
|
664
|
+
context: SearchRequestContext;
|
|
665
|
+
/**
|
|
666
|
+
* The query entered by the user in HERE's search UI.
|
|
667
|
+
*/
|
|
668
|
+
query: string;
|
|
669
|
+
/**
|
|
670
|
+
* 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.
|
|
671
|
+
*/
|
|
672
|
+
signal: AbortSignal;
|
|
673
|
+
};
|
|
674
|
+
/**
|
|
675
|
+
* Context data included with a search request.
|
|
676
|
+
*/
|
|
677
|
+
type SearchRequestContext = {
|
|
678
|
+
/**
|
|
679
|
+
* Filters to apply to the search results.
|
|
680
|
+
*/
|
|
681
|
+
filters: string[];
|
|
682
|
+
/**
|
|
683
|
+
* The locale of the client.
|
|
684
|
+
*/
|
|
685
|
+
locale: string;
|
|
686
|
+
/**
|
|
687
|
+
* The page number of the search results to return.
|
|
688
|
+
*/
|
|
689
|
+
pageNumber: number;
|
|
690
|
+
/**
|
|
691
|
+
* The number of search results to return per page.
|
|
692
|
+
*/
|
|
693
|
+
pageSize: number;
|
|
694
|
+
/**
|
|
695
|
+
* The unique ID of the query.
|
|
696
|
+
*/
|
|
697
|
+
queryId: string;
|
|
698
|
+
/**
|
|
699
|
+
* The timezone of the client.
|
|
700
|
+
*/
|
|
701
|
+
timeZone: string;
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* Return type of the {@link OnSearchRequestListener}.
|
|
705
|
+
*/
|
|
706
|
+
type SearchResponse = {
|
|
707
|
+
/**
|
|
708
|
+
* The search results to display in HERE's search UI.
|
|
709
|
+
*/
|
|
710
|
+
results: SearchResult[];
|
|
711
|
+
};
|
|
712
|
+
/**
|
|
713
|
+
* A search result returned by a Agent in response to a search request.
|
|
714
|
+
*/
|
|
715
|
+
type SearchResult = {
|
|
716
|
+
/**
|
|
717
|
+
* Actions that can be triggered by the user against the search result.
|
|
718
|
+
*/
|
|
719
|
+
actions: SearchAction[];
|
|
720
|
+
/**
|
|
721
|
+
* Additional data that can be used by the {@link OnSearchActionListener} when an action is triggered.
|
|
722
|
+
*/
|
|
723
|
+
data?: Record<string, unknown>;
|
|
724
|
+
/**
|
|
725
|
+
* URL or data URI of an icon that will be displayed with the search result in HERE's search UI.
|
|
726
|
+
*/
|
|
727
|
+
icon?: string;
|
|
728
|
+
/**
|
|
729
|
+
* Unique identifier for the search result.
|
|
730
|
+
*/
|
|
731
|
+
key: string;
|
|
732
|
+
/**
|
|
733
|
+
* Secondary text that will be displayed with the search result in HERE's search UI.
|
|
734
|
+
*/
|
|
735
|
+
label?: string;
|
|
736
|
+
/**
|
|
737
|
+
* Primary text that will be displayed with the search result in HERE's search UI.
|
|
738
|
+
*/
|
|
739
|
+
title: string;
|
|
740
|
+
};
|
|
741
|
+
/**
|
|
742
|
+
* Return type of the {@link OnSearchActionListener}.
|
|
743
|
+
*/
|
|
744
|
+
type SearchResultActionResponse = {
|
|
745
|
+
/**
|
|
746
|
+
* URL that HERE should navigate to.
|
|
747
|
+
*/
|
|
748
|
+
url: string;
|
|
749
|
+
} | undefined;
|
|
750
|
+
|
|
751
|
+
type Agent = {
|
|
752
|
+
/**
|
|
753
|
+
* The features supported by the Agent.
|
|
754
|
+
*/
|
|
755
|
+
features: AgentFeatures;
|
|
756
|
+
/**
|
|
757
|
+
* Joins the agent to a specific interop channel.
|
|
758
|
+
*
|
|
759
|
+
* @throws {InteropFeatureNotSupportedError} if the interop feature is not supported by the agent.
|
|
760
|
+
*/
|
|
761
|
+
joinInteropChannel: (channelName: InteropColorChannel) => Promise<void>;
|
|
762
|
+
/**
|
|
763
|
+
* Sets whether or not the Agent is ready.
|
|
764
|
+
*
|
|
765
|
+
* @param ready Whether the Agent is ready (defaults to `true`).
|
|
766
|
+
*/
|
|
767
|
+
setIsReady: (ready?: boolean) => Promise<void>;
|
|
768
|
+
};
|
|
769
|
+
/**
|
|
770
|
+
* The features supported by the Agent.
|
|
771
|
+
*/
|
|
772
|
+
type AgentFeatures = {
|
|
773
|
+
interop?: {
|
|
774
|
+
defaultChannel?: InteropColorChannel;
|
|
775
|
+
fdc3Version: OpenFin$1.FDC3.Version;
|
|
776
|
+
};
|
|
777
|
+
search?: {
|
|
778
|
+
filters?: AgentSearchFilter[];
|
|
779
|
+
supportsPaging: boolean;
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
/**
|
|
783
|
+
* Configuration provided when registering a Agent.
|
|
784
|
+
*/
|
|
785
|
+
type AgentRegistrationConfig = {
|
|
786
|
+
/**
|
|
787
|
+
* Search configuration required if the Agent supports search functionality.
|
|
788
|
+
*/
|
|
789
|
+
search?: {
|
|
790
|
+
/**
|
|
791
|
+
* 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.
|
|
792
|
+
*
|
|
793
|
+
* The listener returns a response back to HERE that includes a URL to navigate to.
|
|
794
|
+
*/
|
|
795
|
+
onAction: OnSearchActionListener;
|
|
796
|
+
/**
|
|
797
|
+
* This listener is called when the Agent receives a query from HERE's search UI and returns relevant search results.
|
|
798
|
+
*
|
|
799
|
+
* Note: When the Agent is not ready this listener will not be called.
|
|
800
|
+
*/
|
|
801
|
+
onSearch: OnSearchRequestListener;
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* A filter that can be applied to the Agent’s search results.
|
|
806
|
+
*/
|
|
807
|
+
type AgentSearchFilter = {
|
|
808
|
+
icon?: string | {
|
|
809
|
+
dark: string;
|
|
810
|
+
light: string;
|
|
811
|
+
};
|
|
812
|
+
id: string;
|
|
813
|
+
title: string;
|
|
814
|
+
};
|
|
815
|
+
type InteropColorChannel = 'blue' | 'indigo' | 'pink' | 'teal' | 'green' | 'orange' | 'red' | 'yellow' | 'gray' | 'none';
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Retrieves the Agent's configuration data, as has been configured in the HERE Admin Console.
|
|
819
|
+
*
|
|
820
|
+
* @returns A promise that resolves with an object containing properties that match the Agent’s configuration.
|
|
821
|
+
*
|
|
822
|
+
* @example Retrieving the Agent’s configuration data:
|
|
823
|
+
* ```ts
|
|
824
|
+
* import { Agent } from "@openfin/cloud-api";
|
|
825
|
+
*
|
|
826
|
+
* // Get the configuration data
|
|
827
|
+
* const configData = await Agent.getConfiguration<{ customField1: string, customField2: string }>();
|
|
828
|
+
*
|
|
829
|
+
* // Pick out the standard configuration properties
|
|
830
|
+
* const { customData, description, id, title, url } = configData;
|
|
831
|
+
*
|
|
832
|
+
* // Pick out the custom configuration properties
|
|
833
|
+
* if (customData) {
|
|
834
|
+
* const { customField1, customField2 } = customData;
|
|
835
|
+
* }
|
|
836
|
+
* ```
|
|
837
|
+
*/
|
|
838
|
+
declare const getConfiguration: <T extends Record<string, unknown>>() => Promise<T>;
|
|
839
|
+
/**
|
|
840
|
+
* Registers an Agent.
|
|
841
|
+
*
|
|
842
|
+
* @param config The configuration for the Agent.
|
|
843
|
+
*
|
|
844
|
+
* @returns A promise that resolves with the Agent.
|
|
845
|
+
*
|
|
846
|
+
* @example Registering an Agent that will provide search results:
|
|
847
|
+
* ```ts
|
|
848
|
+
* import { Agent } from "@openfin/cloud-api";
|
|
849
|
+
*
|
|
850
|
+
* // Handle incoming action and return a response that includes the URL to navigate to
|
|
851
|
+
* const onAction: Agent.OnSearchActionListener = (action, result) => {
|
|
852
|
+
* const { name } = action;
|
|
853
|
+
* const { data, key } = result;
|
|
854
|
+
* const { owner, searchResultHostUrl } = data as { owner: { id: string, name: string }, searchResultHostUrl: string };
|
|
855
|
+
* const { id: ownerId } = owner;
|
|
856
|
+
*
|
|
857
|
+
* console.log(`Action "${name}" triggered on search result with key "${key}"`);
|
|
858
|
+
*
|
|
859
|
+
* switch (name) {
|
|
860
|
+
* case "view-owner":
|
|
861
|
+
* return { url: `${searchResultHostUrl}/people/${ownerId}` };
|
|
862
|
+
* case "view-result":
|
|
863
|
+
* return { url: `${searchResultHostUrl}/record/${key}` };
|
|
864
|
+
* default:
|
|
865
|
+
* console.warn(`Unknown action: ${name}`);
|
|
866
|
+
* }
|
|
867
|
+
* };
|
|
868
|
+
*
|
|
869
|
+
* // Handle incoming search request and return relevant search results
|
|
870
|
+
* const onSearch: Agent.OnSearchRequestListener = ({ context, query, signal }) => {
|
|
871
|
+
* const { pageNumber, pageSize } = context;
|
|
872
|
+
* try {
|
|
873
|
+
* let results: Agent.SearchResult[] = [];
|
|
874
|
+
* const url = `https://my-web-app.com/search?q=${query}&page=${pageNumber}&limit=${pageSize}`;
|
|
875
|
+
* const response = await fetch(url, { signal });
|
|
876
|
+
* if (!response.ok) {
|
|
877
|
+
* throw new Error(`Request failed: ${response.status}`);
|
|
878
|
+
* }
|
|
879
|
+
* const { searchResults } = await response.json();
|
|
880
|
+
* results = searchResults.map((result) => {
|
|
881
|
+
* const { iconUrl, id: key, owner, subTitle, title } = result;
|
|
882
|
+
* const { name: ownerName } = owner as { id: string, name: string };
|
|
883
|
+
* return {
|
|
884
|
+
* actions: [
|
|
885
|
+
* {
|
|
886
|
+
* name: "view-result",
|
|
887
|
+
* description: `Go to ${title} in My Web App`,
|
|
888
|
+
* },
|
|
889
|
+
* {
|
|
890
|
+
* name: "view-owner",
|
|
891
|
+
* description: `Go to ${ownerName} in My Web App`,
|
|
892
|
+
* title: "View Owner",
|
|
893
|
+
* icon: {
|
|
894
|
+
* dark: "data:image/svg+xml,...",
|
|
895
|
+
* light: "data:image/svg+xml,...",
|
|
896
|
+
* },
|
|
897
|
+
* },
|
|
898
|
+
* ],
|
|
899
|
+
* data: {
|
|
900
|
+
* owner,
|
|
901
|
+
* searchResultHostUrl: `https://my-web-app.com`,
|
|
902
|
+
* },
|
|
903
|
+
* icon: iconUrl,
|
|
904
|
+
* key,
|
|
905
|
+
* label: subTitle,
|
|
906
|
+
* title,
|
|
907
|
+
* };
|
|
908
|
+
* });
|
|
909
|
+
* console.log("Returning results", results);
|
|
910
|
+
* return { results };
|
|
911
|
+
* } catch (err) {
|
|
912
|
+
* if ((err as Error).name === "AbortError") {
|
|
913
|
+
* // Ignore errors for cancelled requests
|
|
914
|
+
* return { results: [] };
|
|
915
|
+
* }
|
|
916
|
+
* throw err;
|
|
917
|
+
* }
|
|
918
|
+
* };
|
|
919
|
+
*
|
|
920
|
+
* // Register the agent
|
|
921
|
+
* const agent = await Agent.register({ search: { onAction, onSearch } });
|
|
922
|
+
*
|
|
923
|
+
* // Set the Agent as ready to receive requests
|
|
924
|
+
* await agent.isReady();
|
|
925
|
+
* ```
|
|
586
926
|
*/
|
|
587
|
-
declare function register(config:
|
|
927
|
+
declare function register(config: AgentRegistrationConfig): Promise<Agent>;
|
|
588
928
|
|
|
589
|
-
type
|
|
590
|
-
type
|
|
591
|
-
type
|
|
592
|
-
type
|
|
593
|
-
type
|
|
594
|
-
type
|
|
929
|
+
type index_Agent = Agent;
|
|
930
|
+
type index_AgentFeatures = AgentFeatures;
|
|
931
|
+
type index_AgentRegistrationConfig = AgentRegistrationConfig;
|
|
932
|
+
type index_AgentSearchFilter = AgentSearchFilter;
|
|
933
|
+
type index_InteropColorChannel = InteropColorChannel;
|
|
934
|
+
type index_OnSearchActionListener = OnSearchActionListener;
|
|
935
|
+
type index_OnSearchRequestListener = OnSearchRequestListener;
|
|
595
936
|
type index_SearchListenerRequest = SearchListenerRequest;
|
|
596
|
-
type index_SearchRequestContext = SearchRequestContext;
|
|
597
|
-
type index_SearchResponse = SearchResponse;
|
|
598
937
|
type index_SearchResult = SearchResult;
|
|
599
|
-
|
|
600
|
-
declare const index_getAgentConfiguration: typeof getAgentConfiguration;
|
|
938
|
+
declare const index_getConfiguration: typeof getConfiguration;
|
|
601
939
|
declare const index_register: typeof register;
|
|
602
940
|
declare namespace index {
|
|
603
|
-
export { type
|
|
941
|
+
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, type index_SearchResult as SearchResult, index_getConfiguration as getConfiguration, index_register as register };
|
|
604
942
|
}
|
|
605
943
|
|
|
606
944
|
declare global {
|
|
@@ -609,4 +947,4 @@ declare global {
|
|
|
609
947
|
}
|
|
610
948
|
}
|
|
611
949
|
|
|
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 };
|
|
950
|
+
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 };
|