@robono/calling-react-native 0.4.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.5.0 — unreleased
2
+
3
+ Add the shared Messenger calling manager for account-scoped direct/group controllers, cleanup, idle renewal, notification opening and unanswered-call prompts. Accept provider string sequence values without changing call authorization.
4
+
1
5
  # Changelog
2
6
 
3
7
  ## 0.4.0
package/SBOM.spdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "spdxVersion": "SPDX-2.3",
3
3
  "dataLicense": "CC0-1.0",
4
4
  "SPDXID": "SPDXRef-DOCUMENT",
5
- "name": "@robono/calling-react-native@0.4.0",
6
- "documentNamespace": "https://robono.com/sbom/calling-react-native/0.4.0/476645ec9acc2476abdde50bd956a1ded87ceb9e",
5
+ "name": "@robono/calling-react-native@0.5.0",
6
+ "documentNamespace": "https://robono.com/sbom/calling-react-native/0.5.0/ca09522a06a3e57bbb2186ce3e57b30a29adde97",
7
7
  "creationInfo": {
8
- "created": "2026-10-31T09:48:43.706Z",
8
+ "created": "2026-11-04T11:32:58.056Z",
9
9
  "creators": [
10
10
  "Organization: Robono (support@robono.com)"
11
11
  ]
@@ -14,11 +14,11 @@
14
14
  {
15
15
  "name": "@robono/calling-react-native",
16
16
  "SPDXID": "SPDXRef-Package",
17
- "versionInfo": "0.4.0",
17
+ "versionInfo": "0.5.0",
18
18
  "downloadLocation": "NOASSERTION",
19
19
  "filesAnalyzed": true,
20
20
  "packageVerificationCode": {
21
- "packageVerificationCodeValue": "476645ec9acc2476abdde50bd956a1ded87ceb9e"
21
+ "packageVerificationCodeValue": "ca09522a06a3e57bbb2186ce3e57b30a29adde97"
22
22
  },
23
23
  "licenseConcluded": "LicenseRef-RobonoSDK",
24
24
  "licenseDeclared": "LicenseRef-RobonoSDK",
@@ -26,7 +26,7 @@
26
26
  "LicenseRef-RobonoSDK"
27
27
  ],
28
28
  "copyrightText": "Copyright (c) 2026 Add to Loop LLC.",
29
- "comment": "Host-supplied peers (not bundled): {\"@robono/calling\":\"^0.3.0\",\"react\":\">=18.2 <20\",\"react-native\":\">=0.76 <1\",\"react-native-svg\":\">=15 <16\",\"react-native-safe-area-context\":\">=5 <6\",\"react-native-webrtc\":\">=124 <125\",\"react-native-incall-manager\":\">=4.2 <5\",\"expo-audio\":\">=1.1.1 <2 || >=55 <57\",\"expo-crypto\":\">=15.0.9 <16 || >=55 <57\",\"expo-notifications\":\">=0.32.17 <0.33 || >=55 <57\",\"expo-asset\":\">=12 <13 || >=55 <57\"}"
29
+ "comment": "Host-supplied peers (not bundled): {\"@robono/calling\":\"^0.4.0\",\"react\":\">=18.2 <20\",\"react-native\":\">=0.76 <1\",\"react-native-svg\":\">=15 <16\",\"react-native-safe-area-context\":\">=5 <6\",\"react-native-webrtc\":\">=124 <125\",\"react-native-incall-manager\":\">=4.2 <5\",\"expo-audio\":\">=1.1.1 <2 || >=55 <57\",\"expo-crypto\":\">=15.0.9 <16 || >=55 <57\",\"expo-notifications\":\">=0.32.17 <0.33 || >=55 <57\",\"expo-asset\":\">=12 <13 || >=55 <57\"}"
30
30
  }
31
31
  ],
32
32
  "files": [
@@ -36,11 +36,11 @@
36
36
  "checksums": [
37
37
  {
38
38
  "algorithm": "SHA256",
39
- "checksumValue": "4d7db9b3437c6a3526dcbded3ff3bfd53fede53d4b71f64ca7be0aafb840bf87"
39
+ "checksumValue": "605e536f0109595ae3613ce88cf87bcd300d8fcd6642ffe2c8bf57f54da06de6"
40
40
  },
41
41
  {
42
42
  "algorithm": "SHA1",
43
- "checksumValue": "bce89a51d331669235a07e4014be5141effbbf38"
43
+ "checksumValue": "1e1ef07d474c629d6137c9fb38c626f7c4666bfa"
44
44
  }
45
45
  ],
46
46
  "licenseConcluded": "LicenseRef-RobonoSDK",
@@ -5503,8 +5503,46 @@
5503
5503
  "copyrightText": "Copyright (c) 2026 Add to Loop LLC."
5504
5504
  },
5505
5505
  {
5506
- "fileName": "./dist/native-video.d.ts",
5506
+ "fileName": "./dist/messenger.d.ts",
5507
5507
  "SPDXID": "SPDXRef-File-288",
5508
+ "checksums": [
5509
+ {
5510
+ "algorithm": "SHA256",
5511
+ "checksumValue": "6fef88594f1234cc5c4ac82469c2fddc9bdd3da7ae88a2ba508f2f9099a30e94"
5512
+ },
5513
+ {
5514
+ "algorithm": "SHA1",
5515
+ "checksumValue": "2d60af12011669fa33bbc8670704d930d105e062"
5516
+ }
5517
+ ],
5518
+ "licenseConcluded": "LicenseRef-RobonoSDK",
5519
+ "licenseInfoInFiles": [
5520
+ "LicenseRef-RobonoSDK"
5521
+ ],
5522
+ "copyrightText": "Copyright (c) 2026 Add to Loop LLC."
5523
+ },
5524
+ {
5525
+ "fileName": "./dist/messenger.js",
5526
+ "SPDXID": "SPDXRef-File-289",
5527
+ "checksums": [
5528
+ {
5529
+ "algorithm": "SHA256",
5530
+ "checksumValue": "72f3b077c5b43f1ba08273693e0160284864873af884f9b0e99874452f2b7c48"
5531
+ },
5532
+ {
5533
+ "algorithm": "SHA1",
5534
+ "checksumValue": "c4e457f52759171201fe6fdfe0cc71583ea51387"
5535
+ }
5536
+ ],
5537
+ "licenseConcluded": "LicenseRef-RobonoSDK",
5538
+ "licenseInfoInFiles": [
5539
+ "LicenseRef-RobonoSDK"
5540
+ ],
5541
+ "copyrightText": "Copyright (c) 2026 Add to Loop LLC."
5542
+ },
5543
+ {
5544
+ "fileName": "./dist/native-video.d.ts",
5545
+ "SPDXID": "SPDXRef-File-290",
5508
5546
  "checksums": [
5509
5547
  {
5510
5548
  "algorithm": "SHA256",
@@ -5523,7 +5561,7 @@
5523
5561
  },
5524
5562
  {
5525
5563
  "fileName": "./dist/native-video.js",
5526
- "SPDXID": "SPDXRef-File-289",
5564
+ "SPDXID": "SPDXRef-File-291",
5527
5565
  "checksums": [
5528
5566
  {
5529
5567
  "algorithm": "SHA256",
@@ -5542,7 +5580,7 @@
5542
5580
  },
5543
5581
  {
5544
5582
  "fileName": "./dist/native.d.ts",
5545
- "SPDXID": "SPDXRef-File-290",
5583
+ "SPDXID": "SPDXRef-File-292",
5546
5584
  "checksums": [
5547
5585
  {
5548
5586
  "algorithm": "SHA256",
@@ -5561,7 +5599,7 @@
5561
5599
  },
5562
5600
  {
5563
5601
  "fileName": "./dist/native.js",
5564
- "SPDXID": "SPDXRef-File-291",
5602
+ "SPDXID": "SPDXRef-File-293",
5565
5603
  "checksums": [
5566
5604
  {
5567
5605
  "algorithm": "SHA256",
@@ -5580,7 +5618,7 @@
5580
5618
  },
5581
5619
  {
5582
5620
  "fileName": "./dist/notification-router.d.ts",
5583
- "SPDXID": "SPDXRef-File-292",
5621
+ "SPDXID": "SPDXRef-File-294",
5584
5622
  "checksums": [
5585
5623
  {
5586
5624
  "algorithm": "SHA256",
@@ -5599,7 +5637,7 @@
5599
5637
  },
5600
5638
  {
5601
5639
  "fileName": "./dist/notification-router.js",
5602
- "SPDXID": "SPDXRef-File-293",
5640
+ "SPDXID": "SPDXRef-File-295",
5603
5641
  "checksums": [
5604
5642
  {
5605
5643
  "algorithm": "SHA256",
@@ -5618,7 +5656,7 @@
5618
5656
  },
5619
5657
  {
5620
5658
  "fileName": "./dist/notifications.d.ts",
5621
- "SPDXID": "SPDXRef-File-294",
5659
+ "SPDXID": "SPDXRef-File-296",
5622
5660
  "checksums": [
5623
5661
  {
5624
5662
  "algorithm": "SHA256",
@@ -5637,15 +5675,15 @@
5637
5675
  },
5638
5676
  {
5639
5677
  "fileName": "./dist/notifications.js",
5640
- "SPDXID": "SPDXRef-File-295",
5678
+ "SPDXID": "SPDXRef-File-297",
5641
5679
  "checksums": [
5642
5680
  {
5643
5681
  "algorithm": "SHA256",
5644
- "checksumValue": "cf39453071bf6d4f1b900b42f86a20ffc047935465bbd432912f4f7d6fe816d7"
5682
+ "checksumValue": "ab90959498ffc7eeb5a4b53a7e1f508c2271c693d9d413c3d41c351be0d9c8db"
5645
5683
  },
5646
5684
  {
5647
5685
  "algorithm": "SHA1",
5648
- "checksumValue": "0d307892ffbe0505909fa3f5496555ef48dc8200"
5686
+ "checksumValue": "1ebb445b5ec8377641b1dc2add71f57da00292d0"
5649
5687
  }
5650
5688
  ],
5651
5689
  "licenseConcluded": "LicenseRef-RobonoSDK",
@@ -5656,7 +5694,7 @@
5656
5694
  },
5657
5695
  {
5658
5696
  "fileName": "./dist/runtime.d.ts",
5659
- "SPDXID": "SPDXRef-File-296",
5697
+ "SPDXID": "SPDXRef-File-298",
5660
5698
  "checksums": [
5661
5699
  {
5662
5700
  "algorithm": "SHA256",
@@ -5675,7 +5713,7 @@
5675
5713
  },
5676
5714
  {
5677
5715
  "fileName": "./dist/runtime.js",
5678
- "SPDXID": "SPDXRef-File-297",
5716
+ "SPDXID": "SPDXRef-File-299",
5679
5717
  "checksums": [
5680
5718
  {
5681
5719
  "algorithm": "SHA256",
@@ -5694,7 +5732,7 @@
5694
5732
  },
5695
5733
  {
5696
5734
  "fileName": "./dist/screens.d.ts",
5697
- "SPDXID": "SPDXRef-File-298",
5735
+ "SPDXID": "SPDXRef-File-300",
5698
5736
  "checksums": [
5699
5737
  {
5700
5738
  "algorithm": "SHA256",
@@ -5713,7 +5751,7 @@
5713
5751
  },
5714
5752
  {
5715
5753
  "fileName": "./dist/screens.js",
5716
- "SPDXID": "SPDXRef-File-299",
5754
+ "SPDXID": "SPDXRef-File-301",
5717
5755
  "checksums": [
5718
5756
  {
5719
5757
  "algorithm": "SHA256",
@@ -5732,7 +5770,7 @@
5732
5770
  },
5733
5771
  {
5734
5772
  "fileName": "./dist/types.d.ts",
5735
- "SPDXID": "SPDXRef-File-300",
5773
+ "SPDXID": "SPDXRef-File-302",
5736
5774
  "checksums": [
5737
5775
  {
5738
5776
  "algorithm": "SHA256",
@@ -5751,7 +5789,7 @@
5751
5789
  },
5752
5790
  {
5753
5791
  "fileName": "./dist/types.js",
5754
- "SPDXID": "SPDXRef-File-301",
5792
+ "SPDXID": "SPDXRef-File-303",
5755
5793
  "checksums": [
5756
5794
  {
5757
5795
  "algorithm": "SHA256",
@@ -5770,15 +5808,15 @@
5770
5808
  },
5771
5809
  {
5772
5810
  "fileName": "./dist/versions.d.ts",
5773
- "SPDXID": "SPDXRef-File-302",
5811
+ "SPDXID": "SPDXRef-File-304",
5774
5812
  "checksums": [
5775
5813
  {
5776
5814
  "algorithm": "SHA256",
5777
- "checksumValue": "bc140fe970552eb23985f4e1a40ac6c0e353c7e09c201ae198403302ce4d039e"
5815
+ "checksumValue": "e901b2760d88c61656d1f61dfd67496270d15f813fb2c93caf4dd56eb349eaea"
5778
5816
  },
5779
5817
  {
5780
5818
  "algorithm": "SHA1",
5781
- "checksumValue": "43be2969cee4a8e9b68ea2531af48d9cf82a35cb"
5819
+ "checksumValue": "4d871421123e99031dfbea25270f171a43636b18"
5782
5820
  }
5783
5821
  ],
5784
5822
  "licenseConcluded": "LicenseRef-RobonoSDK",
@@ -5789,15 +5827,15 @@
5789
5827
  },
5790
5828
  {
5791
5829
  "fileName": "./dist/versions.js",
5792
- "SPDXID": "SPDXRef-File-303",
5830
+ "SPDXID": "SPDXRef-File-305",
5793
5831
  "checksums": [
5794
5832
  {
5795
5833
  "algorithm": "SHA256",
5796
- "checksumValue": "03ff2ed909e8c6a2c91d54f1230a42581dfdce48fa056f3b71f0d965904cb0f8"
5834
+ "checksumValue": "fae782c6480a5fd0229473d5729eb1ee28794439a8806044d53a6e714121226d"
5797
5835
  },
5798
5836
  {
5799
5837
  "algorithm": "SHA1",
5800
- "checksumValue": "23eea5ff6ecd4b3c481565bdb5d63c40856ab762"
5838
+ "checksumValue": "9c3f166a31eaed801574f9824478e7f9fd4815e2"
5801
5839
  }
5802
5840
  ],
5803
5841
  "licenseConcluded": "LicenseRef-RobonoSDK",
@@ -5808,7 +5846,7 @@
5808
5846
  },
5809
5847
  {
5810
5848
  "fileName": "./dist/visual/icon-nodes.d.ts",
5811
- "SPDXID": "SPDXRef-File-304",
5849
+ "SPDXID": "SPDXRef-File-306",
5812
5850
  "checksums": [
5813
5851
  {
5814
5852
  "algorithm": "SHA256",
@@ -5827,7 +5865,7 @@
5827
5865
  },
5828
5866
  {
5829
5867
  "fileName": "./dist/visual/icon-nodes.js",
5830
- "SPDXID": "SPDXRef-File-305",
5868
+ "SPDXID": "SPDXRef-File-307",
5831
5869
  "checksums": [
5832
5870
  {
5833
5871
  "algorithm": "SHA256",
@@ -5846,7 +5884,7 @@
5846
5884
  },
5847
5885
  {
5848
5886
  "fileName": "./dist/visual/icon-paths.d.ts",
5849
- "SPDXID": "SPDXRef-File-306",
5887
+ "SPDXID": "SPDXRef-File-308",
5850
5888
  "checksums": [
5851
5889
  {
5852
5890
  "algorithm": "SHA256",
@@ -5865,7 +5903,7 @@
5865
5903
  },
5866
5904
  {
5867
5905
  "fileName": "./dist/visual/icon-paths.js",
5868
- "SPDXID": "SPDXRef-File-307",
5906
+ "SPDXID": "SPDXRef-File-309",
5869
5907
  "checksums": [
5870
5908
  {
5871
5909
  "algorithm": "SHA256",
@@ -5884,7 +5922,7 @@
5884
5922
  },
5885
5923
  {
5886
5924
  "fileName": "./dist/visual/RobonoIcon.d.ts",
5887
- "SPDXID": "SPDXRef-File-308",
5925
+ "SPDXID": "SPDXRef-File-310",
5888
5926
  "checksums": [
5889
5927
  {
5890
5928
  "algorithm": "SHA256",
@@ -5903,15 +5941,15 @@
5903
5941
  },
5904
5942
  {
5905
5943
  "fileName": "./dist/visual/RobonoIcon.js",
5906
- "SPDXID": "SPDXRef-File-309",
5944
+ "SPDXID": "SPDXRef-File-311",
5907
5945
  "checksums": [
5908
5946
  {
5909
5947
  "algorithm": "SHA256",
5910
- "checksumValue": "9933256286068b06d46178fe57749318c32d67ae91bc4949ed061d37955dc971"
5948
+ "checksumValue": "def8b0fd606ea026f4329e7671c23dc761c9154067486fcbd13cff238db3237c"
5911
5949
  },
5912
5950
  {
5913
5951
  "algorithm": "SHA1",
5914
- "checksumValue": "1bcb3eb4eb657719a0bd56f4fee143ff34f9312d"
5952
+ "checksumValue": "c3d21e7558a4bf11a00419ff2714cc16795e8866"
5915
5953
  }
5916
5954
  ],
5917
5955
  "licenseConcluded": "LicenseRef-RobonoSDK",
@@ -5922,7 +5960,7 @@
5922
5960
  },
5923
5961
  {
5924
5962
  "fileName": "./examples/CallingHost.tsx",
5925
- "SPDXID": "SPDXRef-File-310",
5963
+ "SPDXID": "SPDXRef-File-312",
5926
5964
  "checksums": [
5927
5965
  {
5928
5966
  "algorithm": "SHA256",
@@ -5941,7 +5979,7 @@
5941
5979
  },
5942
5980
  {
5943
5981
  "fileName": "./examples/CustomCallingScreen.tsx",
5944
- "SPDXID": "SPDXRef-File-311",
5982
+ "SPDXID": "SPDXRef-File-313",
5945
5983
  "checksums": [
5946
5984
  {
5947
5985
  "algorithm": "SHA256",
@@ -5960,7 +5998,7 @@
5960
5998
  },
5961
5999
  {
5962
6000
  "fileName": "./examples/ExpoCallingHost.tsx",
5963
- "SPDXID": "SPDXRef-File-312",
6001
+ "SPDXID": "SPDXRef-File-314",
5964
6002
  "checksums": [
5965
6003
  {
5966
6004
  "algorithm": "SHA256",
@@ -5979,7 +6017,7 @@
5979
6017
  },
5980
6018
  {
5981
6019
  "fileName": "./examples/ExpoGroupCallingHost.tsx",
5982
- "SPDXID": "SPDXRef-File-313",
6020
+ "SPDXID": "SPDXRef-File-315",
5983
6021
  "checksums": [
5984
6022
  {
5985
6023
  "algorithm": "SHA256",
@@ -5998,7 +6036,7 @@
5998
6036
  },
5999
6037
  {
6000
6038
  "fileName": "./examples/GroupCallingHost.tsx",
6001
- "SPDXID": "SPDXRef-File-314",
6039
+ "SPDXID": "SPDXRef-File-316",
6002
6040
  "checksums": [
6003
6041
  {
6004
6042
  "algorithm": "SHA256",
@@ -6017,7 +6055,7 @@
6017
6055
  },
6018
6056
  {
6019
6057
  "fileName": "./ios/RobonoCallingRuntime.m",
6020
- "SPDXID": "SPDXRef-File-315",
6058
+ "SPDXID": "SPDXRef-File-317",
6021
6059
  "checksums": [
6022
6060
  {
6023
6061
  "algorithm": "SHA256",
@@ -6036,7 +6074,7 @@
6036
6074
  },
6037
6075
  {
6038
6076
  "fileName": "./licenses/robono-icons-lucide-license.txt",
6039
- "SPDXID": "SPDXRef-File-316",
6077
+ "SPDXID": "SPDXRef-File-318",
6040
6078
  "checksums": [
6041
6079
  {
6042
6080
  "algorithm": "SHA256",
@@ -6055,7 +6093,7 @@
6055
6093
  },
6056
6094
  {
6057
6095
  "fileName": "./licenses/robono-icons-weather-attribution.txt",
6058
- "SPDXID": "SPDXRef-File-317",
6096
+ "SPDXID": "SPDXRef-File-319",
6059
6097
  "checksums": [
6060
6098
  {
6061
6099
  "algorithm": "SHA256",
@@ -6074,7 +6112,7 @@
6074
6112
  },
6075
6113
  {
6076
6114
  "fileName": "./licenses/robono-icons-weather-license.txt",
6077
- "SPDXID": "SPDXRef-File-318",
6115
+ "SPDXID": "SPDXRef-File-320",
6078
6116
  "checksums": [
6079
6117
  {
6080
6118
  "algorithm": "SHA256",
@@ -6093,15 +6131,15 @@
6093
6131
  },
6094
6132
  {
6095
6133
  "fileName": "./package.json",
6096
- "SPDXID": "SPDXRef-File-319",
6134
+ "SPDXID": "SPDXRef-File-321",
6097
6135
  "checksums": [
6098
6136
  {
6099
6137
  "algorithm": "SHA256",
6100
- "checksumValue": "849ef5479bd46ff9362a9c94636f2cd18e18bd868ab92431cf1cd5f35a02ab61"
6138
+ "checksumValue": "e384b434df283b59d1e5d29e314beeeeb0335b294e0e82959be16ee7e20681b2"
6101
6139
  },
6102
6140
  {
6103
6141
  "algorithm": "SHA1",
6104
- "checksumValue": "bccdf63d63a6c8abad7ced40a0f71df972cc2fff"
6142
+ "checksumValue": "411294028f08e3e3b227eb47b543ee725fdbbd8a"
6105
6143
  }
6106
6144
  ],
6107
6145
  "licenseConcluded": "LicenseRef-RobonoSDK",
@@ -6112,7 +6150,7 @@
6112
6150
  },
6113
6151
  {
6114
6152
  "fileName": "./plugin/screensharing.cjs",
6115
- "SPDXID": "SPDXRef-File-320",
6153
+ "SPDXID": "SPDXRef-File-322",
6116
6154
  "checksums": [
6117
6155
  {
6118
6156
  "algorithm": "SHA256",
@@ -6131,7 +6169,7 @@
6131
6169
  },
6132
6170
  {
6133
6171
  "fileName": "./react-native.config.js",
6134
- "SPDXID": "SPDXRef-File-321",
6172
+ "SPDXID": "SPDXRef-File-323",
6135
6173
  "checksums": [
6136
6174
  {
6137
6175
  "algorithm": "SHA256",
@@ -7764,6 +7802,16 @@
7764
7802
  "spdxElementId": "SPDXRef-Package",
7765
7803
  "relationshipType": "CONTAINS",
7766
7804
  "relatedSpdxElement": "SPDXRef-File-321"
7805
+ },
7806
+ {
7807
+ "spdxElementId": "SPDXRef-Package",
7808
+ "relationshipType": "CONTAINS",
7809
+ "relatedSpdxElement": "SPDXRef-File-322"
7810
+ },
7811
+ {
7812
+ "spdxElementId": "SPDXRef-Package",
7813
+ "relationshipType": "CONTAINS",
7814
+ "relatedSpdxElement": "SPDXRef-File-323"
7767
7815
  }
7768
7816
  ],
7769
7817
  "hasExtractedLicensingInfos": [
@@ -0,0 +1,42 @@
1
+ import { type MessengerCallingTransport } from '@robono/calling/messenger';
2
+ import { type GroupCallingController } from './groups.js';
3
+ import { type CallingAppearance } from './appearance.js';
4
+ import type { CallingController, CallingOptions, Contact } from './types.js';
5
+ export interface MessengerCallingState {
6
+ direct: CallingController | null;
7
+ group: GroupCallingController | null;
8
+ appearance?: CallingAppearance;
9
+ features: MessengerCallingTransport['features'];
10
+ unanswered?: {
11
+ id: string;
12
+ conversationId: string;
13
+ };
14
+ loading: boolean;
15
+ error: string;
16
+ }
17
+ export interface MessengerCallAdapters extends Pick<CallingOptions, 'media' | 'audio'> {
18
+ attach?(controller: CallingController | GroupCallingController): () => void;
19
+ dispose?(): Promise<void>;
20
+ /** Browser audio is unlocked by the initiating tap, before any network wait. */
21
+ prime?(): void;
22
+ }
23
+ export interface MessengerCallingOptions {
24
+ request: (operation: string, input: Record<string, unknown>) => Promise<any>;
25
+ adapters: (appearance: CallingAppearance) => MessengerCallAdapters;
26
+ resolveContact?: (conversationId: string) => Contact | null;
27
+ resolveMember?: (appId: string, userId: string) => Contact | null;
28
+ onUnansweredCall?: CallingOptions['onUnansweredCall'];
29
+ }
30
+ /** Account-scoped calls. Owns renewal, listeners and cleanup across navigation. */
31
+ export declare function createMessengerCalling(options: MessengerCallingOptions): {
32
+ start: () => Promise<void>;
33
+ getSnapshot: () => MessengerCallingState;
34
+ subscribe(fn: () => void): () => void;
35
+ isActive: () => boolean;
36
+ dismissUnanswered(): void;
37
+ notification(data: unknown, opened?: boolean): Promise<boolean>;
38
+ prime(): void;
39
+ call(conversationId: string, kind: "voice" | "video", group?: boolean): Promise<void>;
40
+ dispose(): Promise<void>;
41
+ };
42
+ export type MessengerCalling = ReturnType<typeof createMessengerCalling>;
@@ -0,0 +1,130 @@
1
+ import { createMessengerCallingTransport } from '@robono/calling/messenger';
2
+ import { createCallingController } from './index.js';
3
+ import { createGroupCallingController } from './groups.js';
4
+ import { validateCallingAppearance } from './appearance.js';
5
+ import { parseCallingNotification } from './notifications.js';
6
+ /** Account-scoped calls. Owns renewal, listeners and cleanup across navigation. */
7
+ export function createMessengerCalling(options) {
8
+ let state = { direct: null, group: null, features: { voice: false, video: false }, loading: false, error: '' };
9
+ let closed = false, pending = null, transport, timer;
10
+ let adapters = [], detach = [];
11
+ const dismissed = new Set();
12
+ const listeners = new Set();
13
+ const emit = (patch) => { state = { ...state, ...patch }; listeners.forEach(fn => fn()); };
14
+ const active = () => [state.direct, state.group].some(c => c && !['idle', 'error'].includes(c.getSnapshot().phase));
15
+ const release = async () => {
16
+ clearTimeout(timer);
17
+ const controllers = [state.direct, state.group], old = transport, owned = adapters;
18
+ transport = undefined;
19
+ adapters = [];
20
+ detach.splice(0).forEach(fn => fn());
21
+ emit({ direct: null, group: null });
22
+ await Promise.allSettled(controllers.map(c => c?.dispose()));
23
+ await Promise.allSettled(owned.map(a => a.dispose?.()));
24
+ await old?.dispose().catch(() => { });
25
+ };
26
+ const renew = () => {
27
+ clearTimeout(timer);
28
+ if (closed || !transport)
29
+ return;
30
+ timer = setTimeout(() => {
31
+ // Do not replace the controlling session in the middle of a call.
32
+ if (active()) {
33
+ timer = setTimeout(renew, 15000);
34
+ return;
35
+ }
36
+ void release().then(() => start()).catch(() => { });
37
+ }, Math.max(1000, Math.min(2147483647, transport.expiresAt - Date.now() - 60000)));
38
+ };
39
+ const start = () => {
40
+ if (closed)
41
+ return Promise.reject(Error('Calling has been closed.'));
42
+ if (pending)
43
+ return pending;
44
+ if (transport && Date.now() < transport.expiresAt && !state.direct?.client.closed && !state.group?.client.closed)
45
+ return Promise.resolve();
46
+ emit({ loading: true, error: '' });
47
+ pending = (async () => {
48
+ await release();
49
+ const session = await createMessengerCallingTransport({ request: options.request });
50
+ if (closed) {
51
+ await session.dispose();
52
+ return;
53
+ }
54
+ transport = session;
55
+ const appearance = validateCallingAppearance(session.appearance);
56
+ if (!session.features.voice && !session.features.video) {
57
+ emit({ appearance, features: session.features, loading: false });
58
+ renew();
59
+ return;
60
+ }
61
+ const make = () => { const adapter = options.adapters(appearance); adapters.push(adapter); return adapter; };
62
+ const directAdapter = make();
63
+ const direct = createCallingController({ ...directAdapter, request: session.request, appearanceRevision: session.revision, resolveContact: options.resolveContact, onUnansweredCall: call => { emit({ unanswered: { id: call.id, conversationId: call.connectionId } }); options.onUnansweredCall?.(call); } });
64
+ emit({ direct, appearance, features: session.features });
65
+ const directDetach = directAdapter.attach?.(direct);
66
+ if (directDetach)
67
+ detach.push(directDetach);
68
+ if (session.features.groups) {
69
+ const groupAdapter = make(), group = createGroupCallingController({ ...groupAdapter, request: session.request, appearanceRevision: session.revision, resolveGroup: options.resolveContact, resolveMember: options.resolveMember });
70
+ emit({ group });
71
+ const groupDetach = groupAdapter.attach?.(group);
72
+ if (groupDetach)
73
+ detach.push(groupDetach);
74
+ }
75
+ await Promise.all([direct.listen(), state.group?.listen()]);
76
+ if (closed) {
77
+ await release();
78
+ return;
79
+ }
80
+ emit({ loading: false, error: '' });
81
+ renew();
82
+ })().catch(async (error) => { await release(); if (!closed)
83
+ emit({ loading: false, error: 'Calls could not connect. Check your connection and try again.' }); throw error; }).finally(() => { pending = null; });
84
+ return pending;
85
+ };
86
+ return {
87
+ start, getSnapshot: () => state, subscribe(fn) { listeners.add(fn); return () => { listeners.delete(fn); }; },
88
+ isActive: active,
89
+ dismissUnanswered() { emit({ unanswered: undefined }); },
90
+ async notification(data, opened = false) {
91
+ const event = parseCallingNotification(data) || parseCallingNotification(data, true);
92
+ if (!event || closed)
93
+ return false;
94
+ const isDismissed = event.sequence === 2 || Date.parse(event.ring_expires_at) <= Date.now();
95
+ if (isDismissed) {
96
+ dismissed.add(event.call_id);
97
+ if (dismissed.size > 100)
98
+ dismissed.delete(dismissed.values().next().value);
99
+ }
100
+ await start();
101
+ if (closed)
102
+ return false;
103
+ const controller = event.event.startsWith('calling.group_') ? state.group : state.direct;
104
+ if (!controller)
105
+ return false;
106
+ if (isDismissed || dismissed.has(event.call_id) || !opened) {
107
+ await controller.refresh();
108
+ return true;
109
+ }
110
+ await controller.openIncoming(event.call_id);
111
+ return true;
112
+ },
113
+ prime() { adapters.forEach(a => a.prime?.()); },
114
+ async call(conversationId, kind, group = false) {
115
+ // Retain the browser's user activation before awaiting admission.
116
+ adapters.forEach(a => a.prime?.());
117
+ await start();
118
+ if (active())
119
+ throw Error('Finish the current call first.');
120
+ if (!state.features[kind] || group && !state.group)
121
+ throw Error('This call type is not available.');
122
+ if (group)
123
+ await state.group.call(conversationId, { kind });
124
+ else
125
+ await state.direct.call(conversationId, undefined, { kind });
126
+ },
127
+ async dispose() { if (closed)
128
+ return; closed = true; clearTimeout(timer); await pending?.catch(() => { }); await release(); listeners.clear(); },
129
+ };
130
+ }
@@ -33,9 +33,9 @@ export function parseCallingNotification(data, group = false) {
33
33
  return null;
34
34
  if (typeof p.ring_expires_at !== 'string' || !Number.isFinite(Date.parse(p.ring_expires_at)))
35
35
  return null;
36
- if (p.sequence !== (String(p.event).endsWith('incoming') ? 1 : 2))
36
+ if (![1, 2, '1', '2'].includes(p.sequence) || Number(p.sequence) !== (String(p.event).endsWith('incoming') ? 1 : 2))
37
37
  return null;
38
- return { ...(p.kind ? { kind: p.kind } : {}), event: p.event, event_id: p.event_id, call_id: p.call_id, connection_id: p.connection_id, ring_expires_at: p.ring_expires_at, sequence: p.sequence };
38
+ return { ...(p.kind ? { kind: p.kind } : {}), event: p.event, event_id: p.event_id, call_id: p.call_id, connection_id: p.connection_id, ring_expires_at: p.ring_expires_at, sequence: Number(p.sequence) };
39
39
  }
40
40
  /** Host retains its push provider, credentials and notification handler. */
41
41
  export function createCallingNotificationHandler(options) {
@@ -1,2 +1,2 @@
1
- export declare const mobileVersion = "0.4.0";
2
- export declare const engineVersion = "0.3.0";
1
+ export declare const mobileVersion = "0.5.0";
2
+ export declare const engineVersion = "0.4.0";
package/dist/versions.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated from the package manifests by build.mjs.
2
- export const mobileVersion = "0.4.0";
3
- export const engineVersion = "0.3.0";
2
+ export const mobileVersion = "0.5.0";
3
+ export const engineVersion = "0.4.0";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // Generated by scripts/design/generate-icons.mjs from the approved Robono artwork.
3
3
  import React, { useId } from 'react';
4
+ import { Platform } from 'react-native';
4
5
  import Svg, { Path, Circle, Rect, Ellipse, Line, G, Defs, Mask } from 'react-native-svg';
5
6
  import { iconPaths } from './icon-paths.js';
6
7
  import { iconNodes, iconNames } from './icon-nodes.js';
@@ -14,7 +15,7 @@ function draw(node, index, prefix, color) {
14
15
  }
15
16
  export function RobonoIcon({ name, size = 24, color = '#F7F7F7', ...props }) {
16
17
  const prefix = 'robono' + useId().replace(/[^a-zA-Z0-9]/g, '') + '-';
17
- return _jsx(Svg, { width: size, height: size, viewBox: "0 0 32 32", color: color, accessible: false, ...props, children: iconNodes[iconNames[name]]?.map((node, i) => draw(node, i, prefix, color)) });
18
+ return _jsx(Svg, { width: size, height: size, viewBox: "0 0 32 32", color: color, ...(Platform.OS === 'web' ? { 'aria-hidden': true } : { accessible: false }), ...props, children: iconNodes[iconNames[name]]?.map((node, i) => draw(node, i, prefix, color)) });
18
19
  }
19
20
  RobonoIcon.glyphMap = iconPaths;
20
21
  export default RobonoIcon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robono/calling-react-native",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Optional branded calling screens, sounds and native audio adapters for Robono calling.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -46,6 +46,10 @@
46
46
  "./groups": {
47
47
  "types": "./dist/groups.d.ts",
48
48
  "default": "./dist/groups.js"
49
+ },
50
+ "./messenger": {
51
+ "types": "./dist/messenger.d.ts",
52
+ "default": "./dist/messenger.js"
49
53
  }
50
54
  },
51
55
  "files": [
@@ -72,7 +76,7 @@
72
76
  "@types/react": "~19.2.2"
73
77
  },
74
78
  "peerDependencies": {
75
- "@robono/calling": "^0.3.0",
79
+ "@robono/calling": "^0.4.0",
76
80
  "react": ">=18.2 <20",
77
81
  "react-native": ">=0.76 <1",
78
82
  "react-native-svg": ">=15 <16",