@cuemath/leap 3.4.3 → 3.4.4-aa1

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/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.4.3",
3
+ "version": "3.4.4-aa1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,40 +0,0 @@
1
- const s = async (i, r) => {
2
- try {
3
- r("av_preview_open_media_devices", { constraints: i });
4
- const e = await navigator.mediaDevices.getUserMedia(i);
5
- return r("av_preview_open_media_devices_success", { constraints: i }), e;
6
- } catch (e) {
7
- if (e instanceof DOMException)
8
- switch (r("av_preview_open_media_devices_error", {
9
- constraints: i,
10
- error_name: e.name,
11
- error_message: e.message
12
- }), e.name) {
13
- case "NotAllowedError":
14
- if (e.message === "Permission denied by system")
15
- throw new Error("permissionDeniedBySystem");
16
- if (e.message === "Permission denied" || e.message === "Permission dismissed" || e.message === "The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.")
17
- throw new Error("permissionDenied");
18
- break;
19
- case "NotFoundError":
20
- throw new Error("deviceNotFound");
21
- case "NotReadableError":
22
- throw new Error("thirdPartyApps");
23
- }
24
- throw new Error("other");
25
- }
26
- }, o = async () => (await navigator.mediaDevices.enumerateDevices()).reduce(
27
- (r, e) => (e.deviceId && (e.kind === "audioinput" ? r.audio.push({ id: e.deviceId, label: e.label }) : e.kind === "videoinput" ? r.video.push({ id: e.deviceId, label: e.label }) : e.kind === "audiooutput" && r.audioOutput.push({ id: e.deviceId, label: e.label })), r),
28
- { audio: [], video: [], audioOutput: [] }
29
- ), a = (i, r) => {
30
- i.getTracks().forEach((e) => {
31
- (!r || e.kind === r) && (e.stop(), i.removeTrack(e));
32
- });
33
- }, t = (i, r) => (r === "audio" ? i.getAudioTracks() : i.getVideoTracks())[0];
34
- export {
35
- o as getConnectedDevices,
36
- t as getTrack,
37
- s as openMediaDevices,
38
- a as removeTracksFromStream
39
- };
40
- //# sourceMappingURL=helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.js","sources":["../../../../src/features/av/av-preview/helper.ts"],"sourcesContent":["import type { IDevicesMap, ILogger, TMediaKind } from './av-preview-types';\n\nconst openMediaDevices = async (constraints: MediaStreamConstraints, logger: ILogger) => {\n try {\n logger('av_preview_open_media_devices', { constraints });\n\n const promise = await navigator.mediaDevices.getUserMedia(constraints);\n\n logger('av_preview_open_media_devices_success', { constraints });\n\n return promise;\n } catch (error) {\n if (error instanceof DOMException) {\n logger('av_preview_open_media_devices_error', {\n constraints,\n error_name: error.name,\n error_message: error.message,\n });\n switch (error.name) {\n case 'NotAllowedError':\n if (error.message === 'Permission denied by system') {\n throw new Error('permissionDeniedBySystem');\n } else if (\n error.message === 'Permission denied' ||\n error.message === 'Permission dismissed' ||\n error.message ===\n 'The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.'\n ) {\n throw new Error('permissionDenied');\n }\n break;\n case 'NotFoundError':\n throw new Error('deviceNotFound');\n case 'NotReadableError':\n throw new Error('thirdPartyApps');\n }\n }\n\n throw new Error('other');\n }\n};\n\ninterface IGetConnectedDevices {\n (): Promise<IDevicesMap>;\n}\n\nconst getConnectedDevices: IGetConnectedDevices = async () => {\n const devices = await navigator.mediaDevices.enumerateDevices();\n\n return devices.reduce<IDevicesMap>(\n (acc, device) => {\n if (device.deviceId) {\n if (device.kind === 'audioinput') {\n acc.audio.push({ id: device.deviceId, label: device.label });\n } else if (device.kind === 'videoinput') {\n acc.video.push({ id: device.deviceId, label: device.label });\n } else if (device.kind === 'audiooutput') {\n acc.audioOutput.push({ id: device.deviceId, label: device.label });\n }\n }\n\n return acc;\n },\n { audio: [], video: [], audioOutput: [] },\n );\n};\n\nconst removeTracksFromStream = (stream: MediaStream, kind?: TMediaKind) => {\n stream.getTracks().forEach(track => {\n if (!kind || track.kind === kind) {\n track.stop();\n stream.removeTrack(track);\n }\n });\n};\n\nconst getTrack = (stream: MediaStream, deviceKind: TMediaKind) => {\n const tracks = deviceKind === 'audio' ? stream.getAudioTracks() : stream.getVideoTracks();\n\n return tracks[0];\n};\n\nexport { openMediaDevices, getConnectedDevices, removeTracksFromStream, getTrack };\n"],"names":["openMediaDevices","constraints","logger","promise","error","getConnectedDevices","acc","device","removeTracksFromStream","stream","kind","track","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GAAqBC,MAAsB;AAClE,EAAAD,EAAA,UAAA,EAAY,QAAQ,CAASE,MAAA;AAClC,KAAI,CAACD,KAAQC,EAAM,SAASD,OAC1BC,EAAM,KAAK,GACXF,EAAO,YAAYE,CAAK;AAAA,EAC1B,CACD;AACH,GAEMC,IAAW,CAACH,GAAqBI,OACtBA,MAAe,UAAUJ,EAAO,mBAAmBA,EAAO,kBAE3D,CAAC;"}
@@ -1,22 +0,0 @@
1
- import { useState as s, useCallback as r, useEffect as u } from "react";
2
- const d = () => {
3
- const [e] = s(/* @__PURE__ */ new Set()), l = r(
4
- (t) => new Promise((c, n) => {
5
- e.add(t), t.then((a) => {
6
- e.has(t) && (e.delete(t), c(a));
7
- }).catch((a) => {
8
- e.has(t) && (e.delete(t), n(a));
9
- });
10
- }),
11
- [e]
12
- );
13
- return u(() => () => {
14
- e.forEach((t) => {
15
- e.delete(t);
16
- });
17
- }, [e]), l;
18
- };
19
- export {
20
- d as default
21
- };
22
- //# sourceMappingURL=use-cancellable-promise.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-cancellable-promise.js","sources":["../../../src/features/hooks/use-cancellable-promise.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\ninterface IUseCancellablePromise {\n (): <T>(promise: Promise<T>) => Promise<T>;\n}\nconst useCancellablePromise: IUseCancellablePromise = () => {\n const [promises] = useState<Set<Promise<unknown>>>(new Set());\n\n const cancellablePromise = useCallback<ReturnType<IUseCancellablePromise>>(\n promise => {\n return new Promise((resolve, reject) => {\n promises.add(promise);\n\n promise\n .then(result => {\n if (promises.has(promise)) {\n promises.delete(promise);\n resolve(result);\n }\n })\n .catch(error => {\n if (promises.has(promise)) {\n promises.delete(promise);\n reject(error);\n }\n });\n });\n },\n [promises],\n );\n\n useEffect(() => {\n return () => {\n promises.forEach(p => {\n // No native way to cancel a promise, but we can ignore its resolution\n promises.delete(p);\n });\n };\n }, [promises]);\n\n return cancellablePromise;\n};\n\nexport default useCancellablePromise;\n"],"names":["useCancellablePromise","promises","useState","cancellablePromise","useCallback","promise","resolve","reject","result","error","useEffect","p"],"mappings":";AAKA,MAAMA,IAAgD,MAAM;AAC1D,QAAM,CAACC,CAAQ,IAAIC,EAAgC,oBAAI,IAAK,CAAA,GAEtDC,IAAqBC;AAAA,IACzB,CAAWC,MACF,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,MAAAN,EAAS,IAAII,CAAO,GAEpBA,EACG,KAAK,CAAUG,MAAA;AACV,QAAAP,EAAS,IAAII,CAAO,MACtBJ,EAAS,OAAOI,CAAO,GACvBC,EAAQE,CAAM;AAAA,MAChB,CACD,EACA,MAAM,CAASC,MAAA;AACV,QAAAR,EAAS,IAAII,CAAO,MACtBJ,EAAS,OAAOI,CAAO,GACvBE,EAAOE,CAAK;AAAA,MACd,CACD;AAAA,IAAA,CACJ;AAAA,IAEH,CAACR,CAAQ;AAAA,EAAA;AAGX,SAAAS,EAAU,MACD,MAAM;AACX,IAAAT,EAAS,QAAQ,CAAKU,MAAA;AAEpB,MAAAV,EAAS,OAAOU,CAAC;AAAA,IAAA,CAClB;AAAA,EAAA,GAEF,CAACV,CAAQ,CAAC,GAENE;AACT;"}