@burdenoff/microfe-store 2026.805.1 → 2026.819.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/StoreAdminRoutes.js +27 -27
  2. package/dist/StoreRoot.js +78 -45
  3. package/dist/StoreRoot.js.map +1 -1
  4. package/dist/StoreRoutes.js +163 -85
  5. package/dist/StoreRoutes.js.map +1 -1
  6. package/dist/components/sourcing/SourcingConfirmationDialog.d.ts +15 -0
  7. package/dist/components/sourcing/SourcingConfirmationDialog.js +61 -0
  8. package/dist/components/sourcing/SourcingConfirmationDialog.js.map +1 -0
  9. package/dist/components/sourcing/SourcingUi.d.ts +51 -0
  10. package/dist/components/sourcing/SourcingUi.js +176 -0
  11. package/dist/components/sourcing/SourcingUi.js.map +1 -0
  12. package/dist/generated/global-operations.d.ts +713 -0
  13. package/dist/generated/global-operations.js +557 -175
  14. package/dist/generated/global-operations.js.map +1 -1
  15. package/dist/generated/global-types.d.ts +2152 -2159
  16. package/dist/generated/global-types.js +8 -2
  17. package/dist/generated/global-types.js.map +1 -1
  18. package/dist/hooks/useBackendCart.js +17 -17
  19. package/dist/hooks/useInstallations.js +32 -32
  20. package/dist/hooks/useOrders.js +7 -7
  21. package/dist/hooks/useSourcing.d.ts +319 -0
  22. package/dist/hooks/useSourcing.js +87 -0
  23. package/dist/hooks/useSourcing.js.map +1 -0
  24. package/dist/hooks/useStoreGraphQL.js +163 -163
  25. package/dist/index.js +12 -12
  26. package/dist/pages/AdminDashboardPage.js +132 -132
  27. package/dist/pages/AdminReviewModerationPage.js +55 -55
  28. package/dist/pages/AdminStoresPage.js +95 -95
  29. package/dist/pages/AdminSubmissionsQueuePage.js +297 -297
  30. package/dist/pages/AdminSubmissionsQueuePage.js.map +1 -1
  31. package/dist/pages/AppDetailPage.js +65 -65
  32. package/dist/pages/AppSettingsPage.js +32 -32
  33. package/dist/pages/CartPage.js +66 -66
  34. package/dist/pages/CreateSourcingRequestPage.d.ts +3 -0
  35. package/dist/pages/CreateSourcingRequestPage.js +439 -0
  36. package/dist/pages/CreateSourcingRequestPage.js.map +1 -0
  37. package/dist/pages/InstalledAppsPage.js +15 -15
  38. package/dist/pages/InstalledAppsPage.js.map +1 -1
  39. package/dist/pages/MarketplaceHomePage.js +384 -384
  40. package/dist/pages/MarketplaceHomePage.js.map +1 -1
  41. package/dist/pages/MyLicensesPage.js +39 -39
  42. package/dist/pages/OrderConfirmationPage.js +57 -57
  43. package/dist/pages/OrdersPage.js +3 -3
  44. package/dist/pages/OrdersPage.js.map +1 -1
  45. package/dist/pages/ProductDetailPage.js +6 -6
  46. package/dist/pages/SellerSourcingOffersPage.d.ts +3 -0
  47. package/dist/pages/SellerSourcingOffersPage.js +284 -0
  48. package/dist/pages/SellerSourcingOffersPage.js.map +1 -0
  49. package/dist/pages/SellerSourcingOpportunitiesPage.d.ts +3 -0
  50. package/dist/pages/SellerSourcingOpportunitiesPage.js +272 -0
  51. package/dist/pages/SellerSourcingOpportunitiesPage.js.map +1 -0
  52. package/dist/pages/SellerSourcingOpportunityDetailPage.d.ts +3 -0
  53. package/dist/pages/SellerSourcingOpportunityDetailPage.js +465 -0
  54. package/dist/pages/SellerSourcingOpportunityDetailPage.js.map +1 -0
  55. package/dist/pages/SourcingRequestDetailPage.d.ts +3 -0
  56. package/dist/pages/SourcingRequestDetailPage.js +447 -0
  57. package/dist/pages/SourcingRequestDetailPage.js.map +1 -0
  58. package/dist/pages/SourcingRequestsPage.d.ts +3 -0
  59. package/dist/pages/SourcingRequestsPage.js +272 -0
  60. package/dist/pages/SourcingRequestsPage.js.map +1 -0
  61. package/dist/providers/SourcingAccessProvider.d.ts +21 -0
  62. package/dist/providers/SourcingAccessProvider.js +95 -0
  63. package/dist/providers/SourcingAccessProvider.js.map +1 -0
  64. package/dist/translations/en.d.ts +3 -0
  65. package/dist/translations/en.js +3 -0
  66. package/dist/translations/en.js.map +1 -1
  67. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
- import { useStoreGraphQLWithContext as e } from "./useStoreGraphQLWithContext.js";
2
- import { AddToCartDocument as t, ClearCartDocument as n, CreateStoreOrderDocument as r, GetCartDocument as i, RemoveFromCartDocument as a, UpdateCartItemDocument as o } from "../generated/global-operations.js";
1
+ import { AddToCartDocument as e, ClearCartDocument as t, CreateStoreOrderDocument as n, GetCartDocument as r, RemoveFromCartDocument as i, UpdateCartItemDocument as a } from "../generated/global-operations.js";
2
+ import { useStoreGraphQLWithContext as o } from "./useStoreGraphQLWithContext.js";
3
3
  import { useCallback as s, useEffect as c, useState as l } from "react";
4
4
  import { useApolloClient as u } from "@apollo/client/react";
5
5
  //#region src/hooks/useBackendCart.ts
6
6
  function d() {
7
- let d = u(), { query: f, mutate: p, hasOrganizationContext: m } = e(), [h, g] = l(null), [_, v] = l(!0), [y, b] = l(null), [x, S] = l(!1), [C, w] = l(!1), [T, E] = l(!1), [D, O] = l(!1), [k, A] = l(!1), j = s(async (e = !1) => {
7
+ let d = u(), { query: f, mutate: p, hasOrganizationContext: m } = o(), [h, g] = l(null), [_, v] = l(!0), [y, b] = l(null), [x, S] = l(!1), [C, w] = l(!1), [T, E] = l(!1), [D, O] = l(!1), [k, A] = l(!1), j = s(async (e = !1) => {
8
8
  v(!0), b(null);
9
9
  try {
10
10
  g(m ? (await f({
11
- query: i,
11
+ query: r,
12
12
  fetchPolicy: e ? "network-only" : "cache-first"
13
13
  })).data?.myCart || null : (await d.query({
14
- query: i,
14
+ query: r,
15
15
  fetchPolicy: e ? "network-only" : "cache-first"
16
16
  })).data?.myCart || null);
17
17
  } catch (e) {
@@ -27,17 +27,17 @@ function d() {
27
27
  c(() => {
28
28
  j();
29
29
  }, [j]);
30
- let M = s(async (e) => {
30
+ let M = s(async (t) => {
31
31
  if (!d) throw Error("Global client not initialized");
32
32
  S(!0);
33
33
  try {
34
34
  let n;
35
35
  if (n = m ? await p({
36
- mutation: t,
37
- variables: { input: e }
36
+ mutation: e,
37
+ variables: { input: t }
38
38
  }) : await d.mutate({
39
- mutation: t,
40
- variables: { input: e }
39
+ mutation: e,
40
+ variables: { input: t }
41
41
  }), n.data?.addToCart.errors && n.data.addToCart.errors.length > 0) throw Error(n.data.addToCart.errors[0].message);
42
42
  return n.data?.addToCart.cart && g(n.data.addToCart.cart), await j(!0), n.data?.addToCart.cart;
43
43
  } finally {
@@ -54,13 +54,13 @@ function d() {
54
54
  try {
55
55
  let n;
56
56
  if (n = m ? await p({
57
- mutation: o,
57
+ mutation: a,
58
58
  variables: { input: {
59
59
  cartItemId: e,
60
60
  quantity: t
61
61
  } }
62
62
  }) : await d.mutate({
63
- mutation: o,
63
+ mutation: a,
64
64
  variables: { input: {
65
65
  cartItemId: e,
66
66
  quantity: t
@@ -81,10 +81,10 @@ function d() {
81
81
  try {
82
82
  let t;
83
83
  if (t = m ? await p({
84
- mutation: a,
84
+ mutation: i,
85
85
  variables: { cartItemId: e }
86
86
  }) : await d.mutate({
87
- mutation: a,
87
+ mutation: i,
88
88
  variables: { cartItemId: e }
89
89
  }), t.data?.removeFromCart.errors && t.data.removeFromCart.errors.length > 0) throw Error(t.data.removeFromCart.errors[0].message);
90
90
  return t.data?.removeFromCart.cart && g(t.data.removeFromCart.cart), await j(!0), t.data?.removeFromCart.cart;
@@ -100,7 +100,7 @@ function d() {
100
100
  O(!0);
101
101
  try {
102
102
  let e;
103
- if (e = m ? await p({ mutation: n }) : await d.mutate({ mutation: n }), e.data?.clearCart.errors && e.data.clearCart.errors.length > 0) throw Error(e.data.clearCart.errors[0].message);
103
+ if (e = m ? await p({ mutation: t }) : await d.mutate({ mutation: t }), e.data?.clearCart.errors && e.data.clearCart.errors.length > 0) throw Error(e.data.clearCart.errors[0].message);
104
104
  return e.data?.clearCart.cart && g(e.data.clearCart.cart), await j(!0), e.data?.clearCart.cart;
105
105
  } finally {
106
106
  O(!1);
@@ -116,10 +116,10 @@ function d() {
116
116
  try {
117
117
  let t;
118
118
  if (t = m ? await p({
119
- mutation: r,
119
+ mutation: n,
120
120
  variables: { input: e }
121
121
  }) : await d.mutate({
122
- mutation: r,
122
+ mutation: n,
123
123
  variables: { input: e }
124
124
  }), !t.data?.createStoreOrder?.id) throw Error("Failed to create order");
125
125
  return await j(!0), t.data.createStoreOrder;
@@ -1,35 +1,35 @@
1
- import { useStoreGraphQLWithContext as e } from "./useStoreGraphQLWithContext.js";
2
- import { GetMyStoreInstallationsDocument as t, GetStoreAppInstallationDocument as n, RecordAppUninstallationDocument as r } from "../generated/global-operations.js";
1
+ import { GetMyStoreInstallationsDocument as e, GetStoreAppInstallationDocument as t, RecordAppUninstallationDocument as n } from "../generated/global-operations.js";
2
+ import { useStoreGraphQLWithContext as r } from "./useStoreGraphQLWithContext.js";
3
3
  import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
4
4
  import { useApolloClient as c } from "@apollo/client/react";
5
5
  //#region src/hooks/useInstallations.ts
6
- function l(n) {
7
- let { query: l, mutate: u, hasOrganizationContext: d } = e(), f = c(), [p, m] = s([]), [h, g] = s([]), [_, v] = s(0), [y, b] = s(!1), [x, S] = s(n?.offset ?? 0), [C, w] = s(!0), [T, E] = s(null), [D, O] = s(/* @__PURE__ */ new Set()), k = n?.limit ?? 50, A = o(() => ({
6
+ function l(t) {
7
+ let { query: l, mutate: u, hasOrganizationContext: d } = r(), f = c(), [p, m] = s([]), [h, g] = s([]), [_, v] = s(0), [y, b] = s(!1), [x, S] = s(t?.offset ?? 0), [C, w] = s(!0), [T, E] = s(null), [D, O] = s(/* @__PURE__ */ new Set()), k = t?.limit ?? 50, A = o(() => ({
8
8
  limit: k,
9
- offset: n?.offset ?? 0,
10
- filter: n?.filter
9
+ offset: t?.offset ?? 0,
10
+ filter: t?.filter
11
11
  }), [
12
12
  k,
13
- n?.offset,
14
- n?.filter
15
- ]), j = i(async (e = 0, n = !1) => {
13
+ t?.offset,
14
+ t?.filter
15
+ ]), j = i(async (t = 0, n = !1) => {
16
16
  w(!0), E(null);
17
17
  try {
18
18
  let r = {
19
19
  ...A,
20
- offset: e
20
+ offset: t
21
21
  }, i;
22
22
  i = d ? await l({
23
- query: t,
23
+ query: e,
24
24
  variables: r,
25
25
  fetchPolicy: "network-only"
26
26
  }) : await f.query({
27
- query: t,
27
+ query: e,
28
28
  variables: r,
29
29
  fetchPolicy: "network-only"
30
30
  });
31
31
  let a = i.data?.myStoreAppInstallations?.items ?? [], o = i.data?.myStoreAppInstallations?.hasMore ?? !1;
32
- g(n ? (e) => [...e, ...a] : a), m(a), v(i.data?.myStoreAppInstallations?.total ?? 0), b(o), S(e);
32
+ g(n ? (e) => [...e, ...a] : a), m(a), v(i.data?.myStoreAppInstallations?.total ?? 0), b(o), S(t);
33
33
  } catch (e) {
34
34
  E(e);
35
35
  } finally {
@@ -61,31 +61,31 @@ function l(n) {
61
61
  k
62
62
  ]),
63
63
  uninstall: i(async (e, t) => {
64
- let n = `${e.workspaceId}:${e.productId}`;
65
- O((e) => new Set(e).add(n));
64
+ let r = `${e.workspaceId}:${e.productId}`;
65
+ O((e) => new Set(e).add(r));
66
66
  try {
67
67
  let t;
68
68
  t = d ? await u({
69
- mutation: r,
69
+ mutation: n,
70
70
  variables: {
71
71
  workspaceId: e.workspaceId,
72
72
  productId: e.productId
73
73
  }
74
74
  }) : await f.mutate({
75
- mutation: r,
75
+ mutation: n,
76
76
  variables: {
77
77
  workspaceId: e.workspaceId,
78
78
  productId: e.productId
79
79
  }
80
80
  });
81
- let n = !!t.data?.recordAppUninstallation?.id;
82
- return n && await j(), n;
81
+ let r = !!t.data?.recordAppUninstallation?.id;
82
+ return r && await j(), r;
83
83
  } catch {
84
84
  return !1;
85
85
  } finally {
86
86
  O((e) => {
87
87
  let t = new Set(e);
88
- return t.delete(n), t;
88
+ return t.delete(r), t;
89
89
  });
90
90
  }
91
91
  }, [
@@ -96,24 +96,24 @@ function l(n) {
96
96
  ])
97
97
  };
98
98
  }
99
- function u(t) {
100
- let { query: r, hasOrganizationContext: o } = e(), l = c(), [u, d] = s(null), [f, p] = s(!!t), [m, h] = s(null), g = i(async () => {
101
- if (!t) {
99
+ function u(e) {
100
+ let { query: n, hasOrganizationContext: o } = r(), l = c(), [u, d] = s(null), [f, p] = s(!!e), [m, h] = s(null), g = i(async () => {
101
+ if (!e) {
102
102
  d(null), p(!1);
103
103
  return;
104
104
  }
105
105
  p(!0), h(null);
106
106
  try {
107
- let e;
108
- e = o ? await r({
109
- query: n,
110
- variables: { id: t },
107
+ let r;
108
+ r = o ? await n({
109
+ query: t,
110
+ variables: { id: e },
111
111
  fetchPolicy: "network-only"
112
112
  }) : await l.query({
113
- query: n,
114
- variables: { id: t },
113
+ query: t,
114
+ variables: { id: e },
115
115
  fetchPolicy: "network-only"
116
- }), d(e.data?.storeAppInstallation ?? null);
116
+ }), d(r.data?.storeAppInstallation ?? null);
117
117
  } catch (e) {
118
118
  h(e);
119
119
  } finally {
@@ -122,8 +122,8 @@ function u(t) {
122
122
  }, [
123
123
  l,
124
124
  o,
125
- t,
126
- r
125
+ e,
126
+ n
127
127
  ]);
128
128
  return a(() => {
129
129
  g();
@@ -1,24 +1,24 @@
1
- import { useStoreGraphQLWithContext as e } from "./useStoreGraphQLWithContext.js";
2
- import { GetMyOrdersDocument as t } from "../generated/global-operations.js";
1
+ import { GetMyOrdersDocument as e } from "../generated/global-operations.js";
2
+ import { useStoreGraphQLWithContext as t } from "./useStoreGraphQLWithContext.js";
3
3
  import { useCallback as n, useEffect as r, useState as i } from "react";
4
4
  import { useApolloClient as a } from "@apollo/client/react";
5
5
  //#region src/hooks/useOrders.ts
6
6
  var o = 20;
7
7
  function s(s) {
8
- let { query: c, hasOrganizationContext: l } = e(), u = a(), d = s?.limit ?? o, [f, p] = i(s?.offset ?? 0), [m] = i(s?.status), [h, g] = i([]), [_, v] = i(!1), [y, b] = i(!0), [x, S] = i(null), C = n(async (e = 0, n = !1) => {
8
+ let { query: c, hasOrganizationContext: l } = t(), u = a(), d = s?.limit ?? o, [f, p] = i(s?.offset ?? 0), [m] = i(s?.status), [h, g] = i([]), [_, v] = i(!1), [y, b] = i(!0), [x, S] = i(null), C = n(async (t = 0, n = !1) => {
9
9
  b(!0), S(null);
10
10
  try {
11
11
  let r = {
12
12
  limit: d,
13
- offset: e,
13
+ offset: t,
14
14
  status: m ?? null
15
15
  }, i;
16
16
  i = l ? await c({
17
- query: t,
17
+ query: e,
18
18
  variables: r,
19
19
  fetchPolicy: "network-only"
20
20
  }) : await u.query({
21
- query: t,
21
+ query: e,
22
22
  variables: r,
23
23
  fetchPolicy: "network-only"
24
24
  });
@@ -35,7 +35,7 @@ function s(s) {
35
35
  lineItems: t
36
36
  };
37
37
  });
38
- g(n ? (e) => [...e, ...a] : a), v(a.length === d), p(e);
38
+ g(n ? (e) => [...e, ...a] : a), v(a.length === d), p(t);
39
39
  } catch (e) {
40
40
  S(e), console.error("Failed to fetch orders:", e);
41
41
  } finally {
@@ -0,0 +1,319 @@
1
+ import { AcceptSourcingOfferMutation, BuyerSourcingRequestQuery, BuyerSourcingRequestsQuery, PublisherSourcingAccessQuery, PublisherSourcingProductsQuery, SellerSourcingOffersQuery, SellerSourcingOpportunitiesQuery, SellerSourcingOpportunityQuery } from '../generated/global-operations';
2
+ import { CreateSourcingRequestInput, SourcingOfferStatus, SourcingRequestStatus, UpsertSourcingOfferInput } from '../generated/global-types';
3
+
4
+ export type BuyerSourcingRequestListItem = BuyerSourcingRequestsQuery['mySourcingRequests'][number];
5
+ export type BuyerSourcingRequestDetail = NonNullable<BuyerSourcingRequestQuery['mySourcingRequest']>;
6
+ export type SellerSourcingOpportunity = SellerSourcingOpportunitiesQuery['openSourcingRequests'][number];
7
+ export type SellerSourcingOpportunityDetail = NonNullable<SellerSourcingOpportunityQuery['sourcingOpportunity']>;
8
+ export type SellerSourcingOfferDetail = NonNullable<SellerSourcingOpportunityQuery['mySourcingOffer']>;
9
+ export type SellerSourcingOffer = SellerSourcingOffersQuery['mySourcingOffers'][number];
10
+ export type PublisherSourcingProfile = NonNullable<PublisherSourcingAccessQuery['myPublisher']>;
11
+ export type PublisherSourcingProduct = NonNullable<PublisherSourcingProductsQuery['myPublisher']>['products'][number];
12
+ export type AcceptedSourcingOrder = AcceptSourcingOfferMutation['acceptSourcingOffer'];
13
+ interface PageOptions<TStatus> {
14
+ status?: TStatus;
15
+ limit?: number;
16
+ offset?: number;
17
+ }
18
+ interface OpportunityPageOptions {
19
+ category?: string;
20
+ limit?: number;
21
+ offset?: number;
22
+ }
23
+ /**
24
+ * Typed sourcing operations that always include the shell's active organization context.
25
+ * Sourcing is actor self-scoped and intentionally does not require a workspace context.
26
+ */
27
+ export declare function useSourcingApi(): {
28
+ organizationId: string | undefined;
29
+ hasOrganizationContext: boolean;
30
+ listBuyerRequests: (options?: PageOptions<SourcingRequestStatus>) => Promise<{
31
+ __typename?: "SourcingRequest";
32
+ id: string;
33
+ status: SourcingRequestStatus;
34
+ productName: string;
35
+ category: string;
36
+ quantity: number;
37
+ unit: import('../generated/global-types').SourcingUnit;
38
+ deliveryWindowStart: string;
39
+ deliveryWindowEnd: string;
40
+ deliveryCountry: string;
41
+ deliveryRegion?: string | null;
42
+ deliveryCity?: string | null;
43
+ targetUnitPrice?: string | null;
44
+ targetCurrency?: string | null;
45
+ offers: Array<{
46
+ __typename?: "SourcingOffer";
47
+ status: SourcingOfferStatus;
48
+ }>;
49
+ }[]>;
50
+ getBuyerRequest: (id: string) => Promise<{
51
+ __typename?: "SourcingRequest";
52
+ id: string;
53
+ status: SourcingRequestStatus;
54
+ productName: string;
55
+ category: string;
56
+ summary?: string | null;
57
+ quantity: number;
58
+ unit: import('../generated/global-types').SourcingUnit;
59
+ deliveryWindowStart: string;
60
+ deliveryWindowEnd: string;
61
+ deliveryCountry: string;
62
+ deliveryRegion?: string | null;
63
+ deliveryCity?: string | null;
64
+ targetUnitPrice?: string | null;
65
+ targetCurrency?: string | null;
66
+ matchedAt?: string | null;
67
+ canceledAt?: string | null;
68
+ createdAt: string;
69
+ updatedAt: string;
70
+ offers: Array<{
71
+ __typename?: "SourcingOffer";
72
+ id: string;
73
+ status: SourcingOfferStatus;
74
+ quantity: number;
75
+ unit: import('../generated/global-types').SourcingUnit;
76
+ unitPrice: string;
77
+ currency: string;
78
+ deliveryDate: string;
79
+ message?: string | null;
80
+ createdAt: string;
81
+ publisher?: {
82
+ __typename?: "SourcingPublisherSummary";
83
+ name: string;
84
+ logoUrl?: string | null;
85
+ isVerified: boolean;
86
+ } | null;
87
+ order?: {
88
+ __typename?: "SourcingOrderSummary";
89
+ id: string;
90
+ status: import('../generated/global-types').OrderStatus;
91
+ total: string;
92
+ currency: string;
93
+ fulfillment?: {
94
+ __typename?: "OrderFulfillment";
95
+ status: import('../generated/global-types').FulfillmentStatus;
96
+ } | null;
97
+ } | null;
98
+ }>;
99
+ acceptedOrder?: {
100
+ __typename?: "SourcingOrderSummary";
101
+ id: string;
102
+ status: import('../generated/global-types').OrderStatus;
103
+ total: string;
104
+ currency: string;
105
+ fulfillment?: {
106
+ __typename?: "OrderFulfillment";
107
+ status: import('../generated/global-types').FulfillmentStatus;
108
+ } | null;
109
+ } | null;
110
+ } | null>;
111
+ createBuyerRequest: (input: CreateSourcingRequestInput) => Promise<{
112
+ __typename?: "SourcingRequest";
113
+ id: string;
114
+ status: SourcingRequestStatus;
115
+ productName: string;
116
+ category: string;
117
+ quantity: number;
118
+ unit: import('../generated/global-types').SourcingUnit;
119
+ deliveryWindowStart: string;
120
+ deliveryWindowEnd: string;
121
+ deliveryCountry: string;
122
+ deliveryRegion?: string | null;
123
+ deliveryCity?: string | null;
124
+ targetUnitPrice?: string | null;
125
+ targetCurrency?: string | null;
126
+ createdAt: string;
127
+ updatedAt: string;
128
+ }>;
129
+ cancelBuyerRequest: (id: string) => Promise<{
130
+ __typename?: "SourcingRequest";
131
+ id: string;
132
+ status: SourcingRequestStatus;
133
+ canceledAt?: string | null;
134
+ updatedAt: string;
135
+ }>;
136
+ acceptOffer: (offerId: string) => Promise<{
137
+ __typename?: "SourcingOrderSummary";
138
+ id: string;
139
+ status: import('../generated/global-types').OrderStatus;
140
+ total: string;
141
+ currency: string;
142
+ fulfillment?: {
143
+ __typename?: "OrderFulfillment";
144
+ status: import('../generated/global-types').FulfillmentStatus;
145
+ } | null;
146
+ }>;
147
+ getPublisherAccess: () => Promise<{
148
+ __typename?: "Publisher";
149
+ id: string;
150
+ name: string;
151
+ isVerified: boolean;
152
+ verificationStatus: import('../generated/global-types').PublisherVerificationStatus;
153
+ } | null>;
154
+ getPublisherProducts: () => Promise<{
155
+ __typename?: "StoreProduct";
156
+ id: string;
157
+ name: string;
158
+ status: import('../generated/global-types').ProductStatus;
159
+ }[]>;
160
+ listOpportunities: (options?: OpportunityPageOptions) => Promise<{
161
+ __typename?: "SourcingOpportunity";
162
+ id: string;
163
+ productName: string;
164
+ category: string;
165
+ summary?: string | null;
166
+ quantity: number;
167
+ unit: import('../generated/global-types').SourcingUnit;
168
+ deliveryWindowStart: string;
169
+ deliveryWindowEnd: string;
170
+ deliveryCountry: string;
171
+ deliveryRegion?: string | null;
172
+ deliveryCity?: string | null;
173
+ targetUnitPrice?: string | null;
174
+ targetCurrency?: string | null;
175
+ }[]>;
176
+ getOpportunity: (id: string) => Promise<{
177
+ opportunity: {
178
+ __typename?: "SourcingOpportunity";
179
+ id: string;
180
+ productName: string;
181
+ category: string;
182
+ summary?: string | null;
183
+ quantity: number;
184
+ unit: import('../generated/global-types').SourcingUnit;
185
+ deliveryWindowStart: string;
186
+ deliveryWindowEnd: string;
187
+ deliveryCountry: string;
188
+ deliveryRegion?: string | null;
189
+ deliveryCity?: string | null;
190
+ targetUnitPrice?: string | null;
191
+ targetCurrency?: string | null;
192
+ } | null;
193
+ offer: {
194
+ __typename?: "SourcingOffer";
195
+ id: string;
196
+ requestId: string;
197
+ storeProductId?: string | null;
198
+ status: SourcingOfferStatus;
199
+ quantity: number;
200
+ unit: import('../generated/global-types').SourcingUnit;
201
+ unitPrice: string;
202
+ currency: string;
203
+ deliveryDate: string;
204
+ message?: string | null;
205
+ updatedAt: string;
206
+ request?: {
207
+ __typename?: "SourcingOpportunity";
208
+ id: string;
209
+ productName: string;
210
+ category: string;
211
+ summary?: string | null;
212
+ quantity: number;
213
+ unit: import('../generated/global-types').SourcingUnit;
214
+ deliveryWindowStart: string;
215
+ deliveryWindowEnd: string;
216
+ deliveryCountry: string;
217
+ deliveryRegion?: string | null;
218
+ deliveryCity?: string | null;
219
+ targetUnitPrice?: string | null;
220
+ targetCurrency?: string | null;
221
+ } | null;
222
+ order?: {
223
+ __typename?: "SourcingOrderSummary";
224
+ id: string;
225
+ status: import('../generated/global-types').OrderStatus;
226
+ total: string;
227
+ currency: string;
228
+ fulfillment?: {
229
+ __typename?: "OrderFulfillment";
230
+ status: import('../generated/global-types').FulfillmentStatus;
231
+ } | null;
232
+ } | null;
233
+ } | null;
234
+ isOpen: boolean;
235
+ }>;
236
+ listSellerOffers: (options?: PageOptions<SourcingOfferStatus>) => Promise<{
237
+ __typename?: "SourcingOffer";
238
+ id: string;
239
+ requestId: string;
240
+ storeProductId?: string | null;
241
+ status: SourcingOfferStatus;
242
+ quantity: number;
243
+ unit: import('../generated/global-types').SourcingUnit;
244
+ unitPrice: string;
245
+ currency: string;
246
+ deliveryDate: string;
247
+ message?: string | null;
248
+ updatedAt: string;
249
+ request?: {
250
+ __typename?: "SourcingOpportunity";
251
+ id: string;
252
+ productName: string;
253
+ category: string;
254
+ summary?: string | null;
255
+ quantity: number;
256
+ unit: import('../generated/global-types').SourcingUnit;
257
+ deliveryWindowStart: string;
258
+ deliveryWindowEnd: string;
259
+ deliveryCountry: string;
260
+ deliveryRegion?: string | null;
261
+ deliveryCity?: string | null;
262
+ targetUnitPrice?: string | null;
263
+ targetCurrency?: string | null;
264
+ } | null;
265
+ order?: {
266
+ __typename?: "SourcingOrderSummary";
267
+ id: string;
268
+ status: import('../generated/global-types').OrderStatus;
269
+ total: string;
270
+ currency: string;
271
+ fulfillment?: {
272
+ __typename?: "OrderFulfillment";
273
+ status: import('../generated/global-types').FulfillmentStatus;
274
+ } | null;
275
+ } | null;
276
+ }[]>;
277
+ upsertOffer: (input: UpsertSourcingOfferInput) => Promise<{
278
+ __typename?: "SourcingOffer";
279
+ id: string;
280
+ requestId: string;
281
+ storeProductId?: string | null;
282
+ status: SourcingOfferStatus;
283
+ quantity: number;
284
+ unit: import('../generated/global-types').SourcingUnit;
285
+ unitPrice: string;
286
+ currency: string;
287
+ deliveryDate: string;
288
+ message?: string | null;
289
+ updatedAt: string;
290
+ request?: {
291
+ __typename?: "SourcingOpportunity";
292
+ id: string;
293
+ productName: string;
294
+ category: string;
295
+ summary?: string | null;
296
+ quantity: number;
297
+ unit: import('../generated/global-types').SourcingUnit;
298
+ deliveryWindowStart: string;
299
+ deliveryWindowEnd: string;
300
+ deliveryCountry: string;
301
+ deliveryRegion?: string | null;
302
+ deliveryCity?: string | null;
303
+ targetUnitPrice?: string | null;
304
+ targetCurrency?: string | null;
305
+ } | null;
306
+ order?: {
307
+ __typename?: "SourcingOrderSummary";
308
+ id: string;
309
+ status: import('../generated/global-types').OrderStatus;
310
+ total: string;
311
+ currency: string;
312
+ fulfillment?: {
313
+ __typename?: "OrderFulfillment";
314
+ status: import('../generated/global-types').FulfillmentStatus;
315
+ } | null;
316
+ } | null;
317
+ }>;
318
+ };
319
+ export {};
@@ -0,0 +1,87 @@
1
+ import { AcceptSourcingOfferDocument as e, BuyerSourcingRequestDocument as t, BuyerSourcingRequestsDocument as n, CancelSourcingRequestDocument as r, CreateSourcingRequestDocument as i, PublisherSourcingAccessDocument as a, PublisherSourcingProductsDocument as o, SellerSourcingOffersDocument as s, SellerSourcingOpportunitiesDocument as c, SellerSourcingOpportunityDocument as l, UpsertSourcingOfferDocument as u } from "../generated/global-operations.js";
2
+ import { useStoreGraphQLWithContext as d } from "./useStoreGraphQLWithContext.js";
3
+ import { useCallback as f } from "react";
4
+ //#region src/hooks/useSourcing.ts
5
+ function p(e, t) {
6
+ if (e == null) throw Error(t);
7
+ return e;
8
+ }
9
+ function m() {
10
+ let { query: m, mutate: h, organizationId: g, hasOrganizationContext: _ } = d();
11
+ return {
12
+ organizationId: g,
13
+ hasOrganizationContext: _,
14
+ listBuyerRequests: f(async (e = {}) => (await m({
15
+ query: n,
16
+ variables: {
17
+ status: e.status ?? null,
18
+ limit: e.limit ?? 30,
19
+ offset: e.offset ?? 0
20
+ },
21
+ fetchPolicy: "network-only"
22
+ })).data?.mySourcingRequests ?? [], [m]),
23
+ getBuyerRequest: f(async (e) => (await m({
24
+ query: t,
25
+ variables: { id: e },
26
+ fetchPolicy: "network-only"
27
+ })).data?.mySourcingRequest ?? null, [m]),
28
+ createBuyerRequest: f(async (e) => p((await h({
29
+ mutation: i,
30
+ variables: { input: e }
31
+ })).data?.createSourcingRequest, "The sourcing request was not created."), [h]),
32
+ cancelBuyerRequest: f(async (e) => p((await h({
33
+ mutation: r,
34
+ variables: { id: e }
35
+ })).data?.cancelSourcingRequest, "The sourcing request was not canceled."), [h]),
36
+ acceptOffer: f(async (t) => p((await h({
37
+ mutation: e,
38
+ variables: { offerId: t }
39
+ })).data?.acceptSourcingOffer, "The sourcing offer was not accepted."), [h]),
40
+ getPublisherAccess: f(async () => (await m({
41
+ query: a,
42
+ fetchPolicy: "network-only"
43
+ })).data?.myPublisher ?? null, [m]),
44
+ getPublisherProducts: f(async () => (await m({
45
+ query: o,
46
+ fetchPolicy: "network-only"
47
+ })).data?.myPublisher?.products ?? [], [m]),
48
+ listOpportunities: f(async (e = {}) => (await m({
49
+ query: c,
50
+ variables: {
51
+ category: e.category || null,
52
+ limit: e.limit ?? 30,
53
+ offset: e.offset ?? 0
54
+ },
55
+ fetchPolicy: "network-only"
56
+ })).data?.openSourcingRequests ?? [], [m]),
57
+ getOpportunity: f(async (e) => {
58
+ let t = await m({
59
+ query: l,
60
+ variables: { id: e },
61
+ fetchPolicy: "network-only"
62
+ }), n = t.data?.mySourcingOffer ?? null;
63
+ return {
64
+ opportunity: t.data?.sourcingOpportunity ?? n?.request ?? null,
65
+ offer: n,
66
+ isOpen: !!t.data?.sourcingOpportunity
67
+ };
68
+ }, [m]),
69
+ listSellerOffers: f(async (e = {}) => (await m({
70
+ query: s,
71
+ variables: {
72
+ status: e.status ?? null,
73
+ limit: e.limit ?? 30,
74
+ offset: e.offset ?? 0
75
+ },
76
+ fetchPolicy: "network-only"
77
+ })).data?.mySourcingOffers ?? [], [m]),
78
+ upsertOffer: f(async (e) => p((await h({
79
+ mutation: u,
80
+ variables: { input: e }
81
+ })).data?.upsertSourcingOffer, "The sourcing offer was not saved."), [h])
82
+ };
83
+ }
84
+ //#endregion
85
+ export { m as useSourcingApi };
86
+
87
+ //# sourceMappingURL=useSourcing.js.map