@medusajs/draft-order 2.11.0-preview-20251019000333 → 2.11.0-preview-20251019060156

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.
@@ -9573,196 +9573,27 @@ const ID = () => {
9573
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9574
9574
  ] });
9575
9575
  };
9576
- const BillingAddress = () => {
9577
- const { id } = reactRouterDom.useParams();
9578
- const { order, isPending, isError, error } = useOrder(id, {
9579
- fields: "+billing_address"
9580
- });
9581
- if (isError) {
9582
- throw error;
9583
- }
9584
- const isReady = !isPending && !!order;
9576
+ const CustomItems = () => {
9585
9577
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9586
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9587
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9588
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9589
- ] }),
9590
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9578
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9579
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9591
9580
  ] });
9592
9581
  };
9593
- const BillingAddressForm = ({ order }) => {
9594
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9582
+ const CustomItemsForm = () => {
9595
9583
  const form = reactHookForm.useForm({
9596
- defaultValues: {
9597
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9598
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9599
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9600
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9601
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9602
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9603
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9604
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9605
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9606
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9607
- },
9608
9584
  resolver: zod.zodResolver(schema$5)
9609
9585
  });
9610
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9611
- const { handleSuccess } = useRouteModal();
9612
- const onSubmit = form.handleSubmit(async (data) => {
9613
- await mutateAsync(
9614
- { billing_address: data },
9615
- {
9616
- onSuccess: () => {
9617
- handleSuccess();
9618
- },
9619
- onError: (error) => {
9620
- ui.toast.error(error.message);
9621
- }
9622
- }
9623
- );
9624
- });
9625
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9626
- KeyboundForm,
9627
- {
9628
- className: "flex flex-1 flex-col overflow-hidden",
9629
- onSubmit,
9630
- children: [
9631
- /* @__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: [
9632
- /* @__PURE__ */ jsxRuntime.jsx(
9633
- Form$2.Field,
9634
- {
9635
- control: form.control,
9636
- name: "country_code",
9637
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9639
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9640
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
- ] })
9642
- }
9643
- ),
9644
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9645
- /* @__PURE__ */ jsxRuntime.jsx(
9646
- Form$2.Field,
9647
- {
9648
- control: form.control,
9649
- name: "first_name",
9650
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9651
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9652
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9653
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9654
- ] })
9655
- }
9656
- ),
9657
- /* @__PURE__ */ jsxRuntime.jsx(
9658
- Form$2.Field,
9659
- {
9660
- control: form.control,
9661
- name: "last_name",
9662
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9664
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9665
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9666
- ] })
9667
- }
9668
- )
9669
- ] }),
9670
- /* @__PURE__ */ jsxRuntime.jsx(
9671
- Form$2.Field,
9672
- {
9673
- control: form.control,
9674
- name: "company",
9675
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9676
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9677
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9678
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9679
- ] })
9680
- }
9681
- ),
9682
- /* @__PURE__ */ jsxRuntime.jsx(
9683
- Form$2.Field,
9684
- {
9685
- control: form.control,
9686
- name: "address_1",
9687
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9688
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9689
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9690
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9691
- ] })
9692
- }
9693
- ),
9694
- /* @__PURE__ */ jsxRuntime.jsx(
9695
- Form$2.Field,
9696
- {
9697
- control: form.control,
9698
- name: "address_2",
9699
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9701
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9702
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9703
- ] })
9704
- }
9705
- ),
9706
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9707
- /* @__PURE__ */ jsxRuntime.jsx(
9708
- Form$2.Field,
9709
- {
9710
- control: form.control,
9711
- name: "postal_code",
9712
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9713
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9714
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9715
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9716
- ] })
9717
- }
9718
- ),
9719
- /* @__PURE__ */ jsxRuntime.jsx(
9720
- Form$2.Field,
9721
- {
9722
- control: form.control,
9723
- name: "city",
9724
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9726
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9727
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9728
- ] })
9729
- }
9730
- )
9731
- ] }),
9732
- /* @__PURE__ */ jsxRuntime.jsx(
9733
- Form$2.Field,
9734
- {
9735
- control: form.control,
9736
- name: "province",
9737
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9738
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9739
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9740
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9741
- ] })
9742
- }
9743
- ),
9744
- /* @__PURE__ */ jsxRuntime.jsx(
9745
- Form$2.Field,
9746
- {
9747
- control: form.control,
9748
- name: "phone",
9749
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9750
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9751
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9752
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9753
- ] })
9754
- }
9755
- )
9756
- ] }) }),
9757
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9758
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9759
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9760
- ] }) })
9761
- ]
9762
- }
9763
- ) });
9586
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9587
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9588
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9589
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9590
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9591
+ ] }) })
9592
+ ] }) });
9764
9593
  };
9765
- const schema$5 = addressSchema;
9594
+ const schema$5 = objectType({
9595
+ email: stringType().email()
9596
+ });
9766
9597
  const Email = () => {
9767
9598
  const { id } = reactRouterDom.useParams();
9768
9599
  const { order, isPending, isError, error } = useOrder(id, {
@@ -12345,247 +12176,44 @@ const CustomAmountField = ({
12345
12176
  }
12346
12177
  );
12347
12178
  };
12348
- const ShippingAddress = () => {
12179
+ const TransferOwnership = () => {
12349
12180
  const { id } = reactRouterDom.useParams();
12350
- const { order, isPending, isError, error } = useOrder(id, {
12351
- fields: "+shipping_address"
12181
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12182
+ fields: "id,customer_id,customer.*"
12352
12183
  });
12353
12184
  if (isError) {
12354
12185
  throw error;
12355
12186
  }
12356
- const isReady = !isPending && !!order;
12187
+ const isReady = !isPending && !!draft_order;
12357
12188
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12358
12189
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12359
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12360
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12190
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Transfer Ownership" }) }),
12191
+ /* @__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" }) })
12361
12192
  ] }),
12362
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12193
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(TransferOwnershipForm, { order: draft_order })
12363
12194
  ] });
12364
12195
  };
12365
- const ShippingAddressForm = ({ order }) => {
12366
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12196
+ const TransferOwnershipForm = ({ order }) => {
12197
+ var _a, _b;
12367
12198
  const form = reactHookForm.useForm({
12368
12199
  defaultValues: {
12369
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12370
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12371
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12372
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12373
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12374
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12375
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12376
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12377
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12378
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12200
+ customer_id: order.customer_id || ""
12379
12201
  },
12380
12202
  resolver: zod.zodResolver(schema$2)
12381
12203
  });
12382
12204
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12383
12205
  const { handleSuccess } = useRouteModal();
12206
+ const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12207
+ const currentCustomer = order.customer ? {
12208
+ label: name ? `${name} (${order.customer.email})` : order.customer.email,
12209
+ value: order.customer.id
12210
+ } : null;
12384
12211
  const onSubmit = form.handleSubmit(async (data) => {
12385
12212
  await mutateAsync(
12386
- {
12387
- shipping_address: {
12388
- first_name: data.first_name,
12389
- last_name: data.last_name,
12390
- company: data.company,
12391
- address_1: data.address_1,
12392
- address_2: data.address_2,
12393
- city: data.city,
12394
- province: data.province,
12395
- country_code: data.country_code,
12396
- postal_code: data.postal_code,
12397
- phone: data.phone
12398
- }
12399
- },
12213
+ { customer_id: data.customer_id },
12400
12214
  {
12401
12215
  onSuccess: () => {
12402
- handleSuccess();
12403
- },
12404
- onError: (error) => {
12405
- ui.toast.error(error.message);
12406
- }
12407
- }
12408
- );
12409
- });
12410
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12411
- KeyboundForm,
12412
- {
12413
- className: "flex flex-1 flex-col overflow-hidden",
12414
- onSubmit,
12415
- children: [
12416
- /* @__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: [
12417
- /* @__PURE__ */ jsxRuntime.jsx(
12418
- Form$2.Field,
12419
- {
12420
- control: form.control,
12421
- name: "country_code",
12422
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12423
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12424
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12425
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12426
- ] })
12427
- }
12428
- ),
12429
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12430
- /* @__PURE__ */ jsxRuntime.jsx(
12431
- Form$2.Field,
12432
- {
12433
- control: form.control,
12434
- name: "first_name",
12435
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12436
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12437
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12438
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12439
- ] })
12440
- }
12441
- ),
12442
- /* @__PURE__ */ jsxRuntime.jsx(
12443
- Form$2.Field,
12444
- {
12445
- control: form.control,
12446
- name: "last_name",
12447
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12448
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12449
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12450
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12451
- ] })
12452
- }
12453
- )
12454
- ] }),
12455
- /* @__PURE__ */ jsxRuntime.jsx(
12456
- Form$2.Field,
12457
- {
12458
- control: form.control,
12459
- name: "company",
12460
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12461
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12462
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12463
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12464
- ] })
12465
- }
12466
- ),
12467
- /* @__PURE__ */ jsxRuntime.jsx(
12468
- Form$2.Field,
12469
- {
12470
- control: form.control,
12471
- name: "address_1",
12472
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12473
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12474
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12475
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12476
- ] })
12477
- }
12478
- ),
12479
- /* @__PURE__ */ jsxRuntime.jsx(
12480
- Form$2.Field,
12481
- {
12482
- control: form.control,
12483
- name: "address_2",
12484
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12485
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12486
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12487
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12488
- ] })
12489
- }
12490
- ),
12491
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12492
- /* @__PURE__ */ jsxRuntime.jsx(
12493
- Form$2.Field,
12494
- {
12495
- control: form.control,
12496
- name: "postal_code",
12497
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12498
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12499
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12500
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12501
- ] })
12502
- }
12503
- ),
12504
- /* @__PURE__ */ jsxRuntime.jsx(
12505
- Form$2.Field,
12506
- {
12507
- control: form.control,
12508
- name: "city",
12509
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12510
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12511
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12512
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12513
- ] })
12514
- }
12515
- )
12516
- ] }),
12517
- /* @__PURE__ */ jsxRuntime.jsx(
12518
- Form$2.Field,
12519
- {
12520
- control: form.control,
12521
- name: "province",
12522
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12523
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12524
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12525
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12526
- ] })
12527
- }
12528
- ),
12529
- /* @__PURE__ */ jsxRuntime.jsx(
12530
- Form$2.Field,
12531
- {
12532
- control: form.control,
12533
- name: "phone",
12534
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12535
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12536
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12537
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12538
- ] })
12539
- }
12540
- )
12541
- ] }) }),
12542
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12543
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12544
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12545
- ] }) })
12546
- ]
12547
- }
12548
- ) });
12549
- };
12550
- const schema$2 = addressSchema;
12551
- const TransferOwnership = () => {
12552
- const { id } = reactRouterDom.useParams();
12553
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12554
- fields: "id,customer_id,customer.*"
12555
- });
12556
- if (isError) {
12557
- throw error;
12558
- }
12559
- const isReady = !isPending && !!draft_order;
12560
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12561
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12562
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Transfer Ownership" }) }),
12563
- /* @__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" }) })
12564
- ] }),
12565
- isReady && /* @__PURE__ */ jsxRuntime.jsx(TransferOwnershipForm, { order: draft_order })
12566
- ] });
12567
- };
12568
- const TransferOwnershipForm = ({ order }) => {
12569
- var _a, _b;
12570
- const form = reactHookForm.useForm({
12571
- defaultValues: {
12572
- customer_id: order.customer_id || ""
12573
- },
12574
- resolver: zod.zodResolver(schema$1)
12575
- });
12576
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12577
- const { handleSuccess } = useRouteModal();
12578
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12579
- const currentCustomer = order.customer ? {
12580
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12581
- value: order.customer.id
12582
- } : null;
12583
- const onSubmit = form.handleSubmit(async (data) => {
12584
- await mutateAsync(
12585
- { customer_id: data.customer_id },
12586
- {
12587
- onSuccess: () => {
12588
- ui.toast.success("Customer updated");
12216
+ ui.toast.success("Customer updated");
12589
12217
  handleSuccess();
12590
12218
  },
12591
12219
  onError: (error) => {
@@ -13021,53 +12649,425 @@ const Illustration = () => {
13021
12649
  }
13022
12650
  );
13023
12651
  };
13024
- const schema$1 = objectType({
12652
+ const schema$2 = objectType({
13025
12653
  customer_id: stringType().min(1)
13026
12654
  });
13027
- const CustomItems = () => {
12655
+ const ShippingAddress = () => {
12656
+ const { id } = reactRouterDom.useParams();
12657
+ const { order, isPending, isError, error } = useOrder(id, {
12658
+ fields: "+shipping_address"
12659
+ });
12660
+ if (isError) {
12661
+ throw error;
12662
+ }
12663
+ const isReady = !isPending && !!order;
13028
12664
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
13029
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
13030
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12665
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12666
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12667
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12668
+ ] }),
12669
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
13031
12670
  ] });
13032
12671
  };
13033
- const CustomItemsForm = () => {
12672
+ const ShippingAddressForm = ({ order }) => {
12673
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13034
12674
  const form = reactHookForm.useForm({
13035
- resolver: zod.zodResolver(schema)
12675
+ defaultValues: {
12676
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12677
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12678
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12679
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12680
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12681
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12682
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12683
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12684
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12685
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12686
+ },
12687
+ resolver: zod.zodResolver(schema$1)
13036
12688
  });
13037
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
13042
- ] }) })
13043
- ] }) });
13044
- };
13045
- const schema = objectType({
13046
- email: stringType().email()
13047
- });
13048
- const widgetModule = { widgets: [] };
13049
- const routeModule = {
13050
- routes: [
13051
- {
13052
- Component: List,
13053
- path: "/draft-orders",
13054
- handle: handle$1,
13055
- children: [
13056
- {
13057
- Component: Create,
13058
- path: "/draft-orders/create"
12689
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12690
+ const { handleSuccess } = useRouteModal();
12691
+ const onSubmit = form.handleSubmit(async (data) => {
12692
+ await mutateAsync(
12693
+ {
12694
+ shipping_address: {
12695
+ first_name: data.first_name,
12696
+ last_name: data.last_name,
12697
+ company: data.company,
12698
+ address_1: data.address_1,
12699
+ address_2: data.address_2,
12700
+ city: data.city,
12701
+ province: data.province,
12702
+ country_code: data.country_code,
12703
+ postal_code: data.postal_code,
12704
+ phone: data.phone
13059
12705
  }
13060
- ]
13061
- },
13062
- {
13063
- Component: ID,
13064
- path: "/draft-orders/:id",
13065
- handle,
13066
- loader,
13067
- children: [
13068
- {
13069
- Component: BillingAddress,
13070
- path: "/draft-orders/:id/billing-address"
12706
+ },
12707
+ {
12708
+ onSuccess: () => {
12709
+ handleSuccess();
12710
+ },
12711
+ onError: (error) => {
12712
+ ui.toast.error(error.message);
12713
+ }
12714
+ }
12715
+ );
12716
+ });
12717
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12718
+ KeyboundForm,
12719
+ {
12720
+ className: "flex flex-1 flex-col overflow-hidden",
12721
+ onSubmit,
12722
+ children: [
12723
+ /* @__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: [
12724
+ /* @__PURE__ */ jsxRuntime.jsx(
12725
+ Form$2.Field,
12726
+ {
12727
+ control: form.control,
12728
+ name: "country_code",
12729
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12730
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12731
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12732
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12733
+ ] })
12734
+ }
12735
+ ),
12736
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12737
+ /* @__PURE__ */ jsxRuntime.jsx(
12738
+ Form$2.Field,
12739
+ {
12740
+ control: form.control,
12741
+ name: "first_name",
12742
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12743
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12744
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12745
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12746
+ ] })
12747
+ }
12748
+ ),
12749
+ /* @__PURE__ */ jsxRuntime.jsx(
12750
+ Form$2.Field,
12751
+ {
12752
+ control: form.control,
12753
+ name: "last_name",
12754
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12755
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12756
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12757
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12758
+ ] })
12759
+ }
12760
+ )
12761
+ ] }),
12762
+ /* @__PURE__ */ jsxRuntime.jsx(
12763
+ Form$2.Field,
12764
+ {
12765
+ control: form.control,
12766
+ name: "company",
12767
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12768
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12769
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12770
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12771
+ ] })
12772
+ }
12773
+ ),
12774
+ /* @__PURE__ */ jsxRuntime.jsx(
12775
+ Form$2.Field,
12776
+ {
12777
+ control: form.control,
12778
+ name: "address_1",
12779
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12780
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12781
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12782
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12783
+ ] })
12784
+ }
12785
+ ),
12786
+ /* @__PURE__ */ jsxRuntime.jsx(
12787
+ Form$2.Field,
12788
+ {
12789
+ control: form.control,
12790
+ name: "address_2",
12791
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12792
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12793
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12794
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12795
+ ] })
12796
+ }
12797
+ ),
12798
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12799
+ /* @__PURE__ */ jsxRuntime.jsx(
12800
+ Form$2.Field,
12801
+ {
12802
+ control: form.control,
12803
+ name: "postal_code",
12804
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12805
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12806
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12807
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12808
+ ] })
12809
+ }
12810
+ ),
12811
+ /* @__PURE__ */ jsxRuntime.jsx(
12812
+ Form$2.Field,
12813
+ {
12814
+ control: form.control,
12815
+ name: "city",
12816
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12817
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12818
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12819
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12820
+ ] })
12821
+ }
12822
+ )
12823
+ ] }),
12824
+ /* @__PURE__ */ jsxRuntime.jsx(
12825
+ Form$2.Field,
12826
+ {
12827
+ control: form.control,
12828
+ name: "province",
12829
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12830
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12831
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12832
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12833
+ ] })
12834
+ }
12835
+ ),
12836
+ /* @__PURE__ */ jsxRuntime.jsx(
12837
+ Form$2.Field,
12838
+ {
12839
+ control: form.control,
12840
+ name: "phone",
12841
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12842
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12843
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12844
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12845
+ ] })
12846
+ }
12847
+ )
12848
+ ] }) }),
12849
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12850
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12851
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12852
+ ] }) })
12853
+ ]
12854
+ }
12855
+ ) });
12856
+ };
12857
+ const schema$1 = addressSchema;
12858
+ const BillingAddress = () => {
12859
+ const { id } = reactRouterDom.useParams();
12860
+ const { order, isPending, isError, error } = useOrder(id, {
12861
+ fields: "+billing_address"
12862
+ });
12863
+ if (isError) {
12864
+ throw error;
12865
+ }
12866
+ const isReady = !isPending && !!order;
12867
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12868
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12869
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
12870
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12871
+ ] }),
12872
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
12873
+ ] });
12874
+ };
12875
+ const BillingAddressForm = ({ order }) => {
12876
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12877
+ const form = reactHookForm.useForm({
12878
+ defaultValues: {
12879
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12880
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12881
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12882
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12883
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12884
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12885
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12886
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12887
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12888
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12889
+ },
12890
+ resolver: zod.zodResolver(schema)
12891
+ });
12892
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12893
+ const { handleSuccess } = useRouteModal();
12894
+ const onSubmit = form.handleSubmit(async (data) => {
12895
+ await mutateAsync(
12896
+ { billing_address: data },
12897
+ {
12898
+ onSuccess: () => {
12899
+ handleSuccess();
12900
+ },
12901
+ onError: (error) => {
12902
+ ui.toast.error(error.message);
12903
+ }
12904
+ }
12905
+ );
12906
+ });
12907
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12908
+ KeyboundForm,
12909
+ {
12910
+ className: "flex flex-1 flex-col overflow-hidden",
12911
+ onSubmit,
12912
+ children: [
12913
+ /* @__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: [
12914
+ /* @__PURE__ */ jsxRuntime.jsx(
12915
+ Form$2.Field,
12916
+ {
12917
+ control: form.control,
12918
+ name: "country_code",
12919
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12920
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12921
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12922
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12923
+ ] })
12924
+ }
12925
+ ),
12926
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12927
+ /* @__PURE__ */ jsxRuntime.jsx(
12928
+ Form$2.Field,
12929
+ {
12930
+ control: form.control,
12931
+ name: "first_name",
12932
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12933
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12934
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12935
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12936
+ ] })
12937
+ }
12938
+ ),
12939
+ /* @__PURE__ */ jsxRuntime.jsx(
12940
+ Form$2.Field,
12941
+ {
12942
+ control: form.control,
12943
+ name: "last_name",
12944
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12945
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12946
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12947
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12948
+ ] })
12949
+ }
12950
+ )
12951
+ ] }),
12952
+ /* @__PURE__ */ jsxRuntime.jsx(
12953
+ Form$2.Field,
12954
+ {
12955
+ control: form.control,
12956
+ name: "company",
12957
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12958
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12959
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12960
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12961
+ ] })
12962
+ }
12963
+ ),
12964
+ /* @__PURE__ */ jsxRuntime.jsx(
12965
+ Form$2.Field,
12966
+ {
12967
+ control: form.control,
12968
+ name: "address_1",
12969
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12970
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12971
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12972
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12973
+ ] })
12974
+ }
12975
+ ),
12976
+ /* @__PURE__ */ jsxRuntime.jsx(
12977
+ Form$2.Field,
12978
+ {
12979
+ control: form.control,
12980
+ name: "address_2",
12981
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12982
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12983
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12984
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12985
+ ] })
12986
+ }
12987
+ ),
12988
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12989
+ /* @__PURE__ */ jsxRuntime.jsx(
12990
+ Form$2.Field,
12991
+ {
12992
+ control: form.control,
12993
+ name: "postal_code",
12994
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12995
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12996
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12997
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12998
+ ] })
12999
+ }
13000
+ ),
13001
+ /* @__PURE__ */ jsxRuntime.jsx(
13002
+ Form$2.Field,
13003
+ {
13004
+ control: form.control,
13005
+ name: "city",
13006
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13007
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
13008
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13009
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13010
+ ] })
13011
+ }
13012
+ )
13013
+ ] }),
13014
+ /* @__PURE__ */ jsxRuntime.jsx(
13015
+ Form$2.Field,
13016
+ {
13017
+ control: form.control,
13018
+ name: "province",
13019
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13020
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13021
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13022
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13023
+ ] })
13024
+ }
13025
+ ),
13026
+ /* @__PURE__ */ jsxRuntime.jsx(
13027
+ Form$2.Field,
13028
+ {
13029
+ control: form.control,
13030
+ name: "phone",
13031
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13032
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13033
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13034
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13035
+ ] })
13036
+ }
13037
+ )
13038
+ ] }) }),
13039
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13042
+ ] }) })
13043
+ ]
13044
+ }
13045
+ ) });
13046
+ };
13047
+ const schema = addressSchema;
13048
+ const widgetModule = { widgets: [] };
13049
+ const routeModule = {
13050
+ routes: [
13051
+ {
13052
+ Component: List,
13053
+ path: "/draft-orders",
13054
+ handle: handle$1,
13055
+ children: [
13056
+ {
13057
+ Component: Create,
13058
+ path: "/draft-orders/create"
13059
+ }
13060
+ ]
13061
+ },
13062
+ {
13063
+ Component: ID,
13064
+ path: "/draft-orders/:id",
13065
+ handle,
13066
+ loader,
13067
+ children: [
13068
+ {
13069
+ Component: CustomItems,
13070
+ path: "/draft-orders/:id/custom-items"
13071
13071
  },
13072
13072
  {
13073
13073
  Component: Email,
@@ -13093,17 +13093,17 @@ const routeModule = {
13093
13093
  Component: Shipping,
13094
13094
  path: "/draft-orders/:id/shipping"
13095
13095
  },
13096
- {
13097
- Component: ShippingAddress,
13098
- path: "/draft-orders/:id/shipping-address"
13099
- },
13100
13096
  {
13101
13097
  Component: TransferOwnership,
13102
13098
  path: "/draft-orders/:id/transfer-ownership"
13103
13099
  },
13104
13100
  {
13105
- Component: CustomItems,
13106
- path: "/draft-orders/:id/custom-items"
13101
+ Component: ShippingAddress,
13102
+ path: "/draft-orders/:id/shipping-address"
13103
+ },
13104
+ {
13105
+ Component: BillingAddress,
13106
+ path: "/draft-orders/:id/billing-address"
13107
13107
  }
13108
13108
  ]
13109
13109
  }