@adobe/exc-app 0.2.43-beta2 → 0.2.44

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 (65) hide show
  1. package/appapi.d.ts +1 -0
  2. package/appapi.js +1 -0
  3. package/appapi.js.map +1 -1
  4. package/appapi.ts +1 -0
  5. package/build/preBuild.js +1 -0
  6. package/capabilityapi.d.ts +6 -0
  7. package/capabilityapi.js +6 -0
  8. package/capabilityapi.js.map +1 -1
  9. package/capabilityapi.ts +6 -0
  10. package/docs/README.md +1 -1
  11. package/docs/enums/capabilityapi.capabilityids.md +14 -0
  12. package/docs/enums/capabilityapi.capabilitynames.md +14 -0
  13. package/docs/interfaces/appapi.appapi-1.md +2 -2
  14. package/docs/interfaces/capabilityapi.capabilityapi-1.md +2 -2
  15. package/docs/interfaces/helpcenter.helpcenterconfig.md +4 -4
  16. package/docs/interfaces/metrics.analytics.md +6 -6
  17. package/docs/interfaces/metrics.metrics-1.md +2 -2
  18. package/docs/interfaces/metrics.metricsapi.md +2 -2
  19. package/docs/interfaces/network.apolloclientoptions.md +35 -0
  20. package/docs/interfaces/network.defaultmetadata.md +1 -1
  21. package/docs/interfaces/network.graphqlquery.md +1 -1
  22. package/docs/interfaces/network.networkapi.md +37 -4
  23. package/docs/interfaces/network.queryrequest.md +1 -1
  24. package/docs/interfaces/page.callback.md +21 -0
  25. package/docs/interfaces/page.pageapi.md +82 -5
  26. package/docs/interfaces/permissions.permissionsapi.md +2 -2
  27. package/docs/interfaces/permissions.permissionsresponse.md +1 -1
  28. package/docs/interfaces/pulse.pulseapi.md +38 -2
  29. package/docs/interfaces/pulse.pulsebuttonconfig.md +32 -0
  30. package/docs/interfaces/pulse.pulsenotification.md +2 -2
  31. package/docs/interfaces/root.modules.md +161 -0
  32. package/docs/interfaces/root.runtime.md +102 -0
  33. package/docs/interfaces/root.runtimeconfiguration.md +392 -0
  34. package/docs/interfaces/session.sessionapi.md +6 -6
  35. package/docs/interfaces/settings.parameters.md +1 -1
  36. package/docs/interfaces/settings.settingsapi.md +6 -6
  37. package/docs/interfaces/settings.settingsresponse.md +1 -1
  38. package/docs/interfaces/shell.shellapi.md +6 -6
  39. package/docs/interfaces/shell.shellinfo.md +1 -1
  40. package/docs/interfaces/user.imsinfo.md +1 -1
  41. package/docs/interfaces/user.userapi.md +6 -6
  42. package/docs/interfaces/user.userinfo.md +2 -2
  43. package/docs/modules/metrics.md +39 -8
  44. package/docs/modules/network.md +38 -4
  45. package/docs/modules/page.md +1 -0
  46. package/docs/modules/pulse.md +1 -0
  47. package/docs/modules/root.md +88 -0
  48. package/internal.d.ts +27 -0
  49. package/internal.js +12 -0
  50. package/internal.js.map +1 -1
  51. package/internal.ts +39 -0
  52. package/package.json +4 -4
  53. package/page.d.ts +3 -1
  54. package/page.js.map +1 -1
  55. package/page.ts +3 -1
  56. package/pulse.d.ts +22 -0
  57. package/pulse.js +6 -0
  58. package/pulse.js.map +1 -1
  59. package/pulse.ts +32 -0
  60. package/tests/pulse.test.js +3 -1
  61. package/tests/pulse.test.js.map +1 -1
  62. package/tests/pulse.test.ts +3 -1
  63. package/coverage/lcov-report/block-navigation.js +0 -79
  64. package/coverage/lcov-report/prettify.js +0 -2
  65. package/coverage/lcov-report/sorter.js +0 -170
@@ -53,6 +53,7 @@ const queryResponse = await query({
53
53
 
54
54
  ### Interfaces
55
55
 
56
+ * [ApolloClientOptions](../interfaces/network.apolloclientoptions.md)
56
57
  * [DefaultMetaData](../interfaces/network.defaultmetadata.md)
57
58
  * [FetchOptions](../interfaces/network.fetchoptions.md)
58
59
  * [GraphQLQuery](../interfaces/network.graphqlquery.md)
@@ -70,6 +71,7 @@ const queryResponse = await query({
70
71
  ### Functions
71
72
 
72
73
  * [fetch](network.md#fetch)
74
+ * [getApolloClient](network.md#getapolloclient)
73
75
  * [query](network.md#query)
74
76
 
75
77
  ## Type aliases
@@ -99,7 +101,7 @@ Default status codes which imply a transient error and can be retried.
99
101
 
100
102
  ### fetch
101
103
 
102
- ▸ **fetch**(`input`: RequestInfo, `init?`: [FetchInit](network.md#fetchinit)): Promise\<Response>
104
+ ▸ **fetch**(`input`: RequestInfo, `init?`: [FetchInit](network.md#fetchinit)): Promise<Response\>
103
105
 
104
106
  Provides an interface for fetching resources powered by the global 'fetch' API.
105
107
 
@@ -128,15 +130,47 @@ Name | Type | Description |
128
130
  `input` | RequestInfo | The resource that you wish to fetch. It can either be the URL of the resource you want to fetch or a Request object. |
129
131
  `init?` | [FetchInit](network.md#fetchinit) | An object containing any custom settings that you want to apply to the request. |
130
132
 
131
- **Returns:** Promise\<Response>
133
+ **Returns:** Promise<Response\>
132
134
 
133
135
  The promise for the response to the fetch operation.
134
136
 
135
137
  ___
136
138
 
139
+ ### getApolloClient
140
+
141
+ ▸ **getApolloClient**(`options?`: [ApolloClientOptions](../interfaces/network.apolloclientoptions.md)): Promise<{ apolloClient: ApolloClient<InMemoryCache\> ; gql: *typeof* gql }\>
142
+
143
+ Provides an interface for querying resources via GraphqQL using ApolloClient
144
+ ***Example***
145
+ ```typescript
146
+ const apolloClientModule = await getApolloClient();
147
+ const apolloClient = apolloClientModule.apolloClient;
148
+ const gql = apolloClientModule.gql;
149
+ const result = await apolloClient.query({
150
+ query: gql`query user {
151
+ id
152
+ name
153
+ }`,
154
+ variables : {}
155
+ });
156
+ console.log(result.data);
157
+ ```
158
+
159
+ #### Parameters:
160
+
161
+ Name | Type | Description |
162
+ ------ | ------ | ------ |
163
+ `options?` | [ApolloClientOptions](../interfaces/network.apolloclientoptions.md) | Configuration to create ApolloClient instance |
164
+
165
+ **Returns:** Promise<{ apolloClient: ApolloClient<InMemoryCache\> ; gql: *typeof* gql }\>
166
+
167
+ GraphQL query response
168
+
169
+ ___
170
+
137
171
  ### query
138
172
 
139
- ▸ **query**(`input`: [QueryRequest](../interfaces/network.queryrequest.md)): Promise\<Response>
173
+ ▸ **query**(`input`: [QueryRequest](../interfaces/network.queryrequest.md)): Promise<Response\>
140
174
 
141
175
  Provides an interface for querying resources via GraphqQL.
142
176
  In order to consume query, please make sure the respective query resolver is
@@ -173,6 +207,6 @@ Name | Type | Description |
173
207
  ------ | ------ | ------ |
174
208
  `input` | [QueryRequest](../interfaces/network.queryrequest.md) | Query request containing desired GQL Query. |
175
209
 
176
- **Returns:** Promise\<Response>
210
+ **Returns:** Promise<Response\>
177
211
 
178
212
  The promise for the response to the query operation.
@@ -44,6 +44,7 @@ page.shellRedirect('/target');
44
44
  ### Interfaces
45
45
 
46
46
  * [BlockNavigationOptions](../interfaces/page.blocknavigationoptions.md)
47
+ * [Callback](../interfaces/page.callback.md)
47
48
  * [ObjectWithHref](../interfaces/page.objectwithhref.md)
48
49
  * [ObjectWithPath](../interfaces/page.objectwithpath.md)
49
50
  * [PageApi](../interfaces/page.pageapi.md)
@@ -38,5 +38,6 @@ API for sending pulse notifications.
38
38
  ### Interfaces
39
39
 
40
40
  * [PulseApi](../interfaces/pulse.pulseapi.md)
41
+ * [PulseButtonConfig](../interfaces/pulse.pulsebuttonconfig.md)
41
42
  * [PulseNotification](../interfaces/pulse.pulsenotification.md)
42
43
  * [PulseResponse](../interfaces/pulse.pulseresponse.md)
@@ -0,0 +1,88 @@
1
+ **[@adobe/exc-app](../README.md)**
2
+
3
+ > [Globals](../README.md) / root
4
+
5
+ # Module: root
6
+
7
+ API used to integrate as solution web application with the unified shell of the Adobe Experience
8
+ Cloud.
9
+
10
+ ## Index
11
+
12
+ ### References
13
+
14
+ * [RuntimeConfiguration](root.md#runtimeconfiguration)
15
+
16
+ ### Interfaces
17
+
18
+ * [Modules](../interfaces/root.modules.md)
19
+ * [Runtime](../interfaces/root.runtime.md)
20
+ * [RuntimeConfiguration](../interfaces/root.runtimeconfiguration.md)
21
+
22
+ ### Functions
23
+
24
+ * [init](root.md#init)
25
+ * [runtime](root.md#runtime)
26
+
27
+ ## References
28
+
29
+ ### RuntimeConfiguration
30
+
31
+ Re-exports: [RuntimeConfiguration](../interfaces/root.runtimeconfiguration.md)
32
+
33
+ ## Functions
34
+
35
+ ### init
36
+
37
+ ▸ **init**(`bootstrap`: (runtime: [Runtime](../interfaces/root.runtime.md)) => void): void
38
+
39
+ Initializes a solution web application by invoking the bootstrap callback
40
+ once the runtime is ready.
41
+ 1. if the module is already defined, start to bootstrap
42
+ 2. otherwise define the global callback that will be called when runtime is ready.
43
+
44
+ ***Example:***
45
+
46
+ ```typescript
47
+ import React from 'react';
48
+ import ReactDOM from 'react-dom';
49
+ import runtime, {init} from '@adobe/exc-app';
50
+
51
+ init(() => {
52
+ ReactDOM.render(<MainComponent runtime={runtime()} />, document.querySelector('#main'));
53
+ });
54
+ ```
55
+
56
+ #### Parameters:
57
+
58
+ Name | Type | Description |
59
+ ------ | ------ | ------ |
60
+ `bootstrap` | (runtime: [Runtime](../interfaces/root.runtime.md)) => void | Callback used to bootstrap a solution. The runtime object is passed in as a parameter to this callback. |
61
+
62
+ **Returns:** void
63
+
64
+ ___
65
+
66
+ ### runtime
67
+
68
+ ▸ **runtime**(): [Runtime](../interfaces/root.runtime.md)
69
+
70
+ Get the runtime object which contains all unified-shell APIs.
71
+
72
+ ***Example:***
73
+
74
+ ```typescript
75
+ import React from 'react';
76
+ import ReactDOM from 'react-dom';
77
+ import excApp from '@adobe/exc-app';
78
+
79
+ export class MyComponent extends React.Component {
80
+ constructor(props) {
81
+ this.runtime = excApp();
82
+ }
83
+ }
84
+ ```
85
+
86
+ **Returns:** [Runtime](../interfaces/root.runtime.md)
87
+
88
+ The runtime object.
package/internal.d.ts CHANGED
@@ -13,19 +13,42 @@
13
13
  * @ignore
14
14
  */
15
15
  import { Application } from './metrics/Application';
16
+ import EventEmitter from './src/EventEmitter';
16
17
  import { Modules } from './src/Global';
17
18
  import MetricsConfiguration from './metrics/Configuration';
18
19
  import { Configuration as NetworkConfiguration } from './network';
19
20
  import User from './metrics/User';
20
21
  export type { Modules };
22
+ export interface Poller {
23
+ activeFrequency: number;
24
+ hiddenFrequency?: number;
25
+ name: string;
26
+ inactiveFrequency: number;
27
+ immediate: boolean;
28
+ pollFn: () => Promise<void>;
29
+ }
30
+ export interface PollerHandle {
31
+ handle: string;
32
+ }
33
+ export interface UserActivityEmitter extends EventEmitter {
34
+ activityEvents: string[];
35
+ }
36
+ export interface PollingConfiguration {
37
+ inactivityTimeoutSec?: number;
38
+ pollWhileInactive?: boolean;
39
+ }
21
40
  /**
22
41
  * @ignore
23
42
  */
24
43
  export interface InternalApi {
44
+ addPoller(poller: Poller): Promise<PollerHandle>;
25
45
  clearUser(version?: string): void;
26
46
  configureMetrics(config?: MetricsConfiguration): Promise<MetricsConfiguration>;
27
47
  configureNetwork(config: NetworkConfiguration): void;
48
+ configurePolling(config: PollingConfiguration): Promise<void>;
28
49
  flush(): Promise<number>;
50
+ registerActivityEmitter(emitter: UserActivityEmitter): Promise<void>;
51
+ removePoller(handle: PollerHandle): Promise<void>;
29
52
  setApplication(app: Application): void;
30
53
  setFilter(filterFunction: <T>(record: T) => Promise<T>): void;
31
54
  setUser(user: User, version?: string): void;
@@ -34,9 +57,13 @@ export interface InternalApi {
34
57
  * @ignore
35
58
  */
36
59
  export declare class Internal {
60
+ static addPoller(poller: Poller): Promise<PollerHandle>;
37
61
  static configureMetrics(config?: MetricsConfiguration): Promise<MetricsConfiguration>;
38
62
  static configureNetwork(config: NetworkConfiguration): void;
63
+ static configurePolling(config: PollingConfiguration): Promise<void>;
39
64
  static flush(): Promise<number>;
65
+ static registerActivityEmitter(emitter: UserActivityEmitter): Promise<void>;
66
+ static removePoller(handle: PollerHandle): Promise<void>;
40
67
  static setApplication(app: Application): void;
41
68
  static setFilter(filterFunction: <T>(record: T) => Promise<T>): void;
42
69
  static setUser(user: User, version?: string): void;
package/internal.js CHANGED
@@ -16,15 +16,27 @@ const Global_1 = require("./src/Global");
16
16
  * @ignore
17
17
  */
18
18
  class Internal {
19
+ static addPoller(poller) {
20
+ return Global_1.getImpl('internal').addPoller(poller);
21
+ }
19
22
  static configureMetrics(config) {
20
23
  return Global_1.getImpl('internal').configureMetrics(config);
21
24
  }
22
25
  static configureNetwork(config) {
23
26
  return Global_1.getImpl('internal').configureNetwork(config);
24
27
  }
28
+ static configurePolling(config) {
29
+ return Global_1.getImpl('internal').configurePolling(config);
30
+ }
25
31
  static flush() {
26
32
  return Global_1.getImpl('internal').flush();
27
33
  }
34
+ static registerActivityEmitter(emitter) {
35
+ return Global_1.getImpl('internal').registerActivityEmitter(emitter);
36
+ }
37
+ static removePoller(handle) {
38
+ return Global_1.getImpl('internal').removePoller(handle);
39
+ }
28
40
  static setApplication(app) {
29
41
  return Global_1.getImpl('internal').setApplication(app);
30
42
  }
package/internal.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["internal.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;AAO5E,yCAA8C;AAoB9C;;GAEG;AACH,MAAa,QAAQ;IACZ,MAAM,CAAC,gBAAgB,CAAC,MAA6B;QAC1D,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IACM,MAAM,CAAC,gBAAgB,CAAC,MAA4B;QACzD,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IACM,MAAM,CAAC,KAAK;QACjB,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;IACM,MAAM,CAAC,cAAc,CAAC,GAAgB;QAC3C,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;IACM,MAAM,CAAC,SAAS,CAAC,cAA4C;QAClE,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC;IACM,MAAM,CAAC,OAAO,CAAC,IAAU,EAAE,OAAgB;QAChD,OAAO,gBAAO,CAAC,UAAU,CAAC,C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,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;IACM,MAAM,CAAC,SAAS,CAAC,cAA4C;QAClE,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC;IACM,MAAM,CAAC,OAAO,CAAC,IAAU,EAAE,OAAgB;QAChD,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IACM,MAAM,CAAC,SAAS,CAAC,OAAgB;QACtC,OAAO,gBAAO,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACF;AAlCD,4BAkCC"}
package/internal.ts CHANGED
@@ -14,6 +14,7 @@
14
14
  * @ignore
15
15
  */
16
16
  import {Application} from './metrics/Application';
17
+ import EventEmitter from './src/EventEmitter';
17
18
  import {getImpl, Modules} from './src/Global';
18
19
  import MetricsConfiguration from './metrics/Configuration';
19
20
  import {Configuration as NetworkConfiguration} from './network';
@@ -21,14 +22,40 @@ import User from './metrics/User';
21
22
 
22
23
  export type {Modules};
23
24
 
25
+ export interface Poller {
26
+ activeFrequency: number;
27
+ hiddenFrequency?: number;
28
+ name: string;
29
+ inactiveFrequency: number;
30
+ immediate: boolean;
31
+ pollFn: () => Promise<void>;
32
+ }
33
+
34
+ export interface PollerHandle {
35
+ handle: string;
36
+ }
37
+
38
+ export interface UserActivityEmitter extends EventEmitter {
39
+ activityEvents: string[];
40
+ }
41
+
42
+ export interface PollingConfiguration {
43
+ inactivityTimeoutSec?: number;
44
+ pollWhileInactive?: boolean;
45
+ }
46
+
24
47
  /**
25
48
  * @ignore
26
49
  */
27
50
  export interface InternalApi {
51
+ addPoller(poller: Poller): Promise<PollerHandle>
28
52
  clearUser(version?: string): void
29
53
  configureMetrics(config?: MetricsConfiguration): Promise<MetricsConfiguration>;
30
54
  configureNetwork(config: NetworkConfiguration): void;
55
+ configurePolling(config: PollingConfiguration): Promise<void>;
31
56
  flush(): Promise<number>;
57
+ registerActivityEmitter(emitter: UserActivityEmitter): Promise<void>;
58
+ removePoller(handle: PollerHandle): Promise<void>;
32
59
  setApplication(app: Application): void;
33
60
  setFilter(filterFunction: <T>(record: T) => Promise<T>): void;
34
61
  setUser(user: User, version?: string): void;
@@ -38,15 +65,27 @@ export interface InternalApi {
38
65
  * @ignore
39
66
  */
40
67
  export class Internal {
68
+ public static addPoller(poller: Poller): Promise<PollerHandle> {
69
+ return getImpl('internal').addPoller(poller);
70
+ }
41
71
  public static configureMetrics(config?: MetricsConfiguration): Promise<MetricsConfiguration> {
42
72
  return getImpl('internal').configureMetrics(config);
43
73
  }
44
74
  public static configureNetwork(config: NetworkConfiguration): void {
45
75
  return getImpl('internal').configureNetwork(config);
46
76
  }
77
+ public static configurePolling(config: PollingConfiguration): Promise<void> {
78
+ return getImpl('internal').configurePolling(config);
79
+ }
47
80
  public static flush(): Promise<number> {
48
81
  return getImpl('internal').flush();
49
82
  }
83
+ public static registerActivityEmitter(emitter: UserActivityEmitter): Promise<void> {
84
+ return getImpl('internal').registerActivityEmitter(emitter);
85
+ }
86
+ public static removePoller(handle: PollerHandle): Promise<void> {
87
+ return getImpl('internal').removePoller(handle);
88
+ }
50
89
  public static setApplication(app: Application): void {
51
90
  return getImpl('internal').setApplication(app);
52
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/exc-app",
3
- "version": "0.2.43-beta2",
3
+ "version": "0.2.44",
4
4
  "main": "index.js",
5
5
  "source": "index.ts",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "registry": "https://registry.npmjs.com/"
27
27
  },
28
28
  "dependencies": {
29
- "@apollo/client": "3.4.11",
29
+ "@apollo/client": "3.4.16",
30
30
  "graphql": "^15.0.0",
31
31
  "graphql-tag": "2.12.5"
32
32
  },
@@ -41,11 +41,11 @@
41
41
  "glob": "7.1.7",
42
42
  "jest": "26.6.3",
43
43
  "jest-dev-server": "4.4.0",
44
- "jest-localstorage-mock": "2.4.17",
44
+ "jest-localstorage-mock": "2.4.18",
45
45
  "jest-when": "3.3.1",
46
46
  "ts-jest": "26.5.6",
47
47
  "typedoc": "0.19.2",
48
48
  "typedoc-plugin-external-module-name": "4.0.6",
49
- "typedoc-plugin-markdown": "3.10.4"
49
+ "typedoc-plugin-markdown": "3.1.1"
50
50
  }
51
51
  }
package/page.d.ts CHANGED
@@ -374,7 +374,9 @@ export interface PageApi extends PageApiProperties {
374
374
  /**
375
375
  * Set the list of selectors presently being used by modalAutoDetect. If set to an empty
376
376
  * array, the default selectors used by runtime will be used instead. To stop observing changes
377
- * unset modalAutoDetect.
377
+ * unset modalAutoDetect. Setting additonal selectors replaces the currently set selectors, use
378
+ * page.getModalQuerySelectors and append new selectors to the returned list before resetting
379
+ * to modify the existing list of selectors.
378
380
  *
379
381
  * ***Example:***
380
382
  *
package/page.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","sourceRoot":"","sources":["page.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,yCAAqC;AAoarC,MAAM,IAAI,GAAG,gBAAO,CAAC,MAAM,EAAE;IAC3B,CAAC,mBAAmB,CAAC;IACrB,CAAC,cAAc,CAAC;IAChB,CAAC,oBAAoB,CAAC;IACtB,CAAC,iBAAiB,EAAE,IAAI,CAAC;IACzB,CAAC,gBAAgB,EAAE,IAAI,CAAC;IACxB,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,kBAAkB,EAAE,IAAI,CAAC;IAC1B,CAAC,wBAAwB,CAAC;IAC1B,CAAC,SAAS,CAAC;IACX,CAAC,cAAc,EAAE,IAAI,CAAC;IACtB,CAAC,OAAO,CAAC;IACT,CAAC,iBAAiB,CAAC;IACnB,CAAC,UAAU,EAAE,IAAI,CAAC;IAClB,CAAC,cAAc,EAAE,IAAI,CAAC;IACtB,CAAC,sBAAsB,CAAC;IACxB,CAAC,OAAO,EAAE,IAAI,CAAC;IACf,CAAC,eAAe,EAAE,IAAI,CAAC;IACvB,CAAC,wBAAwB,CAAC;IAC1B,CAAC,SAAS,CAAC;IACX,CAAC,OAAO,CAAC;IACT,CAAC,qBAAqB,CAAC;CACxB,CAAC,CAAC;AAEH,kBAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"page.js","sourceRoot":"","sources":["page.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,yCAAqC;AAsarC,MAAM,IAAI,GAAG,gBAAO,CAAC,MAAM,EAAE;IAC3B,CAAC,mBAAmB,CAAC;IACrB,CAAC,cAAc,CAAC;IAChB,CAAC,oBAAoB,CAAC;IACtB,CAAC,iBAAiB,EAAE,IAAI,CAAC;IACzB,CAAC,gBAAgB,EAAE,IAAI,CAAC;IACxB,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,kBAAkB,EAAE,IAAI,CAAC;IAC1B,CAAC,wBAAwB,CAAC;IAC1B,CAAC,SAAS,CAAC;IACX,CAAC,cAAc,EAAE,IAAI,CAAC;IACtB,CAAC,OAAO,CAAC;IACT,CAAC,iBAAiB,CAAC;IACnB,CAAC,UAAU,EAAE,IAAI,CAAC;IAClB,CAAC,cAAc,EAAE,IAAI,CAAC;IACtB,CAAC,sBAAsB,CAAC;IACxB,CAAC,OAAO,EAAE,IAAI,CAAC;IACf,CAAC,eAAe,EAAE,IAAI,CAAC;IACvB,CAAC,wBAAwB,CAAC;IAC1B,CAAC,SAAS,CAAC;IACX,CAAC,OAAO,CAAC;IACT,CAAC,qBAAqB,CAAC;CACxB,CAAC,CAAC;AAEH,kBAAe,IAAI,CAAC"}
package/page.ts CHANGED
@@ -439,7 +439,9 @@ export interface PageApi extends PageApiProperties {
439
439
  /**
440
440
  * Set the list of selectors presently being used by modalAutoDetect. If set to an empty
441
441
  * array, the default selectors used by runtime will be used instead. To stop observing changes
442
- * unset modalAutoDetect.
442
+ * unset modalAutoDetect. Setting additonal selectors replaces the currently set selectors, use
443
+ * page.getModalQuerySelectors and append new selectors to the returned list before resetting
444
+ * to modify the existing list of selectors.
443
445
  *
444
446
  * ***Example:***
445
447
  *
package/pulse.d.ts CHANGED
@@ -144,11 +144,33 @@ export interface PulseResponse {
144
144
  }[];
145
145
  };
146
146
  }
147
+ export interface PulseButtonConfig {
148
+ /**
149
+ * Text of the button.
150
+ */
151
+ label: string;
152
+ /**
153
+ * Callback function to be automatically executed on click.
154
+ */
155
+ callback?: (value?: any) => void;
156
+ }
147
157
  export interface PulseApi {
148
158
  /**
149
159
  * Method to send a pulse notification.
150
160
  */
151
161
  send(notifications: PulseNotification[]): Promise<PulseResponse>;
162
+ /**
163
+ * Adds an additional custom button to the bottom of the Pulse container.
164
+ * Will fire the attached callback when a user presses the button.
165
+ * @param buttonConfig The button configuration
166
+ */
167
+ setButton(buttonConfig: PulseButtonConfig): void;
168
+ /**
169
+ * Adds additional values to the notification.
170
+ * If Pulse has 3 internally and this is set to 2, the UI will show 5.
171
+ * @param count Additional values to add to the pulse notification.
172
+ */
173
+ setCount(count: number): void;
152
174
  }
153
175
  declare const pulse: PulseApi;
154
176
  export default pulse;
package/pulse.js CHANGED
@@ -101,6 +101,12 @@ var NotificationType;
101
101
  const pulse = {
102
102
  send: params => {
103
103
  return Global_1.getImpl('pulse')().send(params);
104
+ },
105
+ setButton: (buttonConfig) => {
106
+ return Global_1.getImpl('pulse')().setButton(buttonConfig);
107
+ },
108
+ setCount: (count) => {
109
+ return Global_1.getImpl('pulse')().setCount(count);
104
110
  }
105
111
  };
106
112
  exports.default = pulse;
package/pulse.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pulse.js","sourceRoot":"","sources":["pulse.ts"],"names":[],"mappings":";AAAA;;;;;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OAEG;IACH,iFAA6D,CAAA;IAC7D;;OAEG;IACH,yEAAqD,CAAA;IACrD;;OAEG;IACH,mEAA+C,CAAA;IAC/C;;OAEG;IACH,oEAAgD,CAAA;IAChD;;OAEG;IACH,qCAAiB,CAAA;AACnB,CAAC,EAjDW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAiD3B;AAwFD,MAAM,KAAK,GAAa;IACtB,IAAI,EAAE,MAAM,CAAC,EAAE;QACb,OAAO,gBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IACD,SAAS,EAAE,CAAC,YAA+B,EAAE,EAAE;QAC7C,OAAO,gBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC;IACD,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;QAC1B,OAAO,gBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF,CAAC;AAEF,kBAAe,KAAK,CAAC"}
package/pulse.ts CHANGED
@@ -150,16 +150,48 @@ export interface PulseResponse {
150
150
  };
151
151
  }
152
152
 
153
+ export interface PulseButtonConfig {
154
+ /**
155
+ * Text of the button.
156
+ */
157
+ label: string;
158
+
159
+ /**
160
+ * Callback function to be automatically executed on click.
161
+ */
162
+ callback?: (value?: any) => void;
163
+ }
164
+
153
165
  export interface PulseApi {
154
166
  /**
155
167
  * Method to send a pulse notification.
156
168
  */
157
169
  send(notifications: PulseNotification[]): Promise<PulseResponse>;
170
+
171
+ /**
172
+ * Adds an additional custom button to the bottom of the Pulse container.
173
+ * Will fire the attached callback when a user presses the button.
174
+ * @param buttonConfig The button configuration
175
+ */
176
+ setButton(buttonConfig: PulseButtonConfig): void;
177
+
178
+ /**
179
+ * Adds additional values to the notification.
180
+ * If Pulse has 3 internally and this is set to 2, the UI will show 5.
181
+ * @param count Additional values to add to the pulse notification.
182
+ */
183
+ setCount(count: number): void;
158
184
  }
159
185
 
160
186
  const pulse: PulseApi = {
161
187
  send: params => {
162
188
  return getImpl('pulse')().send(params);
189
+ },
190
+ setButton: (buttonConfig: PulseButtonConfig) => {
191
+ return getImpl('pulse')().setButton(buttonConfig);
192
+ },
193
+ setCount: (count: number) => {
194
+ return getImpl('pulse')().setCount(count);
163
195
  }
164
196
  };
165
197
 
@@ -19,7 +19,9 @@ describe('pulse.ts', () => {
19
19
  it('correctly sets up the connection with module-runtime', () => {
20
20
  // setup
21
21
  const pulseMock = {
22
- send: () => Promise.resolve({ notifications: { notification: [] } })
22
+ send: () => Promise.resolve({ notifications: { notification: [] } }),
23
+ setButton: () => { },
24
+ setCount: () => { }
23
25
  };
24
26
  Global_1.default['exc-module-runtime'] = {
25
27
  pulse: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"pulse.test.js","sourceRoot":"","sources":["pulse.test.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,2DAA8C;AAC9C,qDAA2E;AAE3E,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,QAAQ;QACR,MAAM,SAAS,GAAG;YAChB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAgB,EAAC,aAAa,EAAE,EAAC,YAAY,EAAE,EAAE,EAAC,EAAC,CAAC;SACpE,CAAC;QACb,gBAAM,CAAC,oBAAoB,CAAa,GAAG;YAC1C,KAAK,EAAE,GAAG,EAAE;gBACV,OAAO,SAAS,CAAC;YACnB,CAAC;SACS,CAAC;QACb,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,CAAC,EAAuB,CAAC,CAAC;QAE3C,SAAS;QACT,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAErB,SAAS;QACT,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"pulse.test.js","sourceRoot":"","sources":["pulse.test.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,2DAA8C;AAC9C,qDAA2E;AAE3E,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,QAAQ;QACR,MAAM,SAAS,GAAG;YAChB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAgB,EAAC,aAAa,EAAE,EAAC,YAAY,EAAE,EAAE,EAAC,EAAC,CAAC;YAC/E,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;YACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;SACP,CAAC;QACb,gBAAM,CAAC,oBAAoB,CAAa,GAAG;YAC1C,KAAK,EAAE,GAAG,EAAE;gBACV,OAAO,SAAS,CAAC;YACnB,CAAC;SACS,CAAC;QACb,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,CAAC,EAAuB,CAAC,CAAC;QAE3C,SAAS;QACT,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAErB,SAAS;QACT,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -15,7 +15,9 @@ describe('pulse.ts', () => {
15
15
  it('correctly sets up the connection with module-runtime', () => {
16
16
  // setup
17
17
  const pulseMock = {
18
- send: () => Promise.resolve<PulseResponse>({notifications: {notification: []}})
18
+ send: () => Promise.resolve<PulseResponse>({notifications: {notification: []}}),
19
+ setButton: () => {},
20
+ setCount: () => {}
19
21
  } as PulseApi;
20
22
  (Global['exc-module-runtime'] as Modules) = {
21
23
  pulse: () => {
@@ -1,79 +0,0 @@
1
- /* eslint-disable */
2
- var jumpToCode = (function init() {
3
- // Classes of code we would like to highlight in the file view
4
- var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
5
-
6
- // Elements to highlight in the file listing view
7
- var fileListingElements = ['td.pct.low'];
8
-
9
- // We don't want to select elements that are direct descendants of another match
10
- var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
11
-
12
- // Selecter that finds elements on the page to which we can jump
13
- var selector =
14
- fileListingElements.join(', ') +
15
- ', ' +
16
- notSelector +
17
- missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
18
-
19
- // The NodeList of matching elements
20
- var missingCoverageElements = document.querySelectorAll(selector);
21
-
22
- var currentIndex;
23
-
24
- function toggleClass(index) {
25
- missingCoverageElements
26
- .item(currentIndex)
27
- .classList.remove('highlighted');
28
- missingCoverageElements.item(index).classList.add('highlighted');
29
- }
30
-
31
- function makeCurrent(index) {
32
- toggleClass(index);
33
- currentIndex = index;
34
- missingCoverageElements.item(index).scrollIntoView({
35
- behavior: 'smooth',
36
- block: 'center',
37
- inline: 'center'
38
- });
39
- }
40
-
41
- function goToPrevious() {
42
- var nextIndex = 0;
43
- if (typeof currentIndex !== 'number' || currentIndex === 0) {
44
- nextIndex = missingCoverageElements.length - 1;
45
- } else if (missingCoverageElements.length > 1) {
46
- nextIndex = currentIndex - 1;
47
- }
48
-
49
- makeCurrent(nextIndex);
50
- }
51
-
52
- function goToNext() {
53
- var nextIndex = 0;
54
-
55
- if (
56
- typeof currentIndex === 'number' &&
57
- currentIndex < missingCoverageElements.length - 1
58
- ) {
59
- nextIndex = currentIndex + 1;
60
- }
61
-
62
- makeCurrent(nextIndex);
63
- }
64
-
65
- return function jump(event) {
66
- switch (event.which) {
67
- case 78: // n
68
- case 74: // j
69
- goToNext();
70
- break;
71
- case 66: // b
72
- case 75: // k
73
- case 80: // p
74
- goToPrevious();
75
- break;
76
- }
77
- };
78
- })();
79
- window.addEventListener('keydown', jumpToCode);