@sawport/react-sdk 0.1.0-alpha.12 → 0.1.0-alpha.15
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/dist/index.js +99 -118
- package/dist/style.css +1 -586
- package/package.json +4 -6
- package/dist/index.iife.js +0 -37861
- package/dist/index.umd.js +0 -37862
package/dist/index.js
CHANGED
|
@@ -1068,7 +1068,7 @@ function toPath(value2) {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
return isSymbol$a(value2) ? [value2] : copyArray(stringToPath$4(toString$h(value2)));
|
|
1070
1070
|
}
|
|
1071
|
-
var isProduction =
|
|
1071
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
1072
1072
|
function warning(condition, message) {
|
|
1073
1073
|
if (!isProduction) {
|
|
1074
1074
|
if (condition) {
|
|
@@ -1203,7 +1203,7 @@ function requireReactIs_development() {
|
|
|
1203
1203
|
if (hasRequiredReactIs_development)
|
|
1204
1204
|
return reactIs_development;
|
|
1205
1205
|
hasRequiredReactIs_development = 1;
|
|
1206
|
-
if (
|
|
1206
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1207
1207
|
(function() {
|
|
1208
1208
|
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
1209
1209
|
var REACT_ELEMENT_TYPE2 = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
@@ -1351,21 +1351,14 @@ function requireReactIs_development() {
|
|
|
1351
1351
|
}
|
|
1352
1352
|
return reactIs_development;
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
} else {
|
|
1363
|
-
module2.exports = requireReactIs_development();
|
|
1364
|
-
}
|
|
1365
|
-
})(reactIs$1);
|
|
1366
|
-
return reactIs$1.exports;
|
|
1367
|
-
}
|
|
1368
|
-
var reactIs = requireReactIs();
|
|
1354
|
+
(function(module2) {
|
|
1355
|
+
if (process.env.NODE_ENV === "production") {
|
|
1356
|
+
module2.exports = requireReactIs_production_min();
|
|
1357
|
+
} else {
|
|
1358
|
+
module2.exports = requireReactIs_development();
|
|
1359
|
+
}
|
|
1360
|
+
})(reactIs$1);
|
|
1361
|
+
var reactIs = reactIs$1.exports;
|
|
1369
1362
|
var FORWARD_REF_STATICS = {
|
|
1370
1363
|
"$$typeof": true,
|
|
1371
1364
|
render: true,
|
|
@@ -1525,7 +1518,7 @@ var FormikProvider = FormikContext.Provider;
|
|
|
1525
1518
|
FormikContext.Consumer;
|
|
1526
1519
|
function useFormikContext() {
|
|
1527
1520
|
var formik = useContext(FormikContext);
|
|
1528
|
-
!!!formik ?
|
|
1521
|
+
!!!formik ? process.env.NODE_ENV !== "production" ? warning(false, "Formik context is undefined, please verify you are calling useFormikContext() as child of a <Formik> component.") : warning(false) : void 0;
|
|
1529
1522
|
return formik;
|
|
1530
1523
|
}
|
|
1531
1524
|
function formikReducer(state, msg) {
|
|
@@ -1607,9 +1600,9 @@ function useFormik(_ref) {
|
|
|
1607
1600
|
var initialStatus = useRef(props.initialStatus);
|
|
1608
1601
|
var isMounted = useRef(false);
|
|
1609
1602
|
var fieldRegistry = useRef({});
|
|
1610
|
-
if (
|
|
1603
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1611
1604
|
useEffect(function() {
|
|
1612
|
-
!(typeof isInitialValid === "undefined") ?
|
|
1605
|
+
!(typeof isInitialValid === "undefined") ? process.env.NODE_ENV !== "production" ? warning(false, "isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors or validateOnMount instead.") : warning(false) : void 0;
|
|
1613
1606
|
}, []);
|
|
1614
1607
|
}
|
|
1615
1608
|
useEffect(function() {
|
|
@@ -1636,7 +1629,7 @@ function useFormik(_ref) {
|
|
|
1636
1629
|
maybePromisedErrors.then(function(errors) {
|
|
1637
1630
|
resolve(errors || emptyErrors);
|
|
1638
1631
|
}, function(actualException) {
|
|
1639
|
-
if (
|
|
1632
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1640
1633
|
console.warn("Warning: An unhandled error was caught during validation in <Formik validate />", actualException);
|
|
1641
1634
|
}
|
|
1642
1635
|
reject(actualException);
|
|
@@ -1657,7 +1650,7 @@ function useFormik(_ref) {
|
|
|
1657
1650
|
if (err.name === "ValidationError") {
|
|
1658
1651
|
resolve(yupToFormErrors(err));
|
|
1659
1652
|
} else {
|
|
1660
|
-
if (
|
|
1653
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1661
1654
|
console.warn("Warning: An unhandled error was caught during validation in <Formik validationSchema />", err);
|
|
1662
1655
|
}
|
|
1663
1656
|
reject(err);
|
|
@@ -1917,7 +1910,7 @@ function useFormik(_ref) {
|
|
|
1917
1910
|
var target = eventOrTextValue.target ? eventOrTextValue.target : eventOrTextValue.currentTarget;
|
|
1918
1911
|
var type = target.type, name = target.name, id2 = target.id, value2 = target.value, checked = target.checked, outerHTML = target.outerHTML, options = target.options, multiple = target.multiple;
|
|
1919
1912
|
field = maybePath ? maybePath : name ? name : id2;
|
|
1920
|
-
if (!field &&
|
|
1913
|
+
if (!field && process.env.NODE_ENV !== "production") {
|
|
1921
1914
|
warnAboutMissingIdentifier({
|
|
1922
1915
|
htmlContent: outerHTML,
|
|
1923
1916
|
documentationAnchorLink: "handlechange-e-reactchangeeventany--void",
|
|
@@ -1959,7 +1952,7 @@ function useFormik(_ref) {
|
|
|
1959
1952
|
}
|
|
1960
1953
|
var _e$target = e2.target, name = _e$target.name, id2 = _e$target.id, outerHTML = _e$target.outerHTML;
|
|
1961
1954
|
var field = path2 ? path2 : name ? name : id2;
|
|
1962
|
-
if (!field &&
|
|
1955
|
+
if (!field && process.env.NODE_ENV !== "production") {
|
|
1963
1956
|
warnAboutMissingIdentifier({
|
|
1964
1957
|
htmlContent: outerHTML,
|
|
1965
1958
|
documentationAnchorLink: "handleblur-e-any--void",
|
|
@@ -2054,10 +2047,10 @@ function useFormik(_ref) {
|
|
|
2054
2047
|
if (e2 && e2.stopPropagation && isFunction$6(e2.stopPropagation)) {
|
|
2055
2048
|
e2.stopPropagation();
|
|
2056
2049
|
}
|
|
2057
|
-
if (
|
|
2050
|
+
if (process.env.NODE_ENV !== "production" && typeof document !== "undefined") {
|
|
2058
2051
|
var activeElement = getActiveElement();
|
|
2059
2052
|
if (activeElement !== null && activeElement instanceof HTMLButtonElement) {
|
|
2060
|
-
!(activeElement.attributes && activeElement.attributes.getNamedItem("type")) ?
|
|
2053
|
+
!(activeElement.attributes && activeElement.attributes.getNamedItem("type")) ? process.env.NODE_ENV !== "production" ? warning(false, 'You submitted a Formik form using a button with an unspecified `type` attribute. Most browsers default button elements to `type="submit"`. If this is not a submit button, please add `type="button"`.') : warning(false) : void 0;
|
|
2061
2054
|
}
|
|
2062
2055
|
}
|
|
2063
2056
|
submitForm()["catch"](function(reason2) {
|
|
@@ -2190,9 +2183,9 @@ function Formik(props) {
|
|
|
2190
2183
|
useImperativeHandle(innerRef, function() {
|
|
2191
2184
|
return formikbag;
|
|
2192
2185
|
});
|
|
2193
|
-
if (
|
|
2186
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2194
2187
|
useEffect(function() {
|
|
2195
|
-
!!props.render ?
|
|
2188
|
+
!!props.render ? process.env.NODE_ENV !== "production" ? warning(false, "<Formik render> has been deprecated and will be removed in future versions of Formik. Please use a child callback function instead. To get rid of this warning, replace <Formik render={(props) => ...} /> with <Formik>{(props) => ...}</Formik>") : warning(false) : void 0;
|
|
2196
2189
|
}, []);
|
|
2197
2190
|
}
|
|
2198
2191
|
return createElement$1(FormikProvider, {
|
|
@@ -6131,7 +6124,7 @@ function requireCheckPropTypes() {
|
|
|
6131
6124
|
hasRequiredCheckPropTypes = 1;
|
|
6132
6125
|
var printWarning = function() {
|
|
6133
6126
|
};
|
|
6134
|
-
if (
|
|
6127
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6135
6128
|
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
6136
6129
|
var loggedTypeFailures = {};
|
|
6137
6130
|
var has2 = requireHas();
|
|
@@ -6147,7 +6140,7 @@ function requireCheckPropTypes() {
|
|
|
6147
6140
|
};
|
|
6148
6141
|
}
|
|
6149
6142
|
function checkPropTypes(typeSpecs, values, location2, componentName, getStack) {
|
|
6150
|
-
if (
|
|
6143
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6151
6144
|
for (var typeSpecName in typeSpecs) {
|
|
6152
6145
|
if (has2(typeSpecs, typeSpecName)) {
|
|
6153
6146
|
var error;
|
|
@@ -6180,7 +6173,7 @@ function requireCheckPropTypes() {
|
|
|
6180
6173
|
}
|
|
6181
6174
|
}
|
|
6182
6175
|
checkPropTypes.resetWarningCache = function() {
|
|
6183
|
-
if (
|
|
6176
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6184
6177
|
loggedTypeFailures = {};
|
|
6185
6178
|
}
|
|
6186
6179
|
};
|
|
@@ -6193,14 +6186,14 @@ function requireFactoryWithTypeCheckers() {
|
|
|
6193
6186
|
if (hasRequiredFactoryWithTypeCheckers)
|
|
6194
6187
|
return factoryWithTypeCheckers;
|
|
6195
6188
|
hasRequiredFactoryWithTypeCheckers = 1;
|
|
6196
|
-
var ReactIs =
|
|
6189
|
+
var ReactIs = reactIs$1.exports;
|
|
6197
6190
|
var assign3 = requireObjectAssign();
|
|
6198
6191
|
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
6199
6192
|
var has2 = requireHas();
|
|
6200
6193
|
var checkPropTypes = requireCheckPropTypes();
|
|
6201
6194
|
var printWarning = function() {
|
|
6202
6195
|
};
|
|
6203
|
-
if (
|
|
6196
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6204
6197
|
printWarning = function(text) {
|
|
6205
6198
|
var message = "Warning: " + text;
|
|
6206
6199
|
if (typeof console !== "undefined") {
|
|
@@ -6260,7 +6253,7 @@ function requireFactoryWithTypeCheckers() {
|
|
|
6260
6253
|
}
|
|
6261
6254
|
PropTypeError.prototype = Error.prototype;
|
|
6262
6255
|
function createChainableTypeChecker(validate) {
|
|
6263
|
-
if (
|
|
6256
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6264
6257
|
var manualPropTypeCallCache = {};
|
|
6265
6258
|
var manualPropTypeWarningCount = 0;
|
|
6266
6259
|
}
|
|
@@ -6274,7 +6267,7 @@ function requireFactoryWithTypeCheckers() {
|
|
|
6274
6267
|
);
|
|
6275
6268
|
err.name = "Invariant Violation";
|
|
6276
6269
|
throw err;
|
|
6277
|
-
} else if (
|
|
6270
|
+
} else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
6278
6271
|
var cacheKey = componentName + ":" + propName;
|
|
6279
6272
|
if (!manualPropTypeCallCache[cacheKey] && manualPropTypeWarningCount < 3) {
|
|
6280
6273
|
printWarning(
|
|
@@ -6374,7 +6367,7 @@ function requireFactoryWithTypeCheckers() {
|
|
|
6374
6367
|
}
|
|
6375
6368
|
function createEnumTypeChecker(expectedValues) {
|
|
6376
6369
|
if (!Array.isArray(expectedValues)) {
|
|
6377
|
-
if (
|
|
6370
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6378
6371
|
if (arguments.length > 1) {
|
|
6379
6372
|
printWarning(
|
|
6380
6373
|
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
@@ -6427,7 +6420,7 @@ function requireFactoryWithTypeCheckers() {
|
|
|
6427
6420
|
}
|
|
6428
6421
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
6429
6422
|
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
6430
|
-
|
|
6423
|
+
process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
6431
6424
|
return emptyFunctionThatReturnsNull;
|
|
6432
6425
|
}
|
|
6433
6426
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
@@ -6685,8 +6678,8 @@ function requireFactoryWithThrowingShims() {
|
|
|
6685
6678
|
};
|
|
6686
6679
|
return factoryWithThrowingShims;
|
|
6687
6680
|
}
|
|
6688
|
-
if (
|
|
6689
|
-
var ReactIs =
|
|
6681
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6682
|
+
var ReactIs = reactIs$1.exports;
|
|
6690
6683
|
var throwOnDirectAccess = true;
|
|
6691
6684
|
propTypes$h.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
6692
6685
|
} else {
|
|
@@ -6966,7 +6959,7 @@ function requireReactJsxRuntime_development() {
|
|
|
6966
6959
|
if (hasRequiredReactJsxRuntime_development)
|
|
6967
6960
|
return reactJsxRuntime_development;
|
|
6968
6961
|
hasRequiredReactJsxRuntime_development = 1;
|
|
6969
|
-
if (
|
|
6962
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6970
6963
|
(function() {
|
|
6971
6964
|
var React2 = React__default;
|
|
6972
6965
|
var REACT_ELEMENT_TYPE2 = Symbol.for("react.element");
|
|
@@ -7830,7 +7823,7 @@ function requireReactJsxRuntime_development() {
|
|
|
7830
7823
|
return reactJsxRuntime_development;
|
|
7831
7824
|
}
|
|
7832
7825
|
(function(module2) {
|
|
7833
|
-
if (
|
|
7826
|
+
if (process.env.NODE_ENV === "production") {
|
|
7834
7827
|
module2.exports = requireReactJsxRuntime_production_min();
|
|
7835
7828
|
} else {
|
|
7836
7829
|
module2.exports = requireReactJsxRuntime_development();
|
|
@@ -8651,13 +8644,13 @@ var _propTypes = _interopRequireDefault$2(propTypes$h.exports);
|
|
|
8651
8644
|
function _interopRequireDefault$2(obj) {
|
|
8652
8645
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
8653
8646
|
}
|
|
8654
|
-
var timeoutsShape =
|
|
8647
|
+
var timeoutsShape = process.env.NODE_ENV !== "production" ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
8655
8648
|
enter: _propTypes.default.number,
|
|
8656
8649
|
exit: _propTypes.default.number,
|
|
8657
8650
|
appear: _propTypes.default.number
|
|
8658
8651
|
}).isRequired]) : null;
|
|
8659
8652
|
PropTypes$1.timeoutsShape = timeoutsShape;
|
|
8660
|
-
var classNamesShape =
|
|
8653
|
+
var classNamesShape = process.env.NODE_ENV !== "production" ? _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
|
8661
8654
|
enter: _propTypes.default.string,
|
|
8662
8655
|
exit: _propTypes.default.string,
|
|
8663
8656
|
active: _propTypes.default.string
|
|
@@ -8963,7 +8956,7 @@ var Transition = /* @__PURE__ */ function(_React$Component) {
|
|
|
8963
8956
|
return Transition2;
|
|
8964
8957
|
}(_react$1.default.Component);
|
|
8965
8958
|
Transition.contextType = _TransitionGroupContext.default;
|
|
8966
|
-
Transition.propTypes =
|
|
8959
|
+
Transition.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
8967
8960
|
children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
|
|
8968
8961
|
in: PropTypes.bool,
|
|
8969
8962
|
mountOnEnter: PropTypes.bool,
|
|
@@ -9175,7 +9168,7 @@ Transition$1.default = _default;
|
|
|
9175
9168
|
CSSTransition2.defaultProps = {
|
|
9176
9169
|
classNames: ""
|
|
9177
9170
|
};
|
|
9178
|
-
CSSTransition2.propTypes =
|
|
9171
|
+
CSSTransition2.propTypes = process.env.NODE_ENV !== "production" ? _extends2({}, _Transition2.default.propTypes, {
|
|
9179
9172
|
classNames: _PropTypes2.classNamesShape,
|
|
9180
9173
|
onEnter: PropTypes2.func,
|
|
9181
9174
|
onEntering: PropTypes2.func,
|
|
@@ -9421,7 +9414,7 @@ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
|
|
9421
9414
|
};
|
|
9422
9415
|
return TransitionGroup3;
|
|
9423
9416
|
}(_react2.default.Component);
|
|
9424
|
-
TransitionGroup2.propTypes =
|
|
9417
|
+
TransitionGroup2.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
9425
9418
|
component: _propTypes2.default.any,
|
|
9426
9419
|
children: _propTypes2.default.node,
|
|
9427
9420
|
appear: _propTypes2.default.bool,
|
|
@@ -9542,7 +9535,7 @@ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
|
|
9542
9535
|
};
|
|
9543
9536
|
return ReplaceTransition3;
|
|
9544
9537
|
}(_react2.default.Component);
|
|
9545
|
-
ReplaceTransition2.propTypes =
|
|
9538
|
+
ReplaceTransition2.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
9546
9539
|
in: _propTypes2.default.bool.isRequired,
|
|
9547
9540
|
children: function children(props, propName) {
|
|
9548
9541
|
if (_react2.default.Children.count(props[propName]) !== 2)
|
|
@@ -15127,7 +15120,7 @@ function useMutation(arg1, arg2, arg3) {
|
|
|
15127
15120
|
function n$1(t2) {
|
|
15128
15121
|
for (var e2 = arguments.length, r2 = Array(e2 > 1 ? e2 - 1 : 0), n2 = 1; n2 < e2; n2++)
|
|
15129
15122
|
r2[n2 - 1] = arguments[n2];
|
|
15130
|
-
if ("production" !==
|
|
15123
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
15131
15124
|
var o2 = G[t2], i = o2 ? "function" == typeof o2 ? o2.apply(null, r2) : o2 : "unknown error nr: " + t2;
|
|
15132
15125
|
throw Error("[Immer] " + i);
|
|
15133
15126
|
}
|
|
@@ -15203,7 +15196,7 @@ function b(t2) {
|
|
|
15203
15196
|
return e2 || n$1(18, t2), e2;
|
|
15204
15197
|
}
|
|
15205
15198
|
function m$1() {
|
|
15206
|
-
return "production" ===
|
|
15199
|
+
return "production" === process.env.NODE_ENV || M || n$1(0), M;
|
|
15207
15200
|
}
|
|
15208
15201
|
function g(t2, e2) {
|
|
15209
15202
|
e2 && (b("Patches"), t2.u = [], t2.s = [], t2.v = e2);
|
|
@@ -15248,7 +15241,7 @@ function D(t2, e2, r2) {
|
|
|
15248
15241
|
return n2.o;
|
|
15249
15242
|
}
|
|
15250
15243
|
function E(t2, e2, r2, u2, a2, s2) {
|
|
15251
|
-
if ("production" !==
|
|
15244
|
+
if ("production" !== process.env.NODE_ENV && a2 === r2 && n$1(5), o$2(a2)) {
|
|
15252
15245
|
var l2 = D(t2, a2, s2 && e2 && 3 !== e2.i && !c$1(e2.D, u2) ? s2.concat(u2) : void 0);
|
|
15253
15246
|
if (f(r2, u2, l2), !o$2(l2))
|
|
15254
15247
|
return;
|
|
@@ -15386,9 +15379,9 @@ u(H, function(t2, e2) {
|
|
|
15386
15379
|
return arguments[0] = arguments[0][0], e2.apply(this, arguments);
|
|
15387
15380
|
};
|
|
15388
15381
|
}), L.deleteProperty = function(t2, e2) {
|
|
15389
|
-
return "production" !==
|
|
15382
|
+
return "production" !== process.env.NODE_ENV && isNaN(parseInt(e2)) && n$1(13), H.deleteProperty.call(this, t2[0], e2);
|
|
15390
15383
|
}, L.set = function(t2, e2, r2) {
|
|
15391
|
-
return "production" !==
|
|
15384
|
+
return "production" !== process.env.NODE_ENV && "length" !== e2 && isNaN(parseInt(e2)) && n$1(14), H.set.call(this, t2[0], e2, r2, t2[0]);
|
|
15392
15385
|
};
|
|
15393
15386
|
var Q = new (function() {
|
|
15394
15387
|
function t2(t3) {
|
|
@@ -15449,7 +15442,7 @@ var Q = new (function() {
|
|
|
15449
15442
|
return r2[$$j].C = true, P(e3), r2;
|
|
15450
15443
|
}, e2.finishDraft = function(t3, e3) {
|
|
15451
15444
|
var r2 = t3 && t3[$$j];
|
|
15452
|
-
"production" !==
|
|
15445
|
+
"production" !== process.env.NODE_ENV && (r2 && r2.C || n$1(9), r2.I && n$1(10));
|
|
15453
15446
|
var o2 = r2.A;
|
|
15454
15447
|
return g(o2, e3), A(void 0, o2);
|
|
15455
15448
|
}, e2.setAutoFreeze = function(t3) {
|
|
@@ -36636,7 +36629,8 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36636
36629
|
connected: false,
|
|
36637
36630
|
localICECandidates: []
|
|
36638
36631
|
});
|
|
36639
|
-
|
|
36632
|
+
const localVideoRef = useRef(null);
|
|
36633
|
+
const remoteVideoRef = useRef(null);
|
|
36640
36634
|
const { socket: socket2 } = useSocket();
|
|
36641
36635
|
const getMediaStream = useCallback(
|
|
36642
36636
|
() => navigator.mediaDevices.getUserMedia({
|
|
@@ -36648,24 +36642,23 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36648
36642
|
const addStreamToVideo = useCallback(
|
|
36649
36643
|
(stream) => {
|
|
36650
36644
|
try {
|
|
36651
|
-
|
|
36652
|
-
|
|
36653
|
-
|
|
36654
|
-
localVideo.volume = 0;
|
|
36655
|
-
ref.current.localStream = stream;
|
|
36645
|
+
if (localVideoRef.current) {
|
|
36646
|
+
localVideoRef.current.srcObject = stream;
|
|
36647
|
+
localVideoRef.current.volume = 0;
|
|
36656
36648
|
}
|
|
36657
36649
|
ref.current.isInit = true;
|
|
36658
36650
|
} catch (error) {
|
|
36659
36651
|
console.warn(error.message);
|
|
36660
36652
|
}
|
|
36661
36653
|
},
|
|
36662
|
-
[ref]
|
|
36654
|
+
[ref, localVideoRef]
|
|
36663
36655
|
);
|
|
36664
36656
|
const initMedia = useCallback(async () => {
|
|
36665
36657
|
if (ref.current.isInit) {
|
|
36666
36658
|
return ref.current.localStream;
|
|
36667
36659
|
}
|
|
36668
36660
|
const stream = await getMediaStream();
|
|
36661
|
+
ref.current.localStream = stream;
|
|
36669
36662
|
addStreamToVideo(stream);
|
|
36670
36663
|
return stream;
|
|
36671
36664
|
}, [ref, getMediaStream, addStreamToVideo]);
|
|
@@ -36699,21 +36692,19 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36699
36692
|
if (document.pictureInPictureElement) {
|
|
36700
36693
|
document.exitPictureInPicture();
|
|
36701
36694
|
}
|
|
36702
|
-
const remoteVideo = document.getElementById("remote-video");
|
|
36703
|
-
const localVideo = document.getElementById("local-video");
|
|
36704
36695
|
peerConnection.close();
|
|
36705
36696
|
peerConnection.onicecandidate = null;
|
|
36706
36697
|
peerConnection.ontrack = null;
|
|
36707
36698
|
peerConnection.onaddstream = null;
|
|
36708
|
-
|
|
36709
|
-
|
|
36699
|
+
localVideoRef.current && (localVideoRef.current.srcObject = null);
|
|
36700
|
+
remoteVideoRef.current && (remoteVideoRef.current.srcObject = null);
|
|
36710
36701
|
ref.current.localStream.getTracks().forEach((track) => track.stop());
|
|
36711
36702
|
if (setUp) {
|
|
36712
36703
|
ref.current.peerConnection = new RTCPeerConnection(peerConnectionConfig);
|
|
36713
36704
|
}
|
|
36714
36705
|
}
|
|
36715
36706
|
},
|
|
36716
|
-
[ref]
|
|
36707
|
+
[ref, localVideoRef, remoteVideoRef]
|
|
36717
36708
|
);
|
|
36718
36709
|
const clearCalls = (append = {}) => {
|
|
36719
36710
|
ref.current.data = null;
|
|
@@ -36779,10 +36770,9 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36779
36770
|
}
|
|
36780
36771
|
};
|
|
36781
36772
|
ref.current.peerConnection.onaddstream = function({ stream }) {
|
|
36782
|
-
|
|
36783
|
-
if (remoteVideo && stream && ref.current.remoteStream !== stream) {
|
|
36773
|
+
if (remoteVideoRef.current && stream && ref.current.remoteStream !== stream) {
|
|
36784
36774
|
ref.current.remoteStream = stream;
|
|
36785
|
-
|
|
36775
|
+
remoteVideoRef.current.srcObject = stream;
|
|
36786
36776
|
}
|
|
36787
36777
|
};
|
|
36788
36778
|
ref.current.peerConnection.ontrack = function({ streams: [stream], track }) {
|
|
@@ -36791,13 +36781,12 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36791
36781
|
ref.current.expectScreenShare = false;
|
|
36792
36782
|
return;
|
|
36793
36783
|
}
|
|
36794
|
-
|
|
36795
|
-
|
|
36796
|
-
remoteVideo.srcObject = stream;
|
|
36784
|
+
if (remoteVideoRef.current) {
|
|
36785
|
+
remoteVideoRef.current.srcObject = stream;
|
|
36797
36786
|
}
|
|
36798
36787
|
};
|
|
36799
36788
|
},
|
|
36800
|
-
[ref, socket2.connected, userId]
|
|
36789
|
+
[ref, socket2.connected, userId, remoteVideoRef]
|
|
36801
36790
|
);
|
|
36802
36791
|
const answerIncoming = useCallback(
|
|
36803
36792
|
async (isIncoming2 = false) => {
|
|
@@ -36893,17 +36882,7 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36893
36882
|
"call-token": onToken
|
|
36894
36883
|
};
|
|
36895
36884
|
}
|
|
36896
|
-
}, [
|
|
36897
|
-
userId,
|
|
36898
|
-
callUser,
|
|
36899
|
-
stateRef,
|
|
36900
|
-
answerIncoming,
|
|
36901
|
-
setBandwidth,
|
|
36902
|
-
initMedia,
|
|
36903
|
-
ref,
|
|
36904
|
-
initPeer,
|
|
36905
|
-
sendOffer
|
|
36906
|
-
]);
|
|
36885
|
+
}, [userId, stateRef, answerIncoming, setBandwidth, initMedia, ref, initPeer, sendOffer]);
|
|
36907
36886
|
useSocketListeners({ listeners: listeners2 });
|
|
36908
36887
|
useEffect(() => {
|
|
36909
36888
|
return () => callCleanup();
|
|
@@ -36918,7 +36897,7 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36918
36897
|
);
|
|
36919
36898
|
useEffect(() => {
|
|
36920
36899
|
if (isIncoming) {
|
|
36921
|
-
ref.current.timeout = setTimeout(() => clearCalls(),
|
|
36900
|
+
ref.current.timeout = setTimeout(() => clearCalls(), 3e4);
|
|
36922
36901
|
return () => clearTimeout(ref.current.timeout);
|
|
36923
36902
|
} else {
|
|
36924
36903
|
clearTimeout(ref.current.timeout);
|
|
@@ -36926,7 +36905,7 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36926
36905
|
}, [isIncoming, ref]);
|
|
36927
36906
|
useEffect(() => {
|
|
36928
36907
|
if (isOutgoing) {
|
|
36929
|
-
ref.current.timeout = setTimeout(() => clearCalls(),
|
|
36908
|
+
ref.current.timeout = setTimeout(() => clearCalls(), 3e4);
|
|
36930
36909
|
return () => clearTimeout(ref.current.timeout);
|
|
36931
36910
|
} else {
|
|
36932
36911
|
clearTimeout(ref.current.timeout);
|
|
@@ -36959,12 +36938,11 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36959
36938
|
}, [socket2.connected, conversation_id, userId, ref]);
|
|
36960
36939
|
const mute = useCallback(() => {
|
|
36961
36940
|
ref.current.localStream.getAudioTracks().forEach((track) => track.enabled = muted);
|
|
36962
|
-
|
|
36963
|
-
|
|
36964
|
-
localVideo.muted = !muted;
|
|
36941
|
+
if (localVideoRef.current) {
|
|
36942
|
+
localVideoRef.current.muted = !muted;
|
|
36965
36943
|
setState({ muted: !muted });
|
|
36966
36944
|
}
|
|
36967
|
-
}, [muted, ref]);
|
|
36945
|
+
}, [muted, ref, localVideoRef]);
|
|
36968
36946
|
async function startScreenSharing() {
|
|
36969
36947
|
try {
|
|
36970
36948
|
ref.current.screenStream = await navigator.mediaDevices.getDisplayMedia({
|
|
@@ -36985,29 +36963,27 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
36985
36963
|
return ((_a = s2.track) == null ? void 0 : _a.kind) === screenVideoTrack.kind;
|
|
36986
36964
|
});
|
|
36987
36965
|
if (sender) {
|
|
36988
|
-
sender.replaceTrack(screenVideoTrack);
|
|
36989
36966
|
ref.current.localVideoTrack = localStream.getVideoTracks()[0];
|
|
36990
|
-
|
|
36991
|
-
|
|
36992
|
-
|
|
36993
|
-
stopScreenSharing();
|
|
36994
|
-
});
|
|
36967
|
+
ref.current.localVideoTrack.enabled = false;
|
|
36968
|
+
addStreamToVideo(screenStream);
|
|
36969
|
+
sender.replaceTrack(screenVideoTrack);
|
|
36995
36970
|
} else {
|
|
36996
36971
|
console.error("Track sender not found");
|
|
36997
36972
|
}
|
|
36973
|
+
screenStream.getVideoTracks()[0].addEventListener("ended", () => stopScreenSharing());
|
|
36998
36974
|
}
|
|
36999
36975
|
}
|
|
37000
36976
|
function stopScreenSharing() {
|
|
37001
|
-
const { peerConnection, localStream, localVideoTrack, data: data2 } = ref.current;
|
|
37002
|
-
|
|
37003
|
-
localStream.removeTrack(localStream.getVideoTracks()[0]);
|
|
37004
|
-
ref.current.screenStream = null;
|
|
36977
|
+
const { peerConnection, localStream, localVideoTrack, data: data2, screenStream } = ref.current;
|
|
36978
|
+
screenStream.getVideoTracks().forEach((track) => track.stop());
|
|
37005
36979
|
if (localVideoTrack) {
|
|
37006
36980
|
localStream.addTrack(localVideoTrack);
|
|
37007
36981
|
const sender = peerConnection.getSenders().find((s2) => {
|
|
37008
36982
|
var _a;
|
|
37009
36983
|
return ((_a = s2.track) == null ? void 0 : _a.kind) === localVideoTrack.kind;
|
|
37010
36984
|
});
|
|
36985
|
+
ref.current.localVideoTrack.enabled = true;
|
|
36986
|
+
addStreamToVideo(localStream);
|
|
37011
36987
|
sender.replaceTrack(localVideoTrack);
|
|
37012
36988
|
} else {
|
|
37013
36989
|
socket2.emit("expectScreenShare", {
|
|
@@ -37016,18 +36992,18 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
37016
36992
|
from: data2.to
|
|
37017
36993
|
});
|
|
37018
36994
|
}
|
|
36995
|
+
ref.current.screenStream = null;
|
|
37019
36996
|
setState({ screenShared: false });
|
|
37020
36997
|
}
|
|
37021
36998
|
const fullScreen = useCallback(async () => {
|
|
37022
36999
|
try {
|
|
37023
|
-
|
|
37024
|
-
|
|
37025
|
-
await remoteVideo.requestFullscreen();
|
|
37000
|
+
if (remoteVideoRef.current) {
|
|
37001
|
+
await remoteVideoRef.current.requestFullscreen();
|
|
37026
37002
|
}
|
|
37027
37003
|
} catch (err) {
|
|
37028
37004
|
console.log("An error occurred, please try again later.");
|
|
37029
37005
|
}
|
|
37030
|
-
}, []);
|
|
37006
|
+
}, [remoteVideoRef]);
|
|
37031
37007
|
const toggleVideo = useCallback(() => {
|
|
37032
37008
|
ref.current.localStream.getVideoTracks().forEach((track) => track.enabled = videoOff);
|
|
37033
37009
|
setState({ videoOff: !videoOff });
|
|
@@ -37068,7 +37044,9 @@ function useVideoCalling({ userId, conversation_id }) {
|
|
|
37068
37044
|
isCalling,
|
|
37069
37045
|
getCalled,
|
|
37070
37046
|
videoOff,
|
|
37071
|
-
toggleVideo
|
|
37047
|
+
toggleVideo,
|
|
37048
|
+
localVideoRef,
|
|
37049
|
+
remoteVideoRef
|
|
37072
37050
|
};
|
|
37073
37051
|
}
|
|
37074
37052
|
const user = (id2, params) => api(`agents/${id2}`, params);
|
|
@@ -37146,7 +37124,9 @@ function VideoChat({
|
|
|
37146
37124
|
stopScreenSharing,
|
|
37147
37125
|
screenShared,
|
|
37148
37126
|
videoOff,
|
|
37149
|
-
toggleVideo
|
|
37127
|
+
toggleVideo,
|
|
37128
|
+
remoteVideoRef,
|
|
37129
|
+
localVideoRef
|
|
37150
37130
|
}) {
|
|
37151
37131
|
return /* @__PURE__ */ jsxs("div", {
|
|
37152
37132
|
id: "video-call-container",
|
|
@@ -37157,6 +37137,7 @@ function VideoChat({
|
|
|
37157
37137
|
},
|
|
37158
37138
|
className: "chat-interaction",
|
|
37159
37139
|
children: [/* @__PURE__ */ jsx("video", {
|
|
37140
|
+
ref: remoteVideoRef,
|
|
37160
37141
|
style: {
|
|
37161
37142
|
objectFit: "cover"
|
|
37162
37143
|
},
|
|
@@ -37164,6 +37145,7 @@ function VideoChat({
|
|
|
37164
37145
|
id: "remote-video",
|
|
37165
37146
|
autoPlay: true
|
|
37166
37147
|
}), /* @__PURE__ */ jsx("video", {
|
|
37148
|
+
ref: localVideoRef,
|
|
37167
37149
|
style: {
|
|
37168
37150
|
objectFit: "cover"
|
|
37169
37151
|
},
|
|
@@ -37344,7 +37326,9 @@ function VideoCall({
|
|
|
37344
37326
|
isCalling,
|
|
37345
37327
|
getCalled,
|
|
37346
37328
|
videoOff,
|
|
37347
|
-
toggleVideo
|
|
37329
|
+
toggleVideo,
|
|
37330
|
+
remoteVideoRef,
|
|
37331
|
+
localVideoRef
|
|
37348
37332
|
} = useVideoCalling({
|
|
37349
37333
|
userId,
|
|
37350
37334
|
conversation_id
|
|
@@ -37369,7 +37353,9 @@ function VideoCall({
|
|
|
37369
37353
|
stopScreenSharing,
|
|
37370
37354
|
screenShared,
|
|
37371
37355
|
videoOff,
|
|
37372
|
-
toggleVideo
|
|
37356
|
+
toggleVideo,
|
|
37357
|
+
remoteVideoRef,
|
|
37358
|
+
localVideoRef
|
|
37373
37359
|
}), /* @__PURE__ */ jsx(IncomingVideoCallModal, {
|
|
37374
37360
|
isIncoming,
|
|
37375
37361
|
answerCall,
|
|
@@ -37408,7 +37394,6 @@ function UnwrapWidget({
|
|
|
37408
37394
|
}
|
|
37409
37395
|
}, [companyUser]);
|
|
37410
37396
|
const [isWidgetLaunched, setIsWidgetLaunched] = useState(false);
|
|
37411
|
-
const dataRef = useRef();
|
|
37412
37397
|
const company_id = projectId || config.projectId;
|
|
37413
37398
|
const {
|
|
37414
37399
|
state: {
|
|
@@ -37438,7 +37423,6 @@ function UnwrapWidget({
|
|
|
37438
37423
|
companyIsClosed,
|
|
37439
37424
|
company_id,
|
|
37440
37425
|
company,
|
|
37441
|
-
dataRef,
|
|
37442
37426
|
companyUser,
|
|
37443
37427
|
setIsWidgetLaunched,
|
|
37444
37428
|
isWidgetLaunched
|
|
@@ -37485,7 +37469,6 @@ const WidgetFormDisplay = memo(({
|
|
|
37485
37469
|
companyIsClosed,
|
|
37486
37470
|
company_id,
|
|
37487
37471
|
company,
|
|
37488
|
-
dataRef,
|
|
37489
37472
|
companyUser,
|
|
37490
37473
|
setIsWidgetLaunched,
|
|
37491
37474
|
isWidgetLaunched
|
|
@@ -37494,6 +37477,7 @@ const WidgetFormDisplay = memo(({
|
|
|
37494
37477
|
const {
|
|
37495
37478
|
socket: socket2
|
|
37496
37479
|
} = useSocket();
|
|
37480
|
+
const dataRef = useRef();
|
|
37497
37481
|
const [{
|
|
37498
37482
|
chatInit,
|
|
37499
37483
|
chatClose,
|
|
@@ -37516,7 +37500,7 @@ const WidgetFormDisplay = memo(({
|
|
|
37516
37500
|
}), [companyIsClosed]);
|
|
37517
37501
|
const {
|
|
37518
37502
|
state: {
|
|
37519
|
-
data:
|
|
37503
|
+
data: data2,
|
|
37520
37504
|
isLoading: isLoadingCustomer
|
|
37521
37505
|
}
|
|
37522
37506
|
} = useRequest({
|
|
@@ -37525,6 +37509,7 @@ const WidgetFormDisplay = memo(({
|
|
|
37525
37509
|
params: [companyUser == null ? void 0 : companyUser.email],
|
|
37526
37510
|
loadOnMount: !!(companyUser == null ? void 0 : companyUser.email)
|
|
37527
37511
|
}, [companyUser == null ? void 0 : companyUser.email]);
|
|
37512
|
+
const customer = (data2 == null ? void 0 : data2.id) ? data2 : (_a = dataRef.current) == null ? void 0 : _a.customer;
|
|
37528
37513
|
useEffect(() => {
|
|
37529
37514
|
var _a2;
|
|
37530
37515
|
if (chatInit && (customer == null ? void 0 : customer.id) && socket2.connected) {
|
|
@@ -37532,7 +37517,7 @@ const WidgetFormDisplay = memo(({
|
|
|
37532
37517
|
user: ((_a2 = customer == null ? void 0 : customer.user) == null ? void 0 : _a2.id) || (customer == null ? void 0 : customer.user)
|
|
37533
37518
|
});
|
|
37534
37519
|
}
|
|
37535
|
-
}, [socket2.connected, chatInit, customer == null ? void 0 : customer.id
|
|
37520
|
+
}, [socket2.connected, chatInit, customer == null ? void 0 : customer.id]);
|
|
37536
37521
|
const quickStopChat = useCallback(() => {
|
|
37537
37522
|
dataRef.current = null;
|
|
37538
37523
|
setState({
|
|
@@ -37792,7 +37777,7 @@ function WidgetInitOnlineHeader({
|
|
|
37792
37777
|
}
|
|
37793
37778
|
var createRoot;
|
|
37794
37779
|
var m = ReactDOM;
|
|
37795
|
-
if (
|
|
37780
|
+
if (process.env.NODE_ENV === "production") {
|
|
37796
37781
|
createRoot = m.createRoot;
|
|
37797
37782
|
m.hydrateRoot;
|
|
37798
37783
|
} else {
|
|
@@ -37807,11 +37792,7 @@ if (production === "production") {
|
|
|
37807
37792
|
};
|
|
37808
37793
|
}
|
|
37809
37794
|
function docReady(fn) {
|
|
37810
|
-
|
|
37811
|
-
setTimeout(fn, 1);
|
|
37812
|
-
} else {
|
|
37813
|
-
document.addEventListener("DOMContentLoaded", fn);
|
|
37814
|
-
}
|
|
37795
|
+
["complete", "interactive"].includes(document.readyState) ? setTimeout(fn, 1) : document.addEventListener("DOMContentLoaded", fn);
|
|
37815
37796
|
}
|
|
37816
37797
|
const mountWidget = (config) => docReady(() => {
|
|
37817
37798
|
setSawportConfig(config);
|