@daily-co/react-native-daily-js 0.85.0 → 0.87.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.
@@ -2,11 +2,18 @@ type CacheResponse = {
2
2
  code?: string;
3
3
  refetchHeaders?: Headers;
4
4
  };
5
+ export interface AsyncStorageInterface {
6
+ getItem(key: string): Promise<string | null>;
7
+ setItem(key: string, value: string): Promise<void>;
8
+ removeItem(key: string): Promise<void>;
9
+ }
5
10
  /**
6
11
  * A workaround for the fact that the iOS HTTP cache won't cache the call
7
12
  * object bundle due to size.
8
13
  */
9
14
  export default class iOSCallObjectBundleCache {
15
+ private static _storage;
16
+ static initialize(storage: AsyncStorageInterface): void;
10
17
  static get(url: string, ignoreExpiry?: boolean): Promise<CacheResponse | null>;
11
18
  static renew(url: string, headers: Headers): Promise<CacheResponse>;
12
19
  static set(url: string, code: string, headers: Headers): Promise<void>;
@@ -35,11 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
38
  Object.defineProperty(exports, "__esModule", { value: true });
42
- var async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
43
39
  var FIELD_CACHE_EXPIRY = 'expiry';
44
40
  var FIELD_BUNDLE_CODE = 'code';
45
41
  var FIELD_BUNDLE_LAST_MODIFIED = 'last-modified';
@@ -56,6 +52,9 @@ function cacheKeyForUrl(url) {
56
52
  var iOSCallObjectBundleCache = /** @class */ (function () {
57
53
  function iOSCallObjectBundleCache() {
58
54
  }
55
+ iOSCallObjectBundleCache.initialize = function (storage) {
56
+ this._storage = storage;
57
+ };
59
58
  iOSCallObjectBundleCache.get = function (url_1) {
60
59
  return __awaiter(this, arguments, void 0, function (url, ignoreExpiry) {
61
60
  var now, cacheItemString, cacheItem, _i, REQUIRED_FIELDS_1, field, headers, e_1;
@@ -63,11 +62,15 @@ var iOSCallObjectBundleCache = /** @class */ (function () {
63
62
  return __generator(this, function (_a) {
64
63
  switch (_a.label) {
65
64
  case 0:
65
+ // console.log("[iOSCallObjectBundleCache] get", url);
66
+ if (!this._storage) {
67
+ return [2 /*return*/, null];
68
+ }
66
69
  now = Date.now();
67
70
  _a.label = 1;
68
71
  case 1:
69
72
  _a.trys.push([1, 3, , 4]);
70
- return [4 /*yield*/, async_storage_1.default.getItem(cacheKeyForUrl(url))];
73
+ return [4 /*yield*/, this._storage.getItem(cacheKeyForUrl(url))];
71
74
  case 2:
72
75
  cacheItemString = _a.sent();
73
76
  // If cache miss, return null
@@ -101,7 +104,7 @@ var iOSCallObjectBundleCache = /** @class */ (function () {
101
104
  e_1 = _a.sent();
102
105
  // console.log("[iOSCallObjectBundleCache] error in get", url, e);
103
106
  // Clear potentially problematic cache entry and return null
104
- async_storage_1.default.removeItem(cacheKeyForUrl(url));
107
+ this._storage.removeItem(cacheKeyForUrl(url));
105
108
  return [2 /*return*/, null];
106
109
  case 4: return [2 /*return*/];
107
110
  }
@@ -130,10 +133,10 @@ var iOSCallObjectBundleCache = /** @class */ (function () {
130
133
  var expiry, cacheControlHeader, expiryMatch, etag, lastModified, cacheItem;
131
134
  return __generator(this, function (_a) {
132
135
  // console.log("[iOSCallObjectBundleCache] set", url, headers);
133
- if (!code) {
136
+ if (!code || !this._storage) {
134
137
  return [2 /*return*/];
135
138
  }
136
- expiry = DEFAULT_EXPIRY_MS;
139
+ expiry = Date.now() + DEFAULT_EXPIRY_MS;
137
140
  cacheControlHeader = headers.get('cache-control');
138
141
  if (cacheControlHeader) {
139
142
  expiryMatch = cacheControlHeader.match(/max-age=([0-9]+)/i);
@@ -148,10 +151,11 @@ var iOSCallObjectBundleCache = /** @class */ (function () {
148
151
  cacheItem[FIELD_CACHE_EXPIRY] = expiry;
149
152
  cacheItem[FIELD_BUNDLE_ETAG] = etag;
150
153
  cacheItem[FIELD_BUNDLE_LAST_MODIFIED] = lastModified;
151
- return [2 /*return*/, async_storage_1.default.setItem(cacheKeyForUrl(url), JSON.stringify(cacheItem))];
154
+ return [2 /*return*/, this._storage.setItem(cacheKeyForUrl(url), JSON.stringify(cacheItem))];
152
155
  });
153
156
  });
154
157
  };
158
+ iOSCallObjectBundleCache._storage = null;
155
159
  return iOSCallObjectBundleCache;
156
160
  }());
157
161
  exports.default = iOSCallObjectBundleCache;
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var daily_js_1 = __importDefault(require("@daily-co/daily-js"));
22
22
  var react_native_webrtc_1 = require("@daily-co/react-native-webrtc");
23
23
  var DailyMediaView_1 = __importDefault(require("./DailyMediaView"));
24
24
  exports.DailyMediaView = DailyMediaView_1.default;
25
+ var async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
25
26
  var iOSCallObjectBundleCache_1 = __importDefault(require("./iOSCallObjectBundleCache"));
26
27
  require("react-native-url-polyfill/auto"); // Applies global URL polyfill
27
28
  var react_native_background_timer_1 = __importDefault(require("react-native-background-timer"));
@@ -99,6 +100,7 @@ function setupGlobals() {
99
100
  global.atob = base_64_1.decode;
100
101
  // A workaround for iOS HTTP cache not caching call object bundle due to size
101
102
  if (react_native_1.Platform.OS === 'ios') {
103
+ iOSCallObjectBundleCache_1.default.initialize(async_storage_1.default);
102
104
  global.iOSCallObjectBundleCache = iOSCallObjectBundleCache_1.default;
103
105
  }
104
106
  // Let timers run while Android app is in the background.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daily-co/react-native-daily-js",
3
- "version": "0.85.0",
3
+ "version": "0.87.0",
4
4
  "description": "React Native library for making video calls using Daily",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "LICENSE"
18
18
  ],
19
19
  "scripts": {
20
- "build": "tsc",
20
+ "build": "rm -rf dist/ && tsc",
21
21
  "postbuild": "sed -E -i.bak 's|@daily-co/daily-js|../type-overrides/@daily-co/daily-js|g' ./dist/index.d.ts && rm ./dist/index.d.ts.bak",
22
22
  "prepare": "npm run build",
23
23
  "tag": "scripts/tag",
@@ -30,7 +30,7 @@
30
30
  "baseUrl": "https://github.com/daily-co/react-native-daily-js"
31
31
  },
32
32
  "dependencies": {
33
- "@daily-co/daily-js": "^0.90.0",
33
+ "@daily-co/daily-js": "^0.92.0",
34
34
  "@types/react-native-background-timer": "^2.0.0",
35
35
  "base-64": "^1.0.0",
36
36
  "react-native-url-polyfill": "^1.1.2"
@@ -38,14 +38,14 @@
38
38
  "///": "WHEN ONE OF THESE CHANGE, PLEASE UPDATE README.md INSTALL SNIPPET ACCORDINGLY",
39
39
  "peerDependencies": {
40
40
  "@daily-co/react-native-webrtc": "^124.0.6-daily.1",
41
- "@react-native-async-storage/async-storage": "^1.24.0",
41
+ "@react-native-async-storage/async-storage": "^1.24.0 || ^2.0.0 || ^3.0.0",
42
42
  "react-native": ">=0.68.0",
43
43
  "react-native-background-timer": "^2.4.1",
44
44
  "react-native-get-random-values": "^1.11.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@daily-co/react-native-webrtc": "^124.0.6-daily.1",
48
- "@react-native-async-storage/async-storage": "^1.24.0",
48
+ "@react-native-async-storage/async-storage": "^3.0.3",
49
49
  "@types/base-64": "^1.0.0",
50
50
  "@types/react": "18.3.21",
51
51
  "react-native": "0.76.9",
@@ -19,6 +19,7 @@ import RTCRtpEncodingParameters from '@daily-co/react-native-webrtc/lib/typescri
19
19
  */
20
20
 
21
21
  export type DailyLanguage =
22
+ | 'cs'
22
23
  | 'da'
23
24
  | 'de'
24
25
  | 'en'
@@ -34,6 +35,7 @@ export type DailyLanguage =
34
35
  | 'pt'
35
36
  | 'pt-BR'
36
37
  | 'ru'
38
+ | 'sk'
37
39
  | 'sv'
38
40
  | 'tr';
39
41
 
@@ -97,6 +99,7 @@ export type DailyEvent =
97
99
  | 'dialin-stopped'
98
100
  | 'dialin-warning'
99
101
  | 'dialout-connected'
102
+ | 'dialout-answered'
100
103
  | 'dialout-error'
101
104
  | 'dialout-stopped'
102
105
  | 'dialout-warning'
@@ -655,6 +658,14 @@ export interface DailyPendingRoomInfo {
655
658
  roomUrlPendingJoin: string;
656
659
  }
657
660
 
661
+ export interface DailyRecordingsBucket {
662
+ allow_api_access: boolean;
663
+ allow_streaming_from_bucket: boolean;
664
+ assume_role_arn: string;
665
+ bucket_name: string;
666
+ bucket_region: string;
667
+ }
668
+
658
669
  export interface DailyRoomInfo {
659
670
  id: string;
660
671
  name: string;
@@ -697,6 +708,7 @@ export interface DailyRoomInfo {
697
708
  */
698
709
  signaling_impl?: string;
699
710
  geo?: string;
711
+ recordings_bucket?: DailyRecordingsBucket | boolean;
700
712
  };
701
713
  domainConfig: {
702
714
  hide_daily_branding?: boolean;
@@ -719,7 +731,9 @@ export interface DailyRoomInfo {
719
731
  enable_pip_ui?: boolean;
720
732
  enable_hand_raising?: boolean;
721
733
  enable_prejoin_ui?: boolean;
734
+ enable_transcription?: boolean;
722
735
  enable_video_processing_ui?: boolean;
736
+ recordings_bucket?: DailyRecordingsBucket | boolean;
723
737
  };
724
738
  tokenConfig: {
725
739
  eject_at_token_exp?: boolean;
@@ -733,6 +747,7 @@ export interface DailyRoomInfo {
733
747
  start_video_off?: boolean;
734
748
  start_audio_off?: boolean;
735
749
  enable_recording?: string;
750
+ start_cloud_recording_opts?: DailyStreamingOptions<'recording', 'start'>;
736
751
  start_cloud_recording?: boolean;
737
752
  close_tab_on_exit?: boolean;
738
753
  redirect_on_meeting_exit?: string;
@@ -1153,6 +1168,11 @@ export interface DailyEventObjectTranscriptionError
1153
1168
  instanceId: string;
1154
1169
  errorMsg?: string;
1155
1170
  }
1171
+
1172
+ export type DailyRemoteMediaPlayerStopReason =
1173
+ | DailyRemoteMediaPlayerEOS
1174
+ | DailyRemoteMediaPlayerPeerStopped;
1175
+
1156
1176
  export interface DailyEventObjectRemoteMediaPlayerUpdate
1157
1177
  extends DailyEventObjectBase {
1158
1178
  action: Extract<
@@ -1175,42 +1195,79 @@ export interface DailyEventObjectRemoteMediaPlayerStopped
1175
1195
  export interface DailyEventObjectDialinReady extends DailyEventObjectBase {
1176
1196
  action: Extract<DailyEvent, 'dialin-ready'>;
1177
1197
  sipEndpoint: string;
1198
+ provider: string;
1178
1199
  }
1179
1200
 
1180
1201
  export interface DailyEventObjectDialinConnected extends DailyEventObjectBase {
1181
1202
  action: Extract<DailyEvent, 'dialin-connected'>;
1203
+ sessionId: string;
1204
+ userId?: string;
1182
1205
  sipHeaders?: Record<string, any>;
1183
1206
  sipFrom?: string;
1207
+ sipEndpoint?: string;
1184
1208
  actionTraceId?: string;
1209
+ provider: string;
1210
+ sipCallId: string;
1185
1211
  }
1186
1212
 
1187
1213
  export interface DailyEventObjectDialinError extends DailyEventObjectBase {
1188
1214
  action: Extract<DailyEvent, 'dialin-error'>;
1189
1215
  errorMsg: string;
1190
1216
  sessionId: string;
1217
+ userId?: string;
1191
1218
  type?: 'start-failed' | null;
1192
1219
  details?: { sipEndpoint?: string };
1193
1220
  actionTraceId?: string;
1221
+ provider: string;
1222
+ sipCallId?: string;
1194
1223
  }
1195
1224
 
1196
1225
  export interface DailyEventObjectDialinStopped extends DailyEventObjectBase {
1197
1226
  action: Extract<DailyEvent, 'dialin-stopped'>;
1227
+ sessionId: string;
1228
+ userId?: string;
1198
1229
  sipHeaders?: Record<string, any>;
1199
1230
  sipFrom?: string;
1231
+ sipEndpoint?: string;
1200
1232
  actionTraceId?: string;
1233
+ provider: string;
1234
+ sipCallId?: string;
1201
1235
  }
1202
1236
 
1203
1237
  export interface DailyEventObjectDialinWarning extends DailyEventObjectBase {
1204
1238
  action: Extract<DailyEvent, 'dialin-warning'>;
1205
1239
  errorMsg: string;
1240
+ sessionId: string;
1241
+ userId?: string;
1242
+ sipFrom?: string;
1243
+ sipEndpoint?: string;
1206
1244
  actionTraceId?: string;
1245
+ provider: string;
1246
+ sipCallId?: string;
1207
1247
  }
1208
1248
 
1209
1249
  export interface DailyEventObjectDialOutConnected extends DailyEventObjectBase {
1210
1250
  action: Extract<DailyEvent, 'dialout-connected'>;
1211
- sessionId?: string;
1251
+ sessionId: string;
1252
+ userId?: string;
1253
+ origin?: string;
1254
+ destination?: string;
1255
+ callerId?: string;
1256
+ actionTraceId?: string;
1257
+ provider: string;
1258
+ sipCallId: string;
1259
+ }
1260
+
1261
+ export interface DailyEventObjectDialOutAnswered extends DailyEventObjectBase {
1262
+ action: Extract<DailyEvent, 'dialout-answered'>;
1263
+ sessionId: string;
1212
1264
  userId?: string;
1265
+ origin?: string;
1266
+ destination?: string;
1267
+ callerId?: string;
1213
1268
  actionTraceId?: string;
1269
+ provider: string;
1270
+ sipCallId: string;
1214
1271
  }
1215
1272
 
1216
1273
  export interface DailyEventObjectDialOutError extends DailyEventObjectBase {
@@ -1218,14 +1275,22 @@ export interface DailyEventObjectDialOutError extends DailyEventObjectBase {
1218
1275
  errorMsg: string;
1219
1276
  sessionId?: string;
1220
1277
  userId?: string;
1278
+ details?: { destination?: string; sipHeaders?: { [key: string]: string } };
1221
1279
  actionTraceId?: string;
1280
+ provider: string;
1281
+ sipCallId?: string;
1222
1282
  }
1223
1283
 
1224
1284
  export interface DailyEventObjectDialOutStopped extends DailyEventObjectBase {
1225
1285
  action: Extract<DailyEvent, 'dialout-stopped'>;
1226
- sessionId?: string;
1286
+ sessionId: string;
1227
1287
  userId?: string;
1288
+ origin?: string;
1289
+ destination?: string;
1290
+ callerId?: string;
1228
1291
  actionTraceId?: string;
1292
+ provider: string;
1293
+ sipCallId?: string;
1229
1294
  }
1230
1295
 
1231
1296
  export interface DailyEventObjectDialOutWarning extends DailyEventObjectBase {
@@ -1233,7 +1298,12 @@ export interface DailyEventObjectDialOutWarning extends DailyEventObjectBase {
1233
1298
  errorMsg: string;
1234
1299
  sessionId?: string;
1235
1300
  userId?: string;
1301
+ origin?: string;
1302
+ destination?: string;
1303
+ callerId?: string;
1236
1304
  actionTraceId?: string;
1305
+ provider: string;
1306
+ sipCallId?: string;
1237
1307
  }
1238
1308
 
1239
1309
  export interface DailyEventObjectDtmfEvent extends DailyEventObjectBase {
@@ -1285,6 +1355,8 @@ export type DailyEventObject<T extends DailyEvent = any> =
1285
1355
  ? DailyEventObjectWaitingParticipant
1286
1356
  : T extends DailyEventObjectAccessState['action']
1287
1357
  ? DailyEventObjectAccessState
1358
+ : T extends DailyEventObjectMeetingSessionSummaryUpdated['action']
1359
+ ? DailyEventObjectMeetingSessionSummaryUpdated
1288
1360
  : T extends DailyEventObjectMeetingSessionStateUpdated['action']
1289
1361
  ? DailyEventObjectMeetingSessionStateUpdated
1290
1362
  : T extends DailyEventObjectTrack['action']
@@ -1327,6 +1399,8 @@ export type DailyEventObject<T extends DailyEvent = any> =
1327
1399
  ? DailyEventObjectDialinWarning
1328
1400
  : T extends DailyEventObjectDialOutConnected['action']
1329
1401
  ? DailyEventObjectDialOutConnected
1402
+ : T extends DailyEventObjectDialOutAnswered['action']
1403
+ ? DailyEventObjectDialOutAnswered
1330
1404
  : T extends DailyEventObjectDialOutError['action']
1331
1405
  ? DailyEventObjectDialOutError
1332
1406
  : T extends DailyEventObjectDialOutStopped['action']
@@ -1394,6 +1468,10 @@ export interface DailyStreamingAudioOnlyLayoutConfig {
1394
1468
  participants?: DailyStreamingParticipantsConfig;
1395
1469
  }
1396
1470
 
1471
+ export interface DailyStreamingRawTracksAudioOnlyLayoutConfig {
1472
+ preset: 'raw-tracks-audio-only';
1473
+ }
1474
+
1397
1475
  export type DailyStreamingPortraitLayoutVariant = 'vertical' | 'inset';
1398
1476
 
1399
1477
  export interface DailyStreamingPortraitLayoutConfig {
@@ -1430,6 +1508,7 @@ export type DailyStreamingLayoutConfig<
1430
1508
  | DailyStreamingActiveParticipantLayoutConfig
1431
1509
  | DailyStreamingPortraitLayoutConfig
1432
1510
  | DailyStreamingAudioOnlyLayoutConfig
1511
+ | DailyStreamingRawTracksAudioOnlyLayoutConfig
1433
1512
  | (Type extends 'start'
1434
1513
  ? DailyStartStreamingCustomLayoutConfig
1435
1514
  : DailyUpdateStreamingCustomLayoutConfig);
@@ -1453,10 +1532,6 @@ export type DailyRemoteMediaPlayerStateBuffering = 'buffering';
1453
1532
  export type DailyRemoteMediaPlayerEOS = 'EOS';
1454
1533
  export type DailyRemoteMediaPlayerPeerStopped = 'stopped-by-peer';
1455
1534
 
1456
- export type DailyRemoteMediaPlayerStopReason =
1457
- | DailyRemoteMediaPlayerEOS
1458
- | DailyRemoteMediaPlayerPeerStopped;
1459
-
1460
1535
  export type DailyAccess = 'unknown' | SpecifiedDailyAccess;
1461
1536
 
1462
1537
  export type SpecifiedDailyAccess = { level: 'none' | 'lobby' | 'full' };
@@ -1553,6 +1628,7 @@ export interface DailyTranscriptionDeepgramOptions {
1553
1628
  includeRawResponse?: boolean;
1554
1629
  instanceId?: string;
1555
1630
  participants?: Array<string>;
1631
+ transcription_geo?: 'global' | 'eu';
1556
1632
  }
1557
1633
 
1558
1634
  export interface DailyTranscriptionUpdateOptions {
@@ -1581,13 +1657,28 @@ export interface DailySipPstnParticipantPermissions {
1581
1657
  canReceive: Partial<DailyParticipantCanReceivePermission>;
1582
1658
  }
1583
1659
 
1660
+ /** Video encoding settings for SIP dial-out. Only applicable when `video` is `true`. */
1661
+ export interface DailySipVideoSettings {
1662
+ /** Video width in pixels. Default: 1280. Maximum: 1280. */
1663
+ width?: number;
1664
+ /** Video height in pixels. Default: 720. Maximum: 720. */
1665
+ height?: number;
1666
+ /** Video frame rate. Default: 15. Maximum: 30. */
1667
+ fps?: number;
1668
+ /** Video bitrate in kbps. Default: 900. Maximum: 1000. */
1669
+ videoBitrate?: number;
1670
+ }
1671
+
1672
+ export type DailySipServiceProvider = 'daily' | 'signalwire';
1584
1673
  export interface DailyStartDialoutSipOptions {
1585
1674
  sipUri?: string;
1586
1675
  displayName?: string;
1587
1676
  userId?: string;
1588
1677
  video?: boolean;
1678
+ videoSettings?: DailySipVideoSettings;
1589
1679
  codecs?: DailyDialOutCodecs;
1590
1680
  permissions?: DailySipPstnParticipantPermissions;
1681
+ provider?: DailySipServiceProvider;
1591
1682
  }
1592
1683
 
1593
1684
  export interface DailyStartDialoutPhoneOptions {
@@ -1605,6 +1696,16 @@ export type DailyStartDialoutOptions =
1605
1696
  | DailyStartDialoutSipOptions
1606
1697
  | DailyStartDialoutPhoneOptions;
1607
1698
 
1699
+ export interface DailyStartDialinOptions {
1700
+ displayName: string;
1701
+ sipEndpoint?: string;
1702
+ userId?: string;
1703
+ video?: boolean;
1704
+ codecs?: DailyDialOutCodecs;
1705
+ permissions?: DailySipPstnParticipantPermissions;
1706
+ provider?: DailySipServiceProvider;
1707
+ }
1708
+
1608
1709
  export interface DailySipCallTransferOptions {
1609
1710
  sessionId: string;
1610
1711
  toEndPoint: string;
@@ -1787,6 +1888,7 @@ export interface DailyCall {
1787
1888
  startDialOut(
1788
1889
  options: DailyStartDialoutOptions
1789
1890
  ): Promise<{ session?: DailyDialOutSession }>;
1891
+ startDialIn(options: DailyStartDialinOptions): Promise<void>;
1790
1892
  stopDialOut(options: { sessionId: string }): Promise<void>;
1791
1893
  sendDTMF(options: DailySendDtmfOptions): Promise<void>;
1792
1894
  sipCallTransfer(options: DailySipCallTransferOptions): Promise<void>;