@medusajs/draft-order 2.11.2-snapshot-20251026124930 → 2.11.2-snapshot-20251028102245

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.
@@ -9565,6 +9565,196 @@ const ID = () => {
9565
9565
  /* @__PURE__ */ jsx(Outlet, {})
9566
9566
  ] });
9567
9567
  };
9568
+ const BillingAddress = () => {
9569
+ const { id } = useParams();
9570
+ const { order, isPending, isError, error } = useOrder(id, {
9571
+ fields: "+billing_address"
9572
+ });
9573
+ if (isError) {
9574
+ throw error;
9575
+ }
9576
+ const isReady = !isPending && !!order;
9577
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9578
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9579
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9580
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9581
+ ] }),
9582
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9583
+ ] });
9584
+ };
9585
+ const BillingAddressForm = ({ order }) => {
9586
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9587
+ const form = useForm({
9588
+ defaultValues: {
9589
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9590
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9591
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9592
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9593
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9594
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9595
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9596
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9597
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9598
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9599
+ },
9600
+ resolver: zodResolver(schema$5)
9601
+ });
9602
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9603
+ const { handleSuccess } = useRouteModal();
9604
+ const onSubmit = form.handleSubmit(async (data) => {
9605
+ await mutateAsync(
9606
+ { billing_address: data },
9607
+ {
9608
+ onSuccess: () => {
9609
+ handleSuccess();
9610
+ },
9611
+ onError: (error) => {
9612
+ toast.error(error.message);
9613
+ }
9614
+ }
9615
+ );
9616
+ });
9617
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9618
+ KeyboundForm,
9619
+ {
9620
+ className: "flex flex-1 flex-col overflow-hidden",
9621
+ onSubmit,
9622
+ children: [
9623
+ /* @__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: [
9624
+ /* @__PURE__ */ jsx(
9625
+ Form$2.Field,
9626
+ {
9627
+ control: form.control,
9628
+ name: "country_code",
9629
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9630
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9631
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9632
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9633
+ ] })
9634
+ }
9635
+ ),
9636
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9637
+ /* @__PURE__ */ jsx(
9638
+ Form$2.Field,
9639
+ {
9640
+ control: form.control,
9641
+ name: "first_name",
9642
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9643
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9644
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9645
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9646
+ ] })
9647
+ }
9648
+ ),
9649
+ /* @__PURE__ */ jsx(
9650
+ Form$2.Field,
9651
+ {
9652
+ control: form.control,
9653
+ name: "last_name",
9654
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9655
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9656
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9657
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9658
+ ] })
9659
+ }
9660
+ )
9661
+ ] }),
9662
+ /* @__PURE__ */ jsx(
9663
+ Form$2.Field,
9664
+ {
9665
+ control: form.control,
9666
+ name: "company",
9667
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9668
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9669
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9670
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9671
+ ] })
9672
+ }
9673
+ ),
9674
+ /* @__PURE__ */ jsx(
9675
+ Form$2.Field,
9676
+ {
9677
+ control: form.control,
9678
+ name: "address_1",
9679
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9680
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9681
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9682
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9683
+ ] })
9684
+ }
9685
+ ),
9686
+ /* @__PURE__ */ jsx(
9687
+ Form$2.Field,
9688
+ {
9689
+ control: form.control,
9690
+ name: "address_2",
9691
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9692
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9693
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9694
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9695
+ ] })
9696
+ }
9697
+ ),
9698
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9699
+ /* @__PURE__ */ jsx(
9700
+ Form$2.Field,
9701
+ {
9702
+ control: form.control,
9703
+ name: "postal_code",
9704
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9705
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9706
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9707
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9708
+ ] })
9709
+ }
9710
+ ),
9711
+ /* @__PURE__ */ jsx(
9712
+ Form$2.Field,
9713
+ {
9714
+ control: form.control,
9715
+ name: "city",
9716
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9717
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9718
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9719
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9720
+ ] })
9721
+ }
9722
+ )
9723
+ ] }),
9724
+ /* @__PURE__ */ jsx(
9725
+ Form$2.Field,
9726
+ {
9727
+ control: form.control,
9728
+ name: "province",
9729
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9730
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9731
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9732
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9733
+ ] })
9734
+ }
9735
+ ),
9736
+ /* @__PURE__ */ jsx(
9737
+ Form$2.Field,
9738
+ {
9739
+ control: form.control,
9740
+ name: "phone",
9741
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9742
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9743
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9744
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9745
+ ] })
9746
+ }
9747
+ )
9748
+ ] }) }),
9749
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9750
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9751
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9752
+ ] }) })
9753
+ ]
9754
+ }
9755
+ ) });
9756
+ };
9757
+ const schema$5 = addressSchema;
9568
9758
  const Email = () => {
9569
9759
  const { id } = useParams();
9570
9760
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9587,7 +9777,7 @@ const EmailForm = ({ order }) => {
9587
9777
  defaultValues: {
9588
9778
  email: order.email ?? ""
9589
9779
  },
9590
- resolver: zodResolver(schema$5)
9780
+ resolver: zodResolver(schema$4)
9591
9781
  });
9592
9782
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9593
9783
  const { handleSuccess } = useRouteModal();
@@ -9630,7 +9820,7 @@ const EmailForm = ({ order }) => {
9630
9820
  }
9631
9821
  ) });
9632
9822
  };
9633
- const schema$5 = objectType({
9823
+ const schema$4 = objectType({
9634
9824
  email: stringType().email()
9635
9825
  });
9636
9826
  const NumberInput = forwardRef(
@@ -11234,27 +11424,6 @@ function getPromotionIds(items, shippingMethods) {
11234
11424
  }
11235
11425
  return Array.from(promotionIds);
11236
11426
  }
11237
- const CustomItems = () => {
11238
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11239
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
11240
- /* @__PURE__ */ jsx(CustomItemsForm, {})
11241
- ] });
11242
- };
11243
- const CustomItemsForm = () => {
11244
- const form = useForm({
11245
- resolver: zodResolver(schema$4)
11246
- });
11247
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
11248
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
11249
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11250
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11251
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
11252
- ] }) })
11253
- ] }) });
11254
- };
11255
- const schema$4 = objectType({
11256
- email: stringType().email()
11257
- });
11258
11427
  const SalesChannel = () => {
11259
11428
  const { id } = useParams();
11260
11429
  const { draft_order, isPending, isError, error } = useDraftOrder(
@@ -11361,46 +11530,249 @@ const SalesChannelField = ({ control, order }) => {
11361
11530
  const schema$3 = objectType({
11362
11531
  sales_channel_id: stringType().min(1)
11363
11532
  });
11364
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11365
- const Shipping = () => {
11366
- var _a;
11533
+ const ShippingAddress = () => {
11367
11534
  const { id } = useParams();
11368
11535
  const { order, isPending, isError, error } = useOrder(id, {
11369
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11536
+ fields: "+shipping_address"
11370
11537
  });
11371
- const {
11372
- order: preview,
11373
- isPending: isPreviewPending,
11374
- isError: isPreviewError,
11375
- error: previewError
11376
- } = useOrderPreview(id);
11377
- useInitiateOrderEdit({ preview });
11378
- const { onCancel } = useCancelOrderEdit({ preview });
11379
11538
  if (isError) {
11380
11539
  throw error;
11381
11540
  }
11382
- if (isPreviewError) {
11383
- throw previewError;
11384
- }
11385
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11386
- const isReady = preview && !isPreviewPending && order && !isPending;
11387
- return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11388
- /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11389
- /* @__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: [
11390
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11391
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11392
- ] }) }) }),
11393
- /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11394
- ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11395
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11396
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11397
- ] }) });
11541
+ const isReady = !isPending && !!order;
11542
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11543
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11544
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11545
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11546
+ ] }),
11547
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11548
+ ] });
11398
11549
  };
11399
- const ShippingForm = ({ preview, order }) => {
11400
- var _a;
11401
- const { setIsOpen } = useStackedModal();
11402
- const [isSubmitting, setIsSubmitting] = useState(false);
11403
- const [data, setData] = useState(null);
11550
+ const ShippingAddressForm = ({ order }) => {
11551
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11552
+ const form = useForm({
11553
+ defaultValues: {
11554
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11555
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11556
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11557
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11558
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11559
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11560
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11561
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11562
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11563
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11564
+ },
11565
+ resolver: zodResolver(schema$2)
11566
+ });
11567
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11568
+ const { handleSuccess } = useRouteModal();
11569
+ const onSubmit = form.handleSubmit(async (data) => {
11570
+ await mutateAsync(
11571
+ {
11572
+ shipping_address: {
11573
+ first_name: data.first_name,
11574
+ last_name: data.last_name,
11575
+ company: data.company,
11576
+ address_1: data.address_1,
11577
+ address_2: data.address_2,
11578
+ city: data.city,
11579
+ province: data.province,
11580
+ country_code: data.country_code,
11581
+ postal_code: data.postal_code,
11582
+ phone: data.phone
11583
+ }
11584
+ },
11585
+ {
11586
+ onSuccess: () => {
11587
+ handleSuccess();
11588
+ },
11589
+ onError: (error) => {
11590
+ toast.error(error.message);
11591
+ }
11592
+ }
11593
+ );
11594
+ });
11595
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11596
+ KeyboundForm,
11597
+ {
11598
+ className: "flex flex-1 flex-col overflow-hidden",
11599
+ onSubmit,
11600
+ children: [
11601
+ /* @__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: [
11602
+ /* @__PURE__ */ jsx(
11603
+ Form$2.Field,
11604
+ {
11605
+ control: form.control,
11606
+ name: "country_code",
11607
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11608
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11609
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11610
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11611
+ ] })
11612
+ }
11613
+ ),
11614
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11615
+ /* @__PURE__ */ jsx(
11616
+ Form$2.Field,
11617
+ {
11618
+ control: form.control,
11619
+ name: "first_name",
11620
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11621
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11622
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11623
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11624
+ ] })
11625
+ }
11626
+ ),
11627
+ /* @__PURE__ */ jsx(
11628
+ Form$2.Field,
11629
+ {
11630
+ control: form.control,
11631
+ name: "last_name",
11632
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11633
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11634
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11635
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11636
+ ] })
11637
+ }
11638
+ )
11639
+ ] }),
11640
+ /* @__PURE__ */ jsx(
11641
+ Form$2.Field,
11642
+ {
11643
+ control: form.control,
11644
+ name: "company",
11645
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11646
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11647
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11648
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11649
+ ] })
11650
+ }
11651
+ ),
11652
+ /* @__PURE__ */ jsx(
11653
+ Form$2.Field,
11654
+ {
11655
+ control: form.control,
11656
+ name: "address_1",
11657
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11658
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11659
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11660
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11661
+ ] })
11662
+ }
11663
+ ),
11664
+ /* @__PURE__ */ jsx(
11665
+ Form$2.Field,
11666
+ {
11667
+ control: form.control,
11668
+ name: "address_2",
11669
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11670
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11671
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11672
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11673
+ ] })
11674
+ }
11675
+ ),
11676
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11677
+ /* @__PURE__ */ jsx(
11678
+ Form$2.Field,
11679
+ {
11680
+ control: form.control,
11681
+ name: "postal_code",
11682
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11683
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11684
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11685
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11686
+ ] })
11687
+ }
11688
+ ),
11689
+ /* @__PURE__ */ jsx(
11690
+ Form$2.Field,
11691
+ {
11692
+ control: form.control,
11693
+ name: "city",
11694
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11695
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11696
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11697
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11698
+ ] })
11699
+ }
11700
+ )
11701
+ ] }),
11702
+ /* @__PURE__ */ jsx(
11703
+ Form$2.Field,
11704
+ {
11705
+ control: form.control,
11706
+ name: "province",
11707
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11708
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11709
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11710
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11711
+ ] })
11712
+ }
11713
+ ),
11714
+ /* @__PURE__ */ jsx(
11715
+ Form$2.Field,
11716
+ {
11717
+ control: form.control,
11718
+ name: "phone",
11719
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11720
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11721
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11722
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11723
+ ] })
11724
+ }
11725
+ )
11726
+ ] }) }),
11727
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11728
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11729
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11730
+ ] }) })
11731
+ ]
11732
+ }
11733
+ ) });
11734
+ };
11735
+ const schema$2 = addressSchema;
11736
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11737
+ const Shipping = () => {
11738
+ var _a;
11739
+ const { id } = useParams();
11740
+ const { order, isPending, isError, error } = useOrder(id, {
11741
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11742
+ });
11743
+ const {
11744
+ order: preview,
11745
+ isPending: isPreviewPending,
11746
+ isError: isPreviewError,
11747
+ error: previewError
11748
+ } = useOrderPreview(id);
11749
+ useInitiateOrderEdit({ preview });
11750
+ const { onCancel } = useCancelOrderEdit({ preview });
11751
+ if (isError) {
11752
+ throw error;
11753
+ }
11754
+ if (isPreviewError) {
11755
+ throw previewError;
11756
+ }
11757
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11758
+ const isReady = preview && !isPreviewPending && order && !isPending;
11759
+ return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11760
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11761
+ /* @__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: [
11762
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11763
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11764
+ ] }) }) }),
11765
+ /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11766
+ ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11767
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11768
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11769
+ ] }) });
11770
+ };
11771
+ const ShippingForm = ({ preview, order }) => {
11772
+ var _a;
11773
+ const { setIsOpen } = useStackedModal();
11774
+ const [isSubmitting, setIsSubmitting] = useState(false);
11775
+ const [data, setData] = useState(null);
11404
11776
  const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11405
11777
  const { shipping_options } = useShippingOptions(
11406
11778
  {
@@ -12191,7 +12563,7 @@ const TransferOwnershipForm = ({ order }) => {
12191
12563
  defaultValues: {
12192
12564
  customer_id: order.customer_id || ""
12193
12565
  },
12194
- resolver: zodResolver(schema$2)
12566
+ resolver: zodResolver(schema$1)
12195
12567
  });
12196
12568
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12197
12569
  const { handleSuccess } = useRouteModal();
@@ -12641,402 +13013,30 @@ const Illustration = () => {
12641
13013
  }
12642
13014
  );
12643
13015
  };
12644
- const schema$2 = objectType({
13016
+ const schema$1 = objectType({
12645
13017
  customer_id: stringType().min(1)
12646
13018
  });
12647
- const ShippingAddress = () => {
12648
- const { id } = useParams();
12649
- const { order, isPending, isError, error } = useOrder(id, {
12650
- fields: "+shipping_address"
12651
- });
12652
- if (isError) {
12653
- throw error;
12654
- }
12655
- const isReady = !isPending && !!order;
13019
+ const CustomItems = () => {
12656
13020
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12657
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12658
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12659
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12660
- ] }),
12661
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
13021
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13022
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
12662
13023
  ] });
12663
13024
  };
12664
- const ShippingAddressForm = ({ order }) => {
12665
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13025
+ const CustomItemsForm = () => {
12666
13026
  const form = useForm({
12667
- defaultValues: {
12668
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12669
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12670
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12671
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12672
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12673
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12674
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12675
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12676
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12677
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12678
- },
12679
- resolver: zodResolver(schema$1)
12680
- });
12681
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12682
- const { handleSuccess } = useRouteModal();
12683
- const onSubmit = form.handleSubmit(async (data) => {
12684
- await mutateAsync(
12685
- {
12686
- shipping_address: {
12687
- first_name: data.first_name,
12688
- last_name: data.last_name,
12689
- company: data.company,
12690
- address_1: data.address_1,
12691
- address_2: data.address_2,
12692
- city: data.city,
12693
- province: data.province,
12694
- country_code: data.country_code,
12695
- postal_code: data.postal_code,
12696
- phone: data.phone
12697
- }
12698
- },
12699
- {
12700
- onSuccess: () => {
12701
- handleSuccess();
12702
- },
12703
- onError: (error) => {
12704
- toast.error(error.message);
12705
- }
12706
- }
12707
- );
12708
- });
12709
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12710
- KeyboundForm,
12711
- {
12712
- className: "flex flex-1 flex-col overflow-hidden",
12713
- onSubmit,
12714
- children: [
12715
- /* @__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: [
12716
- /* @__PURE__ */ jsx(
12717
- Form$2.Field,
12718
- {
12719
- control: form.control,
12720
- name: "country_code",
12721
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12722
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12723
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12724
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12725
- ] })
12726
- }
12727
- ),
12728
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12729
- /* @__PURE__ */ jsx(
12730
- Form$2.Field,
12731
- {
12732
- control: form.control,
12733
- name: "first_name",
12734
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12735
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12736
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12737
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12738
- ] })
12739
- }
12740
- ),
12741
- /* @__PURE__ */ jsx(
12742
- Form$2.Field,
12743
- {
12744
- control: form.control,
12745
- name: "last_name",
12746
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12747
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12748
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12749
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12750
- ] })
12751
- }
12752
- )
12753
- ] }),
12754
- /* @__PURE__ */ jsx(
12755
- Form$2.Field,
12756
- {
12757
- control: form.control,
12758
- name: "company",
12759
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12760
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12761
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12762
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12763
- ] })
12764
- }
12765
- ),
12766
- /* @__PURE__ */ jsx(
12767
- Form$2.Field,
12768
- {
12769
- control: form.control,
12770
- name: "address_1",
12771
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12772
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12773
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12774
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12775
- ] })
12776
- }
12777
- ),
12778
- /* @__PURE__ */ jsx(
12779
- Form$2.Field,
12780
- {
12781
- control: form.control,
12782
- name: "address_2",
12783
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12784
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12785
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12786
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12787
- ] })
12788
- }
12789
- ),
12790
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12791
- /* @__PURE__ */ jsx(
12792
- Form$2.Field,
12793
- {
12794
- control: form.control,
12795
- name: "postal_code",
12796
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12797
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12798
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12799
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12800
- ] })
12801
- }
12802
- ),
12803
- /* @__PURE__ */ jsx(
12804
- Form$2.Field,
12805
- {
12806
- control: form.control,
12807
- name: "city",
12808
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12809
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12810
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12811
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12812
- ] })
12813
- }
12814
- )
12815
- ] }),
12816
- /* @__PURE__ */ jsx(
12817
- Form$2.Field,
12818
- {
12819
- control: form.control,
12820
- name: "province",
12821
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12822
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12823
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12824
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12825
- ] })
12826
- }
12827
- ),
12828
- /* @__PURE__ */ jsx(
12829
- Form$2.Field,
12830
- {
12831
- control: form.control,
12832
- name: "phone",
12833
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12834
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12835
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12836
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12837
- ] })
12838
- }
12839
- )
12840
- ] }) }),
12841
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12842
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12843
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12844
- ] }) })
12845
- ]
12846
- }
12847
- ) });
12848
- };
12849
- const schema$1 = addressSchema;
12850
- const BillingAddress = () => {
12851
- const { id } = useParams();
12852
- const { order, isPending, isError, error } = useOrder(id, {
12853
- fields: "+billing_address"
12854
- });
12855
- if (isError) {
12856
- throw error;
12857
- }
12858
- const isReady = !isPending && !!order;
12859
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12860
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12861
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12862
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12863
- ] }),
12864
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12865
- ] });
12866
- };
12867
- const BillingAddressForm = ({ order }) => {
12868
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12869
- const form = useForm({
12870
- defaultValues: {
12871
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12872
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12873
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12874
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12875
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12876
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12877
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12878
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12879
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12880
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12881
- },
12882
13027
  resolver: zodResolver(schema)
12883
13028
  });
12884
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12885
- const { handleSuccess } = useRouteModal();
12886
- const onSubmit = form.handleSubmit(async (data) => {
12887
- await mutateAsync(
12888
- { billing_address: data },
12889
- {
12890
- onSuccess: () => {
12891
- handleSuccess();
12892
- },
12893
- onError: (error) => {
12894
- toast.error(error.message);
12895
- }
12896
- }
12897
- );
12898
- });
12899
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12900
- KeyboundForm,
12901
- {
12902
- className: "flex flex-1 flex-col overflow-hidden",
12903
- onSubmit,
12904
- children: [
12905
- /* @__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: [
12906
- /* @__PURE__ */ jsx(
12907
- Form$2.Field,
12908
- {
12909
- control: form.control,
12910
- name: "country_code",
12911
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12912
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12913
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12914
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12915
- ] })
12916
- }
12917
- ),
12918
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12919
- /* @__PURE__ */ jsx(
12920
- Form$2.Field,
12921
- {
12922
- control: form.control,
12923
- name: "first_name",
12924
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12925
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12926
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12927
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12928
- ] })
12929
- }
12930
- ),
12931
- /* @__PURE__ */ jsx(
12932
- Form$2.Field,
12933
- {
12934
- control: form.control,
12935
- name: "last_name",
12936
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12937
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12938
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12939
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12940
- ] })
12941
- }
12942
- )
12943
- ] }),
12944
- /* @__PURE__ */ jsx(
12945
- Form$2.Field,
12946
- {
12947
- control: form.control,
12948
- name: "company",
12949
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12950
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12951
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12952
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12953
- ] })
12954
- }
12955
- ),
12956
- /* @__PURE__ */ jsx(
12957
- Form$2.Field,
12958
- {
12959
- control: form.control,
12960
- name: "address_1",
12961
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12962
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12963
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12964
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12965
- ] })
12966
- }
12967
- ),
12968
- /* @__PURE__ */ jsx(
12969
- Form$2.Field,
12970
- {
12971
- control: form.control,
12972
- name: "address_2",
12973
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12974
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12975
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12976
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12977
- ] })
12978
- }
12979
- ),
12980
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12981
- /* @__PURE__ */ jsx(
12982
- Form$2.Field,
12983
- {
12984
- control: form.control,
12985
- name: "postal_code",
12986
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12987
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12988
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12989
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12990
- ] })
12991
- }
12992
- ),
12993
- /* @__PURE__ */ jsx(
12994
- Form$2.Field,
12995
- {
12996
- control: form.control,
12997
- name: "city",
12998
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12999
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
13000
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13001
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13002
- ] })
13003
- }
13004
- )
13005
- ] }),
13006
- /* @__PURE__ */ jsx(
13007
- Form$2.Field,
13008
- {
13009
- control: form.control,
13010
- name: "province",
13011
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13012
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13013
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13014
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13015
- ] })
13016
- }
13017
- ),
13018
- /* @__PURE__ */ jsx(
13019
- Form$2.Field,
13020
- {
13021
- control: form.control,
13022
- name: "phone",
13023
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13024
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13025
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13026
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13027
- ] })
13028
- }
13029
- )
13030
- ] }) }),
13031
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13032
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13033
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13034
- ] }) })
13035
- ]
13036
- }
13037
- ) });
13029
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13030
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
13031
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13032
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13033
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
13034
+ ] }) })
13035
+ ] }) });
13038
13036
  };
13039
- const schema = addressSchema;
13037
+ const schema = objectType({
13038
+ email: stringType().email()
13039
+ });
13040
13040
  const widgetModule = { widgets: [] };
13041
13041
  const routeModule = {
13042
13042
  routes: [
@@ -13057,6 +13057,10 @@ const routeModule = {
13057
13057
  handle,
13058
13058
  loader,
13059
13059
  children: [
13060
+ {
13061
+ Component: BillingAddress,
13062
+ path: "/draft-orders/:id/billing-address"
13063
+ },
13060
13064
  {
13061
13065
  Component: Email,
13062
13066
  path: "/draft-orders/:id/email"
@@ -13073,14 +13077,14 @@ const routeModule = {
13073
13077
  Component: Promotions,
13074
13078
  path: "/draft-orders/:id/promotions"
13075
13079
  },
13076
- {
13077
- Component: CustomItems,
13078
- path: "/draft-orders/:id/custom-items"
13079
- },
13080
13080
  {
13081
13081
  Component: SalesChannel,
13082
13082
  path: "/draft-orders/:id/sales-channel"
13083
13083
  },
13084
+ {
13085
+ Component: ShippingAddress,
13086
+ path: "/draft-orders/:id/shipping-address"
13087
+ },
13084
13088
  {
13085
13089
  Component: Shipping,
13086
13090
  path: "/draft-orders/:id/shipping"
@@ -13090,12 +13094,8 @@ const routeModule = {
13090
13094
  path: "/draft-orders/:id/transfer-ownership"
13091
13095
  },
13092
13096
  {
13093
- Component: ShippingAddress,
13094
- path: "/draft-orders/:id/shipping-address"
13095
- },
13096
- {
13097
- Component: BillingAddress,
13098
- path: "/draft-orders/:id/billing-address"
13097
+ Component: CustomItems,
13098
+ path: "/draft-orders/:id/custom-items"
13099
13099
  }
13100
13100
  ]
13101
13101
  }