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