@takeshape/purchase-order-chat 1.60.3 → 1.61.0
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 +1 -1
- package/dist/{purchase-order-chat-wrapper-CtCPGHtH.js → purchase-order-chat-wrapper-fadhXbv8.js} +235 -235
- package/dist/purchase-order-chat-wrapper-fadhXbv8.js.map +1 -0
- package/dist/shadow.js +2 -2
- package/dist/tailwind.js +1 -1
- package/package.json +1 -1
- package/dist/purchase-order-chat-wrapper-CtCPGHtH.js.map +0 -1
package/dist/{purchase-order-chat-wrapper-CtCPGHtH.js → purchase-order-chat-wrapper-fadhXbv8.js}
RENAMED
|
@@ -16,13 +16,13 @@ import Jr from "p-map";
|
|
|
16
16
|
function ke(...t) {
|
|
17
17
|
return Gr(Hr(t));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function zi(t, e) {
|
|
20
20
|
return t.replace(/:(\w+)/g, (r, n) => {
|
|
21
21
|
const i = e[n];
|
|
22
22
|
return i != null ? String(i) : "";
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
const Yr = "
|
|
25
|
+
const Yr = "__vite_c_css_pos_initial_02ff19dc5b2e4ea6b665b8372abc1362", vt = "__vite_c_css_pos_update_02ff19dc5b2e4ea6b665b8372abc1362", Ct = () => typeof window < "u" ? window[Yr] : void 0, Qi = (t) => {
|
|
26
26
|
const [e, r] = R(() => Ct() || /* @__PURE__ */ new Map()), [n, i] = R(0);
|
|
27
27
|
return F(() => {
|
|
28
28
|
const s = (o) => {
|
|
@@ -1532,7 +1532,7 @@ class Pn {
|
|
|
1532
1532
|
return n;
|
|
1533
1533
|
}
|
|
1534
1534
|
}
|
|
1535
|
-
function
|
|
1535
|
+
function Hi(t) {
|
|
1536
1536
|
return `https://store-${t}.mybigcommerce.com/graphql`;
|
|
1537
1537
|
}
|
|
1538
1538
|
function Tn(t) {
|
|
@@ -3515,18 +3515,18 @@ function vs({
|
|
|
3515
3515
|
}
|
|
3516
3516
|
) });
|
|
3517
3517
|
}
|
|
3518
|
-
const mr = "showProducts", Cs = "searchProducts", Is = "searchProductsBySku", Fe = "addToCart", gr = "updateCart", yr = "removeFromCart", xr = "clearCart", br = "getCart", ut = "getPurchaseOrderData", Ye = "setPoMetadata", vr = "setItemWarnings", Cr = "removeItemWarnings", pt = "addProcessingFailures",
|
|
3519
|
-
function Ss(t) {
|
|
3520
|
-
return t.type === "tool" && !ws.has(t.toolName);
|
|
3521
|
-
}
|
|
3518
|
+
const mr = "showProducts", Cs = "searchProducts", Is = "searchProductsFromChat", ws = "searchProductsBySku", Fe = "addToCart", gr = "updateCart", yr = "removeFromCart", xr = "clearCart", br = "getCart", ut = "getPurchaseOrderData", Ye = "setPoMetadata", vr = "setItemWarnings", Cr = "removeItemWarnings", pt = "addProcessingFailures", Ss = /* @__PURE__ */ new Set([mr]);
|
|
3522
3519
|
function Ns(t) {
|
|
3520
|
+
return t.type === "tool" && !Ss.has(t.toolName);
|
|
3521
|
+
}
|
|
3522
|
+
function Es(t) {
|
|
3523
3523
|
const e = [];
|
|
3524
3524
|
let r = [];
|
|
3525
3525
|
function n() {
|
|
3526
3526
|
r.length >= 2 ? e.push({ type: "tool-group", tools: r }) : r.length === 1 && e.push(r[0]), r = [];
|
|
3527
3527
|
}
|
|
3528
3528
|
for (const i of t)
|
|
3529
|
-
|
|
3529
|
+
Ns(i) ? r.push(i) : (n(), e.push(i));
|
|
3530
3530
|
return n(), e;
|
|
3531
3531
|
}
|
|
3532
3532
|
const $t = () => /* @__PURE__ */ p(
|
|
@@ -3586,7 +3586,7 @@ function ht(t) {
|
|
|
3586
3586
|
return;
|
|
3587
3587
|
}
|
|
3588
3588
|
}
|
|
3589
|
-
function
|
|
3589
|
+
function ks({
|
|
3590
3590
|
toolCallId: t,
|
|
3591
3591
|
toolInput: e,
|
|
3592
3592
|
toolOutput: r,
|
|
@@ -3612,7 +3612,7 @@ function Es({
|
|
|
3612
3612
|
}
|
|
3613
3613
|
);
|
|
3614
3614
|
}
|
|
3615
|
-
function
|
|
3615
|
+
function Ps({
|
|
3616
3616
|
toolCallId: t,
|
|
3617
3617
|
toolInput: e,
|
|
3618
3618
|
toolOutput: r,
|
|
@@ -3628,12 +3628,12 @@ function ks({
|
|
|
3628
3628
|
successMessage: ""
|
|
3629
3629
|
}
|
|
3630
3630
|
);
|
|
3631
|
-
const c = ht(r)?.data?.searchProducts?.total ?? 0;
|
|
3631
|
+
const c = ht(r)?.data, l = c?.searchProducts?.total ?? c?.searchProductsFromChat?.total ?? 0;
|
|
3632
3632
|
return /* @__PURE__ */ a(
|
|
3633
3633
|
ne,
|
|
3634
3634
|
{
|
|
3635
3635
|
toolCallId: t,
|
|
3636
|
-
successMessage: `Found ${
|
|
3636
|
+
successMessage: `Found ${l} product${l !== 1 ? "s" : ""} for '${i}'`,
|
|
3637
3637
|
toolOutput: r
|
|
3638
3638
|
}
|
|
3639
3639
|
);
|
|
@@ -3641,7 +3641,7 @@ function ks({
|
|
|
3641
3641
|
const wr = Rr(
|
|
3642
3642
|
null
|
|
3643
3643
|
);
|
|
3644
|
-
function
|
|
3644
|
+
function Ts({
|
|
3645
3645
|
client: t,
|
|
3646
3646
|
children: e
|
|
3647
3647
|
}) {
|
|
@@ -3650,7 +3650,7 @@ function Ps({
|
|
|
3650
3650
|
function ft() {
|
|
3651
3651
|
return Dr(wr);
|
|
3652
3652
|
}
|
|
3653
|
-
function
|
|
3653
|
+
function As(t, e) {
|
|
3654
3654
|
return qr({
|
|
3655
3655
|
queryKey: [
|
|
3656
3656
|
"productVariants",
|
|
@@ -3694,7 +3694,7 @@ function Bt(t) {
|
|
|
3694
3694
|
}
|
|
3695
3695
|
return e;
|
|
3696
3696
|
}
|
|
3697
|
-
const
|
|
3697
|
+
const $s = () => /* @__PURE__ */ a("div", { className: "w-full h-full bg-surface-tertiary flex items-center justify-center text-text-quaternary", children: /* @__PURE__ */ p(
|
|
3698
3698
|
"svg",
|
|
3699
3699
|
{
|
|
3700
3700
|
width: "40",
|
|
@@ -3711,7 +3711,7 @@ const As = () => /* @__PURE__ */ a("div", { className: "w-full h-full bg-surface
|
|
|
3711
3711
|
]
|
|
3712
3712
|
}
|
|
3713
3713
|
) });
|
|
3714
|
-
function
|
|
3714
|
+
function Bs({
|
|
3715
3715
|
variantDetails: t,
|
|
3716
3716
|
selections: e,
|
|
3717
3717
|
onSelectionChange: r
|
|
@@ -3744,8 +3744,8 @@ function $s({
|
|
|
3744
3744
|
i && /* @__PURE__ */ a("p", { className: "text-xs text-error m-0", role: "alert", "aria-live": "polite", children: "This combination is not available" })
|
|
3745
3745
|
] });
|
|
3746
3746
|
}
|
|
3747
|
-
const
|
|
3748
|
-
function
|
|
3747
|
+
const Ms = 10;
|
|
3748
|
+
function Fs(t, e, r) {
|
|
3749
3749
|
return t ? "bg-surface-tertiary text-text cursor-not-allowed" : e ? "bg-success/20 text-success-text cursor-not-allowed" : r ? "bg-surface-disabled text-text-quaternary cursor-not-allowed" : "bg-surface-invert text-text-invert hover:bg-surface-invert-hover cursor-pointer";
|
|
3750
3750
|
}
|
|
3751
3751
|
function Mt({
|
|
@@ -3761,7 +3761,7 @@ function Mt({
|
|
|
3761
3761
|
}) {
|
|
3762
3762
|
const [d, h] = R(1), [u, m] = R(!1), [S, b] = R(!1), x = i === "horizontal", v = o && c ? mt(o.variants, c) : null, E = v?.entityId ?? t.variantEntityId, I = r.find(
|
|
3763
3763
|
(W) => W.productEntityId === t.productEntityId && W.variantEntityId === E
|
|
3764
|
-
), w = !!I, k = I?.quantity ?? 0, g = v?.sku ?? t.sku, A = v?.prices?.price?.value ?? t.price, $ = v?.inventory?.aggregated?.availableToSell ?? t.availableQuantity, O = $ !== void 0 && $ > 0 && $ <
|
|
3764
|
+
), w = !!I, k = I?.quantity ?? 0, g = v?.sku ?? t.sku, A = v?.prices?.price?.value ?? t.price, $ = v?.inventory?.aggregated?.availableToSell ?? t.availableQuantity, O = $ !== void 0 && $ > 0 && $ < Ms, Q = v?.inventory?.isInStock ?? t.isInStock, H = v !== null ? (
|
|
3765
3765
|
// Have variant details: check variant stock
|
|
3766
3766
|
!v.isPurchasable || Q === !1 || Q === void 0 && (v.inventory?.aggregated?.availableToSell ?? 0) === 0
|
|
3767
3767
|
) : (
|
|
@@ -3814,7 +3814,7 @@ function Mt({
|
|
|
3814
3814
|
alt: t.name,
|
|
3815
3815
|
className: "w-full h-full object-cover"
|
|
3816
3816
|
}
|
|
3817
|
-
) : /* @__PURE__ */ a(
|
|
3817
|
+
) : /* @__PURE__ */ a($s, {}),
|
|
3818
3818
|
!x && H && /* @__PURE__ */ a("div", { className: "absolute top-2 right-2 bg-error text-text-invert text-xs font-semibold px-2 py-0.5 rounded", children: "Out of stock" })
|
|
3819
3819
|
]
|
|
3820
3820
|
}
|
|
@@ -3852,7 +3852,7 @@ function Mt({
|
|
|
3852
3852
|
x && te
|
|
3853
3853
|
] }),
|
|
3854
3854
|
o && c && l && /* @__PURE__ */ a("div", { className: x ? "mt-2" : "shrink-0 px-3 pt-2", children: /* @__PURE__ */ a(
|
|
3855
|
-
|
|
3855
|
+
Bs,
|
|
3856
3856
|
{
|
|
3857
3857
|
variantDetails: o,
|
|
3858
3858
|
selections: c,
|
|
@@ -3891,7 +3891,7 @@ function Mt({
|
|
|
3891
3891
|
type: "button",
|
|
3892
3892
|
onClick: ae,
|
|
3893
3893
|
disabled: u || S || !!z || H,
|
|
3894
|
-
className: `py-1.5 px-3 text-xs font-medium rounded border-none ${x ? "" : "w-full"} ${
|
|
3894
|
+
className: `py-1.5 px-3 text-xs font-medium rounded border-none ${x ? "" : "w-full"} ${Fs(u, S, !!z || H)}`,
|
|
3895
3895
|
children: u ? "Adding..." : S ? "✓ Added" : "Add to cart"
|
|
3896
3896
|
}
|
|
3897
3897
|
)
|
|
@@ -3908,7 +3908,7 @@ function Mt({
|
|
|
3908
3908
|
}
|
|
3909
3909
|
);
|
|
3910
3910
|
}
|
|
3911
|
-
function
|
|
3911
|
+
function Os({
|
|
3912
3912
|
products: t,
|
|
3913
3913
|
onAddToCart: e,
|
|
3914
3914
|
onViewProduct: r,
|
|
@@ -3920,7 +3920,7 @@ function Fs({
|
|
|
3920
3920
|
const c = ft(), l = oe(
|
|
3921
3921
|
() => t.filter((v) => v.productEntityId !== void 0).map((v) => v.productEntityId),
|
|
3922
3922
|
[t]
|
|
3923
|
-
), { data: d } =
|
|
3923
|
+
), { data: d } = As(
|
|
3924
3924
|
c,
|
|
3925
3925
|
c ? l : []
|
|
3926
3926
|
), h = oe(() => {
|
|
@@ -4000,7 +4000,7 @@ function Fs({
|
|
|
4000
4000
|
);
|
|
4001
4001
|
}) });
|
|
4002
4002
|
}
|
|
4003
|
-
function
|
|
4003
|
+
function Rs({
|
|
4004
4004
|
toolInput: t,
|
|
4005
4005
|
toolState: e,
|
|
4006
4006
|
cart: r,
|
|
@@ -4055,7 +4055,7 @@ function Os({
|
|
|
4055
4055
|
}
|
|
4056
4056
|
S();
|
|
4057
4057
|
}, [s, t]), h ? /* @__PURE__ */ a("div", { className: "py-2 text-sm text-error-text", children: h }) : /* @__PURE__ */ a(
|
|
4058
|
-
|
|
4058
|
+
Os,
|
|
4059
4059
|
{
|
|
4060
4060
|
products: o,
|
|
4061
4061
|
onAddToCart: n,
|
|
@@ -4077,7 +4077,7 @@ function Nr({
|
|
|
4077
4077
|
onViewProduct: c
|
|
4078
4078
|
}) {
|
|
4079
4079
|
return e === mr ? /* @__PURE__ */ a("div", { className: "mt-3", children: /* @__PURE__ */ a(
|
|
4080
|
-
|
|
4080
|
+
Rs,
|
|
4081
4081
|
{
|
|
4082
4082
|
toolInput: r,
|
|
4083
4083
|
toolOutput: n,
|
|
@@ -4086,16 +4086,16 @@ function Nr({
|
|
|
4086
4086
|
onAddToCart: o,
|
|
4087
4087
|
onViewProduct: c
|
|
4088
4088
|
}
|
|
4089
|
-
) }) : e === Cs ? /* @__PURE__ */ a(
|
|
4090
|
-
|
|
4089
|
+
) }) : e === Cs || e === Is ? /* @__PURE__ */ a(
|
|
4090
|
+
Ps,
|
|
4091
4091
|
{
|
|
4092
4092
|
toolCallId: t,
|
|
4093
4093
|
toolInput: r,
|
|
4094
4094
|
toolOutput: n,
|
|
4095
4095
|
toolState: i ?? ""
|
|
4096
4096
|
}
|
|
4097
|
-
) : e ===
|
|
4098
|
-
|
|
4097
|
+
) : e === ws ? /* @__PURE__ */ a(
|
|
4098
|
+
ks,
|
|
4099
4099
|
{
|
|
4100
4100
|
toolCallId: t,
|
|
4101
4101
|
toolInput: r,
|
|
@@ -4180,7 +4180,7 @@ function Nr({
|
|
|
4180
4180
|
}
|
|
4181
4181
|
) : null;
|
|
4182
4182
|
}
|
|
4183
|
-
function
|
|
4183
|
+
function Ds({
|
|
4184
4184
|
tools: t,
|
|
4185
4185
|
messageId: e,
|
|
4186
4186
|
cart: r,
|
|
@@ -4238,10 +4238,10 @@ function Rs({
|
|
|
4238
4238
|
)
|
|
4239
4239
|
] });
|
|
4240
4240
|
}
|
|
4241
|
-
const
|
|
4241
|
+
const Ls = bt.object({
|
|
4242
4242
|
id: bt.string()
|
|
4243
4243
|
});
|
|
4244
|
-
async function
|
|
4244
|
+
async function _s(t, e) {
|
|
4245
4245
|
if (!t.body)
|
|
4246
4246
|
throw new Error("No response body");
|
|
4247
4247
|
const r = [], n = /* @__PURE__ */ new Set(), i = [];
|
|
@@ -4319,9 +4319,9 @@ async function Er(t, e) {
|
|
|
4319
4319
|
);
|
|
4320
4320
|
}
|
|
4321
4321
|
const o = await s.json();
|
|
4322
|
-
return
|
|
4322
|
+
return Ls.parse(o).id;
|
|
4323
4323
|
}
|
|
4324
|
-
async function
|
|
4324
|
+
async function Us(t, e, r, n) {
|
|
4325
4325
|
const { sseOrigin: i, projectId: s, apiKey: o } = t, c = await Ee(
|
|
4326
4326
|
`${i}/project/${s}/agents/messages`,
|
|
4327
4327
|
{
|
|
@@ -4358,7 +4358,7 @@ async function _s(t, e, r, n) {
|
|
|
4358
4358
|
}
|
|
4359
4359
|
return c;
|
|
4360
4360
|
}
|
|
4361
|
-
const
|
|
4361
|
+
const qs = `
|
|
4362
4362
|
mutation SendFeedback(
|
|
4363
4363
|
$messageId: String!
|
|
4364
4364
|
$name: String!
|
|
@@ -4375,7 +4375,7 @@ const Us = `
|
|
|
4375
4375
|
)
|
|
4376
4376
|
}
|
|
4377
4377
|
`;
|
|
4378
|
-
async function
|
|
4378
|
+
async function js(t, e) {
|
|
4379
4379
|
const { origin: r, projectId: n, apiKey: i } = t, s = await Ee(`${r}/project/${n}/graphql`, {
|
|
4380
4380
|
method: "POST",
|
|
4381
4381
|
headers: {
|
|
@@ -4383,7 +4383,7 @@ async function qs(t, e) {
|
|
|
4383
4383
|
Authorization: `Bearer ${i}`
|
|
4384
4384
|
},
|
|
4385
4385
|
body: JSON.stringify({
|
|
4386
|
-
query:
|
|
4386
|
+
query: qs,
|
|
4387
4387
|
variables: {
|
|
4388
4388
|
messageId: e.messageId,
|
|
4389
4389
|
name: e.name,
|
|
@@ -4406,7 +4406,7 @@ async function qs(t, e) {
|
|
|
4406
4406
|
);
|
|
4407
4407
|
return !0;
|
|
4408
4408
|
}
|
|
4409
|
-
const
|
|
4409
|
+
const Ws = {
|
|
4410
4410
|
end: () => {
|
|
4411
4411
|
},
|
|
4412
4412
|
setStatus: () => {
|
|
@@ -4415,13 +4415,13 @@ const js = {
|
|
|
4415
4415
|
}
|
|
4416
4416
|
};
|
|
4417
4417
|
let Ue = null;
|
|
4418
|
-
function
|
|
4418
|
+
function Gi(t) {
|
|
4419
4419
|
Ue = t;
|
|
4420
4420
|
}
|
|
4421
4421
|
function nt(t) {
|
|
4422
|
-
return Ue ? Ue.startInactiveSpan(t) :
|
|
4422
|
+
return Ue ? Ue.startInactiveSpan(t) : Ws;
|
|
4423
4423
|
}
|
|
4424
|
-
function
|
|
4424
|
+
function Vs(t, e) {
|
|
4425
4425
|
Ue && Ue.captureFeedback(
|
|
4426
4426
|
t,
|
|
4427
4427
|
e?.tags ? {
|
|
@@ -4456,7 +4456,7 @@ function Ft({
|
|
|
4456
4456
|
if (w.preventDefault(), !(!n.trim() || !c.trim())) {
|
|
4457
4457
|
h("submitting"), m("");
|
|
4458
4458
|
try {
|
|
4459
|
-
|
|
4459
|
+
Vs(
|
|
4460
4460
|
{
|
|
4461
4461
|
name: n.trim(),
|
|
4462
4462
|
email: s.trim() || void 0,
|
|
@@ -4473,7 +4473,7 @@ function Ft({
|
|
|
4473
4473
|
}
|
|
4474
4474
|
}
|
|
4475
4475
|
}
|
|
4476
|
-
), await
|
|
4476
|
+
), await js(b, {
|
|
4477
4477
|
messageId: t,
|
|
4478
4478
|
name: n.trim(),
|
|
4479
4479
|
email: s.trim(),
|
|
@@ -4639,7 +4639,7 @@ const Ot = ({ size: t = 12 }) => /* @__PURE__ */ p(
|
|
|
4639
4639
|
]
|
|
4640
4640
|
}
|
|
4641
4641
|
);
|
|
4642
|
-
function
|
|
4642
|
+
function zs({
|
|
4643
4643
|
messagePartId: t,
|
|
4644
4644
|
messageId: e,
|
|
4645
4645
|
isLatestAssistantMessage: r,
|
|
@@ -4734,7 +4734,7 @@ function Vs({
|
|
|
4734
4734
|
)
|
|
4735
4735
|
] });
|
|
4736
4736
|
}
|
|
4737
|
-
function
|
|
4737
|
+
function Qs(t) {
|
|
4738
4738
|
if (!t.parts)
|
|
4739
4739
|
return [];
|
|
4740
4740
|
const e = [];
|
|
@@ -4757,11 +4757,11 @@ function zs(t) {
|
|
|
4757
4757
|
}
|
|
4758
4758
|
return e;
|
|
4759
4759
|
}
|
|
4760
|
-
function
|
|
4760
|
+
function Hs(t) {
|
|
4761
4761
|
const e = t?.find((r) => r.type === "file");
|
|
4762
4762
|
return e && "filename" in e && typeof e.filename == "string" ? e.filename : "Attachment";
|
|
4763
4763
|
}
|
|
4764
|
-
function
|
|
4764
|
+
function Gs({
|
|
4765
4765
|
message: t,
|
|
4766
4766
|
isFirstUserMessage: e,
|
|
4767
4767
|
isLatestAssistantMessage: r,
|
|
@@ -4772,7 +4772,7 @@ function Hs({
|
|
|
4772
4772
|
onAddToCart: c,
|
|
4773
4773
|
onViewProduct: l
|
|
4774
4774
|
}) {
|
|
4775
|
-
const d = t.role === "assistant", h =
|
|
4775
|
+
const d = t.role === "assistant", h = Qs(t);
|
|
4776
4776
|
return h.length === 0 ? null : /* @__PURE__ */ a(
|
|
4777
4777
|
"div",
|
|
4778
4778
|
{
|
|
@@ -4816,8 +4816,8 @@ function Hs({
|
|
|
4816
4816
|
`text-${t.id}-${m}`
|
|
4817
4817
|
) : null) })
|
|
4818
4818
|
] }) : /* @__PURE__ */ p(ve, { children: [
|
|
4819
|
-
|
|
4820
|
-
|
|
4819
|
+
Es(h).map((u, m) => u.type === "tool-group" ? /* @__PURE__ */ a(
|
|
4820
|
+
Ds,
|
|
4821
4821
|
{
|
|
4822
4822
|
tools: u.tools,
|
|
4823
4823
|
messageId: `${t.id}-${m}`,
|
|
@@ -4827,7 +4827,7 @@ function Hs({
|
|
|
4827
4827
|
},
|
|
4828
4828
|
`group-${t.id}-${m}`
|
|
4829
4829
|
) : u.type === "text" ? d ? /* @__PURE__ */ a(
|
|
4830
|
-
|
|
4830
|
+
zs,
|
|
4831
4831
|
{
|
|
4832
4832
|
messagePartId: `${t.id}-${m}`,
|
|
4833
4833
|
messageId: t.id,
|
|
@@ -4864,7 +4864,7 @@ function Hs({
|
|
|
4864
4864
|
) }, u.toolCallId) : null),
|
|
4865
4865
|
!d && t.parts?.some((u) => u.type === "file") && /* @__PURE__ */ p("div", { className: "flex items-center gap-1.5 mt-2 text-xs text-text-tertiary", children: [
|
|
4866
4866
|
/* @__PURE__ */ a($t, {}),
|
|
4867
|
-
/* @__PURE__ */ a("span", { children:
|
|
4867
|
+
/* @__PURE__ */ a("span", { children: Hs(t.parts) })
|
|
4868
4868
|
] })
|
|
4869
4869
|
] }) })
|
|
4870
4870
|
}
|
|
@@ -4902,7 +4902,7 @@ const Pr = () => /* @__PURE__ */ p(
|
|
|
4902
4902
|
/* @__PURE__ */ a("polyline", { points: "9 15 12 12 15 15" })
|
|
4903
4903
|
]
|
|
4904
4904
|
}
|
|
4905
|
-
),
|
|
4905
|
+
), Ks = () => /* @__PURE__ */ p(
|
|
4906
4906
|
"svg",
|
|
4907
4907
|
{
|
|
4908
4908
|
width: "16",
|
|
@@ -4928,13 +4928,13 @@ function Tr({ onClick: t }) {
|
|
|
4928
4928
|
className: "flex items-center gap-2 min-h-11 py-2.5 px-5 bg-surface border border-border-strong rounded-full text-sm font-medium text-text cursor-pointer transition-colors hover:bg-surface-secondary focus-visible:outline-2 focus-visible:outline-border-focus focus-visible:outline-offset-2",
|
|
4929
4929
|
onClick: t,
|
|
4930
4930
|
children: [
|
|
4931
|
-
/* @__PURE__ */ a(
|
|
4931
|
+
/* @__PURE__ */ a(Ks, {}),
|
|
4932
4932
|
"Take a photo"
|
|
4933
4933
|
]
|
|
4934
4934
|
}
|
|
4935
4935
|
);
|
|
4936
4936
|
}
|
|
4937
|
-
function
|
|
4937
|
+
function Js({
|
|
4938
4938
|
isDragging: t = !1,
|
|
4939
4939
|
fileInputRef: e,
|
|
4940
4940
|
cameraInputRef: r,
|
|
@@ -5000,7 +5000,7 @@ function Ks({
|
|
|
5000
5000
|
n && /* @__PURE__ */ a("div", { className: "flex items-center gap-2 py-3 px-4 bg-error-bg border border-error/30 rounded-lg text-error-text text-sm max-w-[400px] text-center", children: n })
|
|
5001
5001
|
] }) });
|
|
5002
5002
|
}
|
|
5003
|
-
function
|
|
5003
|
+
function Ys() {
|
|
5004
5004
|
return /* @__PURE__ */ a("div", { className: "flex justify-start px-5 py-2", children: /* @__PURE__ */ p("div", { className: "flex flex-col gap-2 w-3/4", children: [
|
|
5005
5005
|
/* @__PURE__ */ a("div", { className: "h-3 rounded-full animate-shimmer" }),
|
|
5006
5006
|
/* @__PURE__ */ a(
|
|
@@ -5012,7 +5012,7 @@ function Js() {
|
|
|
5012
5012
|
)
|
|
5013
5013
|
] }) });
|
|
5014
5014
|
}
|
|
5015
|
-
const
|
|
5015
|
+
const Xs = Lr(
|
|
5016
5016
|
function({
|
|
5017
5017
|
messages: e,
|
|
5018
5018
|
input: r,
|
|
@@ -5069,7 +5069,7 @@ const Ys = Lr(
|
|
|
5069
5069
|
className: "flex-1 min-h-0 overflow-y-auto py-3 flex flex-col",
|
|
5070
5070
|
children: [
|
|
5071
5071
|
e.length === 0 && !s && b && /* @__PURE__ */ a(
|
|
5072
|
-
|
|
5072
|
+
Js,
|
|
5073
5073
|
{
|
|
5074
5074
|
isDragging: b.isDragging,
|
|
5075
5075
|
fileInputRef: b.fileInputRef,
|
|
@@ -5083,7 +5083,7 @@ const Ys = Lr(
|
|
|
5083
5083
|
e.map((g, A) => {
|
|
5084
5084
|
const $ = m && g.role !== "assistant" && A === 0, O = g.role === "assistant" && g.id === k;
|
|
5085
5085
|
return /* @__PURE__ */ a(
|
|
5086
|
-
|
|
5086
|
+
Gs,
|
|
5087
5087
|
{
|
|
5088
5088
|
message: g,
|
|
5089
5089
|
isFirstUserMessage: $,
|
|
@@ -5098,7 +5098,7 @@ const Ys = Lr(
|
|
|
5098
5098
|
g.id
|
|
5099
5099
|
);
|
|
5100
5100
|
}),
|
|
5101
|
-
s && /* @__PURE__ */ a(
|
|
5101
|
+
s && /* @__PURE__ */ a(Ys, {}),
|
|
5102
5102
|
/* @__PURE__ */ a(xs, { error: h, onRetry: u })
|
|
5103
5103
|
]
|
|
5104
5104
|
}
|
|
@@ -5114,18 +5114,18 @@ const Ys = Lr(
|
|
|
5114
5114
|
)
|
|
5115
5115
|
] });
|
|
5116
5116
|
}
|
|
5117
|
-
),
|
|
5117
|
+
), Zs = "purchase-order-chat-user-settings", ea = 25, Rt = it()(
|
|
5118
5118
|
Ht(
|
|
5119
5119
|
(t) => ({
|
|
5120
|
-
panelWidth:
|
|
5120
|
+
panelWidth: ea,
|
|
5121
5121
|
setPanelWidth: (e) => t({ panelWidth: e })
|
|
5122
5122
|
}),
|
|
5123
5123
|
{
|
|
5124
|
-
name:
|
|
5124
|
+
name: Zs
|
|
5125
5125
|
}
|
|
5126
5126
|
)
|
|
5127
5127
|
);
|
|
5128
|
-
function
|
|
5128
|
+
function ta() {
|
|
5129
5129
|
const t = Rt((m) => m.panelWidth), e = Rt((m) => m.setPanelWidth), [r, n] = R(
|
|
5130
5130
|
typeof window < "u" && window.innerWidth >= 1024
|
|
5131
5131
|
), i = D(null), s = D(!1), o = D(t);
|
|
@@ -5179,7 +5179,7 @@ function ea() {
|
|
|
5179
5179
|
handleBlur: u
|
|
5180
5180
|
};
|
|
5181
5181
|
}
|
|
5182
|
-
function
|
|
5182
|
+
function ra({ activeTab: t, onTabChange: e, hasUnread: r }) {
|
|
5183
5183
|
const n = r && t !== "chat";
|
|
5184
5184
|
return /* @__PURE__ */ p("div", { className: "flex border-b border-border-strong shrink-0", role: "tablist", children: [
|
|
5185
5185
|
/* @__PURE__ */ a(
|
|
@@ -5263,7 +5263,7 @@ function Dt({
|
|
|
5263
5263
|
onMinimize: _,
|
|
5264
5264
|
className: j = ""
|
|
5265
5265
|
}) {
|
|
5266
|
-
const K =
|
|
5266
|
+
const K = ta(), [J, Pe] = R(
|
|
5267
5267
|
u.length > 0 ? "cart" : "chat"
|
|
5268
5268
|
), [fe, me] = R(!1), de = D(t.length), ge = D(J);
|
|
5269
5269
|
ge.current = J;
|
|
@@ -5279,7 +5279,7 @@ function Dt({
|
|
|
5279
5279
|
const T = B((U) => {
|
|
5280
5280
|
Pe(U), U === "chat" && me(!1);
|
|
5281
5281
|
}, []), P = /* @__PURE__ */ a(
|
|
5282
|
-
|
|
5282
|
+
Xs,
|
|
5283
5283
|
{
|
|
5284
5284
|
ref: d,
|
|
5285
5285
|
messages: t,
|
|
@@ -5384,7 +5384,7 @@ function Dt({
|
|
|
5384
5384
|
...L,
|
|
5385
5385
|
children: [
|
|
5386
5386
|
/* @__PURE__ */ a(
|
|
5387
|
-
|
|
5387
|
+
ra,
|
|
5388
5388
|
{
|
|
5389
5389
|
activeTab: J,
|
|
5390
5390
|
onTabChange: T,
|
|
@@ -5406,7 +5406,7 @@ function Dt({
|
|
|
5406
5406
|
)
|
|
5407
5407
|
);
|
|
5408
5408
|
}
|
|
5409
|
-
function
|
|
5409
|
+
function na() {
|
|
5410
5410
|
const t = ft(), e = y((c) => c.ui.existingCart), r = y(
|
|
5411
5411
|
(c) => c.confirmClearExistingCart
|
|
5412
5412
|
), [n, i] = R(!1), s = oe(
|
|
@@ -5442,7 +5442,7 @@ function ra() {
|
|
|
5442
5442
|
)
|
|
5443
5443
|
] }) });
|
|
5444
5444
|
}
|
|
5445
|
-
function
|
|
5445
|
+
function sa({ message: t }) {
|
|
5446
5446
|
return /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-full w-full bg-surface-secondary", children: /* @__PURE__ */ p("div", { className: "text-center max-w-md px-4", children: [
|
|
5447
5447
|
/* @__PURE__ */ a("p", { className: "text-lg text-text-secondary mb-2", children: "Something went wrong" }),
|
|
5448
5448
|
/* @__PURE__ */ a("p", { className: "text-sm text-text-tertiary mb-6", children: t || "An unexpected error occurred. Please refresh the page to try again." }),
|
|
@@ -5467,19 +5467,19 @@ function Ar() {
|
|
|
5467
5467
|
);
|
|
5468
5468
|
return oe(() => t !== "processing" ? null : e ? r === "idle" || r === "processing" ? "matching" : "building" : "reading", [t, e, r]);
|
|
5469
5469
|
}
|
|
5470
|
-
const
|
|
5470
|
+
const aa = [
|
|
5471
5471
|
{ label: "Upload", number: 1 },
|
|
5472
5472
|
{ label: "Match", number: 2 },
|
|
5473
5473
|
{ label: "Checkout", number: 3 }
|
|
5474
5474
|
];
|
|
5475
|
-
function
|
|
5476
|
-
return /* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-0 p-4 md:py-1 md:px-0", children:
|
|
5475
|
+
function ia(t = {}) {
|
|
5476
|
+
return /* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-0 p-4 md:py-1 md:px-0", children: aa.map((e, r) => /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
|
|
5477
5477
|
r > 0 && /* @__PURE__ */ a("div", { className: "w-6 md:w-10 h-px mx-2 md:mx-3 rounded-[1px] bg-border" }),
|
|
5478
5478
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-center w-5 h-5 rounded-full shrink-0 bg-transparent border-[1.5px] border-border-strong text-text-quaternary", children: /* @__PURE__ */ a("span", { className: "text-xs font-medium", children: e.number }) }),
|
|
5479
5479
|
/* @__PURE__ */ a("span", { className: "text-s font-normal whitespace-nowrap text-text-quaternary", children: e.label })
|
|
5480
5480
|
] }, e.label)) });
|
|
5481
5481
|
}
|
|
5482
|
-
function
|
|
5482
|
+
function oa({
|
|
5483
5483
|
isDragging: t,
|
|
5484
5484
|
fileInputRef: e,
|
|
5485
5485
|
cameraInputRef: r,
|
|
@@ -5539,7 +5539,7 @@ function ia({
|
|
|
5539
5539
|
}
|
|
5540
5540
|
);
|
|
5541
5541
|
}
|
|
5542
|
-
function
|
|
5542
|
+
function ca({
|
|
5543
5543
|
isDragging: t,
|
|
5544
5544
|
fileInputRef: e,
|
|
5545
5545
|
acceptedExtensions: r,
|
|
@@ -5559,9 +5559,9 @@ function oa({
|
|
|
5559
5559
|
t && "ring-2 ring-border-focus border-border-focus bg-surface-tertiary shadow-upload-active"
|
|
5560
5560
|
),
|
|
5561
5561
|
children: [
|
|
5562
|
-
/* @__PURE__ */ a("div", { className: "upload-zone-steps mb-3 py-4 px-8 border-b border-solid border-border-strong", children: /* @__PURE__ */ a(
|
|
5562
|
+
/* @__PURE__ */ a("div", { className: "upload-zone-steps mb-3 py-4 px-8 border-b border-solid border-border-strong", children: /* @__PURE__ */ a(ia, {}) }),
|
|
5563
5563
|
/* @__PURE__ */ a(
|
|
5564
|
-
|
|
5564
|
+
oa,
|
|
5565
5565
|
{
|
|
5566
5566
|
isDragging: t,
|
|
5567
5567
|
fileInputRef: e,
|
|
@@ -5587,7 +5587,7 @@ function oa({
|
|
|
5587
5587
|
}
|
|
5588
5588
|
);
|
|
5589
5589
|
}
|
|
5590
|
-
function
|
|
5590
|
+
function la({
|
|
5591
5591
|
items: t,
|
|
5592
5592
|
orderId: e,
|
|
5593
5593
|
parsedContent: r,
|
|
@@ -5679,11 +5679,11 @@ function ca({
|
|
|
5679
5679
|
] })
|
|
5680
5680
|
] });
|
|
5681
5681
|
}
|
|
5682
|
-
const
|
|
5683
|
-
function
|
|
5684
|
-
return t <= 0 ? Lt : Math.max(Lt, Math.round(
|
|
5682
|
+
const da = 3e3, Lt = 200;
|
|
5683
|
+
function ua(t) {
|
|
5684
|
+
return t <= 0 ? Lt : Math.max(Lt, Math.round(da / t));
|
|
5685
5685
|
}
|
|
5686
|
-
function
|
|
5686
|
+
function pa() {
|
|
5687
5687
|
const t = y(
|
|
5688
5688
|
(o) => o.batchProcessing.toolCalls
|
|
5689
5689
|
), r = y(
|
|
@@ -5695,7 +5695,7 @@ function ua() {
|
|
|
5695
5695
|
}, 0), [i, s] = R(0);
|
|
5696
5696
|
return F(() => {
|
|
5697
5697
|
if (!r || n === 0 || i >= n) return;
|
|
5698
|
-
const o =
|
|
5698
|
+
const o = ua(n), c = setTimeout(() => {
|
|
5699
5699
|
s((l) => Math.min(l + 1, n));
|
|
5700
5700
|
}, o);
|
|
5701
5701
|
return () => clearTimeout(c);
|
|
@@ -5705,8 +5705,8 @@ function ua() {
|
|
|
5705
5705
|
isRevealing: n > 0 && i < n
|
|
5706
5706
|
};
|
|
5707
5707
|
}
|
|
5708
|
-
const
|
|
5709
|
-
function
|
|
5708
|
+
const ha = 1e3;
|
|
5709
|
+
function fa() {
|
|
5710
5710
|
const t = y(
|
|
5711
5711
|
(s) => s.batchProcessing.toolCalls
|
|
5712
5712
|
), e = y(
|
|
@@ -5717,7 +5717,7 @@ function ha() {
|
|
|
5717
5717
|
F(() => {
|
|
5718
5718
|
if (e >= t.length)
|
|
5719
5719
|
return;
|
|
5720
|
-
const s = setTimeout(r,
|
|
5720
|
+
const s = setTimeout(r, ha);
|
|
5721
5721
|
return () => clearTimeout(s);
|
|
5722
5722
|
}, [t.length, e, r]);
|
|
5723
5723
|
const n = t.slice(0, e);
|
|
@@ -5728,22 +5728,22 @@ function ha() {
|
|
|
5728
5728
|
};
|
|
5729
5729
|
}
|
|
5730
5730
|
const _t = ["reading", "matching", "building"];
|
|
5731
|
-
function
|
|
5731
|
+
function ma(t, e) {
|
|
5732
5732
|
if (!e) return "pending";
|
|
5733
5733
|
const r = _t.indexOf(e), n = _t.indexOf(t);
|
|
5734
5734
|
return n < r ? "complete" : n === r ? "active" : "pending";
|
|
5735
5735
|
}
|
|
5736
|
-
function
|
|
5736
|
+
function ga(t, e) {
|
|
5737
5737
|
return t.length >= 2 && e !== "submitted" && e !== "streaming";
|
|
5738
5738
|
}
|
|
5739
|
-
function
|
|
5739
|
+
function ya(t) {
|
|
5740
5740
|
if (t === void 0) return null;
|
|
5741
5741
|
const e = ht(t);
|
|
5742
5742
|
if (e === void 0) return null;
|
|
5743
5743
|
const r = Ze(e, "data.searchProductsBySku") ?? Ze(e, "data.searchProducts");
|
|
5744
5744
|
return Ze(r, "total", 0);
|
|
5745
5745
|
}
|
|
5746
|
-
const
|
|
5746
|
+
const xa = {
|
|
5747
5747
|
searchProductsBySku: (t, { resultCount: e }) => {
|
|
5748
5748
|
const r = t.sku ?? "";
|
|
5749
5749
|
return e === null ? `Looking up SKU ${r}` : /* @__PURE__ */ p(ve, { children: [
|
|
@@ -5772,14 +5772,14 @@ const ya = {
|
|
|
5772
5772
|
] });
|
|
5773
5773
|
}
|
|
5774
5774
|
};
|
|
5775
|
-
function
|
|
5776
|
-
const r =
|
|
5775
|
+
function ba(t, e) {
|
|
5776
|
+
const r = xa[t.toolName];
|
|
5777
5777
|
return r ? r(t.input, {
|
|
5778
5778
|
visibleToolCalls: e,
|
|
5779
|
-
resultCount:
|
|
5779
|
+
resultCount: ya(t.output)
|
|
5780
5780
|
}) : null;
|
|
5781
5781
|
}
|
|
5782
|
-
const
|
|
5782
|
+
const va = [
|
|
5783
5783
|
{ id: "reading", label: "Reading document..." },
|
|
5784
5784
|
{ id: "matching", label: "Matching products..." },
|
|
5785
5785
|
{ id: "building", label: "Building cart..." }
|
|
@@ -5797,14 +5797,14 @@ const ba = [
|
|
|
5797
5797
|
icon: "bg-surface border-2 border-success text-success"
|
|
5798
5798
|
}
|
|
5799
5799
|
};
|
|
5800
|
-
function
|
|
5800
|
+
function Ca({
|
|
5801
5801
|
currentStep: t
|
|
5802
5802
|
}) {
|
|
5803
|
-
const { currentToolCall: e, visibleToolCalls: r } =
|
|
5803
|
+
const { currentToolCall: e, visibleToolCalls: r } = fa(), { revealedCount: n, totalItems: i } = pa(), s = y(
|
|
5804
5804
|
(o) => o.parser.uploadedFileName
|
|
5805
5805
|
);
|
|
5806
|
-
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-6 w-64", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-6", children:
|
|
5807
|
-
const c =
|
|
5806
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-6 w-64", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-6", children: va.map((o) => {
|
|
5807
|
+
const c = ma(o.id, t), l = o.id === "reading" && (c === "active" || c === "complete") && s ? s : null, d = o.id === "matching" && c === "active" && e ? ba(e, r) : null, h = o.id === "building" && c === "active" && i > 0 ? n >= i ? `Added ${i} item${i !== 1 ? "s" : ""}` : `Adding item ${n + 1} of ${i}...` : null;
|
|
5808
5808
|
return /* @__PURE__ */ p(
|
|
5809
5809
|
"div",
|
|
5810
5810
|
{
|
|
@@ -5855,7 +5855,7 @@ function va({
|
|
|
5855
5855
|
);
|
|
5856
5856
|
}) }) });
|
|
5857
5857
|
}
|
|
5858
|
-
function
|
|
5858
|
+
function Ia({
|
|
5859
5859
|
cartItems: t,
|
|
5860
5860
|
isUploading: e = !1
|
|
5861
5861
|
}) {
|
|
@@ -5863,9 +5863,9 @@ function Ca({
|
|
|
5863
5863
|
(s) => s.parser.parsedContent
|
|
5864
5864
|
);
|
|
5865
5865
|
return /* @__PURE__ */ a("div", { className: "animate-fade-in-scale flex flex-col w-full max-w-[900px] gap-10 bg-surface rounded-2xl p-10 max-md:p-6 border border-border-strong border-solid", children: /* @__PURE__ */ p("div", { className: "flex w-full justify-center gap-32 max-md:flex-col max-md:gap-8", children: [
|
|
5866
|
-
/* @__PURE__ */ a("div", { className: "shrink-0 flex items-center justify-center", children: /* @__PURE__ */ a(
|
|
5866
|
+
/* @__PURE__ */ a("div", { className: "shrink-0 flex items-center justify-center", children: /* @__PURE__ */ a(Ca, { currentStep: r }) }),
|
|
5867
5867
|
/* @__PURE__ */ a("div", { className: "shrink-0 flex items-center justify-center min-w-80", children: /* @__PURE__ */ a(
|
|
5868
|
-
|
|
5868
|
+
la,
|
|
5869
5869
|
{
|
|
5870
5870
|
items: t,
|
|
5871
5871
|
orderId: n,
|
|
@@ -5876,7 +5876,7 @@ function Ca({
|
|
|
5876
5876
|
) })
|
|
5877
5877
|
] }) });
|
|
5878
5878
|
}
|
|
5879
|
-
function
|
|
5879
|
+
function wa({
|
|
5880
5880
|
onFileUpload: t,
|
|
5881
5881
|
onSkip: e,
|
|
5882
5882
|
onClearError: r,
|
|
@@ -5895,8 +5895,8 @@ function Ia({
|
|
|
5895
5895
|
{
|
|
5896
5896
|
className: `upload-step flex flex-col w-full flex-1 min-h-0 ${l.isDragging ? "upload-step-dragging" : ""} ${c ? "upload-step-processing" : ""}`,
|
|
5897
5897
|
...l.dragProps,
|
|
5898
|
-
children: /* @__PURE__ */ a("div", { className: "upload-step-content animate-fade-in-up flex-1 flex items-center justify-center min-h-0 relative", children: c ? /* @__PURE__ */ a(
|
|
5899
|
-
|
|
5898
|
+
children: /* @__PURE__ */ a("div", { className: "upload-step-content animate-fade-in-up flex-1 flex items-center justify-center min-h-0 relative", children: c ? /* @__PURE__ */ a(Ia, { cartItems: n, isUploading: i }) : /* @__PURE__ */ a(
|
|
5899
|
+
ca,
|
|
5900
5900
|
{
|
|
5901
5901
|
isDragging: l.isDragging,
|
|
5902
5902
|
fileInputRef: l.fileInputRef,
|
|
@@ -5932,7 +5932,7 @@ function qt(t, e) {
|
|
|
5932
5932
|
function $r(t, e) {
|
|
5933
5933
|
return t !== void 0 && Math.abs(t - e) > 0.01;
|
|
5934
5934
|
}
|
|
5935
|
-
function
|
|
5935
|
+
function Sa(t, e) {
|
|
5936
5936
|
const r = [...t];
|
|
5937
5937
|
for (const n of e) {
|
|
5938
5938
|
const i = r.findIndex(
|
|
@@ -5942,7 +5942,7 @@ function wa(t, e) {
|
|
|
5942
5942
|
}
|
|
5943
5943
|
return r;
|
|
5944
5944
|
}
|
|
5945
|
-
function
|
|
5945
|
+
function Na(t, e) {
|
|
5946
5946
|
const r = [], n = [];
|
|
5947
5947
|
for (const i of e) {
|
|
5948
5948
|
const s = t.find(
|
|
@@ -5957,7 +5957,7 @@ function Sa(t, e) {
|
|
|
5957
5957
|
}
|
|
5958
5958
|
return { toAdd: r, toUpdate: n };
|
|
5959
5959
|
}
|
|
5960
|
-
function
|
|
5960
|
+
function Ea(t, e) {
|
|
5961
5961
|
const r = [];
|
|
5962
5962
|
for (const n of t.lineItems.physicalItems) {
|
|
5963
5963
|
const i = e.find(
|
|
@@ -5986,14 +5986,14 @@ function Ke(t) {
|
|
|
5986
5986
|
function Je(t) {
|
|
5987
5987
|
return t.toLowerCase();
|
|
5988
5988
|
}
|
|
5989
|
-
function
|
|
5989
|
+
function ka(t, e) {
|
|
5990
5990
|
return t.filter(
|
|
5991
5991
|
(r) => !e.some(
|
|
5992
5992
|
(n) => r.productSku && n.sku && Ke(r.productSku) === Ke(n.sku) || r.productName && n.name && Je(r.productName) === Je(n.name)
|
|
5993
5993
|
)
|
|
5994
5994
|
);
|
|
5995
5995
|
}
|
|
5996
|
-
function
|
|
5996
|
+
function Pa(t) {
|
|
5997
5997
|
const { client: e, onError: r } = t, n = D(e), i = D(r);
|
|
5998
5998
|
i.current = r;
|
|
5999
5999
|
const s = y((f) => f.bcSession.bcCart), o = y((f) => f.bcSession.checkout), c = y(
|
|
@@ -6240,11 +6240,11 @@ function ka(t) {
|
|
|
6240
6240
|
return { cart: s, cartItems: [], errors: [] };
|
|
6241
6241
|
I(!0);
|
|
6242
6242
|
try {
|
|
6243
|
-
const N =
|
|
6243
|
+
const N = Sa(z, f), T = await n.current.getCart();
|
|
6244
6244
|
let P = null;
|
|
6245
6245
|
const M = [];
|
|
6246
6246
|
if (T) {
|
|
6247
|
-
const { toAdd: G, toUpdate: ce } =
|
|
6247
|
+
const { toAdd: G, toUpdate: ce } = Na(
|
|
6248
6248
|
T.lineItems.physicalItems,
|
|
6249
6249
|
f
|
|
6250
6250
|
);
|
|
@@ -6317,10 +6317,10 @@ function ka(t) {
|
|
|
6317
6317
|
}
|
|
6318
6318
|
if (!P)
|
|
6319
6319
|
return { cart: null, cartItems: [], errors: M };
|
|
6320
|
-
const { cartItems: U } =
|
|
6320
|
+
const { cartItems: U } = Ea(
|
|
6321
6321
|
P,
|
|
6322
6322
|
N
|
|
6323
|
-
), je = y.getState().cartifact.itemWarnings, Oe =
|
|
6323
|
+
), je = y.getState().cartifact.itemWarnings, Oe = ka(
|
|
6324
6324
|
je,
|
|
6325
6325
|
U
|
|
6326
6326
|
);
|
|
@@ -6608,7 +6608,7 @@ function ka(t) {
|
|
|
6608
6608
|
setSelectedBillingAddressId: O
|
|
6609
6609
|
};
|
|
6610
6610
|
}
|
|
6611
|
-
function
|
|
6611
|
+
function Ta({
|
|
6612
6612
|
bcCart: t,
|
|
6613
6613
|
cartItems: e,
|
|
6614
6614
|
onCheckoutInitiated: r,
|
|
@@ -6688,14 +6688,14 @@ const st = /* @__PURE__ */ new Set([
|
|
|
6688
6688
|
ut,
|
|
6689
6689
|
Ye,
|
|
6690
6690
|
pt
|
|
6691
|
-
]),
|
|
6692
|
-
function
|
|
6691
|
+
]), Aa = "did not produce any output";
|
|
6692
|
+
function $a(t) {
|
|
6693
6693
|
const e = t.filter((n) => st.has(n.toolName)).map((n) => n.toolName);
|
|
6694
6694
|
return e.length === 0 ? "" : `
|
|
6695
6695
|
|
|
6696
6696
|
Tools called: ${[...new Set(e)].join(", ")}`;
|
|
6697
6697
|
}
|
|
6698
|
-
async function
|
|
6698
|
+
async function Ba(t, e, r, n, i, s) {
|
|
6699
6699
|
const o = [], c = [], l = [], d = [];
|
|
6700
6700
|
let h = [
|
|
6701
6701
|
{
|
|
@@ -6707,15 +6707,15 @@ async function $a(t, e, r, n, i, s) {
|
|
|
6707
6707
|
let m = 0;
|
|
6708
6708
|
for (; m < u; ) {
|
|
6709
6709
|
m++;
|
|
6710
|
-
const k = await
|
|
6710
|
+
const k = await Us(
|
|
6711
6711
|
t,
|
|
6712
6712
|
e,
|
|
6713
6713
|
r,
|
|
6714
6714
|
h
|
|
6715
|
-
), g = await
|
|
6715
|
+
), g = await _s(k, {
|
|
6716
6716
|
onToolCall: s?.onToolCall
|
|
6717
6717
|
});
|
|
6718
|
-
if (c.push(...g.textParts), o.push(...g.toolCalls), g.finalMessage && l.push(g.finalMessage), g.errorMessage?.includes(
|
|
6718
|
+
if (c.push(...g.textParts), o.push(...g.toolCalls), g.finalMessage && l.push(g.finalMessage), g.errorMessage?.includes(Aa)) {
|
|
6719
6719
|
s?.logger?.debug(
|
|
6720
6720
|
`Batch ${i}: Exiting loop - no output error`
|
|
6721
6721
|
);
|
|
@@ -6783,7 +6783,7 @@ async function $a(t, e, r, n, i, s) {
|
|
|
6783
6783
|
);
|
|
6784
6784
|
const S = l.length > 0 ? l.join(`
|
|
6785
6785
|
|
|
6786
|
-
`) : c.join(""), b =
|
|
6786
|
+
`) : c.join(""), b = $a(o), x = S + b, E = d.filter(
|
|
6787
6787
|
(k) => k.toolName === Fe
|
|
6788
6788
|
).reduce((k, g) => {
|
|
6789
6789
|
const A = g.input?.value;
|
|
@@ -6804,7 +6804,7 @@ async function $a(t, e, r, n, i, s) {
|
|
|
6804
6804
|
pendingClientToolCalls: d
|
|
6805
6805
|
};
|
|
6806
6806
|
}
|
|
6807
|
-
async function
|
|
6807
|
+
async function Ma(t, e, r, n) {
|
|
6808
6808
|
if (r.length === 0)
|
|
6809
6809
|
return { results: [], hasErrors: !1 };
|
|
6810
6810
|
const s = (await Promise.allSettled(
|
|
@@ -6831,7 +6831,7 @@ async function Ba(t, e, r, n) {
|
|
|
6831
6831
|
error: "Failed to create thread"
|
|
6832
6832
|
};
|
|
6833
6833
|
try {
|
|
6834
|
-
const u = await
|
|
6834
|
+
const u = await Ba(
|
|
6835
6835
|
t,
|
|
6836
6836
|
e,
|
|
6837
6837
|
h,
|
|
@@ -6856,7 +6856,7 @@ async function Ba(t, e, r, n) {
|
|
|
6856
6856
|
), c = o.some((l) => l.error !== void 0);
|
|
6857
6857
|
return { results: o, hasErrors: c };
|
|
6858
6858
|
}
|
|
6859
|
-
function
|
|
6859
|
+
function Fa(t) {
|
|
6860
6860
|
const e = [];
|
|
6861
6861
|
let r = null;
|
|
6862
6862
|
const n = [];
|
|
@@ -6877,7 +6877,7 @@ function Ma(t) {
|
|
|
6877
6877
|
}
|
|
6878
6878
|
return { addToCartItems: e, setPoMetadataArgs: r, processingFailures: n };
|
|
6879
6879
|
}
|
|
6880
|
-
function
|
|
6880
|
+
function Oa(t) {
|
|
6881
6881
|
if (t.length === 0)
|
|
6882
6882
|
return "";
|
|
6883
6883
|
const e = [
|
|
@@ -6893,7 +6893,7 @@ function Fa(t) {
|
|
|
6893
6893
|
return e.join(`
|
|
6894
6894
|
`);
|
|
6895
6895
|
}
|
|
6896
|
-
function
|
|
6896
|
+
function Ra(t) {
|
|
6897
6897
|
if (t.length === 0) return "";
|
|
6898
6898
|
const e = ["---", "## Failed Tool Calls", ""];
|
|
6899
6899
|
for (const r of t) {
|
|
@@ -6909,8 +6909,8 @@ function Oa(t) {
|
|
|
6909
6909
|
return e.join(`
|
|
6910
6910
|
`);
|
|
6911
6911
|
}
|
|
6912
|
-
async function
|
|
6913
|
-
const r =
|
|
6912
|
+
async function Da(t, e) {
|
|
6913
|
+
const r = Fa(t);
|
|
6914
6914
|
if (r.setPoMetadataArgs) {
|
|
6915
6915
|
const s = r.setPoMetadataArgs;
|
|
6916
6916
|
y.getState().applyPoMetadata(s.poMetadata);
|
|
@@ -6920,20 +6920,20 @@ async function Ra(t, e) {
|
|
|
6920
6920
|
const { errors: s } = await e.addToCart(r.addToCartItems);
|
|
6921
6921
|
n = s, s.length > 0 && console.error("Failed to add some items to cart:", s);
|
|
6922
6922
|
}
|
|
6923
|
-
const i =
|
|
6923
|
+
const i = Oa(
|
|
6924
6924
|
r.processingFailures
|
|
6925
6925
|
);
|
|
6926
6926
|
if (n.length > 0) {
|
|
6927
|
-
const s =
|
|
6927
|
+
const s = Ra(n);
|
|
6928
6928
|
return i ? `${i}
|
|
6929
6929
|
${s}` : s;
|
|
6930
6930
|
}
|
|
6931
6931
|
return i;
|
|
6932
6932
|
}
|
|
6933
|
-
async function
|
|
6933
|
+
async function La(t, e) {
|
|
6934
6934
|
if (e.length === 0)
|
|
6935
6935
|
return { results: [], processingFailuresString: "", hasErrors: !1 };
|
|
6936
|
-
const r = await
|
|
6936
|
+
const r = await Ma(
|
|
6937
6937
|
t.takeshapeConfig,
|
|
6938
6938
|
t.agentName,
|
|
6939
6939
|
e,
|
|
@@ -6947,7 +6947,7 @@ async function Da(t, e) {
|
|
|
6947
6947
|
}
|
|
6948
6948
|
);
|
|
6949
6949
|
let n = "";
|
|
6950
|
-
return t.bcCart && (n = await
|
|
6950
|
+
return t.bcCart && (n = await Da(
|
|
6951
6951
|
r.results,
|
|
6952
6952
|
t.bcCart
|
|
6953
6953
|
)), {
|
|
@@ -6956,7 +6956,7 @@ async function Da(t, e) {
|
|
|
6956
6956
|
hasErrors: r.hasErrors
|
|
6957
6957
|
};
|
|
6958
6958
|
}
|
|
6959
|
-
function
|
|
6959
|
+
function _a(t) {
|
|
6960
6960
|
const { bcCart: e } = t, r = y(
|
|
6961
6961
|
(d) => d.takeshapeConfig
|
|
6962
6962
|
), n = y(
|
|
@@ -6980,7 +6980,7 @@ function La(t) {
|
|
|
6980
6980
|
bcCart: e
|
|
6981
6981
|
};
|
|
6982
6982
|
try {
|
|
6983
|
-
const u = await
|
|
6983
|
+
const u = await La(h, d);
|
|
6984
6984
|
if (s(
|
|
6985
6985
|
u.results,
|
|
6986
6986
|
u.processingFailuresString
|
|
@@ -7010,7 +7010,7 @@ function La(t) {
|
|
|
7010
7010
|
reset: o
|
|
7011
7011
|
};
|
|
7012
7012
|
}
|
|
7013
|
-
function
|
|
7013
|
+
function Ua({
|
|
7014
7014
|
appState: t,
|
|
7015
7015
|
setAppState: e,
|
|
7016
7016
|
parser: r,
|
|
@@ -7022,7 +7022,7 @@ function _a({
|
|
|
7022
7022
|
(u) => u.parser.hasProcessedDocument
|
|
7023
7023
|
), l = y(
|
|
7024
7024
|
(u) => u.setHasProcessedDocument
|
|
7025
|
-
), { processBatches: d } =
|
|
7025
|
+
), { processBatches: d } = _a({ bcCart: s });
|
|
7026
7026
|
return F(() => {
|
|
7027
7027
|
t === "processing" && r.parserStatus !== "streaming" && r.parserStatus !== "submitted" && r.parsedContent && r.parserMessages.length > 0 && !o.current && (o.current = !0, l(!0), d(r.parsedContent));
|
|
7028
7028
|
}, [
|
|
@@ -7048,30 +7048,30 @@ function _a({
|
|
|
7048
7048
|
}
|
|
7049
7049
|
};
|
|
7050
7050
|
}
|
|
7051
|
-
const
|
|
7052
|
-
function qa(t) {
|
|
7053
|
-
return t.split(Ua).map((e) => e.trim()).filter(Boolean);
|
|
7054
|
-
}
|
|
7051
|
+
const qa = "<!-- BATCH -->";
|
|
7055
7052
|
function ja(t) {
|
|
7053
|
+
return t.split(qa).map((e) => e.trim()).filter(Boolean);
|
|
7054
|
+
}
|
|
7055
|
+
function Wa(t) {
|
|
7056
7056
|
return new Promise((e, r) => {
|
|
7057
7057
|
const n = new FileReader();
|
|
7058
7058
|
n.onload = () => e(n.result), n.onerror = () => r(new Error("Failed to read file")), n.readAsText(t);
|
|
7059
7059
|
});
|
|
7060
7060
|
}
|
|
7061
|
-
function
|
|
7061
|
+
function Va(t) {
|
|
7062
7062
|
return new Promise((e, r) => {
|
|
7063
7063
|
const n = new FileReader();
|
|
7064
7064
|
n.onload = () => e(n.result), n.onerror = () => r(new Error("Failed to read file")), n.readAsDataURL(t);
|
|
7065
7065
|
});
|
|
7066
7066
|
}
|
|
7067
|
-
const
|
|
7067
|
+
const za = /* @__PURE__ */ new Set([
|
|
7068
7068
|
"application/vnd.ms-excel",
|
|
7069
7069
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
7070
7070
|
]);
|
|
7071
7071
|
function jt(t) {
|
|
7072
|
-
return
|
|
7072
|
+
return za.has(t);
|
|
7073
7073
|
}
|
|
7074
|
-
async function
|
|
7074
|
+
async function Qa(t) {
|
|
7075
7075
|
const e = await import("xlsx"), r = await t.arrayBuffer(), n = e.read(r, { type: "array" });
|
|
7076
7076
|
if (n.SheetNames.length === 0)
|
|
7077
7077
|
throw new Error("Workbook contains no sheets");
|
|
@@ -7083,27 +7083,27 @@ async function za(t) {
|
|
|
7083
7083
|
const s = e.utils.json_to_sheet(i);
|
|
7084
7084
|
return e.utils.sheet_to_csv(s);
|
|
7085
7085
|
}
|
|
7086
|
-
const
|
|
7087
|
-
function
|
|
7086
|
+
const Ha = "%PDF-", Ga = "%%EOF", Ka = 256;
|
|
7087
|
+
function Ja(t) {
|
|
7088
7088
|
return new Promise((e, r) => {
|
|
7089
7089
|
const n = new FileReader();
|
|
7090
7090
|
n.onload = () => e(n.result), n.onerror = () => r(n.error), n.readAsArrayBuffer(t);
|
|
7091
7091
|
});
|
|
7092
7092
|
}
|
|
7093
|
-
async function
|
|
7094
|
-
if (t.size <
|
|
7093
|
+
async function Ya(t) {
|
|
7094
|
+
if (t.size < Ka) return { valid: !1, reason: "invalid" };
|
|
7095
7095
|
let e;
|
|
7096
7096
|
try {
|
|
7097
|
-
e = new Uint8Array(await
|
|
7097
|
+
e = new Uint8Array(await Ja(t));
|
|
7098
7098
|
} catch {
|
|
7099
7099
|
return { valid: !1, reason: "invalid" };
|
|
7100
7100
|
}
|
|
7101
|
-
if (!String.fromCharCode(...e.slice(0, 5)).startsWith(
|
|
7101
|
+
if (!String.fromCharCode(...e.slice(0, 5)).startsWith(Ha))
|
|
7102
7102
|
return { valid: !1, reason: "invalid" };
|
|
7103
7103
|
const n = Math.min(1024, e.length);
|
|
7104
7104
|
if (!String.fromCharCode(
|
|
7105
7105
|
...e.slice(e.length - n)
|
|
7106
|
-
).includes(
|
|
7106
|
+
).includes(Ga))
|
|
7107
7107
|
return { valid: !1, reason: "invalid" };
|
|
7108
7108
|
const s = Math.max(0, e.length - 8192), o = new TextDecoder().decode(e.slice(s)), c = o.lastIndexOf("<<"), l = o.lastIndexOf(">>");
|
|
7109
7109
|
if (c !== -1 && l !== -1 && c < l && o.substring(c, l).includes("/Encrypt"))
|
|
@@ -7127,7 +7127,7 @@ async function Ja(t) {
|
|
|
7127
7127
|
}
|
|
7128
7128
|
return { valid: !0 };
|
|
7129
7129
|
}
|
|
7130
|
-
const
|
|
7130
|
+
const Xa = /* @__PURE__ */ new Set([
|
|
7131
7131
|
"text/csv",
|
|
7132
7132
|
"text/plain",
|
|
7133
7133
|
"application/json"
|
|
@@ -7142,7 +7142,7 @@ ${e}`
|
|
|
7142
7142
|
}
|
|
7143
7143
|
];
|
|
7144
7144
|
}
|
|
7145
|
-
function
|
|
7145
|
+
function Za(t, e, r) {
|
|
7146
7146
|
return [
|
|
7147
7147
|
{ type: "text", text: Br },
|
|
7148
7148
|
{
|
|
@@ -7153,7 +7153,7 @@ function Xa(t, e, r) {
|
|
|
7153
7153
|
}
|
|
7154
7154
|
];
|
|
7155
7155
|
}
|
|
7156
|
-
function
|
|
7156
|
+
function ei({
|
|
7157
7157
|
createParserThread: t,
|
|
7158
7158
|
sendParserMessage: e
|
|
7159
7159
|
}) {
|
|
@@ -7161,7 +7161,7 @@ function Za({
|
|
|
7161
7161
|
async (c) => {
|
|
7162
7162
|
const l = y.getState();
|
|
7163
7163
|
if (l.setParsedContent(null), n(!0), l.setUploadedFileName(c.name), s(null), c.type === "application/pdf") {
|
|
7164
|
-
const d = await
|
|
7164
|
+
const d = await Ya(c);
|
|
7165
7165
|
if (!d.valid)
|
|
7166
7166
|
return s(
|
|
7167
7167
|
d.reason === "password-protected" ? "The PDF appears to be password protected." : "The file does not appear to be a valid PDF."
|
|
@@ -7170,15 +7170,15 @@ function Za({
|
|
|
7170
7170
|
await t();
|
|
7171
7171
|
try {
|
|
7172
7172
|
if (jt(c.type)) {
|
|
7173
|
-
const d = await
|
|
7173
|
+
const d = await Qa(c);
|
|
7174
7174
|
e({ parts: Wt(c.name, d) });
|
|
7175
|
-
} else if (
|
|
7176
|
-
const d = await
|
|
7175
|
+
} else if (Xa.has(c.type)) {
|
|
7176
|
+
const d = await Wa(c);
|
|
7177
7177
|
e({ parts: Wt(c.name, d) });
|
|
7178
7178
|
} else {
|
|
7179
|
-
const d = await
|
|
7179
|
+
const d = await Va(c);
|
|
7180
7180
|
e({
|
|
7181
|
-
parts:
|
|
7181
|
+
parts: Za(d, c.type, c.name)
|
|
7182
7182
|
});
|
|
7183
7183
|
}
|
|
7184
7184
|
} catch (d) {
|
|
@@ -7243,7 +7243,7 @@ function Mr(t) {
|
|
|
7243
7243
|
createThread: m
|
|
7244
7244
|
};
|
|
7245
7245
|
}
|
|
7246
|
-
function
|
|
7246
|
+
function ti() {
|
|
7247
7247
|
const { sseOrigin: t, projectId: e, apiKey: r } = y(
|
|
7248
7248
|
(g) => g.takeshapeConfig
|
|
7249
7249
|
), n = y(
|
|
@@ -7301,7 +7301,7 @@ function ei() {
|
|
|
7301
7301
|
parserError: x,
|
|
7302
7302
|
setParserError: v,
|
|
7303
7303
|
handleFileUpload: E
|
|
7304
|
-
} =
|
|
7304
|
+
} = ei({
|
|
7305
7305
|
createParserThread: s,
|
|
7306
7306
|
sendParserMessage: h
|
|
7307
7307
|
}), I = B(
|
|
@@ -7320,7 +7320,7 @@ function ei() {
|
|
|
7320
7320
|
if (d.length > 0) {
|
|
7321
7321
|
const g = d[d.length - 1];
|
|
7322
7322
|
if (g?.role === "assistant" && Array.isArray(g.parts)) {
|
|
7323
|
-
const A = g.parts.filter((O) => O.type === "text").map((O) => O.text).filter(Boolean), $ =
|
|
7323
|
+
const A = g.parts.filter((O) => O.type === "text").map((O) => O.text).filter(Boolean), $ = ja(A.join(""));
|
|
7324
7324
|
y.getState().setParsedContent($), $ && b(!1);
|
|
7325
7325
|
}
|
|
7326
7326
|
}
|
|
@@ -7346,7 +7346,7 @@ function ei() {
|
|
|
7346
7346
|
reset: k
|
|
7347
7347
|
};
|
|
7348
7348
|
}
|
|
7349
|
-
class
|
|
7349
|
+
class ri {
|
|
7350
7350
|
b2bToken = null;
|
|
7351
7351
|
companyId = null;
|
|
7352
7352
|
channelId;
|
|
@@ -7492,12 +7492,12 @@ class ti {
|
|
|
7492
7492
|
}
|
|
7493
7493
|
}
|
|
7494
7494
|
}
|
|
7495
|
-
function
|
|
7495
|
+
function ni(t) {
|
|
7496
7496
|
return console.debug(
|
|
7497
7497
|
`[createB2BClient] Initializing B2B client for channelId=${t.channelId}`
|
|
7498
|
-
), new
|
|
7498
|
+
), new ri(t);
|
|
7499
7499
|
}
|
|
7500
|
-
async function
|
|
7500
|
+
async function Ki(t) {
|
|
7501
7501
|
let e = null;
|
|
7502
7502
|
try {
|
|
7503
7503
|
const r = await Ee(
|
|
@@ -7546,7 +7546,7 @@ async function Gi(t) {
|
|
|
7546
7546
|
return null;
|
|
7547
7547
|
}
|
|
7548
7548
|
}
|
|
7549
|
-
async function
|
|
7549
|
+
async function si(t, e) {
|
|
7550
7550
|
const { setToolCallError: r } = y.getState(), n = t.input;
|
|
7551
7551
|
let i = "No items provided to add to cart.";
|
|
7552
7552
|
if (n.value && n.value.length > 0) {
|
|
@@ -7563,7 +7563,7 @@ async function ni(t, e) {
|
|
|
7563
7563
|
output: i
|
|
7564
7564
|
};
|
|
7565
7565
|
}
|
|
7566
|
-
async function
|
|
7566
|
+
async function ai(t, e) {
|
|
7567
7567
|
const { setToolCallError: r } = y.getState();
|
|
7568
7568
|
let n = "Cart cleared successfully.";
|
|
7569
7569
|
try {
|
|
@@ -7578,7 +7578,7 @@ async function si(t, e) {
|
|
|
7578
7578
|
output: n
|
|
7579
7579
|
};
|
|
7580
7580
|
}
|
|
7581
|
-
function
|
|
7581
|
+
function ii(t, e) {
|
|
7582
7582
|
const r = {
|
|
7583
7583
|
items: e.cartItems.map((n) => ({
|
|
7584
7584
|
productEntityId: n.productEntityId,
|
|
@@ -7598,7 +7598,7 @@ function ai(t, e) {
|
|
|
7598
7598
|
output: JSON.stringify(r)
|
|
7599
7599
|
};
|
|
7600
7600
|
}
|
|
7601
|
-
function
|
|
7601
|
+
function oi(t) {
|
|
7602
7602
|
const { parser: e } = y.getState(), r = {
|
|
7603
7603
|
uploadedFileName: e.uploadedFileName,
|
|
7604
7604
|
parsedContent: e.parsedContent
|
|
@@ -7609,7 +7609,7 @@ function ii(t) {
|
|
|
7609
7609
|
output: JSON.stringify(r)
|
|
7610
7610
|
};
|
|
7611
7611
|
}
|
|
7612
|
-
async function
|
|
7612
|
+
async function ci(t, e) {
|
|
7613
7613
|
const { setToolCallError: r } = y.getState(), n = t.input;
|
|
7614
7614
|
let i = "Item removed from cart successfully.";
|
|
7615
7615
|
try {
|
|
@@ -7634,7 +7634,7 @@ async function oi(t, e) {
|
|
|
7634
7634
|
output: i
|
|
7635
7635
|
};
|
|
7636
7636
|
}
|
|
7637
|
-
function
|
|
7637
|
+
function li(t) {
|
|
7638
7638
|
const {
|
|
7639
7639
|
cartifact: { itemWarnings: e },
|
|
7640
7640
|
setItemWarnings: r
|
|
@@ -7647,7 +7647,7 @@ function ci(t) {
|
|
|
7647
7647
|
output: "Item warnings removed successfully."
|
|
7648
7648
|
};
|
|
7649
7649
|
}
|
|
7650
|
-
function
|
|
7650
|
+
function di(t) {
|
|
7651
7651
|
const { setItemWarnings: e } = y.getState(), r = t.input;
|
|
7652
7652
|
return r.itemWarnings && e(r.itemWarnings), {
|
|
7653
7653
|
tool: vr,
|
|
@@ -7655,7 +7655,7 @@ function li(t) {
|
|
|
7655
7655
|
output: "Item warnings set successfully."
|
|
7656
7656
|
};
|
|
7657
7657
|
}
|
|
7658
|
-
function
|
|
7658
|
+
function ui(t) {
|
|
7659
7659
|
const e = t.input;
|
|
7660
7660
|
return y.getState().applyPoMetadata(e.poMetadata), {
|
|
7661
7661
|
tool: Ye,
|
|
@@ -7663,7 +7663,7 @@ function di(t) {
|
|
|
7663
7663
|
output: "PO metadata set successfully."
|
|
7664
7664
|
};
|
|
7665
7665
|
}
|
|
7666
|
-
async function
|
|
7666
|
+
async function pi(t, e) {
|
|
7667
7667
|
const { setToolCallError: r, setPoItemPrice: n } = y.getState(), i = t.input;
|
|
7668
7668
|
let s = 0;
|
|
7669
7669
|
try {
|
|
@@ -7696,21 +7696,21 @@ async function ui(t, e) {
|
|
|
7696
7696
|
};
|
|
7697
7697
|
}
|
|
7698
7698
|
const Fr = {
|
|
7699
|
-
addToCart:
|
|
7700
|
-
updateCart:
|
|
7701
|
-
removeFromCart:
|
|
7702
|
-
clearCart:
|
|
7703
|
-
getCart:
|
|
7704
|
-
getPurchaseOrderData:
|
|
7705
|
-
setPoMetadata:
|
|
7706
|
-
setItemWarnings:
|
|
7707
|
-
removeItemWarnings:
|
|
7708
|
-
},
|
|
7709
|
-
async function
|
|
7699
|
+
addToCart: si,
|
|
7700
|
+
updateCart: pi,
|
|
7701
|
+
removeFromCart: ci,
|
|
7702
|
+
clearCart: ai,
|
|
7703
|
+
getCart: ii,
|
|
7704
|
+
getPurchaseOrderData: oi,
|
|
7705
|
+
setPoMetadata: ui,
|
|
7706
|
+
setItemWarnings: di,
|
|
7707
|
+
removeItemWarnings: li
|
|
7708
|
+
}, hi = new Set(Object.keys(Fr));
|
|
7709
|
+
async function fi(t, e) {
|
|
7710
7710
|
const r = Fr[t.toolName];
|
|
7711
7711
|
return r?.(t, e);
|
|
7712
7712
|
}
|
|
7713
|
-
function
|
|
7713
|
+
function mi(t, e) {
|
|
7714
7714
|
const n = [...t].reverse().find((i) => i.role === "assistant")?.parts?.find(
|
|
7715
7715
|
(i) => "toolCallId" in i && i.toolCallId === e && "state" in i && (i.state === "output-available" || i.state === "output-error")
|
|
7716
7716
|
);
|
|
@@ -7720,12 +7720,12 @@ function fi(t, e) {
|
|
|
7720
7720
|
errorText: "errorText" in n ? String(n.errorText) : void 0
|
|
7721
7721
|
};
|
|
7722
7722
|
}
|
|
7723
|
-
async function
|
|
7723
|
+
async function gi(t, e, r) {
|
|
7724
7724
|
const n = [], i = [];
|
|
7725
7725
|
for (const s of t) {
|
|
7726
|
-
if (!
|
|
7726
|
+
if (!hi.has(s.toolName))
|
|
7727
7727
|
continue;
|
|
7728
|
-
const o =
|
|
7728
|
+
const o = mi(
|
|
7729
7729
|
e,
|
|
7730
7730
|
s.toolCallId
|
|
7731
7731
|
);
|
|
@@ -7744,7 +7744,7 @@ async function mi(t, e, r) {
|
|
|
7744
7744
|
continue;
|
|
7745
7745
|
}
|
|
7746
7746
|
try {
|
|
7747
|
-
const c = await
|
|
7747
|
+
const c = await fi(s, r);
|
|
7748
7748
|
c && (n.push(c.toolCallId), i.push(c));
|
|
7749
7749
|
} catch (c) {
|
|
7750
7750
|
console.error("[handleToolCall] Error:", { toolCall: s, error: c });
|
|
@@ -7754,7 +7754,7 @@ async function mi(t, e, r) {
|
|
|
7754
7754
|
}
|
|
7755
7755
|
return { completedToolCallIds: n, outputs: i };
|
|
7756
7756
|
}
|
|
7757
|
-
function
|
|
7757
|
+
function yi() {
|
|
7758
7758
|
try {
|
|
7759
7759
|
const t = localStorage.getItem(ct);
|
|
7760
7760
|
if (!t)
|
|
@@ -7810,7 +7810,7 @@ function ze() {
|
|
|
7810
7810
|
console.error("Failed to clear persisted session:", t);
|
|
7811
7811
|
}
|
|
7812
7812
|
}
|
|
7813
|
-
function
|
|
7813
|
+
function xi(t, e) {
|
|
7814
7814
|
return !t && !e ? { valid: !0 } : t && !e ? {
|
|
7815
7815
|
valid: !1,
|
|
7816
7816
|
error: "Your previous session was reset because you signed out."
|
|
@@ -7822,20 +7822,20 @@ function yi(t, e) {
|
|
|
7822
7822
|
error: "Your previous session was reset because you signed in as a different user."
|
|
7823
7823
|
} : { valid: !0 };
|
|
7824
7824
|
}
|
|
7825
|
-
async function
|
|
7825
|
+
async function bi(t, e) {
|
|
7826
7826
|
return { valid: !0 };
|
|
7827
7827
|
}
|
|
7828
|
-
function
|
|
7828
|
+
function vi(t) {
|
|
7829
7829
|
return t ? { valid: !0 } : {
|
|
7830
7830
|
valid: !1,
|
|
7831
7831
|
error: "The cart from your previous session is no longer available."
|
|
7832
7832
|
};
|
|
7833
7833
|
}
|
|
7834
|
-
async function
|
|
7834
|
+
async function Ci(t) {
|
|
7835
7835
|
const e = y.getState();
|
|
7836
7836
|
if (e.ui.initStatus !== "pending")
|
|
7837
7837
|
return;
|
|
7838
|
-
const r =
|
|
7838
|
+
const r = yi();
|
|
7839
7839
|
if (e.setTakeShapeConfig(t.takeShapeConfig), !r.valid) {
|
|
7840
7840
|
ze(), e.failValidation(r.error ?? "Session validation failed");
|
|
7841
7841
|
return;
|
|
@@ -7883,12 +7883,12 @@ async function vi(t) {
|
|
|
7883
7883
|
const d = [];
|
|
7884
7884
|
d.push(
|
|
7885
7885
|
Promise.resolve(
|
|
7886
|
-
|
|
7886
|
+
xi(
|
|
7887
7887
|
c.customerEntityId ?? null,
|
|
7888
7888
|
i
|
|
7889
7889
|
)
|
|
7890
7890
|
)
|
|
7891
|
-
), s && d.push(
|
|
7891
|
+
), s && d.push(bi()), o && d.push(Promise.resolve(vi(l)));
|
|
7892
7892
|
const u = (await Promise.all(d)).find((m) => !m.valid);
|
|
7893
7893
|
if (u) {
|
|
7894
7894
|
ze(), e.failValidation(u.error ?? "Session validation failed");
|
|
@@ -7896,16 +7896,16 @@ async function vi(t) {
|
|
|
7896
7896
|
}
|
|
7897
7897
|
c && e.restoreSession(c), l && e.setBcCart(l), i && e.setCustomerInfo(i), n.length > 0 && e.setCustomerAddresses(n), e.completeValidation();
|
|
7898
7898
|
}
|
|
7899
|
-
function Ci(t) {
|
|
7900
|
-
return Qr(t) && "toolCallId" in t && typeof t.toolCallId == "string" && "output" in t && t.output !== void 0 && "state" in t && t.state === "output-available";
|
|
7901
|
-
}
|
|
7902
7899
|
function Ii(t) {
|
|
7903
|
-
return t
|
|
7900
|
+
return Qr(t) && "toolCallId" in t && typeof t.toolCallId == "string" && "output" in t && t.output !== void 0 && "state" in t && t.state === "output-available";
|
|
7904
7901
|
}
|
|
7905
7902
|
function wi(t) {
|
|
7903
|
+
return t ? t.filter(Ii) : [];
|
|
7904
|
+
}
|
|
7905
|
+
function Si(t) {
|
|
7906
7906
|
return t.type === "dynamic-tool" ? t.toolName ?? "unknown" : t.type.slice(5);
|
|
7907
7907
|
}
|
|
7908
|
-
const
|
|
7908
|
+
const Ni = new Wr({
|
|
7909
7909
|
defaultOptions: {
|
|
7910
7910
|
queries: {
|
|
7911
7911
|
staleTime: 300 * 1e3
|
|
@@ -7913,15 +7913,15 @@ const Si = new Wr({
|
|
|
7913
7913
|
}
|
|
7914
7914
|
}
|
|
7915
7915
|
});
|
|
7916
|
-
function Ni(t) {
|
|
7917
|
-
return /* @__PURE__ */ a(jr, { client: Si, children: /* @__PURE__ */ a(Ps, { client: t.bigcommerce.client, children: /* @__PURE__ */ a(Ei, { ...t }) }) });
|
|
7918
|
-
}
|
|
7919
7916
|
function Ei(t) {
|
|
7917
|
+
return /* @__PURE__ */ a(jr, { client: Ni, children: /* @__PURE__ */ a(Ts, { client: t.bigcommerce.client, children: /* @__PURE__ */ a(ki, { ...t }) }) });
|
|
7918
|
+
}
|
|
7919
|
+
function ki(t) {
|
|
7920
7920
|
const e = y((s) => s.ui.initStatus), r = y((s) => s.ui.initError), n = y((s) => s.fatalError), i = y((s) => s.clearInitError);
|
|
7921
7921
|
return F(() => {
|
|
7922
|
-
e === "pending" &&
|
|
7922
|
+
e === "pending" && Ci({
|
|
7923
7923
|
storefrontClient: t.bigcommerce.client,
|
|
7924
|
-
b2bClient:
|
|
7924
|
+
b2bClient: ni({
|
|
7925
7925
|
channelId: t.bigcommerce.client.channelId,
|
|
7926
7926
|
getB2BJwt: t.bigcommerce.getB2BJwt
|
|
7927
7927
|
}),
|
|
@@ -7931,7 +7931,7 @@ function Ei(t) {
|
|
|
7931
7931
|
"div",
|
|
7932
7932
|
{
|
|
7933
7933
|
className: `flex h-full items-center justify-center ${t.className ?? ""}`,
|
|
7934
|
-
children: /* @__PURE__ */ a(
|
|
7934
|
+
children: /* @__PURE__ */ a(sa, { message: n })
|
|
7935
7935
|
}
|
|
7936
7936
|
) : e === "pending" ? /* @__PURE__ */ a(
|
|
7937
7937
|
"div",
|
|
@@ -7943,7 +7943,7 @@ function Ei(t) {
|
|
|
7943
7943
|
"div",
|
|
7944
7944
|
{
|
|
7945
7945
|
className: `flex h-full items-center justify-center ${t.className ?? ""}`,
|
|
7946
|
-
children: /* @__PURE__ */ a(
|
|
7946
|
+
children: /* @__PURE__ */ a(na, {})
|
|
7947
7947
|
}
|
|
7948
7948
|
) : r ? /* @__PURE__ */ p(
|
|
7949
7949
|
"div",
|
|
@@ -7962,9 +7962,9 @@ function Ei(t) {
|
|
|
7962
7962
|
)
|
|
7963
7963
|
]
|
|
7964
7964
|
}
|
|
7965
|
-
) : /* @__PURE__ */ a(
|
|
7965
|
+
) : /* @__PURE__ */ a(Pi, { ...t });
|
|
7966
7966
|
}
|
|
7967
|
-
function
|
|
7967
|
+
function Pi({
|
|
7968
7968
|
className: t = "",
|
|
7969
7969
|
agentName: e = He,
|
|
7970
7970
|
inputName: r = He,
|
|
@@ -7990,7 +7990,7 @@ function ki({
|
|
|
7990
7990
|
null
|
|
7991
7991
|
), I = D(
|
|
7992
7992
|
null
|
|
7993
|
-
), w = Le((C) => C.isExpanded), k = Le((C) => C.setExpanded), g = Le((C) => C.reset), A =
|
|
7993
|
+
), w = Le((C) => C.isExpanded), k = Le((C) => C.setExpanded), g = Le((C) => C.reset), A = ti(), $ = Pa({
|
|
7994
7994
|
client: n.client,
|
|
7995
7995
|
onError: (C) => console.error("BigCommerce error:", C)
|
|
7996
7996
|
}), O = y((C) => C.cartifact.orderId), Q = y((C) => C.cartifact.buyerInfo), H = y(
|
|
@@ -8022,7 +8022,7 @@ function ki({
|
|
|
8022
8022
|
if (re.role === "user" && C.messages.length >= 2) {
|
|
8023
8023
|
const pe = C.messages[C.messages.length - 2], Xe = _.current;
|
|
8024
8024
|
if (pe?.role === "assistant" && Xe.size > 0) {
|
|
8025
|
-
const gt =
|
|
8025
|
+
const gt = wi(
|
|
8026
8026
|
pe.parts
|
|
8027
8027
|
).filter(
|
|
8028
8028
|
(yt) => Xe.has(yt.toolCallId)
|
|
@@ -8031,7 +8031,7 @@ function ki({
|
|
|
8031
8031
|
...pe,
|
|
8032
8032
|
parts: gt.map((Te) => ({
|
|
8033
8033
|
type: Te.type,
|
|
8034
|
-
toolName:
|
|
8034
|
+
toolName: Si(Te),
|
|
8035
8035
|
toolCallId: Te.toolCallId,
|
|
8036
8036
|
state: Te.state,
|
|
8037
8037
|
input: Te.input,
|
|
@@ -8083,7 +8083,7 @@ function ki({
|
|
|
8083
8083
|
}, []), F(() => {
|
|
8084
8084
|
if (J === "ready" && ie.current.length > 0) {
|
|
8085
8085
|
const C = [...ie.current];
|
|
8086
|
-
ie.current = [],
|
|
8086
|
+
ie.current = [], gi(C, j, $).then(async (re) => {
|
|
8087
8087
|
for (const we of re.outputs)
|
|
8088
8088
|
_.current.add(we.toolCallId), await me(we);
|
|
8089
8089
|
re.outputs.length > 0 && de({ text: ot });
|
|
@@ -8104,14 +8104,14 @@ function ki({
|
|
|
8104
8104
|
}, [ge, f, de, N]), F(() => {
|
|
8105
8105
|
i && b === "chatting" && k(!0);
|
|
8106
8106
|
}, [i, b, k]);
|
|
8107
|
-
const T = m || J === "submitted" || J === "streaming", P = oe(() =>
|
|
8107
|
+
const T = m || J === "submitted" || J === "streaming", P = oe(() => ga(j, J), [j, J]), M = Ua({
|
|
8108
8108
|
appState: b,
|
|
8109
8109
|
setAppState: x,
|
|
8110
8110
|
parser: A,
|
|
8111
8111
|
firstResponseComplete: P,
|
|
8112
8112
|
chatPanelRef: v,
|
|
8113
8113
|
bcCart: $
|
|
8114
|
-
}), L =
|
|
8114
|
+
}), L = Ta({
|
|
8115
8115
|
bcCart: $,
|
|
8116
8116
|
cartItems: V,
|
|
8117
8117
|
onCheckoutInitiated: (C) => {
|
|
@@ -8172,7 +8172,7 @@ function ki({
|
|
|
8172
8172
|
]);
|
|
8173
8173
|
if (b === "upload" || b === "processing")
|
|
8174
8174
|
return /* @__PURE__ */ a("div", { className: `flex h-full ${t}`, children: /* @__PURE__ */ a(
|
|
8175
|
-
|
|
8175
|
+
wa,
|
|
8176
8176
|
{
|
|
8177
8177
|
onFileUpload: Oe,
|
|
8178
8178
|
onSkip: X,
|
|
@@ -8229,7 +8229,7 @@ function ki({
|
|
|
8229
8229
|
}
|
|
8230
8230
|
) });
|
|
8231
8231
|
}
|
|
8232
|
-
function
|
|
8232
|
+
function Ji({
|
|
8233
8233
|
takeshape: t,
|
|
8234
8234
|
bigcommerce: e,
|
|
8235
8235
|
agentName: r = He,
|
|
@@ -8248,7 +8248,7 @@ function Ki({
|
|
|
8248
8248
|
[e.endpoint, e.storefrontToken, e.channelId]
|
|
8249
8249
|
);
|
|
8250
8250
|
return /* @__PURE__ */ a(
|
|
8251
|
-
|
|
8251
|
+
Ei,
|
|
8252
8252
|
{
|
|
8253
8253
|
agentName: r,
|
|
8254
8254
|
inputName: n,
|
|
@@ -8270,14 +8270,14 @@ function Ki({
|
|
|
8270
8270
|
);
|
|
8271
8271
|
}
|
|
8272
8272
|
export {
|
|
8273
|
-
|
|
8274
|
-
|
|
8273
|
+
Ji as P,
|
|
8274
|
+
Qi as S,
|
|
8275
8275
|
Tn as a,
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8276
|
+
Hi as b,
|
|
8277
|
+
ni as c,
|
|
8278
|
+
Ei as d,
|
|
8279
|
+
Gi as i,
|
|
8280
|
+
zi as r,
|
|
8281
|
+
Ki as s
|
|
8282
8282
|
};
|
|
8283
|
-
//# sourceMappingURL=purchase-order-chat-wrapper-
|
|
8283
|
+
//# sourceMappingURL=purchase-order-chat-wrapper-fadhXbv8.js.map
|