@burdenoff/microfe-devportal 2026.914.3 → 2026.914.5

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