@snapcall/stream-ui 1.8.1 → 1.9.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.
@@ -449,11 +449,6 @@ const $18fb8799f38eb407$export$84584c2a98eb6753 = {
449
449
  decline: "Decline",
450
450
  you: "You"
451
451
  },
452
- invite: {
453
- title: "Share link to start a conversation",
454
- copy: "Copy",
455
- description: "You are currently the only participant. Invite people to start the conversation."
456
- },
457
452
  greeting: {
458
453
  mainTitle: "Welcome to SnapCall",
459
454
  sideTitle: "Are you ready to join?",
@@ -594,11 +589,6 @@ const $c5472fb74fa04782$export$acb2a88f7d552ebf = {
594
589
  decline: "D\xe9cliner",
595
590
  you: "Vous"
596
591
  },
597
- invite: {
598
- title: "Partagez le lien pour commencer une conversation",
599
- copy: "Copier",
600
- description: "Vous \xeates actuellement le seul participant. Inviter des personnes pour commencer la conversation."
601
- },
602
592
  greeting: {
603
593
  mainTitle: "Bienvenue sur SnapCall",
604
594
  sideTitle: "Pr\xeat \xe0 rejoindre ?",
@@ -743,11 +733,6 @@ const $b7790fb9e48df5c4$export$3486a10f30cf1ee4 = {
743
733
  decline: "Declinare",
744
734
  you: "Voi"
745
735
  },
746
- invite: {
747
- title: "Condividi link per avviare una conversazione",
748
- copy: "Copiare",
749
- description: "Attualmente sei l'unico partecipante. Invita le persone ad iniziare la conversazione."
750
- },
751
736
  greeting: {
752
737
  mainTitle: "Benvenuto a SnapCall",
753
738
  sideTitle: "Sei pronto per unirti?",
@@ -6259,104 +6244,8 @@ var $b496fc6f0d99c06d$export$2e2bcd8739ae039 = $b496fc6f0d99c06d$var$Highlighted
6259
6244
 
6260
6245
 
6261
6246
 
6262
- const $b56218b5a57cb77c$export$dd2ac23a70f320dd = (0, $3Sbms$styledcomponents).div`
6263
- display: ${({ show: show })=>show ? "flex" : "none"};
6264
- flex-direction: column;
6265
- justify-content: center;
6266
- align-items: center;
6267
- position: relative;
6268
- width: ${({ width: width })=>width};
6269
- height: ${({ height: height })=>height};
6270
- background-color: ${({ theme: theme })=>theme.streamTileBackgroundColor};
6271
- border: 2px solid ${({ theme: theme })=>theme.streamTileBorderColor};
6272
- border-radius: 20px;
6273
- box-sizing: border-box;
6274
- color: #fff;
6275
- font-family: Lato;
6276
- padding: 20px;
6277
- `;
6278
- const $b56218b5a57cb77c$export$2dabfbe763cc7a4 = (0, $3Sbms$styledcomponents).h2`
6279
- font-weight: 600;
6280
- font-size: 16px;
6281
- text-align: center;
6282
- max-width: 300px;
6283
- `;
6284
- const $b56218b5a57cb77c$export$6ed6e36e1b456f96 = (0, $3Sbms$styledcomponents).div`
6285
- position: relative;
6286
- display: flex;
6287
- align-items: center;
6288
- height: 50px;
6289
- width: 100%;
6290
- max-width: 300px;
6291
- background-color: ${({ theme: theme })=>theme.popupBackgroundSecondaryColor};
6292
- border: 1px solid ${({ theme: theme })=>theme.popupBorderColor};
6293
- border-radius: 15px;
6294
- padding: 0 10px;
6295
- box-sizing: border-box;
6296
- `;
6297
- const $b56218b5a57cb77c$export$5f759de1870a3e41 = (0, $3Sbms$styledcomponents).div`
6298
- display: flex;
6299
- align-items: center;
6300
- width: 100%;
6301
- gap: 5px;
6302
-
6303
- svg {
6304
- width: 20px;
6305
- height: 20px;
6306
- }
6307
- `;
6308
- const $b56218b5a57cb77c$export$c6b180e8ec79154e = (0, $3Sbms$styledcomponents).p`
6309
- color: #242324;
6310
- font-size: 15px;
6311
- font-weight: 600;
6312
- width: 100%;
6313
- text-overflow: ellipsis;
6314
- white-space: nowrap;
6315
- overflow: hidden;
6316
- line-height: 15px;
6317
- `;
6318
- const $b56218b5a57cb77c$export$d7f3ab4b3437ad97 = (0, $3Sbms$styledcomponents).button`
6319
- position: absolute;
6320
- right: 5px;
6321
- display: flex;
6322
- justify-content: center;
6323
- align-items: center;
6324
- background-color: ${({ theme: theme })=>theme.primaryColor};
6325
- border: none;
6326
- border-radius: 8px;
6327
- height: 32px;
6328
- color: #fff;
6329
- font-weight: 600;
6330
- font-size: 16px;
6331
- padding: 8px 12px;
6332
- line-height: 18px;
6333
- `;
6334
- const $b56218b5a57cb77c$export$c22678f0e7b404e0 = (0, $3Sbms$styledcomponents).p`
6335
- font-size: 12px;
6336
- font-weight: 400;
6337
- max-width: 300px;
6338
- text-align: center;
6339
- `;
6340
-
6341
-
6342
-
6343
-
6344
6247
 
6345
6248
 
6346
- const $1ec1d06e0a21fdaa$var$Link = ({ color: color })=>{
6347
- return /*#__PURE__*/ (0, $3Sbms$jsx)("svg", {
6348
- width: "24",
6349
- height: "24",
6350
- viewBox: "0 0 24 24",
6351
- fill: "none",
6352
- xmlns: "http://www.w3.org/2000/svg",
6353
- children: /*#__PURE__*/ (0, $3Sbms$jsx)("path", {
6354
- d: "m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1.004 1.004 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1.004 1.004 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1.004 1.004 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.471 2.471 0 0 1 0 3.5l-3.88 3.88a1.002 1.002 0 0 0 .325 1.639.999.999 0 0 0 1.095-.219l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1.004 1.004 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z",
6355
- fill: color || "#fff"
6356
- })
6357
- });
6358
- };
6359
- var $1ec1d06e0a21fdaa$export$2e2bcd8739ae039 = $1ec1d06e0a21fdaa$var$Link;
6360
6249
 
6361
6250
 
6362
6251
 
@@ -6409,67 +6298,6 @@ const $93a0377c243d965e$export$c7df1b15b59b1df2 = /*#__PURE__*/ (0, $3Sbms$jsxs)
6409
6298
  });
6410
6299
 
6411
6300
 
6412
-
6413
-
6414
- const $f0b0b18fe6c6ae77$var$InvitationTile = ({ show: show , orientation: orientation , width: width , height: height })=>{
6415
- const { t: t } = (0, $3Sbms$useTranslation)();
6416
- const { options: options } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
6417
- const onCopyCallLinkClick = async ()=>{
6418
- try {
6419
- await (0, $57162bcada7d6f66$export$2e2bcd8739ae039)(options.sharedURL || window.location.href);
6420
- (0, $a5146f9062d7bf28$export$3a57e165650c636f)(t("copyLink.copied"), {
6421
- duration: 2000
6422
- });
6423
- } catch (copyError) {
6424
- console.warn(copyError);
6425
- (0, $a5146f9062d7bf28$export$3a57e165650c636f)(t("copyLink.error"), {
6426
- icon: (0, $93a0377c243d965e$export$edf27be85e5f6da0)
6427
- });
6428
- }
6429
- };
6430
- return /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $b56218b5a57cb77c$export$dd2ac23a70f320dd), {
6431
- show: show,
6432
- width: width,
6433
- height: height,
6434
- orientation: orientation,
6435
- children: [
6436
- /*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$2dabfbe763cc7a4), {
6437
- children: t("invite.title")
6438
- }),
6439
- /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $b56218b5a57cb77c$export$6ed6e36e1b456f96), {
6440
- children: [
6441
- /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $b56218b5a57cb77c$export$5f759de1870a3e41), {
6442
- children: [
6443
- /*#__PURE__*/ (0, $3Sbms$jsx)((0, $1ec1d06e0a21fdaa$export$2e2bcd8739ae039), {
6444
- color: "black"
6445
- }),
6446
- /*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$c6b180e8ec79154e), {
6447
- children: options.sharedURL || window.location.href
6448
- })
6449
- ]
6450
- }),
6451
- /*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$d7f3ab4b3437ad97), {
6452
- onClick: onCopyCallLinkClick,
6453
- children: t("invite.copy")
6454
- })
6455
- ]
6456
- }),
6457
- /*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$c22678f0e7b404e0), {
6458
- children: t("invite.description")
6459
- })
6460
- ]
6461
- });
6462
- };
6463
- var $f0b0b18fe6c6ae77$export$2e2bcd8739ae039 = $f0b0b18fe6c6ae77$var$InvitationTile;
6464
-
6465
-
6466
-
6467
-
6468
-
6469
-
6470
-
6471
-
6472
-
6473
6301
  const $b8963bf62cf5b984$var$Container = (0, $3Sbms$styledcomponents).div`
6474
6302
  background-color: rgba(45, 45, 45, 0.75);
6475
6303
  display: flex;
@@ -6536,7 +6364,6 @@ const $cdab47bb8796991e$var$Video = ()=>{
6536
6364
  });
6537
6365
  const { streams: streams , highlightedTile: highlightedTile , dispatch: dispatch } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
6538
6366
  const [containerWidth, containerHeight] = (0, $af23c74942bdcae7$export$2b86bedf890eab8)(remoteTilesContainerRef.current);
6539
- const showInvitation = !options.audioTiles && streams.length < 1 && !highlightedTile && containerWidth > 0;
6540
6367
  (0, $3Sbms$useEffect)(()=>{
6541
6368
  if (options.GDPRDisclaimer) (0, $b8963bf62cf5b984$export$2e2bcd8739ae039)({
6542
6369
  message: "Para mejorar la calidad de nuestro servicio, esta llamada ser\xe1 grabada",
@@ -6550,7 +6377,6 @@ const $cdab47bb8796991e$var$Video = ()=>{
6550
6377
  if (remoteTilesContainerRef?.current) {
6551
6378
  const ratio = 1;
6552
6379
  let numberOfTiles = remoteTilesContainerRef.current.childElementCount;
6553
- if (!showInvitation) numberOfTiles -= 1;
6554
6380
  const videoWidth = (0, $b8e10de7c6dba8c4$export$4d43009c33055644)({
6555
6381
  availableWidth: containerWidth - 16 * (numberOfTiles - 1),
6556
6382
  availableHeight: containerHeight - 16 * (numberOfTiles - 1),
@@ -6568,8 +6394,7 @@ const $cdab47bb8796991e$var$Video = ()=>{
6568
6394
  containerWidth,
6569
6395
  containerHeight,
6570
6396
  streams.length,
6571
- highlightedTile,
6572
- showInvitation,
6397
+ highlightedTile
6573
6398
  ]);
6574
6399
  (0, $3Sbms$useEffect)(()=>{
6575
6400
  if (userInteractionTriggered) {
@@ -6723,12 +6548,6 @@ const $cdab47bb8796991e$var$Video = ()=>{
6723
6548
  width: tileSize.width,
6724
6549
  height: tileSize.height
6725
6550
  }, stream.id);
6726
- }),
6727
- /*#__PURE__*/ (0, $3Sbms$jsx)((0, $f0b0b18fe6c6ae77$export$2e2bcd8739ae039), {
6728
- show: showInvitation,
6729
- width: `${tileSize.width}px`,
6730
- height: `${tileSize.height}px`,
6731
- orientation: orientation
6732
6551
  })
6733
6552
  ]
6734
6553
  })
@@ -6860,6 +6679,22 @@ var $a2d206a438475087$export$2e2bcd8739ae039 = $a2d206a438475087$var$YoutubeIcon
6860
6679
 
6861
6680
 
6862
6681
 
6682
+ const $1ec1d06e0a21fdaa$var$Link = ({ color: color })=>{
6683
+ return /*#__PURE__*/ (0, $3Sbms$jsx)("svg", {
6684
+ width: "24",
6685
+ height: "24",
6686
+ viewBox: "0 0 24 24",
6687
+ fill: "none",
6688
+ xmlns: "http://www.w3.org/2000/svg",
6689
+ children: /*#__PURE__*/ (0, $3Sbms$jsx)("path", {
6690
+ d: "m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1.004 1.004 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1.004 1.004 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1.004 1.004 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.471 2.471 0 0 1 0 3.5l-3.88 3.88a1.002 1.002 0 0 0 .325 1.639.999.999 0 0 0 1.095-.219l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1.004 1.004 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z",
6691
+ fill: color || "#fff"
6692
+ })
6693
+ });
6694
+ };
6695
+ var $1ec1d06e0a21fdaa$export$2e2bcd8739ae039 = $1ec1d06e0a21fdaa$var$Link;
6696
+
6697
+
6863
6698
 
6864
6699
 
6865
6700
 
@@ -8701,6 +8536,20 @@ const $554f3984e3212196$export$5e3f251c730829 = (0, $3Sbms$styledcomponents).div
8701
8536
 
8702
8537
 
8703
8538
 
8539
+
8540
+ function $5004d610b358fe2c$export$bc98e171e8c82a3d(title) {
8541
+ (0, $3Sbms$useEffect)(()=>{
8542
+ const prevTitle = document.title;
8543
+ if (title) document.title = title;
8544
+ return ()=>{
8545
+ document.title = prevTitle;
8546
+ };
8547
+ }, [
8548
+ title
8549
+ ]);
8550
+ }
8551
+
8552
+
8704
8553
  const $98933bbc579a3e66$export$a1eac7fdbc2db4af = "linkshare_sent";
8705
8554
  const $98933bbc579a3e66$var$sendLinkNotification = (data, t)=>{
8706
8555
  let notificationStatusText = new URL(data.url).hostname;
@@ -8724,7 +8573,7 @@ const $98933bbc579a3e66$var$sendLinkNotification = (data, t)=>{
8724
8573
  }
8725
8574
  },
8726
8575
  ellipsis: true,
8727
- duration: 10000
8576
+ duration: 15000
8728
8577
  });
8729
8578
  (0, $f81bfa56534026c2$export$e9785ae652b3a722)({
8730
8579
  title: data.title,
@@ -8766,22 +8615,45 @@ const $98933bbc579a3e66$var$LinksharePopup = ()=>{
8766
8615
  const themeContext = (0, $3Sbms$useContext)((0, $3Sbms$ThemeContext));
8767
8616
  const linksharePopupRef = (0, $3Sbms$useRef)(null);
8768
8617
  const linkshareInputRef = (0, $3Sbms$useRef)(null);
8618
+ const [pendingShareLink, setPendingShareLink] = (0, $3Sbms$useState)([]);
8619
+ const [title, setTitle] = (0, $3Sbms$useState)();
8769
8620
  const [linkshareInputValue, setLinkshareInputValue] = (0, $3Sbms$useState)("");
8770
8621
  const [errorMessage, setErrorMessage] = (0, $3Sbms$useState)(null);
8771
8622
  const [status, setStatus] = (0, $3Sbms$useState)("waiting");
8772
8623
  const { isLinksharePopupVisible: isLinksharePopupVisible , setIsLinksharePopupVisible: setIsLinksharePopupVisible , orientation: orientation , options: options } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
8773
8624
  const { streams: streams } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
8625
+ (0, $5004d610b358fe2c$export$bc98e171e8c82a3d)(title);
8774
8626
  const desktop = orientation === "landscape";
8627
+ const onVisibilitychange = (0, $3Sbms$useCallback)(()=>{
8628
+ if (!document.hidden) {
8629
+ pendingShareLink.forEach((data)=>{
8630
+ $98933bbc579a3e66$var$sendLinkNotification(data, t);
8631
+ });
8632
+ setPendingShareLink([]);
8633
+ setTitle(undefined);
8634
+ }
8635
+ }, [
8636
+ pendingShareLink,
8637
+ t
8638
+ ]);
8775
8639
  const onCustomMessage = (0, $3Sbms$useCallback)((event)=>{
8776
8640
  const { type: type , data: data } = event.detail.event;
8777
- if (type === $98933bbc579a3e66$export$a1eac7fdbc2db4af) $98933bbc579a3e66$var$sendLinkNotification(data, t);
8778
- else if (type === "paypal_invoice") {
8779
- const sender = streams.find((stream)=>stream.id === event.detail.peerId);
8780
- $98933bbc579a3e66$var$sendPaypalInvoiceNotification(sender?.profile?.name, data.url, t);
8781
- }
8641
+ const sender = streams.find((stream)=>stream.id === event.detail?.peerId);
8642
+ if (type === $98933bbc579a3e66$export$a1eac7fdbc2db4af) {
8643
+ if (!document.hidden) $98933bbc579a3e66$var$sendLinkNotification(data, t);
8644
+ else {
8645
+ const name = sender?.profile.name?.toLowerCase() !== "user" ? sender?.profile.name : undefined;
8646
+ setPendingShareLink([
8647
+ ...pendingShareLink,
8648
+ data
8649
+ ]);
8650
+ setTitle(`${name || "Someone"} shared a link`);
8651
+ }
8652
+ } else if (type === "paypal_invoice") $98933bbc579a3e66$var$sendPaypalInvoiceNotification(sender?.profile?.name, data.url, t);
8782
8653
  }, [
8783
8654
  streams,
8784
- t
8655
+ t,
8656
+ pendingShareLink
8785
8657
  ]);
8786
8658
  const onShareClick = async (event)=>{
8787
8659
  event.preventDefault();
@@ -8836,12 +8708,15 @@ const $98933bbc579a3e66$var$LinksharePopup = ()=>{
8836
8708
  };
8837
8709
  const onCloseClick = ()=>setIsLinksharePopupVisible(false);
8838
8710
  (0, $3Sbms$useEffect)(()=>{
8711
+ window.addEventListener("visibilitychange", onVisibilitychange);
8839
8712
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("customMessage", onCustomMessage);
8840
8713
  return ()=>{
8714
+ window.removeEventListener("visibilitychange", onVisibilitychange);
8841
8715
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("customMessage", onCustomMessage);
8842
8716
  };
8843
8717
  }, [
8844
- onCustomMessage
8718
+ onCustomMessage,
8719
+ onVisibilitychange
8845
8720
  ]);
8846
8721
  const onPopupTransitionEnd = ()=>{
8847
8722
  if (isLinksharePopupVisible) linkshareInputRef.current?.focus();
@@ -9357,10 +9232,12 @@ var $df41bfe6da05853a$export$2e2bcd8739ae039 = $df41bfe6da05853a$var$EndView;
9357
9232
 
9358
9233
 
9359
9234
 
9235
+
9360
9236
  const $805d92fa41e6e1b0$var$connected = new Audio("https://cdn.snapcall.io/stream/connected.mp3");
9361
9237
  const $805d92fa41e6e1b0$var$disconnected = new Audio("https://cdn.snapcall.io/stream/disconnected.mp3");
9362
9238
  const $805d92fa41e6e1b0$var$userConnected = new Audio("https://cdn.snapcall.io/stream/user-connected.mp3");
9363
9239
  const $805d92fa41e6e1b0$var$userDisconnected = new Audio("https://cdn.snapcall.io/stream/user-disconnected.mp3");
9240
+ const $805d92fa41e6e1b0$var$linkReceived = new Audio("https://cdn.snapcall.io/stream/link-received.mp3");
9364
9241
  const $805d92fa41e6e1b0$var$Sounds = ()=>{
9365
9242
  const { userInteractionTriggered: userInteractionTriggered } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
9366
9243
  const onEnterRoom = async ()=>{
@@ -9393,14 +9270,24 @@ const $805d92fa41e6e1b0$var$Sounds = ()=>{
9393
9270
  console.warn("Couldn't play disconnected sound");
9394
9271
  }
9395
9272
  };
9273
+ const onCustomMessage = async (event)=>{
9274
+ const { type: type } = event.detail.event;
9275
+ if (type === (0, $98933bbc579a3e66$export$a1eac7fdbc2db4af)) try {
9276
+ await $805d92fa41e6e1b0$var$linkReceived.play();
9277
+ } catch (disconnectedPlayError) {
9278
+ console.warn("Couldn't play link-received sound");
9279
+ }
9280
+ };
9396
9281
  (0, $3Sbms$useEffect)(()=>{
9397
9282
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("newPeer", onNewPeer);
9398
9283
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("peerClosed", onPeerClosed);
9399
9284
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("leaveRoom", onLeaveRoom);
9285
+ (0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("customMessage", onCustomMessage);
9400
9286
  return ()=>{
9401
9287
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("newPeer", onNewPeer);
9402
9288
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("peerClosed", onPeerClosed);
9403
9289
  (0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("leaveRoom", onLeaveRoom);
9290
+ (0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("customMessage", onCustomMessage);
9404
9291
  };
9405
9292
  }, []);
9406
9293
  (0, $3Sbms$useEffect)(()=>{