@burdenoff/microfe-devportal 2026.914.4 → 2026.914.6
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/devportal/hooks/useSellerOrganization.d.ts.map +1 -1
- package/dist/devportal/hooks/useSellerOrganization.js +2 -2
- package/dist/devportal/hooks/useSellerOrganization.js.map +1 -1
- package/dist/devportal/pages/CreatePhysicalItemPage.d.ts.map +1 -1
- package/dist/devportal/pages/CreatePhysicalItemPage.js +186 -165
- package/dist/devportal/pages/CreatePhysicalItemPage.js.map +1 -1
- package/dist/devportal/providers/DevportalProvider.d.ts.map +1 -1
- package/dist/devportal/providers/DevportalProvider.js +31 -30
- package/dist/devportal/providers/DevportalProvider.js.map +1 -1
- package/dist/devportal/types/index.d.ts +9 -0
- package/dist/devportal/types/index.d.ts.map +1 -1
- package/dist/devportal/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@ import { useDevportal as e } from "../providers/DevportalProvider.js";
|
|
|
2
2
|
import { cn as t } from "../utils/cn.js";
|
|
3
3
|
import { PageLayout as n, PageSection as r } from "../components/PageLayout.js";
|
|
4
4
|
import { CheckboxField as i, InputField as a, SelectField as o, TextareaField as s } from "../components/FormField.js";
|
|
5
|
-
import { usePackageUpload as
|
|
6
|
-
import { useSellerOrganization as
|
|
7
|
-
import { useCallback as
|
|
8
|
-
import { AlertTriangle as
|
|
5
|
+
import { usePackageUpload as ee } from "../hooks/usePackageUpload.js";
|
|
6
|
+
import { useSellerOrganization as c } from "../hooks/useSellerOrganization.js";
|
|
7
|
+
import { useCallback as l, useRef as u, useState as d } from "react";
|
|
8
|
+
import { AlertTriangle as f, Info as p, Loader2 as m, RotateCw as te, Upload as h, X as g } from "lucide-react";
|
|
9
9
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
10
10
|
//#region src/devportal/pages/CreatePhysicalItemPage.tsx
|
|
11
11
|
var b = [
|
|
@@ -62,7 +62,7 @@ var b = [
|
|
|
62
62
|
value: "agri-irrigation",
|
|
63
63
|
label: "Agri-Inputs — Irrigation"
|
|
64
64
|
}
|
|
65
|
-
],
|
|
65
|
+
], re = [
|
|
66
66
|
{
|
|
67
67
|
value: "USD",
|
|
68
68
|
label: "USD — US Dollar"
|
|
@@ -87,7 +87,7 @@ var b = [
|
|
|
87
87
|
value: "AED",
|
|
88
88
|
label: "AED — UAE Dirham"
|
|
89
89
|
}
|
|
90
|
-
],
|
|
90
|
+
], ie = [
|
|
91
91
|
{
|
|
92
92
|
value: "GRAM",
|
|
93
93
|
label: "Grams (g)"
|
|
@@ -104,7 +104,7 @@ var b = [
|
|
|
104
104
|
value: "POUND",
|
|
105
105
|
label: "Pounds (lb)"
|
|
106
106
|
}
|
|
107
|
-
],
|
|
107
|
+
], ae = [
|
|
108
108
|
{
|
|
109
109
|
value: "CENTIMETER",
|
|
110
110
|
label: "Centimeters (cm)"
|
|
@@ -117,7 +117,7 @@ var b = [
|
|
|
117
117
|
value: "METER",
|
|
118
118
|
label: "Meters (m)"
|
|
119
119
|
}
|
|
120
|
-
],
|
|
120
|
+
], x = [
|
|
121
121
|
"name",
|
|
122
122
|
"slug",
|
|
123
123
|
"type",
|
|
@@ -125,18 +125,18 @@ var b = [
|
|
|
125
125
|
"price",
|
|
126
126
|
"currency",
|
|
127
127
|
"stockQuantity"
|
|
128
|
-
],
|
|
129
|
-
function
|
|
128
|
+
], oe = "\n query SellerMyPublisher {\n myPublisher {\n id\n }\n }\n", se = "\n mutation RegisterPublisher($input: RegisterPublisherInput!) {\n registerPublisher(input: $input) {\n id\n name\n email\n }\n }\n", ce = "\n mutation CreatePhysicalProduct($input: CreatePhysicalProductInput!) {\n createPhysicalProduct(input: $input) {\n id\n name\n slug\n status\n nature\n type\n price\n currency\n }\n }\n", S = "\n mutation SubmitProduct($id: ID!, $notes: String) {\n submitProduct(id: $id, notes: $notes) {\n id\n status\n }\n }\n";
|
|
129
|
+
function C(e) {
|
|
130
130
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
132
|
+
function w(e) {
|
|
133
|
+
return x.every((t) => {
|
|
134
134
|
let n = e[t];
|
|
135
135
|
return typeof n == "boolean" ? !0 : n.trim() !== "";
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
var
|
|
139
|
-
let { navigate:
|
|
138
|
+
var T = () => {
|
|
139
|
+
let { navigate: x, basePath: T, productId: E, apiGatewayUrl: D, authToken: O, workspacesGatewayUrl: k, workspaceId: le, getWorkspaceToken: ue } = e(), { organization: A, organizations: j, loading: M, error: N, selectOrganization: P } = c(), [F, I] = d({
|
|
140
140
|
name: "",
|
|
141
141
|
slug: "",
|
|
142
142
|
type: "",
|
|
@@ -163,68 +163,68 @@ var O = () => {
|
|
|
163
163
|
countryOfOrigin: "",
|
|
164
164
|
warrantyInfo: "",
|
|
165
165
|
returnPolicy: ""
|
|
166
|
-
}), [
|
|
167
|
-
|
|
166
|
+
}), [L, R] = d([]), [z, B] = d(!1), V = u(null), { upload: H } = ee(k, O, le, ue, "/DevPortal/Assets"), [U, W] = d(!1), [G, K] = d(null), [de, fe] = d(!1), pe = L.some((e) => e.uploading), q = w(F) && !!A && !pe, me = `${D || ""}/global/graphql`, J = (e, t) => {
|
|
167
|
+
I((n) => ({
|
|
168
168
|
...n,
|
|
169
169
|
[e]: t
|
|
170
170
|
}));
|
|
171
|
-
},
|
|
171
|
+
}, Y = (e) => {
|
|
172
172
|
let t = e.target.value;
|
|
173
|
-
|
|
173
|
+
I((e) => ({
|
|
174
174
|
...e,
|
|
175
175
|
name: t,
|
|
176
|
-
slug:
|
|
176
|
+
slug: C(t)
|
|
177
177
|
}));
|
|
178
178
|
}, X = (e) => (t) => {
|
|
179
|
-
|
|
180
|
-
}, Z =
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
J(e, t.target.checked);
|
|
180
|
+
}, Z = l((e, t) => {
|
|
181
|
+
H(t).then((t) => {
|
|
182
|
+
R((n) => n.map((n) => n.id === e ? {
|
|
183
183
|
...n,
|
|
184
184
|
uploading: !1,
|
|
185
185
|
downloadUrl: t.downloadUrl,
|
|
186
186
|
error: void 0
|
|
187
187
|
} : n));
|
|
188
188
|
}).catch((t) => {
|
|
189
|
-
|
|
189
|
+
R((n) => n.map((n) => n.id === e ? {
|
|
190
190
|
...n,
|
|
191
191
|
uploading: !1,
|
|
192
192
|
error: t instanceof Error ? t.message : "Upload failed"
|
|
193
193
|
} : n));
|
|
194
194
|
});
|
|
195
|
-
}, [
|
|
195
|
+
}, [H]), Q = l((e) => {
|
|
196
196
|
let t = Array.from(e).filter((e) => e.type.startsWith("image/")).map((e) => ({
|
|
197
197
|
id: crypto.randomUUID(),
|
|
198
198
|
file: e,
|
|
199
199
|
url: URL.createObjectURL(e),
|
|
200
200
|
uploading: !0
|
|
201
201
|
}));
|
|
202
|
-
|
|
203
|
-
}, [Z]),
|
|
202
|
+
R((e) => [...e, ...t]), t.forEach((e) => Z(e.id, e.file));
|
|
203
|
+
}, [Z]), he = (e) => {
|
|
204
204
|
e.target.files && Q(e.target.files), e.target.value = "";
|
|
205
|
-
},
|
|
206
|
-
e.preventDefault(),
|
|
207
|
-
},
|
|
208
|
-
e.preventDefault(),
|
|
209
|
-
},
|
|
210
|
-
|
|
205
|
+
}, ge = (e) => {
|
|
206
|
+
e.preventDefault(), B(!1), e.dataTransfer.files && Q(e.dataTransfer.files);
|
|
207
|
+
}, _e = (e) => {
|
|
208
|
+
e.preventDefault(), B(!0);
|
|
209
|
+
}, ve = () => B(!1), ye = (e) => {
|
|
210
|
+
R((t) => {
|
|
211
211
|
let n = t.find((t) => t.id === e);
|
|
212
212
|
return n && URL.revokeObjectURL(n.url), t.filter((t) => t.id !== e);
|
|
213
213
|
});
|
|
214
|
-
},
|
|
215
|
-
let t =
|
|
216
|
-
t && (
|
|
214
|
+
}, be = (e) => {
|
|
215
|
+
let t = L.find((t) => t.id === e);
|
|
216
|
+
t && (R((t) => t.map((t) => t.id === e ? {
|
|
217
217
|
...t,
|
|
218
218
|
uploading: !0,
|
|
219
219
|
error: void 0
|
|
220
220
|
} : t)), Z(e, t.file));
|
|
221
221
|
};
|
|
222
222
|
async function $(e, t) {
|
|
223
|
-
let n = await (await fetch(
|
|
223
|
+
let n = await (await fetch(me, {
|
|
224
224
|
method: "POST",
|
|
225
225
|
headers: {
|
|
226
226
|
"Content-Type": "application/json",
|
|
227
|
-
...
|
|
227
|
+
...O ? { Authorization: `Bearer ${O}` } : {}
|
|
228
228
|
},
|
|
229
229
|
credentials: "include",
|
|
230
230
|
body: JSON.stringify({
|
|
@@ -243,17 +243,37 @@ var O = () => {
|
|
|
243
243
|
children: /* @__PURE__ */ y("div", {
|
|
244
244
|
className: "space-y-8 max-w-3xl",
|
|
245
245
|
children: [
|
|
246
|
-
|
|
246
|
+
de && /* @__PURE__ */ v("div", {
|
|
247
247
|
className: "rounded-card border border-status-success-text/30 bg-status-success-bg-subtle px-4 py-3 text-sm text-status-success-text",
|
|
248
248
|
children: "Your listing has been submitted for review! Redirecting..."
|
|
249
249
|
}),
|
|
250
|
-
|
|
250
|
+
G && /* @__PURE__ */ v("div", {
|
|
251
251
|
className: "rounded-card border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-3 text-sm text-status-error-text",
|
|
252
|
-
children:
|
|
252
|
+
children: G
|
|
253
253
|
}),
|
|
254
|
-
|
|
254
|
+
N && /* @__PURE__ */ y("div", {
|
|
255
255
|
className: "rounded-card border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-3 text-sm text-status-error-text",
|
|
256
|
-
children: ["Couldn't set up your seller organization: ",
|
|
256
|
+
children: ["Couldn't set up your seller organization: ", N]
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ v(r, {
|
|
259
|
+
title: "Seller Organization",
|
|
260
|
+
description: "The seller organization this item will be listed under.",
|
|
261
|
+
children: /* @__PURE__ */ v("div", {
|
|
262
|
+
className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-3",
|
|
263
|
+
children: /* @__PURE__ */ v(o, {
|
|
264
|
+
label: "Organization",
|
|
265
|
+
required: !0,
|
|
266
|
+
value: A?.id ?? "",
|
|
267
|
+
onChange: (e) => P(e.target.value),
|
|
268
|
+
options: j.map((e) => ({
|
|
269
|
+
value: e.id,
|
|
270
|
+
label: e.name
|
|
271
|
+
})),
|
|
272
|
+
placeholder: M ? "Resolving your seller organization…" : "Select an organization",
|
|
273
|
+
disabled: M || j.length <= 1,
|
|
274
|
+
hint: j.length > 1 ? "You have more than one seller organization — pick the one this item belongs to." : A ? `Automatically set to your only seller organization, "${A.name}".` : void 0
|
|
275
|
+
})
|
|
276
|
+
})
|
|
257
277
|
}),
|
|
258
278
|
/* @__PURE__ */ v(r, {
|
|
259
279
|
title: "Basic Information",
|
|
@@ -264,31 +284,31 @@ var O = () => {
|
|
|
264
284
|
/* @__PURE__ */ v(a, {
|
|
265
285
|
label: "Name",
|
|
266
286
|
required: !0,
|
|
267
|
-
value:
|
|
268
|
-
onChange:
|
|
287
|
+
value: F.name,
|
|
288
|
+
onChange: Y,
|
|
269
289
|
placeholder: "e.g. Wireless Ergonomic Keyboard",
|
|
270
290
|
maxLength: 120
|
|
271
291
|
}),
|
|
272
292
|
/* @__PURE__ */ v(a, {
|
|
273
293
|
label: "Slug",
|
|
274
294
|
required: !0,
|
|
275
|
-
value:
|
|
276
|
-
onChange: (e) =>
|
|
295
|
+
value: F.slug,
|
|
296
|
+
onChange: (e) => J("slug", e.target.value),
|
|
277
297
|
placeholder: "auto-derived-from-name",
|
|
278
298
|
hint: "URL-friendly identifier. Auto-derived from name; you can edit it."
|
|
279
299
|
}),
|
|
280
300
|
/* @__PURE__ */ v(o, {
|
|
281
301
|
label: "Product Type",
|
|
282
302
|
required: !0,
|
|
283
|
-
value:
|
|
284
|
-
onChange: (e) =>
|
|
303
|
+
value: F.type,
|
|
304
|
+
onChange: (e) => J("type", e.target.value),
|
|
285
305
|
options: b,
|
|
286
306
|
placeholder: "Select a type"
|
|
287
307
|
}),
|
|
288
308
|
/* @__PURE__ */ v(o, {
|
|
289
309
|
label: "Store Category",
|
|
290
|
-
value:
|
|
291
|
-
onChange: (e) =>
|
|
310
|
+
value: F.category,
|
|
311
|
+
onChange: (e) => J("category", e.target.value),
|
|
292
312
|
options: ne,
|
|
293
313
|
placeholder: "General / uncategorised",
|
|
294
314
|
hint: "Pick an Agri-Inputs category to list this item in the HealthyBowl Agri-Inputs Store. Leave blank for a general store listing."
|
|
@@ -296,16 +316,16 @@ var O = () => {
|
|
|
296
316
|
/* @__PURE__ */ v(a, {
|
|
297
317
|
label: "Short Description",
|
|
298
318
|
required: !0,
|
|
299
|
-
value:
|
|
300
|
-
onChange: (e) =>
|
|
319
|
+
value: F.shortDescription,
|
|
320
|
+
onChange: (e) => J("shortDescription", e.target.value),
|
|
301
321
|
placeholder: "One-line summary shown on the store card",
|
|
302
322
|
maxLength: 160,
|
|
303
|
-
hint: `${
|
|
323
|
+
hint: `${F.shortDescription.length}/160`
|
|
304
324
|
}),
|
|
305
325
|
/* @__PURE__ */ v(s, {
|
|
306
326
|
label: "Long Description",
|
|
307
|
-
value:
|
|
308
|
-
onChange: (e) =>
|
|
327
|
+
value: F.longDescription,
|
|
328
|
+
onChange: (e) => J("longDescription", e.target.value),
|
|
309
329
|
rows: 5,
|
|
310
330
|
placeholder: "Detailed product description, features, specs…"
|
|
311
331
|
})
|
|
@@ -319,15 +339,15 @@ var O = () => {
|
|
|
319
339
|
className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-4",
|
|
320
340
|
children: [
|
|
321
341
|
/* @__PURE__ */ y("div", {
|
|
322
|
-
onDrop:
|
|
323
|
-
onDragOver:
|
|
324
|
-
onDragLeave:
|
|
325
|
-
onClick: () =>
|
|
326
|
-
className: t("flex flex-col items-center justify-center gap-3 rounded-input border-2 border-dashed px-6 py-10 cursor-pointer transition-colors",
|
|
342
|
+
onDrop: ge,
|
|
343
|
+
onDragOver: _e,
|
|
344
|
+
onDragLeave: ve,
|
|
345
|
+
onClick: () => V.current?.click(),
|
|
346
|
+
className: t("flex flex-col items-center justify-center gap-3 rounded-input border-2 border-dashed px-6 py-10 cursor-pointer transition-colors", z ? "border-action-primary-bg bg-action-primary-bg/5" : "border-border-subtle hover:border-border-strong"),
|
|
327
347
|
children: [
|
|
328
|
-
/* @__PURE__ */ v(
|
|
348
|
+
/* @__PURE__ */ v(h, {
|
|
329
349
|
size: 28,
|
|
330
|
-
className:
|
|
350
|
+
className: z ? "text-action-primary-bg" : "text-text-muted"
|
|
331
351
|
}),
|
|
332
352
|
/* @__PURE__ */ y("div", {
|
|
333
353
|
className: "text-center space-y-1",
|
|
@@ -340,20 +360,20 @@ var O = () => {
|
|
|
340
360
|
})]
|
|
341
361
|
}),
|
|
342
362
|
/* @__PURE__ */ v("input", {
|
|
343
|
-
ref:
|
|
363
|
+
ref: V,
|
|
344
364
|
type: "file",
|
|
345
365
|
accept: "image/*",
|
|
346
366
|
multiple: !0,
|
|
347
367
|
className: "sr-only",
|
|
348
|
-
onChange:
|
|
368
|
+
onChange: he
|
|
349
369
|
})
|
|
350
370
|
]
|
|
351
371
|
}),
|
|
352
|
-
|
|
372
|
+
L.length > 0 && /* @__PURE__ */ v("div", {
|
|
353
373
|
className: "flex flex-wrap gap-3",
|
|
354
374
|
children: (() => {
|
|
355
|
-
let e =
|
|
356
|
-
return
|
|
375
|
+
let e = L.find((e) => e.downloadUrl)?.id;
|
|
376
|
+
return L.map((n, r) => /* @__PURE__ */ y("div", {
|
|
357
377
|
className: "relative group",
|
|
358
378
|
children: [
|
|
359
379
|
/* @__PURE__ */ v("img", {
|
|
@@ -363,7 +383,7 @@ var O = () => {
|
|
|
363
383
|
}),
|
|
364
384
|
n.uploading && /* @__PURE__ */ v("div", {
|
|
365
385
|
className: "absolute inset-0 flex items-center justify-center rounded-input bg-bg-overlay",
|
|
366
|
-
children: /* @__PURE__ */ v(
|
|
386
|
+
children: /* @__PURE__ */ v(m, {
|
|
367
387
|
size: 16,
|
|
368
388
|
className: "animate-spin text-white"
|
|
369
389
|
})
|
|
@@ -371,11 +391,11 @@ var O = () => {
|
|
|
371
391
|
n.error && /* @__PURE__ */ y("button", {
|
|
372
392
|
type: "button",
|
|
373
393
|
onClick: (e) => {
|
|
374
|
-
e.stopPropagation(),
|
|
394
|
+
e.stopPropagation(), be(n.id);
|
|
375
395
|
},
|
|
376
396
|
title: `${n.error} — click to retry`,
|
|
377
397
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-0.5 rounded-input bg-status-error-bg/80 text-status-error-text",
|
|
378
|
-
children: [/* @__PURE__ */ v(
|
|
398
|
+
children: [/* @__PURE__ */ v(f, { size: 14 }), /* @__PURE__ */ v(te, { size: 11 })]
|
|
379
399
|
}),
|
|
380
400
|
n.id === e && /* @__PURE__ */ v("span", {
|
|
381
401
|
className: "absolute bottom-0 left-0 right-0 rounded-b-input bg-bg-surface/80 text-center text-[10px] font-medium py-0.5 text-text-secondary",
|
|
@@ -384,11 +404,11 @@ var O = () => {
|
|
|
384
404
|
/* @__PURE__ */ v("button", {
|
|
385
405
|
type: "button",
|
|
386
406
|
onClick: (e) => {
|
|
387
|
-
e.stopPropagation(),
|
|
407
|
+
e.stopPropagation(), ye(n.id);
|
|
388
408
|
},
|
|
389
409
|
className: "absolute -top-1.5 -right-1.5 hidden group-hover:flex h-5 w-5 items-center justify-center rounded-full bg-bg-surface border border-border-subtle text-text-muted hover:text-status-error-text hover:border-status-error-text/40 transition-colors",
|
|
390
410
|
"aria-label": "Remove image",
|
|
391
|
-
children: /* @__PURE__ */ v(
|
|
411
|
+
children: /* @__PURE__ */ v(g, { size: 11 })
|
|
392
412
|
})
|
|
393
413
|
]
|
|
394
414
|
}, n.id));
|
|
@@ -396,7 +416,7 @@ var O = () => {
|
|
|
396
416
|
}),
|
|
397
417
|
/* @__PURE__ */ y("p", {
|
|
398
418
|
className: "flex items-start gap-2 rounded-input border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
|
|
399
|
-
children: [/* @__PURE__ */ v(
|
|
419
|
+
children: [/* @__PURE__ */ v(p, {
|
|
400
420
|
size: 13,
|
|
401
421
|
className: "mt-0.5 shrink-0 text-text-muted"
|
|
402
422
|
}), "At least 1 image helps buyers — high quality photos increase conversions. The first image becomes the main icon."]
|
|
@@ -414,23 +434,23 @@ var O = () => {
|
|
|
414
434
|
label: "Price",
|
|
415
435
|
required: !0,
|
|
416
436
|
type: "number",
|
|
417
|
-
value:
|
|
418
|
-
onChange: (e) =>
|
|
437
|
+
value: F.price,
|
|
438
|
+
onChange: (e) => J("price", e.target.value),
|
|
419
439
|
placeholder: "0.00",
|
|
420
440
|
min: .01,
|
|
421
441
|
step: "0.01"
|
|
422
442
|
}), /* @__PURE__ */ v(o, {
|
|
423
443
|
label: "Currency",
|
|
424
444
|
required: !0,
|
|
425
|
-
value:
|
|
426
|
-
onChange: (e) =>
|
|
427
|
-
options:
|
|
445
|
+
value: F.currency,
|
|
446
|
+
onChange: (e) => J("currency", e.target.value),
|
|
447
|
+
options: re,
|
|
428
448
|
placeholder: "Select currency"
|
|
429
449
|
})]
|
|
430
450
|
}), /* @__PURE__ */ v(a, {
|
|
431
451
|
label: "Tags",
|
|
432
|
-
value:
|
|
433
|
-
onChange: (e) =>
|
|
452
|
+
value: F.tags,
|
|
453
|
+
onChange: (e) => J("tags", e.target.value),
|
|
434
454
|
placeholder: "mechanical, wireless, ergonomic",
|
|
435
455
|
hint: "Comma-separated keywords to help buyers find your item."
|
|
436
456
|
})]
|
|
@@ -447,14 +467,14 @@ var O = () => {
|
|
|
447
467
|
label: "Stock Quantity",
|
|
448
468
|
required: !0,
|
|
449
469
|
type: "number",
|
|
450
|
-
value:
|
|
451
|
-
onChange: (e) =>
|
|
470
|
+
value: F.stockQuantity,
|
|
471
|
+
onChange: (e) => J("stockQuantity", e.target.value),
|
|
452
472
|
min: 0,
|
|
453
473
|
step: 1
|
|
454
474
|
}), /* @__PURE__ */ v(a, {
|
|
455
475
|
label: "SKU",
|
|
456
|
-
value:
|
|
457
|
-
onChange: (e) =>
|
|
476
|
+
value: F.sku,
|
|
477
|
+
onChange: (e) => J("sku", e.target.value),
|
|
458
478
|
placeholder: "e.g. KB-WL-001",
|
|
459
479
|
hint: "Your internal stock-keeping unit reference."
|
|
460
480
|
})]
|
|
@@ -462,8 +482,8 @@ var O = () => {
|
|
|
462
482
|
/* @__PURE__ */ v(a, {
|
|
463
483
|
label: "Low Stock Threshold",
|
|
464
484
|
type: "number",
|
|
465
|
-
value:
|
|
466
|
-
onChange: (e) =>
|
|
485
|
+
value: F.lowStockThreshold,
|
|
486
|
+
onChange: (e) => J("lowStockThreshold", e.target.value),
|
|
467
487
|
placeholder: "e.g. 5",
|
|
468
488
|
min: 0,
|
|
469
489
|
step: 1,
|
|
@@ -472,13 +492,13 @@ var O = () => {
|
|
|
472
492
|
/* @__PURE__ */ v(i, {
|
|
473
493
|
label: "Track Inventory",
|
|
474
494
|
description: "Automatically reduce stock when orders are placed.",
|
|
475
|
-
checked:
|
|
495
|
+
checked: F.trackInventory,
|
|
476
496
|
onChange: X("trackInventory")
|
|
477
497
|
}),
|
|
478
498
|
/* @__PURE__ */ v(i, {
|
|
479
499
|
label: "Allow Backorder",
|
|
480
500
|
description: "Let buyers order even when stock quantity is zero.",
|
|
481
|
-
checked:
|
|
501
|
+
checked: F.allowBackorder,
|
|
482
502
|
onChange: X("allowBackorder")
|
|
483
503
|
})
|
|
484
504
|
]
|
|
@@ -492,26 +512,26 @@ var O = () => {
|
|
|
492
512
|
/* @__PURE__ */ v(i, {
|
|
493
513
|
label: "Requires Shipping",
|
|
494
514
|
description: "This item will be physically shipped to the buyer.",
|
|
495
|
-
checked:
|
|
515
|
+
checked: F.requiresShipping,
|
|
496
516
|
onChange: X("requiresShipping")
|
|
497
517
|
}),
|
|
498
|
-
|
|
518
|
+
F.requiresShipping && /* @__PURE__ */ y(_, { children: [
|
|
499
519
|
/* @__PURE__ */ y("div", {
|
|
500
520
|
className: "grid grid-cols-1 gap-5 sm:grid-cols-2",
|
|
501
521
|
children: [/* @__PURE__ */ v(a, {
|
|
502
522
|
label: "Weight",
|
|
503
523
|
type: "number",
|
|
504
|
-
value:
|
|
505
|
-
onChange: (e) =>
|
|
524
|
+
value: F.weightKg,
|
|
525
|
+
onChange: (e) => J("weightKg", e.target.value),
|
|
506
526
|
placeholder: "0.0",
|
|
507
527
|
min: 0,
|
|
508
528
|
step: "0.01",
|
|
509
529
|
hint: "Used to calculate shipping costs."
|
|
510
530
|
}), /* @__PURE__ */ v(o, {
|
|
511
531
|
label: "Weight Unit",
|
|
512
|
-
value:
|
|
513
|
-
onChange: (e) =>
|
|
514
|
-
options:
|
|
532
|
+
value: F.weightUnit,
|
|
533
|
+
onChange: (e) => J("weightUnit", e.target.value),
|
|
534
|
+
options: ie
|
|
515
535
|
})]
|
|
516
536
|
}),
|
|
517
537
|
/* @__PURE__ */ y("div", {
|
|
@@ -520,8 +540,8 @@ var O = () => {
|
|
|
520
540
|
/* @__PURE__ */ v(a, {
|
|
521
541
|
label: "Length",
|
|
522
542
|
type: "number",
|
|
523
|
-
value:
|
|
524
|
-
onChange: (e) =>
|
|
543
|
+
value: F.length,
|
|
544
|
+
onChange: (e) => J("length", e.target.value),
|
|
525
545
|
placeholder: "0.0",
|
|
526
546
|
min: 0,
|
|
527
547
|
step: "0.01"
|
|
@@ -529,8 +549,8 @@ var O = () => {
|
|
|
529
549
|
/* @__PURE__ */ v(a, {
|
|
530
550
|
label: "Width",
|
|
531
551
|
type: "number",
|
|
532
|
-
value:
|
|
533
|
-
onChange: (e) =>
|
|
552
|
+
value: F.width,
|
|
553
|
+
onChange: (e) => J("width", e.target.value),
|
|
534
554
|
placeholder: "0.0",
|
|
535
555
|
min: 0,
|
|
536
556
|
step: "0.01"
|
|
@@ -538,8 +558,8 @@ var O = () => {
|
|
|
538
558
|
/* @__PURE__ */ v(a, {
|
|
539
559
|
label: "Height",
|
|
540
560
|
type: "number",
|
|
541
|
-
value:
|
|
542
|
-
onChange: (e) =>
|
|
561
|
+
value: F.height,
|
|
562
|
+
onChange: (e) => J("height", e.target.value),
|
|
543
563
|
placeholder: "0.0",
|
|
544
564
|
min: 0,
|
|
545
565
|
step: "0.01"
|
|
@@ -548,15 +568,15 @@ var O = () => {
|
|
|
548
568
|
}),
|
|
549
569
|
/* @__PURE__ */ v(o, {
|
|
550
570
|
label: "Dimension Unit",
|
|
551
|
-
value:
|
|
552
|
-
onChange: (e) =>
|
|
553
|
-
options:
|
|
571
|
+
value: F.dimensionUnit,
|
|
572
|
+
onChange: (e) => J("dimensionUnit", e.target.value),
|
|
573
|
+
options: ae,
|
|
554
574
|
hint: "Applies to length, width, and height above."
|
|
555
575
|
})
|
|
556
576
|
] }),
|
|
557
577
|
/* @__PURE__ */ y("p", {
|
|
558
578
|
className: "flex items-start gap-2 rounded-input border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
|
|
559
|
-
children: [/* @__PURE__ */ v(
|
|
579
|
+
children: [/* @__PURE__ */ v(p, {
|
|
560
580
|
size: 13,
|
|
561
581
|
className: "mt-0.5 shrink-0 text-text-muted"
|
|
562
582
|
}), "Delivery fees are configured at the organization level in store settings."]
|
|
@@ -574,32 +594,32 @@ var O = () => {
|
|
|
574
594
|
className: "grid grid-cols-1 gap-5 sm:grid-cols-2",
|
|
575
595
|
children: [/* @__PURE__ */ v(a, {
|
|
576
596
|
label: "Brand",
|
|
577
|
-
value:
|
|
578
|
-
onChange: (e) =>
|
|
597
|
+
value: F.brand,
|
|
598
|
+
onChange: (e) => J("brand", e.target.value),
|
|
579
599
|
placeholder: "e.g. Logitech"
|
|
580
600
|
}), /* @__PURE__ */ v(a, {
|
|
581
601
|
label: "Manufacturer",
|
|
582
|
-
value:
|
|
583
|
-
onChange: (e) =>
|
|
602
|
+
value: F.manufacturer,
|
|
603
|
+
onChange: (e) => J("manufacturer", e.target.value),
|
|
584
604
|
placeholder: "e.g. Logitech Manufacturing Ltd."
|
|
585
605
|
})]
|
|
586
606
|
}),
|
|
587
607
|
/* @__PURE__ */ v(a, {
|
|
588
608
|
label: "Country of Origin",
|
|
589
|
-
value:
|
|
590
|
-
onChange: (e) =>
|
|
609
|
+
value: F.countryOfOrigin,
|
|
610
|
+
onChange: (e) => J("countryOfOrigin", e.target.value),
|
|
591
611
|
placeholder: "e.g. China"
|
|
592
612
|
}),
|
|
593
613
|
/* @__PURE__ */ v(a, {
|
|
594
614
|
label: "Warranty Info",
|
|
595
|
-
value:
|
|
596
|
-
onChange: (e) =>
|
|
615
|
+
value: F.warrantyInfo,
|
|
616
|
+
onChange: (e) => J("warrantyInfo", e.target.value),
|
|
597
617
|
placeholder: "e.g. 1-year limited manufacturer warranty"
|
|
598
618
|
}),
|
|
599
619
|
/* @__PURE__ */ v(s, {
|
|
600
620
|
label: "Return Policy",
|
|
601
|
-
value:
|
|
602
|
-
onChange: (e) =>
|
|
621
|
+
value: F.returnPolicy,
|
|
622
|
+
onChange: (e) => J("returnPolicy", e.target.value),
|
|
603
623
|
rows: 3,
|
|
604
624
|
placeholder: "e.g. 30-day returns accepted"
|
|
605
625
|
})
|
|
@@ -610,7 +630,7 @@ var O = () => {
|
|
|
610
630
|
className: "flex items-center gap-3 pb-8",
|
|
611
631
|
children: [/* @__PURE__ */ v("button", {
|
|
612
632
|
type: "button",
|
|
613
|
-
onClick: () =>
|
|
633
|
+
onClick: () => x?.(`${T}/seller/items`),
|
|
614
634
|
className: "rounded-button border border-border-strong px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors",
|
|
615
635
|
children: "Cancel"
|
|
616
636
|
}), /* @__PURE__ */ v("div", {
|
|
@@ -618,70 +638,71 @@ var O = () => {
|
|
|
618
638
|
children: /* @__PURE__ */ v("button", {
|
|
619
639
|
type: "button",
|
|
620
640
|
onClick: async () => {
|
|
621
|
-
if (!(!
|
|
622
|
-
|
|
641
|
+
if (!(!q || U || !A)) {
|
|
642
|
+
W(!0), K(null);
|
|
623
643
|
try {
|
|
624
|
-
let e = (await $(
|
|
625
|
-
e ||= (await $(
|
|
626
|
-
name:
|
|
627
|
-
email:
|
|
628
|
-
websiteUrl:
|
|
629
|
-
legalName:
|
|
630
|
-
country:
|
|
631
|
-
contactEmail:
|
|
644
|
+
let e = (await $(oe)).myPublisher?.id ?? null;
|
|
645
|
+
e ||= (await $(se, { input: {
|
|
646
|
+
name: A.legalEntityName ?? A.name,
|
|
647
|
+
email: A.contactEmail ?? "seller@burdenoff.com",
|
|
648
|
+
websiteUrl: A.websiteUrl ?? null,
|
|
649
|
+
legalName: A.legalEntityName ?? A.name,
|
|
650
|
+
country: A.taxCountry ?? null,
|
|
651
|
+
contactEmail: A.contactEmail ?? null
|
|
632
652
|
} })).registerPublisher.id;
|
|
633
|
-
let t =
|
|
634
|
-
name:
|
|
635
|
-
slug:
|
|
636
|
-
type:
|
|
637
|
-
category:
|
|
638
|
-
description:
|
|
639
|
-
longDescription:
|
|
640
|
-
price: parseFloat(
|
|
641
|
-
currency:
|
|
653
|
+
let t = F.tags.split(",").map((e) => e.trim()).filter(Boolean), n = L.map((e) => e.downloadUrl).filter((e) => !!e), r = F.length.trim() || F.width.trim() || F.height.trim(), i = (await $(ce, { input: {
|
|
654
|
+
name: F.name.trim(),
|
|
655
|
+
slug: F.slug.trim(),
|
|
656
|
+
type: F.type,
|
|
657
|
+
category: F.category.trim() || null,
|
|
658
|
+
description: F.shortDescription.trim(),
|
|
659
|
+
longDescription: F.longDescription.trim() || null,
|
|
660
|
+
price: parseFloat(F.price),
|
|
661
|
+
currency: F.currency,
|
|
642
662
|
tags: t.length > 0 ? t : null,
|
|
643
|
-
stockQuantity: parseInt(
|
|
644
|
-
sku:
|
|
645
|
-
trackInventory:
|
|
646
|
-
allowBackorder:
|
|
647
|
-
lowStockThreshold:
|
|
648
|
-
requiresShipping:
|
|
649
|
-
weight:
|
|
650
|
-
weightUnit:
|
|
651
|
-
length:
|
|
652
|
-
width:
|
|
653
|
-
height:
|
|
654
|
-
dimensionUnit:
|
|
655
|
-
brand:
|
|
656
|
-
manufacturer:
|
|
657
|
-
countryOfOrigin:
|
|
658
|
-
warrantyInfo:
|
|
659
|
-
returnPolicy:
|
|
663
|
+
stockQuantity: parseInt(F.stockQuantity, 10),
|
|
664
|
+
sku: F.sku.trim() || null,
|
|
665
|
+
trackInventory: F.trackInventory,
|
|
666
|
+
allowBackorder: F.allowBackorder,
|
|
667
|
+
lowStockThreshold: F.lowStockThreshold.trim() ? parseInt(F.lowStockThreshold, 10) : null,
|
|
668
|
+
requiresShipping: F.requiresShipping,
|
|
669
|
+
weight: F.requiresShipping && F.weightKg.trim() ? parseFloat(F.weightKg) : null,
|
|
670
|
+
weightUnit: F.requiresShipping && F.weightKg.trim() ? F.weightUnit : null,
|
|
671
|
+
length: F.requiresShipping && F.length.trim() ? parseFloat(F.length) : null,
|
|
672
|
+
width: F.requiresShipping && F.width.trim() ? parseFloat(F.width) : null,
|
|
673
|
+
height: F.requiresShipping && F.height.trim() ? parseFloat(F.height) : null,
|
|
674
|
+
dimensionUnit: F.requiresShipping && r ? F.dimensionUnit : null,
|
|
675
|
+
brand: F.brand.trim() || null,
|
|
676
|
+
manufacturer: F.manufacturer.trim() || null,
|
|
677
|
+
countryOfOrigin: F.countryOfOrigin.trim() || null,
|
|
678
|
+
warrantyInfo: F.warrantyInfo.trim() || null,
|
|
679
|
+
returnPolicy: F.returnPolicy.trim() || null,
|
|
660
680
|
icon: n[0] ?? null,
|
|
661
681
|
screenshots: n.length > 1 ? n.slice(1) : null,
|
|
662
|
-
|
|
682
|
+
compatibleProducts: E ? [E] : null,
|
|
683
|
+
organizationId: A.id
|
|
663
684
|
} })).createPhysicalProduct.id;
|
|
664
|
-
await $(
|
|
685
|
+
await $(S, {
|
|
665
686
|
id: i,
|
|
666
687
|
notes: "Submitted from seller portal"
|
|
667
|
-
}),
|
|
668
|
-
|
|
688
|
+
}), fe(!0), setTimeout(() => {
|
|
689
|
+
x?.(`${T}/seller/items`);
|
|
669
690
|
}, 2e3);
|
|
670
691
|
} catch (e) {
|
|
671
|
-
|
|
692
|
+
K(e instanceof Error ? e.message : "Submission failed. Please try again.");
|
|
672
693
|
} finally {
|
|
673
|
-
|
|
694
|
+
W(!1);
|
|
674
695
|
}
|
|
675
696
|
}
|
|
676
697
|
},
|
|
677
|
-
disabled: !
|
|
678
|
-
"aria-disabled": !
|
|
679
|
-
title:
|
|
698
|
+
disabled: !q || U,
|
|
699
|
+
"aria-disabled": !q || U,
|
|
700
|
+
title: M ? "Setting up your seller organization..." : q ? void 0 : "Fill in all required fields to continue",
|
|
680
701
|
className: t("inline-flex items-center gap-2 rounded-button px-5 py-2 text-sm font-medium transition-colors", "bg-action-primary-bg text-action-primary-text", "hover:bg-action-primary-bg/90", "disabled:opacity-50 disabled:cursor-not-allowed", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"),
|
|
681
|
-
children:
|
|
702
|
+
children: U ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(m, {
|
|
682
703
|
size: 15,
|
|
683
704
|
className: "animate-spin"
|
|
684
|
-
}), "Submitting..."] }) :
|
|
705
|
+
}), "Submitting..."] }) : M ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(m, {
|
|
685
706
|
size: 15,
|
|
686
707
|
className: "animate-spin"
|
|
687
708
|
}), "Setting up your store..."] }) : "Create & Submit for Review"
|
|
@@ -693,6 +714,6 @@ var O = () => {
|
|
|
693
714
|
});
|
|
694
715
|
};
|
|
695
716
|
//#endregion
|
|
696
|
-
export {
|
|
717
|
+
export { T as CreatePhysicalItemPage };
|
|
697
718
|
|
|
698
719
|
//# sourceMappingURL=CreatePhysicalItemPage.js.map
|