@adobe/exc-app 0.2.46 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RuntimeConfiguration.d.ts +4 -0
- package/appapi.d.ts +1 -1
- package/appapi.js +1 -1
- package/appapi.js.map +1 -1
- package/build/preBuild.js +14 -0
- package/capabilityapi.d.ts +4 -2
- package/capabilityapi.js +4 -2
- package/capabilityapi.js.map +1 -1
- package/docs/README.md +1 -0
- package/docs/enums/appapi.appids.md +21 -7
- package/docs/enums/capabilityapi.capabilityids.md +28 -0
- package/docs/enums/capabilityapi.capabilitynames.md +28 -0
- package/docs/enums/network.routing.md +21 -1
- package/docs/interfaces/ims.activeproductcontext.md +13 -0
- package/docs/interfaces/ims.imsprofile.md +130 -0
- package/docs/interfaces/ims.productcontext.md +141 -0
- package/docs/interfaces/ims.projectedproductcontext.md +21 -0
- package/docs/interfaces/network.queryrequest.md +20 -0
- package/docs/interfaces/root.poller.md +56 -0
- package/docs/interfaces/root.pollerhandle.md +21 -0
- package/docs/interfaces/root.pollingconfiguration.md +28 -0
- package/docs/interfaces/root.runtimeconfiguration.md +10 -1
- package/docs/interfaces/root.useractivityemitter.md +110 -0
- package/docs/interfaces/root.useractivitymonitor.md +151 -0
- package/docs/interfaces/user.userapi.md +1 -1
- package/docs/modules/ims.md +14 -0
- package/docs/modules/network.md +7 -0
- package/docs/modules/root.md +5 -0
- package/docs/modules/settings.md +8 -57
- package/docs/modules/user.md +14 -0
- package/index.js +7 -0
- package/index.js.map +1 -1
- package/internal.d.ts +9 -0
- package/internal.js +3 -0
- package/internal.js.map +1 -1
- package/network.d.ts +17 -1
- package/network.js +11 -0
- package/network.js.map +1 -1
- package/package.json +6 -7
- package/src/Global.d.ts +3 -1
- package/src/Global.js.map +1 -1
- package/tests/index.test.js +5 -0
- package/tests/index.test.js.map +1 -1
- package/tests/version.test.d.ts +1 -0
- package/tests/version.test.js +23 -0
- package/tests/version.test.js.map +1 -0
- package/{settings/SettingsLevel.ts → version.d.ts} +2 -20
- package/{metrics/Level.ts → version.js} +6 -20
- package/version.js.map +1 -0
- package/RuntimeConfiguration.ts +0 -272
- package/appapi.ts +0 -140
- package/capabilityapi.ts +0 -162
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sorter.js +0 -170
- package/helpcenter.ts +0 -253
- package/ims/ImsProfile.ts +0 -57
- package/index.ts +0 -76
- package/internal.ts +0 -102
- package/metrics/Analytics.ts +0 -55
- package/metrics/Application.ts +0 -24
- package/metrics/Configuration.ts +0 -33
- package/metrics/Events.ts +0 -28
- package/metrics/History.ts +0 -36
- package/metrics/Metric.ts +0 -52
- package/metrics/Metrics.ts +0 -129
- package/metrics/RecordType.ts +0 -139
- package/metrics/User.ts +0 -30
- package/metrics.ts +0 -94
- package/network.ts +0 -554
- package/nps.ts +0 -83
- package/orgswitcher.ts +0 -109
- package/page.ts +0 -497
- package/permissions.ts +0 -103
- package/pulse.ts +0 -198
- package/session.ts +0 -116
- package/settings.ts +0 -147
- package/shell.ts +0 -107
- package/sidebar.ts +0 -208
- package/sidenav.ts +0 -287
- package/src/EventEmitter.ts +0 -44
- package/src/Global.ts +0 -109
- package/src/Runtime.ts +0 -23
- package/tests/MockRuntime.ts +0 -28
- package/tests/appapi.test.ts +0 -78
- package/tests/capabilityapi.test.ts +0 -55
- package/tests/helpCenter.test.ts +0 -80
- package/tests/index.test.ts +0 -50
- package/tests/metrics.test.ts +0 -34
- package/tests/nps.test.ts +0 -37
- package/tests/page.test.ts +0 -110
- package/tests/permissions.test.ts +0 -96
- package/tests/pulse.test.ts +0 -37
- package/tests/shell.test.ts +0 -89
- package/tests/sidenav.test.ts +0 -91
- package/tests/topbar.test.ts +0 -85
- package/tests/user.test.ts +0 -129
- package/tests/userprofile.test.ts +0 -31
- package/topbar.ts +0 -288
- package/user.ts +0 -235
- package/userprofile.ts +0 -93
package/pulse.ts
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
/*************************************************************************
|
|
2
|
-
* Copyright 2020 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it. If you have received this file from a source other than Adobe,
|
|
8
|
-
* then your use, modification, or distribution of it requires the prior
|
|
9
|
-
* written permission of Adobe.
|
|
10
|
-
**************************************************************************/
|
|
11
|
-
/**
|
|
12
|
-
* APIs that let solutions interact with Pulse, Adobe's Notification System.
|
|
13
|
-
*
|
|
14
|
-
* ***Import:***
|
|
15
|
-
*
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import pulse from '@adobe/exc-app/pulse';
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* ***Default export:***
|
|
21
|
-
*
|
|
22
|
-
* [PulseApi](../interfaces/pulse.pulseapi.md#interface-pulserapi)
|
|
23
|
-
*
|
|
24
|
-
* ***Usage:***
|
|
25
|
-
*
|
|
26
|
-
* ```typescript
|
|
27
|
-
* import pulse, {NotificationType} from '@adobe/exc-app/pulse';
|
|
28
|
-
*
|
|
29
|
-
* pulse.send([{
|
|
30
|
-
* groupIds: [],
|
|
31
|
-
* messageType: NotificationType.UPDATES_ON_SUBSCRIBED_OBJECT,
|
|
32
|
-
* metadata: {priority: 'low'},
|
|
33
|
-
* sendToOrg: false,
|
|
34
|
-
* templateParams: {message: 'System shared Asset shared'},
|
|
35
|
-
* userIds: []
|
|
36
|
-
* }]);
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* API for sending pulse notifications.
|
|
40
|
-
* @packageDocumentation
|
|
41
|
-
* @module pulse
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
import {getImpl} from './src/Global';
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @ignore
|
|
48
|
-
*/
|
|
49
|
-
export enum NotificationType {
|
|
50
|
-
/**
|
|
51
|
-
* Request for approval of a resource.
|
|
52
|
-
*/
|
|
53
|
-
APPROVAL_REQUEST = 'approval_request',
|
|
54
|
-
/**
|
|
55
|
-
* Acceptance or rejection of an approval request.
|
|
56
|
-
*/
|
|
57
|
-
APPROVAL_REQUEST_ACTION = 'approval_request_action',
|
|
58
|
-
/**
|
|
59
|
-
* Request for access.
|
|
60
|
-
*/
|
|
61
|
-
ACCESS_REQUEST = 'access_request',
|
|
62
|
-
/**
|
|
63
|
-
* Acceptance or rejection of an access request.
|
|
64
|
-
*/
|
|
65
|
-
ACCESS_REQUEST_ACTION = 'access_request_action',
|
|
66
|
-
/**
|
|
67
|
-
* Assignment notification.
|
|
68
|
-
*/
|
|
69
|
-
ASSIGNED = 'assigned',
|
|
70
|
-
/**
|
|
71
|
-
* Sharing notification.
|
|
72
|
-
*/
|
|
73
|
-
SHARED = 'shared',
|
|
74
|
-
/**
|
|
75
|
-
* Mentions notification.
|
|
76
|
-
*/
|
|
77
|
-
MENTIONS = 'mentions',
|
|
78
|
-
/**
|
|
79
|
-
* Update notification.
|
|
80
|
-
*/
|
|
81
|
-
UPDATES_ON_SUBSCRIBED_OBJECT = 'updates_on_subscribed_object',
|
|
82
|
-
/**
|
|
83
|
-
* Notification for completion with errors.
|
|
84
|
-
*/
|
|
85
|
-
ERROR_COMPLETED_WITH_ERRORS = 'completed_with_errors',
|
|
86
|
-
/**
|
|
87
|
-
* Notification for failure with errors.
|
|
88
|
-
*/
|
|
89
|
-
ERROR_FAILED_WITH_ERRORS = 'failed_with_errors',
|
|
90
|
-
/**
|
|
91
|
-
* Error default message.
|
|
92
|
-
*/
|
|
93
|
-
ERROR_DEFAULT_MESSAGE = 'errors_default_message',
|
|
94
|
-
/**
|
|
95
|
-
* Other notification.
|
|
96
|
-
*/
|
|
97
|
-
OTHERS = 'others'
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface PulseNotification {
|
|
101
|
-
/**
|
|
102
|
-
* Type of Notification to be sent.
|
|
103
|
-
*/
|
|
104
|
-
messageType: NotificationType;
|
|
105
|
-
/**
|
|
106
|
-
* A map of key value pairs which can be provided by publisher of notification for the consumer.
|
|
107
|
-
*/
|
|
108
|
-
metadata?: Record<string, string>;
|
|
109
|
-
/**
|
|
110
|
-
* Templated parameters.
|
|
111
|
-
*/
|
|
112
|
-
templateParams: Record<string, any>;
|
|
113
|
-
/**
|
|
114
|
-
* List of IMS user ids of the users to receive notification.
|
|
115
|
-
* A maximum of 100 user-ids are supported at a time.
|
|
116
|
-
*/
|
|
117
|
-
userIds?: string[];
|
|
118
|
-
/**
|
|
119
|
-
* List of group ids to receive notification.
|
|
120
|
-
*/
|
|
121
|
-
groupIds?: string[];
|
|
122
|
-
/**
|
|
123
|
-
* Specifies whether to send notifications to the complete IMS org.
|
|
124
|
-
*/
|
|
125
|
-
sendToOrg?: boolean;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface PulseResponse {
|
|
129
|
-
/**
|
|
130
|
-
* Notifications
|
|
131
|
-
*/
|
|
132
|
-
notifications: {
|
|
133
|
-
/**
|
|
134
|
-
* Specific notification.
|
|
135
|
-
*/
|
|
136
|
-
notification: {
|
|
137
|
-
/**
|
|
138
|
-
* Status code for the notification.
|
|
139
|
-
*/
|
|
140
|
-
statusCode: number;
|
|
141
|
-
/**
|
|
142
|
-
* Error message received if applicable.
|
|
143
|
-
*/
|
|
144
|
-
errorMessage: string;
|
|
145
|
-
/**
|
|
146
|
-
* Id of the notification.
|
|
147
|
-
*/
|
|
148
|
-
'notification-id': string;
|
|
149
|
-
}[];
|
|
150
|
-
};
|
|
151
|
-
}
|
|
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
|
-
|
|
165
|
-
export interface PulseApi {
|
|
166
|
-
/**
|
|
167
|
-
* Method to send a pulse notification.
|
|
168
|
-
*/
|
|
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;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const pulse: PulseApi = {
|
|
187
|
-
send: params => {
|
|
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);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export default pulse;
|
package/session.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/*************************************************************************
|
|
2
|
-
* Copyright 2021 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it. If you have received this file from a source other than Adobe,
|
|
8
|
-
* then your use, modification, or distribution of it requires the prior
|
|
9
|
-
* written permission of Adobe.
|
|
10
|
-
**************************************************************************/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* APIs to get, set or invalidate session data. These APIs are meant for applications using their
|
|
14
|
-
* own session management in addition Adobe IMS. These APIs are not meant to manage session but
|
|
15
|
-
* rather cache and recycle them whenever possible.
|
|
16
|
-
*
|
|
17
|
-
* To consume this API, add the following import to your code.
|
|
18
|
-
*
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import session from '@adobe/exc-app/session';
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* The default export is an object of type [SessionApi](../interfaces/_session_.sessionapi.md)
|
|
24
|
-
*
|
|
25
|
-
* API reference: [scroll down](#index)
|
|
26
|
-
*
|
|
27
|
-
* ### Sample code
|
|
28
|
-
*
|
|
29
|
-
* ``` typescript
|
|
30
|
-
* import session from '@adobe/exc-app/settings';
|
|
31
|
-
*
|
|
32
|
-
* // Get
|
|
33
|
-
* const session = await session.get();
|
|
34
|
-
*
|
|
35
|
-
* // Set to expire an hour from now
|
|
36
|
-
* await session.set({
|
|
37
|
-
* expires: Date.now() + 3600 * 1000,
|
|
38
|
-
* id: 'SESSION_ID'
|
|
39
|
-
* });
|
|
40
|
-
*
|
|
41
|
-
* // Invalidate session
|
|
42
|
-
* const session = await session.get();
|
|
43
|
-
* await session.invalidate(session);
|
|
44
|
-
* ```
|
|
45
|
-
* @packageDocumentation
|
|
46
|
-
* @module session
|
|
47
|
-
*/
|
|
48
|
-
import {getImpl} from './src/Global';
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Sets the scope validity. Ensuring a session can not be used outside of its context.
|
|
52
|
-
*/
|
|
53
|
-
export enum SessionScope {
|
|
54
|
-
/**
|
|
55
|
-
* User - Session is valid for the current user only.
|
|
56
|
-
*/
|
|
57
|
-
USER = 'user',
|
|
58
|
-
/**
|
|
59
|
-
* Organization - Session is valid for the current user and organization only.
|
|
60
|
-
*/
|
|
61
|
-
ORG = 'org',
|
|
62
|
-
/**
|
|
63
|
-
* Context - Session is valid for the current user, organization and context only.
|
|
64
|
-
* Context depends on the solution - Could be Sandboxes or Sub orgs.
|
|
65
|
-
*/
|
|
66
|
-
CONTEXT = 'context'
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* The session object.
|
|
71
|
-
*/
|
|
72
|
-
export interface Session {
|
|
73
|
-
/**
|
|
74
|
-
* Timestamp indicating session expiration time.
|
|
75
|
-
* 0 will use default TTL configured for the application.
|
|
76
|
-
*/
|
|
77
|
-
expires: number;
|
|
78
|
-
/**
|
|
79
|
-
* Session identifier
|
|
80
|
-
*/
|
|
81
|
-
id: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* APIs to get, set or invalidate session data. These APIs are meant for applications using their
|
|
86
|
-
* own session management in addition Adobe IMS. These APIs are not meant to manage session but
|
|
87
|
-
* rather cache and recycle them whenever possible.
|
|
88
|
-
*/
|
|
89
|
-
export interface SessionApi {
|
|
90
|
-
/**
|
|
91
|
-
* Gets a stored session if one is available.
|
|
92
|
-
* @returns Session object
|
|
93
|
-
*/
|
|
94
|
-
get(): Promise<Session>;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Stores the current session
|
|
98
|
-
* @param {object} Session object
|
|
99
|
-
*/
|
|
100
|
-
set(session: Session): Promise<void>;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Invalidates a session if its current.
|
|
104
|
-
* @param {object} Session object
|
|
105
|
-
*/
|
|
106
|
-
invalidate(session: Session): Promise<void>;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const session = {
|
|
110
|
-
get: () => getImpl('session')().get(),
|
|
111
|
-
invalidate: (session: Session) => getImpl('session')().invalidate(session),
|
|
112
|
-
set: (session: Session) => getImpl('session')().set(session)
|
|
113
|
-
} as SessionApi;
|
|
114
|
-
|
|
115
|
-
export default session;
|
|
116
|
-
|
package/settings.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/*************************************************************************
|
|
2
|
-
* Copyright 2020 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it. If you have received this file from a source other than Adobe,
|
|
8
|
-
* then your use, modification, or distribution of it requires the prior
|
|
9
|
-
* written permission of Adobe.
|
|
10
|
-
**************************************************************************/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* APIs to get or set settings, preferences or configuration data that can be stored and retrieved
|
|
14
|
-
* at an IMS user and/or an IMS org level. An app in unified shell can consume Settings service.
|
|
15
|
-
*
|
|
16
|
-
* To consume this API, add the following import to your code.
|
|
17
|
-
*
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import settings from '@adobe/exc-app/settings';
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* The default export is an object of type [SettingsApi](../interfaces/_settings_.settingsapi.md)
|
|
23
|
-
*
|
|
24
|
-
* API reference: [scroll down](#index)
|
|
25
|
-
*
|
|
26
|
-
* ### Sample code
|
|
27
|
-
*
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import settings, {SettingsLevel} from '@adobe/exc-app/settings';
|
|
30
|
-
*
|
|
31
|
-
* async function updateSettings(type: string, value: number) {
|
|
32
|
-
* const data = await settings.get({
|
|
33
|
-
* groupId: 'test-groupId',
|
|
34
|
-
* level: SettingsLevel.USER,
|
|
35
|
-
* settings: {key1: null}
|
|
36
|
-
* });
|
|
37
|
-
* data = data || {};
|
|
38
|
-
* data[type] = value;
|
|
39
|
-
* await settings.set({
|
|
40
|
-
* groupId: 'test-groupId',
|
|
41
|
-
* level: SettingsLevel.USER,
|
|
42
|
-
* settings: {key1: data}
|
|
43
|
-
* });
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* ### SettingsLevel
|
|
48
|
-
*
|
|
49
|
-
* Can be optionally specified to define the level at which settings are saved.
|
|
50
|
-
*
|
|
51
|
-
* * `SettingsLevel.USER` - use this level when you want to get/set settings per user.
|
|
52
|
-
* * `SettingsLevel.USERORG` - should be used when settings are for user + org combination.
|
|
53
|
-
* * `SettingsLevel.ORG` - use this level when you want to get/set settings per org.
|
|
54
|
-
*
|
|
55
|
-
* By default settings are saved at level `SettingsLevel.USERORG`. You can optionally override this
|
|
56
|
-
* in the get/set API calls using the `level` parameter.
|
|
57
|
-
*
|
|
58
|
-
* ### Groups
|
|
59
|
-
*
|
|
60
|
-
* Apps can group their settings into different groups by different group IDs and keep multiple
|
|
61
|
-
* settings in different groups. Apps are free to define their own groups for a particular selected
|
|
62
|
-
* settings level.
|
|
63
|
-
*
|
|
64
|
-
* You can specify this in the get/set API calls using the `groupId` parameter.
|
|
65
|
-
*
|
|
66
|
-
* ### Sharing settings
|
|
67
|
-
*
|
|
68
|
-
* Set settingsAppId in the solution specific route configuration in order to share settings with
|
|
69
|
-
* other applications.
|
|
70
|
-
* @packageDocumentation
|
|
71
|
-
* @module settings
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
import {getImpl} from './src/Global';
|
|
75
|
-
import {SettingsLevel} from './settings/SettingsLevel';
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* A map of settings in the settings service.
|
|
79
|
-
*/
|
|
80
|
-
export interface Settings {
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* The response from the settings service.
|
|
86
|
-
*/
|
|
87
|
-
export interface SettingsResponse<T extends Settings> {
|
|
88
|
-
/**
|
|
89
|
-
* The map of settings being worked upon.
|
|
90
|
-
*/
|
|
91
|
-
settings: T;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The input parameters for the settings API.
|
|
96
|
-
*/
|
|
97
|
-
export interface Parameters<T extends Settings> {
|
|
98
|
-
/**
|
|
99
|
-
* A unique identifier.
|
|
100
|
-
*/
|
|
101
|
-
groupId: string;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* A map of the settings key-value pairs. In case of `set` API, the value is saved and for the
|
|
105
|
-
* `get` API, the value is the fallback in case the key isn't present in the settings store.
|
|
106
|
-
*/
|
|
107
|
-
settings: T;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The type of store to get/set the settings from/to. Defaults to `SettingsLevel.USERORG`.
|
|
111
|
-
*/
|
|
112
|
-
level?: SettingsLevel;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* APIs to get or set settings, preferences or configuration data that can be stored and retrieved
|
|
117
|
-
* at an IMS user and/or an IMS org level. An app in unified shell can consume Settings service.
|
|
118
|
-
*/
|
|
119
|
-
export interface SettingsApi {
|
|
120
|
-
/**
|
|
121
|
-
* Gets settings based on the specified parameters such as groupId
|
|
122
|
-
* and settings - keys with default values to fallback.
|
|
123
|
-
* @param params Parameters used to identify settings to retrieve.
|
|
124
|
-
* @returns A promise for the specified settings.
|
|
125
|
-
*/
|
|
126
|
-
get<T extends Settings>(params: Parameters<T>): Promise<SettingsResponse<T>>;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Creates or updates settings based on the specified parameters such as groupId and settings
|
|
130
|
-
* key-value pairs.
|
|
131
|
-
* @param params Parameters to identify the settings to create or update.
|
|
132
|
-
* @returns A promise for the operation response.
|
|
133
|
-
*/
|
|
134
|
-
set<T extends Settings>(params: Parameters<T>): Promise<SettingsResponse<T>>;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const settings: SettingsApi = {
|
|
138
|
-
get: params => {
|
|
139
|
-
return getImpl('settings')().get(params);
|
|
140
|
-
},
|
|
141
|
-
set: params => {
|
|
142
|
-
return getImpl('settings')().set(params);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export {SettingsLevel};
|
|
147
|
-
export default settings;
|
package/shell.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/*************************************************************************
|
|
2
|
-
* Copyright 2020 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it. If you have received this file from a source other than Adobe,
|
|
8
|
-
* then your use, modification, or distribution of it requires the prior
|
|
9
|
-
* written permission of Adobe.
|
|
10
|
-
**************************************************************************/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* API to request shell-specific information such as environment and shellInfo.
|
|
14
|
-
*
|
|
15
|
-
* ***Import:***
|
|
16
|
-
*
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import shell from '@adobe/exc-app/shell';
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* ***Default export:***
|
|
22
|
-
*
|
|
23
|
-
* [ShellApi](../interfaces/shell.shellapi.md#interface-shellapi)
|
|
24
|
-
*
|
|
25
|
-
* ***Usage:***
|
|
26
|
-
*
|
|
27
|
-
* Below is an example of how to get various attributes associated to the shell:
|
|
28
|
-
*
|
|
29
|
-
* ```typescript
|
|
30
|
-
* import shell from '@adobe/exc-app/shell';
|
|
31
|
-
*
|
|
32
|
-
* const [env, imsEnv, info] = await Promise.all([
|
|
33
|
-
* shell.get('environment'),
|
|
34
|
-
* shell.get('imsEnvironment'),
|
|
35
|
-
* shell.get('shellInfo')
|
|
36
|
-
* ]);
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* ### Receiving updates
|
|
40
|
-
*
|
|
41
|
-
* You can also listen for updates on the requested data by listening to specific change events.
|
|
42
|
-
*
|
|
43
|
-
* These change events are emitted from the api that the data is requested from. For example, if a
|
|
44
|
-
* shell calls `await shell.get('shellInfo');` they must listen for the change event on
|
|
45
|
-
* `shell.on('change:shellInfo')`. If a shell calls `await shell.get('environment')` they must listen for the
|
|
46
|
-
* change event on `shell.on('change:environment')`. Here is a more detailed example of how the promise
|
|
47
|
-
* api and change events can be used to keep track of specific values from the config:
|
|
48
|
-
*
|
|
49
|
-
* ```typescript
|
|
50
|
-
* import shell from '@adobe/exc-app/shell';
|
|
51
|
-
*
|
|
52
|
-
* constructor() {
|
|
53
|
-
* this.state = {environment: null};
|
|
54
|
-
*
|
|
55
|
-
* shell.on('change:environment', (env) => {
|
|
56
|
-
* this.setState({env});
|
|
57
|
-
* });
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* async componentDidMount() {
|
|
61
|
-
* const env = await shell.get('environment');
|
|
62
|
-
* this.setState({env});
|
|
63
|
-
* }
|
|
64
|
-
* ```
|
|
65
|
-
* @packageDocumentation
|
|
66
|
-
* @module shell
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
import EventEmitter from './src/EventEmitter';
|
|
70
|
-
import {getImpl} from './src/Global';
|
|
71
|
-
|
|
72
|
-
export interface ShellInfo {
|
|
73
|
-
environment: string;
|
|
74
|
-
imsEnvironment: string;
|
|
75
|
-
shellInfo: Record<string, any>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
interface ShellInfoEvent {
|
|
79
|
-
'change:environment': string;
|
|
80
|
-
'change:imsEnvironment': string;
|
|
81
|
-
'change:shellInfo': Record<string, any>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface ShellApi extends EventEmitter<ShellInfoEvent> {
|
|
85
|
-
/**
|
|
86
|
-
* Gets the specified type of information about the shell.
|
|
87
|
-
* @param type The type of information to get.
|
|
88
|
-
*/
|
|
89
|
-
get<T extends keyof ShellInfo>(type: T): Promise<ShellInfo[T]>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const shell = {
|
|
93
|
-
emit: (type, evt) => {
|
|
94
|
-
return getImpl('shell')().emit(type, evt);
|
|
95
|
-
},
|
|
96
|
-
get: params => {
|
|
97
|
-
return getImpl('shell')().get(params);
|
|
98
|
-
},
|
|
99
|
-
off: (type, handler) => {
|
|
100
|
-
return getImpl('shell')().off(type, handler);
|
|
101
|
-
},
|
|
102
|
-
on: (type, handler) => {
|
|
103
|
-
return getImpl('shell')().on(type, handler);
|
|
104
|
-
}
|
|
105
|
-
} as ShellApi;
|
|
106
|
-
|
|
107
|
-
export default shell;
|