@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.
@@ -325,6 +325,9 @@ const $a3e657fb86ae23f3$export$604ba5624273df44 = ()=>{
325
325
  const $18fb8799f38eb407$export$84584c2a98eb6753 = {
326
326
  name: "English",
327
327
  translation: {
328
+ header: {
329
+ free: "Free version"
330
+ },
328
331
  notifications: {
329
332
  screensharingError: "An error occured when trying to toggle screensharing",
330
333
  microphoneError: "An error occured when trying to toggle the microphone",
@@ -356,6 +359,14 @@ const $18fb8799f38eb407$export$84584c2a98eb6753 = {
356
359
  pictureInPicture: "Picture-in-Picture",
357
360
  screenSharing: "Screen sharing"
358
361
  },
362
+ blockedFeature: {
363
+ titleConnected: "Upgrade to Pro",
364
+ titleGuest: "Feature not available",
365
+ descriptionConnected: "On a free plan, you can't use this feature. Upgrade your plan to enjoy all in-call features.",
366
+ descriptionGuest: "You are participating in a call created with a free version of SnapCall. This feature is only available with a Pro version.",
367
+ dismissGuest: "Okay",
368
+ dismissConnected: "Upgrade to Pro"
369
+ },
359
370
  copyLink: {
360
371
  title: "Copy link",
361
372
  description: "Copy link into clipboard",
@@ -465,6 +476,9 @@ const $18fb8799f38eb407$export$84584c2a98eb6753 = {
465
476
  const $c5472fb74fa04782$export$acb2a88f7d552ebf = {
466
477
  name: "Fran\xe7ais",
467
478
  translation: {
479
+ header: {
480
+ free: "Version gratuite"
481
+ },
468
482
  notifications: {
469
483
  screensharingError: "Une erreur est survenue pendant l'activation du partage d'\xe9cran",
470
484
  microphoneError: "Une erreur est survenue pendant l'activation du micro",
@@ -496,6 +510,14 @@ const $c5472fb74fa04782$export$acb2a88f7d552ebf = {
496
510
  pictureInPicture: "Picture-in-Picture",
497
511
  screenSharing: "Partage d'\xe9cran"
498
512
  },
513
+ blockedFeature: {
514
+ titleConnected: "Souscrire au plan Pro",
515
+ titleGuest: "Fonctionnalit\xe9 non disponible",
516
+ descriptionConnected: "Vous n'avez pas acc\xe8s \xe0 cette fonctionnalit\xe9. Souscrivez au plan Pro pour d\xe9bloquer toutes les fonctionnalit\xe9s de SnapCall.",
517
+ 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.",
518
+ dismissGuest: "D'accord",
519
+ dismissConnected: "Souscrire \xe0 Pro"
520
+ },
499
521
  copyLink: {
500
522
  title: "Copier le lien",
501
523
  description: "Copier le lien dans le presse-papiers",
@@ -605,6 +627,9 @@ const $c5472fb74fa04782$export$acb2a88f7d552ebf = {
605
627
  const $b7790fb9e48df5c4$export$3486a10f30cf1ee4 = {
606
628
  name: "Italiano",
607
629
  translation: {
630
+ header: {
631
+ free: "Versione gratuita"
632
+ },
608
633
  notifications: {
609
634
  screensharingError: "Si \xe8 verificato un errore durante l'attivazione della condivisione dello schermo",
610
635
  microphoneError: "Si \xe8 verificato un errore durante l'attivazione del microfono",
@@ -636,6 +661,14 @@ const $b7790fb9e48df5c4$export$3486a10f30cf1ee4 = {
636
661
  pictureInPicture: "Immagine nell'immagine",
637
662
  screenSharing: "Condivisione dello schermo"
638
663
  },
664
+ blockedFeature: {
665
+ titleConnected: "L'aggiornamento a Pro",
666
+ titleGuest: "Funzione non disponibile",
667
+ descriptionConnected: "Su un piano gratuito, non puoi utilizzare questa funzione. Aggiorna il tuo piano per usufruire di tutte le funzionalit\xe0 in chiamata.",
668
+ descriptionGuest: "Stai partecipando a una chiamata creata con una versione gratuita di SnapCall. Questa funzione \xe8 disponibile solo con una versione Pro.",
669
+ dismissGuest: "Okay",
670
+ dismissConnected: "L'aggiornamento a Pro"
671
+ },
639
672
  copyLink: {
640
673
  title: "Copia il link",
641
674
  description: "Copia il link negli appunti",
@@ -771,6 +804,8 @@ var $384d985bb9605c35$export$2e2bcd8739ae039 = (0, $3Sbms$i18next);
771
804
 
772
805
 
773
806
 
807
+
808
+
774
809
  const $0f65a9eaf4a1e910$var$LogLevel = {
775
810
  error: 1,
776
811
  warn: 2,
@@ -1405,6 +1440,8 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1405
1440
  pendingDeviceRequest = {};
1406
1441
  joinOptions = {};
1407
1442
  devicesList = [];
1443
+ plan = undefined;
1444
+ permissions = [];
1408
1445
  constructor(){
1409
1446
  super();
1410
1447
  navigator.mediaDevices.addEventListener("devicechange", ()=>this.onDeviceChange());
@@ -1528,7 +1565,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1528
1565
  if (!this.peerId) this.peerId = (0, $3Sbms$v4)();
1529
1566
  let url;
1530
1567
  try {
1531
- const { instanceId: instanceId } = await fetch(`${this.config.streamerApi}/instance/${this.roomId}`, {
1568
+ const { streamer_instance: instanceId , plan: { permissions: permissions , name: name } , } = await fetch(`${this.config.apiUrl}/streams/${room}/info`, {
1532
1569
  method: "get",
1533
1570
  headers: {
1534
1571
  "Content-Type": "application/json"
@@ -1537,6 +1574,8 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1537
1574
  if (response.ok) return response.json();
1538
1575
  throw new Error("Invalid room ID");
1539
1576
  });
1577
+ this.permissions = permissions;
1578
+ this.plan = name;
1540
1579
  url = `${this.config.streamerServer}/${instanceId}/?roomId=${room}&peerId=${this.peerId}`;
1541
1580
  } catch (roomError) {
1542
1581
  const event = new $c31e3fb4360572af$var$SnapcallEvent("invalidRoom", {
@@ -1806,7 +1845,9 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1806
1845
  peerId: peer.id || peer.peerId
1807
1846
  };
1808
1847
  }),
1809
- callId: callId
1848
+ callId: callId,
1849
+ plan: this.plan,
1850
+ permissions: this.permissions
1810
1851
  }
1811
1852
  }));
1812
1853
  $c31e3fb4360572af$var$log.log("joinRoom", "peers", peers);
@@ -2126,6 +2167,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2126
2167
  this.mediaPipeOption = options;
2127
2168
  }
2128
2169
  async initVideoBackground() {
2170
+ if (!this.permissions.find((permission)=>permission === "virtual_background")) throw new Error("feature not allowed");
2129
2171
  if (this.useVideoBackground === true) return;
2130
2172
  this.useVideoBackground = true;
2131
2173
  if (!this.webcamProducer || this.webcamProducer.closed) return;
@@ -2302,6 +2344,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2302
2344
  this.dispatchEvent(event);
2303
2345
  }
2304
2346
  async enableScreenshare() {
2347
+ if (!this.permissions.find((permission)=>permission === "screen_sharing")) throw new Error("feature not allowed");
2305
2348
  const stream = await this.handleGetUserMediaError("screen", navigator.mediaDevices.getDisplayMedia({
2306
2349
  audio: false,
2307
2350
  video: {
@@ -2394,11 +2437,13 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2394
2437
  } else $c31e3fb4360572af$var$log.error("requestVideo", `Video consumer ${consumer} not found`);
2395
2438
  }
2396
2439
  async captureVideo(videoElement) {
2397
- let image;
2398
- if (videoElement) image = await (0, $15ddac3121cc3a5d$export$674c90a250a8b2c5)(videoElement);
2399
- else if (this.webcamProducer && this.webcamProducer.track) image = await (0, $15ddac3121cc3a5d$export$4a210166cc9cb64b)(this.webcamProducer.track);
2400
- else throw new Error("no video to capture");
2401
- return image;
2440
+ if (this.permissions.find((permission)=>permission === "instant_picture")) {
2441
+ let image;
2442
+ if (videoElement) image = await (0, $15ddac3121cc3a5d$export$674c90a250a8b2c5)(videoElement);
2443
+ else if (this.webcamProducer && this.webcamProducer.track) image = await (0, $15ddac3121cc3a5d$export$4a210166cc9cb64b)(this.webcamProducer.track);
2444
+ else throw new Error("no video to capture");
2445
+ return image;
2446
+ } else throw new Error("feature not allowed");
2402
2447
  }
2403
2448
  requestLocalVideo(element) {
2404
2449
  $c31e3fb4360572af$var$log.info("requestLocalVideo");
@@ -2516,6 +2561,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2516
2561
  this.dispatchEvent(event);
2517
2562
  }
2518
2563
  async requestPeerDevice(remotePeerId, deviceType) {
2564
+ if (!this.permissions.find((permission)=>permission === "request_input")) throw new Error("feature not allowed");
2519
2565
  return this.protoo.request("requestPeerDevice", {
2520
2566
  remotePeerId: remotePeerId,
2521
2567
  deviceType: deviceType
@@ -2684,6 +2730,9 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2684
2730
  ...config
2685
2731
  };
2686
2732
  }
2733
+ getPermissions() {
2734
+ return this.permissions;
2735
+ }
2687
2736
  }
2688
2737
 
2689
2738
 
@@ -3163,7 +3212,7 @@ const $ab29487ffcc05855$export$4dc2e6a0e59ffa13 = (0, $3Sbms$styledcomponents).s
3163
3212
  font-size: 16px;
3164
3213
  font-weight: 300;
3165
3214
  line-height: 16px;
3166
- color: #fff;
3215
+ color: rgba(255, 255, 255, 0.5);
3167
3216
  margin-left: 5px;
3168
3217
  position: relative;
3169
3218
  bottom: 1px;
@@ -3538,7 +3587,7 @@ const $f235befa4cdc42d6$var$multiPiP = new (0, $e96d119a19ed0c6c$export$45fabd1c
3538
3587
  const $f235befa4cdc42d6$var$browser = $3Sbms$parse(window.navigator.userAgent);
3539
3588
  const $f235befa4cdc42d6$var$Header = ()=>{
3540
3589
  const { t: t } = (0, $3Sbms$useTranslation)();
3541
- const { setIsQuickConnectPopupVisible: setIsQuickConnectPopupVisible , setIsSettingsMenuVisible: setIsSettingsMenuVisible , setIsVirtualBackgroundPopupVisible: setIsVirtualBackgroundPopupVisible , options: options , muted: muted , streaming: streaming , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
3590
+ const { setIsQuickConnectPopupVisible: setIsQuickConnectPopupVisible , setIsSettingsMenuVisible: setIsSettingsMenuVisible , setIsVirtualBackgroundPopupVisible: setIsVirtualBackgroundPopupVisible , options: options , muted: muted , streaming: streaming , permissions: permissions , plan: plan , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
3542
3591
  const { streams: streams } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
3543
3592
  const [extraOptions, setExtraOptions] = (0, $3Sbms$useState)(options.extraSettingsOptions || []);
3544
3593
  const onSetExtraSettingsOptions = (event)=>{
@@ -3586,14 +3635,17 @@ const $f235befa4cdc42d6$var$Header = ()=>{
3586
3635
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).endCall();
3587
3636
  };
3588
3637
  const onScanQuickConnectClick = ()=>{
3589
- setIsQuickConnectPopupVisible(true);
3590
- (0, $3Sbms$hotjarbrowser).event("quickConnectClick");
3638
+ if (permissions.find((permission)=>permission === "quick_connect")) {
3639
+ setIsQuickConnectPopupVisible(true);
3640
+ (0, $3Sbms$hotjarbrowser).event("quickConnectClick");
3641
+ } else setBlockedFeaturePopupOpen(true);
3591
3642
  };
3592
3643
  const onSettingsMenuClick = ()=>{
3593
3644
  setIsSettingsMenuVisible(true);
3594
3645
  };
3595
3646
  const onVirtualBackgroundClick = ()=>{
3596
- setIsVirtualBackgroundPopupVisible(true);
3647
+ if (permissions.find((permission)=>permission === "virtual_background")) setIsVirtualBackgroundPopupVisible(true);
3648
+ else setBlockedFeaturePopupOpen(true);
3597
3649
  };
3598
3650
  const computedCategories = [
3599
3651
  {
@@ -3650,13 +3702,15 @@ const $f235befa4cdc42d6$var$Header = ()=>{
3650
3702
  });
3651
3703
  return computedCategories;
3652
3704
  }, [
3705
+ t,
3706
+ options.sharedURL,
3653
3707
  muted,
3654
3708
  streaming,
3655
- options.sharedURL,
3709
+ permissions,
3656
3710
  setIsQuickConnectPopupVisible,
3711
+ setBlockedFeaturePopupOpen,
3657
3712
  setIsSettingsMenuVisible,
3658
- setIsVirtualBackgroundPopupVisible,
3659
- t,
3713
+ setIsVirtualBackgroundPopupVisible,
3660
3714
  ]);
3661
3715
  return /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $ab29487ffcc05855$export$1e86fd0e1db89578), {
3662
3716
  children: [
@@ -3666,7 +3720,10 @@ const $f235befa4cdc42d6$var$Header = ()=>{
3666
3720
  size: options.logo?.size
3667
3721
  }),
3668
3722
  options.logo?.text && /*#__PURE__*/ (0, $3Sbms$jsx)((0, $ab29487ffcc05855$export$4dc2e6a0e59ffa13), {
3669
- children: options.logo.text
3723
+ children: options.logo?.text
3724
+ }),
3725
+ plan === "individual" && /*#__PURE__*/ (0, $3Sbms$jsx)((0, $ab29487ffcc05855$export$4dc2e6a0e59ffa13), {
3726
+ children: `${options.logo?.text ? " \xb7 " : ""}${t("header.free")}`
3670
3727
  })
3671
3728
  ]
3672
3729
  }),
@@ -4502,7 +4559,7 @@ const $a53a1c6f62ad0fcc$var$StreamTile = ({ stream: stream , width: width = 0 ,
4502
4559
  const [requestingDevice, setRequestingDevice] = (0, $3Sbms$useState)(null);
4503
4560
  const [flashAnimation, setFlashAnimation] = (0, $3Sbms$useState)(false);
4504
4561
  const requestingDeviceTimeoutRef = (0, $3Sbms$useRef)(null);
4505
- const { selfPeerId: selfPeerId } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
4562
+ const { selfPeerId: selfPeerId , permissions: permissions , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
4506
4563
  const { highlightedTile: highlightedTile } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
4507
4564
  const isSharingScreen = highlightedTile?.type === "screenshare" && highlightedTile.peerId === selfPeerId;
4508
4565
  const microphoneActive = stream.microphone && !stream.muted;
@@ -4514,16 +4571,22 @@ const $a53a1c6f62ad0fcc$var$StreamTile = ({ stream: stream , width: width = 0 ,
4514
4571
  const onMouseEnter = ()=>setHover(true);
4515
4572
  const onMouseLeave = ()=>setHover(false);
4516
4573
  const requestMicrophone = ()=>{
4517
- (0, $c9e496369b59be7a$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "microphone");
4518
- setRequestingDevice("microphone");
4574
+ if (permissions.find((permission)=>permission === "request_input")) {
4575
+ (0, $c9e496369b59be7a$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "microphone");
4576
+ setRequestingDevice("microphone");
4577
+ } else setBlockedFeaturePopupOpen(true);
4519
4578
  };
4520
4579
  const requestWebcam = ()=>{
4521
- (0, $c9e496369b59be7a$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "webcam");
4522
- setRequestingDevice("webcam");
4580
+ if (permissions.find((permission)=>permission === "request_input")) {
4581
+ (0, $c9e496369b59be7a$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "webcam");
4582
+ setRequestingDevice("webcam");
4583
+ } else setBlockedFeaturePopupOpen(true);
4523
4584
  };
4524
4585
  const requestScreen = ()=>{
4525
- (0, $c9e496369b59be7a$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "screen");
4526
- setRequestingDevice("screen");
4586
+ if (permissions.find((permission)=>permission === "request_input")) {
4587
+ (0, $c9e496369b59be7a$export$2f377c2162fd02b2).requestPeerDevice(stream.id, "screen");
4588
+ setRequestingDevice("screen");
4589
+ } else setBlockedFeaturePopupOpen(true);
4527
4590
  };
4528
4591
  (0, $3Sbms$useEffect)(()=>{
4529
4592
  if (!videoElementRef.current) throw new Error("videoElementRef not available");
@@ -5161,7 +5224,7 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
5161
5224
  const videoElementRef = (0, $3Sbms$useRef)(null);
5162
5225
  const videoMediaProviderRef = (0, $3Sbms$useRef)(null);
5163
5226
  const SelfTileRef = (0, $3Sbms$useRef)(null);
5164
- const { videosContainerRef: videosContainerRef , remoteTilesContainerRef: remoteTilesContainerRef , profile: profile , muted: muted , streaming: streaming , orientation: orientation , options: options , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
5227
+ const { videosContainerRef: videosContainerRef , remoteTilesContainerRef: remoteTilesContainerRef , profile: profile , muted: muted , streaming: streaming , orientation: orientation , options: options , permissions: permissions , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
5165
5228
  const { streams: streams } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
5166
5229
  const [containerWidth, containerHeight] = (0, $af23c74942bdcae7$export$2b86bedf890eab8)(videosContainerRef.current);
5167
5230
  const cursor = streaming && !extended ? "pointer" : "default";
@@ -5205,42 +5268,44 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
5205
5268
  }
5206
5269
  };
5207
5270
  const onSnapshotClick = async ()=>{
5208
- if (!snapshotAnimation && !snapshotImage) {
5209
- if (!videoElementRef.current) throw new Error("Video element is not available");
5210
- setSnapshotAnimation(true);
5211
- const base64Image = await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).captureVideo(videoElementRef.current);
5212
- setSnapshotImage(base64Image);
5213
- try {
5214
- const { objectUrl: objectUrl } = await fetch(`${options.streamApiURL}/uploadSnapshot`, {
5215
- method: "POST",
5216
- body: JSON.stringify({
5217
- file: base64Image
5218
- })
5219
- }).then((rawResponse)=>rawResponse.json());
5220
- await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).sendCustomMessageToAll({
5221
- type: "snapshot",
5222
- imageSrc: objectUrl
5223
- });
5224
- let notificationMessage = t("snapshot.sentToUsers");
5225
- if (streams.length === 1) {
5226
- const userName = streams[0].profile.name || t("misc.user");
5227
- notificationMessage = t("snapshot.sentToUser", {
5228
- user: userName
5271
+ if (permissions.find((permission)=>permission === "instant_picture")) {
5272
+ if (!snapshotAnimation && !snapshotImage) {
5273
+ if (!videoElementRef.current) throw new Error("Video element is not available");
5274
+ setSnapshotAnimation(true);
5275
+ const base64Image = await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).captureVideo(videoElementRef.current);
5276
+ setSnapshotImage(base64Image);
5277
+ try {
5278
+ const { objectUrl: objectUrl } = await fetch(`${options.streamApiURL}/uploadSnapshot`, {
5279
+ method: "POST",
5280
+ body: JSON.stringify({
5281
+ file: base64Image
5282
+ })
5283
+ }).then((rawResponse)=>rawResponse.json());
5284
+ await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).sendCustomMessageToAll({
5285
+ type: "snapshot",
5286
+ imageSrc: objectUrl
5287
+ });
5288
+ let notificationMessage = t("snapshot.sentToUsers");
5289
+ if (streams.length === 1) {
5290
+ const userName = streams[0].profile.name || t("misc.user");
5291
+ notificationMessage = t("snapshot.sentToUser", {
5292
+ user: userName
5293
+ });
5294
+ }
5295
+ (0, $a5146f9062d7bf28$export$3a57e165650c636f)(notificationMessage, {
5296
+ icon: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $6efc75079651494a$export$26fe7ec9351ff761), {
5297
+ src: base64Image
5298
+ }),
5299
+ duration: 2500
5229
5300
  });
5301
+ } catch (sendMessageError) {
5302
+ (0, $3Sbms$reacthottoast)(t("snapshot.error"), {
5303
+ className: "error"
5304
+ });
5305
+ console.error(sendMessageError);
5230
5306
  }
5231
- (0, $a5146f9062d7bf28$export$3a57e165650c636f)(notificationMessage, {
5232
- icon: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $6efc75079651494a$export$26fe7ec9351ff761), {
5233
- src: base64Image
5234
- }),
5235
- duration: 2500
5236
- });
5237
- } catch (sendMessageError) {
5238
- (0, $3Sbms$reacthottoast)(t("snapshot.error"), {
5239
- className: "error"
5240
- });
5241
- console.error(sendMessageError);
5242
5307
  }
5243
- }
5308
+ } else setBlockedFeaturePopupOpen(true);
5244
5309
  };
5245
5310
  const onDeviceRequest = (event)=>{
5246
5311
  const { peerId: peerId , deviceType: deviceType } = event.detail;
@@ -6780,7 +6845,7 @@ const $db92fac48417791a$var$HighlightButton = ()=>{
6780
6845
  const { t: t } = (0, $3Sbms$useTranslation)();
6781
6846
  const highlightMenuRef = (0, $3Sbms$useRef)(null);
6782
6847
  const [isHighlightMenuOpen, setIsHighlightMenuOpen] = (0, $3Sbms$useState)(false);
6783
- const { setIsYoutubePopupVisible: setIsYoutubePopupVisible , setIsLinksharePopupVisible: setIsLinksharePopupVisible , selfPeerId: selfPeerId } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
6848
+ const { setIsYoutubePopupVisible: setIsYoutubePopupVisible , setIsLinksharePopupVisible: setIsLinksharePopupVisible , selfPeerId: selfPeerId , permissions: permissions , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
6784
6849
  const { highlightedTile: highlightedTile , dispatch: dispatch } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
6785
6850
  const isPresenting = Boolean(highlightedTile?.isGlobal && highlightedTile?.peerId === selfPeerId);
6786
6851
  (0, $e1413aacdaa5a03e$export$71b2224f1ce5e08e)(highlightMenuRef, ()=>setIsHighlightMenuOpen(false));
@@ -6791,18 +6856,20 @@ const $db92fac48417791a$var$HighlightButton = ()=>{
6791
6856
  else setIsHighlightMenuOpen((previousValue)=>!previousValue);
6792
6857
  };
6793
6858
  const onScreenshareClick = async ()=>{
6794
- setIsHighlightMenuOpen(false);
6795
- try {
6796
- (0, $3Sbms$hotjarbrowser).event("screenshareClick");
6797
- await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).enableScreenshare();
6798
- (0, $3Sbms$hotjarbrowser).event("enableScreenshare");
6799
- } catch (screenshareError) {
6800
- console.warn(screenshareError);
6801
- (0, $3Sbms$hotjarbrowser).event("screenshareCancel");
6802
- (0, $3Sbms$reacthottoast)(t("notifications.screensharingError"), {
6803
- className: "error"
6804
- });
6805
- }
6859
+ if (permissions.find((permission)=>permission === "screen_sharing")) {
6860
+ setIsHighlightMenuOpen(false);
6861
+ try {
6862
+ (0, $3Sbms$hotjarbrowser).event("screenshareClick");
6863
+ await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).enableScreenshare();
6864
+ (0, $3Sbms$hotjarbrowser).event("enableScreenshare");
6865
+ } catch (screenshareError) {
6866
+ console.warn(screenshareError);
6867
+ (0, $3Sbms$hotjarbrowser).event("screenshareCancel");
6868
+ (0, $3Sbms$reacthottoast)(t("notifications.screensharingError"), {
6869
+ className: "error"
6870
+ });
6871
+ }
6872
+ } else setBlockedFeaturePopupOpen(true);
6806
6873
  };
6807
6874
  const onYoutubeClick = ()=>{
6808
6875
  setIsHighlightMenuOpen(false);
@@ -6810,9 +6877,11 @@ const $db92fac48417791a$var$HighlightButton = ()=>{
6810
6877
  (0, $3Sbms$hotjarbrowser).event("youtubeClick");
6811
6878
  };
6812
6879
  const onLinkshareClick = ()=>{
6813
- setIsHighlightMenuOpen(false);
6814
- setIsLinksharePopupVisible(true);
6815
- (0, $3Sbms$hotjarbrowser).event("linkshareClick");
6880
+ if (permissions.find((permission)=>permission === "share_link")) {
6881
+ setIsHighlightMenuOpen(false);
6882
+ setIsLinksharePopupVisible(true);
6883
+ (0, $3Sbms$hotjarbrowser).event("linkshareClick");
6884
+ } else setBlockedFeaturePopupOpen(true);
6816
6885
  };
6817
6886
  const menuCategories = [
6818
6887
  {
@@ -7385,6 +7454,16 @@ const $910dd7d7d872a463$var$Checkmark = ()=>/*#__PURE__*/ (0, $3Sbms$jsx)("svg",
7385
7454
  fill: "#fff"
7386
7455
  })
7387
7456
  });
7457
+ const $910dd7d7d872a463$export$f8e32eb727ccae99 = ()=>/*#__PURE__*/ (0, $3Sbms$jsx)("svg", {
7458
+ xmlns: "http://www.w3.org/2000/svg",
7459
+ width: "17",
7460
+ height: "18",
7461
+ fill: "none",
7462
+ children: /*#__PURE__*/ (0, $3Sbms$jsx)("path", {
7463
+ fill: "#fff",
7464
+ 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"
7465
+ })
7466
+ });
7388
7467
  var $910dd7d7d872a463$export$2e2bcd8739ae039 = $910dd7d7d872a463$var$Checkmark;
7389
7468
 
7390
7469
 
@@ -9110,6 +9189,170 @@ var $d493afe60dcea711$export$2e2bcd8739ae039 = $d493afe60dcea711$var$VirtualBack
9110
9189
 
9111
9190
 
9112
9191
 
9192
+
9193
+
9194
+ const $3a1d149ac4596979$var$modalHeight = (desktop)=>desktop ? "225px" : "237px";
9195
+ const $3a1d149ac4596979$export$6e1d6efa4a5a1be4 = (0, $3Sbms$styledcomponents).div`
9196
+ position: absolute;
9197
+ width: 100%;
9198
+ bottom: ${(props)=>props.open ? 0 : `-${$3a1d149ac4596979$var$modalHeight(props.desktop)}`};
9199
+ transition: all 0.4s;
9200
+
9201
+ ${(props)=>{
9202
+ if (props.desktop) return (0, $3Sbms$css)`
9203
+ bottom: ${props.open ? 0 : `calc(-${$3a1d149ac4596979$var$modalHeight(props.desktop)} - (100vh / 2))`};
9204
+ height: 100%;
9205
+ display: flex;
9206
+ justify-content: center;
9207
+ align-items: center;
9208
+ `;
9209
+ }}
9210
+ `;
9211
+ const $3a1d149ac4596979$export$ed7a64955cfa5a69 = (0, $3Sbms$styledcomponents).div`
9212
+ display: flex;
9213
+ flex-direction: column;
9214
+ width: ${(props)=>props.desktop ? "375px" : "100%"};
9215
+ height: ${({ desktop: desktop })=>$3a1d149ac4596979$var$modalHeight(desktop)};
9216
+ max-height: 100vh;
9217
+ background-color: ${(props)=>props.theme.popupBackgroundPrimaryColor};
9218
+ color: ${(props)=>props.theme.popupTitleColor};
9219
+ border-radius: ${(props)=>props.desktop ? "20px" : "20px 20px 0 0"};
9220
+ box-sizing: border-box;
9221
+ `;
9222
+ const $3a1d149ac4596979$export$6334857f32bd1136 = (0, $3Sbms$styledcomponents).div`
9223
+ display: flex;
9224
+ justify-content: space-between;
9225
+ align-items: center;
9226
+ border-bottom: 2px solid #f7f7f7;
9227
+ `;
9228
+ const $3a1d149ac4596979$export$a27d59de3a7a8b8e = (0, $3Sbms$styledcomponents).div`
9229
+ display: flex;
9230
+ align-items: center;
9231
+ margin: 16px auto 16px 16px;
9232
+ `;
9233
+ const $3a1d149ac4596979$export$47ef2d2839b7d95a = (0, $3Sbms$styledcomponents).div`
9234
+ font-family: 'Lato';
9235
+ font-style: normal;
9236
+ font-weight: 600;
9237
+ font-size: 18px;
9238
+ line-height: 22px;
9239
+ letter-spacing: -0.02em;
9240
+ `;
9241
+ const $3a1d149ac4596979$export$219c8e53e235e8b7 = (0, $3Sbms$styledcomponents).button`
9242
+ display: flex;
9243
+ justify-content: center;
9244
+ align-items: center;
9245
+ border: none;
9246
+ background-color: ${(props)=>props.theme.popupBackgroundSecondaryColor};
9247
+ border-radius: 50%;
9248
+ height: 30px;
9249
+ width: 30px;
9250
+ padding: 0;
9251
+ margin: 16px 16px 16px auto;
9252
+
9253
+ svg {
9254
+ height: 15px;
9255
+ width: 15px;
9256
+
9257
+ path {
9258
+ fill: #000;
9259
+ }
9260
+ }
9261
+ `;
9262
+ const $3a1d149ac4596979$export$5197cd1b80f9682b = (0, $3Sbms$styledcomponents).div`
9263
+ display: flex;
9264
+ align-items: center;
9265
+ justify-content: center;
9266
+ font-size: 12px;
9267
+ color: #2d2d2d;
9268
+ margin: 16px 32px auto 32px;
9269
+ font-family: 'Lato';
9270
+ font-style: normal;
9271
+ font-weight: 400;
9272
+ font-size: 16px;
9273
+ line-height: 19px;
9274
+ text-align: left;
9275
+ letter-spacing: -0.02em;
9276
+ `;
9277
+ const $3a1d149ac4596979$export$5f79cadb3a637092 = (0, $3Sbms$styledcomponents).button`
9278
+ background-color: ${({ theme: theme })=>theme.primaryColor};
9279
+ padding: 8px 18px;
9280
+ height: 46px;
9281
+ max-width: 100%;
9282
+ border-radius: 15px;
9283
+ margin: 20px 32px 20px 32px;
9284
+ border: none;
9285
+ color: #fff;
9286
+ font-size: 16px;
9287
+ font-weight: 700;
9288
+ line-height: 18px;
9289
+
9290
+ span {
9291
+ display: flex;
9292
+ flex-direction: row;
9293
+ gap: 5px;
9294
+ alig-items: center;
9295
+ justify-content: center;
9296
+ }
9297
+ `;
9298
+
9299
+
9300
+
9301
+
9302
+
9303
+
9304
+
9305
+ const $7d1b559f928daf1f$var$BlockedFeaturePopup = ()=>{
9306
+ const { t: t } = (0, $3Sbms$useTranslation)();
9307
+ const { isBlockedFeaturePopupOpen: isBlockedFeaturePopupOpen , setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen , orientation: orientation , isAgent: isAgent } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
9308
+ const popupRef = (0, $3Sbms$useRef)(null);
9309
+ const desktop = orientation === "landscape";
9310
+ (0, $e1413aacdaa5a03e$export$71b2224f1ce5e08e)(popupRef, ()=>{
9311
+ if (isBlockedFeaturePopupOpen) setBlockedFeaturePopupOpen(false);
9312
+ });
9313
+ return /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3a1d149ac4596979$export$6e1d6efa4a5a1be4), {
9314
+ open: isBlockedFeaturePopupOpen,
9315
+ desktop: desktop,
9316
+ children: /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $3a1d149ac4596979$export$ed7a64955cfa5a69), {
9317
+ ref: popupRef,
9318
+ desktop: desktop,
9319
+ children: [
9320
+ /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $3a1d149ac4596979$export$6334857f32bd1136), {
9321
+ children: [
9322
+ /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3a1d149ac4596979$export$a27d59de3a7a8b8e), {
9323
+ children: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3a1d149ac4596979$export$47ef2d2839b7d95a), {
9324
+ children: isAgent && t("blockedFeature.titleConnected") || t("blockedFeature.titleGuest")
9325
+ })
9326
+ }),
9327
+ /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3a1d149ac4596979$export$219c8e53e235e8b7), {
9328
+ onClick: ()=>setBlockedFeaturePopupOpen(false),
9329
+ children: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $57ab7b9a012d9acd$export$2e2bcd8739ae039), {})
9330
+ })
9331
+ ]
9332
+ }),
9333
+ /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3a1d149ac4596979$export$5197cd1b80f9682b), {
9334
+ children: isAgent && t("blockedFeature.descriptionConnected") || t("blockedFeature.descriptionGuest")
9335
+ }),
9336
+ /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3a1d149ac4596979$export$5f79cadb3a637092), {
9337
+ onClick: ()=>{
9338
+ setBlockedFeaturePopupOpen(false);
9339
+ if (isAgent) window.open(`${"https://app.snapcall.io"}/settings/workspace/plans-invoices`, "_blank");
9340
+ },
9341
+ children: /*#__PURE__*/ (0, $3Sbms$jsxs)("span", {
9342
+ children: [
9343
+ isAgent && /*#__PURE__*/ (0, $3Sbms$jsx)((0, $910dd7d7d872a463$export$f8e32eb727ccae99), {}),
9344
+ isAgent && t("blockedFeature.dismissConnected") || t("blockedFeature.dismissGuest")
9345
+ ]
9346
+ })
9347
+ })
9348
+ ]
9349
+ })
9350
+ });
9351
+ };
9352
+ var $7d1b559f928daf1f$export$2e2bcd8739ae039 = $7d1b559f928daf1f$var$BlockedFeaturePopup;
9353
+
9354
+
9355
+
9113
9356
  const $e1c48a389d8ac959$export$8376625f8bb18347 = (0, $3Sbms$styledcomponents).div`
9114
9357
  position: absolute;
9115
9358
  width: 100%;
@@ -9122,8 +9365,8 @@ const $e1c48a389d8ac959$export$8376625f8bb18347 = (0, $3Sbms$styledcomponents).d
9122
9365
 
9123
9366
 
9124
9367
  const $01986a58bfba8001$var$Settings = ()=>{
9125
- const { isQuickConnectPopupVisible: isQuickConnectPopupVisible , isSettingsMenuVisible: isSettingsMenuVisible , isYoutubePopupVisible: isYoutubePopupVisible , isLinksharePopupVisible: isLinksharePopupVisible , isVirtualBackgroundPopupVisible: isVirtualBackgroundPopupVisible , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
9126
- const open = isQuickConnectPopupVisible || isSettingsMenuVisible || isYoutubePopupVisible || isLinksharePopupVisible || isVirtualBackgroundPopupVisible;
9368
+ const { isQuickConnectPopupVisible: isQuickConnectPopupVisible , isSettingsMenuVisible: isSettingsMenuVisible , isYoutubePopupVisible: isYoutubePopupVisible , isLinksharePopupVisible: isLinksharePopupVisible , isVirtualBackgroundPopupVisible: isVirtualBackgroundPopupVisible , isBlockedFeaturePopupOpen: isBlockedFeaturePopupOpen , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
9369
+ const open = isQuickConnectPopupVisible || isSettingsMenuVisible || isYoutubePopupVisible || isBlockedFeaturePopupOpen || isLinksharePopupVisible || isVirtualBackgroundPopupVisible;
9127
9370
  return /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $e1c48a389d8ac959$export$8376625f8bb18347), {
9128
9371
  open: open,
9129
9372
  children: [
@@ -9131,7 +9374,8 @@ const $01986a58bfba8001$var$Settings = ()=>{
9131
9374
  /*#__PURE__*/ (0, $3Sbms$jsx)((0, $c11e4c21ca692a16$export$2e2bcd8739ae039), {}),
9132
9375
  /*#__PURE__*/ (0, $3Sbms$jsx)((0, $49372cd9190da903$export$2e2bcd8739ae039), {}),
9133
9376
  /*#__PURE__*/ (0, $3Sbms$jsx)((0, $98933bbc579a3e66$export$2e2bcd8739ae039), {}),
9134
- /*#__PURE__*/ (0, $3Sbms$jsx)((0, $d493afe60dcea711$export$2e2bcd8739ae039), {})
9377
+ /*#__PURE__*/ (0, $3Sbms$jsx)((0, $d493afe60dcea711$export$2e2bcd8739ae039), {}),
9378
+ /*#__PURE__*/ (0, $3Sbms$jsx)((0, $7d1b559f928daf1f$export$2e2bcd8739ae039), {})
9135
9379
  ]
9136
9380
  });
9137
9381
  };
@@ -10025,6 +10269,9 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
10025
10269
  const [userInteractionTriggered, setUserInteractionTriggered] = (0, $3Sbms$useState)(false);
10026
10270
  const [containerWidth, containerHeight] = (0, $af23c74942bdcae7$export$2b86bedf890eab8)(streamUIContainerRef.current);
10027
10271
  const [isBlockedDevicesPopupOpen, setBlockedDevicesPopupOpen] = (0, $3Sbms$useState)(false);
10272
+ const [isBlockedFeaturePopupOpen, setBlockedFeaturePopupOpen] = (0, $3Sbms$useState)(false);
10273
+ const [permissions, setPermissions] = (0, $3Sbms$useState)([]);
10274
+ const [plan, setPlan] = (0, $3Sbms$useState)(undefined);
10028
10275
  const orientation = (containerWidth || window.screen.width) > (containerHeight || window.screen.height) ? "landscape" : "portrait";
10029
10276
  const styledTheme = theme === "dark" ? (0, $52580db2e49cdd90$export$3e936a8db52a10a0) : (0, $52580db2e49cdd90$export$f30cb9bc4f736419);
10030
10277
  const onWebcamUpdate = (event)=>{
@@ -10153,6 +10400,9 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
10153
10400
  (0, $3Sbms$useEffect)(()=>{
10154
10401
  const onEnterRoom = async (event)=>{
10155
10402
  const peerId = event.detail.peerId;
10403
+ setPlan(event.detail.plan);
10404
+ setPermissions(event.detail.permissions);
10405
+ console.log(event.detail.permissions);
10156
10406
  setSelfPeerId(peerId);
10157
10407
  try {
10158
10408
  await (0, $15a01b611391c1e7$export$494039379563c94d)(options);
@@ -10171,6 +10421,8 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
10171
10421
  ]);
10172
10422
  return /*#__PURE__*/ (0, $3Sbms$jsx)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039).Provider, {
10173
10423
  value: {
10424
+ plan: plan,
10425
+ permissions: permissions,
10174
10426
  selfPeerId: selfPeerId,
10175
10427
  streamUIContainerRef: streamUIContainerRef,
10176
10428
  videosContainerRef: videosContainerRef,
@@ -10187,6 +10439,8 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
10187
10439
  setIsLinksharePopupVisible: setIsLinksharePopupVisible,
10188
10440
  isVirtualBackgroundPopupVisible: isVirtualBackgroundPopupVisible,
10189
10441
  setIsVirtualBackgroundPopupVisible: setIsVirtualBackgroundPopupVisible,
10442
+ isBlockedFeaturePopupOpen: isBlockedFeaturePopupOpen,
10443
+ setBlockedFeaturePopupOpen: setBlockedFeaturePopupOpen,
10190
10444
  theme: theme,
10191
10445
  setTheme: setTheme,
10192
10446
  language: language,
@@ -10720,7 +10974,8 @@ const $24075a5d702d64b3$export$3f94917203ab7078 = {
10720
10974
  getState: (0, $c9e496369b59be7a$export$2f377c2162fd02b2).getState.bind((0, $c9e496369b59be7a$export$2f377c2162fd02b2)),
10721
10975
  setProfile: (0, $c9e496369b59be7a$export$2f377c2162fd02b2).setProfile.bind((0, $c9e496369b59be7a$export$2f377c2162fd02b2)),
10722
10976
  /* Should not be documented */ setConfig: (0, $c9e496369b59be7a$export$2f377c2162fd02b2).setConfig.bind((0, $c9e496369b59be7a$export$2f377c2162fd02b2)),
10723
- setLogLevel: (level)=>(0, $0f65a9eaf4a1e910$export$2e2bcd8739ae039).setLogLevel(level)
10977
+ setLogLevel: (level)=>(0, $0f65a9eaf4a1e910$export$2e2bcd8739ae039).setLogLevel(level),
10978
+ getPermissions: ()=>(0, $c9e496369b59be7a$export$2f377c2162fd02b2).getPermissions()
10724
10979
  };
10725
10980
  window.streamUI = $24075a5d702d64b3$export$3f94917203ab7078;
10726
10981
  // Backward compatibility