@microsoft/teams-js 2.0.0-beta.3-dev.57 → 2.0.0-beta.3-dev.61

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.
@@ -17,7 +17,7 @@ export namespace bot {
17
17
  * @param onSuccess - callback to invoke when data is retrieved from bot
18
18
  * @param onError - callback to invoke should an error occur
19
19
  */
20
- function sendQuery(botRequest: QueryRequest, onSuccess?: (data: QueryResponse) => void, onError?: (error: string) => void): void;
20
+ export function sendQuery(botRequest: QueryRequest, onSuccess?: (data: QueryResponse) => void, onError?: (error: string) => void): void;
21
21
  /**
22
22
  * @hidden
23
23
  * Hide from docs until release.
@@ -27,7 +27,7 @@ export namespace bot {
27
27
  * @param onSuccess - callback to invoke when data is retrieved from bot
28
28
  * @param onError - callback to invoke should an error occur
29
29
  */
30
- function getSupportedCommands(onSuccess?: (response: Command[]) => void, onError?: (error: string) => void): void;
30
+ export function getSupportedCommands(onSuccess?: (response: Command[]) => void, onError?: (error: string) => void): void;
31
31
  /**
32
32
  * @hidden
33
33
  * Hide from docs until release.
@@ -38,8 +38,8 @@ export namespace bot {
38
38
  * @param onSuccess - callback to invoke when user is authenticated
39
39
  * @param onError - callback to invoke should an error occur
40
40
  */
41
- function authenticate(authRequest: AuthQueryRequest, onSuccess?: (results: Results) => void, onError?: (error: string) => void): void;
42
- interface QueryRequest {
41
+ export function authenticate(authRequest: AuthQueryRequest, onSuccess?: (results: Results) => void, onError?: (error: string) => void): void;
42
+ export interface QueryRequest {
43
43
  /**
44
44
  * @hidden
45
45
  * Query to search for
@@ -51,38 +51,42 @@ export namespace bot {
51
51
  count: number;
52
52
  };
53
53
  }
54
- interface QueryResponse {
55
- data: Results | Auth;
56
- type: ResponseType;
57
- }
58
- interface Results {
54
+ export interface Results {
59
55
  attachments: Attachment[];
60
56
  layout: any;
61
57
  botId: string;
62
58
  }
63
- interface Auth {
59
+ export interface Auth {
64
60
  url: string;
65
61
  title: string;
66
62
  }
67
- interface AuthQueryRequest extends QueryRequest {
63
+ export type ResponseType = 'Results' | 'Auth';
64
+ interface Response<T extends ResponseType> {
65
+ type: T;
66
+ }
67
+ export interface ResultResponse extends Response<'Results'> {
68
+ data: Results;
69
+ }
70
+ export interface AuthResponse extends Response<'Auth'> {
71
+ data: Auth;
72
+ }
73
+ export type QueryResponse = ResultResponse | AuthResponse;
74
+ export interface AuthQueryRequest extends QueryRequest {
68
75
  url: string;
69
76
  }
70
- interface Attachment {
77
+ export interface Attachment {
71
78
  card: any;
72
79
  previewCard: any;
73
80
  previewRawPayload: any;
74
81
  rawPayload: any;
75
82
  }
76
- interface Command {
83
+ export interface Command {
77
84
  title: string;
78
85
  id: string;
79
86
  initialRun: boolean;
80
87
  }
81
- enum ResponseType {
82
- Results = "Results",
83
- Auth = "Auth"
84
- }
85
- function isSupported(): boolean;
88
+ export function isSupported(): boolean;
89
+ export {};
86
90
  }
87
91
 
88
92
  /**
@@ -2172,6 +2176,16 @@ export interface Context {
2172
2176
  * Teamsite ID, aka sharepoint site id.
2173
2177
  */
2174
2178
  teamSiteId?: string;
2179
+ /**
2180
+ * @hidden
2181
+ * The SharePoint my site domain associated with the user.
2182
+ */
2183
+ mySiteDomain?: string;
2184
+ /**
2185
+ * @hidden
2186
+ * The SharePoint relative path to the current users mysite
2187
+ */
2188
+ mySitePath?: string;
2175
2189
  }
2176
2190
  export interface DeepLinkParameters {
2177
2191
  /**
@@ -2667,19 +2681,27 @@ export namespace app {
2667
2681
  /**
2668
2682
  * The root SharePoint site associated with the team.
2669
2683
  */
2670
- url?: string;
2684
+ teamSiteUrl?: string;
2671
2685
  /**
2672
2686
  * The domain of the root SharePoint site associated with the team.
2673
2687
  */
2674
- domain?: string;
2688
+ teamSiteDomain?: string;
2675
2689
  /**
2676
2690
  * The relative path to the SharePoint site associated with the team.
2677
2691
  */
2678
- path?: string;
2692
+ teamSitePath?: string;
2679
2693
  /**
2680
2694
  * Teamsite ID, aka sharepoint site id.
2681
2695
  */
2682
- id?: string;
2696
+ teamSiteId?: string;
2697
+ /**
2698
+ * The SharePoint my site domain associated with the user.
2699
+ */
2700
+ mySiteDomain?: string;
2701
+ /**
2702
+ * The SharePoint relative path to the current users mysite
2703
+ */
2704
+ mySitePath?: string;
2683
2705
  }
2684
2706
  /**
2685
2707
  * Represents structure of the context message received
@@ -1120,7 +1120,7 @@ __webpack_require__.d(__webpack_exports__, {
1120
1120
  });
1121
1121
 
1122
1122
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1123
- var version = "2.0.0-beta.3-dev.57";
1123
+ var version = "2.0.0-beta.3-dev.61";
1124
1124
  /**
1125
1125
  * @hidden
1126
1126
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -2729,6 +2729,10 @@ var app_app;
2729
2729
  // After Teams updates its client code, we can remove this default code.
2730
2730
  try {
2731
2731
  var givenRuntimeConfig = JSON.parse(runtimeConfig);
2732
+ // Check that givenRuntimeConfig is a valid instance of IRuntimeConfig
2733
+ if (!givenRuntimeConfig || !givenRuntimeConfig.apiVersion) {
2734
+ throw new Error('Received runtime config is invalid');
2735
+ }
2732
2736
  runtimeConfig && applyRuntimeConfig(givenRuntimeConfig);
2733
2737
  }
2734
2738
  catch (e) {
@@ -2974,12 +2978,18 @@ function transformLegacyContextToAppContext(legacyContext) {
2974
2978
  userRole: legacyContext.userTeamRole,
2975
2979
  }
2976
2980
  : undefined,
2977
- sharePointSite: legacyContext.teamSiteUrl || legacyContext.teamSiteDomain || legacyContext.teamSitePath
2981
+ sharePointSite: legacyContext.teamSiteUrl ||
2982
+ legacyContext.teamSiteDomain ||
2983
+ legacyContext.teamSitePath ||
2984
+ legacyContext.mySitePath ||
2985
+ legacyContext.mySiteDomain
2978
2986
  ? {
2979
- url: legacyContext.teamSiteUrl,
2980
- domain: legacyContext.teamSiteDomain,
2981
- path: legacyContext.teamSitePath,
2982
- id: legacyContext.teamSiteId,
2987
+ teamSiteUrl: legacyContext.teamSiteUrl,
2988
+ teamSiteDomain: legacyContext.teamSiteDomain,
2989
+ teamSitePath: legacyContext.teamSitePath,
2990
+ teamSiteId: legacyContext.teamSiteId,
2991
+ mySitePath: legacyContext.mySitePath,
2992
+ mySiteDomain: legacyContext.mySiteDomain,
2983
2993
  }
2984
2994
  : undefined,
2985
2995
  };
@@ -4068,11 +4078,6 @@ var bot;
4068
4078
  });
4069
4079
  }
4070
4080
  bot.authenticate = authenticate;
4071
- var ResponseType;
4072
- (function (ResponseType) {
4073
- ResponseType["Results"] = "Results";
4074
- ResponseType["Auth"] = "Auth";
4075
- })(ResponseType = bot.ResponseType || (bot.ResponseType = {}));
4076
4081
  function isSupported() {
4077
4082
  return runtime.supports.bot ? true : false;
4078
4083
  }
@@ -6102,10 +6107,12 @@ function transformAppContextToLegacyContext(appContext) {
6102
6107
  isTeamArchived: appContext.team !== undefined ? appContext.team.isArchived : undefined,
6103
6108
  userTeamRole: appContext.team !== undefined ? appContext.team.userRole : undefined,
6104
6109
  // sharepointSite
6105
- teamSiteUrl: appContext.sharePointSite !== undefined ? appContext.sharePointSite.url : undefined,
6106
- teamSiteDomain: appContext.sharePointSite !== undefined ? appContext.sharePointSite.domain : undefined,
6107
- teamSitePath: appContext.sharePointSite !== undefined ? appContext.sharePointSite.path : undefined,
6108
- teamSiteId: appContext.sharePointSite !== undefined ? appContext.sharePointSite.id : undefined,
6110
+ teamSiteUrl: appContext.sharePointSite !== undefined ? appContext.sharePointSite.teamSiteUrl : undefined,
6111
+ teamSiteDomain: appContext.sharePointSite !== undefined ? appContext.sharePointSite.teamSiteDomain : undefined,
6112
+ teamSitePath: appContext.sharePointSite !== undefined ? appContext.sharePointSite.teamSitePath : undefined,
6113
+ teamSiteId: appContext.sharePointSite !== undefined ? appContext.sharePointSite.teamSiteId : undefined,
6114
+ mySitePath: appContext.sharePointSite !== undefined ? appContext.sharePointSite.mySitePath : undefined,
6115
+ mySiteDomain: appContext.sharePointSite !== undefined ? appContext.sharePointSite.mySiteDomain : undefined,
6109
6116
  };
6110
6117
  return context;
6111
6118
  }