@burdenoff/microfe-coolandlovely 2026.1117.1 → 2026.1123.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/coolandlovely/CoolAndLovelyRoot.js +111 -87
- package/dist/coolandlovely/CoolAndLovelyRoutes.js +57 -45
- package/dist/coolandlovely/components/ImageUploadField.js +126 -89
- package/dist/coolandlovely/components/ResaleListingEditor.js +114 -68
- package/dist/coolandlovely/hooks/useDirectMessages.d.ts +83 -0
- package/dist/coolandlovely/hooks/useDirectMessages.js +152 -0
- package/dist/coolandlovely/hooks/useFulfilmentMonetizationApi.d.ts +288 -0
- package/dist/coolandlovely/hooks/useFulfilmentMonetizationApi.js +287 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.js +233 -134
- package/dist/coolandlovely/pages/commerce/BrandAdsPage.d.ts +7 -0
- package/dist/coolandlovely/pages/commerce/BrandAdsPage.js +264 -0
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.js +225 -156
- package/dist/coolandlovely/pages/commerce/CartPage.js +161 -136
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.js +254 -137
- package/dist/coolandlovely/pages/commerce/OrdersPage.js +186 -131
- package/dist/coolandlovely/pages/commerce/TryAtHomePage.d.ts +8 -0
- package/dist/coolandlovely/pages/commerce/TryAtHomePage.js +336 -0
- package/dist/coolandlovely/pages/messages/DirectMessagesPage.d.ts +9 -0
- package/dist/coolandlovely/pages/messages/DirectMessagesPage.js +282 -0
- package/dist/coolandlovely/pages/profile/StyleProfilePage.js +10 -1
- package/dist/coolandlovely/pages/resale/ResaleListingPage.js +189 -79
- package/dist/coolandlovely/pages/resale/ResaleSellerPage.js +224 -105
- package/dist/coolandlovely/types/commerce.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,171 +5,208 @@ import { cn as i } from "../utils/cn.js";
|
|
|
5
5
|
import { uploadVisibility as a } from "../hooks/uploadVisibility.js";
|
|
6
6
|
import { useTr as o } from "../hooks/useTr.js";
|
|
7
7
|
import { useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
8
|
-
import {
|
|
9
|
-
import { jsx as
|
|
8
|
+
import { Camera as d, ImagePlus as f, Loader2 as p, UploadCloud as m, X as h } from "lucide-react";
|
|
9
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
10
|
// src/coolandlovely/components/ImageUploadField.tsx
|
|
11
|
-
var
|
|
12
|
-
function
|
|
11
|
+
var v = 10485760;
|
|
12
|
+
function y(e) {
|
|
13
13
|
if (e < 1024) return `${e} B`;
|
|
14
14
|
let t = e / 1024;
|
|
15
15
|
return t < 1024 ? `${t < 10 ? t.toFixed(1) : Math.round(t)} KB` : `${(t / 1024).toFixed(1)} MB`;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
let O = o(), { apiGatewayUrl: k } = t(), A = l(null), j = c(), [
|
|
17
|
+
var b = ({ label: b, value: x, onChange: S, folder: ee, allowWorkspace: C = !1, hint: te, accept: w = "image/*", disabled: T = !1, className: E, aspect: D = "square" }) => {
|
|
18
|
+
let O = o(), { apiGatewayUrl: k } = t(), A = l(null), j = l(null), M = c(), [N, P] = u(!1), [F, I] = u(null), [L, R] = u(null), [z, B] = u(null), [V, H] = u(!1), [U, W] = u(), [G, K] = u("PRIVATE"), q = l(!1);
|
|
19
19
|
s(() => () => {
|
|
20
|
-
|
|
21
|
-
}, [
|
|
22
|
-
let
|
|
23
|
-
if (T ||
|
|
20
|
+
z && URL.revokeObjectURL(z);
|
|
21
|
+
}, [z]);
|
|
22
|
+
let J = r(N ? void 0 : x || void 0).data ?? null, Y = T || N, X = async (e) => {
|
|
23
|
+
if (T || q.current) return;
|
|
24
24
|
if (!e.type.startsWith("image/")) {
|
|
25
|
-
|
|
25
|
+
W("Please choose an image file (JPG or PNG).");
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
if (e.size >
|
|
29
|
-
|
|
28
|
+
if (e.size > v) {
|
|
29
|
+
W("That image is over 10 MB — please choose a smaller file.");
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
W(void 0), R(e.name);
|
|
33
33
|
let t = URL.createObjectURL(e);
|
|
34
|
-
|
|
34
|
+
B(t), I({
|
|
35
35
|
loaded: 0,
|
|
36
36
|
total: e.size,
|
|
37
37
|
pct: 0
|
|
38
|
-
}),
|
|
38
|
+
}), q.current = !0, P(!0);
|
|
39
39
|
try {
|
|
40
|
-
|
|
40
|
+
S((await n(e, k, ee, I, C ? G : "PRIVATE")).id);
|
|
41
41
|
} catch (e) {
|
|
42
|
-
|
|
42
|
+
W(e instanceof Error ? e.message : "Upload failed — please try again.");
|
|
43
43
|
} finally {
|
|
44
|
-
|
|
44
|
+
q.current = !1, P(!1), I(null), R(null), B(null);
|
|
45
45
|
}
|
|
46
|
-
}, X = (e) => {
|
|
47
|
-
let t = e.target.files?.[0];
|
|
48
|
-
e.target.value = "", t && Y(t);
|
|
49
46
|
}, Z = (e) => {
|
|
50
|
-
|
|
47
|
+
let t = e.target.files?.[0];
|
|
48
|
+
e.target.value = "", t && X(t);
|
|
49
|
+
}, ne = async () => {
|
|
50
|
+
if (Y) return;
|
|
51
|
+
let e = window.__burdenoffCapturePhoto;
|
|
52
|
+
if (typeof e == "function") try {
|
|
53
|
+
let t = await e();
|
|
54
|
+
if (t) {
|
|
55
|
+
await X(t);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
W(e instanceof Error ? e.message : "Camera capture cancelled or unavailable.");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
j.current?.click();
|
|
63
|
+
}, re = (e) => {
|
|
64
|
+
if (e.preventDefault(), H(!1), Y) return;
|
|
51
65
|
let t = e.dataTransfer.files?.[0];
|
|
52
|
-
t &&
|
|
66
|
+
t && X(t);
|
|
53
67
|
}, Q = (e) => {
|
|
54
|
-
e.preventDefault(),
|
|
55
|
-
},
|
|
56
|
-
e.preventDefault(),
|
|
57
|
-
}, $ =
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
label:
|
|
60
|
-
htmlFor:
|
|
61
|
-
hint:
|
|
62
|
-
error:
|
|
68
|
+
e.preventDefault(), Y || H(!0);
|
|
69
|
+
}, ie = (e) => {
|
|
70
|
+
e.preventDefault(), H(!1);
|
|
71
|
+
}, $ = F?.pct ?? 0;
|
|
72
|
+
return /* @__PURE__ */ _(e, {
|
|
73
|
+
label: b,
|
|
74
|
+
htmlFor: M,
|
|
75
|
+
hint: te,
|
|
76
|
+
error: U,
|
|
63
77
|
className: E,
|
|
64
78
|
children: [
|
|
65
|
-
|
|
79
|
+
C ? /* @__PURE__ */ _("label", {
|
|
66
80
|
className: "mb-2 block text-sm text-text-secondary",
|
|
67
|
-
children: [O("coolandlovely.upload.audience", "New image audience"), /* @__PURE__ */
|
|
68
|
-
value:
|
|
69
|
-
disabled:
|
|
70
|
-
onChange: (e) =>
|
|
81
|
+
children: [O("coolandlovely.upload.audience", "New image audience"), /* @__PURE__ */ _("select", {
|
|
82
|
+
value: G,
|
|
83
|
+
disabled: Y,
|
|
84
|
+
onChange: (e) => K(a(e.target.value)),
|
|
71
85
|
className: "ml-2 rounded-lg border border-border-seam bg-bg-surface p-2 text-text-primary",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
86
|
+
children: [/* @__PURE__ */ g("option", {
|
|
73
87
|
value: "PRIVATE",
|
|
74
88
|
children: O("coolandlovely.upload.private", "Only me")
|
|
75
|
-
}), /* @__PURE__ */
|
|
89
|
+
}), /* @__PURE__ */ g("option", {
|
|
76
90
|
value: "WORKSPACE",
|
|
77
91
|
children: O("coolandlovely.upload.workspace", "Workspace members")
|
|
78
92
|
})]
|
|
79
93
|
})]
|
|
80
94
|
}) : null,
|
|
81
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ g("div", {
|
|
82
96
|
onDragEnter: Q,
|
|
83
97
|
onDragOver: Q,
|
|
84
|
-
onDragLeave:
|
|
85
|
-
onDrop:
|
|
86
|
-
children:
|
|
98
|
+
onDragLeave: ie,
|
|
99
|
+
onDrop: re,
|
|
100
|
+
children: N ? /* @__PURE__ */ _("div", {
|
|
87
101
|
className: "flex items-center gap-3 rounded-lg border border-border-seam bg-bg-surface p-3",
|
|
88
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ g("div", {
|
|
89
103
|
className: "flex h-14 w-14 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-bg-sunken",
|
|
90
|
-
children:
|
|
91
|
-
src:
|
|
104
|
+
children: z ? /* @__PURE__ */ g("img", {
|
|
105
|
+
src: z,
|
|
92
106
|
alt: "",
|
|
93
107
|
className: "h-full w-full object-cover"
|
|
94
|
-
}) : /* @__PURE__ */
|
|
95
|
-
}), /* @__PURE__ */
|
|
108
|
+
}) : /* @__PURE__ */ g(p, { className: "h-5 w-5 animate-spin text-text-secondary" })
|
|
109
|
+
}), /* @__PURE__ */ _("div", {
|
|
96
110
|
className: "min-w-0 flex-1",
|
|
97
111
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ g("p", {
|
|
99
113
|
className: "truncate text-sm font-medium text-text-primary",
|
|
100
|
-
children:
|
|
114
|
+
children: L ?? "Uploading…"
|
|
101
115
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ g("div", {
|
|
103
117
|
className: "mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-bg-sunken",
|
|
104
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ g("div", {
|
|
105
119
|
className: "h-full rounded-full bg-accent-primary transition-[width] duration-200",
|
|
106
120
|
style: { width: `${$}%` }
|
|
107
121
|
})
|
|
108
122
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ _("p", {
|
|
110
124
|
className: "mt-1 text-xs text-text-secondary tabular-nums",
|
|
111
125
|
children: [
|
|
112
126
|
$,
|
|
113
127
|
"%",
|
|
114
|
-
|
|
128
|
+
F ? ` · ${y(F.loaded)} of ${y(F.total)}` : ""
|
|
115
129
|
]
|
|
116
130
|
})
|
|
117
131
|
]
|
|
118
132
|
})]
|
|
119
|
-
}) :
|
|
133
|
+
}) : J ? /* @__PURE__ */ _("div", {
|
|
120
134
|
className: "relative overflow-hidden rounded-lg border border-border-seam bg-bg-sunken",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
122
|
-
src:
|
|
135
|
+
children: [/* @__PURE__ */ g("img", {
|
|
136
|
+
src: J,
|
|
123
137
|
alt: "",
|
|
124
138
|
className: i("w-full object-cover", D === "wide" ? "aspect-video" : "aspect-square max-h-64")
|
|
125
|
-
}), /* @__PURE__ */
|
|
139
|
+
}), /* @__PURE__ */ _("div", {
|
|
126
140
|
className: "absolute inset-x-0 bottom-0 flex justify-end gap-2 bg-gradient-to-t from-bg-canvas/85 to-transparent p-2",
|
|
127
|
-
children: [/* @__PURE__ */
|
|
141
|
+
children: [/* @__PURE__ */ _("button", {
|
|
128
142
|
type: "button",
|
|
129
|
-
disabled:
|
|
143
|
+
disabled: Y,
|
|
130
144
|
onClick: () => A.current?.click(),
|
|
131
145
|
className: "inline-flex items-center gap-1.5 rounded-lg bg-bg-surface/90 px-3 py-1.5 text-sm font-medium text-text-primary shadow-sm backdrop-blur transition-colors hover:bg-bg-surface disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
133
|
-
}), /* @__PURE__ */
|
|
146
|
+
children: [/* @__PURE__ */ g(f, { className: "h-4 w-4" }), " Replace"]
|
|
147
|
+
}), /* @__PURE__ */ _("button", {
|
|
134
148
|
type: "button",
|
|
135
149
|
disabled: T,
|
|
136
|
-
onClick: () =>
|
|
150
|
+
onClick: () => S(""),
|
|
137
151
|
className: "inline-flex items-center gap-1 rounded-lg bg-bg-surface/90 px-3 py-1.5 text-sm text-text-secondary shadow-sm backdrop-blur transition-colors hover:bg-status-error-bg-subtle hover:text-status-error-text disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
138
|
-
children: [/* @__PURE__ */ h
|
|
152
|
+
children: [/* @__PURE__ */ g(h, { className: "h-4 w-4" }), " Remove"]
|
|
139
153
|
})]
|
|
140
154
|
})]
|
|
141
|
-
}) : /* @__PURE__ */
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
155
|
+
}) : /* @__PURE__ */ _("div", {
|
|
156
|
+
className: "space-y-2",
|
|
157
|
+
children: [/* @__PURE__ */ _("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
disabled: Y,
|
|
160
|
+
onClick: () => A.current?.click(),
|
|
161
|
+
className: i("flex min-h-40 w-full flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-6 text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-50", V ? "border-accent-primary bg-[var(--color-accent-soft)]" : "border-border-seam hover:border-accent-primary/60 hover:bg-bg-sunken"),
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ g(m, {
|
|
164
|
+
className: "h-8 w-8 text-text-secondary",
|
|
165
|
+
"aria-hidden": "true"
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ g("span", {
|
|
168
|
+
className: "text-sm font-medium text-text-primary",
|
|
169
|
+
children: "Drag & drop an image here, or click to browse"
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ g("span", {
|
|
172
|
+
className: "text-xs text-text-secondary",
|
|
173
|
+
children: "JPG · PNG · up to 10 MB"
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
}), /* @__PURE__ */ _("button", {
|
|
177
|
+
type: "button",
|
|
178
|
+
disabled: Y,
|
|
179
|
+
onClick: () => void ne(),
|
|
180
|
+
"data-testid": "image-upload-camera-btn",
|
|
181
|
+
className: "inline-flex w-full items-center justify-center gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
|
|
182
|
+
children: [/* @__PURE__ */ g(d, {
|
|
183
|
+
className: "h-4 w-4",
|
|
149
184
|
"aria-hidden": "true"
|
|
150
|
-
}),
|
|
151
|
-
|
|
152
|
-
className: "text-sm font-medium text-text-primary",
|
|
153
|
-
children: "Drag & drop an image here, or click to browse"
|
|
154
|
-
}),
|
|
155
|
-
/* @__PURE__ */ h("span", {
|
|
156
|
-
className: "text-xs text-text-secondary",
|
|
157
|
-
children: "JPG · PNG · up to 10 MB"
|
|
158
|
-
})
|
|
159
|
-
]
|
|
185
|
+
}), O("coolandlovely.upload.takePhoto", "Take photo with camera")]
|
|
186
|
+
})]
|
|
160
187
|
})
|
|
161
188
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ g("input", {
|
|
163
190
|
ref: A,
|
|
164
|
-
id:
|
|
191
|
+
id: M,
|
|
165
192
|
type: "file",
|
|
166
193
|
accept: w,
|
|
167
|
-
disabled:
|
|
194
|
+
disabled: Y,
|
|
195
|
+
className: "sr-only",
|
|
196
|
+
"aria-label": b,
|
|
197
|
+
onChange: Z
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ g("input", {
|
|
200
|
+
ref: j,
|
|
201
|
+
type: "file",
|
|
202
|
+
accept: "image/*",
|
|
203
|
+
capture: "environment",
|
|
204
|
+
disabled: Y,
|
|
168
205
|
className: "sr-only",
|
|
169
|
-
"aria-label":
|
|
170
|
-
onChange:
|
|
206
|
+
"aria-label": `${b} camera capture`,
|
|
207
|
+
onChange: Z
|
|
171
208
|
})
|
|
172
209
|
]
|
|
173
210
|
});
|
|
174
211
|
};
|
|
175
|
-
export {
|
|
212
|
+
export { b as ImageUploadField };
|
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
import { useTr as e } from "../hooks/useTr.js";
|
|
2
2
|
import { CooResaleResolveCreateRequestDocument as t, CooResaleSaveListingDocument as n } from "../../generated/wspace-operations.js";
|
|
3
|
-
import { useResaleClient as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useResaleClient as r, useResaleMutation as i } from "../hooks/useResale.js";
|
|
4
|
+
import { useAssistResaleListing as a } from "../hooks/useFulfilmentMonetizationApi.js";
|
|
5
|
+
import { RESALE_CATEGORIES as o, RESALE_CONDITIONS as s, parseResalePrice as c, resalePriceInput as l } from "../utils/resalePresentation.js";
|
|
6
|
+
import { clearResaleIntent as u, dispatchResaleIntent as d, prepareResaleIntent as ee, readResaleIntent as f, resaleIntentKey as te } from "../utils/resaleCreateIntent.js";
|
|
7
|
+
import { ResalePhotoPicker as ne } from "./ResalePhotoPicker.js";
|
|
8
|
+
import { useEffect as re, useRef as ie, useState as p } from "react";
|
|
8
9
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
10
|
import { Button as g } from "@burdenoff/fe-libs/ui";
|
|
10
11
|
// src/coolandlovely/components/ResaleListingEditor.tsx
|
|
11
12
|
var _ = "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-text-primary";
|
|
12
13
|
function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
13
|
-
let x = e(), { key:
|
|
14
|
-
|
|
14
|
+
let x = e(), { key: ae } = r(), S = te(ae), [C, w] = p(v?.title ?? ""), [T, E] = p(v?.description ?? ""), [D, oe] = p(v?.size ?? ""), [O, k] = p(v?.category ?? "TOPS"), [A, j] = p(v?.condition ?? "GOOD"), [M, N] = p(v?.currency ?? "USD"), [P, F] = p(v ? l(v.priceMinor, v.currency) : ""), [I, L] = p(v?.photoFileIds ?? []), [R, z] = p(null), [B, V] = p(!1), [H, se] = p(null), U = a(), W = ie(!1), [G, K] = p(!1), [q, J] = p(null), [Y, ce] = p(!v), X = q?.phase === "dispatched", Z = v?.id;
|
|
15
|
+
re(() => {
|
|
15
16
|
if (Z) return;
|
|
16
17
|
let e = new AbortController(), t = !0;
|
|
17
18
|
return (async () => {
|
|
18
19
|
try {
|
|
19
20
|
if (!navigator.locks) throw Error("Safe request coordination is unavailable.");
|
|
20
|
-
await navigator.locks.request(
|
|
21
|
-
t && J(
|
|
21
|
+
await navigator.locks.request(S, { signal: e.signal }, () => {
|
|
22
|
+
t && J(ee(localStorage, S));
|
|
22
23
|
});
|
|
23
24
|
} catch {
|
|
24
|
-
t && (K(!0),
|
|
25
|
+
t && (K(!0), z({
|
|
25
26
|
key: "coolandlovely.resale.editor.prepareFailed",
|
|
26
27
|
fallback: "The listing request could not be prepared safely. Close this form before trying again."
|
|
27
28
|
}));
|
|
28
29
|
} finally {
|
|
29
|
-
t &&
|
|
30
|
+
t && ce(!1);
|
|
30
31
|
}
|
|
31
32
|
})(), () => {
|
|
32
33
|
t = !1, e.abort();
|
|
33
34
|
};
|
|
34
|
-
}, [
|
|
35
|
-
let Q =
|
|
35
|
+
}, [S, Z]);
|
|
36
|
+
let Q = i(n), le = i(t), $ = async (e) => {
|
|
36
37
|
if (!navigator.locks) throw Error("This browser cannot safely coordinate listing requests. Use a browser with Web Locks support.");
|
|
37
|
-
await navigator.locks.request(
|
|
38
|
+
await navigator.locks.request(S, { ifAvailable: !0 }, async (t) => {
|
|
38
39
|
if (!t) throw Error("Another tab is processing this listing request.");
|
|
39
40
|
await e();
|
|
40
41
|
});
|
|
41
|
-
},
|
|
42
|
-
if (e.preventDefault(), W.current ||
|
|
42
|
+
}, ue = async (e) => {
|
|
43
|
+
if (e.preventDefault(), W.current || B || Y || G || X || b) return;
|
|
43
44
|
let t;
|
|
44
45
|
try {
|
|
45
|
-
if (t =
|
|
46
|
+
if (t = c(P, M), !C.trim() || !T.trim() || !D.trim() || I.length < 1 || I.length > 10) throw Error("Enter all listing details and choose between one and ten photos.");
|
|
46
47
|
} catch (e) {
|
|
47
|
-
|
|
48
|
+
z({
|
|
48
49
|
key: "coolandlovely.resale.editor.invalidListing",
|
|
49
50
|
fallback: e instanceof Error ? e.message : "Check listing details."
|
|
50
51
|
});
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
let n = {
|
|
54
|
-
title:
|
|
55
|
-
description:
|
|
56
|
-
size:
|
|
57
|
-
category:
|
|
58
|
-
condition:
|
|
59
|
-
currency:
|
|
55
|
+
title: C.trim(),
|
|
56
|
+
description: T.trim(),
|
|
57
|
+
size: D.trim(),
|
|
58
|
+
category: O,
|
|
59
|
+
condition: A,
|
|
60
|
+
currency: M,
|
|
60
61
|
priceMinor: t,
|
|
61
|
-
photoFileIds:
|
|
62
|
+
photoFileIds: I
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
+
V(!0), W.current = !0, z(null);
|
|
64
65
|
try {
|
|
65
66
|
v ? await Q.mutateAsync({
|
|
66
67
|
input: n,
|
|
@@ -69,24 +70,24 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
69
70
|
}) : await $(async () => {
|
|
70
71
|
if (!q) throw Error("The prepared listing request is missing.");
|
|
71
72
|
let e = q.requestId;
|
|
72
|
-
if (
|
|
73
|
+
if (d(localStorage, S, e), J({
|
|
73
74
|
requestId: e,
|
|
74
75
|
phase: "dispatched"
|
|
75
76
|
}), !(await Q.mutateAsync({
|
|
76
77
|
input: n,
|
|
77
78
|
requestId: e
|
|
78
79
|
})).cooSaveResaleListing.id) throw Error("Listing result is missing.");
|
|
79
|
-
|
|
80
|
+
u(localStorage, S, e), J(null);
|
|
80
81
|
}), y();
|
|
81
82
|
} catch {
|
|
82
83
|
K(!0);
|
|
83
84
|
let e = null;
|
|
84
85
|
if (!v) try {
|
|
85
|
-
e =
|
|
86
|
+
e = f(localStorage, S), J(e);
|
|
86
87
|
} catch {
|
|
87
88
|
K(!0);
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
z(v ? {
|
|
90
91
|
key: "coolandlovely.resale.editor.editUnconfirmed",
|
|
91
92
|
fallback: "The save was not confirmed. Close this editor and refresh the listing before editing again."
|
|
92
93
|
} : e?.phase === "dispatched" ? {
|
|
@@ -97,29 +98,29 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
97
98
|
fallback: "The save was not confirmed. Close this form and refresh the current listings before starting another request."
|
|
98
99
|
});
|
|
99
100
|
} finally {
|
|
100
|
-
|
|
101
|
+
V(!1), W.current = !1;
|
|
101
102
|
}
|
|
102
|
-
},
|
|
103
|
-
if (!(W.current ||
|
|
104
|
-
W.current = !0,
|
|
103
|
+
}, de = async () => {
|
|
104
|
+
if (!(W.current || B)) {
|
|
105
|
+
W.current = !0, V(!0);
|
|
105
106
|
try {
|
|
106
107
|
await $(async () => {
|
|
107
|
-
let e =
|
|
108
|
+
let e = f(localStorage, S);
|
|
108
109
|
if (!e) {
|
|
109
110
|
J(null), y();
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
let t = e.requestId, n = (await
|
|
113
|
+
let t = e.requestId, n = (await le.mutateAsync({ requestId: t })).cooResolveResaleCreateRequest;
|
|
113
114
|
if (!n.listing?.id && !n.withdrawn) throw Error("Request resolution is incomplete.");
|
|
114
|
-
|
|
115
|
+
u(localStorage, S, t), J(null), y();
|
|
115
116
|
});
|
|
116
117
|
} catch {
|
|
117
|
-
|
|
118
|
+
z({
|
|
118
119
|
key: "coolandlovely.resale.editor.resolveUnconfirmed",
|
|
119
120
|
fallback: "The pending request is still unresolved. Keep this account and workspace selected, then try resolving its status again. No listing was resubmitted."
|
|
120
121
|
});
|
|
121
122
|
} finally {
|
|
122
|
-
|
|
123
|
+
V(!1), W.current = !1;
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
};
|
|
@@ -127,7 +128,7 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
127
128
|
"data-resale-request-id": v ? void 0 : q?.requestId,
|
|
128
129
|
"data-resale-request-phase": v ? void 0 : q?.phase,
|
|
129
130
|
onSubmit: (e) => {
|
|
130
|
-
|
|
131
|
+
ue(e);
|
|
131
132
|
},
|
|
132
133
|
"aria-label": v ? x("coolandlovely.resale.editor.editLabel", "Edit resale listing") : x("coolandlovely.resale.editor.createLabel", "Create resale listing"),
|
|
133
134
|
className: "space-y-4",
|
|
@@ -136,7 +137,7 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
136
137
|
className: "text-sm text-text-secondary",
|
|
137
138
|
children: x("coolandlovely.resale.editor.draftNotice", "Saving creates a private draft and clears any previous review and publication. Submit the draft for review separately.")
|
|
138
139
|
}),
|
|
139
|
-
b && !
|
|
140
|
+
b && !B && /* @__PURE__ */ m("p", {
|
|
140
141
|
role: "alert",
|
|
141
142
|
className: "text-status-error-text",
|
|
142
143
|
children: x("coolandlovely.resale.editor.changed", "This listing changed while the editor was open. Your unsaved fields are preserved. Close this editor and refresh its current status before editing again.")
|
|
@@ -146,17 +147,62 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
146
147
|
children: x("coolandlovely.resale.editor.preparing", "Preparing the listing form…")
|
|
147
148
|
}),
|
|
148
149
|
/* @__PURE__ */ h("fieldset", {
|
|
149
|
-
disabled:
|
|
150
|
+
disabled: B || Y || G || X,
|
|
150
151
|
className: "space-y-4",
|
|
151
152
|
children: [
|
|
153
|
+
/* @__PURE__ */ h("div", {
|
|
154
|
+
className: "flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border-seam bg-bg-sunken/50 p-3",
|
|
155
|
+
children: [/* @__PURE__ */ m("p", {
|
|
156
|
+
className: "text-xs text-text-secondary",
|
|
157
|
+
children: x("coolandlovely.resale.editor.aiAssistHint", "Need help writing copy or pricing? Generate a grounded draft from live comparables.")
|
|
158
|
+
}), /* @__PURE__ */ m(g, {
|
|
159
|
+
type: "button",
|
|
160
|
+
variant: "outline",
|
|
161
|
+
disabled: U.isPending,
|
|
162
|
+
onClick: () => {
|
|
163
|
+
U.mutate({
|
|
164
|
+
titleHint: C.trim() || void 0,
|
|
165
|
+
category: O,
|
|
166
|
+
condition: A,
|
|
167
|
+
size: D.trim() || "M",
|
|
168
|
+
currency: M,
|
|
169
|
+
photoCount: I.length
|
|
170
|
+
}, { onSuccess: (e) => {
|
|
171
|
+
se(e), C.trim() || w(e.suggestedTitle), T.trim() || E(e.suggestedDescription), P.trim() || F(l(e.suggestedPriceMinor, e.currency));
|
|
172
|
+
} });
|
|
173
|
+
},
|
|
174
|
+
children: U.isPending ? "Drafting…" : x("coolandlovely.resale.editor.aiAssist", "AI Listing Assist")
|
|
175
|
+
})]
|
|
176
|
+
}),
|
|
177
|
+
H && /* @__PURE__ */ h("div", {
|
|
178
|
+
className: "space-y-1 rounded-lg border border-border-seam bg-bg-surface p-3 text-xs text-text-secondary",
|
|
179
|
+
children: [/* @__PURE__ */ h("p", {
|
|
180
|
+
className: "font-medium text-text-primary",
|
|
181
|
+
children: [
|
|
182
|
+
"Suggested range:",
|
|
183
|
+
" ",
|
|
184
|
+
l(H.priceRangeMinMinor, H.currency),
|
|
185
|
+
"–",
|
|
186
|
+
l(H.priceRangeMaxMinor, H.currency),
|
|
187
|
+
" ",
|
|
188
|
+
H.currency,
|
|
189
|
+
" (",
|
|
190
|
+
H.comparableCount,
|
|
191
|
+
" comparables)"
|
|
192
|
+
]
|
|
193
|
+
}), /* @__PURE__ */ h("ul", {
|
|
194
|
+
className: "list-inside list-disc space-y-0.5",
|
|
195
|
+
children: [H.photoQualityChecks.map((e) => /* @__PURE__ */ m("li", { children: e }, e)), H.backgroundCleanupTips.slice(0, 2).map((e) => /* @__PURE__ */ m("li", { children: e }, e))]
|
|
196
|
+
})]
|
|
197
|
+
}),
|
|
152
198
|
/* @__PURE__ */ h("label", {
|
|
153
199
|
className: "grid gap-1",
|
|
154
200
|
children: [x("coolandlovely.resale.editor.title", "Title"), /* @__PURE__ */ m("input", {
|
|
155
201
|
className: _,
|
|
156
202
|
required: !0,
|
|
157
203
|
maxLength: 255,
|
|
158
|
-
value:
|
|
159
|
-
onChange: (e) =>
|
|
204
|
+
value: C,
|
|
205
|
+
onChange: (e) => w(e.target.value)
|
|
160
206
|
})]
|
|
161
207
|
}),
|
|
162
208
|
/* @__PURE__ */ h("label", {
|
|
@@ -165,8 +211,8 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
165
211
|
className: `${_} min-h-28`,
|
|
166
212
|
required: !0,
|
|
167
213
|
maxLength: 4e3,
|
|
168
|
-
value:
|
|
169
|
-
onChange: (e) =>
|
|
214
|
+
value: T,
|
|
215
|
+
onChange: (e) => E(e.target.value)
|
|
170
216
|
})]
|
|
171
217
|
}),
|
|
172
218
|
/* @__PURE__ */ h("div", {
|
|
@@ -176,9 +222,9 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
176
222
|
className: "grid gap-1",
|
|
177
223
|
children: [x("coolandlovely.resale.editor.category", "Category"), /* @__PURE__ */ m("select", {
|
|
178
224
|
className: _,
|
|
179
|
-
value:
|
|
180
|
-
onChange: (e) =>
|
|
181
|
-
children:
|
|
225
|
+
value: O,
|
|
226
|
+
onChange: (e) => k(e.target.value),
|
|
227
|
+
children: o.map((e) => /* @__PURE__ */ m("option", {
|
|
182
228
|
value: e,
|
|
183
229
|
children: e.replaceAll("_", " ")
|
|
184
230
|
}, e))
|
|
@@ -188,9 +234,9 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
188
234
|
className: "grid gap-1",
|
|
189
235
|
children: [x("coolandlovely.resale.editor.condition", "Condition"), /* @__PURE__ */ m("select", {
|
|
190
236
|
className: _,
|
|
191
|
-
value:
|
|
192
|
-
onChange: (e) =>
|
|
193
|
-
children:
|
|
237
|
+
value: A,
|
|
238
|
+
onChange: (e) => j(e.target.value),
|
|
239
|
+
children: s.map((e) => /* @__PURE__ */ m("option", {
|
|
194
240
|
value: e,
|
|
195
241
|
children: e.replaceAll("_", " ")
|
|
196
242
|
}, e))
|
|
@@ -202,16 +248,16 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
202
248
|
className: _,
|
|
203
249
|
required: !0,
|
|
204
250
|
maxLength: 80,
|
|
205
|
-
value:
|
|
206
|
-
onChange: (e) =>
|
|
251
|
+
value: D,
|
|
252
|
+
onChange: (e) => oe(e.target.value)
|
|
207
253
|
})]
|
|
208
254
|
}),
|
|
209
255
|
/* @__PURE__ */ h("label", {
|
|
210
256
|
className: "grid gap-1",
|
|
211
257
|
children: [x("coolandlovely.resale.editor.currency", "Currency"), /* @__PURE__ */ m("select", {
|
|
212
258
|
className: _,
|
|
213
|
-
value:
|
|
214
|
-
onChange: (e) =>
|
|
259
|
+
value: M,
|
|
260
|
+
onChange: (e) => N(e.target.value),
|
|
215
261
|
children: Intl.supportedValuesOf("currency").map((e) => /* @__PURE__ */ m("option", { children: e }, e))
|
|
216
262
|
})]
|
|
217
263
|
}),
|
|
@@ -222,16 +268,16 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
222
268
|
required: !0,
|
|
223
269
|
inputMode: "decimal",
|
|
224
270
|
maxLength: 32,
|
|
225
|
-
value:
|
|
226
|
-
onChange: (e) =>
|
|
271
|
+
value: P,
|
|
272
|
+
onChange: (e) => F(e.target.value)
|
|
227
273
|
})]
|
|
228
274
|
})
|
|
229
275
|
]
|
|
230
276
|
}),
|
|
231
|
-
/* @__PURE__ */ m(
|
|
232
|
-
selected:
|
|
233
|
-
onChange:
|
|
234
|
-
disabled:
|
|
277
|
+
/* @__PURE__ */ m(ne, {
|
|
278
|
+
selected: I,
|
|
279
|
+
onChange: L,
|
|
280
|
+
disabled: B || Y || G || X
|
|
235
281
|
})
|
|
236
282
|
]
|
|
237
283
|
}),
|
|
@@ -241,28 +287,28 @@ function v({ listing: v, onClose: y, changed: b = !1 }) {
|
|
|
241
287
|
children: [/* @__PURE__ */ m("p", { children: x("coolandlovely.resale.editor.pendingNotice", "A listing request remains pending for this account and context. Resolve it to recover its saved listing or permanently withdraw an uncommitted create. This never submits another listing.") }), /* @__PURE__ */ m(g, {
|
|
242
288
|
type: "button",
|
|
243
289
|
variant: "outline",
|
|
244
|
-
disabled:
|
|
290
|
+
disabled: B,
|
|
245
291
|
onClick: () => {
|
|
246
|
-
|
|
292
|
+
de();
|
|
247
293
|
},
|
|
248
294
|
children: x("coolandlovely.resale.editor.resolvePending", "Resolve pending listing request")
|
|
249
295
|
})]
|
|
250
296
|
}),
|
|
251
|
-
|
|
297
|
+
R && /* @__PURE__ */ m("p", {
|
|
252
298
|
role: "alert",
|
|
253
299
|
className: "text-status-error-text",
|
|
254
|
-
children: x(
|
|
300
|
+
children: x(R.key, R.fallback)
|
|
255
301
|
}),
|
|
256
302
|
/* @__PURE__ */ h("div", {
|
|
257
303
|
className: "flex flex-wrap gap-2",
|
|
258
304
|
children: [/* @__PURE__ */ m(g, {
|
|
259
305
|
type: "submit",
|
|
260
|
-
disabled:
|
|
306
|
+
disabled: B || Y || G || X || b,
|
|
261
307
|
children: x("coolandlovely.resale.editor.saveDraft", "Save private draft")
|
|
262
308
|
}), /* @__PURE__ */ m(g, {
|
|
263
309
|
type: "button",
|
|
264
310
|
variant: "outline",
|
|
265
|
-
disabled:
|
|
311
|
+
disabled: B,
|
|
266
312
|
onClick: y,
|
|
267
313
|
children: x("coolandlovely.resale.editor.close", "Close")
|
|
268
314
|
})]
|