sceyt-chat-react-uikit 1.8.9-beta.10 → 1.8.9-beta.11

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 CHANGED
@@ -11456,13 +11456,41 @@ var requestToPromise = function requestToPromise(request) {
11456
11456
  };
11457
11457
  });
11458
11458
  };
11459
+ var _toStructuredCloneSafeValue = function toStructuredCloneSafeValue(value, seen) {
11460
+ if (seen === void 0) {
11461
+ seen = new WeakSet();
11462
+ }
11463
+ if (value === null || typeof value !== 'object') {
11464
+ return typeof value === 'function' || typeof value === 'symbol' ? undefined : value;
11465
+ }
11466
+ if (value instanceof Date) {
11467
+ return new Date(value.getTime());
11468
+ }
11469
+ if (seen.has(value)) {
11470
+ return undefined;
11471
+ }
11472
+ seen.add(value);
11473
+ if (Array.isArray(value)) {
11474
+ return value.map(function (item) {
11475
+ return _toStructuredCloneSafeValue(item, seen);
11476
+ });
11477
+ }
11478
+ return Object.keys(value).reduce(function (snapshot, key) {
11479
+ var safeValue = _toStructuredCloneSafeValue(value[key], seen);
11480
+ if (safeValue !== undefined) {
11481
+ snapshot[key] = safeValue;
11482
+ }
11483
+ return snapshot;
11484
+ }, {});
11485
+ };
11459
11486
  var sanitizeMessageForPersist = function sanitizeMessageForPersist(message) {
11460
- var _message$attachments;
11461
- if (!(message !== null && message !== void 0 && (_message$attachments = message.attachments) !== null && _message$attachments !== void 0 && _message$attachments.length)) {
11462
- return message;
11487
+ var _sanitizedMessage$att;
11488
+ var sanitizedMessage = _toStructuredCloneSafeValue(message);
11489
+ if (!(sanitizedMessage !== null && sanitizedMessage !== void 0 && (_sanitizedMessage$att = sanitizedMessage.attachments) !== null && _sanitizedMessage$att !== void 0 && _sanitizedMessage$att.length)) {
11490
+ return sanitizedMessage;
11463
11491
  }
11464
- return _extends({}, message, {
11465
- attachments: message.attachments.map(function (attachment) {
11492
+ return _extends({}, sanitizedMessage, {
11493
+ attachments: sanitizedMessage.attachments.map(function (attachment) {
11466
11494
  var rest = _extends({}, attachment || {});
11467
11495
  delete rest.data;
11468
11496
  if (rest.attachmentUrl && String(rest.attachmentUrl).startsWith('blob:')) {
package/index.modern.js CHANGED
@@ -11436,13 +11436,41 @@ var requestToPromise = function requestToPromise(request) {
11436
11436
  };
11437
11437
  });
11438
11438
  };
11439
+ var _toStructuredCloneSafeValue = function toStructuredCloneSafeValue(value, seen) {
11440
+ if (seen === void 0) {
11441
+ seen = new WeakSet();
11442
+ }
11443
+ if (value === null || typeof value !== 'object') {
11444
+ return typeof value === 'function' || typeof value === 'symbol' ? undefined : value;
11445
+ }
11446
+ if (value instanceof Date) {
11447
+ return new Date(value.getTime());
11448
+ }
11449
+ if (seen.has(value)) {
11450
+ return undefined;
11451
+ }
11452
+ seen.add(value);
11453
+ if (Array.isArray(value)) {
11454
+ return value.map(function (item) {
11455
+ return _toStructuredCloneSafeValue(item, seen);
11456
+ });
11457
+ }
11458
+ return Object.keys(value).reduce(function (snapshot, key) {
11459
+ var safeValue = _toStructuredCloneSafeValue(value[key], seen);
11460
+ if (safeValue !== undefined) {
11461
+ snapshot[key] = safeValue;
11462
+ }
11463
+ return snapshot;
11464
+ }, {});
11465
+ };
11439
11466
  var sanitizeMessageForPersist = function sanitizeMessageForPersist(message) {
11440
- var _message$attachments;
11441
- if (!(message !== null && message !== void 0 && (_message$attachments = message.attachments) !== null && _message$attachments !== void 0 && _message$attachments.length)) {
11442
- return message;
11467
+ var _sanitizedMessage$att;
11468
+ var sanitizedMessage = _toStructuredCloneSafeValue(message);
11469
+ if (!(sanitizedMessage !== null && sanitizedMessage !== void 0 && (_sanitizedMessage$att = sanitizedMessage.attachments) !== null && _sanitizedMessage$att !== void 0 && _sanitizedMessage$att.length)) {
11470
+ return sanitizedMessage;
11443
11471
  }
11444
- return _extends({}, message, {
11445
- attachments: message.attachments.map(function (attachment) {
11472
+ return _extends({}, sanitizedMessage, {
11473
+ attachments: sanitizedMessage.attachments.map(function (attachment) {
11446
11474
  var rest = _extends({}, attachment || {});
11447
11475
  delete rest.data;
11448
11476
  if (rest.attachmentUrl && String(rest.attachmentUrl).startsWith('blob:')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.8.9-beta.10",
3
+ "version": "1.8.9-beta.11",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",