@microsoft/teams-js 2.31.1 → 2.32.0-beta.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/dist/esm/_virtual/_polyfill-node.buffer.js +1 -0
- package/dist/esm/_virtual/_polyfill-node.global.js +1 -0
- package/dist/esm/_virtual/_polyfill-node.os.js +1 -1
- package/dist/esm/_virtual/_polyfill-node.process.js +1 -1
- package/dist/esm/_virtual/_polyfill-node.util.js +1 -1
- package/dist/esm/packages/teams-js/dts/internal/telemetry.d.ts +2 -0
- package/dist/esm/packages/teams-js/dts/private/index.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/private/otherAppStateChange.d.ts +14 -0
- package/dist/esm/packages/teams-js/dts/private/store.d.ts +123 -0
- package/dist/esm/packages/teams-js/dts/public/dialog/adaptiveCard/adaptiveCard.d.ts +0 -4
- package/dist/esm/packages/teams-js/dts/public/dialog/adaptiveCard/bot.d.ts +0 -5
- package/dist/esm/packages/teams-js/dts/public/dialog/dialog.d.ts +0 -7
- package/dist/esm/packages/teams-js/dts/public/dialog/update.d.ts +0 -5
- package/dist/esm/packages/teams-js/dts/public/dialog/url/bot.d.ts +0 -5
- package/dist/esm/packages/teams-js/dts/public/dialog/url/parentCommunication.d.ts +0 -9
- package/dist/esm/packages/teams-js/dts/public/dialog/url/url.d.ts +0 -6
- package/dist/esm/packages/teams-js/dts/public/runtime.d.ts +1 -0
- package/dist/esm/packages/teams-js/src/index.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/utils.js +1 -1
- package/dist/esm/packages/teams-js/src/private/otherAppStateChange.js +1 -1
- package/dist/esm/packages/teams-js/src/private/store.js +1 -0
- package/dist/esm/packages/teams-js/src/public/nestedAppAuth.js +1 -1
- package/dist/esm/packages/teams-js/src/public/runtime.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +1199 -101
- 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 -50
- package/dist/esm/packages/teams-js/src/internal/uint8array-extras/uint8array-extras.js +0 -1
@@ -11,6 +11,164 @@
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
12
12
|
/******/ var __webpack_modules__ = ({
|
13
13
|
|
14
|
+
/***/ 933:
|
15
|
+
/***/ ((__unused_webpack_module, exports) => {
|
16
|
+
|
17
|
+
"use strict";
|
18
|
+
|
19
|
+
|
20
|
+
exports.byteLength = byteLength
|
21
|
+
exports.toByteArray = toByteArray
|
22
|
+
exports.fromByteArray = fromByteArray
|
23
|
+
|
24
|
+
var lookup = []
|
25
|
+
var revLookup = []
|
26
|
+
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
27
|
+
|
28
|
+
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
29
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
30
|
+
lookup[i] = code[i]
|
31
|
+
revLookup[code.charCodeAt(i)] = i
|
32
|
+
}
|
33
|
+
|
34
|
+
// Support decoding URL-safe base64 strings, as Node.js does.
|
35
|
+
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
36
|
+
revLookup['-'.charCodeAt(0)] = 62
|
37
|
+
revLookup['_'.charCodeAt(0)] = 63
|
38
|
+
|
39
|
+
function getLens (b64) {
|
40
|
+
var len = b64.length
|
41
|
+
|
42
|
+
if (len % 4 > 0) {
|
43
|
+
throw new Error('Invalid string. Length must be a multiple of 4')
|
44
|
+
}
|
45
|
+
|
46
|
+
// Trim off extra bytes after placeholder bytes are found
|
47
|
+
// See: https://github.com/beatgammit/base64-js/issues/42
|
48
|
+
var validLen = b64.indexOf('=')
|
49
|
+
if (validLen === -1) validLen = len
|
50
|
+
|
51
|
+
var placeHoldersLen = validLen === len
|
52
|
+
? 0
|
53
|
+
: 4 - (validLen % 4)
|
54
|
+
|
55
|
+
return [validLen, placeHoldersLen]
|
56
|
+
}
|
57
|
+
|
58
|
+
// base64 is 4/3 + up to two characters of the original data
|
59
|
+
function byteLength (b64) {
|
60
|
+
var lens = getLens(b64)
|
61
|
+
var validLen = lens[0]
|
62
|
+
var placeHoldersLen = lens[1]
|
63
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
64
|
+
}
|
65
|
+
|
66
|
+
function _byteLength (b64, validLen, placeHoldersLen) {
|
67
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
68
|
+
}
|
69
|
+
|
70
|
+
function toByteArray (b64) {
|
71
|
+
var tmp
|
72
|
+
var lens = getLens(b64)
|
73
|
+
var validLen = lens[0]
|
74
|
+
var placeHoldersLen = lens[1]
|
75
|
+
|
76
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
77
|
+
|
78
|
+
var curByte = 0
|
79
|
+
|
80
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
81
|
+
var len = placeHoldersLen > 0
|
82
|
+
? validLen - 4
|
83
|
+
: validLen
|
84
|
+
|
85
|
+
var i
|
86
|
+
for (i = 0; i < len; i += 4) {
|
87
|
+
tmp =
|
88
|
+
(revLookup[b64.charCodeAt(i)] << 18) |
|
89
|
+
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
90
|
+
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
91
|
+
revLookup[b64.charCodeAt(i + 3)]
|
92
|
+
arr[curByte++] = (tmp >> 16) & 0xFF
|
93
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
94
|
+
arr[curByte++] = tmp & 0xFF
|
95
|
+
}
|
96
|
+
|
97
|
+
if (placeHoldersLen === 2) {
|
98
|
+
tmp =
|
99
|
+
(revLookup[b64.charCodeAt(i)] << 2) |
|
100
|
+
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
101
|
+
arr[curByte++] = tmp & 0xFF
|
102
|
+
}
|
103
|
+
|
104
|
+
if (placeHoldersLen === 1) {
|
105
|
+
tmp =
|
106
|
+
(revLookup[b64.charCodeAt(i)] << 10) |
|
107
|
+
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
108
|
+
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
109
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
110
|
+
arr[curByte++] = tmp & 0xFF
|
111
|
+
}
|
112
|
+
|
113
|
+
return arr
|
114
|
+
}
|
115
|
+
|
116
|
+
function tripletToBase64 (num) {
|
117
|
+
return lookup[num >> 18 & 0x3F] +
|
118
|
+
lookup[num >> 12 & 0x3F] +
|
119
|
+
lookup[num >> 6 & 0x3F] +
|
120
|
+
lookup[num & 0x3F]
|
121
|
+
}
|
122
|
+
|
123
|
+
function encodeChunk (uint8, start, end) {
|
124
|
+
var tmp
|
125
|
+
var output = []
|
126
|
+
for (var i = start; i < end; i += 3) {
|
127
|
+
tmp =
|
128
|
+
((uint8[i] << 16) & 0xFF0000) +
|
129
|
+
((uint8[i + 1] << 8) & 0xFF00) +
|
130
|
+
(uint8[i + 2] & 0xFF)
|
131
|
+
output.push(tripletToBase64(tmp))
|
132
|
+
}
|
133
|
+
return output.join('')
|
134
|
+
}
|
135
|
+
|
136
|
+
function fromByteArray (uint8) {
|
137
|
+
var tmp
|
138
|
+
var len = uint8.length
|
139
|
+
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
140
|
+
var parts = []
|
141
|
+
var maxChunkLength = 16383 // must be multiple of 3
|
142
|
+
|
143
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
144
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
145
|
+
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
146
|
+
}
|
147
|
+
|
148
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
149
|
+
if (extraBytes === 1) {
|
150
|
+
tmp = uint8[len - 1]
|
151
|
+
parts.push(
|
152
|
+
lookup[tmp >> 2] +
|
153
|
+
lookup[(tmp << 4) & 0x3F] +
|
154
|
+
'=='
|
155
|
+
)
|
156
|
+
} else if (extraBytes === 2) {
|
157
|
+
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
158
|
+
parts.push(
|
159
|
+
lookup[tmp >> 10] +
|
160
|
+
lookup[(tmp >> 4) & 0x3F] +
|
161
|
+
lookup[(tmp << 2) & 0x3F] +
|
162
|
+
'='
|
163
|
+
)
|
164
|
+
}
|
165
|
+
|
166
|
+
return parts.join('')
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
/***/ }),
|
171
|
+
|
14
172
|
/***/ 815:
|
15
173
|
/***/ ((module, exports, __webpack_require__) => {
|
16
174
|
|
@@ -927,6 +1085,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
927
1085
|
shareDeepLink: () => (/* reexport */ publicAPIs_shareDeepLink),
|
928
1086
|
sharing: () => (/* reexport */ sharing_namespaceObject),
|
929
1087
|
stageView: () => (/* reexport */ stageView_namespaceObject),
|
1088
|
+
store: () => (/* reexport */ store_namespaceObject),
|
930
1089
|
tasks: () => (/* reexport */ tasks_namespaceObject),
|
931
1090
|
teams: () => (/* reexport */ teams_namespaceObject),
|
932
1091
|
teamsCore: () => (/* reexport */ teamsAPIs_namespaceObject),
|
@@ -1328,6 +1487,7 @@ var otherAppStateChange_namespaceObject = {};
|
|
1328
1487
|
__webpack_require__.r(otherAppStateChange_namespaceObject);
|
1329
1488
|
__webpack_require__.d(otherAppStateChange_namespaceObject, {
|
1330
1489
|
isSupported: () => (otherAppStateChange_isSupported),
|
1490
|
+
notifyInstallCompleted: () => (notifyInstallCompleted),
|
1331
1491
|
registerAppInstallationHandler: () => (registerAppInstallationHandler),
|
1332
1492
|
unregisterAppInstallationHandler: () => (unregisterAppInstallationHandler)
|
1333
1493
|
});
|
@@ -1434,6 +1594,18 @@ __webpack_require__.d(hostEntity_namespaceObject, {
|
|
1434
1594
|
tab: () => (tab_namespaceObject)
|
1435
1595
|
});
|
1436
1596
|
|
1597
|
+
// NAMESPACE OBJECT: ./src/private/store.ts
|
1598
|
+
var store_namespaceObject = {};
|
1599
|
+
__webpack_require__.r(store_namespaceObject);
|
1600
|
+
__webpack_require__.d(store_namespaceObject, {
|
1601
|
+
StoreDialogType: () => (StoreDialogType),
|
1602
|
+
errorInvalidDialogType: () => (errorInvalidDialogType),
|
1603
|
+
errorMissingAppId: () => (errorMissingAppId),
|
1604
|
+
errorMissingCollectionId: () => (errorMissingCollectionId),
|
1605
|
+
isSupported: () => (store_isSupported),
|
1606
|
+
openStoreExperience: () => (openStoreExperience)
|
1607
|
+
});
|
1608
|
+
|
1437
1609
|
// NAMESPACE OBJECT: ./src/public/appInstallDialog.ts
|
1438
1610
|
var appInstallDialog_namespaceObject = {};
|
1439
1611
|
__webpack_require__.r(appInstallDialog_namespaceObject);
|
@@ -1781,6 +1953,870 @@ __webpack_require__.d(marketplace_namespaceObject, {
|
|
1781
1953
|
|
1782
1954
|
// EXTERNAL MODULE: ../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js
|
1783
1955
|
var browser = __webpack_require__(815);
|
1956
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
1957
|
+
var base64_js = __webpack_require__(933);
|
1958
|
+
;// ../../node_modules/.pnpm/skeleton-buffer@file+skeleton-buffer/node_modules/skeleton-buffer/index.js
|
1959
|
+
|
1960
|
+
|
1961
|
+
const _Buffer = Buffer;
|
1962
|
+
|
1963
|
+
|
1964
|
+
const K_MAX_LENGTH = 0x7fffffff;
|
1965
|
+
|
1966
|
+
/**
|
1967
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
1968
|
+
* === true Use Uint8Array implementation (fastest)
|
1969
|
+
* === false Print warning and recommend using `buffer` v4.x which has an Object
|
1970
|
+
* implementation (most compatible, even IE6)
|
1971
|
+
*
|
1972
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
1973
|
+
* Opera 11.6+, iOS 4.2+.
|
1974
|
+
*
|
1975
|
+
* We report that the browser does not support typed arrays if the are not subclassable
|
1976
|
+
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
|
1977
|
+
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
|
1978
|
+
* for __proto__ and has a buggy typed array implementation.
|
1979
|
+
*/
|
1980
|
+
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
|
1981
|
+
|
1982
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') {
|
1983
|
+
console.error('This browser lacks typed array (Uint8Array) support which is required');
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
function typedArraySupport() {
|
1987
|
+
// Can typed array instances can be augmented?
|
1988
|
+
try {
|
1989
|
+
const arr = new Uint8Array(1);
|
1990
|
+
const proto = {
|
1991
|
+
foo: function () {
|
1992
|
+
return 42;
|
1993
|
+
},
|
1994
|
+
};
|
1995
|
+
Object.setPrototypeOf(proto, Uint8Array.prototype);
|
1996
|
+
Object.setPrototypeOf(arr, proto);
|
1997
|
+
return arr.foo() === 42;
|
1998
|
+
} catch (e) {
|
1999
|
+
return false;
|
2000
|
+
}
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
/**
|
2004
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
2005
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
2006
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
2007
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
2008
|
+
* returns a single octet.
|
2009
|
+
*
|
2010
|
+
* The `Uint8Array` prototype remains unmodified.
|
2011
|
+
*/
|
2012
|
+
|
2013
|
+
function Buffer(arg, encodingOrOffset, length) {
|
2014
|
+
// Common case.
|
2015
|
+
if (typeof arg === 'number') {
|
2016
|
+
if (typeof encodingOrOffset === 'string') {
|
2017
|
+
throw new TypeError('The "string" argument must be of type string. Received type number');
|
2018
|
+
}
|
2019
|
+
return allocUnsafe(arg);
|
2020
|
+
}
|
2021
|
+
return from(arg, encodingOrOffset, length);
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
/**
|
2025
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
2026
|
+
* if value is a number.
|
2027
|
+
* Buffer.from(str[, encoding])
|
2028
|
+
* Buffer.from(array)
|
2029
|
+
* Buffer.from(buffer)
|
2030
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
2031
|
+
**/
|
2032
|
+
Buffer.from = function (value, encodingOrOffset, length) {
|
2033
|
+
return from(value, encodingOrOffset, length);
|
2034
|
+
};
|
2035
|
+
|
2036
|
+
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
|
2037
|
+
// https://github.com/feross/buffer/pull/148
|
2038
|
+
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
|
2039
|
+
Object.setPrototypeOf(Buffer, Uint8Array);
|
2040
|
+
|
2041
|
+
function from(value, encodingOrOffset, length) {
|
2042
|
+
if (typeof value === 'string') {
|
2043
|
+
return fromString(value, encodingOrOffset);
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
if (ArrayBuffer.isView(value)) {
|
2047
|
+
return fromArrayView(value);
|
2048
|
+
}
|
2049
|
+
|
2050
|
+
if (value == null) {
|
2051
|
+
throw new TypeError(
|
2052
|
+
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
2053
|
+
'or Array-like Object. Received type ' +
|
2054
|
+
typeof value,
|
2055
|
+
);
|
2056
|
+
}
|
2057
|
+
|
2058
|
+
if (isInstance(value, ArrayBuffer) || (value && isInstance(value.buffer, ArrayBuffer))) {
|
2059
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
if (
|
2063
|
+
typeof SharedArrayBuffer !== 'undefined' &&
|
2064
|
+
(isInstance(value, SharedArrayBuffer) || (value && isInstance(value.buffer, SharedArrayBuffer)))
|
2065
|
+
) {
|
2066
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
2067
|
+
}
|
2068
|
+
|
2069
|
+
if (typeof value === 'number') {
|
2070
|
+
throw new TypeError('The "value" argument must not be of type number. Received type number');
|
2071
|
+
}
|
2072
|
+
|
2073
|
+
const valueOf = value.valueOf && value.valueOf();
|
2074
|
+
if (valueOf != null && valueOf !== value) {
|
2075
|
+
return Buffer.from(valueOf, encodingOrOffset, length);
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
const b = fromObject(value);
|
2079
|
+
if (b) {
|
2080
|
+
return b;
|
2081
|
+
}
|
2082
|
+
|
2083
|
+
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') {
|
2084
|
+
return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length);
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
throw new TypeError(
|
2088
|
+
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
2089
|
+
'or Array-like Object. Received type ' +
|
2090
|
+
typeof value,
|
2091
|
+
);
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
function allocUnsafe(size) {
|
2095
|
+
assertSize(size);
|
2096
|
+
return createBuffer(size < 0 ? 0 : checked(size) | 0);
|
2097
|
+
}
|
2098
|
+
|
2099
|
+
function assertSize(size) {
|
2100
|
+
if (typeof size !== 'number') {
|
2101
|
+
throw new TypeError('"size" argument must be of type number');
|
2102
|
+
} else if (size < 0) {
|
2103
|
+
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
2104
|
+
}
|
2105
|
+
}
|
2106
|
+
|
2107
|
+
function createBuffer(length) {
|
2108
|
+
if (length > K_MAX_LENGTH) {
|
2109
|
+
throw new RangeError('The value "' + length + '" is invalid for option "size"');
|
2110
|
+
}
|
2111
|
+
// Return an augmented `Uint8Array` instance
|
2112
|
+
const buf = new Uint8Array(length);
|
2113
|
+
Object.setPrototypeOf(buf, Buffer.prototype);
|
2114
|
+
return buf;
|
2115
|
+
}
|
2116
|
+
|
2117
|
+
function checked(length) {
|
2118
|
+
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
|
2119
|
+
// length is NaN (which is otherwise coerced to zero.)
|
2120
|
+
if (length >= K_MAX_LENGTH) {
|
2121
|
+
throw new RangeError(
|
2122
|
+
'Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes',
|
2123
|
+
);
|
2124
|
+
}
|
2125
|
+
return length | 0;
|
2126
|
+
}
|
2127
|
+
|
2128
|
+
function fromString(string, encoding) {
|
2129
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
2130
|
+
encoding = 'utf8';
|
2131
|
+
}
|
2132
|
+
|
2133
|
+
if (!Buffer.isEncoding(encoding)) {
|
2134
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
2135
|
+
}
|
2136
|
+
|
2137
|
+
const length = byteLength(string, encoding) | 0;
|
2138
|
+
let buf = createBuffer(length);
|
2139
|
+
|
2140
|
+
const actual = buf.write(string, encoding);
|
2141
|
+
|
2142
|
+
if (actual !== length) {
|
2143
|
+
// Writing a hex string, for example, that contains invalid characters will
|
2144
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
2145
|
+
// 'abxxcd' will be treated as 'ab')
|
2146
|
+
buf = buf.slice(0, actual);
|
2147
|
+
}
|
2148
|
+
|
2149
|
+
return buf;
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
Buffer.isEncoding = function isEncoding(encoding) {
|
2153
|
+
switch (String(encoding).toLowerCase()) {
|
2154
|
+
case 'hex':
|
2155
|
+
case 'utf8':
|
2156
|
+
case 'utf-8':
|
2157
|
+
case 'ascii':
|
2158
|
+
case 'latin1':
|
2159
|
+
case 'binary':
|
2160
|
+
case 'base64':
|
2161
|
+
case 'ucs2':
|
2162
|
+
case 'ucs-2':
|
2163
|
+
case 'utf16le':
|
2164
|
+
case 'utf-16le':
|
2165
|
+
return true;
|
2166
|
+
default:
|
2167
|
+
return false;
|
2168
|
+
}
|
2169
|
+
};
|
2170
|
+
|
2171
|
+
function byteLength(string, encoding) {
|
2172
|
+
if (Buffer.isBuffer(string)) {
|
2173
|
+
return string.length;
|
2174
|
+
}
|
2175
|
+
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
2176
|
+
return string.byteLength;
|
2177
|
+
}
|
2178
|
+
if (typeof string !== 'string') {
|
2179
|
+
throw new TypeError(
|
2180
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + typeof string,
|
2181
|
+
);
|
2182
|
+
}
|
2183
|
+
|
2184
|
+
const len = string.length;
|
2185
|
+
const mustMatch = arguments.length > 2 && arguments[2] === true;
|
2186
|
+
if (!mustMatch && len === 0) {
|
2187
|
+
return 0;
|
2188
|
+
}
|
2189
|
+
|
2190
|
+
// Use a for loop to avoid recursion
|
2191
|
+
let loweredCase = false;
|
2192
|
+
for (;;) {
|
2193
|
+
switch (encoding) {
|
2194
|
+
case 'ascii':
|
2195
|
+
case 'latin1':
|
2196
|
+
case 'binary':
|
2197
|
+
return len;
|
2198
|
+
case 'utf8':
|
2199
|
+
case 'utf-8':
|
2200
|
+
return utf8ToBytes(string).length;
|
2201
|
+
case 'ucs2':
|
2202
|
+
case 'ucs-2':
|
2203
|
+
case 'utf16le':
|
2204
|
+
case 'utf-16le':
|
2205
|
+
return len * 2;
|
2206
|
+
case 'hex':
|
2207
|
+
return len >>> 1;
|
2208
|
+
case 'base64':
|
2209
|
+
return base64ToBytes(string).length;
|
2210
|
+
default:
|
2211
|
+
if (loweredCase) {
|
2212
|
+
return mustMatch ? -1 : utf8ToBytes(string).length; // assume utf8
|
2213
|
+
}
|
2214
|
+
encoding = ('' + encoding).toLowerCase();
|
2215
|
+
loweredCase = true;
|
2216
|
+
}
|
2217
|
+
}
|
2218
|
+
}
|
2219
|
+
|
2220
|
+
Buffer.isBuffer = function isBuffer(b) {
|
2221
|
+
return b != null && b._isBuffer === true && b !== Buffer.prototype; // so Buffer.isBuffer(Buffer.prototype) will be false
|
2222
|
+
};
|
2223
|
+
|
2224
|
+
// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
|
2225
|
+
// the `instanceof` check but they should be treated as of that type.
|
2226
|
+
// See: https://github.com/feross/buffer/issues/166
|
2227
|
+
function isInstance(obj, type) {
|
2228
|
+
return (
|
2229
|
+
obj instanceof type ||
|
2230
|
+
(obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name)
|
2231
|
+
);
|
2232
|
+
}
|
2233
|
+
|
2234
|
+
function utf8ToBytes(string, units) {
|
2235
|
+
units = units || Infinity;
|
2236
|
+
let codePoint;
|
2237
|
+
const length = string.length;
|
2238
|
+
let leadSurrogate = null;
|
2239
|
+
const bytes = [];
|
2240
|
+
|
2241
|
+
for (let i = 0; i < length; ++i) {
|
2242
|
+
codePoint = string.charCodeAt(i);
|
2243
|
+
|
2244
|
+
// is surrogate component
|
2245
|
+
if (codePoint > 0xd7ff && codePoint < 0xe000) {
|
2246
|
+
// last char was a lead
|
2247
|
+
if (!leadSurrogate) {
|
2248
|
+
// no lead yet
|
2249
|
+
if (codePoint > 0xdbff) {
|
2250
|
+
// unexpected trail
|
2251
|
+
if ((units -= 3) > -1) {
|
2252
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2253
|
+
}
|
2254
|
+
continue;
|
2255
|
+
} else if (i + 1 === length) {
|
2256
|
+
// unpaired lead
|
2257
|
+
if ((units -= 3) > -1) {
|
2258
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2259
|
+
}
|
2260
|
+
continue;
|
2261
|
+
}
|
2262
|
+
|
2263
|
+
// valid lead
|
2264
|
+
leadSurrogate = codePoint;
|
2265
|
+
|
2266
|
+
continue;
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
// 2 leads in a row
|
2270
|
+
if (codePoint < 0xdc00) {
|
2271
|
+
if ((units -= 3) > -1) {
|
2272
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2273
|
+
}
|
2274
|
+
leadSurrogate = codePoint;
|
2275
|
+
continue;
|
2276
|
+
}
|
2277
|
+
|
2278
|
+
// valid surrogate pair
|
2279
|
+
codePoint = (((leadSurrogate - 0xd800) << 10) | (codePoint - 0xdc00)) + 0x10000;
|
2280
|
+
} else if (leadSurrogate) {
|
2281
|
+
// valid bmp char, but last char was a lead
|
2282
|
+
if ((units -= 3) > -1) {
|
2283
|
+
bytes.push(0xef, 0xbf, 0xbd);
|
2284
|
+
}
|
2285
|
+
}
|
2286
|
+
|
2287
|
+
leadSurrogate = null;
|
2288
|
+
|
2289
|
+
// encode utf8
|
2290
|
+
if (codePoint < 0x80) {
|
2291
|
+
if ((units -= 1) < 0) {
|
2292
|
+
break;
|
2293
|
+
}
|
2294
|
+
bytes.push(codePoint);
|
2295
|
+
} else if (codePoint < 0x800) {
|
2296
|
+
if ((units -= 2) < 0) {
|
2297
|
+
break;
|
2298
|
+
}
|
2299
|
+
bytes.push((codePoint >> 0x6) | 0xc0, (codePoint & 0x3f) | 0x80);
|
2300
|
+
} else if (codePoint < 0x10000) {
|
2301
|
+
if ((units -= 3) < 0) {
|
2302
|
+
break;
|
2303
|
+
}
|
2304
|
+
bytes.push((codePoint >> 0xc) | 0xe0, ((codePoint >> 0x6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
|
2305
|
+
} else if (codePoint < 0x110000) {
|
2306
|
+
if ((units -= 4) < 0) {
|
2307
|
+
break;
|
2308
|
+
}
|
2309
|
+
bytes.push(
|
2310
|
+
(codePoint >> 0x12) | 0xf0,
|
2311
|
+
((codePoint >> 0xc) & 0x3f) | 0x80,
|
2312
|
+
((codePoint >> 0x6) & 0x3f) | 0x80,
|
2313
|
+
(codePoint & 0x3f) | 0x80,
|
2314
|
+
);
|
2315
|
+
} else {
|
2316
|
+
throw new Error('Invalid code point');
|
2317
|
+
}
|
2318
|
+
}
|
2319
|
+
|
2320
|
+
return bytes;
|
2321
|
+
}
|
2322
|
+
|
2323
|
+
function base64ToBytes(str) {
|
2324
|
+
return base64_js.toByteArray(base64clean(str));
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
2328
|
+
|
2329
|
+
function base64clean(str) {
|
2330
|
+
// Node takes equal signs as end of the Base64 encoding
|
2331
|
+
str = str.split('=')[0];
|
2332
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
2333
|
+
str = str.trim().replace(INVALID_BASE64_RE, '');
|
2334
|
+
// Node converts strings with length < 2 to ''
|
2335
|
+
if (str.length < 2) {
|
2336
|
+
return '';
|
2337
|
+
}
|
2338
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
2339
|
+
while (str.length % 4 !== 0) {
|
2340
|
+
str = str + '=';
|
2341
|
+
}
|
2342
|
+
return str;
|
2343
|
+
}
|
2344
|
+
|
2345
|
+
function fromArrayView(arrayView) {
|
2346
|
+
if (isInstance(arrayView, Uint8Array)) {
|
2347
|
+
const copy = new Uint8Array(arrayView);
|
2348
|
+
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
|
2349
|
+
}
|
2350
|
+
return fromArrayLike(arrayView);
|
2351
|
+
}
|
2352
|
+
|
2353
|
+
function fromArrayBuffer(array, byteOffset, length) {
|
2354
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
2355
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
2356
|
+
}
|
2357
|
+
|
2358
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
2359
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
2360
|
+
}
|
2361
|
+
|
2362
|
+
let buf;
|
2363
|
+
if (byteOffset === undefined && length === undefined) {
|
2364
|
+
buf = new Uint8Array(array);
|
2365
|
+
} else if (length === undefined) {
|
2366
|
+
buf = new Uint8Array(array, byteOffset);
|
2367
|
+
} else {
|
2368
|
+
buf = new Uint8Array(array, byteOffset, length);
|
2369
|
+
}
|
2370
|
+
|
2371
|
+
// Return an augmented `Uint8Array` instance
|
2372
|
+
Object.setPrototypeOf(buf, Buffer.prototype);
|
2373
|
+
|
2374
|
+
return buf;
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
function fromArrayLike(array) {
|
2378
|
+
const length = array.length < 0 ? 0 : checked(array.length) | 0;
|
2379
|
+
const buf = createBuffer(length);
|
2380
|
+
for (let i = 0; i < length; i += 1) {
|
2381
|
+
buf[i] = array[i] & 255;
|
2382
|
+
}
|
2383
|
+
return buf;
|
2384
|
+
}
|
2385
|
+
|
2386
|
+
Buffer.prototype.toString = function toString() {
|
2387
|
+
const length = this.length;
|
2388
|
+
if (length === 0) {
|
2389
|
+
return '';
|
2390
|
+
}
|
2391
|
+
if (arguments.length === 0) {
|
2392
|
+
return utf8Slice(this, 0, length);
|
2393
|
+
}
|
2394
|
+
return slowToString.apply(this, arguments);
|
2395
|
+
};
|
2396
|
+
|
2397
|
+
function utf8Slice(buf, start, end) {
|
2398
|
+
end = Math.min(buf.length, end);
|
2399
|
+
const res = [];
|
2400
|
+
|
2401
|
+
let i = start;
|
2402
|
+
while (i < end) {
|
2403
|
+
const firstByte = buf[i];
|
2404
|
+
let codePoint = null;
|
2405
|
+
let bytesPerSequence = firstByte > 0xef ? 4 : firstByte > 0xdf ? 3 : firstByte > 0xbf ? 2 : 1;
|
2406
|
+
|
2407
|
+
if (i + bytesPerSequence <= end) {
|
2408
|
+
let secondByte, thirdByte, fourthByte, tempCodePoint;
|
2409
|
+
|
2410
|
+
switch (bytesPerSequence) {
|
2411
|
+
case 1:
|
2412
|
+
if (firstByte < 0x80) {
|
2413
|
+
codePoint = firstByte;
|
2414
|
+
}
|
2415
|
+
break;
|
2416
|
+
case 2:
|
2417
|
+
secondByte = buf[i + 1];
|
2418
|
+
if ((secondByte & 0xc0) === 0x80) {
|
2419
|
+
tempCodePoint = ((firstByte & 0x1f) << 0x6) | (secondByte & 0x3f);
|
2420
|
+
if (tempCodePoint > 0x7f) {
|
2421
|
+
codePoint = tempCodePoint;
|
2422
|
+
}
|
2423
|
+
}
|
2424
|
+
break;
|
2425
|
+
case 3:
|
2426
|
+
secondByte = buf[i + 1];
|
2427
|
+
thirdByte = buf[i + 2];
|
2428
|
+
if ((secondByte & 0xc0) === 0x80 && (thirdByte & 0xc0) === 0x80) {
|
2429
|
+
tempCodePoint = ((firstByte & 0xf) << 0xc) | ((secondByte & 0x3f) << 0x6) | (thirdByte & 0x3f);
|
2430
|
+
if (tempCodePoint > 0x7ff && (tempCodePoint < 0xd800 || tempCodePoint > 0xdfff)) {
|
2431
|
+
codePoint = tempCodePoint;
|
2432
|
+
}
|
2433
|
+
}
|
2434
|
+
break;
|
2435
|
+
case 4:
|
2436
|
+
secondByte = buf[i + 1];
|
2437
|
+
thirdByte = buf[i + 2];
|
2438
|
+
fourthByte = buf[i + 3];
|
2439
|
+
if ((secondByte & 0xc0) === 0x80 && (thirdByte & 0xc0) === 0x80 && (fourthByte & 0xc0) === 0x80) {
|
2440
|
+
tempCodePoint =
|
2441
|
+
((firstByte & 0xf) << 0x12) |
|
2442
|
+
((secondByte & 0x3f) << 0xc) |
|
2443
|
+
((thirdByte & 0x3f) << 0x6) |
|
2444
|
+
(fourthByte & 0x3f);
|
2445
|
+
if (tempCodePoint > 0xffff && tempCodePoint < 0x110000) {
|
2446
|
+
codePoint = tempCodePoint;
|
2447
|
+
}
|
2448
|
+
}
|
2449
|
+
}
|
2450
|
+
}
|
2451
|
+
|
2452
|
+
if (codePoint === null) {
|
2453
|
+
// we did not generate a valid codePoint so insert a
|
2454
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
2455
|
+
codePoint = 0xfffd;
|
2456
|
+
bytesPerSequence = 1;
|
2457
|
+
} else if (codePoint > 0xffff) {
|
2458
|
+
// encode to utf16 (surrogate pair dance)
|
2459
|
+
codePoint -= 0x10000;
|
2460
|
+
res.push(((codePoint >>> 10) & 0x3ff) | 0xd800);
|
2461
|
+
codePoint = 0xdc00 | (codePoint & 0x3ff);
|
2462
|
+
}
|
2463
|
+
|
2464
|
+
res.push(codePoint);
|
2465
|
+
i += bytesPerSequence;
|
2466
|
+
}
|
2467
|
+
|
2468
|
+
return decodeCodePointsArray(res);
|
2469
|
+
}
|
2470
|
+
|
2471
|
+
function slowToString(encoding, start, end) {
|
2472
|
+
let loweredCase = false;
|
2473
|
+
|
2474
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
2475
|
+
// property of a typed array.
|
2476
|
+
|
2477
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
2478
|
+
// to their upper/lower bounds if the value passed is out of range.
|
2479
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
2480
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
2481
|
+
if (start === undefined || start < 0) {
|
2482
|
+
start = 0;
|
2483
|
+
}
|
2484
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
2485
|
+
// coercion fail below.
|
2486
|
+
if (start > this.length) {
|
2487
|
+
return '';
|
2488
|
+
}
|
2489
|
+
|
2490
|
+
if (end === undefined || end > this.length) {
|
2491
|
+
end = this.length;
|
2492
|
+
}
|
2493
|
+
|
2494
|
+
if (end <= 0) {
|
2495
|
+
return '';
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
// Force coercion to uint32. This will also coerce falsey/NaN values to 0.
|
2499
|
+
end >>>= 0;
|
2500
|
+
start >>>= 0;
|
2501
|
+
|
2502
|
+
if (end <= start) {
|
2503
|
+
return '';
|
2504
|
+
}
|
2505
|
+
|
2506
|
+
if (!encoding) {
|
2507
|
+
encoding = 'utf8';
|
2508
|
+
}
|
2509
|
+
|
2510
|
+
// eslint-disable-next-line no-constant-condition
|
2511
|
+
while (true) {
|
2512
|
+
switch (encoding) {
|
2513
|
+
case 'hex':
|
2514
|
+
return hexSlice(this, start, end);
|
2515
|
+
|
2516
|
+
case 'utf8':
|
2517
|
+
case 'utf-8':
|
2518
|
+
return utf8Slice(this, start, end);
|
2519
|
+
|
2520
|
+
case 'ascii':
|
2521
|
+
return asciiSlice(this, start, end);
|
2522
|
+
|
2523
|
+
case 'latin1':
|
2524
|
+
case 'binary':
|
2525
|
+
return latin1Slice(this, start, end);
|
2526
|
+
|
2527
|
+
case 'base64':
|
2528
|
+
return base64Slice(this, start, end);
|
2529
|
+
|
2530
|
+
case 'ucs2':
|
2531
|
+
case 'ucs-2':
|
2532
|
+
case 'utf16le':
|
2533
|
+
case 'utf-16le':
|
2534
|
+
return utf16leSlice(this, start, end);
|
2535
|
+
|
2536
|
+
default:
|
2537
|
+
if (loweredCase) {
|
2538
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
2539
|
+
}
|
2540
|
+
encoding = (encoding + '').toLowerCase();
|
2541
|
+
loweredCase = true;
|
2542
|
+
}
|
2543
|
+
}
|
2544
|
+
}
|
2545
|
+
|
2546
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
2547
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
2548
|
+
// We go 1 magnitude less, for safety
|
2549
|
+
const MAX_ARGUMENTS_LENGTH = 0x1000;
|
2550
|
+
|
2551
|
+
function decodeCodePointsArray(codePoints) {
|
2552
|
+
const len = codePoints.length;
|
2553
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
2554
|
+
return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
|
2555
|
+
}
|
2556
|
+
|
2557
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
2558
|
+
let res = '';
|
2559
|
+
let i = 0;
|
2560
|
+
while (i < len) {
|
2561
|
+
res += String.fromCharCode.apply(String, codePoints.slice(i, (i += MAX_ARGUMENTS_LENGTH)));
|
2562
|
+
}
|
2563
|
+
return res;
|
2564
|
+
}
|
2565
|
+
|
2566
|
+
function hexSlice(buf, start, end) {
|
2567
|
+
const len = buf.length;
|
2568
|
+
|
2569
|
+
if (!start || start < 0) {
|
2570
|
+
start = 0;
|
2571
|
+
}
|
2572
|
+
if (!end || end < 0 || end > len) {
|
2573
|
+
end = len;
|
2574
|
+
}
|
2575
|
+
|
2576
|
+
let out = '';
|
2577
|
+
for (let i = start; i < end; ++i) {
|
2578
|
+
out += hexSliceLookupTable[buf[i]];
|
2579
|
+
}
|
2580
|
+
return out;
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
function asciiSlice(buf, start, end) {
|
2584
|
+
let ret = '';
|
2585
|
+
end = Math.min(buf.length, end);
|
2586
|
+
|
2587
|
+
for (let i = start; i < end; ++i) {
|
2588
|
+
ret += String.fromCharCode(buf[i] & 0x7f);
|
2589
|
+
}
|
2590
|
+
return ret;
|
2591
|
+
}
|
2592
|
+
|
2593
|
+
function latin1Slice(buf, start, end) {
|
2594
|
+
let ret = '';
|
2595
|
+
end = Math.min(buf.length, end);
|
2596
|
+
|
2597
|
+
for (let i = start; i < end; ++i) {
|
2598
|
+
ret += String.fromCharCode(buf[i]);
|
2599
|
+
}
|
2600
|
+
return ret;
|
2601
|
+
}
|
2602
|
+
|
2603
|
+
function base64Slice(buf, start, end) {
|
2604
|
+
if (start === 0 && end === buf.length) {
|
2605
|
+
return base64_js.fromByteArray(buf);
|
2606
|
+
} else {
|
2607
|
+
return base64_js.fromByteArray(buf.slice(start, end));
|
2608
|
+
}
|
2609
|
+
}
|
2610
|
+
|
2611
|
+
function utf16leSlice(buf, start, end) {
|
2612
|
+
const bytes = buf.slice(start, end);
|
2613
|
+
let res = '';
|
2614
|
+
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
|
2615
|
+
for (let i = 0; i < bytes.length - 1; i += 2) {
|
2616
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
2617
|
+
}
|
2618
|
+
return res;
|
2619
|
+
}
|
2620
|
+
|
2621
|
+
Buffer.prototype.write = function write(string, offset, length, encoding) {
|
2622
|
+
// Buffer#write(string)
|
2623
|
+
if (offset === undefined) {
|
2624
|
+
encoding = 'utf8';
|
2625
|
+
length = this.length;
|
2626
|
+
offset = 0;
|
2627
|
+
// Buffer#write(string, encoding)
|
2628
|
+
} else if (length === undefined && typeof offset === 'string') {
|
2629
|
+
encoding = offset;
|
2630
|
+
length = this.length;
|
2631
|
+
offset = 0;
|
2632
|
+
// Buffer#write(string, offset[, length][, encoding])
|
2633
|
+
} else if (isFinite(offset)) {
|
2634
|
+
offset = offset >>> 0;
|
2635
|
+
if (isFinite(length)) {
|
2636
|
+
length = length >>> 0;
|
2637
|
+
if (encoding === undefined) {
|
2638
|
+
encoding = 'utf8';
|
2639
|
+
}
|
2640
|
+
} else {
|
2641
|
+
encoding = length;
|
2642
|
+
length = undefined;
|
2643
|
+
}
|
2644
|
+
} else {
|
2645
|
+
throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
|
2646
|
+
}
|
2647
|
+
|
2648
|
+
const remaining = this.length - offset;
|
2649
|
+
if (length === undefined || length > remaining) {
|
2650
|
+
length = remaining;
|
2651
|
+
}
|
2652
|
+
|
2653
|
+
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
2654
|
+
throw new RangeError('Attempt to write outside buffer bounds');
|
2655
|
+
}
|
2656
|
+
|
2657
|
+
if (!encoding) {
|
2658
|
+
encoding = 'utf8';
|
2659
|
+
}
|
2660
|
+
|
2661
|
+
let loweredCase = false;
|
2662
|
+
for (;;) {
|
2663
|
+
switch (encoding) {
|
2664
|
+
case 'hex':
|
2665
|
+
return hexWrite(this, string, offset, length);
|
2666
|
+
|
2667
|
+
case 'utf8':
|
2668
|
+
case 'utf-8':
|
2669
|
+
return utf8Write(this, string, offset, length);
|
2670
|
+
|
2671
|
+
case 'ascii':
|
2672
|
+
case 'latin1':
|
2673
|
+
case 'binary':
|
2674
|
+
return asciiWrite(this, string, offset, length);
|
2675
|
+
|
2676
|
+
case 'base64':
|
2677
|
+
// Warning: maxLength not taken into account in base64Write
|
2678
|
+
return base64Write(this, string, offset, length);
|
2679
|
+
|
2680
|
+
case 'ucs2':
|
2681
|
+
case 'ucs-2':
|
2682
|
+
case 'utf16le':
|
2683
|
+
case 'utf-16le':
|
2684
|
+
return ucs2Write(this, string, offset, length);
|
2685
|
+
|
2686
|
+
default:
|
2687
|
+
if (loweredCase) {
|
2688
|
+
throw new TypeError('Unknown encoding: ' + encoding);
|
2689
|
+
}
|
2690
|
+
encoding = ('' + encoding).toLowerCase();
|
2691
|
+
loweredCase = true;
|
2692
|
+
}
|
2693
|
+
}
|
2694
|
+
};
|
2695
|
+
|
2696
|
+
function hexWrite(buf, string, offset, length) {
|
2697
|
+
offset = Number(offset) || 0;
|
2698
|
+
const remaining = buf.length - offset;
|
2699
|
+
if (!length) {
|
2700
|
+
length = remaining;
|
2701
|
+
} else {
|
2702
|
+
length = Number(length);
|
2703
|
+
if (length > remaining) {
|
2704
|
+
length = remaining;
|
2705
|
+
}
|
2706
|
+
}
|
2707
|
+
|
2708
|
+
const strLen = string.length;
|
2709
|
+
|
2710
|
+
if (length > strLen / 2) {
|
2711
|
+
length = strLen / 2;
|
2712
|
+
}
|
2713
|
+
let i;
|
2714
|
+
for (i = 0; i < length; ++i) {
|
2715
|
+
const parsed = parseInt(string.substr(i * 2, 2), 16);
|
2716
|
+
if (numberIsNaN(parsed)) {
|
2717
|
+
return i;
|
2718
|
+
}
|
2719
|
+
buf[offset + i] = parsed;
|
2720
|
+
}
|
2721
|
+
return i;
|
2722
|
+
}
|
2723
|
+
|
2724
|
+
function utf8Write(buf, string, offset, length) {
|
2725
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
2726
|
+
}
|
2727
|
+
|
2728
|
+
function asciiWrite(buf, string, offset, length) {
|
2729
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
2730
|
+
}
|
2731
|
+
|
2732
|
+
function base64Write(buf, string, offset, length) {
|
2733
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
2734
|
+
}
|
2735
|
+
|
2736
|
+
function ucs2Write(buf, string, offset, length) {
|
2737
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
2738
|
+
}
|
2739
|
+
|
2740
|
+
function asciiToBytes(str) {
|
2741
|
+
const byteArray = [];
|
2742
|
+
for (let i = 0; i < str.length; ++i) {
|
2743
|
+
// Node's code seems to be doing this and not & 0x7F..
|
2744
|
+
byteArray.push(str.charCodeAt(i) & 0xff);
|
2745
|
+
}
|
2746
|
+
return byteArray;
|
2747
|
+
}
|
2748
|
+
|
2749
|
+
function utf16leToBytes(str, units) {
|
2750
|
+
let c, hi, lo;
|
2751
|
+
const byteArray = [];
|
2752
|
+
for (let i = 0; i < str.length; ++i) {
|
2753
|
+
if ((units -= 2) < 0) {
|
2754
|
+
break;
|
2755
|
+
}
|
2756
|
+
|
2757
|
+
c = str.charCodeAt(i);
|
2758
|
+
hi = c >> 8;
|
2759
|
+
lo = c % 256;
|
2760
|
+
byteArray.push(lo);
|
2761
|
+
byteArray.push(hi);
|
2762
|
+
}
|
2763
|
+
|
2764
|
+
return byteArray;
|
2765
|
+
}
|
2766
|
+
|
2767
|
+
function blitBuffer(src, dst, offset, length) {
|
2768
|
+
let i;
|
2769
|
+
for (i = 0; i < length; ++i) {
|
2770
|
+
if (i + offset >= dst.length || i >= src.length) {
|
2771
|
+
break;
|
2772
|
+
}
|
2773
|
+
dst[i + offset] = src[i];
|
2774
|
+
}
|
2775
|
+
return i;
|
2776
|
+
}
|
2777
|
+
|
2778
|
+
function numberIsNaN(obj) {
|
2779
|
+
// For IE11 support
|
2780
|
+
return obj !== obj; // eslint-disable-line no-self-compare
|
2781
|
+
}
|
2782
|
+
|
2783
|
+
const hexSliceLookupTable = (function () {
|
2784
|
+
const alphabet = '0123456789abcdef';
|
2785
|
+
const table = new Array(256);
|
2786
|
+
for (let i = 0; i < 16; ++i) {
|
2787
|
+
const i16 = i * 16;
|
2788
|
+
for (let j = 0; j < 16; ++j) {
|
2789
|
+
table[i16 + j] = alphabet[i] + alphabet[j];
|
2790
|
+
}
|
2791
|
+
}
|
2792
|
+
return table;
|
2793
|
+
})();
|
2794
|
+
|
2795
|
+
function fromObject(obj) {
|
2796
|
+
if (Buffer.isBuffer(obj)) {
|
2797
|
+
const len = checked(obj.length) | 0;
|
2798
|
+
const buf = createBuffer(len);
|
2799
|
+
|
2800
|
+
if (buf.length === 0) {
|
2801
|
+
return buf;
|
2802
|
+
}
|
2803
|
+
|
2804
|
+
obj.copy(buf, 0, 0, len);
|
2805
|
+
return buf;
|
2806
|
+
}
|
2807
|
+
|
2808
|
+
if (obj.length !== undefined) {
|
2809
|
+
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
2810
|
+
return createBuffer(0);
|
2811
|
+
}
|
2812
|
+
return fromArrayLike(obj);
|
2813
|
+
}
|
2814
|
+
|
2815
|
+
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
2816
|
+
return fromArrayLike(obj.data);
|
2817
|
+
}
|
2818
|
+
}
|
2819
|
+
|
1784
2820
|
;// ../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js
|
1785
2821
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
1786
2822
|
/* harmony default export */ const esm_browser_native = ({
|
@@ -2278,65 +3314,6 @@ const errorInvalidCount = new Error('Invalid input count: Must supply a valid im
|
|
2278
3314
|
*/
|
2279
3315
|
const errorInvalidResponse = new Error('Invalid response: Received more images than the specified max limit in the response.');
|
2280
3316
|
|
2281
|
-
;// ./src/internal/uint8array-extras/uint8array-extras.ts
|
2282
|
-
const objectToString = Object.prototype.toString;
|
2283
|
-
const uint8ArrayStringified = '[object Uint8Array]';
|
2284
|
-
const arrayBufferStringified = '[object ArrayBuffer]';
|
2285
|
-
const cachedDecoders = {
|
2286
|
-
utf8: new globalThis.TextDecoder('utf8'),
|
2287
|
-
};
|
2288
|
-
function isType(value, typeConstructor, typeStringified) {
|
2289
|
-
if (!value) {
|
2290
|
-
return false;
|
2291
|
-
}
|
2292
|
-
if (value.constructor === typeConstructor) {
|
2293
|
-
return true;
|
2294
|
-
}
|
2295
|
-
return objectToString.call(value) === typeStringified;
|
2296
|
-
}
|
2297
|
-
function isUint8Array(value) {
|
2298
|
-
return isType(value, Uint8Array, uint8ArrayStringified);
|
2299
|
-
}
|
2300
|
-
function isArrayBuffer(value) {
|
2301
|
-
return isType(value, ArrayBuffer, arrayBufferStringified);
|
2302
|
-
}
|
2303
|
-
function assertString(value) {
|
2304
|
-
if (typeof value !== 'string') {
|
2305
|
-
throw new TypeError(`Expected \`string\`, got \`${typeof value}\``);
|
2306
|
-
}
|
2307
|
-
}
|
2308
|
-
function base64ToUint8Array(base64String) {
|
2309
|
-
assertString(base64String);
|
2310
|
-
return Uint8Array.from(globalThis.atob(base64UrlToBase64(base64String)), (x) => {
|
2311
|
-
const codePoint = x.codePointAt(0);
|
2312
|
-
if (codePoint === undefined) {
|
2313
|
-
throw new Error('Invalid character encountered');
|
2314
|
-
}
|
2315
|
-
return codePoint;
|
2316
|
-
});
|
2317
|
-
}
|
2318
|
-
function base64UrlToBase64(base64url) {
|
2319
|
-
return base64url.replaceAll('-', '+').replaceAll('_', '/');
|
2320
|
-
}
|
2321
|
-
function uint8ArrayToString(array, encoding = 'utf8') {
|
2322
|
-
var _a;
|
2323
|
-
assertUint8ArrayOrArrayBuffer(array);
|
2324
|
-
(_a = cachedDecoders[encoding]) !== null && _a !== void 0 ? _a : (cachedDecoders[encoding] = new globalThis.TextDecoder(encoding));
|
2325
|
-
return cachedDecoders[encoding].decode(array);
|
2326
|
-
}
|
2327
|
-
function base64ToString(base64String) {
|
2328
|
-
assertString(base64String);
|
2329
|
-
return uint8ArrayToString(base64ToUint8Array(base64String));
|
2330
|
-
}
|
2331
|
-
function assertUint8ArrayOrArrayBuffer(value) {
|
2332
|
-
if (!isUint8ArrayOrArrayBuffer(value)) {
|
2333
|
-
throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof value}\``);
|
2334
|
-
}
|
2335
|
-
}
|
2336
|
-
function isUint8ArrayOrArrayBuffer(value) {
|
2337
|
-
return isUint8Array(value) || isArrayBuffer(value);
|
2338
|
-
}
|
2339
|
-
|
2340
3317
|
;// ./src/internal/utils.ts
|
2341
3318
|
/* eslint-disable @typescript-eslint/ban-types */
|
2342
3319
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
@@ -2626,14 +3603,14 @@ function base64ToBlob(mimeType, base64String) {
|
|
2626
3603
|
* constructor expects binary data.
|
2627
3604
|
*/
|
2628
3605
|
if (mimeType.startsWith('image/')) {
|
2629
|
-
const byteCharacters =
|
3606
|
+
const byteCharacters = atob(base64String);
|
2630
3607
|
const byteArray = new Uint8Array(byteCharacters.length);
|
2631
3608
|
for (let i = 0; i < byteCharacters.length; i++) {
|
2632
3609
|
byteArray[i] = byteCharacters.charCodeAt(i);
|
2633
3610
|
}
|
2634
3611
|
resolve(new Blob([byteArray], { type: mimeType }));
|
2635
3612
|
}
|
2636
|
-
const byteCharacters =
|
3613
|
+
const byteCharacters = _Buffer.from(base64String, 'base64').toString();
|
2637
3614
|
resolve(new Blob([byteCharacters], { type: mimeType }));
|
2638
3615
|
});
|
2639
3616
|
}
|
@@ -3326,6 +4303,12 @@ const mapTeamsVersionToSupportedCapabilities = {
|
|
3326
4303
|
hostClientTypes: [HostClientType.android, HostClientType.ios],
|
3327
4304
|
},
|
3328
4305
|
],
|
4306
|
+
'2.1.1': [
|
4307
|
+
{
|
4308
|
+
capability: { nestedAppAuth: {} },
|
4309
|
+
hostClientTypes: [HostClientType.android, HostClientType.ios, HostClientType.ipados],
|
4310
|
+
},
|
4311
|
+
],
|
3329
4312
|
};
|
3330
4313
|
const generateBackCompatRuntimeConfigLogger = runtimeLogger.extend('generateBackCompatRuntimeConfig');
|
3331
4314
|
/**
|
@@ -3455,7 +4438,7 @@ function isSerializable(arg) {
|
|
3455
4438
|
* @hidden
|
3456
4439
|
* Package version.
|
3457
4440
|
*/
|
3458
|
-
const version = "2.
|
4441
|
+
const version = "2.32.0-beta.1";
|
3459
4442
|
|
3460
4443
|
;// ./src/internal/internalAPIs.ts
|
3461
4444
|
|
@@ -4752,7 +5735,6 @@ var DataResidency;
|
|
4752
5735
|
/**
|
4753
5736
|
* Module to update the dialog
|
4754
5737
|
*
|
4755
|
-
* @beta
|
4756
5738
|
* @module
|
4757
5739
|
*/
|
4758
5740
|
|
@@ -4763,8 +5745,6 @@ var DataResidency;
|
|
4763
5745
|
* Update dimensions - height/width of a dialog.
|
4764
5746
|
*
|
4765
5747
|
* @param dimensions - An object containing width and height properties.
|
4766
|
-
*
|
4767
|
-
* @beta
|
4768
5748
|
*/
|
4769
5749
|
function resize(dimensions) {
|
4770
5750
|
updateResizeHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.update.resize" /* ApiName.Dialog_Update_Resize */), dimensions);
|
@@ -4774,8 +5754,6 @@ function resize(dimensions) {
|
|
4774
5754
|
* @returns boolean to represent whether dialog.update capabilty is supported
|
4775
5755
|
*
|
4776
5756
|
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
4777
|
-
*
|
4778
|
-
* @beta
|
4779
5757
|
*/
|
4780
5758
|
function update_isSupported() {
|
4781
5759
|
return ensureInitialized(runtime) && runtime.supports.dialog
|
@@ -4789,7 +5767,6 @@ function update_isSupported() {
|
|
4789
5767
|
/**
|
4790
5768
|
* Module to open a dialog that sends results to the bot framework
|
4791
5769
|
*
|
4792
|
-
* @beta
|
4793
5770
|
* @module
|
4794
5771
|
*/
|
4795
5772
|
|
@@ -4804,8 +5781,6 @@ function update_isSupported() {
|
|
4804
5781
|
* @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
|
4805
5782
|
*
|
4806
5783
|
* @returns a function that can be used to send messages to the dialog.
|
4807
|
-
*
|
4808
|
-
* @beta
|
4809
5784
|
*/
|
4810
5785
|
function bot_open(botUrlDialogInfo, submitHandler, messageFromChildHandler) {
|
4811
5786
|
botUrlOpenHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.url.bot.open" /* ApiName.Dialog_Url_Bot_Open */), botUrlDialogInfo, submitHandler, messageFromChildHandler);
|
@@ -4816,8 +5791,6 @@ function bot_open(botUrlDialogInfo, submitHandler, messageFromChildHandler) {
|
|
4816
5791
|
* @returns boolean to represent whether dialog.url.bot is supported
|
4817
5792
|
*
|
4818
5793
|
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
4819
|
-
*
|
4820
|
-
* @beta
|
4821
5794
|
*/
|
4822
5795
|
function bot_isSupported() {
|
4823
5796
|
return (ensureInitialized(runtime) &&
|
@@ -4831,7 +5804,6 @@ function bot_isSupported() {
|
|
4831
5804
|
* @remarks
|
4832
5805
|
* Note that dialog can be invoked from parentless scenarios e.g. Search Message Extensions. The subcapability `parentCommunication` is not supported in such scenarios.
|
4833
5806
|
*
|
4834
|
-
* @beta
|
4835
5807
|
* @module
|
4836
5808
|
*/
|
4837
5809
|
|
@@ -4848,8 +5820,6 @@ function bot_isSupported() {
|
|
4848
5820
|
* This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
|
4849
5821
|
*
|
4850
5822
|
* @param message - The message to send to the parent
|
4851
|
-
*
|
4852
|
-
* @beta
|
4853
5823
|
*/
|
4854
5824
|
function sendMessageToParentFromDialog(
|
4855
5825
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -4864,8 +5834,6 @@ message) {
|
|
4864
5834
|
* Send message to the dialog from the parent
|
4865
5835
|
*
|
4866
5836
|
* @param message - The message to send
|
4867
|
-
*
|
4868
|
-
* @beta
|
4869
5837
|
*/
|
4870
5838
|
function sendMessageToDialog(
|
4871
5839
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -4883,8 +5851,6 @@ message) {
|
|
4883
5851
|
* This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
|
4884
5852
|
*
|
4885
5853
|
* @param listener - The listener that will be triggered.
|
4886
|
-
*
|
4887
|
-
* @beta
|
4888
5854
|
*/
|
4889
5855
|
function registerOnMessageFromParent(listener) {
|
4890
5856
|
ensureInitialized(runtime, FrameContexts.task);
|
@@ -4908,8 +5874,6 @@ function registerOnMessageFromParent(listener) {
|
|
4908
5874
|
* @returns boolean to represent whether dialog.url.parentCommunication capability is supported
|
4909
5875
|
*
|
4910
5876
|
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
4911
|
-
*
|
4912
|
-
* @beta
|
4913
5877
|
*/
|
4914
5878
|
function parentCommunication_isSupported() {
|
4915
5879
|
var _a, _b;
|
@@ -4934,8 +5898,6 @@ function parentCommunication_isSupported() {
|
|
4934
5898
|
* @param urlDialogInfo - An object containing the parameters of the dialog module.
|
4935
5899
|
* @param submitHandler - Handler that triggers when a dialog calls the {@linkcode submit} function or when the user closes the dialog.
|
4936
5900
|
* @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
|
4937
|
-
*
|
4938
|
-
* @beta
|
4939
5901
|
*/
|
4940
5902
|
function url_open(urlDialogInfo, submitHandler, messageFromChildHandler) {
|
4941
5903
|
urlOpenHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.url.open" /* ApiName.Dialog_Url_Open */), urlDialogInfo, submitHandler, messageFromChildHandler);
|
@@ -4950,8 +5912,6 @@ function url_open(urlDialogInfo, submitHandler, messageFromChildHandler) {
|
|
4950
5912
|
* If this function is called from a dialog while {@link M365ContentAction} is set in the context object by the host, result will be ignored
|
4951
5913
|
*
|
4952
5914
|
* @param appIds - Valid application(s) that can receive the result of the submitted dialogs. Specifying this parameter helps prevent malicious apps from retrieving the dialog result. Multiple app IDs can be specified because a web app from a single underlying domain can power multiple apps across different environments and branding schemes.
|
4953
|
-
*
|
4954
|
-
* @beta
|
4955
5915
|
*/
|
4956
5916
|
function url_submit(result, appIds) {
|
4957
5917
|
urlSubmitHelper(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.url.submit" /* ApiName.Dialog_Url_Submit */), result, appIds);
|
@@ -4962,8 +5922,6 @@ function url_submit(result, appIds) {
|
|
4962
5922
|
* @returns boolean to represent whether dialog.url module is supported
|
4963
5923
|
*
|
4964
5924
|
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
4965
|
-
*
|
4966
|
-
* @beta
|
4967
5925
|
*/
|
4968
5926
|
function url_isSupported() {
|
4969
5927
|
return ensureInitialized(runtime) && (runtime.supports.dialog && runtime.supports.dialog.url) !== undefined;
|
@@ -5112,7 +6070,6 @@ function handleDialogMessage(message) {
|
|
5112
6070
|
/**
|
5113
6071
|
* Module for interaction with adaptive card dialogs that need to communicate with the bot framework
|
5114
6072
|
*
|
5115
|
-
* @beta
|
5116
6073
|
* @module
|
5117
6074
|
*/
|
5118
6075
|
|
@@ -5127,8 +6084,6 @@ function handleDialogMessage(message) {
|
|
5127
6084
|
*
|
5128
6085
|
* @param botAdaptiveCardDialogInfo - An object containing the parameters of the dialog module including completionBotId.
|
5129
6086
|
* @param submitHandler - Handler that triggers when the dialog has been submitted or closed.
|
5130
|
-
*
|
5131
|
-
* @beta
|
5132
6087
|
*/
|
5133
6088
|
function adaptiveCard_bot_open(botAdaptiveCardDialogInfo, submitHandler) {
|
5134
6089
|
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.meetingStage);
|
@@ -5146,8 +6101,6 @@ function adaptiveCard_bot_open(botAdaptiveCardDialogInfo, submitHandler) {
|
|
5146
6101
|
* @returns boolean to represent whether dialog.adaptiveCard.bot is supported
|
5147
6102
|
*
|
5148
6103
|
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
5149
|
-
*
|
5150
|
-
* @beta
|
5151
6104
|
*/
|
5152
6105
|
function adaptiveCard_bot_isSupported() {
|
5153
6106
|
const isAdaptiveCardVersionSupported = runtime.hostVersionsInfo &&
|
@@ -5164,7 +6117,6 @@ function adaptiveCard_bot_isSupported() {
|
|
5164
6117
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
5165
6118
|
/**
|
5166
6119
|
* Subcapability for interacting with adaptive card dialogs
|
5167
|
-
* @beta
|
5168
6120
|
* @module
|
5169
6121
|
*/
|
5170
6122
|
|
@@ -5183,8 +6135,6 @@ function adaptiveCard_bot_isSupported() {
|
|
5183
6135
|
*
|
5184
6136
|
* @param adaptiveCardDialogInfo - An object containing the parameters of the dialog module {@link AdaptiveCardDialogInfo}.
|
5185
6137
|
* @param submitHandler - Handler that triggers when a dialog fires an [Action.Submit](https://adaptivecards.io/explorer/Action.Submit.html) or when the user closes the dialog.
|
5186
|
-
*
|
5187
|
-
* @beta
|
5188
6138
|
*/
|
5189
6139
|
function adaptiveCard_open(adaptiveCardDialogInfo, submitHandler) {
|
5190
6140
|
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.meetingStage);
|
@@ -5202,8 +6152,6 @@ function adaptiveCard_open(adaptiveCardDialogInfo, submitHandler) {
|
|
5202
6152
|
* @returns boolean to represent whether dialog.adaptiveCard module is supported
|
5203
6153
|
*
|
5204
6154
|
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
5205
|
-
*
|
5206
|
-
* @beta
|
5207
6155
|
*/
|
5208
6156
|
function adaptiveCard_isSupported() {
|
5209
6157
|
const isAdaptiveCardVersionSupported = runtime.hostVersionsInfo &&
|
@@ -5229,7 +6177,6 @@ function adaptiveCard_isSupported() {
|
|
5229
6177
|
* @remarks Note that dialogs were previously called "task modules". While they have been renamed for clarity, the functionality has been maintained.
|
5230
6178
|
* For more details, see [Dialogs](https://learn.microsoft.com/microsoftteams/platform/task-modules-and-cards/what-are-task-modules)
|
5231
6179
|
*
|
5232
|
-
* @beta
|
5233
6180
|
* @module
|
5234
6181
|
*/
|
5235
6182
|
|
@@ -5248,8 +6195,6 @@ function adaptiveCard_isSupported() {
|
|
5248
6195
|
* Function is called during app initialization
|
5249
6196
|
* @internal
|
5250
6197
|
* Limited to Microsoft-internal use
|
5251
|
-
*
|
5252
|
-
* @beta
|
5253
6198
|
*/
|
5254
6199
|
function dialog_initialize() {
|
5255
6200
|
registerHandler(getApiVersionTag(dialogTelemetryVersionNumber, "dialog.registerMessageForChildHandler" /* ApiName.Dialog_RegisterMessageForChildHandler */), 'messageForChild', handleDialogMessage, false);
|
@@ -9985,6 +10930,24 @@ function unregisterAppInstallationHandler() {
|
|
9985
10930
|
sendMessageToParent(getApiVersionTag(otherAppStateChangeTelemetryVersionNumber, "otherApp.unregisterInstall" /* ApiName.OtherAppStateChange_UnregisterInstall */), "otherApp.unregisterInstall" /* ApiName.OtherAppStateChange_UnregisterInstall */);
|
9986
10931
|
handlers_removeHandler("otherApp.install" /* ApiName.OtherAppStateChange_Install */);
|
9987
10932
|
}
|
10933
|
+
/**
|
10934
|
+
* @hidden
|
10935
|
+
* @beta
|
10936
|
+
* @internal
|
10937
|
+
* Limited to Microsoft-internal use
|
10938
|
+
*
|
10939
|
+
* This function should be called by the Store App to notify the host that the
|
10940
|
+
* app with the given appId has been installed.
|
10941
|
+
*
|
10942
|
+
* @throws Error if {@link app.initialize} has not successfully completed or if the platform
|
10943
|
+
* does not support the otherAppStateChange capability.
|
10944
|
+
*/
|
10945
|
+
function notifyInstallCompleted(appId) {
|
10946
|
+
if (!otherAppStateChange_isSupported()) {
|
10947
|
+
throw new Error(ErrorCode.NOT_SUPPORTED_ON_PLATFORM.toString());
|
10948
|
+
}
|
10949
|
+
return callFunctionInHost("otherApp.notifyInstallCompleted" /* ApiName.OtherAppStateChange_NotifyInstallCompleted */, [appId.toString()], getApiVersionTag(otherAppStateChangeTelemetryVersionNumber, "otherApp.notifyInstallCompleted" /* ApiName.OtherAppStateChange_NotifyInstallCompleted */));
|
10950
|
+
}
|
9988
10951
|
/**
|
9989
10952
|
* Checks if the otherAppStateChange capability is supported by the host
|
9990
10953
|
* @returns boolean to represent whether the otherAppStateChange capability is supported
|
@@ -11970,6 +12933,123 @@ function hostEntity_isSupported() {
|
|
11970
12933
|
}
|
11971
12934
|
|
11972
12935
|
|
12936
|
+
;// ./src/private/store.ts
|
12937
|
+
var store_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12938
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
12939
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
12940
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
12941
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
12942
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
12943
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
12944
|
+
});
|
12945
|
+
};
|
12946
|
+
|
12947
|
+
|
12948
|
+
|
12949
|
+
|
12950
|
+
|
12951
|
+
|
12952
|
+
/**
|
12953
|
+
* @beta
|
12954
|
+
* @hidden
|
12955
|
+
* @module
|
12956
|
+
* Namespace to open app store
|
12957
|
+
* @internal
|
12958
|
+
* Limited to Microsoft-internal use
|
12959
|
+
*/
|
12960
|
+
const StoreVersionTagNum = "v2" /* ApiVersionNumber.V_2 */;
|
12961
|
+
/**
|
12962
|
+
* @beta
|
12963
|
+
* @hidden
|
12964
|
+
* Enum of store dialog type
|
12965
|
+
* @internal
|
12966
|
+
* Limited to Microsoft-internal use
|
12967
|
+
*/
|
12968
|
+
var StoreDialogType;
|
12969
|
+
(function (StoreDialogType) {
|
12970
|
+
/**
|
12971
|
+
* open a store without navigation
|
12972
|
+
*/
|
12973
|
+
StoreDialogType["FullStore"] = "fullstore";
|
12974
|
+
/**
|
12975
|
+
* open a store with navigation to a specific collection
|
12976
|
+
*/
|
12977
|
+
StoreDialogType["SpecificStore"] = "specificstore";
|
12978
|
+
/**
|
12979
|
+
* open in-context-store
|
12980
|
+
*/
|
12981
|
+
StoreDialogType["InContextStore"] = "ics";
|
12982
|
+
/**
|
12983
|
+
* open detail dialog (DD)
|
12984
|
+
*/
|
12985
|
+
StoreDialogType["AppDetail"] = "appdetail";
|
12986
|
+
})(StoreDialogType || (StoreDialogType = {}));
|
12987
|
+
/**
|
12988
|
+
* @beta
|
12989
|
+
* @hidden
|
12990
|
+
* error message when getting invalid store dialog type
|
12991
|
+
* @internal
|
12992
|
+
* Limited to Microsoft-internal use
|
12993
|
+
*/
|
12994
|
+
const errorInvalidDialogType = 'Invalid store dialog type, but type needed to specify store to open';
|
12995
|
+
/**
|
12996
|
+
* @beta
|
12997
|
+
* @hidden
|
12998
|
+
* error message when getting wrong app id or missing app id
|
12999
|
+
* @internal
|
13000
|
+
* Limited to Microsoft-internal use
|
13001
|
+
*/
|
13002
|
+
const errorMissingAppId = 'No App Id present, but AppId needed to open AppDetail store';
|
13003
|
+
/**
|
13004
|
+
* @beta
|
13005
|
+
* @hidden
|
13006
|
+
* error message when getting wrong collection id or missing collection id
|
13007
|
+
* @internal
|
13008
|
+
* Limited to Microsoft-internal use
|
13009
|
+
*/
|
13010
|
+
const errorMissingCollectionId = 'No Collection Id present, but CollectionId needed to open a store specific to a collection';
|
13011
|
+
/**
|
13012
|
+
* @beta
|
13013
|
+
* @hidden
|
13014
|
+
* Api to open a store
|
13015
|
+
*
|
13016
|
+
* @param openStoreParams - params to call openStoreExperience
|
13017
|
+
*
|
13018
|
+
* @internal
|
13019
|
+
* Limited to Microsoft-internal use
|
13020
|
+
*/
|
13021
|
+
function openStoreExperience(openStoreParams) {
|
13022
|
+
return store_awaiter(this, void 0, void 0, function* () {
|
13023
|
+
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.meetingStage);
|
13024
|
+
if (!store_isSupported()) {
|
13025
|
+
throw errorNotSupportedOnPlatform;
|
13026
|
+
}
|
13027
|
+
if (openStoreParams === undefined || !Object.values(StoreDialogType).includes(openStoreParams.dialogType)) {
|
13028
|
+
throw new Error(errorInvalidDialogType);
|
13029
|
+
}
|
13030
|
+
if (openStoreParams.dialogType === StoreDialogType.AppDetail && !(openStoreParams.appId instanceof AppId)) {
|
13031
|
+
throw new Error(errorMissingAppId);
|
13032
|
+
}
|
13033
|
+
if (openStoreParams.dialogType === StoreDialogType.SpecificStore && !openStoreParams.collectionId) {
|
13034
|
+
throw new Error(errorMissingCollectionId);
|
13035
|
+
}
|
13036
|
+
return callFunctionInHost("store.open" /* ApiName.Store_Open */, [
|
13037
|
+
openStoreParams.dialogType,
|
13038
|
+
openStoreParams.appId,
|
13039
|
+
openStoreParams.collectionId,
|
13040
|
+
], getApiVersionTag(StoreVersionTagNum, "store.open" /* ApiName.Store_Open */));
|
13041
|
+
});
|
13042
|
+
}
|
13043
|
+
/**
|
13044
|
+
* Checks if the store capability is supported by the host
|
13045
|
+
* @returns boolean to represent whether the store capability is supported
|
13046
|
+
*
|
13047
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
13048
|
+
*/
|
13049
|
+
function store_isSupported() {
|
13050
|
+
return ensureInitialized(runtime) && !!runtime.supports.store;
|
13051
|
+
}
|
13052
|
+
|
11973
13053
|
;// ./src/private/index.ts
|
11974
13054
|
|
11975
13055
|
|
@@ -12006,6 +13086,8 @@ function hostEntity_isSupported() {
|
|
12006
13086
|
|
12007
13087
|
|
12008
13088
|
|
13089
|
+
|
13090
|
+
|
12009
13091
|
|
12010
13092
|
|
12011
13093
|
|
@@ -13145,6 +14227,8 @@ function clipboard_isSupported() {
|
|
13145
14227
|
*/
|
13146
14228
|
|
13147
14229
|
|
14230
|
+
|
14231
|
+
|
13148
14232
|
/**
|
13149
14233
|
* Checks if MSAL-NAA channel recommended by the host
|
13150
14234
|
* @returns true if host is recommending NAA channel and false otherwise
|
@@ -13155,7 +14239,21 @@ function clipboard_isSupported() {
|
|
13155
14239
|
*/
|
13156
14240
|
function isNAAChannelRecommended() {
|
13157
14241
|
var _a;
|
13158
|
-
return (_a = (ensureInitialized(runtime) &&
|
14242
|
+
return ((_a = (ensureInitialized(runtime) &&
|
14243
|
+
(runtime.isNAAChannelRecommended || isNAAChannelRecommendedForLegacyTeamsMobile()))) !== null && _a !== void 0 ? _a : false);
|
14244
|
+
}
|
14245
|
+
function isNAAChannelRecommendedForLegacyTeamsMobile() {
|
14246
|
+
return ensureInitialized(runtime) &&
|
14247
|
+
isHostAndroidOrIOSOrIPadOS() &&
|
14248
|
+
runtime.isLegacyTeams &&
|
14249
|
+
runtime.supports.nestedAppAuth
|
14250
|
+
? true
|
14251
|
+
: false;
|
14252
|
+
}
|
14253
|
+
function isHostAndroidOrIOSOrIPadOS() {
|
14254
|
+
return (GlobalVars.hostClientType === HostClientType.android ||
|
14255
|
+
GlobalVars.hostClientType === HostClientType.ios ||
|
14256
|
+
GlobalVars.hostClientType === HostClientType.ipados);
|
13159
14257
|
}
|
13160
14258
|
|
13161
14259
|
;// ./src/public/geoLocation/map.ts
|