@microsoft/teams-js 2.53.0 → 2.53.1
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/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/dist/esm/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/rng.js +1 -0
- package/dist/esm/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/stringify.js +1 -0
- package/dist/esm/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/v4.js +1 -0
- package/dist/esm/packages/teams-js/src/internal/communication.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/marketplaceUtils.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/utils.js +1 -1
- package/dist/esm/packages/teams-js/src/private/nestedAppAuth/nestedAppAuthBridge.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +110 -102
- 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 +1 -1
- package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/regex.js +0 -1
- package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js +0 -1
- package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js +0 -1
- package/dist/esm/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js +0 -1
- /package/dist/esm/node_modules/.pnpm/{uuid@9.0.1 → uuid@11.1.1}/node_modules/uuid/dist/esm-browser/native.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{uuid@9.0.1 → uuid@11.1.1}/node_modules/uuid/dist/esm-browser/validate.js +0 -0
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.53.
|
|
27
|
+
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.53.1/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.53.
|
|
49
|
-
integrity="sha384-
|
|
48
|
+
src="https://res.cdn.office.net/teams-js/2.53.1/js/MicrosoftTeams.min.js"
|
|
49
|
+
integrity="sha384-u/ADAeV1WhPQrTvoCmXcIhzguvD7vpAOyMxZFTIk4lTwgZAKtRKT1SFqOWTyQJ/s"
|
|
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.53.
|
|
54
|
+
<script src="node_modules/@microsoft/teams-js@2.53.1/dist/MicrosoftTeams.min.js"></script>
|
|
55
55
|
|
|
56
56
|
<!-- Microsoft Teams JavaScript API (via local) -->
|
|
57
57
|
<script src="MicrosoftTeams.min.js"></script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let t;const e=new Uint8Array(16);function o(){if(!t){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(e)}export{o as default};
|
package/dist/esm/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/stringify.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=[];for(let o=0;o<256;++o)t.push((o+256).toString(16).slice(1));function o(o,e=0){return(t[o[e+0]]+t[o[e+1]]+t[o[e+2]]+t[o[e+3]]+"-"+t[o[e+4]]+t[o[e+5]]+"-"+t[o[e+6]]+t[o[e+7]]+"-"+t[o[e+8]]+t[o[e+9]]+"-"+t[o[e+10]]+t[o[e+11]]+t[o[e+12]]+t[o[e+13]]+t[o[e+14]]+t[o[e+15]]).toLowerCase()}export{o as unsafeStringify};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./native.js";import n from"./rng.js";import{unsafeStringify as t}from"./stringify.js";function o(o,m,e){if(r.randomUUID&&!o)return r.randomUUID();const i=(o=o||{}).random??o.rng?.()??n();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,t(i)}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{isSdkError as n,ErrorCode as t}from"../public/interfaces.js";import{latestRuntimeApiVersion as o}from"../public/runtime.js";import{isSerializable as r}from"../public/serializable.interface.js";import{UUID as i}from"../public/uuidObject.js";import{version as s}from"../public/version.js";import{uninitializeChildCommunication as a,shouldProcessChildMessage as c,handleIncomingMessageFromChild as d}from"./childCommunication.js";import{getMessageIdsAsLogString as u,flushMessageQueue as l}from"./communicationUtils.js";import{GlobalVars as g}from"./globalVars.js";import{callHandler as p}from"./handlers.js";import f from"./hostToAppTelemetry.js";import{serializeMessageRequest as m,deserializeMessageResponse as w}from"./messageObjects.js";import{tryPolyfillWithNestedAppAuthBridge as h}from"./nestedAppAuthUtils.js";import{isFollowingApiVersionTagFormat as v,getLogger as b}from"./telemetry.js";import{getCurrentTimestamp as W,ssrSafeWindow as M}from"./utils.js";import{validateOrigin as y}from"./validOrigins.js";const k=b("communication");class I{}class T{}function E(n,t){if(T.messageListener=n=>function(n){return e(this,void 0,void 0,function*(){if(!n||!n.data||"object"!=typeof n.data)return void J("Unrecognized message format received by app, message being ignored. Message: %o",n);const e=n.source||n.originalEvent&&n.originalEvent.source,t=n.origin||n.originalEvent&&n.originalEvent.origin;return B(e,t).then(o=>{o?(!function(e,n){g.isFramelessWindow||I.parentWindow&&!I.parentWindow.closed&&e!==I.parentWindow||(I.parentWindow=e,I.parentOrigin=n);I.parentWindow&&I.parentWindow.closed&&(I.parentWindow=null,I.parentOrigin=null);l(I.parentWindow,I.parentOrigin,T.parentMessageQueue,"parent")}(e,t),e!==I.parentWindow?c(e,t)&&d(n,e,V,(e,n)=>T.callbacks.set(e,n)):Y(n)):J("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o",n,e,t)})})}(n),I.currentWindow=I.currentWindow||M(),I.parentWindow=I.currentWindow.parent!==I.currentWindow.self?I.currentWindow.parent:I.currentWindow.opener,I.topWindow=I.currentWindow.top,(I.parentWindow||n)&&I.currentWindow.addEventListener("message",T.messageListener,!1),!I.parentWindow){const e=I.currentWindow;if(!e.nativeInterface)return Promise.reject(new Error("Initialization Failed. No Parent window found."));g.isFramelessWindow=!0,e.onNativeMessage=Y}try{return I.parentOrigin="*",S(t,"initialize",[s,o,n]).then(([e,n,t,o])=>(h(o,I.currentWindow,{onMessage:D,sendPostMessage:L}),{context:e,clientType:n,runtimeConfig:t,clientSupportedSDKVersion:o}))}finally{I.parentOrigin=null}}function j(){I.currentWindow&&I.currentWindow.removeEventListener("message",T.messageListener,!1),I.currentWindow=null,I.parentWindow=null,I.parentOrigin=null,T.parentMessageQueue=[],T.nextMessageId=0,T.callbacks.clear(),T.promiseCallbacks.clear(),T.portCallbacks.clear(),T.legacyMessageIdsToUuidMap={},f.clearMessages(),a()}function O(e,n,...t){return S(e,n,t).then(([e])=>e)}function R(e,n,...t){return S(e,n,t).then(([e,n])=>{if(!e)throw new Error(n)})}function C(e,n,t,...o){return S(e,n,o).then(([e,n])=>{if(!e)throw new Error(n||t)})}function P(e,n,...t){return S(e,n,t).then(([e,n])=>{if(e)throw e;return n})}function S(e,n,t=void 0){if(!v(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);return new Promise(o=>{const r=V(e,n,t);var i;o((i=r.uuid,new Promise(e=>{T.promiseCallbacks.set(i,e)})))})}function x(e){return e.map(e=>r(e)?e.serialize():e)}function N(o,r,i,s,a){var c;return e(this,void 0,void 0,function*(){const e=x(r),[d]=yield S(s,o,e);if(a&&a(d)||!a&&n(d))throw new Error(`${d.errorCode}, message: ${null!==(c=d.message)&&void 0!==c?c:"None"}`);if(i.validate(d))return i.deserialize(d);throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host - ${JSON.stringify(d)}`)})}function A(o,r,i,s){var a;return e(this,void 0,void 0,function*(){const e=x(r),[c]=yield S(i,o,e);if(s&&s(c)||!s&&n(c))throw new Error(`${c.errorCode}, message: ${null!==(a=c.message)&&void 0!==a?a:"None"}`);if(void 0!==c)throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host`)})}function U(e,n,t=void 0){if(!v(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const o=V(e,n,t);return r=o.uuid,new Promise((e,n)=>{T.portCallbacks.set(r,(t,o)=>{t instanceof MessagePort?e(t):n(o&&o.length>0?o[0]:new Error("Host responded without port or error details."))})});var r}function $(e,n,t,o){let r;if(t instanceof Function?o=t:t instanceof Array&&(r=t),!v(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const i=V(e,n,r);o&&T.callbacks.set(i.uuid,o)}T.parentMessageQueue=[],T.topMessageQueue=[],T.nextMessageId=0,T.callbacks=new Map,T.promiseCallbacks=new Map,T.portCallbacks=new Map,T.legacyMessageIdsToUuidMap={};const z=k.extend("sendNestedAuthRequestToTopWindow");function L(e,n){const t=z,o=I.topWindow,r=function(e,n){const t=T.nextMessageId++,o=new i;return T.legacyMessageIdsToUuidMap[t]=o,{id:t,uuid:o,func:"nestedAppAuth.execute",timestamp:Date.now(),monotonicTimestamp:W(),apiVersionTag:n,args:[],data:e}}(e,n);return t("Message %s information: %o",u(r),{actionName:r.func}),F(o,r)}const _=k.extend("sendRequestToTargetWindowHelper");function F(e,n){const t=_,o=function(e){return e===I.topWindow&&Z()?"top":e===I.parentWindow?"parent":null}(e),r=m(n);if(g.isFramelessWindow)I.currentWindow&&I.currentWindow.nativeInterface&&(t("Sending message %s to %s via framelessPostMessage interface",u(r),o),I.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(r)));else{const i=function(e){return e===I.topWindow&&Z()?I.topOrigin:e===I.parentWindow?I.parentOrigin:null}(e);e&&i?(t("Sending message %s to %s via postMessage",u(r),o),e.postMessage(r,i)):(t("Adding message %s to %s message queue",u(r),o),ee(e).push(n))}return n}const Q=k.extend("sendMessageToParentHelper");function V(e,n,t,o,r){const s=Q,a=I.parentWindow,c=function(e,n,t,o,r){const s=T.nextMessageId++,a=new i;T.legacyMessageIdsToUuidMap[s]=a;const c=!0===o?r:g.teamsJsInstanceId;return{id:s,uuid:a,func:n,timestamp:Date.now(),monotonicTimestamp:W(),args:t||[],apiVersionTag:e,isProxiedFromChild:null!=o&&o,teamsJsInstanceId:c}}(e,n,t,o,r);return f.storeCallbackInformation(c.uuid,{name:n,calledAt:c.timestamp}),s("Message %s information: %o",u(c),{actionName:n,args:t}),F(a,c)}const J=k.extend("processIncomingMessage");const q=k.extend("processAuthBridgeMessage");function D(e,n){var t,o;const r=q;if(!e||!e.data||"object"!=typeof e.data)return void r("Unrecognized message format received by app, message being ignored. Message: %o",e);const{args:i}=e.data,[,s]=null!=i?i:[],a=(()=>{try{return JSON.parse(s)}catch(e){return null}})();if(!a||"object"!=typeof a||"NestedAppAuthResponse"!==a.messageType)return void r("Unrecognized data format received by app, message being ignored. Message: %o",e);const c=e.source||(null===(t=null==e?void 0:e.originalEvent)||void 0===t?void 0:t.source),d=e.origin||(null===(o=null==e?void 0:e.originalEvent)||void 0===o?void 0:o.origin);c?B(c,d)?(I.topWindow&&!I.topWindow.closed&&c!==I.topWindow||(I.topWindow=c,I.topOrigin=d),I.topWindow&&I.topWindow.closed&&(I.topWindow=null,I.topOrigin=null),l(I.topWindow,I.topOrigin,T.topMessageQueue,"top"),n(s)):r("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin"):r("Message being ignored by app because it is coming for a target that is null")}const H=k.extend("shouldProcessIncomingMessage");function B(n,t){return e(this,void 0,void 0,function*(){if(I.currentWindow&&n===I.currentWindow)return H("Should not process message because it is coming from the current window"),!1;if(I.currentWindow&&I.currentWindow.location&&t&&t===I.currentWindow.location.origin)return!0;{let e;try{e=new URL(t)}catch(e){return H("Message has an invalid origin of %s",t),!1}const n=yield y(e);return n||H("Message has an invalid origin of %s",t),n}})}const K=k.extend("handleIncomingMessageFromParent");function G(e,n){if(n){const t=[...e].find(([e,t])=>e.toString()===n.toString());if(t)return t[0]}}function X(e,n){const t=G(n,e.uuid);t&&n.delete(t),e.uuid?T.legacyMessageIdsToUuidMap={}:delete T.legacyMessageIdsToUuidMap[e.id]}function Y(e){const n=K,t=W();if("id"in e.data&&"number"==typeof e.data.id){const o=e.data,r=w(o),i=function(e){const n=K;if(!e.uuid)return T.legacyMessageIdsToUuidMap[e.id];{const n=e.uuid,t=G(T.callbacks,n);if(t)return t;const o=G(T.promiseCallbacks,n);if(o)return o;const r=G(T.portCallbacks,n);if(r)return r}n("Received message %s that failed to produce a callbackId",u(e))}(r);if(i){const o=T.callbacks.get(i);n("Received a response from parent for message %s",i.toString()),f.handlePerformanceMetrics(i,r,n,t),o&&(n("Invoking the registered callback for message %s with arguments %o",i.toString(),r.args),o.apply(null,[...r.args,r.isPartialResponse]),function(e){return!0===e.data.isPartialResponse}(e)||(n("Removing registered callback for message %s",i.toString()),X(r,T.callbacks)));const s=T.promiseCallbacks.get(i);s&&(n("Invoking the registered promise callback for message %s with arguments %o",i.toString(),r.args),s(r.args),n("Removing registered promise callback for message %s",i.toString()),X(r,T.promiseCallbacks));const a=T.portCallbacks.get(i);if(a){let t;n("Invoking the registered port callback for message %s with arguments %o",i.toString(),r.args),e.ports&&e.ports[0]instanceof MessagePort&&(t=e.ports[0]),a(t,r.args),n("Removing registered port callback for message %s",i.toString()),X(r,T.portCallbacks)}r.uuid&&(T.legacyMessageIdsToUuidMap={})}}else if("func"in e.data&&"string"==typeof e.data.func){const o=e.data;f.handleOneWayPerformanceMetrics(o,n,t),n('Received a message from parent %s, action: "%s"',u(o),o.func),p(o.func,o.args)}else n("Received an unknown message: %O",e)}function Z(){return I.topWindow!==I.parentWindow}function ee(e){return e===I.topWindow&&Z()?T.topMessageQueue:e===I.parentWindow?T.parentMessageQueue:[]}function ne(e,n){let t;t=I.currentWindow.setInterval(()=>{0===ee(e).length&&(clearInterval(t),n())},100)}export{I as Communication,A as callFunctionInHost,N as callFunctionInHostAndHandleResponse,E as initializeCommunication,U as requestPortFromParentWithVersion,P as sendAndHandleSdkError,R as sendAndHandleStatusAndReason,C as sendAndHandleStatusAndReasonWithDefaultError,O as sendAndUnwrap,$ as sendMessageToParent,S as sendMessageToParentAsync,L as sendNestedAuthRequestToTopWindow,j as uninitializeCommunication,ne as waitForMessageQueue};
|
|
1
|
+
import{__awaiter as e}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{isSdkError as n,ErrorCode as t}from"../public/interfaces.js";import{latestRuntimeApiVersion as o}from"../public/runtime.js";import{isSerializable as r}from"../public/serializable.interface.js";import{UUID as i}from"../public/uuidObject.js";import{version as s}from"../public/version.js";import{uninitializeChildCommunication as a,shouldProcessChildMessage as c,handleIncomingMessageFromChild as d}from"./childCommunication.js";import{getMessageIdsAsLogString as u,flushMessageQueue as l}from"./communicationUtils.js";import{GlobalVars as g}from"./globalVars.js";import{callHandler as p}from"./handlers.js";import f from"./hostToAppTelemetry.js";import{serializeMessageRequest as m,deserializeMessageResponse as w}from"./messageObjects.js";import{tryPolyfillWithNestedAppAuthBridge as h}from"./nestedAppAuthUtils.js";import{isFollowingApiVersionTagFormat as v,getLogger as b}from"./telemetry.js";import{getCurrentTimestamp as W,ssrSafeWindow as M}from"./utils.js";import{validateOrigin as y}from"./validOrigins.js";const k=b("communication");class I{}class T{}function E(n,t){if(T.messageListener=n=>function(n){return e(this,void 0,void 0,function*(){if(!n||!n.data||"object"!=typeof n.data)return void J("Unrecognized message format received by app, message being ignored. Message: %o",n);const e=n.source||n.originalEvent&&n.originalEvent.source,t=n.origin||n.originalEvent&&n.originalEvent.origin;return B(e,t).then(o=>{o?(!function(e,n){g.isFramelessWindow||I.parentWindow&&!I.parentWindow.closed&&e!==I.parentWindow||(I.parentWindow=e,I.parentOrigin=n);I.parentWindow&&I.parentWindow.closed&&(I.parentWindow=null,I.parentOrigin=null);l(I.parentWindow,I.parentOrigin,T.parentMessageQueue,"parent")}(e,t),e!==I.parentWindow?c(e,t)&&d(n,e,V,(e,n)=>T.callbacks.set(e,n)):Y(n)):J("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o",n,e,t)})})}(n),I.currentWindow=I.currentWindow||M(),I.parentWindow=I.currentWindow.parent!==I.currentWindow.self?I.currentWindow.parent:I.currentWindow.opener,I.topWindow=I.currentWindow.top,(I.parentWindow||n)&&I.currentWindow.addEventListener("message",T.messageListener,!1),!I.parentWindow){const e=I.currentWindow;if(!e.nativeInterface)return Promise.reject(new Error("Initialization Failed. No Parent window found."));g.isFramelessWindow=!0,e.onNativeMessage=Y}try{return I.parentOrigin="*",S(t,"initialize",[s,o,n]).then(([e,n,t,o])=>(h(o,I.currentWindow,{onMessage:D,sendPostMessage:L}),{context:e,clientType:n,runtimeConfig:t,clientSupportedSDKVersion:o}))}finally{I.parentOrigin=null}}function j(){I.currentWindow&&I.currentWindow.removeEventListener("message",T.messageListener,!1),I.currentWindow=null,I.parentWindow=null,I.parentOrigin=null,T.parentMessageQueue=[],T.nextMessageId=0,T.callbacks.clear(),T.promiseCallbacks.clear(),T.portCallbacks.clear(),T.legacyMessageIdsToUuidMap={},f.clearMessages(),a()}function O(e,n,...t){return S(e,n,t).then(([e])=>e)}function R(e,n,...t){return S(e,n,t).then(([e,n])=>{if(!e)throw new Error(n)})}function C(e,n,t,...o){return S(e,n,o).then(([e,n])=>{if(!e)throw new Error(n||t)})}function P(e,n,...t){return S(e,n,t).then(([e,n])=>{if(e)throw e;return n})}function S(e,n,t=void 0){if(!v(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);return new Promise(o=>{const r=V(e,n,t);var i;o((i=r.uuid,new Promise(e=>{T.promiseCallbacks.set(i,e)})))})}function x(e){return e.map(e=>r(e)?e.serialize():e)}function N(o,r,i,s,a){var c;return e(this,void 0,void 0,function*(){const e=x(r),[d]=yield S(s,o,e);if(a&&a(d)||!a&&n(d))throw new Error(`${d.errorCode}, message: ${null!==(c=d.message)&&void 0!==c?c:"None"}`);if(i.validate(d))return i.deserialize(d);throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host - ${JSON.stringify(d)}`)})}function U(o,r,i,s){var a;return e(this,void 0,void 0,function*(){const e=x(r),[c]=yield S(i,o,e);if(s&&s(c)||!s&&n(c))throw new Error(`${c.errorCode}, message: ${null!==(a=c.message)&&void 0!==a?a:"None"}`);if(void 0!==c)throw new Error(`${t.INTERNAL_ERROR}, message: Invalid response from host`)})}function A(e,n,t=void 0){if(!v(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const o=V(e,n,t);return r=o.uuid,new Promise((e,n)=>{T.portCallbacks.set(r,(t,o)=>{t instanceof MessagePort?e(t):n(o&&o.length>0?o[0]:new Error("Host responded without port or error details."))})});var r}function $(e,n,t,o){let r;if(t instanceof Function?o=t:t instanceof Array&&(r=t),!v(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const i=V(e,n,r);o&&T.callbacks.set(i.uuid,o)}T.parentMessageQueue=[],T.topMessageQueue=[],T.nextMessageId=0,T.callbacks=new Map,T.promiseCallbacks=new Map,T.portCallbacks=new Map,T.legacyMessageIdsToUuidMap={};const z=k.extend("sendNestedAuthRequestToTopWindow");function L(e,n){const t=z,o=I.topWindow,r=function(e,n){const t=T.nextMessageId++,o=new i;return T.legacyMessageIdsToUuidMap[t]=o,{id:t,uuid:o,func:"nestedAppAuth.execute",timestamp:Date.now(),monotonicTimestamp:W(),apiVersionTag:n,args:[],data:e}}(e,n);return t("Message %s information: %o",u(r),{actionName:r.func}),F(o,r)}const _=k.extend("sendRequestToTargetWindowHelper");function F(e,n){const t=_,o=function(e){return e===I.topWindow&&Z()?"top":e===I.parentWindow?"parent":null}(e),r=m(n);if(g.isFramelessWindow)I.currentWindow&&I.currentWindow.nativeInterface&&(t("Sending message %s to %s via framelessPostMessage interface",u(r),o),I.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(r)));else{const i=function(e){return e===I.topWindow&&Z()?I.topOrigin:e===I.parentWindow?I.parentOrigin:null}(e);e&&i?(t("Sending message %s to %s via postMessage",u(r),o),e.postMessage(r,i)):(t("Adding message %s to %s message queue",u(r),o),ee(e).push(n))}return n}const Q=k.extend("sendMessageToParentHelper");function V(e,n,t,o,r){const s=Q,a=I.parentWindow,c=function(e,n,t,o,r){const s=T.nextMessageId++,a=new i;T.legacyMessageIdsToUuidMap[s]=a;const c=!0===o?r:g.teamsJsInstanceId;return{id:s,uuid:a,func:n,timestamp:Date.now(),monotonicTimestamp:W(),args:t||[],apiVersionTag:e,isProxiedFromChild:null!=o&&o,teamsJsInstanceId:c}}(e,n,t,o,r);return f.storeCallbackInformation(c.uuid,{name:n,calledAt:c.timestamp}),s("Message %s information: %o",u(c),{actionName:n,args:t}),F(a,c)}const J=k.extend("processIncomingMessage");const q=k.extend("processAuthBridgeMessage");function D(e,n){var t,o;const r=q;if(!e||!e.data||"object"!=typeof e.data)return void r("Unrecognized message format received by app, message being ignored. Message: %o",e);const{args:i}=e.data,[,s]=null!=i?i:[],a=(()=>{try{return JSON.parse(s)}catch(e){return null}})();if(!a||"object"!=typeof a||"NestedAppAuthResponse"!==a.messageType)return void r("Unrecognized data format received by app, message being ignored. Message: %o",e);const c=e.source||(null===(t=null==e?void 0:e.originalEvent)||void 0===t?void 0:t.source),d=e.origin||(null===(o=null==e?void 0:e.originalEvent)||void 0===o?void 0:o.origin);c?B(c,d).then(e=>{e?(I.topWindow&&!I.topWindow.closed&&c!==I.topWindow||(I.topWindow=c,I.topOrigin=d),I.topWindow&&I.topWindow.closed&&(I.topWindow=null,I.topOrigin=null),l(I.topWindow,I.topOrigin,T.topMessageQueue,"top"),n(s)):r("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin")}).catch(e=>{r("Unexpected error verifying message origin: %o",e)}):r("Message being ignored by app because it is coming for a target that is null")}const H=k.extend("verifyIncomingMessageOrigin");function B(n,t){return e(this,void 0,void 0,function*(){if(I.currentWindow&&n===I.currentWindow)return H("Should not process message because it is coming from the current window"),!1;if(I.currentWindow&&I.currentWindow.location&&t&&t===I.currentWindow.location.origin)return!0;{let e;try{e=new URL(t)}catch(e){return H("Message has an invalid origin of %s",t),!1}const n=yield y(e);return n||H("Message has an invalid origin of %s",t),n}})}const K=k.extend("handleIncomingMessageFromParent");function G(e,n){if(n){const t=[...e].find(([e,t])=>e.toString()===n.toString());if(t)return t[0]}}function X(e,n){const t=G(n,e.uuid);t&&n.delete(t),e.uuid?T.legacyMessageIdsToUuidMap={}:delete T.legacyMessageIdsToUuidMap[e.id]}function Y(e){const n=K,t=W();if("id"in e.data&&"number"==typeof e.data.id){const o=e.data,r=w(o),i=function(e){const n=K;if(!e.uuid)return T.legacyMessageIdsToUuidMap[e.id];{const n=e.uuid,t=G(T.callbacks,n);if(t)return t;const o=G(T.promiseCallbacks,n);if(o)return o;const r=G(T.portCallbacks,n);if(r)return r}n("Received message %s that failed to produce a callbackId",u(e))}(r);if(i){const o=T.callbacks.get(i);n("Received a response from parent for message %s",i.toString()),f.handlePerformanceMetrics(i,r,n,t),o&&(n("Invoking the registered callback for message %s with arguments %o",i.toString(),r.args),o.apply(null,[...r.args,r.isPartialResponse]),function(e){return!0===e.data.isPartialResponse}(e)||(n("Removing registered callback for message %s",i.toString()),X(r,T.callbacks)));const s=T.promiseCallbacks.get(i);s&&(n("Invoking the registered promise callback for message %s with arguments %o",i.toString(),r.args),s(r.args),n("Removing registered promise callback for message %s",i.toString()),X(r,T.promiseCallbacks));const a=T.portCallbacks.get(i);if(a){let t;n("Invoking the registered port callback for message %s with arguments %o",i.toString(),r.args),e.ports&&e.ports[0]instanceof MessagePort&&(t=e.ports[0]),a(t,r.args),n("Removing registered port callback for message %s",i.toString()),X(r,T.portCallbacks)}r.uuid&&(T.legacyMessageIdsToUuidMap={})}}else if("func"in e.data&&"string"==typeof e.data.func){const o=e.data;f.handleOneWayPerformanceMetrics(o,n,t),n('Received a message from parent %s, action: "%s"',u(o),o.func),p(o.func,o.args)}else n("Received an unknown message: %O",e)}function Z(){return I.topWindow!==I.parentWindow}function ee(e){return e===I.topWindow&&Z()?T.topMessageQueue:e===I.parentWindow?T.parentMessageQueue:[]}function ne(e,n){let t;t=I.currentWindow.setInterval(()=>{0===ee(e).length&&(clearInterval(t),n())},100)}export{I as Communication,U as callFunctionInHost,N as callFunctionInHostAndHandleResponse,E as initializeCommunication,A as requestPortFromParentWithVersion,P as sendAndHandleSdkError,R as sendAndHandleStatusAndReason,C as sendAndHandleStatusAndReasonWithDefaultError,O as sendAndUnwrap,$ as sendMessageToParent,S as sendMessageToParentAsync,L as sendNestedAuthRequestToTopWindow,j as uninitializeCommunication,ne as waitForMessageQueue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as r}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{CartStatus as e}from"../public/marketplace.js";import t from"../../../../node_modules/.pnpm/uuid@
|
|
1
|
+
import{__rest as r}from"../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.55.1_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{CartStatus as e}from"../public/marketplace.js";import t from"../../../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/validate.js";function o(r){try{return r.cartItems=s(r.cartItems),r}catch(r){throw new Error("Error deserializing cart")}}function s(r){return r.map(r=>{if(r.imageURL){const e=new URL(r.imageURL);r.imageURL=e}return r.accessories&&(r.accessories=s(r.accessories)),r})}const i=e=>{try{return e.map(e=>{const{imageURL:t,accessories:o}=e,s=r(e,["imageURL","accessories"]),n=Object.assign({},s);return t&&(n.imageURL=t.href),o&&(n.accessories=i(o)),n})}catch(r){throw new Error("Error serializing cart items")}};function n(r){if(!Array.isArray(r)||0===r.length)throw new Error("cartItems must be a non-empty array");for(const e of r)c(e),a(e.accessories)}function a(r){if(null!=r){if(!Array.isArray(r)||0===r.length)throw new Error("CartItem.accessories must be a non-empty array");for(const e of r){if(e.accessories)throw new Error("Item in CartItem.accessories cannot have accessories");c(e)}}}function c(r){if(!r.id)throw new Error("cartItem.id must not be empty");if(!r.name)throw new Error("cartItem.name must not be empty");u(r.price),f(r.quantity)}function m(r){if(null!=r){if(!r)throw new Error("id must not be empty");if(!1===t(r))throw new Error("id must be a valid UUID")}}function u(r){if("number"!=typeof r||r<0)throw new Error(`price ${r} must be a number not less than 0`);if(parseFloat(r.toFixed(3))!==r)throw new Error(`price ${r} must have at most 3 decimal places`)}function f(r){if("number"!=typeof r||r<=0||parseInt(r.toString())!==r)throw new Error(`quantity ${r} must be an integer greater than 0`)}function p(r){if(!Object.values(e).includes(r))throw new Error(`cartStatus ${r} is not valid`)}export{o as deserializeCart,s as deserializeCartItems,i as serializeCartItems,a as validateAccessoryItems,c as validateBasicCartItem,n as validateCartItems,p as validateCartStatus,u as validatePrice,f as validateQuantity,m as validateUuid};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Buffer as t}from"../../../../_virtual/_polyfill-node.buffer.js";import{minAdaptiveCardVersion as e}from"../public/constants.js";import{LegalAgeGroupClassification as n}from"../public/interfaces.js";import r from"../../../../node_modules/.pnpm/uuid@
|
|
1
|
+
import{Buffer as t}from"../../../../_virtual/_polyfill-node.buffer.js";import{minAdaptiveCardVersion as e}from"../public/constants.js";import{LegalAgeGroupClassification as n}from"../public/interfaces.js";import r from"../../../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/v4.js";import o from"../../../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/validate.js";function i(t){return(t,e)=>{if(!t)throw new Error(e)}}function s(t,e){if("string"!=typeof t||"string"!=typeof e)return NaN;const n=t.split("."),r=e.split(".");function o(t){return/^\d+$/.test(t)}if(!n.every(o)||!r.every(o))return NaN;for(;n.length<r.length;)n.push("0");for(;r.length<n.length;)r.push("0");for(let t=0;t<n.length;++t)if(Number(n[t])!=Number(r[t]))return Number(n[t])>Number(r[t])?1:-1;return 0}function u(){return r()}function c(t){return Object.keys(t).forEach(e=>{null!==t[e]&&void 0!==t[e]&&"object"==typeof t[e]&&c(t[e])}),Object.freeze(t)}function a(t,e,...n){const r=t(...n);return r.then(t=>{e&&e(void 0,t)}).catch(t=>{e&&e(t)}),r}function l(t,e,...n){const r=t(...n);return r.then(()=>{e&&e(null)}).catch(t=>{e&&e(t)}),r}function f(t,e,...n){const r=t(...n);return r.then(t=>{e&&e(null,t)}).catch(t=>{e&&e(t,null)}),r}function p(t,e,n){return new Promise((r,o)=>{const i=setTimeout(o,e,n);t().then(t=>{clearTimeout(i),r(t)}).catch(t=>{clearTimeout(i),o(t)})})}function d(t){const e=new URL("https://teams.microsoft.com/l/entity/"+encodeURIComponent(t.appId.toString())+"/"+encodeURIComponent(t.pageId));return t.webUrl&&e.searchParams.append("webUrl",t.webUrl.toString()),(t.chatId||t.channelId||t.subPageId)&&e.searchParams.append("context",JSON.stringify({chatId:t.chatId,channelId:t.channelId,subEntityId:t.subPageId})),e.toString()}function m(t){return!(s(`${t.majorVersion}.${t.minorVersion}`,`${e.majorVersion}.${e.minorVersion}`)>=0)}function h(t){return"https:"===t.protocol}function b(e,n){return new Promise((r,o)=>{if(e||o("MimeType cannot be null or empty."),n||o("Base64 string cannot be null or empty."),e.startsWith("image/")){const t=atob(n),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);r(new Blob([o],{type:e}))}const i=t.from(n,"base64").toString();r(new Blob([i],{type:e}))})}function g(t){return new Promise((e,n)=>{0===t.size&&n(new Error("Blob cannot be empty."));const r=new FileReader;r.onloadend=()=>{r.result?e(r.result.toString().split(",")[1]):n(new Error("Failed to read the blob"))},r.onerror=()=>{n(r.error)},r.readAsDataURL(t)})}function w(){if(y())throw new Error("window object undefined at SSR check");return window}function y(){return"undefined"==typeof window}function j(t,e){if(E(t)||!function(t){return t.length<256&&t.length>4}(t)||!function(t){for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<32||n>126)return!1}return!0}(t))throw e||new Error("id is not valid.")}function I(t,e){const n=t.toString().toLocaleLowerCase();if(E(n))throw new Error("Invalid Url");if(n.length>2048)throw new Error("Url exceeds the maximum size of 2048 characters");if(!h(t))throw new Error("Url should be a valid https url")}function v(t){const e=document.createElement("a");return e.href=t,new URL(e.href)}function E(t){return new RegExp(`${/<script[^>]*>|<script[^&]*>|%3Cscript[^%]*%3E/gi.source}|${/<\/script[^>]*>|<\/script[^&]*>|%3C\/script[^%]*%3E/gi.source}`,"gi").test(t)}function O(t){if(!t)throw new Error("id must not be empty");if(!1===o(t))throw new Error("id must be a valid UUID")}const U=!!performance&&"now"in performance;function N(){return U?performance.now()+performance.timeOrigin:void 0}function S(t,e=0){if(e>1e3)return!1;if(void 0===t||"boolean"==typeof t||"number"==typeof t||"bigint"==typeof t||"string"==typeof t||null===t)return!0;if(Array.isArray(t))return t.every(t=>S(t,e+1));return!("object"!=typeof t||"[object Object]"!==Object.prototype.toString.call(t)||Object.getPrototypeOf(t)!==Object.prototype&&null!==Object.getPrototypeOf(t))&&Object.keys(t).every(n=>S(t[n],e+1))}function P(t){var e,r;if(!(null===(r=null===(e=t.hostVersionsInfo)||void 0===e?void 0:e.appEligibilityInformation)||void 0===r?void 0:r.ageGroup))return t;const o=t.hostVersionsInfo.appEligibilityInformation.ageGroup;return"nonadult"!==(null==o?void 0:o.toLowerCase())?t:Object.assign(Object.assign({},t),{hostVersionsInfo:Object.assign(Object.assign({},t.hostVersionsInfo),{appEligibilityInformation:Object.assign(Object.assign({},t.hostVersionsInfo.appEligibilityInformation),{ageGroup:n.NotAdult})})})}export{b as base64ToBlob,a as callCallbackWithErrorOrResultFromPromiseAndReturnPromise,f as callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise,l as callCallbackWithSdkErrorFromPromiseAndReturnPromise,s as compareSDKVersions,d as createTeamsAppLink,c as deepFreeze,v as fullyQualifyUrlString,u as generateGUID,g as getBase64StringFromBlob,N as getCurrentTimestamp,i as getGenericOnCompleteHandler,E as hasScriptTags,y as inServerSideRenderingEnvironment,m as isHostAdaptiveCardSchemaVersionUnsupported,S as isPrimitiveOrPlainObject,h as isValidHttpsURL,P as normalizeAgeGroupValue,p as runWithTimeout,w as ssrSafeWindow,j as validateId,I as validateUrl,O as validateUuid};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../../../../../node_modules/.pnpm/uuid@
|
|
1
|
+
import e from"../../../../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/v4.js";const t="1.0.1",n={onMessage:function(e,t){if(!e||!e.data||"object"!=typeof e.data||null===e.data)return void a("Invalid message format, ignoring. Message: %o",e);if(!function(e,t){if(t===o)try{return"https:"===new URL(t).protocol}catch(e){return d("Invalid message origin URL:",e),!1}return!1}(e.source,e.origin))return void a("Message source/origin not allowed, ignoring.");const{args:n}=e.data,[,r]=null!=n?n:[],i=(()=>{try{return JSON.parse(r)}catch(e){return d("Failed to parse response message:",e),null}})();if(!i||"NestedAppAuthResponse"!==i.messageType)return void a("Invalid response format, ignoring. Message: %o",e);t(r)}};let o=null,r=!1;function i(t,i,p=!1){if(r=p,!t)throw new Error("Cannot polyfill nestedAppAuthBridge as the current window does not exist");if(!i)throw new Error("Top origin is required to initialize the Nested App Auth Bridge");try{const e=new URL(i);if("https:"!==e.protocol)throw new Error(`Invalid top origin: ${i}. Only HTTPS origins are allowed.`);o=e.origin}catch(e){throw new Error(`Failed to initialize bridge: invalid top origin: ${i}`)}const u=t;if(u.nestedAppAuthBridge)return void a("Nested App Auth Bridge is already present");const g=function(t){const r=new WeakMap,{onMessage:i}=n,p=e=>t=>i(t,e);return{addEventListener:(e,n)=>{if("message"===e){const o=p(n);r.set(n,o),t.addEventListener(e,o)}else a(`Event ${e} is not supported by nestedAppAuthBridge`)},postMessage:n=>{if(!t.top)throw new Error("window.top is not available for posting messages");try{const r=JSON.parse(n);if("object"==typeof r&&"NestedAppAuthRequest"===r.messageType){const r=function(t){const n=Date.now();return{id:s(),uuid:e(),func:"nestedAppAuth.execute",timestamp:n,apiVersionTag:"v2_nestedAppAuth.execute",monotonicTimestamp:n,args:[],data:t}}(n);if(t===t.top||!o)return void d("Not in an embedded iframe; skipping postMessage.");t.top.postMessage(r,o)}}catch(e){return void d("Failed to parse message:",e,"Original message:",n)}},removeEventListener:(e,n)=>{const o=r.get(n);o&&(t.removeEventListener(e,o),r.delete(n))}}}(u);g&&(u.nestedAppAuthBridge=g)}function s(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2,11)}function a(...e){r&&console.log(...e)}function d(...e){r&&console.error(...e)}export{i as initialize,t as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="2.53.
|
|
1
|
+
const o="2.53.1";export{o as version};
|
|
@@ -3328,104 +3328,99 @@ function fromObject(obj) {
|
|
|
3328
3328
|
}
|
|
3329
3329
|
}
|
|
3330
3330
|
|
|
3331
|
-
;// ../../node_modules/.pnpm/uuid@
|
|
3331
|
+
;// ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/native.js
|
|
3332
3332
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3333
|
-
/* harmony default export */ const esm_browser_native = ({
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
;// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js
|
|
3337
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
3338
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
3339
|
-
// generators (like Math.random()).
|
|
3333
|
+
/* harmony default export */ const esm_browser_native = ({ randomUUID });
|
|
3334
|
+
|
|
3335
|
+
;// ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/rng.js
|
|
3340
3336
|
let getRandomValues;
|
|
3341
3337
|
const rnds8 = new Uint8Array(16);
|
|
3342
3338
|
function rng() {
|
|
3343
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
3344
|
-
if (!getRandomValues) {
|
|
3345
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
3346
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3347
|
-
|
|
3348
3339
|
if (!getRandomValues) {
|
|
3349
|
-
|
|
3340
|
+
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
3341
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
3342
|
+
}
|
|
3343
|
+
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
3350
3344
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
return getRandomValues(rnds8);
|
|
3345
|
+
return getRandomValues(rnds8);
|
|
3354
3346
|
}
|
|
3355
|
-
;// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js
|
|
3356
3347
|
|
|
3357
|
-
|
|
3358
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
3359
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
3360
|
-
*/
|
|
3348
|
+
;// ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/stringify.js
|
|
3361
3349
|
|
|
3362
3350
|
const byteToHex = [];
|
|
3363
|
-
|
|
3364
3351
|
for (let i = 0; i < 256; ++i) {
|
|
3365
|
-
|
|
3352
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
3366
3353
|
}
|
|
3367
|
-
|
|
3368
3354
|
function unsafeStringify(arr, offset = 0) {
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3355
|
+
return (byteToHex[arr[offset + 0]] +
|
|
3356
|
+
byteToHex[arr[offset + 1]] +
|
|
3357
|
+
byteToHex[arr[offset + 2]] +
|
|
3358
|
+
byteToHex[arr[offset + 3]] +
|
|
3359
|
+
'-' +
|
|
3360
|
+
byteToHex[arr[offset + 4]] +
|
|
3361
|
+
byteToHex[arr[offset + 5]] +
|
|
3362
|
+
'-' +
|
|
3363
|
+
byteToHex[arr[offset + 6]] +
|
|
3364
|
+
byteToHex[arr[offset + 7]] +
|
|
3365
|
+
'-' +
|
|
3366
|
+
byteToHex[arr[offset + 8]] +
|
|
3367
|
+
byteToHex[arr[offset + 9]] +
|
|
3368
|
+
'-' +
|
|
3369
|
+
byteToHex[arr[offset + 10]] +
|
|
3370
|
+
byteToHex[arr[offset + 11]] +
|
|
3371
|
+
byteToHex[arr[offset + 12]] +
|
|
3372
|
+
byteToHex[arr[offset + 13]] +
|
|
3373
|
+
byteToHex[arr[offset + 14]] +
|
|
3374
|
+
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
3372
3375
|
}
|
|
3373
|
-
|
|
3374
3376
|
function stringify(arr, offset = 0) {
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
if (!validate(uuid)) {
|
|
3382
|
-
throw TypeError('Stringified UUID is invalid');
|
|
3383
|
-
}
|
|
3384
|
-
|
|
3385
|
-
return uuid;
|
|
3377
|
+
const uuid = unsafeStringify(arr, offset);
|
|
3378
|
+
if (!validate(uuid)) {
|
|
3379
|
+
throw TypeError('Stringified UUID is invalid');
|
|
3380
|
+
}
|
|
3381
|
+
return uuid;
|
|
3386
3382
|
}
|
|
3387
|
-
|
|
3388
3383
|
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
|
|
3389
|
-
;// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js
|
|
3390
3384
|
|
|
3385
|
+
;// ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/v4.js
|
|
3391
3386
|
|
|
3392
3387
|
|
|
3393
3388
|
|
|
3394
3389
|
function v4(options, buf, offset) {
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
}
|
|
3398
|
-
|
|
3399
|
-
options = options || {};
|
|
3400
|
-
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
3401
|
-
|
|
3402
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
3403
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
3404
|
-
|
|
3405
|
-
if (buf) {
|
|
3406
|
-
offset = offset || 0;
|
|
3407
|
-
|
|
3408
|
-
for (let i = 0; i < 16; ++i) {
|
|
3409
|
-
buf[offset + i] = rnds[i];
|
|
3390
|
+
if (esm_browser_native.randomUUID && !buf && !options) {
|
|
3391
|
+
return esm_browser_native.randomUUID();
|
|
3410
3392
|
}
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3393
|
+
options = options || {};
|
|
3394
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
3395
|
+
if (rnds.length < 16) {
|
|
3396
|
+
throw new Error('Random bytes length must be >= 16');
|
|
3397
|
+
}
|
|
3398
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
3399
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
3400
|
+
if (buf) {
|
|
3401
|
+
offset = offset || 0;
|
|
3402
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
3403
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
3404
|
+
}
|
|
3405
|
+
for (let i = 0; i < 16; ++i) {
|
|
3406
|
+
buf[offset + i] = rnds[i];
|
|
3407
|
+
}
|
|
3408
|
+
return buf;
|
|
3409
|
+
}
|
|
3410
|
+
return unsafeStringify(rnds);
|
|
3416
3411
|
}
|
|
3417
|
-
|
|
3418
3412
|
/* harmony default export */ const esm_browser_v4 = (v4);
|
|
3419
|
-
;// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/regex.js
|
|
3420
|
-
/* harmony default export */ const regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
|
|
3421
|
-
;// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/validate.js
|
|
3422
3413
|
|
|
3414
|
+
;// ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/regex.js
|
|
3415
|
+
/* harmony default export */ const regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i);
|
|
3416
|
+
|
|
3417
|
+
;// ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/validate.js
|
|
3423
3418
|
|
|
3424
3419
|
function validate_validate(uuid) {
|
|
3425
|
-
|
|
3420
|
+
return typeof uuid === 'string' && regex.test(uuid);
|
|
3426
3421
|
}
|
|
3427
|
-
|
|
3428
3422
|
/* harmony default export */ const esm_browser_validate = (validate_validate);
|
|
3423
|
+
|
|
3429
3424
|
;// ./src/public/constants.ts
|
|
3430
3425
|
/** HostClientType represents the different client platforms on which host can be run. */
|
|
3431
3426
|
var HostClientType;
|
|
@@ -4679,7 +4674,7 @@ function isSerializable(arg) {
|
|
|
4679
4674
|
* @hidden
|
|
4680
4675
|
* Package version.
|
|
4681
4676
|
*/
|
|
4682
|
-
const version = "2.53.
|
|
4677
|
+
const version = "2.53.1";
|
|
4683
4678
|
|
|
4684
4679
|
;// ./src/public/featureFlags.ts
|
|
4685
4680
|
// 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.
|
|
@@ -8777,8 +8772,8 @@ function processIncomingMessage(evt) {
|
|
|
8777
8772
|
// in their call to app.initialize
|
|
8778
8773
|
const messageSource = evt.source || (evt.originalEvent && evt.originalEvent.source);
|
|
8779
8774
|
const messageOrigin = evt.origin || (evt.originalEvent && evt.originalEvent.origin);
|
|
8780
|
-
return
|
|
8781
|
-
if (!
|
|
8775
|
+
return verifyIncomingMessageOrigin(messageSource, messageOrigin).then((isOriginValid) => {
|
|
8776
|
+
if (!isOriginValid) {
|
|
8782
8777
|
processIncomingMessageLogger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o', evt, messageSource, messageOrigin);
|
|
8783
8778
|
return;
|
|
8784
8779
|
}
|
|
@@ -8835,44 +8830,57 @@ function processAuthBridgeMessage(evt, onMessageReceived) {
|
|
|
8835
8830
|
logger('Message being ignored by app because it is coming for a target that is null');
|
|
8836
8831
|
return;
|
|
8837
8832
|
}
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
Communication.
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
Communication.
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8833
|
+
verifyIncomingMessageOrigin(messageSource, messageOrigin)
|
|
8834
|
+
.then((isOriginValid) => {
|
|
8835
|
+
if (!isOriginValid) {
|
|
8836
|
+
logger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin');
|
|
8837
|
+
return;
|
|
8838
|
+
}
|
|
8839
|
+
/**
|
|
8840
|
+
* In most cases, top level window and the parent window will be same.
|
|
8841
|
+
* If they're not, perform the necessary updates for the top level window.
|
|
8842
|
+
*
|
|
8843
|
+
* Top window logic to flush messages is kept independent so that we don't affect
|
|
8844
|
+
* any of the code for the existing communication channel.
|
|
8845
|
+
*/
|
|
8846
|
+
if (!Communication.topWindow || Communication.topWindow.closed || messageSource === Communication.topWindow) {
|
|
8847
|
+
Communication.topWindow = messageSource;
|
|
8848
|
+
Communication.topOrigin = messageOrigin;
|
|
8849
|
+
}
|
|
8850
|
+
// Clean up pointers to closed parent
|
|
8851
|
+
if (Communication.topWindow && Communication.topWindow.closed) {
|
|
8852
|
+
Communication.topWindow = null;
|
|
8853
|
+
Communication.topOrigin = null;
|
|
8854
|
+
}
|
|
8855
|
+
flushMessageQueue(Communication.topWindow, Communication.topOrigin, CommunicationPrivate.topMessageQueue, 'top');
|
|
8856
|
+
// Return the response to the registered callback
|
|
8857
|
+
onMessageReceived(message);
|
|
8858
|
+
})
|
|
8859
|
+
.catch((err) => {
|
|
8860
|
+
// Sanity check; this should not execute
|
|
8861
|
+
logger('Unexpected error verifying message origin: %o', err);
|
|
8862
|
+
});
|
|
8861
8863
|
}
|
|
8862
|
-
const
|
|
8864
|
+
const verifyIncomingMessageOriginLogger = communication_communicationLogger.extend('verifyIncomingMessageOrigin');
|
|
8863
8865
|
/**
|
|
8864
8866
|
* @hidden
|
|
8865
|
-
*
|
|
8867
|
+
* Verifies that an incoming message originates from a different window and that its origin
|
|
8868
|
+
* is either in the pre-known allowlist or was supplied by the app developer during initialization.
|
|
8869
|
+
*
|
|
8870
|
+
* @param messageSource - The window that sent the message.
|
|
8871
|
+
* @param messageOrigin - The origin of the message.
|
|
8872
|
+
*
|
|
8873
|
+
* @returns A promise that resolves to `true` if the origin is valid and the message is safe to process, `false` otherwise.
|
|
8866
8874
|
*
|
|
8867
8875
|
* @internal
|
|
8868
8876
|
* Limited to Microsoft-internal use
|
|
8869
8877
|
*/
|
|
8870
|
-
function
|
|
8878
|
+
function verifyIncomingMessageOrigin(messageSource, messageOrigin) {
|
|
8871
8879
|
return communication_awaiter(this, void 0, void 0, function* () {
|
|
8872
8880
|
// Process if message source is a different window and if origin is either in
|
|
8873
8881
|
// Teams' pre-known whitelist or supplied as valid origin by user during initialization
|
|
8874
8882
|
if (Communication.currentWindow && messageSource === Communication.currentWindow) {
|
|
8875
|
-
|
|
8883
|
+
verifyIncomingMessageOriginLogger('Should not process message because it is coming from the current window');
|
|
8876
8884
|
return false;
|
|
8877
8885
|
}
|
|
8878
8886
|
else if (Communication.currentWindow &&
|
|
@@ -8887,12 +8895,12 @@ function shouldProcessIncomingMessage(messageSource, messageOrigin) {
|
|
|
8887
8895
|
messageOriginURL = new URL(messageOrigin);
|
|
8888
8896
|
}
|
|
8889
8897
|
catch (_) {
|
|
8890
|
-
|
|
8898
|
+
verifyIncomingMessageOriginLogger('Message has an invalid origin of %s', messageOrigin);
|
|
8891
8899
|
return false;
|
|
8892
8900
|
}
|
|
8893
8901
|
const isOriginValid = yield validateOrigin(messageOriginURL);
|
|
8894
8902
|
if (!isOriginValid) {
|
|
8895
|
-
|
|
8903
|
+
verifyIncomingMessageOriginLogger('Message has an invalid origin of %s', messageOrigin);
|
|
8896
8904
|
}
|
|
8897
8905
|
return isOriginValid;
|
|
8898
8906
|
}
|
|
@@ -11996,7 +12004,7 @@ function nestedAppAuthBridge_processAuthBridgeMessage(evt, onMessageReceived) {
|
|
|
11996
12004
|
return;
|
|
11997
12005
|
}
|
|
11998
12006
|
// Validate message source before processing
|
|
11999
|
-
if (!
|
|
12007
|
+
if (!shouldProcessIncomingMessage(evt.source, evt.origin)) {
|
|
12000
12008
|
log('Message source/origin not allowed, ignoring.');
|
|
12001
12009
|
return;
|
|
12002
12010
|
}
|
|
@@ -12017,7 +12025,7 @@ function nestedAppAuthBridge_processAuthBridgeMessage(evt, onMessageReceived) {
|
|
|
12017
12025
|
}
|
|
12018
12026
|
onMessageReceived(message);
|
|
12019
12027
|
}
|
|
12020
|
-
function
|
|
12028
|
+
function shouldProcessIncomingMessage(messageSource, messageOrigin) {
|
|
12021
12029
|
// Check if messageOrigin matches topOriginForNAA
|
|
12022
12030
|
if (messageOrigin === topOriginForNAA) {
|
|
12023
12031
|
try {
|