@corva/chat-core 0.1.3 → 0.1.4

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 CHANGED
@@ -2554,7 +2554,10 @@ function wasRecentlyActive(userId, thresholdDays = DEFAULT_ACTIVITY_THRESHOLD_DA
2554
2554
  try {
2555
2555
  const timestamp = getChatStorage().getItem(getActivityKey(userId));
2556
2556
  if (!timestamp) return false;
2557
- return Date.now() - Number(timestamp) < thresholdDays * DAY_MS;
2557
+ const now = Date.now();
2558
+ const then = Number(timestamp);
2559
+ const dstShift = (new Date(now).getTimezoneOffset() - new Date(then).getTimezoneOffset()) * 6e4;
2560
+ return now - then - dstShift < thresholdDays * DAY_MS;
2558
2561
  } catch {
2559
2562
  return false;
2560
2563
  }
@@ -2740,7 +2743,7 @@ var removeMessageFromList = (messages, messageId) => {
2740
2743
  };
2741
2744
 
2742
2745
  // src/store/utils/messageHelpers.ts
2743
- var isUploadFile = (file) => !!file && typeof file.name === "string";
2746
+ var isUploadFile = (file) => !!file && typeof file.name === "string" && typeof file.size === "number" && typeof file.type === "string";
2744
2747
  async function uploadAndSend(api, data, nonce) {
2745
2748
  if (data.uploadedFileIds?.length) {
2746
2749
  const response2 = await api.sendMessage(