@medusajs/draft-order 2.10.2-preview-20250902091941 → 2.10.2-preview-20250902120204

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.
@@ -9554,217 +9554,6 @@ const ID = () => {
9554
9554
  /* @__PURE__ */ jsx(Outlet, {})
9555
9555
  ] });
9556
9556
  };
9557
- const BillingAddress = () => {
9558
- const { id } = useParams();
9559
- const { order, isPending, isError, error } = useOrder(id, {
9560
- fields: "+billing_address"
9561
- });
9562
- if (isError) {
9563
- throw error;
9564
- }
9565
- const isReady = !isPending && !!order;
9566
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9567
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9568
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9569
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9570
- ] }),
9571
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9572
- ] });
9573
- };
9574
- const BillingAddressForm = ({ order }) => {
9575
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9576
- const form = useForm({
9577
- defaultValues: {
9578
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9579
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9580
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9581
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9582
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9583
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9584
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9585
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9586
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9587
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9588
- },
9589
- resolver: zodResolver(schema$5)
9590
- });
9591
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9592
- const { handleSuccess } = useRouteModal();
9593
- const onSubmit = form.handleSubmit(async (data) => {
9594
- await mutateAsync(
9595
- { billing_address: data },
9596
- {
9597
- onSuccess: () => {
9598
- handleSuccess();
9599
- },
9600
- onError: (error) => {
9601
- toast.error(error.message);
9602
- }
9603
- }
9604
- );
9605
- });
9606
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9607
- KeyboundForm,
9608
- {
9609
- className: "flex flex-1 flex-col overflow-hidden",
9610
- onSubmit,
9611
- children: [
9612
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
9613
- /* @__PURE__ */ jsx(
9614
- Form$2.Field,
9615
- {
9616
- control: form.control,
9617
- name: "country_code",
9618
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9619
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9620
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9621
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9622
- ] })
9623
- }
9624
- ),
9625
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9626
- /* @__PURE__ */ jsx(
9627
- Form$2.Field,
9628
- {
9629
- control: form.control,
9630
- name: "first_name",
9631
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9632
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9633
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9634
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9635
- ] })
9636
- }
9637
- ),
9638
- /* @__PURE__ */ jsx(
9639
- Form$2.Field,
9640
- {
9641
- control: form.control,
9642
- name: "last_name",
9643
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9644
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9645
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9646
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9647
- ] })
9648
- }
9649
- )
9650
- ] }),
9651
- /* @__PURE__ */ jsx(
9652
- Form$2.Field,
9653
- {
9654
- control: form.control,
9655
- name: "company",
9656
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9657
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9658
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9659
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9660
- ] })
9661
- }
9662
- ),
9663
- /* @__PURE__ */ jsx(
9664
- Form$2.Field,
9665
- {
9666
- control: form.control,
9667
- name: "address_1",
9668
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9669
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9670
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9671
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9672
- ] })
9673
- }
9674
- ),
9675
- /* @__PURE__ */ jsx(
9676
- Form$2.Field,
9677
- {
9678
- control: form.control,
9679
- name: "address_2",
9680
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9681
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9682
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9683
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9684
- ] })
9685
- }
9686
- ),
9687
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9688
- /* @__PURE__ */ jsx(
9689
- Form$2.Field,
9690
- {
9691
- control: form.control,
9692
- name: "postal_code",
9693
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9694
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9695
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9696
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9697
- ] })
9698
- }
9699
- ),
9700
- /* @__PURE__ */ jsx(
9701
- Form$2.Field,
9702
- {
9703
- control: form.control,
9704
- name: "city",
9705
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9706
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9707
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9708
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9709
- ] })
9710
- }
9711
- )
9712
- ] }),
9713
- /* @__PURE__ */ jsx(
9714
- Form$2.Field,
9715
- {
9716
- control: form.control,
9717
- name: "province",
9718
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9720
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9721
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
- ] })
9723
- }
9724
- ),
9725
- /* @__PURE__ */ jsx(
9726
- Form$2.Field,
9727
- {
9728
- control: form.control,
9729
- name: "phone",
9730
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9731
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9732
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9733
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9734
- ] })
9735
- }
9736
- )
9737
- ] }) }),
9738
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9739
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9740
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9741
- ] }) })
9742
- ]
9743
- }
9744
- ) });
9745
- };
9746
- const schema$5 = addressSchema;
9747
- const CustomItems = () => {
9748
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9749
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9750
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9751
- ] });
9752
- };
9753
- const CustomItemsForm = () => {
9754
- const form = useForm({
9755
- resolver: zodResolver(schema$4)
9756
- });
9757
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9758
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9759
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9760
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9761
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9762
- ] }) })
9763
- ] }) });
9764
- };
9765
- const schema$4 = objectType({
9766
- email: stringType().email()
9767
- });
9768
9557
  const Email = () => {
9769
9558
  const { id } = useParams();
9770
9559
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9787,7 +9576,7 @@ const EmailForm = ({ order }) => {
9787
9576
  defaultValues: {
9788
9577
  email: order.email ?? ""
9789
9578
  },
9790
- resolver: zodResolver(schema$3)
9579
+ resolver: zodResolver(schema$5)
9791
9580
  });
9792
9581
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9793
9582
  const { handleSuccess } = useRouteModal();
@@ -9830,7 +9619,28 @@ const EmailForm = ({ order }) => {
9830
9619
  }
9831
9620
  ) });
9832
9621
  };
9833
- const schema$3 = objectType({
9622
+ const schema$5 = objectType({
9623
+ email: stringType().email()
9624
+ });
9625
+ const CustomItems = () => {
9626
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9627
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9628
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9629
+ ] });
9630
+ };
9631
+ const CustomItemsForm = () => {
9632
+ const form = useForm({
9633
+ resolver: zodResolver(schema$4)
9634
+ });
9635
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9636
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9637
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9638
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9639
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9640
+ ] }) })
9641
+ ] }) });
9642
+ };
9643
+ const schema$4 = objectType({
9834
9644
  email: stringType().email()
9835
9645
  });
9836
9646
  const NumberInput = forwardRef(
@@ -11462,7 +11272,7 @@ const SalesChannelForm = ({ order }) => {
11462
11272
  defaultValues: {
11463
11273
  sales_channel_id: order.sales_channel_id || ""
11464
11274
  },
11465
- resolver: zodResolver(schema$2)
11275
+ resolver: zodResolver(schema$3)
11466
11276
  });
11467
11277
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11468
11278
  const { handleSuccess } = useRouteModal();
@@ -11537,32 +11347,235 @@ const SalesChannelField = ({ control, order }) => {
11537
11347
  }
11538
11348
  );
11539
11349
  };
11540
- const schema$2 = objectType({
11350
+ const schema$3 = objectType({
11541
11351
  sales_channel_id: stringType().min(1)
11542
11352
  });
11543
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11544
- const Shipping = () => {
11545
- var _a;
11353
+ const ShippingAddress = () => {
11546
11354
  const { id } = useParams();
11547
11355
  const { order, isPending, isError, error } = useOrder(id, {
11548
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11356
+ fields: "+shipping_address"
11549
11357
  });
11550
- const {
11551
- order: preview,
11552
- isPending: isPreviewPending,
11553
- isError: isPreviewError,
11554
- error: previewError
11555
- } = useOrderPreview(id);
11556
- useInitiateOrderEdit({ preview });
11557
- const { onCancel } = useCancelOrderEdit({ preview });
11558
11358
  if (isError) {
11559
11359
  throw error;
11560
11360
  }
11561
- if (isPreviewError) {
11562
- throw previewError;
11563
- }
11564
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11565
- const isReady = preview && !isPreviewPending && order && !isPending;
11361
+ const isReady = !isPending && !!order;
11362
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11363
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11364
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11365
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11366
+ ] }),
11367
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11368
+ ] });
11369
+ };
11370
+ const ShippingAddressForm = ({ order }) => {
11371
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11372
+ const form = useForm({
11373
+ defaultValues: {
11374
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11375
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11376
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11377
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11378
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11379
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11380
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11381
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11382
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11383
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11384
+ },
11385
+ resolver: zodResolver(schema$2)
11386
+ });
11387
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11388
+ const { handleSuccess } = useRouteModal();
11389
+ const onSubmit = form.handleSubmit(async (data) => {
11390
+ await mutateAsync(
11391
+ {
11392
+ shipping_address: {
11393
+ first_name: data.first_name,
11394
+ last_name: data.last_name,
11395
+ company: data.company,
11396
+ address_1: data.address_1,
11397
+ address_2: data.address_2,
11398
+ city: data.city,
11399
+ province: data.province,
11400
+ country_code: data.country_code,
11401
+ postal_code: data.postal_code,
11402
+ phone: data.phone
11403
+ }
11404
+ },
11405
+ {
11406
+ onSuccess: () => {
11407
+ handleSuccess();
11408
+ },
11409
+ onError: (error) => {
11410
+ toast.error(error.message);
11411
+ }
11412
+ }
11413
+ );
11414
+ });
11415
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11416
+ KeyboundForm,
11417
+ {
11418
+ className: "flex flex-1 flex-col overflow-hidden",
11419
+ onSubmit,
11420
+ children: [
11421
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
11422
+ /* @__PURE__ */ jsx(
11423
+ Form$2.Field,
11424
+ {
11425
+ control: form.control,
11426
+ name: "country_code",
11427
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11428
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11429
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11430
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11431
+ ] })
11432
+ }
11433
+ ),
11434
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11435
+ /* @__PURE__ */ jsx(
11436
+ Form$2.Field,
11437
+ {
11438
+ control: form.control,
11439
+ name: "first_name",
11440
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11441
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11442
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11443
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11444
+ ] })
11445
+ }
11446
+ ),
11447
+ /* @__PURE__ */ jsx(
11448
+ Form$2.Field,
11449
+ {
11450
+ control: form.control,
11451
+ name: "last_name",
11452
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11453
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11454
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11455
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11456
+ ] })
11457
+ }
11458
+ )
11459
+ ] }),
11460
+ /* @__PURE__ */ jsx(
11461
+ Form$2.Field,
11462
+ {
11463
+ control: form.control,
11464
+ name: "company",
11465
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11466
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11467
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11468
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11469
+ ] })
11470
+ }
11471
+ ),
11472
+ /* @__PURE__ */ jsx(
11473
+ Form$2.Field,
11474
+ {
11475
+ control: form.control,
11476
+ name: "address_1",
11477
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11478
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11479
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11480
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11481
+ ] })
11482
+ }
11483
+ ),
11484
+ /* @__PURE__ */ jsx(
11485
+ Form$2.Field,
11486
+ {
11487
+ control: form.control,
11488
+ name: "address_2",
11489
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11490
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11491
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11492
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11493
+ ] })
11494
+ }
11495
+ ),
11496
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11497
+ /* @__PURE__ */ jsx(
11498
+ Form$2.Field,
11499
+ {
11500
+ control: form.control,
11501
+ name: "postal_code",
11502
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11503
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11504
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11505
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11506
+ ] })
11507
+ }
11508
+ ),
11509
+ /* @__PURE__ */ jsx(
11510
+ Form$2.Field,
11511
+ {
11512
+ control: form.control,
11513
+ name: "city",
11514
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11515
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11516
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11517
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11518
+ ] })
11519
+ }
11520
+ )
11521
+ ] }),
11522
+ /* @__PURE__ */ jsx(
11523
+ Form$2.Field,
11524
+ {
11525
+ control: form.control,
11526
+ name: "province",
11527
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11528
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11529
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11530
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11531
+ ] })
11532
+ }
11533
+ ),
11534
+ /* @__PURE__ */ jsx(
11535
+ Form$2.Field,
11536
+ {
11537
+ control: form.control,
11538
+ name: "phone",
11539
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11540
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11541
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11542
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11543
+ ] })
11544
+ }
11545
+ )
11546
+ ] }) }),
11547
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11548
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11549
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11550
+ ] }) })
11551
+ ]
11552
+ }
11553
+ ) });
11554
+ };
11555
+ const schema$2 = addressSchema;
11556
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11557
+ const Shipping = () => {
11558
+ var _a;
11559
+ const { id } = useParams();
11560
+ const { order, isPending, isError, error } = useOrder(id, {
11561
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11562
+ });
11563
+ const {
11564
+ order: preview,
11565
+ isPending: isPreviewPending,
11566
+ isError: isPreviewError,
11567
+ error: previewError
11568
+ } = useOrderPreview(id);
11569
+ useInitiateOrderEdit({ preview });
11570
+ const { onCancel } = useCancelOrderEdit({ preview });
11571
+ if (isError) {
11572
+ throw error;
11573
+ }
11574
+ if (isPreviewError) {
11575
+ throw previewError;
11576
+ }
11577
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11578
+ const isReady = preview && !isPreviewPending && order && !isPending;
11566
11579
  return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11567
11580
  /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11568
11581
  /* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
@@ -12347,244 +12360,41 @@ const CustomAmountField = ({
12347
12360
  }
12348
12361
  );
12349
12362
  };
12350
- const ShippingAddress = () => {
12363
+ const TransferOwnership = () => {
12351
12364
  const { id } = useParams();
12352
- const { order, isPending, isError, error } = useOrder(id, {
12353
- fields: "+shipping_address"
12365
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12366
+ fields: "id,customer_id,customer.*"
12354
12367
  });
12355
12368
  if (isError) {
12356
12369
  throw error;
12357
12370
  }
12358
- const isReady = !isPending && !!order;
12371
+ const isReady = !isPending && !!draft_order;
12359
12372
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12360
12373
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12361
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12362
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12374
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12375
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12363
12376
  ] }),
12364
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12377
+ isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12365
12378
  ] });
12366
12379
  };
12367
- const ShippingAddressForm = ({ order }) => {
12368
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12380
+ const TransferOwnershipForm = ({ order }) => {
12381
+ var _a, _b;
12369
12382
  const form = useForm({
12370
12383
  defaultValues: {
12371
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12372
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12373
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12374
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12375
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12376
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12377
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12378
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12379
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12380
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12384
+ customer_id: order.customer_id || ""
12381
12385
  },
12382
12386
  resolver: zodResolver(schema$1)
12383
12387
  });
12384
12388
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12385
12389
  const { handleSuccess } = useRouteModal();
12390
+ const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12391
+ const currentCustomer = order.customer ? {
12392
+ label: name ? `${name} (${order.customer.email})` : order.customer.email,
12393
+ value: order.customer.id
12394
+ } : null;
12386
12395
  const onSubmit = form.handleSubmit(async (data) => {
12387
12396
  await mutateAsync(
12388
- {
12389
- shipping_address: {
12390
- first_name: data.first_name,
12391
- last_name: data.last_name,
12392
- company: data.company,
12393
- address_1: data.address_1,
12394
- address_2: data.address_2,
12395
- city: data.city,
12396
- province: data.province,
12397
- country_code: data.country_code,
12398
- postal_code: data.postal_code,
12399
- phone: data.phone
12400
- }
12401
- },
12402
- {
12403
- onSuccess: () => {
12404
- handleSuccess();
12405
- },
12406
- onError: (error) => {
12407
- toast.error(error.message);
12408
- }
12409
- }
12410
- );
12411
- });
12412
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12413
- KeyboundForm,
12414
- {
12415
- className: "flex flex-1 flex-col overflow-hidden",
12416
- onSubmit,
12417
- children: [
12418
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12419
- /* @__PURE__ */ jsx(
12420
- Form$2.Field,
12421
- {
12422
- control: form.control,
12423
- name: "country_code",
12424
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12425
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12426
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12427
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12428
- ] })
12429
- }
12430
- ),
12431
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12432
- /* @__PURE__ */ jsx(
12433
- Form$2.Field,
12434
- {
12435
- control: form.control,
12436
- name: "first_name",
12437
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12438
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12439
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12440
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12441
- ] })
12442
- }
12443
- ),
12444
- /* @__PURE__ */ jsx(
12445
- Form$2.Field,
12446
- {
12447
- control: form.control,
12448
- name: "last_name",
12449
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12450
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12451
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12452
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12453
- ] })
12454
- }
12455
- )
12456
- ] }),
12457
- /* @__PURE__ */ jsx(
12458
- Form$2.Field,
12459
- {
12460
- control: form.control,
12461
- name: "company",
12462
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12463
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12464
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12465
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12466
- ] })
12467
- }
12468
- ),
12469
- /* @__PURE__ */ jsx(
12470
- Form$2.Field,
12471
- {
12472
- control: form.control,
12473
- name: "address_1",
12474
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12475
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12476
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12477
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12478
- ] })
12479
- }
12480
- ),
12481
- /* @__PURE__ */ jsx(
12482
- Form$2.Field,
12483
- {
12484
- control: form.control,
12485
- name: "address_2",
12486
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12487
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12488
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12489
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12490
- ] })
12491
- }
12492
- ),
12493
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12494
- /* @__PURE__ */ jsx(
12495
- Form$2.Field,
12496
- {
12497
- control: form.control,
12498
- name: "postal_code",
12499
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12500
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12501
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12502
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12503
- ] })
12504
- }
12505
- ),
12506
- /* @__PURE__ */ jsx(
12507
- Form$2.Field,
12508
- {
12509
- control: form.control,
12510
- name: "city",
12511
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12512
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12513
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12514
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12515
- ] })
12516
- }
12517
- )
12518
- ] }),
12519
- /* @__PURE__ */ jsx(
12520
- Form$2.Field,
12521
- {
12522
- control: form.control,
12523
- name: "province",
12524
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12525
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12526
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12527
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12528
- ] })
12529
- }
12530
- ),
12531
- /* @__PURE__ */ jsx(
12532
- Form$2.Field,
12533
- {
12534
- control: form.control,
12535
- name: "phone",
12536
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12537
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12538
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12539
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12540
- ] })
12541
- }
12542
- )
12543
- ] }) }),
12544
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12545
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12546
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12547
- ] }) })
12548
- ]
12549
- }
12550
- ) });
12551
- };
12552
- const schema$1 = addressSchema;
12553
- const TransferOwnership = () => {
12554
- const { id } = useParams();
12555
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12556
- fields: "id,customer_id,customer.*"
12557
- });
12558
- if (isError) {
12559
- throw error;
12560
- }
12561
- const isReady = !isPending && !!draft_order;
12562
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12563
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12564
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12565
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12566
- ] }),
12567
- isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12568
- ] });
12569
- };
12570
- const TransferOwnershipForm = ({ order }) => {
12571
- var _a, _b;
12572
- const form = useForm({
12573
- defaultValues: {
12574
- customer_id: order.customer_id || ""
12575
- },
12576
- resolver: zodResolver(schema)
12577
- });
12578
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12579
- const { handleSuccess } = useRouteModal();
12580
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12581
- const currentCustomer = order.customer ? {
12582
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12583
- value: order.customer.id
12584
- } : null;
12585
- const onSubmit = form.handleSubmit(async (data) => {
12586
- await mutateAsync(
12587
- { customer_id: data.customer_id },
12397
+ { customer_id: data.customer_id },
12588
12398
  {
12589
12399
  onSuccess: () => {
12590
12400
  toast.success("Customer updated");
@@ -13023,9 +12833,199 @@ const Illustration = () => {
13023
12833
  }
13024
12834
  );
13025
12835
  };
13026
- const schema = objectType({
12836
+ const schema$1 = objectType({
13027
12837
  customer_id: stringType().min(1)
13028
12838
  });
12839
+ const BillingAddress = () => {
12840
+ const { id } = useParams();
12841
+ const { order, isPending, isError, error } = useOrder(id, {
12842
+ fields: "+billing_address"
12843
+ });
12844
+ if (isError) {
12845
+ throw error;
12846
+ }
12847
+ const isReady = !isPending && !!order;
12848
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12849
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12850
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12851
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12852
+ ] }),
12853
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12854
+ ] });
12855
+ };
12856
+ const BillingAddressForm = ({ order }) => {
12857
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12858
+ const form = useForm({
12859
+ defaultValues: {
12860
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12861
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12862
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12863
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12864
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12865
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12866
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12867
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12868
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12869
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12870
+ },
12871
+ resolver: zodResolver(schema)
12872
+ });
12873
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12874
+ const { handleSuccess } = useRouteModal();
12875
+ const onSubmit = form.handleSubmit(async (data) => {
12876
+ await mutateAsync(
12877
+ { billing_address: data },
12878
+ {
12879
+ onSuccess: () => {
12880
+ handleSuccess();
12881
+ },
12882
+ onError: (error) => {
12883
+ toast.error(error.message);
12884
+ }
12885
+ }
12886
+ );
12887
+ });
12888
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12889
+ KeyboundForm,
12890
+ {
12891
+ className: "flex flex-1 flex-col overflow-hidden",
12892
+ onSubmit,
12893
+ children: [
12894
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12895
+ /* @__PURE__ */ jsx(
12896
+ Form$2.Field,
12897
+ {
12898
+ control: form.control,
12899
+ name: "country_code",
12900
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12901
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12902
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12903
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12904
+ ] })
12905
+ }
12906
+ ),
12907
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12908
+ /* @__PURE__ */ jsx(
12909
+ Form$2.Field,
12910
+ {
12911
+ control: form.control,
12912
+ name: "first_name",
12913
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12914
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12915
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12916
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12917
+ ] })
12918
+ }
12919
+ ),
12920
+ /* @__PURE__ */ jsx(
12921
+ Form$2.Field,
12922
+ {
12923
+ control: form.control,
12924
+ name: "last_name",
12925
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12926
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12927
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12928
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12929
+ ] })
12930
+ }
12931
+ )
12932
+ ] }),
12933
+ /* @__PURE__ */ jsx(
12934
+ Form$2.Field,
12935
+ {
12936
+ control: form.control,
12937
+ name: "company",
12938
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12939
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12940
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12941
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12942
+ ] })
12943
+ }
12944
+ ),
12945
+ /* @__PURE__ */ jsx(
12946
+ Form$2.Field,
12947
+ {
12948
+ control: form.control,
12949
+ name: "address_1",
12950
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12951
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12952
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12953
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12954
+ ] })
12955
+ }
12956
+ ),
12957
+ /* @__PURE__ */ jsx(
12958
+ Form$2.Field,
12959
+ {
12960
+ control: form.control,
12961
+ name: "address_2",
12962
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12963
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12964
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12965
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12966
+ ] })
12967
+ }
12968
+ ),
12969
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12970
+ /* @__PURE__ */ jsx(
12971
+ Form$2.Field,
12972
+ {
12973
+ control: form.control,
12974
+ name: "postal_code",
12975
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12976
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12977
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12978
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12979
+ ] })
12980
+ }
12981
+ ),
12982
+ /* @__PURE__ */ jsx(
12983
+ Form$2.Field,
12984
+ {
12985
+ control: form.control,
12986
+ name: "city",
12987
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12988
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12989
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12990
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12991
+ ] })
12992
+ }
12993
+ )
12994
+ ] }),
12995
+ /* @__PURE__ */ jsx(
12996
+ Form$2.Field,
12997
+ {
12998
+ control: form.control,
12999
+ name: "province",
13000
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13001
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13002
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13003
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13004
+ ] })
13005
+ }
13006
+ ),
13007
+ /* @__PURE__ */ jsx(
13008
+ Form$2.Field,
13009
+ {
13010
+ control: form.control,
13011
+ name: "phone",
13012
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13013
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13014
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13015
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13016
+ ] })
13017
+ }
13018
+ )
13019
+ ] }) }),
13020
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13021
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13022
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13023
+ ] }) })
13024
+ ]
13025
+ }
13026
+ ) });
13027
+ };
13028
+ const schema = addressSchema;
13029
13029
  const widgetModule = { widgets: [] };
13030
13030
  const routeModule = {
13031
13031
  routes: [
@@ -13047,17 +13047,13 @@ const routeModule = {
13047
13047
  loader,
13048
13048
  children: [
13049
13049
  {
13050
- Component: BillingAddress,
13051
- path: "/draft-orders/:id/billing-address"
13050
+ Component: Email,
13051
+ path: "/draft-orders/:id/email"
13052
13052
  },
13053
13053
  {
13054
13054
  Component: CustomItems,
13055
13055
  path: "/draft-orders/:id/custom-items"
13056
13056
  },
13057
- {
13058
- Component: Email,
13059
- path: "/draft-orders/:id/email"
13060
- },
13061
13057
  {
13062
13058
  Component: Items,
13063
13059
  path: "/draft-orders/:id/items"
@@ -13074,17 +13070,21 @@ const routeModule = {
13074
13070
  Component: SalesChannel,
13075
13071
  path: "/draft-orders/:id/sales-channel"
13076
13072
  },
13077
- {
13078
- Component: Shipping,
13079
- path: "/draft-orders/:id/shipping"
13080
- },
13081
13073
  {
13082
13074
  Component: ShippingAddress,
13083
13075
  path: "/draft-orders/:id/shipping-address"
13084
13076
  },
13077
+ {
13078
+ Component: Shipping,
13079
+ path: "/draft-orders/:id/shipping"
13080
+ },
13085
13081
  {
13086
13082
  Component: TransferOwnership,
13087
13083
  path: "/draft-orders/:id/transfer-ownership"
13084
+ },
13085
+ {
13086
+ Component: BillingAddress,
13087
+ path: "/draft-orders/:id/billing-address"
13088
13088
  }
13089
13089
  ]
13090
13090
  }