@medusajs/draft-order 2.11.4-preview-20251121120142 → 2.11.4-preview-20251121150135

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,27 +9762,6 @@ 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
- });
9786
9765
  const NumberInput = React.forwardRef(
9787
9766
  ({
9788
9767
  value,
@@ -10757,6 +10736,95 @@ const customItemSchema = objectType({
10757
10736
  quantity: numberType(),
10758
10737
  unit_price: unionType([numberType(), stringType()])
10759
10738
  });
10739
+ const Email = () => {
10740
+ const { id } = reactRouterDom.useParams();
10741
+ const { order, isPending, isError, error } = useOrder(id, {
10742
+ fields: "+email"
10743
+ });
10744
+ if (isError) {
10745
+ throw error;
10746
+ }
10747
+ const isReady = !isPending && !!order;
10748
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10749
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10750
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
10751
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
10752
+ ] }),
10753
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
10754
+ ] });
10755
+ };
10756
+ const EmailForm = ({ order }) => {
10757
+ const form = reactHookForm.useForm({
10758
+ defaultValues: {
10759
+ email: order.email ?? ""
10760
+ },
10761
+ resolver: zod.zodResolver(schema$4)
10762
+ });
10763
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10764
+ const { handleSuccess } = useRouteModal();
10765
+ const onSubmit = form.handleSubmit(async (data) => {
10766
+ await mutateAsync(
10767
+ { email: data.email },
10768
+ {
10769
+ onSuccess: () => {
10770
+ handleSuccess();
10771
+ },
10772
+ onError: (error) => {
10773
+ ui.toast.error(error.message);
10774
+ }
10775
+ }
10776
+ );
10777
+ });
10778
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10779
+ KeyboundForm,
10780
+ {
10781
+ className: "flex flex-1 flex-col overflow-hidden",
10782
+ onSubmit,
10783
+ children: [
10784
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
10785
+ Form$2.Field,
10786
+ {
10787
+ control: form.control,
10788
+ name: "email",
10789
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10790
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
10791
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10792
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10793
+ ] })
10794
+ }
10795
+ ) }),
10796
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10797
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10798
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10799
+ ] }) })
10800
+ ]
10801
+ }
10802
+ ) });
10803
+ };
10804
+ const schema$4 = objectType({
10805
+ email: stringType().email()
10806
+ });
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
+ });
10760
10828
  const InlineTip = React.forwardRef(
10761
10829
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10762
10830
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -11412,7 +11480,7 @@ const SalesChannelForm = ({ order }) => {
11412
11480
  defaultValues: {
11413
11481
  sales_channel_id: order.sales_channel_id || ""
11414
11482
  },
11415
- resolver: zod.zodResolver(schema$3)
11483
+ resolver: zod.zodResolver(schema$2)
11416
11484
  });
11417
11485
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11418
11486
  const { handleSuccess } = useRouteModal();
@@ -11487,7 +11555,7 @@ const SalesChannelField = ({ control, order }) => {
11487
11555
  }
11488
11556
  );
11489
11557
  };
11490
- const schema$3 = objectType({
11558
+ const schema$2 = objectType({
11491
11559
  sales_channel_id: stringType().min(1)
11492
11560
  });
11493
11561
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12297,44 +12365,60 @@ const CustomAmountField = ({
12297
12365
  }
12298
12366
  );
12299
12367
  };
12300
- const TransferOwnership = () => {
12368
+ const ShippingAddress = () => {
12301
12369
  const { id } = reactRouterDom.useParams();
12302
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12303
- fields: "id,customer_id,customer.*"
12370
+ const { order, isPending, isError, error } = useOrder(id, {
12371
+ fields: "+shipping_address"
12304
12372
  });
12305
12373
  if (isError) {
12306
12374
  throw error;
12307
12375
  }
12308
- const isReady = !isPending && !!draft_order;
12376
+ const isReady = !isPending && !!order;
12309
12377
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12310
12378
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12311
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Transfer Ownership" }) }),
12312
- /* @__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" }) })
12379
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12380
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12313
12381
  ] }),
12314
- isReady && /* @__PURE__ */ jsxRuntime.jsx(TransferOwnershipForm, { order: draft_order })
12382
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12315
12383
  ] });
12316
12384
  };
12317
- const TransferOwnershipForm = ({ order }) => {
12318
- var _a, _b;
12385
+ const ShippingAddressForm = ({ order }) => {
12386
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12319
12387
  const form = reactHookForm.useForm({
12320
12388
  defaultValues: {
12321
- customer_id: order.customer_id || ""
12389
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12390
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12391
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12392
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12393
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12394
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12395
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12396
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12397
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12398
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12322
12399
  },
12323
- resolver: zod.zodResolver(schema$2)
12400
+ resolver: zod.zodResolver(schema$1)
12324
12401
  });
12325
12402
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12326
12403
  const { handleSuccess } = useRouteModal();
12327
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12328
- const currentCustomer = order.customer ? {
12329
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12330
- value: order.customer.id
12331
- } : null;
12332
12404
  const onSubmit = form.handleSubmit(async (data) => {
12333
12405
  await mutateAsync(
12334
- { customer_id: data.customer_id },
12406
+ {
12407
+ shipping_address: {
12408
+ first_name: data.first_name,
12409
+ last_name: data.last_name,
12410
+ company: data.company,
12411
+ address_1: data.address_1,
12412
+ address_2: data.address_2,
12413
+ city: data.city,
12414
+ province: data.province,
12415
+ country_code: data.country_code,
12416
+ postal_code: data.postal_code,
12417
+ phone: data.phone
12418
+ }
12419
+ },
12335
12420
  {
12336
12421
  onSuccess: () => {
12337
- ui.toast.success("Customer updated");
12338
12422
  handleSuccess();
12339
12423
  },
12340
12424
  onError: (error) => {
@@ -12349,56 +12433,243 @@ const TransferOwnershipForm = ({ order }) => {
12349
12433
  className: "flex flex-1 flex-col overflow-hidden",
12350
12434
  onSubmit,
12351
12435
  children: [
12352
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
12353
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center bg-ui-bg-component rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsx(Illustration, {}) }),
12354
- currentCustomer && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-3", children: [
12355
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
12356
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "current-customer", children: "Current owner" }),
12357
- /* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { children: "The customer that is currently associated with this draft order." })
12358
- ] }),
12359
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { disabled: true, value: currentCustomer.value, children: [
12360
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { id: "current-customer", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
12361
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: currentCustomer.value, children: currentCustomer.label }) })
12362
- ] })
12436
+ /* @__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: [
12437
+ /* @__PURE__ */ jsxRuntime.jsx(
12438
+ Form$2.Field,
12439
+ {
12440
+ control: form.control,
12441
+ name: "country_code",
12442
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12443
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12444
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12445
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12446
+ ] })
12447
+ }
12448
+ ),
12449
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12450
+ /* @__PURE__ */ jsxRuntime.jsx(
12451
+ Form$2.Field,
12452
+ {
12453
+ control: form.control,
12454
+ name: "first_name",
12455
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12456
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12457
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12458
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12459
+ ] })
12460
+ }
12461
+ ),
12462
+ /* @__PURE__ */ jsxRuntime.jsx(
12463
+ Form$2.Field,
12464
+ {
12465
+ control: form.control,
12466
+ name: "last_name",
12467
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12468
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12469
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12470
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12471
+ ] })
12472
+ }
12473
+ )
12363
12474
  ] }),
12364
12475
  /* @__PURE__ */ jsxRuntime.jsx(
12365
- CustomerField,
12476
+ Form$2.Field,
12366
12477
  {
12367
12478
  control: form.control,
12368
- currentCustomerId: order.customer_id
12479
+ name: "company",
12480
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12481
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12482
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12483
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12484
+ ] })
12369
12485
  }
12370
- )
12371
- ] }),
12372
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
12373
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", children: "Cancel" }) }),
12374
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12375
- ] }) })
12376
- ]
12377
- }
12378
- ) });
12379
- };
12380
- const CustomerField = ({ control, currentCustomerId }) => {
12381
- const customers = useComboboxData({
12382
- queryFn: async (params) => {
12383
- return await sdk.admin.customer.list({
12384
- ...params,
12385
- id: currentCustomerId ? { $nin: [currentCustomerId] } : void 0
12386
- });
12387
- },
12388
- queryKey: ["customers"],
12389
- getOptions: (data) => {
12390
- return data.customers.map((customer) => {
12391
- const name = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
12392
- return {
12393
- label: name ? `${name} (${customer.email})` : customer.email,
12394
- value: customer.id
12395
- };
12396
- });
12397
- }
12398
- });
12399
- return /* @__PURE__ */ jsxRuntime.jsx(
12400
- Form$2.Field,
12401
- {
12486
+ ),
12487
+ /* @__PURE__ */ jsxRuntime.jsx(
12488
+ Form$2.Field,
12489
+ {
12490
+ control: form.control,
12491
+ name: "address_1",
12492
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12493
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12494
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12495
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12496
+ ] })
12497
+ }
12498
+ ),
12499
+ /* @__PURE__ */ jsxRuntime.jsx(
12500
+ Form$2.Field,
12501
+ {
12502
+ control: form.control,
12503
+ name: "address_2",
12504
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12505
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12506
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12507
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12508
+ ] })
12509
+ }
12510
+ ),
12511
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12512
+ /* @__PURE__ */ jsxRuntime.jsx(
12513
+ Form$2.Field,
12514
+ {
12515
+ control: form.control,
12516
+ name: "postal_code",
12517
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12518
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12519
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12520
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12521
+ ] })
12522
+ }
12523
+ ),
12524
+ /* @__PURE__ */ jsxRuntime.jsx(
12525
+ Form$2.Field,
12526
+ {
12527
+ control: form.control,
12528
+ name: "city",
12529
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12530
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12531
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12532
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12533
+ ] })
12534
+ }
12535
+ )
12536
+ ] }),
12537
+ /* @__PURE__ */ jsxRuntime.jsx(
12538
+ Form$2.Field,
12539
+ {
12540
+ control: form.control,
12541
+ name: "province",
12542
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12543
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12544
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12545
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12546
+ ] })
12547
+ }
12548
+ ),
12549
+ /* @__PURE__ */ jsxRuntime.jsx(
12550
+ Form$2.Field,
12551
+ {
12552
+ control: form.control,
12553
+ name: "phone",
12554
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12555
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12556
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12557
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12558
+ ] })
12559
+ }
12560
+ )
12561
+ ] }) }),
12562
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12563
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12564
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12565
+ ] }) })
12566
+ ]
12567
+ }
12568
+ ) });
12569
+ };
12570
+ const schema$1 = addressSchema;
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,
12672
+ {
12402
12673
  name: "customer_id",
12403
12674
  control,
12404
12675
  render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "space-y-3", children: [
@@ -12770,279 +13041,8 @@ const Illustration = () => {
12770
13041
  }
12771
13042
  );
12772
13043
  };
12773
- const schema$2 = objectType({
12774
- customer_id: stringType().min(1)
12775
- });
12776
- const ShippingAddress = () => {
12777
- const { id } = reactRouterDom.useParams();
12778
- const { order, isPending, isError, error } = useOrder(id, {
12779
- fields: "+shipping_address"
12780
- });
12781
- if (isError) {
12782
- throw error;
12783
- }
12784
- const isReady = !isPending && !!order;
12785
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12786
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12787
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12788
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12789
- ] }),
12790
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12791
- ] });
12792
- };
12793
- const ShippingAddressForm = ({ order }) => {
12794
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12795
- const form = reactHookForm.useForm({
12796
- defaultValues: {
12797
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12798
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12799
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12800
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12801
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12802
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12803
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12804
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12805
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12806
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12807
- },
12808
- resolver: zod.zodResolver(schema$1)
12809
- });
12810
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12811
- const { handleSuccess } = useRouteModal();
12812
- const onSubmit = form.handleSubmit(async (data) => {
12813
- await mutateAsync(
12814
- {
12815
- shipping_address: {
12816
- first_name: data.first_name,
12817
- last_name: data.last_name,
12818
- company: data.company,
12819
- address_1: data.address_1,
12820
- address_2: data.address_2,
12821
- city: data.city,
12822
- province: data.province,
12823
- country_code: data.country_code,
12824
- postal_code: data.postal_code,
12825
- phone: data.phone
12826
- }
12827
- },
12828
- {
12829
- onSuccess: () => {
12830
- handleSuccess();
12831
- },
12832
- onError: (error) => {
12833
- ui.toast.error(error.message);
12834
- }
12835
- }
12836
- );
12837
- });
12838
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12839
- KeyboundForm,
12840
- {
12841
- className: "flex flex-1 flex-col overflow-hidden",
12842
- onSubmit,
12843
- children: [
12844
- /* @__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: [
12845
- /* @__PURE__ */ jsxRuntime.jsx(
12846
- Form$2.Field,
12847
- {
12848
- control: form.control,
12849
- name: "country_code",
12850
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12851
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12852
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12853
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12854
- ] })
12855
- }
12856
- ),
12857
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12858
- /* @__PURE__ */ jsxRuntime.jsx(
12859
- Form$2.Field,
12860
- {
12861
- control: form.control,
12862
- name: "first_name",
12863
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12864
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12865
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12866
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12867
- ] })
12868
- }
12869
- ),
12870
- /* @__PURE__ */ jsxRuntime.jsx(
12871
- Form$2.Field,
12872
- {
12873
- control: form.control,
12874
- name: "last_name",
12875
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12876
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12877
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12878
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12879
- ] })
12880
- }
12881
- )
12882
- ] }),
12883
- /* @__PURE__ */ jsxRuntime.jsx(
12884
- Form$2.Field,
12885
- {
12886
- control: form.control,
12887
- name: "company",
12888
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12889
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12890
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12891
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12892
- ] })
12893
- }
12894
- ),
12895
- /* @__PURE__ */ jsxRuntime.jsx(
12896
- Form$2.Field,
12897
- {
12898
- control: form.control,
12899
- name: "address_1",
12900
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12901
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12902
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12903
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12904
- ] })
12905
- }
12906
- ),
12907
- /* @__PURE__ */ jsxRuntime.jsx(
12908
- Form$2.Field,
12909
- {
12910
- control: form.control,
12911
- name: "address_2",
12912
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12913
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12914
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12915
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12916
- ] })
12917
- }
12918
- ),
12919
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12920
- /* @__PURE__ */ jsxRuntime.jsx(
12921
- Form$2.Field,
12922
- {
12923
- control: form.control,
12924
- name: "postal_code",
12925
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12926
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12927
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12928
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12929
- ] })
12930
- }
12931
- ),
12932
- /* @__PURE__ */ jsxRuntime.jsx(
12933
- Form$2.Field,
12934
- {
12935
- control: form.control,
12936
- name: "city",
12937
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12938
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12939
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12940
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12941
- ] })
12942
- }
12943
- )
12944
- ] }),
12945
- /* @__PURE__ */ jsxRuntime.jsx(
12946
- Form$2.Field,
12947
- {
12948
- control: form.control,
12949
- name: "province",
12950
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12951
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12952
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12953
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12954
- ] })
12955
- }
12956
- ),
12957
- /* @__PURE__ */ jsxRuntime.jsx(
12958
- Form$2.Field,
12959
- {
12960
- control: form.control,
12961
- name: "phone",
12962
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12963
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12964
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12965
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12966
- ] })
12967
- }
12968
- )
12969
- ] }) }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12971
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12972
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12973
- ] }) })
12974
- ]
12975
- }
12976
- ) });
12977
- };
12978
- const schema$1 = addressSchema;
12979
- const Email = () => {
12980
- const { id } = reactRouterDom.useParams();
12981
- const { order, isPending, isError, error } = useOrder(id, {
12982
- fields: "+email"
12983
- });
12984
- if (isError) {
12985
- throw error;
12986
- }
12987
- const isReady = !isPending && !!order;
12988
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12989
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12990
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
12991
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12992
- ] }),
12993
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12994
- ] });
12995
- };
12996
- const EmailForm = ({ order }) => {
12997
- const form = reactHookForm.useForm({
12998
- defaultValues: {
12999
- email: order.email ?? ""
13000
- },
13001
- resolver: zod.zodResolver(schema)
13002
- });
13003
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
13004
- const { handleSuccess } = useRouteModal();
13005
- const onSubmit = form.handleSubmit(async (data) => {
13006
- await mutateAsync(
13007
- { email: data.email },
13008
- {
13009
- onSuccess: () => {
13010
- handleSuccess();
13011
- },
13012
- onError: (error) => {
13013
- ui.toast.error(error.message);
13014
- }
13015
- }
13016
- );
13017
- });
13018
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
13019
- KeyboundForm,
13020
- {
13021
- className: "flex flex-1 flex-col overflow-hidden",
13022
- onSubmit,
13023
- children: [
13024
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
13025
- Form$2.Field,
13026
- {
13027
- control: form.control,
13028
- name: "email",
13029
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13030
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
13031
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13033
- ] })
13034
- }
13035
- ) }),
13036
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13037
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13038
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13039
- ] }) })
13040
- ]
13041
- }
13042
- ) });
13043
- };
13044
13044
  const schema = objectType({
13045
- email: stringType().email()
13045
+ customer_id: stringType().min(1)
13046
13046
  });
13047
13047
  const widgetModule = { widgets: [] };
13048
13048
  const routeModule = {
@@ -13068,14 +13068,18 @@ 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
- },
13075
13071
  {
13076
13072
  Component: Items,
13077
13073
  path: "/draft-orders/:id/items"
13078
13074
  },
13075
+ {
13076
+ Component: Email,
13077
+ path: "/draft-orders/:id/email"
13078
+ },
13079
+ {
13080
+ Component: CustomItems,
13081
+ path: "/draft-orders/:id/custom-items"
13082
+ },
13079
13083
  {
13080
13084
  Component: Metadata,
13081
13085
  path: "/draft-orders/:id/metadata"
@@ -13092,17 +13096,13 @@ const routeModule = {
13092
13096
  Component: Shipping,
13093
13097
  path: "/draft-orders/:id/shipping"
13094
13098
  },
13095
- {
13096
- Component: TransferOwnership,
13097
- path: "/draft-orders/:id/transfer-ownership"
13098
- },
13099
13099
  {
13100
13100
  Component: ShippingAddress,
13101
13101
  path: "/draft-orders/:id/shipping-address"
13102
13102
  },
13103
13103
  {
13104
- Component: Email,
13105
- path: "/draft-orders/:id/email"
13104
+ Component: TransferOwnership,
13105
+ path: "/draft-orders/:id/transfer-ownership"
13106
13106
  }
13107
13107
  ]
13108
13108
  }