@microsoft/teams-js 2.0.0-beta.3-dev.58 → 2.0.0-beta.3-dev.62

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
  /**
@@ -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.58";
1123
+ var version = "2.0.0-beta.3-dev.62";
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) {
@@ -4074,11 +4078,6 @@ var bot;
4074
4078
  });
4075
4079
  }
4076
4080
  bot.authenticate = authenticate;
4077
- var ResponseType;
4078
- (function (ResponseType) {
4079
- ResponseType["Results"] = "Results";
4080
- ResponseType["Auth"] = "Auth";
4081
- })(ResponseType = bot.ResponseType || (bot.ResponseType = {}));
4082
4081
  function isSupported() {
4083
4082
  return runtime.supports.bot ? true : false;
4084
4083
  }