@snapcall/stream-ui 1.9.0 → 1.10.0

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/stream-ui.js CHANGED
@@ -333,6 +333,9 @@ const $393bda1b33846dfc$export$604ba5624273df44 = ()=>{
333
333
  const $91fcbf58e59aae79$export$84584c2a98eb6753 = {
334
334
  name: "English",
335
335
  translation: {
336
+ header: {
337
+ free: "Free version"
338
+ },
336
339
  notifications: {
337
340
  screensharingError: "An error occured when trying to toggle screensharing",
338
341
  microphoneError: "An error occured when trying to toggle the microphone",
@@ -364,6 +367,14 @@ const $91fcbf58e59aae79$export$84584c2a98eb6753 = {
364
367
  pictureInPicture: "Picture-in-Picture",
365
368
  screenSharing: "Screen sharing"
366
369
  },
370
+ blockedFeature: {
371
+ titleConnected: "Upgrade to Pro",
372
+ titleGuest: "Feature not available",
373
+ descriptionConnected: "On a free plan, you can't use this feature. Upgrade your plan to enjoy all in-call features.",
374
+ descriptionGuest: "You are participating in a call created with a free version of SnapCall. This feature is only available with a Pro version.",
375
+ dismissGuest: "Okay",
376
+ dismissConnected: "Upgrade to Pro"
377
+ },
367
378
  copyLink: {
368
379
  title: "Copy link",
369
380
  description: "Copy link into clipboard",
@@ -473,6 +484,9 @@ const $91fcbf58e59aae79$export$84584c2a98eb6753 = {
473
484
  const $e52ca91c2b296e41$export$acb2a88f7d552ebf = {
474
485
  name: "Fran\xe7ais",
475
486
  translation: {
487
+ header: {
488
+ free: "Version gratuite"
489
+ },
476
490
  notifications: {
477
491
  screensharingError: "Une erreur est survenue pendant l'activation du partage d'\xe9cran",
478
492
  microphoneError: "Une erreur est survenue pendant l'activation du micro",
@@ -504,6 +518,14 @@ const $e52ca91c2b296e41$export$acb2a88f7d552ebf = {
504
518
  pictureInPicture: "Picture-in-Picture",
505
519
  screenSharing: "Partage d'\xe9cran"
506
520
  },
521
+ blockedFeature: {
522
+ titleConnected: "Souscrire au plan Pro",
523
+ titleGuest: "Fonctionnalit\xe9 non disponible",
524
+ descriptionConnected: "Vous n'avez pas acc\xe8s \xe0 cette fonctionnalit\xe9. Souscrivez au plan Pro pour d\xe9bloquer toutes les fonctionnalit\xe9s de SnapCall.",
525
+ descriptionGuest: "Vous participez \xe0 un appel cr\xe9\xe9 avec la version gratuite de SnapCall. Cette fonctionnalit\xe9 n'est disponible qu'avec une version Pro.",
526
+ dismissGuest: "D'accord",
527
+ dismissConnected: "Souscrire \xe0 Pro"
528
+ },
507
529
  copyLink: {
508
530
  title: "Copier le lien",
509
531
  description: "Copier le lien dans le presse-papiers",
@@ -613,6 +635,9 @@ const $e52ca91c2b296e41$export$acb2a88f7d552ebf = {
613
635
  const $e0ae3d23c2381da3$export$3486a10f30cf1ee4 = {
614
636
  name: "Italiano",
615
637
  translation: {
638
+ header: {
639
+ free: "Versione gratuita"
640
+ },
616
641
  notifications: {
617
642
  screensharingError: "Si \xe8 verificato un errore durante l'attivazione della condivisione dello schermo",
618
643
  microphoneError: "Si \xe8 verificato un errore durante l'attivazione del microfono",
@@ -644,6 +669,14 @@ const $e0ae3d23c2381da3$export$3486a10f30cf1ee4 = {
644
669
  pictureInPicture: "Immagine nell'immagine",
645
670
  screenSharing: "Condivisione dello schermo"
646
671
  },
672
+ blockedFeature: {
673
+ titleConnected: "L'aggiornamento a Pro",
674
+ titleGuest: "Funzione non disponibile",
675
+ descriptionConnected: "Su un piano gratuito, non puoi utilizzare questa funzione. Aggiorna il tuo piano per usufruire di tutte le funzionalit\xe0 in chiamata.",
676
+ descriptionGuest: "Stai partecipando a una chiamata creata con una versione gratuita di SnapCall. Questa funzione \xe8 disponibile solo con una versione Pro.",
677
+ dismissGuest: "Okay",
678
+ dismissConnected: "L'aggiornamento a Pro"
679
+ },
647
680
  copyLink: {
648
681
  title: "Copia il link",
649
682
  description: "Copia il link negli appunti",
@@ -779,6 +812,8 @@ var $b45c0bcc142f0b5e$export$2e2bcd8739ae039 = (0, ($parcel$interopDefault($jQDc
779
812
 
780
813
 
781
814
 
815
+
816
+
782
817
  const $d0c6baf97675ab49$var$LogLevel = {
783
818
  error: 1,
784
819
  warn: 2,
@@ -1413,6 +1448,8 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1413
1448
  pendingDeviceRequest = {};
1414
1449
  joinOptions = {};
1415
1450
  devicesList = [];
1451
+ plan = undefined;
1452
+ permissions = [];
1416
1453
  constructor(){
1417
1454
  super();
1418
1455
  navigator.mediaDevices.addEventListener("devicechange", ()=>this.onDeviceChange());
@@ -1536,7 +1573,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1536
1573
  if (!this.peerId) this.peerId = (0, $jQDcL$uuid.v4)();
1537
1574
  let url;
1538
1575
  try {
1539
- const { instanceId: instanceId } = await fetch(`${this.config.streamerApi}/instance/${this.roomId}`, {
1576
+ const { streamer_instance: instanceId , plan: { permissions: permissions , name: name } , } = await fetch(`${this.config.apiUrl}/streams/${room}/info`, {
1540
1577
  method: "get",
1541
1578
  headers: {
1542
1579
  "Content-Type": "application/json"
@@ -1545,6 +1582,8 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1545
1582
  if (response.ok) return response.json();
1546
1583
  throw new Error("Invalid room ID");
1547
1584
  });
1585
+ this.permissions = permissions;
1586
+ this.plan = name;
1548
1587
  url = `${this.config.streamerServer}/${instanceId}/?roomId=${room}&peerId=${this.peerId}`;
1549
1588
  } catch (roomError) {
1550
1589
  const event = new $1dedebd5ff3002eb$var$SnapcallEvent("invalidRoom", {
@@ -1814,7 +1853,9 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1814
1853
  peerId: peer.id || peer.peerId
1815
1854
  };
1816
1855
  }),
1817
- callId: callId
1856
+ callId: callId,
1857
+ plan: this.plan,
1858
+ permissions: this.permissions
1818
1859
  }
1819
1860
  }));
1820
1861
  $1dedebd5ff3002eb$var$log.log("joinRoom", "peers", peers);
@@ -2134,6 +2175,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2134
2175
  this.mediaPipeOption = options;
2135
2176
  }
2136
2177
  async initVideoBackground() {
2178
+ if (!this.permissions.find((permission)=>permission === "virtual_background")) throw new Error("feature not allowed");
2137
2179
  if (this.useVideoBackground === true) return;
2138
2180
  this.useVideoBackground = true;
2139
2181
  if (!this.webcamProducer || this.webcamProducer.closed) return;
@@ -2310,6 +2352,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2310
2352
  this.dispatchEvent(event);
2311
2353
  }
2312
2354
  async enableScreenshare() {
2355
+ if (!this.permissions.find((permission)=>permission === "screen_sharing")) throw new Error("feature not allowed");
2313
2356
  const stream = await this.handleGetUserMediaError("screen", navigator.mediaDevices.getDisplayMedia({
2314
2357
  audio: false,
2315
2358
  video: {
@@ -2402,11 +2445,13 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2402
2445
  } else $1dedebd5ff3002eb$var$log.error("requestVideo", `Video consumer ${consumer} not found`);
2403
2446
  }
2404
2447
  async captureVideo(videoElement) {
2405
- let image;
2406
- if (videoElement) image = await (0, $3575c8a563f2a1da$export$674c90a250a8b2c5)(videoElement);
2407
- else if (this.webcamProducer && this.webcamProducer.track) image = await (0, $3575c8a563f2a1da$export$4a210166cc9cb64b)(this.webcamProducer.track);
2408
- else throw new Error("no video to capture");
2409
- return image;
2448
+ if (this.permissions.find((permission)=>permission === "instant_picture")) {
2449
+ let image;
2450
+ if (videoElement) image = await (0, $3575c8a563f2a1da$export$674c90a250a8b2c5)(videoElement);
2451
+ else if (this.webcamProducer && this.webcamProducer.track) image = await (0, $3575c8a563f2a1da$export$4a210166cc9cb64b)(this.webcamProducer.track);
2452
+ else throw new Error("no video to capture");
2453
+ return image;
2454
+ } else throw new Error("feature not allowed");
2410
2455
  }
2411
2456
  requestLocalVideo(element) {
2412
2457
  $1dedebd5ff3002eb$var$log.info("requestLocalVideo");
@@ -2524,6 +2569,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2524
2569
  this.dispatchEvent(event);
2525
2570
  }
2526
2571
  async requestPeerDevice(remotePeerId, deviceType) {
2572
+ if (!this.permissions.find((permission)=>permission === "request_input")) throw new Error("feature not allowed");
2527
2573
  return this.protoo.request("requestPeerDevice", {
2528
2574
  remotePeerId: remotePeerId,
2529
2575
  deviceType: deviceType
@@ -2692,6 +2738,9 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2692
2738
  ...config
2693
2739
  };
2694
2740
  }
2741
+ getPermissions() {
2742
+ return this.permissions;
2743
+ }
2695
2744
  }
2696
2745
 
2697
2746
 
@@ -3171,7 +3220,7 @@ const $1949f8f101c8cf77$export$4dc2e6a0e59ffa13 = (0, ($parcel$interopDefault($j
3171
3220
  font-size: 16px;
3172
3221
  font-weight: 300;
3173
3222
  line-height: 16px;
3174
- color: #fff;
3223
+ color: rgba(255, 255, 255, 0.5);
3175
3224
  margin-left: 5px;
3176
3225
  position: relative;
3177
3226
  bottom: 1px;
@@ -3546,7 +3595,7 @@ const $e1930b467e7d8845$var$multiPiP = new (0, $21395e477f83709c$export$45fabd1c
3546
3595
  const $e1930b467e7d8845$var$browser = $jQDcL$bowser.parse(window.navigator.userAgent);
3547
3596
  const $e1930b467e7d8845$var$Header = ()=>{
3548
3597
  const { t: t } = (0, $jQDcL$reacti18next.useTranslation)();
3549
- const { setIsQuickConnectPopupVisible: setIsQuickConnectPopupVisible , setIsSettingsMenuVisible: setIsSettingsMenuVisible , setIsVirtualBackgroundPopupVisible: setIsVirtualBackgroundPopupVisible , options: options , muted: muted , streaming: streaming , } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
3598
+ const { setIsQuickConnectPopupVisible: setIsQuickConnectPopupVisible , setIsSettingsMenuVisible: setIsSettingsMenuVisible , setIsVirtualBackgroundPopupVisible: setIsVirtualBackgroundPopupVisible , options: options , muted: muted , streaming: streaming , permissions: permissions , plan: plan , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
3550
3599
  const { streams: streams } = (0, $3f6e908c45fcc5b3$export$b5633a7cfbe42d9f)();
3551
3600
  const [extraOptions, setExtraOptions] = (0, $jQDcL$react.useState)(options.extraSettingsOptions || []);
3552
3601
  const onSetExtraSettingsOptions = (event)=>{
@@ -3594,14 +3643,17 @@ const $e1930b467e7d8845$var$Header = ()=>{
3594
3643
  (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).endCall();
3595
3644
  };
3596
3645
  const onScanQuickConnectClick = ()=>{
3597
- setIsQuickConnectPopupVisible(true);
3598
- (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("quickConnectClick");
3646
+ if (permissions.find((permission)=>permission === "quick_connect")) {
3647
+ setIsQuickConnectPopupVisible(true);
3648
+ (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("quickConnectClick");
3649
+ } else setBlockedFeaturePopupOpen(true);
3599
3650
  };
3600
3651
  const onSettingsMenuClick = ()=>{
3601
3652
  setIsSettingsMenuVisible(true);
3602
3653
  };
3603
3654
  const onVirtualBackgroundClick = ()=>{
3604
- setIsVirtualBackgroundPopupVisible(true);
3655
+ if (permissions.find((permission)=>permission === "virtual_background")) setIsVirtualBackgroundPopupVisible(true);
3656
+ else setBlockedFeaturePopupOpen(true);
3605
3657
  };
3606
3658
  const computedCategories = [
3607
3659
  {
@@ -3658,13 +3710,15 @@ const $e1930b467e7d8845$var$Header = ()=>{
3658
3710
  });
3659
3711
  return computedCategories;
3660
3712
  }, [
3713
+ t,
3714
+ options.sharedURL,
3661
3715
  muted,
3662
3716
  streaming,
3663
- options.sharedURL,
3717
+ permissions,
3664
3718
  setIsQuickConnectPopupVisible,
3719
+ setBlockedFeaturePopupOpen,
3665
3720
  setIsSettingsMenuVisible,
3666
- setIsVirtualBackgroundPopupVisible,
3667
- t,
3721
+ setIsVirtualBackgroundPopupVisible,
3668
3722
  ]);
3669
3723
  return /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsxs)((0, $1949f8f101c8cf77$export$1e86fd0e1db89578), {
3670
3724
  children: [
@@ -3674,7 +3728,10 @@ const $e1930b467e7d8845$var$Header = ()=>{
3674
3728
  size: options.logo?.size
3675
3729
  }),
3676
3730
  options.logo?.text && /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $1949f8f101c8cf77$export$4dc2e6a0e59ffa13), {
3677
- children: options.logo.text
3731
+ children: options.logo?.text
3732
+ }),
3733
+ plan === "individual" && /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $1949f8f101c8cf77$export$4dc2e6a0e59ffa13), {
3734
+ children: `${options.logo?.text ? " \xb7 " : ""}${t("header.free")}`
3678
3735
  })
3679
3736
  ]
3680
3737
  }),
@@ -4510,7 +4567,7 @@ const $07e749066c746c7c$var$StreamTile = ({ stream: stream , width: width = 0 ,
4510
4567
  const [requestingDevice, setRequestingDevice] = (0, $jQDcL$react.useState)(null);
4511
4568
  const [flashAnimation, setFlashAnimation] = (0, $jQDcL$react.useState)(false);
4512
4569
  const requestingDeviceTimeoutRef = (0, $jQDcL$react.useRef)(null);
4513
- const { selfPeerId: selfPeerId } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
4570
+ const { selfPeerId: selfPeerId , permissions: permissions , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
4514
4571
  const { highlightedTile: highlightedTile } = (0, $3f6e908c45fcc5b3$export$b5633a7cfbe42d9f)();
4515
4572
  const isSharingScreen = highlightedTile?.type === "screenshare" && highlightedTile.peerId === selfPeerId;
4516
4573
  const microphoneActive = stream.microphone && !stream.muted;
@@ -4522,16 +4579,22 @@ const $07e749066c746c7c$var$StreamTile = ({ stream: stream , width: width = 0 ,
4522
4579
  const onMouseEnter = ()=>setHover(true);
4523
4580
  const onMouseLeave = ()=>setHover(false);
4524
4581
  const requestMicrophone = ()=>{
4525
- (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "microphone");
4526
- setRequestingDevice("microphone");
4582
+ if (permissions.find((permission)=>permission === "request_input")) {
4583
+ (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "microphone");
4584
+ setRequestingDevice("microphone");
4585
+ } else setBlockedFeaturePopupOpen(true);
4527
4586
  };
4528
4587
  const requestWebcam = ()=>{
4529
- (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "webcam");
4530
- setRequestingDevice("webcam");
4588
+ if (permissions.find((permission)=>permission === "request_input")) {
4589
+ (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "webcam");
4590
+ setRequestingDevice("webcam");
4591
+ } else setBlockedFeaturePopupOpen(true);
4531
4592
  };
4532
4593
  const requestScreen = ()=>{
4533
- (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "screen");
4534
- setRequestingDevice("screen");
4594
+ if (permissions.find((permission)=>permission === "request_input")) {
4595
+ (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "screen");
4596
+ setRequestingDevice("screen");
4597
+ } else setBlockedFeaturePopupOpen(true);
4535
4598
  };
4536
4599
  (0, $jQDcL$react.useEffect)(()=>{
4537
4600
  if (!videoElementRef.current) throw new Error("videoElementRef not available");
@@ -5169,7 +5232,7 @@ const $8393b5c887e16c8c$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
5169
5232
  const videoElementRef = (0, $jQDcL$react.useRef)(null);
5170
5233
  const videoMediaProviderRef = (0, $jQDcL$react.useRef)(null);
5171
5234
  const SelfTileRef = (0, $jQDcL$react.useRef)(null);
5172
- const { videosContainerRef: videosContainerRef , remoteTilesContainerRef: remoteTilesContainerRef , profile: profile , muted: muted , streaming: streaming , orientation: orientation , options: options , } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
5235
+ const { videosContainerRef: videosContainerRef , remoteTilesContainerRef: remoteTilesContainerRef , profile: profile , muted: muted , streaming: streaming , orientation: orientation , options: options , permissions: permissions , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
5173
5236
  const { streams: streams } = (0, $3f6e908c45fcc5b3$export$b5633a7cfbe42d9f)();
5174
5237
  const [containerWidth, containerHeight] = (0, $56e1e7a85d8bf4bb$export$2b86bedf890eab8)(videosContainerRef.current);
5175
5238
  const cursor = streaming && !extended ? "pointer" : "default";
@@ -5213,42 +5276,44 @@ const $8393b5c887e16c8c$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
5213
5276
  }
5214
5277
  };
5215
5278
  const onSnapshotClick = async ()=>{
5216
- if (!snapshotAnimation && !snapshotImage) {
5217
- if (!videoElementRef.current) throw new Error("Video element is not available");
5218
- setSnapshotAnimation(true);
5219
- const base64Image = await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).captureVideo(videoElementRef.current);
5220
- setSnapshotImage(base64Image);
5221
- try {
5222
- const { objectUrl: objectUrl } = await fetch(`${options.streamApiURL}/uploadSnapshot`, {
5223
- method: "POST",
5224
- body: JSON.stringify({
5225
- file: base64Image
5226
- })
5227
- }).then((rawResponse)=>rawResponse.json());
5228
- await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).sendCustomMessageToAll({
5229
- type: "snapshot",
5230
- imageSrc: objectUrl
5231
- });
5232
- let notificationMessage = t("snapshot.sentToUsers");
5233
- if (streams.length === 1) {
5234
- const userName = streams[0].profile.name || t("misc.user");
5235
- notificationMessage = t("snapshot.sentToUser", {
5236
- user: userName
5279
+ if (permissions.find((permission)=>permission === "instant_picture")) {
5280
+ if (!snapshotAnimation && !snapshotImage) {
5281
+ if (!videoElementRef.current) throw new Error("Video element is not available");
5282
+ setSnapshotAnimation(true);
5283
+ const base64Image = await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).captureVideo(videoElementRef.current);
5284
+ setSnapshotImage(base64Image);
5285
+ try {
5286
+ const { objectUrl: objectUrl } = await fetch(`${options.streamApiURL}/uploadSnapshot`, {
5287
+ method: "POST",
5288
+ body: JSON.stringify({
5289
+ file: base64Image
5290
+ })
5291
+ }).then((rawResponse)=>rawResponse.json());
5292
+ await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).sendCustomMessageToAll({
5293
+ type: "snapshot",
5294
+ imageSrc: objectUrl
5295
+ });
5296
+ let notificationMessage = t("snapshot.sentToUsers");
5297
+ if (streams.length === 1) {
5298
+ const userName = streams[0].profile.name || t("misc.user");
5299
+ notificationMessage = t("snapshot.sentToUser", {
5300
+ user: userName
5301
+ });
5302
+ }
5303
+ (0, $84c6cbcbb594d072$export$3a57e165650c636f)(notificationMessage, {
5304
+ icon: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $2c45d365ee8aa1ab$export$26fe7ec9351ff761), {
5305
+ src: base64Image
5306
+ }),
5307
+ duration: 2500
5237
5308
  });
5309
+ } catch (sendMessageError) {
5310
+ (0, ($parcel$interopDefault($jQDcL$reacthottoast)))(t("snapshot.error"), {
5311
+ className: "error"
5312
+ });
5313
+ console.error(sendMessageError);
5238
5314
  }
5239
- (0, $84c6cbcbb594d072$export$3a57e165650c636f)(notificationMessage, {
5240
- icon: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $2c45d365ee8aa1ab$export$26fe7ec9351ff761), {
5241
- src: base64Image
5242
- }),
5243
- duration: 2500
5244
- });
5245
- } catch (sendMessageError) {
5246
- (0, ($parcel$interopDefault($jQDcL$reacthottoast)))(t("snapshot.error"), {
5247
- className: "error"
5248
- });
5249
- console.error(sendMessageError);
5250
5315
  }
5251
- }
5316
+ } else setBlockedFeaturePopupOpen(true);
5252
5317
  };
5253
5318
  const onDeviceRequest = (event)=>{
5254
5319
  const { peerId: peerId , deviceType: deviceType } = event.detail;
@@ -6788,7 +6853,7 @@ const $9dfd9e2286cffa66$var$HighlightButton = ()=>{
6788
6853
  const { t: t } = (0, $jQDcL$reacti18next.useTranslation)();
6789
6854
  const highlightMenuRef = (0, $jQDcL$react.useRef)(null);
6790
6855
  const [isHighlightMenuOpen, setIsHighlightMenuOpen] = (0, $jQDcL$react.useState)(false);
6791
- const { setIsYoutubePopupVisible: setIsYoutubePopupVisible , setIsLinksharePopupVisible: setIsLinksharePopupVisible , selfPeerId: selfPeerId } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
6856
+ const { setIsYoutubePopupVisible: setIsYoutubePopupVisible , setIsLinksharePopupVisible: setIsLinksharePopupVisible , selfPeerId: selfPeerId , permissions: permissions , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
6792
6857
  const { highlightedTile: highlightedTile , dispatch: dispatch } = (0, $3f6e908c45fcc5b3$export$b5633a7cfbe42d9f)();
6793
6858
  const isPresenting = Boolean(highlightedTile?.isGlobal && highlightedTile?.peerId === selfPeerId);
6794
6859
  (0, $326cea7dbbcb019a$export$71b2224f1ce5e08e)(highlightMenuRef, ()=>setIsHighlightMenuOpen(false));
@@ -6799,18 +6864,20 @@ const $9dfd9e2286cffa66$var$HighlightButton = ()=>{
6799
6864
  else setIsHighlightMenuOpen((previousValue)=>!previousValue);
6800
6865
  };
6801
6866
  const onScreenshareClick = async ()=>{
6802
- setIsHighlightMenuOpen(false);
6803
- try {
6804
- (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("screenshareClick");
6805
- await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).enableScreenshare();
6806
- (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("enableScreenshare");
6807
- } catch (screenshareError) {
6808
- console.warn(screenshareError);
6809
- (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("screenshareCancel");
6810
- (0, ($parcel$interopDefault($jQDcL$reacthottoast)))(t("notifications.screensharingError"), {
6811
- className: "error"
6812
- });
6813
- }
6867
+ if (permissions.find((permission)=>permission === "screen_sharing")) {
6868
+ setIsHighlightMenuOpen(false);
6869
+ try {
6870
+ (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("screenshareClick");
6871
+ await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).enableScreenshare();
6872
+ (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("enableScreenshare");
6873
+ } catch (screenshareError) {
6874
+ console.warn(screenshareError);
6875
+ (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("screenshareCancel");
6876
+ (0, ($parcel$interopDefault($jQDcL$reacthottoast)))(t("notifications.screensharingError"), {
6877
+ className: "error"
6878
+ });
6879
+ }
6880
+ } else setBlockedFeaturePopupOpen(true);
6814
6881
  };
6815
6882
  const onYoutubeClick = ()=>{
6816
6883
  setIsHighlightMenuOpen(false);
@@ -6818,9 +6885,11 @@ const $9dfd9e2286cffa66$var$HighlightButton = ()=>{
6818
6885
  (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("youtubeClick");
6819
6886
  };
6820
6887
  const onLinkshareClick = ()=>{
6821
- setIsHighlightMenuOpen(false);
6822
- setIsLinksharePopupVisible(true);
6823
- (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("linkshareClick");
6888
+ if (permissions.find((permission)=>permission === "share_link")) {
6889
+ setIsHighlightMenuOpen(false);
6890
+ setIsLinksharePopupVisible(true);
6891
+ (0, ($parcel$interopDefault($jQDcL$hotjarbrowser))).event("linkshareClick");
6892
+ } else setBlockedFeaturePopupOpen(true);
6824
6893
  };
6825
6894
  const menuCategories = [
6826
6895
  {
@@ -7393,6 +7462,16 @@ const $41e530447f5fd995$var$Checkmark = ()=>/*#__PURE__*/ (0, $jQDcL$reactjsxrun
7393
7462
  fill: "#fff"
7394
7463
  })
7395
7464
  });
7465
+ const $41e530447f5fd995$export$f8e32eb727ccae99 = ()=>/*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)("svg", {
7466
+ xmlns: "http://www.w3.org/2000/svg",
7467
+ width: "17",
7468
+ height: "18",
7469
+ fill: "none",
7470
+ children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)("path", {
7471
+ fill: "#fff",
7472
+ d: "M10.767 6.325 7.192 9.908 5.817 8.533a.833.833 0 1 0-1.175 1.175L6.6 11.675a.831.831 0 0 0 .592.241.833.833 0 0 0 .583-.241l4.166-4.167a.833.833 0 1 0-1.175-1.183ZM8.5.667a8.333 8.333 0 1 0 0 16.666A8.333 8.333 0 0 0 8.5.667Zm0 15a6.667 6.667 0 1 1 0-13.334 6.667 6.667 0 0 1 0 13.333Z"
7473
+ })
7474
+ });
7396
7475
  var $41e530447f5fd995$export$2e2bcd8739ae039 = $41e530447f5fd995$var$Checkmark;
7397
7476
 
7398
7477
 
@@ -9118,6 +9197,170 @@ var $8a52c9358bc52b86$export$2e2bcd8739ae039 = $8a52c9358bc52b86$var$VirtualBack
9118
9197
 
9119
9198
 
9120
9199
 
9200
+
9201
+
9202
+ const $72e3731384b9cb71$var$modalHeight = (desktop)=>desktop ? "225px" : "237px";
9203
+ const $72e3731384b9cb71$export$6e1d6efa4a5a1be4 = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).div`
9204
+ position: absolute;
9205
+ width: 100%;
9206
+ bottom: ${(props)=>props.open ? 0 : `-${$72e3731384b9cb71$var$modalHeight(props.desktop)}`};
9207
+ transition: all 0.4s;
9208
+
9209
+ ${(props)=>{
9210
+ if (props.desktop) return (0, $jQDcL$styledcomponents.css)`
9211
+ bottom: ${props.open ? 0 : `calc(-${$72e3731384b9cb71$var$modalHeight(props.desktop)} - (100vh / 2))`};
9212
+ height: 100%;
9213
+ display: flex;
9214
+ justify-content: center;
9215
+ align-items: center;
9216
+ `;
9217
+ }}
9218
+ `;
9219
+ const $72e3731384b9cb71$export$ed7a64955cfa5a69 = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).div`
9220
+ display: flex;
9221
+ flex-direction: column;
9222
+ width: ${(props)=>props.desktop ? "375px" : "100%"};
9223
+ height: ${({ desktop: desktop })=>$72e3731384b9cb71$var$modalHeight(desktop)};
9224
+ max-height: 100vh;
9225
+ background-color: ${(props)=>props.theme.popupBackgroundPrimaryColor};
9226
+ color: ${(props)=>props.theme.popupTitleColor};
9227
+ border-radius: ${(props)=>props.desktop ? "20px" : "20px 20px 0 0"};
9228
+ box-sizing: border-box;
9229
+ `;
9230
+ const $72e3731384b9cb71$export$6334857f32bd1136 = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).div`
9231
+ display: flex;
9232
+ justify-content: space-between;
9233
+ align-items: center;
9234
+ border-bottom: 2px solid #f7f7f7;
9235
+ `;
9236
+ const $72e3731384b9cb71$export$a27d59de3a7a8b8e = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).div`
9237
+ display: flex;
9238
+ align-items: center;
9239
+ margin: 16px auto 16px 16px;
9240
+ `;
9241
+ const $72e3731384b9cb71$export$47ef2d2839b7d95a = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).div`
9242
+ font-family: 'Lato';
9243
+ font-style: normal;
9244
+ font-weight: 600;
9245
+ font-size: 18px;
9246
+ line-height: 22px;
9247
+ letter-spacing: -0.02em;
9248
+ `;
9249
+ const $72e3731384b9cb71$export$219c8e53e235e8b7 = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).button`
9250
+ display: flex;
9251
+ justify-content: center;
9252
+ align-items: center;
9253
+ border: none;
9254
+ background-color: ${(props)=>props.theme.popupBackgroundSecondaryColor};
9255
+ border-radius: 50%;
9256
+ height: 30px;
9257
+ width: 30px;
9258
+ padding: 0;
9259
+ margin: 16px 16px 16px auto;
9260
+
9261
+ svg {
9262
+ height: 15px;
9263
+ width: 15px;
9264
+
9265
+ path {
9266
+ fill: #000;
9267
+ }
9268
+ }
9269
+ `;
9270
+ const $72e3731384b9cb71$export$5197cd1b80f9682b = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).div`
9271
+ display: flex;
9272
+ align-items: center;
9273
+ justify-content: center;
9274
+ font-size: 12px;
9275
+ color: #2d2d2d;
9276
+ margin: 16px 32px auto 32px;
9277
+ font-family: 'Lato';
9278
+ font-style: normal;
9279
+ font-weight: 400;
9280
+ font-size: 16px;
9281
+ line-height: 19px;
9282
+ text-align: left;
9283
+ letter-spacing: -0.02em;
9284
+ `;
9285
+ const $72e3731384b9cb71$export$5f79cadb3a637092 = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).button`
9286
+ background-color: ${({ theme: theme })=>theme.primaryColor};
9287
+ padding: 8px 18px;
9288
+ height: 46px;
9289
+ max-width: 100%;
9290
+ border-radius: 15px;
9291
+ margin: 20px 32px 20px 32px;
9292
+ border: none;
9293
+ color: #fff;
9294
+ font-size: 16px;
9295
+ font-weight: 700;
9296
+ line-height: 18px;
9297
+
9298
+ span {
9299
+ display: flex;
9300
+ flex-direction: row;
9301
+ gap: 5px;
9302
+ alig-items: center;
9303
+ justify-content: center;
9304
+ }
9305
+ `;
9306
+
9307
+
9308
+
9309
+
9310
+
9311
+
9312
+
9313
+ const $5b8a9a2976fbc419$var$BlockedFeaturePopup = ()=>{
9314
+ const { t: t } = (0, $jQDcL$reacti18next.useTranslation)();
9315
+ const { isBlockedFeaturePopupOpen: isBlockedFeaturePopupOpen , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , orientation: orientation , isAgent: isAgent } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
9316
+ const popupRef = (0, $jQDcL$react.useRef)(null);
9317
+ const desktop = orientation === "landscape";
9318
+ (0, $326cea7dbbcb019a$export$71b2224f1ce5e08e)(popupRef, ()=>{
9319
+ if (isBlockedFeaturePopupOpen) setBlockedFeaturePopupOpen(false);
9320
+ });
9321
+ return /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $72e3731384b9cb71$export$6e1d6efa4a5a1be4), {
9322
+ open: isBlockedFeaturePopupOpen,
9323
+ desktop: desktop,
9324
+ children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsxs)((0, $72e3731384b9cb71$export$ed7a64955cfa5a69), {
9325
+ ref: popupRef,
9326
+ desktop: desktop,
9327
+ children: [
9328
+ /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsxs)((0, $72e3731384b9cb71$export$6334857f32bd1136), {
9329
+ children: [
9330
+ /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $72e3731384b9cb71$export$a27d59de3a7a8b8e), {
9331
+ children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $72e3731384b9cb71$export$47ef2d2839b7d95a), {
9332
+ children: isAgent && t("blockedFeature.titleConnected") || t("blockedFeature.titleGuest")
9333
+ })
9334
+ }),
9335
+ /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $72e3731384b9cb71$export$219c8e53e235e8b7), {
9336
+ onClick: ()=>setBlockedFeaturePopupOpen(false),
9337
+ children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $6f36db3b1217f099$export$2e2bcd8739ae039), {})
9338
+ })
9339
+ ]
9340
+ }),
9341
+ /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $72e3731384b9cb71$export$5197cd1b80f9682b), {
9342
+ children: isAgent && t("blockedFeature.descriptionConnected") || t("blockedFeature.descriptionGuest")
9343
+ }),
9344
+ /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $72e3731384b9cb71$export$5f79cadb3a637092), {
9345
+ onClick: ()=>{
9346
+ setBlockedFeaturePopupOpen(false);
9347
+ if (isAgent) window.open(`${"https://app.snapcall.io"}/settings/workspace/plans-invoices`, "_blank");
9348
+ },
9349
+ children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsxs)("span", {
9350
+ children: [
9351
+ isAgent && /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $41e530447f5fd995$export$f8e32eb727ccae99), {}),
9352
+ isAgent && t("blockedFeature.dismissConnected") || t("blockedFeature.dismissGuest")
9353
+ ]
9354
+ })
9355
+ })
9356
+ ]
9357
+ })
9358
+ });
9359
+ };
9360
+ var $5b8a9a2976fbc419$export$2e2bcd8739ae039 = $5b8a9a2976fbc419$var$BlockedFeaturePopup;
9361
+
9362
+
9363
+
9121
9364
  const $e6950939129bcd4b$export$8376625f8bb18347 = (0, ($parcel$interopDefault($jQDcL$styledcomponents))).div`
9122
9365
  position: absolute;
9123
9366
  width: 100%;
@@ -9130,8 +9373,8 @@ const $e6950939129bcd4b$export$8376625f8bb18347 = (0, ($parcel$interopDefault($j
9130
9373
 
9131
9374
 
9132
9375
  const $5f509eaff0d9c05a$var$Settings = ()=>{
9133
- const { isQuickConnectPopupVisible: isQuickConnectPopupVisible , isSettingsMenuVisible: isSettingsMenuVisible , isYoutubePopupVisible: isYoutubePopupVisible , isLinksharePopupVisible: isLinksharePopupVisible , isVirtualBackgroundPopupVisible: isVirtualBackgroundPopupVisible , } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
9134
- const open = isQuickConnectPopupVisible || isSettingsMenuVisible || isYoutubePopupVisible || isLinksharePopupVisible || isVirtualBackgroundPopupVisible;
9376
+ const { isQuickConnectPopupVisible: isQuickConnectPopupVisible , isSettingsMenuVisible: isSettingsMenuVisible , isYoutubePopupVisible: isYoutubePopupVisible , isLinksharePopupVisible: isLinksharePopupVisible , isVirtualBackgroundPopupVisible: isVirtualBackgroundPopupVisible , isBlockedFeaturePopupOpen: isBlockedFeaturePopupOpen , } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
9377
+ const open = isQuickConnectPopupVisible || isSettingsMenuVisible || isYoutubePopupVisible || isBlockedFeaturePopupOpen || isLinksharePopupVisible || isVirtualBackgroundPopupVisible;
9135
9378
  return /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsxs)((0, $e6950939129bcd4b$export$8376625f8bb18347), {
9136
9379
  open: open,
9137
9380
  children: [
@@ -9139,7 +9382,8 @@ const $5f509eaff0d9c05a$var$Settings = ()=>{
9139
9382
  /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $7d4fa7ceb4c29739$export$2e2bcd8739ae039), {}),
9140
9383
  /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $696ded7a5399bcd4$export$2e2bcd8739ae039), {}),
9141
9384
  /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $e38290b50aaba0e3$export$2e2bcd8739ae039), {}),
9142
- /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $8a52c9358bc52b86$export$2e2bcd8739ae039), {})
9385
+ /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $8a52c9358bc52b86$export$2e2bcd8739ae039), {}),
9386
+ /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $5b8a9a2976fbc419$export$2e2bcd8739ae039), {})
9143
9387
  ]
9144
9388
  });
9145
9389
  };
@@ -10033,6 +10277,9 @@ const $ee8cb448c2c74888$var$StreamUI = ({ options: options })=>{
10033
10277
  const [userInteractionTriggered, setUserInteractionTriggered] = (0, $jQDcL$react.useState)(false);
10034
10278
  const [containerWidth, containerHeight] = (0, $56e1e7a85d8bf4bb$export$2b86bedf890eab8)(streamUIContainerRef.current);
10035
10279
  const [isBlockedDevicesPopupOpen, setBlockedDevicesPopupOpen] = (0, $jQDcL$react.useState)(false);
10280
+ const [isBlockedFeaturePopupOpen, setBlockedFeaturePopupOpen] = (0, $jQDcL$react.useState)(false);
10281
+ const [permissions, setPermissions] = (0, $jQDcL$react.useState)([]);
10282
+ const [plan, setPlan] = (0, $jQDcL$react.useState)(undefined);
10036
10283
  const orientation = (containerWidth || window.screen.width) > (containerHeight || window.screen.height) ? "landscape" : "portrait";
10037
10284
  const styledTheme = theme === "dark" ? (0, $9295e87e6b93e693$export$3e936a8db52a10a0) : (0, $9295e87e6b93e693$export$f30cb9bc4f736419);
10038
10285
  const onWebcamUpdate = (event)=>{
@@ -10161,6 +10408,9 @@ const $ee8cb448c2c74888$var$StreamUI = ({ options: options })=>{
10161
10408
  (0, $jQDcL$react.useEffect)(()=>{
10162
10409
  const onEnterRoom = async (event)=>{
10163
10410
  const peerId = event.detail.peerId;
10411
+ setPlan(event.detail.plan);
10412
+ setPermissions(event.detail.permissions);
10413
+ console.log(event.detail.permissions);
10164
10414
  setSelfPeerId(peerId);
10165
10415
  try {
10166
10416
  await (0, $c3d5253d9d597eb5$export$494039379563c94d)(options);
@@ -10179,6 +10429,8 @@ const $ee8cb448c2c74888$var$StreamUI = ({ options: options })=>{
10179
10429
  ]);
10180
10430
  return /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $8b39f32976a7698a$export$2e2bcd8739ae039).Provider, {
10181
10431
  value: {
10432
+ plan: plan,
10433
+ permissions: permissions,
10182
10434
  selfPeerId: selfPeerId,
10183
10435
  streamUIContainerRef: streamUIContainerRef,
10184
10436
  videosContainerRef: videosContainerRef,
@@ -10195,6 +10447,8 @@ const $ee8cb448c2c74888$var$StreamUI = ({ options: options })=>{
10195
10447
  setIsLinksharePopupVisible: setIsLinksharePopupVisible,
10196
10448
  isVirtualBackgroundPopupVisible: isVirtualBackgroundPopupVisible,
10197
10449
  setIsVirtualBackgroundPopupVisible: setIsVirtualBackgroundPopupVisible,
10450
+ isBlockedFeaturePopupOpen: isBlockedFeaturePopupOpen,
10451
+ setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen,
10198
10452
  theme: theme,
10199
10453
  setTheme: setTheme,
10200
10454
  language: language,
@@ -10728,7 +10982,8 @@ const $e68207026aca356b$export$3f94917203ab7078 = {
10728
10982
  getState: (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).getState.bind((0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2)),
10729
10983
  setProfile: (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).setProfile.bind((0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2)),
10730
10984
  /* Should not be documented */ setConfig: (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).setConfig.bind((0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2)),
10731
- setLogLevel: (level)=>(0, $d0c6baf97675ab49$export$2e2bcd8739ae039).setLogLevel(level)
10985
+ setLogLevel: (level)=>(0, $d0c6baf97675ab49$export$2e2bcd8739ae039).setLogLevel(level),
10986
+ getPermissions: ()=>(0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).getPermissions()
10732
10987
  };
10733
10988
  window.streamUI = $e68207026aca356b$export$3f94917203ab7078;
10734
10989
  // Backward compatibility