@burdenoff/microfe-store 2026.805.1 → 2026.819.2
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/StoreAdminRoutes.js +27 -27
- package/dist/StoreRoot.js +78 -45
- package/dist/StoreRoot.js.map +1 -1
- package/dist/StoreRoutes.js +163 -85
- package/dist/StoreRoutes.js.map +1 -1
- package/dist/components/sourcing/SourcingConfirmationDialog.d.ts +15 -0
- package/dist/components/sourcing/SourcingConfirmationDialog.js +61 -0
- package/dist/components/sourcing/SourcingConfirmationDialog.js.map +1 -0
- package/dist/components/sourcing/SourcingUi.d.ts +51 -0
- package/dist/components/sourcing/SourcingUi.js +176 -0
- package/dist/components/sourcing/SourcingUi.js.map +1 -0
- package/dist/generated/global-operations.d.ts +713 -0
- package/dist/generated/global-operations.js +557 -175
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +2152 -2159
- package/dist/generated/global-types.js +8 -2
- package/dist/generated/global-types.js.map +1 -1
- package/dist/hooks/useBackendCart.js +17 -17
- package/dist/hooks/useInstallations.js +32 -32
- package/dist/hooks/useOrders.js +7 -7
- package/dist/hooks/useSourcing.d.ts +319 -0
- package/dist/hooks/useSourcing.js +87 -0
- package/dist/hooks/useSourcing.js.map +1 -0
- package/dist/hooks/useStoreGraphQL.js +163 -163
- package/dist/index.js +12 -12
- package/dist/pages/AdminDashboardPage.js +132 -132
- package/dist/pages/AdminReviewModerationPage.js +55 -55
- package/dist/pages/AdminStoresPage.js +95 -95
- package/dist/pages/AdminSubmissionsQueuePage.js +297 -297
- package/dist/pages/AdminSubmissionsQueuePage.js.map +1 -1
- package/dist/pages/AppDetailPage.js +65 -65
- package/dist/pages/AppSettingsPage.js +32 -32
- package/dist/pages/CartPage.js +66 -66
- package/dist/pages/CreateSourcingRequestPage.d.ts +3 -0
- package/dist/pages/CreateSourcingRequestPage.js +439 -0
- package/dist/pages/CreateSourcingRequestPage.js.map +1 -0
- package/dist/pages/InstalledAppsPage.js +15 -15
- package/dist/pages/InstalledAppsPage.js.map +1 -1
- package/dist/pages/MarketplaceHomePage.js +384 -384
- package/dist/pages/MarketplaceHomePage.js.map +1 -1
- package/dist/pages/MyLicensesPage.js +39 -39
- package/dist/pages/OrderConfirmationPage.js +57 -57
- package/dist/pages/OrdersPage.js +3 -3
- package/dist/pages/OrdersPage.js.map +1 -1
- package/dist/pages/ProductDetailPage.js +6 -6
- package/dist/pages/SellerSourcingOffersPage.d.ts +3 -0
- package/dist/pages/SellerSourcingOffersPage.js +284 -0
- package/dist/pages/SellerSourcingOffersPage.js.map +1 -0
- package/dist/pages/SellerSourcingOpportunitiesPage.d.ts +3 -0
- package/dist/pages/SellerSourcingOpportunitiesPage.js +272 -0
- package/dist/pages/SellerSourcingOpportunitiesPage.js.map +1 -0
- package/dist/pages/SellerSourcingOpportunityDetailPage.d.ts +3 -0
- package/dist/pages/SellerSourcingOpportunityDetailPage.js +465 -0
- package/dist/pages/SellerSourcingOpportunityDetailPage.js.map +1 -0
- package/dist/pages/SourcingRequestDetailPage.d.ts +3 -0
- package/dist/pages/SourcingRequestDetailPage.js +447 -0
- package/dist/pages/SourcingRequestDetailPage.js.map +1 -0
- package/dist/pages/SourcingRequestsPage.d.ts +3 -0
- package/dist/pages/SourcingRequestsPage.js +272 -0
- package/dist/pages/SourcingRequestsPage.js.map +1 -0
- package/dist/providers/SourcingAccessProvider.d.ts +21 -0
- package/dist/providers/SourcingAccessProvider.js +95 -0
- package/dist/providers/SourcingAccessProvider.js.map +1 -0
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +3 -0
- package/dist/translations/en.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSourcing.js","names":[],"sources":["../../src/hooks/useSourcing.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n AcceptSourcingOfferDocument,\n BuyerSourcingRequestDocument,\n BuyerSourcingRequestsDocument,\n CancelSourcingRequestDocument,\n CreateSourcingRequestDocument,\n PublisherSourcingAccessDocument,\n PublisherSourcingProductsDocument,\n SellerSourcingOffersDocument,\n SellerSourcingOpportunitiesDocument,\n SellerSourcingOpportunityDocument,\n UpsertSourcingOfferDocument,\n} from '../generated/global-operations';\nimport type {\n AcceptSourcingOfferMutation,\n BuyerSourcingRequestQuery,\n BuyerSourcingRequestsQuery,\n CancelSourcingRequestMutation,\n CreateSourcingRequestMutation,\n PublisherSourcingAccessQuery,\n PublisherSourcingProductsQuery,\n SellerSourcingOffersQuery,\n SellerSourcingOpportunitiesQuery,\n SellerSourcingOpportunityQuery,\n UpsertSourcingOfferMutation,\n} from '../generated/global-operations';\nimport type {\n CreateSourcingRequestInput,\n SourcingOfferStatus,\n SourcingRequestStatus,\n UpsertSourcingOfferInput,\n} from '../generated/global-types';\nimport { useStoreGraphQLWithContext } from './useStoreGraphQLWithContext';\n\nexport type BuyerSourcingRequestListItem = BuyerSourcingRequestsQuery['mySourcingRequests'][number];\nexport type BuyerSourcingRequestDetail = NonNullable<\n BuyerSourcingRequestQuery['mySourcingRequest']\n>;\nexport type SellerSourcingOpportunity =\n SellerSourcingOpportunitiesQuery['openSourcingRequests'][number];\nexport type SellerSourcingOpportunityDetail = NonNullable<\n SellerSourcingOpportunityQuery['sourcingOpportunity']\n>;\nexport type SellerSourcingOfferDetail = NonNullable<\n SellerSourcingOpportunityQuery['mySourcingOffer']\n>;\nexport type SellerSourcingOffer = SellerSourcingOffersQuery['mySourcingOffers'][number];\nexport type PublisherSourcingProfile = NonNullable<PublisherSourcingAccessQuery['myPublisher']>;\nexport type PublisherSourcingProduct = NonNullable<\n PublisherSourcingProductsQuery['myPublisher']\n>['products'][number];\nexport type AcceptedSourcingOrder = AcceptSourcingOfferMutation['acceptSourcingOffer'];\n\ninterface PageOptions<TStatus> {\n status?: TStatus;\n limit?: number;\n offset?: number;\n}\n\ninterface OpportunityPageOptions {\n category?: string;\n limit?: number;\n offset?: number;\n}\n\nfunction requireMutationData<T>(value: T | null | undefined, message: string): T {\n if (value === null || value === undefined) {\n throw new Error(message);\n }\n return value;\n}\n\n/**\n * Typed sourcing operations that always include the shell's active organization context.\n * Sourcing is actor self-scoped and intentionally does not require a workspace context.\n */\nexport function useSourcingApi() {\n const { query, mutate, organizationId, hasOrganizationContext } = useStoreGraphQLWithContext();\n\n const listBuyerRequests = useCallback(\n async (options: PageOptions<SourcingRequestStatus> = {}) => {\n const result = (await query({\n query: BuyerSourcingRequestsDocument,\n variables: {\n status: options.status ?? null,\n limit: options.limit ?? 30,\n offset: options.offset ?? 0,\n },\n fetchPolicy: 'network-only',\n })) as { data?: BuyerSourcingRequestsQuery };\n return result.data?.mySourcingRequests ?? [];\n },\n [query]\n );\n\n const getBuyerRequest = useCallback(\n async (id: string) => {\n const result = (await query({\n query: BuyerSourcingRequestDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n })) as { data?: BuyerSourcingRequestQuery };\n return result.data?.mySourcingRequest ?? null;\n },\n [query]\n );\n\n const createBuyerRequest = useCallback(\n async (input: CreateSourcingRequestInput) => {\n const result = await mutate<CreateSourcingRequestMutation>({\n mutation: CreateSourcingRequestDocument,\n variables: { input },\n });\n return requireMutationData(\n result.data?.createSourcingRequest,\n 'The sourcing request was not created.'\n );\n },\n [mutate]\n );\n\n const cancelBuyerRequest = useCallback(\n async (id: string) => {\n const result = await mutate<CancelSourcingRequestMutation>({\n mutation: CancelSourcingRequestDocument,\n variables: { id },\n });\n return requireMutationData(\n result.data?.cancelSourcingRequest,\n 'The sourcing request was not canceled.'\n );\n },\n [mutate]\n );\n\n const acceptOffer = useCallback(\n async (offerId: string) => {\n const result = await mutate<AcceptSourcingOfferMutation>({\n mutation: AcceptSourcingOfferDocument,\n variables: { offerId },\n });\n return requireMutationData(\n result.data?.acceptSourcingOffer,\n 'The sourcing offer was not accepted.'\n );\n },\n [mutate]\n );\n\n const getPublisherAccess = useCallback(async () => {\n const result = (await query({\n query: PublisherSourcingAccessDocument,\n fetchPolicy: 'network-only',\n })) as { data?: PublisherSourcingAccessQuery };\n return result.data?.myPublisher ?? null;\n }, [query]);\n\n const getPublisherProducts = useCallback(async () => {\n const result = (await query({\n query: PublisherSourcingProductsDocument,\n fetchPolicy: 'network-only',\n })) as { data?: PublisherSourcingProductsQuery };\n return result.data?.myPublisher?.products ?? [];\n }, [query]);\n\n const listOpportunities = useCallback(\n async (options: OpportunityPageOptions = {}) => {\n const result = (await query({\n query: SellerSourcingOpportunitiesDocument,\n variables: {\n category: options.category || null,\n limit: options.limit ?? 30,\n offset: options.offset ?? 0,\n },\n fetchPolicy: 'network-only',\n })) as { data?: SellerSourcingOpportunitiesQuery };\n return result.data?.openSourcingRequests ?? [];\n },\n [query]\n );\n\n const getOpportunity = useCallback(\n async (id: string) => {\n const result = (await query({\n query: SellerSourcingOpportunityDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n })) as { data?: SellerSourcingOpportunityQuery };\n const offer = result.data?.mySourcingOffer ?? null;\n return {\n opportunity: result.data?.sourcingOpportunity ?? offer?.request ?? null,\n offer,\n isOpen: Boolean(result.data?.sourcingOpportunity),\n };\n },\n [query]\n );\n\n const listSellerOffers = useCallback(\n async (options: PageOptions<SourcingOfferStatus> = {}) => {\n const result = (await query({\n query: SellerSourcingOffersDocument,\n variables: {\n status: options.status ?? null,\n limit: options.limit ?? 30,\n offset: options.offset ?? 0,\n },\n fetchPolicy: 'network-only',\n })) as { data?: SellerSourcingOffersQuery };\n return result.data?.mySourcingOffers ?? [];\n },\n [query]\n );\n\n const upsertOffer = useCallback(\n async (input: UpsertSourcingOfferInput) => {\n const result = await mutate<UpsertSourcingOfferMutation>({\n mutation: UpsertSourcingOfferDocument,\n variables: { input },\n });\n return requireMutationData(\n result.data?.upsertSourcingOffer,\n 'The sourcing offer was not saved.'\n );\n },\n [mutate]\n );\n\n return {\n organizationId,\n hasOrganizationContext,\n listBuyerRequests,\n getBuyerRequest,\n createBuyerRequest,\n cancelBuyerRequest,\n acceptOffer,\n getPublisherAccess,\n getPublisherProducts,\n listOpportunities,\n getOpportunity,\n listSellerOffers,\n upsertOffer,\n };\n}\n"],"mappings":";;;;AAkEA,SAAS,EAAuB,GAA6B,GAAoB;AAC/E,KAAI,KAAU,KACZ,OAAU,MAAM,EAAQ;AAE1B,QAAO;;AAOT,SAAgB,IAAiB;CAC/B,IAAM,EAAE,UAAO,WAAQ,mBAAgB,8BAA2B,GAA4B;AAuJ9F,QAAO;EACL;EACA;EACA,mBAxJwB,EACxB,OAAO,IAA8C,EAAE,MACrC,MAAM,EAAM;GAC1B,OAAO;GACP,WAAW;IACT,QAAQ,EAAQ,UAAU;IAC1B,OAAO,EAAQ,SAAS;IACxB,QAAQ,EAAQ,UAAU;IAC3B;GACD,aAAa;GACd,CAAC,EACY,MAAM,sBAAsB,EAAE,EAE9C,CAAC,EAAM,CACR;EA2IC,iBAzIsB,EACtB,OAAO,OACW,MAAM,EAAM;GAC1B,OAAO;GACP,WAAW,EAAE,OAAI;GACjB,aAAa;GACd,CAAC,EACY,MAAM,qBAAqB,MAE3C,CAAC,EAAM,CACR;EAgIC,oBA9HyB,EACzB,OAAO,MAKE,GAJQ,MAAM,EAAsC;GACzD,UAAU;GACV,WAAW,EAAE,UAAO;GACrB,CAAC,EAEO,MAAM,uBACb,wCACD,EAEH,CAAC,EAAO,CACT;EAmHC,oBAjHyB,EACzB,OAAO,MAKE,GAJQ,MAAM,EAAsC;GACzD,UAAU;GACV,WAAW,EAAE,OAAI;GAClB,CAAC,EAEO,MAAM,uBACb,yCACD,EAEH,CAAC,EAAO,CACT;EAsGC,aApGkB,EAClB,OAAO,MAKE,GAJQ,MAAM,EAAoC;GACvD,UAAU;GACV,WAAW,EAAE,YAAS;GACvB,CAAC,EAEO,MAAM,qBACb,uCACD,EAEH,CAAC,EAAO,CACT;EAyFC,oBAvFyB,EAAY,aACrB,MAAM,EAAM;GAC1B,OAAO;GACP,aAAa;GACd,CAAC,EACY,MAAM,eAAe,MAClC,CAAC,EAAM,CAAC;EAkFT,sBAhF2B,EAAY,aACvB,MAAM,EAAM;GAC1B,OAAO;GACP,aAAa;GACd,CAAC,EACY,MAAM,aAAa,YAAY,EAAE,EAC9C,CAAC,EAAM,CAAC;EA2ET,mBAzEwB,EACxB,OAAO,IAAkC,EAAE,MACzB,MAAM,EAAM;GAC1B,OAAO;GACP,WAAW;IACT,UAAU,EAAQ,YAAY;IAC9B,OAAO,EAAQ,SAAS;IACxB,QAAQ,EAAQ,UAAU;IAC3B;GACD,aAAa;GACd,CAAC,EACY,MAAM,wBAAwB,EAAE,EAEhD,CAAC,EAAM,CACR;EA4DC,gBA1DqB,EACrB,OAAO,MAAe;GACpB,IAAM,IAAU,MAAM,EAAM;IAC1B,OAAO;IACP,WAAW,EAAE,OAAI;IACjB,aAAa;IACd,CAAC,EACI,IAAQ,EAAO,MAAM,mBAAmB;AAC9C,UAAO;IACL,aAAa,EAAO,MAAM,uBAAuB,GAAO,WAAW;IACnE;IACA,QAAQ,EAAQ,EAAO,MAAM;IAC9B;KAEH,CAAC,EAAM,CACR;EA4CC,kBA1CuB,EACvB,OAAO,IAA4C,EAAE,MACnC,MAAM,EAAM;GAC1B,OAAO;GACP,WAAW;IACT,QAAQ,EAAQ,UAAU;IAC1B,OAAO,EAAQ,SAAS;IACxB,QAAQ,EAAQ,UAAU;IAC3B;GACD,aAAa;GACd,CAAC,EACY,MAAM,oBAAoB,EAAE,EAE5C,CAAC,EAAM,CACR;EA6BC,aA3BkB,EAClB,OAAO,MAKE,GAJQ,MAAM,EAAoC;GACvD,UAAU;GACV,WAAW,EAAE,UAAO;GACrB,CAAC,EAEO,MAAM,qBACb,oCACD,EAEH,CAAC,EAAO,CACT;EAgBA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useStore as e } from "../providers/StoreProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { BrowseStoreDocument as t, CategoriesDocument as n, CheckEntitlementDocument as r, CreateReviewDocument as i, DeleteReviewDocument as a, FeaturedProductsDocument as o, FilterOptionsDocument as s, HomeGroupedProductsDocument as c, MarkReviewHelpfulDocument as l, MyEntitlementsDocument as u, ProductReviewsDocument as d, SearchSuggestionsDocument as f, StoreProductDetailsDocument as p, TrendingSearchesDocument as m, UpdateReviewDocument as h, UserReviewForProductDocument as g, WorkspaceStoreOrdersDocument as _ } from "../generated/global-operations.js";
|
|
3
|
+
import { useStoreGraphQLWithContext as v } from "./useStoreGraphQLWithContext.js";
|
|
4
4
|
import { useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
5
5
|
import { useApolloClient as w } from "@apollo/client/react";
|
|
6
6
|
//#region src/hooks/useStoreGraphQL.ts
|
|
@@ -8,11 +8,11 @@ function T() {
|
|
|
8
8
|
return w();
|
|
9
9
|
}
|
|
10
10
|
function E(e = {}) {
|
|
11
|
-
let
|
|
11
|
+
let n = T(), [r, i] = C([]), [a, o] = C(0), [s, c] = C(!1), [l, u] = C(void 0), [d, f] = C(!0), [p, m] = C(null), h = JSON.stringify(e), g = y(async () => {
|
|
12
12
|
f(!0), m(null);
|
|
13
13
|
try {
|
|
14
|
-
let e = await
|
|
15
|
-
query:
|
|
14
|
+
let e = await n.query({
|
|
15
|
+
query: t,
|
|
16
16
|
variables: { input: JSON.parse(h) },
|
|
17
17
|
fetchPolicy: "network-only"
|
|
18
18
|
});
|
|
@@ -22,7 +22,7 @@ function E(e = {}) {
|
|
|
22
22
|
} finally {
|
|
23
23
|
f(!1);
|
|
24
24
|
}
|
|
25
|
-
}, [
|
|
25
|
+
}, [n, h]);
|
|
26
26
|
return b(() => {
|
|
27
27
|
g();
|
|
28
28
|
}, [g]), {
|
|
@@ -35,20 +35,20 @@ function E(e = {}) {
|
|
|
35
35
|
refetch: g
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function D(
|
|
39
|
-
let { query:
|
|
40
|
-
if (!
|
|
41
|
-
let e = { ...
|
|
42
|
-
return e.filter ? (e.filter = { ...e.filter }, e.filter.compatibleWith || (e.filter.compatibleWith =
|
|
43
|
-
}, [
|
|
38
|
+
function D(n = {}, r) {
|
|
39
|
+
let { query: i, hasOrganizationContext: a } = v(), o = w(), { defaultCompatibleWith: s } = e(), [c, l] = C([]), [u, d] = C(0), [f, p] = C(!1), [m, h] = C(void 0), [g, _] = C(!r?.skip), [T, E] = C(null), [D, O] = C(n.pagination?.offset ?? 0), k = r?.skip, A = x(() => {
|
|
40
|
+
if (!s) return n;
|
|
41
|
+
let e = { ...n };
|
|
42
|
+
return e.filter ? (e.filter = { ...e.filter }, e.filter.compatibleWith || (e.filter.compatibleWith = s)) : e.filter = { compatibleWith: s }, e;
|
|
43
|
+
}, [n, s]), j = x(() => {
|
|
44
44
|
let { pagination: e, ...t } = A;
|
|
45
45
|
return JSON.stringify(t);
|
|
46
|
-
}, [A]), M =
|
|
46
|
+
}, [A]), M = n.pagination?.limit ?? 30, N = y(async (e, n) => {
|
|
47
47
|
if (k) {
|
|
48
|
-
|
|
48
|
+
_(!1);
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
_(!0), E(null);
|
|
52
52
|
try {
|
|
53
53
|
let r = {
|
|
54
54
|
...JSON.parse(j),
|
|
@@ -57,63 +57,63 @@ function D(r = {}, i) {
|
|
|
57
57
|
limit: M,
|
|
58
58
|
offset: e
|
|
59
59
|
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
query:
|
|
60
|
+
}, s;
|
|
61
|
+
s = a ? await i({
|
|
62
|
+
query: t,
|
|
63
63
|
variables: { input: r },
|
|
64
64
|
fetchPolicy: "network-only"
|
|
65
|
-
}) : await
|
|
66
|
-
query:
|
|
65
|
+
}) : await o.query({
|
|
66
|
+
query: t,
|
|
67
67
|
variables: { input: r },
|
|
68
68
|
fetchPolicy: "network-only"
|
|
69
69
|
});
|
|
70
|
-
let c =
|
|
71
|
-
|
|
70
|
+
let c = s.data?.browseStore?.products ?? [];
|
|
71
|
+
l(n ? (e) => [...e, ...c] : c), d(s.data?.browseStore?.totalCount ?? 0), p(s.data?.browseStore?.hasMore ?? !1), h(s.data?.browseStore?.facets), O(e + c.length);
|
|
72
72
|
} catch (e) {
|
|
73
73
|
E(e);
|
|
74
74
|
} finally {
|
|
75
|
-
|
|
75
|
+
_(!1);
|
|
76
76
|
}
|
|
77
77
|
}, [
|
|
78
|
-
|
|
79
|
-
s,
|
|
78
|
+
i,
|
|
80
79
|
o,
|
|
80
|
+
a,
|
|
81
81
|
j,
|
|
82
82
|
k,
|
|
83
83
|
M,
|
|
84
84
|
A.pagination
|
|
85
85
|
]), P = S(N);
|
|
86
86
|
P.current = N;
|
|
87
|
-
let F = S(
|
|
88
|
-
return F.current =
|
|
87
|
+
let F = S(n.pagination?.offset ?? 0);
|
|
88
|
+
return F.current = n.pagination?.offset ?? 0, b(() => {
|
|
89
89
|
P.current(F.current, !1);
|
|
90
90
|
}, [j, k]), {
|
|
91
|
-
products:
|
|
92
|
-
totalCount:
|
|
93
|
-
hasMore:
|
|
94
|
-
facets:
|
|
95
|
-
loading:
|
|
91
|
+
products: c,
|
|
92
|
+
totalCount: u,
|
|
93
|
+
hasMore: f,
|
|
94
|
+
facets: m,
|
|
95
|
+
loading: g,
|
|
96
96
|
error: T,
|
|
97
|
-
refetch: () => N(
|
|
97
|
+
refetch: () => N(n.pagination?.offset ?? 0, !1),
|
|
98
98
|
loadMore: y(() => {
|
|
99
|
-
!
|
|
99
|
+
!f || g || N(D, !0);
|
|
100
100
|
}, [
|
|
101
101
|
N,
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
f,
|
|
103
|
+
g,
|
|
104
104
|
D
|
|
105
105
|
])
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
function O() {
|
|
109
|
-
let e = T(), [
|
|
109
|
+
let e = T(), [n, r] = C([]), [i, a] = C(0), [o, s] = C(!1), [c, l] = C(void 0), [u, d] = C(!1), [f, p] = C(null);
|
|
110
110
|
return {
|
|
111
|
-
browseStore: y(async (
|
|
111
|
+
browseStore: y(async (n = {}) => {
|
|
112
112
|
d(!0), p(null);
|
|
113
113
|
try {
|
|
114
114
|
let i = (await e.query({
|
|
115
|
-
query:
|
|
116
|
-
variables: { input:
|
|
115
|
+
query: t,
|
|
116
|
+
variables: { input: n },
|
|
117
117
|
fetchPolicy: "network-only"
|
|
118
118
|
})).data?.browseStore;
|
|
119
119
|
return r(i?.products ?? []), a(i?.totalCount ?? 0), s(i?.hasMore ?? !1), l(i?.facets), i;
|
|
@@ -123,7 +123,7 @@ function O() {
|
|
|
123
123
|
d(!1);
|
|
124
124
|
}
|
|
125
125
|
}, [e]),
|
|
126
|
-
products:
|
|
126
|
+
products: n,
|
|
127
127
|
totalCount: i,
|
|
128
128
|
hasMore: o,
|
|
129
129
|
facets: c,
|
|
@@ -132,76 +132,76 @@ function O() {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
function k(e) {
|
|
135
|
-
let { query:
|
|
136
|
-
if (
|
|
137
|
-
|
|
135
|
+
let { query: t, hasOrganizationContext: n } = v(), r = w(), [i, a] = C(null), [o, s] = C(!0), [c, l] = C(null), u = !e.id && !e.slug, d = JSON.stringify(e), f = S(null), m = y(async () => {
|
|
136
|
+
if (u) {
|
|
137
|
+
s(!1);
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
if (
|
|
141
|
-
|
|
140
|
+
if (f.current !== d) {
|
|
141
|
+
f.current = d, s(!0), l(null);
|
|
142
142
|
try {
|
|
143
|
-
|
|
144
|
-
query:
|
|
145
|
-
variables: { input: JSON.parse(
|
|
143
|
+
a((n ? await t({
|
|
144
|
+
query: p,
|
|
145
|
+
variables: { input: JSON.parse(d) },
|
|
146
146
|
fetchPolicy: "network-only"
|
|
147
|
-
}) : await
|
|
148
|
-
query:
|
|
149
|
-
variables: { input: JSON.parse(
|
|
147
|
+
}) : await r.query({
|
|
148
|
+
query: p,
|
|
149
|
+
variables: { input: JSON.parse(d) },
|
|
150
150
|
fetchPolicy: "network-only"
|
|
151
151
|
})).data?.storeProductDetails ?? null);
|
|
152
152
|
} catch (e) {
|
|
153
|
-
|
|
153
|
+
l(e);
|
|
154
154
|
} finally {
|
|
155
|
-
|
|
155
|
+
s(!1);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
}, [
|
|
159
|
-
i,
|
|
160
159
|
r,
|
|
161
|
-
f,
|
|
162
160
|
n,
|
|
163
|
-
d
|
|
161
|
+
d,
|
|
162
|
+
t,
|
|
163
|
+
u
|
|
164
164
|
]);
|
|
165
165
|
return b(() => {
|
|
166
|
-
|
|
167
|
-
}, [
|
|
168
|
-
data:
|
|
169
|
-
loading:
|
|
170
|
-
error:
|
|
171
|
-
refetch: () => (
|
|
166
|
+
m();
|
|
167
|
+
}, [m]), {
|
|
168
|
+
data: i,
|
|
169
|
+
loading: o,
|
|
170
|
+
error: c,
|
|
171
|
+
refetch: () => (f.current = null, m())
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
function A() {
|
|
175
|
-
let { query: e, hasOrganizationContext:
|
|
175
|
+
let { query: e, hasOrganizationContext: t } = v(), n = w(), [r, i] = C(null), [a, o] = C(!1), [s, c] = C(null);
|
|
176
176
|
return {
|
|
177
|
-
getProductDetails: y(async (
|
|
178
|
-
|
|
177
|
+
getProductDetails: y(async (r) => {
|
|
178
|
+
o(!0), c(null);
|
|
179
179
|
try {
|
|
180
|
-
let
|
|
181
|
-
query:
|
|
182
|
-
variables: { input:
|
|
183
|
-
}) : await
|
|
184
|
-
query:
|
|
185
|
-
variables: { input:
|
|
180
|
+
let a = (t ? await e({
|
|
181
|
+
query: p,
|
|
182
|
+
variables: { input: r }
|
|
183
|
+
}) : await n.query({
|
|
184
|
+
query: p,
|
|
185
|
+
variables: { input: r }
|
|
186
186
|
})).data?.storeProductDetails ?? null;
|
|
187
|
-
return a
|
|
187
|
+
return i(a), a;
|
|
188
188
|
} catch (e) {
|
|
189
|
-
return
|
|
189
|
+
return c(e), null;
|
|
190
190
|
} finally {
|
|
191
|
-
|
|
191
|
+
o(!1);
|
|
192
192
|
}
|
|
193
193
|
}, [
|
|
194
|
-
r,
|
|
195
194
|
n,
|
|
195
|
+
t,
|
|
196
196
|
e
|
|
197
197
|
]),
|
|
198
|
-
data:
|
|
199
|
-
loading:
|
|
200
|
-
error:
|
|
198
|
+
data: r,
|
|
199
|
+
loading: a,
|
|
200
|
+
error: s
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
function j(t) {
|
|
204
|
-
let n = T(), { defaultCompatibleWith: r } = e(), [i, a] = C(null), [o, s] = C(!t?.skip), [
|
|
204
|
+
let n = T(), { defaultCompatibleWith: r } = e(), [i, a] = C(null), [o, s] = C(!t?.skip), [l, u] = C(null), d = t?.skip, f = y(async () => {
|
|
205
205
|
if (d) {
|
|
206
206
|
s(!1);
|
|
207
207
|
return;
|
|
@@ -209,7 +209,7 @@ function j(t) {
|
|
|
209
209
|
s(!0), u(null);
|
|
210
210
|
try {
|
|
211
211
|
a((await n.query({
|
|
212
|
-
query:
|
|
212
|
+
query: c,
|
|
213
213
|
variables: { compatibleWith: r ?? null },
|
|
214
214
|
fetchPolicy: "cache-first"
|
|
215
215
|
})).data?.homeGroupedProducts ?? null);
|
|
@@ -232,16 +232,16 @@ function j(t) {
|
|
|
232
232
|
recentlyAdded: i?.recentlyAdded ?? [],
|
|
233
233
|
freeItems: i?.freeItems ?? [],
|
|
234
234
|
loading: o,
|
|
235
|
-
error:
|
|
235
|
+
error: l,
|
|
236
236
|
refetch: f
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
function M(e) {
|
|
240
|
-
let t = T(), [n, r] = C([]), [i, a] = C(!0), [
|
|
240
|
+
let t = T(), [n, r] = C([]), [i, a] = C(!0), [s, c] = C(null), l = y(async () => {
|
|
241
241
|
a(!0), c(null);
|
|
242
242
|
try {
|
|
243
243
|
r((await t.query({
|
|
244
|
-
query:
|
|
244
|
+
query: o,
|
|
245
245
|
variables: { limit: e },
|
|
246
246
|
fetchPolicy: "cache-first"
|
|
247
247
|
})).data?.featuredProducts ?? []);
|
|
@@ -256,7 +256,7 @@ function M(e) {
|
|
|
256
256
|
}, [l]), {
|
|
257
257
|
products: n,
|
|
258
258
|
loading: i,
|
|
259
|
-
error:
|
|
259
|
+
error: s,
|
|
260
260
|
refetch: l
|
|
261
261
|
};
|
|
262
262
|
}
|
|
@@ -269,7 +269,7 @@ function N(e, t) {
|
|
|
269
269
|
o(!0), c(null);
|
|
270
270
|
try {
|
|
271
271
|
i((await n.query({
|
|
272
|
-
query:
|
|
272
|
+
query: f,
|
|
273
273
|
variables: {
|
|
274
274
|
query: e,
|
|
275
275
|
limit: t?.limit,
|
|
@@ -306,7 +306,7 @@ function P() {
|
|
|
306
306
|
i(!0), o(null);
|
|
307
307
|
try {
|
|
308
308
|
let i = (await e.query({
|
|
309
|
-
query:
|
|
309
|
+
query: f,
|
|
310
310
|
variables: {
|
|
311
311
|
query: t,
|
|
312
312
|
limit: r?.limit,
|
|
@@ -331,7 +331,7 @@ function F(e) {
|
|
|
331
331
|
a(!0), s(null);
|
|
332
332
|
try {
|
|
333
333
|
r((await t.query({
|
|
334
|
-
query:
|
|
334
|
+
query: m,
|
|
335
335
|
variables: {
|
|
336
336
|
limit: e?.limit,
|
|
337
337
|
type: e?.type
|
|
@@ -358,11 +358,11 @@ function F(e) {
|
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
function I(e) {
|
|
361
|
-
let t = T(), [n, r] = C(null), [i, a] = C(!0), [o,
|
|
362
|
-
a(!0),
|
|
361
|
+
let t = T(), [n, r] = C(null), [i, a] = C(!0), [o, c] = C(null), l = y(async () => {
|
|
362
|
+
a(!0), c(null);
|
|
363
363
|
try {
|
|
364
364
|
r((await t.query({
|
|
365
|
-
query:
|
|
365
|
+
query: s,
|
|
366
366
|
variables: {
|
|
367
367
|
type: e?.type,
|
|
368
368
|
withProducts: e?.withProducts
|
|
@@ -370,7 +370,7 @@ function I(e) {
|
|
|
370
370
|
fetchPolicy: "cache-first"
|
|
371
371
|
})).data?.filterOptions ?? null);
|
|
372
372
|
} catch (e) {
|
|
373
|
-
|
|
373
|
+
c(e);
|
|
374
374
|
} finally {
|
|
375
375
|
a(!1);
|
|
376
376
|
}
|
|
@@ -389,11 +389,11 @@ function I(e) {
|
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
391
|
function L() {
|
|
392
|
-
let e = T(), [t,
|
|
392
|
+
let e = T(), [t, r] = C([]), [i, a] = C(!0), [o, s] = C(null), c = y(async () => {
|
|
393
393
|
a(!0), s(null);
|
|
394
394
|
try {
|
|
395
|
-
|
|
396
|
-
query:
|
|
395
|
+
r((await e.query({
|
|
396
|
+
query: n,
|
|
397
397
|
fetchPolicy: "cache-first"
|
|
398
398
|
})).data?.categories ?? []);
|
|
399
399
|
} catch (e) {
|
|
@@ -420,7 +420,7 @@ function R(e, t) {
|
|
|
420
420
|
o(!0), c(null);
|
|
421
421
|
try {
|
|
422
422
|
i((await n.query({
|
|
423
|
-
query:
|
|
423
|
+
query: d,
|
|
424
424
|
variables: {
|
|
425
425
|
productId: e,
|
|
426
426
|
status: t?.status
|
|
@@ -455,7 +455,7 @@ function z(e) {
|
|
|
455
455
|
a(!0), s(null);
|
|
456
456
|
try {
|
|
457
457
|
r((await t.query({
|
|
458
|
-
query:
|
|
458
|
+
query: g,
|
|
459
459
|
variables: { productId: e },
|
|
460
460
|
fetchPolicy: "network-only"
|
|
461
461
|
})).data?.userReviewForProduct ?? null);
|
|
@@ -475,155 +475,155 @@ function z(e) {
|
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
function B() {
|
|
478
|
-
let { mutate: e } =
|
|
478
|
+
let { mutate: e } = v(), [t, n] = C(null), [r, a] = C(!1), [o, s] = C(null);
|
|
479
479
|
return {
|
|
480
480
|
createReview: y(async (t) => {
|
|
481
|
-
|
|
481
|
+
a(!0), s(null);
|
|
482
482
|
try {
|
|
483
|
-
let
|
|
484
|
-
mutation:
|
|
483
|
+
let r = (await e({
|
|
484
|
+
mutation: i,
|
|
485
485
|
variables: { input: t }
|
|
486
486
|
})).data?.createReview ?? null;
|
|
487
|
-
return r
|
|
488
|
-
data:
|
|
487
|
+
return n(r), {
|
|
488
|
+
data: r,
|
|
489
489
|
errorMessage: null
|
|
490
490
|
};
|
|
491
491
|
} catch (e) {
|
|
492
|
-
|
|
492
|
+
s(e);
|
|
493
493
|
let t = e;
|
|
494
494
|
return {
|
|
495
495
|
data: null,
|
|
496
496
|
errorMessage: t.graphQLErrors?.[0]?.message ?? t.message ?? "We could not save your review. Please try again."
|
|
497
497
|
};
|
|
498
498
|
} finally {
|
|
499
|
-
|
|
499
|
+
a(!1);
|
|
500
500
|
}
|
|
501
501
|
}, [e]),
|
|
502
|
-
review:
|
|
503
|
-
loading:
|
|
504
|
-
error:
|
|
502
|
+
review: t,
|
|
503
|
+
loading: r,
|
|
504
|
+
error: o
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
507
|
function V() {
|
|
508
|
-
let { mutate: e } =
|
|
508
|
+
let { mutate: e } = v(), [t, n] = C(null), [r, i] = C(!1), [a, o] = C(null);
|
|
509
509
|
return {
|
|
510
|
-
updateReview: y(async (t,
|
|
511
|
-
|
|
510
|
+
updateReview: y(async (t, r) => {
|
|
511
|
+
i(!0), o(null);
|
|
512
512
|
try {
|
|
513
513
|
let i = (await e({
|
|
514
|
-
mutation:
|
|
514
|
+
mutation: h,
|
|
515
515
|
variables: {
|
|
516
516
|
id: t,
|
|
517
|
-
input:
|
|
517
|
+
input: r
|
|
518
518
|
}
|
|
519
519
|
})).data?.updateReview ?? null;
|
|
520
|
-
return
|
|
520
|
+
return n(i), i;
|
|
521
521
|
} catch (e) {
|
|
522
|
-
return
|
|
522
|
+
return o(e), null;
|
|
523
523
|
} finally {
|
|
524
|
-
|
|
524
|
+
i(!1);
|
|
525
525
|
}
|
|
526
526
|
}, [e]),
|
|
527
|
-
review:
|
|
528
|
-
loading:
|
|
529
|
-
error:
|
|
527
|
+
review: t,
|
|
528
|
+
loading: r,
|
|
529
|
+
error: a
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
532
|
function H() {
|
|
533
|
-
let { mutate: e } =
|
|
533
|
+
let { mutate: e } = v(), [t, n] = C(!1), [r, i] = C(null);
|
|
534
534
|
return {
|
|
535
535
|
deleteReview: y(async (t) => {
|
|
536
|
-
|
|
536
|
+
n(!0), i(null);
|
|
537
537
|
try {
|
|
538
538
|
return (await e({
|
|
539
|
-
mutation:
|
|
539
|
+
mutation: a,
|
|
540
540
|
variables: { id: t }
|
|
541
541
|
})).data?.deleteReview ?? !1;
|
|
542
542
|
} catch (e) {
|
|
543
|
-
return
|
|
543
|
+
return i(e), !1;
|
|
544
544
|
} finally {
|
|
545
|
-
|
|
545
|
+
n(!1);
|
|
546
546
|
}
|
|
547
547
|
}, [e]),
|
|
548
|
-
loading:
|
|
549
|
-
error:
|
|
548
|
+
loading: t,
|
|
549
|
+
error: r
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
552
|
function U() {
|
|
553
|
-
let { mutate: e } =
|
|
553
|
+
let { mutate: e } = v(), [t, n] = C(!1), [r, i] = C(null);
|
|
554
554
|
return {
|
|
555
555
|
markHelpful: y(async (t) => {
|
|
556
|
-
|
|
556
|
+
n(!0), i(null);
|
|
557
557
|
try {
|
|
558
558
|
return (await e({
|
|
559
|
-
mutation:
|
|
559
|
+
mutation: l,
|
|
560
560
|
variables: { id: t }
|
|
561
561
|
})).data?.markReviewHelpful ?? null;
|
|
562
562
|
} catch (e) {
|
|
563
|
-
return
|
|
563
|
+
return i(e), null;
|
|
564
564
|
} finally {
|
|
565
|
-
|
|
565
|
+
n(!1);
|
|
566
566
|
}
|
|
567
567
|
}, [e]),
|
|
568
|
-
loading:
|
|
569
|
-
error:
|
|
568
|
+
loading: t,
|
|
569
|
+
error: r
|
|
570
570
|
};
|
|
571
571
|
}
|
|
572
572
|
function W() {
|
|
573
|
-
let { query: e, hasOrganizationContext:
|
|
574
|
-
|
|
573
|
+
let { query: e, hasOrganizationContext: t } = v(), n = w(), [r, i] = C([]), [a, o] = C(!1), [s, c] = C(0), [l, d] = C(!0), [f, p] = C(null), m = y(async (r = 0, a = !1) => {
|
|
574
|
+
d(!0), p(null);
|
|
575
575
|
try {
|
|
576
|
-
let
|
|
576
|
+
let s = {
|
|
577
577
|
limit: 20,
|
|
578
|
-
offset:
|
|
579
|
-
},
|
|
580
|
-
query:
|
|
581
|
-
variables:
|
|
578
|
+
offset: r
|
|
579
|
+
}, l = (t ? await e({
|
|
580
|
+
query: u,
|
|
581
|
+
variables: s,
|
|
582
582
|
fetchPolicy: "network-only"
|
|
583
|
-
}) : await
|
|
584
|
-
query:
|
|
585
|
-
variables:
|
|
583
|
+
}) : await n.query({
|
|
584
|
+
query: u,
|
|
585
|
+
variables: s,
|
|
586
586
|
fetchPolicy: "network-only"
|
|
587
587
|
})).data?.myEntitlements ?? [];
|
|
588
|
-
a
|
|
588
|
+
i(a ? (e) => [...e, ...l] : l), o(l.length === 20), c(r);
|
|
589
589
|
} catch (e) {
|
|
590
|
-
|
|
590
|
+
p(e);
|
|
591
591
|
} finally {
|
|
592
|
-
|
|
592
|
+
d(!1);
|
|
593
593
|
}
|
|
594
594
|
}, [
|
|
595
|
-
r,
|
|
596
595
|
n,
|
|
596
|
+
t,
|
|
597
597
|
e
|
|
598
598
|
]);
|
|
599
599
|
return b(() => {
|
|
600
|
-
|
|
601
|
-
}, [
|
|
602
|
-
entitlements:
|
|
603
|
-
hasMore:
|
|
604
|
-
loading:
|
|
605
|
-
error:
|
|
606
|
-
refetch: () =>
|
|
600
|
+
m(0);
|
|
601
|
+
}, [m]), {
|
|
602
|
+
entitlements: r,
|
|
603
|
+
hasMore: a,
|
|
604
|
+
loading: l,
|
|
605
|
+
error: f,
|
|
606
|
+
refetch: () => m(0),
|
|
607
607
|
loadMore: y(() => {
|
|
608
|
-
!
|
|
608
|
+
!a || l || m(s + 20, !0);
|
|
609
609
|
}, [
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
610
|
+
m,
|
|
611
|
+
a,
|
|
612
|
+
l,
|
|
613
|
+
s
|
|
614
614
|
])
|
|
615
615
|
};
|
|
616
616
|
}
|
|
617
617
|
function G(e) {
|
|
618
|
-
let t = T(), [n,
|
|
618
|
+
let t = T(), [n, i] = C(null), [a, o] = C(!0), [s, c] = C(null), l = y(async () => {
|
|
619
619
|
if (!e) {
|
|
620
620
|
o(!1);
|
|
621
621
|
return;
|
|
622
622
|
}
|
|
623
623
|
o(!0), c(null);
|
|
624
624
|
try {
|
|
625
|
-
|
|
626
|
-
query:
|
|
625
|
+
i((await t.query({
|
|
626
|
+
query: r,
|
|
627
627
|
variables: { productId: e },
|
|
628
628
|
fetchPolicy: "network-only"
|
|
629
629
|
})).data?.checkEntitlement ?? null);
|
|
@@ -651,7 +651,7 @@ function K(e, t, n, r) {
|
|
|
651
651
|
u(!0), f(null);
|
|
652
652
|
try {
|
|
653
653
|
let a = await i.query({
|
|
654
|
-
query:
|
|
654
|
+
query: _,
|
|
655
655
|
variables: {
|
|
656
656
|
billingAccountId: e,
|
|
657
657
|
page: t,
|