@microsoft/teams-js 1.10.1-dev.0

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.
@@ -0,0 +1,4044 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define("microsoftTeams", [], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["microsoftTeams"] = factory();
8
+ else
9
+ root["microsoftTeams"] = factory();
10
+ })(window, function() {
11
+ return /******/ (function(modules) { // webpackBootstrap
12
+ /******/ // The module cache
13
+ /******/ var installedModules = {};
14
+ /******/
15
+ /******/ // The require function
16
+ /******/ function __webpack_require__(moduleId) {
17
+ /******/
18
+ /******/ // Check if module is in cache
19
+ /******/ if(installedModules[moduleId]) {
20
+ /******/ return installedModules[moduleId].exports;
21
+ /******/ }
22
+ /******/ // Create a new module (and put it into the cache)
23
+ /******/ var module = installedModules[moduleId] = {
24
+ /******/ i: moduleId,
25
+ /******/ l: false,
26
+ /******/ exports: {}
27
+ /******/ };
28
+ /******/
29
+ /******/ // Execute the module function
30
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
+ /******/
32
+ /******/ // Flag the module as loaded
33
+ /******/ module.l = true;
34
+ /******/
35
+ /******/ // Return the exports of the module
36
+ /******/ return module.exports;
37
+ /******/ }
38
+ /******/
39
+ /******/
40
+ /******/ // expose the modules object (__webpack_modules__)
41
+ /******/ __webpack_require__.m = modules;
42
+ /******/
43
+ /******/ // expose the module cache
44
+ /******/ __webpack_require__.c = installedModules;
45
+ /******/
46
+ /******/ // define getter function for harmony exports
47
+ /******/ __webpack_require__.d = function(exports, name, getter) {
48
+ /******/ if(!__webpack_require__.o(exports, name)) {
49
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
+ /******/ }
51
+ /******/ };
52
+ /******/
53
+ /******/ // define __esModule on exports
54
+ /******/ __webpack_require__.r = function(exports) {
55
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
+ /******/ }
58
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
+ /******/ };
60
+ /******/
61
+ /******/ // create a fake namespace object
62
+ /******/ // mode & 1: value is a module id, require it
63
+ /******/ // mode & 2: merge all properties of value into the ns
64
+ /******/ // mode & 4: return value when already ns object
65
+ /******/ // mode & 8|1: behave like require
66
+ /******/ __webpack_require__.t = function(value, mode) {
67
+ /******/ if(mode & 1) value = __webpack_require__(value);
68
+ /******/ if(mode & 8) return value;
69
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
+ /******/ var ns = Object.create(null);
71
+ /******/ __webpack_require__.r(ns);
72
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
+ /******/ return ns;
75
+ /******/ };
76
+ /******/
77
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
78
+ /******/ __webpack_require__.n = function(module) {
79
+ /******/ var getter = module && module.__esModule ?
80
+ /******/ function getDefault() { return module['default']; } :
81
+ /******/ function getModuleExports() { return module; };
82
+ /******/ __webpack_require__.d(getter, 'a', getter);
83
+ /******/ return getter;
84
+ /******/ };
85
+ /******/
86
+ /******/ // Object.prototype.hasOwnProperty.call
87
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
+ /******/
89
+ /******/ // __webpack_public_path__
90
+ /******/ __webpack_require__.p = "";
91
+ /******/
92
+ /******/
93
+ /******/ // Load entry module and return exports
94
+ /******/ return __webpack_require__(__webpack_require__.s = 19);
95
+ /******/ })
96
+ /************************************************************************/
97
+ /******/ ([
98
+ /* 0 */
99
+ /***/ (function(module, exports, __webpack_require__) {
100
+
101
+ "use strict";
102
+
103
+ Object.defineProperty(exports, "__esModule", { value: true });
104
+ var constants_1 = __webpack_require__(4);
105
+ var globalVars_1 = __webpack_require__(6);
106
+ var handlers_1 = __webpack_require__(3);
107
+ var Communication = /** @class */ (function () {
108
+ function Communication() {
109
+ }
110
+ return Communication;
111
+ }());
112
+ exports.Communication = Communication;
113
+ var CommunicationPrivate = /** @class */ (function () {
114
+ function CommunicationPrivate() {
115
+ }
116
+ CommunicationPrivate.parentMessageQueue = [];
117
+ CommunicationPrivate.childMessageQueue = [];
118
+ CommunicationPrivate.nextMessageId = 0;
119
+ CommunicationPrivate.callbacks = {};
120
+ return CommunicationPrivate;
121
+ }());
122
+ function initializeCommunication(callback, validMessageOrigins) {
123
+ // Listen for messages post to our window
124
+ CommunicationPrivate.messageListener = function (evt) { return processMessage(evt); };
125
+ // If we are in an iframe, our parent window is the one hosting us (i.e., window.parent); otherwise,
126
+ // it's the window that opened us (i.e., window.opener)
127
+ Communication.currentWindow = Communication.currentWindow || window;
128
+ Communication.parentWindow =
129
+ Communication.currentWindow.parent !== Communication.currentWindow.self
130
+ ? Communication.currentWindow.parent
131
+ : Communication.currentWindow.opener;
132
+ // Listen to messages from the parent or child frame.
133
+ // Frameless windows will only receive this event from child frames and if validMessageOrigins is passed.
134
+ if (Communication.parentWindow || validMessageOrigins) {
135
+ Communication.currentWindow.addEventListener('message', CommunicationPrivate.messageListener, false);
136
+ }
137
+ if (!Communication.parentWindow) {
138
+ globalVars_1.GlobalVars.isFramelessWindow = true;
139
+ // @ts-ignore: window as ExtendedWindow
140
+ window.onNativeMessage = handleParentMessage;
141
+ }
142
+ try {
143
+ // Send the initialized message to any origin, because at this point we most likely don't know the origin
144
+ // of the parent window, and this message contains no data that could pose a security risk.
145
+ Communication.parentOrigin = '*';
146
+ sendMessageToParent('initialize', [constants_1.version], callback);
147
+ }
148
+ finally {
149
+ Communication.parentOrigin = null;
150
+ }
151
+ }
152
+ exports.initializeCommunication = initializeCommunication;
153
+ function uninitializeCommunication() {
154
+ Communication.currentWindow.removeEventListener('message', CommunicationPrivate.messageListener, false);
155
+ Communication.parentWindow = null;
156
+ Communication.parentOrigin = null;
157
+ Communication.childWindow = null;
158
+ Communication.childOrigin = null;
159
+ CommunicationPrivate.parentMessageQueue = [];
160
+ CommunicationPrivate.childMessageQueue = [];
161
+ CommunicationPrivate.nextMessageId = 0;
162
+ CommunicationPrivate.callbacks = {};
163
+ }
164
+ exports.uninitializeCommunication = uninitializeCommunication;
165
+ function sendMessageToParent(actionName, argsOrCallback, callback) {
166
+ var args;
167
+ if (argsOrCallback instanceof Function) {
168
+ callback = argsOrCallback;
169
+ }
170
+ else if (argsOrCallback instanceof Array) {
171
+ args = argsOrCallback;
172
+ }
173
+ var targetWindow = Communication.parentWindow;
174
+ var request = createMessageRequest(actionName, args);
175
+ if (globalVars_1.GlobalVars.isFramelessWindow) {
176
+ if (Communication.currentWindow && Communication.currentWindow.nativeInterface) {
177
+ Communication.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(request));
178
+ }
179
+ }
180
+ else {
181
+ var targetOrigin = getTargetOrigin(targetWindow);
182
+ // If the target window isn't closed and we already know its origin, send the message right away; otherwise,
183
+ // queue the message and send it after the origin is established
184
+ if (targetWindow && targetOrigin) {
185
+ targetWindow.postMessage(request, targetOrigin);
186
+ }
187
+ else {
188
+ getTargetMessageQueue(targetWindow).push(request);
189
+ }
190
+ }
191
+ if (callback) {
192
+ CommunicationPrivate.callbacks[request.id] = callback;
193
+ }
194
+ }
195
+ exports.sendMessageToParent = sendMessageToParent;
196
+ function processMessage(evt) {
197
+ // Process only if we received a valid message
198
+ if (!evt || !evt.data || typeof evt.data !== 'object') {
199
+ return;
200
+ }
201
+ // Process only if the message is coming from a different window and a valid origin
202
+ // valid origins are either a pre-known
203
+ var messageSource = evt.source || (evt.originalEvent && evt.originalEvent.source);
204
+ var messageOrigin = evt.origin || (evt.originalEvent && evt.originalEvent.origin);
205
+ if (!shouldProcessMessage(messageSource, messageOrigin)) {
206
+ return;
207
+ }
208
+ // Update our parent and child relationships based on this message
209
+ updateRelationships(messageSource, messageOrigin);
210
+ // Handle the message
211
+ if (messageSource === Communication.parentWindow) {
212
+ handleParentMessage(evt);
213
+ }
214
+ else if (messageSource === Communication.childWindow) {
215
+ handleChildMessage(evt);
216
+ }
217
+ }
218
+ /**
219
+ * Validates the message source and origin, if it should be processed
220
+ */
221
+ function shouldProcessMessage(messageSource, messageOrigin) {
222
+ // Process if message source is a different window and if origin is either in
223
+ // Teams' pre-known whitelist or supplied as valid origin by user during initialization
224
+ if (Communication.currentWindow && messageSource === Communication.currentWindow) {
225
+ return false;
226
+ }
227
+ else if (Communication.currentWindow &&
228
+ Communication.currentWindow.location &&
229
+ messageOrigin &&
230
+ messageOrigin === Communication.currentWindow.location.origin) {
231
+ return true;
232
+ }
233
+ else if (constants_1.validOriginRegExp.test(messageOrigin.toLowerCase()) ||
234
+ (globalVars_1.GlobalVars.additionalValidOriginsRegexp &&
235
+ globalVars_1.GlobalVars.additionalValidOriginsRegexp.test(messageOrigin.toLowerCase()))) {
236
+ return true;
237
+ }
238
+ return false;
239
+ }
240
+ function updateRelationships(messageSource, messageOrigin) {
241
+ // Determine whether the source of the message is our parent or child and update our
242
+ // window and origin pointer accordingly
243
+ // For frameless windows (i.e mobile), there is no parent frame, so the message must be from the child.
244
+ if (!globalVars_1.GlobalVars.isFramelessWindow &&
245
+ (!Communication.parentWindow || Communication.parentWindow.closed || messageSource === Communication.parentWindow)) {
246
+ Communication.parentWindow = messageSource;
247
+ Communication.parentOrigin = messageOrigin;
248
+ }
249
+ else if (!Communication.childWindow ||
250
+ Communication.childWindow.closed ||
251
+ messageSource === Communication.childWindow) {
252
+ Communication.childWindow = messageSource;
253
+ Communication.childOrigin = messageOrigin;
254
+ }
255
+ // Clean up pointers to closed parent and child windows
256
+ if (Communication.parentWindow && Communication.parentWindow.closed) {
257
+ Communication.parentWindow = null;
258
+ Communication.parentOrigin = null;
259
+ }
260
+ if (Communication.childWindow && Communication.childWindow.closed) {
261
+ Communication.childWindow = null;
262
+ Communication.childOrigin = null;
263
+ }
264
+ // If we have any messages in our queue, send them now
265
+ flushMessageQueue(Communication.parentWindow);
266
+ flushMessageQueue(Communication.childWindow);
267
+ }
268
+ function handleParentMessage(evt) {
269
+ if ('id' in evt.data && typeof evt.data.id === 'number') {
270
+ // Call any associated Communication.callbacks
271
+ var message = evt.data;
272
+ var callback = CommunicationPrivate.callbacks[message.id];
273
+ if (callback) {
274
+ callback.apply(null, message.args.concat([message.isPartialResponse]));
275
+ // Remove the callback to ensure that the callback is called only once and to free up memory if response is a complete response
276
+ if (!isPartialResponse(evt)) {
277
+ delete CommunicationPrivate.callbacks[message.id];
278
+ }
279
+ }
280
+ }
281
+ else if ('func' in evt.data && typeof evt.data.func === 'string') {
282
+ // Delegate the request to the proper handler
283
+ var message = evt.data;
284
+ handlers_1.callHandler(message.func, message.args);
285
+ }
286
+ }
287
+ function isPartialResponse(evt) {
288
+ return evt.data.isPartialResponse === true;
289
+ }
290
+ function handleChildMessage(evt) {
291
+ if ('id' in evt.data && 'func' in evt.data) {
292
+ // Try to delegate the request to the proper handler, if defined
293
+ var message_1 = evt.data;
294
+ var _a = handlers_1.callHandler(message_1.func, message_1.args), called = _a[0], result = _a[1];
295
+ if (called && typeof result !== 'undefined') {
296
+ sendMessageResponseToChild(message_1.id, Array.isArray(result) ? result : [result]);
297
+ }
298
+ else {
299
+ // No handler, proxy to parent
300
+ // tslint:disable-next-line:no-any
301
+ sendMessageToParent(message_1.func, message_1.args, function () {
302
+ var args = [];
303
+ for (var _i = 0; _i < arguments.length; _i++) {
304
+ args[_i] = arguments[_i];
305
+ }
306
+ if (Communication.childWindow) {
307
+ var isPartialResponse_1 = args.pop();
308
+ sendMessageResponseToChild(message_1.id, args, isPartialResponse_1);
309
+ }
310
+ });
311
+ }
312
+ }
313
+ }
314
+ function getTargetMessageQueue(targetWindow) {
315
+ return targetWindow === Communication.parentWindow
316
+ ? CommunicationPrivate.parentMessageQueue
317
+ : targetWindow === Communication.childWindow
318
+ ? CommunicationPrivate.childMessageQueue
319
+ : [];
320
+ }
321
+ function getTargetOrigin(targetWindow) {
322
+ return targetWindow === Communication.parentWindow
323
+ ? Communication.parentOrigin
324
+ : targetWindow === Communication.childWindow
325
+ ? Communication.childOrigin
326
+ : null;
327
+ }
328
+ function flushMessageQueue(targetWindow) {
329
+ var targetOrigin = getTargetOrigin(targetWindow);
330
+ var targetMessageQueue = getTargetMessageQueue(targetWindow);
331
+ while (targetWindow && targetOrigin && targetMessageQueue.length > 0) {
332
+ targetWindow.postMessage(targetMessageQueue.shift(), targetOrigin);
333
+ }
334
+ }
335
+ function waitForMessageQueue(targetWindow, callback) {
336
+ var messageQueueMonitor = Communication.currentWindow.setInterval(function () {
337
+ if (getTargetMessageQueue(targetWindow).length === 0) {
338
+ clearInterval(messageQueueMonitor);
339
+ callback();
340
+ }
341
+ }, 100);
342
+ }
343
+ exports.waitForMessageQueue = waitForMessageQueue;
344
+ /**
345
+ * Send a response to child for a message request that was from child
346
+ */
347
+ function sendMessageResponseToChild(id,
348
+ // tslint:disable-next-line:no-any
349
+ args, isPartialResponse) {
350
+ var targetWindow = Communication.childWindow;
351
+ var response = createMessageResponse(id, args, isPartialResponse);
352
+ var targetOrigin = getTargetOrigin(targetWindow);
353
+ if (targetWindow && targetOrigin) {
354
+ targetWindow.postMessage(response, targetOrigin);
355
+ }
356
+ }
357
+ /**
358
+ * Send a custom message object that can be sent to child window,
359
+ * instead of a response message to a child
360
+ */
361
+ function sendMessageEventToChild(actionName,
362
+ // tslint:disable-next-line: no-any
363
+ args) {
364
+ var targetWindow = Communication.childWindow;
365
+ var customEvent = createMessageEvent(actionName, args);
366
+ var targetOrigin = getTargetOrigin(targetWindow);
367
+ // If the target window isn't closed and we already know its origin, send the message right away; otherwise,
368
+ // queue the message and send it after the origin is established
369
+ if (targetWindow && targetOrigin) {
370
+ targetWindow.postMessage(customEvent, targetOrigin);
371
+ }
372
+ else {
373
+ getTargetMessageQueue(targetWindow).push(customEvent);
374
+ }
375
+ }
376
+ exports.sendMessageEventToChild = sendMessageEventToChild;
377
+ // tslint:disable-next-line:no-any
378
+ function createMessageRequest(func, args) {
379
+ return {
380
+ id: CommunicationPrivate.nextMessageId++,
381
+ func: func,
382
+ timestamp: Date.now(),
383
+ args: args || [],
384
+ };
385
+ }
386
+ // tslint:disable-next-line:no-any
387
+ function createMessageResponse(id, args, isPartialResponse) {
388
+ return {
389
+ id: id,
390
+ args: args || [],
391
+ isPartialResponse: isPartialResponse,
392
+ };
393
+ }
394
+ /**
395
+ * Creates a message object without any id, used for custom actions being sent to child frame/window
396
+ */
397
+ // tslint:disable-next-line:no-any
398
+ function createMessageEvent(func, args) {
399
+ return {
400
+ func: func,
401
+ args: args || [],
402
+ };
403
+ }
404
+
405
+
406
+ /***/ }),
407
+ /* 1 */
408
+ /***/ (function(module, exports, __webpack_require__) {
409
+
410
+ "use strict";
411
+
412
+ Object.defineProperty(exports, "__esModule", { value: true });
413
+ var constants_1 = __webpack_require__(4);
414
+ var globalVars_1 = __webpack_require__(6);
415
+ var utils_1 = __webpack_require__(5);
416
+ function ensureInitialized() {
417
+ var expectedFrameContexts = [];
418
+ for (var _i = 0; _i < arguments.length; _i++) {
419
+ expectedFrameContexts[_i] = arguments[_i];
420
+ }
421
+ if (!globalVars_1.GlobalVars.initializeCalled) {
422
+ throw new Error('The library has not yet been initialized');
423
+ }
424
+ if (globalVars_1.GlobalVars.frameContext && expectedFrameContexts && expectedFrameContexts.length > 0) {
425
+ var found = false;
426
+ for (var i = 0; i < expectedFrameContexts.length; i++) {
427
+ if (expectedFrameContexts[i] === globalVars_1.GlobalVars.frameContext) {
428
+ found = true;
429
+ break;
430
+ }
431
+ }
432
+ if (!found) {
433
+ throw new Error("This call is not allowed in the '" + globalVars_1.GlobalVars.frameContext + "' context");
434
+ }
435
+ }
436
+ }
437
+ exports.ensureInitialized = ensureInitialized;
438
+ /**
439
+ * Checks whether the platform has knowledge of this API by doing a comparison
440
+ * on API required version and platform supported version of the SDK
441
+ * @param requiredVersion SDK version required by the API
442
+ */
443
+ function isAPISupportedByPlatform(requiredVersion) {
444
+ if (requiredVersion === void 0) { requiredVersion = constants_1.defaultSDKVersionForCompatCheck; }
445
+ var value = utils_1.compareSDKVersions(globalVars_1.GlobalVars.clientSupportedSDKVersion, requiredVersion);
446
+ if (isNaN(value)) {
447
+ return false;
448
+ }
449
+ return value >= 0;
450
+ }
451
+ exports.isAPISupportedByPlatform = isAPISupportedByPlatform;
452
+ /**
453
+ * Processes the valid origins specifuied by the user, de-duplicates and converts them into a regexp
454
+ * which is used later for message source/origin validation
455
+ */
456
+ function processAdditionalValidOrigins(validMessageOrigins) {
457
+ var combinedOriginUrls = globalVars_1.GlobalVars.additionalValidOrigins.concat(validMessageOrigins.filter(function (_origin) {
458
+ return typeof _origin === 'string' && constants_1.userOriginUrlValidationRegExp.test(_origin);
459
+ }));
460
+ var dedupUrls = {};
461
+ combinedOriginUrls = combinedOriginUrls.filter(function (_originUrl) {
462
+ if (dedupUrls[_originUrl]) {
463
+ return false;
464
+ }
465
+ dedupUrls[_originUrl] = true;
466
+ return true;
467
+ });
468
+ globalVars_1.GlobalVars.additionalValidOrigins = combinedOriginUrls;
469
+ if (globalVars_1.GlobalVars.additionalValidOrigins.length > 0) {
470
+ globalVars_1.GlobalVars.additionalValidOriginsRegexp = utils_1.generateRegExpFromUrls(globalVars_1.GlobalVars.additionalValidOrigins);
471
+ }
472
+ else {
473
+ globalVars_1.GlobalVars.additionalValidOriginsRegexp = null;
474
+ }
475
+ }
476
+ exports.processAdditionalValidOrigins = processAdditionalValidOrigins;
477
+
478
+
479
+ /***/ }),
480
+ /* 2 */
481
+ /***/ (function(module, exports, __webpack_require__) {
482
+
483
+ "use strict";
484
+
485
+ Object.defineProperty(exports, "__esModule", { value: true });
486
+ var HostClientType;
487
+ (function (HostClientType) {
488
+ HostClientType["desktop"] = "desktop";
489
+ HostClientType["web"] = "web";
490
+ HostClientType["android"] = "android";
491
+ HostClientType["ios"] = "ios";
492
+ HostClientType["rigel"] = "rigel";
493
+ HostClientType["surfaceHub"] = "surfaceHub";
494
+ })(HostClientType = exports.HostClientType || (exports.HostClientType = {}));
495
+ // Ensure these declarations stay in sync with the framework.
496
+ var FrameContexts;
497
+ (function (FrameContexts) {
498
+ FrameContexts["settings"] = "settings";
499
+ FrameContexts["content"] = "content";
500
+ FrameContexts["authentication"] = "authentication";
501
+ FrameContexts["remove"] = "remove";
502
+ FrameContexts["task"] = "task";
503
+ FrameContexts["sidePanel"] = "sidePanel";
504
+ FrameContexts["stage"] = "stage";
505
+ FrameContexts["meetingStage"] = "meetingStage";
506
+ })(FrameContexts = exports.FrameContexts || (exports.FrameContexts = {}));
507
+ /**
508
+ * Indicates the team type, currently used to distinguish between different team
509
+ * types in Office 365 for Education (team types 1, 2, 3, and 4).
510
+ */
511
+ var TeamType;
512
+ (function (TeamType) {
513
+ TeamType[TeamType["Standard"] = 0] = "Standard";
514
+ TeamType[TeamType["Edu"] = 1] = "Edu";
515
+ TeamType[TeamType["Class"] = 2] = "Class";
516
+ TeamType[TeamType["Plc"] = 3] = "Plc";
517
+ TeamType[TeamType["Staff"] = 4] = "Staff";
518
+ })(TeamType = exports.TeamType || (exports.TeamType = {}));
519
+ /**
520
+ * Indicates the various types of roles of a user in a team.
521
+ */
522
+ var UserTeamRole;
523
+ (function (UserTeamRole) {
524
+ UserTeamRole[UserTeamRole["Admin"] = 0] = "Admin";
525
+ UserTeamRole[UserTeamRole["User"] = 1] = "User";
526
+ UserTeamRole[UserTeamRole["Guest"] = 2] = "Guest";
527
+ })(UserTeamRole = exports.UserTeamRole || (exports.UserTeamRole = {}));
528
+ /**
529
+ * Task module dimension enum
530
+ */
531
+ var TaskModuleDimension;
532
+ (function (TaskModuleDimension) {
533
+ TaskModuleDimension["Large"] = "large";
534
+ TaskModuleDimension["Medium"] = "medium";
535
+ TaskModuleDimension["Small"] = "small";
536
+ })(TaskModuleDimension = exports.TaskModuleDimension || (exports.TaskModuleDimension = {}));
537
+ /**
538
+ * The type of the channel with which the content is associated.
539
+ */
540
+ var ChannelType;
541
+ (function (ChannelType) {
542
+ ChannelType["Regular"] = "Regular";
543
+ ChannelType["Private"] = "Private";
544
+ ChannelType["Shared"] = "Shared";
545
+ })(ChannelType = exports.ChannelType || (exports.ChannelType = {}));
546
+
547
+
548
+ /***/ }),
549
+ /* 3 */
550
+ /***/ (function(module, exports, __webpack_require__) {
551
+
552
+ "use strict";
553
+
554
+ Object.defineProperty(exports, "__esModule", { value: true });
555
+ var public_1 = __webpack_require__(8);
556
+ var communication_1 = __webpack_require__(0);
557
+ var HandlersPrivate = /** @class */ (function () {
558
+ function HandlersPrivate() {
559
+ }
560
+ HandlersPrivate.handlers = {};
561
+ return HandlersPrivate;
562
+ }());
563
+ function initializeHandlers() {
564
+ // ::::::::::::::::::::MicrosoftTeams SDK Internal :::::::::::::::::
565
+ HandlersPrivate.handlers['themeChange'] = handleThemeChange;
566
+ HandlersPrivate.handlers['backButtonPress'] = handleBackButtonPress;
567
+ HandlersPrivate.handlers['load'] = handleLoad;
568
+ HandlersPrivate.handlers['beforeUnload'] = handleBeforeUnload;
569
+ }
570
+ exports.initializeHandlers = initializeHandlers;
571
+ function callHandler(name, args) {
572
+ var handler = HandlersPrivate.handlers[name];
573
+ if (handler) {
574
+ var result = handler.apply(this, args);
575
+ return [true, result];
576
+ }
577
+ else {
578
+ return [false, undefined];
579
+ }
580
+ }
581
+ exports.callHandler = callHandler;
582
+ function registerHandler(name, handler, sendMessage, args) {
583
+ if (sendMessage === void 0) { sendMessage = true; }
584
+ if (args === void 0) { args = []; }
585
+ if (handler) {
586
+ HandlersPrivate.handlers[name] = handler;
587
+ sendMessage && communication_1.sendMessageToParent('registerHandler', [name].concat(args));
588
+ }
589
+ else {
590
+ delete HandlersPrivate.handlers[name];
591
+ }
592
+ }
593
+ exports.registerHandler = registerHandler;
594
+ function removeHandler(name) {
595
+ delete HandlersPrivate.handlers[name];
596
+ }
597
+ exports.removeHandler = removeHandler;
598
+ function registerOnThemeChangeHandler(handler) {
599
+ HandlersPrivate.themeChangeHandler = handler;
600
+ handler && communication_1.sendMessageToParent('registerHandler', ['themeChange']);
601
+ }
602
+ exports.registerOnThemeChangeHandler = registerOnThemeChangeHandler;
603
+ function handleThemeChange(theme) {
604
+ if (HandlersPrivate.themeChangeHandler) {
605
+ HandlersPrivate.themeChangeHandler(theme);
606
+ }
607
+ if (communication_1.Communication.childWindow) {
608
+ communication_1.sendMessageEventToChild('themeChange', [theme]);
609
+ }
610
+ }
611
+ exports.handleThemeChange = handleThemeChange;
612
+ function registerBackButtonHandler(handler) {
613
+ HandlersPrivate.backButtonPressHandler = handler;
614
+ handler && communication_1.sendMessageToParent('registerHandler', ['backButton']);
615
+ }
616
+ exports.registerBackButtonHandler = registerBackButtonHandler;
617
+ function handleBackButtonPress() {
618
+ if (!HandlersPrivate.backButtonPressHandler || !HandlersPrivate.backButtonPressHandler()) {
619
+ public_1.navigateBack();
620
+ }
621
+ }
622
+ function registerOnLoadHandler(handler) {
623
+ HandlersPrivate.loadHandler = handler;
624
+ handler && communication_1.sendMessageToParent('registerHandler', ['load']);
625
+ }
626
+ exports.registerOnLoadHandler = registerOnLoadHandler;
627
+ function handleLoad(context) {
628
+ if (HandlersPrivate.loadHandler) {
629
+ HandlersPrivate.loadHandler(context);
630
+ }
631
+ if (communication_1.Communication.childWindow) {
632
+ communication_1.sendMessageEventToChild('load', [context]);
633
+ }
634
+ }
635
+ function registerBeforeUnloadHandler(handler) {
636
+ HandlersPrivate.beforeUnloadHandler = handler;
637
+ handler && communication_1.sendMessageToParent('registerHandler', ['beforeUnload']);
638
+ }
639
+ exports.registerBeforeUnloadHandler = registerBeforeUnloadHandler;
640
+ function handleBeforeUnload() {
641
+ var readyToUnload = function () {
642
+ communication_1.sendMessageToParent('readyToUnload', []);
643
+ };
644
+ if (!HandlersPrivate.beforeUnloadHandler || !HandlersPrivate.beforeUnloadHandler(readyToUnload)) {
645
+ readyToUnload();
646
+ }
647
+ }
648
+
649
+
650
+ /***/ }),
651
+ /* 4 */
652
+ /***/ (function(module, exports, __webpack_require__) {
653
+
654
+ "use strict";
655
+
656
+ Object.defineProperty(exports, "__esModule", { value: true });
657
+ var utils_1 = __webpack_require__(5);
658
+ exports.version = '1.10.1-dev.0';
659
+ /**
660
+ * This is the SDK version when all SDK APIs started to check platform compatibility for the APIs.
661
+ */
662
+ exports.defaultSDKVersionForCompatCheck = '1.6.0';
663
+ /**
664
+ * Minimum required client supported version for {@link getUserJoinedTeams} to be supported on {@link HostClientType.android}
665
+ */
666
+ exports.getUserJoinedTeamsSupportedAndroidClientVersion = '2.0.1';
667
+ /**
668
+ * This is the SDK version when location APIs (getLocation and showLocation) are supported.
669
+ */
670
+ exports.locationAPIsRequiredVersion = '1.9.0';
671
+ /**
672
+ * This is the SDK version when people picker API is supported on mobile.
673
+ */
674
+ exports.peoplePickerRequiredVersion = '2.0.0';
675
+ /**
676
+ * This is the SDK version when captureImage API is supported on mobile.
677
+ */
678
+ exports.captureImageMobileSupportVersion = '1.7.0';
679
+ /**
680
+ * This is the SDK version when media APIs are supported on all three platforms ios, android and web.
681
+ */
682
+ exports.mediaAPISupportVersion = '1.8.0';
683
+ /**
684
+ * This is the SDK version when getMedia API is supported via Callbacks on all three platforms ios, android and web.
685
+ */
686
+ exports.getMediaCallbackSupportVersion = '2.0.0';
687
+ /**
688
+ * This is the SDK version when scanBarCode API is supported on mobile.
689
+ */
690
+ exports.scanBarCodeAPIMobileSupportVersion = '1.9.0';
691
+ /**
692
+ * List of supported Host origins
693
+ */
694
+ exports.validOrigins = [
695
+ 'https://teams.microsoft.com',
696
+ 'https://teams.microsoft.us',
697
+ 'https://gov.teams.microsoft.us',
698
+ 'https://dod.teams.microsoft.us',
699
+ 'https://int.teams.microsoft.com',
700
+ 'https://teams.live.com',
701
+ 'https://devspaces.skype.com',
702
+ 'https://ssauth.skype.com',
703
+ 'https://local.teams.live.com',
704
+ 'https://local.teams.live.com:8080',
705
+ 'https://local.teams.office.com',
706
+ 'https://local.teams.office.com:8080',
707
+ 'https://msft.spoppe.com',
708
+ 'https://*.sharepoint.com',
709
+ 'https://*.sharepoint-df.com',
710
+ 'https://*.sharepointonline.com',
711
+ 'https://outlook.office.com',
712
+ 'https://outlook-sdf.office.com',
713
+ 'https://*.teams.microsoft.com',
714
+ 'https://www.office.com',
715
+ 'https://word.office.com',
716
+ 'https://excel.office.com',
717
+ 'https://powerpoint.office.com',
718
+ 'https://www.officeppe.com',
719
+ 'https://*.www.office.com',
720
+ ];
721
+ exports.validOriginRegExp = utils_1.generateRegExpFromUrls(exports.validOrigins);
722
+ /**
723
+ * USer specified message origins should satisfy this test
724
+ */
725
+ exports.userOriginUrlValidationRegExp = /^https\:\/\//;
726
+
727
+
728
+ /***/ }),
729
+ /* 5 */
730
+ /***/ (function(module, exports, __webpack_require__) {
731
+
732
+ "use strict";
733
+
734
+ Object.defineProperty(exports, "__esModule", { value: true });
735
+ var uuid = __webpack_require__(22);
736
+ // This will return a reg expression a given url
737
+ function generateRegExpFromUrl(url) {
738
+ var urlRegExpPart = '^';
739
+ var urlParts = url.split('.');
740
+ for (var j = 0; j < urlParts.length; j++) {
741
+ urlRegExpPart += (j > 0 ? '[.]' : '') + urlParts[j].replace('*', '[^/^.]+');
742
+ }
743
+ urlRegExpPart += '$';
744
+ return urlRegExpPart;
745
+ }
746
+ // This will return a reg expression for list of url
747
+ function generateRegExpFromUrls(urls) {
748
+ var urlRegExp = '';
749
+ for (var i = 0; i < urls.length; i++) {
750
+ urlRegExp += (i === 0 ? '' : '|') + generateRegExpFromUrl(urls[i]);
751
+ }
752
+ return new RegExp(urlRegExp);
753
+ }
754
+ exports.generateRegExpFromUrls = generateRegExpFromUrls;
755
+ function getGenericOnCompleteHandler(errorMessage) {
756
+ return function (success, reason) {
757
+ if (!success) {
758
+ throw new Error(errorMessage ? errorMessage : reason);
759
+ }
760
+ };
761
+ }
762
+ exports.getGenericOnCompleteHandler = getGenericOnCompleteHandler;
763
+ /**
764
+ * Compares SDK versions.
765
+ * @param v1 first version
766
+ * @param v2 second version
767
+ * returns NaN in case inputs are not in right format
768
+ * -1 if v1 < v2
769
+ * 1 if v1 > v2
770
+ * 0 otherwise
771
+ * For example,
772
+ * compareSDKVersions('1.2', '1.2.0') returns 0
773
+ * compareSDKVersions('1.2a', '1.2b') returns NaN
774
+ * compareSDKVersions('1.2', '1.3') returns -1
775
+ * compareSDKVersions('2.0', '1.3.2') returns 1
776
+ * compareSDKVersions('2.0', 2.0) returns NaN
777
+ */
778
+ function compareSDKVersions(v1, v2) {
779
+ if (typeof v1 !== 'string' || typeof v2 !== 'string') {
780
+ return NaN;
781
+ }
782
+ var v1parts = v1.split('.');
783
+ var v2parts = v2.split('.');
784
+ function isValidPart(x) {
785
+ // input has to have one or more digits
786
+ // For ex - returns true for '11', false for '1a1', false for 'a', false for '2b'
787
+ return /^\d+$/.test(x);
788
+ }
789
+ if (!v1parts.every(isValidPart) || !v2parts.every(isValidPart)) {
790
+ return NaN;
791
+ }
792
+ // Make length of both parts equal
793
+ while (v1parts.length < v2parts.length) {
794
+ v1parts.push('0');
795
+ }
796
+ while (v2parts.length < v1parts.length) {
797
+ v2parts.push('0');
798
+ }
799
+ for (var i = 0; i < v1parts.length; ++i) {
800
+ if (Number(v1parts[i]) == Number(v2parts[i])) {
801
+ continue;
802
+ }
803
+ else if (Number(v1parts[i]) > Number(v2parts[i])) {
804
+ return 1;
805
+ }
806
+ else {
807
+ return -1;
808
+ }
809
+ }
810
+ return 0;
811
+ }
812
+ exports.compareSDKVersions = compareSDKVersions;
813
+ /**
814
+ * Generates a GUID
815
+ */
816
+ function generateGUID() {
817
+ return uuid.v4();
818
+ }
819
+ exports.generateGUID = generateGUID;
820
+
821
+
822
+ /***/ }),
823
+ /* 6 */
824
+ /***/ (function(module, exports, __webpack_require__) {
825
+
826
+ "use strict";
827
+
828
+ Object.defineProperty(exports, "__esModule", { value: true });
829
+ var GlobalVars = /** @class */ (function () {
830
+ function GlobalVars() {
831
+ }
832
+ GlobalVars.initializeCalled = false;
833
+ GlobalVars.initializeCompleted = false;
834
+ GlobalVars.additionalValidOrigins = [];
835
+ GlobalVars.additionalValidOriginsRegexp = null;
836
+ GlobalVars.initializeCallbacks = [];
837
+ GlobalVars.isFramelessWindow = false;
838
+ GlobalVars.printCapabilityEnabled = false;
839
+ return GlobalVars;
840
+ }());
841
+ exports.GlobalVars = GlobalVars;
842
+
843
+
844
+ /***/ }),
845
+ /* 7 */
846
+ /***/ (function(module, exports, __webpack_require__) {
847
+
848
+ "use strict";
849
+
850
+ Object.defineProperty(exports, "__esModule", { value: true });
851
+ /**
852
+ * Allowed user file open preferences
853
+ */
854
+ var FileOpenPreference;
855
+ (function (FileOpenPreference) {
856
+ FileOpenPreference["Inline"] = "inline";
857
+ FileOpenPreference["Desktop"] = "desktop";
858
+ FileOpenPreference["Web"] = "web";
859
+ })(FileOpenPreference = exports.FileOpenPreference || (exports.FileOpenPreference = {}));
860
+ var ErrorCode;
861
+ (function (ErrorCode) {
862
+ /**
863
+ * API not supported in the current platform.
864
+ */
865
+ ErrorCode[ErrorCode["NOT_SUPPORTED_ON_PLATFORM"] = 100] = "NOT_SUPPORTED_ON_PLATFORM";
866
+ /**
867
+ * Internal error encountered while performing the required operation.
868
+ */
869
+ ErrorCode[ErrorCode["INTERNAL_ERROR"] = 500] = "INTERNAL_ERROR";
870
+ /**
871
+ * API is not supported in the current context
872
+ */
873
+ ErrorCode[ErrorCode["NOT_SUPPORTED_IN_CURRENT_CONTEXT"] = 501] = "NOT_SUPPORTED_IN_CURRENT_CONTEXT";
874
+ /**
875
+ Permissions denied by user
876
+ */
877
+ ErrorCode[ErrorCode["PERMISSION_DENIED"] = 1000] = "PERMISSION_DENIED";
878
+ /**
879
+ * Network issue
880
+ */
881
+ ErrorCode[ErrorCode["NETWORK_ERROR"] = 2000] = "NETWORK_ERROR";
882
+ /**
883
+ * Underlying hardware doesn't support the capability
884
+ */
885
+ ErrorCode[ErrorCode["NO_HW_SUPPORT"] = 3000] = "NO_HW_SUPPORT";
886
+ /**
887
+ * One or more arguments are invalid
888
+ */
889
+ ErrorCode[ErrorCode["INVALID_ARGUMENTS"] = 4000] = "INVALID_ARGUMENTS";
890
+ /**
891
+ * User is not authorized for this operation
892
+ */
893
+ ErrorCode[ErrorCode["UNAUTHORIZED_USER_OPERATION"] = 5000] = "UNAUTHORIZED_USER_OPERATION";
894
+ /**
895
+ * Could not complete the operation due to insufficient resources
896
+ */
897
+ ErrorCode[ErrorCode["INSUFFICIENT_RESOURCES"] = 6000] = "INSUFFICIENT_RESOURCES";
898
+ /**
899
+ * Platform throttled the request because of API was invoked too frequently
900
+ */
901
+ ErrorCode[ErrorCode["THROTTLE"] = 7000] = "THROTTLE";
902
+ /**
903
+ * User aborted the operation
904
+ */
905
+ ErrorCode[ErrorCode["USER_ABORT"] = 8000] = "USER_ABORT";
906
+ /**
907
+ * Could not complete the operation in the given time interval
908
+ */
909
+ ErrorCode[ErrorCode["OPERATION_TIMED_OUT"] = 8001] = "OPERATION_TIMED_OUT";
910
+ /**
911
+ * Platform code is old and doesn't implement this API
912
+ */
913
+ ErrorCode[ErrorCode["OLD_PLATFORM"] = 9000] = "OLD_PLATFORM";
914
+ /**
915
+ * The file specified was not found on the given location
916
+ */
917
+ ErrorCode[ErrorCode["FILE_NOT_FOUND"] = 404] = "FILE_NOT_FOUND";
918
+ /**
919
+ * The return value is too big and has exceeded our size boundries
920
+ */
921
+ ErrorCode[ErrorCode["SIZE_EXCEEDED"] = 10000] = "SIZE_EXCEEDED";
922
+ })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
923
+
924
+
925
+ /***/ }),
926
+ /* 8 */
927
+ /***/ (function(module, exports, __webpack_require__) {
928
+
929
+ "use strict";
930
+
931
+ Object.defineProperty(exports, "__esModule", { value: true });
932
+ var appInitialization_1 = __webpack_require__(25);
933
+ exports.appInitialization = appInitialization_1.appInitialization;
934
+ var authentication_1 = __webpack_require__(11);
935
+ exports.authentication = authentication_1.authentication;
936
+ var constants_1 = __webpack_require__(2);
937
+ exports.FrameContexts = constants_1.FrameContexts;
938
+ exports.HostClientType = constants_1.HostClientType;
939
+ exports.TaskModuleDimension = constants_1.TaskModuleDimension;
940
+ exports.TeamType = constants_1.TeamType;
941
+ exports.UserTeamRole = constants_1.UserTeamRole;
942
+ exports.ChannelType = constants_1.ChannelType;
943
+ var interfaces_1 = __webpack_require__(7);
944
+ exports.ErrorCode = interfaces_1.ErrorCode;
945
+ exports.FileOpenPreference = interfaces_1.FileOpenPreference;
946
+ var publicAPIs_1 = __webpack_require__(26);
947
+ exports.enablePrintCapability = publicAPIs_1.enablePrintCapability;
948
+ exports.executeDeepLink = publicAPIs_1.executeDeepLink;
949
+ exports.getContext = publicAPIs_1.getContext;
950
+ exports.getMruTabInstances = publicAPIs_1.getMruTabInstances;
951
+ exports.getTabInstances = publicAPIs_1.getTabInstances;
952
+ exports.initialize = publicAPIs_1.initialize;
953
+ exports.initializeWithFrameContext = publicAPIs_1.initializeWithFrameContext;
954
+ exports.print = publicAPIs_1.print;
955
+ exports.registerBackButtonHandler = publicAPIs_1.registerBackButtonHandler;
956
+ exports.registerBeforeUnloadHandler = publicAPIs_1.registerBeforeUnloadHandler;
957
+ exports.registerChangeSettingsHandler = publicAPIs_1.registerChangeSettingsHandler;
958
+ exports.registerFullScreenHandler = publicAPIs_1.registerFullScreenHandler;
959
+ exports.registerOnLoadHandler = publicAPIs_1.registerOnLoadHandler;
960
+ exports.registerOnThemeChangeHandler = publicAPIs_1.registerOnThemeChangeHandler;
961
+ exports.registerAppButtonClickHandler = publicAPIs_1.registerAppButtonClickHandler;
962
+ exports.registerAppButtonHoverEnterHandler = publicAPIs_1.registerAppButtonHoverEnterHandler;
963
+ exports.registerAppButtonHoverLeaveHandler = publicAPIs_1.registerAppButtonHoverLeaveHandler;
964
+ exports.setFrameContext = publicAPIs_1.setFrameContext;
965
+ exports.shareDeepLink = publicAPIs_1.shareDeepLink;
966
+ var navigation_1 = __webpack_require__(27);
967
+ exports.returnFocus = navigation_1.returnFocus;
968
+ exports.navigateBack = navigation_1.navigateBack;
969
+ exports.navigateCrossDomain = navigation_1.navigateCrossDomain;
970
+ exports.navigateToTab = navigation_1.navigateToTab;
971
+ var settings_1 = __webpack_require__(12);
972
+ exports.settings = settings_1.settings;
973
+ var tasks_1 = __webpack_require__(28);
974
+ exports.tasks = tasks_1.tasks;
975
+ var appWindow_1 = __webpack_require__(16);
976
+ exports.ChildAppWindow = appWindow_1.ChildAppWindow;
977
+ exports.ParentAppWindow = appWindow_1.ParentAppWindow;
978
+ var media_1 = __webpack_require__(17);
979
+ exports.media = media_1.media;
980
+ var location_1 = __webpack_require__(29);
981
+ exports.location = location_1.location;
982
+ var meeting_1 = __webpack_require__(30);
983
+ exports.meeting = meeting_1.meeting;
984
+ var people_1 = __webpack_require__(31);
985
+ exports.people = people_1.people;
986
+
987
+
988
+ /***/ }),
989
+ /* 9 */
990
+ /***/ (function(module, exports) {
991
+
992
+ // Unique ID creation requires a high quality random # generator. In the
993
+ // browser this is a little complicated due to unknown quality of Math.random()
994
+ // and inconsistent support for the `crypto` API. We do the best we can via
995
+ // feature-detection
996
+
997
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto
998
+ // implementation. Also, find the complete implementation of crypto on IE11.
999
+ var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
1000
+ (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
1001
+
1002
+ if (getRandomValues) {
1003
+ // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
1004
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
1005
+
1006
+ module.exports = function whatwgRNG() {
1007
+ getRandomValues(rnds8);
1008
+ return rnds8;
1009
+ };
1010
+ } else {
1011
+ // Math.random()-based (RNG)
1012
+ //
1013
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
1014
+ // quality.
1015
+ var rnds = new Array(16);
1016
+
1017
+ module.exports = function mathRNG() {
1018
+ for (var i = 0, r; i < 16; i++) {
1019
+ if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
1020
+ rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
1021
+ }
1022
+
1023
+ return rnds;
1024
+ };
1025
+ }
1026
+
1027
+
1028
+ /***/ }),
1029
+ /* 10 */
1030
+ /***/ (function(module, exports) {
1031
+
1032
+ /**
1033
+ * Convert array of 16 byte values to UUID string format of the form:
1034
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
1035
+ */
1036
+ var byteToHex = [];
1037
+ for (var i = 0; i < 256; ++i) {
1038
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
1039
+ }
1040
+
1041
+ function bytesToUuid(buf, offset) {
1042
+ var i = offset || 0;
1043
+ var bth = byteToHex;
1044
+ // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
1045
+ return ([bth[buf[i++]], bth[buf[i++]],
1046
+ bth[buf[i++]], bth[buf[i++]], '-',
1047
+ bth[buf[i++]], bth[buf[i++]], '-',
1048
+ bth[buf[i++]], bth[buf[i++]], '-',
1049
+ bth[buf[i++]], bth[buf[i++]], '-',
1050
+ bth[buf[i++]], bth[buf[i++]],
1051
+ bth[buf[i++]], bth[buf[i++]],
1052
+ bth[buf[i++]], bth[buf[i++]]]).join('');
1053
+ }
1054
+
1055
+ module.exports = bytesToUuid;
1056
+
1057
+
1058
+ /***/ }),
1059
+ /* 11 */
1060
+ /***/ (function(module, exports, __webpack_require__) {
1061
+
1062
+ "use strict";
1063
+
1064
+ Object.defineProperty(exports, "__esModule", { value: true });
1065
+ var internalAPIs_1 = __webpack_require__(1);
1066
+ var globalVars_1 = __webpack_require__(6);
1067
+ var constants_1 = __webpack_require__(2);
1068
+ var communication_1 = __webpack_require__(0);
1069
+ var handlers_1 = __webpack_require__(3);
1070
+ /**
1071
+ * Namespace to interact with the authentication-specific part of the SDK.
1072
+ * This object is used for starting or completing authentication flows.
1073
+ */
1074
+ var authentication;
1075
+ (function (authentication) {
1076
+ var authParams;
1077
+ var authWindowMonitor;
1078
+ function initialize() {
1079
+ handlers_1.registerHandler('authentication.authenticate.success', handleSuccess, false);
1080
+ handlers_1.registerHandler('authentication.authenticate.failure', handleFailure, false);
1081
+ }
1082
+ authentication.initialize = initialize;
1083
+ /**
1084
+ * Registers the authentication Communication.handlers
1085
+ * @param authenticateParameters A set of values that configure the authentication pop-up.
1086
+ */
1087
+ function registerAuthenticationHandlers(authenticateParameters) {
1088
+ authParams = authenticateParameters;
1089
+ }
1090
+ authentication.registerAuthenticationHandlers = registerAuthenticationHandlers;
1091
+ /**
1092
+ * Initiates an authentication request, which opens a new window with the specified settings.
1093
+ */
1094
+ function authenticate(authenticateParameters) {
1095
+ var authenticateParams = authenticateParameters !== undefined ? authenticateParameters : authParams;
1096
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.sidePanel, constants_1.FrameContexts.settings, constants_1.FrameContexts.remove, constants_1.FrameContexts.task, constants_1.FrameContexts.stage, constants_1.FrameContexts.meetingStage);
1097
+ if (globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.desktop ||
1098
+ globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.android ||
1099
+ globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.ios ||
1100
+ globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.rigel) {
1101
+ // Convert any relative URLs into absolute URLs before sending them over to the parent window.
1102
+ var link = document.createElement('a');
1103
+ link.href = authenticateParams.url;
1104
+ // Ask the parent window to open an authentication window with the parameters provided by the caller.
1105
+ communication_1.sendMessageToParent('authentication.authenticate', [link.href, authenticateParams.width, authenticateParams.height], function (success, response) {
1106
+ if (success) {
1107
+ authenticateParams.successCallback(response);
1108
+ }
1109
+ else {
1110
+ authenticateParams.failureCallback(response);
1111
+ }
1112
+ });
1113
+ }
1114
+ else {
1115
+ // Open an authentication window with the parameters provided by the caller.
1116
+ openAuthenticationWindow(authenticateParams);
1117
+ }
1118
+ }
1119
+ authentication.authenticate = authenticate;
1120
+ /**
1121
+ * Requests an Azure AD token to be issued on behalf of the app. The token is acquired from the cache
1122
+ * if it is not expired. Otherwise a request is sent to Azure AD to obtain a new token.
1123
+ * @param authTokenRequest A set of values that configure the token request.
1124
+ */
1125
+ function getAuthToken(authTokenRequest) {
1126
+ internalAPIs_1.ensureInitialized();
1127
+ communication_1.sendMessageToParent('authentication.getAuthToken', [authTokenRequest.resources, authTokenRequest.claims, authTokenRequest.silent], function (success, result) {
1128
+ if (success) {
1129
+ authTokenRequest.successCallback(result);
1130
+ }
1131
+ else {
1132
+ authTokenRequest.failureCallback(result);
1133
+ }
1134
+ });
1135
+ }
1136
+ authentication.getAuthToken = getAuthToken;
1137
+ /**
1138
+ * @private
1139
+ * Hide from docs.
1140
+ * ------
1141
+ * Requests the decoded Azure AD user identity on behalf of the app.
1142
+ */
1143
+ function getUser(userRequest) {
1144
+ internalAPIs_1.ensureInitialized();
1145
+ communication_1.sendMessageToParent('authentication.getUser', function (success, result) {
1146
+ if (success) {
1147
+ userRequest.successCallback(result);
1148
+ }
1149
+ else {
1150
+ userRequest.failureCallback(result);
1151
+ }
1152
+ });
1153
+ }
1154
+ authentication.getUser = getUser;
1155
+ function closeAuthenticationWindow() {
1156
+ // Stop monitoring the authentication window
1157
+ stopAuthenticationWindowMonitor();
1158
+ // Try to close the authentication window and clear all properties associated with it
1159
+ try {
1160
+ if (communication_1.Communication.childWindow) {
1161
+ communication_1.Communication.childWindow.close();
1162
+ }
1163
+ }
1164
+ finally {
1165
+ communication_1.Communication.childWindow = null;
1166
+ communication_1.Communication.childOrigin = null;
1167
+ }
1168
+ }
1169
+ function openAuthenticationWindow(authenticateParameters) {
1170
+ authParams = authenticateParameters;
1171
+ // Close the previously opened window if we have one
1172
+ closeAuthenticationWindow();
1173
+ // Start with a sensible default size
1174
+ var width = authParams.width || 600;
1175
+ var height = authParams.height || 400;
1176
+ // Ensure that the new window is always smaller than our app's window so that it never fully covers up our app
1177
+ width = Math.min(width, communication_1.Communication.currentWindow.outerWidth - 400);
1178
+ height = Math.min(height, communication_1.Communication.currentWindow.outerHeight - 200);
1179
+ // Convert any relative URLs into absolute URLs before sending them over to the parent window
1180
+ var link = document.createElement('a');
1181
+ link.href = authParams.url;
1182
+ // We are running in the browser, so we need to center the new window ourselves
1183
+ var left = typeof communication_1.Communication.currentWindow.screenLeft !== 'undefined'
1184
+ ? communication_1.Communication.currentWindow.screenLeft
1185
+ : communication_1.Communication.currentWindow.screenX;
1186
+ var top = typeof communication_1.Communication.currentWindow.screenTop !== 'undefined'
1187
+ ? communication_1.Communication.currentWindow.screenTop
1188
+ : communication_1.Communication.currentWindow.screenY;
1189
+ left += communication_1.Communication.currentWindow.outerWidth / 2 - width / 2;
1190
+ top += communication_1.Communication.currentWindow.outerHeight / 2 - height / 2;
1191
+ // Open a child window with a desired set of standard browser features
1192
+ communication_1.Communication.childWindow = communication_1.Communication.currentWindow.open(link.href, '_blank', 'toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=' +
1193
+ top +
1194
+ ', left=' +
1195
+ left +
1196
+ ', width=' +
1197
+ width +
1198
+ ', height=' +
1199
+ height);
1200
+ if (communication_1.Communication.childWindow) {
1201
+ // Start monitoring the authentication window so that we can detect if it gets closed before the flow completes
1202
+ startAuthenticationWindowMonitor();
1203
+ }
1204
+ else {
1205
+ // If we failed to open the window, fail the authentication flow
1206
+ handleFailure('FailedToOpenWindow');
1207
+ }
1208
+ }
1209
+ function stopAuthenticationWindowMonitor() {
1210
+ if (authWindowMonitor) {
1211
+ clearInterval(authWindowMonitor);
1212
+ authWindowMonitor = 0;
1213
+ }
1214
+ handlers_1.removeHandler('initialize');
1215
+ handlers_1.removeHandler('navigateCrossDomain');
1216
+ }
1217
+ function startAuthenticationWindowMonitor() {
1218
+ // Stop the previous window monitor if one is running
1219
+ stopAuthenticationWindowMonitor();
1220
+ // Create an interval loop that
1221
+ // - Notifies the caller of failure if it detects that the authentication window is closed
1222
+ // - Keeps pinging the authentication window while it is open to re-establish
1223
+ // contact with any pages along the authentication flow that need to communicate
1224
+ // with us
1225
+ authWindowMonitor = communication_1.Communication.currentWindow.setInterval(function () {
1226
+ if (!communication_1.Communication.childWindow || communication_1.Communication.childWindow.closed) {
1227
+ handleFailure('CancelledByUser');
1228
+ }
1229
+ else {
1230
+ var savedChildOrigin = communication_1.Communication.childOrigin;
1231
+ try {
1232
+ communication_1.Communication.childOrigin = '*';
1233
+ communication_1.sendMessageEventToChild('ping');
1234
+ }
1235
+ finally {
1236
+ communication_1.Communication.childOrigin = savedChildOrigin;
1237
+ }
1238
+ }
1239
+ }, 100);
1240
+ // Set up an initialize-message handler that gives the authentication window its frame context
1241
+ handlers_1.registerHandler('initialize', function () {
1242
+ return [constants_1.FrameContexts.authentication, globalVars_1.GlobalVars.hostClientType];
1243
+ });
1244
+ // Set up a navigateCrossDomain message handler that blocks cross-domain re-navigation attempts
1245
+ // in the authentication window. We could at some point choose to implement this method via a call to
1246
+ // authenticationWindow.location.href = url; however, we would first need to figure out how to
1247
+ // validate the URL against the tab's list of valid domains.
1248
+ handlers_1.registerHandler('navigateCrossDomain', function () {
1249
+ return false;
1250
+ });
1251
+ }
1252
+ /**
1253
+ * Notifies the frame that initiated this authentication request that the request was successful.
1254
+ * This function is usable only on the authentication window.
1255
+ * This call causes the authentication window to be closed.
1256
+ * @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
1257
+ * @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
1258
+ */
1259
+ function notifySuccess(result, callbackUrl) {
1260
+ redirectIfWin32Outlook(callbackUrl, 'result', result);
1261
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.authentication);
1262
+ communication_1.sendMessageToParent('authentication.authenticate.success', [result]);
1263
+ // Wait for the message to be sent before closing the window
1264
+ communication_1.waitForMessageQueue(communication_1.Communication.parentWindow, function () { return setTimeout(function () { return communication_1.Communication.currentWindow.close(); }, 200); });
1265
+ }
1266
+ authentication.notifySuccess = notifySuccess;
1267
+ /**
1268
+ * Notifies the frame that initiated this authentication request that the request failed.
1269
+ * This function is usable only on the authentication window.
1270
+ * This call causes the authentication window to be closed.
1271
+ * @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
1272
+ * @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
1273
+ */
1274
+ function notifyFailure(reason, callbackUrl) {
1275
+ redirectIfWin32Outlook(callbackUrl, 'reason', reason);
1276
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.authentication);
1277
+ communication_1.sendMessageToParent('authentication.authenticate.failure', [reason]);
1278
+ // Wait for the message to be sent before closing the window
1279
+ communication_1.waitForMessageQueue(communication_1.Communication.parentWindow, function () { return setTimeout(function () { return communication_1.Communication.currentWindow.close(); }, 200); });
1280
+ }
1281
+ authentication.notifyFailure = notifyFailure;
1282
+ function handleSuccess(result) {
1283
+ try {
1284
+ if (authParams && authParams.successCallback) {
1285
+ authParams.successCallback(result);
1286
+ }
1287
+ }
1288
+ finally {
1289
+ authParams = null;
1290
+ closeAuthenticationWindow();
1291
+ }
1292
+ }
1293
+ function handleFailure(reason) {
1294
+ try {
1295
+ if (authParams && authParams.failureCallback) {
1296
+ authParams.failureCallback(reason);
1297
+ }
1298
+ }
1299
+ finally {
1300
+ authParams = null;
1301
+ closeAuthenticationWindow();
1302
+ }
1303
+ }
1304
+ /**
1305
+ * Validates that the callbackUrl param is a valid connector url, appends the result/reason and authSuccess/authFailure as URL fragments and redirects the window
1306
+ * @param callbackUrl - the connectors url to redirect to
1307
+ * @param key - "result" in case of success and "reason" in case of failure
1308
+ * @param value - the value of the passed result/reason parameter
1309
+ */
1310
+ function redirectIfWin32Outlook(callbackUrl, key, value) {
1311
+ if (callbackUrl) {
1312
+ var link = document.createElement('a');
1313
+ link.href = decodeURIComponent(callbackUrl);
1314
+ if (link.host &&
1315
+ link.host !== window.location.host &&
1316
+ link.host === 'outlook.office.com' &&
1317
+ link.search.indexOf('client_type=Win32_Outlook') > -1) {
1318
+ if (key && key === 'result') {
1319
+ if (value) {
1320
+ link.href = updateUrlParameter(link.href, 'result', value);
1321
+ }
1322
+ communication_1.Communication.currentWindow.location.assign(updateUrlParameter(link.href, 'authSuccess', ''));
1323
+ }
1324
+ if (key && key === 'reason') {
1325
+ if (value) {
1326
+ link.href = updateUrlParameter(link.href, 'reason', value);
1327
+ }
1328
+ communication_1.Communication.currentWindow.location.assign(updateUrlParameter(link.href, 'authFailure', ''));
1329
+ }
1330
+ }
1331
+ }
1332
+ }
1333
+ /**
1334
+ * Appends either result or reason as a fragment to the 'callbackUrl'
1335
+ * @param uri - the url to modify
1336
+ * @param key - the fragment key
1337
+ * @param value - the fragment value
1338
+ */
1339
+ function updateUrlParameter(uri, key, value) {
1340
+ var i = uri.indexOf('#');
1341
+ var hash = i === -1 ? '#' : uri.substr(i);
1342
+ hash = hash + '&' + key + (value !== '' ? '=' + value : '');
1343
+ uri = i === -1 ? uri : uri.substr(0, i);
1344
+ return uri + hash;
1345
+ }
1346
+ })(authentication = exports.authentication || (exports.authentication = {}));
1347
+
1348
+
1349
+ /***/ }),
1350
+ /* 12 */
1351
+ /***/ (function(module, exports, __webpack_require__) {
1352
+
1353
+ "use strict";
1354
+
1355
+ Object.defineProperty(exports, "__esModule", { value: true });
1356
+ var internalAPIs_1 = __webpack_require__(1);
1357
+ var constants_1 = __webpack_require__(2);
1358
+ var utils_1 = __webpack_require__(5);
1359
+ var communication_1 = __webpack_require__(0);
1360
+ var handlers_1 = __webpack_require__(3);
1361
+ /**
1362
+ * Namespace to interact with the settings-specific part of the SDK.
1363
+ * This object is usable only on the settings frame.
1364
+ */
1365
+ var settings;
1366
+ (function (settings) {
1367
+ var saveHandler;
1368
+ var removeHandler;
1369
+ function initialize() {
1370
+ handlers_1.registerHandler('settings.save', handleSave, false);
1371
+ handlers_1.registerHandler('settings.remove', handleRemove, false);
1372
+ }
1373
+ settings.initialize = initialize;
1374
+ /**
1375
+ * Sets the validity state for the settings.
1376
+ * The initial value is false, so the user cannot save the settings until this is called with true.
1377
+ * @param validityState Indicates whether the save or remove button is enabled for the user.
1378
+ */
1379
+ function setValidityState(validityState) {
1380
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.settings, constants_1.FrameContexts.remove);
1381
+ communication_1.sendMessageToParent('settings.setValidityState', [validityState]);
1382
+ }
1383
+ settings.setValidityState = setValidityState;
1384
+ /**
1385
+ * Gets the settings for the current instance.
1386
+ * @param callback The callback to invoke when the {@link Settings} object is retrieved.
1387
+ */
1388
+ function getSettings(callback) {
1389
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.settings, constants_1.FrameContexts.remove, constants_1.FrameContexts.sidePanel);
1390
+ communication_1.sendMessageToParent('settings.getSettings', callback);
1391
+ }
1392
+ settings.getSettings = getSettings;
1393
+ /**
1394
+ * Sets the settings for the current instance.
1395
+ * This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.
1396
+ * @param settings The desired settings for this instance.
1397
+ */
1398
+ function setSettings(instanceSettings, onComplete) {
1399
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.settings, constants_1.FrameContexts.sidePanel);
1400
+ communication_1.sendMessageToParent('settings.setSettings', [instanceSettings], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler());
1401
+ }
1402
+ settings.setSettings = setSettings;
1403
+ /**
1404
+ * Registers a handler for when the user attempts to save the settings. This handler should be used
1405
+ * to create or update the underlying resource powering the content.
1406
+ * The object passed to the handler must be used to notify whether to proceed with the save.
1407
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
1408
+ * @param handler The handler to invoke when the user selects the save button.
1409
+ */
1410
+ function registerOnSaveHandler(handler) {
1411
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.settings);
1412
+ saveHandler = handler;
1413
+ handler && communication_1.sendMessageToParent('registerHandler', ['save']);
1414
+ }
1415
+ settings.registerOnSaveHandler = registerOnSaveHandler;
1416
+ /**
1417
+ * Registers a handler for user attempts to remove content. This handler should be used
1418
+ * to remove the underlying resource powering the content.
1419
+ * The object passed to the handler must be used to indicate whether to proceed with the removal.
1420
+ * Only one handler may be registered at a time. Subsequent registrations will override the first.
1421
+ * @param handler The handler to invoke when the user selects the remove button.
1422
+ */
1423
+ function registerOnRemoveHandler(handler) {
1424
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.remove, constants_1.FrameContexts.settings);
1425
+ removeHandler = handler;
1426
+ handler && communication_1.sendMessageToParent('registerHandler', ['remove']);
1427
+ }
1428
+ settings.registerOnRemoveHandler = registerOnRemoveHandler;
1429
+ function handleSave(result) {
1430
+ var saveEvent = new SaveEventImpl(result);
1431
+ if (saveHandler) {
1432
+ saveHandler(saveEvent);
1433
+ }
1434
+ else {
1435
+ // If no handler is registered, we assume success.
1436
+ saveEvent.notifySuccess();
1437
+ }
1438
+ }
1439
+ /**
1440
+ * @private
1441
+ * Hide from docs, since this class is not directly used.
1442
+ */
1443
+ var SaveEventImpl = /** @class */ (function () {
1444
+ function SaveEventImpl(result) {
1445
+ this.notified = false;
1446
+ this.result = result ? result : {};
1447
+ }
1448
+ SaveEventImpl.prototype.notifySuccess = function () {
1449
+ this.ensureNotNotified();
1450
+ communication_1.sendMessageToParent('settings.save.success');
1451
+ this.notified = true;
1452
+ };
1453
+ SaveEventImpl.prototype.notifyFailure = function (reason) {
1454
+ this.ensureNotNotified();
1455
+ communication_1.sendMessageToParent('settings.save.failure', [reason]);
1456
+ this.notified = true;
1457
+ };
1458
+ SaveEventImpl.prototype.ensureNotNotified = function () {
1459
+ if (this.notified) {
1460
+ throw new Error('The SaveEvent may only notify success or failure once.');
1461
+ }
1462
+ };
1463
+ return SaveEventImpl;
1464
+ }());
1465
+ function handleRemove() {
1466
+ var removeEvent = new RemoveEventImpl();
1467
+ if (removeHandler) {
1468
+ removeHandler(removeEvent);
1469
+ }
1470
+ else {
1471
+ // If no handler is registered, we assume success.
1472
+ removeEvent.notifySuccess();
1473
+ }
1474
+ }
1475
+ /**
1476
+ * @private
1477
+ * Hide from docs, since this class is not directly used.
1478
+ */
1479
+ var RemoveEventImpl = /** @class */ (function () {
1480
+ function RemoveEventImpl() {
1481
+ this.notified = false;
1482
+ }
1483
+ RemoveEventImpl.prototype.notifySuccess = function () {
1484
+ this.ensureNotNotified();
1485
+ communication_1.sendMessageToParent('settings.remove.success');
1486
+ this.notified = true;
1487
+ };
1488
+ RemoveEventImpl.prototype.notifyFailure = function (reason) {
1489
+ this.ensureNotNotified();
1490
+ communication_1.sendMessageToParent('settings.remove.failure', [reason]);
1491
+ this.notified = true;
1492
+ };
1493
+ RemoveEventImpl.prototype.ensureNotNotified = function () {
1494
+ if (this.notified) {
1495
+ throw new Error('The removeEvent may only notify success or failure once.');
1496
+ }
1497
+ };
1498
+ return RemoveEventImpl;
1499
+ }());
1500
+ })(settings = exports.settings || (exports.settings = {}));
1501
+
1502
+
1503
+ /***/ }),
1504
+ /* 13 */
1505
+ /***/ (function(module, exports, __webpack_require__) {
1506
+
1507
+ "use strict";
1508
+
1509
+ Object.defineProperty(exports, "__esModule", { value: true });
1510
+ var internalAPIs_1 = __webpack_require__(1);
1511
+ var communication_1 = __webpack_require__(0);
1512
+ var handlers_1 = __webpack_require__(3);
1513
+ /**
1514
+ * Namespace to interact with the logging part of the SDK.
1515
+ * This object is used to send the app logs on demand to the host client
1516
+ *
1517
+ * @private
1518
+ * Hide from docs
1519
+ */
1520
+ var logs;
1521
+ (function (logs) {
1522
+ /**
1523
+ * @private
1524
+ * Hide from docs
1525
+ * ------
1526
+ * Registers a handler for getting app log
1527
+ * @param handler The handler to invoke to get the app log
1528
+ */
1529
+ function registerGetLogHandler(handler) {
1530
+ internalAPIs_1.ensureInitialized();
1531
+ if (handler) {
1532
+ handlers_1.registerHandler('log.request', function () {
1533
+ var log = handler();
1534
+ communication_1.sendMessageToParent('log.receive', [log]);
1535
+ });
1536
+ }
1537
+ else {
1538
+ handlers_1.removeHandler('log.request');
1539
+ }
1540
+ }
1541
+ logs.registerGetLogHandler = registerGetLogHandler;
1542
+ })(logs = exports.logs || (exports.logs = {}));
1543
+
1544
+
1545
+ /***/ }),
1546
+ /* 14 */
1547
+ /***/ (function(module, exports, __webpack_require__) {
1548
+
1549
+ "use strict";
1550
+
1551
+ Object.defineProperty(exports, "__esModule", { value: true });
1552
+ var internalAPIs_1 = __webpack_require__(1);
1553
+ var constants_1 = __webpack_require__(2);
1554
+ var utils_1 = __webpack_require__(5);
1555
+ var communication_1 = __webpack_require__(0);
1556
+ var menus_1 = __webpack_require__(15);
1557
+ var handlers_1 = __webpack_require__(3);
1558
+ var globalVars_1 = __webpack_require__(6);
1559
+ var interfaces_1 = __webpack_require__(7);
1560
+ var constants_2 = __webpack_require__(4);
1561
+ function initializePrivateApis() {
1562
+ menus_1.menus.initialize();
1563
+ }
1564
+ exports.initializePrivateApis = initializePrivateApis;
1565
+ /**
1566
+ * @private
1567
+ * Hide from docs
1568
+ * ------
1569
+ * Allows an app to retrieve information of all user joined teams
1570
+ * @param callback The callback to invoke when the {@link TeamInstanceParameters} object is retrieved.
1571
+ * @param teamInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams
1572
+ */
1573
+ function getUserJoinedTeams(callback, teamInstanceParameters) {
1574
+ internalAPIs_1.ensureInitialized();
1575
+ if (globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.android &&
1576
+ !internalAPIs_1.isAPISupportedByPlatform(constants_2.getUserJoinedTeamsSupportedAndroidClientVersion)) {
1577
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
1578
+ throw new Error(JSON.stringify(oldPlatformError));
1579
+ }
1580
+ communication_1.sendMessageToParent('getUserJoinedTeams', [teamInstanceParameters], callback);
1581
+ }
1582
+ exports.getUserJoinedTeams = getUserJoinedTeams;
1583
+ /**
1584
+ * @private
1585
+ * Hide from docs
1586
+ * ------
1587
+ * Place the tab into full-screen mode.
1588
+ */
1589
+ function enterFullscreen() {
1590
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content);
1591
+ communication_1.sendMessageToParent('enterFullscreen', []);
1592
+ }
1593
+ exports.enterFullscreen = enterFullscreen;
1594
+ /**
1595
+ * @private
1596
+ * Hide from docs
1597
+ * ------
1598
+ * Reverts the tab into normal-screen mode.
1599
+ */
1600
+ function exitFullscreen() {
1601
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content);
1602
+ communication_1.sendMessageToParent('exitFullscreen', []);
1603
+ }
1604
+ exports.exitFullscreen = exitFullscreen;
1605
+ /**
1606
+ * @private
1607
+ * Hide from docs.
1608
+ * ------
1609
+ * Opens a client-friendly preview of the specified file.
1610
+ * @param file The file to preview.
1611
+ */
1612
+ function openFilePreview(filePreviewParameters) {
1613
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content);
1614
+ var params = [
1615
+ filePreviewParameters.entityId,
1616
+ filePreviewParameters.title,
1617
+ filePreviewParameters.description,
1618
+ filePreviewParameters.type,
1619
+ filePreviewParameters.objectUrl,
1620
+ filePreviewParameters.downloadUrl,
1621
+ filePreviewParameters.webPreviewUrl,
1622
+ filePreviewParameters.webEditUrl,
1623
+ filePreviewParameters.baseUrl,
1624
+ filePreviewParameters.editFile,
1625
+ filePreviewParameters.subEntityId,
1626
+ filePreviewParameters.viewerAction,
1627
+ filePreviewParameters.fileOpenPreference,
1628
+ ];
1629
+ communication_1.sendMessageToParent('openFilePreview', params);
1630
+ }
1631
+ exports.openFilePreview = openFilePreview;
1632
+ /**
1633
+ * @private
1634
+ * Hide from docs.
1635
+ * ------
1636
+ * display notification API.
1637
+ * @param message Notification message.
1638
+ * @param notificationType Notification type
1639
+ */
1640
+ function showNotification(showNotificationParameters) {
1641
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content);
1642
+ var params = [showNotificationParameters.message, showNotificationParameters.notificationType];
1643
+ communication_1.sendMessageToParent('showNotification', params);
1644
+ }
1645
+ exports.showNotification = showNotification;
1646
+ /**
1647
+ * @private
1648
+ * Hide from docs.
1649
+ * ------
1650
+ * Upload a custom App manifest directly to both team and personal scopes.
1651
+ * This method works just for the first party Apps.
1652
+ */
1653
+ function uploadCustomApp(manifestBlob, onComplete) {
1654
+ internalAPIs_1.ensureInitialized();
1655
+ communication_1.sendMessageToParent('uploadCustomApp', [manifestBlob], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler());
1656
+ }
1657
+ exports.uploadCustomApp = uploadCustomApp;
1658
+ /**
1659
+ * @private
1660
+ * Internal use only
1661
+ * Sends a custom action MessageRequest to Teams or parent window
1662
+ * @param actionName Specifies name of the custom action to be sent
1663
+ * @param args Specifies additional arguments passed to the action
1664
+ * @param callback Optionally specify a callback to receive response parameters from the parent
1665
+ * @returns id of sent message
1666
+ */
1667
+ function sendCustomMessage(actionName,
1668
+ // tslint:disable-next-line:no-any
1669
+ args,
1670
+ // tslint:disable-next-line:no-any
1671
+ callback) {
1672
+ internalAPIs_1.ensureInitialized();
1673
+ communication_1.sendMessageToParent(actionName, args, callback);
1674
+ }
1675
+ exports.sendCustomMessage = sendCustomMessage;
1676
+ /**
1677
+ * @private
1678
+ * Internal use only
1679
+ * Sends a custom action MessageEvent to a child iframe/window, only if you are not using auth popup.
1680
+ * Otherwise it will go to the auth popup (which becomes the child)
1681
+ * @param actionName Specifies name of the custom action to be sent
1682
+ * @param args Specifies additional arguments passed to the action
1683
+ * @returns id of sent message
1684
+ */
1685
+ function sendCustomEvent(actionName,
1686
+ // tslint:disable-next-line:no-any
1687
+ args) {
1688
+ internalAPIs_1.ensureInitialized();
1689
+ //validate childWindow
1690
+ if (!communication_1.Communication.childWindow) {
1691
+ throw new Error('The child window has not yet been initialized or is not present');
1692
+ }
1693
+ communication_1.sendMessageEventToChild(actionName, args);
1694
+ }
1695
+ exports.sendCustomEvent = sendCustomEvent;
1696
+ /**
1697
+ * @private
1698
+ * Internal use only
1699
+ * Adds a handler for an action sent by a child window or parent window
1700
+ * @param actionName Specifies name of the action message to handle
1701
+ * @param customHandler The callback to invoke when the action message is received. The return value is sent to the child
1702
+ */
1703
+ function registerCustomHandler(actionName, customHandler) {
1704
+ var _this = this;
1705
+ internalAPIs_1.ensureInitialized();
1706
+ handlers_1.registerHandler(actionName, function () {
1707
+ var args = [];
1708
+ for (var _i = 0; _i < arguments.length; _i++) {
1709
+ args[_i] = arguments[_i];
1710
+ }
1711
+ return customHandler.apply(_this, args);
1712
+ });
1713
+ }
1714
+ exports.registerCustomHandler = registerCustomHandler;
1715
+ /**
1716
+ * @private
1717
+ * Hide from docs
1718
+ * ------
1719
+ * Allows an app to retrieve information of all chat members
1720
+ * Because a malicious party run your content in a browser, this value should
1721
+ * be used only as a hint as to who the members are and never as proof of membership.
1722
+ * @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
1723
+ */
1724
+ function getChatMembers(callback) {
1725
+ internalAPIs_1.ensureInitialized();
1726
+ communication_1.sendMessageToParent('getChatMembers', callback);
1727
+ }
1728
+ exports.getChatMembers = getChatMembers;
1729
+ /**
1730
+ * @private
1731
+ * Hide from docs
1732
+ * ------
1733
+ * Allows an app to get the configuration setting value
1734
+ * @param callback The callback to invoke when the value is retrieved.
1735
+ * @param key The key for the config setting
1736
+ */
1737
+ function getConfigSetting(callback, key) {
1738
+ internalAPIs_1.ensureInitialized();
1739
+ communication_1.sendMessageToParent('getConfigSetting', [key], callback);
1740
+ }
1741
+ exports.getConfigSetting = getConfigSetting;
1742
+ /**
1743
+ * @private
1744
+ * register a handler to be called when a user setting changes. The changed setting type & value is provided in the callback.
1745
+ * @param settingTypes List of user setting changes to subscribe
1746
+ * @param handler When a subscribed setting is updated this handler is called
1747
+ */
1748
+ function registerUserSettingsChangeHandler(settingTypes, handler) {
1749
+ internalAPIs_1.ensureInitialized();
1750
+ handlers_1.registerHandler('userSettingsChange', handler, true, [settingTypes]);
1751
+ }
1752
+ exports.registerUserSettingsChangeHandler = registerUserSettingsChangeHandler;
1753
+
1754
+
1755
+ /***/ }),
1756
+ /* 15 */
1757
+ /***/ (function(module, exports, __webpack_require__) {
1758
+
1759
+ "use strict";
1760
+
1761
+ Object.defineProperty(exports, "__esModule", { value: true });
1762
+ var internalAPIs_1 = __webpack_require__(1);
1763
+ var communication_1 = __webpack_require__(0);
1764
+ var handlers_1 = __webpack_require__(3);
1765
+ /**
1766
+ * Namespace to interact with the menu-specific part of the SDK.
1767
+ * This object is used to show View Configuration, Action Menu and Navigation Bar Menu.
1768
+ *
1769
+ * @private
1770
+ * Hide from docs until feature is complete
1771
+ */
1772
+ var menus;
1773
+ (function (menus) {
1774
+ /**
1775
+ * Represents information about menu item for Action Menu and Navigation Bar Menu.
1776
+ */
1777
+ var MenuItem = /** @class */ (function () {
1778
+ function MenuItem() {
1779
+ /**
1780
+ * State of the menu item
1781
+ */
1782
+ this.enabled = true;
1783
+ /**
1784
+ * Whether the menu item is selected or not
1785
+ */
1786
+ this.selected = false;
1787
+ }
1788
+ return MenuItem;
1789
+ }());
1790
+ menus.MenuItem = MenuItem;
1791
+ /**
1792
+ * Represents information about type of list to display in Navigation Bar Menu.
1793
+ */
1794
+ var MenuListType;
1795
+ (function (MenuListType) {
1796
+ MenuListType["dropDown"] = "dropDown";
1797
+ MenuListType["popOver"] = "popOver";
1798
+ })(MenuListType = menus.MenuListType || (menus.MenuListType = {}));
1799
+ var navBarMenuItemPressHandler;
1800
+ var actionMenuItemPressHandler;
1801
+ var viewConfigItemPressHandler;
1802
+ function initialize() {
1803
+ handlers_1.registerHandler('navBarMenuItemPress', handleNavBarMenuItemPress, false);
1804
+ handlers_1.registerHandler('actionMenuItemPress', handleActionMenuItemPress, false);
1805
+ handlers_1.registerHandler('setModuleView', handleViewConfigItemPress, false);
1806
+ }
1807
+ menus.initialize = initialize;
1808
+ /**
1809
+ * Registers list of view configurations and it's handler.
1810
+ * Handler is responsible for listening selection of View Configuration.
1811
+ * @param viewConfig List of view configurations. Minimum 1 value is required.
1812
+ * @param handler The handler to invoke when the user selects view configuration.
1813
+ */
1814
+ function setUpViews(viewConfig, handler) {
1815
+ internalAPIs_1.ensureInitialized();
1816
+ viewConfigItemPressHandler = handler;
1817
+ communication_1.sendMessageToParent('setUpViews', [viewConfig]);
1818
+ }
1819
+ menus.setUpViews = setUpViews;
1820
+ function handleViewConfigItemPress(id) {
1821
+ if (!viewConfigItemPressHandler || !viewConfigItemPressHandler(id)) {
1822
+ internalAPIs_1.ensureInitialized();
1823
+ communication_1.sendMessageToParent('viewConfigItemPress', [id]);
1824
+ }
1825
+ }
1826
+ /**
1827
+ * Used to set menu items on the Navigation Bar. If icon is available, icon will be shown, otherwise title will be shown.
1828
+ * @param items List of MenuItems for Navigation Bar Menu.
1829
+ * @param handler The handler to invoke when the user selects menu item.
1830
+ */
1831
+ function setNavBarMenu(items, handler) {
1832
+ internalAPIs_1.ensureInitialized();
1833
+ navBarMenuItemPressHandler = handler;
1834
+ communication_1.sendMessageToParent('setNavBarMenu', [items]);
1835
+ }
1836
+ menus.setNavBarMenu = setNavBarMenu;
1837
+ function handleNavBarMenuItemPress(id) {
1838
+ if (!navBarMenuItemPressHandler || !navBarMenuItemPressHandler(id)) {
1839
+ internalAPIs_1.ensureInitialized();
1840
+ communication_1.sendMessageToParent('handleNavBarMenuItemPress', [id]);
1841
+ }
1842
+ }
1843
+ /**
1844
+ * Used to show Action Menu.
1845
+ * @param params Parameters for Menu Parameters
1846
+ * @param handler The handler to invoke when the user selects menu item.
1847
+ */
1848
+ function showActionMenu(params, handler) {
1849
+ internalAPIs_1.ensureInitialized();
1850
+ actionMenuItemPressHandler = handler;
1851
+ communication_1.sendMessageToParent('showActionMenu', [params]);
1852
+ }
1853
+ menus.showActionMenu = showActionMenu;
1854
+ function handleActionMenuItemPress(id) {
1855
+ if (!actionMenuItemPressHandler || !actionMenuItemPressHandler(id)) {
1856
+ internalAPIs_1.ensureInitialized();
1857
+ communication_1.sendMessageToParent('handleActionMenuItemPress', [id]);
1858
+ }
1859
+ }
1860
+ })(menus = exports.menus || (exports.menus = {}));
1861
+
1862
+
1863
+ /***/ }),
1864
+ /* 16 */
1865
+ /***/ (function(module, exports, __webpack_require__) {
1866
+
1867
+ "use strict";
1868
+
1869
+ Object.defineProperty(exports, "__esModule", { value: true });
1870
+ var internalAPIs_1 = __webpack_require__(1);
1871
+ var constants_1 = __webpack_require__(2);
1872
+ var utils_1 = __webpack_require__(5);
1873
+ var communication_1 = __webpack_require__(0);
1874
+ var handlers_1 = __webpack_require__(3);
1875
+ var ChildAppWindow = /** @class */ (function () {
1876
+ function ChildAppWindow() {
1877
+ }
1878
+ ChildAppWindow.prototype.postMessage = function (message, onComplete) {
1879
+ internalAPIs_1.ensureInitialized();
1880
+ communication_1.sendMessageToParent('messageForChild', [message], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler());
1881
+ };
1882
+ ChildAppWindow.prototype.addEventListener = function (type, listener) {
1883
+ if (type === 'message') {
1884
+ handlers_1.registerHandler('messageForParent', listener);
1885
+ }
1886
+ };
1887
+ return ChildAppWindow;
1888
+ }());
1889
+ exports.ChildAppWindow = ChildAppWindow;
1890
+ var ParentAppWindow = /** @class */ (function () {
1891
+ function ParentAppWindow() {
1892
+ }
1893
+ Object.defineProperty(ParentAppWindow, "Instance", {
1894
+ get: function () {
1895
+ // Do you need arguments? Make it a regular method instead.
1896
+ return this._instance || (this._instance = new this());
1897
+ },
1898
+ enumerable: true,
1899
+ configurable: true
1900
+ });
1901
+ ParentAppWindow.prototype.postMessage = function (message, onComplete) {
1902
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.task);
1903
+ communication_1.sendMessageToParent('messageForParent', [message], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler());
1904
+ };
1905
+ ParentAppWindow.prototype.addEventListener = function (type, listener) {
1906
+ if (type === 'message') {
1907
+ handlers_1.registerHandler('messageForChild', listener);
1908
+ }
1909
+ };
1910
+ return ParentAppWindow;
1911
+ }());
1912
+ exports.ParentAppWindow = ParentAppWindow;
1913
+
1914
+
1915
+ /***/ }),
1916
+ /* 17 */
1917
+ /***/ (function(module, exports, __webpack_require__) {
1918
+
1919
+ "use strict";
1920
+
1921
+ var __extends = (this && this.__extends) || (function () {
1922
+ var extendStatics = Object.setPrototypeOf ||
1923
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1924
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
1925
+ return function (d, b) {
1926
+ extendStatics(d, b);
1927
+ function __() { this.constructor = d; }
1928
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1929
+ };
1930
+ })();
1931
+ Object.defineProperty(exports, "__esModule", { value: true });
1932
+ var globalVars_1 = __webpack_require__(6);
1933
+ var interfaces_1 = __webpack_require__(7);
1934
+ var internalAPIs_1 = __webpack_require__(1);
1935
+ var constants_1 = __webpack_require__(2);
1936
+ var utils_1 = __webpack_require__(5);
1937
+ var mediaUtil_1 = __webpack_require__(18);
1938
+ var communication_1 = __webpack_require__(0);
1939
+ var handlers_1 = __webpack_require__(3);
1940
+ var constants_2 = __webpack_require__(4);
1941
+ var media;
1942
+ (function (media) {
1943
+ /**
1944
+ * Enum for file formats supported
1945
+ */
1946
+ var FileFormat;
1947
+ (function (FileFormat) {
1948
+ FileFormat["Base64"] = "base64";
1949
+ FileFormat["ID"] = "id";
1950
+ })(FileFormat = media.FileFormat || (media.FileFormat = {}));
1951
+ /**
1952
+ * File object that can be used to represent image or video or audio
1953
+ */
1954
+ var File = /** @class */ (function () {
1955
+ function File() {
1956
+ }
1957
+ return File;
1958
+ }());
1959
+ media.File = File;
1960
+ /**
1961
+ * Launch camera, capture image or choose image from gallery and return the images as a File[] object to the callback.
1962
+ * Callback will be called with an error, if there are any. App should first check the error.
1963
+ * If it is present the user can be updated with appropriate error message.
1964
+ * If error is null or undefined, then files will have the required result.
1965
+ * Note: Currently we support getting one File through this API, i.e. the file arrays size will be one.
1966
+ * Note: For desktop, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
1967
+ * @see File
1968
+ * @see SdkError
1969
+ */
1970
+ function captureImage(callback) {
1971
+ if (!callback) {
1972
+ throw new Error('[captureImage] Callback cannot be null');
1973
+ }
1974
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task);
1975
+ if (!globalVars_1.GlobalVars.isFramelessWindow) {
1976
+ var notSupportedError = { errorCode: interfaces_1.ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
1977
+ callback(notSupportedError, undefined);
1978
+ return;
1979
+ }
1980
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.captureImageMobileSupportVersion)) {
1981
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
1982
+ callback(oldPlatformError, undefined);
1983
+ return;
1984
+ }
1985
+ communication_1.sendMessageToParent('captureImage', callback);
1986
+ }
1987
+ media.captureImage = captureImage;
1988
+ /**
1989
+ * Media object returned by the select Media API
1990
+ */
1991
+ var Media = /** @class */ (function (_super) {
1992
+ __extends(Media, _super);
1993
+ function Media(that) {
1994
+ if (that === void 0) { that = null; }
1995
+ var _this = _super.call(this) || this;
1996
+ if (that) {
1997
+ _this.content = that.content;
1998
+ _this.format = that.format;
1999
+ _this.mimeType = that.mimeType;
2000
+ _this.name = that.name;
2001
+ _this.preview = that.preview;
2002
+ _this.size = that.size;
2003
+ }
2004
+ return _this;
2005
+ }
2006
+ /**
2007
+ * Gets the media in chunks irrespecitve of size, these chunks are assembled and sent back to the webapp as file/blob
2008
+ * @param callback returns blob of media
2009
+ */
2010
+ Media.prototype.getMedia = function (callback) {
2011
+ if (!callback) {
2012
+ throw new Error('[get Media] Callback cannot be null');
2013
+ }
2014
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task);
2015
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.mediaAPISupportVersion)) {
2016
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
2017
+ callback(oldPlatformError, null);
2018
+ return;
2019
+ }
2020
+ if (!mediaUtil_1.validateGetMediaInputs(this.mimeType, this.format, this.content)) {
2021
+ var invalidInput = { errorCode: interfaces_1.ErrorCode.INVALID_ARGUMENTS };
2022
+ callback(invalidInput, null);
2023
+ return;
2024
+ }
2025
+ // Call the new get media implementation via callbacks if the client version is greater than or equal to '2.0.0'
2026
+ if (internalAPIs_1.isAPISupportedByPlatform(constants_2.getMediaCallbackSupportVersion)) {
2027
+ this.getMediaViaCallback(callback);
2028
+ }
2029
+ else {
2030
+ this.getMediaViaHandler(callback);
2031
+ }
2032
+ };
2033
+ Media.prototype.getMediaViaCallback = function (callback) {
2034
+ var helper = {
2035
+ mediaMimeType: this.mimeType,
2036
+ assembleAttachment: [],
2037
+ };
2038
+ var localUriId = [this.content];
2039
+ function handleGetMediaCallbackRequest(mediaResult) {
2040
+ if (callback) {
2041
+ if (mediaResult && mediaResult.error) {
2042
+ callback(mediaResult.error, null);
2043
+ }
2044
+ else {
2045
+ if (mediaResult && mediaResult.mediaChunk) {
2046
+ // If the chunksequence number is less than equal to 0 implies EOF
2047
+ // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
2048
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
2049
+ var file = mediaUtil_1.createFile(helper.assembleAttachment, helper.mediaMimeType);
2050
+ callback(mediaResult.error, file);
2051
+ }
2052
+ else {
2053
+ // Keep pushing chunks into assemble attachment
2054
+ var assemble = mediaUtil_1.decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
2055
+ helper.assembleAttachment.push(assemble);
2056
+ }
2057
+ }
2058
+ else {
2059
+ callback({ errorCode: interfaces_1.ErrorCode.INTERNAL_ERROR, message: 'data receieved is null' }, null);
2060
+ }
2061
+ }
2062
+ }
2063
+ }
2064
+ communication_1.sendMessageToParent('getMedia', localUriId, handleGetMediaCallbackRequest);
2065
+ };
2066
+ Media.prototype.getMediaViaHandler = function (callback) {
2067
+ var actionName = utils_1.generateGUID();
2068
+ var helper = {
2069
+ mediaMimeType: this.mimeType,
2070
+ assembleAttachment: [],
2071
+ };
2072
+ var params = [actionName, this.content];
2073
+ this.content && callback && communication_1.sendMessageToParent('getMedia', params);
2074
+ function handleGetMediaRequest(response) {
2075
+ if (callback) {
2076
+ var mediaResult = JSON.parse(response);
2077
+ if (mediaResult.error) {
2078
+ callback(mediaResult.error, null);
2079
+ handlers_1.removeHandler('getMedia' + actionName);
2080
+ }
2081
+ else {
2082
+ if (mediaResult.mediaChunk) {
2083
+ // If the chunksequence number is less than equal to 0 implies EOF
2084
+ // create file/blob when all chunks have arrived and we get 0/-1 as chunksequence number
2085
+ if (mediaResult.mediaChunk.chunkSequence <= 0) {
2086
+ var file = mediaUtil_1.createFile(helper.assembleAttachment, helper.mediaMimeType);
2087
+ callback(mediaResult.error, file);
2088
+ handlers_1.removeHandler('getMedia' + actionName);
2089
+ }
2090
+ else {
2091
+ // Keep pushing chunks into assemble attachment
2092
+ var assemble = mediaUtil_1.decodeAttachment(mediaResult.mediaChunk, helper.mediaMimeType);
2093
+ helper.assembleAttachment.push(assemble);
2094
+ }
2095
+ }
2096
+ else {
2097
+ callback({ errorCode: interfaces_1.ErrorCode.INTERNAL_ERROR, message: 'data receieved is null' }, null);
2098
+ handlers_1.removeHandler('getMedia' + actionName);
2099
+ }
2100
+ }
2101
+ }
2102
+ }
2103
+ handlers_1.registerHandler('getMedia' + actionName, handleGetMediaRequest);
2104
+ };
2105
+ return Media;
2106
+ }(File));
2107
+ media.Media = Media;
2108
+ /**
2109
+ * The modes in which camera can be launched in select Media API
2110
+ */
2111
+ var CameraStartMode;
2112
+ (function (CameraStartMode) {
2113
+ CameraStartMode[CameraStartMode["Photo"] = 1] = "Photo";
2114
+ CameraStartMode[CameraStartMode["Document"] = 2] = "Document";
2115
+ CameraStartMode[CameraStartMode["Whiteboard"] = 3] = "Whiteboard";
2116
+ CameraStartMode[CameraStartMode["BusinessCard"] = 4] = "BusinessCard";
2117
+ })(CameraStartMode = media.CameraStartMode || (media.CameraStartMode = {}));
2118
+ /**
2119
+ * Specifies the image source
2120
+ */
2121
+ var Source;
2122
+ (function (Source) {
2123
+ Source[Source["Camera"] = 1] = "Camera";
2124
+ Source[Source["Gallery"] = 2] = "Gallery";
2125
+ })(Source = media.Source || (media.Source = {}));
2126
+ /**
2127
+ * Specifies the type of Media
2128
+ */
2129
+ var MediaType;
2130
+ (function (MediaType) {
2131
+ MediaType[MediaType["Image"] = 1] = "Image";
2132
+ // Video = 2, // Not implemented yet
2133
+ // ImageOrVideo = 3, // Not implemented yet
2134
+ MediaType[MediaType["Audio"] = 4] = "Audio";
2135
+ })(MediaType = media.MediaType || (media.MediaType = {}));
2136
+ /**
2137
+ * ID contains a mapping for content uri on platform's side, URL is generic
2138
+ */
2139
+ var ImageUriType;
2140
+ (function (ImageUriType) {
2141
+ ImageUriType[ImageUriType["ID"] = 1] = "ID";
2142
+ ImageUriType[ImageUriType["URL"] = 2] = "URL";
2143
+ })(ImageUriType = media.ImageUriType || (media.ImageUriType = {}));
2144
+ /**
2145
+ * Select an attachment using camera/gallery
2146
+ * @param mediaInputs The input params to customize the media to be selected
2147
+ * @param callback The callback to invoke after fetching the media
2148
+ */
2149
+ function selectMedia(mediaInputs, callback) {
2150
+ if (!callback) {
2151
+ throw new Error('[select Media] Callback cannot be null');
2152
+ }
2153
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task);
2154
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.mediaAPISupportVersion)) {
2155
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
2156
+ callback(oldPlatformError, null);
2157
+ return;
2158
+ }
2159
+ if (!mediaUtil_1.validateSelectMediaInputs(mediaInputs)) {
2160
+ var invalidInput = { errorCode: interfaces_1.ErrorCode.INVALID_ARGUMENTS };
2161
+ callback(invalidInput, null);
2162
+ return;
2163
+ }
2164
+ var params = [mediaInputs];
2165
+ // What comes back from native at attachments would just be objects and will be missing getMedia method on them.
2166
+ communication_1.sendMessageToParent('selectMedia', params, function (err, localAttachments) {
2167
+ if (!localAttachments) {
2168
+ callback(err, null);
2169
+ return;
2170
+ }
2171
+ var mediaArray = [];
2172
+ for (var _i = 0, localAttachments_1 = localAttachments; _i < localAttachments_1.length; _i++) {
2173
+ var attachment = localAttachments_1[_i];
2174
+ mediaArray.push(new Media(attachment));
2175
+ }
2176
+ callback(err, mediaArray);
2177
+ });
2178
+ }
2179
+ media.selectMedia = selectMedia;
2180
+ /**
2181
+ * View images using native image viewer
2182
+ * @param uriList urilist of images to be viewed - can be content uri or server url. supports upto 10 Images in one go
2183
+ * @param callback returns back error if encountered, returns null in case of success
2184
+ */
2185
+ function viewImages(uriList, callback) {
2186
+ if (!callback) {
2187
+ throw new Error('[view images] Callback cannot be null');
2188
+ }
2189
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task);
2190
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.mediaAPISupportVersion)) {
2191
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
2192
+ callback(oldPlatformError);
2193
+ return;
2194
+ }
2195
+ if (!mediaUtil_1.validateViewImagesInput(uriList)) {
2196
+ var invalidInput = { errorCode: interfaces_1.ErrorCode.INVALID_ARGUMENTS };
2197
+ callback(invalidInput);
2198
+ return;
2199
+ }
2200
+ var params = [uriList];
2201
+ communication_1.sendMessageToParent('viewImages', params, callback);
2202
+ }
2203
+ media.viewImages = viewImages;
2204
+ /**
2205
+ * Scan Barcode/QRcode using camera
2206
+ * Note: For desktop and web, this API is not supported. Callback will be resolved with ErrorCode.NotSupported.
2207
+ * @param callback callback to invoke after scanning the barcode
2208
+ * @param config optional input configuration to customize the barcode scanning experience
2209
+ */
2210
+ function scanBarCode(callback, config) {
2211
+ if (!callback) {
2212
+ throw new Error('[media.scanBarCode] Callback cannot be null');
2213
+ }
2214
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task);
2215
+ if (globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.desktop ||
2216
+ globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.web ||
2217
+ globalVars_1.GlobalVars.hostClientType === constants_1.HostClientType.rigel) {
2218
+ var notSupportedError = { errorCode: interfaces_1.ErrorCode.NOT_SUPPORTED_ON_PLATFORM };
2219
+ callback(notSupportedError, null);
2220
+ return;
2221
+ }
2222
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.scanBarCodeAPIMobileSupportVersion)) {
2223
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
2224
+ callback(oldPlatformError, null);
2225
+ return;
2226
+ }
2227
+ if (!mediaUtil_1.validateScanBarCodeInput(config)) {
2228
+ var invalidInput = { errorCode: interfaces_1.ErrorCode.INVALID_ARGUMENTS };
2229
+ callback(invalidInput, null);
2230
+ return;
2231
+ }
2232
+ communication_1.sendMessageToParent('media.scanBarCode', [config], callback);
2233
+ }
2234
+ media.scanBarCode = scanBarCode;
2235
+ })(media = exports.media || (exports.media = {}));
2236
+
2237
+
2238
+ /***/ }),
2239
+ /* 18 */
2240
+ /***/ (function(module, exports, __webpack_require__) {
2241
+
2242
+ "use strict";
2243
+
2244
+ Object.defineProperty(exports, "__esModule", { value: true });
2245
+ var media_1 = __webpack_require__(17);
2246
+ /**
2247
+ * Helper function to create a blob from media chunks based on their sequence
2248
+ */
2249
+ function createFile(assembleAttachment, mimeType) {
2250
+ if (assembleAttachment == null || mimeType == null || assembleAttachment.length <= 0) {
2251
+ return null;
2252
+ }
2253
+ var file;
2254
+ var sequence = 1;
2255
+ assembleAttachment.sort(function (a, b) { return (a.sequence > b.sequence ? 1 : -1); });
2256
+ assembleAttachment.forEach(function (item) {
2257
+ if (item.sequence == sequence) {
2258
+ if (file) {
2259
+ file = new Blob([file, item.file], { type: mimeType });
2260
+ }
2261
+ else {
2262
+ file = new Blob([item.file], { type: mimeType });
2263
+ }
2264
+ sequence++;
2265
+ }
2266
+ });
2267
+ return file;
2268
+ }
2269
+ exports.createFile = createFile;
2270
+ /**
2271
+ * Helper function to convert Media chunks into another object type which can be later assemebled
2272
+ * Converts base 64 encoded string to byte array and then into an array of blobs
2273
+ */
2274
+ function decodeAttachment(attachment, mimeType) {
2275
+ if (attachment == null || mimeType == null) {
2276
+ return null;
2277
+ }
2278
+ var decoded = atob(attachment.chunk);
2279
+ var byteNumbers = new Array(decoded.length);
2280
+ for (var i = 0; i < decoded.length; i++) {
2281
+ byteNumbers[i] = decoded.charCodeAt(i);
2282
+ }
2283
+ var byteArray = new Uint8Array(byteNumbers);
2284
+ var blob = new Blob([byteArray], { type: mimeType });
2285
+ var assemble = {
2286
+ sequence: attachment.chunkSequence,
2287
+ file: blob,
2288
+ };
2289
+ return assemble;
2290
+ }
2291
+ exports.decodeAttachment = decodeAttachment;
2292
+ /**
2293
+ * Returns true if the mediaInput params are valid and false otherwise
2294
+ */
2295
+ function validateSelectMediaInputs(mediaInputs) {
2296
+ if (mediaInputs == null || mediaInputs.maxMediaCount > 10) {
2297
+ return false;
2298
+ }
2299
+ return true;
2300
+ }
2301
+ exports.validateSelectMediaInputs = validateSelectMediaInputs;
2302
+ /**
2303
+ * Returns true if the get Media params are valid and false otherwise
2304
+ */
2305
+ function validateGetMediaInputs(mimeType, format, content) {
2306
+ if (mimeType == null || format == null || format != media_1.media.FileFormat.ID || content == null) {
2307
+ return false;
2308
+ }
2309
+ return true;
2310
+ }
2311
+ exports.validateGetMediaInputs = validateGetMediaInputs;
2312
+ /**
2313
+ * Returns true if the view images param is valid and false otherwise
2314
+ */
2315
+ function validateViewImagesInput(uriList) {
2316
+ if (uriList == null || uriList.length <= 0 || uriList.length > 10) {
2317
+ return false;
2318
+ }
2319
+ return true;
2320
+ }
2321
+ exports.validateViewImagesInput = validateViewImagesInput;
2322
+ /**
2323
+ * Returns true if the scan barcode param is valid and false otherwise
2324
+ */
2325
+ function validateScanBarCodeInput(barCodeConfig) {
2326
+ if (barCodeConfig) {
2327
+ if (barCodeConfig.timeOutIntervalInSec === null ||
2328
+ barCodeConfig.timeOutIntervalInSec <= 0 ||
2329
+ barCodeConfig.timeOutIntervalInSec > 60) {
2330
+ return false;
2331
+ }
2332
+ }
2333
+ return true;
2334
+ }
2335
+ exports.validateScanBarCodeInput = validateScanBarCodeInput;
2336
+ /**
2337
+ * Returns true if the people picker params are valid and false otherwise
2338
+ */
2339
+ function validatePeoplePickerInput(peoplePickerInputs) {
2340
+ if (peoplePickerInputs) {
2341
+ if (peoplePickerInputs.title) {
2342
+ if (typeof peoplePickerInputs.title !== 'string') {
2343
+ return false;
2344
+ }
2345
+ }
2346
+ if (peoplePickerInputs.setSelected) {
2347
+ if (typeof peoplePickerInputs.setSelected !== 'object') {
2348
+ return false;
2349
+ }
2350
+ }
2351
+ if (peoplePickerInputs.openOrgWideSearchInChatOrChannel) {
2352
+ if (typeof peoplePickerInputs.openOrgWideSearchInChatOrChannel !== 'boolean') {
2353
+ return false;
2354
+ }
2355
+ }
2356
+ if (peoplePickerInputs.singleSelect) {
2357
+ if (typeof peoplePickerInputs.singleSelect !== 'boolean') {
2358
+ return false;
2359
+ }
2360
+ }
2361
+ }
2362
+ return true;
2363
+ }
2364
+ exports.validatePeoplePickerInput = validatePeoplePickerInput;
2365
+
2366
+
2367
+ /***/ }),
2368
+ /* 19 */
2369
+ /***/ (function(module, exports, __webpack_require__) {
2370
+
2371
+ "use strict";
2372
+
2373
+ function __export(m) {
2374
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
2375
+ }
2376
+ Object.defineProperty(exports, "__esModule", { value: true });
2377
+ __export(__webpack_require__(20));
2378
+ __export(__webpack_require__(8));
2379
+
2380
+
2381
+ /***/ }),
2382
+ /* 20 */
2383
+ /***/ (function(module, exports, __webpack_require__) {
2384
+
2385
+ "use strict";
2386
+
2387
+ Object.defineProperty(exports, "__esModule", { value: true });
2388
+ var bot_1 = __webpack_require__(21);
2389
+ exports.bot = bot_1.bot;
2390
+ var menus_1 = __webpack_require__(15);
2391
+ exports.menus = menus_1.menus;
2392
+ var logs_1 = __webpack_require__(13);
2393
+ exports.logs = logs_1.logs;
2394
+ var interfaces_1 = __webpack_require__(32);
2395
+ exports.NotificationTypes = interfaces_1.NotificationTypes;
2396
+ exports.ViewerActionTypes = interfaces_1.ViewerActionTypes;
2397
+ exports.UserSettingTypes = interfaces_1.UserSettingTypes;
2398
+ var privateAPIs_1 = __webpack_require__(14);
2399
+ exports.enterFullscreen = privateAPIs_1.enterFullscreen;
2400
+ exports.exitFullscreen = privateAPIs_1.exitFullscreen;
2401
+ exports.getChatMembers = privateAPIs_1.getChatMembers;
2402
+ exports.getConfigSetting = privateAPIs_1.getConfigSetting;
2403
+ exports.getUserJoinedTeams = privateAPIs_1.getUserJoinedTeams;
2404
+ exports.openFilePreview = privateAPIs_1.openFilePreview;
2405
+ exports.sendCustomMessage = privateAPIs_1.sendCustomMessage;
2406
+ exports.showNotification = privateAPIs_1.showNotification;
2407
+ exports.sendCustomEvent = privateAPIs_1.sendCustomEvent;
2408
+ exports.registerCustomHandler = privateAPIs_1.registerCustomHandler;
2409
+ exports.uploadCustomApp = privateAPIs_1.uploadCustomApp;
2410
+ exports.registerUserSettingsChangeHandler = privateAPIs_1.registerUserSettingsChangeHandler;
2411
+ var conversations_1 = __webpack_require__(33);
2412
+ exports.conversations = conversations_1.conversations;
2413
+ var meetingRoom_1 = __webpack_require__(34);
2414
+ exports.meetingRoom = meetingRoom_1.meetingRoom;
2415
+ var remoteCamera_1 = __webpack_require__(35);
2416
+ exports.remoteCamera = remoteCamera_1.remoteCamera;
2417
+ var files_1 = __webpack_require__(36);
2418
+ exports.files = files_1.files;
2419
+ var appEntity_1 = __webpack_require__(37);
2420
+ exports.appEntity = appEntity_1.appEntity;
2421
+
2422
+
2423
+ /***/ }),
2424
+ /* 21 */
2425
+ /***/ (function(module, exports, __webpack_require__) {
2426
+
2427
+ "use strict";
2428
+
2429
+ Object.defineProperty(exports, "__esModule", { value: true });
2430
+ var communication_1 = __webpack_require__(0);
2431
+ var internalAPIs_1 = __webpack_require__(1);
2432
+ /**
2433
+ * @private
2434
+ * Namespace to interact with bots using the SDK.
2435
+ */
2436
+ var bot;
2437
+ (function (bot) {
2438
+ /**
2439
+ * @private
2440
+ * Hide from docs until release.
2441
+ * ------
2442
+ * Sends query to bot in order to retrieve data.
2443
+ * @param botRequest query to send to bot.
2444
+ * @param onSuccess callback to invoke when data is retrieved from bot
2445
+ * @param onError callback to invoke should an error occur
2446
+ */
2447
+ function sendQuery(botRequest, onSuccess, onError) {
2448
+ internalAPIs_1.ensureInitialized();
2449
+ communication_1.sendMessageToParent('bot.executeQuery', [botRequest], function (success, response) {
2450
+ if (success) {
2451
+ onSuccess(response);
2452
+ }
2453
+ else {
2454
+ onError(response);
2455
+ }
2456
+ });
2457
+ }
2458
+ bot.sendQuery = sendQuery;
2459
+ /**
2460
+ * @private
2461
+ * Hide from docs until release.
2462
+ * -----
2463
+ * Retrieves list of support commands from bot
2464
+ * @param onSuccess callback to invoke when data is retrieved from bot
2465
+ * @param onError callback to invoke should an error occur
2466
+ */
2467
+ function getSupportedCommands(onSuccess, onError) {
2468
+ internalAPIs_1.ensureInitialized();
2469
+ communication_1.sendMessageToParent('bot.getSupportedCommands', function (success, response) {
2470
+ if (success) {
2471
+ onSuccess(response);
2472
+ }
2473
+ else {
2474
+ onError(response);
2475
+ }
2476
+ });
2477
+ }
2478
+ bot.getSupportedCommands = getSupportedCommands;
2479
+ /**
2480
+ * @private
2481
+ * Hide from docs until release.
2482
+ * -----
2483
+ * Authenticates a user for json tab
2484
+ * @param authRequest callback to invoke when data is retrieved from bot
2485
+ * @param onSuccess callback to invoke when user is authenticated
2486
+ * @param onError callback to invoke should an error occur
2487
+ */
2488
+ function authenticate(authRequest, onSuccess, onError) {
2489
+ internalAPIs_1.ensureInitialized();
2490
+ communication_1.sendMessageToParent('bot.authenticate', [authRequest], function (success, response) {
2491
+ if (success) {
2492
+ onSuccess(response);
2493
+ }
2494
+ else {
2495
+ onError(response);
2496
+ }
2497
+ });
2498
+ }
2499
+ bot.authenticate = authenticate;
2500
+ var ResponseType;
2501
+ (function (ResponseType) {
2502
+ ResponseType["Results"] = "Results";
2503
+ ResponseType["Auth"] = "Auth";
2504
+ })(ResponseType = bot.ResponseType || (bot.ResponseType = {}));
2505
+ })(bot = exports.bot || (exports.bot = {}));
2506
+
2507
+
2508
+ /***/ }),
2509
+ /* 22 */
2510
+ /***/ (function(module, exports, __webpack_require__) {
2511
+
2512
+ var v1 = __webpack_require__(23);
2513
+ var v4 = __webpack_require__(24);
2514
+
2515
+ var uuid = v4;
2516
+ uuid.v1 = v1;
2517
+ uuid.v4 = v4;
2518
+
2519
+ module.exports = uuid;
2520
+
2521
+
2522
+ /***/ }),
2523
+ /* 23 */
2524
+ /***/ (function(module, exports, __webpack_require__) {
2525
+
2526
+ var rng = __webpack_require__(9);
2527
+ var bytesToUuid = __webpack_require__(10);
2528
+
2529
+ // **`v1()` - Generate time-based UUID**
2530
+ //
2531
+ // Inspired by https://github.com/LiosK/UUID.js
2532
+ // and http://docs.python.org/library/uuid.html
2533
+
2534
+ var _nodeId;
2535
+ var _clockseq;
2536
+
2537
+ // Previous uuid creation time
2538
+ var _lastMSecs = 0;
2539
+ var _lastNSecs = 0;
2540
+
2541
+ // See https://github.com/broofa/node-uuid for API details
2542
+ function v1(options, buf, offset) {
2543
+ var i = buf && offset || 0;
2544
+ var b = buf || [];
2545
+
2546
+ options = options || {};
2547
+ var node = options.node || _nodeId;
2548
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
2549
+
2550
+ // node and clockseq need to be initialized to random values if they're not
2551
+ // specified. We do this lazily to minimize issues related to insufficient
2552
+ // system entropy. See #189
2553
+ if (node == null || clockseq == null) {
2554
+ var seedBytes = rng();
2555
+ if (node == null) {
2556
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
2557
+ node = _nodeId = [
2558
+ seedBytes[0] | 0x01,
2559
+ seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
2560
+ ];
2561
+ }
2562
+ if (clockseq == null) {
2563
+ // Per 4.2.2, randomize (14 bit) clockseq
2564
+ clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
2565
+ }
2566
+ }
2567
+
2568
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
2569
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
2570
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
2571
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
2572
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
2573
+
2574
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
2575
+ // cycle to simulate higher resolution clock
2576
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
2577
+
2578
+ // Time since last uuid creation (in msecs)
2579
+ var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
2580
+
2581
+ // Per 4.2.1.2, Bump clockseq on clock regression
2582
+ if (dt < 0 && options.clockseq === undefined) {
2583
+ clockseq = clockseq + 1 & 0x3fff;
2584
+ }
2585
+
2586
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
2587
+ // time interval
2588
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
2589
+ nsecs = 0;
2590
+ }
2591
+
2592
+ // Per 4.2.1.2 Throw error if too many uuids are requested
2593
+ if (nsecs >= 10000) {
2594
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
2595
+ }
2596
+
2597
+ _lastMSecs = msecs;
2598
+ _lastNSecs = nsecs;
2599
+ _clockseq = clockseq;
2600
+
2601
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
2602
+ msecs += 12219292800000;
2603
+
2604
+ // `time_low`
2605
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
2606
+ b[i++] = tl >>> 24 & 0xff;
2607
+ b[i++] = tl >>> 16 & 0xff;
2608
+ b[i++] = tl >>> 8 & 0xff;
2609
+ b[i++] = tl & 0xff;
2610
+
2611
+ // `time_mid`
2612
+ var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
2613
+ b[i++] = tmh >>> 8 & 0xff;
2614
+ b[i++] = tmh & 0xff;
2615
+
2616
+ // `time_high_and_version`
2617
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
2618
+ b[i++] = tmh >>> 16 & 0xff;
2619
+
2620
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
2621
+ b[i++] = clockseq >>> 8 | 0x80;
2622
+
2623
+ // `clock_seq_low`
2624
+ b[i++] = clockseq & 0xff;
2625
+
2626
+ // `node`
2627
+ for (var n = 0; n < 6; ++n) {
2628
+ b[i + n] = node[n];
2629
+ }
2630
+
2631
+ return buf ? buf : bytesToUuid(b);
2632
+ }
2633
+
2634
+ module.exports = v1;
2635
+
2636
+
2637
+ /***/ }),
2638
+ /* 24 */
2639
+ /***/ (function(module, exports, __webpack_require__) {
2640
+
2641
+ var rng = __webpack_require__(9);
2642
+ var bytesToUuid = __webpack_require__(10);
2643
+
2644
+ function v4(options, buf, offset) {
2645
+ var i = buf && offset || 0;
2646
+
2647
+ if (typeof(options) == 'string') {
2648
+ buf = options === 'binary' ? new Array(16) : null;
2649
+ options = null;
2650
+ }
2651
+ options = options || {};
2652
+
2653
+ var rnds = options.random || (options.rng || rng)();
2654
+
2655
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
2656
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
2657
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
2658
+
2659
+ // Copy bytes to buffer, if provided
2660
+ if (buf) {
2661
+ for (var ii = 0; ii < 16; ++ii) {
2662
+ buf[i + ii] = rnds[ii];
2663
+ }
2664
+ }
2665
+
2666
+ return buf || bytesToUuid(rnds);
2667
+ }
2668
+
2669
+ module.exports = v4;
2670
+
2671
+
2672
+ /***/ }),
2673
+ /* 25 */
2674
+ /***/ (function(module, exports, __webpack_require__) {
2675
+
2676
+ "use strict";
2677
+
2678
+ Object.defineProperty(exports, "__esModule", { value: true });
2679
+ var internalAPIs_1 = __webpack_require__(1);
2680
+ var constants_1 = __webpack_require__(4);
2681
+ var communication_1 = __webpack_require__(0);
2682
+ var appInitialization;
2683
+ (function (appInitialization) {
2684
+ appInitialization.Messages = {
2685
+ AppLoaded: 'appInitialization.appLoaded',
2686
+ Success: 'appInitialization.success',
2687
+ Failure: 'appInitialization.failure',
2688
+ ExpectedFailure: 'appInitialization.expectedFailure',
2689
+ };
2690
+ var FailedReason;
2691
+ (function (FailedReason) {
2692
+ FailedReason["AuthFailed"] = "AuthFailed";
2693
+ FailedReason["Timeout"] = "Timeout";
2694
+ FailedReason["Other"] = "Other";
2695
+ })(FailedReason = appInitialization.FailedReason || (appInitialization.FailedReason = {}));
2696
+ var ExpectedFailureReason;
2697
+ (function (ExpectedFailureReason) {
2698
+ ExpectedFailureReason["PermissionError"] = "PermissionError";
2699
+ ExpectedFailureReason["NotFound"] = "NotFound";
2700
+ ExpectedFailureReason["Throttling"] = "Throttling";
2701
+ ExpectedFailureReason["Offline"] = "Offline";
2702
+ ExpectedFailureReason["Other"] = "Other";
2703
+ })(ExpectedFailureReason = appInitialization.ExpectedFailureReason || (appInitialization.ExpectedFailureReason = {}));
2704
+ /**
2705
+ * Notifies the frame that app has loaded and to hide the loading indicator if one is shown.
2706
+ */
2707
+ function notifyAppLoaded() {
2708
+ internalAPIs_1.ensureInitialized();
2709
+ communication_1.sendMessageToParent(appInitialization.Messages.AppLoaded, [constants_1.version]);
2710
+ }
2711
+ appInitialization.notifyAppLoaded = notifyAppLoaded;
2712
+ /**
2713
+ * Notifies the frame that app initialization is successful and is ready for user interaction.
2714
+ */
2715
+ function notifySuccess() {
2716
+ internalAPIs_1.ensureInitialized();
2717
+ communication_1.sendMessageToParent(appInitialization.Messages.Success, [constants_1.version]);
2718
+ }
2719
+ appInitialization.notifySuccess = notifySuccess;
2720
+ /**
2721
+ * Notifies the frame that app initialization has failed and to show an error page in its place.
2722
+ */
2723
+ function notifyFailure(appInitializationFailedRequest) {
2724
+ internalAPIs_1.ensureInitialized();
2725
+ communication_1.sendMessageToParent(appInitialization.Messages.Failure, [
2726
+ appInitializationFailedRequest.reason,
2727
+ appInitializationFailedRequest.message,
2728
+ ]);
2729
+ }
2730
+ appInitialization.notifyFailure = notifyFailure;
2731
+ /**
2732
+ * Notifies the frame that app initialized with some expected errors.
2733
+ */
2734
+ function notifyExpectedFailure(expectedFailureRequest) {
2735
+ internalAPIs_1.ensureInitialized();
2736
+ communication_1.sendMessageToParent(appInitialization.Messages.ExpectedFailure, [expectedFailureRequest.reason, expectedFailureRequest.message]);
2737
+ }
2738
+ appInitialization.notifyExpectedFailure = notifyExpectedFailure;
2739
+ })(appInitialization = exports.appInitialization || (exports.appInitialization = {}));
2740
+
2741
+
2742
+ /***/ }),
2743
+ /* 26 */
2744
+ /***/ (function(module, exports, __webpack_require__) {
2745
+
2746
+ "use strict";
2747
+
2748
+ Object.defineProperty(exports, "__esModule", { value: true });
2749
+ var internalAPIs_1 = __webpack_require__(1);
2750
+ var globalVars_1 = __webpack_require__(6);
2751
+ var constants_1 = __webpack_require__(4);
2752
+ var settings_1 = __webpack_require__(12);
2753
+ var utils_1 = __webpack_require__(5);
2754
+ var logs_1 = __webpack_require__(13);
2755
+ var constants_2 = __webpack_require__(2);
2756
+ var communication_1 = __webpack_require__(0);
2757
+ var authentication_1 = __webpack_require__(11);
2758
+ var privateAPIs_1 = __webpack_require__(14);
2759
+ var Handlers = __webpack_require__(3); // Conflict with some names
2760
+ // ::::::::::::::::::::::: MicrosoftTeams SDK public API ::::::::::::::::::::
2761
+ /**
2762
+ * Initializes the library. This must be called before any other SDK calls
2763
+ * but after the frame is loaded successfully.
2764
+ * @param callback Optionally specify a callback to invoke when Teams SDK has successfully initialized
2765
+ * @param validMessageOrigins Optionally specify a list of cross frame message origins. There must have
2766
+ * https: protocol otherwise they will be ignored. Example: https://www.example.com
2767
+ */
2768
+ function initialize(callback, validMessageOrigins) {
2769
+ // Independent components might not know whether the SDK is initialized so might call it to be safe.
2770
+ // Just no-op if that happens to make it easier to use.
2771
+ if (!globalVars_1.GlobalVars.initializeCalled) {
2772
+ globalVars_1.GlobalVars.initializeCalled = true;
2773
+ Handlers.initializeHandlers();
2774
+ communication_1.initializeCommunication(function (context, clientType, clientSupportedSDKVersion) {
2775
+ if (clientSupportedSDKVersion === void 0) { clientSupportedSDKVersion = constants_1.defaultSDKVersionForCompatCheck; }
2776
+ globalVars_1.GlobalVars.frameContext = context;
2777
+ globalVars_1.GlobalVars.hostClientType = clientType;
2778
+ globalVars_1.GlobalVars.clientSupportedSDKVersion = clientSupportedSDKVersion;
2779
+ // Notify all waiting callers that the initialization has completed
2780
+ globalVars_1.GlobalVars.initializeCallbacks.forEach(function (initCallback) { return initCallback(); });
2781
+ globalVars_1.GlobalVars.initializeCallbacks = [];
2782
+ globalVars_1.GlobalVars.initializeCompleted = true;
2783
+ }, validMessageOrigins);
2784
+ authentication_1.authentication.initialize();
2785
+ settings_1.settings.initialize();
2786
+ privateAPIs_1.initializePrivateApis();
2787
+ // Undocumented function used to clear state between unit tests
2788
+ this._uninitialize = function () {
2789
+ if (globalVars_1.GlobalVars.frameContext) {
2790
+ registerOnThemeChangeHandler(null);
2791
+ registerFullScreenHandler(null);
2792
+ registerBackButtonHandler(null);
2793
+ registerBeforeUnloadHandler(null);
2794
+ registerOnLoadHandler(null);
2795
+ logs_1.logs.registerGetLogHandler(null);
2796
+ }
2797
+ if (globalVars_1.GlobalVars.frameContext === constants_2.FrameContexts.settings) {
2798
+ settings_1.settings.registerOnSaveHandler(null);
2799
+ }
2800
+ if (globalVars_1.GlobalVars.frameContext === constants_2.FrameContexts.remove) {
2801
+ settings_1.settings.registerOnRemoveHandler(null);
2802
+ }
2803
+ globalVars_1.GlobalVars.initializeCalled = false;
2804
+ globalVars_1.GlobalVars.initializeCompleted = false;
2805
+ globalVars_1.GlobalVars.initializeCallbacks = [];
2806
+ globalVars_1.GlobalVars.additionalValidOrigins = [];
2807
+ globalVars_1.GlobalVars.frameContext = null;
2808
+ globalVars_1.GlobalVars.hostClientType = null;
2809
+ globalVars_1.GlobalVars.isFramelessWindow = false;
2810
+ communication_1.uninitializeCommunication();
2811
+ };
2812
+ }
2813
+ // Handle additional valid message origins if specified
2814
+ if (Array.isArray(validMessageOrigins)) {
2815
+ internalAPIs_1.processAdditionalValidOrigins(validMessageOrigins);
2816
+ }
2817
+ // Handle the callback if specified:
2818
+ // 1. If initialization has already completed then just call it right away
2819
+ // 2. If initialization hasn't completed then add it to the array of callbacks
2820
+ // that should be invoked once initialization does complete
2821
+ if (callback) {
2822
+ globalVars_1.GlobalVars.initializeCompleted ? callback() : globalVars_1.GlobalVars.initializeCallbacks.push(callback);
2823
+ }
2824
+ }
2825
+ exports.initialize = initialize;
2826
+ /**
2827
+ * @private
2828
+ * Hide from docs.
2829
+ * ------
2830
+ * Undocumented function used to set a mock window for unit tests
2831
+ */
2832
+ function _initialize(hostWindow) {
2833
+ communication_1.Communication.currentWindow = hostWindow;
2834
+ }
2835
+ exports._initialize = _initialize;
2836
+ /**
2837
+ * @private
2838
+ * Hide from docs.
2839
+ * ------
2840
+ * Undocumented function used to clear state between unit tests
2841
+ */
2842
+ function _uninitialize() { }
2843
+ exports._uninitialize = _uninitialize;
2844
+ /**
2845
+ * Enable print capability to support printing page using Ctrl+P and cmd+P
2846
+ */
2847
+ function enablePrintCapability() {
2848
+ if (!globalVars_1.GlobalVars.printCapabilityEnabled) {
2849
+ globalVars_1.GlobalVars.printCapabilityEnabled = true;
2850
+ internalAPIs_1.ensureInitialized();
2851
+ // adding ctrl+P and cmd+P handler
2852
+ document.addEventListener('keydown', function (event) {
2853
+ if ((event.ctrlKey || event.metaKey) && event.keyCode === 80) {
2854
+ print();
2855
+ event.cancelBubble = true;
2856
+ event.preventDefault();
2857
+ event.stopImmediatePropagation();
2858
+ }
2859
+ });
2860
+ }
2861
+ }
2862
+ exports.enablePrintCapability = enablePrintCapability;
2863
+ /**
2864
+ * default print handler
2865
+ */
2866
+ function print() {
2867
+ window.print();
2868
+ }
2869
+ exports.print = print;
2870
+ /**
2871
+ * Retrieves the current context the frame is running in.
2872
+ * @param callback The callback to invoke when the {@link Context} object is retrieved.
2873
+ */
2874
+ function getContext(callback) {
2875
+ internalAPIs_1.ensureInitialized();
2876
+ communication_1.sendMessageToParent('getContext', function (context) {
2877
+ if (!context.frameContext) {
2878
+ // Fallback logic for frameContext properties
2879
+ context.frameContext = globalVars_1.GlobalVars.frameContext;
2880
+ }
2881
+ callback(context);
2882
+ });
2883
+ }
2884
+ exports.getContext = getContext;
2885
+ /**
2886
+ * Registers a handler for theme changes.
2887
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2888
+ * @param handler The handler to invoke when the user changes their theme.
2889
+ */
2890
+ function registerOnThemeChangeHandler(handler) {
2891
+ internalAPIs_1.ensureInitialized();
2892
+ Handlers.registerOnThemeChangeHandler(handler);
2893
+ }
2894
+ exports.registerOnThemeChangeHandler = registerOnThemeChangeHandler;
2895
+ /**
2896
+ * Registers a handler for changes from or to full-screen view for a tab.
2897
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2898
+ * @param handler The handler to invoke when the user toggles full-screen view for a tab.
2899
+ */
2900
+ function registerFullScreenHandler(handler) {
2901
+ internalAPIs_1.ensureInitialized();
2902
+ Handlers.registerHandler('fullScreenChange', handler);
2903
+ }
2904
+ exports.registerFullScreenHandler = registerFullScreenHandler;
2905
+ /**
2906
+ * Registers a handler for clicking the app button.
2907
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2908
+ * @param handler The handler to invoke when the personal app button is clicked in the app bar.
2909
+ */
2910
+ function registerAppButtonClickHandler(handler) {
2911
+ internalAPIs_1.ensureInitialized(constants_2.FrameContexts.content);
2912
+ Handlers.registerHandler('appButtonClick', handler);
2913
+ }
2914
+ exports.registerAppButtonClickHandler = registerAppButtonClickHandler;
2915
+ /**
2916
+ * Registers a handler for entering hover of the app button.
2917
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2918
+ * @param handler The handler to invoke when entering hover of the personal app button in the app bar.
2919
+ */
2920
+ function registerAppButtonHoverEnterHandler(handler) {
2921
+ internalAPIs_1.ensureInitialized(constants_2.FrameContexts.content);
2922
+ Handlers.registerHandler('appButtonHoverEnter', handler);
2923
+ }
2924
+ exports.registerAppButtonHoverEnterHandler = registerAppButtonHoverEnterHandler;
2925
+ /**
2926
+ * Registers a handler for exiting hover of the app button.
2927
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2928
+ * @param handler The handler to invoke when exiting hover of the personal app button in the app bar.
2929
+ */
2930
+ function registerAppButtonHoverLeaveHandler(handler) {
2931
+ internalAPIs_1.ensureInitialized(constants_2.FrameContexts.content);
2932
+ Handlers.registerHandler('appButtonHoverLeave', handler);
2933
+ }
2934
+ exports.registerAppButtonHoverLeaveHandler = registerAppButtonHoverLeaveHandler;
2935
+ /**
2936
+ * Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal
2937
+ * navigation stack should use this handler to navigate the user back within their frame. If an app finds
2938
+ * that after running its back button handler it cannot handle the event it should call the navigateBack
2939
+ * method to ask the Teams client to handle it instead.
2940
+ * @param handler The handler to invoke when the user presses their Team client's back button.
2941
+ */
2942
+ function registerBackButtonHandler(handler) {
2943
+ internalAPIs_1.ensureInitialized();
2944
+ Handlers.registerBackButtonHandler(handler);
2945
+ }
2946
+ exports.registerBackButtonHandler = registerBackButtonHandler;
2947
+ /**
2948
+ * @private
2949
+ * Registers a handler to be called when the page has been requested to load.
2950
+ * @param handler The handler to invoke when the page is loaded.
2951
+ */
2952
+ function registerOnLoadHandler(handler) {
2953
+ internalAPIs_1.ensureInitialized();
2954
+ Handlers.registerOnLoadHandler(handler);
2955
+ }
2956
+ exports.registerOnLoadHandler = registerOnLoadHandler;
2957
+ /**
2958
+ * @private
2959
+ * Registers a handler to be called before the page is unloaded.
2960
+ * @param handler The handler to invoke before the page is unloaded. If this handler returns true the page should
2961
+ * invoke the readyToUnload function provided to it once it's ready to be unloaded.
2962
+ */
2963
+ function registerBeforeUnloadHandler(handler) {
2964
+ internalAPIs_1.ensureInitialized();
2965
+ Handlers.registerBeforeUnloadHandler(handler);
2966
+ }
2967
+ exports.registerBeforeUnloadHandler = registerBeforeUnloadHandler;
2968
+ /**
2969
+ * Registers a handler for when the user reconfigurated tab
2970
+ * @param handler The handler to invoke when the user click on Settings.
2971
+ */
2972
+ function registerChangeSettingsHandler(handler) {
2973
+ internalAPIs_1.ensureInitialized(constants_2.FrameContexts.content);
2974
+ Handlers.registerHandler('changeSettings', handler);
2975
+ }
2976
+ exports.registerChangeSettingsHandler = registerChangeSettingsHandler;
2977
+ /**
2978
+ * Allows an app to retrieve for this user tabs that are owned by this app.
2979
+ * If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.
2980
+ * @param callback The callback to invoke when the {@link TabInstanceParameters} object is retrieved.
2981
+ * @param tabInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams or channels.
2982
+ */
2983
+ function getTabInstances(callback, tabInstanceParameters) {
2984
+ internalAPIs_1.ensureInitialized();
2985
+ communication_1.sendMessageToParent('getTabInstances', [tabInstanceParameters], callback);
2986
+ }
2987
+ exports.getTabInstances = getTabInstances;
2988
+ /**
2989
+ * Allows an app to retrieve the most recently used tabs for this user.
2990
+ * @param callback The callback to invoke when the {@link TabInformation} object is retrieved.
2991
+ * @param tabInstanceParameters OPTIONAL Ignored, kept for future use
2992
+ */
2993
+ function getMruTabInstances(callback, tabInstanceParameters) {
2994
+ internalAPIs_1.ensureInitialized();
2995
+ communication_1.sendMessageToParent('getMruTabInstances', [tabInstanceParameters], callback);
2996
+ }
2997
+ exports.getMruTabInstances = getMruTabInstances;
2998
+ /**
2999
+ * Shares a deep link that a user can use to navigate back to a specific state in this page.
3000
+ * @param deepLinkParameters ID and label for the link and fallback URL.
3001
+ */
3002
+ function shareDeepLink(deepLinkParameters) {
3003
+ internalAPIs_1.ensureInitialized(constants_2.FrameContexts.content, constants_2.FrameContexts.sidePanel, constants_2.FrameContexts.meetingStage);
3004
+ communication_1.sendMessageToParent('shareDeepLink', [
3005
+ deepLinkParameters.subEntityId,
3006
+ deepLinkParameters.subEntityLabel,
3007
+ deepLinkParameters.subEntityWebUrl,
3008
+ ]);
3009
+ }
3010
+ exports.shareDeepLink = shareDeepLink;
3011
+ /**
3012
+ * execute deep link API.
3013
+ * @param deepLink deep link.
3014
+ */
3015
+ function executeDeepLink(deepLink, onComplete) {
3016
+ internalAPIs_1.ensureInitialized(constants_2.FrameContexts.content, constants_2.FrameContexts.sidePanel, constants_2.FrameContexts.settings, constants_2.FrameContexts.task, constants_2.FrameContexts.stage, constants_2.FrameContexts.meetingStage);
3017
+ communication_1.sendMessageToParent('executeDeepLink', [deepLink], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler());
3018
+ }
3019
+ exports.executeDeepLink = executeDeepLink;
3020
+ function setFrameContext(frameContext) {
3021
+ internalAPIs_1.ensureInitialized(constants_2.FrameContexts.content);
3022
+ communication_1.sendMessageToParent('setFrameContext', [frameContext]);
3023
+ }
3024
+ exports.setFrameContext = setFrameContext;
3025
+ function initializeWithFrameContext(frameContext, callback, validMessageOrigins) {
3026
+ initialize(callback, validMessageOrigins);
3027
+ setFrameContext(frameContext);
3028
+ }
3029
+ exports.initializeWithFrameContext = initializeWithFrameContext;
3030
+
3031
+
3032
+ /***/ }),
3033
+ /* 27 */
3034
+ /***/ (function(module, exports, __webpack_require__) {
3035
+
3036
+ "use strict";
3037
+
3038
+ Object.defineProperty(exports, "__esModule", { value: true });
3039
+ var internalAPIs_1 = __webpack_require__(1);
3040
+ var utils_1 = __webpack_require__(5);
3041
+ var constants_1 = __webpack_require__(2);
3042
+ var communication_1 = __webpack_require__(0);
3043
+ /**
3044
+ * Navigation specific part of the SDK.
3045
+ */
3046
+ /**
3047
+ * Return focus to the main Teams app. Will focus search bar if navigating foward and app bar if navigating back.
3048
+ * @param navigateForward Determines the direction to focus in teams app.
3049
+ */
3050
+ function returnFocus(navigateForward) {
3051
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content);
3052
+ communication_1.sendMessageToParent('returnFocus', [navigateForward]);
3053
+ }
3054
+ exports.returnFocus = returnFocus;
3055
+ /**
3056
+ * Navigates the Microsoft Teams app to the specified tab instance.
3057
+ * @param tabInstance The tab instance to navigate to.
3058
+ */
3059
+ function navigateToTab(tabInstance, onComplete) {
3060
+ internalAPIs_1.ensureInitialized();
3061
+ var errorMessage = 'Invalid internalTabInstanceId and/or channelId were/was provided';
3062
+ communication_1.sendMessageToParent('navigateToTab', [tabInstance], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler(errorMessage));
3063
+ }
3064
+ exports.navigateToTab = navigateToTab;
3065
+ /**
3066
+ * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
3067
+ * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
3068
+ * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
3069
+ * than the current one in a way that keeps the app informed of the change and allows the SDK to
3070
+ * continue working.
3071
+ * @param url The URL to navigate the frame to.
3072
+ */
3073
+ function navigateCrossDomain(url, onComplete) {
3074
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.sidePanel, constants_1.FrameContexts.settings, constants_1.FrameContexts.remove, constants_1.FrameContexts.task, constants_1.FrameContexts.stage, constants_1.FrameContexts.meetingStage);
3075
+ var errorMessage = 'Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.';
3076
+ communication_1.sendMessageToParent('navigateCrossDomain', [url], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler(errorMessage));
3077
+ }
3078
+ exports.navigateCrossDomain = navigateCrossDomain;
3079
+ /**
3080
+ * Navigates back in the Teams client. See registerBackButtonHandler for more information on when
3081
+ * it's appropriate to use this method.
3082
+ */
3083
+ function navigateBack(onComplete) {
3084
+ internalAPIs_1.ensureInitialized();
3085
+ var errorMessage = 'Back navigation is not supported in the current client or context.';
3086
+ communication_1.sendMessageToParent('navigateBack', [], onComplete ? onComplete : utils_1.getGenericOnCompleteHandler(errorMessage));
3087
+ }
3088
+ exports.navigateBack = navigateBack;
3089
+
3090
+
3091
+ /***/ }),
3092
+ /* 28 */
3093
+ /***/ (function(module, exports, __webpack_require__) {
3094
+
3095
+ "use strict";
3096
+
3097
+ var __rest = (this && this.__rest) || function (s, e) {
3098
+ var t = {};
3099
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3100
+ t[p] = s[p];
3101
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
3102
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
3103
+ t[p[i]] = s[p[i]];
3104
+ return t;
3105
+ };
3106
+ Object.defineProperty(exports, "__esModule", { value: true });
3107
+ var constants_1 = __webpack_require__(2);
3108
+ var appWindow_1 = __webpack_require__(16);
3109
+ var communication_1 = __webpack_require__(0);
3110
+ var internalAPIs_1 = __webpack_require__(1);
3111
+ /**
3112
+ * Namespace to interact with the task module-specific part of the SDK.
3113
+ * This object is usable only on the content frame.
3114
+ */
3115
+ var tasks;
3116
+ (function (tasks) {
3117
+ /**
3118
+ * Allows an app to open the task module.
3119
+ * @param taskInfo An object containing the parameters of the task module
3120
+ * @param submitHandler Handler to call when the task module is completed
3121
+ */
3122
+ function startTask(taskInfo, submitHandler) {
3123
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.sidePanel, constants_1.FrameContexts.meetingStage);
3124
+ communication_1.sendMessageToParent('tasks.startTask', [taskInfo], submitHandler);
3125
+ return new appWindow_1.ChildAppWindow();
3126
+ }
3127
+ tasks.startTask = startTask;
3128
+ /**
3129
+ * Update height/width task info properties.
3130
+ * @param taskInfo An object containing width and height properties
3131
+ */
3132
+ function updateTask(taskInfo) {
3133
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.sidePanel, constants_1.FrameContexts.task, constants_1.FrameContexts.meetingStage);
3134
+ var width = taskInfo.width, height = taskInfo.height, extra = __rest(taskInfo, ["width", "height"]);
3135
+ if (!Object.keys(extra).length) {
3136
+ communication_1.sendMessageToParent('tasks.updateTask', [taskInfo]);
3137
+ }
3138
+ else {
3139
+ throw new Error('updateTask requires a taskInfo argument containing only width and height');
3140
+ }
3141
+ }
3142
+ tasks.updateTask = updateTask;
3143
+ /**
3144
+ * Submit the task module.
3145
+ * @param result Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
3146
+ * @param appIds Helps to validate that the call originates from the same appId as the one that invoked the task module
3147
+ */
3148
+ function submitTask(result, appIds) {
3149
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.sidePanel, constants_1.FrameContexts.task, constants_1.FrameContexts.meetingStage);
3150
+ // Send tasks.completeTask instead of tasks.submitTask message for backward compatibility with Mobile clients
3151
+ communication_1.sendMessageToParent('tasks.completeTask', [result, Array.isArray(appIds) ? appIds : [appIds]]);
3152
+ }
3153
+ tasks.submitTask = submitTask;
3154
+ })(tasks = exports.tasks || (exports.tasks = {}));
3155
+
3156
+
3157
+ /***/ }),
3158
+ /* 29 */
3159
+ /***/ (function(module, exports, __webpack_require__) {
3160
+
3161
+ "use strict";
3162
+
3163
+ Object.defineProperty(exports, "__esModule", { value: true });
3164
+ var interfaces_1 = __webpack_require__(7);
3165
+ var internalAPIs_1 = __webpack_require__(1);
3166
+ var constants_1 = __webpack_require__(2);
3167
+ var communication_1 = __webpack_require__(0);
3168
+ var constants_2 = __webpack_require__(4);
3169
+ var location;
3170
+ (function (location_1) {
3171
+ /**
3172
+ * Fetches current user coordinates or allows user to choose location on map
3173
+ * @param callback Callback to invoke when current user location is fetched
3174
+ */
3175
+ function getLocation(props, callback) {
3176
+ if (!callback) {
3177
+ throw new Error('[location.getLocation] Callback cannot be null');
3178
+ }
3179
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task);
3180
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.locationAPIsRequiredVersion)) {
3181
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
3182
+ callback(oldPlatformError, undefined);
3183
+ return;
3184
+ }
3185
+ if (!props) {
3186
+ var invalidInput = { errorCode: interfaces_1.ErrorCode.INVALID_ARGUMENTS };
3187
+ callback(invalidInput, undefined);
3188
+ return;
3189
+ }
3190
+ communication_1.sendMessageToParent('location.getLocation', [props], callback);
3191
+ }
3192
+ location_1.getLocation = getLocation;
3193
+ /**
3194
+ * Shows the location on map corresponding to the given coordinates
3195
+ * @param location {@link Location} which needs to be shown on map
3196
+ * @param callback Callback to invoke when the location is opened on map
3197
+ */
3198
+ function showLocation(location, callback) {
3199
+ if (!callback) {
3200
+ throw new Error('[location.showLocation] Callback cannot be null');
3201
+ }
3202
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task);
3203
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.locationAPIsRequiredVersion)) {
3204
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
3205
+ callback(oldPlatformError, undefined);
3206
+ return;
3207
+ }
3208
+ if (!location) {
3209
+ var invalidInput = { errorCode: interfaces_1.ErrorCode.INVALID_ARGUMENTS };
3210
+ callback(invalidInput, undefined);
3211
+ return;
3212
+ }
3213
+ communication_1.sendMessageToParent('location.showLocation', [location], callback);
3214
+ }
3215
+ location_1.showLocation = showLocation;
3216
+ })(location = exports.location || (exports.location = {}));
3217
+
3218
+
3219
+ /***/ }),
3220
+ /* 30 */
3221
+ /***/ (function(module, exports, __webpack_require__) {
3222
+
3223
+ "use strict";
3224
+
3225
+ Object.defineProperty(exports, "__esModule", { value: true });
3226
+ var communication_1 = __webpack_require__(0);
3227
+ var handlers_1 = __webpack_require__(3);
3228
+ var internalAPIs_1 = __webpack_require__(1);
3229
+ var constants_1 = __webpack_require__(2);
3230
+ var meeting;
3231
+ (function (meeting) {
3232
+ var MeetingType;
3233
+ (function (MeetingType) {
3234
+ MeetingType["Unknown"] = "Unknown";
3235
+ MeetingType["Adhoc"] = "Adhoc";
3236
+ MeetingType["Scheduled"] = "Scheduled";
3237
+ MeetingType["Recurring"] = "Recurring";
3238
+ MeetingType["Broadcast"] = "Broadcast";
3239
+ MeetingType["MeetNow"] = "MeetNow";
3240
+ })(MeetingType = meeting.MeetingType || (meeting.MeetingType = {}));
3241
+ /**
3242
+ * Allows an app to get the incoming audio speaker setting for the meeting user
3243
+ * @param callback Callback contains 2 parameters, error and result.
3244
+ * error can either contain an error of type SdkError, incase of an error, or null when fetch is successful
3245
+ * result can either contain the true/false value, incase of a successful fetch or null when the fetching fails
3246
+ * result: True means incoming audio is muted and false means incoming audio is unmuted
3247
+ */
3248
+ function getIncomingClientAudioState(callback) {
3249
+ if (!callback) {
3250
+ throw new Error('[get incoming client audio state] Callback cannot be null');
3251
+ }
3252
+ internalAPIs_1.ensureInitialized();
3253
+ communication_1.sendMessageToParent('getIncomingClientAudioState', callback);
3254
+ }
3255
+ meeting.getIncomingClientAudioState = getIncomingClientAudioState;
3256
+ /**
3257
+ * Allows an app to toggle the incoming audio speaker setting for the meeting user from mute to unmute or vice-versa
3258
+ * @param callback Callback contains 2 parameters, error and result.
3259
+ * error can either contain an error of type SdkError, incase of an error, or null when toggle is successful
3260
+ * result can either contain the true/false value, incase of a successful toggle or null when the toggling fails
3261
+ * result: True means incoming audio is muted and false means incoming audio is unmuted
3262
+ */
3263
+ function toggleIncomingClientAudio(callback) {
3264
+ if (!callback) {
3265
+ throw new Error('[toggle incoming client audio] Callback cannot be null');
3266
+ }
3267
+ internalAPIs_1.ensureInitialized();
3268
+ communication_1.sendMessageToParent('toggleIncomingClientAudio', callback);
3269
+ }
3270
+ meeting.toggleIncomingClientAudio = toggleIncomingClientAudio;
3271
+ /**
3272
+ * @private
3273
+ * Hide from docs
3274
+ * Allows an app to get the meeting details for the meeting
3275
+ * @param callback Callback contains 2 parameters, error and meetingDetails.
3276
+ * error can either contain an error of type SdkError, incase of an error, or null when get is successful
3277
+ * result can either contain a IMeetingDetails value, incase of a successful get or null when the get fails
3278
+ */
3279
+ function getMeetingDetails(callback) {
3280
+ if (!callback) {
3281
+ throw new Error('[get meeting details] Callback cannot be null');
3282
+ }
3283
+ internalAPIs_1.ensureInitialized();
3284
+ communication_1.sendMessageToParent('meeting.getMeetingDetails', callback);
3285
+ }
3286
+ meeting.getMeetingDetails = getMeetingDetails;
3287
+ /**
3288
+ * @private
3289
+ * Allows an app to get the authentication token for the anonymous or guest user in the meeting
3290
+ * @param callback Callback contains 2 parameters, error and authenticationTokenOfAnonymousUser.
3291
+ * error can either contain an error of type SdkError, incase of an error, or null when get is successful
3292
+ * authenticationTokenOfAnonymousUser can either contain a string value, incase of a successful get or null when the get fails
3293
+ */
3294
+ function getAuthenticationTokenForAnonymousUser(callback) {
3295
+ if (!callback) {
3296
+ throw new Error('[get Authentication Token For AnonymousUser] Callback cannot be null');
3297
+ }
3298
+ internalAPIs_1.ensureInitialized();
3299
+ communication_1.sendMessageToParent('meeting.getAuthenticationTokenForAnonymousUser', callback);
3300
+ }
3301
+ meeting.getAuthenticationTokenForAnonymousUser = getAuthenticationTokenForAnonymousUser;
3302
+ /**
3303
+ * Allows an app to get the state of the live stream in the current meeting
3304
+ * @param callback Callback contains 2 parameters: error and liveStreamState.
3305
+ * error can either contain an error of type SdkError, in case of an error, or null when get is successful
3306
+ * liveStreamState can either contain a LiveStreamState value, or null when operation fails
3307
+ */
3308
+ function getLiveStreamState(callback) {
3309
+ if (!callback) {
3310
+ throw new Error('[get live stream state] Callback cannot be null');
3311
+ }
3312
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3313
+ communication_1.sendMessageToParent('meeting.getLiveStreamState', callback);
3314
+ }
3315
+ meeting.getLiveStreamState = getLiveStreamState;
3316
+ /**
3317
+ * Allows an app to request the live streaming be started at the given streaming url
3318
+ * @param streamUrl the url to the stream resource
3319
+ * @param streamKey the key to the stream resource
3320
+ * @param callback Callback contains error parameter which can be of type SdkError in case of an error, or null when operation is successful
3321
+ * Use getLiveStreamState or registerLiveStreamChangedHandler to get updates on the live stream state
3322
+ */
3323
+ function requestStartLiveStreaming(callback, streamUrl, streamKey) {
3324
+ if (!callback) {
3325
+ throw new Error('[request start live streaming] Callback cannot be null');
3326
+ }
3327
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3328
+ communication_1.sendMessageToParent('meeting.requestStartLiveStreaming', [streamUrl, streamKey], callback);
3329
+ }
3330
+ meeting.requestStartLiveStreaming = requestStartLiveStreaming;
3331
+ /**
3332
+ * Allows an app to request the live streaming be stopped at the given streaming url
3333
+ * @param callback Callback contains error parameter which can be of type SdkError in case of an error, or null when operation is successful
3334
+ * Use getLiveStreamState or registerLiveStreamChangedHandler to get updates on the live stream state
3335
+ */
3336
+ function requestStopLiveStreaming(callback) {
3337
+ if (!callback) {
3338
+ throw new Error('[request stop live streaming] Callback cannot be null');
3339
+ }
3340
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3341
+ communication_1.sendMessageToParent('meeting.requestStopLiveStreaming', callback);
3342
+ }
3343
+ meeting.requestStopLiveStreaming = requestStopLiveStreaming;
3344
+ /**
3345
+ * Registers a handler for changes to the live stream.
3346
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
3347
+ * @param handler The handler to invoke when the live stream state changes
3348
+ */
3349
+ function registerLiveStreamChangedHandler(handler) {
3350
+ if (!handler) {
3351
+ throw new Error('[register live stream changed handler] Handler cannot be null');
3352
+ }
3353
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3354
+ handlers_1.registerHandler('meeting.liveStreamChanged', handler);
3355
+ }
3356
+ meeting.registerLiveStreamChangedHandler = registerLiveStreamChangedHandler;
3357
+ })(meeting = exports.meeting || (exports.meeting = {}));
3358
+
3359
+
3360
+ /***/ }),
3361
+ /* 31 */
3362
+ /***/ (function(module, exports, __webpack_require__) {
3363
+
3364
+ "use strict";
3365
+
3366
+ Object.defineProperty(exports, "__esModule", { value: true });
3367
+ var internalAPIs_1 = __webpack_require__(1);
3368
+ var constants_1 = __webpack_require__(2);
3369
+ var interfaces_1 = __webpack_require__(7);
3370
+ var mediaUtil_1 = __webpack_require__(18);
3371
+ var communication_1 = __webpack_require__(0);
3372
+ var constants_2 = __webpack_require__(4);
3373
+ var people;
3374
+ (function (people_1) {
3375
+ /**
3376
+ * Launches a people picker and allows the user to select one or more people from the list
3377
+ * If the app is added to personal app scope the people picker launched is org wide and if the app is added to a chat/channel, people picker launched is also limited to the members of chat/channel
3378
+ * @param callback Returns list of JSON object of type PeoplePickerResult which consists of AAD IDs, display names and emails of the selected users
3379
+ * @param peoplePickerInputs Input parameters to launch customized people picker
3380
+ */
3381
+ function selectPeople(callback, peoplePickerInputs) {
3382
+ if (!callback) {
3383
+ throw new Error('[people picker] Callback cannot be null');
3384
+ }
3385
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content, constants_1.FrameContexts.task, constants_1.FrameContexts.settings);
3386
+ if (!internalAPIs_1.isAPISupportedByPlatform(constants_2.peoplePickerRequiredVersion)) {
3387
+ var oldPlatformError = { errorCode: interfaces_1.ErrorCode.OLD_PLATFORM };
3388
+ callback(oldPlatformError, undefined);
3389
+ return;
3390
+ }
3391
+ if (!mediaUtil_1.validatePeoplePickerInput(peoplePickerInputs)) {
3392
+ var invalidInput = { errorCode: interfaces_1.ErrorCode.INVALID_ARGUMENTS };
3393
+ callback(invalidInput, null);
3394
+ return;
3395
+ }
3396
+ communication_1.sendMessageToParent('people.selectPeople', [peoplePickerInputs], callback);
3397
+ }
3398
+ people_1.selectPeople = selectPeople;
3399
+ })(people = exports.people || (exports.people = {}));
3400
+
3401
+
3402
+ /***/ }),
3403
+ /* 32 */
3404
+ /***/ (function(module, exports, __webpack_require__) {
3405
+
3406
+ "use strict";
3407
+
3408
+ Object.defineProperty(exports, "__esModule", { value: true });
3409
+ var NotificationTypes;
3410
+ (function (NotificationTypes) {
3411
+ NotificationTypes["fileDownloadStart"] = "fileDownloadStart";
3412
+ NotificationTypes["fileDownloadComplete"] = "fileDownloadComplete";
3413
+ })(NotificationTypes = exports.NotificationTypes || (exports.NotificationTypes = {}));
3414
+ /**
3415
+ * @private
3416
+ * Hide from docs.
3417
+ * ------
3418
+ */
3419
+ var ViewerActionTypes;
3420
+ (function (ViewerActionTypes) {
3421
+ ViewerActionTypes["view"] = "view";
3422
+ ViewerActionTypes["edit"] = "edit";
3423
+ ViewerActionTypes["editNew"] = "editNew";
3424
+ })(ViewerActionTypes = exports.ViewerActionTypes || (exports.ViewerActionTypes = {}));
3425
+ /**
3426
+ * * @private
3427
+ * Hide from docs.
3428
+ * ------
3429
+ * User setting changes that can be subscribed to,
3430
+ */
3431
+ var UserSettingTypes;
3432
+ (function (UserSettingTypes) {
3433
+ /**
3434
+ * Use this key to subscribe to changes in user's file open preference
3435
+ */
3436
+ UserSettingTypes["fileOpenPreference"] = "fileOpenPreference";
3437
+ /**
3438
+ * Use this key to subscribe to theme changes
3439
+ */
3440
+ UserSettingTypes["theme"] = "theme";
3441
+ })(UserSettingTypes = exports.UserSettingTypes || (exports.UserSettingTypes = {}));
3442
+
3443
+
3444
+ /***/ }),
3445
+ /* 33 */
3446
+ /***/ (function(module, exports, __webpack_require__) {
3447
+
3448
+ "use strict";
3449
+
3450
+ Object.defineProperty(exports, "__esModule", { value: true });
3451
+ var internalAPIs_1 = __webpack_require__(1);
3452
+ var constants_1 = __webpack_require__(2);
3453
+ var communication_1 = __webpack_require__(0);
3454
+ var handlers_1 = __webpack_require__(3);
3455
+ /**
3456
+ * Namespace to interact with the conversational subEntities inside the tab
3457
+ */
3458
+ var conversations;
3459
+ (function (conversations) {
3460
+ /**
3461
+ * @private
3462
+ * Hide from docs
3463
+ * --------------
3464
+ * Allows the user to start or continue a conversation with each subentity inside the tab
3465
+ */
3466
+ function openConversation(openConversationRequest) {
3467
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content);
3468
+ communication_1.sendMessageToParent('conversations.openConversation', [
3469
+ {
3470
+ title: openConversationRequest.title,
3471
+ subEntityId: openConversationRequest.subEntityId,
3472
+ conversationId: openConversationRequest.conversationId,
3473
+ channelId: openConversationRequest.channelId,
3474
+ entityId: openConversationRequest.entityId,
3475
+ },
3476
+ ], function (status, reason) {
3477
+ if (!status) {
3478
+ throw new Error(reason);
3479
+ }
3480
+ });
3481
+ if (openConversationRequest.onStartConversation) {
3482
+ handlers_1.registerHandler('startConversation', function (subEntityId, conversationId, channelId, entityId) {
3483
+ return openConversationRequest.onStartConversation({
3484
+ subEntityId: subEntityId,
3485
+ conversationId: conversationId,
3486
+ channelId: channelId,
3487
+ entityId: entityId,
3488
+ });
3489
+ });
3490
+ }
3491
+ if (openConversationRequest.onCloseConversation) {
3492
+ handlers_1.registerHandler('closeConversation', function (subEntityId, conversationId, channelId, entityId) {
3493
+ return openConversationRequest.onCloseConversation({
3494
+ subEntityId: subEntityId,
3495
+ conversationId: conversationId,
3496
+ channelId: channelId,
3497
+ entityId: entityId,
3498
+ });
3499
+ });
3500
+ }
3501
+ }
3502
+ conversations.openConversation = openConversation;
3503
+ /**
3504
+ * @private
3505
+ * Hide from docs
3506
+ * --------------
3507
+ * Allows the user to close the conversation in the right pane
3508
+ */
3509
+ function closeConversation() {
3510
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.content);
3511
+ communication_1.sendMessageToParent('conversations.closeConversation');
3512
+ handlers_1.removeHandler('startConversation');
3513
+ handlers_1.removeHandler('closeConversation');
3514
+ }
3515
+ conversations.closeConversation = closeConversation;
3516
+ })(conversations = exports.conversations || (exports.conversations = {}));
3517
+
3518
+
3519
+ /***/ }),
3520
+ /* 34 */
3521
+ /***/ (function(module, exports, __webpack_require__) {
3522
+
3523
+ "use strict";
3524
+
3525
+ Object.defineProperty(exports, "__esModule", { value: true });
3526
+ var internalAPIs_1 = __webpack_require__(1);
3527
+ var communication_1 = __webpack_require__(0);
3528
+ var handlers_1 = __webpack_require__(3);
3529
+ var meetingRoom;
3530
+ (function (meetingRoom) {
3531
+ /**
3532
+ * @private
3533
+ * Hide from docs
3534
+ *
3535
+ * Enum used to indicate meeting room capabilities.
3536
+ */
3537
+ var Capability;
3538
+ (function (Capability) {
3539
+ /**
3540
+ * Media control capability: toggle mute.
3541
+ */
3542
+ Capability["toggleMute"] = "toggleMute";
3543
+ /**
3544
+ * Media control capability: toggle camera.
3545
+ */
3546
+ Capability["toggleCamera"] = "toggleCamera";
3547
+ /**
3548
+ * Media control capability: toggle captions.
3549
+ */
3550
+ Capability["toggleCaptions"] = "toggleCaptions";
3551
+ /**
3552
+ * Media control capability: volume ajustion.
3553
+ */
3554
+ Capability["volume"] = "volume";
3555
+ /**
3556
+ * Stage layout control capability: show gallery mode.
3557
+ */
3558
+ Capability["showVideoGallery"] = "showVideoGallery";
3559
+ /**
3560
+ * Stage layout control capability: show content mode.
3561
+ */
3562
+ Capability["showContent"] = "showContent";
3563
+ /**
3564
+ * Stage layout control capability: show content + gallery mode.
3565
+ */
3566
+ Capability["showVideoGalleryAndContent"] = "showVideoGalleryAndContent";
3567
+ /**
3568
+ * Stage layout control capability: show laryge gallery mode.
3569
+ */
3570
+ Capability["showLargeGallery"] = "showLargeGallery";
3571
+ /**
3572
+ * Stage layout control capability: show together mode.
3573
+ */
3574
+ Capability["showTogether"] = "showTogether";
3575
+ /**
3576
+ * Meeting control capability: leave meeting.
3577
+ */
3578
+ Capability["leaveMeeting"] = "leaveMeeting";
3579
+ })(Capability = meetingRoom.Capability || (meetingRoom.Capability = {}));
3580
+ /**
3581
+ * @private
3582
+ * Hide from docs
3583
+ *
3584
+ * Fetch the meeting room info that paired with current client.
3585
+ * @param callback Callback to invoke when the meeting room info is fetched.
3586
+ */
3587
+ function getPairedMeetingRoomInfo(callback) {
3588
+ internalAPIs_1.ensureInitialized();
3589
+ communication_1.sendMessageToParent('meetingRoom.getPairedMeetingRoomInfo', callback);
3590
+ }
3591
+ meetingRoom.getPairedMeetingRoomInfo = getPairedMeetingRoomInfo;
3592
+ /**
3593
+ * @private
3594
+ * Hide from docs
3595
+ *
3596
+ * Send a command to paired meeting room.
3597
+ * @param commandName The command name.
3598
+ * @param callback Callback to invoke when the command response returns.
3599
+ */
3600
+ function sendCommandToPairedMeetingRoom(commandName, callback) {
3601
+ if (!commandName || commandName.length == 0) {
3602
+ throw new Error('[meetingRoom.sendCommandToPairedMeetingRoom] Command name cannot be null or empty');
3603
+ }
3604
+ if (!callback) {
3605
+ throw new Error('[meetingRoom.sendCommandToPairedMeetingRoom] Callback cannot be null');
3606
+ }
3607
+ internalAPIs_1.ensureInitialized();
3608
+ communication_1.sendMessageToParent('meetingRoom.sendCommandToPairedMeetingRoom', [commandName], callback);
3609
+ }
3610
+ meetingRoom.sendCommandToPairedMeetingRoom = sendCommandToPairedMeetingRoom;
3611
+ /**
3612
+ * @private
3613
+ * Hide from docs
3614
+ *
3615
+ * Registers a handler for meeting room capabilities update.
3616
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
3617
+ * @param handler The handler to invoke when the capabilities of meeting room update.
3618
+ */
3619
+ function registerMeetingRoomCapabilitiesUpdateHandler(handler) {
3620
+ if (!handler) {
3621
+ throw new Error('[meetingRoom.registerMeetingRoomCapabilitiesUpdateHandler] Handler cannot be null');
3622
+ }
3623
+ internalAPIs_1.ensureInitialized();
3624
+ handlers_1.registerHandler('meetingRoom.meetingRoomCapabilitiesUpdate', function (capabilities) {
3625
+ internalAPIs_1.ensureInitialized();
3626
+ handler(capabilities);
3627
+ });
3628
+ // handler && Communication.sendMessageToParent('registerHandler', ['meetingRoom.meetingRoomCapabilitiesUpdate']);
3629
+ }
3630
+ meetingRoom.registerMeetingRoomCapabilitiesUpdateHandler = registerMeetingRoomCapabilitiesUpdateHandler;
3631
+ /**
3632
+ * @private
3633
+ * Hide from docs
3634
+ * Registers a handler for meeting room states update.
3635
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
3636
+ * @param handler The handler to invoke when the states of meeting room update.
3637
+ */
3638
+ function registerMeetingRoomStatesUpdateHandler(handler) {
3639
+ if (!handler) {
3640
+ throw new Error('[meetingRoom.registerMeetingRoomStatesUpdateHandler] Handler cannot be null');
3641
+ }
3642
+ internalAPIs_1.ensureInitialized();
3643
+ handlers_1.registerHandler('meetingRoom.meetingRoomStatesUpdate', function (states) {
3644
+ internalAPIs_1.ensureInitialized();
3645
+ handler(states);
3646
+ });
3647
+ // handler && Communication.sendMessageToParent('registerHandler', ['meetingRoom.meetingRoomStatesUpdate']);
3648
+ }
3649
+ meetingRoom.registerMeetingRoomStatesUpdateHandler = registerMeetingRoomStatesUpdateHandler;
3650
+ })(meetingRoom = exports.meetingRoom || (exports.meetingRoom = {}));
3651
+
3652
+
3653
+ /***/ }),
3654
+ /* 35 */
3655
+ /***/ (function(module, exports, __webpack_require__) {
3656
+
3657
+ "use strict";
3658
+
3659
+ Object.defineProperty(exports, "__esModule", { value: true });
3660
+ var internalAPIs_1 = __webpack_require__(1);
3661
+ var constants_1 = __webpack_require__(2);
3662
+ var communication_1 = __webpack_require__(0);
3663
+ var handlers_1 = __webpack_require__(3);
3664
+ var remoteCamera;
3665
+ (function (remoteCamera) {
3666
+ /**
3667
+ * @private
3668
+ * Hide from docs
3669
+ *
3670
+ * Enum used to indicate possible camera control commands.
3671
+ */
3672
+ var ControlCommand;
3673
+ (function (ControlCommand) {
3674
+ ControlCommand["Reset"] = "Reset";
3675
+ ControlCommand["ZoomIn"] = "ZoomIn";
3676
+ ControlCommand["ZoomOut"] = "ZoomOut";
3677
+ ControlCommand["PanLeft"] = "PanLeft";
3678
+ ControlCommand["PanRight"] = "PanRight";
3679
+ ControlCommand["TiltUp"] = "TiltUp";
3680
+ ControlCommand["TiltDown"] = "TiltDown";
3681
+ })(ControlCommand = remoteCamera.ControlCommand || (remoteCamera.ControlCommand = {}));
3682
+ /**
3683
+ * @private
3684
+ * Hide from docs
3685
+ *
3686
+ * Enum used to indicate the reason for the error.
3687
+ */
3688
+ var ErrorReason;
3689
+ (function (ErrorReason) {
3690
+ ErrorReason[ErrorReason["CommandResetError"] = 0] = "CommandResetError";
3691
+ ErrorReason[ErrorReason["CommandZoomInError"] = 1] = "CommandZoomInError";
3692
+ ErrorReason[ErrorReason["CommandZoomOutError"] = 2] = "CommandZoomOutError";
3693
+ ErrorReason[ErrorReason["CommandPanLeftError"] = 3] = "CommandPanLeftError";
3694
+ ErrorReason[ErrorReason["CommandPanRightError"] = 4] = "CommandPanRightError";
3695
+ ErrorReason[ErrorReason["CommandTiltUpError"] = 5] = "CommandTiltUpError";
3696
+ ErrorReason[ErrorReason["CommandTiltDownError"] = 6] = "CommandTiltDownError";
3697
+ ErrorReason[ErrorReason["SendDataError"] = 7] = "SendDataError";
3698
+ })(ErrorReason = remoteCamera.ErrorReason || (remoteCamera.ErrorReason = {}));
3699
+ /**
3700
+ * @private
3701
+ * Hide from docs
3702
+ *
3703
+ * Enum used to indicate the reason the session was terminated.
3704
+ */
3705
+ var SessionTerminatedReason;
3706
+ (function (SessionTerminatedReason) {
3707
+ SessionTerminatedReason[SessionTerminatedReason["None"] = 0] = "None";
3708
+ SessionTerminatedReason[SessionTerminatedReason["ControlDenied"] = 1] = "ControlDenied";
3709
+ SessionTerminatedReason[SessionTerminatedReason["ControlNoResponse"] = 2] = "ControlNoResponse";
3710
+ SessionTerminatedReason[SessionTerminatedReason["ControlBusy"] = 3] = "ControlBusy";
3711
+ SessionTerminatedReason[SessionTerminatedReason["AckTimeout"] = 4] = "AckTimeout";
3712
+ SessionTerminatedReason[SessionTerminatedReason["ControlTerminated"] = 5] = "ControlTerminated";
3713
+ SessionTerminatedReason[SessionTerminatedReason["ControllerTerminated"] = 6] = "ControllerTerminated";
3714
+ SessionTerminatedReason[SessionTerminatedReason["DataChannelError"] = 7] = "DataChannelError";
3715
+ SessionTerminatedReason[SessionTerminatedReason["ControllerCancelled"] = 8] = "ControllerCancelled";
3716
+ SessionTerminatedReason[SessionTerminatedReason["ControlDisabled"] = 9] = "ControlDisabled";
3717
+ })(SessionTerminatedReason = remoteCamera.SessionTerminatedReason || (remoteCamera.SessionTerminatedReason = {}));
3718
+ /**
3719
+ * @private
3720
+ * Hide from docs
3721
+ *
3722
+ * Fetch a list of the participants with controllable-cameras in a meeting.
3723
+ * @param callback Callback contains 2 parameters, error and participants.
3724
+ * error can either contain an error of type SdkError, incase of an error, or null when fetch is successful
3725
+ * participants can either contain an array of Participant objects, incase of a successful fetch or null when it fails
3726
+ * participants: object that contains an array of participants with controllable-cameras
3727
+ */
3728
+ function getCapableParticipants(callback) {
3729
+ if (!callback) {
3730
+ throw new Error('[remoteCamera.getCapableParticipants] Callback cannot be null');
3731
+ }
3732
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3733
+ communication_1.sendMessageToParent('remoteCamera.getCapableParticipants', callback);
3734
+ }
3735
+ remoteCamera.getCapableParticipants = getCapableParticipants;
3736
+ /**
3737
+ * @private
3738
+ * Hide from docs
3739
+ *
3740
+ * Request control of a participant's camera.
3741
+ * @param participant Participant specifies the participant to send the request for camera control.
3742
+ * @param callback Callback contains 2 parameters, error and requestResponse.
3743
+ * error can either contain an error of type SdkError, incase of an error, or null when fetch is successful
3744
+ * requestResponse can either contain the true/false value, incase of a successful request or null when it fails
3745
+ * requestResponse: True means request was accepted and false means request was denied
3746
+ */
3747
+ function requestControl(participant, callback) {
3748
+ if (!participant) {
3749
+ throw new Error('[remoteCamera.requestControl] Participant cannot be null');
3750
+ }
3751
+ if (!callback) {
3752
+ throw new Error('[remoteCamera.requestControl] Callback cannot be null');
3753
+ }
3754
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3755
+ communication_1.sendMessageToParent('remoteCamera.requestControl', [participant], callback);
3756
+ }
3757
+ remoteCamera.requestControl = requestControl;
3758
+ /**
3759
+ * @private
3760
+ * Hide from docs
3761
+ *
3762
+ * Send control command to the participant's camera.
3763
+ * @param ControlCommand ControlCommand specifies the command for controling the camera.
3764
+ * @param callback Callback to invoke when the command response returns.
3765
+ */
3766
+ function sendControlCommand(ControlCommand, callback) {
3767
+ if (!ControlCommand) {
3768
+ throw new Error('[remoteCamera.sendControlCommand] ControlCommand cannot be null');
3769
+ }
3770
+ if (!callback) {
3771
+ throw new Error('[remoteCamera.sendControlCommand] Callback cannot be null');
3772
+ }
3773
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3774
+ communication_1.sendMessageToParent('remoteCamera.sendControlCommand', [ControlCommand], callback);
3775
+ }
3776
+ remoteCamera.sendControlCommand = sendControlCommand;
3777
+ /**
3778
+ * @private
3779
+ * Hide from docs
3780
+ *
3781
+ * Terminate the remote session
3782
+ * @param callback Callback to invoke when the command response returns.
3783
+ */
3784
+ function terminateSession(callback) {
3785
+ if (!callback) {
3786
+ throw new Error('[remoteCamera.terminateSession] Callback cannot be null');
3787
+ }
3788
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3789
+ communication_1.sendMessageToParent('remoteCamera.terminateSession', callback);
3790
+ }
3791
+ remoteCamera.terminateSession = terminateSession;
3792
+ /**
3793
+ * Registers a handler for change in participants with controllable-cameras.
3794
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
3795
+ * @param handler The handler to invoke when the list of participants with controllable-cameras changes.
3796
+ */
3797
+ function registerOnCapableParticipantsChangeHandler(handler) {
3798
+ if (!handler) {
3799
+ throw new Error('[remoteCamera.registerOnCapableParticipantsChangeHandler] Handler cannot be null');
3800
+ }
3801
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3802
+ handlers_1.registerHandler('remoteCamera.capableParticipantsChange', handler);
3803
+ }
3804
+ remoteCamera.registerOnCapableParticipantsChangeHandler = registerOnCapableParticipantsChangeHandler;
3805
+ /**
3806
+ * Registers a handler for error.
3807
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
3808
+ * @param handler The handler to invoke when there is an error from the camera handler.
3809
+ */
3810
+ function registerOnErrorHandler(handler) {
3811
+ if (!handler) {
3812
+ throw new Error('[remoteCamera.registerOnErrorHandler] Handler cannot be null');
3813
+ }
3814
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3815
+ handlers_1.registerHandler('remoteCamera.handlerError', handler);
3816
+ }
3817
+ remoteCamera.registerOnErrorHandler = registerOnErrorHandler;
3818
+ /**
3819
+ * Registers a handler for device state change.
3820
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
3821
+ * @param handler The handler to invoke when the controlled device changes state.
3822
+ */
3823
+ function registerOnDeviceStateChangeHandler(handler) {
3824
+ if (!handler) {
3825
+ throw new Error('[remoteCamera.registerOnDeviceStateChangeHandler] Handler cannot be null');
3826
+ }
3827
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3828
+ handlers_1.registerHandler('remoteCamera.deviceStateChange', handler);
3829
+ }
3830
+ remoteCamera.registerOnDeviceStateChangeHandler = registerOnDeviceStateChangeHandler;
3831
+ /**
3832
+ * Registers a handler for session status change.
3833
+ * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
3834
+ * @param handler The handler to invoke when the current session status changes.
3835
+ */
3836
+ function registerOnSessionStatusChangeHandler(handler) {
3837
+ if (!handler) {
3838
+ throw new Error('[remoteCamera.registerOnSessionStatusChangeHandler] Handler cannot be null');
3839
+ }
3840
+ internalAPIs_1.ensureInitialized(constants_1.FrameContexts.sidePanel);
3841
+ handlers_1.registerHandler('remoteCamera.sessionStatusChange', handler);
3842
+ }
3843
+ remoteCamera.registerOnSessionStatusChangeHandler = registerOnSessionStatusChangeHandler;
3844
+ })(remoteCamera = exports.remoteCamera || (exports.remoteCamera = {}));
3845
+
3846
+
3847
+ /***/ }),
3848
+ /* 36 */
3849
+ /***/ (function(module, exports, __webpack_require__) {
3850
+
3851
+ "use strict";
3852
+
3853
+ Object.defineProperty(exports, "__esModule", { value: true });
3854
+ var communication_1 = __webpack_require__(0);
3855
+ var internalAPIs_1 = __webpack_require__(1);
3856
+ var public_1 = __webpack_require__(8);
3857
+ /**
3858
+ * Namespace to interact with the files specific part of the SDK.
3859
+ *
3860
+ * @private
3861
+ * Hide from docs
3862
+ */
3863
+ var files;
3864
+ (function (files) {
3865
+ /**
3866
+ * @private
3867
+ * Hide from docs
3868
+ *
3869
+ * Cloud storage providers registered with Microsoft Teams
3870
+ */
3871
+ var CloudStorageProvider;
3872
+ (function (CloudStorageProvider) {
3873
+ CloudStorageProvider["Dropbox"] = "DROPBOX";
3874
+ CloudStorageProvider["Box"] = "BOX";
3875
+ CloudStorageProvider["Sharefile"] = "SHAREFILE";
3876
+ CloudStorageProvider["GoogleDrive"] = "GOOGLEDRIVE";
3877
+ CloudStorageProvider["Egnyte"] = "EGNYTE";
3878
+ })(CloudStorageProvider = files.CloudStorageProvider || (files.CloudStorageProvider = {}));
3879
+ /**
3880
+ * @private
3881
+ * Hide from docs
3882
+ *
3883
+ * Cloud storage provider integration type
3884
+ */
3885
+ var CloudStorageProviderType;
3886
+ (function (CloudStorageProviderType) {
3887
+ CloudStorageProviderType[CloudStorageProviderType["Sharepoint"] = 0] = "Sharepoint";
3888
+ CloudStorageProviderType[CloudStorageProviderType["WopiIntegration"] = 1] = "WopiIntegration";
3889
+ CloudStorageProviderType[CloudStorageProviderType["Google"] = 2] = "Google";
3890
+ })(CloudStorageProviderType = files.CloudStorageProviderType || (files.CloudStorageProviderType = {}));
3891
+ /**
3892
+ * @private
3893
+ * Hide from docs
3894
+ *
3895
+ * Gets a list of cloud storage folders added to the channel
3896
+ * @param channelId ID of the channel whose cloud storage folders should be retrieved
3897
+ * @param callback Callback that will be triggered post folders load
3898
+ */
3899
+ function getCloudStorageFolders(channelId, callback) {
3900
+ internalAPIs_1.ensureInitialized(public_1.FrameContexts.content);
3901
+ if (!channelId || channelId.length == 0) {
3902
+ throw new Error('[files.getCloudStorageFolders] channelId name cannot be null or empty');
3903
+ }
3904
+ if (!callback) {
3905
+ throw new Error('[files.getCloudStorageFolders] Callback cannot be null');
3906
+ }
3907
+ communication_1.sendMessageToParent('files.getCloudStorageFolders', [channelId], callback);
3908
+ }
3909
+ files.getCloudStorageFolders = getCloudStorageFolders;
3910
+ /**
3911
+ * @private
3912
+ * Hide from docs
3913
+ *
3914
+ * Initiates the add cloud storage folder flow
3915
+ * @param channelId ID of the channel to add cloud storage folder
3916
+ * @param callback Callback that will be triggered post add folder flow is compelete
3917
+ */
3918
+ function addCloudStorageFolder(channelId, callback) {
3919
+ internalAPIs_1.ensureInitialized(public_1.FrameContexts.content);
3920
+ if (!channelId || channelId.length == 0) {
3921
+ throw new Error('[files.addCloudStorageFolder] channelId name cannot be null or empty');
3922
+ }
3923
+ if (!callback) {
3924
+ throw new Error('[files.addCloudStorageFolder] Callback cannot be null');
3925
+ }
3926
+ communication_1.sendMessageToParent('files.addCloudStorageFolder', [channelId], callback);
3927
+ }
3928
+ files.addCloudStorageFolder = addCloudStorageFolder;
3929
+ /**
3930
+ * @private
3931
+ * Hide from docs
3932
+ *
3933
+ * Deletes a cloud storage folder from channel
3934
+ * @param channelId ID of the channel where folder is to be deleted
3935
+ * @param folderToDelete cloud storage folder to be deleted
3936
+ * @param callback Callback that will be triggered post delete
3937
+ */
3938
+ function deleteCloudStorageFolder(channelId, folderToDelete, callback) {
3939
+ internalAPIs_1.ensureInitialized(public_1.FrameContexts.content);
3940
+ if (!channelId) {
3941
+ throw new Error('[files.deleteCloudStorageFolder] channelId name cannot be null or empty');
3942
+ }
3943
+ if (!folderToDelete) {
3944
+ throw new Error('[files.deleteCloudStorageFolder] folderToDelete cannot be null or empty');
3945
+ }
3946
+ if (!callback) {
3947
+ throw new Error('[files.deleteCloudStorageFolder] Callback cannot be null');
3948
+ }
3949
+ communication_1.sendMessageToParent('files.deleteCloudStorageFolder', [channelId, folderToDelete], callback);
3950
+ }
3951
+ files.deleteCloudStorageFolder = deleteCloudStorageFolder;
3952
+ /**
3953
+ * @private
3954
+ * Hide from docs
3955
+ *
3956
+ * Fetches the contents of a Cloud storage folder (CloudStorageFolder) / sub directory
3957
+ * @param folder Cloud storage folder (CloudStorageFolder) / sub directory (CloudStorageFolderItem)
3958
+ * @param providerCode Code of the cloud storage folder provider
3959
+ * @param callback Callback that will be triggered post contents are loaded
3960
+ */
3961
+ function getCloudStorageFolderContents(folder, providerCode, callback) {
3962
+ internalAPIs_1.ensureInitialized(public_1.FrameContexts.content);
3963
+ if (!folder || !providerCode) {
3964
+ throw new Error('[files.getCloudStorageFolderContents] folder/providerCode name cannot be null or empty');
3965
+ }
3966
+ if (!callback) {
3967
+ throw new Error('[files.getCloudStorageFolderContents] Callback cannot be null');
3968
+ }
3969
+ if ('isSubdirectory' in folder && !folder.isSubdirectory) {
3970
+ throw new Error('[files.getCloudStorageFolderContents] provided folder is not a subDirectory');
3971
+ }
3972
+ communication_1.sendMessageToParent('files.getCloudStorageFolderContents', [folder, providerCode], callback);
3973
+ }
3974
+ files.getCloudStorageFolderContents = getCloudStorageFolderContents;
3975
+ /**
3976
+ * @private
3977
+ * Hide from docs
3978
+ *
3979
+ * Open a cloud storage file in teams
3980
+ * @param file cloud storage file that should be opened
3981
+ * @param providerCode Code of the cloud storage folder provider
3982
+ * @param fileOpenPreference Whether file should be opened in web/inline
3983
+ */
3984
+ function openCloudStorageFile(file, providerCode, fileOpenPreference) {
3985
+ internalAPIs_1.ensureInitialized(public_1.FrameContexts.content);
3986
+ if (!file || !providerCode) {
3987
+ throw new Error('[files.openCloudStorageFile] file/providerCode cannot be null or empty');
3988
+ }
3989
+ if (file.isSubdirectory) {
3990
+ throw new Error('[files.openCloudStorageFile] provided file is a subDirectory');
3991
+ }
3992
+ communication_1.sendMessageToParent('files.openCloudStorageFile', [file, providerCode, fileOpenPreference]);
3993
+ }
3994
+ files.openCloudStorageFile = openCloudStorageFile;
3995
+ })(files = exports.files || (exports.files = {}));
3996
+
3997
+
3998
+ /***/ }),
3999
+ /* 37 */
4000
+ /***/ (function(module, exports, __webpack_require__) {
4001
+
4002
+ "use strict";
4003
+
4004
+ Object.defineProperty(exports, "__esModule", { value: true });
4005
+ var communication_1 = __webpack_require__(0);
4006
+ var internalAPIs_1 = __webpack_require__(1);
4007
+ var public_1 = __webpack_require__(8);
4008
+ /**
4009
+ * Namespace to interact with the application entities specific part of the SDK.
4010
+ *
4011
+ * @private
4012
+ * Hide from docs
4013
+ */
4014
+ var appEntity;
4015
+ (function (appEntity_1) {
4016
+ /**
4017
+ * @private
4018
+ * Hide from docs
4019
+ *
4020
+ * Open the Tab Gallery and retrieve the app entity
4021
+ * @param threadId ID of the thread where the app entity will be created
4022
+ * @param categories A list of app categories that will be displayed in the open tab gallery
4023
+ * @param callback Callback that will be triggered once the app entity information is available.
4024
+ * The callback takes two arguments: the app entity configuration, if available and
4025
+ * an optional SdkError in case something happened (i.e. the window was closed)
4026
+ */
4027
+ function selectAppEntity(threadId, categories, callback) {
4028
+ internalAPIs_1.ensureInitialized(public_1.FrameContexts.content);
4029
+ if (!threadId || threadId.length == 0) {
4030
+ throw new Error('[appEntity.selectAppEntity] threadId name cannot be null or empty');
4031
+ }
4032
+ if (!callback) {
4033
+ throw new Error('[appEntity.selectAppEntity] Callback cannot be null');
4034
+ }
4035
+ communication_1.sendMessageToParent('appEntity.selectAppEntity', [threadId, categories], callback);
4036
+ }
4037
+ appEntity_1.selectAppEntity = selectAppEntity;
4038
+ })(appEntity = exports.appEntity || (exports.appEntity = {}));
4039
+
4040
+
4041
+ /***/ })
4042
+ /******/ ]);
4043
+ });
4044
+ //# sourceMappingURL=MicrosoftTeams.js.map