@microsoft/teams-js 2.49.0-beta.0 → 2.49.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.
- package/README.md +4 -4
- package/dist/esm/packages/teams-js/dts/internal/urlPattern.d.ts +3 -0
- package/dist/esm/packages/teams-js/dts/private/interfaces.d.ts +24 -0
- package/dist/esm/packages/teams-js/src/internal/urlPattern.js +1 -1
- package/dist/esm/packages/teams-js/src/private/privateAPIs.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +28 -7
- package/dist/umd/MicrosoftTeams.js.map +1 -1
- package/dist/umd/MicrosoftTeams.min.js +1 -1
- package/dist/umd/MicrosoftTeams.min.js.map +1 -1
- package/package.json +53 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
|
|
|
24
24
|
|
|
25
25
|
### Production
|
|
26
26
|
|
|
27
|
-
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.
|
|
27
|
+
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.49.0/js/MicrosoftTeams.min.js) or point your package manager at them.
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
|
|
|
45
45
|
```html
|
|
46
46
|
<!-- Microsoft Teams JavaScript API (via CDN) -->
|
|
47
47
|
<script
|
|
48
|
-
src="https://res.cdn.office.net/teams-js/2.
|
|
49
|
-
integrity="sha384-
|
|
48
|
+
src="https://res.cdn.office.net/teams-js/2.49.0/js/MicrosoftTeams.min.js"
|
|
49
|
+
integrity="sha384-7wAL7GWYFgbQUP3f6/vtioav57bCRJ7ndOZUan7+vnCnuM5fPwvCzX+W5DzyjBJ5"
|
|
50
50
|
crossorigin="anonymous"
|
|
51
51
|
></script>
|
|
52
52
|
|
|
53
53
|
<!-- Microsoft Teams JavaScript API (via npm) -->
|
|
54
|
-
<script src="node_modules/@microsoft/teams-js@2.
|
|
54
|
+
<script src="node_modules/@microsoft/teams-js@2.49.0/dist/MicrosoftTeams.min.js"></script>
|
|
55
55
|
|
|
56
56
|
<!-- Microsoft Teams JavaScript API (via local) -->
|
|
57
57
|
<script src="MicrosoftTeams.min.js"></script>
|
|
@@ -15,13 +15,16 @@ export interface URLVerifier {
|
|
|
15
15
|
test: (url: URL) => boolean;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
+
* Checks if the provided host matches the given pattern, which may include a single wildcard segment.
|
|
18
19
|
* @param pattern - reference pattern
|
|
19
20
|
* @param host - candidate string
|
|
20
21
|
* @returns returns true if host matches pre-know valid pattern
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
|
|
25
|
+
* validateHostAgainstPattern('test.*.teams.microsoft.com', 'test.subdomain.teams.microsoft.com') returns true
|
|
24
26
|
* validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
|
|
27
|
+
* validateHostAgainstPattern('*.*.microsoft.com', 'test.team.microsoft.com') returns false
|
|
25
28
|
*
|
|
26
29
|
* @internal
|
|
27
30
|
* Limited to Microsoft-internal use
|
|
@@ -211,6 +211,30 @@ export interface FilePreviewParameters {
|
|
|
211
211
|
* Limited to Microsoft-internal use
|
|
212
212
|
*/
|
|
213
213
|
conversationId?: string;
|
|
214
|
+
/**
|
|
215
|
+
* @hidden
|
|
216
|
+
* Optional; id of message where this file is shared (if applicable)
|
|
217
|
+
*
|
|
218
|
+
* @internal
|
|
219
|
+
* Limited to Microsoft-internal use
|
|
220
|
+
*/
|
|
221
|
+
messageId?: string;
|
|
222
|
+
/**
|
|
223
|
+
* @hidden
|
|
224
|
+
* Optional; used internally to differentiate different callers from within an app
|
|
225
|
+
*
|
|
226
|
+
* @internal
|
|
227
|
+
* Limited to Microsoft-internal use
|
|
228
|
+
*/
|
|
229
|
+
callerInfo?: string;
|
|
230
|
+
/**
|
|
231
|
+
* @hidden
|
|
232
|
+
* Optional; serialised string of atp data which the apps may pass to expediate safelink validations that run when a file is opened
|
|
233
|
+
*
|
|
234
|
+
* @internal
|
|
235
|
+
* Limited to Microsoft-internal use
|
|
236
|
+
*/
|
|
237
|
+
atpData?: string;
|
|
214
238
|
}
|
|
215
239
|
/**
|
|
216
240
|
* @hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=/^[A-Za-z][A-Za-z\d+.-]*:\/\//;function
|
|
1
|
+
const t=/^[A-Za-z][A-Za-z\d+.-]*:\/\//;function e(t,e){const r=t.split("."),s=e.split(".");if(s.length!==r.length)return!1;let n=!1;for(let t=0;t<r.length;t++)if(r[t]!==s[t]){if("*"!==r[t])return!1;if(t===r.length-1||n)return!1;n=!0}return!0}class r{constructor(t,e,r){this.protocol=t,this.host=e,this.logger=r}static canUse(e){return t.test(e)}static create(t,e){const s=t.split("://");return new r(s[0],s[1],e.extend("InternalURLPattern"))}test(t){return this.logger("Testing URL %s against pattern protocol: %s, host: %s",t,this.protocol,this.host),t.protocol===`${this.protocol}:`&&(!t.host||e(this.host,t.host))}}function s(t){return r.canUse(t)}function n(t,e){if(r.canUse(t))return r.create(t,e);e("No URL verifier available for pattern: %s",t)}export{n as createURLVerifier,s as isValidPatternUrl,e as validateHostAgainstPattern};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shouldEventBeRelayedToChild as e,sendMessageEventToChild as t}from"../internal/childCommunication.js";import{sendMessageToParent as n}from"../internal/communication.js";import{registerHandler as i}from"../internal/handlers.js";import{ensureInitialized as r}from"../internal/internalAPIs.js";import{getApiVersionTag as o}from"../internal/telemetry.js";import{getGenericOnCompleteHandler as s}from"../internal/utils.js";import{FrameContexts as l}from"../public/constants.js";import{runtime as a}from"../public/runtime.js";const m="v1";function p(e,t){r(a),n(o(m,"uploadCustomApp"),"uploadCustomApp",[e],t||s())}function c(e,t,i){r(a),n(o(m,"sendCustomMessage"),e,t,i)}function
|
|
1
|
+
import{shouldEventBeRelayedToChild as e,sendMessageEventToChild as t}from"../internal/childCommunication.js";import{sendMessageToParent as n}from"../internal/communication.js";import{registerHandler as i}from"../internal/handlers.js";import{ensureInitialized as r}from"../internal/internalAPIs.js";import{getApiVersionTag as o}from"../internal/telemetry.js";import{getGenericOnCompleteHandler as s}from"../internal/utils.js";import{FrameContexts as l}from"../public/constants.js";import{runtime as a}from"../public/runtime.js";const m="v1";function p(e,t){r(a),n(o(m,"uploadCustomApp"),"uploadCustomApp",[e],t||s())}function c(e,t,i){r(a),n(o(m,"sendCustomMessage"),e,t,i)}function d(n,i){if(r(a),!e())throw new Error("The child window has not yet been initialized or is not present");t(n,i)}function u(e,t){r(a),i(o(m,"registerCustomHandler"),e,(...e)=>t.apply(this,e))}function f(e,t){r(a),i(o(m,"registerUserSettingsChangeHandler"),"userSettingsChange",t,!0,[e])}function w(e){r(a,l.content,l.sidePanel,l.task);const t=[e.entityId,e.title,e.description,e.type,e.objectUrl,e.downloadUrl,e.webPreviewUrl,e.webEditUrl,e.baseUrl,e.editFile,e.subEntityId,e.viewerAction,e.fileOpenPreference,e.conversationId,e.sizeInBytes,e.messageId,e.callerInfo,e.atpData];n(o(m,"openFilePreview"),"openFilePreview",t)}export{w as openFilePreview,u as registerCustomHandler,f as registerUserSettingsChangeHandler,d as sendCustomEvent,c as sendCustomMessage,p as uploadCustomApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o="2.49.0";export{o as version};
|
|
@@ -4669,7 +4669,7 @@ function isSerializable(arg) {
|
|
|
4669
4669
|
* @hidden
|
|
4670
4670
|
* Package version.
|
|
4671
4671
|
*/
|
|
4672
|
-
const version = "2.49.0
|
|
4672
|
+
const version = "2.49.0";
|
|
4673
4673
|
|
|
4674
4674
|
;// ./src/public/featureFlags.ts
|
|
4675
4675
|
// All build feature flags are defined inside this object. Any build feature flag must have its own unique getter and setter function. This pattern allows for client apps to treeshake unused code and avoid including code guarded by this feature flags in the final bundle. If this property isn't desired, use the below runtime feature flags object.
|
|
@@ -4808,24 +4808,42 @@ function flushMessageQueue(targetWindow, targetOrigin, targetMessageQueue, targe
|
|
|
4808
4808
|
*/
|
|
4809
4809
|
const userOriginUrlValidationRegExp = /^[A-Za-z][A-Za-z\d+.-]*:\/\//;
|
|
4810
4810
|
/**
|
|
4811
|
+
* Checks if the provided host matches the given pattern, which may include a single wildcard segment.
|
|
4811
4812
|
* @param pattern - reference pattern
|
|
4812
4813
|
* @param host - candidate string
|
|
4813
4814
|
* @returns returns true if host matches pre-know valid pattern
|
|
4814
4815
|
*
|
|
4815
4816
|
* @example
|
|
4816
4817
|
* validateHostAgainstPattern('*.teams.microsoft.com', 'subdomain.teams.microsoft.com') returns true
|
|
4818
|
+
* validateHostAgainstPattern('test.*.teams.microsoft.com', 'test.subdomain.teams.microsoft.com') returns true
|
|
4817
4819
|
* validateHostAgainstPattern('teams.microsoft.com', 'team.microsoft.com') returns false
|
|
4820
|
+
* validateHostAgainstPattern('*.*.microsoft.com', 'test.team.microsoft.com') returns false
|
|
4818
4821
|
*
|
|
4819
4822
|
* @internal
|
|
4820
4823
|
* Limited to Microsoft-internal use
|
|
4821
4824
|
*/
|
|
4822
4825
|
function validateHostAgainstPattern(pattern, host) {
|
|
4823
|
-
const
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4826
|
+
const patternSegments = pattern.split('.');
|
|
4827
|
+
const hostSegments = host.split('.');
|
|
4828
|
+
if (hostSegments.length !== patternSegments.length) {
|
|
4829
|
+
return false;
|
|
4830
|
+
}
|
|
4831
|
+
let hasUsedWildcard = false;
|
|
4832
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
4833
|
+
if (patternSegments[i] === hostSegments[i]) {
|
|
4834
|
+
continue;
|
|
4835
|
+
}
|
|
4836
|
+
if (patternSegments[i] !== '*') {
|
|
4837
|
+
return false;
|
|
4838
|
+
}
|
|
4839
|
+
// Wildcard in the last segment (TLD position) is not allowed for security reasons. Additionally, only one wildcard segment is allowed to prevent overly permissive patterns.
|
|
4840
|
+
if (i === patternSegments.length - 1 || hasUsedWildcard) {
|
|
4841
|
+
return false;
|
|
4842
|
+
}
|
|
4843
|
+
hasUsedWildcard = true;
|
|
4844
|
+
continue;
|
|
4845
|
+
}
|
|
4846
|
+
return true;
|
|
4829
4847
|
}
|
|
4830
4848
|
/**
|
|
4831
4849
|
* @hidden
|
|
@@ -9374,6 +9392,9 @@ function openFilePreview(filePreviewParameters) {
|
|
|
9374
9392
|
filePreviewParameters.fileOpenPreference,
|
|
9375
9393
|
filePreviewParameters.conversationId,
|
|
9376
9394
|
filePreviewParameters.sizeInBytes,
|
|
9395
|
+
filePreviewParameters.messageId,
|
|
9396
|
+
filePreviewParameters.callerInfo,
|
|
9397
|
+
filePreviewParameters.atpData,
|
|
9377
9398
|
];
|
|
9378
9399
|
sendMessageToParent(getApiVersionTag(privateAPIsTelemetryVersionNumber, "openFilePreview" /* ApiName.PrivateAPIs_OpenFilePreview */), 'openFilePreview', params);
|
|
9379
9400
|
}
|