sceyt-chat-react-uikit 1.7.4 → 1.7.5-beta.1
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/index.js +92 -78
- package/index.modern.js +92 -78
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -32432,6 +32432,9 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32432
32432
|
var oGMetadata = useSelector(function (state) {
|
|
32433
32433
|
return state.MessageReducer.oGMetadata;
|
|
32434
32434
|
});
|
|
32435
|
+
var _useState = React.useState(false),
|
|
32436
|
+
metadataLoaded = _useState[0],
|
|
32437
|
+
setMetadataLoaded = _useState[1];
|
|
32435
32438
|
var _useColor = useColors(),
|
|
32436
32439
|
incomingMessageBackgroundX = _useColor[THEME_COLORS.INCOMING_MESSAGE_BACKGROUND_X],
|
|
32437
32440
|
outgoingMessageBackgroundX = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND_X],
|
|
@@ -32444,12 +32447,12 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32444
32447
|
var metadata = React.useMemo(function () {
|
|
32445
32448
|
return (oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) || null;
|
|
32446
32449
|
}, [oGMetadata, attachment]);
|
|
32447
|
-
var _useState = React.useState(false),
|
|
32448
|
-
imageLoadError = _useState[0],
|
|
32449
|
-
setImageLoadError = _useState[1];
|
|
32450
32450
|
var _useState2 = React.useState(false),
|
|
32451
|
-
|
|
32452
|
-
|
|
32451
|
+
imageLoadError = _useState2[0],
|
|
32452
|
+
setImageLoadError = _useState2[1];
|
|
32453
|
+
var _useState3 = React.useState(false),
|
|
32454
|
+
shouldAnimate = _useState3[0],
|
|
32455
|
+
setShouldAnimate = _useState3[1];
|
|
32453
32456
|
var handleMetadata = React.useCallback(function (metadata) {
|
|
32454
32457
|
if (metadata) {
|
|
32455
32458
|
dispatch(setOGMetadataAC(attachment === null || attachment === void 0 ? void 0 : attachment.url, metadata));
|
|
@@ -32462,83 +32465,89 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32462
32465
|
var client = getClient();
|
|
32463
32466
|
var _temp3 = function () {
|
|
32464
32467
|
if (client && client.connectionState === CONNECTION_STATUS.CONNECTED) {
|
|
32465
|
-
var _temp2 =
|
|
32466
|
-
|
|
32467
|
-
|
|
32468
|
-
return Promise.resolve(
|
|
32469
|
-
|
|
32470
|
-
|
|
32471
|
-
|
|
32472
|
-
|
|
32473
|
-
|
|
32474
|
-
image.
|
|
32475
|
-
|
|
32476
|
-
|
|
32477
|
-
|
|
32478
|
-
|
|
32479
|
-
|
|
32480
|
-
imageHeight: imageHeight
|
|
32481
|
-
}))).then(function () {
|
|
32482
|
-
handleMetadata(_extends({}, metadata, {
|
|
32468
|
+
var _temp2 = _finallyRethrows(function () {
|
|
32469
|
+
return _catch(function () {
|
|
32470
|
+
var queryBuilder = new client.MessageLinkOGQueryBuilder(url);
|
|
32471
|
+
return Promise.resolve(queryBuilder.build()).then(function (query) {
|
|
32472
|
+
return Promise.resolve(query.loadOGData()).then(function (metadata) {
|
|
32473
|
+
var _metadata$og, _metadata$og$image, _metadata$og$image$;
|
|
32474
|
+
var image = new Image();
|
|
32475
|
+
image.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$og = metadata.og) === null || _metadata$og === void 0 ? void 0 : (_metadata$og$image = _metadata$og.image) === null || _metadata$og$image === void 0 ? void 0 : (_metadata$og$image$ = _metadata$og$image[0]) === null || _metadata$og$image$ === void 0 ? void 0 : _metadata$og$image$.url;
|
|
32476
|
+
var _temp = function () {
|
|
32477
|
+
if (image.src) {
|
|
32478
|
+
image.onload = function () {
|
|
32479
|
+
try {
|
|
32480
|
+
var imageWidth = image.width;
|
|
32481
|
+
var imageHeight = image.height;
|
|
32482
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata, {
|
|
32483
32483
|
imageWidth: imageWidth,
|
|
32484
32484
|
imageHeight: imageHeight
|
|
32485
|
-
}))
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
|
|
32494
|
-
|
|
32495
|
-
|
|
32496
|
-
|
|
32497
|
-
|
|
32498
|
-
|
|
32499
|
-
|
|
32500
|
-
|
|
32501
|
-
|
|
32502
|
-
|
|
32503
|
-
|
|
32485
|
+
}))).then(function () {
|
|
32486
|
+
handleMetadata(_extends({}, metadata, {
|
|
32487
|
+
imageWidth: imageWidth,
|
|
32488
|
+
imageHeight: imageHeight
|
|
32489
|
+
}));
|
|
32490
|
+
});
|
|
32491
|
+
} catch (e) {
|
|
32492
|
+
return Promise.reject(e);
|
|
32493
|
+
}
|
|
32494
|
+
};
|
|
32495
|
+
image.onerror = function () {
|
|
32496
|
+
try {
|
|
32497
|
+
var _metadata$og2, _metadata$og2$favicon;
|
|
32498
|
+
setImageLoadError(true);
|
|
32499
|
+
var favicon = new Image();
|
|
32500
|
+
favicon.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$og2 = metadata.og) === null || _metadata$og2 === void 0 ? void 0 : (_metadata$og2$favicon = _metadata$og2.favicon) === null || _metadata$og2$favicon === void 0 ? void 0 : _metadata$og2$favicon.url;
|
|
32501
|
+
if (favicon.src) {
|
|
32502
|
+
favicon.onload = function () {
|
|
32503
|
+
try {
|
|
32504
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata, {
|
|
32504
32505
|
faviconLoaded: true
|
|
32505
|
-
}))
|
|
32506
|
-
|
|
32507
|
-
|
|
32508
|
-
|
|
32509
|
-
|
|
32510
|
-
|
|
32511
|
-
|
|
32512
|
-
|
|
32513
|
-
|
|
32514
|
-
|
|
32515
|
-
|
|
32516
|
-
|
|
32506
|
+
}))).then(function () {
|
|
32507
|
+
handleMetadata(_extends({}, metadata, {
|
|
32508
|
+
faviconLoaded: true
|
|
32509
|
+
}));
|
|
32510
|
+
});
|
|
32511
|
+
} catch (e) {
|
|
32512
|
+
return Promise.reject(e);
|
|
32513
|
+
}
|
|
32514
|
+
};
|
|
32515
|
+
favicon.onerror = function () {
|
|
32516
|
+
try {
|
|
32517
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata, {
|
|
32517
32518
|
faviconLoaded: false
|
|
32518
|
-
}))
|
|
32519
|
-
|
|
32520
|
-
|
|
32521
|
-
|
|
32522
|
-
|
|
32523
|
-
|
|
32519
|
+
}))).then(function () {
|
|
32520
|
+
handleMetadata(_extends({}, metadata, {
|
|
32521
|
+
faviconLoaded: false
|
|
32522
|
+
}));
|
|
32523
|
+
});
|
|
32524
|
+
} catch (e) {
|
|
32525
|
+
return Promise.reject(e);
|
|
32526
|
+
}
|
|
32527
|
+
};
|
|
32528
|
+
}
|
|
32529
|
+
return Promise.resolve();
|
|
32530
|
+
} catch (e) {
|
|
32531
|
+
return Promise.reject(e);
|
|
32524
32532
|
}
|
|
32525
|
-
|
|
32526
|
-
|
|
32527
|
-
|
|
32528
|
-
|
|
32529
|
-
|
|
32530
|
-
|
|
32531
|
-
|
|
32532
|
-
|
|
32533
|
-
|
|
32534
|
-
}
|
|
32535
|
-
}();
|
|
32536
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
|
32533
|
+
};
|
|
32534
|
+
} else {
|
|
32535
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata))).then(function () {
|
|
32536
|
+
handleMetadata(_extends({}, metadata));
|
|
32537
|
+
});
|
|
32538
|
+
}
|
|
32539
|
+
}();
|
|
32540
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
32541
|
+
});
|
|
32537
32542
|
});
|
|
32543
|
+
}, function () {
|
|
32544
|
+
console.log('Failed to fetch OG metadata', url);
|
|
32545
|
+
handleMetadata(null);
|
|
32538
32546
|
});
|
|
32539
|
-
}, function () {
|
|
32540
|
-
|
|
32541
|
-
|
|
32547
|
+
}, function (_wasThrown, _result) {
|
|
32548
|
+
setMetadataLoaded(true);
|
|
32549
|
+
if (_wasThrown) throw _result;
|
|
32550
|
+
return _result;
|
|
32542
32551
|
});
|
|
32543
32552
|
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
32544
32553
|
}
|
|
@@ -32567,6 +32576,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32567
32576
|
}
|
|
32568
32577
|
})["catch"](function () {
|
|
32569
32578
|
ogMetadataQueryBuilder(url);
|
|
32579
|
+
setMetadataLoaded(true);
|
|
32570
32580
|
});
|
|
32571
32581
|
}
|
|
32572
32582
|
}
|
|
@@ -32606,10 +32616,14 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32606
32616
|
};
|
|
32607
32617
|
}, [order]);
|
|
32608
32618
|
React.useEffect(function () {
|
|
32609
|
-
if (
|
|
32610
|
-
metadataGetSuccessCallback
|
|
32619
|
+
if (metadataLoaded || oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) {
|
|
32620
|
+
if (metadata && metadataGetSuccessCallback && hasImage) {
|
|
32621
|
+
metadataGetSuccessCallback(true);
|
|
32622
|
+
} else {
|
|
32623
|
+
metadataGetSuccessCallback === null || metadataGetSuccessCallback === void 0 ? void 0 : metadataGetSuccessCallback(false);
|
|
32624
|
+
}
|
|
32611
32625
|
}
|
|
32612
|
-
}, [metadata, metadataGetSuccessCallback]);
|
|
32626
|
+
}, [metadata, metadataGetSuccessCallback, metadataLoaded, oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url, hasImage]);
|
|
32613
32627
|
var elements = React.useMemo(function () {
|
|
32614
32628
|
var _resolvedOrder$image, _metadata$og1, _metadata$og1$image, _metadata$og1$image$, _resolvedOrder$title, _metadata$og10, _metadata$og11, _resolvedOrder$descri, _metadata$og12, _metadata$og13, _resolvedOrder$link;
|
|
32615
32629
|
return [hasImage ? {
|
package/index.modern.js
CHANGED
|
@@ -32431,6 +32431,9 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32431
32431
|
var oGMetadata = useSelector(function (state) {
|
|
32432
32432
|
return state.MessageReducer.oGMetadata;
|
|
32433
32433
|
});
|
|
32434
|
+
var _useState = useState(false),
|
|
32435
|
+
metadataLoaded = _useState[0],
|
|
32436
|
+
setMetadataLoaded = _useState[1];
|
|
32434
32437
|
var _useColor = useColors(),
|
|
32435
32438
|
incomingMessageBackgroundX = _useColor[THEME_COLORS.INCOMING_MESSAGE_BACKGROUND_X],
|
|
32436
32439
|
outgoingMessageBackgroundX = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND_X],
|
|
@@ -32443,12 +32446,12 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32443
32446
|
var metadata = useMemo(function () {
|
|
32444
32447
|
return (oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) || null;
|
|
32445
32448
|
}, [oGMetadata, attachment]);
|
|
32446
|
-
var _useState = useState(false),
|
|
32447
|
-
imageLoadError = _useState[0],
|
|
32448
|
-
setImageLoadError = _useState[1];
|
|
32449
32449
|
var _useState2 = useState(false),
|
|
32450
|
-
|
|
32451
|
-
|
|
32450
|
+
imageLoadError = _useState2[0],
|
|
32451
|
+
setImageLoadError = _useState2[1];
|
|
32452
|
+
var _useState3 = useState(false),
|
|
32453
|
+
shouldAnimate = _useState3[0],
|
|
32454
|
+
setShouldAnimate = _useState3[1];
|
|
32452
32455
|
var handleMetadata = useCallback(function (metadata) {
|
|
32453
32456
|
if (metadata) {
|
|
32454
32457
|
dispatch(setOGMetadataAC(attachment === null || attachment === void 0 ? void 0 : attachment.url, metadata));
|
|
@@ -32461,83 +32464,89 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32461
32464
|
var client = getClient();
|
|
32462
32465
|
var _temp3 = function () {
|
|
32463
32466
|
if (client && client.connectionState === CONNECTION_STATUS.CONNECTED) {
|
|
32464
|
-
var _temp2 =
|
|
32465
|
-
|
|
32466
|
-
|
|
32467
|
-
return Promise.resolve(
|
|
32468
|
-
|
|
32469
|
-
|
|
32470
|
-
|
|
32471
|
-
|
|
32472
|
-
|
|
32473
|
-
image.
|
|
32474
|
-
|
|
32475
|
-
|
|
32476
|
-
|
|
32477
|
-
|
|
32478
|
-
|
|
32479
|
-
imageHeight: imageHeight
|
|
32480
|
-
}))).then(function () {
|
|
32481
|
-
handleMetadata(_extends({}, metadata, {
|
|
32467
|
+
var _temp2 = _finallyRethrows(function () {
|
|
32468
|
+
return _catch(function () {
|
|
32469
|
+
var queryBuilder = new client.MessageLinkOGQueryBuilder(url);
|
|
32470
|
+
return Promise.resolve(queryBuilder.build()).then(function (query) {
|
|
32471
|
+
return Promise.resolve(query.loadOGData()).then(function (metadata) {
|
|
32472
|
+
var _metadata$og, _metadata$og$image, _metadata$og$image$;
|
|
32473
|
+
var image = new Image();
|
|
32474
|
+
image.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$og = metadata.og) === null || _metadata$og === void 0 ? void 0 : (_metadata$og$image = _metadata$og.image) === null || _metadata$og$image === void 0 ? void 0 : (_metadata$og$image$ = _metadata$og$image[0]) === null || _metadata$og$image$ === void 0 ? void 0 : _metadata$og$image$.url;
|
|
32475
|
+
var _temp = function () {
|
|
32476
|
+
if (image.src) {
|
|
32477
|
+
image.onload = function () {
|
|
32478
|
+
try {
|
|
32479
|
+
var imageWidth = image.width;
|
|
32480
|
+
var imageHeight = image.height;
|
|
32481
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata, {
|
|
32482
32482
|
imageWidth: imageWidth,
|
|
32483
32483
|
imageHeight: imageHeight
|
|
32484
|
-
}))
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
|
|
32494
|
-
|
|
32495
|
-
|
|
32496
|
-
|
|
32497
|
-
|
|
32498
|
-
|
|
32499
|
-
|
|
32500
|
-
|
|
32501
|
-
|
|
32502
|
-
|
|
32484
|
+
}))).then(function () {
|
|
32485
|
+
handleMetadata(_extends({}, metadata, {
|
|
32486
|
+
imageWidth: imageWidth,
|
|
32487
|
+
imageHeight: imageHeight
|
|
32488
|
+
}));
|
|
32489
|
+
});
|
|
32490
|
+
} catch (e) {
|
|
32491
|
+
return Promise.reject(e);
|
|
32492
|
+
}
|
|
32493
|
+
};
|
|
32494
|
+
image.onerror = function () {
|
|
32495
|
+
try {
|
|
32496
|
+
var _metadata$og2, _metadata$og2$favicon;
|
|
32497
|
+
setImageLoadError(true);
|
|
32498
|
+
var favicon = new Image();
|
|
32499
|
+
favicon.src = metadata === null || metadata === void 0 ? void 0 : (_metadata$og2 = metadata.og) === null || _metadata$og2 === void 0 ? void 0 : (_metadata$og2$favicon = _metadata$og2.favicon) === null || _metadata$og2$favicon === void 0 ? void 0 : _metadata$og2$favicon.url;
|
|
32500
|
+
if (favicon.src) {
|
|
32501
|
+
favicon.onload = function () {
|
|
32502
|
+
try {
|
|
32503
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata, {
|
|
32503
32504
|
faviconLoaded: true
|
|
32504
|
-
}))
|
|
32505
|
-
|
|
32506
|
-
|
|
32507
|
-
|
|
32508
|
-
|
|
32509
|
-
|
|
32510
|
-
|
|
32511
|
-
|
|
32512
|
-
|
|
32513
|
-
|
|
32514
|
-
|
|
32515
|
-
|
|
32505
|
+
}))).then(function () {
|
|
32506
|
+
handleMetadata(_extends({}, metadata, {
|
|
32507
|
+
faviconLoaded: true
|
|
32508
|
+
}));
|
|
32509
|
+
});
|
|
32510
|
+
} catch (e) {
|
|
32511
|
+
return Promise.reject(e);
|
|
32512
|
+
}
|
|
32513
|
+
};
|
|
32514
|
+
favicon.onerror = function () {
|
|
32515
|
+
try {
|
|
32516
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata, {
|
|
32516
32517
|
faviconLoaded: false
|
|
32517
|
-
}))
|
|
32518
|
-
|
|
32519
|
-
|
|
32520
|
-
|
|
32521
|
-
|
|
32522
|
-
|
|
32518
|
+
}))).then(function () {
|
|
32519
|
+
handleMetadata(_extends({}, metadata, {
|
|
32520
|
+
faviconLoaded: false
|
|
32521
|
+
}));
|
|
32522
|
+
});
|
|
32523
|
+
} catch (e) {
|
|
32524
|
+
return Promise.reject(e);
|
|
32525
|
+
}
|
|
32526
|
+
};
|
|
32527
|
+
}
|
|
32528
|
+
return Promise.resolve();
|
|
32529
|
+
} catch (e) {
|
|
32530
|
+
return Promise.reject(e);
|
|
32523
32531
|
}
|
|
32524
|
-
|
|
32525
|
-
|
|
32526
|
-
|
|
32527
|
-
|
|
32528
|
-
|
|
32529
|
-
|
|
32530
|
-
|
|
32531
|
-
|
|
32532
|
-
|
|
32533
|
-
}
|
|
32534
|
-
}();
|
|
32535
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
|
32532
|
+
};
|
|
32533
|
+
} else {
|
|
32534
|
+
return Promise.resolve(storeMetadata(url, _extends({}, metadata))).then(function () {
|
|
32535
|
+
handleMetadata(_extends({}, metadata));
|
|
32536
|
+
});
|
|
32537
|
+
}
|
|
32538
|
+
}();
|
|
32539
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
32540
|
+
});
|
|
32536
32541
|
});
|
|
32542
|
+
}, function () {
|
|
32543
|
+
console.log('Failed to fetch OG metadata', url);
|
|
32544
|
+
handleMetadata(null);
|
|
32537
32545
|
});
|
|
32538
|
-
}, function () {
|
|
32539
|
-
|
|
32540
|
-
|
|
32546
|
+
}, function (_wasThrown, _result) {
|
|
32547
|
+
setMetadataLoaded(true);
|
|
32548
|
+
if (_wasThrown) throw _result;
|
|
32549
|
+
return _result;
|
|
32541
32550
|
});
|
|
32542
32551
|
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
32543
32552
|
}
|
|
@@ -32566,6 +32575,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32566
32575
|
}
|
|
32567
32576
|
})["catch"](function () {
|
|
32568
32577
|
ogMetadataQueryBuilder(url);
|
|
32578
|
+
setMetadataLoaded(true);
|
|
32569
32579
|
});
|
|
32570
32580
|
}
|
|
32571
32581
|
}
|
|
@@ -32605,10 +32615,14 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
32605
32615
|
};
|
|
32606
32616
|
}, [order]);
|
|
32607
32617
|
useEffect(function () {
|
|
32608
|
-
if (
|
|
32609
|
-
metadataGetSuccessCallback
|
|
32618
|
+
if (metadataLoaded || oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) {
|
|
32619
|
+
if (metadata && metadataGetSuccessCallback && hasImage) {
|
|
32620
|
+
metadataGetSuccessCallback(true);
|
|
32621
|
+
} else {
|
|
32622
|
+
metadataGetSuccessCallback === null || metadataGetSuccessCallback === void 0 ? void 0 : metadataGetSuccessCallback(false);
|
|
32623
|
+
}
|
|
32610
32624
|
}
|
|
32611
|
-
}, [metadata, metadataGetSuccessCallback]);
|
|
32625
|
+
}, [metadata, metadataGetSuccessCallback, metadataLoaded, oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url, hasImage]);
|
|
32612
32626
|
var elements = useMemo(function () {
|
|
32613
32627
|
var _resolvedOrder$image, _metadata$og1, _metadata$og1$image, _metadata$og1$image$, _resolvedOrder$title, _metadata$og10, _metadata$og11, _resolvedOrder$descri, _metadata$og12, _metadata$og13, _resolvedOrder$link;
|
|
32614
32628
|
return [hasImage ? {
|