@100mslive/roomkit-react 0.3.12-alpha.0 → 0.3.12-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-OAQTW322.css → HLSView-BJWPNE7P.css} +3 -3
- package/dist/{HLSView-OAQTW322.css.map → HLSView-BJWPNE7P.css.map} +1 -1
- package/dist/{HLSView-2BPYWKSN.js → HLSView-EHEKBMBJ.js} +2 -2
- package/dist/Prebuilt/components/Notifications/TranscriptionNotifications.d.ts +1 -0
- package/dist/{chunk-D5F44IP2.js → chunk-ZPUJUJBA.js} +119 -110
- package/dist/chunk-ZPUJUJBA.js.map +7 -0
- package/dist/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +181 -161
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +80 -16
- package/dist/meta.esbuild.json +97 -33
- package/package.json +7 -7
- package/src/Prebuilt/components/MoreSettings/CaptionContent.tsx +3 -4
- package/src/Prebuilt/components/Notifications/Notifications.tsx +5 -44
- package/src/Prebuilt/components/Notifications/TranscriptionNotifications.tsx +58 -0
- package/dist/chunk-D5F44IP2.js.map +0 -7
- /package/dist/{HLSView-2BPYWKSN.js.map → HLSView-EHEKBMBJ.js.map} +0 -0
package/dist/meta.esbuild.json
CHANGED
@@ -3879,7 +3879,7 @@
|
|
3879
3879
|
"format": "esm"
|
3880
3880
|
},
|
3881
3881
|
"src/Prebuilt/components/MoreSettings/CaptionContent.tsx": {
|
3882
|
-
"bytes":
|
3882
|
+
"bytes": 5144,
|
3883
3883
|
"imports": [
|
3884
3884
|
{
|
3885
3885
|
"path": "react",
|
@@ -4640,7 +4640,7 @@
|
|
4640
4640
|
"format": "cjs"
|
4641
4641
|
},
|
4642
4642
|
"../hms-video-store/dist/index.js": {
|
4643
|
-
"bytes":
|
4643
|
+
"bytes": 338124,
|
4644
4644
|
"imports": [
|
4645
4645
|
{
|
4646
4646
|
"path": "../../node_modules/reselect/es/index.js",
|
@@ -10454,7 +10454,7 @@
|
|
10454
10454
|
],
|
10455
10455
|
"format": "esm"
|
10456
10456
|
},
|
10457
|
-
"../../../../../../../tmp/tmp-
|
10457
|
+
"../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fdeb3/tldraw.css": {
|
10458
10458
|
"bytes": 80111,
|
10459
10459
|
"imports": [
|
10460
10460
|
{
|
@@ -10504,7 +10504,7 @@
|
|
10504
10504
|
}
|
10505
10505
|
]
|
10506
10506
|
},
|
10507
|
-
"../../../../../../../tmp/tmp-
|
10507
|
+
"../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fddc1/index.css": {
|
10508
10508
|
"bytes": 597,
|
10509
10509
|
"imports": [
|
10510
10510
|
{
|
@@ -10513,7 +10513,7 @@
|
|
10513
10513
|
"external": true
|
10514
10514
|
},
|
10515
10515
|
{
|
10516
|
-
"path": "../../../../../../../tmp/tmp-
|
10516
|
+
"path": "../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fdeb3/tldraw.css",
|
10517
10517
|
"kind": "import-rule",
|
10518
10518
|
"original": "@tldraw/tldraw/tldraw.css"
|
10519
10519
|
}
|
@@ -10588,7 +10588,7 @@
|
|
10588
10588
|
"original": "../../common/constants"
|
10589
10589
|
},
|
10590
10590
|
{
|
10591
|
-
"path": "../../../../../../../tmp/tmp-
|
10591
|
+
"path": "../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fddc1/index.css",
|
10592
10592
|
"kind": "import-statement",
|
10593
10593
|
"original": "@100mslive/hms-whiteboard/index.css"
|
10594
10594
|
},
|
@@ -12754,8 +12754,8 @@
|
|
12754
12754
|
],
|
12755
12755
|
"format": "esm"
|
12756
12756
|
},
|
12757
|
-
"src/Prebuilt/components/Notifications/
|
12758
|
-
"bytes":
|
12757
|
+
"src/Prebuilt/components/Notifications/TranscriptionNotifications.tsx": {
|
12758
|
+
"bytes": 2246,
|
12759
12759
|
"imports": [
|
12760
12760
|
{
|
12761
12761
|
"path": "react",
|
@@ -12777,6 +12777,47 @@
|
|
12777
12777
|
"kind": "import-statement",
|
12778
12778
|
"external": true
|
12779
12779
|
},
|
12780
|
+
{
|
12781
|
+
"path": "src/Prebuilt/components/Toast/ToastManager.js",
|
12782
|
+
"kind": "import-statement",
|
12783
|
+
"original": "../Toast/ToastManager"
|
12784
|
+
},
|
12785
|
+
{
|
12786
|
+
"path": "src/Prebuilt/components/AppData/useUISettings.js",
|
12787
|
+
"kind": "import-statement",
|
12788
|
+
"original": "../AppData/useUISettings"
|
12789
|
+
},
|
12790
|
+
{
|
12791
|
+
"path": "src/Prebuilt/common/constants.ts",
|
12792
|
+
"kind": "import-statement",
|
12793
|
+
"original": "../../common/constants"
|
12794
|
+
},
|
12795
|
+
{
|
12796
|
+
"path": "<define:process.env>",
|
12797
|
+
"kind": "import-statement",
|
12798
|
+
"external": true
|
12799
|
+
}
|
12800
|
+
],
|
12801
|
+
"format": "esm"
|
12802
|
+
},
|
12803
|
+
"src/Prebuilt/components/Notifications/Notifications.tsx": {
|
12804
|
+
"bytes": 8003,
|
12805
|
+
"imports": [
|
12806
|
+
{
|
12807
|
+
"path": "react",
|
12808
|
+
"kind": "import-statement",
|
12809
|
+
"external": true
|
12810
|
+
},
|
12811
|
+
{
|
12812
|
+
"path": "@100mslive/react-sdk",
|
12813
|
+
"kind": "import-statement",
|
12814
|
+
"external": true
|
12815
|
+
},
|
12816
|
+
{
|
12817
|
+
"path": "@100mslive/react-icons",
|
12818
|
+
"kind": "import-statement",
|
12819
|
+
"external": true
|
12820
|
+
},
|
12780
12821
|
{
|
12781
12822
|
"path": "src/index.ts",
|
12782
12823
|
"kind": "import-statement",
|
@@ -12842,6 +12883,11 @@
|
|
12842
12883
|
"kind": "import-statement",
|
12843
12884
|
"original": "./TrackUnmuteModal"
|
12844
12885
|
},
|
12886
|
+
{
|
12887
|
+
"path": "src/Prebuilt/components/Notifications/TranscriptionNotifications.tsx",
|
12888
|
+
"kind": "import-statement",
|
12889
|
+
"original": "./TranscriptionNotifications"
|
12890
|
+
},
|
12845
12891
|
{
|
12846
12892
|
"path": "src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts",
|
12847
12893
|
"kind": "import-statement",
|
@@ -13671,7 +13717,7 @@
|
|
13671
13717
|
"dist/index.js": {
|
13672
13718
|
"imports": [
|
13673
13719
|
{
|
13674
|
-
"path": "dist/chunk-
|
13720
|
+
"path": "dist/chunk-ZPUJUJBA.js",
|
13675
13721
|
"kind": "import-statement"
|
13676
13722
|
}
|
13677
13723
|
],
|
@@ -13745,16 +13791,16 @@
|
|
13745
13791
|
"inputs": {},
|
13746
13792
|
"bytes": 1822
|
13747
13793
|
},
|
13748
|
-
"dist/HLSView-
|
13794
|
+
"dist/HLSView-EHEKBMBJ.js.map": {
|
13749
13795
|
"imports": [],
|
13750
13796
|
"exports": [],
|
13751
13797
|
"inputs": {},
|
13752
13798
|
"bytes": 99904
|
13753
13799
|
},
|
13754
|
-
"dist/HLSView-
|
13800
|
+
"dist/HLSView-EHEKBMBJ.js": {
|
13755
13801
|
"imports": [
|
13756
13802
|
{
|
13757
|
-
"path": "dist/chunk-
|
13803
|
+
"path": "dist/chunk-ZPUJUJBA.js",
|
13758
13804
|
"kind": "import-statement"
|
13759
13805
|
},
|
13760
13806
|
{
|
@@ -13932,7 +13978,7 @@
|
|
13932
13978
|
"default"
|
13933
13979
|
],
|
13934
13980
|
"entryPoint": "src/Prebuilt/layouts/HLSView.jsx",
|
13935
|
-
"cssBundle": "dist/HLSView-
|
13981
|
+
"cssBundle": "dist/HLSView-BJWPNE7P.css",
|
13936
13982
|
"inputs": {
|
13937
13983
|
"src/Prebuilt/layouts/HLSView.jsx": {
|
13938
13984
|
"bytesInOutput": 25793
|
@@ -13991,13 +14037,13 @@
|
|
13991
14037
|
},
|
13992
14038
|
"bytes": 58515
|
13993
14039
|
},
|
13994
|
-
"dist/chunk-
|
14040
|
+
"dist/chunk-ZPUJUJBA.js.map": {
|
13995
14041
|
"imports": [],
|
13996
14042
|
"exports": [],
|
13997
14043
|
"inputs": {},
|
13998
|
-
"bytes":
|
14044
|
+
"bytes": 3262044
|
13999
14045
|
},
|
14000
|
-
"dist/chunk-
|
14046
|
+
"dist/chunk-ZPUJUJBA.js": {
|
14001
14047
|
"imports": [
|
14002
14048
|
{
|
14003
14049
|
"path": "react",
|
@@ -16470,7 +16516,7 @@
|
|
16470
16516
|
"external": true
|
16471
16517
|
},
|
16472
16518
|
{
|
16473
|
-
"path": "dist/HLSView-
|
16519
|
+
"path": "dist/HLSView-EHEKBMBJ.js",
|
16474
16520
|
"kind": "dynamic-import"
|
16475
16521
|
},
|
16476
16522
|
{
|
@@ -16623,11 +16669,6 @@
|
|
16623
16669
|
"kind": "import-statement",
|
16624
16670
|
"external": true
|
16625
16671
|
},
|
16626
|
-
{
|
16627
|
-
"path": "ts-pattern",
|
16628
|
-
"kind": "import-statement",
|
16629
|
-
"external": true
|
16630
|
-
},
|
16631
16672
|
{
|
16632
16673
|
"path": "@100mslive/react-sdk",
|
16633
16674
|
"kind": "import-statement",
|
@@ -16783,6 +16824,26 @@
|
|
16783
16824
|
"kind": "import-statement",
|
16784
16825
|
"external": true
|
16785
16826
|
},
|
16827
|
+
{
|
16828
|
+
"path": "ts-pattern",
|
16829
|
+
"kind": "import-statement",
|
16830
|
+
"external": true
|
16831
|
+
},
|
16832
|
+
{
|
16833
|
+
"path": "@100mslive/react-sdk",
|
16834
|
+
"kind": "import-statement",
|
16835
|
+
"external": true
|
16836
|
+
},
|
16837
|
+
{
|
16838
|
+
"path": "@100mslive/react-icons",
|
16839
|
+
"kind": "import-statement",
|
16840
|
+
"external": true
|
16841
|
+
},
|
16842
|
+
{
|
16843
|
+
"path": "react",
|
16844
|
+
"kind": "import-statement",
|
16845
|
+
"external": true
|
16846
|
+
},
|
16786
16847
|
{
|
16787
16848
|
"path": "react-use",
|
16788
16849
|
"kind": "import-statement",
|
@@ -16953,7 +17014,7 @@
|
|
16953
17014
|
],
|
16954
17015
|
"inputs": {
|
16955
17016
|
"<define:process.env>": {
|
16956
|
-
"bytesInOutput":
|
17017
|
+
"bytesInOutput": 17904
|
16957
17018
|
},
|
16958
17019
|
"../../node_modules/lodash/lodash.js": {
|
16959
17020
|
"bytesInOutput": 224310
|
@@ -17376,7 +17437,7 @@
|
|
17376
17437
|
"bytesInOutput": 989
|
17377
17438
|
},
|
17378
17439
|
"src/Prebuilt/components/MoreSettings/CaptionContent.tsx": {
|
17379
|
-
"bytesInOutput":
|
17440
|
+
"bytesInOutput": 5003
|
17380
17441
|
},
|
17381
17442
|
"src/Prebuilt/components/MoreSettings/FullScreenItem.tsx": {
|
17382
17443
|
"bytesInOutput": 628
|
@@ -17795,7 +17856,7 @@
|
|
17795
17856
|
"src/Prebuilt/components/VideoLayouts/WhiteboardLayout.tsx": {
|
17796
17857
|
"bytesInOutput": 2656
|
17797
17858
|
},
|
17798
|
-
"../../../../../../../tmp/tmp-
|
17859
|
+
"../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fddc1/index.css": {
|
17799
17860
|
"bytesInOutput": 0
|
17800
17861
|
},
|
17801
17862
|
"src/Prebuilt/common/PeersSorter.ts": {
|
@@ -17856,7 +17917,7 @@
|
|
17856
17917
|
"bytesInOutput": 27
|
17857
17918
|
},
|
17858
17919
|
"src/Prebuilt/components/Notifications/Notifications.tsx": {
|
17859
|
-
"bytesInOutput":
|
17920
|
+
"bytesInOutput": 7252
|
17860
17921
|
},
|
17861
17922
|
"src/Prebuilt/components/Notifications/AutoplayBlockedModal.tsx": {
|
17862
17923
|
"bytesInOutput": 1053
|
@@ -17900,6 +17961,9 @@
|
|
17900
17961
|
"src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx": {
|
17901
17962
|
"bytesInOutput": 1651
|
17902
17963
|
},
|
17964
|
+
"src/Prebuilt/components/Notifications/TranscriptionNotifications.tsx": {
|
17965
|
+
"bytesInOutput": 2152
|
17966
|
+
},
|
17903
17967
|
"src/Prebuilt/components/Preview/PreviewScreen.tsx": {
|
17904
17968
|
"bytesInOutput": 1173
|
17905
17969
|
},
|
@@ -17934,7 +17998,7 @@
|
|
17934
17998
|
"bytesInOutput": 651
|
17935
17999
|
}
|
17936
18000
|
},
|
17937
|
-
"bytes":
|
18001
|
+
"bytes": 1306372
|
17938
18002
|
},
|
17939
18003
|
"dist/index.css.map": {
|
17940
18004
|
"imports": [],
|
@@ -17996,22 +18060,22 @@
|
|
17996
18060
|
}
|
17997
18061
|
],
|
17998
18062
|
"inputs": {
|
17999
|
-
"../../../../../../../tmp/tmp-
|
18063
|
+
"../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fdeb3/tldraw.css": {
|
18000
18064
|
"bytesInOutput": 75223
|
18001
18065
|
},
|
18002
|
-
"../../../../../../../tmp/tmp-
|
18066
|
+
"../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fddc1/index.css": {
|
18003
18067
|
"bytesInOutput": 401
|
18004
18068
|
}
|
18005
18069
|
},
|
18006
18070
|
"bytes": 75901
|
18007
18071
|
},
|
18008
|
-
"dist/HLSView-
|
18072
|
+
"dist/HLSView-BJWPNE7P.css.map": {
|
18009
18073
|
"imports": [],
|
18010
18074
|
"exports": [],
|
18011
18075
|
"inputs": {},
|
18012
18076
|
"bytes": 122402
|
18013
18077
|
},
|
18014
|
-
"dist/HLSView-
|
18078
|
+
"dist/HLSView-BJWPNE7P.css": {
|
18015
18079
|
"imports": [
|
18016
18080
|
{
|
18017
18081
|
"path": "https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap",
|
@@ -18065,10 +18129,10 @@
|
|
18065
18129
|
}
|
18066
18130
|
],
|
18067
18131
|
"inputs": {
|
18068
|
-
"../../../../../../../tmp/tmp-
|
18132
|
+
"../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fdeb3/tldraw.css": {
|
18069
18133
|
"bytesInOutput": 75223
|
18070
18134
|
},
|
18071
|
-
"../../../../../../../tmp/tmp-
|
18135
|
+
"../../../../../../../tmp/tmp-2856-GnTENBz90iJn/18fc335fddc1/index.css": {
|
18072
18136
|
"bytesInOutput": 401
|
18073
18137
|
}
|
18074
18138
|
},
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"prebuilt",
|
11
11
|
"roomkit"
|
12
12
|
],
|
13
|
-
"version": "0.3.12-alpha.
|
13
|
+
"version": "0.3.12-alpha.1",
|
14
14
|
"author": "100ms",
|
15
15
|
"license": "MIT",
|
16
16
|
"repository": {
|
@@ -74,12 +74,12 @@
|
|
74
74
|
"react": ">=17.0.2 <19.0.0"
|
75
75
|
},
|
76
76
|
"dependencies": {
|
77
|
-
"@100mslive/hls-player": "0.3.12-alpha.
|
77
|
+
"@100mslive/hls-player": "0.3.12-alpha.1",
|
78
78
|
"@100mslive/hms-noise-cancellation": "0.0.1",
|
79
|
-
"@100mslive/hms-virtual-background": "1.13.12-alpha.
|
80
|
-
"@100mslive/hms-whiteboard": "0.0.2-alpha.
|
81
|
-
"@100mslive/react-icons": "0.10.12-alpha.
|
82
|
-
"@100mslive/react-sdk": "0.10.12-alpha.
|
79
|
+
"@100mslive/hms-virtual-background": "1.13.12-alpha.1",
|
80
|
+
"@100mslive/hms-whiteboard": "0.0.2-alpha.1",
|
81
|
+
"@100mslive/react-icons": "0.10.12-alpha.1",
|
82
|
+
"@100mslive/react-sdk": "0.10.12-alpha.1",
|
83
83
|
"@100mslive/types-prebuilt": "0.12.8",
|
84
84
|
"@emoji-mart/data": "^1.0.6",
|
85
85
|
"@emoji-mart/react": "^1.0.1",
|
@@ -115,5 +115,5 @@
|
|
115
115
|
"uuid": "^8.3.2",
|
116
116
|
"worker-timers": "^7.0.40"
|
117
117
|
},
|
118
|
-
"gitHead": "
|
118
|
+
"gitHead": "d1da18b74e26ac0defecd1509864a9d8dd8c258e"
|
119
119
|
}
|
@@ -89,12 +89,11 @@ export const CaptionContent = ({ isMobile, onExit }: { isMobile: boolean; onExit
|
|
89
89
|
data-testid="popup_change_btn"
|
90
90
|
onClick={async () => {
|
91
91
|
try {
|
92
|
-
ToastManager.removeToast(toastId);
|
93
92
|
if (isTranscriptionEnabled) {
|
94
93
|
await actions.stopTranscription({
|
95
94
|
mode: HMSTranscriptionMode.CAPTION,
|
96
95
|
});
|
97
|
-
const id = ToastManager.
|
96
|
+
const id = ToastManager.replaceToast(toastId, {
|
98
97
|
title: `Disabling Closed Caption for everyone.`,
|
99
98
|
variant: 'standard',
|
100
99
|
duration: DURATION,
|
@@ -107,7 +106,7 @@ export const CaptionContent = ({ isMobile, onExit }: { isMobile: boolean; onExit
|
|
107
106
|
await actions.startTranscription({
|
108
107
|
mode: HMSTranscriptionMode.CAPTION,
|
109
108
|
});
|
110
|
-
const id = ToastManager.
|
109
|
+
const id = ToastManager.replaceToast(toastId, {
|
111
110
|
title: `Enabling Closed Caption for everyone.`,
|
112
111
|
variant: 'standard',
|
113
112
|
duration: DURATION,
|
@@ -115,7 +114,7 @@ export const CaptionContent = ({ isMobile, onExit }: { isMobile: boolean; onExit
|
|
115
114
|
});
|
116
115
|
setToastId(id);
|
117
116
|
} catch (err) {
|
118
|
-
const id = ToastManager.
|
117
|
+
const id = ToastManager.replaceToast(toastId, {
|
119
118
|
title: `Failed to ${isTranscriptionEnabled ? 'disabled' : 'enabled'} closed caption`,
|
120
119
|
variant: 'error',
|
121
120
|
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
|
@@ -1,11 +1,9 @@
|
|
1
1
|
/* eslint-disable no-case-declarations */
|
2
2
|
import React, { useCallback, useEffect } from 'react';
|
3
|
-
import { match } from 'ts-pattern';
|
4
3
|
import {
|
5
4
|
HMSNotificationTypes,
|
6
5
|
HMSRoleChangeRequest,
|
7
6
|
HMSRoomState,
|
8
|
-
HMSTranscriptionState,
|
9
7
|
selectIsLocalScreenShared,
|
10
8
|
selectLocalPeerID,
|
11
9
|
selectPeerNameByID,
|
@@ -16,7 +14,7 @@ import {
|
|
16
14
|
useHMSStore,
|
17
15
|
useHMSVanillaStore,
|
18
16
|
} from '@100mslive/react-sdk';
|
19
|
-
import {
|
17
|
+
import { GroupIcon } from '@100mslive/react-icons';
|
20
18
|
import { Box, Button } from '../../..';
|
21
19
|
import { useRoomLayout, useUpdateRoomLayout } from '../../provider/roomLayoutProvider';
|
22
20
|
// @ts-ignore: No implicit Any
|
@@ -31,12 +29,13 @@ import { ReconnectNotifications } from './ReconnectNotifications';
|
|
31
29
|
import { TrackBulkUnmuteModal } from './TrackBulkUnmuteModal';
|
32
30
|
import { TrackNotifications } from './TrackNotifications';
|
33
31
|
import { TrackUnmuteModal } from './TrackUnmuteModal';
|
32
|
+
import { TranscriptionNotifications } from './TranscriptionNotifications';
|
34
33
|
import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
35
34
|
// @ts-ignore: No implicit Any
|
36
35
|
import { usePollViewToggle } from '../AppData/useSidepane';
|
37
36
|
// @ts-ignore: No implicit Any
|
38
|
-
import { useIsNotificationDisabled,
|
39
|
-
import {
|
37
|
+
import { useIsNotificationDisabled, useSubscribedNotifications } from '../AppData/useUISettings';
|
38
|
+
import { ROLE_CHANGE_DECLINED } from '../../common/constants';
|
40
39
|
|
41
40
|
const pollToastKey: Record<string, string> = {};
|
42
41
|
|
@@ -53,7 +52,6 @@ export function Notifications() {
|
|
53
52
|
const { showNotification } = useAwayNotifications();
|
54
53
|
const amIScreenSharing = useHMSStore(selectIsLocalScreenShared);
|
55
54
|
const logoURL = useRoomLayout()?.logo?.url;
|
56
|
-
const [toastId, setToastId] = useSetAppDataByKey(CAPTION_TOAST.captionToast);
|
57
55
|
|
58
56
|
const handleRoleChangeDenied = useCallback((request: HMSRoleChangeRequest & { peerName: string }) => {
|
59
57
|
ToastManager.addToast({
|
@@ -181,44 +179,6 @@ export function Notifications() {
|
|
181
179
|
});
|
182
180
|
}
|
183
181
|
break;
|
184
|
-
case HMSNotificationTypes.TRANSCRIPTION_STATE_UPDATED:
|
185
|
-
const transcriptionStates = notification.data;
|
186
|
-
if (transcriptionStates && transcriptionStates.length > 0) {
|
187
|
-
let id = '';
|
188
|
-
match({ state: transcriptionStates[0].state, error: transcriptionStates[0].error })
|
189
|
-
.when(
|
190
|
-
({ error }) => !!error,
|
191
|
-
() => {
|
192
|
-
ToastManager.removeToast(toastId);
|
193
|
-
id = ToastManager.addToast({
|
194
|
-
title: `Failed to enable Closed Caption`,
|
195
|
-
variant: 'error',
|
196
|
-
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
|
197
|
-
});
|
198
|
-
},
|
199
|
-
)
|
200
|
-
.with({ state: HMSTranscriptionState.STARTED }, () => {
|
201
|
-
ToastManager.removeToast(toastId);
|
202
|
-
id = ToastManager.addToast({
|
203
|
-
title: `Closed Captioning enabled for everyone`,
|
204
|
-
variant: 'standard',
|
205
|
-
duration: 2000,
|
206
|
-
icon: <OpenCaptionIcon style={{ marginRight: '0.5rem' }} />,
|
207
|
-
});
|
208
|
-
})
|
209
|
-
.with({ state: HMSTranscriptionState.STOPPED }, () => {
|
210
|
-
ToastManager.removeToast(toastId);
|
211
|
-
id = ToastManager.addToast({
|
212
|
-
title: `Closed Captioning disabled for everyone`,
|
213
|
-
variant: 'standard',
|
214
|
-
duration: 2000,
|
215
|
-
icon: <ClosedCaptionIcon style={{ marginRight: '0.5rem' }} />,
|
216
|
-
});
|
217
|
-
})
|
218
|
-
.otherwise(() => null);
|
219
|
-
setToastId(id);
|
220
|
-
}
|
221
|
-
break;
|
222
182
|
default:
|
223
183
|
break;
|
224
184
|
}
|
@@ -241,6 +201,7 @@ export function Notifications() {
|
|
241
201
|
<InitErrorModal />
|
242
202
|
<ChatNotifications />
|
243
203
|
<HandRaisedNotifications />
|
204
|
+
<TranscriptionNotifications />
|
244
205
|
</>
|
245
206
|
);
|
246
207
|
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import { match } from 'ts-pattern';
|
3
|
+
import { HMSNotificationTypes, HMSTranscriptionState, useHMSNotifications } from '@100mslive/react-sdk';
|
4
|
+
import { AlertTriangleIcon, ClosedCaptionIcon, OpenCaptionIcon } from '@100mslive/react-icons';
|
5
|
+
// @ts-ignore: No implicit Any
|
6
|
+
import { ToastManager } from '../Toast/ToastManager';
|
7
|
+
// @ts-ignore: No implicit Any
|
8
|
+
import { useSetAppDataByKey } from '../AppData/useUISettings';
|
9
|
+
import { CAPTION_TOAST } from '../../common/constants';
|
10
|
+
|
11
|
+
export const TranscriptionNotifications = () => {
|
12
|
+
const notification = useHMSNotifications(HMSNotificationTypes.TRANSCRIPTION_STATE_UPDATED);
|
13
|
+
const [toastId, setToastId] = useSetAppDataByKey(CAPTION_TOAST.captionToast);
|
14
|
+
|
15
|
+
useEffect(() => {
|
16
|
+
if (!notification?.data) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
|
20
|
+
console.debug(`[${notification.type}]`, notification);
|
21
|
+
const transcriptionStates = notification.data;
|
22
|
+
if (transcriptionStates.length > 0) {
|
23
|
+
let id = '';
|
24
|
+
match({ state: transcriptionStates[0].state, error: transcriptionStates[0].error })
|
25
|
+
.when(
|
26
|
+
({ error }) => !!error,
|
27
|
+
() => {
|
28
|
+
id = ToastManager.replaceToast(toastId, {
|
29
|
+
title: `Failed to enable Closed Caption`,
|
30
|
+
variant: 'error',
|
31
|
+
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
|
32
|
+
});
|
33
|
+
},
|
34
|
+
)
|
35
|
+
.with({ state: HMSTranscriptionState.STARTED }, () => {
|
36
|
+
id = ToastManager.replaceToast(toastId, {
|
37
|
+
title: `Closed Captioning enabled for everyone`,
|
38
|
+
variant: 'standard',
|
39
|
+
duration: 2000,
|
40
|
+
icon: <OpenCaptionIcon style={{ marginRight: '0.5rem' }} />,
|
41
|
+
});
|
42
|
+
})
|
43
|
+
.with({ state: HMSTranscriptionState.STOPPED }, () => {
|
44
|
+
id = ToastManager.replaceToast(toastId, {
|
45
|
+
title: `Closed Captioning disabled for everyone`,
|
46
|
+
variant: 'standard',
|
47
|
+
duration: 2000,
|
48
|
+
icon: <ClosedCaptionIcon style={{ marginRight: '0.5rem' }} />,
|
49
|
+
});
|
50
|
+
})
|
51
|
+
.otherwise(() => null);
|
52
|
+
setToastId(id);
|
53
|
+
}
|
54
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
55
|
+
}, [notification, setToastId]);
|
56
|
+
|
57
|
+
return null;
|
58
|
+
};
|