@microsoft/sp-component-base 1.22.0-beta.2 → 1.22.0-beta.4
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/467dc675-7cc5-4709-8aac-78e3b71bd2f6.manifest.json +1 -1
- package/lib/BaseComponent.d.ts +115 -0
- package/lib/BaseComponent.d.ts.map +1 -0
- package/lib/BaseComponent.js +162 -0
- package/lib/BaseComponentContext.d.ts +142 -0
- package/lib/BaseComponentContext.d.ts.map +1 -0
- package/lib/BaseComponentContext.js +221 -0
- package/lib/DynamicDataProvider.d.ts +166 -0
- package/lib/DynamicDataProvider.d.ts.map +1 -0
- package/lib/DynamicDataProvider.js +420 -0
- package/lib/DynamicDataSourceManager.d.ts +160 -0
- package/lib/DynamicDataSourceManager.d.ts.map +1 -0
- package/lib/DynamicDataSourceManager.js +382 -0
- package/lib/DynamicProperty.d.ts +204 -0
- package/lib/DynamicProperty.d.ts.map +1 -0
- package/lib/DynamicProperty.js +390 -0
- package/lib/EnsureIsolatedDomainUrl.d.ts +9 -0
- package/lib/EnsureIsolatedDomainUrl.d.ts.map +1 -0
- package/lib/EnsureIsolatedDomainUrl.js +26 -0
- package/lib/IComponentPosition.d.ts +28 -0
- package/lib/IComponentPosition.d.ts.map +1 -0
- package/lib/IComponentPosition.js +2 -0
- package/lib/IComponentPropertyMetadata.d.ts +100 -0
- package/lib/IComponentPropertyMetadata.d.ts.map +1 -0
- package/lib/IComponentPropertyMetadata.js +2 -0
- package/lib/ISerializedServerProcessedData.d.ts +166 -0
- package/lib/ISerializedServerProcessedData.d.ts.map +1 -0
- package/lib/ISerializedServerProcessedData.js +28 -0
- package/lib/LegacyThirdPartyFabricCoreLoader.d.ts +40 -0
- package/lib/LegacyThirdPartyFabricCoreLoader.d.ts.map +1 -0
- package/lib/LegacyThirdPartyFabricCoreLoader.js +90 -0
- package/lib/PropertyMetadataProcessor.d.ts +54 -0
- package/lib/PropertyMetadataProcessor.d.ts.map +1 -0
- package/lib/PropertyMetadataProcessor.js +297 -0
- package/lib/ShimmerFactory.d.ts +17 -0
- package/lib/ShimmerFactory.d.ts.map +1 -0
- package/lib/ShimmerFactory.js +62 -0
- package/lib/chunks/legacy-third-party-fabric-core/FabricLocalFont.d.ts +17 -0
- package/lib/chunks/legacy-third-party-fabric-core/FabricLocalFont.d.ts.map +1 -0
- package/lib/chunks/legacy-third-party-fabric-core/FabricLocalFont.js +17 -0
- package/lib/chunks/legacy-third-party-fabric-core/fabric-core-sass/Fabric.LocalFont.global.scss.css +9247 -0
- package/lib/chunks/legacy-third-party-fabric-core/fabric-core-sass/Fabric.LocalFontKillSwitchActivated.scss.css +11165 -0
- package/lib/chunks/legacy-third-party-fabric-core/fabric-core-shim.global.scss.css +2063 -0
- package/lib/chunks/legacy-third-party-fabric-core/fabric-core-shimKillSwitchActivated.scss.css +2164 -0
- package/lib/chunks/legacy-third-party-fabric-core/iconDefinitions.css +6 -0
- package/lib/common/Flights.d.ts +3 -0
- package/lib/common/Flights.d.ts.map +1 -0
- package/lib/common/Flights.js +10 -0
- package/lib/common/KillSwitches.d.ts +2 -0
- package/lib/common/KillSwitches.d.ts.map +1 -0
- package/lib/common/KillSwitches.js +5 -0
- package/lib/dataCollector/IWebPartLoadData.d.ts +140 -0
- package/lib/dataCollector/IWebPartLoadData.d.ts.map +1 -0
- package/lib/dataCollector/IWebPartLoadData.js +40 -0
- package/lib/dataCollector/WebPartLoadDataCollector.d.ts +14 -0
- package/lib/dataCollector/WebPartLoadDataCollector.d.ts.map +1 -0
- package/lib/dataCollector/WebPartLoadDataCollector.js +137 -0
- package/lib/index.d.ts +34 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +27 -0
- package/lib/loc/Strings.resx.d.ts +44 -0
- package/lib/loc/Strings.resx.json +1 -0
- package/lib/sp-component-base.manifest.json +9 -0
- package/lib/styles/shimmer.module.scss.css +11 -0
- package/lib/teams/DeferredTeamsAppsClient.d.ts +17 -0
- package/lib/teams/DeferredTeamsAppsClient.d.ts.map +1 -0
- package/lib/teams/DeferredTeamsAppsClient.js +39 -0
- package/lib/teams/ITeamsAppCatalog.d.ts +72 -0
- package/lib/teams/ITeamsAppCatalog.d.ts.map +1 -0
- package/lib/teams/ITeamsAppCatalog.js +2 -0
- package/lib/teams/TeamsAppsClient.d.ts +113 -0
- package/lib/teams/TeamsAppsClient.d.ts.map +1 -0
- package/lib/teams/TeamsAppsClient.js +440 -0
- package/lib/test-api/MockComponent.d.ts +8 -0
- package/lib/test-api/MockComponent.d.ts.map +1 -0
- package/lib/test-api/MockComponent.js +31 -0
- package/lib/test-api/MockComponentContext.d.ts +6 -0
- package/lib/test-api/MockComponentContext.d.ts.map +1 -0
- package/lib/test-api/MockComponentContext.js +27 -0
- package/lib/test-api/index.d.ts +3 -0
- package/lib/test-api/index.d.ts.map +1 -0
- package/lib/test-api/index.js +3 -0
- package/lib/themeProvider/ThemeProvider.d.ts +71 -0
- package/lib/themeProvider/ThemeProvider.d.ts.map +1 -0
- package/lib/themeProvider/ThemeProvider.js +99 -0
- package/lib/themeProvider/themeInterfaces/IFontStyles.d.ts +26 -0
- package/lib/themeProvider/themeInterfaces/IFontStyles.d.ts.map +1 -0
- package/lib/themeProvider/themeInterfaces/IFontStyles.js +2 -0
- package/lib/themeProvider/themeInterfaces/IPalette.d.ts +7 -0
- package/lib/themeProvider/themeInterfaces/IPalette.d.ts.map +1 -0
- package/lib/themeProvider/themeInterfaces/IPalette.js +2 -0
- package/lib/themeProvider/themeInterfaces/ISemanticColors.d.ts +56 -0
- package/lib/themeProvider/themeInterfaces/ISemanticColors.d.ts.map +1 -0
- package/lib/themeProvider/themeInterfaces/ISemanticColors.js +2 -0
- package/lib/themeProvider/themeInterfaces/ISemanticTextColors.d.ts +7 -0
- package/lib/themeProvider/themeInterfaces/ISemanticTextColors.d.ts.map +1 -0
- package/lib/themeProvider/themeInterfaces/ISemanticTextColors.js +2 -0
- package/lib/themeProvider/themeInterfaces/ITheme.d.ts +16 -0
- package/lib/themeProvider/themeInterfaces/ITheme.d.ts.map +1 -0
- package/lib/themeProvider/themeInterfaces/ITheme.js +2 -0
- package/package.json +15 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITeamsAppCatalog.d.ts","sourceRoot":"","sources":["../../src/teams/ITeamsAppCatalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,mBAAmB,EAAE,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAE3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,SAAS,CAAC;IACf,cAAc,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IAEX,WAAW,EAAE,aAAa,GAAG,IAAI,CAAC;IAElC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,gCAAgC,CAAC;IAChD,IAAI,CAAC,EAAE,uBAAuB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,UAAU,EAAE,KAAK,CAAC;IAClB,gBAAgB,CAAC,EAAE,mCAAmC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { IClientSideComponentManifest } from '@microsoft/sp-module-interfaces';
|
|
2
|
+
import type { ServiceScope } from '@microsoft/sp-core-library';
|
|
3
|
+
/**
|
|
4
|
+
* Unique identification of the Teams App component.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface ITeamsAppComponentId {
|
|
9
|
+
/**
|
|
10
|
+
* Teams App ID.
|
|
11
|
+
*/
|
|
12
|
+
appId: string;
|
|
13
|
+
/**
|
|
14
|
+
* For LOB apps - contains the id provided by a developer in the manifest.
|
|
15
|
+
*/
|
|
16
|
+
externalAppId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Teams App component ID.
|
|
19
|
+
*/
|
|
20
|
+
componentId: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* SPFx component that was synced from Teams.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export interface ITeamsAppComponent extends ITeamsAppComponentId {
|
|
28
|
+
/**
|
|
29
|
+
* App/component version.
|
|
30
|
+
*/
|
|
31
|
+
version: string;
|
|
32
|
+
/**
|
|
33
|
+
* App name.
|
|
34
|
+
*/
|
|
35
|
+
appName: string;
|
|
36
|
+
/**
|
|
37
|
+
* App description.
|
|
38
|
+
*/
|
|
39
|
+
appDescription: string;
|
|
40
|
+
/**
|
|
41
|
+
* Group ID.
|
|
42
|
+
*/
|
|
43
|
+
groupId: string;
|
|
44
|
+
/**
|
|
45
|
+
* Icon URL.
|
|
46
|
+
*/
|
|
47
|
+
iconUrl?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Office UI Fabric icon name.
|
|
50
|
+
*/
|
|
51
|
+
officeUIFabricIconName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Component name.
|
|
54
|
+
*/
|
|
55
|
+
name: string;
|
|
56
|
+
/**
|
|
57
|
+
* Component description.
|
|
58
|
+
*/
|
|
59
|
+
description: string;
|
|
60
|
+
/**
|
|
61
|
+
* Connected bot id.
|
|
62
|
+
*/
|
|
63
|
+
botId: string;
|
|
64
|
+
/**
|
|
65
|
+
* Ace default size.
|
|
66
|
+
*/
|
|
67
|
+
defaultSize: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The client for the Teams Apps sync.
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export declare class TeamsAppsClient {
|
|
75
|
+
private static _getTeamsAppComponentManifestsPromise;
|
|
76
|
+
private static _ensureAppCatalogPromise;
|
|
77
|
+
/**
|
|
78
|
+
* Map[teamsAppId, Promise[Set[teamsAppId]]]
|
|
79
|
+
*
|
|
80
|
+
* We store a map where the same promise can be used for multiple entries.
|
|
81
|
+
* In that case we can avoid multiple requests to the API for the same teamsAppId as well as avoid race conditions and allow to make extra requests if needed.
|
|
82
|
+
*/
|
|
83
|
+
private readonly _appComponentsPermissionsPromises;
|
|
84
|
+
private readonly _serviceScope;
|
|
85
|
+
private _msGraphClientFactory;
|
|
86
|
+
private _msGraphClientDeferred;
|
|
87
|
+
constructor(serviceScope: ServiceScope);
|
|
88
|
+
/**
|
|
89
|
+
* Gets the list of Teams App components from Teams App Catalog.
|
|
90
|
+
* @returns Promise that resolves to the list of Teams App components.
|
|
91
|
+
*/
|
|
92
|
+
getTeamsAppComponentManifests(): Promise<IClientSideComponentManifest[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Syncs the Teams App component into SharePoint App Catalog.
|
|
95
|
+
*/
|
|
96
|
+
syncComponent(teamsAppComponentManifest: IClientSideComponentManifest): Promise<IClientSideComponentManifest>;
|
|
97
|
+
/**
|
|
98
|
+
* Requests permissions for the Teams App components (apps) for the current user.
|
|
99
|
+
*/
|
|
100
|
+
requestPermissions(teamsAppComponentIds: ITeamsAppComponentId[]): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Checks if the component is enabled for the current user based on requested Teams permissions.
|
|
103
|
+
*/
|
|
104
|
+
isComponentEnabled(teamsAppId: string): Promise<boolean>;
|
|
105
|
+
private _requestAppsPermissions;
|
|
106
|
+
private _requestAppsPermissionsBatched;
|
|
107
|
+
private _getCheckPermissionsUrl;
|
|
108
|
+
private get _msGraphClient();
|
|
109
|
+
private _teamsAppCatalogItemToAceManifests;
|
|
110
|
+
private _convertBlobToBase64;
|
|
111
|
+
private _teamsAppComponentToAceManifest;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=TeamsAppsClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TeamsAppsClient.d.ts","sourceRoot":"","sources":["../../src/teams/TeamsAppsClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,4BAA4B,EAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAyE/D;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC9D;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,qCAAqC,CAAmD;IACvG,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAA4B;IAEnE;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,iCAAiC,CAG9C;IACJ,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAC7C,OAAO,CAAC,qBAAqB,CAAmC;IAChE,OAAO,CAAC,sBAAsB,CAAuC;gBAElD,YAAY,EAAE,YAAY;IAI7C;;;OAGG;IACI,6BAA6B,IAAI,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAuC/E;;OAEG;IACI,aAAa,CAClB,yBAAyB,EAAE,4BAA4B,GACtD,OAAO,CAAC,4BAA4B,CAAC;IA6FxC;;OAEG;IACI,kBAAkB,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtF;;OAEG;IACI,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB/D,OAAO,CAAC,uBAAuB;IA+C/B,OAAO,CAAC,8BAA8B;IAkGtC,OAAO,CAAC,uBAAuB;IAO/B,OAAO,KAAK,cAAc,GASzB;IAED,OAAO,CAAC,kCAAkC;IAoE1C,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,+BAA+B;CAkCxC"}
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { _QosMonitor } from '@microsoft/sp-diagnostics';
|
|
2
|
+
import { MSGraphClientFactory, SPHttpClient } from '@microsoft/sp-http';
|
|
3
|
+
import { PageContext } from '@microsoft/sp-page-context';
|
|
4
|
+
import { isBotAcesFromTeamsEnabled } from '../common/Flights';
|
|
5
|
+
import { uniq } from '@microsoft/sp-lodash-subset';
|
|
6
|
+
// base teams apps endpoint
|
|
7
|
+
var MS_GRAPH_TEAMS_APPS_ENDPOINT = '/appCatalogs/teamsApps';
|
|
8
|
+
// QSP to fetch all teams apps with dashboard cards
|
|
9
|
+
var MS_GRAPH_FETCH_TEAMS_APPS_QSP = "$expand=appDefinitions($expand=outlineIcon,colorIcon,dashboardCards)&$filter=appDefinitions/any(a:a/dashboardCards/$count ne 0)";
|
|
10
|
+
// QSP to check permissions for the list of app ids
|
|
11
|
+
var MS_GRAPH_CHECK_PERMISSIONS_QSP = "$expand=appDefinitions($expand=dashboardCards)&$filter=appDefinitions/any(a:a/dashboardCards/$count ne 0) and id in ('{appIds}')";
|
|
12
|
+
var MS_GRAPH_API_VERSION = 'beta';
|
|
13
|
+
// the number of app ids we can process without batching the request to avoid the URL length limit
|
|
14
|
+
var MAX_IDS_WITHOUT_BATCHING = 30;
|
|
15
|
+
var MAX_REQUESTS_PER_BATCH = 10;
|
|
16
|
+
var MANIFEST_VERSION = 2;
|
|
17
|
+
var ADVANCED_TOOLBOX_GROUP_ID = '5c03119e-3074-46fd-976b-c60198311f70';
|
|
18
|
+
/**
|
|
19
|
+
* The client for the Teams Apps sync.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
var TeamsAppsClient = /** @class */ (function () {
|
|
24
|
+
function TeamsAppsClient(serviceScope) {
|
|
25
|
+
/**
|
|
26
|
+
* Map[teamsAppId, Promise[Set[teamsAppId]]]
|
|
27
|
+
*
|
|
28
|
+
* We store a map where the same promise can be used for multiple entries.
|
|
29
|
+
* In that case we can avoid multiple requests to the API for the same teamsAppId as well as avoid race conditions and allow to make extra requests if needed.
|
|
30
|
+
*/
|
|
31
|
+
this._appComponentsPermissionsPromises = new Map();
|
|
32
|
+
this._serviceScope = serviceScope;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Gets the list of Teams App components from Teams App Catalog.
|
|
36
|
+
* @returns Promise that resolves to the list of Teams App components.
|
|
37
|
+
*/
|
|
38
|
+
TeamsAppsClient.prototype.getTeamsAppComponentManifests = function () {
|
|
39
|
+
var _this = this;
|
|
40
|
+
if (!TeamsAppsClient._getTeamsAppComponentManifestsPromise) {
|
|
41
|
+
if (!isBotAcesFromTeamsEnabled()) {
|
|
42
|
+
TeamsAppsClient._getTeamsAppComponentManifestsPromise = Promise.resolve([]);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
var monitor_1 = new _QosMonitor('TeamsAppsClient.FetchTeamsApp');
|
|
46
|
+
TeamsAppsClient._getTeamsAppComponentManifestsPromise = this._msGraphClient
|
|
47
|
+
.then(function (client) {
|
|
48
|
+
return client
|
|
49
|
+
.api("".concat(MS_GRAPH_TEAMS_APPS_ENDPOINT, "?").concat(MS_GRAPH_FETCH_TEAMS_APPS_QSP))
|
|
50
|
+
.version(MS_GRAPH_API_VERSION)
|
|
51
|
+
.get();
|
|
52
|
+
})
|
|
53
|
+
.then(function (response) {
|
|
54
|
+
var manifestsPromises = response.value.map(function (item) {
|
|
55
|
+
return _this._teamsAppCatalogItemToAceManifests(item);
|
|
56
|
+
});
|
|
57
|
+
return Promise.all(manifestsPromises).then(function (manifests) {
|
|
58
|
+
var flatManifests = [];
|
|
59
|
+
manifests.forEach(function (item) {
|
|
60
|
+
flatManifests.push.apply(flatManifests, item);
|
|
61
|
+
});
|
|
62
|
+
monitor_1.writeSuccess();
|
|
63
|
+
return flatManifests;
|
|
64
|
+
});
|
|
65
|
+
})
|
|
66
|
+
.catch(function (error) {
|
|
67
|
+
monitor_1.writeUnexpectedFailure(undefined, error);
|
|
68
|
+
// removing reference to the promise to allow retry
|
|
69
|
+
TeamsAppsClient._getTeamsAppComponentManifestsPromise = undefined;
|
|
70
|
+
return [];
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return TeamsAppsClient._getTeamsAppComponentManifestsPromise;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Syncs the Teams App component into SharePoint App Catalog.
|
|
78
|
+
*/
|
|
79
|
+
TeamsAppsClient.prototype.syncComponent = function (teamsAppComponentManifest) {
|
|
80
|
+
var _this = this;
|
|
81
|
+
var _a;
|
|
82
|
+
var manifest = teamsAppComponentManifest;
|
|
83
|
+
if (!isBotAcesFromTeamsEnabled() || !manifest.isPendingTeamsAppSync) {
|
|
84
|
+
return Promise.resolve(teamsAppComponentManifest);
|
|
85
|
+
}
|
|
86
|
+
var monitor = new _QosMonitor('TeamsAppsClient.SyncComponent');
|
|
87
|
+
if (!((_a = teamsAppComponentManifest.properties) === null || _a === void 0 ? void 0 : _a.teamsAppComponent)) {
|
|
88
|
+
monitor.writeExpectedFailure('TeamsAppComponentMissing');
|
|
89
|
+
return new Promise(function () {
|
|
90
|
+
throw new Error('Teams App component manifest is missing teamsAppComponent property');
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var spHttpClient = this._serviceScope.consume(SPHttpClient.serviceKey);
|
|
94
|
+
var pageContext = this._serviceScope.consume(PageContext.serviceKey);
|
|
95
|
+
var baseRequestUrl = pageContext.web.absoluteUrl;
|
|
96
|
+
var monitorFailureTagNameSuffix = undefined;
|
|
97
|
+
var ensureAppCatalogPromise = TeamsAppsClient._ensureAppCatalogPromise;
|
|
98
|
+
if (!TeamsAppsClient._ensureAppCatalogPromise) {
|
|
99
|
+
// first step is to ensure app catalog
|
|
100
|
+
var ensureAppCatalogRequestUrl = "".concat(baseRequestUrl, "/_api/web/EnsureTenantAppCatalog(callerId='TeamsAppsClient')");
|
|
101
|
+
ensureAppCatalogPromise = TeamsAppsClient._ensureAppCatalogPromise = spHttpClient
|
|
102
|
+
.post(ensureAppCatalogRequestUrl, SPHttpClient.configurations.v1, {})
|
|
103
|
+
.then(function (response) {
|
|
104
|
+
return response.json();
|
|
105
|
+
})
|
|
106
|
+
.then(function (response) {
|
|
107
|
+
if (response.error) {
|
|
108
|
+
throw new Error(response.error.message);
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
.catch(function (error) {
|
|
112
|
+
// app catalog error
|
|
113
|
+
monitorFailureTagNameSuffix = 'EnsureAppCatalogFailed';
|
|
114
|
+
// we want to retry if needed
|
|
115
|
+
TeamsAppsClient._ensureAppCatalogPromise = undefined;
|
|
116
|
+
throw error;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return ensureAppCatalogPromise
|
|
120
|
+
.then(function () {
|
|
121
|
+
var syncRequestUrl = "".concat(baseRequestUrl, "/_api/web/SyncTeamsComponent");
|
|
122
|
+
var teamsAppComponent = teamsAppComponentManifest.properties.teamsAppComponent;
|
|
123
|
+
return spHttpClient
|
|
124
|
+
.post(syncRequestUrl, SPHttpClient.configurations.v1, {
|
|
125
|
+
body: JSON.stringify({
|
|
126
|
+
teamsComponent: teamsAppComponent
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
.catch(function (error) {
|
|
130
|
+
// sync error
|
|
131
|
+
monitorFailureTagNameSuffix = 'SyncComponentFailed';
|
|
132
|
+
throw error;
|
|
133
|
+
});
|
|
134
|
+
})
|
|
135
|
+
.then(function (response) {
|
|
136
|
+
return response.json();
|
|
137
|
+
})
|
|
138
|
+
.then(function (syncedManifest) {
|
|
139
|
+
if (syncedManifest.error) {
|
|
140
|
+
monitorFailureTagNameSuffix = 'SyncComponentFailed';
|
|
141
|
+
throw new Error(syncedManifest.error.message);
|
|
142
|
+
}
|
|
143
|
+
var manifestResponse = syncedManifest;
|
|
144
|
+
var parsedManifest = JSON.parse(manifestResponse.Manifest);
|
|
145
|
+
if (manifestResponse.ManifestActivatedTime) {
|
|
146
|
+
parsedManifest.manifestActivatedTime = manifestResponse.ManifestActivatedTime;
|
|
147
|
+
}
|
|
148
|
+
monitor.writeSuccess();
|
|
149
|
+
var appId = teamsAppComponentManifest.properties.teamsAppComponent.appId;
|
|
150
|
+
// we know for sure the component is allowed
|
|
151
|
+
_this._appComponentsPermissionsPromises.set(appId, Promise.resolve(new Set([appId])));
|
|
152
|
+
return parsedManifest;
|
|
153
|
+
})
|
|
154
|
+
.catch(function (error) {
|
|
155
|
+
monitor.writeUnexpectedFailure(monitorFailureTagNameSuffix, error);
|
|
156
|
+
throw error;
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Requests permissions for the Teams App components (apps) for the current user.
|
|
161
|
+
*/
|
|
162
|
+
TeamsAppsClient.prototype.requestPermissions = function (teamsAppComponentIds) {
|
|
163
|
+
if (!isBotAcesFromTeamsEnabled() || !teamsAppComponentIds.length) {
|
|
164
|
+
return Promise.resolve();
|
|
165
|
+
}
|
|
166
|
+
return this._requestAppsPermissions(teamsAppComponentIds).then(function () { });
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Checks if the component is enabled for the current user based on requested Teams permissions.
|
|
170
|
+
*/
|
|
171
|
+
TeamsAppsClient.prototype.isComponentEnabled = function (teamsAppId) {
|
|
172
|
+
if (!isBotAcesFromTeamsEnabled()) {
|
|
173
|
+
return Promise.resolve(true);
|
|
174
|
+
}
|
|
175
|
+
if (this._appComponentsPermissionsPromises.has(teamsAppId)) {
|
|
176
|
+
return this._appComponentsPermissionsPromises.get(teamsAppId).then(function (allowedApps) {
|
|
177
|
+
return allowedApps.has(teamsAppId) || false;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
return this._requestAppsPermissions([{ appId: teamsAppId, componentId: '' }]).then(function (allowedComponents) {
|
|
182
|
+
return allowedComponents.has(teamsAppId) || false;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
TeamsAppsClient.prototype._requestAppsPermissions = function (teamsAppComponentIds) {
|
|
187
|
+
var _this = this;
|
|
188
|
+
// getting app ids for which we don't have a promise yet
|
|
189
|
+
var uniqueAppIds = uniq(teamsAppComponentIds.map(function (item) { return item.appId; })).filter(function (appId) { return !_this._appComponentsPermissionsPromises.has(appId); });
|
|
190
|
+
var requestPermissionsPromise;
|
|
191
|
+
if (uniqueAppIds.length > MAX_IDS_WITHOUT_BATCHING) {
|
|
192
|
+
requestPermissionsPromise = this._requestAppsPermissionsBatched(uniqueAppIds);
|
|
193
|
+
}
|
|
194
|
+
if (!requestPermissionsPromise) {
|
|
195
|
+
var monitor_2 = new _QosMonitor('TeamsAppsClient.RequestAppsPermissions');
|
|
196
|
+
requestPermissionsPromise = this._msGraphClient
|
|
197
|
+
.then(function (client) {
|
|
198
|
+
return client.api(_this._getCheckPermissionsUrl(uniqueAppIds)).version(MS_GRAPH_API_VERSION).get();
|
|
199
|
+
})
|
|
200
|
+
.then(function (response) {
|
|
201
|
+
if (response.error) {
|
|
202
|
+
monitor_2.writeUnexpectedFailure('RequestFailed', new Error(response.error.message));
|
|
203
|
+
return new Set();
|
|
204
|
+
}
|
|
205
|
+
var allowedApps = new Set();
|
|
206
|
+
response.value.map(function (item) {
|
|
207
|
+
allowedApps.add(item.id);
|
|
208
|
+
});
|
|
209
|
+
monitor_2.writeSuccess();
|
|
210
|
+
return allowedApps;
|
|
211
|
+
})
|
|
212
|
+
.catch(function (error) {
|
|
213
|
+
monitor_2.writeUnexpectedFailure(undefined, error);
|
|
214
|
+
return new Set();
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
// store the promise to avoid multiple requests to the API for the same teamsAppId
|
|
218
|
+
uniqueAppIds.forEach(function (teamsAppId) {
|
|
219
|
+
_this._appComponentsPermissionsPromises.set(teamsAppId, requestPermissionsPromise);
|
|
220
|
+
});
|
|
221
|
+
return requestPermissionsPromise;
|
|
222
|
+
};
|
|
223
|
+
TeamsAppsClient.prototype._requestAppsPermissionsBatched = function (appIds) {
|
|
224
|
+
var monitor = new _QosMonitor('TeamsAppsClient.RequestAppsPermissionsBatched');
|
|
225
|
+
var allowedApps = new Set();
|
|
226
|
+
//
|
|
227
|
+
// MS Graph batch body is like that:
|
|
228
|
+
// {
|
|
229
|
+
// "requests": [
|
|
230
|
+
// {
|
|
231
|
+
// "id": "1",
|
|
232
|
+
// "method": "GET",
|
|
233
|
+
// "url": "our-permissions-url"
|
|
234
|
+
// },
|
|
235
|
+
// {
|
|
236
|
+
// etc.
|
|
237
|
+
// }
|
|
238
|
+
// ]
|
|
239
|
+
// }
|
|
240
|
+
// We need to split the list of app ids to have no more than 10 requests per batch and no more than 30 ids per request
|
|
241
|
+
//
|
|
242
|
+
// we can have MAX_IDS_WITHOUT_BATCHING per one request in batch. And up to MAX_REQUESTS_PER_BATCH requests in batch.
|
|
243
|
+
var maxIdsPerBatch = MAX_IDS_WITHOUT_BATCHING * MAX_REQUESTS_PER_BATCH;
|
|
244
|
+
var batchesCount = Math.ceil(appIds.length / maxIdsPerBatch);
|
|
245
|
+
var batchIndex = 0;
|
|
246
|
+
var batchRequests = [];
|
|
247
|
+
try {
|
|
248
|
+
while (batchIndex < batchesCount) {
|
|
249
|
+
var batchBody = {
|
|
250
|
+
requests: []
|
|
251
|
+
};
|
|
252
|
+
var batchStartIndex = batchIndex * maxIdsPerBatch;
|
|
253
|
+
var batchEndIndex = Math.min(batchStartIndex + maxIdsPerBatch, appIds.length);
|
|
254
|
+
var batchIdStartIndex = batchStartIndex;
|
|
255
|
+
while (batchIdStartIndex < batchEndIndex) {
|
|
256
|
+
var batchIdEndIndex = batchIdStartIndex + MAX_IDS_WITHOUT_BATCHING;
|
|
257
|
+
var batchIds = appIds.slice(batchIdStartIndex, batchIdEndIndex);
|
|
258
|
+
batchBody.requests.push({
|
|
259
|
+
id: batchIdStartIndex.toString(),
|
|
260
|
+
method: 'GET',
|
|
261
|
+
url: this._getCheckPermissionsUrl(batchIds)
|
|
262
|
+
});
|
|
263
|
+
batchIdStartIndex = batchIdEndIndex;
|
|
264
|
+
}
|
|
265
|
+
batchRequests.push(batchBody);
|
|
266
|
+
batchIndex++;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
monitor.writeUnexpectedFailure('BatchSplitLogicError', error);
|
|
271
|
+
// Early return to avoid the request
|
|
272
|
+
return Promise.resolve(allowedApps);
|
|
273
|
+
}
|
|
274
|
+
var errors = [];
|
|
275
|
+
return this._msGraphClient
|
|
276
|
+
.then(function (client) {
|
|
277
|
+
var batchPromises = batchRequests.map(function (batchBody) {
|
|
278
|
+
return client
|
|
279
|
+
.api('$batch')
|
|
280
|
+
.version(MS_GRAPH_API_VERSION)
|
|
281
|
+
.post(batchBody)
|
|
282
|
+
.then(function (response) {
|
|
283
|
+
response.responses.forEach(function (responseItem) {
|
|
284
|
+
if (responseItem.status !== 200) {
|
|
285
|
+
errors.push(new Error(responseItem.body.error.message));
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
responseItem.body.value.map(function (app) {
|
|
289
|
+
allowedApps.add(app.id);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
})
|
|
293
|
+
.catch(function (error) {
|
|
294
|
+
errors.push(error);
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
return Promise.all(batchPromises);
|
|
298
|
+
})
|
|
299
|
+
.then(function () {
|
|
300
|
+
// some batches failed
|
|
301
|
+
if (errors.length) {
|
|
302
|
+
monitor.writeUnexpectedFailure('SomeBatchRequestsError', undefined, {
|
|
303
|
+
errors: errors
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
return allowedApps;
|
|
307
|
+
})
|
|
308
|
+
.catch(function (error) {
|
|
309
|
+
// all batches failed
|
|
310
|
+
monitor.writeUnexpectedFailure('BatchRequestError', error);
|
|
311
|
+
return new Set();
|
|
312
|
+
});
|
|
313
|
+
};
|
|
314
|
+
TeamsAppsClient.prototype._getCheckPermissionsUrl = function (appIds) {
|
|
315
|
+
return "".concat(MS_GRAPH_TEAMS_APPS_ENDPOINT, "?").concat(MS_GRAPH_CHECK_PERMISSIONS_QSP.replace('{appIds}', appIds.join("','")));
|
|
316
|
+
};
|
|
317
|
+
Object.defineProperty(TeamsAppsClient.prototype, "_msGraphClient", {
|
|
318
|
+
get: function () {
|
|
319
|
+
if (!this._msGraphClientFactory) {
|
|
320
|
+
this._msGraphClientFactory = this._serviceScope.consume(MSGraphClientFactory.serviceKey);
|
|
321
|
+
}
|
|
322
|
+
if (!this._msGraphClientDeferred) {
|
|
323
|
+
this._msGraphClientDeferred = this._msGraphClientFactory.getClientInternal('3');
|
|
324
|
+
}
|
|
325
|
+
return this._msGraphClientDeferred;
|
|
326
|
+
},
|
|
327
|
+
enumerable: false,
|
|
328
|
+
configurable: true
|
|
329
|
+
});
|
|
330
|
+
TeamsAppsClient.prototype._teamsAppCatalogItemToAceManifests = function (item) {
|
|
331
|
+
var _this = this;
|
|
332
|
+
var _a;
|
|
333
|
+
//
|
|
334
|
+
// collect components that use Teams App icon instead of having its own
|
|
335
|
+
// if there are such components, we will need to fetch the app icon
|
|
336
|
+
//
|
|
337
|
+
var iconPromise;
|
|
338
|
+
var colorIconWebUrl = (_a = item.appDefinitions[0].colorIcon) === null || _a === void 0 ? void 0 : _a.webUrl;
|
|
339
|
+
var manifestsWithoutIcon = [];
|
|
340
|
+
var dashboardCards = item.appDefinitions[0].dashboardCards || [];
|
|
341
|
+
var manifests = [];
|
|
342
|
+
dashboardCards.forEach(function (dashboardCard) {
|
|
343
|
+
var _a, _b;
|
|
344
|
+
var component = {
|
|
345
|
+
appId: item.id,
|
|
346
|
+
externalAppId: item.externalId || undefined,
|
|
347
|
+
componentId: dashboardCard.id,
|
|
348
|
+
groupId: ADVANCED_TOOLBOX_GROUP_ID, // Advanced group. If we decide to use the id from the app definition - we should use dashboardCard.pickerGroupId
|
|
349
|
+
iconUrl: (_a = dashboardCard.icon) === null || _a === void 0 ? void 0 : _a.iconUrl,
|
|
350
|
+
officeUIFabricIconName: (_b = dashboardCard.icon) === null || _b === void 0 ? void 0 : _b.officeUIFabricIconName,
|
|
351
|
+
description: dashboardCard.description,
|
|
352
|
+
name: dashboardCard.displayName,
|
|
353
|
+
botId: dashboardCard.contentSource.botConfiguration.botId,
|
|
354
|
+
appName: item.displayName,
|
|
355
|
+
appDescription: item.appDefinitions[0].description,
|
|
356
|
+
version: item.appDefinitions[0].version,
|
|
357
|
+
// size is lower case in the manifest
|
|
358
|
+
defaultSize: "".concat(dashboardCard.defaultSize.charAt(0).toUpperCase()).concat(dashboardCard.defaultSize.slice(1))
|
|
359
|
+
};
|
|
360
|
+
var manifest = _this._teamsAppComponentToAceManifest(component);
|
|
361
|
+
manifests.push(manifest);
|
|
362
|
+
if (!component.iconUrl && !component.officeUIFabricIconName) {
|
|
363
|
+
manifestsWithoutIcon.push(manifest);
|
|
364
|
+
if (!iconPromise && colorIconWebUrl)
|
|
365
|
+
iconPromise = _this._msGraphClient.then(function (client) {
|
|
366
|
+
return client
|
|
367
|
+
.api(colorIconWebUrl)
|
|
368
|
+
.responseType('blob')
|
|
369
|
+
.get();
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
var resultPromise = Promise.resolve(manifests);
|
|
374
|
+
if (manifestsWithoutIcon.length && iconPromise) {
|
|
375
|
+
resultPromise = iconPromise
|
|
376
|
+
.then(function (response) {
|
|
377
|
+
return _this._convertBlobToBase64(response);
|
|
378
|
+
})
|
|
379
|
+
.then(function (iconUrl) {
|
|
380
|
+
manifestsWithoutIcon.forEach(function (manifest) {
|
|
381
|
+
manifest.preconfiguredEntries[0].iconImageUrl = iconUrl;
|
|
382
|
+
manifest.properties.teamsAppComponent.iconUrl = iconUrl;
|
|
383
|
+
});
|
|
384
|
+
return manifests;
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
return resultPromise;
|
|
388
|
+
};
|
|
389
|
+
TeamsAppsClient.prototype._convertBlobToBase64 = function (blob) {
|
|
390
|
+
return new Promise(function (resolve, reject) {
|
|
391
|
+
var reader = new FileReader();
|
|
392
|
+
reader.onerror = reject;
|
|
393
|
+
reader.onload = function () {
|
|
394
|
+
var base64String = reader.result;
|
|
395
|
+
if (!base64String) {
|
|
396
|
+
reject('');
|
|
397
|
+
}
|
|
398
|
+
resolve(base64String.substr(base64String.indexOf(', ') + 1));
|
|
399
|
+
};
|
|
400
|
+
reader.readAsDataURL(blob);
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
TeamsAppsClient.prototype._teamsAppComponentToAceManifest = function (component) {
|
|
404
|
+
return {
|
|
405
|
+
id: component.componentId,
|
|
406
|
+
manifestVersion: MANIFEST_VERSION,
|
|
407
|
+
version: component.version,
|
|
408
|
+
componentType: 'AdaptiveCardExtension',
|
|
409
|
+
alias: component.componentId,
|
|
410
|
+
properties: {
|
|
411
|
+
teamsAppComponent: component
|
|
412
|
+
},
|
|
413
|
+
loaderConfig: {
|
|
414
|
+
entryModuleId: component.componentId,
|
|
415
|
+
internalModuleBaseUrls: ['HTTPS://CLIENTSIDEASSETSLIBRARY/'],
|
|
416
|
+
scriptResources: {}
|
|
417
|
+
},
|
|
418
|
+
preconfiguredEntries: [
|
|
419
|
+
{
|
|
420
|
+
cardSize: component.defaultSize,
|
|
421
|
+
title: {
|
|
422
|
+
default: component.name
|
|
423
|
+
},
|
|
424
|
+
description: {
|
|
425
|
+
default: component.description
|
|
426
|
+
},
|
|
427
|
+
iconImageUrl: component.iconUrl,
|
|
428
|
+
officeFabricIconFontName: component.officeUIFabricIconName,
|
|
429
|
+
groupId: component.groupId,
|
|
430
|
+
properties: {}
|
|
431
|
+
}
|
|
432
|
+
],
|
|
433
|
+
connectedTeamsAppId: component.appId,
|
|
434
|
+
isPendingTeamsAppSync: true
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
return TeamsAppsClient;
|
|
438
|
+
}());
|
|
439
|
+
export { TeamsAppsClient };
|
|
440
|
+
//# sourceMappingURL=TeamsAppsClient.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseComponent from '../BaseComponent';
|
|
2
|
+
import type { IDynamicDataCallables } from '@microsoft/sp-dynamic-data';
|
|
3
|
+
import type { ServiceScope } from '@microsoft/sp-core-library';
|
|
4
|
+
export declare class MockComponent extends BaseComponent {
|
|
5
|
+
mockIDynamicData: IDynamicDataCallables;
|
|
6
|
+
constructor(mockScope: ServiceScope);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=MockComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockComponent.d.ts","sourceRoot":"","sources":["../../src/test-api/MockComponent.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D,qBAAa,aAAc,SAAQ,aAAa;IACvC,gBAAgB,EAAE,qBAAqB,CAgB5C;gBAEiB,SAAS,EAAE,YAAY;CAI3C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import BaseComponent from '../BaseComponent';
|
|
3
|
+
import { MockComponentContext } from './MockComponentContext';
|
|
4
|
+
var MockComponent = /** @class */ (function (_super) {
|
|
5
|
+
__extends(MockComponent, _super);
|
|
6
|
+
function MockComponent(mockScope) {
|
|
7
|
+
var _this = _super.call(this) || this;
|
|
8
|
+
_this.mockIDynamicData = {
|
|
9
|
+
getPropertyDefinitions: function () {
|
|
10
|
+
return [
|
|
11
|
+
{ id: 'test1', title: 'Test One' },
|
|
12
|
+
{ id: 'test2', title: 'Test Two' },
|
|
13
|
+
{ id: 'test3', title: 'Test Three' }
|
|
14
|
+
];
|
|
15
|
+
},
|
|
16
|
+
getPropertyValue: function () {
|
|
17
|
+
return { 'mock-key': 'mock-value' };
|
|
18
|
+
},
|
|
19
|
+
getAnnotatedPropertyValue: function () {
|
|
20
|
+
return {
|
|
21
|
+
sampleValue: {}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
_this._initializeContext(new MockComponentContext(mockScope));
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
return MockComponent;
|
|
29
|
+
}(BaseComponent));
|
|
30
|
+
export { MockComponent };
|
|
31
|
+
//# sourceMappingURL=MockComponent.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ServiceScope } from '@microsoft/sp-core-library';
|
|
2
|
+
import BaseComponentContext from '../BaseComponentContext';
|
|
3
|
+
export declare class MockComponentContext extends BaseComponentContext {
|
|
4
|
+
constructor(mockRootScope: ServiceScope);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=MockComponentContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockComponentContext.d.ts","sourceRoot":"","sources":["../../src/test-api/MockComponentContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,qBAAa,oBAAqB,SAAQ,oBAAoB;gBACzC,aAAa,EAAE,YAAY;CAmB/C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import BaseComponentContext from '../BaseComponentContext';
|
|
3
|
+
var MockComponentContext = /** @class */ (function (_super) {
|
|
4
|
+
__extends(MockComponentContext, _super);
|
|
5
|
+
function MockComponentContext(mockRootScope) {
|
|
6
|
+
return _super.call(this, {
|
|
7
|
+
parentServiceScope: mockRootScope,
|
|
8
|
+
manifest: {
|
|
9
|
+
componentType: 'Application',
|
|
10
|
+
alias: 'alias',
|
|
11
|
+
version: '1.0',
|
|
12
|
+
loaderConfig: {
|
|
13
|
+
internalModuleBaseUrls: ['mock info'],
|
|
14
|
+
entryModuleId: 'eId',
|
|
15
|
+
scriptResources: {}
|
|
16
|
+
},
|
|
17
|
+
manifestVersion: 1,
|
|
18
|
+
id: '79820548-6e95-4fa8-80a0-b366e6725f71'
|
|
19
|
+
},
|
|
20
|
+
loggingTag: 'logtag',
|
|
21
|
+
instanceId: 'iId'
|
|
22
|
+
}) || this;
|
|
23
|
+
}
|
|
24
|
+
return MockComponentContext;
|
|
25
|
+
}(BaseComponentContext));
|
|
26
|
+
export { MockComponentContext };
|
|
27
|
+
//# sourceMappingURL=MockComponentContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|