@burdenoff/microfe-devportal 2026.902.1 → 2026.914.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,12 @@ 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 { useCallback as ee, useRef as c, useState as l } from "react";
6
- import { Info as u, Loader2 as d, Upload as f, X as p } from "lucide-react";
7
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
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";
8
9
  //#region src/devportal/pages/CreatePhysicalItemPage.tsx
9
- var _ = [
10
+ var y = [
10
11
  {
11
12
  value: "MERCHANDISE",
12
13
  label: "Merchandise"
@@ -39,7 +40,7 @@ var _ = [
39
40
  value: "CONSUMABLE",
40
41
  label: "Consumable"
41
42
  }
42
- ], v = [
43
+ ], b = [
43
44
  {
44
45
  value: "agri-seeds",
45
46
  label: "Agri-Inputs — Seeds"
@@ -60,7 +61,7 @@ var _ = [
60
61
  value: "agri-irrigation",
61
62
  label: "Agri-Inputs — Irrigation"
62
63
  }
63
- ], y = [
64
+ ], ee = [
64
65
  {
65
66
  value: "USD",
66
67
  label: "USD — US Dollar"
@@ -85,7 +86,7 @@ var _ = [
85
86
  value: "AED",
86
87
  label: "AED — UAE Dirham"
87
88
  }
88
- ], b = [
89
+ ], x = [
89
90
  "name",
90
91
  "slug",
91
92
  "type",
@@ -93,18 +94,18 @@ var _ = [
93
94
  "price",
94
95
  "currency",
95
96
  "stockQuantity"
96
- ], x = "\n query SellerMyPublisher {\n myPublisher {\n id\n }\n }\n", S = "\n query SellerOrgForPublisher {\n developerOrganizations(limit: 1, offset: 0) {\n edges {\n node {\n id\n name\n contactEmail\n websiteUrl\n legalEntityName\n taxCountry\n }\n }\n }\n }\n", C = "\n mutation RegisterPublisher($input: RegisterPublisherInput!) {\n registerPublisher(input: $input) {\n id\n name\n email\n }\n }\n", w = "\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", T = "\n mutation SubmitProduct($id: ID!, $notes: String) {\n submitProduct(id: $id, notes: $notes) {\n id\n status\n }\n }\n";
97
+ ], S = "\n query SellerMyPublisher {\n myPublisher {\n id\n }\n }\n", C = "\n mutation RegisterPublisher($input: RegisterPublisherInput!) {\n registerPublisher(input: $input) {\n id\n name\n email\n }\n }\n", w = "\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", T = "\n mutation SubmitProduct($id: ID!, $notes: String) {\n submitProduct(id: $id, notes: $notes) {\n id\n status\n }\n }\n";
97
98
  function E(e) {
98
99
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "-");
99
100
  }
100
101
  function D(e) {
101
- return b.every((t) => {
102
+ return x.every((t) => {
102
103
  let n = e[t];
103
104
  return typeof n == "boolean" ? !0 : n.trim() !== "";
104
105
  });
105
106
  }
106
107
  var O = () => {
107
- let { navigate: b, basePath: O, apiGatewayUrl: k, authToken: A } = e(), [j, M] = l({
108
+ let { navigate: x, basePath: O, apiGatewayUrl: k, authToken: A } = e(), { organization: j, loading: M, error: N } = c(), [P, F] = d({
108
109
  name: "",
109
110
  slug: "",
110
111
  type: "",
@@ -123,40 +124,40 @@ var O = () => {
123
124
  countryOfOrigin: "",
124
125
  warrantyInfo: "",
125
126
  returnPolicy: ""
126
- }), [N, P] = l([]), [F, I] = l(!1), L = c(null), [R, z] = l(!1), [B, V] = l(null), [H, U] = l(!1), W = D(j), G = `${k || ""}/global/graphql`, K = (e, t) => {
127
- M((n) => ({
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) => ({
128
129
  ...n,
129
130
  [e]: t
130
131
  }));
131
- }, q = (e) => {
132
+ }, X = (e) => {
132
133
  let t = e.target.value;
133
- M((e) => ({
134
+ F((e) => ({
134
135
  ...e,
135
136
  name: t,
136
137
  slug: E(t)
137
138
  }));
138
- }, J = (e) => (t) => {
139
- K(e, t.target.checked);
140
- }, Y = ee((e) => {
139
+ }, Z = (e) => (t) => {
140
+ Y(e, t.target.checked);
141
+ }, Q = l((e) => {
141
142
  let t = Array.from(e).filter((e) => e.type.startsWith("image/")).map((e) => ({
142
143
  file: e,
143
144
  url: URL.createObjectURL(e)
144
145
  }));
145
- P((e) => [...e, ...t]);
146
- }, []), X = (e) => {
147
- e.target.files && Y(e.target.files), e.target.value = "";
148
- }, Z = (e) => {
149
- e.preventDefault(), I(!1), e.dataTransfer.files && Y(e.dataTransfer.files);
150
- }, Q = (e) => {
151
- e.preventDefault(), I(!0);
152
- }, te = () => I(!1), ne = (e) => {
153
- P((t) => {
146
+ L((e) => [...e, ...t]);
147
+ }, []), te = (e) => {
148
+ 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) => {
154
155
  let n = [...t];
155
156
  return URL.revokeObjectURL(n[e].url), n.splice(e, 1), n;
156
157
  });
157
158
  };
158
159
  async function $(e, t) {
159
- let n = await (await fetch(G, {
160
+ let n = await (await fetch(J, {
160
161
  method: "POST",
161
162
  headers: {
162
163
  "Content-Type": "application/json",
@@ -171,145 +172,149 @@ var O = () => {
171
172
  if (n.errors?.length) throw Error(n.errors.map((e) => e.message).join("; "));
172
173
  return n.data;
173
174
  }
174
- return /* @__PURE__ */ h(n, {
175
+ return /* @__PURE__ */ _(n, {
175
176
  title: "List a Physical Item",
176
177
  description: "Fill in all required details. Your listing will be reviewed before it appears in the store.",
177
178
  backLink: "/seller/items",
178
179
  backLabel: "Back to My Items",
179
- children: /* @__PURE__ */ g("div", {
180
+ children: /* @__PURE__ */ v("div", {
180
181
  className: "space-y-8 max-w-3xl",
181
182
  children: [
182
- H && /* @__PURE__ */ h("div", {
183
+ G && /* @__PURE__ */ _("div", {
183
184
  className: "rounded-card border border-status-success-text/30 bg-status-success-bg-subtle px-4 py-3 text-sm text-status-success-text",
184
185
  children: "Your listing has been submitted for review! Redirecting..."
185
186
  }),
186
- B && /* @__PURE__ */ h("div", {
187
+ U && /* @__PURE__ */ _("div", {
188
+ 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
190
+ }),
191
+ N && /* @__PURE__ */ v("div", {
187
192
  className: "rounded-card border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-3 text-sm text-status-error-text",
188
- children: B
193
+ children: ["Couldn't set up your seller organization: ", N]
189
194
  }),
190
- /* @__PURE__ */ h(r, {
195
+ /* @__PURE__ */ _(r, {
191
196
  title: "Basic Information",
192
197
  description: "Core details shown in the store listing.",
193
- children: /* @__PURE__ */ g("div", {
198
+ children: /* @__PURE__ */ v("div", {
194
199
  className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-5",
195
200
  children: [
196
- /* @__PURE__ */ h(a, {
201
+ /* @__PURE__ */ _(a, {
197
202
  label: "Name",
198
203
  required: !0,
199
- value: j.name,
200
- onChange: q,
204
+ value: P.name,
205
+ onChange: X,
201
206
  placeholder: "e.g. Wireless Ergonomic Keyboard",
202
207
  maxLength: 120
203
208
  }),
204
- /* @__PURE__ */ h(a, {
209
+ /* @__PURE__ */ _(a, {
205
210
  label: "Slug",
206
211
  required: !0,
207
- value: j.slug,
208
- onChange: (e) => K("slug", e.target.value),
212
+ value: P.slug,
213
+ onChange: (e) => Y("slug", e.target.value),
209
214
  placeholder: "auto-derived-from-name",
210
215
  hint: "URL-friendly identifier. Auto-derived from name; you can edit it."
211
216
  }),
212
- /* @__PURE__ */ h(o, {
217
+ /* @__PURE__ */ _(o, {
213
218
  label: "Product Type",
214
219
  required: !0,
215
- value: j.type,
216
- onChange: (e) => K("type", e.target.value),
217
- options: _,
220
+ value: P.type,
221
+ onChange: (e) => Y("type", e.target.value),
222
+ options: y,
218
223
  placeholder: "Select a type"
219
224
  }),
220
- /* @__PURE__ */ h(o, {
225
+ /* @__PURE__ */ _(o, {
221
226
  label: "Store Category",
222
- value: j.category,
223
- onChange: (e) => K("category", e.target.value),
224
- options: v,
227
+ value: P.category,
228
+ onChange: (e) => Y("category", e.target.value),
229
+ options: b,
225
230
  placeholder: "General / uncategorised",
226
231
  hint: "Pick an Agri-Inputs category to list this item in the HealthyBowl Agri-Inputs Store. Leave blank for a general store listing."
227
232
  }),
228
- /* @__PURE__ */ h(a, {
233
+ /* @__PURE__ */ _(a, {
229
234
  label: "Short Description",
230
235
  required: !0,
231
- value: j.shortDescription,
232
- onChange: (e) => K("shortDescription", e.target.value),
236
+ value: P.shortDescription,
237
+ onChange: (e) => Y("shortDescription", e.target.value),
233
238
  placeholder: "One-line summary shown on the store card",
234
239
  maxLength: 160,
235
- hint: `${j.shortDescription.length}/160`
240
+ hint: `${P.shortDescription.length}/160`
236
241
  }),
237
- /* @__PURE__ */ h(s, {
242
+ /* @__PURE__ */ _(s, {
238
243
  label: "Long Description",
239
- value: j.longDescription,
240
- onChange: (e) => K("longDescription", e.target.value),
244
+ value: P.longDescription,
245
+ onChange: (e) => Y("longDescription", e.target.value),
241
246
  rows: 5,
242
247
  placeholder: "Detailed product description, features, specs…"
243
248
  })
244
249
  ]
245
250
  })
246
251
  }),
247
- /* @__PURE__ */ h(r, {
252
+ /* @__PURE__ */ _(r, {
248
253
  title: "Product Images",
249
254
  description: "The first image is used as the main icon.",
250
- children: /* @__PURE__ */ g("div", {
255
+ children: /* @__PURE__ */ v("div", {
251
256
  className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-4",
252
257
  children: [
253
- /* @__PURE__ */ g("div", {
254
- onDrop: Z,
255
- onDragOver: Q,
256
- onDragLeave: te,
257
- onClick: () => L.current?.click(),
258
- 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", F ? "border-action-primary-bg bg-action-primary-bg/5" : "border-border-subtle hover:border-border-strong"),
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"),
259
264
  children: [
260
- /* @__PURE__ */ h(f, {
265
+ /* @__PURE__ */ _(m, {
261
266
  size: 28,
262
- className: F ? "text-action-primary-bg" : "text-text-muted"
267
+ className: R ? "text-action-primary-bg" : "text-text-muted"
263
268
  }),
264
- /* @__PURE__ */ g("div", {
269
+ /* @__PURE__ */ v("div", {
265
270
  className: "text-center space-y-1",
266
- children: [/* @__PURE__ */ h("p", {
271
+ children: [/* @__PURE__ */ _("p", {
267
272
  className: "text-sm font-medium text-text-primary",
268
273
  children: "Drag and drop images here"
269
- }), /* @__PURE__ */ h("p", {
274
+ }), /* @__PURE__ */ _("p", {
270
275
  className: "text-xs text-text-muted",
271
276
  children: "or click to browse — accepts any image format, multiple files"
272
277
  })]
273
278
  }),
274
- /* @__PURE__ */ h("input", {
275
- ref: L,
279
+ /* @__PURE__ */ _("input", {
280
+ ref: B,
276
281
  type: "file",
277
282
  accept: "image/*",
278
283
  multiple: !0,
279
284
  className: "sr-only",
280
- onChange: X
285
+ onChange: te
281
286
  })
282
287
  ]
283
288
  }),
284
- N.length > 0 && /* @__PURE__ */ h("div", {
289
+ I.length > 0 && /* @__PURE__ */ _("div", {
285
290
  className: "flex flex-wrap gap-3",
286
- children: N.map((e, t) => /* @__PURE__ */ g("div", {
291
+ children: I.map((e, t) => /* @__PURE__ */ v("div", {
287
292
  className: "relative group",
288
293
  children: [
289
- /* @__PURE__ */ h("img", {
294
+ /* @__PURE__ */ _("img", {
290
295
  src: e.url,
291
296
  alt: `Product image ${t + 1}`,
292
297
  className: "h-20 w-20 rounded-input object-cover border border-border-subtle"
293
298
  }),
294
- t === 0 && /* @__PURE__ */ h("span", {
299
+ t === 0 && /* @__PURE__ */ _("span", {
295
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",
296
301
  children: "Main"
297
302
  }),
298
- /* @__PURE__ */ h("button", {
303
+ /* @__PURE__ */ _("button", {
299
304
  type: "button",
300
305
  onClick: (e) => {
301
- e.stopPropagation(), ne(t);
306
+ e.stopPropagation(), ae(t);
302
307
  },
303
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",
304
309
  "aria-label": "Remove image",
305
- children: /* @__PURE__ */ h(p, { size: 11 })
310
+ children: /* @__PURE__ */ _(h, { size: 11 })
306
311
  })
307
312
  ]
308
313
  }, e.url))
309
314
  }),
310
- /* @__PURE__ */ g("p", {
315
+ /* @__PURE__ */ v("p", {
311
316
  className: "flex items-start gap-2 rounded-input border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
312
- children: [/* @__PURE__ */ h(u, {
317
+ children: [/* @__PURE__ */ _(f, {
313
318
  size: 13,
314
319
  className: "mt-0.5 shrink-0 text-text-muted"
315
320
  }), "At least 1 image helps buyers — high quality photos increase conversions."]
@@ -317,91 +322,91 @@ var O = () => {
317
322
  ]
318
323
  })
319
324
  }),
320
- /* @__PURE__ */ h(r, {
325
+ /* @__PURE__ */ _(r, {
321
326
  title: "Pricing",
322
- children: /* @__PURE__ */ g("div", {
327
+ children: /* @__PURE__ */ v("div", {
323
328
  className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-5",
324
- children: [/* @__PURE__ */ g("div", {
329
+ children: [/* @__PURE__ */ v("div", {
325
330
  className: "grid grid-cols-1 gap-5 sm:grid-cols-2",
326
- children: [/* @__PURE__ */ h(a, {
331
+ children: [/* @__PURE__ */ _(a, {
327
332
  label: "Price",
328
333
  required: !0,
329
334
  type: "number",
330
- value: j.price,
331
- onChange: (e) => K("price", e.target.value),
335
+ value: P.price,
336
+ onChange: (e) => Y("price", e.target.value),
332
337
  placeholder: "0.00",
333
338
  min: .01,
334
339
  step: "0.01"
335
- }), /* @__PURE__ */ h(o, {
340
+ }), /* @__PURE__ */ _(o, {
336
341
  label: "Currency",
337
342
  required: !0,
338
- value: j.currency,
339
- onChange: (e) => K("currency", e.target.value),
340
- options: y,
343
+ value: P.currency,
344
+ onChange: (e) => Y("currency", e.target.value),
345
+ options: ee,
341
346
  placeholder: "Select currency"
342
347
  })]
343
- }), /* @__PURE__ */ h(a, {
348
+ }), /* @__PURE__ */ _(a, {
344
349
  label: "Tags",
345
- value: j.tags,
346
- onChange: (e) => K("tags", e.target.value),
350
+ value: P.tags,
351
+ onChange: (e) => Y("tags", e.target.value),
347
352
  placeholder: "mechanical, wireless, ergonomic",
348
353
  hint: "Comma-separated keywords to help buyers find your item."
349
354
  })]
350
355
  })
351
356
  }),
352
- /* @__PURE__ */ h(r, {
357
+ /* @__PURE__ */ _(r, {
353
358
  title: "Inventory",
354
- children: /* @__PURE__ */ g("div", {
359
+ children: /* @__PURE__ */ v("div", {
355
360
  className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-5",
356
- children: [/* @__PURE__ */ g("div", {
361
+ children: [/* @__PURE__ */ v("div", {
357
362
  className: "grid grid-cols-1 gap-5 sm:grid-cols-2",
358
- children: [/* @__PURE__ */ h(a, {
363
+ children: [/* @__PURE__ */ _(a, {
359
364
  label: "Stock Quantity",
360
365
  required: !0,
361
366
  type: "number",
362
- value: j.stockQuantity,
363
- onChange: (e) => K("stockQuantity", e.target.value),
367
+ value: P.stockQuantity,
368
+ onChange: (e) => Y("stockQuantity", e.target.value),
364
369
  min: 0,
365
370
  step: 1
366
- }), /* @__PURE__ */ h(a, {
371
+ }), /* @__PURE__ */ _(a, {
367
372
  label: "SKU",
368
- value: j.sku,
369
- onChange: (e) => K("sku", e.target.value),
373
+ value: P.sku,
374
+ onChange: (e) => Y("sku", e.target.value),
370
375
  placeholder: "e.g. KB-WL-001",
371
376
  hint: "Your internal stock-keeping unit reference."
372
377
  })]
373
- }), /* @__PURE__ */ h(i, {
378
+ }), /* @__PURE__ */ _(i, {
374
379
  label: "Track Inventory",
375
380
  description: "Automatically reduce stock when orders are placed.",
376
- checked: j.trackInventory,
377
- onChange: J("trackInventory")
381
+ checked: P.trackInventory,
382
+ onChange: Z("trackInventory")
378
383
  })]
379
384
  })
380
385
  }),
381
- /* @__PURE__ */ h(r, {
386
+ /* @__PURE__ */ _(r, {
382
387
  title: "Shipping",
383
- children: /* @__PURE__ */ g("div", {
388
+ children: /* @__PURE__ */ v("div", {
384
389
  className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-5",
385
390
  children: [
386
- /* @__PURE__ */ h(i, {
391
+ /* @__PURE__ */ _(i, {
387
392
  label: "Requires Shipping",
388
393
  description: "This item will be physically shipped to the buyer.",
389
- checked: j.requiresShipping,
390
- onChange: J("requiresShipping")
394
+ checked: P.requiresShipping,
395
+ onChange: Z("requiresShipping")
391
396
  }),
392
- j.requiresShipping && /* @__PURE__ */ h(a, {
397
+ P.requiresShipping && /* @__PURE__ */ _(a, {
393
398
  label: "Weight (kg)",
394
399
  type: "number",
395
- value: j.weightKg,
396
- onChange: (e) => K("weightKg", e.target.value),
400
+ value: P.weightKg,
401
+ onChange: (e) => Y("weightKg", e.target.value),
397
402
  placeholder: "0.0",
398
403
  min: 0,
399
404
  step: "0.01",
400
405
  hint: "Used to calculate shipping costs."
401
406
  }),
402
- /* @__PURE__ */ g("p", {
407
+ /* @__PURE__ */ v("p", {
403
408
  className: "flex items-start gap-2 rounded-input border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
404
- children: [/* @__PURE__ */ h(u, {
409
+ children: [/* @__PURE__ */ _(f, {
405
410
  size: 13,
406
411
  className: "mt-0.5 shrink-0 text-text-muted"
407
412
  }), "Delivery fees are configured at the organization level in store settings."]
@@ -409,108 +414,111 @@ var O = () => {
409
414
  ]
410
415
  })
411
416
  }),
412
- /* @__PURE__ */ h(r, {
417
+ /* @__PURE__ */ _(r, {
413
418
  title: "Product Details",
414
419
  description: "Optional supplemental information for buyers.",
415
- children: /* @__PURE__ */ g("div", {
420
+ children: /* @__PURE__ */ v("div", {
416
421
  className: "rounded-card border border-border-seam bg-bg-surface p-6 space-y-5",
417
422
  children: [
418
- /* @__PURE__ */ g("div", {
423
+ /* @__PURE__ */ v("div", {
419
424
  className: "grid grid-cols-1 gap-5 sm:grid-cols-2",
420
- children: [/* @__PURE__ */ h(a, {
425
+ children: [/* @__PURE__ */ _(a, {
421
426
  label: "Brand",
422
- value: j.brand,
423
- onChange: (e) => K("brand", e.target.value),
427
+ value: P.brand,
428
+ onChange: (e) => Y("brand", e.target.value),
424
429
  placeholder: "e.g. Logitech"
425
- }), /* @__PURE__ */ h(a, {
430
+ }), /* @__PURE__ */ _(a, {
426
431
  label: "Country of Origin",
427
- value: j.countryOfOrigin,
428
- onChange: (e) => K("countryOfOrigin", e.target.value),
432
+ value: P.countryOfOrigin,
433
+ onChange: (e) => Y("countryOfOrigin", e.target.value),
429
434
  placeholder: "e.g. China"
430
435
  })]
431
436
  }),
432
- /* @__PURE__ */ h(a, {
437
+ /* @__PURE__ */ _(a, {
433
438
  label: "Warranty Info",
434
- value: j.warrantyInfo,
435
- onChange: (e) => K("warrantyInfo", e.target.value),
439
+ value: P.warrantyInfo,
440
+ onChange: (e) => Y("warrantyInfo", e.target.value),
436
441
  placeholder: "e.g. 1-year limited manufacturer warranty"
437
442
  }),
438
- /* @__PURE__ */ h(s, {
443
+ /* @__PURE__ */ _(s, {
439
444
  label: "Return Policy",
440
- value: j.returnPolicy,
441
- onChange: (e) => K("returnPolicy", e.target.value),
445
+ value: P.returnPolicy,
446
+ onChange: (e) => Y("returnPolicy", e.target.value),
442
447
  rows: 3,
443
448
  placeholder: "e.g. 30-day returns accepted"
444
449
  })
445
450
  ]
446
451
  })
447
452
  }),
448
- /* @__PURE__ */ g("div", {
453
+ /* @__PURE__ */ v("div", {
449
454
  className: "flex items-center gap-3 pb-8",
450
- children: [/* @__PURE__ */ h("button", {
455
+ children: [/* @__PURE__ */ _("button", {
451
456
  type: "button",
452
- onClick: () => b?.(`${O}/seller/items`),
457
+ onClick: () => x?.(`${O}/seller/items`),
453
458
  className: "rounded-button border border-border-strong px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors",
454
459
  children: "Cancel"
455
- }), /* @__PURE__ */ h("div", {
460
+ }), /* @__PURE__ */ _("div", {
456
461
  className: "relative",
457
- children: /* @__PURE__ */ h("button", {
462
+ children: /* @__PURE__ */ _("button", {
458
463
  type: "button",
459
464
  onClick: async () => {
460
- if (!(!W || R)) {
461
- z(!0), V(null);
465
+ if (!(!q || V || !j)) {
466
+ H(!0), W(null);
462
467
  try {
463
- let e = (await $(x)).myPublisher?.id ?? null, t = (await $(S)).developerOrganizations.edges[0]?.node ?? null;
468
+ let e = (await $(S)).myPublisher?.id ?? null;
464
469
  e ||= (await $(C, { input: {
465
- name: t?.legalEntityName ?? t?.name ?? "My Store",
466
- email: t?.contactEmail ?? "seller@burdenoff.com",
467
- websiteUrl: t?.websiteUrl ?? null,
468
- legalName: t?.legalEntityName ?? t?.name ?? "My Store",
469
- country: t?.taxCountry ?? null,
470
- contactEmail: t?.contactEmail ?? null
470
+ name: j.legalEntityName ?? j.name,
471
+ email: j.contactEmail ?? "seller@burdenoff.com",
472
+ websiteUrl: j.websiteUrl ?? null,
473
+ legalName: j.legalEntityName ?? j.name,
474
+ country: j.taxCountry ?? null,
475
+ contactEmail: j.contactEmail ?? null
471
476
  } })).registerPublisher.id;
472
- let n = j.tags.split(",").map((e) => e.trim()).filter(Boolean), r = (await $(w, { input: {
473
- name: j.name.trim(),
474
- slug: j.slug.trim(),
475
- type: j.type,
476
- category: j.category.trim() || null,
477
- description: j.shortDescription.trim(),
478
- longDescription: j.longDescription.trim() || null,
479
- price: parseFloat(j.price),
480
- currency: j.currency,
481
- tags: n.length > 0 ? n : null,
482
- stockQuantity: parseInt(j.stockQuantity, 10),
483
- sku: j.sku.trim() || null,
484
- trackInventory: j.trackInventory,
485
- requiresShipping: j.requiresShipping,
486
- weight: j.requiresShipping && j.weightKg.trim() ? parseFloat(j.weightKg) : null,
487
- brand: j.brand.trim() || null,
488
- countryOfOrigin: j.countryOfOrigin.trim() || null,
489
- warrantyInfo: j.warrantyInfo.trim() || null,
490
- returnPolicy: j.returnPolicy.trim() || null,
491
- metadata: t?.id ? { developerOrganizationId: t.id } : null
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,
486
+ 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,
496
+ organizationId: j.id
492
497
  } })).createPhysicalProduct.id;
493
498
  await $(T, {
494
- id: r,
499
+ id: n,
495
500
  notes: "Submitted from seller portal"
496
- }), U(!0), setTimeout(() => {
497
- b?.(`${O}/seller/items`);
501
+ }), K(!0), setTimeout(() => {
502
+ x?.(`${O}/seller/items`);
498
503
  }, 2e3);
499
504
  } catch (e) {
500
- V(e instanceof Error ? e.message : "Submission failed. Please try again.");
505
+ W(e instanceof Error ? e.message : "Submission failed. Please try again.");
501
506
  } finally {
502
- z(!1);
507
+ H(!1);
503
508
  }
504
509
  }
505
510
  },
506
- disabled: !W || R,
507
- "aria-disabled": !W || R,
508
- title: W ? void 0 : "Fill in all required fields to continue",
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",
509
514
  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"),
510
- children: R ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(d, {
515
+ children: V ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(p, {
516
+ size: 15,
517
+ className: "animate-spin"
518
+ }), "Submitting..."] }) : M ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(p, {
511
519
  size: 15,
512
520
  className: "animate-spin"
513
- }), "Submitting..."] }) : "Create & Submit for Review"
521
+ }), "Setting up your store..."] }) : "Create & Submit for Review"
514
522
  })
515
523
  })]
516
524
  })