@eshal-bot/chat-widget 0.2.27 → 0.2.28

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{e as default}from"./chat-widget-index-DjOa8SJO.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
1
+ export{e as default}from"./chat-widget-index-BPiJscyi.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
@@ -15644,6 +15644,53 @@
15644
15644
  return `${String(apiBaseUrl).replace(/\/$/, "")}${url.startsWith("/") ? "" : "/"}${url}`;
15645
15645
  }
15646
15646
 
15647
+ /**
15648
+ * The filename a download's `Content-Disposition` header names, or null.
15649
+ *
15650
+ * A copy of `filenameFromContentDisposition` in @eshal/shared, which the
15651
+ * widget (published standalone) cannot import. Both run the cases in
15652
+ * packages/shared/fixtures/content-disposition-cases.json.
15653
+ *
15654
+ * Replaces `/filename\*?=(?:UTF-8'')?["']?([^"'\s;]+)["']?/`, whose
15655
+ * `[^"'\s;]+` stopped at the first space: every SharePoint citation saved
15656
+ * under the first word of its name ("Tech Textile Park Guidelines.pdf" came
15657
+ * down as "Tech.pdf"; dev, 27 Oct 2026).
15658
+ *
15659
+ * `filename*` wins (RFC 6266), then a quoted `filename="..."` read whole,
15660
+ * then a bare token.
15661
+ */
15662
+
15663
+ function decodeExtValue(charset, encoded) {
15664
+ try {
15665
+ if (/^utf-8$/i.test(charset)) return decodeURIComponent(encoded);
15666
+ return encoded.replace(/%([0-9a-f]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
15667
+ } catch {
15668
+ return null;
15669
+ }
15670
+ }
15671
+ function maybePercentDecoded(value) {
15672
+ if (!/%[0-9a-f]{2}/i.test(value)) return value;
15673
+ try {
15674
+ return decodeURIComponent(value);
15675
+ } catch {
15676
+ return value;
15677
+ }
15678
+ }
15679
+ function filenameFromContentDisposition(header) {
15680
+ if (!header) return null;
15681
+ const star = /(?:^|;)\s*filename\*\s*=\s*([^;]+)/i.exec(header);
15682
+ if (star) {
15683
+ const ext = /^\s*"?([^']*)'[^']*'([^"]*)"?\s*$/.exec(star[1]);
15684
+ const decoded = ext ? decodeExtValue(ext[1], ext[2]) : null;
15685
+ if (decoded) return decoded;
15686
+ }
15687
+ const quoted = /(?:^|;)\s*filename\s*=\s*"((?:[^"\\]|\\.)*)"/i.exec(header);
15688
+ if (quoted) return maybePercentDecoded(quoted[1].replace(/\\(.)/g, "$1")) || null;
15689
+ const token = /(?:^|;)\s*filename\s*=\s*([^;]+)/i.exec(header);
15690
+ if (token) return maybePercentDecoded(token[1].trim()) || null;
15691
+ return null;
15692
+ }
15693
+
15647
15694
  // Runtime loader for the lazy markdown/chart chunk in the vanilla/IIFE
15648
15695
  // build (EV-2023). Rollup's IIFE output format has no module system of its
15649
15696
  // own, so it can't code-split a native `import()` the way the ESM build
@@ -16167,14 +16214,7 @@
16167
16214
  // Content-Disposition holds the UUID-prefixed storage key we
16168
16215
  // don't want to show. Skip CD parsing for those.
16169
16216
  if (!isAttachment) {
16170
- const match = disposition && /filename\*?=(?:UTF-8'')?["']?([^"'\s;]+)["']?/i.exec(disposition);
16171
- if (match) {
16172
- try {
16173
- filename = decodeURIComponent(match[1].replace(/\\"/g, '"'));
16174
- } catch {
16175
- /* keep fallback */
16176
- }
16177
- }
16217
+ filename = filenameFromContentDisposition(disposition) || filename;
16178
16218
  }
16179
16219
  const a = document.createElement("a");
16180
16220
  const objectUrl = URL.createObjectURL(blob);
@@ -21903,7 +21943,7 @@
21903
21943
  * value by its own test (that constant sat at 0.1.113 while this package was
21904
21944
  * at 0.2.2 precisely because nothing enforced it - EV-2431).
21905
21945
  */
21906
- const WIDGET_VERSION = '0.2.27';
21946
+ const WIDGET_VERSION = '0.2.28';
21907
21947
 
21908
21948
  /**
21909
21949
  * API utility functions