@microsoft/teams-js 2.17.0-beta.1 → 2.17.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2819,6 +2819,20 @@ export const minAdaptiveCardVersion: AdaptiveCardVersion;
2819
2819
  * Adaptive Card version supported by the Teams v1 client.
2820
2820
  */
2821
2821
  export const teamsMinAdaptiveCardVersion: HostVersionsInfo;
2822
+ /**
2823
+ * @hidden
2824
+ * An error object indicates that the image count from visualMedia.image API is invalid.
2825
+ *
2826
+ * @beta
2827
+ */
2828
+ export const errorInvalidCount: Error;
2829
+ /**
2830
+ * @hidden
2831
+ * An error object indicates that the response from the visualMedia.image API is invalid.
2832
+ *
2833
+ * @beta
2834
+ */
2835
+ export const errorInvalidResponse: Error;
2822
2836
 
2823
2837
  /**
2824
2838
  * Represents information about tabs for an app
@@ -7796,6 +7810,199 @@ export namespace stageView {
7796
7810
  */
7797
7811
  export const version = "ERROR: This value should be replaced by webpack!";
7798
7812
 
7813
+ /**
7814
+ * @hidden
7815
+ * Interact with images. Allows the app developer ask the user to get images from their camera / camera roll / file system.
7816
+ *
7817
+ * @beta
7818
+ */
7819
+ export namespace visualMedia {
7820
+ /**
7821
+ * @hidden
7822
+ * All properties common to Image and Video Props
7823
+ *
7824
+ * @beta
7825
+ */
7826
+ interface VisualMediaProps {
7827
+ /**
7828
+ * @hidden
7829
+ * The maximum number of media items that can be selected at once is limited to values that are less than or equal to the maximum visual media selection limit.
7830
+ */
7831
+ maxVisualMediaCount: number;
7832
+ }
7833
+ /**
7834
+ * @hidden
7835
+ * The required value of the visualMedia files from gallery
7836
+ *
7837
+ * @beta
7838
+ */
7839
+ export interface GalleryProps {
7840
+ /**
7841
+ * The visualMedia source
7842
+ */
7843
+ source: Source.Gallery;
7844
+ }
7845
+ /**
7846
+ * @hidden
7847
+ * The required value of the visualMedia files from camera
7848
+ *
7849
+ * @beta
7850
+ */
7851
+ export interface CameraProps {
7852
+ /**
7853
+ * @hidden
7854
+ * The visualMedia source
7855
+ */
7856
+ source: Source.Camera;
7857
+ /**
7858
+ * @hidden
7859
+ * Optional; Specify whether users have the option to switch between the front and rear cameras. The default setting is FrontOrRear.
7860
+ * Default value is FrontOrRear
7861
+ */
7862
+ cameraRestriction?: CameraRestriction;
7863
+ }
7864
+ /**
7865
+ * @hidden
7866
+ * Indicate if user is allowed to move between front and back camera or stay in front/back camera only
7867
+ * If the camera option requested by the app isn't available, the SDK will silently default to the platform's standard camera.
7868
+ *
7869
+ * @beta
7870
+ */
7871
+ export enum CameraRestriction {
7872
+ /** User can move between front and back camera */
7873
+ FrontOrRear = 1,
7874
+ /** User can only use the front camera */
7875
+ FrontOnly = 2,
7876
+ /** User can only use the back camera */
7877
+ RearOnly = 3
7878
+ }
7879
+ /**
7880
+ * @hidden
7881
+ * Specifies the image source
7882
+ *
7883
+ * @beta
7884
+ */
7885
+ export enum Source {
7886
+ /** The camera is the source of visual media. */
7887
+ Camera = 1,
7888
+ /** The source of visual media is the gallery. */
7889
+ Gallery = 2
7890
+ }
7891
+ /**
7892
+ * @hidden
7893
+ * VisualMediaFile object that can be used to represent image or video from host apps.
7894
+ *
7895
+ * @beta
7896
+ */
7897
+ export interface VisualMediaFile {
7898
+ /**
7899
+ * @hidden
7900
+ * This is the base64 content of file.
7901
+ * If app needs to use this directly in HTML tags, it should convert this to a data url.
7902
+ */
7903
+ content: string;
7904
+ /**
7905
+ * @hidden
7906
+ * The size of file represented in VisualMediaFile in KB
7907
+ */
7908
+ sizeInKB: number;
7909
+ /**
7910
+ * @hidden
7911
+ * Name of the file (does not include the extension)
7912
+ */
7913
+ name: string;
7914
+ /**
7915
+ * @hidden
7916
+ * File's MIME type. More information on supported `mimeTypes`(https://docs.lens.xyz/docs/metadata-standards#supported-mime-types-for-imagesaudiovideos).
7917
+ */
7918
+ mimeType: string;
7919
+ }
7920
+ /**
7921
+ * @hidden
7922
+ * Checks whether or not visualMedia has user permission
7923
+ * @returns Promise that will resolve with true if the user had granted the app permission to media information(including Camera and Gallery permission), or with false otherwise,
7924
+ * In case of an error, promise will reject with the error.
7925
+ * @throws NOT_SUPPORTED_ON_PLATFORM Error if the DevicePermission.Media permission has not successfully granted.
7926
+ *
7927
+ * @beta
7928
+ */
7929
+ export function hasPermission(): Promise<boolean>;
7930
+ /**
7931
+ * @hidden
7932
+ * Requests user permission for visualMedia
7933
+ * @returns Promise that will resolve with true if the user consented permission for media(including Camera and Gallery permission), or with false otherwise,
7934
+ * In case of an error, promise will reject with the error.
7935
+ * @throws NOT_SUPPORTED_ON_PLATFORM Error if the DevicePermission.Media permission has not successfully granted.
7936
+ *
7937
+ * @beta
7938
+ */
7939
+ export function requestPermission(): Promise<boolean>;
7940
+ /**
7941
+ * @hidden
7942
+ * To enable this image capability will let the app developer ask the user to get images from camera/local storage
7943
+ *
7944
+ * @beta
7945
+ */
7946
+ export namespace image {
7947
+ /**
7948
+ * @hidden
7949
+ * CameraImageProperties is for the image taken from the camera
7950
+ *
7951
+ * @beta
7952
+ */
7953
+ interface CameraImageProperties extends VisualMediaProps {
7954
+ /**
7955
+ * @hidden
7956
+ * The source in CameraImageProperties should always be CameraProps
7957
+ */
7958
+ sourceProps: CameraProps;
7959
+ }
7960
+ /**
7961
+ * @hidden
7962
+ * CameraImageProperties is for the image taken from the camera
7963
+ *
7964
+ * @beta
7965
+ */
7966
+ interface GalleryImageProperties extends VisualMediaProps {
7967
+ /**
7968
+ * @hidden
7969
+ * The source in GalleryImageProperties should always be GalleryProps
7970
+ */
7971
+ sourceProps: GalleryProps;
7972
+ }
7973
+ /**
7974
+ * @hidden
7975
+ * Capture one or multiple image(s) using camera.
7976
+ * @param cameraImageInputs - The input params to customize the image(s) to be captured
7977
+ * @returns Promise that will resolve with {@link VisualMediaFile[]} object or reject with an error.
7978
+ * @throws INVALID_ARGUMENTS Error if imageInputs is null or imageInputs.maxVisualMediaCount is greater than maxVisualMediaSelectionLimit or lesser than 1.
7979
+ *
7980
+ * @beta
7981
+ */
7982
+ function captureImages(cameraImageInputs: CameraImageProperties): Promise<VisualMediaFile[]>;
7983
+ /**
7984
+ * @hidden
7985
+ * Upload the existing image(s) from the gallery.
7986
+ * @param galleryImageInputs - The input params to customize the image(s) to be captured
7987
+ * @returns Promise that will resolve with {@link VisualMediaFile[]} object or reject with an error.
7988
+ * @throws INVALID_ARGUMENTS Error if imageInputs is null or imageInputs.maxVisualMediaCount is greater than maxVisualMediaSelectionLimit or lesser than 1.
7989
+ *
7990
+ * @beta
7991
+ */
7992
+ function retrieveImages(galleryImageInputs: GalleryImageProperties): Promise<VisualMediaFile[]>;
7993
+ /**
7994
+ * @hidden
7995
+ * Checks if visualMedia.image capability is supported by the host
7996
+ * @returns boolean to represent whether visualMedia.image is supported
7997
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
7998
+ *
7999
+ * @beta
8000
+ */
8001
+ function isSupported(): boolean;
8002
+ }
8003
+ export {};
8004
+ }
8005
+
7799
8006
  /**
7800
8007
  * Contains functionality to allow web apps to store data in webview cache
7801
8008
  *
@@ -891,6 +891,7 @@ __webpack_require__.d(__webpack_exports__, {
891
891
  version: () => (/* reexport */ version),
892
892
  videoEffects: () => (/* reexport */ videoEffects),
893
893
  videoEffectsEx: () => (/* reexport */ videoEffectsEx),
894
+ visualMedia: () => (/* reexport */ visualMedia),
894
895
  webStorage: () => (/* reexport */ webStorage)
895
896
  });
896
897
 
@@ -1030,6 +1031,11 @@ var validOrigins = [
1030
1031
  'www.microsoft365.com',
1031
1032
  'bing.com',
1032
1033
  'edgeservices.bing.com',
1034
+ 'www.bing.com',
1035
+ 'www.staging-bing-int.com',
1036
+ 'teams.cloud.microsoft',
1037
+ 'outlook.cloud.microsoft',
1038
+ 'm365.cloud.microsoft',
1033
1039
  ];
1034
1040
  /**
1035
1041
  * @hidden
@@ -1476,6 +1482,20 @@ var minAdaptiveCardVersion = { majorVersion: 1, minorVersion: 5 };
1476
1482
  var teamsMinAdaptiveCardVersion = {
1477
1483
  adaptiveCardSchemaVersion: { majorVersion: 1, minorVersion: 5 },
1478
1484
  };
1485
+ /**
1486
+ * @hidden
1487
+ * An error object indicates that the image count from visualMedia.image API is invalid.
1488
+ *
1489
+ * @beta
1490
+ */
1491
+ var errorInvalidCount = new Error('Invalid input count: Must supply a valid image count (limit of 10).');
1492
+ /**
1493
+ * @hidden
1494
+ * An error object indicates that the response from the visualMedia.image API is invalid.
1495
+ *
1496
+ * @beta
1497
+ */
1498
+ var errorInvalidResponse = new Error('Invalid response: Received more images than the specified max limit in the response.');
1479
1499
 
1480
1500
  ;// CONCATENATED MODULE: ./src/internal/utils.ts
1481
1501
  /* eslint-disable @typescript-eslint/ban-types */
@@ -2249,7 +2269,7 @@ var _minRuntimeConfigToUninitialize = {
2249
2269
  * @hidden
2250
2270
  * Package version.
2251
2271
  */
2252
- var version = "2.17.0-beta.1";
2272
+ var version = "2.17.0-beta.2";
2253
2273
 
2254
2274
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2255
2275
 
@@ -9770,6 +9790,247 @@ var stageView;
9770
9790
  stageView.isSupported = isSupported;
9771
9791
  })(stageView || (stageView = {}));
9772
9792
 
9793
+ ;// CONCATENATED MODULE: ./src/public/visualMedia.ts
9794
+ var visualMedia_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
9795
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9796
+ return new (P || (P = Promise))(function (resolve, reject) {
9797
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9798
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9799
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9800
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9801
+ });
9802
+ };
9803
+ var visualMedia_generator = (undefined && undefined.__generator) || function (thisArg, body) {
9804
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
9805
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
9806
+ function verb(n) { return function (v) { return step([n, v]); }; }
9807
+ function step(op) {
9808
+ if (f) throw new TypeError("Generator is already executing.");
9809
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
9810
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
9811
+ if (y = 0, t) op = [op[0] & 2, t.value];
9812
+ switch (op[0]) {
9813
+ case 0: case 1: t = op; break;
9814
+ case 4: _.label++; return { value: op[1], done: false };
9815
+ case 5: _.label++; y = op[1]; op = [0]; continue;
9816
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
9817
+ default:
9818
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
9819
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
9820
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
9821
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
9822
+ if (t[2]) _.ops.pop();
9823
+ _.trys.pop(); continue;
9824
+ }
9825
+ op = body.call(thisArg, _);
9826
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
9827
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
9828
+ }
9829
+ };
9830
+
9831
+
9832
+
9833
+
9834
+
9835
+ /**
9836
+ * @hidden
9837
+ * Interact with images. Allows the app developer ask the user to get images from their camera / camera roll / file system.
9838
+ *
9839
+ * @beta
9840
+ */
9841
+ var visualMedia;
9842
+ (function (visualMedia) {
9843
+ var maxVisualMediaSelectionLimit = 10;
9844
+ /**
9845
+ * @hidden
9846
+ * Indicate if user is allowed to move between front and back camera or stay in front/back camera only
9847
+ * If the camera option requested by the app isn't available, the SDK will silently default to the platform's standard camera.
9848
+ *
9849
+ * @beta
9850
+ */
9851
+ var CameraRestriction;
9852
+ (function (CameraRestriction) {
9853
+ /** User can move between front and back camera */
9854
+ CameraRestriction[CameraRestriction["FrontOrRear"] = 1] = "FrontOrRear";
9855
+ /** User can only use the front camera */
9856
+ CameraRestriction[CameraRestriction["FrontOnly"] = 2] = "FrontOnly";
9857
+ /** User can only use the back camera */
9858
+ CameraRestriction[CameraRestriction["RearOnly"] = 3] = "RearOnly";
9859
+ })(CameraRestriction = visualMedia.CameraRestriction || (visualMedia.CameraRestriction = {}));
9860
+ /**
9861
+ * @hidden
9862
+ * Specifies the image source
9863
+ *
9864
+ * @beta
9865
+ */
9866
+ var Source;
9867
+ (function (Source) {
9868
+ /** The camera is the source of visual media. */
9869
+ Source[Source["Camera"] = 1] = "Camera";
9870
+ /** The source of visual media is the gallery. */
9871
+ Source[Source["Gallery"] = 2] = "Gallery";
9872
+ })(Source = visualMedia.Source || (visualMedia.Source = {}));
9873
+ /**
9874
+ * @hidden
9875
+ * Checks whether or not visualMedia has user permission
9876
+ * @returns Promise that will resolve with true if the user had granted the app permission to media information(including Camera and Gallery permission), or with false otherwise,
9877
+ * In case of an error, promise will reject with the error.
9878
+ * @throws NOT_SUPPORTED_ON_PLATFORM Error if the DevicePermission.Media permission has not successfully granted.
9879
+ *
9880
+ * @beta
9881
+ */
9882
+ function hasPermission() {
9883
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
9884
+ if (!image.isSupported()) {
9885
+ throw errorNotSupportedOnPlatform;
9886
+ }
9887
+ var permissions = DevicePermission.Media;
9888
+ return sendAndHandleSdkError('permissions.has', permissions);
9889
+ }
9890
+ visualMedia.hasPermission = hasPermission;
9891
+ /**
9892
+ * @hidden
9893
+ * Requests user permission for visualMedia
9894
+ * @returns Promise that will resolve with true if the user consented permission for media(including Camera and Gallery permission), or with false otherwise,
9895
+ * In case of an error, promise will reject with the error.
9896
+ * @throws NOT_SUPPORTED_ON_PLATFORM Error if the DevicePermission.Media permission has not successfully granted.
9897
+ *
9898
+ * @beta
9899
+ */
9900
+ function requestPermission() {
9901
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
9902
+ if (!image.isSupported()) {
9903
+ throw errorNotSupportedOnPlatform;
9904
+ }
9905
+ var permissions = DevicePermission.Media;
9906
+ return sendAndHandleSdkError('permissions.request', permissions);
9907
+ }
9908
+ visualMedia.requestPermission = requestPermission;
9909
+ /**
9910
+ * @hidden
9911
+ * To enable this image capability will let the app developer ask the user to get images from camera/local storage
9912
+ *
9913
+ * @beta
9914
+ */
9915
+ var image;
9916
+ (function (image) {
9917
+ /**
9918
+ * @hidden
9919
+ * Capture one or multiple image(s) using camera.
9920
+ * @param cameraImageInputs - The input params to customize the image(s) to be captured
9921
+ * @returns Promise that will resolve with {@link VisualMediaFile[]} object or reject with an error.
9922
+ * @throws INVALID_ARGUMENTS Error if imageInputs is null or imageInputs.maxVisualMediaCount is greater than maxVisualMediaSelectionLimit or lesser than 1.
9923
+ *
9924
+ * @beta
9925
+ */
9926
+ function captureImages(cameraImageInputs) {
9927
+ return visualMedia_awaiter(this, void 0, void 0, function () {
9928
+ var files;
9929
+ return visualMedia_generator(this, function (_a) {
9930
+ switch (_a.label) {
9931
+ case 0:
9932
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
9933
+ ensureSupported();
9934
+ ensureImageInputValid(cameraImageInputs);
9935
+ return [4 /*yield*/, sendAndHandleSdkError('visualMedia.image.captureImages', cameraImageInputs)];
9936
+ case 1:
9937
+ files = _a.sent();
9938
+ ensureResponseValid(cameraImageInputs.maxVisualMediaCount, files);
9939
+ return [2 /*return*/, files];
9940
+ }
9941
+ });
9942
+ });
9943
+ }
9944
+ image.captureImages = captureImages;
9945
+ /**
9946
+ * @hidden
9947
+ * Upload the existing image(s) from the gallery.
9948
+ * @param galleryImageInputs - The input params to customize the image(s) to be captured
9949
+ * @returns Promise that will resolve with {@link VisualMediaFile[]} object or reject with an error.
9950
+ * @throws INVALID_ARGUMENTS Error if imageInputs is null or imageInputs.maxVisualMediaCount is greater than maxVisualMediaSelectionLimit or lesser than 1.
9951
+ *
9952
+ * @beta
9953
+ */
9954
+ function retrieveImages(galleryImageInputs) {
9955
+ return visualMedia_awaiter(this, void 0, void 0, function () {
9956
+ var files;
9957
+ return visualMedia_generator(this, function (_a) {
9958
+ switch (_a.label) {
9959
+ case 0:
9960
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
9961
+ ensureSupported();
9962
+ ensureImageInputValid(galleryImageInputs);
9963
+ return [4 /*yield*/, sendAndHandleSdkError('visualMedia.image.retrieveImages', galleryImageInputs)];
9964
+ case 1:
9965
+ files = _a.sent();
9966
+ ensureResponseValid(galleryImageInputs.maxVisualMediaCount, files);
9967
+ return [2 /*return*/, files];
9968
+ }
9969
+ });
9970
+ });
9971
+ }
9972
+ image.retrieveImages = retrieveImages;
9973
+ /**
9974
+ * @hidden
9975
+ * Checks if visualMedia.image capability is supported by the host
9976
+ * @returns boolean to represent whether visualMedia.image is supported
9977
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
9978
+ *
9979
+ * @beta
9980
+ */
9981
+ function isSupported() {
9982
+ return ensureInitialized(runtime) &&
9983
+ runtime.supports.visualMedia &&
9984
+ runtime.supports.visualMedia.image &&
9985
+ runtime.supports.permissions
9986
+ ? true
9987
+ : false;
9988
+ }
9989
+ image.isSupported = isSupported;
9990
+ /**
9991
+ * @hidden
9992
+ * Ensure visualMedia.image capability is supported by the host
9993
+ * @throws errorNotSupportedOnPlatform error if isSupported() fails.
9994
+ *
9995
+ * @beta
9996
+ */
9997
+ function ensureSupported() {
9998
+ if (!isSupported()) {
9999
+ throw errorNotSupportedOnPlatform;
10000
+ }
10001
+ }
10002
+ /**
10003
+ * @hidden
10004
+ * @param imageInput the input can be either CameraImageProperties or GalleryImageProperties
10005
+ * @param source the expected Source
10006
+ * @throws error if the input check fails.
10007
+ * @beta
10008
+ */
10009
+ function ensureImageInputValid(imageInput) {
10010
+ if (!imageInput ||
10011
+ imageInput.maxVisualMediaCount > maxVisualMediaSelectionLimit ||
10012
+ imageInput.maxVisualMediaCount < 1) {
10013
+ throw errorInvalidCount;
10014
+ }
10015
+ }
10016
+ /**
10017
+ * @hidden
10018
+ * Ensure the number of images in the response is within the maximum limit.
10019
+ * @throws error if length check fails.
10020
+ * @param maxCount the maxVisualMediaCount set in the imageInpus
10021
+ * @param response the response passed from host app
10022
+ *
10023
+ * @beta
10024
+ */
10025
+ function ensureResponseValid(maxCount, response) {
10026
+ // to ensure the number of images in the response is within the maximum limit.
10027
+ if (response.length > maxCount) {
10028
+ throw errorInvalidResponse;
10029
+ }
10030
+ }
10031
+ })(image = visualMedia.image || (visualMedia.image = {}));
10032
+ })(visualMedia || (visualMedia = {}));
10033
+
9773
10034
  ;// CONCATENATED MODULE: ./src/public/webStorage.ts
9774
10035
 
9775
10036
 
@@ -11219,6 +11480,7 @@ var marketplace;
11219
11480
 
11220
11481
 
11221
11482
 
11483
+
11222
11484
 
11223
11485
 
11224
11486