@takeshape/purchase-order-chat 1.63.0 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/{purchase-order-chat-wrapper-CMOXLHX5.js → purchase-order-chat-wrapper-BVV3Wy6e.js} +437 -420
- package/dist/purchase-order-chat-wrapper-BVV3Wy6e.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-CMOXLHX5.js.map +0 -1
package/dist/{purchase-order-chat-wrapper-CMOXLHX5.js → purchase-order-chat-wrapper-BVV3Wy6e.js}
RENAMED
|
@@ -1,43 +1,42 @@
|
|
|
1
|
-
import { useState as R, useEffect as F, createElement as
|
|
1
|
+
import { useState as R, useEffect as F, createElement as $r, useRef as D, useLayoutEffect as gt, useCallback as M, createContext as Mr, useContext as Or, useMemo as ee, forwardRef as Fr, useImperativeHandle as Dr } from "react";
|
|
2
2
|
import { jsxs as h, jsx as a, Fragment as Ce } from "react/jsx-runtime";
|
|
3
|
-
import { GraphQLClient as
|
|
4
|
-
import { initGraphQLTada as
|
|
5
|
-
import { useChat as
|
|
6
|
-
import { QueryClientProvider as
|
|
7
|
-
import { parseJsonEventStream as
|
|
8
|
-
import { create as
|
|
9
|
-
import { clsx as
|
|
10
|
-
import { twMerge as
|
|
11
|
-
import { devtools as
|
|
3
|
+
import { GraphQLClient as st, ClientError as Rr } from "graphql-request";
|
|
4
|
+
import { initGraphQLTada as jt, readFragment as Ee } from "gql.tada";
|
|
5
|
+
import { useChat as Wt } from "@ai-sdk/react";
|
|
6
|
+
import { QueryClientProvider as _r, QueryClient as Lr } from "@tanstack/react-query";
|
|
7
|
+
import { parseJsonEventStream as Ur, uiMessageChunkSchema as qr, DefaultChatTransport as Vt, isToolUIPart as jr } from "ai";
|
|
8
|
+
import { create as at } from "zustand";
|
|
9
|
+
import { clsx as Wr } from "clsx";
|
|
10
|
+
import { twMerge as Vr } from "tailwind-merge";
|
|
11
|
+
import { devtools as zr, persist as zt } from "zustand/middleware";
|
|
12
12
|
import { Streamdown as He } from "streamdown";
|
|
13
|
-
import { z as
|
|
14
|
-
import
|
|
15
|
-
import Qr from "p-map";
|
|
13
|
+
import { z as yt } from "zod";
|
|
14
|
+
import Hr from "p-map";
|
|
16
15
|
function ke(...t) {
|
|
17
|
-
return
|
|
16
|
+
return Vr(Wr(t));
|
|
18
17
|
}
|
|
19
|
-
function
|
|
18
|
+
function qi(t, e) {
|
|
20
19
|
return t.replace(/:(\w+)/g, (r, n) => {
|
|
21
20
|
const i = e[n];
|
|
22
21
|
return i != null ? String(i) : "";
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
|
-
const
|
|
26
|
-
const [e, r] = R(() =>
|
|
24
|
+
const Qr = "__vite_c_css_pos_initial_05f37d663790485ea5a6ff7e3c2189b4", xt = "__vite_c_css_pos_update_05f37d663790485ea5a6ff7e3c2189b4", bt = () => typeof window < "u" ? window[Qr] : void 0, ji = (t) => {
|
|
25
|
+
const [e, r] = R(() => bt() || /* @__PURE__ */ new Map()), [n, i] = R(0);
|
|
27
26
|
return F(() => {
|
|
28
27
|
const s = (o) => {
|
|
29
|
-
const c =
|
|
28
|
+
const c = bt() || /* @__PURE__ */ new Map();
|
|
30
29
|
r(c), i((l) => l + 1), t.onChange?.(c);
|
|
31
30
|
};
|
|
32
|
-
return window.addEventListener(
|
|
33
|
-
window.removeEventListener(
|
|
31
|
+
return window.addEventListener(xt, s), s(), () => {
|
|
32
|
+
window.removeEventListener(xt, s);
|
|
34
33
|
};
|
|
35
34
|
}, [t.onChange]), Array.from(e?.keys() || []).map((s) => {
|
|
36
35
|
const o = e.get(s);
|
|
37
|
-
return o ? /* @__PURE__ */
|
|
36
|
+
return o ? /* @__PURE__ */ $r("style", { ...o.attributes, key: `${s}-${n}` }, o.css) : null;
|
|
38
37
|
});
|
|
39
|
-
}, Qe = "bigcommercePurchaseOrderAgent",
|
|
40
|
-
function
|
|
38
|
+
}, Qe = "bigcommercePurchaseOrderAgent", Ct = "https://api.takeshape.io", Ht = "https://api-b2b.bigcommerce.com/graphql", Gr = "dl7c39mdpul6hyc489yk0vzxl6jesyx", it = "[client is providing tool response]", be = "__po_address__", Se = "__po_billing_address__", le = "__checkout_address__", ot = "purchase-order-chat-session", Qt = 3;
|
|
39
|
+
function Kr() {
|
|
41
40
|
if (typeof document < "u")
|
|
42
41
|
try {
|
|
43
42
|
const t = document.createElement("iframe");
|
|
@@ -50,13 +49,13 @@ function Jr() {
|
|
|
50
49
|
}
|
|
51
50
|
return fetch;
|
|
52
51
|
}
|
|
53
|
-
const
|
|
52
|
+
const Jr = Kr(), Ne = Jr, ve = jt(), ct = ve(`
|
|
54
53
|
fragment UserAuthorizationFragment on UserAuthorization {
|
|
55
54
|
result {
|
|
56
55
|
token
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
`),
|
|
58
|
+
`), Gt = ve(
|
|
60
59
|
`
|
|
61
60
|
mutation Authorization($authData: UserAuthType!) {
|
|
62
61
|
authorization(authData: $authData) {
|
|
@@ -64,14 +63,14 @@ const Yr = Jr(), Ne = Yr, ve = Wt(), lt = ve(`
|
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
`,
|
|
67
|
-
[
|
|
68
|
-
),
|
|
66
|
+
[ct]
|
|
67
|
+
), Kt = ve(`
|
|
69
68
|
fragment UserFragment on UserType {
|
|
70
69
|
companyInfo {
|
|
71
70
|
companyId
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
|
-
`),
|
|
73
|
+
`), Yr = ve(
|
|
75
74
|
`
|
|
76
75
|
query CurrentUser {
|
|
77
76
|
currentUser {
|
|
@@ -79,8 +78,8 @@ const Yr = Jr(), Ne = Yr, ve = Wt(), lt = ve(`
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
`,
|
|
82
|
-
[
|
|
83
|
-
),
|
|
81
|
+
[Kt]
|
|
82
|
+
), Jt = ve(`
|
|
84
83
|
fragment CompanyAddressFragment on AddressType {
|
|
85
84
|
id
|
|
86
85
|
firstName
|
|
@@ -100,7 +99,7 @@ const Yr = Jr(), Ne = Yr, ve = Wt(), lt = ve(`
|
|
|
100
99
|
isBilling
|
|
101
100
|
label
|
|
102
101
|
}
|
|
103
|
-
`),
|
|
102
|
+
`), Zr = ve(
|
|
104
103
|
`
|
|
105
104
|
query CompanyAddressesQuery(
|
|
106
105
|
$companyId: Int!
|
|
@@ -121,14 +120,14 @@ const Yr = Jr(), Ne = Yr, ve = Wt(), lt = ve(`
|
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
`,
|
|
124
|
-
[
|
|
123
|
+
[Jt]
|
|
125
124
|
);
|
|
126
125
|
ve(`
|
|
127
126
|
fragment CheckoutResultFragment on CheckoutLoginResultType {
|
|
128
127
|
redirectUrl
|
|
129
128
|
}
|
|
130
129
|
`);
|
|
131
|
-
const
|
|
130
|
+
const Xr = ve(
|
|
132
131
|
`
|
|
133
132
|
mutation CheckoutLoginMutation(
|
|
134
133
|
$cartData: CheckoutLoginType!
|
|
@@ -140,7 +139,7 @@ const en = ve(
|
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
`
|
|
143
|
-
), V =
|
|
142
|
+
), V = jt(), Be = V(`
|
|
144
143
|
fragment CartFields on Cart {
|
|
145
144
|
id
|
|
146
145
|
entityId
|
|
@@ -215,7 +214,7 @@ const en = ve(
|
|
|
215
214
|
utc
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
|
-
`),
|
|
217
|
+
`), en = V(
|
|
219
218
|
`
|
|
220
219
|
query GetCart($cartEntityId: String) {
|
|
221
220
|
site {
|
|
@@ -226,7 +225,7 @@ const en = ve(
|
|
|
226
225
|
}
|
|
227
226
|
`,
|
|
228
227
|
[Be]
|
|
229
|
-
),
|
|
228
|
+
), tn = V(
|
|
230
229
|
`
|
|
231
230
|
mutation CreateCart($input: CreateCartInput!) {
|
|
232
231
|
cart {
|
|
@@ -239,7 +238,7 @@ const en = ve(
|
|
|
239
238
|
}
|
|
240
239
|
`,
|
|
241
240
|
[Be]
|
|
242
|
-
),
|
|
241
|
+
), rn = V(
|
|
243
242
|
`
|
|
244
243
|
mutation AddCartLineItems($input: AddCartLineItemsInput!) {
|
|
245
244
|
cart {
|
|
@@ -252,7 +251,7 @@ const en = ve(
|
|
|
252
251
|
}
|
|
253
252
|
`,
|
|
254
253
|
[Be]
|
|
255
|
-
),
|
|
254
|
+
), nn = V(
|
|
256
255
|
`
|
|
257
256
|
mutation UpdateCartLineItem($input: UpdateCartLineItemInput!) {
|
|
258
257
|
cart {
|
|
@@ -265,7 +264,7 @@ const en = ve(
|
|
|
265
264
|
}
|
|
266
265
|
`,
|
|
267
266
|
[Be]
|
|
268
|
-
),
|
|
267
|
+
), sn = V(
|
|
269
268
|
`
|
|
270
269
|
mutation DeleteCartLineItem($input: DeleteCartLineItemInput!) {
|
|
271
270
|
cart {
|
|
@@ -278,7 +277,7 @@ const en = ve(
|
|
|
278
277
|
}
|
|
279
278
|
`,
|
|
280
279
|
[Be]
|
|
281
|
-
),
|
|
280
|
+
), an = V(`
|
|
282
281
|
mutation DeleteCart($input: DeleteCartInput!) {
|
|
283
282
|
cart {
|
|
284
283
|
deleteCart(input: $input) {
|
|
@@ -286,7 +285,7 @@ const en = ve(
|
|
|
286
285
|
}
|
|
287
286
|
}
|
|
288
287
|
}
|
|
289
|
-
`),
|
|
288
|
+
`), on = V(`
|
|
290
289
|
mutation CreateCartRedirectUrls($input: CreateCartRedirectUrlsInput) {
|
|
291
290
|
cart {
|
|
292
291
|
createCartRedirectUrls(input: $input) {
|
|
@@ -296,7 +295,7 @@ const en = ve(
|
|
|
296
295
|
}
|
|
297
296
|
}
|
|
298
297
|
}
|
|
299
|
-
`),
|
|
298
|
+
`), cn = V(`
|
|
300
299
|
mutation CreateCartMetafield($input: CreateCartMetafieldInput!) {
|
|
301
300
|
cart {
|
|
302
301
|
createCartMetafield(input: $input) {
|
|
@@ -383,7 +382,7 @@ const en = ve(
|
|
|
383
382
|
lineItemIds
|
|
384
383
|
}
|
|
385
384
|
}
|
|
386
|
-
`),
|
|
385
|
+
`), ln = V(
|
|
387
386
|
`
|
|
388
387
|
query GetCheckout($checkoutEntityId: String) {
|
|
389
388
|
site {
|
|
@@ -394,7 +393,7 @@ const en = ve(
|
|
|
394
393
|
}
|
|
395
394
|
`,
|
|
396
395
|
[$e]
|
|
397
|
-
),
|
|
396
|
+
), dn = V(
|
|
398
397
|
`
|
|
399
398
|
mutation AddCheckoutShippingConsignments($input: AddCheckoutShippingConsignmentsInput!) {
|
|
400
399
|
checkout {
|
|
@@ -407,7 +406,7 @@ const en = ve(
|
|
|
407
406
|
}
|
|
408
407
|
`,
|
|
409
408
|
[$e]
|
|
410
|
-
),
|
|
409
|
+
), un = V(
|
|
411
410
|
`
|
|
412
411
|
mutation AddCheckoutBillingAddressMutation($input: AddCheckoutBillingAddressInput!) {
|
|
413
412
|
checkout {
|
|
@@ -435,7 +434,7 @@ V(
|
|
|
435
434
|
`,
|
|
436
435
|
[$e]
|
|
437
436
|
);
|
|
438
|
-
const
|
|
437
|
+
const pn = V(
|
|
439
438
|
`
|
|
440
439
|
mutation UpdateCheckoutCustomerMessage($input: UpdateCheckoutCustomerMessageInput!) {
|
|
441
440
|
checkout {
|
|
@@ -448,7 +447,7 @@ const hn = V(
|
|
|
448
447
|
}
|
|
449
448
|
`,
|
|
450
449
|
[$e]
|
|
451
|
-
),
|
|
450
|
+
), vt = V(`
|
|
452
451
|
query GetProductDisplayData($entityIds: [Int!], $variantEntityIds: [Int!], $first: Int = 50) {
|
|
453
452
|
site {
|
|
454
453
|
products(entityIds: $entityIds, first: $first) {
|
|
@@ -540,7 +539,7 @@ const hn = V(
|
|
|
540
539
|
}
|
|
541
540
|
}
|
|
542
541
|
}
|
|
543
|
-
`),
|
|
542
|
+
`), hn = V(`
|
|
544
543
|
query GetVariantByOptions($productEntityId: Int!, $optionValueIds: [OptionValueId!]!) {
|
|
545
544
|
site {
|
|
546
545
|
product(entityId: $productEntityId) {
|
|
@@ -588,7 +587,7 @@ const hn = V(
|
|
|
588
587
|
}
|
|
589
588
|
}
|
|
590
589
|
}
|
|
591
|
-
`),
|
|
590
|
+
`), fn = V(`
|
|
592
591
|
query GetProductVariantDetails($entityIds: [Int!], $first: Int = 50) {
|
|
593
592
|
site {
|
|
594
593
|
products(entityIds: $entityIds, first: $first) {
|
|
@@ -674,7 +673,7 @@ const hn = V(
|
|
|
674
673
|
}
|
|
675
674
|
}
|
|
676
675
|
}
|
|
677
|
-
`),
|
|
676
|
+
`), Yt = V(`
|
|
678
677
|
fragment CustomerAddressFields on CustomerAddress {
|
|
679
678
|
entityId
|
|
680
679
|
firstName
|
|
@@ -688,7 +687,7 @@ const hn = V(
|
|
|
688
687
|
country
|
|
689
688
|
phone
|
|
690
689
|
}
|
|
691
|
-
`),
|
|
690
|
+
`), It = V(
|
|
692
691
|
`
|
|
693
692
|
query GetCustomerAddresses($first: Int = 50, $after: String) {
|
|
694
693
|
customer {
|
|
@@ -710,8 +709,8 @@ const hn = V(
|
|
|
710
709
|
}
|
|
711
710
|
}
|
|
712
711
|
`,
|
|
713
|
-
[
|
|
714
|
-
),
|
|
712
|
+
[Yt]
|
|
713
|
+
), mn = V(`
|
|
715
714
|
query GetProductVariantsPage($entityId: Int!, $first: Int = 50, $after: String!) {
|
|
716
715
|
site {
|
|
717
716
|
product(entityId: $entityId) {
|
|
@@ -762,7 +761,7 @@ const hn = V(
|
|
|
762
761
|
}
|
|
763
762
|
}
|
|
764
763
|
}
|
|
765
|
-
`),
|
|
764
|
+
`), gn = V(`
|
|
766
765
|
query GetProductOptionsPage($entityId: Int!, $first: Int = 50, $after: String!) {
|
|
767
766
|
site {
|
|
768
767
|
product(entityId: $entityId) {
|
|
@@ -799,7 +798,7 @@ const hn = V(
|
|
|
799
798
|
}
|
|
800
799
|
}
|
|
801
800
|
}
|
|
802
|
-
`),
|
|
801
|
+
`), yn = V(`
|
|
803
802
|
query GetProductOptionValuesPage($entityId: Int!, $optionEntityId: Int!, $first: Int = 50, $after: String!) {
|
|
804
803
|
site {
|
|
805
804
|
product(entityId: $entityId) {
|
|
@@ -842,8 +841,8 @@ V(`
|
|
|
842
841
|
}
|
|
843
842
|
}
|
|
844
843
|
`);
|
|
845
|
-
function
|
|
846
|
-
const e = Ee(
|
|
844
|
+
function xn(t) {
|
|
845
|
+
const e = Ee(Jt, t);
|
|
847
846
|
return {
|
|
848
847
|
source: "b2b",
|
|
849
848
|
id: `${e.id}`,
|
|
@@ -864,8 +863,8 @@ function bn(t) {
|
|
|
864
863
|
label: e.label || void 0
|
|
865
864
|
};
|
|
866
865
|
}
|
|
867
|
-
function
|
|
868
|
-
const r = Ee(
|
|
866
|
+
function bn(t, e = 0) {
|
|
867
|
+
const r = Ee(Yt, t);
|
|
869
868
|
return {
|
|
870
869
|
source: "storefront",
|
|
871
870
|
id: `${r.entityId}`,
|
|
@@ -907,11 +906,11 @@ function je(t, e) {
|
|
|
907
906
|
label: "PO Address"
|
|
908
907
|
};
|
|
909
908
|
}
|
|
910
|
-
const
|
|
909
|
+
const Cn = 20;
|
|
911
910
|
async function We(t, e, r, n) {
|
|
912
911
|
const i = [];
|
|
913
912
|
let s, o = 0;
|
|
914
|
-
for (; o <
|
|
913
|
+
for (; o < Cn; ) {
|
|
915
914
|
const c = s !== void 0 ? { ...r, after: s } : { ...r }, l = await t.request({
|
|
916
915
|
document: e,
|
|
917
916
|
variables: c
|
|
@@ -929,10 +928,10 @@ function De(t) {
|
|
|
929
928
|
function Ve(t) {
|
|
930
929
|
return Ee($e, t);
|
|
931
930
|
}
|
|
932
|
-
function
|
|
931
|
+
function vn(t) {
|
|
933
932
|
return t.startsWith("http://") || t.startsWith("https://") ? t : typeof window < "u" && window.location?.origin ? `${window.location.origin}${t.startsWith("/") ? "" : "/"}${t}` : t;
|
|
934
933
|
}
|
|
935
|
-
class
|
|
934
|
+
class In {
|
|
936
935
|
endpoint;
|
|
937
936
|
storefrontToken;
|
|
938
937
|
graphQLClient;
|
|
@@ -941,12 +940,12 @@ class wn {
|
|
|
941
940
|
requestQueue = [];
|
|
942
941
|
channelId;
|
|
943
942
|
constructor(e) {
|
|
944
|
-
this.endpoint =
|
|
943
|
+
this.endpoint = vn(e.endpoint), this.storefrontToken = e.storefrontToken, this.channelId = e.channelId ?? 1;
|
|
945
944
|
const r = {
|
|
946
945
|
"content-type": "application/json",
|
|
947
946
|
accept: "application/json"
|
|
948
947
|
};
|
|
949
|
-
this.storefrontToken && (r.authorization = `Bearer ${this.storefrontToken}`), this.graphQLClient = new
|
|
948
|
+
this.storefrontToken && (r.authorization = `Bearer ${this.storefrontToken}`), this.graphQLClient = new st(this.endpoint, {
|
|
950
949
|
fetch: Ne,
|
|
951
950
|
credentials: "same-origin",
|
|
952
951
|
headers: r
|
|
@@ -980,7 +979,7 @@ class wn {
|
|
|
980
979
|
* These are errors like "out of stock", "invalid product", etc. that won't succeed on retry.
|
|
981
980
|
*/
|
|
982
981
|
isGraphQLBusinessError(e) {
|
|
983
|
-
return e instanceof
|
|
982
|
+
return e instanceof Rr && e.response.status === 200;
|
|
984
983
|
}
|
|
985
984
|
/**
|
|
986
985
|
* Extract a clean error message from a GraphQL error or generic error.
|
|
@@ -1022,7 +1021,7 @@ class wn {
|
|
|
1022
1021
|
*/
|
|
1023
1022
|
async getCart(e) {
|
|
1024
1023
|
const n = (await this.request({
|
|
1025
|
-
document:
|
|
1024
|
+
document: en,
|
|
1026
1025
|
variables: {
|
|
1027
1026
|
cartEntityId: e
|
|
1028
1027
|
}
|
|
@@ -1098,7 +1097,7 @@ class wn {
|
|
|
1098
1097
|
async addBatchToCart(e, r, { retry: n = !0 } = {}) {
|
|
1099
1098
|
const s = (await this.request(
|
|
1100
1099
|
{
|
|
1101
|
-
document:
|
|
1100
|
+
document: rn,
|
|
1102
1101
|
variables: {
|
|
1103
1102
|
input: {
|
|
1104
1103
|
cartEntityId: e,
|
|
@@ -1155,7 +1154,7 @@ class wn {
|
|
|
1155
1154
|
async createCartBatch(e, { retry: r = !0 } = {}) {
|
|
1156
1155
|
const i = (await this.request(
|
|
1157
1156
|
{
|
|
1158
|
-
document:
|
|
1157
|
+
document: tn,
|
|
1159
1158
|
variables: {
|
|
1160
1159
|
input: {
|
|
1161
1160
|
lineItems: e.map((s) => ({
|
|
@@ -1241,7 +1240,7 @@ class wn {
|
|
|
1241
1240
|
*/
|
|
1242
1241
|
async updateCartLineItem(e, r, n, i, s) {
|
|
1243
1242
|
const c = (await this.request({
|
|
1244
|
-
document:
|
|
1243
|
+
document: nn,
|
|
1245
1244
|
variables: {
|
|
1246
1245
|
input: {
|
|
1247
1246
|
cartEntityId: e,
|
|
@@ -1263,7 +1262,7 @@ class wn {
|
|
|
1263
1262
|
*/
|
|
1264
1263
|
async deleteCartLineItem(e, r) {
|
|
1265
1264
|
const i = (await this.request({
|
|
1266
|
-
document:
|
|
1265
|
+
document: sn,
|
|
1267
1266
|
variables: {
|
|
1268
1267
|
input: {
|
|
1269
1268
|
cartEntityId: e,
|
|
@@ -1278,7 +1277,7 @@ class wn {
|
|
|
1278
1277
|
*/
|
|
1279
1278
|
async deleteCart(e) {
|
|
1280
1279
|
return (await this.request({
|
|
1281
|
-
document:
|
|
1280
|
+
document: an,
|
|
1282
1281
|
variables: {
|
|
1283
1282
|
input: {
|
|
1284
1283
|
cartEntityId: e
|
|
@@ -1300,7 +1299,7 @@ class wn {
|
|
|
1300
1299
|
*/
|
|
1301
1300
|
async createCartRedirectUrls(e) {
|
|
1302
1301
|
return (await this.request({
|
|
1303
|
-
document:
|
|
1302
|
+
document: on,
|
|
1304
1303
|
variables: {
|
|
1305
1304
|
input: {
|
|
1306
1305
|
cartEntityId: e
|
|
@@ -1313,7 +1312,7 @@ class wn {
|
|
|
1313
1312
|
*/
|
|
1314
1313
|
async createCartMetafield(e, r, n) {
|
|
1315
1314
|
await this.executeWithRetry({
|
|
1316
|
-
document:
|
|
1315
|
+
document: cn,
|
|
1317
1316
|
variables: {
|
|
1318
1317
|
input: {
|
|
1319
1318
|
cartEntityId: e,
|
|
@@ -1331,7 +1330,7 @@ class wn {
|
|
|
1331
1330
|
*/
|
|
1332
1331
|
async getCheckout(e) {
|
|
1333
1332
|
const n = (await this.request({
|
|
1334
|
-
document:
|
|
1333
|
+
document: ln,
|
|
1335
1334
|
variables: {
|
|
1336
1335
|
checkoutEntityId: e
|
|
1337
1336
|
}
|
|
@@ -1344,7 +1343,7 @@ class wn {
|
|
|
1344
1343
|
*/
|
|
1345
1344
|
async setCheckoutShippingAddress(e, r, n) {
|
|
1346
1345
|
const s = (await this.request({
|
|
1347
|
-
document:
|
|
1346
|
+
document: dn,
|
|
1348
1347
|
variables: {
|
|
1349
1348
|
input: {
|
|
1350
1349
|
checkoutEntityId: e,
|
|
@@ -1367,7 +1366,7 @@ class wn {
|
|
|
1367
1366
|
*/
|
|
1368
1367
|
async setCheckoutBillingAddress(e, r) {
|
|
1369
1368
|
const i = (await this.request({
|
|
1370
|
-
document:
|
|
1369
|
+
document: un,
|
|
1371
1370
|
variables: {
|
|
1372
1371
|
input: {
|
|
1373
1372
|
checkoutEntityId: e,
|
|
@@ -1386,7 +1385,7 @@ class wn {
|
|
|
1386
1385
|
*/
|
|
1387
1386
|
async getCustomerAddresses() {
|
|
1388
1387
|
const e = await this.request({
|
|
1389
|
-
document:
|
|
1388
|
+
document: It
|
|
1390
1389
|
});
|
|
1391
1390
|
if (!e.customer)
|
|
1392
1391
|
return {
|
|
@@ -1402,14 +1401,14 @@ class wn {
|
|
|
1402
1401
|
if (e.customer.addresses.pageInfo.hasNextPage) {
|
|
1403
1402
|
const s = await We(
|
|
1404
1403
|
this,
|
|
1405
|
-
|
|
1404
|
+
It,
|
|
1406
1405
|
{ after: e.customer.addresses.pageInfo.endCursor },
|
|
1407
1406
|
(o) => o.customer?.addresses ?? null
|
|
1408
1407
|
);
|
|
1409
1408
|
n.push(...s);
|
|
1410
1409
|
}
|
|
1411
1410
|
const i = n.map(
|
|
1412
|
-
(s, o) =>
|
|
1411
|
+
(s, o) => bn(s.node, o)
|
|
1413
1412
|
);
|
|
1414
1413
|
return {
|
|
1415
1414
|
customerInfo: r,
|
|
@@ -1425,7 +1424,7 @@ class wn {
|
|
|
1425
1424
|
r.purchaseOrderNumber && (n += `PO Number: ${r.purchaseOrderNumber}, `), r.threadId && (n && (n += `
|
|
1426
1425
|
`), n += `Thread ID: ${r.threadId}`);
|
|
1427
1426
|
const s = (await this.request({
|
|
1428
|
-
document:
|
|
1427
|
+
document: pn,
|
|
1429
1428
|
variables: {
|
|
1430
1429
|
input: {
|
|
1431
1430
|
checkoutEntityId: e,
|
|
@@ -1444,7 +1443,7 @@ class wn {
|
|
|
1444
1443
|
*/
|
|
1445
1444
|
async getProductVariantDetails(e) {
|
|
1446
1445
|
const r = await this.request({
|
|
1447
|
-
document:
|
|
1446
|
+
document: fn,
|
|
1448
1447
|
variables: {
|
|
1449
1448
|
entityIds: e
|
|
1450
1449
|
}
|
|
@@ -1454,7 +1453,7 @@ class wn {
|
|
|
1454
1453
|
if (s.variants.pageInfo.hasNextPage) {
|
|
1455
1454
|
const d = await We(
|
|
1456
1455
|
this,
|
|
1457
|
-
|
|
1456
|
+
mn,
|
|
1458
1457
|
{
|
|
1459
1458
|
entityId: s.entityId,
|
|
1460
1459
|
after: s.variants.pageInfo.endCursor
|
|
@@ -1467,7 +1466,7 @@ class wn {
|
|
|
1467
1466
|
if (s.productOptions.pageInfo.hasNextPage) {
|
|
1468
1467
|
const d = await We(
|
|
1469
1468
|
this,
|
|
1470
|
-
|
|
1469
|
+
gn,
|
|
1471
1470
|
{
|
|
1472
1471
|
entityId: s.entityId,
|
|
1473
1472
|
after: s.productOptions.pageInfo.endCursor
|
|
@@ -1482,7 +1481,7 @@ class wn {
|
|
|
1482
1481
|
if (p.values?.pageInfo.hasNextPage && p.values.pageInfo.endCursor) {
|
|
1483
1482
|
const u = await We(
|
|
1484
1483
|
this,
|
|
1485
|
-
|
|
1484
|
+
yn,
|
|
1486
1485
|
{
|
|
1487
1486
|
entityId: s.entityId,
|
|
1488
1487
|
optionEntityId: p.entityId,
|
|
@@ -1547,7 +1546,7 @@ class wn {
|
|
|
1547
1546
|
const i = [];
|
|
1548
1547
|
if (e.length <= 50) {
|
|
1549
1548
|
const c = await this.request({
|
|
1550
|
-
document:
|
|
1549
|
+
document: vt,
|
|
1551
1550
|
variables: {
|
|
1552
1551
|
entityIds: e,
|
|
1553
1552
|
variantEntityIds: r?.length ? r : void 0
|
|
@@ -1561,7 +1560,7 @@ class wn {
|
|
|
1561
1560
|
const o = await Promise.all(
|
|
1562
1561
|
s.map(
|
|
1563
1562
|
(c) => this.request({
|
|
1564
|
-
document:
|
|
1563
|
+
document: vt,
|
|
1565
1564
|
variables: {
|
|
1566
1565
|
entityIds: c,
|
|
1567
1566
|
variantEntityIds: r?.length ? r : void 0
|
|
@@ -1634,7 +1633,7 @@ class wn {
|
|
|
1634
1633
|
*/
|
|
1635
1634
|
async getVariantByOptions(e, r) {
|
|
1636
1635
|
const i = (await this.request({
|
|
1637
|
-
document:
|
|
1636
|
+
document: hn,
|
|
1638
1637
|
variables: {
|
|
1639
1638
|
productEntityId: e,
|
|
1640
1639
|
optionValueIds: r
|
|
@@ -1660,19 +1659,19 @@ class wn {
|
|
|
1660
1659
|
};
|
|
1661
1660
|
}
|
|
1662
1661
|
}
|
|
1663
|
-
function
|
|
1662
|
+
function Wi(t) {
|
|
1664
1663
|
return `https://store-${t}.mybigcommerce.com/graphql`;
|
|
1665
1664
|
}
|
|
1666
|
-
function
|
|
1667
|
-
return new
|
|
1665
|
+
function wn(t) {
|
|
1666
|
+
return new In(t);
|
|
1668
1667
|
}
|
|
1669
|
-
const Re =
|
|
1668
|
+
const Re = at((t) => ({
|
|
1670
1669
|
isExpanded: !1,
|
|
1671
1670
|
setExpanded: (e) => t({ isExpanded: e }),
|
|
1672
1671
|
toggleExpanded: () => t((e) => ({ isExpanded: !e.isExpanded })),
|
|
1673
1672
|
reset: () => t({ isExpanded: !1 })
|
|
1674
1673
|
}));
|
|
1675
|
-
function
|
|
1674
|
+
function Sn({ children: t }) {
|
|
1676
1675
|
const e = Re((i) => i.isExpanded), r = Re((i) => i.setExpanded), n = D(null);
|
|
1677
1676
|
return F(() => {
|
|
1678
1677
|
if (!e) return;
|
|
@@ -1680,13 +1679,13 @@ function En({ children: t }) {
|
|
|
1680
1679
|
s.key === "Escape" && r(!1);
|
|
1681
1680
|
};
|
|
1682
1681
|
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
1683
|
-
}, [e, r]),
|
|
1682
|
+
}, [e, r]), gt(() => {
|
|
1684
1683
|
if (!e) return;
|
|
1685
1684
|
const i = window.scrollY, s = document.body.style.overflow, o = document.body.style.position, c = document.body.style.top, l = document.body.style.width;
|
|
1686
1685
|
return document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${i}px`, document.body.style.width = "100%", () => {
|
|
1687
1686
|
document.body.style.overflow = s, document.body.style.position = o, document.body.style.top = c, document.body.style.width = l, window.scrollTo(0, i);
|
|
1688
1687
|
};
|
|
1689
|
-
}, [e]),
|
|
1688
|
+
}, [e]), gt(() => {
|
|
1690
1689
|
if (!e || !n.current) return;
|
|
1691
1690
|
const i = n.current.getRootNode();
|
|
1692
1691
|
if (!(i instanceof ShadowRoot)) return;
|
|
@@ -1722,28 +1721,28 @@ function En({ children: t }) {
|
|
|
1722
1721
|
}
|
|
1723
1722
|
) : null;
|
|
1724
1723
|
}
|
|
1725
|
-
const
|
|
1726
|
-
function
|
|
1724
|
+
const En = /* @__PURE__ */ new Set(["image/heic", "image/heif"]), Nn = /* @__PURE__ */ new Set([".heic", ".heif"]);
|
|
1725
|
+
function kn(t) {
|
|
1727
1726
|
const e = t.lastIndexOf(".");
|
|
1728
1727
|
return e === -1 ? "" : t.slice(e).toLowerCase();
|
|
1729
1728
|
}
|
|
1730
|
-
function
|
|
1731
|
-
return
|
|
1729
|
+
function Zt(t) {
|
|
1730
|
+
return En.has(t.type) ? !0 : t.type !== "" && t.type !== "application/octet-stream" ? !1 : Nn.has(kn(t.name));
|
|
1732
1731
|
}
|
|
1733
|
-
function
|
|
1732
|
+
function Xt(t) {
|
|
1734
1733
|
return t.replace(/\.heic$/i, ".jpg").replace(/\.heif$/i, ".jpg");
|
|
1735
1734
|
}
|
|
1736
|
-
async function
|
|
1735
|
+
async function Pn(t, e) {
|
|
1737
1736
|
try {
|
|
1738
1737
|
const r = await createImageBitmap(t), n = new OffscreenCanvas(r.width, r.height);
|
|
1739
1738
|
n.getContext("2d").drawImage(r, 0, 0), r.close();
|
|
1740
1739
|
const s = await n.convertToBlob({ type: "image/jpeg", quality: e });
|
|
1741
|
-
return new File([s],
|
|
1740
|
+
return new File([s], Xt(t.name), { type: "image/jpeg" });
|
|
1742
1741
|
} catch {
|
|
1743
1742
|
return null;
|
|
1744
1743
|
}
|
|
1745
1744
|
}
|
|
1746
|
-
async function
|
|
1745
|
+
async function Tn(t, e) {
|
|
1747
1746
|
const { HeifDecoder: r } = await import("libheif-js/wasm-bundle"), n = await new Promise((v, b) => {
|
|
1748
1747
|
const x = new FileReader();
|
|
1749
1748
|
x.onload = () => v(new Uint8Array(x.result)), x.onerror = () => b(new Error("Failed to read file")), x.readAsArrayBuffer(t);
|
|
@@ -1761,15 +1760,15 @@ async function An(t, e) {
|
|
|
1761
1760
|
});
|
|
1762
1761
|
}), p.putImageData(u, 0, 0);
|
|
1763
1762
|
const m = await d.convertToBlob({ type: "image/jpeg", quality: e });
|
|
1764
|
-
return new File([m],
|
|
1763
|
+
return new File([m], Xt(t.name), { type: "image/jpeg" });
|
|
1765
1764
|
}
|
|
1766
|
-
async function
|
|
1767
|
-
if (!
|
|
1765
|
+
async function An(t) {
|
|
1766
|
+
if (!Zt(t)) return t;
|
|
1768
1767
|
console.debug("heic file detected, attempting to convert");
|
|
1769
|
-
const e = 0.9, r = await
|
|
1770
|
-
return r ? (console.debug("native heic conversion successful"), r) : (console.debug("falling back to libheif conversion"),
|
|
1768
|
+
const e = 0.9, r = await Pn(t, e);
|
|
1769
|
+
return r ? (console.debug("native heic conversion successful"), r) : (console.debug("falling back to libheif conversion"), Tn(t, e));
|
|
1771
1770
|
}
|
|
1772
|
-
const
|
|
1771
|
+
const er = {
|
|
1773
1772
|
"application/pdf": ".pdf",
|
|
1774
1773
|
"text/csv": ".csv",
|
|
1775
1774
|
"application/vnd.ms-excel": ".xls",
|
|
@@ -1782,9 +1781,9 @@ const tr = {
|
|
|
1782
1781
|
"image/webp": ".webp",
|
|
1783
1782
|
"image/heic": ".heic",
|
|
1784
1783
|
"image/heif": ".heif"
|
|
1785
|
-
},
|
|
1784
|
+
}, Bn = Object.keys(er), $n = Object.values(er).flatMap(
|
|
1786
1785
|
(t) => t.split(",")
|
|
1787
|
-
),
|
|
1786
|
+
), Mn = [
|
|
1788
1787
|
".png",
|
|
1789
1788
|
".jpg",
|
|
1790
1789
|
".jpeg",
|
|
@@ -1797,40 +1796,40 @@ const tr = {
|
|
|
1797
1796
|
".tif",
|
|
1798
1797
|
".svg",
|
|
1799
1798
|
".avif"
|
|
1800
|
-
],
|
|
1801
|
-
function
|
|
1802
|
-
if (t.size >
|
|
1799
|
+
], tr = $n.join(","), rr = "image/png,image/jpeg,image/gif,image/webp", On = "PDF, Excel, CSV, text, or image files", Fn = "PNG, JPEG, GIF, or WebP", nr = ["PDF", "Excel", "CSV", "Images"], Dn = 10 * 1024 * 1024;
|
|
1800
|
+
function Rn(t) {
|
|
1801
|
+
if (t.size > Dn)
|
|
1803
1802
|
return {
|
|
1804
1803
|
valid: !1,
|
|
1805
1804
|
error: "File size exceeds 10MB limit. Please choose a smaller file."
|
|
1806
1805
|
};
|
|
1807
|
-
if (
|
|
1806
|
+
if (!Bn.includes(t.type)) {
|
|
1808
1807
|
const e = t.name.includes(".") ? `.${t.name.split(".").pop()?.toLowerCase()}` : void 0;
|
|
1809
|
-
return t.type.startsWith("image/") || e &&
|
|
1808
|
+
return t.type.startsWith("image/") || e && Mn.includes(e) ? {
|
|
1810
1809
|
valid: !1,
|
|
1811
|
-
error: `Image type not supported. Please upload ${
|
|
1810
|
+
error: `Image type not supported. Please upload ${Fn} images.`
|
|
1812
1811
|
} : {
|
|
1813
1812
|
valid: !1,
|
|
1814
|
-
error: `File type not supported. Please upload ${
|
|
1813
|
+
error: `File type not supported. Please upload ${On}.`
|
|
1815
1814
|
};
|
|
1816
1815
|
}
|
|
1817
1816
|
return { valid: !0 };
|
|
1818
1817
|
}
|
|
1819
|
-
function
|
|
1818
|
+
function sr({ onFile: t, onBeforeValidate: e }) {
|
|
1820
1819
|
const [r, n] = R(!1), [i, s] = R(null), o = D(null), c = D(null), l = M(
|
|
1821
1820
|
async (x) => {
|
|
1822
1821
|
e?.(), s(null);
|
|
1823
1822
|
let I = x;
|
|
1824
|
-
if (
|
|
1823
|
+
if (Zt(x))
|
|
1825
1824
|
try {
|
|
1826
|
-
I = await
|
|
1825
|
+
I = await An(x);
|
|
1827
1826
|
} catch {
|
|
1828
1827
|
s(
|
|
1829
1828
|
"Failed to convert HEIC image. Please convert to JPEG and try again."
|
|
1830
1829
|
);
|
|
1831
1830
|
return;
|
|
1832
1831
|
}
|
|
1833
|
-
const w =
|
|
1832
|
+
const w = Rn(I);
|
|
1834
1833
|
if (!w.valid) {
|
|
1835
1834
|
s(w.error ?? null);
|
|
1836
1835
|
return;
|
|
@@ -1875,7 +1874,7 @@ function ar({ onFile: t, onBeforeValidate: e }) {
|
|
|
1875
1874
|
openCamera: b
|
|
1876
1875
|
};
|
|
1877
1876
|
}
|
|
1878
|
-
const
|
|
1877
|
+
const _n = () => /* @__PURE__ */ h(
|
|
1879
1878
|
"svg",
|
|
1880
1879
|
{
|
|
1881
1880
|
width: "18",
|
|
@@ -1905,7 +1904,7 @@ const Ln = () => /* @__PURE__ */ h(
|
|
|
1905
1904
|
/* @__PURE__ */ a("polyline", { points: "20 6 9 17 4 12" })
|
|
1906
1905
|
]
|
|
1907
1906
|
}
|
|
1908
|
-
),
|
|
1907
|
+
), ar = ({ size: t = 12 }) => /* @__PURE__ */ h(
|
|
1909
1908
|
"svg",
|
|
1910
1909
|
{
|
|
1911
1910
|
width: t,
|
|
@@ -1922,7 +1921,7 @@ const Ln = () => /* @__PURE__ */ h(
|
|
|
1922
1921
|
/* @__PURE__ */ a("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
1923
1922
|
]
|
|
1924
1923
|
}
|
|
1925
|
-
),
|
|
1924
|
+
), ir = ({ size: t = 16 }) => /* @__PURE__ */ h(
|
|
1926
1925
|
"svg",
|
|
1927
1926
|
{
|
|
1928
1927
|
width: t,
|
|
@@ -1941,7 +1940,7 @@ const Ln = () => /* @__PURE__ */ h(
|
|
|
1941
1940
|
/* @__PURE__ */ a("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
1942
1941
|
]
|
|
1943
1942
|
}
|
|
1944
|
-
),
|
|
1943
|
+
), or = ({ size: t = 16 }) => /* @__PURE__ */ h(
|
|
1945
1944
|
"svg",
|
|
1946
1945
|
{
|
|
1947
1946
|
width: t,
|
|
@@ -1960,7 +1959,7 @@ const Ln = () => /* @__PURE__ */ h(
|
|
|
1960
1959
|
/* @__PURE__ */ a("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
1961
1960
|
]
|
|
1962
1961
|
}
|
|
1963
|
-
),
|
|
1962
|
+
), Ln = ({
|
|
1964
1963
|
size: t = 12,
|
|
1965
1964
|
title: e = "Error"
|
|
1966
1965
|
}) => /* @__PURE__ */ h(
|
|
@@ -1995,7 +1994,7 @@ const Ln = () => /* @__PURE__ */ h(
|
|
|
1995
1994
|
]
|
|
1996
1995
|
}
|
|
1997
1996
|
);
|
|
1998
|
-
function
|
|
1997
|
+
function Un({
|
|
1999
1998
|
addresses: t,
|
|
2000
1999
|
selectedAddressId: e,
|
|
2001
2000
|
addressUpdateStatus: r = "idle",
|
|
@@ -2016,7 +2015,7 @@ function qn({
|
|
|
2016
2015
|
),
|
|
2017
2016
|
children: [
|
|
2018
2017
|
s && /* @__PURE__ */ a(
|
|
2019
|
-
|
|
2018
|
+
wt,
|
|
2020
2019
|
{
|
|
2021
2020
|
label: "Bill to",
|
|
2022
2021
|
onAddressChange: l,
|
|
@@ -2030,7 +2029,7 @@ function qn({
|
|
|
2030
2029
|
}
|
|
2031
2030
|
),
|
|
2032
2031
|
/* @__PURE__ */ a(
|
|
2033
|
-
|
|
2032
|
+
wt,
|
|
2034
2033
|
{
|
|
2035
2034
|
label: "Ship to",
|
|
2036
2035
|
onAddressChange: n,
|
|
@@ -2047,7 +2046,7 @@ function qn({
|
|
|
2047
2046
|
}
|
|
2048
2047
|
);
|
|
2049
2048
|
}
|
|
2050
|
-
function
|
|
2049
|
+
function wt(t) {
|
|
2051
2050
|
const {
|
|
2052
2051
|
label: e,
|
|
2053
2052
|
addresses: r,
|
|
@@ -2078,7 +2077,7 @@ function St(t) {
|
|
|
2078
2077
|
"Updated"
|
|
2079
2078
|
] }),
|
|
2080
2079
|
i === "error" && /* @__PURE__ */ h("span", { className: "flex items-center gap-0.5 text-2xs font-semibold text-error-text uppercase tracking-[0.025em]", children: [
|
|
2081
|
-
/* @__PURE__ */ a(
|
|
2080
|
+
/* @__PURE__ */ a(Ln, { size: 12, title: "Failed" }),
|
|
2082
2081
|
"Failed to update"
|
|
2083
2082
|
] })
|
|
2084
2083
|
] }),
|
|
@@ -2091,11 +2090,11 @@ function St(t) {
|
|
|
2091
2090
|
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",
|
|
2092
2091
|
children: [
|
|
2093
2092
|
o && /* @__PURE__ */ h(Ce, { children: [
|
|
2094
|
-
/* @__PURE__ */ a("option", { value: o.id, children: /* @__PURE__ */ a(
|
|
2093
|
+
/* @__PURE__ */ a("option", { value: o.id, children: /* @__PURE__ */ a(St, { address: o }) }, o.id),
|
|
2095
2094
|
/* @__PURE__ */ a("option", { disabled: !0, children: "---" })
|
|
2096
2095
|
] }),
|
|
2097
2096
|
v.map((b) => /* @__PURE__ */ a("option", { value: b.id, children: /* @__PURE__ */ a(
|
|
2098
|
-
|
|
2097
|
+
St,
|
|
2099
2098
|
{
|
|
2100
2099
|
address: b,
|
|
2101
2100
|
isDefault: c
|
|
@@ -2106,13 +2105,13 @@ function St(t) {
|
|
|
2106
2105
|
]
|
|
2107
2106
|
}
|
|
2108
2107
|
),
|
|
2109
|
-
o && /* @__PURE__ */ a(
|
|
2108
|
+
o && /* @__PURE__ */ a(jn, { address: o }),
|
|
2110
2109
|
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." })
|
|
2111
2110
|
]
|
|
2112
2111
|
}
|
|
2113
2112
|
);
|
|
2114
2113
|
}
|
|
2115
|
-
function
|
|
2114
|
+
function St(t) {
|
|
2116
2115
|
const { address: e, isDefault: r } = t;
|
|
2117
2116
|
return /* @__PURE__ */ h(Ce, { children: [
|
|
2118
2117
|
r?.(e) ? "[DEFAULT] " : "",
|
|
@@ -2131,18 +2130,18 @@ function Et(t) {
|
|
|
2131
2130
|
e.postalCode
|
|
2132
2131
|
] });
|
|
2133
2132
|
}
|
|
2134
|
-
function
|
|
2133
|
+
function qn(t) {
|
|
2135
2134
|
const e = [t.address1];
|
|
2136
2135
|
t.address2 && e.push(t.address2), t.city && e.push(t.city), t.stateOrProvince && e.push(t.stateOrProvince);
|
|
2137
2136
|
const r = e.pop();
|
|
2138
2137
|
return t.postalCode ? e.push(`${r} ${t.postalCode}`) : r && e.push(r), e.join(", ");
|
|
2139
2138
|
}
|
|
2140
|
-
function
|
|
2139
|
+
function jn({ address: t }) {
|
|
2141
2140
|
const [e, r] = R(!1), n = D(void 0);
|
|
2142
2141
|
F(() => () => {
|
|
2143
2142
|
n.current && clearTimeout(n.current);
|
|
2144
2143
|
}, []);
|
|
2145
|
-
const i =
|
|
2144
|
+
const i = qn(t), s = M(async () => {
|
|
2146
2145
|
try {
|
|
2147
2146
|
await navigator.clipboard.writeText(i), r(!0), n.current && clearTimeout(n.current), n.current = setTimeout(() => r(!1), 1500);
|
|
2148
2147
|
} catch {
|
|
@@ -2161,7 +2160,7 @@ function Wn({ address: t }) {
|
|
|
2161
2160
|
" ",
|
|
2162
2161
|
i
|
|
2163
2162
|
] }),
|
|
2164
|
-
/* @__PURE__ */ a("span", { className: "shrink-0 mt-0.5", children: e ? /* @__PURE__ */ a(Ue, { size: 12, title: "Copied" }) : /* @__PURE__ */ a(
|
|
2163
|
+
/* @__PURE__ */ a("span", { className: "shrink-0 mt-0.5", children: e ? /* @__PURE__ */ a(Ue, { size: 12, title: "Copied" }) : /* @__PURE__ */ a(ar, { size: 12 }) })
|
|
2165
2164
|
]
|
|
2166
2165
|
}
|
|
2167
2166
|
);
|
|
@@ -2170,16 +2169,16 @@ const Ae = (t, e = "USD") => new Intl.NumberFormat("en-US", {
|
|
|
2170
2169
|
style: "currency",
|
|
2171
2170
|
currency: e
|
|
2172
2171
|
}).format(t);
|
|
2173
|
-
function
|
|
2172
|
+
function Xe({ label: t, value: e }) {
|
|
2174
2173
|
return /* @__PURE__ */ h("div", { className: "flex justify-between py-0.5", children: [
|
|
2175
2174
|
/* @__PURE__ */ a("span", { className: "text-sm text-text-tertiary", children: t }),
|
|
2176
2175
|
/* @__PURE__ */ a("span", { className: "text-sm text-text", children: e })
|
|
2177
2176
|
] });
|
|
2178
2177
|
}
|
|
2179
|
-
function
|
|
2178
|
+
function et(t, e) {
|
|
2180
2179
|
return t != null ? Ae(t, e) : "...";
|
|
2181
2180
|
}
|
|
2182
|
-
function
|
|
2181
|
+
function Wn({
|
|
2183
2182
|
subtotal: t,
|
|
2184
2183
|
tax: e,
|
|
2185
2184
|
shipping: r,
|
|
@@ -2193,23 +2192,23 @@ function Vn({
|
|
|
2193
2192
|
}) {
|
|
2194
2193
|
return /* @__PURE__ */ h("div", { className: "px-4 py-2.5 shrink-0 bg-surface-secondary", children: [
|
|
2195
2194
|
/* @__PURE__ */ a(
|
|
2196
|
-
|
|
2195
|
+
Xe,
|
|
2197
2196
|
{
|
|
2198
2197
|
label: "Subtotal",
|
|
2199
2198
|
value: Ae(t, i)
|
|
2200
2199
|
}
|
|
2201
2200
|
),
|
|
2202
|
-
/* @__PURE__ */ a(
|
|
2201
|
+
/* @__PURE__ */ a(Xe, { label: "Tax", value: et(e, i) }),
|
|
2203
2202
|
/* @__PURE__ */ a(
|
|
2204
|
-
|
|
2203
|
+
Xe,
|
|
2205
2204
|
{
|
|
2206
2205
|
label: "Shipping",
|
|
2207
|
-
value:
|
|
2206
|
+
value: et(r, i)
|
|
2208
2207
|
}
|
|
2209
2208
|
),
|
|
2210
2209
|
/* @__PURE__ */ h("div", { className: "flex justify-between mt-1 pt-1.5 border-t border-border", children: [
|
|
2211
2210
|
/* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children: "Total" }),
|
|
2212
|
-
/* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children:
|
|
2211
|
+
/* @__PURE__ */ a("span", { className: "text-sm font-semibold text-text", children: et(n, i) })
|
|
2213
2212
|
] }),
|
|
2214
2213
|
/* @__PURE__ */ a(
|
|
2215
2214
|
"button",
|
|
@@ -2245,7 +2244,7 @@ function Vn({
|
|
|
2245
2244
|
)
|
|
2246
2245
|
] });
|
|
2247
2246
|
}
|
|
2248
|
-
const
|
|
2247
|
+
const lt = () => /* @__PURE__ */ h(
|
|
2249
2248
|
"svg",
|
|
2250
2249
|
{
|
|
2251
2250
|
width: "14",
|
|
@@ -2260,8 +2259,8 @@ const dt = () => /* @__PURE__ */ h(
|
|
|
2260
2259
|
/* @__PURE__ */ a("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
2261
2260
|
]
|
|
2262
2261
|
}
|
|
2263
|
-
),
|
|
2264
|
-
function
|
|
2262
|
+
), Et = "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";
|
|
2263
|
+
function Nt({
|
|
2265
2264
|
children: t,
|
|
2266
2265
|
className: e,
|
|
2267
2266
|
...r
|
|
@@ -2270,13 +2269,13 @@ function kt({
|
|
|
2270
2269
|
"button",
|
|
2271
2270
|
{
|
|
2272
2271
|
type: "button",
|
|
2273
|
-
className: e ? ke(
|
|
2272
|
+
className: e ? ke(Et, e) : Et,
|
|
2274
2273
|
...r,
|
|
2275
2274
|
children: t
|
|
2276
2275
|
}
|
|
2277
2276
|
);
|
|
2278
2277
|
}
|
|
2279
|
-
function
|
|
2278
|
+
function cr({
|
|
2280
2279
|
value: t,
|
|
2281
2280
|
onChange: e,
|
|
2282
2281
|
min: r = 1,
|
|
@@ -2351,7 +2350,7 @@ function lr({
|
|
|
2351
2350
|
}, I = t <= r, w = n !== void 0 && t >= n, k = d === "saving";
|
|
2352
2351
|
return /* @__PURE__ */ h("span", { className: `inline-flex items-center gap-0.5 ${i}`, children: [
|
|
2353
2352
|
/* @__PURE__ */ a(
|
|
2354
|
-
|
|
2353
|
+
Nt,
|
|
2355
2354
|
{
|
|
2356
2355
|
onClick: () => x(-1),
|
|
2357
2356
|
disabled: I || k,
|
|
@@ -2387,7 +2386,7 @@ function lr({
|
|
|
2387
2386
|
}
|
|
2388
2387
|
),
|
|
2389
2388
|
/* @__PURE__ */ a(
|
|
2390
|
-
|
|
2389
|
+
Nt,
|
|
2391
2390
|
{
|
|
2392
2391
|
onClick: () => x(1),
|
|
2393
2392
|
disabled: w || k,
|
|
@@ -2415,7 +2414,7 @@ function lr({
|
|
|
2415
2414
|
d === "error" && /* @__PURE__ */ a("span", { className: "text-error text-xs ml-0.5", children: "Failed" })
|
|
2416
2415
|
] });
|
|
2417
2416
|
}
|
|
2418
|
-
function
|
|
2417
|
+
function Vn(t) {
|
|
2419
2418
|
const {
|
|
2420
2419
|
item: e,
|
|
2421
2420
|
onUpdateQuantity: r,
|
|
@@ -2452,7 +2451,7 @@ function zn(t) {
|
|
|
2452
2451
|
] }),
|
|
2453
2452
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
2454
2453
|
/* @__PURE__ */ a(
|
|
2455
|
-
|
|
2454
|
+
cr,
|
|
2456
2455
|
{
|
|
2457
2456
|
value: e.quantity,
|
|
2458
2457
|
onChange: (p) => r(e.id, p),
|
|
@@ -2467,7 +2466,7 @@ function zn(t) {
|
|
|
2467
2466
|
onClick: () => n(e.id),
|
|
2468
2467
|
className: "p-2 text-text-quaternary hover:text-text-secondary shrink-0",
|
|
2469
2468
|
"aria-label": "Remove item",
|
|
2470
|
-
children: /* @__PURE__ */ a(
|
|
2469
|
+
children: /* @__PURE__ */ a(lt, {})
|
|
2471
2470
|
}
|
|
2472
2471
|
)
|
|
2473
2472
|
] })
|
|
@@ -2491,7 +2490,7 @@ function zn(t) {
|
|
|
2491
2490
|
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" }),
|
|
2492
2491
|
/* @__PURE__ */ h("div", { className: "flex items-center justify-between mt-2", children: [
|
|
2493
2492
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children: /* @__PURE__ */ a(
|
|
2494
|
-
|
|
2493
|
+
zn,
|
|
2495
2494
|
{
|
|
2496
2495
|
onClick: () => i(e.name, e.sku)
|
|
2497
2496
|
}
|
|
@@ -2504,7 +2503,7 @@ function zn(t) {
|
|
|
2504
2503
|
] })
|
|
2505
2504
|
] });
|
|
2506
2505
|
}
|
|
2507
|
-
function
|
|
2506
|
+
function zn(t) {
|
|
2508
2507
|
return /* @__PURE__ */ a(
|
|
2509
2508
|
"button",
|
|
2510
2509
|
{
|
|
@@ -2515,7 +2514,7 @@ function Hn(t) {
|
|
|
2515
2514
|
}
|
|
2516
2515
|
);
|
|
2517
2516
|
}
|
|
2518
|
-
const
|
|
2517
|
+
const kt = "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";
|
|
2519
2518
|
function _e({
|
|
2520
2519
|
children: t,
|
|
2521
2520
|
className: e,
|
|
@@ -2525,13 +2524,13 @@ function _e({
|
|
|
2525
2524
|
"button",
|
|
2526
2525
|
{
|
|
2527
2526
|
type: "button",
|
|
2528
|
-
className: e ? ke(
|
|
2527
|
+
className: e ? ke(kt, e) : kt,
|
|
2529
2528
|
...r,
|
|
2530
2529
|
children: t
|
|
2531
2530
|
}
|
|
2532
2531
|
);
|
|
2533
2532
|
}
|
|
2534
|
-
function
|
|
2533
|
+
function lr({ onNewOrder: t }) {
|
|
2535
2534
|
const [e, r] = R(!1), [n, i] = R(!1), s = D(!0), o = D(
|
|
2536
2535
|
void 0
|
|
2537
2536
|
), c = () => {
|
|
@@ -2601,7 +2600,7 @@ function dr({ onNewOrder: t }) {
|
|
|
2601
2600
|
"New Order"
|
|
2602
2601
|
] });
|
|
2603
2602
|
}
|
|
2604
|
-
const
|
|
2603
|
+
const Hn = () => /* @__PURE__ */ h(
|
|
2605
2604
|
"svg",
|
|
2606
2605
|
{
|
|
2607
2606
|
width: "48",
|
|
@@ -2621,7 +2620,7 @@ const Qn = () => /* @__PURE__ */ h(
|
|
|
2621
2620
|
]
|
|
2622
2621
|
}
|
|
2623
2622
|
);
|
|
2624
|
-
function
|
|
2623
|
+
function Qn({
|
|
2625
2624
|
className: t = "",
|
|
2626
2625
|
isDragging: e = !1,
|
|
2627
2626
|
onNewOrder: r,
|
|
@@ -2639,18 +2638,18 @@ function Gn({
|
|
|
2639
2638
|
),
|
|
2640
2639
|
children: [
|
|
2641
2640
|
s && /* @__PURE__ */ h("div", { className: "absolute top-0 right-0 px-4 py-3 z-10 flex items-center gap-2", children: [
|
|
2642
|
-
r && /* @__PURE__ */ a(
|
|
2641
|
+
r && /* @__PURE__ */ a(lr, { onNewOrder: r }),
|
|
2643
2642
|
n && /* @__PURE__ */ h(_e, { onClick: n, "aria-label": "Expand", children: [
|
|
2644
|
-
/* @__PURE__ */ a(
|
|
2643
|
+
/* @__PURE__ */ a(ir, { size: 14 }),
|
|
2645
2644
|
"Expand"
|
|
2646
2645
|
] }),
|
|
2647
2646
|
i && /* @__PURE__ */ h(_e, { onClick: i, "aria-label": "Minimize", children: [
|
|
2648
|
-
/* @__PURE__ */ a(
|
|
2647
|
+
/* @__PURE__ */ a(or, { size: 14 }),
|
|
2649
2648
|
"Minimize"
|
|
2650
2649
|
] })
|
|
2651
2650
|
] }),
|
|
2652
2651
|
/* @__PURE__ */ h("div", { className: "flex flex-col flex-1 items-center justify-center gap-4 py-3 px-8", children: [
|
|
2653
|
-
/* @__PURE__ */ a("div", { className: "flex items-center justify-center w-16 h-16 rounded-2xl p-1 text-text", children: /* @__PURE__ */ a(
|
|
2652
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-center w-16 h-16 rounded-2xl p-1 text-text", children: /* @__PURE__ */ a(Hn, {}) }),
|
|
2654
2653
|
/* @__PURE__ */ a("h3", { className: "m-0 text-base font-semibold text-text", children: "Your cart will appear here" }),
|
|
2655
2654
|
/* @__PURE__ */ a("div", { className: "h-[50px]", "aria-hidden": "true" })
|
|
2656
2655
|
] }),
|
|
@@ -2659,11 +2658,11 @@ function Gn({
|
|
|
2659
2658
|
}
|
|
2660
2659
|
);
|
|
2661
2660
|
}
|
|
2662
|
-
const
|
|
2661
|
+
const dr = {
|
|
2663
2662
|
pendingMessage: null,
|
|
2664
2663
|
shouldScroll: !0
|
|
2665
|
-
},
|
|
2666
|
-
ai: { ...
|
|
2664
|
+
}, Gn = (t) => ({
|
|
2665
|
+
ai: { ...dr },
|
|
2667
2666
|
sendMessage: (e, r) => t(
|
|
2668
2667
|
(n) => ({
|
|
2669
2668
|
ai: {
|
|
@@ -2690,7 +2689,7 @@ const ur = {
|
|
|
2690
2689
|
toolCalls: [],
|
|
2691
2690
|
revealedCount: 0,
|
|
2692
2691
|
threadIds: []
|
|
2693
|
-
},
|
|
2692
|
+
}, Kn = (t) => ({
|
|
2694
2693
|
batchProcessing: { ...Ge },
|
|
2695
2694
|
setBatchProcessingStatus: (e) => t(
|
|
2696
2695
|
(r) => ({ batchProcessing: { ...r.batchProcessing, status: e } }),
|
|
@@ -2748,14 +2747,14 @@ const ur = {
|
|
|
2748
2747
|
!1,
|
|
2749
2748
|
"batchProcessing/reset"
|
|
2750
2749
|
)
|
|
2751
|
-
}),
|
|
2750
|
+
}), Pt = {
|
|
2752
2751
|
bcCart: null,
|
|
2753
2752
|
checkout: null,
|
|
2754
2753
|
isLoading: !1,
|
|
2755
2754
|
productCache: {},
|
|
2756
2755
|
variantCache: {}
|
|
2757
|
-
},
|
|
2758
|
-
bcSession: { ...
|
|
2756
|
+
}, Jn = (t, e) => ({
|
|
2757
|
+
bcSession: { ...Pt },
|
|
2759
2758
|
setBcCart: (r) => t(
|
|
2760
2759
|
(n) => ({ bcSession: { ...n.bcSession, bcCart: r } }),
|
|
2761
2760
|
!1,
|
|
@@ -2809,15 +2808,15 @@ const ur = {
|
|
|
2809
2808
|
"bcSession/cacheVariant"
|
|
2810
2809
|
),
|
|
2811
2810
|
clearBcSession: () => t(
|
|
2812
|
-
() => ({ bcSession: { ...
|
|
2811
|
+
() => ({ bcSession: { ...Pt } }),
|
|
2813
2812
|
!1,
|
|
2814
2813
|
"bcSession/clearBcSession"
|
|
2815
2814
|
)
|
|
2816
2815
|
});
|
|
2817
|
-
function
|
|
2816
|
+
function Tt(t, e) {
|
|
2818
2817
|
return `${t}-${e}`;
|
|
2819
2818
|
}
|
|
2820
|
-
const
|
|
2819
|
+
const ur = {
|
|
2821
2820
|
cartEntityId: null,
|
|
2822
2821
|
poItemPrices: {},
|
|
2823
2822
|
orderId: null,
|
|
@@ -2826,8 +2825,8 @@ const pr = {
|
|
|
2826
2825
|
billingAddress: null,
|
|
2827
2826
|
poMetadataSet: !1,
|
|
2828
2827
|
itemWarnings: []
|
|
2829
|
-
},
|
|
2830
|
-
cartifact: { ...
|
|
2828
|
+
}, Yn = (t) => ({
|
|
2829
|
+
cartifact: { ...ur },
|
|
2831
2830
|
setCartEntityId: (e) => t(
|
|
2832
2831
|
(r) => ({ cartifact: { ...r.cartifact, cartEntityId: e } }),
|
|
2833
2832
|
!1,
|
|
@@ -2839,7 +2838,7 @@ const pr = {
|
|
|
2839
2838
|
...s.cartifact,
|
|
2840
2839
|
poItemPrices: {
|
|
2841
2840
|
...s.cartifact.poItemPrices,
|
|
2842
|
-
[
|
|
2841
|
+
[Tt(e, r)]: {
|
|
2843
2842
|
productEntityId: e,
|
|
2844
2843
|
variantEntityId: r,
|
|
2845
2844
|
poPrice: n,
|
|
@@ -2854,7 +2853,7 @@ const pr = {
|
|
|
2854
2853
|
removePoItemPrice: (e, r) => t(
|
|
2855
2854
|
(n) => {
|
|
2856
2855
|
const i = { ...n.cartifact.poItemPrices };
|
|
2857
|
-
return delete i[
|
|
2856
|
+
return delete i[Tt(e, r)], { cartifact: { ...n.cartifact, poItemPrices: i } };
|
|
2858
2857
|
},
|
|
2859
2858
|
!1,
|
|
2860
2859
|
"cartifact/removePoItemPrice"
|
|
@@ -2957,13 +2956,13 @@ const pr = {
|
|
|
2957
2956
|
!1,
|
|
2958
2957
|
"cartifact/applyPoMetadata"
|
|
2959
2958
|
)
|
|
2960
|
-
}),
|
|
2959
|
+
}), Zn = {
|
|
2961
2960
|
messages: [],
|
|
2962
2961
|
input: "",
|
|
2963
2962
|
threadId: null,
|
|
2964
2963
|
toolCallErrors: {}
|
|
2965
|
-
},
|
|
2966
|
-
chat: { ...
|
|
2964
|
+
}, Xn = (t) => ({
|
|
2965
|
+
chat: { ...Zn },
|
|
2967
2966
|
setMessages: (e) => t(
|
|
2968
2967
|
(r) => ({ chat: { ...r.chat, messages: e } }),
|
|
2969
2968
|
!1,
|
|
@@ -3012,11 +3011,11 @@ const pr = {
|
|
|
3012
3011
|
!1,
|
|
3013
3012
|
"chat/clearChat"
|
|
3014
3013
|
)
|
|
3015
|
-
}),
|
|
3014
|
+
}), es = {
|
|
3016
3015
|
customerInfo: null,
|
|
3017
3016
|
customerAddresses: []
|
|
3018
|
-
},
|
|
3019
|
-
customer: { ...
|
|
3017
|
+
}, ts = (t) => ({
|
|
3018
|
+
customer: { ...es },
|
|
3020
3019
|
setCustomerInfo: (e) => {
|
|
3021
3020
|
t(
|
|
3022
3021
|
(r) => ({
|
|
@@ -3034,13 +3033,13 @@ const pr = {
|
|
|
3034
3033
|
!1,
|
|
3035
3034
|
"customer/setCustomerAddresses"
|
|
3036
3035
|
)
|
|
3037
|
-
}),
|
|
3036
|
+
}), pr = {
|
|
3038
3037
|
uploadedFileName: null,
|
|
3039
3038
|
parsedContent: null,
|
|
3040
3039
|
hasProcessedDocument: !1,
|
|
3041
3040
|
threadId: null
|
|
3042
|
-
},
|
|
3043
|
-
parser: { ...
|
|
3041
|
+
}, rs = (t) => ({
|
|
3042
|
+
parser: { ...pr },
|
|
3044
3043
|
setUploadedFileName: (e) => t(
|
|
3045
3044
|
(r) => ({ parser: { ...r.parser, uploadedFileName: e } }),
|
|
3046
3045
|
!1,
|
|
@@ -3074,15 +3073,15 @@ const pr = {
|
|
|
3074
3073
|
!1,
|
|
3075
3074
|
"parser/clearParser"
|
|
3076
3075
|
)
|
|
3077
|
-
}),
|
|
3076
|
+
}), ns = {
|
|
3078
3077
|
projectId: "",
|
|
3079
3078
|
apiKey: "",
|
|
3080
3079
|
origin: "",
|
|
3081
3080
|
sseOrigin: ""
|
|
3082
|
-
},
|
|
3083
|
-
takeshapeConfig: { ...
|
|
3081
|
+
}, ss = (t) => ({
|
|
3082
|
+
takeshapeConfig: { ...ns },
|
|
3084
3083
|
setTakeShapeConfig: (e) => t({ takeshapeConfig: e }, !1, "setTakeShapeConfig")
|
|
3085
|
-
}),
|
|
3084
|
+
}), as = {
|
|
3086
3085
|
initStatus: "pending",
|
|
3087
3086
|
initError: null,
|
|
3088
3087
|
existingCart: null,
|
|
@@ -3091,8 +3090,8 @@ const pr = {
|
|
|
3091
3090
|
addressUpdateStatus: "idle",
|
|
3092
3091
|
selectedBillingAddressId: null,
|
|
3093
3092
|
billingAddressUpdateStatus: "idle"
|
|
3094
|
-
},
|
|
3095
|
-
ui: { ...
|
|
3093
|
+
}, is = (t) => ({
|
|
3094
|
+
ui: { ...as },
|
|
3096
3095
|
toggleMessageExpanded: (e) => t(
|
|
3097
3096
|
(r) => {
|
|
3098
3097
|
const n = r.ui.expandedMessageIds, i = n.includes(e);
|
|
@@ -3140,12 +3139,12 @@ const pr = {
|
|
|
3140
3139
|
"ui/clearAddressSelections"
|
|
3141
3140
|
)
|
|
3142
3141
|
});
|
|
3143
|
-
function
|
|
3142
|
+
function os() {
|
|
3144
3143
|
return {
|
|
3145
3144
|
appState: "upload",
|
|
3146
3145
|
customerEntityId: null,
|
|
3147
3146
|
fatalError: null,
|
|
3148
|
-
ai: { ...
|
|
3147
|
+
ai: { ...dr },
|
|
3149
3148
|
chat: {
|
|
3150
3149
|
messages: [],
|
|
3151
3150
|
input: "",
|
|
@@ -3192,20 +3191,20 @@ function cs() {
|
|
|
3192
3191
|
batchProcessing: { ...Ge }
|
|
3193
3192
|
};
|
|
3194
3193
|
}
|
|
3195
|
-
const g =
|
|
3196
|
-
|
|
3197
|
-
|
|
3194
|
+
const g = at()(
|
|
3195
|
+
zr(
|
|
3196
|
+
zt(
|
|
3198
3197
|
(t, e) => ({
|
|
3199
3198
|
// Combine all slices
|
|
3200
|
-
...
|
|
3201
|
-
...
|
|
3202
|
-
...Zn(t),
|
|
3203
|
-
...rs(t),
|
|
3199
|
+
...Gn(t),
|
|
3200
|
+
...Xn(t),
|
|
3204
3201
|
...Yn(t),
|
|
3205
|
-
...
|
|
3206
|
-
...os(t),
|
|
3202
|
+
...ts(t),
|
|
3207
3203
|
...Jn(t),
|
|
3208
|
-
...
|
|
3204
|
+
...rs(t),
|
|
3205
|
+
...is(t),
|
|
3206
|
+
...Kn(t),
|
|
3207
|
+
...ss(t),
|
|
3209
3208
|
// Top-level state
|
|
3210
3209
|
appState: "upload",
|
|
3211
3210
|
customerEntityId: null,
|
|
@@ -3276,7 +3275,7 @@ const g = it()(
|
|
|
3276
3275
|
failValidation: (r) => {
|
|
3277
3276
|
t(
|
|
3278
3277
|
{
|
|
3279
|
-
...
|
|
3278
|
+
...os(),
|
|
3280
3279
|
appState: "upload",
|
|
3281
3280
|
ui: {
|
|
3282
3281
|
initStatus: "ready",
|
|
@@ -3328,11 +3327,11 @@ const g = it()(
|
|
|
3328
3327
|
toolCallErrors: r.chat?.toolCallErrors ?? {}
|
|
3329
3328
|
},
|
|
3330
3329
|
cartifact: {
|
|
3331
|
-
...
|
|
3330
|
+
...ur,
|
|
3332
3331
|
...r.cartifact
|
|
3333
3332
|
},
|
|
3334
3333
|
parser: {
|
|
3335
|
-
...
|
|
3334
|
+
...pr,
|
|
3336
3335
|
...r.parser ?? {}
|
|
3337
3336
|
},
|
|
3338
3337
|
batchProcessing: {
|
|
@@ -3346,8 +3345,8 @@ const g = it()(
|
|
|
3346
3345
|
}
|
|
3347
3346
|
}),
|
|
3348
3347
|
{
|
|
3349
|
-
name:
|
|
3350
|
-
version:
|
|
3348
|
+
name: ot,
|
|
3349
|
+
version: Qt,
|
|
3351
3350
|
partialize: (t) => ({
|
|
3352
3351
|
// Persist customer ID for validation
|
|
3353
3352
|
customerEntityId: t.customerEntityId,
|
|
@@ -3385,10 +3384,10 @@ const g = it()(
|
|
|
3385
3384
|
}
|
|
3386
3385
|
)
|
|
3387
3386
|
);
|
|
3388
|
-
function
|
|
3387
|
+
function tt({ productName: t, productSku: e }) {
|
|
3389
3388
|
return t && e ? `${t} (${e})` : t || e || "Unknown Product";
|
|
3390
3389
|
}
|
|
3391
|
-
function
|
|
3390
|
+
function cs({
|
|
3392
3391
|
item: t,
|
|
3393
3392
|
onSuggestAlternatives: e
|
|
3394
3393
|
}) {
|
|
@@ -3400,7 +3399,7 @@ function ls({
|
|
|
3400
3399
|
/* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
|
|
3401
3400
|
/* @__PURE__ */ h("div", { className: "flex items-start justify-between gap-2", children: [
|
|
3402
3401
|
/* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
|
|
3403
|
-
(t.productName || t.productSku) && /* @__PURE__ */ a("p", { className: "text-sm font-medium text-text-secondary m-0 truncate", children:
|
|
3402
|
+
(t.productName || t.productSku) && /* @__PURE__ */ a("p", { className: "text-sm font-medium text-text-secondary m-0 truncate", children: tt(t) }),
|
|
3404
3403
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5 mt-1", children: /* @__PURE__ */ h("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: [
|
|
3405
3404
|
/* @__PURE__ */ a("span", { className: "w-1.5 h-1.5 bg-text-secondary rounded-full animate-pulse" }),
|
|
3406
3405
|
t.status
|
|
@@ -3413,7 +3412,7 @@ function ls({
|
|
|
3413
3412
|
onClick: () => r(t),
|
|
3414
3413
|
className: "p-1 text-text-quaternary hover:text-text-secondary shrink-0",
|
|
3415
3414
|
"aria-label": "Dismiss warning",
|
|
3416
|
-
children: /* @__PURE__ */ a(
|
|
3415
|
+
children: /* @__PURE__ */ a(lt, {})
|
|
3417
3416
|
}
|
|
3418
3417
|
)
|
|
3419
3418
|
] }),
|
|
@@ -3421,7 +3420,7 @@ function ls({
|
|
|
3421
3420
|
"button",
|
|
3422
3421
|
{
|
|
3423
3422
|
type: "button",
|
|
3424
|
-
onClick: () => e(
|
|
3423
|
+
onClick: () => e(tt(t)),
|
|
3425
3424
|
className: "text-xs px-1.5 py-1 rounded text-warning-text bg-warning/20 hover:bg-warning/30",
|
|
3426
3425
|
children: "Suggest alternatives"
|
|
3427
3426
|
}
|
|
@@ -3429,7 +3428,7 @@ function ls({
|
|
|
3429
3428
|
] })
|
|
3430
3429
|
] });
|
|
3431
3430
|
}
|
|
3432
|
-
function
|
|
3431
|
+
function ls({
|
|
3433
3432
|
items: t,
|
|
3434
3433
|
itemWarnings: e = [],
|
|
3435
3434
|
onUpdateQuantity: r,
|
|
@@ -3468,7 +3467,7 @@ function ds({
|
|
|
3468
3467
|
(L) => L.catalogPriceCurrencyCode
|
|
3469
3468
|
)?.catalogPriceCurrencyCode, q = N?.tax, oe = N?.shipping, Ie = N?.grandTotal ?? (q !== null ? ie + (q ?? 0) + (oe ?? 0) : null);
|
|
3470
3469
|
return t.length === 0 && e.length === 0 && !y ? /* @__PURE__ */ a(
|
|
3471
|
-
|
|
3470
|
+
Qn,
|
|
3472
3471
|
{
|
|
3473
3472
|
className: l,
|
|
3474
3473
|
isDragging: A,
|
|
@@ -3488,13 +3487,13 @@ function ds({
|
|
|
3488
3487
|
/* @__PURE__ */ h("div", { className: "flex items-center justify-between mb-2", children: [
|
|
3489
3488
|
/* @__PURE__ */ a("h2", { className: "text-lg font-normal text-text m-0", children: "Cart" }),
|
|
3490
3489
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
|
|
3491
|
-
$ && /* @__PURE__ */ a(
|
|
3490
|
+
$ && /* @__PURE__ */ a(lr, { onNewOrder: $ }),
|
|
3492
3491
|
B && /* @__PURE__ */ h(_e, { onClick: B, "aria-label": "Expand", children: [
|
|
3493
|
-
/* @__PURE__ */ a(
|
|
3492
|
+
/* @__PURE__ */ a(ir, { size: 14 }),
|
|
3494
3493
|
"Expand"
|
|
3495
3494
|
] }),
|
|
3496
3495
|
Q && /* @__PURE__ */ h(_e, { onClick: Q, "aria-label": "Minimize", children: [
|
|
3497
|
-
/* @__PURE__ */ a(
|
|
3496
|
+
/* @__PURE__ */ a(or, { size: 14 }),
|
|
3498
3497
|
"Minimize"
|
|
3499
3498
|
] })
|
|
3500
3499
|
] })
|
|
@@ -3511,7 +3510,7 @@ function ds({
|
|
|
3511
3510
|
title: te ? "Copied!" : "Copy PO Number",
|
|
3512
3511
|
children: [
|
|
3513
3512
|
d,
|
|
3514
|
-
/* @__PURE__ */ a("span", { className: "text-text-tertiary", children: te ? /* @__PURE__ */ a(Ue, { size: 12, title: "Copied" }) : /* @__PURE__ */ a(
|
|
3513
|
+
/* @__PURE__ */ a("span", { className: "text-text-tertiary", children: te ? /* @__PURE__ */ a(Ue, { size: 12, title: "Copied" }) : /* @__PURE__ */ a(ar, { size: 12 }) })
|
|
3515
3514
|
]
|
|
3516
3515
|
}
|
|
3517
3516
|
)
|
|
@@ -3522,7 +3521,7 @@ function ds({
|
|
|
3522
3521
|
] })
|
|
3523
3522
|
] }),
|
|
3524
3523
|
/* @__PURE__ */ a(
|
|
3525
|
-
|
|
3524
|
+
Un,
|
|
3526
3525
|
{
|
|
3527
3526
|
addresses: p,
|
|
3528
3527
|
selectedAddressId: u,
|
|
@@ -3539,22 +3538,22 @@ function ds({
|
|
|
3539
3538
|
/* @__PURE__ */ a("div", { className: "h-px shrink-0 bg-border" }),
|
|
3540
3539
|
/* @__PURE__ */ a("div", { className: "flex-1 min-h-0 overflow-y-auto flex flex-col", children: /* @__PURE__ */ h("div", { className: "flex-1 min-h-0 overflow-y-auto p-2 bg-surface", children: [
|
|
3541
3540
|
t.length === 0 && e.length === 0 && /* @__PURE__ */ h("div", { className: "flex flex-col items-center justify-center h-full text-center", children: [
|
|
3542
|
-
/* @__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(
|
|
3541
|
+
/* @__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(_n, {}) }),
|
|
3543
3542
|
/* @__PURE__ */ a("p", { className: "text-sm text-text-quaternary m-0", children: "No items in cart yet" })
|
|
3544
3543
|
] }),
|
|
3545
3544
|
e.length > 0 && /* @__PURE__ */ h(Ce, { children: [
|
|
3546
3545
|
e.map((L) => /* @__PURE__ */ a(
|
|
3547
|
-
|
|
3546
|
+
cs,
|
|
3548
3547
|
{
|
|
3549
3548
|
item: L,
|
|
3550
3549
|
onSuggestAlternatives: (W) => s(W)
|
|
3551
3550
|
},
|
|
3552
|
-
`${
|
|
3551
|
+
`${tt(L)}-${L.status}`
|
|
3553
3552
|
)),
|
|
3554
3553
|
t.length > 0 && /* @__PURE__ */ a("div", { className: "border-b border-border mb-2" })
|
|
3555
3554
|
] }),
|
|
3556
3555
|
t.map((L) => /* @__PURE__ */ a(
|
|
3557
|
-
|
|
3556
|
+
Vn,
|
|
3558
3557
|
{
|
|
3559
3558
|
item: L,
|
|
3560
3559
|
onUpdateQuantity: r,
|
|
@@ -3567,7 +3566,7 @@ function ds({
|
|
|
3567
3566
|
] }) }),
|
|
3568
3567
|
/* @__PURE__ */ a("div", { className: "h-px shrink-0 bg-border" }),
|
|
3569
3568
|
/* @__PURE__ */ a(
|
|
3570
|
-
|
|
3569
|
+
Wn,
|
|
3571
3570
|
{
|
|
3572
3571
|
subtotal: ie,
|
|
3573
3572
|
tax: q,
|
|
@@ -3585,7 +3584,7 @@ function ds({
|
|
|
3585
3584
|
}
|
|
3586
3585
|
);
|
|
3587
3586
|
}
|
|
3588
|
-
const
|
|
3587
|
+
const ds = [
|
|
3589
3588
|
"failed to fetch",
|
|
3590
3589
|
"networkerror",
|
|
3591
3590
|
"network request failed",
|
|
@@ -3594,16 +3593,16 @@ const us = [
|
|
|
3594
3593
|
"net::err_internet_disconnected",
|
|
3595
3594
|
"net::err_network_changed"
|
|
3596
3595
|
];
|
|
3597
|
-
function
|
|
3596
|
+
function us(t) {
|
|
3598
3597
|
if (typeof navigator < "u" && !navigator.onLine)
|
|
3599
3598
|
return !0;
|
|
3600
3599
|
const e = t.message.toLowerCase();
|
|
3601
|
-
return
|
|
3600
|
+
return ds.some((r) => e.includes(r));
|
|
3602
3601
|
}
|
|
3603
|
-
function
|
|
3602
|
+
function ps({ error: t, onRetry: e }) {
|
|
3604
3603
|
if (!t)
|
|
3605
3604
|
return null;
|
|
3606
|
-
const r =
|
|
3605
|
+
const r = us(t);
|
|
3607
3606
|
return /* @__PURE__ */ h("div", { className: "mx-4 my-3 px-4 py-3 bg-error-bg border border-error/30 rounded-lg", children: [
|
|
3608
3607
|
/* @__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." }),
|
|
3609
3608
|
e && /* @__PURE__ */ a(
|
|
@@ -3617,7 +3616,7 @@ function hs({ error: t, onRetry: e }) {
|
|
|
3617
3616
|
)
|
|
3618
3617
|
] });
|
|
3619
3618
|
}
|
|
3620
|
-
const
|
|
3619
|
+
const hs = () => /* @__PURE__ */ h(
|
|
3621
3620
|
"svg",
|
|
3622
3621
|
{
|
|
3623
3622
|
width: "18",
|
|
@@ -3633,7 +3632,7 @@ const fs = () => /* @__PURE__ */ h(
|
|
|
3633
3632
|
]
|
|
3634
3633
|
}
|
|
3635
3634
|
);
|
|
3636
|
-
function
|
|
3635
|
+
function fs({
|
|
3637
3636
|
input: t,
|
|
3638
3637
|
onInputChange: e,
|
|
3639
3638
|
onSubmit: r,
|
|
@@ -3670,28 +3669,28 @@ function ms({
|
|
|
3670
3669
|
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",
|
|
3671
3670
|
disabled: !t.trim() || n,
|
|
3672
3671
|
"aria-label": "Send message",
|
|
3673
|
-
children: /* @__PURE__ */ a(
|
|
3672
|
+
children: /* @__PURE__ */ a(hs, {})
|
|
3674
3673
|
}
|
|
3675
3674
|
)
|
|
3676
3675
|
]
|
|
3677
3676
|
}
|
|
3678
3677
|
) });
|
|
3679
3678
|
}
|
|
3680
|
-
const
|
|
3681
|
-
function
|
|
3682
|
-
return t.type === "tool" && !
|
|
3679
|
+
const hr = "showProducts", ms = "searchProducts", gs = "searchProductsFromChat", ys = "searchProductsBySku", Oe = "addToCart", fr = "updateCart", mr = "removeFromCart", gr = "clearCart", yr = "getCart", dt = "getPurchaseOrderData", Ye = "setPoMetadata", xr = "setItemWarnings", br = "removeItemWarnings", ut = "addProcessingFailures", xs = /* @__PURE__ */ new Set([hr]);
|
|
3680
|
+
function bs(t) {
|
|
3681
|
+
return t.type === "tool" && !xs.has(t.toolName);
|
|
3683
3682
|
}
|
|
3684
|
-
function
|
|
3683
|
+
function Cs(t) {
|
|
3685
3684
|
const e = [];
|
|
3686
3685
|
let r = [];
|
|
3687
3686
|
function n() {
|
|
3688
3687
|
r.length >= 2 ? e.push({ type: "tool-group", tools: r }) : r.length === 1 && e.push(r[0]), r = [];
|
|
3689
3688
|
}
|
|
3690
3689
|
for (const i of t)
|
|
3691
|
-
|
|
3690
|
+
bs(i) ? r.push(i) : (n(), e.push(i));
|
|
3692
3691
|
return n(), e;
|
|
3693
3692
|
}
|
|
3694
|
-
const
|
|
3693
|
+
const At = () => /* @__PURE__ */ h(
|
|
3695
3694
|
"svg",
|
|
3696
3695
|
{
|
|
3697
3696
|
width: "14",
|
|
@@ -3706,7 +3705,7 @@ const Bt = () => /* @__PURE__ */ h(
|
|
|
3706
3705
|
/* @__PURE__ */ a("polyline", { points: "14 2 14 8 20 8" })
|
|
3707
3706
|
]
|
|
3708
3707
|
}
|
|
3709
|
-
),
|
|
3708
|
+
), Cr = () => /* @__PURE__ */ h(
|
|
3710
3709
|
"svg",
|
|
3711
3710
|
{
|
|
3712
3711
|
width: "12",
|
|
@@ -3740,7 +3739,7 @@ function ae({
|
|
|
3740
3739
|
}
|
|
3741
3740
|
);
|
|
3742
3741
|
}
|
|
3743
|
-
function
|
|
3742
|
+
function vs(t) {
|
|
3744
3743
|
if (t)
|
|
3745
3744
|
try {
|
|
3746
3745
|
return typeof t == "string" ? JSON.parse(t) : t;
|
|
@@ -3748,6 +3747,20 @@ function ht(t) {
|
|
|
3748
3747
|
return;
|
|
3749
3748
|
}
|
|
3750
3749
|
}
|
|
3750
|
+
function pt(t, e) {
|
|
3751
|
+
const r = vs(t);
|
|
3752
|
+
if (!r || typeof r != "object") return;
|
|
3753
|
+
const n = r.data;
|
|
3754
|
+
if (!n || typeof n != "object") return;
|
|
3755
|
+
const i = n;
|
|
3756
|
+
if (e)
|
|
3757
|
+
for (const s of e) {
|
|
3758
|
+
const o = i[s];
|
|
3759
|
+
if (o && typeof o == "object")
|
|
3760
|
+
return o;
|
|
3761
|
+
}
|
|
3762
|
+
return i;
|
|
3763
|
+
}
|
|
3751
3764
|
function Is({
|
|
3752
3765
|
toolCallId: t,
|
|
3753
3766
|
toolInput: e,
|
|
@@ -3764,7 +3777,7 @@ function Is({
|
|
|
3764
3777
|
successMessage: ""
|
|
3765
3778
|
}
|
|
3766
3779
|
);
|
|
3767
|
-
const c =
|
|
3780
|
+
const c = pt(r, ["searchProductsBySku"])?.total ?? 0;
|
|
3768
3781
|
return /* @__PURE__ */ a(
|
|
3769
3782
|
ae,
|
|
3770
3783
|
{
|
|
@@ -3790,30 +3803,33 @@ function ws({
|
|
|
3790
3803
|
successMessage: ""
|
|
3791
3804
|
}
|
|
3792
3805
|
);
|
|
3793
|
-
const c =
|
|
3806
|
+
const c = pt(r, [
|
|
3807
|
+
"searchProducts",
|
|
3808
|
+
"searchProductsFromChat"
|
|
3809
|
+
])?.total ?? 0;
|
|
3794
3810
|
return /* @__PURE__ */ a(
|
|
3795
3811
|
ae,
|
|
3796
3812
|
{
|
|
3797
3813
|
toolCallId: t,
|
|
3798
|
-
successMessage: `Found ${
|
|
3814
|
+
successMessage: `Found ${c} product${c !== 1 ? "s" : ""} for '${i}'`,
|
|
3799
3815
|
toolOutput: r
|
|
3800
3816
|
}
|
|
3801
3817
|
);
|
|
3802
3818
|
}
|
|
3803
|
-
const
|
|
3819
|
+
const vr = Mr(
|
|
3804
3820
|
null
|
|
3805
3821
|
);
|
|
3806
3822
|
function Ss({
|
|
3807
3823
|
client: t,
|
|
3808
3824
|
children: e
|
|
3809
3825
|
}) {
|
|
3810
|
-
return /* @__PURE__ */ a(
|
|
3826
|
+
return /* @__PURE__ */ a(vr.Provider, { value: t, children: e });
|
|
3811
3827
|
}
|
|
3812
|
-
function
|
|
3813
|
-
return
|
|
3828
|
+
function ht() {
|
|
3829
|
+
return Or(vr);
|
|
3814
3830
|
}
|
|
3815
3831
|
function Es(t, e) {
|
|
3816
|
-
const r =
|
|
3832
|
+
const r = ht(), n = g(
|
|
3817
3833
|
(d) => d.bcSession.productCache
|
|
3818
3834
|
), i = g((d) => d.cacheProducts), s = D(/* @__PURE__ */ new Set()), o = ee(() => t.filter(
|
|
3819
3835
|
(d) => !n[d] && !s.current.has(d)
|
|
@@ -3927,7 +3943,7 @@ const As = 10;
|
|
|
3927
3943
|
function Bs(t, e, r) {
|
|
3928
3944
|
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";
|
|
3929
3945
|
}
|
|
3930
|
-
function
|
|
3946
|
+
function Bt({
|
|
3931
3947
|
product: t,
|
|
3932
3948
|
onAddToCart: e,
|
|
3933
3949
|
cart: r = [],
|
|
@@ -4063,7 +4079,7 @@ function $t({
|
|
|
4063
4079
|
className: x ? "flex items-center gap-2 flex-wrap" : "flex flex-col gap-2",
|
|
4064
4080
|
children: [
|
|
4065
4081
|
/* @__PURE__ */ a(
|
|
4066
|
-
|
|
4082
|
+
cr,
|
|
4067
4083
|
{
|
|
4068
4084
|
value: d,
|
|
4069
4085
|
onChange: p,
|
|
@@ -4105,7 +4121,7 @@ function $s({
|
|
|
4105
4121
|
loadingText: o = "Searching for products...",
|
|
4106
4122
|
className: c = ""
|
|
4107
4123
|
}) {
|
|
4108
|
-
const l =
|
|
4124
|
+
const l = ht(), d = ee(() => {
|
|
4109
4125
|
const I = /* @__PURE__ */ new Map();
|
|
4110
4126
|
if (i)
|
|
4111
4127
|
for (const w of i)
|
|
@@ -4161,7 +4177,7 @@ function $s({
|
|
|
4161
4177
|
if (b.length === 1 && x) {
|
|
4162
4178
|
const I = x.productEntityId !== void 0 ? d.get(x.productEntityId) : void 0, w = p.get(x.id);
|
|
4163
4179
|
return /* @__PURE__ */ a("div", { className: `py-2 ${c}`, children: /* @__PURE__ */ a(
|
|
4164
|
-
|
|
4180
|
+
Bt,
|
|
4165
4181
|
{
|
|
4166
4182
|
layout: "horizontal",
|
|
4167
4183
|
product: x,
|
|
@@ -4177,7 +4193,7 @@ function $s({
|
|
|
4177
4193
|
return /* @__PURE__ */ a("div", { className: `flex flex-wrap gap-3 py-2 ${c}`, children: b.map((I) => {
|
|
4178
4194
|
const w = I.productEntityId !== void 0 ? d.get(I.productEntityId) : void 0, k = p.get(I.id);
|
|
4179
4195
|
return /* @__PURE__ */ a(
|
|
4180
|
-
|
|
4196
|
+
Bt,
|
|
4181
4197
|
{
|
|
4182
4198
|
product: I,
|
|
4183
4199
|
onAddToCart: e,
|
|
@@ -4240,7 +4256,7 @@ function Ms({
|
|
|
4240
4256
|
}
|
|
4241
4257
|
);
|
|
4242
4258
|
}
|
|
4243
|
-
function
|
|
4259
|
+
function Ir({
|
|
4244
4260
|
toolCallId: t,
|
|
4245
4261
|
toolName: e,
|
|
4246
4262
|
toolInput: r,
|
|
@@ -4250,7 +4266,7 @@ function wr({
|
|
|
4250
4266
|
onAddToCart: o,
|
|
4251
4267
|
onViewProduct: c
|
|
4252
4268
|
}) {
|
|
4253
|
-
return e ===
|
|
4269
|
+
return e === hr ? /* @__PURE__ */ a("div", { className: "mt-3", children: /* @__PURE__ */ a(
|
|
4254
4270
|
Ms,
|
|
4255
4271
|
{
|
|
4256
4272
|
toolInput: r,
|
|
@@ -4260,7 +4276,7 @@ function wr({
|
|
|
4260
4276
|
onAddToCart: o,
|
|
4261
4277
|
onViewProduct: c
|
|
4262
4278
|
}
|
|
4263
|
-
) }) : e ===
|
|
4279
|
+
) }) : e === ms || e === gs ? /* @__PURE__ */ a(
|
|
4264
4280
|
ws,
|
|
4265
4281
|
{
|
|
4266
4282
|
toolCallId: t,
|
|
@@ -4268,7 +4284,7 @@ function wr({
|
|
|
4268
4284
|
toolOutput: n,
|
|
4269
4285
|
toolState: i ?? ""
|
|
4270
4286
|
}
|
|
4271
|
-
) : e ===
|
|
4287
|
+
) : e === ys ? /* @__PURE__ */ a(
|
|
4272
4288
|
Is,
|
|
4273
4289
|
{
|
|
4274
4290
|
toolCallId: t,
|
|
@@ -4285,7 +4301,7 @@ function wr({
|
|
|
4285
4301
|
successMessage: "Added to cart",
|
|
4286
4302
|
toolOutput: n
|
|
4287
4303
|
}
|
|
4288
|
-
) : e ===
|
|
4304
|
+
) : e === fr ? /* @__PURE__ */ a(
|
|
4289
4305
|
ae,
|
|
4290
4306
|
{
|
|
4291
4307
|
toolCallId: t,
|
|
@@ -4294,7 +4310,7 @@ function wr({
|
|
|
4294
4310
|
successMessage: "Updated cart",
|
|
4295
4311
|
toolOutput: n
|
|
4296
4312
|
}
|
|
4297
|
-
) : e ===
|
|
4313
|
+
) : e === mr ? /* @__PURE__ */ a(
|
|
4298
4314
|
ae,
|
|
4299
4315
|
{
|
|
4300
4316
|
toolCallId: t,
|
|
@@ -4303,7 +4319,7 @@ function wr({
|
|
|
4303
4319
|
successMessage: "Removed from cart",
|
|
4304
4320
|
toolOutput: n
|
|
4305
4321
|
}
|
|
4306
|
-
) : e ===
|
|
4322
|
+
) : e === gr ? /* @__PURE__ */ a(
|
|
4307
4323
|
ae,
|
|
4308
4324
|
{
|
|
4309
4325
|
toolCallId: t,
|
|
@@ -4312,7 +4328,7 @@ function wr({
|
|
|
4312
4328
|
successMessage: "Cart cleared",
|
|
4313
4329
|
toolOutput: n
|
|
4314
4330
|
}
|
|
4315
|
-
) : e ===
|
|
4331
|
+
) : e === yr ? /* @__PURE__ */ a(
|
|
4316
4332
|
ae,
|
|
4317
4333
|
{
|
|
4318
4334
|
toolCallId: t,
|
|
@@ -4320,7 +4336,7 @@ function wr({
|
|
|
4320
4336
|
successMessage: "Retrieved cart",
|
|
4321
4337
|
toolOutput: n
|
|
4322
4338
|
}
|
|
4323
|
-
) : e ===
|
|
4339
|
+
) : e === dt ? /* @__PURE__ */ a(
|
|
4324
4340
|
ae,
|
|
4325
4341
|
{
|
|
4326
4342
|
toolCallId: t,
|
|
@@ -4336,7 +4352,7 @@ function wr({
|
|
|
4336
4352
|
successMessage: "Saved metadata",
|
|
4337
4353
|
toolOutput: n
|
|
4338
4354
|
}
|
|
4339
|
-
) : e ===
|
|
4355
|
+
) : e === xr ? /* @__PURE__ */ a(
|
|
4340
4356
|
ae,
|
|
4341
4357
|
{
|
|
4342
4358
|
toolCallId: t,
|
|
@@ -4344,7 +4360,7 @@ function wr({
|
|
|
4344
4360
|
successMessage: "Warnings updated",
|
|
4345
4361
|
toolOutput: n
|
|
4346
4362
|
}
|
|
4347
|
-
) : e ===
|
|
4363
|
+
) : e === br ? /* @__PURE__ */ a(
|
|
4348
4364
|
ae,
|
|
4349
4365
|
{
|
|
4350
4366
|
toolCallId: t,
|
|
@@ -4377,7 +4393,7 @@ function Os({
|
|
|
4377
4393
|
{
|
|
4378
4394
|
className: `transition-transform duration-200 ${s ? "rotate-90" : ""}`,
|
|
4379
4395
|
"aria-hidden": "true",
|
|
4380
|
-
children: /* @__PURE__ */ a(
|
|
4396
|
+
children: /* @__PURE__ */ a(Cr, {})
|
|
4381
4397
|
}
|
|
4382
4398
|
),
|
|
4383
4399
|
/* @__PURE__ */ h("span", { className: "flex-1 text-left", children: [
|
|
@@ -4395,7 +4411,7 @@ function Os({
|
|
|
4395
4411
|
"data-testid": "collapsible-panel",
|
|
4396
4412
|
className: `collapsible-panel ${s ? "collapsible-panel-open" : ""}`,
|
|
4397
4413
|
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((c) => /* @__PURE__ */ a(
|
|
4398
|
-
|
|
4414
|
+
Ir,
|
|
4399
4415
|
{
|
|
4400
4416
|
toolCallId: c.toolCallId,
|
|
4401
4417
|
toolName: c.toolName,
|
|
@@ -4412,17 +4428,17 @@ function Os({
|
|
|
4412
4428
|
)
|
|
4413
4429
|
] });
|
|
4414
4430
|
}
|
|
4415
|
-
const Fs =
|
|
4416
|
-
id:
|
|
4431
|
+
const Fs = yt.object({
|
|
4432
|
+
id: yt.string()
|
|
4417
4433
|
});
|
|
4418
4434
|
async function Ds(t, e) {
|
|
4419
4435
|
if (!t.body)
|
|
4420
4436
|
throw new Error("No response body");
|
|
4421
4437
|
const r = [], n = /* @__PURE__ */ new Set(), i = [];
|
|
4422
4438
|
let s = null, o = null;
|
|
4423
|
-
const l =
|
|
4439
|
+
const l = Ur({
|
|
4424
4440
|
stream: t.body,
|
|
4425
|
-
schema:
|
|
4441
|
+
schema: qr
|
|
4426
4442
|
}).getReader();
|
|
4427
4443
|
try {
|
|
4428
4444
|
for (; ; ) {
|
|
@@ -4474,7 +4490,7 @@ async function Ds(t, e) {
|
|
|
4474
4490
|
errorMessage: o
|
|
4475
4491
|
};
|
|
4476
4492
|
}
|
|
4477
|
-
async function
|
|
4493
|
+
async function wr(t, e) {
|
|
4478
4494
|
const { origin: r, projectId: n, apiKey: i } = t, s = await Ne(
|
|
4479
4495
|
`${r}/project/${n}/agents/threads`,
|
|
4480
4496
|
{
|
|
@@ -4589,10 +4605,10 @@ const Us = {
|
|
|
4589
4605
|
}
|
|
4590
4606
|
};
|
|
4591
4607
|
let Le = null;
|
|
4592
|
-
function
|
|
4608
|
+
function Vi(t) {
|
|
4593
4609
|
Le = t;
|
|
4594
4610
|
}
|
|
4595
|
-
function
|
|
4611
|
+
function rt(t) {
|
|
4596
4612
|
return Le ? Le.startInactiveSpan(t) : Us;
|
|
4597
4613
|
}
|
|
4598
4614
|
function qs(t, e) {
|
|
@@ -4605,7 +4621,7 @@ function qs(t, e) {
|
|
|
4605
4621
|
} : void 0
|
|
4606
4622
|
);
|
|
4607
4623
|
}
|
|
4608
|
-
function
|
|
4624
|
+
function $t({
|
|
4609
4625
|
messageId: t,
|
|
4610
4626
|
isOpen: e,
|
|
4611
4627
|
onClose: r
|
|
@@ -4695,7 +4711,7 @@ function Mt({
|
|
|
4695
4711
|
onClick: r,
|
|
4696
4712
|
className: "p-1 rounded-md hover:bg-surface-secondary transition-colors",
|
|
4697
4713
|
"aria-label": "Close dialog",
|
|
4698
|
-
children: /* @__PURE__ */ a(
|
|
4714
|
+
children: /* @__PURE__ */ a(lt, {})
|
|
4699
4715
|
}
|
|
4700
4716
|
)
|
|
4701
4717
|
] }),
|
|
@@ -4795,7 +4811,7 @@ function Mt({
|
|
|
4795
4811
|
}
|
|
4796
4812
|
) : null;
|
|
4797
4813
|
}
|
|
4798
|
-
const
|
|
4814
|
+
const Mt = ({ size: t = 12 }) => /* @__PURE__ */ h(
|
|
4799
4815
|
"svg",
|
|
4800
4816
|
{
|
|
4801
4817
|
width: t,
|
|
@@ -4834,11 +4850,11 @@ function js({
|
|
|
4834
4850
|
className: "shrink-0 p-1 rounded text-text-tertiary hover:text-text hover:bg-surface-secondary transition-colors",
|
|
4835
4851
|
"aria-label": "Send feedback",
|
|
4836
4852
|
title: "Send feedback",
|
|
4837
|
-
children: /* @__PURE__ */ a(
|
|
4853
|
+
children: /* @__PURE__ */ a(Mt, { size: 14 })
|
|
4838
4854
|
}
|
|
4839
4855
|
),
|
|
4840
4856
|
/* @__PURE__ */ a(
|
|
4841
|
-
|
|
4857
|
+
$t,
|
|
4842
4858
|
{
|
|
4843
4859
|
messageId: e,
|
|
4844
4860
|
isOpen: l,
|
|
@@ -4862,7 +4878,7 @@ function js({
|
|
|
4862
4878
|
{
|
|
4863
4879
|
className: `transition-transform duration-200 ${c ? "rotate-90" : ""}`,
|
|
4864
4880
|
"aria-hidden": "true",
|
|
4865
|
-
children: /* @__PURE__ */ a(
|
|
4881
|
+
children: /* @__PURE__ */ a(Cr, {})
|
|
4866
4882
|
}
|
|
4867
4883
|
),
|
|
4868
4884
|
/* @__PURE__ */ a("span", { className: "flex-1 text-left truncate", children: c ? "Hide message" : i })
|
|
@@ -4894,12 +4910,12 @@ function js({
|
|
|
4894
4910
|
className: "shrink-0 p-1 rounded text-text-tertiary hover:text-text hover:bg-surface-secondary transition-colors",
|
|
4895
4911
|
"aria-label": "Send feedback",
|
|
4896
4912
|
title: "Send feedback",
|
|
4897
|
-
children: /* @__PURE__ */ a(
|
|
4913
|
+
children: /* @__PURE__ */ a(Mt, { size: 14 })
|
|
4898
4914
|
}
|
|
4899
4915
|
)
|
|
4900
4916
|
] }),
|
|
4901
4917
|
/* @__PURE__ */ a(
|
|
4902
|
-
|
|
4918
|
+
$t,
|
|
4903
4919
|
{
|
|
4904
4920
|
messageId: e,
|
|
4905
4921
|
isOpen: l,
|
|
@@ -4913,7 +4929,7 @@ function Ws(t) {
|
|
|
4913
4929
|
return [];
|
|
4914
4930
|
const e = [];
|
|
4915
4931
|
for (const r of t.parts)
|
|
4916
|
-
if (r.type === "text" && r.text !==
|
|
4932
|
+
if (r.type === "text" && r.text !== it)
|
|
4917
4933
|
e.push({
|
|
4918
4934
|
type: "text",
|
|
4919
4935
|
text: r.text
|
|
@@ -4959,7 +4975,7 @@ function zs({
|
|
|
4959
4975
|
onClick: i,
|
|
4960
4976
|
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",
|
|
4961
4977
|
children: [
|
|
4962
|
-
/* @__PURE__ */ a(
|
|
4978
|
+
/* @__PURE__ */ a(At, {}),
|
|
4963
4979
|
/* @__PURE__ */ a("span", { className: "text-sm text-text font-medium truncate min-w-0", children: s || "Uploaded Document" }),
|
|
4964
4980
|
/* @__PURE__ */ h(
|
|
4965
4981
|
"svg",
|
|
@@ -4990,7 +5006,7 @@ function zs({
|
|
|
4990
5006
|
`text-${t.id}-${m}`
|
|
4991
5007
|
) : null) })
|
|
4992
5008
|
] }) : /* @__PURE__ */ h(Ce, { children: [
|
|
4993
|
-
|
|
5009
|
+
Cs(p).map((u, m) => u.type === "tool-group" ? /* @__PURE__ */ a(
|
|
4994
5010
|
Os,
|
|
4995
5011
|
{
|
|
4996
5012
|
tools: u.tools,
|
|
@@ -5024,7 +5040,7 @@ function zs({
|
|
|
5024
5040
|
},
|
|
5025
5041
|
`text-${t.id}-${m}`
|
|
5026
5042
|
) : u.type === "tool" ? /* @__PURE__ */ a("div", { className: "ml-5", children: /* @__PURE__ */ a(
|
|
5027
|
-
|
|
5043
|
+
Ir,
|
|
5028
5044
|
{
|
|
5029
5045
|
toolCallId: u.toolCallId,
|
|
5030
5046
|
toolName: u.toolName,
|
|
@@ -5037,14 +5053,14 @@ function zs({
|
|
|
5037
5053
|
}
|
|
5038
5054
|
) }, u.toolCallId) : null),
|
|
5039
5055
|
!d && t.parts?.some((u) => u.type === "file") && /* @__PURE__ */ h("div", { className: "flex items-center gap-1.5 mt-2 text-xs text-text-tertiary", children: [
|
|
5040
|
-
/* @__PURE__ */ a(
|
|
5056
|
+
/* @__PURE__ */ a(At, {}),
|
|
5041
5057
|
/* @__PURE__ */ a("span", { children: Vs(t.parts) })
|
|
5042
5058
|
] })
|
|
5043
5059
|
] }) })
|
|
5044
5060
|
}
|
|
5045
5061
|
);
|
|
5046
5062
|
}
|
|
5047
|
-
function
|
|
5063
|
+
function Sr() {
|
|
5048
5064
|
const [t, e] = R(!1);
|
|
5049
5065
|
return F(() => {
|
|
5050
5066
|
if (typeof window.matchMedia != "function") {
|
|
@@ -5059,7 +5075,7 @@ function Er() {
|
|
|
5059
5075
|
return r.addEventListener("change", n), () => r.removeEventListener("change", n);
|
|
5060
5076
|
}, []), t;
|
|
5061
5077
|
}
|
|
5062
|
-
const
|
|
5078
|
+
const Er = () => /* @__PURE__ */ h(
|
|
5063
5079
|
"svg",
|
|
5064
5080
|
{
|
|
5065
5081
|
width: "48",
|
|
@@ -5094,7 +5110,7 @@ const Nr = () => /* @__PURE__ */ h(
|
|
|
5094
5110
|
]
|
|
5095
5111
|
}
|
|
5096
5112
|
);
|
|
5097
|
-
function
|
|
5113
|
+
function Nr({ onClick: t }) {
|
|
5098
5114
|
return /* @__PURE__ */ h(
|
|
5099
5115
|
"button",
|
|
5100
5116
|
{
|
|
@@ -5117,7 +5133,7 @@ function Qs({
|
|
|
5117
5133
|
onDropZoneClick: s,
|
|
5118
5134
|
onCameraClick: o
|
|
5119
5135
|
}) {
|
|
5120
|
-
const c =
|
|
5136
|
+
const c = Sr();
|
|
5121
5137
|
return /* @__PURE__ */ a("div", { className: "flex-1 flex items-center justify-center animate-fade-in-up", children: /* @__PURE__ */ h("div", { className: "flex flex-col items-center gap-4", children: [
|
|
5122
5138
|
/* @__PURE__ */ h(
|
|
5123
5139
|
"button",
|
|
@@ -5133,7 +5149,7 @@ function Qs({
|
|
|
5133
5149
|
type: "file",
|
|
5134
5150
|
className: "hidden",
|
|
5135
5151
|
onChange: i,
|
|
5136
|
-
accept:
|
|
5152
|
+
accept: tr
|
|
5137
5153
|
}
|
|
5138
5154
|
),
|
|
5139
5155
|
/* @__PURE__ */ a(
|
|
@@ -5143,7 +5159,7 @@ function Qs({
|
|
|
5143
5159
|
type: "file",
|
|
5144
5160
|
className: "hidden",
|
|
5145
5161
|
onChange: i,
|
|
5146
|
-
accept:
|
|
5162
|
+
accept: rr,
|
|
5147
5163
|
capture: "environment"
|
|
5148
5164
|
}
|
|
5149
5165
|
),
|
|
@@ -5154,12 +5170,12 @@ function Qs({
|
|
|
5154
5170
|
"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",
|
|
5155
5171
|
t && "animate-icon-bounce"
|
|
5156
5172
|
),
|
|
5157
|
-
children: /* @__PURE__ */ a(
|
|
5173
|
+
children: /* @__PURE__ */ a(Er, {})
|
|
5158
5174
|
}
|
|
5159
5175
|
),
|
|
5160
5176
|
/* @__PURE__ */ a("h3", { className: "m-0 text-base font-semibold text-text text-center", children: "Upload your Order" }),
|
|
5161
5177
|
/* @__PURE__ */ a("p", { className: "m-0 text-sm text-text-tertiary text-center", children: "Your Order Assistant will match products and check stock availability" }),
|
|
5162
|
-
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2", children:
|
|
5178
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2", children: nr.map((l) => /* @__PURE__ */ a(
|
|
5163
5179
|
"span",
|
|
5164
5180
|
{
|
|
5165
5181
|
className: "py-1 px-3 bg-surface-invert/5 border border-border-strong rounded-full text-xs font-medium text-text",
|
|
@@ -5170,7 +5186,7 @@ function Qs({
|
|
|
5170
5186
|
]
|
|
5171
5187
|
}
|
|
5172
5188
|
),
|
|
5173
|
-
c && /* @__PURE__ */ a(
|
|
5189
|
+
c && /* @__PURE__ */ a(Nr, { onClick: o }),
|
|
5174
5190
|
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 })
|
|
5175
5191
|
] }) });
|
|
5176
5192
|
}
|
|
@@ -5186,7 +5202,7 @@ function Gs() {
|
|
|
5186
5202
|
)
|
|
5187
5203
|
] }) });
|
|
5188
5204
|
}
|
|
5189
|
-
const Ks =
|
|
5205
|
+
const Ks = Fr(
|
|
5190
5206
|
function({
|
|
5191
5207
|
messages: e,
|
|
5192
5208
|
input: r,
|
|
@@ -5211,7 +5227,7 @@ const Ks = Dr(
|
|
|
5211
5227
|
}
|
|
5212
5228
|
return null;
|
|
5213
5229
|
}, [e]);
|
|
5214
|
-
return
|
|
5230
|
+
return Dr(x, () => ({
|
|
5215
5231
|
scrollToBottom: () => {
|
|
5216
5232
|
const y = I.current;
|
|
5217
5233
|
y && (y.scrollHeight - y.scrollTop - y.clientHeight > 500 || !y.scrollTo ? y.scrollTop = y.scrollHeight : y.scrollTo({
|
|
@@ -5273,12 +5289,12 @@ const Ks = Dr(
|
|
|
5273
5289
|
);
|
|
5274
5290
|
}),
|
|
5275
5291
|
s && /* @__PURE__ */ a(Gs, {}),
|
|
5276
|
-
/* @__PURE__ */ a(
|
|
5292
|
+
/* @__PURE__ */ a(ps, { error: p, onRetry: u })
|
|
5277
5293
|
]
|
|
5278
5294
|
}
|
|
5279
5295
|
),
|
|
5280
5296
|
/* @__PURE__ */ a(
|
|
5281
|
-
|
|
5297
|
+
fs,
|
|
5282
5298
|
{
|
|
5283
5299
|
input: r,
|
|
5284
5300
|
onInputChange: n,
|
|
@@ -5288,8 +5304,8 @@ const Ks = Dr(
|
|
|
5288
5304
|
)
|
|
5289
5305
|
] });
|
|
5290
5306
|
}
|
|
5291
|
-
), Js = "purchase-order-chat-user-settings", Ys = 25,
|
|
5292
|
-
|
|
5307
|
+
), Js = "purchase-order-chat-user-settings", Ys = 25, Ot = at()(
|
|
5308
|
+
zt(
|
|
5293
5309
|
(t) => ({
|
|
5294
5310
|
panelWidth: Ys,
|
|
5295
5311
|
setPanelWidth: (e) => t({ panelWidth: e })
|
|
@@ -5300,7 +5316,7 @@ const Ks = Dr(
|
|
|
5300
5316
|
)
|
|
5301
5317
|
);
|
|
5302
5318
|
function Zs() {
|
|
5303
|
-
const t =
|
|
5319
|
+
const t = Ot((m) => m.panelWidth), e = Ot((m) => m.setPanelWidth), [r, n] = R(
|
|
5304
5320
|
typeof window < "u" && window.innerWidth >= 1024
|
|
5305
5321
|
), i = D(null), s = D(!1), o = D(t);
|
|
5306
5322
|
F(() => {
|
|
@@ -5394,7 +5410,7 @@ function Xs({ activeTab: t, onTabChange: e, hasUnread: r }) {
|
|
|
5394
5410
|
)
|
|
5395
5411
|
] });
|
|
5396
5412
|
}
|
|
5397
|
-
function
|
|
5413
|
+
function Ft({
|
|
5398
5414
|
// Chat panel props
|
|
5399
5415
|
messages: t,
|
|
5400
5416
|
input: e,
|
|
@@ -5441,7 +5457,7 @@ function Dt({
|
|
|
5441
5457
|
u.length > 0 ? "cart" : "chat"
|
|
5442
5458
|
), [fe, me] = R(!1), de = D(t.length), ge = D(K);
|
|
5443
5459
|
ge.current = K;
|
|
5444
|
-
const f = t.length === 0 && u.length === 0 && !!p, S =
|
|
5460
|
+
const f = t.length === 0 && u.length === 0 && !!p, S = sr({
|
|
5445
5461
|
onFile: p ?? (() => {
|
|
5446
5462
|
})
|
|
5447
5463
|
});
|
|
@@ -5471,7 +5487,7 @@ function Dt({
|
|
|
5471
5487
|
fileDrop: p ? S : void 0
|
|
5472
5488
|
}
|
|
5473
5489
|
), O = /* @__PURE__ */ a(
|
|
5474
|
-
|
|
5490
|
+
ls,
|
|
5475
5491
|
{
|
|
5476
5492
|
items: u,
|
|
5477
5493
|
itemWarnings: m,
|
|
@@ -5581,7 +5597,7 @@ function Dt({
|
|
|
5581
5597
|
);
|
|
5582
5598
|
}
|
|
5583
5599
|
function ea() {
|
|
5584
|
-
const t =
|
|
5600
|
+
const t = ht(), e = g((c) => c.ui.existingCart), r = g(
|
|
5585
5601
|
(c) => c.confirmClearExistingCart
|
|
5586
5602
|
), [n, i] = R(!1), s = ee(
|
|
5587
5603
|
() => e?.lineItems.physicalItems.reduce(
|
|
@@ -5633,7 +5649,7 @@ function ta({ message: t }) {
|
|
|
5633
5649
|
)
|
|
5634
5650
|
] }) });
|
|
5635
5651
|
}
|
|
5636
|
-
function
|
|
5652
|
+
function kr() {
|
|
5637
5653
|
const t = g((n) => n.appState), e = g(
|
|
5638
5654
|
(n) => n.parser.parsedContent
|
|
5639
5655
|
), r = g(
|
|
@@ -5685,7 +5701,7 @@ function sa({
|
|
|
5685
5701
|
type: "file",
|
|
5686
5702
|
className: "hidden",
|
|
5687
5703
|
onChange: s,
|
|
5688
|
-
accept:
|
|
5704
|
+
accept: rr,
|
|
5689
5705
|
capture: "environment"
|
|
5690
5706
|
}
|
|
5691
5707
|
),
|
|
@@ -5696,12 +5712,12 @@ function sa({
|
|
|
5696
5712
|
"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",
|
|
5697
5713
|
t && "animate-icon-bounce"
|
|
5698
5714
|
),
|
|
5699
|
-
children: /* @__PURE__ */ a(
|
|
5715
|
+
children: /* @__PURE__ */ a(Er, {})
|
|
5700
5716
|
}
|
|
5701
5717
|
),
|
|
5702
5718
|
/* @__PURE__ */ a("h2", { className: "m-0 text-2xl max-md:text-xl font-semibold text-text text-center", children: "Upload your Order" }),
|
|
5703
5719
|
/* @__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" }),
|
|
5704
|
-
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2 mt-2", children:
|
|
5720
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-center gap-2 mt-2", children: nr.map((o) => /* @__PURE__ */ a(
|
|
5705
5721
|
"span",
|
|
5706
5722
|
{
|
|
5707
5723
|
className: "py-1 px-3 bg-surface-invert/5 border border-border-strong rounded-full text-xs font-medium text-text backdrop-blur",
|
|
@@ -5722,7 +5738,7 @@ function aa({
|
|
|
5722
5738
|
onFileChange: s,
|
|
5723
5739
|
onSkip: o
|
|
5724
5740
|
}) {
|
|
5725
|
-
const c =
|
|
5741
|
+
const c = Sr(), l = D(null), d = M(() => {
|
|
5726
5742
|
l.current?.click();
|
|
5727
5743
|
}, []);
|
|
5728
5744
|
return /* @__PURE__ */ h(
|
|
@@ -5745,7 +5761,7 @@ function aa({
|
|
|
5745
5761
|
onFileChange: s
|
|
5746
5762
|
}
|
|
5747
5763
|
),
|
|
5748
|
-
c && /* @__PURE__ */ a(
|
|
5764
|
+
c && /* @__PURE__ */ a(Nr, { onClick: d }),
|
|
5749
5765
|
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 }),
|
|
5750
5766
|
/* @__PURE__ */ a("div", { className: "upload-zone-steps px-8 border-b border-solid border-border-strong" }),
|
|
5751
5767
|
/* @__PURE__ */ a(
|
|
@@ -5853,9 +5869,9 @@ function ia({
|
|
|
5853
5869
|
] })
|
|
5854
5870
|
] });
|
|
5855
5871
|
}
|
|
5856
|
-
const oa = 3e3,
|
|
5872
|
+
const oa = 3e3, Dt = 200;
|
|
5857
5873
|
function ca(t) {
|
|
5858
|
-
return t <= 0 ?
|
|
5874
|
+
return t <= 0 ? Dt : Math.max(Dt, Math.round(oa / t));
|
|
5859
5875
|
}
|
|
5860
5876
|
function la() {
|
|
5861
5877
|
const t = g(
|
|
@@ -5901,21 +5917,22 @@ function ua() {
|
|
|
5901
5917
|
isRevealing: e < t.length
|
|
5902
5918
|
};
|
|
5903
5919
|
}
|
|
5904
|
-
const
|
|
5920
|
+
const Rt = ["reading", "matching", "building"];
|
|
5905
5921
|
function pa(t, e) {
|
|
5906
5922
|
if (!e) return "pending";
|
|
5907
|
-
const r =
|
|
5923
|
+
const r = Rt.indexOf(e), n = Rt.indexOf(t);
|
|
5908
5924
|
return n < r ? "complete" : n === r ? "active" : "pending";
|
|
5909
5925
|
}
|
|
5910
5926
|
function ha(t, e) {
|
|
5911
5927
|
return t.length >= 2 && e !== "submitted" && e !== "streaming";
|
|
5912
5928
|
}
|
|
5913
5929
|
function fa(t) {
|
|
5914
|
-
if (t
|
|
5915
|
-
const e =
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5930
|
+
if (t == null) return null;
|
|
5931
|
+
const e = pt(t, [
|
|
5932
|
+
"searchProductsBySku",
|
|
5933
|
+
"searchProducts"
|
|
5934
|
+
]);
|
|
5935
|
+
return e === void 0 ? null : e.total ?? 0;
|
|
5919
5936
|
}
|
|
5920
5937
|
const ma = {
|
|
5921
5938
|
searchProductsBySku: (t, { resultCount: e }) => {
|
|
@@ -5957,7 +5974,7 @@ const ya = [
|
|
|
5957
5974
|
{ id: "reading", label: "Reading document..." },
|
|
5958
5975
|
{ id: "matching", label: "Matching products..." },
|
|
5959
5976
|
{ id: "building", label: "Building cart..." }
|
|
5960
|
-
],
|
|
5977
|
+
], _t = {
|
|
5961
5978
|
pending: {
|
|
5962
5979
|
row: "opacity-40",
|
|
5963
5980
|
icon: "bg-surface-secondary border-2 border-border-strong"
|
|
@@ -5984,12 +6001,12 @@ function xa({
|
|
|
5984
6001
|
{
|
|
5985
6002
|
"data-testid": "processing-step-row",
|
|
5986
6003
|
"data-status": c,
|
|
5987
|
-
className: `flex items-center gap-4 transition-opacity duration-300 ${
|
|
6004
|
+
className: `flex items-center gap-4 transition-opacity duration-300 ${_t[c].row}`,
|
|
5988
6005
|
children: [
|
|
5989
6006
|
/* @__PURE__ */ h(
|
|
5990
6007
|
"div",
|
|
5991
6008
|
{
|
|
5992
|
-
className: `flex items-center justify-center w-8 h-8 rounded-full shrink-0 transition-all duration-300 ${
|
|
6009
|
+
className: `flex items-center justify-center w-8 h-8 rounded-full shrink-0 transition-all duration-300 ${_t[c].icon}${c === "complete" ? " animate-step-pulse" : ""}${c === "active" ? " bg-surface-invert shadow-step" : ""}`,
|
|
5993
6010
|
children: [
|
|
5994
6011
|
c === "complete" && /* @__PURE__ */ a(Ue, { size: 16, title: "Complete" }),
|
|
5995
6012
|
c === "active" && /* @__PURE__ */ a(Me, { size: 16 }),
|
|
@@ -6033,7 +6050,7 @@ function ba({
|
|
|
6033
6050
|
cartItems: t,
|
|
6034
6051
|
isUploading: e = !1
|
|
6035
6052
|
}) {
|
|
6036
|
-
const r =
|
|
6053
|
+
const r = kr(), n = g((s) => s.cartifact.orderId), i = g(
|
|
6037
6054
|
(s) => s.parser.parsedContent
|
|
6038
6055
|
);
|
|
6039
6056
|
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__ */ h("div", { className: "flex w-full justify-center gap-32 max-md:flex-col max-md:gap-8", children: [
|
|
@@ -6058,7 +6075,7 @@ function Ca({
|
|
|
6058
6075
|
isUploading: i = !1,
|
|
6059
6076
|
parserError: s = null
|
|
6060
6077
|
}) {
|
|
6061
|
-
const c =
|
|
6078
|
+
const c = kr() !== null, l = sr({
|
|
6062
6079
|
onFile: t,
|
|
6063
6080
|
onBeforeValidate: r
|
|
6064
6081
|
}), d = s || l.fileError, p = M(() => {
|
|
@@ -6074,7 +6091,7 @@ function Ca({
|
|
|
6074
6091
|
{
|
|
6075
6092
|
isDragging: l.isDragging,
|
|
6076
6093
|
fileInputRef: l.fileInputRef,
|
|
6077
|
-
acceptedExtensions:
|
|
6094
|
+
acceptedExtensions: tr,
|
|
6078
6095
|
displayError: d,
|
|
6079
6096
|
onDropZoneClick: p,
|
|
6080
6097
|
onFileChange: l.handleFileChange,
|
|
@@ -6097,13 +6114,13 @@ function he(t) {
|
|
|
6097
6114
|
shouldSaveAddress: !1
|
|
6098
6115
|
};
|
|
6099
6116
|
}
|
|
6100
|
-
function
|
|
6117
|
+
function Lt(t, e) {
|
|
6101
6118
|
if (!(!t.address1 || !t.postalCode))
|
|
6102
6119
|
return e.find(
|
|
6103
6120
|
(r) => r.address1?.toLowerCase() === t.address1.toLowerCase() && r.postalCode?.toLowerCase() === t.postalCode?.toLowerCase()
|
|
6104
6121
|
);
|
|
6105
6122
|
}
|
|
6106
|
-
function
|
|
6123
|
+
function Pr(t, e) {
|
|
6107
6124
|
return t !== void 0 && Math.abs(t - e) > 0.01;
|
|
6108
6125
|
}
|
|
6109
6126
|
function va(t, e) {
|
|
@@ -6136,7 +6153,7 @@ function wa(t, e) {
|
|
|
6136
6153
|
for (const n of t.lineItems.physicalItems) {
|
|
6137
6154
|
const i = e.find(
|
|
6138
6155
|
(l) => l.productEntityId === n.productEntityId && l.variantEntityId === n.variantEntityId
|
|
6139
|
-
), s = i?.poPriceValue, o = n.listPrice.value, c =
|
|
6156
|
+
), s = i?.poPriceValue, o = n.listPrice.value, c = Pr(s, o);
|
|
6140
6157
|
r.push({
|
|
6141
6158
|
id: n.entityId,
|
|
6142
6159
|
sku: n.sku,
|
|
@@ -6298,7 +6315,7 @@ function Ea(t) {
|
|
|
6298
6315
|
}
|
|
6299
6316
|
let f;
|
|
6300
6317
|
if (l.length > 0) {
|
|
6301
|
-
const S =
|
|
6318
|
+
const S = Lt(
|
|
6302
6319
|
T,
|
|
6303
6320
|
l
|
|
6304
6321
|
);
|
|
@@ -6330,7 +6347,7 @@ function Ea(t) {
|
|
|
6330
6347
|
return;
|
|
6331
6348
|
let f;
|
|
6332
6349
|
if (l.length > 0) {
|
|
6333
|
-
const S =
|
|
6350
|
+
const S = Lt(
|
|
6334
6351
|
y,
|
|
6335
6352
|
l
|
|
6336
6353
|
);
|
|
@@ -6361,7 +6378,7 @@ function Ea(t) {
|
|
|
6361
6378
|
const z = D(void 0), q = D(void 0), oe = ee(() => s ? s.lineItems.physicalItems.map((f) => {
|
|
6362
6379
|
const S = j.find(
|
|
6363
6380
|
(_) => _.productEntityId === f.productEntityId && _.variantEntityId === f.variantEntityId
|
|
6364
|
-
), E = S?.poPriceValue, P = f.listPrice.value, O =
|
|
6381
|
+
), E = S?.poPriceValue, P = f.listPrice.value, O = Pr(E, P), U = m[f.productEntityId];
|
|
6365
6382
|
return {
|
|
6366
6383
|
id: f.entityId,
|
|
6367
6384
|
sku: f.sku ?? "",
|
|
@@ -6857,14 +6874,14 @@ function Na({
|
|
|
6857
6874
|
handleShowMoreLikeThis: p
|
|
6858
6875
|
};
|
|
6859
6876
|
}
|
|
6860
|
-
const
|
|
6877
|
+
const nt = /* @__PURE__ */ new Set([
|
|
6861
6878
|
Oe,
|
|
6862
|
-
|
|
6879
|
+
dt,
|
|
6863
6880
|
Ye,
|
|
6864
|
-
|
|
6881
|
+
ut
|
|
6865
6882
|
]), ka = "did not produce any output";
|
|
6866
6883
|
function Pa(t) {
|
|
6867
|
-
const e = t.filter((n) =>
|
|
6884
|
+
const e = t.filter((n) => nt.has(n.toolName)).map((n) => n.toolName);
|
|
6868
6885
|
return e.length === 0 ? "" : `
|
|
6869
6886
|
|
|
6870
6887
|
Tools called: ${[...new Set(e)].join(", ")}`;
|
|
@@ -6908,10 +6925,10 @@ async function Ta(t, e, r, n, i, s) {
|
|
|
6908
6925
|
error: y.errorMessage
|
|
6909
6926
|
};
|
|
6910
6927
|
const A = y.toolCalls.filter(
|
|
6911
|
-
(B) =>
|
|
6928
|
+
(B) => nt.has(B.toolName) || !y.serverHandledToolCallIds.has(B.toolCallId)
|
|
6912
6929
|
);
|
|
6913
6930
|
for (const B of A)
|
|
6914
|
-
|
|
6931
|
+
nt.has(B.toolName) && d.push(B);
|
|
6915
6932
|
if (A.length === 0) {
|
|
6916
6933
|
s?.logger?.debug(
|
|
6917
6934
|
`Batch ${i}: Exiting loop - no client tool calls to respond to`
|
|
@@ -6949,7 +6966,7 @@ async function Ta(t, e, r, n, i, s) {
|
|
|
6949
6966
|
},
|
|
6950
6967
|
{
|
|
6951
6968
|
role: "user",
|
|
6952
|
-
parts: [{ type: "text", text:
|
|
6969
|
+
parts: [{ type: "text", text: it }]
|
|
6953
6970
|
}
|
|
6954
6971
|
];
|
|
6955
6972
|
}
|
|
@@ -6964,7 +6981,7 @@ async function Ta(t, e, r, n, i, s) {
|
|
|
6964
6981
|
const A = y.input?.value;
|
|
6965
6982
|
return T + (A?.length ?? 0);
|
|
6966
6983
|
}, 0), N = d.filter(
|
|
6967
|
-
(T) => T.toolName ===
|
|
6984
|
+
(T) => T.toolName === ut
|
|
6968
6985
|
).reduce((T, y) => {
|
|
6969
6986
|
const A = y.input?.processingFailures;
|
|
6970
6987
|
return T + (A?.length ?? 0);
|
|
@@ -6983,7 +7000,7 @@ async function Aa(t, e, r, n) {
|
|
|
6983
7000
|
if (r.length === 0)
|
|
6984
7001
|
return { results: [], hasErrors: !1 };
|
|
6985
7002
|
const s = (await Promise.allSettled(
|
|
6986
|
-
r.map(() =>
|
|
7003
|
+
r.map(() => wr(t, e))
|
|
6987
7004
|
)).map((l, d) => {
|
|
6988
7005
|
if (l.status === "fulfilled")
|
|
6989
7006
|
return n?.onThreadCreated?.(d, l.value), l.value;
|
|
@@ -6992,7 +7009,7 @@ async function Aa(t, e, r, n) {
|
|
|
6992
7009
|
`Failed to create thread for batch ${d}`,
|
|
6993
7010
|
l.reason
|
|
6994
7011
|
), n?.onError?.(d, p), null;
|
|
6995
|
-
}), o = await
|
|
7012
|
+
}), o = await Hr(
|
|
6996
7013
|
r,
|
|
6997
7014
|
async (l, d) => {
|
|
6998
7015
|
const p = s[d];
|
|
@@ -7045,7 +7062,7 @@ function Ba(t) {
|
|
|
7045
7062
|
l.value && (s += l.value.length, e.push(...l.value));
|
|
7046
7063
|
} else if (c.toolName === Ye)
|
|
7047
7064
|
r = c.input;
|
|
7048
|
-
else if (c.toolName ===
|
|
7065
|
+
else if (c.toolName === ut) {
|
|
7049
7066
|
const l = c.input;
|
|
7050
7067
|
l.processingFailures && (o += l.processingFailures.length, n.push(...l.processingFailures));
|
|
7051
7068
|
}
|
|
@@ -7243,7 +7260,7 @@ const ja = /* @__PURE__ */ new Set([
|
|
|
7243
7260
|
"application/vnd.ms-excel",
|
|
7244
7261
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
7245
7262
|
]);
|
|
7246
|
-
function
|
|
7263
|
+
function Ut(t) {
|
|
7247
7264
|
return ja.has(t);
|
|
7248
7265
|
}
|
|
7249
7266
|
async function Wa(t) {
|
|
@@ -7306,12 +7323,12 @@ const Ka = /* @__PURE__ */ new Set([
|
|
|
7306
7323
|
"text/csv",
|
|
7307
7324
|
"text/plain",
|
|
7308
7325
|
"application/json"
|
|
7309
|
-
]),
|
|
7310
|
-
function
|
|
7326
|
+
]), Tr = "Please parse this document and extract relevant purchase order information.";
|
|
7327
|
+
function qt(t, e) {
|
|
7311
7328
|
return [
|
|
7312
7329
|
{
|
|
7313
7330
|
type: "text",
|
|
7314
|
-
text: `${
|
|
7331
|
+
text: `${Tr.replace("this document", `this ${t} document`)}
|
|
7315
7332
|
|
|
7316
7333
|
${e}`
|
|
7317
7334
|
}
|
|
@@ -7319,7 +7336,7 @@ ${e}`
|
|
|
7319
7336
|
}
|
|
7320
7337
|
function Ja(t, e, r) {
|
|
7321
7338
|
return [
|
|
7322
|
-
{ type: "text", text:
|
|
7339
|
+
{ type: "text", text: Tr },
|
|
7323
7340
|
{
|
|
7324
7341
|
type: "file",
|
|
7325
7342
|
url: t,
|
|
@@ -7344,12 +7361,12 @@ function Ya({
|
|
|
7344
7361
|
}
|
|
7345
7362
|
await t();
|
|
7346
7363
|
try {
|
|
7347
|
-
if (
|
|
7364
|
+
if (Ut(c.type)) {
|
|
7348
7365
|
const d = await Wa(c);
|
|
7349
|
-
e({ parts:
|
|
7366
|
+
e({ parts: qt(c.name, d) });
|
|
7350
7367
|
} else if (Ka.has(c.type)) {
|
|
7351
7368
|
const d = await Ua(c);
|
|
7352
|
-
e({ parts:
|
|
7369
|
+
e({ parts: qt(c.name, d) });
|
|
7353
7370
|
} else {
|
|
7354
7371
|
const d = await qa(c);
|
|
7355
7372
|
e({
|
|
@@ -7357,7 +7374,7 @@ function Ya({
|
|
|
7357
7374
|
});
|
|
7358
7375
|
}
|
|
7359
7376
|
} catch (d) {
|
|
7360
|
-
console.error("Failed to read file:", d),
|
|
7377
|
+
console.error("Failed to read file:", d), Ut(c.type) ? s(
|
|
7361
7378
|
"Failed to read the spreadsheet file. Please try saving it as CSV and uploading again."
|
|
7362
7379
|
) : g.getState().setParsedContent(null), n(!1);
|
|
7363
7380
|
}
|
|
@@ -7372,7 +7389,7 @@ function Ya({
|
|
|
7372
7389
|
handleFileUpload: o
|
|
7373
7390
|
};
|
|
7374
7391
|
}
|
|
7375
|
-
function
|
|
7392
|
+
function Ar(t) {
|
|
7376
7393
|
const {
|
|
7377
7394
|
agentName: e,
|
|
7378
7395
|
createOnMount: r,
|
|
@@ -7389,7 +7406,7 @@ function Br(t) {
|
|
|
7389
7406
|
let b = 0;
|
|
7390
7407
|
for (; b <= v; )
|
|
7391
7408
|
try {
|
|
7392
|
-
const x = await
|
|
7409
|
+
const x = await wr(
|
|
7393
7410
|
{ origin: l, projectId: o, apiKey: c },
|
|
7394
7411
|
e
|
|
7395
7412
|
);
|
|
@@ -7423,7 +7440,7 @@ function Za() {
|
|
|
7423
7440
|
(y) => y.takeshapeConfig
|
|
7424
7441
|
), n = g(
|
|
7425
7442
|
(y) => y.setParserThreadId
|
|
7426
|
-
), { thread: i, createThread: s } =
|
|
7443
|
+
), { thread: i, createThread: s } = Ar({
|
|
7427
7444
|
agentName: "documentParser",
|
|
7428
7445
|
createOnMount: !1,
|
|
7429
7446
|
persist: !1,
|
|
@@ -7440,8 +7457,8 @@ function Za() {
|
|
|
7440
7457
|
sendMessage: p,
|
|
7441
7458
|
status: u,
|
|
7442
7459
|
setMessages: m
|
|
7443
|
-
} =
|
|
7444
|
-
transport: new
|
|
7460
|
+
} = Wt({
|
|
7461
|
+
transport: new Vt({
|
|
7445
7462
|
api: `${t}/project/${e}/agents/messages`,
|
|
7446
7463
|
headers: {
|
|
7447
7464
|
Authorization: `Bearer ${r}`
|
|
@@ -7480,7 +7497,7 @@ function Za() {
|
|
|
7480
7497
|
createParserThread: s,
|
|
7481
7498
|
sendParserMessage: p
|
|
7482
7499
|
}), k = M(
|
|
7483
|
-
async (y) => (l.current?.end(), l.current =
|
|
7500
|
+
async (y) => (l.current?.end(), l.current = rt({
|
|
7484
7501
|
name: "document-parser",
|
|
7485
7502
|
op: "ai.parse",
|
|
7486
7503
|
attributes: {
|
|
@@ -7529,7 +7546,7 @@ class Xa {
|
|
|
7529
7546
|
getB2BJwt;
|
|
7530
7547
|
initPromise;
|
|
7531
7548
|
constructor(e) {
|
|
7532
|
-
this.channelId = e.channelId, this.getB2BJwt = e.getB2BJwt ?? null, this.graphQLClient = new
|
|
7549
|
+
this.channelId = e.channelId, this.getB2BJwt = e.getB2BJwt ?? null, this.graphQLClient = new st(Ht, {
|
|
7533
7550
|
fetch: Ne,
|
|
7534
7551
|
credentials: "same-origin",
|
|
7535
7552
|
headers: {
|
|
@@ -7584,7 +7601,7 @@ class Xa {
|
|
|
7584
7601
|
}
|
|
7585
7602
|
async getB2BStorefrontToken(e) {
|
|
7586
7603
|
const r = await this.request({
|
|
7587
|
-
document:
|
|
7604
|
+
document: Gt,
|
|
7588
7605
|
variables: {
|
|
7589
7606
|
authData: {
|
|
7590
7607
|
bcToken: e,
|
|
@@ -7595,7 +7612,7 @@ class Xa {
|
|
|
7595
7612
|
Authorization: `Bearer ${e}`
|
|
7596
7613
|
}
|
|
7597
7614
|
}), i = Ee(
|
|
7598
|
-
|
|
7615
|
+
ct,
|
|
7599
7616
|
r.authorization
|
|
7600
7617
|
)?.result?.token;
|
|
7601
7618
|
if (!i)
|
|
@@ -7606,13 +7623,13 @@ class Xa {
|
|
|
7606
7623
|
console.debug("[B2BClient] Requesting company ID with customer JWT");
|
|
7607
7624
|
const r = await this.request(
|
|
7608
7625
|
{
|
|
7609
|
-
document:
|
|
7626
|
+
document: Yr,
|
|
7610
7627
|
requestHeaders: {
|
|
7611
7628
|
Authorization: `Bearer ${e}`
|
|
7612
7629
|
}
|
|
7613
7630
|
},
|
|
7614
7631
|
-1
|
|
7615
|
-
), i = Ee(
|
|
7632
|
+
), i = Ee(Kt, r.currentUser)?.companyInfo?.companyId;
|
|
7616
7633
|
if (!i)
|
|
7617
7634
|
throw new Error("No company ID returned from current user query");
|
|
7618
7635
|
return console.debug("[B2BClient] Received company ID", i), Number(i);
|
|
@@ -7622,7 +7639,7 @@ class Xa {
|
|
|
7622
7639
|
return [];
|
|
7623
7640
|
try {
|
|
7624
7641
|
const r = (await this.request({
|
|
7625
|
-
document:
|
|
7642
|
+
document: Zr,
|
|
7626
7643
|
variables: {
|
|
7627
7644
|
companyId: this.companyId
|
|
7628
7645
|
},
|
|
@@ -7631,7 +7648,7 @@ class Xa {
|
|
|
7631
7648
|
}
|
|
7632
7649
|
}))?.addresses?.edges;
|
|
7633
7650
|
return r ? r.map(
|
|
7634
|
-
(n) =>
|
|
7651
|
+
(n) => xn(n.node)
|
|
7635
7652
|
) : [];
|
|
7636
7653
|
} catch (e) {
|
|
7637
7654
|
return console.info(
|
|
@@ -7645,7 +7662,7 @@ class Xa {
|
|
|
7645
7662
|
throw new Error("B2B client is not available");
|
|
7646
7663
|
try {
|
|
7647
7664
|
const n = (await this.request({
|
|
7648
|
-
document:
|
|
7665
|
+
document: Xr,
|
|
7649
7666
|
variables: {
|
|
7650
7667
|
cartData: {
|
|
7651
7668
|
cartId: e
|
|
@@ -7672,11 +7689,11 @@ function ei(t) {
|
|
|
7672
7689
|
`[createB2BClient] Initializing B2B client for channelId=${t.channelId}`
|
|
7673
7690
|
), new Xa(t);
|
|
7674
7691
|
}
|
|
7675
|
-
async function
|
|
7692
|
+
async function zi(t) {
|
|
7676
7693
|
let e = null;
|
|
7677
7694
|
try {
|
|
7678
7695
|
const r = await Ne(
|
|
7679
|
-
`/customer/current.jwt?app_client_id=${
|
|
7696
|
+
`/customer/current.jwt?app_client_id=${Gr}`,
|
|
7680
7697
|
{
|
|
7681
7698
|
method: "GET",
|
|
7682
7699
|
credentials: "same-origin",
|
|
@@ -7696,7 +7713,7 @@ async function Hi(t) {
|
|
|
7696
7713
|
console.debug(
|
|
7697
7714
|
"[stencilB2BJwt] Exchanging customer JWT for B2B storefront token"
|
|
7698
7715
|
);
|
|
7699
|
-
const n = await new
|
|
7716
|
+
const n = await new st(Ht, {
|
|
7700
7717
|
fetch: Ne,
|
|
7701
7718
|
credentials: "same-origin",
|
|
7702
7719
|
headers: {
|
|
@@ -7705,7 +7722,7 @@ async function Hi(t) {
|
|
|
7705
7722
|
Authorization: `Bearer ${e}`
|
|
7706
7723
|
}
|
|
7707
7724
|
}).request({
|
|
7708
|
-
document:
|
|
7725
|
+
document: Gt,
|
|
7709
7726
|
variables: {
|
|
7710
7727
|
authData: {
|
|
7711
7728
|
bcToken: e,
|
|
@@ -7713,7 +7730,7 @@ async function Hi(t) {
|
|
|
7713
7730
|
}
|
|
7714
7731
|
}
|
|
7715
7732
|
}), s = Ee(
|
|
7716
|
-
|
|
7733
|
+
ct,
|
|
7717
7734
|
n.authorization
|
|
7718
7735
|
)?.result?.token;
|
|
7719
7736
|
return s ? (console.debug("[stencilB2BJwt] Received B2B storefront token"), s) : null;
|
|
@@ -7748,7 +7765,7 @@ async function ri(t, e) {
|
|
|
7748
7765
|
n = `Failed to clear cart: ${s}`, r(t.toolCallId, s);
|
|
7749
7766
|
}
|
|
7750
7767
|
return {
|
|
7751
|
-
tool:
|
|
7768
|
+
tool: gr,
|
|
7752
7769
|
toolCallId: t.toolCallId,
|
|
7753
7770
|
output: n
|
|
7754
7771
|
};
|
|
@@ -7768,7 +7785,7 @@ function ni(t, e) {
|
|
|
7768
7785
|
totals: e.checkoutTotals
|
|
7769
7786
|
};
|
|
7770
7787
|
return {
|
|
7771
|
-
tool:
|
|
7788
|
+
tool: yr,
|
|
7772
7789
|
toolCallId: t.toolCallId,
|
|
7773
7790
|
output: JSON.stringify(r)
|
|
7774
7791
|
};
|
|
@@ -7779,7 +7796,7 @@ function si(t) {
|
|
|
7779
7796
|
parsedContent: e.parsedContent
|
|
7780
7797
|
};
|
|
7781
7798
|
return {
|
|
7782
|
-
tool:
|
|
7799
|
+
tool: dt,
|
|
7783
7800
|
toolCallId: t.toolCallId,
|
|
7784
7801
|
output: JSON.stringify(r)
|
|
7785
7802
|
};
|
|
@@ -7793,7 +7810,7 @@ async function ai(t, e) {
|
|
|
7793
7810
|
) ?? [];
|
|
7794
7811
|
if (s.length === 0)
|
|
7795
7812
|
return {
|
|
7796
|
-
tool:
|
|
7813
|
+
tool: mr,
|
|
7797
7814
|
toolCallId: t.toolCallId,
|
|
7798
7815
|
output: "Cart item not found."
|
|
7799
7816
|
};
|
|
@@ -7817,7 +7834,7 @@ function ii(t) {
|
|
|
7817
7834
|
(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))
|
|
7818
7835
|
);
|
|
7819
7836
|
return r(i), {
|
|
7820
|
-
tool:
|
|
7837
|
+
tool: br,
|
|
7821
7838
|
toolCallId: t.toolCallId,
|
|
7822
7839
|
output: "Item warnings removed successfully."
|
|
7823
7840
|
};
|
|
@@ -7825,7 +7842,7 @@ function ii(t) {
|
|
|
7825
7842
|
function oi(t) {
|
|
7826
7843
|
const { setItemWarnings: e } = g.getState(), r = t.input;
|
|
7827
7844
|
return r.itemWarnings && e(r.itemWarnings), {
|
|
7828
|
-
tool:
|
|
7845
|
+
tool: xr,
|
|
7829
7846
|
toolCallId: t.toolCallId,
|
|
7830
7847
|
output: "Item warnings set successfully."
|
|
7831
7848
|
};
|
|
@@ -7859,7 +7876,7 @@ async function li(t, e) {
|
|
|
7859
7876
|
} catch (o) {
|
|
7860
7877
|
const c = o instanceof Error ? o.message : "Unknown error";
|
|
7861
7878
|
return r(t.toolCallId, c), {
|
|
7862
|
-
tool:
|
|
7879
|
+
tool: fr,
|
|
7863
7880
|
toolCallId: t.toolCallId,
|
|
7864
7881
|
output: `Failed to update cart item: ${c}`
|
|
7865
7882
|
};
|
|
@@ -7870,7 +7887,7 @@ async function li(t, e) {
|
|
|
7870
7887
|
output: `${s} cart item(s) updated.`
|
|
7871
7888
|
};
|
|
7872
7889
|
}
|
|
7873
|
-
const
|
|
7890
|
+
const Br = {
|
|
7874
7891
|
addToCart: ti,
|
|
7875
7892
|
updateCart: li,
|
|
7876
7893
|
removeFromCart: ai,
|
|
@@ -7880,9 +7897,9 @@ const $r = {
|
|
|
7880
7897
|
setPoMetadata: ci,
|
|
7881
7898
|
setItemWarnings: oi,
|
|
7882
7899
|
removeItemWarnings: ii
|
|
7883
|
-
}, di = new Set(Object.keys(
|
|
7900
|
+
}, di = new Set(Object.keys(Br));
|
|
7884
7901
|
async function ui(t, e) {
|
|
7885
|
-
const r =
|
|
7902
|
+
const r = Br[t.toolName];
|
|
7886
7903
|
return r?.(t, e);
|
|
7887
7904
|
}
|
|
7888
7905
|
function pi(t, e) {
|
|
@@ -7931,7 +7948,7 @@ async function hi(t, e, r) {
|
|
|
7931
7948
|
}
|
|
7932
7949
|
function fi() {
|
|
7933
7950
|
try {
|
|
7934
|
-
const t = localStorage.getItem(
|
|
7951
|
+
const t = localStorage.getItem(ot);
|
|
7935
7952
|
if (!t)
|
|
7936
7953
|
return {
|
|
7937
7954
|
valid: !0,
|
|
@@ -7948,7 +7965,7 @@ function fi() {
|
|
|
7948
7965
|
threadId: null,
|
|
7949
7966
|
cartEntityId: null
|
|
7950
7967
|
};
|
|
7951
|
-
if (r !==
|
|
7968
|
+
if (r !== Qt)
|
|
7952
7969
|
return {
|
|
7953
7970
|
valid: !1,
|
|
7954
7971
|
error: "The app version has changed. Your previous session is not compatible.",
|
|
@@ -7980,7 +7997,7 @@ function fi() {
|
|
|
7980
7997
|
}
|
|
7981
7998
|
function ze() {
|
|
7982
7999
|
try {
|
|
7983
|
-
localStorage.removeItem(
|
|
8000
|
+
localStorage.removeItem(ot);
|
|
7984
8001
|
} catch (t) {
|
|
7985
8002
|
console.error("Failed to clear persisted session:", t);
|
|
7986
8003
|
}
|
|
@@ -8072,7 +8089,7 @@ async function xi(t) {
|
|
|
8072
8089
|
c && e.restoreSession(c), l && e.setBcCart(l), i && e.setCustomerInfo(i), n.length > 0 && e.setCustomerAddresses(n), e.completeValidation();
|
|
8073
8090
|
}
|
|
8074
8091
|
function bi(t) {
|
|
8075
|
-
return
|
|
8092
|
+
return jr(t) && "toolCallId" in t && typeof t.toolCallId == "string" && "output" in t && t.output !== void 0 && "state" in t && t.state === "output-available";
|
|
8076
8093
|
}
|
|
8077
8094
|
function Ci(t) {
|
|
8078
8095
|
return t ? t.filter(bi) : [];
|
|
@@ -8080,7 +8097,7 @@ function Ci(t) {
|
|
|
8080
8097
|
function vi(t) {
|
|
8081
8098
|
return t.type === "dynamic-tool" ? t.toolName ?? "unknown" : t.type.slice(5);
|
|
8082
8099
|
}
|
|
8083
|
-
const Ii = new
|
|
8100
|
+
const Ii = new Lr({
|
|
8084
8101
|
defaultOptions: {
|
|
8085
8102
|
queries: {
|
|
8086
8103
|
staleTime: 300 * 1e3
|
|
@@ -8089,7 +8106,7 @@ const Ii = new Ur({
|
|
|
8089
8106
|
}
|
|
8090
8107
|
});
|
|
8091
8108
|
function wi(t) {
|
|
8092
|
-
return /* @__PURE__ */ a(
|
|
8109
|
+
return /* @__PURE__ */ a(_r, { client: Ii, children: /* @__PURE__ */ a(Ss, { client: t.bigcommerce.client, children: /* @__PURE__ */ a(Si, { ...t }) }) });
|
|
8093
8110
|
}
|
|
8094
8111
|
function Si(t) {
|
|
8095
8112
|
const e = g((s) => s.ui.initStatus), r = g((s) => s.ui.initError), n = g((s) => s.fatalError), i = g((s) => s.clearInitError);
|
|
@@ -8156,7 +8173,7 @@ function Ei({
|
|
|
8156
8173
|
thread: u,
|
|
8157
8174
|
isCreating: m,
|
|
8158
8175
|
createThread: v
|
|
8159
|
-
} =
|
|
8176
|
+
} = Ar({
|
|
8160
8177
|
agentName: e,
|
|
8161
8178
|
createOnMount: !l,
|
|
8162
8179
|
// Only create if no existing thread
|
|
@@ -8183,8 +8200,8 @@ function Ei({
|
|
|
8183
8200
|
oe.current.push(C);
|
|
8184
8201
|
},
|
|
8185
8202
|
[]
|
|
8186
|
-
), L = D(/* @__PURE__ */ new Set()), { messages: W, sendMessage: G, status: K, error: Pe, setMessages: fe, addToolOutput: me } =
|
|
8187
|
-
transport: new
|
|
8203
|
+
), L = D(/* @__PURE__ */ new Set()), { messages: W, sendMessage: G, status: K, error: Pe, setMessages: fe, addToolOutput: me } = Wt({
|
|
8204
|
+
transport: new Vt({
|
|
8188
8205
|
api: `${s}/project/${o}/agents/messages`,
|
|
8189
8206
|
headers: {
|
|
8190
8207
|
Authorization: `Bearer ${c}`
|
|
@@ -8197,14 +8214,14 @@ function Ei({
|
|
|
8197
8214
|
if (se.role === "user" && C.messages.length >= 2) {
|
|
8198
8215
|
const pe = C.messages[C.messages.length - 2], Ze = L.current;
|
|
8199
8216
|
if (pe?.role === "assistant" && Ze.size > 0) {
|
|
8200
|
-
const
|
|
8217
|
+
const ft = Ci(
|
|
8201
8218
|
pe.parts
|
|
8202
8219
|
).filter(
|
|
8203
|
-
(
|
|
8220
|
+
(mt) => Ze.has(mt.toolCallId)
|
|
8204
8221
|
);
|
|
8205
|
-
Ze.clear(),
|
|
8222
|
+
Ze.clear(), ft.length > 0 && (we = [{
|
|
8206
8223
|
...pe,
|
|
8207
|
-
parts:
|
|
8224
|
+
parts: ft.map((Te) => ({
|
|
8208
8225
|
type: Te.type,
|
|
8209
8226
|
toolName: vi(Te),
|
|
8210
8227
|
toolCallId: Te.toolCallId,
|
|
@@ -8241,7 +8258,7 @@ function Ei({
|
|
|
8241
8258
|
}
|
|
8242
8259
|
}), de = M(
|
|
8243
8260
|
(C) => {
|
|
8244
|
-
w.current?.end(), w.current =
|
|
8261
|
+
w.current?.end(), w.current = rt({
|
|
8245
8262
|
name: "po-agent-turn",
|
|
8246
8263
|
op: "ai.agent",
|
|
8247
8264
|
attributes: {
|
|
@@ -8261,7 +8278,7 @@ function Ei({
|
|
|
8261
8278
|
oe.current = [], hi(C, W, $).then(async (se) => {
|
|
8262
8279
|
for (const we of se.outputs)
|
|
8263
8280
|
L.current.add(we.toolCallId), await me(we);
|
|
8264
|
-
se.outputs.length > 0 && de({ text:
|
|
8281
|
+
se.outputs.length > 0 && de({ text: it });
|
|
8265
8282
|
}).catch((se) => {
|
|
8266
8283
|
console.error("[executeDeferredToolCalls] Error:", se);
|
|
8267
8284
|
});
|
|
@@ -8298,7 +8315,7 @@ function Ei({
|
|
|
8298
8315
|
}, qe = (C) => {
|
|
8299
8316
|
C.preventDefault(), d.trim() && (g.getState().sendMessage(d), g.getState().setInput(""));
|
|
8300
8317
|
}, Fe = async (C) => {
|
|
8301
|
-
k.current?.end(), k.current =
|
|
8318
|
+
k.current?.end(), k.current = rt({
|
|
8302
8319
|
name: "upload-to-checkout",
|
|
8303
8320
|
op: "purchase-order.session",
|
|
8304
8321
|
attributes: {
|
|
@@ -8396,15 +8413,15 @@ function Ei({
|
|
|
8396
8413
|
poMetadataSet: Y,
|
|
8397
8414
|
onNewOrder: ye
|
|
8398
8415
|
};
|
|
8399
|
-
return i && N ? /* @__PURE__ */ a(
|
|
8400
|
-
|
|
8416
|
+
return i && N ? /* @__PURE__ */ a(Sn, { children: /* @__PURE__ */ a(Ft, { ...ue, onMinimize: () => T(!1) }) }) : /* @__PURE__ */ a("div", { className: "h-full max-w-[1440px] mx-auto", children: /* @__PURE__ */ a(
|
|
8417
|
+
Ft,
|
|
8401
8418
|
{
|
|
8402
8419
|
...ue,
|
|
8403
8420
|
onExpand: i ? () => T(!0) : void 0
|
|
8404
8421
|
}
|
|
8405
8422
|
) });
|
|
8406
8423
|
}
|
|
8407
|
-
function
|
|
8424
|
+
function Hi({
|
|
8408
8425
|
takeshape: t,
|
|
8409
8426
|
bigcommerce: e,
|
|
8410
8427
|
agentName: r = Qe,
|
|
@@ -8415,7 +8432,7 @@ function Qi({
|
|
|
8415
8432
|
expandOnReady: c
|
|
8416
8433
|
}) {
|
|
8417
8434
|
const l = ee(
|
|
8418
|
-
() =>
|
|
8435
|
+
() => wn({
|
|
8419
8436
|
endpoint: e.endpoint,
|
|
8420
8437
|
storefrontToken: e.storefrontToken,
|
|
8421
8438
|
channelId: e.channelId
|
|
@@ -8432,8 +8449,8 @@ function Qi({
|
|
|
8432
8449
|
takeshape: {
|
|
8433
8450
|
projectId: t.projectId,
|
|
8434
8451
|
apiKey: t.apiKey,
|
|
8435
|
-
origin: t.origin ??
|
|
8436
|
-
sseOrigin: t.sseOrigin ??
|
|
8452
|
+
origin: t.origin ?? Ct,
|
|
8453
|
+
sseOrigin: t.sseOrigin ?? Ct
|
|
8437
8454
|
},
|
|
8438
8455
|
bigcommerce: {
|
|
8439
8456
|
client: l,
|
|
@@ -8445,14 +8462,14 @@ function Qi({
|
|
|
8445
8462
|
);
|
|
8446
8463
|
}
|
|
8447
8464
|
export {
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8465
|
+
Hi as P,
|
|
8466
|
+
ji as S,
|
|
8467
|
+
wn as a,
|
|
8468
|
+
Wi as b,
|
|
8452
8469
|
ei as c,
|
|
8453
8470
|
wi as d,
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8471
|
+
Vi as i,
|
|
8472
|
+
qi as r,
|
|
8473
|
+
zi as s
|
|
8457
8474
|
};
|
|
8458
|
-
//# sourceMappingURL=purchase-order-chat-wrapper-
|
|
8475
|
+
//# sourceMappingURL=purchase-order-chat-wrapper-BVV3Wy6e.js.map
|