@snapcall/stream-ui 1.14.0 → 1.14.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.
@@ -13096,8 +13096,11 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
13096
13096
  setPlan(event.detail.plan);
13097
13097
  setPermissions(event.detail.permissions);
13098
13098
  setSelfPeerId(peerId);
13099
- setVideoRecording(event.detail.videoRecording);
13100
- if (event.detail.videoRecording.requested) (0, $a5146f9062d7bf28$export$3a57e165650c636f)(t("notifications.recording"), {
13099
+ setVideoRecording(event.detail.videoRecording || {
13100
+ requested: false,
13101
+ started: false
13102
+ });
13103
+ if (event.detail.videoRecording?.requested) (0, $a5146f9062d7bf28$export$3a57e165650c636f)(t("notifications.recording"), {
13101
13104
  duration: 11000,
13102
13105
  icon: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $4731637db263b767$export$d9f09da0f8d1c822), {}),
13103
13106
  messageStyle: {
package/dist/stream-ui.js CHANGED
@@ -13101,8 +13101,11 @@ const $ee8cb448c2c74888$var$StreamUI = ({ options: options })=>{
13101
13101
  setPlan(event.detail.plan);
13102
13102
  setPermissions(event.detail.permissions);
13103
13103
  setSelfPeerId(peerId);
13104
- setVideoRecording(event.detail.videoRecording);
13105
- if (event.detail.videoRecording.requested) (0, $84c6cbcbb594d072$export$3a57e165650c636f)(t("notifications.recording"), {
13104
+ setVideoRecording(event.detail.videoRecording || {
13105
+ requested: false,
13106
+ started: false
13107
+ });
13108
+ if (event.detail.videoRecording?.requested) (0, $84c6cbcbb594d072$export$3a57e165650c636f)(t("notifications.recording"), {
13106
13109
  duration: 11000,
13107
13110
  icon: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $24108d3063533819$export$d9f09da0f8d1c822), {}),
13108
13111
  messageStyle: {
@@ -2215,7 +2215,7 @@ and limitations under the License.
2215
2215
  font-weight: 500;
2216
2216
  font-size: 14px;
2217
2217
  font-family: 'Lato';
2218
- `,Zb=()=>{const{t:e}=Fi();return(0,a.jsx)($b,{children:(0,a.jsxs)(Kb,{children:[(0,a.jsx)(Wb,{}),(0,a.jsx)(Gb,{children:e("loader.connection")})]})})},Qb=(()=>{try{const e=localStorage.getItem("stream_ui_theme");return e||"dark"}catch(e){return console.warn(e),"dark"}})(),Yb=wi(),Jb=new sb;let Xb=-1;var ew=({options:e})=>{const{t:t}=Fi(),[n,i]=(0,je.useState)(void 0),o=(0,je.useRef)(null),s=(0,je.useRef)(null),c=(0,je.useRef)(null),[l,d]=(0,je.useState)(e.recorder?.enabled?"recorder":"loading"),[u,p]=(0,je.useState)(!1),[f,m]=(0,je.useState)(!1),[g,y]=(0,je.useState)(!1),[b,w]=(0,je.useState)(!1),[x,S]=(0,je.useState)(!1),[_,k]=(0,je.useState)(Qb),[C,E]=(0,je.useState)(e.language||Yb),[P,R]=(0,je.useState)({}),[T,j]=(0,je.useState)(!0),[O,M]=(0,je.useState)(!1),[L,D]=(0,je.useState)(!1),[I,A]=(0,je.useState)(!0),[N,F]=(0,je.useState)(!1),[z,B]=Tc(o.current),[U,V]=(0,je.useState)(!1),[H,q]=(0,je.useState)(!1),[W,$]=(0,je.useState)({requested:!1,started:!1}),[K,G]=(0,je.useState)(!1),[Z,Q]=(0,je.useState)([]),[Y,J]=(0,je.useState)(void 0),X=(z||window.screen.width)>(B||window.screen.height)?"landscape":"portrait",ee="dark"===_?Df:Lf,te=e=>{"localVideoAvailable"===e.type?M(!0):M(!1)},re=e=>{"screenshareEnabled"===e.type?D(!0):D(!1)},ne=e=>{"microphoneMute"===e.type?j(!0):j(!1)},ie=()=>{$({requested:!0,started:!0})},oe=()=>{$({requested:!1,started:!1})},ae=(0,je.useCallback)((()=>{$({requested:!0,started:!1}),G(!0),Ir(t("notifications.recording"),{duration:1e4,icon:(0,a.jsx)(zs,{}),messageStyle:{fontWeight:600}})}),[t]),se=e=>{const t=e.detail.label;Ir(`Connected to ${t}`,{duration:3e3,icon:(0,a.jsx)(Mc,{}),messageStyle:{fontWeight:600}})},ce=e=>{const{profile:t}=e.detail;R(t)},le=()=>{Wf(),d("ended"),j(!0),M(!1),D(!1),F(!1)},de=()=>{Wf(),d("terminated")},ue=()=>{d("expired")},pe=e=>{const{success:t,email:n}=e.detail;t?(A(!0),n&&h.identify(null,{email:n})):r(v)("An error occured while trying to join the room as an agent",{className:"error"})},he=e=>{const t=Date.now();"USERLIMIT"!==e.detail.code?-1!==Xb&&Xb+2e4>t||(Xb=t,Ir(`A critical error has occurred (error ${e.detail.code}).`,{icon:hd,button:{text:"Reload",action:()=>{window.location.reload()}},duration:2e4})):d("full")};return(0,je.useEffect)((()=>{try{localStorage.setItem("stream_ui_theme",_)}catch(e){console.warn(e)}}),[_]),(0,je.useEffect)((()=>{try{localStorage.setItem("stream_ui_language",C),Si.changeLanguage(C)}catch(e){console.warn(e)}}),[C]),(0,je.useEffect)((()=>(Qa.addEventListener("localVideoAvailable",te),Qa.addEventListener("localVideoUnavailable",te),Qa.addEventListener("screenshareEnabled",re),Qa.addEventListener("screenshareDisabled",re),Qa.addEventListener("microphoneEnabled",ne),Qa.addEventListener("microphoneMute",ne),Qa.addEventListener("microphoneUnmute",ne),Qa.addEventListener("defaultAudioDeviceChange",se),Qa.addEventListener("selfProfileUpdate",ce),Qa.addEventListener("terminateRoom",de),Qa.addEventListener("leaveRoom",le),Qa.addEventListener("invalidRoom",ue),Qa.addEventListener("agentIdentity",pe),Qa.addEventListener("criticalError",he),Qa.addEventListener("videoRecordingStarted",ie),Qa.addEventListener("videoRecordingStopped",oe),Qa.addEventListener("videoRecordingRequested",ae),()=>{Qa.removeEventListener("localVideoAvailable",te),Qa.removeEventListener("localVideoUnavailable",te),Qa.removeEventListener("screenshareEnabled",re),Qa.removeEventListener("screenshareDisabled",re),Qa.removeEventListener("microphoneEnabled",ne),Qa.removeEventListener("microphoneMute",ne),Qa.removeEventListener("microphoneUnmute",ne),Qa.removeEventListener("defaultAudioDeviceChange",se),Qa.removeEventListener("selfProfileUpdate",ce),Qa.removeEventListener("terminateRoom",de),Qa.removeEventListener("leaveRoom",le),Qa.removeEventListener("invalidRoom",ue),Qa.removeEventListener("agentIdentity",pe),Qa.removeEventListener("criticalError",he),Qa.removeEventListener("videoRecordingStarted",ie),Qa.removeEventListener("videoRecordingStopped",oe),Qa.removeEventListener("videoRecordingRequested",ae)})),[ae]),(0,je.useEffect)((()=>{const r=async r=>{const n=r.detail.peerId;if(J(r.detail.plan),Q(r.detail.permissions),i(n),$(r.detail.videoRecording),r.detail.videoRecording.requested&&Ir(t("notifications.recording"),{duration:11e3,icon:(0,a.jsx)(zs,{}),messageStyle:{fontWeight:600}}),!e.recorder?.enabled)try{e.headless||await $f(e),F(!0)}catch(e){V(!0),console.error("User interaction trigger failed",e)}finally{d("streaming")}};return Qa.addEventListener("enterRoom",r),()=>{Qa.removeEventListener("enterRoom",r)}}),[e,t]),(0,a.jsx)(fb,{client:Jb,children:(0,a.jsx)(Ya.Provider,{value:{videoRecording:W,setVideoRecording:$,headless:Boolean(e.headless),plan:Y,permissions:Z,selfPeerId:n,streamUIContainerRef:o,videosContainerRef:s,remoteTilesContainerRef:c,streamState:l,setStreamState:d,isQuickConnectPopupVisible:u,setIsQuickConnectPopupVisible:p,isSettingsMenuVisible:f,setIsSettingsMenuVisible:m,isYoutubePopupVisible:g,setIsYoutubePopupVisible:y,isLinksharePopupVisible:b,setIsLinksharePopupVisible:w,isVirtualBackgroundPopupVisible:x,setIsVirtualBackgroundPopupVisible:S,isBlockedFeaturePopupOpen:H,setBlockedFeaturePopupOpen:q,isRecordingStartPopupOpen:K,setRecordingStartPopupOpen:G,theme:_,setTheme:k,language:C,setLanguage:E,options:e,profile:P,muted:T,streaming:O,screensharing:L,isAgent:I,userInteractionTriggered:N,orientation:X},children:(0,a.jsxs)(ur,{theme:ee,children:[(0,a.jsx)(Kf,{}),(0,a.jsx)(If,{}),(0,a.jsxs)(Gf,{ref:o,children:["loading"===l&&(0,a.jsx)(Zb,{}),(0,a.jsx)(Mf,{}),(0,a.jsx)(Cc,{}),U&&(0,a.jsx)(Uf,{close:()=>{F(!0),V(!1)}}),"recorder"===l&&(0,a.jsx)(qb,{}),("streaming"===l||"loading"===l)&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(ns,{children:[(0,a.jsx)(Rc,{}),(0,a.jsx)(bd,{}),(0,a.jsx)(Ud,{}),(0,a.jsx)(bf,{})]})}),("ended"===l||"terminated"===l||"full"===l||"expired"===l)&&(0,a.jsx)(Cf,{})]})]})})})};window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments)};je=o("85Hg2");var tw=()=>(0,a.jsx)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsxs)("g",{clipPath:"url(#greetingSnapcallLogo)",children:[(0,a.jsx)("path",{d:"M0 36C0 6.354 6.354 0 36 0s36 6.354 36 36-6.354 36-36 36S0 65.646 0 36Z",fill:"#000"}),(0,a.jsx)("path",{d:"M36.225 57.428c2.367 0 4.35-1.964 3.62-4.215a13.38 13.38 0 0 0-3.133-5.203c-2.432-2.498-5.73-3.902-9.17-3.902-3.44 0-6.74 1.404-9.172 3.902a13.381 13.381 0 0 0-3.132 5.203c-.731 2.25 1.252 4.215 3.62 4.215h17.367ZM35.775 14.572c-2.367 0-4.35 1.965-3.62 4.216a13.381 13.381 0 0 0 3.133 5.203c2.432 2.498 5.73 3.901 9.17 3.901 3.44 0 6.74-1.403 9.172-3.901a13.375 13.375 0 0 0 3.132-5.203c.731-2.252-1.252-4.216-3.62-4.216H35.776ZM44.459 53.143c0 2.367 1.971 4.352 4.204 3.566a12.924 12.924 0 0 0 4.967-3.182c2.432-2.498 3.799-5.886 3.799-9.419 0-3.533-1.367-6.921-3.8-9.42a12.923 12.923 0 0 0-4.966-3.181c-2.233-.786-4.204 1.2-4.204 3.566v18.07ZM27.541 18.857c0-2.367-1.971-4.352-4.204-3.566a12.923 12.923 0 0 0-4.967 3.182c-2.432 2.498-3.799 5.886-3.799 9.42 0 3.532 1.367 6.92 3.8 9.418a12.923 12.923 0 0 0 4.966 3.182c2.233.786 4.204-1.2 4.204-3.566v-18.07Z",fill:"#fff"})]})});const rw=yr.div`
2218
+ `,Zb=()=>{const{t:e}=Fi();return(0,a.jsx)($b,{children:(0,a.jsxs)(Kb,{children:[(0,a.jsx)(Wb,{}),(0,a.jsx)(Gb,{children:e("loader.connection")})]})})},Qb=(()=>{try{const e=localStorage.getItem("stream_ui_theme");return e||"dark"}catch(e){return console.warn(e),"dark"}})(),Yb=wi(),Jb=new sb;let Xb=-1;var ew=({options:e})=>{const{t:t}=Fi(),[n,i]=(0,je.useState)(void 0),o=(0,je.useRef)(null),s=(0,je.useRef)(null),c=(0,je.useRef)(null),[l,d]=(0,je.useState)(e.recorder?.enabled?"recorder":"loading"),[u,p]=(0,je.useState)(!1),[f,m]=(0,je.useState)(!1),[g,y]=(0,je.useState)(!1),[b,w]=(0,je.useState)(!1),[x,S]=(0,je.useState)(!1),[_,k]=(0,je.useState)(Qb),[C,E]=(0,je.useState)(e.language||Yb),[P,R]=(0,je.useState)({}),[T,j]=(0,je.useState)(!0),[O,M]=(0,je.useState)(!1),[L,D]=(0,je.useState)(!1),[I,A]=(0,je.useState)(!0),[N,F]=(0,je.useState)(!1),[z,B]=Tc(o.current),[U,V]=(0,je.useState)(!1),[H,q]=(0,je.useState)(!1),[W,$]=(0,je.useState)({requested:!1,started:!1}),[K,G]=(0,je.useState)(!1),[Z,Q]=(0,je.useState)([]),[Y,J]=(0,je.useState)(void 0),X=(z||window.screen.width)>(B||window.screen.height)?"landscape":"portrait",ee="dark"===_?Df:Lf,te=e=>{"localVideoAvailable"===e.type?M(!0):M(!1)},re=e=>{"screenshareEnabled"===e.type?D(!0):D(!1)},ne=e=>{"microphoneMute"===e.type?j(!0):j(!1)},ie=()=>{$({requested:!0,started:!0})},oe=()=>{$({requested:!1,started:!1})},ae=(0,je.useCallback)((()=>{$({requested:!0,started:!1}),G(!0),Ir(t("notifications.recording"),{duration:1e4,icon:(0,a.jsx)(zs,{}),messageStyle:{fontWeight:600}})}),[t]),se=e=>{const t=e.detail.label;Ir(`Connected to ${t}`,{duration:3e3,icon:(0,a.jsx)(Mc,{}),messageStyle:{fontWeight:600}})},ce=e=>{const{profile:t}=e.detail;R(t)},le=()=>{Wf(),d("ended"),j(!0),M(!1),D(!1),F(!1)},de=()=>{Wf(),d("terminated")},ue=()=>{d("expired")},pe=e=>{const{success:t,email:n}=e.detail;t?(A(!0),n&&h.identify(null,{email:n})):r(v)("An error occured while trying to join the room as an agent",{className:"error"})},he=e=>{const t=Date.now();"USERLIMIT"!==e.detail.code?-1!==Xb&&Xb+2e4>t||(Xb=t,Ir(`A critical error has occurred (error ${e.detail.code}).`,{icon:hd,button:{text:"Reload",action:()=>{window.location.reload()}},duration:2e4})):d("full")};return(0,je.useEffect)((()=>{try{localStorage.setItem("stream_ui_theme",_)}catch(e){console.warn(e)}}),[_]),(0,je.useEffect)((()=>{try{localStorage.setItem("stream_ui_language",C),Si.changeLanguage(C)}catch(e){console.warn(e)}}),[C]),(0,je.useEffect)((()=>(Qa.addEventListener("localVideoAvailable",te),Qa.addEventListener("localVideoUnavailable",te),Qa.addEventListener("screenshareEnabled",re),Qa.addEventListener("screenshareDisabled",re),Qa.addEventListener("microphoneEnabled",ne),Qa.addEventListener("microphoneMute",ne),Qa.addEventListener("microphoneUnmute",ne),Qa.addEventListener("defaultAudioDeviceChange",se),Qa.addEventListener("selfProfileUpdate",ce),Qa.addEventListener("terminateRoom",de),Qa.addEventListener("leaveRoom",le),Qa.addEventListener("invalidRoom",ue),Qa.addEventListener("agentIdentity",pe),Qa.addEventListener("criticalError",he),Qa.addEventListener("videoRecordingStarted",ie),Qa.addEventListener("videoRecordingStopped",oe),Qa.addEventListener("videoRecordingRequested",ae),()=>{Qa.removeEventListener("localVideoAvailable",te),Qa.removeEventListener("localVideoUnavailable",te),Qa.removeEventListener("screenshareEnabled",re),Qa.removeEventListener("screenshareDisabled",re),Qa.removeEventListener("microphoneEnabled",ne),Qa.removeEventListener("microphoneMute",ne),Qa.removeEventListener("microphoneUnmute",ne),Qa.removeEventListener("defaultAudioDeviceChange",se),Qa.removeEventListener("selfProfileUpdate",ce),Qa.removeEventListener("terminateRoom",de),Qa.removeEventListener("leaveRoom",le),Qa.removeEventListener("invalidRoom",ue),Qa.removeEventListener("agentIdentity",pe),Qa.removeEventListener("criticalError",he),Qa.removeEventListener("videoRecordingStarted",ie),Qa.removeEventListener("videoRecordingStopped",oe),Qa.removeEventListener("videoRecordingRequested",ae)})),[ae]),(0,je.useEffect)((()=>{const r=async r=>{const n=r.detail.peerId;if(J(r.detail.plan),Q(r.detail.permissions),i(n),$(r.detail.videoRecording||{requested:!1,started:!1}),r.detail.videoRecording?.requested&&Ir(t("notifications.recording"),{duration:11e3,icon:(0,a.jsx)(zs,{}),messageStyle:{fontWeight:600}}),!e.recorder?.enabled)try{e.headless||await $f(e),F(!0)}catch(e){V(!0),console.error("User interaction trigger failed",e)}finally{d("streaming")}};return Qa.addEventListener("enterRoom",r),()=>{Qa.removeEventListener("enterRoom",r)}}),[e,t]),(0,a.jsx)(fb,{client:Jb,children:(0,a.jsx)(Ya.Provider,{value:{videoRecording:W,setVideoRecording:$,headless:Boolean(e.headless),plan:Y,permissions:Z,selfPeerId:n,streamUIContainerRef:o,videosContainerRef:s,remoteTilesContainerRef:c,streamState:l,setStreamState:d,isQuickConnectPopupVisible:u,setIsQuickConnectPopupVisible:p,isSettingsMenuVisible:f,setIsSettingsMenuVisible:m,isYoutubePopupVisible:g,setIsYoutubePopupVisible:y,isLinksharePopupVisible:b,setIsLinksharePopupVisible:w,isVirtualBackgroundPopupVisible:x,setIsVirtualBackgroundPopupVisible:S,isBlockedFeaturePopupOpen:H,setBlockedFeaturePopupOpen:q,isRecordingStartPopupOpen:K,setRecordingStartPopupOpen:G,theme:_,setTheme:k,language:C,setLanguage:E,options:e,profile:P,muted:T,streaming:O,screensharing:L,isAgent:I,userInteractionTriggered:N,orientation:X},children:(0,a.jsxs)(ur,{theme:ee,children:[(0,a.jsx)(Kf,{}),(0,a.jsx)(If,{}),(0,a.jsxs)(Gf,{ref:o,children:["loading"===l&&(0,a.jsx)(Zb,{}),(0,a.jsx)(Mf,{}),(0,a.jsx)(Cc,{}),U&&(0,a.jsx)(Uf,{close:()=>{F(!0),V(!1)}}),"recorder"===l&&(0,a.jsx)(qb,{}),("streaming"===l||"loading"===l)&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(ns,{children:[(0,a.jsx)(Rc,{}),(0,a.jsx)(bd,{}),(0,a.jsx)(Ud,{}),(0,a.jsx)(bf,{})]})}),("ended"===l||"terminated"===l||"full"===l||"expired"===l)&&(0,a.jsx)(Cf,{})]})]})})})};window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments)};je=o("85Hg2");var tw=()=>(0,a.jsx)("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsxs)("g",{clipPath:"url(#greetingSnapcallLogo)",children:[(0,a.jsx)("path",{d:"M0 36C0 6.354 6.354 0 36 0s36 6.354 36 36-6.354 36-36 36S0 65.646 0 36Z",fill:"#000"}),(0,a.jsx)("path",{d:"M36.225 57.428c2.367 0 4.35-1.964 3.62-4.215a13.38 13.38 0 0 0-3.133-5.203c-2.432-2.498-5.73-3.902-9.17-3.902-3.44 0-6.74 1.404-9.172 3.902a13.381 13.381 0 0 0-3.132 5.203c-.731 2.25 1.252 4.215 3.62 4.215h17.367ZM35.775 14.572c-2.367 0-4.35 1.965-3.62 4.216a13.381 13.381 0 0 0 3.133 5.203c2.432 2.498 5.73 3.901 9.17 3.901 3.44 0 6.74-1.403 9.172-3.901a13.375 13.375 0 0 0 3.132-5.203c.731-2.252-1.252-4.216-3.62-4.216H35.776ZM44.459 53.143c0 2.367 1.971 4.352 4.204 3.566a12.924 12.924 0 0 0 4.967-3.182c2.432-2.498 3.799-5.886 3.799-9.419 0-3.533-1.367-6.921-3.8-9.42a12.923 12.923 0 0 0-4.966-3.181c-2.233-.786-4.204 1.2-4.204 3.566v18.07ZM27.541 18.857c0-2.367-1.971-4.352-4.204-3.566a12.923 12.923 0 0 0-4.967 3.182c-2.432 2.498-3.799 5.886-3.799 9.42 0 3.532 1.367 6.92 3.8 9.418a12.923 12.923 0 0 0 4.966 3.182c2.233.786 4.204-1.2 4.204-3.566v-18.07Z",fill:"#fff"})]})});const rw=yr.div`
2219
2219
  height: 100%;
2220
2220
  display: flex;
2221
2221
  flex-direction: column;
package/dist/types.d.ts CHANGED
@@ -168,7 +168,7 @@ declare global {
168
168
  export type SnapcallEvent<T> = CustomEvent<T>;
169
169
  export type PeersInfoEvent = SnapcallEvent<{
170
170
  videoRecordStarted: boolean;
171
- videoRecording: {
171
+ videoRecording?: {
172
172
  requested: boolean;
173
173
  started: boolean;
174
174
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcall/stream-ui",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/stream-ui.js",