@takeshape/purchase-order-chat 1.59.0 → 1.59.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 +1 -1
- package/dist/{purchase-order-chat-wrapper-s-B-vEE8.js → purchase-order-chat-wrapper-Dd9F3Vhd.js} +753 -736
- package/dist/purchase-order-chat-wrapper-Dd9F3Vhd.js.map +1 -0
- package/dist/shadow.js +2 -2
- package/dist/tailwind.js +1 -1
- package/package.json +3 -3
- package/dist/purchase-order-chat-wrapper-s-B-vEE8.js.map +0 -1
package/dist/{purchase-order-chat-wrapper-s-B-vEE8.js → purchase-order-chat-wrapper-Dd9F3Vhd.js}
RENAMED
|
@@ -1,48 +1,62 @@
|
|
|
1
|
-
import { useState as L, useEffect as F, createElement as
|
|
1
|
+
import { useState as L, useEffect as F, createElement as Br, useRef as D, useLayoutEffect as xt, useCallback as B, createContext as Mr, useContext as Fr, useMemo as oe, forwardRef as Or, useImperativeHandle as Lr } from "react";
|
|
2
2
|
import { jsxs as p, jsx as a, Fragment as ve } from "react/jsx-runtime";
|
|
3
|
-
import { GraphQLClient as
|
|
4
|
-
import { initGraphQLTada as
|
|
5
|
-
import { useChat as
|
|
6
|
-
import { useQuery as
|
|
7
|
-
import { parseJsonEventStream as
|
|
8
|
-
import { create as
|
|
9
|
-
import { clsx as
|
|
10
|
-
import { twMerge as
|
|
11
|
-
import { devtools as
|
|
12
|
-
import { Streamdown as
|
|
13
|
-
import { z as
|
|
14
|
-
import { get as
|
|
15
|
-
import
|
|
16
|
-
function
|
|
17
|
-
return Vr(
|
|
18
|
-
}
|
|
19
|
-
function
|
|
3
|
+
import { GraphQLClient as at, ClientError as Rr } from "graphql-request";
|
|
4
|
+
import { initGraphQLTada as Vt, readFragment as Ne } from "gql.tada";
|
|
5
|
+
import { useChat as zt } from "@ai-sdk/react";
|
|
6
|
+
import { useQuery as Dr, QueryClientProvider as _r, QueryClient as Ur } from "@tanstack/react-query";
|
|
7
|
+
import { parseJsonEventStream as qr, uiMessageChunkSchema as jr, DefaultChatTransport as Qt, isToolUIPart as Wr } from "ai";
|
|
8
|
+
import { create as it } from "zustand";
|
|
9
|
+
import { clsx as Vr } from "clsx";
|
|
10
|
+
import { twMerge as zr } from "tailwind-merge";
|
|
11
|
+
import { devtools as Qr, persist as Gt } from "zustand/middleware";
|
|
12
|
+
import { Streamdown as Qe } from "streamdown";
|
|
13
|
+
import { z as bt } from "zod";
|
|
14
|
+
import { get as Ze } from "lodash";
|
|
15
|
+
import Gr from "p-map";
|
|
16
|
+
function Ee(...t) {
|
|
17
|
+
return zr(Vr(t));
|
|
18
|
+
}
|
|
19
|
+
function Oi(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
|
|
26
|
-
const [e, r] = L(() =>
|
|
25
|
+
const Hr = "__vite_c_css_pos_initial_e2ca095638db45a6b54eed7af1490e3e", vt = "__vite_c_css_pos_update_e2ca095638db45a6b54eed7af1490e3e", Ct = () => typeof window < "u" ? window[Hr] : void 0, Li = (t) => {
|
|
26
|
+
const [e, r] = L(() => Ct() || /* @__PURE__ */ new Map()), [n, i] = L(0);
|
|
27
27
|
return F(() => {
|
|
28
28
|
const s = (o) => {
|
|
29
|
-
const l =
|
|
29
|
+
const l = Ct() || /* @__PURE__ */ new Map();
|
|
30
30
|
r(l), i((c) => c + 1), t.onChange?.(l);
|
|
31
31
|
};
|
|
32
|
-
return window.addEventListener(
|
|
33
|
-
window.removeEventListener(
|
|
32
|
+
return window.addEventListener(vt, s), s(), () => {
|
|
33
|
+
window.removeEventListener(vt, s);
|
|
34
34
|
};
|
|
35
35
|
}, [t.onChange]), Array.from(e?.keys() || []).map((s) => {
|
|
36
36
|
const o = e.get(s);
|
|
37
|
-
return o ? /* @__PURE__ */
|
|
37
|
+
return o ? /* @__PURE__ */ Br("style", { ...o.attributes, key: `${s}-${n}` }, o.css) : null;
|
|
38
38
|
});
|
|
39
|
-
},
|
|
39
|
+
}, Ge = "bigcommercePurchaseOrderAgent", It = "https://api.takeshape.io", Ht = "https://api-b2b.bigcommerce.com/graphql", Kr = "dl7c39mdpul6hyc489yk0vzxl6jesyx", ot = "[client is providing tool response]", be = "__po_address__", Se = "__po_billing_address__", he = "__checkout_address__", lt = "purchase-order-chat-session", Kt = 3;
|
|
40
|
+
function Jr() {
|
|
41
|
+
if (typeof document < "u")
|
|
42
|
+
try {
|
|
43
|
+
const t = document.createElement("iframe");
|
|
44
|
+
t.style.display = "none", document.head.appendChild(t);
|
|
45
|
+
const e = t.contentWindow?.fetch;
|
|
46
|
+
if (e)
|
|
47
|
+
return e.bind(t.contentWindow);
|
|
48
|
+
document.head.removeChild(t);
|
|
49
|
+
} catch {
|
|
50
|
+
}
|
|
51
|
+
return fetch;
|
|
52
|
+
}
|
|
53
|
+
const Yr = Jr(), ke = Yr, Ce = Vt(), ct = Ce(`
|
|
40
54
|
fragment UserAuthorizationFragment on UserAuthorization {
|
|
41
55
|
result {
|
|
42
56
|
token
|
|
43
57
|
}
|
|
44
58
|
}
|
|
45
|
-
`),
|
|
59
|
+
`), Jt = Ce(
|
|
46
60
|
`
|
|
47
61
|
mutation Authorization($authData: UserAuthType!) {
|
|
48
62
|
authorization(authData: $authData) {
|
|
@@ -50,14 +64,14 @@ const Gr = "__vite_c_css_pos_initial_f439532678134e5d8e15eb785e1fe208", bt = "__
|
|
|
50
64
|
}
|
|
51
65
|
}
|
|
52
66
|
`,
|
|
53
|
-
[
|
|
54
|
-
),
|
|
67
|
+
[ct]
|
|
68
|
+
), Yt = Ce(`
|
|
55
69
|
fragment UserFragment on UserType {
|
|
56
70
|
companyInfo {
|
|
57
71
|
companyId
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
|
-
`),
|
|
74
|
+
`), Xr = Ce(
|
|
61
75
|
`
|
|
62
76
|
query CurrentUser {
|
|
63
77
|
currentUser {
|
|
@@ -65,8 +79,8 @@ const Gr = "__vite_c_css_pos_initial_f439532678134e5d8e15eb785e1fe208", bt = "__
|
|
|
65
79
|
}
|
|
66
80
|
}
|
|
67
81
|
`,
|
|
68
|
-
[
|
|
69
|
-
),
|
|
82
|
+
[Yt]
|
|
83
|
+
), Xt = Ce(`
|
|
70
84
|
fragment CompanyAddressFragment on AddressType {
|
|
71
85
|
id
|
|
72
86
|
firstName
|
|
@@ -86,7 +100,7 @@ const Gr = "__vite_c_css_pos_initial_f439532678134e5d8e15eb785e1fe208", bt = "__
|
|
|
86
100
|
isBilling
|
|
87
101
|
label
|
|
88
102
|
}
|
|
89
|
-
`),
|
|
103
|
+
`), Zr = Ce(
|
|
90
104
|
`
|
|
91
105
|
query CompanyAddressesQuery(
|
|
92
106
|
$companyId: Int!
|
|
@@ -107,14 +121,14 @@ const Gr = "__vite_c_css_pos_initial_f439532678134e5d8e15eb785e1fe208", bt = "__
|
|
|
107
121
|
}
|
|
108
122
|
}
|
|
109
123
|
`,
|
|
110
|
-
[
|
|
124
|
+
[Xt]
|
|
111
125
|
);
|
|
112
126
|
Ce(`
|
|
113
127
|
fragment CheckoutResultFragment on CheckoutLoginResultType {
|
|
114
128
|
redirectUrl
|
|
115
129
|
}
|
|
116
130
|
`);
|
|
117
|
-
const
|
|
131
|
+
const en = Ce(
|
|
118
132
|
`
|
|
119
133
|
mutation CheckoutLoginMutation(
|
|
120
134
|
$cartData: CheckoutLoginType!
|
|
@@ -126,7 +140,7 @@ const Yr = Ce(
|
|
|
126
140
|
}
|
|
127
141
|
}
|
|
128
142
|
`
|
|
129
|
-
), q =
|
|
143
|
+
), q = Vt(), $e = q(`
|
|
130
144
|
fragment CartFields on Cart {
|
|
131
145
|
id
|
|
132
146
|
entityId
|
|
@@ -201,7 +215,7 @@ const Yr = Ce(
|
|
|
201
215
|
utc
|
|
202
216
|
}
|
|
203
217
|
}
|
|
204
|
-
`),
|
|
218
|
+
`), tn = q(
|
|
205
219
|
`
|
|
206
220
|
query GetCart($cartEntityId: String) {
|
|
207
221
|
site {
|
|
@@ -211,8 +225,8 @@ const Yr = Ce(
|
|
|
211
225
|
}
|
|
212
226
|
}
|
|
213
227
|
`,
|
|
214
|
-
[
|
|
215
|
-
),
|
|
228
|
+
[$e]
|
|
229
|
+
), rn = q(
|
|
216
230
|
`
|
|
217
231
|
mutation CreateCart($input: CreateCartInput!) {
|
|
218
232
|
cart {
|
|
@@ -224,8 +238,8 @@ const Yr = Ce(
|
|
|
224
238
|
}
|
|
225
239
|
}
|
|
226
240
|
`,
|
|
227
|
-
[
|
|
228
|
-
),
|
|
241
|
+
[$e]
|
|
242
|
+
), nn = q(
|
|
229
243
|
`
|
|
230
244
|
mutation AddCartLineItems($input: AddCartLineItemsInput!) {
|
|
231
245
|
cart {
|
|
@@ -237,8 +251,8 @@ const Yr = Ce(
|
|
|
237
251
|
}
|
|
238
252
|
}
|
|
239
253
|
`,
|
|
240
|
-
[
|
|
241
|
-
),
|
|
254
|
+
[$e]
|
|
255
|
+
), sn = q(
|
|
242
256
|
`
|
|
243
257
|
mutation UpdateCartLineItem($input: UpdateCartLineItemInput!) {
|
|
244
258
|
cart {
|
|
@@ -250,8 +264,8 @@ const Yr = Ce(
|
|
|
250
264
|
}
|
|
251
265
|
}
|
|
252
266
|
`,
|
|
253
|
-
[
|
|
254
|
-
),
|
|
267
|
+
[$e]
|
|
268
|
+
), an = q(
|
|
255
269
|
`
|
|
256
270
|
mutation DeleteCartLineItem($input: DeleteCartLineItemInput!) {
|
|
257
271
|
cart {
|
|
@@ -263,8 +277,8 @@ const Yr = Ce(
|
|
|
263
277
|
}
|
|
264
278
|
}
|
|
265
279
|
`,
|
|
266
|
-
[
|
|
267
|
-
),
|
|
280
|
+
[$e]
|
|
281
|
+
), on = q(`
|
|
268
282
|
mutation DeleteCart($input: DeleteCartInput!) {
|
|
269
283
|
cart {
|
|
270
284
|
deleteCart(input: $input) {
|
|
@@ -272,7 +286,7 @@ const Yr = Ce(
|
|
|
272
286
|
}
|
|
273
287
|
}
|
|
274
288
|
}
|
|
275
|
-
`),
|
|
289
|
+
`), ln = q(`
|
|
276
290
|
mutation CreateCartRedirectUrls($input: CreateCartRedirectUrlsInput) {
|
|
277
291
|
cart {
|
|
278
292
|
createCartRedirectUrls(input: $input) {
|
|
@@ -282,7 +296,7 @@ const Yr = Ce(
|
|
|
282
296
|
}
|
|
283
297
|
}
|
|
284
298
|
}
|
|
285
|
-
`),
|
|
299
|
+
`), cn = q(`
|
|
286
300
|
mutation CreateCartMetafield($input: CreateCartMetafieldInput!) {
|
|
287
301
|
cart {
|
|
288
302
|
createCartMetafield(input: $input) {
|
|
@@ -293,7 +307,7 @@ const Yr = Ce(
|
|
|
293
307
|
}
|
|
294
308
|
}
|
|
295
309
|
}
|
|
296
|
-
`),
|
|
310
|
+
`), Be = q(`
|
|
297
311
|
fragment CheckoutFields on Checkout {
|
|
298
312
|
entityId
|
|
299
313
|
subtotal {
|
|
@@ -369,7 +383,7 @@ const Yr = Ce(
|
|
|
369
383
|
lineItemIds
|
|
370
384
|
}
|
|
371
385
|
}
|
|
372
|
-
`),
|
|
386
|
+
`), dn = q(
|
|
373
387
|
`
|
|
374
388
|
query GetCheckout($checkoutEntityId: String) {
|
|
375
389
|
site {
|
|
@@ -379,8 +393,8 @@ const Yr = Ce(
|
|
|
379
393
|
}
|
|
380
394
|
}
|
|
381
395
|
`,
|
|
382
|
-
[
|
|
383
|
-
),
|
|
396
|
+
[Be]
|
|
397
|
+
), un = q(
|
|
384
398
|
`
|
|
385
399
|
mutation AddCheckoutShippingConsignments($input: AddCheckoutShippingConsignmentsInput!) {
|
|
386
400
|
checkout {
|
|
@@ -392,8 +406,8 @@ const Yr = Ce(
|
|
|
392
406
|
}
|
|
393
407
|
}
|
|
394
408
|
`,
|
|
395
|
-
[
|
|
396
|
-
),
|
|
409
|
+
[Be]
|
|
410
|
+
), pn = q(
|
|
397
411
|
`
|
|
398
412
|
mutation AddCheckoutBillingAddressMutation($input: AddCheckoutBillingAddressInput!) {
|
|
399
413
|
checkout {
|
|
@@ -405,7 +419,7 @@ const Yr = Ce(
|
|
|
405
419
|
}
|
|
406
420
|
}
|
|
407
421
|
`,
|
|
408
|
-
[
|
|
422
|
+
[Be]
|
|
409
423
|
);
|
|
410
424
|
q(
|
|
411
425
|
`
|
|
@@ -419,9 +433,9 @@ q(
|
|
|
419
433
|
}
|
|
420
434
|
}
|
|
421
435
|
`,
|
|
422
|
-
[
|
|
436
|
+
[Be]
|
|
423
437
|
);
|
|
424
|
-
const
|
|
438
|
+
const hn = q(
|
|
425
439
|
`
|
|
426
440
|
mutation UpdateCheckoutCustomerMessage($input: UpdateCheckoutCustomerMessageInput!) {
|
|
427
441
|
checkout {
|
|
@@ -433,8 +447,8 @@ const dn = q(
|
|
|
433
447
|
}
|
|
434
448
|
}
|
|
435
449
|
`,
|
|
436
|
-
[
|
|
437
|
-
),
|
|
450
|
+
[Be]
|
|
451
|
+
), fn = q(`
|
|
438
452
|
query GetProductVariantDetails($entityIds: [Int!], $first: Int = 50) {
|
|
439
453
|
site {
|
|
440
454
|
products(entityIds: $entityIds) {
|
|
@@ -520,7 +534,7 @@ const dn = q(
|
|
|
520
534
|
}
|
|
521
535
|
}
|
|
522
536
|
}
|
|
523
|
-
`),
|
|
537
|
+
`), mn = q(`
|
|
524
538
|
query GetProductsForDisplay($entityIds: [Int!], $first: Int = 50) {
|
|
525
539
|
site {
|
|
526
540
|
products(entityIds: $entityIds) {
|
|
@@ -567,7 +581,7 @@ const dn = q(
|
|
|
567
581
|
}
|
|
568
582
|
}
|
|
569
583
|
}
|
|
570
|
-
`),
|
|
584
|
+
`), gn = q(`
|
|
571
585
|
query GetProductVariantsForDisplayPage($entityId: Int!, $first: Int = 50, $after: String!) {
|
|
572
586
|
site {
|
|
573
587
|
product(entityId: $entityId) {
|
|
@@ -603,7 +617,7 @@ const dn = q(
|
|
|
603
617
|
}
|
|
604
618
|
}
|
|
605
619
|
}
|
|
606
|
-
`),
|
|
620
|
+
`), Zt = q(`
|
|
607
621
|
fragment CustomerAddressFields on CustomerAddress {
|
|
608
622
|
entityId
|
|
609
623
|
firstName
|
|
@@ -617,7 +631,7 @@ const dn = q(
|
|
|
617
631
|
country
|
|
618
632
|
phone
|
|
619
633
|
}
|
|
620
|
-
`),
|
|
634
|
+
`), wt = q(
|
|
621
635
|
`
|
|
622
636
|
query GetCustomerAddresses($first: Int = 50, $after: String) {
|
|
623
637
|
customer {
|
|
@@ -639,8 +653,8 @@ const dn = q(
|
|
|
639
653
|
}
|
|
640
654
|
}
|
|
641
655
|
`,
|
|
642
|
-
[
|
|
643
|
-
),
|
|
656
|
+
[Zt]
|
|
657
|
+
), yn = q(`
|
|
644
658
|
query GetProductVariantsPage($entityId: Int!, $first: Int = 50, $after: String!) {
|
|
645
659
|
site {
|
|
646
660
|
product(entityId: $entityId) {
|
|
@@ -691,7 +705,7 @@ const dn = q(
|
|
|
691
705
|
}
|
|
692
706
|
}
|
|
693
707
|
}
|
|
694
|
-
`),
|
|
708
|
+
`), xn = q(`
|
|
695
709
|
query GetProductOptionsPage($entityId: Int!, $first: Int = 50, $after: String!) {
|
|
696
710
|
site {
|
|
697
711
|
product(entityId: $entityId) {
|
|
@@ -728,7 +742,7 @@ const dn = q(
|
|
|
728
742
|
}
|
|
729
743
|
}
|
|
730
744
|
}
|
|
731
|
-
`),
|
|
745
|
+
`), bn = q(`
|
|
732
746
|
query GetProductPaths($entityIds: [Int!]) {
|
|
733
747
|
site {
|
|
734
748
|
products(entityIds: $entityIds) {
|
|
@@ -741,7 +755,7 @@ const dn = q(
|
|
|
741
755
|
}
|
|
742
756
|
}
|
|
743
757
|
}
|
|
744
|
-
`),
|
|
758
|
+
`), vn = q(`
|
|
745
759
|
query GetProductOptionValuesPage($entityId: Int!, $optionEntityId: Int!, $first: Int = 50, $after: String!) {
|
|
746
760
|
site {
|
|
747
761
|
product(entityId: $entityId) {
|
|
@@ -784,8 +798,8 @@ q(`
|
|
|
784
798
|
}
|
|
785
799
|
}
|
|
786
800
|
`);
|
|
787
|
-
function
|
|
788
|
-
const e = Ne(
|
|
801
|
+
function Cn(t) {
|
|
802
|
+
const e = Ne(Xt, t);
|
|
789
803
|
return {
|
|
790
804
|
source: "b2b",
|
|
791
805
|
id: `${e.id}`,
|
|
@@ -806,8 +820,8 @@ function xn(t) {
|
|
|
806
820
|
label: e.label || void 0
|
|
807
821
|
};
|
|
808
822
|
}
|
|
809
|
-
function
|
|
810
|
-
const r = Ne(
|
|
823
|
+
function In(t, e = 0) {
|
|
824
|
+
const r = Ne(Zt, t);
|
|
811
825
|
return {
|
|
812
826
|
source: "storefront",
|
|
813
827
|
id: `${r.entityId}`,
|
|
@@ -829,7 +843,7 @@ function bn(t, e = 0) {
|
|
|
829
843
|
isDefaultBilling: e === 0
|
|
830
844
|
};
|
|
831
845
|
}
|
|
832
|
-
function
|
|
846
|
+
function We(t, e) {
|
|
833
847
|
return {
|
|
834
848
|
source: "po",
|
|
835
849
|
id: e.id,
|
|
@@ -849,11 +863,11 @@ function je(t, e) {
|
|
|
849
863
|
label: "PO Address"
|
|
850
864
|
};
|
|
851
865
|
}
|
|
852
|
-
const
|
|
853
|
-
async function
|
|
866
|
+
const wn = 20;
|
|
867
|
+
async function Le(t, e, r, n) {
|
|
854
868
|
const i = [];
|
|
855
869
|
let s, o = 0;
|
|
856
|
-
for (; o <
|
|
870
|
+
for (; o < wn; ) {
|
|
857
871
|
const l = s !== void 0 ? { ...r, after: s } : { ...r }, c = await t.request({
|
|
858
872
|
document: e,
|
|
859
873
|
variables: l
|
|
@@ -865,16 +879,16 @@ async function Oe(t, e, r, n) {
|
|
|
865
879
|
return i;
|
|
866
880
|
}
|
|
867
881
|
const xe = 20;
|
|
868
|
-
function
|
|
869
|
-
return Ne(Ae, t);
|
|
870
|
-
}
|
|
871
|
-
function We(t) {
|
|
882
|
+
function Re(t) {
|
|
872
883
|
return Ne($e, t);
|
|
873
884
|
}
|
|
874
|
-
function
|
|
885
|
+
function Ve(t) {
|
|
886
|
+
return Ne(Be, t);
|
|
887
|
+
}
|
|
888
|
+
function Sn(t) {
|
|
875
889
|
return t.startsWith("http://") || t.startsWith("https://") ? t : typeof window < "u" && window.location?.origin ? `${window.location.origin}${t.startsWith("/") ? "" : "/"}${t}` : t;
|
|
876
890
|
}
|
|
877
|
-
class
|
|
891
|
+
class Nn {
|
|
878
892
|
endpoint;
|
|
879
893
|
storefrontToken;
|
|
880
894
|
graphQLClient;
|
|
@@ -883,12 +897,13 @@ class In {
|
|
|
883
897
|
requestQueue = [];
|
|
884
898
|
channelId;
|
|
885
899
|
constructor(e) {
|
|
886
|
-
this.endpoint =
|
|
900
|
+
this.endpoint = Sn(e.endpoint), this.storefrontToken = e.storefrontToken, this.channelId = e.channelId ?? 1;
|
|
887
901
|
const r = {
|
|
888
902
|
"content-type": "application/json",
|
|
889
903
|
accept: "application/json"
|
|
890
904
|
};
|
|
891
|
-
this.storefrontToken && (r.authorization = `Bearer ${this.storefrontToken}`), this.graphQLClient = new
|
|
905
|
+
this.storefrontToken && (r.authorization = `Bearer ${this.storefrontToken}`), this.graphQLClient = new at(this.endpoint, {
|
|
906
|
+
fetch: ke,
|
|
892
907
|
credentials: "same-origin",
|
|
893
908
|
headers: r
|
|
894
909
|
});
|
|
@@ -921,7 +936,7 @@ class In {
|
|
|
921
936
|
* These are errors like "out of stock", "invalid product", etc. that won't succeed on retry.
|
|
922
937
|
*/
|
|
923
938
|
isGraphQLBusinessError(e) {
|
|
924
|
-
return e instanceof
|
|
939
|
+
return e instanceof Rr && e.response.status === 200;
|
|
925
940
|
}
|
|
926
941
|
/**
|
|
927
942
|
* Extract a clean error message from a GraphQL error or generic error.
|
|
@@ -963,12 +978,12 @@ class In {
|
|
|
963
978
|
*/
|
|
964
979
|
async getCart(e) {
|
|
965
980
|
const n = (await this.request({
|
|
966
|
-
document:
|
|
981
|
+
document: tn,
|
|
967
982
|
variables: {
|
|
968
983
|
cartEntityId: e
|
|
969
984
|
}
|
|
970
985
|
})).site.cart;
|
|
971
|
-
return n ?
|
|
986
|
+
return n ? Re(n) : null;
|
|
972
987
|
}
|
|
973
988
|
/**
|
|
974
989
|
* Create a new cart with line items
|
|
@@ -1027,7 +1042,7 @@ class In {
|
|
|
1027
1042
|
async addBatchToCart(e, r, { retry: n = !0 } = {}) {
|
|
1028
1043
|
const s = (await this.request(
|
|
1029
1044
|
{
|
|
1030
|
-
document:
|
|
1045
|
+
document: nn,
|
|
1031
1046
|
variables: {
|
|
1032
1047
|
input: {
|
|
1033
1048
|
cartEntityId: e,
|
|
@@ -1043,7 +1058,7 @@ class In {
|
|
|
1043
1058
|
},
|
|
1044
1059
|
{ retry: n }
|
|
1045
1060
|
)).cart.addCartLineItems?.cart;
|
|
1046
|
-
return s ?
|
|
1061
|
+
return s ? Re(s) : null;
|
|
1047
1062
|
}
|
|
1048
1063
|
/**
|
|
1049
1064
|
* Try to add a batch to cart, isolating failures if needed.
|
|
@@ -1081,7 +1096,7 @@ class In {
|
|
|
1081
1096
|
async createCartBatch(e, { retry: r = !0 } = {}) {
|
|
1082
1097
|
const i = (await this.request(
|
|
1083
1098
|
{
|
|
1084
|
-
document:
|
|
1099
|
+
document: rn,
|
|
1085
1100
|
variables: {
|
|
1086
1101
|
input: {
|
|
1087
1102
|
lineItems: e.map((s) => ({
|
|
@@ -1094,7 +1109,7 @@ class In {
|
|
|
1094
1109
|
},
|
|
1095
1110
|
{ retry: r }
|
|
1096
1111
|
)).cart.createCart?.cart;
|
|
1097
|
-
return i ?
|
|
1112
|
+
return i ? Re(i) : null;
|
|
1098
1113
|
}
|
|
1099
1114
|
/**
|
|
1100
1115
|
* Try to create a cart with a batch, isolating failures if needed.
|
|
@@ -1161,7 +1176,7 @@ class In {
|
|
|
1161
1176
|
*/
|
|
1162
1177
|
async updateCartLineItem(e, r, n, i, s) {
|
|
1163
1178
|
const l = (await this.request({
|
|
1164
|
-
document:
|
|
1179
|
+
document: sn,
|
|
1165
1180
|
variables: {
|
|
1166
1181
|
input: {
|
|
1167
1182
|
cartEntityId: e,
|
|
@@ -1176,14 +1191,14 @@ class In {
|
|
|
1176
1191
|
}
|
|
1177
1192
|
}
|
|
1178
1193
|
})).cart.updateCartLineItem?.cart;
|
|
1179
|
-
return l ?
|
|
1194
|
+
return l ? Re(l) : null;
|
|
1180
1195
|
}
|
|
1181
1196
|
/**
|
|
1182
1197
|
* Remove a line item from the cart
|
|
1183
1198
|
*/
|
|
1184
1199
|
async deleteCartLineItem(e, r) {
|
|
1185
1200
|
const i = (await this.request({
|
|
1186
|
-
document:
|
|
1201
|
+
document: an,
|
|
1187
1202
|
variables: {
|
|
1188
1203
|
input: {
|
|
1189
1204
|
cartEntityId: e,
|
|
@@ -1191,14 +1206,14 @@ class In {
|
|
|
1191
1206
|
}
|
|
1192
1207
|
}
|
|
1193
1208
|
})).cart.deleteCartLineItem?.cart;
|
|
1194
|
-
return i ?
|
|
1209
|
+
return i ? Re(i) : null;
|
|
1195
1210
|
}
|
|
1196
1211
|
/**
|
|
1197
1212
|
* Delete an entire cart
|
|
1198
1213
|
*/
|
|
1199
1214
|
async deleteCart(e) {
|
|
1200
1215
|
return (await this.request({
|
|
1201
|
-
document:
|
|
1216
|
+
document: on,
|
|
1202
1217
|
variables: {
|
|
1203
1218
|
input: {
|
|
1204
1219
|
cartEntityId: e
|
|
@@ -1220,7 +1235,7 @@ class In {
|
|
|
1220
1235
|
*/
|
|
1221
1236
|
async createCartRedirectUrls(e) {
|
|
1222
1237
|
return (await this.request({
|
|
1223
|
-
document:
|
|
1238
|
+
document: ln,
|
|
1224
1239
|
variables: {
|
|
1225
1240
|
input: {
|
|
1226
1241
|
cartEntityId: e
|
|
@@ -1233,7 +1248,7 @@ class In {
|
|
|
1233
1248
|
*/
|
|
1234
1249
|
async createCartMetafield(e, r, n) {
|
|
1235
1250
|
await this.executeWithRetry({
|
|
1236
|
-
document:
|
|
1251
|
+
document: cn,
|
|
1237
1252
|
variables: {
|
|
1238
1253
|
input: {
|
|
1239
1254
|
cartEntityId: e,
|
|
@@ -1251,12 +1266,12 @@ class In {
|
|
|
1251
1266
|
*/
|
|
1252
1267
|
async getCheckout(e) {
|
|
1253
1268
|
const n = (await this.request({
|
|
1254
|
-
document:
|
|
1269
|
+
document: dn,
|
|
1255
1270
|
variables: {
|
|
1256
1271
|
checkoutEntityId: e
|
|
1257
1272
|
}
|
|
1258
1273
|
})).site.checkout;
|
|
1259
|
-
return n ?
|
|
1274
|
+
return n ? Ve(n) : null;
|
|
1260
1275
|
}
|
|
1261
1276
|
/**
|
|
1262
1277
|
* Add shipping consignments (addresses) to a checkout
|
|
@@ -1264,7 +1279,7 @@ class In {
|
|
|
1264
1279
|
*/
|
|
1265
1280
|
async setCheckoutShippingAddress(e, r, n) {
|
|
1266
1281
|
const s = (await this.request({
|
|
1267
|
-
document:
|
|
1282
|
+
document: un,
|
|
1268
1283
|
variables: {
|
|
1269
1284
|
input: {
|
|
1270
1285
|
checkoutEntityId: e,
|
|
@@ -1279,7 +1294,7 @@ class In {
|
|
|
1279
1294
|
}
|
|
1280
1295
|
}
|
|
1281
1296
|
})).checkout.addCheckoutShippingConsignments?.checkout;
|
|
1282
|
-
return s ?
|
|
1297
|
+
return s ? Ve(s) : null;
|
|
1283
1298
|
}
|
|
1284
1299
|
/**
|
|
1285
1300
|
* Add shipping consignments (addresses) to a checkout
|
|
@@ -1287,7 +1302,7 @@ class In {
|
|
|
1287
1302
|
*/
|
|
1288
1303
|
async setCheckoutBillingAddress(e, r) {
|
|
1289
1304
|
const i = (await this.request({
|
|
1290
|
-
document:
|
|
1305
|
+
document: pn,
|
|
1291
1306
|
variables: {
|
|
1292
1307
|
input: {
|
|
1293
1308
|
checkoutEntityId: e,
|
|
@@ -1297,7 +1312,7 @@ class In {
|
|
|
1297
1312
|
}
|
|
1298
1313
|
}
|
|
1299
1314
|
})).checkout.addCheckoutBillingAddress?.checkout;
|
|
1300
|
-
return i ?
|
|
1315
|
+
return i ? Ve(i) : null;
|
|
1301
1316
|
}
|
|
1302
1317
|
/**
|
|
1303
1318
|
* Get customer's saved addresses and customer info
|
|
@@ -1306,7 +1321,7 @@ class In {
|
|
|
1306
1321
|
*/
|
|
1307
1322
|
async getCustomerAddresses() {
|
|
1308
1323
|
const e = await this.request({
|
|
1309
|
-
document:
|
|
1324
|
+
document: wt
|
|
1310
1325
|
});
|
|
1311
1326
|
if (!e.customer)
|
|
1312
1327
|
return {
|
|
@@ -1320,16 +1335,16 @@ class In {
|
|
|
1320
1335
|
email: e.customer.email
|
|
1321
1336
|
}, n = [...e.customer.addresses.edges ?? []];
|
|
1322
1337
|
if (e.customer.addresses.pageInfo.hasNextPage) {
|
|
1323
|
-
const s = await
|
|
1338
|
+
const s = await Le(
|
|
1324
1339
|
this,
|
|
1325
|
-
|
|
1340
|
+
wt,
|
|
1326
1341
|
{ after: e.customer.addresses.pageInfo.endCursor },
|
|
1327
1342
|
(o) => o.customer?.addresses ?? null
|
|
1328
1343
|
);
|
|
1329
1344
|
n.push(...s);
|
|
1330
1345
|
}
|
|
1331
1346
|
const i = n.map(
|
|
1332
|
-
(s, o) =>
|
|
1347
|
+
(s, o) => In(s.node, o)
|
|
1333
1348
|
);
|
|
1334
1349
|
return {
|
|
1335
1350
|
customerInfo: r,
|
|
@@ -1345,7 +1360,7 @@ class In {
|
|
|
1345
1360
|
r.purchaseOrderNumber && (n += `PO Number: ${r.purchaseOrderNumber}, `), r.threadId && (n && (n += `
|
|
1346
1361
|
`), n += `Thread ID: ${r.threadId}`);
|
|
1347
1362
|
const s = (await this.request({
|
|
1348
|
-
document:
|
|
1363
|
+
document: hn,
|
|
1349
1364
|
variables: {
|
|
1350
1365
|
input: {
|
|
1351
1366
|
checkoutEntityId: e,
|
|
@@ -1355,7 +1370,7 @@ class In {
|
|
|
1355
1370
|
}
|
|
1356
1371
|
}
|
|
1357
1372
|
})).checkout.updateCheckoutCustomerMessage?.checkout;
|
|
1358
|
-
return s ?
|
|
1373
|
+
return s ? Ve(s) : null;
|
|
1359
1374
|
}
|
|
1360
1375
|
/**
|
|
1361
1376
|
* Get product variant details for multiple products
|
|
@@ -1364,7 +1379,7 @@ class In {
|
|
|
1364
1379
|
*/
|
|
1365
1380
|
async getProductVariantDetails(e) {
|
|
1366
1381
|
const r = await this.request({
|
|
1367
|
-
document:
|
|
1382
|
+
document: fn,
|
|
1368
1383
|
variables: {
|
|
1369
1384
|
entityIds: e
|
|
1370
1385
|
}
|
|
@@ -1372,9 +1387,9 @@ class In {
|
|
|
1372
1387
|
for (const i of r.site.products.edges ?? []) {
|
|
1373
1388
|
const s = i.node, o = [...s.variants.edges ?? []];
|
|
1374
1389
|
if (s.variants.pageInfo.hasNextPage) {
|
|
1375
|
-
const d = await
|
|
1390
|
+
const d = await Le(
|
|
1376
1391
|
this,
|
|
1377
|
-
|
|
1392
|
+
yn,
|
|
1378
1393
|
{
|
|
1379
1394
|
entityId: s.entityId,
|
|
1380
1395
|
after: s.variants.pageInfo.endCursor
|
|
@@ -1385,9 +1400,9 @@ class In {
|
|
|
1385
1400
|
}
|
|
1386
1401
|
const l = [...s.productOptions.edges ?? []];
|
|
1387
1402
|
if (s.productOptions.pageInfo.hasNextPage) {
|
|
1388
|
-
const d = await
|
|
1403
|
+
const d = await Le(
|
|
1389
1404
|
this,
|
|
1390
|
-
|
|
1405
|
+
xn,
|
|
1391
1406
|
{
|
|
1392
1407
|
entityId: s.entityId,
|
|
1393
1408
|
after: s.productOptions.pageInfo.endCursor
|
|
@@ -1400,9 +1415,9 @@ class In {
|
|
|
1400
1415
|
for (const d of l) {
|
|
1401
1416
|
const f = d.node;
|
|
1402
1417
|
if (f.values?.pageInfo.hasNextPage && f.values.pageInfo.endCursor) {
|
|
1403
|
-
const u = await
|
|
1418
|
+
const u = await Le(
|
|
1404
1419
|
this,
|
|
1405
|
-
|
|
1420
|
+
vn,
|
|
1406
1421
|
{
|
|
1407
1422
|
entityId: s.entityId,
|
|
1408
1423
|
optionEntityId: f.entityId,
|
|
@@ -1464,7 +1479,7 @@ class In {
|
|
|
1464
1479
|
*/
|
|
1465
1480
|
async getProductPaths(e) {
|
|
1466
1481
|
const r = await this.request({
|
|
1467
|
-
document:
|
|
1482
|
+
document: bn,
|
|
1468
1483
|
variables: {
|
|
1469
1484
|
entityIds: e
|
|
1470
1485
|
}
|
|
@@ -1479,7 +1494,7 @@ class In {
|
|
|
1479
1494
|
*/
|
|
1480
1495
|
async getProductsForDisplay(e) {
|
|
1481
1496
|
const r = await this.request({
|
|
1482
|
-
document:
|
|
1497
|
+
document: mn,
|
|
1483
1498
|
variables: {
|
|
1484
1499
|
entityIds: e
|
|
1485
1500
|
}
|
|
@@ -1487,9 +1502,9 @@ class In {
|
|
|
1487
1502
|
for (const i of r.site.products.edges ?? []) {
|
|
1488
1503
|
const s = i.node, o = [...s.variants.edges ?? []];
|
|
1489
1504
|
if (s.variants.pageInfo.hasNextPage) {
|
|
1490
|
-
const l = await
|
|
1505
|
+
const l = await Le(
|
|
1491
1506
|
this,
|
|
1492
|
-
|
|
1507
|
+
gn,
|
|
1493
1508
|
{
|
|
1494
1509
|
entityId: s.entityId,
|
|
1495
1510
|
after: s.variants.pageInfo.endCursor
|
|
@@ -1517,33 +1532,33 @@ class In {
|
|
|
1517
1532
|
return n;
|
|
1518
1533
|
}
|
|
1519
1534
|
}
|
|
1520
|
-
function
|
|
1535
|
+
function Ri(t) {
|
|
1521
1536
|
return `https://store-${t}.mybigcommerce.com/graphql`;
|
|
1522
1537
|
}
|
|
1523
|
-
function
|
|
1524
|
-
return new
|
|
1538
|
+
function kn(t) {
|
|
1539
|
+
return new Nn(t);
|
|
1525
1540
|
}
|
|
1526
|
-
const
|
|
1541
|
+
const De = it((t) => ({
|
|
1527
1542
|
isExpanded: !1,
|
|
1528
1543
|
setExpanded: (e) => t({ isExpanded: e }),
|
|
1529
1544
|
toggleExpanded: () => t((e) => ({ isExpanded: !e.isExpanded })),
|
|
1530
1545
|
reset: () => t({ isExpanded: !1 })
|
|
1531
1546
|
}));
|
|
1532
|
-
function
|
|
1533
|
-
const e =
|
|
1547
|
+
function En({ children: t }) {
|
|
1548
|
+
const e = De((i) => i.isExpanded), r = De((i) => i.setExpanded), n = D(null);
|
|
1534
1549
|
return F(() => {
|
|
1535
1550
|
if (!e) return;
|
|
1536
1551
|
const i = (s) => {
|
|
1537
1552
|
s.key === "Escape" && r(!1);
|
|
1538
1553
|
};
|
|
1539
1554
|
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
1540
|
-
}, [e, r]),
|
|
1555
|
+
}, [e, r]), xt(() => {
|
|
1541
1556
|
if (!e) return;
|
|
1542
1557
|
const i = window.scrollY, s = document.body.style.overflow, o = document.body.style.position, l = document.body.style.top, c = document.body.style.width;
|
|
1543
1558
|
return document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${i}px`, document.body.style.width = "100%", () => {
|
|
1544
1559
|
document.body.style.overflow = s, document.body.style.position = o, document.body.style.top = l, document.body.style.width = c, window.scrollTo(0, i);
|
|
1545
1560
|
};
|
|
1546
|
-
}, [e]),
|
|
1561
|
+
}, [e]), xt(() => {
|
|
1547
1562
|
if (!e || !n.current) return;
|
|
1548
1563
|
const i = n.current.getRootNode();
|
|
1549
1564
|
if (!(i instanceof ShadowRoot)) return;
|
|
@@ -1579,7 +1594,7 @@ function Sn({ children: t }) {
|
|
|
1579
1594
|
}
|
|
1580
1595
|
) : null;
|
|
1581
1596
|
}
|
|
1582
|
-
const
|
|
1597
|
+
const er = {
|
|
1583
1598
|
"application/pdf": ".pdf",
|
|
1584
1599
|
"text/csv": ".csv",
|
|
1585
1600
|
"application/vnd.ms-excel": ".xls",
|
|
@@ -1590,9 +1605,9 @@ const Zt = {
|
|
|
1590
1605
|
"image/jpeg": ".jpg,.jpeg",
|
|
1591
1606
|
"image/gif": ".gif",
|
|
1592
1607
|
"image/webp": ".webp"
|
|
1593
|
-
},
|
|
1608
|
+
}, Pn = Object.keys(er), Tn = Object.values(er).flatMap(
|
|
1594
1609
|
(t) => t.split(",")
|
|
1595
|
-
),
|
|
1610
|
+
), An = [
|
|
1596
1611
|
".png",
|
|
1597
1612
|
".jpg",
|
|
1598
1613
|
".jpeg",
|
|
@@ -1605,30 +1620,30 @@ const Zt = {
|
|
|
1605
1620
|
".tif",
|
|
1606
1621
|
".svg",
|
|
1607
1622
|
".avif"
|
|
1608
|
-
],
|
|
1609
|
-
function
|
|
1610
|
-
if (t.size >
|
|
1623
|
+
], tr = Tn.join(","), $n = "PDF, Excel, CSV, text, or image files", Bn = "PNG, JPEG, GIF, or WebP", rr = ["PDF", "Excel", "CSV", "Images"], Mn = 10 * 1024 * 1024;
|
|
1624
|
+
function Fn(t) {
|
|
1625
|
+
if (t.size > Mn)
|
|
1611
1626
|
return {
|
|
1612
1627
|
valid: !1,
|
|
1613
1628
|
error: "File size exceeds 10MB limit. Please choose a smaller file."
|
|
1614
1629
|
};
|
|
1615
|
-
if (!
|
|
1630
|
+
if (!Pn.includes(t.type)) {
|
|
1616
1631
|
const e = t.name.includes(".") ? `.${t.name.split(".").pop()?.toLowerCase()}` : void 0;
|
|
1617
|
-
return t.type.startsWith("image/") || e &&
|
|
1632
|
+
return t.type.startsWith("image/") || e && An.includes(e) ? {
|
|
1618
1633
|
valid: !1,
|
|
1619
|
-
error: `Image type not supported. Please upload ${
|
|
1634
|
+
error: `Image type not supported. Please upload ${Bn} images.`
|
|
1620
1635
|
} : {
|
|
1621
1636
|
valid: !1,
|
|
1622
|
-
error: `File type not supported. Please upload ${
|
|
1637
|
+
error: `File type not supported. Please upload ${$n}.`
|
|
1623
1638
|
};
|
|
1624
1639
|
}
|
|
1625
1640
|
return { valid: !0 };
|
|
1626
1641
|
}
|
|
1627
|
-
function
|
|
1642
|
+
function nr({ onFile: t, onBeforeValidate: e }) {
|
|
1628
1643
|
const [r, n] = L(!1), [i, s] = L(null), o = D(null), l = D(null), c = B(
|
|
1629
1644
|
(x) => {
|
|
1630
1645
|
e?.(), s(null);
|
|
1631
|
-
const v =
|
|
1646
|
+
const v = Fn(x);
|
|
1632
1647
|
if (!v.valid) {
|
|
1633
1648
|
s(v.error ?? null);
|
|
1634
1649
|
return;
|
|
@@ -1673,7 +1688,7 @@ function rr({ onFile: t, onBeforeValidate: e }) {
|
|
|
1673
1688
|
openCamera: b
|
|
1674
1689
|
};
|
|
1675
1690
|
}
|
|
1676
|
-
const
|
|
1691
|
+
const On = () => /* @__PURE__ */ p(
|
|
1677
1692
|
"svg",
|
|
1678
1693
|
{
|
|
1679
1694
|
width: "18",
|
|
@@ -1689,7 +1704,7 @@ const Bn = () => /* @__PURE__ */ p(
|
|
|
1689
1704
|
/* @__PURE__ */ a("path", { d: "M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6" })
|
|
1690
1705
|
]
|
|
1691
1706
|
}
|
|
1692
|
-
),
|
|
1707
|
+
), qe = ({ size: t = 12, title: e = "Saved" }) => /* @__PURE__ */ p(
|
|
1693
1708
|
"svg",
|
|
1694
1709
|
{
|
|
1695
1710
|
width: t,
|
|
@@ -1703,7 +1718,7 @@ const Bn = () => /* @__PURE__ */ p(
|
|
|
1703
1718
|
/* @__PURE__ */ a("polyline", { points: "20 6 9 17 4 12" })
|
|
1704
1719
|
]
|
|
1705
1720
|
}
|
|
1706
|
-
),
|
|
1721
|
+
), sr = ({ size: t = 12 }) => /* @__PURE__ */ p(
|
|
1707
1722
|
"svg",
|
|
1708
1723
|
{
|
|
1709
1724
|
width: t,
|
|
@@ -1720,7 +1735,7 @@ const Bn = () => /* @__PURE__ */ p(
|
|
|
1720
1735
|
/* @__PURE__ */ a("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
1721
1736
|
]
|
|
1722
1737
|
}
|
|
1723
|
-
),
|
|
1738
|
+
), ar = ({ size: t = 16 }) => /* @__PURE__ */ p(
|
|
1724
1739
|
"svg",
|
|
1725
1740
|
{
|
|
1726
1741
|
width: t,
|
|
@@ -1739,7 +1754,7 @@ const Bn = () => /* @__PURE__ */ p(
|
|
|
1739
1754
|
/* @__PURE__ */ a("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
1740
1755
|
]
|
|
1741
1756
|
}
|
|
1742
|
-
),
|
|
1757
|
+
), ir = ({ size: t = 16 }) => /* @__PURE__ */ p(
|
|
1743
1758
|
"svg",
|
|
1744
1759
|
{
|
|
1745
1760
|
width: t,
|
|
@@ -1758,7 +1773,7 @@ const Bn = () => /* @__PURE__ */ p(
|
|
|
1758
1773
|
/* @__PURE__ */ a("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
1759
1774
|
]
|
|
1760
1775
|
}
|
|
1761
|
-
),
|
|
1776
|
+
), Ln = ({
|
|
1762
1777
|
size: t = 12,
|
|
1763
1778
|
title: e = "Error"
|
|
1764
1779
|
}) => /* @__PURE__ */ p(
|
|
@@ -1777,7 +1792,7 @@ const Bn = () => /* @__PURE__ */ p(
|
|
|
1777
1792
|
/* @__PURE__ */ a("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
1778
1793
|
]
|
|
1779
1794
|
}
|
|
1780
|
-
),
|
|
1795
|
+
), Me = ({ size: t = 12 }) => /* @__PURE__ */ p(
|
|
1781
1796
|
"svg",
|
|
1782
1797
|
{
|
|
1783
1798
|
width: t,
|
|
@@ -1793,7 +1808,7 @@ const Bn = () => /* @__PURE__ */ p(
|
|
|
1793
1808
|
]
|
|
1794
1809
|
}
|
|
1795
1810
|
);
|
|
1796
|
-
function
|
|
1811
|
+
function Rn({
|
|
1797
1812
|
addresses: t,
|
|
1798
1813
|
selectedAddressId: e,
|
|
1799
1814
|
addressUpdateStatus: r = "idle",
|
|
@@ -1808,13 +1823,13 @@ function Fn({
|
|
|
1808
1823
|
return /* @__PURE__ */ p(
|
|
1809
1824
|
"div",
|
|
1810
1825
|
{
|
|
1811
|
-
className:
|
|
1826
|
+
className: Ee(
|
|
1812
1827
|
"grid gap-2",
|
|
1813
1828
|
s ? "grid-cols-2" : "grid-cols-1"
|
|
1814
1829
|
),
|
|
1815
1830
|
children: [
|
|
1816
1831
|
s && /* @__PURE__ */ a(
|
|
1817
|
-
|
|
1832
|
+
St,
|
|
1818
1833
|
{
|
|
1819
1834
|
label: "Bill to",
|
|
1820
1835
|
onAddressChange: c,
|
|
@@ -1828,7 +1843,7 @@ function Fn({
|
|
|
1828
1843
|
}
|
|
1829
1844
|
),
|
|
1830
1845
|
/* @__PURE__ */ a(
|
|
1831
|
-
|
|
1846
|
+
St,
|
|
1832
1847
|
{
|
|
1833
1848
|
label: "Ship to",
|
|
1834
1849
|
onAddressChange: n,
|
|
@@ -1845,7 +1860,7 @@ function Fn({
|
|
|
1845
1860
|
}
|
|
1846
1861
|
);
|
|
1847
1862
|
}
|
|
1848
|
-
function
|
|
1863
|
+
function St(t) {
|
|
1849
1864
|
const {
|
|
1850
1865
|
label: e,
|
|
1851
1866
|
addresses: r,
|
|
@@ -1868,15 +1883,15 @@ function wt(t) {
|
|
|
1868
1883
|
/* @__PURE__ */ p("div", { className: "flex justify-between items-center mb-0.5", children: [
|
|
1869
1884
|
/* @__PURE__ */ a("span", { className: "text-2xs text-text-tertiary uppercase tracking-[0.05em]", children: e }),
|
|
1870
1885
|
i === "updating" && /* @__PURE__ */ p("span", { className: "flex items-center gap-1 text-2xs font-medium text-text-tertiary uppercase tracking-[0.025em]", children: [
|
|
1871
|
-
/* @__PURE__ */ a(
|
|
1886
|
+
/* @__PURE__ */ a(Me, { size: 10 }),
|
|
1872
1887
|
"Updating..."
|
|
1873
1888
|
] }),
|
|
1874
1889
|
i === "success" && /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5 text-2xs font-semibold text-success-text uppercase tracking-[0.025em]", children: [
|
|
1875
|
-
/* @__PURE__ */ a(
|
|
1890
|
+
/* @__PURE__ */ a(qe, { size: 10, title: "Updated" }),
|
|
1876
1891
|
"Updated"
|
|
1877
1892
|
] }),
|
|
1878
1893
|
i === "error" && /* @__PURE__ */ p("span", { className: "flex items-center gap-0.5 text-2xs font-semibold text-error-text uppercase tracking-[0.025em]", children: [
|
|
1879
|
-
/* @__PURE__ */ a(
|
|
1894
|
+
/* @__PURE__ */ a(Ln, { size: 12, title: "Failed" }),
|
|
1880
1895
|
"Failed to update"
|
|
1881
1896
|
] })
|
|
1882
1897
|
] }),
|
|
@@ -1889,11 +1904,11 @@ function wt(t) {
|
|
|
1889
1904
|
className: "w-full px-2 py-1.5 text-sm font-medium rounded cursor-pointer transition-colors focus:outline-none focus:border-border-focus disabled:opacity-50 disabled:cursor-not-allowed border border-solid font-[inherit] appearance-auto text-text bg-transparent border-border-strong",
|
|
1890
1905
|
children: [
|
|
1891
1906
|
o && /* @__PURE__ */ p(ve, { children: [
|
|
1892
|
-
/* @__PURE__ */ a("option", { value: o.id, children: /* @__PURE__ */ a(
|
|
1907
|
+
/* @__PURE__ */ a("option", { value: o.id, children: /* @__PURE__ */ a(Nt, { address: o }) }, o.id),
|
|
1893
1908
|
/* @__PURE__ */ a("option", { disabled: !0, children: "---" })
|
|
1894
1909
|
] }),
|
|
1895
1910
|
N.map((b) => /* @__PURE__ */ a("option", { value: b.id, children: /* @__PURE__ */ a(
|
|
1896
|
-
|
|
1911
|
+
Nt,
|
|
1897
1912
|
{
|
|
1898
1913
|
address: b,
|
|
1899
1914
|
isDefault: l
|
|
@@ -1904,13 +1919,13 @@ function wt(t) {
|
|
|
1904
1919
|
]
|
|
1905
1920
|
}
|
|
1906
1921
|
),
|
|
1907
|
-
o && /* @__PURE__ */ a(
|
|
1922
|
+
o && /* @__PURE__ */ a(_n, { address: o }),
|
|
1908
1923
|
m && /* @__PURE__ */ a("p", { className: "mt-1.5 pt-1.5 m-0 text-xs leading-[1.4]", children: "Your company has a default address set. Verify your address on the checkout page as it may not populate automatically." })
|
|
1909
1924
|
]
|
|
1910
1925
|
}
|
|
1911
1926
|
);
|
|
1912
1927
|
}
|
|
1913
|
-
function
|
|
1928
|
+
function Nt(t) {
|
|
1914
1929
|
const { address: e, isDefault: r } = t;
|
|
1915
1930
|
return /* @__PURE__ */ p(ve, { children: [
|
|
1916
1931
|
r?.(e) ? "[DEFAULT] " : "",
|
|
@@ -1929,18 +1944,18 @@ function St(t) {
|
|
|
1929
1944
|
e.postalCode
|
|
1930
1945
|
] });
|
|
1931
1946
|
}
|
|
1932
|
-
function
|
|
1947
|
+
function Dn(t) {
|
|
1933
1948
|
const e = [t.address1];
|
|
1934
1949
|
t.address2 && e.push(t.address2), t.city && e.push(t.city), t.stateOrProvince && e.push(t.stateOrProvince);
|
|
1935
1950
|
const r = e.pop();
|
|
1936
1951
|
return t.postalCode ? e.push(`${r} ${t.postalCode}`) : r && e.push(r), e.join(", ");
|
|
1937
1952
|
}
|
|
1938
|
-
function
|
|
1953
|
+
function _n({ address: t }) {
|
|
1939
1954
|
const [e, r] = L(!1), n = D(void 0);
|
|
1940
1955
|
F(() => () => {
|
|
1941
1956
|
n.current && clearTimeout(n.current);
|
|
1942
1957
|
}, []);
|
|
1943
|
-
const i =
|
|
1958
|
+
const i = Dn(t), s = B(async () => {
|
|
1944
1959
|
try {
|
|
1945
1960
|
await navigator.clipboard.writeText(i), r(!0), n.current && clearTimeout(n.current), n.current = setTimeout(() => r(!1), 1500);
|
|
1946
1961
|
} catch {
|
|
@@ -1959,25 +1974,25 @@ function Ln({ address: t }) {
|
|
|
1959
1974
|
" ",
|
|
1960
1975
|
i
|
|
1961
1976
|
] }),
|
|
1962
|
-
/* @__PURE__ */ a("span", { className: "shrink-0 mt-0.5", children: e ? /* @__PURE__ */ a(
|
|
1977
|
+
/* @__PURE__ */ a("span", { className: "shrink-0 mt-0.5", children: e ? /* @__PURE__ */ a(qe, { size: 12, title: "Copied" }) : /* @__PURE__ */ a(sr, { size: 12 }) })
|
|
1963
1978
|
]
|
|
1964
1979
|
}
|
|
1965
1980
|
);
|
|
1966
1981
|
}
|
|
1967
|
-
const
|
|
1982
|
+
const Ae = (t, e = "USD") => new Intl.NumberFormat("en-US", {
|
|
1968
1983
|
style: "currency",
|
|
1969
1984
|
currency: e
|
|
1970
1985
|
}).format(t);
|
|
1971
|
-
function
|
|
1986
|
+
function et({ label: t, value: e }) {
|
|
1972
1987
|
return /* @__PURE__ */ p("div", { className: "flex justify-between py-0.5", children: [
|
|
1973
1988
|
/* @__PURE__ */ a("span", { className: "text-sm text-text-tertiary", children: t }),
|
|
1974
1989
|
/* @__PURE__ */ a("span", { className: "text-sm text-text", children: e })
|
|
1975
1990
|
] });
|
|
1976
1991
|
}
|
|
1977
|
-
function
|
|
1978
|
-
return t != null ?
|
|
1992
|
+
function tt(t, e) {
|
|
1993
|
+
return t != null ? Ae(t, e) : "...";
|
|
1979
1994
|
}
|
|
1980
|
-
function
|
|
1995
|
+
function Un({
|
|
1981
1996
|
subtotal: t,
|
|
1982
1997
|
tax: e,
|
|
1983
1998
|
shipping: r,
|
|
@@ -1991,23 +2006,23 @@ function Rn({
|
|
|
1991
2006
|
}) {
|
|
1992
2007
|
return /* @__PURE__ */ p("div", { className: "px-4 py-2.5 shrink-0 bg-surface-secondary", children: [
|
|
1993
2008
|
/* @__PURE__ */ a(
|
|
1994
|
-
|
|
2009
|
+
et,
|
|
1995
2010
|
{
|
|
1996
2011
|
label: "Subtotal",
|
|
1997
|
-
value:
|
|
2012
|
+
value: Ae(t, i)
|
|
1998
2013
|
}
|
|
1999
2014
|
),
|
|
2000
|
-
/* @__PURE__ */ a(
|
|
2015
|
+
/* @__PURE__ */ a(et, { label: "Tax", value: tt(e, i) }),
|
|
2001
2016
|
/* @__PURE__ */ a(
|
|
2002
|
-
|
|
2017
|
+
et,
|
|
2003
2018
|
{
|
|
2004
2019
|
label: "Shipping",
|
|
2005
|
-
value:
|
|
2020
|
+
value: tt(r, i)
|
|
2006
2021
|
}
|
|
2007
2022
|
),
|
|
2008
2023
|
/* @__PURE__ */ p("div", { className: "flex justify-between mt-1 pt-1.5 border-t border-border", children: [
|
|
2009
2024
|
/* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children: "Total" }),
|
|
2010
|
-
/* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children:
|
|
2025
|
+
/* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children: tt(n, i) })
|
|
2011
2026
|
] }),
|
|
2012
2027
|
/* @__PURE__ */ a(
|
|
2013
2028
|
"button",
|
|
@@ -2043,7 +2058,7 @@ function Rn({
|
|
|
2043
2058
|
)
|
|
2044
2059
|
] });
|
|
2045
2060
|
}
|
|
2046
|
-
const
|
|
2061
|
+
const dt = () => /* @__PURE__ */ p(
|
|
2047
2062
|
"svg",
|
|
2048
2063
|
{
|
|
2049
2064
|
width: "14",
|
|
@@ -2058,8 +2073,8 @@ const ct = () => /* @__PURE__ */ p(
|
|
|
2058
2073
|
/* @__PURE__ */ a("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
2059
2074
|
]
|
|
2060
2075
|
}
|
|
2061
|
-
),
|
|
2062
|
-
function
|
|
2076
|
+
), kt = "w-8 h-8 p-0 flex items-center justify-center bg-surface-tertiary border border-border rounded-sm text-text-tertiary cursor-pointer transition-all duration-150 hover:bg-surface-disabled hover:border-border-strong hover:text-text-secondary disabled:opacity-50 disabled:cursor-not-allowed";
|
|
2077
|
+
function Et({
|
|
2063
2078
|
children: t,
|
|
2064
2079
|
className: e,
|
|
2065
2080
|
...r
|
|
@@ -2068,13 +2083,13 @@ function kt({
|
|
|
2068
2083
|
"button",
|
|
2069
2084
|
{
|
|
2070
2085
|
type: "button",
|
|
2071
|
-
className: e ?
|
|
2086
|
+
className: e ? Ee(kt, e) : kt,
|
|
2072
2087
|
...r,
|
|
2073
2088
|
children: t
|
|
2074
2089
|
}
|
|
2075
2090
|
);
|
|
2076
2091
|
}
|
|
2077
|
-
function
|
|
2092
|
+
function or({
|
|
2078
2093
|
value: t,
|
|
2079
2094
|
onChange: e,
|
|
2080
2095
|
min: r = 1,
|
|
@@ -2149,7 +2164,7 @@ function ir({
|
|
|
2149
2164
|
}, v = t <= r, E = n !== void 0 && t >= n, I = d === "saving";
|
|
2150
2165
|
return /* @__PURE__ */ p("span", { className: `inline-flex items-center gap-0.5 ${i}`, children: [
|
|
2151
2166
|
/* @__PURE__ */ a(
|
|
2152
|
-
|
|
2167
|
+
Et,
|
|
2153
2168
|
{
|
|
2154
2169
|
onClick: () => x(-1),
|
|
2155
2170
|
disabled: v || I,
|
|
@@ -2185,7 +2200,7 @@ function ir({
|
|
|
2185
2200
|
}
|
|
2186
2201
|
),
|
|
2187
2202
|
/* @__PURE__ */ a(
|
|
2188
|
-
|
|
2203
|
+
Et,
|
|
2189
2204
|
{
|
|
2190
2205
|
onClick: () => x(1),
|
|
2191
2206
|
disabled: E || I,
|
|
@@ -2208,12 +2223,12 @@ function ir({
|
|
|
2208
2223
|
)
|
|
2209
2224
|
}
|
|
2210
2225
|
),
|
|
2211
|
-
I && /* @__PURE__ */ a("span", { className: "text-text-tertiary ml-0.5", children: /* @__PURE__ */ a(
|
|
2212
|
-
d === "success" && /* @__PURE__ */ a("span", { className: "text-success ml-0.5", children: /* @__PURE__ */ a(
|
|
2226
|
+
I && /* @__PURE__ */ a("span", { className: "text-text-tertiary ml-0.5", children: /* @__PURE__ */ a(Me, {}) }),
|
|
2227
|
+
d === "success" && /* @__PURE__ */ a("span", { className: "text-success ml-0.5", children: /* @__PURE__ */ a(qe, {}) }),
|
|
2213
2228
|
d === "error" && /* @__PURE__ */ a("span", { className: "text-error text-xs ml-0.5", children: "Failed" })
|
|
2214
2229
|
] });
|
|
2215
2230
|
}
|
|
2216
|
-
function
|
|
2231
|
+
function qn(t) {
|
|
2217
2232
|
const {
|
|
2218
2233
|
item: e,
|
|
2219
2234
|
onUpdateQuantity: r,
|
|
@@ -2250,7 +2265,7 @@ function Dn(t) {
|
|
|
2250
2265
|
] }),
|
|
2251
2266
|
/* @__PURE__ */ p("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
2252
2267
|
/* @__PURE__ */ a(
|
|
2253
|
-
|
|
2268
|
+
or,
|
|
2254
2269
|
{
|
|
2255
2270
|
value: e.quantity,
|
|
2256
2271
|
onChange: (f) => r(e.id, f),
|
|
@@ -2265,7 +2280,7 @@ function Dn(t) {
|
|
|
2265
2280
|
onClick: () => n(e.id),
|
|
2266
2281
|
className: "p-2 text-text-quaternary hover:text-text-secondary shrink-0",
|
|
2267
2282
|
"aria-label": "Remove item",
|
|
2268
|
-
children: /* @__PURE__ */ a(
|
|
2283
|
+
children: /* @__PURE__ */ a(dt, {})
|
|
2269
2284
|
}
|
|
2270
2285
|
)
|
|
2271
2286
|
] })
|
|
@@ -2278,10 +2293,10 @@ function Dn(t) {
|
|
|
2278
2293
|
d ? "Catalog price lower" : "Catalog price higher",
|
|
2279
2294
|
" · ",
|
|
2280
2295
|
"PO: ",
|
|
2281
|
-
|
|
2296
|
+
Ae(o, e.poPriceCurrencyCode),
|
|
2282
2297
|
" → Catalog:",
|
|
2283
2298
|
" ",
|
|
2284
|
-
|
|
2299
|
+
Ae(e.price ?? 0, e.catalogPriceCurrencyCode)
|
|
2285
2300
|
] })
|
|
2286
2301
|
}
|
|
2287
2302
|
),
|
|
@@ -2289,12 +2304,12 @@ function Dn(t) {
|
|
|
2289
2304
|
e.status === "pending" && /* @__PURE__ */ a("span", { className: "inline-block text-xs font-medium px-1.5 py-0.5 rounded mt-1 bg-warning/20 text-warning-text", children: "Pending" }),
|
|
2290
2305
|
/* @__PURE__ */ p("div", { className: "flex items-center justify-between mt-2", children: [
|
|
2291
2306
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children: /* @__PURE__ */ a(
|
|
2292
|
-
|
|
2307
|
+
jn,
|
|
2293
2308
|
{
|
|
2294
2309
|
onClick: () => i(e.name, e.sku)
|
|
2295
2310
|
}
|
|
2296
2311
|
) }),
|
|
2297
|
-
e.price !== void 0 && /* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children:
|
|
2312
|
+
e.price !== void 0 && /* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children: Ae(
|
|
2298
2313
|
e.price * e.quantity,
|
|
2299
2314
|
e.catalogPriceCurrencyCode
|
|
2300
2315
|
) })
|
|
@@ -2302,7 +2317,7 @@ function Dn(t) {
|
|
|
2302
2317
|
] })
|
|
2303
2318
|
] });
|
|
2304
2319
|
}
|
|
2305
|
-
function
|
|
2320
|
+
function jn(t) {
|
|
2306
2321
|
return /* @__PURE__ */ a(
|
|
2307
2322
|
"button",
|
|
2308
2323
|
{
|
|
@@ -2313,8 +2328,8 @@ function _n(t) {
|
|
|
2313
2328
|
}
|
|
2314
2329
|
);
|
|
2315
2330
|
}
|
|
2316
|
-
const
|
|
2317
|
-
function
|
|
2331
|
+
const Pt = "flex items-center gap-1 min-h-11 px-3 py-1 text-xs font-medium text-text bg-surface-secondary border border-border-focus/20 rounded-md hover:bg-surface-tertiary hover:border-border-focus/35 transition-all whitespace-nowrap";
|
|
2332
|
+
function _e({
|
|
2318
2333
|
children: t,
|
|
2319
2334
|
className: e,
|
|
2320
2335
|
...r
|
|
@@ -2323,13 +2338,13 @@ function De({
|
|
|
2323
2338
|
"button",
|
|
2324
2339
|
{
|
|
2325
2340
|
type: "button",
|
|
2326
|
-
className: e ?
|
|
2341
|
+
className: e ? Ee(Pt, e) : Pt,
|
|
2327
2342
|
...r,
|
|
2328
2343
|
children: t
|
|
2329
2344
|
}
|
|
2330
2345
|
);
|
|
2331
2346
|
}
|
|
2332
|
-
function
|
|
2347
|
+
function lr({ onNewOrder: t }) {
|
|
2333
2348
|
const [e, r] = L(!1), n = D(
|
|
2334
2349
|
void 0
|
|
2335
2350
|
), i = () => {
|
|
@@ -2361,7 +2376,7 @@ function or({ onNewOrder: t }) {
|
|
|
2361
2376
|
children: "No"
|
|
2362
2377
|
}
|
|
2363
2378
|
)
|
|
2364
|
-
] }) : /* @__PURE__ */ p(
|
|
2379
|
+
] }) : /* @__PURE__ */ p(_e, { onClick: i, title: "Start a new order", children: [
|
|
2365
2380
|
/* @__PURE__ */ a(
|
|
2366
2381
|
"svg",
|
|
2367
2382
|
{
|
|
@@ -2378,7 +2393,7 @@ function or({ onNewOrder: t }) {
|
|
|
2378
2393
|
"New Order"
|
|
2379
2394
|
] });
|
|
2380
2395
|
}
|
|
2381
|
-
const
|
|
2396
|
+
const Wn = () => /* @__PURE__ */ p(
|
|
2382
2397
|
"svg",
|
|
2383
2398
|
{
|
|
2384
2399
|
width: "48",
|
|
@@ -2398,7 +2413,7 @@ const Un = () => /* @__PURE__ */ p(
|
|
|
2398
2413
|
]
|
|
2399
2414
|
}
|
|
2400
2415
|
);
|
|
2401
|
-
function
|
|
2416
|
+
function Vn({
|
|
2402
2417
|
className: t = "",
|
|
2403
2418
|
isDragging: e = !1,
|
|
2404
2419
|
onNewOrder: r,
|
|
@@ -2409,25 +2424,25 @@ function qn({
|
|
|
2409
2424
|
return /* @__PURE__ */ p(
|
|
2410
2425
|
"div",
|
|
2411
2426
|
{
|
|
2412
|
-
className:
|
|
2427
|
+
className: Ee(
|
|
2413
2428
|
"rounded-lg flex flex-col h-full bg-surface-secondary relative transition-colors duration-200",
|
|
2414
2429
|
e && "bg-surface-tertiary",
|
|
2415
2430
|
t
|
|
2416
2431
|
),
|
|
2417
2432
|
children: [
|
|
2418
2433
|
s && /* @__PURE__ */ p("div", { className: "absolute top-0 right-0 px-4 py-3 z-10 flex items-center gap-2", children: [
|
|
2419
|
-
r && /* @__PURE__ */ a(
|
|
2420
|
-
n && /* @__PURE__ */ p(
|
|
2421
|
-
/* @__PURE__ */ a(
|
|
2434
|
+
r && /* @__PURE__ */ a(lr, { onNewOrder: r }),
|
|
2435
|
+
n && /* @__PURE__ */ p(_e, { onClick: n, "aria-label": "Expand", children: [
|
|
2436
|
+
/* @__PURE__ */ a(ar, { size: 14 }),
|
|
2422
2437
|
"Expand"
|
|
2423
2438
|
] }),
|
|
2424
|
-
i && /* @__PURE__ */ p(
|
|
2425
|
-
/* @__PURE__ */ a(
|
|
2439
|
+
i && /* @__PURE__ */ p(_e, { onClick: i, "aria-label": "Minimize", children: [
|
|
2440
|
+
/* @__PURE__ */ a(ir, { size: 14 }),
|
|
2426
2441
|
"Minimize"
|
|
2427
2442
|
] })
|
|
2428
2443
|
] }),
|
|
2429
2444
|
/* @__PURE__ */ p("div", { className: "flex flex-col flex-1 items-center justify-center gap-4 py-3 px-8", children: [
|
|
2430
|
-
/* @__PURE__ */ a("div", { className: "flex items-center justify-center w-16 h-16 rounded-2xl p-1 text-text", children: /* @__PURE__ */ a(
|
|
2445
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-center w-16 h-16 rounded-2xl p-1 text-text", children: /* @__PURE__ */ a(Wn, {}) }),
|
|
2431
2446
|
/* @__PURE__ */ a("h3", { className: "m-0 text-base font-semibold text-text", children: "Your cart will appear here" }),
|
|
2432
2447
|
/* @__PURE__ */ a("div", { className: "h-[50px]", "aria-hidden": "true" })
|
|
2433
2448
|
] }),
|
|
@@ -2436,11 +2451,11 @@ function qn({
|
|
|
2436
2451
|
}
|
|
2437
2452
|
);
|
|
2438
2453
|
}
|
|
2439
|
-
const
|
|
2454
|
+
const cr = {
|
|
2440
2455
|
pendingMessage: null,
|
|
2441
2456
|
shouldScroll: !0
|
|
2442
|
-
},
|
|
2443
|
-
ai: { ...
|
|
2457
|
+
}, zn = (t) => ({
|
|
2458
|
+
ai: { ...cr },
|
|
2444
2459
|
sendMessage: (e, r) => t(
|
|
2445
2460
|
(n) => ({
|
|
2446
2461
|
ai: {
|
|
@@ -2459,7 +2474,7 @@ const lr = {
|
|
|
2459
2474
|
!1,
|
|
2460
2475
|
"ai/consumeMessage"
|
|
2461
2476
|
)
|
|
2462
|
-
}),
|
|
2477
|
+
}), He = {
|
|
2463
2478
|
status: "idle",
|
|
2464
2479
|
error: null,
|
|
2465
2480
|
results: null,
|
|
@@ -2467,8 +2482,8 @@ const lr = {
|
|
|
2467
2482
|
toolCalls: [],
|
|
2468
2483
|
revealedCount: 0,
|
|
2469
2484
|
threadIds: []
|
|
2470
|
-
},
|
|
2471
|
-
batchProcessing: { ...
|
|
2485
|
+
}, Qn = (t) => ({
|
|
2486
|
+
batchProcessing: { ...He },
|
|
2472
2487
|
setBatchProcessingStatus: (e) => t(
|
|
2473
2488
|
(r) => ({ batchProcessing: { ...r.batchProcessing, status: e } }),
|
|
2474
2489
|
!1,
|
|
@@ -2521,17 +2536,17 @@ const lr = {
|
|
|
2521
2536
|
"batchProcessing/incrementRevealed"
|
|
2522
2537
|
),
|
|
2523
2538
|
resetBatchProcessing: () => t(
|
|
2524
|
-
{ batchProcessing: { ...
|
|
2539
|
+
{ batchProcessing: { ...He } },
|
|
2525
2540
|
!1,
|
|
2526
2541
|
"batchProcessing/reset"
|
|
2527
2542
|
)
|
|
2528
|
-
}),
|
|
2543
|
+
}), Tt = {
|
|
2529
2544
|
bcCart: null,
|
|
2530
2545
|
checkout: null,
|
|
2531
2546
|
isLoading: !1,
|
|
2532
2547
|
productPaths: {}
|
|
2533
|
-
},
|
|
2534
|
-
bcSession: { ...
|
|
2548
|
+
}, Gn = (t) => ({
|
|
2549
|
+
bcSession: { ...Tt },
|
|
2535
2550
|
setBcCart: (e) => t(
|
|
2536
2551
|
(r) => ({ bcSession: { ...r.bcSession, bcCart: e } }),
|
|
2537
2552
|
!1,
|
|
@@ -2553,15 +2568,15 @@ const lr = {
|
|
|
2553
2568
|
"bcSession/setProductPaths"
|
|
2554
2569
|
),
|
|
2555
2570
|
clearBcSession: () => t(
|
|
2556
|
-
() => ({ bcSession: { ...
|
|
2571
|
+
() => ({ bcSession: { ...Tt } }),
|
|
2557
2572
|
!1,
|
|
2558
2573
|
"bcSession/clearBcSession"
|
|
2559
2574
|
)
|
|
2560
2575
|
});
|
|
2561
|
-
function
|
|
2576
|
+
function At(t, e) {
|
|
2562
2577
|
return `${t}-${e}`;
|
|
2563
2578
|
}
|
|
2564
|
-
const
|
|
2579
|
+
const dr = {
|
|
2565
2580
|
cartEntityId: null,
|
|
2566
2581
|
poItemPrices: {},
|
|
2567
2582
|
orderId: null,
|
|
@@ -2570,8 +2585,8 @@ const cr = {
|
|
|
2570
2585
|
billingAddress: null,
|
|
2571
2586
|
poMetadataSet: !1,
|
|
2572
2587
|
itemWarnings: []
|
|
2573
|
-
},
|
|
2574
|
-
cartifact: { ...
|
|
2588
|
+
}, Hn = (t) => ({
|
|
2589
|
+
cartifact: { ...dr },
|
|
2575
2590
|
setCartEntityId: (e) => t(
|
|
2576
2591
|
(r) => ({ cartifact: { ...r.cartifact, cartEntityId: e } }),
|
|
2577
2592
|
!1,
|
|
@@ -2583,7 +2598,7 @@ const cr = {
|
|
|
2583
2598
|
...s.cartifact,
|
|
2584
2599
|
poItemPrices: {
|
|
2585
2600
|
...s.cartifact.poItemPrices,
|
|
2586
|
-
[
|
|
2601
|
+
[At(e, r)]: {
|
|
2587
2602
|
productEntityId: e,
|
|
2588
2603
|
variantEntityId: r,
|
|
2589
2604
|
poPrice: n,
|
|
@@ -2598,7 +2613,7 @@ const cr = {
|
|
|
2598
2613
|
removePoItemPrice: (e, r) => t(
|
|
2599
2614
|
(n) => {
|
|
2600
2615
|
const i = { ...n.cartifact.poItemPrices };
|
|
2601
|
-
return delete i[
|
|
2616
|
+
return delete i[At(e, r)], { cartifact: { ...n.cartifact, poItemPrices: i } };
|
|
2602
2617
|
},
|
|
2603
2618
|
!1,
|
|
2604
2619
|
"cartifact/removePoItemPrice"
|
|
@@ -2622,7 +2637,7 @@ const cr = {
|
|
|
2622
2637
|
(r) => ({
|
|
2623
2638
|
cartifact: {
|
|
2624
2639
|
...r.cartifact,
|
|
2625
|
-
shipToAddress: e ?
|
|
2640
|
+
shipToAddress: e ? We(e, {
|
|
2626
2641
|
id: be
|
|
2627
2642
|
}) : null
|
|
2628
2643
|
}
|
|
@@ -2634,7 +2649,7 @@ const cr = {
|
|
|
2634
2649
|
(r) => ({
|
|
2635
2650
|
cartifact: {
|
|
2636
2651
|
...r.cartifact,
|
|
2637
|
-
billingAddress: e ?
|
|
2652
|
+
billingAddress: e ? We(e, {
|
|
2638
2653
|
id: Se
|
|
2639
2654
|
}) : null
|
|
2640
2655
|
}
|
|
@@ -2690,10 +2705,10 @@ const cr = {
|
|
|
2690
2705
|
email: e.buyerEmail,
|
|
2691
2706
|
firstName: e.buyerFirstName,
|
|
2692
2707
|
lastName: e.buyerLastName
|
|
2693
|
-
}), e.shipToAddress && (n.shipToAddress =
|
|
2708
|
+
}), e.shipToAddress && (n.shipToAddress = We(
|
|
2694
2709
|
e.shipToAddress,
|
|
2695
2710
|
{ id: be }
|
|
2696
|
-
)), e.billingAddress && (n.billingAddress =
|
|
2711
|
+
)), e.billingAddress && (n.billingAddress = We(
|
|
2697
2712
|
e.billingAddress,
|
|
2698
2713
|
{ id: Se }
|
|
2699
2714
|
)), { cartifact: { ...r.cartifact, ...n } };
|
|
@@ -2701,13 +2716,13 @@ const cr = {
|
|
|
2701
2716
|
!1,
|
|
2702
2717
|
"cartifact/applyPoMetadata"
|
|
2703
2718
|
)
|
|
2704
|
-
}),
|
|
2719
|
+
}), Kn = {
|
|
2705
2720
|
messages: [],
|
|
2706
2721
|
input: "",
|
|
2707
2722
|
threadId: null,
|
|
2708
2723
|
toolCallErrors: {}
|
|
2709
|
-
},
|
|
2710
|
-
chat: { ...
|
|
2724
|
+
}, Jn = (t) => ({
|
|
2725
|
+
chat: { ...Kn },
|
|
2711
2726
|
setMessages: (e) => t(
|
|
2712
2727
|
(r) => ({ chat: { ...r.chat, messages: e } }),
|
|
2713
2728
|
!1,
|
|
@@ -2756,11 +2771,11 @@ const cr = {
|
|
|
2756
2771
|
!1,
|
|
2757
2772
|
"chat/clearChat"
|
|
2758
2773
|
)
|
|
2759
|
-
}),
|
|
2774
|
+
}), Yn = {
|
|
2760
2775
|
customerInfo: null,
|
|
2761
2776
|
customerAddresses: []
|
|
2762
|
-
},
|
|
2763
|
-
customer: { ...
|
|
2777
|
+
}, Xn = (t) => ({
|
|
2778
|
+
customer: { ...Yn },
|
|
2764
2779
|
setCustomerInfo: (e) => {
|
|
2765
2780
|
t(
|
|
2766
2781
|
(r) => ({
|
|
@@ -2778,13 +2793,13 @@ const cr = {
|
|
|
2778
2793
|
!1,
|
|
2779
2794
|
"customer/setCustomerAddresses"
|
|
2780
2795
|
)
|
|
2781
|
-
}),
|
|
2796
|
+
}), ur = {
|
|
2782
2797
|
uploadedFileName: null,
|
|
2783
2798
|
parsedContent: null,
|
|
2784
2799
|
hasProcessedDocument: !1,
|
|
2785
2800
|
threadId: null
|
|
2786
|
-
},
|
|
2787
|
-
parser: { ...
|
|
2801
|
+
}, Zn = (t) => ({
|
|
2802
|
+
parser: { ...ur },
|
|
2788
2803
|
setUploadedFileName: (e) => t(
|
|
2789
2804
|
(r) => ({ parser: { ...r.parser, uploadedFileName: e } }),
|
|
2790
2805
|
!1,
|
|
@@ -2818,15 +2833,15 @@ const cr = {
|
|
|
2818
2833
|
!1,
|
|
2819
2834
|
"parser/clearParser"
|
|
2820
2835
|
)
|
|
2821
|
-
}),
|
|
2836
|
+
}), es = {
|
|
2822
2837
|
projectId: "",
|
|
2823
2838
|
apiKey: "",
|
|
2824
2839
|
origin: "",
|
|
2825
2840
|
sseOrigin: ""
|
|
2826
|
-
},
|
|
2827
|
-
takeshapeConfig: { ...
|
|
2841
|
+
}, ts = (t) => ({
|
|
2842
|
+
takeshapeConfig: { ...es },
|
|
2828
2843
|
setTakeShapeConfig: (e) => t({ takeshapeConfig: e }, !1, "setTakeShapeConfig")
|
|
2829
|
-
}),
|
|
2844
|
+
}), rs = {
|
|
2830
2845
|
initStatus: "pending",
|
|
2831
2846
|
initError: null,
|
|
2832
2847
|
existingCart: null,
|
|
@@ -2835,8 +2850,8 @@ const cr = {
|
|
|
2835
2850
|
addressUpdateStatus: "idle",
|
|
2836
2851
|
selectedBillingAddressId: null,
|
|
2837
2852
|
billingAddressUpdateStatus: "idle"
|
|
2838
|
-
},
|
|
2839
|
-
ui: { ...
|
|
2853
|
+
}, ns = (t) => ({
|
|
2854
|
+
ui: { ...rs },
|
|
2840
2855
|
toggleMessageExpanded: (e) => t(
|
|
2841
2856
|
(r) => {
|
|
2842
2857
|
const n = r.ui.expandedMessageIds, i = n.includes(e);
|
|
@@ -2884,12 +2899,12 @@ const cr = {
|
|
|
2884
2899
|
"ui/clearAddressSelections"
|
|
2885
2900
|
)
|
|
2886
2901
|
});
|
|
2887
|
-
function
|
|
2902
|
+
function ss() {
|
|
2888
2903
|
return {
|
|
2889
2904
|
appState: "upload",
|
|
2890
2905
|
customerEntityId: null,
|
|
2891
2906
|
fatalError: null,
|
|
2892
|
-
ai: { ...
|
|
2907
|
+
ai: { ...cr },
|
|
2893
2908
|
chat: {
|
|
2894
2909
|
messages: [],
|
|
2895
2910
|
input: "",
|
|
@@ -2932,23 +2947,23 @@ function ts() {
|
|
|
2932
2947
|
selectedBillingAddressId: null,
|
|
2933
2948
|
billingAddressUpdateStatus: "idle"
|
|
2934
2949
|
},
|
|
2935
|
-
batchProcessing: { ...
|
|
2950
|
+
batchProcessing: { ...He }
|
|
2936
2951
|
};
|
|
2937
2952
|
}
|
|
2938
|
-
const y =
|
|
2939
|
-
|
|
2940
|
-
|
|
2953
|
+
const y = it()(
|
|
2954
|
+
Qr(
|
|
2955
|
+
Gt(
|
|
2941
2956
|
(t, e) => ({
|
|
2942
2957
|
// Combine all slices
|
|
2943
|
-
...jn(t),
|
|
2944
|
-
...Gn(t),
|
|
2945
2958
|
...zn(t),
|
|
2946
|
-
...Kn(t),
|
|
2947
|
-
...Vn(t),
|
|
2948
2959
|
...Jn(t),
|
|
2949
|
-
...
|
|
2950
|
-
...Wn(t),
|
|
2960
|
+
...Hn(t),
|
|
2951
2961
|
...Xn(t),
|
|
2962
|
+
...Gn(t),
|
|
2963
|
+
...Zn(t),
|
|
2964
|
+
...ns(t),
|
|
2965
|
+
...Qn(t),
|
|
2966
|
+
...ts(t),
|
|
2952
2967
|
// Top-level state
|
|
2953
2968
|
appState: "upload",
|
|
2954
2969
|
customerEntityId: null,
|
|
@@ -3019,7 +3034,7 @@ const y = at()(
|
|
|
3019
3034
|
failValidation: (r) => {
|
|
3020
3035
|
t(
|
|
3021
3036
|
{
|
|
3022
|
-
...
|
|
3037
|
+
...ss(),
|
|
3023
3038
|
appState: "upload",
|
|
3024
3039
|
ui: {
|
|
3025
3040
|
initStatus: "ready",
|
|
@@ -3071,15 +3086,15 @@ const y = at()(
|
|
|
3071
3086
|
toolCallErrors: r.chat?.toolCallErrors ?? {}
|
|
3072
3087
|
},
|
|
3073
3088
|
cartifact: {
|
|
3074
|
-
...
|
|
3089
|
+
...dr,
|
|
3075
3090
|
...r.cartifact
|
|
3076
3091
|
},
|
|
3077
3092
|
parser: {
|
|
3078
|
-
...
|
|
3093
|
+
...ur,
|
|
3079
3094
|
...r.parser ?? {}
|
|
3080
3095
|
},
|
|
3081
3096
|
batchProcessing: {
|
|
3082
|
-
...
|
|
3097
|
+
...He,
|
|
3083
3098
|
threadIds: r.batchProcessing?.threadIds ?? []
|
|
3084
3099
|
}
|
|
3085
3100
|
},
|
|
@@ -3089,8 +3104,8 @@ const y = at()(
|
|
|
3089
3104
|
}
|
|
3090
3105
|
}),
|
|
3091
3106
|
{
|
|
3092
|
-
name:
|
|
3093
|
-
version:
|
|
3107
|
+
name: lt,
|
|
3108
|
+
version: Kt,
|
|
3094
3109
|
partialize: (t) => ({
|
|
3095
3110
|
// Persist customer ID for validation
|
|
3096
3111
|
customerEntityId: t.customerEntityId,
|
|
@@ -3128,10 +3143,10 @@ const y = at()(
|
|
|
3128
3143
|
}
|
|
3129
3144
|
)
|
|
3130
3145
|
);
|
|
3131
|
-
function
|
|
3146
|
+
function rt({ productName: t, productSku: e }) {
|
|
3132
3147
|
return t && e ? `${t} (${e})` : t || e || "Unknown Product";
|
|
3133
3148
|
}
|
|
3134
|
-
function
|
|
3149
|
+
function as({
|
|
3135
3150
|
item: t,
|
|
3136
3151
|
onSuggestAlternatives: e
|
|
3137
3152
|
}) {
|
|
@@ -3143,7 +3158,7 @@ function rs({
|
|
|
3143
3158
|
/* @__PURE__ */ p("div", { className: "flex-1 min-w-0", children: [
|
|
3144
3159
|
/* @__PURE__ */ p("div", { className: "flex items-start justify-between gap-2", children: [
|
|
3145
3160
|
/* @__PURE__ */ p("div", { className: "flex-1 min-w-0", children: [
|
|
3146
|
-
(t.productName || t.productSku) && /* @__PURE__ */ a("p", { className: "text-sm font-medium text-text-secondary m-0 truncate", children:
|
|
3161
|
+
(t.productName || t.productSku) && /* @__PURE__ */ a("p", { className: "text-sm font-medium text-text-secondary m-0 truncate", children: rt(t) }),
|
|
3147
3162
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5 mt-1", children: /* @__PURE__ */ p("span", { className: "inline-flex items-center gap-1 text-2xs font-medium px-1.5 py-0.5 rounded bg-surface-tertiary text-text-secondary", children: [
|
|
3148
3163
|
/* @__PURE__ */ a("span", { className: "w-1.5 h-1.5 bg-text-secondary rounded-full animate-pulse" }),
|
|
3149
3164
|
t.status
|
|
@@ -3156,7 +3171,7 @@ function rs({
|
|
|
3156
3171
|
onClick: () => r(t),
|
|
3157
3172
|
className: "p-1 text-text-quaternary hover:text-text-secondary shrink-0",
|
|
3158
3173
|
"aria-label": "Dismiss warning",
|
|
3159
|
-
children: /* @__PURE__ */ a(
|
|
3174
|
+
children: /* @__PURE__ */ a(dt, {})
|
|
3160
3175
|
}
|
|
3161
3176
|
)
|
|
3162
3177
|
] }),
|
|
@@ -3164,7 +3179,7 @@ function rs({
|
|
|
3164
3179
|
"button",
|
|
3165
3180
|
{
|
|
3166
3181
|
type: "button",
|
|
3167
|
-
onClick: () => e(
|
|
3182
|
+
onClick: () => e(rt(t)),
|
|
3168
3183
|
className: "text-xs px-1.5 py-1 rounded text-warning-text bg-warning/20 hover:bg-warning/30",
|
|
3169
3184
|
children: "Suggest alternatives"
|
|
3170
3185
|
}
|
|
@@ -3172,7 +3187,7 @@ function rs({
|
|
|
3172
3187
|
] })
|
|
3173
3188
|
] });
|
|
3174
3189
|
}
|
|
3175
|
-
function
|
|
3190
|
+
function is({
|
|
3176
3191
|
items: t,
|
|
3177
3192
|
itemWarnings: e = [],
|
|
3178
3193
|
onUpdateQuantity: r,
|
|
@@ -3211,7 +3226,7 @@ function ns({
|
|
|
3211
3226
|
(_) => _.catalogPriceCurrencyCode
|
|
3212
3227
|
)?.catalogPriceCurrencyCode, V = w?.tax, ie = w?.shipping, Ie = w?.grandTotal ?? (V !== null ? se + (V ?? 0) + (ie ?? 0) : null);
|
|
3213
3228
|
return t.length === 0 && e.length === 0 && !g ? /* @__PURE__ */ a(
|
|
3214
|
-
|
|
3229
|
+
Vn,
|
|
3215
3230
|
{
|
|
3216
3231
|
className: c,
|
|
3217
3232
|
isDragging: A,
|
|
@@ -3231,13 +3246,13 @@ function ns({
|
|
|
3231
3246
|
/* @__PURE__ */ p("div", { className: "flex items-center justify-between mb-2", children: [
|
|
3232
3247
|
/* @__PURE__ */ a("h2", { className: "text-lg font-normal text-text m-0", children: "Cart" }),
|
|
3233
3248
|
/* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
|
|
3234
|
-
$ && /* @__PURE__ */ a(
|
|
3235
|
-
O && /* @__PURE__ */ p(
|
|
3236
|
-
/* @__PURE__ */ a(
|
|
3249
|
+
$ && /* @__PURE__ */ a(lr, { onNewOrder: $ }),
|
|
3250
|
+
O && /* @__PURE__ */ p(_e, { onClick: O, "aria-label": "Expand", children: [
|
|
3251
|
+
/* @__PURE__ */ a(ar, { size: 14 }),
|
|
3237
3252
|
"Expand"
|
|
3238
3253
|
] }),
|
|
3239
|
-
Q && /* @__PURE__ */ p(
|
|
3240
|
-
/* @__PURE__ */ a(
|
|
3254
|
+
Q && /* @__PURE__ */ p(_e, { onClick: Q, "aria-label": "Minimize", children: [
|
|
3255
|
+
/* @__PURE__ */ a(ir, { size: 14 }),
|
|
3241
3256
|
"Minimize"
|
|
3242
3257
|
] })
|
|
3243
3258
|
] })
|
|
@@ -3254,7 +3269,7 @@ function ns({
|
|
|
3254
3269
|
title: G ? "Copied!" : "Copy PO Number",
|
|
3255
3270
|
children: [
|
|
3256
3271
|
d,
|
|
3257
|
-
/* @__PURE__ */ a("span", { className: "text-text-tertiary", children: G ? /* @__PURE__ */ a(
|
|
3272
|
+
/* @__PURE__ */ a("span", { className: "text-text-tertiary", children: G ? /* @__PURE__ */ a(qe, { size: 12, title: "Copied" }) : /* @__PURE__ */ a(sr, { size: 12 }) })
|
|
3258
3273
|
]
|
|
3259
3274
|
}
|
|
3260
3275
|
)
|
|
@@ -3265,7 +3280,7 @@ function ns({
|
|
|
3265
3280
|
] })
|
|
3266
3281
|
] }),
|
|
3267
3282
|
/* @__PURE__ */ a(
|
|
3268
|
-
|
|
3283
|
+
Rn,
|
|
3269
3284
|
{
|
|
3270
3285
|
addresses: f,
|
|
3271
3286
|
selectedAddressId: u,
|
|
@@ -3282,22 +3297,22 @@ function ns({
|
|
|
3282
3297
|
/* @__PURE__ */ a("div", { className: "h-px shrink-0 bg-border" }),
|
|
3283
3298
|
/* @__PURE__ */ a("div", { className: "flex-1 min-h-0 overflow-y-auto flex flex-col", children: /* @__PURE__ */ p("div", { className: "flex-1 min-h-0 overflow-y-auto p-2 bg-surface", children: [
|
|
3284
3299
|
t.length === 0 && e.length === 0 && /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center h-full text-center", children: [
|
|
3285
|
-
/* @__PURE__ */ a("div", { className: "w-12 h-12 mx-auto mb-3 rounded-full bg-surface-tertiary flex items-center justify-center text-text-quaternary", children: /* @__PURE__ */ a(
|
|
3300
|
+
/* @__PURE__ */ a("div", { className: "w-12 h-12 mx-auto mb-3 rounded-full bg-surface-tertiary flex items-center justify-center text-text-quaternary", children: /* @__PURE__ */ a(On, {}) }),
|
|
3286
3301
|
/* @__PURE__ */ a("p", { className: "text-sm text-text-quaternary m-0", children: "No items in cart yet" })
|
|
3287
3302
|
] }),
|
|
3288
3303
|
e.length > 0 && /* @__PURE__ */ p(ve, { children: [
|
|
3289
3304
|
e.map((_) => /* @__PURE__ */ a(
|
|
3290
|
-
|
|
3305
|
+
as,
|
|
3291
3306
|
{
|
|
3292
3307
|
item: _,
|
|
3293
3308
|
onSuggestAlternatives: (j) => s(j)
|
|
3294
3309
|
},
|
|
3295
|
-
`${
|
|
3310
|
+
`${rt(_)}-${_.status}`
|
|
3296
3311
|
)),
|
|
3297
3312
|
t.length > 0 && /* @__PURE__ */ a("div", { className: "border-b border-border mb-2" })
|
|
3298
3313
|
] }),
|
|
3299
3314
|
t.map((_) => /* @__PURE__ */ a(
|
|
3300
|
-
|
|
3315
|
+
qn,
|
|
3301
3316
|
{
|
|
3302
3317
|
item: _,
|
|
3303
3318
|
onUpdateQuantity: r,
|
|
@@ -3310,7 +3325,7 @@ function ns({
|
|
|
3310
3325
|
] }) }),
|
|
3311
3326
|
/* @__PURE__ */ a("div", { className: "h-px shrink-0 bg-border" }),
|
|
3312
3327
|
/* @__PURE__ */ a(
|
|
3313
|
-
|
|
3328
|
+
Un,
|
|
3314
3329
|
{
|
|
3315
3330
|
subtotal: se,
|
|
3316
3331
|
tax: V,
|
|
@@ -3328,7 +3343,7 @@ function ns({
|
|
|
3328
3343
|
}
|
|
3329
3344
|
);
|
|
3330
3345
|
}
|
|
3331
|
-
const
|
|
3346
|
+
const os = [
|
|
3332
3347
|
"failed to fetch",
|
|
3333
3348
|
"networkerror",
|
|
3334
3349
|
"network request failed",
|
|
@@ -3337,16 +3352,16 @@ const ss = [
|
|
|
3337
3352
|
"net::err_internet_disconnected",
|
|
3338
3353
|
"net::err_network_changed"
|
|
3339
3354
|
];
|
|
3340
|
-
function
|
|
3355
|
+
function ls(t) {
|
|
3341
3356
|
if (typeof navigator < "u" && !navigator.onLine)
|
|
3342
3357
|
return !0;
|
|
3343
3358
|
const e = t.message.toLowerCase();
|
|
3344
|
-
return
|
|
3359
|
+
return os.some((r) => e.includes(r));
|
|
3345
3360
|
}
|
|
3346
|
-
function
|
|
3361
|
+
function cs({ error: t, onRetry: e }) {
|
|
3347
3362
|
if (!t)
|
|
3348
3363
|
return null;
|
|
3349
|
-
const r =
|
|
3364
|
+
const r = ls(t);
|
|
3350
3365
|
return /* @__PURE__ */ p("div", { className: "mx-4 my-3 px-4 py-3 bg-error-bg border border-error/30 rounded-lg", children: [
|
|
3351
3366
|
/* @__PURE__ */ a("p", { className: "text-sm text-error-text", children: r ? "You're offline. Please check your internet connection and try again." : "Something went wrong. Please try again." }),
|
|
3352
3367
|
e && /* @__PURE__ */ a(
|
|
@@ -3360,7 +3375,7 @@ function is({ error: t, onRetry: e }) {
|
|
|
3360
3375
|
)
|
|
3361
3376
|
] });
|
|
3362
3377
|
}
|
|
3363
|
-
const
|
|
3378
|
+
const ds = () => /* @__PURE__ */ p(
|
|
3364
3379
|
"svg",
|
|
3365
3380
|
{
|
|
3366
3381
|
width: "18",
|
|
@@ -3376,7 +3391,7 @@ const os = () => /* @__PURE__ */ p(
|
|
|
3376
3391
|
]
|
|
3377
3392
|
}
|
|
3378
3393
|
);
|
|
3379
|
-
function
|
|
3394
|
+
function us({
|
|
3380
3395
|
input: t,
|
|
3381
3396
|
onInputChange: e,
|
|
3382
3397
|
onSubmit: r,
|
|
@@ -3413,28 +3428,28 @@ function ls({
|
|
|
3413
3428
|
className: "w-10 h-10 mr-1.5 border-none rounded-lg bg-surface-invert text-text-invert cursor-pointer flex items-center justify-center transition-colors shrink-0 hover:bg-surface-invert-hover disabled:bg-surface-disabled disabled:cursor-not-allowed",
|
|
3414
3429
|
disabled: !t.trim() || n,
|
|
3415
3430
|
"aria-label": "Send message",
|
|
3416
|
-
children: /* @__PURE__ */ a(
|
|
3431
|
+
children: /* @__PURE__ */ a(ds, {})
|
|
3417
3432
|
}
|
|
3418
3433
|
)
|
|
3419
3434
|
]
|
|
3420
3435
|
}
|
|
3421
3436
|
) });
|
|
3422
3437
|
}
|
|
3423
|
-
const
|
|
3424
|
-
function
|
|
3425
|
-
return t.type === "tool" && !
|
|
3438
|
+
const pr = "showProducts", ps = "searchProducts", hs = "searchProductsBySku", Fe = "addToCart", hr = "updateCart", fr = "removeFromCart", mr = "clearCart", gr = "getCart", ut = "getPurchaseOrderData", Ye = "setPoMetadata", yr = "setItemWarnings", xr = "removeItemWarnings", pt = "addProcessingFailures", fs = /* @__PURE__ */ new Set([pr]);
|
|
3439
|
+
function ms(t) {
|
|
3440
|
+
return t.type === "tool" && !fs.has(t.toolName);
|
|
3426
3441
|
}
|
|
3427
|
-
function
|
|
3442
|
+
function gs(t) {
|
|
3428
3443
|
const e = [];
|
|
3429
3444
|
let r = [];
|
|
3430
3445
|
function n() {
|
|
3431
3446
|
r.length >= 2 ? e.push({ type: "tool-group", tools: r }) : r.length === 1 && e.push(r[0]), r = [];
|
|
3432
3447
|
}
|
|
3433
3448
|
for (const i of t)
|
|
3434
|
-
|
|
3449
|
+
ms(i) ? r.push(i) : (n(), e.push(i));
|
|
3435
3450
|
return n(), e;
|
|
3436
3451
|
}
|
|
3437
|
-
const
|
|
3452
|
+
const $t = () => /* @__PURE__ */ p(
|
|
3438
3453
|
"svg",
|
|
3439
3454
|
{
|
|
3440
3455
|
width: "14",
|
|
@@ -3449,7 +3464,7 @@ const At = () => /* @__PURE__ */ p(
|
|
|
3449
3464
|
/* @__PURE__ */ a("polyline", { points: "14 2 14 8 20 8" })
|
|
3450
3465
|
]
|
|
3451
3466
|
}
|
|
3452
|
-
),
|
|
3467
|
+
), br = () => /* @__PURE__ */ p(
|
|
3453
3468
|
"svg",
|
|
3454
3469
|
{
|
|
3455
3470
|
width: "12",
|
|
@@ -3483,7 +3498,7 @@ function ne({
|
|
|
3483
3498
|
}
|
|
3484
3499
|
);
|
|
3485
3500
|
}
|
|
3486
|
-
function
|
|
3501
|
+
function ht(t) {
|
|
3487
3502
|
if (t)
|
|
3488
3503
|
try {
|
|
3489
3504
|
return typeof t == "string" ? JSON.parse(t) : t;
|
|
@@ -3491,7 +3506,7 @@ function pt(t) {
|
|
|
3491
3506
|
return;
|
|
3492
3507
|
}
|
|
3493
3508
|
}
|
|
3494
|
-
function
|
|
3509
|
+
function ys({
|
|
3495
3510
|
toolCallId: t,
|
|
3496
3511
|
toolInput: e,
|
|
3497
3512
|
toolOutput: r,
|
|
@@ -3507,7 +3522,7 @@ function fs({
|
|
|
3507
3522
|
successMessage: ""
|
|
3508
3523
|
}
|
|
3509
3524
|
);
|
|
3510
|
-
const l =
|
|
3525
|
+
const l = ht(r)?.data?.searchProductsBySku?.total ?? 0;
|
|
3511
3526
|
return /* @__PURE__ */ a(
|
|
3512
3527
|
ne,
|
|
3513
3528
|
{
|
|
@@ -3517,7 +3532,7 @@ function fs({
|
|
|
3517
3532
|
}
|
|
3518
3533
|
);
|
|
3519
3534
|
}
|
|
3520
|
-
function
|
|
3535
|
+
function xs({
|
|
3521
3536
|
toolCallId: t,
|
|
3522
3537
|
toolInput: e,
|
|
3523
3538
|
toolOutput: r,
|
|
@@ -3533,7 +3548,7 @@ function ms({
|
|
|
3533
3548
|
successMessage: ""
|
|
3534
3549
|
}
|
|
3535
3550
|
);
|
|
3536
|
-
const l =
|
|
3551
|
+
const l = ht(r)?.data?.searchProducts?.total ?? 0;
|
|
3537
3552
|
return /* @__PURE__ */ a(
|
|
3538
3553
|
ne,
|
|
3539
3554
|
{
|
|
@@ -3543,20 +3558,20 @@ function ms({
|
|
|
3543
3558
|
}
|
|
3544
3559
|
);
|
|
3545
3560
|
}
|
|
3546
|
-
const
|
|
3561
|
+
const vr = Mr(
|
|
3547
3562
|
null
|
|
3548
3563
|
);
|
|
3549
|
-
function
|
|
3564
|
+
function bs({
|
|
3550
3565
|
client: t,
|
|
3551
3566
|
children: e
|
|
3552
3567
|
}) {
|
|
3553
|
-
return /* @__PURE__ */ a(
|
|
3568
|
+
return /* @__PURE__ */ a(vr.Provider, { value: t, children: e });
|
|
3554
3569
|
}
|
|
3555
|
-
function
|
|
3556
|
-
return
|
|
3570
|
+
function ft() {
|
|
3571
|
+
return Fr(vr);
|
|
3557
3572
|
}
|
|
3558
|
-
function
|
|
3559
|
-
return
|
|
3573
|
+
function vs(t, e) {
|
|
3574
|
+
return Dr({
|
|
3560
3575
|
queryKey: [
|
|
3561
3576
|
"productVariants",
|
|
3562
3577
|
e.slice().sort((r, n) => r - n).join(",")
|
|
@@ -3567,7 +3582,7 @@ function ys(t, e) {
|
|
|
3567
3582
|
// 5 minutes
|
|
3568
3583
|
});
|
|
3569
3584
|
}
|
|
3570
|
-
function
|
|
3585
|
+
function Cr(t) {
|
|
3571
3586
|
const e = /* @__PURE__ */ new Map();
|
|
3572
3587
|
for (const r of t.options) {
|
|
3573
3588
|
const n = r.values[0];
|
|
@@ -3575,21 +3590,21 @@ function vr(t) {
|
|
|
3575
3590
|
}
|
|
3576
3591
|
return e;
|
|
3577
3592
|
}
|
|
3578
|
-
function
|
|
3593
|
+
function mt(t, e) {
|
|
3579
3594
|
return t.find((r) => {
|
|
3580
|
-
const n =
|
|
3595
|
+
const n = Cr(r);
|
|
3581
3596
|
return Array.from(e.entries()).every(
|
|
3582
3597
|
([i, s]) => n.get(i) === s
|
|
3583
3598
|
);
|
|
3584
3599
|
}) ?? null;
|
|
3585
3600
|
}
|
|
3586
|
-
function
|
|
3601
|
+
function Bt(t) {
|
|
3587
3602
|
const e = /* @__PURE__ */ new Map();
|
|
3588
3603
|
for (const n of t.productOptions) {
|
|
3589
3604
|
const i = n.values.find((s) => s.isDefault);
|
|
3590
3605
|
i ? e.set(n.entityId, i.entityId) : n.values[0] && e.set(n.entityId, n.values[0].entityId);
|
|
3591
3606
|
}
|
|
3592
|
-
if (!
|
|
3607
|
+
if (!mt(t.variants, e) && t.variants[0]) {
|
|
3593
3608
|
const n = t.variants[0];
|
|
3594
3609
|
e.clear();
|
|
3595
3610
|
for (const i of n.options) {
|
|
@@ -3599,7 +3614,7 @@ function $t(t) {
|
|
|
3599
3614
|
}
|
|
3600
3615
|
return e;
|
|
3601
3616
|
}
|
|
3602
|
-
const
|
|
3617
|
+
const Cs = () => /* @__PURE__ */ a("div", { className: "w-full h-full bg-surface-tertiary flex items-center justify-center text-text-quaternary", children: /* @__PURE__ */ p(
|
|
3603
3618
|
"svg",
|
|
3604
3619
|
{
|
|
3605
3620
|
width: "40",
|
|
@@ -3616,12 +3631,12 @@ const xs = () => /* @__PURE__ */ a("div", { className: "w-full h-full bg-surface
|
|
|
3616
3631
|
]
|
|
3617
3632
|
}
|
|
3618
3633
|
) });
|
|
3619
|
-
function
|
|
3634
|
+
function Is({
|
|
3620
3635
|
variantDetails: t,
|
|
3621
3636
|
selections: e,
|
|
3622
3637
|
onSelectionChange: r
|
|
3623
3638
|
}) {
|
|
3624
|
-
const i = !
|
|
3639
|
+
const i = !mt(
|
|
3625
3640
|
t.variants,
|
|
3626
3641
|
e
|
|
3627
3642
|
);
|
|
@@ -3649,11 +3664,11 @@ function bs({
|
|
|
3649
3664
|
i && /* @__PURE__ */ a("p", { className: "text-xs text-error m-0", role: "alert", "aria-live": "polite", children: "This combination is not available" })
|
|
3650
3665
|
] });
|
|
3651
3666
|
}
|
|
3652
|
-
const
|
|
3653
|
-
function
|
|
3667
|
+
const ws = 10;
|
|
3668
|
+
function Ss(t, e, r) {
|
|
3654
3669
|
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";
|
|
3655
3670
|
}
|
|
3656
|
-
function
|
|
3671
|
+
function Mt({
|
|
3657
3672
|
product: t,
|
|
3658
3673
|
onAddToCart: e,
|
|
3659
3674
|
cart: r = [],
|
|
@@ -3664,9 +3679,9 @@ function Bt({
|
|
|
3664
3679
|
selections: l,
|
|
3665
3680
|
onSelectionChange: c
|
|
3666
3681
|
}) {
|
|
3667
|
-
const [d, f] = L(1), [u, m] = L(!1), [N, b] = L(!1), x = i === "horizontal", v = o && l ?
|
|
3682
|
+
const [d, f] = L(1), [u, m] = L(!1), [N, b] = L(!1), x = i === "horizontal", v = o && l ? mt(o.variants, l) : null, E = v?.entityId ?? t.variantEntityId, I = r.find(
|
|
3668
3683
|
(W) => W.productEntityId === t.productEntityId && W.variantEntityId === E
|
|
3669
|
-
), w = !!I, S = 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 && $ <
|
|
3684
|
+
), w = !!I, S = 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 && $ < ws, Q = v?.inventory?.isInStock ?? t.isInStock, G = v !== null ? (
|
|
3670
3685
|
// Have variant details: check variant stock
|
|
3671
3686
|
!v.isPurchasable || Q === !1 || Q === void 0 && (v.inventory?.aggregated?.availableToSell ?? 0) === 0
|
|
3672
3687
|
) : (
|
|
@@ -3719,7 +3734,7 @@ function Bt({
|
|
|
3719
3734
|
alt: t.name,
|
|
3720
3735
|
className: "w-full h-full object-cover"
|
|
3721
3736
|
}
|
|
3722
|
-
) : /* @__PURE__ */ a(
|
|
3737
|
+
) : /* @__PURE__ */ a(Cs, {}),
|
|
3723
3738
|
!x && G && /* @__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" })
|
|
3724
3739
|
]
|
|
3725
3740
|
}
|
|
@@ -3748,7 +3763,7 @@ function Bt({
|
|
|
3748
3763
|
}
|
|
3749
3764
|
),
|
|
3750
3765
|
/* @__PURE__ */ a("p", { className: "text-xs text-text-quaternary m-0 mt-0.5", children: g }),
|
|
3751
|
-
A !== void 0 && /* @__PURE__ */ a("p", { className: "text-sm font-semibold text-text m-0 mt-1", children:
|
|
3766
|
+
A !== void 0 && /* @__PURE__ */ a("p", { className: "text-sm font-semibold text-text m-0 mt-1", children: Ae(A) }),
|
|
3752
3767
|
G && /* @__PURE__ */ a("p", { className: "text-xs text-error m-0 mt-1 font-medium", children: "Out of Stock" }),
|
|
3753
3768
|
!x && !G && $ !== void 0 && $ > 0 && /* @__PURE__ */ p("p", { className: "text-2xs text-success font-medium m-0 mt-0.5", children: [
|
|
3754
3769
|
$,
|
|
@@ -3757,7 +3772,7 @@ function Bt({
|
|
|
3757
3772
|
x && te
|
|
3758
3773
|
] }),
|
|
3759
3774
|
o && l && c && /* @__PURE__ */ a("div", { className: x ? "mt-2" : "shrink-0 px-3 pt-2", children: /* @__PURE__ */ a(
|
|
3760
|
-
|
|
3775
|
+
Is,
|
|
3761
3776
|
{
|
|
3762
3777
|
variantDetails: o,
|
|
3763
3778
|
selections: l,
|
|
@@ -3781,7 +3796,7 @@ function Bt({
|
|
|
3781
3796
|
className: x ? "flex items-center gap-2 flex-wrap" : "flex flex-col gap-2",
|
|
3782
3797
|
children: [
|
|
3783
3798
|
/* @__PURE__ */ a(
|
|
3784
|
-
|
|
3799
|
+
or,
|
|
3785
3800
|
{
|
|
3786
3801
|
value: d,
|
|
3787
3802
|
onChange: f,
|
|
@@ -3796,7 +3811,7 @@ function Bt({
|
|
|
3796
3811
|
type: "button",
|
|
3797
3812
|
onClick: ae,
|
|
3798
3813
|
disabled: u || N || !!z || G,
|
|
3799
|
-
className: `py-1.5 px-3 text-xs font-medium rounded border-none ${x ? "" : "w-full"} ${
|
|
3814
|
+
className: `py-1.5 px-3 text-xs font-medium rounded border-none ${x ? "" : "w-full"} ${Ss(u, N, !!z || G)}`,
|
|
3800
3815
|
children: u ? "Adding..." : N ? "✓ Added" : "Add to cart"
|
|
3801
3816
|
}
|
|
3802
3817
|
)
|
|
@@ -3813,7 +3828,7 @@ function Bt({
|
|
|
3813
3828
|
}
|
|
3814
3829
|
);
|
|
3815
3830
|
}
|
|
3816
|
-
function
|
|
3831
|
+
function Ns({
|
|
3817
3832
|
products: t,
|
|
3818
3833
|
onAddToCart: e,
|
|
3819
3834
|
onViewProduct: r,
|
|
@@ -3822,10 +3837,10 @@ function Is({
|
|
|
3822
3837
|
loadingText: s = "Searching for products...",
|
|
3823
3838
|
className: o = ""
|
|
3824
3839
|
}) {
|
|
3825
|
-
const l =
|
|
3840
|
+
const l = ft(), c = oe(
|
|
3826
3841
|
() => t.filter((v) => v.productEntityId !== void 0).map((v) => v.productEntityId),
|
|
3827
3842
|
[t]
|
|
3828
|
-
), { data: d } =
|
|
3843
|
+
), { data: d } = vs(
|
|
3829
3844
|
l,
|
|
3830
3845
|
l ? c : []
|
|
3831
3846
|
), f = oe(() => {
|
|
@@ -3849,9 +3864,9 @@ function Is({
|
|
|
3849
3864
|
const g = w.variants.find(
|
|
3850
3865
|
(A) => A.entityId === I.variantEntityId
|
|
3851
3866
|
);
|
|
3852
|
-
g ? S =
|
|
3867
|
+
g ? S = Cr(g) : S = Bt(w);
|
|
3853
3868
|
} else
|
|
3854
|
-
S =
|
|
3869
|
+
S = Bt(w);
|
|
3855
3870
|
E.set(I.id, S);
|
|
3856
3871
|
}
|
|
3857
3872
|
return E;
|
|
@@ -3875,7 +3890,7 @@ function Is({
|
|
|
3875
3890
|
if (b.length === 1 && x) {
|
|
3876
3891
|
const v = x.productEntityId !== void 0 ? f.get(x.productEntityId) : void 0, E = u.get(x.id);
|
|
3877
3892
|
return /* @__PURE__ */ a("div", { className: `py-2 ${o}`, children: /* @__PURE__ */ a(
|
|
3878
|
-
|
|
3893
|
+
Mt,
|
|
3879
3894
|
{
|
|
3880
3895
|
layout: "horizontal",
|
|
3881
3896
|
product: x,
|
|
@@ -3891,7 +3906,7 @@ function Is({
|
|
|
3891
3906
|
return /* @__PURE__ */ a("div", { className: `flex flex-wrap gap-3 py-2 ${o}`, children: b.map((v) => {
|
|
3892
3907
|
const E = v.productEntityId !== void 0 ? f.get(v.productEntityId) : void 0, I = u.get(v.id);
|
|
3893
3908
|
return /* @__PURE__ */ a(
|
|
3894
|
-
|
|
3909
|
+
Mt,
|
|
3895
3910
|
{
|
|
3896
3911
|
product: v,
|
|
3897
3912
|
onAddToCart: e,
|
|
@@ -3905,14 +3920,14 @@ function Is({
|
|
|
3905
3920
|
);
|
|
3906
3921
|
}) });
|
|
3907
3922
|
}
|
|
3908
|
-
function
|
|
3923
|
+
function ks({
|
|
3909
3924
|
toolInput: t,
|
|
3910
3925
|
toolState: e,
|
|
3911
3926
|
cart: r,
|
|
3912
3927
|
onAddToCart: n,
|
|
3913
3928
|
onViewProduct: i
|
|
3914
3929
|
}) {
|
|
3915
|
-
const s =
|
|
3930
|
+
const s = ft(), [o, l] = L([]), [c, d] = L(!0), [f, u] = L(null), m = e !== "output-available";
|
|
3916
3931
|
return F(() => {
|
|
3917
3932
|
async function N() {
|
|
3918
3933
|
if (!s) {
|
|
@@ -3960,7 +3975,7 @@ function ws({
|
|
|
3960
3975
|
}
|
|
3961
3976
|
N();
|
|
3962
3977
|
}, [s, t]), f ? /* @__PURE__ */ a("div", { className: "py-2 text-sm text-error-text", children: f }) : /* @__PURE__ */ a(
|
|
3963
|
-
|
|
3978
|
+
Ns,
|
|
3964
3979
|
{
|
|
3965
3980
|
products: o,
|
|
3966
3981
|
onAddToCart: n,
|
|
@@ -3971,7 +3986,7 @@ function ws({
|
|
|
3971
3986
|
}
|
|
3972
3987
|
);
|
|
3973
3988
|
}
|
|
3974
|
-
function
|
|
3989
|
+
function Ir({
|
|
3975
3990
|
toolCallId: t,
|
|
3976
3991
|
toolName: e,
|
|
3977
3992
|
toolInput: r,
|
|
@@ -3981,8 +3996,8 @@ function Cr({
|
|
|
3981
3996
|
onAddToCart: o,
|
|
3982
3997
|
onViewProduct: l
|
|
3983
3998
|
}) {
|
|
3984
|
-
return e ===
|
|
3985
|
-
|
|
3999
|
+
return e === pr ? /* @__PURE__ */ a("div", { className: "mt-3", children: /* @__PURE__ */ a(
|
|
4000
|
+
ks,
|
|
3986
4001
|
{
|
|
3987
4002
|
toolInput: r,
|
|
3988
4003
|
toolOutput: n,
|
|
@@ -3991,23 +4006,23 @@ function Cr({
|
|
|
3991
4006
|
onAddToCart: o,
|
|
3992
4007
|
onViewProduct: l
|
|
3993
4008
|
}
|
|
3994
|
-
) }) : e ===
|
|
3995
|
-
|
|
4009
|
+
) }) : e === ps ? /* @__PURE__ */ a(
|
|
4010
|
+
xs,
|
|
3996
4011
|
{
|
|
3997
4012
|
toolCallId: t,
|
|
3998
4013
|
toolInput: r,
|
|
3999
4014
|
toolOutput: n,
|
|
4000
4015
|
toolState: i ?? ""
|
|
4001
4016
|
}
|
|
4002
|
-
) : e ===
|
|
4003
|
-
|
|
4017
|
+
) : e === hs ? /* @__PURE__ */ a(
|
|
4018
|
+
ys,
|
|
4004
4019
|
{
|
|
4005
4020
|
toolCallId: t,
|
|
4006
4021
|
toolInput: r,
|
|
4007
4022
|
toolOutput: n,
|
|
4008
4023
|
toolState: i ?? ""
|
|
4009
4024
|
}
|
|
4010
|
-
) : e ===
|
|
4025
|
+
) : e === Fe ? /* @__PURE__ */ a(
|
|
4011
4026
|
ne,
|
|
4012
4027
|
{
|
|
4013
4028
|
toolCallId: t,
|
|
@@ -4016,7 +4031,7 @@ function Cr({
|
|
|
4016
4031
|
successMessage: "Added to cart",
|
|
4017
4032
|
toolOutput: n
|
|
4018
4033
|
}
|
|
4019
|
-
) : e ===
|
|
4034
|
+
) : e === hr ? /* @__PURE__ */ a(
|
|
4020
4035
|
ne,
|
|
4021
4036
|
{
|
|
4022
4037
|
toolCallId: t,
|
|
@@ -4025,7 +4040,7 @@ function Cr({
|
|
|
4025
4040
|
successMessage: "Updated cart",
|
|
4026
4041
|
toolOutput: n
|
|
4027
4042
|
}
|
|
4028
|
-
) : e ===
|
|
4043
|
+
) : e === fr ? /* @__PURE__ */ a(
|
|
4029
4044
|
ne,
|
|
4030
4045
|
{
|
|
4031
4046
|
toolCallId: t,
|
|
@@ -4034,7 +4049,7 @@ function Cr({
|
|
|
4034
4049
|
successMessage: "Removed from cart",
|
|
4035
4050
|
toolOutput: n
|
|
4036
4051
|
}
|
|
4037
|
-
) : e ===
|
|
4052
|
+
) : e === mr ? /* @__PURE__ */ a(
|
|
4038
4053
|
ne,
|
|
4039
4054
|
{
|
|
4040
4055
|
toolCallId: t,
|
|
@@ -4043,7 +4058,7 @@ function Cr({
|
|
|
4043
4058
|
successMessage: "Cart cleared",
|
|
4044
4059
|
toolOutput: n
|
|
4045
4060
|
}
|
|
4046
|
-
) : e ===
|
|
4061
|
+
) : e === gr ? /* @__PURE__ */ a(
|
|
4047
4062
|
ne,
|
|
4048
4063
|
{
|
|
4049
4064
|
toolCallId: t,
|
|
@@ -4051,7 +4066,7 @@ function Cr({
|
|
|
4051
4066
|
successMessage: "Retrieved cart",
|
|
4052
4067
|
toolOutput: n
|
|
4053
4068
|
}
|
|
4054
|
-
) : e ===
|
|
4069
|
+
) : e === ut ? /* @__PURE__ */ a(
|
|
4055
4070
|
ne,
|
|
4056
4071
|
{
|
|
4057
4072
|
toolCallId: t,
|
|
@@ -4059,7 +4074,7 @@ function Cr({
|
|
|
4059
4074
|
successMessage: "Retrieved PO",
|
|
4060
4075
|
toolOutput: n
|
|
4061
4076
|
}
|
|
4062
|
-
) : e ===
|
|
4077
|
+
) : e === Ye ? /* @__PURE__ */ a(
|
|
4063
4078
|
ne,
|
|
4064
4079
|
{
|
|
4065
4080
|
toolCallId: t,
|
|
@@ -4067,7 +4082,7 @@ function Cr({
|
|
|
4067
4082
|
successMessage: "Saved metadata",
|
|
4068
4083
|
toolOutput: n
|
|
4069
4084
|
}
|
|
4070
|
-
) : e ===
|
|
4085
|
+
) : e === yr ? /* @__PURE__ */ a(
|
|
4071
4086
|
ne,
|
|
4072
4087
|
{
|
|
4073
4088
|
toolCallId: t,
|
|
@@ -4075,7 +4090,7 @@ function Cr({
|
|
|
4075
4090
|
successMessage: "Warnings updated",
|
|
4076
4091
|
toolOutput: n
|
|
4077
4092
|
}
|
|
4078
|
-
) : e ===
|
|
4093
|
+
) : e === xr ? /* @__PURE__ */ a(
|
|
4079
4094
|
ne,
|
|
4080
4095
|
{
|
|
4081
4096
|
toolCallId: t,
|
|
@@ -4085,7 +4100,7 @@ function Cr({
|
|
|
4085
4100
|
}
|
|
4086
4101
|
) : null;
|
|
4087
4102
|
}
|
|
4088
|
-
function
|
|
4103
|
+
function Es({
|
|
4089
4104
|
tools: t,
|
|
4090
4105
|
messageId: e,
|
|
4091
4106
|
cart: r,
|
|
@@ -4108,7 +4123,7 @@ function Ss({
|
|
|
4108
4123
|
{
|
|
4109
4124
|
className: `transition-transform duration-200 ${s ? "rotate-90" : ""}`,
|
|
4110
4125
|
"aria-hidden": "true",
|
|
4111
|
-
children: /* @__PURE__ */ a(
|
|
4126
|
+
children: /* @__PURE__ */ a(br, {})
|
|
4112
4127
|
}
|
|
4113
4128
|
),
|
|
4114
4129
|
/* @__PURE__ */ p("span", { className: "flex-1 text-left", children: [
|
|
@@ -4126,7 +4141,7 @@ function Ss({
|
|
|
4126
4141
|
"data-testid": "collapsible-panel",
|
|
4127
4142
|
className: `collapsible-panel ${s ? "collapsible-panel-open" : ""}`,
|
|
4128
4143
|
children: /* @__PURE__ */ a("div", { className: "overflow-hidden", children: /* @__PURE__ */ a("div", { className: "pl-2.5 border-l border-gray-200 ml-[1px] my-2", children: t.map((l) => /* @__PURE__ */ a(
|
|
4129
|
-
|
|
4144
|
+
Ir,
|
|
4130
4145
|
{
|
|
4131
4146
|
toolCallId: l.toolCallId,
|
|
4132
4147
|
toolName: l.toolName,
|
|
@@ -4143,17 +4158,17 @@ function Ss({
|
|
|
4143
4158
|
)
|
|
4144
4159
|
] });
|
|
4145
4160
|
}
|
|
4146
|
-
const
|
|
4147
|
-
id:
|
|
4161
|
+
const Ps = bt.object({
|
|
4162
|
+
id: bt.string()
|
|
4148
4163
|
});
|
|
4149
|
-
async function
|
|
4164
|
+
async function Ts(t, e) {
|
|
4150
4165
|
if (!t.body)
|
|
4151
4166
|
throw new Error("No response body");
|
|
4152
4167
|
const r = [], n = /* @__PURE__ */ new Set(), i = [];
|
|
4153
4168
|
let s = null, o = null;
|
|
4154
|
-
const c =
|
|
4169
|
+
const c = qr({
|
|
4155
4170
|
stream: t.body,
|
|
4156
|
-
schema:
|
|
4171
|
+
schema: jr
|
|
4157
4172
|
}).getReader();
|
|
4158
4173
|
try {
|
|
4159
4174
|
for (; ; ) {
|
|
@@ -4205,8 +4220,8 @@ async function ks(t, e) {
|
|
|
4205
4220
|
errorMessage: o
|
|
4206
4221
|
};
|
|
4207
4222
|
}
|
|
4208
|
-
async function
|
|
4209
|
-
const { origin: r, projectId: n, apiKey: i } = t, s = await
|
|
4223
|
+
async function wr(t, e) {
|
|
4224
|
+
const { origin: r, projectId: n, apiKey: i } = t, s = await ke(
|
|
4210
4225
|
`${r}/project/${n}/agents/threads`,
|
|
4211
4226
|
{
|
|
4212
4227
|
method: "POST",
|
|
@@ -4224,10 +4239,10 @@ async function Ir(t, e) {
|
|
|
4224
4239
|
);
|
|
4225
4240
|
}
|
|
4226
4241
|
const o = await s.json();
|
|
4227
|
-
return
|
|
4242
|
+
return Ps.parse(o).id;
|
|
4228
4243
|
}
|
|
4229
|
-
async function
|
|
4230
|
-
const { sseOrigin: i, projectId: s, apiKey: o } = t, l = await
|
|
4244
|
+
async function As(t, e, r, n) {
|
|
4245
|
+
const { sseOrigin: i, projectId: s, apiKey: o } = t, l = await ke(
|
|
4231
4246
|
`${i}/project/${s}/agents/messages`,
|
|
4232
4247
|
{
|
|
4233
4248
|
method: "POST",
|
|
@@ -4263,7 +4278,7 @@ async function Es(t, e, r, n) {
|
|
|
4263
4278
|
}
|
|
4264
4279
|
return l;
|
|
4265
4280
|
}
|
|
4266
|
-
const
|
|
4281
|
+
const $s = `
|
|
4267
4282
|
mutation SendFeedback(
|
|
4268
4283
|
$messageId: String!
|
|
4269
4284
|
$name: String!
|
|
@@ -4280,15 +4295,15 @@ const Ps = `
|
|
|
4280
4295
|
)
|
|
4281
4296
|
}
|
|
4282
4297
|
`;
|
|
4283
|
-
async function
|
|
4284
|
-
const { origin: r, projectId: n, apiKey: i } = t, s = await
|
|
4298
|
+
async function Bs(t, e) {
|
|
4299
|
+
const { origin: r, projectId: n, apiKey: i } = t, s = await ke(`${r}/project/${n}/graphql`, {
|
|
4285
4300
|
method: "POST",
|
|
4286
4301
|
headers: {
|
|
4287
4302
|
"Content-Type": "application/json",
|
|
4288
4303
|
Authorization: `Bearer ${i}`
|
|
4289
4304
|
},
|
|
4290
4305
|
body: JSON.stringify({
|
|
4291
|
-
query:
|
|
4306
|
+
query: $s,
|
|
4292
4307
|
variables: {
|
|
4293
4308
|
messageId: e.messageId,
|
|
4294
4309
|
name: e.name,
|
|
@@ -4311,7 +4326,7 @@ async function Ts(t, e) {
|
|
|
4311
4326
|
);
|
|
4312
4327
|
return !0;
|
|
4313
4328
|
}
|
|
4314
|
-
const
|
|
4329
|
+
const Ms = {
|
|
4315
4330
|
end: () => {
|
|
4316
4331
|
},
|
|
4317
4332
|
setStatus: () => {
|
|
@@ -4319,15 +4334,15 @@ const As = {
|
|
|
4319
4334
|
setAttribute: () => {
|
|
4320
4335
|
}
|
|
4321
4336
|
};
|
|
4322
|
-
let
|
|
4323
|
-
function
|
|
4324
|
-
|
|
4337
|
+
let Ue = null;
|
|
4338
|
+
function Di(t) {
|
|
4339
|
+
Ue = t;
|
|
4325
4340
|
}
|
|
4326
|
-
function
|
|
4327
|
-
return
|
|
4341
|
+
function nt(t) {
|
|
4342
|
+
return Ue ? Ue.startInactiveSpan(t) : Ms;
|
|
4328
4343
|
}
|
|
4329
|
-
function
|
|
4330
|
-
|
|
4344
|
+
function Fs(t, e) {
|
|
4345
|
+
Ue && Ue.captureFeedback(
|
|
4331
4346
|
t,
|
|
4332
4347
|
e?.tags ? {
|
|
4333
4348
|
captureContext: {
|
|
@@ -4336,7 +4351,7 @@ function $s(t, e) {
|
|
|
4336
4351
|
} : void 0
|
|
4337
4352
|
);
|
|
4338
4353
|
}
|
|
4339
|
-
function
|
|
4354
|
+
function Ft({
|
|
4340
4355
|
messageId: t,
|
|
4341
4356
|
isOpen: e,
|
|
4342
4357
|
onClose: r
|
|
@@ -4361,7 +4376,7 @@ function Mt({
|
|
|
4361
4376
|
if (w.preventDefault(), !(!n.trim() || !l.trim())) {
|
|
4362
4377
|
f("submitting"), m("");
|
|
4363
4378
|
try {
|
|
4364
|
-
|
|
4379
|
+
Fs(
|
|
4365
4380
|
{
|
|
4366
4381
|
name: n.trim(),
|
|
4367
4382
|
email: s.trim() || void 0,
|
|
@@ -4378,7 +4393,7 @@ function Mt({
|
|
|
4378
4393
|
}
|
|
4379
4394
|
}
|
|
4380
4395
|
}
|
|
4381
|
-
), await
|
|
4396
|
+
), await Bs(b, {
|
|
4382
4397
|
messageId: t,
|
|
4383
4398
|
name: n.trim(),
|
|
4384
4399
|
email: s.trim(),
|
|
@@ -4426,7 +4441,7 @@ function Mt({
|
|
|
4426
4441
|
onClick: r,
|
|
4427
4442
|
className: "p-1 rounded-md hover:bg-surface-secondary transition-colors",
|
|
4428
4443
|
"aria-label": "Close dialog",
|
|
4429
|
-
children: /* @__PURE__ */ a(
|
|
4444
|
+
children: /* @__PURE__ */ a(dt, {})
|
|
4430
4445
|
}
|
|
4431
4446
|
)
|
|
4432
4447
|
] }),
|
|
@@ -4513,7 +4528,7 @@ function Mt({
|
|
|
4513
4528
|
disabled: !n.trim() || !l.trim() || d === "submitting" || d === "success",
|
|
4514
4529
|
className: "w-full flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium text-text-invert bg-surface-invert rounded-md hover:bg-surface-invert-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
4515
4530
|
children: d === "submitting" ? /* @__PURE__ */ p(ve, { children: [
|
|
4516
|
-
/* @__PURE__ */ a(
|
|
4531
|
+
/* @__PURE__ */ a(Me, { size: 16 }),
|
|
4517
4532
|
"Sending..."
|
|
4518
4533
|
] }) : d === "success" ? "Sent!" : "Send Feedback"
|
|
4519
4534
|
}
|
|
@@ -4526,7 +4541,7 @@ function Mt({
|
|
|
4526
4541
|
}
|
|
4527
4542
|
) : null;
|
|
4528
4543
|
}
|
|
4529
|
-
const
|
|
4544
|
+
const Ot = ({ size: t = 12 }) => /* @__PURE__ */ p(
|
|
4530
4545
|
"svg",
|
|
4531
4546
|
{
|
|
4532
4547
|
width: t,
|
|
@@ -4544,7 +4559,7 @@ const Ft = ({ size: t = 12 }) => /* @__PURE__ */ p(
|
|
|
4544
4559
|
]
|
|
4545
4560
|
}
|
|
4546
4561
|
);
|
|
4547
|
-
function
|
|
4562
|
+
function Os({
|
|
4548
4563
|
messagePartId: t,
|
|
4549
4564
|
messageId: e,
|
|
4550
4565
|
isLatestAssistantMessage: r,
|
|
@@ -4556,7 +4571,7 @@ function Bs({
|
|
|
4556
4571
|
(f) => f.toggleMessageExpanded
|
|
4557
4572
|
), l = r || s.includes(t), [c, d] = L(!1);
|
|
4558
4573
|
return r ? /* @__PURE__ */ p("div", { className: "my-2 flex items-center gap-2", children: [
|
|
4559
|
-
/* @__PURE__ */ a("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ a(
|
|
4574
|
+
/* @__PURE__ */ a("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ a(Qe, { className: "leading-relaxed text-text", plugins: {}, children: n }) }),
|
|
4560
4575
|
/* @__PURE__ */ a(
|
|
4561
4576
|
"button",
|
|
4562
4577
|
{
|
|
@@ -4565,11 +4580,11 @@ function Bs({
|
|
|
4565
4580
|
className: "shrink-0 p-1 rounded text-text-tertiary hover:text-text hover:bg-surface-secondary transition-colors",
|
|
4566
4581
|
"aria-label": "Send feedback",
|
|
4567
4582
|
title: "Send feedback",
|
|
4568
|
-
children: /* @__PURE__ */ a(
|
|
4583
|
+
children: /* @__PURE__ */ a(Ot, { size: 14 })
|
|
4569
4584
|
}
|
|
4570
4585
|
),
|
|
4571
4586
|
/* @__PURE__ */ a(
|
|
4572
|
-
|
|
4587
|
+
Ft,
|
|
4573
4588
|
{
|
|
4574
4589
|
messageId: e,
|
|
4575
4590
|
isOpen: c,
|
|
@@ -4593,7 +4608,7 @@ function Bs({
|
|
|
4593
4608
|
{
|
|
4594
4609
|
className: `transition-transform duration-200 ${l ? "rotate-90" : ""}`,
|
|
4595
4610
|
"aria-hidden": "true",
|
|
4596
|
-
children: /* @__PURE__ */ a(
|
|
4611
|
+
children: /* @__PURE__ */ a(br, {})
|
|
4597
4612
|
}
|
|
4598
4613
|
),
|
|
4599
4614
|
/* @__PURE__ */ a("span", { className: "flex-1 text-left truncate", children: l ? "Hide message" : i })
|
|
@@ -4607,7 +4622,7 @@ function Bs({
|
|
|
4607
4622
|
"data-testid": "collapsible-message-panel",
|
|
4608
4623
|
className: `collapsible-panel ${l ? "collapsible-panel-open" : ""}`,
|
|
4609
4624
|
children: /* @__PURE__ */ a("div", { className: "overflow-hidden", children: /* @__PURE__ */ a("div", { className: "pl-2.5 border-l border-gray-200 ml-[1px] my-2", children: /* @__PURE__ */ a(
|
|
4610
|
-
|
|
4625
|
+
Qe,
|
|
4611
4626
|
{
|
|
4612
4627
|
className: "text-xs leading-relaxed text-text",
|
|
4613
4628
|
plugins: {},
|
|
@@ -4625,12 +4640,12 @@ function Bs({
|
|
|
4625
4640
|
className: "shrink-0 p-1 rounded text-text-tertiary hover:text-text hover:bg-surface-secondary transition-colors",
|
|
4626
4641
|
"aria-label": "Send feedback",
|
|
4627
4642
|
title: "Send feedback",
|
|
4628
|
-
children: /* @__PURE__ */ a(
|
|
4643
|
+
children: /* @__PURE__ */ a(Ot, { size: 14 })
|
|
4629
4644
|
}
|
|
4630
4645
|
)
|
|
4631
4646
|
] }),
|
|
4632
4647
|
/* @__PURE__ */ a(
|
|
4633
|
-
|
|
4648
|
+
Ft,
|
|
4634
4649
|
{
|
|
4635
4650
|
messageId: e,
|
|
4636
4651
|
isOpen: c,
|
|
@@ -4639,12 +4654,12 @@ function Bs({
|
|
|
4639
4654
|
)
|
|
4640
4655
|
] });
|
|
4641
4656
|
}
|
|
4642
|
-
function
|
|
4657
|
+
function Ls(t) {
|
|
4643
4658
|
if (!t.parts)
|
|
4644
4659
|
return [];
|
|
4645
4660
|
const e = [];
|
|
4646
4661
|
for (const r of t.parts)
|
|
4647
|
-
if (r.type === "text" && r.text !==
|
|
4662
|
+
if (r.type === "text" && r.text !== ot)
|
|
4648
4663
|
e.push({
|
|
4649
4664
|
type: "text",
|
|
4650
4665
|
text: r.text
|
|
@@ -4662,11 +4677,11 @@ function Ms(t) {
|
|
|
4662
4677
|
}
|
|
4663
4678
|
return e;
|
|
4664
4679
|
}
|
|
4665
|
-
function
|
|
4680
|
+
function Rs(t) {
|
|
4666
4681
|
const e = t?.find((r) => r.type === "file");
|
|
4667
4682
|
return e && "filename" in e && typeof e.filename == "string" ? e.filename : "Attachment";
|
|
4668
4683
|
}
|
|
4669
|
-
function
|
|
4684
|
+
function Ds({
|
|
4670
4685
|
message: t,
|
|
4671
4686
|
isFirstUserMessage: e,
|
|
4672
4687
|
isLatestAssistantMessage: r,
|
|
@@ -4677,7 +4692,7 @@ function Os({
|
|
|
4677
4692
|
onAddToCart: l,
|
|
4678
4693
|
onViewProduct: c
|
|
4679
4694
|
}) {
|
|
4680
|
-
const d = t.role === "assistant", f =
|
|
4695
|
+
const d = t.role === "assistant", f = Ls(t);
|
|
4681
4696
|
return f.length === 0 ? null : /* @__PURE__ */ a(
|
|
4682
4697
|
"div",
|
|
4683
4698
|
{
|
|
@@ -4690,7 +4705,7 @@ function Os({
|
|
|
4690
4705
|
onClick: i,
|
|
4691
4706
|
className: "flex items-center gap-2 px-3 py-2 bg-surface hover:bg-surface-secondary rounded-lg transition-colors border border-border text-left w-full",
|
|
4692
4707
|
children: [
|
|
4693
|
-
/* @__PURE__ */ a(
|
|
4708
|
+
/* @__PURE__ */ a($t, {}),
|
|
4694
4709
|
/* @__PURE__ */ a("span", { className: "text-sm text-text font-medium truncate min-w-0", children: s || "Uploaded Document" }),
|
|
4695
4710
|
/* @__PURE__ */ p(
|
|
4696
4711
|
"svg",
|
|
@@ -4712,7 +4727,7 @@ function Os({
|
|
|
4712
4727
|
}
|
|
4713
4728
|
),
|
|
4714
4729
|
n && /* @__PURE__ */ a("div", { className: "mt-2 p-3 bg-surface border border-border rounded-lg max-h-96 overflow-y-auto", children: f.map((u, m) => u.type === "text" ? /* @__PURE__ */ a(
|
|
4715
|
-
|
|
4730
|
+
Qe,
|
|
4716
4731
|
{
|
|
4717
4732
|
className: "text-sm leading-normal text-text",
|
|
4718
4733
|
plugins: {},
|
|
@@ -4721,8 +4736,8 @@ function Os({
|
|
|
4721
4736
|
`text-${t.id}-${m}`
|
|
4722
4737
|
) : null) })
|
|
4723
4738
|
] }) : /* @__PURE__ */ p(ve, { children: [
|
|
4724
|
-
|
|
4725
|
-
|
|
4739
|
+
gs(f).map((u, m) => u.type === "tool-group" ? /* @__PURE__ */ a(
|
|
4740
|
+
Es,
|
|
4726
4741
|
{
|
|
4727
4742
|
tools: u.tools,
|
|
4728
4743
|
messageId: `${t.id}-${m}`,
|
|
@@ -4732,7 +4747,7 @@ function Os({
|
|
|
4732
4747
|
},
|
|
4733
4748
|
`group-${t.id}-${m}`
|
|
4734
4749
|
) : u.type === "text" ? d ? /* @__PURE__ */ a(
|
|
4735
|
-
|
|
4750
|
+
Os,
|
|
4736
4751
|
{
|
|
4737
4752
|
messagePartId: `${t.id}-${m}`,
|
|
4738
4753
|
messageId: t.id,
|
|
@@ -4745,7 +4760,7 @@ function Os({
|
|
|
4745
4760
|
{
|
|
4746
4761
|
className: "rounded-2xl bg-surface-tertiary px-4 py-2.5",
|
|
4747
4762
|
children: /* @__PURE__ */ a(
|
|
4748
|
-
|
|
4763
|
+
Qe,
|
|
4749
4764
|
{
|
|
4750
4765
|
className: "text-sm leading-relaxed text-text",
|
|
4751
4766
|
plugins: {},
|
|
@@ -4755,7 +4770,7 @@ function Os({
|
|
|
4755
4770
|
},
|
|
4756
4771
|
`text-${t.id}-${m}`
|
|
4757
4772
|
) : u.type === "tool" ? /* @__PURE__ */ a("div", { className: "ml-5", children: /* @__PURE__ */ a(
|
|
4758
|
-
|
|
4773
|
+
Ir,
|
|
4759
4774
|
{
|
|
4760
4775
|
toolCallId: u.toolCallId,
|
|
4761
4776
|
toolName: u.toolName,
|
|
@@ -4768,14 +4783,14 @@ function Os({
|
|
|
4768
4783
|
}
|
|
4769
4784
|
) }, u.toolCallId) : null),
|
|
4770
4785
|
!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: [
|
|
4771
|
-
/* @__PURE__ */ a(
|
|
4772
|
-
/* @__PURE__ */ a("span", { children:
|
|
4786
|
+
/* @__PURE__ */ a($t, {}),
|
|
4787
|
+
/* @__PURE__ */ a("span", { children: Rs(t.parts) })
|
|
4773
4788
|
] })
|
|
4774
4789
|
] }) })
|
|
4775
4790
|
}
|
|
4776
4791
|
);
|
|
4777
4792
|
}
|
|
4778
|
-
function
|
|
4793
|
+
function Sr() {
|
|
4779
4794
|
const [t, e] = L(!1);
|
|
4780
4795
|
return F(() => {
|
|
4781
4796
|
if (typeof window.matchMedia != "function") {
|
|
@@ -4790,7 +4805,7 @@ function wr() {
|
|
|
4790
4805
|
return r.addEventListener("change", n), () => r.removeEventListener("change", n);
|
|
4791
4806
|
}, []), t;
|
|
4792
4807
|
}
|
|
4793
|
-
const
|
|
4808
|
+
const Nr = () => /* @__PURE__ */ p(
|
|
4794
4809
|
"svg",
|
|
4795
4810
|
{
|
|
4796
4811
|
width: "48",
|
|
@@ -4807,7 +4822,7 @@ const Sr = () => /* @__PURE__ */ p(
|
|
|
4807
4822
|
/* @__PURE__ */ a("polyline", { points: "9 15 12 12 15 15" })
|
|
4808
4823
|
]
|
|
4809
4824
|
}
|
|
4810
|
-
),
|
|
4825
|
+
), _s = () => /* @__PURE__ */ p(
|
|
4811
4826
|
"svg",
|
|
4812
4827
|
{
|
|
4813
4828
|
width: "16",
|
|
@@ -4825,7 +4840,7 @@ const Sr = () => /* @__PURE__ */ p(
|
|
|
4825
4840
|
]
|
|
4826
4841
|
}
|
|
4827
4842
|
);
|
|
4828
|
-
function
|
|
4843
|
+
function kr({ onClick: t }) {
|
|
4829
4844
|
return /* @__PURE__ */ p(
|
|
4830
4845
|
"button",
|
|
4831
4846
|
{
|
|
@@ -4833,13 +4848,13 @@ function Nr({ onClick: t }) {
|
|
|
4833
4848
|
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",
|
|
4834
4849
|
onClick: t,
|
|
4835
4850
|
children: [
|
|
4836
|
-
/* @__PURE__ */ a(
|
|
4851
|
+
/* @__PURE__ */ a(_s, {}),
|
|
4837
4852
|
"Take a photo"
|
|
4838
4853
|
]
|
|
4839
4854
|
}
|
|
4840
4855
|
);
|
|
4841
4856
|
}
|
|
4842
|
-
function
|
|
4857
|
+
function Us({
|
|
4843
4858
|
isDragging: t = !1,
|
|
4844
4859
|
fileInputRef: e,
|
|
4845
4860
|
cameraInputRef: r,
|
|
@@ -4848,7 +4863,7 @@ function Rs({
|
|
|
4848
4863
|
onDropZoneClick: s,
|
|
4849
4864
|
onCameraClick: o
|
|
4850
4865
|
}) {
|
|
4851
|
-
const l =
|
|
4866
|
+
const l = Sr();
|
|
4852
4867
|
return /* @__PURE__ */ a("div", { className: "flex-1 flex items-center justify-center animate-fade-in-up", children: /* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-4", children: [
|
|
4853
4868
|
/* @__PURE__ */ p(
|
|
4854
4869
|
"button",
|
|
@@ -4864,7 +4879,7 @@ function Rs({
|
|
|
4864
4879
|
type: "file",
|
|
4865
4880
|
className: "hidden",
|
|
4866
4881
|
onChange: i,
|
|
4867
|
-
accept:
|
|
4882
|
+
accept: tr
|
|
4868
4883
|
}
|
|
4869
4884
|
),
|
|
4870
4885
|
/* @__PURE__ */ a(
|
|
@@ -4881,16 +4896,16 @@ function Rs({
|
|
|
4881
4896
|
/* @__PURE__ */ a(
|
|
4882
4897
|
"div",
|
|
4883
4898
|
{
|
|
4884
|
-
className:
|
|
4899
|
+
className: Ee(
|
|
4885
4900
|
"flex items-center justify-center w-16 h-16 rounded-2xl p-1 border-2 border-dashed border-border-focus text-text transition-transform duration-200",
|
|
4886
4901
|
t && "animate-icon-bounce"
|
|
4887
4902
|
),
|
|
4888
|
-
children: /* @__PURE__ */ a(
|
|
4903
|
+
children: /* @__PURE__ */ a(Nr, {})
|
|
4889
4904
|
}
|
|
4890
4905
|
),
|
|
4891
4906
|
/* @__PURE__ */ a("h3", { className: "m-0 text-base font-semibold text-text text-center", children: "Upload your Order" }),
|
|
4892
4907
|
/* @__PURE__ */ a("p", { className: "m-0 text-sm text-text-tertiary text-center", children: "Your Order Assistant will match products and check stock availability" }),
|
|
4893
|
-
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2", children:
|
|
4908
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2", children: rr.map((c) => /* @__PURE__ */ a(
|
|
4894
4909
|
"span",
|
|
4895
4910
|
{
|
|
4896
4911
|
className: "py-1 px-3 bg-surface-invert/5 border border-border-strong rounded-full text-xs font-medium text-text",
|
|
@@ -4901,11 +4916,11 @@ function Rs({
|
|
|
4901
4916
|
]
|
|
4902
4917
|
}
|
|
4903
4918
|
),
|
|
4904
|
-
l && /* @__PURE__ */ a(
|
|
4919
|
+
l && /* @__PURE__ */ a(kr, { onClick: o }),
|
|
4905
4920
|
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 })
|
|
4906
4921
|
] }) });
|
|
4907
4922
|
}
|
|
4908
|
-
function
|
|
4923
|
+
function qs() {
|
|
4909
4924
|
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: [
|
|
4910
4925
|
/* @__PURE__ */ a("div", { className: "h-3 rounded-full animate-shimmer" }),
|
|
4911
4926
|
/* @__PURE__ */ a(
|
|
@@ -4917,7 +4932,7 @@ function Ds() {
|
|
|
4917
4932
|
)
|
|
4918
4933
|
] }) });
|
|
4919
4934
|
}
|
|
4920
|
-
const
|
|
4935
|
+
const js = Or(
|
|
4921
4936
|
function({
|
|
4922
4937
|
messages: e,
|
|
4923
4938
|
input: r,
|
|
@@ -4942,7 +4957,7 @@ const _s = Fr(
|
|
|
4942
4957
|
}
|
|
4943
4958
|
return null;
|
|
4944
4959
|
}, [e]);
|
|
4945
|
-
return
|
|
4960
|
+
return Lr(x, () => ({
|
|
4946
4961
|
scrollToBottom: () => {
|
|
4947
4962
|
const g = v.current;
|
|
4948
4963
|
g && (g.scrollHeight - g.scrollTop - g.clientHeight > 500 || !g.scrollTo ? g.scrollTop = g.scrollHeight : g.scrollTo({
|
|
@@ -4974,7 +4989,7 @@ const _s = Fr(
|
|
|
4974
4989
|
className: "flex-1 min-h-0 overflow-y-auto py-3 flex flex-col",
|
|
4975
4990
|
children: [
|
|
4976
4991
|
e.length === 0 && !s && b && /* @__PURE__ */ a(
|
|
4977
|
-
|
|
4992
|
+
Us,
|
|
4978
4993
|
{
|
|
4979
4994
|
isDragging: b.isDragging,
|
|
4980
4995
|
fileInputRef: b.fileInputRef,
|
|
@@ -4988,7 +5003,7 @@ const _s = Fr(
|
|
|
4988
5003
|
e.map((g, A) => {
|
|
4989
5004
|
const $ = m && g.role !== "assistant" && A === 0, O = g.role === "assistant" && g.id === S;
|
|
4990
5005
|
return /* @__PURE__ */ a(
|
|
4991
|
-
|
|
5006
|
+
Ds,
|
|
4992
5007
|
{
|
|
4993
5008
|
message: g,
|
|
4994
5009
|
isFirstUserMessage: $,
|
|
@@ -5003,13 +5018,13 @@ const _s = Fr(
|
|
|
5003
5018
|
g.id
|
|
5004
5019
|
);
|
|
5005
5020
|
}),
|
|
5006
|
-
s && /* @__PURE__ */ a(
|
|
5007
|
-
/* @__PURE__ */ a(
|
|
5021
|
+
s && /* @__PURE__ */ a(qs, {}),
|
|
5022
|
+
/* @__PURE__ */ a(cs, { error: f, onRetry: u })
|
|
5008
5023
|
]
|
|
5009
5024
|
}
|
|
5010
5025
|
),
|
|
5011
5026
|
/* @__PURE__ */ a(
|
|
5012
|
-
|
|
5027
|
+
us,
|
|
5013
5028
|
{
|
|
5014
5029
|
input: r,
|
|
5015
5030
|
onInputChange: n,
|
|
@@ -5019,19 +5034,19 @@ const _s = Fr(
|
|
|
5019
5034
|
)
|
|
5020
5035
|
] });
|
|
5021
5036
|
}
|
|
5022
|
-
),
|
|
5023
|
-
|
|
5037
|
+
), Ws = "purchase-order-chat-user-settings", Vs = 25, Lt = it()(
|
|
5038
|
+
Gt(
|
|
5024
5039
|
(t) => ({
|
|
5025
|
-
panelWidth:
|
|
5040
|
+
panelWidth: Vs,
|
|
5026
5041
|
setPanelWidth: (e) => t({ panelWidth: e })
|
|
5027
5042
|
}),
|
|
5028
5043
|
{
|
|
5029
|
-
name:
|
|
5044
|
+
name: Ws
|
|
5030
5045
|
}
|
|
5031
5046
|
)
|
|
5032
5047
|
);
|
|
5033
|
-
function
|
|
5034
|
-
const t =
|
|
5048
|
+
function zs() {
|
|
5049
|
+
const t = Lt((m) => m.panelWidth), e = Lt((m) => m.setPanelWidth), [r, n] = L(
|
|
5035
5050
|
typeof window < "u" && window.innerWidth >= 1024
|
|
5036
5051
|
), i = D(null), s = D(!1), o = D(t);
|
|
5037
5052
|
F(() => {
|
|
@@ -5084,7 +5099,7 @@ function js() {
|
|
|
5084
5099
|
handleBlur: u
|
|
5085
5100
|
};
|
|
5086
5101
|
}
|
|
5087
|
-
function
|
|
5102
|
+
function Qs({ activeTab: t, onTabChange: e, hasUnread: r }) {
|
|
5088
5103
|
const n = r && t !== "chat";
|
|
5089
5104
|
return /* @__PURE__ */ p("div", { className: "flex border-b border-border-strong shrink-0", role: "tablist", children: [
|
|
5090
5105
|
/* @__PURE__ */ a(
|
|
@@ -5125,7 +5140,7 @@ function Ws({ activeTab: t, onTabChange: e, hasUnread: r }) {
|
|
|
5125
5140
|
)
|
|
5126
5141
|
] });
|
|
5127
5142
|
}
|
|
5128
|
-
function
|
|
5143
|
+
function Rt({
|
|
5129
5144
|
// Chat panel props
|
|
5130
5145
|
messages: t,
|
|
5131
5146
|
input: e,
|
|
@@ -5168,11 +5183,11 @@ function Lt({
|
|
|
5168
5183
|
onMinimize: _,
|
|
5169
5184
|
className: j = ""
|
|
5170
5185
|
}) {
|
|
5171
|
-
const K =
|
|
5186
|
+
const K = zs(), [J, Pe] = L(
|
|
5172
5187
|
u.length > 0 ? "cart" : "chat"
|
|
5173
5188
|
), [fe, me] = L(!1), ce = D(t.length), ge = D(J);
|
|
5174
5189
|
ge.current = J;
|
|
5175
|
-
const h = t.length === 0 && u.length === 0 && !!f, k =
|
|
5190
|
+
const h = t.length === 0 && u.length === 0 && !!f, k = nr({
|
|
5176
5191
|
onFile: f ?? (() => {
|
|
5177
5192
|
})
|
|
5178
5193
|
});
|
|
@@ -5182,9 +5197,9 @@ function Lt({
|
|
|
5182
5197
|
K.isDesktop && me(!1);
|
|
5183
5198
|
}, [K.isDesktop]);
|
|
5184
5199
|
const T = B((U) => {
|
|
5185
|
-
|
|
5200
|
+
Pe(U), U === "chat" && me(!1);
|
|
5186
5201
|
}, []), P = /* @__PURE__ */ a(
|
|
5187
|
-
|
|
5202
|
+
js,
|
|
5188
5203
|
{
|
|
5189
5204
|
ref: d,
|
|
5190
5205
|
messages: t,
|
|
@@ -5202,7 +5217,7 @@ function Lt({
|
|
|
5202
5217
|
fileDrop: f ? k : void 0
|
|
5203
5218
|
}
|
|
5204
5219
|
), M = /* @__PURE__ */ a(
|
|
5205
|
-
|
|
5220
|
+
is,
|
|
5206
5221
|
{
|
|
5207
5222
|
items: u,
|
|
5208
5223
|
itemWarnings: m,
|
|
@@ -5289,7 +5304,7 @@ function Lt({
|
|
|
5289
5304
|
...R,
|
|
5290
5305
|
children: [
|
|
5291
5306
|
/* @__PURE__ */ a(
|
|
5292
|
-
|
|
5307
|
+
Qs,
|
|
5293
5308
|
{
|
|
5294
5309
|
activeTab: J,
|
|
5295
5310
|
onTabChange: T,
|
|
@@ -5311,8 +5326,8 @@ function Lt({
|
|
|
5311
5326
|
)
|
|
5312
5327
|
);
|
|
5313
5328
|
}
|
|
5314
|
-
function
|
|
5315
|
-
const t =
|
|
5329
|
+
function Gs() {
|
|
5330
|
+
const t = ft(), e = y((l) => l.ui.existingCart), r = y(
|
|
5316
5331
|
(l) => l.confirmClearExistingCart
|
|
5317
5332
|
), [n, i] = L(!1), s = oe(
|
|
5318
5333
|
() => e?.lineItems.physicalItems.reduce(
|
|
@@ -5340,14 +5355,14 @@ function Vs() {
|
|
|
5340
5355
|
disabled: n,
|
|
5341
5356
|
className: "bg-surface-invert shadow-button transition-all duration-200 ease-in-out hover:bg-surface-invert-hover hover:shadow-button-hover hover:-translate-y-px px-4 py-2 text-text-invert rounded-full font-medium cursor-pointer disabled:opacity-50 disabled:pointer-events-none",
|
|
5342
5357
|
children: n ? /* @__PURE__ */ p("span", { className: "flex items-center gap-2", children: [
|
|
5343
|
-
/* @__PURE__ */ a(
|
|
5358
|
+
/* @__PURE__ */ a(Me, { size: 14 }),
|
|
5344
5359
|
"Clearing cart…"
|
|
5345
5360
|
] }) : "Clear Cart & Continue"
|
|
5346
5361
|
}
|
|
5347
5362
|
)
|
|
5348
5363
|
] }) });
|
|
5349
5364
|
}
|
|
5350
|
-
function
|
|
5365
|
+
function Hs({ message: t }) {
|
|
5351
5366
|
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: [
|
|
5352
5367
|
/* @__PURE__ */ a("p", { className: "text-lg text-text-secondary mb-2", children: "Something went wrong" }),
|
|
5353
5368
|
/* @__PURE__ */ a("p", { className: "text-sm text-text-tertiary mb-6", children: t || "An unexpected error occurred. Please refresh the page to try again." }),
|
|
@@ -5364,7 +5379,7 @@ function zs({ message: t }) {
|
|
|
5364
5379
|
)
|
|
5365
5380
|
] }) });
|
|
5366
5381
|
}
|
|
5367
|
-
function
|
|
5382
|
+
function Er() {
|
|
5368
5383
|
const t = y((n) => n.appState), e = y(
|
|
5369
5384
|
(n) => n.parser.parsedContent
|
|
5370
5385
|
), r = y(
|
|
@@ -5372,19 +5387,19 @@ function kr() {
|
|
|
5372
5387
|
);
|
|
5373
5388
|
return oe(() => t !== "processing" ? null : e ? r === "idle" || r === "processing" ? "matching" : "building" : "reading", [t, e, r]);
|
|
5374
5389
|
}
|
|
5375
|
-
const
|
|
5390
|
+
const Ks = [
|
|
5376
5391
|
{ label: "Upload", number: 1 },
|
|
5377
5392
|
{ label: "Match", number: 2 },
|
|
5378
5393
|
{ label: "Checkout", number: 3 }
|
|
5379
5394
|
];
|
|
5380
|
-
function
|
|
5381
|
-
return /* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-0 p-4 md:py-1 md:px-0", children:
|
|
5395
|
+
function Js(t = {}) {
|
|
5396
|
+
return /* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-0 p-4 md:py-1 md:px-0", children: Ks.map((e, r) => /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
|
|
5382
5397
|
r > 0 && /* @__PURE__ */ a("div", { className: "w-6 md:w-10 h-px mx-2 md:mx-3 rounded-[1px] bg-border" }),
|
|
5383
5398
|
/* @__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 }) }),
|
|
5384
5399
|
/* @__PURE__ */ a("span", { className: "text-s font-normal whitespace-nowrap text-text-quaternary", children: e.label })
|
|
5385
5400
|
] }, e.label)) });
|
|
5386
5401
|
}
|
|
5387
|
-
function
|
|
5402
|
+
function Ys({
|
|
5388
5403
|
isDragging: t,
|
|
5389
5404
|
fileInputRef: e,
|
|
5390
5405
|
cameraInputRef: r,
|
|
@@ -5423,16 +5438,16 @@ function Hs({
|
|
|
5423
5438
|
/* @__PURE__ */ a(
|
|
5424
5439
|
"div",
|
|
5425
5440
|
{
|
|
5426
|
-
className:
|
|
5441
|
+
className: Ee(
|
|
5427
5442
|
"flex items-center justify-center w-16 h-16 rounded-2xl p-1 border-2 border-dashed border-border-focus text-text transition-transform duration-200",
|
|
5428
5443
|
t && "animate-icon-bounce"
|
|
5429
5444
|
),
|
|
5430
|
-
children: /* @__PURE__ */ a(
|
|
5445
|
+
children: /* @__PURE__ */ a(Nr, {})
|
|
5431
5446
|
}
|
|
5432
5447
|
),
|
|
5433
5448
|
/* @__PURE__ */ a("h2", { className: "m-0 text-2xl max-md:text-xl font-semibold text-text text-center", children: "Upload your Order" }),
|
|
5434
5449
|
/* @__PURE__ */ a("p", { className: "m-0 px-8 text-sm text-text-tertiary text-center", children: "Your Order Assistant will match products and check stock availability" }),
|
|
5435
|
-
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2 mt-2", children:
|
|
5450
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2 mt-2", children: rr.map((o) => /* @__PURE__ */ a(
|
|
5436
5451
|
"span",
|
|
5437
5452
|
{
|
|
5438
5453
|
className: "py-1 px-3 bg-surface-invert/5 border border-border-strong rounded-full text-xs font-medium text-text backdrop-blur",
|
|
@@ -5444,7 +5459,7 @@ function Hs({
|
|
|
5444
5459
|
}
|
|
5445
5460
|
);
|
|
5446
5461
|
}
|
|
5447
|
-
function
|
|
5462
|
+
function Xs({
|
|
5448
5463
|
isDragging: t,
|
|
5449
5464
|
fileInputRef: e,
|
|
5450
5465
|
acceptedExtensions: r,
|
|
@@ -5453,20 +5468,20 @@ function Ks({
|
|
|
5453
5468
|
onFileChange: s,
|
|
5454
5469
|
onSkip: o
|
|
5455
5470
|
}) {
|
|
5456
|
-
const l =
|
|
5471
|
+
const l = Sr(), c = D(null), d = B(() => {
|
|
5457
5472
|
c.current?.click();
|
|
5458
5473
|
}, []);
|
|
5459
5474
|
return /* @__PURE__ */ p(
|
|
5460
5475
|
"div",
|
|
5461
5476
|
{
|
|
5462
|
-
className:
|
|
5477
|
+
className: Ee(
|
|
5463
5478
|
"flex flex-col items-center gap-6 border-border border-solid bg-surface border rounded-2xl transition-all duration-[250ms] ease-[cubic-bezier(0.34,1.56,0.64,1)] hover:border-border-strong",
|
|
5464
5479
|
t && "ring-2 ring-border-focus border-border-focus bg-surface-tertiary shadow-upload-active"
|
|
5465
5480
|
),
|
|
5466
5481
|
children: [
|
|
5467
|
-
/* @__PURE__ */ a("div", { className: "upload-zone-steps mb-3 py-4 px-8 border-b border-solid border-border-strong", children: /* @__PURE__ */ a(
|
|
5482
|
+
/* @__PURE__ */ a("div", { className: "upload-zone-steps mb-3 py-4 px-8 border-b border-solid border-border-strong", children: /* @__PURE__ */ a(Js, {}) }),
|
|
5468
5483
|
/* @__PURE__ */ a(
|
|
5469
|
-
|
|
5484
|
+
Ys,
|
|
5470
5485
|
{
|
|
5471
5486
|
isDragging: t,
|
|
5472
5487
|
fileInputRef: e,
|
|
@@ -5476,7 +5491,7 @@ function Ks({
|
|
|
5476
5491
|
onFileChange: s
|
|
5477
5492
|
}
|
|
5478
5493
|
),
|
|
5479
|
-
l && /* @__PURE__ */ a(
|
|
5494
|
+
l && /* @__PURE__ */ a(kr, { onClick: d }),
|
|
5480
5495
|
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 }),
|
|
5481
5496
|
/* @__PURE__ */ a("div", { className: "upload-zone-steps px-8 border-b border-solid border-border-strong" }),
|
|
5482
5497
|
/* @__PURE__ */ a(
|
|
@@ -5492,7 +5507,7 @@ function Ks({
|
|
|
5492
5507
|
}
|
|
5493
5508
|
);
|
|
5494
5509
|
}
|
|
5495
|
-
function
|
|
5510
|
+
function Zs({
|
|
5496
5511
|
items: t,
|
|
5497
5512
|
orderId: e,
|
|
5498
5513
|
parsedContent: r,
|
|
@@ -5584,23 +5599,23 @@ function Js({
|
|
|
5584
5599
|
] })
|
|
5585
5600
|
] });
|
|
5586
5601
|
}
|
|
5587
|
-
const
|
|
5588
|
-
function
|
|
5589
|
-
return t <= 0 ?
|
|
5602
|
+
const ea = 3e3, Dt = 200;
|
|
5603
|
+
function ta(t) {
|
|
5604
|
+
return t <= 0 ? Dt : Math.max(Dt, Math.round(ea / t));
|
|
5590
5605
|
}
|
|
5591
|
-
function
|
|
5606
|
+
function ra() {
|
|
5592
5607
|
const t = y(
|
|
5593
5608
|
(o) => o.batchProcessing.toolCalls
|
|
5594
5609
|
), r = y(
|
|
5595
5610
|
(o) => o.batchProcessing.status
|
|
5596
5611
|
) === "complete", n = t.reduce((o, l) => {
|
|
5597
|
-
if (l.toolName !==
|
|
5612
|
+
if (l.toolName !== Fe) return o;
|
|
5598
5613
|
const c = l.input;
|
|
5599
5614
|
return c && typeof c == "object" && "value" in c && Array.isArray(c.value) ? o + c.value.length : o;
|
|
5600
5615
|
}, 0), [i, s] = L(0);
|
|
5601
5616
|
return F(() => {
|
|
5602
5617
|
if (!r || n === 0 || i >= n) return;
|
|
5603
|
-
const o =
|
|
5618
|
+
const o = ta(n), l = setTimeout(() => {
|
|
5604
5619
|
s((c) => Math.min(c + 1, n));
|
|
5605
5620
|
}, o);
|
|
5606
5621
|
return () => clearTimeout(l);
|
|
@@ -5610,8 +5625,8 @@ function Zs() {
|
|
|
5610
5625
|
isRevealing: n > 0 && i < n
|
|
5611
5626
|
};
|
|
5612
5627
|
}
|
|
5613
|
-
const
|
|
5614
|
-
function
|
|
5628
|
+
const na = 1e3;
|
|
5629
|
+
function sa() {
|
|
5615
5630
|
const t = y(
|
|
5616
5631
|
(s) => s.batchProcessing.toolCalls
|
|
5617
5632
|
), e = y(
|
|
@@ -5622,7 +5637,7 @@ function ta() {
|
|
|
5622
5637
|
F(() => {
|
|
5623
5638
|
if (e >= t.length)
|
|
5624
5639
|
return;
|
|
5625
|
-
const s = setTimeout(r,
|
|
5640
|
+
const s = setTimeout(r, na);
|
|
5626
5641
|
return () => clearTimeout(s);
|
|
5627
5642
|
}, [t.length, e, r]);
|
|
5628
5643
|
const n = t.slice(0, e);
|
|
@@ -5632,23 +5647,23 @@ function ta() {
|
|
|
5632
5647
|
isRevealing: e < t.length
|
|
5633
5648
|
};
|
|
5634
5649
|
}
|
|
5635
|
-
const
|
|
5636
|
-
function
|
|
5650
|
+
const _t = ["reading", "matching", "building"];
|
|
5651
|
+
function aa(t, e) {
|
|
5637
5652
|
if (!e) return "pending";
|
|
5638
|
-
const r =
|
|
5653
|
+
const r = _t.indexOf(e), n = _t.indexOf(t);
|
|
5639
5654
|
return n < r ? "complete" : n === r ? "active" : "pending";
|
|
5640
5655
|
}
|
|
5641
|
-
function
|
|
5656
|
+
function ia(t, e) {
|
|
5642
5657
|
return t.length >= 2 && e !== "submitted" && e !== "streaming";
|
|
5643
5658
|
}
|
|
5644
|
-
function
|
|
5659
|
+
function oa(t) {
|
|
5645
5660
|
if (t === void 0) return null;
|
|
5646
|
-
const e =
|
|
5661
|
+
const e = ht(t);
|
|
5647
5662
|
if (e === void 0) return null;
|
|
5648
|
-
const r =
|
|
5649
|
-
return
|
|
5663
|
+
const r = Ze(e, "data.searchProductsBySku") ?? Ze(e, "data.searchProducts");
|
|
5664
|
+
return Ze(r, "total", 0);
|
|
5650
5665
|
}
|
|
5651
|
-
const
|
|
5666
|
+
const la = {
|
|
5652
5667
|
searchProductsBySku: (t, { resultCount: e }) => {
|
|
5653
5668
|
const r = t.sku ?? "";
|
|
5654
5669
|
return e === null ? `Looking up SKU ${r}` : /* @__PURE__ */ p(ve, { children: [
|
|
@@ -5677,18 +5692,18 @@ const aa = {
|
|
|
5677
5692
|
] });
|
|
5678
5693
|
}
|
|
5679
5694
|
};
|
|
5680
|
-
function
|
|
5681
|
-
const r =
|
|
5695
|
+
function ca(t, e) {
|
|
5696
|
+
const r = la[t.toolName];
|
|
5682
5697
|
return r ? r(t.input, {
|
|
5683
5698
|
visibleToolCalls: e,
|
|
5684
|
-
resultCount:
|
|
5699
|
+
resultCount: oa(t.output)
|
|
5685
5700
|
}) : null;
|
|
5686
5701
|
}
|
|
5687
|
-
const
|
|
5702
|
+
const da = [
|
|
5688
5703
|
{ id: "reading", label: "Reading document..." },
|
|
5689
5704
|
{ id: "matching", label: "Matching products..." },
|
|
5690
5705
|
{ id: "building", label: "Building cart..." }
|
|
5691
|
-
],
|
|
5706
|
+
], Ut = {
|
|
5692
5707
|
pending: {
|
|
5693
5708
|
row: "opacity-40",
|
|
5694
5709
|
icon: "bg-surface-secondary border-2 border-border-strong"
|
|
@@ -5702,28 +5717,28 @@ const oa = [
|
|
|
5702
5717
|
icon: "bg-surface border-2 border-success text-success"
|
|
5703
5718
|
}
|
|
5704
5719
|
};
|
|
5705
|
-
function
|
|
5720
|
+
function ua({
|
|
5706
5721
|
currentStep: t
|
|
5707
5722
|
}) {
|
|
5708
|
-
const { currentToolCall: e, visibleToolCalls: r } =
|
|
5723
|
+
const { currentToolCall: e, visibleToolCalls: r } = sa(), { revealedCount: n, totalItems: i } = ra(), s = y(
|
|
5709
5724
|
(o) => o.parser.uploadedFileName
|
|
5710
5725
|
);
|
|
5711
|
-
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-6 w-64", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-6", children:
|
|
5712
|
-
const l =
|
|
5726
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-6 w-64", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-6", children: da.map((o) => {
|
|
5727
|
+
const l = aa(o.id, t), c = o.id === "reading" && (l === "active" || l === "complete") && s ? s : null, d = o.id === "matching" && l === "active" && e ? ca(e, r) : null, f = o.id === "building" && l === "active" && i > 0 ? n >= i ? `Added ${i} item${i !== 1 ? "s" : ""}` : `Adding item ${n + 1} of ${i}...` : null;
|
|
5713
5728
|
return /* @__PURE__ */ p(
|
|
5714
5729
|
"div",
|
|
5715
5730
|
{
|
|
5716
5731
|
"data-testid": "processing-step-row",
|
|
5717
5732
|
"data-status": l,
|
|
5718
|
-
className: `flex items-center gap-4 transition-opacity duration-300 ${
|
|
5733
|
+
className: `flex items-center gap-4 transition-opacity duration-300 ${Ut[l].row}`,
|
|
5719
5734
|
children: [
|
|
5720
5735
|
/* @__PURE__ */ p(
|
|
5721
5736
|
"div",
|
|
5722
5737
|
{
|
|
5723
|
-
className: `flex items-center justify-center w-8 h-8 rounded-full shrink-0 transition-all duration-300 ${
|
|
5738
|
+
className: `flex items-center justify-center w-8 h-8 rounded-full shrink-0 transition-all duration-300 ${Ut[l].icon}${l === "complete" ? " animate-step-pulse" : ""}${l === "active" ? " bg-surface-invert shadow-step" : ""}`,
|
|
5724
5739
|
children: [
|
|
5725
|
-
l === "complete" && /* @__PURE__ */ a(
|
|
5726
|
-
l === "active" && /* @__PURE__ */ a(
|
|
5740
|
+
l === "complete" && /* @__PURE__ */ a(qe, { size: 16, title: "Complete" }),
|
|
5741
|
+
l === "active" && /* @__PURE__ */ a(Me, { size: 16 }),
|
|
5727
5742
|
l === "pending" && /* @__PURE__ */ a("div", { className: "w-2 h-2 rounded-full bg-border-strong" })
|
|
5728
5743
|
]
|
|
5729
5744
|
}
|
|
@@ -5760,17 +5775,17 @@ function la({
|
|
|
5760
5775
|
);
|
|
5761
5776
|
}) }) });
|
|
5762
5777
|
}
|
|
5763
|
-
function
|
|
5778
|
+
function pa({
|
|
5764
5779
|
cartItems: t,
|
|
5765
5780
|
isUploading: e = !1
|
|
5766
5781
|
}) {
|
|
5767
|
-
const r =
|
|
5782
|
+
const r = Er(), n = y((s) => s.cartifact.orderId), i = y(
|
|
5768
5783
|
(s) => s.parser.parsedContent
|
|
5769
5784
|
);
|
|
5770
5785
|
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: [
|
|
5771
|
-
/* @__PURE__ */ a("div", { className: "shrink-0 flex items-center justify-center", children: /* @__PURE__ */ a(
|
|
5786
|
+
/* @__PURE__ */ a("div", { className: "shrink-0 flex items-center justify-center", children: /* @__PURE__ */ a(ua, { currentStep: r }) }),
|
|
5772
5787
|
/* @__PURE__ */ a("div", { className: "shrink-0 flex items-center justify-center min-w-80", children: /* @__PURE__ */ a(
|
|
5773
|
-
|
|
5788
|
+
Zs,
|
|
5774
5789
|
{
|
|
5775
5790
|
items: t,
|
|
5776
5791
|
orderId: n,
|
|
@@ -5781,7 +5796,7 @@ function ca({
|
|
|
5781
5796
|
) })
|
|
5782
5797
|
] }) });
|
|
5783
5798
|
}
|
|
5784
|
-
function
|
|
5799
|
+
function ha({
|
|
5785
5800
|
onFileUpload: t,
|
|
5786
5801
|
onSkip: e,
|
|
5787
5802
|
onClearError: r,
|
|
@@ -5789,7 +5804,7 @@ function da({
|
|
|
5789
5804
|
isUploading: i = !1,
|
|
5790
5805
|
parserError: s = null
|
|
5791
5806
|
}) {
|
|
5792
|
-
const l =
|
|
5807
|
+
const l = Er() !== null, c = nr({
|
|
5793
5808
|
onFile: t,
|
|
5794
5809
|
onBeforeValidate: r
|
|
5795
5810
|
}), d = s || c.fileError, f = B(() => {
|
|
@@ -5800,12 +5815,12 @@ function da({
|
|
|
5800
5815
|
{
|
|
5801
5816
|
className: `upload-step flex flex-col w-full flex-1 min-h-0 ${c.isDragging ? "upload-step-dragging" : ""} ${l ? "upload-step-processing" : ""}`,
|
|
5802
5817
|
...c.dragProps,
|
|
5803
|
-
children: /* @__PURE__ */ a("div", { className: "upload-step-content animate-fade-in-up flex-1 flex items-center justify-center min-h-0 relative", children: l ? /* @__PURE__ */ a(
|
|
5804
|
-
|
|
5818
|
+
children: /* @__PURE__ */ a("div", { className: "upload-step-content animate-fade-in-up flex-1 flex items-center justify-center min-h-0 relative", children: l ? /* @__PURE__ */ a(pa, { cartItems: n, isUploading: i }) : /* @__PURE__ */ a(
|
|
5819
|
+
Xs,
|
|
5805
5820
|
{
|
|
5806
5821
|
isDragging: c.isDragging,
|
|
5807
5822
|
fileInputRef: c.fileInputRef,
|
|
5808
|
-
acceptedExtensions:
|
|
5823
|
+
acceptedExtensions: tr,
|
|
5809
5824
|
displayError: d,
|
|
5810
5825
|
onDropZoneClick: f,
|
|
5811
5826
|
onFileChange: c.handleFileChange,
|
|
@@ -5828,16 +5843,16 @@ function pe(t) {
|
|
|
5828
5843
|
shouldSaveAddress: !1
|
|
5829
5844
|
};
|
|
5830
5845
|
}
|
|
5831
|
-
function
|
|
5846
|
+
function qt(t, e) {
|
|
5832
5847
|
if (!(!t.address1 || !t.postalCode))
|
|
5833
5848
|
return e.find(
|
|
5834
5849
|
(r) => r.address1?.toLowerCase() === t.address1.toLowerCase() && r.postalCode?.toLowerCase() === t.postalCode?.toLowerCase()
|
|
5835
5850
|
);
|
|
5836
5851
|
}
|
|
5837
|
-
function
|
|
5852
|
+
function Pr(t, e) {
|
|
5838
5853
|
return t !== void 0 && Math.abs(t - e) > 0.01;
|
|
5839
5854
|
}
|
|
5840
|
-
function
|
|
5855
|
+
function fa(t, e) {
|
|
5841
5856
|
const r = [...t];
|
|
5842
5857
|
for (const n of e) {
|
|
5843
5858
|
const i = r.findIndex(
|
|
@@ -5847,7 +5862,7 @@ function ua(t, e) {
|
|
|
5847
5862
|
}
|
|
5848
5863
|
return r;
|
|
5849
5864
|
}
|
|
5850
|
-
function
|
|
5865
|
+
function ma(t, e) {
|
|
5851
5866
|
const r = [], n = [];
|
|
5852
5867
|
for (const i of e) {
|
|
5853
5868
|
const s = t.find(
|
|
@@ -5862,12 +5877,12 @@ function pa(t, e) {
|
|
|
5862
5877
|
}
|
|
5863
5878
|
return { toAdd: r, toUpdate: n };
|
|
5864
5879
|
}
|
|
5865
|
-
function
|
|
5880
|
+
function ga(t, e) {
|
|
5866
5881
|
const r = [];
|
|
5867
5882
|
for (const n of t.lineItems.physicalItems) {
|
|
5868
5883
|
const i = e.find(
|
|
5869
5884
|
(c) => c.productEntityId === n.productEntityId && c.variantEntityId === n.variantEntityId
|
|
5870
|
-
), s = i?.poPriceValue, o = n.listPrice.value, l =
|
|
5885
|
+
), s = i?.poPriceValue, o = n.listPrice.value, l = Pr(s, o);
|
|
5871
5886
|
r.push({
|
|
5872
5887
|
id: n.entityId,
|
|
5873
5888
|
sku: n.sku,
|
|
@@ -5885,20 +5900,20 @@ function ha(t, e) {
|
|
|
5885
5900
|
}
|
|
5886
5901
|
return { cartItems: r };
|
|
5887
5902
|
}
|
|
5888
|
-
function
|
|
5903
|
+
function Ke(t) {
|
|
5889
5904
|
return t.replace(/-/g, "").toLowerCase();
|
|
5890
5905
|
}
|
|
5891
|
-
function
|
|
5906
|
+
function Je(t) {
|
|
5892
5907
|
return t.toLowerCase();
|
|
5893
5908
|
}
|
|
5894
|
-
function
|
|
5909
|
+
function ya(t, e) {
|
|
5895
5910
|
return t.filter(
|
|
5896
5911
|
(r) => !e.some(
|
|
5897
|
-
(n) => r.productSku && n.sku &&
|
|
5912
|
+
(n) => r.productSku && n.sku && Ke(r.productSku) === Ke(n.sku) || r.productName && n.name && Je(r.productName) === Je(n.name)
|
|
5898
5913
|
)
|
|
5899
5914
|
);
|
|
5900
5915
|
}
|
|
5901
|
-
function
|
|
5916
|
+
function xa(t) {
|
|
5902
5917
|
const { client: e, onError: r } = t, n = D(e), i = D(r);
|
|
5903
5918
|
i.current = r;
|
|
5904
5919
|
const s = y((h) => h.bcSession.bcCart), o = y((h) => h.bcSession.checkout), l = y(
|
|
@@ -6020,7 +6035,7 @@ function ma(t) {
|
|
|
6020
6035
|
}
|
|
6021
6036
|
let h;
|
|
6022
6037
|
if (c.length > 0) {
|
|
6023
|
-
const k =
|
|
6038
|
+
const k = qt(
|
|
6024
6039
|
S,
|
|
6025
6040
|
c
|
|
6026
6041
|
);
|
|
@@ -6052,7 +6067,7 @@ function ma(t) {
|
|
|
6052
6067
|
return;
|
|
6053
6068
|
let h;
|
|
6054
6069
|
if (c.length > 0) {
|
|
6055
|
-
const k =
|
|
6070
|
+
const k = qt(
|
|
6056
6071
|
g,
|
|
6057
6072
|
c
|
|
6058
6073
|
);
|
|
@@ -6083,7 +6098,7 @@ function ma(t) {
|
|
|
6083
6098
|
const W = D(void 0), V = D(void 0), ie = oe(() => s ? s.lineItems.physicalItems.map((h) => {
|
|
6084
6099
|
const k = z.find(
|
|
6085
6100
|
(R) => R.productEntityId === h.productEntityId && R.variantEntityId === h.variantEntityId
|
|
6086
|
-
), T = k?.poPriceValue, P = h.listPrice.value, M =
|
|
6101
|
+
), T = k?.poPriceValue, P = h.listPrice.value, M = Pr(T, P);
|
|
6087
6102
|
return {
|
|
6088
6103
|
id: h.entityId,
|
|
6089
6104
|
sku: h.sku ?? "",
|
|
@@ -6136,11 +6151,11 @@ function ma(t) {
|
|
|
6136
6151
|
return { cart: s, cartItems: [], errors: [] };
|
|
6137
6152
|
I(!0);
|
|
6138
6153
|
try {
|
|
6139
|
-
const k =
|
|
6154
|
+
const k = fa(z, h), T = await n.current.getCart();
|
|
6140
6155
|
let P = null;
|
|
6141
6156
|
const M = [];
|
|
6142
6157
|
if (T) {
|
|
6143
|
-
const { toAdd: H, toUpdate: le } =
|
|
6158
|
+
const { toAdd: H, toUpdate: le } = ma(
|
|
6144
6159
|
T.lineItems.physicalItems,
|
|
6145
6160
|
h
|
|
6146
6161
|
);
|
|
@@ -6213,14 +6228,14 @@ function ma(t) {
|
|
|
6213
6228
|
}
|
|
6214
6229
|
if (!P)
|
|
6215
6230
|
return { cart: null, cartItems: [], errors: M };
|
|
6216
|
-
const { cartItems: U } =
|
|
6231
|
+
const { cartItems: U } = ga(
|
|
6217
6232
|
P,
|
|
6218
6233
|
k
|
|
6219
|
-
),
|
|
6220
|
-
|
|
6234
|
+
), je = y.getState().cartifact.itemWarnings, Oe = ya(
|
|
6235
|
+
je,
|
|
6221
6236
|
U
|
|
6222
6237
|
);
|
|
6223
|
-
return
|
|
6238
|
+
return Oe.length !== je.length && G(Oe), { cart: P, cartItems: U, errors: M };
|
|
6224
6239
|
} finally {
|
|
6225
6240
|
I(!1);
|
|
6226
6241
|
}
|
|
@@ -6293,7 +6308,7 @@ function ma(t) {
|
|
|
6293
6308
|
b,
|
|
6294
6309
|
I
|
|
6295
6310
|
]
|
|
6296
|
-
),
|
|
6311
|
+
), Pe = B(
|
|
6297
6312
|
async (h) => {
|
|
6298
6313
|
if (!n.current || !s?.entityId)
|
|
6299
6314
|
return null;
|
|
@@ -6495,7 +6510,7 @@ function ma(t) {
|
|
|
6495
6510
|
cartItems: ie,
|
|
6496
6511
|
addToCart: K,
|
|
6497
6512
|
updateLineItemQuantity: J,
|
|
6498
|
-
removeLineItem:
|
|
6513
|
+
removeLineItem: Pe,
|
|
6499
6514
|
initiateCheckout: fe,
|
|
6500
6515
|
setShippingAddressOnCheckout: me,
|
|
6501
6516
|
setBillingAddressOnCheckout: ce,
|
|
@@ -6504,7 +6519,7 @@ function ma(t) {
|
|
|
6504
6519
|
setSelectedBillingAddressId: O
|
|
6505
6520
|
};
|
|
6506
6521
|
}
|
|
6507
|
-
function
|
|
6522
|
+
function ba({
|
|
6508
6523
|
bcCart: t,
|
|
6509
6524
|
cartItems: e,
|
|
6510
6525
|
onCheckoutInitiated: r,
|
|
@@ -6579,19 +6594,19 @@ function ga({
|
|
|
6579
6594
|
handleShowMoreLikeThis: f
|
|
6580
6595
|
};
|
|
6581
6596
|
}
|
|
6582
|
-
const
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
]),
|
|
6588
|
-
function
|
|
6589
|
-
const e = t.filter((n) =>
|
|
6597
|
+
const st = /* @__PURE__ */ new Set([
|
|
6598
|
+
Fe,
|
|
6599
|
+
ut,
|
|
6600
|
+
Ye,
|
|
6601
|
+
pt
|
|
6602
|
+
]), va = "did not produce any output";
|
|
6603
|
+
function Ca(t) {
|
|
6604
|
+
const e = t.filter((n) => st.has(n.toolName)).map((n) => n.toolName);
|
|
6590
6605
|
return e.length === 0 ? "" : `
|
|
6591
6606
|
|
|
6592
6607
|
Tools called: ${[...new Set(e)].join(", ")}`;
|
|
6593
6608
|
}
|
|
6594
|
-
async function
|
|
6609
|
+
async function Ia(t, e, r, n, i, s) {
|
|
6595
6610
|
const o = [], l = [], c = [], d = [];
|
|
6596
6611
|
let f = [
|
|
6597
6612
|
{
|
|
@@ -6603,15 +6618,15 @@ async function ba(t, e, r, n, i, s) {
|
|
|
6603
6618
|
let m = 0;
|
|
6604
6619
|
for (; m < u; ) {
|
|
6605
6620
|
m++;
|
|
6606
|
-
const S = await
|
|
6621
|
+
const S = await As(
|
|
6607
6622
|
t,
|
|
6608
6623
|
e,
|
|
6609
6624
|
r,
|
|
6610
6625
|
f
|
|
6611
|
-
), g = await
|
|
6626
|
+
), g = await Ts(S, {
|
|
6612
6627
|
onToolCall: s?.onToolCall
|
|
6613
6628
|
});
|
|
6614
|
-
if (l.push(...g.textParts), o.push(...g.toolCalls), g.finalMessage && c.push(g.finalMessage), g.errorMessage?.includes(
|
|
6629
|
+
if (l.push(...g.textParts), o.push(...g.toolCalls), g.finalMessage && c.push(g.finalMessage), g.errorMessage?.includes(va)) {
|
|
6615
6630
|
s?.logger?.debug(
|
|
6616
6631
|
`Batch ${i}: Exiting loop - no output error`
|
|
6617
6632
|
);
|
|
@@ -6629,10 +6644,10 @@ async function ba(t, e, r, n, i, s) {
|
|
|
6629
6644
|
error: g.errorMessage
|
|
6630
6645
|
};
|
|
6631
6646
|
const A = g.toolCalls.filter(
|
|
6632
|
-
(O) =>
|
|
6647
|
+
(O) => st.has(O.toolName) || !g.serverHandledToolCallIds.has(O.toolCallId)
|
|
6633
6648
|
);
|
|
6634
6649
|
for (const O of A)
|
|
6635
|
-
|
|
6650
|
+
st.has(O.toolName) && d.push(O);
|
|
6636
6651
|
if (A.length === 0) {
|
|
6637
6652
|
s?.logger?.debug(
|
|
6638
6653
|
`Batch ${i}: Exiting loop - no client tool calls to respond to`
|
|
@@ -6670,7 +6685,7 @@ async function ba(t, e, r, n, i, s) {
|
|
|
6670
6685
|
},
|
|
6671
6686
|
{
|
|
6672
6687
|
role: "user",
|
|
6673
|
-
parts: [{ type: "text", text:
|
|
6688
|
+
parts: [{ type: "text", text: ot }]
|
|
6674
6689
|
}
|
|
6675
6690
|
];
|
|
6676
6691
|
}
|
|
@@ -6679,13 +6694,13 @@ async function ba(t, e, r, n, i, s) {
|
|
|
6679
6694
|
);
|
|
6680
6695
|
const N = c.length > 0 ? c.join(`
|
|
6681
6696
|
|
|
6682
|
-
`) : l.join(""), b =
|
|
6683
|
-
(S) => S.toolName ===
|
|
6697
|
+
`) : l.join(""), b = Ca(o), x = N + b, E = d.filter(
|
|
6698
|
+
(S) => S.toolName === Fe
|
|
6684
6699
|
).reduce((S, g) => {
|
|
6685
6700
|
const A = g.input?.value;
|
|
6686
6701
|
return S + (A?.length ?? 0);
|
|
6687
6702
|
}, 0), w = d.filter(
|
|
6688
|
-
(S) => S.toolName ===
|
|
6703
|
+
(S) => S.toolName === pt
|
|
6689
6704
|
).reduce((S, g) => {
|
|
6690
6705
|
const A = g.input?.processingFailures;
|
|
6691
6706
|
return S + (A?.length ?? 0);
|
|
@@ -6700,11 +6715,11 @@ async function ba(t, e, r, n, i, s) {
|
|
|
6700
6715
|
pendingClientToolCalls: d
|
|
6701
6716
|
};
|
|
6702
6717
|
}
|
|
6703
|
-
async function
|
|
6718
|
+
async function wa(t, e, r, n) {
|
|
6704
6719
|
if (r.length === 0)
|
|
6705
6720
|
return { results: [], hasErrors: !1 };
|
|
6706
6721
|
const s = (await Promise.allSettled(
|
|
6707
|
-
r.map(() =>
|
|
6722
|
+
r.map(() => wr(t, e))
|
|
6708
6723
|
)).map((c, d) => {
|
|
6709
6724
|
if (c.status === "fulfilled")
|
|
6710
6725
|
return n?.onThreadCreated?.(d, c.value), c.value;
|
|
@@ -6713,7 +6728,7 @@ async function va(t, e, r, n) {
|
|
|
6713
6728
|
`Failed to create thread for batch ${d}`,
|
|
6714
6729
|
c.reason
|
|
6715
6730
|
), n?.onError?.(d, f), null;
|
|
6716
|
-
}), o = await
|
|
6731
|
+
}), o = await Gr(
|
|
6717
6732
|
r,
|
|
6718
6733
|
async (c, d) => {
|
|
6719
6734
|
const f = s[d];
|
|
@@ -6727,7 +6742,7 @@ async function va(t, e, r, n) {
|
|
|
6727
6742
|
error: "Failed to create thread"
|
|
6728
6743
|
};
|
|
6729
6744
|
try {
|
|
6730
|
-
const u = await
|
|
6745
|
+
const u = await Ia(
|
|
6731
6746
|
t,
|
|
6732
6747
|
e,
|
|
6733
6748
|
f,
|
|
@@ -6752,7 +6767,7 @@ async function va(t, e, r, n) {
|
|
|
6752
6767
|
), l = o.some((c) => c.error !== void 0);
|
|
6753
6768
|
return { results: o, hasErrors: l };
|
|
6754
6769
|
}
|
|
6755
|
-
function
|
|
6770
|
+
function Sa(t) {
|
|
6756
6771
|
const e = [];
|
|
6757
6772
|
let r = null;
|
|
6758
6773
|
const n = [];
|
|
@@ -6761,19 +6776,19 @@ function Ca(t) {
|
|
|
6761
6776
|
continue;
|
|
6762
6777
|
let s = 0, o = 0;
|
|
6763
6778
|
for (const l of i.pendingClientToolCalls)
|
|
6764
|
-
if (l.toolName ===
|
|
6779
|
+
if (l.toolName === Fe) {
|
|
6765
6780
|
const c = l.input;
|
|
6766
6781
|
c.value && (s += c.value.length, e.push(...c.value));
|
|
6767
|
-
} else if (l.toolName ===
|
|
6782
|
+
} else if (l.toolName === Ye)
|
|
6768
6783
|
r = l.input;
|
|
6769
|
-
else if (l.toolName ===
|
|
6784
|
+
else if (l.toolName === pt) {
|
|
6770
6785
|
const c = l.input;
|
|
6771
6786
|
c.processingFailures && (o += c.processingFailures.length, n.push(...c.processingFailures));
|
|
6772
6787
|
}
|
|
6773
6788
|
}
|
|
6774
6789
|
return { addToCartItems: e, setPoMetadataArgs: r, processingFailures: n };
|
|
6775
6790
|
}
|
|
6776
|
-
function
|
|
6791
|
+
function Na(t) {
|
|
6777
6792
|
if (t.length === 0)
|
|
6778
6793
|
return "";
|
|
6779
6794
|
const e = [
|
|
@@ -6789,7 +6804,7 @@ function Ia(t) {
|
|
|
6789
6804
|
return e.join(`
|
|
6790
6805
|
`);
|
|
6791
6806
|
}
|
|
6792
|
-
function
|
|
6807
|
+
function ka(t) {
|
|
6793
6808
|
if (t.length === 0) return "";
|
|
6794
6809
|
const e = ["---", "## Failed Tool Calls", ""];
|
|
6795
6810
|
for (const r of t) {
|
|
@@ -6805,8 +6820,8 @@ function wa(t) {
|
|
|
6805
6820
|
return e.join(`
|
|
6806
6821
|
`);
|
|
6807
6822
|
}
|
|
6808
|
-
async function
|
|
6809
|
-
const r =
|
|
6823
|
+
async function Ea(t, e) {
|
|
6824
|
+
const r = Sa(t);
|
|
6810
6825
|
if (r.setPoMetadataArgs) {
|
|
6811
6826
|
const s = r.setPoMetadataArgs;
|
|
6812
6827
|
y.getState().applyPoMetadata(s.poMetadata);
|
|
@@ -6816,20 +6831,20 @@ async function Sa(t, e) {
|
|
|
6816
6831
|
const { errors: s } = await e.addToCart(r.addToCartItems);
|
|
6817
6832
|
n = s, s.length > 0 && console.error("Failed to add some items to cart:", s);
|
|
6818
6833
|
}
|
|
6819
|
-
const i =
|
|
6834
|
+
const i = Na(
|
|
6820
6835
|
r.processingFailures
|
|
6821
6836
|
);
|
|
6822
6837
|
if (n.length > 0) {
|
|
6823
|
-
const s =
|
|
6838
|
+
const s = ka(n);
|
|
6824
6839
|
return i ? `${i}
|
|
6825
6840
|
${s}` : s;
|
|
6826
6841
|
}
|
|
6827
6842
|
return i;
|
|
6828
6843
|
}
|
|
6829
|
-
async function
|
|
6844
|
+
async function Pa(t, e) {
|
|
6830
6845
|
if (e.length === 0)
|
|
6831
6846
|
return { results: [], processingFailuresString: "", hasErrors: !1 };
|
|
6832
|
-
const r = await
|
|
6847
|
+
const r = await wa(
|
|
6833
6848
|
t.takeshapeConfig,
|
|
6834
6849
|
t.agentName,
|
|
6835
6850
|
e,
|
|
@@ -6843,7 +6858,7 @@ async function Na(t, e) {
|
|
|
6843
6858
|
}
|
|
6844
6859
|
);
|
|
6845
6860
|
let n = "";
|
|
6846
|
-
return t.bcCart && (n = await
|
|
6861
|
+
return t.bcCart && (n = await Ea(
|
|
6847
6862
|
r.results,
|
|
6848
6863
|
t.bcCart
|
|
6849
6864
|
)), {
|
|
@@ -6852,7 +6867,7 @@ async function Na(t, e) {
|
|
|
6852
6867
|
hasErrors: r.hasErrors
|
|
6853
6868
|
};
|
|
6854
6869
|
}
|
|
6855
|
-
function
|
|
6870
|
+
function Ta(t) {
|
|
6856
6871
|
const { bcCart: e } = t, r = y(
|
|
6857
6872
|
(d) => d.takeshapeConfig
|
|
6858
6873
|
), n = y(
|
|
@@ -6876,7 +6891,7 @@ function ka(t) {
|
|
|
6876
6891
|
bcCart: e
|
|
6877
6892
|
};
|
|
6878
6893
|
try {
|
|
6879
|
-
const u = await
|
|
6894
|
+
const u = await Pa(f, d);
|
|
6880
6895
|
if (s(
|
|
6881
6896
|
u.results,
|
|
6882
6897
|
u.processingFailuresString
|
|
@@ -6906,7 +6921,7 @@ function ka(t) {
|
|
|
6906
6921
|
reset: o
|
|
6907
6922
|
};
|
|
6908
6923
|
}
|
|
6909
|
-
function
|
|
6924
|
+
function Aa({
|
|
6910
6925
|
appState: t,
|
|
6911
6926
|
setAppState: e,
|
|
6912
6927
|
parser: r,
|
|
@@ -6918,7 +6933,7 @@ function Ea({
|
|
|
6918
6933
|
(u) => u.parser.hasProcessedDocument
|
|
6919
6934
|
), c = y(
|
|
6920
6935
|
(u) => u.setHasProcessedDocument
|
|
6921
|
-
), { processBatches: d } =
|
|
6936
|
+
), { processBatches: d } = Ta({ bcCart: s });
|
|
6922
6937
|
return F(() => {
|
|
6923
6938
|
t === "processing" && r.parserStatus !== "streaming" && r.parserStatus !== "submitted" && r.parsedContent && r.parserMessages.length > 0 && !o.current && (o.current = !0, c(!0), d(r.parsedContent));
|
|
6924
6939
|
}, [
|
|
@@ -6944,30 +6959,30 @@ function Ea({
|
|
|
6944
6959
|
}
|
|
6945
6960
|
};
|
|
6946
6961
|
}
|
|
6947
|
-
const
|
|
6948
|
-
function
|
|
6949
|
-
return t.split(
|
|
6962
|
+
const $a = "<!-- BATCH -->";
|
|
6963
|
+
function Ba(t) {
|
|
6964
|
+
return t.split($a).map((e) => e.trim()).filter(Boolean);
|
|
6950
6965
|
}
|
|
6951
|
-
function
|
|
6966
|
+
function Ma(t) {
|
|
6952
6967
|
return new Promise((e, r) => {
|
|
6953
6968
|
const n = new FileReader();
|
|
6954
6969
|
n.onload = () => e(n.result), n.onerror = () => r(new Error("Failed to read file")), n.readAsText(t);
|
|
6955
6970
|
});
|
|
6956
6971
|
}
|
|
6957
|
-
function
|
|
6972
|
+
function Fa(t) {
|
|
6958
6973
|
return new Promise((e, r) => {
|
|
6959
6974
|
const n = new FileReader();
|
|
6960
6975
|
n.onload = () => e(n.result), n.onerror = () => r(new Error("Failed to read file")), n.readAsDataURL(t);
|
|
6961
6976
|
});
|
|
6962
6977
|
}
|
|
6963
|
-
const
|
|
6978
|
+
const Oa = /* @__PURE__ */ new Set([
|
|
6964
6979
|
"application/vnd.ms-excel",
|
|
6965
6980
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
6966
6981
|
]);
|
|
6967
|
-
function
|
|
6968
|
-
return
|
|
6982
|
+
function jt(t) {
|
|
6983
|
+
return Oa.has(t);
|
|
6969
6984
|
}
|
|
6970
|
-
async function
|
|
6985
|
+
async function La(t) {
|
|
6971
6986
|
const e = await import("xlsx"), r = await t.arrayBuffer(), n = e.read(r, { type: "array" });
|
|
6972
6987
|
if (n.SheetNames.length === 0)
|
|
6973
6988
|
throw new Error("Workbook contains no sheets");
|
|
@@ -6979,27 +6994,27 @@ async function Ma(t) {
|
|
|
6979
6994
|
const s = e.utils.json_to_sheet(i);
|
|
6980
6995
|
return e.utils.sheet_to_csv(s);
|
|
6981
6996
|
}
|
|
6982
|
-
const
|
|
6983
|
-
function
|
|
6997
|
+
const Ra = "%PDF-", Da = "%%EOF", _a = 256;
|
|
6998
|
+
function Ua(t) {
|
|
6984
6999
|
return new Promise((e, r) => {
|
|
6985
7000
|
const n = new FileReader();
|
|
6986
7001
|
n.onload = () => e(n.result), n.onerror = () => r(n.error), n.readAsArrayBuffer(t);
|
|
6987
7002
|
});
|
|
6988
7003
|
}
|
|
6989
|
-
async function
|
|
6990
|
-
if (t.size <
|
|
7004
|
+
async function qa(t) {
|
|
7005
|
+
if (t.size < _a) return { valid: !1, reason: "invalid" };
|
|
6991
7006
|
let e;
|
|
6992
7007
|
try {
|
|
6993
|
-
e = new Uint8Array(await
|
|
7008
|
+
e = new Uint8Array(await Ua(t));
|
|
6994
7009
|
} catch {
|
|
6995
7010
|
return { valid: !1, reason: "invalid" };
|
|
6996
7011
|
}
|
|
6997
|
-
if (!String.fromCharCode(...e.slice(0, 5)).startsWith(
|
|
7012
|
+
if (!String.fromCharCode(...e.slice(0, 5)).startsWith(Ra))
|
|
6998
7013
|
return { valid: !1, reason: "invalid" };
|
|
6999
7014
|
const n = Math.min(1024, e.length);
|
|
7000
7015
|
if (!String.fromCharCode(
|
|
7001
7016
|
...e.slice(e.length - n)
|
|
7002
|
-
).includes(
|
|
7017
|
+
).includes(Da))
|
|
7003
7018
|
return { valid: !1, reason: "invalid" };
|
|
7004
7019
|
const s = Math.max(0, e.length - 8192), o = new TextDecoder().decode(e.slice(s)), l = o.lastIndexOf("<<"), c = o.lastIndexOf(">>");
|
|
7005
7020
|
if (l !== -1 && c !== -1 && l < c && o.substring(l, c).includes("/Encrypt"))
|
|
@@ -7023,24 +7038,24 @@ async function Da(t) {
|
|
|
7023
7038
|
}
|
|
7024
7039
|
return { valid: !0 };
|
|
7025
7040
|
}
|
|
7026
|
-
const
|
|
7041
|
+
const ja = /* @__PURE__ */ new Set([
|
|
7027
7042
|
"text/csv",
|
|
7028
7043
|
"text/plain",
|
|
7029
7044
|
"application/json"
|
|
7030
|
-
]),
|
|
7031
|
-
function
|
|
7045
|
+
]), Tr = "Please parse this document and extract relevant purchase order information.";
|
|
7046
|
+
function Wt(t, e) {
|
|
7032
7047
|
return [
|
|
7033
7048
|
{
|
|
7034
7049
|
type: "text",
|
|
7035
|
-
text: `${
|
|
7050
|
+
text: `${Tr.replace("this document", `this ${t} document`)}
|
|
7036
7051
|
|
|
7037
7052
|
${e}`
|
|
7038
7053
|
}
|
|
7039
7054
|
];
|
|
7040
7055
|
}
|
|
7041
|
-
function
|
|
7056
|
+
function Wa(t, e, r) {
|
|
7042
7057
|
return [
|
|
7043
|
-
{ type: "text", text:
|
|
7058
|
+
{ type: "text", text: Tr },
|
|
7044
7059
|
{
|
|
7045
7060
|
type: "file",
|
|
7046
7061
|
url: t,
|
|
@@ -7049,7 +7064,7 @@ function Ua(t, e, r) {
|
|
|
7049
7064
|
}
|
|
7050
7065
|
];
|
|
7051
7066
|
}
|
|
7052
|
-
function
|
|
7067
|
+
function Va({
|
|
7053
7068
|
createParserThread: t,
|
|
7054
7069
|
sendParserMessage: e
|
|
7055
7070
|
}) {
|
|
@@ -7057,7 +7072,7 @@ function qa({
|
|
|
7057
7072
|
async (l) => {
|
|
7058
7073
|
const c = y.getState();
|
|
7059
7074
|
if (c.setParsedContent(null), n(!0), c.setUploadedFileName(l.name), s(null), l.type === "application/pdf") {
|
|
7060
|
-
const d = await
|
|
7075
|
+
const d = await qa(l);
|
|
7061
7076
|
if (!d.valid)
|
|
7062
7077
|
return s(
|
|
7063
7078
|
d.reason === "password-protected" ? "The PDF appears to be password protected." : "The file does not appear to be a valid PDF."
|
|
@@ -7065,20 +7080,20 @@ function qa({
|
|
|
7065
7080
|
}
|
|
7066
7081
|
await t();
|
|
7067
7082
|
try {
|
|
7068
|
-
if (
|
|
7083
|
+
if (jt(l.type)) {
|
|
7084
|
+
const d = await La(l);
|
|
7085
|
+
e({ parts: Wt(l.name, d) });
|
|
7086
|
+
} else if (ja.has(l.type)) {
|
|
7069
7087
|
const d = await Ma(l);
|
|
7070
|
-
e({ parts:
|
|
7071
|
-
} else if (_a.has(l.type)) {
|
|
7072
|
-
const d = await Aa(l);
|
|
7073
|
-
e({ parts: jt(l.name, d) });
|
|
7088
|
+
e({ parts: Wt(l.name, d) });
|
|
7074
7089
|
} else {
|
|
7075
|
-
const d = await
|
|
7090
|
+
const d = await Fa(l);
|
|
7076
7091
|
e({
|
|
7077
|
-
parts:
|
|
7092
|
+
parts: Wa(d, l.type, l.name)
|
|
7078
7093
|
});
|
|
7079
7094
|
}
|
|
7080
7095
|
} catch (d) {
|
|
7081
|
-
console.error("Failed to read file:", d),
|
|
7096
|
+
console.error("Failed to read file:", d), jt(l.type) ? s(
|
|
7082
7097
|
"Failed to read the spreadsheet file. Please try saving it as CSV and uploading again."
|
|
7083
7098
|
) : y.getState().setParsedContent(null), n(!1);
|
|
7084
7099
|
}
|
|
@@ -7093,7 +7108,7 @@ function qa({
|
|
|
7093
7108
|
handleFileUpload: o
|
|
7094
7109
|
};
|
|
7095
7110
|
}
|
|
7096
|
-
function
|
|
7111
|
+
function Ar(t) {
|
|
7097
7112
|
const {
|
|
7098
7113
|
agentName: e,
|
|
7099
7114
|
createOnMount: r,
|
|
@@ -7110,7 +7125,7 @@ function Tr(t) {
|
|
|
7110
7125
|
let b = 0;
|
|
7111
7126
|
for (; b <= N; )
|
|
7112
7127
|
try {
|
|
7113
|
-
const x = await
|
|
7128
|
+
const x = await wr(
|
|
7114
7129
|
{ origin: c, projectId: o, apiKey: l },
|
|
7115
7130
|
e
|
|
7116
7131
|
);
|
|
@@ -7139,12 +7154,12 @@ function Tr(t) {
|
|
|
7139
7154
|
createThread: m
|
|
7140
7155
|
};
|
|
7141
7156
|
}
|
|
7142
|
-
function
|
|
7157
|
+
function za() {
|
|
7143
7158
|
const { sseOrigin: t, projectId: e, apiKey: r } = y(
|
|
7144
7159
|
(g) => g.takeshapeConfig
|
|
7145
7160
|
), n = y(
|
|
7146
7161
|
(g) => g.setParserThreadId
|
|
7147
|
-
), { thread: i, createThread: s } =
|
|
7162
|
+
), { thread: i, createThread: s } = Ar({
|
|
7148
7163
|
agentName: "documentParser",
|
|
7149
7164
|
createOnMount: !0,
|
|
7150
7165
|
persist: !1,
|
|
@@ -7161,8 +7176,8 @@ function ja() {
|
|
|
7161
7176
|
sendMessage: f,
|
|
7162
7177
|
status: u,
|
|
7163
7178
|
setMessages: m
|
|
7164
|
-
} =
|
|
7165
|
-
transport: new
|
|
7179
|
+
} = zt({
|
|
7180
|
+
transport: new Qt({
|
|
7166
7181
|
api: `${t}/project/${e}/agents/messages`,
|
|
7167
7182
|
headers: {
|
|
7168
7183
|
Authorization: `Bearer ${r}`
|
|
@@ -7197,11 +7212,11 @@ function ja() {
|
|
|
7197
7212
|
parserError: x,
|
|
7198
7213
|
setParserError: v,
|
|
7199
7214
|
handleFileUpload: E
|
|
7200
|
-
} =
|
|
7215
|
+
} = Va({
|
|
7201
7216
|
createParserThread: s,
|
|
7202
7217
|
sendParserMessage: f
|
|
7203
7218
|
}), I = B(
|
|
7204
|
-
async (g) => (c.current?.end(), c.current =
|
|
7219
|
+
async (g) => (c.current?.end(), c.current = nt({
|
|
7205
7220
|
name: "document-parser",
|
|
7206
7221
|
op: "ai.parse",
|
|
7207
7222
|
attributes: {
|
|
@@ -7216,7 +7231,7 @@ function ja() {
|
|
|
7216
7231
|
if (d.length > 0) {
|
|
7217
7232
|
const g = d[d.length - 1];
|
|
7218
7233
|
if (g?.role === "assistant" && Array.isArray(g.parts)) {
|
|
7219
|
-
const A = g.parts.filter((O) => O.type === "text").map((O) => O.text).filter(Boolean), $ =
|
|
7234
|
+
const A = g.parts.filter((O) => O.type === "text").map((O) => O.text).filter(Boolean), $ = Ba(A.join(""));
|
|
7220
7235
|
y.getState().setParsedContent($), $ && b(!1);
|
|
7221
7236
|
}
|
|
7222
7237
|
}
|
|
@@ -7247,7 +7262,7 @@ function ja() {
|
|
|
7247
7262
|
reset: S
|
|
7248
7263
|
};
|
|
7249
7264
|
}
|
|
7250
|
-
class
|
|
7265
|
+
class Qa {
|
|
7251
7266
|
b2bToken = null;
|
|
7252
7267
|
companyId = null;
|
|
7253
7268
|
channelId;
|
|
@@ -7255,7 +7270,8 @@ class Wa {
|
|
|
7255
7270
|
getB2BJwt;
|
|
7256
7271
|
initPromise;
|
|
7257
7272
|
constructor(e) {
|
|
7258
|
-
this.channelId = e.channelId, this.getB2BJwt = e.getB2BJwt ?? null, this.graphQLClient = new
|
|
7273
|
+
this.channelId = e.channelId, this.getB2BJwt = e.getB2BJwt ?? null, this.graphQLClient = new at(Ht, {
|
|
7274
|
+
fetch: ke,
|
|
7259
7275
|
credentials: "same-origin",
|
|
7260
7276
|
headers: {
|
|
7261
7277
|
"content-type": "application/json",
|
|
@@ -7309,7 +7325,7 @@ class Wa {
|
|
|
7309
7325
|
}
|
|
7310
7326
|
async getB2BStorefrontToken(e) {
|
|
7311
7327
|
const r = await this.request({
|
|
7312
|
-
document:
|
|
7328
|
+
document: Jt,
|
|
7313
7329
|
variables: {
|
|
7314
7330
|
authData: {
|
|
7315
7331
|
bcToken: e,
|
|
@@ -7320,7 +7336,7 @@ class Wa {
|
|
|
7320
7336
|
Authorization: `Bearer ${e}`
|
|
7321
7337
|
}
|
|
7322
7338
|
}), i = Ne(
|
|
7323
|
-
|
|
7339
|
+
ct,
|
|
7324
7340
|
r.authorization
|
|
7325
7341
|
)?.result?.token;
|
|
7326
7342
|
if (!i)
|
|
@@ -7331,13 +7347,13 @@ class Wa {
|
|
|
7331
7347
|
console.debug("[B2BClient] Requesting company ID with customer JWT");
|
|
7332
7348
|
const r = await this.request(
|
|
7333
7349
|
{
|
|
7334
|
-
document:
|
|
7350
|
+
document: Xr,
|
|
7335
7351
|
requestHeaders: {
|
|
7336
7352
|
Authorization: `Bearer ${e}`
|
|
7337
7353
|
}
|
|
7338
7354
|
},
|
|
7339
7355
|
-1
|
|
7340
|
-
), i = Ne(
|
|
7356
|
+
), i = Ne(Yt, r.currentUser)?.companyInfo?.companyId;
|
|
7341
7357
|
if (!i)
|
|
7342
7358
|
throw new Error("No company ID returned from current user query");
|
|
7343
7359
|
return console.debug("[B2BClient] Received company ID", i), Number(i);
|
|
@@ -7347,7 +7363,7 @@ class Wa {
|
|
|
7347
7363
|
return [];
|
|
7348
7364
|
try {
|
|
7349
7365
|
const r = (await this.request({
|
|
7350
|
-
document:
|
|
7366
|
+
document: Zr,
|
|
7351
7367
|
variables: {
|
|
7352
7368
|
companyId: this.companyId
|
|
7353
7369
|
},
|
|
@@ -7356,7 +7372,7 @@ class Wa {
|
|
|
7356
7372
|
}
|
|
7357
7373
|
}))?.addresses?.edges;
|
|
7358
7374
|
return r ? r.map(
|
|
7359
|
-
(n) =>
|
|
7375
|
+
(n) => Cn(n.node)
|
|
7360
7376
|
) : [];
|
|
7361
7377
|
} catch (e) {
|
|
7362
7378
|
return console.info(
|
|
@@ -7370,7 +7386,7 @@ class Wa {
|
|
|
7370
7386
|
throw new Error("B2B client is not available");
|
|
7371
7387
|
try {
|
|
7372
7388
|
const n = (await this.request({
|
|
7373
|
-
document:
|
|
7389
|
+
document: en,
|
|
7374
7390
|
variables: {
|
|
7375
7391
|
cartData: {
|
|
7376
7392
|
cartId: e
|
|
@@ -7392,16 +7408,16 @@ class Wa {
|
|
|
7392
7408
|
}
|
|
7393
7409
|
}
|
|
7394
7410
|
}
|
|
7395
|
-
function
|
|
7411
|
+
function Ga(t) {
|
|
7396
7412
|
return console.debug(
|
|
7397
7413
|
`[createB2BClient] Initializing B2B client for channelId=${t.channelId}`
|
|
7398
|
-
), new
|
|
7414
|
+
), new Qa(t);
|
|
7399
7415
|
}
|
|
7400
|
-
async function
|
|
7416
|
+
async function _i(t) {
|
|
7401
7417
|
let e = null;
|
|
7402
7418
|
try {
|
|
7403
|
-
const r = await
|
|
7404
|
-
`/customer/current.jwt?app_client_id=${
|
|
7419
|
+
const r = await ke(
|
|
7420
|
+
`/customer/current.jwt?app_client_id=${Kr}`,
|
|
7405
7421
|
{
|
|
7406
7422
|
method: "GET",
|
|
7407
7423
|
credentials: "same-origin",
|
|
@@ -7421,7 +7437,8 @@ async function Li(t) {
|
|
|
7421
7437
|
console.debug(
|
|
7422
7438
|
"[stencilB2BJwt] Exchanging customer JWT for B2B storefront token"
|
|
7423
7439
|
);
|
|
7424
|
-
const n = await new
|
|
7440
|
+
const n = await new at(Ht, {
|
|
7441
|
+
fetch: ke,
|
|
7425
7442
|
credentials: "same-origin",
|
|
7426
7443
|
headers: {
|
|
7427
7444
|
"content-type": "application/json",
|
|
@@ -7429,7 +7446,7 @@ async function Li(t) {
|
|
|
7429
7446
|
Authorization: `Bearer ${e}`
|
|
7430
7447
|
}
|
|
7431
7448
|
}).request({
|
|
7432
|
-
document:
|
|
7449
|
+
document: Jt,
|
|
7433
7450
|
variables: {
|
|
7434
7451
|
authData: {
|
|
7435
7452
|
bcToken: e,
|
|
@@ -7437,7 +7454,7 @@ async function Li(t) {
|
|
|
7437
7454
|
}
|
|
7438
7455
|
}
|
|
7439
7456
|
}), s = Ne(
|
|
7440
|
-
|
|
7457
|
+
ct,
|
|
7441
7458
|
n.authorization
|
|
7442
7459
|
)?.result?.token;
|
|
7443
7460
|
return s ? (console.debug("[stencilB2BJwt] Received B2B storefront token"), s) : null;
|
|
@@ -7445,7 +7462,7 @@ async function Li(t) {
|
|
|
7445
7462
|
return null;
|
|
7446
7463
|
}
|
|
7447
7464
|
}
|
|
7448
|
-
async function
|
|
7465
|
+
async function Ha(t, e) {
|
|
7449
7466
|
const { setToolCallError: r } = y.getState(), n = t.input;
|
|
7450
7467
|
let i = "No items provided to add to cart.";
|
|
7451
7468
|
if (n.value && n.value.length > 0) {
|
|
@@ -7457,12 +7474,12 @@ async function za(t, e) {
|
|
|
7457
7474
|
i = `Successfully added ${n.value.length} item(s) to cart.`;
|
|
7458
7475
|
}
|
|
7459
7476
|
return {
|
|
7460
|
-
tool:
|
|
7477
|
+
tool: Fe,
|
|
7461
7478
|
toolCallId: t.toolCallId,
|
|
7462
7479
|
output: i
|
|
7463
7480
|
};
|
|
7464
7481
|
}
|
|
7465
|
-
async function
|
|
7482
|
+
async function Ka(t, e) {
|
|
7466
7483
|
const { setToolCallError: r } = y.getState();
|
|
7467
7484
|
let n = "Cart cleared successfully.";
|
|
7468
7485
|
try {
|
|
@@ -7472,12 +7489,12 @@ async function Qa(t, e) {
|
|
|
7472
7489
|
n = `Failed to clear cart: ${s}`, r(t.toolCallId, s);
|
|
7473
7490
|
}
|
|
7474
7491
|
return {
|
|
7475
|
-
tool:
|
|
7492
|
+
tool: mr,
|
|
7476
7493
|
toolCallId: t.toolCallId,
|
|
7477
7494
|
output: n
|
|
7478
7495
|
};
|
|
7479
7496
|
}
|
|
7480
|
-
function
|
|
7497
|
+
function Ja(t, e) {
|
|
7481
7498
|
const r = {
|
|
7482
7499
|
items: e.cartItems.map((n) => ({
|
|
7483
7500
|
productEntityId: n.productEntityId,
|
|
@@ -7492,23 +7509,23 @@ function Ga(t, e) {
|
|
|
7492
7509
|
totals: e.checkoutTotals
|
|
7493
7510
|
};
|
|
7494
7511
|
return {
|
|
7495
|
-
tool:
|
|
7512
|
+
tool: gr,
|
|
7496
7513
|
toolCallId: t.toolCallId,
|
|
7497
7514
|
output: JSON.stringify(r)
|
|
7498
7515
|
};
|
|
7499
7516
|
}
|
|
7500
|
-
function
|
|
7517
|
+
function Ya(t) {
|
|
7501
7518
|
const { parser: e } = y.getState(), r = {
|
|
7502
7519
|
uploadedFileName: e.uploadedFileName,
|
|
7503
7520
|
parsedContent: e.parsedContent
|
|
7504
7521
|
};
|
|
7505
7522
|
return {
|
|
7506
|
-
tool:
|
|
7523
|
+
tool: ut,
|
|
7507
7524
|
toolCallId: t.toolCallId,
|
|
7508
7525
|
output: JSON.stringify(r)
|
|
7509
7526
|
};
|
|
7510
7527
|
}
|
|
7511
|
-
async function
|
|
7528
|
+
async function Xa(t, e) {
|
|
7512
7529
|
const { setToolCallError: r } = y.getState(), n = t.input;
|
|
7513
7530
|
let i = "Item removed from cart successfully.";
|
|
7514
7531
|
try {
|
|
@@ -7519,7 +7536,7 @@ async function Ka(t, e) {
|
|
|
7519
7536
|
await e.removeLineItem(s.entityId);
|
|
7520
7537
|
else
|
|
7521
7538
|
return {
|
|
7522
|
-
tool:
|
|
7539
|
+
tool: fr,
|
|
7523
7540
|
toolCallId: t.toolCallId,
|
|
7524
7541
|
output: "Cart item not found."
|
|
7525
7542
|
};
|
|
@@ -7533,36 +7550,36 @@ async function Ka(t, e) {
|
|
|
7533
7550
|
output: i
|
|
7534
7551
|
};
|
|
7535
7552
|
}
|
|
7536
|
-
function
|
|
7553
|
+
function Za(t) {
|
|
7537
7554
|
const {
|
|
7538
7555
|
cartifact: { itemWarnings: e },
|
|
7539
7556
|
setItemWarnings: r
|
|
7540
7557
|
} = y.getState(), n = t.input, i = e.filter(
|
|
7541
|
-
(s) => !(n.productSku !== void 0 && s.productSku !== void 0 &&
|
|
7558
|
+
(s) => !(n.productSku !== void 0 && s.productSku !== void 0 && Ke(s.productSku) === Ke(n.productSku) || n.productName !== void 0 && s.productName !== void 0 && Je(s.productName) === Je(n.productName))
|
|
7542
7559
|
);
|
|
7543
7560
|
return r(i), {
|
|
7544
|
-
tool:
|
|
7561
|
+
tool: xr,
|
|
7545
7562
|
toolCallId: t.toolCallId,
|
|
7546
7563
|
output: "Item warnings removed successfully."
|
|
7547
7564
|
};
|
|
7548
7565
|
}
|
|
7549
|
-
function
|
|
7566
|
+
function ei(t) {
|
|
7550
7567
|
const { setItemWarnings: e } = y.getState(), r = t.input;
|
|
7551
7568
|
return r.itemWarnings && e(r.itemWarnings), {
|
|
7552
|
-
tool:
|
|
7569
|
+
tool: yr,
|
|
7553
7570
|
toolCallId: t.toolCallId,
|
|
7554
7571
|
output: "Item warnings set successfully."
|
|
7555
7572
|
};
|
|
7556
7573
|
}
|
|
7557
|
-
function
|
|
7574
|
+
function ti(t) {
|
|
7558
7575
|
const e = t.input;
|
|
7559
7576
|
return y.getState().applyPoMetadata(e.poMetadata), {
|
|
7560
|
-
tool:
|
|
7577
|
+
tool: Ye,
|
|
7561
7578
|
toolCallId: t.toolCallId,
|
|
7562
7579
|
output: "PO metadata set successfully."
|
|
7563
7580
|
};
|
|
7564
7581
|
}
|
|
7565
|
-
async function
|
|
7582
|
+
async function ri(t, e) {
|
|
7566
7583
|
const { setToolCallError: r, setPoItemPrice: n } = y.getState(), i = t.input;
|
|
7567
7584
|
let s = 0;
|
|
7568
7585
|
try {
|
|
@@ -7583,7 +7600,7 @@ async function Za(t, e) {
|
|
|
7583
7600
|
} catch (o) {
|
|
7584
7601
|
const l = o instanceof Error ? o.message : "Unknown error";
|
|
7585
7602
|
return r(t.toolCallId, l), {
|
|
7586
|
-
tool:
|
|
7603
|
+
tool: hr,
|
|
7587
7604
|
toolCallId: t.toolCallId,
|
|
7588
7605
|
output: `Failed to update cart item: ${l}`
|
|
7589
7606
|
};
|
|
@@ -7594,22 +7611,22 @@ async function Za(t, e) {
|
|
|
7594
7611
|
output: `${s} cart item(s) updated.`
|
|
7595
7612
|
};
|
|
7596
7613
|
}
|
|
7597
|
-
const
|
|
7598
|
-
addToCart:
|
|
7599
|
-
updateCart:
|
|
7600
|
-
removeFromCart:
|
|
7601
|
-
clearCart:
|
|
7602
|
-
getCart:
|
|
7603
|
-
getPurchaseOrderData:
|
|
7604
|
-
setPoMetadata:
|
|
7605
|
-
setItemWarnings:
|
|
7606
|
-
removeItemWarnings:
|
|
7607
|
-
},
|
|
7608
|
-
async function
|
|
7609
|
-
const r =
|
|
7614
|
+
const $r = {
|
|
7615
|
+
addToCart: Ha,
|
|
7616
|
+
updateCart: ri,
|
|
7617
|
+
removeFromCart: Xa,
|
|
7618
|
+
clearCart: Ka,
|
|
7619
|
+
getCart: Ja,
|
|
7620
|
+
getPurchaseOrderData: Ya,
|
|
7621
|
+
setPoMetadata: ti,
|
|
7622
|
+
setItemWarnings: ei,
|
|
7623
|
+
removeItemWarnings: Za
|
|
7624
|
+
}, ni = new Set(Object.keys($r));
|
|
7625
|
+
async function si(t, e) {
|
|
7626
|
+
const r = $r[t.toolName];
|
|
7610
7627
|
return r?.(t, e);
|
|
7611
7628
|
}
|
|
7612
|
-
function
|
|
7629
|
+
function ai(t, e) {
|
|
7613
7630
|
const n = [...t].reverse().find((i) => i.role === "assistant")?.parts?.find(
|
|
7614
7631
|
(i) => "toolCallId" in i && i.toolCallId === e && "state" in i && (i.state === "output-available" || i.state === "output-error")
|
|
7615
7632
|
);
|
|
@@ -7619,12 +7636,12 @@ function ri(t, e) {
|
|
|
7619
7636
|
errorText: "errorText" in n ? String(n.errorText) : void 0
|
|
7620
7637
|
};
|
|
7621
7638
|
}
|
|
7622
|
-
async function
|
|
7639
|
+
async function ii(t, e, r) {
|
|
7623
7640
|
const n = [], i = [];
|
|
7624
7641
|
for (const s of t) {
|
|
7625
|
-
if (!
|
|
7642
|
+
if (!ni.has(s.toolName))
|
|
7626
7643
|
continue;
|
|
7627
|
-
const o =
|
|
7644
|
+
const o = ai(
|
|
7628
7645
|
e,
|
|
7629
7646
|
s.toolCallId
|
|
7630
7647
|
);
|
|
@@ -7643,7 +7660,7 @@ async function ni(t, e, r) {
|
|
|
7643
7660
|
continue;
|
|
7644
7661
|
}
|
|
7645
7662
|
try {
|
|
7646
|
-
const l = await
|
|
7663
|
+
const l = await si(s, r);
|
|
7647
7664
|
l && (n.push(l.toolCallId), i.push(l));
|
|
7648
7665
|
} catch (l) {
|
|
7649
7666
|
console.error("[handleToolCall] Error:", { toolCall: s, error: l });
|
|
@@ -7653,9 +7670,9 @@ async function ni(t, e, r) {
|
|
|
7653
7670
|
}
|
|
7654
7671
|
return { completedToolCallIds: n, outputs: i };
|
|
7655
7672
|
}
|
|
7656
|
-
function
|
|
7673
|
+
function oi() {
|
|
7657
7674
|
try {
|
|
7658
|
-
const t = localStorage.getItem(
|
|
7675
|
+
const t = localStorage.getItem(lt);
|
|
7659
7676
|
if (!t)
|
|
7660
7677
|
return {
|
|
7661
7678
|
valid: !0,
|
|
@@ -7672,7 +7689,7 @@ function si() {
|
|
|
7672
7689
|
threadId: null,
|
|
7673
7690
|
cartEntityId: null
|
|
7674
7691
|
};
|
|
7675
|
-
if (r !==
|
|
7692
|
+
if (r !== Kt)
|
|
7676
7693
|
return {
|
|
7677
7694
|
valid: !1,
|
|
7678
7695
|
error: "The app version has changed. Your previous session is not compatible.",
|
|
@@ -7702,14 +7719,14 @@ function si() {
|
|
|
7702
7719
|
};
|
|
7703
7720
|
}
|
|
7704
7721
|
}
|
|
7705
|
-
function
|
|
7722
|
+
function ze() {
|
|
7706
7723
|
try {
|
|
7707
|
-
localStorage.removeItem(
|
|
7724
|
+
localStorage.removeItem(lt);
|
|
7708
7725
|
} catch (t) {
|
|
7709
7726
|
console.error("Failed to clear persisted session:", t);
|
|
7710
7727
|
}
|
|
7711
7728
|
}
|
|
7712
|
-
function
|
|
7729
|
+
function li(t, e) {
|
|
7713
7730
|
return !t && !e ? { valid: !0 } : t && !e ? {
|
|
7714
7731
|
valid: !1,
|
|
7715
7732
|
error: "Your previous session was reset because you signed out."
|
|
@@ -7721,22 +7738,22 @@ function ai(t, e) {
|
|
|
7721
7738
|
error: "Your previous session was reset because you signed in as a different user."
|
|
7722
7739
|
} : { valid: !0 };
|
|
7723
7740
|
}
|
|
7724
|
-
async function
|
|
7741
|
+
async function ci(t, e) {
|
|
7725
7742
|
return { valid: !0 };
|
|
7726
7743
|
}
|
|
7727
|
-
function
|
|
7744
|
+
function di(t) {
|
|
7728
7745
|
return t ? { valid: !0 } : {
|
|
7729
7746
|
valid: !1,
|
|
7730
7747
|
error: "The cart from your previous session is no longer available."
|
|
7731
7748
|
};
|
|
7732
7749
|
}
|
|
7733
|
-
async function
|
|
7750
|
+
async function ui(t) {
|
|
7734
7751
|
const e = y.getState();
|
|
7735
7752
|
if (e.ui.initStatus !== "pending")
|
|
7736
7753
|
return;
|
|
7737
|
-
const r =
|
|
7754
|
+
const r = oi();
|
|
7738
7755
|
if (e.setTakeShapeConfig(t.takeShapeConfig), !r.valid) {
|
|
7739
|
-
|
|
7756
|
+
ze(), e.failValidation(r.error ?? "Session validation failed");
|
|
7740
7757
|
return;
|
|
7741
7758
|
}
|
|
7742
7759
|
let n = [], i = null;
|
|
@@ -7749,7 +7766,7 @@ async function li(t) {
|
|
|
7749
7766
|
}
|
|
7750
7767
|
} catch (m) {
|
|
7751
7768
|
if (console.error("Failed to fetch customer addresses:", m), r.data) {
|
|
7752
|
-
|
|
7769
|
+
ze(), e.failValidation("Unable to verify customer identity.");
|
|
7753
7770
|
return;
|
|
7754
7771
|
}
|
|
7755
7772
|
}
|
|
@@ -7776,35 +7793,35 @@ async function li(t) {
|
|
|
7776
7793
|
try {
|
|
7777
7794
|
c = await t.storefrontClient.getCart(o);
|
|
7778
7795
|
} catch (m) {
|
|
7779
|
-
console.error("Failed to fetch cart:", m),
|
|
7796
|
+
console.error("Failed to fetch cart:", m), ze(), e.failValidation("Unable to restore previous cart.");
|
|
7780
7797
|
return;
|
|
7781
7798
|
}
|
|
7782
7799
|
const d = [];
|
|
7783
7800
|
d.push(
|
|
7784
7801
|
Promise.resolve(
|
|
7785
|
-
|
|
7802
|
+
li(
|
|
7786
7803
|
l.customerEntityId ?? null,
|
|
7787
7804
|
i
|
|
7788
7805
|
)
|
|
7789
7806
|
)
|
|
7790
|
-
), s && d.push(
|
|
7807
|
+
), s && d.push(ci()), o && d.push(Promise.resolve(di(c)));
|
|
7791
7808
|
const u = (await Promise.all(d)).find((m) => !m.valid);
|
|
7792
7809
|
if (u) {
|
|
7793
|
-
|
|
7810
|
+
ze(), e.failValidation(u.error ?? "Session validation failed");
|
|
7794
7811
|
return;
|
|
7795
7812
|
}
|
|
7796
7813
|
l && e.restoreSession(l), c && e.setBcCart(c), i && e.setCustomerInfo(i), n.length > 0 && e.setCustomerAddresses(n), e.completeValidation();
|
|
7797
7814
|
}
|
|
7798
|
-
function
|
|
7799
|
-
return
|
|
7815
|
+
function pi(t) {
|
|
7816
|
+
return Wr(t) && "toolCallId" in t && typeof t.toolCallId == "string" && "output" in t && t.output !== void 0 && "state" in t && t.state === "output-available";
|
|
7800
7817
|
}
|
|
7801
|
-
function
|
|
7802
|
-
return t ? t.filter(
|
|
7818
|
+
function hi(t) {
|
|
7819
|
+
return t ? t.filter(pi) : [];
|
|
7803
7820
|
}
|
|
7804
|
-
function
|
|
7821
|
+
function fi(t) {
|
|
7805
7822
|
return t.type === "dynamic-tool" ? t.toolName ?? "unknown" : t.type.slice(5);
|
|
7806
7823
|
}
|
|
7807
|
-
const
|
|
7824
|
+
const mi = new Ur({
|
|
7808
7825
|
defaultOptions: {
|
|
7809
7826
|
queries: {
|
|
7810
7827
|
staleTime: 300 * 1e3
|
|
@@ -7812,15 +7829,15 @@ const pi = new _r({
|
|
|
7812
7829
|
}
|
|
7813
7830
|
}
|
|
7814
7831
|
});
|
|
7815
|
-
function
|
|
7816
|
-
return /* @__PURE__ */ a(
|
|
7832
|
+
function gi(t) {
|
|
7833
|
+
return /* @__PURE__ */ a(_r, { client: mi, children: /* @__PURE__ */ a(bs, { client: t.bigcommerce.client, children: /* @__PURE__ */ a(yi, { ...t }) }) });
|
|
7817
7834
|
}
|
|
7818
|
-
function
|
|
7835
|
+
function yi(t) {
|
|
7819
7836
|
const e = y((s) => s.ui.initStatus), r = y((s) => s.ui.initError), n = y((s) => s.fatalError), i = y((s) => s.clearInitError);
|
|
7820
7837
|
return F(() => {
|
|
7821
|
-
e === "pending" &&
|
|
7838
|
+
e === "pending" && ui({
|
|
7822
7839
|
storefrontClient: t.bigcommerce.client,
|
|
7823
|
-
b2bClient:
|
|
7840
|
+
b2bClient: Ga({
|
|
7824
7841
|
channelId: t.bigcommerce.client.channelId,
|
|
7825
7842
|
getB2BJwt: t.bigcommerce.getB2BJwt
|
|
7826
7843
|
}),
|
|
@@ -7830,19 +7847,19 @@ function fi(t) {
|
|
|
7830
7847
|
"div",
|
|
7831
7848
|
{
|
|
7832
7849
|
className: `flex h-full items-center justify-center ${t.className ?? ""}`,
|
|
7833
|
-
children: /* @__PURE__ */ a(
|
|
7850
|
+
children: /* @__PURE__ */ a(Hs, { message: n })
|
|
7834
7851
|
}
|
|
7835
7852
|
) : e === "pending" ? /* @__PURE__ */ a(
|
|
7836
7853
|
"div",
|
|
7837
7854
|
{
|
|
7838
7855
|
className: `flex h-full items-center justify-center ${t.className ?? ""}`,
|
|
7839
|
-
children: /* @__PURE__ */ a("div", { className: "flex items-center", children: /* @__PURE__ */ a(
|
|
7856
|
+
children: /* @__PURE__ */ a("div", { className: "flex items-center", children: /* @__PURE__ */ a(Me, { size: 16 }) })
|
|
7840
7857
|
}
|
|
7841
7858
|
) : e === "existing-cart" ? /* @__PURE__ */ a(
|
|
7842
7859
|
"div",
|
|
7843
7860
|
{
|
|
7844
7861
|
className: `flex h-full items-center justify-center ${t.className ?? ""}`,
|
|
7845
|
-
children: /* @__PURE__ */ a(
|
|
7862
|
+
children: /* @__PURE__ */ a(Gs, {})
|
|
7846
7863
|
}
|
|
7847
7864
|
) : r ? /* @__PURE__ */ p(
|
|
7848
7865
|
"div",
|
|
@@ -7861,12 +7878,12 @@ function fi(t) {
|
|
|
7861
7878
|
)
|
|
7862
7879
|
]
|
|
7863
7880
|
}
|
|
7864
|
-
) : /* @__PURE__ */ a(
|
|
7881
|
+
) : /* @__PURE__ */ a(xi, { ...t });
|
|
7865
7882
|
}
|
|
7866
|
-
function
|
|
7883
|
+
function xi({
|
|
7867
7884
|
className: t = "",
|
|
7868
|
-
agentName: e =
|
|
7869
|
-
inputName: r =
|
|
7885
|
+
agentName: e = Ge,
|
|
7886
|
+
inputName: r = Ge,
|
|
7870
7887
|
bigcommerce: n,
|
|
7871
7888
|
expandOnReady: i
|
|
7872
7889
|
}) {
|
|
@@ -7880,7 +7897,7 @@ function mi({
|
|
|
7880
7897
|
thread: u,
|
|
7881
7898
|
isCreating: m,
|
|
7882
7899
|
createThread: N
|
|
7883
|
-
} =
|
|
7900
|
+
} = Ar({
|
|
7884
7901
|
agentName: e,
|
|
7885
7902
|
createOnMount: !c,
|
|
7886
7903
|
// Only create if no existing thread
|
|
@@ -7889,7 +7906,7 @@ function mi({
|
|
|
7889
7906
|
null
|
|
7890
7907
|
), I = D(
|
|
7891
7908
|
null
|
|
7892
|
-
), w =
|
|
7909
|
+
), w = De((C) => C.isExpanded), S = De((C) => C.setExpanded), g = De((C) => C.reset), A = za(), $ = xa({
|
|
7893
7910
|
client: n.client,
|
|
7894
7911
|
onError: (C) => console.error("BigCommerce error:", C)
|
|
7895
7912
|
}), O = y((C) => C.cartifact.orderId), Q = y((C) => C.cartifact.buyerInfo), G = y(
|
|
@@ -7907,8 +7924,8 @@ function mi({
|
|
|
7907
7924
|
ie.current.push(C);
|
|
7908
7925
|
},
|
|
7909
7926
|
[]
|
|
7910
|
-
), _ = D(/* @__PURE__ */ new Set()), { messages: j, sendMessage: K, status: J, error:
|
|
7911
|
-
transport: new
|
|
7927
|
+
), _ = D(/* @__PURE__ */ new Set()), { messages: j, sendMessage: K, status: J, error: Pe, setMessages: fe, addToolOutput: me } = zt({
|
|
7928
|
+
transport: new Qt({
|
|
7912
7929
|
api: `${s}/project/${o}/agents/messages`,
|
|
7913
7930
|
headers: {
|
|
7914
7931
|
Authorization: `Bearer ${l}`
|
|
@@ -7919,22 +7936,22 @@ function mi({
|
|
|
7919
7936
|
throw new Error("No messages to send");
|
|
7920
7937
|
let we = [re];
|
|
7921
7938
|
if (re.role === "user" && C.messages.length >= 2) {
|
|
7922
|
-
const ue = C.messages[C.messages.length - 2],
|
|
7923
|
-
if (ue?.role === "assistant" &&
|
|
7924
|
-
const
|
|
7939
|
+
const ue = C.messages[C.messages.length - 2], Xe = _.current;
|
|
7940
|
+
if (ue?.role === "assistant" && Xe.size > 0) {
|
|
7941
|
+
const gt = hi(
|
|
7925
7942
|
ue.parts
|
|
7926
7943
|
).filter(
|
|
7927
|
-
(
|
|
7944
|
+
(yt) => Xe.has(yt.toolCallId)
|
|
7928
7945
|
);
|
|
7929
|
-
|
|
7946
|
+
Xe.clear(), gt.length > 0 && (we = [{
|
|
7930
7947
|
...ue,
|
|
7931
|
-
parts:
|
|
7932
|
-
type:
|
|
7933
|
-
toolName:
|
|
7934
|
-
toolCallId:
|
|
7935
|
-
state:
|
|
7936
|
-
input:
|
|
7937
|
-
output:
|
|
7948
|
+
parts: gt.map((Te) => ({
|
|
7949
|
+
type: Te.type,
|
|
7950
|
+
toolName: fi(Te),
|
|
7951
|
+
toolCallId: Te.toolCallId,
|
|
7952
|
+
state: Te.state,
|
|
7953
|
+
input: Te.input,
|
|
7954
|
+
output: Te.output
|
|
7938
7955
|
}))
|
|
7939
7956
|
}, re]);
|
|
7940
7957
|
}
|
|
@@ -7965,7 +7982,7 @@ function mi({
|
|
|
7965
7982
|
}
|
|
7966
7983
|
}), ce = B(
|
|
7967
7984
|
(C) => {
|
|
7968
|
-
E.current?.end(), E.current =
|
|
7985
|
+
E.current?.end(), E.current = nt({
|
|
7969
7986
|
name: "po-agent-turn",
|
|
7970
7987
|
op: "ai.agent",
|
|
7971
7988
|
attributes: {
|
|
@@ -7982,10 +7999,10 @@ function mi({
|
|
|
7982
7999
|
}, []), F(() => {
|
|
7983
8000
|
if (J === "ready" && ie.current.length > 0) {
|
|
7984
8001
|
const C = [...ie.current];
|
|
7985
|
-
ie.current = [],
|
|
8002
|
+
ie.current = [], ii(C, j, $).then(async (re) => {
|
|
7986
8003
|
for (const we of re.outputs)
|
|
7987
8004
|
_.current.add(we.toolCallId), await me(we);
|
|
7988
|
-
re.outputs.length > 0 && ce({ text:
|
|
8005
|
+
re.outputs.length > 0 && ce({ text: ot });
|
|
7989
8006
|
}).catch((re) => {
|
|
7990
8007
|
console.error("[executeDeferredToolCalls] Error:", re);
|
|
7991
8008
|
});
|
|
@@ -8003,14 +8020,14 @@ function mi({
|
|
|
8003
8020
|
}, [ge, h, ce, k]), F(() => {
|
|
8004
8021
|
i && b === "chatting" && S(!0);
|
|
8005
8022
|
}, [i, b, S]);
|
|
8006
|
-
const T = m || J === "submitted" || J === "streaming", P = oe(() =>
|
|
8023
|
+
const T = m || J === "submitted" || J === "streaming", P = oe(() => ia(j, J), [j, J]), M = Aa({
|
|
8007
8024
|
appState: b,
|
|
8008
8025
|
setAppState: x,
|
|
8009
8026
|
parser: A,
|
|
8010
8027
|
firstResponseComplete: P,
|
|
8011
8028
|
chatPanelRef: v,
|
|
8012
8029
|
bcCart: $
|
|
8013
|
-
}), R =
|
|
8030
|
+
}), R = ba({
|
|
8014
8031
|
bcCart: $,
|
|
8015
8032
|
cartItems: V,
|
|
8016
8033
|
onCheckoutInitiated: (C) => {
|
|
@@ -8019,10 +8036,10 @@ function mi({
|
|
|
8019
8036
|
onCheckout: n.onCheckout
|
|
8020
8037
|
}), U = (C) => {
|
|
8021
8038
|
y.getState().setInput(C.target.value);
|
|
8022
|
-
},
|
|
8039
|
+
}, je = (C) => {
|
|
8023
8040
|
C.preventDefault(), d.trim() && (y.getState().sendMessage(d), y.getState().setInput(""));
|
|
8024
|
-
},
|
|
8025
|
-
I.current?.end(), I.current =
|
|
8041
|
+
}, Oe = async (C) => {
|
|
8042
|
+
I.current?.end(), I.current = nt({
|
|
8026
8043
|
name: "upload-to-checkout",
|
|
8027
8044
|
op: "purchase-order.session",
|
|
8028
8045
|
attributes: {
|
|
@@ -8071,9 +8088,9 @@ function mi({
|
|
|
8071
8088
|
]);
|
|
8072
8089
|
if (b === "upload" || b === "processing")
|
|
8073
8090
|
return /* @__PURE__ */ a("div", { className: `flex h-full ${t}`, children: /* @__PURE__ */ a(
|
|
8074
|
-
|
|
8091
|
+
ha,
|
|
8075
8092
|
{
|
|
8076
|
-
onFileUpload:
|
|
8093
|
+
onFileUpload: Oe,
|
|
8077
8094
|
onSkip: X,
|
|
8078
8095
|
onClearError: A.handleClearError,
|
|
8079
8096
|
cartItems: V,
|
|
@@ -8086,14 +8103,14 @@ function mi({
|
|
|
8086
8103
|
messages: j,
|
|
8087
8104
|
input: d,
|
|
8088
8105
|
onInputChange: U,
|
|
8089
|
-
onSubmit:
|
|
8106
|
+
onSubmit: je,
|
|
8090
8107
|
isLoading: T,
|
|
8091
|
-
error:
|
|
8092
|
-
onRetry:
|
|
8108
|
+
error: Pe,
|
|
8109
|
+
onRetry: Pe ? le : void 0,
|
|
8093
8110
|
hasProcessedDocument: M.hasProcessedDocument,
|
|
8094
8111
|
uploadedFileName: A.uploadedFileName,
|
|
8095
8112
|
chatPanelRef: v,
|
|
8096
|
-
onFileUpload:
|
|
8113
|
+
onFileUpload: Oe,
|
|
8097
8114
|
cartItems: V,
|
|
8098
8115
|
itemWarnings: ee,
|
|
8099
8116
|
onUpdateQuantity: R.handleUpdateQuantity,
|
|
@@ -8120,26 +8137,26 @@ function mi({
|
|
|
8120
8137
|
poMetadataSet: ae,
|
|
8121
8138
|
onNewOrder: ye
|
|
8122
8139
|
};
|
|
8123
|
-
return i && w ? /* @__PURE__ */ a(
|
|
8124
|
-
|
|
8140
|
+
return i && w ? /* @__PURE__ */ a(En, { children: /* @__PURE__ */ a(Rt, { ...de, onMinimize: () => S(!1) }) }) : /* @__PURE__ */ a("div", { className: "h-full max-w-[1440px] mx-auto", children: /* @__PURE__ */ a(
|
|
8141
|
+
Rt,
|
|
8125
8142
|
{
|
|
8126
8143
|
...de,
|
|
8127
8144
|
onExpand: i ? () => S(!0) : void 0
|
|
8128
8145
|
}
|
|
8129
8146
|
) });
|
|
8130
8147
|
}
|
|
8131
|
-
function
|
|
8148
|
+
function Ui({
|
|
8132
8149
|
takeshape: t,
|
|
8133
8150
|
bigcommerce: e,
|
|
8134
|
-
agentName: r =
|
|
8135
|
-
inputName: n =
|
|
8151
|
+
agentName: r = Ge,
|
|
8152
|
+
inputName: n = Ge,
|
|
8136
8153
|
onViewProduct: i,
|
|
8137
8154
|
onCheckout: s,
|
|
8138
8155
|
className: o,
|
|
8139
8156
|
expandOnReady: l
|
|
8140
8157
|
}) {
|
|
8141
8158
|
const c = oe(
|
|
8142
|
-
() =>
|
|
8159
|
+
() => kn({
|
|
8143
8160
|
endpoint: e.endpoint,
|
|
8144
8161
|
storefrontToken: e.storefrontToken,
|
|
8145
8162
|
channelId: e.channelId
|
|
@@ -8147,7 +8164,7 @@ function Ri({
|
|
|
8147
8164
|
[e.endpoint, e.storefrontToken, e.channelId]
|
|
8148
8165
|
);
|
|
8149
8166
|
return /* @__PURE__ */ a(
|
|
8150
|
-
|
|
8167
|
+
gi,
|
|
8151
8168
|
{
|
|
8152
8169
|
agentName: r,
|
|
8153
8170
|
inputName: n,
|
|
@@ -8156,8 +8173,8 @@ function Ri({
|
|
|
8156
8173
|
takeshape: {
|
|
8157
8174
|
projectId: t.projectId,
|
|
8158
8175
|
apiKey: t.apiKey,
|
|
8159
|
-
origin: t.origin ??
|
|
8160
|
-
sseOrigin: t.sseOrigin ??
|
|
8176
|
+
origin: t.origin ?? It,
|
|
8177
|
+
sseOrigin: t.sseOrigin ?? It
|
|
8161
8178
|
},
|
|
8162
8179
|
bigcommerce: {
|
|
8163
8180
|
client: c,
|
|
@@ -8169,14 +8186,14 @@ function Ri({
|
|
|
8169
8186
|
);
|
|
8170
8187
|
}
|
|
8171
8188
|
export {
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8189
|
+
Ui as P,
|
|
8190
|
+
Li as S,
|
|
8191
|
+
kn as a,
|
|
8192
|
+
Ri as b,
|
|
8193
|
+
Ga as c,
|
|
8194
|
+
gi as d,
|
|
8195
|
+
Di as i,
|
|
8196
|
+
Oi as r,
|
|
8197
|
+
_i as s
|
|
8181
8198
|
};
|
|
8182
|
-
//# sourceMappingURL=purchase-order-chat-wrapper-
|
|
8199
|
+
//# sourceMappingURL=purchase-order-chat-wrapper-Dd9F3Vhd.js.map
|