@eshal-bot/chat-widget 0.2.34 → 0.2.35

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.
@@ -1 +1 @@
1
- export{S as default}from"./chat-widget-index-DsG4QrRk.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
1
+ export{S as default}from"./chat-widget-index-Dy4YmSJD.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
@@ -12098,25 +12098,37 @@
12098
12098
  attachmentLimitReached: "That file is too large. This chat can receive up to {max_mb} MB of files in total.",
12099
12099
  attachmentLimitReachedUsed: "That file is too large. This chat can receive up to {max_mb} MB of files in total, and {used_mb} MB is already used.",
12100
12100
  attachmentFileTooLarge: "Sorry, that file is too large. Files must be under {max_mb} MB.",
12101
- attachmentTypeNotAllowed: "Sorry, we can't accept that type of file. You can send {types}."
12101
+ attachmentTypeNotAllowed: "Sorry, we can't accept that type of file. You can send {types}.",
12102
+ attachmentLimitReachedSize: "That file is {file_mb} MB, which is too large. This chat can receive up to {max_mb} MB of files in total.",
12103
+ attachmentLimitReachedUsedSize: "That file is {file_mb} MB, which is too large. This chat can receive up to {max_mb} MB of files in total, and {used_mb} MB is already used.",
12104
+ attachmentFileTooLargeSize: "Sorry, that file is {file_mb} MB, which is too large. Files must be under {max_mb} MB."
12102
12105
  },
12103
12106
  ar: {
12104
12107
  attachmentLimitReached: "حجم الملف كبير جداً. يمكن لهذه المحادثة استقبال ملفات يصل مجموع حجمها إلى {max_mb} ميغابايت.",
12105
12108
  attachmentLimitReachedUsed: "حجم الملف كبير جداً. يمكن لهذه المحادثة استقبال ملفات يصل مجموع حجمها إلى {max_mb} ميغابايت، وقد تم استخدام {used_mb} ميغابايت.",
12106
12109
  attachmentFileTooLarge: "عذراً، حجم الملف كبير جداً. يجب أن يكون حجم الملف أقل من {max_mb} ميغابايت.",
12107
- attachmentTypeNotAllowed: "عذراً، لا يمكننا استقبال هذا النوع من الملفات. يمكنك إرسال: {types}."
12110
+ attachmentTypeNotAllowed: "عذراً، لا يمكننا استقبال هذا النوع من الملفات. يمكنك إرسال: {types}.",
12111
+ attachmentLimitReachedSize: "حجم الملف {file_mb} ميغابايت، وهو كبير جداً. يمكن لهذه المحادثة استقبال ملفات يصل مجموع حجمها إلى {max_mb} ميغابايت.",
12112
+ attachmentLimitReachedUsedSize: "حجم الملف {file_mb} ميغابايت، وهو كبير جداً. يمكن لهذه المحادثة استقبال ملفات يصل مجموع حجمها إلى {max_mb} ميغابايت، وقد تم استخدام {used_mb} ميغابايت.",
12113
+ attachmentFileTooLargeSize: "عذراً، حجم الملف {file_mb} ميغابايت، وهو كبير جداً. يجب أن يكون حجم الملف أقل من {max_mb} ميغابايت."
12108
12114
  },
12109
12115
  zh: {
12110
12116
  attachmentLimitReached: "文件过大。此聊天最多可接收共 {max_mb} MB 的文件。",
12111
12117
  attachmentLimitReachedUsed: "文件过大。此聊天最多可接收共 {max_mb} MB 的文件,目前已使用 {used_mb} MB。",
12112
12118
  attachmentFileTooLarge: "抱歉,文件过大。文件大小必须小于 {max_mb} MB。",
12113
- attachmentTypeNotAllowed: "抱歉,无法接收此类文件。您可以发送:{types}。"
12119
+ attachmentTypeNotAllowed: "抱歉,无法接收此类文件。您可以发送:{types}。",
12120
+ attachmentLimitReachedSize: "该文件为 {file_mb} MB,过大。此聊天最多可接收共 {max_mb} MB 的文件。",
12121
+ attachmentLimitReachedUsedSize: "该文件为 {file_mb} MB,过大。此聊天最多可接收共 {max_mb} MB 的文件,目前已使用 {used_mb} MB。",
12122
+ attachmentFileTooLargeSize: "抱歉,该文件为 {file_mb} MB,过大。文件大小必须小于 {max_mb} MB。"
12114
12123
  },
12115
12124
  ja: {
12116
12125
  attachmentLimitReached: "ファイルが大きすぎます。このチャットで受け取れるファイルは合計 {max_mb} MB までです。",
12117
12126
  attachmentLimitReachedUsed: "ファイルが大きすぎます。このチャットで受け取れるファイルは合計 {max_mb} MB までで、すでに {used_mb} MB を使用しています。",
12118
12127
  attachmentFileTooLarge: "申し訳ありませんが、ファイルが大きすぎます。ファイルは {max_mb} MB 未満にしてください。",
12119
- attachmentTypeNotAllowed: "申し訳ありませんが、この種類のファイルは受け付けていません。送信できるファイル: {types}"
12128
+ attachmentTypeNotAllowed: "申し訳ありませんが、この種類のファイルは受け付けていません。送信できるファイル: {types}",
12129
+ attachmentLimitReachedSize: "このファイルは {file_mb} MB で、大きすぎます。このチャットで受け取れるファイルは合計 {max_mb} MB までです。",
12130
+ attachmentLimitReachedUsedSize: "このファイルは {file_mb} MB で、大きすぎます。このチャットで受け取れるファイルは合計 {max_mb} MB までで、すでに {used_mb} MB を使用しています。",
12131
+ attachmentFileTooLargeSize: "申し訳ありませんが、このファイルは {file_mb} MB で、大きすぎます。ファイルは {max_mb} MB 未満にしてください。"
12120
12132
  }
12121
12133
  };
12122
12134
  function translate(locale, key) {
@@ -18955,6 +18967,13 @@
18955
18967
  const v = Math.max(0, Number(bytes) || 0) / (1024 * 1024);
18956
18968
  return v >= 10 ? String(Math.round(v)) : String(Math.round(v * 10) / 10);
18957
18969
  };
18970
+ // EV-4701: the refused file's own size, so the customer sees why it did not
18971
+ // fit. One decimal below 100 MB, so a 10.4 MB file never reads as "10 MB"
18972
+ // against a 10 MB limit.
18973
+ const fileMb = bytes => {
18974
+ const v = Math.max(0, Number(bytes) || 0) / (1024 * 1024);
18975
+ return v >= 100 ? String(Math.round(v)) : String(Math.round(v * 10) / 10);
18976
+ };
18958
18977
 
18959
18978
  /**
18960
18979
  * The agent's reply to a rejected file, in the widget's language.
@@ -18969,16 +18988,23 @@
18969
18988
  types: types || "PDF"
18970
18989
  });
18971
18990
  }
18991
+ // With the file's size known the message names it; without it, as before.
18992
+ const size = Number(rejection.size) || 0;
18993
+ const sized = key => size > 0 ? `${key}Size` : key;
18994
+ const file_mb = fileMb(size);
18972
18995
  if (rejection.code === "file_too_large") {
18973
- return fill(t("attachmentFileTooLarge"), {
18996
+ return fill(t(sized("attachmentFileTooLarge")), {
18997
+ file_mb,
18974
18998
  max_mb: String(config.fileUploadMaxFileMB ?? maxMb)
18975
18999
  });
18976
19000
  }
18977
19001
  const used = Number(rejection.usedBytes) || 0;
18978
- return used > 0 ? fill(t("attachmentLimitReachedUsed"), {
19002
+ return used > 0 ? fill(t(sized("attachmentLimitReachedUsed")), {
19003
+ file_mb,
18979
19004
  max_mb: maxMb,
18980
19005
  used_mb: mb(used)
18981
- }) : fill(t("attachmentLimitReached"), {
19006
+ }) : fill(t(sized("attachmentLimitReached")), {
19007
+ file_mb,
18982
19008
  max_mb: maxMb
18983
19009
  });
18984
19010
  }
@@ -23063,7 +23089,7 @@
23063
23089
  * value by its own test (that constant sat at 0.1.113 while this package was
23064
23090
  * at 0.2.2 precisely because nothing enforced it - EV-2431).
23065
23091
  */
23066
- const WIDGET_VERSION = '0.2.34';
23092
+ const WIDGET_VERSION = '0.2.35';
23067
23093
 
23068
23094
  /**
23069
23095
  * API utility functions