@burdenoff/microfe-coolandlovely 2026.1109.6 → 2026.1109.8
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/README.md +30 -0
- package/dist/coolandlovely/components/ResaleListingActions.d.ts +8 -0
- package/dist/coolandlovely/components/ResaleListingActions.d.ts.map +1 -0
- package/dist/coolandlovely/components/ResaleListingActions.js +132 -0
- package/dist/coolandlovely/components/ResaleListingActions.js.map +1 -0
- package/dist/coolandlovely/components/ResaleListingEditor.d.ts +7 -0
- package/dist/coolandlovely/components/ResaleListingEditor.d.ts.map +1 -0
- package/dist/coolandlovely/components/ResaleListingEditor.js +276 -0
- package/dist/coolandlovely/components/ResaleListingEditor.js.map +1 -0
- package/dist/coolandlovely/components/ResalePhotoPicker.d.ts +6 -0
- package/dist/coolandlovely/components/ResalePhotoPicker.d.ts.map +1 -0
- package/dist/coolandlovely/components/ResalePhotoPicker.js +150 -0
- package/dist/coolandlovely/components/ResalePhotoPicker.js.map +1 -0
- package/dist/coolandlovely/hooks/useResale.d.ts +178 -2
- package/dist/coolandlovely/hooks/useResale.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useResale.js +75 -42
- package/dist/coolandlovely/hooks/useResale.js.map +1 -1
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.js +130 -86
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.js.map +1 -1
- package/dist/coolandlovely/utils/resaleCreateIntent.d.ts +13 -0
- package/dist/coolandlovely/utils/resaleCreateIntent.d.ts.map +1 -0
- package/dist/coolandlovely/utils/resaleCreateIntent.js +49 -0
- package/dist/coolandlovely/utils/resaleCreateIntent.js.map +1 -0
- package/dist/coolandlovely/utils/resalePresentation.d.ts +3 -0
- package/dist/coolandlovely/utils/resalePresentation.d.ts.map +1 -1
- package/dist/coolandlovely/utils/resalePresentation.js +23 -4
- package/dist/coolandlovely/utils/resalePresentation.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +70 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +41 -9
- package/dist/generated/wspace-operations.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { refreshResaleRead as t, useResaleOwnedPhotos as n } from "../hooks/useResale.js";
|
|
3
|
+
import { useState as r } from "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { Button as o, Pagination as s } from "@burdenoff/fe-libs/ui";
|
|
6
|
+
//#region src/coolandlovely/components/ResalePhotoPicker.tsx
|
|
7
|
+
function c({ selected: c, onChange: l, disabled: u }) {
|
|
8
|
+
let d = e(), [f, p] = r(0), [m, h] = r(0), [g, _] = r([]), v = new Set(c), y = n(f, m, g.at(-1)?.id), b = (y.data?.getFoldersInFolder.folders ?? []).filter((e) => e.workspaceId === y.workspaceId && e.status === "ACTIVE" && e.canRead === !0), x = (y.data?.getFiles.files ?? []).filter((e) => {
|
|
9
|
+
if (e.workspaceId !== y.workspaceId || e.uploadedById !== y.actorId || e.status !== "ACTIVE" || e.visibility !== "PUBLIC" || e.canRead !== !0 || ![
|
|
10
|
+
"image/jpeg",
|
|
11
|
+
"image/png",
|
|
12
|
+
"image/webp",
|
|
13
|
+
"image/avif"
|
|
14
|
+
].includes(e.mimeType)) return !1;
|
|
15
|
+
try {
|
|
16
|
+
let t = new URL(e.publicUrl ?? "");
|
|
17
|
+
return t.protocol === "https:" && !t.username && !t.password;
|
|
18
|
+
} catch {
|
|
19
|
+
return !1;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ a("fieldset", {
|
|
23
|
+
disabled: u,
|
|
24
|
+
className: "space-y-3",
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ i("legend", {
|
|
27
|
+
className: "font-semibold text-text-primary",
|
|
28
|
+
children: d("coolandlovely.resale.editor.photoCount", "Product photos ({{count}}/10)", { count: c.length })
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ i("p", {
|
|
31
|
+
className: "text-sm text-text-secondary",
|
|
32
|
+
children: d("coolandlovely.resale.editor.publicPhotoNotice", "Choose photos you uploaded as PUBLIC in Files for this workspace. Public photos can be viewed without signing in. Private files are never made public by this form.")
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ a("nav", {
|
|
35
|
+
"aria-label": "Photo folders",
|
|
36
|
+
className: "flex flex-wrap items-center gap-2 text-sm",
|
|
37
|
+
children: [/* @__PURE__ */ i(o, {
|
|
38
|
+
type: "button",
|
|
39
|
+
variant: "outline",
|
|
40
|
+
onClick: () => {
|
|
41
|
+
_([]), p(0), h(0);
|
|
42
|
+
},
|
|
43
|
+
children: d("coolandlovely.resale.editor.filesRoot", "Files root")
|
|
44
|
+
}), g.map((e, t) => /* @__PURE__ */ i(o, {
|
|
45
|
+
className: "max-w-full whitespace-normal break-words text-start",
|
|
46
|
+
type: "button",
|
|
47
|
+
variant: "outline",
|
|
48
|
+
onClick: () => {
|
|
49
|
+
_(g.slice(0, t + 1)), p(0), h(0);
|
|
50
|
+
},
|
|
51
|
+
children: e.name
|
|
52
|
+
}, e.id))]
|
|
53
|
+
}),
|
|
54
|
+
b.length > 0 && /* @__PURE__ */ i("div", {
|
|
55
|
+
className: "flex flex-wrap gap-2",
|
|
56
|
+
"aria-label": "Subfolders",
|
|
57
|
+
children: b.map((e) => /* @__PURE__ */ i(o, {
|
|
58
|
+
type: "button",
|
|
59
|
+
variant: "outline",
|
|
60
|
+
className: "max-w-full whitespace-normal break-words text-start",
|
|
61
|
+
disabled: g.length >= 50 || g.some((t) => t.id === e.id),
|
|
62
|
+
onClick: () => {
|
|
63
|
+
_([...g, {
|
|
64
|
+
id: e.id,
|
|
65
|
+
name: e.name
|
|
66
|
+
}]), p(0), h(0);
|
|
67
|
+
},
|
|
68
|
+
children: d("coolandlovely.resale.editor.openFolder", "Open folder: {{name}}", { name: e.name })
|
|
69
|
+
}, e.id))
|
|
70
|
+
}),
|
|
71
|
+
(m > 0 || y.data?.getFoldersInFolder.hasMore) && /* @__PURE__ */ i(s, {
|
|
72
|
+
page: m + 1,
|
|
73
|
+
pageSize: 20,
|
|
74
|
+
hasNextPage: y.data?.getFoldersInFolder.hasMore ?? !1,
|
|
75
|
+
hasPreviousPage: m > 0,
|
|
76
|
+
loading: y.isFetching,
|
|
77
|
+
onPageChange: (e) => h(e - 1)
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ i(o, {
|
|
80
|
+
type: "button",
|
|
81
|
+
variant: "outline",
|
|
82
|
+
disabled: y.isFetching,
|
|
83
|
+
onClick: () => void t(y.refetch),
|
|
84
|
+
children: d("coolandlovely.resale.editor.refreshPhotoLibrary", "Refresh photo library")
|
|
85
|
+
}),
|
|
86
|
+
c.length > 0 && /* @__PURE__ */ i(o, {
|
|
87
|
+
type: "button",
|
|
88
|
+
variant: "outline",
|
|
89
|
+
onClick: () => l([]),
|
|
90
|
+
children: d("coolandlovely.resale.editor.clearPhotos", "Clear photo selection")
|
|
91
|
+
}),
|
|
92
|
+
y.isPending && /* @__PURE__ */ i("p", {
|
|
93
|
+
role: "status",
|
|
94
|
+
children: d("coolandlovely.resale.editor.loadingPhotos", "Loading your public photos…")
|
|
95
|
+
}),
|
|
96
|
+
y.isError && /* @__PURE__ */ a("div", {
|
|
97
|
+
role: "alert",
|
|
98
|
+
children: [
|
|
99
|
+
d("coolandlovely.resale.editor.photoLoadFailed", "Photo library could not be loaded."),
|
|
100
|
+
" ",
|
|
101
|
+
/* @__PURE__ */ i(o, {
|
|
102
|
+
type: "button",
|
|
103
|
+
variant: "outline",
|
|
104
|
+
onClick: () => void t(y.refetch),
|
|
105
|
+
children: d("coolandlovely.resale.editor.refreshPhotos", "Refresh photos")
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
y.isSuccess && x.length === 0 && /* @__PURE__ */ i("p", {
|
|
110
|
+
role: "status",
|
|
111
|
+
children: d("coolandlovely.resale.editor.noPublicPhotos", "No usable public photos on this page. Upload public product photos in Files, then refresh this library.")
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ i("div", {
|
|
114
|
+
className: "grid grid-cols-2 gap-3 sm:grid-cols-3",
|
|
115
|
+
children: x.map((e) => /* @__PURE__ */ a("label", {
|
|
116
|
+
className: "min-w-0 rounded-lg border border-border-seam p-2",
|
|
117
|
+
children: [/* @__PURE__ */ i("img", {
|
|
118
|
+
src: e.publicUrl ?? void 0,
|
|
119
|
+
alt: e.name,
|
|
120
|
+
loading: "lazy",
|
|
121
|
+
className: "aspect-square w-full rounded object-cover"
|
|
122
|
+
}), /* @__PURE__ */ a("span", {
|
|
123
|
+
className: "mt-2 flex items-start gap-2 break-words text-sm text-text-primary",
|
|
124
|
+
children: [/* @__PURE__ */ i("input", {
|
|
125
|
+
type: "checkbox",
|
|
126
|
+
checked: v.has(e.id),
|
|
127
|
+
disabled: u || !v.has(e.id) && c.length >= 10,
|
|
128
|
+
onChange: (t) => l(t.target.checked ? [...c, e.id] : c.filter((t) => t !== e.id))
|
|
129
|
+
}), /* @__PURE__ */ i("span", {
|
|
130
|
+
className: "min-w-0 break-words",
|
|
131
|
+
children: e.name
|
|
132
|
+
})]
|
|
133
|
+
})]
|
|
134
|
+
}, e.id))
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ i(s, {
|
|
137
|
+
page: f + 1,
|
|
138
|
+
pageSize: 20,
|
|
139
|
+
hasNextPage: y.data?.getFiles.hasMore ?? !1,
|
|
140
|
+
hasPreviousPage: f > 0,
|
|
141
|
+
loading: y.isFetching,
|
|
142
|
+
onPageChange: (e) => p(e - 1)
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { c as ResalePhotoPicker };
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=ResalePhotoPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResalePhotoPicker.js","names":[],"sources":["../../../src/coolandlovely/components/ResalePhotoPicker.tsx"],"sourcesContent":["import { useTr } from '../hooks/useTr';\nimport { useState } from 'react';\nimport { Button, Pagination } from '@burdenoff/fe-libs/ui';\nimport { RESALE_PAGE_SIZE, refreshResaleRead, useResaleOwnedPhotos } from '../hooks/useResale';\n\nexport function ResalePhotoPicker({\n selected,\n onChange,\n disabled,\n}: {\n selected: string[];\n onChange(ids: string[]): void;\n disabled: boolean;\n}) {\n const tr = useTr();\n const [page, setPage] = useState(0);\n const [folderPage, setFolderPage] = useState(0);\n const [path, setPath] = useState<{ id: string; name: string }[]>([]);\n const selectedIds = new Set(selected);\n const photos = useResaleOwnedPhotos(page, folderPage, path.at(-1)?.id);\n const folders = (photos.data?.getFoldersInFolder.folders ?? []).filter(\n (folder) =>\n folder.workspaceId === photos.workspaceId &&\n folder.status === 'ACTIVE' &&\n folder.canRead === true\n );\n const available = (photos.data?.getFiles.files ?? []).filter((file) => {\n if (\n file.workspaceId !== photos.workspaceId ||\n file.uploadedById !== photos.actorId ||\n file.status !== 'ACTIVE' ||\n file.visibility !== 'PUBLIC' ||\n file.canRead !== true ||\n !['image/jpeg', 'image/png', 'image/webp', 'image/avif'].includes(file.mimeType)\n )\n return false;\n try {\n const url = new URL(file.publicUrl ?? '');\n return url.protocol === 'https:' && !url.username && !url.password;\n } catch {\n return false;\n }\n });\n return (\n <fieldset disabled={disabled} className=\"space-y-3\">\n <legend className=\"font-semibold text-text-primary\">\n {tr('coolandlovely.resale.editor.photoCount', 'Product photos ({{count}}/10)', {\n count: selected.length,\n })}\n </legend>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'coolandlovely.resale.editor.publicPhotoNotice',\n 'Choose photos you uploaded as PUBLIC in Files for this workspace. Public photos can be viewed without signing in. Private files are never made public by this form.'\n )}\n </p>\n <nav aria-label=\"Photo folders\" className=\"flex flex-wrap items-center gap-2 text-sm\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n setPath([]);\n setPage(0);\n setFolderPage(0);\n }}\n >\n {tr('coolandlovely.resale.editor.filesRoot', 'Files root')}\n </Button>\n {path.map((folder, index) => (\n <Button\n key={folder.id}\n className=\"max-w-full whitespace-normal break-words text-start\"\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n setPath(path.slice(0, index + 1));\n setPage(0);\n setFolderPage(0);\n }}\n >\n {folder.name}\n </Button>\n ))}\n </nav>\n {folders.length > 0 && (\n <div className=\"flex flex-wrap gap-2\" aria-label=\"Subfolders\">\n {folders.map((folder) => (\n <Button\n type=\"button\"\n variant=\"outline\"\n key={folder.id}\n className=\"max-w-full whitespace-normal break-words text-start\"\n disabled={path.length >= 50 || path.some((parent) => parent.id === folder.id)}\n onClick={() => {\n setPath([...path, { id: folder.id, name: folder.name }]);\n setPage(0);\n setFolderPage(0);\n }}\n >\n {tr('coolandlovely.resale.editor.openFolder', 'Open folder: {{name}}', {\n name: folder.name,\n })}\n </Button>\n ))}\n </div>\n )}\n {(folderPage > 0 || photos.data?.getFoldersInFolder.hasMore) && (\n <Pagination\n page={folderPage + 1}\n pageSize={RESALE_PAGE_SIZE}\n hasNextPage={photos.data?.getFoldersInFolder.hasMore ?? false}\n hasPreviousPage={folderPage > 0}\n loading={photos.isFetching}\n onPageChange={(next) => setFolderPage(next - 1)}\n />\n )}\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={photos.isFetching}\n onClick={() => void refreshResaleRead(photos.refetch)}\n >\n {tr('coolandlovely.resale.editor.refreshPhotoLibrary', 'Refresh photo library')}\n </Button>\n {selected.length > 0 && (\n <Button type=\"button\" variant=\"outline\" onClick={() => onChange([])}>\n {tr('coolandlovely.resale.editor.clearPhotos', 'Clear photo selection')}\n </Button>\n )}\n {photos.isPending && (\n <p role=\"status\">\n {tr('coolandlovely.resale.editor.loadingPhotos', 'Loading your public photos…')}\n </p>\n )}\n {photos.isError && (\n <div role=\"alert\">\n {tr('coolandlovely.resale.editor.photoLoadFailed', 'Photo library could not be loaded.')}{' '}\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => void refreshResaleRead(photos.refetch)}\n >\n {tr('coolandlovely.resale.editor.refreshPhotos', 'Refresh photos')}\n </Button>\n </div>\n )}\n {photos.isSuccess && available.length === 0 && (\n <p role=\"status\">\n {tr(\n 'coolandlovely.resale.editor.noPublicPhotos',\n 'No usable public photos on this page. Upload public product photos in Files, then refresh this library.'\n )}\n </p>\n )}\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3\">\n {available.map((file) => (\n <label key={file.id} className=\"min-w-0 rounded-lg border border-border-seam p-2\">\n <img\n src={file.publicUrl ?? undefined}\n alt={file.name}\n loading=\"lazy\"\n className=\"aspect-square w-full rounded object-cover\"\n />\n <span className=\"mt-2 flex items-start gap-2 break-words text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={selectedIds.has(file.id)}\n disabled={disabled || (!selectedIds.has(file.id) && selected.length >= 10)}\n onChange={(event) =>\n onChange(\n event.target.checked\n ? [...selected, file.id]\n : selected.filter((id) => id !== file.id)\n )\n }\n />\n <span className=\"min-w-0 break-words\">{file.name}</span>\n </span>\n </label>\n ))}\n </div>\n <Pagination\n page={page + 1}\n pageSize={RESALE_PAGE_SIZE}\n hasNextPage={photos.data?.getFiles.hasMore ?? false}\n hasPreviousPage={page > 0}\n loading={photos.isFetching}\n onPageChange={(next) => setPage(next - 1)}\n />\n </fieldset>\n );\n}\n"],"mappings":";;;;;;AAKA,SAAgB,EAAkB,EAChC,aACA,aACA,eAKC;CACD,IAAM,IAAK,EAAM,GACX,CAAC,GAAM,KAAW,EAAS,CAAC,GAC5B,CAAC,GAAY,KAAiB,EAAS,CAAC,GACxC,CAAC,GAAM,KAAW,EAAyC,CAAC,CAAC,GAC7D,IAAc,IAAI,IAAI,CAAQ,GAC9B,IAAS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,EAAG,6CAA6C,gBAAgB;KAC3D,CAAA;IACL;;GAEN,EAAO,aAAa,EAAU,WAAW,KACxC,kBAAC,KAAD;IAAG,MAAK;cACL,EACC,8CACA,yGACF;GACC,CAAA;GAEL,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAU,KAAK,MACd,kBAAC,SAAD;KAAqB,WAAU;eAA/B,CACE,kBAAC,OAAD;MACE,KAAK,EAAK,aAAa,KAAA;MACvB,KAAK,EAAK;MACV,SAAQ;MACR,WAAU;KACX,CAAA,GACD,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,kBAAC,SAAD;OACE,MAAK;OACL,SAAS,EAAY,IAAI,EAAK,EAAE;OAChC,UAAU,KAAa,CAAC,EAAY,IAAI,EAAK,EAAE,KAAK,EAAS,UAAU;OACvE,WAAW,MACT,EACE,EAAM,OAAO,UACT,CAAC,GAAG,GAAU,EAAK,EAAE,IACrB,EAAS,QAAQ,MAAO,MAAO,EAAK,EAAE,CAC5C;MAEH,CAAA,GACD,kBAAC,QAAD;OAAM,WAAU;iBAAuB,EAAK;MAAW,CAAA,CACnD;OACD;OAtBK,EAAK,EAsBV,CACR;GACE,CAAA;GACL,kBAAC,GAAD;IACE,MAAM,IAAO;IACb,UAAA;IACA,aAAa,EAAO,MAAM,SAAS,WAAW;IAC9C,iBAAiB,IAAO;IACxB,SAAS,EAAO;IAChB,eAAe,MAAS,EAAQ,IAAO,CAAC;GACzC,CAAA;EACO;;AAEd"}
|
|
@@ -1,12 +1,188 @@
|
|
|
1
1
|
import { DocumentNode } from 'graphql';
|
|
2
|
-
import { CooResaleBrowseQuery, CooResaleBrowseQueryVariables, CooResalePublicDetailQuery, CooResaleSellerQuery, CooResaleOwnReportsQuery } from '../../generated/wspace-operations';
|
|
2
|
+
import { CooResaleBrowseQuery, CooResaleBrowseQueryVariables, CooResalePublicDetailQuery, CooResaleSellerQuery, CooResaleOwnReportsQuery, CooResaleOwnedPhotosQuery } from '../../generated/wspace-operations';
|
|
3
3
|
export type { CooResaleShopFieldsFragment as ResaleShop, CooResaleOwnListingFieldsFragment as ResaleOwnListing, CooResalePublicFieldsFragment as ResalePublicListing, } from '../../generated/wspace-operations';
|
|
4
4
|
export declare const RESALE_QUERY_KEY: readonly ["coolandlovely", "resale"];
|
|
5
5
|
export declare const RESALE_PAGE_SIZE = 20;
|
|
6
|
+
export declare function useResaleClient(): {
|
|
7
|
+
request: <T>(document: DocumentNode, variables: Record<string, unknown>, signal?: AbortSignal) => Promise<T>;
|
|
8
|
+
ready: boolean;
|
|
9
|
+
key: readonly ["coolandlovely", "resale", string | undefined, string | undefined, string | undefined, string | undefined, string | undefined, string | undefined];
|
|
10
|
+
actorId: string | undefined;
|
|
11
|
+
workspaceId: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare function useResaleOwnedPhotos(page: number, folderPage: number, folderId?: string): {
|
|
14
|
+
actorId: string | undefined;
|
|
15
|
+
workspaceId: string | undefined;
|
|
16
|
+
data: CooResaleOwnedPhotosQuery;
|
|
17
|
+
error: Error;
|
|
18
|
+
isError: true;
|
|
19
|
+
isPending: false;
|
|
20
|
+
isLoading: false;
|
|
21
|
+
isLoadingError: false;
|
|
22
|
+
isRefetchError: true;
|
|
23
|
+
isSuccess: false;
|
|
24
|
+
isPlaceholderData: false;
|
|
25
|
+
status: "error";
|
|
26
|
+
dataUpdatedAt: number;
|
|
27
|
+
errorUpdatedAt: number;
|
|
28
|
+
failureCount: number;
|
|
29
|
+
failureReason: Error | null;
|
|
30
|
+
errorUpdateCount: number;
|
|
31
|
+
isFetched: boolean;
|
|
32
|
+
isFetchedAfterMount: boolean;
|
|
33
|
+
isFetching: boolean;
|
|
34
|
+
isInitialLoading: boolean;
|
|
35
|
+
isPaused: boolean;
|
|
36
|
+
isRefetching: boolean;
|
|
37
|
+
isStale: boolean;
|
|
38
|
+
isEnabled: boolean;
|
|
39
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<CooResaleOwnedPhotosQuery, Error>>;
|
|
40
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
41
|
+
} | {
|
|
42
|
+
actorId: string | undefined;
|
|
43
|
+
workspaceId: string | undefined;
|
|
44
|
+
data: CooResaleOwnedPhotosQuery;
|
|
45
|
+
error: null;
|
|
46
|
+
isError: false;
|
|
47
|
+
isPending: false;
|
|
48
|
+
isLoading: false;
|
|
49
|
+
isLoadingError: false;
|
|
50
|
+
isRefetchError: false;
|
|
51
|
+
isSuccess: true;
|
|
52
|
+
isPlaceholderData: false;
|
|
53
|
+
status: "success";
|
|
54
|
+
dataUpdatedAt: number;
|
|
55
|
+
errorUpdatedAt: number;
|
|
56
|
+
failureCount: number;
|
|
57
|
+
failureReason: Error | null;
|
|
58
|
+
errorUpdateCount: number;
|
|
59
|
+
isFetched: boolean;
|
|
60
|
+
isFetchedAfterMount: boolean;
|
|
61
|
+
isFetching: boolean;
|
|
62
|
+
isInitialLoading: boolean;
|
|
63
|
+
isPaused: boolean;
|
|
64
|
+
isRefetching: boolean;
|
|
65
|
+
isStale: boolean;
|
|
66
|
+
isEnabled: boolean;
|
|
67
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<CooResaleOwnedPhotosQuery, Error>>;
|
|
68
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
69
|
+
} | {
|
|
70
|
+
actorId: string | undefined;
|
|
71
|
+
workspaceId: string | undefined;
|
|
72
|
+
data: undefined;
|
|
73
|
+
error: Error;
|
|
74
|
+
isError: true;
|
|
75
|
+
isPending: false;
|
|
76
|
+
isLoading: false;
|
|
77
|
+
isLoadingError: true;
|
|
78
|
+
isRefetchError: false;
|
|
79
|
+
isSuccess: false;
|
|
80
|
+
isPlaceholderData: false;
|
|
81
|
+
status: "error";
|
|
82
|
+
dataUpdatedAt: number;
|
|
83
|
+
errorUpdatedAt: number;
|
|
84
|
+
failureCount: number;
|
|
85
|
+
failureReason: Error | null;
|
|
86
|
+
errorUpdateCount: number;
|
|
87
|
+
isFetched: boolean;
|
|
88
|
+
isFetchedAfterMount: boolean;
|
|
89
|
+
isFetching: boolean;
|
|
90
|
+
isInitialLoading: boolean;
|
|
91
|
+
isPaused: boolean;
|
|
92
|
+
isRefetching: boolean;
|
|
93
|
+
isStale: boolean;
|
|
94
|
+
isEnabled: boolean;
|
|
95
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<CooResaleOwnedPhotosQuery, Error>>;
|
|
96
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
97
|
+
} | {
|
|
98
|
+
actorId: string | undefined;
|
|
99
|
+
workspaceId: string | undefined;
|
|
100
|
+
data: undefined;
|
|
101
|
+
error: null;
|
|
102
|
+
isError: false;
|
|
103
|
+
isPending: true;
|
|
104
|
+
isLoading: true;
|
|
105
|
+
isLoadingError: false;
|
|
106
|
+
isRefetchError: false;
|
|
107
|
+
isSuccess: false;
|
|
108
|
+
isPlaceholderData: false;
|
|
109
|
+
status: "pending";
|
|
110
|
+
dataUpdatedAt: number;
|
|
111
|
+
errorUpdatedAt: number;
|
|
112
|
+
failureCount: number;
|
|
113
|
+
failureReason: Error | null;
|
|
114
|
+
errorUpdateCount: number;
|
|
115
|
+
isFetched: boolean;
|
|
116
|
+
isFetchedAfterMount: boolean;
|
|
117
|
+
isFetching: boolean;
|
|
118
|
+
isInitialLoading: boolean;
|
|
119
|
+
isPaused: boolean;
|
|
120
|
+
isRefetching: boolean;
|
|
121
|
+
isStale: boolean;
|
|
122
|
+
isEnabled: boolean;
|
|
123
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<CooResaleOwnedPhotosQuery, Error>>;
|
|
124
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
125
|
+
} | {
|
|
126
|
+
actorId: string | undefined;
|
|
127
|
+
workspaceId: string | undefined;
|
|
128
|
+
data: undefined;
|
|
129
|
+
error: null;
|
|
130
|
+
isError: false;
|
|
131
|
+
isPending: true;
|
|
132
|
+
isLoadingError: false;
|
|
133
|
+
isRefetchError: false;
|
|
134
|
+
isSuccess: false;
|
|
135
|
+
isPlaceholderData: false;
|
|
136
|
+
status: "pending";
|
|
137
|
+
dataUpdatedAt: number;
|
|
138
|
+
errorUpdatedAt: number;
|
|
139
|
+
failureCount: number;
|
|
140
|
+
failureReason: Error | null;
|
|
141
|
+
errorUpdateCount: number;
|
|
142
|
+
isFetched: boolean;
|
|
143
|
+
isFetchedAfterMount: boolean;
|
|
144
|
+
isFetching: boolean;
|
|
145
|
+
isLoading: boolean;
|
|
146
|
+
isInitialLoading: boolean;
|
|
147
|
+
isPaused: boolean;
|
|
148
|
+
isRefetching: boolean;
|
|
149
|
+
isStale: boolean;
|
|
150
|
+
isEnabled: boolean;
|
|
151
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<CooResaleOwnedPhotosQuery, Error>>;
|
|
152
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
153
|
+
} | {
|
|
154
|
+
actorId: string | undefined;
|
|
155
|
+
workspaceId: string | undefined;
|
|
156
|
+
data: CooResaleOwnedPhotosQuery;
|
|
157
|
+
isError: false;
|
|
158
|
+
error: null;
|
|
159
|
+
isPending: false;
|
|
160
|
+
isLoading: false;
|
|
161
|
+
isLoadingError: false;
|
|
162
|
+
isRefetchError: false;
|
|
163
|
+
isSuccess: true;
|
|
164
|
+
isPlaceholderData: true;
|
|
165
|
+
status: "success";
|
|
166
|
+
dataUpdatedAt: number;
|
|
167
|
+
errorUpdatedAt: number;
|
|
168
|
+
failureCount: number;
|
|
169
|
+
failureReason: Error | null;
|
|
170
|
+
errorUpdateCount: number;
|
|
171
|
+
isFetched: boolean;
|
|
172
|
+
isFetchedAfterMount: boolean;
|
|
173
|
+
isFetching: boolean;
|
|
174
|
+
isInitialLoading: boolean;
|
|
175
|
+
isPaused: boolean;
|
|
176
|
+
isRefetching: boolean;
|
|
177
|
+
isStale: boolean;
|
|
178
|
+
isEnabled: boolean;
|
|
179
|
+
refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<CooResaleOwnedPhotosQuery, Error>>;
|
|
180
|
+
fetchStatus: import('@tanstack/query-core').FetchStatus;
|
|
181
|
+
};
|
|
6
182
|
export declare function useResaleBrowse(input: CooResaleBrowseQueryVariables['input']): import('@tanstack/react-query').UseQueryResult<CooResaleBrowseQuery, Error>;
|
|
7
183
|
export declare function useResalePublicListing(id: string | undefined): import('@tanstack/react-query').UseQueryResult<CooResalePublicDetailQuery, Error>;
|
|
8
184
|
export declare function useResaleSeller(page: number): import('@tanstack/react-query').UseQueryResult<CooResaleSellerQuery, Error>;
|
|
9
185
|
export declare function useResaleReports(page: number): import('@tanstack/react-query').UseQueryResult<CooResaleOwnReportsQuery, Error>;
|
|
10
186
|
export declare function useResaleMutation<TData, TVariables extends Record<string, unknown>>(document: DocumentNode): import('@tanstack/react-query').UseMutationResult<TData, Error, TVariables, unknown>;
|
|
11
|
-
export declare function refreshResaleRead(refetch: () => Promise<
|
|
187
|
+
export declare function refreshResaleRead<T>(refetch: () => Promise<T>): Promise<T>;
|
|
12
188
|
//# sourceMappingURL=useResale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResale.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useResale.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,OAAO,
|
|
1
|
+
{"version":3,"file":"useResale.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useResale.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,E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,CAG1E"}
|
|
@@ -1,56 +1,89 @@
|
|
|
1
1
|
import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
|
|
2
2
|
import "../context/index.js";
|
|
3
|
-
import { CooResaleBrowseDocument as t, CooResaleOwnReportsDocument as n,
|
|
4
|
-
import { resaleRequest as
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { useMutation as
|
|
7
|
-
import { clearGraphqlFetchResponseCache as
|
|
3
|
+
import { CooResaleBrowseDocument as t, CooResaleOwnReportsDocument as n, CooResaleOwnedPhotosDocument as r, CooResalePublicDetailDocument as i, CooResaleSellerDocument as a } from "../../generated/wspace-operations.js";
|
|
4
|
+
import { resaleRequest as o } from "../api/resaleTransport.js";
|
|
5
|
+
import { useEffect as s, useMemo as c } from "react";
|
|
6
|
+
import { useMutation as l, useQuery as u, useQueryClient as d } from "@tanstack/react-query";
|
|
7
|
+
import { clearGraphqlFetchResponseCache as f } from "@burdenoff/fe-libs/shared/graphql/fetch";
|
|
8
8
|
//#region src/coolandlovely/hooks/useResale.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let { apiGatewayUrl: t, authToken: n, currentUser: r, workspaceId: i, tenantId:
|
|
9
|
+
var p = ["coolandlovely", "resale"];
|
|
10
|
+
function m() {
|
|
11
|
+
let { apiGatewayUrl: t, authToken: n, currentUser: r, workspaceId: i, tenantId: a, organizationId: l, projectId: u } = e(), d = r?.id, f = c(() => ({ controller: new AbortController() }), [
|
|
12
12
|
t,
|
|
13
13
|
n,
|
|
14
14
|
d,
|
|
15
15
|
i,
|
|
16
|
-
|
|
16
|
+
a,
|
|
17
17
|
l,
|
|
18
18
|
u
|
|
19
19
|
]);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
let e =
|
|
20
|
+
s(() => {
|
|
21
|
+
f.controller.signal.aborted && (f.controller = new AbortController());
|
|
22
|
+
let e = f.controller;
|
|
23
23
|
return () => e.abort();
|
|
24
|
-
}, [
|
|
24
|
+
}, [f]);
|
|
25
25
|
let m = [
|
|
26
|
-
...
|
|
26
|
+
...p,
|
|
27
27
|
t,
|
|
28
28
|
d,
|
|
29
29
|
i,
|
|
30
|
-
|
|
30
|
+
a,
|
|
31
31
|
l,
|
|
32
32
|
u
|
|
33
33
|
];
|
|
34
34
|
return {
|
|
35
|
-
request: (e, r,
|
|
35
|
+
request: (e, r, s = f.controller.signal) => {
|
|
36
36
|
if (!t || !n || !d || !i) throw Error("Choose an account and workspace before continuing.");
|
|
37
|
-
return
|
|
37
|
+
return o({
|
|
38
38
|
apiGatewayUrl: t,
|
|
39
39
|
authToken: n,
|
|
40
40
|
actorId: d,
|
|
41
41
|
workspaceId: i,
|
|
42
|
-
tenantId:
|
|
42
|
+
tenantId: a,
|
|
43
43
|
organizationId: l,
|
|
44
44
|
projectId: u
|
|
45
|
-
}, e, r,
|
|
45
|
+
}, e, r, s);
|
|
46
46
|
},
|
|
47
47
|
ready: !!(t && n && d && i),
|
|
48
|
-
key: m
|
|
48
|
+
key: m,
|
|
49
|
+
actorId: d,
|
|
50
|
+
workspaceId: i
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
|
-
function
|
|
52
|
-
let { request:
|
|
53
|
-
return
|
|
53
|
+
function h(e, t, n) {
|
|
54
|
+
let { request: i, ready: a, key: o, actorId: s, workspaceId: c } = m();
|
|
55
|
+
return {
|
|
56
|
+
...u({
|
|
57
|
+
queryKey: [
|
|
58
|
+
...o,
|
|
59
|
+
"owned-photos",
|
|
60
|
+
n,
|
|
61
|
+
e,
|
|
62
|
+
t
|
|
63
|
+
],
|
|
64
|
+
enabled: a,
|
|
65
|
+
retry: !1,
|
|
66
|
+
staleTime: 0,
|
|
67
|
+
queryFn: ({ signal: a }) => i(r, {
|
|
68
|
+
actorId: s,
|
|
69
|
+
folderId: n,
|
|
70
|
+
pagination: {
|
|
71
|
+
limit: 20,
|
|
72
|
+
offset: e * 20
|
|
73
|
+
},
|
|
74
|
+
folderPagination: {
|
|
75
|
+
limit: 20,
|
|
76
|
+
offset: t * 20
|
|
77
|
+
}
|
|
78
|
+
}, a)
|
|
79
|
+
}),
|
|
80
|
+
actorId: s,
|
|
81
|
+
workspaceId: c
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function g(e) {
|
|
85
|
+
let { request: n, ready: r, key: i } = m();
|
|
86
|
+
return u({
|
|
54
87
|
queryKey: [
|
|
55
88
|
...i,
|
|
56
89
|
"browse",
|
|
@@ -62,11 +95,11 @@ function m(e) {
|
|
|
62
95
|
queryFn: ({ signal: r }) => n(t, { input: e }, r)
|
|
63
96
|
});
|
|
64
97
|
}
|
|
65
|
-
function
|
|
66
|
-
let { request: t, ready: n, key:
|
|
67
|
-
return
|
|
98
|
+
function _(e) {
|
|
99
|
+
let { request: t, ready: n, key: r } = m();
|
|
100
|
+
return u({
|
|
68
101
|
queryKey: [
|
|
69
|
-
...
|
|
102
|
+
...r,
|
|
70
103
|
"public-detail",
|
|
71
104
|
e
|
|
72
105
|
],
|
|
@@ -75,13 +108,13 @@ function h(e) {
|
|
|
75
108
|
staleTime: 0,
|
|
76
109
|
queryFn: ({ signal: n }) => {
|
|
77
110
|
if (!e) throw Error("Choose a resale listing.");
|
|
78
|
-
return t(
|
|
111
|
+
return t(i, { id: e }, n);
|
|
79
112
|
}
|
|
80
113
|
});
|
|
81
114
|
}
|
|
82
|
-
function
|
|
83
|
-
let { request: t, ready: n, key: r } =
|
|
84
|
-
return
|
|
115
|
+
function v(e) {
|
|
116
|
+
let { request: t, ready: n, key: r } = m();
|
|
117
|
+
return u({
|
|
85
118
|
queryKey: [
|
|
86
119
|
...r,
|
|
87
120
|
"seller",
|
|
@@ -90,15 +123,15 @@ function g(e) {
|
|
|
90
123
|
enabled: n,
|
|
91
124
|
retry: !1,
|
|
92
125
|
staleTime: 0,
|
|
93
|
-
queryFn: ({ signal: n }) => t(
|
|
126
|
+
queryFn: ({ signal: n }) => t(a, { pagination: {
|
|
94
127
|
limit: 20,
|
|
95
128
|
offset: e * 20
|
|
96
129
|
} }, n)
|
|
97
130
|
});
|
|
98
131
|
}
|
|
99
|
-
function
|
|
100
|
-
let { request: t, ready: r, key: i } =
|
|
101
|
-
return
|
|
132
|
+
function y(e) {
|
|
133
|
+
let { request: t, ready: r, key: i } = m();
|
|
134
|
+
return u({
|
|
102
135
|
queryKey: [
|
|
103
136
|
...i,
|
|
104
137
|
"reports",
|
|
@@ -113,20 +146,20 @@ function _(e) {
|
|
|
113
146
|
} }, r)
|
|
114
147
|
});
|
|
115
148
|
}
|
|
116
|
-
function
|
|
117
|
-
let { request: t } =
|
|
118
|
-
return
|
|
149
|
+
function b(e) {
|
|
150
|
+
let { request: t } = m(), n = d();
|
|
151
|
+
return l({
|
|
119
152
|
retry: !1,
|
|
120
153
|
mutationFn: (n) => t(e, n),
|
|
121
154
|
onSettled: async () => {
|
|
122
|
-
|
|
155
|
+
f(), await n.invalidateQueries({ queryKey: p });
|
|
123
156
|
}
|
|
124
157
|
});
|
|
125
158
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
159
|
+
function x(e) {
|
|
160
|
+
return f(), e();
|
|
128
161
|
}
|
|
129
162
|
//#endregion
|
|
130
|
-
export {
|
|
163
|
+
export { p as RESALE_QUERY_KEY, x as refreshResaleRead, g as useResaleBrowse, m as useResaleClient, b as useResaleMutation, h as useResaleOwnedPhotos, _ as useResalePublicListing, y as useResaleReports, v as useResaleSeller };
|
|
131
164
|
|
|
132
165
|
//# sourceMappingURL=useResale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResale.js","names":[],"sources":["../../../src/coolandlovely/hooks/useResale.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { DocumentNode } from 'graphql';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql/fetch';\nimport { useCoolAndLovely } from '../context';\nimport { resaleRequest } from '../api/resaleTransport';\nimport {\n CooResaleBrowseDocument,\n CooResalePublicDetailDocument,\n CooResaleSellerDocument,\n CooResaleOwnReportsDocument,\n type CooResaleBrowseQuery,\n type CooResaleBrowseQueryVariables,\n type CooResalePublicDetailQuery,\n type CooResaleSellerQuery,\n type CooResaleOwnReportsQuery,\n} from '../../generated/wspace-operations';\n\nexport type {\n CooResaleShopFieldsFragment as ResaleShop,\n CooResaleOwnListingFieldsFragment as ResaleOwnListing,\n CooResalePublicFieldsFragment as ResalePublicListing,\n} from '../../generated/wspace-operations';\n\nexport const RESALE_QUERY_KEY = ['coolandlovely', 'resale'] as const;\nexport const RESALE_PAGE_SIZE = 20;\n\
|
|
1
|
+
{"version":3,"file":"useResale.js","names":[],"sources":["../../../src/coolandlovely/hooks/useResale.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport type { DocumentNode } from 'graphql';\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql/fetch';\nimport { useCoolAndLovely } from '../context';\nimport { resaleRequest } from '../api/resaleTransport';\nimport {\n CooResaleBrowseDocument,\n CooResalePublicDetailDocument,\n CooResaleSellerDocument,\n CooResaleOwnReportsDocument,\n CooResaleOwnedPhotosDocument,\n type CooResaleBrowseQuery,\n type CooResaleBrowseQueryVariables,\n type CooResalePublicDetailQuery,\n type CooResaleSellerQuery,\n type CooResaleOwnReportsQuery,\n type CooResaleOwnedPhotosQuery,\n} from '../../generated/wspace-operations';\n\nexport type {\n CooResaleShopFieldsFragment as ResaleShop,\n CooResaleOwnListingFieldsFragment as ResaleOwnListing,\n CooResalePublicFieldsFragment as ResalePublicListing,\n} from '../../generated/wspace-operations';\n\nexport const RESALE_QUERY_KEY = ['coolandlovely', 'resale'] as const;\nexport const RESALE_PAGE_SIZE = 20;\n\nexport function useResaleClient() {\n const {\n apiGatewayUrl,\n authToken,\n currentUser,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n } = useCoolAndLovely();\n const actorId = currentUser?.id;\n const lifetime = useMemo(\n () => ({ controller: new AbortController() }),\n [apiGatewayUrl, authToken, actorId, workspaceId, tenantId, organizationId, projectId]\n );\n useEffect(() => {\n // StrictMode and hidden-tree effect replay reuse the captured scope capsule.\n // Renew only that capsule after cleanup; old scopes stay independently aborted.\n if (lifetime.controller.signal.aborted) lifetime.controller = new AbortController();\n const controller = lifetime.controller;\n return () => controller.abort();\n }, [lifetime]);\n // Only nonsecret context identifiers belong in query keys. Bearers never do.\n const key = [\n ...RESALE_QUERY_KEY,\n apiGatewayUrl,\n actorId,\n workspaceId,\n tenantId,\n organizationId,\n projectId,\n ] as const;\n const ready = Boolean(apiGatewayUrl && authToken && actorId && workspaceId);\n const request = <T>(\n document: DocumentNode,\n variables: Record<string, unknown>,\n signal = lifetime.controller.signal\n ): Promise<T> => {\n if (!apiGatewayUrl || !authToken || !actorId || !workspaceId)\n throw new Error('Choose an account and workspace before continuing.');\n return resaleRequest<T>(\n { apiGatewayUrl, authToken, actorId, workspaceId, tenantId, organizationId, projectId },\n document,\n variables,\n signal\n );\n };\n return { request, ready, key, actorId, workspaceId };\n}\n\nexport function useResaleOwnedPhotos(page: number, folderPage: number, folderId?: string) {\n const { request, ready, key, actorId, workspaceId } = useResaleClient();\n const query = useQuery({\n queryKey: [...key, 'owned-photos', folderId, page, folderPage],\n enabled: ready,\n retry: false,\n staleTime: 0,\n queryFn: ({ signal }) =>\n request<CooResaleOwnedPhotosQuery>(\n CooResaleOwnedPhotosDocument,\n {\n actorId,\n folderId,\n pagination: { limit: RESALE_PAGE_SIZE, offset: page * RESALE_PAGE_SIZE },\n folderPagination: { limit: RESALE_PAGE_SIZE, offset: folderPage * RESALE_PAGE_SIZE },\n },\n signal\n ),\n });\n return { ...query, actorId, workspaceId };\n}\n\nexport function useResaleBrowse(input: CooResaleBrowseQueryVariables['input']) {\n const { request, ready, key } = useResaleClient();\n return useQuery({\n queryKey: [...key, 'browse', input],\n enabled: ready,\n retry: false,\n staleTime: 0,\n queryFn: ({ signal }) =>\n request<CooResaleBrowseQuery>(CooResaleBrowseDocument, { input }, signal),\n });\n}\n\nexport function useResalePublicListing(id: string | undefined) {\n const { request, ready, key } = useResaleClient();\n return useQuery({\n queryKey: [...key, 'public-detail', id],\n enabled: ready && Boolean(id),\n retry: false,\n staleTime: 0,\n queryFn: ({ signal }) => {\n if (!id) throw new Error('Choose a resale listing.');\n return request<CooResalePublicDetailQuery>(CooResalePublicDetailDocument, { id }, signal);\n },\n });\n}\n\nexport function useResaleSeller(page: number) {\n const { request, ready, key } = useResaleClient();\n return useQuery({\n queryKey: [...key, 'seller', page],\n enabled: ready,\n retry: false,\n staleTime: 0,\n queryFn: ({ signal }) =>\n request<CooResaleSellerQuery>(\n CooResaleSellerDocument,\n { pagination: { limit: RESALE_PAGE_SIZE, offset: page * RESALE_PAGE_SIZE } },\n signal\n ),\n });\n}\n\nexport function useResaleReports(page: number) {\n const { request, ready, key } = useResaleClient();\n return useQuery({\n queryKey: [...key, 'reports', page],\n enabled: ready,\n retry: false,\n staleTime: 0,\n queryFn: ({ signal }) =>\n request<CooResaleOwnReportsQuery>(\n CooResaleOwnReportsDocument,\n { pagination: { limit: RESALE_PAGE_SIZE, offset: page * RESALE_PAGE_SIZE } },\n signal\n ),\n });\n}\n\nexport function useResaleMutation<TData, TVariables extends Record<string, unknown>>(\n document: DocumentNode\n) {\n const { request } = useResaleClient();\n const queries = useQueryClient();\n return useMutation<TData, Error, TVariables>({\n retry: false,\n mutationFn: (variables) => request<TData>(document, variables),\n // A committed write can lose its response or fail the post-context check.\n // Refresh reads on every settlement, without replaying the mutation.\n onSettled: async () => {\n clearGraphqlFetchResponseCache();\n await queries.invalidateQueries({ queryKey: RESALE_QUERY_KEY });\n },\n });\n}\n\nexport function refreshResaleRead<T>(refetch: () => Promise<T>): Promise<T> {\n clearGraphqlFetchResponseCache();\n return refetch();\n}\n"],"mappings":";;;;;;;;AA0BA,IAAa,IAAmB,CAAC,iBAAiB,QAAQ;AAG1D,SAAgB,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MAAM,EAAQ,kBAAkB,EAAE,UAAU,EAAiB,CAAC;EAChE;CACF,CAAC;AACH;AAEA,SAAgB,EAAqB,GAAuC;CAE1E,OADA,EAA+B,GACxB,EAAQ;AACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResaleSellerPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/resale/ResaleSellerPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResaleSellerPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/resale/ResaleSellerPage.tsx"],"names":[],"mappings":"AA4NA,wBAAgB,gBAAgB,gCAuI/B"}
|