@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/tests/sidenav.test.ts
DELETED
|
@@ -1,91 +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
|
-
import Global, {Modules} from '../src/Global';
|
|
12
|
-
import sidenav, {SidenavApi, SidenavInfo} from '../sidenav';
|
|
13
|
-
|
|
14
|
-
describe('sidenav.ts', () => {
|
|
15
|
-
const evt = true;
|
|
16
|
-
const handler = () => {};
|
|
17
|
-
const sidenavMock = {
|
|
18
|
-
collapsed: true,
|
|
19
|
-
emit: (type, evt) => {
|
|
20
|
-
return {evt, type};
|
|
21
|
-
},
|
|
22
|
-
get: (param: SidenavInfo) => {
|
|
23
|
-
return Promise.resolve(param);
|
|
24
|
-
},
|
|
25
|
-
off: (type, handler) => {
|
|
26
|
-
return {handler, type};
|
|
27
|
-
},
|
|
28
|
-
on: (type, handler) => {
|
|
29
|
-
return {handler, type};
|
|
30
|
-
},
|
|
31
|
-
visible: true
|
|
32
|
-
} as SidenavApi;
|
|
33
|
-
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
(Global['exc-module-runtime'] as Modules) = {
|
|
36
|
-
sidenav: () => {
|
|
37
|
-
return sidenavMock;
|
|
38
|
-
}
|
|
39
|
-
} as Modules;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('can emit()', () => {
|
|
43
|
-
const spy = jest.spyOn(sidenavMock, 'emit');
|
|
44
|
-
|
|
45
|
-
// action
|
|
46
|
-
sidenav.emit('change:shellSideNavCollapsed', evt),
|
|
47
|
-
|
|
48
|
-
// verify
|
|
49
|
-
expect(spy).toBeCalledTimes(1);
|
|
50
|
-
expect(spy).toBeCalledWith('change:shellSideNavCollapsed', evt);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('can get()', async () => {
|
|
54
|
-
const spy = jest.spyOn(sidenavMock, 'get');
|
|
55
|
-
|
|
56
|
-
// action
|
|
57
|
-
await Promise.all([
|
|
58
|
-
sidenav.get('shellSideNavCollapsed')
|
|
59
|
-
]);
|
|
60
|
-
|
|
61
|
-
// verify
|
|
62
|
-
expect(spy).toBeCalledTimes(1);
|
|
63
|
-
expect(spy).toBeCalledWith('shellSideNavCollapsed');
|
|
64
|
-
|
|
65
|
-
// verify getters
|
|
66
|
-
expect(sidenav.collapsed).toEqual(true);
|
|
67
|
-
expect(sidenav.visible).toEqual(true);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('can off()', () => {
|
|
71
|
-
const spy = jest.spyOn(sidenavMock, 'off');
|
|
72
|
-
|
|
73
|
-
// action
|
|
74
|
-
sidenav.off('change:shellSideNavCollapsed', handler),
|
|
75
|
-
|
|
76
|
-
// verify
|
|
77
|
-
expect(spy).toBeCalledTimes(1);
|
|
78
|
-
expect(spy).toBeCalledWith('change:shellSideNavCollapsed', handler);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('can on()', () => {
|
|
82
|
-
const spy = jest.spyOn(sidenavMock, 'on');
|
|
83
|
-
|
|
84
|
-
// action
|
|
85
|
-
sidenav.on('change:shellSideNavCollapsed', handler);
|
|
86
|
-
|
|
87
|
-
// verify
|
|
88
|
-
expect(spy).toBeCalledTimes(1);
|
|
89
|
-
expect(spy).toBeCalledWith('change:shellSideNavCollapsed', handler);
|
|
90
|
-
});
|
|
91
|
-
});
|
package/tests/topbar.test.ts
DELETED
|
@@ -1,85 +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
|
-
import Global, {Modules} from '../src/Global';
|
|
12
|
-
import topbar, {
|
|
13
|
-
Callback,
|
|
14
|
-
CustomFeedbackConfig,
|
|
15
|
-
CustomSearchConfig,
|
|
16
|
-
ExternalFeedbackConfig,
|
|
17
|
-
HelpCenterFeedbackConfig
|
|
18
|
-
} from '../topbar';
|
|
19
|
-
|
|
20
|
-
describe('topbar/index.js', () => {
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
(Global['exc-module-runtime'] as Modules) = {
|
|
23
|
-
topbar: {
|
|
24
|
-
customEnvLabel: 'Test',
|
|
25
|
-
onHeroClick: (callback: Callback) => {
|
|
26
|
-
console.log(callback); // eslint-disable-line no-console
|
|
27
|
-
},
|
|
28
|
-
setCustomSearch: (config: CustomSearchConfig) => {
|
|
29
|
-
console.log(config); // eslint-disable-line no-console
|
|
30
|
-
},
|
|
31
|
-
setFeedbackButton: (config: CustomFeedbackConfig | HelpCenterFeedbackConfig | ExternalFeedbackConfig | null) => {
|
|
32
|
-
console.log(config); // eslint-disable-line no-console
|
|
33
|
-
},
|
|
34
|
-
solution: {
|
|
35
|
-
icon: 'AdobeExperienceCloud',
|
|
36
|
-
shortTitle: 'AEC',
|
|
37
|
-
title: 'Adobe Experience Cloud22'
|
|
38
|
-
},
|
|
39
|
-
workspaces: [{name: 'Workspace', url: '/workspace'}]
|
|
40
|
-
}
|
|
41
|
-
} as Modules;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('correctly sets up the connection with module-runtime', () => {
|
|
45
|
-
expect(true).toEqual(true);
|
|
46
|
-
const searchCallback = jest.fn();
|
|
47
|
-
const setCustomSearchSpy = jest.spyOn(Global['exc-module-runtime'].topbar, 'setCustomSearch');
|
|
48
|
-
topbar.setCustomSearch({callback: searchCallback, enabled: true, open: false});
|
|
49
|
-
expect(setCustomSearchSpy).toBeCalledTimes(1);
|
|
50
|
-
|
|
51
|
-
expect(topbar.solution).toStrictEqual({
|
|
52
|
-
icon: 'AdobeExperienceCloud',
|
|
53
|
-
shortTitle: 'AEC',
|
|
54
|
-
title: 'Adobe Experience Cloud22'
|
|
55
|
-
});
|
|
56
|
-
const newConfig = {
|
|
57
|
-
icon: 'AdobeExample',
|
|
58
|
-
shortTitle: 'AEC',
|
|
59
|
-
title: 'Example Solution'
|
|
60
|
-
};
|
|
61
|
-
topbar.solution = newConfig;
|
|
62
|
-
expect(Global['exc-module-runtime'].topbar.solution).toStrictEqual(newConfig);
|
|
63
|
-
|
|
64
|
-
expect(topbar.customEnvLabel).toBe('Test');
|
|
65
|
-
topbar.customEnvLabel = 'Beta';
|
|
66
|
-
expect(Global['exc-module-runtime'].topbar.customEnvLabel).toBe('Beta');
|
|
67
|
-
|
|
68
|
-
expect(topbar.workspaces).toStrictEqual([{name: 'Workspace', url: '/workspace'}]);
|
|
69
|
-
topbar.workspaces = [{name: 'New Workspace', url: '/newWorkspace'}];
|
|
70
|
-
expect(Global['exc-module-runtime'].topbar.workspaces).toStrictEqual([{name: 'New Workspace', url: '/newWorkspace'}]);
|
|
71
|
-
|
|
72
|
-
expect(typeof topbar.onHeroClick).toBe('function');
|
|
73
|
-
const newCallback = () => {};
|
|
74
|
-
const heroClickSpy = jest.spyOn(Global['exc-module-runtime'].topbar, 'onHeroClick');
|
|
75
|
-
topbar.onHeroClick(newCallback);
|
|
76
|
-
expect(heroClickSpy).toBeCalledWith(newCallback);
|
|
77
|
-
|
|
78
|
-
const feedbackCallback = jest.fn();
|
|
79
|
-
const feedbackButtonSpy = jest.spyOn(Global['exc-module-runtime'].topbar, 'setFeedbackButton');
|
|
80
|
-
topbar.setFeedbackButton({buttonLabel: 'Beta Feedback', callback: feedbackCallback, enabled: true, type: 'custom'});
|
|
81
|
-
topbar.setFeedbackButton({buttonLabel: 'Beta Feedback', enabled: true, subject: 'Subject', type: 'openFeedback'});
|
|
82
|
-
topbar.setFeedbackButton({buttonLabel: 'Beta Feedback', enabled: true, type: 'external', url: 'http://example.com'});
|
|
83
|
-
expect(feedbackButtonSpy).toBeCalledTimes(3);
|
|
84
|
-
});
|
|
85
|
-
});
|
package/tests/user.test.ts
DELETED
|
@@ -1,129 +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
|
-
import Global, {Modules} from '../src/Global';
|
|
12
|
-
import user, {IMS, UserApi, UserInfo} from '../user';
|
|
13
|
-
|
|
14
|
-
describe('user.ts', () => {
|
|
15
|
-
const evt = '';
|
|
16
|
-
const handler = () => {};
|
|
17
|
-
const userMock = {
|
|
18
|
-
authExpired: () => {},
|
|
19
|
-
emit: (type, evt) => {
|
|
20
|
-
return {evt, type};
|
|
21
|
-
},
|
|
22
|
-
get: (param: UserInfo) => {
|
|
23
|
-
return Promise.resolve(param);
|
|
24
|
-
},
|
|
25
|
-
getCustomToken: (ims: IMS) => {
|
|
26
|
-
return Promise.resolve(ims.toString());
|
|
27
|
-
},
|
|
28
|
-
logoutUrl: 'https://localhost/logout',
|
|
29
|
-
off: (type, handler) => {
|
|
30
|
-
return {handler, type};
|
|
31
|
-
},
|
|
32
|
-
on: (type, handler) => {
|
|
33
|
-
return {handler, type};
|
|
34
|
-
},
|
|
35
|
-
showLanguagePicker: undefined
|
|
36
|
-
} as UserApi;
|
|
37
|
-
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
(Global['exc-module-runtime'] as Modules) = {
|
|
40
|
-
user: () => {
|
|
41
|
-
return userMock;
|
|
42
|
-
}
|
|
43
|
-
} as Modules;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('can emit()', () => {
|
|
47
|
-
const spy = jest.spyOn(userMock, 'emit');
|
|
48
|
-
|
|
49
|
-
// action
|
|
50
|
-
user.emit('change:theme', evt),
|
|
51
|
-
|
|
52
|
-
// verify
|
|
53
|
-
expect(spy).toBeCalledTimes(1);
|
|
54
|
-
expect(spy).toBeCalledWith('change:theme', evt);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('can get()', async () => {
|
|
58
|
-
const spy = jest.spyOn(userMock, 'get');
|
|
59
|
-
|
|
60
|
-
// action
|
|
61
|
-
await Promise.all([
|
|
62
|
-
user.get('imsOrg'),
|
|
63
|
-
user.get('imsOrgName'),
|
|
64
|
-
user.get('imsOrgs'),
|
|
65
|
-
user.get('imsToken'),
|
|
66
|
-
user.get('imsProfile'),
|
|
67
|
-
user.get('locale'),
|
|
68
|
-
user.get('preferredLanguages'),
|
|
69
|
-
user.get('sandbox'),
|
|
70
|
-
user.get('sandboxes'),
|
|
71
|
-
user.get('subOrg'),
|
|
72
|
-
user.get('tenant'),
|
|
73
|
-
user.get('theme')
|
|
74
|
-
]);
|
|
75
|
-
|
|
76
|
-
// verify
|
|
77
|
-
expect(spy).toBeCalledTimes(12);
|
|
78
|
-
expect(spy).toBeCalledWith('imsOrg');
|
|
79
|
-
expect(spy).toBeCalledWith('imsOrgName');
|
|
80
|
-
expect(spy).toBeCalledWith('imsOrgs');
|
|
81
|
-
expect(spy).toBeCalledWith('imsToken');
|
|
82
|
-
expect(spy).toBeCalledWith('imsProfile');
|
|
83
|
-
expect(spy).toBeCalledWith('locale');
|
|
84
|
-
expect(spy).toBeCalledWith('preferredLanguages');
|
|
85
|
-
expect(spy).toBeCalledWith('sandbox');
|
|
86
|
-
expect(spy).toBeCalledWith('sandboxes');
|
|
87
|
-
expect(spy).toBeCalledWith('subOrg');
|
|
88
|
-
expect(spy).toBeCalledWith('tenant');
|
|
89
|
-
expect(spy).toBeCalledWith('theme');
|
|
90
|
-
|
|
91
|
-
// Verify logoutUrl getter
|
|
92
|
-
expect(user.logoutUrl).toEqual('https://localhost/logout');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('can getCustomToken()', async () => {
|
|
96
|
-
const spy = jest.spyOn(userMock, 'getCustomToken');
|
|
97
|
-
user.getCustomToken({client_id: 'client', scopes: 'scope1,scope2'});
|
|
98
|
-
expect(spy).toBeCalledTimes(1);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('can off()', () => {
|
|
102
|
-
const spy = jest.spyOn(userMock, 'off');
|
|
103
|
-
|
|
104
|
-
// action
|
|
105
|
-
user.off('change:imsOrg', handler),
|
|
106
|
-
|
|
107
|
-
// verify
|
|
108
|
-
expect(spy).toBeCalledTimes(1);
|
|
109
|
-
expect(spy).toBeCalledWith('change:imsOrg', handler);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('can on()', () => {
|
|
113
|
-
const spy = jest.spyOn(userMock, 'on');
|
|
114
|
-
|
|
115
|
-
// action
|
|
116
|
-
user.on('change:tenant', handler);
|
|
117
|
-
|
|
118
|
-
// verify
|
|
119
|
-
expect(spy).toBeCalledTimes(1);
|
|
120
|
-
expect(spy).toBeCalledWith('change:tenant', handler);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('can call authExpired', () => {
|
|
124
|
-
const user = Global['exc-module-runtime'].user();
|
|
125
|
-
const authExpiredSpy = jest.spyOn(user, 'authExpired');
|
|
126
|
-
user.authExpired();
|
|
127
|
-
expect(authExpiredSpy).toBeCalledTimes(1);
|
|
128
|
-
});
|
|
129
|
-
});
|
|
@@ -1,31 +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
|
-
import Global, {Modules} from '../src/Global';
|
|
12
|
-
import userProfile from '../userprofile';
|
|
13
|
-
|
|
14
|
-
describe('userProfile', () => {
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
(Global['exc-module-runtime'] as Modules) = {
|
|
17
|
-
userProfile: {
|
|
18
|
-
setButtons: (buttons) => {
|
|
19
|
-
console.log(buttons); // eslint-disable-line no-console
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
} as Modules;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('correctly sets up the connection with module-runtime', () => {
|
|
26
|
-
const setButtons = jest.spyOn(Global['exc-module-runtime'].userProfile, 'setButtons');
|
|
27
|
-
const callbackFn = jest.fn();
|
|
28
|
-
userProfile.setButtons([{callback: callbackFn, id: 'idx', label: 'myButton'}]);
|
|
29
|
-
expect(setButtons).toBeCalledTimes(1);
|
|
30
|
-
});
|
|
31
|
-
});
|
package/topbar.ts
DELETED
|
@@ -1,288 +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 that let solutions interact with the top bar and personalize it, e.g. configuring the
|
|
14
|
-
* solution area on the left, setting up workspaces, custom search, etc.
|
|
15
|
-
*
|
|
16
|
-
* ***Import:***
|
|
17
|
-
*
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import topbar from '@adobe/exc-app/topbar';
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* ***Default export:***
|
|
23
|
-
*
|
|
24
|
-
* [TopbarApi](../interfaces/topbar.topbarapi.md#interface-topbarapi)
|
|
25
|
-
*
|
|
26
|
-
* ***Usage:***
|
|
27
|
-
*
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import topbar from '@adobe/exc-app/topbar';
|
|
30
|
-
*
|
|
31
|
-
* topbar.customEnvLabel = 'Beta';
|
|
32
|
-
* ```
|
|
33
|
-
* @packageDocumentation
|
|
34
|
-
* @module topbar
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
import {connect} from './src/Global';
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Defines the attributes of the solution to display on the left-side of the top bar.
|
|
41
|
-
*/
|
|
42
|
-
export interface Solution {
|
|
43
|
-
/**
|
|
44
|
-
* The icon to display in the solution area. If this isn't set, then the default experience cloud
|
|
45
|
-
* icon will be used.
|
|
46
|
-
*/
|
|
47
|
-
icon: string;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The title to display on smaller browser resolutions where the horizonal space is constrained.
|
|
51
|
-
*/
|
|
52
|
-
shortTitle: string;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The title to display. Defaults to 'Adobe Experience Cloud'.
|
|
56
|
-
*/
|
|
57
|
-
title: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface CustomSearchConfig {
|
|
61
|
-
/**
|
|
62
|
-
* Used to control whether or not the search icon in the top bar is enabled and clickable.
|
|
63
|
-
*/
|
|
64
|
-
enabled?: boolean;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Flag used to notify shell whether the custom search dialog has been opened/closed.
|
|
68
|
-
*/
|
|
69
|
-
open?: boolean;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The callback to execute when the search icon is clicked.
|
|
73
|
-
*/
|
|
74
|
-
callback?: Callback;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @ignore
|
|
79
|
-
*/
|
|
80
|
-
export interface CoachMarkConfig {
|
|
81
|
-
/**
|
|
82
|
-
* The callback to execute when the position of the element Coach Marks is pointing to is updated.
|
|
83
|
-
* The position, which specifies the horizontal position of the element in pixels,
|
|
84
|
-
* will be passed as an argument to the callback.
|
|
85
|
-
*/
|
|
86
|
-
callback?: CoachMarkCallback;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Valid CSS selector string indicating which element Coach Marks should be pointing to.
|
|
90
|
-
*/
|
|
91
|
-
element: string;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Whether or not Coach Marks is currently enabled in the Shell.
|
|
95
|
-
*/
|
|
96
|
-
enabled: boolean;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface CustomFeedbackConfig {
|
|
100
|
-
buttonLabel: string;
|
|
101
|
-
callback: Callback;
|
|
102
|
-
enabled: boolean;
|
|
103
|
-
type: 'custom';
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface ExternalFeedbackConfig {
|
|
107
|
-
buttonLabel: string;
|
|
108
|
-
enabled: boolean;
|
|
109
|
-
type: 'external';
|
|
110
|
-
url: string;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface HelpCenterFeedbackConfig {
|
|
114
|
-
buttonLabel: string;
|
|
115
|
-
enabled: boolean;
|
|
116
|
-
subject?: string;
|
|
117
|
-
type: 'openFeedback';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
interface WorkspaceMenu {
|
|
121
|
-
/**
|
|
122
|
-
* Workspace name shown on the tab (unique).
|
|
123
|
-
*/
|
|
124
|
-
name: string;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Optional when menu is used. Path when workspace is clicked. This can alternatively be a full
|
|
128
|
-
* url. This must be a path if it needs to stay within the Unified Shell.
|
|
129
|
-
*/
|
|
130
|
-
url?: string;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Optionally nest related links within an n-level menu underneath the workspace.
|
|
134
|
-
*/
|
|
135
|
-
menu?: Array<WorkspaceMenu>;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* If the workspace should open in a new tab.
|
|
139
|
-
*/
|
|
140
|
-
newtab?: boolean;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Optional array of regexes that allow the solution application to decide when a workspace should
|
|
144
|
-
* be selected. This is useful when there is a workspace like items and diving into a single item
|
|
145
|
-
* nets a URL like item/<id>. The same workspace should probably still be selected in this case,
|
|
146
|
-
* so the value of this option might be [/item\/\d*\/]
|
|
147
|
-
*/
|
|
148
|
-
selectOn?: RegExp[];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface Callback {(value?: any): void}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @ignore
|
|
155
|
-
*/
|
|
156
|
-
export interface CoachMarkCallback {(value?: number): void}
|
|
157
|
-
|
|
158
|
-
export interface TopbarApiProperties {
|
|
159
|
-
/**
|
|
160
|
-
* Gets or sets a custom environment label in the shell.
|
|
161
|
-
*
|
|
162
|
-
* ***Example:***
|
|
163
|
-
*
|
|
164
|
-
* ```typescript
|
|
165
|
-
* topbar.customEnvLabel = 'Beta';
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
customEnvLabel: string;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Configuration for solution name and hero. All values aside from
|
|
172
|
-
* path can only be used by third party applications. All other solutions will use
|
|
173
|
-
* their default product set branding as of the 2020 branding changes.
|
|
174
|
-
*
|
|
175
|
-
* ***Example:***
|
|
176
|
-
*
|
|
177
|
-
* ```typescript
|
|
178
|
-
* topbar.solution = {
|
|
179
|
-
* icon: 'AdobeExperienceCloud',
|
|
180
|
-
* path: '/alternatepath/for/heroclick',
|
|
181
|
-
* shortTitle: 'AEC',
|
|
182
|
-
* title: 'Adobe Experience Cloud22'
|
|
183
|
-
* };
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
solution: Solution;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Configuration for the Shell workspaces. Workspace names should be unique, and should be
|
|
190
|
-
* localized using the unified shell locale prior to setting runtime.workspaces.
|
|
191
|
-
*
|
|
192
|
-
* ```typescript
|
|
193
|
-
* topbar.workspaces = [
|
|
194
|
-
* {name: 'Home', url: '/'},
|
|
195
|
-
* {name: 'ABC', url: '/abc'},
|
|
196
|
-
* {name: 'DEF', url: '/def'}
|
|
197
|
-
* ];
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* Unified shell also supports workspace flyout menus, where clicking on a workspace displays a
|
|
201
|
-
* dropdown menu. The top-level workspace is present in the dropdown menu as the first menu item.
|
|
202
|
-
* Menus may be nested multiple times, and used in combination with normal workspaces. By default,
|
|
203
|
-
* parent menu items will be automatically added to the sub-menu due to how the user interaction
|
|
204
|
-
* works. To prevent this functionality, simply remove the url property on the parent item and it
|
|
205
|
-
* will not be injected into the sub-menu.
|
|
206
|
-
*
|
|
207
|
-
* ```typescript
|
|
208
|
-
* topbar.workspaces = [
|
|
209
|
-
* {name: 'Home', url: '/'},
|
|
210
|
-
* {name: 'ABC', url: '/abc'},
|
|
211
|
-
* {
|
|
212
|
-
* name: 'DEF',
|
|
213
|
-
* url: '/def',
|
|
214
|
-
* menu: [
|
|
215
|
-
* {
|
|
216
|
-
* name: 'GHI',
|
|
217
|
-
* url: '/def/ghi',
|
|
218
|
-
* menu: [
|
|
219
|
-
* {name: 'JKL', url: '/def/ghi/jkl'}
|
|
220
|
-
* ]
|
|
221
|
-
* }
|
|
222
|
-
* ]
|
|
223
|
-
* }
|
|
224
|
-
* ];
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
workspaces: WorkspaceMenu[];
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Defines page-level APIs available to solutions.
|
|
232
|
-
*/
|
|
233
|
-
export interface TopbarApi extends TopbarApiProperties {
|
|
234
|
-
/**
|
|
235
|
-
* Registers a callback to execute when the hero (solution) icon in the upper lefthand corner of
|
|
236
|
-
* the Shell is clicked.
|
|
237
|
-
* @param callback The callback to execute.
|
|
238
|
-
*/
|
|
239
|
-
onHeroClick(callback: Callback): void;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Determines whether or not to enable the custom search property and enacts a callback
|
|
243
|
-
* when the custom search icon is clicked.
|
|
244
|
-
*/
|
|
245
|
-
setCustomSearch(config: CustomSearchConfig | null): void;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Determines whether or not Coach Mark is enabled within the Shell and which element
|
|
249
|
-
* should currently be pointed to based on the CSS selector string. If no position is available,
|
|
250
|
-
* the selector is either not valid or the element was hidden due to the screen width being too small.
|
|
251
|
-
*
|
|
252
|
-
* ```typescript
|
|
253
|
-
* topbar.setCoachMark({
|
|
254
|
-
* callback: (position) => {
|
|
255
|
-
* if (!position) {
|
|
256
|
-
* return this.setState({coachMark {enabled: false, position}});
|
|
257
|
-
* }
|
|
258
|
-
* this.setState({coachMark: {enabled: true, position}});
|
|
259
|
-
* },
|
|
260
|
-
* element: '#hero',
|
|
261
|
-
* enabled: true
|
|
262
|
-
* })
|
|
263
|
-
* ```
|
|
264
|
-
* @param config The Coach Mark configuration with valid CSS selector and enabled boolean.
|
|
265
|
-
* Enacts a callback when the Coach Mark is enabled and positioned on an element.
|
|
266
|
-
*/
|
|
267
|
-
/**
|
|
268
|
-
* @ignore
|
|
269
|
-
*/
|
|
270
|
-
setCoachMark(config: CoachMarkConfig | null): void;
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Determines whether or not to enable a feedback button.
|
|
274
|
-
*/
|
|
275
|
-
setFeedbackButton(config: CustomFeedbackConfig | HelpCenterFeedbackConfig | ExternalFeedbackConfig | null): void;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const topbar = connect('topbar', [
|
|
279
|
-
['customEnvLabel'],
|
|
280
|
-
['onHeroClick', true],
|
|
281
|
-
['setCustomSearch', true],
|
|
282
|
-
['setCoachMark', true],
|
|
283
|
-
['setFeedbackButton', true],
|
|
284
|
-
['solution'],
|
|
285
|
-
['workspaces']
|
|
286
|
-
]);
|
|
287
|
-
|
|
288
|
-
export default topbar;
|