@medusajs/draft-order 2.12.2-preview-20251204150146 → 2.12.2-preview-20251204210133

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.
@@ -9762,6 +9762,27 @@ const BillingAddressForm = ({ order }) => {
9762
9762
  ) });
9763
9763
  };
9764
9764
  const schema$5 = addressSchema;
9765
+ const CustomItems = () => {
9766
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9767
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9768
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9769
+ ] });
9770
+ };
9771
+ const CustomItemsForm = () => {
9772
+ const form = reactHookForm.useForm({
9773
+ resolver: zod.zodResolver(schema$4)
9774
+ });
9775
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9776
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9777
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9778
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9779
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9780
+ ] }) })
9781
+ ] }) });
9782
+ };
9783
+ const schema$4 = objectType({
9784
+ email: stringType().email()
9785
+ });
9765
9786
  const Email = () => {
9766
9787
  const { id } = reactRouterDom.useParams();
9767
9788
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9784,7 +9805,7 @@ const EmailForm = ({ order }) => {
9784
9805
  defaultValues: {
9785
9806
  email: order.email ?? ""
9786
9807
  },
9787
- resolver: zod.zodResolver(schema$4)
9808
+ resolver: zod.zodResolver(schema$3)
9788
9809
  });
9789
9810
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9790
9811
  const { handleSuccess } = useRouteModal();
@@ -9827,7 +9848,7 @@ const EmailForm = ({ order }) => {
9827
9848
  }
9828
9849
  ) });
9829
9850
  };
9830
- const schema$4 = objectType({
9851
+ const schema$3 = objectType({
9831
9852
  email: stringType().email()
9832
9853
  });
9833
9854
  const NumberInput = React.forwardRef(
@@ -10804,27 +10825,6 @@ const customItemSchema = objectType({
10804
10825
  quantity: numberType(),
10805
10826
  unit_price: unionType([numberType(), stringType()])
10806
10827
  });
10807
- const CustomItems = () => {
10808
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10809
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
10810
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
10811
- ] });
10812
- };
10813
- const CustomItemsForm = () => {
10814
- const form = reactHookForm.useForm({
10815
- resolver: zod.zodResolver(schema$3)
10816
- });
10817
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
10818
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
10819
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10820
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10821
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
10822
- ] }) })
10823
- ] }) });
10824
- };
10825
- const schema$3 = objectType({
10826
- email: stringType().email()
10827
- });
10828
10828
  const InlineTip = React.forwardRef(
10829
10829
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10830
10830
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -11452,112 +11452,6 @@ function getPromotionIds(items, shippingMethods) {
11452
11452
  }
11453
11453
  return Array.from(promotionIds);
11454
11454
  }
11455
- const SalesChannel = () => {
11456
- const { id } = reactRouterDom.useParams();
11457
- const { draft_order, isPending, isError, error } = useDraftOrder(
11458
- id,
11459
- {
11460
- fields: "+sales_channel_id"
11461
- },
11462
- {
11463
- enabled: !!id
11464
- }
11465
- );
11466
- if (isError) {
11467
- throw error;
11468
- }
11469
- const ISrEADY = !!draft_order && !isPending;
11470
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11471
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11472
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11473
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11474
- ] }),
11475
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11476
- ] });
11477
- };
11478
- const SalesChannelForm = ({ order }) => {
11479
- const form = reactHookForm.useForm({
11480
- defaultValues: {
11481
- sales_channel_id: order.sales_channel_id || ""
11482
- },
11483
- resolver: zod.zodResolver(schema$2)
11484
- });
11485
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11486
- const { handleSuccess } = useRouteModal();
11487
- const onSubmit = form.handleSubmit(async (data) => {
11488
- await mutateAsync(
11489
- {
11490
- sales_channel_id: data.sales_channel_id
11491
- },
11492
- {
11493
- onSuccess: () => {
11494
- ui.toast.success("Sales channel updated");
11495
- handleSuccess();
11496
- },
11497
- onError: (error) => {
11498
- ui.toast.error(error.message);
11499
- }
11500
- }
11501
- );
11502
- });
11503
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11504
- KeyboundForm,
11505
- {
11506
- className: "flex flex-1 flex-col overflow-hidden",
11507
- onSubmit,
11508
- children: [
11509
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11510
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11511
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11512
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11513
- ] }) })
11514
- ]
11515
- }
11516
- ) });
11517
- };
11518
- const SalesChannelField = ({ control, order }) => {
11519
- const salesChannels = useComboboxData({
11520
- queryFn: async (params) => {
11521
- return await sdk.admin.salesChannel.list(params);
11522
- },
11523
- queryKey: ["sales-channels"],
11524
- getOptions: (data) => {
11525
- return data.sales_channels.map((salesChannel) => ({
11526
- label: salesChannel.name,
11527
- value: salesChannel.id
11528
- }));
11529
- },
11530
- defaultValue: order.sales_channel_id || void 0
11531
- });
11532
- return /* @__PURE__ */ jsxRuntime.jsx(
11533
- Form$2.Field,
11534
- {
11535
- control,
11536
- name: "sales_channel_id",
11537
- render: ({ field }) => {
11538
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11539
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11540
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11541
- Combobox,
11542
- {
11543
- options: salesChannels.options,
11544
- fetchNextPage: salesChannels.fetchNextPage,
11545
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11546
- searchValue: salesChannels.searchValue,
11547
- onSearchValueChange: salesChannels.onSearchValueChange,
11548
- placeholder: "Select sales channel",
11549
- ...field
11550
- }
11551
- ) }),
11552
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11553
- ] });
11554
- }
11555
- }
11556
- );
11557
- };
11558
- const schema$2 = objectType({
11559
- sales_channel_id: stringType().min(1)
11560
- });
11561
11455
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11562
11456
  const Shipping = () => {
11563
11457
  var _a;
@@ -12365,44 +12259,60 @@ const CustomAmountField = ({
12365
12259
  }
12366
12260
  );
12367
12261
  };
12368
- const TransferOwnership = () => {
12262
+ const ShippingAddress = () => {
12369
12263
  const { id } = reactRouterDom.useParams();
12370
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12371
- fields: "id,customer_id,customer.*"
12264
+ const { order, isPending, isError, error } = useOrder(id, {
12265
+ fields: "+shipping_address"
12372
12266
  });
12373
12267
  if (isError) {
12374
12268
  throw error;
12375
12269
  }
12376
- const isReady = !isPending && !!draft_order;
12270
+ const isReady = !isPending && !!order;
12377
12271
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12378
12272
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12379
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Transfer Ownership" }) }),
12380
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12273
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12274
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12381
12275
  ] }),
12382
- isReady && /* @__PURE__ */ jsxRuntime.jsx(TransferOwnershipForm, { order: draft_order })
12276
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12383
12277
  ] });
12384
12278
  };
12385
- const TransferOwnershipForm = ({ order }) => {
12386
- var _a, _b;
12279
+ const ShippingAddressForm = ({ order }) => {
12280
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12387
12281
  const form = reactHookForm.useForm({
12388
12282
  defaultValues: {
12389
- customer_id: order.customer_id || ""
12283
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12284
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12285
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12286
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12287
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12288
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12289
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12290
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12291
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12292
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12390
12293
  },
12391
- resolver: zod.zodResolver(schema$1)
12294
+ resolver: zod.zodResolver(schema$2)
12392
12295
  });
12393
12296
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12394
12297
  const { handleSuccess } = useRouteModal();
12395
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12396
- const currentCustomer = order.customer ? {
12397
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12398
- value: order.customer.id
12399
- } : null;
12400
12298
  const onSubmit = form.handleSubmit(async (data) => {
12401
12299
  await mutateAsync(
12402
- { customer_id: data.customer_id },
12300
+ {
12301
+ shipping_address: {
12302
+ first_name: data.first_name,
12303
+ last_name: data.last_name,
12304
+ company: data.company,
12305
+ address_1: data.address_1,
12306
+ address_2: data.address_2,
12307
+ city: data.city,
12308
+ province: data.province,
12309
+ country_code: data.country_code,
12310
+ postal_code: data.postal_code,
12311
+ phone: data.phone
12312
+ }
12313
+ },
12403
12314
  {
12404
12315
  onSuccess: () => {
12405
- ui.toast.success("Customer updated");
12406
12316
  handleSuccess();
12407
12317
  },
12408
12318
  onError: (error) => {
@@ -12417,55 +12327,348 @@ const TransferOwnershipForm = ({ order }) => {
12417
12327
  className: "flex flex-1 flex-col overflow-hidden",
12418
12328
  onSubmit,
12419
12329
  children: [
12420
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
12421
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx(Illustration, {}) }),
12422
- currentCustomer && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-3", children: [
12423
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
12424
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
12425
- /* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { children: "The customer that is currently associated with this draft order." })
12426
- ] }),
12427
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { disabled: true, value: currentCustomer.value, children: [
12428
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
12429
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
12430
- ] })
12431
- ] }),
12330
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12432
12331
  /* @__PURE__ */ jsxRuntime.jsx(
12433
- CustomerField,
12332
+ Form$2.Field,
12434
12333
  {
12435
12334
  control: form.control,
12436
- currentCustomerId: order.customer_id
12335
+ name: "country_code",
12336
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12337
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12338
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12339
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12340
+ ] })
12437
12341
  }
12438
- )
12439
- ] }),
12440
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
12441
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", children: "Cancel" }) }),
12442
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12443
- ] }) })
12444
- ]
12445
- }
12446
- ) });
12447
- };
12448
- const CustomerField = ({ control, currentCustomerId }) => {
12449
- const customers = useComboboxData({
12450
- queryFn: async (params) => {
12451
- return await sdk.admin.customer.list({
12452
- ...params,
12453
- id: currentCustomerId ? { $nin: [currentCustomerId] } : void 0
12454
- });
12455
- },
12456
- queryKey: ["customers"],
12457
- getOptions: (data) => {
12458
- return data.customers.map((customer) => {
12459
- const name = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
12460
- return {
12461
- label: name ? `${name} (${customer.email})` : customer.email,
12462
- value: customer.id
12463
- };
12464
- });
12465
- }
12466
- });
12467
- return /* @__PURE__ */ jsxRuntime.jsx(
12468
- Form$2.Field,
12342
+ ),
12343
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12344
+ /* @__PURE__ */ jsxRuntime.jsx(
12345
+ Form$2.Field,
12346
+ {
12347
+ control: form.control,
12348
+ name: "first_name",
12349
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12350
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12351
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12352
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12353
+ ] })
12354
+ }
12355
+ ),
12356
+ /* @__PURE__ */ jsxRuntime.jsx(
12357
+ Form$2.Field,
12358
+ {
12359
+ control: form.control,
12360
+ name: "last_name",
12361
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12362
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12363
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12364
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12365
+ ] })
12366
+ }
12367
+ )
12368
+ ] }),
12369
+ /* @__PURE__ */ jsxRuntime.jsx(
12370
+ Form$2.Field,
12371
+ {
12372
+ control: form.control,
12373
+ name: "company",
12374
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12375
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12376
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12377
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12378
+ ] })
12379
+ }
12380
+ ),
12381
+ /* @__PURE__ */ jsxRuntime.jsx(
12382
+ Form$2.Field,
12383
+ {
12384
+ control: form.control,
12385
+ name: "address_1",
12386
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12387
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12388
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12389
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12390
+ ] })
12391
+ }
12392
+ ),
12393
+ /* @__PURE__ */ jsxRuntime.jsx(
12394
+ Form$2.Field,
12395
+ {
12396
+ control: form.control,
12397
+ name: "address_2",
12398
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12399
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12400
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12401
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12402
+ ] })
12403
+ }
12404
+ ),
12405
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12406
+ /* @__PURE__ */ jsxRuntime.jsx(
12407
+ Form$2.Field,
12408
+ {
12409
+ control: form.control,
12410
+ name: "postal_code",
12411
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12412
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12413
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12414
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12415
+ ] })
12416
+ }
12417
+ ),
12418
+ /* @__PURE__ */ jsxRuntime.jsx(
12419
+ Form$2.Field,
12420
+ {
12421
+ control: form.control,
12422
+ name: "city",
12423
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12424
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12425
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12426
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12427
+ ] })
12428
+ }
12429
+ )
12430
+ ] }),
12431
+ /* @__PURE__ */ jsxRuntime.jsx(
12432
+ Form$2.Field,
12433
+ {
12434
+ control: form.control,
12435
+ name: "province",
12436
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12437
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12438
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12439
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12440
+ ] })
12441
+ }
12442
+ ),
12443
+ /* @__PURE__ */ jsxRuntime.jsx(
12444
+ Form$2.Field,
12445
+ {
12446
+ control: form.control,
12447
+ name: "phone",
12448
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12449
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12450
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12451
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12452
+ ] })
12453
+ }
12454
+ )
12455
+ ] }) }),
12456
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12457
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12458
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12459
+ ] }) })
12460
+ ]
12461
+ }
12462
+ ) });
12463
+ };
12464
+ const schema$2 = addressSchema;
12465
+ const SalesChannel = () => {
12466
+ const { id } = reactRouterDom.useParams();
12467
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12468
+ id,
12469
+ {
12470
+ fields: "+sales_channel_id"
12471
+ },
12472
+ {
12473
+ enabled: !!id
12474
+ }
12475
+ );
12476
+ if (isError) {
12477
+ throw error;
12478
+ }
12479
+ const ISrEADY = !!draft_order && !isPending;
12480
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12481
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12482
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
12483
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12484
+ ] }),
12485
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
12486
+ ] });
12487
+ };
12488
+ const SalesChannelForm = ({ order }) => {
12489
+ const form = reactHookForm.useForm({
12490
+ defaultValues: {
12491
+ sales_channel_id: order.sales_channel_id || ""
12492
+ },
12493
+ resolver: zod.zodResolver(schema$1)
12494
+ });
12495
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12496
+ const { handleSuccess } = useRouteModal();
12497
+ const onSubmit = form.handleSubmit(async (data) => {
12498
+ await mutateAsync(
12499
+ {
12500
+ sales_channel_id: data.sales_channel_id
12501
+ },
12502
+ {
12503
+ onSuccess: () => {
12504
+ ui.toast.success("Sales channel updated");
12505
+ handleSuccess();
12506
+ },
12507
+ onError: (error) => {
12508
+ ui.toast.error(error.message);
12509
+ }
12510
+ }
12511
+ );
12512
+ });
12513
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12514
+ KeyboundForm,
12515
+ {
12516
+ className: "flex flex-1 flex-col overflow-hidden",
12517
+ onSubmit,
12518
+ children: [
12519
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
12520
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12521
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12522
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12523
+ ] }) })
12524
+ ]
12525
+ }
12526
+ ) });
12527
+ };
12528
+ const SalesChannelField = ({ control, order }) => {
12529
+ const salesChannels = useComboboxData({
12530
+ queryFn: async (params) => {
12531
+ return await sdk.admin.salesChannel.list(params);
12532
+ },
12533
+ queryKey: ["sales-channels"],
12534
+ getOptions: (data) => {
12535
+ return data.sales_channels.map((salesChannel) => ({
12536
+ label: salesChannel.name,
12537
+ value: salesChannel.id
12538
+ }));
12539
+ },
12540
+ defaultValue: order.sales_channel_id || void 0
12541
+ });
12542
+ return /* @__PURE__ */ jsxRuntime.jsx(
12543
+ Form$2.Field,
12544
+ {
12545
+ control,
12546
+ name: "sales_channel_id",
12547
+ render: ({ field }) => {
12548
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12549
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
12550
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12551
+ Combobox,
12552
+ {
12553
+ options: salesChannels.options,
12554
+ fetchNextPage: salesChannels.fetchNextPage,
12555
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
12556
+ searchValue: salesChannels.searchValue,
12557
+ onSearchValueChange: salesChannels.onSearchValueChange,
12558
+ placeholder: "Select sales channel",
12559
+ ...field
12560
+ }
12561
+ ) }),
12562
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12563
+ ] });
12564
+ }
12565
+ }
12566
+ );
12567
+ };
12568
+ const schema$1 = objectType({
12569
+ sales_channel_id: stringType().min(1)
12570
+ });
12571
+ const TransferOwnership = () => {
12572
+ const { id } = reactRouterDom.useParams();
12573
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12574
+ fields: "id,customer_id,customer.*"
12575
+ });
12576
+ if (isError) {
12577
+ throw error;
12578
+ }
12579
+ const isReady = !isPending && !!draft_order;
12580
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12581
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12582
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Transfer Ownership" }) }),
12583
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12584
+ ] }),
12585
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(TransferOwnershipForm, { order: draft_order })
12586
+ ] });
12587
+ };
12588
+ const TransferOwnershipForm = ({ order }) => {
12589
+ var _a, _b;
12590
+ const form = reactHookForm.useForm({
12591
+ defaultValues: {
12592
+ customer_id: order.customer_id || ""
12593
+ },
12594
+ resolver: zod.zodResolver(schema)
12595
+ });
12596
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12597
+ const { handleSuccess } = useRouteModal();
12598
+ const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12599
+ const currentCustomer = order.customer ? {
12600
+ label: name ? `${name} (${order.customer.email})` : order.customer.email,
12601
+ value: order.customer.id
12602
+ } : null;
12603
+ const onSubmit = form.handleSubmit(async (data) => {
12604
+ await mutateAsync(
12605
+ { customer_id: data.customer_id },
12606
+ {
12607
+ onSuccess: () => {
12608
+ ui.toast.success("Customer updated");
12609
+ handleSuccess();
12610
+ },
12611
+ onError: (error) => {
12612
+ ui.toast.error(error.message);
12613
+ }
12614
+ }
12615
+ );
12616
+ });
12617
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12618
+ KeyboundForm,
12619
+ {
12620
+ className: "flex flex-1 flex-col overflow-hidden",
12621
+ onSubmit,
12622
+ children: [
12623
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
12624
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx(Illustration, {}) }),
12625
+ currentCustomer && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-3", children: [
12626
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
12627
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
12628
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { children: "The customer that is currently associated with this draft order." })
12629
+ ] }),
12630
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { disabled: true, value: currentCustomer.value, children: [
12631
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
12632
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
12633
+ ] })
12634
+ ] }),
12635
+ /* @__PURE__ */ jsxRuntime.jsx(
12636
+ CustomerField,
12637
+ {
12638
+ control: form.control,
12639
+ currentCustomerId: order.customer_id
12640
+ }
12641
+ )
12642
+ ] }),
12643
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
12644
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", children: "Cancel" }) }),
12645
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12646
+ ] }) })
12647
+ ]
12648
+ }
12649
+ ) });
12650
+ };
12651
+ const CustomerField = ({ control, currentCustomerId }) => {
12652
+ const customers = useComboboxData({
12653
+ queryFn: async (params) => {
12654
+ return await sdk.admin.customer.list({
12655
+ ...params,
12656
+ id: currentCustomerId ? { $nin: [currentCustomerId] } : void 0
12657
+ });
12658
+ },
12659
+ queryKey: ["customers"],
12660
+ getOptions: (data) => {
12661
+ return data.customers.map((customer) => {
12662
+ const name = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
12663
+ return {
12664
+ label: name ? `${name} (${customer.email})` : customer.email,
12665
+ value: customer.id
12666
+ };
12667
+ });
12668
+ }
12669
+ });
12670
+ return /* @__PURE__ */ jsxRuntime.jsx(
12671
+ Form$2.Field,
12469
12672
  {
12470
12673
  name: "customer_id",
12471
12674
  control,
@@ -12838,212 +13041,9 @@ const Illustration = () => {
12838
13041
  }
12839
13042
  );
12840
13043
  };
12841
- const schema$1 = objectType({
13044
+ const schema = objectType({
12842
13045
  customer_id: stringType().min(1)
12843
13046
  });
12844
- const ShippingAddress = () => {
12845
- const { id } = reactRouterDom.useParams();
12846
- const { order, isPending, isError, error } = useOrder(id, {
12847
- fields: "+shipping_address"
12848
- });
12849
- if (isError) {
12850
- throw error;
12851
- }
12852
- const isReady = !isPending && !!order;
12853
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12854
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12855
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12856
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12857
- ] }),
12858
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12859
- ] });
12860
- };
12861
- const ShippingAddressForm = ({ order }) => {
12862
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12863
- const form = reactHookForm.useForm({
12864
- defaultValues: {
12865
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12866
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12867
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12868
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12869
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12870
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12871
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12872
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12873
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12874
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12875
- },
12876
- resolver: zod.zodResolver(schema)
12877
- });
12878
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12879
- const { handleSuccess } = useRouteModal();
12880
- const onSubmit = form.handleSubmit(async (data) => {
12881
- await mutateAsync(
12882
- {
12883
- shipping_address: {
12884
- first_name: data.first_name,
12885
- last_name: data.last_name,
12886
- company: data.company,
12887
- address_1: data.address_1,
12888
- address_2: data.address_2,
12889
- city: data.city,
12890
- province: data.province,
12891
- country_code: data.country_code,
12892
- postal_code: data.postal_code,
12893
- phone: data.phone
12894
- }
12895
- },
12896
- {
12897
- onSuccess: () => {
12898
- handleSuccess();
12899
- },
12900
- onError: (error) => {
12901
- ui.toast.error(error.message);
12902
- }
12903
- }
12904
- );
12905
- });
12906
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12907
- KeyboundForm,
12908
- {
12909
- className: "flex flex-1 flex-col overflow-hidden",
12910
- onSubmit,
12911
- children: [
12912
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12913
- /* @__PURE__ */ jsxRuntime.jsx(
12914
- Form$2.Field,
12915
- {
12916
- control: form.control,
12917
- name: "country_code",
12918
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12919
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12921
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12922
- ] })
12923
- }
12924
- ),
12925
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12926
- /* @__PURE__ */ jsxRuntime.jsx(
12927
- Form$2.Field,
12928
- {
12929
- control: form.control,
12930
- name: "first_name",
12931
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12932
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12934
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12935
- ] })
12936
- }
12937
- ),
12938
- /* @__PURE__ */ jsxRuntime.jsx(
12939
- Form$2.Field,
12940
- {
12941
- control: form.control,
12942
- name: "last_name",
12943
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12944
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12946
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12947
- ] })
12948
- }
12949
- )
12950
- ] }),
12951
- /* @__PURE__ */ jsxRuntime.jsx(
12952
- Form$2.Field,
12953
- {
12954
- control: form.control,
12955
- name: "company",
12956
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12957
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12959
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12960
- ] })
12961
- }
12962
- ),
12963
- /* @__PURE__ */ jsxRuntime.jsx(
12964
- Form$2.Field,
12965
- {
12966
- control: form.control,
12967
- name: "address_1",
12968
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12969
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12972
- ] })
12973
- }
12974
- ),
12975
- /* @__PURE__ */ jsxRuntime.jsx(
12976
- Form$2.Field,
12977
- {
12978
- control: form.control,
12979
- name: "address_2",
12980
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12981
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12983
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12984
- ] })
12985
- }
12986
- ),
12987
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12988
- /* @__PURE__ */ jsxRuntime.jsx(
12989
- Form$2.Field,
12990
- {
12991
- control: form.control,
12992
- name: "postal_code",
12993
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12994
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12996
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12997
- ] })
12998
- }
12999
- ),
13000
- /* @__PURE__ */ jsxRuntime.jsx(
13001
- Form$2.Field,
13002
- {
13003
- control: form.control,
13004
- name: "city",
13005
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13006
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13008
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13009
- ] })
13010
- }
13011
- )
13012
- ] }),
13013
- /* @__PURE__ */ jsxRuntime.jsx(
13014
- Form$2.Field,
13015
- {
13016
- control: form.control,
13017
- name: "province",
13018
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13021
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13022
- ] })
13023
- }
13024
- ),
13025
- /* @__PURE__ */ jsxRuntime.jsx(
13026
- Form$2.Field,
13027
- {
13028
- control: form.control,
13029
- name: "phone",
13030
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13031
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13033
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13034
- ] })
13035
- }
13036
- )
13037
- ] }) }),
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13040
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13041
- ] }) })
13042
- ]
13043
- }
13044
- ) });
13045
- };
13046
- const schema = addressSchema;
13047
13047
  const widgetModule = { widgets: [] };
13048
13048
  const routeModule = {
13049
13049
  routes: [
@@ -13068,6 +13068,10 @@ const routeModule = {
13068
13068
  Component: BillingAddress,
13069
13069
  path: "/draft-orders/:id/billing-address"
13070
13070
  },
13071
+ {
13072
+ Component: CustomItems,
13073
+ path: "/draft-orders/:id/custom-items"
13074
+ },
13071
13075
  {
13072
13076
  Component: Email,
13073
13077
  path: "/draft-orders/:id/email"
@@ -13076,10 +13080,6 @@ const routeModule = {
13076
13080
  Component: Items,
13077
13081
  path: "/draft-orders/:id/items"
13078
13082
  },
13079
- {
13080
- Component: CustomItems,
13081
- path: "/draft-orders/:id/custom-items"
13082
- },
13083
13083
  {
13084
13084
  Component: Metadata,
13085
13085
  path: "/draft-orders/:id/metadata"
@@ -13088,21 +13088,21 @@ const routeModule = {
13088
13088
  Component: Promotions,
13089
13089
  path: "/draft-orders/:id/promotions"
13090
13090
  },
13091
- {
13092
- Component: SalesChannel,
13093
- path: "/draft-orders/:id/sales-channel"
13094
- },
13095
13091
  {
13096
13092
  Component: Shipping,
13097
13093
  path: "/draft-orders/:id/shipping"
13098
13094
  },
13099
- {
13100
- Component: TransferOwnership,
13101
- path: "/draft-orders/:id/transfer-ownership"
13102
- },
13103
13095
  {
13104
13096
  Component: ShippingAddress,
13105
13097
  path: "/draft-orders/:id/shipping-address"
13098
+ },
13099
+ {
13100
+ Component: SalesChannel,
13101
+ path: "/draft-orders/:id/sales-channel"
13102
+ },
13103
+ {
13104
+ Component: TransferOwnership,
13105
+ path: "/draft-orders/:id/transfer-ownership"
13106
13106
  }
13107
13107
  ]
13108
13108
  }