@takeshape/purchase-order-chat 1.60.0 → 1.60.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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as e } from "react/jsx-runtime";
3
- import { r as o } from "./purchase-order-chat-wrapper-CGoWg1CH.js";
3
+ import { r as o } from "./purchase-order-chat-wrapper-Ctm9BV2k.js";
4
4
  import { PurchaseOrderChat as c } from "./shadow.js";
5
5
  function n(r) {
6
6
  return /* @__PURE__ */ e(
@@ -22,7 +22,7 @@ function Vi(t, e) {
22
22
  return i != null ? String(i) : "";
23
23
  });
24
24
  }
25
- const Yr = "__vite_c_css_pos_initial_648f0c526ee84f978742d80f0489cbe8", vt = "__vite_c_css_pos_update_648f0c526ee84f978742d80f0489cbe8", Ct = () => typeof window < "u" ? window[Yr] : void 0, zi = (t) => {
25
+ const Yr = "__vite_c_css_pos_initial_36c304cac03b430c81e7aad4f679f68b", vt = "__vite_c_css_pos_update_36c304cac03b430c81e7aad4f679f68b", Ct = () => typeof window < "u" ? window[Yr] : void 0, zi = (t) => {
26
26
  const [e, r] = D(() => Ct() || /* @__PURE__ */ new Map()), [n, i] = D(0);
27
27
  return F(() => {
28
28
  const s = (o) => {
@@ -7220,7 +7220,7 @@ function ei() {
7220
7220
  (g) => g.setParserThreadId
7221
7221
  ), { thread: i, createThread: s } = Mr({
7222
7222
  agentName: "documentParser",
7223
- createOnMount: !0,
7223
+ createOnMount: !1,
7224
7224
  persist: !1,
7225
7225
  // Document parser is ephemeral, don't overwrite main chat thread
7226
7226
  onThreadCreated: n
@@ -7300,15 +7300,10 @@ function ei() {
7300
7300
  u === "ready" && l.current && o !== null && (l.current.setStatus({ code: 1, message: "ok" }), l.current.end(), l.current = null);
7301
7301
  }, [u, o]);
7302
7302
  const w = B(() => {
7303
- l.current?.setStatus({ code: 2, message: "cancelled" }), l.current?.end(), l.current = null, v(null), m([]), y.getState().setParsedContent(null), s();
7304
- }, [v, m, s]), E = B(() => {
7305
- l.current?.setStatus({ code: 2, message: "cancelled" }), l.current?.end(), l.current = null, m([]), y.getState().clearParser(), b(!1), v(null), s();
7306
- }, [
7307
- m,
7308
- b,
7309
- v,
7310
- s
7311
- ]);
7303
+ l.current?.setStatus({ code: 2, message: "cancelled" }), l.current?.end(), l.current = null, v(null), m([]), y.getState().setParsedContent(null);
7304
+ }, [v, m]), E = B(() => {
7305
+ l.current?.setStatus({ code: 2, message: "cancelled" }), l.current?.end(), l.current = null, m([]), y.getState().clearParser(), b(!1), v(null);
7306
+ }, [m, b, v]);
7312
7307
  return {
7313
7308
  parsedContent: o,
7314
7309
  isUploadingFile: S,
@@ -7588,17 +7583,17 @@ async function oi(t, e) {
7588
7583
  const { setToolCallError: r } = y.getState(), n = t.input;
7589
7584
  let i = "Item removed from cart successfully.";
7590
7585
  try {
7591
- const s = e.bcCart?.lineItems.physicalItems.find(
7586
+ const s = e.bcCart?.lineItems.physicalItems.filter(
7592
7587
  (o) => o.productEntityId === n.productEntityId && o.variantEntityId === n.variantEntityId
7593
- );
7594
- if (s)
7595
- await e.removeLineItem(s.entityId);
7596
- else
7588
+ ) ?? [];
7589
+ if (s.length === 0)
7597
7590
  return {
7598
7591
  tool: yr,
7599
7592
  toolCallId: t.toolCallId,
7600
7593
  output: "Cart item not found."
7601
7594
  };
7595
+ for (const o of s)
7596
+ await e.removeLineItem(o.entityId);
7602
7597
  } catch (s) {
7603
7598
  const o = s instanceof Error ? s.message : "Unknown error";
7604
7599
  i = `Failed to remove item from cart: ${o}`, r(t.toolCallId, o);
@@ -8255,4 +8250,4 @@ export {
8255
8250
  Vi as r,
8256
8251
  Gi as s
8257
8252
  };
8258
- //# sourceMappingURL=purchase-order-chat-wrapper-CGoWg1CH.js.map
8253
+ //# sourceMappingURL=purchase-order-chat-wrapper-Ctm9BV2k.js.map