@videosdk.live/react-sdk 0.1.1 → 0.1.5
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/README.md +78 -0
- package/dist/index.js +1148 -323
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1147 -322
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -1
- package/readme.md +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="https://static.zujonow.com/videosdk.live/videosdk_logo_circle_big.png"/><br/>
|
|
3
|
+
<p align="center">
|
|
4
|
+
Video SDK React App<br/>
|
|
5
|
+
<a href="https://videosdk.live/">videosdk.live</a>
|
|
6
|
+
</p>
|
|
7
|
+
</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@videosdk.live/react-sdk"><img src="https://img.shields.io/npm/dw/@videosdk.live/react-sdk.svg?style=for-the-badge" alt="NPM downloads"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@videosdk.live/react-sdk"><img src="https://img.shields.io/npm/v/@videosdk.live/react-sdk/latest.svg?style=for-the-badge" alt="NPM latest version"></a>
|
|
12
|
+
<a href="https://discord.com/invite/f2WsNDN9S5"><img src="https://img.shields.io/discord/876774498798551130?color=%237289da&label=Chat%20on%20Discrd&style=for-the-badge" alt="Chat on Discord"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- [x] Video API with real-time audio, video and data streams
|
|
18
|
+
- [x] 5,000+ participants support
|
|
19
|
+
- [x] Chat support with rich media.
|
|
20
|
+
- [x] Screen sharing with HD and Full HD.
|
|
21
|
+
- [x] Play realtime video in meeting
|
|
22
|
+
- [x] Connect it with social media such as Facebook, Youtube etc (RTMP out support).
|
|
23
|
+
- [x] Intelligent speaker switch
|
|
24
|
+
- [x] Record your meetings on cloud
|
|
25
|
+
- [x] Customise UI and built other rich features with our new data streams such as whiteboard, poll, Q & A etc.
|
|
26
|
+
|
|
27
|
+
## Browser Support
|
|
28
|
+
|
|
29
|
+
Visit our official guide for [Browser Support](https://docs.videosdk.live/docs/realtime-communication/see-also/device-browser-support)
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
You must have the following installed:
|
|
34
|
+
|
|
35
|
+
- Node.js v12+
|
|
36
|
+
- NPM v6+ (comes installed with newer Node versions)
|
|
37
|
+
|
|
38
|
+
# Setup
|
|
39
|
+
|
|
40
|
+
`@videosdk.live/react-sdk` wraps up our [`@videosdk.live/js-sdk`](https://www.npmjs.com/package/@videosdk.live/js-sdk)
|
|
41
|
+
into usable hooks APIs. It simplifies code and concept for react-js
|
|
42
|
+
|
|
43
|
+
### Install the library in React
|
|
44
|
+
|
|
45
|
+
The easiest way to get started is by installing `@videosdk.live/react-sdk` in your app.
|
|
46
|
+
|
|
47
|
+
**From npm package**:
|
|
48
|
+
```js
|
|
49
|
+
npm install @videosdk.live/react-sdk
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**From yarn package**:
|
|
53
|
+
```js
|
|
54
|
+
yarn add @videosdk.live/react-sdk
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Import the library in your app
|
|
58
|
+
|
|
59
|
+
`react-sdk` provides two most important hook `useMeeting` and `useParticipant`. it also provides `MeetingProvider` and `MeetingConsumer` to listen changes in meeting state and events.
|
|
60
|
+
|
|
61
|
+
```javascript title="Import the library"
|
|
62
|
+
import {
|
|
63
|
+
MeetingProvider,
|
|
64
|
+
useMeeting,
|
|
65
|
+
useParticipant,
|
|
66
|
+
MeetingConsumer,
|
|
67
|
+
} from "@videosdk.live/react-sdk";
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
|
|
73
|
+
Check the components and their usage in our [documentation](https://docs.videosdk.live/docs/realtime-communication/sdk-reference/react-sdk/setup).
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Try it out
|
|
77
|
+
|
|
78
|
+
Run the [Code sample](https://github.com/videosdk-live/videosdk-rtc-react-sdk-example) to see it in action.
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var React__default = _interopDefault(React);
|
|
5
|
-
var EventEmitter = _interopDefault(require('
|
|
6
|
-
var
|
|
5
|
+
var EventEmitter = _interopDefault(require('eventemitter3'));
|
|
6
|
+
var js = require('@videosdk.live/js');
|
|
7
7
|
|
|
8
8
|
var eventPrifix = 'zn-meeting-react-sdk';
|
|
9
9
|
var events = {
|
|
@@ -18,16 +18,9 @@ var events = {
|
|
|
18
18
|
'recording-stopped': eventPrifix + "-recording-stopped",
|
|
19
19
|
'chat-message': eventPrifix + "-chat-message",
|
|
20
20
|
'meeting-joined': eventPrifix + "-meeting-joined",
|
|
21
|
-
'meeting-left': eventPrifix + "-meeting-left"
|
|
22
|
-
'live-stream-started': eventPrifix + "-live-stream-started",
|
|
23
|
-
'live-stream-stopped': eventPrifix + "-live-stream-stopped",
|
|
24
|
-
'video-state-changed': eventPrifix + "-video-state-changed",
|
|
25
|
-
'video-seeked': eventPrifix + "-video-seeked",
|
|
26
|
-
'webcam-requested': eventPrifix + "-webcam-requested",
|
|
27
|
-
'mic-requested': eventPrifix + "-mic-requested"
|
|
21
|
+
'meeting-left': eventPrifix + "-meeting-left"
|
|
28
22
|
};
|
|
29
23
|
var eventEmitter = new EventEmitter();
|
|
30
|
-
eventEmitter.setMaxListeners(9999);
|
|
31
24
|
|
|
32
25
|
var MeetingProviderContex = React.createContext();
|
|
33
26
|
var useMeeting = function useMeeting(_temp) {
|
|
@@ -55,19 +48,7 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
55
48
|
_ref$onMeetingJoined = _ref.onMeetingJoined,
|
|
56
49
|
onMeetingJoined = _ref$onMeetingJoined === void 0 ? function () {} : _ref$onMeetingJoined,
|
|
57
50
|
_ref$onMeetingLeft = _ref.onMeetingLeft,
|
|
58
|
-
onMeetingLeft = _ref$onMeetingLeft === void 0 ? function () {} : _ref$onMeetingLeft
|
|
59
|
-
_ref$onLiveStreamStar = _ref.onLiveStreamStarted,
|
|
60
|
-
onLiveStreamStarted = _ref$onLiveStreamStar === void 0 ? function () {} : _ref$onLiveStreamStar,
|
|
61
|
-
_ref$onLiveStreamStop = _ref.onLiveStreamStopped,
|
|
62
|
-
onLiveStreamStopped = _ref$onLiveStreamStop === void 0 ? function () {} : _ref$onLiveStreamStop,
|
|
63
|
-
_ref$onVideoStateChan = _ref.onVideoStateChanged,
|
|
64
|
-
onVideoStateChanged = _ref$onVideoStateChan === void 0 ? function () {} : _ref$onVideoStateChan,
|
|
65
|
-
_ref$onVideoSeeked = _ref.onVideoSeeked,
|
|
66
|
-
onVideoSeeked = _ref$onVideoSeeked === void 0 ? function () {} : _ref$onVideoSeeked,
|
|
67
|
-
_ref$onWebcamRequeste = _ref.onWebcamRequested,
|
|
68
|
-
onWebcamRequested = _ref$onWebcamRequeste === void 0 ? function () {} : _ref$onWebcamRequeste,
|
|
69
|
-
_ref$onMicRequested = _ref.onMicRequested,
|
|
70
|
-
onMicRequested = _ref$onMicRequested === void 0 ? function () {} : _ref$onMicRequested;
|
|
51
|
+
onMeetingLeft = _ref$onMeetingLeft === void 0 ? function () {} : _ref$onMeetingLeft;
|
|
71
52
|
|
|
72
53
|
React.useEffect(function () {
|
|
73
54
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
@@ -82,12 +63,6 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
82
63
|
eventEmitter.on(events['chat-message'], onChatMessage);
|
|
83
64
|
eventEmitter.on(events['meeting-joined'], onMeetingJoined);
|
|
84
65
|
eventEmitter.on(events['meeting-left'], onMeetingLeft);
|
|
85
|
-
eventEmitter.on(events['live-stream-started'], onLiveStreamStarted);
|
|
86
|
-
eventEmitter.on(events['live-stream-stopped'], onLiveStreamStopped);
|
|
87
|
-
eventEmitter.on(events['video-state-changed'], onVideoStateChanged);
|
|
88
|
-
eventEmitter.on(events['video-seeked'], onVideoSeeked);
|
|
89
|
-
eventEmitter.on(events['webcam-requested'], onWebcamRequested);
|
|
90
|
-
eventEmitter.on(events['mic-requested'], onMicRequested);
|
|
91
66
|
return function () {
|
|
92
67
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
93
68
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
@@ -101,12 +76,6 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
101
76
|
eventEmitter.off(events['chat-message'], onChatMessage);
|
|
102
77
|
eventEmitter.off(events['meeting-joined'], onMeetingJoined);
|
|
103
78
|
eventEmitter.off(events['meeting-left'], onMeetingLeft);
|
|
104
|
-
eventEmitter.off(events['live-stream-started'], onLiveStreamStarted);
|
|
105
|
-
eventEmitter.off(events['live-stream-stopped'], onLiveStreamStopped);
|
|
106
|
-
eventEmitter.off(events['video-state-changed'], onVideoStateChanged);
|
|
107
|
-
eventEmitter.off(events['video-seeked'], onVideoSeeked);
|
|
108
|
-
eventEmitter.off(events['webcam-requested'], onWebcamRequested);
|
|
109
|
-
eventEmitter.off(events['mic-requested'], onMicRequested);
|
|
110
79
|
};
|
|
111
80
|
}, []);
|
|
112
81
|
return React.useContext(MeetingProviderContex);
|
|
@@ -136,19 +105,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
136
105
|
_ref2$onMeetingJoined = _ref2.onMeetingJoined,
|
|
137
106
|
onMeetingJoined = _ref2$onMeetingJoined === void 0 ? function () {} : _ref2$onMeetingJoined,
|
|
138
107
|
_ref2$onMeetingLeft = _ref2.onMeetingLeft,
|
|
139
|
-
onMeetingLeft = _ref2$onMeetingLeft === void 0 ? function () {} : _ref2$onMeetingLeft
|
|
140
|
-
_ref2$onLiveStreamSta = _ref2.onLiveStreamStarted,
|
|
141
|
-
onLiveStreamStarted = _ref2$onLiveStreamSta === void 0 ? function () {} : _ref2$onLiveStreamSta,
|
|
142
|
-
_ref2$onLiveStreamSto = _ref2.onLiveStreamStopped,
|
|
143
|
-
onLiveStreamStopped = _ref2$onLiveStreamSto === void 0 ? function () {} : _ref2$onLiveStreamSto,
|
|
144
|
-
_ref2$onVideoStateCha = _ref2.onVideoStateChanged,
|
|
145
|
-
onVideoStateChanged = _ref2$onVideoStateCha === void 0 ? function () {} : _ref2$onVideoStateCha,
|
|
146
|
-
_ref2$onVideoSeeked = _ref2.onVideoSeeked,
|
|
147
|
-
onVideoSeeked = _ref2$onVideoSeeked === void 0 ? function () {} : _ref2$onVideoSeeked,
|
|
148
|
-
_ref2$onWebcamRequest = _ref2.onWebcamRequested,
|
|
149
|
-
onWebcamRequested = _ref2$onWebcamRequest === void 0 ? function () {} : _ref2$onWebcamRequest,
|
|
150
|
-
_ref2$onMicRequested = _ref2.onMicRequested,
|
|
151
|
-
onMicRequested = _ref2$onMicRequested === void 0 ? function () {} : _ref2$onMicRequested;
|
|
108
|
+
onMeetingLeft = _ref2$onMeetingLeft === void 0 ? function () {} : _ref2$onMeetingLeft;
|
|
152
109
|
React.useEffect(function () {
|
|
153
110
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
154
111
|
eventEmitter.on(events['participant-left'], onParticipantLeft);
|
|
@@ -160,14 +117,8 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
160
117
|
eventEmitter.on(events['recording-started'], onRecordingStarted);
|
|
161
118
|
eventEmitter.on(events['recording-stopped'], onRecordingStopped);
|
|
162
119
|
eventEmitter.on(events['chat-message'], onChatMessage);
|
|
163
|
-
eventEmitter.on(events['
|
|
164
|
-
eventEmitter.on(events['
|
|
165
|
-
eventEmitter.on(events['live-stream-enabled'], onLiveStreamStarted);
|
|
166
|
-
eventEmitter.on(events['live-stream-disabled'], onLiveStreamStopped);
|
|
167
|
-
eventEmitter.on(events['video-state-changed'], onVideoStateChanged);
|
|
168
|
-
eventEmitter.on(events['video-seeked'], onVideoSeeked);
|
|
169
|
-
eventEmitter.on(events['webcam-requested'], onWebcamRequested);
|
|
170
|
-
eventEmitter.on(events['mic-requested'], onMicRequested);
|
|
120
|
+
eventEmitter.on(events['chat-message'], onMeetingJoined);
|
|
121
|
+
eventEmitter.on(events['chat-message'], onMeetingLeft);
|
|
171
122
|
return function () {
|
|
172
123
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
173
124
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
@@ -181,17 +132,1088 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
181
132
|
eventEmitter.off(events['chat-message'], onChatMessage);
|
|
182
133
|
eventEmitter.off(events['meeting-joined'], onMeetingJoined);
|
|
183
134
|
eventEmitter.off(events['meeting-left'], onMeetingLeft);
|
|
184
|
-
eventEmitter.off(events['live-stream-enabled'], onLiveStreamStarted);
|
|
185
|
-
eventEmitter.off(events['live-stream-disabled'], onLiveStreamStopped);
|
|
186
|
-
eventEmitter.off(events['video-state-changed'], onVideoStateChanged);
|
|
187
|
-
eventEmitter.off(events['video-seeked'], onVideoSeeked);
|
|
188
|
-
eventEmitter.off(events['webcam-requested'], onWebcamRequested);
|
|
189
|
-
eventEmitter.off(events['mic-requested'], onMicRequested);
|
|
190
135
|
};
|
|
191
136
|
}, []);
|
|
192
137
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
|
|
193
138
|
};
|
|
194
139
|
|
|
140
|
+
function createCommonjsModule(fn, module) {
|
|
141
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** @license React v16.13.1
|
|
145
|
+
* react-is.production.min.js
|
|
146
|
+
*
|
|
147
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the MIT license found in the
|
|
150
|
+
* LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/
|
|
152
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
153
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
154
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
|
|
155
|
+
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
|
|
156
|
+
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
|
|
157
|
+
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
|
|
158
|
+
|
|
159
|
+
var reactIs_production_min = {
|
|
160
|
+
AsyncMode: AsyncMode,
|
|
161
|
+
ConcurrentMode: ConcurrentMode,
|
|
162
|
+
ContextConsumer: ContextConsumer,
|
|
163
|
+
ContextProvider: ContextProvider,
|
|
164
|
+
Element: Element,
|
|
165
|
+
ForwardRef: ForwardRef,
|
|
166
|
+
Fragment: Fragment,
|
|
167
|
+
Lazy: Lazy,
|
|
168
|
+
Memo: Memo,
|
|
169
|
+
Portal: Portal,
|
|
170
|
+
Profiler: Profiler,
|
|
171
|
+
StrictMode: StrictMode,
|
|
172
|
+
Suspense: Suspense,
|
|
173
|
+
isAsyncMode: isAsyncMode,
|
|
174
|
+
isConcurrentMode: isConcurrentMode,
|
|
175
|
+
isContextConsumer: isContextConsumer,
|
|
176
|
+
isContextProvider: isContextProvider,
|
|
177
|
+
isElement: isElement,
|
|
178
|
+
isForwardRef: isForwardRef,
|
|
179
|
+
isFragment: isFragment,
|
|
180
|
+
isLazy: isLazy,
|
|
181
|
+
isMemo: isMemo,
|
|
182
|
+
isPortal: isPortal,
|
|
183
|
+
isProfiler: isProfiler,
|
|
184
|
+
isStrictMode: isStrictMode,
|
|
185
|
+
isSuspense: isSuspense,
|
|
186
|
+
isValidElementType: isValidElementType,
|
|
187
|
+
typeOf: typeOf
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
if (process.env.NODE_ENV !== "production") {
|
|
195
|
+
(function() {
|
|
196
|
+
|
|
197
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
198
|
+
// nor polyfill, then a plain number is used for performance.
|
|
199
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
200
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
201
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
202
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
203
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
204
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
205
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
206
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
207
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
208
|
+
|
|
209
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
210
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
211
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
212
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
213
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
214
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
215
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
216
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
217
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
218
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
219
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
220
|
+
|
|
221
|
+
function isValidElementType(type) {
|
|
222
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
223
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function typeOf(object) {
|
|
227
|
+
if (typeof object === 'object' && object !== null) {
|
|
228
|
+
var $$typeof = object.$$typeof;
|
|
229
|
+
|
|
230
|
+
switch ($$typeof) {
|
|
231
|
+
case REACT_ELEMENT_TYPE:
|
|
232
|
+
var type = object.type;
|
|
233
|
+
|
|
234
|
+
switch (type) {
|
|
235
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
236
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
237
|
+
case REACT_FRAGMENT_TYPE:
|
|
238
|
+
case REACT_PROFILER_TYPE:
|
|
239
|
+
case REACT_STRICT_MODE_TYPE:
|
|
240
|
+
case REACT_SUSPENSE_TYPE:
|
|
241
|
+
return type;
|
|
242
|
+
|
|
243
|
+
default:
|
|
244
|
+
var $$typeofType = type && type.$$typeof;
|
|
245
|
+
|
|
246
|
+
switch ($$typeofType) {
|
|
247
|
+
case REACT_CONTEXT_TYPE:
|
|
248
|
+
case REACT_FORWARD_REF_TYPE:
|
|
249
|
+
case REACT_LAZY_TYPE:
|
|
250
|
+
case REACT_MEMO_TYPE:
|
|
251
|
+
case REACT_PROVIDER_TYPE:
|
|
252
|
+
return $$typeofType;
|
|
253
|
+
|
|
254
|
+
default:
|
|
255
|
+
return $$typeof;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
case REACT_PORTAL_TYPE:
|
|
261
|
+
return $$typeof;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return undefined;
|
|
266
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
267
|
+
|
|
268
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
269
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
270
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
271
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
272
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
273
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
274
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
275
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
276
|
+
var Memo = REACT_MEMO_TYPE;
|
|
277
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
278
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
279
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
280
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
281
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
282
|
+
|
|
283
|
+
function isAsyncMode(object) {
|
|
284
|
+
{
|
|
285
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
286
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
287
|
+
|
|
288
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
293
|
+
}
|
|
294
|
+
function isConcurrentMode(object) {
|
|
295
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
296
|
+
}
|
|
297
|
+
function isContextConsumer(object) {
|
|
298
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
299
|
+
}
|
|
300
|
+
function isContextProvider(object) {
|
|
301
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
302
|
+
}
|
|
303
|
+
function isElement(object) {
|
|
304
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
305
|
+
}
|
|
306
|
+
function isForwardRef(object) {
|
|
307
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
308
|
+
}
|
|
309
|
+
function isFragment(object) {
|
|
310
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
311
|
+
}
|
|
312
|
+
function isLazy(object) {
|
|
313
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
314
|
+
}
|
|
315
|
+
function isMemo(object) {
|
|
316
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
317
|
+
}
|
|
318
|
+
function isPortal(object) {
|
|
319
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
320
|
+
}
|
|
321
|
+
function isProfiler(object) {
|
|
322
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
323
|
+
}
|
|
324
|
+
function isStrictMode(object) {
|
|
325
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
326
|
+
}
|
|
327
|
+
function isSuspense(object) {
|
|
328
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
exports.AsyncMode = AsyncMode;
|
|
332
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
333
|
+
exports.ContextConsumer = ContextConsumer;
|
|
334
|
+
exports.ContextProvider = ContextProvider;
|
|
335
|
+
exports.Element = Element;
|
|
336
|
+
exports.ForwardRef = ForwardRef;
|
|
337
|
+
exports.Fragment = Fragment;
|
|
338
|
+
exports.Lazy = Lazy;
|
|
339
|
+
exports.Memo = Memo;
|
|
340
|
+
exports.Portal = Portal;
|
|
341
|
+
exports.Profiler = Profiler;
|
|
342
|
+
exports.StrictMode = StrictMode;
|
|
343
|
+
exports.Suspense = Suspense;
|
|
344
|
+
exports.isAsyncMode = isAsyncMode;
|
|
345
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
346
|
+
exports.isContextConsumer = isContextConsumer;
|
|
347
|
+
exports.isContextProvider = isContextProvider;
|
|
348
|
+
exports.isElement = isElement;
|
|
349
|
+
exports.isForwardRef = isForwardRef;
|
|
350
|
+
exports.isFragment = isFragment;
|
|
351
|
+
exports.isLazy = isLazy;
|
|
352
|
+
exports.isMemo = isMemo;
|
|
353
|
+
exports.isPortal = isPortal;
|
|
354
|
+
exports.isProfiler = isProfiler;
|
|
355
|
+
exports.isStrictMode = isStrictMode;
|
|
356
|
+
exports.isSuspense = isSuspense;
|
|
357
|
+
exports.isValidElementType = isValidElementType;
|
|
358
|
+
exports.typeOf = typeOf;
|
|
359
|
+
})();
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
var reactIs = createCommonjsModule(function (module) {
|
|
364
|
+
|
|
365
|
+
if (process.env.NODE_ENV === 'production') {
|
|
366
|
+
module.exports = reactIs_production_min;
|
|
367
|
+
} else {
|
|
368
|
+
module.exports = reactIs_development;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
/*
|
|
373
|
+
object-assign
|
|
374
|
+
(c) Sindre Sorhus
|
|
375
|
+
@license MIT
|
|
376
|
+
*/
|
|
377
|
+
/* eslint-disable no-unused-vars */
|
|
378
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
379
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
380
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
381
|
+
|
|
382
|
+
function toObject(val) {
|
|
383
|
+
if (val === null || val === undefined) {
|
|
384
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return Object(val);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function shouldUseNative() {
|
|
391
|
+
try {
|
|
392
|
+
if (!Object.assign) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
397
|
+
|
|
398
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
399
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
400
|
+
test1[5] = 'de';
|
|
401
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
406
|
+
var test2 = {};
|
|
407
|
+
for (var i = 0; i < 10; i++) {
|
|
408
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
409
|
+
}
|
|
410
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
411
|
+
return test2[n];
|
|
412
|
+
});
|
|
413
|
+
if (order2.join('') !== '0123456789') {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
418
|
+
var test3 = {};
|
|
419
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
420
|
+
test3[letter] = letter;
|
|
421
|
+
});
|
|
422
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
423
|
+
'abcdefghijklmnopqrst') {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
return true;
|
|
428
|
+
} catch (err) {
|
|
429
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
435
|
+
var from;
|
|
436
|
+
var to = toObject(target);
|
|
437
|
+
var symbols;
|
|
438
|
+
|
|
439
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
440
|
+
from = Object(arguments[s]);
|
|
441
|
+
|
|
442
|
+
for (var key in from) {
|
|
443
|
+
if (hasOwnProperty.call(from, key)) {
|
|
444
|
+
to[key] = from[key];
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (getOwnPropertySymbols) {
|
|
449
|
+
symbols = getOwnPropertySymbols(from);
|
|
450
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
451
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
452
|
+
to[symbols[i]] = from[symbols[i]];
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return to;
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
463
|
+
*
|
|
464
|
+
* This source code is licensed under the MIT license found in the
|
|
465
|
+
* LICENSE file in the root directory of this source tree.
|
|
466
|
+
*/
|
|
467
|
+
|
|
468
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
469
|
+
|
|
470
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
471
|
+
|
|
472
|
+
var printWarning = function() {};
|
|
473
|
+
|
|
474
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
475
|
+
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
476
|
+
var loggedTypeFailures = {};
|
|
477
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
478
|
+
|
|
479
|
+
printWarning = function(text) {
|
|
480
|
+
var message = 'Warning: ' + text;
|
|
481
|
+
if (typeof console !== 'undefined') {
|
|
482
|
+
console.error(message);
|
|
483
|
+
}
|
|
484
|
+
try {
|
|
485
|
+
// --- Welcome to debugging React ---
|
|
486
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
487
|
+
// to find the callsite that caused this warning to fire.
|
|
488
|
+
throw new Error(message);
|
|
489
|
+
} catch (x) {}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Assert that the values match with the type specs.
|
|
495
|
+
* Error messages are memorized and will only be shown once.
|
|
496
|
+
*
|
|
497
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
498
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
499
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
500
|
+
* @param {string} componentName Name of the component for error messages.
|
|
501
|
+
* @param {?Function} getStack Returns the component stack.
|
|
502
|
+
* @private
|
|
503
|
+
*/
|
|
504
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
505
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
506
|
+
for (var typeSpecName in typeSpecs) {
|
|
507
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
508
|
+
var error;
|
|
509
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
510
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
511
|
+
// After these have been cleaned up, we'll let them throw.
|
|
512
|
+
try {
|
|
513
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
514
|
+
// behavior as without this statement except with a better message.
|
|
515
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
516
|
+
var err = Error(
|
|
517
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
518
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
519
|
+
);
|
|
520
|
+
err.name = 'Invariant Violation';
|
|
521
|
+
throw err;
|
|
522
|
+
}
|
|
523
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
|
524
|
+
} catch (ex) {
|
|
525
|
+
error = ex;
|
|
526
|
+
}
|
|
527
|
+
if (error && !(error instanceof Error)) {
|
|
528
|
+
printWarning(
|
|
529
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
530
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
531
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
532
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
533
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
534
|
+
'shape all require an argument).'
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
538
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
539
|
+
// same error.
|
|
540
|
+
loggedTypeFailures[error.message] = true;
|
|
541
|
+
|
|
542
|
+
var stack = getStack ? getStack() : '';
|
|
543
|
+
|
|
544
|
+
printWarning(
|
|
545
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Resets warning cache when testing.
|
|
555
|
+
*
|
|
556
|
+
* @private
|
|
557
|
+
*/
|
|
558
|
+
checkPropTypes.resetWarningCache = function() {
|
|
559
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
560
|
+
loggedTypeFailures = {};
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
var checkPropTypes_1 = checkPropTypes;
|
|
565
|
+
|
|
566
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
567
|
+
var printWarning$1 = function() {};
|
|
568
|
+
|
|
569
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
570
|
+
printWarning$1 = function(text) {
|
|
571
|
+
var message = 'Warning: ' + text;
|
|
572
|
+
if (typeof console !== 'undefined') {
|
|
573
|
+
console.error(message);
|
|
574
|
+
}
|
|
575
|
+
try {
|
|
576
|
+
// --- Welcome to debugging React ---
|
|
577
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
578
|
+
// to find the callsite that caused this warning to fire.
|
|
579
|
+
throw new Error(message);
|
|
580
|
+
} catch (x) {}
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function emptyFunctionThatReturnsNull() {
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
589
|
+
/* global Symbol */
|
|
590
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
591
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Returns the iterator method function contained on the iterable object.
|
|
595
|
+
*
|
|
596
|
+
* Be sure to invoke the function with the iterable as context:
|
|
597
|
+
*
|
|
598
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
599
|
+
* if (iteratorFn) {
|
|
600
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
601
|
+
* ...
|
|
602
|
+
* }
|
|
603
|
+
*
|
|
604
|
+
* @param {?object} maybeIterable
|
|
605
|
+
* @return {?function}
|
|
606
|
+
*/
|
|
607
|
+
function getIteratorFn(maybeIterable) {
|
|
608
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
609
|
+
if (typeof iteratorFn === 'function') {
|
|
610
|
+
return iteratorFn;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
616
|
+
* supplied to React components. Example usage:
|
|
617
|
+
*
|
|
618
|
+
* var Props = require('ReactPropTypes');
|
|
619
|
+
* var MyArticle = React.createClass({
|
|
620
|
+
* propTypes: {
|
|
621
|
+
* // An optional string prop named "description".
|
|
622
|
+
* description: Props.string,
|
|
623
|
+
*
|
|
624
|
+
* // A required enum prop named "category".
|
|
625
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
626
|
+
*
|
|
627
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
628
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
629
|
+
* },
|
|
630
|
+
* render: function() { ... }
|
|
631
|
+
* });
|
|
632
|
+
*
|
|
633
|
+
* A more formal specification of how these methods are used:
|
|
634
|
+
*
|
|
635
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
636
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
637
|
+
*
|
|
638
|
+
* Each and every declaration produces a function with the same signature. This
|
|
639
|
+
* allows the creation of custom validation functions. For example:
|
|
640
|
+
*
|
|
641
|
+
* var MyLink = React.createClass({
|
|
642
|
+
* propTypes: {
|
|
643
|
+
* // An optional string or URI prop named "href".
|
|
644
|
+
* href: function(props, propName, componentName) {
|
|
645
|
+
* var propValue = props[propName];
|
|
646
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
647
|
+
* !(propValue instanceof URI)) {
|
|
648
|
+
* return new Error(
|
|
649
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
650
|
+
* componentName
|
|
651
|
+
* );
|
|
652
|
+
* }
|
|
653
|
+
* }
|
|
654
|
+
* },
|
|
655
|
+
* render: function() {...}
|
|
656
|
+
* });
|
|
657
|
+
*
|
|
658
|
+
* @internal
|
|
659
|
+
*/
|
|
660
|
+
|
|
661
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
662
|
+
|
|
663
|
+
// Important!
|
|
664
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
665
|
+
var ReactPropTypes = {
|
|
666
|
+
array: createPrimitiveTypeChecker('array'),
|
|
667
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
668
|
+
func: createPrimitiveTypeChecker('function'),
|
|
669
|
+
number: createPrimitiveTypeChecker('number'),
|
|
670
|
+
object: createPrimitiveTypeChecker('object'),
|
|
671
|
+
string: createPrimitiveTypeChecker('string'),
|
|
672
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
673
|
+
|
|
674
|
+
any: createAnyTypeChecker(),
|
|
675
|
+
arrayOf: createArrayOfTypeChecker,
|
|
676
|
+
element: createElementTypeChecker(),
|
|
677
|
+
elementType: createElementTypeTypeChecker(),
|
|
678
|
+
instanceOf: createInstanceTypeChecker,
|
|
679
|
+
node: createNodeChecker(),
|
|
680
|
+
objectOf: createObjectOfTypeChecker,
|
|
681
|
+
oneOf: createEnumTypeChecker,
|
|
682
|
+
oneOfType: createUnionTypeChecker,
|
|
683
|
+
shape: createShapeTypeChecker,
|
|
684
|
+
exact: createStrictShapeTypeChecker,
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
689
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
690
|
+
*/
|
|
691
|
+
/*eslint-disable no-self-compare*/
|
|
692
|
+
function is(x, y) {
|
|
693
|
+
// SameValue algorithm
|
|
694
|
+
if (x === y) {
|
|
695
|
+
// Steps 1-5, 7-10
|
|
696
|
+
// Steps 6.b-6.e: +0 != -0
|
|
697
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
698
|
+
} else {
|
|
699
|
+
// Step 6.a: NaN == NaN
|
|
700
|
+
return x !== x && y !== y;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
/*eslint-enable no-self-compare*/
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
707
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
708
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
709
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
710
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
711
|
+
*/
|
|
712
|
+
function PropTypeError(message) {
|
|
713
|
+
this.message = message;
|
|
714
|
+
this.stack = '';
|
|
715
|
+
}
|
|
716
|
+
// Make `instanceof Error` still work for returned errors.
|
|
717
|
+
PropTypeError.prototype = Error.prototype;
|
|
718
|
+
|
|
719
|
+
function createChainableTypeChecker(validate) {
|
|
720
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
721
|
+
var manualPropTypeCallCache = {};
|
|
722
|
+
var manualPropTypeWarningCount = 0;
|
|
723
|
+
}
|
|
724
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
725
|
+
componentName = componentName || ANONYMOUS;
|
|
726
|
+
propFullName = propFullName || propName;
|
|
727
|
+
|
|
728
|
+
if (secret !== ReactPropTypesSecret_1) {
|
|
729
|
+
if (throwOnDirectAccess) {
|
|
730
|
+
// New behavior only for users of `prop-types` package
|
|
731
|
+
var err = new Error(
|
|
732
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
733
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
734
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
735
|
+
);
|
|
736
|
+
err.name = 'Invariant Violation';
|
|
737
|
+
throw err;
|
|
738
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
739
|
+
// Old behavior for people using React.PropTypes
|
|
740
|
+
var cacheKey = componentName + ':' + propName;
|
|
741
|
+
if (
|
|
742
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
743
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
744
|
+
manualPropTypeWarningCount < 3
|
|
745
|
+
) {
|
|
746
|
+
printWarning$1(
|
|
747
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
748
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
749
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
750
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
751
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
752
|
+
);
|
|
753
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
754
|
+
manualPropTypeWarningCount++;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
if (props[propName] == null) {
|
|
759
|
+
if (isRequired) {
|
|
760
|
+
if (props[propName] === null) {
|
|
761
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
762
|
+
}
|
|
763
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
764
|
+
}
|
|
765
|
+
return null;
|
|
766
|
+
} else {
|
|
767
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
772
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
773
|
+
|
|
774
|
+
return chainedCheckType;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
778
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
779
|
+
var propValue = props[propName];
|
|
780
|
+
var propType = getPropType(propValue);
|
|
781
|
+
if (propType !== expectedType) {
|
|
782
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
783
|
+
// check, but we can offer a more precise error message here rather than
|
|
784
|
+
// 'of type `object`'.
|
|
785
|
+
var preciseType = getPreciseType(propValue);
|
|
786
|
+
|
|
787
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
|
788
|
+
}
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
return createChainableTypeChecker(validate);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
function createAnyTypeChecker() {
|
|
795
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
799
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
800
|
+
if (typeof typeChecker !== 'function') {
|
|
801
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
802
|
+
}
|
|
803
|
+
var propValue = props[propName];
|
|
804
|
+
if (!Array.isArray(propValue)) {
|
|
805
|
+
var propType = getPropType(propValue);
|
|
806
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
807
|
+
}
|
|
808
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
809
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
|
810
|
+
if (error instanceof Error) {
|
|
811
|
+
return error;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
return createChainableTypeChecker(validate);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function createElementTypeChecker() {
|
|
820
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
821
|
+
var propValue = props[propName];
|
|
822
|
+
if (!isValidElement(propValue)) {
|
|
823
|
+
var propType = getPropType(propValue);
|
|
824
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
825
|
+
}
|
|
826
|
+
return null;
|
|
827
|
+
}
|
|
828
|
+
return createChainableTypeChecker(validate);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
function createElementTypeTypeChecker() {
|
|
832
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
833
|
+
var propValue = props[propName];
|
|
834
|
+
if (!reactIs.isValidElementType(propValue)) {
|
|
835
|
+
var propType = getPropType(propValue);
|
|
836
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
837
|
+
}
|
|
838
|
+
return null;
|
|
839
|
+
}
|
|
840
|
+
return createChainableTypeChecker(validate);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
844
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
845
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
846
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
847
|
+
var actualClassName = getClassName(props[propName]);
|
|
848
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
849
|
+
}
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
return createChainableTypeChecker(validate);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function createEnumTypeChecker(expectedValues) {
|
|
856
|
+
if (!Array.isArray(expectedValues)) {
|
|
857
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
858
|
+
if (arguments.length > 1) {
|
|
859
|
+
printWarning$1(
|
|
860
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
861
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
862
|
+
);
|
|
863
|
+
} else {
|
|
864
|
+
printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return emptyFunctionThatReturnsNull;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
871
|
+
var propValue = props[propName];
|
|
872
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
873
|
+
if (is(propValue, expectedValues[i])) {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
879
|
+
var type = getPreciseType(value);
|
|
880
|
+
if (type === 'symbol') {
|
|
881
|
+
return String(value);
|
|
882
|
+
}
|
|
883
|
+
return value;
|
|
884
|
+
});
|
|
885
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
886
|
+
}
|
|
887
|
+
return createChainableTypeChecker(validate);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
891
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
892
|
+
if (typeof typeChecker !== 'function') {
|
|
893
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
894
|
+
}
|
|
895
|
+
var propValue = props[propName];
|
|
896
|
+
var propType = getPropType(propValue);
|
|
897
|
+
if (propType !== 'object') {
|
|
898
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
899
|
+
}
|
|
900
|
+
for (var key in propValue) {
|
|
901
|
+
if (has$1(propValue, key)) {
|
|
902
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
903
|
+
if (error instanceof Error) {
|
|
904
|
+
return error;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
return createChainableTypeChecker(validate);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
914
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
915
|
+
process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
916
|
+
return emptyFunctionThatReturnsNull;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
920
|
+
var checker = arrayOfTypeCheckers[i];
|
|
921
|
+
if (typeof checker !== 'function') {
|
|
922
|
+
printWarning$1(
|
|
923
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
924
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
925
|
+
);
|
|
926
|
+
return emptyFunctionThatReturnsNull;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
931
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
932
|
+
var checker = arrayOfTypeCheckers[i];
|
|
933
|
+
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
|
934
|
+
return null;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
|
939
|
+
}
|
|
940
|
+
return createChainableTypeChecker(validate);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
function createNodeChecker() {
|
|
944
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
945
|
+
if (!isNode(props[propName])) {
|
|
946
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
947
|
+
}
|
|
948
|
+
return null;
|
|
949
|
+
}
|
|
950
|
+
return createChainableTypeChecker(validate);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
954
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
955
|
+
var propValue = props[propName];
|
|
956
|
+
var propType = getPropType(propValue);
|
|
957
|
+
if (propType !== 'object') {
|
|
958
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
959
|
+
}
|
|
960
|
+
for (var key in shapeTypes) {
|
|
961
|
+
var checker = shapeTypes[key];
|
|
962
|
+
if (!checker) {
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
965
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
966
|
+
if (error) {
|
|
967
|
+
return error;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return null;
|
|
971
|
+
}
|
|
972
|
+
return createChainableTypeChecker(validate);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
976
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
977
|
+
var propValue = props[propName];
|
|
978
|
+
var propType = getPropType(propValue);
|
|
979
|
+
if (propType !== 'object') {
|
|
980
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
981
|
+
}
|
|
982
|
+
// We need to check all keys in case some are required but missing from
|
|
983
|
+
// props.
|
|
984
|
+
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
985
|
+
for (var key in allKeys) {
|
|
986
|
+
var checker = shapeTypes[key];
|
|
987
|
+
if (!checker) {
|
|
988
|
+
return new PropTypeError(
|
|
989
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
990
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
991
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
995
|
+
if (error) {
|
|
996
|
+
return error;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return null;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
return createChainableTypeChecker(validate);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
function isNode(propValue) {
|
|
1006
|
+
switch (typeof propValue) {
|
|
1007
|
+
case 'number':
|
|
1008
|
+
case 'string':
|
|
1009
|
+
case 'undefined':
|
|
1010
|
+
return true;
|
|
1011
|
+
case 'boolean':
|
|
1012
|
+
return !propValue;
|
|
1013
|
+
case 'object':
|
|
1014
|
+
if (Array.isArray(propValue)) {
|
|
1015
|
+
return propValue.every(isNode);
|
|
1016
|
+
}
|
|
1017
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
1018
|
+
return true;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
1022
|
+
if (iteratorFn) {
|
|
1023
|
+
var iterator = iteratorFn.call(propValue);
|
|
1024
|
+
var step;
|
|
1025
|
+
if (iteratorFn !== propValue.entries) {
|
|
1026
|
+
while (!(step = iterator.next()).done) {
|
|
1027
|
+
if (!isNode(step.value)) {
|
|
1028
|
+
return false;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
} else {
|
|
1032
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1033
|
+
while (!(step = iterator.next()).done) {
|
|
1034
|
+
var entry = step.value;
|
|
1035
|
+
if (entry) {
|
|
1036
|
+
if (!isNode(entry[1])) {
|
|
1037
|
+
return false;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
} else {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
return true;
|
|
1047
|
+
default:
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function isSymbol(propType, propValue) {
|
|
1053
|
+
// Native Symbol.
|
|
1054
|
+
if (propType === 'symbol') {
|
|
1055
|
+
return true;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// falsy value can't be a Symbol
|
|
1059
|
+
if (!propValue) {
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1064
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1065
|
+
return true;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1069
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1070
|
+
return true;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
return false;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1077
|
+
function getPropType(propValue) {
|
|
1078
|
+
var propType = typeof propValue;
|
|
1079
|
+
if (Array.isArray(propValue)) {
|
|
1080
|
+
return 'array';
|
|
1081
|
+
}
|
|
1082
|
+
if (propValue instanceof RegExp) {
|
|
1083
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1084
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1085
|
+
// passes PropTypes.object.
|
|
1086
|
+
return 'object';
|
|
1087
|
+
}
|
|
1088
|
+
if (isSymbol(propType, propValue)) {
|
|
1089
|
+
return 'symbol';
|
|
1090
|
+
}
|
|
1091
|
+
return propType;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1095
|
+
// See `createPrimitiveTypeChecker`.
|
|
1096
|
+
function getPreciseType(propValue) {
|
|
1097
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1098
|
+
return '' + propValue;
|
|
1099
|
+
}
|
|
1100
|
+
var propType = getPropType(propValue);
|
|
1101
|
+
if (propType === 'object') {
|
|
1102
|
+
if (propValue instanceof Date) {
|
|
1103
|
+
return 'date';
|
|
1104
|
+
} else if (propValue instanceof RegExp) {
|
|
1105
|
+
return 'regexp';
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
return propType;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1112
|
+
// For example, "undefined" or "of type array"
|
|
1113
|
+
function getPostfixForTypeWarning(value) {
|
|
1114
|
+
var type = getPreciseType(value);
|
|
1115
|
+
switch (type) {
|
|
1116
|
+
case 'array':
|
|
1117
|
+
case 'object':
|
|
1118
|
+
return 'an ' + type;
|
|
1119
|
+
case 'boolean':
|
|
1120
|
+
case 'date':
|
|
1121
|
+
case 'regexp':
|
|
1122
|
+
return 'a ' + type;
|
|
1123
|
+
default:
|
|
1124
|
+
return type;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// Returns class name of the object, if any.
|
|
1129
|
+
function getClassName(propValue) {
|
|
1130
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1131
|
+
return ANONYMOUS;
|
|
1132
|
+
}
|
|
1133
|
+
return propValue.constructor.name;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
|
1137
|
+
ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
|
1138
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1139
|
+
|
|
1140
|
+
return ReactPropTypes;
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
function emptyFunction() {}
|
|
1144
|
+
function emptyFunctionWithReset() {}
|
|
1145
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1146
|
+
|
|
1147
|
+
var factoryWithThrowingShims = function() {
|
|
1148
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1149
|
+
if (secret === ReactPropTypesSecret_1) {
|
|
1150
|
+
// It is still safe when called from React.
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
var err = new Error(
|
|
1154
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1155
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1156
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
1157
|
+
);
|
|
1158
|
+
err.name = 'Invariant Violation';
|
|
1159
|
+
throw err;
|
|
1160
|
+
} shim.isRequired = shim;
|
|
1161
|
+
function getShim() {
|
|
1162
|
+
return shim;
|
|
1163
|
+
} // Important!
|
|
1164
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1165
|
+
var ReactPropTypes = {
|
|
1166
|
+
array: shim,
|
|
1167
|
+
bool: shim,
|
|
1168
|
+
func: shim,
|
|
1169
|
+
number: shim,
|
|
1170
|
+
object: shim,
|
|
1171
|
+
string: shim,
|
|
1172
|
+
symbol: shim,
|
|
1173
|
+
|
|
1174
|
+
any: shim,
|
|
1175
|
+
arrayOf: getShim,
|
|
1176
|
+
element: shim,
|
|
1177
|
+
elementType: shim,
|
|
1178
|
+
instanceOf: getShim,
|
|
1179
|
+
node: shim,
|
|
1180
|
+
objectOf: getShim,
|
|
1181
|
+
oneOf: getShim,
|
|
1182
|
+
oneOfType: getShim,
|
|
1183
|
+
shape: getShim,
|
|
1184
|
+
exact: getShim,
|
|
1185
|
+
|
|
1186
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1187
|
+
resetWarningCache: emptyFunction
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1191
|
+
|
|
1192
|
+
return ReactPropTypes;
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
var propTypes = createCommonjsModule(function (module) {
|
|
1196
|
+
/**
|
|
1197
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1198
|
+
*
|
|
1199
|
+
* This source code is licensed under the MIT license found in the
|
|
1200
|
+
* LICENSE file in the root directory of this source tree.
|
|
1201
|
+
*/
|
|
1202
|
+
|
|
1203
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1204
|
+
var ReactIs = reactIs;
|
|
1205
|
+
|
|
1206
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1207
|
+
// http://fb.me/prop-types-in-prod
|
|
1208
|
+
var throwOnDirectAccess = true;
|
|
1209
|
+
module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1210
|
+
} else {
|
|
1211
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1212
|
+
// http://fb.me/prop-types-in-prod
|
|
1213
|
+
module.exports = factoryWithThrowingShims();
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
|
|
195
1217
|
var MeetingProvider = function MeetingProvider(_ref) {
|
|
196
1218
|
var children = _ref.children,
|
|
197
1219
|
config = _ref.config,
|
|
@@ -242,10 +1264,6 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
242
1264
|
messages = _useState11[0],
|
|
243
1265
|
setMessages = _useState11[1];
|
|
244
1266
|
|
|
245
|
-
var _useState12 = React.useState(false),
|
|
246
|
-
isLiveStreaming = _useState12[0],
|
|
247
|
-
setIsLiveStreaming = _useState12[1];
|
|
248
|
-
|
|
249
1267
|
var meetingRef = React.useRef();
|
|
250
1268
|
var localMicOnRef = React.useRef();
|
|
251
1269
|
var localWebcamOnRef = React.useRef();
|
|
@@ -279,7 +1297,6 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
279
1297
|
setLocalScreenShareOn(false);
|
|
280
1298
|
setIsRecording(false);
|
|
281
1299
|
setMessages([]);
|
|
282
|
-
setIsLiveStreaming(false);
|
|
283
1300
|
};
|
|
284
1301
|
|
|
285
1302
|
var _handle_participant_joined = function _handle_participant_joined(participant) {
|
|
@@ -319,18 +1336,18 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
319
1336
|
};
|
|
320
1337
|
|
|
321
1338
|
var _handle_chat_message = function _handle_chat_message(data) {
|
|
1339
|
+
eventEmitter.emit(events['chat-message'], data);
|
|
322
1340
|
setMessages(function (s) {
|
|
323
1341
|
return [].concat(s, [data]);
|
|
324
1342
|
});
|
|
325
|
-
eventEmitter.emit(events['chat-message'], data);
|
|
326
1343
|
};
|
|
327
1344
|
|
|
328
|
-
var _handle_entry_requested = function _handle_entry_requested(
|
|
329
|
-
eventEmitter.emit(events['entry-requested'],
|
|
1345
|
+
var _handle_entry_requested = function _handle_entry_requested(participantId, name) {
|
|
1346
|
+
eventEmitter.emit(events['entry-requested'], participantId, name);
|
|
330
1347
|
};
|
|
331
1348
|
|
|
332
|
-
var _handle_entry_responded = function _handle_entry_responded(participantId,
|
|
333
|
-
eventEmitter.emit(events['entry-responded'], participantId,
|
|
1349
|
+
var _handle_entry_responded = function _handle_entry_responded(participantId, name) {
|
|
1350
|
+
eventEmitter.emit(events['entry-responded'], participantId, name);
|
|
334
1351
|
};
|
|
335
1352
|
|
|
336
1353
|
var _handle_recording_started = function _handle_recording_started() {
|
|
@@ -343,6 +1360,14 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
343
1360
|
eventEmitter.emit(events['recording-stopped']);
|
|
344
1361
|
};
|
|
345
1362
|
|
|
1363
|
+
var _handle_meeting_joined = function _handle_meeting_joined() {
|
|
1364
|
+
eventEmitter.emit(events['meeting-joined']);
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
var _handle_meeting_left = function _handle_meeting_left() {
|
|
1368
|
+
eventEmitter.emit(events['meeting-left']);
|
|
1369
|
+
};
|
|
1370
|
+
|
|
346
1371
|
var _handle_localParticipant_stream_enabled = function _handle_localParticipant_stream_enabled(stream) {
|
|
347
1372
|
if (stream.track.readyState === 'live') {
|
|
348
1373
|
if (stream.kind === 'video') {
|
|
@@ -363,81 +1388,16 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
363
1388
|
}
|
|
364
1389
|
};
|
|
365
1390
|
|
|
366
|
-
var _handle_live_stream_started = function _handle_live_stream_started(data) {
|
|
367
|
-
setIsLiveStreaming(true);
|
|
368
|
-
eventEmitter.emit(events['live-stream-started'], data);
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
var _handle_live_stream_stopped = function _handle_live_stream_stopped() {
|
|
372
|
-
setIsLiveStreaming(false);
|
|
373
|
-
eventEmitter.emit(events['live-stream-stopped']);
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
var _handle_video_state_changed = function _handle_video_state_changed(data) {
|
|
377
|
-
eventEmitter.emit(events['video-state-changed'], data);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
var _handle_video_seeked = function _handle_video_seeked(data) {
|
|
381
|
-
eventEmitter.emit(events['video-seeked'], data);
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
var _handle_webcam_requested = function _handle_webcam_requested(data) {
|
|
385
|
-
eventEmitter.emit(events['webcam-requested'], data);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
var _handle_mic_requested = function _handle_mic_requested(data) {
|
|
389
|
-
eventEmitter.emit(events['mic-requested'], data);
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
var _handle_meeting_joined = function _handle_meeting_joined(data) {
|
|
393
|
-
eventEmitter.emit(events['meeting-joined'], data);
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
var _handle_meeting_left = function _handle_meeting_left() {
|
|
397
|
-
eventEmitter.emit(events['meeting-left']);
|
|
398
|
-
var meeting = meetingRef.current;
|
|
399
|
-
|
|
400
|
-
if (meeting) {
|
|
401
|
-
var _meeting$localPartici;
|
|
402
|
-
|
|
403
|
-
if (typeof (meeting === null || meeting === void 0 ? void 0 : meeting.off) === 'function') {
|
|
404
|
-
meeting.off('participant-joined', _handle_participant_joined);
|
|
405
|
-
meeting.off('participant-left', _handle_participant_left);
|
|
406
|
-
meeting.off('presenter-changed', _handle_presenter_changed);
|
|
407
|
-
meeting.off('main-participant-changed', _handle_main_participant_changed);
|
|
408
|
-
meeting.off('speaker-changed', _handle_speaker_changed);
|
|
409
|
-
meeting.off('entry-requested', _handle_entry_requested);
|
|
410
|
-
meeting.off('entry-responded', _handle_entry_responded);
|
|
411
|
-
meeting.off('chat-message', _handle_chat_message);
|
|
412
|
-
meeting.off('recording-started', _handle_recording_started);
|
|
413
|
-
meeting.off('recording-stopped', _handle_recording_stopped);
|
|
414
|
-
meeting.off('meeting-joined', _handle_meeting_joined);
|
|
415
|
-
meeting.off('meeting-left', _handle_meeting_left);
|
|
416
|
-
meeting.off('livestream-started', _handle_live_stream_started);
|
|
417
|
-
meeting.off('livestream-stopped', _handle_live_stream_stopped);
|
|
418
|
-
meeting.off('video-state-changed', _handle_video_state_changed);
|
|
419
|
-
meeting.off('video-seeked', _handle_video_seeked);
|
|
420
|
-
meeting.off('webcam-requested', _handle_webcam_requested);
|
|
421
|
-
meeting.off('mic-requested', _handle_mic_requested);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
if (typeof (meeting === null || meeting === void 0 ? void 0 : (_meeting$localPartici = meeting.localParticipant) === null || _meeting$localPartici === void 0 ? void 0 : _meeting$localPartici.off) === 'function') {
|
|
425
|
-
meeting.localParticipant.off('stream-enabled', _handle_localParticipant_stream_enabled);
|
|
426
|
-
meeting.localParticipant.off('stream-disabled', _handle_localParticipant_stream_disabled);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
resetStates();
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
|
|
433
1391
|
var join = function join() {
|
|
434
|
-
var meeting =
|
|
1392
|
+
var meeting = js.ZujoSDK.initMeeting(config);
|
|
435
1393
|
setMeeting(meeting);
|
|
436
1394
|
var localParticipant = meeting.localParticipant,
|
|
437
|
-
participants = meeting.participants
|
|
1395
|
+
participants = meeting.participants,
|
|
1396
|
+
messages = meeting.messages;
|
|
438
1397
|
participants.set(localParticipant.id, localParticipant);
|
|
439
1398
|
setParticipants(participants);
|
|
440
1399
|
setLocalParticipant(localParticipant);
|
|
1400
|
+
setMessages(messages);
|
|
441
1401
|
meeting.on('participant-joined', _handle_participant_joined);
|
|
442
1402
|
meeting.on('participant-left', _handle_participant_left);
|
|
443
1403
|
meeting.on('presenter-changed', _handle_presenter_changed);
|
|
@@ -450,67 +1410,58 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
450
1410
|
meeting.on('recording-stopped', _handle_recording_stopped);
|
|
451
1411
|
meeting.on('meeting-joined', _handle_meeting_joined);
|
|
452
1412
|
meeting.on('meeting-left', _handle_meeting_left);
|
|
453
|
-
meeting.on('livestream-started', _handle_live_stream_started);
|
|
454
|
-
meeting.on('livestream-stopped', _handle_live_stream_stopped);
|
|
455
|
-
meeting.on('video-state-changed', _handle_video_state_changed);
|
|
456
|
-
meeting.on('video-seeked', _handle_video_seeked);
|
|
457
|
-
meeting.on('webcam-requested', _handle_webcam_requested);
|
|
458
|
-
meeting.on('mic-requested', _handle_mic_requested);
|
|
459
1413
|
meeting.localParticipant.on('stream-enabled', _handle_localParticipant_stream_enabled);
|
|
460
1414
|
meeting.localParticipant.on('stream-disabled', _handle_localParticipant_stream_disabled);
|
|
461
1415
|
meeting.join();
|
|
462
1416
|
};
|
|
463
1417
|
|
|
464
1418
|
var leave = function leave() {
|
|
1419
|
+
var _meeting$localPartici;
|
|
1420
|
+
|
|
465
1421
|
var meeting = meetingRef.current;
|
|
466
1422
|
|
|
467
|
-
if (meeting) {
|
|
468
|
-
meeting.
|
|
1423
|
+
if (typeof (meeting === null || meeting === void 0 ? void 0 : meeting.off) === 'function') {
|
|
1424
|
+
meeting.off('participant-joined', _handle_participant_joined);
|
|
1425
|
+
meeting.off('participant-left', _handle_participant_left);
|
|
1426
|
+
meeting.off('presenter-changed', _handle_presenter_changed);
|
|
1427
|
+
meeting.off('main-participant-changed', _handle_main_participant_changed);
|
|
1428
|
+
meeting.off('speaker-changed', _handle_speaker_changed);
|
|
1429
|
+
meeting.off('chat-message', _handle_chat_message);
|
|
1430
|
+
meeting.off('meeting-joined', _handle_meeting_joined);
|
|
1431
|
+
meeting.off('meeting-left', _handle_meeting_left);
|
|
469
1432
|
}
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
var end = function end() {
|
|
473
|
-
var meeting = meetingRef.current;
|
|
474
1433
|
|
|
475
|
-
if (meeting) {
|
|
476
|
-
meeting.
|
|
1434
|
+
if (typeof (meeting === null || meeting === void 0 ? void 0 : (_meeting$localPartici = meeting.localParticipant) === null || _meeting$localPartici === void 0 ? void 0 : _meeting$localPartici.off) === 'function') {
|
|
1435
|
+
meeting.localParticipant.off('stream-enabled', _handle_localParticipant_stream_enabled);
|
|
1436
|
+
meeting.localParticipant.off('stream-disabled', _handle_localParticipant_stream_disabled);
|
|
477
1437
|
}
|
|
1438
|
+
|
|
1439
|
+
meeting.leave();
|
|
1440
|
+
resetStates();
|
|
478
1441
|
};
|
|
479
1442
|
|
|
480
1443
|
var startRecording = function startRecording(webhookUrl) {
|
|
481
1444
|
var meeting = meetingRef.current;
|
|
482
|
-
|
|
483
|
-
if (meeting) {
|
|
484
|
-
meeting.startRecording(webhookUrl);
|
|
485
|
-
}
|
|
1445
|
+
meeting.startRecording(webhookUrl);
|
|
486
1446
|
};
|
|
487
1447
|
|
|
488
1448
|
var stopRecording = function stopRecording() {
|
|
489
1449
|
var meeting = meetingRef.current;
|
|
1450
|
+
var isRecording = isRecordingRef.current;
|
|
490
1451
|
|
|
491
|
-
if (
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
if (_isRecording) {
|
|
495
|
-
meeting.stopRecording();
|
|
496
|
-
}
|
|
1452
|
+
if (isRecording) {
|
|
1453
|
+
meeting.stopRecording();
|
|
497
1454
|
}
|
|
498
1455
|
};
|
|
499
1456
|
|
|
500
1457
|
var unmuteMic = function unmuteMic() {
|
|
501
1458
|
var meeting = meetingRef.current;
|
|
502
|
-
|
|
503
|
-
if (meeting) {
|
|
504
|
-
meeting.unmuteMic();
|
|
505
|
-
}
|
|
1459
|
+
meeting.unmuteMic();
|
|
506
1460
|
};
|
|
507
1461
|
|
|
508
1462
|
var muteMic = function muteMic() {
|
|
509
1463
|
var meeting = meetingRef.current;
|
|
510
|
-
|
|
511
|
-
if (meeting) {
|
|
512
|
-
meeting.muteMic();
|
|
513
|
-
}
|
|
1464
|
+
meeting.muteMic();
|
|
514
1465
|
};
|
|
515
1466
|
|
|
516
1467
|
var toggleMic = function toggleMic() {
|
|
@@ -525,18 +1476,12 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
525
1476
|
|
|
526
1477
|
var disableWebcam = function disableWebcam() {
|
|
527
1478
|
var meeting = meetingRef.current;
|
|
528
|
-
|
|
529
|
-
if (meeting) {
|
|
530
|
-
meeting.disableWebcam();
|
|
531
|
-
}
|
|
1479
|
+
meeting.disableWebcam();
|
|
532
1480
|
};
|
|
533
1481
|
|
|
534
1482
|
var enableWebcam = function enableWebcam() {
|
|
535
1483
|
var meeting = meetingRef.current;
|
|
536
|
-
|
|
537
|
-
if (meeting) {
|
|
538
|
-
meeting.enableWebcam();
|
|
539
|
-
}
|
|
1484
|
+
meeting.enableWebcam();
|
|
540
1485
|
};
|
|
541
1486
|
|
|
542
1487
|
var toggleWebcam = function toggleWebcam() {
|
|
@@ -551,18 +1496,12 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
551
1496
|
|
|
552
1497
|
var disableScreenShare = function disableScreenShare() {
|
|
553
1498
|
var meeting = meetingRef.current;
|
|
554
|
-
|
|
555
|
-
if (meeting) {
|
|
556
|
-
meeting.disableScreenShare();
|
|
557
|
-
}
|
|
1499
|
+
meeting.disableScreenShare();
|
|
558
1500
|
};
|
|
559
1501
|
|
|
560
1502
|
var enableScreenShare = function enableScreenShare() {
|
|
561
1503
|
var meeting = meetingRef.current;
|
|
562
|
-
|
|
563
|
-
if (meeting) {
|
|
564
|
-
meeting.enableScreenShare();
|
|
565
|
-
}
|
|
1504
|
+
meeting.enableScreenShare();
|
|
566
1505
|
};
|
|
567
1506
|
|
|
568
1507
|
var toggleScreenShare = function toggleScreenShare() {
|
|
@@ -577,129 +1516,16 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
577
1516
|
|
|
578
1517
|
var sendChatMessage = function sendChatMessage(text) {
|
|
579
1518
|
var meeting = meetingRef.current;
|
|
580
|
-
|
|
581
|
-
if (meeting) {
|
|
582
|
-
meeting.sendChatMessage(text);
|
|
583
|
-
}
|
|
1519
|
+
meeting.sendChatMessage(text);
|
|
584
1520
|
};
|
|
585
1521
|
|
|
586
1522
|
var respondEntry = function respondEntry(participantId, decision) {
|
|
587
1523
|
var meeting = meetingRef.current;
|
|
588
|
-
|
|
589
|
-
if (meeting) {
|
|
590
|
-
meeting.respondEntry(participantId, decision);
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
var getMics = function getMics() {
|
|
595
|
-
try {
|
|
596
|
-
var _meeting = meetingRef.current;
|
|
597
|
-
return Promise.resolve(function () {
|
|
598
|
-
if (_meeting) {
|
|
599
|
-
return Promise.resolve(_meeting.getMics());
|
|
600
|
-
}
|
|
601
|
-
}());
|
|
602
|
-
} catch (e) {
|
|
603
|
-
return Promise.reject(e);
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
var getWebcams = function getWebcams() {
|
|
608
|
-
try {
|
|
609
|
-
var _meeting2 = meetingRef.current;
|
|
610
|
-
return Promise.resolve(function () {
|
|
611
|
-
if (_meeting2) {
|
|
612
|
-
return Promise.resolve(_meeting2.getWebcams());
|
|
613
|
-
}
|
|
614
|
-
}());
|
|
615
|
-
} catch (e) {
|
|
616
|
-
return Promise.reject(e);
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
var changeWebcam = function changeWebcam(deviceId) {
|
|
621
|
-
var meeting = meetingRef.current;
|
|
622
|
-
|
|
623
|
-
if (meeting) {
|
|
624
|
-
meeting.changeWebcam(deviceId);
|
|
625
|
-
}
|
|
626
|
-
};
|
|
627
|
-
|
|
628
|
-
var changeMic = function changeMic(deviceId) {
|
|
629
|
-
var meeting = meetingRef.current;
|
|
630
|
-
|
|
631
|
-
if (meeting) {
|
|
632
|
-
meeting.changeMic(deviceId);
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
var startVideo = function startVideo(_ref2) {
|
|
637
|
-
var link = _ref2.link;
|
|
638
|
-
var meeting = meetingRef.current;
|
|
639
|
-
|
|
640
|
-
if (meeting) {
|
|
641
|
-
meeting.startVideo({
|
|
642
|
-
link: link
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
var stopVideo = function stopVideo() {
|
|
648
|
-
var meeting = meetingRef.current;
|
|
649
|
-
|
|
650
|
-
if (meeting) {
|
|
651
|
-
meeting.stopVideo();
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
var resumeVideo = function resumeVideo() {
|
|
656
|
-
var meeting = meetingRef.current;
|
|
657
|
-
|
|
658
|
-
if (meeting) {
|
|
659
|
-
meeting.resumeVideo();
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
|
|
663
|
-
var pauseVideo = function pauseVideo(_ref3) {
|
|
664
|
-
var currentTime = _ref3.currentTime;
|
|
665
|
-
var meeting = meetingRef.current;
|
|
666
|
-
|
|
667
|
-
if (meeting) {
|
|
668
|
-
meeting.pauseVideo({
|
|
669
|
-
currentTime: currentTime
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
var seekVideo = function seekVideo(_ref4) {
|
|
675
|
-
var currentTime = _ref4.currentTime;
|
|
676
|
-
var meeting = meetingRef.current;
|
|
677
|
-
|
|
678
|
-
if (meeting) {
|
|
679
|
-
meeting.seekVideo({
|
|
680
|
-
currentTime: currentTime
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
var startLivestream = function startLivestream(streamInfo) {
|
|
686
|
-
var meeting = meetingRef.current;
|
|
687
|
-
|
|
688
|
-
if (meeting) {
|
|
689
|
-
meeting.startLivestream(streamInfo);
|
|
690
|
-
}
|
|
691
|
-
};
|
|
692
|
-
|
|
693
|
-
var stopLivestream = function stopLivestream() {
|
|
694
|
-
var meeting = meetingRef.current;
|
|
695
|
-
|
|
696
|
-
if (meeting) {
|
|
697
|
-
meeting.stopLivestream();
|
|
698
|
-
}
|
|
1524
|
+
meeting.respondEntry(participantId, decision);
|
|
699
1525
|
};
|
|
700
1526
|
|
|
701
1527
|
var initSDK = function initSDK() {
|
|
702
|
-
|
|
1528
|
+
js.ZujoSDK.config(token);
|
|
703
1529
|
|
|
704
1530
|
if (joinWithoutUserInteraction) {
|
|
705
1531
|
join();
|
|
@@ -722,11 +1548,8 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
722
1548
|
localWebcamOn: localWebcamOn,
|
|
723
1549
|
localScreenShareOn: localScreenShareOn,
|
|
724
1550
|
messages: messages,
|
|
725
|
-
isRecording: isRecording,
|
|
726
|
-
isLiveStreaming: isLiveStreaming,
|
|
727
1551
|
join: join,
|
|
728
1552
|
leave: leave,
|
|
729
|
-
end: end,
|
|
730
1553
|
startRecording: startRecording,
|
|
731
1554
|
stopRecording: stopRecording,
|
|
732
1555
|
sendChatMessage: sendChatMessage,
|
|
@@ -739,21 +1562,20 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
739
1562
|
toggleWebcam: toggleWebcam,
|
|
740
1563
|
disableScreenShare: disableScreenShare,
|
|
741
1564
|
enableScreenShare: enableScreenShare,
|
|
742
|
-
toggleScreenShare: toggleScreenShare
|
|
743
|
-
getMics: getMics,
|
|
744
|
-
getWebcams: getWebcams,
|
|
745
|
-
changeWebcam: changeWebcam,
|
|
746
|
-
changeMic: changeMic,
|
|
747
|
-
startVideo: startVideo,
|
|
748
|
-
stopVideo: stopVideo,
|
|
749
|
-
resumeVideo: resumeVideo,
|
|
750
|
-
pauseVideo: pauseVideo,
|
|
751
|
-
seekVideo: seekVideo,
|
|
752
|
-
startLivestream: startLivestream,
|
|
753
|
-
stopLivestream: stopLivestream
|
|
1565
|
+
toggleScreenShare: toggleScreenShare
|
|
754
1566
|
}
|
|
755
1567
|
}, children);
|
|
756
1568
|
};
|
|
1569
|
+
MeetingProvider.propTypes = {
|
|
1570
|
+
config: propTypes.shape({
|
|
1571
|
+
meetingId: propTypes.string.isRequired,
|
|
1572
|
+
micEnabled: propTypes.bool.isRequired,
|
|
1573
|
+
webcamEnabled: propTypes.bool.isRequired,
|
|
1574
|
+
name: propTypes.string.isRequired
|
|
1575
|
+
}).isRequired,
|
|
1576
|
+
token: propTypes.string.isRequired,
|
|
1577
|
+
joinWithoutUserInteraction: propTypes.bool
|
|
1578
|
+
};
|
|
757
1579
|
|
|
758
1580
|
var useParticipant = function useParticipant(participantId, _temp) {
|
|
759
1581
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
@@ -782,18 +1604,21 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
782
1604
|
var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
|
|
783
1605
|
|
|
784
1606
|
var setTrack = function setTrack(stream) {
|
|
1607
|
+
var mediaStream = new MediaStream();
|
|
1608
|
+
mediaStream.addTrack(stream.track);
|
|
1609
|
+
|
|
785
1610
|
if (stream.track.readyState === 'live') {
|
|
786
1611
|
switch (stream.kind) {
|
|
787
1612
|
case 'video':
|
|
788
|
-
setwebcamStream(
|
|
1613
|
+
setwebcamStream(mediaStream);
|
|
789
1614
|
break;
|
|
790
1615
|
|
|
791
1616
|
case 'audio':
|
|
792
|
-
setMicStream(
|
|
1617
|
+
setMicStream(mediaStream);
|
|
793
1618
|
break;
|
|
794
1619
|
|
|
795
1620
|
case 'share':
|
|
796
|
-
setScreenShareStream(
|
|
1621
|
+
setScreenShareStream(mediaStream);
|
|
797
1622
|
break;
|
|
798
1623
|
}
|
|
799
1624
|
}
|